sdk-aws-lambda 0.8.0 → 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.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/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/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 +7 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +42 -2
|
@@ -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
|
*
|
|
@@ -2,10 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genIoLoggerMiddleware = void 0;
|
|
4
4
|
const asContextTrailed_1 = require("./asContextTrailed");
|
|
5
|
+
const asLogMethodOfFailure_1 = require("./asLogMethodOfFailure");
|
|
5
6
|
/**
|
|
6
7
|
* .what = middleware that logs handler input and output
|
|
7
8
|
* .why = enables debug observability with optional redaction via translate.log
|
|
8
9
|
*
|
|
10
|
+
* | outcome | `handler.output` level |
|
|
11
|
+
* |---|---|
|
|
12
|
+
* | success | debug |
|
|
13
|
+
* | caller fault (`getIsConstraintError`) | warn |
|
|
14
|
+
* | any other fault | error |
|
|
15
|
+
*
|
|
16
|
+
* .note = a handled failure still reads a success to aws, so the level is on-call's only signal
|
|
17
|
+
* (sdk-aws-lambda#77). where trail has not yet put a `log` on the context, the failure
|
|
18
|
+
* line falls back to `console` (`asLogMethodOfFailure`)
|
|
19
|
+
* .note = the error branch logs `errorMessage` + `stackTrace` raw; `logTranslate.output` reads
|
|
20
|
+
* only the response branch
|
|
21
|
+
* .note = a server fault writes two error lines: this `handler.output`, then
|
|
22
|
+
* `genInternalServiceErrorMiddleware`'s `handler.error`. an alarm that counts error lines
|
|
23
|
+
* reads two per fault; count by `message` to read one (F5, accepted)
|
|
24
|
+
*
|
|
9
25
|
* .defect = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
|
|
10
26
|
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch instead
|
|
11
27
|
*
|
|
@@ -46,20 +62,25 @@ const genIoLoggerMiddleware = (input) => {
|
|
|
46
62
|
}
|
|
47
63
|
};
|
|
48
64
|
const onError = async (request) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
}
|
|
65
|
+
// a failure logs at warn (caller fault) or error (all else), never at debug
|
|
66
|
+
const logFailure = (0, asLogMethodOfFailure_1.asLogMethodOfFailure)({
|
|
67
|
+
error: request.error,
|
|
68
|
+
log: (0, asContextTrailed_1.asContextTrailed)({ context: request.context }).log ?? null,
|
|
69
|
+
});
|
|
70
|
+
// log what the caller received, where an error builder already set it
|
|
71
|
+
if (request.response) {
|
|
72
|
+
logFailure('handler.output', {
|
|
73
|
+
response: translateOutput(request.response),
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
62
76
|
}
|
|
77
|
+
// log the failure itself; onError runs only on a throw, so a thrown non-Error (a string, a
|
|
78
|
+
// falsy value, `undefined`) still logs, and names what was thrown
|
|
79
|
+
const thrown = request.error;
|
|
80
|
+
logFailure('handler.output', {
|
|
81
|
+
errorMessage: thrown instanceof Error ? thrown.message : String(thrown),
|
|
82
|
+
stackTrace: thrown instanceof Error ? thrown.stack : null,
|
|
83
|
+
});
|
|
63
84
|
};
|
|
64
85
|
return { before, after, onError };
|
|
65
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;
|
|
1
|
+
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAErC,EAIC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,eAAe,GACnB,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,MAAM,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KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;YACvE,UAAU,EAAE,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SAC1D,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC;AApDW,QAAA,qBAAqB,yBAoDhC"}
|
|
@@ -25,7 +25,7 @@ const asMechanismsFileSource = (input) => {
|
|
|
25
25
|
const usedResourceNames = input.resourceNames.filter((name) => new RegExp(`\\b${name}\\b`).test(fnsText));
|
|
26
26
|
// the import lines: askLambdaEndpoint always; resource types only if any used
|
|
27
27
|
const imports = [
|
|
28
|
-
`import { askLambdaEndpoint, type ContextAwsLambdaCaller } from 'sdk-aws-lambda';`,
|
|
28
|
+
`import { askLambdaEndpoint, type ContextAwsLambdaCaller, type LambdaEndpointRefusal } from 'sdk-aws-lambda';`,
|
|
29
29
|
];
|
|
30
30
|
if (usedResourceNames.length > 0)
|
|
31
31
|
imports.push(`import type { ${usedResourceNames.join(', ')} } from '${input.resourcesModule}';`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asMechanismsFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAOtC,EAAU,EAAE;IACX,8EAA8E;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;SACrC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,IAAA,yCAAmB,EAAC;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAyB;QACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,iFAAiF;IACjF,iFAAiF;IACjF,oFAAoF;IACpF,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAC1C,CAAC;IAEF,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACd,
|
|
1
|
+
{"version":3,"file":"asMechanismsFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAOtC,EAAU,EAAE;IACX,8EAA8E;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;SACrC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,IAAA,yCAAmB,EAAC;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAyB;QACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,iFAAiF;IACjF,iFAAiF;IACjF,oFAAoF;IACpF,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAC1C,CAAC;IAEF,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACd,8GAA8G;KAC/G,CAAC;IACF,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAC9B,OAAO,CAAC,IAAI,CACV,iBAAiB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,eAAe,IAAI,CACnF,CAAC;IAEJ,OAAO;QACL,eAAM;QACN,EAAE;QACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,EAAE;QACF,gBAAgB,KAAK,CAAC,MAAM,MAAM;QAClC,OAAO;QACP,IAAI;QACJ,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AA/CW,QAAA,sBAAsB,0BA+CjC"}
|
|
@@ -12,6 +12,8 @@ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpoin
|
|
|
12
12
|
* two differ, and there `event` names the envelope while `payload` names its body
|
|
13
13
|
*
|
|
14
14
|
* .note = the wrapper keeps the caller's `context` ambient (env.access lives there)
|
|
15
|
+
* .note = `options.refusal` is the same opt `askLambdaEndpoint` takes, so a call through the
|
|
16
|
+
* generated sdk can pass a peer refusal through as a `ConstraintError` (sdk-aws-lambda#77)
|
|
15
17
|
*/
|
|
16
18
|
export declare const asMechanismFnSource: (input: {
|
|
17
19
|
service: string;
|
|
@@ -15,6 +15,8 @@ const getTypescriptFromJsonSchema_1 = require("./getTypescriptFromJsonSchema");
|
|
|
15
15
|
* two differ, and there `event` names the envelope while `payload` names its body
|
|
16
16
|
*
|
|
17
17
|
* .note = the wrapper keeps the caller's `context` ambient (env.access lives there)
|
|
18
|
+
* .note = `options.refusal` is the same opt `askLambdaEndpoint` takes, so a call through the
|
|
19
|
+
* generated sdk can pass a peer refusal through as a `ConstraintError` (sdk-aws-lambda#77)
|
|
18
20
|
*/
|
|
19
21
|
const asMechanismFnSource = (input) => {
|
|
20
22
|
// the typed shapes for this endpoint's event (input) and result (output)
|
|
@@ -26,16 +28,18 @@ const asMechanismFnSource = (input) => {
|
|
|
26
28
|
schema: input.schema.output,
|
|
27
29
|
dobjRefs: input.dobjRefs,
|
|
28
30
|
});
|
|
29
|
-
// the fn: passes which + event to askLambdaEndpoint, threads
|
|
30
|
-
// the explicit <event, result> generics make the call
|
|
31
|
-
// sees the contract at the call site, not only via the
|
|
31
|
+
// the fn: passes which + event + the refusal opt to askLambdaEndpoint, threads
|
|
32
|
+
// context through. the explicit <event, result> generics make the call
|
|
33
|
+
// self-evident — a reader sees the contract at the call site, not only via the
|
|
34
|
+
// outer annotation
|
|
32
35
|
return [
|
|
33
36
|
` ${input.function}: (`,
|
|
34
37
|
` event: ${eventType},`,
|
|
35
38
|
` context: ContextAwsLambdaCaller,`,
|
|
39
|
+
` options?: { refusal?: LambdaEndpointRefusal },`,
|
|
36
40
|
` ): Promise<${resultType}> =>`,
|
|
37
41
|
` askLambdaEndpoint<${eventType}, ${resultType}>(`,
|
|
38
|
-
` { which: { service: ${JSON.stringify(input.service)}, function: ${JSON.stringify(input.function)} }, event },`,
|
|
42
|
+
` { which: { service: ${JSON.stringify(input.service)}, function: ${JSON.stringify(input.function)} }, event, refusal: options?.refusal },`,
|
|
39
43
|
` context,`,
|
|
40
44
|
` ),`,
|
|
41
45
|
].join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asMechanismFnSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.ts"],"names":[],"mappings":";;;AACA,+EAA4E;AAE5E
|
|
1
|
+
{"version":3,"file":"asMechanismFnSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.ts"],"names":[],"mappings":";;;AACA,+EAA4E;AAE5E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAKnC,EAAU,EAAE;IACX,yEAAyE;IACzE,MAAM,SAAS,GAAG,IAAA,yDAA2B,EAAC;QAC5C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;QAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAA,yDAA2B,EAAC;QAC7C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,+EAA+E;IAC/E,uEAAuE;IACvE,+EAA+E;IAC/E,mBAAmB;IACnB,OAAO;QACL,KAAK,KAAK,CAAC,QAAQ,KAAK;QACxB,cAAc,SAAS,GAAG;QAC1B,sCAAsC;QACtC,oDAAoD;QACpD,gBAAgB,UAAU,MAAM;QAChC,yBAAyB,SAAS,KAAK,UAAU,IAAI;QACrD,6BAA6B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,yCAAyC;QAChJ,gBAAgB;QAChB,QAAQ;KACT,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AA/BW,QAAA,mBAAmB,uBA+B9B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConstraintError } from 'helpful-errors';
|
|
2
|
+
import type { LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
|
|
3
|
+
import { LambdaEndpointRefusedError, type LambdaEndpointRefusedErrorMetadata } from '../../../domain.objects/LambdaEndpointRefusedError';
|
|
4
|
+
/**
|
|
5
|
+
* .what = casts a peer endpoint's refusal into the error its caller throws
|
|
6
|
+
* .why = a peer's caller fault names a fault in the request this caller composed, so by default
|
|
7
|
+
* it is this caller's malfunction (`LambdaEndpointRefusedError`). a caller that forwards
|
|
8
|
+
* its own caller's input verbatim names `ConstraintError`, and gets today's class, with
|
|
9
|
+
* today's message and metadata, byte for byte
|
|
10
|
+
*
|
|
11
|
+
* .note = the refusal's message names the fix, since its metadata shape has no `hint` field and
|
|
12
|
+
* a human reads the message first (rule.require.errors-name-the-fix)
|
|
13
|
+
* .note = shared by both ask roads — the invoke hydration and the http one — so one vocabulary
|
|
14
|
+
* serves either (rule.require.consistent-variant-contracts)
|
|
15
|
+
*/
|
|
16
|
+
export declare const asErrorFromPeerRefusal: (input: {
|
|
17
|
+
refusal: LambdaEndpointRefusal;
|
|
18
|
+
peer: string;
|
|
19
|
+
message: string;
|
|
20
|
+
errorType: string;
|
|
21
|
+
metadata: LambdaEndpointRefusedErrorMetadata;
|
|
22
|
+
}) => ConstraintError | LambdaEndpointRefusedError;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asErrorFromPeerRefusal = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const LambdaEndpointRefusedError_1 = require("../../../domain.objects/LambdaEndpointRefusedError");
|
|
6
|
+
/**
|
|
7
|
+
* .what = casts a peer endpoint's refusal into the error its caller throws
|
|
8
|
+
* .why = a peer's caller fault names a fault in the request this caller composed, so by default
|
|
9
|
+
* it is this caller's malfunction (`LambdaEndpointRefusedError`). a caller that forwards
|
|
10
|
+
* its own caller's input verbatim names `ConstraintError`, and gets today's class, with
|
|
11
|
+
* today's message and metadata, byte for byte
|
|
12
|
+
*
|
|
13
|
+
* .note = the refusal's message names the fix, since its metadata shape has no `hint` field and
|
|
14
|
+
* a human reads the message first (rule.require.errors-name-the-fix)
|
|
15
|
+
* .note = shared by both ask roads — the invoke hydration and the http one — so one vocabulary
|
|
16
|
+
* serves either (rule.require.consistent-variant-contracts)
|
|
17
|
+
*/
|
|
18
|
+
const asErrorFromPeerRefusal = (input) => {
|
|
19
|
+
// pass-through: the caller declared the request its own caller's, so the fault stays a caller fault
|
|
20
|
+
if (input.refusal.as === 'ConstraintError')
|
|
21
|
+
return new helpful_errors_1.ConstraintError(input.message, input.metadata);
|
|
22
|
+
// default: the caller composed the request, so the fault is the caller's own malfunction
|
|
23
|
+
if (input.refusal.as === 'LambdaEndpointRefusedError')
|
|
24
|
+
return new LambdaEndpointRefusedError_1.LambdaEndpointRefusedError(
|
|
25
|
+
// the fix stands in its own paragraph, so a log reader finds it apart from the peer's json
|
|
26
|
+
`${input.peer} refused the request: ${input.message}\n\nthis caller composed the request. if it forwards its own caller's input verbatim, opt in with refusal: { as: 'ConstraintError' }`, { ...input.metadata, errorType: input.errorType });
|
|
27
|
+
// a third opt added to the union fails to compile here, never falls through to a wrong class
|
|
28
|
+
const refusalUnknown = input.refusal.as;
|
|
29
|
+
return helpful_errors_1.UnexpectedCodePathError.throw('refusal opt has no cast', {
|
|
30
|
+
refusal: refusalUnknown,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.asErrorFromPeerRefusal = asErrorFromPeerRefusal;
|
|
34
|
+
//# sourceMappingURL=asErrorFromPeerRefusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asErrorFromPeerRefusal.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAG1E,mGAG4D;AAE5D;;;;;;;;;;;GAWG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAMtC,EAAgD,EAAE;IACjD,oGAAoG;IACpG,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,iBAAiB;QACxC,OAAO,IAAI,gCAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE5D,yFAAyF;IACzF,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,4BAA4B;QACnD,OAAO,IAAI,uDAA0B;QACnC,2FAA2F;QAC3F,GAAG,KAAK,CAAC,IAAI,yBAAyB,KAAK,CAAC,OAAO,sIAAsI,EACzL,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAClD,CAAC;IAEJ,6FAA6F;IAC7F,MAAM,cAAc,GAAU,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/C,OAAO,wCAAuB,CAAC,KAAK,CAAC,yBAAyB,EAAE;QAC9D,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,sBAAsB,0BAwBjC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
|
|
2
|
+
import type { LambdaEndpointRefusal } from '../../domain.objects/LambdaEndpointRefusal';
|
|
2
3
|
/**
|
|
3
4
|
* .what = reads a lambda's raw wire response, and throws whatever fault it carries
|
|
4
5
|
* .why = this is the SERIALIZED boundary's hydration step — the one place a
|
|
@@ -12,15 +13,18 @@ import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
|
|
|
12
13
|
* | # | when | it throws |
|
|
13
14
|
* |---|---|---|
|
|
14
15
|
* | 1 | the payload is absent or is not json | `LambdaEndpointError` |
|
|
15
|
-
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | `
|
|
16
|
-
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | `
|
|
16
|
+
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | the `refusal` class when `class` is `ConstraintError`; else `LambdaEndpointError` |
|
|
17
|
+
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | the `refusal` class when `errorType` is `ConstraintError` **or** `BadRequestError`; else `LambdaEndpointError` |
|
|
17
18
|
* | 4 | aws reported a `functionError` and no shape above matched | `LambdaEndpointError`, with the payload in `details` |
|
|
18
19
|
* | 5 | none of the above | returns the payload as `TResponse` |
|
|
19
20
|
*
|
|
20
21
|
* ⚠️ **rows 2 and 3 split on the same question and answer it differently**, which
|
|
21
22
|
* is deliberate: a caller's bad request is not a lambda failure, so it
|
|
22
|
-
* hydrates to `
|
|
23
|
-
* (`invariant.badrequesterror-not-lambda-error`). the
|
|
23
|
+
* hydrates to the `refusal` class rather than to an invocation error
|
|
24
|
+
* (`invariant.badrequesterror-not-lambda-error`). the `refusal` class is
|
|
25
|
+
* `LambdaEndpointRefusedError` on an ask road — the asker composed the request,
|
|
26
|
+
* so the refusal is its own malfunction — and `ConstraintError` where the caller
|
|
27
|
+
* opted in, or is the test author (`onSerialized`). the ancient arm accepts
|
|
24
28
|
* `BadRequestError` too, because that is the name the legacy family emits for
|
|
25
29
|
* the same fact (`invariant.ancient-vs-contemp-callers`).
|
|
26
30
|
*
|
|
@@ -42,4 +46,11 @@ export declare const getParsedResponse: <TResponse>(input: {
|
|
|
42
46
|
functionError: string | undefined;
|
|
43
47
|
endpoint: LambdaEndpoint;
|
|
44
48
|
exid: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* .what = the class a peer's caller fault becomes
|
|
51
|
+
* .why = an ask road's caller composed the request, so its default is
|
|
52
|
+
* `LambdaEndpointRefusedError`; `runLambdaEndpoint.onSerialized`'s caller IS the party
|
|
53
|
+
* at fault, so it names `ConstraintError`
|
|
54
|
+
*/
|
|
55
|
+
refusal: LambdaEndpointRefusal;
|
|
45
56
|
}) => TResponse;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getParsedResponse = void 0;
|
|
4
|
-
const helpful_errors_1 = require("helpful-errors");
|
|
5
4
|
const LambdaEndpointError_1 = require("../../domain.objects/LambdaEndpointError");
|
|
5
|
+
const asErrorFromPeerRefusal_1 = require("./error/asErrorFromPeerRefusal");
|
|
6
6
|
const getIsLambdaErrorResponse_1 = require("./error/getIsLambdaErrorResponse");
|
|
7
7
|
const getLambdaErrorMetadata_1 = require("./error/getLambdaErrorMetadata");
|
|
8
8
|
const getStackTraceString_1 = require("./error/getStackTraceString");
|
|
@@ -22,15 +22,18 @@ const getParsedJson_1 = require("./serde/getParsedJson");
|
|
|
22
22
|
* | # | when | it throws |
|
|
23
23
|
* |---|---|---|
|
|
24
24
|
* | 1 | the payload is absent or is not json | `LambdaEndpointError` |
|
|
25
|
-
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | `
|
|
26
|
-
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | `
|
|
25
|
+
* | 2 | a CONTEMP envelope — `{ error: { _serde, class, … } }` | the `refusal` class when `class` is `ConstraintError`; else `LambdaEndpointError` |
|
|
26
|
+
* | 3 | an ANCIENT envelope — `{ errorMessage, … }` | the `refusal` class when `errorType` is `ConstraintError` **or** `BadRequestError`; else `LambdaEndpointError` |
|
|
27
27
|
* | 4 | aws reported a `functionError` and no shape above matched | `LambdaEndpointError`, with the payload in `details` |
|
|
28
28
|
* | 5 | none of the above | returns the payload as `TResponse` |
|
|
29
29
|
*
|
|
30
30
|
* ⚠️ **rows 2 and 3 split on the same question and answer it differently**, which
|
|
31
31
|
* is deliberate: a caller's bad request is not a lambda failure, so it
|
|
32
|
-
* hydrates to `
|
|
33
|
-
* (`invariant.badrequesterror-not-lambda-error`). the
|
|
32
|
+
* hydrates to the `refusal` class rather than to an invocation error
|
|
33
|
+
* (`invariant.badrequesterror-not-lambda-error`). the `refusal` class is
|
|
34
|
+
* `LambdaEndpointRefusedError` on an ask road — the asker composed the request,
|
|
35
|
+
* so the refusal is its own malfunction — and `ConstraintError` where the caller
|
|
36
|
+
* opted in, or is the test author (`onSerialized`). the ancient arm accepts
|
|
34
37
|
* `BadRequestError` too, because that is the name the legacy family emits for
|
|
35
38
|
* the same fact (`invariant.ancient-vs-contemp-callers`).
|
|
36
39
|
*
|
|
@@ -70,15 +73,21 @@ const getParsedResponse = (input) => {
|
|
|
70
73
|
// detect contemp error response (preferred, check first)
|
|
71
74
|
if ((0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(parsed)) {
|
|
72
75
|
const err = parsed.error;
|
|
73
|
-
// ConstraintError =
|
|
76
|
+
// ConstraintError = the peer refused the request (lambda succeeded); the caller's opt names the class
|
|
74
77
|
if (err.class === 'ConstraintError') {
|
|
75
78
|
// strip prefix to avoid double prefix (handler already prefixed the message)
|
|
76
79
|
const message = (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({ message: err.message });
|
|
77
|
-
throw
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
throw (0, asErrorFromPeerRefusal_1.asErrorFromPeerRefusal)({
|
|
81
|
+
refusal: input.refusal,
|
|
82
|
+
peer: input.endpoint.slug,
|
|
83
|
+
message,
|
|
84
|
+
errorType: err.class,
|
|
85
|
+
metadata: {
|
|
86
|
+
endpoint: input.endpoint,
|
|
87
|
+
exid: input.exid,
|
|
88
|
+
causeMessage: err.cause,
|
|
89
|
+
details: err.details,
|
|
90
|
+
},
|
|
82
91
|
});
|
|
83
92
|
}
|
|
84
93
|
// all other error classes = lambda invocation error
|
|
@@ -94,7 +103,7 @@ const getParsedResponse = (input) => {
|
|
|
94
103
|
if ((0, getIsLambdaErrorResponse_1.getIsAncientErrorResponse)(parsed)) {
|
|
95
104
|
const stackTrace = (0, getStackTraceString_1.getStackTraceString)({ stackTrace: parsed.stackTrace });
|
|
96
105
|
const errorMeta = (0, getLambdaErrorMetadata_1.getLambdaErrorMetadata)({ errorResponse: parsed });
|
|
97
|
-
// ConstraintError/BadRequestError =
|
|
106
|
+
// ConstraintError/BadRequestError = the peer refused the request (lambda succeeded)
|
|
98
107
|
// .note = check both for backwards compat with handlers that use old error types
|
|
99
108
|
if (parsed.errorType === 'ConstraintError' ||
|
|
100
109
|
parsed.errorType === 'BadRequestError') {
|
|
@@ -102,11 +111,17 @@ const getParsedResponse = (input) => {
|
|
|
102
111
|
const message = (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({
|
|
103
112
|
message: parsed.errorMessage,
|
|
104
113
|
});
|
|
105
|
-
throw
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
throw (0, asErrorFromPeerRefusal_1.asErrorFromPeerRefusal)({
|
|
115
|
+
refusal: input.refusal,
|
|
116
|
+
peer: input.endpoint.slug,
|
|
117
|
+
message,
|
|
118
|
+
errorType: parsed.errorType,
|
|
119
|
+
metadata: {
|
|
120
|
+
endpoint: input.endpoint,
|
|
121
|
+
exid: input.exid,
|
|
122
|
+
stackTrace,
|
|
123
|
+
...errorMeta,
|
|
124
|
+
},
|
|
110
125
|
});
|
|
111
126
|
}
|
|
112
127
|
// all other error types = lambda invocation error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParsedResponse.js","sourceRoot":"","sources":["../../../src/domain.operations/lambdaEndpointWire/getParsedResponse.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getParsedResponse.js","sourceRoot":"","sources":["../../../src/domain.operations/lambdaEndpointWire/getParsedResponse.ts"],"names":[],"mappings":";;;AACA,kFAA+E;AAE/E,2EAAwE;AACxE,+EAG0C;AAC1C,2EAAwE;AACxE,qEAAkE;AAClE,+EAA4E;AAC5E,iEAA8D;AAC9D,yDAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACI,MAAM,iBAAiB,GAAG,CAAY,KAY5C,EAAa,EAAE;IACd,0BAA0B;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,yCAAmB,CAAC,+BAA+B,EAAE;YAC7D,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAED,2BAA2B;IAC3B,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAEpE,aAAa;IACb,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,aAAa;QACrB,MAAM,IAAI,yCAAmB;QAC3B,0EAA0E;QAC1E,0EAA0E;QAC1E,mEAAmE;QACnE,4IAA4I,EAC5I;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,aAAa;YAC9B,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SAC7B,CACF,CAAC;IAEJ;;;;;OAKG;IACH,OAAO,MAAmB,CAAC;AAC7B,CAAC,CAAC;AA/JW,QAAA,iBAAiB,qBA+J5B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onSerialized = void 0;
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const LambdaEndpointRefusal_1 = require("../../domain.objects/LambdaEndpointRefusal");
|
|
5
6
|
const askLambdaEndpoint_1 = require("../askLambdaEndpoint/askLambdaEndpoint");
|
|
6
7
|
const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
|
|
7
8
|
const getOneTrailExid_1 = require("../lambdaEndpointWire/context/getOneTrailExid");
|
|
@@ -17,6 +18,14 @@ const runLambdaEndpoint_onReferenced_1 = require("./runLambdaEndpoint.onReferenc
|
|
|
17
18
|
const asCarriedPayload_1 = require("./serde/asCarriedPayload");
|
|
18
19
|
const asWireFunctionErrorPayload_1 = require("./serde/asWireFunctionErrorPayload");
|
|
19
20
|
const asWirePayload_1 = require("./serde/asWirePayload");
|
|
21
|
+
/**
|
|
22
|
+
* .what = a refusal reaches the runner as a `ConstraintError`, on both loci
|
|
23
|
+
* .why = the runner composed the event itself, so no peer stands between it and the handler:
|
|
24
|
+
* the fault truly is the runner's to fix. `askLambdaEndpoint`'s default
|
|
25
|
+
* (`LambdaEndpointRefusedError`) states the opposite, for a caller that composed a request
|
|
26
|
+
* on its OWN caller's behalf
|
|
27
|
+
*/
|
|
28
|
+
const REFUSAL_OF_RUN = LambdaEndpointRefusal_1.REFUSAL_PASSTHROUGH;
|
|
20
29
|
/**
|
|
21
30
|
* .what = runs a lambda endpoint you hold the SLUG of — `{ service, function }`
|
|
22
31
|
* plus the ambient access
|
|
@@ -147,6 +156,7 @@ const onSerialized = async (input, context) => {
|
|
|
147
156
|
carrier,
|
|
148
157
|
}),
|
|
149
158
|
struct: { payload: 'ancient' },
|
|
159
|
+
refusal: REFUSAL_OF_RUN,
|
|
150
160
|
}, {
|
|
151
161
|
...context,
|
|
152
162
|
log: {
|
|
@@ -159,6 +169,7 @@ const onSerialized = async (input, context) => {
|
|
|
159
169
|
which: input.which,
|
|
160
170
|
event: input.event,
|
|
161
171
|
struct: structValidated,
|
|
172
|
+
refusal: REFUSAL_OF_RUN,
|
|
162
173
|
}, context).catch(asCredentialsFault);
|
|
163
174
|
}
|
|
164
175
|
// the local locus: look the handler up, run it, then hydrate exactly as the wire does
|
|
@@ -206,6 +217,7 @@ const onSerialized = async (input, context) => {
|
|
|
206
217
|
functionError: undefined,
|
|
207
218
|
endpoint,
|
|
208
219
|
exid,
|
|
220
|
+
refusal: REFUSAL_OF_RUN,
|
|
209
221
|
});
|
|
210
222
|
};
|
|
211
223
|
exports.onSerialized = onSerialized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runLambdaEndpoint.onSerialized.js","sourceRoot":"","sources":["../../../src/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD,8EAA2E;AAC3E,2EAAwE;AACxE,mFAAgF;AAChF,iGAA8F;AAC9F,qGAAkG;AAClG,+EAA4E;AAC5E,+EAA4E;AAE5E,mEAAgE;AAChE,6EAA0E;AAC1E,mEAAgE;AAChE,2FAAwF;AACxF,qFAAgE;AAChE,+DAA4D;AAC5D,mFAAgF;AAChF,yDAAsD;AAWtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAE,CACnD,IAAA,iDAAuB,EAAC;YACtB,KAAK;YACL,OAAO,EACL,mFAAmF;YACrF,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM;YAC1B,QAAQ,EAAE;gBACR,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM;gBAC1B,EAAE;aACH;SACF,CAAC,CAAC;QAEL,uFAAuF;QACvF,sFAAsF;QACtF,0FAA0F;QAC1F,4FAA4F;QAC5F,8DAA8D;QAC9D,MAAM,OAAO,GAAG,IAAA,qDAAyB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAClE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,0FAA0F;YAC1F,wFAAwF;YACxF,qEAAqE;YACrE,MAAM,IAAI,GAAG,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACnD,OAAO,IAAA,qCAAiB,EACtB;gBACE,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,KAAK,EAAE,IAAA,mCAAgB,EAAC;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,KAAK,EAAE,EAAE,IAAI,EAAE;oBACf,OAAO,EAAE,gBAAgB;oBACzB,OAAO;iBACR,CAAC;gBACF,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"runLambdaEndpoint.onSerialized.js","sourceRoot":"","sources":["../../../src/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD,sFAGoD;AACpD,8EAA2E;AAC3E,2EAAwE;AACxE,mFAAgF;AAChF,iGAA8F;AAC9F,qGAAkG;AAClG,+EAA4E;AAC5E,+EAA4E;AAE5E,mEAAgE;AAChE,6EAA0E;AAC1E,mEAAgE;AAChE,2FAAwF;AACxF,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EAA4E;QAC5E,OAAO,EAAE,IAAA,uCAAkB,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAErE,uEAAuE;QACvE,6EAA6E;QAC7E,kDAAkD;QAClD,0EAA0E;QAC1E,KAAK,EAAE,EAAE,IAAI,EAAE;KAChB,CAAC,CAAC,KAAK,CAAC,uDAA0B,CAAC,CAAC;IAErC,2EAA2E;IAC3E,8EAA8E;IAC9E,yDAAyD;IACzD,OAAO,IAAA,qCAAiB,EAAyB;QAC/C,OAAO,EAAE,IAAA,6BAAa,EAAC,MAAM,CAAC;QAC9B,aAAa,EAAE,SAAS;QACxB,QAAQ;QACR,IAAI;QACJ,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AA1MW,QAAA,YAAY,gBA0MvB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export { LambdaDomainObjectRefUnbindableError } from './domain.objects/LambdaDom
|
|
|
35
35
|
export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
|
|
36
36
|
export type { LambdaEndpointDialect } from './domain.objects/LambdaEndpointDialect';
|
|
37
37
|
export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
|
|
38
|
+
/**
|
|
39
|
+
* .what = a peer's refusal of a request this caller composed, and the opt that names its class
|
|
40
|
+
* .why = `askLambdaEndpoint` throws it by default for a peer's caller fault, so a consumer must be
|
|
41
|
+
* able to catch it by class and to name the opt it passes
|
|
42
|
+
*/
|
|
43
|
+
export type { LambdaEndpointRefusal } from './domain.objects/LambdaEndpointRefusal';
|
|
44
|
+
export { LambdaEndpointRefusedError } from './domain.objects/LambdaEndpointRefusedError';
|
|
38
45
|
export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
|
|
39
46
|
export { LambdaFunctionNotFoundError } from './domain.objects/LambdaFunctionNotFoundError';
|
|
40
47
|
export { LambdaIntrospectionBlockedError } from './domain.objects/LambdaIntrospectionBlockedError';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* triggers mint a fresh `exid` per invoke (`domain.terms/trail.md`)
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.runLambdaEndpoint = exports.isLambdaEndpointErrorEnvelopeContemp = exports.isLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointErrorEnvelopeContemp = exports.asLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointOutput = exports.asLambdaContext = exports.asTrailExidHeaders = exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.getValidatedOutput = exports.getValidatedInput = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genZodInputValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayRequestEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.asApiGatewayResponseSchema = exports.genLambdaEndpoint = exports.asLambdaEventSchema = exports.asLambdaEvent = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
|
|
13
|
+
exports.runLambdaEndpoint = exports.isLambdaEndpointErrorEnvelopeContemp = exports.isLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointErrorEnvelopeContemp = exports.asLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointOutput = exports.asLambdaContext = exports.asTrailExidHeaders = exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.getValidatedOutput = exports.getValidatedInput = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genZodInputValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayRequestEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.asApiGatewayResponseSchema = exports.genLambdaEndpoint = exports.asLambdaEventSchema = exports.asLambdaEvent = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointRefusedError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
|
|
14
14
|
// re-export from helpful-errors for convenience
|
|
15
15
|
var helpful_errors_1 = require("helpful-errors");
|
|
16
16
|
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
|
|
@@ -36,6 +36,8 @@ var LambdaEndpoint_1 = require("./domain.objects/LambdaEndpoint");
|
|
|
36
36
|
Object.defineProperty(exports, "LambdaEndpoint", { enumerable: true, get: function () { return LambdaEndpoint_1.LambdaEndpoint; } });
|
|
37
37
|
var LambdaEndpointError_1 = require("./domain.objects/LambdaEndpointError");
|
|
38
38
|
Object.defineProperty(exports, "LambdaEndpointError", { enumerable: true, get: function () { return LambdaEndpointError_1.LambdaEndpointError; } });
|
|
39
|
+
var LambdaEndpointRefusedError_1 = require("./domain.objects/LambdaEndpointRefusedError");
|
|
40
|
+
Object.defineProperty(exports, "LambdaEndpointRefusedError", { enumerable: true, get: function () { return LambdaEndpointRefusedError_1.LambdaEndpointRefusedError; } });
|
|
39
41
|
// contract discovery errors
|
|
40
42
|
var LambdaFunctionNotFoundError_1 = require("./domain.objects/LambdaFunctionNotFoundError");
|
|
41
43
|
Object.defineProperty(exports, "LambdaFunctionNotFoundError", { enumerable: true, get: function () { return LambdaFunctionNotFoundError_1.LambdaFunctionNotFoundError; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAQxB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AAEvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAQxB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,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AC1C,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AACnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AASzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wGAAuG;AAA9F,sHAAA,iBAAiB,OAAA;AAC1B,0GAG6E;AAF3E,wHAAA,kBAAkB,OAAA;AAcpB,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA;AAEtB;;;;GAIG;AACH,sGAAqG;AAA5F,wHAAA,kBAAkB,OAAA;AAC3B,gFAAgF;AAChF,iGAAgG;AAAvF,kHAAA,eAAe,OAAA;AACxB,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,+GAA8G;AAArG,gIAAA,sBAAsB,OAAA;AAC/B,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,0CAA0C;AAC1C,6HAKqF;AAJnF,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AAMtC,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "sdk-aws-lambda",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
|
|
5
|
-
"version": "0.8.
|
|
5
|
+
"version": "0.8.1",
|
|
6
6
|
"repository": "ehmpathy/sdk-aws-lambda",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
|
|
8
8
|
"keywords": [
|