@classytic/arc 2.30.0 → 2.32.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 (242) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -0
  3. package/TRADEMARK.md +22 -0
  4. package/dist/{BaseController-B5DwufbB.mjs → BaseController-Dk34dxhI.mjs} +21 -19
  5. package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
  6. package/dist/{EventTransport-C6YA8xY9.mjs → EventTransport-BV10D0oG.mjs} +1 -0
  7. package/dist/{HookSystem-WkIougo6.mjs → HookSystem-vimw5D7Z.mjs} +2 -1
  8. package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
  9. package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-BVr7PgA0.mjs} +18 -15
  10. package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-Dti7ebyv.mjs} +1 -0
  11. package/dist/audit/index.d.mts +3 -2
  12. package/dist/audit/index.mjs +2 -1
  13. package/dist/auth/audit.d.mts +1 -0
  14. package/dist/auth/audit.mjs +1 -0
  15. package/dist/auth/index.d.mts +5 -4
  16. package/dist/auth/index.mjs +11 -9
  17. package/dist/auth/redis-session.d.mts +2 -1
  18. package/dist/auth/redis-session.mjs +1 -0
  19. package/dist/{applyPermissionResult-Cf6zUCvb.mjs → authorizationDecision-__T3EJDA.mjs} +19 -10
  20. package/dist/{buildHandler-BYS3Vkfz.mjs → buildHandler-Dn7rzUJo.mjs} +6 -4
  21. package/dist/cache/index.d.mts +4 -3
  22. package/dist/cache/index.mjs +4 -3
  23. package/dist/{caching-_NJeDd1_.mjs → caching-DFJqHyFs.mjs} +2 -1
  24. package/dist/cleanup/index.d.mts +39 -16
  25. package/dist/cleanup/index.mjs +50 -38
  26. package/dist/cli/commands/describe.d.mts +2 -1
  27. package/dist/cli/commands/describe.mjs +4 -5
  28. package/dist/cli/commands/docs.d.mts +1 -0
  29. package/dist/cli/commands/docs.mjs +3 -2
  30. package/dist/cli/commands/doctor.d.mts +1 -0
  31. package/dist/cli/commands/doctor.mjs +1 -0
  32. package/dist/cli/commands/generate.d.mts +2 -1
  33. package/dist/cli/commands/generate.mjs +2 -1
  34. package/dist/cli/commands/init.d.mts +2 -1
  35. package/dist/cli/commands/init.mjs +2 -1
  36. package/dist/cli/commands/introspect.d.mts +1 -0
  37. package/dist/cli/commands/introspect.mjs +2 -1
  38. package/dist/cli/index.d.mts +3 -2
  39. package/dist/cli/index.mjs +3 -2
  40. package/dist/{constants-DNre0wRg.mjs → constants-J99LGTJI.mjs} +1 -0
  41. package/dist/context/index.d.mts +1 -0
  42. package/dist/context/index.mjs +3 -2
  43. package/dist/core/index.d.mts +3 -2
  44. package/dist/core/index.mjs +7 -6
  45. package/dist/{core-poalJLvp.mjs → core-BwwmNSp7.mjs} +3 -2
  46. package/dist/{createActionRouter-BxuywVRB.mjs → createActionRouter-DkJZWo0m.mjs} +14 -10
  47. package/dist/{createAggregationRouter-BiY-lGdY.mjs → createAggregationRouter-B1exOVD8.mjs} +10 -7
  48. package/dist/{createApp-CXrKFciH.mjs → createApp-Bv0m-Q6_.mjs} +625 -229
  49. package/dist/{defineAggregation-ufWjUwml.mjs → defineAggregation-gX4No1gt.mjs} +1 -0
  50. package/dist/{defineResource-CxWqDCAy.mjs → defineResource-XFPPUu2c.mjs} +84 -50
  51. package/dist/discovery/index.d.mts +1 -0
  52. package/dist/discovery/index.mjs +1 -0
  53. package/dist/docs/index.d.mts +3 -2
  54. package/dist/docs/index.mjs +3 -2
  55. package/dist/{elevation-C9s5hFP_.d.mts → elevation-BXCfVcNG.d.mts} +1 -0
  56. package/dist/{elevation-CIz1GjGm.mjs → elevation-DNXXxgjl.mjs} +4 -3
  57. package/dist/encryption/index.d.mts +2 -1
  58. package/dist/encryption/index.mjs +5 -3
  59. package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-B2AZUJUj.mjs} +3 -2
  60. package/dist/{errorHandler-C6yv4ZTW.d.mts → errorHandler-CpYUJmPA.d.mts} +1 -0
  61. package/dist/{errors-DHcHVAgk.d.mts → errors-BGdVwP25.d.mts} +1 -0
  62. package/dist/{errors-DkO8Nk6-.mjs → errors-Bh1KK5ps.mjs} +1 -0
  63. package/dist/{eventPlugin-D2NNR4py.mjs → eventPlugin-Dk_TyXeE.mjs} +8 -6
  64. package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
  65. package/dist/events/index.d.mts +112 -44
  66. package/dist/events/index.mjs +177 -141
  67. package/dist/events/transports/redis-stream-entry.d.mts +2 -1
  68. package/dist/events/transports/redis-stream-entry.mjs +14 -9
  69. package/dist/events/transports/redis.d.mts +2 -1
  70. package/dist/events/transports/redis.mjs +1 -0
  71. package/dist/{externalPaths-BE6wFpYv.d.mts → externalPaths-CmGOxOtD.d.mts} +1 -0
  72. package/dist/factory/index.d.mts +9 -5
  73. package/dist/factory/index.mjs +131 -7
  74. package/dist/fastify-augmentation-BppG5bMT.d.mts +179 -0
  75. package/dist/{fields-CQ_7KQWw.mjs → fields-DEi65pGj.mjs} +6 -10
  76. package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
  77. package/dist/{generate-D0wZupBg.mjs → generate-CRSG0jTv.mjs} +2 -1
  78. package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
  79. package/dist/{headers-BvlQSDMB.mjs → headers-BXjQYbeC.mjs} +2 -1
  80. package/dist/{health-CB_m4S32.mjs → health-5XnTa2uo.mjs} +1 -0
  81. package/dist/hooks/index.d.mts +2 -1
  82. package/dist/hooks/index.mjs +2 -1
  83. package/dist/idempotency/index.d.mts +3 -2
  84. package/dist/idempotency/index.mjs +8 -5
  85. package/dist/idempotency/redis.d.mts +2 -1
  86. package/dist/idempotency/redis.mjs +1 -0
  87. package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
  88. package/dist/{index-Q5gzEIWY.d.mts → index-CpzxqePp.d.mts} +107 -32
  89. package/dist/{index-Cx7bro4R.d.mts → index-DXlHwvuE.d.mts} +5 -4
  90. package/dist/index-ZWhLTp_s.d.mts +290 -0
  91. package/dist/{index-Ch16aAah.d.mts → index-zq6VrjaB.d.mts} +122 -15
  92. package/dist/index.d.mts +9 -8
  93. package/dist/index.mjs +11 -10
  94. package/dist/{init-tlRSt667.mjs → init-BbfP8aky.mjs} +25 -27
  95. package/dist/{init-BPEu8cs-.d.mts → init-Cscs4lab.d.mts} +1 -0
  96. package/dist/integrations/event-gateway.d.mts +3 -2
  97. package/dist/integrations/event-gateway.mjs +2 -1
  98. package/dist/integrations/index.d.mts +4 -3
  99. package/dist/integrations/index.mjs +1 -0
  100. package/dist/integrations/jobs/index.d.mts +2 -1
  101. package/dist/integrations/jobs/index.mjs +109 -33
  102. package/dist/integrations/mcp/index.d.mts +6 -6
  103. package/dist/integrations/mcp/index.mjs +2 -1
  104. package/dist/integrations/mcp/testing.d.mts +3 -2
  105. package/dist/integrations/mcp/testing.mjs +2 -2
  106. package/dist/integrations/streamline.d.mts +1 -0
  107. package/dist/integrations/streamline.mjs +3 -2
  108. package/dist/integrations/webhooks.d.mts +1 -0
  109. package/dist/integrations/webhooks.mjs +1 -0
  110. package/dist/integrations/websocket-pushref-redis.d.mts +2 -1
  111. package/dist/integrations/websocket-pushref-redis.mjs +1 -0
  112. package/dist/integrations/websocket-redis.d.mts +2 -1
  113. package/dist/integrations/websocket-redis.mjs +1 -0
  114. package/dist/integrations/websocket.d.mts +3 -2
  115. package/dist/integrations/websocket.mjs +38 -34
  116. package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
  117. package/dist/{interface-n5hpKg1d.mjs → interface-BP4IJCBO.mjs} +1 -0
  118. package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
  119. package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-DDSR2HFl.mjs} +2 -1
  120. package/dist/{keys-Cd316u_y.mjs → keys-B-HBTGXl.mjs} +1 -0
  121. package/dist/{loadResources-DpU8pfjV.mjs → loadResources-DisEAmkm.mjs} +4 -2
  122. package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-D1MJp13f.mjs} +2 -1
  123. package/dist/logger/index.d.mts +1 -0
  124. package/dist/logger/index.mjs +1 -0
  125. package/dist/{mcpPlugin-nRzm5g2s.mjs → mcpPlugin-CpfVpKHE.mjs} +38 -38
  126. package/dist/{memory-CmnzXE5Z.mjs → memory-DsuWnj4T.mjs} +5 -4
  127. package/dist/{metrics-fdxI5mn_.mjs → metrics-DdQL8syd.mjs} +2 -1
  128. package/dist/middleware/index.d.mts +2 -1
  129. package/dist/middleware/index.mjs +3 -2
  130. package/dist/migrations/index.d.mts +1 -0
  131. package/dist/migrations/index.mjs +3 -2
  132. package/dist/module-Br81am6m.mjs +78 -0
  133. package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-BnkBLN7v.mjs} +3 -2
  134. package/dist/{openapi-B8Vkbxbn.mjs → openapi-DIRzvxC0.mjs} +6 -5
  135. package/dist/outbox-admin/index.d.mts +85 -0
  136. package/dist/outbox-admin/index.mjs +115 -0
  137. package/dist/permissions/index.d.mts +5 -4
  138. package/dist/permissions/index.mjs +6 -5
  139. package/dist/{permissions-Bfu_8y1U.mjs → permissions-Dl_m0NCe.mjs} +308 -42
  140. package/dist/{pipe-BOLmGIxa.mjs → pipe-ELHCP3zj.mjs} +3 -4
  141. package/dist/pipeline/index.d.mts +2 -1
  142. package/dist/pipeline/index.mjs +2 -1
  143. package/dist/{pipeline-BJnpkY9i.mjs → pipeline-CPA-jx0M.mjs} +17 -14
  144. package/dist/plugins/index.d.mts +8 -7
  145. package/dist/plugins/index.mjs +16 -15
  146. package/dist/plugins/response-cache.d.mts +1 -0
  147. package/dist/plugins/response-cache.mjs +2 -1
  148. package/dist/plugins/tracing-entry.d.mts +2 -1
  149. package/dist/plugins/tracing-entry.mjs +2 -1
  150. package/dist/{pluralize-BhrgwZb9.mjs → pluralize-C2ZkKbsn.mjs} +1 -0
  151. package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-CDs87fTw.mjs} +1 -0
  152. package/dist/{preloadResources-DCfa2egz.d.mts → preloadResources-T1hmlTEZ.d.mts} +117 -12
  153. package/dist/presets/filesUpload.d.mts +6 -5
  154. package/dist/presets/filesUpload.mjs +10 -12
  155. package/dist/presets/index.d.mts +3 -2
  156. package/dist/presets/index.mjs +2 -1
  157. package/dist/presets/multiTenant.d.mts +2 -1
  158. package/dist/presets/multiTenant.mjs +3 -2
  159. package/dist/presets/search.d.mts +3 -2
  160. package/dist/presets/search.mjs +2 -1
  161. package/dist/{presets-CJOEXLuk.mjs → presets-Dntd_pUO.mjs} +6 -4
  162. package/dist/{projection-UBDgfMwu.mjs → projection-CjHhM5W1.mjs} +2 -1
  163. package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
  164. package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
  165. package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-Dhps-Ldt.mjs} +6 -5
  166. package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-C7mmAGs3.mjs} +7 -3
  167. package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-CccEFBfk.mjs} +1 -0
  168. package/dist/{realtime-B9nmIY5V.mjs → realtime-DVvVZZFz.mjs} +20 -9
  169. package/dist/{redis-UDtLaNj6.d.mts → redis-CduhKsJi.d.mts} +2 -1
  170. package/dist/{redis-stream-uIaauNpZ.d.mts → redis-stream-qN6A-RFv.d.mts} +2 -1
  171. package/dist/{registerRoute-JkxIEBJq.mjs → registerRoute-B_QrjYZS.mjs} +10 -7
  172. package/dist/registry/index.d.mts +3 -2
  173. package/dist/registry/index.mjs +3 -2
  174. package/dist/{registry-BYXUUg21.mjs → registry-DqUmzA9W.mjs} +2 -1
  175. package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-BpP9wwj7.mjs} +1 -0
  176. package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DS-P0b32.mjs} +2 -1
  177. package/dist/{repositoryFilter-Dz8k3S4P.mjs → repositoryFilter-DotlxG3L.mjs} +1 -0
  178. package/dist/{requestContext-MrlJwECf.mjs → requestContext-B6vQF-sy.mjs} +1 -0
  179. package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-BhflRrBs.mjs} +1 -0
  180. package/dist/{schedules-CjOd2MG9.mjs → schedules-C2Q3uv2d.mjs} +3 -2
  181. package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-Crjvczi_.mjs} +70 -17
  182. package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-CnyKK_1j.mjs} +2 -1
  183. package/dist/schemas/index.d.mts +1 -0
  184. package/dist/schemas/index.mjs +1 -0
  185. package/dist/scim/index.d.mts +1 -0
  186. package/dist/scim/index.mjs +2 -1
  187. package/dist/scope/index.d.mts +3 -2
  188. package/dist/scope/index.mjs +5 -4
  189. package/dist/{scope-DfaPntpo.mjs → scope-afz_Ieek.mjs} +4 -3
  190. package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
  191. package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-C4KiMWUa.mjs} +1 -0
  192. package/dist/{sse-BQ1w0dfl.mjs → sse-B9P4Y-UI.mjs} +7 -5
  193. package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B3zb_d1h.mjs} +2 -1
  194. package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
  195. package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-DmEMHlPQ.mjs} +1 -0
  196. package/dist/{streaming-BQcW6_Kq.mjs → streaming-DPZdQmDz.mjs} +1 -0
  197. package/dist/{subscribe-helpers-DfzsivM6.mjs → subscribe-helpers-sp5xTDVA.mjs} +2 -1
  198. package/dist/sync/changelog.d.mts +1 -0
  199. package/dist/sync/changelog.mjs +1 -0
  200. package/dist/testing/cleanupStoreContract.d.mts +2 -1
  201. package/dist/testing/cleanupStoreContract.mjs +10 -5
  202. package/dist/testing/index.d.mts +166 -12
  203. package/dist/testing/index.mjs +315 -43
  204. package/dist/testing/outboxStoreContract.d.mts +12 -2
  205. package/dist/testing/outboxStoreContract.mjs +110 -20
  206. package/dist/testing/storageContract.d.mts +2 -1
  207. package/dist/testing/storageContract.mjs +11 -5
  208. package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
  209. package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-BvLKvOIL.mjs} +1 -0
  210. package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B_5-hKjJ.mjs} +1 -0
  211. package/dist/types/index.d.mts +6 -5
  212. package/dist/types/index.mjs +1 -0
  213. package/dist/types/storage.d.mts +2 -1
  214. package/dist/types/storage.mjs +1 -0
  215. package/dist/{types-ChvvVNP8.d.mts → types-B7XeLEgK.d.mts} +34 -2
  216. package/dist/{types-Cc91nXuA.d.mts → types-ByHn9rEO.d.mts} +1 -0
  217. package/dist/{types-C_ZZRcD6.d.mts → types-C4QE8qnm.d.mts} +1 -0
  218. package/dist/{types-D_n8L6VY.d.mts → types-CT5vu6M0.d.mts} +132 -17
  219. package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
  220. package/dist/{types-Bmmn-fO0.d.mts → types-CwcUQ610.d.mts} +2 -6
  221. package/dist/{types-CSyCxl2V.mjs → types-DXYX7dIR.mjs} +4 -3
  222. package/dist/usage/index.d.mts +3 -2
  223. package/dist/usage/index.mjs +0 -0
  224. package/dist/{userHelpers-Cg_y3fBz.mjs → userHelpers-BNsOXzOd.mjs} +1 -0
  225. package/dist/utils/index.d.mts +16 -7
  226. package/dist/utils/index.mjs +10 -9
  227. package/dist/{utils-taUVD4p3.mjs → utils-BtOha_Sp.mjs} +3 -2
  228. package/dist/{validate-Bk44F2yT.mjs → validate-PMCPR9El.mjs} +2 -1
  229. package/dist/{versioning-gKWyryT3.mjs → versioning-CKv2jz_U.mjs} +4 -3
  230. package/dist/{versioning-DXgY5BUm.d.mts → versioning-D_rhHfZm.d.mts} +5 -2
  231. package/dist/{websocket-_Pd0CgR0.d.mts → websocket-BOXVggMf.d.mts} +2 -1
  232. package/package.json +557 -539
  233. package/skills/arc/SKILL.md +22 -8
  234. package/skills/arc/references/api-reference.md +4 -0
  235. package/skills/arc/references/auth.md +3 -0
  236. package/skills/arc/references/integrations.md +33 -0
  237. package/skills/arc/references/mcp.md +6 -7
  238. package/skills/arc/references/production.md +24 -25
  239. package/skills/arc-code-review/references/anti-patterns.md +3 -3
  240. package/dist/fastify-augmentation-0WhPnUH7.d.mts +0 -76
  241. package/dist/index-CCzVR-N3.d.mts +0 -107
  242. package/dist/module-_-M7C5ES.mjs +0 -29
@@ -1,3 +1,4 @@
1
+
1
2
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
2
3
  //#region src/plugins/response-cache.d.ts
3
4
  interface ResponseCacheRule {
@@ -1,4 +1,5 @@
1
- import { t as hasEvents } from "../typeGuards-C9KXUly6.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as hasEvents } from "../typeGuards-B_5-hKjJ.mjs";
2
3
  import fp from "fastify-plugin";
3
4
  //#region src/plugins/response-cache.ts
4
5
  /**
@@ -1,2 +1,3 @@
1
- import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-CsGKQJGg.mjs";
1
+
2
+ import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-Dro5eH6j.mjs";
2
3
  export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { createRequire } from "node:module";
2
3
  import fp from "fastify-plugin";
3
4
  //#region src/plugins/tracing.ts
@@ -58,7 +59,7 @@ try {
58
59
  function createTracerProvider(options) {
59
60
  if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
60
61
  const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
61
- const resolvedVersion = serviceVersion ?? "2.30.0";
62
+ const resolvedVersion = serviceVersion ?? "2.32.0";
62
63
  const exporter = new OTLPTraceExporter({ url: exporterUrl });
63
64
  const provider = new NodeTracerProvider({ resource: { attributes: {
64
65
  "service.name": serviceName,
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  //#region src/utils/pluralize.ts
2
3
  /**
3
4
  * Lightweight English pluralization for the Arc CLI.
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  //#region src/factory/preloadResources.ts
2
3
  /**
3
4
  * Normalize an eager `import.meta.glob` result into a `ResourceLike[]`.
@@ -1,16 +1,102 @@
1
- import { Wt as Authenticator } from "./index-Q5gzEIWY.mjs";
2
- import { r as CacheStore } from "./interface-BGZCzOGL.mjs";
3
- import { n as ElevationOptions } from "./elevation-C9s5hFP_.mjs";
4
- import { a as EventTransport } from "./EventTransport-QmY7A258.mjs";
5
- import { t as ExternalOpenApiPaths } from "./externalPaths-BE6wFpYv.mjs";
6
- import { r as QueryCachePluginOptions } from "./queryCachePlugin-br4otiqF.mjs";
7
- import { t as ErrorHandlerOptions } from "./errorHandler-C6yv4ZTW.mjs";
8
- import { f as SchedulesPluginOptions, g as HealthOptions, n as ArcModuleInput, s as ResourceLike } from "./types-D_n8L6VY.mjs";
9
- import "./index-CCzVR-N3.mjs";
10
- import { t as EventPluginOptions } from "./eventPlugin-Bg3cP2_u.mjs";
11
- import { g as CachingOptions, o as MetricsOptions, p as SSEOptions, t as VersioningOptions, u as RealtimeOptions } from "./versioning-DXgY5BUm.mjs";
12
- import { r as IdempotencyStore } from "./interface-Uk8ONJv7.mjs";
1
+
2
+ import { Gt as Authenticator } from "./index-CpzxqePp.mjs";
3
+ import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
4
+ import { n as ElevationOptions } from "./elevation-BXCfVcNG.mjs";
5
+ import { a as EventTransport } from "./EventTransport-2uVV34WU.mjs";
6
+ import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
7
+ import { r as QueryCachePluginOptions } from "./queryCachePlugin-BzqxconG.mjs";
8
+ import { t as ErrorHandlerOptions } from "./errorHandler-CpYUJmPA.mjs";
9
+ import { l as ResourceLike, m as SchedulesPluginOptions, n as ArcModuleInput, v as HealthOptions } from "./types-CT5vu6M0.mjs";
10
+ import "./index-ZWhLTp_s.mjs";
11
+ import { t as EventPluginOptions } from "./eventPlugin-GF5nnBIq.mjs";
12
+ import { g as CachingOptions, o as MetricsOptions, p as SSEOptions, t as VersioningOptions, u as RealtimeOptions } from "./versioning-D_rhHfZm.mjs";
13
+ import { r as IdempotencyStore } from "./interface-DEWNOMza.mjs";
13
14
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
15
+ //#region src/factory/types/assets.d.ts
16
+ /**
17
+ * How other origins may EMBED these bytes — the value of
18
+ * `Cross-Origin-Resource-Policy` for this prefix.
19
+ *
20
+ * - `same-site` (default) — `app.example.com` may embed assets served by
21
+ * `api.example.com`; an unrelated site may not. The common deployment split.
22
+ * - `cross-origin` — ANY site may embed (and hotlink). Correct for genuinely
23
+ * public, CDN-style assets; wrong for anything caller-specific.
24
+ * - `same-origin` — only the exact same origin. Arc's app-wide default; set it
25
+ * per-root to keep a private prefix locked down.
26
+ */
27
+ type AssetCrossOrigin = "same-origin" | "same-site" | "cross-origin";
28
+ /** Cache posture for a prefix. See `CACHE_CONTROL` in `../assets.ts`. */
29
+ type AssetCache = "immutable" | "revalidate" | "none";
30
+ /** One static root mounted at one URL prefix. */
31
+ interface AssetRoot {
32
+ /**
33
+ * URL prefix to serve from, e.g. `"/uploads"`. Must be unique across roots —
34
+ * a duplicate fails at boot rather than silently shadowing.
35
+ */
36
+ readonly prefix: string;
37
+ /** Filesystem directory (or directories) to serve. Passed to `@fastify/static`. */
38
+ readonly root: string | readonly string[] | URL | readonly URL[];
39
+ /**
40
+ * Who may embed these bytes cross-origin. Defaults to `"same-site"`.
41
+ * **This is the setting that unbreaks a separate-origin frontend** — arc's
42
+ * app-wide default (from helmet) is `same-origin`, which blocks the embed even
43
+ * when CORS is correct.
44
+ */
45
+ readonly crossOrigin?: AssetCrossOrigin;
46
+ /**
47
+ * Cache posture. Defaults to `"revalidate"` — safe for mutable paths, and
48
+ * cheap in practice because `ETag` turns the steady state into a 304.
49
+ *
50
+ * Use `"immutable"` ONLY for content-addressed filenames (a hash that changes
51
+ * with the bytes). On a mutable path it serves stale content for a year.
52
+ */
53
+ readonly cache?: AssetCache;
54
+ /**
55
+ * `Content-Disposition` type. Defaults to `"attachment"`.
56
+ *
57
+ * Keep the default for anything user-uploaded: serving untrusted content
58
+ * `inline` lets an uploaded `.svg`/`.html` execute on your origin with your
59
+ * cookies. `"inline"` is for trusted, transformed derivatives you produced.
60
+ */
61
+ readonly disposition?: "inline" | "attachment";
62
+ /**
63
+ * Serve `.br`/`.gz` siblings when the client accepts them. `@fastify/static`
64
+ * adds `Vary: Accept-Encoding` automatically.
65
+ *
66
+ * ⚠ `allowedPath` is evaluated against the REQUESTED path, before the variant
67
+ * is chosen — so denying `*.gz` does NOT prevent `/main.js` from serving
68
+ * `main.js.gz`. Treat pre-compressed files as public alternate encodings of the
69
+ * same asset; keep anything restricted out of the served root entirely.
70
+ */
71
+ readonly preCompressed?: boolean;
72
+ /**
73
+ * Per-request filter. Return `false` to fall through to the 404 handler.
74
+ *
75
+ * **Synchronous by contract** (it is `@fastify/static`'s signature), so an
76
+ * async permission check CANNOT run here. That makes it the right home for a
77
+ * SIGNED-URL check — HMAC verification is synchronous, needs no database, and
78
+ * stays CDN-cacheable. For an async gate, put a `preHandler` on the prefix
79
+ * instead.
80
+ */
81
+ readonly allowedPath?: (pathName: string, root: string, request: FastifyRequest) => boolean;
82
+ /** Extra headers, applied AFTER arc's policy so a host can override it. */
83
+ readonly setHeaders?: (reply: FastifyReply, filePath: string) => void;
84
+ /** Serve `index.html` for a directory request. Default `false`. */
85
+ readonly index?: string | readonly string[] | false;
86
+ /** Emit `ETag`. Default `true` — it is what makes `revalidate` cheap. */
87
+ readonly etag?: boolean;
88
+ /** Emit `Last-Modified`. Default `true`. */
89
+ readonly lastModified?: boolean;
90
+ /** Support byte ranges — audio/video seeking, resumable downloads. Default `true`. */
91
+ readonly acceptRanges?: boolean;
92
+ /**
93
+ * Let this root install the `reply.sendFile()` decorator. Default `false`
94
+ * because only ONE registration may decorate; set it on exactly one root if
95
+ * handlers need `reply.sendFile()`.
96
+ */
97
+ readonly decorateReply?: boolean;
98
+ }
99
+ //#endregion
14
100
  //#region src/factory/types/auth.d.ts
15
101
  /**
16
102
  * Arc's built-in JWT auth
@@ -576,6 +662,25 @@ interface CreateAppOptions {
576
662
  cors?: CorsOptions | false;
577
663
  /** Rate limiting. Set to false to disable. */
578
664
  rateLimit?: RateLimitOpts | false;
665
+ /**
666
+ * Static asset roots, each served by its own `@fastify/static` registration.
667
+ *
668
+ * Arc supplies POLICY (per-prefix `Cross-Origin-Resource-Policy`, cache preset,
669
+ * `Content-Disposition`) and delegates every transport mechanic — byte ranges,
670
+ * ETag/304, immutable directives, pre-compressed variants — to the plugin.
671
+ *
672
+ * ```ts
673
+ * assets: [{ prefix: "/uploads", root: "./var/uploads", crossOrigin: "same-site" }]
674
+ * ```
675
+ *
676
+ * **Why this exists:** arc's default security headers include
677
+ * `Cross-Origin-Resource-Policy: same-origin`, which makes a browser discard the
678
+ * response when a cross-origin document tries to embed it — even though the
679
+ * request returned 200 and CORS negotiated fine. A frontend on a different
680
+ * origin cannot render an uploaded image until CORP is relaxed for that prefix.
681
+ * Requires `@fastify/static`.
682
+ */
683
+ assets?: readonly AssetRoot[];
579
684
  /** Under pressure health monitoring. Set to false to disable. */
580
685
  underPressure?: UnderPressureOptions | false;
581
686
  /** @fastify/sensible (HTTP helpers). Set to false to disable. */
@@ -1,7 +1,8 @@
1
- import { Y as PresetResult } from "../index-Q5gzEIWY.mjs";
2
- import { i as RequestScope } from "../types-DjC-KUCz.mjs";
3
- import { r as PermissionCheck } from "../types-ChvvVNP8.mjs";
4
- import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-DLUZ04kK.mjs";
1
+
2
+ import { Y as PresetResult } from "../index-CpzxqePp.mjs";
3
+ import { i as RequestScope } from "../types-ChuShpCP.mjs";
4
+ import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
5
+ import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Cx9Sz3Ou.mjs";
5
6
  //#region src/presets/filesUpload.d.ts
6
7
  interface FilesUploadPresetRoutes {
7
8
  upload?: boolean;
@@ -61,7 +62,7 @@ interface FilesUploadPresetOptions {
61
62
  /**
62
63
  * Create a files-upload preset bound to a `Storage` adapter.
63
64
  *
64
- * The preset uses `raw: true` routes so binary responses bypass arc's JSON
65
+ * The preset declares every route via `rawHandler` so binary responses bypass arc's JSON
65
66
  * envelope. Upload still returns the standard `{ success: true, data }`
66
67
  * envelope manually because the response is structured metadata, not bytes.
67
68
  */
@@ -1,10 +1,11 @@
1
- import { i as NotFoundError, u as ValidationError } from "../errors-DkO8Nk6-.mjs";
2
- import { c as getOrgId, g as getUserId } from "../types-CSyCxl2V.mjs";
3
- import { I as requireAuth, j as allowPublic } from "../permissions-Bfu_8y1U.mjs";
4
- import { t as multipartBody } from "../multipartBody-D0eBvkeq.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { i as NotFoundError, u as ValidationError } from "../errors-Bh1KK5ps.mjs";
3
+ import { c as getOrgId, g as getUserId } from "../types-DXYX7dIR.mjs";
4
+ import { B as requireAuth, F as allowPublic } from "../permissions-Dl_m0NCe.mjs";
5
+ import { t as multipartBody } from "../multipartBody-BnkBLN7v.mjs";
5
6
  //#region src/presets/filesUpload.ts
6
7
  const DEFAULT_FIELD_NAME = "file";
7
- const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
8
+ const DEFAULT_MAX_FILE_SIZE = 10485760;
8
9
  function defaultContextFrom(scope) {
9
10
  if (!scope) return {};
10
11
  const userId = getUserId(scope);
@@ -187,7 +188,7 @@ function toNotFound(err, resource, id) {
187
188
  /**
188
189
  * Create a files-upload preset bound to a `Storage` adapter.
189
190
  *
190
- * The preset uses `raw: true` routes so binary responses bypass arc's JSON
191
+ * The preset declares every route via `rawHandler` so binary responses bypass arc's JSON
191
192
  * envelope. Upload still returns the standard `{ success: true, data }`
192
193
  * envelope manually because the response is structured metadata, not bytes.
193
194
  */
@@ -222,8 +223,7 @@ function filesUploadPreset(options) {
222
223
  allowedMimeTypes,
223
224
  requiredFields: [deps.fieldName]
224
225
  })],
225
- raw: true,
226
- handler: makeUploadHandler(deps)
226
+ rawHandler: makeUploadHandler(deps)
227
227
  });
228
228
  if (includeRoutes.read) routes.push({
229
229
  method: "GET",
@@ -232,8 +232,7 @@ function filesUploadPreset(options) {
232
232
  summary: "Download a file",
233
233
  description: "Streams the stored bytes. Supports single-range `Range: bytes=start-end`.",
234
234
  permissions: options.permissions?.read ?? permissions.get ?? allowPublic(),
235
- raw: true,
236
- handler: makeReadHandler(deps),
235
+ rawHandler: makeReadHandler(deps),
237
236
  mcp: false
238
237
  });
239
238
  if (includeRoutes.delete) routes.push({
@@ -242,8 +241,7 @@ function filesUploadPreset(options) {
242
241
  operation: "filesUpload.delete",
243
242
  summary: "Delete a file",
244
243
  permissions: options.permissions?.delete ?? permissions.delete ?? requireAuth(),
245
- raw: true,
246
- handler: makeDeleteHandler(deps)
244
+ rawHandler: makeDeleteHandler(deps)
247
245
  });
248
246
  return routes;
249
247
  }
@@ -1,5 +1,6 @@
1
- import { Rt as IControllerResponse, U as ResourceConfig, Y as PresetResult, d as PaginationResult, zt as IRequestContext } from "../index-Q5gzEIWY.mjs";
2
- import { l as AnyRecord } from "../types-ChvvVNP8.mjs";
1
+
2
+ import { Rt as IControllerResponse, U as ResourceConfig, Y as PresetResult, d as PaginationResult, zt as IRequestContext } from "../index-CpzxqePp.mjs";
3
+ import { l as AnyRecord } from "../types-B7XeLEgK.mjs";
3
4
  import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
4
5
  import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
5
6
  import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
@@ -1,5 +1,6 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { multiTenantPreset } from "./multiTenant.mjs";
2
- import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-CJOEXLuk.mjs";
3
+ import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-Dntd_pUO.mjs";
3
4
  import { filesUploadPreset } from "./filesUpload.mjs";
4
5
  import { searchPreset } from "./search.mjs";
5
6
  export { applyPresets, auditedPreset, bulkPreset, filesUploadPreset, flexibleMultiTenantPreset, getAvailablePresets, getPreset, multiTenantPreset, ownedByUserPreset, registerPreset, searchPreset, slugLookupPreset, softDeletePreset, treePreset };
@@ -1,4 +1,5 @@
1
- import { X as CrudRouteKey, Y as PresetResult } from "../index-Q5gzEIWY.mjs";
1
+
2
+ import { X as CrudRouteKey, Y as PresetResult } from "../index-CpzxqePp.mjs";
2
3
  //#region src/presets/multiTenant.d.ts
3
4
  /**
4
5
  * One tenant dimension for multi-field filtering. Discriminated by source:
@@ -1,5 +1,6 @@
1
- import "../constants-DNre0wRg.mjs";
2
- import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-CSyCxl2V.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import "../constants-J99LGTJI.mjs";
3
+ import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-DXYX7dIR.mjs";
3
4
  //#region src/presets/multiTenant.ts
4
5
  /**
5
6
  * Resolve a single TenantFieldSpec against the current scope.
@@ -1,5 +1,6 @@
1
- import { At as RouteDefinition, Pt as ControllerHandler, Y as PresetResult, jt as RouteMcpConfig } from "../index-Q5gzEIWY.mjs";
2
- import { r as PermissionCheck } from "../types-ChvvVNP8.mjs";
1
+
2
+ import { At as RouteDefinition, Pt as ControllerHandler, Y as PresetResult, jt as RouteMcpConfig } from "../index-CpzxqePp.mjs";
3
+ import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
3
4
  //#region src/presets/search.d.ts
4
5
  /**
5
6
  * Search Preset — backend-agnostic search / vector / embed routes
@@ -1,4 +1,5 @@
1
- import { I as requireAuth, j as allowPublic } from "../permissions-Bfu_8y1U.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { B as requireAuth, F as allowPublic } from "../permissions-Dl_m0NCe.mjs";
2
3
  //#region src/presets/search.ts
3
4
  const BUILTINS = [
4
5
  {
@@ -1,6 +1,7 @@
1
- import { l as UnauthorizedError } from "./errors-DkO8Nk6-.mjs";
2
- import { b as isElevated, n as PUBLIC_SCOPE } from "./types-CSyCxl2V.mjs";
3
- import { I as requireAuth, R as requireRoles, j as allowPublic } from "./permissions-Bfu_8y1U.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { l as UnauthorizedError } from "./errors-Bh1KK5ps.mjs";
3
+ import { b as isElevated, n as PUBLIC_SCOPE } from "./types-DXYX7dIR.mjs";
4
+ import { B as requireAuth, F as allowPublic, U as requireRoles } from "./permissions-Dl_m0NCe.mjs";
4
5
  import { multiTenantPreset } from "./presets/multiTenant.mjs";
5
6
  //#region src/presets/ownedByUser.ts
6
7
  /**
@@ -13,7 +14,8 @@ import { multiTenantPreset } from "./presets/multiTenant.mjs";
13
14
  */
14
15
  function createOwnershipCheck(ownerField, missingOwner) {
15
16
  return async (request, _reply) => {
16
- if (isElevated(request.scope ?? PUBLIC_SCOPE)) return;
17
+ const scope = request.scope ?? PUBLIC_SCOPE;
18
+ if (isElevated(scope)) return;
17
19
  const user = request.user;
18
20
  if (!user) throw new UnauthorizedError("Authentication required for this operation");
19
21
  const userWithId = user;
@@ -1,4 +1,5 @@
1
- import { c as getOrgId, g as getUserId, x as isMember } from "./types-CSyCxl2V.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { c as getOrgId, g as getUserId, x as isMember } from "./types-DXYX7dIR.mjs";
2
3
  //#region src/scope/projection.ts
3
4
  /**
4
5
  * Compute the request-scope projection. Returns `undefined` when no
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/integrations/websocket/dead-queue.d.ts
2
3
  /**
3
4
  * Per-connection dead queue — ring buffer holding the last N outbound
@@ -1,5 +1,6 @@
1
- import { r as CacheStore } from "./interface-BGZCzOGL.mjs";
2
- import { i as QueryCache } from "./QueryCache-DOMT_iq7.mjs";
1
+
2
+ import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
3
+ import { i as QueryCache } from "./QueryCache-DFA-QrU9.mjs";
3
4
  import { FastifyPluginAsync } from "fastify";
4
5
  //#region src/cache/queryCachePlugin.d.ts
5
6
  interface QueryCachePluginOptions {
@@ -1,7 +1,8 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { t as hasEvents } from "./typeGuards-C9KXUly6.mjs";
3
- import { i as versionKey, r as tagVersionKey } from "./keys-Cd316u_y.mjs";
4
- import { t as MemoryCacheStore } from "./memory-CmnzXE5Z.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
3
+ import { t as hasEvents } from "./typeGuards-B_5-hKjJ.mjs";
4
+ import { i as versionKey, r as tagVersionKey } from "./keys-B-HBTGXl.mjs";
5
+ import { t as MemoryCacheStore } from "./memory-DsuWnj4T.mjs";
5
6
  import fp from "fastify-plugin";
6
7
  //#region src/cache/QueryCache.ts
7
8
  var QueryCache = class {
@@ -99,7 +100,7 @@ var QueryCache = class {
99
100
  }
100
101
  };
101
102
  /** See `bumpVersion` — effectively non-expiring, refreshed on every bump. */
102
- const VERSION_TTL_SECONDS = 365 * 24 * 60 * 60;
103
+ const VERSION_TTL_SECONDS = 31536e3;
103
104
  //#endregion
104
105
  //#region src/cache/queryCachePlugin.ts
105
106
  var queryCachePlugin_exports = /* @__PURE__ */ __exportAll({ queryCachePlugin: () => queryCachePlugin });
@@ -1,4 +1,5 @@
1
- import { n as requestContext } from "./requestContext-MrlJwECf.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { n as requestContext } from "./requestContext-B6vQF-sy.mjs";
2
3
  //#region src/core/middlewares/arcDecorator.ts
3
4
  /**
4
5
  * Build the `arcDecorator` preHandler for a resource.
@@ -211,6 +212,7 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
211
212
  * Build the per-route Fastify `config` object shared by the CRUD, custom, and
212
213
  * action routers. Two independent concerns ride on `routeOptions.config`:
213
214
  * - `config.rateLimit` — read by `@fastify/rate-limit`.
215
+ * - `config.cors` — read by `@fastify/cors` as a per-route override.
214
216
  * - `config.arcExtensions` — read by arc plugins (encryption, …) at request
215
217
  * time, sourced from `defineResource({ extensions })`.
216
218
  *
@@ -218,10 +220,12 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
218
220
  * either stay config-free and the spread is a genuine no-op. Both fields are
219
221
  * optional in the return type, so no cast is needed when only one is set.
220
222
  */
221
- function buildRouteConfig(rateLimitConfig, extensions) {
222
- if (!rateLimitConfig && !extensions) return {};
223
+ function buildRouteConfig(rateLimitConfig, extensions, cors) {
224
+ const hasCors = cors !== void 0;
225
+ if (!rateLimitConfig && !extensions && !hasCors) return {};
223
226
  return { config: {
224
227
  ...rateLimitConfig ?? {},
228
+ ...hasCors ? { cors } : {},
225
229
  ...extensions ? { arcExtensions: extensions } : {}
226
230
  } };
227
231
  }
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  //#region src/scope/rateLimitKey.ts
2
3
  function createTenantKeyGenerator(opts) {
3
4
  if (opts?.strategy) return opts.strategy;
@@ -1,15 +1,17 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
2
3
  import { arcLog } from "./logger/index.mjs";
3
- import { n as getUserRoles } from "./userHelpers-Cg_y3fBz.mjs";
4
- import { c as getOrgId } from "./types-CSyCxl2V.mjs";
5
- import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-Cg05HPsn.mjs";
6
- import { r as evaluateAndApplyPermission } from "./applyPermissionResult-Cf6zUCvb.mjs";
7
- import { t as applyFieldReadPermissions } from "./fields-CQ_7KQWw.mjs";
8
- import { a as promoteStreamTokenToHeader } from "./streaming-BQcW6_Kq.mjs";
9
- import { t as openSseStream } from "./sseStream-BQ7Qaynp.mjs";
4
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-__T3EJDA.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-BNsOXzOd.mjs";
6
+ import { c as getOrgId } from "./types-DXYX7dIR.mjs";
7
+ import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-C4KiMWUa.mjs";
8
+ import { t as applyFieldReadPermissions } from "./fields-DEi65pGj.mjs";
9
+ import { a as promoteStreamTokenToHeader } from "./streaming-DPZdQmDz.mjs";
10
+ import { t as openSseStream } from "./sseStream-B3zb_d1h.mjs";
10
11
  import fp from "fastify-plugin";
11
12
  //#region src/plugins/realtime.ts
12
13
  var realtime_exports = /* @__PURE__ */ __exportAll({
14
+ DEFAULT_MAX_CONNECTION_MS: () => DEFAULT_MAX_CONNECTION_MS,
13
15
  buildChangeFrame: () => buildChangeFrame,
14
16
  connectionDeadlineMs: () => connectionDeadlineMs,
15
17
  default: () => realtime_default,
@@ -38,6 +40,15 @@ const MAX_MULTIPLEX_RESOURCES = 20;
38
40
  /** Node's `setTimeout` ceiling (~24.8 days); larger delays fire immediately. */
39
41
  const MAX_TIMER_MS = 2147483647;
40
42
  /**
43
+ * Secure default lease when no other bound applies (session/cookie auth with no
44
+ * token `exp`, and no explicit `maxConnectionMs`). A change feed snapshots its
45
+ * permission filters at connect, so without ANY ceiling a revoked caller would
46
+ * keep their old view forever. 30 minutes bounds that staleness while not
47
+ * churning connections. A host that truly wants a longer-lived feed sets
48
+ * `maxConnectionMs` explicitly (up to `MAX_TIMER_MS`).
49
+ */
50
+ const DEFAULT_MAX_CONNECTION_MS = 18e5;
51
+ /**
41
52
  * Milliseconds from `now` until the feed should force-close to bound
42
53
  * permission staleness — `min(auth-token exp, maxConnectionMs)`. Returns
43
54
  * `undefined` when neither bound applies (no `exp` claim, no cap → the feed
@@ -147,7 +158,7 @@ function buildChangeFrame(event, resourceName, data) {
147
158
  });
148
159
  }
149
160
  const realtimePlugin = async (fastify, opts = {}) => {
150
- const { path = "/realtime/:resource", heartbeat = 3e4, resources: allowlist, operations = CHANGE_OPERATIONS, tokenQueryParam = "token", maxConnectionMs } = opts;
161
+ const { path = "/realtime/:resource", heartbeat = 3e4, resources: allowlist, operations = CHANGE_OPERATIONS, tokenQueryParam = "token", maxConnectionMs = DEFAULT_MAX_CONNECTION_MS } = opts;
151
162
  if (!fastify.hasDecorator("events")) {
152
163
  log.warn("Events plugin (arc-events) not registered. Realtime plugin will not function. Register eventPlugin before realtimePlugin.");
153
164
  return;
@@ -1,4 +1,5 @@
1
- import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-Uk8ONJv7.mjs";
1
+
2
+ import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-DEWNOMza.mjs";
2
3
  //#region src/idempotency/stores/redis.d.ts
3
4
  interface RedisClient {
4
5
  get(key: string): Promise<string | null>;
@@ -1,4 +1,5 @@
1
- import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-QmY7A258.mjs";
1
+
2
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-2uVV34WU.mjs";
2
3
  //#region src/events/transports/redis-stream.d.ts
3
4
  interface RedisStreamLike {
4
5
  xadd(key: string, id: string, ...fieldValues: string[]): Promise<string | null>;
@@ -1,6 +1,7 @@
1
- import { f as createError } from "./errors-DkO8Nk6-.mjs";
2
- import { u as getRequestScope } from "./types-CSyCxl2V.mjs";
3
- import { r as evaluateAndApplyPermission } from "./applyPermissionResult-Cf6zUCvb.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-__T3EJDA.mjs";
3
+ import { f as createError } from "./errors-Bh1KK5ps.mjs";
4
+ import { u as getRequestScope } from "./types-DXYX7dIR.mjs";
4
5
  //#region src/core/middlewares/permissions.ts
5
6
  /**
6
7
  * Build a PermissionContext from a Fastify request. Extracted so the CRUD
@@ -31,10 +32,11 @@ function buildPermissionContext(req, opts) {
31
32
  function buildCrudPermissionMw(permissionCheck, resourceName, action) {
32
33
  if (!permissionCheck) return null;
33
34
  return async (req, reply) => {
34
- await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
35
+ const context = buildPermissionContext(req, {
35
36
  resource: resourceName,
36
37
  action
37
- }), req, reply);
38
+ });
39
+ await evaluateAndApplyPermission(permissionCheck, context, req, reply);
38
40
  };
39
41
  }
40
42
  /**
@@ -63,12 +65,13 @@ function buildActionPermissionMw(actionEnum, actionPermissions, globalAuth, reso
63
65
  if (!permissionCheck) return;
64
66
  const { action: _discard, ...data } = body;
65
67
  const params = req.params;
66
- await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
68
+ const context = buildPermissionContext(req, {
67
69
  resource: resourceName,
68
70
  action,
69
71
  resourceId: params?.id,
70
72
  data
71
- }), req, reply, { defaultDenialMessage: (user) => user ? `Permission denied for '${action}'` : "Authentication required" });
73
+ });
74
+ await evaluateAndApplyPermission(permissionCheck, context, req, reply, { defaultDenialMessage: (user) => user ? `Permission denied for '${action}'` : "Authentication required" });
72
75
  };
73
76
  }
74
77
  //#endregion
@@ -1,5 +1,6 @@
1
- import { K as ResolvedTenantPurge, R as RegisterOptions, V as ResourceDefinition, X as CrudRouteKey, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-Q5gzEIWY.mjs";
2
- import "../fastify-augmentation-0WhPnUH7.mjs";
1
+
2
+ import { K as ResolvedTenantPurge, R as RegisterOptions, V as ResourceDefinition, X as CrudRouteKey, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-CpzxqePp.mjs";
3
+ import "../fastify-augmentation-BppG5bMT.mjs";
3
4
  import { FastifyPluginAsync } from "fastify";
4
5
  import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
5
6
  //#region src/registry/assertNoTenantData.d.ts
@@ -1,3 +1,4 @@
1
- import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-BYXUUg21.mjs";
2
- import { t as ResourceRegistry } from "../ResourceRegistry-y9Hnypus.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-DqUmzA9W.mjs";
3
+ import { t as ResourceRegistry } from "../ResourceRegistry-BVr7PgA0.mjs";
3
4
  export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
@@ -1,4 +1,5 @@
1
- import { t as CRUD_OPERATIONS } from "./constants-DNre0wRg.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "./constants-J99LGTJI.mjs";
2
3
  import fp from "fastify-plugin";
3
4
  //#region src/registry/assertNoTenantData.ts
4
5
  /**
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  //#region src/lock/renewingLease.ts
2
3
  /**
3
4
  * Start renewing an ALREADY-ACQUIRED lease. The caller performed the
@@ -1,4 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
2
3
  import { toCanonicalList } from "@classytic/repo-core/pagination";
3
4
  import fp from "fastify-plugin";
4
5
  //#region src/plugins/replyHelpers.ts
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { arcLog } from "./logger/index.mjs";
2
3
  import { policyRecordToFilter } from "@classytic/repo-core/filter";
3
4
  //#region src/core/repositoryFilter.ts
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { AsyncLocalStorage } from "node:async_hooks";
2
3
  //#region src/context/requestContext.ts
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import "node:module";
2
3
  //#region \0rolldown/runtime.js
3
4
  var __defProp = Object.defineProperty;
@@ -1,5 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { t as startRenewingLease } from "./renewingLease-3cuQH7h8.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
3
+ import { t as startRenewingLease } from "./renewingLease-BpP9wwj7.mjs";
3
4
  import fp from "fastify-plugin";
4
5
  //#region src/plugins/schedules.ts
5
6
  var schedules_exports = /* @__PURE__ */ __exportAll({