mirror of
https://github.com/standardnotes/server
synced 2026-02-06 02:01:13 -05:00
Compare commits
14 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d284461f3 | ||
|
|
6642641c11 | ||
|
|
3e637a482e | ||
|
|
6374248132 | ||
|
|
b9661d74ee | ||
|
|
0a5b956cb9 | ||
|
|
be88fd941d | ||
|
|
48af9e7c1c | ||
|
|
71684350e9 | ||
|
|
9a1924b7c6 | ||
|
|
fc20697d81 | ||
|
|
e7dda207fa | ||
|
|
7fd97fa194 | ||
|
|
ccbadfbd69 |
74
.pnp.cjs
generated
74
.pnp.cjs
generated
@@ -2480,7 +2480,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@types/jest", "npm:28.1.4"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
["ioredis", "npm:4.28.5"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["reflect-metadata", "npm:0.1.13"],\
|
||||
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.0.5"]\
|
||||
@@ -2533,7 +2533,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["helmet", "npm:4.4.1"],\
|
||||
["inversify", "npm:6.0.1"],\
|
||||
["inversify-express-utils", "npm:6.4.3"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["jsonwebtoken", "npm:8.5.1"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
@@ -2601,7 +2601,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["express", "npm:4.18.1"],\
|
||||
["inversify", "npm:6.0.1"],\
|
||||
["inversify-express-utils", "npm:6.4.3"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["mysql2", "npm:2.3.3"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
@@ -2680,7 +2680,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["aws-sdk", "npm:2.1168.0"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
["ioredis", "npm:4.28.5"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
["reflect-metadata", "npm:0.1.13"],\
|
||||
@@ -2725,7 +2725,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["eslint", "npm:8.19.0"],\
|
||||
["eslint-plugin-prettier", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.2.1"],\
|
||||
["inversify", "npm:6.0.1"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["mysql2", "npm:2.3.3"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
@@ -2785,7 +2785,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["helmet", "npm:4.6.0"],\
|
||||
["inversify", "npm:6.0.1"],\
|
||||
["inversify-express-utils", "npm:6.4.3"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["jsonwebtoken", "npm:8.5.1"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
@@ -2878,7 +2878,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["dotenv", "npm:16.0.1"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
["inversify", "npm:5.0.5"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["mysql2", "npm:2.3.3"],\
|
||||
["newrelic", "npm:8.14.1"],\
|
||||
@@ -3029,7 +3029,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["helmet", "npm:4.3.1"],\
|
||||
["inversify", "npm:6.0.1"],\
|
||||
["inversify-express-utils", "npm:6.4.3"],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
|
||||
["jsonwebtoken", "npm:8.5.1"],\
|
||||
["mysql2", "npm:2.3.3"],\
|
||||
@@ -5744,13 +5744,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["denque", [\
|
||||
["npm:1.5.1", {\
|
||||
"packageLocation": "./.yarn/cache/denque-npm-1.5.1-2dd42d2dcb-4375ad19d5.zip/node_modules/denque/",\
|
||||
"packageDependencies": [\
|
||||
["denque", "npm:1.5.1"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["npm:2.0.1", {\
|
||||
"packageLocation": "./.yarn/cache/denque-npm-2.0.1-4ba00e404b-ec398d1e3c.zip/node_modules/denque/",\
|
||||
"packageDependencies": [\
|
||||
@@ -7613,28 +7606,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["ioredis", [\
|
||||
["npm:4.28.5", {\
|
||||
"packageLocation": "./.yarn/cache/ioredis-npm-4.28.5-74671f2fa3-a8793c3324.zip/node_modules/ioredis/",\
|
||||
["npm:5.2.0", {\
|
||||
"packageLocation": "./.yarn/cache/ioredis-npm-5.2.0-e2dd53ed39-37189fcd4b.zip/node_modules/ioredis/",\
|
||||
"packageDependencies": [\
|
||||
["ioredis", "npm:4.28.5"],\
|
||||
["cluster-key-slot", "npm:1.1.0"],\
|
||||
["debug", "virtual:b86a9fb34323a98c6519528ed55faa0d9b44ca8879307c0b29aa384bde47ff59a7d0c9051b31246f14521dfb71ba3c5d6d0b35c29fffc17bf875aa6ad977d9e8#npm:4.3.4"],\
|
||||
["denque", "npm:1.5.1"],\
|
||||
["lodash.defaults", "npm:4.2.0"],\
|
||||
["lodash.flatten", "npm:4.4.0"],\
|
||||
["lodash.isarguments", "npm:3.1.0"],\
|
||||
["p-map", "npm:2.1.0"],\
|
||||
["redis-commands", "npm:1.7.0"],\
|
||||
["redis-errors", "npm:1.2.0"],\
|
||||
["redis-parser", "npm:3.0.0"],\
|
||||
["standard-as-callback", "npm:2.1.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["npm:5.1.0", {\
|
||||
"packageLocation": "./.yarn/cache/ioredis-npm-5.1.0-cc56f45bbf-7b1c137836.zip/node_modules/ioredis/",\
|
||||
"packageDependencies": [\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["@ioredis/commands", "npm:1.2.0"],\
|
||||
["cluster-key-slot", "npm:1.1.0"],\
|
||||
["debug", "virtual:b86a9fb34323a98c6519528ed55faa0d9b44ca8879307c0b29aa384bde47ff59a7d0c9051b31246f14521dfb71ba3c5d6d0b35c29fffc17bf875aa6ad977d9e8#npm:4.3.4"],\
|
||||
@@ -8921,15 +8896,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["lodash.flatten", [\
|
||||
["npm:4.4.0", {\
|
||||
"packageLocation": "./.yarn/cache/lodash.flatten-npm-4.4.0-495935e617-0ac34a393d.zip/node_modules/lodash.flatten/",\
|
||||
"packageDependencies": [\
|
||||
["lodash.flatten", "npm:4.4.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["lodash.includes", [\
|
||||
["npm:4.3.0", {\
|
||||
"packageLocation": "./.yarn/cache/lodash.includes-npm-4.3.0-3a2f6fa22c-71092c1305.zip/node_modules/lodash.includes/",\
|
||||
@@ -10134,13 +10100,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["p-map", [\
|
||||
["npm:2.1.0", {\
|
||||
"packageLocation": "./.yarn/cache/p-map-npm-2.1.0-d9e865dc7c-9e3ad3c9f6.zip/node_modules/p-map/",\
|
||||
"packageDependencies": [\
|
||||
["p-map", "npm:2.1.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["npm:4.0.0", {\
|
||||
"packageLocation": "./.yarn/cache/p-map-npm-4.0.0-4677ae07c7-cb0ab21ec0.zip/node_modules/p-map/",\
|
||||
"packageDependencies": [\
|
||||
@@ -10999,15 +10958,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["redis-commands", [\
|
||||
["npm:1.7.0", {\
|
||||
"packageLocation": "./.yarn/cache/redis-commands-npm-1.7.0-528f61f9d8-d1ff7fbcb5.zip/node_modules/redis-commands/",\
|
||||
"packageDependencies": [\
|
||||
["redis-commands", "npm:1.7.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["redis-errors", [\
|
||||
["npm:1.2.0", {\
|
||||
"packageLocation": "./.yarn/cache/redis-errors-npm-1.2.0-a81fd9b0f1-f28ac26921.zip/node_modules/redis-errors/",\
|
||||
@@ -12547,7 +12497,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["dotenv", "npm:16.0.1"],\
|
||||
["glob", "npm:7.2.3"],\
|
||||
["hdb-pool", null],\
|
||||
["ioredis", "npm:5.1.0"],\
|
||||
["ioredis", "npm:5.2.0"],\
|
||||
["js-yaml", "npm:4.1.0"],\
|
||||
["mkdirp", "npm:1.0.4"],\
|
||||
["mongodb", null],\
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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.8.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@1.8.2...@standardnotes/analytics@1.8.3) (2022-07-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **analytics:** change send_command to bitop function ([7fd97fa](https://github.com/standardnotes/server/commit/7fd97fa1940b6aab6b235a1ae2cb6ed2aa6ae917))
|
||||
|
||||
## [1.8.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@1.8.1...@standardnotes/analytics@1.8.2) (2022-07-12)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/analytics
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/analytics",
|
||||
"version": "1.8.2",
|
||||
"version": "1.8.3",
|
||||
"engines": {
|
||||
"node": ">=14.0.0 <17.0.0"
|
||||
},
|
||||
@@ -26,11 +26,11 @@
|
||||
"test:unit": "jest spec --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ioredis": "^4.28.8",
|
||||
"@types/ioredis": "^4.28.10",
|
||||
"@types/jest": "^28.1.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"ioredis": "^4.28.5",
|
||||
"ioredis": "^5.2.0",
|
||||
"jest": "^28.1.2",
|
||||
"ts-jest": "^28.0.5"
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('RedisAnalyticsStore', () => {
|
||||
redisClient.incr = jest.fn()
|
||||
redisClient.setbit = jest.fn()
|
||||
redisClient.getbit = jest.fn().mockReturnValue(1)
|
||||
redisClient.send_command = jest.fn()
|
||||
redisClient.bitop = jest.fn()
|
||||
|
||||
periodKeyGenerator = {} as jest.Mocked<PeriodKeyGeneratorInterface>
|
||||
periodKeyGenerator.getPeriodKey = jest.fn().mockReturnValue('period-key')
|
||||
@@ -50,8 +50,7 @@ describe('RedisAnalyticsStore', () => {
|
||||
),
|
||||
).toEqual(70)
|
||||
|
||||
expect(redisClient.send_command).toHaveBeenCalledWith(
|
||||
'BITOP',
|
||||
expect(redisClient.bitop).toHaveBeenCalledWith(
|
||||
'AND',
|
||||
'bitmap:action:editing-items:timespan:period-key-period-key',
|
||||
'bitmap:action:editing-items:timespan:period-key',
|
||||
|
||||
@@ -59,8 +59,7 @@ export class RedisAnalyticsStore implements AnalyticsStoreInterface {
|
||||
|
||||
const diffKey = `bitmap:action:${activity}:timespan:${initialPeriodKey}-${subsequentPeriodKey}`
|
||||
|
||||
await this.redisClient.send_command(
|
||||
'BITOP',
|
||||
await this.redisClient.bitop(
|
||||
'AND',
|
||||
diffKey,
|
||||
`bitmap:action:${activity}:timespan:${initialPeriodKey}`,
|
||||
|
||||
@@ -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.6.29](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.28...@standardnotes/api-gateway@1.6.29) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
## [1.6.28](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.27...@standardnotes/api-gateway@1.6.28) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
## [1.6.27](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.26...@standardnotes/api-gateway@1.6.27) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/api-gateway",
|
||||
"version": "1.6.27",
|
||||
"version": "1.6.29",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -37,7 +37,7 @@
|
||||
"helmet": "4.4.1",
|
||||
"inversify": "^6.0.1",
|
||||
"inversify-express-utils": "^6.4.3",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"newrelic": "^8.14.1",
|
||||
"prettyjson": "^1.2.5",
|
||||
|
||||
@@ -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.11.30](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.11.29...@standardnotes/auth-server@1.11.30) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth-server
|
||||
|
||||
## [1.11.29](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.11.28...@standardnotes/auth-server@1.11.29) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth-server
|
||||
|
||||
## [1.11.28](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.11.27...@standardnotes/auth-server@1.11.28) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/auth-server",
|
||||
"version": "1.11.28",
|
||||
"version": "1.11.30",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -55,7 +55,7 @@
|
||||
"express": "^4.18.1",
|
||||
"inversify": "^6.0.1",
|
||||
"inversify-express-utils": "^6.4.3",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"mysql2": "^2.3.3",
|
||||
"newrelic": "^8.14.1",
|
||||
"otplib": "12.0.1",
|
||||
|
||||
@@ -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.7.27](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.26...@standardnotes/domain-events-infra@1.7.27) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||
|
||||
## [1.7.26](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.25...@standardnotes/domain-events-infra@1.7.26) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||
|
||||
## [1.7.25](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.24...@standardnotes/domain-events-infra@1.7.25) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/domain-events-infra",
|
||||
"version": "1.7.25",
|
||||
"version": "1.7.27",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -26,14 +26,14 @@
|
||||
"dependencies": {
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"aws-sdk": "^2.1082.0",
|
||||
"ioredis": "^4.28.5",
|
||||
"ioredis": "^5.2.0",
|
||||
"newrelic": "^8.8.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sqs-consumer": "^5.6.0",
|
||||
"winston": "^3.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ioredis": "^4.28.8",
|
||||
"@types/ioredis": "^4.28.10",
|
||||
"@types/jest": "^28.1.4",
|
||||
"@types/newrelic": "^7.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.50.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.50.1...@standardnotes/domain-events@2.50.2) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events
|
||||
|
||||
## [2.50.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.50.0...@standardnotes/domain-events@2.50.1) (2022-07-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/domain-events",
|
||||
"version": "2.50.1",
|
||||
"version": "2.50.2",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -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.1.26](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.1.25...@standardnotes/event-store@1.1.26) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/event-store
|
||||
|
||||
## [1.1.25](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.1.24...@standardnotes/event-store@1.1.25) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/event-store
|
||||
|
||||
## [1.1.24](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.1.23...@standardnotes/event-store@1.1.24) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/event-store
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/event-store",
|
||||
"version": "1.1.24",
|
||||
"version": "1.1.26",
|
||||
"description": "Event Store Service",
|
||||
"private": true,
|
||||
"main": "dist/src/index.js",
|
||||
@@ -37,7 +37,7 @@
|
||||
"aws-sdk": "^2.1159.0",
|
||||
"dotenv": "^16.0.1",
|
||||
"inversify": "^6.0.1",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"mysql2": "^2.3.3",
|
||||
"newrelic": "^8.14.1",
|
||||
"reflect-metadata": "0.1.13",
|
||||
|
||||
@@ -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.27](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.26...@standardnotes/files-server@1.5.27) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files-server
|
||||
|
||||
## [1.5.26](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.25...@standardnotes/files-server@1.5.26) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files-server
|
||||
|
||||
## [1.5.25](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.24...@standardnotes/files-server@1.5.25) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/files-server",
|
||||
"version": "1.5.25",
|
||||
"version": "1.5.27",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -44,7 +44,7 @@
|
||||
"helmet": "^4.3.1",
|
||||
"inversify": "^6.0.1",
|
||||
"inversify-express-utils": "^6.4.3",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"newrelic": "^8.14.1",
|
||||
"nodemon": "^2.0.19",
|
||||
|
||||
@@ -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.3.0](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.2.6...@standardnotes/predicates@1.3.0) (2022-07-25)
|
||||
|
||||
### Features
|
||||
|
||||
* **predicates:** add could-not-be-determined predicate verification result ([6642641](https://github.com/standardnotes/server/commit/6642641c1161986a1c1186698f6b8151ce3aee87))
|
||||
|
||||
## [1.2.6](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.2.5...@standardnotes/predicates@1.2.6) (2022-07-14)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/predicates
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/predicates",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export enum PredicateVerificationResult {
|
||||
Affirmed = 'affirmed',
|
||||
Denied = 'denied',
|
||||
CouldNotBeDetermined = 'could-not-be-determined',
|
||||
}
|
||||
|
||||
@@ -3,6 +3,39 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.8.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.8.1...@standardnotes/scheduler-server@1.8.2) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||
|
||||
## [1.8.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.8.0...@standardnotes/scheduler-server@1.8.1) (2022-07-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **scheduler:** checking for predicates fullfillment on applying discount ([6374248](https://github.com/standardnotes/server/commit/637424813278b7dd81969e1783cbc38d1a916cab))
|
||||
|
||||
# [1.8.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.7.0...@standardnotes/scheduler-server@1.8.0) (2022-07-25)
|
||||
|
||||
### Features
|
||||
|
||||
* **scheduler:** add feature flag behind applying and withdrawing discounts ([0a5b956](https://github.com/standardnotes/server/commit/0a5b956cb9586d353ac68c79e8473d74f8d9796a))
|
||||
|
||||
# [1.7.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.6.0...@standardnotes/scheduler-server@1.7.0) (2022-07-25)
|
||||
|
||||
### Features
|
||||
|
||||
* **scheduler:** add creating discount apply/withdraw events ([7168435](https://github.com/standardnotes/server/commit/71684350e94053d884ae907e5d3deba4bc027f1b))
|
||||
* **scheduler:** add publishing discount apply/withdraw events ([48af9e7](https://github.com/standardnotes/server/commit/48af9e7c1cfb582389af83e15977b930bf067f8d))
|
||||
|
||||
# [1.6.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.5.23...@standardnotes/scheduler-server@1.6.0) (2022-07-22)
|
||||
|
||||
### Features
|
||||
|
||||
* **scheduler:** schedule apply and withdraw subscription discounts upon registration ([fc20697](https://github.com/standardnotes/server/commit/fc20697d81419827c4f51c5c80804dd98804f33f))
|
||||
|
||||
## [1.5.23](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.5.22...@standardnotes/scheduler-server@1.5.23) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||
|
||||
## [1.5.22](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.5.21...@standardnotes/scheduler-server@1.5.22) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/scheduler-server",
|
||||
"version": "1.5.22",
|
||||
"version": "1.8.2",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -35,7 +35,7 @@
|
||||
"dayjs": "^1.11.3",
|
||||
"dotenv": "^16.0.1",
|
||||
"inversify": "5.0.5",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"mysql2": "^2.3.3",
|
||||
"newrelic": "^8.14.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
||||
@@ -19,6 +19,52 @@ describe('DomainEventFactory', () => {
|
||||
timer.getUTCDate = jest.fn().mockReturnValue(new Date(1))
|
||||
})
|
||||
|
||||
it('should create a DISCOUNT_APPLY_REQUESTED event', () => {
|
||||
expect(
|
||||
createFactory().createDiscountApplyRequestedEvent({
|
||||
userEmail: 'test@test.te',
|
||||
discountCode: 'off-10',
|
||||
}),
|
||||
).toEqual({
|
||||
createdAt: expect.any(Date),
|
||||
meta: {
|
||||
correlation: {
|
||||
userIdentifier: 'test@test.te',
|
||||
userIdentifierType: 'email',
|
||||
},
|
||||
origin: 'scheduler',
|
||||
},
|
||||
payload: {
|
||||
userEmail: 'test@test.te',
|
||||
discountCode: 'off-10',
|
||||
},
|
||||
type: 'DISCOUNT_APPLY_REQUESTED',
|
||||
})
|
||||
})
|
||||
|
||||
it('should create a DISCOUNT_WITHDRAW_REQUESTED event', () => {
|
||||
expect(
|
||||
createFactory().createDiscountWithdrawRequestedEvent({
|
||||
userEmail: 'test@test.te',
|
||||
discountCode: 'off-10',
|
||||
}),
|
||||
).toEqual({
|
||||
createdAt: expect.any(Date),
|
||||
meta: {
|
||||
correlation: {
|
||||
userIdentifier: 'test@test.te',
|
||||
userIdentifierType: 'email',
|
||||
},
|
||||
origin: 'scheduler',
|
||||
},
|
||||
payload: {
|
||||
userEmail: 'test@test.te',
|
||||
discountCode: 'off-10',
|
||||
},
|
||||
type: 'DISCOUNT_WITHDRAW_REQUESTED',
|
||||
})
|
||||
})
|
||||
|
||||
it('should create a EMAIL_MESSAGE_REQUESTED event', () => {
|
||||
expect(
|
||||
createFactory().createEmailMessageRequestedEvent({
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { EmailMessageIdentifier } from '@standardnotes/common'
|
||||
import {
|
||||
DiscountApplyRequestedEvent,
|
||||
DiscountWithdrawRequestedEvent,
|
||||
DomainEventService,
|
||||
EmailMessageRequestedEvent,
|
||||
PredicateVerificationRequestedEvent,
|
||||
@@ -16,6 +18,39 @@ import { DomainEventFactoryInterface } from './DomainEventFactoryInterface'
|
||||
export class DomainEventFactory implements DomainEventFactoryInterface {
|
||||
constructor(@inject(TYPES.Timer) private timer: TimerInterface) {}
|
||||
|
||||
createDiscountApplyRequestedEvent(dto: { userEmail: string; discountCode: string }): DiscountApplyRequestedEvent {
|
||||
return {
|
||||
type: 'DISCOUNT_APPLY_REQUESTED',
|
||||
createdAt: this.timer.getUTCDate(),
|
||||
meta: {
|
||||
correlation: {
|
||||
userIdentifier: dto.userEmail,
|
||||
userIdentifierType: 'email',
|
||||
},
|
||||
origin: DomainEventService.Scheduler,
|
||||
},
|
||||
payload: dto,
|
||||
}
|
||||
}
|
||||
|
||||
createDiscountWithdrawRequestedEvent(dto: {
|
||||
userEmail: string
|
||||
discountCode: string
|
||||
}): DiscountWithdrawRequestedEvent {
|
||||
return {
|
||||
type: '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
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { EmailMessageIdentifier } from '@standardnotes/common'
|
||||
import { EmailMessageRequestedEvent, PredicateVerificationRequestedEvent } from '@standardnotes/domain-events'
|
||||
import {
|
||||
DiscountApplyRequestedEvent,
|
||||
DiscountWithdrawRequestedEvent,
|
||||
EmailMessageRequestedEvent,
|
||||
PredicateVerificationRequestedEvent,
|
||||
} from '@standardnotes/domain-events'
|
||||
|
||||
import { Job } from '../Job/Job'
|
||||
import { Predicate } from '../Predicate/Predicate'
|
||||
@@ -11,4 +16,6 @@ export interface DomainEventFactoryInterface {
|
||||
messageIdentifier: EmailMessageIdentifier
|
||||
context: Record<string, unknown>
|
||||
}): EmailMessageRequestedEvent
|
||||
createDiscountApplyRequestedEvent(dto: { userEmail: string; discountCode: string }): DiscountApplyRequestedEvent
|
||||
createDiscountWithdrawRequestedEvent(dto: { userEmail: string; discountCode: string }): DiscountWithdrawRequestedEvent
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ export class UserRegisteredEventHandler implements DomainEventHandlerInterface {
|
||||
await this.scheduleEncourageEmailBackupsJob(event)
|
||||
|
||||
await this.scheduleEncourageSubscriptionPurchasing(event)
|
||||
|
||||
await this.scheduleSubscriptionDiscountApplying(event)
|
||||
|
||||
await this.scheduleSubscriptionDiscountWithdraw(event)
|
||||
}
|
||||
|
||||
private async scheduleEncourageEmailBackupsJob(event: UserRegisteredEvent): Promise<void> {
|
||||
@@ -65,4 +69,36 @@ export class UserRegisteredEventHandler implements DomainEventHandlerInterface {
|
||||
|
||||
await this.predicateRepository.save(predicate)
|
||||
}
|
||||
|
||||
private async scheduleSubscriptionDiscountApplying(event: UserRegisteredEvent): Promise<void> {
|
||||
const job = new Job()
|
||||
job.name = JobName.APPLY_SUBSCRIPTION_DISCOUNT
|
||||
job.scheduledAt = this.timer.convertDateToMicroseconds(this.timer.getUTCDateNDaysAhead(7))
|
||||
job.createdAt = this.timer.getTimestampInMicroseconds()
|
||||
job.status = JobStatus.Pending
|
||||
job.userIdentifier = event.payload.email
|
||||
job.userIdentifierType = 'email'
|
||||
|
||||
await this.jobRepository.save(job)
|
||||
|
||||
const predicate = new Predicate()
|
||||
predicate.name = PredicateName.SubscriptionPurchased
|
||||
predicate.status = PredicateStatus.Pending
|
||||
predicate.authority = PredicateAuthority.Auth
|
||||
predicate.job = Promise.resolve(job)
|
||||
|
||||
await this.predicateRepository.save(predicate)
|
||||
}
|
||||
|
||||
private async scheduleSubscriptionDiscountWithdraw(event: UserRegisteredEvent): Promise<void> {
|
||||
const job = new Job()
|
||||
job.name = JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT
|
||||
job.scheduledAt = this.timer.convertDateToMicroseconds(this.timer.getUTCDateNDaysAhead(12))
|
||||
job.createdAt = this.timer.getTimestampInMicroseconds()
|
||||
job.status = JobStatus.Pending
|
||||
job.userIdentifier = event.payload.email
|
||||
job.userIdentifierType = 'email'
|
||||
|
||||
await this.jobRepository.save(job)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { DomainEventPublisherInterface, EmailMessageRequestedEvent } from '@standardnotes/domain-events'
|
||||
import {
|
||||
DiscountApplyRequestedEvent,
|
||||
DiscountWithdrawRequestedEvent,
|
||||
DomainEventPublisherInterface,
|
||||
EmailMessageRequestedEvent,
|
||||
} from '@standardnotes/domain-events'
|
||||
import { PredicateName } from '@standardnotes/predicates'
|
||||
import 'reflect-metadata'
|
||||
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||
@@ -35,6 +40,12 @@ describe('JobDoneInterpreter', () => {
|
||||
domainEventFactory.createEmailMessageRequestedEvent = jest
|
||||
.fn()
|
||||
.mockReturnValue({} as jest.Mocked<EmailMessageRequestedEvent>)
|
||||
domainEventFactory.createDiscountApplyRequestedEvent = jest
|
||||
.fn()
|
||||
.mockReturnValue({} as jest.Mocked<DiscountApplyRequestedEvent>)
|
||||
domainEventFactory.createDiscountWithdrawRequestedEvent = jest
|
||||
.fn()
|
||||
.mockReturnValue({} as jest.Mocked<DiscountWithdrawRequestedEvent>)
|
||||
|
||||
domainEventPublisher = {} as jest.Mocked<DomainEventPublisherInterface>
|
||||
domainEventPublisher.publish = jest.fn()
|
||||
@@ -172,6 +183,95 @@ describe('JobDoneInterpreter', () => {
|
||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should request discount apply', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.APPLY_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: 'test@standardnotes.com',
|
||||
userIdentifierType: 'email',
|
||||
} as jest.Mocked<Job>)
|
||||
predicateRepository.findByJobUuid = jest
|
||||
.fn()
|
||||
.mockReturnValue([
|
||||
{ name: PredicateName.SubscriptionPurchased, status: PredicateStatus.Denied } as jest.Mocked<Predicate>,
|
||||
])
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountApplyRequestedEvent).toHaveBeenCalledWith({
|
||||
userEmail: 'test@standardnotes.com',
|
||||
discountCode: 'econ-10',
|
||||
})
|
||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not request discount apply if email is not internal', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.APPLY_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: 'test@test.com',
|
||||
userIdentifierType: 'email',
|
||||
} as jest.Mocked<Job>)
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountApplyRequestedEvent).not.toHaveBeenCalled()
|
||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not request discount apply if email is missing', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.APPLY_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: '2-3-4',
|
||||
userIdentifierType: 'uuid',
|
||||
} as jest.Mocked<Job>)
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountApplyRequestedEvent).not.toHaveBeenCalled()
|
||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should request discount withdraw', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: 'test@standardnotes.com',
|
||||
userIdentifierType: 'email',
|
||||
} as jest.Mocked<Job>)
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountWithdrawRequestedEvent).toHaveBeenCalledWith({
|
||||
userEmail: 'test@standardnotes.com',
|
||||
discountCode: 'econ-10',
|
||||
})
|
||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not request discount withdraw if email is not internal', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: 'test@test.com',
|
||||
userIdentifierType: 'email',
|
||||
} as jest.Mocked<Job>)
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountWithdrawRequestedEvent).not.toHaveBeenCalled()
|
||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not request discount withdraw if email is missing', async () => {
|
||||
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
|
||||
name: JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT,
|
||||
userIdentifier: '2-3-4',
|
||||
userIdentifierType: 'uuid',
|
||||
} as jest.Mocked<Job>)
|
||||
|
||||
await createInterpreter().interpret('1-2-3')
|
||||
|
||||
expect(domainEventFactory.createDiscountWithdrawRequestedEvent).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,
|
||||
|
||||
@@ -49,6 +49,16 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
|
||||
await this.requestExitInterviewEmail(job.userIdentifier)
|
||||
}
|
||||
return
|
||||
case JobName.APPLY_SUBSCRIPTION_DISCOUNT:
|
||||
if (job.userIdentifierType === 'email' && job.userIdentifier.includes('@standardnotes.com')) {
|
||||
await this.requestDiscountApply(job.userIdentifier)
|
||||
}
|
||||
return
|
||||
case JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT:
|
||||
if (job.userIdentifierType === 'email' && job.userIdentifier.includes('@standardnotes.com')) {
|
||||
await this.requestDiscountWithdraw(job.userIdentifier)
|
||||
}
|
||||
return
|
||||
default:
|
||||
return
|
||||
}
|
||||
@@ -86,6 +96,24 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
|
||||
)
|
||||
}
|
||||
|
||||
private async requestDiscountApply(userEmail: string): Promise<void> {
|
||||
await this.domainEventPublisher.publish(
|
||||
this.domainEventFactory.createDiscountApplyRequestedEvent({
|
||||
userEmail,
|
||||
discountCode: 'econ-10',
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
private async requestDiscountWithdraw(userEmail: string): Promise<void> {
|
||||
await this.domainEventPublisher.publish(
|
||||
this.domainEventFactory.createDiscountWithdrawRequestedEvent({
|
||||
userEmail,
|
||||
discountCode: 'econ-10',
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
private async predicatesAreFulfilled(job: Job): Promise<boolean> {
|
||||
const predicates = await this.predicateRepository.findByJobUuid(job.uuid)
|
||||
|
||||
@@ -96,6 +124,7 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
|
||||
PredicateStatus.Denied
|
||||
)
|
||||
case JobName.ENCOURAGE_SUBSCRIPTION_PURCHASING:
|
||||
case JobName.APPLY_SUBSCRIPTION_DISCOUNT:
|
||||
return (
|
||||
predicates.find((predicate) => predicate.name === PredicateName.SubscriptionPurchased)?.status ===
|
||||
PredicateStatus.Denied
|
||||
|
||||
@@ -3,4 +3,6 @@ export enum JobName {
|
||||
ENCOURAGE_EMAIL_BACKUPS = 'encourage-email-backups',
|
||||
ENCOURAGE_SUBSCRIPTION_PURCHASING = 'encourage-subscription-purchasing',
|
||||
EXIT_INTERVIEW = 'exit-interview',
|
||||
APPLY_SUBSCRIPTION_DISCOUNT = 'apply-subscription-discount',
|
||||
WITHDRAW_SUBSCRIPTION_DISCOUNT = 'withdraw-subscription-discount',
|
||||
}
|
||||
|
||||
@@ -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.6.29](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.28...@standardnotes/syncing-server@1.6.29) (2022-07-25)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||
|
||||
## [1.6.28](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.27...@standardnotes/syncing-server@1.6.28) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||
|
||||
## [1.6.27](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.26...@standardnotes/syncing-server@1.6.27) (2022-07-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/syncing-server",
|
||||
"version": "1.6.27",
|
||||
"version": "1.6.29",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -43,7 +43,7 @@
|
||||
"helmet": "4.3.1",
|
||||
"inversify": "^6.0.1",
|
||||
"inversify-express-utils": "^6.4.3",
|
||||
"ioredis": "^5.0.6",
|
||||
"ioredis": "^5.2.0",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"mysql2": "^2.3.3",
|
||||
"newrelic": "^8.14.1",
|
||||
|
||||
77
yarn.lock
77
yarn.lock
@@ -1752,11 +1752,11 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/analytics@workspace:packages/analytics"
|
||||
dependencies:
|
||||
"@types/ioredis": ^4.28.8
|
||||
"@types/ioredis": ^4.28.10
|
||||
"@types/jest": ^28.1.4
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
ioredis: ^4.28.5
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
reflect-metadata: ^0.1.13
|
||||
ts-jest: ^28.0.5
|
||||
@@ -1792,7 +1792,7 @@ __metadata:
|
||||
helmet: 4.4.1
|
||||
inversify: ^6.0.1
|
||||
inversify-express-utils: ^6.4.3
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
jsonwebtoken: 8.5.1
|
||||
newrelic: ^8.14.1
|
||||
@@ -1861,7 +1861,7 @@ __metadata:
|
||||
express: ^4.18.1
|
||||
inversify: ^6.0.1
|
||||
inversify-express-utils: ^6.4.3
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
mysql2: ^2.3.3
|
||||
newrelic: ^8.14.1
|
||||
@@ -1920,13 +1920,13 @@ __metadata:
|
||||
resolution: "@standardnotes/domain-events-infra@workspace:packages/domain-events-infra"
|
||||
dependencies:
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@types/ioredis": ^4.28.8
|
||||
"@types/ioredis": ^4.28.10
|
||||
"@types/jest": ^28.1.4
|
||||
"@types/newrelic": ^7.0.3
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
aws-sdk: ^2.1082.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
ioredis: ^4.28.5
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
newrelic: ^8.8.0
|
||||
reflect-metadata: ^0.1.13
|
||||
@@ -1985,7 +1985,7 @@ __metadata:
|
||||
eslint: ^8.14.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
inversify: ^6.0.1
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
mysql2: ^2.3.3
|
||||
newrelic: ^8.14.1
|
||||
@@ -2042,7 +2042,7 @@ __metadata:
|
||||
helmet: ^4.3.1
|
||||
inversify: ^6.0.1
|
||||
inversify-express-utils: ^6.4.3
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
jsonwebtoken: ^8.5.1
|
||||
newrelic: ^8.14.1
|
||||
@@ -2128,7 +2128,7 @@ __metadata:
|
||||
dotenv: ^16.0.1
|
||||
eslint-plugin-prettier: ^4.0.0
|
||||
inversify: 5.0.5
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
mysql2: ^2.3.3
|
||||
newrelic: ^8.14.1
|
||||
@@ -2266,7 +2266,7 @@ __metadata:
|
||||
helmet: 4.3.1
|
||||
inversify: ^6.0.1
|
||||
inversify-express-utils: ^6.4.3
|
||||
ioredis: ^5.0.6
|
||||
ioredis: ^5.2.0
|
||||
jest: ^28.1.2
|
||||
jsonwebtoken: 8.5.1
|
||||
mysql2: ^2.3.3
|
||||
@@ -2517,7 +2517,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/ioredis@npm:^4.28.10, @types/ioredis@npm:^4.28.8":
|
||||
"@types/ioredis@npm:^4.28.10":
|
||||
version: 4.28.10
|
||||
resolution: "@types/ioredis@npm:4.28.10"
|
||||
dependencies:
|
||||
@@ -4387,13 +4387,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"denque@npm:^1.1.0":
|
||||
version: 1.5.1
|
||||
resolution: "denque@npm:1.5.1"
|
||||
checksum: 4375ad19d5cea99f90effa82a8cecdaa10f4eb261fbcd7e47cd753ff2737f037aac8f7f4e031cc77f3966314c491c86a0d3b20c128aeee57f791b4662c45108e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"denque@npm:^2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "denque@npm:2.0.1"
|
||||
@@ -5949,28 +5942,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ioredis@npm:^4.28.5":
|
||||
version: 4.28.5
|
||||
resolution: "ioredis@npm:4.28.5"
|
||||
dependencies:
|
||||
cluster-key-slot: ^1.1.0
|
||||
debug: ^4.3.1
|
||||
denque: ^1.1.0
|
||||
lodash.defaults: ^4.2.0
|
||||
lodash.flatten: ^4.4.0
|
||||
lodash.isarguments: ^3.1.0
|
||||
p-map: ^2.1.0
|
||||
redis-commands: 1.7.0
|
||||
redis-errors: ^1.2.0
|
||||
redis-parser: ^3.0.0
|
||||
standard-as-callback: ^2.1.0
|
||||
checksum: a8793c3324cd69fa55b4baacbda118ce6724e574260157761276b31411dd3e168c75490f7155c6ce34d79e01488efa98e0cdb162991970fd56da7cbcdafb8fb8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ioredis@npm:^5.0.6":
|
||||
version: 5.1.0
|
||||
resolution: "ioredis@npm:5.1.0"
|
||||
"ioredis@npm:^5.2.0":
|
||||
version: 5.2.0
|
||||
resolution: "ioredis@npm:5.2.0"
|
||||
dependencies:
|
||||
"@ioredis/commands": ^1.1.1
|
||||
cluster-key-slot: ^1.1.0
|
||||
@@ -5981,7 +5955,7 @@ __metadata:
|
||||
redis-errors: ^1.2.0
|
||||
redis-parser: ^3.0.0
|
||||
standard-as-callback: ^2.1.0
|
||||
checksum: 7b1c137836ee136a634926df4ec68cc2393772a32ecda8e30dd305d7b9182af02d600456e661f96a6ceada17560ce7b6458948fd09b8adc277a1d287325777dd
|
||||
checksum: 37189fcd4bd834d66aabb28a754d97da9147a6162c16bd971647750dbb81cbe7d93f4c07a623efdc0fdcb61bca243678b864229ddbcc2b8692755d7be40a2227
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -7067,13 +7041,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash.flatten@npm:^4.4.0":
|
||||
version: 4.4.0
|
||||
resolution: "lodash.flatten@npm:4.4.0"
|
||||
checksum: 0ac34a393d4b795d4b7421153d27c13ae67e08786c9cbb60ff5b732210d46f833598eee3fb3844bb10070e8488efe390ea53bb567377e0cb47e9e630bf0811cb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash.includes@npm:^4.3.0":
|
||||
version: 4.3.0
|
||||
resolution: "lodash.includes@npm:4.3.0"
|
||||
@@ -8173,13 +8140,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"p-map@npm:^2.1.0":
|
||||
version: 2.1.0
|
||||
resolution: "p-map@npm:2.1.0"
|
||||
checksum: 9e3ad3c9f6d75a5b5661bcad78c91f3a63849189737cd75e4f1225bf9ac205194e5c44aac2ef6f09562b1facdb9bd1425584d7ac375bfaa17b3f1a142dab936d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"p-map@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "p-map@npm:4.0.0"
|
||||
@@ -8943,13 +8903,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"redis-commands@npm:1.7.0":
|
||||
version: 1.7.0
|
||||
resolution: "redis-commands@npm:1.7.0"
|
||||
checksum: d1ff7fbcb5e54768c77f731f1d49679d2a62c3899522c28addb4e2e5813aea8bcac3f22519d71d330224c3f2937f935dfc3d8dc65e90db0f5fe22dc2c1515aa7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"redis-errors@npm:^1.0.0, redis-errors@npm:^1.2.0":
|
||||
version: 1.2.0
|
||||
resolution: "redis-errors@npm:1.2.0"
|
||||
|
||||
Reference in New Issue
Block a user