mirror of
https://github.com/standardnotes/server
synced 2026-01-27 08:01:11 -05:00
Compare commits
4 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e1fcebdd8 | ||
|
|
fd4ee2123d | ||
|
|
62caa840ef | ||
|
|
565e890973 |
94
.pnp.cjs
generated
94
.pnp.cjs
generated
@@ -32,6 +32,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"name": "@standardnotes/auth-server",\
|
||||
"reference": "workspace:packages/auth"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/common",\
|
||||
"reference": "workspace:packages/common"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/domain-events",\
|
||||
"reference": "workspace:packages/domain-events"\
|
||||
@@ -59,6 +63,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
{\
|
||||
"name": "@standardnotes/syncing-server",\
|
||||
"reference": "workspace:packages/syncing-server"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/time",\
|
||||
"reference": "workspace:packages/time"\
|
||||
}\
|
||||
],\
|
||||
"enableTopLevelFallback": true,\
|
||||
@@ -67,6 +75,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/analytics", ["workspace:packages/analytics"]],\
|
||||
["@standardnotes/api-gateway", ["workspace:packages/api-gateway"]],\
|
||||
["@standardnotes/auth-server", ["workspace:packages/auth"]],\
|
||||
["@standardnotes/common", ["workspace:packages/common"]],\
|
||||
["@standardnotes/domain-events", ["workspace:packages/domain-events"]],\
|
||||
["@standardnotes/domain-events-infra", ["workspace:packages/domain-events-infra"]],\
|
||||
["@standardnotes/files-server", ["workspace:packages/files"]],\
|
||||
@@ -74,7 +83,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/scheduler-server", ["workspace:packages/scheduler"]],\
|
||||
["@standardnotes/security", ["workspace:packages/security"]],\
|
||||
["@standardnotes/server-monorepo", ["workspace:."]],\
|
||||
["@standardnotes/syncing-server", ["workspace:packages/syncing-server"]]\
|
||||
["@standardnotes/syncing-server", ["workspace:packages/syncing-server"]],\
|
||||
["@standardnotes/time", ["workspace:packages/time"]]\
|
||||
],\
|
||||
"fallbackPool": [\
|
||||
],\
|
||||
@@ -2662,7 +2672,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/api", "npm:1.1.19"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/encryption", "npm:1.12.0"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/services", "npm:1.15.0"],\
|
||||
@@ -2682,7 +2692,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/express", "npm:4.17.13"],\
|
||||
["@types/ioredis", "npm:4.28.10"],\
|
||||
@@ -2720,7 +2730,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-auth-npm-3.19.4-29b35c1352-84ac9e669e.zip/node_modules/@standardnotes/auth/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["jsonwebtoken", "npm:8.5.1"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@@ -2735,7 +2745,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/analytics", "workspace:packages/analytics"],\
|
||||
["@standardnotes/api", "npm:1.1.19"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
@@ -2745,7 +2755,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/settings", "npm:1.15.0"],\
|
||||
["@standardnotes/sncrypto-common", "npm:1.9.0"],\
|
||||
["@standardnotes/sncrypto-node", "npm:1.8.3"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/bcryptjs", "npm:2.4.2"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/express", "npm:4.17.13"],\
|
||||
@@ -2788,12 +2798,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/common", [\
|
||||
["npm:1.23.1", {\
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-common-npm-1.23.1-ed73dbb679-f498f4c469.zip/node_modules/@standardnotes/common/",\
|
||||
["workspace:packages/common", {\
|
||||
"packageLocation": "./packages/common/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/common", "npm:1.23.1"]\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@types/jest", "npm:27.5.2"],\
|
||||
["@types/node", "npm:18.0.3"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.5.1"],\
|
||||
["reflect-metadata", "npm:0.1.13"],\
|
||||
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.1.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/config", [\
|
||||
@@ -2815,7 +2832,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./packages/domain-events/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
@@ -2857,7 +2874,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.12.0-eb2342c675-1a28653b1e.zip/node_modules/@standardnotes/encryption/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/encryption", "npm:1.12.0"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/models", "npm:1.14.0"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/services", "npm:1.15.0"],\
|
||||
@@ -2874,7 +2891,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["reflect-metadata", "npm:0.1.13"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@@ -2886,14 +2903,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/files-server", "workspace:packages/files"],\
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/config", "npm:2.4.3"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/sncrypto-common", "npm:1.9.0"],\
|
||||
["@standardnotes/sncrypto-node", "npm:1.8.3"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/connect-busboy", "npm:1.0.0"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/express", "npm:4.17.13"],\
|
||||
@@ -2937,7 +2954,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.14.0-6f064d99e7-bfb9d517b6.zip/node_modules/@standardnotes/models/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/models", "npm:1.14.0"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/utils", "npm:1.6.12"],\
|
||||
@@ -2952,7 +2969,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-payloads-npm-1.5.1-45dffe2f5c-65c28421e7.zip/node_modules/@standardnotes/payloads/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/payloads", "npm:1.5.1"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/utils", "npm:1.6.12"]\
|
||||
],\
|
||||
@@ -2964,7 +2981,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./packages/predicates/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@types/jest", "npm:27.5.2"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
@@ -2981,7 +2998,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/features", "npm:1.50.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@@ -2994,11 +3011,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/scheduler-server", "workspace:packages/scheduler"],\
|
||||
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:2.1.2"],\
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/ioredis", "npm:4.28.10"],\
|
||||
["@types/jest", "npm:28.1.4"],\
|
||||
["@types/newrelic", "npm:7.0.3"],\
|
||||
@@ -3027,7 +3044,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./packages/security/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@types/jest", "npm:27.5.2"],\
|
||||
["@types/jsonwebtoken", "npm:8.5.8"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
@@ -3073,7 +3090,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/services", "npm:1.15.0"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/models", "npm:1.14.0"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/utils", "npm:1.6.12"],\
|
||||
@@ -3118,14 +3135,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:2.1.2"],\
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/analytics", "workspace:packages/analytics"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/payloads", "npm:1.5.1"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/settings", "npm:1.15.0"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/dotenv", "npm:8.2.0"],\
|
||||
["@types/express", "npm:4.17.13"],\
|
||||
@@ -3167,15 +3184,21 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/time", [\
|
||||
["npm:1.7.1", {\
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-time-npm-1.7.1-e6859705d5-ccb9c4af73.zip/node_modules/@standardnotes/time/",\
|
||||
["workspace:packages/time", {\
|
||||
"packageLocation": "./packages/time/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/jest", "npm:27.5.2"],\
|
||||
["@types/microtime", "npm:2.1.0"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["dayjs", "npm:1.11.3"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.5.1"],\
|
||||
["microtime", "npm:3.1.0"],\
|
||||
["reflect-metadata", "npm:0.1.13"]\
|
||||
["reflect-metadata", "npm:0.1.13"],\
|
||||
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.1.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/utils", [\
|
||||
@@ -3183,7 +3206,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./.yarn/cache/@standardnotes-utils-npm-1.6.12-8fa8d7d09b-e177b1fa51.zip/node_modules/@standardnotes/utils/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/utils", "npm:1.6.12"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/common", "workspace:packages/common"],\
|
||||
["dompurify", "npm:2.3.8"],\
|
||||
["lodash", "npm:4.17.21"]\
|
||||
],\
|
||||
@@ -3510,6 +3533,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/microtime", [\
|
||||
["npm:2.1.0", {\
|
||||
"packageLocation": "./.yarn/cache/@types-microtime-npm-2.1.0-111ed89518-6c23131fe4.zip/node_modules/@types/microtime/",\
|
||||
"packageDependencies": [\
|
||||
["@types/microtime", "npm:2.1.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/mime", [\
|
||||
["npm:1.3.2", {\
|
||||
"packageLocation": "./.yarn/cache/@types-mime-npm-1.3.2-ea71878ab3-0493368244.zip/node_modules/@types/mime/",\
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@types-microtime-npm-2.1.0-111ed89518-6c23131fe4.zip
vendored
Normal file
BIN
.yarn/cache/@types-microtime-npm-2.1.0-111ed89518-6c23131fe4.zip
vendored
Normal file
Binary file not shown.
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.6.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.0...@standardnotes/api-gateway@1.6.1) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
# [1.6.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.5.0...@standardnotes/api-gateway@1.6.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/api-gateway/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
# [1.5.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.4.2...@standardnotes/api-gateway@1.5.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/api-gateway",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.1",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -28,7 +28,7 @@
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1160.0",
|
||||
"axios": "0.24.0",
|
||||
"cors": "2.8.5",
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.8.0](https://github.com/standardnotes/auth/compare/@standardnotes/auth-server@1.7.0...@standardnotes/auth-server@1.8.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/auth/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# [1.7.0](https://github.com/standardnotes/auth/compare/@standardnotes/auth-server@1.6.0...@standardnotes/auth-server@1.7.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/auth/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
# [1.6.0](https://github.com/standardnotes/auth/compare/@standardnotes/auth-server@1.5.1...@standardnotes/auth-server@1.6.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/auth-server",
|
||||
"version": "1.6.0",
|
||||
"version": "1.8.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -35,7 +35,7 @@
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/analytics": "workspace:*",
|
||||
"@standardnotes/api": "^1.1.19",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/features": "^1.47.0",
|
||||
@@ -45,7 +45,7 @@
|
||||
"@standardnotes/settings": "^1.15.0",
|
||||
"@standardnotes/sncrypto-common": "^1.9.0",
|
||||
"@standardnotes/sncrypto-node": "^1.8.3",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1159.0",
|
||||
"axios": "0.24.0",
|
||||
"bcryptjs": "2.4.3",
|
||||
|
||||
1
packages/common/.eslintignore
Normal file
1
packages/common/.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
6
packages/common/.eslintrc
Normal file
6
packages/common/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../../.eslintrc",
|
||||
"parserOptions": {
|
||||
"project": "./linter.tsconfig.json"
|
||||
}
|
||||
}
|
||||
264
packages/common/CHANGELOG.md
Normal file
264
packages/common/CHANGELOG.md
Normal file
@@ -0,0 +1,264 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 1.25.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/server/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
## [1.23.2](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.23.1...@standardnotes/common@1.23.2) (2022-07-04)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing reflect-metadata package ([70aa494](https://github.com/standardnotes/snjs/commit/70aa4943a3fde70d4360055db22cb5388fc3f76e))
|
||||
|
||||
## [1.23.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.23.0...@standardnotes/common@1.23.1) (2022-06-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add email message identifier for files email campaign ([affa300](https://github.com/standardnotes/snjs/commit/affa3005b6933165e262227282198310f0a65cb3))
|
||||
|
||||
# [1.23.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.22.0...@standardnotes/common@1.23.0) (2022-06-15)
|
||||
|
||||
### Features
|
||||
|
||||
* add email requested events ([4d501fa](https://github.com/standardnotes/snjs/commit/4d501faedad44ff23782db1704956a6c19365fb6))
|
||||
|
||||
# [1.22.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.21.0...@standardnotes/common@1.22.0) (2022-05-22)
|
||||
|
||||
### Features
|
||||
|
||||
* optional files navigation ([#745](https://github.com/standardnotes/snjs/issues/745)) ([8512166](https://github.com/standardnotes/snjs/commit/851216615478b57b11a570173f94ee598bec31c0))
|
||||
|
||||
# [1.21.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.20.1...@standardnotes/common@1.21.0) (2022-05-17)
|
||||
|
||||
### Features
|
||||
|
||||
* remove basic user role and core subscription plan ([#741](https://github.com/standardnotes/snjs/issues/741)) ([7800ecd](https://github.com/standardnotes/snjs/commit/7800ecd119e7bbb5872d48bd7806b5d0f5522c0e))
|
||||
|
||||
## [1.20.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.20.0...@standardnotes/common@1.20.1) (2022-05-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
# [1.20.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.8...@standardnotes/common@1.20.0) (2022-05-16)
|
||||
|
||||
### Features
|
||||
|
||||
* remove basic user role and core subscription plan names ([304e232](https://github.com/standardnotes/snjs/commit/304e232e738456a93374de869117b5579e8a8f57))
|
||||
|
||||
## [1.19.8](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.6...@standardnotes/common@1.19.8) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.7](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.6...@standardnotes/common@1.19.7) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.6](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.5...@standardnotes/common@1.19.6) (2022-04-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.5](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.4...@standardnotes/common@1.19.5) (2022-04-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* abort key recovery after aborted challenge ([#703](https://github.com/standardnotes/snjs/issues/703)) ([a67fb7e](https://github.com/standardnotes/snjs/commit/a67fb7e8cde41a5c9fadf545933e35d525faeaf0))
|
||||
|
||||
## [1.19.4](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.3...@standardnotes/common@1.19.4) (2022-04-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.3](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.2...@standardnotes/common@1.19.3) (2022-04-11)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.2](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.1...@standardnotes/common@1.19.2) (2022-04-01)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.19.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.19.0...@standardnotes/common@1.19.1) (2022-03-31)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
# [1.19.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.18.0...@standardnotes/common@1.19.0) (2022-03-31)
|
||||
|
||||
### Features
|
||||
|
||||
* encryption and models packages ([#679](https://github.com/standardnotes/snjs/issues/679)) ([5e03d48](https://github.com/standardnotes/snjs/commit/5e03d48aba7e3dd266117201139ab869b1f70cc9))
|
||||
|
||||
# [1.18.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.17.0...@standardnotes/common@1.18.0) (2022-03-30)
|
||||
|
||||
### Features
|
||||
|
||||
* files-beta role ([#678](https://github.com/standardnotes/snjs/issues/678)) ([f1ae62f](https://github.com/standardnotes/snjs/commit/f1ae62ff05e361dc551f1a0d047feabd129d0f76))
|
||||
|
||||
# [1.17.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.16.2...@standardnotes/common@1.17.0) (2022-03-22)
|
||||
|
||||
### Features
|
||||
|
||||
* add read only access error tag ([c3c7b4c](https://github.com/standardnotes/snjs/commit/c3c7b4c12f9b23dfc8e4bf1d4af43f6307f64190))
|
||||
|
||||
## [1.16.2](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.16.1...@standardnotes/common@1.16.2) (2022-03-21)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.16.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.16.0...@standardnotes/common@1.16.1) (2022-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add demo user role ([aa7ebc8](https://github.com/standardnotes/snjs/commit/aa7ebc84ef1160688d2767b86a32719ce68a257b))
|
||||
|
||||
# [1.16.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.15.3...@standardnotes/common@1.16.0) (2022-03-16)
|
||||
|
||||
### Features
|
||||
|
||||
* delete file functionality ([#657](https://github.com/standardnotes/snjs/issues/657)) ([edec4f7](https://github.com/standardnotes/snjs/commit/edec4f7a65ef557ed5f47be4dddcf2b659ee28b4))
|
||||
|
||||
## [1.15.4](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.15.3...@standardnotes/common@1.15.4) (2022-03-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
## [1.15.3](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.15.1...@standardnotes/common@1.15.3) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [1.15.2](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.15.1...@standardnotes/common@1.15.2) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [1.15.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.15.0...@standardnotes/common@1.15.1) (2022-02-27)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
# [1.15.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.14.1...@standardnotes/common@1.15.0) (2022-02-25)
|
||||
|
||||
### Features
|
||||
|
||||
* extract core functionalities to separate packages ([#610](https://github.com/standardnotes/snjs/issues/610)) ([801547a](https://github.com/standardnotes/snjs/commit/801547a71614ad51a92fb249eaa184ed46a44aac))
|
||||
|
||||
## [1.14.1](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.14.0...@standardnotes/common@1.14.1) (2022-02-24)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/common
|
||||
|
||||
# [1.14.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.13.0...@standardnotes/common@1.14.0) (2022-02-22)
|
||||
|
||||
### Features
|
||||
|
||||
* extract services package ([#605](https://github.com/standardnotes/snjs/issues/605)) ([3966b10](https://github.com/standardnotes/snjs/commit/3966b10745c10ef5bb92871abb13ceb4ea631362))
|
||||
|
||||
# [1.13.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.12.0...@standardnotes/common@1.13.0) (2022-02-22)
|
||||
|
||||
### Features
|
||||
|
||||
* extract SNJS utils as a separate package ([#604](https://github.com/standardnotes/snjs/issues/604)) ([b28195c](https://github.com/standardnotes/snjs/commit/b28195c20be788eec8dabc44c5aff518f074cdd9))
|
||||
|
||||
# [1.12.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.11.0...@standardnotes/common@1.12.0) (2022-02-18)
|
||||
|
||||
### Features
|
||||
|
||||
* add item integrity hash model ([975474a](https://github.com/standardnotes/snjs/commit/975474a04c4b11edea381235fe38273db59fa770))
|
||||
|
||||
# [1.11.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.10.0...@standardnotes/common@1.11.0) (2022-02-16)
|
||||
|
||||
### Features
|
||||
|
||||
* add paid roles definition ([3432608](https://github.com/standardnotes/snjs/commit/34326086c16000397d994054e807dd3589b536db))
|
||||
|
||||
# [1.10.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.9.0...@standardnotes/common@1.10.0) (2022-02-10)
|
||||
|
||||
### Features
|
||||
|
||||
* move role names and suscription names from auth to common package ([5358c03](https://github.com/standardnotes/snjs/commit/5358c03ef113597bcdcf7b0f3e730c8014885a0f))
|
||||
|
||||
# [1.9.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.8.0...@standardnotes/common@1.9.0) (2022-02-07)
|
||||
|
||||
### Features
|
||||
|
||||
* dynamic features based on runtime env ([#590](https://github.com/standardnotes/snjs/issues/590)) ([060861a](https://github.com/standardnotes/snjs/commit/060861a6c5bc179e3e1987c2b63490888e153bbb))
|
||||
|
||||
# [1.8.0](https://github.com/standardnotes/snjs/compare/@standardnotes/common@1.7.0...@standardnotes/common@1.8.0) (2022-01-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct gitignore paths ([cefc0cf](https://github.com/standardnotes/snjs/commit/cefc0cfcf98e3e5378e055b8c46931b53b23195e))
|
||||
* include dist in static components ([d17ce0f](https://github.com/standardnotes/snjs/commit/d17ce0f67045c6e4c97bf4577709aa58794e72e6))
|
||||
|
||||
### Features
|
||||
|
||||
* remove server extension type ([#552](https://github.com/standardnotes/snjs/issues/552)) ([aa542f3](https://github.com/standardnotes/snjs/commit/aa542f3124c60fa81a0b271030b3c35415c54a62))
|
||||
|
||||
# 1.7.0 (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* rename email backup setting to email backup frequency ([25e7b46](https://github.com/standardnotes/snjs/commit/25e7b4620834711ac7f513ae893898c5eab1af53))
|
||||
|
||||
## 1.6.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* lock package versions ([8aa2ce6](https://github.com/standardnotes/snjs/commit/8aa2ce676b57598ab72840adf851869d8e769022))
|
||||
|
||||
## 1.6.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add publishing from package version by lerna ([80433d0](https://github.com/standardnotes/snjs/commit/80433d044f258095753482b8322d73aba3d9a9e4))
|
||||
|
||||
## 1.6.1 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove the ammend commit from lerna versioning ([f0400d9](https://github.com/standardnotes/snjs/commit/f0400d9a2f5a04eaece2e4c16da71166a2ddb251))
|
||||
|
||||
# 1.6.0 (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* add one drive backup frequency setting ([#522](https://github.com/standardnotes/snjs/issues/522)) ([c27827f](https://github.com/standardnotes/snjs/commit/c27827f8c7969dd32511c9c75122ece372132c83))
|
||||
|
||||
## 1.5.4 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove running tests upon deployment - ensured on PR status checks ([#523](https://github.com/standardnotes/snjs/issues/523)) ([5c795d1](https://github.com/standardnotes/snjs/commit/5c795d17b583d02955773576384e622c3ef7f418))
|
||||
|
||||
## 1.5.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* pr template ([#518](https://github.com/standardnotes/snjs/issues/518)) ([b445bb6](https://github.com/standardnotes/snjs/commit/b445bb64841217ae27c2514887629235be95d2a3))
|
||||
|
||||
## 1.5.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* checkout with personal access token ([773c1ef](https://github.com/standardnotes/snjs/commit/773c1ef91c4452ad411e928342060dcb59428e3c))
|
||||
|
||||
## 1.5.1 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* gpg signing with CI StandardNotes user ([d72f61c](https://github.com/standardnotes/snjs/commit/d72f61c23cd15b31d37340cc756d16526634b9ee))
|
||||
|
||||
# 1.5.0 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* versioning and package dependencies ([#509](https://github.com/standardnotes/snjs/issues/509)) ([fe1df94](https://github.com/standardnotes/snjs/commit/fe1df94eff3e90bcf9ba0cf45bdc44ac49204c71))
|
||||
|
||||
### Features
|
||||
|
||||
* add content decoder to common package ([504cf10](https://github.com/standardnotes/snjs/commit/504cf10d83c9cba6e8ee79ce138847a293a2f9e0))
|
||||
* add ContentType to common package ([#401](https://github.com/standardnotes/snjs/issues/401)) ([1152c02](https://github.com/standardnotes/snjs/commit/1152c020e30e60996b4830b66e07ec4183bbac24))
|
||||
* add SN|Privileges to content types ([#444](https://github.com/standardnotes/snjs/issues/444)) ([0eee358](https://github.com/standardnotes/snjs/commit/0eee3581e5f9f41f227c824adc92a0e15b8fa4b4))
|
||||
* extract settings and common package ([#372](https://github.com/standardnotes/snjs/issues/372)) ([4f89688](https://github.com/standardnotes/snjs/commit/4f89688054cdae88c001287c9fb3431debd0136c))
|
||||
* remove legacy mfa ([#495](https://github.com/standardnotes/snjs/issues/495)) ([b0498f4](https://github.com/standardnotes/snjs/commit/b0498f4fad85367e1b57c6deacb5d313331bf8db))
|
||||
* upgrade node engine versions to latest active LTS ([#462](https://github.com/standardnotes/snjs/issues/462)) ([686fc15](https://github.com/standardnotes/snjs/commit/686fc15030d302b474ebb7ef1cd4dcc48ec42359))
|
||||
19
packages/common/jest.config.js
Normal file
19
packages/common/jest.config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const base = require('../../jest.config');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json',
|
||||
},
|
||||
},
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 14,
|
||||
functions: 13,
|
||||
lines: 14,
|
||||
statements: 14
|
||||
}
|
||||
}
|
||||
};
|
||||
4
packages/common/linter.tsconfig.json
Normal file
4
packages/common/linter.tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
39
packages/common/package.json
Normal file
39
packages/common/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@standardnotes/common",
|
||||
"version": "1.25.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
"description": "Common types and utilities for Standard Notes projects",
|
||||
"main": "dist/src/index.js",
|
||||
"author": "Standard Notes",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"clean": "rm -fr dist",
|
||||
"prestart": "yarn clean",
|
||||
"start": "tsc -p tsconfig.json --watch",
|
||||
"prebuild": "yarn clean",
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test:unit": "jest spec --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^18.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"reflect-metadata": "^0.1.13"
|
||||
}
|
||||
}
|
||||
37
packages/common/src/Domain/Content/ContentDecoder.spec.ts
Normal file
37
packages/common/src/Domain/Content/ContentDecoder.spec.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { ContentDecoder } from './ContentDecoder'
|
||||
|
||||
describe('ContentDecoder', () => {
|
||||
const createDecoder = () => new ContentDecoder()
|
||||
|
||||
it('should decode content', () => {
|
||||
const content = '000eyJmb28iOiJiYXIifQ=='
|
||||
|
||||
expect(createDecoder().decode(content)).toEqual({
|
||||
foo: 'bar',
|
||||
})
|
||||
})
|
||||
|
||||
it('should decode content without padding', () => {
|
||||
const content = 'eyJmb28iOiJiYXIifQ=='
|
||||
|
||||
expect(createDecoder().decode(content, 0)).toEqual({
|
||||
foo: 'bar',
|
||||
})
|
||||
})
|
||||
|
||||
it('should encode content', () => {
|
||||
expect(
|
||||
createDecoder().encode({
|
||||
foo: 'bar',
|
||||
}),
|
||||
).toEqual('000eyJmb28iOiJiYXIifQ==')
|
||||
})
|
||||
|
||||
it('should return empty object on decoding failure', () => {
|
||||
const content = '032400eyJmb28iOiJiYXIifQ=='
|
||||
|
||||
expect(createDecoder().decode(content)).toEqual({})
|
||||
})
|
||||
})
|
||||
23
packages/common/src/Domain/Content/ContentDecoder.ts
Normal file
23
packages/common/src/Domain/Content/ContentDecoder.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ContentDecoderInterface } from './ContentDecoderInterface'
|
||||
|
||||
export class ContentDecoder implements ContentDecoderInterface {
|
||||
decode(content: string, leftPaddingLength = 3): Record<string, unknown> {
|
||||
try {
|
||||
const contentToDecode = leftPaddingLength > 0 ? content.substring(leftPaddingLength) : content
|
||||
const contentBuffer = Buffer.from(contentToDecode, 'base64')
|
||||
const decodedContent = contentBuffer.toString()
|
||||
|
||||
return JSON.parse(decodedContent)
|
||||
} catch (error) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
encode(content: Record<string, unknown>, leftPaddingLength = 3): string | undefined {
|
||||
const stringifiedContent = JSON.stringify(content)
|
||||
|
||||
const encodedContent = Buffer.from(stringifiedContent).toString('base64')
|
||||
|
||||
return encodedContent.padStart(encodedContent.length + leftPaddingLength, '0')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface ContentDecoderInterface {
|
||||
decode(content: string, leftPaddingLength?: number): Record<string, unknown>
|
||||
encode(content: Record<string, unknown>, leftPaddingLength?: number): string | undefined
|
||||
}
|
||||
44
packages/common/src/Domain/Content/ContentType.ts
Normal file
44
packages/common/src/Domain/Content/ContentType.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/* istanbul ignore file */
|
||||
export enum ContentType {
|
||||
Any = '*',
|
||||
Item = 'SF|Item',
|
||||
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]
|
||||
}
|
||||
2
packages/common/src/Domain/DataType/AnyRecord.ts
Normal file
2
packages/common/src/Domain/DataType/AnyRecord.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type AnyRecord = Partial<Record<string, any>>
|
||||
@@ -0,0 +1 @@
|
||||
export type ApplicationIdentifier = string
|
||||
@@ -0,0 +1 @@
|
||||
export type MicrosecondsTimestamp = number
|
||||
1
packages/common/src/Domain/DataType/Uuid.ts
Normal file
1
packages/common/src/Domain/DataType/Uuid.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type Uuid = string
|
||||
18
packages/common/src/Domain/Email/EmailMessageIdentifier.ts
Normal file
18
packages/common/src/Domain/Email/EmailMessageIdentifier.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export enum EmailMessageIdentifier {
|
||||
WELCOME_EMAIL = 'WELCOME_EMAIL',
|
||||
ACCOUNT_CLAIM = 'ACCOUNT_CLAIM',
|
||||
ACTIVATION_CODE = 'ACTIVATION_CODE',
|
||||
VERSION_ADOPTION_REPORT = 'VERSION_ADOPTION_REPORT',
|
||||
FAILED_DROPBOX_BACKUP = 'FAILED_DROPBOX_BACKUP',
|
||||
FAILED_GOOGLE_DRIVE_BACKUP = 'FAILED_GOOGLE_DRIVE_BACKUP',
|
||||
FAILED_ONE_DRIVE_BACKUP = 'FAILED_ONE_DRIVE_BACKUP',
|
||||
DATA_BACKUP = 'DATA_BACKUP',
|
||||
FAILED_BACKUP_ATTACHMENT_TOO_BIG = 'FAILED_BACKUP_ATTACHMENT_TOO_BIG',
|
||||
OFFLINE_SUBSCRIPTION_ACCESS = 'OFFLINE_SUBSCRIPTION_ACCESS',
|
||||
SIGN_IN = 'SIGN_IN',
|
||||
SHARED_SUBSCRIPTION_INVITATION = 'SHARED_SUBSCRIPTION_INVITATION',
|
||||
ENCOURAGE_EMAIL_BACKUPS = 'ENCOURAGE_EMAIL_BACKUPS',
|
||||
ENCOURAGE_SUBSCRIPTION_PURCHASING = 'ENCOURAGE_SUBSCRIPTION_PURCHASING',
|
||||
EXIT_INTERVIEW = 'EXIT_INTERVIEW',
|
||||
MARKETING_CAMPAIGN_FILES = 'MARKETING_CAMPAIGN_FILES',
|
||||
}
|
||||
12
packages/common/src/Domain/Error/ErrorTag.ts
Normal file
12
packages/common/src/Domain/Error/ErrorTag.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/* istanbul ignore file */
|
||||
export enum ErrorTag {
|
||||
MfaInvalid = 'mfa-invalid',
|
||||
MfaRequired = 'mfa-required',
|
||||
RefreshTokenInvalid = 'invalid-refresh-token',
|
||||
RefreshTokenExpired = 'expired-refresh-token',
|
||||
AccessTokenExpired = 'expired-access-token',
|
||||
ParametersInvalid = 'invalid-parameters',
|
||||
RevokedSession = 'revoked-session',
|
||||
AuthInvalid = 'invalid-auth',
|
||||
ReadOnlyAccess = 'read-only-access',
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { KeyParamsContent001 } from './KeyParamsContent001'
|
||||
import { KeyParamsContent002 } from './KeyParamsContent002'
|
||||
import { KeyParamsContent003 } from './KeyParamsContent003'
|
||||
import { KeyParamsContent004 } from './KeyParamsContent004'
|
||||
|
||||
export type AnyKeyParamsContent = KeyParamsContent001 | KeyParamsContent002 | KeyParamsContent003 | KeyParamsContent004
|
||||
10
packages/common/src/Domain/KeyParams/BaseKeyParams.ts
Normal file
10
packages/common/src/Domain/KeyParams/BaseKeyParams.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ProtocolVersion } from '../Protocol/ProtocolVersion'
|
||||
import { KeyParamsOrigination } from './KeyParamsOrigination'
|
||||
|
||||
export type BaseKeyParams = {
|
||||
/** Seconds since creation date */
|
||||
created?: string
|
||||
/** The event that lead to the creation of these params */
|
||||
origination?: KeyParamsOrigination
|
||||
version: ProtocolVersion
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { BaseKeyParams } from './BaseKeyParams'
|
||||
|
||||
export type KeyParamsContent001 = BaseKeyParams & {
|
||||
email: string
|
||||
pw_cost: number
|
||||
pw_salt: string
|
||||
pw_nonce: string
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { BaseKeyParams } from './BaseKeyParams'
|
||||
|
||||
export type KeyParamsContent002 = BaseKeyParams & {
|
||||
email: string
|
||||
pw_cost: number
|
||||
pw_salt: string
|
||||
pw_nonce: string
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { BaseKeyParams } from './BaseKeyParams'
|
||||
|
||||
export type KeyParamsContent003 = BaseKeyParams & {
|
||||
identifier: string
|
||||
pw_nonce: string
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { BaseKeyParams } from './BaseKeyParams'
|
||||
|
||||
export type KeyParamsContent004 = Required<BaseKeyParams> & {
|
||||
identifier: string
|
||||
pw_nonce: string
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export enum KeyParamsOrigination {
|
||||
Registration = 'registration',
|
||||
EmailChange = 'email-change',
|
||||
PasswordChange = 'password-change',
|
||||
ProtocolUpgrade = 'protocol-upgrade',
|
||||
PasscodeCreate = 'passcode-create',
|
||||
PasscodeChange = 'passcode-change',
|
||||
}
|
||||
56
packages/common/src/Domain/Protocol/ProtocolVersion.ts
Normal file
56
packages/common/src/Domain/Protocol/ProtocolVersion.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
export enum ProtocolVersion {
|
||||
V001 = '001',
|
||||
V002 = '002',
|
||||
V003 = '003',
|
||||
V004 = '004',
|
||||
}
|
||||
|
||||
export const ProtocolVersionLatest = ProtocolVersion.V004
|
||||
|
||||
/** The last protocol version to not use root-key based items keys */
|
||||
export const ProtocolVersionLastNonrootItemsKey = ProtocolVersion.V003
|
||||
|
||||
export const ProtocolExpirationDates: Partial<Record<ProtocolVersion, number>> = Object.freeze({
|
||||
[ProtocolVersion.V001]: Date.parse('2018-01-01'),
|
||||
[ProtocolVersion.V002]: Date.parse('2020-01-01'),
|
||||
})
|
||||
|
||||
export function isProtocolVersionExpired(version: ProtocolVersion) {
|
||||
const expireDate = ProtocolExpirationDates[version]
|
||||
if (!expireDate) {
|
||||
return false
|
||||
}
|
||||
|
||||
const expired = new Date().getTime() > expireDate
|
||||
return expired
|
||||
}
|
||||
|
||||
export const ProtocolVersionLength = 3
|
||||
|
||||
export function protocolVersionFromEncryptedString(string: string): ProtocolVersion {
|
||||
const version = string.substring(0, ProtocolVersionLength) as ProtocolVersion
|
||||
if (Object.values(ProtocolVersion).includes(version)) {
|
||||
return version
|
||||
}
|
||||
|
||||
throw Error(`Unrecognized protocol version ${version}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* -1 if a < b
|
||||
* 0 if a == b
|
||||
* 1 if a > b
|
||||
*/
|
||||
export function compareVersions(a: ProtocolVersion, b: ProtocolVersion): number {
|
||||
const aNum = Number(a)
|
||||
const bNum = Number(b)
|
||||
return aNum - bNum
|
||||
}
|
||||
|
||||
export function leftVersionGreaterThanOrEqualToRight(a: ProtocolVersion, b: ProtocolVersion): boolean {
|
||||
return compareVersions(a, b) >= 0
|
||||
}
|
||||
|
||||
export function isVersionLessThanOrEqualTo(input: ProtocolVersion, compareTo: ProtocolVersion): boolean {
|
||||
return compareVersions(input, compareTo) <= 0
|
||||
}
|
||||
4
packages/common/src/Domain/Role/PaidRoles.ts
Normal file
4
packages/common/src/Domain/Role/PaidRoles.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
/* istanbul ignore file */
|
||||
import { RoleName } from './RoleName'
|
||||
|
||||
export const PaidRoles = [RoleName.CoreUser, RoleName.PlusUser, RoleName.ProUser]
|
||||
7
packages/common/src/Domain/Role/RoleName.ts
Normal file
7
packages/common/src/Domain/Role/RoleName.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/* istanbul ignore file */
|
||||
export enum RoleName {
|
||||
CoreUser = 'CORE_USER',
|
||||
PlusUser = 'PLUS_USER',
|
||||
ProUser = 'PRO_USER',
|
||||
FilesBetaUser = 'FILES_BETA_USER',
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* istanbul ignore file */
|
||||
export enum SubscriptionName {
|
||||
PlusPlan = 'PLUS_PLAN',
|
||||
ProPlan = 'PRO_PLAN',
|
||||
}
|
||||
20
packages/common/src/Domain/index.ts
Normal file
20
packages/common/src/Domain/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export * from './Content/ContentType'
|
||||
export * from './Content/ContentDecoder'
|
||||
export * from './Content/ContentDecoderInterface'
|
||||
export * from './DataType/AnyRecord'
|
||||
export * from './DataType/MicrosecondsTimestamp'
|
||||
export * from './DataType/Uuid'
|
||||
export * from './DataType/ApplicationIdentifier'
|
||||
export * from './Email/EmailMessageIdentifier'
|
||||
export * from './Error/ErrorTag'
|
||||
export * from './KeyParams/AnyKeyParamsContent'
|
||||
export * from './KeyParams/BaseKeyParams'
|
||||
export * from './KeyParams/KeyParamsContent001'
|
||||
export * from './KeyParams/KeyParamsContent002'
|
||||
export * from './KeyParams/KeyParamsContent003'
|
||||
export * from './KeyParams/KeyParamsContent004'
|
||||
export * from './KeyParams/KeyParamsOrigination'
|
||||
export * from './Protocol/ProtocolVersion'
|
||||
export * from './Role/PaidRoles'
|
||||
export * from './Role/RoleName'
|
||||
export * from './Subscription/SubscriptionName'
|
||||
1
packages/common/src/index.ts
Normal file
1
packages/common/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Domain'
|
||||
11
packages/common/tsconfig.json
Normal file
11
packages/common/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "./dist",
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
@@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.7.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.4...@standardnotes/domain-events-infra@1.7.5) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||
|
||||
## [1.7.4](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.3...@standardnotes/domain-events-infra@1.7.4) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/domain-events-infra",
|
||||
"version": "1.7.4",
|
||||
"version": "1.7.5",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.39.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.38.0...@standardnotes/domain-events@2.39.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/server/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# [2.38.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.37.1...@standardnotes/domain-events@2.38.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/domain-events",
|
||||
"version": "2.38.0",
|
||||
"version": "2.39.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -24,7 +24,7 @@
|
||||
"test:unit": "jest spec --coverage --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"@standardnotes/features": "^1.47.0",
|
||||
"@standardnotes/predicates": "workspace:*",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.4.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.3.0...@standardnotes/files-server@1.4.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/files/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# [1.3.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.2.0...@standardnotes/files-server@1.3.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/files/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
# [1.2.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.1.14...@standardnotes/files-server@1.2.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/files-server",
|
||||
"version": "1.2.0",
|
||||
"version": "1.4.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -27,13 +27,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"@standardnotes/sncrypto-common": "^1.9.0",
|
||||
"@standardnotes/sncrypto-node": "^1.8.3",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1158.0",
|
||||
"connect-busboy": "^1.0.0",
|
||||
"cors": "^2.8.5",
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.2.0](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.1.1...@standardnotes/predicates@1.2.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/server/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
## [1.1.1](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.1.0...@standardnotes/predicates@1.1.1) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/predicates",
|
||||
"version": "1.1.1",
|
||||
"version": "1.2.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -33,7 +33,7 @@
|
||||
"ts-jest": "^27.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.5.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.4.0...@standardnotes/scheduler-server@1.5.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/server/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# [1.4.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.3.2...@standardnotes/scheduler-server@1.4.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/server/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
## [1.3.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.3.1...@standardnotes/scheduler-server@1.3.2) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/scheduler-server",
|
||||
"version": "1.3.2",
|
||||
"version": "1.5.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -26,11 +26,11 @@
|
||||
"dependencies": {
|
||||
"@newrelic/winston-enricher": "^2.1.0",
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/predicates": "workspace:*",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1158.0",
|
||||
"dayjs": "^1.11.3",
|
||||
"dotenv": "8.2.0",
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.2.0](https://github.com/standardnotes/server/compare/@standardnotes/security@1.1.0...@standardnotes/security@1.2.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/server/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# 1.1.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/security",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -26,7 +26,7 @@
|
||||
"test:unit": "jest spec --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.5.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.4.0...@standardnotes/syncing-server@1.5.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add common package ([fd4ee21](https://github.com/standardnotes/syncing-server-js/commit/fd4ee2123dc72b4d8755504d57bced608c1ab928))
|
||||
|
||||
# [1.4.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.3.0...@standardnotes/syncing-server@1.4.0) (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/syncing-server-js/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
# [1.3.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.2.2...@standardnotes/syncing-server@1.3.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/syncing-server",
|
||||
"version": "1.3.0",
|
||||
"version": "1.5.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -27,14 +27,14 @@
|
||||
"@newrelic/winston-enricher": "^2.1.0",
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/analytics": "workspace:*",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/common": "workspace:*",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/payloads": "^1.5.1",
|
||||
"@standardnotes/responses": "^1.6.39",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"@standardnotes/settings": "1.15.0",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1159.0",
|
||||
"axios": "0.24.0",
|
||||
"cors": "2.8.5",
|
||||
|
||||
1
packages/time/.eslintignore
Normal file
1
packages/time/.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
6
packages/time/.eslintrc
Normal file
6
packages/time/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../../.eslintrc",
|
||||
"parserOptions": {
|
||||
"project": "./linter.tsconfig.json"
|
||||
}
|
||||
}
|
||||
188
packages/time/CHANGELOG.md
Normal file
188
packages/time/CHANGELOG.md
Normal file
@@ -0,0 +1,188 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 1.9.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add time package ([565e890](https://github.com/standardnotes/server/commit/565e890973b1d96544bb750fdd700d58f8dad088))
|
||||
|
||||
## [1.7.2](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.7.1...@standardnotes/time@1.7.2) (2022-07-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.7.1](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.7.0...@standardnotes/time@1.7.1) (2022-06-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* upgrade microtime package version ([65ec0e6](https://github.com/standardnotes/snjs/commit/65ec0e6f3a72718aa490f30a168fbdd13b5a4c76))
|
||||
|
||||
# [1.7.0](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.10...@standardnotes/time@1.7.0) (2022-05-30)
|
||||
|
||||
### Features
|
||||
|
||||
* getting timestamp in seconds ([24c3215](https://github.com/standardnotes/snjs/commit/24c3215fd0797b60eec10a88583c0ed8c7020387))
|
||||
|
||||
## [1.6.10](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.9...@standardnotes/time@1.6.10) (2022-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add converting string dates to seconds ([f1ccbc9](https://github.com/standardnotes/snjs/commit/f1ccbc929fbd9a452ca87cbaf88bf4ce30855c91))
|
||||
|
||||
## [1.6.9](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.7...@standardnotes/time@1.6.9) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.8](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.7...@standardnotes/time@1.6.8) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.7](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.6...@standardnotes/time@1.6.7) (2022-04-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.6](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.5...@standardnotes/time@1.6.6) (2022-04-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.5](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.4...@standardnotes/time@1.6.5) (2022-04-11)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.4](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.3...@standardnotes/time@1.6.4) (2022-03-31)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.6.3](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.1...@standardnotes/time@1.6.3) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [1.6.2](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.1...@standardnotes/time@1.6.2) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [1.6.1](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.6.0...@standardnotes/time@1.6.1) (2022-02-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* timer tests with utc dates ([c0b15a2](https://github.com/standardnotes/snjs/commit/c0b15a2ae45632615fa5e4064d5210bdd97ff237))
|
||||
|
||||
# [1.6.0](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.5.0...@standardnotes/time@1.6.0) (2022-02-09)
|
||||
|
||||
### Features
|
||||
|
||||
* add date formatting ([4c65cb8](https://github.com/standardnotes/snjs/commit/4c65cb82b1acd842f7e35fb79389de95bef0ddcf))
|
||||
|
||||
# [1.5.0](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.5...@standardnotes/time@1.5.0) (2022-02-09)
|
||||
|
||||
### Features
|
||||
|
||||
* add calculating time difference in days ([1348065](https://github.com/standardnotes/snjs/commit/1348065eb2bd7a559046a0f125751b32ad224d93))
|
||||
|
||||
## [1.4.5](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.4...@standardnotes/time@1.4.5) (2021-12-29)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.4.4](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.3...@standardnotes/time@1.4.4) (2021-12-29)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.4.3](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.2...@standardnotes/time@1.4.3) (2021-12-29)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/time
|
||||
|
||||
## [1.4.2](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.1...@standardnotes/time@1.4.2) (2021-12-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove code coverage reports from repository ([61f5dfd](https://github.com/standardnotes/snjs/commit/61f5dfd8e9698e36142df131ad210749865f70f4))
|
||||
|
||||
## [1.4.1](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.4.0...@standardnotes/time@1.4.1) (2021-12-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct gitignore paths ([cefc0cf](https://github.com/standardnotes/snjs/commit/cefc0cfcf98e3e5378e055b8c46931b53b23195e))
|
||||
* include dist in static components ([d17ce0f](https://github.com/standardnotes/snjs/commit/d17ce0f67045c6e4c97bf4577709aa58794e72e6))
|
||||
|
||||
# 1.4.0 (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* rename email backup setting to email backup frequency ([25e7b46](https://github.com/standardnotes/snjs/commit/25e7b4620834711ac7f513ae893898c5eab1af53))
|
||||
|
||||
## 1.3.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* lock package versions ([8aa2ce6](https://github.com/standardnotes/snjs/commit/8aa2ce676b57598ab72840adf851869d8e769022))
|
||||
|
||||
## 1.3.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add publishing from package version by lerna ([80433d0](https://github.com/standardnotes/snjs/commit/80433d044f258095753482b8322d73aba3d9a9e4))
|
||||
|
||||
## 1.3.1 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove the ammend commit from lerna versioning ([f0400d9](https://github.com/standardnotes/snjs/commit/f0400d9a2f5a04eaece2e4c16da71166a2ddb251))
|
||||
|
||||
# 1.3.0 (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* add one drive backup frequency setting ([#522](https://github.com/standardnotes/snjs/issues/522)) ([c27827f](https://github.com/standardnotes/snjs/commit/c27827f8c7969dd32511c9c75122ece372132c83))
|
||||
|
||||
## 1.2.4 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove running tests upon deployment - ensured on PR status checks ([#523](https://github.com/standardnotes/snjs/issues/523)) ([5c795d1](https://github.com/standardnotes/snjs/commit/5c795d17b583d02955773576384e622c3ef7f418))
|
||||
|
||||
## 1.2.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* pr template ([#518](https://github.com/standardnotes/snjs/issues/518)) ([b445bb6](https://github.com/standardnotes/snjs/commit/b445bb64841217ae27c2514887629235be95d2a3))
|
||||
|
||||
## 1.2.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* checkout with personal access token ([773c1ef](https://github.com/standardnotes/snjs/commit/773c1ef91c4452ad411e928342060dcb59428e3c))
|
||||
|
||||
## 1.2.1 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* gpg signing with CI StandardNotes user ([d72f61c](https://github.com/standardnotes/snjs/commit/d72f61c23cd15b31d37340cc756d16526634b9ee))
|
||||
|
||||
# [1.2.0](https://github.com/standardnotes/snjs/compare/@standardnotes/time@1.1.0...@standardnotes/time@1.2.0) (2021-12-22)
|
||||
|
||||
### Features
|
||||
|
||||
* add converting date to microseconds ([#516](https://github.com/standardnotes/snjs/issues/516)) ([a3dfd9e](https://github.com/standardnotes/snjs/commit/a3dfd9eccb275734ecd381cfb9fbb3fa132aa0ac))
|
||||
|
||||
# 1.1.0 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add n days ahead method for timer ([#443](https://github.com/standardnotes/snjs/issues/443)) ([63926da](https://github.com/standardnotes/snjs/commit/63926da495c8b0fbaf1cddb595f7e2a90185b207))
|
||||
* timer specs ([e782a14](https://github.com/standardnotes/snjs/commit/e782a14b023954b1b9d112111d4bc15ed746a8ae))
|
||||
* versioning and package dependencies ([#509](https://github.com/standardnotes/snjs/issues/509)) ([fe1df94](https://github.com/standardnotes/snjs/commit/fe1df94eff3e90bcf9ba0cf45bdc44ac49204c71))
|
||||
|
||||
### Features
|
||||
|
||||
* add converting date to milliseconds ([#513](https://github.com/standardnotes/snjs/issues/513)) ([088bfcf](https://github.com/standardnotes/snjs/commit/088bfcf37ed98a5385735cd7c5ce8155bf276b16))
|
||||
* add method for getting n days ago date ([#434](https://github.com/standardnotes/snjs/issues/434)) ([4aa91c1](https://github.com/standardnotes/snjs/commit/4aa91c10a3612bff7f1c10a8660e1da4d5cbc492))
|
||||
* add n-hours ahead and ago methods for timer ([7ced52d](https://github.com/standardnotes/snjs/commit/7ced52db6dabccb8f1c203b73d6237be75ed4fb7))
|
||||
* add time package ([#311](https://github.com/standardnotes/snjs/issues/311)) ([f50d8aa](https://github.com/standardnotes/snjs/commit/f50d8aa11dd8c72f6ae03c281fc00a048937f623))
|
||||
* features instead of permissions ([#385](https://github.com/standardnotes/snjs/issues/385)) ([b53e967](https://github.com/standardnotes/snjs/commit/b53e967297bc472ed11aed79af79d0ae5b36d101))
|
||||
* upgrade node engine versions to latest active LTS ([#462](https://github.com/standardnotes/snjs/issues/462)) ([686fc15](https://github.com/standardnotes/snjs/commit/686fc15030d302b474ebb7ef1cd4dcc48ec42359))
|
||||
11
packages/time/jest.config.js
Normal file
11
packages/time/jest.config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const base = require('../../jest.config');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json',
|
||||
},
|
||||
}
|
||||
};
|
||||
4
packages/time/linter.tsconfig.json
Normal file
4
packages/time/linter.tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
39
packages/time/package.json
Normal file
39
packages/time/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@standardnotes/time",
|
||||
"version": "1.9.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
"description": "Utilities for time processing and calculation",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Standard Notes",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"clean": "rm -fr dist",
|
||||
"prebuild": "yarn clean",
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test:unit": "jest spec --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"dayjs": "^1.10.8",
|
||||
"microtime": "^3.1.0",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/microtime": "^2.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3"
|
||||
}
|
||||
}
|
||||
4
packages/time/src/Domain/Time/Time.ts
Normal file
4
packages/time/src/Domain/Time/Time.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum Time {
|
||||
MicrosecondsInASecond = 1_000_000,
|
||||
MicrosecondsInAMillisecond = 1_000,
|
||||
}
|
||||
111
packages/time/src/Domain/Time/Timer.spec.ts
Normal file
111
packages/time/src/Domain/Time/Timer.spec.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { Timer } from './Timer'
|
||||
|
||||
describe('Timer', () => {
|
||||
const createTimer = () => new Timer()
|
||||
|
||||
it('should return a timestamp in microseconds', () => {
|
||||
const timestamp = createTimer().getTimestampInMicroseconds()
|
||||
expect(`${timestamp}`.length).toEqual(16)
|
||||
})
|
||||
|
||||
it('should return a timestamp in seconds', () => {
|
||||
const timestamp = createTimer().getTimestampInSeconds()
|
||||
expect(`${timestamp}`.length).toEqual(10)
|
||||
})
|
||||
|
||||
it('should return a utc date', () => {
|
||||
const date = createTimer().getUTCDate()
|
||||
expect(date).toBeInstanceOf(Date)
|
||||
})
|
||||
|
||||
it('should return a utc date n days ago', () => {
|
||||
const date = createTimer().getUTCDate()
|
||||
const dateNDaysAgo = createTimer().getUTCDateNDaysAgo(4)
|
||||
|
||||
expect(+date - +dateNDaysAgo >= 4 * 24 * 3600).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should return a utc date n days ahead', () => {
|
||||
const date = createTimer().getUTCDate()
|
||||
const dateNDaysAhead = createTimer().getUTCDateNDaysAhead(4)
|
||||
|
||||
expect(+dateNDaysAhead - +date >= 4 * 24 * 3600).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should calculate days difference between now and a given date', () => {
|
||||
const dateNDaysAgo = createTimer().getUTCDateNDaysAgo(4)
|
||||
|
||||
expect(createTimer().dateWasNDaysAgo(dateNDaysAgo)).toEqual(4)
|
||||
})
|
||||
|
||||
it('should return a utc date n hours ago', () => {
|
||||
const date = createTimer().getUTCDate()
|
||||
const dateNHoursAgo = createTimer().getUTCDateNHoursAgo(4)
|
||||
|
||||
expect(+date - +dateNHoursAgo >= 4 * 3600).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should return a utc date n hours ahead', () => {
|
||||
const date = createTimer().getUTCDate()
|
||||
const dateNHoursAhead = createTimer().getUTCDateNHoursAhead(4)
|
||||
|
||||
expect(+dateNHoursAhead - +date >= 4 * 3600).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should convert a date to milliseconds', () => {
|
||||
const timestamp = createTimer().convertDateToMilliseconds(new Date(Date.UTC(2021, 2, 29, 12, 13, 45)))
|
||||
expect(timestamp).toEqual(1617020025000)
|
||||
})
|
||||
|
||||
it('should convert a date to microseconds', () => {
|
||||
const timestamp = createTimer().convertDateToMicroseconds(new Date(Date.UTC(2021, 2, 29, 8, 0, 5, 233)))
|
||||
expect(timestamp).toEqual(1617004805000000)
|
||||
})
|
||||
|
||||
it('should convert a date to iso string', () => {
|
||||
const isoString = createTimer().convertDateToISOString(new Date(Date.UTC(2021, 2, 29, 8, 0, 5)))
|
||||
expect(isoString).toEqual('2021-03-29T08:00:05.000Z')
|
||||
})
|
||||
|
||||
it('should convert a string date to microseconds', () => {
|
||||
const timestamp = createTimer().convertStringDateToMicroseconds('2021-03-29 08:00:05.233Z')
|
||||
expect(timestamp).toEqual(1617004805233000)
|
||||
})
|
||||
|
||||
it('should convert a string date to seconds', () => {
|
||||
const timestamp = createTimer().convertStringDateToSeconds('2021-03-29 08:00:05.233Z')
|
||||
expect(timestamp).toEqual(1617004805)
|
||||
})
|
||||
|
||||
it('should convert microseconds to string date', () => {
|
||||
expect(createTimer().convertMicrosecondsToStringDate(1617004805233123)).toEqual('2021-03-29T08:00:05.233123Z')
|
||||
})
|
||||
|
||||
it('should convert a string date to milliseconds', () => {
|
||||
const timestamp = createTimer().convertStringDateToMilliseconds('Mon Mar 29 2021 12:13:45 GMT+0200')
|
||||
expect(timestamp).toEqual(1617012825000)
|
||||
})
|
||||
|
||||
it('should convert a string date to date', () => {
|
||||
const date = createTimer().convertStringDateToDate('Mon Mar 29 2021 12:13:45 GMT+0200')
|
||||
expect(date).toEqual(new Date(1617012825000))
|
||||
})
|
||||
|
||||
it('should convert microseconds to date', () => {
|
||||
expect(createTimer().convertMicrosecondsToDate(1617004805233123)).toEqual(new Date('2021-03-29T08:00:05.233123Z'))
|
||||
})
|
||||
|
||||
it('should convert microseconds to milliseconds', () => {
|
||||
expect(createTimer().convertMicrosecondsToMilliseconds(1616164633241312)).toEqual(1616164633241)
|
||||
})
|
||||
|
||||
it('should convert microseconds to seconds', () => {
|
||||
expect(createTimer().convertMicrosecondsToSeconds(1616164633241312)).toEqual(1616164633)
|
||||
})
|
||||
|
||||
it('should format date', () => {
|
||||
expect(createTimer().formatDate(new Date('2021-03-29T08:00:05.233123Z'), 'YYYY-MM-DD')).toEqual('2021-03-29')
|
||||
})
|
||||
})
|
||||
95
packages/time/src/Domain/Time/Timer.ts
Normal file
95
packages/time/src/Domain/Time/Timer.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import * as dayjs from 'dayjs'
|
||||
import * as utc from 'dayjs/plugin/utc'
|
||||
import * as microtime from 'microtime'
|
||||
import { Time } from './Time'
|
||||
import { TimerInterface } from './TimerInterface'
|
||||
|
||||
export class Timer implements TimerInterface {
|
||||
constructor() {
|
||||
dayjs.extend(utc)
|
||||
}
|
||||
|
||||
formatDate(date: Date, format: string): string {
|
||||
return dayjs.utc(date).format(format)
|
||||
}
|
||||
|
||||
convertDateToMilliseconds(date: Date): number {
|
||||
return this.convertStringDateToMilliseconds(date.toString())
|
||||
}
|
||||
|
||||
convertDateToMicroseconds(date: Date): number {
|
||||
return this.convertStringDateToMicroseconds(date.toString())
|
||||
}
|
||||
|
||||
convertMicrosecondsToSeconds(microseconds: number): number {
|
||||
return Math.floor(microseconds / Time.MicrosecondsInASecond)
|
||||
}
|
||||
|
||||
getTimestampInMicroseconds(): number {
|
||||
return microtime.now()
|
||||
}
|
||||
|
||||
getTimestampInSeconds(): number {
|
||||
return this.convertMicrosecondsToSeconds(this.getTimestampInMicroseconds())
|
||||
}
|
||||
|
||||
getUTCDate(): Date {
|
||||
return dayjs.utc().toDate()
|
||||
}
|
||||
|
||||
getUTCDateNDaysAgo(n: number): Date {
|
||||
return dayjs.utc().subtract(n, 'days').toDate()
|
||||
}
|
||||
|
||||
getUTCDateNDaysAhead(n: number): Date {
|
||||
return dayjs.utc().add(n, 'days').toDate()
|
||||
}
|
||||
|
||||
getUTCDateNHoursAgo(n: number): Date {
|
||||
return dayjs.utc().subtract(n, 'hours').toDate()
|
||||
}
|
||||
|
||||
getUTCDateNHoursAhead(n: number): Date {
|
||||
return dayjs.utc().add(n, 'hours').toDate()
|
||||
}
|
||||
|
||||
convertStringDateToDate(date: string): Date {
|
||||
return dayjs.utc(date).toDate()
|
||||
}
|
||||
|
||||
convertDateToISOString(date: Date): string {
|
||||
return dayjs.utc(date).toISOString()
|
||||
}
|
||||
|
||||
dateWasNDaysAgo(date: Date): number {
|
||||
return dayjs.utc().diff(date, 'days')
|
||||
}
|
||||
|
||||
convertStringDateToMicroseconds(date: string): number {
|
||||
return this.convertStringDateToMilliseconds(date) * Time.MicrosecondsInAMillisecond
|
||||
}
|
||||
|
||||
convertStringDateToMilliseconds(date: string): number {
|
||||
return dayjs.utc(date).valueOf()
|
||||
}
|
||||
|
||||
convertStringDateToSeconds(date: string): number {
|
||||
return this.convertMicrosecondsToSeconds(this.convertStringDateToMicroseconds(date))
|
||||
}
|
||||
|
||||
convertMicrosecondsToMilliseconds(microseconds: number): number {
|
||||
return Math.floor(microseconds / Time.MicrosecondsInAMillisecond)
|
||||
}
|
||||
|
||||
convertMicrosecondsToStringDate(microseconds: number): string {
|
||||
const milliseconds = this.convertMicrosecondsToMilliseconds(microseconds)
|
||||
|
||||
const microsecondsString = microseconds.toString().substring(13)
|
||||
|
||||
return dayjs.utc(milliseconds).format(`YYYY-MM-DDTHH:mm:ss.SSS${microsecondsString}[Z]`)
|
||||
}
|
||||
|
||||
convertMicrosecondsToDate(microseconds: number): Date {
|
||||
return this.convertStringDateToDate(this.convertMicrosecondsToStringDate(microseconds))
|
||||
}
|
||||
}
|
||||
22
packages/time/src/Domain/Time/TimerInterface.ts
Normal file
22
packages/time/src/Domain/Time/TimerInterface.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface TimerInterface {
|
||||
getTimestampInMicroseconds(): number
|
||||
getTimestampInSeconds(): number
|
||||
getUTCDate(): Date
|
||||
getUTCDateNDaysAgo(n: number): Date
|
||||
getUTCDateNDaysAhead(n: number): Date
|
||||
getUTCDateNHoursAgo(n: number): Date
|
||||
getUTCDateNHoursAhead(n: number): Date
|
||||
convertDateToMilliseconds(date: Date): number
|
||||
convertDateToMicroseconds(date: Date): number
|
||||
convertDateToISOString(date: Date): string
|
||||
convertStringDateToDate(date: string): Date
|
||||
convertStringDateToMicroseconds(date: string): number
|
||||
convertStringDateToMilliseconds(date: string): number
|
||||
convertStringDateToSeconds(date: string): number
|
||||
convertMicrosecondsToMilliseconds(microseconds: number): number
|
||||
convertMicrosecondsToSeconds(microseconds: number): number
|
||||
convertMicrosecondsToStringDate(microseconds: number): string
|
||||
convertMicrosecondsToDate(microseconds: number): Date
|
||||
formatDate(date: Date, format: string): string
|
||||
dateWasNDaysAgo(date: Date): number
|
||||
}
|
||||
3
packages/time/src/Domain/index.ts
Normal file
3
packages/time/src/Domain/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './Time/Time'
|
||||
export * from './Time/Timer'
|
||||
export * from './Time/TimerInterface'
|
||||
1
packages/time/src/index.ts
Normal file
1
packages/time/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Domain'
|
||||
11
packages/time/tsconfig.json
Normal file
11
packages/time/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "./dist",
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
@@ -31,6 +31,9 @@
|
||||
{
|
||||
"path": "./packages/auth"
|
||||
},
|
||||
{
|
||||
"path": "./packages/common"
|
||||
},
|
||||
{
|
||||
"path": "./packages/domain-events"
|
||||
},
|
||||
@@ -51,6 +54,9 @@
|
||||
},
|
||||
{
|
||||
"path": "./packages/syncing-server"
|
||||
},
|
||||
{
|
||||
"path": "./packages/time"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
67
yarn.lock
67
yarn.lock
@@ -1964,7 +1964,7 @@ __metadata:
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/cors": ^2.8.9
|
||||
"@types/express": ^4.17.11
|
||||
"@types/ioredis": ^4.28.10
|
||||
@@ -2018,7 +2018,7 @@ __metadata:
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/analytics": "workspace:*"
|
||||
"@standardnotes/api": ^1.1.19
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/features": ^1.47.0
|
||||
@@ -2028,7 +2028,7 @@ __metadata:
|
||||
"@standardnotes/settings": ^1.15.0
|
||||
"@standardnotes/sncrypto-common": ^1.9.0
|
||||
"@standardnotes/sncrypto-node": ^1.8.3
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/bcryptjs": ^2.4.2
|
||||
"@types/cors": ^2.8.9
|
||||
"@types/express": ^4.17.11
|
||||
@@ -2079,12 +2079,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@standardnotes/common@npm:^1.19.1, @standardnotes/common@npm:^1.23.1":
|
||||
version: 1.23.1
|
||||
resolution: "@standardnotes/common@npm:1.23.1"
|
||||
checksum: f498f4c469f7b9cdfc08b7648077832a2a214d844f012d02d73c2c418fab221af3302570cc6b1957b5ed481b55237f95bc24fc5c231162bfcdf8730333d38405
|
||||
languageName: node
|
||||
linkType: hard
|
||||
"@standardnotes/common@^1.19.1, @standardnotes/common@^1.23.1, @standardnotes/common@workspace:*, @standardnotes/common@workspace:packages/common":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/common@workspace:packages/common"
|
||||
dependencies:
|
||||
"@types/jest": ^27.4.1
|
||||
"@types/node": ^18.0.0
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
jest: ^27.5.1
|
||||
reflect-metadata: ^0.1.13
|
||||
ts-jest: ^27.1.3
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/config@npm:2.4.3":
|
||||
version: 2.4.3
|
||||
@@ -2124,7 +2131,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/domain-events@workspace:packages/domain-events"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@standardnotes/features": ^1.47.0
|
||||
"@standardnotes/predicates": "workspace:*"
|
||||
"@standardnotes/security": "workspace:*"
|
||||
@@ -2168,14 +2175,14 @@ __metadata:
|
||||
resolution: "@standardnotes/files-server@workspace:packages/files"
|
||||
dependencies:
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@standardnotes/config": 2.4.3
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@standardnotes/sncrypto-common": ^1.9.0
|
||||
"@standardnotes/sncrypto-node": ^1.8.3
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/connect-busboy": ^1.0.0
|
||||
"@types/cors": ^2.8.9
|
||||
"@types/express": ^4.17.11
|
||||
@@ -2242,7 +2249,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/predicates@workspace:packages/predicates"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@types/jest": ^27.4.1
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
@@ -2269,11 +2276,11 @@ __metadata:
|
||||
dependencies:
|
||||
"@newrelic/winston-enricher": ^2.1.0
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/predicates": "workspace:*"
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/ioredis": ^4.28.10
|
||||
"@types/jest": ^28.1.2
|
||||
"@types/newrelic": ^7.0.3
|
||||
@@ -2300,7 +2307,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/security@workspace:packages/security"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@types/jest": ^27.4.1
|
||||
"@types/jsonwebtoken": ^8.5.8
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
@@ -2381,14 +2388,14 @@ __metadata:
|
||||
"@newrelic/winston-enricher": ^2.1.0
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/analytics": "workspace:*"
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/common": "workspace:*"
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/payloads": ^1.5.1
|
||||
"@standardnotes/responses": ^1.6.39
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@standardnotes/settings": 1.15.0
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/cors": ^2.8.9
|
||||
"@types/dotenv": ^8.2.0
|
||||
"@types/express": ^4.17.9
|
||||
@@ -2428,16 +2435,21 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/time@npm:^1.7.1":
|
||||
version: 1.7.1
|
||||
resolution: "@standardnotes/time@npm:1.7.1"
|
||||
"@standardnotes/time@workspace:*, @standardnotes/time@workspace:packages/time":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/time@workspace:packages/time"
|
||||
dependencies:
|
||||
"@types/jest": ^27.4.1
|
||||
"@types/microtime": ^2.1.0
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
dayjs: ^1.10.8
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
jest: ^27.5.1
|
||||
microtime: ^3.1.0
|
||||
reflect-metadata: ^0.1.13
|
||||
checksum: ccb9c4af73d2c77d5b1cfea480930e3a30e87fb426eee3c60eb0ce0f259fa5c1f9b1b29fdc52c72d321821791e3bdc141e4af0bfc668662863012743332c5407
|
||||
languageName: node
|
||||
linkType: hard
|
||||
ts-jest: ^27.1.3
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/utils@npm:^1.4.6, @standardnotes/utils@npm:^1.6.12":
|
||||
version: 1.6.12
|
||||
@@ -2731,6 +2743,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/microtime@npm:^2.1.0":
|
||||
version: 2.1.0
|
||||
resolution: "@types/microtime@npm:2.1.0"
|
||||
checksum: 6c23131fe46fd1b059c8d7e474a5ab60e703cf0f4a6ab0e3dbe36f1d394359fb4712dca696ff891b15482855465e6febc16acc56eaaf500864283d758b0c8dca
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/mime@npm:^1":
|
||||
version: 1.3.2
|
||||
resolution: "@types/mime@npm:1.3.2"
|
||||
|
||||
Reference in New Issue
Block a user