@classytic/arc 2.48.0 → 2.50.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 (213) hide show
  1. package/dist/{EventTransport-BWwg5YAU.mjs → EventTransport-B18mcj_M.mjs} +2 -2
  2. package/dist/{HookSystem-B9x-Y_k7.mjs → HookSystem-FUBaLTRm.mjs} +2 -2
  3. package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
  4. package/dist/{ResourceRegistry-BcvEJoZd.mjs → ResourceRegistry-C5NM07fZ.mjs} +2 -2
  5. package/dist/{acquire-D2yj6Zzl.mjs → acquire-MHCnbDtH.mjs} +1 -1
  6. package/dist/audit/index.d.mts +1 -1
  7. package/dist/audit/index.mjs +4 -4
  8. package/dist/auth/audit.mjs +1 -1
  9. package/dist/auth/index.d.mts +2 -2
  10. package/dist/auth/index.mjs +53 -15
  11. package/dist/auth/redis-session.mjs +1 -1
  12. package/dist/{authorizationDecision-BZSJcPNE.mjs → authorizationDecision-BD8K4jdQ.mjs} +4 -4
  13. package/dist/{boundedMap-o2KZDCWy.mjs → boundedMap-CuCwos_X.mjs} +1 -1
  14. package/dist/{buildHandler-G3k59KY2.mjs → buildHandler-BttjNkTM.mjs} +23 -16
  15. package/dist/cache/index.d.mts +2 -2
  16. package/dist/cache/index.mjs +4 -4
  17. package/dist/{caching-CJIDPZOv.mjs → caching-CxUQLHfR.mjs} +3 -6
  18. package/dist/{claimed-D0A43wjT.mjs → claimed-CQ4ZpD8K.mjs} +1 -1
  19. package/dist/cleanup/index.d.mts +2 -2
  20. package/dist/cleanup/index.mjs +4 -4
  21. package/dist/cli/commands/describe.d.mts +1 -1
  22. package/dist/cli/commands/describe.mjs +3 -3
  23. package/dist/cli/commands/docs.mjs +3 -3
  24. package/dist/cli/commands/doctor.mjs +1 -1
  25. package/dist/cli/commands/generate.mjs +2 -2
  26. package/dist/cli/commands/init.mjs +2 -2
  27. package/dist/cli/commands/introspect.mjs +2 -2
  28. package/dist/cli/index.mjs +3 -3
  29. package/dist/{constants-D-faL5SX.mjs → constants-BZFsZwJh.mjs} +1 -1
  30. package/dist/context/index.mjs +5 -5
  31. package/dist/core/index.d.mts +3 -3
  32. package/dist/core/index.mjs +7 -7
  33. package/dist/{core-NSu1peyq.mjs → core-DWA1-5IE.mjs} +3 -3
  34. package/dist/{createActionRouter-DTSVv1VK.mjs → createActionRouter-fP3l2xVF.mjs} +54 -18
  35. package/dist/{createAggregationRouter-zEasm-ax.mjs → createAggregationRouter-BJZeOmBa.mjs} +13 -11
  36. package/dist/{createApp-CjqhkX1x.mjs → createApp-Db9JRumw.mjs} +332 -40
  37. package/dist/{createMcpServer-hSFeqRUb.d.mts → createMcpServer-CS2KOVP6.d.mts} +1 -1
  38. package/dist/{defineAggregation-DH2L6_v9.mjs → defineAggregation-BskqRz8M.mjs} +1 -1
  39. package/dist/{defineResource-zYCrhNaN.mjs → defineResource-B2vTvKzW.mjs} +8 -8
  40. package/dist/discovery/index.mjs +1 -1
  41. package/dist/docs/index.d.mts +1 -1
  42. package/dist/docs/index.mjs +3 -3
  43. package/dist/{elevation-z--rFcZ5.mjs → elevation-XoY0C73T.mjs} +6 -9
  44. package/dist/encryption/index.mjs +3 -3
  45. package/dist/{errorHandler-3_3oN-Uc.mjs → errorHandler-BYI-JQMm.mjs} +4 -7
  46. package/dist/{errors-DyY48oRi.mjs → errors-3xaK0i9n.mjs} +1 -1
  47. package/dist/{eventPlugin-Co9sABCg.mjs → eventPlugin-CVQ9ddnL.mjs} +9 -13
  48. package/dist/{eventTypes-HmAFyJmJ.mjs → eventTypes-UPYg7gW1.mjs} +2 -2
  49. package/dist/events/index.d.mts +18 -5
  50. package/dist/events/index.mjs +8 -8
  51. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  52. package/dist/events/transports/redis.d.mts +35 -0
  53. package/dist/events/transports/redis.mjs +87 -11
  54. package/dist/factory/index.d.mts +4 -4
  55. package/dist/factory/index.mjs +6 -6
  56. package/dist/{fastify-augmentation-bzkWPt1f.d.mts → fastify-augmentation-baQc3MaO.d.mts} +2 -2
  57. package/dist/fieldTypes-CxRvCaaZ.mjs +80 -0
  58. package/dist/{fields-rfsl26Ov.mjs → fields-DLFcJiDe.mjs} +1 -1
  59. package/dist/{filter-merge-8glLr7Dk.mjs → filter-merge-Bvjk_8dV.mjs} +1 -1
  60. package/dist/{generate-BOfBueRt.mjs → generate-0OpCUjUv.mjs} +2 -2
  61. package/dist/{headers-CHSOqpcY.mjs → headers-BROW65-r.mjs} +2 -2
  62. package/dist/{health-ezwTHQh2.mjs → health-Cfh-kYI_.mjs} +1 -1
  63. package/dist/{health-DHvAIVmM.mjs → health-Cy6aOg1i.mjs} +1 -1
  64. package/dist/hooks/index.d.mts +1 -1
  65. package/dist/hooks/index.mjs +2 -2
  66. package/dist/http-cache/index.d.mts +2 -2
  67. package/dist/http-cache/index.mjs +4 -4
  68. package/dist/http-cache/purgers/cloudflare.mjs +2 -2
  69. package/dist/http-cache/purgers/fastly.mjs +2 -2
  70. package/dist/http-cache/testing/index.mjs +1 -1
  71. package/dist/idempotency/index.d.mts +1 -1
  72. package/dist/idempotency/index.mjs +10 -8
  73. package/dist/idempotency/redis.mjs +2 -2
  74. package/dist/{index-B5i9-vuP.d.mts → index-CMNpMBtW.d.mts} +1 -1
  75. package/dist/{index-BxZS-8So.d.mts → index-DKM2p5w5.d.mts} +48 -23
  76. package/dist/{index-Cy2-QffW.d.mts → index-DLCcLUQT.d.mts} +69 -6
  77. package/dist/{index-DFCCQ9AE.d.mts → index-DexdFs1a.d.mts} +1 -1
  78. package/dist/{index-D1X_C_qz.d.mts → index-Dhrks-hM.d.mts} +60 -10
  79. package/dist/index.d.mts +4 -4
  80. package/dist/index.mjs +11 -11
  81. package/dist/{init-MoE3eZNR.mjs → init-D7PQcvvL.mjs} +1 -1
  82. package/dist/integrations/event-gateway.mjs +2 -2
  83. package/dist/integrations/index.d.mts +2 -2
  84. package/dist/integrations/index.mjs +1 -1
  85. package/dist/integrations/jobs/index.mjs +3 -3
  86. package/dist/integrations/mcp/index.d.mts +5 -5
  87. package/dist/integrations/mcp/index.mjs +2 -2
  88. package/dist/integrations/mcp/testing.d.mts +2 -2
  89. package/dist/integrations/mcp/testing.mjs +2 -2
  90. package/dist/integrations/streamline.mjs +3 -3
  91. package/dist/integrations/webhooks.d.mts +1 -1
  92. package/dist/integrations/webhooks.mjs +4 -4
  93. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  94. package/dist/integrations/websocket-redis.mjs +1 -1
  95. package/dist/integrations/websocket.mjs +2 -2
  96. package/dist/{jsonBody-DZGiCawf.mjs → jsonBody-C0oREwUc.mjs} +2 -2
  97. package/dist/{keys-CrMOZuk6.mjs → keys-CGlPoVSn.mjs} +1 -1
  98. package/dist/{loadResources-CVQvYUhN.mjs → loadResources-Oi47dogA.mjs} +3 -3
  99. package/dist/{loadResourcesFromEntry-D0naccV2.mjs → loadResourcesFromEntry-BW-LexBz.mjs} +2 -2
  100. package/dist/logger/index.mjs +2 -2
  101. package/dist/{logger-VyMcSmVG.mjs → logger-BagW7_YA.mjs} +1 -1
  102. package/dist/{mcpPlugin-DQACaqVu.mjs → mcpPlugin-C6-wFsOX.mjs} +29 -26
  103. package/dist/{memory-Lpfu8Hga.mjs → memory-Bl7kv6TS.mjs} +3 -3
  104. package/dist/{metrics-DjVj1sg5.mjs → metrics-CqnMJKrJ.mjs} +4 -7
  105. package/dist/middleware/index.d.mts +1 -1
  106. package/dist/middleware/index.mjs +3 -3
  107. package/dist/migrations/index.mjs +2 -2
  108. package/dist/{module-BqPJpZ_L.mjs → module-lbEbHUfI.mjs} +1 -1
  109. package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
  110. package/dist/{multipartBody-BNgNv7r0.mjs → multipartBody-CqNezaB3.mjs} +1 -1
  111. package/dist/{observeSend-BKJHibJz.mjs → observeSend-BjilzlYl.mjs} +1 -1
  112. package/dist/{openapi-T90KrPR6.mjs → openapi-DXNbadgd.mjs} +7 -7
  113. package/dist/outbox-admin/index.d.mts +1 -1
  114. package/dist/outbox-admin/index.mjs +5 -5
  115. package/dist/{outbox-module-5Mnwcycy.d.mts → outbox-module-DzW6zwWJ.d.mts} +103 -10
  116. package/dist/{outbox-module-C874VgBr.mjs → outbox-module-k5rIszQ4.mjs} +197 -28
  117. package/dist/permissions/index.d.mts +2 -2
  118. package/dist/permissions/index.mjs +7 -7
  119. package/dist/{permissions-R9T2G1PH.mjs → permissions-BJylQopQ.mjs} +9 -9
  120. package/dist/{pipe-DzqbsZy-.mjs → pipe-D1cq8hET.mjs} +2 -2
  121. package/dist/pipeline/index.d.mts +1 -1
  122. package/dist/pipeline/index.mjs +2 -2
  123. package/dist/{plan-C0gkeABY.mjs → plan-iEgaS5_H.mjs} +1 -1
  124. package/dist/{plugin-BJcVOX5r.mjs → plugin-DsLr6L4O.mjs} +94 -50
  125. package/dist/plugins/index.d.mts +6 -5
  126. package/dist/plugins/index.mjs +19 -18
  127. package/dist/plugins/response-cache.mjs +4 -4
  128. package/dist/plugins/tracing-entry.mjs +2 -2
  129. package/dist/{pluralize-CrCpyoZs.mjs → pluralize-CX4ZvwCa.mjs} +1 -1
  130. package/dist/presets/filesUpload.d.mts +1 -1
  131. package/dist/presets/filesUpload.mjs +5 -5
  132. package/dist/presets/index.d.mts +2 -2
  133. package/dist/presets/index.mjs +2 -2
  134. package/dist/presets/multiTenant.d.mts +1 -1
  135. package/dist/presets/multiTenant.mjs +5 -5
  136. package/dist/presets/search.d.mts +1 -1
  137. package/dist/presets/search.mjs +2 -2
  138. package/dist/{presets-CNDvNYsz.mjs → presets-D_suT4OY.mjs} +4 -4
  139. package/dist/{projection-CIUe8b59.mjs → projection-CmjGjFih.mjs} +2 -2
  140. package/dist/{purger.types-f83fTzGy.mjs → purger.types-CZwkTZ7B.mjs} +1 -1
  141. package/dist/{queryCachePlugin-B2jpwFcv.mjs → queryCachePlugin-BDOPEAmH.mjs} +114 -14
  142. package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
  143. package/dist/{rateLimitKey-BWx-qep0.mjs → rateLimitKey-igF1x64n.mjs} +1 -1
  144. package/dist/{realtime-D2tqi3d2.mjs → realtime-Cq_ugiWw.mjs} +75 -22
  145. package/dist/registry/index.d.mts +2 -2
  146. package/dist/registry/index.mjs +3 -3
  147. package/dist/{registry-Dl0k6UXy.mjs → registry-DmF9Akvn.mjs} +2 -2
  148. package/dist/{relay-ZYvS4xyW.mjs → relay-DA89IhFt.mjs} +200 -99
  149. package/dist/{renewingLease-DT4yLb29.mjs → renewingLease-DBtGUt8T.mjs} +1 -1
  150. package/dist/{replyHelpers-BJFN5AW7.mjs → replyHelpers-CUbeUc5q.mjs} +2 -2
  151. package/dist/{requestContext-Ct5la-SA.mjs → requestContext-DO9Qv0gw.mjs} +1 -1
  152. package/dist/{requirement-CxDxjB6V.mjs → requirement-C3GaQmkR.mjs} +1 -1
  153. package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
  154. package/dist/{resourceRateLimit-D1oH2obv.mjs → resourceRateLimit-KKn-sFhb.mjs} +19 -4
  155. package/dist/{rolldown-runtime-BdTN42uL.mjs → rolldown-runtime-Ck1Tj4Ax.mjs} +1 -1
  156. package/dist/{routeValidator-DclDl5WJ.mjs → routeValidator-BF7n34xV.mjs} +47 -5
  157. package/dist/{runtimeCapabilities-ClWr60El.mjs → runtimeCapabilities-D0A4kkrC.mjs} +1 -1
  158. package/dist/{schedules-gVkRcs-9.mjs → schedules-CLrQRSTt.mjs} +6 -9
  159. package/dist/{schemaConverter-CIwB5wPO.mjs → schemaConverter-JEmU21fu.mjs} +2 -2
  160. package/dist/{actionPermissions-Dha8sAz2.mjs → schemaIR-wOffQlbq.mjs} +184 -16
  161. package/dist/schemas/index.mjs +1 -1
  162. package/dist/scim/index.mjs +2 -2
  163. package/dist/scope/index.d.mts +1 -1
  164. package/dist/scope/index.mjs +5 -5
  165. package/dist/{scope-VMZhdkbT.mjs → scope-CcTMRd7s.mjs} +4 -4
  166. package/dist/{shutdown-Bi19vH0z.mjs → shutdown-BIR-QBYM.mjs} +1 -1
  167. package/dist/{simpleEqualityMatcher-CaCS09fh.mjs → simpleEqualityMatcher-DqqJqovq.mjs} +1 -1
  168. package/dist/{sse-BqM359f1.mjs → sse-OEuPpgss.mjs} +9 -35
  169. package/dist/sseStats-DQqNN385.d.mts +112 -0
  170. package/dist/sseStream-DknHE2K5.mjs +166 -0
  171. package/dist/{store-helpers-rx-F2ZGR.mjs → store-helpers-D4vtEXt2.mjs} +1 -1
  172. package/dist/{streaming-CPChx3A7.mjs → streaming-CcIpcx02.mjs} +1 -1
  173. package/dist/{subscriberIdentity-CYNYw8p_.mjs → subscriberIdentity-PO6kimAl.mjs} +1 -1
  174. package/dist/{tenancy-BoWImS3K.mjs → tenancy-CH2Kuksc.mjs} +2 -2
  175. package/dist/{tenantPreparation-oqKCZQZM.mjs → tenantPreparation-BTGpblQW.mjs} +4 -4
  176. package/dist/testing/cleanupStoreContract.mjs +1 -1
  177. package/dist/testing/index.d.mts +4 -4
  178. package/dist/testing/index.mjs +324 -17
  179. package/dist/testing/outboxStoreContract.mjs +2 -2
  180. package/dist/testing/requiredPorts.mjs +2 -2
  181. package/dist/testing/storageContract.mjs +1 -1
  182. package/dist/{timing-Dsteq59c.mjs → timing-Dii5X7AP.mjs} +1 -1
  183. package/dist/{transactionContext-C1OgH-hW.mjs → transactionContext-DMPhYEOt.mjs} +1 -1
  184. package/dist/{typeGuards-DNlpASzd.mjs → typeGuards-C1o_XEyp.mjs} +1 -1
  185. package/dist/types/index.d.mts +1 -1
  186. package/dist/types/index.mjs +1 -1
  187. package/dist/types/storage.mjs +1 -1
  188. package/dist/{types-DduBiYaI.d.mts → types-B4E0sc6D.d.mts} +2 -2
  189. package/dist/{types-HFFSwF_K.mjs → types-BuV_cFqT.mjs} +4 -4
  190. package/dist/usage/index.d.mts +1 -1
  191. package/dist/usage/index.mjs +7 -7
  192. package/dist/{userHelpers-N-k-8dNF.mjs → userHelpers-D4m_pLSC.mjs} +1 -1
  193. package/dist/utils/index.d.mts +193 -34
  194. package/dist/utils/index.mjs +13 -13
  195. package/dist/{utils-C7w_RVlx.mjs → utils-CxLMXGn5.mjs} +761 -8
  196. package/dist/{validate-Brr4b_fH.mjs → validate-CZ975J8N.mjs} +3 -3
  197. package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
  198. package/dist/{versioning-CE5kdWOY.mjs → versioning-B2_8SBZo.mjs} +4 -7
  199. package/dist/{workScope-A3XBpYTa.mjs → workScope-B3W3r35s.mjs} +2 -2
  200. package/llms.txt +2 -2
  201. package/package.json +34 -34
  202. package/skills/arc/references/api-reference.md +2 -2
  203. package/skills/arc/references/auth-better-auth.md +1 -0
  204. package/skills/arc/references/events-outbox.md +7 -4
  205. package/skills/arc/references/events.md +2 -2
  206. package/skills/arc/references/production-api.md +4 -0
  207. package/skills/arc/references/production-boot.md +2 -0
  208. package/skills/arc/references/production-idempotency.md +1 -1
  209. package/skills/arc/references/production-realtime.md +28 -2
  210. package/skills/arc/references/validation.md +4 -0
  211. package/skills/arc/references/writes-hooks-errors.md +1 -0
  212. package/dist/schemaIR-A0IoD05P.mjs +0 -108
  213. package/dist/sseStream-qSa-F2Qm.mjs +0 -57
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { a as EventTransport, n as DomainEvent } from "../EventTransport-CYEoCJGe.mjs";
3
- import { i as createOutboxModule, r as OutboxModuleOptions } from "../outbox-module-5Mnwcycy.mjs";
3
+ import { a as createOutboxModule, i as OutboxModuleOptions } from "../outbox-module-DzW6zwWJ.mjs";
4
4
  import { FastifyPluginAsync } from "fastify";
5
5
  import { OutboxFailurePolicy, OutboxStore } from "@classytic/primitives/outbox";
6
6
  export interface WebhookSubscription {
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-ClWr60El.mjs";
3
- import { r as exponentialBackoff } from "../relay-ZYvS4xyW.mjs";
4
- import { t as createOutboxModule } from "../outbox-module-C874VgBr.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { r as exponentialBackoff } from "../relay-DA89IhFt.mjs";
3
+ import { t as createOutboxModule } from "../outbox-module-k5rIszQ4.mjs";
4
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-D0A4kkrC.mjs";
5
5
  import { createHmac, timingSafeEqual } from "node:crypto";
6
6
  import fp from "fastify-plugin";
7
7
  import { createChildEvent, matchEventPattern } from "@classytic/primitives/events";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  // src/integrations/websocket-pushref-redis.ts
3
3
  /**
4
4
  * Lua script for atomic claim. Runs server-side, single-roundtrip.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  // src/integrations/websocket-redis.ts
3
3
  /**
4
4
  * Redis Pub/Sub adapter for cross-instance WebSocket broadcast.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-ClWr60El.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-D0A4kkrC.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import sjson from "secure-json-parse";
5
5
  import fp from "fastify-plugin";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as ArcError } from "./errors-DyY48oRi.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "./errors-3xaK0i9n.mjs";
3
3
  import sjson from "secure-json-parse";
4
4
  // src/utils/jsonBody.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  import { contentHash } from "@classytic/repo-core/hash";
3
3
  // src/cache/keys.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
3
- import { t as arcLog } from "./logger-VyMcSmVG.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
3
+ import { t as arcLog } from "./logger-BagW7_YA.mjs";
4
4
  import { readdir } from "node:fs/promises";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as ResourceRegistry } from "./ResourceRegistry-BcvEJoZd.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as ResourceRegistry } from "./ResourceRegistry-C5NM07fZ.mjs";
3
3
  import { resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  // src/cli/utils/loadResourcesFromEntry.ts
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- export { t as arcLog, n as configureArcLogger, r as createPinoWriter, i as runWithArcLogger } from "../logger-VyMcSmVG.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ export { t as arcLog, n as configureArcLogger, r as createPinoWriter, i as runWithArcLogger } from "../logger-BagW7_YA.mjs";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/logger/scope.ts
4
4
  /**
@@ -1,24 +1,24 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as arcLog } from "./logger-VyMcSmVG.mjs";
3
- import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-DyY48oRi.mjs";
4
- import { f as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-BJcVOX5r.mjs";
5
- import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-HFFSwF_K.mjs";
6
- import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-rfsl26Ov.mjs";
7
- import { o as toJsonSchema } from "./schemaConverter-CIwB5wPO.mjs";
8
- import { t as buildRequestScopeProjection } from "./projection-CIUe8b59.mjs";
9
- import { l as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-Dha8sAz2.mjs";
10
- import { a as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-oqKCZQZM.mjs";
11
- import { r as evaluatePermissionDecision } from "./authorizationDecision-BZSJcPNE.mjs";
12
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-ClWr60El.mjs";
13
- import { t as executePipeline } from "./pipe-DzqbsZy-.mjs";
14
- import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-D1oH2obv.mjs";
15
- import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-o2KZDCWy.mjs";
16
- import { t as pluralize } from "./pluralize-CrCpyoZs.mjs";
17
- import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-Dsteq59c.mjs";
18
- import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "./acquire-D2yj6Zzl.mjs";
19
- import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-A0IoD05P.mjs";
20
- import { n as validateAggregations } from "./validate-Brr4b_fH.mjs";
21
- import { n as executeAggregation } from "./buildHandler-G3k59KY2.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-KKn-sFhb.mjs";
3
+ import { n as declareRuntimeCapability } from "./runtimeCapabilities-D0A4kkrC.mjs";
4
+ import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-CuCwos_X.mjs";
5
+ import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-3xaK0i9n.mjs";
6
+ import { a as resolveActionPermission, i as shouldRejectAdditionalProperties, n as normalizeSchemaIR, p as resolvePipelineSteps, t as actionSchemaIR } from "./schemaIR-wOffQlbq.mjs";
7
+ import { n as fieldTypesFromOpenApiSchemas } from "./fieldTypes-CxRvCaaZ.mjs";
8
+ import { f as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-DsLr6L4O.mjs";
9
+ import { a as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-BTGpblQW.mjs";
10
+ import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-BuV_cFqT.mjs";
11
+ import { t as pluralize } from "./pluralize-CX4ZvwCa.mjs";
12
+ import { t as buildRequestScopeProjection } from "./projection-CmjGjFih.mjs";
13
+ import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "./acquire-MHCnbDtH.mjs";
14
+ import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-Dii5X7AP.mjs";
15
+ import { t as arcLog } from "./logger-BagW7_YA.mjs";
16
+ import { r as evaluatePermissionDecision } from "./authorizationDecision-BD8K4jdQ.mjs";
17
+ import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-DLFcJiDe.mjs";
18
+ import { n as executeAggregation } from "./buildHandler-BttjNkTM.mjs";
19
+ import { n as validateAggregations } from "./validate-CZ975J8N.mjs";
20
+ import { o as toJsonSchema } from "./schemaConverter-JEmU21fu.mjs";
21
+ import { t as executePipeline } from "./pipe-D1cq8hET.mjs";
22
22
  import { ARC_ERROR_CODES, isHttpError, toErrorContract } from "@classytic/repo-core/errors";
23
23
  import { createHash, randomUUID } from "node:crypto";
24
24
  import fp from "fastify-plugin";
@@ -1358,7 +1358,7 @@ function jsonSchemaPropToZod(schema) {
1358
1358
  * format can't express strict mode natively — see [./types.ts]).
1359
1359
  */
1360
1360
  function convertActionSchemaToZod(raw) {
1361
- return schemaIRToZodShape(normalizeSchemaIR(raw));
1361
+ return schemaIRToZodShape(actionSchemaIR(raw));
1362
1362
  }
1363
1363
  /**
1364
1364
  * Build an MCP tool handler for a declarative action.
@@ -1390,7 +1390,7 @@ function createActionToolHandler(actionName, handler, permissions, resourceName,
1390
1390
  log: wiring.log
1391
1391
  }
1392
1392
  } : { tenantMiddlewares: extras?.tenantMiddlewares };
1393
- const ir = rawSchema ? normalizeSchemaIR(rawSchema) : void 0;
1393
+ const ir = rawSchema ? actionSchemaIR(rawSchema) : void 0;
1394
1394
  const strict = ir ? shouldRejectAdditionalProperties(ir) : false;
1395
1395
  const allowedBaseKeys = [...idLess ? [] : ["id"], ...parity?.keyRequired ? ["_idempotencyKey"] : []];
1396
1396
  const allowedKeys = strict && ir ? /* @__PURE__ */ new Set([...allowedBaseKeys, ...Object.keys(ir.properties)]) : void 0;
@@ -1515,7 +1515,8 @@ function buildAggregationTools(args) {
1515
1515
  repo,
1516
1516
  buildOptionsFromSession,
1517
1517
  fields,
1518
- tenantMiddlewares: args.tenantMiddlewares
1518
+ tenantMiddlewares: args.tenantMiddlewares,
1519
+ fieldTypes: args.fieldTypes
1519
1520
  })
1520
1521
  });
1521
1522
  }
@@ -1580,7 +1581,8 @@ function createAggregationToolHandler(args) {
1580
1581
  };
1581
1582
  const result = await executeAggregation(normalized, {
1582
1583
  repo,
1583
- buildOptions: () => tenantOptions
1584
+ buildOptions: () => tenantOptions,
1585
+ ...args.fieldTypes ? { fieldTypes: args.fieldTypes } : {}
1584
1586
  }, {
1585
1587
  query: filterInput,
1586
1588
  tenantOptions,
@@ -2341,7 +2343,8 @@ function resourceToTools(resource, config = {}) {
2341
2343
  buildOptionsFromSession,
2342
2344
  tenantMiddlewares: resource.middlewares?.aggregations,
2343
2345
  prefix,
2344
- fields: resource.fields
2346
+ fields: resource.fields,
2347
+ fieldTypes: fieldTypesFromOpenApiSchemas(resource._registryMeta?.openApiSchemas)
2345
2348
  }));
2346
2349
  }
2347
2350
  return tools;
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
3
- import { n as evictToSize } from "./boundedMap-o2KZDCWy.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
3
+ import { n as evictToSize } from "./boundedMap-CuCwos_X.mjs";
4
4
  // src/cache/memory.ts
5
5
  var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
6
6
  /**
@@ -1,12 +1,9 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
3
- import { a as MetricHistogram, i as DURATION_BUCKETS_SECONDS, o as MetricSeries, s as renderMetricSample } from "./health-ezwTHQh2.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
3
+ import { a as MetricHistogram, i as DURATION_BUCKETS_SECONDS, o as MetricSeries, s as renderMetricSample } from "./health-Cfh-kYI_.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  // src/plugins/metrics.ts
6
- var metrics_exports = /* @__PURE__ */ __exportAll({
7
- default: () => metrics_default,
8
- metricsPlugin: () => metricsPlugin
9
- });
6
+ var metrics_exports = /* @__PURE__ */ __exportAll({ default: () => metrics_default });
10
7
  var Counter = class {
11
8
  series;
12
9
  constructor(maxSeries) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as RequestWithExtras, J as MiddlewareConfig, k as MiddlewareHandler } from "../index-Cy2-QffW.mjs";
2
+ import { A as RequestWithExtras, J as MiddlewareConfig, k as MiddlewareHandler } from "../index-DLCcLUQT.mjs";
3
3
  import { RouteHandlerMethod } from "fastify";
4
4
  interface NamedMiddleware {
5
5
  /** Unique name for debugging/introspection */
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-D-faL5SX.mjs";
3
- import { t as multipartBody } from "../multipartBody-BNgNv7r0.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-BZFsZwJh.mjs";
3
+ import { t as multipartBody } from "../multipartBody-CqNezaB3.mjs";
4
4
  // src/middleware/middleware.ts
5
5
  /**
6
6
  * Named Middleware — Priority-based, conditional middleware execution.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as startRenewingLease } from "../renewingLease-DT4yLb29.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as startRenewingLease } from "../renewingLease-DBtGUt8T.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  // src/migrations/index.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  // src/factory/module/index.ts
3
3
  /**
4
4
  * Identity helper for authoring a typed module — mirrors `defineResource`.
@@ -1,5 +1,5 @@
1
1
 
2
- import { G as CrudRouteKey, W as PresetResult } from "./index-Cy2-QffW.mjs";
2
+ import { G as CrudRouteKey, W as PresetResult } from "./index-DLCcLUQT.mjs";
3
3
  type TenantFieldSpec = {
4
4
  field: string;
5
5
  type: "org";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
3
3
  import sjson from "secure-json-parse";
4
4
  // src/middleware/multipartBody.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
2
  // src/utils/observeSend.ts
3
3
  /** Run `fn`, reporting whether it called `reply.send` (or the reply is already sent). */
4
4
  async function runObservingSend(reply, fn) {
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { n as getUserRoles } from "./userHelpers-N-k-8dNF.mjs";
3
- import { n as convertRouteSchema } from "./schemaConverter-CIwB5wPO.mjs";
4
- import { t as resolveActionPermission } from "./actionPermissions-Dha8sAz2.mjs";
5
- import { t as pluralize } from "./pluralize-CrCpyoZs.mjs";
6
- import { t as buildActionBodySchema } from "./createActionRouter-DTSVv1VK.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { n as getUserRoles } from "./userHelpers-D4m_pLSC.mjs";
3
+ import { a as resolveActionPermission } from "./schemaIR-wOffQlbq.mjs";
4
+ import { t as buildActionBodySchema } from "./createActionRouter-fP3l2xVF.mjs";
5
+ import { t as pluralize } from "./pluralize-CX4ZvwCa.mjs";
6
+ import { n as convertRouteSchema } from "./schemaConverter-JEmU21fu.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  // src/docs/openapi/canonical-schemas.ts
9
9
  /**
@@ -572,7 +572,7 @@ function emitMount(paths, resource, basePath, additionalSecurity, subsetActions,
572
572
  const actionEnum = subsetActions.map((a) => a.name);
573
573
  const actionSchemas = {};
574
574
  for (const a of subsetActions) if (a.schema) actionSchemas[a.name] = a.schema;
575
- const bodySchema = buildActionBodySchema(actionEnum, actionSchemas);
575
+ const bodySchema = buildActionBodySchema(actionEnum, actionSchemas, { keepDefaults: true });
576
576
  const descLines = [
577
577
  hasId ? "Unified action endpoint for state transitions on an existing entity." : "Resource-root action endpoint (no `:id` — operates on the collection or creates new entities).",
578
578
  "",
@@ -1,6 +1,6 @@
1
1
 
2
- import { l as PermissionCheck } from "../base-HXNgPQww.mjs";
3
2
  import { n as ArcModule, u as ModuleName } from "../types-BeEJm-DV.mjs";
3
+ import { l as PermissionCheck } from "../base-HXNgPQww.mjs";
4
4
  import { OutboxStore } from "@classytic/primitives/outbox";
5
5
  /**
6
6
  * A store that can answer an operator's questions.
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { i as NotFoundError, u as ValidationError } from "../errors-DyY48oRi.mjs";
3
- import { t as defineResource } from "../defineResource-zYCrhNaN.mjs";
4
- import { n as getModuleExports, t as defineModule } from "../module-BqPJpZ_L.mjs";
5
- import { r as readOutboxHealth } from "../health-DHvAIVmM.mjs";
1
+ /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
+ import { t as defineResource } from "../defineResource-B2vTvKzW.mjs";
3
+ import { r as readOutboxHealth } from "../health-Cy6aOg1i.mjs";
4
+ import { n as getModuleExports, t as defineModule } from "../module-lbEbHUfI.mjs";
5
+ import { i as NotFoundError, u as ValidationError } from "../errors-3xaK0i9n.mjs";
6
6
  // src/outbox-admin/module.ts
7
7
  /**
8
8
  * Strip the domain payload and the stack unless explicitly opted in.
@@ -1,6 +1,6 @@
1
1
 
2
- import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-CYEoCJGe.mjs";
3
2
  import { n as ArcModule } from "./types-BeEJm-DV.mjs";
3
+ import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-CYEoCJGe.mjs";
4
4
  import { FastifyInstance } from "fastify";
5
5
  import { OutboxFailurePolicy, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
6
6
  import { MemoryOutboxStore } from "@classytic/primitives/memory-outbox";
@@ -26,6 +26,14 @@ type OutboxRelayErrorKind = "publish_failed" | "acknowledge_failed" | "fail_fail
26
26
  * The simpler {@link EventOutbox.relay} returns just the `relayed` count for
27
27
  * backward compatibility.
28
28
  */
29
+ /** Options for one {@link EventOutbox.relayBatch} pass. */
30
+ interface RelayBatchOptions {
31
+ /**
32
+ * Claim only events of these types (exact names). A priority pass: rows of
33
+ * other types stay pending for the next untyped pass. Empty = all types.
34
+ */
35
+ readonly types?: readonly string[];
36
+ }
29
37
  interface RelayResult {
30
38
  /** Number of events successfully published AND acknowledged */
31
39
  readonly relayed: number;
@@ -57,6 +65,12 @@ interface RelayResult {
57
65
  readonly claimMs?: number;
58
66
  /** Wall-clock ms spent publishing + acknowledging the batch. */
59
67
  readonly publishMs?: number;
68
+ /**
69
+ * Claimed rows NOT published because the lease budget ran out first. They
70
+ * stay leased to this relay and are re-claimed (unpublished) after expiry;
71
+ * counted in `attempted`.
72
+ */
73
+ readonly leaseDeferred?: number;
60
74
  }
61
75
  /**
62
76
  * Called by {@link EventOutbox.relay} when a non-fatal error occurs during
@@ -97,6 +111,10 @@ interface EventOutboxOptions {
97
111
  /**
98
112
  * Lease duration in ms for claimed events. Only used when the store
99
113
  * supports `claimPending`. Default: 30 seconds.
114
+ *
115
+ * A pass publishes a claimed row only while its lease has budget left, and
116
+ * sizes later claims to fit the lease from the measured per-event time, so
117
+ * this must exceed the slowest SINGLE publish + ack, not a whole batch.
100
118
  */
101
119
  readonly leaseMs?: number;
102
120
  /**
@@ -196,9 +214,20 @@ declare class EventOutbox {
196
214
  * durable count wins — see the failure path in `relayBatch`.
197
215
  */
198
216
  private readonly _attempts;
217
+ /**
218
+ * Measured ms per event (publish + ack), rising at once on a slower batch and
219
+ * decaying slowly. Undefined until a batch has published something.
220
+ */
221
+ private _perEventMs;
199
222
  constructor(opts: EventOutboxOptions);
200
223
  /** Unique consumer ID used for lease ownership when the store supports claims */
201
224
  get consumerId(): string;
225
+ /**
226
+ * Rows claimed per {@link relayBatch} (the `batchSize` option, default 100), lowered to
227
+ * the store's `claimCap` once a claim came back clamped (`repositoryAsOutboxStore`).
228
+ * A pass that attempted this many rows hit the limit, so more may be pending.
229
+ */
230
+ get batchSize(): number;
202
231
  /**
203
232
  * Store event in outbox.
204
233
  *
@@ -252,9 +281,33 @@ declare class EventOutbox {
252
281
  * claimed the event), the event is NOT counted as relayed. The other
253
282
  * worker will re-publish — at-least-once semantics preserved.
254
283
  *
284
+ * - **Types**: `options.types` claims only events of those types (exact
285
+ * names, oldest first), so a priority pass is not queued behind a backlog
286
+ * of other types. Needs a store with `claimPending` / `claimPendingFenced`
287
+ * (both honour `OutboxClaimOptions.types`); on the single-worker
288
+ * `getPending` fallback the filter is ignored and the oldest rows go out.
289
+ *
290
+ * - **Lease budget**: on a leasing store each row is published only while
291
+ * the claim's lease has budget left, and acked right after its publish.
292
+ * Rows past the budget are not published (`leaseDeferred`); they are
293
+ * re-claimed after expiry. The claim size adapts to the measured per-event
294
+ * time so a batch fits the lease. See wiki/delivery-guarantees.md.
295
+ *
255
296
  * @returns Per-kind outcome counts for the batch
256
297
  */
257
- relayBatch(): Promise<RelayResult>;
298
+ relayBatch(options?: RelayBatchOptions): Promise<RelayResult>;
299
+ /**
300
+ * Rows to claim: `batchSize`, or fewer when the measured per-event time says a
301
+ * full batch would outlive {@link LEASE_CLAIM_FRACTION} of the lease.
302
+ */
303
+ private _claimLimit;
304
+ private _recordPerEventMs;
305
+ private _notifyPublished;
306
+ /**
307
+ * Ack a published event, or `fail()` a rejected one. Returns `true` when the
308
+ * batch must stop (a failure on a store without `fail`).
309
+ */
310
+ private _settle;
258
311
  /**
259
312
  * Fetch current dead-lettered events as typed {@link DeadLetteredEvent}
260
313
  * envelopes. Delegates to {@link OutboxStore.getDeadLettered} — returns
@@ -299,7 +352,29 @@ interface OutboxModuleOptions {
299
352
  * throughput tuning decision, not something this module should invent.
300
353
  */
301
354
  batchSize?: number;
302
- /** Lease duration for a claimed batch, in ms. */
355
+ /**
356
+ * Upper bound on relay passes per scheduled tick and per {@link OutboxModuleExports.requestDrain}.
357
+ * Default `1`: one `relayBatch()` per tick, as before this option existed.
358
+ *
359
+ * With a value above 1 the module keeps relaying in the same tick while the last pass claimed
360
+ * rows (`attempted > 0`) and relayed something (`relayed > 0`). A pass that claimed or relayed
361
+ * nothing ends the loop; a pass that claimed fewer than `batchSize` rows does not, so a store
362
+ * whose claim is capped below `batchSize` still drains. A backlog of 250 rows with
363
+ * `batchSize: 100` then clears in one tick instead of three intervals, at the price of one extra
364
+ * empty claim after the backlog clears (4 passes). A pass where every publish failed stops the
365
+ * loop, so a transport outage never spins. The whole loop is one tracked pass, so `drain()`
366
+ * waits for it. Must be an integer >= 1.
367
+ *
368
+ * Keep `maxPassesPerTick × batchSize` relays inside the relay schedule's lock lease. A longer
369
+ * tick is safe on a store with claim leases (`claimPending`), but on the single-worker
370
+ * `getPending` fallback a second worker could start relaying the same rows.
371
+ */
372
+ maxPassesPerTick?: number;
373
+ /**
374
+ * Lease duration for a claimed batch, in ms (`EventOutbox` default 30 000). Must
375
+ * exceed the slowest single publish + ack: the relay stops publishing a batch when
376
+ * its lease budget runs out and sizes later claims to fit it.
377
+ */
303
378
  leaseMs?: number;
304
379
  /**
305
380
  * Consumer id recorded on the lease. Default:
@@ -322,7 +397,9 @@ interface OutboxModuleOptions {
322
397
  * Called for every non-fatal relay problem — publish failures, ownership mismatches,
323
398
  * acknowledge failures.
324
399
  *
325
- * Omit to report through the Arc app's structured logger. Override for metrics, tracing, or
400
+ * Omit to report through the Arc app's structured logger; there `ownership_mismatch` is
401
+ * logged once per pass as a `marker: 'OUTBOX_LEASE_LOST'` warning with counts (per row at
402
+ * debug), and the relay backs off. Override for metrics, tracing, or
326
403
  * external alerting. Silence here is the failure mode that matters: the relay keeps ticking,
327
404
  * rows keep failing, and the only symptom is revenue that never posted.
328
405
  *
@@ -415,12 +492,27 @@ interface OutboxDrainResult {
415
492
  publishFailed: number;
416
493
  deadLettered: number;
417
494
  /**
418
- * `true` once a pass found nothing VISIBLE to claim. Rows backing off after a failed
419
- * publish are invisible until their retry time, so read `publishFailed` too.
495
+ * `true` once a pass found nothing VISIBLE to claim and no claimed row was left
496
+ * unpublished for lack of lease budget (`RelayResult.leaseDeferred`; those stay
497
+ * leased until expiry). Rows backing off after a failed publish are invisible until
498
+ * their retry time, so read `publishFailed` too.
420
499
  */
421
500
  drained: boolean;
422
501
  }
423
502
  /** What the module exports at `fastify.arc.modules.<name>`. */
503
+ /** Options for {@link OutboxModuleExports.requestDrain}. */
504
+ interface OutboxDrainRequest {
505
+ /**
506
+ * Relay only events of these types (exact names), oldest first, ahead of the rest of
507
+ * the backlog: a priority nudge for rows that must not wait behind thousands of others
508
+ * (an alarm committed while a bulk import drains). Coalesced with other typed requests
509
+ * into one pass, in its own single-flight lane, so it never waits behind a running
510
+ * untyped pass. Uses the
511
+ * store's `claimPending({ types })`; on a store with only `getPending` the filter is
512
+ * ignored. Empty or absent = an ordinary untyped nudge.
513
+ */
514
+ types?: readonly string[];
515
+ }
424
516
  interface OutboxModuleExports {
425
517
  /** The store, for consumers that write events transactionally. */
426
518
  store: OutboxStore;
@@ -431,14 +523,15 @@ interface OutboxModuleExports {
431
523
  * any number of calls before the pass runs produce ONE pass. Never throws
432
524
  * and returns nothing — a unit of work calls this after commit so a row it
433
525
  * just wrote is delivered in milliseconds rather than up to `relayEveryMs`
434
- * later. Safe under concurrency: the store's lease and fence token make an
435
- * extra pass a no-op, not a double publish.
526
+ * later. Single-flight: a call while a pass runs queues exactly ONE
527
+ * follow-up that starts when it ends, never a concurrent pass. During a
528
+ * lease-loss back-off the pass runs when the back-off ends.
436
529
  *
437
530
  * Calling from inside a request does NOT put the pass in that request's
438
531
  * scope: a pass drains whatever is pending, which is other requests' rows.
439
532
  * The pass runs scope-free, so each event opens its own (see `runWorkScope`).
440
533
  */
441
- requestDrain: () => void;
534
+ requestDrain: (options?: OutboxDrainRequest) => void;
442
535
  /**
443
536
  * Relay passes until nothing visible is pending, and resolve with the totals —
444
537
  * including events published BY the handlers it ran. For tests that assert what
@@ -482,4 +575,4 @@ interface OutboxModuleExports {
482
575
  * boot error naming the module that needed it.
483
576
  */
484
577
  declare function createOutboxModule(options: OutboxModuleOptions): ArcModule<OutboxModuleExports>;
485
- export { MemoryOutboxStore as a, OutboxRelayErrorHandler as c, DEFAULT_RELAY_LAG_UNHEALTHY_MS as d, OutboxHealth as f, createOutboxModule as i, OutboxRelayErrorKind as l, readOutboxHealth as m, OutboxModuleExports as n, EventOutbox as o, OutboxHealthStore as p, OutboxModuleOptions as r, EventOutboxOptions as s, OutboxDrainResult as t, RelayResult as u };
578
+ export { createOutboxModule as a, EventOutboxOptions as c, RelayBatchOptions as d, RelayResult as f, readOutboxHealth as g, OutboxHealthStore as h, OutboxModuleOptions as i, OutboxRelayErrorHandler as l, OutboxHealth as m, OutboxDrainResult as n, MemoryOutboxStore as o, DEFAULT_RELAY_LAG_UNHEALTHY_MS as p, OutboxModuleExports as r, EventOutbox as s, OutboxDrainRequest as t, OutboxRelayErrorKind as u };