softkave-node-utils 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/package.json +41 -47
- package/build/src/contexts/SessionContext.d.ts +0 -15
- package/build/src/contexts/SessionContext.js +0 -70
- package/build/src/contexts/SessionContext.js.map +0 -1
- package/build/src/contexts/asyncLocalStorage.d.ts +0 -27
- package/build/src/contexts/asyncLocalStorage.js +0 -115
- package/build/src/contexts/asyncLocalStorage.js.map +0 -1
- package/build/src/contexts/config.d.ts +0 -49
- package/build/src/contexts/config.js +0 -25
- package/build/src/contexts/config.js.map +0 -1
- package/build/src/contexts/data/BaseMongoDataProvider.d.ts +0 -21
- package/build/src/contexts/data/BaseMongoDataProvider.js +0 -157
- package/build/src/contexts/data/BaseMongoDataProvider.js.map +0 -1
- package/build/src/contexts/data/MongoDataProviderUtils.d.ts +0 -6
- package/build/src/contexts/data/MongoDataProviderUtils.js +0 -35
- package/build/src/contexts/data/MongoDataProviderUtils.js.map +0 -1
- package/build/src/contexts/data/dataQueryToMongoQuery.d.ts +0 -3
- package/build/src/contexts/data/dataQueryToMongoQuery.js +0 -85
- package/build/src/contexts/data/dataQueryToMongoQuery.js.map +0 -1
- package/build/src/contexts/data/index.d.ts +0 -5
- package/build/src/contexts/data/index.js +0 -22
- package/build/src/contexts/data/index.js.map +0 -1
- package/build/src/contexts/data/types.d.ts +0 -114
- package/build/src/contexts/data/types.js +0 -15
- package/build/src/contexts/data/types.js.map +0 -1
- package/build/src/contexts/data/utils.d.ts +0 -2
- package/build/src/contexts/data/utils.js +0 -24
- package/build/src/contexts/data/utils.js.map +0 -1
- package/build/src/contexts/email/SESEmailProviderContext.d.ts +0 -9
- package/build/src/contexts/email/SESEmailProviderContext.js +0 -49
- package/build/src/contexts/email/SESEmailProviderContext.js.map +0 -1
- package/build/src/contexts/email/index.d.ts +0 -2
- package/build/src/contexts/email/index.js +0 -19
- package/build/src/contexts/email/index.js.map +0 -1
- package/build/src/contexts/email/types.d.ts +0 -13
- package/build/src/contexts/email/types.js +0 -3
- package/build/src/contexts/email/types.js.map +0 -1
- package/build/src/contexts/encryption/AWSSecretsManagerProvider.d.ts +0 -12
- package/build/src/contexts/encryption/AWSSecretsManagerProvider.js +0 -51
- package/build/src/contexts/encryption/AWSSecretsManagerProvider.js.map +0 -1
- package/build/src/contexts/encryption/MemorySecretsManagerProvider.d.ts +0 -12
- package/build/src/contexts/encryption/MemorySecretsManagerProvider.js +0 -35
- package/build/src/contexts/encryption/MemorySecretsManagerProvider.js.map +0 -1
- package/build/src/contexts/encryption/index.d.ts +0 -3
- package/build/src/contexts/encryption/index.js +0 -20
- package/build/src/contexts/encryption/index.js.map +0 -1
- package/build/src/contexts/encryption/types.d.ts +0 -29
- package/build/src/contexts/encryption/types.js +0 -3
- package/build/src/contexts/encryption/types.js.map +0 -1
- package/build/src/contexts/globalUtils.d.ts +0 -2
- package/build/src/contexts/globalUtils.js +0 -17
- package/build/src/contexts/globalUtils.js.map +0 -1
- package/build/src/contexts/index.d.ts +0 -11
- package/build/src/contexts/index.js +0 -28
- package/build/src/contexts/index.js.map +0 -1
- package/build/src/contexts/injection/index.d.ts +0 -3
- package/build/src/contexts/injection/index.js +0 -20
- package/build/src/contexts/injection/index.js.map +0 -1
- package/build/src/contexts/injection/injectables.d.ts +0 -56
- package/build/src/contexts/injection/injectables.js +0 -26
- package/build/src/contexts/injection/injectables.js.map +0 -1
- package/build/src/contexts/injection/keys.d.ts +0 -22
- package/build/src/contexts/injection/keys.js +0 -33
- package/build/src/contexts/injection/keys.js.map +0 -1
- package/build/src/contexts/injection/register.d.ts +0 -33
- package/build/src/contexts/injection/register.js +0 -107
- package/build/src/contexts/injection/register.js.map +0 -1
- package/build/src/contexts/logger/index.d.ts +0 -3
- package/build/src/contexts/logger/index.js +0 -20
- package/build/src/contexts/logger/index.js.map +0 -1
- package/build/src/contexts/logger/noop.d.ts +0 -5
- package/build/src/contexts/logger/noop.js +0 -12
- package/build/src/contexts/logger/noop.js.map +0 -1
- package/build/src/contexts/logger/types.d.ts +0 -11
- package/build/src/contexts/logger/types.js +0 -8
- package/build/src/contexts/logger/types.js.map +0 -1
- package/build/src/contexts/logger/utils.d.ts +0 -2
- package/build/src/contexts/logger/utils.js +0 -15
- package/build/src/contexts/logger/utils.js.map +0 -1
- package/build/src/contexts/semantic/DataSemanticDataAccessBaseProvider.d.ts +0 -28
- package/build/src/contexts/semantic/DataSemanticDataAccessBaseProvider.js +0 -115
- package/build/src/contexts/semantic/DataSemanticDataAccessBaseProvider.js.map +0 -1
- package/build/src/contexts/semantic/index.d.ts +0 -3
- package/build/src/contexts/semantic/index.js +0 -20
- package/build/src/contexts/semantic/index.js.map +0 -1
- package/build/src/contexts/semantic/types.d.ts +0 -48
- package/build/src/contexts/semantic/types.js +0 -3
- package/build/src/contexts/semantic/types.js.map +0 -1
- package/build/src/contexts/semantic/utils.d.ts +0 -16
- package/build/src/contexts/semantic/utils.js +0 -68
- package/build/src/contexts/semantic/utils.js.map +0 -1
- package/build/src/contexts/types.d.ts +0 -6
- package/build/src/contexts/types.js +0 -3
- package/build/src/contexts/types.js.map +0 -1
- package/build/src/definitions/agent.d.ts +0 -10
- package/build/src/definitions/agent.js +0 -3
- package/build/src/definitions/agent.js.map +0 -1
- package/build/src/definitions/index.d.ts +0 -4
- package/build/src/definitions/index.js +0 -21
- package/build/src/definitions/index.js.map +0 -1
- package/build/src/definitions/resource.d.ts +0 -17
- package/build/src/definitions/resource.js +0 -3
- package/build/src/definitions/resource.js.map +0 -1
- package/build/src/definitions/resourceTypes.d.ts +0 -10
- package/build/src/definitions/resourceTypes.js +0 -19
- package/build/src/definitions/resourceTypes.js.map +0 -1
- package/build/src/definitions/token.d.ts +0 -17
- package/build/src/definitions/token.js +0 -10
- package/build/src/definitions/token.js.map +0 -1
- package/build/src/endpoints/RequestData.d.ts +0 -20
- package/build/src/endpoints/RequestData.js +0 -52
- package/build/src/endpoints/RequestData.js.map +0 -1
- package/build/src/endpoints/constants.d.ts +0 -20
- package/build/src/endpoints/constants.js +0 -24
- package/build/src/endpoints/constants.js.map +0 -1
- package/build/src/endpoints/endpoints.d.ts +0 -7
- package/build/src/endpoints/endpoints.js +0 -33
- package/build/src/endpoints/endpoints.js.map +0 -1
- package/build/src/endpoints/endpoints.mddoc.d.ts +0 -62
- package/build/src/endpoints/endpoints.mddoc.js +0 -437
- package/build/src/endpoints/endpoints.mddoc.js.map +0 -1
- package/build/src/endpoints/extractors.d.ts +0 -9
- package/build/src/endpoints/extractors.js +0 -24
- package/build/src/endpoints/extractors.js.map +0 -1
- package/build/src/endpoints/index.d.ts +0 -10
- package/build/src/endpoints/index.js +0 -27
- package/build/src/endpoints/index.js.map +0 -1
- package/build/src/endpoints/jobs/index.d.ts +0 -1
- package/build/src/endpoints/jobs/index.js +0 -18
- package/build/src/endpoints/jobs/index.js.map +0 -1
- package/build/src/endpoints/jobs/types.d.ts +0 -6
- package/build/src/endpoints/jobs/types.js +0 -3
- package/build/src/endpoints/jobs/types.js.map +0 -1
- package/build/src/endpoints/pagination.d.ts +0 -3
- package/build/src/endpoints/pagination.js +0 -27
- package/build/src/endpoints/pagination.js.map +0 -1
- package/build/src/endpoints/types.d.ts +0 -68
- package/build/src/endpoints/types.js +0 -13
- package/build/src/endpoints/types.js.map +0 -1
- package/build/src/endpoints/utils.d.ts +0 -23
- package/build/src/endpoints/utils.js +0 -131
- package/build/src/endpoints/utils.js.map +0 -1
- package/build/src/endpoints/validation.d.ts +0 -47
- package/build/src/endpoints/validation.js +0 -73
- package/build/src/endpoints/validation.js.map +0 -1
- package/build/src/errors/OperationError.d.ts +0 -20
- package/build/src/errors/OperationError.js +0 -38
- package/build/src/errors/OperationError.js.map +0 -1
- package/build/src/errors/commonErrors.d.ts +0 -24
- package/build/src/errors/commonErrors.js +0 -72
- package/build/src/errors/commonErrors.js.map +0 -1
- package/build/src/errors/endpointErrors.d.ts +0 -31
- package/build/src/errors/endpointErrors.js +0 -83
- package/build/src/errors/endpointErrors.js.map +0 -1
- package/build/src/errors/index.d.ts +0 -6
- package/build/src/errors/index.js +0 -23
- package/build/src/errors/index.js.map +0 -1
- package/build/src/errors/messages.d.ts +0 -11
- package/build/src/errors/messages.js +0 -27
- package/build/src/errors/messages.js.map +0 -1
- package/build/src/errors/reusableErrors.d.ts +0 -12
- package/build/src/errors/reusableErrors.js +0 -25
- package/build/src/errors/reusableErrors.js.map +0 -1
- package/build/src/errors/sessionErrors.d.ts +0 -18
- package/build/src/errors/sessionErrors.js +0 -60
- package/build/src/errors/sessionErrors.js.map +0 -1
- package/build/src/index.d.ts +0 -8
- package/build/src/index.js +0 -25
- package/build/src/index.js.map +0 -1
- package/build/src/mddoc/index.d.ts +0 -4
- package/build/src/mddoc/index.js +0 -21
- package/build/src/mddoc/index.js.map +0 -1
- package/build/src/mddoc/jsSdkCodeGen.d.ts +0 -7
- package/build/src/mddoc/jsSdkCodeGen.js +0 -546
- package/build/src/mddoc/jsSdkCodeGen.js.map +0 -1
- package/build/src/mddoc/mddoc.d.ts +0 -206
- package/build/src/mddoc/mddoc.js +0 -142
- package/build/src/mddoc/mddoc.js.map +0 -1
- package/build/src/mddoc/restApiEndpointsInfoGen.d.ts +0 -10
- package/build/src/mddoc/restApiEndpointsInfoGen.js +0 -92
- package/build/src/mddoc/restApiEndpointsInfoGen.js.map +0 -1
- package/build/src/mddoc/restApiTableOfContentGen.d.ts +0 -2
- package/build/src/mddoc/restApiTableOfContentGen.js +0 -51
- package/build/src/mddoc/restApiTableOfContentGen.js.map +0 -1
- package/build/src/mongodb/connection.d.ts +0 -26
- package/build/src/mongodb/connection.js +0 -50
- package/build/src/mongodb/connection.js.map +0 -1
- package/build/src/mongodb/constants.d.ts +0 -4
- package/build/src/mongodb/constants.js +0 -7
- package/build/src/mongodb/constants.js.map +0 -1
- package/build/src/mongodb/index.d.ts +0 -3
- package/build/src/mongodb/index.js +0 -20
- package/build/src/mongodb/index.js.map +0 -1
- package/build/src/mongodb/utils.d.ts +0 -20
- package/build/src/mongodb/utils.js +0 -26
- package/build/src/mongodb/utils.js.map +0 -1
- package/build/src/testUtils/context/email/MockTestEmailProviderContext.d.ts +0 -6
- package/build/src/testUtils/context/email/MockTestEmailProviderContext.js +0 -10
- package/build/src/testUtils/context/email/MockTestEmailProviderContext.js.map +0 -1
- package/build/src/testUtils/context/email/NoopEmailProviderContext.d.ts +0 -6
- package/build/src/testUtils/context/email/NoopEmailProviderContext.js +0 -11
- package/build/src/testUtils/context/email/NoopEmailProviderContext.js.map +0 -1
- package/build/src/testUtils/context/email/TestSESEmailProviderContext.d.ts +0 -8
- package/build/src/testUtils/context/email/TestSESEmailProviderContext.js +0 -14
- package/build/src/testUtils/context/email/TestSESEmailProviderContext.js.map +0 -1
- package/build/src/testUtils/context/email/index.d.ts +0 -3
- package/build/src/testUtils/context/email/index.js +0 -20
- package/build/src/testUtils/context/email/index.js.map +0 -1
- package/build/src/testUtils/context/index.d.ts +0 -2
- package/build/src/testUtils/context/index.js +0 -19
- package/build/src/testUtils/context/index.js.map +0 -1
- package/build/src/testUtils/context/types.d.ts +0 -9
- package/build/src/testUtils/context/types.js +0 -3
- package/build/src/testUtils/context/types.js.map +0 -1
- package/build/src/testUtils/generate/index.d.ts +0 -1
- package/build/src/testUtils/generate/index.js +0 -18
- package/build/src/testUtils/generate/index.js.map +0 -1
- package/build/src/testUtils/generate/utils.d.ts +0 -37
- package/build/src/testUtils/generate/utils.js +0 -79
- package/build/src/testUtils/generate/utils.js.map +0 -1
- package/build/src/testUtils/helpers/assertion.d.ts +0 -25
- package/build/src/testUtils/helpers/assertion.js +0 -63
- package/build/src/testUtils/helpers/assertion.js.map +0 -1
- package/build/src/testUtils/helpers/binary.d.ts +0 -4
- package/build/src/testUtils/helpers/binary.js +0 -19
- package/build/src/testUtils/helpers/binary.js.map +0 -1
- package/build/src/testUtils/helpers/error.d.ts +0 -3
- package/build/src/testUtils/helpers/error.js +0 -43
- package/build/src/testUtils/helpers/error.js.map +0 -1
- package/build/src/testUtils/helpers/index.d.ts +0 -8
- package/build/src/testUtils/helpers/index.js +0 -25
- package/build/src/testUtils/helpers/index.js.map +0 -1
- package/build/src/testUtils/helpers/mock.d.ts +0 -2
- package/build/src/testUtils/helpers/mock.js +0 -15
- package/build/src/testUtils/helpers/mock.js.map +0 -1
- package/build/src/testUtils/helpers/mongodb.d.ts +0 -3
- package/build/src/testUtils/helpers/mongodb.js +0 -17
- package/build/src/testUtils/helpers/mongodb.js.map +0 -1
- package/build/src/testUtils/helpers/request.d.ts +0 -7
- package/build/src/testUtils/helpers/request.js +0 -29
- package/build/src/testUtils/helpers/request.js.map +0 -1
- package/build/src/testUtils/helpers/response.d.ts +0 -2
- package/build/src/testUtils/helpers/response.js +0 -12
- package/build/src/testUtils/helpers/response.js.map +0 -1
- package/build/src/testUtils/helpers/testFns.d.ts +0 -33
- package/build/src/testUtils/helpers/testFns.js +0 -105
- package/build/src/testUtils/helpers/testFns.js.map +0 -1
- package/build/src/testUtils/index.d.ts +0 -3
- package/build/src/testUtils/index.js +0 -20
- package/build/src/testUtils/index.js.map +0 -1
- package/build/src/testUtils/testUtils.d.ts +0 -13
- package/build/src/testUtils/testUtils.js +0 -50
- package/build/src/testUtils/testUtils.js.map +0 -1
- package/build/src/utils/assertion.d.ts +0 -2
- package/build/src/utils/assertion.js +0 -31
- package/build/src/utils/assertion.js.map +0 -1
- package/build/src/utils/aws.d.ts +0 -5
- package/build/src/utils/aws.js +0 -3
- package/build/src/utils/aws.js.map +0 -1
- package/build/src/utils/index.d.ts +0 -3
- package/build/src/utils/index.js +0 -20
- package/build/src/utils/index.js.map +0 -1
- package/build/src/utils/streamToBuffer.d.ts +0 -4
- package/build/src/utils/streamToBuffer.js +0 -19
- package/build/src/utils/streamToBuffer.js.map +0 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "softkave-node-utils",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Softkave Node.js utilities",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "ywordk@gmail.com",
|
|
7
7
|
"name": "softkave"
|
|
@@ -10,63 +10,57 @@
|
|
|
10
10
|
"keywords": [],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/softkave/softkave-
|
|
13
|
+
"url": "https://github.com/softkave/softkave-node-utils.git"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/softkave/softkave-
|
|
16
|
+
"url": "https://github.com/softkave/softkave-node-utils/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/softkave/softkave-node-utils",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./common": {
|
|
22
|
+
"types": "./build/common.d.ts",
|
|
23
|
+
"default": "./build/common.js"
|
|
24
|
+
}
|
|
17
25
|
},
|
|
18
|
-
"homepage": "https://github.com/softkave/softkave-js-utils",
|
|
19
|
-
"main": "build/src/index.js",
|
|
20
|
-
"types": "build/src/index.d.ts",
|
|
21
26
|
"files": [
|
|
22
|
-
"build/
|
|
23
|
-
"build/
|
|
24
|
-
"build/
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
+
"build/{*.js,**/*.js}",
|
|
28
|
+
"build/{*.cjs,**/*.cjs}",
|
|
29
|
+
"build/{*.js.map,**/*.js.map}",
|
|
30
|
+
"build/{*.cjs.map,**/*.cjs.map}",
|
|
31
|
+
"build/{*.d.ts,**/*.d.ts}",
|
|
32
|
+
"!build/**/__tests__/**/*"
|
|
27
33
|
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=13"
|
|
36
|
+
},
|
|
28
37
|
"scripts": {
|
|
29
|
-
"test": "
|
|
38
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
30
39
|
"lint": "gts lint",
|
|
31
40
|
"clean": "gts clean",
|
|
32
|
-
"compile": "tsc",
|
|
41
|
+
"compile": "npm run clean && tsc",
|
|
33
42
|
"fix": "gts fix",
|
|
34
|
-
"prepare": "npm run compile",
|
|
35
43
|
"pretest": "npm run compile",
|
|
36
44
|
"posttest": "npm run lint",
|
|
37
|
-
"check
|
|
38
|
-
"
|
|
39
|
-
"
|
|
45
|
+
"check:circular-deps": "npx dpdm --no-warning --no-tree 'src/**/*.*'",
|
|
46
|
+
"show:packlist": "npm run compile && npm pack --dry-run",
|
|
47
|
+
"publish:npm": "npm run compile && npm publish",
|
|
48
|
+
"publish:yalc": "npm run compile && yalc publish"
|
|
40
49
|
},
|
|
41
|
-
"
|
|
42
|
-
"@
|
|
43
|
-
"@types/
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"@types/node": "20.8.2",
|
|
50
|
-
"gts": "^5.2.0",
|
|
51
|
-
"jest": "^29.7.0",
|
|
52
|
-
"ts-jest": "^29.1.2",
|
|
53
|
-
"typescript": "~5.2.0"
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@types/lodash-es": "^4.17.12",
|
|
52
|
+
"@types/node": "^20",
|
|
53
|
+
"fimidx": "^0.5.0",
|
|
54
|
+
"lodash-es": "^4.17.21",
|
|
55
|
+
"next": "15.2.0",
|
|
56
|
+
"softkave-js-utils": "^0.17.1",
|
|
57
|
+
"zod": "^4.1.11"
|
|
54
58
|
},
|
|
55
|
-
"
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"fs-extra": "^11.2.0",
|
|
62
|
-
"joi": "^17.12.3",
|
|
63
|
-
"js-accessor": "^1.1.0",
|
|
64
|
-
"jsonwebtoken": "^9.0.2",
|
|
65
|
-
"lodash": "^4.17.21",
|
|
66
|
-
"mongoose": "^8.1.1",
|
|
67
|
-
"nanoid": "^5.0.7",
|
|
68
|
-
"softkave-js-utils": "^0.3.1",
|
|
69
|
-
"tsyringe": "^4.8.0",
|
|
70
|
-
"type-fest": "^4.15.0"
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
61
|
+
"@typescript-eslint/parser": "^6.13.2",
|
|
62
|
+
"gts": "^6.0.2",
|
|
63
|
+
"prettier": "^3.6.2",
|
|
64
|
+
"typescript": "^5.9.3"
|
|
71
65
|
}
|
|
72
66
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseTokenData, TokenAccessScope, TokenSubjectDefault } from '../definitions/token';
|
|
2
|
-
export interface SessionContextType {
|
|
3
|
-
decodeToken: (token: string) => BaseTokenData<TokenSubjectDefault>;
|
|
4
|
-
tokenContainsScope: (tokenData: {
|
|
5
|
-
scope: string[];
|
|
6
|
-
}, expectedTokenScopes: TokenAccessScope | TokenAccessScope[]) => boolean;
|
|
7
|
-
encodeToken: (tokenId: string, expires?: string | Date | number | null, issuedAt?: string | Date | number | null) => string;
|
|
8
|
-
}
|
|
9
|
-
export default class SessionContext implements SessionContextType {
|
|
10
|
-
decodeToken: (token: string) => BaseTokenData<TokenSubjectDefault>;
|
|
11
|
-
tokenContainsScope: (tokenData: {
|
|
12
|
-
scope: string[];
|
|
13
|
-
}, expectedTokenScopes: TokenAccessScope | TokenAccessScope[]) => boolean;
|
|
14
|
-
encodeToken: (tokenId: string, expires?: string | Date | number | null, issuedAt?: string | Date | number | null) => string;
|
|
15
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const date_fns_1 = require("date-fns");
|
|
27
|
-
const jwt = __importStar(require("jsonwebtoken"));
|
|
28
|
-
const lodash_1 = require("lodash");
|
|
29
|
-
const softkave_js_utils_1 = require("softkave-js-utils");
|
|
30
|
-
const token_1 = require("../definitions/token");
|
|
31
|
-
const assertion_1 = require("../utils/assertion");
|
|
32
|
-
const injectables_1 = require("./injection/injectables");
|
|
33
|
-
const sessionErrors_1 = require("../errors/sessionErrors");
|
|
34
|
-
class SessionContext {
|
|
35
|
-
constructor() {
|
|
36
|
-
this.decodeToken = (token) => {
|
|
37
|
-
const suppliedConfig = injectables_1.kUtilsInjectables.suppliedConfig();
|
|
38
|
-
(0, assertion_1.appAssert)(suppliedConfig.jwtSecret);
|
|
39
|
-
const tokenData = (0, softkave_js_utils_1.cast)(jwt.verify(token, suppliedConfig.jwtSecret, { complete: false }));
|
|
40
|
-
if (tokenData.version < token_1.kCurrentJWTTokenVersion) {
|
|
41
|
-
throw new sessionErrors_1.CredentialsExpiredError();
|
|
42
|
-
}
|
|
43
|
-
return tokenData;
|
|
44
|
-
};
|
|
45
|
-
this.tokenContainsScope = (tokenData, expectedTokenScopes) => {
|
|
46
|
-
var _a;
|
|
47
|
-
const tokenScopes = (_a = tokenData.scope) !== null && _a !== void 0 ? _a : [];
|
|
48
|
-
const expectedTokenScopesMap = (0, softkave_js_utils_1.indexArray)((0, softkave_js_utils_1.convertToArray)(expectedTokenScopes), { reducer: () => true, indexer: lodash_1.identity });
|
|
49
|
-
const hasTokenAccessScope = !!tokenScopes.find(nextScope => expectedTokenScopesMap[nextScope]);
|
|
50
|
-
return hasTokenAccessScope;
|
|
51
|
-
};
|
|
52
|
-
this.encodeToken = (tokenId, expires, issuedAt) => {
|
|
53
|
-
const suppliedConfig = injectables_1.kUtilsInjectables.suppliedConfig();
|
|
54
|
-
(0, assertion_1.appAssert)(suppliedConfig.jwtSecret);
|
|
55
|
-
const payload = {
|
|
56
|
-
version: token_1.kCurrentJWTTokenVersion,
|
|
57
|
-
sub: { id: tokenId },
|
|
58
|
-
};
|
|
59
|
-
if (expires) {
|
|
60
|
-
payload.exp = (0, date_fns_1.millisecondsToSeconds)((0, date_fns_1.toDate)(expires).valueOf());
|
|
61
|
-
}
|
|
62
|
-
if (issuedAt) {
|
|
63
|
-
payload.iat = (0, date_fns_1.millisecondsToSeconds)((0, date_fns_1.toDate)(issuedAt).valueOf());
|
|
64
|
-
}
|
|
65
|
-
return jwt.sign(payload, suppliedConfig.jwtSecret);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.default = SessionContext;
|
|
70
|
-
//# sourceMappingURL=SessionContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionContext.js","sourceRoot":"","sources":["../../../src/contexts/SessionContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuD;AACvD,kDAAoC;AACpC,mCAAgC;AAChC,yDAAmE;AACnE,gDA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AAuB;gBAChC,GAAG,EAAE,EAAC,EAAE,EAAE,OAAO,EAAC;aACnB,CAAC;YAEF,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,GAAG,GAAG,IAAA,gCAAqB,EAAC,IAAA,iBAAM,EAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;aAChE;YAED,IAAI,QAAQ,EAAE;gBACZ,OAAO,CAAC,GAAG,GAAG,IAAA,gCAAqB,EAAC,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;aACjE;YAED,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC;IACJ,CAAC;CAAA;AAtDD,iCAsDC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
|
-
import { AnyFn, AnyObject, DisposablesStore } from 'softkave-js-utils';
|
|
4
|
-
import { ReadonlyDeep } from 'type-fest';
|
|
5
|
-
export type FimidaraAsyncLocalStorageStore = Record<string, unknown>;
|
|
6
|
-
export type FimidaraAsyncLocalStorage = AsyncLocalStorage<FimidaraAsyncLocalStorageStore>;
|
|
7
|
-
export interface AsyncLocalStorageUtils {
|
|
8
|
-
run: <TFn extends AnyFn>(cb: TFn, store?: AnyObject) => Promise<ReturnType<TFn>>;
|
|
9
|
-
inheritAndRun: <TFn extends AnyFn>(cb: TFn, store?: AnyObject) => Promise<ReturnType<TFn>>;
|
|
10
|
-
get: <T = unknown>(key: string) => T | undefined;
|
|
11
|
-
getStore: () => ReadonlyDeep<AnyObject>;
|
|
12
|
-
set: <T = unknown>(key: string, value: T) => T;
|
|
13
|
-
/** Set if `key` does not exist in store, or use `run()` inheriting parent
|
|
14
|
-
* store to shadow set `key`. Shadow setting means shadow keys are stored in a
|
|
15
|
-
* separate store so they don't collide, but other keys are store in the
|
|
16
|
-
* closest real parent store. */
|
|
17
|
-
shadowSet: <TFn extends AnyFn>(key: string, value: unknown, cb: TFn) => Promise<ReturnType<TFn>>;
|
|
18
|
-
/** Like `shadowSet` but creates a shadow store whether key exists or not. */
|
|
19
|
-
shadowSetForce: <TFn extends AnyFn>(key: string, value: unknown, cb: TFn) => Promise<ReturnType<TFn>>;
|
|
20
|
-
delete: (key: string) => void;
|
|
21
|
-
disposables: () => DisposablesStore;
|
|
22
|
-
}
|
|
23
|
-
export declare const kAsyncLocalStorageUtils: AsyncLocalStorageUtils;
|
|
24
|
-
export declare const kAsyncLocalStorageKeys: {
|
|
25
|
-
txn: string;
|
|
26
|
-
disposables: string;
|
|
27
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kAsyncLocalStorageKeys = exports.kAsyncLocalStorageUtils = void 0;
|
|
4
|
-
const async_hooks_1 = require("async_hooks");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
|
-
const softkave_js_utils_1 = require("softkave-js-utils");
|
|
7
|
-
const injectables_1 = require("./injection/injectables");
|
|
8
|
-
const asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
9
|
-
const kInternalKeys = {
|
|
10
|
-
realStore: Symbol.for('realStore'),
|
|
11
|
-
};
|
|
12
|
-
function getAsyncLocalStore() {
|
|
13
|
-
var _a;
|
|
14
|
-
return (_a = asyncLocalStorage.getStore()) !== null && _a !== void 0 ? _a : {};
|
|
15
|
-
}
|
|
16
|
-
function startShadowStore(realStore) {
|
|
17
|
-
const shadowStore = {};
|
|
18
|
-
shadowStore[kInternalKeys.realStore] = realStore;
|
|
19
|
-
return shadowStore;
|
|
20
|
-
}
|
|
21
|
-
/** Returns immedaite real store from shadow store. The real store returned may
|
|
22
|
-
* itself be a shadow of another store. */
|
|
23
|
-
function getImmediateRealStore(shadowStore) {
|
|
24
|
-
return shadowStore ? shadowStore[kInternalKeys.realStore] : undefined;
|
|
25
|
-
}
|
|
26
|
-
function shadowGet(store, key) {
|
|
27
|
-
let item;
|
|
28
|
-
for (; store && !item; store = getImmediateRealStore(store)) {
|
|
29
|
-
item = (0, lodash_1.get)(store, key);
|
|
30
|
-
}
|
|
31
|
-
return item;
|
|
32
|
-
}
|
|
33
|
-
function getDeepestRealStore(store) {
|
|
34
|
-
let realStore;
|
|
35
|
-
for (; store; store = getImmediateRealStore(store)) {
|
|
36
|
-
realStore = store;
|
|
37
|
-
}
|
|
38
|
-
return realStore;
|
|
39
|
-
}
|
|
40
|
-
function shadowSet(store, key, value) {
|
|
41
|
-
const realStore = getDeepestRealStore(store);
|
|
42
|
-
if (realStore) {
|
|
43
|
-
(0, lodash_1.set)(realStore, key, value);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function shadowDelete(store, key) {
|
|
47
|
-
const realStore = getDeepestRealStore(store);
|
|
48
|
-
if (realStore) {
|
|
49
|
-
delete realStore[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function isShadowStore(store) {
|
|
53
|
-
return !!getImmediateRealStore(store);
|
|
54
|
-
}
|
|
55
|
-
exports.kAsyncLocalStorageUtils = {
|
|
56
|
-
run: (cb, store = {}) => {
|
|
57
|
-
return asyncLocalStorage.run(store, async () => {
|
|
58
|
-
try {
|
|
59
|
-
return await cb();
|
|
60
|
-
}
|
|
61
|
-
finally {
|
|
62
|
-
if (!isShadowStore(getAsyncLocalStore())) {
|
|
63
|
-
exports.kAsyncLocalStorageUtils.disposables().disposeAll();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
inheritAndRun: (cb, store = {}) => {
|
|
69
|
-
return exports.kAsyncLocalStorageUtils.run(cb, (0, softkave_js_utils_1.mergeObjects)(store, getAsyncLocalStore(), {
|
|
70
|
-
arrayUpdateStrategy: 'replace',
|
|
71
|
-
}));
|
|
72
|
-
},
|
|
73
|
-
get: (key) => {
|
|
74
|
-
var _a;
|
|
75
|
-
return shadowGet((_a = asyncLocalStorage.getStore()) !== null && _a !== void 0 ? _a : {}, key);
|
|
76
|
-
},
|
|
77
|
-
set: (key, value) => {
|
|
78
|
-
var _a;
|
|
79
|
-
shadowSet((_a = asyncLocalStorage.getStore()) !== null && _a !== void 0 ? _a : {}, key, value);
|
|
80
|
-
return value;
|
|
81
|
-
},
|
|
82
|
-
delete: (key) => {
|
|
83
|
-
var _a;
|
|
84
|
-
// TODO: delete deep
|
|
85
|
-
const store = (_a = asyncLocalStorage.getStore()) !== null && _a !== void 0 ? _a : {};
|
|
86
|
-
shadowDelete(store, key);
|
|
87
|
-
},
|
|
88
|
-
disposables() {
|
|
89
|
-
return (this.get(exports.kAsyncLocalStorageKeys.disposables) ||
|
|
90
|
-
this.set(exports.kAsyncLocalStorageKeys.disposables, new softkave_js_utils_1.DisposablesStore(injectables_1.kUtilsInjectables.promises())));
|
|
91
|
-
},
|
|
92
|
-
getStore() {
|
|
93
|
-
var _a;
|
|
94
|
-
return (_a = asyncLocalStorage.getStore()) !== null && _a !== void 0 ? _a : {};
|
|
95
|
-
},
|
|
96
|
-
shadowSet: (key, value, cb) => {
|
|
97
|
-
if (exports.kAsyncLocalStorageUtils.get(key)) {
|
|
98
|
-
return exports.kAsyncLocalStorageUtils.shadowSetForce(key, value, cb);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
exports.kAsyncLocalStorageUtils.set(key, value);
|
|
102
|
-
return cb();
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
shadowSetForce: async (key, value, cb) => {
|
|
106
|
-
const shadowStore = startShadowStore(getAsyncLocalStore());
|
|
107
|
-
(0, lodash_1.set)(shadowStore, key, value);
|
|
108
|
-
return await exports.kAsyncLocalStorageUtils.run(cb, shadowStore);
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
exports.kAsyncLocalStorageKeys = {
|
|
112
|
-
txn: 'txn',
|
|
113
|
-
disposables: 'disposables',
|
|
114
|
-
};
|
|
115
|
-
//# sourceMappingURL=asyncLocalStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asyncLocalStorage.js","sourceRoot":"","sources":["../../../src/contexts/asyncLocalStorage.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,mCAAgC;AAChC,yDAK2B;AAE3B,yDAA0D;AAqC1D,MAAM,iBAAiB,GACrB,IAAI,+BAAiB,EAAkC,CAAC;AAE1D,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;CACnC,CAAC;AAEF,SAAS,kBAAkB;;IACzB,OAAO,MAAA,iBAAiB,CAAC,QAAQ,EAAE,mCAAI,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,gBAAgB,CAAC,SAAqB;IAC7C,MAAM,WAAW,GAAc,EAAE,CAAC;IAClC,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACjD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;0CAC0C;AAC1C,SAAS,qBAAqB,CAC5B,WAAkC;IAElC,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC;AAED,SAAS,SAAS,CAAC,KAA4B,EAAE,GAAW;IAC1D,IAAI,IAAyB,CAAC;IAE9B,OAAO,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,EAAE;QAC3D,IAAI,GAAG,IAAA,YAAG,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KACxB;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,mBAAmB,CAAC,KAA4B;IACvD,IAAI,SAAgC,CAAC;IAErC,OAAO,KAAK,EAAE,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,EAAE;QAClD,SAAS,GAAG,KA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C3D,IAAA,YAAG,EAAC,WAAW,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,OAAO,MAAM,+BAAuB,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC;AAEW,QAAA,sBAAsB,GAAG;IACpC,GAAG,EAAE,KAAK;IACV,WAAW,EAAE,aAAa;CAC3B,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { LoggerType } from 'softkave-js-utils';
|
|
2
|
-
import { ValueOf } from 'type-fest';
|
|
3
|
-
import { AWSConfig } from '../utils/aws';
|
|
4
|
-
export declare const kFimidaraConfigEmailProvider: {
|
|
5
|
-
readonly ses: "ses";
|
|
6
|
-
readonly noop: "noop";
|
|
7
|
-
};
|
|
8
|
-
export type FimidaraConfigEmailProvider = ValueOf<typeof kFimidaraConfigEmailProvider>;
|
|
9
|
-
export declare const kFimidaraConfigSecretsManagerProvider: {
|
|
10
|
-
readonly awsSecretsManager: "awsSecretsManager";
|
|
11
|
-
readonly memory: "memory";
|
|
12
|
-
};
|
|
13
|
-
export type FimidaraConfigSecretsManagerProvider = ValueOf<typeof kFimidaraConfigSecretsManagerProvider>;
|
|
14
|
-
export declare const kFimidaraConfigDbType: {
|
|
15
|
-
readonly mongoDb: "mongoDb";
|
|
16
|
-
readonly noop: "noop";
|
|
17
|
-
};
|
|
18
|
-
export type FimidaraConfigDbType = ValueOf<typeof kFimidaraConfigDbType>;
|
|
19
|
-
export type FimidaraSuppliedConfig = Partial<{
|
|
20
|
-
clientDomain: string;
|
|
21
|
-
dbType: FimidaraConfigDbType;
|
|
22
|
-
mongoDbURI: string;
|
|
23
|
-
mongoDbDatabaseName: string;
|
|
24
|
-
jwtSecret: string;
|
|
25
|
-
exposeHttpServer: boolean;
|
|
26
|
-
httpPort: string;
|
|
27
|
-
exposeHttpsServer: boolean;
|
|
28
|
-
httpsPort: string;
|
|
29
|
-
httpsPublicKeyFilepath: string;
|
|
30
|
-
httpsPrivateKeyFilepath: string;
|
|
31
|
-
emailProvider: FimidaraConfigEmailProvider;
|
|
32
|
-
secretsManagerProvider: FimidaraConfigSecretsManagerProvider;
|
|
33
|
-
awsConfig: AWSConfig;
|
|
34
|
-
appName: string;
|
|
35
|
-
appDefaultEmailAddressFrom: string;
|
|
36
|
-
awsEmailEncoding: string;
|
|
37
|
-
dateFormat: string;
|
|
38
|
-
clientLoginLink: string;
|
|
39
|
-
clientSignupLink: string;
|
|
40
|
-
changePasswordLink: string;
|
|
41
|
-
verifyEmailLink: string;
|
|
42
|
-
test: {
|
|
43
|
-
awsConfig?: AWSConfig;
|
|
44
|
-
bucket?: string;
|
|
45
|
-
};
|
|
46
|
-
loggerType: LoggerType;
|
|
47
|
-
}>;
|
|
48
|
-
export type FimidaraConfig = FimidaraSuppliedConfig;
|
|
49
|
-
export declare function getSuppliedConfig(): FimidaraSuppliedConfig;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSuppliedConfig = exports.kFimidaraConfigDbType = exports.kFimidaraConfigSecretsManagerProvider = exports.kFimidaraConfigEmailProvider = void 0;
|
|
7
|
-
const config_1 = __importDefault(require("config"));
|
|
8
|
-
exports.kFimidaraConfigEmailProvider = {
|
|
9
|
-
ses: 'ses',
|
|
10
|
-
noop: 'noop',
|
|
11
|
-
};
|
|
12
|
-
exports.kFimidaraConfigSecretsManagerProvider = {
|
|
13
|
-
awsSecretsManager: 'awsSecretsManager',
|
|
14
|
-
memory: 'memory',
|
|
15
|
-
};
|
|
16
|
-
exports.kFimidaraConfigDbType = {
|
|
17
|
-
mongoDb: 'mongoDb',
|
|
18
|
-
noop: 'noop',
|
|
19
|
-
};
|
|
20
|
-
function getSuppliedConfig() {
|
|
21
|
-
const envSuppliedConfig = config_1.default.util.toObject();
|
|
22
|
-
return envSuppliedConfig;
|
|
23
|
-
}
|
|
24
|
-
exports.getSuppliedConfig = getSuppliedConfig;
|
|
25
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/contexts/config.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAKf,QAAA,4BAA4B,GAAG;IAC1C,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAME,QAAA,qCAAqC,GAAG;IACnD,iBAAiB,EAAE,mBAAmB;IACtC,MAAM,EAAE,QAAQ;CACR,CAAC;AAME,QAAA,qBAAqB,GAAG;IACnC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACJ,CAAC;AAoCX,SAAgB,iBAAiB;IAC/B,MAAM,iBAAiB,GAAG,gBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAHD,8CAGC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AnyObject, Model } from 'mongoose';
|
|
2
|
-
import { BaseDataProvider, BulkOpItem, DataProviderOpParams, DataProviderQueryListParams, DataProviderQueryParams, DataQuery } from './types';
|
|
3
|
-
export declare abstract class BaseMongoDataProvider<T extends AnyObject, TQuery extends DataQuery<AnyObject> = DataQuery<T>> implements BaseDataProvider<T, TQuery> {
|
|
4
|
-
abstract throwNotFound: () => void;
|
|
5
|
-
model: Model<T>;
|
|
6
|
-
constructor(model: Model<T>);
|
|
7
|
-
insertItem: (item: T, otherProps?: DataProviderOpParams | undefined) => Promise<T>;
|
|
8
|
-
insertList: (items: T[], otherProps?: DataProviderOpParams | undefined) => Promise<void>;
|
|
9
|
-
getManyByQuery: (query: TQuery, otherProps?: DataProviderQueryListParams<T> | undefined) => Promise<T[]>;
|
|
10
|
-
getOneByQuery: (query: TQuery, otherProps?: DataProviderQueryParams<T> | undefined) => Promise<T | null>;
|
|
11
|
-
assertGetOneByQuery: (query: TQuery, otherProps?: DataProviderQueryParams<T> | undefined) => Promise<T>;
|
|
12
|
-
updateManyByQuery: (query: TQuery, data: Partial<T>, otherProps?: DataProviderOpParams | undefined) => Promise<void>;
|
|
13
|
-
updateOneByQuery: (query: TQuery, data: Partial<T>, otherProps?: DataProviderOpParams | undefined) => Promise<void>;
|
|
14
|
-
getAndUpdateOneByQuery: (query: TQuery, data: Partial<T>, otherProps?: DataProviderQueryParams<T> | undefined) => Promise<T>;
|
|
15
|
-
assertGetAndUpdateOneByQuery: (query: TQuery, data: Partial<T>, otherProps?: DataProviderQueryParams<T> | undefined) => Promise<T>;
|
|
16
|
-
existsByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams | undefined) => Promise<boolean>;
|
|
17
|
-
countByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams | undefined) => Promise<number>;
|
|
18
|
-
deleteManyByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams | undefined) => Promise<void>;
|
|
19
|
-
deleteOneByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams | undefined) => Promise<void>;
|
|
20
|
-
bulkWrite(ops: BulkOpItem<T>[], otherProps?: DataProviderOpParams | undefined): Promise<void>;
|
|
21
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseMongoDataProvider = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const types_1 = require("./types");
|
|
6
|
-
// eslint-disable-next-line node/no-extraneous-import
|
|
7
|
-
const dataQueryToMongoQuery_1 = require("./dataQueryToMongoQuery");
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
function getMongoQueryOptionsForOp(params) {
|
|
10
|
-
return { session: params === null || params === void 0 ? void 0 : params.txn, lean: true };
|
|
11
|
-
}
|
|
12
|
-
function getMongoBulkWriteOptions(params) {
|
|
13
|
-
return { session: params === null || params === void 0 ? void 0 : params.txn };
|
|
14
|
-
}
|
|
15
|
-
function getMongoQueryOptionsForOne(
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
params) {
|
|
18
|
-
return { ...getMongoQueryOptionsForOp(params), projection: params === null || params === void 0 ? void 0 : params.projection };
|
|
19
|
-
}
|
|
20
|
-
function getMongoQueryOptionsForMany(
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
params) {
|
|
23
|
-
const page = (0, utils_1.getPage)(params === null || params === void 0 ? void 0 : params.page);
|
|
24
|
-
const pageSize = (0, utils_1.getPageSize)(params === null || params === void 0 ? void 0 : params.pageSize, page);
|
|
25
|
-
const skip = (0, lodash_1.isNumber)(page) && (0, lodash_1.isNumber)(pageSize)
|
|
26
|
-
? Math.max(page, 0) * pageSize
|
|
27
|
-
: undefined;
|
|
28
|
-
return {
|
|
29
|
-
...getMongoQueryOptionsForOp(params),
|
|
30
|
-
skip,
|
|
31
|
-
limit: pageSize,
|
|
32
|
-
projection: params === null || params === void 0 ? void 0 : params.projection,
|
|
33
|
-
sort: params === null || params === void 0 ? void 0 : params.sort,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
class BaseMongoDataProvider {
|
|
37
|
-
constructor(model) {
|
|
38
|
-
this.insertItem = async (item, otherProps) => {
|
|
39
|
-
await this.insertList([item], otherProps);
|
|
40
|
-
return item;
|
|
41
|
-
};
|
|
42
|
-
this.insertList = async (items, otherProps) => {
|
|
43
|
-
await this.model.insertMany(items, getMongoQueryOptionsForOp(otherProps));
|
|
44
|
-
};
|
|
45
|
-
this.getManyByQuery = async (query, otherProps) => {
|
|
46
|
-
const mongoQuery = (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query);
|
|
47
|
-
const items = await this.model
|
|
48
|
-
.find(mongoQuery, otherProps === null || otherProps === void 0 ? void 0 : otherProps.projection, getMongoQueryOptionsForMany(otherProps))
|
|
49
|
-
.lean()
|
|
50
|
-
.exec();
|
|
51
|
-
return items;
|
|
52
|
-
};
|
|
53
|
-
this.getOneByQuery = async (query, otherProps) => {
|
|
54
|
-
const opts = getMongoQueryOptionsForOne(otherProps);
|
|
55
|
-
const mQuery = (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query);
|
|
56
|
-
const item = await this.model
|
|
57
|
-
.findOne(mQuery, opts.projection, opts)
|
|
58
|
-
.lean()
|
|
59
|
-
.exec();
|
|
60
|
-
return item;
|
|
61
|
-
};
|
|
62
|
-
this.assertGetOneByQuery = async (query, otherProps) => {
|
|
63
|
-
const item = await this.getOneByQuery(query, otherProps);
|
|
64
|
-
if (!item)
|
|
65
|
-
this.throwNotFound();
|
|
66
|
-
return item;
|
|
67
|
-
};
|
|
68
|
-
this.updateManyByQuery = async (query, data, otherProps) => {
|
|
69
|
-
await this.model
|
|
70
|
-
.updateMany((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), data, getMongoQueryOptionsForOp(otherProps))
|
|
71
|
-
.exec();
|
|
72
|
-
};
|
|
73
|
-
this.updateOneByQuery = async (query, data, otherProps) => {
|
|
74
|
-
await this.model
|
|
75
|
-
.updateOne((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), data, getMongoQueryOptionsForOp(otherProps))
|
|
76
|
-
.exec();
|
|
77
|
-
};
|
|
78
|
-
this.getAndUpdateOneByQuery = async (query, data, otherProps) => {
|
|
79
|
-
const item = await this.model
|
|
80
|
-
.findOneAndUpdate((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), data, {
|
|
81
|
-
...getMongoQueryOptionsForOne(otherProps),
|
|
82
|
-
new: true,
|
|
83
|
-
})
|
|
84
|
-
.exec();
|
|
85
|
-
return item;
|
|
86
|
-
};
|
|
87
|
-
this.assertGetAndUpdateOneByQuery = async (query, data, otherProps) => {
|
|
88
|
-
const item = await this.getAndUpdateOneByQuery(query, data, otherProps);
|
|
89
|
-
if (!item)
|
|
90
|
-
this.throwNotFound();
|
|
91
|
-
return item;
|
|
92
|
-
};
|
|
93
|
-
this.existsByQuery = async (query, otherProps) => {
|
|
94
|
-
return !!(await this.getOneByQuery(query, {
|
|
95
|
-
...otherProps,
|
|
96
|
-
projection: '_id',
|
|
97
|
-
}));
|
|
98
|
-
};
|
|
99
|
-
this.countByQuery = async (query, otherProps) => {
|
|
100
|
-
return await this.model
|
|
101
|
-
.countDocuments((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), getMongoQueryOptionsForOp(otherProps))
|
|
102
|
-
.exec();
|
|
103
|
-
};
|
|
104
|
-
this.deleteManyByQuery = async (query, otherProps) => {
|
|
105
|
-
await this.model
|
|
106
|
-
.deleteMany((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), getMongoQueryOptionsForOp(otherProps))
|
|
107
|
-
.exec();
|
|
108
|
-
};
|
|
109
|
-
this.deleteOneByQuery = async (query, otherProps) => {
|
|
110
|
-
await this.model
|
|
111
|
-
.deleteOne((0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(query), getMongoQueryOptionsForOp(otherProps))
|
|
112
|
-
.exec();
|
|
113
|
-
};
|
|
114
|
-
this.model = model;
|
|
115
|
-
}
|
|
116
|
-
async bulkWrite(ops, otherProps) {
|
|
117
|
-
const mongoOps = [];
|
|
118
|
-
ops.forEach(op => {
|
|
119
|
-
let mongoOp = null;
|
|
120
|
-
switch (op.type) {
|
|
121
|
-
case types_1.BulkOpType.InsertOne:
|
|
122
|
-
mongoOp = { insertOne: { document: op.item } };
|
|
123
|
-
break;
|
|
124
|
-
case types_1.BulkOpType.UpdateOne:
|
|
125
|
-
mongoOp = {
|
|
126
|
-
updateOne: {
|
|
127
|
-
filter: (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(op.query),
|
|
128
|
-
update: op.update,
|
|
129
|
-
upsert: op.upsert,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
break;
|
|
133
|
-
case types_1.BulkOpType.UpdateMany:
|
|
134
|
-
mongoOp = {
|
|
135
|
-
updateMany: {
|
|
136
|
-
filter: (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(op.query),
|
|
137
|
-
update: op.update,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
break;
|
|
141
|
-
case types_1.BulkOpType.DeleteOne:
|
|
142
|
-
mongoOp = { deleteOne: { filter: (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(op.query) } };
|
|
143
|
-
break;
|
|
144
|
-
case types_1.BulkOpType.DeleteMany:
|
|
145
|
-
mongoOp = { deleteMany: { filter: (0, dataQueryToMongoQuery_1.dataQueryToMongoQuery)(op.query) } };
|
|
146
|
-
break;
|
|
147
|
-
default: // do nothing
|
|
148
|
-
}
|
|
149
|
-
if (mongoOp) {
|
|
150
|
-
mongoOps.push(mongoOp);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
await this.model.bulkWrite(mongoOps, getMongoBulkWriteOptions(otherProps));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.BaseMongoDataProvider = BaseMongoDataProvider;
|
|
157
|
-
//# sourceMappingURL=BaseMongoDataProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMongoDataProvider.js","sourceRoot":"","sources":["../../../../src/contexts/data/BaseMongoDataProvider.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAQhC,mCAQiB;AACjB,qDAAqD;AACrD,mEAA8D;AAC9D,mCAA6C;AAE7C,SAAS,yBAAyB,CAAC,MAA6B;IAI9D,OAAO,EAAC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAgC,EAAE,IAAI,EAAE,I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wBACR,SAAS,EAAE;4BACT,MAAM,EAAE,IAAA,6CAAqB,EAAC,EAAE,CAAC,KAAK,CAAC;4BACvC,MAAM,EAAE,EAAE,CAAC,MAAM;4BACjB,MAAM,EAAE,EAAE,CAAC,MAAM;yBAClB;qBACF,CAAC;oBACF,MAAM;gBAER,KAAK,kBAAU,CAAC,UAAU;oBACxB,OAAO,GAAG;wBACR,UAAU,EAAE;4BACV,MAAM,EAAE,IAAA,6CAAqB,EAAC,EAAE,CAAC,KAAK,CAAC;4BACvC,MAAM,EAAE,EAAE,CAAC,MAAM;yBAClB;qBACF,CAAC;oBACF,MAAM;gBAER,KAAK,kBAAU,CAAC,SAAS;oBACvB,OAAO,GAAG,EAAC,SAAS,EAAE,EAAC,MAAM,EAAE,IAAA,6CAAqB,EAAC,EAAE,CAAC,KAAK,CAAC,EAAC,EAAC,CAAC;oBACjE,MAAM;gBAER,KAAK,kBAAU,CAAC,UAAU;oBACxB,OAAO,GAAG,EAAC,UAAU,EAAE,EAAC,MAAM,EAAE,IAAA,6CAAqB,EAAC,EAAE,CAAC,KAAK,CAAC,EAAC,EAAC,CAAC;oBAClE,MAAM;gBAER,QAAQ,CAAC,aAAa;aACvB;YAED,IAAI,OAAO,EAAE;gBACX,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACxB;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF;AAxND,sDAwNC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ClientSession } from 'mongoose';
|
|
2
|
-
import { AnyFn } from 'softkave-js-utils';
|
|
3
|
-
import { DataProviderUtils } from './types';
|
|
4
|
-
export declare class MongoDataProviderUtils implements DataProviderUtils {
|
|
5
|
-
withTxn<TResult>(fn: AnyFn<[txn: ClientSession], Promise<TResult>>, reuseAsyncLocalTxn?: boolean, existingSession?: unknown): Promise<TResult>;
|
|
6
|
-
}
|