sdk-aws-lambda 0.1.1 → 0.2.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.
Files changed (114) hide show
  1. package/dist/{domain.operations/askLambdaEndpoint/invoke/genLambdaClient.d.ts → access/sdks/lambda/genLambdaSdk.d.ts} +2 -2
  2. package/dist/{domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js → access/sdks/lambda/genLambdaSdk.js} +7 -7
  3. package/dist/access/sdks/lambda/genLambdaSdk.js.map +1 -0
  4. package/dist/{domain.operations/askLambdaEndpoint/invoke → access/sdks/lambda}/sdkLambdaInvoke.d.ts +6 -2
  5. package/dist/{domain.operations/askLambdaEndpoint/invoke → access/sdks/lambda}/sdkLambdaInvoke.js +6 -3
  6. package/dist/access/sdks/lambda/sdkLambdaInvoke.js.map +1 -0
  7. package/dist/domain.objects/ContextAwsLambdaCaller.d.ts +25 -0
  8. package/dist/domain.objects/ContextAwsLambdaCaller.js +3 -0
  9. package/dist/domain.objects/ContextAwsLambdaCaller.js.map +1 -0
  10. package/dist/domain.objects/ContextAwsLambdaServer.d.ts +30 -0
  11. package/dist/domain.objects/ContextAwsLambdaServer.js +3 -0
  12. package/dist/domain.objects/ContextAwsLambdaServer.js.map +1 -0
  13. package/dist/domain.objects/HttpStatusCode.d.ts +2 -2
  14. package/dist/domain.objects/HttpStatusCode.js +3 -3
  15. package/dist/domain.objects/LambdaEndpoint.d.ts +35 -0
  16. package/dist/domain.objects/LambdaEndpoint.js +10 -0
  17. package/dist/domain.objects/LambdaEndpoint.js.map +1 -0
  18. package/dist/domain.objects/LambdaEndpointError.d.ts +5 -8
  19. package/dist/domain.objects/LambdaEndpointError.js.map +1 -1
  20. package/dist/domain.objects/LambdaEndpointSchema.d.ts +9 -0
  21. package/dist/domain.objects/LambdaEndpointSchema.js +3 -0
  22. package/dist/domain.objects/LambdaEndpointSchema.js.map +1 -0
  23. package/dist/domain.objects/LambdaFunctionNotFoundError.d.ts +10 -0
  24. package/dist/domain.objects/LambdaFunctionNotFoundError.js +15 -0
  25. package/dist/domain.objects/LambdaFunctionNotFoundError.js.map +1 -0
  26. package/dist/domain.objects/LambdaIntrospectionBlockedError.d.ts +10 -0
  27. package/dist/domain.objects/LambdaIntrospectionBlockedError.js +15 -0
  28. package/dist/domain.objects/LambdaIntrospectionBlockedError.js.map +1 -0
  29. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.d.ts +18 -0
  30. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js +15 -0
  31. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js.map +1 -0
  32. package/dist/domain.objects/LambdaServiceNotFoundError.d.ts +10 -0
  33. package/dist/domain.objects/LambdaServiceNotFoundError.js +15 -0
  34. package/dist/domain.objects/LambdaServiceNotFoundError.js.map +1 -0
  35. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.d.ts +20 -0
  36. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js +47 -0
  37. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js.map +1 -0
  38. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +2 -12
  39. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +13 -22
  40. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
  41. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.d.ts +2 -2
  42. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js.map +1 -1
  43. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.d.ts +3 -4
  44. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js +17 -5
  45. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js.map +1 -1
  46. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.d.ts +1 -1
  47. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js +3 -3
  48. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +13 -8
  49. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +20 -19
  50. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
  51. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.d.ts +13 -0
  52. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js +26 -0
  53. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js.map +1 -0
  54. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +2 -2
  55. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +15 -14
  56. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +1 -1
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +15 -8
  58. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +16 -9
  59. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  60. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.d.ts +3 -3
  61. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js +5 -5
  62. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.d.ts +1 -1
  63. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js +1 -1
  64. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +88 -63
  65. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
  66. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +7 -9
  67. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +14 -11
  68. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  69. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +1 -1
  70. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +22 -0
  71. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +7 -0
  72. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +13 -0
  73. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -0
  74. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.d.ts +5 -0
  75. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js +16 -0
  76. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js.map +1 -0
  77. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +53 -0
  78. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -0
  79. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +1 -1
  80. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +1 -1
  81. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +1 -1
  82. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +12 -4
  83. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  84. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.d.ts +33 -0
  85. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +89 -0
  86. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -0
  87. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.d.ts +6 -0
  88. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js +12 -0
  89. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js.map +1 -0
  90. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.d.ts +15 -0
  91. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js +44 -0
  92. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js.map +1 -0
  93. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.d.ts +16 -0
  94. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js +26 -0
  95. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js.map +1 -0
  96. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.d.ts +16 -0
  97. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js +76 -0
  98. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js.map +1 -0
  99. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.d.ts +32 -0
  100. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js +112 -0
  101. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js.map +1 -0
  102. package/dist/index.d.ts +14 -1
  103. package/dist/index.js +24 -2
  104. package/dist/index.js.map +1 -1
  105. package/package.json +14 -12
  106. package/readme.md +64 -4
  107. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.d.ts +0 -11
  108. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js +0 -21
  109. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js.map +0 -1
  110. package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js.map +0 -1
  111. package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.js.map +0 -1
  112. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.d.ts +0 -9
  113. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js +0 -12
  114. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllLambdaContracts.js","sourceRoot":"","sources":["../../../src/domain.operations/getAllLambdaContracts/getAllLambdaContracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,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,EACjF,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAC7D,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;IAE/D,wEAAwE;IACxE,MAAM,SAAS,G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AE,QAAQ,CAAC,OAAO;gBACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;aAC5B;SACF,EACD,cAAc,CACf,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAmC,CAAC;IACvE,CAAC,CAAC,CACH,CAAC;IAEF,8CAA8C;IAC9C,OAAO,IAAA,mCAAgB,EAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC;AAnEW,QAAA,qBAAqB,yBAmEhC"}
@@ -0,0 +1,6 @@
1
+ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
2
+ /**
3
+ * .what = transform array of [functionName, schema] tuples to Record
4
+ * .why = enables keyed lookup of contracts by function name
5
+ */
6
+ export declare const asContractRecord: (contracts: Array<[string, LambdaEndpointSchema]>) => Record<string, LambdaEndpointSchema>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asContractRecord = void 0;
4
+ /**
5
+ * .what = transform array of [functionName, schema] tuples to Record
6
+ * .why = enables keyed lookup of contracts by function name
7
+ */
8
+ const asContractRecord = (contracts) => {
9
+ return Object.fromEntries(contracts);
10
+ };
11
+ exports.asContractRecord = asContractRecord;
12
+ //# sourceMappingURL=asContractRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asContractRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAC9B,SAAgD,EACV,EAAE;IACxC,OAAO,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
@@ -0,0 +1,15 @@
1
+ import type { LambdaClient } from '@aws-sdk/client-lambda';
2
+ /**
3
+ * .what = get all lambda endpoint slugs that match a prefix
4
+ * .why = enables discovery of lambda endpoints for contract introspection
5
+ *
6
+ * behavior:
7
+ * - paginates through all functions in the aws account
8
+ * - filters by prefix
9
+ * - returns slugs (aws function names, not full ARNs)
10
+ */
11
+ export declare const getAllLambdaFunctionsByPrefix: (input: {
12
+ prefix: string;
13
+ }, context: {
14
+ sdkLambda: LambdaClient;
15
+ }) => Promise<string[]>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllLambdaFunctionsByPrefix = void 0;
4
+ const sdkLambdaGetAllFunctions_1 = require("./sdkLambdaGetAllFunctions");
5
+ /**
6
+ * .what = filter slugs by prefix
7
+ * .why = extract transformation from orchestrator for clear grain separation
8
+ */
9
+ const getMatchedSlugs = (input) => {
10
+ return input.slugs.filter((slug) => slug.startsWith(input.prefix));
11
+ };
12
+ /**
13
+ * .what = recursively fetch pages of functions and collect matched slugs
14
+ * .why = avoids mutation via push, enables functional pagination
15
+ */
16
+ const collectPagesRecursive = async (input, context) => {
17
+ // fetch page from communicator
18
+ const page = await (0, sdkLambdaGetAllFunctions_1.sdkLambdaGetAllFunctions)({ marker: input.marker }, { sdkLambda: context.sdkLambda });
19
+ // filter by prefix via transformer
20
+ const matched = getMatchedSlugs({
21
+ slugs: page.slugs,
22
+ prefix: input.prefix,
23
+ });
24
+ // combine collected with this page
25
+ const nextCollected = [...input.collected, ...matched];
26
+ // recurse if more pages, otherwise return
27
+ if (!page.nextMarker)
28
+ return nextCollected;
29
+ return collectPagesRecursive({ ...input, marker: page.nextMarker, collected: nextCollected }, context);
30
+ };
31
+ /**
32
+ * .what = get all lambda endpoint slugs that match a prefix
33
+ * .why = enables discovery of lambda endpoints for contract introspection
34
+ *
35
+ * behavior:
36
+ * - paginates through all functions in the aws account
37
+ * - filters by prefix
38
+ * - returns slugs (aws function names, not full ARNs)
39
+ */
40
+ const getAllLambdaFunctionsByPrefix = async (input, context) => {
41
+ return collectPagesRecursive({ prefix: input.prefix, marker: undefined, collected: [] }, context);
42
+ };
43
+ exports.getAllLambdaFunctionsByPrefix = getAllLambdaFunctionsByPrefix;
44
+ //# sourceMappingURL=getAllLambdaFunctionsByPrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllLambdaFunctionsByPrefix.js","sourceRoot":"","sources":["../../../../src/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.ts"],"names":[],"mappings":";;;AAEA,yEAAsE;AAEtE;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAGxB,EAAY,EAAE;IACb,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,KAAK,EACjC,KAIC,EACD,OAAoC,EACjB,EAAE;IACrB,+BAA+B;IAC/B,MAAM,IAAI,GAAG,MAAM,IAAA,mDAAwB,EACzC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EACxB,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CACjC,CAAC;IAEF,mCAAmC;IACnC,MAAM,OAAO,GAAG,eAAe,CAAC;QAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAC;IAEH,mCAAmC;IACnC,MAAM,aAAa,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,CAAC;IAEvD,0CAA0C;IAC1C,IAAI,CAAC,IAAI,CAAC,UAAU;QAAE,OAAO,aAAa,CAAC;IAC3C,OAAO,qBAAqB,CAC1B,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,EAC/D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,6BAA6B,GAAG,KAAK,EAChD,KAEC,EACD,OAEC,EACkB,EAAE;IACrB,OAAO,qBAAqB,CAC1B,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,EAC1D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC"}
@@ -0,0 +1,16 @@
1
+ import { type LambdaClient } from '@aws-sdk/client-lambda';
2
+ /**
3
+ * .what = list lambda function slugs via aws sdk
4
+ * .why = communicator encapsulates raw aws sdk i/o at boundary
5
+ *
6
+ * .note = aws function names ARE endpoint slugs; sdkLambda (the client
7
+ * dependency) is injected via context
8
+ */
9
+ export declare const sdkLambdaGetAllFunctions: (input: {
10
+ marker?: string;
11
+ }, context: {
12
+ sdkLambda: LambdaClient;
13
+ }) => Promise<{
14
+ slugs: string[];
15
+ nextMarker: string | undefined;
16
+ }>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sdkLambdaGetAllFunctions = void 0;
4
+ const client_lambda_1 = require("@aws-sdk/client-lambda");
5
+ /**
6
+ * .what = list lambda function slugs via aws sdk
7
+ * .why = communicator encapsulates raw aws sdk i/o at boundary
8
+ *
9
+ * .note = aws function names ARE endpoint slugs; sdkLambda (the client
10
+ * dependency) is injected via context
11
+ */
12
+ const sdkLambdaGetAllFunctions = async (input, context) => {
13
+ const result = await context.sdkLambda.send(new client_lambda_1.ListFunctionsCommand({
14
+ Marker: input.marker,
15
+ MaxItems: 50,
16
+ }));
17
+ const slugs = (result.Functions ?? [])
18
+ .map((fn) => fn.FunctionName)
19
+ .filter((name) => name !== undefined);
20
+ return {
21
+ slugs,
22
+ nextMarker: result.NextMarker,
23
+ };
24
+ };
25
+ exports.sdkLambdaGetAllFunctions = sdkLambdaGetAllFunctions;
26
+ //# sourceMappingURL=sdkLambdaGetAllFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdkLambdaGetAllFunctions.js","sourceRoot":"","sources":["../../../../src/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.ts"],"names":[],"mappings":";;;AAAA,0DAGgC;AAEhC;;;;;;GAMG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAC3C,KAEC,EACD,OAEC,EAIA,EAAE;IACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CACzC,IAAI,oCAAoB,CAAC;QACvB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,EAAE;KACb,CAAC,CACH,CAAC;IAEF,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;SACnC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC;SAC5B,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAExD,OAAO;QACL,KAAK;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,wBAAwB,4BA0BnC"}
@@ -0,0 +1,16 @@
1
+ import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
2
+ import type { LambdaEndpointSchema } from '../../domain.objects/LambdaEndpointSchema';
3
+ /**
4
+ * .what = cast a lambda response payload into a LambdaEndpointSchema
5
+ * .why = a payload either is a contract or the lambda does not support
6
+ * introspection; there is no partial state, so this cast throws rather
7
+ * than yield null
8
+ *
9
+ * .throws LambdaIntrospectionNotSupportedError (reason: non-schema-payload)
10
+ * - payload is malformed json
11
+ * - payload is not a json-schema envelope (lacks input/output schema shape)
12
+ */
13
+ export declare const asLambdaEndpointSchema: (input: {
14
+ payload: Uint8Array;
15
+ endpoint: LambdaEndpoint;
16
+ }) => LambdaEndpointSchema;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asLambdaEndpointSchema = void 0;
4
+ const LambdaIntrospectionNotSupportedError_1 = require("../../domain.objects/LambdaIntrospectionNotSupportedError");
5
+ /**
6
+ * .what = cast a lambda response payload into a LambdaEndpointSchema
7
+ * .why = a payload either is a contract or the lambda does not support
8
+ * introspection; there is no partial state, so this cast throws rather
9
+ * than yield null
10
+ *
11
+ * .throws LambdaIntrospectionNotSupportedError (reason: non-schema-payload)
12
+ * - payload is malformed json
13
+ * - payload is not a json-schema envelope (lacks input/output schema shape)
14
+ */
15
+ const asLambdaEndpointSchema = (input) => {
16
+ // decode payload bytes to string
17
+ const payloadStr = Buffer.from(input.payload).toString('utf-8');
18
+ // parse json; malformed json means the lambda is not introspectable
19
+ let parsed;
20
+ try {
21
+ parsed = JSON.parse(payloadStr);
22
+ }
23
+ catch (error) {
24
+ // allowlist: only SyntaxError (malformed json) maps to not-supported
25
+ if (!(error instanceof SyntaxError))
26
+ throw error;
27
+ throw new LambdaIntrospectionNotSupportedError_1.LambdaIntrospectionNotSupportedError(`lambda does not support introspection (non-schema-payload): ${input.endpoint.slug}`, {
28
+ endpoint: input.endpoint,
29
+ reason: 'non-schema-payload',
30
+ cause: error,
31
+ hint: 'ensure handler uses genLambdaEndpoint with zod schemas and env config',
32
+ });
33
+ }
34
+ // require a schema envelope: an object that carries input AND output schemas
35
+ const envelope = parsed;
36
+ const isSchemaEnvelope = typeof parsed === 'object' &&
37
+ parsed !== null &&
38
+ getIsJsonSchemaShape(envelope?.input) &&
39
+ getIsJsonSchemaShape(envelope?.output);
40
+ if (!isSchemaEnvelope) {
41
+ throw new LambdaIntrospectionNotSupportedError_1.LambdaIntrospectionNotSupportedError(`lambda does not support introspection (non-schema-payload): ${input.endpoint.slug}`, {
42
+ endpoint: input.endpoint,
43
+ reason: 'non-schema-payload',
44
+ hint: 'ensure handler uses genLambdaEndpoint with zod schemas and env config',
45
+ });
46
+ }
47
+ return parsed;
48
+ };
49
+ exports.asLambdaEndpointSchema = asLambdaEndpointSchema;
50
+ /**
51
+ * .what = checks if a value looks like a json-schema object
52
+ * .why = distinguishes a real introspection schema from a business output that
53
+ * coincidentally has input/output keys
54
+ *
55
+ * note: json schemas are objects that carry at least one structural marker
56
+ * (type, properties, $ref, enum, anyOf/oneOf/allOf, items, const, $schema)
57
+ */
58
+ const getIsJsonSchemaShape = (value) => {
59
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
60
+ return false;
61
+ }
62
+ const markers = [
63
+ 'type',
64
+ 'properties',
65
+ '$ref',
66
+ '$schema',
67
+ 'enum',
68
+ 'const',
69
+ 'anyOf',
70
+ 'oneOf',
71
+ 'allOf',
72
+ 'items',
73
+ ];
74
+ return markers.some((marker) => marker in value);
75
+ };
76
+ //# sourceMappingURL=asLambdaEndpointSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asLambdaEndpointSchema.js","sourceRoot":"","sources":["../../../src/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.ts"],"names":[],"mappings":";;;AAEA,oHAAiH;AAEjH;;;;;;;;;GASG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAGtC,EAAwB,EAAE;IACzB,iCAAiC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEhE,oEAAoE;IACpE,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qEAAqE;QACrE,IAAI,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC;YAAE,MAAM,KAAK,CAAC;QACjD,MAAM,IAAI,2EAAoC,CAC5C,+DAA+D,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EACpF;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,oBAAoB;YAC5B,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,uEAAuE;SAC9E,CACF,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,MAAsD,CAAC;IACxE,MAAM,gBAAgB,GACpB,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACrC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,2EAAoC,CAC5C,+DAA+D,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EACpF;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,oBAAoB;YAC5B,IAAI,EAAE,uEAAuE;SAC9E,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAA8B,CAAC;AACxC,CAAC,CAAC;AA5CW,QAAA,sBAAsB,0BA4CjC;AAEF;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAW,EAAE;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG;QACd,MAAM;QACN,YAAY;QACZ,MAAM;QACN,SAAS;QACT,MAAM;QACN,OAAO;QACP,OAAO;QACP,OAAO;QACP,OAAO;QACP,OAAO;KACR,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
2
+ import type { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
3
+ import type { LambdaEndpointSchema } from '../../domain.objects/LambdaEndpointSchema';
4
+ /**
5
+ * .what = get the contract schema from a lambda endpoint
6
+ * .why = enables runtime schema discovery for sdk generation
7
+ *
8
+ * .throws LambdaFunctionNotFoundError — endpoint does not exist
9
+ * .throws LambdaIntrospectionBlockedError — introspection blocked in prod/test
10
+ * .throws LambdaIntrospectionNotSupportedError — endpoint does not support introspection
11
+ */
12
+ export declare const getOneLambdaContract: (input: {
13
+ which: {
14
+ service: string;
15
+ function: string;
16
+ };
17
+ }, context: ContextAwsLambdaCaller) => Promise<LambdaEndpointSchema>;
18
+ /**
19
+ * .what = input type for getOneLambdaContract
20
+ * .why = exported for sdk consumers
21
+ */
22
+ export type GetOneLambdaContractInput = Parameters<typeof getOneLambdaContract>[0];
23
+ /**
24
+ * .what = context type for getOneLambdaContract
25
+ * .why = exported for sdk consumers
26
+ */
27
+ export type GetOneLambdaContractContext = Parameters<typeof getOneLambdaContract>[1];
28
+ /**
29
+ * .what = re-export LambdaEndpoint type for convenience
30
+ * .why = callers of getOneLambdaContract operate on endpoints
31
+ */
32
+ export type { LambdaEndpoint };
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getOneLambdaContract = void 0;
27
+ const helpful_errors_1 = require("helpful-errors");
28
+ const sdkLambdaInvoke_1 = require("../../access/sdks/lambda/sdkLambdaInvoke");
29
+ const LambdaFunctionNotFoundError_1 = require("../../domain.objects/LambdaFunctionNotFoundError");
30
+ const LambdaIntrospectionBlockedError_1 = require("../../domain.objects/LambdaIntrospectionBlockedError");
31
+ const LambdaIntrospectionNotSupportedError_1 = require("../../domain.objects/LambdaIntrospectionNotSupportedError");
32
+ const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
33
+ const asLambdaEndpointSchema_1 = require("./asLambdaEndpointSchema");
34
+ /**
35
+ * .what = determines if error indicates lambda not found
36
+ * .why = extract allowlist logic from orchestrator for readability
37
+ */
38
+ const getIsLambdaFunctionNotFoundError = (input) => {
39
+ return (input.error.name === 'ResourceNotFoundException' ||
40
+ input.error.message.includes('Function not found'));
41
+ };
42
+ /**
43
+ * .what = determines if error indicates access denied
44
+ * .why = extract allowlist logic from orchestrator for readability
45
+ */
46
+ const getIsAccessDeniedError = (input) => {
47
+ return (input.error.name === 'AccessDeniedException' ||
48
+ input.error.message.includes('Access Denied'));
49
+ };
50
+ /**
51
+ * .what = get the contract schema from a lambda endpoint
52
+ * .why = enables runtime schema discovery for sdk generation
53
+ *
54
+ * .throws LambdaFunctionNotFoundError — endpoint does not exist
55
+ * .throws LambdaIntrospectionBlockedError — introspection blocked in prod/test
56
+ * .throws LambdaIntrospectionNotSupportedError — endpoint does not support introspection
57
+ */
58
+ const getOneLambdaContract = async (input, context) => {
59
+ // build the endpoint from the selector + ambient access (computes slug)
60
+ const endpoint = (0, asLambdaEndpoint_1.asLambdaEndpoint)({
61
+ service: input.which.service,
62
+ access: context.env.access,
63
+ function: input.which.function,
64
+ });
65
+ // log the introspection attempt for observability
66
+ context.log.debug('getOneLambdaContract.invoke', { slug: endpoint.slug });
67
+ // fail fast if introspection is blocked: only prep exposes schemas
68
+ // (gate up front so no request is made and no schema can leak)
69
+ if (endpoint.access !== 'prep') {
70
+ throw new LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError(`introspection is only available in prep environment, got: ${endpoint.access}`, { endpoint });
71
+ }
72
+ // get or create LambdaClient (genLambdaSdk always returns valid client)
73
+ const sdkLambda = context.aws?.lambda?.sdk ??
74
+ (await Promise.resolve().then(() => __importStar(require('../../access/sdks/lambda/genLambdaSdk'))).then((m) => m.genLambdaSdk({ env: { region: context.env.region } })));
75
+ // invoke endpoint with introspect payload
76
+ let response;
77
+ try {
78
+ response = await (0, sdkLambdaInvoke_1.sdkLambdaInvoke)({ slug: endpoint.slug, payload: { introspect: 'schema' } }, { sdkLambda });
79
+ }
80
+ catch (error) {
81
+ // endpoint not found (or access denied → same caller experience) → clear error
82
+ const isNotFound = error instanceof Error &&
83
+ (getIsLambdaFunctionNotFoundError({ error }) ||
84
+ getIsAccessDeniedError({ error }));
85
+ if (isNotFound) {
86
+ throw new LambdaFunctionNotFoundError_1.LambdaFunctionNotFoundError(`lambda function not found: ${endpoint.slug}`, { endpoint });
87
+ }
88
+ // wrap unexpected errors with context for diagnosis
89
+ throw new helpful_errors_1.UnexpectedCodePathError(`lambda introspection failed: ${error instanceof Error ? error.message : String(error)}`, { endpoint, cause: error instanceof Error ? error : undefined });
90
+ }
91
+ // function error → handler threw on the introspect payload (access is prep here)
92
+ if (response.functionError) {
93
+ throw new LambdaIntrospectionNotSupportedError_1.LambdaIntrospectionNotSupportedError(`lambda does not support introspection (handler-error): ${endpoint.slug}`, {
94
+ endpoint,
95
+ reason: 'handler-error',
96
+ functionError: response.functionError,
97
+ hint: 'ensure handler uses genLambdaEndpoint with zod schemas and env config',
98
+ });
99
+ }
100
+ // absent payload → invoke returned no body to parse
101
+ if (!response.payload) {
102
+ throw new LambdaIntrospectionNotSupportedError_1.LambdaIntrospectionNotSupportedError(`lambda does not support introspection (empty-payload): ${endpoint.slug}`, {
103
+ endpoint,
104
+ reason: 'empty-payload',
105
+ hint: 'ensure handler uses genLambdaEndpoint with zod schemas and env config',
106
+ });
107
+ }
108
+ // cast payload into schema; throws not-supported (non-schema-payload) if invalid
109
+ return (0, asLambdaEndpointSchema_1.asLambdaEndpointSchema)({ payload: response.payload, endpoint });
110
+ };
111
+ exports.getOneLambdaContract = getOneLambdaContract;
112
+ //# sourceMappingURL=getOneLambdaContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneLambdaContract.js","sourceRoot":"","sources":["../../../src/domain.operations/getOneLambdaContract/getOneLambdaContract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAyD;AAEzD,8EAGkD;AAIlD,kGAA+F;AAC/F,0GAAuG;AACvG,oHAAiH;AACjH,2EAAwE;AACxE,qEAAkE;AAElE;;;GAGG;AACH,MAAM,gCAAgC,GAAG,CAAC,KAAuB,EAAW,EAAE;IAC5E,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,2BAA2B;QAChD,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CACnD,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAC,KAAuB,EAAW,EAAE;IAClE,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,uBAAuB;QAC5C,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAC9C,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,KAKC,EACD,OAA+B,EACA,EAAE;IACjC,wEAAwE;IACxE,MAAM,QAAQ,GAAG,IAAA,mCAAgB,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vC,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,IAAI,yDAA2B,CACnC,8BAA8B,QAAQ,CAAC,IAAI,EAAE,EAC7C,EAAE,QAAQ,EAAE,CACb,CAAC;QACJ,CAAC;QAED,oDAAoD;QACpD,MAAM,IAAI,wCAAuB,CAC/B,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACxF,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,CAChE,CAAC;IACJ,CAAC;IAED,iFAAiF;IACjF,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,2EAAoC,CAC5C,0DAA0D,QAAQ,CAAC,IAAI,EAAE,EACzE;YACE,QAAQ;YACR,MAAM,EAAE,eAAe;YACvB,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,IAAI,EAAE,uEAAuE;SAC9E,CACF,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,2EAAoC,CAC5C,0DAA0D,QAAQ,CAAC,IAAI,EAAE,EACzE;YACE,QAAQ;YACR,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,uEAAuE;SAC9E,CACF,CAAC;IACJ,CAAC;IAED,iFAAiF;IACjF,OAAO,IAAA,+CAAsB,EAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAzFW,QAAA,oBAAoB,wBAyF/B"}
package/dist/index.d.ts CHANGED
@@ -4,13 +4,22 @@
4
4
  * define endpoints, ask endpoints, auto-propagate trace-ids.
5
5
  */
6
6
  export { BadRequestError } from 'helpful-errors';
7
+ export type { ContextAwsLambdaCaller } from './domain.objects/ContextAwsLambdaCaller';
8
+ export type { ContextAwsLambdaServer, EnvAccess, EnvConfig, } from './domain.objects/ContextAwsLambdaServer';
7
9
  export { HttpStatusCode } from './domain.objects/HttpStatusCode';
10
+ export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
8
11
  export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
12
+ export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
13
+ export { LambdaFunctionNotFoundError } from './domain.objects/LambdaFunctionNotFoundError';
14
+ export { LambdaIntrospectionBlockedError } from './domain.objects/LambdaIntrospectionBlockedError';
15
+ export { LambdaIntrospectionNotSupportedError } from './domain.objects/LambdaIntrospectionNotSupportedError';
16
+ export { LambdaServiceNotFoundError } from './domain.objects/LambdaServiceNotFoundError';
9
17
  export type { AskLambdaEndpointContext, AskLambdaEndpointInput, } from './domain.operations/askLambdaEndpoint/askLambdaEndpoint';
10
18
  export { askLambdaEndpoint } from './domain.operations/askLambdaEndpoint/askLambdaEndpoint';
11
19
  export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet';
12
20
  export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
13
- export type { CorsConfig, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
21
+ export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
22
+ export type { CorsConfig, ForApiGatewayContext, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
14
23
  export { forApiGateway } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
15
24
  export type { UnifiedApiGatewayEvent } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
16
25
  export { genApiGatewayEventNormalizationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
@@ -18,7 +27,11 @@ export type { EndpointOperation, FlatPayload, GenLambdaEndpointContext, GenLambd
18
27
  export { genLambdaEndpoint } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
19
28
  export { genZodEventValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware';
20
29
  export { genConstraintErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware';
30
+ export { genIntrospectionMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware';
21
31
  export type { IoLogTranslate } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
22
32
  export { genIoLoggerMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
23
33
  export { genTrailMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware';
24
34
  export { genZodOutputValidationMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware';
35
+ export { type GetAllLambdaContractsContext, type GetAllLambdaContractsInput, getAllLambdaContracts, } from './domain.operations/getAllLambdaContracts/getAllLambdaContracts';
36
+ export { getAllLambdaFunctionsByPrefix } from './domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix';
37
+ export { type GetOneLambdaContractContext, type GetOneLambdaContractInput, getOneLambdaContract, } from './domain.operations/getOneLambdaContract/getOneLambdaContract';
package/dist/index.js CHANGED
@@ -5,15 +5,25 @@
5
5
  * define endpoints, ask endpoints, auto-propagate trace-ids.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genConstraintErrorMiddleware = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genApiGatewayEventNormalizationMiddleware = exports.forApiGateway = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaEndpointError = exports.HttpStatusCode = exports.BadRequestError = void 0;
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;
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
- // domain objects
13
12
  var HttpStatusCode_1 = require("./domain.objects/HttpStatusCode");
14
13
  Object.defineProperty(exports, "HttpStatusCode", { enumerable: true, get: function () { return HttpStatusCode_1.HttpStatusCode; } });
14
+ var LambdaEndpoint_1 = require("./domain.objects/LambdaEndpoint");
15
+ Object.defineProperty(exports, "LambdaEndpoint", { enumerable: true, get: function () { return LambdaEndpoint_1.LambdaEndpoint; } });
15
16
  var LambdaEndpointError_1 = require("./domain.objects/LambdaEndpointError");
16
17
  Object.defineProperty(exports, "LambdaEndpointError", { enumerable: true, get: function () { return LambdaEndpointError_1.LambdaEndpointError; } });
18
+ // contract discovery errors
19
+ var LambdaFunctionNotFoundError_1 = require("./domain.objects/LambdaFunctionNotFoundError");
20
+ Object.defineProperty(exports, "LambdaFunctionNotFoundError", { enumerable: true, get: function () { return LambdaFunctionNotFoundError_1.LambdaFunctionNotFoundError; } });
21
+ var LambdaIntrospectionBlockedError_1 = require("./domain.objects/LambdaIntrospectionBlockedError");
22
+ Object.defineProperty(exports, "LambdaIntrospectionBlockedError", { enumerable: true, get: function () { return LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError; } });
23
+ var LambdaIntrospectionNotSupportedError_1 = require("./domain.objects/LambdaIntrospectionNotSupportedError");
24
+ Object.defineProperty(exports, "LambdaIntrospectionNotSupportedError", { enumerable: true, get: function () { return LambdaIntrospectionNotSupportedError_1.LambdaIntrospectionNotSupportedError; } });
25
+ var LambdaServiceNotFoundError_1 = require("./domain.objects/LambdaServiceNotFoundError");
26
+ Object.defineProperty(exports, "LambdaServiceNotFoundError", { enumerable: true, get: function () { return LambdaServiceNotFoundError_1.LambdaServiceNotFoundError; } });
17
27
  // domain operations
18
28
  var askLambdaEndpoint_1 = require("./domain.operations/askLambdaEndpoint/askLambdaEndpoint");
19
29
  Object.defineProperty(exports, "askLambdaEndpoint", { enumerable: true, get: function () { return askLambdaEndpoint_1.askLambdaEndpoint; } });
@@ -21,6 +31,9 @@ var asCacheWithoutSet_1 = require("./domain.operations/askLambdaEndpoint/cache/a
21
31
  Object.defineProperty(exports, "asCacheWithoutSet", { enumerable: true, get: function () { return asCacheWithoutSet_1.asCacheWithoutSet; } });
22
32
  var getAskLambdaCacheKey_1 = require("./domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey");
23
33
  Object.defineProperty(exports, "getAskLambdaCacheKey", { enumerable: true, get: function () { return getAskLambdaCacheKey_1.getAskLambdaCacheKey; } });
34
+ // transformers
35
+ var asLambdaEndpoint_1 = require("./domain.operations/asLambdaEndpoint/asLambdaEndpoint");
36
+ Object.defineProperty(exports, "asLambdaEndpoint", { enumerable: true, get: function () { return asLambdaEndpoint_1.asLambdaEndpoint; } });
24
37
  var genLambdaEndpoint_forApiGateway_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway");
25
38
  Object.defineProperty(exports, "forApiGateway", { enumerable: true, get: function () { return genLambdaEndpoint_forApiGateway_1.forApiGateway; } });
26
39
  var genApiGatewayEventNormalizationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware");
@@ -31,6 +44,8 @@ var genZodEventValidationMiddleware_1 = require("./domain.operations/genLambdaEn
31
44
  Object.defineProperty(exports, "genZodEventValidationMiddleware", { enumerable: true, get: function () { return genZodEventValidationMiddleware_1.genZodEventValidationMiddleware; } });
32
45
  var genConstraintErrorMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware");
33
46
  Object.defineProperty(exports, "genConstraintErrorMiddleware", { enumerable: true, get: function () { return genConstraintErrorMiddleware_1.genConstraintErrorMiddleware; } });
47
+ var genIntrospectionMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware");
48
+ Object.defineProperty(exports, "genIntrospectionMiddleware", { enumerable: true, get: function () { return genIntrospectionMiddleware_1.genIntrospectionMiddleware; } });
34
49
  var genIoLoggerMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware");
35
50
  Object.defineProperty(exports, "genIoLoggerMiddleware", { enumerable: true, get: function () { return genIoLoggerMiddleware_1.genIoLoggerMiddleware; } });
36
51
  // middleware (for advanced use)
@@ -38,4 +53,11 @@ var genTrailMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middle
38
53
  Object.defineProperty(exports, "genTrailMiddleware", { enumerable: true, get: function () { return genTrailMiddleware_1.genTrailMiddleware; } });
39
54
  var genZodOutputValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware");
40
55
  Object.defineProperty(exports, "genZodOutputValidationMiddleware", { enumerable: true, get: function () { return genZodOutputValidationMiddleware_1.genZodOutputValidationMiddleware; } });
56
+ // contract discovery (for sdk generation)
57
+ var getAllLambdaContracts_1 = require("./domain.operations/getAllLambdaContracts/getAllLambdaContracts");
58
+ Object.defineProperty(exports, "getAllLambdaContracts", { enumerable: true, get: function () { return getAllLambdaContracts_1.getAllLambdaContracts; } });
59
+ var getAllLambdaFunctionsByPrefix_1 = require("./domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix");
60
+ Object.defineProperty(exports, "getAllLambdaFunctionsByPrefix", { enumerable: true, get: function () { return getAllLambdaFunctionsByPrefix_1.getAllLambdaFunctionsByPrefix; } });
61
+ var getOneLambdaContract_1 = require("./domain.operations/getOneLambdaContract/getOneLambdaContract");
62
+ Object.defineProperty(exports, "getOneLambdaContract", { enumerable: true, get: function () { return getOneLambdaContract_1.getOneLambdaContract; } });
41
63
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAExB,iBAAiB;AACjB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAK5B,oBAAoB;AACpB,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAC1B,mGAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,yGAAwG;AAA/F,4HAAA,oBAAoB,OAAA;AAK7B,yJAAsI;AAA7H,gIAAA,aAAa,OAAA;AAEtB,wLAAuL;AAA9K,sKAAA,yCAAyC,OAAA;AASlD,4JAA4I;AAAnI,qIAAA,iBAAiB,OAAA;AAC1B,qKAAoK;AAA3J,kJAAA,+BAA+B,OAAA;AACxC,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AAErC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAA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A6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sdk-aws-lambda",
3
3
  "author": "ehmpathy",
4
4
  "description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
5
- "version": "0.1.1",
5
+ "version": "0.2.0",
6
6
  "repository": "ehmpathy/sdk-aws-lambda",
7
7
  "homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
8
8
  "keywords": [
@@ -52,8 +52,9 @@
52
52
  "preversion": "npm run prepush",
53
53
  "postversion": "git push origin HEAD --tags --no-verify",
54
54
  "prepare:husky": "husky install && chmod ug+x .husky/*",
55
- "prepare:rhachet": "rhachet init --hooks --roles mechanic behaver driver architect ergonomist reviewer dreamer dispatcher",
56
- "prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi"
55
+ "prepare:rhachet": "rhachet init --keys --hooks --roles mechanic behaver driver reviewer librarian ergonomist architect dispatcher",
56
+ "prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
57
+ "upgrade:rhachet": "rhachet upgrade"
57
58
  },
58
59
  "dependencies": {
59
60
  "@aws-sdk/client-lambda": "3.1045.0",
@@ -65,6 +66,7 @@
65
66
  "@middy/http-security-headers": "4.7.0",
66
67
  "domain-objects": "0.31.10",
67
68
  "helpful-errors": "1.7.3",
69
+ "sdk-environment": "0.1.5",
68
70
  "sdk-logs": "0.9.0",
69
71
  "simple-in-memory-cache": "0.4.0",
70
72
  "with-simple-cache": "0.15.3",
@@ -85,7 +87,7 @@
85
87
  "archiver": "8.0.0",
86
88
  "cz-conventional-changelog": "3.3.0",
87
89
  "declapract": "^0.13.18",
88
- "declapract-typescript-ehmpathy": "^0.47.14",
90
+ "declapract-typescript-ehmpathy": "^0.49.4",
89
91
  "declastruct": "1.7.3",
90
92
  "declastruct-aws": "^1.5.2",
91
93
  "declastruct-github": "1.3.0",
@@ -94,14 +96,14 @@
94
96
  "esbuild-register": "3.6.0",
95
97
  "husky": "8.0.3",
96
98
  "jest": "30.2.0",
97
- "rhachet": "1.41.22",
98
- "rhachet-brains-anthropic": "^0.4.1",
99
- "rhachet-brains-fireworksai": "^0.1.2",
100
- "rhachet-brains-xai": "^0.3.3",
101
- "rhachet-roles-bhrain": "0.29.8",
102
- "rhachet-roles-bhuild": "0.21.17",
103
- "rhachet-roles-ehmpathy": "1.35.16",
104
- "rhachet-roles-rhachet": "^0.1.7",
99
+ "rhachet": "1.42.4",
100
+ "rhachet-brains-anthropic": "0.4.1",
101
+ "rhachet-brains-fireworksai": "0.1.3",
102
+ "rhachet-brains-xai": "0.3.3",
103
+ "rhachet-roles-bhrain": "0.29.12",
104
+ "rhachet-roles-bhuild": "0.21.18",
105
+ "rhachet-roles-ehmpathy": "1.37.1",
106
+ "rhachet-roles-rhachet": "0.1.7",
105
107
  "test-fns": "1.15.8",
106
108
  "tsc-alias": "1.8.10",
107
109
  "tsx": "4.20.6",