@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,19 +1,19 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
3
- import { a as enterArcLoggerScope, i as runWithArcLogger, n as configureArcLogger, r as createPinoWriter, t as arcLog } from "./logger-VyMcSmVG.mjs";
4
- import { n as PUBLIC_SCOPE } from "./types-HFFSwF_K.mjs";
5
- import { t as runObservingSend } from "./observeSend-BKJHibJz.mjs";
6
- import { r as initRuntimeCapabilityRegistry, t as auditRuntimeCapabilities } from "./runtimeCapabilities-ClWr60El.mjs";
7
- import { a as runShutdown, t as initShutdownRegistry } from "./shutdown-Bi19vH0z.mjs";
8
- import { n as isScopeAwareKeyGenerator, t as createTenantKeyGenerator } from "./rateLimitKey-BWx-qep0.mjs";
9
- import { i as resolveResourceRateLimiter, n as markRateLimitingDisabled } from "./resourceRateLimit-D1oH2obv.mjs";
10
- import { r as markArcRootValidator, t as arcAjvCustomOptions } from "./routeValidator-DclDl5WJ.mjs";
11
- import { c as createRequestIdGenerator, r as mergeHealthChecks } from "./health-ezwTHQh2.mjs";
12
- import { t as parseJsonBody } from "./jsonBody-DZGiCawf.mjs";
13
- import { a as portsForModule, b as verifyEventDurability, f as resolveModuleArm, g as crudEventsOf, h as buildModuleGraph, m as analyzeModuleGraph, n as composeModules, x as verifyModuleGraph } from "./plan-C0gkeABY.mjs";
14
- import { c as wrapWithAttribution, f as defineEvent, l as wrapWithBoundary, r as CRUD_EVENT_SCHEMA } from "./eventTypes-HmAFyJmJ.mjs";
15
- import { r as withSubscriberId } from "./subscriberIdentity-CYNYw8p_.mjs";
16
- import { r as getOptionalModuleExports } from "./module-BqPJpZ_L.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
3
+ import { a as enterArcLoggerScope, i as runWithArcLogger, n as configureArcLogger, r as createPinoWriter, t as arcLog } from "./logger-UbknHqHy.mjs";
4
+ import { n as PUBLIC_SCOPE } from "./types-CrOlZ4rY.mjs";
5
+ import { t as runObservingSend } from "./observeSend-DrA3ADFN.mjs";
6
+ import { r as initRuntimeCapabilityRegistry, t as auditRuntimeCapabilities } from "./runtimeCapabilities-BQK-GrYe.mjs";
7
+ import { a as runShutdown, t as initShutdownRegistry } from "./shutdown-BM7Q0h4B.mjs";
8
+ import { n as isScopeAwareKeyGenerator, t as createTenantKeyGenerator } from "./rateLimitKey-56nH1cWN.mjs";
9
+ import { i as resolveResourceRateLimiter, n as markRateLimitingDisabled } from "./resourceRateLimit-iSXF8rLH.mjs";
10
+ import { i as markArcRootValidator, r as arcValidatorBuilder, t as arcAjvCustomOptions } from "./routeValidator-xNYA4rr1.mjs";
11
+ import { c as createRequestIdGenerator, r as mergeHealthChecks } from "./health-BoFxrkJE.mjs";
12
+ import { t as parseJsonBody } from "./jsonBody-DoTt5BS6.mjs";
13
+ import { a as portsForModule, b as verifyEventDurability, f as resolveModuleArm, g as crudEventsOf, h as buildModuleGraph, m as analyzeModuleGraph, n as composeModules, x as verifyModuleGraph } from "./plan-BnlNJhrj.mjs";
14
+ import { c as wrapWithAttribution, f as defineEvent, l as wrapWithBoundary, r as CRUD_EVENT_SCHEMA } from "./eventTypes-BqA-N-Uz.mjs";
15
+ import { r as withSubscriberId } from "./subscriberIdentity-DSgnoT_D.mjs";
16
+ import { r as getOptionalModuleExports } from "./module-CWiqsXnh.mjs";
17
17
  import { isProductionEnv, readEnv } from "@classytic/primitives/environment";
18
18
  import Fastify from "fastify";
19
19
  import qs from "qs";
@@ -766,7 +766,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
766
766
  await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
767
767
  trackPlugin("arc-core");
768
768
  if (config.arcPlugins?.events !== false) {
769
- const { default: eventPlugin } = await import("./eventPlugin-Co9sABCg.mjs").then((n) => n.r);
769
+ const { default: eventPlugin } = await import("./eventPlugin-D7LYtYzL.mjs").then((n) => n.r);
770
770
  const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
771
771
  await fastify.register(eventPlugin, {
772
772
  /**
@@ -821,15 +821,15 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
821
821
  trackPlugin("arc-graceful-shutdown", shutdownOpts);
822
822
  }
823
823
  if (config.arcPlugins?.caching) {
824
- const { default: cachingPlugin } = await import("./caching-CJIDPZOv.mjs").then((n) => n.n);
824
+ const { default: cachingPlugin } = await import("./caching-COTX3sDa.mjs").then((n) => n.n);
825
825
  const opts = config.arcPlugins.caching === true ? {} : config.arcPlugins.caching;
826
826
  await fastify.register(cachingPlugin, opts);
827
827
  trackPlugin("arc-caching", opts);
828
828
  }
829
829
  if (config.arcPlugins?.queryCache) {
830
- const { queryCachePlugin } = await import("./queryCachePlugin-B2jpwFcv.mjs").then((n) => n.n);
830
+ const { queryCachePlugin } = await import("./queryCachePlugin-BvB3k_Fh.mjs").then((n) => n.n);
831
831
  const opts = config.arcPlugins.queryCache === true ? {} : config.arcPlugins.queryCache;
832
- const store = config.stores?.queryCache ?? new (await (import("./memory-Lpfu8Hga.mjs").then((n) => n.n))).MemoryCacheStore();
832
+ const store = config.stores?.queryCache ?? new (await (import("./memory-C47xVsjX.mjs").then((n) => n.n))).MemoryCacheStore();
833
833
  await fastify.register(queryCachePlugin, {
834
834
  store,
835
835
  ...opts
@@ -839,7 +839,7 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
839
839
  if (config.arcPlugins?.sse) {
840
840
  if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
841
841
  else {
842
- const { default: ssePlugin } = await import("./sse-BqM359f1.mjs").then((n) => n.n);
842
+ const { default: ssePlugin } = await import("./sse-ofvlcTQQ.mjs").then((n) => n.n);
843
843
  const opts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
844
844
  await fastify.register(ssePlugin, opts);
845
845
  trackPlugin("arc-sse", opts);
@@ -848,20 +848,20 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
848
848
  if (config.arcPlugins?.realtime) {
849
849
  if (config.arcPlugins?.events === false) fastify.log.warn("Realtime plugin requires events plugin (arcPlugins.events). Realtime disabled.");
850
850
  else {
851
- const { default: realtimePlugin } = await import("./realtime-D2tqi3d2.mjs").then((n) => n.n);
851
+ const { default: realtimePlugin } = await import("./realtime-DXGBPtYK.mjs").then((n) => n.n);
852
852
  const opts = config.arcPlugins.realtime === true ? {} : config.arcPlugins.realtime;
853
853
  await fastify.register(realtimePlugin, opts);
854
854
  trackPlugin("arc-realtime", opts);
855
855
  }
856
856
  }
857
857
  if (config.arcPlugins?.metrics) {
858
- const { default: metricsPlugin } = await import("./metrics-DjVj1sg5.mjs").then((n) => n.n);
858
+ const { default: metricsPlugin } = await import("./metrics-TJyAb1Xk.mjs").then((n) => n.n);
859
859
  const opts = config.arcPlugins.metrics === true ? {} : config.arcPlugins.metrics;
860
860
  await fastify.register(metricsPlugin, opts);
861
861
  trackPlugin("arc-metrics", opts);
862
862
  }
863
863
  if (config.arcPlugins?.versioning) {
864
- const { default: versioningPlugin } = await import("./versioning-CE5kdWOY.mjs").then((n) => n.n);
864
+ const { default: versioningPlugin } = await import("./versioning-qYgqwOhL.mjs").then((n) => n.n);
865
865
  await fastify.register(versioningPlugin, config.arcPlugins.versioning);
866
866
  trackPlugin("arc-versioning", config.arcPlugins.versioning);
867
867
  }
@@ -938,7 +938,7 @@ async function registerAuth(fastify, config, trackPlugin) {
938
938
  */
939
939
  async function registerElevation(fastify, config, trackPlugin) {
940
940
  if (!config.elevation) return;
941
- const { elevationPlugin } = await import("./elevation-z--rFcZ5.mjs").then((n) => n.n);
941
+ const { elevationPlugin } = await import("./elevation-DupGuM41.mjs").then((n) => n.n);
942
942
  await fastify.register(elevationPlugin, config.elevation);
943
943
  trackPlugin("arc-elevation", config.elevation);
944
944
  fastify.log.debug("Elevation plugin enabled");
@@ -953,7 +953,7 @@ async function registerElevation(fastify, config, trackPlugin) {
953
953
  */
954
954
  async function registerErrorHandler(fastify, config, trackPlugin, moduleErrorMappers) {
955
955
  if (config.errorHandler === false) return;
956
- const { errorHandlerPlugin } = await import("./errorHandler-3_3oN-Uc.mjs").then((n) => n.r);
956
+ const { errorHandlerPlugin } = await import("./errorHandler-DA03vRqp.mjs").then((n) => n.r);
957
957
  /**
958
958
  * DISCLOSURE DEFAULTS MERGE — they used to be REPLACED, and that was two bugs.
959
959
  *
@@ -1172,7 +1172,7 @@ async function registerResources(fastify, config, preResolvedModules, skippedBri
1172
1172
  let discoveryPath;
1173
1173
  let discoveryYieldedZero = false;
1174
1174
  if (resolvedResources === void 0 && config.resourceDir) {
1175
- const { loadResources } = await import("./loadResources-CVQvYUhN.mjs").then((n) => n.n);
1175
+ const { loadResources } = await import("./loadResources-rygByIQA.mjs").then((n) => n.n);
1176
1176
  const { resolve, dirname } = await import("node:path");
1177
1177
  const { fileURLToPath } = await import("node:url");
1178
1178
  const rawDir = config.resourceDir;
@@ -1297,7 +1297,7 @@ Resources supplied by "${m.name}": ${provided}.`);
1297
1297
  if (fastify.hasDecorator("getScheduleStats")) throw new Error("[arc] modules declare scheduledJobs but schedulesPlugin was already registered manually. Configure their runner through arcPlugins.schedules so Arc can compose one schedule table.");
1298
1298
  const frozenJobs = Object.freeze(scheduledJobs.map((job) => Object.freeze({ ...job })));
1299
1299
  const scheduleOptions = typeof config.arcPlugins?.schedules === "object" ? config.arcPlugins.schedules : {};
1300
- const { default: schedulesPlugin } = await import("./schedules-gVkRcs-9.mjs").then((n) => n.n);
1300
+ const { default: schedulesPlugin } = await import("./schedules-D9iMVFhF.mjs").then((n) => n.n);
1301
1301
  await fastify.register(schedulesPlugin, {
1302
1302
  ...scheduleOptions,
1303
1303
  schedules: frozenJobs
@@ -1484,6 +1484,54 @@ const ARC_EXPOSED_HEADERS = ["set-auth-token"];
1484
1484
  */
1485
1485
  const DEFAULT_CORS_MAX_AGE = 86400;
1486
1486
  /**
1487
+ * `Access-Control-Allow-Methods` when the host's `cors` object names none:
1488
+ * the verbs arc's own routes register (CRUD `PUT`/`PATCH`/`DELETE` included),
1489
+ * the same list the production and development presets carry. `@fastify/cors`
1490
+ * alone allows only `GET,HEAD,POST`, so a host `cors` object (which replaces the
1491
+ * preset's) silently broke every cross-origin update and delete.
1492
+ */
1493
+ const ARC_DEFAULT_CORS_METHODS = [
1494
+ "GET",
1495
+ "HEAD",
1496
+ "POST",
1497
+ "PUT",
1498
+ "PATCH",
1499
+ "DELETE",
1500
+ "OPTIONS"
1501
+ ];
1502
+ /** `@fastify/cors`'s own `methods` default, answered when `options.methods` is unset. */
1503
+ const FASTIFY_CORS_DEFAULT_METHODS = [
1504
+ "GET",
1505
+ "HEAD",
1506
+ "POST"
1507
+ ];
1508
+ /**
1509
+ * CORS-safelisted methods: browsers never check them against
1510
+ * `Access-Control-Allow-Methods`, so a route on one of these verbs cannot
1511
+ * fail its preflight for want of the verb. `OPTIONS` is the preflight itself.
1512
+ */
1513
+ const PREFLIGHT_EXEMPT_METHODS = /* @__PURE__ */ new Set([
1514
+ "GET",
1515
+ "HEAD",
1516
+ "POST",
1517
+ "OPTIONS"
1518
+ ]);
1519
+ /**
1520
+ * The verbs registered routes use that the resolved CORS `methods` do not allow
1521
+ * (sorted, upper case). Safelisted verbs never count. Feeds the boot warning
1522
+ * for cross-origin PUT/PATCH/DELETE that would fail their preflight silently.
1523
+ */
1524
+ function corsMissingRouteMethods(options, routeMethods) {
1525
+ const declared = options.methods;
1526
+ const allowed = new Set((Array.isArray(declared) ? declared : typeof declared === "string" ? declared.split(",") : FASTIFY_CORS_DEFAULT_METHODS).map((m) => m.trim().toUpperCase()));
1527
+ const missing = /* @__PURE__ */ new Set();
1528
+ for (const method of routeMethods) {
1529
+ const verb = method.toUpperCase();
1530
+ if (!PREFLIGHT_EXEMPT_METHODS.has(verb) && !allowed.has(verb)) missing.add(verb);
1531
+ }
1532
+ return [...missing].sort();
1533
+ }
1534
+ /**
1487
1535
  * Resolve the host's CORS config into `@fastify/cors` options + warnings.
1488
1536
  * Throws on the one configuration arc refuses to ship (see module header).
1489
1537
  * Callers decide only HOW to surface warnings — the policy is all here.
@@ -1491,6 +1539,7 @@ const DEFAULT_CORS_MAX_AGE = 86400;
1491
1539
  function resolveCorsOptions(config) {
1492
1540
  const corsOptions = { ...config.cors ?? {} };
1493
1541
  const warnings = [];
1542
+ let methodsWarned = false;
1494
1543
  const originDeclared = "origin" in corsOptions && corsOptions.origin !== void 0;
1495
1544
  if (config.preset === "production" && !originDeclared) warnings.push("CORS origin is not explicitly configured in production. Browser apps: set cors.origin to allowed domains (e.g. ['https://app.example.com']) with credentials: true. Server-to-server / API-key services: cors: { origin: '*', credentials: false } OR cors: false to disable. Tip: when wiring cors.origin from an env var, fail fast on missing (`if (!process.env.ALLOWED_ORIGINS) throw ...`) instead of letting `undefined` slip through.");
1496
1545
  if (corsOptions.credentials === true && corsOptions.origin === "*") throw new Error("[Arc] cors: `origin: '*'` cannot be combined with `credentials: true`.\nReflecting arbitrary origins with credentials lets any website read authenticated responses (CSRF-adjacent data theft).\nFix one of:\n • cors: { origin: ['https://app.example.com'], credentials: true } — explicit allow-list\n • cors: { origin: /\\.example\\.com$/, credentials: true } — pattern allow-list\n • cors: { origin: '*', credentials: false } — public, uncredentialed API");
@@ -1506,10 +1555,19 @@ function resolveCorsOptions(config) {
1506
1555
  for (const arcHeader of ARC_EXPOSED_HEADERS) if (!declared.has(arcHeader)) exposed.push(arcHeader);
1507
1556
  corsOptions.exposedHeaders = exposed;
1508
1557
  }
1558
+ if (corsOptions.methods === void 0) {
1559
+ const origin = corsOptions.origin;
1560
+ if (typeof origin === "string" || Array.isArray(origin) || origin instanceof RegExp) corsOptions.methods = [...ARC_DEFAULT_CORS_METHODS];
1561
+ else if (corsOptions.credentials === true && (origin === true || typeof origin === "function")) {
1562
+ warnings.push("CORS `origin` reflects any origin (true or a function) with `credentials: true` and names no `methods`: arc keeps @fastify/cors's GET,HEAD,POST, so cross-origin PUT/PATCH/DELETE fail their preflight. Set cors.origin to an explicit allow-list (arc then allows its route verbs), or declare cors.methods yourself if the origin function already restricts origins.");
1563
+ methodsWarned = true;
1564
+ }
1565
+ }
1509
1566
  if (corsOptions.maxAge === void 0) corsOptions.maxAge = DEFAULT_CORS_MAX_AGE;
1510
1567
  return {
1511
1568
  options: corsOptions,
1512
- warnings
1569
+ warnings,
1570
+ methodsWarned
1513
1571
  };
1514
1572
  }
1515
1573
  // src/factory/security/rateLimit.ts
@@ -1602,6 +1660,233 @@ function compilePathMatcher(patterns) {
1602
1660
  return false;
1603
1661
  };
1604
1662
  }
1663
+ // src/factory/security/rateLimitStore.ts
1664
+ const DEFAULT_TIMEOUT_MS = 250;
1665
+ const DEFAULT_RETRY_AFTER_MS = 5e3;
1666
+ const DEFAULT_CAPACITY = 1e4;
1667
+ function positive(name, value, fallback) {
1668
+ if (value === void 0) return fallback;
1669
+ if (!Number.isFinite(value) || value <= 0) throw new Error(`[arc] rateLimit.storeFallback.${name} must be a positive number of milliseconds.`);
1670
+ return value;
1671
+ }
1672
+ /** One outage state per app: every route's child store switches together. */
1673
+ var StoreHealth = class {
1674
+ mode = "shared";
1675
+ since = /* @__PURE__ */ new Date();
1676
+ outages = 0;
1677
+ lastError;
1678
+ retryAt = 0;
1679
+ probing = false;
1680
+ retryAfterMs;
1681
+ log;
1682
+ onStatus;
1683
+ now;
1684
+ constructor(retryAfterMs, log, onStatus, now) {
1685
+ this.retryAfterMs = retryAfterMs;
1686
+ this.log = log;
1687
+ this.onStatus = onStatus;
1688
+ this.now = now;
1689
+ }
1690
+ /** Whether this call goes to the shared store: always when healthy, one probe at a time when degraded. */
1691
+ tryShared() {
1692
+ if (this.mode === "shared") return true;
1693
+ if (this.probing || this.now() < this.retryAt) return false;
1694
+ this.probing = true;
1695
+ return true;
1696
+ }
1697
+ succeeded() {
1698
+ this.probing = false;
1699
+ if (this.mode === "shared") return;
1700
+ this.mode = "shared";
1701
+ this.since = new Date(this.now());
1702
+ this.log.info({ outages: this.outages }, "[arc] rate-limit store recovered: limits are shared across instances again");
1703
+ this.report();
1704
+ }
1705
+ failed(err) {
1706
+ this.probing = false;
1707
+ this.retryAt = this.now() + this.retryAfterMs;
1708
+ if (this.mode === "fallback") return;
1709
+ this.mode = "fallback";
1710
+ this.since = new Date(this.now());
1711
+ this.outages++;
1712
+ this.lastError = err instanceof Error ? err.message : String(err);
1713
+ this.log.warn({
1714
+ err: this.lastError,
1715
+ retryAfterMs: this.retryAfterMs
1716
+ }, "[arc] rate-limit store unavailable: limiting per instance in memory until it answers again");
1717
+ this.report();
1718
+ }
1719
+ status() {
1720
+ return {
1721
+ mode: this.mode,
1722
+ since: this.since,
1723
+ outages: this.outages,
1724
+ ...this.lastError !== void 0 ? { lastError: this.lastError } : {}
1725
+ };
1726
+ }
1727
+ report() {
1728
+ try {
1729
+ this.onStatus?.(this.status());
1730
+ } catch {}
1731
+ }
1732
+ };
1733
+ /** Fixed-window counters for one store (route); the oldest key is dropped at capacity. */
1734
+ var MemoryWindows = class {
1735
+ windows = /* @__PURE__ */ new Map();
1736
+ capacity;
1737
+ now;
1738
+ constructor(capacity, now) {
1739
+ this.capacity = capacity;
1740
+ this.now = now;
1741
+ }
1742
+ incr(key, timeWindow) {
1743
+ const now = this.now();
1744
+ let slot = this.windows.get(key);
1745
+ if (!slot || slot.start + timeWindow <= now) {
1746
+ if (slot) this.windows.delete(key);
1747
+ if (this.windows.size >= this.capacity) this.evict(now, timeWindow);
1748
+ slot = {
1749
+ start: now,
1750
+ current: 0
1751
+ };
1752
+ this.windows.set(key, slot);
1753
+ }
1754
+ slot.current++;
1755
+ return {
1756
+ current: slot.current,
1757
+ ttl: slot.start + timeWindow - now
1758
+ };
1759
+ }
1760
+ read(key, timeWindow) {
1761
+ const now = this.now();
1762
+ const slot = this.windows.get(key);
1763
+ if (!slot || slot.start + timeWindow <= now) return {
1764
+ current: 0,
1765
+ ttl: 0
1766
+ };
1767
+ return {
1768
+ current: slot.current,
1769
+ ttl: slot.start + timeWindow - now
1770
+ };
1771
+ }
1772
+ evict(now, timeWindow) {
1773
+ for (const [key, slot] of this.windows) if (slot.start + timeWindow <= now) this.windows.delete(key);
1774
+ while (this.windows.size >= this.capacity) {
1775
+ const oldest = this.windows.keys().next().value;
1776
+ if (oldest === void 0) break;
1777
+ this.windows.delete(oldest);
1778
+ }
1779
+ }
1780
+ };
1781
+ var FallbackStore = class FallbackStore {
1782
+ memory;
1783
+ primary;
1784
+ health;
1785
+ timeoutMs;
1786
+ capacity;
1787
+ now;
1788
+ constructor(primary, health, timeoutMs, capacity, now) {
1789
+ this.primary = primary;
1790
+ this.health = health;
1791
+ this.timeoutMs = timeoutMs;
1792
+ this.capacity = capacity;
1793
+ this.now = now;
1794
+ this.memory = new MemoryWindows(capacity, now);
1795
+ }
1796
+ incr(key, cb, timeWindow, max) {
1797
+ this.call((done) => this.primary.incr(key, done, timeWindow, max), () => this.memory.incr(key, timeWindow), cb);
1798
+ }
1799
+ read(key, cb, timeWindow, max) {
1800
+ const read = this.primary.read;
1801
+ if (typeof read !== "function") {
1802
+ cb(/* @__PURE__ */ new Error("The configured rate-limit store does not implement a `read` method"));
1803
+ return;
1804
+ }
1805
+ this.call((done) => read.call(this.primary, key, done, timeWindow, max), () => this.memory.read(key, timeWindow), cb);
1806
+ }
1807
+ child(routeOptions) {
1808
+ return new FallbackStore(this.primary.child(routeOptions), this.health, this.timeoutMs, this.capacity, this.now);
1809
+ }
1810
+ call(shared, local, cb) {
1811
+ if (!this.health.tryShared()) {
1812
+ cb(null, local());
1813
+ return;
1814
+ }
1815
+ let settled = false;
1816
+ const settle = (err, res) => {
1817
+ if (settled) return;
1818
+ settled = true;
1819
+ clearTimeout(timer);
1820
+ if (err || !res) {
1821
+ this.health.failed(err ?? /* @__PURE__ */ new Error("rate-limit store returned no result"));
1822
+ cb(null, local());
1823
+ return;
1824
+ }
1825
+ this.health.succeeded();
1826
+ cb(null, res);
1827
+ };
1828
+ const timer = setTimeout(() => settle(/* @__PURE__ */ new Error(`rate-limit store did not answer within ${this.timeoutMs} ms`)), this.timeoutMs);
1829
+ timer.unref?.();
1830
+ try {
1831
+ shared((err, res) => settle(err, res));
1832
+ } catch (err) {
1833
+ settle(err);
1834
+ }
1835
+ }
1836
+ };
1837
+ /**
1838
+ * Build the `@fastify/rate-limit` `store` class that wraps `createPrimary` (called with the
1839
+ * plugin's global params, as the plugin would construct a store) in the fallback.
1840
+ */
1841
+ function createFallbackStoreClass(createPrimary, options) {
1842
+ const timeoutMs = positive("timeoutMs", options.timeoutMs, DEFAULT_TIMEOUT_MS);
1843
+ const retryAfterMs = positive("retryAfterMs", options.retryAfterMs, DEFAULT_RETRY_AFTER_MS);
1844
+ const capacity = positive("capacity", options.capacity, DEFAULT_CAPACITY);
1845
+ const now = options.now ?? Date.now;
1846
+ const health = new StoreHealth(retryAfterMs, options.log, options.onStatus, now);
1847
+ return class SharedStoreWithFallback extends FallbackStore {
1848
+ constructor(params) {
1849
+ super(createPrimary(params), health, timeoutMs, capacity, now);
1850
+ }
1851
+ };
1852
+ }
1853
+ const REDIS_STORE_SPECIFIER = "@fastify/rate-limit/store/RedisStore.js";
1854
+ async function loadRedisStore() {
1855
+ const mod = await import(REDIS_STORE_SPECIFIER);
1856
+ const ctor = mod.default ?? mod;
1857
+ if (typeof ctor !== "function") throw new Error(`[arc] ${REDIS_STORE_SPECIFIER} did not export the Redis store constructor`);
1858
+ return ctor;
1859
+ }
1860
+ /**
1861
+ * Wrap the shared store of built rate-limit options in the fallback (default ON whenever a
1862
+ * shared store is configured; `storeFallback: false` keeps the plugin's own behaviour).
1863
+ * `storeFallback` itself is always removed from the options handed to the plugin.
1864
+ */
1865
+ async function applyRateLimitStoreFallback(opts, log, deps = {}) {
1866
+ const { storeFallback, ...rest } = opts;
1867
+ if (storeFallback === false) return rest;
1868
+ const fallbackOptions = {
1869
+ ...storeFallback ?? {},
1870
+ log,
1871
+ ...deps.now ? { now: deps.now } : {}
1872
+ };
1873
+ if (rest.store != null) {
1874
+ const Store = rest.store;
1875
+ return {
1876
+ ...rest,
1877
+ store: createFallbackStoreClass((params) => new Store(params), fallbackOptions)
1878
+ };
1879
+ }
1880
+ if (rest.redis != null) {
1881
+ const { redis, nameSpace, ...withoutRedis } = rest;
1882
+ const RedisStore = await (deps.loadRedisStore ?? loadRedisStore)();
1883
+ return {
1884
+ ...withoutRedis,
1885
+ store: createFallbackStoreClass((params) => new RedisStore(params.continueExceeding, params.exponentialBackoff, redis, nameSpace), fallbackOptions)
1886
+ };
1887
+ }
1888
+ return rest;
1889
+ }
1605
1890
  // src/factory/registerSecurity.ts
1606
1891
  /**
1607
1892
  * Register security plugins (Helmet, CORS, Rate Limiting).
@@ -1620,17 +1905,27 @@ async function registerSecurityPlugins(fastify, config) {
1620
1905
  } else fastify.log.warn("Helmet disabled - security headers not applied");
1621
1906
  if (config.cors !== false) {
1622
1907
  const cors = await loadPlugin("cors");
1623
- const { options: corsOptions, warnings } = resolveCorsOptions(config);
1908
+ const { options: corsOptions, warnings, methodsWarned } = resolveCorsOptions(config);
1624
1909
  for (const warning of warnings) fastify.log.warn(warning);
1625
1910
  await fastify.register(cors, corsOptions);
1911
+ const routeMethods = /* @__PURE__ */ new Set();
1912
+ fastify.addHook("onRoute", (route) => {
1913
+ for (const method of [route.method].flat()) routeMethods.add(String(method));
1914
+ });
1915
+ fastify.addHook("onReady", async () => {
1916
+ if (methodsWarned) return;
1917
+ const missing = corsMissingRouteMethods(corsOptions, routeMethods);
1918
+ if (missing.length === 0) return;
1919
+ fastify.log.warn(`CORS \`methods\` omit ${missing.join(", ")}, which registered routes use: cross-origin requests on those verbs fail their browser preflight. Declare cors.methods (e.g. ['GET','HEAD','POST','PUT','PATCH','DELETE','OPTIONS']) or set cors.origin to an explicit allow-list so arc allows its route verbs. Ignore this if those routes are same-origin only.`);
1920
+ });
1626
1921
  fastify.log.debug("CORS enabled");
1627
1922
  } else fastify.log.warn("CORS disabled");
1628
1923
  if (config.rateLimit !== false) {
1629
1924
  const rateLimit = await loadPlugin("rateLimit");
1630
- const rateLimitOpts = buildRateLimitOpts(config.rateLimit ?? {
1925
+ const rateLimitOpts = await applyRateLimitStoreFallback(buildRateLimitOpts(config.rateLimit ?? {
1631
1926
  max: 100,
1632
1927
  timeWindow: "1 minute"
1633
- });
1928
+ }), fastify.log);
1634
1929
  await fastify.register(rateLimit, rateLimitOpts);
1635
1930
  const rateLimitRecord = typeof rateLimitOpts === "object" && rateLimitOpts !== null ? rateLimitOpts : void 0;
1636
1931
  const hasStore = rateLimitRecord !== void 0 && (rateLimitRecord.store != null || rateLimitRecord.redis != null);
@@ -1721,12 +2016,7 @@ async function registerUtilityPlugins(fastify, config) {
1721
2016
  * resources: [productResource, orderResource],
1722
2017
  * });
1723
2018
  */
1724
- var createApp_exports = /* @__PURE__ */ __exportAll({
1725
- ArcFactory: () => ArcFactory,
1726
- DEFAULT_LOGGER_REDACT_PATHS: () => DEFAULT_LOGGER_REDACT_PATHS,
1727
- createApp: () => createApp,
1728
- resolveLoggerConfig: () => resolveLoggerConfig
1729
- });
2019
+ var createApp_exports = /* @__PURE__ */ __exportAll({ createApp: () => createApp });
1730
2020
  /**
1731
2021
  * The fail-loud switches — ON by default — and what each one costs when a deployment turns it OFF.
1732
2022
  * Reported together at production boot, so an opt-out is never silent.
@@ -1927,6 +2217,7 @@ async function buildApp(options, loggerScope, onInstance, onBootDisposer) {
1927
2217
  ...config.requestTimeout !== void 0 ? { requestTimeout: config.requestTimeout } : {},
1928
2218
  ...config.connectionTimeout !== void 0 ? { connectionTimeout: config.connectionTimeout } : {},
1929
2219
  ...config.keepAliveTimeout !== void 0 ? { keepAliveTimeout: config.keepAliveTimeout } : {},
2220
+ ...config.http !== void 0 ? { http: { ...config.http } } : {},
1930
2221
  allowErrorHandlerOverride: true,
1931
2222
  routerOptions: {
1932
2223
  querystringParser: (str) => qs.parse(str, {
@@ -1937,7 +2228,8 @@ async function buildApp(options, loggerScope, onInstance, onBootDisposer) {
1937
2228
  }),
1938
2229
  maxParamLength: config.maxParamLength ?? 400
1939
2230
  },
1940
- ajv: { customOptions: arcAjvCustomOptions(config.ajv?.keywords) }
2231
+ ajv: { customOptions: arcAjvCustomOptions(config.ajv?.keywords) },
2232
+ schemaController: { compilersFactory: { buildValidator: arcValidatorBuilder({ coerceBody: config.ajv?.coerceBody === true }) } }
1941
2233
  });
1942
2234
  markArcRootValidator(fastify);
1943
2235
  onInstance(fastify);
@@ -1999,7 +2291,7 @@ async function buildApp(options, loggerScope, onInstance, onBootDisposer) {
1999
2291
  await registerErrorHandler(fastify, config, trackPlugin, moduleErrorMappers);
2000
2292
  await registerResources(fastify, config, resolvedModules, skippedBridges);
2001
2293
  if (config.replyHelpers) {
2002
- const { replyHelpersPlugin } = await import("./replyHelpers-BJFN5AW7.mjs").then((n) => n.n);
2294
+ const { replyHelpersPlugin } = await import("./replyHelpers-DliJNb0-.mjs").then((n) => n.n);
2003
2295
  await fastify.register(replyHelpersPlugin);
2004
2296
  }
2005
2297
  if (config.serializeBigInt) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { _ as ToolDefinition, c as McpAuthResult, r as CreateMcpServerConfig } from "./types-DduBiYaI.mjs";
2
+ import { _ as ToolDefinition, c as McpAuthResult, r as CreateMcpServerConfig } from "./types-B4E0sc6D.mjs";
3
3
  import { McpServer } from "@modelcontextprotocol/server";
4
4
  /**
5
5
  * Mutable auth ref — updated per-request by mcpPlugin.
@@ -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
  // src/core/aggregation/defineAggregation.ts
3
3
  /**
4
4
  * Declare a single resource aggregation. Exported configs flow into
@@ -1,11 +1,11 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { m as MUTATION_OPERATIONS, t as CRUD_OPERATIONS } from "./constants-D-faL5SX.mjs";
3
- import { t as arcLog } from "./logger-VyMcSmVG.mjs";
4
- import { C as isWriteVerbCapable, S as detectOverriddenWriteSlots, f as BaseController, i as resolveOpenApiSchemas, l as autoInjectTenantFieldRules, t as buildResourcePlugin } from "./plugin-BJcVOX5r.mjs";
5
- import { a as isZodSchema, i as isJsonSchema } from "./schemaConverter-CIwB5wPO.mjs";
6
- import { B as requireAuth } from "./permissions-R9T2G1PH.mjs";
7
- import { n as getAvailablePresets, t as applyPresets } from "./presets-CNDvNYsz.mjs";
8
- import { t as pluralize } from "./pluralize-CrCpyoZs.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as arcLog } from "./logger-UbknHqHy.mjs";
3
+ import { C as isWriteVerbCapable, S as detectOverriddenWriteSlots, f as BaseController, i as resolveOpenApiSchemas, l as autoInjectTenantFieldRules, t as buildResourcePlugin } from "./plugin-CrMPYbdj.mjs";
4
+ import { m as MUTATION_OPERATIONS, t as CRUD_OPERATIONS } from "./constants-DOnfMd7i.mjs";
5
+ import { B as requireAuth } from "./permissions-CFsmdYUt.mjs";
6
+ import { n as getAvailablePresets, t as applyPresets } from "./presets-CUd3L7v6.mjs";
7
+ import { t as pluralize } from "./pluralize-oVIxJ4CY.mjs";
8
+ import { a as isZodSchema, i as isJsonSchema } from "./schemaConverter-cIh4oX9a.mjs";
9
9
  import { isReadOnlyRepo } from "@classytic/repo-core/repository";
10
10
  import { readEnv } from "@classytic/primitives/environment";
11
11
  // src/core/defineResource/writeVerbs.ts
@@ -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 { readdir } from "node:fs/promises";
3
3
  import { extname, join, resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
@@ -1,6 +1,6 @@
1
1
 
2
- import { o as RegistryEntry } from "../index-Cy2-QffW.mjs";
3
2
  import { t as ExternalOpenApiPaths } from "../externalPaths-BOqdq5wr.mjs";
3
+ import { o as RegistryEntry } from "../index-DLCcLUQT.mjs";
4
4
  import { FastifyPluginAsync } from "fastify";
5
5
  /**
6
6
  * OpenAPI 3.0 type primitives used by arc's spec emitter.
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { n as getUserRoles } from "../userHelpers-N-k-8dNF.mjs";
3
- import { n as openapi_default, t as buildOpenApiSpec } from "../openapi-T90KrPR6.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { n as openapi_default, t as buildOpenApiSpec } from "../openapi-D6MAbYpv.mjs";
3
+ import { n as getUserRoles } from "../userHelpers-CBKx3XJN.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  // src/docs/scalar.ts
6
6
  const scalarPlugin = async (fastify, opts = {}) => {
@@ -1,8 +1,8 @@
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 { n as requireSingleHeaderValue } from "./headers-CHSOqpcY.mjs";
5
- import { n as getUserRoles } from "./userHelpers-N-k-8dNF.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
3
+ import { t as arcLog } from "./logger-UbknHqHy.mjs";
4
+ import { n as requireSingleHeaderValue } from "./headers-D4bncIOf.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-CBKx3XJN.mjs";
6
6
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
7
7
  import fp from "fastify-plugin";
8
8
  // src/scope/elevation.ts
@@ -36,10 +36,7 @@ import fp from "fastify-plugin";
36
36
  * });
37
37
  * ```
38
38
  */
39
- var elevation_exports = /* @__PURE__ */ __exportAll({
40
- default: () => elevation_default,
41
- elevationPlugin: () => elevationPlugin
42
- });
39
+ var elevation_exports = /* @__PURE__ */ __exportAll({ elevationPlugin: () => elevationPlugin });
43
40
  const log = arcLog("elevation");
44
41
  const elevationPlugin = async (fastify, opts = {}) => {
45
42
  const { platformRoles = ["superadmin"], scopeHeader = "x-arc-scope", orgHeader = "x-organization-id", onElevation } = opts;
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as ArcError } from "../errors-DyY48oRi.mjs";
3
- import { t as parseJsonBody } from "../jsonBody-DZGiCawf.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "../errors-BpYV859Y.mjs";
3
+ import { t as parseJsonBody } from "../jsonBody-DoTt5BS6.mjs";
4
4
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
5
5
  import fp from "fastify-plugin";
6
6
  // src/encryption/fieldCipher.ts
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
3
- import { m as statusToArcCode, p as isArcError } from "./errors-DyY48oRi.mjs";
1
+ /*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
3
+ import { m as statusToArcCode, p as isArcError } from "./errors-BpYV859Y.mjs";
4
4
  import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
5
5
  import { isProductionEnv } from "@classytic/primitives/environment";
6
6
  import fp from "fastify-plugin";
@@ -30,10 +30,7 @@ import fp from "fastify-plugin";
30
30
  * onError: (err) => Sentry.captureException(err),
31
31
  * });
32
32
  */
33
- var errorHandler_exports = /* @__PURE__ */ __exportAll({
34
- defaultIsDuplicateKeyError: () => defaultIsDuplicateKeyError,
35
- errorHandlerPlugin: () => errorHandlerPlugin
36
- });
33
+ var errorHandler_exports = /* @__PURE__ */ __exportAll({ errorHandlerPlugin: () => errorHandlerPlugin });
37
34
  /** Canonical 404 body for a request that matched no route. */
38
35
  function notFoundContract(request) {
39
36
  const correlationId = request.id;
@@ -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 { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
3
3
  // src/utils/errors.ts
4
4
  /**