quidproquo-actionprocessor-awslambda 0.0.214 → 0.0.215
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/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
13
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
14
14
|
const dynamo_1 = require("../../../logic/dynamo");
|
|
15
|
+
const src_1 = require("quidproquo-core/src");
|
|
15
16
|
const getProcessKeyValueStoreUpsert = (qpqConfig) => {
|
|
16
17
|
return ({ keyValueStoreName, item, options }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
18
|
const dynamoTableName = (0, awsNamingUtils_1.getKvsDynamoTableNameFromConfig)(keyValueStoreName, qpqConfig, 'kvs');
|
|
@@ -26,10 +27,17 @@ const getProcessKeyValueStoreUpsert = (qpqConfig) => {
|
|
|
26
27
|
...storeConfig.indexes.map((i) => i.partitionKey),
|
|
27
28
|
...storeConfig.indexes.filter((i) => !!i.sortKey).map((i) => i.sortKey),
|
|
28
29
|
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
try {
|
|
31
|
+
yield (0, dynamo_1.putItem)(dynamoTableName, item, keys, {
|
|
32
|
+
expires: options === null || options === void 0 ? void 0 : options.ttlInSeconds,
|
|
33
|
+
}, region);
|
|
34
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
38
|
+
InternalServerError: () => (0, quidproquo_core_1.actionResultError)(src_1.KeyValueStoreUpsertErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
33
41
|
});
|
|
34
42
|
};
|
|
35
43
|
exports.default = (qpqConfig) => ({
|
package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { qpqCoreUtils, actionResult, KeyValueStoreActionType, ErrorTypeEnum, actionResultError, } from 'quidproquo-core';
|
|
1
|
+
import { qpqCoreUtils, actionResult, KeyValueStoreActionType, ErrorTypeEnum, actionResultError, actionResultErrorFromCaughtError, } from 'quidproquo-core';
|
|
2
2
|
import { getKvsDynamoTableNameFromConfig } from '../../../awsNamingUtils';
|
|
3
3
|
import { putItem } from '../../../logic/dynamo';
|
|
4
|
+
import { KeyValueStoreUpsertErrorTypeEnum } from 'quidproquo-core/src';
|
|
4
5
|
const getProcessKeyValueStoreUpsert = (qpqConfig) => {
|
|
5
6
|
return async ({ keyValueStoreName, item, options }) => {
|
|
6
7
|
const dynamoTableName = getKvsDynamoTableNameFromConfig(keyValueStoreName, qpqConfig, 'kvs');
|
|
@@ -15,10 +16,17 @@ const getProcessKeyValueStoreUpsert = (qpqConfig) => {
|
|
|
15
16
|
...storeConfig.indexes.map((i) => i.partitionKey),
|
|
16
17
|
...storeConfig.indexes.filter((i) => !!i.sortKey).map((i) => i.sortKey),
|
|
17
18
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
try {
|
|
20
|
+
await putItem(dynamoTableName, item, keys, {
|
|
21
|
+
expires: options?.ttlInSeconds,
|
|
22
|
+
}, region);
|
|
23
|
+
return actionResult(void 0);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return actionResultErrorFromCaughtError(error, {
|
|
27
|
+
InternalServerError: () => actionResultError(KeyValueStoreUpsertErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
22
30
|
};
|
|
23
31
|
};
|
|
24
32
|
export default (qpqConfig) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-awslambda",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.215",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"node-cache": "^5.1.2",
|
|
53
53
|
"node-match-path": "^0.6.3",
|
|
54
|
-
"quidproquo-config-aws": "0.0.
|
|
55
|
-
"quidproquo-core": "0.0.
|
|
56
|
-
"quidproquo-webserver": "0.0.
|
|
54
|
+
"quidproquo-config-aws": "0.0.215",
|
|
55
|
+
"quidproquo-core": "0.0.215",
|
|
56
|
+
"quidproquo-webserver": "0.0.215"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/aws-lambda": "^8.10.109",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/jsonwebtoken": "^9.0.2",
|
|
62
62
|
"@types/lodash": "^4.14.194",
|
|
63
63
|
"@types/node": "^18.11.9",
|
|
64
|
-
"quidproquo-tsconfig": "0.0.
|
|
64
|
+
"quidproquo-tsconfig": "0.0.215",
|
|
65
65
|
"typescript": "^4.9.3"
|
|
66
66
|
}
|
|
67
67
|
}
|