Compare commits

...

16 Commits

Author SHA1 Message Date
standardci
0dbc929c8e chore(release): publish new version
- @standardnotes/api-gateway@1.34.1
 - @standardnotes/auth-server@1.48.2
 - @standardnotes/common@1.44.0
 - @standardnotes/domain-events-infra@1.9.6
 - @standardnotes/domain-events@2.73.1
 - @standardnotes/event-store@1.6.1
 - @standardnotes/files-server@1.8.1
 - @standardnotes/predicates@1.5.3
 - @standardnotes/scheduler-server@1.13.1
 - @standardnotes/security@1.5.3
 - @standardnotes/syncing-server@1.10.8
 - @standardnotes/websockets-server@1.4.1
 - @standardnotes/workspace-server@1.17.1
2022-11-03 09:25:39 +00:00
Karol Sójko
0c5305acf6 feat(common): add subscription cancelled email message identifier 2022-11-03 10:23:18 +01:00
standardci
34139efafb chore(release): publish new version
- @standardnotes/event-store@1.6.0
2022-11-03 09:21:17 +00:00
Karol Sójko
eb53c3896f feat(event-store): add discount events to event store 2022-11-03 10:18:55 +01:00
standardci
2af4c6fb55 chore(release): publish new version
- @standardnotes/scheduler-server@1.13.0
2022-11-03 09:10:52 +00:00
Karol Sójko
d66f784538 feat(scheduler): add publishing exit discount withdraw requested event 2022-11-03 10:08:52 +01:00
standardci
f127241857 chore(release): publish new version
- @standardnotes/auth-server@1.48.1
2022-11-02 13:24:02 +00:00
Karol Sójko
5b0d9dd394 fix(auth): controller name 2022-11-02 14:22:13 +01:00
standardci
ee29d18484 chore(release): publish new version
- @standardnotes/api-gateway@1.34.0
 - @standardnotes/auth-server@1.48.0
 - @standardnotes/event-store@1.5.8
 - @standardnotes/files-server@1.8.0
 - @standardnotes/scheduler-server@1.12.0
 - @standardnotes/syncing-server@1.10.7
 - @standardnotes/time@1.13.0
 - @standardnotes/websockets-server@1.4.0
 - @standardnotes/workspace-server@1.17.0
2022-11-02 12:25:40 +00:00
Karol Sójko
2255f856f9 feat(auth): add processing user requests 2022-11-02 13:23:49 +01:00
standardci
f2415527f0 chore(release): publish new version
- @standardnotes/api-gateway@1.33.6
 - @standardnotes/auth-server@1.47.7
 - @standardnotes/domain-events-infra@1.9.5
 - @standardnotes/domain-events@2.73.0
 - @standardnotes/event-store@1.5.7
 - @standardnotes/files-server@1.7.5
 - @standardnotes/scheduler-server@1.11.7
 - @standardnotes/syncing-server@1.10.6
 - @standardnotes/websockets-server@1.3.5
 - @standardnotes/workspace-server@1.16.6
2022-11-02 10:33:04 +00:00
Karol Sójko
59eb70ce62 feat(domain-events): add exit discount events 2022-11-02 11:31:10 +01:00
standardci
1d18725bc5 chore(release): publish new version
- @standardnotes/api-gateway@1.33.5
 - @standardnotes/auth-server@1.47.6
 - @standardnotes/common@1.43.0
 - @standardnotes/domain-events-infra@1.9.4
 - @standardnotes/domain-events@2.72.1
 - @standardnotes/event-store@1.5.6
 - @standardnotes/files-server@1.7.4
 - @standardnotes/predicates@1.5.2
 - @standardnotes/scheduler-server@1.11.6
 - @standardnotes/security@1.5.2
 - @standardnotes/syncing-server@1.10.5
 - @standardnotes/websockets-server@1.3.4
 - @standardnotes/workspace-server@1.16.5
2022-11-01 09:30:17 +00:00
Karol Sójko
d4af1d743e feat(common): add user request type 2022-11-01 10:28:00 +01:00
standardci
9d1a357b5b chore(release): publish new version
- @standardnotes/auth-server@1.47.5
 - @standardnotes/event-store@1.5.5
 - @standardnotes/scheduler-server@1.11.5
 - @standardnotes/syncing-server@1.10.4
 - @standardnotes/workspace-server@1.16.4
2022-11-01 06:48:36 +00:00
Karol Sójko
5160cc36dd fix: force utf8mb4 charset on typeorm 2022-11-01 07:46:15 +01:00
80 changed files with 918 additions and 121 deletions

83
.pnp.cjs generated
View File

@@ -2555,16 +2555,16 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["@standardnotes/api", [\
["npm:1.17.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.17.2-c07102ac18-4f74f52306.zip/node_modules/@standardnotes/api/",\
["npm:1.19.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.19.0-ce8296df3c-b28884be40.zip/node_modules/@standardnotes/api/",\
"packageDependencies": [\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/api", "npm:1.19.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/encryption", "npm:1.18.5"],\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/encryption", "npm:1.19.0"],\
["@standardnotes/models", "npm:1.33.0"],\
["@standardnotes/responses", "npm:1.12.0"],\
["@standardnotes/security", "workspace:packages/security"],\
["@standardnotes/utils", "npm:1.10.0"],\
["@standardnotes/utils", "npm:1.11.0"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
@@ -2635,7 +2635,7 @@ const RAW_RUNTIME_STATE =
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/analytics", "workspace:packages/analytics"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/api", "npm:1.19.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -2662,7 +2662,7 @@ const RAW_RUNTIME_STATE =
["axios", "npm:0.27.2"],\
["bcryptjs", "npm:2.4.3"],\
["cors", "npm:2.8.5"],\
["dayjs", "npm:1.11.5"],\
["dayjs", "npm:1.11.6"],\
["dotenv", "npm:16.0.1"],\
["eslint", "npm:8.25.0"],\
["eslint-plugin-prettier", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.2.1"],\
@@ -2764,15 +2764,15 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["@standardnotes/encryption", [\
["npm:1.18.5", {\
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.18.5-80059dd62d-b023188012.zip/node_modules/@standardnotes/encryption/",\
["npm:1.19.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.19.0-29799e7bcc-af7665e979.zip/node_modules/@standardnotes/encryption/",\
"packageDependencies": [\
["@standardnotes/encryption", "npm:1.18.5"],\
["@standardnotes/encryption", "npm:1.19.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/models", "npm:1.33.0"],\
["@standardnotes/responses", "npm:1.12.0"],\
["@standardnotes/sncrypto-common", "npm:1.13.0"],\
["@standardnotes/utils", "npm:1.10.0"],\
["@standardnotes/utils", "npm:1.11.0"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
@@ -2821,10 +2821,10 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "HARD"\
}],\
["npm:1.53.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.53.2-cd8faaf4ee-820219e3a5.zip/node_modules/@standardnotes/features/",\
["npm:1.54.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.54.0-15f8cf20f0-7647e7506e.zip/node_modules/@standardnotes/features/",\
"packageDependencies": [\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/features", "npm:1.54.0"],\
["@standardnotes/auth", "npm:3.19.4"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/security", "workspace:packages/security"],\
@@ -2860,7 +2860,7 @@ const RAW_RUNTIME_STATE =
["aws-sdk", "npm:2.1234.0"],\
["connect-busboy", "npm:1.0.0"],\
["cors", "npm:2.8.5"],\
["dayjs", "npm:1.11.5"],\
["dayjs", "npm:1.11.6"],\
["dotenv", "npm:16.0.1"],\
["eslint", "npm:8.25.0"],\
["eslint-plugin-prettier", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.2.1"],\
@@ -2900,14 +2900,14 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "HARD"\
}],\
["npm:1.30.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.30.0-c2134137c4-40c234f92b.zip/node_modules/@standardnotes/models/",\
["npm:1.33.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.33.0-df7d20ae6d-7d45409e4a.zip/node_modules/@standardnotes/models/",\
"packageDependencies": [\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/models", "npm:1.33.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/utils", "npm:1.10.0"],\
["@standardnotes/features", "npm:1.54.0"],\
["@standardnotes/responses", "npm:1.12.0"],\
["@standardnotes/utils", "npm:1.11.0"],\
["lodash", "npm:4.17.21"],\
["reflect-metadata", "npm:0.1.13"]\
],\
@@ -2955,12 +2955,12 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "HARD"\
}],\
["npm:1.11.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.11.2-61f5ee52c3-2a1ffd142c.zip/node_modules/@standardnotes/responses/",\
["npm:1.12.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.12.0-1de721974f-15b2e92d57.zip/node_modules/@standardnotes/responses/",\
"packageDependencies": [\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/responses", "npm:1.12.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/features", "npm:1.54.0"],\
["@standardnotes/security", "workspace:packages/security"],\
["reflect-metadata", "npm:0.1.13"]\
],\
@@ -2985,7 +2985,7 @@ const RAW_RUNTIME_STATE =
["@types/node", "npm:18.0.3"],\
["@typescript-eslint/eslint-plugin", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:5.40.1"],\
["aws-sdk", "npm:2.1234.0"],\
["dayjs", "npm:1.11.5"],\
["dayjs", "npm:1.11.6"],\
["dotenv", "npm:16.0.1"],\
["eslint", "npm:8.25.0"],\
["eslint-plugin-prettier", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.2.1"],\
@@ -3158,7 +3158,7 @@ const RAW_RUNTIME_STATE =
["@types/jest", "npm:29.1.1"],\
["@types/microtime", "npm:2.1.0"],\
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
["dayjs", "npm:1.11.5"],\
["dayjs", "npm:1.11.6"],\
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:29.1.2"],\
["microtime", "npm:3.1.1"],\
@@ -3180,6 +3180,17 @@ const RAW_RUNTIME_STATE =
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}],\
["npm:1.11.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-utils-npm-1.11.0-afbc24024c-9e7d9c1257.zip/node_modules/@standardnotes/utils/",\
"packageDependencies": [\
["@standardnotes/utils", "npm:1.11.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["dompurify", "npm:2.4.0"],\
["lodash", "npm:4.17.21"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}]\
]],\
["@standardnotes/websockets-server", [\
@@ -3189,7 +3200,7 @@ const RAW_RUNTIME_STATE =
["@standardnotes/websockets-server", "workspace:packages/websockets"],\
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/api", "npm:1.19.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -3229,7 +3240,7 @@ const RAW_RUNTIME_STATE =
["@standardnotes/workspace-server", "workspace:packages/workspace"],\
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/api", "npm:1.19.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -5891,10 +5902,10 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["dayjs", [\
["npm:1.11.5", {\
"packageLocation": "./.yarn/cache/dayjs-npm-1.11.5-a825142dc5-ea78d43de0.zip/node_modules/dayjs/",\
["npm:1.11.6", {\
"packageLocation": "./.yarn/cache/dayjs-npm-1.11.6-44daf311a9-f59ea45f24.zip/node_modules/dayjs/",\
"packageDependencies": [\
["dayjs", "npm:1.11.5"]\
["dayjs", "npm:1.11.6"]\
],\
"linkType": "HARD"\
}]\

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.34.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.34.0...@standardnotes/api-gateway@1.34.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/api-gateway
# [1.34.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.33.6...@standardnotes/api-gateway@1.34.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/api-gateway/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.33.6](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.33.5...@standardnotes/api-gateway@1.33.6) (2022-11-02)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.33.5](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.33.4...@standardnotes/api-gateway@1.33.5) (2022-11-01)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.33.4](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.33.3...@standardnotes/api-gateway@1.33.4) (2022-10-31)
**Note:** Version bump only for package @standardnotes/api-gateway

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.33.4",
"version": "1.34.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -147,4 +147,9 @@ export class UsersController extends BaseHttpController {
async deleteUser(request: Request, response: Response): Promise<void> {
await this.httpService.callPaymentsServer(request, response, 'api/account', request.body)
}
@httpPost('/:userUuid/requests', TYPES.AuthMiddleware)
async submitRequest(request: Request, response: Response): Promise<void> {
await this.httpService.callAuthServer(request, response, `users/${request.params.userUuid}/requests`, request.body)
}
}

View File

@@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.48.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.48.1...@standardnotes/auth-server@1.48.2) (2022-11-03)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.48.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.48.0...@standardnotes/auth-server@1.48.1) (2022-11-02)
### Bug Fixes
* **auth:** controller name ([5b0d9dd](https://github.com/standardnotes/server/commit/5b0d9dd3949d4da9d5ac3ca86a0e54ead2ce730d))
# [1.48.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.47.7...@standardnotes/auth-server@1.48.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/server/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.47.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.47.6...@standardnotes/auth-server@1.47.7) (2022-11-02)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.47.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.47.5...@standardnotes/auth-server@1.47.6) (2022-11-01)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.47.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.47.4...@standardnotes/auth-server@1.47.5) (2022-11-01)
### Bug Fixes
* force utf8mb4 charset on typeorm ([5160cc3](https://github.com/standardnotes/server/commit/5160cc36ddc9e30551d5ad40a9e210d87091eec3))
## [1.47.4](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.47.3...@standardnotes/auth-server@1.47.4) (2022-10-31)
**Note:** Version bump only for package @standardnotes/auth-server

View File

@@ -20,6 +20,7 @@ import '../src/Controller/SubscriptionSettingsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressAuthController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSubscriptionInvitesController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressUserRequestsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressWebSocketsController'
import * as cors from 'cors'

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.47.4",
"version": "1.48.2",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -33,7 +33,7 @@
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/analytics": "workspace:*",
"@standardnotes/api": "^1.17.2",
"@standardnotes/api": "^1.19.0",
"@standardnotes/common": "workspace:*",
"@standardnotes/domain-events": "workspace:*",
"@standardnotes/domain-events-infra": "workspace:*",
@@ -49,7 +49,7 @@
"axios": "^0.27.2",
"bcryptjs": "2.4.3",
"cors": "2.8.5",
"dayjs": "^1.11.3",
"dayjs": "^1.11.6",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"inversify": "^6.0.1",

View File

@@ -203,6 +203,8 @@ import { PaymentSuccessEventHandler } from '../Domain/Handler/PaymentSuccessEven
import { RefundProcessedEventHandler } from '../Domain/Handler/RefundProcessedEventHandler'
import { SubscriptionInvitesController } from '../Controller/SubscriptionInvitesController'
import { CreateCrossServiceToken } from '../Domain/UseCase/CreateCrossServiceToken/CreateCrossServiceToken'
import { ProcessUserRequest } from '../Domain/UseCase/ProcessUserRequest/ProcessUserRequest'
import { UserRequestsController } from '../Controller/UserRequestsController'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -266,6 +268,7 @@ export class ContainerConfigLoader {
// Controller
container.bind<AuthController>(TYPES.AuthController).to(AuthController)
container.bind<SubscriptionInvitesController>(TYPES.SubscriptionInvitesController).to(SubscriptionInvitesController)
container.bind<UserRequestsController>(TYPES.UserRequestsController).to(UserRequestsController)
// Repositories
container.bind<SessionRepositoryInterface>(TYPES.SessionRepository).to(MySQLSessionRepository)
@@ -438,6 +441,7 @@ export class ContainerConfigLoader {
container.bind<GetUserAnalyticsId>(TYPES.GetUserAnalyticsId).to(GetUserAnalyticsId)
container.bind<VerifyPredicate>(TYPES.VerifyPredicate).to(VerifyPredicate)
container.bind<CreateCrossServiceToken>(TYPES.CreateCrossServiceToken).to(CreateCrossServiceToken)
container.bind<ProcessUserRequest>(TYPES.ProcessUserRequest).to(ProcessUserRequest)
// Handlers
container.bind<UserRegisteredEventHandler>(TYPES.UserRegisteredEventHandler).to(UserRegisteredEventHandler)

View File

@@ -22,6 +22,7 @@ const maxQueryExecutionTime = env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
export const AppDataSource = new DataSource({
type: 'mysql',
charset: 'utf8mb4',
supportBigNumbers: true,
bigNumberStrings: false,
maxQueryExecutionTime,

View File

@@ -6,6 +6,7 @@ const TYPES = {
// Controller
AuthController: Symbol.for('AuthController'),
SubscriptionInvitesController: Symbol.for('SubscriptionInvitesController'),
UserRequestsController: Symbol.for('UserRequestsController'),
// Repositories
UserRepository: Symbol.for('UserRepository'),
SessionRepository: Symbol.for('SessionRepository'),
@@ -121,6 +122,7 @@ const TYPES = {
GetUserAnalyticsId: Symbol.for('GetUserAnalyticsId'),
VerifyPredicate: Symbol.for('VerifyPredicate'),
CreateCrossServiceToken: Symbol.for('CreateCrossServiceToken'),
ProcessUserRequest: Symbol.for('ProcessUserRequest'),
// Handlers
UserRegisteredEventHandler: Symbol.for('UserRegisteredEventHandler'),
AccountDeletionRequestedEventHandler: Symbol.for('AccountDeletionRequestedEventHandler'),

View File

@@ -109,4 +109,15 @@ describe('AuthController', () => {
expect(response.status).toEqual(400)
})
it('should throw error on the delete user method as it is still a part of the payments server', async () => {
let caughtError = null
try {
await createController().deleteAccount({ userUuid: '1-2-3' })
} catch (error) {
caughtError = error
}
expect(caughtError).not.toBeNull()
})
})

View File

@@ -2,6 +2,7 @@ import { inject, injectable } from 'inversify'
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
import {
HttpStatusCode,
UserDeletionResponse,
UserRegistrationRequestParams,
UserRegistrationResponse,
UserServerInterface,
@@ -12,6 +13,7 @@ import { ClearLoginAttempts } from '../Domain/UseCase/ClearLoginAttempts'
import { Register } from '../Domain/UseCase/Register'
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
import { ProtocolVersion } from '@standardnotes/common'
import { UserDeletionRequestParams } from '@standardnotes/api/dist/Domain/Request/User/UserDeletionRequestParams'
@injectable()
export class AuthController implements UserServerInterface {
@@ -22,6 +24,10 @@ export class AuthController implements UserServerInterface {
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
) {}
async deleteAccount(_params: UserDeletionRequestParams): Promise<UserDeletionResponse> {
throw new Error('This method is implemented on the payments server.')
}
async register(params: UserRegistrationRequestParams): Promise<UserRegistrationResponse> {
if (!params.email || !params.password) {
return {

View File

@@ -0,0 +1,43 @@
import 'reflect-metadata'
import { UserRequestType } from '@standardnotes/common'
import { ProcessUserRequest } from '../Domain/UseCase/ProcessUserRequest/ProcessUserRequest'
import { UserRequestsController } from './UserRequestsController'
describe('UserRequestsController', () => {
let processUserRequest: ProcessUserRequest
const createController = () => new UserRequestsController(processUserRequest)
beforeEach(() => {
processUserRequest = {} as jest.Mocked<ProcessUserRequest>
processUserRequest.execute = jest.fn().mockReturnValue({ success: true })
})
it('should process user request', async () => {
expect(
await createController().submitUserRequest({
userUuid: '1-2-3',
requestType: UserRequestType.ExitDiscount,
}),
).toEqual({
status: 200,
data: { success: true },
})
})
it('should not process user request', async () => {
processUserRequest.execute = jest.fn().mockReturnValue({ success: false })
expect(
await createController().submitUserRequest({
userUuid: '1-2-3',
requestType: UserRequestType.ExitDiscount,
}),
).toEqual({
status: 400,
data: { success: false },
})
})
})

View File

@@ -0,0 +1,34 @@
import {
HttpStatusCode,
UserRequestRequestParams,
UserRequestResponse,
UserRequestServerInterface,
} from '@standardnotes/api'
import { inject, injectable } from 'inversify'
import TYPES from '../Bootstrap/Types'
import { ProcessUserRequest } from '../Domain/UseCase/ProcessUserRequest/ProcessUserRequest'
@injectable()
export class UserRequestsController implements UserRequestServerInterface {
constructor(@inject(TYPES.ProcessUserRequest) private processUserRequest: ProcessUserRequest) {}
async submitUserRequest(params: UserRequestRequestParams): Promise<UserRequestResponse> {
const result = await this.processUserRequest.execute({
requestType: params.requestType,
userEmail: params.userEmail as string,
userUuid: params.userUuid,
})
if (!result.success) {
return {
status: HttpStatusCode.BadRequest,
data: result,
}
}
return {
status: HttpStatusCode.Success,
data: result,
}
}
}

View File

@@ -18,6 +18,29 @@ describe('DomainEventFactory', () => {
timer.getUTCDate = jest.fn().mockReturnValue(new Date(1))
})
it('should create a EXIT_DISCOUNT_APPLY_REQUESTED event', () => {
expect(
createFactory().createExitDiscountApplyRequestedEvent({
userEmail: 'test@test.te',
discountCode: 'exit-20',
}),
).toEqual({
createdAt: expect.any(Date),
meta: {
correlation: {
userIdentifier: 'test@test.te',
userIdentifierType: 'email',
},
origin: 'auth',
},
payload: {
userEmail: 'test@test.te',
discountCode: 'exit-20',
},
type: 'EXIT_DISCOUNT_APPLY_REQUESTED',
})
})
it('should create a WEB_SOCKET_MESSAGE_REQUESTED event', () => {
expect(
createFactory().createWebSocketMessageRequestedEvent({

View File

@@ -16,6 +16,7 @@ import {
DomainEventService,
EmailMessageRequestedEvent,
WebSocketMessageRequestedEvent,
ExitDiscountApplyRequestedEvent,
} from '@standardnotes/domain-events'
import { Predicate, PredicateVerificationResult } from '@standardnotes/predicates'
import { TimerInterface } from '@standardnotes/time'
@@ -28,6 +29,24 @@ import { DomainEventFactoryInterface } from './DomainEventFactoryInterface'
export class DomainEventFactory implements DomainEventFactoryInterface {
constructor(@inject(TYPES.Timer) private timer: TimerInterface) {}
createExitDiscountApplyRequestedEvent(dto: {
userEmail: string
discountCode: string
}): ExitDiscountApplyRequestedEvent {
return {
type: 'EXIT_DISCOUNT_APPLY_REQUESTED',
createdAt: this.timer.getUTCDate(),
meta: {
correlation: {
userIdentifier: dto.userEmail,
userIdentifierType: 'email',
},
origin: DomainEventService.Auth,
},
payload: dto,
}
}
createWebSocketMessageRequestedEvent(dto: { userUuid: Uuid; message: JSONString }): WebSocketMessageRequestedEvent {
return {
type: 'WEB_SOCKET_MESSAGE_REQUESTED',

View File

@@ -16,6 +16,7 @@ import {
PredicateVerifiedEvent,
EmailMessageRequestedEvent,
WebSocketMessageRequestedEvent,
ExitDiscountApplyRequestedEvent,
} from '@standardnotes/domain-events'
import { InviteeIdentifierType } from '../SharedSubscription/InviteeIdentifierType'
@@ -83,4 +84,8 @@ export interface DomainEventFactoryInterface {
predicate: Predicate
predicateVerificationResult: PredicateVerificationResult
}): PredicateVerifiedEvent
createExitDiscountApplyRequestedEvent(dto: {
userEmail: string
discountCode: string
}): ExitDiscountApplyRequestedEvent
}

View File

@@ -0,0 +1,94 @@
import 'reflect-metadata'
import { DomainEventPublisherInterface, ExitDiscountApplyRequestedEvent } from '@standardnotes/domain-events'
import { UserRequestType } from '@standardnotes/common'
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
import { UserSubscription } from '../../Subscription/UserSubscription'
import { UserSubscriptionRepositoryInterface } from '../../Subscription/UserSubscriptionRepositoryInterface'
import { ProcessUserRequest } from './ProcessUserRequest'
describe('ProcessUserRequest', () => {
let userSubscriptionRepository: UserSubscriptionRepositoryInterface
let domainEventFactory: DomainEventFactoryInterface
let domainEventPublisher: DomainEventPublisherInterface
const createUseCase = () =>
new ProcessUserRequest(userSubscriptionRepository, domainEventFactory, domainEventPublisher)
beforeEach(() => {
userSubscriptionRepository = {} as jest.Mocked<UserSubscriptionRepositoryInterface>
userSubscriptionRepository.findOneByUserUuid = jest.fn().mockReturnValue({
cancelled: true,
} as jest.Mocked<UserSubscription>)
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
domainEventFactory.createExitDiscountApplyRequestedEvent = jest
.fn()
.mockReturnValue({} as jest.Mocked<ExitDiscountApplyRequestedEvent>)
domainEventPublisher = {} as jest.Mocked<DomainEventPublisherInterface>
domainEventPublisher.publish = jest.fn()
})
it('should not process unsupported requests', async () => {
expect(
await createUseCase().execute({
userEmail: 'test@test.te',
userUuid: '1-2-3',
requestType: 'foobar' as UserRequestType,
}),
).toEqual({
success: false,
})
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should not process uncancelled subscriptions', async () => {
userSubscriptionRepository.findOneByUserUuid = jest.fn().mockReturnValue({} as jest.Mocked<UserSubscription>)
expect(
await createUseCase().execute({
userEmail: 'test@test.te',
userUuid: '1-2-3',
requestType: UserRequestType.ExitDiscount,
}),
).toEqual({
success: false,
})
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should not process non existing subscriptions', async () => {
userSubscriptionRepository.findOneByUserUuid = jest.fn().mockReturnValue(null)
expect(
await createUseCase().execute({
userEmail: 'test@test.te',
userUuid: '1-2-3',
requestType: UserRequestType.ExitDiscount,
}),
).toEqual({
success: false,
})
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should publish an exit discount apply requested event', async () => {
expect(
await createUseCase().execute({
userEmail: 'test@test.te',
userUuid: '1-2-3',
requestType: UserRequestType.ExitDiscount,
}),
).toEqual({
success: true,
})
expect(domainEventPublisher.publish).toHaveBeenCalled()
})
})

View File

@@ -0,0 +1,46 @@
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
import { inject, injectable } from 'inversify'
import { UserRequestType } from '@standardnotes/common'
import TYPES from '../../../Bootstrap/Types'
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
import { UserSubscriptionRepositoryInterface } from '../../Subscription/UserSubscriptionRepositoryInterface'
import { UseCaseInterface } from '../UseCaseInterface'
import { ProcessUserRequestDTO } from './ProcessUserRequestDTO'
import { ProcessUserRequestResponse } from './ProcessUserRequestResponse'
@injectable()
export class ProcessUserRequest implements UseCaseInterface {
constructor(
@inject(TYPES.UserSubscriptionRepository) private userSubscriptionRepository: UserSubscriptionRepositoryInterface,
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
@inject(TYPES.DomainEventPublisher) private domainEventPublisher: DomainEventPublisherInterface,
) {}
async execute(dto: ProcessUserRequestDTO): Promise<ProcessUserRequestResponse> {
if (dto.requestType !== UserRequestType.ExitDiscount) {
return {
success: false,
}
}
const subscription = await this.userSubscriptionRepository.findOneByUserUuid(dto.userUuid)
if (subscription === null || !subscription.cancelled) {
return {
success: false,
}
}
await this.domainEventPublisher.publish(
this.domainEventFactory.createExitDiscountApplyRequestedEvent({
userEmail: dto.userEmail,
discountCode: 'exit-20',
}),
)
return {
success: true,
}
}
}

View File

@@ -0,0 +1,7 @@
import { UserRequestType, Uuid } from '@standardnotes/common'
export type ProcessUserRequestDTO = {
userUuid: Uuid
userEmail: string
requestType: UserRequestType
}

View File

@@ -0,0 +1,3 @@
export type ProcessUserRequestResponse = {
success: boolean
}

View File

@@ -0,0 +1,24 @@
import { Request, Response } from 'express'
import { inject } from 'inversify'
import { controller, BaseHttpController, results, httpPost } from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { UserRequestsController } from '../../Controller/UserRequestsController'
@controller('/users/:userUuid/requests')
export class InversifyExpressUserRequestsController extends BaseHttpController {
constructor(@inject(TYPES.UserRequestsController) private userRequestsController: UserRequestsController) {
super()
}
@httpPost('/', TYPES.ApiGatewayAuthMiddleware)
async submitRequest(request: Request, response: Response): Promise<results.JsonResult> {
const result = await this.userRequestsController.submitUserRequest({
requestType: request.body.requestType,
userUuid: response.locals.user.uuid,
userEmail: response.locals.user.email,
})
return this.json(result.data, result.status)
}
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.44.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.43.0...@standardnotes/common@1.44.0) (2022-11-03)
### Features
* **common:** add subscription cancelled email message identifier ([0c5305a](https://github.com/standardnotes/server/commit/0c5305acf62aae047caedca25de25049c37f7653))
# [1.43.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.42.0...@standardnotes/common@1.43.0) (2022-11-01)
### Features
* **common:** add user request type ([d4af1d7](https://github.com/standardnotes/server/commit/d4af1d743ef914228a15f15b36a15dc9b612c704))
# [1.42.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.41.0...@standardnotes/common@1.42.0) (2022-10-31)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/common",
"version": "1.42.0",
"version": "1.44.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -26,4 +26,5 @@ export enum EmailMessageIdentifier {
RATE_ADJUSTMENT_NOTICE = 'RATE_ADJUSTMENT_NOTICE',
WORKSPACE_INVITE_CREATED = 'WORKSPACE_INVITE_CREATED',
EXIT_DISCOUNT = 'EXIT_DISCOUNT',
SUBSCRIPTION_CANCELLED = 'SUBSCRIPTION_CANCELLED',
}

View File

@@ -0,0 +1,3 @@
export enum UserRequestType {
ExitDiscount = 'exit-discount',
}

View File

@@ -23,6 +23,7 @@ export * from './Subscription/SubscriptionBillingFrequency'
export * from './Subscription/SubscriptionName'
export * from './Type/Either'
export * from './Type/Only'
export * from './User/UserRequestType'
export * from './Validator/UuidValidator'
export * from './Validator/ValidatorInterface'
export * from './Workspace/WorkspaceAccessLevel'

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.9.6](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.5...@standardnotes/domain-events-infra@1.9.6) (2022-11-03)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.9.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.4...@standardnotes/domain-events-infra@1.9.5) (2022-11-02)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.9.4](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.3...@standardnotes/domain-events-infra@1.9.4) (2022-11-01)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.9.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.2...@standardnotes/domain-events-infra@1.9.3) (2022-10-31)
**Note:** Version bump only for package @standardnotes/domain-events-infra

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.9.3",
"version": "1.9.6",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.73.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.73.0...@standardnotes/domain-events@2.73.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/domain-events
# [2.73.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.72.1...@standardnotes/domain-events@2.73.0) (2022-11-02)
### Features
* **domain-events:** add exit discount events ([59eb70c](https://github.com/standardnotes/server/commit/59eb70ce62eddd1ac8031667bc38e495e9c17bba))
## [2.72.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.72.0...@standardnotes/domain-events@2.72.1) (2022-11-01)
**Note:** Version bump only for package @standardnotes/domain-events
# [2.72.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.71.0...@standardnotes/domain-events@2.72.0) (2022-10-31)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.72.0",
"version": "2.73.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -0,0 +1,7 @@
import { DomainEventInterface } from './DomainEventInterface'
import { ExitDiscountApplyRequestedEventPayload } from './ExitDiscountApplyRequestedEventPayload'
export interface ExitDiscountApplyRequestedEvent extends DomainEventInterface {
type: 'EXIT_DISCOUNT_APPLY_REQUESTED'
payload: ExitDiscountApplyRequestedEventPayload
}

View File

@@ -0,0 +1,4 @@
export interface ExitDiscountApplyRequestedEventPayload {
userEmail: string
discountCode: string
}

View File

@@ -0,0 +1,7 @@
import { DomainEventInterface } from './DomainEventInterface'
import { ExitDiscountWithdrawRequestedEventPayload } from './ExitDiscountWithdrawRequestedEventPayload'
export interface ExitDiscountWithdrawRequestedEvent extends DomainEventInterface {
type: 'EXIT_DISCOUNT_WITHDRAW_REQUESTED'
payload: ExitDiscountWithdrawRequestedEventPayload
}

View File

@@ -0,0 +1,4 @@
export interface ExitDiscountWithdrawRequestedEventPayload {
userEmail: string
discountCode: string
}

View File

@@ -1,8 +0,0 @@
import { DomainEventInterface } from './DomainEventInterface'
import { SubscriptionReactivationDiscountRequestedEventPayload } from './SubscriptionReactivationDiscountRequestedEventPayload'
export interface SubscriptionReactivationDiscountRequestedEvent extends DomainEventInterface {
type: 'SUBSCRIPTION_REACTIVATION_DISCOUNT_REQUESTED'
payload: SubscriptionReactivationDiscountRequestedEventPayload
}

View File

@@ -1,4 +0,0 @@
export interface SubscriptionReactivationDiscountRequestedEventPayload {
userUuid: string
discountCode: string
}

View File

@@ -32,6 +32,10 @@ export * from './Event/EmailMessageRequestedEvent'
export * from './Event/EmailMessageRequestedEventPayload'
export * from './Event/ExitDiscountAppliedEvent'
export * from './Event/ExitDiscountAppliedEventPayload'
export * from './Event/ExitDiscountApplyRequestedEvent'
export * from './Event/ExitDiscountApplyRequestedEventPayload'
export * from './Event/ExitDiscountWithdrawRequestedEvent'
export * from './Event/ExitDiscountWithdrawRequestedEventPayload'
export * from './Event/ExtensionKeyGrantedEvent'
export * from './Event/ExtensionKeyGrantedEventPayload'
export * from './Event/FileRemovedEvent'
@@ -82,8 +86,6 @@ export * from './Event/SubscriptionRateAdjustedEvent'
export * from './Event/SubscriptionRateAdjustedEventPayload'
export * from './Event/SubscriptionReactivatedEvent'
export * from './Event/SubscriptionReactivatedEventPayload'
export * from './Event/SubscriptionReactivationDiscountRequestedEvent'
export * from './Event/SubscriptionReactivationDiscountRequestedEventPayload'
export * from './Event/SubscriptionReassignedEvent'
export * from './Event/SubscriptionReassignedEventPayload'
export * from './Event/SubscriptionRefundedEvent'

View File

@@ -3,6 +3,34 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.6.1](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.0...@standardnotes/event-store@1.6.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/event-store
# [1.6.0](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.8...@standardnotes/event-store@1.6.0) (2022-11-03)
### Features
* **event-store:** add discount events to event store ([eb53c38](https://github.com/standardnotes/server/commit/eb53c3896f8c64747e30901722c0bdc63125128f))
## [1.5.8](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.7...@standardnotes/event-store@1.5.8) (2022-11-02)
**Note:** Version bump only for package @standardnotes/event-store
## [1.5.7](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.6...@standardnotes/event-store@1.5.7) (2022-11-02)
**Note:** Version bump only for package @standardnotes/event-store
## [1.5.6](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.5...@standardnotes/event-store@1.5.6) (2022-11-01)
**Note:** Version bump only for package @standardnotes/event-store
## [1.5.5](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.4...@standardnotes/event-store@1.5.5) (2022-11-01)
### Bug Fixes
* force utf8mb4 charset on typeorm ([5160cc3](https://github.com/standardnotes/server/commit/5160cc36ddc9e30551d5ad40a9e210d87091eec3))
## [1.5.4](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.5.3...@standardnotes/event-store@1.5.4) (2022-10-31)
**Note:** Version bump only for package @standardnotes/event-store

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.5.4",
"version": "1.6.1",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",

View File

@@ -82,12 +82,17 @@ export class ContainerConfigLoader {
['SUBSCRIPTION_REVERT_REQUESTED', container.get(TYPES.EventHandler)],
['REFUND_PROCESSED', container.get(TYPES.EventHandler)],
['ACCOUNT_RESET_REQUESTED', container.get(TYPES.EventHandler)],
['DISCOUNT_APPLY_REQUESTED', container.get(TYPES.EventHandler)],
['DISCOUNT_APPLIED', container.get(TYPES.EventHandler)],
['DISCOUNT_WITHDRAW_REQUESTED', container.get(TYPES.EventHandler)],
['SUBSCRIPTION_RATE_ADJUSTED', container.get(TYPES.EventHandler)],
['REFUND_REQUESTED', container.get(TYPES.EventHandler)],
['INVOICE_GENERATED', container.get(TYPES.EventHandler)],
['WORKSPACE_INVITE_CREATED', container.get(TYPES.EventHandler)],
['SUBSCRIPTION_REACTIVATED', container.get(TYPES.EventHandler)],
['EXIT_DISCOUNT_APPLY_REQUESTED', container.get(TYPES.EventHandler)],
['EXIT_DISCOUNT_APPLIED', container.get(TYPES.EventHandler)],
['EXIT_DISCOUNT_WITHDRAW_REQUESTED', container.get(TYPES.EventHandler)],
])
container

View File

@@ -11,6 +11,7 @@ const maxQueryExecutionTime = env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
export const AppDataSource = new DataSource({
type: 'mysql',
charset: 'utf8mb4',
supportBigNumbers: true,
bigNumberStrings: false,
maxQueryExecutionTime,

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.8.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.0...@standardnotes/files-server@1.8.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/files-server
# [1.8.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.7.5...@standardnotes/files-server@1.8.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/files/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.7.5](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.7.4...@standardnotes/files-server@1.7.5) (2022-11-02)
**Note:** Version bump only for package @standardnotes/files-server
## [1.7.4](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.7.3...@standardnotes/files-server@1.7.4) (2022-11-01)
**Note:** Version bump only for package @standardnotes/files-server
## [1.7.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.7.2...@standardnotes/files-server@1.7.3) (2022-10-31)
**Note:** Version bump only for package @standardnotes/files-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.7.3",
"version": "1.8.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -36,7 +36,7 @@
"aws-sdk": "^2.1158.0",
"connect-busboy": "^1.0.0",
"cors": "^2.8.5",
"dayjs": "^1.11.3",
"dayjs": "^1.11.6",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-winston": "^4.0.5",

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.5.3](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.5.2...@standardnotes/predicates@1.5.3) (2022-11-03)
**Note:** Version bump only for package @standardnotes/predicates
## [1.5.2](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.5.1...@standardnotes/predicates@1.5.2) (2022-11-01)
**Note:** Version bump only for package @standardnotes/predicates
## [1.5.1](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.5.0...@standardnotes/predicates@1.5.1) (2022-10-31)
**Note:** Version bump only for package @standardnotes/predicates

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/predicates",
"version": "1.5.1",
"version": "1.5.3",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.13.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.0...@standardnotes/scheduler-server@1.13.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/scheduler-server
# [1.13.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.12.0...@standardnotes/scheduler-server@1.13.0) (2022-11-03)
### Features
* **scheduler:** add publishing exit discount withdraw requested event ([d66f784](https://github.com/standardnotes/server/commit/d66f78453820c8a97d090f858d9a4fc2557773fa))
# [1.12.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.11.7...@standardnotes/scheduler-server@1.12.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/server/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.11.7](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.11.6...@standardnotes/scheduler-server@1.11.7) (2022-11-02)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.11.6](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.11.5...@standardnotes/scheduler-server@1.11.6) (2022-11-01)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.11.5](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.11.4...@standardnotes/scheduler-server@1.11.5) (2022-11-01)
### Bug Fixes
* force utf8mb4 charset on typeorm ([5160cc3](https://github.com/standardnotes/server/commit/5160cc36ddc9e30551d5ad40a9e210d87091eec3))
## [1.11.4](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.11.3...@standardnotes/scheduler-server@1.11.4) (2022-10-31)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.11.4",
"version": "1.13.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -32,7 +32,7 @@
"@standardnotes/predicates": "workspace:*",
"@standardnotes/time": "workspace:*",
"aws-sdk": "^2.1158.0",
"dayjs": "^1.11.3",
"dayjs": "^1.11.6",
"dotenv": "^16.0.1",
"inversify": "^6.0.1",
"ioredis": "^5.2.0",

View File

@@ -36,6 +36,7 @@ import { PredicateVerifiedEventHandler } from '../Domain/Handler/PredicateVerifi
import { VerifyPredicates } from '../Domain/UseCase/VerifyPredicates/VerifyPredicates'
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -124,6 +125,9 @@ export class ContainerConfigLoader {
container
.bind<SubscriptionCancelledEventHandler>(TYPES.SubscriptionCancelledEventHandler)
.to(SubscriptionCancelledEventHandler)
container
.bind<ExitDiscountAppliedEventHandler>(TYPES.ExitDiscountAppliedEventHandler)
.to(ExitDiscountAppliedEventHandler)
// Services
container.bind<DomainEventFactory>(TYPES.DomainEventFactory).to(DomainEventFactory)
@@ -146,6 +150,7 @@ export class ContainerConfigLoader {
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
['USER_REGISTERED', container.get(TYPES.UserRegisteredEventHandler)],
['SUBSCRIPTION_CANCELLED', container.get(TYPES.SubscriptionCancelledEventHandler)],
['EXIT_DISCOUNT_APPLIED', container.get(TYPES.ExitDiscountAppliedEventHandler)],
])
if (env.get('SQS_QUEUE_URL', true)) {

View File

@@ -12,6 +12,7 @@ const maxQueryExecutionTime = env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
export const AppDataSource = new DataSource({
type: 'mysql',
charset: 'utf8mb4',
supportBigNumbers: true,
bigNumberStrings: false,
maxQueryExecutionTime,

View File

@@ -24,6 +24,7 @@ const TYPES = {
PredicateVerifiedEventHandler: Symbol.for('PredicateVerifiedEventHandler'),
UserRegisteredEventHandler: Symbol.for('UserRegisteredEventHandler'),
SubscriptionCancelledEventHandler: Symbol.for('SubscriptionCancelledEventHandler'),
ExitDiscountAppliedEventHandler: Symbol.for('ExitDiscountAppliedEventHandler'),
// Services
DomainEventPublisher: Symbol.for('DomainEventPublisher'),
DomainEventSubscriberFactory: Symbol.for('DomainEventSubscriberFactory'),

View File

@@ -65,6 +65,29 @@ describe('DomainEventFactory', () => {
})
})
it('should create a EXIT_DISCOUNT_WITHDRAW_REQUESTED event', () => {
expect(
createFactory().createExitDiscountWithdrawRequestedEvent({
userEmail: 'test@test.te',
discountCode: 'exit-20',
}),
).toEqual({
createdAt: expect.any(Date),
meta: {
correlation: {
userIdentifier: 'test@test.te',
userIdentifierType: 'email',
},
origin: 'scheduler',
},
payload: {
userEmail: 'test@test.te',
discountCode: 'exit-20',
},
type: 'EXIT_DISCOUNT_WITHDRAW_REQUESTED',
})
})
it('should create a EMAIL_MESSAGE_REQUESTED event', () => {
expect(
createFactory().createEmailMessageRequestedEvent({

View File

@@ -4,6 +4,7 @@ import {
DiscountWithdrawRequestedEvent,
DomainEventService,
EmailMessageRequestedEvent,
ExitDiscountWithdrawRequestedEvent,
PredicateVerificationRequestedEvent,
} from '@standardnotes/domain-events'
import { PredicateAuthority } from '@standardnotes/predicates'
@@ -51,6 +52,24 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
}
}
createExitDiscountWithdrawRequestedEvent(dto: {
userEmail: string
discountCode: string
}): ExitDiscountWithdrawRequestedEvent {
return {
type: 'EXIT_DISCOUNT_WITHDRAW_REQUESTED',
createdAt: this.timer.getUTCDate(),
meta: {
correlation: {
userIdentifier: dto.userEmail,
userIdentifierType: 'email',
},
origin: DomainEventService.Scheduler,
},
payload: dto,
}
}
createEmailMessageRequestedEvent(dto: {
userEmail: string
messageIdentifier: EmailMessageIdentifier

View File

@@ -3,6 +3,7 @@ import {
DiscountApplyRequestedEvent,
DiscountWithdrawRequestedEvent,
EmailMessageRequestedEvent,
ExitDiscountWithdrawRequestedEvent,
PredicateVerificationRequestedEvent,
} from '@standardnotes/domain-events'
@@ -18,4 +19,8 @@ export interface DomainEventFactoryInterface {
}): EmailMessageRequestedEvent
createDiscountApplyRequestedEvent(dto: { userEmail: string; discountCode: string }): DiscountApplyRequestedEvent
createDiscountWithdrawRequestedEvent(dto: { userEmail: string; discountCode: string }): DiscountWithdrawRequestedEvent
createExitDiscountWithdrawRequestedEvent(dto: {
userEmail: string
discountCode: string
}): ExitDiscountWithdrawRequestedEvent
}

View File

@@ -0,0 +1,40 @@
import 'reflect-metadata'
import { ExitDiscountAppliedEvent } from '@standardnotes/domain-events'
import { TimerInterface } from '@standardnotes/time'
import { JobRepositoryInterface } from '../Job/JobRepositoryInterface'
import { ExitDiscountAppliedEventHandler } from './ExitDiscountAppliedEventHandler'
describe('ExitDiscountAppliedEventHandler', () => {
let timer: TimerInterface
let jobRepository: JobRepositoryInterface
const createHandler = () => new ExitDiscountAppliedEventHandler(timer, jobRepository)
beforeEach(() => {
timer = {} as jest.Mocked<TimerInterface>
timer.getUTCDateNHoursAhead = jest.fn().mockReturnValue(new Date(2))
timer.convertDateToMicroseconds = jest.fn().mockReturnValue(123)
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(1)
jobRepository = {} as jest.Mocked<JobRepositoryInterface>
jobRepository.save = jest.fn()
})
it('should schedule a job to do an exit discount withdrawal', async () => {
await createHandler().handle({
payload: { userEmail: 'test@test.te', discountRate: 20 },
} as jest.Mocked<ExitDiscountAppliedEvent>)
expect(jobRepository.save).toHaveBeenNthCalledWith(1, {
createdAt: 1,
name: 'withdraw-subscription-exit-discount',
scheduledAt: 123,
status: 'pending',
userIdentifier: 'test@test.te',
userIdentifierType: 'email',
})
})
})

View File

@@ -0,0 +1,33 @@
import { DomainEventHandlerInterface, ExitDiscountAppliedEvent } from '@standardnotes/domain-events'
import { inject, injectable } from 'inversify'
import { TimerInterface } from '@standardnotes/time'
import TYPES from '../../Bootstrap/Types'
import { Job } from '../Job/Job'
import { JobName } from '../Job/JobName'
import { JobRepositoryInterface } from '../Job/JobRepositoryInterface'
import { JobStatus } from '../Job/JobStatus'
@injectable()
export class ExitDiscountAppliedEventHandler implements DomainEventHandlerInterface {
constructor(
@inject(TYPES.Timer) private timer: TimerInterface,
@inject(TYPES.JobRepository) private jobRepository: JobRepositoryInterface,
) {}
async handle(event: ExitDiscountAppliedEvent): Promise<void> {
await this.scheduleExitDiscountWithdraw(event)
}
private async scheduleExitDiscountWithdraw(event: ExitDiscountAppliedEvent): Promise<void> {
const job = new Job()
job.name = JobName.WITHDRAW_SUBSCRIPTION_EXIT_DISCOUNT
job.scheduledAt = this.timer.convertDateToMicroseconds(this.timer.getUTCDateNHoursAhead(24))
job.createdAt = this.timer.getTimestampInMicroseconds()
job.status = JobStatus.Pending
job.userIdentifier = event.payload.userEmail
job.userIdentifierType = 'email'
await this.jobRepository.save(job)
}
}

View File

@@ -253,6 +253,35 @@ describe('JobDoneInterpreter', () => {
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should request exit discount withdraw', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.WITHDRAW_SUBSCRIPTION_EXIT_DISCOUNT,
userIdentifier: 'test@standardnotes.com',
userIdentifierType: 'email',
} as jest.Mocked<Job>)
await createInterpreter().interpret('1-2-3')
expect(domainEventFactory.createExitDiscountWithdrawRequestedEvent).toHaveBeenCalledWith({
userEmail: 'test@standardnotes.com',
discountCode: 'exit-20',
})
expect(domainEventPublisher.publish).toHaveBeenCalled()
})
it('should not request exit discount withdraw if email is missing', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.WITHDRAW_SUBSCRIPTION_EXIT_DISCOUNT,
userIdentifier: '2-3-4',
userIdentifierType: 'uuid',
} as jest.Mocked<Job>)
await createInterpreter().interpret('1-2-3')
expect(domainEventFactory.createExitDiscountWithdrawRequestedEvent).not.toHaveBeenCalled()
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should do nothing if there is no interpretation for a given job', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: 'foobar' as JobName,

View File

@@ -65,6 +65,11 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
await this.requestDiscountWithdraw(job)
}
return
case JobName.WITHDRAW_SUBSCRIPTION_EXIT_DISCOUNT:
if (job.userIdentifierType === 'email') {
await this.requestExitDiscountWithdraw(job)
}
return
default:
this.logger.warn(`[${jobUuid}]${job.name}: job is not interpretable.`)
@@ -132,6 +137,17 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
)
}
private async requestExitDiscountWithdraw(job: Job): Promise<void> {
this.logger.debug(`[${job.uuid}]${job.name}: requesting exit discount withdraw.`)
await this.domainEventPublisher.publish(
this.domainEventFactory.createExitDiscountWithdrawRequestedEvent({
userEmail: job.userIdentifier,
discountCode: 'exit-20',
}),
)
}
private async predicatesAreFulfilled(job: Job): Promise<boolean> {
const predicates = await this.predicateRepository.findByJobUuid(job.uuid)

View File

@@ -5,4 +5,5 @@ export enum JobName {
EXIT_INTERVIEW = 'exit-interview',
APPLY_SUBSCRIPTION_DISCOUNT = 'apply-subscription-discount',
WITHDRAW_SUBSCRIPTION_DISCOUNT = 'withdraw-subscription-discount',
WITHDRAW_SUBSCRIPTION_EXIT_DISCOUNT = 'withdraw-subscription-exit-discount',
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.5.3](https://github.com/standardnotes/server/compare/@standardnotes/security@1.5.2...@standardnotes/security@1.5.3) (2022-11-03)
**Note:** Version bump only for package @standardnotes/security
## [1.5.2](https://github.com/standardnotes/server/compare/@standardnotes/security@1.5.1...@standardnotes/security@1.5.2) (2022-11-01)
**Note:** Version bump only for package @standardnotes/security
## [1.5.1](https://github.com/standardnotes/server/compare/@standardnotes/security@1.5.0...@standardnotes/security@1.5.1) (2022-10-31)
**Note:** Version bump only for package @standardnotes/security

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/security",
"version": "1.5.1",
"version": "1.5.3",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.10.8](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.7...@standardnotes/syncing-server@1.10.8) (2022-11-03)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.10.7](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.6...@standardnotes/syncing-server@1.10.7) (2022-11-02)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.10.6](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.5...@standardnotes/syncing-server@1.10.6) (2022-11-02)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.10.5](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.4...@standardnotes/syncing-server@1.10.5) (2022-11-01)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.10.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.3...@standardnotes/syncing-server@1.10.4) (2022-11-01)
### Bug Fixes
* force utf8mb4 charset on typeorm ([5160cc3](https://github.com/standardnotes/syncing-server-js/commit/5160cc36ddc9e30551d5ad40a9e210d87091eec3))
## [1.10.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.10.2...@standardnotes/syncing-server@1.10.3) (2022-10-31)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.10.3",
"version": "1.10.8",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -12,6 +12,7 @@ const maxQueryExecutionTime = env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
export const AppDataSource = new DataSource({
type: 'mysql',
charset: 'utf8mb4',
supportBigNumbers: true,
bigNumberStrings: false,
maxQueryExecutionTime,

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.13.0](https://github.com/standardnotes/server/compare/@standardnotes/time@1.12.0...@standardnotes/time@1.13.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/server/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
# [1.12.0](https://github.com/standardnotes/server/compare/@standardnotes/time@1.11.1...@standardnotes/time@1.12.0) (2022-10-19)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/time",
"version": "1.12.0",
"version": "1.13.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -23,7 +23,7 @@
"test": "jest spec --coverage"
},
"dependencies": {
"dayjs": "^1.10.8",
"dayjs": "^1.11.6",
"microtime": "^3.1.0",
"reflect-metadata": "^0.1.13"
},

View File

@@ -35,9 +35,9 @@ describe('Timer', () => {
})
it('should calculate days difference between now and a given date', () => {
const dateNDaysAgo = createTimer().getUTCDateNDaysAgo(4)
const dateNDaysAgo = createTimer().getUTCDateNDaysAgo(3)
expect(createTimer().dateWasNDaysAgo(dateNDaysAgo)).toEqual(4)
expect(createTimer().dateWasNDaysAgo(dateNDaysAgo)).toEqual(3)
})
it('should return a utc date n hours ago', () => {

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.1](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.0...@standardnotes/websockets-server@1.4.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/websockets-server
# [1.4.0](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.3.5...@standardnotes/websockets-server@1.4.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/server/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.3.5](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.3.4...@standardnotes/websockets-server@1.3.5) (2022-11-02)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.3.4](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.3.3...@standardnotes/websockets-server@1.3.4) (2022-11-01)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.3.3](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.3.2...@standardnotes/websockets-server@1.3.3) (2022-10-31)
**Note:** Version bump only for package @standardnotes/websockets-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.3.3",
"version": "1.4.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -24,7 +24,7 @@
"dependencies": {
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/api": "^1.17.2",
"@standardnotes/api": "^1.19.0",
"@standardnotes/common": "workspace:^",
"@standardnotes/domain-events": "workspace:^",
"@standardnotes/domain-events-infra": "workspace:^",

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.17.1](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.0...@standardnotes/workspace-server@1.17.1) (2022-11-03)
**Note:** Version bump only for package @standardnotes/workspace-server
# [1.17.0](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.16.6...@standardnotes/workspace-server@1.17.0) (2022-11-02)
### Features
* **auth:** add processing user requests ([2255f85](https://github.com/standardnotes/server/commit/2255f856f928e855ac94f8aca4e1fb81047f58f7))
## [1.16.6](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.16.5...@standardnotes/workspace-server@1.16.6) (2022-11-02)
**Note:** Version bump only for package @standardnotes/workspace-server
## [1.16.5](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.16.4...@standardnotes/workspace-server@1.16.5) (2022-11-01)
**Note:** Version bump only for package @standardnotes/workspace-server
## [1.16.4](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.16.3...@standardnotes/workspace-server@1.16.4) (2022-11-01)
### Bug Fixes
* force utf8mb4 charset on typeorm ([5160cc3](https://github.com/standardnotes/server/commit/5160cc36ddc9e30551d5ad40a9e210d87091eec3))
## [1.16.3](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.16.2...@standardnotes/workspace-server@1.16.3) (2022-10-31)
**Note:** Version bump only for package @standardnotes/workspace-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/workspace-server",
"version": "1.16.3",
"version": "1.17.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -24,7 +24,7 @@
"dependencies": {
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/api": "^1.17.2",
"@standardnotes/api": "^1.19.0",
"@standardnotes/common": "workspace:*",
"@standardnotes/domain-events": "workspace:^",
"@standardnotes/domain-events-infra": "workspace:^",

View File

@@ -13,6 +13,7 @@ const maxQueryExecutionTime = env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
export const AppDataSource = new DataSource({
type: 'mysql',
charset: 'utf8mb4',
supportBigNumbers: true,
bigNumberStrings: false,
maxQueryExecutionTime,

108
yarn.lock
View File

@@ -1861,18 +1861,18 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/api@npm:^1.17.2":
version: 1.17.2
resolution: "@standardnotes/api@npm:1.17.2"
"@standardnotes/api@npm:^1.19.0":
version: 1.19.0
resolution: "@standardnotes/api@npm:1.19.0"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/encryption": "npm:1.18.5"
"@standardnotes/models": "npm:1.30.0"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/common": "npm:^1.43.0"
"@standardnotes/encryption": "npm:1.19.0"
"@standardnotes/models": "npm:1.33.0"
"@standardnotes/responses": "npm:1.12.0"
"@standardnotes/security": "npm:^1.1.0"
"@standardnotes/utils": "npm:1.10.0"
"@standardnotes/utils": "npm:1.11.0"
reflect-metadata: "npm:^0.1.13"
checksum: 4f74f52306c27f8bc8b26eb78abb952393b608f16cf18683ec3f7363b64c511786401e59fd57bfc7613c55876aabcb47f256dfcdb0d09b8416ca1901d8562338
checksum: b28884be401012f9bac25639f240f80179f59c01d03258979fc89793e26d1b4303752ef15c150bd5b76227676b10ce1ff6fea498f92fd03be6918d08eec8097b
languageName: node
linkType: hard
@@ -1883,7 +1883,7 @@ __metadata:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/analytics": "workspace:*"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/api": "npm:^1.19.0"
"@standardnotes/common": "workspace:*"
"@standardnotes/domain-events": "workspace:*"
"@standardnotes/domain-events-infra": "workspace:*"
@@ -1910,7 +1910,7 @@ __metadata:
axios: "npm:^0.27.2"
bcryptjs: "npm:2.4.3"
cors: "npm:2.8.5"
dayjs: "npm:^1.11.3"
dayjs: "npm:^1.11.6"
dotenv: "npm:^16.0.1"
eslint: "npm:^8.14.0"
eslint-plugin-prettier: "npm:^4.0.0"
@@ -1945,7 +1945,7 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/common@npm:^1.19.1, @standardnotes/common@npm:^1.23.1, @standardnotes/common@npm:^1.39.0, @standardnotes/common@workspace:*, @standardnotes/common@workspace:^, @standardnotes/common@workspace:packages/common":
"@standardnotes/common@npm:^1.19.1, @standardnotes/common@npm:^1.23.1, @standardnotes/common@npm:^1.39.0, @standardnotes/common@npm:^1.43.0, @standardnotes/common@workspace:*, @standardnotes/common@workspace:^, @standardnotes/common@workspace:packages/common":
version: 0.0.0-use.local
resolution: "@standardnotes/common@workspace:packages/common"
dependencies:
@@ -2013,17 +2013,17 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/encryption@npm:1.18.5":
version: 1.18.5
resolution: "@standardnotes/encryption@npm:1.18.5"
"@standardnotes/encryption@npm:1.19.0":
version: 1.19.0
resolution: "@standardnotes/encryption@npm:1.19.0"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/models": "npm:1.30.0"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/common": "npm:^1.43.0"
"@standardnotes/models": "npm:1.33.0"
"@standardnotes/responses": "npm:1.12.0"
"@standardnotes/sncrypto-common": "npm:1.13.0"
"@standardnotes/utils": "npm:1.10.0"
"@standardnotes/utils": "npm:1.11.0"
reflect-metadata: "npm:^0.1.13"
checksum: b02318801254b428d6a9a26f8ab9bf9b47ddf4e538616f928e6b8db6dfa60270e99b9cd350346d7956c923071ac693d6952c5ec195e46f3df1256a9996520a2f
checksum: af7665e97983650978462f65c1ba768f2c03b742497e3256957beb2e0dcf1d8c47f34f8778eb2dd52c0c7345f0b86f701ca64e0b8fd4ea6597b83c5b73ca7f5b
languageName: node
linkType: hard
@@ -2068,15 +2068,15 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/features@npm:1.53.2":
version: 1.53.2
resolution: "@standardnotes/features@npm:1.53.2"
"@standardnotes/features@npm:1.54.0":
version: 1.54.0
resolution: "@standardnotes/features@npm:1.54.0"
dependencies:
"@standardnotes/auth": "npm:^3.19.4"
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/common": "npm:^1.43.0"
"@standardnotes/security": "npm:^1.2.0"
reflect-metadata: "npm:^0.1.13"
checksum: 820219e3a58fb2b03f3341e9cac2c4a5704b77f1ec8f1ad986aa7ffa92e2ce4bc87c24a1aee98ac80c957a293edf84bef91cff9fce973ab2f108f5ef726db2cc
checksum: 7647e7506e2d863c8a8909644aca157baa9b3b23f0fe260d1786ba8366267571e414ddf5000e1fe109b918d979e97428b1d57afbd457db49efd4219b4c8ff759
languageName: node
linkType: hard
@@ -2106,7 +2106,7 @@ __metadata:
aws-sdk: "npm:^2.1158.0"
connect-busboy: "npm:^1.0.0"
cors: "npm:^2.8.5"
dayjs: "npm:^1.11.3"
dayjs: "npm:^1.11.6"
dotenv: "npm:^16.0.1"
eslint: "npm:^8.14.0"
eslint-plugin-prettier: "npm:^4.0.0"
@@ -2131,17 +2131,17 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/models@npm:1.30.0":
version: 1.30.0
resolution: "@standardnotes/models@npm:1.30.0"
"@standardnotes/models@npm:1.33.0":
version: 1.33.0
resolution: "@standardnotes/models@npm:1.33.0"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/features": "npm:1.53.2"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/utils": "npm:1.10.0"
"@standardnotes/common": "npm:^1.43.0"
"@standardnotes/features": "npm:1.54.0"
"@standardnotes/responses": "npm:1.12.0"
"@standardnotes/utils": "npm:1.11.0"
lodash: "npm:^4.17.21"
reflect-metadata: "npm:^0.1.13"
checksum: 40c234f92ba0b4c33ba7e8cc604058f3b87086d83dd5642ed5d17faff47dacbf6079bf3912c5eac6f51d0dae13da1ad960746c3cc36a0d37128f3bf6b2ce873d
checksum: 7d45409e4aeef5d4299e1fd12a18e13554023e63652460754313099d11f54130afa4bf8f0de0280ed7a83ff6bb4bc59eb96b28a4f1f617755e969f4672b07b1a
languageName: node
linkType: hard
@@ -2197,15 +2197,15 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/responses@npm:1.11.2":
version: 1.11.2
resolution: "@standardnotes/responses@npm:1.11.2"
"@standardnotes/responses@npm:1.12.0":
version: 1.12.0
resolution: "@standardnotes/responses@npm:1.12.0"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/features": "npm:1.53.2"
"@standardnotes/common": "npm:^1.43.0"
"@standardnotes/features": "npm:1.54.0"
"@standardnotes/security": "npm:^1.1.0"
reflect-metadata: "npm:^0.1.13"
checksum: 2a1ffd142c23866228afe06d1dc6e453515d8bf8ad3da0ca2e24d638835a2f639913d75aa830c24343bed743baeb76c382c2cf70232e75538b5c3803fe8ddf0d
checksum: 15b2e92d57870d881b2923843db6c9506be6f1e49e4522cbc261a8c8933bff2a41b0e82855fd5e8c42f933da9f05408f38e2f1d53b320a61312ee76bac37398c
languageName: node
linkType: hard
@@ -2226,7 +2226,7 @@ __metadata:
"@types/node": "npm:^18.0.0"
"@typescript-eslint/eslint-plugin": "npm:^5.29.0"
aws-sdk: "npm:^2.1158.0"
dayjs: "npm:^1.11.3"
dayjs: "npm:^1.11.6"
dotenv: "npm:^16.0.1"
eslint: "npm:^8.14.0"
eslint-plugin-prettier: "npm:^4.0.0"
@@ -2386,7 +2386,7 @@ __metadata:
"@types/jest": "npm:^29.1.1"
"@types/microtime": "npm:^2.1.0"
"@typescript-eslint/eslint-plugin": "npm:^5.30.0"
dayjs: "npm:^1.10.8"
dayjs: "npm:^1.11.6"
eslint-plugin-prettier: "npm:^4.2.1"
jest: "npm:^29.1.2"
microtime: "npm:^3.1.0"
@@ -2408,13 +2408,25 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/utils@npm:1.11.0":
version: 1.11.0
resolution: "@standardnotes/utils@npm:1.11.0"
dependencies:
"@standardnotes/common": "npm:^1.43.0"
dompurify: "npm:^2.3.8"
lodash: "npm:^4.17.21"
reflect-metadata: "npm:^0.1.13"
checksum: 9e7d9c12573d9819f8dfa3128d5437e7c6c7cad72e6c65e90456a1dfcfe711fb9fdc91493fb974fa6941a37cbd62a800283d4b04d8a6464250a1681da7ace983
languageName: node
linkType: hard
"@standardnotes/websockets-server@workspace:packages/websockets":
version: 0.0.0-use.local
resolution: "@standardnotes/websockets-server@workspace:packages/websockets"
dependencies:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/api": "npm:^1.19.0"
"@standardnotes/common": "workspace:^"
"@standardnotes/domain-events": "workspace:^"
"@standardnotes/domain-events-infra": "workspace:^"
@@ -2452,7 +2464,7 @@ __metadata:
dependencies:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/api": "npm:^1.19.0"
"@standardnotes/common": "workspace:*"
"@standardnotes/domain-events": "workspace:^"
"@standardnotes/domain-events-infra": "workspace:^"
@@ -4551,10 +4563,10 @@ __metadata:
languageName: node
linkType: hard
"dayjs@npm:^1.10.8, dayjs@npm:^1.11.3":
version: 1.11.5
resolution: "dayjs@npm:1.11.5"
checksum: ea78d43de0ff67d65f54cd8c927908ee72421f4d73ce5aa19060e20f26b1940db2980b273427eb1813434fdb2df6731e2ac609d97e89e665d29e7b638f762894
"dayjs@npm:^1.11.6":
version: 1.11.6
resolution: "dayjs@npm:1.11.6"
checksum: f59ea45f2438056f10955a979124738906d897fb642b6157ead34b675240a79a1424655f691a35af810248575506459bf65eadd7d51625cdc537bf805a92dea6
languageName: node
linkType: hard