mirror of
https://github.com/standardnotes/server
synced 2026-03-06 05:01:08 -05:00
Compare commits
83 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b1fc718a2 | ||
|
|
1708c3f8a0 | ||
|
|
352e02028d | ||
|
|
1bbb639c83 | ||
|
|
c14265f103 | ||
|
|
c030a6b3d8 | ||
|
|
af997ea658 | ||
|
|
efa4d7fc60 | ||
|
|
f714aaa0e9 | ||
|
|
aee6e60583 | ||
|
|
4e602687d5 | ||
|
|
d026152ac8 | ||
|
|
3f21a358d2 | ||
|
|
dc55e47c98 | ||
|
|
3b804e2321 | ||
|
|
b32f851a90 | ||
|
|
479d20e76f | ||
|
|
fae4553fc8 | ||
|
|
cb74b23e45 | ||
|
|
af8f12c33a | ||
|
|
a148c4d1f6 | ||
|
|
f7190c0c9c | ||
|
|
c00d7765a9 | ||
|
|
2b651d86e2 | ||
|
|
9be3517093 | ||
|
|
fcfedaf7e7 | ||
|
|
0b82794e9c | ||
|
|
2a52e398cb | ||
|
|
c31e882ad2 | ||
|
|
2f0903e0eb | ||
|
|
2396053bc1 | ||
|
|
17fd12305e | ||
|
|
425ea4374d | ||
|
|
c076c3c74a | ||
|
|
547cdfd8ec | ||
|
|
a0af8f0025 | ||
|
|
c970b1ea68 | ||
|
|
4d1e2dec26 | ||
|
|
108408a944 | ||
|
|
18d07d431f | ||
|
|
cbc024f67a | ||
|
|
55ec5970da | ||
|
|
58bdca6659 | ||
|
|
ef49b0d3f8 | ||
|
|
9cb691e5ad | ||
|
|
04d09582d4 | ||
|
|
8f90dc172b | ||
|
|
f759261919 | ||
|
|
2606f6d929 | ||
|
|
c288e5d8dc | ||
|
|
4b76d4b71e | ||
|
|
72310130d2 | ||
|
|
f9e51ef06e | ||
|
|
92a5eb0d98 | ||
|
|
77d2ea1a1f | ||
|
|
92f96ddb84 | ||
|
|
15a914e25e | ||
|
|
912a29d091 | ||
|
|
b2c32ce70e | ||
|
|
ed1a708c40 | ||
|
|
e905128d45 | ||
|
|
fd598f372a | ||
|
|
7a3946a9e2 | ||
|
|
cbdd2584d0 | ||
|
|
f3161c2712 | ||
|
|
148542dd5a | ||
|
|
d2b2c339f2 | ||
|
|
d2578c48f0 | ||
|
|
fecfd54728 | ||
|
|
17e4162d3e | ||
|
|
742209d773 | ||
|
|
1fa4b7cf27 | ||
|
|
5dc5507039 | ||
|
|
3035a20b9f | ||
|
|
04b3bb034f | ||
|
|
bf84be0136 | ||
|
|
890cf48749 | ||
|
|
2b3436c6ce | ||
|
|
4df8c3b2e5 | ||
|
|
25a2696c32 | ||
|
|
52f879f842 | ||
|
|
4f70fa156d | ||
|
|
38e77f04be |
4
.github/workflows/common-e2e.yml
vendored
4
.github/workflows/common-e2e.yml
vendored
@@ -115,6 +115,8 @@ jobs:
|
|||||||
echo "DB_TYPE=${{ matrix.db_type }}" >> packages/home-server/.env
|
echo "DB_TYPE=${{ matrix.db_type }}" >> packages/home-server/.env
|
||||||
echo "REDIS_URL=redis://cache" >> packages/home-server/.env
|
echo "REDIS_URL=redis://cache" >> packages/home-server/.env
|
||||||
echo "CACHE_TYPE=${{ matrix.cache_type }}" >> packages/home-server/.env
|
echo "CACHE_TYPE=${{ matrix.cache_type }}" >> packages/home-server/.env
|
||||||
|
echo "FILES_SERVER_URL=http://localhost:3123" >> packages/home-server/.env
|
||||||
|
echo "E2E_TESTING=true" >> packages/home-server/.env
|
||||||
|
|
||||||
- name: Run Server
|
- name: Run Server
|
||||||
run: nohup yarn workspace @standardnotes/home-server start &
|
run: nohup yarn workspace @standardnotes/home-server start &
|
||||||
@@ -125,4 +127,4 @@ jobs:
|
|||||||
run: for i in {1..30}; do curl -s http://localhost:3123/healthcheck && break || sleep 1; done
|
run: for i in {1..30}; do curl -s http://localhost:3123/healthcheck && break || sleep 1; done
|
||||||
|
|
||||||
- name: Run E2E Test Suite
|
- name: Run E2E Test Suite
|
||||||
run: yarn dlx mocha-headless-chrome --timeout 1200000 -f http://localhost:9001/mocha/test.html?skip_paid_features=true
|
run: yarn dlx mocha-headless-chrome --timeout 1200000 -f http://localhost:9001/mocha/test.html
|
||||||
|
|||||||
97
.pnp.cjs
generated
97
.pnp.cjs
generated
@@ -4560,17 +4560,16 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/api", [\
|
["@standardnotes/api", [\
|
||||||
["npm:1.26.10", {\
|
["npm:1.26.26", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.26.10-f6165cafd3-3c3561aec8.zip/node_modules/@standardnotes/api/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.26.26-4338a5fe92-db41aedfa3.zip/node_modules/@standardnotes/api/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/api", "npm:1.26.10"],\
|
["@standardnotes/api", "npm:1.26.26"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/encryption", "npm:1.21.38"],\
|
["@standardnotes/models", "npm:1.46.8"],\
|
||||||
["@standardnotes/models", "npm:1.45.5"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/utils", "npm:1.16.5"],\
|
["@standardnotes/utils", "npm:1.17.5"],\
|
||||||
["reflect-metadata", "npm:0.1.13"]\
|
["reflect-metadata", "npm:0.1.13"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
@@ -4635,17 +4634,17 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
||||||
["@simplewebauthn/server", "npm:7.2.0"],\
|
["@simplewebauthn/server", "npm:7.2.0"],\
|
||||||
["@simplewebauthn/typescript-types", "npm:7.0.0"],\
|
["@simplewebauthn/typescript-types", "npm:7.0.0"],\
|
||||||
["@standardnotes/api", "npm:1.26.10"],\
|
["@standardnotes/api", "npm:1.26.26"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/features", "npm:1.59.5"],\
|
["@standardnotes/features", "npm:1.59.7"],\
|
||||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/settings", "workspace:packages/settings"],\
|
["@standardnotes/settings", "workspace:packages/settings"],\
|
||||||
["@standardnotes/sncrypto-common", "npm:1.13.3"],\
|
["@standardnotes/sncrypto-common", "npm:1.13.4"],\
|
||||||
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
||||||
["@standardnotes/time", "workspace:packages/time"],\
|
["@standardnotes/time", "workspace:packages/time"],\
|
||||||
["@types/bcryptjs", "npm:2.4.2"],\
|
["@types/bcryptjs", "npm:2.4.2"],\
|
||||||
@@ -4781,21 +4780,6 @@ const RAW_RUNTIME_STATE =
|
|||||||
"linkType": "SOFT"\
|
"linkType": "SOFT"\
|
||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/encryption", [\
|
|
||||||
["npm:1.21.38", {\
|
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.21.38-d08c3d4766-1393840523.zip/node_modules/@standardnotes/encryption/",\
|
|
||||||
"packageDependencies": [\
|
|
||||||
["@standardnotes/encryption", "npm:1.21.38"],\
|
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
|
||||||
["@standardnotes/models", "npm:1.45.5"],\
|
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
|
||||||
["@standardnotes/sncrypto-common", "npm:1.13.3"],\
|
|
||||||
["@standardnotes/utils", "npm:1.16.5"],\
|
|
||||||
["reflect-metadata", "npm:0.1.13"]\
|
|
||||||
],\
|
|
||||||
"linkType": "HARD"\
|
|
||||||
}]\
|
|
||||||
]],\
|
|
||||||
["@standardnotes/event-store", [\
|
["@standardnotes/event-store", [\
|
||||||
["workspace:packages/event-store", {\
|
["workspace:packages/event-store", {\
|
||||||
"packageLocation": "./packages/event-store/",\
|
"packageLocation": "./packages/event-store/",\
|
||||||
@@ -4831,10 +4815,10 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/features", [\
|
["@standardnotes/features", [\
|
||||||
["npm:1.59.5", {\
|
["npm:1.59.7", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.59.5-83c83acde9-173b1f5d52.zip/node_modules/@standardnotes/features/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.59.7-27c3e5296e-1632d64cc1.zip/node_modules/@standardnotes/features/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/features", "npm:1.59.5"],\
|
["@standardnotes/features", "npm:1.59.7"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
@@ -4855,7 +4839,7 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/sncrypto-common", "npm:1.13.3"],\
|
["@standardnotes/sncrypto-common", "npm:1.13.4"],\
|
||||||
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
||||||
["@standardnotes/time", "workspace:packages/time"],\
|
["@standardnotes/time", "workspace:packages/time"],\
|
||||||
["@types/connect-busboy", "npm:1.0.0"],\
|
["@types/connect-busboy", "npm:1.0.0"],\
|
||||||
@@ -4935,14 +4919,16 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/models", [\
|
["@standardnotes/models", [\
|
||||||
["npm:1.45.5", {\
|
["npm:1.46.8", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.45.5-29326e959c-15f26c11b2.zip/node_modules/@standardnotes/models/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.46.8-bc0390832e-8404340f27.zip/node_modules/@standardnotes/models/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/models", "npm:1.45.5"],\
|
["@standardnotes/models", "npm:1.46.8"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/features", "npm:1.59.5"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/features", "npm:1.59.7"],\
|
||||||
["@standardnotes/utils", "npm:1.16.5"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
|
["@standardnotes/sncrypto-common", "npm:1.13.4"],\
|
||||||
|
["@standardnotes/utils", "npm:1.17.5"],\
|
||||||
["lodash", "npm:4.17.21"]\
|
["lodash", "npm:4.17.21"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
@@ -4967,12 +4953,12 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/responses", [\
|
["@standardnotes/responses", [\
|
||||||
["npm:1.13.24", {\
|
["npm:1.13.27", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.13.24-3b4167c7ea-3bcfee90f0.zip/node_modules/@standardnotes/responses/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.13.27-829dec3e6e-9bf55e5f02.zip/node_modules/@standardnotes/responses/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/features", "npm:1.59.5"],\
|
["@standardnotes/features", "npm:1.59.7"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["reflect-metadata", "npm:0.1.13"]\
|
["reflect-metadata", "npm:0.1.13"]\
|
||||||
],\
|
],\
|
||||||
@@ -4987,12 +4973,12 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@aws-sdk/client-s3", "npm:3.342.0"],\
|
["@aws-sdk/client-s3", "npm:3.342.0"],\
|
||||||
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
||||||
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
||||||
["@standardnotes/api", "npm:1.26.10"],\
|
["@standardnotes/api", "npm:1.26.26"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/time", "workspace:packages/time"],\
|
["@standardnotes/time", "workspace:packages/time"],\
|
||||||
["@types/cors", "npm:2.8.13"],\
|
["@types/cors", "npm:2.8.13"],\
|
||||||
@@ -5129,10 +5115,10 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/sncrypto-common", [\
|
["@standardnotes/sncrypto-common", [\
|
||||||
["npm:1.13.3", {\
|
["npm:1.13.4", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-sncrypto-common-npm-1.13.3-97ef3850ce-a73af90962.zip/node_modules/@standardnotes/sncrypto-common/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-sncrypto-common-npm-1.13.4-3186513fa6-48e0e207f2.zip/node_modules/@standardnotes/sncrypto-common/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/sncrypto-common", "npm:1.13.3"],\
|
["@standardnotes/sncrypto-common", "npm:1.13.4"],\
|
||||||
["reflect-metadata", "npm:0.1.13"]\
|
["reflect-metadata", "npm:0.1.13"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
@@ -5143,7 +5129,7 @@ const RAW_RUNTIME_STATE =
|
|||||||
"packageLocation": "./packages/sncrypto-node/",\
|
"packageLocation": "./packages/sncrypto-node/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
||||||
["@standardnotes/sncrypto-common", "npm:1.13.3"],\
|
["@standardnotes/sncrypto-common", "npm:1.13.4"],\
|
||||||
["@types/jest", "npm:29.5.2"],\
|
["@types/jest", "npm:29.5.2"],\
|
||||||
["@types/node", "npm:20.2.5"],\
|
["@types/node", "npm:20.2.5"],\
|
||||||
["@typescript-eslint/eslint-plugin", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:5.59.8"],\
|
["@typescript-eslint/eslint-plugin", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:5.59.8"],\
|
||||||
@@ -5171,14 +5157,15 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@aws-sdk/client-sns", "npm:3.342.0"],\
|
["@aws-sdk/client-sns", "npm:3.342.0"],\
|
||||||
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
||||||
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
||||||
["@standardnotes/api", "npm:1.26.10"],\
|
["@standardnotes/api", "npm:1.26.26"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/settings", "workspace:packages/settings"],\
|
["@standardnotes/settings", "workspace:packages/settings"],\
|
||||||
|
["@standardnotes/sncrypto-node", "workspace:packages/sncrypto-node"],\
|
||||||
["@standardnotes/time", "workspace:packages/time"],\
|
["@standardnotes/time", "workspace:packages/time"],\
|
||||||
["@types/cors", "npm:2.8.13"],\
|
["@types/cors", "npm:2.8.13"],\
|
||||||
["@types/dotenv", "npm:8.2.0"],\
|
["@types/dotenv", "npm:8.2.0"],\
|
||||||
@@ -5188,6 +5175,7 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@types/newrelic", "npm:9.14.0"],\
|
["@types/newrelic", "npm:9.14.0"],\
|
||||||
["@types/node", "npm:20.2.5"],\
|
["@types/node", "npm:20.2.5"],\
|
||||||
["@types/prettyjson", "npm:0.0.30"],\
|
["@types/prettyjson", "npm:0.0.30"],\
|
||||||
|
["@types/semver", "npm:7.5.0"],\
|
||||||
["@types/ua-parser-js", "npm:0.7.36"],\
|
["@types/ua-parser-js", "npm:0.7.36"],\
|
||||||
["@types/uuid", "npm:8.3.4"],\
|
["@types/uuid", "npm:8.3.4"],\
|
||||||
["@typescript-eslint/eslint-plugin", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:5.59.8"],\
|
["@typescript-eslint/eslint-plugin", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:5.59.8"],\
|
||||||
@@ -5210,6 +5198,7 @@ const RAW_RUNTIME_STATE =
|
|||||||
["prettier", "npm:2.8.8"],\
|
["prettier", "npm:2.8.8"],\
|
||||||
["prettyjson", "npm:1.2.5"],\
|
["prettyjson", "npm:1.2.5"],\
|
||||||
["reflect-metadata", "npm:0.1.13"],\
|
["reflect-metadata", "npm:0.1.13"],\
|
||||||
|
["semver", "npm:7.5.1"],\
|
||||||
["sqlite3", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:5.1.6"],\
|
["sqlite3", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:5.1.6"],\
|
||||||
["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\
|
["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\
|
||||||
["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16"],\
|
["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16"],\
|
||||||
@@ -5244,10 +5233,10 @@ const RAW_RUNTIME_STATE =
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@standardnotes/utils", [\
|
["@standardnotes/utils", [\
|
||||||
["npm:1.16.5", {\
|
["npm:1.17.5", {\
|
||||||
"packageLocation": "./.yarn/cache/@standardnotes-utils-npm-1.16.5-47f537f49f-d5caa7181f.zip/node_modules/@standardnotes/utils/",\
|
"packageLocation": "./.yarn/cache/@standardnotes-utils-npm-1.17.5-210b60222d-47e8520174.zip/node_modules/@standardnotes/utils/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@standardnotes/utils", "npm:1.16.5"],\
|
["@standardnotes/utils", "npm:1.17.5"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["dompurify", "npm:2.4.5"],\
|
["dompurify", "npm:2.4.5"],\
|
||||||
["lodash", "npm:4.17.21"],\
|
["lodash", "npm:4.17.21"],\
|
||||||
@@ -5263,14 +5252,14 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@standardnotes/websockets-server", "workspace:packages/websockets"],\
|
["@standardnotes/websockets-server", "workspace:packages/websockets"],\
|
||||||
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
["@aws-sdk/client-sqs", "npm:3.342.0"],\
|
||||||
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
["@newrelic/winston-enricher", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.0.1"],\
|
||||||
["@standardnotes/api", "npm:1.26.10"],\
|
["@standardnotes/api", "npm:1.26.26"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/responses", "npm:1.13.24"],\
|
["@standardnotes/responses", "npm:1.13.27"],\
|
||||||
["@standardnotes/security", "workspace:packages/security"],\
|
["@standardnotes/security", "workspace:packages/security"],\
|
||||||
["@standardnotes/utils", "npm:1.16.5"],\
|
["@standardnotes/utils", "npm:1.17.5"],\
|
||||||
["@types/cors", "npm:2.8.13"],\
|
["@types/cors", "npm:2.8.13"],\
|
||||||
["@types/express", "npm:4.17.17"],\
|
["@types/express", "npm:4.17.17"],\
|
||||||
["@types/ioredis", "npm:5.0.0"],\
|
["@types/ioredis", "npm:5.0.0"],\
|
||||||
|
|||||||
Binary file not shown.
BIN
.yarn/cache/@standardnotes-api-npm-1.26.26-4338a5fe92-db41aedfa3.zip
vendored
Normal file
BIN
.yarn/cache/@standardnotes-api-npm-1.26.26-4338a5fe92-db41aedfa3.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@standardnotes-models-npm-1.46.8-bc0390832e-8404340f27.zip
vendored
Normal file
BIN
.yarn/cache/@standardnotes-models-npm-1.46.8-bc0390832e-8404340f27.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@standardnotes-responses-npm-1.13.27-829dec3e6e-9bf55e5f02.zip
vendored
Normal file
BIN
.yarn/cache/@standardnotes-responses-npm-1.13.27-829dec3e6e-9bf55e5f02.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.25.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.25.2...@standardnotes/analytics@2.25.3) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.25.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.25.1...@standardnotes/analytics@2.25.2) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.25.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.25.0...@standardnotes/analytics@2.25.1) (2023-07-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
# [2.25.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.9...@standardnotes/analytics@2.25.0) (2023-07-17)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** refactor syncing to decouple getting and saving items ([#659](https://github.com/standardnotes/server/issues/659)) ([cb74b23](https://github.com/standardnotes/server/commit/cb74b23e45b207136e299ce8a3db2c04dc87e21e))
|
||||||
|
|
||||||
|
## [2.24.9](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.8...@standardnotes/analytics@2.24.9) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.24.8](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.7...@standardnotes/analytics@2.24.8) (2023-07-07)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.24.7](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.6...@standardnotes/analytics@2.24.7) (2023-07-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.24.6](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.5...@standardnotes/analytics@2.24.6) (2023-07-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.24.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.4...@standardnotes/analytics@2.24.5) (2023-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
## [2.24.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.3...@standardnotes/analytics@2.24.4) (2023-06-30)
|
## [2.24.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.24.3...@standardnotes/analytics@2.24.4) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/analytics
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/analytics",
|
"name": "@standardnotes/analytics",
|
||||||
"version": "2.24.4",
|
"version": "2.25.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Result, Entity, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { StatisticMeasureProps } from './StatisticMeasureProps'
|
import { StatisticMeasureProps } from './StatisticMeasureProps'
|
||||||
|
|
||||||
export class StatisticMeasure extends Entity<StatisticMeasureProps> {
|
export class StatisticMeasure extends Entity<StatisticMeasureProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return this.props.name.value
|
return this.props.name.value
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { SubscriptionProps } from './SubscriptionProps'
|
import { SubscriptionProps } from './SubscriptionProps'
|
||||||
|
|
||||||
export class Subscription extends Entity<SubscriptionProps> {
|
export class Subscription extends Entity<SubscriptionProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: SubscriptionProps, id?: UniqueEntityId) {
|
private constructor(props: SubscriptionProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { UserProps } from './UserProps'
|
import { UserProps } from './UserProps'
|
||||||
|
|
||||||
export class User extends Entity<UserProps> {
|
export class User extends Entity<UserProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: UserProps, id?: UniqueEntityId) {
|
private constructor(props: UserProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,56 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.67.2](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.67.1...@standardnotes/api-gateway@1.67.2) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.67.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.67.0...@standardnotes/api-gateway@1.67.1) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
# [1.67.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.66.1...@standardnotes/api-gateway@1.67.0) (2023-07-20)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add shared vaults, invites, messages and notifications to sync response ([#665](https://github.com/standardnotes/api-gateway/issues/665)) ([efa4d7f](https://github.com/standardnotes/api-gateway/commit/efa4d7fc6007ef668e3de3b04853ac11b2d13c30))
|
||||||
|
|
||||||
|
## [1.66.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.66.0...@standardnotes/api-gateway@1.66.1) (2023-07-19)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add missing imports and exports for controllers ([#664](https://github.com/standardnotes/api-gateway/issues/664)) ([aee6e60](https://github.com/standardnotes/api-gateway/commit/aee6e6058359e2b5231cc13387656f837699300f))
|
||||||
|
|
||||||
|
# [1.66.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.7...@standardnotes/api-gateway@1.66.0) (2023-07-19)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add persistence of shared vaults with users and invites + controllers ([#662](https://github.com/standardnotes/api-gateway/issues/662)) ([3f21a35](https://github.com/standardnotes/api-gateway/commit/3f21a358d24d70daf541aa62dc86cd9e29500e62))
|
||||||
|
|
||||||
|
## [1.65.7](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.6...@standardnotes/api-gateway@1.65.7) (2023-07-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.65.6](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.5...@standardnotes/api-gateway@1.65.6) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.65.5](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.4...@standardnotes/api-gateway@1.65.5) (2023-07-07)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.65.4](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.3...@standardnotes/api-gateway@1.65.4) (2023-07-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.65.3](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.2...@standardnotes/api-gateway@1.65.3) (2023-07-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.65.2](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.1...@standardnotes/api-gateway@1.65.2) (2023-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
## [1.65.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.0...@standardnotes/api-gateway@1.65.1) (2023-06-30)
|
## [1.65.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.65.0...@standardnotes/api-gateway@1.65.1) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import '../src/Controller/v1/OfflineController'
|
|||||||
import '../src/Controller/v1/FilesController'
|
import '../src/Controller/v1/FilesController'
|
||||||
import '../src/Controller/v1/SubscriptionInvitesController'
|
import '../src/Controller/v1/SubscriptionInvitesController'
|
||||||
import '../src/Controller/v1/AuthenticatorsController'
|
import '../src/Controller/v1/AuthenticatorsController'
|
||||||
import '../src/Controller/v1/AsymmetricMessagesController'
|
import '../src/Controller/v1/MessagesController'
|
||||||
import '../src/Controller/v1/SharedVaultsController'
|
import '../src/Controller/v1/SharedVaultsController'
|
||||||
|
import '../src/Controller/v1/SharedVaultInvitesController'
|
||||||
|
import '../src/Controller/v1/SharedVaultUsersController'
|
||||||
|
|
||||||
import '../src/Controller/v2/PaymentsControllerV2'
|
import '../src/Controller/v2/PaymentsControllerV2'
|
||||||
import '../src/Controller/v2/ActionsControllerV2'
|
import '../src/Controller/v2/ActionsControllerV2'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/api-gateway",
|
"name": "@standardnotes/api-gateway",
|
||||||
"version": "1.65.1",
|
"version": "1.67.2",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export * from './SubscriptionTokenAuthMiddleware'
|
|||||||
export * from './TokenAuthenticationMethod'
|
export * from './TokenAuthenticationMethod'
|
||||||
export * from './WebSocketAuthMiddleware'
|
export * from './WebSocketAuthMiddleware'
|
||||||
export * from './v1/ActionsController'
|
export * from './v1/ActionsController'
|
||||||
export * from './v1/AsymmetricMessagesController'
|
export * from './v1/MessagesController'
|
||||||
export * from './v1/AuthenticatorsController'
|
export * from './v1/AuthenticatorsController'
|
||||||
export * from './v1/FilesController'
|
export * from './v1/FilesController'
|
||||||
export * from './v1/InvoicesController'
|
export * from './v1/InvoicesController'
|
||||||
@@ -13,6 +13,8 @@ export * from './v1/OfflineController'
|
|||||||
export * from './v1/PaymentsController'
|
export * from './v1/PaymentsController'
|
||||||
export * from './v1/RevisionsController'
|
export * from './v1/RevisionsController'
|
||||||
export * from './v1/SessionsController'
|
export * from './v1/SessionsController'
|
||||||
|
export * from './v1/SharedVaultInvitesController'
|
||||||
|
export * from './v1/SharedVaultUsersController'
|
||||||
export * from './v1/SharedVaultsController'
|
export * from './v1/SharedVaultsController'
|
||||||
export * from './v1/SubscriptionInvitesController'
|
export * from './v1/SubscriptionInvitesController'
|
||||||
export * from './v1/TokensController'
|
export * from './v1/TokensController'
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { Request, Response } from 'express'
|
|
||||||
import { inject } from 'inversify'
|
|
||||||
import { BaseHttpController, controller, all } from 'inversify-express-utils'
|
|
||||||
import { TYPES } from '../../Bootstrap/Types'
|
|
||||||
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
|
||||||
|
|
||||||
@controller('/v1/asymmetric-messages')
|
|
||||||
export class AsymmetricMessagesController extends BaseHttpController {
|
|
||||||
constructor(@inject(TYPES.ServiceProxy) private serviceProxy: ServiceProxyInterface) {
|
|
||||||
super()
|
|
||||||
}
|
|
||||||
|
|
||||||
@all('*', TYPES.RequiredCrossServiceTokenMiddleware)
|
|
||||||
async subscriptions(request: Request, response: Response): Promise<void> {
|
|
||||||
await this.serviceProxy.callSyncingServer(request, response, request.path.replace('/v1/', ''), request.body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
70
packages/api-gateway/src/Controller/v1/MessagesController.ts
Normal file
70
packages/api-gateway/src/Controller/v1/MessagesController.ts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
|
import { inject } from 'inversify'
|
||||||
|
import { BaseHttpController, controller, httpDelete, httpGet, httpPost } from 'inversify-express-utils'
|
||||||
|
import { TYPES } from '../../Bootstrap/Types'
|
||||||
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
||||||
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
||||||
|
|
||||||
|
@controller('/v1/messages', TYPES.RequiredCrossServiceTokenMiddleware)
|
||||||
|
export class MessagesController extends BaseHttpController {
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.ServiceProxy) private httpService: ServiceProxyInterface,
|
||||||
|
@inject(TYPES.EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
||||||
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/')
|
||||||
|
async getMessages(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('GET', 'messages/'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/outbound')
|
||||||
|
async getMessagesSent(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('GET', 'messages/outbound'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/')
|
||||||
|
async sendMessage(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('POST', 'messages/'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/inbound')
|
||||||
|
async deleteMessagesSentToUser(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('DELETE', 'messages/inbound'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/:messageUuid')
|
||||||
|
async deleteMessage(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'DELETE',
|
||||||
|
'messages/:messageUuid',
|
||||||
|
request.params.messageUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
|
import { inject } from 'inversify'
|
||||||
|
import { BaseHttpController, controller, httpDelete, httpGet, httpPatch, httpPost } from 'inversify-express-utils'
|
||||||
|
import { TYPES } from '../../Bootstrap/Types'
|
||||||
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
||||||
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
||||||
|
|
||||||
|
@controller('/v1/shared-vaults', TYPES.RequiredCrossServiceTokenMiddleware)
|
||||||
|
export class SharedVaultInvitesController extends BaseHttpController {
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.ServiceProxy) private httpService: ServiceProxyInterface,
|
||||||
|
@inject(TYPES.EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
||||||
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/:sharedVaultUuid/invites')
|
||||||
|
async createSharedVaultInvite(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'POST',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPatch('/:sharedVaultUuid/invites/:inviteUuid')
|
||||||
|
async updateSharedVaultInvite(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'PATCH',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites/:inviteUuid',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
request.params.inviteUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/:sharedVaultUuid/invites/:inviteUuid/accept')
|
||||||
|
async acceptSharedVaultInvite(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'POST',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites/:inviteUuid/accept',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
request.params.inviteUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/:sharedVaultUuid/invites/:inviteUuid/decline')
|
||||||
|
async declineSharedVaultInvite(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'POST',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites/:inviteUuid/decline',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
request.params.inviteUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/invites/inbound')
|
||||||
|
async deleteInboundUserInvites(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('DELETE', 'shared-vaults/invites/inbound'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/invites/outbound')
|
||||||
|
async getOutboundUserInvites(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('GET', 'shared-vaults/invites/outbound'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/invites')
|
||||||
|
async getUserInvites(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('GET', 'shared-vaults/invites'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/:sharedVaultUuid/invites')
|
||||||
|
async getSharedVaultInvites(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'GET',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/:sharedVaultUuid/invites/:inviteUuid')
|
||||||
|
async deleteSharedVaultInvite(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'DELETE',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites/:inviteUuid',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
request.params.inviteUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/:sharedVaultUuid/invites')
|
||||||
|
async deleteAllSharedVaultInvites(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'DELETE',
|
||||||
|
'shared-vaults/:sharedVaultUuid/invites',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
|
import { inject } from 'inversify'
|
||||||
|
import { BaseHttpController, controller, httpDelete, httpGet } from 'inversify-express-utils'
|
||||||
|
import { TYPES } from '../../Bootstrap/Types'
|
||||||
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
||||||
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
||||||
|
|
||||||
|
@controller('/v1/shared-vaults/:sharedVaultUuid/users', TYPES.RequiredCrossServiceTokenMiddleware)
|
||||||
|
export class SharedVaultUsersController extends BaseHttpController {
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.ServiceProxy) private httpService: ServiceProxyInterface,
|
||||||
|
@inject(TYPES.EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
||||||
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpGet('/')
|
||||||
|
async getSharedVaultUsers(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'GET',
|
||||||
|
'shared-vaults/:sharedVaultUuid/users',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/:userUuid')
|
||||||
|
async removeUserFromSharedVault(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'DELETE',
|
||||||
|
'shared-vaults/:sharedVaultUuid/users/:userUuid',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
request.params.userUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,64 @@
|
|||||||
import { Request, Response } from 'express'
|
import { Request, Response } from 'express'
|
||||||
import { inject } from 'inversify'
|
import { inject } from 'inversify'
|
||||||
import { BaseHttpController, controller, all } from 'inversify-express-utils'
|
import { BaseHttpController, controller, httpDelete, httpGet, httpPost } from 'inversify-express-utils'
|
||||||
import { TYPES } from '../../Bootstrap/Types'
|
import { TYPES } from '../../Bootstrap/Types'
|
||||||
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
||||||
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
||||||
|
|
||||||
@controller('/v1/shared-vaults')
|
@controller('/v1/shared-vaults', TYPES.RequiredCrossServiceTokenMiddleware)
|
||||||
export class SharedVaultsController extends BaseHttpController {
|
export class SharedVaultsController extends BaseHttpController {
|
||||||
constructor(@inject(TYPES.ServiceProxy) private serviceProxy: ServiceProxyInterface) {
|
constructor(
|
||||||
|
@inject(TYPES.ServiceProxy) private httpService: ServiceProxyInterface,
|
||||||
|
@inject(TYPES.EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
||||||
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
@all('*', TYPES.RequiredCrossServiceTokenMiddleware)
|
@httpGet('/')
|
||||||
async subscriptions(request: Request, response: Response): Promise<void> {
|
async getSharedVaults(request: Request, response: Response): Promise<void> {
|
||||||
await this.serviceProxy.callSyncingServer(request, response, request.path.replace('/v1/', ''), request.body)
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('GET', 'shared-vaults/'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/')
|
||||||
|
async createSharedVault(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('POST', 'shared-vaults/'),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpDelete('/:sharedVaultUuid')
|
||||||
|
async deleteSharedVault(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'DELETE',
|
||||||
|
'shared-vaults/:sharedVaultUuid',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@httpPost('/:sharedVaultUuid/valet-tokens')
|
||||||
|
async createValetTokenForSharedVaultFile(request: Request, response: Response): Promise<void> {
|
||||||
|
await this.httpService.callSyncingServer(
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
||||||
|
'POST',
|
||||||
|
'shared-vaults/:sharedVaultUuid/valet-tokens',
|
||||||
|
request.params.sharedVaultUuid,
|
||||||
|
),
|
||||||
|
request.body,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,31 @@ export class EndpointResolver implements EndpointResolverInterface {
|
|||||||
['[GET]:items/:itemUuid/revisions', 'revisions.revisions.getRevisions'],
|
['[GET]:items/:itemUuid/revisions', 'revisions.revisions.getRevisions'],
|
||||||
['[GET]:items/:itemUuid/revisions/:id', 'revisions.revisions.getRevision'],
|
['[GET]:items/:itemUuid/revisions/:id', 'revisions.revisions.getRevision'],
|
||||||
['[DELETE]:items/:itemUuid/revisions/:id', 'revisions.revisions.deleteRevision'],
|
['[DELETE]:items/:itemUuid/revisions/:id', 'revisions.revisions.deleteRevision'],
|
||||||
|
// Messages Controller
|
||||||
|
['[GET]:messages/', 'sync.messages.get-received'],
|
||||||
|
['[GET]:messages/outbound', 'sync.messages.get-sent'],
|
||||||
|
['[POST]:messages/', 'sync.messages.send'],
|
||||||
|
['[DELETE]:messages/inbound', 'sync.messages.delete-all'],
|
||||||
|
['[DELETE]:messages/:messageUuid', 'sync.messages.delete'],
|
||||||
|
// Shared Vaults Controller
|
||||||
|
['[GET]:shared-vaults/', 'sync.shared-vaults.get-vaults'],
|
||||||
|
['[POST]:shared-vaults/', 'sync.shared-vaults.create-vault'],
|
||||||
|
['[DELETE]:shared-vaults/:sharedVaultUuid', 'sync.shared-vaults.delete-vault'],
|
||||||
|
['[POST]:shared-vaults/:sharedVaultUuid/valet-tokens', 'sync.shared-vaults.create-file-valet-token'],
|
||||||
|
// Shared Vault Invites Controller
|
||||||
|
['[POST]:shared-vaults/:sharedVaultUuid/invites', 'sync.shared-vault-invites.create'],
|
||||||
|
['[PATCH]:shared-vaults/:sharedVaultUuid/invites/:inviteUuid', 'sync.shared-vault-invites.update'],
|
||||||
|
['[POST]:shared-vaults/:sharedVaultUuid/invites/:inviteUuid/accept', 'sync.shared-vault-invites.accept'],
|
||||||
|
['[POST]:shared-vaults/:sharedVaultUuid/invites/:inviteUuid/decline', 'sync.shared-vault-invites.decline'],
|
||||||
|
['[DELETE]:shared-vaults/invites/inbound', 'sync.shared-vault-invites.delete-inbound'],
|
||||||
|
['[GET]:shared-vaults/invites/outbound', 'sync.shared-vault-invites.get-outbound'],
|
||||||
|
['[GET]:shared-vaults/invites', 'sync.shared-vault-invites.get-user-invites'],
|
||||||
|
['[GET]:shared-vaults/:sharedVaultUuid/invites', 'sync.shared-vault-invites.get-vault-invites'],
|
||||||
|
['[DELETE]:shared-vaults/:sharedVaultUuid/invites/:inviteUuid', 'sync.shared-vault-invites.delete-invite'],
|
||||||
|
['[DELETE]:shared-vaults/:sharedVaultUuid/invites', 'sync.shared-vault-invites.delete-all'],
|
||||||
|
// Shared Vault Users Controller
|
||||||
|
['[GET]:shared-vaults/:sharedVaultUuid/users', 'sync.shared-vault-users.get-users'],
|
||||||
|
['[DELETE]:shared-vaults/:sharedVaultUuid/users/:userUuid', 'sync.shared-vault-users.remove-user'],
|
||||||
])
|
])
|
||||||
|
|
||||||
resolveEndpointOrMethodIdentifier(method: string, endpoint: string, ...params: string[]): string {
|
resolveEndpointOrMethodIdentifier(method: string, endpoint: string, ...params: string[]): string {
|
||||||
@@ -75,7 +100,7 @@ export class EndpointResolver implements EndpointResolverInterface {
|
|||||||
const identifier = this.endpointToIdentifierMap.get(`[${method}]:${endpoint}`)
|
const identifier = this.endpointToIdentifierMap.get(`[${method}]:${endpoint}`)
|
||||||
|
|
||||||
if (!identifier) {
|
if (!identifier) {
|
||||||
throw new Error(`Endpoint ${endpoint} not found`)
|
throw new Error(`Endpoint [${method}]:${endpoint} not found`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return identifier
|
return identifier
|
||||||
|
|||||||
@@ -3,6 +3,88 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.126.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.126.1...@standardnotes/auth-server@1.126.2) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.126.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.126.0...@standardnotes/auth-server@1.126.1) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
# [1.126.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.125.1...@standardnotes/auth-server@1.126.0) (2023-07-20)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add shared vaults, invites, messages and notifications to sync response ([#665](https://github.com/standardnotes/server/issues/665)) ([efa4d7f](https://github.com/standardnotes/server/commit/efa4d7fc6007ef668e3de3b04853ac11b2d13c30))
|
||||||
|
|
||||||
|
## [1.125.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.125.0...@standardnotes/auth-server@1.125.1) (2023-07-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
# [1.125.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.124.2...@standardnotes/auth-server@1.125.0) (2023-07-17)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** refactor syncing to decouple getting and saving items ([#659](https://github.com/standardnotes/server/issues/659)) ([cb74b23](https://github.com/standardnotes/server/commit/cb74b23e45b207136e299ce8a3db2c04dc87e21e))
|
||||||
|
|
||||||
|
## [1.124.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.124.1...@standardnotes/auth-server@1.124.2) (2023-07-14)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **home-server:** allow custom atributtes for activating premium features ([f7190c0](https://github.com/standardnotes/server/commit/f7190c0c9c2d105f97d1cf980ce6a4f0dae34805))
|
||||||
|
|
||||||
|
## [1.124.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.124.0...@standardnotes/auth-server@1.124.1) (2023-07-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **files:** handling unlimited storage quota on home server ([9be3517](https://github.com/standardnotes/server/commit/9be3517093f8dd7bbdd7507c1e2ff059e6c9a889))
|
||||||
|
|
||||||
|
# [1.124.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.123.2...@standardnotes/auth-server@1.124.0) (2023-07-13)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **auth:** add overriding subscription settings on home server ([#656](https://github.com/standardnotes/server/issues/656)) ([0b82794](https://github.com/standardnotes/server/commit/0b82794e9c7ed82cfc08a92eafc016fbde5c4fcc))
|
||||||
|
|
||||||
|
## [1.123.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.123.1...@standardnotes/auth-server@1.123.2) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.123.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.123.0...@standardnotes/auth-server@1.123.1) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
# [1.123.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.122.2...@standardnotes/auth-server@1.123.0) (2023-07-12)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* domain items ([#655](https://github.com/standardnotes/server/issues/655)) ([a0af8f0](https://github.com/standardnotes/server/commit/a0af8f00252e1219e58cb7e066c11a8e71692e9d))
|
||||||
|
|
||||||
|
## [1.122.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.122.1...@standardnotes/auth-server@1.122.2) (2023-07-07)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* transfer notifications from auth to syncing-server. ([#648](https://github.com/standardnotes/server/issues/648)) ([c288e5d](https://github.com/standardnotes/server/commit/c288e5d8dc54778a96a9fc33e3c9cae00583fade))
|
||||||
|
|
||||||
|
## [1.122.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.122.0...@standardnotes/auth-server@1.122.1) (2023-07-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
# [1.122.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.121.0...@standardnotes/auth-server@1.122.0) (2023-07-05)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* deleting shared vaults. ([#640](https://github.com/standardnotes/server/issues/640)) ([f3161c2](https://github.com/standardnotes/server/commit/f3161c271296159331639814b2dbb2e566cc54c9))
|
||||||
|
|
||||||
|
# [1.121.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.120.2...@standardnotes/auth-server@1.121.0) (2023-07-05)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **auth:** add notifications model ([#638](https://github.com/standardnotes/server/issues/638)) ([fecfd54](https://github.com/standardnotes/server/commit/fecfd5472824b5adae708db95d351e4ad65ee87b))
|
||||||
|
|
||||||
|
## [1.120.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.120.1...@standardnotes/auth-server@1.120.2) (2023-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
## [1.120.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.120.0...@standardnotes/auth-server@1.120.1) (2023-06-30)
|
## [1.120.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.120.0...@standardnotes/auth-server@1.120.1) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/auth-server
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|||||||
BIN
packages/auth/database.sqlite
Normal file
BIN
packages/auth/database.sqlite
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.120.1",
|
"version": "1.126.2",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
@@ -42,17 +42,17 @@
|
|||||||
"@cbor-extract/cbor-extract-linux-x64": "^2.1.1",
|
"@cbor-extract/cbor-extract-linux-x64": "^2.1.1",
|
||||||
"@simplewebauthn/server": "^7.2.0",
|
"@simplewebauthn/server": "^7.2.0",
|
||||||
"@simplewebauthn/typescript-types": "^7.0.0",
|
"@simplewebauthn/typescript-types": "^7.0.0",
|
||||||
"@standardnotes/api": "^1.25.3",
|
"@standardnotes/api": "^1.26.26",
|
||||||
"@standardnotes/common": "workspace:*",
|
"@standardnotes/common": "workspace:*",
|
||||||
"@standardnotes/domain-core": "workspace:^",
|
"@standardnotes/domain-core": "workspace:^",
|
||||||
"@standardnotes/domain-events": "workspace:*",
|
"@standardnotes/domain-events": "workspace:*",
|
||||||
"@standardnotes/domain-events-infra": "workspace:*",
|
"@standardnotes/domain-events-infra": "workspace:*",
|
||||||
"@standardnotes/features": "^1.58.12",
|
"@standardnotes/features": "^1.59.7",
|
||||||
"@standardnotes/predicates": "workspace:*",
|
"@standardnotes/predicates": "workspace:*",
|
||||||
"@standardnotes/responses": "^1.13.9",
|
"@standardnotes/responses": "^1.13.27",
|
||||||
"@standardnotes/security": "workspace:*",
|
"@standardnotes/security": "workspace:*",
|
||||||
"@standardnotes/settings": "workspace:*",
|
"@standardnotes/settings": "workspace:*",
|
||||||
"@standardnotes/sncrypto-common": "^1.9.0",
|
"@standardnotes/sncrypto-common": "^1.13.4",
|
||||||
"@standardnotes/sncrypto-node": "workspace:*",
|
"@standardnotes/sncrypto-node": "workspace:*",
|
||||||
"@standardnotes/time": "workspace:*",
|
"@standardnotes/time": "workspace:*",
|
||||||
"axios": "^1.1.3",
|
"axios": "^1.1.3",
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { Result, ServiceInterface } from '@standardnotes/domain-core'
|
import { Result, ServiceInterface } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
export interface AuthServiceInterface extends ServiceInterface {
|
export interface AuthServiceInterface extends ServiceInterface {
|
||||||
activatePremiumFeatures(username: string): Promise<Result<string>>
|
activatePremiumFeatures(dto: {
|
||||||
|
username: string
|
||||||
|
subscriptionPlanName?: string
|
||||||
|
endsAt?: Date
|
||||||
|
}): Promise<Result<string>>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -793,6 +793,7 @@ export class ContainerConfigLoader {
|
|||||||
new ActivatePremiumFeatures(
|
new ActivatePremiumFeatures(
|
||||||
container.get(TYPES.Auth_UserRepository),
|
container.get(TYPES.Auth_UserRepository),
|
||||||
container.get(TYPES.Auth_UserSubscriptionRepository),
|
container.get(TYPES.Auth_UserSubscriptionRepository),
|
||||||
|
container.get(TYPES.Auth_SubscriptionSettingService),
|
||||||
container.get(TYPES.Auth_RoleService),
|
container.get(TYPES.Auth_RoleService),
|
||||||
container.get(TYPES.Auth_Timer),
|
container.get(TYPES.Auth_Timer),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -20,19 +20,23 @@ import { Env } from './Env'
|
|||||||
import { SqliteConnectionOptions } from 'typeorm/driver/sqlite/SqliteConnectionOptions'
|
import { SqliteConnectionOptions } from 'typeorm/driver/sqlite/SqliteConnectionOptions'
|
||||||
|
|
||||||
export class AppDataSource {
|
export class AppDataSource {
|
||||||
private dataSource: DataSource | undefined
|
private _dataSource: DataSource | undefined
|
||||||
|
|
||||||
constructor(private env: Env) {}
|
constructor(private env: Env) {}
|
||||||
|
|
||||||
getRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): Repository<Entity> {
|
getRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): Repository<Entity> {
|
||||||
if (!this.dataSource) {
|
if (!this._dataSource) {
|
||||||
throw new Error('DataSource not initialized')
|
throw new Error('DataSource not initialized')
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.dataSource.getRepository(target)
|
return this._dataSource.getRepository(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize(): Promise<void> {
|
async initialize(): Promise<void> {
|
||||||
|
await this.dataSource.initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
get dataSource(): DataSource {
|
||||||
this.env.load()
|
this.env.load()
|
||||||
|
|
||||||
const isConfiguredForMySQL = this.env.get('DB_TYPE') === 'mysql'
|
const isConfiguredForMySQL = this.env.get('DB_TYPE') === 'mysql'
|
||||||
@@ -104,7 +108,7 @@ export class AppDataSource {
|
|||||||
database: inReplicaMode ? undefined : this.env.get('DB_DATABASE'),
|
database: inReplicaMode ? undefined : this.env.get('DB_DATABASE'),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataSource = new DataSource(mySQLDataSourceOptions)
|
this._dataSource = new DataSource(mySQLDataSourceOptions)
|
||||||
} else {
|
} else {
|
||||||
const sqliteDataSourceOptions: SqliteConnectionOptions = {
|
const sqliteDataSourceOptions: SqliteConnectionOptions = {
|
||||||
...commonDataSourceOptions,
|
...commonDataSourceOptions,
|
||||||
@@ -112,9 +116,9 @@ export class AppDataSource {
|
|||||||
database: this.env.get('DB_SQLITE_DATABASE_PATH'),
|
database: this.env.get('DB_SQLITE_DATABASE_PATH'),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataSource = new DataSource(sqliteDataSourceOptions)
|
this._dataSource = new DataSource(sqliteDataSourceOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.dataSource.initialize()
|
return this._dataSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
packages/auth/src/Bootstrap/MigrationsDataSource.ts
Normal file
7
packages/auth/src/Bootstrap/MigrationsDataSource.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { AppDataSource } from './DataSource'
|
||||||
|
import { Env } from './Env'
|
||||||
|
|
||||||
|
const env: Env = new Env()
|
||||||
|
env.load()
|
||||||
|
|
||||||
|
export const MigrationsDataSource = new AppDataSource(env).dataSource
|
||||||
@@ -24,14 +24,18 @@ export class Service implements AuthServiceInterface {
|
|||||||
this.serviceContainer.register(this.getId(), this)
|
this.serviceContainer.register(this.getId(), this)
|
||||||
}
|
}
|
||||||
|
|
||||||
async activatePremiumFeatures(username: string): Promise<Result<string>> {
|
async activatePremiumFeatures(dto: {
|
||||||
|
username: string
|
||||||
|
subscriptionPlanName?: string
|
||||||
|
endsAt?: Date
|
||||||
|
}): Promise<Result<string>> {
|
||||||
if (!this.container) {
|
if (!this.container) {
|
||||||
return Result.fail('Container not initialized')
|
return Result.fail('Container not initialized')
|
||||||
}
|
}
|
||||||
|
|
||||||
const activatePremiumFeatures = this.container.get(TYPES.Auth_ActivatePremiumFeatures) as ActivatePremiumFeatures
|
const activatePremiumFeatures = this.container.get(TYPES.Auth_ActivatePremiumFeatures) as ActivatePremiumFeatures
|
||||||
|
|
||||||
return activatePremiumFeatures.execute({ username })
|
return activatePremiumFeatures.execute(dto)
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown> {
|
async handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown> {
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import { User } from '../Domain/User/User'
|
|||||||
import { Register } from '../Domain/UseCase/Register'
|
import { Register } from '../Domain/UseCase/Register'
|
||||||
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||||
import { KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
import { KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||||
import { ApiVersion } from '@standardnotes/api'
|
|
||||||
import { SignInWithRecoveryCodes } from '../Domain/UseCase/SignInWithRecoveryCodes/SignInWithRecoveryCodes'
|
import { SignInWithRecoveryCodes } from '../Domain/UseCase/SignInWithRecoveryCodes/SignInWithRecoveryCodes'
|
||||||
import { GetUserKeyParamsRecovery } from '../Domain/UseCase/GetUserKeyParamsRecovery/GetUserKeyParamsRecovery'
|
import { GetUserKeyParamsRecovery } from '../Domain/UseCase/GetUserKeyParamsRecovery/GetUserKeyParamsRecovery'
|
||||||
import { GenerateRecoveryCodes } from '../Domain/UseCase/GenerateRecoveryCodes/GenerateRecoveryCodes'
|
import { GenerateRecoveryCodes } from '../Domain/UseCase/GenerateRecoveryCodes/GenerateRecoveryCodes'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { SessionServiceInterface } from '../Domain/Session/SessionServiceInterface'
|
import { SessionServiceInterface } from '../Domain/Session/SessionServiceInterface'
|
||||||
|
import { ApiVersion } from '../Domain/Api/ApiVersion'
|
||||||
|
|
||||||
describe('AuthController', () => {
|
describe('AuthController', () => {
|
||||||
let clearLoginAttempts: ClearLoginAttempts
|
let clearLoginAttempts: ClearLoginAttempts
|
||||||
@@ -73,7 +73,7 @@ describe('AuthController', () => {
|
|||||||
email: 'test@test.te',
|
email: 'test@test.te',
|
||||||
password: 'asdzxc',
|
password: 'asdzxc',
|
||||||
version: ProtocolVersion.V004,
|
version: ProtocolVersion.V004,
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
origination: KeyParamsOrigination.Registration,
|
origination: KeyParamsOrigination.Registration,
|
||||||
userAgent: 'Google Chrome',
|
userAgent: 'Google Chrome',
|
||||||
identifier: 'test@test.te',
|
identifier: 'test@test.te',
|
||||||
@@ -103,7 +103,7 @@ describe('AuthController', () => {
|
|||||||
email: 'test@test.te',
|
email: 'test@test.te',
|
||||||
password: '',
|
password: '',
|
||||||
version: ProtocolVersion.V004,
|
version: ProtocolVersion.V004,
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
origination: KeyParamsOrigination.Registration,
|
origination: KeyParamsOrigination.Registration,
|
||||||
userAgent: 'Google Chrome',
|
userAgent: 'Google Chrome',
|
||||||
identifier: 'test@test.te',
|
identifier: 'test@test.te',
|
||||||
@@ -123,7 +123,7 @@ describe('AuthController', () => {
|
|||||||
email: 'test@test.te',
|
email: 'test@test.te',
|
||||||
password: 'test',
|
password: 'test',
|
||||||
version: ProtocolVersion.V004,
|
version: ProtocolVersion.V004,
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
origination: KeyParamsOrigination.Registration,
|
origination: KeyParamsOrigination.Registration,
|
||||||
userAgent: 'Google Chrome',
|
userAgent: 'Google Chrome',
|
||||||
identifier: 'test@test.te',
|
identifier: 'test@test.te',
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
import {
|
import {
|
||||||
ApiVersion,
|
|
||||||
UserRegistrationRequestParams,
|
UserRegistrationRequestParams,
|
||||||
UserServerInterface,
|
UserServerInterface,
|
||||||
UserDeletionResponseBody,
|
UserDeletionResponseBody,
|
||||||
UserRegistrationResponseBody,
|
UserRegistrationResponseBody,
|
||||||
|
UserUpdateRequestParams,
|
||||||
} from '@standardnotes/api'
|
} from '@standardnotes/api'
|
||||||
import { ErrorTag, HttpResponse, HttpStatusCode } from '@standardnotes/responses'
|
import { ErrorTag, HttpResponse, HttpStatusCode } from '@standardnotes/responses'
|
||||||
import { ProtocolVersion } from '@standardnotes/common'
|
import { ProtocolVersion } from '@standardnotes/common'
|
||||||
@@ -23,6 +23,8 @@ import { GenerateRecoveryCodes } from '../Domain/UseCase/GenerateRecoveryCodes/G
|
|||||||
import { GenerateRecoveryCodesRequestParams } from '../Infra/Http/Request/GenerateRecoveryCodesRequestParams'
|
import { GenerateRecoveryCodesRequestParams } from '../Infra/Http/Request/GenerateRecoveryCodesRequestParams'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { SessionServiceInterface } from '../Domain/Session/SessionServiceInterface'
|
import { SessionServiceInterface } from '../Domain/Session/SessionServiceInterface'
|
||||||
|
import { ApiVersion } from '../Domain/Api/ApiVersion'
|
||||||
|
import { UserUpdateResponse } from '@standardnotes/api/dist/Domain/Response/User/UserUpdateResponse'
|
||||||
|
|
||||||
export class AuthController implements UserServerInterface {
|
export class AuthController implements UserServerInterface {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -37,6 +39,10 @@ export class AuthController implements UserServerInterface {
|
|||||||
private sessionService: SessionServiceInterface,
|
private sessionService: SessionServiceInterface,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
async update(_params: UserUpdateRequestParams): Promise<HttpResponse<UserUpdateResponse>> {
|
||||||
|
throw new Error('Method not implemented.')
|
||||||
|
}
|
||||||
|
|
||||||
async deleteAccount(_params: never): Promise<HttpResponse<UserDeletionResponseBody>> {
|
async deleteAccount(_params: never): Promise<HttpResponse<UserDeletionResponseBody>> {
|
||||||
throw new Error('This method is implemented on the payments server.')
|
throw new Error('This method is implemented on the payments server.')
|
||||||
}
|
}
|
||||||
@@ -121,7 +127,7 @@ export class AuthController implements UserServerInterface {
|
|||||||
async signInWithRecoveryCodes(
|
async signInWithRecoveryCodes(
|
||||||
params: SignInWithRecoveryCodesRequestParams,
|
params: SignInWithRecoveryCodesRequestParams,
|
||||||
): Promise<HttpResponse<SignInWithRecoveryCodesResponseBody>> {
|
): Promise<HttpResponse<SignInWithRecoveryCodesResponseBody>> {
|
||||||
if (params.apiVersion !== ApiVersion.v0) {
|
if (params.apiVersion !== ApiVersion.v20200115) {
|
||||||
return {
|
return {
|
||||||
status: HttpStatusCode.BadRequest,
|
status: HttpStatusCode.BadRequest,
|
||||||
data: {
|
data: {
|
||||||
@@ -162,7 +168,7 @@ export class AuthController implements UserServerInterface {
|
|||||||
async recoveryKeyParams(
|
async recoveryKeyParams(
|
||||||
params: RecoveryKeyParamsRequestParams,
|
params: RecoveryKeyParamsRequestParams,
|
||||||
): Promise<HttpResponse<RecoveryKeyParamsResponseBody>> {
|
): Promise<HttpResponse<RecoveryKeyParamsResponseBody>> {
|
||||||
if (params.apiVersion !== ApiVersion.v0) {
|
if (params.apiVersion !== ApiVersion.v20200115) {
|
||||||
return {
|
return {
|
||||||
status: HttpStatusCode.BadRequest,
|
status: HttpStatusCode.BadRequest,
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { AcceptSharedSubscriptionInvitation } from '../Domain/UseCase/AcceptShar
|
|||||||
import { DeclineSharedSubscriptionInvitation } from '../Domain/UseCase/DeclineSharedSubscriptionInvitation/DeclineSharedSubscriptionInvitation'
|
import { DeclineSharedSubscriptionInvitation } from '../Domain/UseCase/DeclineSharedSubscriptionInvitation/DeclineSharedSubscriptionInvitation'
|
||||||
import { CancelSharedSubscriptionInvitation } from '../Domain/UseCase/CancelSharedSubscriptionInvitation/CancelSharedSubscriptionInvitation'
|
import { CancelSharedSubscriptionInvitation } from '../Domain/UseCase/CancelSharedSubscriptionInvitation/CancelSharedSubscriptionInvitation'
|
||||||
import { ListSharedSubscriptionInvitations } from '../Domain/UseCase/ListSharedSubscriptionInvitations/ListSharedSubscriptionInvitations'
|
import { ListSharedSubscriptionInvitations } from '../Domain/UseCase/ListSharedSubscriptionInvitations/ListSharedSubscriptionInvitations'
|
||||||
import { ApiVersion } from '@standardnotes/api'
|
import { ApiVersion } from '../Domain/Api/ApiVersion'
|
||||||
|
|
||||||
describe('SubscriptionInvitesController', () => {
|
describe('SubscriptionInvitesController', () => {
|
||||||
let inviteToSharedSubscription: InviteToSharedSubscription
|
let inviteToSharedSubscription: InviteToSharedSubscription
|
||||||
@@ -53,7 +53,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
invitations: [],
|
invitations: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().listInvites({ api: ApiVersion.v0, inviterEmail: 'test@test.te' })
|
const result = await createController().listInvites({ api: ApiVersion.v20200115, inviterEmail: 'test@test.te' })
|
||||||
|
|
||||||
expect(listSharedSubscriptionInvitations.execute).toHaveBeenCalledWith({
|
expect(listSharedSubscriptionInvitations.execute).toHaveBeenCalledWith({
|
||||||
inviterEmail: 'test@test.te',
|
inviterEmail: 'test@test.te',
|
||||||
@@ -68,7 +68,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().cancelInvite({
|
const result = await createController().cancelInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
inviterEmail: 'test@test.te',
|
inviterEmail: 'test@test.te',
|
||||||
})
|
})
|
||||||
@@ -87,7 +87,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().cancelInvite({
|
const result = await createController().cancelInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().declineInvite({
|
const result = await createController().declineInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().declineInvite({
|
const result = await createController().declineInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().acceptInvite({
|
const result = await createController().acceptInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().acceptInvite({
|
const result = await createController().acceptInvite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
inviteUuid: '1-2-3',
|
inviteUuid: '1-2-3',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().invite({
|
const result = await createController().invite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
identifier: 'invitee@test.te',
|
identifier: 'invitee@test.te',
|
||||||
inviterUuid: '1-2-3',
|
inviterUuid: '1-2-3',
|
||||||
inviterEmail: 'test@test.te',
|
inviterEmail: 'test@test.te',
|
||||||
@@ -187,7 +187,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
|
|
||||||
it('should not invite to user subscription if the identifier is missing in request', async () => {
|
it('should not invite to user subscription if the identifier is missing in request', async () => {
|
||||||
const result = await createController().invite({
|
const result = await createController().invite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
identifier: '',
|
identifier: '',
|
||||||
inviterUuid: '1-2-3',
|
inviterUuid: '1-2-3',
|
||||||
inviterEmail: 'test@test.te',
|
inviterEmail: 'test@test.te',
|
||||||
@@ -205,7 +205,7 @@ describe('SubscriptionInvitesController', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const result = await createController().invite({
|
const result = await createController().invite({
|
||||||
api: ApiVersion.v0,
|
api: ApiVersion.v20200115,
|
||||||
identifier: 'invitee@test.te',
|
identifier: 'invitee@test.te',
|
||||||
inviterUuid: '1-2-3',
|
inviterUuid: '1-2-3',
|
||||||
inviterEmail: 'test@test.te',
|
inviterEmail: 'test@test.te',
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { AuthenticatorProps } from './AuthenticatorProps'
|
import { AuthenticatorProps } from './AuthenticatorProps'
|
||||||
|
|
||||||
export class Authenticator extends Entity<AuthenticatorProps> {
|
export class Authenticator extends Entity<AuthenticatorProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: AuthenticatorProps, id?: UniqueEntityId) {
|
private constructor(props: AuthenticatorProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { AuthenticatorChallengeProps } from './AuthenticatorChallengeProps'
|
import { AuthenticatorChallengeProps } from './AuthenticatorChallengeProps'
|
||||||
|
|
||||||
export class AuthenticatorChallenge extends Entity<AuthenticatorChallengeProps> {
|
export class AuthenticatorChallenge extends Entity<AuthenticatorChallengeProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: AuthenticatorChallengeProps, id?: UniqueEntityId) {
|
private constructor(props: AuthenticatorChallengeProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { EmergencyAccessInvitationProps } from './EmergencyAccessInvitationProps'
|
import { EmergencyAccessInvitationProps } from './EmergencyAccessInvitationProps'
|
||||||
|
|
||||||
export class EmergencyAccessInvitation extends Entity<EmergencyAccessInvitationProps> {
|
export class EmergencyAccessInvitation extends Entity<EmergencyAccessInvitationProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: EmergencyAccessInvitationProps, id?: UniqueEntityId) {
|
private constructor(props: EmergencyAccessInvitationProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import { UserSubscriptionServiceInterface } from '../Subscription/UserSubscripti
|
|||||||
describe('FileRemovedEventHandler', () => {
|
describe('FileRemovedEventHandler', () => {
|
||||||
let userSubscriptionService: UserSubscriptionServiceInterface
|
let userSubscriptionService: UserSubscriptionServiceInterface
|
||||||
let logger: Logger
|
let logger: Logger
|
||||||
let user: User
|
let regularUser: User
|
||||||
|
let sharedUser: User
|
||||||
let event: FileRemovedEvent
|
let event: FileRemovedEvent
|
||||||
let subscriptionSettingService: SubscriptionSettingServiceInterface
|
let subscriptionSettingService: SubscriptionSettingServiceInterface
|
||||||
let regularSubscription: UserSubscription
|
let regularSubscription: UserSubscription
|
||||||
@@ -22,20 +23,24 @@ describe('FileRemovedEventHandler', () => {
|
|||||||
const createHandler = () => new FileRemovedEventHandler(userSubscriptionService, subscriptionSettingService, logger)
|
const createHandler = () => new FileRemovedEventHandler(userSubscriptionService, subscriptionSettingService, logger)
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
user = {
|
regularUser = {
|
||||||
uuid: '123',
|
uuid: '123',
|
||||||
} as jest.Mocked<User>
|
} as jest.Mocked<User>
|
||||||
|
|
||||||
|
sharedUser = {
|
||||||
|
uuid: '234',
|
||||||
|
} as jest.Mocked<User>
|
||||||
|
|
||||||
regularSubscription = {
|
regularSubscription = {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: UserSubscriptionType.Regular,
|
subscriptionType: UserSubscriptionType.Regular,
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(regularUser),
|
||||||
} as jest.Mocked<UserSubscription>
|
} as jest.Mocked<UserSubscription>
|
||||||
|
|
||||||
sharedSubscription = {
|
sharedSubscription = {
|
||||||
uuid: '2-3-4',
|
uuid: '2-3-4',
|
||||||
subscriptionType: UserSubscriptionType.Shared,
|
subscriptionType: UserSubscriptionType.Shared,
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(sharedUser),
|
||||||
} as jest.Mocked<UserSubscription>
|
} as jest.Mocked<UserSubscription>
|
||||||
|
|
||||||
userSubscriptionService = {} as jest.Mocked<UserSubscriptionServiceInterface>
|
userSubscriptionService = {} as jest.Mocked<UserSubscriptionServiceInterface>
|
||||||
@@ -93,10 +98,11 @@ describe('FileRemovedEventHandler', () => {
|
|||||||
unencryptedValue: '222',
|
unencryptedValue: '222',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user: regularUser,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: 'regular',
|
subscriptionType: 'regular',
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(regularUser),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -118,10 +124,11 @@ describe('FileRemovedEventHandler', () => {
|
|||||||
unencryptedValue: '222',
|
unencryptedValue: '222',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user: regularUser,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: 'regular',
|
subscriptionType: 'regular',
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(regularUser),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -132,10 +139,11 @@ describe('FileRemovedEventHandler', () => {
|
|||||||
unencryptedValue: '222',
|
unencryptedValue: '222',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user: sharedUser,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '2-3-4',
|
uuid: '2-3-4',
|
||||||
subscriptionType: 'shared',
|
subscriptionType: 'shared',
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(sharedUser),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export class FileRemovedEventHandler implements DomainEventHandlerInterface {
|
|||||||
|
|
||||||
await this.subscriptionSettingService.createOrReplace({
|
await this.subscriptionSettingService.createOrReplace({
|
||||||
userSubscription: subscription,
|
userSubscription: subscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: SettingName.NAMES.FileUploadBytesUsed,
|
name: SettingName.NAMES.FileUploadBytesUsed,
|
||||||
unencryptedValue: (+bytesUsed - byteSize).toString(),
|
unencryptedValue: (+bytesUsed - byteSize).toString(),
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ describe('FileUploadedEventHandler', () => {
|
|||||||
unencryptedValue: '123',
|
unencryptedValue: '123',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: 'regular',
|
subscriptionType: 'regular',
|
||||||
@@ -118,6 +119,7 @@ describe('FileUploadedEventHandler', () => {
|
|||||||
unencryptedValue: '468',
|
unencryptedValue: '468',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: 'regular',
|
subscriptionType: 'regular',
|
||||||
@@ -143,6 +145,7 @@ describe('FileUploadedEventHandler', () => {
|
|||||||
unencryptedValue: '468',
|
unencryptedValue: '468',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
subscriptionType: 'regular',
|
subscriptionType: 'regular',
|
||||||
@@ -157,6 +160,7 @@ describe('FileUploadedEventHandler', () => {
|
|||||||
unencryptedValue: '468',
|
unencryptedValue: '468',
|
||||||
serverEncryptionVersion: 0,
|
serverEncryptionVersion: 0,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: {
|
userSubscription: {
|
||||||
uuid: '2-3-4',
|
uuid: '2-3-4',
|
||||||
subscriptionType: 'shared',
|
subscriptionType: 'shared',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { SubscriptionSettingServiceInterface } from '../Setting/SubscriptionSett
|
|||||||
import { UserSubscription } from '../Subscription/UserSubscription'
|
import { UserSubscription } from '../Subscription/UserSubscription'
|
||||||
import { UserSubscriptionServiceInterface } from '../Subscription/UserSubscriptionServiceInterface'
|
import { UserSubscriptionServiceInterface } from '../Subscription/UserSubscriptionServiceInterface'
|
||||||
import { UserRepositoryInterface } from '../User/UserRepositoryInterface'
|
import { UserRepositoryInterface } from '../User/UserRepositoryInterface'
|
||||||
|
import { User } from '../User/User'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class FileUploadedEventHandler implements DomainEventHandlerInterface {
|
export class FileUploadedEventHandler implements DomainEventHandlerInterface {
|
||||||
@@ -36,14 +37,18 @@ export class FileUploadedEventHandler implements DomainEventHandlerInterface {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.updateUploadBytesUsedSetting(regularSubscription, event.payload.fileByteSize)
|
await this.updateUploadBytesUsedSetting(regularSubscription, user, event.payload.fileByteSize)
|
||||||
|
|
||||||
if (sharedSubscription !== null) {
|
if (sharedSubscription !== null) {
|
||||||
await this.updateUploadBytesUsedSetting(sharedSubscription, event.payload.fileByteSize)
|
await this.updateUploadBytesUsedSetting(sharedSubscription, user, event.payload.fileByteSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async updateUploadBytesUsedSetting(subscription: UserSubscription, byteSize: number): Promise<void> {
|
private async updateUploadBytesUsedSetting(
|
||||||
|
subscription: UserSubscription,
|
||||||
|
user: User,
|
||||||
|
byteSize: number,
|
||||||
|
): Promise<void> {
|
||||||
let bytesUsed = '0'
|
let bytesUsed = '0'
|
||||||
const bytesUsedSetting = await this.subscriptionSettingService.findSubscriptionSettingWithDecryptedValue({
|
const bytesUsedSetting = await this.subscriptionSettingService.findSubscriptionSettingWithDecryptedValue({
|
||||||
userUuid: (await subscription.user).uuid,
|
userUuid: (await subscription.user).uuid,
|
||||||
@@ -56,6 +61,7 @@ export class FileUploadedEventHandler implements DomainEventHandlerInterface {
|
|||||||
|
|
||||||
await this.subscriptionSettingService.createOrReplace({
|
await this.subscriptionSettingService.createOrReplace({
|
||||||
userSubscription: subscription,
|
userSubscription: subscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: SettingName.NAMES.FileUploadBytesUsed,
|
name: SettingName.NAMES.FileUploadBytesUsed,
|
||||||
unencryptedValue: (+bytesUsed + byteSize).toString(),
|
unencryptedValue: (+bytesUsed + byteSize).toString(),
|
||||||
|
|||||||
@@ -114,8 +114,6 @@ describe('SubscriptionPurchasedEventHandler', () => {
|
|||||||
|
|
||||||
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
||||||
subscription,
|
subscription,
|
||||||
SubscriptionName.ProPlan,
|
|
||||||
'123',
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,7 @@ export class SubscriptionPurchasedEventHandler implements DomainEventHandlerInte
|
|||||||
|
|
||||||
await this.addUserRole(user, event.payload.subscriptionName)
|
await this.addUserRole(user, event.payload.subscriptionName)
|
||||||
|
|
||||||
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(
|
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
event.payload.subscriptionName,
|
|
||||||
user.uuid,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async addUserRole(user: User, subscriptionName: string): Promise<void> {
|
private async addUserRole(user: User, subscriptionName: string): Promise<void> {
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ describe('SubscriptionReassignedEventHandler', () => {
|
|||||||
|
|
||||||
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
||||||
subscription,
|
subscription,
|
||||||
SubscriptionName.ProPlan,
|
|
||||||
'123',
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,7 @@ export class SubscriptionReassignedEventHandler implements DomainEventHandlerInt
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(
|
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
event.payload.subscriptionName,
|
|
||||||
user.uuid,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async addUserRole(user: User, subscriptionName: string): Promise<void> {
|
private async addUserRole(user: User, subscriptionName: string): Promise<void> {
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ describe('SubscriptionSyncRequestedEventHandler', () => {
|
|||||||
|
|
||||||
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
||||||
subscription,
|
subscription,
|
||||||
SubscriptionName.ProPlan,
|
|
||||||
'123',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(settingService.createOrReplace).toHaveBeenCalledWith({
|
expect(settingService.createOrReplace).toHaveBeenCalledWith({
|
||||||
|
|||||||
@@ -95,11 +95,7 @@ export class SubscriptionSyncRequestedEventHandler implements DomainEventHandler
|
|||||||
|
|
||||||
await this.roleService.addUserRole(user, event.payload.subscriptionName)
|
await this.roleService.addUserRole(user, event.payload.subscriptionName)
|
||||||
|
|
||||||
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(
|
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
event.payload.subscriptionName,
|
|
||||||
user.uuid,
|
|
||||||
)
|
|
||||||
|
|
||||||
await this.settingService.createOrReplace({
|
await this.settingService.createOrReplace({
|
||||||
user,
|
user,
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
|||||||
import { SessionTraceProps } from './SessionTraceProps'
|
import { SessionTraceProps } from './SessionTraceProps'
|
||||||
|
|
||||||
export class SessionTrace extends Entity<SessionTraceProps> {
|
export class SessionTrace extends Entity<SessionTraceProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: SessionTraceProps, id?: UniqueEntityId) {
|
private constructor(props: SessionTraceProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { UserSubscription } from '../Subscription/UserSubscription'
|
import { UserSubscription } from '../Subscription/UserSubscription'
|
||||||
|
import { User } from '../User/User'
|
||||||
import { SubscriptionSettingProps } from './SubscriptionSettingProps'
|
import { SubscriptionSettingProps } from './SubscriptionSettingProps'
|
||||||
|
|
||||||
export type CreateOrReplaceSubscriptionSettingDTO = {
|
export type CreateOrReplaceSubscriptionSettingDTO = {
|
||||||
userSubscription: UserSubscription
|
userSubscription: UserSubscription
|
||||||
|
user: User
|
||||||
props: SubscriptionSettingProps
|
props: SubscriptionSettingProps
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
userSubscription = {
|
userSubscription = {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
user: Promise.resolve(user),
|
user: Promise.resolve(user),
|
||||||
|
planName: SubscriptionName.PlusPlan,
|
||||||
} as jest.Mocked<UserSubscription>
|
} as jest.Mocked<UserSubscription>
|
||||||
|
|
||||||
setting = {
|
setting = {
|
||||||
@@ -97,15 +98,70 @@ describe('SubscriptionSettingService', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should create default settings for a subscription', async () => {
|
it('should create default settings for a subscription', async () => {
|
||||||
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
await createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should create default settings for a subscription with overrides', async () => {
|
||||||
|
subscriptionSettingsAssociationService.getDefaultSettingsAndValuesForSubscriptionName = jest.fn().mockReturnValue(
|
||||||
|
new Map([
|
||||||
|
[
|
||||||
|
SettingName.NAMES.FileUploadBytesUsed,
|
||||||
|
{
|
||||||
|
value: '0',
|
||||||
|
sensitive: 0,
|
||||||
|
serverEncryptionVersion: EncryptionVersion.Unencrypted,
|
||||||
|
replaceable: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
SettingName.NAMES.FileUploadBytesLimit,
|
||||||
|
{
|
||||||
|
value: '345',
|
||||||
|
sensitive: 0,
|
||||||
|
serverEncryptionVersion: EncryptionVersion.Unencrypted,
|
||||||
|
replaceable: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
|
||||||
|
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
||||||
|
userSubscription,
|
||||||
|
new Map([[SettingName.NAMES.FileUploadBytesLimit, '123']]),
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(factory.createSubscriptionSetting).toHaveBeenNthCalledWith(
|
||||||
|
1,
|
||||||
|
{
|
||||||
|
name: SettingName.NAMES.FileUploadBytesUsed,
|
||||||
|
sensitive: 0,
|
||||||
|
serverEncryptionVersion: EncryptionVersion.Unencrypted,
|
||||||
|
unencryptedValue: '0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
planName: SubscriptionName.PlusPlan,
|
||||||
|
user: Promise.resolve(user),
|
||||||
|
uuid: '1-2-3',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
expect(factory.createSubscriptionSetting).toHaveBeenNthCalledWith(
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
name: SettingName.NAMES.FileUploadBytesLimit,
|
||||||
|
sensitive: 0,
|
||||||
|
serverEncryptionVersion: EncryptionVersion.Unencrypted,
|
||||||
|
unencryptedValue: '123',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
planName: SubscriptionName.PlusPlan,
|
||||||
|
user: Promise.resolve(user),
|
||||||
|
uuid: '1-2-3',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it('should throw error if subscription setting is invalid', async () => {
|
it('should throw error if subscription setting is invalid', async () => {
|
||||||
subscriptionSettingsAssociationService.getDefaultSettingsAndValuesForSubscriptionName = jest.fn().mockReturnValue(
|
subscriptionSettingsAssociationService.getDefaultSettingsAndValuesForSubscriptionName = jest.fn().mockReturnValue(
|
||||||
new Map([
|
new Map([
|
||||||
@@ -121,13 +177,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
await expect(
|
await expect(createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)).rejects.toThrow()
|
||||||
createService().applyDefaultSubscriptionSettingsForSubscription(
|
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
),
|
|
||||||
).rejects.toThrow()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw error if setting name is not a subscription setting when applying defaults', async () => {
|
it('should throw error if setting name is not a subscription setting when applying defaults', async () => {
|
||||||
@@ -145,13 +195,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
await expect(
|
await expect(createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)).rejects.toThrow()
|
||||||
createService().applyDefaultSubscriptionSettingsForSubscription(
|
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
),
|
|
||||||
).rejects.toThrow()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reassign existing default settings for a subscription if it is not replaceable', async () => {
|
it('should reassign existing default settings for a subscription if it is not replaceable', async () => {
|
||||||
@@ -170,11 +214,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
)
|
)
|
||||||
subscriptionSettingRepository.findLastByNameAndUserSubscriptionUuid = jest.fn().mockReturnValue(setting)
|
subscriptionSettingRepository.findLastByNameAndUserSubscriptionUuid = jest.fn().mockReturnValue(setting)
|
||||||
|
|
||||||
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
await createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(subscriptionSettingRepository.save).toHaveBeenCalled()
|
expect(subscriptionSettingRepository.save).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
@@ -195,11 +235,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
)
|
)
|
||||||
subscriptionSettingRepository.findLastByNameAndUserSubscriptionUuid = jest.fn().mockReturnValue(null)
|
subscriptionSettingRepository.findLastByNameAndUserSubscriptionUuid = jest.fn().mockReturnValue(null)
|
||||||
|
|
||||||
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
await createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
||||||
})
|
})
|
||||||
@@ -225,11 +261,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
} as jest.Mocked<UserSubscription>,
|
} as jest.Mocked<UserSubscription>,
|
||||||
])
|
])
|
||||||
|
|
||||||
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
await createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
expect(subscriptionSettingRepository.save).toHaveBeenCalledWith(setting)
|
||||||
})
|
})
|
||||||
@@ -239,11 +271,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
.fn()
|
.fn()
|
||||||
.mockReturnValue(undefined)
|
.mockReturnValue(undefined)
|
||||||
|
|
||||||
await createService().applyDefaultSubscriptionSettingsForSubscription(
|
await createService().applyDefaultSubscriptionSettingsForSubscription(userSubscription)
|
||||||
userSubscription,
|
|
||||||
SubscriptionName.PlusPlan,
|
|
||||||
'1-2-3',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(subscriptionSettingRepository.save).not.toHaveBeenCalled()
|
expect(subscriptionSettingRepository.save).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
@@ -251,6 +279,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
it("should create setting if it doesn't exist", async () => {
|
it("should create setting if it doesn't exist", async () => {
|
||||||
const result = await createService().createOrReplace({
|
const result = await createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: SettingName.NAMES.FileUploadBytesLimit,
|
name: SettingName.NAMES.FileUploadBytesLimit,
|
||||||
unencryptedValue: 'value',
|
unencryptedValue: 'value',
|
||||||
@@ -266,6 +295,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
createService().createOrReplace({
|
createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: 'invalid',
|
name: 'invalid',
|
||||||
unencryptedValue: 'value',
|
unencryptedValue: 'value',
|
||||||
@@ -280,6 +310,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
createService().createOrReplace({
|
createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: SettingName.NAMES.DropboxBackupFrequency,
|
name: SettingName.NAMES.DropboxBackupFrequency,
|
||||||
unencryptedValue: 'value',
|
unencryptedValue: 'value',
|
||||||
@@ -295,6 +326,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
|
|
||||||
const result = await createService().createOrReplace({
|
const result = await createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
name: SettingName.NAMES.FileUploadBytesLimit,
|
name: SettingName.NAMES.FileUploadBytesLimit,
|
||||||
@@ -312,6 +344,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
|
|
||||||
const result = await createService().createOrReplace({
|
const result = await createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
...setting,
|
...setting,
|
||||||
unencryptedValue: 'value',
|
unencryptedValue: 'value',
|
||||||
@@ -327,6 +360,7 @@ describe('SubscriptionSettingService', () => {
|
|||||||
|
|
||||||
const result = await createService().createOrReplace({
|
const result = await createService().createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
...setting,
|
...setting,
|
||||||
uuid: '1-2-3',
|
uuid: '1-2-3',
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { SubscriptionName } from '@standardnotes/common'
|
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
@@ -36,17 +35,20 @@ export class SubscriptionSettingService implements SubscriptionSettingServiceInt
|
|||||||
|
|
||||||
async applyDefaultSubscriptionSettingsForSubscription(
|
async applyDefaultSubscriptionSettingsForSubscription(
|
||||||
userSubscription: UserSubscription,
|
userSubscription: UserSubscription,
|
||||||
subscriptionName: SubscriptionName,
|
overrides?: Map<string, string>,
|
||||||
userUuid: string,
|
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const defaultSettingsWithValues =
|
const defaultSettingsWithValues =
|
||||||
await this.subscriptionSettingAssociationService.getDefaultSettingsAndValuesForSubscriptionName(subscriptionName)
|
await this.subscriptionSettingAssociationService.getDefaultSettingsAndValuesForSubscriptionName(
|
||||||
|
userSubscription.planName,
|
||||||
|
)
|
||||||
if (defaultSettingsWithValues === undefined) {
|
if (defaultSettingsWithValues === undefined) {
|
||||||
this.logger.warn(`Could not find settings for subscription: ${subscriptionName}`)
|
this.logger.warn(`Could not find settings for subscription: ${userSubscription.planName}`)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user = await userSubscription.user
|
||||||
|
|
||||||
for (const settingNameString of defaultSettingsWithValues.keys()) {
|
for (const settingNameString of defaultSettingsWithValues.keys()) {
|
||||||
const settingNameOrError = SettingName.create(settingNameString)
|
const settingNameOrError = SettingName.create(settingNameString)
|
||||||
if (settingNameOrError.isFailed()) {
|
if (settingNameOrError.isFailed()) {
|
||||||
@@ -59,7 +61,11 @@ export class SubscriptionSettingService implements SubscriptionSettingServiceInt
|
|||||||
|
|
||||||
const setting = defaultSettingsWithValues.get(settingName.value) as SettingDescription
|
const setting = defaultSettingsWithValues.get(settingName.value) as SettingDescription
|
||||||
if (!setting.replaceable) {
|
if (!setting.replaceable) {
|
||||||
const existingSetting = await this.findPreviousSubscriptionSetting(settingName, userSubscription.uuid, userUuid)
|
const existingSetting = await this.findPreviousSubscriptionSetting(
|
||||||
|
settingName,
|
||||||
|
userSubscription.uuid,
|
||||||
|
user.uuid,
|
||||||
|
)
|
||||||
if (existingSetting !== null) {
|
if (existingSetting !== null) {
|
||||||
existingSetting.userSubscription = Promise.resolve(userSubscription)
|
existingSetting.userSubscription = Promise.resolve(userSubscription)
|
||||||
await this.subscriptionSettingRepository.save(existingSetting)
|
await this.subscriptionSettingRepository.save(existingSetting)
|
||||||
@@ -68,11 +74,17 @@ export class SubscriptionSettingService implements SubscriptionSettingServiceInt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let unencryptedValue = setting.value
|
||||||
|
if (overrides && overrides.has(settingName.value)) {
|
||||||
|
unencryptedValue = overrides.get(settingName.value) as string
|
||||||
|
}
|
||||||
|
|
||||||
await this.createOrReplace({
|
await this.createOrReplace({
|
||||||
userSubscription,
|
userSubscription,
|
||||||
|
user,
|
||||||
props: {
|
props: {
|
||||||
name: settingName.value,
|
name: settingName.value,
|
||||||
unencryptedValue: setting.value,
|
unencryptedValue,
|
||||||
serverEncryptionVersion: setting.serverEncryptionVersion,
|
serverEncryptionVersion: setting.serverEncryptionVersion,
|
||||||
sensitive: setting.sensitive,
|
sensitive: setting.sensitive,
|
||||||
},
|
},
|
||||||
@@ -109,7 +121,7 @@ export class SubscriptionSettingService implements SubscriptionSettingServiceInt
|
|||||||
async createOrReplace(
|
async createOrReplace(
|
||||||
dto: CreateOrReplaceSubscriptionSettingDTO,
|
dto: CreateOrReplaceSubscriptionSettingDTO,
|
||||||
): Promise<CreateOrReplaceSubscriptionSettingResponse> {
|
): Promise<CreateOrReplaceSubscriptionSettingResponse> {
|
||||||
const { userSubscription, props } = dto
|
const { userSubscription, user, props } = dto
|
||||||
|
|
||||||
const settingNameOrError = SettingName.create(props.name)
|
const settingNameOrError = SettingName.create(props.name)
|
||||||
if (settingNameOrError.isFailed()) {
|
if (settingNameOrError.isFailed()) {
|
||||||
@@ -121,7 +133,6 @@ export class SubscriptionSettingService implements SubscriptionSettingServiceInt
|
|||||||
throw new Error(`Setting ${settingName.value} is not a subscription setting`)
|
throw new Error(`Setting ${settingName.value} is not a subscription setting`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await userSubscription.user
|
|
||||||
const existing = await this.findSubscriptionSettingWithDecryptedValue({
|
const existing = await this.findSubscriptionSettingWithDecryptedValue({
|
||||||
userUuid: user.uuid,
|
userUuid: user.uuid,
|
||||||
userSubscriptionUuid: userSubscription.uuid,
|
userSubscriptionUuid: userSubscription.uuid,
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import { SubscriptionSetting } from './SubscriptionSetting'
|
|||||||
export interface SubscriptionSettingServiceInterface {
|
export interface SubscriptionSettingServiceInterface {
|
||||||
applyDefaultSubscriptionSettingsForSubscription(
|
applyDefaultSubscriptionSettingsForSubscription(
|
||||||
userSubscription: UserSubscription,
|
userSubscription: UserSubscription,
|
||||||
subscriptionName: string,
|
overrides?: Map<string, string>,
|
||||||
userUuid: string,
|
|
||||||
): Promise<void>
|
): Promise<void>
|
||||||
createOrReplace(dto: CreateOrReplaceSubscriptionSettingDTO): Promise<CreateOrReplaceSubscriptionSettingResponse>
|
createOrReplace(dto: CreateOrReplaceSubscriptionSettingDTO): Promise<CreateOrReplaceSubscriptionSettingResponse>
|
||||||
findSubscriptionSettingWithDecryptedValue(dto: FindSubscriptionSettingDTO): Promise<SubscriptionSetting | null>
|
findSubscriptionSettingWithDecryptedValue(dto: FindSubscriptionSettingDTO): Promise<SubscriptionSetting | null>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { SettingDescription } from './SettingDescription'
|
|||||||
|
|
||||||
export interface SubscriptionSettingsAssociationServiceInterface {
|
export interface SubscriptionSettingsAssociationServiceInterface {
|
||||||
getDefaultSettingsAndValuesForSubscriptionName(
|
getDefaultSettingsAndValuesForSubscriptionName(
|
||||||
subscriptionName: SubscriptionName,
|
subscriptionName: string,
|
||||||
): Promise<Map<string, SettingDescription> | undefined>
|
): Promise<Map<string, SettingDescription> | undefined>
|
||||||
getFileUploadLimit(subscriptionName: SubscriptionName): Promise<number>
|
getFileUploadLimit(subscriptionName: SubscriptionName): Promise<number>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,8 +106,6 @@ describe('AcceptSharedSubscriptionInvitation', () => {
|
|||||||
expect(roleService.addUserRole).toHaveBeenCalledWith(invitee, 'PLUS_PLAN')
|
expect(roleService.addUserRole).toHaveBeenCalledWith(invitee, 'PLUS_PLAN')
|
||||||
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
||||||
inviteeSubscription,
|
inviteeSubscription,
|
||||||
'PLUS_PLAN',
|
|
||||||
'123',
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -148,8 +146,6 @@ describe('AcceptSharedSubscriptionInvitation', () => {
|
|||||||
expect(roleService.addUserRole).toHaveBeenCalledWith(invitee, 'PLUS_PLAN')
|
expect(roleService.addUserRole).toHaveBeenCalledWith(invitee, 'PLUS_PLAN')
|
||||||
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
expect(subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription).toHaveBeenCalledWith(
|
||||||
inviteeSubscription,
|
inviteeSubscription,
|
||||||
'PLUS_PLAN',
|
|
||||||
'123',
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -92,11 +92,7 @@ export class AcceptSharedSubscriptionInvitation implements UseCaseInterface {
|
|||||||
|
|
||||||
await this.addUserRole(invitee, inviterUserSubscription.planName as SubscriptionName)
|
await this.addUserRole(invitee, inviterUserSubscription.planName as SubscriptionName)
|
||||||
|
|
||||||
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(
|
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(inviteeSubscription)
|
||||||
inviteeSubscription,
|
|
||||||
inviteeSubscription.planName as SubscriptionName,
|
|
||||||
invitee.uuid,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
|||||||
@@ -5,16 +5,24 @@ import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
|
|||||||
|
|
||||||
import { ActivatePremiumFeatures } from './ActivatePremiumFeatures'
|
import { ActivatePremiumFeatures } from './ActivatePremiumFeatures'
|
||||||
import { User } from '../../User/User'
|
import { User } from '../../User/User'
|
||||||
|
import { SubscriptionSettingServiceInterface } from '../../Setting/SubscriptionSettingServiceInterface'
|
||||||
|
|
||||||
describe('ActivatePremiumFeatures', () => {
|
describe('ActivatePremiumFeatures', () => {
|
||||||
let userRepository: UserRepositoryInterface
|
let userRepository: UserRepositoryInterface
|
||||||
let userSubscriptionRepository: UserSubscriptionRepositoryInterface
|
let userSubscriptionRepository: UserSubscriptionRepositoryInterface
|
||||||
|
let subscriptionSettingsService: SubscriptionSettingServiceInterface
|
||||||
let roleService: RoleServiceInterface
|
let roleService: RoleServiceInterface
|
||||||
let timer: TimerInterface
|
let timer: TimerInterface
|
||||||
let user: User
|
let user: User
|
||||||
|
|
||||||
const createUseCase = () =>
|
const createUseCase = () =>
|
||||||
new ActivatePremiumFeatures(userRepository, userSubscriptionRepository, roleService, timer)
|
new ActivatePremiumFeatures(
|
||||||
|
userRepository,
|
||||||
|
userSubscriptionRepository,
|
||||||
|
subscriptionSettingsService,
|
||||||
|
roleService,
|
||||||
|
timer,
|
||||||
|
)
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
user = {} as jest.Mocked<User>
|
user = {} as jest.Mocked<User>
|
||||||
@@ -32,6 +40,9 @@ describe('ActivatePremiumFeatures', () => {
|
|||||||
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(123456789)
|
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(123456789)
|
||||||
timer.convertDateToMicroseconds = jest.fn().mockReturnValue(123456789)
|
timer.convertDateToMicroseconds = jest.fn().mockReturnValue(123456789)
|
||||||
timer.getUTCDateNDaysAhead = jest.fn().mockReturnValue(new Date('2024-01-01T00:00:00.000Z'))
|
timer.getUTCDateNDaysAhead = jest.fn().mockReturnValue(new Date('2024-01-01T00:00:00.000Z'))
|
||||||
|
|
||||||
|
subscriptionSettingsService = {} as jest.Mocked<SubscriptionSettingServiceInterface>
|
||||||
|
subscriptionSettingsService.applyDefaultSubscriptionSettingsForSubscription = jest.fn()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return error when username is invalid', async () => {
|
it('should return error when username is invalid', async () => {
|
||||||
@@ -64,4 +75,28 @@ describe('ActivatePremiumFeatures', () => {
|
|||||||
expect(userSubscriptionRepository.save).toHaveBeenCalled()
|
expect(userSubscriptionRepository.save).toHaveBeenCalled()
|
||||||
expect(roleService.addUserRole).toHaveBeenCalled()
|
expect(roleService.addUserRole).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should save a subscription with custom plan name and endsAt', async () => {
|
||||||
|
const useCase = createUseCase()
|
||||||
|
|
||||||
|
const result = await useCase.execute({
|
||||||
|
username: 'test@test.te',
|
||||||
|
subscriptionPlanName: 'PRO_PLAN',
|
||||||
|
endsAt: new Date('2024-01-01T00:00:00.000Z'),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result.isFailed()).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should fail when subscription plan name is invalid', async () => {
|
||||||
|
const useCase = createUseCase()
|
||||||
|
|
||||||
|
const result = await useCase.execute({
|
||||||
|
username: 'test@test.te',
|
||||||
|
subscriptionPlanName: 'some invalid plan name',
|
||||||
|
endsAt: new Date('2024-01-01T00:00:00.000Z'),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result.isFailed()).toBe(true)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
|
|||||||
import { UserSubscription } from '../../Subscription/UserSubscription'
|
import { UserSubscription } from '../../Subscription/UserSubscription'
|
||||||
import { UserSubscriptionType } from '../../Subscription/UserSubscriptionType'
|
import { UserSubscriptionType } from '../../Subscription/UserSubscriptionType'
|
||||||
import { ActivatePremiumFeaturesDTO } from './ActivatePremiumFeaturesDTO'
|
import { ActivatePremiumFeaturesDTO } from './ActivatePremiumFeaturesDTO'
|
||||||
|
import { SubscriptionSettingServiceInterface } from '../../Setting/SubscriptionSettingServiceInterface'
|
||||||
|
import { SettingName } from '@standardnotes/settings'
|
||||||
|
|
||||||
export class ActivatePremiumFeatures implements UseCaseInterface<string> {
|
export class ActivatePremiumFeatures implements UseCaseInterface<string> {
|
||||||
constructor(
|
constructor(
|
||||||
private userRepository: UserRepositoryInterface,
|
private userRepository: UserRepositoryInterface,
|
||||||
private userSubscriptionRepository: UserSubscriptionRepositoryInterface,
|
private userSubscriptionRepository: UserSubscriptionRepositoryInterface,
|
||||||
|
private subscriptionSettingService: SubscriptionSettingServiceInterface,
|
||||||
private roleService: RoleServiceInterface,
|
private roleService: RoleServiceInterface,
|
||||||
private timer: TimerInterface,
|
private timer: TimerInterface,
|
||||||
) {}
|
) {}
|
||||||
@@ -27,22 +30,35 @@ export class ActivatePremiumFeatures implements UseCaseInterface<string> {
|
|||||||
if (user === null) {
|
if (user === null) {
|
||||||
return Result.fail(`User not found with username: ${username.value}`)
|
return Result.fail(`User not found with username: ${username.value}`)
|
||||||
}
|
}
|
||||||
|
const subscriptionPlanNameString = dto.subscriptionPlanName ?? SubscriptionPlanName.NAMES.ProPlan
|
||||||
|
const subscriptionPlanNameOrError = SubscriptionPlanName.create(subscriptionPlanNameString)
|
||||||
|
if (subscriptionPlanNameOrError.isFailed()) {
|
||||||
|
return Result.fail(subscriptionPlanNameOrError.getError())
|
||||||
|
}
|
||||||
|
const subscriptionPlanName = subscriptionPlanNameOrError.getValue()
|
||||||
|
|
||||||
const timestamp = this.timer.getTimestampInMicroseconds()
|
const timestamp = this.timer.getTimestampInMicroseconds()
|
||||||
|
|
||||||
|
const endsAt = dto.endsAt ?? this.timer.getUTCDateNDaysAhead(365)
|
||||||
|
|
||||||
const subscription = new UserSubscription()
|
const subscription = new UserSubscription()
|
||||||
subscription.planName = SubscriptionPlanName.NAMES.ProPlan
|
subscription.planName = subscriptionPlanName.value
|
||||||
subscription.user = Promise.resolve(user)
|
subscription.user = Promise.resolve(user)
|
||||||
subscription.createdAt = timestamp
|
subscription.createdAt = timestamp
|
||||||
subscription.updatedAt = timestamp
|
subscription.updatedAt = timestamp
|
||||||
subscription.endsAt = this.timer.convertDateToMicroseconds(this.timer.getUTCDateNDaysAhead(365))
|
subscription.endsAt = this.timer.convertDateToMicroseconds(endsAt)
|
||||||
subscription.cancelled = false
|
subscription.cancelled = false
|
||||||
subscription.subscriptionId = 1
|
subscription.subscriptionId = 1
|
||||||
subscription.subscriptionType = UserSubscriptionType.Regular
|
subscription.subscriptionType = UserSubscriptionType.Regular
|
||||||
|
|
||||||
await this.userSubscriptionRepository.save(subscription)
|
await this.userSubscriptionRepository.save(subscription)
|
||||||
|
|
||||||
await this.roleService.addUserRole(user, SubscriptionPlanName.NAMES.ProPlan)
|
await this.roleService.addUserRole(user, subscriptionPlanName.value)
|
||||||
|
|
||||||
|
await this.subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription(
|
||||||
|
subscription,
|
||||||
|
new Map([[SettingName.NAMES.FileUploadBytesLimit, '-1']]),
|
||||||
|
)
|
||||||
|
|
||||||
return Result.ok('Premium features activated.')
|
return Result.ok('Premium features activated.')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
export interface ActivatePremiumFeaturesDTO {
|
export interface ActivatePremiumFeaturesDTO {
|
||||||
username: string
|
username: string
|
||||||
|
subscriptionPlanName?: string
|
||||||
|
endsAt?: Date
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as bcrypt from 'bcryptjs'
|
import * as bcrypt from 'bcryptjs'
|
||||||
import { RoleName, Username } from '@standardnotes/domain-core'
|
import { RoleName, Username } from '@standardnotes/domain-core'
|
||||||
import { ApiVersion } from '@standardnotes/api'
|
|
||||||
|
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
@@ -16,6 +15,7 @@ import { TimerInterface } from '@standardnotes/time'
|
|||||||
import { SettingServiceInterface } from '../Setting/SettingServiceInterface'
|
import { SettingServiceInterface } from '../Setting/SettingServiceInterface'
|
||||||
import { AuthResponseFactory20200115 } from '../Auth/AuthResponseFactory20200115'
|
import { AuthResponseFactory20200115 } from '../Auth/AuthResponseFactory20200115'
|
||||||
import { AuthResponse20200115 } from '../Auth/AuthResponse20200115'
|
import { AuthResponse20200115 } from '../Auth/AuthResponse20200115'
|
||||||
|
import { ApiVersion } from '../Api/ApiVersion'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class Register implements UseCaseInterface {
|
export class Register implements UseCaseInterface {
|
||||||
@@ -39,7 +39,7 @@ export class Register implements UseCaseInterface {
|
|||||||
|
|
||||||
const { email, password, apiVersion, ephemeralSession, ...registrationFields } = dto
|
const { email, password, apiVersion, ephemeralSession, ...registrationFields } = dto
|
||||||
|
|
||||||
if (apiVersion !== ApiVersion.v0) {
|
if (apiVersion !== ApiVersion.v20200115) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
errorMessage: `Unsupported api version: ${apiVersion}`,
|
errorMessage: `Unsupported api version: ${apiVersion}`,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import * as bcrypt from 'bcryptjs'
|
import * as bcrypt from 'bcryptjs'
|
||||||
import { Result, UseCaseInterface, Username, Uuid, Validator } from '@standardnotes/domain-core'
|
import { Result, UseCaseInterface, Username, Uuid, Validator } from '@standardnotes/domain-core'
|
||||||
import { SettingName } from '@standardnotes/settings'
|
import { SettingName } from '@standardnotes/settings'
|
||||||
import { ApiVersion } from '@standardnotes/api'
|
|
||||||
|
|
||||||
import { AuthResponse20200115 } from '../../Auth/AuthResponse20200115'
|
import { AuthResponse20200115 } from '../../Auth/AuthResponse20200115'
|
||||||
import { SettingServiceInterface } from '../../Setting/SettingServiceInterface'
|
import { SettingServiceInterface } from '../../Setting/SettingServiceInterface'
|
||||||
@@ -16,6 +15,7 @@ import { IncreaseLoginAttempts } from '../IncreaseLoginAttempts'
|
|||||||
import { ClearLoginAttempts } from '../ClearLoginAttempts'
|
import { ClearLoginAttempts } from '../ClearLoginAttempts'
|
||||||
import { DeleteSetting } from '../DeleteSetting/DeleteSetting'
|
import { DeleteSetting } from '../DeleteSetting/DeleteSetting'
|
||||||
import { AuthenticatorRepositoryInterface } from '../../Authenticator/AuthenticatorRepositoryInterface'
|
import { AuthenticatorRepositoryInterface } from '../../Authenticator/AuthenticatorRepositoryInterface'
|
||||||
|
import { ApiVersion } from '../../Api/ApiVersion'
|
||||||
|
|
||||||
export class SignInWithRecoveryCodes implements UseCaseInterface<AuthResponse20200115> {
|
export class SignInWithRecoveryCodes implements UseCaseInterface<AuthResponse20200115> {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -100,7 +100,7 @@ export class SignInWithRecoveryCodes implements UseCaseInterface<AuthResponse202
|
|||||||
|
|
||||||
const authResponse = await this.authResponseFactory.createResponse({
|
const authResponse = await this.authResponseFactory.createResponse({
|
||||||
user,
|
user,
|
||||||
apiVersion: ApiVersion.v0,
|
apiVersion: ApiVersion.v20200115,
|
||||||
userAgent: dto.userAgent,
|
userAgent: dto.userAgent,
|
||||||
ephemeralSession: false,
|
ephemeralSession: false,
|
||||||
readonlyAccess: false,
|
readonlyAccess: false,
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ describe('UpdateSetting', () => {
|
|||||||
serverEncryptionVersion: 1,
|
serverEncryptionVersion: 1,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: regularSubscription,
|
userSubscription: regularSubscription,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -303,6 +304,7 @@ describe('UpdateSetting', () => {
|
|||||||
serverEncryptionVersion: 1,
|
serverEncryptionVersion: 1,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
},
|
},
|
||||||
|
user,
|
||||||
userSubscription: sharedSubscription,
|
userSubscription: sharedSubscription,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export class UpdateSetting implements UseCaseInterface {
|
|||||||
|
|
||||||
const response = await this.subscriptionSettingService.createOrReplace({
|
const response = await this.subscriptionSettingService.createOrReplace({
|
||||||
userSubscription: subscription,
|
userSubscription: subscription,
|
||||||
|
user,
|
||||||
props,
|
props,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [1.50.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.49.0...@standardnotes/common@1.50.0) (2023-07-12)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* domain items ([#655](https://github.com/standardnotes/server/issues/655)) ([a0af8f0](https://github.com/standardnotes/server/commit/a0af8f00252e1219e58cb7e066c11a8e71692e9d))
|
||||||
|
|
||||||
# [1.49.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.48.3...@standardnotes/common@1.49.0) (2023-06-30)
|
# [1.49.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.48.3...@standardnotes/common@1.49.0) (2023-06-30)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/common",
|
"name": "@standardnotes/common",
|
||||||
"version": "1.49.0",
|
"version": "1.50.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
/* istanbul ignore file */
|
|
||||||
export enum ContentType {
|
|
||||||
Any = '*',
|
|
||||||
Item = 'SF|Item',
|
|
||||||
KeySystemItemsKey = 'SN|KeySystemItemsKey',
|
|
||||||
KeySystemRootKey = 'SN|KeySystemRootKey',
|
|
||||||
TrustedContact = 'SN|TrustedContact',
|
|
||||||
VaultListing = 'SN|VaultListing',
|
|
||||||
RootKey = 'SN|RootKey|NoSync',
|
|
||||||
ItemsKey = 'SN|ItemsKey',
|
|
||||||
EncryptedStorage = 'SN|EncryptedStorage',
|
|
||||||
Privileges = 'SN|Privileges',
|
|
||||||
Note = 'Note',
|
|
||||||
Tag = 'Tag',
|
|
||||||
SmartView = 'SN|SmartTag',
|
|
||||||
Component = 'SN|Component',
|
|
||||||
Editor = 'SN|Editor',
|
|
||||||
ActionsExtension = 'Extension',
|
|
||||||
UserPrefs = 'SN|UserPreferences',
|
|
||||||
HistorySession = 'SN|HistorySession',
|
|
||||||
Theme = 'SN|Theme',
|
|
||||||
File = 'SN|File',
|
|
||||||
FilesafeCredentials = 'SN|FileSafe|Credentials',
|
|
||||||
FilesafeFileMetadata = 'SN|FileSafe|FileMetadata',
|
|
||||||
FilesafeIntegration = 'SN|FileSafe|Integration',
|
|
||||||
ExtensionRepo = 'SN|ExtensionRepo',
|
|
||||||
Unknown = 'Unknown',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function DisplayStringForContentType(contentType: ContentType): string | undefined {
|
|
||||||
const map: Partial<Record<ContentType, string>> = {
|
|
||||||
[ContentType.ActionsExtension]: 'action-based extension',
|
|
||||||
[ContentType.Component]: 'component',
|
|
||||||
[ContentType.Editor]: 'editor',
|
|
||||||
[ContentType.File]: 'file',
|
|
||||||
[ContentType.FilesafeCredentials]: 'FileSafe credential',
|
|
||||||
[ContentType.FilesafeFileMetadata]: 'FileSafe file',
|
|
||||||
[ContentType.FilesafeIntegration]: 'FileSafe integration',
|
|
||||||
[ContentType.ItemsKey]: 'encryption key',
|
|
||||||
[ContentType.Note]: 'note',
|
|
||||||
[ContentType.SmartView]: 'smart view',
|
|
||||||
[ContentType.Tag]: 'tag',
|
|
||||||
[ContentType.Theme]: 'theme',
|
|
||||||
[ContentType.UserPrefs]: 'user preferences',
|
|
||||||
}
|
|
||||||
|
|
||||||
return map[contentType]
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
export * from './Content/ContentType'
|
|
||||||
export * from './Content/ContentDecoder'
|
export * from './Content/ContentDecoder'
|
||||||
export * from './Content/ContentDecoderInterface'
|
export * from './Content/ContentDecoderInterface'
|
||||||
export * from './DataType/AnyRecord'
|
export * from './DataType/AnyRecord'
|
||||||
|
|||||||
@@ -3,6 +3,60 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.23.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.23.2...@standardnotes/domain-core@1.23.3) (2023-07-21)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-core:** notification payload creation from string ([1708c3f](https://github.com/standardnotes/server/commit/1708c3f8a00897369585e1ef8022950a7c3c610e))
|
||||||
|
|
||||||
|
## [1.23.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.23.1...@standardnotes/domain-core@1.23.2) (2023-07-21)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* user notifications structure ([#667](https://github.com/standardnotes/server/issues/667)) ([1bbb639](https://github.com/standardnotes/server/commit/1bbb639c83922ec09e3778f85419d76669d36ae3))
|
||||||
|
|
||||||
|
## [1.23.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.23.0...@standardnotes/domain-core@1.23.1) (2023-07-19)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **syncing-server:** add missing messages and key system identifier sql representations ([#663](https://github.com/standardnotes/server/issues/663)) ([d026152](https://github.com/standardnotes/server/commit/d026152ac8cb2ecda2eee8d3f7385d655b210938))
|
||||||
|
|
||||||
|
# [1.23.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.22.0...@standardnotes/domain-core@1.23.0) (2023-07-17)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** refactor syncing to decouple getting and saving items ([#659](https://github.com/standardnotes/server/issues/659)) ([cb74b23](https://github.com/standardnotes/server/commit/cb74b23e45b207136e299ce8a3db2c04dc87e21e))
|
||||||
|
|
||||||
|
# [1.22.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.21.1...@standardnotes/domain-core@1.22.0) (2023-07-12)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* domain items ([#655](https://github.com/standardnotes/server/issues/655)) ([a0af8f0](https://github.com/standardnotes/server/commit/a0af8f00252e1219e58cb7e066c11a8e71692e9d))
|
||||||
|
|
||||||
|
## [1.21.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.21.0...@standardnotes/domain-core@1.21.1) (2023-07-07)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* transfer notifications from auth to syncing-server. ([#648](https://github.com/standardnotes/server/issues/648)) ([c288e5d](https://github.com/standardnotes/server/commit/c288e5d8dc54778a96a9fc33e3c9cae00583fade))
|
||||||
|
|
||||||
|
# [1.21.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.20.0...@standardnotes/domain-core@1.21.0) (2023-07-06)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* getting shared vault users and removing shared vault user ([#642](https://github.com/standardnotes/server/issues/642)) ([e905128](https://github.com/standardnotes/server/commit/e905128d45eaadb34d3465d4480dfb3a2c5f3f79))
|
||||||
|
|
||||||
|
# [1.20.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.19.0...@standardnotes/domain-core@1.20.0) (2023-07-05)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* deleting shared vaults. ([#640](https://github.com/standardnotes/server/issues/640)) ([f3161c2](https://github.com/standardnotes/server/commit/f3161c271296159331639814b2dbb2e566cc54c9))
|
||||||
|
|
||||||
|
# [1.19.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.18.0...@standardnotes/domain-core@1.19.0) (2023-06-30)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add shared vaults model. ([#631](https://github.com/standardnotes/server/issues/631)) ([38e77f0](https://github.com/standardnotes/server/commit/38e77f04be441b7506c3390fb0d9894b34119c3e))
|
||||||
|
|
||||||
# [1.18.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.17.0...@standardnotes/domain-core@1.18.0) (2023-06-02)
|
# [1.18.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.17.0...@standardnotes/domain-core@1.18.0) (2023-06-02)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-core",
|
"name": "@standardnotes/domain-core",
|
||||||
"version": "1.18.0",
|
"version": "1.23.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ import { UniqueEntityId } from '../Core/UniqueEntityId'
|
|||||||
import { CacheEntryProps } from './CacheEntryProps'
|
import { CacheEntryProps } from './CacheEntryProps'
|
||||||
|
|
||||||
export class CacheEntry extends Entity<CacheEntryProps> {
|
export class CacheEntry extends Entity<CacheEntryProps> {
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
|
|
||||||
private constructor(props: CacheEntryProps, id?: UniqueEntityId) {
|
private constructor(props: CacheEntryProps, id?: UniqueEntityId) {
|
||||||
super(props, id)
|
super(props, id)
|
||||||
}
|
}
|
||||||
|
|||||||
39
packages/domain-core/src/Domain/Common/ContentType.spec.ts
Normal file
39
packages/domain-core/src/Domain/Common/ContentType.spec.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { ContentType } from './ContentType'
|
||||||
|
|
||||||
|
describe('ContentType', () => {
|
||||||
|
it('should create a value object', () => {
|
||||||
|
const valueOrError = ContentType.create(ContentType.TYPES.Component)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeFalsy()
|
||||||
|
expect(valueOrError.getValue().value).toEqual('SN|Component')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not create an invalid value object', () => {
|
||||||
|
for (const value of ['', undefined, 0, 'FOOBAR']) {
|
||||||
|
const valueOrError = ContentType.create(value as string)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeTruthy()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return a display name', () => {
|
||||||
|
const valueOrError = ContentType.create(ContentType.TYPES.FilesafeFileMetadata)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeFalsy()
|
||||||
|
expect(valueOrError.getValue().getDisplayName()).toEqual('FileSafe file')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return null for a display name if the value is null', () => {
|
||||||
|
const valueOrError = ContentType.create(null)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeFalsy()
|
||||||
|
expect(valueOrError.getValue().getDisplayName()).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should fallback to the value if the display name is not found', () => {
|
||||||
|
const valueOrError = ContentType.create(ContentType.TYPES.Unknown)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeFalsy()
|
||||||
|
expect(valueOrError.getValue().getDisplayName()).toEqual('Unknown')
|
||||||
|
})
|
||||||
|
})
|
||||||
79
packages/domain-core/src/Domain/Common/ContentType.ts
Normal file
79
packages/domain-core/src/Domain/Common/ContentType.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import { Result } from '../Core/Result'
|
||||||
|
import { ValueObject } from '../Core/ValueObject'
|
||||||
|
|
||||||
|
import { ContentTypeProps } from './ContentTypeProps'
|
||||||
|
|
||||||
|
export class ContentType extends ValueObject<ContentTypeProps> {
|
||||||
|
static readonly TYPES = {
|
||||||
|
Any: '*',
|
||||||
|
Item: 'SF|Item',
|
||||||
|
KeySystemItemsKey: 'SN|KeySystemItemsKey',
|
||||||
|
KeySystemRootKey: 'SN|KeySystemRootKey',
|
||||||
|
TrustedContact: 'SN|TrustedContact',
|
||||||
|
VaultListing: 'SN|VaultListing',
|
||||||
|
RootKey: 'SN|RootKey|NoSync',
|
||||||
|
ItemsKey: 'SN|ItemsKey',
|
||||||
|
EncryptedStorage: 'SN|EncryptedStorage',
|
||||||
|
Privileges: 'SN|Privileges',
|
||||||
|
Note: 'Note',
|
||||||
|
Tag: 'Tag',
|
||||||
|
SmartView: 'SN|SmartTag',
|
||||||
|
Component: 'SN|Component',
|
||||||
|
Editor: 'SN|Editor',
|
||||||
|
ActionsExtension: 'Extension',
|
||||||
|
UserPrefs: 'SN|UserPreferences',
|
||||||
|
HistorySession: 'SN|HistorySession',
|
||||||
|
Theme: 'SN|Theme',
|
||||||
|
File: 'SN|File',
|
||||||
|
FilesafeCredentials: 'SN|FileSafe|Credentials',
|
||||||
|
FilesafeFileMetadata: 'SN|FileSafe|FileMetadata',
|
||||||
|
FilesafeIntegration: 'SN|FileSafe|Integration',
|
||||||
|
ExtensionRepo: 'SN|ExtensionRepo',
|
||||||
|
Unknown: 'Unknown',
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly displayNamesMap: Partial<Record<string, string>> = {
|
||||||
|
[ContentType.TYPES.ActionsExtension]: 'action-based extension',
|
||||||
|
[ContentType.TYPES.Component]: 'component',
|
||||||
|
[ContentType.TYPES.Editor]: 'editor',
|
||||||
|
[ContentType.TYPES.File]: 'file',
|
||||||
|
[ContentType.TYPES.FilesafeCredentials]: 'FileSafe credential',
|
||||||
|
[ContentType.TYPES.FilesafeFileMetadata]: 'FileSafe file',
|
||||||
|
[ContentType.TYPES.FilesafeIntegration]: 'FileSafe integration',
|
||||||
|
[ContentType.TYPES.ItemsKey]: 'encryption key',
|
||||||
|
[ContentType.TYPES.Note]: 'note',
|
||||||
|
[ContentType.TYPES.SmartView]: 'smart view',
|
||||||
|
[ContentType.TYPES.Tag]: 'tag',
|
||||||
|
[ContentType.TYPES.Theme]: 'theme',
|
||||||
|
[ContentType.TYPES.UserPrefs]: 'user preferences',
|
||||||
|
}
|
||||||
|
|
||||||
|
get value(): string | null {
|
||||||
|
return this.props.value
|
||||||
|
}
|
||||||
|
|
||||||
|
private constructor(props: ContentTypeProps) {
|
||||||
|
super(props)
|
||||||
|
}
|
||||||
|
|
||||||
|
static create(type: string | null): Result<ContentType> {
|
||||||
|
if (type === null) {
|
||||||
|
return Result.ok<ContentType>(new ContentType({ value: null }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const isValidType = Object.values(this.TYPES).includes(type)
|
||||||
|
if (!isValidType) {
|
||||||
|
return Result.fail<ContentType>(`Invalid content type: ${type}`)
|
||||||
|
} else {
|
||||||
|
return Result.ok<ContentType>(new ContentType({ value: type }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getDisplayName(): string | null {
|
||||||
|
if (!this.value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.displayNamesMap[this.value] || this.value
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ export class Dates extends ValueObject<DatesProps> {
|
|||||||
return Result.fail<Dates>(`Could not create Dates. Creation date should be a date object, given: ${createdAt}`)
|
return Result.fail<Dates>(`Could not create Dates. Creation date should be a date object, given: ${createdAt}`)
|
||||||
}
|
}
|
||||||
if (!(updatedAt instanceof Date)) {
|
if (!(updatedAt instanceof Date)) {
|
||||||
return Result.fail<Dates>(`Could not create Dates. Update date should be a date object, given: ${createdAt}`)
|
return Result.fail<Dates>(`Could not create Dates. Update date should be a date object, given: ${updatedAt}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.ok<Dates>(new Dates({ createdAt, updatedAt }))
|
return Result.ok<Dates>(new Dates({ createdAt, updatedAt }))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class RoleNameCollection extends ValueObject<RoleNameCollectionProps> {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
equals(roleNameCollection: RoleNameCollection): boolean {
|
override equals(roleNameCollection: RoleNameCollection): boolean {
|
||||||
if (this.props.value.length !== roleNameCollection.value.length) {
|
if (this.props.value.length !== roleNameCollection.value.length) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
30
packages/domain-core/src/Domain/Common/Timestamps.ts
Normal file
30
packages/domain-core/src/Domain/Common/Timestamps.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { Result } from '../Core/Result'
|
||||||
|
import { ValueObject } from '../Core/ValueObject'
|
||||||
|
import { TimestampsProps } from './TimestampsProps'
|
||||||
|
|
||||||
|
export class Timestamps extends ValueObject<TimestampsProps> {
|
||||||
|
get createdAt(): number {
|
||||||
|
return this.props.createdAt
|
||||||
|
}
|
||||||
|
|
||||||
|
get updatedAt(): number {
|
||||||
|
return this.props.updatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
private constructor(props: TimestampsProps) {
|
||||||
|
super(props)
|
||||||
|
}
|
||||||
|
|
||||||
|
static create(createdAt: number, updatedAt: number): Result<Timestamps> {
|
||||||
|
if (isNaN(createdAt)) {
|
||||||
|
return Result.fail<Timestamps>(
|
||||||
|
`Could not create Timestamps. Creation date should be a number, given: ${createdAt}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (isNaN(updatedAt)) {
|
||||||
|
return Result.fail<Timestamps>(`Could not create Timestamps. Update date should be a number, given: ${updatedAt}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.ok<Timestamps>(new Timestamps({ createdAt, updatedAt }))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export interface TimestampsProps {
|
||||||
|
createdAt: number
|
||||||
|
updatedAt: number
|
||||||
|
}
|
||||||
@@ -13,4 +13,25 @@ describe('Uuid', () => {
|
|||||||
|
|
||||||
expect(valueOrError.isFailed()).toBeTruthy()
|
expect(valueOrError.isFailed()).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should check equality between two value objects', () => {
|
||||||
|
const uuid1 = Uuid.create('84c0f8e8-544a-4c7e-9adf-26209303bc1d').getValue()
|
||||||
|
const uuid2 = Uuid.create('84c0f8e8-544a-4c7e-9adf-26209303bc1d').getValue()
|
||||||
|
|
||||||
|
expect(uuid1.equals(uuid2)).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should check inequality between two value objects', () => {
|
||||||
|
const uuid1 = Uuid.create('84c0f8e8-544a-4c7e-9adf-26209303bc1d').getValue()
|
||||||
|
const uuid2 = Uuid.create('84c0f8e8-544a-4c7e-9adf-26209303bc1e').getValue()
|
||||||
|
|
||||||
|
expect(uuid1.equals(uuid2)).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should check inequality between two value objects of different types', () => {
|
||||||
|
const uuid1 = Uuid.create('84c0f8e8-544a-4c7e-9adf-26209303bc1d').getValue()
|
||||||
|
|
||||||
|
expect(uuid1.equals(null as unknown as Uuid)).toBeFalsy()
|
||||||
|
expect(uuid1.equals(undefined as unknown as Uuid)).toBeFalsy()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
|
|
||||||
import { Entity } from './Entity'
|
import { Entity } from './Entity'
|
||||||
import { UniqueEntityId } from './UniqueEntityId'
|
|
||||||
|
|
||||||
export abstract class Aggregate<T> extends Entity<T> {
|
export abstract class Aggregate<T> extends Entity<T> {}
|
||||||
get id(): UniqueEntityId {
|
|
||||||
return this._id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ export abstract class Entity<T> {
|
|||||||
this._id = id ? id : new UniqueEntityId()
|
this._id = id ? id : new UniqueEntityId()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get id(): UniqueEntityId {
|
||||||
|
return this._id
|
||||||
|
}
|
||||||
|
|
||||||
public equals(object?: Entity<T>): boolean {
|
public equals(object?: Entity<T>): boolean {
|
||||||
if (object == null || object == undefined) {
|
if (object == null || object == undefined) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -78,4 +78,18 @@ describe('Validator', () => {
|
|||||||
expect(Validator.isNotEmpty(value).isFailed()).toBeTruthy()
|
expect(Validator.isNotEmpty(value).isFailed()).toBeTruthy()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('is not empty string', () => {
|
||||||
|
it('should not validate invalid string', () => {
|
||||||
|
expect(Validator.isNotEmptyString(123 as unknown as string).isFailed()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not validate an empty string', () => {
|
||||||
|
expect(Validator.isNotEmptyString('').isFailed()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should validate a string', () => {
|
||||||
|
expect(Validator.isNotEmptyString('foo').isFailed()).toBeFalsy()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -42,4 +42,18 @@ export class Validator {
|
|||||||
|
|
||||||
return Result.ok()
|
return Result.ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isNotEmptyString(value: unknown): Result<string> {
|
||||||
|
const isStringResult = Validator.isString(value)
|
||||||
|
if (isStringResult.isFailed()) {
|
||||||
|
return isStringResult
|
||||||
|
}
|
||||||
|
|
||||||
|
const isNotEmptyResult = Validator.isNotEmpty(value)
|
||||||
|
if (isNotEmptyResult.isFailed()) {
|
||||||
|
return isNotEmptyResult
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.ok()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,12 @@ export abstract class ValueObject<T extends ValueObjectProps> {
|
|||||||
constructor(props: T) {
|
constructor(props: T) {
|
||||||
this.props = Object.freeze(props)
|
this.props = Object.freeze(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public equals(vo?: ValueObject<T>): boolean {
|
||||||
|
if (vo === null || vo === undefined) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return JSON.stringify(this.props) === JSON.stringify(vo.props)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { ValueObject } from '../Core/ValueObject'
|
||||||
|
import { Result } from '../Core/Result'
|
||||||
|
|
||||||
|
import { NotificationPayloadProps } from './NotificationPayloadProps'
|
||||||
|
import { NotificationType } from './NotificationType'
|
||||||
|
import { Uuid } from '../Common/Uuid'
|
||||||
|
|
||||||
|
export class NotificationPayload extends ValueObject<NotificationPayloadProps> {
|
||||||
|
private constructor(props: NotificationPayloadProps) {
|
||||||
|
super(props)
|
||||||
|
}
|
||||||
|
|
||||||
|
override toString(): string {
|
||||||
|
return JSON.stringify({
|
||||||
|
version: this.props.version,
|
||||||
|
type: this.props.type.value,
|
||||||
|
sharedVaultUuid: this.props.sharedVaultUuid.value,
|
||||||
|
itemUuid: this.props.itemUuid ? this.props.itemUuid.value : undefined,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static createFromString(jsonPayload: string): Result<NotificationPayload> {
|
||||||
|
try {
|
||||||
|
const props = JSON.parse(jsonPayload)
|
||||||
|
|
||||||
|
const typeOrError = NotificationType.create(props.type)
|
||||||
|
if (typeOrError.isFailed()) {
|
||||||
|
return Result.fail<NotificationPayload>(typeOrError.getError())
|
||||||
|
}
|
||||||
|
const type = typeOrError.getValue()
|
||||||
|
|
||||||
|
const sharedVaultUuidOrError = Uuid.create(props.sharedVaultUuid)
|
||||||
|
if (sharedVaultUuidOrError.isFailed()) {
|
||||||
|
return Result.fail<NotificationPayload>(sharedVaultUuidOrError.getError())
|
||||||
|
}
|
||||||
|
const sharedVaultUuid = sharedVaultUuidOrError.getValue()
|
||||||
|
|
||||||
|
let itemUuid: Uuid | undefined = undefined
|
||||||
|
if (props.itemUuid) {
|
||||||
|
const itemUuidOrError = Uuid.create(props.itemUuid)
|
||||||
|
if (itemUuidOrError.isFailed()) {
|
||||||
|
return Result.fail<NotificationPayload>(itemUuidOrError.getError())
|
||||||
|
}
|
||||||
|
itemUuid = itemUuidOrError.getValue()
|
||||||
|
}
|
||||||
|
|
||||||
|
return NotificationPayload.create({
|
||||||
|
version: props.version,
|
||||||
|
type,
|
||||||
|
sharedVaultUuid,
|
||||||
|
itemUuid,
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
return Result.fail<NotificationPayload>((error as Error).message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static create(props: NotificationPayloadProps): Result<NotificationPayload> {
|
||||||
|
if (
|
||||||
|
props.itemUuid === undefined &&
|
||||||
|
props.type.equals(NotificationType.create(NotificationType.TYPES.SharedVaultItemRemoved).getValue())
|
||||||
|
) {
|
||||||
|
return Result.fail<NotificationPayload>(
|
||||||
|
`Item uuid is required for ${NotificationType.TYPES.SharedVaultItemRemoved} notification type`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.ok<NotificationPayload>(new NotificationPayload(props))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Uuid } from '../Common/Uuid'
|
||||||
|
import { NotificationType } from './NotificationType'
|
||||||
|
|
||||||
|
export interface NotificationPayloadProps {
|
||||||
|
type: NotificationType
|
||||||
|
sharedVaultUuid: Uuid
|
||||||
|
version: string
|
||||||
|
itemUuid?: Uuid
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { NotificationType } from './NotificationType'
|
||||||
|
|
||||||
|
describe('NotificationType', () => {
|
||||||
|
it('should create a value object', () => {
|
||||||
|
const valueOrError = NotificationType.create(NotificationType.TYPES.SharedVaultItemRemoved)
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeFalsy()
|
||||||
|
expect(valueOrError.getValue().value).toEqual('shared_vault_item_removed')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not create an invalid value object', () => {
|
||||||
|
const valueOrError = NotificationType.create('TEST')
|
||||||
|
|
||||||
|
expect(valueOrError.isFailed()).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { Result } from '../Core/Result'
|
||||||
|
import { ValueObject } from '../Core/ValueObject'
|
||||||
|
import { NotificationTypeProps } from './NotificationTypeProps'
|
||||||
|
|
||||||
|
export class NotificationType extends ValueObject<NotificationTypeProps> {
|
||||||
|
static readonly TYPES = {
|
||||||
|
SharedVaultItemRemoved: 'shared_vault_item_removed',
|
||||||
|
RemovedFromSharedVault: 'removed_from_shared_vault',
|
||||||
|
}
|
||||||
|
|
||||||
|
get value(): string {
|
||||||
|
return this.props.value
|
||||||
|
}
|
||||||
|
|
||||||
|
private constructor(props: NotificationTypeProps) {
|
||||||
|
super(props)
|
||||||
|
}
|
||||||
|
|
||||||
|
static create(notificationType: string): Result<NotificationType> {
|
||||||
|
const isValidType = Object.values(this.TYPES).includes(notificationType)
|
||||||
|
if (!isValidType) {
|
||||||
|
return Result.fail<NotificationType>(`Invalid notification type: ${notificationType}`)
|
||||||
|
} else {
|
||||||
|
return Result.ok<NotificationType>(new NotificationType({ value: notificationType }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export interface NotificationTypeProps {
|
||||||
|
value: string
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ export * from './Cache/CacheEntry'
|
|||||||
export * from './Cache/CacheEntryProps'
|
export * from './Cache/CacheEntryProps'
|
||||||
export * from './Cache/CacheEntryRepositoryInterface'
|
export * from './Cache/CacheEntryRepositoryInterface'
|
||||||
|
|
||||||
|
export * from './Common/ContentType'
|
||||||
|
export * from './Common/ContentTypeProps'
|
||||||
export * from './Common/Dates'
|
export * from './Common/Dates'
|
||||||
export * from './Common/DatesProps'
|
export * from './Common/DatesProps'
|
||||||
export * from './Common/Email'
|
export * from './Common/Email'
|
||||||
@@ -17,6 +19,8 @@ export * from './Common/RoleName'
|
|||||||
export * from './Common/RoleNameProps'
|
export * from './Common/RoleNameProps'
|
||||||
export * from './Common/RoleNameCollection'
|
export * from './Common/RoleNameCollection'
|
||||||
export * from './Common/RoleNameCollectionProps'
|
export * from './Common/RoleNameCollectionProps'
|
||||||
|
export * from './Common/Timestamps'
|
||||||
|
export * from './Common/TimestampsProps'
|
||||||
export * from './Common/Username'
|
export * from './Common/Username'
|
||||||
export * from './Common/UsernameProps'
|
export * from './Common/UsernameProps'
|
||||||
export * from './Common/Uuid'
|
export * from './Common/Uuid'
|
||||||
@@ -41,6 +45,11 @@ export * from './Env/AbstractEnv'
|
|||||||
|
|
||||||
export * from './Mapping/MapperInterface'
|
export * from './Mapping/MapperInterface'
|
||||||
|
|
||||||
|
export * from './Notification/NotificationPayload'
|
||||||
|
export * from './Notification/NotificationPayloadProps'
|
||||||
|
export * from './Notification/NotificationType'
|
||||||
|
export * from './Notification/NotificationTypeProps'
|
||||||
|
|
||||||
export * from './Service/ServiceConfiguration'
|
export * from './Service/ServiceConfiguration'
|
||||||
export * from './Service/ServiceContainer'
|
export * from './Service/ServiceContainer'
|
||||||
export * from './Service/ServiceContainerInterface'
|
export * from './Service/ServiceContainerInterface'
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.12.9](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.8...@standardnotes/domain-events-infra@1.12.9) (2023-07-07)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.12.8](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.7...@standardnotes/domain-events-infra@1.12.8) (2023-07-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
## [1.12.7](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.6...@standardnotes/domain-events-infra@1.12.7) (2023-06-30)
|
## [1.12.7](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.6...@standardnotes/domain-events-infra@1.12.7) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events-infra",
|
"name": "@standardnotes/domain-events-infra",
|
||||||
"version": "1.12.7",
|
"version": "1.12.9",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.113.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.113.0...@standardnotes/domain-events@2.113.1) (2023-07-07)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* transfer notifications from auth to syncing-server. ([#648](https://github.com/standardnotes/server/issues/648)) ([c288e5d](https://github.com/standardnotes/server/commit/c288e5d8dc54778a96a9fc33e3c9cae00583fade))
|
||||||
|
|
||||||
|
# [2.113.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.112.1...@standardnotes/domain-events@2.113.0) (2023-07-05)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* deleting shared vaults. ([#640](https://github.com/standardnotes/server/issues/640)) ([f3161c2](https://github.com/standardnotes/server/commit/f3161c271296159331639814b2dbb2e566cc54c9))
|
||||||
|
|
||||||
## [2.112.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.112.0...@standardnotes/domain-events@2.112.1) (2023-06-30)
|
## [2.112.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.112.0...@standardnotes/domain-events@2.112.1) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/domain-events
|
**Note:** Version bump only for package @standardnotes/domain-events
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events",
|
"name": "@standardnotes/domain-events",
|
||||||
"version": "2.112.1",
|
"version": "2.113.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,42 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.11.10](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.9...@standardnotes/event-store@1.11.10) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.9](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.8...@standardnotes/event-store@1.11.9) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.8](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.7...@standardnotes/event-store@1.11.8) (2023-07-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.7](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.6...@standardnotes/event-store@1.11.7) (2023-07-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.6](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.5...@standardnotes/event-store@1.11.6) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.5](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.4...@standardnotes/event-store@1.11.5) (2023-07-07)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.4](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.3...@standardnotes/event-store@1.11.4) (2023-07-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.3](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.2...@standardnotes/event-store@1.11.3) (2023-07-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.11.2](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.1...@standardnotes/event-store@1.11.2) (2023-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
## [1.11.1](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.0...@standardnotes/event-store@1.11.1) (2023-06-30)
|
## [1.11.1](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.11.0...@standardnotes/event-store@1.11.1) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/event-store
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/event-store",
|
"name": "@standardnotes/event-store",
|
||||||
"version": "1.11.1",
|
"version": "1.11.10",
|
||||||
"description": "Event Store Service",
|
"description": "Event Store Service",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,52 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.19.12](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.11...@standardnotes/files-server@1.19.12) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.11](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.10...@standardnotes/files-server@1.19.11) (2023-07-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.10](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.9...@standardnotes/files-server@1.19.10) (2023-07-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.9](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.8...@standardnotes/files-server@1.19.9) (2023-07-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.8](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.7...@standardnotes/files-server@1.19.8) (2023-07-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **files:** handling unlimited storage quota on home server ([9be3517](https://github.com/standardnotes/files/commit/9be3517093f8dd7bbdd7507c1e2ff059e6c9a889))
|
||||||
|
|
||||||
|
## [1.19.7](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.6...@standardnotes/files-server@1.19.7) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.6](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.5...@standardnotes/files-server@1.19.6) (2023-07-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.5](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.4...@standardnotes/files-server@1.19.5) (2023-07-07)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.4](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.3...@standardnotes/files-server@1.19.4) (2023-07-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.2...@standardnotes/files-server@1.19.3) (2023-07-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.19.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.1...@standardnotes/files-server@1.19.2) (2023-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
## [1.19.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.0...@standardnotes/files-server@1.19.1) (2023-06-30)
|
## [1.19.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.19.0...@standardnotes/files-server@1.19.1) (2023-06-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/files-server
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/files-server",
|
"name": "@standardnotes/files-server",
|
||||||
"version": "1.19.1",
|
"version": "1.19.12",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
"@standardnotes/domain-events": "workspace:*",
|
"@standardnotes/domain-events": "workspace:*",
|
||||||
"@standardnotes/domain-events-infra": "workspace:*",
|
"@standardnotes/domain-events-infra": "workspace:*",
|
||||||
"@standardnotes/security": "workspace:*",
|
"@standardnotes/security": "workspace:*",
|
||||||
"@standardnotes/sncrypto-common": "^1.9.0",
|
"@standardnotes/sncrypto-common": "^1.13.4",
|
||||||
"@standardnotes/sncrypto-node": "workspace:*",
|
"@standardnotes/sncrypto-node": "workspace:*",
|
||||||
"@standardnotes/time": "workspace:*",
|
"@standardnotes/time": "workspace:*",
|
||||||
"connect-busboy": "^1.0.0",
|
"connect-busboy": "^1.0.0",
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user