sdk-aws-lambda 0.7.3 → 0.8.1
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/dist/domain.objects/LambdaEndpointRefusal.d.ts +25 -0
- package/dist/domain.objects/LambdaEndpointRefusal.js +19 -0
- package/dist/domain.objects/LambdaEndpointRefusal.js.map +1 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.d.ts +25 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.js +28 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.js.map +1 -0
- package/dist/domain.objects/LambdaEventSchemaSource.d.ts +26 -0
- package/dist/domain.objects/LambdaEventSchemaSource.js +11 -0
- package/dist/domain.objects/LambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.d.ts +13 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.js +3 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.d.ts +19 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.js +3 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.d.ts +37 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js +57 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.d.ts +39 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.d.ts +61 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js +89 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.d.ts +58 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js +81 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.js +45 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +3 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.d.ts +11 -2
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js +7 -2
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.d.ts +10 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js +17 -5
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.d.ts +17 -0
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js +22 -0
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +2 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +1 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.d.ts +9 -5
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js +27 -9
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.d.ts +15 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js +43 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.d.ts +11 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js +15 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +9 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.d.ts +25 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js +66 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.d.ts +12 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.js +42 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.d.ts +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.js +103 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forSqs → middleware}/asCallerFault.d.ts +4 -3
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forSqs → middleware}/asCallerFault.js +5 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/asCallerFault.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.d.ts +17 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js +26 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +2 -2
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +15 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +34 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +1 -1
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +2 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +8 -4
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -1
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.d.ts +22 -0
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js +34 -0
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.d.ts +15 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.js +50 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.d.ts +27 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.js +31 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.d.ts +15 -4
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js +32 -17
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js.map +1 -1
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +12 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/readme.md +115 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asCallerFault.js.map +0 -1
|
@@ -2,10 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genIoLoggerMiddleware = void 0;
|
|
4
4
|
const asContextTrailed_1 = require("./asContextTrailed");
|
|
5
|
+
const asLogMethodOfFailure_1 = require("./asLogMethodOfFailure");
|
|
5
6
|
/**
|
|
6
7
|
* .what = middleware that logs handler input and output
|
|
7
8
|
* .why = enables debug observability with optional redaction via translate.log
|
|
8
9
|
*
|
|
10
|
+
* | outcome | `handler.output` level |
|
|
11
|
+
* |---|---|
|
|
12
|
+
* | success | debug |
|
|
13
|
+
* | caller fault (`getIsConstraintError`) | warn |
|
|
14
|
+
* | any other fault | error |
|
|
15
|
+
*
|
|
16
|
+
* .note = a handled failure still reads a success to aws, so the level is on-call's only signal
|
|
17
|
+
* (sdk-aws-lambda#77). where trail has not yet put a `log` on the context, the failure
|
|
18
|
+
* line falls back to `console` (`asLogMethodOfFailure`)
|
|
19
|
+
* .note = the error branch logs `errorMessage` + `stackTrace` raw; `logTranslate.output` reads
|
|
20
|
+
* only the response branch
|
|
21
|
+
* .note = a server fault writes two error lines: this `handler.output`, then
|
|
22
|
+
* `genInternalServiceErrorMiddleware`'s `handler.error`. an alarm that counts error lines
|
|
23
|
+
* reads two per fault; count by `message` to read one (F5, accepted)
|
|
24
|
+
*
|
|
9
25
|
* .defect = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
|
|
10
26
|
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch instead
|
|
11
27
|
*
|
|
@@ -46,20 +62,25 @@ const genIoLoggerMiddleware = (input) => {
|
|
|
46
62
|
}
|
|
47
63
|
};
|
|
48
64
|
const onError = async (request) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
}
|
|
65
|
+
// a failure logs at warn (caller fault) or error (all else), never at debug
|
|
66
|
+
const logFailure = (0, asLogMethodOfFailure_1.asLogMethodOfFailure)({
|
|
67
|
+
error: request.error,
|
|
68
|
+
log: (0, asContextTrailed_1.asContextTrailed)({ context: request.context }).log ?? null,
|
|
69
|
+
});
|
|
70
|
+
// log what the caller received, where an error builder already set it
|
|
71
|
+
if (request.response) {
|
|
72
|
+
logFailure('handler.output', {
|
|
73
|
+
response: translateOutput(request.response),
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
62
76
|
}
|
|
77
|
+
// log the failure itself; onError runs only on a throw, so a thrown non-Error (a string, a
|
|
78
|
+
// falsy value, `undefined`) still logs, and names what was thrown
|
|
79
|
+
const thrown = request.error;
|
|
80
|
+
logFailure('handler.output', {
|
|
81
|
+
errorMessage: thrown instanceof Error ? thrown.message : String(thrown),
|
|
82
|
+
stackTrace: thrown instanceof Error ? thrown.stack : null,
|
|
83
|
+
});
|
|
63
84
|
};
|
|
64
85
|
return { before, after, onError };
|
|
65
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;
|
|
1
|
+
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAErC,EAIC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,eAAe,GACnB,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,MAAM,GAAG,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;QAC/D,IAAI,GAAG,EAAE,CAAC;YACR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AAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SAC1D,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC;AApDW,QAAA,qBAAqB,yBAoDhC"}
|
|
@@ -25,7 +25,7 @@ const asMechanismsFileSource = (input) => {
|
|
|
25
25
|
const usedResourceNames = input.resourceNames.filter((name) => new RegExp(`\\b${name}\\b`).test(fnsText));
|
|
26
26
|
// the import lines: askLambdaEndpoint always; resource types only if any used
|
|
27
27
|
const imports = [
|
|
28
|
-
`import { askLambdaEndpoint, type ContextAwsLambdaCaller } from 'sdk-aws-lambda';`,
|
|
28
|
+
`import { askLambdaEndpoint, type ContextAwsLambdaCaller, type LambdaEndpointRefusal } from 'sdk-aws-lambda';`,
|
|
29
29
|
];
|
|
30
30
|
if (usedResourceNames.length > 0)
|
|
31
31
|
imports.push(`import type { ${usedResourceNames.join(', ')} } from '${input.resourcesModule}';`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asMechanismsFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAOtC,EAAU,EAAE;IACX,8EAA8E;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;SACrC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,IAAA,yCAAmB,EAAC;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAyB;QACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,iFAAiF;IACjF,iFAAiF;IACjF,oFAAoF;IACpF,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAC1C,CAAC;IAEF,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACd,
|
|
1
|
+
{"version":3,"file":"asMechanismsFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAOtC,EAAU,EAAE;IACX,8EAA8E;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;SACrC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,IAAA,yCAAmB,EAAC;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAyB;QACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,iFAAiF;IACjF,iFAAiF;IACjF,oFAAoF;IACpF,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAC1C,CAAC;IAEF,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACd,8GAA8G;KAC/G,CAAC;IACF,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAC9B,OAAO,CAAC,IAAI,CACV,iBAAiB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,eAAe,IAAI,CACnF,CAAC;IAEJ,OAAO;QACL,eAAM;QACN,EAAE;QACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,EAAE;QACF,gBAAgB,KAAK,CAAC,MAAM,MAAM;QAClC,OAAO;QACP,IAAI;QACJ,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AA/CW,QAAA,sBAAsB,0BA+CjC"}
|
|
@@ -12,6 +12,8 @@ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpoin
|
|
|
12
12
|
* two differ, and there `event` names the envelope while `payload` names its body
|
|
13
13
|
*
|
|
14
14
|
* .note = the wrapper keeps the caller's `context` ambient (env.access lives there)
|
|
15
|
+
* .note = `options.refusal` is the same opt `askLambdaEndpoint` takes, so a call through the
|
|
16
|
+
* generated sdk can pass a peer refusal through as a `ConstraintError` (sdk-aws-lambda#77)
|
|
15
17
|
*/
|
|
16
18
|
export declare const asMechanismFnSource: (input: {
|
|
17
19
|
service: string;
|
|
@@ -15,6 +15,8 @@ const getTypescriptFromJsonSchema_1 = require("./getTypescriptFromJsonSchema");
|
|
|
15
15
|
* two differ, and there `event` names the envelope while `payload` names its body
|
|
16
16
|
*
|
|
17
17
|
* .note = the wrapper keeps the caller's `context` ambient (env.access lives there)
|
|
18
|
+
* .note = `options.refusal` is the same opt `askLambdaEndpoint` takes, so a call through the
|
|
19
|
+
* generated sdk can pass a peer refusal through as a `ConstraintError` (sdk-aws-lambda#77)
|
|
18
20
|
*/
|
|
19
21
|
const asMechanismFnSource = (input) => {
|
|
20
22
|
// the typed shapes for this endpoint's event (input) and result (output)
|
|
@@ -26,16 +28,18 @@ const asMechanismFnSource = (input) => {
|
|
|
26
28
|
schema: input.schema.output,
|
|
27
29
|
dobjRefs: input.dobjRefs,
|
|
28
30
|
});
|
|
29
|
-
// the fn: passes which + event to askLambdaEndpoint, threads
|
|
30
|
-
// the explicit <event, result> generics make the call
|
|
31
|
-
// sees the contract at the call site, not only via the
|
|
31
|
+
// the fn: passes which + event + the refusal opt to askLambdaEndpoint, threads
|
|
32
|
+
// context through. the explicit <event, result> generics make the call
|
|
33
|
+
// self-evident — a reader sees the contract at the call site, not only via the
|
|
34
|
+
// outer annotation
|
|
32
35
|
return [
|
|
33
36
|
` ${input.function}: (`,
|
|
34
37
|
` event: ${eventType},`,
|
|
35
38
|
` context: ContextAwsLambdaCaller,`,
|
|
39
|
+
` options?: { refusal?: LambdaEndpointRefusal },`,
|
|
36
40
|
` ): Promise<${resultType}> =>`,
|
|
37
41
|
` askLambdaEndpoint<${eventType}, ${resultType}>(`,
|
|
38
|
-
` { which: { service: ${JSON.stringify(input.service)}, function: ${JSON.stringify(input.function)} }, event },`,
|
|
42
|
+
` { which: { service: ${JSON.stringify(input.service)}, function: ${JSON.stringify(input.function)} }, event, refusal: options?.refusal },`,
|
|
39
43
|
` context,`,
|
|
40
44
|
` ),`,
|
|
41
45
|
].join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asMechanismFnSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.ts"],"names":[],"mappings":";;;AACA,+EAA4E;AAE5E
|
|
1
|
+
{"version":3,"file":"asMechanismFnSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.ts"],"names":[],"mappings":";;;AACA,+EAA4E;AAE5E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAKnC,EAAU,EAAE;IACX,yEAAyE;IACzE,MAAM,SAAS,GAAG,IAAA,yDAA2B,EAAC;QAC5C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;QAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAA,yDAA2B,EAAC;QAC7C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,+EAA+E;IAC/E,uEAAuE;IACvE,+EAA+E;IAC/E,mBAAmB;IACnB,OAAO;QACL,KAAK,KAAK,CAAC,QAAQ,KAAK;QACxB,cAAc,SAAS,GAAG;QAC1B,sCAAsC;QACtC,oDAAoD;QACpD,gBAAgB,UAAU,MAAM;QAChC,yBAAyB,SAAS,KAAK,UAAU,IAAI;QACrD,6BAA6B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,yCAAyC;QAChJ,gBAAgB;QAChB,QAAQ;KACT,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AA/BW,QAAA,mBAAmB,uBA+B9B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConstraintError } from 'helpful-errors';
|
|
2
|
+
import type { LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
|
|
3
|
+
import { LambdaEndpointRefusedError, type LambdaEndpointRefusedErrorMetadata } from '../../../domain.objects/LambdaEndpointRefusedError';
|
|
4
|
+
/**
|
|
5
|
+
* .what = casts a peer endpoint's refusal into the error its caller throws
|
|
6
|
+
* .why = a peer's caller fault names a fault in the request this caller composed, so by default
|
|
7
|
+
* it is this caller's malfunction (`LambdaEndpointRefusedError`). a caller that forwards
|
|
8
|
+
* its own caller's input verbatim names `ConstraintError`, and gets today's class, with
|
|
9
|
+
* today's message and metadata, byte for byte
|
|
10
|
+
*
|
|
11
|
+
* .note = the refusal's message names the fix, since its metadata shape has no `hint` field and
|
|
12
|
+
* a human reads the message first (rule.require.errors-name-the-fix)
|
|
13
|
+
* .note = shared by both ask roads — the invoke hydration and the http one — so one vocabulary
|
|
14
|
+
* serves either (rule.require.consistent-variant-contracts)
|
|
15
|
+
*/
|
|
16
|
+
export declare const asErrorFromPeerRefusal: (input: {
|
|
17
|
+
refusal: LambdaEndpointRefusal;
|
|
18
|
+
peer: string;
|
|
19
|
+
message: string;
|
|
20
|
+
errorType: string;
|
|
21
|
+
metadata: LambdaEndpointRefusedErrorMetadata;
|
|
22
|
+
}) => ConstraintError | LambdaEndpointRefusedError;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asErrorFromPeerRefusal = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const LambdaEndpointRefusedError_1 = require("../../../domain.objects/LambdaEndpointRefusedError");
|
|
6
|
+
/**
|
|
7
|
+
* .what = casts a peer endpoint's refusal into the error its caller throws
|
|
8
|
+
* .why = a peer's caller fault names a fault in the request this caller composed, so by default
|
|
9
|
+
* it is this caller's malfunction (`LambdaEndpointRefusedError`). a caller that forwards
|
|
10
|
+
* its own caller's input verbatim names `ConstraintError`, and gets today's class, with
|
|
11
|
+
* today's message and metadata, byte for byte
|
|
12
|
+
*
|
|
13
|
+
* .note = the refusal's message names the fix, since its metadata shape has no `hint` field and
|
|
14
|
+
* a human reads the message first (rule.require.errors-name-the-fix)
|
|
15
|
+
* .note = shared by both ask roads — the invoke hydration and the http one — so one vocabulary
|
|
16
|
+
* serves either (rule.require.consistent-variant-contracts)
|
|
17
|
+
*/
|
|
18
|
+
const asErrorFromPeerRefusal = (input) => {
|
|
19
|
+
// pass-through: the caller declared the request its own caller's, so the fault stays a caller fault
|
|
20
|
+
if (input.refusal.as === 'ConstraintError')
|
|
21
|
+
return new helpful_errors_1.ConstraintError(input.message, input.metadata);
|
|
22
|
+
// default: the caller composed the request, so the fault is the caller's own malfunction
|
|
23
|
+
if (input.refusal.as === 'LambdaEndpointRefusedError')
|
|
24
|
+
return new LambdaEndpointRefusedError_1.LambdaEndpointRefusedError(
|
|
25
|
+
// the fix stands in its own paragraph, so a log reader finds it apart from the peer's json
|
|
26
|
+
`${input.peer} refused the request: ${input.message}\n\nthis caller composed the request. if it forwards its own caller's input verbatim, opt in with refusal: { as: 'ConstraintError' }`, { ...input.metadata, errorType: input.errorType });
|
|
27
|
+
// a third opt added to the union fails to compile here, never falls through to a wrong class
|
|
28
|
+
const refusalUnknown = input.refusal.as;
|
|
29
|
+
return helpful_errors_1.UnexpectedCodePathError.throw('refusal opt has no cast', {
|
|
30
|
+
refusal: refusalUnknown,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.asErrorFromPeerRefusal = asErrorFromPeerRefusal;
|
|
34
|
+
//# sourceMappingURL=asErrorFromPeerRefusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asErrorFromPeerRefusal.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAG1E,mGAG4D;AAE5D;;;;;;;;;;;GAWG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAMtC,EAAgD,EAAE;IACjD,oGAAoG;IACpG,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,iBAAiB;QACxC,OAAO,IAAI,gCAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE5D,yFAAyF;IACzF,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,4BAA4B;QACnD,OAAO,IAAI,uDAA0B;QACnC,2FAA2F;QAC3F,GAAG,KAAK,CAAC,IAAI,yBAAyB,KAAK,CAAC,OAAO,sIAAsI,EACzL,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAClD,CAAC;IAEJ,6FAA6F;IAC7F,MAAM,cAAc,GAAU,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/C,OAAO,wCAAuB,CAAC,KAAK,CAAC,yBAAyB,EAAE;QAC9D,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,sBAAsB,0BAwBjC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type LambdaEventSchemaSource } from '../../../domain.objects/LambdaEventSchemaSource';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the event source a schema declares, or null for a schema that declares none
|
|
4
|
+
* .why = every schema not built by `asLambdaEventSchema.*` declares none, and its refusals keep
|
|
5
|
+
* `forAsk`'s debug-only log
|
|
6
|
+
*
|
|
7
|
+
* .note = a zod clone (`.refine()`, `.describe()`, `.meta()`) carries no own mark, but points at
|
|
8
|
+
* the schema it was cloned from via `_zod.parent`; the read follows that chain, as zod's
|
|
9
|
+
* own registries do for metadata
|
|
10
|
+
* .note = the mark may come from another copy of this package (`Symbol.for`), so it is read,
|
|
11
|
+
* never assumed: only a known source name is accepted, and the record is rebuilt from it
|
|
12
|
+
*/
|
|
13
|
+
export declare const getOneLambdaEventSchemaSource: (input: {
|
|
14
|
+
schema: unknown;
|
|
15
|
+
}) => LambdaEventSchemaSource | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOneLambdaEventSchemaSource = void 0;
|
|
4
|
+
const LambdaEventSchemaSource_1 = require("../../../domain.objects/LambdaEventSchemaSource");
|
|
5
|
+
const setLambdaEventSchemaSource_1 = require("./setLambdaEventSchemaSource");
|
|
6
|
+
/**
|
|
7
|
+
* .what = the event source a schema declares, or null for a schema that declares none
|
|
8
|
+
* .why = every schema not built by `asLambdaEventSchema.*` declares none, and its refusals keep
|
|
9
|
+
* `forAsk`'s debug-only log
|
|
10
|
+
*
|
|
11
|
+
* .note = a zod clone (`.refine()`, `.describe()`, `.meta()`) carries no own mark, but points at
|
|
12
|
+
* the schema it was cloned from via `_zod.parent`; the read follows that chain, as zod's
|
|
13
|
+
* own registries do for metadata
|
|
14
|
+
* .note = the mark may come from another copy of this package (`Symbol.for`), so it is read,
|
|
15
|
+
* never assumed: only a known source name is accepted, and the record is rebuilt from it
|
|
16
|
+
*/
|
|
17
|
+
const getOneLambdaEventSchemaSource = (input) => {
|
|
18
|
+
// a value that is no object declares no source
|
|
19
|
+
if (!isObjectNonNull(input.schema))
|
|
20
|
+
return null;
|
|
21
|
+
// a schema that holds its own mark declares the source the mark names, if known
|
|
22
|
+
const mark = Reflect.get(input.schema, setLambdaEventSchemaSource_1.LAMBDA_EVENT_SCHEMA_SOURCE);
|
|
23
|
+
if (isObjectNonNull(mark)) {
|
|
24
|
+
const name = Reflect.get(mark, 'name');
|
|
25
|
+
return isLambdaEventSchemaSourceName(name) ? { name } : null;
|
|
26
|
+
}
|
|
27
|
+
// else read the schema it was cloned from, if any
|
|
28
|
+
return (0, exports.getOneLambdaEventSchemaSource)({
|
|
29
|
+
schema: getParentOfZodClone({ schema: input.schema }),
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.getOneLambdaEventSchemaSource = getOneLambdaEventSchemaSource;
|
|
33
|
+
/**
|
|
34
|
+
* .what = the schema a zod clone was made from, or null for a schema that is no clone
|
|
35
|
+
*/
|
|
36
|
+
const getParentOfZodClone = (input) => {
|
|
37
|
+
const internals = Reflect.get(input.schema, '_zod');
|
|
38
|
+
if (!isObjectNonNull(internals))
|
|
39
|
+
return null;
|
|
40
|
+
return Reflect.get(internals, 'parent') ?? null;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* .what = whether a value is an object one can read a key off
|
|
44
|
+
*/
|
|
45
|
+
const isObjectNonNull = (value) => typeof value === 'object' && value !== null;
|
|
46
|
+
/**
|
|
47
|
+
* .what = whether a value names a source this sdk builds a schema for
|
|
48
|
+
*/
|
|
49
|
+
const isLambdaEventSchemaSourceName = (name) => LambdaEventSchemaSource_1.LAMBDA_EVENT_SCHEMA_SOURCE_NAMES.some((known) => known === name);
|
|
50
|
+
//# sourceMappingURL=getOneLambdaEventSchemaSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOneLambdaEventSchemaSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.ts"],"names":[],"mappings":";;;AAAA,6FAIyD;AACzD,6EAA0E;AAE1E;;;;;;;;;;GAUG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAE7C,EAAkC,EAAE;IACnC,+CAA+C;IAC/C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAEhD,gFAAgF;IAChF,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,uDAA0B,CAAC,CAAC;IAC5E,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/D,CAAC;IAED,kDAAkD;IAClD,OAAO,IAAA,qCAA6B,EAAC;QACnC,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC;AACL,CAAC,CAAC;AAjBW,QAAA,6BAA6B,iCAiBxC;AAEF;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,KAAyB,EAAW,EAAE;IACjE,MAAM,SAAS,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7D,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC;AAClD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC1D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAM,6BAA6B,GAAG,CACpC,IAAa,EACwB,EAAE,CACvC,0DAAgC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { LambdaEventSchemaSource } from '../../../domain.objects/LambdaEventSchemaSource';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the mark an `asLambdaEventSchema.*` builder leaves on the schema it returns
|
|
4
|
+
* .why = the same shape as `HANDLER_TRAIL_CARRIER` (`setHandlerTrailCarrier`): the reader holds
|
|
5
|
+
* the object, so it reads the fact off the object
|
|
6
|
+
*
|
|
7
|
+
* .note = `Symbol.for`, so two copies of this package in one process still agree on the mark — a
|
|
8
|
+
* schema built by one copy still warns when another copy's `forAsk` validates it
|
|
9
|
+
* .note = a clone zod makes of the schema (`.refine()`, `.describe()`, `.meta()`) points back at
|
|
10
|
+
* it via `_zod.parent`, which the reader follows, as zod's own registries do. a schema
|
|
11
|
+
* that WRAPS it (`.optional()`, a union) is a new schema with no parent, so it carries no
|
|
12
|
+
* mark; its refusals log as any other `forAsk` caller's do
|
|
13
|
+
*/
|
|
14
|
+
export declare const LAMBDA_EVENT_SCHEMA_SOURCE: unique symbol;
|
|
15
|
+
/**
|
|
16
|
+
* .what = declares the event source a schema validates, and returns the same schema
|
|
17
|
+
* .why = each `asLambdaEventSchema.*` builder stamps its schema here, so `forAsk` can tell an
|
|
18
|
+
* aws-delivered event's refusal (warn) from a direct caller's (debug)
|
|
19
|
+
*
|
|
20
|
+
* .note = non-enumerable, so it appears in no spread, no snapshot, and no introspection render
|
|
21
|
+
* (zod `.meta()` would publish it into the json schema)
|
|
22
|
+
* .note = DELIBERATE MUTATION — of the fresh schema the builder just made, never of a caller's
|
|
23
|
+
*/
|
|
24
|
+
export declare const setLambdaEventSchemaSource: <TSchema extends object>(input: {
|
|
25
|
+
schema: TSchema;
|
|
26
|
+
source: LambdaEventSchemaSource;
|
|
27
|
+
}) => TSchema;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLambdaEventSchemaSource = exports.LAMBDA_EVENT_SCHEMA_SOURCE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the mark an `asLambdaEventSchema.*` builder leaves on the schema it returns
|
|
6
|
+
* .why = the same shape as `HANDLER_TRAIL_CARRIER` (`setHandlerTrailCarrier`): the reader holds
|
|
7
|
+
* the object, so it reads the fact off the object
|
|
8
|
+
*
|
|
9
|
+
* .note = `Symbol.for`, so two copies of this package in one process still agree on the mark — a
|
|
10
|
+
* schema built by one copy still warns when another copy's `forAsk` validates it
|
|
11
|
+
* .note = a clone zod makes of the schema (`.refine()`, `.describe()`, `.meta()`) points back at
|
|
12
|
+
* it via `_zod.parent`, which the reader follows, as zod's own registries do. a schema
|
|
13
|
+
* that WRAPS it (`.optional()`, a union) is a new schema with no parent, so it carries no
|
|
14
|
+
* mark; its refusals log as any other `forAsk` caller's do
|
|
15
|
+
*/
|
|
16
|
+
exports.LAMBDA_EVENT_SCHEMA_SOURCE = Symbol.for('sdk-aws-lambda.lambdaEventSchema.source');
|
|
17
|
+
/**
|
|
18
|
+
* .what = declares the event source a schema validates, and returns the same schema
|
|
19
|
+
* .why = each `asLambdaEventSchema.*` builder stamps its schema here, so `forAsk` can tell an
|
|
20
|
+
* aws-delivered event's refusal (warn) from a direct caller's (debug)
|
|
21
|
+
*
|
|
22
|
+
* .note = non-enumerable, so it appears in no spread, no snapshot, and no introspection render
|
|
23
|
+
* (zod `.meta()` would publish it into the json schema)
|
|
24
|
+
* .note = DELIBERATE MUTATION — of the fresh schema the builder just made, never of a caller's
|
|
25
|
+
*/
|
|
26
|
+
const setLambdaEventSchemaSource = (input) => Object.defineProperty(input.schema, exports.LAMBDA_EVENT_SCHEMA_SOURCE, {
|
|
27
|
+
value: input.source,
|
|
28
|
+
enumerable: false,
|
|
29
|
+
});
|
|
30
|
+
exports.setLambdaEventSchemaSource = setLambdaEventSchemaSource;
|
|
31
|
+
//# sourceMappingURL=setLambdaEventSchemaSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setLambdaEventSchemaSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;GAWG;AACU,QAAA,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAClD,yCAAyC,CAC1C,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,0BAA0B,GAAG,CAAyB,KAGlE,EAAW,EAAE,CACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,kCAA0B,EAAE;IAC9D,KAAK,EAAE,KAAK,CAAC,MAAM;IACnB,UAAU,EAAE,KAAK;CAClB,CAAC,CAAC;AAPQ,QAAA,0BAA0B,8BAOlC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
|
|
2
|
+
import type { LambdaEndpointRefusal } from '../../domain.objects/LambdaEndpointRefusal';
|
|
2
3
|
/**
|
|
3
4
|
* .what = reads a lambda's raw wire response, and throws whatever fault it carries
|
|
4
5
|
* .why = this is the SERIALIZED boundary's hydration step — the one place a
|
|
@@ -12,15 +13,18 @@ import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
|
|
|
12
13
|
* | # | when | it throws |
|
|
13
14
|
* |---|---|---|
|
|
14
15
|
* | 1 | the payload is absent or is not json | `LambdaEndpointError` |
|
|
15
|
-
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | `
|
|
16
|
-
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | `
|
|
16
|
+
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | the `refusal` class when `class` is `ConstraintError`; else `LambdaEndpointError` |
|
|
17
|
+
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | the `refusal` class when `errorType` is `ConstraintError` **or** `BadRequestError`; else `LambdaEndpointError` |
|
|
17
18
|
* | 4 | aws reported a `functionError` and no shape above matched | `LambdaEndpointError`, with the payload in `details` |
|
|
18
19
|
* | 5 | none of the above | returns the payload as `TResponse` |
|
|
19
20
|
*
|
|
20
21
|
* ⚠️ **rows 2 and 3 split on the same question and answer it differently**, which
|
|
21
22
|
* is deliberate: a caller's bad request is not a lambda failure, so it
|
|
22
|
-
* hydrates to `
|
|
23
|
-
* (`invariant.badrequesterror-not-lambda-error`). the
|
|
23
|
+
* hydrates to the `refusal` class rather than to an invocation error
|
|
24
|
+
* (`invariant.badrequesterror-not-lambda-error`). the `refusal` class is
|
|
25
|
+
* `LambdaEndpointRefusedError` on an ask road — the asker composed the request,
|
|
26
|
+
* so the refusal is its own malfunction — and `ConstraintError` where the caller
|
|
27
|
+
* opted in, or is the test author (`onSerialized`). the ancient arm accepts
|
|
24
28
|
* `BadRequestError` too, because that is the name the legacy family emits for
|
|
25
29
|
* the same fact (`invariant.ancient-vs-contemp-callers`).
|
|
26
30
|
*
|
|
@@ -42,4 +46,11 @@ export declare const getParsedResponse: <TResponse>(input: {
|
|
|
42
46
|
functionError: string | undefined;
|
|
43
47
|
endpoint: LambdaEndpoint;
|
|
44
48
|
exid: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* .what = the class a peer's caller fault becomes
|
|
51
|
+
* .why = an ask road's caller composed the request, so its default is
|
|
52
|
+
* `LambdaEndpointRefusedError`; `runLambdaEndpoint.onSerialized`'s caller IS the party
|
|
53
|
+
* at fault, so it names `ConstraintError`
|
|
54
|
+
*/
|
|
55
|
+
refusal: LambdaEndpointRefusal;
|
|
45
56
|
}) => TResponse;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getParsedResponse = void 0;
|
|
4
|
-
const helpful_errors_1 = require("helpful-errors");
|
|
5
4
|
const LambdaEndpointError_1 = require("../../domain.objects/LambdaEndpointError");
|
|
5
|
+
const asErrorFromPeerRefusal_1 = require("./error/asErrorFromPeerRefusal");
|
|
6
6
|
const getIsLambdaErrorResponse_1 = require("./error/getIsLambdaErrorResponse");
|
|
7
7
|
const getLambdaErrorMetadata_1 = require("./error/getLambdaErrorMetadata");
|
|
8
8
|
const getStackTraceString_1 = require("./error/getStackTraceString");
|
|
@@ -22,15 +22,18 @@ const getParsedJson_1 = require("./serde/getParsedJson");
|
|
|
22
22
|
* | # | when | it throws |
|
|
23
23
|
* |---|---|---|
|
|
24
24
|
* | 1 | the payload is absent or is not json | `LambdaEndpointError` |
|
|
25
|
-
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | `
|
|
26
|
-
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | `
|
|
25
|
+
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | the `refusal` class when `class` is `ConstraintError`; else `LambdaEndpointError` |
|
|
26
|
+
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | the `refusal` class when `errorType` is `ConstraintError` **or** `BadRequestError`; else `LambdaEndpointError` |
|
|
27
27
|
* | 4 | aws reported a `functionError` and no shape above matched | `LambdaEndpointError`, with the payload in `details` |
|
|
28
28
|
* | 5 | none of the above | returns the payload as `TResponse` |
|
|
29
29
|
*
|
|
30
30
|
* ⚠️ **rows 2 and 3 split on the same question and answer it differently**, which
|
|
31
31
|
* is deliberate: a caller's bad request is not a lambda failure, so it
|
|
32
|
-
* hydrates to `
|
|
33
|
-
* (`invariant.badrequesterror-not-lambda-error`). the
|
|
32
|
+
* hydrates to the `refusal` class rather than to an invocation error
|
|
33
|
+
* (`invariant.badrequesterror-not-lambda-error`). the `refusal` class is
|
|
34
|
+
* `LambdaEndpointRefusedError` on an ask road — the asker composed the request,
|
|
35
|
+
* so the refusal is its own malfunction — and `ConstraintError` where the caller
|
|
36
|
+
* opted in, or is the test author (`onSerialized`). the ancient arm accepts
|
|
34
37
|
* `BadRequestError` too, because that is the name the legacy family emits for
|
|
35
38
|
* the same fact (`invariant.ancient-vs-contemp-callers`).
|
|
36
39
|
*
|
|
@@ -70,15 +73,21 @@ const getParsedResponse = (input) => {
|
|
|
70
73
|
// detect contemp error response (preferred, check first)
|
|
71
74
|
if ((0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(parsed)) {
|
|
72
75
|
const err = parsed.error;
|
|
73
|
-
// ConstraintError =
|
|
76
|
+
// ConstraintError = the peer refused the request (lambda succeeded); the caller's opt names the class
|
|
74
77
|
if (err.class === 'ConstraintError') {
|
|
75
78
|
// strip prefix to avoid double prefix (handler already prefixed the message)
|
|
76
79
|
const message = (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({ message: err.message });
|
|
77
|
-
throw
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
throw (0, asErrorFromPeerRefusal_1.asErrorFromPeerRefusal)({
|
|
81
|
+
refusal: input.refusal,
|
|
82
|
+
peer: input.endpoint.slug,
|
|
83
|
+
message,
|
|
84
|
+
errorType: err.class,
|
|
85
|
+
metadata: {
|
|
86
|
+
endpoint: input.endpoint,
|
|
87
|
+
exid: input.exid,
|
|
88
|
+
causeMessage: err.cause,
|
|
89
|
+
details: err.details,
|
|
90
|
+
},
|
|
82
91
|
});
|
|
83
92
|
}
|
|
84
93
|
// all other error classes = lambda invocation error
|
|
@@ -94,7 +103,7 @@ const getParsedResponse = (input) => {
|
|
|
94
103
|
if ((0, getIsLambdaErrorResponse_1.getIsAncientErrorResponse)(parsed)) {
|
|
95
104
|
const stackTrace = (0, getStackTraceString_1.getStackTraceString)({ stackTrace: parsed.stackTrace });
|
|
96
105
|
const errorMeta = (0, getLambdaErrorMetadata_1.getLambdaErrorMetadata)({ errorResponse: parsed });
|
|
97
|
-
// ConstraintError/BadRequestError =
|
|
106
|
+
// ConstraintError/BadRequestError = the peer refused the request (lambda succeeded)
|
|
98
107
|
// .note = check both for backwards compat with handlers that use old error types
|
|
99
108
|
if (parsed.errorType === 'ConstraintError' ||
|
|
100
109
|
parsed.errorType === 'BadRequestError') {
|
|
@@ -102,11 +111,17 @@ const getParsedResponse = (input) => {
|
|
|
102
111
|
const message = (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({
|
|
103
112
|
message: parsed.errorMessage,
|
|
104
113
|
});
|
|
105
|
-
throw
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
throw (0, asErrorFromPeerRefusal_1.asErrorFromPeerRefusal)({
|
|
115
|
+
refusal: input.refusal,
|
|
116
|
+
peer: input.endpoint.slug,
|
|
117
|
+
message,
|
|
118
|
+
errorType: parsed.errorType,
|
|
119
|
+
metadata: {
|
|
120
|
+
endpoint: input.endpoint,
|
|
121
|
+
exid: input.exid,
|
|
122
|
+
stackTrace,
|
|
123
|
+
...errorMeta,
|
|
124
|
+
},
|
|
110
125
|
});
|
|
111
126
|
}
|
|
112
127
|
// all other error types = lambda invocation error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParsedResponse.js","sourceRoot":"","sources":["../../../src/domain.operations/lambdaEndpointWire/getParsedResponse.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getParsedResponse.js","sourceRoot":"","sources":["../../../src/domain.operations/lambdaEndpointWire/getParsedResponse.ts"],"names":[],"mappings":";;;AACA,kFAA+E;AAE/E,2EAAwE;AACxE,+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,QAAQ,CAAC,IAAI;gBACzB,OAAO;gBACP,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE;oBACR,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,UAAU;oBACV,GAAG,SAAS;iBACb;aACF,CAAC,CAAC;QACL,CAAC;QAED,kDAAkD;QAClD,MAAM,IAAI,yCAAmB,CAAC,MAAM,CAAC,YAAY,EAAE;YACjD,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU;YACV,GAAG,SAAS;SACb,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,IAAI,KAAK,CAAC,aAAa;QACrB,MAAM,IAAI,yCAAmB;QAC3B,0EAA0E;QAC1E,0EAA0E;QAC1E,mEAAmE;QACnE,4IAA4I,EAC5I;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,aAAa;YAC9B,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC7B,CACF,CAAC;IAEJ;;;;;OAKG;IACH,OAAO,MAAmB,CAAC;AAC7B,CAAC,CAAC;AA/JW,QAAA,iBAAiB,qBA+J5B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onSerialized = void 0;
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const LambdaEndpointRefusal_1 = require("../../domain.objects/LambdaEndpointRefusal");
|
|
5
6
|
const askLambdaEndpoint_1 = require("../askLambdaEndpoint/askLambdaEndpoint");
|
|
6
7
|
const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
|
|
7
8
|
const getOneTrailExid_1 = require("../lambdaEndpointWire/context/getOneTrailExid");
|
|
@@ -17,6 +18,14 @@ const runLambdaEndpoint_onReferenced_1 = require("./runLambdaEndpoint.onReferenc
|
|
|
17
18
|
const asCarriedPayload_1 = require("./serde/asCarriedPayload");
|
|
18
19
|
const asWireFunctionErrorPayload_1 = require("./serde/asWireFunctionErrorPayload");
|
|
19
20
|
const asWirePayload_1 = require("./serde/asWirePayload");
|
|
21
|
+
/**
|
|
22
|
+
* .what = a refusal reaches the runner as a `ConstraintError`, on both loci
|
|
23
|
+
* .why = the runner composed the event itself, so no peer stands between it and the handler:
|
|
24
|
+
* the fault truly is the runner's to fix. `askLambdaEndpoint`'s default
|
|
25
|
+
* (`LambdaEndpointRefusedError`) states the opposite, for a caller that composed a request
|
|
26
|
+
* on its OWN caller's behalf
|
|
27
|
+
*/
|
|
28
|
+
const REFUSAL_OF_RUN = LambdaEndpointRefusal_1.REFUSAL_PASSTHROUGH;
|
|
20
29
|
/**
|
|
21
30
|
* .what = runs a lambda endpoint you hold the SLUG of — `{ service, function }`
|
|
22
31
|
* plus the ambient access
|
|
@@ -147,6 +156,7 @@ const onSerialized = async (input, context) => {
|
|
|
147
156
|
carrier,
|
|
148
157
|
}),
|
|
149
158
|
struct: { payload: 'ancient' },
|
|
159
|
+
refusal: REFUSAL_OF_RUN,
|
|
150
160
|
}, {
|
|
151
161
|
...context,
|
|
152
162
|
log: {
|
|
@@ -159,6 +169,7 @@ const onSerialized = async (input, context) => {
|
|
|
159
169
|
which: input.which,
|
|
160
170
|
event: input.event,
|
|
161
171
|
struct: structValidated,
|
|
172
|
+
refusal: REFUSAL_OF_RUN,
|
|
162
173
|
}, context).catch(asCredentialsFault);
|
|
163
174
|
}
|
|
164
175
|
// the local locus: look the handler up, run it, then hydrate exactly as the wire does
|
|
@@ -206,6 +217,7 @@ const onSerialized = async (input, context) => {
|
|
|
206
217
|
functionError: undefined,
|
|
207
218
|
endpoint,
|
|
208
219
|
exid,
|
|
220
|
+
refusal: REFUSAL_OF_RUN,
|
|
209
221
|
});
|
|
210
222
|
};
|
|
211
223
|
exports.onSerialized = onSerialized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runLambdaEndpoint.onSerialized.js","sourceRoot":"","sources":["../../../src/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD,8EAA2E;AAC3E,2EAAwE;AACxE,mFAAgF;AAChF,iGAA8F;AAC9F,qGAAkG;AAClG,+EAA4E;AAC5E,+EAA4E;AAE5E,mEAAgE;AAChE,6EAA0E;AAC1E,mEAAgE;AAChE,2FAAwF;AACxF,qFAAgE;AAChE,+DAA4D;AAC5D,mFAAgF;AAChF,yDAAsD;AAWtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,KAiCC,EACD,OAA+B,EACE,EAAE;IACnC,gFAAgF;IAChF,yEAAyE;IACzE,iFAAiF;IACjF,IAAA,uCAAkB,EAAC;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,OAAO,EAAE;KAC1D,CAAC,CAAC;IAEH,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,OAAO,CAAC;IAE/B,+EAA+E;IAC/E,4EAA4E;IAC5E,+EAA+E;IAC/E,0EAA0E;IAC1E,0DAA0D;IAC1D,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,OAAO;QAClC,OAAO,gCAAe,CAAC,KAAK,CAC1B,8CAA8C,EAC9C;YACE,EAAE;YACF,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;YAC3B,IAAI,EAAE,uLAAuL;SAC9L,CACF,CAAC;IAEJ,+EAA+E;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,KAAK,EAAE,IAAA,mCAAgB,EAAC;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,KAAK,EAAE,EAAE,IAAI,EAAE;oBACf,OAAO,EAAE,gBAAgB;oBACzB,OAAO;iBACR,CAAC;gBACF,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"runLambdaEndpoint.onSerialized.js","sourceRoot":"","sources":["../../../src/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD,sFAGoD;AACpD,8EAA2E;AAC3E,2EAAwE;AACxE,mFAAgF;AAChF,iGAA8F;AAC9F,qGAAkG;AAClG,+EAA4E;AAC5E,+EAA4E;AAE5E,mEAAgE;AAChE,6EAA0E;AAC1E,mEAAgE;AAChE,2FAAwF;AACxF,qFAAgE;AAChE,+DAA4D;AAC5D,mFAAgF;AAChF,yDAAsD;AAWtD;;;;;;GAMG;AACH,MAAM,cAAc,GAA0B,2CAAmB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,KAiCC,EACD,OAA+B,EACE,EAAE;IACnC,gFAAgF;IAChF,yEAAyE;IACzE,iFAAiF;IACjF,IAAA,uCAAkB,EAAC;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,OAAO,EAAE;KAC1D,CAAC,CAAC;IAEH,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,OAAO,CAAC;IAE/B,+EAA+E;IAC/E,4EAA4E;IAC5E,+EAA+E;IAC/E,0EAA0E;IAC1E,0DAA0D;IAC1D,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,OAAO;QAClC,OAAO,g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AAK,CAAC,QAAQ;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;IAEH,6EAA6E;IAC7E,4EAA4E;IAC5E,+EAA+E;IAC/E,yDAAyD;IACzD,IAAA,iDAAuB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAErC,0EAA0E;IAC1E,iEAAiE;IACjE,MAAM,IAAI,GAAG,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEnD,+EAA+E;IAC/E,uDAAuD;IACvD,yCAAyC;IACzC,2EAA2E;IAC3E,6EAA6E;IAC7E,MAAM,MAAM,GAAG,MAAM,IAAA,6CAAY,EAAC;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO;QACP,MAAM,EAAE,eAAe;QAEvB,6EAA6E;QAC7E,4EAA4E;QAC5E,OAAO,EAAE,IAAA,uCAAkB,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAErE,uEAAuE;QACvE,6EAA6E;QAC7E,kDAAkD;QAClD,0EAA0E;QAC1E,KAAK,EAAE,EAAE,IAAI,EAAE;KAChB,CAAC,CAAC,KAAK,CAAC,uDAA0B,CAAC,CAAC;IAErC,2EAA2E;IAC3E,8EAA8E;IAC9E,yDAAyD;IACzD,OAAO,IAAA,qCAAiB,EAAyB;QAC/C,OAAO,EAAE,IAAA,6BAAa,EAAC,MAAM,CAAC;QAC9B,aAAa,EAAE,SAAS;QACxB,QAAQ;QACR,IAAI;QACJ,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AA1MW,QAAA,YAAY,gBA0MvB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export { LambdaDomainObjectRefUnbindableError } from './domain.objects/LambdaDom
|
|
|
35
35
|
export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
|
|
36
36
|
export type { LambdaEndpointDialect } from './domain.objects/LambdaEndpointDialect';
|
|
37
37
|
export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
|
|
38
|
+
/**
|
|
39
|
+
* .what = a peer's refusal of a request this caller composed, and the opt that names its class
|
|
40
|
+
* .why = `askLambdaEndpoint` throws it by default for a peer's caller fault, so a consumer must be
|
|
41
|
+
* able to catch it by class and to name the opt it passes
|
|
42
|
+
*/
|
|
43
|
+
export type { LambdaEndpointRefusal } from './domain.objects/LambdaEndpointRefusal';
|
|
44
|
+
export { LambdaEndpointRefusedError } from './domain.objects/LambdaEndpointRefusedError';
|
|
38
45
|
export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
|
|
39
46
|
export { LambdaFunctionNotFoundError } from './domain.objects/LambdaFunctionNotFoundError';
|
|
40
47
|
export { LambdaIntrospectionBlockedError } from './domain.objects/LambdaIntrospectionBlockedError';
|
|
@@ -46,6 +53,14 @@ export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/a
|
|
|
46
53
|
export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
|
|
47
54
|
export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
|
|
48
55
|
export { asLambdaEvent } from './domain.operations/asLambdaEvent/asLambdaEvent';
|
|
56
|
+
/**
|
|
57
|
+
* .what = the validate direction of the event source axis — `{ fromSns, fromKinesis }`
|
|
58
|
+
* .why = an sns or kinesis handler wired via `genLambdaEndpoint.forAsk` gets a validated
|
|
59
|
+
* envelope and a typed payload. sqs is served by `genLambdaEndpoint.forSqs`
|
|
60
|
+
*/
|
|
61
|
+
export { asLambdaEventSchema } from './domain.operations/asLambdaEventSchema/asLambdaEventSchema';
|
|
62
|
+
export type { KinesisStreamEventDecoded } from './domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded';
|
|
63
|
+
export type { SnsEventDecoded } from './domain.operations/asLambdaEventSchema/SnsEventDecoded';
|
|
49
64
|
/**
|
|
50
65
|
* .what = the `genLambdaEndpoint` family —
|
|
51
66
|
* `{ forAsk, forApiGateway, forSqs: { perRecord, perBatch } }`
|