@classytic/arc 2.52.0 → 2.53.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 (222) hide show
  1. package/README.md +2 -1
  2. package/dist/{EventTransport-DeNze_-C.mjs → EventTransport-B3jTKMQH.mjs} +2 -2
  3. package/dist/{HookSystem-DTffXM1X.mjs → HookSystem-DNwxV463.mjs} +2 -2
  4. package/dist/{ResourceRegistry-tlqXSZoK.mjs → ResourceRegistry-Ck7RFodL.mjs} +2 -2
  5. package/dist/{acquire-7JKEkKnN.mjs → acquire-DkLruwhL.mjs} +1 -1
  6. package/dist/audit/index.d.mts +1 -1
  7. package/dist/audit/index.mjs +4 -4
  8. package/dist/auth/audit.mjs +1 -1
  9. package/dist/auth/index.d.mts +1 -1
  10. package/dist/auth/index.mjs +7 -7
  11. package/dist/auth/redis-session.mjs +1 -1
  12. package/dist/auth/social/index.mjs +1 -1
  13. package/dist/{authorizationDecision-DKmH4tZ-.mjs → authorizationDecision-gB5-bHDp.mjs} +5 -5
  14. package/dist/bootError-BT3z3cvX.mjs +38 -0
  15. package/dist/{boundedMap-zxGBpXX0.mjs → boundedMap-Ddw2yGb2.mjs} +1 -1
  16. package/dist/{buildHandler-ZDV6LRZ_.mjs → buildHandler-B8IDGmhD.mjs} +5 -5
  17. package/dist/cache/index.mjs +4 -4
  18. package/dist/{caching-DceUN9Xk.mjs → caching-BitJDAY0.mjs} +2 -2
  19. package/dist/{claimed-DsP5Hi_f.mjs → claimed-CM_-lFHX.mjs} +1 -1
  20. package/dist/cleanup/index.d.mts +2 -2
  21. package/dist/cleanup/index.mjs +4 -4
  22. package/dist/cli/commands/describe.d.mts +18 -1
  23. package/dist/cli/commands/describe.mjs +39 -7
  24. package/dist/cli/commands/docs.mjs +3 -3
  25. package/dist/cli/commands/doctor.d.mts +3 -1
  26. package/dist/cli/commands/doctor.mjs +135 -22
  27. package/dist/cli/commands/generate.mjs +2 -2
  28. package/dist/cli/commands/init.mjs +2 -2
  29. package/dist/cli/commands/introspect.mjs +2 -2
  30. package/dist/cli/index.mjs +3 -3
  31. package/dist/{constants-Ca2IQFy2.mjs → constants-D9EiaO5s.mjs} +1 -1
  32. package/dist/context/index.d.mts +5 -2
  33. package/dist/context/index.mjs +5 -5
  34. package/dist/core/index.d.mts +2 -2
  35. package/dist/core/index.mjs +7 -7
  36. package/dist/{core-M18RhMqi.mjs → core-B_06Fcn0.mjs} +3 -3
  37. package/dist/{createActionRouter-zXlrwWVs.mjs → createActionRouter-DtxUXOCI.mjs} +5 -5
  38. package/dist/{createAggregationRouter-CN0Da9nC.mjs → createAggregationRouter-BMiKyDoW.mjs} +7 -7
  39. package/dist/{createApp-BC67ACu4.mjs → createApp-CEdGZtkP.mjs} +207 -44
  40. package/dist/{createMcpServer-CS2KOVP6.d.mts → createMcpServer-Bk3ls5jS.d.mts} +1 -1
  41. package/dist/{defineAggregation-DqAGb5oI.mjs → defineAggregation-DUsrGcsm.mjs} +1 -1
  42. package/dist/{defineResource-DC5UqkQv.mjs → defineResource-q8TsJpOm.mjs} +92 -36
  43. package/dist/deprecation-DX625dth.mjs +27 -0
  44. package/dist/discovery/index.mjs +1 -1
  45. package/dist/docs/index.d.mts +1 -1
  46. package/dist/docs/index.mjs +3 -3
  47. package/dist/{elevation-DiXVg98q.mjs → elevation-NJ3908pJ.mjs} +5 -5
  48. package/dist/encryption/index.mjs +3 -3
  49. package/dist/{errorHandler-BUTm9P_f.mjs → errorHandler-Ke6PGvF7.mjs} +7 -4
  50. package/dist/{errors-DxpHZBlW.mjs → errors-Ukhmfmmx.mjs} +1 -1
  51. package/dist/{eventPlugin-BY38F6yK.d.mts → eventPlugin-BeJasppx.d.mts} +7 -18
  52. package/dist/{eventPlugin-ZsIQPRso.mjs → eventPlugin-DTKAgSvb.mjs} +10 -8
  53. package/dist/{eventTypes-D-pFtqT1.mjs → eventTypes-DpDQtyR6.mjs} +2 -2
  54. package/dist/events/index.d.mts +2 -2
  55. package/dist/events/index.mjs +8 -8
  56. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  57. package/dist/events/transports/redis.mjs +2 -2
  58. package/dist/factory/index.d.mts +28 -5
  59. package/dist/factory/index.mjs +12 -7
  60. package/dist/{fastify-augmentation-CPReFhZ1.d.mts → fastify-augmentation-DjxuSRG4.d.mts} +4 -3
  61. package/dist/{fieldTypes-f-3TZgR3.mjs → fieldTypes-BtFpQO6I.mjs} +2 -2
  62. package/dist/{fields-kCbIDTjA.mjs → fields-B7fuROWK.mjs} +1 -1
  63. package/dist/{filter-merge-UJCgjbZR.mjs → filter-merge-BuzZ-r9z.mjs} +1 -1
  64. package/dist/{generate-CLpmzbJ_.mjs → generate-c4F39pk1.mjs} +4 -4
  65. package/dist/{headers-Bh47h0XH.mjs → headers-Ib7BDgRI.mjs} +2 -2
  66. package/dist/{health-CEpgVAl7.mjs → health-22T82HAa.mjs} +1 -1
  67. package/dist/health-skjSwNaC.d.mts +36 -0
  68. package/dist/hooks/index.d.mts +1 -1
  69. package/dist/hooks/index.mjs +2 -2
  70. package/dist/http-cache/index.mjs +4 -4
  71. package/dist/http-cache/purgers/cloudflare.mjs +2 -2
  72. package/dist/http-cache/purgers/fastly.mjs +2 -2
  73. package/dist/http-cache/testing/index.mjs +1 -1
  74. package/dist/idempotency/index.d.mts +7 -1
  75. package/dist/idempotency/index.mjs +9 -7
  76. package/dist/idempotency/redis.mjs +2 -2
  77. package/dist/{index-CMNpMBtW.d.mts → index-BzUyno-u.d.mts} +14 -5
  78. package/dist/{index-yXXCsKl7.d.mts → index-CXqYFGoH.d.mts} +13 -4
  79. package/dist/{index-CSbDhif4.d.mts → index-CaBFPmnu.d.mts} +10 -6
  80. package/dist/{index-DCH08eqQ.d.mts → index-DWn0o4U7.d.mts} +2 -2
  81. package/dist/{index-DLCcLUQT.d.mts → index-DtHACefu.d.mts} +109 -116
  82. package/dist/index.d.mts +5 -5
  83. package/dist/index.mjs +12 -12
  84. package/dist/{init-B43DXBpc.mjs → init-XY5slyuS.mjs} +3 -3
  85. package/dist/integrations/event-gateway.mjs +2 -2
  86. package/dist/integrations/index.d.mts +1 -1
  87. package/dist/integrations/index.mjs +1 -1
  88. package/dist/integrations/jobs/index.mjs +3 -3
  89. package/dist/integrations/mcp/index.d.mts +9 -4
  90. package/dist/integrations/mcp/index.mjs +2 -2
  91. package/dist/integrations/mcp/testing.d.mts +2 -2
  92. package/dist/integrations/mcp/testing.mjs +2 -2
  93. package/dist/integrations/streamline.mjs +3 -3
  94. package/dist/integrations/webhooks.d.mts +1 -1
  95. package/dist/integrations/webhooks.mjs +4 -4
  96. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  97. package/dist/integrations/websocket-redis.mjs +1 -1
  98. package/dist/integrations/websocket.mjs +2 -2
  99. package/dist/invariants-COekUeoh.mjs +120 -0
  100. package/dist/{jsonBody-CkKs6dA_.mjs → jsonBody-BNlcGUnb.mjs} +2 -2
  101. package/dist/{keys-DHrHnT0f.mjs → keys-DwvXJwUX.mjs} +1 -1
  102. package/dist/{loadResources-CFdzAWQZ.mjs → loadResources-izEeQLO_.mjs} +3 -3
  103. package/dist/{loadResourcesFromEntry-DkoSiJsI.mjs → loadResourcesFromEntry-CijqjbHE.mjs} +2 -2
  104. package/dist/logger/index.mjs +2 -2
  105. package/dist/{logger-DJwz_-Pl.mjs → logger-DdMS0XC_.mjs} +1 -1
  106. package/dist/{mcpPlugin-CA_MDFlS.mjs → mcpPlugin-D0tSZqKk.mjs} +24 -22
  107. package/dist/{memory-B9CFHbA_.mjs → memory-Ay0haw9n.mjs} +3 -3
  108. package/dist/{metrics-DSKv-T9K.mjs → metrics-Bpgf4UL6.mjs} +3 -3
  109. package/dist/middleware/index.d.mts +1 -1
  110. package/dist/middleware/index.mjs +3 -3
  111. package/dist/migrations/index.mjs +2 -2
  112. package/dist/{module-C0JCsnO7.mjs → module-BLrTmMyk.mjs} +1 -1
  113. package/dist/{multiTenant-QtDzxx_K.d.mts → multiTenant-Cf0Ye-Wu.d.mts} +1 -1
  114. package/dist/{multipartBody-Bxz-q6hI.mjs → multipartBody-L2gr96df.mjs} +1 -1
  115. package/dist/{observeSend-DfNkdGww.mjs → observeSend-B7FEdk_g.mjs} +1 -1
  116. package/dist/{openapi-Dmp7Ipsi.mjs → openapi-COrL_33P.mjs} +6 -6
  117. package/dist/outbox-admin/index.d.mts +1 -1
  118. package/dist/outbox-admin/index.mjs +6 -6
  119. package/dist/{outbox-module-vT6PaThj.mjs → outbox-module-BY2HtnjU.mjs} +7 -7
  120. package/dist/{outbox-module-DzW6zwWJ.d.mts → outbox-module-C1QWMloZ.d.mts} +5 -8
  121. package/dist/permissions/index.d.mts +2 -2
  122. package/dist/permissions/index.mjs +8 -8
  123. package/dist/{permissions-Cga6KBOX.mjs → permissions-CEyeDHtT.mjs} +36 -17
  124. package/dist/{pipe-CqPweKdL.mjs → pipe-DIAr91at.mjs} +2 -2
  125. package/dist/pipeline/index.d.mts +1 -1
  126. package/dist/pipeline/index.mjs +2 -2
  127. package/dist/{plan-CbDTFbTj.mjs → plan-BhKHIkFl.mjs} +75 -20
  128. package/dist/{plugin-8Z1khbAI.mjs → plugin-D6hrdx-j.mjs} +72 -38
  129. package/dist/plugins/index.d.mts +4 -3
  130. package/dist/plugins/index.mjs +18 -18
  131. package/dist/plugins/response-cache.mjs +4 -4
  132. package/dist/plugins/tracing-entry.mjs +177 -85
  133. package/dist/{pluralize-D4vcPLVs.mjs → pluralize-CJKgYkVc.mjs} +1 -1
  134. package/dist/presetPermission-2pcRVYRG.mjs +23 -0
  135. package/dist/presets/filesUpload.d.mts +4 -2
  136. package/dist/presets/filesUpload.mjs +11 -6
  137. package/dist/presets/index.d.mts +6 -4
  138. package/dist/presets/index.mjs +2 -2
  139. package/dist/presets/multiTenant.d.mts +1 -1
  140. package/dist/presets/multiTenant.mjs +5 -5
  141. package/dist/presets/search.d.mts +2 -2
  142. package/dist/presets/search.mjs +54 -38
  143. package/dist/{presets-D28IABZe.mjs → presets-st11ePNn.mjs} +150 -41
  144. package/dist/{projection-aHCtDQQ9.mjs → projection-B4rqiJTi.mjs} +2 -2
  145. package/dist/{purger.types-CNFmEtFu.mjs → purger.types-BcHeAhY_.mjs} +1 -1
  146. package/dist/{queryCachePlugin-CwpEjCwz.mjs → queryCachePlugin-BgSc2bga.mjs} +6 -6
  147. package/dist/rateLimitKey-DLGdeFd2.mjs +138 -0
  148. package/dist/{realtime-Dvu8ES2z.mjs → realtime-CpYpIFsm.mjs} +11 -11
  149. package/dist/registry/index.d.mts +2 -2
  150. package/dist/registry/index.mjs +3 -3
  151. package/dist/{registry-DmxbzW7-.mjs → registry-BQsdAlZ_.mjs} +2 -2
  152. package/dist/{relay-CEaCmUfG.mjs → relay-CmT3gtkP.mjs} +11 -12
  153. package/dist/{renewingLease-g2FjB3im.mjs → renewingLease-DaoP0K-e.mjs} +1 -1
  154. package/dist/{replyHelpers-CSByAX_Z.mjs → replyHelpers-SiLr1wK4.mjs} +2 -2
  155. package/dist/{requestContext-yc7MSgmq.mjs → requestContext-B-TjFpWt.mjs} +8 -3
  156. package/dist/{health-W4S2yFBL.mjs → requestId-ClcKoWLq.mjs} +154 -116
  157. package/dist/{requirement-Dm8njSoC.mjs → requirement-BygDzjDS.mjs} +1 -1
  158. package/dist/{resourceRateLimit-PQaY3HW1.mjs → resourceRateLimit-DdIYis3m.mjs} +2 -2
  159. package/dist/{rolldown-runtime-BBBkGgwA.mjs → rolldown-runtime-Cy6j0m8_.mjs} +1 -1
  160. package/dist/{routeValidator-fuG51bQA.mjs → routeValidator-Bn-x2gaJ.mjs} +1 -1
  161. package/dist/{runtimeCapabilities-B8IT7xiQ.mjs → runtimeCapabilities-DY20Pibh.mjs} +7 -2
  162. package/dist/{schedules-0-aS4jDV.mjs → schedules-CwqC0Mp0.mjs} +5 -5
  163. package/dist/{schemaConverter-Cs3SwP4R.mjs → schemaConverter-XoLKVpzG.mjs} +2 -2
  164. package/dist/{schemaIR-By8XiNeE.mjs → schemaIR-DP7mMj7c.mjs} +16 -16
  165. package/dist/schemas/index.mjs +1 -1
  166. package/dist/scim/index.mjs +2 -2
  167. package/dist/scope/index.d.mts +6 -2
  168. package/dist/scope/index.mjs +5 -5
  169. package/dist/{scope-BWNAlBj0.mjs → scope-B0vgM2Zw.mjs} +4 -4
  170. package/dist/{shutdown-Cf-27xsS.mjs → shutdown-C76Hn-Th.mjs} +1 -1
  171. package/dist/{simpleEqualityMatcher-e-dgJcUO.mjs → simpleEqualityMatcher-Qbl-11cE.mjs} +1 -1
  172. package/dist/{sse-C3bj5qWi.mjs → sse-eyb8lNuI.mjs} +7 -7
  173. package/dist/{sseStream-BYZbpFDa.mjs → sseStream-BsBesrfw.mjs} +2 -2
  174. package/dist/{store-helpers-B9HierHY.mjs → store-helpers-D1yIVa91.mjs} +1 -1
  175. package/dist/{streaming-EN8NJWxr.mjs → streaming-DKziqs1Z.mjs} +1 -1
  176. package/dist/{subscriberIdentity-DSqCh38x.mjs → subscriberIdentity-DpdSQMQq.mjs} +1 -1
  177. package/dist/{tenancy-CAqjGQcQ.mjs → tenancy-YuRYsOPr.mjs} +2 -2
  178. package/dist/{tenantPreparation-CVBWarqs.mjs → tenantPreparation-Bk8ouRB3.mjs} +17 -5
  179. package/dist/testing/cleanupStoreContract.mjs +1 -1
  180. package/dist/testing/index.d.mts +4 -4
  181. package/dist/testing/index.mjs +11 -11
  182. package/dist/testing/outboxStoreContract.mjs +2 -2
  183. package/dist/testing/requiredPorts.d.mts +1 -1
  184. package/dist/testing/requiredPorts.mjs +2 -2
  185. package/dist/testing/storageContract.mjs +1 -1
  186. package/dist/{timing-CKI_Oyub.mjs → timing-BtIDIdQz.mjs} +1 -1
  187. package/dist/{transactionContext-D0UZFoSy.mjs → transactionContext-BsQ5ortM.mjs} +1 -1
  188. package/dist/{typeGuards-CLYkmBLT.mjs → typeGuards-Cr2_zEW0.mjs} +1 -1
  189. package/dist/types/index.d.mts +2 -2
  190. package/dist/types/index.mjs +1 -1
  191. package/dist/types/storage.mjs +1 -1
  192. package/dist/{types-BeEJm-DV.d.mts → types-CQhHTZXs.d.mts} +48 -35
  193. package/dist/{types-B4E0sc6D.d.mts → types-DWFgq8EP.d.mts} +1 -1
  194. package/dist/{types-Cunc4shv.mjs → types-ZvdR7MVa.mjs} +4 -4
  195. package/dist/usage/index.mjs +4 -4
  196. package/dist/{userHelpers-cT5j1kgp.mjs → userHelpers-CwpEK36a.mjs} +1 -1
  197. package/dist/utils/index.d.mts +1 -1
  198. package/dist/utils/index.mjs +12 -12
  199. package/dist/{utils-DlNkm1dI.mjs → utils-CnrfcYMq.mjs} +6 -6
  200. package/dist/{validate-63QThRoS.mjs → validate-BTQBh-Dr.mjs} +3 -3
  201. package/dist/{versioning-f2YGmh4i.mjs → versioning-DiLykI6U.mjs} +3 -3
  202. package/dist/{workScope-DwspXz70.mjs → workScope-C3tPz_Gt.mjs} +2 -2
  203. package/package.json +34 -9
  204. package/skills/arc/SKILL.md +5 -5
  205. package/skills/arc/references/api-reference.md +1 -1
  206. package/skills/arc/references/boot.md +17 -2
  207. package/skills/arc/references/events.md +0 -1
  208. package/skills/arc/references/mcp-setup.md +3 -2
  209. package/skills/arc/references/multi-tenancy.md +1 -1
  210. package/skills/arc/references/production-api.md +19 -12
  211. package/skills/arc/references/production-audit.md +1 -1
  212. package/skills/arc/references/production-boot.md +3 -3
  213. package/skills/arc/references/production-idempotency.md +2 -2
  214. package/skills/arc/references/production-observability.md +14 -2
  215. package/skills/arc/references/production-reliability.md +1 -1
  216. package/skills/arc/references/querying.md +1 -2
  217. package/skills/arc/references/resources.md +8 -6
  218. package/skills/arc/references/testing.md +1 -1
  219. package/skills/arc-code-review/references/arc-cheatsheet.md +1 -1
  220. package/skills/arc-code-review/references/recipe-scope-permissions.md +1 -1
  221. package/skills/arc-module-publishing/references/resource-assembly.md +2 -2
  222. package/dist/rateLimitKey-D9dl3FQn.mjs +0 -40
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { r as exponentialBackoff } from "../relay-CEaCmUfG.mjs";
3
- import { t as createOutboxModule } from "../outbox-module-vT6PaThj.mjs";
4
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-B8IT7xiQ.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { r as exponentialBackoff } from "../relay-CmT3gtkP.mjs";
3
+ import { t as createOutboxModule } from "../outbox-module-BY2HtnjU.mjs";
4
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-DY20Pibh.mjs";
5
5
  import { createHmac, timingSafeEqual } from "node:crypto";
6
6
  import fp from "fastify-plugin";
7
7
  import { createChildEvent, matchEventPattern } from "@classytic/primitives/events";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/integrations/websocket-pushref-redis.ts
3
3
  /**
4
4
  * Lua script for atomic claim. Runs server-side, single-roundtrip.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/integrations/websocket-redis.ts
3
3
  /**
4
4
  * Redis Pub/Sub adapter for cross-instance WebSocket broadcast.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-B8IT7xiQ.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-DY20Pibh.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import sjson from "secure-json-parse";
5
5
  import fp from "fastify-plugin";
@@ -0,0 +1,120 @@
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { r as formatBootProblems, t as ArcBootError } from "./bootError-BT3z3cvX.mjs";
3
+ // src/factory/module/invariants.ts
4
+ /**
5
+ * Module facts and invariants — evaluated once, after composition planning and before any
6
+ * module setup, by `composeModules` (boot) and `planModules` (dry run). Pure: no I/O, no
7
+ * Fastify. `arc describe` runs the same evaluation over the modules an entry file exports.
8
+ */
9
+ /** Every composed module's facts, frozen copies; `{}` for a module that declares none. */
10
+ function composedFacts(modules) {
11
+ const all = Object.create(null);
12
+ for (const m of modules) all[m.name] = deepFreeze(structuredClone(m.facts ?? {}));
13
+ return Object.freeze(all);
14
+ }
15
+ /**
16
+ * Evaluate every module's invariants. Never throws: a throwing, async or malformed check is
17
+ * a failed result, so every problem reaches one report.
18
+ */
19
+ function evaluateModuleInvariants(modules) {
20
+ const results = [];
21
+ const unserialisable = /* @__PURE__ */ new Set();
22
+ for (const m of modules) {
23
+ const path = firstUnserialisable(m.facts ?? {}, "facts");
24
+ if (path !== void 0) {
25
+ unserialisable.add(m.name);
26
+ results.push({
27
+ module: m.name,
28
+ code: "module-facts-not-serialisable",
29
+ fix: "facts hold plain data only: strings, numbers, booleans, null, arrays and plain objects",
30
+ ok: false,
31
+ reason: `${path} is not plain serialisable data`
32
+ });
33
+ }
34
+ }
35
+ const all = composedFacts(modules.filter((m) => !unserialisable.has(m.name)));
36
+ for (const m of modules) {
37
+ if (unserialisable.has(m.name)) continue;
38
+ const own = all[m.name] ?? {};
39
+ for (const inv of m.invariants ?? []) results.push({
40
+ module: m.name,
41
+ code: inv.code,
42
+ fix: inv.fix,
43
+ ...runCheck(inv, own, all)
44
+ });
45
+ }
46
+ return results;
47
+ }
48
+ /** Throw ONE `ArcBootError` listing every failed invariant, or return. */
49
+ function assertModuleInvariants(modules) {
50
+ const failed = evaluateModuleInvariants(modules).filter((r) => !r.ok);
51
+ if (failed.length === 0) return;
52
+ const problems = failed.map((r) => ({
53
+ code: r.code,
54
+ module: r.module,
55
+ message: r.reason ?? "invariant failed",
56
+ fix: r.fix
57
+ }));
58
+ throw new ArcBootError(formatBootProblems("[arc] module invariants failed — no module was set up", problems), problems);
59
+ }
60
+ function runCheck(inv, own, all) {
61
+ let verdict;
62
+ try {
63
+ verdict = inv.check(own, all);
64
+ } catch (err) {
65
+ return {
66
+ ok: false,
67
+ reason: `check threw: ${err instanceof Error ? err.message : String(err)}`
68
+ };
69
+ }
70
+ if (verdict === true) return { ok: true };
71
+ if (typeof verdict === "string" && verdict.length > 0) return {
72
+ ok: false,
73
+ reason: verdict
74
+ };
75
+ if (typeof verdict?.then === "function") {
76
+ Promise.resolve(verdict).catch(() => void 0);
77
+ return {
78
+ ok: false,
79
+ reason: "check returned a Promise — invariants must be synchronous"
80
+ };
81
+ }
82
+ return {
83
+ ok: false,
84
+ reason: "check returned false"
85
+ };
86
+ }
87
+ function deepFreeze(value) {
88
+ if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
89
+ Object.freeze(value);
90
+ for (const v of Object.values(value)) deepFreeze(v);
91
+ }
92
+ return value;
93
+ }
94
+ /** The first path holding something JSON cannot carry faithfully, or `undefined`. */
95
+ function firstUnserialisable(value, path) {
96
+ if (value === null) return void 0;
97
+ switch (typeof value) {
98
+ case "string":
99
+ case "boolean": return;
100
+ case "number": return Number.isFinite(value) ? void 0 : path;
101
+ case "object": {
102
+ if (Array.isArray(value)) {
103
+ for (const [i, v] of value.entries()) {
104
+ const bad = firstUnserialisable(v, `${path}[${i}]`);
105
+ if (bad !== void 0) return bad;
106
+ }
107
+ return;
108
+ }
109
+ const proto = Object.getPrototypeOf(value);
110
+ if (proto !== Object.prototype && proto !== null) return path;
111
+ for (const [k, v] of Object.entries(value)) {
112
+ const bad = firstUnserialisable(v, `${path}.${k}`);
113
+ if (bad !== void 0) return bad;
114
+ }
115
+ return;
116
+ }
117
+ default: return path;
118
+ }
119
+ }
120
+ export { evaluateModuleInvariants as n, assertModuleInvariants as t };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as ArcError } from "./errors-DxpHZBlW.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "./errors-Ukhmfmmx.mjs";
3
3
  import sjson from "secure-json-parse";
4
4
  // src/utils/jsonBody.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  import { contentHash } from "@classytic/repo-core/hash";
3
3
  // src/cache/keys.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
- import { t as arcLog } from "./logger-DJwz_-Pl.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
3
+ import { t as arcLog } from "./logger-DdMS0XC_.mjs";
4
4
  import { readdir } from "node:fs/promises";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as ResourceRegistry } from "./ResourceRegistry-tlqXSZoK.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as ResourceRegistry } from "./ResourceRegistry-Ck7RFodL.mjs";
3
3
  import { resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  // src/cli/utils/loadResourcesFromEntry.ts
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- export { t as arcLog, n as configureArcLogger, r as createPinoWriter, i as runWithArcLogger } from "../logger-DJwz_-Pl.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ export { t as arcLog, n as configureArcLogger, r as createPinoWriter, i as runWithArcLogger } from "../logger-DdMS0XC_.mjs";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/logger/scope.ts
4
4
  /**
@@ -1,24 +1,25 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-PQaY3HW1.mjs";
3
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-B8IT7xiQ.mjs";
4
- import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-zxGBpXX0.mjs";
5
- import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-DxpHZBlW.mjs";
6
- import { a as resolveActionPermission, i as shouldRejectAdditionalProperties, n as normalizeSchemaIR, p as resolvePipelineSteps, t as actionSchemaIR } from "./schemaIR-By8XiNeE.mjs";
7
- import { n as fieldTypesFromOpenApiSchemas } from "./fieldTypes-f-3TZgR3.mjs";
8
- import { f as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-8Z1khbAI.mjs";
9
- import { a as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-CVBWarqs.mjs";
10
- import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-Cunc4shv.mjs";
11
- import { t as pluralize } from "./pluralize-D4vcPLVs.mjs";
12
- import { t as buildRequestScopeProjection } from "./projection-aHCtDQQ9.mjs";
13
- import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "./acquire-7JKEkKnN.mjs";
14
- import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-CKI_Oyub.mjs";
15
- import { t as arcLog } from "./logger-DJwz_-Pl.mjs";
16
- import { r as evaluatePermissionDecision } from "./authorizationDecision-DKmH4tZ-.mjs";
17
- import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-kCbIDTjA.mjs";
18
- import { n as executeAggregation } from "./buildHandler-ZDV6LRZ_.mjs";
19
- import { n as validateAggregations } from "./validate-63QThRoS.mjs";
20
- import { o as toJsonSchema } from "./schemaConverter-Cs3SwP4R.mjs";
21
- import { t as executePipeline } from "./pipe-CqPweKdL.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as warnDeprecated } from "./deprecation-DX625dth.mjs";
3
+ import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-DdIYis3m.mjs";
4
+ import { n as declareRuntimeCapability } from "./runtimeCapabilities-DY20Pibh.mjs";
5
+ import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-Ddw2yGb2.mjs";
6
+ import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-Ukhmfmmx.mjs";
7
+ import { a as resolveActionPermission, i as shouldRejectAdditionalProperties, n as normalizeSchemaIR, p as resolvePipelineSteps, t as actionSchemaIR } from "./schemaIR-DP7mMj7c.mjs";
8
+ import { n as fieldTypesFromOpenApiSchemas } from "./fieldTypes-BtFpQO6I.mjs";
9
+ import { f as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-D6hrdx-j.mjs";
10
+ import { i as routeTenantMiddlewares, o as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-Bk8ouRB3.mjs";
11
+ import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-ZvdR7MVa.mjs";
12
+ import { t as pluralize } from "./pluralize-CJKgYkVc.mjs";
13
+ import { t as buildRequestScopeProjection } from "./projection-B4rqiJTi.mjs";
14
+ import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "./acquire-DkLruwhL.mjs";
15
+ import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-BtIDIdQz.mjs";
16
+ import { t as arcLog } from "./logger-DdMS0XC_.mjs";
17
+ import { r as evaluatePermissionDecision } from "./authorizationDecision-gB5-bHDp.mjs";
18
+ import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-B7fuROWK.mjs";
19
+ import { n as executeAggregation } from "./buildHandler-B8IDGmhD.mjs";
20
+ import { n as validateAggregations } from "./validate-BTQBh-Dr.mjs";
21
+ import { o as toJsonSchema } from "./schemaConverter-XoLKVpzG.mjs";
22
+ import { t as executePipeline } from "./pipe-DIAr91at.mjs";
22
23
  import { ARC_ERROR_CODES, isHttpError, toErrorContract } from "@classytic/repo-core/errors";
23
24
  import { createHash, randomUUID } from "node:crypto";
24
25
  import fp from "fastify-plugin";
@@ -2257,7 +2258,7 @@ function resourceToTools(resource, config = {}) {
2257
2258
  pipeline: resource.pipe,
2258
2259
  fields: resource.fields,
2259
2260
  wiring,
2260
- tenantMiddlewares: route.tenantScope ? resource.middlewares?.tenantScope : void 0,
2261
+ tenantMiddlewares: routeTenantMiddlewares(route, resource.middlewares),
2261
2262
  schemaOptions: resource.schemaOptions,
2262
2263
  idField: resource.idField
2263
2264
  })
@@ -2565,6 +2566,7 @@ const mcpPluginImpl = async (fastify, options) => {
2565
2566
  return registrations.get(p);
2566
2567
  },
2567
2568
  get toolNames() {
2569
+ warnDeprecated("`fastify.mcp.toolNames`", "Use `fastify.mcp.get(prefix)?.toolNames` (or iterate `fastify.mcp.registrations`).");
2568
2570
  return first()?.toolNames ?? [];
2569
2571
  },
2570
2572
  get resourceNames() {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
- import { n as evictToSize } from "./boundedMap-zxGBpXX0.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
3
+ import { n as evictToSize } from "./boundedMap-Ddw2yGb2.mjs";
4
4
  // src/cache/memory.ts
5
5
  var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
6
6
  /**
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
- import { a as MetricHistogram, i as DURATION_BUCKETS_SECONDS, o as MetricSeries, s as renderMetricSample } from "./health-W4S2yFBL.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
3
+ import { c as DURATION_BUCKETS_SECONDS, d as renderMetricSample, l as MetricHistogram, u as MetricSeries } from "./requestId-ClcKoWLq.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  // src/plugins/metrics.ts
6
6
  var metrics_exports = /* @__PURE__ */ __exportAll({ default: () => metrics_default });
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as RequestWithExtras, J as MiddlewareConfig, k as MiddlewareHandler } from "../index-DLCcLUQT.mjs";
2
+ import { A as RequestWithExtras, Y as MiddlewareConfig, k as MiddlewareHandler } from "../index-DtHACefu.mjs";
3
3
  import { RouteHandlerMethod } from "fastify";
4
4
  interface NamedMiddleware {
5
5
  /** Unique name for debugging/introspection */
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-Ca2IQFy2.mjs";
3
- import { t as multipartBody } from "../multipartBody-Bxz-q6hI.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-D9EiaO5s.mjs";
3
+ import { t as multipartBody } from "../multipartBody-L2gr96df.mjs";
4
4
  // src/middleware/middleware.ts
5
5
  /**
6
6
  * Named Middleware — Priority-based, conditional middleware execution.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as startRenewingLease } from "../renewingLease-g2FjB3im.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as startRenewingLease } from "../renewingLease-DaoP0K-e.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  // src/migrations/index.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/factory/module/index.ts
3
3
  /**
4
4
  * Identity helper for authoring a typed module — mirrors `defineResource`.
@@ -1,5 +1,5 @@
1
1
 
2
- import { G as CrudRouteKey, W as PresetResult } from "./index-DLCcLUQT.mjs";
2
+ import { G as PresetResult, K as CrudRouteKey } from "./index-DtHACefu.mjs";
3
3
  type TenantFieldSpec = {
4
4
  field: string;
5
5
  type: "org";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
3
3
  import sjson from "secure-json-parse";
4
4
  // src/middleware/multipartBody.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/utils/observeSend.ts
3
3
  /** Run `fn`, reporting whether it called `reply.send` (or the reply is already sent). */
4
4
  async function runObservingSend(reply, fn) {
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { n as getUserRoles } from "./userHelpers-cT5j1kgp.mjs";
3
- import { a as resolveActionPermission } from "./schemaIR-By8XiNeE.mjs";
4
- import { t as buildActionBodySchema } from "./createActionRouter-zXlrwWVs.mjs";
5
- import { t as pluralize } from "./pluralize-D4vcPLVs.mjs";
6
- import { n as convertRouteSchema } from "./schemaConverter-Cs3SwP4R.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as getUserRoles } from "./userHelpers-CwpEK36a.mjs";
3
+ import { a as resolveActionPermission } from "./schemaIR-DP7mMj7c.mjs";
4
+ import { t as buildActionBodySchema } from "./createActionRouter-DtxUXOCI.mjs";
5
+ import { t as pluralize } from "./pluralize-CJKgYkVc.mjs";
6
+ import { n as convertRouteSchema } from "./schemaConverter-XoLKVpzG.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  // src/docs/openapi/canonical-schemas.ts
9
9
  /**
@@ -1,5 +1,5 @@
1
1
 
2
- import { n as ArcModule, u as ModuleName } from "../types-BeEJm-DV.mjs";
2
+ import { n as ArcModule, p as ModuleName } from "../types-CQhHTZXs.mjs";
3
3
  import { l as PermissionCheck } from "../base-HXNgPQww.mjs";
4
4
  import { OutboxStore } from "@classytic/primitives/outbox";
5
5
  /**
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as defineResource } from "../defineResource-DC5UqkQv.mjs";
3
- import { r as readOutboxHealth } from "../health-CEpgVAl7.mjs";
4
- import { n as getModuleExports, t as defineModule } from "../module-C0JCsnO7.mjs";
5
- import { i as NotFoundError, u as ValidationError } from "../errors-DxpHZBlW.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as defineResource } from "../defineResource-q8TsJpOm.mjs";
3
+ import { r as readOutboxHealth } from "../health-22T82HAa.mjs";
4
+ import { n as getModuleExports, t as defineModule } from "../module-BLrTmMyk.mjs";
5
+ import { i as NotFoundError, u as ValidationError } from "../errors-Ukhmfmmx.mjs";
6
6
  // src/outbox-admin/module.ts
7
7
  /**
8
8
  * Strip the domain payload and the stack unless explicitly opted in.
@@ -81,7 +81,7 @@ function createOutboxAdminModule(deps) {
81
81
  if (!eventId) throw new ValidationError("event id is required");
82
82
  if (!await deps.store.requeue(eventId)) throw new NotFoundError(`Dead-lettered event "${eventId}" — not found, or not currently dead-lettered`);
83
83
  const { relay } = getModuleExports(req.server, outboxModuleName);
84
- const relayDelivered = await relay.relay();
84
+ const relayDelivered = (await relay.relayBatch()).relayed;
85
85
  return reply.send({
86
86
  eventId,
87
87
  requeued: true,
@@ -1,10 +1,10 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { n as requestContext } from "./requestContext-yc7MSgmq.mjs";
3
- import { t as transactionContext } from "./transactionContext-D0UZFoSy.mjs";
4
- import { i as resolveEventTransport } from "./EventTransport-DeNze_-C.mjs";
5
- import { t as emitObserved } from "./eventPlugin-ZsIQPRso.mjs";
6
- import { n as canReportHealth, r as readOutboxHealth } from "./health-CEpgVAl7.mjs";
7
- import { t as EventOutbox } from "./relay-CEaCmUfG.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as requestContext } from "./requestContext-B-TjFpWt.mjs";
3
+ import { t as transactionContext } from "./transactionContext-BsQ5ortM.mjs";
4
+ import { i as resolveEventTransport } from "./EventTransport-B3jTKMQH.mjs";
5
+ import { t as emitObserved } from "./eventPlugin-DTKAgSvb.mjs";
6
+ import { n as canReportHealth, r as readOutboxHealth } from "./health-22T82HAa.mjs";
7
+ import { t as EventOutbox } from "./relay-CmT3gtkP.mjs";
8
8
  import { randomBytes } from "node:crypto";
9
9
  import { hostname } from "node:os";
10
10
  // src/events/outbox-module.ts
@@ -1,5 +1,5 @@
1
1
 
2
- import { n as ArcModule } from "./types-BeEJm-DV.mjs";
2
+ import { n as ArcModule } from "./types-CQhHTZXs.mjs";
3
3
  import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-CYEoCJGe.mjs";
4
4
  import { FastifyInstance } from "fastify";
5
5
  import { OutboxFailurePolicy, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
@@ -243,14 +243,11 @@ declare class EventOutbox {
243
243
  store(event: DomainEvent, options?: OutboxWriteOptions): Promise<void>;
244
244
  private _reportError;
245
245
  /**
246
- * Relay pending events to transport and return the number of successful
247
- * publish+acknowledge pairs.
246
+ * Relay pending events and return the count of published AND acknowledged events.
248
247
  *
249
- * For richer observability (per-kind counts, publishMany detection, etc.)
250
- * use {@link relayBatch} which returns a {@link RelayResult}. This method
251
- * is the backward-compatible shortcut that returns just the count.
252
- *
253
- * @returns Number of successfully published AND acknowledged events
248
+ * @deprecated Use `(await outbox.relayBatch()).relayed` — {@link relayBatch}
249
+ * returns the full {@link RelayResult}. Warns once per process; removed in the
250
+ * next minor.
254
251
  */
255
252
  relay(): Promise<number>;
256
253
  /**
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { c as DataPolicy, d as UserBase, l as PermissionCheck, m as normalizeRoles, p as getUserRoles, s as AuthorizationDecision, u as PermissionContext } from "../base-HXNgPQww.mjs";
3
3
  import { a as applyFieldReadPermissions, c as resolveEffectiveRoles, i as FieldWritePermissionResult, n as FieldPermissionMap, o as applyFieldWritePermissions, r as FieldPermissionType, s as fields, t as FieldPermission } from "../fields-JTkrtO-r.mjs";
4
- import { $ as deny, A as GrantResolution, B as explainAccess, C as requireScopeContext, D as createRoleHierarchy, E as RoleHierarchy, F as AccessExplanation, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, I as PermissionRequirement, J as PublicPolicy, K as createOrgPermissions, L as collectPublicSurface, M as modeSatisfies, N as requireGrant, O as GRANT_MODES, P as conjoinPolicyFilters, Q as anyOf, R as describePermission, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, V as ConnectEventsOptions, W as PermissionEventBus, X as allow, Y as allOf, Z as allowPublic, _ as publicRead, _t as requireMandate, a as PermissionMatrixRegistry, at as requireRoles, b as requireOrgInScope, c as introspectModule, ct as scopeOf, d as adminOnly, dt as evaluatePermissionDecision, et as denyAll, f as authenticated, ft as normalizeToDecision, g as presets_d_exports, gt as requireDPoP, h as permissionMatrix, ht as requireAgentScope, i as PermissionMatrixOptions, it as requirePlatformRole, j as RequireGrantOptions, k as GrantMode, l as introspectRegistry, lt as PermissionCheckReturn, m as ownerWithAdminBypass, mt as RequireMandateOptions, n as PermissionEntryType, nt as requireAuth, o as buildPermissionMatrix, ot as roles, p as fullPublic, pt as RequireAgentScopeOptions, q as AllowPublicOptions, r as PermissionMatrix, rt as requireOwnership, s as introspectCheck, st as when, t as PermissionEntry, tt as not, u as PermissionOverrides, ut as applyAuthorizationDecision, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly, z as describePermissionMap } from "../index-CMNpMBtW.mjs";
4
+ import { $ as deny, A as GrantResolution, B as explainAccess, C as requireScopeContext, D as createRoleHierarchy, E as RoleHierarchy, F as AccessExplanation, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, I as PermissionRequirement, J as PublicPolicy, K as createOrgPermissions, L as collectPublicSurface, M as modeSatisfies, N as requireGrant, O as GRANT_MODES, P as conjoinPolicyFilters, Q as anyOf, R as describePermission, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, V as ConnectEventsOptions, W as PermissionEventBus, X as allow, Y as allOf, Z as allowPublic, _ as publicRead, _t as requireMandate, a as PermissionMatrixOptions, at as requireRoles, b as requireOrgInScope, c as introspectCheck, ct as scopeOf, d as PermissionOverrides, dt as evaluatePermissionDecision, et as denyAll, f as adminOnly, ft as normalizeToDecision, g as permissionMatrix, gt as requireDPoP, h as ownerWithAdminBypass, ht as requireAgentScope, i as PermissionMatrix, it as requirePlatformRole, j as RequireGrantOptions, k as GrantMode, l as introspectModule, lt as PermissionCheckReturn, m as fullPublic, mt as RequireMandateOptions, n as PermissionEntry, nt as requireAuth, o as PermissionMatrixRegistry, ot as roles, p as authenticated, pt as RequireAgentScopeOptions, q as AllowPublicOptions, r as PermissionEntryType, rt as requireOwnership, s as buildPermissionMatrix, st as when, t as permissions, tt as not, u as introspectRegistry, ut as applyAuthorizationDecision, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly, z as describePermissionMap } from "../index-BzUyno-u.mjs";
5
5
  import { a as createMemoryResourceRateLimiter, i as ResourceRateLimiter, n as ResourceRateLimitDecision, o as resolveResourceRateLimiter, r as ResourceRateLimitPolicy, t as ResourceRateLimitContext } from "../resourceRateLimit-BPiESPtG.mjs";
6
- export { type AccessExplanation, type AllowPublicOptions, type AuthorizationDecision, type ConnectEventsOptions, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type FieldPermission, type FieldPermissionMap, type FieldPermissionType, type FieldWritePermissionResult, GRANT_MODES, type GrantMode, type GrantResolution, type PermissionCheck, type PermissionCheckReturn, type PermissionContext, type PermissionEntry, type PermissionEntryType, type PermissionEventBus, type PermissionMatrix, type PermissionMatrixOptions, type PermissionMatrixRegistry, type PermissionOverrides, type PermissionRequirement, type PublicPolicy, type RequireAgentScopeOptions, type RequireGrantOptions, type RequireMandateOptions, type ResourceRateLimitContext, type ResourceRateLimitDecision, type ResourceRateLimitPolicy, type ResourceRateLimiter, type RoleHierarchy, type UserBase, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
6
+ export { type AccessExplanation, type AllowPublicOptions, type AuthorizationDecision, type ConnectEventsOptions, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type FieldPermission, type FieldPermissionMap, type FieldPermissionType, type FieldWritePermissionResult, GRANT_MODES, type GrantMode, type GrantResolution, type PermissionCheck, type PermissionCheckReturn, type PermissionContext, type PermissionEntry, type PermissionEntryType, type PermissionEventBus, type PermissionMatrix, type PermissionMatrixOptions, type PermissionMatrixRegistry, type PermissionOverrides, type PermissionRequirement, type PublicPolicy, type RequireAgentScopeOptions, type RequireGrantOptions, type RequireMandateOptions, type ResourceRateLimitContext, type ResourceRateLimitDecision, type ResourceRateLimitPolicy, type ResourceRateLimiter, type RoleHierarchy, type UserBase, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as conjoinPolicyFilters } from "../filter-merge-UJCgjbZR.mjs";
3
- import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-cT5j1kgp.mjs";
4
- import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-kCbIDTjA.mjs";
5
- import { i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-DKmH4tZ-.mjs";
6
- import { i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "../resourceRateLimit-PQaY3HW1.mjs";
7
- import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-Cga6KBOX.mjs";
8
- export { GRANT_MODES, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as conjoinPolicyFilters } from "../filter-merge-BuzZ-r9z.mjs";
3
+ import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-CwpEK36a.mjs";
4
+ import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-B7fuROWK.mjs";
5
+ import { i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-gB5-bHDp.mjs";
6
+ import { i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "../resourceRateLimit-DdIYis3m.mjs";
7
+ import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as introspectRegistry, b as describePermissionMap, c as fullPublic, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectModule, j as requireDPoP, k as requireTeamMembership, l as ownerWithAdminBypass, m as createRoleHierarchy, n as buildPermissionMatrix, o as adminOnly, p as readOnly, r as introspectCheck, s as authenticated, t as permissions, u as permissionMatrix, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-CEyeDHtT.mjs";
8
+ export { GRANT_MODES, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createMemoryResourceRateLimiter, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, resolveResourceRateLimiter, roles, scopeOf, when };
@@ -1,12 +1,13 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
- import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-Cunc4shv.mjs";
4
- import { i as normalizeToDecision } from "./authorizationDecision-DKmH4tZ-.mjs";
5
- import { t as conjoinPolicyFilters } from "./filter-merge-UJCgjbZR.mjs";
6
- import { n as getUserRoles } from "./userHelpers-cT5j1kgp.mjs";
7
- import { t as MemoryCacheStore } from "./memory-B9CFHbA_.mjs";
8
- import { t as arcLog } from "./logger-DJwz_-Pl.mjs";
9
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-B8IT7xiQ.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
3
+ import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-ZvdR7MVa.mjs";
4
+ import { n as warnDeprecated, t as deprecatedNamespace } from "./deprecation-DX625dth.mjs";
5
+ import { i as normalizeToDecision } from "./authorizationDecision-gB5-bHDp.mjs";
6
+ import { t as conjoinPolicyFilters } from "./filter-merge-BuzZ-r9z.mjs";
7
+ import { n as getUserRoles } from "./userHelpers-CwpEK36a.mjs";
8
+ import { t as MemoryCacheStore } from "./memory-Ay0haw9n.mjs";
9
+ import { t as arcLog } from "./logger-DdMS0XC_.mjs";
10
+ import { n as declareRuntimeCapability } from "./runtimeCapabilities-DY20Pibh.mjs";
10
11
  import { randomUUID } from "node:crypto";
11
12
  // src/permissions/context.ts
12
13
  /**
@@ -40,6 +41,13 @@ function scopeOf(ctx) {
40
41
  }
41
42
  // src/permissions/core.ts
42
43
  /**
44
+ * Permission Core — universal permission primitives.
45
+ *
46
+ * Auth/role/ownership checks and the combinators (`allOf`, `anyOf`, `not`,
47
+ * `when`, `denyAll`) that compose them. Scope-bound checks live in
48
+ * `./scope.js`; the dynamic matrix lives in `./dynamic.js`.
49
+ */
50
+ /**
43
51
  * Build an `allow` {@link AuthorizationDecision}, optionally attaching a row-level
44
52
  * `policy` and/or a `scope` to install. The idiomatic "grant" return for arc
45
53
  * 2.30 checks (parallels Cedar's `permit`).
@@ -230,11 +238,13 @@ function requirePlatformRole(...args) {
230
238
  return check;
231
239
  }
232
240
  /**
233
- * Short-form alias of `requireRoles()`. Identical behavior — checks both
234
- * platform roles AND org roles. Prefer `requireRoles` for new code; this
235
- * exists for call sites that want a terser name.
241
+ * Short-form alias of `requireRoles()` — checks platform AND org roles.
242
+ *
243
+ * @deprecated Use `requireRoles(...)`. Warns once per process; removed in the
244
+ * next minor.
236
245
  */
237
246
  function roles(...args) {
247
+ warnDeprecated("`roles()` from @classytic/arc/permissions", "Use `requireRoles(...)`.");
238
248
  const roleList = normalizeVariadicOrArray(args);
239
249
  const check = (ctx) => {
240
250
  if (!ctx.user) return deny("Authentication required");
@@ -1517,15 +1527,15 @@ function createRoleHierarchy(map) {
1517
1527
  *
1518
1528
  * @example
1519
1529
  * ```typescript
1520
- * import { permissions } from '@classytic/arc';
1530
+ * import { publicRead, requireRoles } from '@classytic/arc/permissions';
1521
1531
  *
1522
1532
  * // Public read, authenticated write
1523
- * defineResource({ name: 'product', permissions: permissions.publicRead() });
1533
+ * defineResource({ name: 'product', permissions: publicRead() });
1524
1534
  *
1525
1535
  * // Override specific operations
1526
1536
  * defineResource({
1527
1537
  * name: 'product',
1528
- * permissions: permissions.publicRead({ delete: requireRoles(['superadmin']) }),
1538
+ * permissions: publicRead({ delete: requireRoles(['superadmin']) }),
1529
1539
  * });
1530
1540
  * ```
1531
1541
  */
@@ -1670,7 +1680,7 @@ function fullPublic(overrides) {
1670
1680
  * Writes carry an explicit `denyAll` check — an omitted CRUD permission
1671
1681
  * mounts the route with NO gate (public-by-omission), so leaving
1672
1682
  * create/update/delete undefined here would expose unauthenticated writes.
1673
- * Hosts that disable write routes entirely (`disabledRoutes`) are unaffected.
1683
+ * Hosts that disable write routes entirely (`crud: { list: true, get: true }`) are unaffected.
1674
1684
  */
1675
1685
  function readOnly(overrides) {
1676
1686
  return withOverrides({
@@ -1796,4 +1806,13 @@ function buildPermissionMatrix(options = {}) {
1796
1806
  modules
1797
1807
  };
1798
1808
  }
1799
- export { requireAgentScope as A, requireAuth as B, createOrgPermissions as C, requireScopeContext as D, requireOrgRole as E, allowPublic as F, when as G, requirePlatformRole as H, anyOf as I, scopeOf as K, deny as L, requireMandate as M, allOf as N, requireServiceScope as O, allow as P, denyAll as R, createDynamicPermissionMatrix as S, requireOrgMembership as T, requireRoles as U, requireOwnership as V, roles as W, requireGrant as _, adminOnly as a, describePermissionMap as b, ownerWithAdminBypass as c, publicRead as d, publicReadAdminWrite as f, modeSatisfies as g, GRANT_MODES as h, introspectRegistry as i, requireDPoP as j, requireTeamMembership as k, permissionMatrix as l, createRoleHierarchy as m, introspectCheck as n, authenticated as o, readOnly as p, introspectModule as r, fullPublic as s, buildPermissionMatrix as t, presets_exports as u, collectPublicSurface as v, requireOrgInScope as w, explainAccess as x, describePermission as y, not as z };
1809
+ // src/permissions/index.ts
1810
+ /**
1811
+ * Namespace alias for the preset bundles.
1812
+ *
1813
+ * @deprecated Import the preset itself: `import { publicRead } from
1814
+ * '@classytic/arc/permissions'` then `permissions: publicRead()`. Warns once per
1815
+ * process; removed in the next minor.
1816
+ */
1817
+ const permissions = /* @__PURE__ */ deprecatedNamespace(presets_exports, "The `permissions` namespace export", "Import the preset directly: `import { publicRead } from '@classytic/arc/permissions'`.");
1818
+ export { requireAgentScope as A, requireAuth as B, createOrgPermissions as C, requireScopeContext as D, requireOrgRole as E, allowPublic as F, when as G, requirePlatformRole as H, anyOf as I, scopeOf as K, deny as L, requireMandate as M, allOf as N, requireServiceScope as O, allow as P, denyAll as R, createDynamicPermissionMatrix as S, requireOrgMembership as T, requireRoles as U, requireOwnership as V, roles as W, requireGrant as _, introspectRegistry as a, describePermissionMap as b, fullPublic as c, publicRead as d, publicReadAdminWrite as f, modeSatisfies as g, GRANT_MODES as h, introspectModule as i, requireDPoP as j, requireTeamMembership as k, ownerWithAdminBypass as l, createRoleHierarchy as m, buildPermissionMatrix as n, adminOnly as o, readOnly as p, introspectCheck as r, authenticated as s, permissions as t, permissionMatrix as u, collectPublicSurface as v, requireOrgInScope as w, explainAccess as x, describePermission as y, not as z };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
- import { r as ForbiddenError } from "./errors-DxpHZBlW.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { r as ForbiddenError } from "./errors-Ukhmfmmx.mjs";
3
3
  // src/pipeline/pipe.ts
4
4
  /**
5
5
  * Compose pipeline steps into an ordered array.