sdk-aws-lambda 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/cli/gen.js +18 -0
- package/dist/contract/cli/gen.js.map +1 -1
- package/dist/domain.objects/AwsIdentitySynthetic.d.ts +20 -0
- package/dist/domain.objects/AwsIdentitySynthetic.js +24 -0
- package/dist/domain.objects/AwsIdentitySynthetic.js.map +1 -0
- package/dist/domain.objects/LambdaEndpointDialect.d.ts +19 -0
- package/dist/domain.objects/LambdaEndpointDialect.js +3 -0
- package/dist/domain.objects/LambdaEndpointDialect.js.map +1 -0
- package/dist/domain.objects/LambdaEndpointErrorResponseBody.d.ts +70 -0
- package/dist/domain.objects/LambdaEndpointErrorResponseBody.js +41 -0
- package/dist/domain.objects/LambdaEndpointErrorResponseBody.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.d.ts +7 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.js +13 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.d.ts +36 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js +88 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.d.ts +81 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.d.ts +75 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js +163 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.d.ts +32 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.js +55 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.d.ts +40 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.js +71 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.d.ts +27 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.js +51 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.d.ts +35 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.js +50 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.js +59 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +2 -1
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +19 -18
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +1 -1
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +9 -7
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +6 -19
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +6 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js.map +1 -1
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +16 -35
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
- package/dist/domain.operations/lambdaEndpointWire/context/getExidFromContext.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/context/getLogForExidExtraction.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.d.ts +36 -0
- package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.js +53 -0
- package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.d.ts +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.js +32 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.d.ts +63 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.js +39 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getLambdaErrorMetadata.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/getStackTraceString.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.d.ts +54 -0
- package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.js +107 -0
- package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.js.map +1 -0
- package/dist/domain.operations/{genLambdaEndpoint/middleware → lambdaEndpointWire/frame}/getIsWrappedPayload.d.ts +6 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getIsWrappedPayload.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.d.ts +45 -0
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js +173 -0
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.d.ts +21 -0
- package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.js +33 -0
- package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/serde/getDecodedPayload.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/serde/getParsedJson.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.d.ts +24 -0
- package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js +70 -0
- package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.d.ts +67 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.js +3 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.d.ts +26 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.js +43 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.d.ts +47 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js +89 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.d.ts +73 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js +108 -0
- package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.d.ts +50 -0
- package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.js +55 -0
- package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.d.ts +56 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.js +57 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.d.ts +16 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.js +71 -0
- package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.d.ts +48 -0
- package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.js +57 -0
- package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.d.ts +18 -0
- package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js +239 -0
- package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.d.ts +82 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.js +67 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +120 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +119 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.d.ts +98 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +176 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.d.ts +41 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.js +62 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.d.ts +40 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js +68 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.d.ts +34 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.js +39 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.d.ts +25 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js +85 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/readme.md +108 -49
- package/dist/domain.operations/askLambdaEndpoint/context/getExidFromContext.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.d.ts +0 -42
- package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js +0 -21
- package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/error/getLambdaErrorMetadata.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/error/getStackTraceString.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.d.ts +0 -13
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js +0 -26
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/getDecodedPayload.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedJson.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +0 -15
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +0 -100
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsWrappedPayload.js.map +0 -1
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getExidFromContext.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getExidFromContext.js +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getLogForExidExtraction.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getLogForExidExtraction.js +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getLambdaErrorMetadata.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getLambdaErrorMetadata.js +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getStackTraceString.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getStackTraceString.js +0 -0
- /package/dist/domain.operations/{genLambdaEndpoint/middleware → lambdaEndpointWire/frame}/getIsWrappedPayload.js +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getDecodedPayload.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getDecodedPayload.js +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getParsedJson.d.ts +0 -0
- /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getParsedJson.js +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asFramedPayload = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = casts an event into the payload frame a given dialect sends
|
|
6
|
+
* .why = the endpoint reads the FRAME to decide the dialect — `getIsWrappedPayload`
|
|
7
|
+
* checks for exactly `{ event, trail }` — so the frame IS the declaration.
|
|
8
|
+
*
|
|
9
|
+
* | dialect | the frame emitted | getIsWrappedPayload |
|
|
10
|
+
* |---------|-------------------|---------------------|
|
|
11
|
+
* | contemp | `{ event, trail }` | true → contemp envelope |
|
|
12
|
+
* | ancient | the event, untouched | false → ancient envelope |
|
|
13
|
+
*
|
|
14
|
+
* 🔴 .the one knob
|
|
15
|
+
*
|
|
16
|
+
* F9 names an open bound in the vision: the frame is driven by `trail:` and the
|
|
17
|
+
* dialect is declared by `struct.payload` — **two knobs, one fact**, so they can
|
|
18
|
+
* be set to disagree, and that design admits a contemp envelope under an ancient
|
|
19
|
+
* return type.
|
|
20
|
+
*
|
|
21
|
+
* this closes it by DERIVATION: `struct.payload` is the only declaration, and the
|
|
22
|
+
* frame follows from it. `trail` supplies the exid and never the dialect. so the
|
|
23
|
+
* disagreement is unrepresentable rather than policed
|
|
24
|
+
* (rule.prefer.prevent-over-correct, rung 1).
|
|
25
|
+
*
|
|
26
|
+
* 🔴 .ancient drops the trail, exactly as the wire does
|
|
27
|
+
*
|
|
28
|
+
* `askLambdaEndpoint.ts:74-77` sends `input.event` and nothing else on the ancient
|
|
29
|
+
* dialect — the trail does not travel. this matches it verbatim.
|
|
30
|
+
*
|
|
31
|
+
* ⚠️ ancient never merges `{ ...event, trail }` for a caller that carries an exid
|
|
32
|
+
* — a shape `invariant.payload-format-compat` does describe, and that **no
|
|
33
|
+
* caller in this sdk ever sends**. that merge is backcompat nobody asked for,
|
|
34
|
+
* it makes the referenced boundary disagree with the wire, and it costs two
|
|
35
|
+
* defensive branches.
|
|
36
|
+
*/
|
|
37
|
+
const asFramedPayload = (input) => {
|
|
38
|
+
// contemp: the wrapper IS the declaration. an absent exid is legal —
|
|
39
|
+
// genTrailMiddleware generates one, exactly as it does for askLambdaEndpoint.
|
|
40
|
+
//
|
|
41
|
+
// .note = the wrapper carries the exid and NO other trail field, which is what
|
|
42
|
+
// getLambdaPayload does for the wire (`serde/getLambdaPayload.ts:9-12`). the
|
|
43
|
+
// two are not merged because that one demands an exid where this one may not
|
|
44
|
+
// have it — but they must agree on the shape they emit, and they do. forward
|
|
45
|
+
// the whole trail here and a `stack` survives at this boundary, then gets
|
|
46
|
+
// dropped by the wire.
|
|
47
|
+
//
|
|
48
|
+
// 🔴 the agreement is CLAMPED, not held by this comment alone:
|
|
49
|
+
// `lambdaEndpointWire/frame/contempFrameEmittersAgree.test.ts` asserts both
|
|
50
|
+
// emitters produce the identical frame for an exid-bearing input, so a future
|
|
51
|
+
// divergence (a new field on one and not the other) goes red.
|
|
52
|
+
if (input.dialect === 'contemp')
|
|
53
|
+
return {
|
|
54
|
+
event: input.event,
|
|
55
|
+
trail: input.trail?.exid ? { exid: input.trail.exid } : {},
|
|
56
|
+
};
|
|
57
|
+
// ancient: the event crosses untouched. no wrapper, so getIsWrappedPayload stays
|
|
58
|
+
// false and the endpoint answers in the dialect the caller declared.
|
|
59
|
+
return input.event;
|
|
60
|
+
};
|
|
61
|
+
exports.asFramedPayload = asFramedPayload;
|
|
62
|
+
//# sourceMappingURL=asFramedPayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asFramedPayload.js","sourceRoot":"","sources":["../../../../src/domain.operations/runLambdaEndpoint/serde/asFramedPayload.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACI,MAAM,eAAe,GAAG,CAAC,KAI/B,EAAW,EAAE;IACZ,qEAAqE;IACrE,8EAA8E;IAC9E,EAAE;IACF,+EAA+E;IAC/E,+EAA+E;IAC/E,+EAA+E;IAC/E,+EAA+E;IAC/E,4EAA4E;IAC5E,yBAAyB;IACzB,EAAE;IACF,+DAA+D;IAC/D,8EAA8E;IAC9E,gFAAgF;IAChF,gEAAgE;IAChE,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAC7B,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;SAC3D,CAAC;IAEJ,iFAAiF;IACjF,qEAAqE;IACrE,OAAO,KAAK,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AA5BW,QAAA,eAAe,mBA4B1B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = casts a thrown handler fault into the envelope aws puts on the wire
|
|
3
|
+
* .why = 🔴 **a THROW does not cross a wire; a payload does.** on the cloud locus
|
|
4
|
+
* aws answers `{ errorMessage, errorType, stackTrace }` and
|
|
5
|
+
* `getParsedResponse` hydrates it. the local locus runs the handler in
|
|
6
|
+
* THIS process, so without this cast its throw escapes as the handler's
|
|
7
|
+
* own class — and one malfunction arrives as two classes on the two loci,
|
|
8
|
+
* which is `at` altering the contract it exists to hold constant.
|
|
9
|
+
*
|
|
10
|
+
* ## 🔴 what this DROPS — the placement rule every guard owes
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ **the CANONICAL account; three peers cite it and none restates it** — both
|
|
13
|
+
* `guard/assert*.ts` and both `runLambdaEndpoint.on*.ts` call sites. it lives
|
|
14
|
+
* here because the rule and its cause die together.
|
|
15
|
+
*
|
|
16
|
+
* the cast carries three fields and no `metadata`, so no `hint`. ⇒ **every guard
|
|
17
|
+
* in `runLambdaEndpoint` runs AHEAD of the delegation, never inside it** — a
|
|
18
|
+
* guard that fires inside `.catch(asWireFunctionErrorPayload)` answers a
|
|
19
|
+
* local-locus caller with its fix demoted out of a structured field:
|
|
20
|
+
*
|
|
21
|
+
* | | inside the delegation | ahead of it |
|
|
22
|
+
* |---|---|---|
|
|
23
|
+
* | error class | unchanged | unchanged |
|
|
24
|
+
* | the hint TEXT | present, buried in `stackTrace` | present |
|
|
25
|
+
* | `metadata.hint` | ❌ absent | ✅ present |
|
|
26
|
+
*
|
|
27
|
+
* 🟡 the obvious alternative — preserve `metadata` when the error carries a hint
|
|
28
|
+
* — is what `[t4]` of `runLambdaEndpoint.onSerialized.integration.test.ts`
|
|
29
|
+
* forbids: aws sends no `metadata`, so a local locus that kept it would hand
|
|
30
|
+
* a richer error than cloud can produce. that is the divergence the fix was
|
|
31
|
+
* meant to remove, reintroduced.
|
|
32
|
+
*
|
|
33
|
+
* .note = a wrap-and-rethrow, never a `rule.forbid.failhide` — the fault is
|
|
34
|
+
* re-raised through the one shared hydration.
|
|
35
|
+
*/
|
|
36
|
+
export declare const asWireFunctionErrorPayload: (error: unknown) => {
|
|
37
|
+
errorMessage: string;
|
|
38
|
+
errorType: string;
|
|
39
|
+
stackTrace: string[];
|
|
40
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asWireFunctionErrorPayload = void 0;
|
|
4
|
+
const isErrorLike_1 = require("../error/isErrorLike");
|
|
5
|
+
/**
|
|
6
|
+
* .what = casts a thrown handler fault into the envelope aws puts on the wire
|
|
7
|
+
* .why = 🔴 **a THROW does not cross a wire; a payload does.** on the cloud locus
|
|
8
|
+
* aws answers `{ errorMessage, errorType, stackTrace }` and
|
|
9
|
+
* `getParsedResponse` hydrates it. the local locus runs the handler in
|
|
10
|
+
* THIS process, so without this cast its throw escapes as the handler's
|
|
11
|
+
* own class — and one malfunction arrives as two classes on the two loci,
|
|
12
|
+
* which is `at` altering the contract it exists to hold constant.
|
|
13
|
+
*
|
|
14
|
+
* ## 🔴 what this DROPS — the placement rule every guard owes
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ **the CANONICAL account; three peers cite it and none restates it** — both
|
|
17
|
+
* `guard/assert*.ts` and both `runLambdaEndpoint.on*.ts` call sites. it lives
|
|
18
|
+
* here because the rule and its cause die together.
|
|
19
|
+
*
|
|
20
|
+
* the cast carries three fields and no `metadata`, so no `hint`. ⇒ **every guard
|
|
21
|
+
* in `runLambdaEndpoint` runs AHEAD of the delegation, never inside it** — a
|
|
22
|
+
* guard that fires inside `.catch(asWireFunctionErrorPayload)` answers a
|
|
23
|
+
* local-locus caller with its fix demoted out of a structured field:
|
|
24
|
+
*
|
|
25
|
+
* | | inside the delegation | ahead of it |
|
|
26
|
+
* |---|---|---|
|
|
27
|
+
* | error class | unchanged | unchanged |
|
|
28
|
+
* | the hint TEXT | present, buried in `stackTrace` | present |
|
|
29
|
+
* | `metadata.hint` | ❌ absent | ✅ present |
|
|
30
|
+
*
|
|
31
|
+
* 🟡 the obvious alternative — preserve `metadata` when the error carries a hint
|
|
32
|
+
* — is what `[t4]` of `runLambdaEndpoint.onSerialized.integration.test.ts`
|
|
33
|
+
* forbids: aws sends no `metadata`, so a local locus that kept it would hand
|
|
34
|
+
* a richer error than cloud can produce. that is the divergence the fix was
|
|
35
|
+
* meant to remove, reintroduced.
|
|
36
|
+
*
|
|
37
|
+
* .note = a wrap-and-rethrow, never a `rule.forbid.failhide` — the fault is
|
|
38
|
+
* re-raised through the one shared hydration.
|
|
39
|
+
*/
|
|
40
|
+
const asWireFunctionErrorPayload = (error) => {
|
|
41
|
+
/**
|
|
42
|
+
* .what = reads the error by duck-type, never by `instanceof Error`
|
|
43
|
+
* .why = 🔴 `instanceof` fails CROSS-REALM, and this runs where two realms
|
|
44
|
+
* meet: the local locus loads the handler through
|
|
45
|
+
* `getOneHandlerFromServerlessYml`, and jest executes each module in
|
|
46
|
+
* its own vm context.
|
|
47
|
+
*
|
|
48
|
+
* ⚠️ the miss is SILENT — it degrades the payload rather than throws:
|
|
49
|
+
* `errorMessage` gains an `Error: ` prefix, `errorType` collapses to
|
|
50
|
+
* `'Error'`, `stackTrace` is dropped. `getParsedResponse` hydrates from
|
|
51
|
+
* `errorType`, so a cross-realm `ConstraintError` comes back generic — a
|
|
52
|
+
* caller fault that no longer reads as one (`rule.forbid.failhide`).
|
|
53
|
+
*/
|
|
54
|
+
if (!(0, isErrorLike_1.isErrorLike)(error))
|
|
55
|
+
return {
|
|
56
|
+
errorMessage: String(error),
|
|
57
|
+
errorType: 'Error',
|
|
58
|
+
stackTrace: [],
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
errorMessage: error.message,
|
|
62
|
+
errorType: error.constructor?.name ?? 'Error',
|
|
63
|
+
// `stack` is optional on a real Error
|
|
64
|
+
stackTrace: typeof error.stack === 'string' ? error.stack.split('\n') : [],
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.asWireFunctionErrorPayload = asWireFunctionErrorPayload;
|
|
68
|
+
//# sourceMappingURL=asWireFunctionErrorPayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asWireFunctionErrorPayload.js","sourceRoot":"","sources":["../../../../src/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACI,MAAM,0BAA0B,GAAG,CACxC,KAAc,EACqD,EAAE;IACrE;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC;QACrB,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC;YAC3B,SAAS,EAAE,OAAO;YAClB,UAAU,EAAE,EAAE;SACf,CAAC;IAEJ,OAAO;QACL,YAAY,EAAE,KAAK,CAAC,OAAO;QAC3B,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO;QAC7C,sCAAsC;QACtC,UAAU,EAAE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;KAC3E,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,0BAA0B,8BA6BrC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = casts a handler's in-process answer into the byte payload aws puts on
|
|
3
|
+
* the wire
|
|
4
|
+
* .why = the local locus must hand `getParsedResponse` what the CLOUD locus
|
|
5
|
+
* hands it, or the two loci hydrate different things and `at` changes the
|
|
6
|
+
* contract it exists to hold constant.
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ **`?? null` is a BOUNDARY DIVERGENCE, never a defensive default.** a void
|
|
9
|
+
* handler answers `undefined` on the referenced boundary
|
|
10
|
+
* (`asWireStripped.ts:18` returns it rather than throws) and **`null`** here —
|
|
11
|
+
* because aws delivers `null` for a lambda that returns no value, so `null` is
|
|
12
|
+
* what a real caller receives.
|
|
13
|
+
*
|
|
14
|
+
* ⇒ the two boundaries genuinely disagree about a void handler's value, and
|
|
15
|
+
* each is right for its own side. it is the same asymmetry the error stance
|
|
16
|
+
* has, one level down: the referenced boundary is HOST-faithful, the
|
|
17
|
+
* serialized boundary is WIRE-faithful.
|
|
18
|
+
*
|
|
19
|
+
* 🟡 an sqs or sns consumer handler is exactly the void case, so this is a real
|
|
20
|
+
* experience rather than an edge — see `case=11`'s actor, and
|
|
21
|
+
* `define.lambda-endpoint-run-boundary` for the boundary table it belongs to.
|
|
22
|
+
*
|
|
23
|
+
* .note = named rather than inline, so the `onSerialized` orchestrator reads as
|
|
24
|
+
* narrative rather than as a stringify-with-a-fallback plus a utf-8 encode
|
|
25
|
+
* (rule.forbid.inline-decode-friction). the divergence above is the whole
|
|
26
|
+
* reason it earns a name: it is the one line where the two loci differ.
|
|
27
|
+
*
|
|
28
|
+
* .note = the `?? null` is clamped in `asWirePayload.test.ts` on three axes, and
|
|
29
|
+
* each exists because a plausible edit breaks exactly one: `[case2]` the void
|
|
30
|
+
* divergence against its referenced peer, `[case3]` that `0` / `''` / `false`
|
|
31
|
+
* are NOT void, and `[case4]` that `WireDelivered`'s declared `null` and this
|
|
32
|
+
* runtime `null` remain one fact rather than two that drifted.
|
|
33
|
+
*/
|
|
34
|
+
export declare const asWirePayload: (output: unknown) => Uint8Array;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asWirePayload = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = casts a handler's in-process answer into the byte payload aws puts on
|
|
6
|
+
* the wire
|
|
7
|
+
* .why = the local locus must hand `getParsedResponse` what the CLOUD locus
|
|
8
|
+
* hands it, or the two loci hydrate different things and `at` changes the
|
|
9
|
+
* contract it exists to hold constant.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ **`?? null` is a BOUNDARY DIVERGENCE, never a defensive default.** a void
|
|
12
|
+
* handler answers `undefined` on the referenced boundary
|
|
13
|
+
* (`asWireStripped.ts:18` returns it rather than throws) and **`null`** here —
|
|
14
|
+
* because aws delivers `null` for a lambda that returns no value, so `null` is
|
|
15
|
+
* what a real caller receives.
|
|
16
|
+
*
|
|
17
|
+
* ⇒ the two boundaries genuinely disagree about a void handler's value, and
|
|
18
|
+
* each is right for its own side. it is the same asymmetry the error stance
|
|
19
|
+
* has, one level down: the referenced boundary is HOST-faithful, the
|
|
20
|
+
* serialized boundary is WIRE-faithful.
|
|
21
|
+
*
|
|
22
|
+
* 🟡 an sqs or sns consumer handler is exactly the void case, so this is a real
|
|
23
|
+
* experience rather than an edge — see `case=11`'s actor, and
|
|
24
|
+
* `define.lambda-endpoint-run-boundary` for the boundary table it belongs to.
|
|
25
|
+
*
|
|
26
|
+
* .note = named rather than inline, so the `onSerialized` orchestrator reads as
|
|
27
|
+
* narrative rather than as a stringify-with-a-fallback plus a utf-8 encode
|
|
28
|
+
* (rule.forbid.inline-decode-friction). the divergence above is the whole
|
|
29
|
+
* reason it earns a name: it is the one line where the two loci differ.
|
|
30
|
+
*
|
|
31
|
+
* .note = the `?? null` is clamped in `asWirePayload.test.ts` on three axes, and
|
|
32
|
+
* each exists because a plausible edit breaks exactly one: `[case2]` the void
|
|
33
|
+
* divergence against its referenced peer, `[case3]` that `0` / `''` / `false`
|
|
34
|
+
* are NOT void, and `[case4]` that `WireDelivered`'s declared `null` and this
|
|
35
|
+
* runtime `null` remain one fact rather than two that drifted.
|
|
36
|
+
*/
|
|
37
|
+
const asWirePayload = (output) => new TextEncoder().encode(JSON.stringify(output ?? null));
|
|
38
|
+
exports.asWirePayload = asWirePayload;
|
|
39
|
+
//# sourceMappingURL=asWirePayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asWirePayload.js","sourceRoot":"","sources":["../../../../src/domain.operations/runLambdaEndpoint/serde/asWirePayload.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACI,MAAM,aAAa,GAAG,CAAC,MAAe,EAAc,EAAE,CAC3D,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC;AAD9C,QAAA,aAAa,iBACiC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = casts a live object into the shape a json wire would deliver
|
|
3
|
+
* .why = the referenced boundary crosses no wire, so a Date, a class instance,
|
|
4
|
+
* or an `undefined` would survive into the handler — data the serialized
|
|
5
|
+
* boundary could never deliver.
|
|
6
|
+
*
|
|
7
|
+
* this is a FIDELITY GUARD, never the boundary itself. it keeps a test on
|
|
8
|
+
* the referenced boundary from a pass that the serialized boundary would fail.
|
|
9
|
+
*
|
|
10
|
+
* .note = applied in BOTH directions. aws serializes the response too, so an
|
|
11
|
+
* input-only strip would let a test assert on an output shape the wire
|
|
12
|
+
* could never deliver — the same hole, pointed the other way.
|
|
13
|
+
*
|
|
14
|
+
* .of = which side is stripped, and it is REQUIRED because it decides who owns
|
|
15
|
+
* a refusal:
|
|
16
|
+
*
|
|
17
|
+
* | `of` | the value is | a refusal is | the class |
|
|
18
|
+
* |------|--------------|--------------|-----------|
|
|
19
|
+
* | `'event'` | what the CALLER passed | the caller's fault | `ConstraintError` |
|
|
20
|
+
* | `'output'` | what the HANDLER returned | the server's fault | `MalfunctionError` |
|
|
21
|
+
*/
|
|
22
|
+
export declare const asWireStripped: <T>(input: {
|
|
23
|
+
value: T;
|
|
24
|
+
of: 'event' | 'output';
|
|
25
|
+
}) => T;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asWireStripped = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const isErrorLike_1 = require("../error/isErrorLike");
|
|
6
|
+
/**
|
|
7
|
+
* .what = casts a live object into the shape a json wire would deliver
|
|
8
|
+
* .why = the referenced boundary crosses no wire, so a Date, a class instance,
|
|
9
|
+
* or an `undefined` would survive into the handler — data the serialized
|
|
10
|
+
* boundary could never deliver.
|
|
11
|
+
*
|
|
12
|
+
* this is a FIDELITY GUARD, never the boundary itself. it keeps a test on
|
|
13
|
+
* the referenced boundary from a pass that the serialized boundary would fail.
|
|
14
|
+
*
|
|
15
|
+
* .note = applied in BOTH directions. aws serializes the response too, so an
|
|
16
|
+
* input-only strip would let a test assert on an output shape the wire
|
|
17
|
+
* could never deliver — the same hole, pointed the other way.
|
|
18
|
+
*
|
|
19
|
+
* .of = which side is stripped, and it is REQUIRED because it decides who owns
|
|
20
|
+
* a refusal:
|
|
21
|
+
*
|
|
22
|
+
* | `of` | the value is | a refusal is | the class |
|
|
23
|
+
* |------|--------------|--------------|-----------|
|
|
24
|
+
* | `'event'` | what the CALLER passed | the caller's fault | `ConstraintError` |
|
|
25
|
+
* | `'output'` | what the HANDLER returned | the server's fault | `MalfunctionError` |
|
|
26
|
+
*/
|
|
27
|
+
const asWireStripped = (input) => {
|
|
28
|
+
/**
|
|
29
|
+
* .what = undefined has no json representation, so it is returned as-is
|
|
30
|
+
* .why = `JSON.stringify(undefined)` yields `undefined`, which `JSON.parse`
|
|
31
|
+
* then refuses. so the round trip below cannot carry this case.
|
|
32
|
+
*
|
|
33
|
+
* .as = the cast is sound rather than a shapefit dodge: `value` is typed `T`,
|
|
34
|
+
* so `value === undefined` proves `undefined` inhabits `T`. typescript
|
|
35
|
+
* cannot carry that proof out of the narrow on an unresolved generic.
|
|
36
|
+
* .removal = drops out if typescript narrows a generic by an equality check
|
|
37
|
+
*/
|
|
38
|
+
if (input.value === undefined)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
/**
|
|
42
|
+
* .as = JSON round-trip erases the type at runtime while the shape survives
|
|
43
|
+
* .removal = if typescript gains a JsonOf<T> mapped type, narrow the return
|
|
44
|
+
*/
|
|
45
|
+
return JSON.parse(JSON.stringify(input.value));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
// 🔴 the THROW is correct — aws serializes the payload too and would refuse
|
|
49
|
+
// the same value, so a circular reference or a bigint must not pass here.
|
|
50
|
+
// it rethrows and swallows naught (`rule.forbid.failhide`); what must not
|
|
51
|
+
// escape is a bare TypeError, which names neither the strip nor why it
|
|
52
|
+
// exists (`rule.require.errors-name-the-fix`).
|
|
53
|
+
//
|
|
54
|
+
// 🔴 the FAULT OWNER is decided by `of`, never guessed. a MESSAGE can name
|
|
55
|
+
// both sides in one sentence; a CLASS cannot — it is a single claim about
|
|
56
|
+
// who must fix the fault, so a guessed one is wrong half the time. a
|
|
57
|
+
// caller who hands a circular event would get `MalfunctionError`, which in
|
|
58
|
+
// this domain reads as *"the handler ran and broke"*
|
|
59
|
+
// (`invariant.badrequesterror-not-lambda-error`).
|
|
60
|
+
//
|
|
61
|
+
// ⇒ and `of` costs two call sites, both in `onReferenced` — one per side,
|
|
62
|
+
// each of which knows its own. with the direction known the message
|
|
63
|
+
// sharpens too, so no two-way hint is owed.
|
|
64
|
+
//
|
|
65
|
+
// duck-type rather than `instanceof Error` — jest runs each module in its own
|
|
66
|
+
// vm context, so a cross-realm error fails the prototype check and would
|
|
67
|
+
// degrade to `new Error(String(error))`, which loses the real constructor
|
|
68
|
+
// name and stack.
|
|
69
|
+
//
|
|
70
|
+
// 🟡 the predicate is shared rather than inline — three call sites read it,
|
|
71
|
+
// each with its own return contract, and a fork between any two is silent.
|
|
72
|
+
const cause = (0, isErrorLike_1.isErrorLike)(error) ? error : new Error(String(error));
|
|
73
|
+
if (input.of === 'event')
|
|
74
|
+
return helpful_errors_1.ConstraintError.throw('the event given cannot cross the wire — json refused to serialize it', {
|
|
75
|
+
cause,
|
|
76
|
+
hint: 'a circular reference or a bigint cannot reach a lambda. check the event you passed. aws would refuse the same payload, so it refuses here rather than let a test pass on a value the wire could never deliver.',
|
|
77
|
+
});
|
|
78
|
+
throw new helpful_errors_1.MalfunctionError('the handler returned a value that cannot cross the wire — json refused to serialize it', {
|
|
79
|
+
cause,
|
|
80
|
+
hint: 'a circular reference or a bigint cannot leave a lambda. check the value your handler returned. aws would refuse the same response, so it refuses here rather than let a test assert on an output the wire could never deliver.',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.asWireStripped = asWireStripped;
|
|
85
|
+
//# sourceMappingURL=asWireStripped.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asWireStripped.js","sourceRoot":"","sources":["../../../../src/domain.operations/runLambdaEndpoint/serde/asWireStripped.ts"],"names":[],"mappings":";;;AAAA,mDAAmE;AAEnE,sDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,cAAc,GAAG,CAAI,KAGjC,EAAK,EAAE;IACN;;;;;;;;;OASG;IACH,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,SAAc,CAAC;IAErD,IAAI,CAAC;QACH;;;WAGG;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAM,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4EAA4E;QAC5E,6EAA6E;QAC7E,6EAA6E;QAC7E,0EAA0E;QAC1E,kDAAkD;QAClD,EAAE;QACF,2EAA2E;QAC3E,6EAA6E;QAC7E,wEAAwE;QACxE,8EAA8E;QAC9E,wDAAwD;QACxD,qDAAqD;QACrD,EAAE;QACF,6EAA6E;QAC7E,yEAAyE;QACzE,iDAAiD;QACjD,EAAE;QACF,8EAA8E;QAC9E,yEAAyE;QACzE,0EAA0E;QAC1E,kBAAkB;QAClB,EAAE;QACF,4EAA4E;QAC5E,8EAA8E;QAC9E,MAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAEpE,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO;YACtB,OAAO,gCAAe,CAAC,KAAK,CAC1B,sEAAsE,EACtE;gBACE,KAAK;gBACL,IAAI,EAAE,gNAAgN;aACvN,CACF,CAAC;QAEJ,MAAM,IAAI,iCAAgB,CACxB,wFAAwF,EACxF;YACE,KAAK;YACL,IAAI,EAAE,gOAAgO;SACvO,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAlEW,QAAA,cAAc,kBAkEzB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { LambdaCredentialsAbsentError } from './domain.objects/LambdaCredentials
|
|
|
22
22
|
export { LambdaDomainObjectNotCapturableError } from './domain.objects/LambdaDomainObjectNotCapturableError';
|
|
23
23
|
export { LambdaDomainObjectRefUnbindableError } from './domain.objects/LambdaDomainObjectRefUnbindableError';
|
|
24
24
|
export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
|
|
25
|
+
export type { LambdaEndpointDialect } from './domain.objects/LambdaEndpointDialect';
|
|
25
26
|
export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
|
|
26
27
|
export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
|
|
27
28
|
export { LambdaFunctionNotFoundError } from './domain.objects/LambdaFunctionNotFoundError';
|
|
@@ -33,6 +34,7 @@ export { askLambdaEndpoint } from './domain.operations/askLambdaEndpoint/askLamb
|
|
|
33
34
|
export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet';
|
|
34
35
|
export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
|
|
35
36
|
export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
|
|
37
|
+
export { asLambdaEvent } from './domain.operations/asLambdaEvent/asLambdaEvent';
|
|
36
38
|
export { asApiGatewayResponseSchema } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema';
|
|
37
39
|
export type { CorsConfig, ForApiGatewayContext, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
|
|
38
40
|
export { forApiGateway } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
|
|
@@ -78,3 +80,10 @@ export { genServiceSdk } from './domain.operations/genServiceSdk/genServiceSdk';
|
|
|
78
80
|
export { type GetAllLambdaContractsContext, type GetAllLambdaContractsInput, getAllLambdaContracts, } from './domain.operations/getAllLambdaContracts/getAllLambdaContracts';
|
|
79
81
|
export { getAllLambdaFunctionsByPrefix } from './domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix';
|
|
80
82
|
export { type GetOneLambdaContractContext, type GetOneLambdaContractInput, getOneLambdaContract, } from './domain.operations/getOneLambdaContract/getOneLambdaContract';
|
|
83
|
+
export { asLambdaContext } from './domain.operations/runLambdaEndpoint/context/asLambdaContext';
|
|
84
|
+
export { asLambdaEndpointOutput } from './domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput';
|
|
85
|
+
export { asLambdaEndpointErrorEnvelopeAncient, asLambdaEndpointErrorEnvelopeContemp, isLambdaEndpointErrorEnvelopeAncient, isLambdaEndpointErrorEnvelopeContemp, } from './domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope';
|
|
86
|
+
export type { LambdaEndpointErrorEnvelope, LambdaEndpointRunOutput, } from './domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput';
|
|
87
|
+
export { runLambdaEndpoint } from './domain.operations/runLambdaEndpoint/runLambdaEndpoint';
|
|
88
|
+
export type { LambdaEndpointHandlerReferenced } from './domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced';
|
|
89
|
+
export type { LambdaEndpointLocus } from './domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* define endpoints, ask endpoints, auto-propagate trace-ids.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genZodBodyValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.forApiGateway = exports.asApiGatewayResponseSchema = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
|
|
8
|
+
exports.runLambdaEndpoint = exports.isLambdaEndpointErrorEnvelopeContemp = exports.isLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointErrorEnvelopeContemp = exports.asLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointOutput = exports.asLambdaContext = exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genZodBodyValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.forApiGateway = exports.asApiGatewayResponseSchema = exports.asLambdaEvent = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
|
|
9
9
|
// re-export from helpful-errors for convenience
|
|
10
10
|
var helpful_errors_1 = require("helpful-errors");
|
|
11
11
|
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
|
|
@@ -50,6 +50,9 @@ Object.defineProperty(exports, "getAskLambdaCacheKey", { enumerable: true, get:
|
|
|
50
50
|
// transformers
|
|
51
51
|
var asLambdaEndpoint_1 = require("./domain.operations/asLambdaEndpoint/asLambdaEndpoint");
|
|
52
52
|
Object.defineProperty(exports, "asLambdaEndpoint", { enumerable: true, get: function () { return asLambdaEndpoint_1.asLambdaEndpoint; } });
|
|
53
|
+
// test utils — the event source axis (construct the envelope a source delivers)
|
|
54
|
+
var asLambdaEvent_1 = require("./domain.operations/asLambdaEvent/asLambdaEvent");
|
|
55
|
+
Object.defineProperty(exports, "asLambdaEvent", { enumerable: true, get: function () { return asLambdaEvent_1.asLambdaEvent; } });
|
|
53
56
|
var asApiGatewayResponseSchema_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema");
|
|
54
57
|
Object.defineProperty(exports, "asApiGatewayResponseSchema", { enumerable: true, get: function () { return asApiGatewayResponseSchema_1.asApiGatewayResponseSchema; } });
|
|
55
58
|
var genLambdaEndpoint_forApiGateway_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway");
|
|
@@ -98,4 +101,25 @@ var getAllLambdaFunctionsByPrefix_1 = require("./domain.operations/getAllLambdaC
|
|
|
98
101
|
Object.defineProperty(exports, "getAllLambdaFunctionsByPrefix", { enumerable: true, get: function () { return getAllLambdaFunctionsByPrefix_1.getAllLambdaFunctionsByPrefix; } });
|
|
99
102
|
var getOneLambdaContract_1 = require("./domain.operations/getOneLambdaContract/getOneLambdaContract");
|
|
100
103
|
Object.defineProperty(exports, "getOneLambdaContract", { enumerable: true, get: function () { return getOneLambdaContract_1.getOneLambdaContract; } });
|
|
104
|
+
// test utils — the run boundary axis (run an endpoint by reference, or by slug)
|
|
105
|
+
var asLambdaContext_1 = require("./domain.operations/runLambdaEndpoint/context/asLambdaContext");
|
|
106
|
+
Object.defineProperty(exports, "asLambdaContext", { enumerable: true, get: function () { return asLambdaContext_1.asLambdaContext; } });
|
|
107
|
+
// the narrows the union needs — a field read on `TOutput | Envelope` does not
|
|
108
|
+
// compile on EITHER arm, and an `as` cast is the only other way through.
|
|
109
|
+
// ⚠️ the success-side narrow was absent until self-review r6. the vision named
|
|
110
|
+
// only the error one, so the MAJORITY case — a read on the handler's own
|
|
111
|
+
// output — had no supported form at all.
|
|
112
|
+
var asLambdaEndpointOutput_1 = require("./domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput");
|
|
113
|
+
Object.defineProperty(exports, "asLambdaEndpointOutput", { enumerable: true, get: function () { return asLambdaEndpointOutput_1.asLambdaEndpointOutput; } });
|
|
114
|
+
// the envelope narrows, one per dialect (F22). contemp reads the codec-versioned
|
|
115
|
+
// tag (EXACT); ancient reads the flat shape (ambiguous by the wire). the caller
|
|
116
|
+
// names the dialect by WHICH function they call — so F9 (dialect-in-the-type)
|
|
117
|
+
// holds with no runtime dialect argument.
|
|
118
|
+
var isLambdaEndpointErrorEnvelope_1 = require("./domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope");
|
|
119
|
+
Object.defineProperty(exports, "asLambdaEndpointErrorEnvelopeAncient", { enumerable: true, get: function () { return isLambdaEndpointErrorEnvelope_1.asLambdaEndpointErrorEnvelopeAncient; } });
|
|
120
|
+
Object.defineProperty(exports, "asLambdaEndpointErrorEnvelopeContemp", { enumerable: true, get: function () { return isLambdaEndpointErrorEnvelope_1.asLambdaEndpointErrorEnvelopeContemp; } });
|
|
121
|
+
Object.defineProperty(exports, "isLambdaEndpointErrorEnvelopeAncient", { enumerable: true, get: function () { return isLambdaEndpointErrorEnvelope_1.isLambdaEndpointErrorEnvelopeAncient; } });
|
|
122
|
+
Object.defineProperty(exports, "isLambdaEndpointErrorEnvelopeContemp", { enumerable: true, get: function () { return isLambdaEndpointErrorEnvelope_1.isLambdaEndpointErrorEnvelopeContemp; } });
|
|
123
|
+
var runLambdaEndpoint_1 = require("./domain.operations/runLambdaEndpoint/runLambdaEndpoint");
|
|
124
|
+
Object.defineProperty(exports, "runLambdaEndpoint", { enumerable: true, get: function () { return runLambdaEndpoint_1.runLambdaEndpoint; } });
|
|
101
125
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAExB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAExB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AAEvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAE5B,4BAA4B;AAC5B,4FAA2F;AAAlF,0IAAA,2BAA2B,OAAA;AACpC,oGAAmG;AAA1F,kJAAA,+BAA+B,OAAA;AACxC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,0FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAKnC,oBAAoB;AACpB,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAC1B,mGAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,yGAAwG;AAA/F,4HAAA,oBAAoB,OAAA;AAC7B,eAAe;AACf,0FAAyF;AAAhF,oHAAA,gBAAgB,OAAA;AACzB,gFAAgF;AAChF,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,+IAA8I;AAArI,wIAAA,0BAA0B,OAAA;AAMnC,yJAAsI;AAA7H,gIAAA,aAAa,OAAA;AACtB,mIAAkI;AAAzH,4HAAA,oBAAoB,OAAA;AAC7B,wLAAuL;AAA9K,sKAAA,yCAAyC,OAAA;AAClD,wKAAuK;AAA9J,sJAAA,iCAAiC,OAAA;AAC1C,kKAAiK;AAAxJ,gJAAA,8BAA8B,OAAA;AAUvC,4JAA4I;AAAnI,qIAAA,iBAAiB,OAAA;AAC1B,qKAAoK;AAA3J,kJAAA,+BAA+B,OAAA;AACxC;;;;;;GAMG;AACH,sGAG2E;AAFzE,oHAAA,gBAAgB,OAAA;AAGlB,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AACrC,wIAAuI;AAA9H,sJAAA,iCAAiC,OAAA;AAC1C,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AACnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AAoBzC,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA;AAEtB,gFAAgF;AAChF,iGAAgG;AAAvF,kHAAA,eAAe,OAAA;AACxB,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,+GAA8G;AAArG,gIAAA,sBAAsB,OAAA;AAC/B,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,0CAA0C;AAC1C,6HAKqF;AAJnF,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AAMtC,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "sdk-aws-lambda",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"repository": "ehmpathy/sdk-aws-lambda",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
|
|
8
8
|
"keywords": [
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"simple-in-memory-cache": "0.4.0",
|
|
76
76
|
"type-fns": "1.21.4",
|
|
77
77
|
"with-simple-cache": "0.15.3",
|
|
78
|
+
"yaml": "2.9.0",
|
|
78
79
|
"zod": "4.4.3"
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|