@nifrajs/core 2.13.0 → 3.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 (177) hide show
  1. package/README.md +4 -0
  2. package/dist/assurance.d.ts +16 -8
  3. package/dist/assurance.d.ts.map +1 -1
  4. package/dist/assurance.js +33 -0
  5. package/dist/assurance.js.map +1 -1
  6. package/dist/binary.d.ts +32 -0
  7. package/dist/binary.d.ts.map +1 -1
  8. package/dist/binary.js +17 -0
  9. package/dist/binary.js.map +1 -1
  10. package/dist/durable-adapters.d.ts.map +1 -1
  11. package/dist/durable-adapters.js +21 -50
  12. package/dist/durable-adapters.js.map +1 -1
  13. package/dist/durable-execution.d.ts.map +1 -1
  14. package/dist/durable-execution.js +49 -69
  15. package/dist/durable-execution.js.map +1 -1
  16. package/dist/edge-kit.d.ts +27 -0
  17. package/dist/edge-kit.d.ts.map +1 -0
  18. package/dist/edge-kit.js +24 -0
  19. package/dist/edge-kit.js.map +1 -0
  20. package/dist/errors.d.ts +1 -1
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/internal/durable-approval-protocol.d.ts +13 -0
  28. package/dist/internal/durable-approval-protocol.d.ts.map +1 -0
  29. package/dist/internal/durable-approval-protocol.js +66 -0
  30. package/dist/internal/durable-approval-protocol.js.map +1 -0
  31. package/dist/internal/durable-effect-protocol.d.ts +14 -0
  32. package/dist/internal/durable-effect-protocol.d.ts.map +1 -0
  33. package/dist/internal/durable-effect-protocol.js +16 -0
  34. package/dist/internal/durable-effect-protocol.js.map +1 -0
  35. package/dist/internal/durable-saga-protocol.d.ts +8 -0
  36. package/dist/internal/durable-saga-protocol.d.ts.map +1 -0
  37. package/dist/internal/durable-saga-protocol.js +21 -0
  38. package/dist/internal/durable-saga-protocol.js.map +1 -0
  39. package/dist/internal/route-catalog.d.ts +3 -0
  40. package/dist/internal/route-catalog.d.ts.map +1 -1
  41. package/dist/internal/route-catalog.js +5 -0
  42. package/dist/internal/route-catalog.js.map +1 -1
  43. package/dist/internal/route-execution.d.ts +11 -5
  44. package/dist/internal/route-execution.d.ts.map +1 -1
  45. package/dist/internal/route-execution.js +2 -1
  46. package/dist/internal/route-execution.js.map +1 -1
  47. package/dist/response-observer.d.ts +25 -0
  48. package/dist/response-observer.d.ts.map +1 -0
  49. package/dist/response-observer.js +40 -0
  50. package/dist/response-observer.js.map +1 -0
  51. package/dist/security/baseline.d.ts +68 -0
  52. package/dist/security/baseline.d.ts.map +1 -0
  53. package/dist/security/baseline.js +118 -0
  54. package/dist/security/baseline.js.map +1 -0
  55. package/dist/server/bare-error-lane.d.ts +26 -0
  56. package/dist/server/bare-error-lane.d.ts.map +1 -0
  57. package/dist/server/bare-error-lane.js +60 -0
  58. package/dist/server/bare-error-lane.js.map +1 -0
  59. package/dist/server/body.d.ts +7 -0
  60. package/dist/server/body.d.ts.map +1 -1
  61. package/dist/server/body.js +7 -0
  62. package/dist/server/body.js.map +1 -1
  63. package/dist/server/bridge-markers.d.ts +25 -0
  64. package/dist/server/bridge-markers.d.ts.map +1 -0
  65. package/dist/server/bridge-markers.js +25 -0
  66. package/dist/server/bridge-markers.js.map +1 -0
  67. package/dist/server/context.d.ts +6 -1
  68. package/dist/server/context.d.ts.map +1 -1
  69. package/dist/server/header-case.d.ts.map +1 -1
  70. package/dist/server/header-case.js +2 -1
  71. package/dist/server/header-case.js.map +1 -1
  72. package/dist/server/http.d.ts +36 -3
  73. package/dist/server/http.d.ts.map +1 -1
  74. package/dist/server/http.js +49 -3
  75. package/dist/server/http.js.map +1 -1
  76. package/dist/server/install.d.ts +6 -8
  77. package/dist/server/install.d.ts.map +1 -1
  78. package/dist/server/install.js +7 -0
  79. package/dist/server/install.js.map +1 -1
  80. package/dist/server/node-outcome-hook.d.ts +2 -1
  81. package/dist/server/node-outcome-hook.d.ts.map +1 -1
  82. package/dist/server/node-outcome-hook.js.map +1 -1
  83. package/dist/server/node-outcome.d.ts +17 -2
  84. package/dist/server/node-outcome.d.ts.map +1 -1
  85. package/dist/server/node-outcome.js +37 -3
  86. package/dist/server/node-outcome.js.map +1 -1
  87. package/dist/server/plugin.d.ts +1 -1
  88. package/dist/server/plugin.d.ts.map +1 -1
  89. package/dist/server/query.d.ts +7 -1
  90. package/dist/server/query.d.ts.map +1 -1
  91. package/dist/server/query.js +8 -3
  92. package/dist/server/query.js.map +1 -1
  93. package/dist/server/registry.d.ts +11 -2
  94. package/dist/server/registry.d.ts.map +1 -1
  95. package/dist/server/request-context.d.ts +17 -4
  96. package/dist/server/request-context.d.ts.map +1 -1
  97. package/dist/server/request-context.js +82 -45
  98. package/dist/server/request-context.js.map +1 -1
  99. package/dist/server/respond.d.ts.map +1 -1
  100. package/dist/server/respond.js +19 -2
  101. package/dist/server/respond.js.map +1 -1
  102. package/dist/server/response-contract-lane.d.ts.map +1 -1
  103. package/dist/server/response-contract-lane.js +5 -2
  104. package/dist/server/response-contract-lane.js.map +1 -1
  105. package/dist/server/response-observer-runtime.d.ts +20 -0
  106. package/dist/server/response-observer-runtime.d.ts.map +1 -0
  107. package/dist/server/response-observer-runtime.js +95 -0
  108. package/dist/server/response-observer-runtime.js.map +1 -0
  109. package/dist/server/runtime-core.d.ts +60 -0
  110. package/dist/server/runtime-core.d.ts.map +1 -1
  111. package/dist/server/runtime-core.js +65 -1
  112. package/dist/server/runtime-core.js.map +1 -1
  113. package/dist/server/server-types.d.ts +18 -1
  114. package/dist/server/server-types.d.ts.map +1 -1
  115. package/dist/server/server.d.ts +89 -48
  116. package/dist/server/server.d.ts.map +1 -1
  117. package/dist/server/server.js +397 -276
  118. package/dist/server/server.js.map +1 -1
  119. package/dist/server/websocket.d.ts +20 -4
  120. package/dist/server/websocket.d.ts.map +1 -1
  121. package/dist/server/websocket.js +81 -11
  122. package/dist/server/websocket.js.map +1 -1
  123. package/dist/server/ws-bun.d.ts +1 -1
  124. package/dist/server/ws-bun.d.ts.map +1 -1
  125. package/dist/server/ws-bun.js +12 -8
  126. package/dist/server/ws-bun.js.map +1 -1
  127. package/dist/server.d.ts +2 -1
  128. package/dist/server.d.ts.map +1 -1
  129. package/dist/server.js +2 -1
  130. package/dist/server.js.map +1 -1
  131. package/dist/single-copy-register.d.ts +2 -0
  132. package/dist/single-copy-register.d.ts.map +1 -0
  133. package/dist/single-copy-register.js +24 -0
  134. package/dist/single-copy-register.js.map +1 -0
  135. package/dist/single-copy.d.ts +156 -0
  136. package/dist/single-copy.d.ts.map +1 -0
  137. package/dist/single-copy.js +470 -0
  138. package/dist/single-copy.js.map +1 -0
  139. package/package.json +24 -2
  140. package/src/assurance.ts +58 -1
  141. package/src/binary.ts +35 -0
  142. package/src/durable-adapters.ts +26 -51
  143. package/src/durable-execution.ts +46 -88
  144. package/src/edge-kit.ts +27 -0
  145. package/src/errors.ts +1 -0
  146. package/src/index.ts +1 -1
  147. package/src/internal/durable-approval-protocol.ts +92 -0
  148. package/src/internal/durable-effect-protocol.ts +37 -0
  149. package/src/internal/durable-saga-protocol.ts +55 -0
  150. package/src/internal/route-catalog.ts +6 -0
  151. package/src/internal/route-execution.ts +23 -16
  152. package/src/response-observer.ts +64 -0
  153. package/src/security/baseline.ts +172 -0
  154. package/src/server/bare-error-lane.ts +76 -0
  155. package/src/server/body.ts +8 -0
  156. package/src/server/bridge-markers.ts +24 -0
  157. package/src/server/context.ts +6 -1
  158. package/src/server/header-case.ts +3 -1
  159. package/src/server/http.ts +53 -3
  160. package/src/server/install.ts +14 -0
  161. package/src/server/node-outcome-hook.ts +2 -1
  162. package/src/server/node-outcome.ts +44 -3
  163. package/src/server/plugin.ts +1 -1
  164. package/src/server/query.ts +10 -4
  165. package/src/server/registry.ts +19 -4
  166. package/src/server/request-context.ts +106 -51
  167. package/src/server/respond.ts +26 -1
  168. package/src/server/response-contract-lane.ts +6 -2
  169. package/src/server/response-observer-runtime.ts +135 -0
  170. package/src/server/runtime-core.ts +98 -1
  171. package/src/server/server-types.ts +18 -1
  172. package/src/server/server.ts +607 -376
  173. package/src/server/websocket.ts +127 -17
  174. package/src/server/ws-bun.ts +26 -7
  175. package/src/server.ts +2 -1
  176. package/src/single-copy-register.ts +24 -0
  177. package/src/single-copy.ts +524 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Edge kit - the moat-neutral free functions a compact fetch-handler server needs to enforce the
3
+ * SAME request trust boundary the full `Server` does, without pulling in the full builder.
4
+ *
5
+ * A minimal edge entrypoint (`@nifrajs/edge`) is not allowed to re-derive the body lane: the assembly
6
+ * order of the content-type dispatch, the bounded read, the Content-Length pre-reject, and the
7
+ * prototype-poisoning guard is a security contract, and a second copy of it would drift. This subpath
8
+ * exposes the one lane the fused body runner already calls, so a compact server reuses it verbatim:
9
+ *
10
+ * - {@link readBodyFramed} read + cap + proto-guard + content-type framing (JSON / urlencoded / 415)
11
+ * - {@link toResponse} render a {@link ResponseResult} (e.g. a 413 / 415 rejection) to a `Response`
12
+ * - {@link plainError} the structured rejection envelope the lane returns
13
+ * - {@link queryObjectOf} / {@link searchOf} query parse without a full WHATWG URL construction
14
+ *
15
+ * Everything here carries only structure - bytes, guards, and envelopes - never routing, lifecycle,
16
+ * or app state. It is the interface, not the framework.
17
+ */
18
+ export { plainError } from "./server/http.js";
19
+ export type { ProtoPoisoning } from "./server/proto-guard.js";
20
+ export { type QueryValue, queryObjectOf, searchOf } from "./server/query.js";
21
+ export { readBodyFramed } from "./server/request-context.js";
22
+ export { toResponse } from "./server/respond.js";
23
+ export type { ResponseResult } from "./server/runtime-core.js";
24
+ export { EMPTY_RESPONSE_CONTROLS } from "./server/runtime-core.js";
25
+ export type { CtxSet, MaybePromise, RequestSource } from "./server/server.js";
26
+ export { plainValidationError } from "./server/server.js";
27
+ //# sourceMappingURL=edge-kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-kit.d.ts","sourceRoot":"","sources":["../src/edge-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Edge kit - the moat-neutral free functions a compact fetch-handler server needs to enforce the
3
+ * SAME request trust boundary the full `Server` does, without pulling in the full builder.
4
+ *
5
+ * A minimal edge entrypoint (`@nifrajs/edge`) is not allowed to re-derive the body lane: the assembly
6
+ * order of the content-type dispatch, the bounded read, the Content-Length pre-reject, and the
7
+ * prototype-poisoning guard is a security contract, and a second copy of it would drift. This subpath
8
+ * exposes the one lane the fused body runner already calls, so a compact server reuses it verbatim:
9
+ *
10
+ * - {@link readBodyFramed} read + cap + proto-guard + content-type framing (JSON / urlencoded / 415)
11
+ * - {@link toResponse} render a {@link ResponseResult} (e.g. a 413 / 415 rejection) to a `Response`
12
+ * - {@link plainError} the structured rejection envelope the lane returns
13
+ * - {@link queryObjectOf} / {@link searchOf} query parse without a full WHATWG URL construction
14
+ *
15
+ * Everything here carries only structure - bytes, guards, and envelopes - never routing, lifecycle,
16
+ * or app state. It is the interface, not the framework.
17
+ */
18
+ export { plainError } from "./server/http.js";
19
+ export { queryObjectOf, searchOf } from "./server/query.js";
20
+ export { readBodyFramed } from "./server/request-context.js";
21
+ export { toResponse } from "./server/respond.js";
22
+ export { EMPTY_RESPONSE_CONTROLS } from "./server/runtime-core.js";
23
+ export { plainValidationError } from "./server/server.js";
24
+ //# sourceMappingURL=edge-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-kit.js","sourceRoot":"","sources":["../src/edge-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAmB,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
package/dist/errors.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare class FrameworkError extends Error {
8
8
  constructor(code: string, message: string);
9
9
  }
10
10
  /** Stable codes for boot-time (L2) route configuration failures. */
11
- export type RouteConfigErrorCode = "DUPLICATE_ROUTE" | "DUPLICATE_PARAM" | "PARAM_NAME_CONFLICT" | "INVALID_PATH" | "INVALID_PARAM_NAME" | "WILDCARD_NOT_LAST" | "INVALID_METHOD" | "INVALID_ASSURANCE" | "INVALID_IDEMPOTENCY" | "INVALID_BODY_LIMIT";
11
+ export type RouteConfigErrorCode = "DUPLICATE_ROUTE" | "DUPLICATE_PARAM" | "PARAM_NAME_CONFLICT" | "INVALID_PATH" | "INVALID_PARAM_NAME" | "WILDCARD_NOT_LAST" | "INVALID_METHOD" | "INVALID_ASSURANCE" | "INVALID_IDEMPOTENCY" | "INVALID_WS_SEND_VALIDATION" | "INVALID_BODY_LIMIT";
12
12
  /**
13
13
  * Thrown at route registration when a route is misconfigured. This is the
14
14
  * boot-time rejection layer: loud and early,
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,cAAc,GACd,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,oBAAoB,CAAA;AAExB;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAElD,SAAiB,IAAI,EAAE,oBAAoB,CAAA;gBAE/B,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM;CAIxD"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,cAAc,GACd,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,4BAA4B,GAC5B,oBAAoB,CAAA;AAExB;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAElD,SAAiB,IAAI,EAAE,oBAAoB,CAAA;gBAE/B,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM;CAIxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAQ;IAErB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC,CAAA;QACvC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAeD;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IAIlD,YAAY,IAA0B,EAAE,OAAe;QACrD,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAQ;IAErB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC,CAAA;QACvC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAgBD;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IAIlD,YAAY,IAA0B,EAAE,OAAe;QACrD,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and
10
10
  * `check:publish` asserts it equals `@nifrajs/core`'s package version.
11
11
  */
12
- export declare const VERSION: "2.13.0";
12
+ export declare const VERSION: "3.1.0";
13
13
  export type Version = typeof VERSION;
14
14
  export * from "./server.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAG,QAAiB,CAAA;AAExC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AAEpC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAG,OAAgB,CAAA;AAEvC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AAEpC,cAAc,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -9,6 +9,6 @@
9
9
  * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and
10
10
  * `check:publish` asserts it equals `@nifrajs/core`'s package version.
11
11
  */
12
- export const VERSION = "2.13.0";
12
+ export const VERSION = "3.1.0";
13
13
  export * from "./server.js";
14
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAiB,CAAA;AAIxC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAgB,CAAA;AAIvC,cAAc,aAAa,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { ApprovalConsumeResult, ApprovalRecord, ApprovalStore } from "../durable-execution.js";
2
+ export type DurableApprovalDecisionInput = Parameters<ApprovalStore["decide"]>[0];
3
+ export type DurableApprovalConsumeInput = Parameters<ApprovalStore["consume"]>[0];
4
+ export interface DurableApprovalConsumeTransition {
5
+ readonly result: ApprovalConsumeResult;
6
+ readonly next?: ApprovalRecord;
7
+ }
8
+ export interface DurableApprovalProtocol {
9
+ decide(current: ApprovalRecord | undefined, input: DurableApprovalDecisionInput): ApprovalRecord | undefined;
10
+ consume(current: ApprovalRecord | undefined, input: DurableApprovalConsumeInput): DurableApprovalConsumeTransition;
11
+ }
12
+ export declare const durableApprovalProtocol: DurableApprovalProtocol;
13
+ //# sourceMappingURL=durable-approval-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-approval-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/durable-approval-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGnG,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjF,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAA;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CACJ,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,KAAK,EAAE,4BAA4B,GAClC,cAAc,GAAG,SAAS,CAAA;IAC7B,OAAO,CACL,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,KAAK,EAAE,2BAA2B,GACjC,gCAAgC,CAAA;CACpC;AAoED,eAAO,MAAM,uBAAuB,EAAE,uBAGpC,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { safeEqual } from "./safe-equal.js";
2
+ function decideApproval(current, input) {
3
+ if (current === undefined ||
4
+ current.tenantId !== input.tenantId ||
5
+ current.state !== "pending" ||
6
+ current.expiresAt <= input.now) {
7
+ return undefined;
8
+ }
9
+ return Object.freeze({
10
+ ...current,
11
+ state: input.decision,
12
+ decidedBy: input.decidedBy,
13
+ updatedAt: input.now,
14
+ version: current.version + 1,
15
+ });
16
+ }
17
+ function consumeApproval(current, input) {
18
+ if (current === undefined)
19
+ return { result: { state: "missing" } };
20
+ if (current.tenantId !== input.tenantId ||
21
+ current.principalId !== input.principalId ||
22
+ current.capability !== input.capability ||
23
+ current.target !== input.target ||
24
+ !safeEqual(current.digest, input.digest)) {
25
+ return { result: { state: "binding" } };
26
+ }
27
+ if (!safeEqual(current.tokenHash, input.tokenHash))
28
+ return { result: { state: "token" } };
29
+ if (current.state === "consumed")
30
+ return { result: { state: "replay" } };
31
+ if (current.state === "denied")
32
+ return { result: { state: "denied" } };
33
+ if (current.state === "pending")
34
+ return { result: { state: "pending" } };
35
+ if (current.state === "expired" || current.expiresAt <= input.now) {
36
+ return {
37
+ result: { state: "expired" },
38
+ ...(current.state === "expired"
39
+ ? {}
40
+ : {
41
+ next: Object.freeze({
42
+ ...current,
43
+ state: "expired",
44
+ updatedAt: input.now,
45
+ version: current.version + 1,
46
+ }),
47
+ }),
48
+ };
49
+ }
50
+ if (current.state !== "approved")
51
+ return { result: { state: "token" } };
52
+ return {
53
+ result: { state: "consumed" },
54
+ next: Object.freeze({
55
+ ...current,
56
+ state: "consumed",
57
+ updatedAt: input.now,
58
+ version: current.version + 1,
59
+ }),
60
+ };
61
+ }
62
+ export const durableApprovalProtocol = Object.freeze({
63
+ decide: decideApproval,
64
+ consume: consumeApproval,
65
+ });
66
+ //# sourceMappingURL=durable-approval-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-approval-protocol.js","sourceRoot":"","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,MAAM,CAAC,MAAM,uBAAuB,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC5E,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { DurableEffectRecord, DurableEffectState } from "../durable-execution.js";
2
+ export interface DurableEffectTransitionInput {
3
+ readonly effectId: string;
4
+ readonly version: number;
5
+ readonly from: DurableEffectState;
6
+ readonly to: DurableEffectState;
7
+ readonly updatedAt: number;
8
+ readonly errorCode?: string;
9
+ }
10
+ export interface DurableEffectProtocol {
11
+ transition(current: DurableEffectRecord | undefined, input: DurableEffectTransitionInput): DurableEffectRecord | undefined;
12
+ }
13
+ export declare const durableEffectProtocol: DurableEffectProtocol;
14
+ //# sourceMappingURL=durable-effect-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-effect-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/durable-effect-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEtF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;IACjC,QAAQ,CAAC,EAAE,EAAE,kBAAkB,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,CACR,OAAO,EAAE,mBAAmB,GAAG,SAAS,EACxC,KAAK,EAAE,4BAA4B,GAClC,mBAAmB,GAAG,SAAS,CAAA;CACnC;AAkBD,eAAO,MAAM,qBAAqB,EAAE,qBAElC,CAAA"}
@@ -0,0 +1,16 @@
1
+ function transitionEffect(current, input) {
2
+ if (current === undefined || current.version !== input.version || current.state !== input.from) {
3
+ return undefined;
4
+ }
5
+ return Object.freeze({
6
+ ...current,
7
+ state: input.to,
8
+ updatedAt: input.updatedAt,
9
+ version: current.version + 1,
10
+ ...(input.errorCode === undefined ? {} : { errorCode: input.errorCode }),
11
+ });
12
+ }
13
+ export const durableEffectProtocol = Object.freeze({
14
+ transition: transitionEffect,
15
+ });
16
+ //# sourceMappingURL=durable-effect-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-effect-protocol.js","sourceRoot":"","sources":["../../src/internal/durable-effect-protocol.ts"],"names":[],"mappings":"AAkBA,SAAS,gBAAgB,CACvB,OAAwC,EACxC,KAAmC;IAEnC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;QAC/F,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,OAAO;QACV,KAAK,EAAE,KAAK,CAAC,EAAE;QACf,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,CAAC;QAC5B,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;KACzE,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAA0B,MAAM,CAAC,MAAM,CAAC;IACxE,UAAU,EAAE,gBAAgB;CAC7B,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { SagaRecord, SagaState, SagaStepRecord, SagaStore } from "../durable-execution.js";
2
+ export type DurableSagaTransitionInput = Parameters<SagaStore["compareAndSet"]>[0];
3
+ export interface DurableSagaProtocol {
4
+ transition(current: SagaRecord | undefined, input: DurableSagaTransitionInput): SagaRecord | undefined;
5
+ withStep(record: SagaRecord, index: number, step: SagaStepRecord, state: SagaState, updatedAt: number): Omit<SagaRecord, "version">;
6
+ }
7
+ export declare const durableSagaProtocol: DurableSagaProtocol;
8
+ //# sourceMappingURL=durable-saga-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-saga-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/durable-saga-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAE/F,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAElF,MAAM,WAAW,mBAAmB;IAClC,UAAU,CACR,OAAO,EAAE,UAAU,GAAG,SAAS,EAC/B,KAAK,EAAE,0BAA0B,GAChC,UAAU,GAAG,SAAS,CAAA;IACzB,QAAQ,CACN,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;CAC/B;AAmCD,eAAO,MAAM,mBAAmB,EAAE,mBAGhC,CAAA"}
@@ -0,0 +1,21 @@
1
+ function transitionSaga(current, input) {
2
+ if (input.record.version !== input.version + 1 ||
3
+ (current !== undefined &&
4
+ (current.sagaId !== input.sagaId || current.version !== input.version))) {
5
+ return undefined;
6
+ }
7
+ return Object.freeze({ ...input.record });
8
+ }
9
+ function withSagaStep(record, index, step, state, updatedAt) {
10
+ return {
11
+ ...record,
12
+ state,
13
+ steps: Object.freeze(record.steps.map((candidate, candidateIndex) => candidateIndex === index ? Object.freeze(step) : candidate)),
14
+ updatedAt,
15
+ };
16
+ }
17
+ export const durableSagaProtocol = Object.freeze({
18
+ transition: transitionSaga,
19
+ withStep: withSagaStep,
20
+ });
21
+ //# sourceMappingURL=durable-saga-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-saga-protocol.js","sourceRoot":"","sources":["../../src/internal/durable-saga-protocol.ts"],"names":[],"mappings":"AAkBA,SAAS,cAAc,CACrB,OAA+B,EAC/B,KAAiC;IAEjC,IACE,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,GAAG,CAAC;QAC1C,CAAC,OAAO,KAAK,SAAS;YACpB,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,EACzE,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,YAAY,CACnB,MAAkB,EAClB,KAAa,EACb,IAAoB,EACpB,KAAgB,EAChB,SAAiB;IAEjB,OAAO;QACL,GAAG,MAAM;QACT,KAAK;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,CAC7C,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAC3D,CACF;QACD,SAAS;KACV,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAwB,MAAM,CAAC,MAAM,CAAC;IACpE,UAAU,EAAE,cAAc;IAC1B,QAAQ,EAAE,YAAY;CACvB,CAAC,CAAA"}
@@ -51,6 +51,9 @@ export declare class RouteCatalog {
51
51
  addBatch(routes: readonly CatalogRoute[]): void;
52
52
  find(method: string, path: string): RouterMatch<RouteEntry>;
53
53
  entries(): readonly CatalogRoute[];
54
+ /** Number of registered routes. Read at hook push time and at seal to detect an order-scoped hook
55
+ * that captured no route (see `Server.sealConfiguration`). */
56
+ get size(): number;
54
57
  routeDescriptors(): ReadonlyArray<RouteDescriptor>;
55
58
  lastDescriptor(): RouteDescriptor | undefined;
56
59
  hasAssurance(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"route-catalog.d.ts","sourceRoot":"","sources":["../../src/internal/route-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,KAAK,MAAM,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD;sFACsF;AACtF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAA;IACtC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAA;CACpD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,OAAO,CAAqB;IACpC,qGAAqG;IACrG,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,gBAAgB,CAAQ;IAEhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAO9B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,I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QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI;IAe/C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,UAAU,CAAC;IAI3D,OAAO,IAAI,SAAS,YAAY,EAAE;IAIlC;kEAC8D;IAC9D,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,gBAAgB,IAAI,aAAa,CAAC,eAAe,CAAC;IAIlD,cAAc,IAAI,eAAe,GAAG,SAAS;IAI7C,YAAY,IAAI,OAAO;CAGxB"}
@@ -45,6 +45,11 @@ export class RouteCatalog {
45
45
  entries() {
46
46
  return this.records;
47
47
  }
48
+ /** Number of registered routes. Read at hook push time and at seal to detect an order-scoped hook
49
+ * that captured no route (see `Server.sealConfiguration`). */
50
+ get size() {
51
+ return this.records.length;
52
+ }
48
53
  routeDescriptors() {
49
54
  return this.descriptors;
50
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"route-catalog.js","sourceRoot":"","sources":["../../src/internal/route-catalog.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAe,MAAM,EAAoB,MAAM,qBAAqB,CAAA;AAgB3E;;;;;;;;;;GAUG;AACH,MAAM,OAAO,YAAY;IACf,OAAO,GAAG,IAAI,MAAM,EAAc,CAAA;IAClC,OAAO,GAAmB,EAAE,CAAA;IACpC,qGAAqG;IAC7F,WAAW,GAAsB,EAAE,CAAA;IACnC,gBAAgB,GAAG,KAAK,CAAA;IAEhC,GAAG,CAAC,KAAmB;QACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACvC,IAAI,KAAK,CAAC,SAAS,CAAC,M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AU,CAAA;IAC1D,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;CACF"}
@@ -23,7 +23,7 @@ import type { ResolvedIdempotency } from "../server/idempotency-lane.js";
23
23
  import type { ResolvedEffectLedger } from "../server/ledger-lane.js";
24
24
  import type { Registry } from "../server/registry.js";
25
25
  import type { ResponseContractRuntime } from "../server/response-contract-lane.js";
26
- import type { HandlerResult } from "../server/runtime-core.js";
26
+ import type { HandlerResult, ResponseResult } from "../server/runtime-core.js";
27
27
  import type { CtxSet, MaybePromise, RawContext, RequestSource, Server } from "../server/server.js";
28
28
  export type InternalHandler = (ctx: RawContext) => MaybePromise<HandlerResult>;
29
29
  /** A `derive` computes per-request context extensions; stored path-erased. */
@@ -32,8 +32,8 @@ export type RawBeforeHandle = (ctx: RawContext) => MaybePromise<unknown>;
32
32
  export type RawAfterHandle = (result: unknown, ctx: RawContext) => MaybePromise<unknown>;
33
33
  export type RawErrorHandler = (error: unknown, ctx: RawContext) => MaybePromise<unknown>;
34
34
  export type RawAround = <T>(ctx: RawContext, next: () => MaybePromise<T>) => MaybePromise<T>;
35
- export type RouteExecutionRunner = <T, R extends Registry, Ctx>(runtime: Server<R, Ctx>, entry: RouteEntry, source: RequestSource, params: Record<string, string>, search: string | undefined, signal: AbortSignal, budget: RequestBudget, platform: Platform | undefined, nativeContext: boolean, finalize: (result: unknown, set: CtxSet) => T, wrapResponse: (response: Response) => T) => MaybePromise<T>;
36
- export type ContextRouteRunner = <T, R extends Registry, Ctx>(runtime: Server<R, Ctx>, entry: RouteEntry, source: RequestSource, ctx: RawContext, finalize: (result: unknown, set: CtxSet) => T, wrapResponse: (response: Response) => T) => MaybePromise<T>;
35
+ export type RouteExecutionRunner = <T, R extends Registry, Ctx>(runtime: Server<R, Ctx>, entry: RouteEntry, source: RequestSource, params: Record<string, string>, search: string | undefined, signal: AbortSignal, budget: RequestBudget, platform: Platform | undefined, nativeContext: boolean, finalize: (result: unknown, set: CtxSet) => T, wrapResponse: (response: Response | ResponseResult) => T) => MaybePromise<T>;
36
+ export type ContextRouteRunner = <T, R extends Registry, Ctx>(runtime: Server<R, Ctx>, entry: RouteEntry, source: RequestSource, ctx: RawContext, finalize: (result: unknown, set: CtxSet) => T, wrapResponse: (response: Response | ResponseResult) => T) => MaybePromise<T>;
37
37
  export type RouteExecutionLane = "bare" | "body" | "query" | "lifecycle";
38
38
  export type LifecycleExecutionLane = "hooks" | "query" | "body" | "body-query" | undefined;
39
39
  /** Compile the one immutable route decision at registration time. The request path only invokes the
@@ -64,7 +64,13 @@ export interface RouteExecutionPlan {
64
64
  export interface RouteEntry {
65
65
  readonly handler: InternalHandler;
66
66
  readonly schema: RouteSchema | undefined;
67
- /** Effective transport body cap; `undefined` is an explicit streaming/upload exemption. */
67
+ /**
68
+ * Effective transport body cap, already resolved at registration: the route's own
69
+ * `schema.bodyLimit` when it declared one, the server's `maxBodyBytes` otherwise. `undefined` is
70
+ * an explicit streaming/upload exemption (`bodyLimit: "unlimited"`) and means NO cap - readers
71
+ * must fall back to {@link UNLIMITED_BODY_BYTES}, never to the server default, which would be a
72
+ * tighter bound than the route asked for.
73
+ */
68
74
  readonly bodyLimit: number | undefined;
69
75
  /** Resolved idempotency config; `undefined` = off (the dedupe lane is never entered). */
70
76
  readonly idempotent: ResolvedIdempotency | undefined;
@@ -99,5 +105,5 @@ export interface RouteEntry {
99
105
  export type FusedWebRunner = (source: RequestSource, params: Record<string, string>, search: string | undefined, signal: AbortSignal, budget: RequestBudget, platform: Platform | undefined, nativeContext: boolean) => MaybePromise<Response>;
100
106
  /** Registration-compiled body lane. The finalizer receives the live context so Web can preserve lazy
101
107
  * response controls while Node can emit its native outcome directly. */
102
- export type FusedBodyRunner = <T>(source: RequestSource, params: Record<string, string>, search: string | undefined, signal: AbortSignal, budget: RequestBudget, platform: Platform | undefined, nativeContext: boolean, finalize: (result: unknown, set: CtxSet, ctx: RawContext) => T, wrapResponse: (response: Response) => T) => MaybePromise<T>;
108
+ export type FusedBodyRunner = <T>(source: RequestSource, params: Record<string, string>, search: string | undefined, signal: AbortSignal, budget: RequestBudget, platform: Platform | undefined, nativeContext: boolean, finalize: (result: unknown, set: CtxSet, ctx: RawContext) => T, wrapResponse: (response: Response | ResponseResult) => T) => MaybePromise<T>;
103
109
  //# sourceMappingURL=route-execution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route-execution.d.ts","sourceRoot":"","sources":["../../src/internal/route-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAEzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAElG,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,aAAa,CAAC,CAAA;AAE9E,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,MAAM,CAAC,CAAA;AACjE,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,OAAO,CAAC,CAAA;AACxE,MAAM,MA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,CAAC,SAAS,CAAC,CAAA;IACzC,uGAAuG;IACvG,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;CACvC;AAED,mGAAmG;AACnG,MAAM,MAAM,cAAc,GAAG,CAC3B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,aAAa,EAAE,OAAO,KACnB,YAAY,CAAC,QAAQ,CAAC,CAAA;AAE3B;wEACwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAC9B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,aAAa,EAAE,OAAO,EACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,KAAK,CAAC,EAC9D,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,KAAK,CAAC,KACrD,YAAY,CAAC,CAAC,CAAC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { UNLIMITED_BODY_BYTES } from "../server/body.js";
1
2
  import { RequestContext } from "../server/request-context.js";
2
3
  /** Compile the one immutable route decision at registration time. The request path only invokes the
3
4
  * selected closure; it never repeats this eligibility ladder. The closures reach the kernel's private
@@ -43,7 +44,7 @@ export function compileRouteExecutionPlan(options) {
43
44
  : inner;
44
45
  const run = (runtime, entry, source, params, search, signal, budget, platform, nativeContext, finalize, wrapResponse) => {
45
46
  const server = runtime;
46
- const maxBodyBytes = entry.bodyLimit ?? server.maxBodyBytes;
47
+ const maxBodyBytes = entry.bodyLimit ?? UNLIMITED_BODY_BYTES;
47
48
  const ctx = nativeContext
48
49
  ? RequestContext.native(source, params, search, maxBodyBytes, platform, server.protoPoisoning)
49
50
  : new RequestContext(source, params, search, signal, budget, platform, maxBodyBytes, server.protoPoisoning);
@@ -1 +1 @@
1
- {"version":3,"file":"route-execution.js","sourceRoot":"","sources":["../../src/internal/route-execution.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AA4H7D;;;gFAGgF;AAChF,MAAM,UAAU,yBAAyB,CAAC,OASzC;IACC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAC9F,OAAO,CAAA;IAET,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,GAAG,GAAyB,CAChC,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,EAAE,CACD,OAA4C,CAAC,kBAAkB,CAC9D,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,CACb,CAAA;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,IAAI,KAAyB,CAAA;IAC7B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,KAAK,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,CAC9D,OAA4C,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,CA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AAC;YAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAgC,CAAA;YACvD,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;YACvC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACnC,CAAC;QACD,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;QAC1E,IAAI,MAAM,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,CAAA;YACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAgC,CAAA;YACvD,OAAO,GAAG,CAAC,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACzF,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CACvD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,MAAM,CAAC,CACzD,CACF,CAAA;QACH,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAA;AAC/D,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { AnyServer } from "./server/server.js";
2
+ export type { ResponseBodyHook, ResponseHeadersHook, ResponseObserverMethods, ResponseObserverRuntime, } from "./server/response-observer-runtime.js";
3
+ /** A server shape with the opt-in response observation methods installed. */
4
+ export type ResponseObserverServer<S extends AnyServer> = S & import("./server/response-observer-runtime.js").ResponseObserverMethods;
5
+ /** A plugin that enables response header, body, and raw-response observation methods. */
6
+ export type ResponseObserverPlugin = (<S extends AnyServer>(app: S) => ResponseObserverServer<S>) & {
7
+ readonly pluginName?: string;
8
+ };
9
+ /**
10
+ * Enable the response observation methods on a server.
11
+ *
12
+ * The default server does not carry the header, body, or raw-response observation adapters. Apply
13
+ * this plugin before using those methods:
14
+ *
15
+ * ```ts
16
+ * import { responseObserver } from "@nifrajs/core/response-observer"
17
+ * const app = server().use(responseObserver()).onResponseHeaders((headers) => {
18
+ * headers.set("cache-control", "no-store")
19
+ * })
20
+ * ```
21
+ */
22
+ export declare function responseObserver(): ResponseObserverPlugin;
23
+ /** Attach the opt-in observer runtime to a middleware bundle that uses response observation. */
24
+ export declare function withResponseObserver<T extends object>(middleware: T): T;
25
+ //# sourceMappingURL=response-observer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-observer.d.ts","sourceRoot":"","sources":["../src/response-observer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,uCAAuC,CAAA;AAE9C,6EAA6E;AAC7E,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,GACzD,OAAO,uCAAuC,EAAE,uBAAuB,CAAA;AAEzE,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,CAAC,SAAS,SAAS,EACxD,GAAG,EAAE,CAAC,KACH,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAElE;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAiBzD;AAED,gGAAgG;AAChG,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAOvE"}
@@ -0,0 +1,40 @@
1
+ import { INSTALL_RESPONSE_OBSERVER } from "./server/install.js";
2
+ import { createResponseObserverRuntime, } from "./server/response-observer-runtime.js";
3
+ /**
4
+ * Enable the response observation methods on a server.
5
+ *
6
+ * The default server does not carry the header, body, or raw-response observation adapters. Apply
7
+ * this plugin before using those methods:
8
+ *
9
+ * ```ts
10
+ * import { responseObserver } from "@nifrajs/core/response-observer"
11
+ * const app = server().use(responseObserver()).onResponseHeaders((headers) => {
12
+ * headers.set("cache-control", "no-store")
13
+ * })
14
+ * ```
15
+ */
16
+ export function responseObserver() {
17
+ const apply = (app) => {
18
+ const install = app[INSTALL_RESPONSE_OBSERVER];
19
+ if (typeof install !== "function") {
20
+ throw new TypeError("[nifra] responseObserver() requires a compatible Server");
21
+ }
22
+ const methods = install.call(app, createResponseObserverRuntime());
23
+ if (methods === null || typeof methods !== "object") {
24
+ throw new TypeError("[nifra] responseObserver() failed to install its methods");
25
+ }
26
+ Object.assign(app, methods);
27
+ return app;
28
+ };
29
+ return Object.assign(apply, { pluginName: "nifra:response-observer" });
30
+ }
31
+ /** Attach the opt-in observer runtime to a middleware bundle that uses response observation. */
32
+ export function withResponseObserver(middleware) {
33
+ Object.defineProperty(middleware, INSTALL_RESPONSE_OBSERVER, {
34
+ value: createResponseObserverRuntime(),
35
+ enumerable: false,
36
+ configurable: false,
37
+ });
38
+ return middleware;
39
+ }
40
+ //# sourceMappingURL=response-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-observer.js","sourceRoot":"","sources":["../src/response-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,6BAA6B,GAE9B,MAAM,uCAAuC,CAAA;AAmB9C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAAG,CAAsB,GAAM,EAA6B,EAAE;QACvE,MAAM,OAAO,GAAI,GAA0C,CAAC,yBAAyB,CAAC,CAAA;QACtF,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAA;QAChF,CAAC;QACD,MAAM,OAAO,GAAI,OAAyD,CAAC,IAAI,CAC7E,GAAG,EACH,6BAA6B,EAAE,CAChC,CAAA;QACD,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YACpD,MAAM,IAAI,SAAS,CAAC,0DAA0D,CAAC,CAAA;QACjF,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAC3B,OAAO,GAAgC,CAAA;IACzC,CAAC,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACxE,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,oBAAoB,CAAmB,UAAa;IAClE,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,yBAAyB,EAAE;QAC3D,KAAK,EAAE,6BAA6B,EAAE;QACtC,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA;IACF,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { AssurancePolicy } from "../assurance.js";
2
+ /**
3
+ * How much a {@link securityBaseline} demands. Each level is a superset of the one before it, so
4
+ * raising the level only ever adds findings.
5
+ *
6
+ * - `"essential"` - the invariants that hold for ANY app and never false-positive on a reasonable
7
+ * one: a body read must be bounded, an unlimited body may never claim to be bounded, an agent tool
8
+ * ingress must be bounded, and an authenticated state change must prove CSRF. Every required piece
9
+ * of evidence here is either published by the core from the route schema or only demanded when the
10
+ * route already opted into the risk (CSRF is required only where authentication is present). Safe to
11
+ * adopt on day one.
12
+ * - `"standard"` (default) - essential, plus: a route the app itself classified as `pii` or higher
13
+ * must be authenticated, whether it reads or writes. High signal, low noise - it fires only on
14
+ * routes the application already labelled sensitive.
15
+ * - `"strict"` - standard, plus the opinionated, higher-friction requirements: every route must carry
16
+ * a response contract, every read must carry security headers, and every mutation must be rate
17
+ * limited. These need middleware the app has to install, so they are opt-in rather than default.
18
+ */
19
+ export type SecurityBaselineLevel = "essential" | "standard" | "strict";
20
+ /** Tuning for {@link securityBaseline}. Every knob only ever tightens the policy. */
21
+ export interface SecurityBaselineOptions {
22
+ /** How much the baseline demands. Default `"standard"`. See {@link SecurityBaselineLevel}. */
23
+ readonly level?: SecurityBaselineLevel;
24
+ /**
25
+ * How to treat a route no rule matched. Default `"ignore"` so the baseline is purely additive - it
26
+ * asserts the invariants below and stays silent on everything else, which lets a project adopt it
27
+ * without first classifying its whole route table. Set `"error"` to make an unclassified route a
28
+ * finding, turning the baseline into a closed allow-list (recommended once the table is covered).
29
+ */
30
+ readonly unmatched?: "error" | "ignore";
31
+ /**
32
+ * Require that a matched route's evidence was installed by runtime enforcement (middleware/plugin
33
+ * or framework policy) rather than asserted inline on `schema.assurance`. Default `true`: an author
34
+ * label is not proof, and a security baseline that accepts labels is theater. Set `false` only to
35
+ * stage adoption before guards emit runtime evidence.
36
+ */
37
+ readonly requireRuntimeProvenance?: boolean;
38
+ }
39
+ /**
40
+ * A first-match-wins security policy that turns the recurring audit finding classes into machine
41
+ * checked route invariants. Composed only from the public assurance engine, so it inherits its
42
+ * fail-closed evaluation, provenance checks, and selector validation - no bespoke evaluator.
43
+ *
44
+ * The rules are ordered most-specific-first because assurance evaluation is first-match-wins: each
45
+ * route is owned by exactly one rule, so that rule carries the FULL requirement bundle for its class
46
+ * (a body-carrying mutation proves bounded-body AND CSRF in one rule, not two). Raising the `level`
47
+ * widens those bundles; it never reorders them.
48
+ *
49
+ * Coverage by level (see {@link SecurityBaselineLevel} for the rationale):
50
+ *
51
+ * | invariant | essential | standard | strict |
52
+ * | --- | :-: | :-: | :-: |
53
+ * | unlimited body can never be "bounded" (F-001) | ✓ | ✓ | ✓ |
54
+ * | every body read is bounded | ✓ | ✓ | ✓ |
55
+ * | agent tool ingress is bounded | ✓ | ✓ | ✓ |
56
+ * | authenticated mutation proves CSRF | ✓ | ✓ | ✓ |
57
+ * | pii+ route is authenticated | | ✓ | ✓ |
58
+ * | every route carries a response contract | | | ✓ |
59
+ * | every read carries security headers | | | ✓ |
60
+ * | every mutation is rate limited | | | ✓ |
61
+ *
62
+ * The baseline deliberately does not select on `access`/`zone` capabilities: those selectors require
63
+ * capability definitions and would make the preset refuse an app that declares none. Extend the
64
+ * returned policy's `rules` for capability- or path-specific requirements; put more specific rules
65
+ * before these so they own their routes first.
66
+ */
67
+ export declare function securityBaseline(options?: SecurityBaselineOptions): AssurancePolicy;
68
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/security/baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,iBAAiB,CAAA;AAGrE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvE,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAA;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAC5C;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,eAAe,CAgGvF"}