feat: add predicates package

This commit is contained in:
Karol Sójko
2022-07-06 10:49:22 +02:00
parent b4f1c6f7f8
commit ed62ed516f
20 changed files with 169 additions and 28 deletions

37
.pnp.cjs generated
View File

@@ -44,6 +44,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"name": "@standardnotes/files-server",\
"reference": "workspace:packages/files"\
},\
{\
"name": "@standardnotes/predicates",\
"reference": "workspace:packages/predicates"\
},\
{\
"name": "@standardnotes/scheduler-server",\
"reference": "workspace:packages/scheduler"\
@@ -62,6 +66,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@standardnotes/domain-events", ["workspace:packages/domain-events"]],\
["@standardnotes/domain-events-infra", ["workspace:packages/domain-events-infra"]],\
["@standardnotes/files-server", ["workspace:packages/files"]],\
["@standardnotes/predicates", ["workspace:packages/predicates"]],\
["@standardnotes/scheduler-server", ["workspace:packages/scheduler"]],\
["@standardnotes/server-monorepo", ["workspace:."]],\
["@standardnotes/syncing-server", ["workspace:packages/syncing-server"]]\
@@ -2730,8 +2735,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@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/scheduler", "npm:1.1.2"],\
["@standardnotes/settings", "npm:1.15.0"],\
["@standardnotes/sncrypto-common", "npm:1.9.0"],\
["@standardnotes/sncrypto-node", "npm:1.8.3"],\
@@ -2808,7 +2813,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@standardnotes/auth", "npm:3.19.4"],\
["@standardnotes/common", "npm:1.23.1"],\
["@standardnotes/features", "npm:1.50.0"],\
["@standardnotes/scheduler", "npm:1.1.2"],\
["@standardnotes/predicates", "workspace:packages/predicates"],\
["@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"],\
@@ -2949,6 +2954,22 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "HARD"\
}]\
]],\
["@standardnotes/predicates", [\
["workspace:packages/predicates", {\
"packageLocation": "./packages/predicates/",\
"packageDependencies": [\
["@standardnotes/predicates", "workspace:packages/predicates"],\
["@standardnotes/common", "npm:1.23.1"],\
["@types/jest", "npm:27.5.2"],\
["@typescript-eslint/eslint-plugin", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:5.30.5"],\
["eslint-plugin-prettier", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:4.2.1"],\
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.5.1"],\
["reflect-metadata", "npm:0.1.13"],\
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:27.1.5"]\
],\
"linkType": "SOFT"\
}]\
]],\
["@standardnotes/responses", [\
["npm:1.6.39", {\
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.6.39-395f4c2d65-0ea1d4d5b8.zip/node_modules/@standardnotes/responses/",\
@@ -2961,16 +2982,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "HARD"\
}]\
]],\
["@standardnotes/scheduler", [\
["npm:1.1.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-scheduler-npm-1.1.2-78f89314fb-68642a0874.zip/node_modules/@standardnotes/scheduler/",\
"packageDependencies": [\
["@standardnotes/scheduler", "npm:1.1.2"],\
["@standardnotes/common", "npm:1.23.1"]\
],\
"linkType": "HARD"\
}]\
]],\
["@standardnotes/scheduler-server", [\
["workspace:packages/scheduler", {\
"packageLocation": "./packages/scheduler/",\
@@ -2981,7 +2992,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@standardnotes/common", "npm:1.23.1"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
["@standardnotes/scheduler", "npm:1.1.2"],\
["@standardnotes/predicates", "workspace:packages/predicates"],\
["@standardnotes/time", "npm:1.7.1"],\
["@types/ioredis", "npm:4.28.10"],\
["@types/jest", "npm:28.1.4"],\

View File

@@ -40,8 +40,8 @@
"@standardnotes/domain-events": "workspace:*",
"@standardnotes/domain-events-infra": "workspace:*",
"@standardnotes/features": "^1.47.0",
"@standardnotes/predicates": "workspace:*",
"@standardnotes/responses": "^1.6.39",
"@standardnotes/scheduler": "^1.1.2",
"@standardnotes/settings": "^1.15.0",
"@standardnotes/sncrypto-common": "^1.9.0",
"@standardnotes/sncrypto-node": "^1.8.3",

View File

@@ -26,7 +26,7 @@
"@standardnotes/auth": "^3.19.4",
"@standardnotes/common": "^1.23.1",
"@standardnotes/features": "^1.47.0",
"@standardnotes/scheduler": "^1.1.2",
"@standardnotes/predicates": "workspace:*",
"reflect-metadata": "^0.1.13"
},
"devDependencies": {

View File

@@ -0,0 +1 @@
dist

View File

@@ -0,0 +1,6 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,24 @@
# 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.3](https://github.com/standardnotes/snjs/compare/@standardnotes/scheduler@1.1.2...@standardnotes/scheduler@1.1.3) (2022-07-04)
### Bug Fixes
* add missing reflect-metadata package to all packages ([ce3a5bb](https://github.com/standardnotes/snjs/commit/ce3a5bbf3f1d2276ac4abc3eec3c6a44c8c3ba9b))
## [1.1.2](https://github.com/standardnotes/snjs/compare/@standardnotes/scheduler@1.1.1...@standardnotes/scheduler@1.1.2) (2022-06-27)
**Note:** Version bump only for package @standardnotes/scheduler
## [1.1.1](https://github.com/standardnotes/snjs/compare/@standardnotes/scheduler@1.1.0...@standardnotes/scheduler@1.1.1) (2022-06-15)
**Note:** Version bump only for package @standardnotes/scheduler
# 1.1.0 (2022-06-13)
### Features
* add scheduler package ([251a2b5](https://github.com/standardnotes/snjs/commit/251a2b57937c4fcf3d23efd71dd6762a8df4496c))

View 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',
},
}
};

View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -0,0 +1,38 @@
{
"name": "@standardnotes/predicates",
"version": "1.0.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
"description": "Utils and models required for scheduling jobs",
"main": "dist/src/index.js",
"author": "Standard Notes",
"types": "dist/src/index.d.ts",
"files": [
"dist/src"
],
"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 --passWithNoTests"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^27.5.1",
"ts-jest": "^27.1.3"
},
"dependencies": {
"@standardnotes/common": "^1.23.1",
"reflect-metadata": "^0.1.13"
}
}

View File

@@ -0,0 +1,10 @@
import { Uuid } from '@standardnotes/common'
import { PredicateAuthority } from './PredicateAuthority'
import { PredicateName } from './PredicateName'
export type Predicate = {
jobUuid: Uuid
name: PredicateName
authority: PredicateAuthority
}

View File

@@ -0,0 +1,4 @@
export enum PredicateAuthority {
Auth = 'auth',
SyncingServer = 'syncing-server',
}

View File

@@ -0,0 +1,4 @@
export enum PredicateName {
EmailBackupsEnabled = 'email-backups-enabled',
SubscriptionPurchased = 'subscription-purchased',
}

View File

@@ -0,0 +1,4 @@
export enum PredicateVerificationResult {
Affirmed = 'affirmed',
Denied = 'denied',
}

View File

@@ -0,0 +1,4 @@
export * from './Predicate/Predicate'
export * from './Predicate/PredicateAuthority'
export * from './Predicate/PredicateName'
export * from './Predicate/PredicateVerificationResult'

View File

@@ -0,0 +1 @@
export * from './Domain'

View File

@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "./dist",
},
"include": [
"src/**/*"
],
"references": []
}

View File

@@ -29,7 +29,7 @@
"@standardnotes/common": "^1.23.1",
"@standardnotes/domain-events": "workspace:*",
"@standardnotes/domain-events-infra": "workspace:*",
"@standardnotes/scheduler": "^1.1.2",
"@standardnotes/predicates": "workspace:*",
"@standardnotes/time": "^1.7.1",
"aws-sdk": "^2.1158.0",
"dayjs": "^1.11.3",

View File

@@ -40,6 +40,9 @@
{
"path": "./packages/files"
},
{
"path": "./packages/predicates"
},
{
"path": "./packages/scheduler"
},

View File

@@ -2023,8 +2023,8 @@ __metadata:
"@standardnotes/domain-events": "workspace:*"
"@standardnotes/domain-events-infra": "workspace:*"
"@standardnotes/features": ^1.47.0
"@standardnotes/predicates": "workspace:*"
"@standardnotes/responses": ^1.6.39
"@standardnotes/scheduler": ^1.1.2
"@standardnotes/settings": ^1.15.0
"@standardnotes/sncrypto-common": ^1.9.0
"@standardnotes/sncrypto-node": ^1.8.3
@@ -2127,7 +2127,7 @@ __metadata:
"@standardnotes/auth": ^3.19.4
"@standardnotes/common": ^1.23.1
"@standardnotes/features": ^1.47.0
"@standardnotes/scheduler": ^1.1.2
"@standardnotes/predicates": "workspace:*"
"@types/jest": ^28.1.4
"@typescript-eslint/eslint-plugin": ^5.30.0
eslint-plugin-prettier: ^4.2.1
@@ -2238,6 +2238,20 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/predicates@workspace:*, @standardnotes/predicates@workspace:packages/predicates":
version: 0.0.0-use.local
resolution: "@standardnotes/predicates@workspace:packages/predicates"
dependencies:
"@standardnotes/common": ^1.23.1
"@types/jest": ^27.4.1
"@typescript-eslint/eslint-plugin": ^5.30.0
eslint-plugin-prettier: ^4.2.1
jest: ^27.5.1
reflect-metadata: ^0.1.13
ts-jest: ^27.1.3
languageName: unknown
linkType: soft
"@standardnotes/responses@npm:^1.6.39":
version: 1.6.39
resolution: "@standardnotes/responses@npm:1.6.39"
@@ -2258,7 +2272,7 @@ __metadata:
"@standardnotes/common": ^1.23.1
"@standardnotes/domain-events": "workspace:*"
"@standardnotes/domain-events-infra": "workspace:*"
"@standardnotes/scheduler": ^1.1.2
"@standardnotes/predicates": "workspace:*"
"@standardnotes/time": ^1.7.1
"@types/ioredis": ^4.28.10
"@types/jest": ^28.1.2
@@ -2282,15 +2296,6 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/scheduler@npm:^1.1.2":
version: 1.1.2
resolution: "@standardnotes/scheduler@npm:1.1.2"
dependencies:
"@standardnotes/common": ^1.23.1
checksum: 68642a08741aeb4936e4a69e43e2b85e5cbfa3ce60006d292cee517d33093edaf35a6a7af61343d85ab3474d6e980a073a2779f6e0b1f11805ab06a407b15ce7
languageName: node
linkType: hard
"@standardnotes/server-monorepo@workspace:.":
version: 0.0.0-use.local
resolution: "@standardnotes/server-monorepo@workspace:."