quidproquo-actionprocessor-awslambda 0.0.120 → 0.0.121
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.
|
@@ -15,9 +15,11 @@ const quidproquo_core_2 = require("quidproquo-core");
|
|
|
15
15
|
const dynamo_1 = require("../../../logic/dynamo");
|
|
16
16
|
const getProcessKeyValueStoreDelete = (qpqConfig) => {
|
|
17
17
|
return ({ keyValueStoreName, key, sortKey }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
var _a;
|
|
18
19
|
const dynamoTableName = (0, awsNamingUtils_1.getKvsDynamoTableNameFromConfig)(keyValueStoreName, qpqConfig, 'kvs');
|
|
19
20
|
const region = quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
20
|
-
|
|
21
|
+
const storeConfig = quidproquo_core_1.qpqCoreUtils.getKeyValueStoreByName(qpqConfig, keyValueStoreName);
|
|
22
|
+
yield (0, dynamo_1.deleteItem)(dynamoTableName, region, key, storeConfig.partitionKey.key, sortKey, (_a = storeConfig.sortKeys[0]) === null || _a === void 0 ? void 0 : _a.key);
|
|
21
23
|
return (0, quidproquo_core_2.actionResult)(void 0);
|
|
22
24
|
});
|
|
23
25
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { KvsCoreDataType } from 'quidproquo-core';
|
|
2
|
-
export declare function deleteItem(tableName: string, region: string, key: KvsCoreDataType, sortKey?: KvsCoreDataType): Promise<void>;
|
|
2
|
+
export declare function deleteItem(tableName: string, region: string, key: KvsCoreDataType, keyName: string, sortKey?: KvsCoreDataType, sortKeyName?: string): Promise<void>;
|
|
@@ -12,17 +12,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.deleteItem = void 0;
|
|
13
13
|
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
14
14
|
const qpqDynamoOrm_1 = require("./qpqDynamoOrm");
|
|
15
|
-
function deleteItem(tableName, region, key, sortKey) {
|
|
15
|
+
function deleteItem(tableName, region, key, keyName, sortKey, sortKeyName) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const dynamoClient = new client_dynamodb_1.DynamoDBClient({ region });
|
|
18
18
|
const deleteItemParams = {
|
|
19
19
|
TableName: tableName,
|
|
20
20
|
Key: {
|
|
21
|
-
|
|
21
|
+
[keyName]: (0, qpqDynamoOrm_1.buildAttributeValue)(key),
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
|
-
if (sortKey
|
|
25
|
-
deleteItemParams.Key
|
|
24
|
+
if (sortKey && sortKeyName) {
|
|
25
|
+
deleteItemParams.Key[sortKeyName] = (0, qpqDynamoOrm_1.buildAttributeValue)(sortKey);
|
|
26
26
|
}
|
|
27
27
|
yield dynamoClient.send(new client_dynamodb_1.DeleteItemCommand(deleteItemParams));
|
|
28
28
|
});
|