sdk-aws-lambda 0.7.1 → 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 (110) 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/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.d.ts +12 -0
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js +27 -0
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js.map +1 -0
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +3 -0
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +32 -7
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js +22 -0
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -1
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +13 -2
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +5 -1
  53. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -1
  54. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +5 -1
  55. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
  56. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +9 -0
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +10 -2
  58. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -1
  59. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +15 -8
  60. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +57 -12
  61. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  62. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.d.ts +11 -0
  63. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js +13 -0
  64. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js.map +1 -0
  65. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.d.ts +23 -0
  66. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js +32 -0
  67. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js.map +1 -0
  68. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.d.ts +20 -0
  69. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js +23 -0
  70. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js.map +1 -0
  71. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.d.ts +9 -0
  72. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js +19 -0
  73. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js.map +1 -0
  74. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.d.ts +16 -0
  75. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js +24 -0
  76. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js.map +1 -0
  77. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.d.ts +9 -0
  78. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js +15 -0
  79. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js.map +1 -0
  80. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.d.ts +19 -0
  81. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js +27 -0
  82. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js.map +1 -0
  83. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.d.ts +11 -0
  84. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js +21 -0
  85. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js.map +1 -0
  86. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.d.ts +21 -0
  87. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js +27 -0
  88. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js.map +1 -0
  89. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.d.ts +24 -0
  90. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js +28 -0
  91. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js.map +1 -0
  92. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +7 -0
  93. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +18 -2
  94. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -1
  95. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +43 -7
  96. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
  97. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.d.ts +35 -0
  98. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js +81 -0
  99. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js.map +1 -0
  100. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.d.ts +14 -0
  101. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js +18 -0
  102. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js.map +1 -0
  103. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.d.ts +17 -0
  104. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js +19 -0
  105. package/dist/domain.operations/runLambdaEndpoint/serde/isEventWithHeaders.js.map +1 -0
  106. package/dist/index.d.ts +8 -1
  107. package/dist/index.js +10 -2
  108. package/dist/index.js.map +1 -1
  109. package/package.json +6 -6
  110. package/readme.md +43 -1
@@ -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;AAMlD,4DAAyD;AACzD,sDAAmD;AAEnD,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,MAAM,KAAK,GAAG,KAAK,EACjB,KAAe,EACf,aAAsB,EACK,EAAE;QAC7B,gDAAgD;QAChD,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,iFAAiF;QACjF,MAAM,gBAAgB,GAGf,EAAE,CAAC;QACV,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,gBAAgB,CAAC,IAAI,CACnB,IAAA,6CAAqB,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAC/D,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;oBAAE,MAAM,KAAK,CAAC;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AE,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,mDAAkD;AAMlD,kGAA+F;AAC/F,4DAAyD;AACzD,sDAAmD;AAEnD,2DAAwD;AACxD,6DAA2D;AAC3D,2EAGqC;AAOrC,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,MAAM,KAAK,GAAG,KAAK,EACjB,KAAe,EACf,aAAsB,EACK,EAAE;QAC7B,gDAAgD;QAChD,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,iFAAiF;QACjF,MAAM,gBAAgB,GAGf,EAAE,CAAC;QACV,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,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,+CAAsB,EAAC;QAC5B,OAAO,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"}
@@ -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;AAMlD,4DAAyD;AACzD,sDAAmD;AAEnD,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;;;;;;;;;;;;;;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7B,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,KAAK,EAAE,WAAW;SACnB,EACD,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAA,+CAAsB,EAAC;QAC5B,OAAO,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;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,E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,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;AAjEW,QAAA,kBAAkB,sBAiE7B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * .what = casts a headers bag into the same bag with every case variant of one key dropped
3
+ * .why = http field names are case-insensitive (rfc 9110 §5.1), so `X-Trail-Exid` and `x-trail-exid`
4
+ * are one header. a bag that holds both, merged into a `Headers`, joins them as `a, b`, and the
5
+ * endpoint reads the join as the exid. the caller's variant is dropped before the sdk writes its own,
6
+ * so the sdk's key is the only one on the wire
7
+ */
8
+ export declare const asHeadersWithoutKey: <TValue>(input: {
9
+ headers: Record<string, TValue> | null | undefined;
10
+ key: string;
11
+ }) => Record<string, TValue>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asHeadersWithoutKey = void 0;
4
+ /**
5
+ * .what = casts a headers bag into the same bag with every case variant of one key dropped
6
+ * .why = http field names are case-insensitive (rfc 9110 §5.1), so `X-Trail-Exid` and `x-trail-exid`
7
+ * are one header. a bag that holds both, merged into a `Headers`, joins them as `a, b`, and the
8
+ * endpoint reads the join as the exid. the caller's variant is dropped before the sdk writes its own,
9
+ * so the sdk's key is the only one on the wire
10
+ */
11
+ const asHeadersWithoutKey = (input) => Object.fromEntries(Object.entries(input.headers ?? {}).filter(([name]) => name.toLowerCase() !== input.key.toLowerCase()));
12
+ exports.asHeadersWithoutKey = asHeadersWithoutKey;
13
+ //# sourceMappingURL=asHeadersWithoutKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asHeadersWithoutKey.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,mBAAmB,GAAG,CAAS,KAG3C,EAA0B,EAAE,CAC3B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CACxC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,CAC3D,CACF,CAAC;AARS,QAAA,mBAAmB,uBAQ5B"}
@@ -0,0 +1,23 @@
1
+ import { TRAIL_EXID_HEADER } from '../../../domain.objects/TrailExidHeader';
2
+ /**
3
+ * .what = casts a trail into the http headers that opt a request into the contemp dialect
4
+ * .why = an api gateway event is built by aws, so no caller can wrap it in `{ event, trail }`.
5
+ * the opt-in rides the request's own `headers` instead. any http client spreads this in
6
+ * (`domain.terms/x-trail-exid.md`, `invariant.ancient-vs-contemp-callers.md`)
7
+ *
8
+ * .note = the sender always supplies a well-formed exid: 1 to 128 printable ascii characters. the
9
+ * endpoint reads any other value as ABSENT, so the request would silently stay ancient —
10
+ * refused here instead, loudly
11
+ *
12
+ * .usage = `fetch(url, { headers: { ...asTrailExidHeaders({ trail: { exid } }) } })`
13
+ *
14
+ * .note = the usage is prose on purpose. a docblock example tag is a promise the advertised-examples
15
+ * sweep runs verbatim, and a snippet that needs a live url cannot keep it
16
+ */
17
+ export declare const asTrailExidHeaders: (input: {
18
+ trail: {
19
+ exid: string;
20
+ };
21
+ }) => {
22
+ [TRAIL_EXID_HEADER]: string;
23
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asTrailExidHeaders = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
6
+ const isTrailExid_1 = require("./isTrailExid");
7
+ /**
8
+ * .what = casts a trail into the http headers that opt a request into the contemp dialect
9
+ * .why = an api gateway event is built by aws, so no caller can wrap it in `{ event, trail }`.
10
+ * the opt-in rides the request's own `headers` instead. any http client spreads this in
11
+ * (`domain.terms/x-trail-exid.md`, `invariant.ancient-vs-contemp-callers.md`)
12
+ *
13
+ * .note = the sender always supplies a well-formed exid: 1 to 128 printable ascii characters. the
14
+ * endpoint reads any other value as ABSENT, so the request would silently stay ancient —
15
+ * refused here instead, loudly
16
+ *
17
+ * .usage = `fetch(url, { headers: { ...asTrailExidHeaders({ trail: { exid } }) } })`
18
+ *
19
+ * .note = the usage is prose on purpose. a docblock example tag is a promise the advertised-examples
20
+ * sweep runs verbatim, and a snippet that needs a live url cannot keep it
21
+ */
22
+ const asTrailExidHeaders = (input) => {
23
+ // an exid the endpoint would read as absent would opt out in silence
24
+ if (!isTrailExid_1.isTrailExid.assess(input.trail.exid))
25
+ helpful_errors_1.ConstraintError.throw('trail.exid is not a well-formed exid, so the request would carry no opt-in', {
26
+ trail: input.trail,
27
+ hint: `supply the exid of the invoke that makes this call: 1 to ${isTrailExid_1.TRAIL_EXID_LENGTH_MAX} printable ascii characters`,
28
+ });
29
+ return { [TrailExidHeader_1.TRAIL_EXID_HEADER]: input.trail.exid };
30
+ };
31
+ exports.asTrailExidHeaders = asTrailExidHeaders;
32
+ //# sourceMappingURL=asTrailExidHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asTrailExidHeaders.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD,6EAA4E;AAC5E,+CAAmE;AAEnE;;;;;;;;;;;;;;GAcG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAAmC,EAAE;IACpC,qEAAqE;IACrE,IAAI,CAAC,yBAAW,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;QACvC,gCAAe,CAAC,KAAK,CACnB,4EAA4E,EAC5E;YACE,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,4DAA4D,mCAAqB,6BAA6B;SACrH,CACF,CAAC;IAEJ,OAAO,EAAE,CAAC,mCAAiB,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC,CAAC;AAdW,QAAA,kBAAkB,sBAc7B"}
@@ -0,0 +1,20 @@
1
+ import type { TrailCarrier } from '../../../domain.objects/TrailCarrier';
2
+ /**
3
+ * .what = which carrier an event's caller must put its trail and contemp opt-in in
4
+ * .why = an event the builder declared as api gateway is built by aws in prod, so no caller can wrap
5
+ * it; its opt-in rides the request's `headers`. every other event keeps the `{ event, trail }`
6
+ * wrapper (`invariant.ancient-vs-contemp-callers.md`)
7
+ *
8
+ * .note = the declaration is the builder's alone. an event's own contents never choose its carrier:
9
+ * an event cannot know which family receives it, and a forwarded request that happens to hold
10
+ * an `x-trail-exid` header is a valid payload for a direct invoke
11
+ * .note = this is the fallback. where the runner holds the handler (`onReferenced`, and the local locus
12
+ * of `onSerialized`) the handler's own declaration decides first (`getOneTrailCarrierOfHandler`),
13
+ * so a copy of a built event is framed for the family that receives it. the event's mark is the
14
+ * only declaration at the cloud locus, which holds no handler
15
+ * .note = both run boundaries (`onReferenced`, and `onSerialized` at cloud) pick the carrier here, so
16
+ * the two cannot disagree. read it BEFORE the json strip, which drops the declaration
17
+ */
18
+ export declare const getOneTrailCarrierOfEvent: (input: {
19
+ event: unknown;
20
+ }) => TrailCarrier;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOneTrailCarrierOfEvent = void 0;
4
+ const isEventDeclaredAsApiGateway_1 = require("./isEventDeclaredAsApiGateway");
5
+ /**
6
+ * .what = which carrier an event's caller must put its trail and contemp opt-in in
7
+ * .why = an event the builder declared as api gateway is built by aws in prod, so no caller can wrap
8
+ * it; its opt-in rides the request's `headers`. every other event keeps the `{ event, trail }`
9
+ * wrapper (`invariant.ancient-vs-contemp-callers.md`)
10
+ *
11
+ * .note = the declaration is the builder's alone. an event's own contents never choose its carrier:
12
+ * an event cannot know which family receives it, and a forwarded request that happens to hold
13
+ * an `x-trail-exid` header is a valid payload for a direct invoke
14
+ * .note = this is the fallback. where the runner holds the handler (`onReferenced`, and the local locus
15
+ * of `onSerialized`) the handler's own declaration decides first (`getOneTrailCarrierOfHandler`),
16
+ * so a copy of a built event is framed for the family that receives it. the event's mark is the
17
+ * only declaration at the cloud locus, which holds no handler
18
+ * .note = both run boundaries (`onReferenced`, and `onSerialized` at cloud) pick the carrier here, so
19
+ * the two cannot disagree. read it BEFORE the json strip, which drops the declaration
20
+ */
21
+ const getOneTrailCarrierOfEvent = (input) => (0, isEventDeclaredAsApiGateway_1.isEventDeclaredAsApiGateway)({ event: input.event }) ? 'headers' : 'wrapper';
22
+ exports.getOneTrailCarrierOfEvent = getOneTrailCarrierOfEvent;
23
+ //# sourceMappingURL=getOneTrailCarrierOfEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneTrailCarrierOfEvent.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.ts"],"names":[],"mappings":";;;AACA,+EAA4E;AAE5E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAEzC,EAAgB,EAAE,CACjB,IAAA,yDAA2B,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAHjE,QAAA,yBAAyB,6BAGwC"}
@@ -0,0 +1,9 @@
1
+ import type { TrailCarrier } from '../../../domain.objects/TrailCarrier';
2
+ /**
3
+ * .what = the carrier a handler declares, or null for a handler that declares none
4
+ * .why = a plain lambda handler (an unmigrated `createStandardHandler`) is built by no `genLambdaEndpoint`
5
+ * family, so it declares none, and the caller falls back to the event's own declaration
6
+ */
7
+ export declare const getOneTrailCarrierOfHandler: (input: {
8
+ handler: unknown;
9
+ }) => TrailCarrier | null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOneTrailCarrierOfHandler = void 0;
4
+ const setHandlerTrailCarrier_1 = require("./setHandlerTrailCarrier");
5
+ /**
6
+ * .what = the carrier a handler declares, or null for a handler that declares none
7
+ * .why = a plain lambda handler (an unmigrated `createStandardHandler`) is built by no `genLambdaEndpoint`
8
+ * family, so it declares none, and the caller falls back to the event's own declaration
9
+ */
10
+ const getOneTrailCarrierOfHandler = (input) => {
11
+ if (typeof input.handler !== 'function')
12
+ return null;
13
+ const carrier = Reflect.get(input.handler, setHandlerTrailCarrier_1.HANDLER_TRAIL_CARRIER);
14
+ if (carrier === 'wrapper' || carrier === 'headers')
15
+ return carrier;
16
+ return null;
17
+ };
18
+ exports.getOneTrailCarrierOfHandler = getOneTrailCarrierOfHandler;
19
+ //# sourceMappingURL=getOneTrailCarrierOfHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneTrailCarrierOfHandler.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.ts"],"names":[],"mappings":";;;AACA,qEAAiE;AAEjE;;;;GAIG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAE3C,EAAuB,EAAE;IACxB,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IACrD,MAAM,OAAO,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,8CAAqB,CAAC,CAAC;IAC3E,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACnE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPW,QAAA,2BAA2B,+BAOtC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * .what = reads the caller's exid out of a headers bag, or null when the bag carries none
3
+ * .why = the exid's presence IS the contemp opt-in at an aws-delivered family
4
+ * (`invariant.ancient-vs-contemp-callers.md`)
5
+ *
6
+ * .note = a value that is not a well-formed exid (empty, past the length bound, or with a control
7
+ * character) reads as ABSENT, so a public caller cannot place unbounded or forged text in the
8
+ * sdk's logs and responses. the request then reads as ancient, with a fresh exid
9
+ * .note = exactly one key is read — no generic correlation header (`x-amzn-trace-id`, `traceparent`,
10
+ * `x-request-id`) ever opts a caller in, since a proxy that forwards one must not flip an
11
+ * error body (`domain.terms/x-trail-exid.md`)
12
+ * .note = the bag's keys are lowercase by now — event normalization folds them (`headers.md`)
13
+ */
14
+ export declare const getOneTrailExidFromHeaders: (input: {
15
+ headers: Record<string, string | undefined> | null | undefined;
16
+ }) => string | null;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOneTrailExidFromHeaders = void 0;
4
+ const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
5
+ const isTrailExid_1 = require("./isTrailExid");
6
+ /**
7
+ * .what = reads the caller's exid out of a headers bag, or null when the bag carries none
8
+ * .why = the exid's presence IS the contemp opt-in at an aws-delivered family
9
+ * (`invariant.ancient-vs-contemp-callers.md`)
10
+ *
11
+ * .note = a value that is not a well-formed exid (empty, past the length bound, or with a control
12
+ * character) reads as ABSENT, so a public caller cannot place unbounded or forged text in the
13
+ * sdk's logs and responses. the request then reads as ancient, with a fresh exid
14
+ * .note = exactly one key is read — no generic correlation header (`x-amzn-trace-id`, `traceparent`,
15
+ * `x-request-id`) ever opts a caller in, since a proxy that forwards one must not flip an
16
+ * error body (`domain.terms/x-trail-exid.md`)
17
+ * .note = the bag's keys are lowercase by now — event normalization folds them (`headers.md`)
18
+ */
19
+ const getOneTrailExidFromHeaders = (input) => {
20
+ const value = input.headers?.[TrailExidHeader_1.TRAIL_EXID_HEADER];
21
+ return isTrailExid_1.isTrailExid.assess(value) ? value : null;
22
+ };
23
+ exports.getOneTrailExidFromHeaders = getOneTrailExidFromHeaders;
24
+ //# sourceMappingURL=getOneTrailExidFromHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneTrailExidFromHeaders.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.ts"],"names":[],"mappings":";;;AAAA,6EAA4E;AAC5E,+CAA4C;AAE5C;;;;;;;;;;;;GAYG;AACI,MAAM,0BAA0B,GAAG,CAAC,KAE1C,EAAiB,EAAE;IAClB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,mCAAiB,CAAC,CAAC;IACjD,OAAO,yBAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * .what = whether an event carries the api gateway declaration
3
+ * .why = the carrier follows the declaration, never the event's shape
4
+ * (`invariant.ancient-vs-contemp-callers.md`). an event built by hand, or spread from a
5
+ * declared one, is undeclared and keeps the `{ event, trail }` wrapper
6
+ */
7
+ export declare const isEventDeclaredAsApiGateway: (input: {
8
+ event: unknown;
9
+ }) => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEventDeclaredAsApiGateway = void 0;
4
+ const setEventDeclaredAsApiGateway_1 = require("./setEventDeclaredAsApiGateway");
5
+ /**
6
+ * .what = whether an event carries the api gateway declaration
7
+ * .why = the carrier follows the declaration, never the event's shape
8
+ * (`invariant.ancient-vs-contemp-callers.md`). an event built by hand, or spread from a
9
+ * declared one, is undeclared and keeps the `{ event, trail }` wrapper
10
+ */
11
+ const isEventDeclaredAsApiGateway = (input) => typeof input.event === 'object' &&
12
+ input.event !== null &&
13
+ Reflect.get(input.event, setEventDeclaredAsApiGateway_1.EVENT_DECLARED_AS_API_GATEWAY) === true;
14
+ exports.isEventDeclaredAsApiGateway = isEventDeclaredAsApiGateway;
15
+ //# sourceMappingURL=isEventDeclaredAsApiGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isEventDeclaredAsApiGateway.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.ts"],"names":[],"mappings":";;;AAAA,iFAA+E;AAE/E;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAE3C,EAAW,EAAE,CACZ,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;IAC/B,KAAK,CAAC,KAAK,KAAK,IAAI;IACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,4DAA6B,CAAC,KAAK,IAAI,CAAC;AALtD,QAAA,2BAA2B,+BAK2B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * .what = the longest exid the sdk accepts from, or writes to, a header
3
+ * .why = an exid is a correlation key, not a payload. the form the sdk mints is `exid:<uuid>`, 41
4
+ * characters, so 128 leaves room for a request id or a prefixed trace without a header that
5
+ * can hold a page of text
6
+ */
7
+ export declare const TRAIL_EXID_LENGTH_MAX = 128;
8
+ /**
9
+ * .what = whether a value is a well-formed trail exid: a string of 1 to 128 printable ascii characters
10
+ * .why = `x-trail-exid` is the first value a public caller can place in this sdk's logs, in every 500's
11
+ * `correlationId`, and in the trail of every downstream call. a caller who sends a page of text,
12
+ * or a control character, would write it all into those places. a bounded printable value cannot
13
+ * forge a log line or grow a header without limit (`domain.terms/x-trail-exid.md`)
14
+ *
15
+ * .note = printable ascii is U+0020 to U+007E. a space is allowed inside the value, never at an end: http
16
+ * trims the ends of a header value, so a padded exid would read differently at each side of the
17
+ * wire and the trace would not join. a tab, a newline, and every control character are not allowed
18
+ */
19
+ export declare const isTrailExid: import("type-fns").AssessWithAssure<unknown, string>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTrailExid = exports.TRAIL_EXID_LENGTH_MAX = void 0;
4
+ const type_fns_1 = require("type-fns");
5
+ /**
6
+ * .what = the longest exid the sdk accepts from, or writes to, a header
7
+ * .why = an exid is a correlation key, not a payload. the form the sdk mints is `exid:<uuid>`, 41
8
+ * characters, so 128 leaves room for a request id or a prefixed trace without a header that
9
+ * can hold a page of text
10
+ */
11
+ exports.TRAIL_EXID_LENGTH_MAX = 128;
12
+ /**
13
+ * .what = whether a value is a well-formed trail exid: a string of 1 to 128 printable ascii characters
14
+ * .why = `x-trail-exid` is the first value a public caller can place in this sdk's logs, in every 500's
15
+ * `correlationId`, and in the trail of every downstream call. a caller who sends a page of text,
16
+ * or a control character, would write it all into those places. a bounded printable value cannot
17
+ * forge a log line or grow a header without limit (`domain.terms/x-trail-exid.md`)
18
+ *
19
+ * .note = printable ascii is U+0020 to U+007E. a space is allowed inside the value, never at an end: http
20
+ * trims the ends of a header value, so a padded exid would read differently at each side of the
21
+ * wire and the trace would not join. a tab, a newline, and every control character are not allowed
22
+ */
23
+ exports.isTrailExid = (0, type_fns_1.withAssure)((value) => typeof value === 'string' &&
24
+ value.length >= 1 &&
25
+ value.length <= exports.TRAIL_EXID_LENGTH_MAX &&
26
+ /^[\x21-\x7e]([\x20-\x7e]*[\x21-\x7e])?$/.test(value), { name: 'isTrailExid' });
27
+ //# sourceMappingURL=isTrailExid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTrailExid.js","sourceRoot":"","sources":["../../../../src/domain.operations/lambdaEndpointWire/frame/isTrailExid.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAEtC;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;;;;;GAUG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,EACnC,CAAC,KAAc,EAAmB,EAAE,CAClC,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,CAAC,MAAM,IAAI,CAAC;IACjB,KAAK,CAAC,MAAM,IAAI,6BAAqB;IACrC,yCAAyC,CAAC,IAAI,CAAC,KAAK,CAAC,EACvD,EAAE,IAAI,EAAE,aAAa,EAAE,CACxB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * .what = whether a headers bag holds an `x-trail-exid` a caller meant as the opt-in, which the endpoint
3
+ * reads as absent because the value is malformed
4
+ * .why = a malformed value opts a caller out in silence: the caller is answered ancient and its trace does
5
+ * not join. the endpoint logs this, with the length and never the text, so the drop leaves a signal
6
+ *
7
+ * .note = an empty value is absent, not malformed: a client that sends an empty header meant no opt-in
8
+ */
9
+ export declare const isTrailExidHeaderMalformed: (input: {
10
+ headers: Record<string, string | undefined> | null | undefined;
11
+ }) => boolean;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTrailExidHeaderMalformed = void 0;
4
+ const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
5
+ const isTrailExid_1 = require("./isTrailExid");
6
+ /**
7
+ * .what = whether a headers bag holds an `x-trail-exid` a caller meant as the opt-in, which the endpoint
8
+ * reads as absent because the value is malformed
9
+ * .why = a malformed value opts a caller out in silence: the caller is answered ancient and its trace does
10
+ * not join. the endpoint logs this, with the length and never the text, so the drop leaves a signal
11
+ *
12
+ * .note = an empty value is absent, not malformed: a client that sends an empty header meant no opt-in
13
+ */
14
+ const isTrailExidHeaderMalformed = (input) => {
15
+ const value = input.headers?.[TrailExidHeader_1.TRAIL_EXID_HEADER];
16
+ if (typeof value !== 'string' || value === '')
17
+ return false;
18
+ return !isTrailExid_1.isTrailExid.assess(value);
19
+ };
20
+ exports.isTrailExidHeaderMalformed = isTrailExidHeaderMalformed;
21
+ //# sourceMappingURL=isTrailExidHeaderMalformed.js.map