sdk-aws-lambda 0.7.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain.objects/LambdaEndpointRefusal.d.ts +25 -0
- package/dist/domain.objects/LambdaEndpointRefusal.js +19 -0
- package/dist/domain.objects/LambdaEndpointRefusal.js.map +1 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.d.ts +25 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.js +28 -0
- package/dist/domain.objects/LambdaEndpointRefusedError.js.map +1 -0
- package/dist/domain.objects/LambdaEventSchemaSource.d.ts +26 -0
- package/dist/domain.objects/LambdaEventSchemaSource.js +11 -0
- package/dist/domain.objects/LambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.d.ts +13 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.js +3 -0
- package/dist/domain.operations/asLambdaEventSchema/KinesisStreamEventDecoded.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.d.ts +19 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.js +3 -0
- package/dist/domain.operations/asLambdaEventSchema/SnsEventDecoded.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.d.ts +37 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js +57 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.d.ts +39 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.d.ts +61 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js +89 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.d.ts +58 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js +81 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js.map +1 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.js +45 -0
- package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +3 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.d.ts +11 -2
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js +7 -2
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.d.ts +10 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js +17 -5
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.d.ts +17 -0
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js +22 -0
- package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +2 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +1 -0
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.d.ts +9 -5
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js +27 -9
- package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.d.ts +15 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js +43 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.d.ts +11 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js +15 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +9 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.d.ts +25 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js +66 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.d.ts +12 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.js +42 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.d.ts +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.js +103 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forSqs → middleware}/asCallerFault.d.ts +4 -3
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forSqs → middleware}/asCallerFault.js +5 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/asCallerFault.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.d.ts +17 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js +26 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +2 -2
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +15 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +34 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +1 -1
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +2 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +8 -4
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -1
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.d.ts +22 -0
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js +34 -0
- package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.d.ts +15 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.js +50 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.d.ts +27 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.js +31 -0
- package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.js.map +1 -0
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.d.ts +15 -4
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js +32 -17
- package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js.map +1 -1
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +12 -0
- package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/readme.md +115 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asCallerFault.js.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIsHttpThrottle = void 0;
|
|
4
|
+
const HttpStatusCode_1 = require("../../../domain.objects/HttpStatusCode");
|
|
5
|
+
/**
|
|
6
|
+
* .what = whether an http status asks the caller to wait, never to fix the request
|
|
7
|
+
* .why = a throttle is a 4xx that is not a refusal: the same request succeeds after `retry-after`,
|
|
8
|
+
* so it is a server fault under either refusal opt (`domain.terms/refusal.md`, F8)
|
|
9
|
+
*
|
|
10
|
+
* .note = names one status, 429, the one rfc 9110 defines as "retry later". widen it here, and only
|
|
11
|
+
* here, if a peer is seen to answer another transient 4xx (a 408, say)
|
|
12
|
+
*/
|
|
13
|
+
const getIsHttpThrottle = (input) => input.status === HttpStatusCode_1.HttpStatusCode.TOO_MANY_REQUESTS_429;
|
|
14
|
+
exports.getIsHttpThrottle = getIsHttpThrottle;
|
|
15
|
+
//# sourceMappingURL=getIsHttpThrottle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIsHttpThrottle.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AAExE;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAyB,EAAW,EAAE,CACtE,KAAK,CAAC,MAAM,KAAK,+BAAc,CAAC,qBAAqB,CAAC;AAD3C,QAAA,iBAAiB,qBAC0B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type FrozenDeep } from 'type-fns';
|
|
5
5
|
import type { ZodSchema } from 'zod';
|
|
6
6
|
import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
|
|
7
7
|
import type { WrappedPayload } from '../../lambdaEndpointWire/frame/getIsWrappedPayload';
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.forAsk = void 0;
|
|
7
7
|
const core_1 = __importDefault(require("@middy/core"));
|
|
8
|
+
const type_fns_1 = require("type-fns");
|
|
8
9
|
const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
|
|
9
10
|
const asContextLogTrail_1 = require("../asContextLogTrail");
|
|
10
11
|
const genConstraintErrorMiddleware_1 = require("../middleware/genConstraintErrorMiddleware");
|
|
@@ -15,6 +16,7 @@ const genTrailMiddleware_1 = require("../middleware/genTrailMiddleware");
|
|
|
15
16
|
const getValidatedOutput_1 = require("../middleware/getValidatedOutput");
|
|
16
17
|
const setEventFrozen_1 = require("../setEventFrozen");
|
|
17
18
|
const genAskEventOnwireCaptureMiddleware_1 = require("./middleware/genAskEventOnwireCaptureMiddleware");
|
|
19
|
+
const genLambdaEventRefusedLogMiddleware_1 = require("./middleware/genLambdaEventRefusedLogMiddleware");
|
|
18
20
|
const genZodEventValidationMiddleware_1 = require("./middleware/genZodEventValidationMiddleware");
|
|
19
21
|
/**
|
|
20
22
|
* .what = the carrier this family reads: a direct invoke owns its whole payload, so the `{ event, trail }`
|
|
@@ -59,7 +61,10 @@ input, context) => {
|
|
|
59
61
|
// 3. trail (onBefore) - injects trail context (must be early so isContempCaller is set for error handlers)
|
|
60
62
|
// 4. io logger - logs input/output for debug
|
|
61
63
|
// 5. introspection (onBefore) - intercepts introspect requests, returns schema
|
|
62
|
-
// 6.
|
|
64
|
+
// 6. refusal log - keeps the unwrapped event; on a caller fault at an event-source endpoint,
|
|
65
|
+
// logs the warn line aws's drop leaves as the only trace (its onError runs before the
|
|
66
|
+
// constraint error handler answers)
|
|
67
|
+
// 7. validation (onBefore) - validates the body, then writes the envelope into `request.event`
|
|
63
68
|
const middlewares = [
|
|
64
69
|
/**
|
|
65
70
|
* .note = this family's response IS its payload, so a caller fault renders as the body
|
|
@@ -78,8 +83,10 @@ input, context) => {
|
|
|
78
83
|
asInputAfter: (request) => request.event,
|
|
79
84
|
asOutputAfter: (schema) => schema,
|
|
80
85
|
}),
|
|
86
|
+
// null for an endpoint whose schema declares no source, so its chain is unchanged
|
|
87
|
+
(0, genLambdaEventRefusedLogMiddleware_1.genLambdaEventRefusedLogMiddleware)({ schema: input.schema.input }),
|
|
81
88
|
(0, genZodEventValidationMiddleware_1.genZodEventValidationMiddleware)({ schema: input.schema.input }),
|
|
82
|
-
];
|
|
89
|
+
].filter(type_fns_1.isPresent);
|
|
83
90
|
/**
|
|
84
91
|
* .as = assertion needed because middleware transforms LambdaHandlerInput<TInputBefore> into
|
|
85
92
|
* AskEventUnified<TInput> before logic runs — it unwraps the frame, runs the codec, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genLambdaEndpoint.forAsk.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;
|
|
1
|
+
{"version":3,"file":"genLambdaEndpoint.forAsk.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAGhC,uCAAsD;AAMtD,kGAA+F;AAC/F,4DAAyD;AACzD,6FAA0F;AAC1F,uGAAoG;AACpG,yFAAsF;AACtF,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;AACtE,sDAAmD;AAEnD,wGAAqG;AACrG,wGAAqG;AACrG,kGAA+F;AAE/F;;;;;GAKG;AACH,MAAM,WAAW,GAAiB,SAAS,CAAC;AAqH5C;;;;;;;;;GASG;AACI,MAAM,MAAM,GAAG;AACpB,4FAA4F;AAC5F,KAA4D,EAC5D,OAAgC,EAQhC,EAAE;IACF,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,EACjB,KAA8B,EAC9B,aAAsB,EACJ,EAAE;QACpB,qFAAqF;QACrF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,qCAAiB,EAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;QAE9D;;;;;;WAMG;QACH,MAA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AAE,CAAC;QAClE,IAAA,iEAA+B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChE,CAAC,MAAM,CAAC,oBAAS,CAAC,CAAC;IAEpB;;;;;OAKG;IACH,OAAO,IAAA,+CAAsB,EAAC;QAC5B,OAAO,EAAE,IAAA,cAAK,EACZ,KAGqB,CACtB,CAAC,GAAG,CAAC,WAAW,CAAC;QAClB,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;AACL,CAAC,CAAC;AAvFW,QAAA,MAAM,UAuFjB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type middy from '@middy/core';
|
|
2
|
+
/**
|
|
3
|
+
* .what = logs `lambda.event.refused` at warn when an event-source endpoint answers a caller
|
|
4
|
+
* fault — a refusal by its `asLambdaEventSchema.*` schema, or one its handler throws
|
|
5
|
+
* .why = `forAsk` answers every caller fault as a success, so aws drops the event: sns does not
|
|
6
|
+
* retry a success, and kinesis advances the shard, outside a tumble window. the warn line is the event's only
|
|
7
|
+
* trace, whichever step refused it
|
|
8
|
+
*
|
|
9
|
+
* .where = after `genTrailMiddleware`, so the log exists when `before` runs; ahead of the
|
|
10
|
+
* validator, so `before` keeps the unwrapped event the validator is about to replace
|
|
11
|
+
* with its envelope. its `onError` reads the log and the event back from there
|
|
12
|
+
* .note = an endpoint whose input schema declares no source gets no step (null; middy refuses an
|
|
13
|
+
* empty one), so every other `forAsk` caller keeps its chain and its debug-only log
|
|
14
|
+
* exactly (F9). a direct caller reads the refusal in its own response
|
|
15
|
+
* .note = it decides with `asCallerFault`, the same predicate `genConstraintErrorMiddleware`
|
|
16
|
+
* answers on, so no fault that drops the event can miss its line, and no fault aws
|
|
17
|
+
* retries gets one
|
|
18
|
+
* .note = it sets no response: `genConstraintErrorMiddleware` still answers the fault. the line is
|
|
19
|
+
* a side effect beside that answer, never a replacement for it
|
|
20
|
+
* .note = a throw from the log sink itself is a server fault, and it surfaces as one: aws then
|
|
21
|
+
* retries the event, so it is not lost (F15)
|
|
22
|
+
*/
|
|
23
|
+
export declare const genLambdaEventRefusedLogMiddleware: (input: {
|
|
24
|
+
schema: unknown;
|
|
25
|
+
}) => middy.MiddlewareObj<any, any> | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genLambdaEventRefusedLogMiddleware = void 0;
|
|
4
|
+
const getOneLambdaEventSchemaSource_1 = require("../../../lambdaEndpointWire/frame/getOneLambdaEventSchemaSource");
|
|
5
|
+
const asCallerFault_1 = require("../../middleware/asCallerFault");
|
|
6
|
+
const asContextTrailed_1 = require("../../middleware/asContextTrailed");
|
|
7
|
+
const logLambdaEventRefused_1 = require("./logLambdaEventRefused");
|
|
8
|
+
/**
|
|
9
|
+
* .what = the key under which the unwrapped event rides in middy's `request.internal`
|
|
10
|
+
* .why = one name, shared by the writer (`before`) and the reader (`onError`), so the two
|
|
11
|
+
* cannot drift
|
|
12
|
+
*/
|
|
13
|
+
const KEY_OF_ASK_EVENT_REFUSABLE = 'askEventRefusable';
|
|
14
|
+
/**
|
|
15
|
+
* .what = logs `lambda.event.refused` at warn when an event-source endpoint answers a caller
|
|
16
|
+
* fault — a refusal by its `asLambdaEventSchema.*` schema, or one its handler throws
|
|
17
|
+
* .why = `forAsk` answers every caller fault as a success, so aws drops the event: sns does not
|
|
18
|
+
* retry a success, and kinesis advances the shard, outside a tumble window. the warn line is the event's only
|
|
19
|
+
* trace, whichever step refused it
|
|
20
|
+
*
|
|
21
|
+
* .where = after `genTrailMiddleware`, so the log exists when `before` runs; ahead of the
|
|
22
|
+
* validator, so `before` keeps the unwrapped event the validator is about to replace
|
|
23
|
+
* with its envelope. its `onError` reads the log and the event back from there
|
|
24
|
+
* .note = an endpoint whose input schema declares no source gets no step (null; middy refuses an
|
|
25
|
+
* empty one), so every other `forAsk` caller keeps its chain and its debug-only log
|
|
26
|
+
* exactly (F9). a direct caller reads the refusal in its own response
|
|
27
|
+
* .note = it decides with `asCallerFault`, the same predicate `genConstraintErrorMiddleware`
|
|
28
|
+
* answers on, so no fault that drops the event can miss its line, and no fault aws
|
|
29
|
+
* retries gets one
|
|
30
|
+
* .note = it sets no response: `genConstraintErrorMiddleware` still answers the fault. the line is
|
|
31
|
+
* a side effect beside that answer, never a replacement for it
|
|
32
|
+
* .note = a throw from the log sink itself is a server fault, and it surfaces as one: aws then
|
|
33
|
+
* retries the event, so it is not lost (F15)
|
|
34
|
+
*/
|
|
35
|
+
const genLambdaEventRefusedLogMiddleware = (input) => {
|
|
36
|
+
// an `asLambdaEventSchema.*` schema declares its source; any other schema declares none
|
|
37
|
+
const source = (0, getOneLambdaEventSchemaSource_1.getOneLambdaEventSchemaSource)({ schema: input.schema });
|
|
38
|
+
if (!source)
|
|
39
|
+
return null;
|
|
40
|
+
const before = async (request) => {
|
|
41
|
+
// keep the unwrapped event, for the ids an operator needs
|
|
42
|
+
// .note = deliberate mutation — `request` is middy's only channel to hand a value onward
|
|
43
|
+
request.internal = {
|
|
44
|
+
...request.internal,
|
|
45
|
+
[KEY_OF_ASK_EVENT_REFUSABLE]: request.event,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const onError = async (request) => {
|
|
49
|
+
// only a caller fault drops the event; a server fault is retried, so it owes no line
|
|
50
|
+
const error = (0, asCallerFault_1.asCallerFault)({ error: request.error });
|
|
51
|
+
if (!error)
|
|
52
|
+
return;
|
|
53
|
+
// a chain with no log (trail never ran) has no sink to write to
|
|
54
|
+
const { log } = (0, asContextTrailed_1.asContextTrailed)({ context: request.context });
|
|
55
|
+
if (!log)
|
|
56
|
+
return;
|
|
57
|
+
(0, logLambdaEventRefused_1.logLambdaEventRefused)({
|
|
58
|
+
event: request.internal?.[KEY_OF_ASK_EVENT_REFUSABLE] ?? null,
|
|
59
|
+
error,
|
|
60
|
+
source,
|
|
61
|
+
}, { log });
|
|
62
|
+
};
|
|
63
|
+
return { before, onError };
|
|
64
|
+
};
|
|
65
|
+
exports.genLambdaEventRefusedLogMiddleware = genLambdaEventRefusedLogMiddleware;
|
|
66
|
+
//# sourceMappingURL=genLambdaEventRefusedLogMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genLambdaEventRefusedLogMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.ts"],"names":[],"mappings":";;;AAEA,mHAAgH;AAChH,kEAA+D;AAC/D,wEAAqE;AACrE,mEAAgE;AAEhE;;;;GAIG;AACH,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,kCAAkC,GAAG,CAAC,KAElD,EAAwC,EAAE;IACzC,wFAAwF;IACxF,MAAM,MAAM,GAAG,IAAA,6DAA6B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,0DAA0D;QAC1D,yFAAyF;QACzF,OAAO,CAAC,QAAQ,GAAG;YACjB,GAAG,OAAO,CAAC,QAAQ;YACnB,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC,KAAK;SAC5C,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,qFAAqF;QACrF,MAAM,KAAK,GAAG,IAAA,6BAAa,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,gEAAgE;QAChE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,IAAA,6CAAqB,EACnB;YACE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,0BAA0B,CAAC,IAAI,IAAI;YAC7D,KAAK;YACL,MAAM;SACP,EACD,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC,CAAC;AApCW,QAAA,kCAAkC,sCAoC7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LambdaEventSchemaSourceName } from '../../../../domain.objects/LambdaEventSchemaSource';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the ids of an aws-delivered event, read per its source, or none when the event is not
|
|
4
|
+
* shaped as its source sends it
|
|
5
|
+
* .why = a refused event is dropped by aws, so the warn line must carry the ids an operator
|
|
6
|
+
* needs to find or replay it. a misrouted event lacks the path, so it yields `[]`, never
|
|
7
|
+
* a throw — this runs inside the catch of a refusal, and a throw would replace it
|
|
8
|
+
*/
|
|
9
|
+
export declare const getAllLambdaEventIds: (input: {
|
|
10
|
+
event: unknown;
|
|
11
|
+
name: LambdaEventSchemaSourceName;
|
|
12
|
+
}) => string[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllLambdaEventIds = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// the one path each source's ids sit at; every other key may be absent on a misrouted event
|
|
6
|
+
const schemaOfSnsIds = zod_1.z.object({
|
|
7
|
+
Records: zod_1.z.array(zod_1.z.object({ Sns: zod_1.z.object({ MessageId: zod_1.z.string() }) })),
|
|
8
|
+
});
|
|
9
|
+
const schemaOfKinesisIds = zod_1.z.object({
|
|
10
|
+
Records: zod_1.z.array(zod_1.z.object({ eventID: zod_1.z.string() })),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* .what = how to read the ids of an event, per source
|
|
14
|
+
* .why = a `Record` keyed by the source name list, so a new source that lacks its reader fails to
|
|
15
|
+
* compile
|
|
16
|
+
* .note = sns: the `MessageId` an operator searches for. kinesis: the `eventID`, which is
|
|
17
|
+
* `${shardId}:${sequenceNumber}`, so it names the range an operator replays
|
|
18
|
+
*/
|
|
19
|
+
const GET_ALL_IDS_BY_SOURCE = {
|
|
20
|
+
sns: (input) => {
|
|
21
|
+
const parsed = schemaOfSnsIds.safeParse(input.event);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
return [];
|
|
24
|
+
return parsed.data.Records.map((record) => record.Sns.MessageId);
|
|
25
|
+
},
|
|
26
|
+
kinesis: (input) => {
|
|
27
|
+
const parsed = schemaOfKinesisIds.safeParse(input.event);
|
|
28
|
+
if (!parsed.success)
|
|
29
|
+
return [];
|
|
30
|
+
return parsed.data.Records.map((record) => record.eventID);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* .what = the ids of an aws-delivered event, read per its source, or none when the event is not
|
|
35
|
+
* shaped as its source sends it
|
|
36
|
+
* .why = a refused event is dropped by aws, so the warn line must carry the ids an operator
|
|
37
|
+
* needs to find or replay it. a misrouted event lacks the path, so it yields `[]`, never
|
|
38
|
+
* a throw — this runs inside the catch of a refusal, and a throw would replace it
|
|
39
|
+
*/
|
|
40
|
+
const getAllLambdaEventIds = (input) => GET_ALL_IDS_BY_SOURCE[input.name]({ event: input.event });
|
|
41
|
+
exports.getAllLambdaEventIds = getAllLambdaEventIds;
|
|
42
|
+
//# sourceMappingURL=getAllLambdaEventIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllLambdaEventIds.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAIxB,4FAA4F;A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CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;AAH7D,QAAA,oBAAoB,wBAGyC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ContextLogTrail } from 'sdk-logs';
|
|
2
|
+
import type { LambdaEventSchemaSource } from '../../../../domain.objects/LambdaEventSchemaSource';
|
|
3
|
+
/**
|
|
4
|
+
* .what = records that an aws-delivered event was refused, by its `asLambdaEventSchema.*` schema
|
|
5
|
+
* or by the handler as a caller fault
|
|
6
|
+
* .why = `forAsk` answers the refusal as a caller fault, so the invoke succeeds and aws drops the
|
|
7
|
+
* event (sns does not retry a success; kinesis advances the shard, outside a tumble window). this line is its one
|
|
8
|
+
* durable trace: the source, the cause, the issue paths, and the ids to find or replay it
|
|
9
|
+
*
|
|
10
|
+
* .note = warn, not error: the lambda ran as intended and the producer is at fault, as for
|
|
11
|
+
* `sqs.record.refused`
|
|
12
|
+
* .note = scoped to event-source endpoints only. every other `forAsk` caller keeps its debug-only
|
|
13
|
+
* log, since a direct caller reads the refusal in its own response
|
|
14
|
+
* .note = `error` is any throw `asCallerFault` accepts, so it is typed `Error`: a
|
|
15
|
+
* `BadRequestError`, or another copy's `ConstraintError`, is not this copy's class
|
|
16
|
+
* .note = `class` reads `constructor.name`, as `logSqsRecordRefused` does: an operator searches
|
|
17
|
+
* for the class the author threw, which the wire's `errorType` (`.name`) may not carry
|
|
18
|
+
* .note = each list is capped (`LINE_LIMIT`), with its full count beside it, so the line fits
|
|
19
|
+
* one cloudwatch event at any batch size
|
|
20
|
+
*/
|
|
21
|
+
export declare const logLambdaEventRefused: (input: {
|
|
22
|
+
event: unknown;
|
|
23
|
+
error: Error;
|
|
24
|
+
source: LambdaEventSchemaSource;
|
|
25
|
+
}, context: {
|
|
26
|
+
log: Pick<ContextLogTrail['log'], 'warn'>;
|
|
27
|
+
}) => void;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logLambdaEventRefused = void 0;
|
|
4
|
+
const getAllLambdaEventIds_1 = require("./getAllLambdaEventIds");
|
|
5
|
+
/**
|
|
6
|
+
* .what = what became of a refused event, per source, in operator words
|
|
7
|
+
* .why = `forAsk` answers a caller fault as a success, so the fate is `forAsk`'s fact and lives
|
|
8
|
+
* here, beside the line that states it, never in the schema layer. a `Record` keyed by
|
|
9
|
+
* the source name list, so a new source that lacks its fate fails to compile
|
|
10
|
+
*/
|
|
11
|
+
const CONSEQUENCE_BY_SOURCE = {
|
|
12
|
+
sns: 'acknowledged; lambda does not retry a success, so this line is the only trace',
|
|
13
|
+
kinesis: 'the whole batch is answered as a success, so lambda does not retry it; this line is the only trace',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* .what = the most of each list one line carries
|
|
17
|
+
* .why = a kinesis batch holds up to 10,000 records, and one bad record can raise an issue per
|
|
18
|
+
* record. uncapped, that line reaches megabytes, past cloudwatch's 256 KB event limit, so
|
|
19
|
+
* it would land split and unparseable, on the very refusal it exists to trace. capped, the
|
|
20
|
+
* line stays a few KB: the counts say how many, and the first and last id bound the range
|
|
21
|
+
* to replay from the stream
|
|
22
|
+
*/
|
|
23
|
+
const LINE_LIMIT = { ids: 100, issues: 20, errorMessageChars: 500 };
|
|
24
|
+
/**
|
|
25
|
+
* .what = the first `limit` items of a list, the full count, and the last item when it was cut
|
|
26
|
+
* .note = `cutLast` is null when every item is shown, since the last is then in `shown`
|
|
27
|
+
*/
|
|
28
|
+
const asListCapped = (input) => ({
|
|
29
|
+
shown: input.items.slice(0, input.limit),
|
|
30
|
+
count: input.items.length,
|
|
31
|
+
cutLast: input.items.length > input.limit ? (input.items.at(-1) ?? null) : null,
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* .what = the error message's first line, cut to a bound
|
|
35
|
+
* .why = a validation error's message restates its issues as pretty json below its first line,
|
|
36
|
+
* which the line's own `issues` already carries
|
|
37
|
+
*/
|
|
38
|
+
const asErrorMessageHeadline = (input) => {
|
|
39
|
+
const [headline = ''] = input.message.split('\n');
|
|
40
|
+
return headline.length > LINE_LIMIT.errorMessageChars
|
|
41
|
+
? `${headline.slice(0, LINE_LIMIT.errorMessageChars)}…`
|
|
42
|
+
: headline;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* .what = the issue summaries a refusal carries, or none
|
|
46
|
+
* .why = a schema refusal arrives via `getValidationError`, whose metadata holds `issues`. but a
|
|
47
|
+
* caller fault a consumer's own code throws (a `.refine`, an `X.contract()` constructor,
|
|
48
|
+
* the handler itself) carries metadata of its own shape, or none. so `issues` is read,
|
|
49
|
+
* never assumed
|
|
50
|
+
* .note = typed `unknown[]`, not this copy's `ZodIssueSummary[]`: the elements pass to the log
|
|
51
|
+
* as-is, so a foreign copy's issues reach the operator whole rather than filtered out
|
|
52
|
+
*/
|
|
53
|
+
const getIssuesOfRefusal = (input) => {
|
|
54
|
+
const metadata = Reflect.get(input.error, 'metadata');
|
|
55
|
+
if (typeof metadata !== 'object' || metadata === null)
|
|
56
|
+
return [];
|
|
57
|
+
const issues = Reflect.get(metadata, 'issues');
|
|
58
|
+
return Array.isArray(issues) ? issues : [];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* .what = records that an aws-delivered event was refused, by its `asLambdaEventSchema.*` schema
|
|
62
|
+
* or by the handler as a caller fault
|
|
63
|
+
* .why = `forAsk` answers the refusal as a caller fault, so the invoke succeeds and aws drops the
|
|
64
|
+
* event (sns does not retry a success; kinesis advances the shard, outside a tumble window). this line is its one
|
|
65
|
+
* durable trace: the source, the cause, the issue paths, and the ids to find or replay it
|
|
66
|
+
*
|
|
67
|
+
* .note = warn, not error: the lambda ran as intended and the producer is at fault, as for
|
|
68
|
+
* `sqs.record.refused`
|
|
69
|
+
* .note = scoped to event-source endpoints only. every other `forAsk` caller keeps its debug-only
|
|
70
|
+
* log, since a direct caller reads the refusal in its own response
|
|
71
|
+
* .note = `error` is any throw `asCallerFault` accepts, so it is typed `Error`: a
|
|
72
|
+
* `BadRequestError`, or another copy's `ConstraintError`, is not this copy's class
|
|
73
|
+
* .note = `class` reads `constructor.name`, as `logSqsRecordRefused` does: an operator searches
|
|
74
|
+
* for the class the author threw, which the wire's `errorType` (`.name`) may not carry
|
|
75
|
+
* .note = each list is capped (`LINE_LIMIT`), with its full count beside it, so the line fits
|
|
76
|
+
* one cloudwatch event at any batch size
|
|
77
|
+
*/
|
|
78
|
+
const logLambdaEventRefused = (input, context) => {
|
|
79
|
+
const ids = asListCapped({
|
|
80
|
+
items: (0, getAllLambdaEventIds_1.getAllLambdaEventIds)({
|
|
81
|
+
event: input.event,
|
|
82
|
+
name: input.source.name,
|
|
83
|
+
}),
|
|
84
|
+
limit: LINE_LIMIT.ids,
|
|
85
|
+
});
|
|
86
|
+
const issues = asListCapped({
|
|
87
|
+
items: getIssuesOfRefusal({ error: input.error }),
|
|
88
|
+
limit: LINE_LIMIT.issues,
|
|
89
|
+
});
|
|
90
|
+
context.log.warn('lambda.event.refused', {
|
|
91
|
+
source: input.source.name,
|
|
92
|
+
ids: ids.shown,
|
|
93
|
+
idsCount: ids.count,
|
|
94
|
+
idLast: ids.cutLast,
|
|
95
|
+
class: input.error.constructor.name,
|
|
96
|
+
errorMessage: asErrorMessageHeadline({ message: input.error.message }),
|
|
97
|
+
issues: issues.shown,
|
|
98
|
+
issuesCount: issues.count,
|
|
99
|
+
consequence: CONSEQUENCE_BY_SOURCE[input.source.name],
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
exports.logLambdaEventRefused = logLambdaEventRefused;
|
|
103
|
+
//# sourceMappingURL=logLambdaEventRefused.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logLambdaEventRefused.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.ts"],"names":[],"mappings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AK,CAAC,MAAM,CAAC,IAAI,CAAC;KACtD,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,qBAAqB,yBA8BhC"}
|
|
@@ -8,8 +8,8 @@ const core_1 = __importDefault(require("@middy/core"));
|
|
|
8
8
|
const helpful_errors_1 = require("helpful-errors");
|
|
9
9
|
const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
|
|
10
10
|
const asContextLogTrail_1 = require("../asContextLogTrail");
|
|
11
|
+
const asCallerFault_1 = require("../middleware/asCallerFault");
|
|
11
12
|
const setEventFrozen_1 = require("../setEventFrozen");
|
|
12
|
-
const asCallerFault_1 = require("./asCallerFault");
|
|
13
13
|
const asSqsEventDecoded_1 = require("./asSqsEventDecoded");
|
|
14
14
|
const asSqsRecordDecoded_1 = require("./asSqsRecordDecoded");
|
|
15
15
|
const genSqsEndpointMiddlewares_1 = require("./genSqsEndpointMiddlewares");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genLambdaEndpoint.forSqs.perRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,mDAAkD;AAMlD,kGAA+F;AAC/F,4DAAyD;AACzD,sDAAmD;AAEnD,
|
|
1
|
+
{"version":3,"file":"genLambdaEndpoint.forSqs.perRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,mDAAkD;AAMlD,kGAA+F;AAC/F,4DAAyD;AACzD,+DAA4D;AAC5D,sDAAmD;AAEnD,2DAAwD;AACxD,6DAA2D;AAC3D,2EAGqC;AACrC,+DAA4D;AAM5D,mEAAgE;AA+GhE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM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;gBACE,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,KAAK,EAAE,WAAW;aACnB,EACD,EAAE,GAAG,EAAE,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mGAAmG;YACnG,MAAM,WAAW,GAAG,IAAA,6BAAa,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW;gBAAE,MAAM,KAAK,CAAC;YAE9B,qGAAqG;YACrG,IAAA,yCAAmB,EACjB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,EAC7C,EAAE,GAAG,EAAE,CACR,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,IAAA,+CAAsB,EAAC;QAC5B,OAAO,EAAE,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,GAAG,CACvB,IAAA,qDAAyB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CACjE;QACD,OAAO,EAAE,uCAAW;KACrB,CAAC,CAAC;AACL,CAAC,CAAC;AA9GW,QAAA,SAAS,aA8GpB"}
|
package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setSqsRecordsValidated = void 0;
|
|
4
|
-
const asCallerFault_1 = require("
|
|
4
|
+
const asCallerFault_1 = require("../middleware/asCallerFault");
|
|
5
5
|
const logSqsRecordInvalid_1 = require("./logSqsRecordInvalid");
|
|
6
6
|
const logSqsRecordRefused_1 = require("./logSqsRecordRefused");
|
|
7
7
|
const setSqsRecordValidated_1 = require("./setSqsRecordValidated");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setSqsRecordsValidated.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.ts"],"names":[],"mappings":";;;AAGA
|
|
1
|
+
{"version":3,"file":"setSqsRecordsValidated.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.ts"],"names":[],"mappings":";;;AAGA,+DAA4D;AAC5D,+DAA4D;AAC5D,+DAA4D;AAM5D,mEAAgE;AAEhE;;;;;;;;;;;;GAYG;AACI,MAAM,sBAAsB,GAAG,CAIpC,KAGC,EACD,OAAgE,EAOhE,EAAE;IACF,MAAM,gBAAgB,GAGf,EAAE,CAAC;IACV,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,gBAAgB,CAAC,IAAI,CACnB,IAAA,6CAAqB,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CACxD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,wCAAwC;YACxC,MAAM,WAAW,GAAG,IAAA,6BAAa,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7C,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAA,yCAAmB,EACjB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,EAC7C,OAAO,CACR,CAAC;gBACF,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAC1B,SAAS;YACX,CAAC;YAED,qFAAqF;YACrF,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YAE3C,4FAA4F;YAC5F,IAAA,yCAAmB,EAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;AAC1C,CAAC,CAAC;AAhDW,QAAA,sBAAsB,0BAgDjC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* .what = the thrown value as a caller fault, or null when it is not one
|
|
3
|
-
* .why =
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* .why = every family that acts on a caller fault decides on this one answer, so it is stated
|
|
4
|
+
* once: both sqs variants decide delete-vs-redrive on it (a variant that disagreed would
|
|
5
|
+
* delete a message its peer redrives, `invariant.constraint-errors-never-redrive-sqs`),
|
|
6
|
+
* and `forAsk` decides on it whether a dropped aws event owes its warn line
|
|
6
7
|
*
|
|
7
8
|
* .note = a caller fault is an `Error` that `getIsConstraintError` accepts — a `ConstraintError`,
|
|
8
9
|
* a `BadRequestError`, or a subclass. any other value, a bare `{ name }` bag included, is
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asCallerFault = void 0;
|
|
4
|
-
const getIsConstraintError_1 = require("
|
|
4
|
+
const getIsConstraintError_1 = require("./getIsConstraintError");
|
|
5
5
|
/**
|
|
6
6
|
* .what = the thrown value as a caller fault, or null when it is not one
|
|
7
|
-
* .why =
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* .why = every family that acts on a caller fault decides on this one answer, so it is stated
|
|
8
|
+
* once: both sqs variants decide delete-vs-redrive on it (a variant that disagreed would
|
|
9
|
+
* delete a message its peer redrives, `invariant.constraint-errors-never-redrive-sqs`),
|
|
10
|
+
* and `forAsk` decides on it whether a dropped aws event owes its warn line
|
|
10
11
|
*
|
|
11
12
|
* .note = a caller fault is an `Error` that `getIsConstraintError` accepts — a `ConstraintError`,
|
|
12
13
|
* a `BadRequestError`, or a subclass. any other value, a bare `{ name }` bag included, is
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asCallerFault.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/asCallerFault.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAE9D;;;;;;;;;;;GAWG;AACI,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAgB,EAAE,CACvE,KAAK,CAAC,KAAK,YAAY,KAAK,IAAI,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1E,CAAC,CAAC,KAAK,CAAC,KAAK;IACb,CAAC,CAAC,IAAI,CAAC;AAHE,QAAA,aAAa,iBAGf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContextLogTrail } from 'sdk-logs';
|
|
2
|
+
/**
|
|
3
|
+
* .what = picks the log method a failure is written with: warn for a caller fault, error for all else
|
|
4
|
+
* .why = a failure must never log at debug beside a success. the invocation of a handled failure
|
|
5
|
+
* still reads a success to aws, so the log level is the only signal on-call has
|
|
6
|
+
* (sdk-aws-lambda#77: 24 prod failures hid at debug)
|
|
7
|
+
*
|
|
8
|
+
* .note = where trail has not yet put a `log` on the context — a `before` hook that throws ahead
|
|
9
|
+
* of it — this falls back to `console`, as `genInternalServiceErrorMiddleware` does, so no
|
|
10
|
+
* observed failure goes unlogged
|
|
11
|
+
* .note = returns a call bound to its own sink, never a bare method reference, so the method runs
|
|
12
|
+
* with its receiver whatever the log's implementation reads from `this`
|
|
13
|
+
*/
|
|
14
|
+
export declare const asLogMethodOfFailure: (input: {
|
|
15
|
+
error: unknown;
|
|
16
|
+
log: ContextLogTrail['log'] | null;
|
|
17
|
+
}) => ((message: string, metadata: Record<string, unknown>) => void);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asLogMethodOfFailure = void 0;
|
|
4
|
+
const getIsConstraintError_1 = require("./getIsConstraintError");
|
|
5
|
+
/**
|
|
6
|
+
* .what = picks the log method a failure is written with: warn for a caller fault, error for all else
|
|
7
|
+
* .why = a failure must never log at debug beside a success. the invocation of a handled failure
|
|
8
|
+
* still reads a success to aws, so the log level is the only signal on-call has
|
|
9
|
+
* (sdk-aws-lambda#77: 24 prod failures hid at debug)
|
|
10
|
+
*
|
|
11
|
+
* .note = where trail has not yet put a `log` on the context — a `before` hook that throws ahead
|
|
12
|
+
* of it — this falls back to `console`, as `genInternalServiceErrorMiddleware` does, so no
|
|
13
|
+
* observed failure goes unlogged
|
|
14
|
+
* .note = returns a call bound to its own sink, never a bare method reference, so the method runs
|
|
15
|
+
* with its receiver whatever the log's implementation reads from `this`
|
|
16
|
+
*/
|
|
17
|
+
const asLogMethodOfFailure = (input) => {
|
|
18
|
+
const sink = input.log ?? console;
|
|
19
|
+
// a caller fault is the caller's to fix, so someone should look soon — never wake anyone
|
|
20
|
+
if ((0, getIsConstraintError_1.getIsConstraintError)({ error: input.error }))
|
|
21
|
+
return (message, metadata) => sink.warn(message, metadata);
|
|
22
|
+
// every other fault is ours to fix
|
|
23
|
+
return (message, metadata) => sink.error(message, metadata);
|
|
24
|
+
};
|
|
25
|
+
exports.asLogMethodOfFailure = asLogMethodOfFailure;
|
|
26
|
+
//# sourceMappingURL=asLogMethodOfFailure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asLogMethodOfFailure.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAE9D;;;;;;;;;;;GAWG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAGpC,EAAkE,EAAE;IACnE,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC;IAElC,yFAAyF;IACzF,IAAI,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE7D,mCAAmC;IACnC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B"}
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js
CHANGED
|
@@ -42,8 +42,8 @@ const genInternalServiceErrorMiddleware = (opts) => {
|
|
|
42
42
|
* at all is a disclosure call, and it belongs to the wisher — tracked as `F02`.
|
|
43
43
|
* a log line crosses no trust boundary, so THIS half needed no such call
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// call the method on its own sink, so it runs with its receiver whatever the log reads from `this`
|
|
46
|
+
(log ?? console).error('handler.error', {
|
|
47
47
|
endpoint: request.context
|
|
48
48
|
?.functionName ?? null,
|
|
49
49
|
errorMessage: error.message,
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;GASG;AACI,MAAM,iCAAiC,GAAG,CAAC,IAqBjD,EAEC,EAAE;IACF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,4DAA4D;QAC5D,yEAAyE;QACzE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,YAAY;YAAE,OAAO;QAEzB,iEAAiE;QACjE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/D;;;;;;;;;;;;;;;;WAgBG;QACH,
|
|
1
|
+
{"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;GASG;AACI,MAAM,iCAAiC,GAAG,CAAC,IAqBjD,EAEC,EAAE;IACF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,4DAA4D;QAC5D,yEAAyE;QACzE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,YAAY;YAAE,OAAO;QAEzB,iEAAiE;QACjE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/D;;;;;;;;;;;;;;;;WAgBG;QACH,mGAAmG;QACnG,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE;YACtC,QAAQ,EACL,OAAO,CAAC,OAAiD;gBACxD,EAAE,YAAY,IAAI,IAAI;YAC1B,YAAY,EAAE,KAAK,CAAC,OAAO;YAC3B,UAAU,EAAE,KAAK,CAAC,KAAK;SACxB,CAAC,CAAC;QAEH,sFAAsF;QACtF,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK;YAAE,MAAM,KAAK,CAAC;QAE9C,2DAA2D;QAC3D,MAAM,IAAI,GAAG,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,IAAI,CAAC;QAEtC;;;;;;WAMG;QACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC;AA9EW,QAAA,iCAAiC,qCA8E5C"}
|
|
@@ -4,6 +4,21 @@ import type { TranslateLog } from '../TranslateLog';
|
|
|
4
4
|
* .what = middleware that logs handler input and output
|
|
5
5
|
* .why = enables debug observability with optional redaction via translate.log
|
|
6
6
|
*
|
|
7
|
+
* | outcome | `handler.output` level |
|
|
8
|
+
* |---|---|
|
|
9
|
+
* | success | debug |
|
|
10
|
+
* | caller fault (`getIsConstraintError`) | warn |
|
|
11
|
+
* | any other fault | error |
|
|
12
|
+
*
|
|
13
|
+
* .note = a handled failure still reads a success to aws, so the level is on-call's only signal
|
|
14
|
+
* (sdk-aws-lambda#77). where trail has not yet put a `log` on the context, the failure
|
|
15
|
+
* line falls back to `console` (`asLogMethodOfFailure`)
|
|
16
|
+
* .note = the error branch logs `errorMessage` + `stackTrace` raw; `logTranslate.output` reads
|
|
17
|
+
* only the response branch
|
|
18
|
+
* .note = a server fault writes two error lines: this `handler.output`, then
|
|
19
|
+
* `genInternalServiceErrorMiddleware`'s `handler.error`. an alarm that counts error lines
|
|
20
|
+
* reads two per fault; count by `message` to read one (F5, accepted)
|
|
21
|
+
*
|
|
7
22
|
* .defect = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
|
|
8
23
|
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch instead
|
|
9
24
|
*
|