@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,6 +1,7 @@
1
- import { g as getUserId } from "../types-CSyCxl2V.mjs";
2
- import { t as defineResource } from "../defineResource-CxWqDCAy.mjs";
3
- import { t as defineModule } from "../module-_-M7C5ES.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { g as getUserId } from "../types-DXYX7dIR.mjs";
3
+ import { t as defineResource } from "../defineResource-XFPPUu2c.mjs";
4
+ import { t as defineModule } from "../module-Br81am6m.mjs";
4
5
  import { createPurgeEvidence } from "@classytic/primitives/retention";
5
6
  import { canonicalJson, sha256Hex } from "@classytic/primitives/canonical";
6
7
  //#region src/cleanup/errors.ts
@@ -562,7 +563,7 @@ function createCleanupService(deps) {
562
563
  ...DEFAULT_CLEANUP_LIMITS,
563
564
  ...deps.limits
564
565
  };
565
- const leaseMs = deps.leaseMs ?? 300 * 1e3;
566
+ const leaseMs = deps.leaseMs ?? 3e5;
566
567
  const progressThrottleMs = deps.progressThrottleMs ?? 0;
567
568
  const jobQueue = deps.jobQueue ?? { enqueue: async (job) => {
568
569
  queueMicrotask(() => {
@@ -1139,24 +1140,40 @@ const actionBodySchema = {
1139
1140
  }
1140
1141
  }
1141
1142
  };
1142
- /**
1143
- * Build the Data Cleanup Center Arc module. The module's public export is the
1144
- * live {@link CleanupService} (so other modules / tests can drive it directly).
1145
- */
1143
+ async function resolve(input) {
1144
+ return typeof input === "function" ? await input() : input;
1145
+ }
1146
1146
  function createDataCleanupModule(deps) {
1147
- const registry = createCleanupRegistry(deps.recipes);
1148
- const service = createCleanupService({
1149
- registry,
1150
- runStore: deps.runStore,
1151
- evidenceStore: deps.evidenceStore,
1152
- writeFence: deps.writeFence,
1153
- jobQueue: deps.jobQueue,
1154
- limits: deps.limits,
1155
- leaseMs: deps.leaseMs,
1156
- progressThrottleMs: deps.progressThrottleMs,
1157
- generateId: deps.generateId,
1158
- now: deps.now
1159
- });
1147
+ /**
1148
+ * Built on FIRST READ, which is `bootstrap` — never in this factory body.
1149
+ *
1150
+ * Memoized, so the recipe thunk runs exactly once and the id-uniqueness check
1151
+ * still happens at boot (arc calls bootstrap during startup); it simply happens
1152
+ * inside arc's lifecycle rather than ahead of it.
1153
+ */
1154
+ let cachedRegistry;
1155
+ const registry = async () => {
1156
+ cachedRegistry ??= createCleanupRegistry(typeof deps.recipes === "function" ? await deps.recipes() : deps.recipes);
1157
+ return cachedRegistry;
1158
+ };
1159
+ if (typeof deps.recipes !== "function") cachedRegistry = createCleanupRegistry(deps.recipes);
1160
+ let cached;
1161
+ const service = async () => {
1162
+ if (cached) return cached;
1163
+ cached = createCleanupService({
1164
+ registry: await registry(),
1165
+ runStore: await resolve(deps.runStore),
1166
+ evidenceStore: await resolve(deps.evidenceStore),
1167
+ writeFence: await resolve(deps.writeFence),
1168
+ jobQueue: await resolve(deps.jobQueue),
1169
+ limits: deps.limits,
1170
+ leaseMs: deps.leaseMs,
1171
+ progressThrottleMs: deps.progressThrottleMs,
1172
+ generateId: deps.generateId,
1173
+ now: deps.now
1174
+ });
1175
+ return cached;
1176
+ };
1160
1177
  const prefix = deps.prefix ?? "/governance/data-cleanup";
1161
1178
  const resolveActor = deps.resolveActor ?? defaultResolveActor;
1162
1179
  const resolveAmbient = deps.resolveAmbient;
@@ -1175,9 +1192,8 @@ function createDataCleanupModule(deps) {
1175
1192
  path: "/recipes",
1176
1193
  summary: "List available cleanup recipes",
1177
1194
  permissions: view,
1178
- raw: true,
1179
- handler: async (_req, reply) => {
1180
- return reply.send({ recipes: registry.introspect() });
1195
+ rawHandler: async (_req, reply) => {
1196
+ return reply.send({ recipes: (await registry()).introspect() });
1181
1197
  }
1182
1198
  },
1183
1199
  {
@@ -1185,12 +1201,11 @@ function createDataCleanupModule(deps) {
1185
1201
  path: "/preview",
1186
1202
  summary: "Preview a cleanup plan (no mutation)",
1187
1203
  permissions: view,
1188
- raw: true,
1189
1204
  schema: { body: previewBodySchema },
1190
- handler: async (req, reply) => {
1205
+ rawHandler: async (req, reply) => {
1191
1206
  const r = req;
1192
1207
  const body = req.body;
1193
- const plan = await service.preview({
1208
+ const plan = await (await service()).preview({
1194
1209
  recipeId: body.recipe,
1195
1210
  parameters: body.parameters,
1196
1211
  actor: resolveActor(r),
@@ -1204,12 +1219,11 @@ function createDataCleanupModule(deps) {
1204
1219
  path: "/runs",
1205
1220
  summary: "Execute a confirmed cleanup plan",
1206
1221
  permissions: execute,
1207
- raw: true,
1208
1222
  schema: { body: runsBodySchema },
1209
- handler: async (req, reply) => {
1223
+ rawHandler: async (req, reply) => {
1210
1224
  const r = req;
1211
1225
  const body = req.body;
1212
- const run = await service.execute({
1226
+ const run = await (await service()).execute({
1213
1227
  recipeId: body.recipe,
1214
1228
  parameters: body.parameters,
1215
1229
  planDigest: body.planDigest,
@@ -1226,11 +1240,10 @@ function createDataCleanupModule(deps) {
1226
1240
  path: "/runs/:id",
1227
1241
  summary: "Observe a cleanup run",
1228
1242
  permissions: view,
1229
- raw: true,
1230
1243
  schema: { params: runIdParamsSchema },
1231
- handler: async (req, reply) => {
1244
+ rawHandler: async (req, reply) => {
1232
1245
  const { id } = req.params;
1233
- return reply.send(await service.getRun(id));
1246
+ return reply.send(await (await service()).getRun(id));
1234
1247
  }
1235
1248
  },
1236
1249
  {
@@ -1238,20 +1251,19 @@ function createDataCleanupModule(deps) {
1238
1251
  path: "/runs/:id/action",
1239
1252
  summary: "Cancel or retry a cleanup run",
1240
1253
  permissions: manage,
1241
- raw: true,
1242
1254
  schema: {
1243
1255
  params: runIdParamsSchema,
1244
1256
  body: actionBodySchema
1245
1257
  },
1246
- handler: async (req, reply) => {
1258
+ rawHandler: async (req, reply) => {
1247
1259
  const actionActor = resolveActor(req);
1248
1260
  const { id } = req.params;
1249
1261
  const { action, reason } = req.body;
1250
- if (action === "cancel") return reply.send(await service.cancel(id, {
1262
+ if (action === "cancel") return reply.send(await (await service()).cancel(id, {
1251
1263
  actor: actionActor,
1252
1264
  reason
1253
1265
  }));
1254
- return reply.send(await service.retry(id));
1266
+ return reply.send(await (await service()).retry(id));
1255
1267
  }
1256
1268
  }
1257
1269
  ]
@@ -1259,7 +1271,7 @@ function createDataCleanupModule(deps) {
1259
1271
  return defineModule({
1260
1272
  name: deps.moduleName ?? "data-cleanup",
1261
1273
  ...deps.owns ? { owns: deps.owns } : {},
1262
- bootstrap: () => service,
1274
+ bootstrap: () => service(),
1263
1275
  resources: () => [resource]
1264
1276
  });
1265
1277
  }
@@ -1,4 +1,5 @@
1
- import { Nt as RateLimitConfig, V as ResourceDefinition, et as RouteSchemaOptions } from "../../index-Q5gzEIWY.mjs";
1
+
2
+ import { Nt as RateLimitConfig, V as ResourceDefinition, et as RouteSchemaOptions } from "../../index-CpzxqePp.mjs";
2
3
  //#region src/cli/commands/describe.d.ts
3
4
  interface DescribedResource {
4
5
  name: string;
@@ -1,5 +1,6 @@
1
- import { t as CRUD_OPERATIONS } from "../../constants-DNre0wRg.mjs";
2
- import { n as stringifyMeasureMap } from "../../ResourceRegistry-y9Hnypus.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../../constants-J99LGTJI.mjs";
3
+ import { n as stringifyMeasureMap } from "../../ResourceRegistry-BVr7PgA0.mjs";
3
4
  import { resolve } from "node:path";
4
5
  import { pathToFileURL } from "node:url";
5
6
  //#region src/cli/commands/describe.ts
@@ -77,9 +78,7 @@ function describePipeline(pipe) {
77
78
  case "transform":
78
79
  transforms.push(desc);
79
80
  break;
80
- case "interceptor":
81
- interceptors.push(desc);
82
- break;
81
+ case "interceptor": interceptors.push(desc);
83
82
  }
84
83
  }
85
84
  return {
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/cli/commands/docs.d.ts
2
3
  /**
3
4
  * Arc CLI - Docs Command
@@ -1,5 +1,6 @@
1
- import { t as buildOpenApiSpec } from "../../openapi-B8Vkbxbn.mjs";
2
- import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-kvGT6EcO.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as buildOpenApiSpec } from "../../openapi-DIRzvxC0.mjs";
3
+ import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-D1MJp13f.mjs";
3
4
  import { dirname, resolve } from "node:path";
4
5
  import { mkdirSync, writeFileSync } from "node:fs";
5
6
  //#region src/cli/commands/docs.ts
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/cli/commands/doctor.d.ts
2
3
  /**
3
4
  * Arc CLI - Doctor Command
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { dirname, join, parse, resolve } from "node:path";
2
3
  import { existsSync, readFileSync } from "node:fs";
3
4
  //#region src/cli/commands/doctor.ts
@@ -1,2 +1,3 @@
1
- import { n as generate, t as ArcProjectConfig } from "../../generate-BnsL9GBm.mjs";
1
+
2
+ import { n as generate, t as ArcProjectConfig } from "../../generate-DCGuEbqI.mjs";
2
3
  export { type ArcProjectConfig, generate };
@@ -1,2 +1,3 @@
1
- import { t as generate } from "../../generate-D0wZupBg.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as generate } from "../../generate-CRSG0jTv.mjs";
2
3
  export { generate };
@@ -1,2 +1,3 @@
1
- import { a as ProjectConfig, i as PackageManager, n as DependencyManifest, r as InitOptions, t as init } from "../../init-BPEu8cs-.mjs";
1
+
2
+ import { a as ProjectConfig, i as PackageManager, n as DependencyManifest, r as InitOptions, t as init } from "../../init-Cscs4lab.mjs";
2
3
  export { type DependencyManifest, type InitOptions, type PackageManager, type ProjectConfig, init };
@@ -1,2 +1,3 @@
1
- import { t as init } from "../../init-tlRSt667.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as init } from "../../init-BbfP8aky.mjs";
2
3
  export { init };
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/cli/commands/introspect.d.ts
2
3
  /**
3
4
  * Arc CLI - Introspect Command
@@ -1,4 +1,5 @@
1
- import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-kvGT6EcO.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-D1MJp13f.mjs";
2
3
  //#region src/cli/commands/introspect.ts
3
4
  function describePermission(value) {
4
5
  if (!value) return "none";
@@ -1,7 +1,8 @@
1
+
1
2
  import { describe } from "./commands/describe.mjs";
2
3
  import { exportDocs } from "./commands/docs.mjs";
3
4
  import { doctor } from "./commands/doctor.mjs";
4
- import { n as generate } from "../generate-BnsL9GBm.mjs";
5
- import { t as init } from "../init-BPEu8cs-.mjs";
5
+ import { n as generate } from "../generate-DCGuEbqI.mjs";
6
+ import { t as init } from "../init-Cscs4lab.mjs";
6
7
  import { introspect } from "./commands/introspect.mjs";
7
8
  export { describe, doctor, exportDocs, generate, init, introspect };
@@ -1,7 +1,8 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  import { describe } from "./commands/describe.mjs";
2
3
  import { exportDocs } from "./commands/docs.mjs";
3
4
  import { doctor } from "./commands/doctor.mjs";
4
- import { t as generate } from "../generate-D0wZupBg.mjs";
5
- import { t as init } from "../init-tlRSt667.mjs";
5
+ import { t as generate } from "../generate-CRSG0jTv.mjs";
6
+ import { t as init } from "../init-BbfP8aky.mjs";
6
7
  import { introspect } from "./commands/introspect.mjs";
7
8
  export { describe, doctor, exportDocs, generate, init, introspect };
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
2
  //#region src/constants.ts
2
3
  /**
3
4
  * Arc Framework Constants — Single Source of Truth
@@ -1,3 +1,4 @@
1
+
1
2
  import { AsyncLocalStorage } from "node:async_hooks";
2
3
  //#region src/context/requestContext.d.ts
3
4
  /**
@@ -1,3 +1,4 @@
1
- import { n as requestContext, t as getTraceHeaders } from "../requestContext-MrlJwECf.mjs";
2
- import { t as transactionContext } from "../transactionContext-PNdoyLLm.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { n as requestContext, t as getTraceHeaders } from "../requestContext-B6vQF-sy.mjs";
3
+ import { t as transactionContext } from "../transactionContext-BvLKvOIL.mjs";
3
4
  export { getTraceHeaders, requestContext, transactionContext };
@@ -1,3 +1,4 @@
1
- import { $t as SlugExt, An as ControllerConfigurableOptions, B as defineResource, Jt as BaseController, Mn as ListResult, Nn as BodySanitizer, Pn as BodySanitizerConfig, Qt as TreeMixin, V as ResourceDefinition, Xt as SoftDeleteMixin, Yt as SoftDeleteExt, Zt as TreeExt, an as QueryResolverConfig, ct as AggMeasureShorthand, dt as AggregationDateRangeRequirement, en as SlugMixin, ft as AggregationIndexHint, gt as AggregationsMap, ht as AggregationRateLimit, in as QueryResolver, jn as ControllerConstructionOptions, kn as BaseControllerOptions, lt as AggregationCacheConfig, mt as AggregationMaterializedResult, nn as BulkMixin, on as AccessControl, pt as AggregationMaterializedContext, rn as BaseCrudController, sn as AccessControlConfig, st as AggMeasureInput, tn as BulkExt, ut as AggregationConfig } from "../index-Q5gzEIWY.mjs";
2
- import { A as DEFAULT_ID_FIELD, B as MAX_FILTER_DEPTH, C as DefineActionConfig, D as defineAggregation, E as createPermissionMiddleware, F as DEFAULT_UPDATE_METHOD, G as RESERVED_QUERY_PARAMS, H as MAX_SEARCH_LENGTH, I as HOOK_OPERATIONS, K as SYSTEM_FIELDS, L as HOOK_PHASES, M as DEFAULT_MAX_LIMIT, N as DEFAULT_SORT, O as CRUD_OPERATIONS, P as DEFAULT_TENANT_FIELD, R as HookOperation, S as mergeResourceConfig, T as createCrudRouter, U as MUTATION_OPERATIONS, V as MAX_REGEX_LENGTH, W as MutationOperation, _ as getEntityQuery, a as formatValidationErrors, b as ResourceSeams, c as isFieldReadable, d as createRequestContext, f as getControllerContext, g as getEntityIdField, h as getEntityId, i as assertValidConfig, j as DEFAULT_LIMIT, k as CrudOperation, l as createCrudHandlers, m as sendControllerResponse, n as ValidateOptions, o as validateResourceConfig, p as getControllerScope, r as ValidationResult, s as collectReadBlockedFields, t as ConfigError, u as createFastifyHandler, v as defineResourceVariants, w as defineAction, x as SeamedResourceConfig, y as AdapterLike, z as HookPhase } from "../index-Cx7bro4R.mjs";
1
+
2
+ import { $t as TreeMixin, An as BaseControllerOptions, B as defineResource, Fn as BodySanitizerConfig, Mn as ControllerConstructionOptions, Nn as ListResult, Pn as BodySanitizer, Qt as TreeExt, V as ResourceDefinition, Xt as SoftDeleteExt, Yt as BaseController, Zt as SoftDeleteMixin, an as QueryResolver, cn as AccessControlConfig, ct as AggMeasureShorthand, dt as AggregationDateRangeRequirement, en as SlugExt, ft as AggregationIndexHint, gt as AggregationsMap, ht as AggregationRateLimit, in as BaseCrudController, jn as ControllerConfigurableOptions, lt as AggregationCacheConfig, mt as AggregationMaterializedResult, nn as BulkExt, on as QueryResolverConfig, pt as AggregationMaterializedContext, rn as BulkMixin, sn as AccessControl, st as AggMeasureInput, tn as SlugMixin, ut as AggregationConfig } from "../index-CpzxqePp.mjs";
3
+ import { A as DEFAULT_ID_FIELD, B as MAX_FILTER_DEPTH, C as DefineActionConfig, D as defineAggregation, E as createPermissionMiddleware, F as DEFAULT_UPDATE_METHOD, G as RESERVED_QUERY_PARAMS, H as MAX_SEARCH_LENGTH, I as HOOK_OPERATIONS, K as SYSTEM_FIELDS, L as HOOK_PHASES, M as DEFAULT_MAX_LIMIT, N as DEFAULT_SORT, O as CRUD_OPERATIONS, P as DEFAULT_TENANT_FIELD, R as HookOperation, S as mergeResourceConfig, T as createCrudRouter, U as MUTATION_OPERATIONS, V as MAX_REGEX_LENGTH, W as MutationOperation, _ as getEntityQuery, a as formatValidationErrors, b as ResourceSeams, c as isFieldReadable, d as createRequestContext, f as getControllerContext, g as getEntityIdField, h as getEntityId, i as assertValidConfig, j as DEFAULT_LIMIT, k as CrudOperation, l as createCrudHandlers, m as sendControllerResponse, n as ValidateOptions, o as validateResourceConfig, p as getControllerScope, r as ValidationResult, s as collectReadBlockedFields, t as ConfigError, u as createFastifyHandler, v as defineResourceVariants, w as defineAction, x as SeamedResourceConfig, y as AdapterLike, z as HookPhase } from "../index-DXlHwvuE.mjs";
3
4
  export { AccessControl, type AccessControlConfig, type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, BaseController, type BaseControllerOptions, BaseCrudController, BodySanitizer, type BodySanitizerConfig, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DefineActionConfig, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, type QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, type ResourceSeams, SYSTEM_FIELDS, type SeamedResourceConfig, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type ValidateOptions, type ValidationResult, assertValidConfig, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, sendControllerResponse, validateResourceConfig };
@@ -1,7 +1,8 @@
1
- import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "../constants-DNre0wRg.mjs";
2
- import { a as BulkMixin, c as collectReadBlockedFields, f as AccessControl, i as SlugMixin, l as isFieldReadable, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController, u as BodySanitizer } from "../BaseController-B5DwufbB.mjs";
3
- import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, o as createCrudRouter, r as formatValidationErrors, s as createPermissionMiddleware, t as defineResource } from "../defineResource-CxWqDCAy.mjs";
4
- import { a as createFastifyHandler, c as getControllerScope, i as createCrudHandlers, l as sendControllerResponse, o as createRequestContext, s as getControllerContext } from "../pipeline-BJnpkY9i.mjs";
5
- import { t as defineAggregation } from "../defineAggregation-ufWjUwml.mjs";
6
- import { a as mergeResourceConfig, i as defineResourceVariants, n as getEntityIdField, o as defineAction, r as getEntityQuery, t as getEntityId } from "../core-poalJLvp.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "../constants-J99LGTJI.mjs";
3
+ import { a as BulkMixin, c as collectReadBlockedFields, f as AccessControl, i as SlugMixin, l as isFieldReadable, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController, u as BodySanitizer } from "../BaseController-Dk34dxhI.mjs";
4
+ import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, o as createCrudRouter, r as formatValidationErrors, s as createPermissionMiddleware, t as defineResource } from "../defineResource-XFPPUu2c.mjs";
5
+ import { a as createFastifyHandler, c as getControllerScope, i as createCrudHandlers, l as sendControllerResponse, o as createRequestContext, s as getControllerContext } from "../pipeline-CPA-jx0M.mjs";
6
+ import { t as defineAggregation } from "../defineAggregation-gX4No1gt.mjs";
7
+ import { a as mergeResourceConfig, i as defineResourceVariants, n as getEntityIdField, o as defineAction, r as getEntityQuery, t as getEntityId } from "../core-BwwmNSp7.mjs";
7
8
  export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, assertValidConfig, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, sendControllerResponse, validateResourceConfig };
@@ -1,5 +1,6 @@
1
- import "./constants-DNre0wRg.mjs";
2
- import { t as defineResource } from "./defineResource-CxWqDCAy.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import "./constants-J99LGTJI.mjs";
3
+ import { t as defineResource } from "./defineResource-XFPPUu2c.mjs";
3
4
  //#region src/core/defineAction.ts
4
5
  /**
5
6
  * Build an `ActionDefinition` with a typed handler. The literal schema
@@ -1,10 +1,11 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import "./constants-DNre0wRg.mjs";
3
- import { f as createError } from "./errors-DkO8Nk6-.mjs";
4
- import { a as buildRouteHooks, i as selectPluginMw, l as buildAuthMiddlewareForPermissions, n as buildRouteConfig, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-DrED-C4v.mjs";
5
- import { n as buildActionPermissionMw, t as tryRegisterRoute } from "./registerRoute-JkxIEBJq.mjs";
6
- import { l as sendControllerResponse, r as resolvePipelineSteps, t as buildActionPipelineHandler } from "./pipeline-BJnpkY9i.mjs";
7
- import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-Ca7ySNPx.mjs";
1
+ /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
3
+ import "./constants-J99LGTJI.mjs";
4
+ import { f as createError } from "./errors-Bh1KK5ps.mjs";
5
+ import { a as buildRouteHooks, i as selectPluginMw, l as buildAuthMiddlewareForPermissions, n as buildRouteConfig, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-C7mmAGs3.mjs";
6
+ import { n as buildActionPermissionMw, t as tryRegisterRoute } from "./registerRoute-B_QrjYZS.mjs";
7
+ import { l as sendControllerResponse, r as resolvePipelineSteps, t as buildActionPipelineHandler } from "./pipeline-CPA-jx0M.mjs";
8
+ import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-CnyKK_1j.mjs";
8
9
  //#region src/core/createActionRouter.ts
9
10
  var createActionRouter_exports = /* @__PURE__ */ __exportAll({
10
11
  buildActionBodySchema: () => buildActionBodySchema,
@@ -57,7 +58,8 @@ function createActionRouter(fastify, config) {
57
58
  const { urlPath, actionSubset, hasId } = mountOpts;
58
59
  if (actionSubset.length === 0) return;
59
60
  const subsetSet = new Set(actionSubset);
60
- const authMw = buildAuthMiddlewareForPermissions(fastify, actionSubset.map((name) => actionPermissions[name] ?? globalAuth));
61
+ const perActionPermissions = actionSubset.map((name) => actionPermissions[name] ?? globalAuth);
62
+ const authMw = buildAuthMiddlewareForPermissions(fastify, perActionPermissions);
61
63
  const subsetPermissions = {};
62
64
  for (const name of actionSubset) {
63
65
  const perm = actionPermissions[name];
@@ -89,7 +91,8 @@ function createActionRouter(fastify, config) {
89
91
  if (!submitted || !subsetSet.has(submitted)) {
90
92
  const wrongMount = submitted && allActionNames.includes(submitted) ? submitted : void 0;
91
93
  const otherMount = hasId ? "/action" : "/:id/action";
92
- throw createError(400, wrongMount ? `Action '${wrongMount}' on '${resourceName}' is mounted at 'POST ${otherMount}', not 'POST ${urlPath}'` : submitted ? `Unknown action '${submitted}' on '${resourceName}'. Valid at 'POST ${urlPath}': ${actionSubset.join(", ")}` : `Missing 'action' field on '${resourceName}'. Valid at 'POST ${urlPath}': ${actionSubset.join(", ")}`, {
94
+ const message = wrongMount ? `Action '${wrongMount}' on '${resourceName}' is mounted at 'POST ${otherMount}', not 'POST ${urlPath}'` : submitted ? `Unknown action '${submitted}' on '${resourceName}'. Valid at 'POST ${urlPath}': ${actionSubset.join(", ")}` : `Missing 'action' field on '${resourceName}'. Valid at 'POST ${urlPath}': ${actionSubset.join(", ")}`;
95
+ throw createError(400, message, {
93
96
  code: "arc.invalid_action",
94
97
  validActions: actionSubset,
95
98
  mount: urlPath,
@@ -140,7 +143,8 @@ function createActionRouter(fastify, config) {
140
143
  const handler = wrappedHandlers.get(action);
141
144
  if (!handler) throw createError(400, `Invalid action '${action}'. Valid actions: ${actionSubset.join(", ")}`, { validActions: actionSubset });
142
145
  try {
143
- sendControllerResponse(reply, await handler(id, data, req), req);
146
+ const response = await handler(id, data, req);
147
+ sendControllerResponse(reply, response, req);
144
148
  return reply;
145
149
  } catch (error) {
146
150
  if (onError) {
@@ -1,9 +1,10 @@
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";
4
- import { a as buildRouteHooks, c as buildAuthMiddleware, i as selectPluginMw, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-DrED-C4v.mjs";
5
- import { n as validateAggregations } from "./validate-Bk44F2yT.mjs";
6
- import { t as buildAggregationHandler } from "./buildHandler-BYS3Vkfz.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";
5
+ import { a as buildRouteHooks, c as buildAuthMiddleware, i as selectPluginMw, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-C7mmAGs3.mjs";
6
+ import { n as validateAggregations } from "./validate-PMCPR9El.mjs";
7
+ import { t as buildAggregationHandler } from "./buildHandler-Dn7rzUJo.mjs";
7
8
  //#region src/core/aggregation/createAggregationRouter.ts
8
9
  /**
9
10
  * Register one Fastify route per aggregation. No-op when the map is
@@ -44,11 +45,13 @@ function registerOne(fastify, normalized, ctx) {
44
45
  const ctx = buildPermissionContextLite(req, normalized.name);
45
46
  await evaluateAndApplyPermission(permissionFn, ctx, req, reply, { defaultDenialMessage: (user) => user ? "You do not have permission to access this aggregation." : "Authentication required to access this aggregation." });
46
47
  };
48
+ const pluginMwAll = resolveRouterPluginMw(fastify, false);
49
+ const pluginMw = selectPluginMw("GET", pluginMwAll);
47
50
  const hooks = buildRouteHooks({
48
51
  arcDecorator,
49
52
  authMw,
50
53
  permissionMw,
51
- pluginMw: selectPluginMw("GET", resolveRouterPluginMw(fastify, false)),
54
+ pluginMw,
52
55
  routeGuards,
53
56
  customMws: middlewares
54
57
  });