quidproquo-actionprocessor-awslambda 0.1.12 → 0.1.14
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/event/dynamo/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/index.js +18 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/index.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.js +25 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.js +88 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.js +27 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.js +30 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.js +34 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/index.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/index.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/index.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/types.d.ts +11 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/types.js +14 -0
- package/lib/commonjs/getActionProcessor/core/event/dynamo/streamEvent/types.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/event/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/index.js +1 -0
- package/lib/commonjs/getActionProcessor/core/event/index.js.map +1 -1
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js +1 -1
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js.map +1 -1
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.js +58 -0
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.js.map +1 -0
- package/lib/commonjs/getActionProcessor/core/keyValueStore/index.js +2 -1
- package/lib/commonjs/getActionProcessor/core/keyValueStore/index.js.map +1 -1
- package/lib/commonjs/getLambdaEntries.js +1 -0
- package/lib/commonjs/getLambdaEntries.js.map +1 -1
- package/lib/commonjs/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.d.ts +3 -0
- package/lib/commonjs/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.js +10 -0
- package/lib/commonjs/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.js.map +1 -0
- package/lib/commonjs/lambdaHandlers/index.d.ts +1 -0
- package/lib/commonjs/lambdaHandlers/index.js +1 -0
- package/lib/commonjs/lambdaHandlers/index.js.map +1 -1
- package/lib/commonjs/lambdas/dynamoStreamEvent_kvsStreamEvent.d.ts +1 -0
- package/lib/commonjs/lambdas/dynamoStreamEvent_kvsStreamEvent.js +8 -0
- package/lib/commonjs/lambdas/dynamoStreamEvent_kvsStreamEvent.js.map +1 -0
- package/lib/commonjs/lambdas/index.d.ts +1 -0
- package/lib/commonjs/lambdas/index.js +16 -0
- package/lib/commonjs/lambdas/index.js.map +1 -1
- package/lib/commonjs/logic/dynamo/query.d.ts +1 -1
- package/lib/commonjs/logic/dynamo/query.js +5 -1
- package/lib/commonjs/logic/dynamo/query.js.map +1 -1
- package/lib/esm/getActionProcessor/core/event/dynamo/index.d.ts +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/index.js +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/index.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.js +10 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.js +71 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.js +12 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.js +15 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.js +19 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/index.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/index.js +13 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/index.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/types.d.ts +11 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/types.js +11 -0
- package/lib/esm/getActionProcessor/core/event/dynamo/streamEvent/types.js.map +1 -0
- package/lib/esm/getActionProcessor/core/event/index.d.ts +1 -0
- package/lib/esm/getActionProcessor/core/event/index.js +1 -0
- package/lib/esm/getActionProcessor/core/event/index.js.map +1 -1
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js +1 -1
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js.map +1 -1
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.js +42 -0
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.js.map +1 -0
- package/lib/esm/getActionProcessor/core/keyValueStore/index.js +2 -0
- package/lib/esm/getActionProcessor/core/keyValueStore/index.js.map +1 -1
- package/lib/esm/getLambdaEntries.js +1 -0
- package/lib/esm/getLambdaEntries.js.map +1 -1
- package/lib/esm/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.d.ts +3 -0
- package/lib/esm/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.js +6 -0
- package/lib/esm/lambdaHandlers/getDynamoStreamEvent_kvsStreamEvent.js.map +1 -0
- package/lib/esm/lambdaHandlers/index.d.ts +1 -0
- package/lib/esm/lambdaHandlers/index.js +1 -0
- package/lib/esm/lambdaHandlers/index.js.map +1 -1
- package/lib/esm/lambdas/dynamoStreamEvent_kvsStreamEvent.d.ts +1 -0
- package/lib/esm/lambdas/dynamoStreamEvent_kvsStreamEvent.js +5 -0
- package/lib/esm/lambdas/dynamoStreamEvent_kvsStreamEvent.js.map +1 -0
- package/lib/esm/lambdas/index.d.ts +1 -0
- package/lib/esm/lambdas/index.js +1 -1
- package/lib/esm/lambdas/index.js.map +1 -1
- package/lib/esm/logic/dynamo/query.d.ts +1 -1
- package/lib/esm/logic/dynamo/query.js +5 -1
- package/lib/esm/logic/dynamo/query.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './streamEvent';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./streamEvent"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/getActionProcessor/core/event/dynamo/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from './streamEvent';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getEventAutoRespondActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
const getProcessAutoRespond = (qpqConfig) => {
|
|
15
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ qpqEventRecord, matchResult }) {
|
|
16
|
+
return (0, quidproquo_core_1.actionResult)(null);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const getEventAutoRespondActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
return ({
|
|
21
|
+
[quidproquo_core_1.EventActionType.AutoRespond]: getProcessAutoRespond(qpqConfig),
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
exports.getEventAutoRespondActionProcessor = getEventAutoRespondActionProcessor;
|
|
25
|
+
//# sourceMappingURL=getEventAutoRespondActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEventAutoRespondActionProcessor.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/getEventAutoRespondActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAOyB;AAIzB,MAAM,qBAAqB,GAAG,CAAC,SAAoB,EAA0F,EAAE;IAC7I,OAAO,KAAwC,EAAE,4CAAnC,EAAE,cAAc,EAAE,WAAW,EAAE;QAC3C,OAAO,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,kCAAkC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC5I,CAAC,iCAAe,CAAC,WAAW,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC;KAChE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,kCAAkC,sCAE5C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n EventActionType,\n EventAutoRespondActionProcessor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { InternalEventOutput, InternalEventRecord, MatchResult } from './types';\n\nconst getProcessAutoRespond = (qpqConfig: QPQConfig): EventAutoRespondActionProcessor<InternalEventRecord, MatchResult, InternalEventOutput> => {\n return async ({ qpqEventRecord, matchResult }) => {\n return actionResult(null);\n };\n};\n\nexport const getEventAutoRespondActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [EventActionType.AutoRespond]: getProcessAutoRespond(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getEventGetRecordsActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
const convertDynamoMapToObject_1 = require("../../../../../logic/dynamo/convertDynamoMapToObject");
|
|
15
|
+
const types_1 = require("./types");
|
|
16
|
+
// aws-lambda types the stream images with its own AttributeValue shape; the marshaller is
|
|
17
|
+
// the SDK's. Structurally identical, so this is a lens rather than a conversion.
|
|
18
|
+
const toObject = (image) => image ? (0, convertDynamoMapToObject_1.convertDynamoMapToObject)(image) : undefined;
|
|
19
|
+
// Switch on the closed union aws-lambda declares, not on `string`. Exhausting it means a
|
|
20
|
+
// stream event type we do not handle is a COMPILE error here, rather than a `default` branch
|
|
21
|
+
// quietly folding it into Modify — which for a REMOVE would report a delete as an edit.
|
|
22
|
+
const toEventType = (eventName) => {
|
|
23
|
+
switch (eventName) {
|
|
24
|
+
case 'INSERT':
|
|
25
|
+
return quidproquo_core_1.KvsStreamEventType.Insert;
|
|
26
|
+
case 'MODIFY':
|
|
27
|
+
return quidproquo_core_1.KvsStreamEventType.Modify;
|
|
28
|
+
case 'REMOVE':
|
|
29
|
+
return quidproquo_core_1.KvsStreamEventType.Remove;
|
|
30
|
+
case undefined:
|
|
31
|
+
// DynamoDB always sets this; its absence means a malformed record. Failing is right:
|
|
32
|
+
// the alternative is guessing, and every guess here misreports what happened to the item.
|
|
33
|
+
throw new Error('DynamoDB stream record has no eventName');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
// Put the raw partition key back on an image, so nothing downstream ever sees the composed
|
|
37
|
+
// form. Mirrors what the scoped translator's `strip` does for an ordinary read.
|
|
38
|
+
const stripScope = (image, rawPartitionKey) => image && types_1.GLOBAL_KVS_STREAM_PARTITION_KEY ? Object.assign(Object.assign({}, image), { [types_1.GLOBAL_KVS_STREAM_PARTITION_KEY]: rawPartitionKey }) : image;
|
|
39
|
+
const toInternalRecord = (record) => {
|
|
40
|
+
var _a, _b, _c, _d, _e;
|
|
41
|
+
const keys = (_b = toObject((_a = record.dynamodb) === null || _a === void 0 ? void 0 : _a.Keys)) !== null && _b !== void 0 ? _b : {};
|
|
42
|
+
// The stored partition key carries the scope; split it once here so every consumer gets a
|
|
43
|
+
// raw key plus an explicit scope, and none of them has to know the composition format.
|
|
44
|
+
const composedPartitionKey = types_1.GLOBAL_KVS_STREAM_PARTITION_KEY ? String((_c = keys[types_1.GLOBAL_KVS_STREAM_PARTITION_KEY]) !== null && _c !== void 0 ? _c : '') : '';
|
|
45
|
+
const { scope, rawValue } = (0, quidproquo_core_1.decomposeScopedKvsValue)(composedPartitionKey);
|
|
46
|
+
return {
|
|
47
|
+
keyValueStoreName: types_1.GLOBAL_KVS_STREAM_STORE_NAME,
|
|
48
|
+
eventType: toEventType(record.eventName),
|
|
49
|
+
scope,
|
|
50
|
+
keys: types_1.GLOBAL_KVS_STREAM_PARTITION_KEY ? Object.assign(Object.assign({}, keys), { [types_1.GLOBAL_KVS_STREAM_PARTITION_KEY]: rawValue }) : keys,
|
|
51
|
+
newImage: stripScope(toObject((_d = record.dynamodb) === null || _d === void 0 ? void 0 : _d.NewImage), rawValue),
|
|
52
|
+
oldImage: stripScope(toObject((_e = record.dynamodb) === null || _e === void 0 ? void 0 : _e.OldImage), rawValue),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
// Keep the LAST record for each partition key, preserving the batch's order of first
|
|
56
|
+
// appearance. Last rather than first because a projection wants the newest state, and a
|
|
57
|
+
// handler that re-derives from source only needs to be told the key changed once.
|
|
58
|
+
//
|
|
59
|
+
// The stream guarantees ordering within a partition key, so "last in the batch" is genuinely
|
|
60
|
+
// the most recent change, not an arbitrary pick.
|
|
61
|
+
//
|
|
62
|
+
// Grouped by SCOPE AND key, not key alone: keys are raw by this point, so two tenants can
|
|
63
|
+
// legitimately hold the same id, and collapsing on the raw key would drop one tenant's change
|
|
64
|
+
// on the floor because another tenant touched the same id in the same batch.
|
|
65
|
+
const coalesceByPartitionKey = (records) => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (!types_1.GLOBAL_KVS_STREAM_PARTITION_KEY) {
|
|
68
|
+
return records;
|
|
69
|
+
}
|
|
70
|
+
const latest = new Map();
|
|
71
|
+
for (const record of records) {
|
|
72
|
+
latest.set(`${(_a = record.scope) !== null && _a !== void 0 ? _a : ''}\u0000${String(record.keys[types_1.GLOBAL_KVS_STREAM_PARTITION_KEY])}`, record);
|
|
73
|
+
}
|
|
74
|
+
return [...latest.values()];
|
|
75
|
+
};
|
|
76
|
+
const getProcessGetRecords = (qpqConfig) => {
|
|
77
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ eventParams: [streamEvent] }) {
|
|
78
|
+
const records = streamEvent.Records.map(toInternalRecord);
|
|
79
|
+
return (0, quidproquo_core_1.actionResult)(types_1.GLOBAL_KVS_STREAM_COALESCE ? coalesceByPartitionKey(records) : records);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const getEventGetRecordsActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
return ({
|
|
84
|
+
[quidproquo_core_1.EventActionType.GetRecords]: getProcessGetRecords(qpqConfig),
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
exports.getEventGetRecordsActionProcessor = getEventGetRecordsActionProcessor;
|
|
88
|
+
//# sourceMappingURL=getEventGetRecordsActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEventGetRecordsActionProcessor.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/getEventGetRecordsActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAKzB,mGAAgG;AAChG,mCAAqJ;AAErJ,0FAA0F;AAC1F,iFAAiF;AACjF,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAE,EAAE,CACnD,KAAK,CAAC,CAAC,CAAE,IAAA,mDAAwB,EAAC,KAAuC,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;AAErH,yFAAyF;AACzF,6FAA6F;AAC7F,wFAAwF;AACxF,MAAM,WAAW,GAAG,CAAC,SAAsC,EAAsB,EAAE;IACjF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO,oCAAkB,CAAC,MAAM,CAAC;QACnC,KAAK,QAAQ;YACX,OAAO,oCAAkB,CAAC,MAAM,CAAC;QACnC,KAAK,QAAQ;YACX,OAAO,oCAAkB,CAAC,MAAM,CAAC;QACnC,KAAK,SAAS;YACZ,qFAAqF;YACrF,0FAA0F;YAC1F,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AAEF,2FAA2F;AAC3F,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,KAA0C,EAAE,eAAuB,EAAuC,EAAE,CAC9H,KAAK,IAAI,uCAA+B,CAAC,CAAC,iCAAM,KAAK,KAAE,CAAC,uCAA+B,CAAC,EAAE,eAAe,IAAG,CAAC,CAAC,KAAK,CAAC;AAEtH,MAAM,gBAAgB,GAAG,CAAC,MAAsB,EAAuB,EAAE;;IACvE,MAAM,IAAI,GAAG,MAAA,QAAQ,CAAC,MAAA,MAAM,CAAC,QAAQ,0CAAE,IAAI,CAAC,mCAAI,EAAE,CAAC;IAEnD,0FAA0F;IAC1F,uFAAuF;IACvF,MAAM,oBAAoB,GAAG,uCAA+B,CAAC,CAAC,CAAC,MAAM,CAAC,MAAA,IAAI,CAAC,uCAA+B,CAAC,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAA,yCAAuB,EAAC,oBAAoB,CAAC,CAAC;IAE1E,OAAO;QACL,iBAAiB,EAAE,oCAA4B;QAC/C,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC;QACxC,KAAK;QACL,IAAI,EAAE,uCAA+B,CAAC,CAAC,iCAAM,IAAI,KAAE,CAAC,uCAA+B,CAAC,EAAE,QAAQ,IAAG,CAAC,CAAC,IAAI;QACvG,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAA,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACnE,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAA,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACpE,CAAC;AACJ,CAAC,CAAC;AAEF,qFAAqF;AACrF,wFAAwF;AACxF,kFAAkF;AAClF,EAAE;AACF,6FAA6F;AAC7F,iDAAiD;AACjD,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,6EAA6E;AAC7E,MAAM,sBAAsB,GAAG,CAAC,OAA8B,EAAyB,EAAE;;IACvF,IAAI,CAAC,uCAA+B,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEtD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,SAAS,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,uCAA+B,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3G,CAAC;IAED,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAmE,EAAE;IACrH,OAAO,KAAuC,EAAE,4CAAlC,EAAE,WAAW,EAAE,CAAC,WAAW,CAAC,EAAE;QAC1C,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAE1D,OAAO,IAAA,8BAAY,EAAC,kCAA0B,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9F,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,iCAAiC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC3I,CAAC,iCAAe,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC;KAC9D,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,iCAAiC,qCAE3C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n decomposeScopedKvsValue,\n EventActionType,\n EventGetRecordsActionProcessor,\n KvsStreamEventType,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { DynamoDBRecord } from 'aws-lambda';\nimport { AttributeValue } from '@aws-sdk/client-dynamodb';\n\nimport { convertDynamoMapToObject } from '../../../../../logic/dynamo/convertDynamoMapToObject';\nimport { EventInput, GLOBAL_KVS_STREAM_COALESCE, GLOBAL_KVS_STREAM_PARTITION_KEY, GLOBAL_KVS_STREAM_STORE_NAME, InternalEventRecord } from './types';\n\n// aws-lambda types the stream images with its own AttributeValue shape; the marshaller is\n// the SDK's. Structurally identical, so this is a lens rather than a conversion.\nconst toObject = (image?: Record<string, unknown>) =>\n image ? (convertDynamoMapToObject(image as Record<string, AttributeValue>) as Record<string, unknown>) : undefined;\n\n// Switch on the closed union aws-lambda declares, not on `string`. Exhausting it means a\n// stream event type we do not handle is a COMPILE error here, rather than a `default` branch\n// quietly folding it into Modify — which for a REMOVE would report a delete as an edit.\nconst toEventType = (eventName: DynamoDBRecord['eventName']): KvsStreamEventType => {\n switch (eventName) {\n case 'INSERT':\n return KvsStreamEventType.Insert;\n case 'MODIFY':\n return KvsStreamEventType.Modify;\n case 'REMOVE':\n return KvsStreamEventType.Remove;\n case undefined:\n // DynamoDB always sets this; its absence means a malformed record. Failing is right:\n // the alternative is guessing, and every guess here misreports what happened to the item.\n throw new Error('DynamoDB stream record has no eventName');\n }\n};\n\n// Put the raw partition key back on an image, so nothing downstream ever sees the composed\n// form. Mirrors what the scoped translator's `strip` does for an ordinary read.\nconst stripScope = (image: Record<string, unknown> | undefined, rawPartitionKey: string): Record<string, unknown> | undefined =>\n image && GLOBAL_KVS_STREAM_PARTITION_KEY ? { ...image, [GLOBAL_KVS_STREAM_PARTITION_KEY]: rawPartitionKey } : image;\n\nconst toInternalRecord = (record: DynamoDBRecord): InternalEventRecord => {\n const keys = toObject(record.dynamodb?.Keys) ?? {};\n\n // The stored partition key carries the scope; split it once here so every consumer gets a\n // raw key plus an explicit scope, and none of them has to know the composition format.\n const composedPartitionKey = GLOBAL_KVS_STREAM_PARTITION_KEY ? String(keys[GLOBAL_KVS_STREAM_PARTITION_KEY] ?? '') : '';\n const { scope, rawValue } = decomposeScopedKvsValue(composedPartitionKey);\n\n return {\n keyValueStoreName: GLOBAL_KVS_STREAM_STORE_NAME,\n eventType: toEventType(record.eventName),\n scope,\n keys: GLOBAL_KVS_STREAM_PARTITION_KEY ? { ...keys, [GLOBAL_KVS_STREAM_PARTITION_KEY]: rawValue } : keys,\n newImage: stripScope(toObject(record.dynamodb?.NewImage), rawValue),\n oldImage: stripScope(toObject(record.dynamodb?.OldImage), rawValue),\n };\n};\n\n// Keep the LAST record for each partition key, preserving the batch's order of first\n// appearance. Last rather than first because a projection wants the newest state, and a\n// handler that re-derives from source only needs to be told the key changed once.\n//\n// The stream guarantees ordering within a partition key, so \"last in the batch\" is genuinely\n// the most recent change, not an arbitrary pick.\n//\n// Grouped by SCOPE AND key, not key alone: keys are raw by this point, so two tenants can\n// legitimately hold the same id, and collapsing on the raw key would drop one tenant's change\n// on the floor because another tenant touched the same id in the same batch.\nconst coalesceByPartitionKey = (records: InternalEventRecord[]): InternalEventRecord[] => {\n if (!GLOBAL_KVS_STREAM_PARTITION_KEY) {\n return records;\n }\n\n const latest = new Map<string, InternalEventRecord>();\n\n for (const record of records) {\n latest.set(`${record.scope ?? ''}\\u0000${String(record.keys[GLOBAL_KVS_STREAM_PARTITION_KEY])}`, record);\n }\n\n return [...latest.values()];\n};\n\nconst getProcessGetRecords = (qpqConfig: QPQConfig): EventGetRecordsActionProcessor<EventInput, InternalEventRecord> => {\n return async ({ eventParams: [streamEvent] }) => {\n const records = streamEvent.Records.map(toInternalRecord);\n\n return actionResult(GLOBAL_KVS_STREAM_COALESCE ? coalesceByPartitionKey(records) : records);\n };\n};\n\nexport const getEventGetRecordsActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [EventActionType.GetRecords]: getProcessGetRecords(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getEventGetStorySessionActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
// A stream record carries no caller identity — the change already happened, under whatever
|
|
15
|
+
// authority wrote it. The handler runs with a blank session, like the storage drive event.
|
|
16
|
+
const getProcessGetStorySession = (qpqConfig) => {
|
|
17
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ qpqEventRecord, eventParams }) {
|
|
18
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const getEventGetStorySessionActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
return ({
|
|
23
|
+
[quidproquo_core_1.EventActionType.GetStorySession]: getProcessGetStorySession(qpqConfig),
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
exports.getEventGetStorySessionActionProcessor = getEventGetStorySessionActionProcessor;
|
|
27
|
+
//# sourceMappingURL=getEventGetStorySessionActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEventGetStorySessionActionProcessor.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/getEventGetStorySessionActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAOyB;AAIzB,2FAA2F;AAC3F,2FAA2F;AAC3F,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAqF,EAAE;IAC5I,OAAO,KAAwC,EAAE,4CAAnC,EAAE,cAAc,EAAE,WAAW,EAAE;QAC3C,OAAO,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,sCAAsC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAChJ,CAAC,iCAAe,CAAC,eAAe,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC;KACxE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,sCAAsC,0CAEhD","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n EventActionType,\n EventGetStorySessionActionProcessor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { EventInput, InternalEventRecord, MatchResult } from './types';\n\n// A stream record carries no caller identity — the change already happened, under whatever\n// authority wrote it. The handler runs with a blank session, like the storage drive event.\nconst getProcessGetStorySession = (qpqConfig: QPQConfig): EventGetStorySessionActionProcessor<EventInput, InternalEventRecord, MatchResult> => {\n return async ({ qpqEventRecord, eventParams }) => {\n return actionResult(void 0);\n };\n};\n\nexport const getEventGetStorySessionActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [EventActionType.GetStorySession]: getProcessGetStorySession(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getEventMatchStoryActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
// One store, one handler — the runtime is stamped on the lambda by the CDK, so there is
|
|
16
|
+
// nothing to route on.
|
|
17
|
+
const getProcessMatchStory = (qpqConfig) => {
|
|
18
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ qpqEventRecord }) {
|
|
19
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
20
|
+
runtime: types_1.GLOBAL_KVS_STREAM_RUNTIME,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const getEventMatchStoryActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
return ({
|
|
26
|
+
[quidproquo_core_1.EventActionType.MatchStory]: getProcessMatchStory(qpqConfig),
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
exports.getEventMatchStoryActionProcessor = getEventMatchStoryActionProcessor;
|
|
30
|
+
//# sourceMappingURL=getEventMatchStoryActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEventMatchStoryActionProcessor.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/getEventMatchStoryActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAOyB;AAEzB,mCAAkG;AAElG,wFAAwF;AACxF,uBAAuB;AACvB,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAgF,EAAE;IAClI,OAAO,KAA2B,EAAE,4CAAtB,EAAE,cAAc,EAAE;QAC9B,OAAO,IAAA,8BAAY,EAAc;YAC/B,OAAO,EAAE,iCAAyB;SACnC,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,iCAAiC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC3I,CAAC,iCAAe,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC;KAC9D,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,iCAAiC,qCAE3C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n EventActionType,\n EventMatchStoryActionProcessor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { EventInput, GLOBAL_KVS_STREAM_RUNTIME, InternalEventRecord, MatchResult } from './types';\n\n// One store, one handler — the runtime is stamped on the lambda by the CDK, so there is\n// nothing to route on.\nconst getProcessMatchStory = (qpqConfig: QPQConfig): EventMatchStoryActionProcessor<InternalEventRecord, MatchResult, EventInput> => {\n return async ({ qpqEventRecord }) => {\n return actionResult<MatchResult>({\n runtime: GLOBAL_KVS_STREAM_RUNTIME,\n });\n };\n};\n\nexport const getEventMatchStoryActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [EventActionType.MatchStory]: getProcessMatchStory(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getEventTransformResponseResultActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
// Throwing here fails the whole batch, which makes Lambda retry it and — by default —
|
|
15
|
+
// stall the shard until it succeeds or the records expire. That is the correct default for
|
|
16
|
+
// a projection (falling behind loudly beats silently skipping a change), but it is exactly
|
|
17
|
+
// why the event source mapping must be given a retry bound and a failure destination; see
|
|
18
|
+
// the stream construct.
|
|
19
|
+
const getProcessTransformResponseResult = (qpqConfig) => {
|
|
20
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ eventParams, qpqEventRecordResponses }) {
|
|
21
|
+
const onesThatErrored = qpqEventRecordResponses.filter((r) => !r.success);
|
|
22
|
+
if (onesThatErrored.length > 0) {
|
|
23
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `[${onesThatErrored.length}] stream records unable to be processed.`);
|
|
24
|
+
}
|
|
25
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const getEventTransformResponseResultActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
return ({
|
|
30
|
+
[quidproquo_core_1.EventActionType.TransformResponseResult]: getProcessTransformResponseResult(qpqConfig),
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
exports.getEventTransformResponseResultActionProcessor = getEventTransformResponseResultActionProcessor;
|
|
34
|
+
//# sourceMappingURL=getEventTransformResponseResultActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEventTransformResponseResultActionProcessor.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/getEventTransformResponseResultActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAIzB,sFAAsF;AACtF,2FAA2F;AAC3F,2FAA2F;AAC3F,0FAA0F;AAC1F,wBAAwB;AACxB,MAAM,iCAAiC,GAAG,CACxC,SAAoB,EACuE,EAAE;IAC7F,OAAO,KAAiD,EAAE,4CAA5C,EAAE,WAAW,EAAE,uBAAuB,EAAE;QACpD,MAAM,eAAe,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC1E,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,IAAA,mCAAiB,EAAC,+BAAa,CAAC,YAAY,EAAE,IAAI,eAAe,CAAC,MAAM,0CAA0C,CAAC,CAAC;QAC7H,CAAC;QAED,OAAO,IAAA,8BAAY,EAAc,KAAK,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,8CAA8C,GAAgC,CACzF,SAAoB,EACU,EAAE;IAAC,OAAA,CAAC;QAClC,CAAC,iCAAe,CAAC,uBAAuB,CAAC,EAAE,iCAAiC,CAAC,SAAS,CAAC;KACxF,CAAC,CAAA;EAAA,CAAC;AAJU,QAAA,8CAA8C,kDAIxD","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ErrorTypeEnum,\n EventActionType,\n EventTransformResponseResultActionProcessor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { EventInput, EventOutput, InternalEventOutput, InternalEventRecord } from './types';\n\n// Throwing here fails the whole batch, which makes Lambda retry it and — by default —\n// stall the shard until it succeeds or the records expire. That is the correct default for\n// a projection (falling behind loudly beats silently skipping a change), but it is exactly\n// why the event source mapping must be given a retry bound and a failure destination; see\n// the stream construct.\nconst getProcessTransformResponseResult = (\n qpqConfig: QPQConfig,\n): EventTransformResponseResultActionProcessor<EventInput, InternalEventOutput, EventOutput> => {\n return async ({ eventParams, qpqEventRecordResponses }) => {\n const onesThatErrored = qpqEventRecordResponses.filter((r) => !r.success);\n if (onesThatErrored.length > 0) {\n return actionResultError(ErrorTypeEnum.GenericError, `[${onesThatErrored.length}] stream records unable to be processed.`);\n }\n\n return actionResult<EventOutput>(void 0);\n };\n};\n\nexport const getEventTransformResponseResultActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n): Promise<ActionProcessorList> => ({\n [EventActionType.TransformResponseResult]: getProcessTransformResponseResult(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getDynamoKvsStreamEventProcessor = void 0;
|
|
13
|
+
const getEventAutoRespondActionProcessor_1 = require("./getEventAutoRespondActionProcessor");
|
|
14
|
+
const getEventGetRecordsActionProcessor_1 = require("./getEventGetRecordsActionProcessor");
|
|
15
|
+
const getEventGetStorySessionActionProcessor_1 = require("./getEventGetStorySessionActionProcessor");
|
|
16
|
+
const getEventMatchStoryActionProcessor_1 = require("./getEventMatchStoryActionProcessor");
|
|
17
|
+
const getEventTransformResponseResultActionProcessor_1 = require("./getEventTransformResponseResultActionProcessor");
|
|
18
|
+
const getDynamoKvsStreamEventProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (yield (0, getEventAutoRespondActionProcessor_1.getEventAutoRespondActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getEventGetRecordsActionProcessor_1.getEventGetRecordsActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getEventGetStorySessionActionProcessor_1.getEventGetStorySessionActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getEventMatchStoryActionProcessor_1.getEventMatchStoryActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getEventTransformResponseResultActionProcessor_1.getEventTransformResponseResultActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
20
|
+
});
|
|
21
|
+
exports.getDynamoKvsStreamEventProcessor = getDynamoKvsStreamEventProcessor;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6FAA0F;AAC1F,2FAAwF;AACxF,qGAAkG;AAClG,2FAAwF;AACxF,qHAAkH;AAE3G,MAAM,gCAAgC,GAAgC,CAC3E,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,2EAC9B,CAAC,MAAM,IAAA,uEAAkC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC1E,CAAC,MAAM,IAAA,qEAAiC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACzE,CAAC,MAAM,IAAA,+EAAsC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC9E,CAAC,MAAM,IAAA,qEAAiC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACzE,CAAC,MAAM,IAAA,+FAA8C,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EACzF,CAAA;EAAA,CAAC;AATU,QAAA,gCAAgC,oCAS1C","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport { getEventAutoRespondActionProcessor } from './getEventAutoRespondActionProcessor';\nimport { getEventGetRecordsActionProcessor } from './getEventGetRecordsActionProcessor';\nimport { getEventGetStorySessionActionProcessor } from './getEventGetStorySessionActionProcessor';\nimport { getEventMatchStoryActionProcessor } from './getEventMatchStoryActionProcessor';\nimport { getEventTransformResponseResultActionProcessor } from './getEventTransformResponseResultActionProcessor';\n\nexport const getDynamoKvsStreamEventProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getEventAutoRespondActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getEventGetRecordsActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getEventGetStorySessionActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getEventMatchStoryActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getEventTransformResponseResultActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KvsStreamEventResponse, KvsStreamRecord, MatchStoryResult, QpqFunctionRuntime } from 'quidproquo-core';
|
|
2
|
+
import { Context, DynamoDBStreamEvent } from 'aws-lambda';
|
|
3
|
+
export declare const GLOBAL_KVS_STREAM_STORE_NAME: string;
|
|
4
|
+
export declare const GLOBAL_KVS_STREAM_RUNTIME: QpqFunctionRuntime;
|
|
5
|
+
export declare const GLOBAL_KVS_STREAM_COALESCE: boolean;
|
|
6
|
+
export declare const GLOBAL_KVS_STREAM_PARTITION_KEY: string;
|
|
7
|
+
export type EventInput = [DynamoDBStreamEvent, Context];
|
|
8
|
+
export type EventOutput = void;
|
|
9
|
+
export type InternalEventRecord = KvsStreamRecord;
|
|
10
|
+
export type InternalEventOutput = KvsStreamEventResponse;
|
|
11
|
+
export type MatchResult = MatchStoryResult<any, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLOBAL_KVS_STREAM_PARTITION_KEY = exports.GLOBAL_KVS_STREAM_COALESCE = exports.GLOBAL_KVS_STREAM_RUNTIME = exports.GLOBAL_KVS_STREAM_STORE_NAME = void 0;
|
|
4
|
+
// Customs — the CDK stamps these onto the projector lambda, the same way the storage drive
|
|
5
|
+
// event lambda is told which drive it serves.
|
|
6
|
+
exports.GLOBAL_KVS_STREAM_STORE_NAME = process.env.keyValueStoreName;
|
|
7
|
+
exports.GLOBAL_KVS_STREAM_RUNTIME = JSON.parse(process.env.kvsStreamEntry || '"/::"');
|
|
8
|
+
// Collapse each batch to one record per partition key. See KvsStreamSettings.
|
|
9
|
+
exports.GLOBAL_KVS_STREAM_COALESCE = process.env.kvsStreamCoalesceByPartitionKey === 'true';
|
|
10
|
+
// The table's partition key attribute, needed to coalesce (the stream record's `Keys` map
|
|
11
|
+
// carries both partition and sort key, and only the partition key identifies the item's
|
|
12
|
+
// ordering group).
|
|
13
|
+
exports.GLOBAL_KVS_STREAM_PARTITION_KEY = process.env.kvsStreamPartitionKey || '';
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/getActionProcessor/core/event/dynamo/streamEvent/types.ts"],"names":[],"mappings":";;;AAIA,2FAA2F;AAC3F,8CAA8C;AACjC,QAAA,4BAA4B,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAkB,CAAC;AAC9D,QAAA,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAuB,CAAC;AAEjH,8EAA8E;AACjE,QAAA,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,KAAK,MAAM,CAAC;AAEjG,0FAA0F;AAC1F,wFAAwF;AACxF,mBAAmB;AACN,QAAA,+BAA+B,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC","sourcesContent":["import { KvsStreamEventResponse, KvsStreamRecord, MatchStoryResult, QpqFunctionRuntime } from 'quidproquo-core';\n\nimport { Context, DynamoDBStreamEvent } from 'aws-lambda';\n\n// Customs — the CDK stamps these onto the projector lambda, the same way the storage drive\n// event lambda is told which drive it serves.\nexport const GLOBAL_KVS_STREAM_STORE_NAME = process.env.keyValueStoreName!;\nexport const GLOBAL_KVS_STREAM_RUNTIME = JSON.parse(process.env.kvsStreamEntry || '\"/::\"') as QpqFunctionRuntime;\n\n// Collapse each batch to one record per partition key. See KvsStreamSettings.\nexport const GLOBAL_KVS_STREAM_COALESCE = process.env.kvsStreamCoalesceByPartitionKey === 'true';\n\n// The table's partition key attribute, needed to coalesce (the stream record's `Keys` map\n// carries both partition and sort key, and only the partition key identifies the item's\n// ordering group).\nexport const GLOBAL_KVS_STREAM_PARTITION_KEY = process.env.kvsStreamPartitionKey || '';\n\n// Externals — the ins and outs of the external event\nexport type EventInput = [DynamoDBStreamEvent, Context];\nexport type EventOutput = void;\n\n// Internals — the ins and outs of each record in the event\nexport type InternalEventRecord = KvsStreamRecord;\nexport type InternalEventOutput = KvsStreamEventResponse;\n\nexport type MatchResult = MatchStoryResult<any, any>;\n"]}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./apiGatwayEvent"), exports);
|
|
18
18
|
__exportStar(require("./cloudFrontOriginRequest"), exports);
|
|
19
19
|
__exportStar(require("./cognito"), exports);
|
|
20
|
+
__exportStar(require("./dynamo"), exports);
|
|
20
21
|
__exportStar(require("./eventBridgeEvent"), exports);
|
|
21
22
|
__exportStar(require("./lambda"), exports);
|
|
22
23
|
__exportStar(require("./s3"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/event/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,4DAA0C;AAC1C,4CAA0B;AAC1B,qDAAmC;AACnC,2CAAyB;AACzB,uCAAqB;AACrB,wCAAsB","sourcesContent":["export * from './apiGatwayEvent';\nexport * from './cloudFrontOriginRequest';\nexport * from './cognito';\nexport * from './eventBridgeEvent';\nexport * from './lambda';\nexport * from './s3';\nexport * from './sqs';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/event/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,4DAA0C;AAC1C,4CAA0B;AAC1B,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,uCAAqB;AACrB,wCAAsB","sourcesContent":["export * from './apiGatwayEvent';\nexport * from './cloudFrontOriginRequest';\nexport * from './cognito';\nexport * from './dynamo';\nexport * from './eventBridgeEvent';\nexport * from './lambda';\nexport * from './s3';\nexport * from './sqs';\n"]}
|
package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js
CHANGED
|
@@ -27,7 +27,7 @@ const getProcessKeyValueStoreQuery = (qpqConfig) => {
|
|
|
27
27
|
// composed form (throws when the key condition never constrains the pk).
|
|
28
28
|
const scoped = (0, quidproquo_core_1.getScopedKvsTranslatorOrThrow)(qpqConfig, keyValueStoreName, options === null || options === void 0 ? void 0 : options.scope);
|
|
29
29
|
const effectiveKeyCondition = scoped.keyCondition(keyCondition);
|
|
30
|
-
const items = yield (0, dynamo_1.query)(dynamoTableName, region, effectiveKeyCondition, scoped.filter(options === null || options === void 0 ? void 0 : options.filter), options === null || options === void 0 ? void 0 : options.nextPageKey, (_b = (0, qpqDynamoOrm_1.getDynamoTableIndexByConfigAndQuery)(storeConfig, effectiveKeyCondition)) !== null && _b !== void 0 ? _b : undefined, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.sortAscending);
|
|
30
|
+
const items = yield (0, dynamo_1.query)(dynamoTableName, region, effectiveKeyCondition, scoped.filter(options === null || options === void 0 ? void 0 : options.filter), options === null || options === void 0 ? void 0 : options.nextPageKey, (_b = (0, qpqDynamoOrm_1.getDynamoTableIndexByConfigAndQuery)(storeConfig, effectiveKeyCondition)) !== null && _b !== void 0 ? _b : undefined, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.sortAscending, options === null || options === void 0 ? void 0 : options.consistentRead);
|
|
31
31
|
items.items = items.items.map((item) => scoped.strip(item));
|
|
32
32
|
return (0, quidproquo_core_2.actionResult)(items);
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKeyValueStoreQueryActionProcessor.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAA0D;AAC1D,qDAQyB;AACzB,qDAA4I;AAE5I,4DAA0E;AAC1E,kDAA8C;AAC9C,qEAAyF;AAEzF,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA0C,EAAE;IACpG,OAAO,KAAqD,EAAE,4CAAhD,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,EAAE;;QACxD,MAAM,eAAe,GAAG,IAAA,gDAA+B,EAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,yCAAiB,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QAE7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAA,8CAA4B,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YAE/E,0EAA0E;YAC1E,yEAAyE;YACzE,MAAM,MAAM,GAAG,IAAA,+CAA6B,EAAC,SAAS,EAAE,iBAAiB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;YAC3F,MAAM,qBAAqB,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAEhE,MAAM,KAAK,GAAG,MAAM,IAAA,cAAK,EACvB,eAAe,EACf,MAAM,EACN,qBAAqB,EACrB,MAAM,CAAC,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,EAC9B,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EACpB,MAAA,IAAA,kDAAmC,EAAC,WAAW,EAAE,qBAAqB,CAAC,mCAAI,SAAS,EACpF,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EACd,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"getKeyValueStoreQueryActionProcessor.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAA0D;AAC1D,qDAQyB;AACzB,qDAA4I;AAE5I,4DAA0E;AAC1E,kDAA8C;AAC9C,qEAAyF;AAEzF,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA0C,EAAE;IACpG,OAAO,KAAqD,EAAE,4CAAhD,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,EAAE;;QACxD,MAAM,eAAe,GAAG,IAAA,gDAA+B,EAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,yCAAiB,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QAE7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAA,8CAA4B,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YAE/E,0EAA0E;YAC1E,yEAAyE;YACzE,MAAM,MAAM,GAAG,IAAA,+CAA6B,EAAC,SAAS,EAAE,iBAAiB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;YAC3F,MAAM,qBAAqB,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAEhE,MAAM,KAAK,GAAG,MAAM,IAAA,cAAK,EACvB,eAAe,EACf,MAAM,EACN,qBAAqB,EACrB,MAAM,CAAC,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,EAC9B,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EACpB,MAAA,IAAA,kDAAmC,EAAC,WAAW,EAAE,qBAAqB,CAAC,mCAAI,SAAS,EACpF,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EACd,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EACtB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CACxB,CAAC;YAEF,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAEjE,OAAO,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAA,kDAAgC,EAAC,KAAK,EAAE;gBAC7C,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAA,mCAAiB,EAAC,iDAA+B,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;gBAC3H,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAA,mCAAiB,EAAC,iDAA+B,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;gBAC9H,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAiB,EAAC,iDAA+B,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC5G,qBAAqB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAiB,EAAC,iDAA+B,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC;aAClH,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,oCAAoC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC9I,CAAC,yCAAuB,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;KACzE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,oCAAoC,wCAE9C","sourcesContent":["import { qpqConfigAwsUtils } from 'quidproquo-config-aws';\nimport {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResultError,\n actionResultErrorFromCaughtError,\n getScopedKvsTranslatorOrThrow,\n QPQConfig,\n resolveKvsStoreConfigOrThrow,\n} from 'quidproquo-core';\nimport { actionResult, KeyValueStoreActionType, KeyValueStoreQueryActionProcessor, KeyValueStoreQueryErrorTypeEnum } from 'quidproquo-core';\n\nimport { getKvsDynamoTableNameFromConfig } from '../../../awsNamingUtils';\nimport { query } from '../../../logic/dynamo';\nimport { getDynamoTableIndexByConfigAndQuery } from '../../../logic/dynamo/qpqDynamoOrm';\n\nconst getProcessKeyValueStoreQuery = (qpqConfig: QPQConfig): KeyValueStoreQueryActionProcessor<any> => {\n return async ({ keyValueStoreName, keyCondition, options }) => {\n const dynamoTableName = getKvsDynamoTableNameFromConfig(keyValueStoreName, qpqConfig, 'kvs');\n const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);\n\n try {\n const storeConfig = resolveKvsStoreConfigOrThrow(qpqConfig, keyValueStoreName);\n\n // Scope lives inside the pk values, so pk conditions are rewritten to the\n // composed form (throws when the key condition never constrains the pk).\n const scoped = getScopedKvsTranslatorOrThrow(qpqConfig, keyValueStoreName, options?.scope);\n const effectiveKeyCondition = scoped.keyCondition(keyCondition);\n\n const items = await query<any>(\n dynamoTableName,\n region,\n effectiveKeyCondition,\n scoped.filter(options?.filter),\n options?.nextPageKey,\n getDynamoTableIndexByConfigAndQuery(storeConfig, effectiveKeyCondition) ?? undefined,\n options?.limit,\n options?.sortAscending,\n options?.consistentRead,\n );\n\n items.items = items.items.map((item: any) => scoped.strip(item));\n\n return actionResult(items);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InternalServerError: () => actionResultError(KeyValueStoreQueryErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),\n ResourceNotFoundException: () => actionResultError(KeyValueStoreQueryErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),\n InvalidScopeError: (error) => actionResultError(KeyValueStoreQueryErrorTypeEnum.InvalidScope, error.message),\n KvsStoreNotFoundError: (error) => actionResultError(KeyValueStoreQueryErrorTypeEnum.StoreNotFound, error.message),\n });\n }\n };\n};\n\nexport const getKeyValueStoreQueryActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [KeyValueStoreActionType.Query]: getProcessKeyValueStoreQuery(qpqConfig),\n});\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getKeyValueStoreScanAllScopesActionProcessor = void 0;
|
|
13
|
+
const quidproquo_config_aws_1 = require("quidproquo-config-aws");
|
|
14
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
|
+
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
|
+
const dynamo_1 = require("../../../logic/dynamo");
|
|
17
|
+
// Every row in the table, scope and all. No scoped translator is involved: that is the whole
|
|
18
|
+
// point, and it is why this action is migration-only (see askKeyValueStoreScanAllScopes).
|
|
19
|
+
//
|
|
20
|
+
// The scope is composed into the partition key value, so each row is split back into the
|
|
21
|
+
// scope it belongs to plus its raw key, exactly as the stream processor does. The caller gets
|
|
22
|
+
// items indistinguishable from a scoped read, plus the scope beside them.
|
|
23
|
+
const getProcessKeyValueStoreScanAllScopes = (qpqConfig) => {
|
|
24
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ keyValueStoreName, filterCondition, nextPageKey }) {
|
|
25
|
+
const dynamoTableName = (0, awsNamingUtils_1.getKvsDynamoTableNameFromConfig)(keyValueStoreName, qpqConfig, 'kvs');
|
|
26
|
+
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
27
|
+
try {
|
|
28
|
+
const storeConfig = (0, quidproquo_core_1.resolveKvsStoreConfigOrThrow)(qpqConfig, keyValueStoreName);
|
|
29
|
+
const partitionKey = storeConfig.partitionKey.key;
|
|
30
|
+
const page = yield (0, dynamo_1.scan)(dynamoTableName, region, filterCondition, nextPageKey);
|
|
31
|
+
const items = page.items.map((item) => {
|
|
32
|
+
var _a;
|
|
33
|
+
// Only a string partition key can carry a composed scope; anything else is unscoped
|
|
34
|
+
// by construction.
|
|
35
|
+
if (storeConfig.partitionKey.type !== 'string') {
|
|
36
|
+
return { item };
|
|
37
|
+
}
|
|
38
|
+
const { scope, rawValue } = (0, quidproquo_core_1.decomposeScopedKvsValue)(String((_a = item[partitionKey]) !== null && _a !== void 0 ? _a : ''));
|
|
39
|
+
return { scope, item: Object.assign(Object.assign({}, item), { [partitionKey]: rawValue }) };
|
|
40
|
+
});
|
|
41
|
+
return (0, quidproquo_core_1.actionResult)({ items, nextPageKey: page.nextPageKey });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
45
|
+
InternalServerError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.KeyValueStoreScanAllScopesErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
|
|
46
|
+
ResourceNotFoundException: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.KeyValueStoreScanAllScopesErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),
|
|
47
|
+
KvsStoreNotFoundError: (error) => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.KeyValueStoreScanAllScopesErrorTypeEnum.StoreNotFound, error.message),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const getKeyValueStoreScanAllScopesActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
return ({
|
|
54
|
+
[quidproquo_core_1.KeyValueStoreActionType.ScanAllScopes]: getProcessKeyValueStoreScanAllScopes(qpqConfig),
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
exports.getKeyValueStoreScanAllScopesActionProcessor = getKeyValueStoreScanAllScopesActionProcessor;
|
|
58
|
+
//# sourceMappingURL=getKeyValueStoreScanAllScopesActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getKeyValueStoreScanAllScopesActionProcessor.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/keyValueStore/getKeyValueStoreScanAllScopesActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAA0D;AAC1D,qDAayB;AAEzB,4DAA0E;AAC1E,kDAA6C;AAE7C,6FAA6F;AAC7F,0FAA0F;AAC1F,EAAE;AACF,yFAAyF;AACzF,8FAA8F;AAC9F,0EAA0E;AAC1E,MAAM,oCAAoC,GAAG,CAAC,SAAoB,EAAkD,EAAE;IACpH,OAAO,KAA4D,EAAE,4CAAvD,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE;QAC/D,MAAM,eAAe,GAAG,IAAA,gDAA+B,EAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,yCAAiB,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QAE7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAA,8CAA4B,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YAC/E,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;YAElD,MAAM,IAAI,GAAG,MAAM,IAAA,aAAI,EAAM,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;YAEpF,MAAM,KAAK,GAAyB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;;gBAC/D,oFAAoF;gBACpF,mBAAmB;gBACnB,IAAI,WAAW,CAAC,YAAY,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC/C,OAAO,EAAE,IAAI,EAAE,CAAC;gBAClB,CAAC;gBAED,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAA,yCAAuB,EAAC,MAAM,CAAC,MAAA,IAAI,CAAC,YAAY,CAAC,mCAAI,EAAE,CAAC,CAAC,CAAC;gBAEtF,OAAO,EAAE,KAAK,EAAE,IAAI,kCAAO,IAAI,KAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,GAAE,EAAE,CAAC;YAChE,CAAC,CAAC,CAAC;YAEH,OAAO,IAAA,8BAAY,EAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAA,kDAAgC,EAAC,KAAK,EAAE;gBAC7C,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAA,mCAAiB,EAAC,yDAAuC,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;gBACnI,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAA,mCAAiB,EAAC,yDAAuC,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;gBACtI,qBAAqB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAiB,EAAC,yDAAuC,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC;aAC1H,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,4CAA4C,GAAgC,CACvF,SAAoB,EACU,EAAE;IAAC,OAAA,CAAC;QAClC,CAAC,yCAAuB,CAAC,aAAa,CAAC,EAAE,oCAAoC,CAAC,SAAS,CAAC;KACzF,CAAC,CAAA;EAAA,CAAC;AAJU,QAAA,4CAA4C,gDAItD","sourcesContent":["import { qpqConfigAwsUtils } from 'quidproquo-config-aws';\nimport {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n decomposeScopedKvsValue,\n KeyValueStoreActionType,\n KeyValueStoreScanAllScopesActionProcessor,\n KeyValueStoreScanAllScopesErrorTypeEnum,\n KvsScopedItem,\n QPQConfig,\n resolveKvsStoreConfigOrThrow,\n} from 'quidproquo-core';\n\nimport { getKvsDynamoTableNameFromConfig } from '../../../awsNamingUtils';\nimport { scan } from '../../../logic/dynamo';\n\n// Every row in the table, scope and all. No scoped translator is involved: that is the whole\n// point, and it is why this action is migration-only (see askKeyValueStoreScanAllScopes).\n//\n// The scope is composed into the partition key value, so each row is split back into the\n// scope it belongs to plus its raw key, exactly as the stream processor does. The caller gets\n// items indistinguishable from a scoped read, plus the scope beside them.\nconst getProcessKeyValueStoreScanAllScopes = (qpqConfig: QPQConfig): KeyValueStoreScanAllScopesActionProcessor<any> => {\n return async ({ keyValueStoreName, filterCondition, nextPageKey }) => {\n const dynamoTableName = getKvsDynamoTableNameFromConfig(keyValueStoreName, qpqConfig, 'kvs');\n const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);\n\n try {\n const storeConfig = resolveKvsStoreConfigOrThrow(qpqConfig, keyValueStoreName);\n const partitionKey = storeConfig.partitionKey.key;\n\n const page = await scan<any>(dynamoTableName, region, filterCondition, nextPageKey);\n\n const items: KvsScopedItem<any>[] = page.items.map((item: any) => {\n // Only a string partition key can carry a composed scope; anything else is unscoped\n // by construction.\n if (storeConfig.partitionKey.type !== 'string') {\n return { item };\n }\n\n const { scope, rawValue } = decomposeScopedKvsValue(String(item[partitionKey] ?? ''));\n\n return { scope, item: { ...item, [partitionKey]: rawValue } };\n });\n\n return actionResult({ items, nextPageKey: page.nextPageKey });\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InternalServerError: () => actionResultError(KeyValueStoreScanAllScopesErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),\n ResourceNotFoundException: () => actionResultError(KeyValueStoreScanAllScopesErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),\n KvsStoreNotFoundError: (error) => actionResultError(KeyValueStoreScanAllScopesErrorTypeEnum.StoreNotFound, error.message),\n });\n }\n };\n};\n\nexport const getKeyValueStoreScanAllScopesActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n): Promise<ActionProcessorList> => ({\n [KeyValueStoreActionType.ScanAllScopes]: getProcessKeyValueStoreScanAllScopes(qpqConfig),\n});\n"]}
|
|
@@ -15,10 +15,11 @@ const getKeyValueStoreGetActionProcessor_1 = require("./getKeyValueStoreGetActio
|
|
|
15
15
|
const getKeyValueStoreGetAllActionProcessor_1 = require("./getKeyValueStoreGetAllActionProcessor");
|
|
16
16
|
const getKeyValueStoreQueryActionProcessor_1 = require("./getKeyValueStoreQueryActionProcessor");
|
|
17
17
|
const getKeyValueStoreScanActionProcessor_1 = require("./getKeyValueStoreScanActionProcessor");
|
|
18
|
+
const getKeyValueStoreScanAllScopesActionProcessor_1 = require("./getKeyValueStoreScanAllScopesActionProcessor");
|
|
18
19
|
const getKeyValueStoreUpdateActionProcessor_1 = require("./getKeyValueStoreUpdateActionProcessor");
|
|
19
20
|
const getKeyValueStoreUpsertActionProcessor_1 = require("./getKeyValueStoreUpsertActionProcessor");
|
|
20
21
|
const getKeyValueStoreActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (yield (0, getKeyValueStoreDeleteActionProcessor_1.getKeyValueStoreDeleteActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreGetActionProcessor_1.getKeyValueStoreGetActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreGetAllActionProcessor_1.getKeyValueStoreGetAllActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreUpsertActionProcessor_1.getKeyValueStoreUpsertActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreUpdateActionProcessor_1.getKeyValueStoreUpdateActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreQueryActionProcessor_1.getKeyValueStoreQueryActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreScanActionProcessor_1.getKeyValueStoreScanActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
22
|
+
return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (yield (0, getKeyValueStoreDeleteActionProcessor_1.getKeyValueStoreDeleteActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreGetActionProcessor_1.getKeyValueStoreGetActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreGetAllActionProcessor_1.getKeyValueStoreGetAllActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreUpsertActionProcessor_1.getKeyValueStoreUpsertActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreUpdateActionProcessor_1.getKeyValueStoreUpdateActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreQueryActionProcessor_1.getKeyValueStoreQueryActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreScanActionProcessor_1.getKeyValueStoreScanActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getKeyValueStoreScanAllScopesActionProcessor_1.getKeyValueStoreScanAllScopesActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
22
23
|
});
|
|
23
24
|
exports.getKeyValueStoreActionProcessor = getKeyValueStoreActionProcessor;
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/keyValueStore/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,mGAAgG;AAChG,6FAA0F;AAC1F,mGAAgG;AAChG,iGAA8F;AAC9F,+FAA4F;AAC5F,mGAAgG;AAChG,mGAAgG;AAEzF,MAAM,+BAA+B,GAAgC,CAC1E,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/getActionProcessor/core/keyValueStore/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,mGAAgG;AAChG,6FAA0F;AAC1F,mGAAgG;AAChG,iGAA8F;AAC9F,+FAA4F;AAC5F,iHAA8G;AAC9G,mGAAgG;AAChG,mGAAgG;AAEzF,MAAM,+BAA+B,GAAgC,CAC1E,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,qHAC9B,CAAC,MAAM,IAAA,6EAAqC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC7E,CAAC,MAAM,IAAA,uEAAkC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC1E,CAAC,MAAM,IAAA,6EAAqC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC7E,CAAC,MAAM,IAAA,6EAAqC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC7E,CAAC,MAAM,IAAA,6EAAqC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC7E,CAAC,MAAM,IAAA,2EAAoC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC5E,CAAC,MAAM,IAAA,yEAAmC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC3E,CAAC,MAAM,IAAA,2FAA4C,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EACvF,CAAA;EAAA,CAAC;AAZU,QAAA,+BAA+B,mCAYzC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport { getKeyValueStoreDeleteActionProcessor } from './getKeyValueStoreDeleteActionProcessor';\nimport { getKeyValueStoreGetActionProcessor } from './getKeyValueStoreGetActionProcessor';\nimport { getKeyValueStoreGetAllActionProcessor } from './getKeyValueStoreGetAllActionProcessor';\nimport { getKeyValueStoreQueryActionProcessor } from './getKeyValueStoreQueryActionProcessor';\nimport { getKeyValueStoreScanActionProcessor } from './getKeyValueStoreScanActionProcessor';\nimport { getKeyValueStoreScanAllScopesActionProcessor } from './getKeyValueStoreScanAllScopesActionProcessor';\nimport { getKeyValueStoreUpdateActionProcessor } from './getKeyValueStoreUpdateActionProcessor';\nimport { getKeyValueStoreUpsertActionProcessor } from './getKeyValueStoreUpsertActionProcessor';\n\nexport const getKeyValueStoreActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getKeyValueStoreDeleteActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreGetActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreGetAllActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreUpsertActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreUpdateActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreQueryActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreScanActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getKeyValueStoreScanAllScopesActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -18,6 +18,7 @@ exports.entryNames = [
|
|
|
18
18
|
'customMessageTriggerEvent_defineAuthChallenge',
|
|
19
19
|
'customMessageTriggerEvent_createAuthChallenge',
|
|
20
20
|
'customMessageTriggerEvent_verifyAuthChallenge',
|
|
21
|
+
'dynamoStreamEvent_kvsStreamEvent',
|
|
21
22
|
'eventBridgeEvent_recurringSchedule',
|
|
22
23
|
'eventBridgeEvent_stackDeploy',
|
|
23
24
|
's3Event_fileEvent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLambdaEntries.js","sourceRoot":"","sources":["../../src/getLambdaEntries.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,gFAAgF;AAChF,4DAA4D;AAC/C,QAAA,UAAU,GAAG;IACxB,gDAAgD;IAEhD,iCAAiC;IACjC,wBAAwB;IAExB,oDAAoD;IAEpD,sCAAsC;IACtC,sCAAsC;IAEtC,yCAAyC;IACzC,+CAA+C;IAC/C,+CAA+C;IAC/C,+CAA+C;IAE/C,oCAAoC;IACpC,8BAA8B;IAE9B,mBAAmB;IACnB,qBAAqB;CACtB,CAAC;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,GAA2B,EAAE,CAC3D,MAAM,CAAC,WAAW,CAAC,kBAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AADrF,QAAA,gBAAgB,oBACqE","sourcesContent":["import path from 'path';\n\n// One entry per lambda handler under ./lambdas; each name must match its source\n// filename exactly (yes, including the apiGatway spelling).\nexport const entryNames = [\n 'anyExecuteServiceFunctionEvent_serviceFunction',\n\n 'apiGatewayEventHandler_redirect',\n 'apiGatewayEventHandler',\n\n 'apiGatwayEventWebsocketWithIdentity_websocketEvent',\n\n 'cloudFrontRequestEvent_originRequest',\n 'cloudFrontRequestEvent_viewerRequest',\n\n 'customMessageTriggerEvent_customMessage',\n 'customMessageTriggerEvent_defineAuthChallenge',\n 'customMessageTriggerEvent_createAuthChallenge',\n 'customMessageTriggerEvent_verifyAuthChallenge',\n\n 'eventBridgeEvent_recurringSchedule',\n 'eventBridgeEvent_stackDeploy',\n\n 's3Event_fileEvent',\n 'sqsEvent_queueEvent',\n];\n\n/**\n * Maps each lambda entry name to its handler path, for deploy bundlers\n * (quidproquo-deploy-rspack/webpack) to use as bundle entry points.\n */\nexport const getLambdaEntries = (): Record<string, string> =>\n Object.fromEntries(entryNames.map((name) => [name, path.join(__dirname, `./lambdas/${name}`)]));\n"]}
|
|
1
|
+
{"version":3,"file":"getLambdaEntries.js","sourceRoot":"","sources":["../../src/getLambdaEntries.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,gFAAgF;AAChF,4DAA4D;AAC/C,QAAA,UAAU,GAAG;IACxB,gDAAgD;IAEhD,iCAAiC;IACjC,wBAAwB;IAExB,oDAAoD;IAEpD,sCAAsC;IACtC,sCAAsC;IAEtC,yCAAyC;IACzC,+CAA+C;IAC/C,+CAA+C;IAC/C,+CAA+C;IAE/C,kCAAkC;IAElC,oCAAoC;IACpC,8BAA8B;IAE9B,mBAAmB;IACnB,qBAAqB;CACtB,CAAC;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,GAA2B,EAAE,CAC3D,MAAM,CAAC,WAAW,CAAC,kBAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AADrF,QAAA,gBAAgB,oBACqE","sourcesContent":["import path from 'path';\n\n// One entry per lambda handler under ./lambdas; each name must match its source\n// filename exactly (yes, including the apiGatway spelling).\nexport const entryNames = [\n 'anyExecuteServiceFunctionEvent_serviceFunction',\n\n 'apiGatewayEventHandler_redirect',\n 'apiGatewayEventHandler',\n\n 'apiGatwayEventWebsocketWithIdentity_websocketEvent',\n\n 'cloudFrontRequestEvent_originRequest',\n 'cloudFrontRequestEvent_viewerRequest',\n\n 'customMessageTriggerEvent_customMessage',\n 'customMessageTriggerEvent_defineAuthChallenge',\n 'customMessageTriggerEvent_createAuthChallenge',\n 'customMessageTriggerEvent_verifyAuthChallenge',\n\n 'dynamoStreamEvent_kvsStreamEvent',\n\n 'eventBridgeEvent_recurringSchedule',\n 'eventBridgeEvent_stackDeploy',\n\n 's3Event_fileEvent',\n 'sqsEvent_queueEvent',\n];\n\n/**\n * Maps each lambda entry name to its handler path, for deploy bundlers\n * (quidproquo-deploy-rspack/webpack) to use as bundle entry points.\n */\nexport const getLambdaEntries = (): Record<string, string> =>\n Object.fromEntries(entryNames.map((name) => [name, path.join(__dirname, `./lambdas/${name}`)]));\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DynamicModuleLoader, QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { DynamoDBStreamEvent } from 'aws-lambda';
|
|
3
|
+
export declare const getDynamoStreamEvent_kvsStreamEvent: (dynamicModuleLoader: DynamicModuleLoader, qpqConfig: QPQConfig) => (event: DynamoDBStreamEvent, context: import("aws-lambda").Context) => Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDynamoStreamEvent_kvsStreamEvent = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const getActionProcessor_1 = require("../getActionProcessor");
|
|
6
|
+
const getBlankStorySession_1 = require("./helpers/getBlankStorySession");
|
|
7
|
+
const getQpqLambdaRuntimeForEvent_1 = require("./helpers/getQpqLambdaRuntimeForEvent");
|
|
8
|
+
const getDynamoStreamEvent_kvsStreamEvent = (dynamicModuleLoader, qpqConfig) => (0, getQpqLambdaRuntimeForEvent_1.getQpqLambdaRuntimeForEvent)(quidproquo_core_1.QpqRuntimeType.KVS_STREAM_EVENT, getBlankStorySession_1.getBlankStorySession, getActionProcessor_1.getDynamoKvsStreamEventProcessor, dynamicModuleLoader, qpqConfig);
|
|
9
|
+
exports.getDynamoStreamEvent_kvsStreamEvent = getDynamoStreamEvent_kvsStreamEvent;
|
|
10
|
+
//# sourceMappingURL=getDynamoStreamEvent_kvsStreamEvent.js.map
|