sdk-aws-lambda 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/domain.objects/HttpStatusCode.d.ts +28 -0
  2. package/dist/domain.objects/HttpStatusCode.js +37 -0
  3. package/dist/domain.objects/HttpStatusCode.js.map +1 -0
  4. package/dist/domain.objects/LambdaEndpointContext.d.ts +6 -0
  5. package/dist/domain.objects/LambdaEndpointContext.js +3 -0
  6. package/dist/domain.objects/LambdaEndpointContext.js.map +1 -0
  7. package/dist/domain.objects/LambdaEndpointError.d.ts +51 -0
  8. package/dist/domain.objects/LambdaEndpointError.js +13 -0
  9. package/dist/domain.objects/LambdaEndpointError.js.map +1 -0
  10. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +54 -0
  11. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +76 -0
  12. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -0
  13. package/dist/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.d.ts +11 -0
  14. package/dist/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.js +18 -0
  15. package/dist/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.js.map +1 -0
  16. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.d.ts +18 -0
  17. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js +31 -0
  18. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js.map +1 -0
  19. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.d.ts +10 -0
  20. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js +26 -0
  21. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js.map +1 -0
  22. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.d.ts +11 -0
  23. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js +21 -0
  24. package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js.map +1 -0
  25. package/dist/domain.operations/askLambdaEndpoint/context/getExidFromContext.d.ts +16 -0
  26. package/dist/domain.operations/askLambdaEndpoint/context/getExidFromContext.js +20 -0
  27. package/dist/domain.operations/askLambdaEndpoint/context/getExidFromContext.js.map +1 -0
  28. package/dist/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.d.ts +27 -0
  29. package/dist/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.js +20 -0
  30. package/dist/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.js.map +1 -0
  31. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.d.ts +42 -0
  32. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js +21 -0
  33. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js.map +1 -0
  34. package/dist/domain.operations/askLambdaEndpoint/error/getLambdaErrorMetadata.d.ts +16 -0
  35. package/dist/domain.operations/askLambdaEndpoint/error/getLambdaErrorMetadata.js +19 -0
  36. package/dist/domain.operations/askLambdaEndpoint/error/getLambdaErrorMetadata.js.map +1 -0
  37. package/dist/domain.operations/askLambdaEndpoint/error/getStackTraceString.d.ts +7 -0
  38. package/dist/domain.operations/askLambdaEndpoint/error/getStackTraceString.js +16 -0
  39. package/dist/domain.operations/askLambdaEndpoint/error/getStackTraceString.js.map +1 -0
  40. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.d.ts +5 -0
  41. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js +34 -0
  42. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js.map +1 -0
  43. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +26 -0
  44. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +60 -0
  45. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -0
  46. package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.d.ts +11 -0
  47. package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js +17 -0
  48. package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js.map +1 -0
  49. package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.d.ts +19 -0
  50. package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.js +21 -0
  51. package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.js.map +1 -0
  52. package/dist/domain.operations/askLambdaEndpoint/serde/getDecodedPayload.d.ts +7 -0
  53. package/dist/domain.operations/askLambdaEndpoint/serde/getDecodedPayload.js +12 -0
  54. package/dist/domain.operations/askLambdaEndpoint/serde/getDecodedPayload.js.map +1 -0
  55. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.d.ts +9 -0
  56. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js +12 -0
  57. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js.map +1 -0
  58. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaPayload.d.ts +15 -0
  59. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaPayload.js +15 -0
  60. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaPayload.js.map +1 -0
  61. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedJson.d.ts +18 -0
  62. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedJson.js +22 -0
  63. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedJson.js.map +1 -0
  64. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +15 -0
  65. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +99 -0
  66. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +1 -0
  67. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +83 -0
  68. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +99 -0
  69. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -0
  70. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.d.ts +14 -0
  71. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js +44 -0
  72. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js.map +1 -0
  73. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayEvent.d.ts +6 -0
  74. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayEvent.js +16 -0
  75. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayEvent.js.map +1 -0
  76. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.d.ts +6 -0
  77. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js +16 -0
  78. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js.map +1 -0
  79. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.d.ts +32 -0
  80. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +90 -0
  81. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -0
  82. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +11 -0
  83. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +22 -0
  84. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -0
  85. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +80 -0
  86. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +59 -0
  87. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -0
  88. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +11 -0
  89. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +21 -0
  90. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -0
  91. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +23 -0
  92. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +57 -0
  93. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -0
  94. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +13 -0
  95. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +56 -0
  96. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -0
  97. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +16 -0
  98. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +44 -0
  99. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -0
  100. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +12 -0
  101. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +51 -0
  102. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -0
  103. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +9 -0
  104. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +26 -0
  105. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -0
  106. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +37 -0
  107. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +57 -0
  108. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -0
  109. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.d.ts +11 -0
  110. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js +54 -0
  111. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js.map +1 -0
  112. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsWrappedPayload.d.ts +15 -0
  113. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsWrappedPayload.js +36 -0
  114. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsWrappedPayload.js.map +1 -0
  115. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.d.ts +13 -0
  116. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js +25 -0
  117. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js.map +1 -0
  118. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.d.ts +9 -0
  119. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js +19 -0
  120. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -0
  121. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +13 -0
  122. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +17 -0
  123. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -0
  124. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.d.ts +13 -0
  125. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js +16 -0
  126. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -0
  127. package/dist/index.d.ts +24 -0
  128. package/dist/index.js +41 -0
  129. package/dist/index.js.map +1 -0
  130. package/license.md +21 -0
  131. package/package.json +115 -0
  132. package/readme.md +54 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * .what = HTTP status codes enum
3
+ * .why = provides typed status codes for API responses
4
+ *
5
+ * ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
6
+ */
7
+ export declare enum HttpStatusCode {
8
+ SUCCESS_200 = 200,
9
+ CREATED_201 = 201,
10
+ ACCEPTED_202 = 202,
11
+ NO_CONTENT_204 = 204,
12
+ MOVED_PERMANENTLY_301 = 301,
13
+ FOUND_302 = 302,
14
+ NOT_MODIFIED_304 = 304,
15
+ BAD_REQUEST_400 = 400,
16
+ UNAUTHORIZED_401 = 401,
17
+ FORBIDDEN_403 = 403,
18
+ NOT_FOUND_404 = 404,
19
+ METHOD_NOT_ALLOWED_405 = 405,
20
+ CONFLICT_409 = 409,
21
+ UNPROCESSABLE_ENTITY_422 = 422,
22
+ TOO_MANY_REQUESTS_429 = 429,
23
+ INTERNAL_SERVER_ERROR_500 = 500,
24
+ NOT_IMPLEMENTED_501 = 501,
25
+ BAD_GATEWAY_502 = 502,
26
+ SERVICE_UNAVAILABLE_503 = 503,
27
+ GATEWAY_TIMEOUT_504 = 504
28
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpStatusCode = void 0;
4
+ /**
5
+ * .what = HTTP status codes enum
6
+ * .why = provides typed status codes for API responses
7
+ *
8
+ * ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
9
+ */
10
+ var HttpStatusCode;
11
+ (function (HttpStatusCode) {
12
+ // success
13
+ HttpStatusCode[HttpStatusCode["SUCCESS_200"] = 200] = "SUCCESS_200";
14
+ HttpStatusCode[HttpStatusCode["CREATED_201"] = 201] = "CREATED_201";
15
+ HttpStatusCode[HttpStatusCode["ACCEPTED_202"] = 202] = "ACCEPTED_202";
16
+ HttpStatusCode[HttpStatusCode["NO_CONTENT_204"] = 204] = "NO_CONTENT_204";
17
+ // redirect
18
+ HttpStatusCode[HttpStatusCode["MOVED_PERMANENTLY_301"] = 301] = "MOVED_PERMANENTLY_301";
19
+ HttpStatusCode[HttpStatusCode["FOUND_302"] = 302] = "FOUND_302";
20
+ HttpStatusCode[HttpStatusCode["NOT_MODIFIED_304"] = 304] = "NOT_MODIFIED_304";
21
+ // client error
22
+ HttpStatusCode[HttpStatusCode["BAD_REQUEST_400"] = 400] = "BAD_REQUEST_400";
23
+ HttpStatusCode[HttpStatusCode["UNAUTHORIZED_401"] = 401] = "UNAUTHORIZED_401";
24
+ HttpStatusCode[HttpStatusCode["FORBIDDEN_403"] = 403] = "FORBIDDEN_403";
25
+ HttpStatusCode[HttpStatusCode["NOT_FOUND_404"] = 404] = "NOT_FOUND_404";
26
+ HttpStatusCode[HttpStatusCode["METHOD_NOT_ALLOWED_405"] = 405] = "METHOD_NOT_ALLOWED_405";
27
+ HttpStatusCode[HttpStatusCode["CONFLICT_409"] = 409] = "CONFLICT_409";
28
+ HttpStatusCode[HttpStatusCode["UNPROCESSABLE_ENTITY_422"] = 422] = "UNPROCESSABLE_ENTITY_422";
29
+ HttpStatusCode[HttpStatusCode["TOO_MANY_REQUESTS_429"] = 429] = "TOO_MANY_REQUESTS_429";
30
+ // server error
31
+ HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR_500"] = 500] = "INTERNAL_SERVER_ERROR_500";
32
+ HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED_501"] = 501] = "NOT_IMPLEMENTED_501";
33
+ HttpStatusCode[HttpStatusCode["BAD_GATEWAY_502"] = 502] = "BAD_GATEWAY_502";
34
+ HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE_503"] = 503] = "SERVICE_UNAVAILABLE_503";
35
+ HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT_504"] = 504] = "GATEWAY_TIMEOUT_504";
36
+ })(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
37
+ //# sourceMappingURL=HttpStatusCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpStatusCode.js","sourceRoot":"","sources":["../../src/domain.objects/HttpStatusCode.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,cA4BX;AA5BD,WAAY,cAAc;IACxB,UAAU;IACV,mEAAiB,CAAA;IACjB,mEAAiB,CAAA;IACjB,qEAAkB,CAAA;IAClB,yEAAoB,CAAA;IAEpB,WAAW;IACX,uFAA2B,CAAA;IAC3B,+DAAe,CAAA;IACf,6EAAsB,CAAA;IAEtB,eAAe;IACf,2EAAqB,CAAA;IACrB,6EAAsB,CAAA;IACtB,uEAAmB,CAAA;IACnB,uEAAmB,CAAA;IACnB,yFAA4B,CAAA;IAC5B,qEAAkB,CAAA;IAClB,6FAA8B,CAAA;IAC9B,uFAA2B,CAAA;IAE3B,eAAe;IACf,+FAA+B,CAAA;IAC/B,mFAAyB,CAAA;IACzB,2EAAqB,CAAA;IACrB,2FAA6B,CAAA;IAC7B,mFAAyB,CAAA;AAC3B,CAAC,EA5BW,cAAc,8BAAd,cAAc,QA4BzB"}
@@ -0,0 +1,6 @@
1
+ import type { ContextLogTrail } from 'sdk-logs';
2
+ /**
3
+ * .what = the context shape passed to lambda endpoint handlers
4
+ * .why = provides trail-aware log methods for correlation across requests
5
+ */
6
+ export type LambdaEndpointContext = ContextLogTrail;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=LambdaEndpointContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpointContext.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointContext.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { HelpfulError } from 'helpful-errors';
2
+ /**
3
+ * .what = error for failed lambda invocations via askLambdaEndpoint
4
+ * .why = provides rich context for debug: service, function, exid, cause
5
+ */
6
+ export interface LambdaEndpointErrorMetadata {
7
+ /**
8
+ * the service that owns the lambda function
9
+ */
10
+ service: string;
11
+ /**
12
+ * the lambda function name that was invoked
13
+ */
14
+ function: string;
15
+ /**
16
+ * the exid (execution id) for trail correlation
17
+ */
18
+ exid: string | null;
19
+ /**
20
+ * the error type returned by the lambda (e.g., 'Error', 'ValidationError')
21
+ */
22
+ errorType?: string;
23
+ /**
24
+ * the HTTP status code from the Lambda invocation
25
+ * non-200 indicates invocation itself failed (throttle, permission, not found)
26
+ */
27
+ statusCode?: number;
28
+ /**
29
+ * the stack trace from the remote lambda
30
+ */
31
+ stackTrace?: string;
32
+ /**
33
+ * the root cause error, if wrapped
34
+ */
35
+ cause?: Error;
36
+ /**
37
+ * additional error details from the lambda response
38
+ */
39
+ details?: unknown;
40
+ /**
41
+ * cause message from lambda response (when cause is remote)
42
+ */
43
+ causeMessage?: string;
44
+ }
45
+ export declare class LambdaEndpointError extends HelpfulError<LambdaEndpointErrorMetadata> {
46
+ static code: {
47
+ readonly http: 502;
48
+ readonly slug: "LAMBDA_ENDPOINT_ERROR";
49
+ };
50
+ constructor(message: string, metadata: LambdaEndpointErrorMetadata);
51
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaEndpointError = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ class LambdaEndpointError extends helpful_errors_1.HelpfulError {
6
+ constructor(message, metadata) {
7
+ super(message, metadata);
8
+ this.name = 'LambdaEndpointError';
9
+ }
10
+ }
11
+ exports.LambdaEndpointError = LambdaEndpointError;
12
+ LambdaEndpointError.code = { http: 502, slug: 'LAMBDA_ENDPOINT_ERROR' };
13
+ //# sourceMappingURL=LambdaEndpointError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpointError.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointError.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAsD9C,MAAa,mBAAoB,SAAQ,6BAAyC;IAGhF,YAAY,OAAe,EAAE,QAAqC;QAChE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;;AANH,kDAOC;AANe,wBAAI,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,uBAAuB,EAAW,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { LambdaClient } from '@aws-sdk/client-lambda';
2
+ import type { ContextLogTrail } from 'sdk-logs';
3
+ import type { SimpleInMemoryCache } from 'simple-in-memory-cache';
4
+ import type { SimpleCache } from 'with-simple-cache';
5
+ /**
6
+ * .what = invokes a lambda endpoint with trail propagation
7
+ * .why = enables service-to-service calls with observability
8
+ *
9
+ * .note = pass context.cache to enable response cache
10
+ * .note = use struct: 'ancient' for handlers that don't understand wrapped payloads
11
+ */
12
+ export declare const askLambdaEndpoint: <TRequest, TResponse>(input: {
13
+ which: {
14
+ service: string;
15
+ function: string;
16
+ };
17
+ event: TRequest;
18
+ /**
19
+ * .what = structure options
20
+ * .why = extensible for future structure versions
21
+ */
22
+ struct?: {
23
+ /**
24
+ * .what = payload format to send
25
+ * .why = ancient handlers don't understand wrapped { event, trail } structure
26
+ * .default = 'contemp' (wrapped with trail)
27
+ */
28
+ payload?: 'ancient' | 'contemp';
29
+ };
30
+ }, context: ContextLogTrail & {
31
+ env: {
32
+ access: string;
33
+ region?: string;
34
+ };
35
+ aws?: {
36
+ lambda?: {
37
+ sdk?: LambdaClient;
38
+ };
39
+ };
40
+ cache?: {
41
+ response?: SimpleCache<TResponse>;
42
+ dedupe?: SimpleInMemoryCache<TResponse>;
43
+ };
44
+ }) => Promise<TResponse>;
45
+ /**
46
+ * .what = input type for askLambdaEndpoint
47
+ * .why = exported for sdk consumers
48
+ */
49
+ export type AskLambdaEndpointInput<TRequest> = Parameters<typeof askLambdaEndpoint<TRequest, unknown>>[0];
50
+ /**
51
+ * .what = context type for askLambdaEndpoint
52
+ * .why = exported for sdk consumers
53
+ */
54
+ export type AskLambdaEndpointContext = Parameters<typeof askLambdaEndpoint>[1];
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askLambdaEndpoint = void 0;
4
+ const asCachedExecutor_1 = require("./cache/asCachedExecutor");
5
+ const getAskLambdaCacheKey_1 = require("./cache/getAskLambdaCacheKey");
6
+ const getAccessFromContext_1 = require("./context/getAccessFromContext");
7
+ const getExidFromContext_1 = require("./context/getExidFromContext");
8
+ const getLogForExidExtraction_1 = require("./context/getLogForExidExtraction");
9
+ const genLambdaClient_1 = require("./invoke/genLambdaClient");
10
+ const getLambdaFunctionName_1 = require("./serde/getLambdaFunctionName");
11
+ const getLambdaPayload_1 = require("./serde/getLambdaPayload");
12
+ /**
13
+ * .what = invokes a lambda endpoint with trail propagation
14
+ * .why = enables service-to-service calls with observability
15
+ *
16
+ * .note = pass context.cache to enable response cache
17
+ * .note = use struct: 'ancient' for handlers that don't understand wrapped payloads
18
+ */
19
+ const askLambdaEndpoint = async (input, context) => {
20
+ // extract or generate trail exid
21
+ const logForExidExtraction = (0, getLogForExidExtraction_1.getLogForExidExtraction)({ log: context.log });
22
+ const { exid, source: exidSource } = (0, getExidFromContext_1.getExidFromContext)({
23
+ log: logForExidExtraction,
24
+ });
25
+ // log when trail exid was generated (indicates caller did not propagate trail)
26
+ if (exidSource === 'generated') {
27
+ context.log.debug('trail.exid.generated', {
28
+ exid,
29
+ note: 'no trail exid in context, generated new one',
30
+ });
31
+ }
32
+ // get access level from context
33
+ const access = (0, getAccessFromContext_1.getAccessFromContext)({ env: context.env });
34
+ // build function name
35
+ const functionName = (0, getLambdaFunctionName_1.getLambdaFunctionName)({
36
+ service: input.which.service,
37
+ access,
38
+ function: input.which.function,
39
+ });
40
+ // build payload (ancient handlers expect flat event, contemp expect wrapped)
41
+ const structOfPayload = input.struct?.payload ?? 'contemp';
42
+ const payload = structOfPayload === 'ancient'
43
+ ? input.event
44
+ : (0, getLambdaPayload_1.getLambdaPayload)({ event: input.event, trail: { exid } });
45
+ // get or create lambda client
46
+ const lambdaClient = (0, genLambdaClient_1.genLambdaClient)({
47
+ sdk: context.aws?.lambda?.sdk,
48
+ env: { region: context.env.region },
49
+ });
50
+ // prepare invocation args
51
+ const invocationArgs = {
52
+ functionName,
53
+ payload,
54
+ exid,
55
+ service: input.which.service,
56
+ function: input.which.function,
57
+ lambdaClient,
58
+ log: context.log,
59
+ };
60
+ // build cache key generator
61
+ const getCacheKey = () => (0, getAskLambdaCacheKey_1.getAskLambdaCacheKey)({
62
+ service: input.which.service,
63
+ function: input.which.function,
64
+ access,
65
+ event: input.event,
66
+ });
67
+ // get executor with cache wrapper
68
+ const execute = (0, asCachedExecutor_1.asCachedExecutor)({
69
+ ...context.cache,
70
+ getCacheKey,
71
+ });
72
+ // execute invocation
73
+ return execute(invocationArgs);
74
+ };
75
+ exports.askLambdaEndpoint = askLambdaEndpoint;
76
+ //# sourceMappingURL=askLambdaEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askLambdaEndpoint.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEndpoint.ts"],"names":[],"mappings":";;;AAKA,+DAA4D;AAC5D,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+EAA4E;AAE5E,8DAA2D;AAC3D,yEAAsE;AACtE,+DAA4D;AAE5D;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,KAAK,EACpC,KAkBC,EACD,OAYC,EACmB,EAAE;IACtB,iCAAiC;IACjC,MAAM,oBAAoB,GAAG,IAAA,iDAAuB,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3E,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uCAAkB,EAAC;QACtD,GAAG,EAAE,oBAAoB;KAC1B,CAAC,CAAC;IAEH,+EAA+E;IAC/E,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACxC,IAAI;YACJ,IAAI,EAAE,6CAA6C;SACpD,CAAC,CAAC;IACL,CAAC;IAED,gCAAgC;IAChC,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE1D,sBAAsB;IACtB,MAAM,YAAY,GAAG,IAAA,6CAAqB,EAAC;QACzC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;QAC5B,MAAM;QACN,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ;KAC/B,CAAC,CAAC;IAEH,6EAA6E;IAC7E,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,IAAI,SAAS,CAAC;IAC3D,MAAM,OAAO,GACX,eAAe,KAAK,SAAS;QAC3B,CAAC,CAAC,KAAK,CAAC,KAAK;QACb,CAAC,CAAC,IAAA,mCAAgB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAEhE,8BAA8B;IAC9B,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC;QACnC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG;QAC7B,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;KACpC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,cAAc,GAAmB;QACrC,YAAY;QACZ,OAAO;QACP,IAAI;QACJ,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;QAC5B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ;QAC9B,YAAY;QACZ,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC;IAEF,4BAA4B;IAC5B,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,IAAA,2CAAoB,EAAC;QACnB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;QAC5B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ;QAC9B,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,KAAgC;KAC9C,CAAC,CAAC;IAEL,kCAAkC;IAClC,MAAM,OAAO,GAAG,IAAA,mCAAgB,EAAY;QAC1C,GAAG,OAAO,CAAC,KAAK;QAChB,WAAW;KACZ,CAAC,CAAC;IAEH,qBAAqB;IACrB,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;AACjC,CAAC,CAAC;AAnGW,QAAA,iBAAiB,qBAmG5B"}
@@ -0,0 +1,11 @@
1
+ import type { SimpleCache } from 'with-simple-cache';
2
+ /**
3
+ * .what = disables set functionality on a cache
4
+ * .why = enables read-only cache access when service owns the data
5
+ *
6
+ * .note = use this when
7
+ * - a lambda service owns the cached data
8
+ * - you want to read from cache to avoid calls
9
+ * - but the service manages cache writes
10
+ */
11
+ export declare const asCacheWithoutSet: <T>(cache: SimpleCache<T>) => SimpleCache<T>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asCacheWithoutSet = void 0;
4
+ /**
5
+ * .what = disables set functionality on a cache
6
+ * .why = enables read-only cache access when service owns the data
7
+ *
8
+ * .note = use this when
9
+ * - a lambda service owns the cached data
10
+ * - you want to read from cache to avoid calls
11
+ * - but the service manages cache writes
12
+ */
13
+ const asCacheWithoutSet = (cache) => ({
14
+ ...cache,
15
+ set: (() => { }),
16
+ });
17
+ exports.asCacheWithoutSet = asCacheWithoutSet;
18
+ //# sourceMappingURL=asCacheWithoutSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asCacheWithoutSet.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAAI,KAAqB,EAAkB,EAAE,CAC5E,CAAC;IACC,GAAG,KAAK;IACR,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAA0B;CACzC,CAAmB,CAAC;AAJV,QAAA,iBAAiB,qBAIP"}
@@ -0,0 +1,18 @@
1
+ import type { SimpleInMemoryCache } from 'simple-in-memory-cache';
2
+ import { type SimpleCache } from 'with-simple-cache';
3
+ import { type InvocationArgs } from '../invoke/executeLambdaInvocation';
4
+ /**
5
+ * .what = executor type for lambda invocation
6
+ * .why = typed for cache wrapper composition
7
+ */
8
+ type LambdaExecutor<TResponse> = (args: InvocationArgs) => Promise<TResponse>;
9
+ /**
10
+ * .what = wraps executor with cache if caches provided
11
+ * .why = extracts cache selection logic from orchestrator
12
+ */
13
+ export declare const asCachedExecutor: <TResponse>(input: {
14
+ response?: SimpleCache<TResponse>;
15
+ dedupe?: SimpleInMemoryCache<TResponse>;
16
+ getCacheKey: () => string;
17
+ }) => LambdaExecutor<TResponse>;
18
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asCachedExecutor = void 0;
4
+ const with_simple_cache_1 = require("with-simple-cache");
5
+ const executeLambdaInvocation_1 = require("../invoke/executeLambdaInvocation");
6
+ /**
7
+ * .what = wraps executor with cache if caches provided
8
+ * .why = extracts cache selection logic from orchestrator
9
+ */
10
+ const asCachedExecutor = (input) => {
11
+ // no cache provided, return unwrapped executor
12
+ if (!input.response)
13
+ return executeLambdaInvocation_1.executeLambdaInvocation;
14
+ // dedupe cache provided, wrap with both caches
15
+ if (input.dedupe) {
16
+ return (0, with_simple_cache_1.withSimpleCacheAsync)(executeLambdaInvocation_1.executeLambdaInvocation, {
17
+ cache: {
18
+ output: input.response,
19
+ deduplication: input.dedupe,
20
+ },
21
+ serialize: { key: input.getCacheKey },
22
+ });
23
+ }
24
+ // output cache only
25
+ return (0, with_simple_cache_1.withSimpleCacheAsync)(executeLambdaInvocation_1.executeLambdaInvocation, {
26
+ cache: input.response,
27
+ serialize: { key: input.getCacheKey },
28
+ });
29
+ };
30
+ exports.asCachedExecutor = asCachedExecutor;
31
+ //# sourceMappingURL=asCachedExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asCachedExecutor.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.ts"],"names":[],"mappings":";;;AACA,yDAA2E;AAE3E,+EAG2C;AAQ3C;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAY,KAI3C,EAA6B,EAAE;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,iDAAoD,CAAC;IAE9D,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;YACnD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ;gBACtB,aAAa,EAAE,KAAK,CAAC,MAAM;aAC5B;YACD,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;SACtC,CAA8B,CAAC;IAClC,CAAC;IAED,oBAAoB;IACpB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;KACtC,CAA8B,CAAC;AAClC,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * .what = generates a unique cache key for lambda client requests
3
+ * .why = enables request deduplication and response cache
4
+ */
5
+ export declare const getAskLambdaCacheKey: (input: {
6
+ service: string;
7
+ function: string;
8
+ access: string;
9
+ event: Record<string, unknown>;
10
+ }) => string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAskLambdaCacheKey = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ /**
6
+ * .what = generates a unique cache key for lambda client requests
7
+ * .why = enables request deduplication and response cache
8
+ */
9
+ const getAskLambdaCacheKey = (input) => {
10
+ const idealKey = [
11
+ [input.service, input.access, input.function].join('-'),
12
+ JSON.stringify(input.event),
13
+ ].join('.');
14
+ // create human part for observability
15
+ const humanPart = idealKey
16
+ .replace(/:/g, '.')
17
+ .replace(/[^\w\-_.]/g, '')
18
+ .replace(/\.\./g, '.');
19
+ // create unique part for collision avoidance
20
+ const uniquePart = (0, node_crypto_1.createHash)('sha256')
21
+ .update(JSON.stringify(idealKey))
22
+ .digest('hex');
23
+ return [humanPart, uniquePart].join('.');
24
+ };
25
+ exports.getAskLambdaCacheKey = getAskLambdaCacheKey;
26
+ //# sourceMappingURL=getAskLambdaCacheKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAskLambdaCacheKey.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAKpC,EAAU,EAAE;IACX,MAAM,QAAQ,GAAG;QACf,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;KAC5B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEZ,sCAAsC;IACtC,MAAM,SAAS,GAAG,QAAQ;SACvB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEzB,6CAA6C;IAC7C,MAAM,UAAU,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACpC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SAChC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC,CAAC;AAvBW,QAAA,oBAAoB,wBAuB/B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * .what = extracts access level from context
3
+ * .why = named transformer for clear narrative in orchestrator
4
+ *
5
+ * .note = throws if access is not provided — no fallbacks
6
+ */
7
+ export declare const getAccessFromContext: (input: {
8
+ env: {
9
+ access: string | null;
10
+ } | null;
11
+ }) => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccessFromContext = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = extracts access level from context
7
+ * .why = named transformer for clear narrative in orchestrator
8
+ *
9
+ * .note = throws if access is not provided — no fallbacks
10
+ */
11
+ const getAccessFromContext = (input) => {
12
+ // require explicit access from context
13
+ if (input.env?.access)
14
+ return input.env.access;
15
+ // fail loud: no fallbacks
16
+ throw new helpful_errors_1.MalfunctionError('access not provided: context.env.access is required', {
17
+ hint: 'pass env.access in context (test | prep | prod)',
18
+ });
19
+ };
20
+ exports.getAccessFromContext = getAccessFromContext;
21
+ //# sourceMappingURL=getAccessFromContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccessFromContext.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/context/getAccessFromContext.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAElD;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAAU,EAAE;IACX,uCAAuC;IACvC,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IAE/C,0BAA0B;IAC1B,MAAM,IAAI,iCAAgB,CACxB,qDAAqD,EACrD;QACE,IAAI,EAAE,iDAAiD;KACxD,CACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * .what = extracts trail exid from context or generates new one
3
+ * .why = enables trail propagation with fallback for contexts without exid
4
+ *
5
+ * returns exid and source to enable caller to log when fallback occurs
6
+ */
7
+ export declare const getExidFromContext: (input: {
8
+ log: {
9
+ trail: {
10
+ exid: string | null;
11
+ } | null;
12
+ } | null;
13
+ }) => {
14
+ exid: string;
15
+ source: 'extracted' | 'generated';
16
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExidFromContext = void 0;
4
+ const crypto_1 = require("crypto");
5
+ /**
6
+ * .what = extracts trail exid from context or generates new one
7
+ * .why = enables trail propagation with fallback for contexts without exid
8
+ *
9
+ * returns exid and source to enable caller to log when fallback occurs
10
+ */
11
+ const getExidFromContext = (input) => {
12
+ // extract exid from log trail
13
+ const exid = input.log?.trail?.exid;
14
+ if (exid)
15
+ return { exid, source: 'extracted' };
16
+ // generate new exid and indicate it was generated
17
+ return { exid: `exid:${(0, crypto_1.randomUUID)()}`, source: 'generated' };
18
+ };
19
+ exports.getExidFromContext = getExidFromContext;
20
+ //# sourceMappingURL=getExidFromContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExidFromContext.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/context/getExidFromContext.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAEpC;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAAuD,EAAE;IACxD,8BAA8B;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC;IACpC,IAAI,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAE/C,kDAAkD;IAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAA,mBAAU,GAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAC/D,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * external log shape from askLambdaEndpoint callers
3
+ *
4
+ * .note = accepts optional trail/exid because callers may not provide trail context
5
+ * this is the expected input from public API boundaries
6
+ */
7
+ interface ExternalLogShape {
8
+ trail?: {
9
+ exid?: string | null;
10
+ } | null;
11
+ }
12
+ /**
13
+ * .what = boundary normalizer for log shape
14
+ * .why = converts external log shape to strict internal shape with explicit nulls
15
+ *
16
+ * .note = this function is the boundary between external (optional) and internal (strict)
17
+ * input accepts external shape with optionals (from public API)
18
+ * output uses strict nulls for internal consumption
19
+ */
20
+ export declare const getLogForExidExtraction: (input: {
21
+ log: ExternalLogShape | null;
22
+ }) => {
23
+ trail: {
24
+ exid: string | null;
25
+ } | null;
26
+ } | null;
27
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLogForExidExtraction = void 0;
4
+ /**
5
+ * .what = boundary normalizer for log shape
6
+ * .why = converts external log shape to strict internal shape with explicit nulls
7
+ *
8
+ * .note = this function is the boundary between external (optional) and internal (strict)
9
+ * input accepts external shape with optionals (from public API)
10
+ * output uses strict nulls for internal consumption
11
+ */
12
+ const getLogForExidExtraction = (input) => {
13
+ if (!input.log)
14
+ return null;
15
+ if (!input.log.trail)
16
+ return { trail: null };
17
+ return { trail: { exid: input.log.trail.exid ?? null } };
18
+ };
19
+ exports.getLogForExidExtraction = getLogForExidExtraction;
20
+ //# sourceMappingURL=getLogForExidExtraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLogForExidExtraction.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.ts"],"names":[],"mappings":";;;AAUA;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAEvC,EAAoD,EAAE;IACrD,IAAI,CAAC,KAAK,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC7C,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;AAC3D,CAAC,CAAC;AANW,QAAA,uBAAuB,2BAMlC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * contemp error response shape from genLambdaEndpoint
3
+ * .note = has explicit _serde discriminator for clean detection
4
+ */
5
+ export interface LambdaErrorResponseContemp {
6
+ error: {
7
+ _serde: 'LambdaEndpointError::contemp';
8
+ class: string;
9
+ message: string;
10
+ cause?: string;
11
+ details?: unknown;
12
+ };
13
+ }
14
+ /**
15
+ * ancient error response shape from AWS Lambda or old genLambdaEndpoint
16
+ * .note = stackTrace can be string[] (aws native) or string (genLambdaEndpoint)
17
+ */
18
+ export interface LambdaErrorResponseAncient {
19
+ errorMessage: string;
20
+ errorType?: string;
21
+ stackTrace?: string[] | string;
22
+ /**
23
+ * validation issues or other error details from genLambdaEndpoint
24
+ * .note = genConstraintErrorMiddleware sends error.metadata as details
25
+ */
26
+ details?: unknown;
27
+ /**
28
+ * cause error message from genLambdaEndpoint
29
+ * .note = genConstraintErrorMiddleware sends error.cause.message as causeMessage
30
+ */
31
+ causeMessage?: string;
32
+ }
33
+ /**
34
+ * .what = checks if parsed response is a contemp lambda error response
35
+ * .why = contemp errors have { error: { _serde: 'LambdaEndpointError::contemp' } }
36
+ */
37
+ export declare const getIsContempErrorResponse: (parsed: unknown) => parsed is LambdaErrorResponseContemp;
38
+ /**
39
+ * .what = checks if parsed response is an ancient lambda error response
40
+ * .why = ancient errors have flat errorMessage property
41
+ */
42
+ export declare const getIsAncientErrorResponse: (parsed: unknown) => parsed is LambdaErrorResponseAncient;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIsAncientErrorResponse = exports.getIsContempErrorResponse = void 0;
4
+ /**
5
+ * .what = checks if parsed response is a contemp lambda error response
6
+ * .why = contemp errors have { error: { _serde: 'LambdaEndpointError::contemp' } }
7
+ */
8
+ const getIsContempErrorResponse = (parsed) => typeof parsed === 'object' &&
9
+ parsed !== null &&
10
+ 'error' in parsed &&
11
+ typeof parsed.error === 'object' &&
12
+ parsed.error !== null &&
13
+ parsed.error._serde === 'LambdaEndpointError::contemp';
14
+ exports.getIsContempErrorResponse = getIsContempErrorResponse;
15
+ /**
16
+ * .what = checks if parsed response is an ancient lambda error response
17
+ * .why = ancient errors have flat errorMessage property
18
+ */
19
+ const getIsAncientErrorResponse = (parsed) => typeof parsed === 'object' && parsed !== null && 'errorMessage' in parsed;
20
+ exports.getIsAncientErrorResponse = getIsAncientErrorResponse;
21
+ //# sourceMappingURL=getIsLambdaErrorResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIsLambdaErrorResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.ts"],"names":[],"mappings":";;;AAkCA;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CACvC,MAAe,EACuB,EAAE,CACxC,OAAO,MAAM,KAAK,QAAQ;IAC1B,MAAM,KAAK,IAAI;IACf,OAAO,IAAI,MAAM;IACjB,OAAQ,MAAkC,CAAC,KAAK,KAAK,QAAQ;IAC5D,MAAkC,CAAC,KAAK,KAAK,IAAI;IAE/C,MAAkD,CAAC,KAIrD,CAAC,MAAM,KAAK,8BAA8B,CAAC;AAbjC,QAAA,yBAAyB,6BAaQ;AAE9C;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CACvC,MAAe,EACuB,EAAE,CACxC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,cAAc,IAAI,MAAM,CAAC;AAH/D,QAAA,yBAAyB,6BAGsC"}