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
@@ -7,6 +7,7 @@ exports.genLambdaEndpoint = void 0;
7
7
  const core_1 = __importDefault(require("@middy/core"));
8
8
  const genConstraintErrorMiddleware_1 = require("../middleware/genConstraintErrorMiddleware");
9
9
  const genInternalServiceErrorMiddleware_1 = require("../middleware/genInternalServiceErrorMiddleware");
10
+ const genIntrospectionMiddleware_1 = require("../middleware/genIntrospectionMiddleware");
10
11
  const genIoLoggerMiddleware_1 = require("../middleware/genIoLoggerMiddleware");
11
12
  const genTrailMiddleware_1 = require("../middleware/genTrailMiddleware");
12
13
  const getValidatedOutput_1 = require("../middleware/getValidatedOutput");
@@ -26,27 +27,29 @@ const genZodEventValidationMiddleware_1 = require("./middleware/genZodEventValid
26
27
  * - trail middleware injects log with trail context
27
28
  * - output validation via zod schema
28
29
  */
29
- const genLambdaEndpoint = (config, _genContext) => {
30
+ const genLambdaEndpoint = (input, context) => {
30
31
  // build logic that invokes user handler and validates output
31
- const logic = async (event, context) => {
32
- // get log from context (injected by trail middleware)
33
- const log = context.log;
32
+ const logic = async (event, lambdaContext) => {
33
+ // get log from lambda context (injected by trail middleware)
34
+ const log = lambdaContext.log;
34
35
  // invoke user handler
35
- const response = await config.invoke({ event }, { log });
36
+ const response = await input.invoke({ event }, { log });
36
37
  // validate output and return typed result
37
- return (0, getValidatedOutput_1.getValidatedOutput)({ response, schema: config.schema.output });
38
+ return (0, getValidatedOutput_1.getValidatedOutput)({ response, schema: input.schema.output });
38
39
  };
39
40
  // middleware order matters:
40
41
  // 1. error handlers (onError) - must be first to catch errors from all other middleware
41
- // 2. io logger - logs input/output for debug
42
- // 3. trail (onBefore) - injects trail context
43
- // 4. validation (onBefore) - validates event against schema
42
+ // 2. trail (onBefore) - injects trail context (must be early so isContempCaller is set for error handlers)
43
+ // 3. io logger - logs input/output for debug
44
+ // 4. introspection (onBefore) - intercepts introspect requests, returns schema
45
+ // 5. validation (onBefore) - validates event against schema
44
46
  const middlewares = [
45
47
  (0, genConstraintErrorMiddleware_1.genConstraintErrorMiddleware)(),
46
48
  (0, genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware)(),
47
- (0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: config.logTranslate }),
48
49
  (0, genTrailMiddleware_1.genTrailMiddleware)(),
49
- (0, genZodEventValidationMiddleware_1.genZodEventValidationMiddleware)({ schema: config.schema.input }),
50
+ (0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: input.logTranslate }),
51
+ (0, genIntrospectionMiddleware_1.genIntrospectionMiddleware)({ schema: input.schema, env: context?.env }),
52
+ (0, genZodEventValidationMiddleware_1.genZodEventValidationMiddleware)({ schema: input.schema.input }),
50
53
  ];
51
54
  /**
52
55
  * .as = assertion needed because middleware transforms LambdaHandlerInput<TInput> to TInput
@@ -1 +1 @@
1
- {"version":3,"file":"genLambdaEndpoint.forAskEndpoint.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAKhC,6FAA0F;AAC1F,uGAAoG;AAEpG,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;AACtE,kGAA+F;AAqD/F;;;;;;;;;;;;;;GAcG;AACI,MAAM,iBAAiB,GAAG,CAC/B,MAOC,EACD,WAAkC,EAMlC,EAAE;IACF,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,EAAE,KAAa,EAAE,OAAgB,EAAoB,EAAE;QACxE,sDAAsD;QACtD,MAAM,GAAG,GAAI,OAAsC,CAAC,GAAG,CAAC;QAExD,sBAAsB;QACtB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAEzD,0CAA0C;QAC1C,OAAO,IAAA,uCAAkB,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF,4BAA4B;IAC5B,wFAAwF;IACxF,6CAA6C;IAC7C,8CAA8C;IAC9C,4DAA4D;IAC5D,MAAM,WAAW,GAAG;QAClB,IAAA,2DAA4B,GAAE;QAC9B,IAAA,qEAAiC,GAAE;QACnC,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5D,IAAA,uCAAkB,GAAE;QACpB,IAAA,iEAA+B,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KACjE,CAAC;IAEF;;;;OAIG;IACH,OAAO,IAAA,cAAK,EACV,KAGqB,CACtB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACrB,CAAC,CAAC;AApDW,QAAA,iBAAiB,qBAoD5B"}
1
+ {"version":3,"file":"genLambdaEndpoint.forAskEndpoint.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAMhC,6FAA0F;AAC1F,uGAAoG;AACpG,yFAAsF;AAEtF,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;AACtE,kGAA+F;AAsD/F;;;;;;;;;;;;;;GAcG;AACI,MAAM,iBAAiB,GAAG,CAC/B,KAOC,EACD,OAAgC,EAMhC,EAAE;IACF,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,EACjB,KAAa,EACb,aAAsB,EACJ,EAAE;QACpB,6DAA6D;QAC7D,MAAM,GAAG,GAAI,aAA4C,CAAC,GAAG,CAAC;QAE9D,sBAAsB;QACtB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAExD,0CAA0C;QAC1C,OAAO,IAAA,uCAAkB,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC;IAEF,4BAA4B;IAC5B,wFAAwF;IACxF,2GAA2G;IAC3G,6CAA6C;IAC7C,+EAA+E;IAC/E,4DAA4D;IAC5D,MAAM,WAAW,GAAG;QAClB,IAAA,2DAA4B,GAAE;QAC9B,IAAA,qEAAiC,GAAE;QACnC,IAAA,uCAAkB,GAAE;QACpB,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;QAC3D,IAAA,uDAA0B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;QACvE,IAAA,iEAA+B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChE,CAAC;IAEF;;;;OAIG;IACH,OAAO,IAAA,cAAK,EACV,KAGqB,CACtB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACrB,CAAC,CAAC;AAzDW,QAAA,iBAAiB,qBAyD5B"}
@@ -32,7 +32,7 @@ const genConstraintErrorMiddleware = (opts) => {
32
32
  const body = isContempCaller
33
33
  ? (0, getErrorResponseBody_1.getErrorResponseBodyContemp)({ error, errorClass: 'ConstraintError' })
34
34
  : (0, getErrorResponseBody_1.getErrorResponseBodyAncient)({ error, errorType: 'BadRequestError' });
35
- // for API Gateway: return HTTP response
35
+ // for api gateway: return http response
36
36
  if (opts?.apiGateway) {
37
37
  /**
38
38
  * .as = middy types request.response as unknown, but we set it to ApiGatewayResponse
@@ -0,0 +1,22 @@
1
+ import type middy from '@middy/core';
2
+ import type { ZodType } from 'zod';
3
+ import type { EnvConfig } from '../../../domain.objects/ContextAwsLambdaServer';
4
+ /**
5
+ * .what = middleware that intercepts introspection requests
6
+ * .why = enables runtime schema discovery for sdk generation
7
+ *
8
+ * behavior:
9
+ * - if payload is { introspect: 'schema' } and env.access === 'prep': return schema
10
+ * - if payload is { introspect: 'schema' } and env.access !== 'prep': fail fast
11
+ * - otherwise: pass through to handler
12
+ */
13
+ export declare const genIntrospectionMiddleware: <TInput, TOutput>(opts: {
14
+ schema: {
15
+ input: ZodType<TInput>;
16
+ output: ZodType<TOutput>;
17
+ };
18
+ env?: EnvConfig;
19
+ apiGateway?: boolean;
20
+ }) => {
21
+ before: middy.MiddlewareFn<any, any>;
22
+ };
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import type { JSONSchema } from 'zod/v4/core/json-schema';
3
+ /**
4
+ * .what = convert zod schema to JSON schema
5
+ * .why = encapsulates zod api for future error handler if needed
6
+ */
7
+ export declare const getJsonSchemaFromZod: <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>(schema: T) => JSONSchema;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJsonSchemaFromZod = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * .what = convert zod schema to JSON schema
7
+ * .why = encapsulates zod api for future error handler if needed
8
+ */
9
+ const getJsonSchemaFromZod = (schema) => {
10
+ return zod_1.z.toJSONSchema(schema);
11
+ };
12
+ exports.getJsonSchemaFromZod = getJsonSchemaFromZod;
13
+ //# sourceMappingURL=genIntrospectionMiddleware.getJsonSchemaFromZod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genIntrospectionMiddleware.getJsonSchemaFromZod.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGxB;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAClC,MAAS,EACG,EAAE;IACd,OAAO,OAAC,CAAC,YAAY,CAAC,MAAM,CAAe,CAAC;AAC9C,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * .what = detect if payload requests schema introspection
3
+ * .why = enables middleware to intercept introspection requests before handler
4
+ */
5
+ export declare const isIntrospectionPayload: (payload: unknown) => boolean;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIntrospectionPayload = void 0;
4
+ /**
5
+ * .what = detect if payload requests schema introspection
6
+ * .why = enables middleware to intercept introspection requests before handler
7
+ */
8
+ const isIntrospectionPayload = (payload) => {
9
+ if (typeof payload !== 'object' || payload === null)
10
+ return false;
11
+ if (!('introspect' in payload))
12
+ return false;
13
+ return payload.introspect === 'schema';
14
+ };
15
+ exports.isIntrospectionPayload = isIntrospectionPayload;
16
+ //# sourceMappingURL=genIntrospectionMiddleware.isIntrospectionPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genIntrospectionMiddleware.isIntrospectionPayload.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAAgB,EAAW,EAAE;IAClE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,IAAI,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,OAAQ,OAAmC,CAAC,UAAU,KAAK,QAAQ,CAAC;AACtE,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genIntrospectionMiddleware = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const genIntrospectionMiddleware_getJsonSchemaFromZod_1 = require("./genIntrospectionMiddleware.getJsonSchemaFromZod");
6
+ const genIntrospectionMiddleware_isIntrospectionPayload_1 = require("./genIntrospectionMiddleware.isIntrospectionPayload");
7
+ /**
8
+ * .what = middleware that intercepts introspection requests
9
+ * .why = enables runtime schema discovery for sdk generation
10
+ *
11
+ * behavior:
12
+ * - if payload is { introspect: 'schema' } and env.access === 'prep': return schema
13
+ * - if payload is { introspect: 'schema' } and env.access !== 'prep': fail fast
14
+ * - otherwise: pass through to handler
15
+ */
16
+ const genIntrospectionMiddleware = (opts) => {
17
+ const before = async (request) => {
18
+ // extract payload - for API Gateway, body is already parsed by httpJsonBodyParser
19
+ const payload = opts.apiGateway ? request.event?.body : request.event;
20
+ // check if introspection request
21
+ if (!(0, genIntrospectionMiddleware_isIntrospectionPayload_1.isIntrospectionPayload)(payload))
22
+ return;
23
+ // extract env from config
24
+ const env = typeof opts.env === 'function' ? await opts.env() : opts.env;
25
+ // fail fast if env not provided
26
+ if (!env) {
27
+ throw new helpful_errors_1.ConstraintError('introspection requires env.access context but env was not provided to handler', { hint: 'pass env config to genLambdaEndpoint' });
28
+ }
29
+ // fail fast if not prep
30
+ if (env.access !== 'prep') {
31
+ throw new helpful_errors_1.ConstraintError(`introspection is only available in prep environment, current: ${env.access}`, { env, access: env.access });
32
+ }
33
+ // build schema response
34
+ const schema = {
35
+ input: (0, genIntrospectionMiddleware_getJsonSchemaFromZod_1.getJsonSchemaFromZod)(opts.schema.input),
36
+ output: (0, genIntrospectionMiddleware_getJsonSchemaFromZod_1.getJsonSchemaFromZod)(opts.schema.output),
37
+ };
38
+ // set response to short-circuit middleware chain
39
+ if (opts.apiGateway) {
40
+ request.response = {
41
+ statusCode: 200,
42
+ body: JSON.stringify(schema),
43
+ headers: { 'Content-Type': 'application/json' },
44
+ };
45
+ return request.response;
46
+ }
47
+ request.response = schema;
48
+ return request.response;
49
+ };
50
+ return { before };
51
+ };
52
+ exports.genIntrospectionMiddleware = genIntrospectionMiddleware;
53
+ //# sourceMappingURL=genIntrospectionMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genIntrospectionMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAMjD,uHAAyF;AACzF,2HAA6F;AAE7F;;;;;;;;GAQG;AACI,MAAM,0BAA0B,GAAG,CAAkB,IAO3D,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,kFAAkF;QAClF,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QAEtE,iCAAiC;QACjC,IAAI,CAAC,IAAA,0EAAsB,EAAC,OAAO,CAAC;YAAE,OAAO;QAE7C,0BAA0B;QAC1B,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAEzE,gCAAgC;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,gCAAe,CACvB,+EAA+E,EAC/E,EAAE,IAAI,EAAE,sCAAsC,EAAE,CACjD,CAAC;QACJ,CAAC;QAED,wBAAwB;QACxB,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAe,CACvB,iEAAiE,GAAG,CAAC,MAAM,EAAE,EAC7E,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAC5B,CAAC;QACJ,CAAC;QAED,wBAAwB;QACxB,MAAM,MAAM,GAAyB;YACnC,KAAK,EAAE,IAAA,sEAAoB,EAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9C,MAAM,EAAE,IAAA,sEAAoB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;SACjD,CAAC;QAEF,iDAAiD;QACjD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,CAAC,QAAQ,GAAG;gBACjB,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;gBAC5B,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;aAC1B,CAAC;YACxB,OAAO,OAAO,CAAC,QAAQ,CAAC;QAC1B,CAAC;QAED,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAzDW,QAAA,0BAA0B,8BAyDrC"}
@@ -32,7 +32,7 @@ const genTrailMiddleware = () => {
32
32
  });
33
33
  // unwrap event (if wrapped format)
34
34
  request.event = unwrappedEvent;
35
- // inject log and client version flag into context
35
+ // inject log and caller version flag into context
36
36
  const contextBefore = (request.context ?? {});
37
37
  /**
38
38
  * .as = middy types request.context as aws-lambda Context, but we extend
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ancient error response body (flat, for backwards compat)
2
+ * ancient error response body (flat format, backwards compat)
3
3
  */
4
4
  export interface LambdaEndpointErrorResponseBodyAncient {
5
5
  errorMessage: string;
@@ -6,7 +6,7 @@ export interface ValidationErrorMetadata {
6
6
  }
7
7
  /**
8
8
  * .what = transforms zod validation error into ConstraintError
9
- * .why = clients need friendly error messages for invalid input
9
+ * .why = callers need friendly error messages for invalid input
10
10
  */
11
11
  export declare const getValidationError: (input: {
12
12
  error: ZodError;
@@ -3,15 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getValidationError = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
6
+ /**
7
+ * .what = format issues summary for error message
8
+ * .why = extract message format from orchestrator
9
+ */
10
+ const getIssuesMessage = (input) => {
11
+ return input.issues
12
+ .map((issue) => `${issue.path}: ${issue.message}`)
13
+ .join('; ');
14
+ };
6
15
  /**
7
16
  * .what = transforms zod validation error into ConstraintError
8
- * .why = clients need friendly error messages for invalid input
17
+ * .why = callers need friendly error messages for invalid input
9
18
  */
10
19
  const getValidationError = (input) => {
11
20
  const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: input.error.issues });
12
- return new helpful_errors_1.ConstraintError('validation failed', {
13
- issues,
14
- });
21
+ const issuesMessage = getIssuesMessage({ issues });
22
+ return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}`, { issues });
15
23
  };
16
24
  exports.getValidationError = getValidationError;
17
25
  //# sourceMappingURL=getValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAG+B;AAM/B;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAEnE,OAAO,IAAI,gCAAe,CAA0B,mBAAmB,EAAE;QACvE,MAAM;KACP,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B"}
1
+ {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAG+B;AAM/B;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAoC,EAAU,EAAE;IACxE,OAAO,KAAK,CAAC,MAAM;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;SACjD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEnD,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,EAAE,EACrC,EAAE,MAAM,EAAE,CACX,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * .what = derive the codegen symbols (object name + dobj prefix) for a service
3
+ * .why = the generated sdk names one object `svcJobs` and prefixes captured
4
+ * domain-objects `SvcJobsJob`; both derive from the `svc-{noun}` name
5
+ *
6
+ * .model = matches the extant `asLambdaEndpoint` slug parser: a service is
7
+ * exactly `svc-{noun}` (2 dash-segments). so `svc-jobs` → noun `jobs`.
8
+ *
9
+ * .throws UnexpectedCodePathError — input is not a valid `svc-{noun}` service
10
+ */
11
+ export declare const asServiceSymbols: (input: {
12
+ service: string;
13
+ }) => {
14
+ object: string;
15
+ prefix: string;
16
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asServiceSymbols = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = derive the codegen symbols (object name + dobj prefix) for a service
7
+ * .why = the generated sdk names one object `svcJobs` and prefixes captured
8
+ * domain-objects `SvcJobsJob`; both derive from the `svc-{noun}` name
9
+ *
10
+ * .model = matches the extant `asLambdaEndpoint` slug parser: a service is
11
+ * exactly `svc-{noun}` (2 dash-segments). so `svc-jobs` → noun `jobs`.
12
+ *
13
+ * .throws UnexpectedCodePathError — input is not a valid `svc-{noun}` service
14
+ */
15
+ const asServiceSymbols = (input) => {
16
+ // split the service into its dash-segments
17
+ const parts = input.service.split('-');
18
+ // require the svc-{noun} shape: exactly 2 non-empty segments, first is 'svc'
19
+ const isValid = parts.length === 2 && parts[0] === 'svc' && (parts[1]?.length ?? 0) > 0;
20
+ if (!isValid)
21
+ throw new helpful_errors_1.UnexpectedCodePathError(`service does not match expected 'svc-{noun}' shape`, { service: input.service });
22
+ // noun is the second segment (e.g. 'jobs')
23
+ const noun = parts[1];
24
+ // object = camelCase svc+noun (e.g. 'svcJobs')
25
+ const object = `svc${capitalize(noun)}`;
26
+ // prefix = PascalCase Svc+Noun (e.g. 'SvcJobs')
27
+ const prefix = `Svc${capitalize(noun)}`;
28
+ return { object, prefix };
29
+ };
30
+ exports.asServiceSymbols = asServiceSymbols;
31
+ /**
32
+ * .what = uppercase the first character of a word
33
+ * .why = build camelCase/PascalCase symbols from the service noun
34
+ */
35
+ const capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
36
+ //# sourceMappingURL=asServiceSymbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asServiceSymbols.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AAEzD;;;;;;;;;GASG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAEhC,EAAsC,EAAE;IACvC,2CAA2C;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvC,6EAA6E;IAC7E,MAAM,OAAO,GACX,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1E,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,wCAAuB,CAC/B,oDAAoD,EACpD,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAC3B,CAAC;IAEJ,2CAA2C;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAW,CAAC;IAEhC,+CAA+C;IAC/C,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;IAExC,gDAAgD;IAChD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;IAExC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B;AAEF;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAC1C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * .what = assemble the `<svc>.ts` barrel file text
3
+ * .why = the single public entrypoint: re-exports the mechanisms object + all
4
+ * resource declarations, so consumers import from one path (uc.1)
5
+ */
6
+ export declare const asBarrelFileSource: (input: {
7
+ object: string;
8
+ mechanismsModule: string;
9
+ resourcesModule: string;
10
+ }) => string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asBarrelFileSource = void 0;
4
+ const banner_1 = require("./banner");
5
+ /**
6
+ * .what = assemble the `<svc>.ts` barrel file text
7
+ * .why = the single public entrypoint: re-exports the mechanisms object + all
8
+ * resource declarations, so consumers import from one path (uc.1)
9
+ */
10
+ const asBarrelFileSource = (input) => [
11
+ banner_1.banner,
12
+ '',
13
+ `export { ${input.object} } from '${input.mechanismsModule}';`,
14
+ `export * from '${input.resourcesModule}';`,
15
+ '',
16
+ ].join('\n');
17
+ exports.asBarrelFileSource = asBarrelFileSource;
18
+ //# sourceMappingURL=asBarrelFileSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asBarrelFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAIlC,EAAU,EAAE,CACX;IACE,eAAM;IACN,EAAE;IACF,YAAY,KAAK,CAAC,MAAM,YAAY,KAAK,CAAC,gBAAgB,IAAI;IAC9D,kBAAkB,KAAK,CAAC,eAAe,IAAI;IAC3C,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAXF,QAAA,kBAAkB,sBAWhB"}
@@ -0,0 +1,14 @@
1
+ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
2
+ /**
3
+ * .what = assemble the full `<svc>.mechanisms.ts` file text
4
+ * .why = exposes the `<object>` const of typed `(event, context)` fns, one per
5
+ * endpoint (uc.1); imports askLambdaEndpoint + the resource types
6
+ */
7
+ export declare const asMechanismsFileSource: (input: {
8
+ service: string;
9
+ object: string;
10
+ resourcesModule: string;
11
+ resourceNames: string[];
12
+ contracts: Record<string, LambdaEndpointSchema>;
13
+ dobjRefs: Record<string, string>;
14
+ }) => string;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asMechanismsFileSource = void 0;
4
+ const asMechanismFnSource_1 = require("../gen.mechanism/asMechanismFnSource");
5
+ const banner_1 = require("./banner");
6
+ /**
7
+ * .what = assemble the full `<svc>.mechanisms.ts` file text
8
+ * .why = exposes the `<object>` const of typed `(event, context)` fns, one per
9
+ * endpoint (uc.1); imports askLambdaEndpoint + the resource types
10
+ */
11
+ const asMechanismsFileSource = (input) => {
12
+ // one fn per endpoint, keyed by bare function name (sorted for stable output)
13
+ const fns = Object.keys(input.contracts)
14
+ .sort()
15
+ .map((fnName) => (0, asMechanismFnSource_1.asMechanismFnSource)({
16
+ service: input.service,
17
+ function: fnName,
18
+ schema: input.contracts[fnName],
19
+ dobjRefs: input.dobjRefs,
20
+ }));
21
+ const fnsText = fns.join('\n');
22
+ // import only the resource types the fn signatures actually name — a nested-only
23
+ // dobj (referenced inside another resource, never in a fn signature) must NOT be
24
+ // imported here, else the generated file has an unused import (consumer lint fails)
25
+ const usedResourceNames = input.resourceNames.filter((name) => new RegExp(`\\b${name}\\b`).test(fnsText));
26
+ // the import lines: askLambdaEndpoint always; resource types only if any used
27
+ const imports = [
28
+ `import { askLambdaEndpoint, type ContextAwsLambdaCaller } from 'sdk-aws-lambda';`,
29
+ ];
30
+ if (usedResourceNames.length > 0)
31
+ imports.push(`import type { ${usedResourceNames.join(', ')} } from '${input.resourcesModule}';`);
32
+ return [
33
+ banner_1.banner,
34
+ '',
35
+ imports.join('\n'),
36
+ '',
37
+ `export const ${input.object} = {`,
38
+ fnsText,
39
+ `};`,
40
+ '',
41
+ ].join('\n');
42
+ };
43
+ exports.asMechanismsFileSource = asMechanismsFileSource;
44
+ //# sourceMappingURL=asMechanismsFileSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asMechanismsFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAOtC,EAAU,EAAE;IACX,8EAA8E;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;SACrC,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,IAAA,yCAAmB,EAAC;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAyB;QACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,iFAAiF;IACjF,iFAAiF;IACjF,oFAAoF;IACpF,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAC1C,CAAC;IAEF,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACd,kFAAkF;KACnF,CAAC;IACF,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAC9B,OAAO,CAAC,IAAI,CACV,iBAAiB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,eAAe,IAAI,CACnF,CAAC;IAEJ,OAAO;QACL,eAAM;QACN,EAAE;QACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,EAAE;QACF,gBAAgB,KAAK,CAAC,MAAM,MAAM;QAClC,OAAO;QACP,IAAI;QACJ,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AA/CW,QAAA,sBAAsB,0BA+CjC"}
@@ -0,0 +1,11 @@
1
+ import type { DomainObjectCaptured } from '../../../domain.objects/DomainObjectCaptured';
2
+ /**
3
+ * .what = assemble the full `<svc>.resources.ts` file text
4
+ * .why = declares every captured dobj as a prefixed interface + class (uc.2);
5
+ * imports the domain-objects base classes; carries the do-not-edit banner
6
+ */
7
+ export declare const asResourcesFileSource: (input: {
8
+ dobjs: DomainObjectCaptured[];
9
+ prefix: string;
10
+ dobjRefs: Record<string, string>;
11
+ }) => string;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asResourcesFileSource = void 0;
4
+ const getTypescriptFromJsonSchema_1 = require("../gen.mechanism/getTypescriptFromJsonSchema");
5
+ const asResourceClassSource_1 = require("../gen.resource/asResourceClassSource");
6
+ const banner_1 = require("./banner");
7
+ /**
8
+ * .what = assemble the full `<svc>.resources.ts` file text
9
+ * .why = declares every captured dobj as a prefixed interface + class (uc.2);
10
+ * imports the domain-objects base classes; carries the do-not-edit banner
11
+ */
12
+ const asResourcesFileSource = (input) => {
13
+ // one interface + class block per captured dobj (sorted for stable output)
14
+ const blocks = input.dobjs.map((dobj) => (0, asResourceClassSource_1.asResourceClassSource)({
15
+ dobj,
16
+ prefix: input.prefix,
17
+ dobjRefs: input.dobjRefs,
18
+ }));
19
+ // import only the base classes actually used — one per distinct kind present
20
+ // (entity→DomainEntity, literal→DomainLiteral, etc); an unused import here would
21
+ // trip the consumer's lint (rule.forbid.snapshot-visual-blemishes)
22
+ const baseClasses = [
23
+ ...new Set(input.dobjs.map((dobj) => asResourceClassSource_1.BASE_CLASS_BY_KIND[dobj.kind])),
24
+ ];
25
+ // import the ref generics (Ref / RefByPrimary / RefByUnique) any dobj shape
26
+ // references — collected across every captured dobj so the import carries exactly
27
+ // the generics emitted (no unused import)
28
+ const refGenerics = [
29
+ ...new Set(input.dobjs.flatMap((dobj) => (0, getTypescriptFromJsonSchema_1.getRefGenericsUsed)({ schema: dobj.shape, dobjRefs: input.dobjRefs }))),
30
+ ].sort();
31
+ // one domain-objects import for base classes + ref generics, alphabetized
32
+ const imported = [...baseClasses, ...refGenerics].sort();
33
+ // the import line, omitted entirely when the import list is empty
34
+ const importLine = imported.length > 0
35
+ ? `import { ${imported.join(', ')} } from 'domain-objects';`
36
+ : null;
37
+ return [banner_1.banner, '', importLine, '', blocks.join('\n\n'), '']
38
+ .filter((line) => line !== null)
39
+ .join('\n');
40
+ };
41
+ exports.asResourcesFileSource = asResourcesFileSource;
42
+ //# sourceMappingURL=asResourcesFileSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asResourcesFileSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.ts"],"names":[],"mappings":";;;AACA,8FAAkF;AAClF,iFAG+C;AAC/C,qCAAkC;AAElC;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAIrC,EAAU,EAAE;IACX,2EAA2E;IAC3E,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACtC,IAAA,6CAAqB,EAAC;QACpB,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CACH,CAAC;IAEF,6EAA6E;IAC7E,iFAAiF;IACjF,mEAAmE;IACnE,MAAM,WAAW,GAAG;QAClB,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,0CAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACrE,CAAC;IAEF,4EAA4E;IAC5E,kFAAkF;IAClF,0CAA0C;IAC1C,MAAM,WAAW,GAAG;QAClB,GAAG,IAAI,GAAG,CACR,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3B,IAAA,gDAAkB,EAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CACrE,CACF;KACF,CAAC,IAAI,EAAE,CAAC;IAET,0EAA0E;IAC1E,MAAM,QAAQ,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;IAEzD,kEAAkE;IAClE,MAAM,UAAU,GACd,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,YAAY,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B;QAC5D,CAAC,CAAC,IAAI,CAAC;IAEX,OAAO,CAAC,eAAM,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;SACzD,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC;SAC/C,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AA5CW,QAAA,qBAAqB,yBA4ChC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * .what = the "generated — do not edit" banner prepended to every emitted file
3
+ * .why = readers should re-run the codegen, not hand-edit the output (uc.1); the
4
+ * robot-arm 🦾 signals at a glance that a machine wrote this file
5
+ * .note = the glyph must survive the biome/stdin format pass — an earlier ⚠️ was
6
+ * mangled to `!` by the pipe (5.3 verification i4); 🦾 is asserted to
7
+ * round-trip cleanly in formatTypescript.integration.test.ts
8
+ */
9
+ export declare const banner = "/**\n * \uD83E\uDDBE generated by `sdk-aws-lambda gen` \u2014 do not edit.\n * re-run the codegen to update.\n */";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.banner = void 0;
4
+ /**
5
+ * .what = the "generated — do not edit" banner prepended to every emitted file
6
+ * .why = readers should re-run the codegen, not hand-edit the output (uc.1); the
7
+ * robot-arm 🦾 signals at a glance that a machine wrote this file
8
+ * .note = the glyph must survive the biome/stdin format pass — an earlier ⚠️ was
9
+ * mangled to `!` by the pipe (5.3 verification i4); 🦾 is asserted to
10
+ * round-trip cleanly in formatTypescript.integration.test.ts
11
+ */
12
+ exports.banner = `/**
13
+ * 🦾 generated by \`sdk-aws-lambda gen\` — do not edit.
14
+ * re-run the codegen to update.
15
+ */`;
16
+ //# sourceMappingURL=banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/banner.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG;;;IAGlB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * .what = format a generated typescript file's text via the biome formatter
3
+ * .why = the emitter assembles bespoke text; running it through biome guarantees
4
+ * the output matches the extant biome config (quote style, spacing, object
5
+ * layout) instead of our hand-rolled whitespace — so the generated files are
6
+ * drop-in clean, not a source of lint churn
7
+ *
8
+ * .note = spawns the biome native cli (found from `@biomejs/biome`) as a
9
+ * subprocess over stdin. `--stdin-file-path` is a VIRTUAL name biome uses
10
+ * for (a) language detection and (b) matching the config's `files.includes`
11
+ * — NOT a real fs read. we pass `src/<filename>` so it matches the standard
12
+ * `src/**` include (generated sdks live under src/access/svcs/); biome
13
+ * discovers the config from cwd and falls back to defaults if none.
14
+ *
15
+ * .throws MalfunctionError — biome could not be spawned or exited non-zero
16
+ */
17
+ export declare const formatTypescript: (input: {
18
+ content: string;
19
+ path: string;
20
+ }) => Promise<string>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatTypescript = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const node_child_process_1 = require("node:child_process");
6
+ const node_path_1 = require("node:path");
7
+ /**
8
+ * .what = format a generated typescript file's text via the biome formatter
9
+ * .why = the emitter assembles bespoke text; running it through biome guarantees
10
+ * the output matches the extant biome config (quote style, spacing, object
11
+ * layout) instead of our hand-rolled whitespace — so the generated files are
12
+ * drop-in clean, not a source of lint churn
13
+ *
14
+ * .note = spawns the biome native cli (found from `@biomejs/biome`) as a
15
+ * subprocess over stdin. `--stdin-file-path` is a VIRTUAL name biome uses
16
+ * for (a) language detection and (b) matching the config's `files.includes`
17
+ * — NOT a real fs read. we pass `src/<filename>` so it matches the standard
18
+ * `src/**` include (generated sdks live under src/access/svcs/); biome
19
+ * discovers the config from cwd and falls back to defaults if none.
20
+ *
21
+ * .throws MalfunctionError — biome could not be spawned or exited non-zero
22
+ */
23
+ const formatTypescript = async (input) => {
24
+ // locate the biome cli shim shipped by the `@biomejs/biome` package
25
+ const biomeBin = require.resolve('@biomejs/biome/bin/biome');
26
+ // a src-conventional virtual name so biome's `files.includes` matches + formats
27
+ const virtualPath = `src/${(0, node_path_1.basename)(input.path)}`;
28
+ // format over stdin; `--stdin-file-path` tells biome the language + include match
29
+ return new Promise((done, fail) => {
30
+ const child = (0, node_child_process_1.execFile)(process.execPath, [biomeBin, 'format', `--stdin-file-path=${virtualPath}`], { maxBuffer: 10 * 1024 * 1024 }, (error, stdout, stderr) => {
31
+ if (error)
32
+ return fail(new helpful_errors_1.MalfunctionError('biome failed to format generated text', {
33
+ cause: error,
34
+ path: input.path,
35
+ stderr,
36
+ }));
37
+ return done(stdout);
38
+ });
39
+ // feed the unformatted text to biome's stdin
40
+ child.stdin?.end(input.content);
41
+ });
42
+ };
43
+ exports.formatTypescript = formatTypescript;
44
+ //# sourceMappingURL=formatTypescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatTypescript.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.file/formatTypescript.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAElD,2DAA8C;AAC9C,yCAAqC;AAErC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,gBAAgB,GAAG,KAAK,EAAE,KAGtC,EAAmB,EAAE;IACpB,oEAAoE;IACpE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAE7D,gFAAgF;IAChF,MAAM,WAAW,GAAG,OAAO,IAAA,oBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;IAElD,kFAAkF;IAClF,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,IAAA,6BAAQ,EACpB,OAAO,CAAC,QAAQ,EAChB,CAAC,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,WAAW,EAAE,CAAC,EACxD,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,EAC/B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,KAAK;gBACP,OAAO,IAAI,CACT,IAAI,iCAAgB,CAAC,uCAAuC,EAAE;oBAC5D,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,MAAM;iBACP,CAAC,CACH,CAAC;YACJ,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;QAEF,6CAA6C;QAC7C,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAhCW,QAAA,gBAAgB,oBAgC3B"}
@@ -0,0 +1,13 @@
1
+ import type { GeneratedFile } from '../../../domain.objects/GeneratedFile';
2
+ /**
3
+ * .what = write a batch of generated files atomically (all-or-none on disk)
4
+ * .why = three sequential single-file writes could leave a partial sdk if the fs
5
+ * fails on file 2 of 3; this stages all to temp names, then renames each
6
+ * into place — on any failure it removes the temp files and throws, so the
7
+ * target directory is never left with a partial set (uc.1 all-or-none)
8
+ *
9
+ * .throws MalfunctionError — a filesystem write/rename failed; temps are cleaned
10
+ */
11
+ export declare const setGeneratedFilesBatch: (input: {
12
+ files: GeneratedFile[];
13
+ }) => Promise<void>;