sdk-aws-lambda 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/contract/cli/asGenArgs.d.ts +21 -0
  2. package/dist/contract/cli/asGenArgs.js +69 -0
  3. package/dist/contract/cli/asGenArgs.js.map +1 -0
  4. package/dist/contract/cli/gen.d.ts +23 -0
  5. package/dist/contract/cli/gen.js +72 -0
  6. package/dist/contract/cli/gen.js.map +1 -0
  7. package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +12 -0
  8. package/dist/domain.objects/ApiGatewayRequestPayload.js +3 -0
  9. package/dist/domain.objects/ApiGatewayRequestPayload.js.map +1 -0
  10. package/dist/domain.objects/ApiGatewayResponse.d.ts +30 -0
  11. package/dist/domain.objects/ApiGatewayResponse.js +3 -0
  12. package/dist/domain.objects/ApiGatewayResponse.js.map +1 -0
  13. package/dist/domain.objects/ApiGatewayResponsePayload.d.ts +30 -0
  14. package/dist/domain.objects/ApiGatewayResponsePayload.js +3 -0
  15. package/dist/domain.objects/ApiGatewayResponsePayload.js.map +1 -0
  16. package/dist/domain.objects/DomainObjectCaptured.d.ts +51 -0
  17. package/dist/domain.objects/DomainObjectCaptured.js +8 -0
  18. package/dist/domain.objects/DomainObjectCaptured.js.map +1 -0
  19. package/dist/domain.objects/GeneratedFile.d.ts +18 -0
  20. package/dist/domain.objects/GeneratedFile.js +8 -0
  21. package/dist/domain.objects/GeneratedFile.js.map +1 -0
  22. package/dist/domain.objects/HttpStatusCode.d.ts +1 -0
  23. package/dist/domain.objects/HttpStatusCode.js +1 -0
  24. package/dist/domain.objects/HttpStatusCode.js.map +1 -1
  25. package/dist/domain.objects/LambdaCredentialsAbsentError.d.ts +11 -0
  26. package/dist/domain.objects/LambdaCredentialsAbsentError.js +16 -0
  27. package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -0
  28. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.d.ts +12 -0
  29. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js +17 -0
  30. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -0
  31. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.d.ts +14 -0
  32. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js +19 -0
  33. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -0
  34. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +29 -0
  35. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js +3 -0
  36. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js.map +1 -0
  37. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.d.ts +29 -0
  38. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js +30 -0
  39. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js.map +1 -0
  40. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +36 -0
  41. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js +3 -0
  42. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +1 -0
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +19 -0
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +24 -0
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +1 -0
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.d.ts +26 -0
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js +31 -0
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +1 -0
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +33 -0
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +39 -0
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -0
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +27 -0
  53. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +118 -0
  54. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +1 -0
  55. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +76 -36
  56. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +153 -45
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  58. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.d.ts +8 -0
  59. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +34 -0
  60. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +1 -0
  61. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +19 -0
  62. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +36 -0
  63. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -0
  64. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.d.ts +7 -24
  65. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +19 -103
  66. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
  67. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +20 -0
  68. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +48 -0
  69. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js.map +1 -0
  70. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +16 -0
  71. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +32 -0
  72. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
  73. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +6 -22
  74. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +24 -18
  75. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  76. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +11 -2
  77. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +12 -2
  78. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
  79. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.d.ts +37 -0
  80. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js +24 -0
  81. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js.map +1 -0
  82. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +18 -10
  83. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +20 -23
  84. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
  85. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +29 -6
  86. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +23 -28
  87. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  88. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +16 -1
  89. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +9 -13
  90. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
  91. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +27 -6
  92. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +29 -4
  93. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
  94. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +12 -4
  95. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  96. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +27 -2
  97. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +34 -13
  98. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  99. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +1 -0
  100. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
  101. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.d.ts +16 -0
  102. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js +36 -0
  103. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -0
  104. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.d.ts +10 -0
  105. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js +18 -0
  106. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -0
  107. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.d.ts +14 -0
  108. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +44 -0
  109. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -0
  110. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.d.ts +11 -0
  111. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +42 -0
  112. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -0
  113. package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +9 -0
  114. package/dist/domain.operations/genServiceSdk/gen.file/banner.js +16 -0
  115. package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -0
  116. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.d.ts +20 -0
  117. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js +44 -0
  118. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -0
  119. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.d.ts +13 -0
  120. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js +49 -0
  121. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -0
  122. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +16 -0
  123. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +39 -0
  124. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -0
  125. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +35 -0
  126. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +189 -0
  127. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -0
  128. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +15 -0
  129. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +37 -0
  130. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -0
  131. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.d.ts +26 -0
  132. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +106 -0
  133. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -0
  134. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.d.ts +15 -0
  135. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +51 -0
  136. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -0
  137. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts +14 -0
  138. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +68 -0
  139. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -0
  140. package/dist/domain.operations/genServiceSdk/genServiceSdk.d.ts +20 -0
  141. package/dist/domain.operations/genServiceSdk/genServiceSdk.js +88 -0
  142. package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -0
  143. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +49 -4
  144. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
  145. package/dist/index.d.ts +38 -2
  146. package/dist/index.js +31 -1
  147. package/dist/index.js.map +1 -1
  148. package/package.json +18 -14
  149. package/readme.md +50 -2
@@ -1 +1 @@
1
- {"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAE9D;;;;;;GAMG;AACI,MAAM,iCAAiC,GAAG,CAAC,IAEjD,EAEC,EAAE;IACF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,4DAA4D;QAC5D,yEAAyE;QACzE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,YAAY;YAAE,OAAO;QAEzB,oCAAoC;QACpC,MAAM,GAAG,GACP,OAAO,CAAC,OACT,EAAE,GAAG,CAAC;QAEP,uDAAuD;QACvD,MAAM,QAAQ,GAAG,GAAG,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;QAC7C,QAAQ,CAAC,eAAe,EAAE;YACxB,YAAY,EAAE,KAAK,CAAC,OAAO;YAC3B,UAAU,EAAE,KAAK,CAAC,KAAK;SACxB,CAAC,CAAC;QAEH,uFAAuF;QACvF,IAAI,IAAI,EAAE,UAAU,EAAE,CAAC;YACrB,2DAA2D;YAC3D,MAAM,IAAI,GAAI,OAAO,CAAC,OAAmD;gBACvE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC;YAErB,iDAAiD;YACjD,6FAA6F;YAC7F,OAAO,CAAC,QAAQ,GAAG;gBACjB,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,YAAY,EAAE,uBAAuB;oBACrC,SAAS,EAAE,sBAAsB;oBACjC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACzC,CAAC;gBACF,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;aAChD,CAAC;YAEF,4DAA4D;YAC5D,8DAA8D;YAC9D,OAAO;QACT,CAAC;QAED,kDAAkD;QAClD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC;AArDW,QAAA,iCAAiC,qCAqD5C"}
1
+ {"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;GASG;AACI,MAAM,iCAAiC,GAAG,CAAC,IAqBjD,EAEC,EAAE;IACF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,4DAA4D;QAC5D,yEAAyE;QACzE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,YAAY;YAAE,OAAO;QAEzB,iEAAiE;QACjE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/D,uDAAuD;QACvD,MAAM,QAAQ,GAAG,GAAG,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;QAC7C,QAAQ,CAAC,eAAe,EAAE;YACxB,YAAY,EAAE,KAAK,CAAC,OAAO;YAC3B,UAAU,EAAE,KAAK,CAAC,KAAK;SACxB,CAAC,CAAC;QAEH,sFAAsF;QACtF,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK;YAAE,MAAM,KAAK,CAAC;QAE9C,2DAA2D;QAC3D,MAAM,IAAI,GAAG,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,IAAI,CAAC;QAEtC;;;;;;WAMG;QACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC;AA3DW,QAAA,iCAAiC,qCA2D5C"}
@@ -1,6 +1,7 @@
1
1
  import type middy from '@middy/core';
2
2
  import type { ZodType } from 'zod';
3
3
  import type { EnvConfig } from '../../../domain.objects/ContextAwsLambdaServer';
4
+ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
4
5
  /**
5
6
  * .what = middleware that intercepts introspection requests
6
7
  * .why = enables runtime schema discovery for sdk generation
@@ -16,7 +17,21 @@ export declare const genIntrospectionMiddleware: <TInput, TOutput>(opts: {
16
17
  output: ZodType<TOutput>;
17
18
  };
18
19
  env?: EnvConfig;
19
- apiGateway?: boolean;
20
+ /**
21
+ * .what = reads `inputAfter` out of the middy request, per family
22
+ * .why = each family keeps the caller's value in a DIFFERENT place, and only the family
23
+ * knows which. the api-gateway chain must keep `request.event` HTTP-SHAPED, since
24
+ * `@middy/http-cors` reads `request.event.headers` and derives the http method from
25
+ * `request.event` in its `after` hook — so that family carries the value at
26
+ * `event.body`, while the ask-endpoint family carries it at `event` itself
27
+ */
28
+ asInputAfter: (request: any) => unknown;
29
+ /**
30
+ * .what = renders the schema as this family's `outputAfter`, per family
31
+ * .why = the short-circuit writes STRAIGHT to the wire, so the shape is the family's own:
32
+ * api-gateway owes a wire payload, while an ask-endpoint response IS its payload
33
+ */
34
+ asOutputAfter: (schema: LambdaEndpointSchema) => unknown;
20
35
  }) => {
21
36
  before: middy.MiddlewareFn<any, any>;
22
37
  };
@@ -15,9 +15,8 @@ const genIntrospectionMiddleware_isIntrospectionPayload_1 = require("./genIntros
15
15
  */
16
16
  const genIntrospectionMiddleware = (opts) => {
17
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
18
+ // read inputAfter from wherever this family keeps it
19
+ const payload = opts.asInputAfter(request);
21
20
  if (!(0, genIntrospectionMiddleware_isIntrospectionPayload_1.isIntrospectionPayload)(payload))
22
21
  return;
23
22
  // extract env from config
@@ -35,16 +34,13 @@ const genIntrospectionMiddleware = (opts) => {
35
34
  input: (0, genIntrospectionMiddleware_getJsonSchemaFromZod_1.getJsonSchemaFromZod)(opts.schema.input),
36
35
  output: (0, genIntrospectionMiddleware_getJsonSchemaFromZod_1.getJsonSchemaFromZod)(opts.schema.output),
37
36
  };
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;
37
+ /**
38
+ * .what = short-circuit the chain with this family's own wire shape
39
+ * .note = DELIBERATE MUTATION. middy's `before` contract is that a hook short-circuits by
40
+ * assignment to `request.response`; there is no immutable form of that signal
41
+ * (rule.require.immutable-vars, the annotated-exception clause)
42
+ */
43
+ request.response = opts.asOutputAfter(schema);
48
44
  return request.response;
49
45
  };
50
46
  return { before };
@@ -1 +1 @@
1
- {"version":3,"file":"genIntrospectionMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpo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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"}
1
+ {"version":3,"file":"genIntrospectionMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAKjD,uHAAyF;AACzF,2HAA6F;AAE7F;;;;;;;;GAQG;AACI,MAAM,0BAA0B,GAAG,CAAkB,IAuB3D,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,qDAAqD;QACrD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAE3C,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;;;;;WAKG;QACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AApEW,QAAA,0BAA0B,8BAoErC"}
@@ -1,14 +1,35 @@
1
1
  import type middy from '@middy/core';
2
- export interface IoLogTranslate {
3
- input?: (event: unknown) => unknown;
4
- output?: (response: unknown) => unknown;
5
- }
2
+ import type { TranslateLog } from '../TranslateLog';
6
3
  /**
7
4
  * .what = middleware that logs handler input and output
8
- * .why = enables debug observability with optional redaction via logTranslate
5
+ * .why = enables debug observability with optional redaction via translate.log
6
+ *
7
+ * ⚠️ .note = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
8
+ * never runs. both shipped chains log the `errorMessage` / `stackTrace` branch
9
+ * instead.
10
+ *
11
+ * .the cause = middy `unshift`s `after` and `onError` hooks
12
+ * (`@middy/core/index.js:79-100`), so registration order REVERSES at run time: a
13
+ * HIGHER array index runs EARLIER on the error path. `onError` here reads
14
+ * `request.response`, which exists only once an error-builder has set it — so this
15
+ * middleware must sit at a LOWER index than `genConstraintErrorMiddleware` /
16
+ * `genInternalServiceErrorMiddleware` for its response branch to observe a value at
17
+ * all. today it sits HIGHER in both.
18
+ *
19
+ * .the repair, unapplied = move it below the error builders. left with the peer
20
+ * header-order defect (F32) because that reorder also moves the SUCCESS-path `after`
21
+ * order for every handler — a blast radius this wish's bound does not cover.
22
+ *
23
+ * ⚠️ do NOT delete the response branch as dead code. it names a real intent — *on an
24
+ * error, log what the caller actually received* — and it goes live the moment the
25
+ * reorder lands (rule.require.retest-the-model-on-every-family: prune a slot, never a
26
+ * name).
27
+ *
28
+ * ⚠️ the same mechanism binds a CUSTOM chain: place this below your own error
29
+ * builders, or its error-path response branch is dead there too.
9
30
  */
10
31
  export declare const genIoLoggerMiddleware: (input?: {
11
- logTranslate?: IoLogTranslate;
32
+ logTranslate?: TranslateLog;
12
33
  }) => {
13
34
  before: middy.MiddlewareFn<any, any>;
14
35
  after: middy.MiddlewareFn<any, any>;
@@ -1,21 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.genIoLoggerMiddleware = void 0;
4
+ const asContextTrailed_1 = require("./asContextTrailed");
4
5
  /**
5
6
  * .what = middleware that logs handler input and output
6
- * .why = enables debug observability with optional redaction via logTranslate
7
+ * .why = enables debug observability with optional redaction via translate.log
8
+ *
9
+ * ⚠️ .note = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
10
+ * never runs. both shipped chains log the `errorMessage` / `stackTrace` branch
11
+ * instead.
12
+ *
13
+ * .the cause = middy `unshift`s `after` and `onError` hooks
14
+ * (`@middy/core/index.js:79-100`), so registration order REVERSES at run time: a
15
+ * HIGHER array index runs EARLIER on the error path. `onError` here reads
16
+ * `request.response`, which exists only once an error-builder has set it — so this
17
+ * middleware must sit at a LOWER index than `genConstraintErrorMiddleware` /
18
+ * `genInternalServiceErrorMiddleware` for its response branch to observe a value at
19
+ * all. today it sits HIGHER in both.
20
+ *
21
+ * .the repair, unapplied = move it below the error builders. left with the peer
22
+ * header-order defect (F32) because that reorder also moves the SUCCESS-path `after`
23
+ * order for every handler — a blast radius this wish's bound does not cover.
24
+ *
25
+ * ⚠️ do NOT delete the response branch as dead code. it names a real intent — *on an
26
+ * error, log what the caller actually received* — and it goes live the moment the
27
+ * reorder lands (rule.require.retest-the-model-on-every-family: prune a slot, never a
28
+ * name).
29
+ *
30
+ * ⚠️ the same mechanism binds a CUSTOM chain: place this below your own error
31
+ * builders, or its error-path response branch is dead there too.
7
32
  */
8
33
  const genIoLoggerMiddleware = (input) => {
9
34
  const translateInput = input?.logTranslate?.input ?? ((event) => event);
10
35
  const translateOutput = input?.logTranslate?.output ?? ((response) => response);
11
36
  const before = async (request) => {
12
- const log = request.context?.log;
37
+ const log = (0, asContextTrailed_1.asContextTrailed)({ context: request.context }).log;
13
38
  if (log) {
14
39
  log.debug('handler.input', { event: translateInput(request.event) });
15
40
  }
16
41
  };
17
42
  const after = async (request) => {
18
- const log = request.context?.log;
43
+ const log = (0, asContextTrailed_1.asContextTrailed)({ context: request.context }).log;
19
44
  if (log) {
20
45
  log.debug('handler.output', {
21
46
  response: translateOutput(request.response),
@@ -23,7 +48,7 @@ const genIoLoggerMiddleware = (input) => {
23
48
  }
24
49
  };
25
50
  const onError = async (request) => {
26
- const log = request.context?.log;
51
+ const log = (0, asContextTrailed_1.asContextTrailed)({ context: request.context }).log;
27
52
  if (log) {
28
53
  if (request.response) {
29
54
  log.debug('handler.output', {
@@ -1 +1 @@
1
- {"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAWA;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAErC,EAIC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,eAAe,GACnB,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IA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C,CAAC;AA5CW,QAAA,qBAAqB,yBA4ChC"}
1
+ {"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAErC,EAIC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,eAAe,GACnB,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,MAAM,GAAG,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;QAC/D,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,KAAK,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;QAC/D,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE;gBAC1B,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;aAC5C,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,GAAG,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;QAC/D,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACrB,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE;oBAC1B,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;iBAC5C,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBACzB,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE;oBAC1B,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO;oBACnC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;iBAChC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC;AA5CW,QAAA,qBAAqB,yBA4ChC"}
@@ -31,14 +31,22 @@ const genTrailMiddleware = () => {
31
31
  env: null,
32
32
  });
33
33
  // unwrap event (if wrapped format)
34
+ // .note = DELIBERATE MUTATION — `request` is middy's only channel to hand a value onward
34
35
  request.event = unwrappedEvent;
35
36
  // inject log and caller version flag into context
36
- const contextBefore = (request.context ?? {});
37
37
  /**
38
- * .as = middy types request.context as aws-lambda Context, but we extend
39
- * it with ContextLogTrail and isContempCaller
40
- * .removal = if middy gains typed middleware inference that tracks context extensions, remove cast
38
+ * .as = TWO casts, one subject: middy types `request.context` as aws-lambda's `Context`,
39
+ * which declares neither `log` nor `isContempCaller`. the first widens the read so
40
+ * every extant key survives the spread; the second declares the extension this
41
+ * middleware writes
42
+ *
43
+ * .why not `asContextTrailed` = that reader returns only the TWO sdk-managed fields, so a
44
+ * spread of it would DROP every aws-supplied key. a writer needs the whole bag
45
+ *
46
+ * .removal = removable when middy's `Request` carries a caller-declared context type
47
+ * parameter this chain can bind, such that a middleware may declare what it adds
41
48
  */
49
+ const contextBefore = (request.context ?? {});
42
50
  request.context = {
43
51
  ...contextBefore,
44
52
  log: contextLogTrail.log,
@@ -1 +1 @@
1
- {"version":3,"file":"genTrailMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AACpC,uCAIkB;AAElB,2EAAwE;AAExE;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,GAEhC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,kDAAkD;QAClD,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,GACxD,IAAA,qDAAyB,EAAC;YACxB,OAAO,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC,CAAC;QAEL,gCAAgC;QAChC,MAAM,IAAI,GAAG,eAAe,IAAI,QAAQ,IAAA,mBAAU,GAAE,EAAE,CAAC;QAEvD,eAAe;QACf,MAAM,KAAK,GAAa;YACtB,IAAI;YACJ,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,kCAAkC;QAClC,MAAM,eAAe,GAAG,IAAA,6BAAkB,EAAC;YACzC,KAAK;YACL,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;QAEH,mCAAmC;QACnC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;QAE/B,kDAAkD;QAClD,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAG3C,CAAC;QACF;;;;WAIG;QACH,OAAO,CAAC,OAAO,GAAG;YAChB,GAAG,aAAa;YAChB,GAAG,EAAE,eAAe,CAAC,GAAG;YACxB,eAAe;SAE+B,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AA/CW,QAAA,kBAAkB,sBA+C7B"}
1
+ {"version":3,"file":"genTrailMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AACpC,uCAIkB;AAElB,2EAAwE;AAExE;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,GAEhC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,kDAAkD;QAClD,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,GACxD,IAAA,qDAAyB,EAAC;YACxB,OAAO,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC,CAAC;QAEL,gCAAgC;QAChC,MAAM,IAAI,GAAG,eAAe,IAAI,QAAQ,IAAA,mBAAU,GAAE,EAAE,CAAC;QAEvD,eAAe;QACf,MAAM,KAAK,GAAa;YACtB,IAAI;YACJ,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,kCAAkC;QAClC,MAAM,eAAe,GAAG,IAAA,6BAAkB,EAAC;YACzC,KAAK;YACL,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;QAEH,mCAAmC;QACnC,yFAAyF;QACzF,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;QAE/B,kDAAkD;QAClD;;;;;;;;;;;WAWG;QACH,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAG3C,CAAC;QACF,OAAO,CAAC,OAAO,GAAG;YAChB,GAAG,aAAa;YAChB,GAAG,EAAE,eAAe,CAAC,GAAG;YACxB,eAAe;SAE+B,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAvDW,QAAA,kBAAkB,sBAuD7B"}
@@ -1,8 +1,33 @@
1
1
  import type middy from '@middy/core';
2
2
  import type { ZodSchema } from 'zod';
3
3
  /**
4
- * .what = middleware that validates handler output against zod schema
5
- * .why = ensures type-safe output before response is returned
4
+ * .what = middleware that validates handler output against a zod schema
5
+ * .why = ensures type-safe output before the response is returned
6
+ *
7
+ * ⚠️ .note = WHICH SHAPE THIS VALIDATES DEPENDS ON WHERE YOU REGISTER IT.
8
+ *
9
+ * it reads `request.response`, and on the api-gateway path that slot holds a different
10
+ * type at different points in the chain:
11
+ *
12
+ * before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
13
+ * after the output translator -> `ApiGatewayResponsePayload` (the wire form, body
14
+ * already a string)
15
+ *
16
+ * a schema written for one refuses the other, so a caller who composes this into a
17
+ * custom chain validates whichever shape their registration order produces. the
18
+ * signature cannot warn them — `request.response` is `unknown` to middy, so both bind.
19
+ *
20
+ * .note = UNRESOLVED, NOT A DEFECT — this export carries two contracts with no discriminant.
21
+ * tracked as **F33** in `1.vision.yield.md`'s fulcrum table, where the three options
22
+ * (deprecate, add a `point` discriminant, accept) are spelled out.
23
+ *
24
+ * no shipped chain registers it — both families validate inline instead, because each
25
+ * knows which of the two shapes it holds at that moment and this middleware cannot. so
26
+ * the open question is one of surface area, never of a live defect.
27
+ *
28
+ * .note = the validation itself is delegated to `getValidatedOutput`, as both input-side peers
29
+ * delegate to `getValidationError` — one guarantee, one implementation
30
+ * (rule.forbid.parallel-codepaths)
6
31
  */
7
32
  export declare const genZodOutputValidationMiddleware: <TOutput>(input: {
8
33
  schema: ZodSchema<TOutput>;
@@ -1,24 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.genZodOutputValidationMiddleware = void 0;
4
- const helpful_errors_1 = require("helpful-errors");
5
- const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
4
+ const getValidatedOutput_1 = require("./getValidatedOutput");
6
5
  /**
7
- * .what = middleware that validates handler output against zod schema
8
- * .why = ensures type-safe output before response is returned
6
+ * .what = middleware that validates handler output against a zod schema
7
+ * .why = ensures type-safe output before the response is returned
8
+ *
9
+ * ⚠️ .note = WHICH SHAPE THIS VALIDATES DEPENDS ON WHERE YOU REGISTER IT.
10
+ *
11
+ * it reads `request.response`, and on the api-gateway path that slot holds a different
12
+ * type at different points in the chain:
13
+ *
14
+ * before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
15
+ * after the output translator -> `ApiGatewayResponsePayload` (the wire form, body
16
+ * already a string)
17
+ *
18
+ * a schema written for one refuses the other, so a caller who composes this into a
19
+ * custom chain validates whichever shape their registration order produces. the
20
+ * signature cannot warn them — `request.response` is `unknown` to middy, so both bind.
21
+ *
22
+ * .note = UNRESOLVED, NOT A DEFECT — this export carries two contracts with no discriminant.
23
+ * tracked as **F33** in `1.vision.yield.md`'s fulcrum table, where the three options
24
+ * (deprecate, add a `point` discriminant, accept) are spelled out.
25
+ *
26
+ * no shipped chain registers it — both families validate inline instead, because each
27
+ * knows which of the two shapes it holds at that moment and this middleware cannot. so
28
+ * the open question is one of surface area, never of a live defect.
29
+ *
30
+ * .note = the validation itself is delegated to `getValidatedOutput`, as both input-side peers
31
+ * delegate to `getValidationError` — one guarantee, one implementation
32
+ * (rule.forbid.parallel-codepaths)
9
33
  */
10
34
  const genZodOutputValidationMiddleware = (input) => {
11
35
  return {
12
36
  after: async (request) => {
13
- const result = input.schema.safeParse(request.response);
14
- if (!result.success) {
15
- const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: result.error.issues });
16
- throw new helpful_errors_1.MalfunctionError('output validation failed', {
17
- issues,
18
- });
19
- }
20
- // replace response with validated data (includes defaults, transforms)
21
- request.response = result.data;
37
+ // replace response with validated data (defaults + transforms applied)
38
+ // .note = DELIBERATE MUTATION — `request` is middy's only channel to hand a value onward
39
+ request.response = (0, getValidatedOutput_1.getValidatedOutput)({
40
+ response: request.response,
41
+ schema: input.schema,
42
+ });
22
43
  },
23
44
  };
24
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AACA,mDAAkD;AAGlD,+DAA4D;AAE5D;;;GAGG;AACI,MAAM,gCAAgC,GAAG,CAAU,KAEzD,EAAyC,EAAE;IAC1C,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAExD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;gBAEpE,MAAM,IAAI,iCAAgB,CAAC,0BAA0B,EAAE;oBACrD,MAAM;iBACP,CAAC,CAAC;YACL,CAAC;YAED,uEAAuE;YACvE,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,gCAAgC,oCAmB3C"}
1
+ {"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,MAAM,gCAAgC,GAAG,CAAU,KAEzD,EAAyC,EAAE;IAC1C,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,uEAAuE;YACvE,yFAAyF;YACzF,OAAO,CAAC,QAAQ,GAAG,IAAA,uCAAkB,EAAC;gBACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gCAAgC,oCAa3C"}
@@ -16,6 +16,7 @@ const getCauseMessage = (input) => {
16
16
  * .why = named transformer for clear narrative
17
17
  */
18
18
  const getErrorMetadata = (input) => {
19
+ // .note = the `in` guard narrows, so this needs no cast (rule.forbid.as-cast)
19
20
  if ('metadata' in input.error) {
20
21
  return input.error.metadata;
21
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorResponseBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.ts"],"names":[],"mappings":";;;AAuBA;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAAuB,EAAsB,EAAE;IACtE,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;IACnC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAuB,EAAuB,EAAE;IACxE,IAAI,UAAU,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC9B,OAAQ,KAAK,CAAC,KAAgC,CAAC,QAAQ,CAAC;IAC1D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAG3C,EAA0C,EAAE;IAC3C,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAE1D,OAAO;QACL,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;QACjC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzD,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC;AAEF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAG3C,EAA0C,EAAE;IAC3C,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAEzD,OAAO;QACL,KAAK,EAAE;YACL,MAAM,EAAE,8BAA8B;YACtC,KAAK,EAAE,KAAK,CAAC,UAAU;YACvB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;YAC5B,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C;KACF,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,2BAA2B,+BAgBtC"}
1
+ {"version":3,"file":"getErrorResponseBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.ts"],"names":[],"mappings":";;;AAuBA;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAAuB,EAAsB,EAAE;IACtE,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;IACnC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAuB,EAAuB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AS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C;KACF,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,2BAA2B,+BAgBtC"}
@@ -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,EAA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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"}