sdk-aws-lambda 0.1.1 → 0.3.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 (177) 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/contract/cli/asGenArgs.d.ts +21 -0
  8. package/dist/contract/cli/asGenArgs.js +69 -0
  9. package/dist/contract/cli/asGenArgs.js.map +1 -0
  10. package/dist/contract/cli/gen.d.ts +23 -0
  11. package/dist/contract/cli/gen.js +72 -0
  12. package/dist/contract/cli/gen.js.map +1 -0
  13. package/dist/domain.objects/ContextAwsLambdaCaller.d.ts +25 -0
  14. package/dist/domain.objects/ContextAwsLambdaCaller.js +3 -0
  15. package/dist/domain.objects/ContextAwsLambdaCaller.js.map +1 -0
  16. package/dist/domain.objects/ContextAwsLambdaServer.d.ts +30 -0
  17. package/dist/domain.objects/ContextAwsLambdaServer.js +3 -0
  18. package/dist/domain.objects/ContextAwsLambdaServer.js.map +1 -0
  19. package/dist/domain.objects/DomainObjectCaptured.d.ts +51 -0
  20. package/dist/domain.objects/DomainObjectCaptured.js +8 -0
  21. package/dist/domain.objects/DomainObjectCaptured.js.map +1 -0
  22. package/dist/domain.objects/GeneratedFile.d.ts +18 -0
  23. package/dist/domain.objects/GeneratedFile.js +8 -0
  24. package/dist/domain.objects/GeneratedFile.js.map +1 -0
  25. package/dist/domain.objects/HttpStatusCode.d.ts +2 -2
  26. package/dist/domain.objects/HttpStatusCode.js +3 -3
  27. package/dist/domain.objects/LambdaCredentialsAbsentError.d.ts +11 -0
  28. package/dist/domain.objects/LambdaCredentialsAbsentError.js +16 -0
  29. package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -0
  30. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.d.ts +12 -0
  31. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js +17 -0
  32. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -0
  33. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.d.ts +14 -0
  34. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js +19 -0
  35. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -0
  36. package/dist/domain.objects/LambdaEndpoint.d.ts +35 -0
  37. package/dist/domain.objects/LambdaEndpoint.js +10 -0
  38. package/dist/domain.objects/LambdaEndpoint.js.map +1 -0
  39. package/dist/domain.objects/LambdaEndpointError.d.ts +5 -8
  40. package/dist/domain.objects/LambdaEndpointError.js.map +1 -1
  41. package/dist/domain.objects/LambdaEndpointSchema.d.ts +9 -0
  42. package/dist/domain.objects/LambdaEndpointSchema.js +3 -0
  43. package/dist/domain.objects/LambdaEndpointSchema.js.map +1 -0
  44. package/dist/domain.objects/LambdaFunctionNotFoundError.d.ts +10 -0
  45. package/dist/domain.objects/LambdaFunctionNotFoundError.js +15 -0
  46. package/dist/domain.objects/LambdaFunctionNotFoundError.js.map +1 -0
  47. package/dist/domain.objects/LambdaIntrospectionBlockedError.d.ts +10 -0
  48. package/dist/domain.objects/LambdaIntrospectionBlockedError.js +15 -0
  49. package/dist/domain.objects/LambdaIntrospectionBlockedError.js.map +1 -0
  50. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.d.ts +18 -0
  51. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js +15 -0
  52. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js.map +1 -0
  53. package/dist/domain.objects/LambdaServiceNotFoundError.d.ts +10 -0
  54. package/dist/domain.objects/LambdaServiceNotFoundError.js +15 -0
  55. package/dist/domain.objects/LambdaServiceNotFoundError.js.map +1 -0
  56. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.d.ts +20 -0
  57. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js +47 -0
  58. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js.map +1 -0
  59. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +2 -12
  60. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +13 -22
  61. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
  62. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.d.ts +2 -2
  63. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js.map +1 -1
  64. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.d.ts +3 -4
  65. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js +17 -5
  66. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js.map +1 -1
  67. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.d.ts +1 -1
  68. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js +3 -3
  69. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +13 -8
  70. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +20 -19
  71. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
  72. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.d.ts +13 -0
  73. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js +26 -0
  74. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js.map +1 -0
  75. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +2 -2
  76. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +15 -14
  77. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +1 -1
  78. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +15 -8
  79. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +16 -9
  80. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  81. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.d.ts +3 -3
  82. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js +5 -5
  83. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.d.ts +1 -1
  84. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js +1 -1
  85. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +88 -63
  86. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
  87. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +7 -9
  88. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +14 -11
  89. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  90. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +1 -1
  91. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +22 -0
  92. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +7 -0
  93. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +13 -0
  94. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -0
  95. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.d.ts +5 -0
  96. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js +16 -0
  97. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js.map +1 -0
  98. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +53 -0
  99. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -0
  100. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +1 -1
  101. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +1 -1
  102. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +1 -1
  103. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +12 -4
  104. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  105. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.d.ts +16 -0
  106. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js +36 -0
  107. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -0
  108. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.d.ts +10 -0
  109. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js +18 -0
  110. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -0
  111. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.d.ts +14 -0
  112. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +44 -0
  113. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -0
  114. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.d.ts +11 -0
  115. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +42 -0
  116. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -0
  117. package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +9 -0
  118. package/dist/domain.operations/genServiceSdk/gen.file/banner.js +16 -0
  119. package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -0
  120. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.d.ts +20 -0
  121. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js +44 -0
  122. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -0
  123. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.d.ts +13 -0
  124. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js +49 -0
  125. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -0
  126. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +16 -0
  127. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +39 -0
  128. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -0
  129. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +35 -0
  130. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +189 -0
  131. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -0
  132. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +15 -0
  133. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +37 -0
  134. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -0
  135. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.d.ts +26 -0
  136. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +106 -0
  137. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -0
  138. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.d.ts +15 -0
  139. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +51 -0
  140. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -0
  141. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts +14 -0
  142. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +68 -0
  143. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -0
  144. package/dist/domain.operations/genServiceSdk/genServiceSdk.d.ts +20 -0
  145. package/dist/domain.operations/genServiceSdk/genServiceSdk.js +88 -0
  146. package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -0
  147. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.d.ts +33 -0
  148. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +134 -0
  149. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -0
  150. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.d.ts +6 -0
  151. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js +12 -0
  152. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js.map +1 -0
  153. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.d.ts +15 -0
  154. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js +44 -0
  155. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js.map +1 -0
  156. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.d.ts +16 -0
  157. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js +26 -0
  158. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js.map +1 -0
  159. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.d.ts +16 -0
  160. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js +76 -0
  161. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js.map +1 -0
  162. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.d.ts +32 -0
  163. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js +112 -0
  164. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js.map +1 -0
  165. package/dist/index.d.ts +19 -1
  166. package/dist/index.js +35 -2
  167. package/dist/index.js.map +1 -1
  168. package/package.json +19 -14
  169. package/readme.md +64 -4
  170. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.d.ts +0 -11
  171. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js +0 -21
  172. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js.map +0 -1
  173. package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js.map +0 -1
  174. package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.js.map +0 -1
  175. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.d.ts +0 -9
  176. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js +0 -12
  177. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaEndpoint = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class LambdaEndpoint extends domain_objects_1.DomainEntity {
6
+ }
7
+ exports.LambdaEndpoint = LambdaEndpoint;
8
+ LambdaEndpoint.primary = ['slug'];
9
+ LambdaEndpoint.unique = ['service', 'access', 'function'];
10
+ //# sourceMappingURL=LambdaEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpoint.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpoint.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAoC9C,MAAa,cACX,SAAQ,6BAA4B;;AADtC,wCAMC;AAFe,sBAAO,GAAG,CAAC,MAAM,CAAU,CAAC;AAC5B,qBAAM,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC"}
@@ -1,17 +1,14 @@
1
1
  import { HelpfulError } from 'helpful-errors';
2
+ import type { LambdaEndpoint } from './LambdaEndpoint';
2
3
  /**
3
4
  * .what = error for failed lambda invocations via askLambdaEndpoint
4
- * .why = provides rich context for debug: service, function, exid, cause
5
+ * .why = provides rich context for debug: endpoint, exid, cause
5
6
  */
6
7
  export interface LambdaEndpointErrorMetadata {
7
8
  /**
8
- * the service that owns the lambda function
9
+ * the endpoint that was invoked (service, access, function, slug)
9
10
  */
10
- service: string;
11
- /**
12
- * the lambda function name that was invoked
13
- */
14
- function: string;
11
+ endpoint: LambdaEndpoint;
15
12
  /**
16
13
  * the exid (execution id) for trail correlation
17
14
  */
@@ -21,7 +18,7 @@ export interface LambdaEndpointErrorMetadata {
21
18
  */
22
19
  errorType?: string;
23
20
  /**
24
- * the HTTP status code from the Lambda invocation
21
+ * the http status code from the lambda invocation
25
22
  * non-200 indicates invocation itself failed (throttle, permission, not found)
26
23
  */
27
24
  statusCode?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"LambdaEndpointError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointError.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAsD9C,MAAa,mBAAoB,SAAQ,6BAAyC;IAGhF,YAAY,OAAe,EAAE,QAAqC;QAChE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;;AANH,kDAOC;AANe,wBAAI,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,uBAAuB,EAAW,CAAC"}
1
+ {"version":3,"file":"LambdaEndpointError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointError.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAmD9C,MAAa,mBAAoB,SAAQ,6BAAyC;IAGhF,YAAY,OAAe,EAAE,QAAqC;QAChE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;;AANH,kDAOC;AANe,wBAAI,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,uBAAuB,EAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { JSONSchema } from 'zod/v4/core/json-schema';
2
+ /**
3
+ * .what = the schema of a lambda endpoint's input and output
4
+ * .why = enables runtime introspection of endpoint contracts for sdk generation
5
+ */
6
+ export interface LambdaEndpointSchema {
7
+ input: JSONSchema;
8
+ output: JSONSchema;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=LambdaEndpointSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpointSchema.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointSchema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { ConstraintError } from 'helpful-errors';
2
+ /**
3
+ * .what = error when a lambda function does not exist
4
+ * .why = clear error that names the absent function per criteria
5
+ *
6
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
7
+ * at the throw site via `new LambdaFunctionNotFoundError(message, { ... })`
8
+ */
9
+ export declare class LambdaFunctionNotFoundError extends ConstraintError {
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaFunctionNotFoundError = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = error when a lambda function does not exist
7
+ * .why = clear error that names the absent function per criteria
8
+ *
9
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
10
+ * at the throw site via `new LambdaFunctionNotFoundError(message, { ... })`
11
+ */
12
+ class LambdaFunctionNotFoundError extends helpful_errors_1.ConstraintError {
13
+ }
14
+ exports.LambdaFunctionNotFoundError = LambdaFunctionNotFoundError;
15
+ //# sourceMappingURL=LambdaFunctionNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaFunctionNotFoundError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaFunctionNotFoundError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;GAMG;AACH,MAAa,2BAA4B,SAAQ,gCAAe;CAAG;AAAnE,kEAAmE"}
@@ -0,0 +1,10 @@
1
+ import { ConstraintError } from 'helpful-errors';
2
+ /**
3
+ * .what = error when introspection is blocked (non-prep environment)
4
+ * .why = clear error when introspection attempted outside prep
5
+ *
6
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
7
+ * at the throw site via `new LambdaIntrospectionBlockedError(message, { ... })`
8
+ */
9
+ export declare class LambdaIntrospectionBlockedError extends ConstraintError {
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaIntrospectionBlockedError = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = error when introspection is blocked (non-prep environment)
7
+ * .why = clear error when introspection attempted outside prep
8
+ *
9
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
10
+ * at the throw site via `new LambdaIntrospectionBlockedError(message, { ... })`
11
+ */
12
+ class LambdaIntrospectionBlockedError extends helpful_errors_1.ConstraintError {
13
+ }
14
+ exports.LambdaIntrospectionBlockedError = LambdaIntrospectionBlockedError;
15
+ //# sourceMappingURL=LambdaIntrospectionBlockedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaIntrospectionBlockedError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaIntrospectionBlockedError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;GAMG;AACH,MAAa,+BAAgC,SAAQ,gCAAe;CAAG;AAAvE,0EAAuE"}
@@ -0,0 +1,18 @@
1
+ import { ConstraintError } from 'helpful-errors';
2
+ /**
3
+ * .what = the distinct reasons a lambda does not support introspection
4
+ * .why = lets the error state WHY introspection failed, not just that it did
5
+ * - handler-error = the handler threw on the introspect payload
6
+ * - empty-payload = the invoke returned no payload
7
+ * - non-schema-payload = the payload was not a json-schema envelope
8
+ */
9
+ export type LambdaIntrospectionNotSupportedReason = 'handler-error' | 'empty-payload' | 'non-schema-payload';
10
+ /**
11
+ * .what = error when a lambda does not support introspection
12
+ * .why = clear error to separate "no support" from "not found"
13
+ *
14
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
15
+ * (incl. the `reason`) at the throw site
16
+ */
17
+ export declare class LambdaIntrospectionNotSupportedError extends ConstraintError {
18
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaIntrospectionNotSupportedError = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = error when a lambda does not support introspection
7
+ * .why = clear error to separate "no support" from "not found"
8
+ *
9
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
10
+ * (incl. the `reason`) at the throw site
11
+ */
12
+ class LambdaIntrospectionNotSupportedError extends helpful_errors_1.ConstraintError {
13
+ }
14
+ exports.LambdaIntrospectionNotSupportedError = LambdaIntrospectionNotSupportedError;
15
+ //# sourceMappingURL=LambdaIntrospectionNotSupportedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaIntrospectionNotSupportedError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaIntrospectionNotSupportedError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAcjD;;;;;;GAMG;AACH,MAAa,oCAAqC,SAAQ,gCAAe;CAAG;AAA5E,oFAA4E"}
@@ -0,0 +1,10 @@
1
+ import { ConstraintError } from 'helpful-errors';
2
+ /**
3
+ * .what = error when a service has no lambda functions
4
+ * .why = clear error that names the absent service per criteria
5
+ *
6
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
7
+ * at the throw site via `new LambdaServiceNotFoundError(message, { ... })`
8
+ */
9
+ export declare class LambdaServiceNotFoundError extends ConstraintError {
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaServiceNotFoundError = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = error when a service has no lambda functions
7
+ * .why = clear error that names the absent service per criteria
8
+ *
9
+ * .note = bare subclass per helpful-errors convention; pass message + metadata
10
+ * at the throw site via `new LambdaServiceNotFoundError(message, { ... })`
11
+ */
12
+ class LambdaServiceNotFoundError extends helpful_errors_1.ConstraintError {
13
+ }
14
+ exports.LambdaServiceNotFoundError = LambdaServiceNotFoundError;
15
+ //# sourceMappingURL=LambdaServiceNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaServiceNotFoundError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaServiceNotFoundError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,gCAAe;CAAG;AAAlE,gEAAkE"}
@@ -0,0 +1,20 @@
1
+ import { LambdaEndpoint } from '../../domain.objects/LambdaEndpoint';
2
+ /**
3
+ * .what = builds a LambdaEndpoint from either its natural-key parts or its slug
4
+ * .why = one boundary transformer for the endpoint concept; parse the slug string
5
+ * exactly once here, pass the structured entity everywhere else
6
+ *
7
+ * .forms
8
+ * - asLambdaEndpoint({ service, access, function }) → computes slug
9
+ * - asLambdaEndpoint({ slug }) → strict-parses slug into parts
10
+ *
11
+ * .throws UnexpectedCodePathError — slug does not match '{service}-{access}-{function}'
12
+ * (exact 3-part shape; no partial match)
13
+ */
14
+ export declare const asLambdaEndpoint: (input: {
15
+ service: string;
16
+ access: string;
17
+ function: string;
18
+ } | {
19
+ slug: string;
20
+ }) => LambdaEndpoint;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asLambdaEndpoint = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const LambdaEndpoint_1 = require("../../domain.objects/LambdaEndpoint");
6
+ /**
7
+ * .what = builds a LambdaEndpoint from either its natural-key parts or its slug
8
+ * .why = one boundary transformer for the endpoint concept; parse the slug string
9
+ * exactly once here, pass the structured entity everywhere else
10
+ *
11
+ * .forms
12
+ * - asLambdaEndpoint({ service, access, function }) → computes slug
13
+ * - asLambdaEndpoint({ slug }) → strict-parses slug into parts
14
+ *
15
+ * .throws UnexpectedCodePathError — slug does not match '{service}-{access}-{function}'
16
+ * (exact 3-part shape; no partial match)
17
+ */
18
+ const asLambdaEndpoint = (input) => {
19
+ // form 1: parts → entity (compute slug)
20
+ if ('service' in input) {
21
+ return new LambdaEndpoint_1.LambdaEndpoint({
22
+ service: input.service,
23
+ access: input.access,
24
+ function: input.function,
25
+ slug: `${input.service}-${input.access}-${input.function}`,
26
+ });
27
+ }
28
+ // form 2: slug → entity (strict parse)
29
+ // slug shape: 'svc-{noun}-{access}-{function}' where service is 'svc-{noun}'
30
+ // so the first two dash-parts form the service, the third is access, the rest
31
+ // (joined) is the function — which may itself contain dashes
32
+ const parts = input.slug.split('-');
33
+ if (parts.length < 4 || parts[0] !== 'svc') {
34
+ throw new helpful_errors_1.UnexpectedCodePathError(`slug does not match expected '{service}-{access}-{function}' shape`, { slug: input.slug });
35
+ }
36
+ const service = `${parts[0]}-${parts[1]}`;
37
+ const access = parts[2];
38
+ const func = parts.slice(3).join('-');
39
+ return new LambdaEndpoint_1.LambdaEndpoint({
40
+ service,
41
+ access,
42
+ function: func,
43
+ slug: input.slug,
44
+ });
45
+ };
46
+ exports.asLambdaEndpoint = asLambdaEndpoint;
47
+ //# sourceMappingURL=asLambdaEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asLambdaEndpoint.js","sourceRoot":"","sources":["../../../src/domain.operations/asLambdaEndpoint/asLambdaEndpoint.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AAEzD,wEAAqE;AAErE;;;;;;;;;;;GAWG;AACI,MAAM,gBAAgB,GAAG,CAC9B,KAEoB,EACJ,EAAE;IAClB,wCAAwC;IACxC,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QACvB,OAAO,IAAI,+BAAc,CAAC;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE;SAC3D,CAAC,CAAC;IACL,CAAC;IAED,uCAAuC;IACvC,6EAA6E;IAC7E,8EAA8E;IAC9E,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;QAC3C,MAAM,IAAI,wCAAuB,CAC/B,oEAAoE,EACpE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CACrB,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAW,CAAC;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,OAAO,IAAI,+BAAc,CAAC;QACxB,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;AACL,CAAC,CAAC;AArCW,QAAA,gBAAgB,oBAqC3B"}
@@ -1,7 +1,6 @@
1
- import type { LambdaClient } from '@aws-sdk/client-lambda';
2
- import type { ContextLogTrail } from 'sdk-logs';
3
1
  import type { SimpleInMemoryCache } from 'simple-in-memory-cache';
4
2
  import type { SimpleCache } from 'with-simple-cache';
3
+ import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
5
4
  /**
6
5
  * .what = invokes a lambda endpoint with trail propagation
7
6
  * .why = enables service-to-service calls with observability
@@ -27,16 +26,7 @@ export declare const askLambdaEndpoint: <TRequest, TResponse>(input: {
27
26
  */
28
27
  payload?: 'ancient' | 'contemp';
29
28
  };
30
- }, context: ContextLogTrail & {
31
- env: {
32
- access: string;
33
- region?: string;
34
- };
35
- aws?: {
36
- lambda?: {
37
- sdk?: LambdaClient;
38
- };
39
- };
29
+ }, context: ContextAwsLambdaCaller & {
40
30
  cache?: {
41
31
  response?: SimpleCache<TResponse>;
42
32
  dedupe?: SimpleInMemoryCache<TResponse>;
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.askLambdaEndpoint = void 0;
4
+ const genLambdaSdk_1 = require("../../access/sdks/lambda/genLambdaSdk");
5
+ const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
4
6
  const asCachedExecutor_1 = require("./cache/asCachedExecutor");
5
7
  const getAskLambdaCacheKey_1 = require("./cache/getAskLambdaCacheKey");
6
- const getAccessFromContext_1 = require("./context/getAccessFromContext");
7
8
  const getExidFromContext_1 = require("./context/getExidFromContext");
8
9
  const getLogForExidExtraction_1 = require("./context/getLogForExidExtraction");
9
- const genLambdaClient_1 = require("./invoke/genLambdaClient");
10
- const getLambdaFunctionName_1 = require("./serde/getLambdaFunctionName");
11
10
  const getLambdaPayload_1 = require("./serde/getLambdaPayload");
12
11
  /**
13
12
  * .what = invokes a lambda endpoint with trail propagation
@@ -29,12 +28,10 @@ const askLambdaEndpoint = async (input, context) => {
29
28
  note: 'no trail exid in context, generated new one',
30
29
  });
31
30
  }
32
- // get access level from context
33
- const access = (0, getAccessFromContext_1.getAccessFromContext)({ env: context.env });
34
- // build function name
35
- const functionName = (0, getLambdaFunctionName_1.getLambdaFunctionName)({
31
+ // build the endpoint from the selector + ambient access (computes slug)
32
+ const endpoint = (0, asLambdaEndpoint_1.asLambdaEndpoint)({
36
33
  service: input.which.service,
37
- access,
34
+ access: context.env.access,
38
35
  function: input.which.function,
39
36
  });
40
37
  // build payload (ancient handlers expect flat event, contemp expect wrapped)
@@ -42,26 +39,20 @@ const askLambdaEndpoint = async (input, context) => {
42
39
  const payload = structOfPayload === 'ancient'
43
40
  ? input.event
44
41
  : (0, getLambdaPayload_1.getLambdaPayload)({ event: input.event, trail: { exid } });
45
- // get or create lambda client
46
- const lambdaClient = (0, genLambdaClient_1.genLambdaClient)({
42
+ // get or create LambdaClient
43
+ const sdkLambda = (0, genLambdaSdk_1.genLambdaSdk)({
47
44
  sdk: context.aws?.lambda?.sdk,
48
45
  env: { region: context.env.region },
49
46
  });
50
- // prepare invocation args
51
- const invocationArgs = {
52
- functionName,
53
- payload,
54
- exid,
55
- service: input.which.service,
56
- function: input.which.function,
57
- lambdaClient,
47
+ // prepare invocation input + context
48
+ const invocationInput = { endpoint, payload, exid };
49
+ const invocationContext = {
50
+ sdkLambda,
58
51
  log: context.log,
59
52
  };
60
53
  // build cache key generator
61
54
  const getCacheKey = () => (0, getAskLambdaCacheKey_1.getAskLambdaCacheKey)({
62
- service: input.which.service,
63
- function: input.which.function,
64
- access,
55
+ endpoint,
65
56
  event: input.event,
66
57
  });
67
58
  // get executor with cache wrapper
@@ -70,7 +61,7 @@ const askLambdaEndpoint = async (input, context) => {
70
61
  getCacheKey,
71
62
  });
72
63
  // execute invocation
73
- return execute(invocationArgs);
64
+ return execute(invocationInput, invocationContext);
74
65
  };
75
66
  exports.askLambdaEndpoint = askLambdaEndpoint;
76
67
  //# sourceMappingURL=askLambdaEndpoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askLambdaEndpoint.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEndpoint.ts"],"names":[],"mappings":";;;AAKA,+DAA4D;AAC5D,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+EAA4E;AAE5E,8DAA2D;AAC3D,yEAAsE;AACtE,+DAA4D;AAE5D;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,KAAK,EACpC,KAkBC,EACD,OAYC,EACmB,EAAE;IACtB,iCAAiC;IACjC,MAAM,oBAAoB,GAAG,IAAA,iDAAuB,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3E,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uCAAkB,EAAC;QACtD,GAAG,EAAE,oBAAoB;KAC1B,CAAC,CAAC;IAEH,+EAA+E;IAC/E,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACxC,IAAI;YACJ,IAAI,EAAE,6CAA6C;SACpD,CAAC,CAAC;IACL,CAAC;IAED,gCAAgC;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,6EAA6E;IAC7E,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,IAAI,SAAS,CAAC;IAC3D,MAAM,OAAO,GACX,eAAe,KAAK,SAAS;QAC3B,CAAC,CAAC,KAAK,CAAC,KAAK;QACb,CAAC,CAAC,IAAA,mCAAgB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAEhE,6BAA6B;IAC7B,MAAM,SAAS,GAAG,IAAA,2BAAY,EAAC;QAC7B,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG;QAC7B,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;KACpC,CAAC,CAAC;IAEH,qCAAqC;IACrC,MAAM,eAAe,GAAoB,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACrE,MAAM,iBAAiB,GAAsB;QAC3C,SAAS;QACT,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC;IAEF,4BAA4B;IAC5B,MAAM,WAAW,GAAG,GAAW,EAAE,CAC/B,IAAA,2CAAoB,EAAC;QACnB,QAAQ;QACR,KAAK,EAAE,KAAK,CAAC,KAAgC;KAC9C,CAAC,CAAC;IAEL,kCAAkC;IAClC,MAAM,OAAO,GAAG,IAAA,mCAAgB,EAAY;QAC1C,GAAG,OAAO,CAAC,KAAK;QAChB,WAAW;KACZ,CAAC,CAAC;IAEH,qBAAqB;IACrB,OAAO,OAAO,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC,CAAC;AAnFW,QAAA,iBAAiB,qBAmF5B"}
@@ -1,11 +1,11 @@
1
1
  import type { SimpleInMemoryCache } from 'simple-in-memory-cache';
2
2
  import { type SimpleCache } from 'with-simple-cache';
3
- import { type InvocationArgs } from '../invoke/executeLambdaInvocation';
3
+ import { type InvocationContext, type InvocationInput } from '../invoke/executeLambdaInvocation';
4
4
  /**
5
5
  * .what = executor type for lambda invocation
6
6
  * .why = typed for cache wrapper composition
7
7
  */
8
- type LambdaExecutor<TResponse> = (args: InvocationArgs) => Promise<TResponse>;
8
+ type LambdaExecutor<TResponse> = (input: InvocationInput, context: InvocationContext) => Promise<TResponse>;
9
9
  /**
10
10
  * .what = wraps executor with cache if caches provided
11
11
  * .why = extracts cache selection logic from orchestrator
@@ -1 +1 @@
1
- {"version":3,"file":"asCachedExecutor.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.ts"],"names":[],"mappings":";;;AACA,yDAA2E;AAE3E,+EAG2C;AAQ3C;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAY,KAI3C,EAA6B,EAAE;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,iDAAoD,CAAC;IAE9D,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;YACnD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ;gBACtB,aAAa,EAAE,KAAK,CAAC,MAAM;aAC5B;YACD,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;SACtC,CAA8B,CAAC;IAClC,CAAC;IAED,oBAAoB;IACpB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;KACtC,CAA8B,CAAC;AAClC,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B"}
1
+ {"version":3,"file":"asCachedExecutor.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.ts"],"names":[],"mappings":";;;AACA,yDAA2E;AAE3E,+EAI2C;AAW3C;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAY,KAI3C,EAA6B,EAAE;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,iDAAoD,CAAC;IAE9D,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;YACnD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ;gBACtB,aAAa,EAAE,KAAK,CAAC,MAAM;aAC5B;YACD,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;SACtC,CAA8B,CAAC;IAClC,CAAC;IAED,oBAAoB;IACpB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;KACtC,CAA8B,CAAC;AAClC,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B"}
@@ -1,10 +1,9 @@
1
+ import type { LambdaEndpoint } from '../../../domain.objects/LambdaEndpoint';
1
2
  /**
2
- * .what = generates a unique cache key for lambda client requests
3
+ * .what = generates a unique cache key for LambdaClient requests
3
4
  * .why = enables request deduplication and response cache
4
5
  */
5
6
  export declare const getAskLambdaCacheKey: (input: {
6
- service: string;
7
- function: string;
8
- access: string;
7
+ endpoint: LambdaEndpoint;
9
8
  event: Record<string, unknown>;
10
9
  }) => string;
@@ -3,14 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAskLambdaCacheKey = void 0;
4
4
  const node_crypto_1 = require("node:crypto");
5
5
  /**
6
- * .what = generates a unique cache key for lambda client requests
6
+ * .what = recursively sorts object keys for deterministic serialization
7
+ * .why = JSON.stringify does not guarantee property order
8
+ */
9
+ const asStableJson = (value) => {
10
+ if (value === null || typeof value !== 'object') {
11
+ return JSON.stringify(value);
12
+ }
13
+ if (Array.isArray(value)) {
14
+ return '[' + value.map(asStableJson).join(',') + ']';
15
+ }
16
+ const sortedKeys = Object.keys(value).sort();
17
+ const pairs = sortedKeys.map((key) => `${JSON.stringify(key)}:${asStableJson(value[key])}`);
18
+ return '{' + pairs.join(',') + '}';
19
+ };
20
+ /**
21
+ * .what = generates a unique cache key for LambdaClient requests
7
22
  * .why = enables request deduplication and response cache
8
23
  */
9
24
  const getAskLambdaCacheKey = (input) => {
10
- const idealKey = [
11
- [input.service, input.access, input.function].join('-'),
12
- JSON.stringify(input.event),
13
- ].join('.');
25
+ const idealKey = [input.endpoint.slug, asStableJson(input.event)].join('.');
14
26
  // create human part for observability
15
27
  const humanPart = idealKey
16
28
  .replace(/:/g, '.')
@@ -1 +1 @@
1
- {"version":3,"file":"getAskLambdaCacheKey.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAKpC,EAAU,EAAE;IACX,MAAM,QAAQ,GAAG;QACf,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;KAC5B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEZ,sCAAsC;IACtC,MAAM,SAAS,GAAG,QAAQ;SACvB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEzB,6CAA6C;IAC7C,MAAM,UAAU,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACpC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CA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AC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5E,sCAAsC;IACtC,MAAM,SAAS,GAAG,QAAQ;SACvB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEzB,6CAA6C;IAC7C,MAAM,UAAU,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACpC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SAChC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * .what = transforms http status code to actionable hint message
3
- * .why = helps users understand and address lambda invocation failures
3
+ * .why = helps humans understand and address lambda invocation failures
4
4
  */
5
5
  export declare const getStatusCodeHint: (statusCode: number) => string;
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStatusCodeHint = void 0;
4
4
  /**
5
5
  * .what = transforms http status code to actionable hint message
6
- * .why = helps users understand and address lambda invocation failures
6
+ * .why = helps humans understand and address lambda invocation failures
7
7
  */
8
8
  const getStatusCodeHint = (statusCode) => {
9
9
  // check common aws lambda status codes
10
10
  if (statusCode === 400)
11
11
  return 'bad request — check payload format and size';
12
12
  if (statusCode === 403)
13
- return 'access denied — check IAM permissions for lambda:InvokeFunction';
13
+ return 'access denied — check iam permissions for lambda:InvokeFunction';
14
14
  if (statusCode === 404)
15
15
  return 'function not found — verify service name, access level, and function name are correct';
16
16
  if (statusCode === 408)
17
- return 'request timeout — consider increasing client timeout';
17
+ return 'request timeout — consider increasing caller timeout';
18
18
  if (statusCode === 413)
19
19
  return 'payload too large — reduce request size (max 6MB sync, 256KB async)';
20
20
  if (statusCode === 429)
@@ -1,4 +1,5 @@
1
1
  import type { LambdaClient } from '@aws-sdk/client-lambda';
2
+ import type { LambdaEndpoint } from '../../../domain.objects/LambdaEndpoint';
2
3
  /**
3
4
  * .what = minimal log interface for lambda invocation
4
5
  * .why = accepts console, sdk-logs LogMethods, or any object with debug method
@@ -7,20 +8,24 @@ export interface MinimalLogMethods {
7
8
  debug: (message: string, meta?: Record<string, unknown>) => void;
8
9
  }
9
10
  /**
10
- * .what = invocation args for lambda execution
11
- * .why = typed input for executor functions
11
+ * .what = invocation input for lambda execution
12
+ * .why = what to invoke (the endpoint) with which payload + trail exid
12
13
  */
13
- export type InvocationArgs = {
14
- functionName: string;
14
+ export type InvocationInput = {
15
+ endpoint: LambdaEndpoint;
15
16
  payload: unknown;
16
17
  exid: string;
17
- service: string;
18
- function: string;
19
- lambdaClient: LambdaClient;
18
+ };
19
+ /**
20
+ * .what = invocation context for lambda execution
21
+ * .why = injected dependencies (sdk client + log), not invocation identity
22
+ */
23
+ export type InvocationContext = {
24
+ sdkLambda: LambdaClient;
20
25
  log: MinimalLogMethods | null;
21
26
  };
22
27
  /**
23
28
  * .what = the core lambda invocation logic
24
29
  * .why = extracted to enable cache wrapper composition
25
30
  */
26
- export declare const executeLambdaInvocation: <TResponse>(input: InvocationArgs) => Promise<TResponse>;
31
+ export declare const executeLambdaInvocation: <TResponse>(input: InvocationInput, context: InvocationContext) => Promise<TResponse>;
@@ -1,31 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeLambdaInvocation = void 0;
4
+ const sdkLambdaInvoke_1 = require("../../../access/sdks/lambda/sdkLambdaInvoke");
4
5
  const LambdaEndpointError_1 = require("../../../domain.objects/LambdaEndpointError");
5
6
  const getStatusCodeHint_1 = require("../error/getStatusCodeHint");
6
7
  const getParsedResponse_1 = require("../serde/getParsedResponse");
7
- const sdkLambdaInvoke_1 = require("./sdkLambdaInvoke");
8
8
  /**
9
9
  * .what = the core lambda invocation logic
10
10
  * .why = extracted to enable cache wrapper composition
11
11
  */
12
- const executeLambdaInvocation = async (input) => {
12
+ const executeLambdaInvocation = async (input, context) => {
13
13
  // log invocation
14
- input.log?.debug('askLambdaEndpoint.invoke', {
15
- functionName: input.functionName,
14
+ context.log?.debug('askLambdaEndpoint.invoke', {
15
+ slug: input.endpoint.slug,
16
16
  exid: input.exid,
17
17
  });
18
18
  // invoke lambda via communicator
19
- const result = await (0, sdkLambdaInvoke_1.sdkLambdaInvoke)({
20
- client: input.lambdaClient,
21
- functionName: input.functionName,
22
- payload: input.payload,
23
- }).catch((error) => {
24
- throw new LambdaEndpointError_1.LambdaEndpointError(`lambda invocation threw: ${error instanceof Error ? error.message : String(error)}`, {
25
- service: input.service,
26
- function: input.function,
19
+ // @error-enrichment: all sdkLambdaInvoke errors wrapped with endpoint context
20
+ // - allowlist: all errors (sdk, network, timeout) → wrap with endpoint context
21
+ // - original error preserved via `cause` for full stack trace
22
+ // - throw raw error would lose which endpoint failed
23
+ const result = await (0, sdkLambdaInvoke_1.sdkLambdaInvoke)({ slug: input.endpoint.slug, payload: input.payload }, { sdkLambda: context.sdkLambda }).catch((error) => {
24
+ // throw non-Error values (unexpected)
25
+ if (!(error instanceof Error))
26
+ throw error;
27
+ // wrap Error with endpoint context (error preserved via cause)
28
+ throw new LambdaEndpointError_1.LambdaEndpointError(`lambda invocation threw: ${error.message}`, {
29
+ endpoint: input.endpoint,
27
30
  exid: input.exid,
28
- cause: error instanceof Error ? error : undefined,
31
+ cause: error,
29
32
  });
30
33
  });
31
34
  // check invocation status (200 = invocation succeeded, handler may have thrown)
@@ -35,8 +38,7 @@ const executeLambdaInvocation = async (input) => {
35
38
  // construct actionable error message based on status code
36
39
  const statusHint = (0, getStatusCodeHint_1.getStatusCodeHint)(statusCode);
37
40
  throw new LambdaEndpointError_1.LambdaEndpointError(`lambda invocation failed: ${statusHint}`, {
38
- service: input.service,
39
- function: input.function,
41
+ endpoint: input.endpoint,
40
42
  exid: input.exid,
41
43
  statusCode,
42
44
  });
@@ -45,13 +47,12 @@ const executeLambdaInvocation = async (input) => {
45
47
  const response = (0, getParsedResponse_1.getParsedResponse)({
46
48
  payload: result.payload,
47
49
  functionError: result.functionError,
48
- service: input.service,
49
- function: input.function,
50
+ endpoint: input.endpoint,
50
51
  exid: input.exid,
51
52
  });
52
53
  // log result
53
- input.log?.debug('askLambdaEndpoint.result', {
54
- functionName: input.functionName,
54
+ context.log?.debug('askLambdaEndpoint.result', {
55
+ slug: input.endpoint.slug,
55
56
  statusCode: result.statusCode,
56
57
  });
57
58
  return response;