sdk-aws-lambda 0.7.0 → 0.7.2

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 (122) hide show
  1. package/dist/domain.objects/TrailCarrier.d.ts +17 -0
  2. package/dist/domain.objects/TrailCarrier.js +3 -0
  3. package/dist/domain.objects/TrailCarrier.js.map +1 -0
  4. package/dist/domain.objects/TrailExidHeader.d.ts +10 -0
  5. package/dist/domain.objects/TrailExidHeader.js +14 -0
  6. package/dist/domain.objects/TrailExidHeader.js.map +1 -0
  7. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js +15 -1
  8. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js.map +1 -1
  9. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +50 -27
  10. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +18 -61
  11. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
  12. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.d.ts +35 -0
  13. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js +80 -0
  14. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js.map +1 -0
  15. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.d.ts +37 -0
  16. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js +70 -0
  17. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js.map +1 -0
  18. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.d.ts +17 -0
  19. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js +34 -0
  20. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js.map +1 -0
  21. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.d.ts +31 -0
  22. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js +55 -0
  23. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js.map +1 -0
  24. package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.d.ts +13 -0
  25. package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.js +22 -0
  26. package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.js.map +1 -0
  27. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.d.ts +16 -0
  28. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.js +22 -0
  29. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.js.map +1 -0
  30. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.d.ts +17 -0
  31. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.js +28 -0
  32. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.js.map +1 -0
  33. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.d.ts +23 -0
  34. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js +39 -0
  35. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js.map +1 -0
  36. package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.d.ts +10 -0
  37. package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js +19 -0
  38. package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js.map +1 -0
  39. package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.d.ts +11 -0
  40. package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.js +19 -0
  41. package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.js.map +1 -0
  42. package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.d.ts +9 -6
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.d.ts +12 -0
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js +27 -0
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js.map +1 -0
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +4 -1
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +32 -7
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js +22 -0
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -1
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +1 -1
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +13 -2
  53. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
  54. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.d.ts +1 -1
  55. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +5 -1
  56. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -1
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.d.ts +1 -1
  58. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +5 -1
  59. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
  60. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +9 -0
  61. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +10 -2
  62. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -1
  63. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +15 -8
  64. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +57 -12
  65. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  66. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js +4 -0
  67. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js.map +1 -1
  68. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.d.ts +17 -0
  69. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.js +32 -0
  70. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.js.map +1 -0
  71. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.d.ts +19 -57
  72. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js +30 -78
  73. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js.map +1 -1
  74. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.d.ts +11 -0
  75. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js +13 -0
  76. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js.map +1 -0
  77. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.d.ts +23 -0
  78. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js +32 -0
  79. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js.map +1 -0
  80. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.d.ts +20 -0
  81. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js +23 -0
  82. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js.map +1 -0
  83. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.d.ts +9 -0
  84. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js +19 -0
  85. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js.map +1 -0
  86. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.d.ts +16 -0
  87. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js +24 -0
  88. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js.map +1 -0
  89. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.d.ts +9 -0
  90. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js +15 -0
  91. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js.map +1 -0
  92. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.d.ts +19 -0
  93. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js +27 -0
  94. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js.map +1 -0
  95. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.d.ts +11 -0
  96. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js +21 -0
  97. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js.map +1 -0
  98. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.d.ts +21 -0
  99. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js +27 -0
  100. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js.map +1 -0
  101. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.d.ts +24 -0
  102. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js +28 -0
  103. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js.map +1 -0
  104. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +7 -0
  105. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +18 -2
  106. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -1
  107. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +43 -7
  108. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
  109. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.d.ts +35 -0
  110. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js +81 -0
  111. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js.map +1 -0
  112. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.d.ts +14 -0
  113. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js +18 -0
  114. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js.map +1 -0
  115. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.d.ts +17 -0
  116. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js +19 -0
  117. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js.map +1 -0
  118. package/dist/index.d.ts +14 -6
  119. package/dist/index.js +10 -2
  120. package/dist/index.js.map +1 -1
  121. package/package.json +8 -6
  122. package/readme.md +43 -1
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.forAsk = void 0;
7
7
  const core_1 = __importDefault(require("@middy/core"));
8
+ const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
8
9
  const asContextLogTrail_1 = require("../asContextLogTrail");
9
10
  const genConstraintErrorMiddleware_1 = require("../middleware/genConstraintErrorMiddleware");
10
11
  const genInternalServiceErrorMiddleware_1 = require("../middleware/genInternalServiceErrorMiddleware");
@@ -15,6 +16,13 @@ const getValidatedOutput_1 = require("../middleware/getValidatedOutput");
15
16
  const setEventFrozen_1 = require("../setEventFrozen");
16
17
  const genAskEventOnwireCaptureMiddleware_1 = require("./middleware/genAskEventOnwireCaptureMiddleware");
17
18
  const genZodEventValidationMiddleware_1 = require("./middleware/genZodEventValidationMiddleware");
19
+ /**
20
+ * .what = the carrier this family reads: a direct invoke owns its whole payload, so the `{ event, trail }`
21
+ * wrapper stands in for a metadata bag
22
+ * .why = one constant feeds the trail middleware that reads it and the stamp that tells
23
+ * `runLambdaEndpoint` which carrier to write, so the two cannot disagree
24
+ */
25
+ const CARRIER_ASK = 'wrapper';
18
26
  /**
19
27
  * .what = generates a lambda handler with validation and trail context, for a DIRECT invoke
20
28
  * .why = standardizes handler creation with schema validation and observability. the chain:
@@ -61,7 +69,7 @@ input, context) => {
61
69
  (0, genConstraintErrorMiddleware_1.genConstraintErrorMiddleware)({ asOutputAfter: (body) => body }),
62
70
  (0, genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware)({ asOutputAfter: false }),
63
71
  (0, genAskEventOnwireCaptureMiddleware_1.genAskEventOnwireCaptureMiddleware)(),
64
- (0, genTrailMiddleware_1.genTrailMiddleware)(),
72
+ (0, genTrailMiddleware_1.genTrailMiddleware)({ carrier: CARRIER_ASK }),
65
73
  (0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: input.logTranslate }),
66
74
  (0, genIntrospectionMiddleware_1.genIntrospectionMiddleware)({
67
75
  schema: input.schema,
@@ -78,7 +86,10 @@ input, context) => {
78
86
  * builds the envelope — but typescript cannot track that through middy
79
87
  * .removal = if middy gains typed middleware inference, remove cast
80
88
  */
81
- return (0, core_1.default)(logic).use(middlewares);
89
+ return (0, setHandlerTrailCarrier_1.setHandlerTrailCarrier)({
90
+ handler: (0, core_1.default)(logic).use(middlewares),
91
+ carrier: CARRIER_ASK,
92
+ });
82
93
  };
83
94
  exports.forAsk = forAsk;
84
95
  //# sourceMappingURL=genLambdaEndpoint.forAsk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"genLambdaEndpoint.forAsk.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAOhC,4DAAyD;AACzD,6FAA0F;AAC1F,uGAAoG;AACpG,yFAAsF;AACtF,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;AACtE,sDAAoE;AAEpE,wGAAqG;AACrG,kGAA+F;AAqH/F;;;;;;;;;GASG;AACI,MAAM,MAAM,GAAG;AACpB,4FAA4F;AAC5F,KAA4D,EAC5D,OAAgC,EAQhC,EAAE;IACF,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,EACjB,KAA8B,EAC9B,aAAsB,EACJ,EAAE;QACpB,qFAAqF;QACrF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,qCAAiB,EAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;QAE9D;;;;;;WAMG;QACH,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAE9C,wFAAwF;QACxF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CACjC,EA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CAAC,IAAI,EAAE,CAAC;QAC/D,IAAA,qEAAiC,EAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAC3D,IAAA,uEAAkC,GAAE;QACpC,IAAA,uCAAkB,EAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAC5C,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;QAC3D,IAAA,uDAA0B,EAAC;YACzB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,EAAE,OAAO,EAAE,GAAG;YACjB,0FAA0F;YAC1F,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK;YACxC,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;SAClC,CAAC;QACF,IAAA,iEAA+B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChE,CAAC;IAEF;;;;;OAKG;IACH,OAAO,IAAA,+CAAsB,EAAC;QAC5B,OAAO,EAAE,IAAA,cAAK,EACZ,KAGqB,CACtB,CAAC,GAAG,CAAC,WAAW,CAAC;QAClB,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;AACL,CAAC,CAAC;AAlFW,QAAA,MAAM,UAkFjB"}
@@ -1,9 +1,9 @@
1
1
  import middy from '@middy/core';
2
2
  import type { Context, SQSBatchResponse, SQSEvent } from 'aws-lambda';
3
3
  import type { ContextLogTrail } from 'sdk-logs';
4
+ import type { FrozenDeep } from 'type-fns';
4
5
  import type { ZodSchema } from 'zod';
5
6
  import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
6
- import { type FrozenDeep } from '../setEventFrozen';
7
7
  import type { TranslateLog } from '../TranslateLog';
8
8
  import type { SqsEventDecoded, SqsHeadersDeclared, SqsHeadersMerged, SqsRecordDecoded } from './SqsEventDecoded';
9
9
  /**
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.perBatch = void 0;
7
7
  const core_1 = __importDefault(require("@middy/core"));
8
8
  const helpful_errors_1 = require("helpful-errors");
9
+ const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
9
10
  const asContextLogTrail_1 = require("../asContextLogTrail");
10
11
  const setEventFrozen_1 = require("../setEventFrozen");
11
12
  const asSqsEventDecoded_1 = require("./asSqsEventDecoded");
@@ -102,7 +103,10 @@ const perBatch = (config, context) => {
102
103
  batchItemFailures: idsFailed.map((id) => ({ itemIdentifier: id })),
103
104
  };
104
105
  };
105
- return (0, core_1.default)(logic).use((0, genSqsEndpointMiddlewares_1.genSqsEndpointMiddlewares)({ logTranslate: config.logTranslate }));
106
+ return (0, setHandlerTrailCarrier_1.setHandlerTrailCarrier)({
107
+ handler: (0, core_1.default)(logic).use((0, genSqsEndpointMiddlewares_1.genSqsEndpointMiddlewares)({ logTranslate: config.logTranslate })),
108
+ carrier: genSqsEndpointMiddlewares_1.CARRIER_SQS,
109
+ });
106
110
  };
107
111
  exports.perBatch = perBatch;
108
112
  //# sourceMappingURL=genLambdaEndpoint.forSqs.perBatch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"genLambdaEndpoint.forSqs.perBatch.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,mDAAkD;AAKlD,4DAAyD;AACzD,sDAAoE;AAEpE,2DAAwD;AACxD,6DAA2D;AAC3D,2EAAwE;AAOxE,mEAAgE;AA6EhE;;;;;;;;;GASG;AACI,MAAM,QAAQ,GAAG,CACtB,MAA+C,EAC/C,OAAgC,EACoC,EAAE;IACtE,wFAAwF;IACxF,KAAK,OAAO,CAAC;IAEb,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,wCAAmB,CAAC;IAE9D;;;OAGG;IACH,MAA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MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,cAAc,CAAC,MAAM;YACvB,iCAAgB,CAAC,KAAK,CACpB,0EAA0E,EAC1E;gBACE,cAAc;gBACd,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;gBAC/B,GAAG,EAAE,sJAAsJ;aAC5J,CACF,CAAC;QAEJ,0FAA0F;QAC1F,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5E,MAAM,SAAS,GAAG;YAChB,GAAG,IAAI,GAAG,CACR,OAAO,CAAC,OAAO;iBACZ,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;iBAC1B,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CACzC;SACF,CAAC;QAEF,OAAO;YACL,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;SACnE,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,GAAG,CACrB,IAAA,qDAAyB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CACjE,CAAC;AACJ,CAAC,CAAC;AA5HW,QAAA,QAAQ,YA4HnB"}
1
+ {"version":3,"file":"genLambdaEndpoint.forSqs.perBatch.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,m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O,EAAE,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,GAAG,CACvB,IAAA,qDAAyB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CACjE;QACD,OAAO,EAAE,uCAAW;KACrB,CAAC,CAAC;AACL,CAAC,CAAC;AA/HW,QAAA,QAAQ,YA+HnB"}
@@ -1,9 +1,9 @@
1
1
  import middy from '@middy/core';
2
2
  import type { Context, SQSEvent } from 'aws-lambda';
3
3
  import type { ContextLogTrail } from 'sdk-logs';
4
+ import type { FrozenDeep } from 'type-fns';
4
5
  import type { ZodSchema } from 'zod';
5
6
  import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
6
- import { type FrozenDeep } from '../setEventFrozen';
7
7
  import type { TranslateLog } from '../TranslateLog';
8
8
  import type { SqsEventDecoded, SqsHeadersDeclared, SqsHeadersMerged } from './SqsEventDecoded';
9
9
  /**
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.perRecord = void 0;
7
7
  const core_1 = __importDefault(require("@middy/core"));
8
8
  const helpful_errors_1 = require("helpful-errors");
9
+ const setHandlerTrailCarrier_1 = require("../../lambdaEndpointWire/frame/setHandlerTrailCarrier");
9
10
  const asContextLogTrail_1 = require("../asContextLogTrail");
10
11
  const setEventFrozen_1 = require("../setEventFrozen");
11
12
  const asSqsEventDecoded_1 = require("./asSqsEventDecoded");
@@ -91,7 +92,10 @@ const perRecord = (config, context) => {
91
92
  event: eventFrozen,
92
93
  }, { log });
93
94
  };
94
- return (0, core_1.default)(logic).use((0, genSqsEndpointMiddlewares_1.genSqsEndpointMiddlewares)({ logTranslate: config.logTranslate }));
95
+ return (0, setHandlerTrailCarrier_1.setHandlerTrailCarrier)({
96
+ handler: (0, core_1.default)(logic).use((0, genSqsEndpointMiddlewares_1.genSqsEndpointMiddlewares)({ logTranslate: config.logTranslate })),
97
+ carrier: genSqsEndpointMiddlewares_1.CARRIER_SQS,
98
+ });
95
99
  };
96
100
  exports.perRecord = perRecord;
97
101
  //# sourceMappingURL=genLambdaEndpoint.forSqs.perRecord.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"genLambdaEndpoint.forSqs.perRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,mDAAkD;AAKlD,4DAAyD;AACzD,sDAAoE;AAEpE,2DAAwD;AACxD,6DAA2D;AAC3D,2EAAwE;AAMxE,mEAAgE;AAyGhE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,SAAS,GAAG,CACvB,MAAgD,EAChD,OAAgC,EACwB,EAAE;IAC1D,wFAAwF;IACxF,KAAK,OAAO,CAAC;IAEb,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,wCAAmB,CAAC;IAE9D;;;OAGG;IACH,MAAM,KAAK,GAAG,KAAK,EACjB,KAAe,EACf,aAAsB,EACP,EAAE;QACjB,qFAAqF;QACrF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,qCAAiB,EAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;QAE9D,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAEpE;;;;WAIG;QACH,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAC9B,iCAAgB,CAAC,KAAK,CACpB,6DAA6D,EAC7D;gBACE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;gBAC7B,GAAG,EAAE,yFAAyF;gBAC9F,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;aAChD,CACF,CAAC;QAEJ;;;;WAIG;QACH,IAAA,6CAAqB,EAAC;YACpB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAE;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;SAC5B,CAAC,CAAC;QAEH;;;;;;;;;;WAUG;QACH,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC;YACjC,KAAK,EAAE,OAGL;SACH,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC;QAE7C;;;;;;WAMG;QACH,MAAM,MAAM,CAAC,MAAM,CACjB;YACE,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,KAAK,EAAE,WAAW;SACnB,EACD,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,GAAG,CACrB,IAAA,qDAAyB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CACjE,CAAC;AACJ,CAAC,CAAC;AAtFW,QAAA,SAAS,aAsFpB"}
1
+ {"version":3,"file":"genLambdaEndpoint.forSqs.perRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAEhC,mDAAkD;AAMlD,kGAA+F;AAC/F,4DAAyD;AACzD,sDAAmD;AAEnD,2DAAwD;AACxD,6DAA2D;AAC3D,2EAGqC;AAMrC,mEAAgE;AAyGhE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,SAAS,GAAG,CACvB,MAAgD,EAChD,OAAgC,EACwB,EAAE;IAC1D,wFAAwF;IACxF,KAAK,OAAO,CAAC;IAEb,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,wCAAmB,CAAC;IAE9D;;;OAGG;IACH,MAAM,KAAK,G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,CACvB,IAAA,qDAAyB,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CACjE;QACD,OAAO,EAAE,uCAAW;KACrB,CAAC,CAAC;AACL,CAAC,CAAC;AAzFW,QAAA,SAAS,aAyFpB"}
@@ -1,5 +1,14 @@
1
1
  import type middy from '@middy/core';
2
+ import type { TrailCarrier } from '../../../domain.objects/TrailCarrier';
2
3
  import type { TranslateLog } from '../TranslateLog';
4
+ /**
5
+ * .what = the carrier both `forSqs` variants read: the `{ event, trail }` wrapper a test runner frames
6
+ * .why = one constant feeds the trail middleware that reads it and the stamp each variant leaves on its
7
+ * handler, so `runLambdaEndpoint` writes what the endpoint reads. aws never sends a wrapper to an
8
+ * sqs handler, so a deployed endpoint reads no trail until the `messageAttributes` lift lands
9
+ * (`domain.terms/trail-carrier.md`)
10
+ */
11
+ export declare const CARRIER_SQS: TrailCarrier;
3
12
  /**
4
13
  * .what = the observability chain both `forSqs` variants run
5
14
  * .why = the two variants differ in one respect — how they hand records to `invoke`, and what
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.genSqsEndpointMiddlewares = void 0;
3
+ exports.genSqsEndpointMiddlewares = exports.CARRIER_SQS = void 0;
4
4
  const genInternalServiceErrorMiddleware_1 = require("../middleware/genInternalServiceErrorMiddleware");
5
5
  const genIoLoggerMiddleware_1 = require("../middleware/genIoLoggerMiddleware");
6
6
  const genTrailMiddleware_1 = require("../middleware/genTrailMiddleware");
7
+ /**
8
+ * .what = the carrier both `forSqs` variants read: the `{ event, trail }` wrapper a test runner frames
9
+ * .why = one constant feeds the trail middleware that reads it and the stamp each variant leaves on its
10
+ * handler, so `runLambdaEndpoint` writes what the endpoint reads. aws never sends a wrapper to an
11
+ * sqs handler, so a deployed endpoint reads no trail until the `messageAttributes` lift lands
12
+ * (`domain.terms/trail-carrier.md`)
13
+ */
14
+ exports.CARRIER_SQS = 'wrapper';
7
15
  /**
8
16
  * .what = the observability chain both `forSqs` variants run
9
17
  * .why = the two variants differ in one respect — how they hand records to `invoke`, and what
@@ -61,7 +69,7 @@ const genSqsEndpointMiddlewares = (input) => [
61
69
  * message it does not name (`rule.forbid.failhide`)
62
70
  */
63
71
  (0, genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware)({ asOutputAfter: false }),
64
- (0, genTrailMiddleware_1.genTrailMiddleware)(),
72
+ (0, genTrailMiddleware_1.genTrailMiddleware)({ carrier: exports.CARRIER_SQS }),
65
73
  (0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: input.logTranslate }),
66
74
  ];
67
75
  exports.genSqsEndpointMiddlewares = genSqsEndpointMiddlewares;
@@ -1 +1 @@
1
- {"version":3,"file":"genSqsEndpointMiddlewares.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.ts"],"names":[],"mappings":";;;AAEA,uGAAoG;AACpG,+EAA4E;AAC5E,yEAAsE;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAEzC,EAIG,EAAE,CAAC;IACL;;;;;;;;;;;OAWG;IACH,IAAA,qEAAiC,EAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAC3D,IAAA,uCAAkB,GAAE;IACpB,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;CAC5D,CAAC;AAtBW,QAAA,yBAAyB,6BAsBpC"}
1
+ {"version":3,"file":"genSqsEndpointMiddlewares.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.ts"],"names":[],"mappings":";;;AAGA,uGAAoG;AACpG,+EAA4E;AAC5E,yEAAsE;AAGtE;;;;;;GAMG;AACU,QAAA,WAAW,GAAiB,SAAS,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAEzC,EAIG,EAAE,CAAC;IACL;;;;;;;;;;;OAWG;IACH,IAAA,qEAAiC,EAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAC3D,IAAA,uCAAkB,EAAC,EAAE,OAAO,EAAE,mBAAW,EAAE,CAAC;IAC5C,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;CAC5D,CAAC;AAtBW,QAAA,yBAAyB,6BAsBpC"}
@@ -1,17 +1,24 @@
1
1
  import type middy from '@middy/core';
2
+ import type { TrailCarrier } from '../../../domain.objects/TrailCarrier';
2
3
  /**
3
4
  * .what = middleware that extracts or generates trail context and unwraps event
4
5
  * .why = enables request correlation via trail.exid across lambda invocations
5
6
  *
6
- * payload formats:
7
- * - wrapped: { event: X, trail: { exid } } → extracts trail, unwraps to X
8
- * - raw: X → generates trail, uses X as event
7
+ * | carrier | the caller's trail + opt-in ride | present → | absent → |
8
+ * |---------|----------------------------------|-----------|----------|
9
+ * | wrapper | `{ event: X, trail: { exid } }` | unwrap to X, contemp | event as is, ancient |
10
+ * | headers | `event.headers['x-trail-exid']` | event as is, contemp | event as is, ancient |
9
11
  *
10
- * .note = the wrapped arm is the only inbound source of an `exid`, and only `askLambdaEndpoint`
11
- * sends that shape. so an api-gateway or an sqs envelope cannot match it, and both
12
- * families mint a fresh id every invoke — a trace does not cross an http or a queue
13
- * boundary (`domain.terms/trail.md`)
12
+ * .note = `headers` reads the RECONCILED bag, so a family that carries it places this entry after
13
+ * its event normalization. a `{ event, trail }` wrapper is not honored there
14
+ *
15
+ * .note = `forSqs.*` keeps the `wrapper` carrier it ran before the headers carrier existed: a test
16
+ * runner frames one, and aws never sends one, so a deployed sqs endpoint reads no trail and
17
+ * mints a fresh id. the `messageAttributes` lift is recorded as next
18
+ * (`domain.terms/trail.md`, `invariant.ancient-vs-contemp-callers.md`)
14
19
  */
15
- export declare const genTrailMiddleware: () => {
20
+ export declare const genTrailMiddleware: (input: {
21
+ carrier: TrailCarrier;
22
+ }) => {
16
23
  before: middy.MiddlewareFn<any, any>;
17
24
  };
@@ -2,27 +2,65 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.genTrailMiddleware = void 0;
4
4
  const crypto_1 = require("crypto");
5
+ const helpful_errors_1 = require("helpful-errors");
5
6
  const sdk_logs_1 = require("sdk-logs");
7
+ const getOneTrailExidFromHeaders_1 = require("../../lambdaEndpointWire/frame/getOneTrailExidFromHeaders");
8
+ const isTrailExidHeaderMalformed_1 = require("../../lambdaEndpointWire/frame/isTrailExidHeaderMalformed");
6
9
  const getUnwrappedEventWithExid_1 = require("./getUnwrappedEventWithExid");
10
+ /**
11
+ * .what = reads the trail and the opt-in off a reconciled event's headers
12
+ * .why = the header's presence IS the contemp opt-in; the event itself is never rewrapped
13
+ */
14
+ const getTrailFromHeaders = (input) => {
15
+ const exidFromPayload = (0, getOneTrailExidFromHeaders_1.getOneTrailExidFromHeaders)({
16
+ headers: input.event?.headers,
17
+ });
18
+ return {
19
+ exidFromPayload,
20
+ unwrappedEvent: input.event,
21
+ isContempCaller: exidFromPayload !== null,
22
+ };
23
+ };
24
+ /**
25
+ * .what = reads the caller's trail, the opt-in, and the event, from the carrier a family declares
26
+ * .why = one place picks the read per carrier, so the middleware body stays one narrative
27
+ */
28
+ const getTrailFromCarrier = (input) => {
29
+ switch (input.carrier) {
30
+ case 'headers':
31
+ return getTrailFromHeaders({ event: input.event });
32
+ case 'wrapper':
33
+ return (0, getUnwrappedEventWithExid_1.getUnwrappedEventWithExid)({ payload: input.event });
34
+ default: {
35
+ // a carrier added to the type and not handled here fails to compile at this line
36
+ const carrierUnhandled = input.carrier;
37
+ return helpful_errors_1.MalfunctionError.throw('the trail carrier is not one this reads', {
38
+ carrier: carrierUnhandled,
39
+ });
40
+ }
41
+ }
42
+ };
7
43
  /**
8
44
  * .what = middleware that extracts or generates trail context and unwraps event
9
45
  * .why = enables request correlation via trail.exid across lambda invocations
10
46
  *
11
- * payload formats:
12
- * - wrapped: { event: X, trail: { exid } } → extracts trail, unwraps to X
13
- * - raw: X → generates trail, uses X as event
47
+ * | carrier | the caller's trail + opt-in ride | present → | absent → |
48
+ * |---------|----------------------------------|-----------|----------|
49
+ * | wrapper | `{ event: X, trail: { exid } }` | unwrap to X, contemp | event as is, ancient |
50
+ * | headers | `event.headers['x-trail-exid']` | event as is, contemp | event as is, ancient |
14
51
  *
15
- * .note = the wrapped arm is the only inbound source of an `exid`, and only `askLambdaEndpoint`
16
- * sends that shape. so an api-gateway or an sqs envelope cannot match it, and both
17
- * families mint a fresh id every invoke — a trace does not cross an http or a queue
18
- * boundary (`domain.terms/trail.md`)
52
+ * .note = `headers` reads the RECONCILED bag, so a family that carries it places this entry after
53
+ * its event normalization. a `{ event, trail }` wrapper is not honored there
54
+ *
55
+ * .note = `forSqs.*` keeps the `wrapper` carrier it ran before the headers carrier existed: a test
56
+ * runner frames one, and aws never sends one, so a deployed sqs endpoint reads no trail and
57
+ * mints a fresh id. the `messageAttributes` lift is recorded as next
58
+ * (`domain.terms/trail.md`, `invariant.ancient-vs-contemp-callers.md`)
19
59
  */
20
- const genTrailMiddleware = () => {
60
+ const genTrailMiddleware = (input) => {
21
61
  const before = async (request) => {
22
- // detect payload format and extract trail + event
23
- const { exidFromPayload, unwrappedEvent, isContempCaller } = (0, getUnwrappedEventWithExid_1.getUnwrappedEventWithExid)({
24
- payload: request.event,
25
- });
62
+ // read the caller's trail + event off the carrier the family declares
63
+ const { exidFromPayload, unwrappedEvent, isContempCaller } = getTrailFromCarrier({ carrier: input.carrier, event: request.event });
26
64
  // generate exid if not provided
27
65
  const exid = exidFromPayload ?? `exid:${(0, crypto_1.randomUUID)()}`;
28
66
  // create trail
@@ -35,6 +73,13 @@ const genTrailMiddleware = () => {
35
73
  trail,
36
74
  env: null,
37
75
  });
76
+ // a malformed opt-in header reads as absent, so say so: the caller is answered ancient and its trace
77
+ // does not join. the length is logged, never the text, since the value came from a public caller
78
+ if (input.carrier === 'headers' &&
79
+ (0, isTrailExidHeaderMalformed_1.isTrailExidHeaderMalformed)({ headers: request.event?.headers }))
80
+ contextLogTrail.log.debug('trail.exid.header.rejected', {
81
+ length: String(request.event?.headers?.['x-trail-exid']).length,
82
+ });
38
83
  // unwrap event (if wrapped format)
39
84
  // .note = DELIBERATE MUTATION — `request` is middy's only channel to hand a value onward
40
85
  request.event = unwrappedEvent;
@@ -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;;;;;;;;;;;;GAYG;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
+ {"version":3,"file":"genTrailMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AACpC,mDAAkD;AAClD,uCAIkB;AAGlB,0GAAuG;AACvG,0GAAuG;AACvG,2EAAwE;AAExE;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAE1B,KAED,EAIC,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,uDAA0B,EAAC;QACjD,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO;KAC9B,CAAC,CAAC;IACH,OAAO;QACL,eAAe;QACf,cAAc,EAAE,KAAK,CAAC,KAAK;QAC3B,eAAe,EAAE,eAAe,KAAK,IAAI;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAAC,KAG5B,EAIC,EAAE;IACF,QAAQ,KAAK,CAAC,OAAO,EAAE,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACrD,KAAK,SAAS;YACZ,OAAO,IAAA,qDAAyB,EAAC,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,CAAC,CAAC;YACR,iFAAiF;YACjF,MAAM,gBAAgB,GAAU,KAAK,CAAC,OAAO,CAAC;YAC9C,OAAO,iCAAgB,CAAC,KAAK,CAAC,yCAAyC,EAAE;gBACvE,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CA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AAC,GAAG;YACxB,eAAe;SAE+B,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAjEW,QAAA,kBAAkB,sBAiE7B"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getIsConstraintError = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
+ const getIsFrozenMutatorRefusal_1 = require("./getIsFrozenMutatorRefusal");
5
6
  /**
6
7
  * .what = decides if error is a constraint error via thorough check
7
8
  * .why = robust detection for cross-boundary error response
@@ -15,6 +16,9 @@ const getIsConstraintError = (input) => {
15
16
  // not an error at all
16
17
  if (!(error instanceof Error))
17
18
  return false;
19
+ // the invoke freeze's refusal is a handler defect, never a caller fault, though it wears the class
20
+ if ((0, getIsFrozenMutatorRefusal_1.getIsFrozenMutatorRefusal)({ error }))
21
+ return false;
18
22
  // direct instanceof check (ConstraintError and BadRequestError for backwards compat)
19
23
  if (error instanceof helpful_errors_1.ConstraintError)
20
24
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"getIsConstraintError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAElE;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAyB,EAAW,EAAE;IACzE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,sBAAsB;IACtB,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE5C,qFAAqF;IACrF,IAAI,KAAK,YAAY,gCAAe;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,KAAK,YAAY,gCAAe;QAAE,OAAO,IAAI,CAAC;IAElD,kDAAkD;IAClD,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAElD,wEAAwE;IACxE,IACE,wCAAwC,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;KACpC,CAAC;QAEF,OAAO,IAAI,CAAC;IAEd,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAvBW,QAAA,oBAAoB,wBAuB/B;AAEF;;;;;GAKG;AACH,MAAM,wCAAwC,GAAG,CAAC,KAEjD,EAAW,EAAE;IACZ,MAAM,KAAK,GAAG,KAAK,CAAC,KAAmD,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC/D,OAAO,wCAAwC,CAAC;QAC9C,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;KACpC,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"getIsConstraintError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAElE,2EAAwE;AAExE;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAyB,EAAW,EAAE;IACzE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,sBAAsB;IACtB,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE5C,mGAAmG;IACnG,IAAI,IAAA,qDAAyB,EAAC,EAAE,KAAK,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IAEvD,qFAAqF;IACrF,IAAI,KAAK,YAAY,gCAAe;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,KAAK,YAAY,gCAAe;QAAE,OAAO,IAAI,CAAC;IAElD,kDAAkD;IAClD,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAElD,wEAAwE;IACxE,IACE,wCAAwC,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;KACpC,CAAC;QAEF,OAAO,IAAI,CAAC;IAEd,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA1BW,QAAA,oBAAoB,wBA0B/B;AAEF;;;;;GAKG;AACH,MAAM,wCAAwC,GAAG,CAAC,KAEjD,EAAW,EAAE;IACZ,MAAM,KAAK,GAAG,KAAK,CAAC,KAAmD,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC/D,OAAO,wCAAwC,CAAC;QAC9C,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;KACpC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * .what = decides if an error is the invoke freeze's refusal of a mutator call
3
+ * .why = the freeze (`asFrozenDeep`, via `setEventFrozen`) replaces each mutator of a frozen `Date`,
4
+ * `Map`, `Set`, `WeakMap`, `WeakSet`, `DataView`, `RegExp`, or `ArrayBuffer` with a thrower,
5
+ * and that thrower raises a `ConstraintError`. at type-fns' boundary that is correct — its
6
+ * caller misused the value. at this sdk's boundary its caller is the HANDLER, so the refusal
7
+ * is a server fault: the lambda's caller sent a valid request and must never be told
8
+ * otherwise (`invariant.badrequesterror-not-lambda-error`)
9
+ *
10
+ * .note = matched by shape, never by class: type-fns throws a plain `ConstraintError` with no
11
+ * subclass of its own, and it may load a separate `helpful-errors` instance. the shape is
12
+ * the metadata it stamps (`{ kind, mutator }`) plus a message that names that mutator, so a
13
+ * handler's own `ConstraintError` with a coincident key does not match
14
+ */
15
+ export declare const getIsFrozenMutatorRefusal: (input: {
16
+ error: unknown;
17
+ }) => boolean;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIsFrozenMutatorRefusal = void 0;
4
+ /**
5
+ * .what = decides if an error is the invoke freeze's refusal of a mutator call
6
+ * .why = the freeze (`asFrozenDeep`, via `setEventFrozen`) replaces each mutator of a frozen `Date`,
7
+ * `Map`, `Set`, `WeakMap`, `WeakSet`, `DataView`, `RegExp`, or `ArrayBuffer` with a thrower,
8
+ * and that thrower raises a `ConstraintError`. at type-fns' boundary that is correct — its
9
+ * caller misused the value. at this sdk's boundary its caller is the HANDLER, so the refusal
10
+ * is a server fault: the lambda's caller sent a valid request and must never be told
11
+ * otherwise (`invariant.badrequesterror-not-lambda-error`)
12
+ *
13
+ * .note = matched by shape, never by class: type-fns throws a plain `ConstraintError` with no
14
+ * subclass of its own, and it may load a separate `helpful-errors` instance. the shape is
15
+ * the metadata it stamps (`{ kind, mutator }`) plus a message that names that mutator, so a
16
+ * handler's own `ConstraintError` with a coincident key does not match
17
+ */
18
+ const getIsFrozenMutatorRefusal = (input) => {
19
+ // not an error at all
20
+ if (!(input.error instanceof Error))
21
+ return false;
22
+ // the refusal stamps `{ kind, mutator }`, both strings
23
+ const metadata = input.error.metadata;
24
+ if (typeof metadata?.kind !== 'string')
25
+ return false;
26
+ if (typeof metadata?.mutator !== 'string')
27
+ return false;
28
+ // and its message names that kind and that mutator
29
+ return input.error.message.includes(`a frozen ${metadata.kind} refuses .${metadata.mutator}()`);
30
+ };
31
+ exports.getIsFrozenMutatorRefusal = getIsFrozenMutatorRefusal;
32
+ //# sourceMappingURL=getIsFrozenMutatorRefusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIsFrozenMutatorRefusal.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAEzC,EAAW,EAAE;IACZ,sBAAsB;IACtB,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAElD,uDAAuD;IACvD,MAAM,QAAQ,GAAI,KAAK,CAAC,KAAgC,CAAC,QAE5C,CAAC;IACd,IAAI,OAAO,QAAQ,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,OAAO,QAAQ,EAAE,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAExD,mDAAmD;IACnD,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CACjC,YAAY,QAAQ,CAAC,IAAI,aAAa,QAAQ,CAAC,OAAO,IAAI,CAC3D,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,yBAAyB,6BAiBpC"}
@@ -1,24 +1,6 @@
1
+ import { type FrozenDeep } from 'type-fns';
1
2
  /**
2
- * .what = the type of what `setEventFrozen` produces — readonly all the way down
3
- * .why = typescript's own `Readonly<T>` is shallow, so it refuses `event.x = 1` and allows
4
- * `event.headers.x = 1`. the runtime freeze below is deep, so the two would disagree: a
5
- * write one level in type-checks cleanly and then throws a `TypeError` in production,
6
- * which turns a well-typed handler into a 500
7
- * .why here = it is named for the mechanism it types (`setFrozenDeep`), so the contract and its
8
- * enforcement sit in one file and cannot drift apart
9
- *
10
- * .note = a function passes through unmapped. `Object.freeze` does freeze a function, but to map
11
- * over one would discard its call signature — and no field of this envelope is a
12
- * function, so the arm is free and it guards the general case
13
- * .note = `readonly` is a compile-time refusal only; it erases at runtime. the freeze is what
14
- * enforces it, and this type is what announces it — neither replaces the other
15
- * (`rule.prefer.prevent-over-correct`: refuse it at rung 1, report it at rung 4)
16
- */
17
- export type FrozenDeep<T> = T extends (...args: never[]) => unknown ? T : T extends ReadonlyArray<infer TItem> ? ReadonlyArray<FrozenDeep<TItem>> : T extends object ? {
18
- readonly [TKey in keyof T]: FrozenDeep<T[TKey]>;
19
- } : T;
20
- /**
21
- * .what = seals the envelope before `invoke` receives it
3
+ * .what = seals the envelope before `invoke` receives it, in place, typed `FrozenDeep`
22
4
  * .why = the envelope outlives the handler's turn, so a write through it corrupts a value
23
5
  * somebody else reads after `invoke` returns — with no type error and no throw. the freeze
24
6
  * makes that unrepresentable
@@ -31,47 +13,27 @@ export type FrozenDeep<T> = T extends (...args: never[]) => unknown ? T : T exte
31
13
  * property of today, so a rule keyed to one expires silently the first commit that adds a
32
14
  * post-invoke read (`rule.require.frozen-invoke-inputs`)
33
15
  *
34
- * .why the cost is paid on purpose = `FrozenDeep<TInput>` makes `event` unassignable to every
35
- * mutable parameter a handler forwards it to, so a handler must declare its sinks
36
- * readonly. a guarantee that holds on three variants of four is a trap for whoever moves
37
- * between them
38
- *
39
- * .where = the family root rather than inside `forApiGateway`, because two variants of one family
40
- * reach for it. lifted on the second use (`rule.prefer.most-common-denominator`)
16
+ * .why type-fns' `asFrozenDeep` = the type and the runtime come from one package, so they cannot
17
+ * drift: what `FrozenDeep` refuses at compile time, `asFrozenDeep` refuses at run time. that
18
+ * includes the state a bare `Object.freeze` cannot reach — a `Date`, `Map`, `Set`, `WeakMap`,
19
+ * or `WeakSet` has its mutators replaced by throwers, and the walk reaches symbol keys and
20
+ * non-enumerable own props
41
21
  *
22
+ * .note = in place, deliberately. `asFrozenDeep` returns the same reference, so
23
+ * `headers === event.headers` holds and the bag cannot drift from the envelope it projects
24
+ * (`domain.terms/event.md`). a defensive copy would remove the hazard and break the projection
42
25
  * .note = the projections freeze with it, by design: `headers`, `payload`, and `records` are the
43
- * envelope's own slots, so a handler mutates none (`domain.terms/event.md`)
26
+ * envelope's own slots, so a handler mutates none
44
27
  * .note = `forSqs.perBatch`'s harm is the sharpest, and `[case17]` walks it end to end: a handler
45
28
  * that forges `event.records[n].id` would rewrite the set the unknown-id guard checks
46
- * against, so the guard passes and sqs is answered with an `itemIdentifier` it cannot
47
- * match — the message the author meant to save is deleted, on a successful invocation
48
- *
49
- * .why a `WeakSet` = an envelope and its `_.raw` share sub-objects, so each is reachable by two
50
- * paths and would otherwise be walked twice. measured in both families:
51
- *
52
- * apiGateway -> `queryStringParameters` and `pathParameters` pass by reference
53
- * (`asApiGatewayRequestEventUnified.ts:68-69`)
54
- * sqs -> `wire.Records[n]` is reachable as `event._.raw.Records[n]` and as
55
- * `event.records[n]._.raw` (`asSqsEventDecoded.ts:37`,
56
- * `asSqsRecordDecoded.ts:94`)
57
- *
58
- * it is not a cycle guard. no cycle is reachable from this event — `requestContext` is an
59
- * explicit four-field copy of primitives and `headers` is a new object — though the set
60
- * would terminate one a later author introduced
61
- *
62
- * .note = a frozen write throws in strict mode and no-ops in sloppy mode. every module this sdk
63
- * ships is an es module, which is strict by construction, so the throw is the behavior a
64
- * consumer meets (ecma-262 §11.2.2)
65
- * .note = the throw's message is terse — node raises a bare `TypeError: Cannot assign to read
66
- * only property …`, which names no cause and no remedy. `Object.freeze` accepts no
67
- * message, and the only mechanism that could supply one is a `Proxy` — a different
68
- * object, so `headers === event.headers` would stop to hold. the remedy is prevention
69
- * instead: `FrozenDeep` refuses the write at compile time, so a type-checked consumer
70
- * never reaches the message (`rule.prefer.prevent-over-correct`)
71
- *
72
- * .why it returns = the same reference, narrowed to `FrozenDeep`. it still freezes in place — the
73
- * return is the type half of one act, so a caller receives the guarantee from the step
74
- * that establishes it rather than asserts it by hand at the hand-off
29
+ * against, so sqs is answered with an `itemIdentifier` it cannot match
30
+ *
31
+ * .why a refusal is a `MalfunctionError` = `asFrozenDeep` refuses, all or none and before any
32
+ * freeze, a value it cannot seal: a typed array that holds bytes, a global or sticky
33
+ * `RegExp`. `JSON.parse` yields neither, so one reaches the envelope only when the handler's
34
+ * own schema builds it. that is a server fault, never the caller's, so it must not ride the
35
+ * caller-fault path a bare `ConstraintError` would take (`getIsConstraintError`). the
36
+ * type-fns refusal rides as `cause`, so its `path` and `hint` still name the fix
75
37
  */
76
38
  export declare const setEventFrozen: <TEvent>(input: {
77
39
  event: TEvent;