sdk-aws-lambda 0.7.0 → 0.7.2
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/TrailCarrier.d.ts +17 -0
- package/dist/domain.objects/TrailCarrier.js +3 -0
- package/dist/domain.objects/TrailCarrier.js.map +1 -0
- package/dist/domain.objects/TrailExidHeader.d.ts +10 -0
- package/dist/domain.objects/TrailExidHeader.js +14 -0
- package/dist/domain.objects/TrailExidHeader.js.map +1 -0
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js +15 -1
- package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +50 -27
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +18 -61
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.d.ts +35 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js +80 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.d.ts +37 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js +70 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.d.ts +17 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js +34 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.d.ts +31 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js +55 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.d.ts +13 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.js +22 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.d.ts +16 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.js +22 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.d.ts +17 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.js +28 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.d.ts +23 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js +39 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.d.ts +10 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js +19 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.d.ts +11 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.js +19 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.d.ts +9 -6
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.d.ts +12 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +4 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +32 -7
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js +22 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +13 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +5 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +5 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +9 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +10 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +15 -8
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +57 -12
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js +4 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.d.ts +17 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.js +32 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.d.ts +19 -57
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js +30 -78
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js.map +1 -1
- package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.d.ts +11 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js +13 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.d.ts +23 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js +32 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.d.ts +20 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js +23 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.d.ts +9 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js +19 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.d.ts +16 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js +24 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.d.ts +9 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js +15 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.d.ts +19 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js +27 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.d.ts +11 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js +21 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.d.ts +21 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js +27 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.d.ts +24 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js +28 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +7 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +18 -2
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -1
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +43 -7
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
- package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.d.ts +35 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js +81 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.d.ts +14 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js +18 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js.map +1 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.d.ts +17 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js +19 -0
- package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js.map +1 -0
- package/dist/index.d.ts +14 -6
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
- package/readme.md +43 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asErrorFromHttpResponse = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const HttpStatusCode_1 = require("../../../domain.objects/HttpStatusCode");
|
|
6
|
+
const getIsLambdaErrorResponse_1 = require("../../lambdaEndpointWire/error/getIsLambdaErrorResponse");
|
|
7
|
+
const asUnprefixedErrorMessage_1 = require("../../lambdaEndpointWire/serde/asUnprefixedErrorMessage");
|
|
8
|
+
const getOneCorrelationIdFromBody_1 = require("./getOneCorrelationIdFromBody");
|
|
9
|
+
const ERROR_TEXT_LENGTH_MAX = 1000;
|
|
10
|
+
/**
|
|
11
|
+
* .what = casts an http response into the error a caller should throw, or null for a success
|
|
12
|
+
* .why = an api gateway endpoint answers a fault as a RETURNED http response, never a lambda error
|
|
13
|
+
* (`invariant.badrequesterror-not-lambda-error`). the caller of `viaApiGateway` still wants
|
|
14
|
+
* the throw `askLambdaEndpoint` gives — one catch block, whichever road it took
|
|
15
|
+
*
|
|
16
|
+
* | status | the error | because |
|
|
17
|
+
* |--------|-----------|---------|
|
|
18
|
+
* | < 400 | none | a success. a redirect is followed by fetch by default, so a 3xx seldom arrives here |
|
|
19
|
+
* | 4xx | `ConstraintError` | the caller must fix the request |
|
|
20
|
+
* | 5xx | `MalfunctionError` | the endpoint must fix itself; its `correlationId` finds the log line |
|
|
21
|
+
*
|
|
22
|
+
* .note = the message comes from the body's contemp envelope when it has one, else from the
|
|
23
|
+
* status alone — a 404 from the gateway's own route match has no body this sdk wrote.
|
|
24
|
+
* a flat ancient body reads as the status alone: an opted-in caller is never answered in
|
|
25
|
+
* that shape, so no arm reads it
|
|
26
|
+
* .note = the raw answer text rides the error metadata, cut to a bound, so a message no arm reads
|
|
27
|
+
* (an old endpoint's flat body, a proxy's html page) is never lost to the caller. it is null
|
|
28
|
+
* where the message came from the contemp envelope, which is the text already. the
|
|
29
|
+
* response headers ride it too, so a deliberate refusal (a 429 and its `retry-after`) can be
|
|
30
|
+
* read from the thrown error
|
|
31
|
+
*/
|
|
32
|
+
const asErrorFromHttpResponse = (input) => {
|
|
33
|
+
if (input.status < HttpStatusCode_1.HttpStatusCode.BAD_REQUEST_400)
|
|
34
|
+
return null;
|
|
35
|
+
const message = (0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(input.body)
|
|
36
|
+
? (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({ message: input.body.error.message })
|
|
37
|
+
: `the endpoint answered http ${input.status}`;
|
|
38
|
+
const metadata = {
|
|
39
|
+
url: input.url,
|
|
40
|
+
status: input.status,
|
|
41
|
+
exid: input.exid,
|
|
42
|
+
correlationId: (0, getOneCorrelationIdFromBody_1.getOneCorrelationIdFromBody)({ body: input.body }),
|
|
43
|
+
// the raw text rides only where the message did not come from it: an envelope's message is
|
|
44
|
+
// the text already, and a second copy would bury the fix a person reads first
|
|
45
|
+
text: (0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(input.body)
|
|
46
|
+
? null
|
|
47
|
+
: input.text.slice(0, ERROR_TEXT_LENGTH_MAX),
|
|
48
|
+
headers: input.headers,
|
|
49
|
+
};
|
|
50
|
+
if (input.status < HttpStatusCode_1.HttpStatusCode.INTERNAL_SERVER_ERROR_500)
|
|
51
|
+
return new helpful_errors_1.ConstraintError(message, metadata);
|
|
52
|
+
return new helpful_errors_1.MalfunctionError(message, metadata);
|
|
53
|
+
};
|
|
54
|
+
exports.asErrorFromHttpResponse = asErrorFromHttpResponse;
|
|
55
|
+
//# sourceMappingURL=asErrorFromHttpResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asErrorFromHttpResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.ts"],"names":[],"mappings":";;;AAAA,mDAAmE;AAEnE,2EAAwE;AACxE,sGAAoG;AACpG,sGAAmG;AACnG,+EAA4E;AAE5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAOvC,EAA6C,EAAE;IAC9C,IAAI,KAAK,CAAC,MAAM,GAAG,+BAAc,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAE/D,MAAM,OAAO,GAAG,IAAA,oDAAyB,EAAC,KAAK,CAAC,IAAI,CAAC;QACnD,CAAC,CAAC,IAAA,mDAAwB,EAAC,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjE,CAAC,CAAC,8BAA8B,KAAK,CAAC,MAAM,EAAE,CAAC;IAEjD,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,IAAA,yDAA2B,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAChE,2FAA2F;QAC3F,8EAA8E;QAC9E,IAAI,EAAE,IAAA,oDAAyB,EAAC,KAAK,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC;QAC9C,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;IAEF,IAAI,KAAK,CAAC,MAAM,GAAG,+BAAc,CAAC,yBAAyB;QACzD,OAAO,IAAI,gCAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChD,OAAO,IAAI,iCAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC;AA9BW,QAAA,uBAAuB,2BA8BlC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = casts a fetch `Headers` into a plain record, keys lowercased by the http client
|
|
3
|
+
* .why = a caller reads a header by name, and a live `Headers` cannot survive a json strip, a spread,
|
|
4
|
+
* or a snapshot
|
|
5
|
+
*
|
|
6
|
+
* .note = DELIBERATE MUTATION — of a record made in this scope, which does not escape until whole.
|
|
7
|
+
* the declared `Headers` type under this tsconfig's lib has no `entries()` and is not
|
|
8
|
+
* iterable, so `forEach` is the only reader (`rule.require.immutable-vars` sanctions an
|
|
9
|
+
* unavoidable mutation that is isolated and annotated)
|
|
10
|
+
*/
|
|
11
|
+
export declare const asHeadersRecord: (input: {
|
|
12
|
+
headers: Headers;
|
|
13
|
+
}) => Record<string, string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asHeadersRecord = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = casts a fetch `Headers` into a plain record, keys lowercased by the http client
|
|
6
|
+
* .why = a caller reads a header by name, and a live `Headers` cannot survive a json strip, a spread,
|
|
7
|
+
* or a snapshot
|
|
8
|
+
*
|
|
9
|
+
* .note = DELIBERATE MUTATION — of a record made in this scope, which does not escape until whole.
|
|
10
|
+
* the declared `Headers` type under this tsconfig's lib has no `entries()` and is not
|
|
11
|
+
* iterable, so `forEach` is the only reader (`rule.require.immutable-vars` sanctions an
|
|
12
|
+
* unavoidable mutation that is isolated and annotated)
|
|
13
|
+
*/
|
|
14
|
+
const asHeadersRecord = (input) => {
|
|
15
|
+
const record = {};
|
|
16
|
+
input.headers.forEach((value, key) => {
|
|
17
|
+
record[key] = value;
|
|
18
|
+
});
|
|
19
|
+
return record;
|
|
20
|
+
};
|
|
21
|
+
exports.asHeadersRecord = asHeadersRecord;
|
|
22
|
+
//# sourceMappingURL=asHeadersRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asHeadersRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAG,CAAC,KAE/B,EAA0B,EAAE;IAC3B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = the method a request is sent under: the caller's, else the one its body implies
|
|
3
|
+
* .why = a request with a body and no method is a write, and fetch refuses `GET` with a body. so the
|
|
4
|
+
* bare call does the common work: `POST` where there is a body, `GET` where there is none
|
|
5
|
+
* (`rule.prefer.defaults-match-common-case`)
|
|
6
|
+
*
|
|
7
|
+
* | method | body | sent as |
|
|
8
|
+
* |--------|------|---------|
|
|
9
|
+
* | given | any | the given method, as is — a mismatch is the caller's to see |
|
|
10
|
+
* | absent | present | `POST` |
|
|
11
|
+
* | absent | absent | `GET` |
|
|
12
|
+
*/
|
|
13
|
+
export declare const asHttpMethod: (input: {
|
|
14
|
+
method: string | undefined;
|
|
15
|
+
body: unknown;
|
|
16
|
+
}) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asHttpMethod = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the method a request is sent under: the caller's, else the one its body implies
|
|
6
|
+
* .why = a request with a body and no method is a write, and fetch refuses `GET` with a body. so the
|
|
7
|
+
* bare call does the common work: `POST` where there is a body, `GET` where there is none
|
|
8
|
+
* (`rule.prefer.defaults-match-common-case`)
|
|
9
|
+
*
|
|
10
|
+
* | method | body | sent as |
|
|
11
|
+
* |--------|------|---------|
|
|
12
|
+
* | given | any | the given method, as is — a mismatch is the caller's to see |
|
|
13
|
+
* | absent | present | `POST` |
|
|
14
|
+
* | absent | absent | `GET` |
|
|
15
|
+
*/
|
|
16
|
+
const asHttpMethod = (input) => {
|
|
17
|
+
if (input.method)
|
|
18
|
+
return input.method;
|
|
19
|
+
return input.body === undefined ? 'GET' : 'POST';
|
|
20
|
+
};
|
|
21
|
+
exports.asHttpMethod = asHttpMethod;
|
|
22
|
+
//# sourceMappingURL=asHttpMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asHttpMethod.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpMethod.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,YAAY,GAAG,CAAC,KAG5B,EAAU,EAAE;IACX,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = casts a request body into the bytes fetch sends, and the content type that declares them
|
|
3
|
+
* .why = a caller hands a string or an object, as `asLambdaEvent.fromApiGateway` takes one. a string
|
|
4
|
+
* crosses as is; any other value is json, and says so in its content type
|
|
5
|
+
*
|
|
6
|
+
* | body | text | contentType |
|
|
7
|
+
* |------|------|-------------|
|
|
8
|
+
* | absent | absent | none |
|
|
9
|
+
* | string | the string | none — the caller owns its sense |
|
|
10
|
+
* | other | `JSON.stringify` of it | `application/json` |
|
|
11
|
+
*/
|
|
12
|
+
export declare const asHttpRequestBody: (input: {
|
|
13
|
+
body: unknown;
|
|
14
|
+
}) => {
|
|
15
|
+
text: string | undefined;
|
|
16
|
+
contentType: string | null;
|
|
17
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asHttpRequestBody = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the content type a json request body is sent under
|
|
6
|
+
* .why = one name for the literal, so the body cast and the header that declares it cannot drift
|
|
7
|
+
*/
|
|
8
|
+
const CONTENT_TYPE_JSON = 'application/json';
|
|
9
|
+
/**
|
|
10
|
+
* .what = casts a request body into the bytes fetch sends, and the content type that declares them
|
|
11
|
+
* .why = a caller hands a string or an object, as `asLambdaEvent.fromApiGateway` takes one. a string
|
|
12
|
+
* crosses as is; any other value is json, and says so in its content type
|
|
13
|
+
*
|
|
14
|
+
* | body | text | contentType |
|
|
15
|
+
* |------|------|-------------|
|
|
16
|
+
* | absent | absent | none |
|
|
17
|
+
* | string | the string | none — the caller owns its sense |
|
|
18
|
+
* | other | `JSON.stringify` of it | `application/json` |
|
|
19
|
+
*/
|
|
20
|
+
const asHttpRequestBody = (input) => {
|
|
21
|
+
if (input.body === undefined)
|
|
22
|
+
return { text: undefined, contentType: null };
|
|
23
|
+
if (typeof input.body === 'string')
|
|
24
|
+
return { text: input.body, contentType: null };
|
|
25
|
+
return { text: JSON.stringify(input.body), contentType: CONTENT_TYPE_JSON };
|
|
26
|
+
};
|
|
27
|
+
exports.asHttpRequestBody = asHttpRequestBody;
|
|
28
|
+
//# sourceMappingURL=asHttpRequestBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asHttpRequestBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAE7C;;;;;;;;;;GAUG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAEjC,EAA4D,EAAE;IAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC5E,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAChC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC9E,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = the headers an http request is sent with: the body's content type, the caller's, and the trail's
|
|
3
|
+
* .why = three sources meet and two can collide, so the order is the contract, and it reads here once
|
|
4
|
+
* instead of at each call site
|
|
5
|
+
*
|
|
6
|
+
* | source | wins over |
|
|
7
|
+
* |--------|-----------|
|
|
8
|
+
* | the trail's `x-trail-exid` | any caller header of that name, in any case |
|
|
9
|
+
* | the caller's `headers` | the content type the body implies, in any case |
|
|
10
|
+
* | the content type the body implies | none |
|
|
11
|
+
*
|
|
12
|
+
* .note = a caller header of the trail's name is dropped in every case, since one of that name would
|
|
13
|
+
* silently opt in or out of the dialect the trail declares
|
|
14
|
+
* .note = the implied content type yields to a caller's of any case: a bag that held `Content-Type` and
|
|
15
|
+
* `content-type` would be joined by the http client into one value that names two types
|
|
16
|
+
*/
|
|
17
|
+
export declare const asHttpRequestHeaders: (input: {
|
|
18
|
+
contentType: string | null;
|
|
19
|
+
headers: Record<string, string> | undefined;
|
|
20
|
+
trail: {
|
|
21
|
+
exid: string;
|
|
22
|
+
};
|
|
23
|
+
}) => Record<string, string>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asHttpRequestHeaders = void 0;
|
|
4
|
+
const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
|
|
5
|
+
const asHeadersWithoutKey_1 = require("../../lambdaEndpointWire/frame/asHeadersWithoutKey");
|
|
6
|
+
const asTrailExidHeaders_1 = require("../../lambdaEndpointWire/frame/asTrailExidHeaders");
|
|
7
|
+
const CONTENT_TYPE_HEADER = 'content-type';
|
|
8
|
+
/**
|
|
9
|
+
* .what = the headers an http request is sent with: the body's content type, the caller's, and the trail's
|
|
10
|
+
* .why = three sources meet and two can collide, so the order is the contract, and it reads here once
|
|
11
|
+
* instead of at each call site
|
|
12
|
+
*
|
|
13
|
+
* | source | wins over |
|
|
14
|
+
* |--------|-----------|
|
|
15
|
+
* | the trail's `x-trail-exid` | any caller header of that name, in any case |
|
|
16
|
+
* | the caller's `headers` | the content type the body implies, in any case |
|
|
17
|
+
* | the content type the body implies | none |
|
|
18
|
+
*
|
|
19
|
+
* .note = a caller header of the trail's name is dropped in every case, since one of that name would
|
|
20
|
+
* silently opt in or out of the dialect the trail declares
|
|
21
|
+
* .note = the implied content type yields to a caller's of any case: a bag that held `Content-Type` and
|
|
22
|
+
* `content-type` would be joined by the http client into one value that names two types
|
|
23
|
+
*/
|
|
24
|
+
const asHttpRequestHeaders = (input) => {
|
|
25
|
+
const headersOfCaller = (0, asHeadersWithoutKey_1.asHeadersWithoutKey)({
|
|
26
|
+
headers: input.headers,
|
|
27
|
+
key: TrailExidHeader_1.TRAIL_EXID_HEADER,
|
|
28
|
+
});
|
|
29
|
+
const isContentTypeGiven = Object.keys(headersOfCaller).some((name) => name.toLowerCase() === CONTENT_TYPE_HEADER);
|
|
30
|
+
return {
|
|
31
|
+
...(input.contentType && !isContentTypeGiven
|
|
32
|
+
? { [CONTENT_TYPE_HEADER]: input.contentType }
|
|
33
|
+
: {}),
|
|
34
|
+
...headersOfCaller,
|
|
35
|
+
...(0, asTrailExidHeaders_1.asTrailExidHeaders)({ trail: input.trail }),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.asHttpRequestHeaders = asHttpRequestHeaders;
|
|
39
|
+
//# sourceMappingURL=asHttpRequestHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asHttpRequestHeaders.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.ts"],"names":[],"mappings":";;;AAAA,6EAA4E;AAC5E,4FAAyF;AACzF,0FAAuF;AAEvF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAIpC,EAA0B,EAAE;IAC3B,MAAM,eAAe,GAAG,IAAA,yCAAmB,EAAC;QAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,EAAE,mCAAiB;KACvB,CAAC,CAAC;IACH,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAC1D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,mBAAmB,CACrD,CAAC;IACF,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,kBAAkB;YAC1C,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE;YAC9C,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,eAAe;QAClB,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,oBAAoB,wBAmB/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = reads a response body's json out of its text, or null when it holds none
|
|
3
|
+
* .why = an endpoint answers json, but a gateway's own 404 or 502 answers html or empty. null says
|
|
4
|
+
* "no json here" without a throw; the raw text travels beside it, so no data is hidden
|
|
5
|
+
*
|
|
6
|
+
* .note = null is not a swallow: the caller of `viaApiGateway` always receives the raw `text` too
|
|
7
|
+
*/
|
|
8
|
+
export declare const getOneBodyFromHttpText: (input: {
|
|
9
|
+
text: string;
|
|
10
|
+
}) => unknown;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOneBodyFromHttpText = void 0;
|
|
4
|
+
const getParsedJson_1 = require("../../lambdaEndpointWire/serde/getParsedJson");
|
|
5
|
+
/**
|
|
6
|
+
* .what = reads a response body's json out of its text, or null when it holds none
|
|
7
|
+
* .why = an endpoint answers json, but a gateway's own 404 or 502 answers html or empty. null says
|
|
8
|
+
* "no json here" without a throw; the raw text travels beside it, so no data is hidden
|
|
9
|
+
*
|
|
10
|
+
* .note = null is not a swallow: the caller of `viaApiGateway` always receives the raw `text` too
|
|
11
|
+
*/
|
|
12
|
+
const getOneBodyFromHttpText = (input) => {
|
|
13
|
+
if (!input.text)
|
|
14
|
+
return null;
|
|
15
|
+
const parsed = (0, getParsedJson_1.getParsedJson)({ json: input.text });
|
|
16
|
+
return parsed.success ? parsed.data : null;
|
|
17
|
+
};
|
|
18
|
+
exports.getOneBodyFromHttpText = getOneBodyFromHttpText;
|
|
19
|
+
//# sourceMappingURL=getOneBodyFromHttpText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOneBodyFromHttpText.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.ts"],"names":[],"mappings":";;;AAAA,gFAA6E;AAE7E;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAuB,EAAW,EAAE;IACzE,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,6BAAa,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = reads the `correlationId` an endpoint's redacted 500 body holds, or null when it holds none
|
|
3
|
+
* .why = the 500 body is family-blind: `{ errorMessage, errorType, correlationId }`. the id is the key to
|
|
4
|
+
* the real error in the endpoint's logs, so the thrown `MalfunctionError` carries it
|
|
5
|
+
*
|
|
6
|
+
* .note = reads one string field off a body of unknown shape, so the shape is checked here, in one
|
|
7
|
+
* named place, rather than at each reader
|
|
8
|
+
*/
|
|
9
|
+
export declare const getOneCorrelationIdFromBody: (input: {
|
|
10
|
+
body: unknown;
|
|
11
|
+
}) => string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOneCorrelationIdFromBody = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = reads the `correlationId` an endpoint's redacted 500 body holds, or null when it holds none
|
|
6
|
+
* .why = the 500 body is family-blind: `{ errorMessage, errorType, correlationId }`. the id is the key to
|
|
7
|
+
* the real error in the endpoint's logs, so the thrown `MalfunctionError` carries it
|
|
8
|
+
*
|
|
9
|
+
* .note = reads one string field off a body of unknown shape, so the shape is checked here, in one
|
|
10
|
+
* named place, rather than at each reader
|
|
11
|
+
*/
|
|
12
|
+
const getOneCorrelationIdFromBody = (input) => {
|
|
13
|
+
if (typeof input.body !== 'object' || input.body === null)
|
|
14
|
+
return null;
|
|
15
|
+
const correlationId = Reflect.get(input.body, 'correlationId');
|
|
16
|
+
return typeof correlationId === 'string' ? correlationId : null;
|
|
17
|
+
};
|
|
18
|
+
exports.getOneCorrelationIdFromBody = getOneCorrelationIdFromBody;
|
|
19
|
+
//# sourceMappingURL=getOneCorrelationIdFromBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOneCorrelationIdFromBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAE3C,EAAiB,EAAE;IAClB,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACvE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC/D,OAAO,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC,CAAC;AANW,QAAA,2BAA2B,+BAMtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FrozenDeep } from '
|
|
1
|
+
import type { FrozenDeep } from 'type-fns';
|
|
2
2
|
/**
|
|
3
3
|
* .what = the shapes one family binds into the superset — its own types, per slot
|
|
4
4
|
* .why = the superset must be checkable against a variant that carries real types, never against
|
|
@@ -37,11 +37,14 @@ export interface InvokeShapes {
|
|
|
37
37
|
*
|
|
38
38
|
* .note = every slot is `FrozenDeep`, because every value handed to an `invoke` is deep-frozen
|
|
39
39
|
* in every family (`rule.require.frozen-invoke-inputs`)
|
|
40
|
-
* .note = the freeze is NOT clampable from here, measured
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* .note = the freeze is NOT clampable from here, measured. per arm of `FrozenDeep`:
|
|
41
|
+
* - an object property: typescript ignores `readonly` in assignability, in both
|
|
42
|
+
* directions — `{ to: string }` is assignable to `{ readonly to: string }` and back
|
|
43
|
+
* - an array, `Set`, or `Map`: the mutable form is assignable to its readonly peer
|
|
44
|
+
* (`string[]` → `readonly string[]`); only the reverse fails
|
|
45
|
+
* either way, a mutable slot satisfies a frozen one. so a variant that drops `FrozenDeep`
|
|
46
|
+
* from a slot still satisfies this superset, and a bite check written for it goes TS2578
|
|
47
|
+
* rather than red. each arm is run in `InvokeInputSuperset.test.ts [case2][t2]`. the freeze is held by each variant's
|
|
45
48
|
* own `@ts-expect-error` depth arm instead; this superset clamps a slot's NAME and its
|
|
46
49
|
* VALUE TYPE, and naught else
|
|
47
50
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = appends the trail header to a comma-separated list of allowed cors request headers
|
|
3
|
+
* .why = a browser that sends `x-trail-exid` preflights it, and a preflight that does not list it
|
|
4
|
+
* blocks the real request. the sdk expects the header on every endpoint
|
|
5
|
+
* (`domain.terms/x-trail-exid.md`)
|
|
6
|
+
*
|
|
7
|
+
* .note = http header names are case-insensitive (rfc 9110 §5.1), so an author's `X-Trail-Exid` is
|
|
8
|
+
* already listed and is not appended again
|
|
9
|
+
*/
|
|
10
|
+
export declare const asCorsHeadersWithTrail: (input: {
|
|
11
|
+
headers: string;
|
|
12
|
+
}) => string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asCorsHeadersWithTrail = void 0;
|
|
4
|
+
const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
|
|
5
|
+
/**
|
|
6
|
+
* .what = appends the trail header to a comma-separated list of allowed cors request headers
|
|
7
|
+
* .why = a browser that sends `x-trail-exid` preflights it, and a preflight that does not list it
|
|
8
|
+
* blocks the real request. the sdk expects the header on every endpoint
|
|
9
|
+
* (`domain.terms/x-trail-exid.md`)
|
|
10
|
+
*
|
|
11
|
+
* .note = http header names are case-insensitive (rfc 9110 §5.1), so an author's `X-Trail-Exid` is
|
|
12
|
+
* already listed and is not appended again
|
|
13
|
+
*/
|
|
14
|
+
const asCorsHeadersWithTrail = (input) => {
|
|
15
|
+
const listed = input.headers
|
|
16
|
+
.split(',')
|
|
17
|
+
.map((header) => header.trim().toLowerCase());
|
|
18
|
+
if (listed.includes(TrailExidHeader_1.TRAIL_EXID_HEADER))
|
|
19
|
+
return input.headers;
|
|
20
|
+
// an empty list, or one that ends in a comma, gains the key with no stray comma
|
|
21
|
+
const listedBefore = input.headers.trim().replace(/,+$/, '');
|
|
22
|
+
return listedBefore === ''
|
|
23
|
+
? TrailExidHeader_1.TRAIL_EXID_HEADER
|
|
24
|
+
: `${listedBefore},${TrailExidHeader_1.TRAIL_EXID_HEADER}`;
|
|
25
|
+
};
|
|
26
|
+
exports.asCorsHeadersWithTrail = asCorsHeadersWithTrail;
|
|
27
|
+
//# sourceMappingURL=asCorsHeadersWithTrail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asCorsHeadersWithTrail.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.ts"],"names":[],"mappings":";;;AAAA,6EAA4E;AAE5E;;;;;;;;GAQG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAU,EAAE;IAC3E,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO;SACzB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,QAAQ,CAAC,mCAAiB,CAAC;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IAE7D,gFAAgF;IAChF,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7D,OAAO,YAAY,KAAK,EAAE;QACxB,CAAC,CAAC,mCAAiB;QACnB,CAAC,CAAC,GAAG,YAAY,IAAI,mCAAiB,EAAE,CAAC;AAC7C,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import middy from '@middy/core';
|
|
2
2
|
import type { Context } from 'aws-lambda';
|
|
3
3
|
import type { ContextLogTrail } from 'sdk-logs';
|
|
4
|
+
import type { FrozenDeep } from 'type-fns';
|
|
4
5
|
import type { ZodSchema } from 'zod';
|
|
5
6
|
import type { ApiGatewayRequestEventOnwire } from '../../../domain.objects/ApiGatewayRequestEventOnwire';
|
|
6
7
|
import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayResponse';
|
|
7
8
|
import type { ApiGatewayResponseOnwire } from '../../../domain.objects/ApiGatewayResponseOnwire';
|
|
8
9
|
import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
|
|
9
|
-
import { type FrozenDeep } from '../setEventFrozen';
|
|
10
10
|
import type { TranslateLog } from '../TranslateLog';
|
|
11
11
|
import type { ApiGatewayHeadersDeclared, ApiGatewayHeadersMerged, ApiGatewayRequestEventUnified } from './ApiGatewayRequestEventUnified';
|
|
12
12
|
/**
|
|
@@ -51,6 +51,9 @@ export interface CorsConfig {
|
|
|
51
51
|
* .why = sets Access-Control-Allow-Headers header
|
|
52
52
|
*
|
|
53
53
|
* defaults to 'content-type,authorization'
|
|
54
|
+
*
|
|
55
|
+
* `x-trail-exid` is always appended, default or author-set, so a browser caller that opts into
|
|
56
|
+
* the contemp dialect passes its preflight
|
|
54
57
|
*/
|
|
55
58
|
headers?: string;
|
|
56
59
|
}
|
|
@@ -9,6 +9,7 @@ const http_cors_1 = __importDefault(require("@middy/http-cors"));
|
|
|
9
9
|
const http_response_serializer_1 = __importDefault(require("@middy/http-response-serializer"));
|
|
10
10
|
const http_security_headers_1 = __importDefault(require("@middy/http-security-headers"));
|
|
11
11
|
const helpful_errors_1 = require("helpful-errors");
|
|
12
|
+
const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
|
|
12
13
|
const asContextLogTrail_1 = require("../asContextLogTrail");
|
|
13
14
|
const genConstraintErrorMiddleware_1 = require("../middleware/genConstraintErrorMiddleware");
|
|
14
15
|
const genInternalServiceErrorMiddleware_1 = require("../middleware/genInternalServiceErrorMiddleware");
|
|
@@ -20,11 +21,18 @@ const setEventFrozen_1 = require("../setEventFrozen");
|
|
|
20
21
|
const asApiGatewayRequestEventUnified_1 = require("./asApiGatewayRequestEventUnified");
|
|
21
22
|
const asApiGatewayResponseOnwire_1 = require("./asApiGatewayResponseOnwire");
|
|
22
23
|
const asApiGatewayResponseOnwireJson_1 = require("./asApiGatewayResponseOnwireJson");
|
|
24
|
+
const asCorsHeadersWithTrail_1 = require("./asCorsHeadersWithTrail");
|
|
23
25
|
const getAllResponseOnwireKeysFound_1 = require("./getAllResponseOnwireKeysFound");
|
|
24
26
|
const isApiGatewayResponse_1 = require("./isApiGatewayResponse");
|
|
25
27
|
const genApiGatewayRequestEventNormalizationMiddleware_1 = require("./middleware/genApiGatewayRequestEventNormalizationMiddleware");
|
|
26
28
|
const genContentTypeCoherenceMiddleware_1 = require("./middleware/genContentTypeCoherenceMiddleware");
|
|
27
29
|
const genZodInputValidationMiddleware_1 = require("./middleware/genZodInputValidationMiddleware");
|
|
30
|
+
/**
|
|
31
|
+
* .what = the carrier this family reads: aws builds the envelope, so the opt-in rides its `headers`
|
|
32
|
+
* .why = one constant feeds the trail middleware that reads it and the stamp that tells
|
|
33
|
+
* `runLambdaEndpoint` which carrier to write, so the two cannot disagree
|
|
34
|
+
*/
|
|
35
|
+
const CARRIER_API_GATEWAY = 'headers';
|
|
28
36
|
/** .what = converts this sdk's cors config into `@middy/http-cors` options */
|
|
29
37
|
const corsInputToCorsConfig = (cors) => {
|
|
30
38
|
return {
|
|
@@ -38,7 +46,15 @@ const corsInputToCorsConfig = (cors) => {
|
|
|
38
46
|
*/
|
|
39
47
|
...(cors.origins === '*' ? { origin: '*' } : { origins: cors.origins }),
|
|
40
48
|
credentials: cors.credentials,
|
|
41
|
-
|
|
49
|
+
/**
|
|
50
|
+
* .what = the allowed request headers, with the trail header always appended
|
|
51
|
+
* .why = a browser that sends `x-trail-exid` preflights it, and a preflight that does not
|
|
52
|
+
* list it blocks the real request. the sdk expects the header on every endpoint, so
|
|
53
|
+
* an author-set list gets it too, rather than drop it in silence
|
|
54
|
+
*/
|
|
55
|
+
headers: (0, asCorsHeadersWithTrail_1.asCorsHeadersWithTrail)({
|
|
56
|
+
headers: cors.headers ?? 'content-type,authorization',
|
|
57
|
+
}),
|
|
42
58
|
/**
|
|
43
59
|
* .absent by choice = `disableBeforePreflightResponse: false` would turn on the vendor's
|
|
44
60
|
* `OPTIONS` short-circuit — limit 1 on `CorsConfig`. blast radius, probed: one case
|
|
@@ -167,10 +183,10 @@ const forApiGateway = (config, context) => {
|
|
|
167
183
|
* error (invariant.badrequesterror-not-lambda-error) — and the 500 body carries a
|
|
168
184
|
* generic message plus the correlation id, never the error's own message
|
|
169
185
|
*
|
|
170
|
-
* .note =
|
|
171
|
-
* `
|
|
172
|
-
*
|
|
173
|
-
*
|
|
186
|
+
* .note = the dialect follows the caller's opt-in, as in every family. a caller that sends
|
|
187
|
+
* `x-trail-exid` is contemp and gets the nested body; one that sends none — a
|
|
188
|
+
* browser, a legacy client — is ancient and gets the flat one. where trail never
|
|
189
|
+
* ran, `asContextTrailed` defaults the flag to `false`
|
|
174
190
|
*/
|
|
175
191
|
(0, genConstraintErrorMiddleware_1.genConstraintErrorMiddleware)({
|
|
176
192
|
asOutputAfter: (payload) => (0, asApiGatewayResponseOnwireJson_1.asApiGatewayResponseOnwireJson)({ status: 400, payload }),
|
|
@@ -209,7 +225,13 @@ const forApiGateway = (config, context) => {
|
|
|
209
225
|
(0, genApiGatewayRequestEventNormalizationMiddleware_1.genApiGatewayRequestEventNormalizationMiddleware)({
|
|
210
226
|
parsePayload: deserialize.payload,
|
|
211
227
|
}),
|
|
212
|
-
|
|
228
|
+
/**
|
|
229
|
+
* .what = reads the caller's `x-trail-exid` from the headers entry 7 just reconciled
|
|
230
|
+
* .why = aws builds this envelope, so no caller can wrap it in `{ event, trail }`. the
|
|
231
|
+
* opt-in rides the request's own headers, which exist only AFTER normalization — so
|
|
232
|
+
* this stays at 8, below it (`invariant.ancient-vs-contemp-callers.md`)
|
|
233
|
+
*/
|
|
234
|
+
(0, genTrailMiddleware_1.genTrailMiddleware)({ carrier: CARRIER_API_GATEWAY }),
|
|
213
235
|
(0, genIntrospectionMiddleware_1.genIntrospectionMiddleware)({
|
|
214
236
|
schema: config.schema,
|
|
215
237
|
env: context?.env,
|
|
@@ -234,7 +256,10 @@ const forApiGateway = (config, context) => {
|
|
|
234
256
|
* .removal = drops if middy gains typed inference across `.use`; every shape it spans is
|
|
235
257
|
* already named, so only the cast is owed
|
|
236
258
|
*/
|
|
237
|
-
return (0,
|
|
259
|
+
return (0, setHandlerTrailCarrier_1.setHandlerTrailCarrier)({
|
|
260
|
+
handler: (0, core_1.default)(logic).use(middlewares),
|
|
261
|
+
carrier: CARRIER_API_GATEWAY,
|
|
262
|
+
});
|
|
238
263
|
};
|
|
239
264
|
exports.forApiGateway = forApiGateway;
|
|
240
265
|
//# sourceMappingURL=genLambdaEndpoint.forApiGateway.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genLambdaEndpoint.forApiGateway.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAChC,iEAAwC;AACxC,+FAAqE;AACrE,yFAA+D;AAE/D,mDAAkD;
|
|
1
|
+
{"version":3,"file":"genLambdaEndpoint.forApiGateway.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genApiGatewayRequestEventNormalizationMiddleware = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const TrailExidHeader_1 = require("../../../../domain.objects/TrailExidHeader");
|
|
6
|
+
const getIsWrappedPayload_1 = require("../../../lambdaEndpointWire/frame/getIsWrappedPayload");
|
|
4
7
|
const asApiGatewayRequestEventUnified_1 = require("../asApiGatewayRequestEventUnified");
|
|
5
8
|
/**
|
|
6
9
|
* .what = replaces the event with the v1/v2-reconciled shape
|
|
@@ -13,6 +16,25 @@ const asApiGatewayRequestEventUnified_1 = require("../asApiGatewayRequestEventUn
|
|
|
13
16
|
*/
|
|
14
17
|
const genApiGatewayRequestEventNormalizationMiddleware = (input) => {
|
|
15
18
|
const before = async (request) => {
|
|
19
|
+
/**
|
|
20
|
+
* .what = refuses a `{ event, trail }` wrapper, and names the two remedies
|
|
21
|
+
* .why = aws builds every event this family receives and never wraps one, so a wrapper means
|
|
22
|
+
* a caller framed an http event as a direct invoke — the 0.7.1 defect. the opt-in
|
|
23
|
+
* rides the request's `x-trail-exid` header instead (`invariant.ancient-vs-contemp-callers.md`).
|
|
24
|
+
* without this, the throw below says only "neither v1 nor v2" and names no fix
|
|
25
|
+
* .why ConstraintError = a wrapper here is a fault in the frame the caller chose, so the caller
|
|
26
|
+
* fixes it, and its message reaches the response, where its author looks. a public caller
|
|
27
|
+
* cannot send one, since aws builds the event
|
|
28
|
+
*/
|
|
29
|
+
if ((0, getIsWrappedPayload_1.getIsWrappedPayload)(request.event))
|
|
30
|
+
helpful_errors_1.ConstraintError.throw('a { event, trail } wrapper reached an api gateway endpoint; aws never sends one', {
|
|
31
|
+
fix: [
|
|
32
|
+
`run the endpoint through runLambdaEndpoint with an event built by asLambdaEvent.fromApiGateway: it sends the opt-in as an ${TrailExidHeader_1.TRAIL_EXID_HEADER} header`,
|
|
33
|
+
'a copy of that event (spread, structuredClone, json round trip) loses its declaration at the cloud locus: pass the changes to asLambdaEvent.fromApiGateway (headers, requestContext, path, ...) instead of a copy',
|
|
34
|
+
`for a raw event captured from aws, pass struct: { payload: 'ancient' }: it arrives as is, with any ${TrailExidHeader_1.TRAIL_EXID_HEADER} header it holds`,
|
|
35
|
+
'to ask a deployed http endpoint over the network, use askLambdaEndpoint.viaApiGateway',
|
|
36
|
+
],
|
|
37
|
+
});
|
|
16
38
|
/**
|
|
17
39
|
* .as = both casts exist because this middleware is typed `<any, any>`, so `request.event`
|
|
18
40
|
* is `any` on the way in and its declared type on the way out. the transform is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genApiGatewayRequestEventNormalizationMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"genApiGatewayRequestEventNormalizationMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,gFAA+E;AAC/E,+FAA4F;AAC5F,wFAAqF;AAErF;;;;;;;;GAQG;AACI,MAAM,gDAAgD,GAAG,CAAC,KAEhE,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D;;;;;;;;;WASG;QACH,IAAI,IAAA,yCAAmB,EAAC,OAAO,CAAC,KAAK,CAAC;YACpC,gCAAe,CAAC,KAAK,CACnB,iFAAiF,EACjF;gBACE,GAAG,EAAE;oBACH,6HAA6H,mCAAiB,SAAS;oBACvJ,mNAAmN;oBACnN,sGAAsG,mCAAiB,kBAAkB;oBACzI,uFAAuF;iBACxF;aACF,CACF,CAAC;QAEJ;;;;;;;;;WASG;QACH,OAAO,CAAC,KAAK,GAAG,IAAA,iEAA+B,EAC7C,EAAE,IAAI,EAAE,OAAO,CAAC,KAAqC,EAAE,EACvD,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,CACd,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AA9CW,QAAA,gDAAgD,oDA8C3D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import middy from '@middy/core';
|
|
2
2
|
import type { Context } from 'aws-lambda';
|
|
3
3
|
import type { ContextLogTrail } from 'sdk-logs';
|
|
4
|
+
import type { FrozenDeep } from 'type-fns';
|
|
4
5
|
import type { ZodSchema } from 'zod';
|
|
5
6
|
import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
|
|
6
7
|
import type { WrappedPayload } from '../../lambdaEndpointWire/frame/getIsWrappedPayload';
|
|
7
|
-
import { type FrozenDeep } from '../setEventFrozen';
|
|
8
8
|
import type { TranslateLog } from '../TranslateLog';
|
|
9
9
|
/**
|
|
10
10
|
* .what = wrapped payload format: event nested under `event` key with trail
|