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,15 @@
|
|
|
1
|
+
import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
|
|
2
|
+
/**
|
|
3
|
+
* .what = verify every `x-domain-object-ref` across a service's contracts names a
|
|
4
|
+
* dobj that is captured in full (present in `capturedNames`)
|
|
5
|
+
* .why = a reference emits `RefByPrimary<typeof Svc<Prefix><Name>>`; that prefixed
|
|
6
|
+
* resource must be declared, else the generated sdk will not compile. an
|
|
7
|
+
* unbound ref means the referenced dobj is surfaced by no endpoint whole —
|
|
8
|
+
* fail loud so the caller surfaces it (all-or-none, exit 2)
|
|
9
|
+
*
|
|
10
|
+
* .throws LambdaDomainObjectRefUnbindableError — names the unbound ref + its dobj
|
|
11
|
+
*/
|
|
12
|
+
export declare const assertAllDomainObjectRefsBind: (input: {
|
|
13
|
+
contracts: Record<string, LambdaEndpointSchema>;
|
|
14
|
+
capturedNames: Set<string>;
|
|
15
|
+
}) => void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertAllDomainObjectRefsBind = void 0;
|
|
4
|
+
const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/LambdaDomainObjectRefUnbindableError");
|
|
5
|
+
/**
|
|
6
|
+
* .what = verify every `x-domain-object-ref` across a service's contracts names a
|
|
7
|
+
* dobj that is captured in full (present in `capturedNames`)
|
|
8
|
+
* .why = a reference emits `RefByPrimary<typeof Svc<Prefix><Name>>`; that prefixed
|
|
9
|
+
* resource must be declared, else the generated sdk will not compile. an
|
|
10
|
+
* unbound ref means the referenced dobj is surfaced by no endpoint whole —
|
|
11
|
+
* fail loud so the caller surfaces it (all-or-none, exit 2)
|
|
12
|
+
*
|
|
13
|
+
* .throws LambdaDomainObjectRefUnbindableError — names the unbound ref + its dobj
|
|
14
|
+
*/
|
|
15
|
+
const assertAllDomainObjectRefsBind = (input) => {
|
|
16
|
+
const referencedNames = new Set();
|
|
17
|
+
// walk each endpoint's input + output schema trees for ref-pragma names
|
|
18
|
+
for (const schema of Object.values(input.contracts)) {
|
|
19
|
+
collectRefNames({ node: schema.input, into: referencedNames });
|
|
20
|
+
collectRefNames({ node: schema.output, into: referencedNames });
|
|
21
|
+
}
|
|
22
|
+
// every referenced name must be captured in full; else the ref cannot bind
|
|
23
|
+
const unbound = [...referencedNames]
|
|
24
|
+
.filter((name) => !input.capturedNames.has(name))
|
|
25
|
+
.sort();
|
|
26
|
+
if (unbound.length > 0)
|
|
27
|
+
throw new LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError(`domain-object reference(s) cannot bind: ${unbound.join(', ')} — referenced by key but captured by no endpoint`, {
|
|
28
|
+
unbound,
|
|
29
|
+
hint: 'surface each referenced domain-object in full on some endpoint of this service (return it whole via `.contract`) so the codegen can declare its resource',
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.assertAllDomainObjectRefsBind = assertAllDomainObjectRefsBind;
|
|
33
|
+
/**
|
|
34
|
+
* .what = recursively read every `x-domain-object-ref` name in a schema tree
|
|
35
|
+
*/
|
|
36
|
+
const collectRefNames = (input) => {
|
|
37
|
+
const { node, into } = input;
|
|
38
|
+
if (typeof node !== 'object' || node === null)
|
|
39
|
+
return;
|
|
40
|
+
const ref = node['x-domain-object-ref'];
|
|
41
|
+
if (ref?.of)
|
|
42
|
+
into.add(ref.of);
|
|
43
|
+
for (const value of Object.values(node)) {
|
|
44
|
+
if (Array.isArray(value))
|
|
45
|
+
for (const item of value)
|
|
46
|
+
collectRefNames({ node: item, into });
|
|
47
|
+
else
|
|
48
|
+
collectRefNames({ node: value, into });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=assertAllDomainObjectRefsBind.js.map
|
package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertAllDomainObjectRefsBind.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.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AAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;YAC7D,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC"}
|
package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DomainObjectCaptured } from '../../../domain.objects/DomainObjectCaptured';
|
|
2
|
+
import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
|
|
3
|
+
/**
|
|
4
|
+
* .what = collect every domain-object captured across a service's contracts,
|
|
5
|
+
* de-duplicated by name
|
|
6
|
+
* .why = the resources file declares each captured dobj once; a dobj referenced
|
|
7
|
+
* by many endpoints must yield a single declaration (uc.2 dedupe)
|
|
8
|
+
*
|
|
9
|
+
* .throws LambdaDomainObjectNotCapturableError — a pragma-tagged node whose shape
|
|
10
|
+
* cannot be reconstructed (no object properties) (uc.9)
|
|
11
|
+
*/
|
|
12
|
+
export declare const getAllDomainObjectsFromContracts: (input: {
|
|
13
|
+
contracts: Record<string, LambdaEndpointSchema>;
|
|
14
|
+
}) => DomainObjectCaptured[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllDomainObjectsFromContracts = void 0;
|
|
4
|
+
const LambdaDomainObjectNotCapturableError_1 = require("../../../domain.objects/LambdaDomainObjectNotCapturableError");
|
|
5
|
+
const asDomainObjectPragma_1 = require("./asDomainObjectPragma");
|
|
6
|
+
/**
|
|
7
|
+
* .what = collect every domain-object captured across a service's contracts,
|
|
8
|
+
* de-duplicated by name
|
|
9
|
+
* .why = the resources file declares each captured dobj once; a dobj referenced
|
|
10
|
+
* by many endpoints must yield a single declaration (uc.2 dedupe)
|
|
11
|
+
*
|
|
12
|
+
* .throws LambdaDomainObjectNotCapturableError — a pragma-tagged node whose shape
|
|
13
|
+
* cannot be reconstructed (no object properties) (uc.9)
|
|
14
|
+
*/
|
|
15
|
+
const getAllDomainObjectsFromContracts = (input) => {
|
|
16
|
+
// collect every dobj contract from every endpoint's input + output schemas
|
|
17
|
+
const captured = new Map();
|
|
18
|
+
// walk each endpoint's input and output schema trees
|
|
19
|
+
for (const schema of Object.values(input.contracts)) {
|
|
20
|
+
collectFromNode({ node: schema.input, captured });
|
|
21
|
+
collectFromNode({ node: schema.output, captured });
|
|
22
|
+
}
|
|
23
|
+
// return the de-duplicated contracts in stable (name-sorted) order
|
|
24
|
+
return [...captured.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
25
|
+
};
|
|
26
|
+
exports.getAllDomainObjectsFromContracts = getAllDomainObjectsFromContracts;
|
|
27
|
+
/**
|
|
28
|
+
* .what = recursively walk a json-schema node, collect every `x-domain-object`
|
|
29
|
+
* .why = a dobj can appear at any depth (properties, items, $defs, anyOf, etc.)
|
|
30
|
+
*/
|
|
31
|
+
const collectFromNode = (input) => {
|
|
32
|
+
const { node, captured } = input;
|
|
33
|
+
// skip non-object nodes (leaves like strings/booleans/numbers)
|
|
34
|
+
if (typeof node !== 'object' || node === null)
|
|
35
|
+
return;
|
|
36
|
+
// capture this node if it carries a domain-object pragma
|
|
37
|
+
const contract = (0, asDomainObjectPragma_1.asDomainObjectPragma)({ node: node });
|
|
38
|
+
if (contract) {
|
|
39
|
+
// fail loud if the pragma names a dobj with no reconstructable shape (uc.9)
|
|
40
|
+
if (!getIsCapturableShape(node))
|
|
41
|
+
throw new LambdaDomainObjectNotCapturableError_1.LambdaDomainObjectNotCapturableError(`domain-object '${contract.name}' cannot be captured: its object schema declares no properties to reconstruct`, {
|
|
42
|
+
name: contract.name,
|
|
43
|
+
hint: 'ensure the domain-object schema declares its properties (an empty object schema cannot be captured)',
|
|
44
|
+
});
|
|
45
|
+
// keep the first capture; a repeat of the same name is a de-dup no-op
|
|
46
|
+
if (!captured.has(contract.name))
|
|
47
|
+
captured.set(contract.name, contract);
|
|
48
|
+
}
|
|
49
|
+
// recurse into every child value (arrays + nested objects)
|
|
50
|
+
for (const value of Object.values(node)) {
|
|
51
|
+
if (Array.isArray(value))
|
|
52
|
+
for (const item of value)
|
|
53
|
+
collectFromNode({ node: item, captured });
|
|
54
|
+
else
|
|
55
|
+
collectFromNode({ node: value, captured });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* .what = decide whether a schema node has an object shape we can reconstruct
|
|
60
|
+
* .why = a dobj resource needs properties to emit; a pragma without them is uncapturable
|
|
61
|
+
*/
|
|
62
|
+
const getIsCapturableShape = (node) => {
|
|
63
|
+
const properties = node.properties;
|
|
64
|
+
return (typeof properties === 'object' &&
|
|
65
|
+
properties !== null &&
|
|
66
|
+
Object.keys(properties).length > 0);
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=getAllDomainObjectsFromContracts.js.map
|
package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllDomainObjectsFromContracts.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.ts"],"names":[],"mappings":";;;AAGA,uHAAoH;AAEpH,iEAA8D;AAE9D;;;;;;;;GAQG;AACI,MAAM,gCAAgC,GAAG,CAAC,KAEhD,EAA0B,EAAE;IAC3B,2EAA2E;IAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAEzD,qDAAqD;IACrD,KAAK,MAAM,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C;IAC1E,CAAC;IAED,2DAA2D;IAC3D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;;YACjE,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE;IACrD,MAAM,UAAU,GAAI,IAAiC,CAAC,UAAU,CAAC;IACjE,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
|
|
2
|
+
import type { GeneratedFile } from '../../domain.objects/GeneratedFile';
|
|
3
|
+
/**
|
|
4
|
+
* .what = generate a per-service sdk from live lambda contract introspection
|
|
5
|
+
* .why = the whole codegen: discover a service's contracts, capture its
|
|
6
|
+
* domain-objects, and emit the three files (barrel + mechanisms +
|
|
7
|
+
* resources) atomically into the target dir (uc.1, uc.2)
|
|
8
|
+
*
|
|
9
|
+
* .all-or-none = all file content is assembled in memory first; only after every
|
|
10
|
+
* transform succeeds is it written, via one atomic batch call — so any
|
|
11
|
+
* discovery/capture/fs error leaves zero files written (uc.5/6/8/9)
|
|
12
|
+
*/
|
|
13
|
+
export declare const genServiceSdk: (input: {
|
|
14
|
+
which: {
|
|
15
|
+
service: string;
|
|
16
|
+
};
|
|
17
|
+
into: string;
|
|
18
|
+
}, context: ContextAwsLambdaCaller) => Promise<{
|
|
19
|
+
files: GeneratedFile[];
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genServiceSdk = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const getAllLambdaContracts_1 = require("../getAllLambdaContracts/getAllLambdaContracts");
|
|
6
|
+
const asServiceSymbols_1 = require("./asServiceSymbols/asServiceSymbols");
|
|
7
|
+
const asBarrelFileSource_1 = require("./gen.file/asBarrelFileSource");
|
|
8
|
+
const asMechanismsFileSource_1 = require("./gen.file/asMechanismsFileSource");
|
|
9
|
+
const asResourcesFileSource_1 = require("./gen.file/asResourcesFileSource");
|
|
10
|
+
const formatTypescript_1 = require("./gen.file/formatTypescript");
|
|
11
|
+
const setGeneratedFilesBatch_1 = require("./gen.file/setGeneratedFilesBatch");
|
|
12
|
+
const assertAllDomainObjectRefsBind_1 = require("./gen.resource/assertAllDomainObjectRefsBind");
|
|
13
|
+
const getAllDomainObjectsFromContracts_1 = require("./gen.resource/getAllDomainObjectsFromContracts");
|
|
14
|
+
/**
|
|
15
|
+
* .what = generate a per-service sdk from live lambda contract introspection
|
|
16
|
+
* .why = the whole codegen: discover a service's contracts, capture its
|
|
17
|
+
* domain-objects, and emit the three files (barrel + mechanisms +
|
|
18
|
+
* resources) atomically into the target dir (uc.1, uc.2)
|
|
19
|
+
*
|
|
20
|
+
* .all-or-none = all file content is assembled in memory first; only after every
|
|
21
|
+
* transform succeeds is it written, via one atomic batch call — so any
|
|
22
|
+
* discovery/capture/fs error leaves zero files written (uc.5/6/8/9)
|
|
23
|
+
*/
|
|
24
|
+
const genServiceSdk = async (input, context) => {
|
|
25
|
+
// discover the service's endpoint contracts (prep-gated by the spine)
|
|
26
|
+
const contracts = await (0, getAllLambdaContracts_1.getAllLambdaContracts)({ which: { service: input.which.service } }, context);
|
|
27
|
+
// derive the codegen symbols (object name + dobj prefix)
|
|
28
|
+
const symbols = (0, asServiceSymbols_1.asServiceSymbols)({ service: input.which.service });
|
|
29
|
+
// capture every domain-object referenced across the contracts (de-duped)
|
|
30
|
+
const dobjs = (0, getAllDomainObjectsFromContracts_1.getAllDomainObjectsFromContracts)({ contracts });
|
|
31
|
+
// fail loud if any dobj REFERENCE (by key) names a dobj captured by no endpoint —
|
|
32
|
+
// its `typeof Svc<Prefix><Name>` resource would not exist (all-or-none, exit 2)
|
|
33
|
+
(0, assertAllDomainObjectRefsBind_1.assertAllDomainObjectRefsBind)({
|
|
34
|
+
contracts,
|
|
35
|
+
capturedNames: new Set(dobjs.map((dobj) => dobj.name)),
|
|
36
|
+
});
|
|
37
|
+
// build the ref map: each dobj name → its prefixed resource name
|
|
38
|
+
const dobjRefs = Object.fromEntries(dobjs.map((dobj) => [dobj.name, `${symbols.prefix}${dobj.name}`]));
|
|
39
|
+
const resourceNames = dobjs.map((dobj) => `${symbols.prefix}${dobj.name}`);
|
|
40
|
+
// the module specifiers the generated files use to import each other
|
|
41
|
+
const resourcesModule = `./${symbols.object}.resources`;
|
|
42
|
+
const mechanismsModule = `./${symbols.object}.mechanisms`;
|
|
43
|
+
// assemble the three file texts in memory
|
|
44
|
+
const resourcesText = (0, asResourcesFileSource_1.asResourcesFileSource)({
|
|
45
|
+
dobjs,
|
|
46
|
+
prefix: symbols.prefix,
|
|
47
|
+
dobjRefs,
|
|
48
|
+
});
|
|
49
|
+
const mechanismsText = (0, asMechanismsFileSource_1.asMechanismsFileSource)({
|
|
50
|
+
service: input.which.service,
|
|
51
|
+
object: symbols.object,
|
|
52
|
+
resourcesModule,
|
|
53
|
+
resourceNames,
|
|
54
|
+
contracts,
|
|
55
|
+
dobjRefs,
|
|
56
|
+
});
|
|
57
|
+
const barrelText = (0, asBarrelFileSource_1.asBarrelFileSource)({
|
|
58
|
+
object: symbols.object,
|
|
59
|
+
mechanismsModule,
|
|
60
|
+
resourcesModule,
|
|
61
|
+
});
|
|
62
|
+
// pair each text with its target path
|
|
63
|
+
const drafts = [
|
|
64
|
+
{ path: (0, node_path_1.join)(input.into, `${symbols.object}.ts`), content: barrelText },
|
|
65
|
+
{
|
|
66
|
+
path: (0, node_path_1.join)(input.into, `${symbols.object}.mechanisms.ts`),
|
|
67
|
+
content: mechanismsText,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: (0, node_path_1.join)(input.into, `${symbols.object}.resources.ts`),
|
|
71
|
+
content: resourcesText,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
// format each file's text through biome (its real target path drives which
|
|
75
|
+
// biome config applies) — clean, drop-in output, not our own whitespace
|
|
76
|
+
const files = await Promise.all(drafts.map(async (draft) => ({
|
|
77
|
+
path: draft.path,
|
|
78
|
+
content: await (0, formatTypescript_1.formatTypescript)({
|
|
79
|
+
content: draft.content,
|
|
80
|
+
path: draft.path,
|
|
81
|
+
}),
|
|
82
|
+
})));
|
|
83
|
+
// write all files atomically (all-or-none)
|
|
84
|
+
await (0, setGeneratedFilesBatch_1.setGeneratedFilesBatch)({ files });
|
|
85
|
+
return { files };
|
|
86
|
+
};
|
|
87
|
+
exports.genServiceSdk = genServiceSdk;
|
|
88
|
+
//# sourceMappingURL=genServiceSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genServiceSdk.js","sourceRoot":"","sources":["../../../src/domain.operations/genServiceSdk/genServiceSdk.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAGjC,0FAAuF;AACvF,0EAAuE;AACvE,sEAAmE;AACnE,8EAA2E;AAC3E,4EAAyE;AACzE,kEAA+D;AAC/D,8EAA2E;AAC3E,gGAA6F;AAC7F,sGAAmG;AAEnG;;;;;;;;;GASG;AACI,MAAM,aAAa,GAAG,KAAK,EAChC,KAGC,EACD,OAA+B,EACM,EAAE;IACvC,sEAAsE;IACtE,MAAM,SAAS,GAAG,MAAM,IAAA,6CAAqB,EAC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24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getAllLambdaContracts = void 0;
|
|
27
|
+
const LambdaCredentialsAbsentError_1 = require("../../domain.objects/LambdaCredentialsAbsentError");
|
|
27
28
|
const LambdaIntrospectionBlockedError_1 = require("../../domain.objects/LambdaIntrospectionBlockedError");
|
|
28
29
|
const LambdaServiceNotFoundError_1 = require("../../domain.objects/LambdaServiceNotFoundError");
|
|
29
30
|
const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
|
|
@@ -50,18 +51,32 @@ const getAllLambdaContracts = async (input, context) => {
|
|
|
50
51
|
// fail fast if introspection is blocked: only prep exposes schemas
|
|
51
52
|
// (gate up front so no request is made and no schema can leak)
|
|
52
53
|
if (context.env.access !== 'prep') {
|
|
53
|
-
throw new LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError(`introspection is only available in prep environment, got: ${context.env.access}`, {
|
|
54
|
+
throw new LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError(`introspection is only available in prep environment, got: ${context.env.access}`, {
|
|
55
|
+
service: input.which.service,
|
|
56
|
+
access: context.env.access,
|
|
57
|
+
hint: 're-run with --env prep',
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
// build prefix from service + access
|
|
56
61
|
const prefix = `${input.which.service}-${context.env.access}-`;
|
|
57
62
|
// get or create LambdaClient (genLambdaSdk always returns valid client)
|
|
58
63
|
const sdkLambda = context.aws?.lambda?.sdk ??
|
|
59
64
|
(await Promise.resolve().then(() => __importStar(require('../../access/sdks/lambda/genLambdaSdk'))).then((m) => m.genLambdaSdk({ env: { region: context.env.region } })));
|
|
60
|
-
//
|
|
61
|
-
|
|
65
|
+
// discover endpoint slugs by prefix. a creds failure surfaces on this first aws
|
|
66
|
+
// call — map it to a caller-must-fix LambdaCredentialsAbsentError (with an unlock
|
|
67
|
+
// hint), not a raw aws CredentialsProviderError
|
|
68
|
+
const slugs = await (0, getAllLambdaFunctionsByPrefix_1.getAllLambdaFunctionsByPrefix)({ prefix }, { sdkLambda }).catch((error) => throwIfCredentialsError({
|
|
69
|
+
error,
|
|
70
|
+
service: input.which.service,
|
|
71
|
+
access: context.env.access,
|
|
72
|
+
}));
|
|
62
73
|
// throw if no endpoints found
|
|
63
74
|
if (slugs.length === 0) {
|
|
64
|
-
throw new LambdaServiceNotFoundError_1.LambdaServiceNotFoundError(`no lambda functions found for service: ${input.which.service}`, {
|
|
75
|
+
throw new LambdaServiceNotFoundError_1.LambdaServiceNotFoundError(`no lambda functions found for service: ${input.which.service}`, {
|
|
76
|
+
service: input.which.service,
|
|
77
|
+
prefix,
|
|
78
|
+
hint: 'check the --for service name and verify it is deployed to the prep environment',
|
|
79
|
+
});
|
|
65
80
|
}
|
|
66
81
|
// log the discovered endpoints for observability
|
|
67
82
|
context.log.debug('getAllLambdaContracts.discovered', {
|
|
@@ -86,4 +101,34 @@ const getAllLambdaContracts = async (input, context) => {
|
|
|
86
101
|
return (0, asContractRecord_1.asContractRecord)(entries);
|
|
87
102
|
};
|
|
88
103
|
exports.getAllLambdaContracts = getAllLambdaContracts;
|
|
104
|
+
/**
|
|
105
|
+
* .what = decide whether an error is an aws sdk credentials failure
|
|
106
|
+
* .why = a creds failure is caller-must-fix (unlock + retry), not a malfunction —
|
|
107
|
+
* the discovery boundary maps it to a hinted LambdaCredentialsAbsentError
|
|
108
|
+
*/
|
|
109
|
+
const getIsCredentialsError = (error) => {
|
|
110
|
+
if (!(error instanceof Error))
|
|
111
|
+
return false;
|
|
112
|
+
const name = error.name.toLowerCase();
|
|
113
|
+
const message = error.message.toLowerCase();
|
|
114
|
+
return (name.includes('credential') ||
|
|
115
|
+
message.includes('credential') ||
|
|
116
|
+
(message.includes('security token') && message.includes('expired')));
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* .what = map an aws credentials failure to a hinted LambdaCredentialsAbsentError
|
|
120
|
+
* .why = surface a creds failure with an unlock hint (caller-must-fix) rather than a
|
|
121
|
+
* raw aws error; any non-creds error rethrows unchanged. returns `never` — it
|
|
122
|
+
* always throws — so the caller keeps a non-null slug list.
|
|
123
|
+
*/
|
|
124
|
+
const throwIfCredentialsError = (input) => {
|
|
125
|
+
if (!getIsCredentialsError(input.error))
|
|
126
|
+
throw input.error;
|
|
127
|
+
throw new LambdaCredentialsAbsentError_1.LambdaCredentialsAbsentError('aws credentials are absent or expired; cannot introspect', {
|
|
128
|
+
service: input.service,
|
|
129
|
+
access: input.access,
|
|
130
|
+
hint: 'unlock prep creds (e.g. `rhx keyrack unlock --owner ehmpath --env prep`), then re-run',
|
|
131
|
+
cause: input.error instanceof Error ? input.error : undefined,
|
|
132
|
+
});
|
|
133
|
+
};
|
|
89
134
|
//# sourceMappingURL=getAllLambdaContracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAllLambdaContracts.js","sourceRoot":"","sources":["../../../src/domain.operations/getAllLambdaContracts/getAllLambdaContracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getAllLambdaContracts.js","sourceRoot":"","sources":["../../../src/domain.operations/getAllLambdaContracts/getAllLambdaContracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,oGAAiG;AAEjG,0GAAuG;AACvG,gGAA6F;AAC7F,2EAAwE;AACxE,uFAAoF;AACpF,wEAAqE;AACrE,kGAA+F;AAE/F;;;;;;;;;;;;;;;GAeG;AACI,MAAM,qBAAqB,GAAG,KAAK,EACxC,KAIC,EACD,OAA+B,EACgB,EAAE;IACjD,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,iEAA+B,CACvC,6DAA6D,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,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AC9B,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,CAAC,KAIhC,EAAS,EAAE;IACV,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,MAAM,KAAK,CAAC,KAAK,CAAC;IAC3D,MAAM,IAAI,2DAA4B,CACpC,0DAA0D,EAC1D;QACE,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,uFAAuF;QAC7F,KAAK,EAAE,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;KAC9D,CACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,16 @@
|
|
|
4
4
|
* define endpoints, ask endpoints, auto-propagate trace-ids.
|
|
5
5
|
*/
|
|
6
6
|
export { BadRequestError } from 'helpful-errors';
|
|
7
|
+
export type { ApiGatewayRequestPayload } from './domain.objects/ApiGatewayRequestPayload';
|
|
8
|
+
export type { ApiGatewayResponse } from './domain.objects/ApiGatewayResponse';
|
|
9
|
+
export type { ApiGatewayResponsePayload } from './domain.objects/ApiGatewayResponsePayload';
|
|
7
10
|
export type { ContextAwsLambdaCaller } from './domain.objects/ContextAwsLambdaCaller';
|
|
8
11
|
export type { ContextAwsLambdaServer, EnvAccess, EnvConfig, } from './domain.objects/ContextAwsLambdaServer';
|
|
12
|
+
export { GeneratedFile } from './domain.objects/GeneratedFile';
|
|
9
13
|
export { HttpStatusCode } from './domain.objects/HttpStatusCode';
|
|
14
|
+
export { LambdaCredentialsAbsentError } from './domain.objects/LambdaCredentialsAbsentError';
|
|
15
|
+
export { LambdaDomainObjectNotCapturableError } from './domain.objects/LambdaDomainObjectNotCapturableError';
|
|
16
|
+
export { LambdaDomainObjectRefUnbindableError } from './domain.objects/LambdaDomainObjectRefUnbindableError';
|
|
10
17
|
export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
|
|
11
18
|
export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
|
|
12
19
|
export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
|
|
@@ -19,19 +26,48 @@ export { askLambdaEndpoint } from './domain.operations/askLambdaEndpoint/askLamb
|
|
|
19
26
|
export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet';
|
|
20
27
|
export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
|
|
21
28
|
export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
|
|
29
|
+
export { asApiGatewayResponseSchema } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema';
|
|
22
30
|
export type { CorsConfig, ForApiGatewayContext, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
|
|
23
31
|
export { forApiGateway } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
|
|
24
|
-
export
|
|
32
|
+
export { isApiGatewayResponse } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse';
|
|
25
33
|
export { genApiGatewayEventNormalizationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
|
|
34
|
+
export { genContentTypeCoherenceMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware';
|
|
35
|
+
export { genZodBodyValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware';
|
|
36
|
+
export type { UnifiedApiGatewayEvent } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent';
|
|
26
37
|
export type { EndpointOperation, FlatPayload, GenLambdaEndpointContext, GenLambdaEndpointInput, LambdaHandlerInput, WrappedPayload, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
|
|
27
38
|
export { genLambdaEndpoint } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
|
|
28
39
|
export { genZodEventValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware';
|
|
40
|
+
/**
|
|
41
|
+
* .what = the shared `request.context` reader every exported middleware uses
|
|
42
|
+
* .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
|
|
43
|
+
* the lambda context. a consumer who authors a PEER of the exported middlewares would
|
|
44
|
+
* otherwise restate that cast — the exact sprawl this reader exists to retire
|
|
45
|
+
* (rule.forbid.as-cast)
|
|
46
|
+
*/
|
|
47
|
+
export { asContextTrailed, type ContextTrailed, } from './domain.operations/genLambdaEndpoint/middleware/asContextTrailed';
|
|
29
48
|
export { genConstraintErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware';
|
|
49
|
+
export { genInternalServiceErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware';
|
|
30
50
|
export { genIntrospectionMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware';
|
|
31
|
-
export type { IoLogTranslate } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
|
|
32
51
|
export { genIoLoggerMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
|
|
33
52
|
export { genTrailMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware';
|
|
34
53
|
export { genZodOutputValidationMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware';
|
|
54
|
+
/**
|
|
55
|
+
* .what = the two error-body shapes `genConstraintErrorMiddleware.asOutputAfter` receives
|
|
56
|
+
* .why = that middleware is public, so its OWN parameter type must be nameable by a consumer.
|
|
57
|
+
* an unexported parameter type forces an `any` or a hand-copied re-declaration at the
|
|
58
|
+
* public boundary (rule.forbid.as-cast)
|
|
59
|
+
*/
|
|
60
|
+
export type { LambdaEndpointErrorResponseBodyAncient, LambdaEndpointErrorResponseBodyContemp, } from './domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody';
|
|
61
|
+
/**
|
|
62
|
+
* .note = `TranslateLog` is public because `logTranslate` accepts it, and it replaces the
|
|
63
|
+
* formerly-public `IoLogTranslate`. its three designed peers — `Translate<TShapes>`,
|
|
64
|
+
* `LambdaEndpointShapes`, `Translator<TFrom, TInto>` — are DELETED rather than
|
|
65
|
+
* unexported: no config field ever accepted a `Translate`, so all three would ship with
|
|
66
|
+
* zero consumers (rule.prefer.wet-over-dry). the design survives in `1.vision.yield.md`,
|
|
67
|
+
* so a later round restores a TERM from a record rather than a dead declaration
|
|
68
|
+
*/
|
|
69
|
+
export type { TranslateLog } from './domain.operations/genLambdaEndpoint/TranslateLog';
|
|
70
|
+
export { genServiceSdk } from './domain.operations/genServiceSdk/genServiceSdk';
|
|
35
71
|
export { type GetAllLambdaContractsContext, type GetAllLambdaContractsInput, getAllLambdaContracts, } from './domain.operations/getAllLambdaContracts/getAllLambdaContracts';
|
|
36
72
|
export { getAllLambdaFunctionsByPrefix } from './domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix';
|
|
37
73
|
export { type GetOneLambdaContractContext, type GetOneLambdaContractInput, getOneLambdaContract, } from './domain.operations/getOneLambdaContract/getOneLambdaContract';
|
package/dist/index.js
CHANGED
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
* define endpoints, ask endpoints, auto-propagate trace-ids.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genConstraintErrorMiddleware = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genApiGatewayEventNormalizationMiddleware = exports.forApiGateway = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.HttpStatusCode = exports.BadRequestError = void 0;
|
|
8
|
+
exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genZodBodyValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.forApiGateway = exports.asApiGatewayResponseSchema = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.BadRequestError = void 0;
|
|
9
9
|
// re-export from helpful-errors for convenience
|
|
10
10
|
var helpful_errors_1 = require("helpful-errors");
|
|
11
11
|
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
|
|
12
|
+
var GeneratedFile_1 = require("./domain.objects/GeneratedFile");
|
|
13
|
+
Object.defineProperty(exports, "GeneratedFile", { enumerable: true, get: function () { return GeneratedFile_1.GeneratedFile; } });
|
|
12
14
|
var HttpStatusCode_1 = require("./domain.objects/HttpStatusCode");
|
|
13
15
|
Object.defineProperty(exports, "HttpStatusCode", { enumerable: true, get: function () { return HttpStatusCode_1.HttpStatusCode; } });
|
|
16
|
+
var LambdaCredentialsAbsentError_1 = require("./domain.objects/LambdaCredentialsAbsentError");
|
|
17
|
+
Object.defineProperty(exports, "LambdaCredentialsAbsentError", { enumerable: true, get: function () { return LambdaCredentialsAbsentError_1.LambdaCredentialsAbsentError; } });
|
|
18
|
+
var LambdaDomainObjectNotCapturableError_1 = require("./domain.objects/LambdaDomainObjectNotCapturableError");
|
|
19
|
+
Object.defineProperty(exports, "LambdaDomainObjectNotCapturableError", { enumerable: true, get: function () { return LambdaDomainObjectNotCapturableError_1.LambdaDomainObjectNotCapturableError; } });
|
|
20
|
+
var LambdaDomainObjectRefUnbindableError_1 = require("./domain.objects/LambdaDomainObjectRefUnbindableError");
|
|
21
|
+
Object.defineProperty(exports, "LambdaDomainObjectRefUnbindableError", { enumerable: true, get: function () { return LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError; } });
|
|
14
22
|
var LambdaEndpoint_1 = require("./domain.objects/LambdaEndpoint");
|
|
15
23
|
Object.defineProperty(exports, "LambdaEndpoint", { enumerable: true, get: function () { return LambdaEndpoint_1.LambdaEndpoint; } });
|
|
16
24
|
var LambdaEndpointError_1 = require("./domain.objects/LambdaEndpointError");
|
|
@@ -34,16 +42,35 @@ Object.defineProperty(exports, "getAskLambdaCacheKey", { enumerable: true, get:
|
|
|
34
42
|
// transformers
|
|
35
43
|
var asLambdaEndpoint_1 = require("./domain.operations/asLambdaEndpoint/asLambdaEndpoint");
|
|
36
44
|
Object.defineProperty(exports, "asLambdaEndpoint", { enumerable: true, get: function () { return asLambdaEndpoint_1.asLambdaEndpoint; } });
|
|
45
|
+
var asApiGatewayResponseSchema_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema");
|
|
46
|
+
Object.defineProperty(exports, "asApiGatewayResponseSchema", { enumerable: true, get: function () { return asApiGatewayResponseSchema_1.asApiGatewayResponseSchema; } });
|
|
37
47
|
var genLambdaEndpoint_forApiGateway_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway");
|
|
38
48
|
Object.defineProperty(exports, "forApiGateway", { enumerable: true, get: function () { return genLambdaEndpoint_forApiGateway_1.forApiGateway; } });
|
|
49
|
+
var isApiGatewayResponse_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse");
|
|
50
|
+
Object.defineProperty(exports, "isApiGatewayResponse", { enumerable: true, get: function () { return isApiGatewayResponse_1.isApiGatewayResponse; } });
|
|
39
51
|
var genApiGatewayEventNormalizationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware");
|
|
40
52
|
Object.defineProperty(exports, "genApiGatewayEventNormalizationMiddleware", { enumerable: true, get: function () { return genApiGatewayEventNormalizationMiddleware_1.genApiGatewayEventNormalizationMiddleware; } });
|
|
53
|
+
var genContentTypeCoherenceMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware");
|
|
54
|
+
Object.defineProperty(exports, "genContentTypeCoherenceMiddleware", { enumerable: true, get: function () { return genContentTypeCoherenceMiddleware_1.genContentTypeCoherenceMiddleware; } });
|
|
55
|
+
var genZodBodyValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware");
|
|
56
|
+
Object.defineProperty(exports, "genZodBodyValidationMiddleware", { enumerable: true, get: function () { return genZodBodyValidationMiddleware_1.genZodBodyValidationMiddleware; } });
|
|
41
57
|
var genLambdaEndpoint_forAskEndpoint_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint");
|
|
42
58
|
Object.defineProperty(exports, "genLambdaEndpoint", { enumerable: true, get: function () { return genLambdaEndpoint_forAskEndpoint_1.genLambdaEndpoint; } });
|
|
43
59
|
var genZodEventValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware");
|
|
44
60
|
Object.defineProperty(exports, "genZodEventValidationMiddleware", { enumerable: true, get: function () { return genZodEventValidationMiddleware_1.genZodEventValidationMiddleware; } });
|
|
61
|
+
/**
|
|
62
|
+
* .what = the shared `request.context` reader every exported middleware uses
|
|
63
|
+
* .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
|
|
64
|
+
* the lambda context. a consumer who authors a PEER of the exported middlewares would
|
|
65
|
+
* otherwise restate that cast — the exact sprawl this reader exists to retire
|
|
66
|
+
* (rule.forbid.as-cast)
|
|
67
|
+
*/
|
|
68
|
+
var asContextTrailed_1 = require("./domain.operations/genLambdaEndpoint/middleware/asContextTrailed");
|
|
69
|
+
Object.defineProperty(exports, "asContextTrailed", { enumerable: true, get: function () { return asContextTrailed_1.asContextTrailed; } });
|
|
45
70
|
var genConstraintErrorMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware");
|
|
46
71
|
Object.defineProperty(exports, "genConstraintErrorMiddleware", { enumerable: true, get: function () { return genConstraintErrorMiddleware_1.genConstraintErrorMiddleware; } });
|
|
72
|
+
var genInternalServiceErrorMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware");
|
|
73
|
+
Object.defineProperty(exports, "genInternalServiceErrorMiddleware", { enumerable: true, get: function () { return genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware; } });
|
|
47
74
|
var genIntrospectionMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware");
|
|
48
75
|
Object.defineProperty(exports, "genIntrospectionMiddleware", { enumerable: true, get: function () { return genIntrospectionMiddleware_1.genIntrospectionMiddleware; } });
|
|
49
76
|
var genIoLoggerMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware");
|
|
@@ -53,6 +80,9 @@ var genTrailMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middle
|
|
|
53
80
|
Object.defineProperty(exports, "genTrailMiddleware", { enumerable: true, get: function () { return genTrailMiddleware_1.genTrailMiddleware; } });
|
|
54
81
|
var genZodOutputValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware");
|
|
55
82
|
Object.defineProperty(exports, "genZodOutputValidationMiddleware", { enumerable: true, get: function () { return genZodOutputValidationMiddleware_1.genZodOutputValidationMiddleware; } });
|
|
83
|
+
// sdk codegen (generate a per-service sdk from introspection)
|
|
84
|
+
var genServiceSdk_1 = require("./domain.operations/genServiceSdk/genServiceSdk");
|
|
85
|
+
Object.defineProperty(exports, "genServiceSdk", { enumerable: true, get: function () { return genServiceSdk_1.genServiceSdk; } });
|
|
56
86
|
// contract discovery (for sdk generation)
|
|
57
87
|
var getAllLambdaContracts_1 = require("./domain.operations/getAllLambdaContracts/getAllLambdaContracts");
|
|
58
88
|
Object.defineProperty(exports, "getAllLambdaContracts", { enumerable: true, get: function () { return getAllLambdaContracts_1.getAllLambdaContracts; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;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