mirror of
https://github.com/standardnotes/server
synced 2026-01-25 02:01:08 -05:00
Compare commits
7 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62caa840ef | ||
|
|
565e890973 | ||
|
|
84c4642ced | ||
|
|
699164eba5 | ||
|
|
d86928f1b4 | ||
|
|
06fc077f1b | ||
|
|
97ba31f345 |
75
.pnp.cjs
generated
75
.pnp.cjs
generated
@@ -52,9 +52,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"name": "@standardnotes/scheduler-server",\
|
||||
"reference": "workspace:packages/scheduler"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/security",\
|
||||
"reference": "workspace:packages/security"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/syncing-server",\
|
||||
"reference": "workspace:packages/syncing-server"\
|
||||
},\
|
||||
{\
|
||||
"name": "@standardnotes/time",\
|
||||
"reference": "workspace:packages/time"\
|
||||
}\
|
||||
],\
|
||||
"enableTopLevelFallback": true,\
|
||||
@@ -68,8 +76,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@standardnotes/files-server", ["workspace:packages/files"]],\
|
||||
["@standardnotes/predicates", ["workspace:packages/predicates"]],\
|
||||
["@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": [\
|
||||
],\
|
||||
@@ -2674,10 +2684,10 @@ 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/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/time", "npm:1.7.1"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/time", "workspace:packages/time"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/express", "npm:4.17.13"],\
|
||||
["@types/ioredis", "npm:4.28.10"],\
|
||||
@@ -2730,17 +2740,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/analytics", "workspace:packages/analytics"],\
|
||||
["@standardnotes/api", "npm:1.1.19"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/responses", "npm:1.6.39"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@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"],\
|
||||
@@ -2810,10 +2820,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./packages/domain-events/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@standardnotes/features", "npm:1.50.0"],\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@types/jest", "npm:28.1.4"],\
|
||||
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
|
||||
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
|
||||
@@ -2881,14 +2891,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/files-server", "workspace:packages/files"],\
|
||||
["@sentry/node", "npm:7.5.0"],\
|
||||
["@standardnotes/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@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"],\
|
||||
@@ -2993,7 +3003,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@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"],\
|
||||
@@ -3017,6 +3027,24 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/security", [\
|
||||
["workspace:packages/security", {\
|
||||
"packageLocation": "./packages/security/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@types/jest", "npm:27.5.2"],\
|
||||
["@types/jsonwebtoken", "npm:8.5.8"],\
|
||||
["@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"],\
|
||||
["jsonwebtoken", "npm:8.5.1"],\
|
||||
["reflect-metadata", "npm:0.1.13"],\
|
||||
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.1.5"]\
|
||||
],\
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
]],\
|
||||
["@standardnotes/server-monorepo", [\
|
||||
["workspace:.", {\
|
||||
"packageLocation": "./",\
|
||||
@@ -3095,14 +3123,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/auth", "npm:3.19.4"],\
|
||||
["@standardnotes/common", "npm:1.23.1"],\
|
||||
["@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"],\
|
||||
@@ -3144,15 +3172,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", [\
|
||||
@@ -3487,6 +3521,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.
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,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.8.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@1.8.0...@standardnotes/analytics@1.8.1) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* files included in distributable packages ([97ba31f](https://github.com/standardnotes/server/commit/97ba31f345fc95df0c15a348f0461fb9e5bcb923))
|
||||
|
||||
# 1.8.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/analytics",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"engines": {
|
||||
"node": ">=14.0.0 <17.0.0"
|
||||
},
|
||||
@@ -9,7 +9,8 @@
|
||||
"author": "Standard Notes",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src"
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [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
|
||||
|
||||
* deps to @standarnotes/security ([699164e](https://github.com/standardnotes/api-gateway/commit/699164eba553cd07fb50f7a06ae8991028167603))
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/api-gateway/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [1.4.2](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.4.1...@standardnotes/api-gateway@1.4.2) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
## [1.4.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.4.0...@standardnotes/api-gateway@1.4.1) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/api-gateway",
|
||||
"version": "1.4.1",
|
||||
"version": "1.6.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -25,10 +25,10 @@
|
||||
"@newrelic/winston-enricher": "^2.1.0",
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/analytics": "workspace:*",
|
||||
"@standardnotes/auth": "3.19.4",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/time": "^1.7.1",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"@standardnotes/time": "workspace:*",
|
||||
"aws-sdk": "^2.1160.0",
|
||||
"axios": "0.24.0",
|
||||
"cors": "2.8.5",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CrossServiceTokenData } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData } from '@standardnotes/security'
|
||||
import { TimerInterface } from '@standardnotes/time'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OfflineUserTokenData, CrossServiceTokenData } from '@standardnotes/auth'
|
||||
import { OfflineUserTokenData, CrossServiceTokenData } from '@standardnotes/security'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { BaseMiddleware } from 'inversify-express-utils'
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [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
|
||||
|
||||
* deps to @standarnotes/security ([699164e](https://github.com/standardnotes/auth/commit/699164eba553cd07fb50f7a06ae8991028167603))
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/auth/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [1.5.1](https://github.com/standardnotes/auth/compare/@standardnotes/auth-server@1.5.0...@standardnotes/auth-server@1.5.1) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth-server
|
||||
|
||||
# [1.5.0](https://github.com/standardnotes/auth/compare/@standardnotes/auth-server@1.4.0...@standardnotes/auth-server@1.5.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/auth-server",
|
||||
"version": "1.5.0",
|
||||
"version": "1.7.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -35,17 +35,17 @@
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/analytics": "workspace:*",
|
||||
"@standardnotes/api": "^1.1.19",
|
||||
"@standardnotes/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/domain-events": "workspace:*",
|
||||
"@standardnotes/domain-events-infra": "workspace:*",
|
||||
"@standardnotes/features": "^1.47.0",
|
||||
"@standardnotes/predicates": "workspace:*",
|
||||
"@standardnotes/responses": "^1.6.39",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"@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",
|
||||
|
||||
@@ -143,7 +143,7 @@ import {
|
||||
TokenEncoder,
|
||||
TokenEncoderInterface,
|
||||
ValetTokenData,
|
||||
} from '@standardnotes/auth'
|
||||
} from '@standardnotes/security'
|
||||
import { FileUploadedEventHandler } from '../Domain/Handler/FileUploadedEventHandler'
|
||||
import { CreateValetToken } from '../Domain/UseCase/CreateValetToken/CreateValetToken'
|
||||
import { CreateListedAccount } from '../Domain/UseCase/CreateListedAccount/CreateListedAccount'
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
||||
import { ApiGatewayAuthMiddleware } from './ApiGatewayAuthMiddleware'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { Logger } from 'winston'
|
||||
import { CrossServiceTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
import { RoleName } from '@standardnotes/common'
|
||||
|
||||
describe('ApiGatewayAuthMiddleware', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CrossServiceTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { BaseMiddleware } from 'inversify-express-utils'
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
||||
import { ApiGatewayOfflineAuthMiddleware } from './ApiGatewayOfflineAuthMiddleware'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { Logger } from 'winston'
|
||||
import { OfflineUserTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { OfflineUserTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
|
||||
describe('ApiGatewayOfflineAuthMiddleware', () => {
|
||||
let tokenDecoder: TokenDecoderInterface<OfflineUserTokenData>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OfflineUserTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { OfflineUserTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { BaseMiddleware } from 'inversify-express-utils'
|
||||
|
||||
@@ -11,7 +11,7 @@ import { CreateOfflineSubscriptionTokenResponse } from '../Domain/UseCase/Create
|
||||
import { AuthenticateOfflineSubscriptionToken } from '../Domain/UseCase/AuthenticateOfflineSubscriptionToken/AuthenticateOfflineSubscriptionToken'
|
||||
import { OfflineUserSubscription } from '../Domain/Subscription/OfflineUserSubscription'
|
||||
import { GetUserOfflineSubscription } from '../Domain/UseCase/GetUserOfflineSubscription/GetUserOfflineSubscription'
|
||||
import { OfflineUserTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { OfflineUserTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { AuthenticateOfflineSubscriptionToken } from '../Domain/UseCase/Authenti
|
||||
import { CreateOfflineSubscriptionToken } from '../Domain/UseCase/CreateOfflineSubscriptionToken/CreateOfflineSubscriptionToken'
|
||||
import { GetUserOfflineSubscription } from '../Domain/UseCase/GetUserOfflineSubscription/GetUserOfflineSubscription'
|
||||
import { Logger } from 'winston'
|
||||
import { OfflineUserTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { OfflineUserTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
|
||||
@controller('/offline')
|
||||
export class OfflineController extends BaseHttpController {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { GetActiveSessionsForUser } from '../Domain/UseCase/GetActiveSessionsFor
|
||||
import { AuthenticateRequest } from '../Domain/UseCase/AuthenticateRequest'
|
||||
import { User } from '../Domain/User/User'
|
||||
import { Role } from '../Domain/Role/Role'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { GetUserAnalyticsId } from '../Domain/UseCase/GetUserAnalyticsId/GetUserAnalyticsId'
|
||||
|
||||
describe('SessionsController', () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Role } from '../Domain/Role/Role'
|
||||
import { User } from '../Domain/User/User'
|
||||
import { ProjectorInterface } from '../Projection/ProjectorInterface'
|
||||
import { SessionProjector } from '../Projection/SessionProjector'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { RoleName } from '@standardnotes/common'
|
||||
import { GetUserAnalyticsId } from '../Domain/UseCase/GetUserAnalyticsId/GetUserAnalyticsId'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Role } from '@standardnotes/auth'
|
||||
import { Role } from '@standardnotes/security'
|
||||
import { Request, Response } from 'express'
|
||||
import { inject } from 'inversify'
|
||||
import {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ProjectorInterface } from '../Projection/ProjectorInterface'
|
||||
import { Role } from '../Domain/Role/Role'
|
||||
import { SettingServiceInterface } from '../Domain/Setting/SettingServiceInterface'
|
||||
import { Setting } from '../Domain/Setting/Setting'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { GetUserAnalyticsId } from '../Domain/UseCase/GetUserAnalyticsId/GetUserAnalyticsId'
|
||||
|
||||
describe('SubscriptionTokensController', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { ErrorTag, RoleName } from '@standardnotes/common'
|
||||
import { SettingName } from '@standardnotes/settings'
|
||||
import { Request, Response } from 'express'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import * as crypto from 'crypto'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import 'reflect-metadata'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenEncoderInterface } from '@standardnotes/security'
|
||||
import { SessionBody } from '@standardnotes/responses'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
SessionTokenData,
|
||||
TokenEncoderInterface,
|
||||
} from '@standardnotes/auth'
|
||||
} from '@standardnotes/security'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { SessionBody } from '@standardnotes/responses'
|
||||
import { inject, injectable } from 'inversify'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { SessionTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
|
||||
import { RevokedSession } from '../Session/RevokedSession'
|
||||
import { Session } from '../Session/Session'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SessionTokenData, TokenDecoderInterface } from '@standardnotes/auth'
|
||||
import { SessionTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import TYPES from '../../Bootstrap/Types'
|
||||
import { SessionServiceInterface } from '../Session/SessionServiceInterface'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { Role } from '@standardnotes/auth'
|
||||
import { Role } from '@standardnotes/security'
|
||||
import { RoleName, SubscriptionName } from '@standardnotes/common'
|
||||
|
||||
import { RoleToSubscriptionMapInterface } from '../Role/RoleToSubscriptionMapInterface'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DomainEventHandlerInterface, ExtensionKeyGrantedEvent } from '@standardnotes/domain-events'
|
||||
import { SettingName } from '@standardnotes/settings'
|
||||
import { OfflineFeaturesTokenData } from '@standardnotes/auth'
|
||||
import { OfflineFeaturesTokenData } from '@standardnotes/security'
|
||||
import { ContentDecoderInterface } from '@standardnotes/common'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OfflineFeaturesTokenData } from '@standardnotes/auth'
|
||||
import { OfflineFeaturesTokenData } from '@standardnotes/security'
|
||||
import { DomainEventHandlerInterface, SubscriptionSyncRequestedEvent } from '@standardnotes/domain-events'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { Logger } from 'winston'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { TokenEncoderInterface, ValetTokenData } from '@standardnotes/auth'
|
||||
import { TokenEncoderInterface, ValetTokenData } from '@standardnotes/security'
|
||||
import { CreateValetToken } from './CreateValetToken'
|
||||
import { TimerInterface } from '@standardnotes/time'
|
||||
import { UserSubscription } from '../../Subscription/UserSubscription'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { TimerInterface } from '@standardnotes/time'
|
||||
import { TokenEncoderInterface, ValetTokenData } from '@standardnotes/auth'
|
||||
import { TokenEncoderInterface, ValetTokenData } from '@standardnotes/security'
|
||||
import { CreateValetTokenPayload, CreateValetTokenResponseData } from '@standardnotes/responses'
|
||||
import { SubscriptionSettingName } from '@standardnotes/settings'
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { VerifyMFA } from './VerifyMFA'
|
||||
import { Setting } from '../Setting/Setting'
|
||||
import { SettingServiceInterface } from '../Setting/SettingServiceInterface'
|
||||
import { SettingName } from '@standardnotes/settings'
|
||||
import { SelectorInterface } from '@standardnotes/auth'
|
||||
import { SelectorInterface } from '@standardnotes/security'
|
||||
import { LockRepositoryInterface } from '../User/LockRepositoryInterface'
|
||||
|
||||
describe('VerifyMFA', () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { UseCaseInterface } from './UseCaseInterface'
|
||||
import { VerifyMFADTO } from './VerifyMFADTO'
|
||||
import { VerifyMFAResponse } from './VerifyMFAResponse'
|
||||
import { SettingServiceInterface } from '../Setting/SettingServiceInterface'
|
||||
import { SelectorInterface } from '@standardnotes/auth'
|
||||
import { SelectorInterface } from '@standardnotes/security'
|
||||
import { LockRepositoryInterface } from '../User/LockRepositoryInterface'
|
||||
|
||||
@injectable()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { SelectorInterface } from '@standardnotes/auth'
|
||||
import { SelectorInterface } from '@standardnotes/security'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
|
||||
import { KeyParamsFactory } from './KeyParamsFactory'
|
||||
|
||||
@@ -6,7 +6,7 @@ import { inject, injectable } from 'inversify'
|
||||
import TYPES from '../../Bootstrap/Types'
|
||||
import { KeyParamsFactoryInterface } from './KeyParamsFactoryInterface'
|
||||
import { User } from './User'
|
||||
import { SelectorInterface } from '@standardnotes/auth'
|
||||
import { SelectorInterface } from '@standardnotes/security'
|
||||
|
||||
@injectable()
|
||||
export class KeyParamsFactory implements KeyParamsFactoryInterface {
|
||||
|
||||
@@ -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.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.7.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.2...@standardnotes/domain-events-infra@1.7.3) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* files included in distributable packages ([97ba31f](https://github.com/standardnotes/server/commit/97ba31f345fc95df0c15a348f0461fb9e5bcb923))
|
||||
|
||||
## [1.7.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.1...@standardnotes/domain-events-infra@1.7.2) (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.2",
|
||||
"version": "1.7.4",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -8,7 +8,8 @@
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src"
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [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
|
||||
|
||||
* deps to @standarnotes/security ([699164e](https://github.com/standardnotes/server/commit/699164eba553cd07fb50f7a06ae8991028167603))
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/server/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [2.37.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.37.0...@standardnotes/domain-events@2.37.1) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* files included in distributable packages ([97ba31f](https://github.com/standardnotes/server/commit/97ba31f345fc95df0c15a348f0461fb9e5bcb923))
|
||||
|
||||
# [2.37.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.36.0...@standardnotes/domain-events@2.37.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/domain-events",
|
||||
"version": "2.37.0",
|
||||
"version": "2.38.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -8,7 +8,8 @@
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src"
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -23,10 +24,10 @@
|
||||
"test:unit": "jest spec --coverage --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@standardnotes/features": "^1.47.0",
|
||||
"@standardnotes/predicates": "workspace:*",
|
||||
"@standardnotes/security": "workspace:*",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.3.0](https://github.com/standardnotes/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
|
||||
|
||||
* deps to @standarnotes/security ([699164e](https://github.com/standardnotes/files/commit/699164eba553cd07fb50f7a06ae8991028167603))
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/files/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [1.1.14](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.1.13...@standardnotes/files-server@1.1.14) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files-server
|
||||
|
||||
## [1.1.13](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.1.12...@standardnotes/files-server@1.1.13) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/files-server",
|
||||
"version": "1.1.13",
|
||||
"version": "1.3.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -27,13 +27,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/node": "^7.3.0",
|
||||
"@standardnotes/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@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",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Env } from './Env'
|
||||
import TYPES from './Types'
|
||||
import { UploadFileChunk } from '../Domain/UseCase/UploadFileChunk/UploadFileChunk'
|
||||
import { ValetTokenAuthMiddleware } from '../Controller/ValetTokenAuthMiddleware'
|
||||
import { TokenDecoder, TokenDecoderInterface, ValetTokenData } from '@standardnotes/auth'
|
||||
import { TokenDecoder, TokenDecoderInterface, ValetTokenData } from '@standardnotes/security'
|
||||
import { Timer, TimerInterface } from '@standardnotes/time'
|
||||
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
||||
import { ValetTokenAuthMiddleware } from './ValetTokenAuthMiddleware'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { Logger } from 'winston'
|
||||
import { TokenDecoderInterface, ValetTokenData } from '@standardnotes/auth'
|
||||
import { TokenDecoderInterface, ValetTokenData } from '@standardnotes/security'
|
||||
|
||||
describe('ValetTokenAuthMiddleware', () => {
|
||||
let tokenDecoder: TokenDecoderInterface<ValetTokenData>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TokenDecoderInterface, ValetTokenData } from '@standardnotes/auth'
|
||||
import { TokenDecoderInterface, ValetTokenData } from '@standardnotes/security'
|
||||
import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { BaseMiddleware } from 'inversify-express-utils'
|
||||
|
||||
@@ -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.1.1](https://github.com/standardnotes/server/compare/@standardnotes/predicates@1.1.0...@standardnotes/predicates@1.1.1) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* files included in distributable packages ([97ba31f](https://github.com/standardnotes/server/commit/97ba31f345fc95df0c15a348f0461fb9e5bcb923))
|
||||
|
||||
# 1.1.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/predicates",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -9,7 +9,8 @@
|
||||
"author": "Standard Notes",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/src"
|
||||
"dist/src/**/*.js",
|
||||
"dist/src/**/*.d.ts"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -3,6 +3,20 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [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.3.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.3.0...@standardnotes/scheduler-server@1.3.1) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||
|
||||
# [1.3.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.2.7...@standardnotes/scheduler-server@1.3.0) (2022-07-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/scheduler-server",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
@@ -30,7 +30,7 @@
|
||||
"@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",
|
||||
|
||||
1
packages/security/.eslintignore
Normal file
1
packages/security/.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
6
packages/security/.eslintrc
Normal file
6
packages/security/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../../.eslintrc",
|
||||
"parserOptions": {
|
||||
"project": "./linter.tsconfig.json"
|
||||
}
|
||||
}
|
||||
371
packages/security/CHANGELOG.md
Normal file
371
packages/security/CHANGELOG.md
Normal file
@@ -0,0 +1,371 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 1.1.0 (2022-07-06)
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/server/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [3.19.5](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.19.4...@standardnotes/auth@3.19.5) (2022-07-04)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing reflect-metadata package to all packages ([ce3a5bb](https://github.com/standardnotes/snjs/commit/ce3a5bbf3f1d2276ac4abc3eec3c6a44c8c3ba9b))
|
||||
|
||||
## [3.19.4](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.19.3...@standardnotes/auth@3.19.4) (2022-06-27)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.19.3](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.19.2...@standardnotes/auth@3.19.3) (2022-06-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.19.2](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.19.1...@standardnotes/auth@3.19.2) (2022-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add session access and refresh expiration dates to cross service token data ([8ad0eee](https://github.com/standardnotes/snjs/commit/8ad0eee04acfbba03e62881e1c17e77baedbea04))
|
||||
|
||||
## [3.19.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.19.0...@standardnotes/auth@3.19.1) (2022-05-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make analytics id optional in the cross service token data ([f5445d4](https://github.com/standardnotes/snjs/commit/f5445d4fb69158de676c4f4d108dc675ded8b9a1))
|
||||
|
||||
# [3.19.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.17...@standardnotes/auth@3.19.0) (2022-05-24)
|
||||
|
||||
### Features
|
||||
|
||||
* add user analytics id to cross service token data ([046c951](https://github.com/standardnotes/snjs/commit/046c951cac4b1d9a80904da97d5fc279a629e965))
|
||||
|
||||
## [3.18.17](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.16...@standardnotes/auth@3.18.17) (2022-05-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.16](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.15...@standardnotes/auth@3.18.16) (2022-05-17)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.15](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.14...@standardnotes/auth@3.18.15) (2022-05-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.14](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.13...@standardnotes/auth@3.18.14) (2022-05-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.13](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.11...@standardnotes/auth@3.18.13) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.12](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.11...@standardnotes/auth@3.18.12) (2022-05-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.11](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.10...@standardnotes/auth@3.18.11) (2022-04-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.10](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.9...@standardnotes/auth@3.18.10) (2022-04-21)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.9](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.8...@standardnotes/auth@3.18.9) (2022-04-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* valet token data optional property ([f926ecb](https://github.com/standardnotes/snjs/commit/f926ecbd5481e9cc98cbfadf57260e1d4a5e54fc))
|
||||
|
||||
## [3.18.8](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.7...@standardnotes/auth@3.18.8) (2022-04-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* valet token data property name ([990fca7](https://github.com/standardnotes/snjs/commit/990fca7bdab43d06339ffa25b907c850fd0afb22))
|
||||
|
||||
## [3.18.7](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.6...@standardnotes/auth@3.18.7) (2022-04-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.6](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.5...@standardnotes/auth@3.18.6) (2022-04-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add subscription uuids to valet token and file removed events for cleanup purposes ([e05deb9](https://github.com/standardnotes/snjs/commit/e05deb9cd3fbc69e90fd2dbcae5a62582febe5fa))
|
||||
|
||||
## [3.18.5](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.4...@standardnotes/auth@3.18.5) (2022-04-11)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.4](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.3...@standardnotes/auth@3.18.4) (2022-04-01)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.3](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.2...@standardnotes/auth@3.18.3) (2022-03-31)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.2](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.1...@standardnotes/auth@3.18.2) (2022-03-31)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.18.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.18.0...@standardnotes/auth@3.18.1) (2022-03-30)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
# [3.18.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.11...@standardnotes/auth@3.18.0) (2022-03-23)
|
||||
|
||||
### Features
|
||||
|
||||
* add deterministic value selector ([#671](https://github.com/standardnotes/snjs/issues/671)) ([570d2ae](https://github.com/standardnotes/snjs/commit/570d2aeae842540c64ae33bbcbef8242f2b85e5f))
|
||||
|
||||
## [3.17.11](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.10...@standardnotes/auth@3.17.11) (2022-03-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.17.10](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.9...@standardnotes/auth@3.17.10) (2022-03-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add readonly access information about the session in cross service token ([9363eeb](https://github.com/standardnotes/snjs/commit/9363eeb83dcc953b14b040e68045a6019f498e12))
|
||||
|
||||
## [3.17.9](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.8...@standardnotes/auth@3.17.9) (2022-03-21)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.17.8](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.7...@standardnotes/auth@3.17.8) (2022-03-18)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.17.7](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.5...@standardnotes/auth@3.17.7) (2022-03-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.17.6](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.5...@standardnotes/auth@3.17.6) (2022-03-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.17.5](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.4...@standardnotes/auth@3.17.5) (2022-03-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add unencrypted file size to valet token resources ([06b0a4a](https://github.com/standardnotes/snjs/commit/06b0a4a998980048b3b9e0e146321de0c198f069))
|
||||
|
||||
## [3.17.4](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.3...@standardnotes/auth@3.17.4) (2022-03-09)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add deleting as a valid operation in valet token ([13a22d9](https://github.com/standardnotes/snjs/commit/13a22d9734f898d0cd2475fbe53a021be2c20a5f))
|
||||
|
||||
## [3.17.3](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.1...@standardnotes/auth@3.17.3) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [3.17.2](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.1...@standardnotes/auth@3.17.2) (2022-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add pseudo change to get lerna to trigger ([41e6817](https://github.com/standardnotes/snjs/commit/41e6817bbf726b0932cdf16f58622328b9e42803))
|
||||
|
||||
## [3.17.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.17.0...@standardnotes/auth@3.17.1) (2022-02-27)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
# [3.17.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.5...@standardnotes/auth@3.17.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))
|
||||
|
||||
## [3.16.5](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.4...@standardnotes/auth@3.16.5) (2022-02-24)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.16.4](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.3...@standardnotes/auth@3.16.4) (2022-02-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.16.3](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.2...@standardnotes/auth@3.16.3) (2022-02-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.16.2](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.1...@standardnotes/auth@3.16.2) (2022-02-18)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.16.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.16.0...@standardnotes/auth@3.16.1) (2022-02-16)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
# [3.16.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.5...@standardnotes/auth@3.16.0) (2022-02-10)
|
||||
|
||||
### Features
|
||||
|
||||
* remove role name and subscription name from auth in favor of common ([14ec74c](https://github.com/standardnotes/snjs/commit/14ec74c3d98febf1117073f32442504cfad428e8))
|
||||
|
||||
## [3.15.5](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.4...@standardnotes/auth@3.15.5) (2022-02-10)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.15.4](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.3...@standardnotes/auth@3.15.4) (2022-02-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
## [3.15.3](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.2...@standardnotes/auth@3.15.3) (2022-01-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add upload bytes information to valet token ([6d35f2b](https://github.com/standardnotes/snjs/commit/6d35f2b3774b1d0dad60c3ad00d2a958b81a52cb))
|
||||
|
||||
## [3.15.2](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.1...@standardnotes/auth@3.15.2) (2022-01-17)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove valet token valid until date in favor of jwt expiration ([7973fb1](https://github.com/standardnotes/snjs/commit/7973fb1695f3b02fa9b8888c6c5d0ff10b1979ee))
|
||||
|
||||
## [3.15.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.15.0...@standardnotes/auth@3.15.1) (2022-01-17)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* token encoders ([e0be0f4](https://github.com/standardnotes/snjs/commit/e0be0f4f0677615c3e347843eea33f08e9920eae))
|
||||
|
||||
# [3.15.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.14.1...@standardnotes/auth@3.15.0) (2022-01-17)
|
||||
|
||||
### Features
|
||||
|
||||
* refactor token data names ([#559](https://github.com/standardnotes/snjs/issues/559)) ([2c615c9](https://github.com/standardnotes/snjs/commit/2c615c9b6f733195684163a58df606f5a8ffde59))
|
||||
|
||||
## [3.14.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.14.0...@standardnotes/auth@3.14.1) (2022-01-15)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/auth
|
||||
|
||||
# [3.14.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.13.1...@standardnotes/auth@3.14.0) (2022-01-15)
|
||||
|
||||
### Features
|
||||
|
||||
* add crypter, decoder and encoder to auth package ([#553](https://github.com/standardnotes/snjs/issues/553)) ([940e0a5](https://github.com/standardnotes/snjs/commit/940e0a56a84e5f057a94a526289ae79e1ea46f70))
|
||||
|
||||
## [3.13.1](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.13.0...@standardnotes/auth@3.13.1) (2022-01-14)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cross-package dependencies and content type imports ([#556](https://github.com/standardnotes/snjs/issues/556)) ([26ba1e0](https://github.com/standardnotes/snjs/commit/26ba1e0c38e7e0ae572996125150a4c3d27f1c0a))
|
||||
|
||||
# [3.13.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.12.0...@standardnotes/auth@3.13.0) (2022-01-13)
|
||||
|
||||
### 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
|
||||
|
||||
* add token decoder ([#551](https://github.com/standardnotes/snjs/issues/551)) ([7240588](https://github.com/standardnotes/snjs/commit/724058864be08d0d78d4d8c232864aed125ea6e0))
|
||||
|
||||
# [3.12.0](https://github.com/standardnotes/snjs/compare/@standardnotes/auth@3.11.0...@standardnotes/auth@3.12.0) (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* remove not used AuthMethods type ([98cb8e2](https://github.com/standardnotes/snjs/commit/98cb8e2bdf152c2b9e4f349fb77b537f8ac416e3))
|
||||
|
||||
# 3.11.0 (2021-12-23)
|
||||
|
||||
### Features
|
||||
|
||||
* rename email backup setting to email backup frequency ([25e7b46](https://github.com/standardnotes/snjs/commit/25e7b4620834711ac7f513ae893898c5eab1af53))
|
||||
|
||||
## 3.10.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* lock package versions ([8aa2ce6](https://github.com/standardnotes/snjs/commit/8aa2ce676b57598ab72840adf851869d8e769022))
|
||||
|
||||
## 3.10.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add publishing from package version by lerna ([80433d0](https://github.com/standardnotes/snjs/commit/80433d044f258095753482b8322d73aba3d9a9e4))
|
||||
|
||||
## 3.10.1 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove the ammend commit from lerna versioning ([f0400d9](https://github.com/standardnotes/snjs/commit/f0400d9a2f5a04eaece2e4c16da71166a2ddb251))
|
||||
|
||||
# 3.10.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))
|
||||
|
||||
## 3.9.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))
|
||||
|
||||
## 3.9.3 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* pr template ([#518](https://github.com/standardnotes/snjs/issues/518)) ([b445bb6](https://github.com/standardnotes/snjs/commit/b445bb64841217ae27c2514887629235be95d2a3))
|
||||
|
||||
## 3.9.2 (2021-12-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* checkout with personal access token ([773c1ef](https://github.com/standardnotes/snjs/commit/773c1ef91c4452ad411e928342060dcb59428e3c))
|
||||
|
||||
## 3.9.1 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* gpg signing with CI StandardNotes user ([d72f61c](https://github.com/standardnotes/snjs/commit/d72f61c23cd15b31d37340cc756d16526634b9ee))
|
||||
|
||||
# 3.9.0 (2021-12-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add another missing export ([e219511](https://github.com/standardnotes/snjs/commit/e219511bfd361ac7e785c8ef407fd3323c3f6d08))
|
||||
* add missing export ([887a37e](https://github.com/standardnotes/snjs/commit/887a37ece3c6a266894ab5e54c96c7b45c1c8d68))
|
||||
* change user changed email event name ([#409](https://github.com/standardnotes/snjs/issues/409)) ([84efd16](https://github.com/standardnotes/snjs/commit/84efd161574d98a368201c7afcc1eff8ef916631))
|
||||
* create start task for auth package ([eb51014](https://github.com/standardnotes/snjs/commit/eb51014dcd94cf4a8be7db4ed7494f07dd7a4040))
|
||||
* fix lint problems and permission name export ([d303c06](https://github.com/standardnotes/snjs/commit/d303c06a0bda0d44a01d67c3fdb3a495a6a9148c))
|
||||
* forgot to bump Auth SDK version ([5fde641](https://github.com/standardnotes/snjs/commit/5fde64112cf09bdd309ad8f89e07edaf199db5fd))
|
||||
* format ([1d7d8a7](https://github.com/standardnotes/snjs/commit/1d7d8a7e39e83c858a5174db174e6f6f67a4f440))
|
||||
* format ([89705ae](https://github.com/standardnotes/snjs/commit/89705ae4d0e18b8672f2bd6e33681d38201ad56e))
|
||||
* format ([c3ee41b](https://github.com/standardnotes/snjs/commit/c3ee41b1ced73301600ead8cd70e20f0b1ca1d75))
|
||||
* linter errors ([51dee46](https://github.com/standardnotes/snjs/commit/51dee46ff8ebe13e43e7c5ca3e00a48dc25cdd54))
|
||||
* make session optional in the authentication token - legacy clients support ([e1b7e3e](https://github.com/standardnotes/snjs/commit/e1b7e3e846cf775009eb59bfbe526addf7848798))
|
||||
* naming on offline user token data ([0ebbfaa](https://github.com/standardnotes/snjs/commit/0ebbfaa7682ec0fdbccd698b6e9d13fb4dd39836))
|
||||
* remove comma ([328d2ca](https://github.com/standardnotes/snjs/commit/328d2ca19d4f9e813ad3f8ff27b2bab64a0036e4))
|
||||
* remove features dependency from auth ([4ae24b6](https://github.com/standardnotes/snjs/commit/4ae24b69cbd1df62e036666218f5961cc81e91aa))
|
||||
* replace permissions with features in auth token ([#373](https://github.com/standardnotes/snjs/issues/373)) ([739c956](https://github.com/standardnotes/snjs/commit/739c95604bd119a893d0d43dd2b35794cb5cb770))
|
||||
* versioning and package dependencies ([#509](https://github.com/standardnotes/snjs/issues/509)) ([fe1df94](https://github.com/standardnotes/snjs/commit/fe1df94eff3e90bcf9ba0cf45bdc44ac49204c71))
|
||||
|
||||
### Features
|
||||
|
||||
* add Auth SDK package ([#214](https://github.com/standardnotes/snjs/issues/214)) ([ae855ed](https://github.com/standardnotes/snjs/commit/ae855ed74081d7b3dbbcde30ddcd173ed41bf018))
|
||||
* add Auth Token DTO ([#218](https://github.com/standardnotes/snjs/issues/218)) ([c5a7509](https://github.com/standardnotes/snjs/commit/c5a750945fc368430ed2bdf7bc2f1c95061fdc2a))
|
||||
* add email events ([#250](https://github.com/standardnotes/snjs/issues/250)) ([fe4b444](https://github.com/standardnotes/snjs/commit/fe4b4442bd1c88e8c3e51806629c95153343b92a))
|
||||
* add extension key to auth token ([fc1b732](https://github.com/standardnotes/snjs/commit/fc1b7322825ebc3553dc8ce0c298e68baf0004c3))
|
||||
* add feature type ([0a8e2ec](https://github.com/standardnotes/snjs/commit/0a8e2ecc9f3cc527e615d9a12125ac8d5b32643b))
|
||||
* add get user subscription api call ([#411](https://github.com/standardnotes/snjs/issues/411)) ([83a8518](https://github.com/standardnotes/snjs/commit/83a8518f9232ca3d84dd5ddb102fb6f8b5448654))
|
||||
* add KeyParams model to auth package ([#248](https://github.com/standardnotes/snjs/issues/248)) ([cd9f74e](https://github.com/standardnotes/snjs/commit/cd9f74e119e670e3de47b245a6197d4a25340df4))
|
||||
* add offline user token data model ([6623498](https://github.com/standardnotes/snjs/commit/6623498690c74e547b32788b8866424e439ef794))
|
||||
* add subscription names and extract role names ([#359](https://github.com/standardnotes/snjs/issues/359)) ([df6356c](https://github.com/standardnotes/snjs/commit/df6356ccb8975b39a95c143e064f3e32f0006580))
|
||||
* added AuthMethods and extracted Uuid to auth SDK ([cffb5bf](https://github.com/standardnotes/snjs/commit/cffb5bfc4e99ab7186f57257aeba7e346a1c7c08))
|
||||
* adjust Auth SDK to the MFA implementation in Auth ([ca2f89a](https://github.com/standardnotes/snjs/commit/ca2f89a1645cad0fcf9f16bdb321773379692c03))
|
||||
* change permission and role types ([2722270](https://github.com/standardnotes/snjs/commit/27222706e4c37fa7337ddf44c2a2b1be3c96fea2))
|
||||
* extract common error tags to Auth SDK ([7df999e](https://github.com/standardnotes/snjs/commit/7df999eca44a48a74ecf3359ae1f6b914de942b6))
|
||||
* extract MFA payload to Auth SDK ([ab28d5c](https://github.com/standardnotes/snjs/commit/ab28d5ceb18e34f944362784105f0c2681667dbe))
|
||||
* extract settings and common package ([#372](https://github.com/standardnotes/snjs/issues/372)) ([4f89688](https://github.com/standardnotes/snjs/commit/4f89688054cdae88c001287c9fb3431debd0136c))
|
||||
* features instead of permissions ([#385](https://github.com/standardnotes/snjs/issues/385)) ([b53e967](https://github.com/standardnotes/snjs/commit/b53e967297bc472ed11aed79af79d0ae5b36d101))
|
||||
* Offline features token ([#452](https://github.com/standardnotes/snjs/issues/452)) ([b04d71b](https://github.com/standardnotes/snjs/commit/b04d71b62d9c6cd408c460c1458a8f14ef6f1948))
|
||||
* return array of feature ids instead of features in token ([2e2ac7b](https://github.com/standardnotes/snjs/commit/2e2ac7bae707915adcd01b35c98022720caa834c))
|
||||
* revert to returning just user role on event and auth token ([8f9341e](https://github.com/standardnotes/snjs/commit/8f9341eb49910a91a2ccaf2d70843a3ead97b707))
|
||||
* 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/security/jest.config.js
Normal file
11
packages/security/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/security/linter.tsconfig.json
Normal file
4
packages/security/linter.tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
41
packages/security/package.json
Normal file
41
packages/security/package.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@standardnotes/security",
|
||||
"version": "1.1.0",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
"description": "Security SDK 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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3"
|
||||
}
|
||||
}
|
||||
31
packages/security/src/Domain/Decoder/TokenDecoder.spec.ts
Normal file
31
packages/security/src/Domain/Decoder/TokenDecoder.spec.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { TokenDecoder } from './TokenDecoder'
|
||||
|
||||
describe('TokenDecoder', () => {
|
||||
const jwtSecret = 'secret'
|
||||
|
||||
const createDecoder = () =>
|
||||
new TokenDecoder<{ iat: number; pw_hash: string; sub: string; user_uuid: string }>(jwtSecret)
|
||||
|
||||
it('should decode a token', () => {
|
||||
expect(
|
||||
createDecoder().decodeToken(
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwidXNlcl91dWlkIjoiMTIzIiwicHdfaGFzaCI6IjlmODZkMDgxODg0YzdkNjU5YTJmZWFhMGM1NWFkMDE1YTNiZjRmMWIyYjBiODIyY2QxNWQ2YzE1YjBmMDBhMDgiLCJpYXQiOjE1MTYyMzkwMjJ9.TXDPCbCAITDjcUUorHsF4S5Nxkz4eFE4F3TPCsKI89A',
|
||||
),
|
||||
).toEqual({
|
||||
iat: 1516239022,
|
||||
pw_hash: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08',
|
||||
sub: '1234567890',
|
||||
user_uuid: '123',
|
||||
})
|
||||
})
|
||||
|
||||
it('should not decode a session token with wrong encoding', () => {
|
||||
expect(
|
||||
createDecoder().decodeToken(
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyqeqwJzdWIiOiIxMjM0NTY3ODkwIiwidXNlcl91dWlkIjoiMTIzIiwicHdfaGFzaCI6IjlmODZkMDgxODg0YzdkNjU5YTJmZWFhMGM1NWFkMDE1YTNiZjRmMWIyYjBiODIyY2QxNWQ2YzE1YjBmMDBhMDgiLCJpYXQiOjE1MTYyMzkwMjJ9.g32nbZ046pRwSe1iHwWEfsNNBRnAKqXshQKRtCuX1Zw',
|
||||
),
|
||||
).toBeUndefined()
|
||||
})
|
||||
})
|
||||
16
packages/security/src/Domain/Decoder/TokenDecoder.ts
Normal file
16
packages/security/src/Domain/Decoder/TokenDecoder.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { verify } from 'jsonwebtoken'
|
||||
|
||||
import { TokenDecoderInterface } from './TokenDecoderInterface'
|
||||
export class TokenDecoder<T> implements TokenDecoderInterface<T> {
|
||||
constructor(private jwtSecret: string) {}
|
||||
|
||||
decodeToken(token: string): T | undefined {
|
||||
try {
|
||||
return <T>verify(token, this.jwtSecret, {
|
||||
algorithms: ['HS256'],
|
||||
})
|
||||
} catch (error) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface TokenDecoderInterface<T> {
|
||||
decodeToken(token: string): T | undefined
|
||||
}
|
||||
25
packages/security/src/Domain/Encoder/TokenEncoder.spec.ts
Normal file
25
packages/security/src/Domain/Encoder/TokenEncoder.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { JwtPayload, verify } from 'jsonwebtoken'
|
||||
|
||||
import { TokenEncoder } from './TokenEncoder'
|
||||
|
||||
describe('TokenEncoder', () => {
|
||||
const jwtSecret = 'secret'
|
||||
|
||||
const createEncoder = () => new TokenEncoder<{ user_uuid: string }>(jwtSecret)
|
||||
|
||||
it('should encode a token', () => {
|
||||
const encodedToken = createEncoder().encodeToken({ user_uuid: '123' })
|
||||
|
||||
expect((verify(encodedToken, jwtSecret) as JwtPayload).user_uuid).toEqual('123')
|
||||
expect((verify(encodedToken, jwtSecret) as JwtPayload).exp).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should encode an expirable token', () => {
|
||||
const encodedToken = createEncoder().encodeExpirableToken({ user_uuid: '123' }, 123)
|
||||
|
||||
expect((verify(encodedToken, jwtSecret) as JwtPayload).user_uuid).toEqual('123')
|
||||
expect((verify(encodedToken, jwtSecret) as JwtPayload).exp).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
15
packages/security/src/Domain/Encoder/TokenEncoder.ts
Normal file
15
packages/security/src/Domain/Encoder/TokenEncoder.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { sign } from 'jsonwebtoken'
|
||||
|
||||
import { TokenEncoderInterface } from './TokenEncoderInterface'
|
||||
|
||||
export class TokenEncoder<T> implements TokenEncoderInterface<T> {
|
||||
constructor(private jwtSecret: string) {}
|
||||
|
||||
encodeExpirableToken(data: T, expiresIn: string | number | undefined): string {
|
||||
return sign(data as Record<string, unknown>, this.jwtSecret, { algorithm: 'HS256', expiresIn })
|
||||
}
|
||||
|
||||
encodeToken(data: T): string {
|
||||
return sign(data as Record<string, unknown>, this.jwtSecret, { algorithm: 'HS256' })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface TokenEncoderInterface<T> {
|
||||
encodeToken(data: T): string
|
||||
encodeExpirableToken(data: T, expiresIn: number): string
|
||||
}
|
||||
6
packages/security/src/Domain/Role/Role.ts
Normal file
6
packages/security/src/Domain/Role/Role.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Uuid, RoleName } from '@standardnotes/common'
|
||||
|
||||
export type Role = {
|
||||
uuid: Uuid
|
||||
name: RoleName
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { DeterministicSelector } from './DeterministicSelector'
|
||||
|
||||
describe('DeterministicSelector', () => {
|
||||
const createSelector = () => new DeterministicSelector<string>()
|
||||
|
||||
it('should choose always the same value based on the same input', () => {
|
||||
const selector = createSelector()
|
||||
|
||||
const inputString = '875a31ce95365904ef0e0a8e6cefc1f5e99adfef81bbdb6d4499eeb10ae0ff67'
|
||||
|
||||
const allowedValues = ['a', 'b', 'c', 'd', 'e']
|
||||
|
||||
const firstValue = selector.select(inputString, allowedValues)
|
||||
|
||||
const secondValue = selector.select(inputString, allowedValues)
|
||||
|
||||
expect(firstValue).toEqual('d')
|
||||
|
||||
expect(firstValue).toEqual(secondValue)
|
||||
})
|
||||
|
||||
it('should choose different values on different input', () => {
|
||||
const selector = createSelector()
|
||||
|
||||
const allowedValues = ['a', 'b', 'c', 'd', 'e']
|
||||
|
||||
const firstValue = selector.select(
|
||||
'875a31ce95365904ef0e0a8e6cefc1f5e99adfef81bbdb6d4499eeb10ae0ff67',
|
||||
allowedValues,
|
||||
)
|
||||
|
||||
const secondValue = selector.select(
|
||||
'a75a31ce95365904ef0e0a8e6cefc1f5e99adfef81bbdb6d4499eeb10ae0ff67',
|
||||
allowedValues,
|
||||
)
|
||||
|
||||
expect(firstValue).toEqual('d')
|
||||
|
||||
expect(secondValue).toEqual('e')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
import { SelectorInterface } from './SelectorInterface'
|
||||
|
||||
export class DeterministicSelector<T> implements SelectorInterface<T> {
|
||||
private readonly CHAR_0_CODE = 48
|
||||
|
||||
select(inputKey: string, values: T[]): T {
|
||||
const firstChar = inputKey[0]
|
||||
const firstCharCode = firstChar.charCodeAt(0)
|
||||
|
||||
const normalizedCode = firstCharCode - this.CHAR_0_CODE
|
||||
|
||||
const index = normalizedCode % values.length
|
||||
|
||||
return values[index]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface SelectorInterface<T> {
|
||||
select(inputKey: string, values: Array<T>): T
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
|
||||
export type Subscription = {
|
||||
planName: SubscriptionName
|
||||
endsAt: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
cancelled: boolean
|
||||
}
|
||||
23
packages/security/src/Domain/Token/CrossServiceTokenData.ts
Normal file
23
packages/security/src/Domain/Token/CrossServiceTokenData.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
|
||||
import { Role } from '../Role/Role'
|
||||
|
||||
export type CrossServiceTokenData = {
|
||||
user: {
|
||||
uuid: Uuid
|
||||
email: string
|
||||
}
|
||||
roles: Array<Role>
|
||||
session?: {
|
||||
uuid: Uuid
|
||||
api_version: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
device_info: string
|
||||
readonly_access: boolean
|
||||
access_expiration: string
|
||||
refresh_expiration: string
|
||||
}
|
||||
extensionKey?: string
|
||||
analyticsId?: number
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type OfflineFeaturesTokenData = {
|
||||
featuresUrl: string
|
||||
extensionKey: string
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type OfflineUserTokenData = {
|
||||
userEmail: string
|
||||
featuresToken: string
|
||||
}
|
||||
1
packages/security/src/Domain/Token/SessionTokenData.ts
Normal file
1
packages/security/src/Domain/Token/SessionTokenData.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type SessionTokenData = Record<string, unknown>
|
||||
14
packages/security/src/Domain/Token/ValetTokenData.ts
Normal file
14
packages/security/src/Domain/Token/ValetTokenData.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
|
||||
export type ValetTokenData = {
|
||||
userUuid: Uuid
|
||||
sharedSubscriptionUuid: Uuid | undefined
|
||||
regularSubscriptionUuid: Uuid
|
||||
permittedOperation: 'read' | 'write' | 'delete'
|
||||
permittedResources: Array<{
|
||||
remoteIdentifier: string
|
||||
unencryptedFileSize?: number
|
||||
}>
|
||||
uploadBytesUsed: number
|
||||
uploadBytesLimit: number
|
||||
}
|
||||
13
packages/security/src/Domain/index.ts
Normal file
13
packages/security/src/Domain/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export * from './Decoder/TokenDecoder'
|
||||
export * from './Decoder/TokenDecoderInterface'
|
||||
export * from './Encoder/TokenEncoder'
|
||||
export * from './Encoder/TokenEncoderInterface'
|
||||
export * from './Role/Role'
|
||||
export * from './Selection/DeterministicSelector'
|
||||
export * from './Selection/SelectorInterface'
|
||||
export * from './Subscription/Subscription'
|
||||
export * from './Token/CrossServiceTokenData'
|
||||
export * from './Token/OfflineFeaturesTokenData'
|
||||
export * from './Token/OfflineUserTokenData'
|
||||
export * from './Token/SessionTokenData'
|
||||
export * from './Token/ValetTokenData'
|
||||
1
packages/security/src/index.ts
Normal file
1
packages/security/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Domain'
|
||||
11
packages/security/tsconfig.json
Normal file
11
packages/security/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "./dist",
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
@@ -3,6 +3,26 @@
|
||||
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/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
|
||||
|
||||
* deps to @standarnotes/security ([699164e](https://github.com/standardnotes/syncing-server-js/commit/699164eba553cd07fb50f7a06ae8991028167603))
|
||||
|
||||
### Features
|
||||
|
||||
* add security package ([d86928f](https://github.com/standardnotes/syncing-server-js/commit/d86928f1b4b5feda8c330ed8ee0bf9de0fc12ae7))
|
||||
|
||||
## [1.2.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.2.1...@standardnotes/syncing-server@1.2.2) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||
|
||||
## [1.2.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.2.0...@standardnotes/syncing-server@1.2.1) (2022-07-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/syncing-server",
|
||||
"version": "1.2.1",
|
||||
"version": "1.4.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/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.23.1",
|
||||
"@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",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextFunction, Request, Response } from 'express'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { BaseMiddleware } from 'inversify-express-utils'
|
||||
import { verify } from 'jsonwebtoken'
|
||||
import { CrossServiceTokenData } from '@standardnotes/auth'
|
||||
import { CrossServiceTokenData } from '@standardnotes/security'
|
||||
import * as winston from 'winston'
|
||||
import TYPES from '../Bootstrap/Types'
|
||||
|
||||
|
||||
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": []
|
||||
}
|
||||
@@ -46,8 +46,14 @@
|
||||
{
|
||||
"path": "./packages/scheduler"
|
||||
},
|
||||
{
|
||||
"path": "./packages/security"
|
||||
},
|
||||
{
|
||||
"path": "./packages/syncing-server"
|
||||
},
|
||||
{
|
||||
"path": "./packages/time"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
64
yarn.lock
64
yarn.lock
@@ -1961,10 +1961,10 @@ __metadata:
|
||||
"@newrelic/winston-enricher": ^2.1.0
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/analytics": "workspace:*"
|
||||
"@standardnotes/auth": 3.19.4
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/time": ^1.7.1
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@standardnotes/time": "workspace:*"
|
||||
"@types/cors": ^2.8.9
|
||||
"@types/express": ^4.17.11
|
||||
"@types/ioredis": ^4.28.10
|
||||
@@ -2018,17 +2018,17 @@ __metadata:
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/analytics": "workspace:*"
|
||||
"@standardnotes/api": ^1.1.19
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/domain-events": "workspace:*"
|
||||
"@standardnotes/domain-events-infra": "workspace:*"
|
||||
"@standardnotes/features": ^1.47.0
|
||||
"@standardnotes/predicates": "workspace:*"
|
||||
"@standardnotes/responses": ^1.6.39
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@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
|
||||
@@ -2069,7 +2069,7 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/auth@npm:3.19.4, @standardnotes/auth@npm:^3.19.4":
|
||||
"@standardnotes/auth@npm:^3.19.4":
|
||||
version: 3.19.4
|
||||
resolution: "@standardnotes/auth@npm:3.19.4"
|
||||
dependencies:
|
||||
@@ -2124,10 +2124,10 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/domain-events@workspace:packages/domain-events"
|
||||
dependencies:
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@standardnotes/features": ^1.47.0
|
||||
"@standardnotes/predicates": "workspace:*"
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@types/jest": ^28.1.4
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
@@ -2168,14 +2168,14 @@ __metadata:
|
||||
resolution: "@standardnotes/files-server@workspace:packages/files"
|
||||
dependencies:
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@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
|
||||
@@ -2273,7 +2273,7 @@ __metadata:
|
||||
"@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
|
||||
@@ -2296,6 +2296,22 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/security@workspace:*, @standardnotes/security@workspace:packages/security":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/security@workspace:packages/security"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@types/jest": ^27.4.1
|
||||
"@types/jsonwebtoken": ^8.5.8
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
eslint-plugin-prettier: ^4.2.1
|
||||
jest: ^27.5.1
|
||||
jsonwebtoken: ^8.5.1
|
||||
reflect-metadata: ^0.1.13
|
||||
ts-jest: ^27.1.3
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/server-monorepo@workspace:.":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/server-monorepo@workspace:."
|
||||
@@ -2365,14 +2381,14 @@ __metadata:
|
||||
"@newrelic/winston-enricher": ^2.1.0
|
||||
"@sentry/node": ^7.3.0
|
||||
"@standardnotes/analytics": "workspace:*"
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.23.1
|
||||
"@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
|
||||
@@ -2412,16 +2428,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
|
||||
@@ -2690,7 +2711,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/jsonwebtoken@npm:^8.5.0":
|
||||
"@types/jsonwebtoken@npm:^8.5.0, @types/jsonwebtoken@npm:^8.5.8":
|
||||
version: 8.5.8
|
||||
resolution: "@types/jsonwebtoken@npm:8.5.8"
|
||||
dependencies:
|
||||
@@ -2715,6 +2736,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