@classytic/arc 2.48.0 → 2.49.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-DbHZK230.mjs} +2 -2
  2. package/dist/{HookSystem-B9x-Y_k7.mjs → HookSystem-DMoeJ6Do.mjs} +2 -2
  3. package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
  4. package/dist/{ResourceRegistry-BcvEJoZd.mjs → ResourceRegistry-CP-iTcKy.mjs} +2 -2
  5. package/dist/{acquire-D2yj6Zzl.mjs → acquire-CB0va87C.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-DHO94aV2.mjs} +4 -4
  13. package/dist/{boundedMap-o2KZDCWy.mjs → boundedMap-C51EUUOm.mjs} +1 -1
  14. package/dist/{buildHandler-G3k59KY2.mjs → buildHandler-9DuwEKvr.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-COTX3sDa.mjs} +3 -6
  18. package/dist/{claimed-D0A43wjT.mjs → claimed-C7T1nHlo.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-DOnfMd7i.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-BoEdFDDw.mjs} +3 -3
  34. package/dist/{createActionRouter-DTSVv1VK.mjs → createActionRouter-CpTn15dm.mjs} +54 -18
  35. package/dist/{createAggregationRouter-zEasm-ax.mjs → createAggregationRouter-CD_Hydp0.mjs} +13 -11
  36. package/dist/{createApp-CjqhkX1x.mjs → createApp-Be6XTGD9.mjs} +332 -40
  37. package/dist/{createMcpServer-hSFeqRUb.d.mts → createMcpServer-CS2KOVP6.d.mts} +1 -1
  38. package/dist/{defineAggregation-DH2L6_v9.mjs → defineAggregation-BI5pRb8c.mjs} +1 -1
  39. package/dist/{defineResource-zYCrhNaN.mjs → defineResource-BAzNu5Um.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-DupGuM41.mjs} +6 -9
  44. package/dist/encryption/index.mjs +3 -3
  45. package/dist/{errorHandler-3_3oN-Uc.mjs → errorHandler-DA03vRqp.mjs} +4 -7
  46. package/dist/{errors-DyY48oRi.mjs → errors-BpYV859Y.mjs} +1 -1
  47. package/dist/{eventPlugin-Co9sABCg.mjs → eventPlugin-D7LYtYzL.mjs} +9 -13
  48. package/dist/{eventTypes-HmAFyJmJ.mjs → eventTypes-BqA-N-Uz.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-EFWxCkZ5.mjs +80 -0
  58. package/dist/{fields-rfsl26Ov.mjs → fields-CT1Erg7o.mjs} +1 -1
  59. package/dist/{filter-merge-8glLr7Dk.mjs → filter-merge-B1eJ1pMx.mjs} +1 -1
  60. package/dist/{generate-BOfBueRt.mjs → generate-Cr0ULavs.mjs} +2 -2
  61. package/dist/{headers-CHSOqpcY.mjs → headers-D4bncIOf.mjs} +2 -2
  62. package/dist/{health-ezwTHQh2.mjs → health-BoFxrkJE.mjs} +1 -1
  63. package/dist/{health-DHvAIVmM.mjs → health-DN_pUVMX.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-C4a24wD2.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-DoTt5BS6.mjs} +2 -2
  97. package/dist/{keys-CrMOZuk6.mjs → keys--l9n7aOC.mjs} +1 -1
  98. package/dist/{loadResources-CVQvYUhN.mjs → loadResources-rygByIQA.mjs} +3 -3
  99. package/dist/{loadResourcesFromEntry-D0naccV2.mjs → loadResourcesFromEntry-ItNBIQ5w.mjs} +2 -2
  100. package/dist/logger/index.mjs +2 -2
  101. package/dist/{logger-VyMcSmVG.mjs → logger-UbknHqHy.mjs} +1 -1
  102. package/dist/{mcpPlugin-DQACaqVu.mjs → mcpPlugin-CTkk4RP8.mjs} +29 -26
  103. package/dist/{memory-Lpfu8Hga.mjs → memory-C47xVsjX.mjs} +3 -3
  104. package/dist/{metrics-DjVj1sg5.mjs → metrics-TJyAb1Xk.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-CWiqsXnh.mjs} +1 -1
  109. package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
  110. package/dist/{multipartBody-BNgNv7r0.mjs → multipartBody-BdG1qbn1.mjs} +1 -1
  111. package/dist/{observeSend-BKJHibJz.mjs → observeSend-DrA3ADFN.mjs} +1 -1
  112. package/dist/{openapi-T90KrPR6.mjs → openapi-D6MAbYpv.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-C874VgBr.mjs → outbox-module-D5QABFQW.mjs} +197 -28
  116. package/dist/{outbox-module-5Mnwcycy.d.mts → outbox-module-DzW6zwWJ.d.mts} +103 -10
  117. package/dist/permissions/index.d.mts +2 -2
  118. package/dist/permissions/index.mjs +7 -7
  119. package/dist/{permissions-R9T2G1PH.mjs → permissions-CFsmdYUt.mjs} +9 -9
  120. package/dist/{pipe-DzqbsZy-.mjs → pipe-B_05AgGt.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-BnlNJhrj.mjs} +1 -1
  124. package/dist/{plugin-BJcVOX5r.mjs → plugin-CrMPYbdj.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-oVIxJ4CY.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-CUd3L7v6.mjs} +4 -4
  139. package/dist/{projection-CIUe8b59.mjs → projection-DowJlIto.mjs} +2 -2
  140. package/dist/{purger.types-f83fTzGy.mjs → purger.types-BjKy8869.mjs} +1 -1
  141. package/dist/{queryCachePlugin-B2jpwFcv.mjs → queryCachePlugin-BvB3k_Fh.mjs} +114 -14
  142. package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
  143. package/dist/{rateLimitKey-BWx-qep0.mjs → rateLimitKey-56nH1cWN.mjs} +1 -1
  144. package/dist/{realtime-D2tqi3d2.mjs → realtime-DXGBPtYK.mjs} +19 -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-Biz-6sEZ.mjs} +2 -2
  148. package/dist/{relay-ZYvS4xyW.mjs → relay-DEIoMntZ.mjs} +200 -99
  149. package/dist/{renewingLease-DT4yLb29.mjs → renewingLease-BCJpW9-u.mjs} +1 -1
  150. package/dist/{replyHelpers-BJFN5AW7.mjs → replyHelpers-DliJNb0-.mjs} +2 -2
  151. package/dist/{requestContext-Ct5la-SA.mjs → requestContext-tUgLt9Ky.mjs} +1 -1
  152. package/dist/{requirement-CxDxjB6V.mjs → requirement-0l2DApiQ.mjs} +1 -1
  153. package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
  154. package/dist/{resourceRateLimit-D1oH2obv.mjs → resourceRateLimit-iSXF8rLH.mjs} +19 -4
  155. package/dist/{rolldown-runtime-BdTN42uL.mjs → rolldown-runtime-gKJR3o-6.mjs} +1 -1
  156. package/dist/{routeValidator-DclDl5WJ.mjs → routeValidator-xNYA4rr1.mjs} +47 -5
  157. package/dist/{runtimeCapabilities-ClWr60El.mjs → runtimeCapabilities-BQK-GrYe.mjs} +1 -1
  158. package/dist/{schedules-gVkRcs-9.mjs → schedules-D9iMVFhF.mjs} +6 -9
  159. package/dist/{schemaConverter-CIwB5wPO.mjs → schemaConverter-cIh4oX9a.mjs} +2 -2
  160. package/dist/{actionPermissions-Dha8sAz2.mjs → schemaIR-BsY4y9VP.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-QyhM9w8z.mjs} +4 -4
  166. package/dist/{shutdown-Bi19vH0z.mjs → shutdown-BM7Q0h4B.mjs} +1 -1
  167. package/dist/{sse-BqM359f1.mjs → sse-ofvlcTQQ.mjs} +9 -35
  168. package/dist/sseStats-DQqNN385.d.mts +112 -0
  169. package/dist/sseStream-BxQW7hPq.mjs +166 -0
  170. package/dist/{store-helpers-rx-F2ZGR.mjs → store-helpers-_FRhHDyv.mjs} +1 -1
  171. package/dist/{simpleEqualityMatcher-CaCS09fh.mjs → streamFrames-B3ZJfI02.mjs} +19 -2
  172. package/dist/{streaming-CPChx3A7.mjs → streaming-HZr63UiM.mjs} +1 -1
  173. package/dist/{subscriberIdentity-CYNYw8p_.mjs → subscriberIdentity-DSgnoT_D.mjs} +1 -1
  174. package/dist/{tenancy-BoWImS3K.mjs → tenancy-_ukT0oBt.mjs} +2 -2
  175. package/dist/{tenantPreparation-oqKCZQZM.mjs → tenantPreparation-DSlQI53c.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-Z8p-Zlw1.mjs} +1 -1
  183. package/dist/{transactionContext-C1OgH-hW.mjs → transactionContext-DBbSTfY3.mjs} +1 -1
  184. package/dist/{typeGuards-DNlpASzd.mjs → typeGuards-_6nNQqgq.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-CrOlZ4rY.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-CBKx3XJN.mjs} +1 -1
  193. package/dist/utils/index.d.mts +239 -34
  194. package/dist/utils/index.mjs +13 -13
  195. package/dist/{utils-C7w_RVlx.mjs → utils--HE8R8sH.mjs} +761 -8
  196. package/dist/{validate-Brr4b_fH.mjs → validate-BUeE2MLR.mjs} +3 -3
  197. package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
  198. package/dist/{versioning-CE5kdWOY.mjs → versioning-qYgqwOhL.mjs} +4 -7
  199. package/dist/{workScope-A3XBpYTa.mjs → workScope-C-1QHNmV.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
- 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 };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { c as DataPolicy, d as UserBase, l as PermissionCheck, m as normalizeRoles, p as getUserRoles, s as AuthorizationDecision, u as PermissionContext } from "../base-HXNgPQww.mjs";
3
3
  import { a as applyFieldReadPermissions, c as resolveEffectiveRoles, i as FieldWritePermissionResult, n as FieldPermissionMap, o as applyFieldWritePermissions, r as FieldPermissionType, s as fields, t as FieldPermission } from "../fields-JTkrtO-r.mjs";
4
- import { $ as deny, A as GrantResolution, B as explainAccess, C as requireScopeContext, D as createRoleHierarchy, E as RoleHierarchy, F as AccessExplanation, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, I as PermissionRequirement, J as PublicPolicy, K as createOrgPermissions, L as collectPublicSurface, M as modeSatisfies, N as requireGrant, O as GRANT_MODES, P as conjoinPolicyFilters, Q as anyOf, R as describePermission, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, V as ConnectEventsOptions, W as PermissionEventBus, X as allow, Y as allOf, Z as allowPublic, _ as publicRead, _t as requireMandate, a as PermissionMatrixRegistry, at as requireRoles, b as requireOrgInScope, c as introspectModule, ct as scopeOf, d as adminOnly, dt as evaluatePermissionDecision, et as denyAll, f as authenticated, ft as normalizeToDecision, g as presets_d_exports, gt as requireDPoP, h as permissionMatrix, ht as requireAgentScope, i as PermissionMatrixOptions, it as requirePlatformRole, j as RequireGrantOptions, k as GrantMode, l as introspectRegistry, lt as PermissionCheckReturn, m as ownerWithAdminBypass, mt as RequireMandateOptions, n as PermissionEntryType, nt as requireAuth, o as buildPermissionMatrix, ot as roles, p as fullPublic, pt as RequireAgentScopeOptions, q as AllowPublicOptions, r as PermissionMatrix, rt as requireOwnership, s as introspectCheck, st as when, t as PermissionEntry, tt as not, u as PermissionOverrides, ut as applyAuthorizationDecision, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly, z as describePermissionMap } from "../index-B5i9-vuP.mjs";
5
- import { a as createMemoryResourceRateLimiter, i as ResourceRateLimiter, n as ResourceRateLimitDecision, o as resolveResourceRateLimiter, r as ResourceRateLimitPolicy, t as ResourceRateLimitContext } from "../resourceRateLimit-DCWglD7V.mjs";
4
+ import { $ as deny, A as GrantResolution, B as explainAccess, C as requireScopeContext, D as createRoleHierarchy, E as RoleHierarchy, F as AccessExplanation, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, I as PermissionRequirement, J as PublicPolicy, K as createOrgPermissions, L as collectPublicSurface, M as modeSatisfies, N as requireGrant, O as GRANT_MODES, P as conjoinPolicyFilters, Q as anyOf, R as describePermission, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, V as ConnectEventsOptions, W as PermissionEventBus, X as allow, Y as allOf, Z as allowPublic, _ as publicRead, _t as requireMandate, a as PermissionMatrixRegistry, at as requireRoles, b as requireOrgInScope, c as introspectModule, ct as scopeOf, d as adminOnly, dt as evaluatePermissionDecision, et as denyAll, f as authenticated, ft as normalizeToDecision, g as presets_d_exports, gt as requireDPoP, h as permissionMatrix, ht as requireAgentScope, i as PermissionMatrixOptions, it as requirePlatformRole, j as RequireGrantOptions, k as GrantMode, l as introspectRegistry, lt as PermissionCheckReturn, m as ownerWithAdminBypass, mt as RequireMandateOptions, n as PermissionEntryType, nt as requireAuth, o as buildPermissionMatrix, ot as roles, p as fullPublic, pt as RequireAgentScopeOptions, q as AllowPublicOptions, r as PermissionMatrix, rt as requireOwnership, s as introspectCheck, st as when, t as PermissionEntry, tt as not, u as PermissionOverrides, ut as applyAuthorizationDecision, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly, z as describePermissionMap } from "../index-CMNpMBtW.mjs";
5
+ import { a as createMemoryResourceRateLimiter, i as ResourceRateLimiter, n as ResourceRateLimitDecision, o as resolveResourceRateLimiter, r as ResourceRateLimitPolicy, t as ResourceRateLimitContext } from "../resourceRateLimit-BPiESPtG.mjs";
6
6
  export { type AccessExplanation, type AllowPublicOptions, type AuthorizationDecision, type ConnectEventsOptions, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type FieldPermission, type FieldPermissionMap, type FieldPermissionType, type FieldWritePermissionResult, GRANT_MODES, type GrantMode, type GrantResolution, type PermissionCheck, type PermissionCheckReturn, type PermissionContext, type PermissionEntry, type PermissionEntryType, type PermissionEventBus, type PermissionMatrix, type PermissionMatrixOptions, type PermissionMatrixRegistry, type PermissionOverrides, type PermissionRequirement, type PublicPolicy, type RequireAgentScopeOptions, type RequireGrantOptions, type RequireMandateOptions, type ResourceRateLimitContext, type ResourceRateLimitDecision, type ResourceRateLimitPolicy, type ResourceRateLimiter, type RoleHierarchy, type UserBase, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as conjoinPolicyFilters } from "../filter-merge-8glLr7Dk.mjs";
3
- import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-N-k-8dNF.mjs";
4
- import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-rfsl26Ov.mjs";
5
- import { i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-BZSJcPNE.mjs";
6
- import { i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "../resourceRateLimit-D1oH2obv.mjs";
7
- import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-R9T2G1PH.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as conjoinPolicyFilters } from "../filter-merge-B1eJ1pMx.mjs";
3
+ import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-CBKx3XJN.mjs";
4
+ import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-CT1Erg7o.mjs";
5
+ import { i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-DHO94aV2.mjs";
6
+ import { i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "../resourceRateLimit-iSXF8rLH.mjs";
7
+ import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-CFsmdYUt.mjs";
8
8
  export { GRANT_MODES, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
@@ -1,12 +1,12 @@
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";
4
- import { t as conjoinPolicyFilters } from "./filter-merge-8glLr7Dk.mjs";
5
- import { n as getUserRoles } from "./userHelpers-N-k-8dNF.mjs";
6
- import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-HFFSwF_K.mjs";
7
- import { i as normalizeToDecision } from "./authorizationDecision-BZSJcPNE.mjs";
8
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-ClWr60El.mjs";
9
- import { t as MemoryCacheStore } from "./memory-Lpfu8Hga.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
3
+ import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-CrOlZ4rY.mjs";
4
+ import { i as normalizeToDecision } from "./authorizationDecision-DHO94aV2.mjs";
5
+ import { t as conjoinPolicyFilters } from "./filter-merge-B1eJ1pMx.mjs";
6
+ import { n as getUserRoles } from "./userHelpers-CBKx3XJN.mjs";
7
+ import { t as MemoryCacheStore } from "./memory-C47xVsjX.mjs";
8
+ import { t as arcLog } from "./logger-UbknHqHy.mjs";
9
+ import { n as declareRuntimeCapability } from "./runtimeCapabilities-BQK-GrYe.mjs";
10
10
  import { randomUUID } from "node:crypto";
11
11
  // src/permissions/context.ts
12
12
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { r as ForbiddenError } from "./errors-DyY48oRi.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { r as ForbiddenError } from "./errors-BpYV859Y.mjs";
3
3
  // src/pipeline/pipe.ts
4
4
  /**
5
5
  * Compose pipeline steps into an ordered array.
@@ -1,5 +1,5 @@
1
1
 
2
- import { Vn as IControllerResponse, _t as PipelineConfig, bt as Transform, gt as OperationFilter, ht as NextFunction, mt as Interceptor, pt as Guard, vt as PipelineContext, yt as PipelineStep } from "../index-Cy2-QffW.mjs";
2
+ import { St as Transform, Un as IControllerResponse, _t as NextFunction, bt as PipelineContext, gt as Interceptor, ht as Guard, vt as OperationFilter, xt as PipelineStep, yt as PipelineConfig } from "../index-DLCcLUQT.mjs";
3
3
  interface GuardOptions {
4
4
  operations?: OperationFilter;
5
5
  handler: (ctx: PipelineContext) => boolean | Promise<boolean>;
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { n as pipe, t as executePipeline } from "../pipe-DzqbsZy-.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { n as pipe, t as executePipeline } from "../pipe-B_05AgGt.mjs";
3
3
  // src/pipeline/guard.ts
4
4
  /**
5
5
  * Create a named guard.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
2
  import { createEventRouter, matchEventPattern } from "@classytic/primitives/events";
3
3
  // src/factory/module/graph.ts
4
4
  /**
@@ -1,23 +1,23 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { g as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-D-faL5SX.mjs";
3
- import { t as arcLog } from "./logger-VyMcSmVG.mjs";
4
- import { t as conjoinPolicyFilters } from "./filter-merge-8glLr7Dk.mjs";
5
- import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError, u as ValidationError } from "./errors-DyY48oRi.mjs";
6
- import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-CaCS09fh.mjs";
7
- import { n as requireSingleHeaderValue } from "./headers-CHSOqpcY.mjs";
8
- import { n as getUserRoles, t as getUserId } from "./userHelpers-N-k-8dNF.mjs";
9
- import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-HFFSwF_K.mjs";
10
- import { r as resolveTenancy } from "./tenancy-BoWImS3K.mjs";
11
- import { t as buildQueryKey } from "./keys-CrMOZuk6.mjs";
12
- import { t as transactionContext } from "./transactionContext-C1OgH-hW.mjs";
13
- import { a as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-rfsl26Ov.mjs";
14
- import { E as ArcQueryParser, v as getDefaultCrudSchemas } from "./utils-C7w_RVlx.mjs";
15
- import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-CIwB5wPO.mjs";
16
- import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-CPChx3A7.mjs";
17
- import { _ as buildArcDecorator, a as resolveRouterPluginMw, b as createRequestContext, c as buildPipelineHandler, d as buildCrudPermissionMw, f as buildRouteHooks, h as buildAuthMiddleware, i as buildRouteConfig, l as resolvePipelineSteps, m as routeHookOptions, n as tryRegisterRoute, o as selectPluginMw, p as resolveRoutePreHandlers, r as buildRateLimitConfig, t as resolveActionPermission, v as createCrudHandlers, y as createFastifyHandler } from "./actionPermissions-Dha8sAz2.mjs";
18
- import { a as withoutTenantInjection } from "./tenantPreparation-oqKCZQZM.mjs";
19
- import { t as hasEvents } from "./typeGuards-DNlpASzd.mjs";
20
- import { n as idempotencyConfigProblem } from "./requirement-CxDxjB6V.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { g as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-DOnfMd7i.mjs";
3
+ import { t as arcLog } from "./logger-UbknHqHy.mjs";
4
+ import { t as conjoinPolicyFilters } from "./filter-merge-B1eJ1pMx.mjs";
5
+ import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError, u as ValidationError } from "./errors-BpYV859Y.mjs";
6
+ import { n as simpleEqualityMatcher } from "./streamFrames-B3ZJfI02.mjs";
7
+ import { n as requireSingleHeaderValue } from "./headers-D4bncIOf.mjs";
8
+ import { n as getUserRoles, t as getUserId } from "./userHelpers-CBKx3XJN.mjs";
9
+ import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-CrOlZ4rY.mjs";
10
+ import { r as resolveTenancy } from "./tenancy-_ukT0oBt.mjs";
11
+ import { t as buildQueryKey } from "./keys--l9n7aOC.mjs";
12
+ import { t as transactionContext } from "./transactionContext-DBbSTfY3.mjs";
13
+ import { a as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CT1Erg7o.mjs";
14
+ import { O as ArcQueryParser, b as getDefaultCrudSchemas } from "./utils--HE8R8sH.mjs";
15
+ import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-cIh4oX9a.mjs";
16
+ import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-HZr63UiM.mjs";
17
+ import { C as createFastifyHandler, S as createCrudHandlers, _ as resolveRoutePreHandlers, a as resolveActionPermission, c as buildRouteConfig, f as buildPipelineHandler, g as buildRouteHooks, h as buildCrudPermissionMw, l as resolveRouterPluginMw, n as normalizeSchemaIR, o as tryRegisterRoute, p as resolvePipelineSteps, s as buildRateLimitConfig, u as selectPluginMw, v as routeHookOptions, w as createRequestContext, x as buildArcDecorator, y as buildAuthMiddleware } from "./schemaIR-BsY4y9VP.mjs";
18
+ import { a as withoutTenantInjection } from "./tenantPreparation-DSlQI53c.mjs";
19
+ import { t as hasEvents } from "./typeGuards-_6nNQqgq.mjs";
20
+ import { n as idempotencyConfigProblem } from "./requirement-0l2DApiQ.mjs";
21
21
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
22
22
  import { policyRecordToFilter } from "@classytic/repo-core/filter";
23
23
  import { retryingTransaction } from "@classytic/repo-core/repository";
@@ -1542,14 +1542,21 @@ var BaseCrudController = class {
1542
1542
  * `existing` is the document the request was AUTHORISED against — handed over
1543
1543
  * so the verb does not re-fetch and possibly observe a different document.
1544
1544
  * `id` is the REPOSITORY PRIMARY KEY (`resolveRepoId` output), never the route param.
1545
+ * `cas` (update only, from {@link expectedVersion}) becomes `expectedVersion` /
1546
+ * `expectedVersionSource` when the resource declares `concurrency` and the loaded
1547
+ * document has a numeric version.
1545
1548
  */
1546
- mutationWriteContext(req, id, existing, repo = this.repository, uow) {
1549
+ mutationWriteContext(req, id, existing, repo = this.repository, uow, cas) {
1547
1550
  return {
1548
1551
  req,
1549
1552
  repository: repo,
1550
1553
  id,
1551
1554
  existing,
1552
- ...uow !== void 0 ? { uow } : {}
1555
+ ...uow !== void 0 ? { uow } : {},
1556
+ ...cas?.version !== void 0 ? {
1557
+ expectedVersion: cas.version,
1558
+ expectedVersionSource: cas.fromClient ? "if-match" : "loaded"
1559
+ } : {}
1553
1560
  };
1554
1561
  }
1555
1562
  /**
@@ -1807,18 +1814,20 @@ var BaseCrudController = class {
1807
1814
  id,
1808
1815
  existing
1809
1816
  };
1810
- const cas = this._writes?.update ? { fromClient: false } : this.expectedVersion(req, existing);
1817
+ const cas = this.expectedVersion(req, existing);
1811
1818
  const item = await this.runHookedOpUntilResult(req, {
1812
1819
  op: "update",
1813
1820
  input: data,
1814
1821
  meta: hookMeta
1815
- }, async (processed) => this.runWritePersistence((repo, uow) => this._writes?.update ? this._writes.update(repoId, processed, this.mutationWriteContext(req, repoId, existing, repo, uow)) : repo.update(repoId, processed, {
1822
+ }, async (processed) => this.runWritePersistence((repo, uow) => this._writes?.update ? this._writes.update(repoId, processed, this.mutationWriteContext(req, repoId, existing, repo, uow, cas)) : repo.update(repoId, processed, {
1816
1823
  user,
1817
1824
  context: arcContext,
1818
1825
  ...this.tenantRepoOptions(req),
1819
1826
  ...cas.version !== void 0 ? { ifVersion: cas.version } : {}
1820
1827
  }))).catch((err) => {
1821
- if (cas.fromClient && err?.code === "version_conflict") throw createDomainError(ARC_ERROR_CODES.PRECONDITION_FAILED, "The resource changed since it was read — re-read and retry.", 412);
1828
+ const conflict = err;
1829
+ const onOtherDoc = this._writes?.update !== void 0 && conflict?.id !== void 0 && conflict.id !== null && String(conflict.id) !== String(repoId);
1830
+ if (cas.fromClient && conflict?.code === "version_conflict" && !onOtherDoc) throw createDomainError(ARC_ERROR_CODES.PRECONDITION_FAILED, "The resource changed since it was read — re-read and retry.", 412);
1822
1831
  throw err;
1823
1832
  });
1824
1833
  const resolved = this._writes?.update ? item ?? await this.repository.getById(repoId, {
@@ -2643,10 +2652,13 @@ function isParseable(schema) {
2643
2652
  return typeof schema === "object" && schema !== null && typeof schema.safeParse === "function";
2644
2653
  }
2645
2654
  /** Parse `value` with `schema`; zod issues become one `ValidationError` (400, `details[]`). */
2646
- function parseOrThrow(schema, value) {
2655
+ function parseOrThrow(schema, value, mapIssues) {
2647
2656
  const result = schema.safeParse(value);
2648
2657
  if (result.success) return result.data;
2649
- throw new ValidationError("Validation failed", (result.error?.issues ?? []).map((issue) => ({
2658
+ const issues = result.error?.issues ?? [];
2659
+ const mapped = mapIssues?.(issues);
2660
+ if (mapped) throw mapped;
2661
+ throw new ValidationError("Validation failed", issues.map((issue) => ({
2650
2662
  field: issue.path.map(String).join("."),
2651
2663
  message: issue.message
2652
2664
  })));
@@ -2655,7 +2667,8 @@ function parseOrThrow(schema, value) {
2655
2667
  * Spread into a route entry: `{ method, path, permissions, ...routeInput({ body }), handler }`.
2656
2668
  * `preHandler` is empty when no zod body/querystring/params slot is declared.
2657
2669
  */
2658
- function routeInput(slots) {
2670
+ function routeInput(slots, options = {}) {
2671
+ const { mapIssues } = options;
2659
2672
  const { body, querystring, params } = slots;
2660
2673
  const parseBody = isParseable(body) ? body : void 0;
2661
2674
  const parseQuery = isParseable(querystring) ? querystring : void 0;
@@ -2665,9 +2678,9 @@ function routeInput(slots) {
2665
2678
  preHandler: []
2666
2679
  };
2667
2680
  const parse = async (request) => {
2668
- if (parseParams) request.params = parseOrThrow(parseParams, request.params ?? {});
2669
- if (parseQuery) request.query = parseOrThrow(parseQuery, request.query ?? {});
2670
- if (parseBody) request.body = parseOrThrow(parseBody, request.body ?? {});
2681
+ if (parseParams) request.params = parseOrThrow(parseParams, request.params ?? {}, mapIssues);
2682
+ if (parseQuery) request.query = parseOrThrow(parseQuery, request.query ?? {}, mapIssues);
2683
+ if (parseBody) request.body = parseOrThrow(parseBody, request.body ?? {}, mapIssues);
2671
2684
  };
2672
2685
  return {
2673
2686
  schema: slots,
@@ -2700,30 +2713,56 @@ const noPayloadSchema = Object.freeze({
2700
2713
  function crudInput(input) {
2701
2714
  const { create, update } = input;
2702
2715
  const parseBody = (schema) => input.parse && isParseable(schema) ? [(async (request) => {
2703
- request.body = parseOrThrow(schema, request.body ?? {});
2716
+ request.body = parseOrThrow(schema, request.body ?? {}, input.mapIssues);
2704
2717
  })] : [];
2718
+ const customSchemas = {};
2719
+ const openApiSchemas = {};
2720
+ const middlewares = {};
2721
+ if (create) {
2722
+ customSchemas.create = { body: create };
2723
+ openApiSchemas.createBody = create;
2724
+ if (input.parse) middlewares.create = parseBody(create);
2725
+ }
2726
+ if (update) {
2727
+ customSchemas.update = { body: update };
2728
+ openApiSchemas.updateBody = update;
2729
+ if (input.parse) middlewares.update = parseBody(update);
2730
+ }
2705
2731
  return {
2706
- customSchemas: {
2707
- ...create ? { create: { body: create } } : {},
2708
- ...update ? { update: { body: update } } : {}
2709
- },
2710
- openApiSchemas: {
2711
- ...create ? { createBody: create } : {},
2712
- ...update ? { updateBody: update } : {}
2713
- },
2714
- middlewares: {
2715
- ...create && input.parse ? { create: parseBody(create) } : {},
2716
- ...update && input.parse ? { update: parseBody(update) } : {}
2717
- }
2732
+ customSchemas,
2733
+ openApiSchemas,
2734
+ middlewares
2718
2735
  };
2719
2736
  }
2737
+ /** True when the schema's object shape declares an `action` property. */
2738
+ function declaresAction(schema) {
2739
+ try {
2740
+ return "action" in normalizeSchemaIR(schema).properties;
2741
+ } catch {
2742
+ return false;
2743
+ }
2744
+ }
2720
2745
  /**
2721
2746
  * Wrap an action handler so `data` is the zod schema's OUTPUT. Used by `ActionDefinition.parse`
2722
2747
  * and `defineAction({ parse: true })`; a non-zod schema returns the handler unchanged.
2748
+ *
2749
+ * `data` never carries the `action` discriminator (arc owns it). A schema that DECLARES `action`
2750
+ * (`z.strictObject({ action: z.literal('issue'), ... })`, a contracts discriminated-union branch)
2751
+ * is parsed with `action: actionName` put back, so strictness and refinements that read it hold;
2752
+ * the handler still gets the output without `action`.
2723
2753
  */
2724
- function withParsedInput(handler, schema) {
2754
+ function withParsedInput(handler, schema, actionName) {
2725
2755
  if (!isParseable(schema)) return handler;
2726
- return (id, data, req) => handler(id, parseOrThrow(schema, data), req);
2756
+ if (actionName === void 0 || !declaresAction(schema)) return (id, data, req) => handler(id, parseOrThrow(schema, data), req);
2757
+ return (id, data, req) => {
2758
+ const out = parseOrThrow(schema, {
2759
+ ...data,
2760
+ action: actionName
2761
+ });
2762
+ if (out === null || typeof out !== "object" || Array.isArray(out)) return handler(id, out, req);
2763
+ const { action: _owned, ...rest } = out;
2764
+ return handler(id, rest, req);
2765
+ };
2727
2766
  }
2728
2767
  // src/core/defineResource/schemas.ts
2729
2768
  /**
@@ -3041,7 +3080,7 @@ function normalizeActionsToRouterConfig(actions, resourceActionPermissions, tag,
3041
3080
  if (typeof entry === "function") handlers[name] = entry;
3042
3081
  else {
3043
3082
  const def = entry;
3044
- handlers[name] = def.parse ? withParsedInput(def.handler, def.schema) : def.handler;
3083
+ handlers[name] = def.parse ? withParsedInput(def.handler, def.schema, name) : def.handler;
3045
3084
  if (def.schema) schemas[name] = def.schema;
3046
3085
  if (def.id === false) idLessActionNames.push(name);
3047
3086
  if (def.idempotency?.required === true) idempotentActionNames.push(name);
@@ -3177,7 +3216,7 @@ function buildResourcePlugin(resource) {
3177
3216
  extensions: resource.extensions
3178
3217
  });
3179
3218
  if (resource.actions && Object.keys(resource.actions).length > 0) {
3180
- const { createActionRouter } = await import("./createActionRouter-DTSVv1VK.mjs").then((n) => n.n);
3219
+ const { createActionRouter } = await import("./createActionRouter-CpTn15dm.mjs").then((n) => n.n);
3181
3220
  const actionConfig = normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log);
3182
3221
  const actionTarget = resolveActionTargetFence(resource, actionConfig);
3183
3222
  createActionRouter(typedInstance, {
@@ -3197,7 +3236,11 @@ function buildResourcePlugin(resource) {
3197
3236
  });
3198
3237
  }
3199
3238
  if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
3200
- const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-zEasm-ax.mjs"), import("./validate-Brr4b_fH.mjs").then((n) => n.r)]);
3239
+ const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }, { fieldTypesFromOpenApiSchemas }] = await Promise.all([
3240
+ import("./createAggregationRouter-CD_Hydp0.mjs"),
3241
+ import("./validate-BUeE2MLR.mjs").then((n) => n.r),
3242
+ import("./fieldTypes-EFWxCkZ5.mjs").then((n) => n.r)
3243
+ ]);
3201
3244
  const repoForAgg = resource.controller?.repository ?? resource.repository;
3202
3245
  if (!adapterSupportsAggregate(repoForAgg)) {
3203
3246
  const undispatchable = Object.entries(resource.aggregations).filter(([, cfg]) => !cfg.materialized).map(([name]) => name);
@@ -3219,7 +3262,8 @@ function buildResourcePlugin(resource) {
3219
3262
  routeGuards: resource.routeGuards,
3220
3263
  repository: repoForAgg,
3221
3264
  buildOptions,
3222
- middlewares: resource.middlewares?.aggregations
3265
+ middlewares: resource.middlewares?.aggregations,
3266
+ fieldTypes: fieldTypesFromOpenApiSchemas(resource._registryMeta?.openApiSchemas)
3223
3267
  });
3224
3268
  }
3225
3269
  if (resource.events && Object.keys(resource.events).length > 0) typedInstance.log?.debug?.(`Resource '${resource.name}' defined ${Object.keys(resource.events).length} events`);
@@ -1,10 +1,11 @@
1
1
 
2
2
  import { t as AnyRecord } from "../base-HXNgPQww.mjs";
3
- import { Et as RouteDefinition, J as MiddlewareConfig, U as PresetHook, X as RouteSchemaOptions } from "../index-Cy2-QffW.mjs";
4
- import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-B9r88jZV.mjs";
3
+ import { i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-baQc3MaO.mjs";
4
+ import { i as registerSseStats, n as SseConnectionGauge, r as createSseConnectionGauge, t as SSEStats } from "../sseStats-DQqNN385.mjs";
5
+ import { _ as _default$2, a as MetricsOptions, c as RealtimeOptions, d as _default$9, f as CachingOptions, g as ShutdownState, h as GracefulShutdownOptions, i as MetricsCollector, l as _default$6, m as _default$1, n as _default$10, o as _default$4, p as CachingRule, r as MetricEntry, s as ChangeOperation, t as VersioningOptions, u as SSEOptions } from "../versioning-B07RgD27.mjs";
6
+ import { J as MiddlewareConfig, Ot as RouteDefinition, U as PresetHook, X as RouteSchemaOptions } from "../index-DLCcLUQT.mjs";
5
7
  import { A as DailyLedger, C as ScheduleStats, D as DailyClock, E as DailyClaimInfo, F as HealthCheck, I as HealthOptions, L as _default$3, M as MemoryDailyLedger, N as createDailyGate, O as DailyGate, P as createMemoryDailyLedger, S as ScheduleRunContext, T as _default$8, b as DailyScheduleOptions, j as DailyRunOutcome, k as DailyGateOptions, w as SchedulesPluginOptions, x as ScheduleDefinition } from "../types-BeEJm-DV.mjs";
6
- import { i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-bzkWPt1f.mjs";
7
- import { _ as ShutdownState, a as MetricsOptions, c as RealtimeOptions, d as SSEStats, f as _default$9, g as GracefulShutdownOptions, h as _default$1, i as MetricsCollector, l as _default$6, m as CachingRule, n as _default$10, o as _default$4, p as CachingOptions, r as MetricEntry, s as ChangeOperation, t as VersioningOptions, u as SSEOptions, v as _default$2 } from "../versioning-S18y2-0C.mjs";
8
+ import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-B9r88jZV.mjs";
8
9
  import { t as TracingOptions } from "../tracing-JSFiBl5r.mjs";
9
10
  import { PaginatedResult } from "@classytic/repo-core/pagination";
10
11
  import { FastifyInstance, FastifyPluginAsync } from "fastify";
@@ -218,4 +219,4 @@ export declare function createRequestIdGenerator(opts?: Pick<RequestIdOptions, "
218
219
  headers: Record<string, string | string[] | undefined>;
219
220
  }) => string;
220
221
  declare const _default$7: FastifyPluginAsync<RequestIdOptions>;
221
- export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type DailyClaimInfo, type DailyClock, type DailyGate, type DailyGateOptions, type DailyLedger, type DailyRunOutcome, type DailyScheduleOptions, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MemoryDailyLedger, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type SSEStats, type ScheduleDefinition, type ScheduleRunContext, type ScheduleStats, type SchedulesPluginOptions, type ShutdownState, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, _default$1 as cachingPlugin, createDailyGate, createMemoryDailyLedger, defaultIsDuplicateKeyError, errorHandlerPlugin, _default$2 as gracefulShutdownPlugin, _default$3 as healthPlugin, _default$4 as metricsPlugin, _default$5 as pressurePlugin, _default$6 as realtimePlugin, _default$7 as requestIdPlugin, _default$8 as schedulesPlugin, _default$9 as ssePlugin, _default$10 as versioningPlugin };
222
+ export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type DailyClaimInfo, type DailyClock, type DailyGate, type DailyGateOptions, type DailyLedger, type DailyRunOutcome, type DailyScheduleOptions, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MemoryDailyLedger, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type SSEStats, type ScheduleDefinition, type ScheduleRunContext, type ScheduleStats, type SchedulesPluginOptions, type ShutdownState, type SseConnectionGauge, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, _default$1 as cachingPlugin, createDailyGate, createMemoryDailyLedger, createSseConnectionGauge, defaultIsDuplicateKeyError, errorHandlerPlugin, _default$2 as gracefulShutdownPlugin, _default$3 as healthPlugin, _default$4 as metricsPlugin, _default$5 as pressurePlugin, _default$6 as realtimePlugin, registerSseStats, _default$7 as requestIdPlugin, _default$8 as schedulesPlugin, _default$9 as ssePlugin, _default$10 as versioningPlugin };
@@ -1,20 +1,21 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { m as MUTATION_OPERATIONS } from "../constants-D-faL5SX.mjs";
3
- import { t as arcLog } from "../logger-VyMcSmVG.mjs";
4
- import { c as getOrgId } from "../types-HFFSwF_K.mjs";
5
- import { n as requestContext } from "../requestContext-Ct5la-SA.mjs";
6
- import { t as hasEvents } from "../typeGuards-DNlpASzd.mjs";
7
- import { t as HookSystem } from "../HookSystem-B9x-Y_k7.mjs";
8
- import { t as ResourceRegistry } from "../ResourceRegistry-BcvEJoZd.mjs";
9
- import { c as createRequestIdGenerator, l as requestId_default, n as health_default, u as sanitizeRequestId } from "../health-ezwTHQh2.mjs";
10
- import { t as caching_default } from "../caching-CJIDPZOv.mjs";
11
- import { i as createMemoryDailyLedger, r as createDailyGate, t as schedules_default } from "../schedules-gVkRcs-9.mjs";
12
- import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-3_3oN-Uc.mjs";
13
- import { t as metrics_default } from "../metrics-DjVj1sg5.mjs";
14
- import { t as realtime_default } from "../realtime-D2tqi3d2.mjs";
15
- import { t as replyHelpersPlugin } from "../replyHelpers-BJFN5AW7.mjs";
16
- import { t as sse_default } from "../sse-BqM359f1.mjs";
17
- import { t as versioning_default } from "../versioning-CE5kdWOY.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { m as MUTATION_OPERATIONS } from "../constants-DOnfMd7i.mjs";
3
+ import { n as requestContext } from "../requestContext-tUgLt9Ky.mjs";
4
+ import { t as HookSystem } from "../HookSystem-DMoeJ6Do.mjs";
5
+ import { t as ResourceRegistry } from "../ResourceRegistry-CP-iTcKy.mjs";
6
+ import { c as getOrgId } from "../types-CrOlZ4rY.mjs";
7
+ import { t as hasEvents } from "../typeGuards-_6nNQqgq.mjs";
8
+ import { a as registerSseStats, i as createSseConnectionGauge } from "../sseStream-BxQW7hPq.mjs";
9
+ import { t as caching_default } from "../caching-COTX3sDa.mjs";
10
+ import { i as createMemoryDailyLedger, r as createDailyGate, t as schedules_default } from "../schedules-D9iMVFhF.mjs";
11
+ import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-DA03vRqp.mjs";
12
+ import { c as createRequestIdGenerator, l as requestId_default, n as health_default, u as sanitizeRequestId } from "../health-BoFxrkJE.mjs";
13
+ import { t as metrics_default } from "../metrics-TJyAb1Xk.mjs";
14
+ import { t as arcLog } from "../logger-UbknHqHy.mjs";
15
+ import { t as realtime_default } from "../realtime-DXGBPtYK.mjs";
16
+ import { t as replyHelpersPlugin } from "../replyHelpers-DliJNb0-.mjs";
17
+ import { t as sse_default } from "../sse-ofvlcTQQ.mjs";
18
+ import { t as versioning_default } from "../versioning-qYgqwOhL.mjs";
18
19
  import fp from "fastify-plugin";
19
20
  import { performance as performance$1 } from "node:perf_hooks";
20
21
  // src/core/arcCorePlugin.ts
@@ -386,4 +387,4 @@ var pressure_default = fp(pressurePlugin, {
386
387
  name: "arc-pressure",
387
388
  fastify: "5.x"
388
389
  });
389
- export { arcCorePlugin_default as arcCorePlugin, caching_default as cachingPlugin, createDailyGate, createMemoryDailyLedger, createPlugin, createRequestIdGenerator, defaultIsDuplicateKeyError, errorHandlerPlugin, gracefulShutdown_default as gracefulShutdownPlugin, health_default as healthPlugin, metrics_default as metricsPlugin, pressure_default as pressurePlugin, realtime_default as realtimePlugin, replyHelpersPlugin, requestId_default as requestIdPlugin, sanitizeRequestId, schedules_default as schedulesPlugin, sse_default as ssePlugin, versioning_default as versioningPlugin };
390
+ export { arcCorePlugin_default as arcCorePlugin, caching_default as cachingPlugin, createDailyGate, createMemoryDailyLedger, createPlugin, createRequestIdGenerator, createSseConnectionGauge, defaultIsDuplicateKeyError, errorHandlerPlugin, gracefulShutdown_default as gracefulShutdownPlugin, health_default as healthPlugin, metrics_default as metricsPlugin, pressure_default as pressurePlugin, realtime_default as realtimePlugin, registerSseStats, replyHelpersPlugin, requestId_default as requestIdPlugin, sanitizeRequestId, schedules_default as schedulesPlugin, sse_default as ssePlugin, versioning_default as versioningPlugin };