sdk-aws-lambda 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/cli/asGenArgs.d.ts +21 -0
- package/dist/contract/cli/asGenArgs.js +69 -0
- package/dist/contract/cli/asGenArgs.js.map +1 -0
- package/dist/contract/cli/gen.d.ts +23 -0
- package/dist/contract/cli/gen.js +72 -0
- package/dist/contract/cli/gen.js.map +1 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +12 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.js +3 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.js.map +1 -0
- package/dist/domain.objects/ApiGatewayResponse.d.ts +30 -0
- package/dist/domain.objects/ApiGatewayResponse.js +3 -0
- package/dist/domain.objects/ApiGatewayResponse.js.map +1 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.d.ts +30 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.js +3 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.js.map +1 -0
- package/dist/domain.objects/DomainObjectCaptured.d.ts +51 -0
- package/dist/domain.objects/DomainObjectCaptured.js +8 -0
- package/dist/domain.objects/DomainObjectCaptured.js.map +1 -0
- package/dist/domain.objects/GeneratedFile.d.ts +18 -0
- package/dist/domain.objects/GeneratedFile.js +8 -0
- package/dist/domain.objects/GeneratedFile.js.map +1 -0
- package/dist/domain.objects/HttpStatusCode.d.ts +1 -0
- package/dist/domain.objects/HttpStatusCode.js +1 -0
- package/dist/domain.objects/HttpStatusCode.js.map +1 -1
- package/dist/domain.objects/LambdaCredentialsAbsentError.d.ts +11 -0
- package/dist/domain.objects/LambdaCredentialsAbsentError.js +16 -0
- package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.d.ts +12 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js +17 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.d.ts +14 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js +19 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +29 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js +3 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.d.ts +29 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js +30 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js +3 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +19 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +24 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.d.ts +26 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js +31 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +33 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +39 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +118 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +76 -36
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +153 -45
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.d.ts +8 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +34 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +19 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.d.ts +7 -24
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +19 -103
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +20 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +48 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +16 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +32 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +6 -22
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +24 -18
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +11 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +12 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.d.ts +37 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js +24 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +18 -10
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +20 -23
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +29 -6
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +23 -28
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +16 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +9 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +27 -6
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +29 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +12 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +27 -2
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +34 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.d.ts +16 -0
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js +36 -0
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.d.ts +10 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js +18 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.d.ts +14 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +44 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.d.ts +11 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +42 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +9 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js +16 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.d.ts +20 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js +44 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.d.ts +13 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js +49 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +16 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +39 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +35 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +189 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +15 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +37 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.d.ts +26 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +106 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.d.ts +15 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +51 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts +14 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +68 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.d.ts +20 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.js +88 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -0
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +49 -4
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/package.json +18 -14
- package/readme.md +50 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type EnvironmentAccessTier } from 'sdk-environment';
|
|
2
|
+
/**
|
|
3
|
+
* .what = parse + validate the `gen` cli args into a typed, safe shape
|
|
4
|
+
* .why = the cli boundary must fail loud on bad input (per rule.require.failfast)
|
|
5
|
+
* before the orchestrator runs; a malformed invocation should never reach
|
|
6
|
+
* the spine
|
|
7
|
+
*
|
|
8
|
+
* .args
|
|
9
|
+
* --for <service> a svc-{noun} service name (required)
|
|
10
|
+
* --into <dir> the target directory (required)
|
|
11
|
+
* --env <access> the env access tier: test | prep | prod (required)
|
|
12
|
+
*
|
|
13
|
+
* .throws ConstraintError — a required arg is absent or invalid (with usage hint)
|
|
14
|
+
*/
|
|
15
|
+
export declare const asGenArgs: (input: {
|
|
16
|
+
argv: string[];
|
|
17
|
+
}) => {
|
|
18
|
+
service: string;
|
|
19
|
+
into: string;
|
|
20
|
+
access: EnvironmentAccessTier;
|
|
21
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asGenArgs = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const sdk_environment_1 = require("sdk-environment");
|
|
6
|
+
/**
|
|
7
|
+
* .what = parse + validate the `gen` cli args into a typed, safe shape
|
|
8
|
+
* .why = the cli boundary must fail loud on bad input (per rule.require.failfast)
|
|
9
|
+
* before the orchestrator runs; a malformed invocation should never reach
|
|
10
|
+
* the spine
|
|
11
|
+
*
|
|
12
|
+
* .args
|
|
13
|
+
* --for <service> a svc-{noun} service name (required)
|
|
14
|
+
* --into <dir> the target directory (required)
|
|
15
|
+
* --env <access> the env access tier: test | prep | prod (required)
|
|
16
|
+
*
|
|
17
|
+
* .throws ConstraintError — a required arg is absent or invalid (with usage hint)
|
|
18
|
+
*/
|
|
19
|
+
const asGenArgs = (input) => {
|
|
20
|
+
// parse `--flag value` pairs from argv
|
|
21
|
+
const flags = asFlagMap(input.argv);
|
|
22
|
+
// --for: required, must be svc-<noun> shaped. distinguish the two faults so the
|
|
23
|
+
// user sees which mistake they made — absent flag vs a malformed value
|
|
24
|
+
const service = flags['for'];
|
|
25
|
+
if (!service)
|
|
26
|
+
return throwUsage(`--for is required; must be a svc-<noun> service name`);
|
|
27
|
+
if (!/^svc-[a-z0-9]+$/.test(service))
|
|
28
|
+
return throwUsage(`invalid --for value '${service}'; must be a svc-<noun> service name`);
|
|
29
|
+
// --into: required, non-empty
|
|
30
|
+
const into = flags['into'];
|
|
31
|
+
if (!into)
|
|
32
|
+
return throwUsage(`--into <dir> is required`);
|
|
33
|
+
// --env: required, must be a valid access tier
|
|
34
|
+
const env = flags['env'];
|
|
35
|
+
if (!env)
|
|
36
|
+
return throwUsage(`--env <test|prep|prod> is required`);
|
|
37
|
+
if (!(0, sdk_environment_1.isEnvironmentAccessTier)(env))
|
|
38
|
+
return throwUsage(`--env must be one of: test | prep | prod`);
|
|
39
|
+
return { service, into, access: env };
|
|
40
|
+
};
|
|
41
|
+
exports.asGenArgs = asGenArgs;
|
|
42
|
+
/**
|
|
43
|
+
* .what = collect `--flag value` pairs from an argv array into a map
|
|
44
|
+
* .why = a tiny hand-parse; a full arg framework is unwarranted for 3 flags
|
|
45
|
+
*/
|
|
46
|
+
const asFlagMap = (argv) => {
|
|
47
|
+
const flags = {};
|
|
48
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
49
|
+
const token = argv[i];
|
|
50
|
+
if (token?.startsWith('--')) {
|
|
51
|
+
const key = token.slice(2);
|
|
52
|
+
const value = argv[i + 1];
|
|
53
|
+
if (value !== undefined && !value.startsWith('--')) {
|
|
54
|
+
flags[key] = value;
|
|
55
|
+
i += 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return flags;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* .what = throw a ConstraintError with the standard usage hint
|
|
63
|
+
*/
|
|
64
|
+
const throwUsage = (reason) => {
|
|
65
|
+
throw new helpful_errors_1.ConstraintError(reason, {
|
|
66
|
+
usage: 'sdk-aws-lambda gen --for svc-<noun> --into <dir> --env <test|prep|prod>',
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=asGenArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asGenArgs.js","sourceRoot":"","sources":["../../../src/contract/cli/asGenArgs.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AACjD,qDAGyB;AAEzB;;;;;;;;;;;;GAYG;AACI,MAAM,SAAS,GAAG,CAAC,KAEzB,EAAoE,EAAE;IACrE,uCAAuC;IACvC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEpC,gFAAgF;IAChF,uEAAuE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,OAAO;QACV,OAAO,UAAU,CAAC,sDAAsD,CAAC,CAAC;IAC5E,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;QAClC,OAAO,UAAU,CACf,wBAAwB,OAAO,sCAAsC,CACtE,CAAC;IAEJ,8BAA8B;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAI;QAAE,OAAO,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAEzD,+CAA+C;IAC/C,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,IAAI,CAAC,GAAG;QAAE,OAAO,UAAU,CAAC,oCAAoC,CAAC,CAAC;IAClE,IAAI,CAAC,IAAA,yCAAuB,EAAC,GAAG,CAAC;QAC/B,OAAO,UAAU,CAAC,0CAA0C,CAAC,CAAC;IAEhE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACxC,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC,IAAc,EAA0B,EAAE;IAC3D,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACnB,CAAC,IAAI,CAAC,CAAC;YACT,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,MAAc,EAAS,EAAE;IAC3C,MAAM,IAAI,gCAAe,CAAC,MAAM,EAAE;QAChC,KAAK,EACH,yEAAyE;KAC5E,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type ContextLogTrail } from 'sdk-logs';
|
|
3
|
+
import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
|
|
4
|
+
/**
|
|
5
|
+
* .what = the `sdk-aws-lambda gen` cli entrypoint
|
|
6
|
+
* .why = generates a per-service sdk into a target dir from live introspection;
|
|
7
|
+
* validates args, routes --env into ambient context, and maps errors to
|
|
8
|
+
* semantic exit codes (0 ok / 1 malfunction / 2 constraint)
|
|
9
|
+
*
|
|
10
|
+
* .context = the caller may inject `log` (observability) + `aws` (sdk seam for
|
|
11
|
+
* tests); both default when absent so the bin can call `gen({ argv })`.
|
|
12
|
+
* `env.access` is NOT injected here — it is parsed from `--env` (the cli
|
|
13
|
+
* is the composition root that maps the flag into ambient access).
|
|
14
|
+
*/
|
|
15
|
+
export declare const gen: (input: {
|
|
16
|
+
argv: string[];
|
|
17
|
+
}, context?: {
|
|
18
|
+
log?: ContextLogTrail['log'];
|
|
19
|
+
aws?: ContextAwsLambdaCaller['aws'];
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
exit: number;
|
|
22
|
+
message: string | null;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.gen = void 0;
|
|
5
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
6
|
+
const sdk_logs_1 = require("sdk-logs");
|
|
7
|
+
const genServiceSdk_1 = require("../../domain.operations/genServiceSdk/genServiceSdk");
|
|
8
|
+
const asGenArgs_1 = require("./asGenArgs");
|
|
9
|
+
/**
|
|
10
|
+
* .what = the `sdk-aws-lambda gen` cli entrypoint
|
|
11
|
+
* .why = generates a per-service sdk into a target dir from live introspection;
|
|
12
|
+
* validates args, routes --env into ambient context, and maps errors to
|
|
13
|
+
* semantic exit codes (0 ok / 1 malfunction / 2 constraint)
|
|
14
|
+
*
|
|
15
|
+
* .context = the caller may inject `log` (observability) + `aws` (sdk seam for
|
|
16
|
+
* tests); both default when absent so the bin can call `gen({ argv })`.
|
|
17
|
+
* `env.access` is NOT injected here — it is parsed from `--env` (the cli
|
|
18
|
+
* is the composition root that maps the flag into ambient access).
|
|
19
|
+
*/
|
|
20
|
+
const gen = async (input, context) => {
|
|
21
|
+
const log = context?.log ?? (0, sdk_logs_1.genContextLogTrail)({ trail: null, env: null }).log;
|
|
22
|
+
try {
|
|
23
|
+
// validate args at the boundary (throws ConstraintError → exit 2)
|
|
24
|
+
const args = (0, asGenArgs_1.asGenArgs)({ argv: input.argv });
|
|
25
|
+
// route the --env flag into ambient context.env.access, then generate
|
|
26
|
+
await (0, genServiceSdk_1.genServiceSdk)({ which: { service: args.service }, into: args.into }, { log, env: { access: args.access }, aws: context?.aws });
|
|
27
|
+
return { exit: 0, message: null };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// caller-must-fix errors → exit 2; server/unexpected → exit 1. surface the
|
|
31
|
+
// message on the result (not only via log) so callers + tests can assert +
|
|
32
|
+
// snapshot exactly what the user sees
|
|
33
|
+
const exit = getExitForError({ error });
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
+
log.error('gen failed', { exit, error: message });
|
|
36
|
+
return { exit, message };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.gen = gen;
|
|
40
|
+
/**
|
|
41
|
+
* .what = decide whether a thrown error is a caller-must-fix constraint
|
|
42
|
+
* .why = every codegen error class (LambdaCredentialsAbsentError,
|
|
43
|
+
* LambdaIntrospectionBlockedError, LambdaServiceNotFoundError,
|
|
44
|
+
* LambdaFunctionNotFoundError, LambdaIntrospectionNotSupportedError,
|
|
45
|
+
* LambdaDomainObjectNotCapturableError) extends ConstraintError, so a single
|
|
46
|
+
* `instanceof ConstraintError` covers them all — no per-class chain to keep in
|
|
47
|
+
* sync (a new Lambda*Error extends ConstraintError is caught automatically)
|
|
48
|
+
*/
|
|
49
|
+
const isConstraintError = (error) => error instanceof helpful_errors_1.ConstraintError;
|
|
50
|
+
/**
|
|
51
|
+
* .what = map a thrown error to its semantic exit code
|
|
52
|
+
* .why = constraint errors (caller must fix) exit 2; malfunctions exit 1
|
|
53
|
+
*/
|
|
54
|
+
const getExitForError = (input) => {
|
|
55
|
+
if (isConstraintError(input.error))
|
|
56
|
+
return 2;
|
|
57
|
+
if (input.error instanceof helpful_errors_1.MalfunctionError)
|
|
58
|
+
return 1;
|
|
59
|
+
return 1;
|
|
60
|
+
};
|
|
61
|
+
// when invoked as a bin, run + set the process exit code
|
|
62
|
+
/* istanbul ignore next */
|
|
63
|
+
if (require.main === module) {
|
|
64
|
+
(0, exports.gen)({ argv: process.argv.slice(2) })
|
|
65
|
+
.then(({ exit }) => {
|
|
66
|
+
process.exitCode = exit;
|
|
67
|
+
})
|
|
68
|
+
.catch(() => {
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen.js","sourceRoot":"","sources":["../../../src/contract/cli/gen.ts"],"names":[],"mappings":";;;;AAEA,mDAAmE;AACnE,uCAAoE;AAGpE,uFAAoF;AACpF,2CAAwC;AAExC;;;;;;;;;;GAUG;AACI,MAAM,GAAG,GAAG,KAAK,EACtB,KAEC,EACD,OAGC,EACkD,EAAE;IACrD,MAAM,GAAG,GACP,OAAO,EAAE,GAAG,IAAI,IAAA,6BAAkB,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;IAErE,IAAI,CAAC;QACH,kEAAkE;QAClE,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7C,sEAAsE;QACtE,MAAM,IAAA,6BAAa,EACjB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EACrD,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CACzD,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2EAA2E;QAC3E,2EAA2E;QAC3E,sCAAsC;QACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,GAAG,OAgCd;AAEF;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAW,EAAE,CACpD,KAAK,YAAY,gCAAe,CAAC;AAEnC;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAU,EAAE;IAC5D,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,KAAK,YAAY,iCAAgB;QAAE,OAAO,CAAC,CAAC;IACtD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,yDAAyD;AACzD,0BAA0B;AAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAA,WAAG,EAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from 'aws-lambda';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the wire payload an api-gateway trigger delivers, either version
|
|
4
|
+
* .why = api gateway ships two incompatible request shapes (rest/v1, http/v2), and a
|
|
5
|
+
* handler must be able to name the shape as it LANDS, before any translate runs
|
|
6
|
+
*
|
|
7
|
+
* .note = this is the `inputBefore` point: the untouched bytes-as-parsed, before the
|
|
8
|
+
* input translator. its peer at the other end of the pipeline is
|
|
9
|
+
* `ApiGatewayResponsePayload` — request/response, each qualified by `Payload`
|
|
10
|
+
* to mark it as the wire form
|
|
11
|
+
*/
|
|
12
|
+
export type ApiGatewayRequestPayload = APIGatewayProxyEvent | APIGatewayProxyEventV2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiGatewayRequestPayload.js","sourceRoot":"","sources":["../../src/domain.objects/ApiGatewayRequestPayload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PickAny } from 'type-fns';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the http response a handler puts on the wire — the `outputBefore` point, which
|
|
4
|
+
* `schema.output` describes
|
|
5
|
+
*
|
|
6
|
+
* .note = `PickAny` demands at least one key, so `{}` is a compile error. an empty response
|
|
7
|
+
* would reach middy's `normalizeHttpResponse` and pick up `statusCode ??= 500` — a
|
|
8
|
+
* silent server-fault on the wire for code that returned success
|
|
9
|
+
*/
|
|
10
|
+
export type ApiGatewayResponse<TBody> = PickAny<{
|
|
11
|
+
/** .note = omit for 200 */
|
|
12
|
+
status: number;
|
|
13
|
+
/**
|
|
14
|
+
* .note = set `Content-Type` to take the body verbatim; the serializer skips a response that
|
|
15
|
+
* already declares one. omit it and the body is json-encoded for you
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ .note = ONE VALUE PER HEADER, so a header that must repeat (`Set-Cookie`) cannot be
|
|
18
|
+
* expressed — a `Record` key is unique, and js drops the earlier value with no
|
|
19
|
+
* warn. aws carries repeats in `multiValueHeaders` (v1) / `cookies` (v2); this
|
|
20
|
+
* contract declares neither, and `getAllWirePayloadKeysFound` REFUSES both loudly
|
|
21
|
+
* so the attempt fails fast. deferred, not denied — each is one additive key (F7)
|
|
22
|
+
*/
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* ⚠️ .note = OMIT the key for no body. an explicit `body: ''` is a different value — a real
|
|
26
|
+
* two-byte json `""` under `application/json`, which is coherent but is not
|
|
27
|
+
* body-less. `[case10]` of `local.wireResponse.acceptance.test.ts` pins both
|
|
28
|
+
*/
|
|
29
|
+
body: TBody;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiGatewayResponse.js","sourceRoot":"","sources":["../../src/domain.objects/ApiGatewayResponse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { APIGatewayProxyResult } from 'aws-lambda';
|
|
2
|
+
/**
|
|
3
|
+
* .what = the wire payload api gateway receives back
|
|
4
|
+
* .why = names the `outputAfter` point — what lands on the wire, after the output
|
|
5
|
+
* translator has run. by here the body is a `string`, whatever domain type it
|
|
6
|
+
* held before, so its contents are opaque
|
|
7
|
+
*
|
|
8
|
+
* .why = the sdk adds no field to aws's shape; it adds a NAME, so a consumer can say
|
|
9
|
+
* "the bytes on the wire" and a translator can target it. the extant code had no
|
|
10
|
+
* term for this value, which is exactly why its encode sat hardcoded
|
|
11
|
+
*
|
|
12
|
+
* .note = `body` is OPTIONAL here, where aws declares it required. a body-less response
|
|
13
|
+
* (a 204, a 308) must reach the wire with the key ABSENT, never as `''` — the
|
|
14
|
+
* response serializer runs after the encode and would turn an empty string into
|
|
15
|
+
* `'""'`. api gateway reads an absent body as no body, so absence is the correct
|
|
16
|
+
* wire form and this type says so rather than leave a cast to hide it
|
|
17
|
+
*
|
|
18
|
+
* .note = `TBody` is PARAMETERIZED because the body is encoded one step later than the
|
|
19
|
+
* output translator runs, so this shape occurs twice in the chain:
|
|
20
|
+
*
|
|
21
|
+
* ApiGatewayResponsePayload<TBody> <- `outputAfter`, what the translator yields
|
|
22
|
+
* ↓ the response serializer — an sdk-internal step, not a model point
|
|
23
|
+
* ApiGatewayResponsePayload <- what aws receives; the body is bytes
|
|
24
|
+
*
|
|
25
|
+
* it defaults to `string` so the bare name reads as the wire shape. the serializer
|
|
26
|
+
* sits OUTSIDE the four points, mirror to the trail read which sits before them
|
|
27
|
+
*/
|
|
28
|
+
export type ApiGatewayResponsePayload<TBody = string> = Omit<APIGatewayProxyResult, 'body'> & {
|
|
29
|
+
body?: TBody;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiGatewayResponsePayload.js","sourceRoot":"","sources":["../../src/domain.objects/ApiGatewayResponsePayload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DomainLiteral, type DomainObjectKind } from 'domain-objects';
|
|
2
|
+
import type { JSONSchema } from 'zod/v4/core/json-schema';
|
|
3
|
+
/**
|
|
4
|
+
* .what = a domain-object captured from an introspected `x-domain-object` pragma,
|
|
5
|
+
* normalized for emit (the raw domain-objects `DomainObjectPragma` fields +
|
|
6
|
+
* the json-schema `shape`, with the key-fields defaulted)
|
|
7
|
+
* .why = parse the wire pragma once at the boundary into a structured value; all
|
|
8
|
+
* downstream ops speak in this instead of a re-read of the raw json
|
|
9
|
+
*
|
|
10
|
+
* .kind = which base class the upstream dobj extended (from the pragma's stamped
|
|
11
|
+
* `kind`); governs which base class asResourceClassSource emits
|
|
12
|
+
*/
|
|
13
|
+
export interface DomainObjectCaptured {
|
|
14
|
+
/**
|
|
15
|
+
* .what = the upstream domain-object's unqualified class name (e.g. 'Job')
|
|
16
|
+
* .why = the codegen prefixes this with the service (e.g. 'SvcJobsJob')
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* .what = which base class the upstream dobj extended (entity/literal/event/object)
|
|
21
|
+
* .why = the codegen emits the base class this maps to
|
|
22
|
+
*/
|
|
23
|
+
kind: DomainObjectKind;
|
|
24
|
+
/**
|
|
25
|
+
* .what = the primary key parts (artificial/serialized key), if any
|
|
26
|
+
*/
|
|
27
|
+
primary: string[];
|
|
28
|
+
/**
|
|
29
|
+
* .what = the unique key parts (natural key), if any
|
|
30
|
+
*/
|
|
31
|
+
unique: string[];
|
|
32
|
+
/**
|
|
33
|
+
* .what = the colloquial alias, if declared upstream
|
|
34
|
+
*/
|
|
35
|
+
alias: null | string | {
|
|
36
|
+
singular?: string;
|
|
37
|
+
plural?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* .what = map of nested-property name → nested dobj type name(s), unprefixed
|
|
41
|
+
* .why = the codegen prefixes each nested type name with the service; a value
|
|
42
|
+
* is an array when the nested position is polymorphic (choice of dobjs)
|
|
43
|
+
*/
|
|
44
|
+
nested: Record<string, string | string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* .what = the json-schema shape of the dobj (for TS type emit)
|
|
47
|
+
*/
|
|
48
|
+
shape: JSONSchema;
|
|
49
|
+
}
|
|
50
|
+
export declare class DomainObjectCaptured extends DomainLiteral<DomainObjectCaptured> implements DomainObjectCaptured {
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DomainObjectCaptured = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class DomainObjectCaptured extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.DomainObjectCaptured = DomainObjectCaptured;
|
|
8
|
+
//# sourceMappingURL=DomainObjectCaptured.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainObjectCaptured.js","sourceRoot":"","sources":["../../src/domain.objects/DomainObjectCaptured.ts"],"names":[],"mappings":";;;AAAA,mDAAsE;AAsDtE,MAAa,oBACX,SAAQ,8BAAmC;CACT;AAFpC,oDAEoC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
/**
|
|
3
|
+
* .what = one file the codegen will emit (path + content)
|
|
4
|
+
* .why = the emit boundary speaks in a named domain literal, not raw tuples;
|
|
5
|
+
* the batch communicator writes a list of these atomically
|
|
6
|
+
*/
|
|
7
|
+
export interface GeneratedFile {
|
|
8
|
+
/**
|
|
9
|
+
* .what = the absolute-or-relative path the file will be written to
|
|
10
|
+
*/
|
|
11
|
+
path: string;
|
|
12
|
+
/**
|
|
13
|
+
* .what = the full text content of the file (already formatted)
|
|
14
|
+
*/
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class GeneratedFile extends DomainLiteral<GeneratedFile> implements GeneratedFile {
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeneratedFile = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class GeneratedFile extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.GeneratedFile = GeneratedFile;
|
|
8
|
+
//# sourceMappingURL=GeneratedFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratedFile.js","sourceRoot":"","sources":["../../src/domain.objects/GeneratedFile.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAmB/C,MAAa,aACX,SAAQ,8BAA4B;CACT;AAF7B,sCAE6B"}
|
|
@@ -18,6 +18,7 @@ var HttpStatusCode;
|
|
|
18
18
|
HttpStatusCode[HttpStatusCode["MOVED_PERMANENTLY_301"] = 301] = "MOVED_PERMANENTLY_301";
|
|
19
19
|
HttpStatusCode[HttpStatusCode["FOUND_302"] = 302] = "FOUND_302";
|
|
20
20
|
HttpStatusCode[HttpStatusCode["NOT_MODIFIED_304"] = 304] = "NOT_MODIFIED_304";
|
|
21
|
+
HttpStatusCode[HttpStatusCode["PERMANENT_REDIRECT_308"] = 308] = "PERMANENT_REDIRECT_308";
|
|
21
22
|
// caller error
|
|
22
23
|
HttpStatusCode[HttpStatusCode["BAD_REQUEST_400"] = 400] = "BAD_REQUEST_400";
|
|
23
24
|
HttpStatusCode[HttpStatusCode["UNAUTHORIZED_401"] = 401] = "UNAUTHORIZED_401";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpStatusCode.js","sourceRoot":"","sources":["../../src/domain.objects/HttpStatusCode.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"HttpStatusCode.js","sourceRoot":"","sources":["../../src/domain.objects/HttpStatusCode.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,cA6BX;AA7BD,WAAY,cAAc;IACxB,UAAU;IACV,mEAAiB,CAAA;IACjB,mEAAiB,CAAA;IACjB,qEAAkB,CAAA;IAClB,yEAAoB,CAAA;IAEpB,WAAW;IACX,uFAA2B,CAAA;IAC3B,+DAAe,CAAA;IACf,6EAAsB,CAAA;IACtB,yFAA4B,CAAA;IAE5B,eAAe;IACf,2EAAqB,CAAA;IACrB,6EAAsB,CAAA;IACtB,uEAAmB,CAAA;IACnB,uEAAmB,CAAA;IACnB,yFAA4B,CAAA;IAC5B,qEAAkB,CAAA;IAClB,6FAA8B,CAAA;IAC9B,uFAA2B,CAAA;IAE3B,eAAe;IACf,+FAA+B,CAAA;IAC/B,mFAAyB,CAAA;IACzB,2EAAqB,CAAA;IACrB,2FAA6B,CAAA;IAC7B,mFAAyB,CAAA;AAC3B,CAAC,EA7BW,cAAc,8BAAd,cAAc,QA6BzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConstraintError } from 'helpful-errors';
|
|
2
|
+
/**
|
|
3
|
+
* .what = error when the aws sdk cannot load credentials for introspection
|
|
4
|
+
* .why = a clear, caller-must-fix error (with an unlock hint) instead of a raw
|
|
5
|
+
* aws CredentialsProviderError; introspection needs live prep creds
|
|
6
|
+
*
|
|
7
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata
|
|
8
|
+
* at the throw site via `new LambdaCredentialsAbsentError(message, { ... })`
|
|
9
|
+
*/
|
|
10
|
+
export declare class LambdaCredentialsAbsentError extends ConstraintError {
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LambdaCredentialsAbsentError = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
/**
|
|
6
|
+
* .what = error when the aws sdk cannot load credentials for introspection
|
|
7
|
+
* .why = a clear, caller-must-fix error (with an unlock hint) instead of a raw
|
|
8
|
+
* aws CredentialsProviderError; introspection needs live prep creds
|
|
9
|
+
*
|
|
10
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata
|
|
11
|
+
* at the throw site via `new LambdaCredentialsAbsentError(message, { ... })`
|
|
12
|
+
*/
|
|
13
|
+
class LambdaCredentialsAbsentError extends helpful_errors_1.ConstraintError {
|
|
14
|
+
}
|
|
15
|
+
exports.LambdaCredentialsAbsentError = LambdaCredentialsAbsentError;
|
|
16
|
+
//# sourceMappingURL=LambdaCredentialsAbsentError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LambdaCredentialsAbsentError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaCredentialsAbsentError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;;GAOG;AACH,MAAa,4BAA6B,SAAQ,gCAAe;CAAG;AAApE,oEAAoE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConstraintError } from 'helpful-errors';
|
|
2
|
+
/**
|
|
3
|
+
* .what = error when a contract-surfaced domain-object cannot be captured
|
|
4
|
+
* .why = a dobj referenced by an endpoint that declares no `static schema` has no
|
|
5
|
+
* shape to reconstruct; fail loud and name the dobj (uc.9) rather than
|
|
6
|
+
* silently drop it
|
|
7
|
+
*
|
|
8
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata
|
|
9
|
+
* at the throw site via `new LambdaDomainObjectNotCapturableError(message, { ... })`
|
|
10
|
+
*/
|
|
11
|
+
export declare class LambdaDomainObjectNotCapturableError extends ConstraintError {
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LambdaDomainObjectNotCapturableError = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
/**
|
|
6
|
+
* .what = error when a contract-surfaced domain-object cannot be captured
|
|
7
|
+
* .why = a dobj referenced by an endpoint that declares no `static schema` has no
|
|
8
|
+
* shape to reconstruct; fail loud and name the dobj (uc.9) rather than
|
|
9
|
+
* silently drop it
|
|
10
|
+
*
|
|
11
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata
|
|
12
|
+
* at the throw site via `new LambdaDomainObjectNotCapturableError(message, { ... })`
|
|
13
|
+
*/
|
|
14
|
+
class LambdaDomainObjectNotCapturableError extends helpful_errors_1.ConstraintError {
|
|
15
|
+
}
|
|
16
|
+
exports.LambdaDomainObjectNotCapturableError = LambdaDomainObjectNotCapturableError;
|
|
17
|
+
//# sourceMappingURL=LambdaDomainObjectNotCapturableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LambdaDomainObjectNotCapturableError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaDomainObjectNotCapturableError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;;;GAQG;AACH,MAAa,oCAAqC,SAAQ,gCAAe;CAAG;AAA5E,oFAA4E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConstraintError } from 'helpful-errors';
|
|
2
|
+
/**
|
|
3
|
+
* .what = error when a domain-object REFERENCE names a dobj that is not captured in
|
|
4
|
+
* full anywhere in the service's contracts, so the generated `typeof
|
|
5
|
+
* Svc<Prefix><Name>` cannot bind
|
|
6
|
+
* .why = a ref emits `RefByPrimary<typeof SvcSurfSeaturtle>`; that resource must
|
|
7
|
+
* exist. if no endpoint surfaces the referenced dobj whole, the generated sdk
|
|
8
|
+
* would not compile — fail loud (caller must surface the dobj on an endpoint)
|
|
9
|
+
*
|
|
10
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata at
|
|
11
|
+
* the throw site via `new LambdaDomainObjectRefUnbindableError(message, { ... })`
|
|
12
|
+
*/
|
|
13
|
+
export declare class LambdaDomainObjectRefUnbindableError extends ConstraintError {
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LambdaDomainObjectRefUnbindableError = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
/**
|
|
6
|
+
* .what = error when a domain-object REFERENCE names a dobj that is not captured in
|
|
7
|
+
* full anywhere in the service's contracts, so the generated `typeof
|
|
8
|
+
* Svc<Prefix><Name>` cannot bind
|
|
9
|
+
* .why = a ref emits `RefByPrimary<typeof SvcSurfSeaturtle>`; that resource must
|
|
10
|
+
* exist. if no endpoint surfaces the referenced dobj whole, the generated sdk
|
|
11
|
+
* would not compile — fail loud (caller must surface the dobj on an endpoint)
|
|
12
|
+
*
|
|
13
|
+
* .note = bare subclass per helpful-errors convention; pass message + metadata at
|
|
14
|
+
* the throw site via `new LambdaDomainObjectRefUnbindableError(message, { ... })`
|
|
15
|
+
*/
|
|
16
|
+
class LambdaDomainObjectRefUnbindableError extends helpful_errors_1.ConstraintError {
|
|
17
|
+
}
|
|
18
|
+
exports.LambdaDomainObjectRefUnbindableError = LambdaDomainObjectRefUnbindableError;
|
|
19
|
+
//# sourceMappingURL=LambdaDomainObjectRefUnbindableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LambdaDomainObjectRefUnbindableError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaDomainObjectRefUnbindableError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;;;;;GAUG;AACH,MAAa,oCAAqC,SAAQ,gCAAe;CAAG;AAA5E,oFAA4E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = projections applied to io before it reaches cloudwatch
|
|
3
|
+
* .why = a log projection is cosmetic — it changes what an operator reads, never what the
|
|
4
|
+
* caller receives
|
|
5
|
+
*
|
|
6
|
+
* .note = these are untyped on purpose. a log projection runs over whatever the chain holds
|
|
7
|
+
* at that moment, which for an error path is neither of the declared output shapes
|
|
8
|
+
*
|
|
9
|
+
* .note = this type once sat in a `Translate.ts` beside a `Translate<TShapes>` interface, a
|
|
10
|
+
* `LambdaEndpointShapes` bag, and a `Translator<TFrom, TInto>` alias — a config
|
|
11
|
+
* namespace for the four translator boundaries an endpoint has. those three shipped
|
|
12
|
+
* with ZERO production consumers, because the input-side translator they existed to
|
|
13
|
+
* type never landed: its home in the middy chain is unresolved (`request.event` is
|
|
14
|
+
* read by `@middy/http-cors` in its `after` hook, so the natural seam starves cors).
|
|
15
|
+
* so they were dead declarations, below the rule of three
|
|
16
|
+
* (rule.prefer.wet-over-dry), and they are deleted rather than shipped.
|
|
17
|
+
*
|
|
18
|
+
* the DESIGN is not lost — the four points (`inputBefore` / `inputAfter` /
|
|
19
|
+
* `outputBefore` / `outputAfter`), the tri-state (absent = default, `false` =
|
|
20
|
+
* disarmed, function = yours), and the structural-bind rationale are recorded in
|
|
21
|
+
* `1.vision.yield.md`. a term costs one line to restore from there; a dead
|
|
22
|
+
* declaration costs every reader who meets it. `TranslateLog` stays because it is
|
|
23
|
+
* the one member with real consumers — `logTranslate` on both endpoint families and
|
|
24
|
+
* on `genIoLoggerMiddleware`, plus a public export.
|
|
25
|
+
*/
|
|
26
|
+
export interface TranslateLog {
|
|
27
|
+
input?: (payload: unknown) => unknown;
|
|
28
|
+
output?: (response: unknown) => unknown;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslateLog.js","sourceRoot":"","sources":["../../../src/domain.operations/genLambdaEndpoint/TranslateLog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Context } from 'aws-lambda';
|
|
2
|
+
import type { ContextLogTrail } from 'sdk-logs';
|
|
3
|
+
/**
|
|
4
|
+
* .what = reads the trail log that `genTrailMiddleware` wrote onto the lambda context
|
|
5
|
+
* .why = BOTH family handlers need it, and each had restated the same cast with its own
|
|
6
|
+
* ~10-line doc block — one of which called itself "the twin of" the other. one
|
|
7
|
+
* declaration, so the two cannot drift (rule.forbid.parallel-codepaths)
|
|
8
|
+
*
|
|
9
|
+
* .as = aws types a handler's second argument as `Context`, which declares no `log`. this
|
|
10
|
+
* sdk's own `genTrailMiddleware` puts it there, so the cast asserts what the sdk's own
|
|
11
|
+
* middleware wrote — never an outside claim
|
|
12
|
+
*
|
|
13
|
+
* .as = `unknown` is the intermediate because `Context` and `ContextLogTrail` overlap on no
|
|
14
|
+
* member, so tsc refuses the direct assertion
|
|
15
|
+
*
|
|
16
|
+
* .why NOT `asContextTrailed` = that reader returns OPTIONAL fields, because a middleware's
|
|
17
|
+
* array position decides whether trail has run yet. a handler has no such doubt: trail is
|
|
18
|
+
* a `before` hook, so it has always run by the time the handler does. so this reader
|
|
19
|
+
* states `log` as PRESENT, and a caller owes no `?.` — the two readers differ in the one
|
|
20
|
+
* guarantee that matters, which is why they are a pair rather than one function
|
|
21
|
+
*
|
|
22
|
+
* .removal = removable when aws-lambda's `Handler` takes a caller-declared context type, or
|
|
23
|
+
* when the families hand their `logic` the middy request rather than the raw arguments —
|
|
24
|
+
* the latter is the cheaper path, and it is why `asContextTrailed` exists for the
|
|
25
|
+
* middleware sites
|
|
26
|
+
*/
|
|
27
|
+
export declare const asContextLogTrail: (input: {
|
|
28
|
+
context: Context;
|
|
29
|
+
}) => ContextLogTrail;
|