sdk-aws-lambda 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +12 -0
  2. package/dist/domain.objects/ApiGatewayRequestPayload.js +3 -0
  3. package/dist/domain.objects/ApiGatewayRequestPayload.js.map +1 -0
  4. package/dist/domain.objects/ApiGatewayResponse.d.ts +30 -0
  5. package/dist/domain.objects/ApiGatewayResponse.js +3 -0
  6. package/dist/domain.objects/ApiGatewayResponse.js.map +1 -0
  7. package/dist/domain.objects/ApiGatewayResponsePayload.d.ts +30 -0
  8. package/dist/domain.objects/ApiGatewayResponsePayload.js +3 -0
  9. package/dist/domain.objects/ApiGatewayResponsePayload.js.map +1 -0
  10. package/dist/domain.objects/HttpStatusCode.d.ts +1 -0
  11. package/dist/domain.objects/HttpStatusCode.js +1 -0
  12. package/dist/domain.objects/HttpStatusCode.js.map +1 -1
  13. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +29 -0
  14. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js +3 -0
  15. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js.map +1 -0
  16. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.d.ts +29 -0
  17. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js +30 -0
  18. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js.map +1 -0
  19. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +36 -0
  20. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js +3 -0
  21. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +1 -0
  22. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +19 -0
  23. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +24 -0
  24. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +1 -0
  25. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.d.ts +26 -0
  26. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js +31 -0
  27. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +1 -0
  28. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +33 -0
  29. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +39 -0
  30. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -0
  31. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +27 -0
  32. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +118 -0
  33. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +1 -0
  34. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +76 -36
  35. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +153 -45
  36. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  37. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.d.ts +8 -0
  38. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +34 -0
  39. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +1 -0
  40. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +19 -0
  41. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +36 -0
  42. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -0
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.d.ts +7 -24
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +19 -103
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +20 -0
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +48 -0
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js.map +1 -0
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +16 -0
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +32 -0
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +6 -22
  53. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +24 -18
  54. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  55. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +11 -2
  56. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +12 -2
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
  58. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.d.ts +37 -0
  59. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js +24 -0
  60. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js.map +1 -0
  61. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +18 -10
  62. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +20 -23
  63. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
  64. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +29 -6
  65. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +23 -28
  66. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  67. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +16 -1
  68. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +9 -13
  69. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
  70. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +27 -6
  71. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +29 -4
  72. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
  73. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +12 -4
  74. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  75. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +27 -2
  76. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +34 -13
  77. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  78. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +1 -0
  79. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
  80. package/dist/index.d.ts +33 -2
  81. package/dist/index.js +20 -1
  82. package/dist/index.js.map +1 -1
  83. package/package.json +12 -11
  84. package/readme.md +50 -2
package/dist/index.d.ts CHANGED
@@ -4,6 +4,9 @@
4
4
  * define endpoints, ask endpoints, auto-propagate trace-ids.
5
5
  */
6
6
  export { BadRequestError } from 'helpful-errors';
7
+ export type { ApiGatewayRequestPayload } from './domain.objects/ApiGatewayRequestPayload';
8
+ export type { ApiGatewayResponse } from './domain.objects/ApiGatewayResponse';
9
+ export type { ApiGatewayResponsePayload } from './domain.objects/ApiGatewayResponsePayload';
7
10
  export type { ContextAwsLambdaCaller } from './domain.objects/ContextAwsLambdaCaller';
8
11
  export type { ContextAwsLambdaServer, EnvAccess, EnvConfig, } from './domain.objects/ContextAwsLambdaServer';
9
12
  export { GeneratedFile } from './domain.objects/GeneratedFile';
@@ -23,19 +26,47 @@ export { askLambdaEndpoint } from './domain.operations/askLambdaEndpoint/askLamb
23
26
  export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet';
24
27
  export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
25
28
  export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
29
+ export { asApiGatewayResponseSchema } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema';
26
30
  export type { CorsConfig, ForApiGatewayContext, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
27
31
  export { forApiGateway } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
28
- export type { UnifiedApiGatewayEvent } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
32
+ export { isApiGatewayResponse } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse';
29
33
  export { genApiGatewayEventNormalizationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
34
+ export { genContentTypeCoherenceMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware';
35
+ export { genZodBodyValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware';
36
+ export type { UnifiedApiGatewayEvent } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent';
30
37
  export type { EndpointOperation, FlatPayload, GenLambdaEndpointContext, GenLambdaEndpointInput, LambdaHandlerInput, WrappedPayload, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
31
38
  export { genLambdaEndpoint } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
32
39
  export { genZodEventValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware';
40
+ /**
41
+ * .what = the shared `request.context` reader every exported middleware uses
42
+ * .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
43
+ * the lambda context. a consumer who authors a PEER of the exported middlewares would
44
+ * otherwise restate that cast — the exact sprawl this reader exists to retire
45
+ * (rule.forbid.as-cast)
46
+ */
47
+ export { asContextTrailed, type ContextTrailed, } from './domain.operations/genLambdaEndpoint/middleware/asContextTrailed';
33
48
  export { genConstraintErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware';
49
+ export { genInternalServiceErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware';
34
50
  export { genIntrospectionMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware';
35
- export type { IoLogTranslate } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
36
51
  export { genIoLoggerMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
37
52
  export { genTrailMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware';
38
53
  export { genZodOutputValidationMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware';
54
+ /**
55
+ * .what = the two error-body shapes `genConstraintErrorMiddleware.asOutputAfter` receives
56
+ * .why = that middleware is public, so its OWN parameter type must be nameable by a consumer.
57
+ * an unexported parameter type forces an `any` or a hand-copied re-declaration at the
58
+ * public boundary (rule.forbid.as-cast)
59
+ */
60
+ export type { LambdaEndpointErrorResponseBodyAncient, LambdaEndpointErrorResponseBodyContemp, } from './domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody';
61
+ /**
62
+ * .note = `TranslateLog` is public because `logTranslate` accepts it, and it replaces the
63
+ * formerly-public `IoLogTranslate`. its three designed peers — `Translate<TShapes>`,
64
+ * `LambdaEndpointShapes`, `Translator<TFrom, TInto>` — are DELETED rather than
65
+ * unexported: no config field ever accepted a `Translate`, so all three would ship with
66
+ * zero consumers (rule.prefer.wet-over-dry). the design survives in `1.vision.yield.md`,
67
+ * so a later round restores a TERM from a record rather than a dead declaration
68
+ */
69
+ export type { TranslateLog } from './domain.operations/genLambdaEndpoint/TranslateLog';
39
70
  export { genServiceSdk } from './domain.operations/genServiceSdk/genServiceSdk';
40
71
  export { type GetAllLambdaContractsContext, type GetAllLambdaContractsInput, getAllLambdaContracts, } from './domain.operations/getAllLambdaContracts/getAllLambdaContracts';
41
72
  export { getAllLambdaFunctionsByPrefix } from './domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * define endpoints, ask endpoints, auto-propagate trace-ids.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genConstraintErrorMiddleware = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genApiGatewayEventNormalizationMiddleware = exports.forApiGateway = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.BadRequestError = void 0;
8
+ exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genZodBodyValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.forApiGateway = exports.asApiGatewayResponseSchema = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.BadRequestError = void 0;
9
9
  // re-export from helpful-errors for convenience
10
10
  var helpful_errors_1 = require("helpful-errors");
11
11
  Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
@@ -42,16 +42,35 @@ Object.defineProperty(exports, "getAskLambdaCacheKey", { enumerable: true, get:
42
42
  // transformers
43
43
  var asLambdaEndpoint_1 = require("./domain.operations/asLambdaEndpoint/asLambdaEndpoint");
44
44
  Object.defineProperty(exports, "asLambdaEndpoint", { enumerable: true, get: function () { return asLambdaEndpoint_1.asLambdaEndpoint; } });
45
+ var asApiGatewayResponseSchema_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema");
46
+ Object.defineProperty(exports, "asApiGatewayResponseSchema", { enumerable: true, get: function () { return asApiGatewayResponseSchema_1.asApiGatewayResponseSchema; } });
45
47
  var genLambdaEndpoint_forApiGateway_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway");
46
48
  Object.defineProperty(exports, "forApiGateway", { enumerable: true, get: function () { return genLambdaEndpoint_forApiGateway_1.forApiGateway; } });
49
+ var isApiGatewayResponse_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse");
50
+ Object.defineProperty(exports, "isApiGatewayResponse", { enumerable: true, get: function () { return isApiGatewayResponse_1.isApiGatewayResponse; } });
47
51
  var genApiGatewayEventNormalizationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware");
48
52
  Object.defineProperty(exports, "genApiGatewayEventNormalizationMiddleware", { enumerable: true, get: function () { return genApiGatewayEventNormalizationMiddleware_1.genApiGatewayEventNormalizationMiddleware; } });
53
+ var genContentTypeCoherenceMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware");
54
+ Object.defineProperty(exports, "genContentTypeCoherenceMiddleware", { enumerable: true, get: function () { return genContentTypeCoherenceMiddleware_1.genContentTypeCoherenceMiddleware; } });
55
+ var genZodBodyValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware");
56
+ Object.defineProperty(exports, "genZodBodyValidationMiddleware", { enumerable: true, get: function () { return genZodBodyValidationMiddleware_1.genZodBodyValidationMiddleware; } });
49
57
  var genLambdaEndpoint_forAskEndpoint_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint");
50
58
  Object.defineProperty(exports, "genLambdaEndpoint", { enumerable: true, get: function () { return genLambdaEndpoint_forAskEndpoint_1.genLambdaEndpoint; } });
51
59
  var genZodEventValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware");
52
60
  Object.defineProperty(exports, "genZodEventValidationMiddleware", { enumerable: true, get: function () { return genZodEventValidationMiddleware_1.genZodEventValidationMiddleware; } });
61
+ /**
62
+ * .what = the shared `request.context` reader every exported middleware uses
63
+ * .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
64
+ * the lambda context. a consumer who authors a PEER of the exported middlewares would
65
+ * otherwise restate that cast — the exact sprawl this reader exists to retire
66
+ * (rule.forbid.as-cast)
67
+ */
68
+ var asContextTrailed_1 = require("./domain.operations/genLambdaEndpoint/middleware/asContextTrailed");
69
+ Object.defineProperty(exports, "asContextTrailed", { enumerable: true, get: function () { return asContextTrailed_1.asContextTrailed; } });
53
70
  var genConstraintErrorMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware");
54
71
  Object.defineProperty(exports, "genConstraintErrorMiddleware", { enumerable: true, get: function () { return genConstraintErrorMiddleware_1.genConstraintErrorMiddleware; } });
72
+ var genInternalServiceErrorMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware");
73
+ Object.defineProperty(exports, "genInternalServiceErrorMiddleware", { enumerable: true, get: function () { return genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware; } });
55
74
  var genIntrospectionMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware");
56
75
  Object.defineProperty(exports, "genIntrospectionMiddleware", { enumerable: true, get: function () { return genIntrospectionMiddleware_1.genIntrospectionMiddleware; } });
57
76
  var genIoLoggerMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AASxB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JA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C,OAAA;AAC1C,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AACnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AAoBzC,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sdk-aws-lambda",
3
3
  "author": "ehmpathy",
4
4
  "description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "repository": "ehmpathy/sdk-aws-lambda",
7
7
  "homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
8
8
  "keywords": [
@@ -45,11 +45,11 @@
45
45
  "test:lint:biome": "biome check --diagnostic-level=error",
46
46
  "test:lint:biome:all": "biome check",
47
47
  "test:lint": "npm run test:lint:biome && npm run test:lint:deps",
48
- "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
49
- "test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
50
- "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
48
+ "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ \"${THOROUGH:-}\" != \"true\" ] && echo '--changedSince=origin/main') $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
49
+ "test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ \"${THOROUGH:-}\" != \"true\" ] && echo '--changedSince=origin/main') $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
50
+ "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
51
51
  "test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
52
- "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
52
+ "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
53
53
  "prepush": "npm run test && npm run build",
54
54
  "prepublish": "npm run build",
55
55
  "preversion": "npm run prepush",
@@ -73,6 +73,7 @@
73
73
  "sdk-environment": "0.1.5",
74
74
  "sdk-logs": "0.9.0",
75
75
  "simple-in-memory-cache": "0.4.0",
76
+ "type-fns": "1.21.4",
76
77
  "with-simple-cache": "0.15.3",
77
78
  "zod": "4.4.3"
78
79
  },
@@ -99,13 +100,13 @@
99
100
  "esbuild-register": "3.6.0",
100
101
  "husky": "8.0.3",
101
102
  "jest": "30.2.0",
102
- "rhachet": "1.43.1",
103
- "rhachet-brains-anthropic": "0.4.1",
104
- "rhachet-brains-fireworksai": "0.1.3",
103
+ "rhachet": "1.47.5",
104
+ "rhachet-brains-anthropic": "0.4.3",
105
+ "rhachet-brains-fireworksai": "0.1.6",
105
106
  "rhachet-brains-xai": "0.3.3",
106
- "rhachet-roles-bhrain": "0.30.2",
107
- "rhachet-roles-bhuild": "0.21.25",
108
- "rhachet-roles-ehmpathy": "1.38.1",
107
+ "rhachet-roles-bhrain": "0.34.1",
108
+ "rhachet-roles-bhuild": "0.21.36",
109
+ "rhachet-roles-ehmpathy": "1.38.12",
109
110
  "rhachet-roles-rhachet": "0.1.7",
110
111
  "test-fns": "1.15.8",
111
112
  "tsc-alias": "1.8.10",
package/readme.md CHANGED
@@ -99,11 +99,46 @@ const contracts = await getAllLambdaContracts(
99
99
  // returns: { getUser: {...schema}, getSettings: {...schema} }
100
100
  ```
101
101
 
102
+ # the http wire response
103
+
104
+ `forApiGateway()` handlers own their **exact wire response** — any status, any headers, any body, or
105
+ none at all. return an `ApiGatewayResponse`, and it reaches the wire as written.
106
+
107
+ ```ts
108
+ import { forApiGateway, asApiGatewayResponseSchema } from 'sdk-aws-lambda';
109
+
110
+ export const handler = forApiGateway({
111
+ schema: {
112
+ input: z.any(), // a twilio form blob
113
+ output: asApiGatewayResponseSchema({ body: z.undefined() }),
114
+ },
115
+ invoke: async ({ event }) => ({ status: 204 }), // 204, no body
116
+ });
117
+ ```
118
+
119
+ | return | wire |
120
+ |---|---|
121
+ | `{ body: x }` | 200 + json — the convenient default |
122
+ | `{ status: 204 }` | 204, no body, **no `content-type`** |
123
+ | `{ status: 308, headers: { Location } }` | a redirect |
124
+ | `{ headers: { 'Content-Type': 'text/xml' }, body: xml }` | your bytes, verbatim |
125
+ | `{}` | ⛔ a **compile error** — at least one key is required |
126
+
127
+ set a `Content-Type` yourself and the serializer stands aside, so xml/text reach the wire
128
+ byte-identical. omit it with a body and you get `application/json`.
129
+
130
+ ### schema is required; `z.any()` is the opt-out
131
+
132
+ `schema.output` describes what `invoke` **returns** (the envelope), so
133
+ `asApiGatewayResponseSchema({ body })` wraps a body schema into it. a required field with a visible
134
+ opt-out keeps validation and introspection on one code path, and puts the choice where a reviewer can
135
+ see it.
136
+
102
137
  # features
103
138
 
104
139
  - **genLambdaEndpoint** — define lambda endpoints with validation, log capture, error classification
105
140
  - `genLambdaEndpoint()` — direct invoke (default)
106
- - `forApiGateway()` — http via api gateway
141
+ - `forApiGateway()` — http via api gateway, with full wire-response control (above)
107
142
  - **askLambdaEndpoint** — ask another lambda with typed request/response, automatic trail propagation
108
143
  - **trace-id propagation** — pass `log` and trail.exid auto-threads through the call chain
109
144
  - **introspection** — expose json-schema via `{ introspect: 'schema' }` (prep only)
@@ -111,4 +146,17 @@ const contracts = await getAllLambdaContracts(
111
146
 
112
147
  # docs
113
148
 
114
- see [vision](./.behavior/v2026_05_08.rename/1.vision.yield.md) for detailed contracts and design.
149
+ **this readme is the consumer doc.** the contract, the migration, and the live defects are all
150
+ above — you need read no further to use the package.
151
+
152
+ the links below are **internal design records**, kept for a maintainer who wants the reasons:
153
+
154
+ - ⚠️ they are **not in the npm tarball** (`"files": ["/dist"]`), so they open on github only
155
+ - ⚠️ they are process journals — fulcrum tables, review-round narration, references to briefs that
156
+ live outside this package. they read as a decision log, never as a guide
157
+
158
+ <!-- prettier-ignore -->
159
+ | record | holds |
160
+ |---|---|
161
+ | [the wire-response design](./.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md) | why the contract widened rather than grew a peer, its four named pipeline points, and each deferred defect with its clamp |
162
+ | [the endpoint vocabulary](./.behavior/v2026_05_08.rename/1.vision.yield.md) | how `LambdaEndpoint` and its slug were named |