softkave-node-utils 0.1.0 → 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/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/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/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/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/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/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/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/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/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 -0
- package/build/src/index.js +0 -2
- package/build/src/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/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/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/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/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/testFns.d.ts +0 -30
- package/build/src/testUtils/helpers/testFns.js +0 -96
- package/build/src/testUtils/helpers/testFns.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/streamToBuffer.d.ts +0 -4
- package/build/src/utils/streamToBuffer.js +0 -19
- package/build/src/utils/streamToBuffer.js.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MongoDataProviderUtils = void 0;
|
|
4
|
-
const connection_1 = require("../../mongodb/connection");
|
|
5
|
-
const assertion_1 = require("../../utils/assertion");
|
|
6
|
-
const asyncLocalStorage_1 = require("../asyncLocalStorage");
|
|
7
|
-
const injectables_1 = require("../injection/injectables");
|
|
8
|
-
class MongoDataProviderUtils {
|
|
9
|
-
async withTxn(fn, reuseAsyncLocalTxn = true, existingSession) {
|
|
10
|
-
let result = undefined;
|
|
11
|
-
if (!existingSession && reuseAsyncLocalTxn) {
|
|
12
|
-
existingSession = injectables_1.kUtilsInjectables
|
|
13
|
-
.asyncLocalStorage()
|
|
14
|
-
.get(asyncLocalStorage_1.kAsyncLocalStorageKeys.txn);
|
|
15
|
-
}
|
|
16
|
-
if (existingSession) {
|
|
17
|
-
(0, assertion_1.appAssert)((0, connection_1.isMongoClientSession)(existingSession));
|
|
18
|
-
result = await fn(existingSession);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
const connection = injectables_1.kUtilsInjectables.dbConnection().get();
|
|
22
|
-
(0, assertion_1.appAssert)((0, connection_1.isMongoConnection)(connection));
|
|
23
|
-
const session = await connection.startSession();
|
|
24
|
-
await session.withTransaction(async () => injectables_1.kUtilsInjectables
|
|
25
|
-
.asyncLocalStorage()
|
|
26
|
-
.shadowSetForce(asyncLocalStorage_1.kAsyncLocalStorageKeys.txn, session, async () => (result = await fn(session))));
|
|
27
|
-
await session.endSession();
|
|
28
|
-
}
|
|
29
|
-
// `connection.transaction` throws if error occurs so if the control flow
|
|
30
|
-
// gets here, `result` is set.
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.MongoDataProviderUtils = MongoDataProviderUtils;
|
|
35
|
-
//# sourceMappingURL=MongoDataProviderUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoDataProviderUtils.js","sourceRoot":"","sources":["../../../../src/contexts/data/MongoDataProviderUtils.ts"],"names":[],"mappings":";;;AAEA,yDAGkC;AAClC,qDAAgD;AAChD,4DAA4D;AAC5D,0DAA2D;AAG3D,MAAa,sBAAsB;IACjC,KAAK,CAAC,OAAO,CACX,EAAiD,EACjD,kBAAkB,GAAG,IAAI,EACzB,eAAyB;QAEzB,IAAI,MAAM,GAAwB,SAAS,CAAC;QAE5C,IAAI,CAAC,eAAe,IAAI,kBAAkB,EAAE;YAC1C,eAAe,GAAG,+BAAiB;iBAChC,iBAAiB,EAAE;iBACnB,GAAG,CAAgB,0CAAsB,CAAC,GAAG,CAAC,CAAC;SACnD;QAED,IAAI,eAAe,EAAE;YACnB,IAAA,qBAAS,EAAC,IAAA,iCAAoB,EAAC,eAAe,CAAC,CAAC,CAAC;YACjD,MAAM,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,CAAC;SACpC;aAAM;YACL,MAAM,UAAU,GAAG,+BAAiB,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC;YAC1D,IAAA,qBAAS,EAAC,IAAA,8BAAiB,EAAC,UAAU,CAAC,CAAC,CAAC;YACzC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;YAChD,MAAM,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE,CACvC,+BAAiB;iBACd,iBAAiB,EAAE;iBACnB,cAAc,CACb,0CAAsB,CAAC,GAAG,EAC1B,OAAO,EACP,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CACzC,CACJ,CAAC;YACF,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;SAC5B;QAED,yEAAyE;QACzE,8BAA8B;QAC9B,OAAO,MAA4B,CAAC;IACtC,CAAC;CACF;AArCD,wDAqCC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataQueryToMongoQuery = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const assertion_1 = require("../../utils/assertion");
|
|
6
|
-
function dataQueryToMongoQuery(query) {
|
|
7
|
-
const mongoQuery = {};
|
|
8
|
-
for (const k00 in query) {
|
|
9
|
-
const v00 = query[k00];
|
|
10
|
-
if ((0, lodash_1.isUndefined)(v00)) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
if (typeof v00 !== 'object' || v00 === null) {
|
|
14
|
-
mongoQuery[k00] = v00;
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
if (k00 === '$and' || k00 === '$nor' || k00 === '$or') {
|
|
18
|
-
(0, assertion_1.appAssert)((0, lodash_1.isArray)(v00));
|
|
19
|
-
const qList = v00.map((v01) => dataQueryToMongoQuery(v01));
|
|
20
|
-
mongoQuery[k00] = qList;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
Object.entries(v00).forEach(([k01, v01]) => {
|
|
24
|
-
switch (k01) {
|
|
25
|
-
case '$objMatch': {
|
|
26
|
-
(0, assertion_1.appAssert)((0, lodash_1.isObject)(v01));
|
|
27
|
-
const q01 = dataQueryToMongoQuery(v01);
|
|
28
|
-
Object.entries(q01).forEach(([k02, v02]) => {
|
|
29
|
-
const k03 = `${k00}.${k02}`;
|
|
30
|
-
mongoQuery[k03] = v02;
|
|
31
|
-
});
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
case '$all': {
|
|
35
|
-
(0, assertion_1.appAssert)((0, lodash_1.isArray)(v01));
|
|
36
|
-
const v0100 = (0, lodash_1.first)(v01);
|
|
37
|
-
if ((0, lodash_1.isObjectLike)(v0100) && v0100.$elemMatch) {
|
|
38
|
-
const expQueryList = v01.map(v01Next => ({
|
|
39
|
-
$elemMatch: dataQueryToMongoQuery(v01Next.$elemMatch),
|
|
40
|
-
}));
|
|
41
|
-
const k02 = [k00, '$all'];
|
|
42
|
-
(0, lodash_1.set)(mongoQuery, k02, expQueryList);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const k02 = [k00, '$all'];
|
|
46
|
-
(0, lodash_1.set)(mongoQuery, k02, v01);
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case '$elemMatch': {
|
|
51
|
-
(0, assertion_1.appAssert)((0, lodash_1.isObject)(v01));
|
|
52
|
-
const q01 = dataQueryToMongoQuery(v01);
|
|
53
|
-
const k02 = [k00, '$elemMatch'];
|
|
54
|
-
(0, lodash_1.set)(mongoQuery, k02, q01);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case '$not': {
|
|
58
|
-
(0, assertion_1.appAssert)((0, lodash_1.isObject)(v01));
|
|
59
|
-
if (v01.$objMatch) {
|
|
60
|
-
const objMatch = v01.$objMatch;
|
|
61
|
-
(0, assertion_1.appAssert)((0, lodash_1.isObject)(objMatch));
|
|
62
|
-
const q01 = dataQueryToMongoQuery(objMatch);
|
|
63
|
-
Object.entries(q01).forEach(([k02, v02]) => {
|
|
64
|
-
const k03 = `${k00}.${k02}`;
|
|
65
|
-
mongoQuery[k03] = (0, lodash_1.merge)(mongoQuery[k03] || {}, { $not: v02 });
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const q01 = dataQueryToMongoQuery(v01);
|
|
70
|
-
const k02 = [k00, '$not'];
|
|
71
|
-
(0, lodash_1.set)(mongoQuery, k02, q01);
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
default: {
|
|
76
|
-
const k02 = [k00, k01];
|
|
77
|
-
(0, lodash_1.set)(mongoQuery, k02, v01);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return mongoQuery;
|
|
83
|
-
}
|
|
84
|
-
exports.dataQueryToMongoQuery = dataQueryToMongoQuery;
|
|
85
|
-
//# sourceMappingURL=dataQueryToMongoQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataQueryToMongoQuery.js","sourceRoot":"","sources":["../../../../src/contexts/data/dataQueryToMongoQuery.ts"],"names":[],"mappings":";;;AAAA,mCAQgB;AAEhB,qDAAgD;AAGhD,SAAgB,qBAAqB,CACnC,KAAa;IAEb,MAAM,UAAU,GAAc,EAAE,CAAC;IAEjC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAmB,CAAC,CAAC;QAEvC,IAAI,IAAA,oBAAW,EAAC,GAAG,CAAC,EAAE;YACpB,SAAS;SACV;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;YAC3C,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;YACtB,SAAS;SACV;QAED,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,KAAK,EAAE;YACrD,IAAA,qBAAS,EAAC,IAAA,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L,MAAM,GAAG,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;wBACvC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;wBAC1B,IAAA,YAAG,EAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;qBAC3B;oBAED,MAAM;iBACP;gBAED,OAAO,CAAC,CAAC;oBACP,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;oBACvB,IAAA,YAAG,EAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;iBAC3B;aACF;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,UAAoB,CAAC;AAC9B,CAAC;AA3FD,sDA2FC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { AnyObject, ProjectionType, SortOrder } from 'mongoose';
|
|
2
|
-
import { AnyFn } from 'softkave-js-utils';
|
|
3
|
-
import { Primitive } from 'type-fest';
|
|
4
|
-
export type DataQuerySort<T, K extends keyof T = keyof T> = {
|
|
5
|
-
[P in K]?: SortOrder;
|
|
6
|
-
};
|
|
7
|
-
export interface DataProviderOpParams {
|
|
8
|
-
txn?: unknown;
|
|
9
|
-
}
|
|
10
|
-
export interface DataProviderQueryParams<T> extends DataProviderOpParams {
|
|
11
|
-
projection?: ProjectionType<T>;
|
|
12
|
-
}
|
|
13
|
-
export interface DataProviderQueryListParams<T> extends DataProviderQueryParams<T> {
|
|
14
|
-
/** zero-based index */
|
|
15
|
-
page?: number;
|
|
16
|
-
pageSize?: number;
|
|
17
|
-
sort?: DataQuerySort<T>;
|
|
18
|
-
}
|
|
19
|
-
export declare const kIncludeInProjection: 1;
|
|
20
|
-
export declare const kExcludeFromProjection: 0;
|
|
21
|
-
export type DataProviderLiteralType = Primitive | Date;
|
|
22
|
-
export interface ComparisonLiteralFieldQueryOps<T = DataProviderLiteralType> {
|
|
23
|
-
$eq?: T | null;
|
|
24
|
-
$in?: Array<T | null>;
|
|
25
|
-
$ne?: T | null;
|
|
26
|
-
$nin?: Array<T | null>;
|
|
27
|
-
$exists?: boolean;
|
|
28
|
-
$regex?: T extends string ? string | RegExp : never;
|
|
29
|
-
$options?: T extends string ? string : never;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Can also be used to query dates in Mongo.
|
|
33
|
-
*/
|
|
34
|
-
export interface NumberLiteralFieldQueryOps {
|
|
35
|
-
$gt?: number;
|
|
36
|
-
$gte?: number;
|
|
37
|
-
$lt?: number;
|
|
38
|
-
$lte?: number;
|
|
39
|
-
}
|
|
40
|
-
export type LiteralFieldQueryOps<T = DataProviderLiteralType> = (T extends DataProviderLiteralType ? ComparisonLiteralFieldQueryOps<T> | NumberLiteralFieldQueryOps | T : never) | null;
|
|
41
|
-
export type LiteralDataQuery<T> = {
|
|
42
|
-
[P in keyof T]?: ExpandDataQuery<Exclude<T[P], undefined>>;
|
|
43
|
-
};
|
|
44
|
-
export interface RecordFieldQueryOps<T extends AnyObject> {
|
|
45
|
-
$objMatch: LiteralDataQuery<T>;
|
|
46
|
-
}
|
|
47
|
-
export interface ElemMatchFieldQueryOps<T> {
|
|
48
|
-
$elemMatch?: T extends AnyObject ? LiteralDataQuery<T> : never;
|
|
49
|
-
}
|
|
50
|
-
export interface ArrayFieldQueryOps<T> extends ElemMatchFieldQueryOps<T> {
|
|
51
|
-
$size?: number;
|
|
52
|
-
$all?: T extends DataProviderLiteralType ? T[] : T extends AnyObject ? ElemMatchFieldQueryOps<T>[] : never;
|
|
53
|
-
$eq?: (T extends DataProviderLiteralType ? T | T[] : never) | null;
|
|
54
|
-
}
|
|
55
|
-
export interface FieldLogicalQueryOps<T> {
|
|
56
|
-
$not?: ExpandDataQuery<T, true>;
|
|
57
|
-
}
|
|
58
|
-
export interface LogicalQueryOps<T> {
|
|
59
|
-
$and?: LiteralDataQuery<T>[];
|
|
60
|
-
$nor?: LiteralDataQuery<T>[];
|
|
61
|
-
$or?: LiteralDataQuery<T>[];
|
|
62
|
-
}
|
|
63
|
-
type ExpandDataQuery<TValue, TExcludeFieldLogical extends boolean = false> = (Exclude<TValue, undefined> extends DataProviderLiteralType ? TValue | LiteralFieldQueryOps<TValue> : never) | (TExcludeFieldLogical extends false ? FieldLogicalQueryOps<TValue> : never) | (NonNullable<TValue> extends Array<infer TArrayItem> ? ArrayFieldQueryOps<TArrayItem> | (TArrayItem extends AnyObject ? RecordFieldQueryOps<TArrayItem> : never) | (TArrayItem extends DataProviderLiteralType ? TArrayItem : never) : NonNullable<TValue> extends AnyObject ? RecordFieldQueryOps<NonNullable<TValue>> : never);
|
|
64
|
-
export type DataQuery<T> = LiteralDataQuery<T> & LogicalQueryOps<T>;
|
|
65
|
-
export type KeyedComparisonOps<TData extends AnyObject> = keyof TData extends string ? `${keyof TData}.${keyof ComparisonLiteralFieldQueryOps}` : '';
|
|
66
|
-
export declare enum BulkOpType {
|
|
67
|
-
InsertOne = 1,
|
|
68
|
-
ReplaceOne = 2,
|
|
69
|
-
UpdateOne = 3,
|
|
70
|
-
UpdateMany = 4,
|
|
71
|
-
DeleteOne = 5,
|
|
72
|
-
DeleteMany = 6
|
|
73
|
-
}
|
|
74
|
-
export type BulkOpItem<T> = {
|
|
75
|
-
type: BulkOpType.InsertOne;
|
|
76
|
-
item: T;
|
|
77
|
-
} | {
|
|
78
|
-
type: BulkOpType.UpdateOne;
|
|
79
|
-
query: DataQuery<T>;
|
|
80
|
-
update: Partial<T>;
|
|
81
|
-
upsert?: boolean;
|
|
82
|
-
} | {
|
|
83
|
-
type: BulkOpType.UpdateMany;
|
|
84
|
-
query: DataQuery<T>;
|
|
85
|
-
update: Partial<T>;
|
|
86
|
-
} | {
|
|
87
|
-
type: BulkOpType.DeleteOne;
|
|
88
|
-
query: DataQuery<T>;
|
|
89
|
-
} | {
|
|
90
|
-
type: BulkOpType.DeleteMany;
|
|
91
|
-
query: DataQuery<T>;
|
|
92
|
-
};
|
|
93
|
-
export interface BaseDataProvider<TData, TQuery extends DataQuery<TData> = DataQuery<TData>> {
|
|
94
|
-
insertItem: (item: TData, otherProps?: DataProviderOpParams) => Promise<TData>;
|
|
95
|
-
insertList: (items: TData[], otherProps?: DataProviderOpParams) => Promise<void>;
|
|
96
|
-
existsByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams) => Promise<boolean>;
|
|
97
|
-
getManyByQuery: (query: TQuery, otherProps?: DataProviderQueryListParams<TData>) => Promise<TData[]>;
|
|
98
|
-
getOneByQuery: (query: TQuery, otherProps?: DataProviderQueryParams<TData>) => Promise<TData | null>;
|
|
99
|
-
assertGetOneByQuery: (query: TQuery, otherProps?: DataProviderQueryParams<TData>) => Promise<TData>;
|
|
100
|
-
assertGetAndUpdateOneByQuery: (query: TQuery, data: Partial<TData>, otherProps?: DataProviderQueryParams<TData>) => Promise<TData>;
|
|
101
|
-
countByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams) => Promise<number>;
|
|
102
|
-
updateManyByQuery: (query: TQuery, data: Partial<TData>, otherProps?: DataProviderOpParams) => Promise<void>;
|
|
103
|
-
updateOneByQuery: (query: TQuery, data: Partial<TData>, otherProps?: DataProviderOpParams) => Promise<void>;
|
|
104
|
-
getAndUpdateOneByQuery: (query: TQuery, data: Partial<TData>, otherProps?: DataProviderQueryParams<TData>) => Promise<TData | null>;
|
|
105
|
-
deleteManyByQuery: <TOpQuery extends TQuery = TQuery>(query: TOpQuery, otherProps?: DataProviderOpParams) => Promise<void>;
|
|
106
|
-
deleteOneByQuery: <ExtendedQueryType extends TQuery = TQuery>(query: ExtendedQueryType, otherProps?: DataProviderOpParams) => Promise<void>;
|
|
107
|
-
bulkWrite(ops: Array<BulkOpItem<TData>>, otherProps?: DataProviderOpParams): Promise<void>;
|
|
108
|
-
}
|
|
109
|
-
export interface DataProviderUtils {
|
|
110
|
-
withTxn<TResult>(fn: AnyFn<[
|
|
111
|
-
txn: unknown
|
|
112
|
-
], Promise<TResult>> /** Whether or not to reuse an existing txn from async local storage. */, reuseAsyncLocalTxn: boolean, existingSession?: unknown): Promise<TResult>;
|
|
113
|
-
}
|
|
114
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BulkOpType = exports.kExcludeFromProjection = exports.kIncludeInProjection = void 0;
|
|
4
|
-
exports.kIncludeInProjection = 1;
|
|
5
|
-
exports.kExcludeFromProjection = 0;
|
|
6
|
-
var BulkOpType;
|
|
7
|
-
(function (BulkOpType) {
|
|
8
|
-
BulkOpType[BulkOpType["InsertOne"] = 1] = "InsertOne";
|
|
9
|
-
BulkOpType[BulkOpType["ReplaceOne"] = 2] = "ReplaceOne";
|
|
10
|
-
BulkOpType[BulkOpType["UpdateOne"] = 3] = "UpdateOne";
|
|
11
|
-
BulkOpType[BulkOpType["UpdateMany"] = 4] = "UpdateMany";
|
|
12
|
-
BulkOpType[BulkOpType["DeleteOne"] = 5] = "DeleteOne";
|
|
13
|
-
BulkOpType[BulkOpType["DeleteMany"] = 6] = "DeleteMany";
|
|
14
|
-
})(BulkOpType || (exports.BulkOpType = BulkOpType = {}));
|
|
15
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/contexts/data/types.ts"],"names":[],"mappings":";;;AA0Ba,QAAA,oBAAoB,GAAG,CAAU,CAAC;AAClC,QAAA,sBAAsB,GAAG,CAAU,CAAC;AAwFjD,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,qDAAa,CAAA;IACb,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,uDAAU,CAAA;AACZ,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPageSize = exports.getPage = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const constants_1 = require("../../endpoints/constants");
|
|
6
|
-
function getPage(inputPage, minPage = constants_1.kEndpointConstants.minPage) {
|
|
7
|
-
return (0, lodash_1.isNumber)(inputPage)
|
|
8
|
-
? Math.max(inputPage, minPage) // return 0 if page is negative
|
|
9
|
-
: undefined;
|
|
10
|
-
}
|
|
11
|
-
exports.getPage = getPage;
|
|
12
|
-
function getPageSize(inputPageSize, inputPage, maxPageSize = constants_1.kEndpointConstants.maxPageSize, minPageSize = constants_1.kEndpointConstants.minPageSize) {
|
|
13
|
-
const pageSize = (0, lodash_1.isNumber)(inputPageSize)
|
|
14
|
-
? Math.max(inputPageSize, minPageSize)
|
|
15
|
-
: (0, lodash_1.isNumber)(inputPage)
|
|
16
|
-
? maxPageSize
|
|
17
|
-
: undefined;
|
|
18
|
-
if (pageSize) {
|
|
19
|
-
return Math.min(pageSize, maxPageSize);
|
|
20
|
-
}
|
|
21
|
-
return pageSize;
|
|
22
|
-
}
|
|
23
|
-
exports.getPageSize = getPageSize;
|
|
24
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/contexts/data/utils.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,yDAA6D;AAE7D,SAAgB,OAAO,CACrB,SAAkB,EAClB,OAAO,GAAG,8BAAkB,CAAC,OAAO;IAEpC,OAAO,IAAA,iBAAQ,EAAC,SAAS,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,+BAA+B;QAC9D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAPD,0BAOC;AAED,SAAgB,WAAW,CACzB,aAAsB,EACtB,SAAkB,EAClB,WAAW,GAAG,8BAAkB,CAAC,WAAW,EAC5C,WAAW,GAAG,8BAAkB,CAAC,WAAW;IAE5C,MAAM,QAAQ,GAAG,IAAA,iBAAQ,EAAC,aAAa,CAAC;QACtC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC;QACtC,CAAC,CAAC,IAAA,iBAAQ,EAAC,SAAS,CAAC;YACrB,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;KACxC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAjBD,kCAiBC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SESv2Client } from '@aws-sdk/client-sesv2';
|
|
2
|
-
import { IEmailProviderContext, SendEmailParams } from './types';
|
|
3
|
-
import { AWSConfig } from '../../utils/aws';
|
|
4
|
-
export declare class SESEmailProviderContext implements IEmailProviderContext {
|
|
5
|
-
protected ses: SESv2Client;
|
|
6
|
-
constructor(params: AWSConfig);
|
|
7
|
-
sendEmail: (params: SendEmailParams) => Promise<void>;
|
|
8
|
-
dispose: () => Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SESEmailProviderContext = void 0;
|
|
4
|
-
const client_sesv2_1 = require("@aws-sdk/client-sesv2");
|
|
5
|
-
const assertion_1 = require("../../utils/assertion");
|
|
6
|
-
const injectables_1 = require("../injection/injectables");
|
|
7
|
-
class SESEmailProviderContext {
|
|
8
|
-
constructor(params) {
|
|
9
|
-
this.sendEmail = async (params) => {
|
|
10
|
-
const suppliedConfig = injectables_1.kUtilsInjectables.suppliedConfig();
|
|
11
|
-
(0, assertion_1.appAssert)(suppliedConfig.awsEmailEncoding);
|
|
12
|
-
const command = new client_sesv2_1.SendEmailCommand({
|
|
13
|
-
Destination: { ToAddresses: params.destination },
|
|
14
|
-
FromEmailAddress: params.source,
|
|
15
|
-
Content: {
|
|
16
|
-
Simple: {
|
|
17
|
-
Subject: {
|
|
18
|
-
Charset: suppliedConfig.awsEmailEncoding,
|
|
19
|
-
Data: params.subject,
|
|
20
|
-
},
|
|
21
|
-
Body: {
|
|
22
|
-
Html: {
|
|
23
|
-
Charset: suppliedConfig.awsEmailEncoding,
|
|
24
|
-
Data: params.body.html,
|
|
25
|
-
},
|
|
26
|
-
Text: {
|
|
27
|
-
Charset: suppliedConfig.awsEmailEncoding,
|
|
28
|
-
Data: params.body.text,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
await this.ses.send(command);
|
|
35
|
-
};
|
|
36
|
-
this.dispose = async () => {
|
|
37
|
-
await this.ses.destroy();
|
|
38
|
-
};
|
|
39
|
-
this.ses = new client_sesv2_1.SESv2Client({
|
|
40
|
-
region: params.region,
|
|
41
|
-
credentials: {
|
|
42
|
-
accessKeyId: params.accessKeyId,
|
|
43
|
-
secretAccessKey: params.secretAccessKey,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.SESEmailProviderContext = SESEmailProviderContext;
|
|
49
|
-
//# sourceMappingURL=SESEmailProviderContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SESEmailProviderContext.js","sourceRoot":"","sources":["../../../../src/contexts/email/SESEmailProviderContext.ts"],"names":[],"mappings":";;;AAAA,wDAAoE;AACpE,qDAAgD;AAChD,0DAA2D;AAI3D,MAAa,uBAAuB;IAGlC,YAAY,MAAiB;QAU7B,cAAS,GAAG,KAAK,EAAE,MAAuB,EAAE,EAAE;YAC5C,MAAM,cAAc,GAAG,+BAAiB,CAAC,cAAc,EAAE,CAAC;YAC1D,IAAA,qBAAS,EAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;YAE3C,MAAM,OAAO,GAAG,IAAI,+BAAgB,CAAC;gBACnC,WAAW,EAAE,EAAC,WAAW,EAAE,MAAM,CAAC,WAAW,EAAC;gBAC9C,gBAAgB,EAAE,MAAM,CAAC,MAAM;gBAC/B,OAAO,EAAE;oBACP,MAAM,EAAE;wBACN,OAAO,EAAE;4BACP,OAAO,EAAE,cAAc,CAAC,gBAAgB;4BACxC,IAAI,EAAE,MAAM,CAAC,OAAO;yBACrB;wBACD,IAAI,EAAE;4BACJ,IAAI,EAAE;gCACJ,OAAO,EAAE,cAAc,CAAC,gBAAgB;gCACxC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;6BACvB;4BACD,IAAI,EAAE;gCACJ,OAAO,EAAE,cAAc,CAAC,gBAAgB;gCACxC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;6BACvB;yBACF;qBACF;iBACF;aACF,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,YAAO,GAAG,KAAK,IAAI,EAAE;YACnB,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC,CAAC;QAzCA,IAAI,CAAC,GAAG,GAAG,IAAI,0BAAW,CAAC;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,WAAW,EAAE;gBACX,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;aACxC;SACF,CAAC,CAAC;IACL,CAAC;CAmCF;AA9CD,0DA8CC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DisposableResource } from 'softkave-js-utils';
|
|
2
|
-
export interface SendEmailParams {
|
|
3
|
-
destination: string[];
|
|
4
|
-
source: string;
|
|
5
|
-
subject: string;
|
|
6
|
-
body: {
|
|
7
|
-
html: string;
|
|
8
|
-
text: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export interface IEmailProviderContext extends DisposableResource {
|
|
12
|
-
sendEmail: (params: SendEmailParams) => Promise<void>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/contexts/email/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
|
|
2
|
-
import { AWSConfig } from '../../utils/aws';
|
|
3
|
-
import { SecretsManagerProvider, SecretsManagerProviderAddSecretParams, SecretsManagerProviderAddSecretResult, SecretsManagerProviderDeleteSecretParams, SecretsManagerProviderGetSecretParams, SecretsManagerProviderGetSecretResult, SecretsManagerProviderUpdateSecretParams } from './types';
|
|
4
|
-
export declare class AWSSecretsManagerProvider implements SecretsManagerProvider {
|
|
5
|
-
protected client: SecretsManagerClient;
|
|
6
|
-
constructor(params: AWSConfig);
|
|
7
|
-
addSecret: (params: SecretsManagerProviderAddSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
8
|
-
updateSecret: (params: SecretsManagerProviderUpdateSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
9
|
-
deleteSecret: (params: SecretsManagerProviderDeleteSecretParams) => Promise<void>;
|
|
10
|
-
getSecret: (params: SecretsManagerProviderGetSecretParams) => Promise<SecretsManagerProviderGetSecretResult>;
|
|
11
|
-
dispose: () => Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AWSSecretsManagerProvider = void 0;
|
|
4
|
-
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
5
|
-
const assertion_1 = require("../../utils/assertion");
|
|
6
|
-
class AWSSecretsManagerProvider {
|
|
7
|
-
constructor(params) {
|
|
8
|
-
this.addSecret = async (params) => {
|
|
9
|
-
const { name, text } = params;
|
|
10
|
-
const command = new client_secrets_manager_1.CreateSecretCommand({ Name: name, SecretString: text });
|
|
11
|
-
const response = await this.client.send(command);
|
|
12
|
-
(0, assertion_1.appAssert)(response.ARN);
|
|
13
|
-
return { secretId: response.ARN };
|
|
14
|
-
};
|
|
15
|
-
this.updateSecret = async (params) => {
|
|
16
|
-
const { text, secretId } = params;
|
|
17
|
-
const command = new client_secrets_manager_1.UpdateSecretCommand({
|
|
18
|
-
SecretString: text,
|
|
19
|
-
SecretId: secretId,
|
|
20
|
-
});
|
|
21
|
-
const response = await this.client.send(command);
|
|
22
|
-
(0, assertion_1.appAssert)(response.ARN);
|
|
23
|
-
return { secretId: response.ARN };
|
|
24
|
-
};
|
|
25
|
-
this.deleteSecret = async (params) => {
|
|
26
|
-
const { secretId } = params;
|
|
27
|
-
const command = new client_secrets_manager_1.DeleteSecretCommand({
|
|
28
|
-
SecretId: secretId,
|
|
29
|
-
});
|
|
30
|
-
await this.client.send(command);
|
|
31
|
-
};
|
|
32
|
-
this.getSecret = async (params) => {
|
|
33
|
-
const { secretId: id } = params;
|
|
34
|
-
const input = { SecretId: id };
|
|
35
|
-
const command = new client_secrets_manager_1.GetSecretValueCommand(input);
|
|
36
|
-
const response = await this.client.send(command);
|
|
37
|
-
(0, assertion_1.appAssert)(response.SecretString);
|
|
38
|
-
return { text: response.SecretString };
|
|
39
|
-
};
|
|
40
|
-
this.dispose = async () => {
|
|
41
|
-
await this.client.destroy();
|
|
42
|
-
};
|
|
43
|
-
const { accessKeyId, secretAccessKey, region } = params;
|
|
44
|
-
this.client = new client_secrets_manager_1.SecretsManagerClient({
|
|
45
|
-
region,
|
|
46
|
-
credentials: { accessKeyId, secretAccessKey },
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.AWSSecretsManagerProvider = AWSSecretsManagerProvider;
|
|
51
|
-
//# sourceMappingURL=AWSSecretsManagerProvider.js.map
|
|
@@ -1 +0,0 @@
|
|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AAQ,EAAE,QAAQ;aACnB,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC;QAEF,cAAS,GAAG,KAAK,EACf,MAA6C,EACG,EAAE;YAClD,MAAM,EAAC,QAAQ,EAAE,EAAE,EAAC,GAAG,MAAM,CAAC;YAC9B,MAAM,KAAK,GAAG,EAAC,QAAQ,EAAE,EAAE,EAAC,CAAC;YAC7B,MAAM,OAAO,GAAG,IAAI,8CAAqB,CAAC,KAAK,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEjD,IAAA,qBAAS,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACjC,OAAO,EAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,EAAC,CAAC;QACvC,CAAC,CAAC;QAEF,YAAO,GAAG,KAAK,IAAI,EAAE;YACnB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC;QAtDA,MAAM,EAAC,WAAW,EAAE,eAAe,EAAE,MAAM,EAAC,GAAG,MAAM,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,IAAI,6CAAoB,CAAC;YACrC,MAAM;YACN,WAAW,EAAE,EAAC,WAAW,EAAE,eAAe,EAAC;SAC5C,CAAC,CAAC;IACL,CAAC;CAkDF;AA3DD,8DA2DC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SecretsManagerProvider, SecretsManagerProviderAddSecretParams, SecretsManagerProviderAddSecretResult, SecretsManagerProviderDeleteSecretParams, SecretsManagerProviderGetSecretParams, SecretsManagerProviderGetSecretResult, SecretsManagerProviderUpdateSecretParams } from './types';
|
|
2
|
-
export declare class MemorySecretsManagerProvider implements SecretsManagerProvider {
|
|
3
|
-
protected secrets: Record<string, {
|
|
4
|
-
name: string;
|
|
5
|
-
secret: string;
|
|
6
|
-
}>;
|
|
7
|
-
addSecret: (params: SecretsManagerProviderAddSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
8
|
-
updateSecret: (params: SecretsManagerProviderUpdateSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
9
|
-
deleteSecret: (params: SecretsManagerProviderDeleteSecretParams) => Promise<void>;
|
|
10
|
-
getSecret: (params: SecretsManagerProviderGetSecretParams) => Promise<SecretsManagerProviderGetSecretResult>;
|
|
11
|
-
dispose: (...args: any[]) => void;
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemorySecretsManagerProvider = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const softkave_js_utils_1 = require("softkave-js-utils");
|
|
6
|
-
const assertion_1 = require("../../utils/assertion");
|
|
7
|
-
class MemorySecretsManagerProvider {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.secrets = {};
|
|
10
|
-
this.addSecret = async (params) => {
|
|
11
|
-
const { name, text } = params;
|
|
12
|
-
const id = (0, softkave_js_utils_1.getNewId)();
|
|
13
|
-
this.secrets[id] = { name, secret: text };
|
|
14
|
-
return { secretId: id };
|
|
15
|
-
};
|
|
16
|
-
this.updateSecret = async (params) => {
|
|
17
|
-
const { name, text, secretId } = params;
|
|
18
|
-
this.secrets[secretId] = { name, secret: text };
|
|
19
|
-
return { secretId };
|
|
20
|
-
};
|
|
21
|
-
this.deleteSecret = async (params) => {
|
|
22
|
-
const { secretId } = params;
|
|
23
|
-
delete this.secrets[secretId];
|
|
24
|
-
};
|
|
25
|
-
this.getSecret = async (params) => {
|
|
26
|
-
const { secretId: id } = params;
|
|
27
|
-
const secret = this.secrets[id];
|
|
28
|
-
(0, assertion_1.appAssert)(secret, new Error('Secret not found'));
|
|
29
|
-
return { text: secret.secret };
|
|
30
|
-
};
|
|
31
|
-
this.dispose = lodash_1.noop;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.MemorySecretsManagerProvider = MemorySecretsManagerProvider;
|
|
35
|
-
//# sourceMappingURL=MemorySecretsManagerProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySecretsManagerProvider.js","sourceRoot":"","sources":["../../../../src/contexts/encryption/MemorySecretsManagerProvider.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAU5B,yDAA2C;AAC3C,qDAAgD;AAEhD,MAAa,4BAA4B;IAAzC;QACY,YAAO,GAAmD,EAAE,CAAC;QAEvE,cAAS,GAAG,KAAK,EACf,MAA6C,EACG,EAAE;YAClD,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,GAAG,MAAM,CAAC;YAC5B,MAAM,EAAE,GAAG,IAAA,4BAAQ,GAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;YAExC,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,CAAC;QACxB,CAAC,CAAC;QAEF,iBAAY,GAAG,KAAK,EAClB,MAAgD,EACA,EAAE;YAClD,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAC,GAAG,MAAM,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;YAE9C,OAAO,EAAC,QAAQ,EAAC,CAAC;QACpB,CAAC,CAAC;QAEF,iBAAY,GAAG,KAAK,EAAE,MAAgD,EAAE,EAAE;YACxE,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,CAAC;YAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC,CAAC;QAEF,cAAS,GAAG,KAAK,EACf,MAA6C,EACG,EAAE;YAClD,MAAM,EAAC,QAAQ,EAAE,EAAE,EAAC,GAAG,MAAM,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAEhC,IAAA,qBAAS,EAAC,MAAM,EAAE,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;YACjD,OAAO,EAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,YAAO,GAAG,aAAI,CAAC;IACjB,CAAC;CAAA;AAtCD,oEAsCC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DisposableResource } from 'softkave-js-utils';
|
|
2
|
-
export interface SecretsManagerProviderAddSecretParams {
|
|
3
|
-
text: string;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export interface SecretsManagerProviderUpdateSecretParams {
|
|
7
|
-
secretId: string;
|
|
8
|
-
text: string;
|
|
9
|
-
name: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SecretsManagerProviderDeleteSecretParams {
|
|
12
|
-
secretId: string;
|
|
13
|
-
}
|
|
14
|
-
export interface SecretsManagerProviderAddSecretResult {
|
|
15
|
-
secretId: string;
|
|
16
|
-
}
|
|
17
|
-
export interface SecretsManagerProviderGetSecretParams {
|
|
18
|
-
secretId: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SecretsManagerProviderGetSecretResult {
|
|
21
|
-
text: string;
|
|
22
|
-
}
|
|
23
|
-
export interface SecretsManagerProvider extends DisposableResource {
|
|
24
|
-
addSecret: (params: SecretsManagerProviderAddSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
25
|
-
updateSecret: (params: SecretsManagerProviderUpdateSecretParams) => Promise<SecretsManagerProviderAddSecretResult>;
|
|
26
|
-
deleteSecret: (params: SecretsManagerProviderDeleteSecretParams) => Promise<void>;
|
|
27
|
-
/** throws if secret is not found */
|
|
28
|
-
getSecret: (params: SecretsManagerProviderGetSecretParams) => Promise<SecretsManagerProviderGetSecretResult>;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/contexts/encryption/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.globalSetup = exports.globalDispose = void 0;
|
|
4
|
-
const injectables_1 = require("./injection/injectables");
|
|
5
|
-
const register_1 = require("./injection/register");
|
|
6
|
-
async function globalDispose() {
|
|
7
|
-
injectables_1.kUtilsInjectables.disposables().disposeAll();
|
|
8
|
-
await Promise.all([injectables_1.kUtilsInjectables.dbConnection().close()]);
|
|
9
|
-
await injectables_1.kUtilsInjectables.promises().close().flush();
|
|
10
|
-
}
|
|
11
|
-
exports.globalDispose = globalDispose;
|
|
12
|
-
async function globalSetup() {
|
|
13
|
-
(0, register_1.registerInjectables)();
|
|
14
|
-
await injectables_1.kUtilsInjectables.dbConnection().wait();
|
|
15
|
-
}
|
|
16
|
-
exports.globalSetup = globalSetup;
|
|
17
|
-
//# sourceMappingURL=globalUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalUtils.js","sourceRoot":"","sources":["../../../src/contexts/globalUtils.ts"],"names":[],"mappings":";;;AAAA,yDAA0D;AAC1D,mDAAyD;AAElD,KAAK,UAAU,aAAa;IACjC,+BAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC;IAC7C,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,+BAAiB,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC9D,MAAM,+BAAiB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;AACrD,CAAC;AAJD,sCAIC;AAEM,KAAK,UAAU,WAAW;IAC/B,IAAA,8BAAmB,GAAE,CAAC;IACtB,MAAM,+BAAiB,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC;AAChD,CAAC;AAHD,kCAGC"}
|