@classytic/arc 2.47.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 (216) hide show
  1. package/dist/{EventTransport-BHKy4_Bi.mjs → EventTransport-DbHZK230.mjs} +2 -2
  2. package/dist/{HookSystem-CAIDVoKC.mjs → HookSystem-DMoeJ6Do.mjs} +2 -2
  3. package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
  4. package/dist/{ResourceRegistry-23Ml6FNe.mjs → ResourceRegistry-CP-iTcKy.mjs} +2 -2
  5. package/dist/{acquire-DoFX06fm.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-DYiubkYw.mjs → authorizationDecision-DHO94aV2.mjs} +4 -4
  13. package/dist/{boundedMap-CtdzpJ3X.mjs → boundedMap-C51EUUOm.mjs} +1 -1
  14. package/dist/{buildHandler-CARdmPNo.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-QRiryDLs.mjs → caching-COTX3sDa.mjs} +3 -6
  18. package/dist/{claimed-BLecr1j3.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-Cx7BcnHT.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-0WyMuo0f.mjs → core-BoEdFDDw.mjs} +3 -3
  34. package/dist/{createActionRouter-mLAGbpDV.mjs → createActionRouter-CpTn15dm.mjs} +54 -18
  35. package/dist/{createAggregationRouter-BEAjn3dA.mjs → createAggregationRouter-CD_Hydp0.mjs} +13 -11
  36. package/dist/{createApp-QDP4vYWH.mjs → createApp-Be6XTGD9.mjs} +332 -40
  37. package/dist/{createMcpServer-DzXHX0SO.d.mts → createMcpServer-CS2KOVP6.d.mts} +9 -10
  38. package/dist/{defineAggregation-CFNfvz-C.mjs → defineAggregation-BI5pRb8c.mjs} +1 -1
  39. package/dist/{defineResource-BROJmhzJ.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-DrXeEWWk.mjs → elevation-DupGuM41.mjs} +6 -9
  44. package/dist/encryption/index.mjs +3 -3
  45. package/dist/{errorHandler-BiBXtxj4.mjs → errorHandler-DA03vRqp.mjs} +4 -7
  46. package/dist/{errors-DnrUChAy.mjs → errors-BpYV859Y.mjs} +1 -1
  47. package/dist/{eventPlugin-BhKLUe7H.mjs → eventPlugin-D7LYtYzL.mjs} +9 -13
  48. package/dist/{eventTypes-CCIRGakw.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-CYdpcV73.mjs → fields-CT1Erg7o.mjs} +1 -1
  59. package/dist/{filter-merge-6kasezRH.mjs → filter-merge-B1eJ1pMx.mjs} +1 -1
  60. package/dist/{generate-DUkcbc4r.mjs → generate-Cr0ULavs.mjs} +2 -2
  61. package/dist/{headers-KxhrKevA.mjs → headers-D4bncIOf.mjs} +2 -2
  62. package/dist/{health-jkYNdobJ.mjs → health-BoFxrkJE.mjs} +1 -1
  63. package/dist/{health-CRJg3IIq.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-CACwpktI.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 +6 -38
  87. package/dist/integrations/mcp/index.mjs +2 -2
  88. package/dist/integrations/mcp/testing.d.mts +11 -15
  89. package/dist/integrations/mcp/testing.mjs +22 -42
  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-CzDBkCme.mjs → jsonBody-DoTt5BS6.mjs} +2 -2
  97. package/dist/{keys-Cbwf6r1B.mjs → keys--l9n7aOC.mjs} +1 -1
  98. package/dist/{loadResources-Kr6vuljv.mjs → loadResources-rygByIQA.mjs} +3 -3
  99. package/dist/{loadResourcesFromEntry-D2e0qoDR.mjs → loadResourcesFromEntry-ItNBIQ5w.mjs} +2 -2
  100. package/dist/logger/index.mjs +2 -2
  101. package/dist/{logger-C110X5Yz.mjs → logger-UbknHqHy.mjs} +1 -1
  102. package/dist/{mcpPlugin-4lIPr9OJ.mjs → mcpPlugin-CTkk4RP8.mjs} +218 -378
  103. package/dist/{memory-D9qkhXiB.mjs → memory-C47xVsjX.mjs} +3 -3
  104. package/dist/{metrics-B-qrrWfI.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-BD8xHgrz.mjs → module-CWiqsXnh.mjs} +1 -1
  109. package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
  110. package/dist/{multipartBody-qU7KCn1l.mjs → multipartBody-BdG1qbn1.mjs} +1 -1
  111. package/dist/{observeSend-BnPtTotW.mjs → observeSend-DrA3ADFN.mjs} +1 -1
  112. package/dist/{openapi-DoVa5SVP.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-DyITEIop.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-BBy4bOGi.mjs → permissions-CFsmdYUt.mjs} +9 -9
  120. package/dist/{pipe-BOm2o4UA.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-DDIGwuxr.mjs → plan-BnlNJhrj.mjs} +1 -1
  124. package/dist/{plugin-Bn4D_0XK.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-ClEjcKlG.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-DK2jh5YR.mjs → presets-CUd3L7v6.mjs} +4 -4
  139. package/dist/{projection-BHH-sXyS.mjs → projection-DowJlIto.mjs} +2 -2
  140. package/dist/{purger.types-2wNJK_89.mjs → purger.types-BjKy8869.mjs} +1 -1
  141. package/dist/{queryCachePlugin-Ckqe98AM.mjs → queryCachePlugin-BvB3k_Fh.mjs} +114 -14
  142. package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
  143. package/dist/{rateLimitKey-CWAjlqcN.mjs → rateLimitKey-56nH1cWN.mjs} +1 -1
  144. package/dist/{realtime-BIJi9USY.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-y9ZA-R_J.mjs → registry-Biz-6sEZ.mjs} +2 -2
  148. package/dist/{relay-BNrC1CEP.mjs → relay-DEIoMntZ.mjs} +200 -99
  149. package/dist/{renewingLease-CS43br5E.mjs → renewingLease-BCJpW9-u.mjs} +1 -1
  150. package/dist/{replyHelpers-oZDzakGb.mjs → replyHelpers-DliJNb0-.mjs} +2 -2
  151. package/dist/{requestContext-fWb_YaV2.mjs → requestContext-tUgLt9Ky.mjs} +1 -1
  152. package/dist/{requirement--2hWyyHi.mjs → requirement-0l2DApiQ.mjs} +1 -1
  153. package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
  154. package/dist/{resourceRateLimit-1WbcyMZY.mjs → resourceRateLimit-iSXF8rLH.mjs} +19 -4
  155. package/dist/{rolldown-runtime-yH2lHMo_.mjs → rolldown-runtime-gKJR3o-6.mjs} +1 -1
  156. package/dist/{routeValidator-BSlRIA5c.mjs → routeValidator-xNYA4rr1.mjs} +47 -5
  157. package/dist/{runtimeCapabilities-CYCEtU1W.mjs → runtimeCapabilities-BQK-GrYe.mjs} +1 -1
  158. package/dist/{schedules-B5WGlYIT.mjs → schedules-D9iMVFhF.mjs} +6 -9
  159. package/dist/{schemaConverter-DtNvts-6.mjs → schemaConverter-cIh4oX9a.mjs} +2 -2
  160. package/dist/{actionPermissions-DXrlWHHK.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-BwVLSyNG.mjs → scope-QyhM9w8z.mjs} +4 -4
  166. package/dist/{shutdown-BJiJN7FT.mjs → shutdown-BM7Q0h4B.mjs} +1 -1
  167. package/dist/{sse-B_50llZu.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-D-n5cwy5.mjs → store-helpers-_FRhHDyv.mjs} +1 -1
  171. package/dist/{simpleEqualityMatcher-DGRLq-1k.mjs → streamFrames-B3ZJfI02.mjs} +19 -2
  172. package/dist/{streaming-Dcgqa-hH.mjs → streaming-HZr63UiM.mjs} +1 -1
  173. package/dist/{subscriberIdentity-C9KhIXTF.mjs → subscriberIdentity-DSgnoT_D.mjs} +1 -1
  174. package/dist/{tenancy-COrhjPRZ.mjs → tenancy-_ukT0oBt.mjs} +2 -2
  175. package/dist/{tenantPreparation-BElWHytd.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-CaxKbRk_.mjs → timing-Z8p-Zlw1.mjs} +1 -1
  183. package/dist/{transactionContext-8qKON0Nk.mjs → transactionContext-DBbSTfY3.mjs} +1 -1
  184. package/dist/{typeGuards-DVjVSsXO.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-DeLiuaNv.d.mts → types-B4E0sc6D.d.mts} +20 -31
  189. package/dist/{types-DZHqOuJE.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-_eGj6kf0.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-Dd6MWpye.mjs → utils--HE8R8sH.mjs} +761 -8
  196. package/dist/{validate-BaF5wd0x.mjs → validate-BUeE2MLR.mjs} +3 -3
  197. package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
  198. package/dist/{versioning-DyV7mwtK.mjs → versioning-qYgqwOhL.mjs} +4 -7
  199. package/dist/{workScope-CmCBUmPR.mjs → workScope-C-1QHNmV.mjs} +2 -2
  200. package/llms.txt +2 -2
  201. package/package.json +42 -50
  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/mcp-custom-tools.md +1 -1
  207. package/skills/arc/references/mcp-setup.md +11 -10
  208. package/skills/arc/references/mcp-testing.md +3 -3
  209. package/skills/arc/references/production-api.md +4 -0
  210. package/skills/arc/references/production-boot.md +2 -0
  211. package/skills/arc/references/production-idempotency.md +1 -1
  212. package/skills/arc/references/production-realtime.md +28 -2
  213. package/skills/arc/references/validation.md +4 -0
  214. package/skills/arc/references/writes-hooks-errors.md +1 -0
  215. package/dist/schemaIR-uS_RHqa3.mjs +0 -108
  216. package/dist/sseStream-BjSo9Ult.mjs +0 -57
@@ -1,6 +1,6 @@
1
1
 
2
- import { t as RouteIdempotencyConfig } from "../requirement-CTRQjjQx.mjs";
3
2
  import { a as createIdempotencyResult, i as IdempotencyStore, n as IdempotencyLock, r as IdempotencyResult, t as IdempotencyAcquisition } from "../interface-BmExzQRD.mjs";
3
+ import { t as RouteIdempotencyConfig } from "../requirement-CTRQjjQx.mjs";
4
4
  import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-RpDMemdm.mjs";
5
5
  import { FastifyPluginAsync } from "fastify";
6
6
  import { RepositoryLike } from "@classytic/repo-core/adapter";
@@ -1,10 +1,10 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
- import { d as createDomainError } from "../errors-DnrUChAy.mjs";
3
- import { n as requireSingleHeaderValue } from "../headers-KxhrKevA.mjs";
4
- import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement--2hWyyHi.mjs";
5
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-D-n5cwy5.mjs";
6
- import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-CaxKbRk_.mjs";
7
- import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "../acquire-DoFX06fm.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { d as createDomainError } from "../errors-BpYV859Y.mjs";
3
+ import { n as requireSingleHeaderValue } from "../headers-D4bncIOf.mjs";
4
+ import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-Z8p-Zlw1.mjs";
5
+ import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "../acquire-CB0va87C.mjs";
6
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-_FRhHDyv.mjs";
7
+ import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement-0l2DApiQ.mjs";
8
8
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
9
9
  import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
10
10
  import { createHash } from "node:crypto";
@@ -181,7 +181,9 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
181
181
  }
182
182
  },
183
183
  async unlock(key, requestId) {
184
- await r.findOneAndUpdate(and(eq(idField, key), eq("lock.requestId", requestId)), update({ unset: ["lock"] }));
184
+ const ours = and(eq(idField, key), eq("lock.requestId", requestId));
185
+ if (((await r.deleteMany(and(ours, exists("result.statusCode", false))))?.deletedCount ?? 0) > 0) return;
186
+ await r.findOneAndUpdate(ours, update({ unset: ["lock"] }));
185
187
  },
186
188
  async isLocked(key) {
187
189
  const doc = await safeGetOne(eq(idField, key));
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
- import { t as acquireBySteps } from "../acquire-DoFX06fm.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as acquireBySteps } from "../acquire-CB0va87C.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  // src/idempotency/stores/redis.ts
5
5
  /**
@@ -2,7 +2,7 @@
2
2
  import { i as RequestScope, n as Mandate } from "./types-DnkIALZ8.mjs";
3
3
  import { c as DataPolicy, l as PermissionCheck, s as AuthorizationDecision, u as PermissionContext } from "./base-HXNgPQww.mjs";
4
4
  import { r as CacheStore, t as CacheLogger } from "./interface-WR1U0K7t.mjs";
5
- import "./resourceRateLimit-DCWglD7V.mjs";
5
+ import "./resourceRateLimit-BPiESPtG.mjs";
6
6
  import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
7
7
  /**
8
8
  * Require a sender-constrained credential — the inbound token MUST carry a
@@ -1,8 +1,8 @@
1
1
 
2
- import { i as RequestScope } from "./types-DnkIALZ8.mjs";
2
+ import "./fastify-augmentation-baQc3MaO.mjs";
3
+ import { A as RequestWithExtras, F as ResourceDefinition, I as CrudController, L as ResourceConfig, O as FastifyWithDecorators, Un as IControllerResponse, Wn as IRequestContext, X as RouteSchemaOptions, Z as ArcFieldRule, g as RequestContext, k as MiddlewareHandler, kt as RouteMcpConfig, ot as AggregationConfig, v as CrudRouterOptions, wt as ActionDefinition } from "./index-DLCcLUQT.mjs";
3
4
  import { l as PermissionCheck, t as AnyRecord } from "./base-HXNgPQww.mjs";
4
- import { A as RequestWithExtras, Dt as RouteMcpConfig, F as ResourceDefinition, Hn as IRequestContext, I as CrudController, L as ResourceConfig, O as FastifyWithDecorators, St as ActionDefinition, Vn as IControllerResponse, X as RouteSchemaOptions, Z as ArcFieldRule, g as RequestContext, k as MiddlewareHandler, ot as AggregationConfig, v as CrudRouterOptions } from "./index-Cy2-QffW.mjs";
5
- import "./fastify-augmentation-bzkWPt1f.mjs";
5
+ import { i as RequestScope } from "./types-DnkIALZ8.mjs";
6
6
  import { Filter } from "@classytic/repo-core/filter";
7
7
  import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
8
8
  import { z } from "zod";
@@ -333,11 +333,28 @@ interface RouteInputSlots {
333
333
  /** Serialization + docs. A `z.object` response strips fields it does not declare. */
334
334
  response?: Record<number, InputSchema> | undefined;
335
335
  }
336
+ /** One zod issue as the parse saw it (`params` is what a refinement's `ctx.addIssue` attached). */
337
+ interface RouteInputIssue {
338
+ readonly path: ReadonlyArray<PropertyKey>;
339
+ readonly message: string;
340
+ readonly code?: string;
341
+ readonly params?: unknown;
342
+ }
343
+ /** Options shared by {@link routeInput}, {@link crudInput}. */
344
+ interface RouteInputOptions {
345
+ /**
346
+ * A failed parse's issues -> the error to throw instead of the default 400
347
+ * `arc.validation_error`, or `undefined` to keep it. Lets a schema choose its own code: a
348
+ * refinement tags its issue (`ctx.addIssue({ ..., params: { code: 'insights.range_too_long' } })`)
349
+ * and this returns `new ArcError(msg, { code, statusCode: 400 })` for it.
350
+ */
351
+ readonly mapIssues?: ((issues: readonly RouteInputIssue[]) => Error | undefined) | undefined;
352
+ }
336
353
  /**
337
354
  * Spread into a route entry: `{ method, path, permissions, ...routeInput({ body }), handler }`.
338
355
  * `preHandler` is empty when no zod body/querystring/params slot is declared.
339
356
  */
340
- declare function routeInput<const S extends RouteInputSlots>(slots: S): {
357
+ declare function routeInput<const S extends RouteInputSlots>(slots: S, options?: RouteInputOptions): {
341
358
  schema: S;
342
359
  preHandler: RouteHandlerMethod[];
343
360
  };
@@ -349,37 +366,45 @@ declare function parsed<S extends z.ZodType>(_schema: S, value: unknown): z.outp
349
366
  */
350
367
  declare const noPayloadSchema: Readonly<Record<string, unknown>>;
351
368
  /**
352
- * Wire shape of a resource's own CRUD writes. Spread into `defineResource`:
353
- * `customSchemas` is what AJV validates (and, for zod, converts input-direction: a `.default()`
354
- * stays optional; `z.strictObject` refuses unknown keys); `openApiSchemas` makes the generated
355
- * reference describe what the route accepts rather than the stored model.
356
- *
357
- * `parse: true` also adds a create/update middleware that replaces `request.body` with the zod
358
- * OUTPUT (trim, defaults, refinements). It writes `middlewares.create` / `middlewares.update`, so
359
- * merge your own: `middlewares: { create: [...mine, ...crud.middlewares.create] }`.
369
+ * What {@link crudInput} returns. Each slot is present only when its schema was given
370
+ * (never `undefined`), so the spread type-checks under `exactOptionalPropertyTypes`.
360
371
  */
361
- declare function crudInput(input: {
362
- create?: InputSchema;
363
- update?: InputSchema;
364
- parse?: boolean;
365
- }): {
372
+ interface CrudInput {
366
373
  customSchemas: {
367
374
  create?: {
368
375
  body: InputSchema;
369
- } | undefined;
376
+ };
370
377
  update?: {
371
378
  body: InputSchema;
372
- } | undefined;
379
+ };
373
380
  };
374
381
  openApiSchemas: {
375
- createBody?: InputSchema | undefined;
376
- updateBody?: InputSchema | undefined;
382
+ createBody?: InputSchema;
383
+ updateBody?: InputSchema;
377
384
  };
385
+ /** Filled only with `parse: true`. */
378
386
  middlewares: {
379
387
  create?: MiddlewareHandler[];
380
388
  update?: MiddlewareHandler[];
381
389
  };
382
- };
390
+ }
391
+ /**
392
+ * Wire shape of a resource's own CRUD writes. Spread into `defineResource`:
393
+ * `customSchemas` is what AJV validates (and, for zod, converts input-direction: a `.default()`
394
+ * stays optional; `z.strictObject` refuses unknown keys); `openApiSchemas` makes the generated
395
+ * reference describe what the route accepts rather than the stored model.
396
+ *
397
+ * `parse: true` also adds a create/update middleware that replaces `request.body` with the zod
398
+ * OUTPUT (trim, defaults, refinements). It writes `middlewares.create` / `middlewares.update`, so
399
+ * merge your own: `middlewares: { create: [...mine, ...crud.middlewares.create] }`.
400
+ */
401
+ declare function crudInput(input: {
402
+ create?: InputSchema | undefined;
403
+ update?: InputSchema | undefined;
404
+ parse?: boolean | undefined;
405
+ /** With `parse: true`: see {@link RouteInputOptions.mapIssues}. */
406
+ mapIssues?: RouteInputOptions["mapIssues"];
407
+ }): CrudInput;
383
408
  interface ConfigError {
384
409
  field: string;
385
410
  message: string;
@@ -410,4 +435,4 @@ declare function formatValidationErrors(resourceName: string, result: Validation
410
435
  * Validate and throw if invalid
411
436
  */
412
437
  declare function assertValidConfig(config: ResourceConfig, options?: ValidateOptions): void;
413
- export { RESERVED_QUERY_PARAMS as $, DefineActionConfig as A, DEFAULT_SORT as B, VariantsMap as C, ResourceSeams as D, AdapterLike as E, CRUD_OPERATIONS as F, HOOK_PHASES as G, DEFAULT_UPDATE_METHOD as H, CrudOperation as I, MAX_FILTER_DEPTH as J, HookOperation as K, DEFAULT_ID_FIELD as L, createCrudRouter as M, createPermissionMiddleware as N, SeamedResourceConfig as O, defineAggregation as P, MutationOperation as Q, DEFAULT_LIMIT as R, VariantOverride as S, defineResourceVariants as T, DEFAULT_VERSION_FIELD as U, DEFAULT_TENANT_FIELD as V, HOOK_OPERATIONS as W, MAX_SEARCH_LENGTH as X, MAX_REGEX_LENGTH as Y, MUTATION_OPERATIONS as Z, createFastifyHandler as _, formatValidationErrors as a, getControllerScope as b, RouteInputSlots as c, parsed as d, SYSTEM_FIELDS as et, routeInput as f, isFieldReadable as g, collectReadBlockedFields as h, assertValidConfig as i, defineAction as j, mergeResourceConfig as k, crudInput as l, nativePolicyFilter as m, ValidateOptions as n, validateResourceConfig as o, NativePolicyFilter as p, HookPhase as q, ValidationResult as r, InputSchema as s, ConfigError as t, noPayloadSchema as u, createRequestContext as v, VariantsResult as w, sendControllerResponse as x, getControllerContext as y, DEFAULT_MAX_LIMIT as z };
438
+ export { MAX_SEARCH_LENGTH as $, ResourceSeams as A, DEFAULT_ID_FIELD as B, getControllerScope as C, VariantsResult as D, VariantsMap as E, createCrudRouter as F, DEFAULT_UPDATE_METHOD as G, DEFAULT_MAX_LIMIT as H, createPermissionMiddleware as I, HOOK_PHASES as J, DEFAULT_VERSION_FIELD as K, defineAggregation as L, mergeResourceConfig as M, DefineActionConfig as N, defineResourceVariants as O, defineAction as P, MAX_REGEX_LENGTH as Q, CRUD_OPERATIONS as R, getControllerContext as S, VariantOverride as T, DEFAULT_SORT as U, DEFAULT_LIMIT as V, DEFAULT_TENANT_FIELD as W, HookPhase as X, HookOperation as Y, MAX_FILTER_DEPTH as Z, nativePolicyFilter as _, formatValidationErrors as a, createFastifyHandler as b, InputSchema as c, RouteInputSlots as d, MUTATION_OPERATIONS as et, crudInput as f, NativePolicyFilter as g, routeInput as h, assertValidConfig as i, SeamedResourceConfig as j, AdapterLike as k, RouteInputIssue as l, parsed as m, ValidateOptions as n, RESERVED_QUERY_PARAMS as nt, validateResourceConfig as o, noPayloadSchema as p, HOOK_OPERATIONS as q, ValidationResult as r, SYSTEM_FIELDS as rt, CrudInput as s, ConfigError as t, MutationOperation as tt, RouteInputOptions as u, collectReadBlockedFields as v, sendControllerResponse as w, createRequestContext as x, isFieldReadable as y, CrudOperation as z };
@@ -1,7 +1,7 @@
1
1
 
2
- import { P as ArcHeaders, i as RequestScope } from "./types-DnkIALZ8.mjs";
3
2
  import { d as UserBase, l as PermissionCheck, t as AnyRecord } from "./base-HXNgPQww.mjs";
4
- import { a as QueryCacheConfig } from "./QueryCache-DdvrGG8Q.mjs";
3
+ import { P as ArcHeaders, i as RequestScope } from "./types-DnkIALZ8.mjs";
4
+ import { a as QueryCacheConfig } from "./QueryCache-BE47tmlO.mjs";
5
5
  import "./elevation-DPD0hcU-.mjs";
6
6
  import "./requirement-CTRQjjQx.mjs";
7
7
  import { n as FieldPermissionMap } from "./fields-JTkrtO-r.mjs";
@@ -399,6 +399,26 @@ interface MutationWriteContext<TDoc = AnyRecord> extends WriteContext<TDoc> {
399
399
  * against.
400
400
  */
401
401
  existing: TDoc;
402
+ /**
403
+ * `update` only, and only when the resource declares `concurrency` and
404
+ * `existing` carries a numeric version: the version this write must apply
405
+ * at. CAS with it so a concurrent write in between fails instead of being
406
+ * overwritten (mongokit:
407
+ * `repo.claimVersion(id, { from: ctx.expectedVersion }, update, session)`;
408
+ * a null result → throw repo-core's `VersionConflictError`).
409
+ *
410
+ * Arc has already rejected a stale `If-Match` with 412 before the verb ran.
411
+ * A `version_conflict` the verb throws answers 412 when the version came
412
+ * from `If-Match`, and 409 otherwise. A conflict whose `id` names a
413
+ * different document (another aggregate the verb CASes) always stays 409.
414
+ */
415
+ expectedVersion?: number;
416
+ /**
417
+ * Where {@link expectedVersion} came from: `'if-match'` — the client named
418
+ * it and arc verified it against `existing`; `'loaded'` — no `If-Match` (or
419
+ * `*`), so it is the version arc just loaded.
420
+ */
421
+ expectedVersionSource?: "if-match" | "loaded";
402
422
  }
403
423
  /**
404
424
  * Per-slot write commands. Every field is optional and independent: declare
@@ -1368,8 +1388,14 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
1368
1388
  * `existing` is the document the request was AUTHORISED against — handed over
1369
1389
  * so the verb does not re-fetch and possibly observe a different document.
1370
1390
  * `id` is the REPOSITORY PRIMARY KEY (`resolveRepoId` output), never the route param.
1391
+ * `cas` (update only, from {@link expectedVersion}) becomes `expectedVersion` /
1392
+ * `expectedVersionSource` when the resource declares `concurrency` and the loaded
1393
+ * document has a numeric version.
1371
1394
  */
1372
- protected mutationWriteContext(req: IRequestContext, id: string, existing: unknown, repo?: TRepository, uow?: TransactionHandle): MutationWriteContext;
1395
+ protected mutationWriteContext(req: IRequestContext, id: string, existing: unknown, repo?: TRepository, uow?: TransactionHandle, cas?: {
1396
+ version?: number;
1397
+ fromClient: boolean;
1398
+ }): MutationWriteContext;
1373
1399
  /**
1374
1400
  * Run after-hooks for `op`. No-op without hooks or `resourceName`. `data` is the
1375
1401
  * result for create/update, `existing` for delete.
@@ -2204,6 +2230,32 @@ type PipelineConfig = PipelineStep[] | {
2204
2230
  delete?: PipelineStep[];
2205
2231
  [operation: string]: PipelineStep[] | undefined;
2206
2232
  };
2233
+ /**
2234
+ * Declared field types for the aggregation route's URL filter coercion.
2235
+ *
2236
+ * A URL carries every value as a string. Without types the aggregation route guessed from the
2237
+ * value's shape: a range operand that LOOKS like a date (`2026-11-01`) became a `Date`, so a
2238
+ * string field holding civil dates (`civilDate[gte]=2026-11-01`) compared a Date against
2239
+ * strings and matched nothing, while a number field got string operands (`amount[gte]=10`) and
2240
+ * matched nothing either. With a declared type the operand is coerced BY THE FIELD:
2241
+ *
2242
+ * - `string` — kept as sent (never a Date)
2243
+ * - `date` — a `Date` when it parses (else kept, as before)
2244
+ * - `number` — a number when it is a finite numeric string (else kept)
2245
+ * - `boolean` — `true` / `false` from `"true"` / `"false"` (else kept)
2246
+ *
2247
+ * A field with no declared type keeps the legacy behaviour exactly (range operands that look
2248
+ * like ISO dates become Dates; everything else stays a string).
2249
+ *
2250
+ * Sources, most specific first: the aggregation's own `fieldTypes`, then the types derived from
2251
+ * the resource's generated entity schema (`adapter.generateSchemas()`, the same JSON Schema the
2252
+ * OpenAPI document and MCP tools use). Only unambiguous JSON Schema shapes are mapped:
2253
+ * `format: "date-time"` is a date; `format: "date"` is NOT mapped (a Mongo `Date` emitted with
2254
+ * `dateAs: "date"` and a civil-date string column look the same), so it keeps the legacy guess.
2255
+ */
2256
+ /** The coercion classes a URL filter operand can be cast to. */
2257
+ type AggregationFieldType = "string" | "number" | "boolean" | "date";
2258
+ type AggregationFieldTypes = Readonly<Record<string, AggregationFieldType>>;
2207
2259
  /**
2208
2260
  * Sugar for measures: `'count'` / `'count:field'` / `'sum:price'` /
2209
2261
  * `'avg:rating'` / `'min:created'` / `'max:updated'` /
@@ -2465,6 +2517,15 @@ interface AggregationConfig {
2465
2517
  * all-time scans on billion-row collections.
2466
2518
  */
2467
2519
  requireDateRange?: AggregationDateRangeRequirement;
2520
+ /**
2521
+ * Declared types of the fields a caller may filter on (`field path → "string" | "number" |
2522
+ * "boolean" | "date"`). URL operands are coerced by the field's type, so a string field holding
2523
+ * `YYYY-MM-DD` civil dates keeps `?civilDate[gte]=2026-11-01` a string instead of a Date that
2524
+ * matches nothing. Merged over the types arc derives from the resource's generated entity
2525
+ * schema (these win). A field in neither keeps the legacy guess (ISO-looking range operands
2526
+ * become Dates).
2527
+ */
2528
+ fieldTypes?: Readonly<Record<string, AggregationFieldType>>;
2468
2529
  /**
2469
2530
  * Documented index expectation. Arc warns at boot when the kit
2470
2531
  * exposes index introspection and no matching index exists. NOT
@@ -3096,8 +3157,10 @@ interface ResourceConfig<TDoc = AnyRecord> {
3096
3157
  transactional?: boolean;
3097
3158
  /**
3098
3159
  * Optimistic concurrency over HTTP (RFC 9110). Reads send `ETag: "<version>"`; an update
3099
- * with `If-Match` applies only at that version (else 412), and EVERY update is a CAS write on
3100
- * the version it loaded (else 409) — so the version, and the ETag, change on every write.
3160
+ * with `If-Match` applies only at that version (else 412), and EVERY default update is a CAS
3161
+ * write on the version it loaded (else 409) — so the version, and the ETag, change on every
3162
+ * write. With `writes.update` declared, arc still answers a stale `If-Match` with 412, but the
3163
+ * CAS is the verb's job: it receives `ctx.expectedVersion` (see `MutationWriteContext`).
3101
3164
  * `versionField` defaults to `'__v'`. Boot-fatal on a repository without the
3102
3165
  * `optimisticConcurrency` capability.
3103
3166
  */
@@ -4604,4 +4667,4 @@ type InferDocType<T> = T extends DataAdapter<infer D> ? D : T extends ResourceCo
4604
4667
  */
4605
4668
  type InferAdapterDoc<A> = A extends DataAdapter<infer D> ? D : unknown;
4606
4669
  type InferResourceDoc<T> = T extends ResourceConfig<infer D> ? D : never;
4607
- export { ResourceHookContext as $, AccessControl as $t, RequestWithExtras as A, MixinConstructor as An, AuthHelpers as At, OnTenantDeleteConfig as B, IController as Bn, TreeMixin as Bt, RequestIdOptions as C, ArcGetResult as Cn, ActionEntry as Ct, FastifyWithAuth as D, ControllerConfigurableOptions as Dn, RouteMcpConfig as Dt, FastifyRequestExtras as E, BaseControllerOptions as En, RouteDefinition as Et, ResourceDefinition as F, WriteContext as Fn, TokenPair as Ft, CrudRouteKey as G, ServerAccessor as Gn, BaseCrudController as Gt, PresetFunction as H, IRequestContext as Hn, SlugMixin as Ht, CrudController as I, WriteVerbKey as In, BaseController as It, MiddlewareConfig as J, ActionTargetCheck as Jt, CrudSchemas as K, QueryResolver as Kt, ResourceConfig as L, ControllerHandler as Ln, SoftDeleteExt as Lt, ResourceRegistry as M, BodySanitizerConfig as Mn, Authenticator as Mt, RouteRow as N, MutationWriteContext as Nn, AuthenticatorContext as Nt, FastifyWithDecorators as O, ControllerConstructionOptions as On, RouteMethod as Ot, defineResource as P, ResourceWrites as Pn, JwtContext as Pt, FieldRule$1 as Q, getEntityQuery as Qt, ResourceIdempotencyConfig as R, ControllerLike as Rn, SoftDeleteMixin as Rt, IntrospectionPluginOptions as S, ArcDeleteResult as Sn, ActionDefinition as St, EventsDecorator as T, ArcUpdateResult as Tn, ActionsMap as Tt, PresetHook as U, RawRouteHandler as Un, BulkExt as Ut, ResolvedTenantPurge as V, IControllerResponse as Vn, SlugExt as Vt, PresetResult as W, RouteHandler as Wn, BulkMixin as Wt, RouteSchemaOptions as X, getEntityId as Xt, OpenApiSchemas as Y, getActionTarget as Yt, ArcFieldRule as Z, getEntityIdField as Zt, ServiceContext as _, beforeDelete as _n, PipelineConfig as _t, IntrospectionData as a, DefineHookOptions as an, AggregationCacheConfig as at, HealthCheck as b, defineHook as bn, Transform as bt, ResourceMetadata as c, HookOperation as cn, AggregationIndexHint as ct, LookupOption as d, HookSystem as dn, AggregationRateLimit as dt, AccessControlConfig as en, ResourceHooks as et, OwnershipCheck as f, HookSystemOptions as fn, AggregationsMap as ft, RequestContext as g, beforeCreate as gn, OperationFilter as gt, QueryParserInterface as h, afterUpdate as hn, NextFunction as ht, PaginationResult as i, AroundHookHandler as in, AggMeasureShorthand as it, RegisterOptions as j, BodySanitizer as jn, AuthPluginOptions as jt, MiddlewareHandler as k, ListResult as kn, RateLimitConfig as kt, ArcInternalMetadata as l, HookPhase as ln, AggregationMaterializedContext as lt, PopulateOption as m, afterDelete as mn, Interceptor as mt, InferDocType as n, FetchDenialReason as nn, EventDefinition as nt, RegistryEntry as o, HookContext as on, AggregationConfig as ot, ParsedQuery as p, afterCreate as pn, Guard as pt, LookupPolicy as q, QueryResolverConfig as qt, InferResourceDoc as r, FetchResult as rn, AggMeasureInput as rt, RegistryStats as s, HookHandler as sn, AggregationDateRangeRequirement as st, InferAdapterDoc as t, AccessControlRepository as tn, ResourceExtensions as tt, ControllerQueryOptions as u, HookRegistration as un, AggregationMaterializedResult as ut, CrudRouterOptions as v, beforeUpdate as vn, PipelineContext as vt, ArcDecorator as w, ArcListResult as wn, ActionHandlerFn as wt, HealthOptions as x, ArcCreateResult as xn, ResourceCacheConfig as xt, GracefulShutdownOptions as y, createHookSystem as yn, PipelineStep as yt, ResourcePermissions as z, FastifyHandler as zn, TreeExt as zt };
4670
+ export { ResourceHookContext as $, getEntityIdField as $t, RequestWithExtras as A, ControllerConstructionOptions as An, RouteMethod as At, OnTenantDeleteConfig as B, ControllerLike as Bn, SoftDeleteMixin as Bt, RequestIdOptions as C, ArcCreateResult as Cn, ResourceCacheConfig as Ct, FastifyWithAuth as D, ArcUpdateResult as Dn, ActionsMap as Dt, FastifyRequestExtras as E, ArcListResult as En, ActionHandlerFn as Et, ResourceDefinition as F, MutationWriteContext as Fn, AuthenticatorContext as Ft, CrudRouteKey as G, RawRouteHandler as Gn, BulkExt as Gt, PresetFunction as H, IController as Hn, TreeMixin as Ht, CrudController as I, ResourceWrites as In, JwtContext as It, MiddlewareConfig as J, QueryResolver as Jt, CrudSchemas as K, RouteHandler as Kn, BulkMixin as Kt, ResourceConfig as L, WriteContext as Ln, TokenPair as Lt, ResourceRegistry as M, MixinConstructor as Mn, AuthHelpers as Mt, RouteRow as N, BodySanitizer as Nn, AuthPluginOptions as Nt, FastifyWithDecorators as O, BaseControllerOptions as On, RouteDefinition as Ot, defineResource as P, BodySanitizerConfig as Pn, Authenticator as Pt, FieldRule$1 as Q, getEntityId as Qt, ResourceIdempotencyConfig as R, WriteVerbKey as Rn, BaseController as Rt, IntrospectionPluginOptions as S, defineHook as Sn, Transform as St, EventsDecorator as T, ArcGetResult as Tn, ActionEntry as Tt, PresetHook as U, IControllerResponse as Un, SlugExt as Ut, ResolvedTenantPurge as V, FastifyHandler as Vn, TreeExt as Vt, PresetResult as W, IRequestContext as Wn, SlugMixin as Wt, RouteSchemaOptions as X, ActionTargetCheck as Xt, OpenApiSchemas as Y, QueryResolverConfig as Yt, ArcFieldRule as Z, getActionTarget as Zt, ServiceContext as _, afterUpdate as _n, NextFunction as _t, IntrospectionData as a, FetchResult as an, AggregationCacheConfig as at, HealthCheck as b, beforeUpdate as bn, PipelineContext as bt, ResourceMetadata as c, HookContext as cn, AggregationIndexHint as ct, LookupOption as d, HookPhase as dn, AggregationRateLimit as dt, getEntityQuery as en, ResourceHooks as et, OwnershipCheck as f, HookRegistration as fn, AggregationsMap as ft, RequestContext as g, afterDelete as gn, Interceptor as gt, QueryParserInterface as h, afterCreate as hn, Guard as ht, PaginationResult as i, FetchDenialReason as in, AggMeasureShorthand as it, RegisterOptions as j, ListResult as jn, RateLimitConfig as jt, MiddlewareHandler as k, ControllerConfigurableOptions as kn, RouteMcpConfig as kt, ArcInternalMetadata as l, HookHandler as ln, AggregationMaterializedContext as lt, PopulateOption as m, HookSystemOptions as mn, AggregationFieldTypes as mt, InferDocType as n, AccessControlConfig as nn, EventDefinition as nt, RegistryEntry as o, AroundHookHandler as on, AggregationConfig as ot, ParsedQuery as p, HookSystem as pn, AggregationFieldType as pt, LookupPolicy as q, ServerAccessor as qn, BaseCrudController as qt, InferResourceDoc as r, AccessControlRepository as rn, AggMeasureInput as rt, RegistryStats as s, DefineHookOptions as sn, AggregationDateRangeRequirement as st, InferAdapterDoc as t, AccessControl as tn, ResourceExtensions as tt, ControllerQueryOptions as u, HookOperation as un, AggregationMaterializedResult as ut, CrudRouterOptions as v, beforeCreate as vn, OperationFilter as vt, ArcDecorator as w, ArcDeleteResult as wn, ActionDefinition as wt, HealthOptions as x, createHookSystem as xn, PipelineStep as xt, GracefulShutdownOptions as y, beforeDelete as yn, PipelineConfig as yt, ResourcePermissions as z, ControllerHandler as zn, SoftDeleteExt as zt };
@@ -1,6 +1,6 @@
1
1
 
2
- import { F as ResourceDefinition } from "./index-Cy2-QffW.mjs";
3
2
  import { h as ModuleSetupContext, i as ArcModuleRegistry, l as ModuleContribution, n as ArcModule, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "./types-BeEJm-DV.mjs";
3
+ import { F as ResourceDefinition } from "./index-DLCcLUQT.mjs";
4
4
  import { FastifyInstance } from "fastify";
5
5
  type ModuleKind = "domain" | "bridge" | "platform" | "aggregator";
6
6
  /** How strictly the event graph is checked at boot. */
@@ -1,17 +1,18 @@
1
1
 
2
- import { Mt as Authenticator } from "./index-Cy2-QffW.mjs";
3
- import { r as CacheStore } from "./interface-WR1U0K7t.mjs";
4
- import { n as ElevationOptions } from "./elevation-DPD0hcU-.mjs";
5
- import { a as EventTransport } from "./EventTransport-CYEoCJGe.mjs";
6
- import { t as ExternalOpenApiPaths } from "./externalPaths-BOqdq5wr.mjs";
7
- import { r as QueryCachePluginOptions } from "./queryCachePlugin-DYQUyeJ9.mjs";
8
- import { t as ErrorHandlerOptions } from "./errorHandler-B9r88jZV.mjs";
9
2
  import { I as HealthOptions, _ as ResourceLike, o as ArcPorts, r as ArcModuleInput, w as SchedulesPluginOptions } from "./types-BeEJm-DV.mjs";
10
- import { H as ModuleGraphOptions } from "./index-DFCCQ9AE.mjs";
3
+ import { a as MetricsOptions, c as RealtimeOptions, f as CachingOptions, h as GracefulShutdownOptions, t as VersioningOptions, u as SSEOptions } from "./versioning-B07RgD27.mjs";
11
4
  import { t as EventPluginOptions } from "./eventPlugin-BY38F6yK.mjs";
12
- import { a as MetricsOptions, c as RealtimeOptions, g as GracefulShutdownOptions, p as CachingOptions, t as VersioningOptions, u as SSEOptions } from "./versioning-S18y2-0C.mjs";
5
+ import { r as QueryCachePluginOptions } from "./queryCachePlugin-DrQNnGws.mjs";
6
+ import { t as ErrorHandlerOptions } from "./errorHandler-B9r88jZV.mjs";
7
+ import { H as ModuleGraphOptions } from "./index-DexdFs1a.mjs";
8
+ import { r as CacheStore } from "./interface-WR1U0K7t.mjs";
9
+ import { a as EventTransport } from "./EventTransport-CYEoCJGe.mjs";
13
10
  import { i as IdempotencyStore } from "./interface-BmExzQRD.mjs";
11
+ import { n as ElevationOptions } from "./elevation-DPD0hcU-.mjs";
12
+ import { t as ExternalOpenApiPaths } from "./externalPaths-BOqdq5wr.mjs";
13
+ import { Pt as Authenticator } from "./index-DLCcLUQT.mjs";
14
14
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
15
+ import { ServerOptions } from "node:http";
15
16
  /**
16
17
  * How other origins may EMBED these bytes — the value of
17
18
  * `Cross-Origin-Resource-Policy` for this prefix.
@@ -374,6 +375,28 @@ type RateLimitOpts = Record<string, unknown> & {
374
375
  * `createTenantKeyGenerator`'s IP fallback (documented there).
375
376
  */
376
377
  plan?: RateLimitPlanConfig;
378
+ /**
379
+ * What happens when the SHARED store (`redis` / `store`) is unavailable.
380
+ * Default (on whenever a shared store is configured): every store call is
381
+ * bounded by `timeoutMs` (250), and an error or timeout is answered from an
382
+ * in-process fixed-window counter, so requests neither hang nor fail and
383
+ * still have a limit (per instance while degraded). One warning per outage,
384
+ * the shared store is probed every `retryAfterMs` (5000) and resumes on its
385
+ * first answer; `onStatus` reports each switch (for a health or metrics
386
+ * signal). `false` = `@fastify/rate-limit`'s own behaviour (`skipOnError`).
387
+ */
388
+ storeFallback?: false | {
389
+ timeoutMs?: number;
390
+ retryAfterMs?: number;
391
+ /** Most live keys per fallback counter; the oldest is dropped beyond it. Default 10000. */
392
+ capacity?: number;
393
+ onStatus?: (status: {
394
+ readonly mode: "shared" | "fallback";
395
+ readonly since: Date;
396
+ readonly outages: number;
397
+ readonly lastError?: string;
398
+ }) => void;
399
+ };
377
400
  };
378
401
  /** Plan-aware rate limiting (2.22) — see `rateLimit.plan` on CreateAppOptions. */
379
402
  interface RateLimitPlanConfig {
@@ -404,6 +427,8 @@ type BootDisposer = () => void | Promise<void>;
404
427
  * });
405
428
  * ```
406
429
  */
430
+ /** The Node HTTP server options {@link CreateAppOptions.http} passes through. */
431
+ type CreateAppHttpOptions = Pick<ServerOptions, "highWaterMark" | "maxHeaderSize" | "requireHostHeader" | "joinDuplicateHeaders" | "noDelay" | "keepAlive" | "keepAliveInitialDelay">;
407
432
  interface CreateAppOptions {
408
433
  /** Environment preset: 'production', 'development', 'testing', 'edge', or 'worker' */
409
434
  preset?: "production" | "development" | "testing" | "edge" | "worker";
@@ -542,6 +567,22 @@ interface CreateAppOptions {
542
567
  * the server just closed — intermittent 502s.
543
568
  */
544
569
  keepAliveTimeout?: number;
570
+ /**
571
+ * Node HTTP server options, passed through as Fastify `http`
572
+ * (`http.createServer(options, handler)`). Pass-through only — no arc
573
+ * defaults. Limited to the per-socket and parser knobs that do not overlap
574
+ * the timeout options above:
575
+ *
576
+ * - `highWaterMark` (Node 20.1+): the write buffer every accepted socket gets
577
+ * before `write()` reports it full (Node default 16 KiB). SSE streams wait
578
+ * for `drain` within their own byte budget either way; a larger mark only
579
+ * means fewer drain round trips for a big replay.
580
+ * - `maxHeaderSize`, `requireHostHeader`, `joinDuplicateHeaders`, `noDelay`,
581
+ * `keepAlive`, `keepAliveInitialDelay`: as documented for `http.createServer`.
582
+ *
583
+ * Ignored by an `https` / `http2` server built outside arc.
584
+ */
585
+ http?: CreateAppHttpOptions;
545
586
  /**
546
587
  * Max JSON body in bytes. Fastify default 1 MiB; over it is a 413
547
588
  * (`FST_ERR_CTP_BODY_TOO_LARGE`) raised BEFORE any handler runs.
@@ -754,6 +795,15 @@ interface CreateAppOptions {
754
795
  */
755
796
  ajv?: {
756
797
  keywords?: string[];
798
+ /**
799
+ * Type-coerce JSON BODY values to their schema type (`"5"` → `5`). Default `false`.
800
+ *
801
+ * Querystring, params and headers always coerce (URL values are strings). A JSON body is
802
+ * already typed, and coercing it picks the FIRST `anyOf` branch: `{ value: false }` against
803
+ * `anyOf [number, boolean, string]` became `0`. Set `true` only for clients that send
804
+ * numbers/booleans as strings in a JSON or urlencoded body (migration escape hatch).
805
+ */
806
+ coerceBody?: boolean;
757
807
  };
758
808
  /**
759
809
  * Enable `reply.sendList()` + `reply.stream()` response decorators.
@@ -999,4 +1049,4 @@ interface CreateAppOptions {
999
1049
  /** Hook called when the app is shutting down */
1000
1050
  onClose?: (fastify: FastifyInstance) => void | Promise<void>;
1001
1051
  }
1002
- export { UnderPressureOptions as a, CustomAuthenticatorOption as c, RawBodyOptions as i, CustomPluginAuthOption as l, CreateAppOptions as n, AuthOption as o, MultipartOptions as r, BetterAuthOption as s, BootDisposer as t, JwtAuthOption as u };
1052
+ export { RawBodyOptions as a, BetterAuthOption as c, JwtAuthOption as d, MultipartOptions as i, CustomAuthenticatorOption as l, CreateAppHttpOptions as n, UnderPressureOptions as o, CreateAppOptions as r, AuthOption as s, BootDisposer as t, CustomPluginAuthOption as u };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { c as DataPolicy, d as UserBase, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "./base-HXNgPQww.mjs";
3
- import { A as RequestWithExtras, Bn as IController, Bt as TreeMixin, C as RequestIdOptions, Cn as ArcGetResult, D as FastifyWithAuth, Dn as ControllerConfigurableOptions, E as FastifyRequestExtras, En as BaseControllerOptions, F as ResourceDefinition, Fn as WriteContext, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Hn as IRequestContext, Ht as SlugMixin, I as CrudController, In as WriteVerbKey, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Lt as SoftDeleteExt, Nn as MutationWriteContext, O as FastifyWithDecorators, On as ControllerConstructionOptions, P as defineResource, Pn as ResourceWrites, Q as FieldRule, Rn as ControllerLike, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ArcDeleteResult, Tn as ArcUpdateResult, Un as RawRouteHandler, Ut as BulkExt, Vn as IControllerResponse, Vt as SlugExt, W as PresetResult, Wn as RouteHandler, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jt as AuthPluginOptions, kn as ListResult, kt as RateLimitConfig, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, wn as ArcListResult, x as HealthOptions, xn as ArcCreateResult, y as GracefulShutdownOptions, zt as TreeExt } from "./index-Cy2-QffW.mjs";
3
+ import "./fastify-augmentation-baQc3MaO.mjs";
4
4
  import { a as applyFieldReadPermissions, n as FieldPermissionMap, o as applyFieldWritePermissions, s as fields, t as FieldPermission } from "./fields-JTkrtO-r.mjs";
5
- import "./fastify-augmentation-bzkWPt1f.mjs";
6
- import { $ as RESERVED_QUERY_PARAMS, B as DEFAULT_SORT, D as ResourceSeams, E as AdapterLike, F as CRUD_OPERATIONS, G as HOOK_PHASES, H as DEFAULT_UPDATE_METHOD, I as CrudOperation, J as MAX_FILTER_DEPTH, K as HookOperation, L as DEFAULT_ID_FIELD, O as SeamedResourceConfig, P as defineAggregation, Q as MutationOperation, R as DEFAULT_LIMIT, T as defineResourceVariants, V as DEFAULT_TENANT_FIELD, W as HOOK_OPERATIONS, X as MAX_SEARCH_LENGTH, Y as MAX_REGEX_LENGTH, Z as MUTATION_OPERATIONS, b as getControllerScope, et as SYSTEM_FIELDS, j as defineAction, k as mergeResourceConfig, m as nativePolicyFilter, p as NativePolicyFilter, q as HookPhase, z as DEFAULT_MAX_LIMIT } from "./index-BxZS-8So.mjs";
7
- import { C as requireScopeContext, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, J as PublicPolicy, K as createOrgPermissions, Q as anyOf, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, Y as allOf, Z as allowPublic, _ as publicRead, at as requireRoles, b as requireOrgInScope, d as adminOnly, et as denyAll, f as authenticated, g as presets_d_exports, m as ownerWithAdminBypass, nt as requireAuth, p as fullPublic, q as AllowPublicOptions, rt as requireOwnership, st as when, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly } from "./index-B5i9-vuP.mjs";
5
+ import { $ as MAX_SEARCH_LENGTH, A as ResourceSeams, B as DEFAULT_ID_FIELD, C as getControllerScope, G as DEFAULT_UPDATE_METHOD, H as DEFAULT_MAX_LIMIT, J as HOOK_PHASES, L as defineAggregation, M as mergeResourceConfig, O as defineResourceVariants, P as defineAction, Q as MAX_REGEX_LENGTH, R as CRUD_OPERATIONS, U as DEFAULT_SORT, V as DEFAULT_LIMIT, W as DEFAULT_TENANT_FIELD, X as HookPhase, Y as HookOperation, Z as MAX_FILTER_DEPTH, _ as nativePolicyFilter, et as MUTATION_OPERATIONS, g as NativePolicyFilter, j as SeamedResourceConfig, k as AdapterLike, nt as RESERVED_QUERY_PARAMS, q as HOOK_OPERATIONS, rt as SYSTEM_FIELDS, tt as MutationOperation, z as CrudOperation } from "./index-DKM2p5w5.mjs";
6
+ import { A as RequestWithExtras, An as ControllerConstructionOptions, Bn as ControllerLike, Bt as SoftDeleteMixin, C as RequestIdOptions, Cn as ArcCreateResult, D as FastifyWithAuth, Dn as ArcUpdateResult, E as FastifyRequestExtras, En as ArcListResult, F as ResourceDefinition, Fn as MutationWriteContext, G as CrudRouteKey, Gn as RawRouteHandler, Gt as BulkExt, H as PresetFunction, Hn as IController, Ht as TreeMixin, I as CrudController, In as ResourceWrites, J as MiddlewareConfig, K as CrudSchemas, Kn as RouteHandler, Kt as BulkMixin, L as ResourceConfig, Ln as WriteContext, Nt as AuthPluginOptions, O as FastifyWithDecorators, On as BaseControllerOptions, P as defineResource, Q as FieldRule, Rn as WriteVerbKey, Rt as BaseController, S as IntrospectionPluginOptions, Tn as ArcGetResult, Un as IControllerResponse, Ut as SlugExt, Vt as TreeExt, W as PresetResult, Wn as IRequestContext, Wt as SlugMixin, X as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jn as ListResult, jt as RateLimitConfig, kn as ControllerConfigurableOptions, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, qt as BaseCrudController, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, wn as ArcDeleteResult, x as HealthOptions, y as GracefulShutdownOptions, zt as SoftDeleteExt } from "./index-DLCcLUQT.mjs";
7
+ import { C as requireScopeContext, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, J as PublicPolicy, K as createOrgPermissions, Q as anyOf, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, Y as allOf, Z as allowPublic, _ as publicRead, at as requireRoles, b as requireOrgInScope, d as adminOnly, et as denyAll, f as authenticated, g as presets_d_exports, m as ownerWithAdminBypass, nt as requireAuth, p as fullPublic, q as AllowPublicOptions, rt as requireOwnership, st as when, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly } from "./index-CMNpMBtW.mjs";
8
8
  import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-DTo0me1o.mjs";
9
9
  export declare const version: string;
10
10
  export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, when };
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
- import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-Cx7BcnHT.mjs";
3
- import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-DnrUChAy.mjs";
4
- import { E as nativePolicyFilter, _ as BaseCrudController, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, p as TreeMixin } from "./plugin-Bn4D_0XK.mjs";
5
- import { t as defineAggregation } from "./defineAggregation-CFNfvz-C.mjs";
6
- import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-CYdpcV73.mjs";
7
- import { S as getControllerScope } from "./actionPermissions-DXrlWHHK.mjs";
8
- import { a as defineResourceVariants, o as mergeResourceConfig, s as defineAction } from "./core-0WyMuo0f.mjs";
9
- import { a as ResourceDefinition, t as defineResource } from "./defineResource-BROJmhzJ.mjs";
10
- import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-BBy4bOGi.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { E as nativePolicyFilter, _ as BaseCrudController, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, p as TreeMixin } from "./plugin-CrMPYbdj.mjs";
3
+ import { a as defineResourceVariants, o as mergeResourceConfig, s as defineAction } from "./core-BoEdFDDw.mjs";
4
+ import { t as defineAggregation } from "./defineAggregation-BI5pRb8c.mjs";
5
+ import { a as ResourceDefinition, t as defineResource } from "./defineResource-BAzNu5Um.mjs";
6
+ import { E as getControllerScope } from "./schemaIR-BsY4y9VP.mjs";
7
+ import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-DOnfMd7i.mjs";
8
+ import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-CFsmdYUt.mjs";
9
+ import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-CT1Erg7o.mjs";
10
+ import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-BpYV859Y.mjs";
11
11
  // src/index.ts
12
- const version = "2.47.0";
12
+ const version = "2.49.0";
13
13
  export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
  import { dirname, join } from "node:path";
@@ -1,11 +1,11 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
2
  import fp from "fastify-plugin";
3
3
  // src/integrations/event-gateway.ts
4
4
  const eventGatewayPluginImpl = async (fastify, opts = {}) => {
5
5
  const { auth = true, orgScoped, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
6
6
  if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
7
7
  if (opts.sse !== false) {
8
- const { default: ssePlugin } = await import("../sse-B_50llZu.mjs").then((n) => n.n);
8
+ const { default: ssePlugin } = await import("../sse-ofvlcTQQ.mjs").then((n) => n.n);
9
9
  await fastify.register(ssePlugin, {
10
10
  path: opts.sse?.path ?? "/events/stream",
11
11
  requireAuth: auth,
@@ -1,8 +1,8 @@
1
1
 
2
- import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BGuc-WVZ.mjs";
3
2
  import { EventGatewayOptions } from "./event-gateway.mjs";
4
3
  import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-BAXDo5eE.mjs";
5
- import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-DeLiuaNv.mjs";
4
+ import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, p as PromptDefinition, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-B4E0sc6D.mjs";
6
5
  import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
7
6
  import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
7
+ import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BGuc-WVZ.mjs";
8
8
  export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
- import { n as evaluateAndApplyPermission } from "../../authorizationDecision-DYiubkYw.mjs";
3
- import { i as runAdmittedWork, r as registerShutdownParticipant } from "../../shutdown-BJiJN7FT.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { n as evaluateAndApplyPermission } from "../../authorizationDecision-DHO94aV2.mjs";
3
+ import { i as runAdmittedWork, r as registerShutdownParticipant } from "../../shutdown-BM7Q0h4B.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  // src/integrations/jobs/execution.ts
6
6
  async function executeTimedHandler(options) {