mirror of
https://github.com/standardnotes/server
synced 2026-05-09 15:57:17 -04:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdd052f90c | |||
| 32fe8d0a85 | |||
| 31338066ef | |||
| 07398169c8 | |||
| 1632c83217 | |||
| 0c29ff1ab4 | |||
| 2a8029ba02 | |||
| 337eae73c6 | |||
| 0a90502658 | |||
| 1246af2551 | |||
| e0b19ef011 | |||
| 63201934a5 | |||
| 4a6f90b95b | |||
| a747f4fc46 | |||
| b782cedc85 |
@@ -3,6 +3,35 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.31.7](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.6...@standardnotes/analytics@2.31.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [2.31.6](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.5...@standardnotes/analytics@2.31.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.31.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.4...@standardnotes/analytics@2.31.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.31.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.3...@standardnotes/analytics@2.31.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/server/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [2.31.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.2...@standardnotes/analytics@2.31.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.31.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.1...@standardnotes/analytics@2.31.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
## [2.31.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.0...@standardnotes/analytics@2.31.1) (2023-10-11)
|
## [2.31.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.0...@standardnotes/analytics@2.31.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/analytics
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { EmailLevel, ServiceIdentifier } from '@standardnotes/domain-core'
|
import { EmailLevel, ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AnalyticsScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AnalyticsWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/analytics",
|
"name": "@standardnotes/analytics",
|
||||||
"version": "2.31.1",
|
"version": "2.31.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
DomainEventSubscriberFactoryInterface,
|
DomainEventSubscriberFactoryInterface,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
|
import { MapperInterface } from '@standardnotes/domain-core'
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const Mixpanel = require('mixpanel')
|
const Mixpanel = require('mixpanel')
|
||||||
|
|
||||||
@@ -16,11 +16,9 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
OpenTelemetryPropagation,
|
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { Timer, TimerInterface } from '@standardnotes/time'
|
import { Timer, TimerInterface } from '@standardnotes/time'
|
||||||
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
|
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
|
||||||
@@ -89,10 +87,6 @@ export class ContainerConfigLoader {
|
|||||||
})
|
})
|
||||||
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
||||||
|
|
||||||
container
|
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
const snsConfig: SNSClientConfig = {
|
const snsConfig: SNSClientConfig = {
|
||||||
apiVersion: 'latest',
|
apiVersion: 'latest',
|
||||||
region: env.get('SNS_AWS_REGION', true),
|
region: env.get('SNS_AWS_REGION', true),
|
||||||
@@ -146,11 +140,7 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SNSOpenTelemetryDomainEventPublisher(
|
new SNSOpenTelemetryDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)),
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR),
|
|
||||||
container.get(TYPES.SNS),
|
|
||||||
container.get(TYPES.SNS_TOPIC_ARN),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
if (env.get('MIXPANEL_TOKEN', true)) {
|
if (env.get('MIXPANEL_TOKEN', true)) {
|
||||||
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
||||||
@@ -248,14 +238,7 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.AnalyticsWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const TYPES = {
|
|||||||
Redis: Symbol.for('Redis'),
|
Redis: Symbol.for('Redis'),
|
||||||
SNS: Symbol.for('SNS'),
|
SNS: Symbol.for('SNS'),
|
||||||
SQS: Symbol.for('SQS'),
|
SQS: Symbol.for('SQS'),
|
||||||
OTEL_PROPAGATOR: Symbol.for('OTEL_PROPAGATOR'),
|
|
||||||
// env vars
|
// env vars
|
||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
||||||
|
|||||||
@@ -3,6 +3,34 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.79.12](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.11...@standardnotes/api-gateway@1.79.12) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/api-gateway/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.79.11](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.10...@standardnotes/api-gateway@1.79.11) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* passing key params for backup requests ([#867](https://github.com/standardnotes/api-gateway/issues/867)) ([0739816](https://github.com/standardnotes/api-gateway/commit/07398169c80e7871cd04d889f471c3eef70e1aae))
|
||||||
|
|
||||||
|
## [1.79.10](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.9...@standardnotes/api-gateway@1.79.10) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.79.9](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.8...@standardnotes/api-gateway@1.79.9) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.79.8](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.7...@standardnotes/api-gateway@1.79.8) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.79.7](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.6...@standardnotes/api-gateway@1.79.7) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
## [1.79.6](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.5...@standardnotes/api-gateway@1.79.6) (2023-10-11)
|
## [1.79.6](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.5...@standardnotes/api-gateway@1.79.6) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.ApiGateway)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.ApiGateway })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import '../src/Controller/LegacyController'
|
import '../src/Controller/LegacyController'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/api-gateway",
|
"name": "@standardnotes/api-gateway",
|
||||||
"version": "1.79.6",
|
"version": "1.79.12",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export class EndpointResolver implements EndpointResolverInterface {
|
|||||||
// Users Controller
|
// Users Controller
|
||||||
['[PATCH]:users/:userId', 'auth.users.update'],
|
['[PATCH]:users/:userId', 'auth.users.update'],
|
||||||
['[PUT]:users/:userUuid/attributes/credentials', 'auth.users.updateCredentials'],
|
['[PUT]:users/:userUuid/attributes/credentials', 'auth.users.updateCredentials'],
|
||||||
['[GET]:users/params', 'auth.users.getKeyParams'],
|
|
||||||
['[DELETE]:users/:userUuid', 'auth.users.delete'],
|
['[DELETE]:users/:userUuid', 'auth.users.delete'],
|
||||||
['[POST]:listed', 'auth.users.createListedAccount'],
|
['[POST]:listed', 'auth.users.createListedAccount'],
|
||||||
['[POST]:auth', 'auth.users.register'],
|
['[POST]:auth', 'auth.users.register'],
|
||||||
|
|||||||
@@ -3,6 +3,37 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.158.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.6...@standardnotes/auth-server@1.158.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.158.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.5...@standardnotes/auth-server@1.158.6) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* passing key params for backup requests ([#867](https://github.com/standardnotes/server/issues/867)) ([0739816](https://github.com/standardnotes/server/commit/07398169c80e7871cd04d889f471c3eef70e1aae))
|
||||||
|
|
||||||
|
## [1.158.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.4...@standardnotes/auth-server@1.158.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.158.4](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.3...@standardnotes/auth-server@1.158.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/server/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.158.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.2...@standardnotes/auth-server@1.158.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.158.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.1...@standardnotes/auth-server@1.158.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
## [1.158.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.0...@standardnotes/auth-server@1.158.1) (2023-10-11)
|
## [1.158.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.0...@standardnotes/auth-server@1.158.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/auth-server
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Stream } from 'stream'
|
import { Stream } from 'stream'
|
||||||
@@ -21,6 +21,7 @@ import { SettingRepositoryInterface } from '../src/Domain/Setting/SettingReposit
|
|||||||
import { MuteFailedBackupsEmailsOption, SettingName } from '@standardnotes/settings'
|
import { MuteFailedBackupsEmailsOption, SettingName } from '@standardnotes/settings'
|
||||||
import { RoleServiceInterface } from '../src/Domain/Role/RoleServiceInterface'
|
import { RoleServiceInterface } from '../src/Domain/Role/RoleServiceInterface'
|
||||||
import { PermissionName } from '@standardnotes/features'
|
import { PermissionName } from '@standardnotes/features'
|
||||||
|
import { GetUserKeyParams } from '../src/Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
||||||
|
|
||||||
const inputArgs = process.argv.slice(2)
|
const inputArgs = process.argv.slice(2)
|
||||||
const backupProvider = inputArgs[0]
|
const backupProvider = inputArgs[0]
|
||||||
@@ -31,6 +32,7 @@ const requestBackups = async (
|
|||||||
roleService: RoleServiceInterface,
|
roleService: RoleServiceInterface,
|
||||||
domainEventFactory: DomainEventFactoryInterface,
|
domainEventFactory: DomainEventFactoryInterface,
|
||||||
domainEventPublisher: DomainEventPublisherInterface,
|
domainEventPublisher: DomainEventPublisherInterface,
|
||||||
|
getUserKeyParamsUseCase: GetUserKeyParams,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const settingName = SettingName.create(SettingName.NAMES.EmailBackupFrequency).getValue()
|
const settingName = SettingName.create(SettingName.NAMES.EmailBackupFrequency).getValue()
|
||||||
const permissionName = PermissionName.DailyEmailBackup
|
const permissionName = PermissionName.DailyEmailBackup
|
||||||
@@ -64,11 +66,17 @@ const requestBackups = async (
|
|||||||
userHasEmailsMuted = emailsMutedSetting.value === muteEmailsSettingValue
|
userHasEmailsMuted = emailsMutedSetting.value === muteEmailsSettingValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const keyParamsResponse = await getUserKeyParamsUseCase.execute({
|
||||||
|
userUuid: setting.setting_user_uuid,
|
||||||
|
authenticated: false,
|
||||||
|
})
|
||||||
|
|
||||||
await domainEventPublisher.publish(
|
await domainEventPublisher.publish(
|
||||||
domainEventFactory.createEmailBackupRequestedEvent(
|
domainEventFactory.createEmailBackupRequestedEvent(
|
||||||
setting.setting_user_uuid,
|
setting.setting_user_uuid,
|
||||||
emailsMutedSetting?.uuid as string,
|
emailsMutedSetting?.uuid as string,
|
||||||
userHasEmailsMuted,
|
userHasEmailsMuted,
|
||||||
|
keyParamsResponse.keyParams,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -96,11 +104,14 @@ void container.load().then((container) => {
|
|||||||
const roleService: RoleServiceInterface = container.get(TYPES.Auth_RoleService)
|
const roleService: RoleServiceInterface = container.get(TYPES.Auth_RoleService)
|
||||||
const domainEventFactory: DomainEventFactoryInterface = container.get(TYPES.Auth_DomainEventFactory)
|
const domainEventFactory: DomainEventFactoryInterface = container.get(TYPES.Auth_DomainEventFactory)
|
||||||
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
||||||
|
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
const tracer = new OpenTelemetryTracer()
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'backup')
|
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'backup')
|
||||||
|
|
||||||
Promise.resolve(requestBackups(settingRepository, roleService, domainEventFactory, domainEventPublisher))
|
Promise.resolve(
|
||||||
|
requestBackups(settingRepository, roleService, domainEventFactory, domainEventPublisher, getUserKeyParamsUseCase),
|
||||||
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`${backupFrequency} ${backupProvider} backup requesting complete`)
|
logger.info(`${backupFrequency} ${backupProvider} backup requesting complete`)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Auth)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Auth })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier, RoleName, TransitionStatus } from '@standardnotes/domain-core'
|
import { ServiceIdentifier, RoleName, TransitionStatus } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { Email, ServiceIdentifier } from '@standardnotes/domain-core'
|
import { Email, ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
@@ -20,6 +20,7 @@ import { MuteFailedBackupsEmailsOption, SettingName } from '@standardnotes/setti
|
|||||||
import { RoleServiceInterface } from '../src/Domain/Role/RoleServiceInterface'
|
import { RoleServiceInterface } from '../src/Domain/Role/RoleServiceInterface'
|
||||||
import { PermissionName } from '@standardnotes/features'
|
import { PermissionName } from '@standardnotes/features'
|
||||||
import { UserRepositoryInterface } from '../src/Domain/User/UserRepositoryInterface'
|
import { UserRepositoryInterface } from '../src/Domain/User/UserRepositoryInterface'
|
||||||
|
import { GetUserKeyParams } from '../src/Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
||||||
|
|
||||||
const inputArgs = process.argv.slice(2)
|
const inputArgs = process.argv.slice(2)
|
||||||
const backupEmail = inputArgs[0]
|
const backupEmail = inputArgs[0]
|
||||||
@@ -30,6 +31,7 @@ const requestBackups = async (
|
|||||||
roleService: RoleServiceInterface,
|
roleService: RoleServiceInterface,
|
||||||
domainEventFactory: DomainEventFactoryInterface,
|
domainEventFactory: DomainEventFactoryInterface,
|
||||||
domainEventPublisher: DomainEventPublisherInterface,
|
domainEventPublisher: DomainEventPublisherInterface,
|
||||||
|
getUserKeyParamsUseCase: GetUserKeyParams,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const permissionName = PermissionName.DailyEmailBackup
|
const permissionName = PermissionName.DailyEmailBackup
|
||||||
const muteEmailsSettingName = SettingName.NAMES.MuteFailedBackupsEmails
|
const muteEmailsSettingName = SettingName.NAMES.MuteFailedBackupsEmails
|
||||||
@@ -57,11 +59,17 @@ const requestBackups = async (
|
|||||||
userHasEmailsMuted = emailsMutedSetting.value === muteEmailsSettingValue
|
userHasEmailsMuted = emailsMutedSetting.value === muteEmailsSettingValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const keyParamsResponse = await getUserKeyParamsUseCase.execute({
|
||||||
|
userUuid: user.uuid,
|
||||||
|
authenticated: false,
|
||||||
|
})
|
||||||
|
|
||||||
await domainEventPublisher.publish(
|
await domainEventPublisher.publish(
|
||||||
domainEventFactory.createEmailBackupRequestedEvent(
|
domainEventFactory.createEmailBackupRequestedEvent(
|
||||||
user.uuid,
|
user.uuid,
|
||||||
emailsMutedSetting?.uuid as string,
|
emailsMutedSetting?.uuid as string,
|
||||||
userHasEmailsMuted,
|
userHasEmailsMuted,
|
||||||
|
keyParamsResponse.keyParams,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -84,12 +92,20 @@ void container.load().then((container) => {
|
|||||||
const roleService: RoleServiceInterface = container.get(TYPES.Auth_RoleService)
|
const roleService: RoleServiceInterface = container.get(TYPES.Auth_RoleService)
|
||||||
const domainEventFactory: DomainEventFactoryInterface = container.get(TYPES.Auth_DomainEventFactory)
|
const domainEventFactory: DomainEventFactoryInterface = container.get(TYPES.Auth_DomainEventFactory)
|
||||||
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
||||||
|
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
const tracer = new OpenTelemetryTracer()
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'user_email_backup')
|
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'user_email_backup')
|
||||||
|
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
requestBackups(userRepository, settingRepository, roleService, domainEventFactory, domainEventPublisher),
|
requestBackups(
|
||||||
|
userRepository,
|
||||||
|
settingRepository,
|
||||||
|
roleService,
|
||||||
|
domainEventFactory,
|
||||||
|
domainEventPublisher,
|
||||||
|
getUserKeyParamsUseCase,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`Email backup requesting complete for ${backupEmail}`)
|
logger.info(`Email backup requesting complete for ${backupEmail}`)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.158.1",
|
"version": "1.158.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -89,12 +89,9 @@ import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyG
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
OpenTelemetryPropagation,
|
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { GetUserSubscription } from '../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
import { GetUserSubscription } from '../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
||||||
import { ChangeCredentials } from '../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
import { ChangeCredentials } from '../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
||||||
@@ -191,7 +188,6 @@ import {
|
|||||||
ControllerContainer,
|
ControllerContainer,
|
||||||
ControllerContainerInterface,
|
ControllerContainerInterface,
|
||||||
MapperInterface,
|
MapperInterface,
|
||||||
ServiceIdentifier,
|
|
||||||
SharedVaultUser,
|
SharedVaultUser,
|
||||||
} from '@standardnotes/domain-core'
|
} from '@standardnotes/domain-core'
|
||||||
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
|
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
|
||||||
@@ -277,6 +273,8 @@ import { UserRemovedFromSharedVaultEventHandler } from '../Domain/Handler/UserRe
|
|||||||
import { DesignateSurvivor } from '../Domain/UseCase/DesignateSurvivor/DesignateSurvivor'
|
import { DesignateSurvivor } from '../Domain/UseCase/DesignateSurvivor/DesignateSurvivor'
|
||||||
import { UserDesignatedAsSurvivorInSharedVaultEventHandler } from '../Domain/Handler/UserDesignatedAsSurvivorInSharedVaultEventHandler'
|
import { UserDesignatedAsSurvivorInSharedVaultEventHandler } from '../Domain/Handler/UserDesignatedAsSurvivorInSharedVaultEventHandler'
|
||||||
import { DisableEmailSettingBasedOnEmailSubscription } from '../Domain/UseCase/DisableEmailSettingBasedOnEmailSubscription/DisableEmailSettingBasedOnEmailSubscription'
|
import { DisableEmailSettingBasedOnEmailSubscription } from '../Domain/UseCase/DisableEmailSettingBasedOnEmailSubscription/DisableEmailSettingBasedOnEmailSubscription'
|
||||||
|
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||||
|
import { KeyParamsFactoryInterface } from '../Domain/User/KeyParamsFactoryInterface'
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
constructor(private mode: 'server' | 'worker' = 'server') {}
|
constructor(private mode: 'server' | 'worker' = 'server') {}
|
||||||
@@ -310,9 +308,7 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
|
||||||
|
|
||||||
container
|
container.bind<CryptoNode>(TYPES.Auth_CryptoNode).toConstantValue(new CryptoNode())
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
@@ -375,6 +371,19 @@ export class ContainerConfigLoader {
|
|||||||
container.bind<SQSClient>(TYPES.Auth_SQS).toConstantValue(sqsClient)
|
container.bind<SQSClient>(TYPES.Auth_SQS).toConstantValue(sqsClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
container.bind(TYPES.Auth_SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
||||||
|
|
||||||
|
container
|
||||||
|
.bind<DomainEventPublisherInterface>(TYPES.Auth_DomainEventPublisher)
|
||||||
|
.toConstantValue(
|
||||||
|
isConfiguredForHomeServer
|
||||||
|
? directCallDomainEventPublisher
|
||||||
|
: new SNSOpenTelemetryDomainEventPublisher(
|
||||||
|
container.get(TYPES.Auth_SNS),
|
||||||
|
container.get(TYPES.Auth_SNS_TOPIC_ARN),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
// Mapping
|
// Mapping
|
||||||
container
|
container
|
||||||
.bind<MapperInterface<SessionTrace, TypeORMSessionTrace>>(TYPES.Auth_SessionTracePersistenceMapper)
|
.bind<MapperInterface<SessionTrace, TypeORMSessionTrace>>(TYPES.Auth_SessionTracePersistenceMapper)
|
||||||
@@ -555,7 +564,6 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind(TYPES.Auth_DISABLE_USER_REGISTRATION)
|
.bind(TYPES.Auth_DISABLE_USER_REGISTRATION)
|
||||||
.toConstantValue(env.get('DISABLE_USER_REGISTRATION', true) === 'true')
|
.toConstantValue(env.get('DISABLE_USER_REGISTRATION', true) === 'true')
|
||||||
container.bind(TYPES.Auth_SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
|
||||||
container.bind(TYPES.Auth_SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.Auth_SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.Auth_SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.Auth_SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
||||||
container
|
container
|
||||||
@@ -657,6 +665,9 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
|
container
|
||||||
|
.bind<SelectorInterface<ProtocolVersion>>(TYPES.Auth_ProtocolVersionSelector)
|
||||||
|
.toConstantValue(new DeterministicSelector<ProtocolVersion>())
|
||||||
container.bind<UAParser>(TYPES.Auth_DeviceDetector).toConstantValue(new UAParser())
|
container.bind<UAParser>(TYPES.Auth_DeviceDetector).toConstantValue(new UAParser())
|
||||||
container.bind<SessionService>(TYPES.Auth_SessionService).to(SessionService)
|
container.bind<SessionService>(TYPES.Auth_SessionService).to(SessionService)
|
||||||
container.bind<AuthResponseFactory20161215>(TYPES.Auth_AuthResponseFactory20161215).to(AuthResponseFactory20161215)
|
container.bind<AuthResponseFactory20161215>(TYPES.Auth_AuthResponseFactory20161215).to(AuthResponseFactory20161215)
|
||||||
@@ -699,45 +710,61 @@ export class ContainerConfigLoader {
|
|||||||
container.bind<DomainEventFactory>(TYPES.Auth_DomainEventFactory).to(DomainEventFactory)
|
container.bind<DomainEventFactory>(TYPES.Auth_DomainEventFactory).to(DomainEventFactory)
|
||||||
container.bind<AxiosInstance>(TYPES.Auth_HTTPClient).toConstantValue(axios.create())
|
container.bind<AxiosInstance>(TYPES.Auth_HTTPClient).toConstantValue(axios.create())
|
||||||
container.bind<CrypterInterface>(TYPES.Auth_Crypter).to(CrypterNode)
|
container.bind<CrypterInterface>(TYPES.Auth_Crypter).to(CrypterNode)
|
||||||
container.bind<SettingServiceInterface>(TYPES.Auth_SettingService).to(SettingService)
|
container
|
||||||
|
.bind<SettingsAssociationServiceInterface>(TYPES.Auth_SettingsAssociationService)
|
||||||
|
.to(SettingsAssociationService)
|
||||||
|
container.bind<SettingDecrypterInterface>(TYPES.Auth_SettingDecrypter).to(SettingDecrypter)
|
||||||
|
|
||||||
|
container
|
||||||
|
.bind<GetUserKeyParams>(TYPES.Auth_GetUserKeyParams)
|
||||||
|
.toConstantValue(
|
||||||
|
new GetUserKeyParams(
|
||||||
|
container.get<KeyParamsFactoryInterface>(TYPES.Auth_KeyParamsFactory),
|
||||||
|
container.get<UserRepositoryInterface>(TYPES.Auth_UserRepository),
|
||||||
|
container.get<PKCERepositoryInterface>(TYPES.Auth_PKCERepository),
|
||||||
|
container.get<winston.Logger>(TYPES.Auth_Logger),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
container
|
||||||
|
.bind<SettingInterpreterInterface>(TYPES.Auth_SettingInterpreter)
|
||||||
|
.toConstantValue(
|
||||||
|
new SettingInterpreter(
|
||||||
|
container.get<DomainEventPublisherInterface>(TYPES.Auth_DomainEventPublisher),
|
||||||
|
container.get<DomainEventFactoryInterface>(TYPES.Auth_DomainEventFactory),
|
||||||
|
container.get<SettingRepositoryInterface>(TYPES.Auth_SettingRepository),
|
||||||
|
container.get<GetUserKeyParams>(TYPES.Auth_GetUserKeyParams),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
container
|
||||||
|
.bind<SettingServiceInterface>(TYPES.Auth_SettingService)
|
||||||
|
.toConstantValue(
|
||||||
|
new SettingService(
|
||||||
|
container.get<SettingFactoryInterface>(TYPES.Auth_SettingFactory),
|
||||||
|
container.get<SettingRepositoryInterface>(TYPES.Auth_SettingRepository),
|
||||||
|
container.get<SettingsAssociationServiceInterface>(TYPES.Auth_SettingsAssociationService),
|
||||||
|
container.get<SettingInterpreterInterface>(TYPES.Auth_SettingInterpreter),
|
||||||
|
container.get<SettingDecrypterInterface>(TYPES.Auth_SettingDecrypter),
|
||||||
|
container.get<winston.Logger>(TYPES.Auth_Logger),
|
||||||
|
),
|
||||||
|
)
|
||||||
container
|
container
|
||||||
.bind<SubscriptionSettingServiceInterface>(TYPES.Auth_SubscriptionSettingService)
|
.bind<SubscriptionSettingServiceInterface>(TYPES.Auth_SubscriptionSettingService)
|
||||||
.to(SubscriptionSettingService)
|
.to(SubscriptionSettingService)
|
||||||
container.bind<OfflineSettingServiceInterface>(TYPES.Auth_OfflineSettingService).to(OfflineSettingService)
|
container.bind<OfflineSettingServiceInterface>(TYPES.Auth_OfflineSettingService).to(OfflineSettingService)
|
||||||
container.bind<CryptoNode>(TYPES.Auth_CryptoNode).toConstantValue(new CryptoNode())
|
|
||||||
container.bind<ContentDecoderInterface>(TYPES.Auth_ContenDecoder).toConstantValue(new ContentDecoder())
|
container.bind<ContentDecoderInterface>(TYPES.Auth_ContenDecoder).toConstantValue(new ContentDecoder())
|
||||||
container.bind<ClientServiceInterface>(TYPES.Auth_WebSocketsClientService).to(WebSocketsClientService)
|
container.bind<ClientServiceInterface>(TYPES.Auth_WebSocketsClientService).to(WebSocketsClientService)
|
||||||
container.bind<RoleServiceInterface>(TYPES.Auth_RoleService).to(RoleService)
|
container.bind<RoleServiceInterface>(TYPES.Auth_RoleService).to(RoleService)
|
||||||
container.bind<RoleToSubscriptionMapInterface>(TYPES.Auth_RoleToSubscriptionMap).to(RoleToSubscriptionMap)
|
container.bind<RoleToSubscriptionMapInterface>(TYPES.Auth_RoleToSubscriptionMap).to(RoleToSubscriptionMap)
|
||||||
container
|
|
||||||
.bind<SettingsAssociationServiceInterface>(TYPES.Auth_SettingsAssociationService)
|
|
||||||
.to(SettingsAssociationService)
|
|
||||||
container
|
container
|
||||||
.bind<SubscriptionSettingsAssociationServiceInterface>(TYPES.Auth_SubscriptionSettingsAssociationService)
|
.bind<SubscriptionSettingsAssociationServiceInterface>(TYPES.Auth_SubscriptionSettingsAssociationService)
|
||||||
.to(SubscriptionSettingsAssociationService)
|
.to(SubscriptionSettingsAssociationService)
|
||||||
container.bind<FeatureServiceInterface>(TYPES.Auth_FeatureService).to(FeatureService)
|
container.bind<FeatureServiceInterface>(TYPES.Auth_FeatureService).to(FeatureService)
|
||||||
container.bind<SettingInterpreterInterface>(TYPES.Auth_SettingInterpreter).to(SettingInterpreter)
|
|
||||||
container.bind<SettingDecrypterInterface>(TYPES.Auth_SettingDecrypter).to(SettingDecrypter)
|
|
||||||
container
|
|
||||||
.bind<SelectorInterface<ProtocolVersion>>(TYPES.Auth_ProtocolVersionSelector)
|
|
||||||
.toConstantValue(new DeterministicSelector<ProtocolVersion>())
|
|
||||||
container
|
container
|
||||||
.bind<SelectorInterface<boolean>>(TYPES.Auth_BooleanSelector)
|
.bind<SelectorInterface<boolean>>(TYPES.Auth_BooleanSelector)
|
||||||
.toConstantValue(new DeterministicSelector<boolean>())
|
.toConstantValue(new DeterministicSelector<boolean>())
|
||||||
container.bind<UserSubscriptionServiceInterface>(TYPES.Auth_UserSubscriptionService).to(UserSubscriptionService)
|
container.bind<UserSubscriptionServiceInterface>(TYPES.Auth_UserSubscriptionService).to(UserSubscriptionService)
|
||||||
|
|
||||||
container
|
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Auth_DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
isConfiguredForHomeServer
|
|
||||||
? directCallDomainEventPublisher
|
|
||||||
: new SNSOpenTelemetryDomainEventPublisher(
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR),
|
|
||||||
container.get(TYPES.Auth_SNS),
|
|
||||||
container.get(TYPES.Auth_SNS_TOPIC_ARN),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Middleware
|
// Middleware
|
||||||
container.bind<SessionMiddleware>(TYPES.Auth_SessionMiddleware).to(SessionMiddleware)
|
container.bind<SessionMiddleware>(TYPES.Auth_SessionMiddleware).to(SessionMiddleware)
|
||||||
container.bind<LockMiddleware>(TYPES.Auth_LockMiddleware).to(LockMiddleware)
|
container.bind<LockMiddleware>(TYPES.Auth_LockMiddleware).to(LockMiddleware)
|
||||||
@@ -890,7 +917,6 @@ export class ContainerConfigLoader {
|
|||||||
container.get(TYPES.Auth_SettingService),
|
container.get(TYPES.Auth_SettingService),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
container.bind<GetUserKeyParams>(TYPES.Auth_GetUserKeyParams).to(GetUserKeyParams)
|
|
||||||
container.bind<UpdateUser>(TYPES.Auth_UpdateUser).to(UpdateUser)
|
container.bind<UpdateUser>(TYPES.Auth_UpdateUser).to(UpdateUser)
|
||||||
container.bind<Register>(TYPES.Auth_Register).to(Register)
|
container.bind<Register>(TYPES.Auth_Register).to(Register)
|
||||||
container.bind<GetActiveSessionsForUser>(TYPES.Auth_GetActiveSessionsForUser).to(GetActiveSessionsForUser)
|
container.bind<GetActiveSessionsForUser>(TYPES.Auth_GetActiveSessionsForUser).to(GetActiveSessionsForUser)
|
||||||
@@ -1233,16 +1259,7 @@ export class ContainerConfigLoader {
|
|||||||
} else {
|
} else {
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger)))
|
||||||
isConfiguredForHomeServerOrSelfHosting
|
|
||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger))
|
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.AuthWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Auth_Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Auth_DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Auth_DomainEventSubscriberFactory)
|
||||||
@@ -1329,7 +1346,6 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new BaseUsersController(
|
new BaseUsersController(
|
||||||
container.get<UpdateUser>(TYPES.Auth_UpdateUser),
|
container.get<UpdateUser>(TYPES.Auth_UpdateUser),
|
||||||
container.get<GetUserKeyParams>(TYPES.Auth_GetUserKeyParams),
|
|
||||||
container.get<DeleteAccount>(TYPES.Auth_DeleteAccount),
|
container.get<DeleteAccount>(TYPES.Auth_DeleteAccount),
|
||||||
container.get<GetUserSubscription>(TYPES.Auth_GetUserSubscription),
|
container.get<GetUserSubscription>(TYPES.Auth_GetUserSubscription),
|
||||||
container.get<ClearLoginAttempts>(TYPES.Auth_ClearLoginAttempts),
|
container.get<ClearLoginAttempts>(TYPES.Auth_ClearLoginAttempts),
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const TYPES = {
|
|||||||
Auth_Redis: Symbol.for('Auth_Redis'),
|
Auth_Redis: Symbol.for('Auth_Redis'),
|
||||||
Auth_SNS: Symbol.for('Auth_SNS'),
|
Auth_SNS: Symbol.for('Auth_SNS'),
|
||||||
Auth_SQS: Symbol.for('Auth_SQS'),
|
Auth_SQS: Symbol.for('Auth_SQS'),
|
||||||
Auth_OTEL_PROPAGATOR: Symbol.for('Auth_OTEL_PROPAGATOR'),
|
|
||||||
// Mapping
|
// Mapping
|
||||||
Auth_SessionTracePersistenceMapper: Symbol.for('Auth_SessionTracePersistenceMapper'),
|
Auth_SessionTracePersistenceMapper: Symbol.for('Auth_SessionTracePersistenceMapper'),
|
||||||
Auth_AuthenticatorChallengePersistenceMapper: Symbol.for('Auth_AuthenticatorChallengePersistenceMapper'),
|
Auth_AuthenticatorChallengePersistenceMapper: Symbol.for('Auth_AuthenticatorChallengePersistenceMapper'),
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { inject, injectable } from 'inversify'
|
|||||||
import TYPES from '../../Bootstrap/Types'
|
import TYPES from '../../Bootstrap/Types'
|
||||||
import { InviteeIdentifierType } from '../SharedSubscription/InviteeIdentifierType'
|
import { InviteeIdentifierType } from '../SharedSubscription/InviteeIdentifierType'
|
||||||
import { DomainEventFactoryInterface } from './DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from './DomainEventFactoryInterface'
|
||||||
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class DomainEventFactory implements DomainEventFactoryInterface {
|
export class DomainEventFactory implements DomainEventFactoryInterface {
|
||||||
@@ -277,6 +278,7 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
|||||||
userUuid: string,
|
userUuid: string,
|
||||||
muteEmailsSettingUuid: string,
|
muteEmailsSettingUuid: string,
|
||||||
userHasEmailsMuted: boolean,
|
userHasEmailsMuted: boolean,
|
||||||
|
keyParams: KeyParamsData,
|
||||||
): EmailBackupRequestedEvent {
|
): EmailBackupRequestedEvent {
|
||||||
return {
|
return {
|
||||||
type: 'EMAIL_BACKUP_REQUESTED',
|
type: 'EMAIL_BACKUP_REQUESTED',
|
||||||
@@ -292,6 +294,7 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
|||||||
userUuid,
|
userUuid,
|
||||||
userHasEmailsMuted,
|
userHasEmailsMuted,
|
||||||
muteEmailsSettingUuid,
|
muteEmailsSettingUuid,
|
||||||
|
keyParams,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
TransitionRequestedEvent,
|
TransitionRequestedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { InviteeIdentifierType } from '../SharedSubscription/InviteeIdentifierType'
|
import { InviteeIdentifierType } from '../SharedSubscription/InviteeIdentifierType'
|
||||||
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
|
|
||||||
export interface DomainEventFactoryInterface {
|
export interface DomainEventFactoryInterface {
|
||||||
createWebSocketMessageRequestedEvent(dto: { userUuid: string; message: JSONString }): WebSocketMessageRequestedEvent
|
createWebSocketMessageRequestedEvent(dto: { userUuid: string; message: JSONString }): WebSocketMessageRequestedEvent
|
||||||
@@ -41,6 +42,7 @@ export interface DomainEventFactoryInterface {
|
|||||||
userUuid: string,
|
userUuid: string,
|
||||||
muteEmailsSettingUuid: string,
|
muteEmailsSettingUuid: string,
|
||||||
userHasEmailsMuted: boolean,
|
userHasEmailsMuted: boolean,
|
||||||
|
keyParams: KeyParamsData,
|
||||||
): EmailBackupRequestedEvent
|
): EmailBackupRequestedEvent
|
||||||
createAccountDeletionRequestedEvent(dto: {
|
createAccountDeletionRequestedEvent(dto: {
|
||||||
userUuid: string
|
userUuid: string
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import { SettingDecrypterInterface } from './SettingDecrypterInterface'
|
|||||||
|
|
||||||
import { SettingInterpreter } from './SettingInterpreter'
|
import { SettingInterpreter } from './SettingInterpreter'
|
||||||
import { SettingRepositoryInterface } from './SettingRepositoryInterface'
|
import { SettingRepositoryInterface } from './SettingRepositoryInterface'
|
||||||
|
import { GetUserKeyParams } from '../UseCase/GetUserKeyParams/GetUserKeyParams'
|
||||||
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
|
|
||||||
describe('SettingInterpreter', () => {
|
describe('SettingInterpreter', () => {
|
||||||
let user: User
|
let user: User
|
||||||
@@ -27,8 +29,10 @@ describe('SettingInterpreter', () => {
|
|||||||
let settingRepository: SettingRepositoryInterface
|
let settingRepository: SettingRepositoryInterface
|
||||||
let settingDecrypter: SettingDecrypterInterface
|
let settingDecrypter: SettingDecrypterInterface
|
||||||
let logger: Logger
|
let logger: Logger
|
||||||
|
let getUserKeyParams: GetUserKeyParams
|
||||||
|
|
||||||
const createInterpreter = () => new SettingInterpreter(domainEventPublisher, domainEventFactory, settingRepository)
|
const createInterpreter = () =>
|
||||||
|
new SettingInterpreter(domainEventPublisher, domainEventFactory, settingRepository, getUserKeyParams)
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
user = {
|
user = {
|
||||||
@@ -61,6 +65,9 @@ describe('SettingInterpreter', () => {
|
|||||||
logger.debug = jest.fn()
|
logger.debug = jest.fn()
|
||||||
logger.warn = jest.fn()
|
logger.warn = jest.fn()
|
||||||
logger.error = jest.fn()
|
logger.error = jest.fn()
|
||||||
|
|
||||||
|
getUserKeyParams = {} as jest.Mocked<GetUserKeyParams>
|
||||||
|
getUserKeyParams.execute = jest.fn().mockReturnValue({ keyParams: {} as jest.Mocked<KeyParamsData> })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should trigger session cleanup if user is disabling session user agent logging', async () => {
|
it('should trigger session cleanup if user is disabling session user agent logging', async () => {
|
||||||
@@ -85,7 +92,7 @@ describe('SettingInterpreter', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupRequestedEvent).toHaveBeenCalledWith('4-5-6', '', false)
|
expect(domainEventFactory.createEmailBackupRequestedEvent).toHaveBeenCalledWith('4-5-6', '', false, {})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should trigger backup if email backup setting is created - emails muted', async () => {
|
it('should trigger backup if email backup setting is created - emails muted', async () => {
|
||||||
@@ -102,7 +109,7 @@ describe('SettingInterpreter', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupRequestedEvent).toHaveBeenCalledWith('4-5-6', '6-7-8', true)
|
expect(domainEventFactory.createEmailBackupRequestedEvent).toHaveBeenCalledWith('4-5-6', '6-7-8', true, {})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not trigger backup if email backup setting is disabled', async () => {
|
it('should not trigger backup if email backup setting is disabled', async () => {
|
||||||
|
|||||||
@@ -6,15 +6,13 @@ import {
|
|||||||
MuteFailedBackupsEmailsOption,
|
MuteFailedBackupsEmailsOption,
|
||||||
SettingName,
|
SettingName,
|
||||||
} from '@standardnotes/settings'
|
} from '@standardnotes/settings'
|
||||||
import { inject, injectable } from 'inversify'
|
|
||||||
|
|
||||||
import TYPES from '../../Bootstrap/Types'
|
|
||||||
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
import { User } from '../User/User'
|
import { User } from '../User/User'
|
||||||
import { SettingInterpreterInterface } from './SettingInterpreterInterface'
|
import { SettingInterpreterInterface } from './SettingInterpreterInterface'
|
||||||
import { SettingRepositoryInterface } from './SettingRepositoryInterface'
|
import { SettingRepositoryInterface } from './SettingRepositoryInterface'
|
||||||
|
import { GetUserKeyParams } from '../UseCase/GetUserKeyParams/GetUserKeyParams'
|
||||||
|
|
||||||
@injectable()
|
|
||||||
export class SettingInterpreter implements SettingInterpreterInterface {
|
export class SettingInterpreter implements SettingInterpreterInterface {
|
||||||
private readonly emailSettingToSubscriptionRejectionLevelMap: Map<string, string> = new Map([
|
private readonly emailSettingToSubscriptionRejectionLevelMap: Map<string, string> = new Map([
|
||||||
[SettingName.NAMES.MuteFailedBackupsEmails, EmailLevel.LEVELS.FailedEmailBackup],
|
[SettingName.NAMES.MuteFailedBackupsEmails, EmailLevel.LEVELS.FailedEmailBackup],
|
||||||
@@ -24,9 +22,10 @@ export class SettingInterpreter implements SettingInterpreterInterface {
|
|||||||
])
|
])
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(TYPES.Auth_DomainEventPublisher) private domainEventPublisher: DomainEventPublisherInterface,
|
private domainEventPublisher: DomainEventPublisherInterface,
|
||||||
@inject(TYPES.Auth_DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
private domainEventFactory: DomainEventFactoryInterface,
|
||||||
@inject(TYPES.Auth_SettingRepository) private settingRepository: SettingRepositoryInterface,
|
private settingRepository: SettingRepositoryInterface,
|
||||||
|
private getUserKeyParams: GetUserKeyParams,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async interpretSettingUpdated(
|
async interpretSettingUpdated(
|
||||||
@@ -59,8 +58,18 @@ export class SettingInterpreter implements SettingInterpreterInterface {
|
|||||||
muteEmailsSettingUuid = muteFailedEmailsBackupSetting.uuid
|
muteEmailsSettingUuid = muteFailedEmailsBackupSetting.uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const keyParamsResponse = await this.getUserKeyParams.execute({
|
||||||
|
authenticated: false,
|
||||||
|
userUuid,
|
||||||
|
})
|
||||||
|
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.domainEventFactory.createEmailBackupRequestedEvent(userUuid, muteEmailsSettingUuid, userHasEmailsMuted),
|
this.domainEventFactory.createEmailBackupRequestedEvent(
|
||||||
|
userUuid,
|
||||||
|
muteEmailsSettingUuid,
|
||||||
|
userHasEmailsMuted,
|
||||||
|
keyParamsResponse.keyParams,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { SettingName } from '@standardnotes/settings'
|
import { SettingName } from '@standardnotes/settings'
|
||||||
import { inject, injectable } from 'inversify'
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import TYPES from '../../Bootstrap/Types'
|
|
||||||
import { User } from '../User/User'
|
import { User } from '../User/User'
|
||||||
import { CreateOrReplaceSettingDto } from './CreateOrReplaceSettingDto'
|
import { CreateOrReplaceSettingDto } from './CreateOrReplaceSettingDto'
|
||||||
import { CreateOrReplaceSettingResponse } from './CreateOrReplaceSettingResponse'
|
import { CreateOrReplaceSettingResponse } from './CreateOrReplaceSettingResponse'
|
||||||
@@ -14,16 +13,14 @@ import { SettingInterpreterInterface } from './SettingInterpreterInterface'
|
|||||||
import { SettingDecrypterInterface } from './SettingDecrypterInterface'
|
import { SettingDecrypterInterface } from './SettingDecrypterInterface'
|
||||||
import { SettingFactoryInterface } from './SettingFactoryInterface'
|
import { SettingFactoryInterface } from './SettingFactoryInterface'
|
||||||
|
|
||||||
@injectable()
|
|
||||||
export class SettingService implements SettingServiceInterface {
|
export class SettingService implements SettingServiceInterface {
|
||||||
constructor(
|
constructor(
|
||||||
@inject(TYPES.Auth_SettingFactory) private factory: SettingFactoryInterface,
|
private factory: SettingFactoryInterface,
|
||||||
@inject(TYPES.Auth_SettingRepository) private settingRepository: SettingRepositoryInterface,
|
private settingRepository: SettingRepositoryInterface,
|
||||||
@inject(TYPES.Auth_SettingsAssociationService)
|
|
||||||
private settingsAssociationService: SettingsAssociationServiceInterface,
|
private settingsAssociationService: SettingsAssociationServiceInterface,
|
||||||
@inject(TYPES.Auth_SettingInterpreter) private settingInterpreter: SettingInterpreterInterface,
|
private settingInterpreter: SettingInterpreterInterface,
|
||||||
@inject(TYPES.Auth_SettingDecrypter) private settingDecrypter: SettingDecrypterInterface,
|
private settingDecrypter: SettingDecrypterInterface,
|
||||||
@inject(TYPES.Auth_Logger) private logger: Logger,
|
private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async applyDefaultSettingsUponRegistration(user: User): Promise<void> {
|
async applyDefaultSettingsUponRegistration(user: User): Promise<void> {
|
||||||
|
|||||||
@@ -1,24 +1,22 @@
|
|||||||
import { inject, injectable } from 'inversify'
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
import TYPES from '../../../Bootstrap/Types'
|
import { Logger } from 'winston'
|
||||||
|
import { Username, Uuid } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
import { KeyParamsFactoryInterface } from '../../User/KeyParamsFactoryInterface'
|
import { KeyParamsFactoryInterface } from '../../User/KeyParamsFactoryInterface'
|
||||||
import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
|
import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
|
||||||
import { GetUserKeyParamsDTO } from './GetUserKeyParamsDTO'
|
import { GetUserKeyParamsDTO } from './GetUserKeyParamsDTO'
|
||||||
import { GetUserKeyParamsResponse } from './GetUserKeyParamsResponse'
|
import { GetUserKeyParamsResponse } from './GetUserKeyParamsResponse'
|
||||||
import { UseCaseInterface } from '../UseCaseInterface'
|
import { UseCaseInterface } from '../UseCaseInterface'
|
||||||
import { Logger } from 'winston'
|
|
||||||
import { User } from '../../User/User'
|
import { User } from '../../User/User'
|
||||||
import { PKCERepositoryInterface } from '../../User/PKCERepositoryInterface'
|
import { PKCERepositoryInterface } from '../../User/PKCERepositoryInterface'
|
||||||
import { GetUserKeyParamsDTOV2Challenged } from './GetUserKeyParamsDTOV2Challenged'
|
import { GetUserKeyParamsDTOV2Challenged } from './GetUserKeyParamsDTOV2Challenged'
|
||||||
import { KeyParamsData } from '@standardnotes/responses'
|
|
||||||
import { Username, Uuid } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
@injectable()
|
|
||||||
export class GetUserKeyParams implements UseCaseInterface {
|
export class GetUserKeyParams implements UseCaseInterface {
|
||||||
constructor(
|
constructor(
|
||||||
@inject(TYPES.Auth_KeyParamsFactory) private keyParamsFactory: KeyParamsFactoryInterface,
|
private keyParamsFactory: KeyParamsFactoryInterface,
|
||||||
@inject(TYPES.Auth_UserRepository) private userRepository: UserRepositoryInterface,
|
private userRepository: UserRepositoryInterface,
|
||||||
@inject(TYPES.Auth_PKCERepository) private pkceRepository: PKCERepositoryInterface,
|
private pkceRepository: PKCERepositoryInterface,
|
||||||
@inject(TYPES.Auth_Logger) private logger: Logger,
|
private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async execute(dto: GetUserKeyParamsDTO): Promise<GetUserKeyParamsResponse> {
|
async execute(dto: GetUserKeyParamsDTO): Promise<GetUserKeyParamsResponse> {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { Result, Username } from '@standardnotes/domain-core'
|
|||||||
import { DeleteAccount } from '../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
import { DeleteAccount } from '../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
||||||
import { ChangeCredentials } from '../../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
import { ChangeCredentials } from '../../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
||||||
import { ClearLoginAttempts } from '../../Domain/UseCase/ClearLoginAttempts'
|
import { ClearLoginAttempts } from '../../Domain/UseCase/ClearLoginAttempts'
|
||||||
import { GetUserKeyParams } from '../../Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
|
||||||
import { GetUserSubscription } from '../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
import { GetUserSubscription } from '../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
||||||
import { IncreaseLoginAttempts } from '../../Domain/UseCase/IncreaseLoginAttempts'
|
import { IncreaseLoginAttempts } from '../../Domain/UseCase/IncreaseLoginAttempts'
|
||||||
import { InviteToSharedSubscription } from '../../Domain/UseCase/InviteToSharedSubscription/InviteToSharedSubscription'
|
import { InviteToSharedSubscription } from '../../Domain/UseCase/InviteToSharedSubscription/InviteToSharedSubscription'
|
||||||
@@ -18,7 +17,6 @@ import { User } from '../../Domain/User/User'
|
|||||||
describe('AnnotatedUsersController', () => {
|
describe('AnnotatedUsersController', () => {
|
||||||
let updateUser: UpdateUser
|
let updateUser: UpdateUser
|
||||||
let deleteAccount: DeleteAccount
|
let deleteAccount: DeleteAccount
|
||||||
let getUserKeyParams: GetUserKeyParams
|
|
||||||
let getUserSubscription: GetUserSubscription
|
let getUserSubscription: GetUserSubscription
|
||||||
let clearLoginAttempts: ClearLoginAttempts
|
let clearLoginAttempts: ClearLoginAttempts
|
||||||
let increaseLoginAttempts: IncreaseLoginAttempts
|
let increaseLoginAttempts: IncreaseLoginAttempts
|
||||||
@@ -32,7 +30,6 @@ describe('AnnotatedUsersController', () => {
|
|||||||
const createController = () =>
|
const createController = () =>
|
||||||
new AnnotatedUsersController(
|
new AnnotatedUsersController(
|
||||||
updateUser,
|
updateUser,
|
||||||
getUserKeyParams,
|
|
||||||
deleteAccount,
|
deleteAccount,
|
||||||
getUserSubscription,
|
getUserSubscription,
|
||||||
clearLoginAttempts,
|
clearLoginAttempts,
|
||||||
@@ -51,9 +48,6 @@ describe('AnnotatedUsersController', () => {
|
|||||||
user.uuid = '123'
|
user.uuid = '123'
|
||||||
user.email = 'test@test.te'
|
user.email = 'test@test.te'
|
||||||
|
|
||||||
getUserKeyParams = {} as jest.Mocked<GetUserKeyParams>
|
|
||||||
getUserKeyParams.execute = jest.fn()
|
|
||||||
|
|
||||||
getUserSubscription = {} as jest.Mocked<GetUserSubscription>
|
getUserSubscription = {} as jest.Mocked<GetUserSubscription>
|
||||||
getUserSubscription.execute = jest.fn()
|
getUserSubscription.execute = jest.fn()
|
||||||
|
|
||||||
@@ -213,60 +207,6 @@ describe('AnnotatedUsersController', () => {
|
|||||||
expect(result.statusCode).toEqual(401)
|
expect(result.statusCode).toEqual(401)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should get user key params', async () => {
|
|
||||||
request.query = {
|
|
||||||
email: 'test@test.te',
|
|
||||||
uuid: '1-2-3',
|
|
||||||
}
|
|
||||||
|
|
||||||
getUserKeyParams.execute = jest.fn().mockReturnValue({ foo: 'bar' })
|
|
||||||
|
|
||||||
const httpResponse = <results.JsonResult>await createController().keyParams(request)
|
|
||||||
const result = await httpResponse.executeAsync()
|
|
||||||
|
|
||||||
expect(getUserKeyParams.execute).toHaveBeenCalledWith({
|
|
||||||
email: 'test@test.te',
|
|
||||||
userUuid: '1-2-3',
|
|
||||||
authenticated: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.statusCode).toEqual(200)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should get authenticated user key params', async () => {
|
|
||||||
request.query = {
|
|
||||||
email: 'test@test.te',
|
|
||||||
uuid: '1-2-3',
|
|
||||||
authenticated: 'true',
|
|
||||||
}
|
|
||||||
|
|
||||||
getUserKeyParams.execute = jest.fn().mockReturnValue({ foo: 'bar' })
|
|
||||||
|
|
||||||
const httpResponse = <results.JsonResult>await createController().keyParams(request)
|
|
||||||
const result = await httpResponse.executeAsync()
|
|
||||||
|
|
||||||
expect(getUserKeyParams.execute).toHaveBeenCalledWith({
|
|
||||||
email: 'test@test.te',
|
|
||||||
userUuid: '1-2-3',
|
|
||||||
authenticated: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.statusCode).toEqual(200)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should not get user key params if email and user uuid is missing', async () => {
|
|
||||||
request.query = {}
|
|
||||||
|
|
||||||
getUserKeyParams.execute = jest.fn().mockReturnValue({ foo: 'bar' })
|
|
||||||
|
|
||||||
const httpResponse = <results.JsonResult>await createController().keyParams(request)
|
|
||||||
const result = await httpResponse.executeAsync()
|
|
||||||
|
|
||||||
expect(getUserKeyParams.execute).not.toHaveBeenCalled()
|
|
||||||
|
|
||||||
expect(result.statusCode).toEqual(400)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should get user subscription', async () => {
|
it('should get user subscription', async () => {
|
||||||
request.params.userUuid = '1-2-3'
|
request.params.userUuid = '1-2-3'
|
||||||
response.locals.user = {
|
response.locals.user = {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
} from 'inversify-express-utils'
|
} from 'inversify-express-utils'
|
||||||
import TYPES from '../../Bootstrap/Types'
|
import TYPES from '../../Bootstrap/Types'
|
||||||
import { DeleteAccount } from '../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
import { DeleteAccount } from '../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
||||||
import { GetUserKeyParams } from '../../Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
|
||||||
import { UpdateUser } from '../../Domain/UseCase/UpdateUser'
|
import { UpdateUser } from '../../Domain/UseCase/UpdateUser'
|
||||||
import { GetUserSubscription } from '../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
import { GetUserSubscription } from '../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
||||||
import { ClearLoginAttempts } from '../../Domain/UseCase/ClearLoginAttempts'
|
import { ClearLoginAttempts } from '../../Domain/UseCase/ClearLoginAttempts'
|
||||||
@@ -23,7 +22,6 @@ import { BaseUsersController } from './Base/BaseUsersController'
|
|||||||
export class AnnotatedUsersController extends BaseUsersController {
|
export class AnnotatedUsersController extends BaseUsersController {
|
||||||
constructor(
|
constructor(
|
||||||
@inject(TYPES.Auth_UpdateUser) override updateUser: UpdateUser,
|
@inject(TYPES.Auth_UpdateUser) override updateUser: UpdateUser,
|
||||||
@inject(TYPES.Auth_GetUserKeyParams) override getUserKeyParams: GetUserKeyParams,
|
|
||||||
@inject(TYPES.Auth_DeleteAccount) override doDeleteAccount: DeleteAccount,
|
@inject(TYPES.Auth_DeleteAccount) override doDeleteAccount: DeleteAccount,
|
||||||
@inject(TYPES.Auth_GetUserSubscription) override doGetUserSubscription: GetUserSubscription,
|
@inject(TYPES.Auth_GetUserSubscription) override doGetUserSubscription: GetUserSubscription,
|
||||||
@inject(TYPES.Auth_ClearLoginAttempts) override clearLoginAttempts: ClearLoginAttempts,
|
@inject(TYPES.Auth_ClearLoginAttempts) override clearLoginAttempts: ClearLoginAttempts,
|
||||||
@@ -32,7 +30,6 @@ export class AnnotatedUsersController extends BaseUsersController {
|
|||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
updateUser,
|
updateUser,
|
||||||
getUserKeyParams,
|
|
||||||
doDeleteAccount,
|
doDeleteAccount,
|
||||||
doGetUserSubscription,
|
doGetUserSubscription,
|
||||||
clearLoginAttempts,
|
clearLoginAttempts,
|
||||||
@@ -46,11 +43,6 @@ export class AnnotatedUsersController extends BaseUsersController {
|
|||||||
return super.update(request, response)
|
return super.update(request, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@httpGet('/params')
|
|
||||||
override async keyParams(request: Request): Promise<results.JsonResult> {
|
|
||||||
return super.keyParams(request)
|
|
||||||
}
|
|
||||||
|
|
||||||
@httpDelete('/:userUuid', TYPES.Auth_RequiredCrossServiceTokenMiddleware)
|
@httpDelete('/:userUuid', TYPES.Auth_RequiredCrossServiceTokenMiddleware)
|
||||||
override async deleteAccount(request: Request, response: Response): Promise<results.JsonResult> {
|
override async deleteAccount(request: Request, response: Response): Promise<results.JsonResult> {
|
||||||
return super.deleteAccount(request, response)
|
return super.deleteAccount(request, response)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { BaseHttpController, results } from 'inversify-express-utils'
|
|||||||
import { ChangeCredentials } from '../../../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
import { ChangeCredentials } from '../../../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
||||||
import { ClearLoginAttempts } from '../../../Domain/UseCase/ClearLoginAttempts'
|
import { ClearLoginAttempts } from '../../../Domain/UseCase/ClearLoginAttempts'
|
||||||
import { DeleteAccount } from '../../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
import { DeleteAccount } from '../../../Domain/UseCase/DeleteAccount/DeleteAccount'
|
||||||
import { GetUserKeyParams } from '../../../Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
|
||||||
import { GetUserSubscription } from '../../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
import { GetUserSubscription } from '../../../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
||||||
import { IncreaseLoginAttempts } from '../../../Domain/UseCase/IncreaseLoginAttempts'
|
import { IncreaseLoginAttempts } from '../../../Domain/UseCase/IncreaseLoginAttempts'
|
||||||
import { UpdateUser } from '../../../Domain/UseCase/UpdateUser'
|
import { UpdateUser } from '../../../Domain/UseCase/UpdateUser'
|
||||||
@@ -14,7 +13,6 @@ import { ErrorTag } from '@standardnotes/responses'
|
|||||||
export class BaseUsersController extends BaseHttpController {
|
export class BaseUsersController extends BaseHttpController {
|
||||||
constructor(
|
constructor(
|
||||||
protected updateUser: UpdateUser,
|
protected updateUser: UpdateUser,
|
||||||
protected getUserKeyParams: GetUserKeyParams,
|
|
||||||
protected doDeleteAccount: DeleteAccount,
|
protected doDeleteAccount: DeleteAccount,
|
||||||
protected doGetUserSubscription: GetUserSubscription,
|
protected doGetUserSubscription: GetUserSubscription,
|
||||||
protected clearLoginAttempts: ClearLoginAttempts,
|
protected clearLoginAttempts: ClearLoginAttempts,
|
||||||
@@ -26,7 +24,6 @@ export class BaseUsersController extends BaseHttpController {
|
|||||||
|
|
||||||
if (this.controllerContainer !== undefined) {
|
if (this.controllerContainer !== undefined) {
|
||||||
this.controllerContainer.register('auth.users.update', this.update.bind(this))
|
this.controllerContainer.register('auth.users.update', this.update.bind(this))
|
||||||
this.controllerContainer.register('auth.users.getKeyParams', this.keyParams.bind(this))
|
|
||||||
this.controllerContainer.register('auth.users.getSubscription', this.getSubscription.bind(this))
|
this.controllerContainer.register('auth.users.getSubscription', this.getSubscription.bind(this))
|
||||||
this.controllerContainer.register('auth.users.updateCredentials', this.changeCredentials.bind(this))
|
this.controllerContainer.register('auth.users.updateCredentials', this.changeCredentials.bind(this))
|
||||||
this.controllerContainer.register('auth.users.delete', this.deleteAccount.bind(this))
|
this.controllerContainer.register('auth.users.delete', this.deleteAccount.bind(this))
|
||||||
@@ -79,30 +76,6 @@ export class BaseUsersController extends BaseHttpController {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async keyParams(request: Request): Promise<results.JsonResult> {
|
|
||||||
const email = 'email' in request.query ? <string>request.query.email : undefined
|
|
||||||
const userUuid = 'uuid' in request.query ? <string>request.query.uuid : undefined
|
|
||||||
|
|
||||||
if (!email && !userUuid) {
|
|
||||||
return this.json(
|
|
||||||
{
|
|
||||||
error: {
|
|
||||||
message: 'Missing mandatory request query parameters.',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
400,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.getUserKeyParams.execute({
|
|
||||||
email,
|
|
||||||
userUuid,
|
|
||||||
authenticated: request.query.authenticated === 'true',
|
|
||||||
})
|
|
||||||
|
|
||||||
return this.json(result.keyParams)
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteAccount(request: Request, response: Response): Promise<results.JsonResult> {
|
async deleteAccount(request: Request, response: Response): Promise<results.JsonResult> {
|
||||||
if (request.params.userUuid !== response.locals.user.uuid) {
|
if (request.params.userUuid !== response.locals.user.uuid) {
|
||||||
return this.json(
|
return this.json(
|
||||||
|
|||||||
@@ -3,6 +3,42 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.19.7](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.6...@standardnotes/domain-events-infra@1.19.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.19.6](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.5...@standardnotes/domain-events-infra@1.19.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.19.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.4...@standardnotes/domain-events-infra@1.19.5) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-events-infra:** retrieve all message attributes from sqs ([0c29ff1](https://github.com/standardnotes/server/commit/0c29ff1ab4886a73eae8079e80d7ff779c0e3859))
|
||||||
|
|
||||||
|
## [1.19.4](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.3...@standardnotes/domain-events-infra@1.19.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* **domain-events-infra:** supress typeorm internal instrumentation ([1246af2](https://github.com/standardnotes/server/commit/1246af2551ae3502734583fbc7dcebc91c16eb6b))
|
||||||
|
* enable opentelemetry tracing on async workers via sqs/sns automation ([0a90502](https://github.com/standardnotes/server/commit/0a90502658ce6f60f4a3100a518d522d6209a8fd))
|
||||||
|
|
||||||
|
## [1.19.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.2...@standardnotes/domain-events-infra@1.19.3) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* injecting opentelemetry trace into sqs/sns coms ([4a6f90b](https://github.com/standardnotes/server/commit/4a6f90b95b39e7990b10dd4b96d549e1366383fe))
|
||||||
|
|
||||||
|
## [1.19.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.1...@standardnotes/domain-events-infra@1.19.2) (2023-10-11)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-events-infra:** logs severity ([b782ced](https://github.com/standardnotes/server/commit/b782cedc85e0dff1f94163b908d98005b30f119e))
|
||||||
|
|
||||||
## [1.19.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.0...@standardnotes/domain-events-infra@1.19.1) (2023-10-11)
|
## [1.19.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.0...@standardnotes/domain-events-infra@1.19.1) (2023-10-11)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events-infra",
|
"name": "@standardnotes/domain-events-infra",
|
||||||
"version": "1.19.1",
|
"version": "1.19.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import * as OpenTelemetryApi from '@opentelemetry/api'
|
|
||||||
|
|
||||||
export class OpenTelemetryPropagation {
|
|
||||||
inject(): { traceparent?: string; tracestate?: string } {
|
|
||||||
const output = {}
|
|
||||||
|
|
||||||
OpenTelemetryApi.propagation.inject(OpenTelemetryApi.context.active(), output)
|
|
||||||
|
|
||||||
return output as { traceparent?: string; tracestate?: string }
|
|
||||||
}
|
|
||||||
|
|
||||||
extract(input: { traceparent?: string; tracestate?: string }): OpenTelemetryApi.Context {
|
|
||||||
const activeContext = OpenTelemetryApi.propagation.extract(OpenTelemetryApi.context.active(), input)
|
|
||||||
|
|
||||||
return activeContext
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import { Context } from '@opentelemetry/api'
|
|
||||||
|
|
||||||
export interface OpenTelemetryPropagationInterface {
|
|
||||||
inject(): { traceparent?: string; tracestate?: string }
|
|
||||||
extract(input: { traceparent?: string; tracestate?: string }): Context
|
|
||||||
}
|
|
||||||
@@ -18,8 +18,11 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
|
|||||||
private declare sdk: OpenTelemetrySDKNode.NodeSDK
|
private declare sdk: OpenTelemetrySDKNode.NodeSDK
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceName: string,
|
private options: {
|
||||||
private spanRatio?: number,
|
serviceName: string
|
||||||
|
spanRatio?: number
|
||||||
|
metricExportIntervalMillis?: number
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
this.build()
|
this.build()
|
||||||
}
|
}
|
||||||
@@ -27,24 +30,28 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
|
|||||||
build(): void {
|
build(): void {
|
||||||
const otResource = OpenTelemetrySDKNode.resources.Resource.default().merge(
|
const otResource = OpenTelemetrySDKNode.resources.Resource.default().merge(
|
||||||
new OpenTelemetrySDKNode.resources.Resource({
|
new OpenTelemetrySDKNode.resources.Resource({
|
||||||
[SemanticResourceAttributes.SERVICE_NAME]: this.serviceName,
|
[SemanticResourceAttributes.SERVICE_NAME]: this.options.serviceName,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter()
|
const traceExporter = new OTLPTraceExporter()
|
||||||
|
|
||||||
const spanProcessor = new OpenTelemetrySDKNode.tracing.BatchSpanProcessor(traceExporter)
|
const spanProcessor = new OpenTelemetrySDKNode.tracing.BatchSpanProcessor(traceExporter)
|
||||||
|
|
||||||
|
const metricExportIntervalMillis = this.options.metricExportIntervalMillis ?? 300_000
|
||||||
const metricReader = new OpenTelemetrySDKNode.metrics.PeriodicExportingMetricReader({
|
const metricReader = new OpenTelemetrySDKNode.metrics.PeriodicExportingMetricReader({
|
||||||
exportIntervalMillis: 1_000,
|
exportIntervalMillis: metricExportIntervalMillis,
|
||||||
exporter: new OTLPMetricExporter(),
|
exporter: new OTLPMetricExporter(),
|
||||||
})
|
})
|
||||||
|
|
||||||
const serviceName = this.serviceName
|
const serviceName = this.options.serviceName
|
||||||
const winstonInstrumentation = new WinstonInstrumentation({
|
const winstonInstrumentation = new WinstonInstrumentation({
|
||||||
logHook: (_span, record) => {
|
logHook: (_span, record) => {
|
||||||
record['resource.service.name'] = serviceName
|
record['resource.service.name'] = serviceName
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const ratio = this.spanRatio ?? 0.01
|
const ratio = this.options.spanRatio ?? 0.01
|
||||||
|
|
||||||
this.sdk = new OpenTelemetrySDKNode.NodeSDK({
|
this.sdk = new OpenTelemetrySDKNode.NodeSDK({
|
||||||
sampler: new OpenTelemetrySDKNode.tracing.TraceIdRatioBasedSampler(ratio),
|
sampler: new OpenTelemetrySDKNode.tracing.TraceIdRatioBasedSampler(ratio),
|
||||||
@@ -60,8 +67,12 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
|
|||||||
new ExpressInstrumentation(),
|
new ExpressInstrumentation(),
|
||||||
new AwsInstrumentation({
|
new AwsInstrumentation({
|
||||||
suppressInternalInstrumentation: true,
|
suppressInternalInstrumentation: true,
|
||||||
|
sqsExtractContextPropagationFromPayload: true,
|
||||||
|
}),
|
||||||
|
new TypeormInstrumentation({
|
||||||
|
collectParameters: false,
|
||||||
|
suppressInternalInstrumentation: true,
|
||||||
}),
|
}),
|
||||||
new TypeormInstrumentation(),
|
|
||||||
winstonInstrumentation,
|
winstonInstrumentation,
|
||||||
new IORedisInstrumentation(),
|
new IORedisInstrumentation(),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ export class OpenTelemetryTracer implements OpenTelemetryTracerInterface {
|
|||||||
private parentSpan: OpenTelemetryApi.Span | undefined
|
private parentSpan: OpenTelemetryApi.Span | undefined
|
||||||
private internalSpan: OpenTelemetryApi.Span | undefined
|
private internalSpan: OpenTelemetryApi.Span | undefined
|
||||||
|
|
||||||
startSpan(parentSpanName: string, internalSpanName: string, activeContext?: OpenTelemetryApi.Context): void {
|
startSpan(parentSpanName: string, internalSpanName: string): void {
|
||||||
const tracer = OpenTelemetryApi.trace.getTracer(`${parentSpanName}-handler`)
|
const tracer = OpenTelemetryApi.trace.getTracer(`${parentSpanName}-handler`)
|
||||||
|
|
||||||
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER }, activeContext)
|
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER })
|
||||||
const ctx = OpenTelemetryApi.trace.setSpan(activeContext ?? OpenTelemetryApi.context.active(), this.parentSpan)
|
const ctx = OpenTelemetryApi.trace.setSpan(OpenTelemetryApi.context.active(), this.parentSpan)
|
||||||
|
|
||||||
this.internalSpan = tracer.startSpan(internalSpanName, { kind: OpenTelemetryApi.SpanKind.INTERNAL }, ctx)
|
this.internalSpan = tracer.startSpan(internalSpanName, { kind: OpenTelemetryApi.SpanKind.INTERNAL }, ctx)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import { Context } from '@opentelemetry/api'
|
|
||||||
|
|
||||||
export interface OpenTelemetryTracerInterface {
|
export interface OpenTelemetryTracerInterface {
|
||||||
startSpan(parentSpanName: string, internalSpanName: string, activeContext?: Context): void
|
startSpan(parentSpanName: string, internalSpanName: string): void
|
||||||
stopSpan(): void
|
stopSpan(): void
|
||||||
stopSpanWithError(error: Error): void
|
stopSpanWithError(error: Error): void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,14 @@ import * as zlib from 'zlib'
|
|||||||
import { MessageAttributeValue, PublishCommand, PublishCommandInput, SNSClient } from '@aws-sdk/client-sns'
|
import { MessageAttributeValue, PublishCommand, PublishCommandInput, SNSClient } from '@aws-sdk/client-sns'
|
||||||
|
|
||||||
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
import { OpenTelemetryPropagationInterface } from '../OpenTelemetry/OpenTelemetryPropagationInterface'
|
|
||||||
|
|
||||||
export class SNSOpenTelemetryDomainEventPublisher implements DomainEventPublisherInterface {
|
export class SNSOpenTelemetryDomainEventPublisher implements DomainEventPublisherInterface {
|
||||||
constructor(
|
constructor(
|
||||||
private propagator: OpenTelemetryPropagationInterface,
|
|
||||||
private snsClient: SNSClient,
|
private snsClient: SNSClient,
|
||||||
private topicArn: string,
|
private topicArn: string,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async publish(event: DomainEventInterface): Promise<void> {
|
async publish(event: DomainEventInterface): Promise<void> {
|
||||||
const trace = this.propagator.inject()
|
|
||||||
event.meta.trace = trace
|
|
||||||
|
|
||||||
const message: PublishCommandInput = {
|
const message: PublishCommandInput = {
|
||||||
TopicArn: this.topicArn,
|
TopicArn: this.topicArn,
|
||||||
MessageAttributes: {
|
MessageAttributes: {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class SQSDomainEventSubscriberFactory implements DomainEventSubscriberFac
|
|||||||
create(): DomainEventSubscriberInterface {
|
create(): DomainEventSubscriberInterface {
|
||||||
const sqsConsumer = Consumer.create({
|
const sqsConsumer = Consumer.create({
|
||||||
attributeNames: ['All'],
|
attributeNames: ['All'],
|
||||||
messageAttributeNames: ['compression', 'event'],
|
messageAttributeNames: ['All'],
|
||||||
queueUrl: this.queueUrl,
|
queueUrl: this.queueUrl,
|
||||||
sqs: this.sqs,
|
sqs: this.sqs,
|
||||||
handleMessage:
|
handleMessage:
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ import {
|
|||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
|
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
|
||||||
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
|
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
|
||||||
import { OpenTelemetryPropagationInterface } from '../OpenTelemetry/OpenTelemetryPropagationInterface'
|
|
||||||
|
|
||||||
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
|
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
|
||||||
private tracer: OpenTelemetryTracerInterface | undefined
|
private tracer: OpenTelemetryTracerInterface | undefined
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceName: string,
|
private serviceName: string,
|
||||||
private propagator: OpenTelemetryPropagationInterface,
|
|
||||||
private handlers: Map<string, DomainEventHandlerInterface>,
|
private handlers: Map<string, DomainEventHandlerInterface>,
|
||||||
private logger: Logger,
|
private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
@@ -35,18 +33,11 @@ export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info(`Received event: ${domainEvent.type}`)
|
this.logger.debug(`Received event: ${domainEvent.type}`)
|
||||||
|
|
||||||
this.tracer = new OpenTelemetryTracer()
|
this.tracer = new OpenTelemetryTracer()
|
||||||
|
|
||||||
let activeContext = undefined
|
this.tracer.startSpan(this.serviceName, domainEvent.type)
|
||||||
if (domainEvent.meta.trace) {
|
|
||||||
this.logger.info(`Event has trace: ${JSON.stringify(domainEvent.meta.trace)}`)
|
|
||||||
|
|
||||||
activeContext = this.propagator.extract(domainEvent.meta.trace)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.tracer.startSpan(this.serviceName, domainEvent.type, activeContext)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await handler.handle(domainEvent)
|
await handler.handle(domainEvent)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
export * from './DirectCall/DirectCallDomainEventPublisher'
|
export * from './DirectCall/DirectCallDomainEventPublisher'
|
||||||
export * from './DirectCall/DirectCallEventMessageHandler'
|
export * from './DirectCall/DirectCallEventMessageHandler'
|
||||||
|
|
||||||
export * from './OpenTelemetry/OpenTelemetryPropagation'
|
|
||||||
export * from './OpenTelemetry/OpenTelemetryPropagationInterface'
|
|
||||||
export * from './OpenTelemetry/OpenTelemetrySDK'
|
export * from './OpenTelemetry/OpenTelemetrySDK'
|
||||||
export * from './OpenTelemetry/OpenTelemetrySDKInterface'
|
export * from './OpenTelemetry/OpenTelemetrySDKInterface'
|
||||||
export * from './OpenTelemetry/OpenTelemetryTracer'
|
export * from './OpenTelemetry/OpenTelemetryTracer'
|
||||||
|
|||||||
@@ -3,6 +3,24 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.132.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.132.2...@standardnotes/domain-events@2.132.3) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* passing key params for backup requests ([#867](https://github.com/standardnotes/server/issues/867)) ([0739816](https://github.com/standardnotes/server/commit/07398169c80e7871cd04d889f471c3eef70e1aae))
|
||||||
|
|
||||||
|
## [2.132.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.132.1...@standardnotes/domain-events@2.132.2) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
|
||||||
|
## [2.132.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.132.0...@standardnotes/domain-events@2.132.1) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* injecting opentelemetry trace into sqs/sns coms ([4a6f90b](https://github.com/standardnotes/server/commit/4a6f90b95b39e7990b10dd4b96d549e1366383fe))
|
||||||
|
|
||||||
# [2.132.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.131.1...@standardnotes/domain-events@2.132.0) (2023-10-11)
|
# [2.132.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.131.1...@standardnotes/domain-events@2.132.0) (2023-10-11)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events",
|
"name": "@standardnotes/domain-events",
|
||||||
"version": "2.132.0",
|
"version": "2.132.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ export interface DomainEventInterface {
|
|||||||
userIdentifier: string
|
userIdentifier: string
|
||||||
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
|
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
|
||||||
}
|
}
|
||||||
trace?: {
|
|
||||||
traceparent?: string
|
|
||||||
tracestate?: string
|
|
||||||
}
|
|
||||||
origin: DomainEventService
|
origin: DomainEventService
|
||||||
target?: DomainEventService
|
target?: DomainEventService
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export interface EmailBackupRequestedEventPayload {
|
|||||||
userUuid: string
|
userUuid: string
|
||||||
userHasEmailsMuted: boolean
|
userHasEmailsMuted: boolean
|
||||||
muteEmailsSettingUuid: string
|
muteEmailsSettingUuid: string
|
||||||
|
keyParams: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,30 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.13.12](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.11...@standardnotes/event-store@1.13.12) (2023-10-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.13.11](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.10...@standardnotes/event-store@1.13.11) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.13.10](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.9...@standardnotes/event-store@1.13.10) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.13.9](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.8...@standardnotes/event-store@1.13.9) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.13.8](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.7...@standardnotes/event-store@1.13.8) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.13.7](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.6...@standardnotes/event-store@1.13.7) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
## [1.13.6](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.5...@standardnotes/event-store@1.13.6) (2023-10-11)
|
## [1.13.6](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.5...@standardnotes/event-store@1.13.6) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/event-store
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/event-store",
|
"name": "@standardnotes/event-store",
|
||||||
"version": "1.13.6",
|
"version": "1.13.12",
|
||||||
"description": "Event Store Service",
|
"description": "Event Store Service",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,35 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.30.7](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.6...@standardnotes/files-server@1.30.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/files/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.30.6](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.5...@standardnotes/files-server@1.30.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.30.5](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.4...@standardnotes/files-server@1.30.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.30.4](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.3...@standardnotes/files-server@1.30.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/files/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/files/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.30.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.2...@standardnotes/files-server@1.30.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.30.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.1...@standardnotes/files-server@1.30.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
## [1.30.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.0...@standardnotes/files-server@1.30.1) (2023-10-11)
|
## [1.30.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.0...@standardnotes/files-server@1.30.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/files-server
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Files)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Files })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import * as busboy from 'connect-busboy'
|
import * as busboy from 'connect-busboy'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.FilesWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.FilesWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/files-server",
|
"name": "@standardnotes/files-server",
|
||||||
"version": "1.30.1",
|
"version": "1.30.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,12 +16,9 @@ import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
OpenTelemetryPropagation,
|
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { StreamDownloadFile } from '../Domain/UseCase/StreamDownloadFile/StreamDownloadFile'
|
import { StreamDownloadFile } from '../Domain/UseCase/StreamDownloadFile/StreamDownloadFile'
|
||||||
import { FileDownloaderInterface } from '../Domain/Services/FileDownloaderInterface'
|
import { FileDownloaderInterface } from '../Domain/Services/FileDownloaderInterface'
|
||||||
@@ -55,7 +52,6 @@ import { S3FileMover } from '../Infra/S3/S3FileMover'
|
|||||||
import { FSFileMover } from '../Infra/FS/FSFileMover'
|
import { FSFileMover } from '../Infra/FS/FSFileMover'
|
||||||
import { MoveFile } from '../Domain/UseCase/MoveFile/MoveFile'
|
import { MoveFile } from '../Domain/UseCase/MoveFile/MoveFile'
|
||||||
import { SharedVaultValetTokenAuthMiddleware } from '../Infra/InversifyExpress/Middleware/SharedVaultValetTokenAuthMiddleware'
|
import { SharedVaultValetTokenAuthMiddleware } from '../Infra/InversifyExpress/Middleware/SharedVaultValetTokenAuthMiddleware'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(configuration?: {
|
async load(configuration?: {
|
||||||
@@ -100,10 +96,6 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())
|
||||||
|
|
||||||
container
|
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
// services
|
// services
|
||||||
container
|
container
|
||||||
.bind<TokenDecoderInterface<ValetTokenData>>(TYPES.Files_ValetTokenDecoder)
|
.bind<TokenDecoderInterface<ValetTokenData>>(TYPES.Files_ValetTokenDecoder)
|
||||||
@@ -183,7 +175,6 @@ export class ContainerConfigLoader {
|
|||||||
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SNSOpenTelemetryDomainEventPublisher(
|
new SNSOpenTelemetryDomainEventPublisher(
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR),
|
|
||||||
container.get(TYPES.Files_SNS),
|
container.get(TYPES.Files_SNS),
|
||||||
container.get(TYPES.Files_SNS_TOPIC_ARN),
|
container.get(TYPES.Files_SNS_TOPIC_ARN),
|
||||||
),
|
),
|
||||||
@@ -305,16 +296,7 @@ export class ContainerConfigLoader {
|
|||||||
} else {
|
} else {
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Files_Logger)))
|
||||||
isConfiguredForHomeServerOrSelfHosting
|
|
||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Files_Logger))
|
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.FilesWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Files_Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Files_DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Files_DomainEventSubscriberFactory)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const TYPES = {
|
|||||||
Files_S3: Symbol.for('Files_S3'),
|
Files_S3: Symbol.for('Files_S3'),
|
||||||
Files_SNS: Symbol.for('Files_SNS'),
|
Files_SNS: Symbol.for('Files_SNS'),
|
||||||
Files_SQS: Symbol.for('Files_SQS'),
|
Files_SQS: Symbol.for('Files_SQS'),
|
||||||
Files_OTEL_PROPAGATOR: Symbol.for('Files_OTEL_PROPAGATOR'),
|
|
||||||
|
|
||||||
// use cases
|
// use cases
|
||||||
Files_UploadFileChunk: Symbol.for('Files_UploadFileChunk'),
|
Files_UploadFileChunk: Symbol.for('Files_UploadFileChunk'),
|
||||||
|
|||||||
@@ -3,6 +3,30 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.17.13](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.12...@standardnotes/home-server@1.17.13) (2023-10-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
|
## [1.17.12](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.11...@standardnotes/home-server@1.17.12) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
|
## [1.17.11](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.10...@standardnotes/home-server@1.17.11) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
|
## [1.17.10](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.9...@standardnotes/home-server@1.17.10) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
|
## [1.17.9](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.8...@standardnotes/home-server@1.17.9) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
|
## [1.17.8](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.7...@standardnotes/home-server@1.17.8) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|
||||||
## [1.17.7](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.6...@standardnotes/home-server@1.17.7) (2023-10-11)
|
## [1.17.7](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.6...@standardnotes/home-server@1.17.7) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/home-server
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/home-server",
|
"name": "@standardnotes/home-server",
|
||||||
"version": "1.17.7",
|
"version": "1.17.13",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,35 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.45.7](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.6...@standardnotes/revisions-server@1.45.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.45.6](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.5...@standardnotes/revisions-server@1.45.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.45.5](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.4...@standardnotes/revisions-server@1.45.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.45.4](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.3...@standardnotes/revisions-server@1.45.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/server/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.45.3](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.2...@standardnotes/revisions-server@1.45.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.45.2](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.1...@standardnotes/revisions-server@1.45.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
## [1.45.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.0...@standardnotes/revisions-server@1.45.1) (2023-10-11)
|
## [1.45.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.0...@standardnotes/revisions-server@1.45.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/revisions-server
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Revisions)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Revisions })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import * as cors from 'cors'
|
import * as cors from 'cors'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.RevisionsWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.RevisionsWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/revisions-server",
|
"name": "@standardnotes/revisions-server",
|
||||||
"version": "1.45.1",
|
"version": "1.45.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { ControllerContainer, ControllerContainerInterface, MapperInterface } from '@standardnotes/domain-core'
|
||||||
ControllerContainer,
|
|
||||||
ControllerContainerInterface,
|
|
||||||
MapperInterface,
|
|
||||||
ServiceIdentifier,
|
|
||||||
} from '@standardnotes/domain-core'
|
|
||||||
import Redis from 'ioredis'
|
import Redis from 'ioredis'
|
||||||
import { Container, interfaces } from 'inversify'
|
import { Container, interfaces } from 'inversify'
|
||||||
import { MongoRepository, Repository } from 'typeorm'
|
import { MongoRepository, Repository } from 'typeorm'
|
||||||
@@ -39,10 +34,7 @@ import {
|
|||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
|
||||||
OpenTelemetryPropagation,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
||||||
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
||||||
@@ -142,10 +134,6 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container.bind<TimerInterface>(TYPES.Revisions_Timer).toDynamicValue(() => new Timer())
|
container.bind<TimerInterface>(TYPES.Revisions_Timer).toDynamicValue(() => new Timer())
|
||||||
|
|
||||||
container
|
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
|
|
||||||
@@ -187,7 +175,6 @@ export class ContainerConfigLoader {
|
|||||||
.bind<DomainEventPublisherInterface>(TYPES.Revisions_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Revisions_DomainEventPublisher)
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
.toDynamicValue((context: interfaces.Context) => {
|
||||||
return new SNSOpenTelemetryDomainEventPublisher(
|
return new SNSOpenTelemetryDomainEventPublisher(
|
||||||
context.container.get<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR),
|
|
||||||
context.container.get(TYPES.Revisions_SNS),
|
context.container.get(TYPES.Revisions_SNS),
|
||||||
context.container.get(TYPES.Revisions_SNS_TOPIC_ARN),
|
context.container.get(TYPES.Revisions_SNS_TOPIC_ARN),
|
||||||
)
|
)
|
||||||
@@ -517,16 +504,7 @@ export class ContainerConfigLoader {
|
|||||||
} else {
|
} else {
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger)))
|
||||||
isConfiguredForHomeServerOrSelfHosting
|
|
||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
|
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.RevisionsWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Revisions_Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Revisions_DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Revisions_DomainEventSubscriberFactory)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ const TYPES = {
|
|||||||
Revisions_SNS: Symbol.for('Revisions_SNS'),
|
Revisions_SNS: Symbol.for('Revisions_SNS'),
|
||||||
Revisions_S3: Symbol.for('Revisions_S3'),
|
Revisions_S3: Symbol.for('Revisions_S3'),
|
||||||
Revisions_Env: Symbol.for('Revisions_Env'),
|
Revisions_Env: Symbol.for('Revisions_Env'),
|
||||||
Revisions_OTEL_PROPAGATOR: Symbol.for('Revisions_OTEL_PROPAGATOR'),
|
|
||||||
// Map
|
// Map
|
||||||
Revisions_SQLLegacyRevisionMetadataPersistenceMapper: Symbol.for(
|
Revisions_SQLLegacyRevisionMetadataPersistenceMapper: Symbol.for(
|
||||||
'Revisions_SQLLegacyRevisionMetadataPersistenceMapper',
|
'Revisions_SQLLegacyRevisionMetadataPersistenceMapper',
|
||||||
|
|||||||
@@ -3,6 +3,35 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.25.7](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.6...@standardnotes/scheduler-server@1.25.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.25.6](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.5...@standardnotes/scheduler-server@1.25.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
## [1.25.5](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.4...@standardnotes/scheduler-server@1.25.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
## [1.25.4](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.3...@standardnotes/scheduler-server@1.25.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/server/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.25.3](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.2...@standardnotes/scheduler-server@1.25.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
## [1.25.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.1...@standardnotes/scheduler-server@1.25.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
## [1.25.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.0...@standardnotes/scheduler-server@1.25.1) (2023-10-11)
|
## [1.25.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.0...@standardnotes/scheduler-server@1.25.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SchedulerScheduledTask)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerScheduledTask })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SchedulerWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/scheduler-server",
|
"name": "@standardnotes/scheduler-server",
|
||||||
"version": "1.25.1",
|
"version": "1.25.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,11 +15,9 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
OpenTelemetryPropagation,
|
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { Timer, TimerInterface } from '@standardnotes/time'
|
import { Timer, TimerInterface } from '@standardnotes/time'
|
||||||
import { PredicateRepositoryInterface } from '../Domain/Predicate/PredicateRepositoryInterface'
|
import { PredicateRepositoryInterface } from '../Domain/Predicate/PredicateRepositoryInterface'
|
||||||
@@ -37,7 +35,6 @@ import { VerifyPredicates } from '../Domain/UseCase/VerifyPredicates/VerifyPredi
|
|||||||
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
|
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
|
||||||
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
|
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
|
||||||
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
|
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(): Promise<Container> {
|
async load(): Promise<Container> {
|
||||||
@@ -68,10 +65,6 @@ export class ContainerConfigLoader {
|
|||||||
})
|
})
|
||||||
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
||||||
|
|
||||||
container
|
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
if (env.get('SNS_TOPIC_ARN', true)) {
|
||||||
const snsConfig: SNSClientConfig = {
|
const snsConfig: SNSClientConfig = {
|
||||||
apiVersion: 'latest',
|
apiVersion: 'latest',
|
||||||
@@ -143,11 +136,7 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SNSOpenTelemetryDomainEventPublisher(
|
new SNSOpenTelemetryDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)),
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR),
|
|
||||||
container.get(TYPES.SNS),
|
|
||||||
container.get(TYPES.SNS_TOPIC_ARN),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
@@ -159,14 +148,7 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.SchedulerWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const TYPES = {
|
|||||||
Redis: Symbol.for('Redis'),
|
Redis: Symbol.for('Redis'),
|
||||||
SNS: Symbol.for('SNS'),
|
SNS: Symbol.for('SNS'),
|
||||||
SQS: Symbol.for('SQS'),
|
SQS: Symbol.for('SQS'),
|
||||||
Scheduler_OTEL_PROPAGATOR: Symbol.for('Scheduler_OTEL_PROPAGATOR'),
|
|
||||||
// env vars
|
// env vars
|
||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
||||||
|
|||||||
@@ -3,6 +3,37 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.117.7](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.6...@standardnotes/syncing-server@1.117.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/syncing-server-js/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.117.6](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.5...@standardnotes/syncing-server@1.117.6) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* passing key params for backup requests ([#867](https://github.com/standardnotes/syncing-server-js/issues/867)) ([0739816](https://github.com/standardnotes/syncing-server-js/commit/07398169c80e7871cd04d889f471c3eef70e1aae))
|
||||||
|
|
||||||
|
## [1.117.5](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.4...@standardnotes/syncing-server@1.117.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
|
## [1.117.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.3...@standardnotes/syncing-server@1.117.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/syncing-server-js/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/syncing-server-js/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.117.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.2...@standardnotes/syncing-server@1.117.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
|
## [1.117.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.1...@standardnotes/syncing-server@1.117.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
## [1.117.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.0...@standardnotes/syncing-server@1.117.1) (2023-10-11)
|
## [1.117.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.0...@standardnotes/syncing-server@1.117.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SyncingServer)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SyncingServer })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SyncingServerWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SyncingServerWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/syncing-server",
|
"name": "@standardnotes/syncing-server",
|
||||||
"version": "1.117.1",
|
"version": "1.117.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,12 +13,9 @@ import { Item } from '../Domain/Item/Item'
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
OpenTelemetryPropagation,
|
|
||||||
OpenTelemetryPropagationInterface,
|
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
@@ -50,7 +47,6 @@ import {
|
|||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import axios, { AxiosInstance } from 'axios'
|
import axios, { AxiosInstance } from 'axios'
|
||||||
import { AuthHttpServiceInterface } from '../Domain/Auth/AuthHttpServiceInterface'
|
|
||||||
import { ExtensionsHttpService } from '../Domain/Extension/ExtensionsHttpService'
|
import { ExtensionsHttpService } from '../Domain/Extension/ExtensionsHttpService'
|
||||||
import { ExtensionsHttpServiceInterface } from '../Domain/Extension/ExtensionsHttpServiceInterface'
|
import { ExtensionsHttpServiceInterface } from '../Domain/Extension/ExtensionsHttpServiceInterface'
|
||||||
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
||||||
@@ -59,13 +55,11 @@ import { EmailBackupRequestedEventHandler } from '../Domain/Handler/EmailBackupR
|
|||||||
import { ItemRevisionCreationRequestedEventHandler } from '../Domain/Handler/ItemRevisionCreationRequestedEventHandler'
|
import { ItemRevisionCreationRequestedEventHandler } from '../Domain/Handler/ItemRevisionCreationRequestedEventHandler'
|
||||||
import { ItemBackupServiceInterface } from '../Domain/Item/ItemBackupServiceInterface'
|
import { ItemBackupServiceInterface } from '../Domain/Item/ItemBackupServiceInterface'
|
||||||
import { FSItemBackupService } from '../Infra/FS/FSItemBackupService'
|
import { FSItemBackupService } from '../Infra/FS/FSItemBackupService'
|
||||||
import { AuthHttpService } from '../Infra/HTTP/AuthHttpService'
|
|
||||||
import { S3ItemBackupService } from '../Infra/S3/S3ItemBackupService'
|
import { S3ItemBackupService } from '../Infra/S3/S3ItemBackupService'
|
||||||
import {
|
import {
|
||||||
ControllerContainer,
|
ControllerContainer,
|
||||||
ControllerContainerInterface,
|
ControllerContainerInterface,
|
||||||
MapperInterface,
|
MapperInterface,
|
||||||
ServiceIdentifier,
|
|
||||||
SharedVaultUser,
|
SharedVaultUser,
|
||||||
} from '@standardnotes/domain-core'
|
} from '@standardnotes/domain-core'
|
||||||
import { BaseItemsController } from '../Infra/InversifyExpressUtils/Base/BaseItemsController'
|
import { BaseItemsController } from '../Infra/InversifyExpressUtils/Base/BaseItemsController'
|
||||||
@@ -218,10 +212,6 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
container.bind<winston.Logger>(TYPES.Sync_Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Sync_Logger).toConstantValue(logger)
|
||||||
|
|
||||||
container
|
|
||||||
.bind<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR)
|
|
||||||
.toConstantValue(new OpenTelemetryPropagation())
|
|
||||||
|
|
||||||
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
|
|
||||||
@@ -293,7 +283,6 @@ export class ContainerConfigLoader {
|
|||||||
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
.toDynamicValue((context: interfaces.Context) => {
|
||||||
return new SNSOpenTelemetryDomainEventPublisher(
|
return new SNSOpenTelemetryDomainEventPublisher(
|
||||||
context.container.get<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR),
|
|
||||||
context.container.get(TYPES.Sync_SNS),
|
context.container.get(TYPES.Sync_SNS),
|
||||||
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
||||||
)
|
)
|
||||||
@@ -1113,17 +1102,6 @@ export class ContainerConfigLoader {
|
|||||||
],
|
],
|
||||||
])
|
])
|
||||||
if (!isConfiguredForHomeServer) {
|
if (!isConfiguredForHomeServer) {
|
||||||
container.bind(TYPES.Sync_AUTH_SERVER_URL).toConstantValue(env.get('AUTH_SERVER_URL'))
|
|
||||||
|
|
||||||
container
|
|
||||||
.bind<AuthHttpServiceInterface>(TYPES.Sync_AuthHttpService)
|
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
|
||||||
return new AuthHttpService(
|
|
||||||
context.container.get(TYPES.Sync_HTTPClient),
|
|
||||||
context.container.get(TYPES.Sync_AUTH_SERVER_URL),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<EmailBackupRequestedEventHandler>(TYPES.Sync_EmailBackupRequestedEventHandler)
|
.bind<EmailBackupRequestedEventHandler>(TYPES.Sync_EmailBackupRequestedEventHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
@@ -1132,7 +1110,6 @@ export class ContainerConfigLoader {
|
|||||||
isSecondaryDatabaseEnabled
|
isSecondaryDatabaseEnabled
|
||||||
? container.get<ItemRepositoryInterface>(TYPES.Sync_MongoDBItemRepository)
|
? container.get<ItemRepositoryInterface>(TYPES.Sync_MongoDBItemRepository)
|
||||||
: null,
|
: null,
|
||||||
container.get<AuthHttpServiceInterface>(TYPES.Sync_AuthHttpService),
|
|
||||||
container.get<ItemBackupServiceInterface>(TYPES.Sync_ItemBackupService),
|
container.get<ItemBackupServiceInterface>(TYPES.Sync_ItemBackupService),
|
||||||
container.get<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher),
|
container.get<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher),
|
||||||
container.get<DomainEventFactoryInterface>(TYPES.Sync_DomainEventFactory),
|
container.get<DomainEventFactoryInterface>(TYPES.Sync_DomainEventFactory),
|
||||||
@@ -1159,16 +1136,7 @@ export class ContainerConfigLoader {
|
|||||||
} else {
|
} else {
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.Sync_DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.Sync_DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger)))
|
||||||
isConfiguredForHomeServerOrSelfHosting
|
|
||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger))
|
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.SyncingServerWorker,
|
|
||||||
container.get<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Sync_Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
container
|
container
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ const TYPES = {
|
|||||||
Sync_SQS: Symbol.for('Sync_SQS'),
|
Sync_SQS: Symbol.for('Sync_SQS'),
|
||||||
Sync_S3: Symbol.for('Sync_S3'),
|
Sync_S3: Symbol.for('Sync_S3'),
|
||||||
Sync_Env: Symbol.for('Sync_Env'),
|
Sync_Env: Symbol.for('Sync_Env'),
|
||||||
Sync_OTEL_PROPAGATOR: Symbol.for('Sync_OTEL_PROPAGATOR'),
|
|
||||||
// Repositories
|
// Repositories
|
||||||
Sync_ItemRepositoryResolver: Symbol.for('Sync_ItemRepositoryResolver'),
|
Sync_ItemRepositoryResolver: Symbol.for('Sync_ItemRepositoryResolver'),
|
||||||
Sync_SQLItemRepository: Symbol.for('Sync_SQLItemRepository'),
|
Sync_SQLItemRepository: Symbol.for('Sync_SQLItemRepository'),
|
||||||
@@ -37,7 +36,6 @@ const TYPES = {
|
|||||||
Sync_SQS_AWS_REGION: Symbol.for('Sync_SQS_AWS_REGION'),
|
Sync_SQS_AWS_REGION: Symbol.for('Sync_SQS_AWS_REGION'),
|
||||||
Sync_AUTH_JWT_SECRET: Symbol.for('Sync_AUTH_JWT_SECRET'),
|
Sync_AUTH_JWT_SECRET: Symbol.for('Sync_AUTH_JWT_SECRET'),
|
||||||
Sync_EXTENSIONS_SERVER_URL: Symbol.for('Sync_EXTENSIONS_SERVER_URL'),
|
Sync_EXTENSIONS_SERVER_URL: Symbol.for('Sync_EXTENSIONS_SERVER_URL'),
|
||||||
Sync_AUTH_SERVER_URL: Symbol.for('Sync_AUTH_SERVER_URL'),
|
|
||||||
Sync_S3_AWS_REGION: Symbol.for('Sync_S3_AWS_REGION'),
|
Sync_S3_AWS_REGION: Symbol.for('Sync_S3_AWS_REGION'),
|
||||||
Sync_S3_BACKUP_BUCKET_NAME: Symbol.for('Sync_S3_BACKUP_BUCKET_NAME'),
|
Sync_S3_BACKUP_BUCKET_NAME: Symbol.for('Sync_S3_BACKUP_BUCKET_NAME'),
|
||||||
Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE: Symbol.for('Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE'),
|
Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE: Symbol.for('Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE'),
|
||||||
@@ -116,7 +114,6 @@ const TYPES = {
|
|||||||
Sync_SyncResponseFactory20161215: Symbol.for('Sync_SyncResponseFactory20161215'),
|
Sync_SyncResponseFactory20161215: Symbol.for('Sync_SyncResponseFactory20161215'),
|
||||||
Sync_SyncResponseFactory20200115: Symbol.for('Sync_SyncResponseFactory20200115'),
|
Sync_SyncResponseFactory20200115: Symbol.for('Sync_SyncResponseFactory20200115'),
|
||||||
Sync_SyncResponseFactoryResolver: Symbol.for('Sync_SyncResponseFactoryResolver'),
|
Sync_SyncResponseFactoryResolver: Symbol.for('Sync_SyncResponseFactoryResolver'),
|
||||||
Sync_AuthHttpService: Symbol.for('Sync_AuthHttpService'),
|
|
||||||
Sync_ExtensionsHttpService: Symbol.for('Sync_ExtensionsHttpService'),
|
Sync_ExtensionsHttpService: Symbol.for('Sync_ExtensionsHttpService'),
|
||||||
Sync_ItemBackupService: Symbol.for('Sync_ItemBackupService'),
|
Sync_ItemBackupService: Symbol.for('Sync_ItemBackupService'),
|
||||||
Sync_ItemSaveValidator: Symbol.for('Sync_ItemSaveValidator'),
|
Sync_ItemSaveValidator: Symbol.for('Sync_ItemSaveValidator'),
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { KeyParamsData } from '@standardnotes/responses'
|
|
||||||
|
|
||||||
export interface AuthHttpServiceInterface {
|
|
||||||
getUserKeyParams(userUuid: string): Promise<KeyParamsData>
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { KeyParamsData } from '@standardnotes/responses'
|
|
||||||
import {
|
import {
|
||||||
DomainEventHandlerInterface,
|
DomainEventHandlerInterface,
|
||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
@@ -6,7 +5,6 @@ import {
|
|||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { EmailLevel } from '@standardnotes/domain-core'
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { AuthHttpServiceInterface } from '../Auth/AuthHttpServiceInterface'
|
|
||||||
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
||||||
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||||
@@ -18,7 +16,6 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
constructor(
|
constructor(
|
||||||
private primaryItemRepository: ItemRepositoryInterface,
|
private primaryItemRepository: ItemRepositoryInterface,
|
||||||
private secondaryItemRepository: ItemRepositoryInterface | null,
|
private secondaryItemRepository: ItemRepositoryInterface | null,
|
||||||
private authHttpService: AuthHttpServiceInterface,
|
|
||||||
private itemBackupService: ItemBackupServiceInterface,
|
private itemBackupService: ItemBackupServiceInterface,
|
||||||
private domainEventPublisher: DomainEventPublisherInterface,
|
private domainEventPublisher: DomainEventPublisherInterface,
|
||||||
private domainEventFactory: DomainEventFactoryInterface,
|
private domainEventFactory: DomainEventFactoryInterface,
|
||||||
@@ -40,19 +37,6 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
event: EmailBackupRequestedEvent,
|
event: EmailBackupRequestedEvent,
|
||||||
itemRepository: ItemRepositoryInterface,
|
itemRepository: ItemRepositoryInterface,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
let authParams: KeyParamsData
|
|
||||||
try {
|
|
||||||
authParams = await this.authHttpService.getUserKeyParams(event.payload.userUuid)
|
|
||||||
} catch (error) {
|
|
||||||
this.logger.error(
|
|
||||||
`Could not get user key params from auth service for user ${event.payload.userUuid}: ${
|
|
||||||
(error as Error).message
|
|
||||||
}`,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const itemQuery: ItemQuery = {
|
const itemQuery: ItemQuery = {
|
||||||
userUuid: event.payload.userUuid,
|
userUuid: event.payload.userUuid,
|
||||||
sortBy: 'updated_at_timestamp',
|
sortBy: 'updated_at_timestamp',
|
||||||
@@ -75,7 +59,7 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
|
|
||||||
const bundleBackupFileNames = await this.itemBackupService.backup(
|
const bundleBackupFileNames = await this.itemBackupService.backup(
|
||||||
items,
|
items,
|
||||||
authParams,
|
event.payload.keyParams,
|
||||||
this.emailAttachmentMaxByteSize,
|
this.emailAttachmentMaxByteSize,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -88,11 +72,11 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
for (const backupFileName of backupFileNames) {
|
for (const backupFileName of backupFileNames) {
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.domainEventFactory.createEmailRequestedEvent({
|
this.domainEventFactory.createEmailRequestedEvent({
|
||||||
body: getBody(authParams.identifier as string),
|
body: getBody(event.payload.keyParams.identifier as string),
|
||||||
level: EmailLevel.LEVELS.System,
|
level: EmailLevel.LEVELS.System,
|
||||||
messageIdentifier: 'DATA_BACKUP',
|
messageIdentifier: 'DATA_BACKUP',
|
||||||
subject: getSubject(bundleIndex++, backupFileNames.length, dateOnly),
|
subject: getSubject(bundleIndex++, backupFileNames.length, dateOnly),
|
||||||
userEmail: authParams.identifier as string,
|
userEmail: event.payload.keyParams.identifier as string,
|
||||||
sender: 'backups@standardnotes.org',
|
sender: 'backups@standardnotes.org',
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
import { KeyParamsData } from '@standardnotes/responses'
|
|
||||||
import { AxiosInstance } from 'axios'
|
|
||||||
|
|
||||||
import { AuthHttpServiceInterface } from '../../Domain/Auth/AuthHttpServiceInterface'
|
|
||||||
|
|
||||||
export class AuthHttpService implements AuthHttpServiceInterface {
|
|
||||||
constructor(
|
|
||||||
private httpClient: AxiosInstance,
|
|
||||||
private authServerUrl: string,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
async getUserKeyParams(userUuid: string): Promise<KeyParamsData> {
|
|
||||||
const keyParamsResponse = await this.httpClient.request({
|
|
||||||
method: 'GET',
|
|
||||||
timeout: 10000,
|
|
||||||
headers: {
|
|
||||||
Accept: 'application/json',
|
|
||||||
},
|
|
||||||
url: `${this.authServerUrl}/users/params?uuid=${userUuid}`,
|
|
||||||
validateStatus:
|
|
||||||
/* istanbul ignore next */
|
|
||||||
(status: number) => status >= 200 && status < 500,
|
|
||||||
})
|
|
||||||
|
|
||||||
return keyParamsResponse.data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,35 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.16.7](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.6...@standardnotes/websockets-server@1.16.7) (2023-10-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
|
||||||
|
|
||||||
|
## [1.16.6](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.5...@standardnotes/websockets-server@1.16.6) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.16.5](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.4...@standardnotes/websockets-server@1.16.5) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.16.4](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.3...@standardnotes/websockets-server@1.16.4) (2023-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable opentelemetry tracing on async worker jobs ([e0b19ef](https://github.com/standardnotes/server/commit/e0b19ef011197c854cb6e833dbaa982f661e8d17))
|
||||||
|
* disable sqs open telemetry manual tracing in favour of automated instrumentation ([337eae7](https://github.com/standardnotes/server/commit/337eae73c6cb18ae872527b06f6c23e1c48b6dff))
|
||||||
|
|
||||||
|
## [1.16.3](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.2...@standardnotes/websockets-server@1.16.3) (2023-10-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.16.2](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.1...@standardnotes/websockets-server@1.16.2) (2023-10-11)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
## [1.16.1](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.0...@standardnotes/websockets-server@1.16.1) (2023-10-11)
|
## [1.16.1](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.0...@standardnotes/websockets-server@1.16.1) (2023-10-11)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/websockets-server
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Websockets)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Websockets })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.WebsocketsWorker)
|
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.WebsocketsWorker })
|
||||||
sdk.start()
|
sdk.start()
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/websockets-server",
|
"name": "@standardnotes/websockets-server",
|
||||||
"version": "1.16.1",
|
"version": "1.16.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ import { RedisWebSocketsConnectionRepository } from '../Infra/Redis/RedisWebSock
|
|||||||
import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnection/AddWebSocketsConnection'
|
import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnection/AddWebSocketsConnection'
|
||||||
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
||||||
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
||||||
import {
|
import { SQSDomainEventSubscriberFactory, SQSEventMessageHandler } from '@standardnotes/domain-events-infra'
|
||||||
OpenTelemetryPropagation,
|
|
||||||
SQSDomainEventSubscriberFactory,
|
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
|
||||||
import { ApiGatewayAuthMiddleware } from '../Controller/ApiGatewayAuthMiddleware'
|
import { ApiGatewayAuthMiddleware } from '../Controller/ApiGatewayAuthMiddleware'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -38,7 +34,6 @@ import { WebSocketsController } from '../Controller/WebSocketsController'
|
|||||||
import { WebSocketServerInterface } from '@standardnotes/api'
|
import { WebSocketServerInterface } from '@standardnotes/api'
|
||||||
import { ClientMessengerInterface } from '../Client/ClientMessengerInterface'
|
import { ClientMessengerInterface } from '../Client/ClientMessengerInterface'
|
||||||
import { WebSocketMessageRequestedEventHandler } from '../Domain/Handler/WebSocketMessageRequestedEventHandler'
|
import { WebSocketMessageRequestedEventHandler } from '../Domain/Handler/WebSocketMessageRequestedEventHandler'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(): Promise<Container> {
|
async load(): Promise<Container> {
|
||||||
@@ -145,14 +140,7 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.toConstantValue(
|
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
|
||||||
ServiceIdentifier.NAMES.WebsocketsWorker,
|
|
||||||
new OpenTelemetryPropagation(),
|
|
||||||
eventHandlers,
|
|
||||||
container.get(TYPES.Logger),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
|
|||||||
Reference in New Issue
Block a user