@classytic/arc 2.51.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 (223) hide show
  1. package/README.md +2 -1
  2. package/dist/{EventTransport-K7Q9WPjm.mjs → EventTransport-B3jTKMQH.mjs} +2 -2
  3. package/dist/{HookSystem-DBAu9uNT.mjs → HookSystem-DNwxV463.mjs} +2 -2
  4. package/dist/{ResourceRegistry-BelzCRMy.mjs → ResourceRegistry-Ck7RFodL.mjs} +2 -2
  5. package/dist/{acquire-B0zhfGSm.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-Dxj_cy6N.mjs → authorizationDecision-gB5-bHDp.mjs} +9 -7
  14. package/dist/bootError-BT3z3cvX.mjs +38 -0
  15. package/dist/{boundedMap-DOBai-H3.mjs → boundedMap-Ddw2yGb2.mjs} +1 -1
  16. package/dist/{buildHandler-Dyl8P9j0.mjs → buildHandler-B8IDGmhD.mjs} +5 -5
  17. package/dist/cache/index.mjs +4 -4
  18. package/dist/{caching-CUmaNL8Y.mjs → caching-BitJDAY0.mjs} +2 -2
  19. package/dist/{claimed-DJPk4VZr.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-DH41jnNT.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-DPmRWlpx.mjs → core-B_06Fcn0.mjs} +3 -3
  37. package/dist/{createActionRouter-B1xhER6i.mjs → createActionRouter-DtxUXOCI.mjs} +5 -5
  38. package/dist/{createAggregationRouter-CNntJL-z.mjs → createAggregationRouter-BMiKyDoW.mjs} +7 -7
  39. package/dist/{createApp-DpG26bCu.mjs → createApp-CEdGZtkP.mjs} +207 -44
  40. package/dist/{createMcpServer-CS2KOVP6.d.mts → createMcpServer-Bk3ls5jS.d.mts} +1 -1
  41. package/dist/{defineAggregation-rI3EbZUg.mjs → defineAggregation-DUsrGcsm.mjs} +1 -1
  42. package/dist/{defineResource-5DcG_wlI.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-XFu7J3aj.mjs → elevation-NJ3908pJ.mjs} +5 -5
  48. package/dist/encryption/index.d.mts +26 -1
  49. package/dist/encryption/index.mjs +56 -6
  50. package/dist/{errorHandler-xDVUWOMu.mjs → errorHandler-Ke6PGvF7.mjs} +7 -4
  51. package/dist/{errors-KBZ3tQk5.mjs → errors-Ukhmfmmx.mjs} +1 -1
  52. package/dist/{eventPlugin-BY38F6yK.d.mts → eventPlugin-BeJasppx.d.mts} +7 -18
  53. package/dist/{eventPlugin-C4lNj2Dw.mjs → eventPlugin-DTKAgSvb.mjs} +10 -8
  54. package/dist/{eventTypes-DZRoUAdk.mjs → eventTypes-DpDQtyR6.mjs} +2 -2
  55. package/dist/events/index.d.mts +2 -2
  56. package/dist/events/index.mjs +8 -8
  57. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  58. package/dist/events/transports/redis.mjs +2 -2
  59. package/dist/factory/index.d.mts +28 -5
  60. package/dist/factory/index.mjs +12 -7
  61. package/dist/{fastify-augmentation-baQc3MaO.d.mts → fastify-augmentation-DjxuSRG4.d.mts} +4 -3
  62. package/dist/{fieldTypes-DrXUW1jc.mjs → fieldTypes-BtFpQO6I.mjs} +2 -2
  63. package/dist/{fields-C5J8WTd2.mjs → fields-B7fuROWK.mjs} +1 -1
  64. package/dist/{filter-merge-DTjYoDrj.mjs → filter-merge-BuzZ-r9z.mjs} +1 -1
  65. package/dist/{generate-SA8oMlLB.mjs → generate-c4F39pk1.mjs} +4 -4
  66. package/dist/{headers-D5wrBLOk.mjs → headers-Ib7BDgRI.mjs} +2 -2
  67. package/dist/{health-BLal039H.mjs → health-22T82HAa.mjs} +1 -1
  68. package/dist/health-skjSwNaC.d.mts +36 -0
  69. package/dist/hooks/index.d.mts +1 -1
  70. package/dist/hooks/index.mjs +2 -2
  71. package/dist/http-cache/index.mjs +4 -4
  72. package/dist/http-cache/purgers/cloudflare.mjs +2 -2
  73. package/dist/http-cache/purgers/fastly.mjs +2 -2
  74. package/dist/http-cache/testing/index.mjs +1 -1
  75. package/dist/idempotency/index.d.mts +7 -1
  76. package/dist/idempotency/index.mjs +9 -7
  77. package/dist/idempotency/redis.mjs +2 -2
  78. package/dist/{index-CMNpMBtW.d.mts → index-BzUyno-u.d.mts} +14 -5
  79. package/dist/{index-Dhrks-hM.d.mts → index-CXqYFGoH.d.mts} +13 -4
  80. package/dist/{index-DexdFs1a.d.mts → index-CaBFPmnu.d.mts} +29 -7
  81. package/dist/{index-DKM2p5w5.d.mts → index-DWn0o4U7.d.mts} +2 -2
  82. package/dist/{index-DLCcLUQT.d.mts → index-DtHACefu.d.mts} +109 -116
  83. package/dist/index.d.mts +5 -5
  84. package/dist/index.mjs +12 -12
  85. package/dist/{init-DeKHaNZn.mjs → init-XY5slyuS.mjs} +3 -3
  86. package/dist/integrations/event-gateway.mjs +2 -2
  87. package/dist/integrations/index.d.mts +1 -1
  88. package/dist/integrations/index.mjs +1 -1
  89. package/dist/integrations/jobs/index.mjs +3 -3
  90. package/dist/integrations/mcp/index.d.mts +9 -4
  91. package/dist/integrations/mcp/index.mjs +2 -2
  92. package/dist/integrations/mcp/testing.d.mts +2 -2
  93. package/dist/integrations/mcp/testing.mjs +2 -2
  94. package/dist/integrations/streamline.mjs +3 -3
  95. package/dist/integrations/webhooks.d.mts +1 -1
  96. package/dist/integrations/webhooks.mjs +4 -4
  97. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  98. package/dist/integrations/websocket-redis.mjs +1 -1
  99. package/dist/integrations/websocket.mjs +2 -2
  100. package/dist/invariants-COekUeoh.mjs +120 -0
  101. package/dist/{jsonBody-rDPGT5A9.mjs → jsonBody-BNlcGUnb.mjs} +2 -2
  102. package/dist/{keys-t7i-lJ2r.mjs → keys-DwvXJwUX.mjs} +1 -1
  103. package/dist/{loadResources-CcupAVJH.mjs → loadResources-izEeQLO_.mjs} +3 -3
  104. package/dist/{loadResourcesFromEntry-BpjYlaoj.mjs → loadResourcesFromEntry-CijqjbHE.mjs} +2 -2
  105. package/dist/logger/index.mjs +2 -2
  106. package/dist/{logger-IL7Btm-N.mjs → logger-DdMS0XC_.mjs} +1 -1
  107. package/dist/{mcpPlugin-BsdH7Vot.mjs → mcpPlugin-D0tSZqKk.mjs} +24 -22
  108. package/dist/{memory-Dkp6ZD3F.mjs → memory-Ay0haw9n.mjs} +3 -3
  109. package/dist/{metrics-CDPqgdKr.mjs → metrics-Bpgf4UL6.mjs} +3 -3
  110. package/dist/middleware/index.d.mts +1 -1
  111. package/dist/middleware/index.mjs +3 -3
  112. package/dist/migrations/index.mjs +2 -2
  113. package/dist/{module-KFxT1Iuk.mjs → module-BLrTmMyk.mjs} +17 -2
  114. package/dist/{multiTenant-QtDzxx_K.d.mts → multiTenant-Cf0Ye-Wu.d.mts} +1 -1
  115. package/dist/{multipartBody-BHktuarE.mjs → multipartBody-L2gr96df.mjs} +1 -1
  116. package/dist/{observeSend-CY-sLanc.mjs → observeSend-B7FEdk_g.mjs} +1 -1
  117. package/dist/{openapi-DbeXiy2v.mjs → openapi-COrL_33P.mjs} +6 -6
  118. package/dist/outbox-admin/index.d.mts +1 -1
  119. package/dist/outbox-admin/index.mjs +6 -6
  120. package/dist/{outbox-module-BWqkTE8-.mjs → outbox-module-BY2HtnjU.mjs} +7 -7
  121. package/dist/{outbox-module-DzW6zwWJ.d.mts → outbox-module-C1QWMloZ.d.mts} +5 -8
  122. package/dist/permissions/index.d.mts +2 -2
  123. package/dist/permissions/index.mjs +8 -8
  124. package/dist/{permissions-e5YMrFbm.mjs → permissions-CEyeDHtT.mjs} +36 -17
  125. package/dist/{pipe-CMnKfdF4.mjs → pipe-DIAr91at.mjs} +2 -2
  126. package/dist/pipeline/index.d.mts +1 -1
  127. package/dist/pipeline/index.mjs +2 -2
  128. package/dist/{plan-BvLJGm3U.mjs → plan-BhKHIkFl.mjs} +75 -20
  129. package/dist/{plugin-DYmu8uT4.mjs → plugin-D6hrdx-j.mjs} +72 -38
  130. package/dist/plugins/index.d.mts +4 -3
  131. package/dist/plugins/index.mjs +18 -18
  132. package/dist/plugins/response-cache.mjs +4 -4
  133. package/dist/plugins/tracing-entry.mjs +177 -85
  134. package/dist/{pluralize-ClwfBdIx.mjs → pluralize-CJKgYkVc.mjs} +1 -1
  135. package/dist/presetPermission-2pcRVYRG.mjs +23 -0
  136. package/dist/presets/filesUpload.d.mts +4 -2
  137. package/dist/presets/filesUpload.mjs +11 -6
  138. package/dist/presets/index.d.mts +6 -4
  139. package/dist/presets/index.mjs +2 -2
  140. package/dist/presets/multiTenant.d.mts +1 -1
  141. package/dist/presets/multiTenant.mjs +5 -5
  142. package/dist/presets/search.d.mts +2 -2
  143. package/dist/presets/search.mjs +54 -38
  144. package/dist/{presets-DX_lPabi.mjs → presets-st11ePNn.mjs} +150 -41
  145. package/dist/{projection-DnZiFPPE.mjs → projection-B4rqiJTi.mjs} +2 -2
  146. package/dist/{purger.types-BEzTVDOU.mjs → purger.types-BcHeAhY_.mjs} +1 -1
  147. package/dist/{queryCachePlugin-C57-Nj-g.mjs → queryCachePlugin-BgSc2bga.mjs} +6 -6
  148. package/dist/rateLimitKey-DLGdeFd2.mjs +138 -0
  149. package/dist/{realtime-C-VIoXMg.mjs → realtime-CpYpIFsm.mjs} +11 -11
  150. package/dist/registry/index.d.mts +2 -2
  151. package/dist/registry/index.mjs +3 -3
  152. package/dist/{registry-DbQvODPH.mjs → registry-BQsdAlZ_.mjs} +2 -2
  153. package/dist/{relay-B61seKq1.mjs → relay-CmT3gtkP.mjs} +11 -12
  154. package/dist/{renewingLease-Dp7wmzNN.mjs → renewingLease-DaoP0K-e.mjs} +1 -1
  155. package/dist/{replyHelpers-CHii_jIO.mjs → replyHelpers-SiLr1wK4.mjs} +2 -2
  156. package/dist/{requestContext-C_mbAm8o.mjs → requestContext-B-TjFpWt.mjs} +8 -3
  157. package/dist/{health-vEo3fni4.mjs → requestId-ClcKoWLq.mjs} +154 -116
  158. package/dist/{requirement-C8OsWLYp.mjs → requirement-BygDzjDS.mjs} +1 -1
  159. package/dist/{resourceRateLimit-DhbQZjE2.mjs → resourceRateLimit-DdIYis3m.mjs} +2 -2
  160. package/dist/{rolldown-runtime-HTi8KV7V.mjs → rolldown-runtime-Cy6j0m8_.mjs} +1 -1
  161. package/dist/{routeValidator-DnQ2BGnH.mjs → routeValidator-Bn-x2gaJ.mjs} +1 -1
  162. package/dist/{runtimeCapabilities-G9QXHov1.mjs → runtimeCapabilities-DY20Pibh.mjs} +7 -2
  163. package/dist/{schedules-DAthT5O3.mjs → schedules-CwqC0Mp0.mjs} +5 -5
  164. package/dist/{schemaConverter-BOt_ed78.mjs → schemaConverter-XoLKVpzG.mjs} +2 -2
  165. package/dist/{schemaIR-MZVVj6Cw.mjs → schemaIR-DP7mMj7c.mjs} +16 -16
  166. package/dist/schemas/index.mjs +1 -1
  167. package/dist/scim/index.mjs +2 -2
  168. package/dist/scope/index.d.mts +6 -2
  169. package/dist/scope/index.mjs +5 -5
  170. package/dist/{scope-btg-225w.mjs → scope-B0vgM2Zw.mjs} +4 -4
  171. package/dist/{shutdown-Dfy8La90.mjs → shutdown-C76Hn-Th.mjs} +1 -1
  172. package/dist/{simpleEqualityMatcher-D5dOqbbj.mjs → simpleEqualityMatcher-Qbl-11cE.mjs} +1 -1
  173. package/dist/{sse-DivxX1m6.mjs → sse-eyb8lNuI.mjs} +7 -7
  174. package/dist/{sseStream-hQxQjvre.mjs → sseStream-BsBesrfw.mjs} +2 -2
  175. package/dist/{store-helpers-DfqfssAw.mjs → store-helpers-D1yIVa91.mjs} +1 -1
  176. package/dist/{streaming-CQiOktsh.mjs → streaming-DKziqs1Z.mjs} +1 -1
  177. package/dist/{subscriberIdentity-Bf8VLqA7.mjs → subscriberIdentity-DpdSQMQq.mjs} +1 -1
  178. package/dist/{tenancy-Btmaf1MB.mjs → tenancy-YuRYsOPr.mjs} +2 -2
  179. package/dist/{tenantPreparation-4e3qyb6q.mjs → tenantPreparation-Bk8ouRB3.mjs} +17 -5
  180. package/dist/testing/cleanupStoreContract.mjs +1 -1
  181. package/dist/testing/index.d.mts +4 -4
  182. package/dist/testing/index.mjs +11 -11
  183. package/dist/testing/outboxStoreContract.mjs +2 -2
  184. package/dist/testing/requiredPorts.d.mts +1 -1
  185. package/dist/testing/requiredPorts.mjs +2 -2
  186. package/dist/testing/storageContract.mjs +1 -1
  187. package/dist/{timing-DXx0IWyi.mjs → timing-BtIDIdQz.mjs} +1 -1
  188. package/dist/{transactionContext-DperjON1.mjs → transactionContext-BsQ5ortM.mjs} +1 -1
  189. package/dist/{typeGuards-eoQLIOh6.mjs → typeGuards-Cr2_zEW0.mjs} +1 -1
  190. package/dist/types/index.d.mts +2 -2
  191. package/dist/types/index.mjs +1 -1
  192. package/dist/types/storage.mjs +1 -1
  193. package/dist/{types-BeEJm-DV.d.mts → types-CQhHTZXs.d.mts} +48 -35
  194. package/dist/{types-B4E0sc6D.d.mts → types-DWFgq8EP.d.mts} +1 -1
  195. package/dist/{types-CcpISJe8.mjs → types-ZvdR7MVa.mjs} +4 -4
  196. package/dist/usage/index.mjs +4 -4
  197. package/dist/{userHelpers-Cp5zqlEN.mjs → userHelpers-CwpEK36a.mjs} +1 -1
  198. package/dist/utils/index.d.mts +1 -1
  199. package/dist/utils/index.mjs +12 -12
  200. package/dist/{utils-dKN-_315.mjs → utils-CnrfcYMq.mjs} +6 -6
  201. package/dist/{validate-BZHaAdgy.mjs → validate-BTQBh-Dr.mjs} +3 -3
  202. package/dist/{versioning-CPLP0VbB.mjs → versioning-DiLykI6U.mjs} +3 -3
  203. package/dist/{workScope-BI72KXsI.mjs → workScope-C3tPz_Gt.mjs} +2 -2
  204. package/package.json +34 -9
  205. package/skills/arc/SKILL.md +5 -5
  206. package/skills/arc/references/api-reference.md +1 -1
  207. package/skills/arc/references/boot.md +17 -2
  208. package/skills/arc/references/events.md +0 -1
  209. package/skills/arc/references/mcp-setup.md +3 -2
  210. package/skills/arc/references/multi-tenancy.md +1 -1
  211. package/skills/arc/references/production-api.md +19 -12
  212. package/skills/arc/references/production-audit.md +1 -1
  213. package/skills/arc/references/production-boot.md +3 -3
  214. package/skills/arc/references/production-idempotency.md +2 -2
  215. package/skills/arc/references/production-observability.md +14 -2
  216. package/skills/arc/references/production-reliability.md +1 -1
  217. package/skills/arc/references/querying.md +1 -2
  218. package/skills/arc/references/resources.md +8 -6
  219. package/skills/arc/references/testing.md +1 -1
  220. package/skills/arc-code-review/references/arc-cheatsheet.md +1 -1
  221. package/skills/arc-code-review/references/recipe-scope-permissions.md +1 -1
  222. package/skills/arc-module-publishing/references/resource-assembly.md +2 -2
  223. package/dist/rateLimitKey-B1RxyGt3.mjs +0 -40
@@ -1,8 +1,68 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { B as requireAuth, F as allowPublic, U as requireRoles } from "./permissions-e5YMrFbm.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as warnDeprecated } from "./deprecation-DX625dth.mjs";
3
+ import { n as bootError, r as formatBootProblems, t as ArcBootError } from "./bootError-BT3z3cvX.mjs";
4
+ import { B as requireAuth, U as requireRoles } from "./permissions-CEyeDHtT.mjs";
3
5
  import { multiTenantPreset } from "./presets/multiTenant.mjs";
4
- import { b as isElevated, n as PUBLIC_SCOPE } from "./types-CcpISJe8.mjs";
5
- import { l as UnauthorizedError } from "./errors-KBZ3tQk5.mjs";
6
+ import { b as isElevated, n as PUBLIC_SCOPE } from "./types-ZvdR7MVa.mjs";
7
+ import { l as UnauthorizedError } from "./errors-Ukhmfmmx.mjs";
8
+ import { t as presetPermission } from "./presetPermission-2pcRVYRG.mjs";
9
+ // src/presets/controllerHandle.ts
10
+ const PRESET_CONTROLLER_METHOD_MISSING = "preset-controller-method-missing";
11
+ const states = /* @__PURE__ */ new WeakMap();
12
+ /** Attribute the next build-time reads on `controller` to `presetName` (no-op for a foreign object). */
13
+ function notePresetSource(controller, presetName) {
14
+ const state = states.get(controller);
15
+ if (state) state.preset = presetName;
16
+ }
17
+ function createPresetControllerHandle(resourceName) {
18
+ let bound = false;
19
+ let target;
20
+ const methods = /* @__PURE__ */ new Map();
21
+ const reads = /* @__PURE__ */ new Map();
22
+ const state = { preset: void 0 };
23
+ const methodFor = (method) => {
24
+ if (!bound) reads.set(`${state.preset}\0${method}`, {
25
+ preset: state.preset,
26
+ method
27
+ });
28
+ const cached = methods.get(method);
29
+ if (cached) return cached;
30
+ const call = async (...args) => {
31
+ const fn = target?.[method];
32
+ if (typeof fn !== "function") throw new Error(`Resource '${resourceName}': a preset route called controller.${method}(), but ` + (!bound ? "the controller is not resolved yet (call the handler from a request)." : target ? `the controller has no '${method}' method. Add it, or extend BaseController.` : "the resource has no controller. Pass `controller`, or give the resource an `adapter` with CRUD routes so arc builds a BaseController."));
33
+ return fn.apply(target, args);
34
+ };
35
+ Object.defineProperty(call, "name", { value: method });
36
+ methods.set(method, call);
37
+ return call;
38
+ };
39
+ const controller = new Proxy({}, { get: (_t, property) => typeof property === "string" && property !== "then" ? methodFor(property) : void 0 });
40
+ states.set(controller, state);
41
+ return {
42
+ controller,
43
+ bind(resolved) {
44
+ bound = true;
45
+ target = resolved ?? void 0;
46
+ },
47
+ verify(routes) {
48
+ const problems = [];
49
+ for (const { preset, method } of reads.values()) {
50
+ if (typeof target?.[method] === "function") continue;
51
+ const fn = methods.get(method);
52
+ const route = routes.find((r) => r.handler === fn || r.rawHandler === fn);
53
+ const at = route ? ` route ${route.method} ${route.path}` : "";
54
+ const where = `preset '${preset ?? "unknown"}'${at}`;
55
+ problems.push({
56
+ code: PRESET_CONTROLLER_METHOD_MISSING,
57
+ message: target ? `Resource '${resourceName}': ${where} uses controller.${method}, but the controller has no '${method}' method.` : `Resource '${resourceName}': ${where} uses controller.${method}, but the resource has no controller.`,
58
+ fix: target ? `Add '${method}' to the controller, or extend BaseController.` : "Pass `controller`, or give the resource an `adapter` with CRUD routes so arc builds a BaseController."
59
+ });
60
+ }
61
+ if (problems.length === 1) throw bootError(problems[0]);
62
+ if (problems.length > 1) throw new ArcBootError(formatBootProblems(`Resource '${resourceName}' preset routes cannot boot`, problems), problems);
63
+ }
64
+ };
65
+ }
6
66
  // src/presets/audited.ts
7
67
  /**
8
68
  * Audited preset - adds createdBy/updatedBy tracking
@@ -70,13 +130,14 @@ function bulkPreset(opts) {
70
130
  const maxCreateItems = opts?.maxCreateItems ?? 1e3;
71
131
  return {
72
132
  name: "bulk",
73
- routes: (permissions) => {
133
+ routes: (permissions, controller) => {
74
134
  const routes = [];
75
135
  if (operations.includes("createMany")) routes.push({
76
136
  method: "POST",
77
137
  path: "/bulk",
78
- handler: "bulkCreate",
138
+ handler: controller.bulkCreate,
79
139
  operation: "bulkCreate",
140
+ _tenantSlot: "create",
80
141
  summary: "Create multiple items",
81
142
  permissions: permissions.create ?? requireAuth(),
82
143
  schema: {
@@ -95,8 +156,9 @@ function bulkPreset(opts) {
95
156
  if (operations.includes("updateMany")) routes.push({
96
157
  method: "PATCH",
97
158
  path: "/bulk",
98
- handler: "bulkUpdate",
159
+ handler: controller.bulkUpdate,
99
160
  operation: "bulkUpdate",
161
+ _tenantSlot: "update",
100
162
  summary: "Update multiple items matching filter",
101
163
  permissions: permissions.update ?? requireAuth(),
102
164
  schema: {
@@ -120,8 +182,9 @@ function bulkPreset(opts) {
120
182
  if (operations.includes("deleteMany")) routes.push({
121
183
  method: "DELETE",
122
184
  path: "/bulk",
123
- handler: "bulkDelete",
185
+ handler: controller.bulkDelete,
124
186
  operation: "bulkDelete",
187
+ _tenantSlot: "delete",
125
188
  summary: "Delete multiple items matching filter",
126
189
  permissions: permissions.delete ?? requireAuth(),
127
190
  schema: {
@@ -181,22 +244,21 @@ function ownedByUserPreset(options = {}) {
181
244
  };
182
245
  }
183
246
  // src/presets/slugLookup.ts
184
- /**
185
- * Slug Lookup Preset
186
- *
187
- * Adds a route to get resource by slug.
188
- */
189
247
  function slugLookupPreset(options = {}) {
190
248
  const { slugField = "slug" } = options;
191
249
  return {
192
250
  name: "slugLookup",
193
- routes: (permissions) => [{
251
+ routes: (permissions, controller) => [{
194
252
  method: "GET",
195
253
  path: `/slug/:${slugField}`,
196
- handler: "getBySlug",
254
+ handler: controller.getBySlug,
197
255
  summary: "Get by slug",
198
- permissions: permissions.get ?? allowPublic(),
199
- operation: "getBySlug"
256
+ permissions: presetPermission(permissions.get, {
257
+ preset: "slugLookup",
258
+ inherits: "get"
259
+ }),
260
+ operation: "getBySlug",
261
+ _tenantSlot: "get"
200
262
  }],
201
263
  controllerOptions: { slugField }
202
264
  };
@@ -212,54 +274,82 @@ function slugLookupPreset(options = {}) {
212
274
  function softDeletePreset() {
213
275
  return {
214
276
  name: "softDelete",
215
- routes: (permissions) => [{
277
+ routes: (permissions, controller) => [{
216
278
  method: "GET",
217
279
  path: "/deleted",
218
- handler: "getDeleted",
280
+ handler: controller.getDeleted,
219
281
  summary: "Get soft-deleted items",
220
282
  permissions: permissions.list ?? requireRoles(["admin"]),
221
283
  operation: "listDeleted",
284
+ _tenantSlot: "list",
222
285
  _presetSource: "softDelete"
223
286
  }, {
224
287
  method: "POST",
225
288
  path: "/:id/restore",
226
- handler: "restore",
289
+ handler: controller.restore,
227
290
  summary: "Restore soft-deleted item",
228
291
  permissions: permissions.update ?? requireRoles(["admin"]),
229
292
  operation: "restore",
293
+ _tenantSlot: "update",
230
294
  _presetSource: "softDelete"
231
295
  }]
232
296
  };
233
297
  }
234
298
  // src/presets/tree.ts
235
- /**
236
- * Tree Preset
237
- *
238
- * Adds routes for hierarchical tree structures.
239
- */
240
299
  function treePreset(options = {}) {
241
300
  const { parentField = "parent" } = options;
242
301
  return {
243
302
  name: "tree",
244
- routes: (permissions) => [{
303
+ routes: (permissions, controller) => [{
245
304
  method: "GET",
246
305
  path: "/tree",
247
- handler: "getTree",
306
+ handler: controller.getTree,
248
307
  summary: "Get hierarchical tree",
249
- permissions: permissions.list ?? allowPublic(),
250
- operation: "getTree"
308
+ permissions: presetPermission(permissions.list, {
309
+ preset: "tree",
310
+ inherits: "list"
311
+ }),
312
+ operation: "getTree",
313
+ _tenantSlot: "list"
251
314
  }, {
252
315
  method: "GET",
253
316
  path: `/:${parentField}/children`,
254
- handler: "getChildren",
317
+ handler: controller.getChildren,
255
318
  summary: "Get children of parent",
256
- permissions: permissions.list ?? allowPublic(),
257
- operation: "getChildren"
319
+ permissions: presetPermission(permissions.list, {
320
+ preset: "tree",
321
+ inherits: "list"
322
+ }),
323
+ operation: "getChildren",
324
+ _tenantSlot: "list"
258
325
  }],
259
326
  controllerOptions: { parentField }
260
327
  };
261
328
  }
262
329
  // src/presets/index.ts
330
+ /**
331
+ * Presets Module
332
+ *
333
+ * Reusable resource configurations that add routes, middlewares, and schema options.
334
+ *
335
+ * @example
336
+ * import { defineResource } from '@classytic/arc';
337
+ *
338
+ * // Using preset strings (resolved internally)
339
+ * defineResource({
340
+ * presets: ['softDelete', 'slugLookup'],
341
+ * });
342
+ *
343
+ * // Using preset functions with options
344
+ * import { softDeletePreset, treePreset } from '@classytic/arc/presets';
345
+ *
346
+ * defineResource({
347
+ * presets: [
348
+ * softDeletePreset(),
349
+ * treePreset({ parentField: 'parentSlug' }),
350
+ * ],
351
+ * });
352
+ */
263
353
  const presetRegistry = {
264
354
  softDelete: softDeletePreset,
265
355
  slugLookup: slugLookupPreset,
@@ -307,12 +397,13 @@ function getAvailablePresets() {
307
397
  * Validate that preset combinations don't conflict.
308
398
  * Detects route collisions (same method + path from different presets).
309
399
  */
310
- function validatePresetCombination(presets) {
400
+ function validatePresetCombination(presets, controller) {
311
401
  const conflicts = [];
312
402
  const routeMap = /* @__PURE__ */ new Map();
313
403
  for (const preset of presets) {
314
404
  const name = preset.name ?? "unknown";
315
- const presetRoutes = preset.routes ? typeof preset.routes === "function" ? preset.routes({}) : preset.routes : [];
405
+ notePresetSource(controller, name);
406
+ const presetRoutes = preset.routes ? typeof preset.routes === "function" ? preset.routes({}, controller) : preset.routes : [];
316
407
  for (const route of presetRoutes) {
317
408
  const key = `${route.method} ${route.path}`;
318
409
  const existing = routeMap.get(key);
@@ -328,14 +419,16 @@ function validatePresetCombination(presets) {
328
419
  }
329
420
  /**
330
421
  * Apply presets to resource config.
331
- * Validates preset combinations for conflicts before merging.
422
+ * Validates preset combinations for conflicts before merging. `controller` is
423
+ * what function-form `routes(permissions, controller)` receives; `defineResource`
424
+ * passes a handle bound to the resolved controller.
332
425
  */
333
- function applyPresets(config, presets = []) {
426
+ function applyPresets(config, presets = [], controller = createPresetControllerHandle(config.name).controller) {
334
427
  let result = { ...config };
335
428
  const resolved = presets.map(resolvePresetInput);
336
- const errors = validatePresetCombination(resolved).filter((c) => c.severity === "error");
429
+ const errors = validatePresetCombination(resolved, controller).filter((c) => c.severity === "error");
337
430
  if (errors.length > 0) throw new Error(`[Arc] Resource '${config.name}' preset conflicts:\n` + errors.map((c) => ` - ${c.message}`).join("\n"));
338
- for (const preset of resolved) result = mergePreset(result, preset);
431
+ for (const preset of resolved) result = mergePreset(result, preset, controller);
339
432
  return result;
340
433
  }
341
434
  /**
@@ -349,13 +442,29 @@ function resolvePresetInput(preset) {
349
442
  }
350
443
  return resolvePreset(preset);
351
444
  }
445
+ const PRESET_HANDLER_FIX = "Build the routes with `routes(permissions, controller)` and return `handler: controller.method` (a method read this way is verified at boot).";
446
+ /**
447
+ * Warn once about string dispatch on a preset route. The resource-level check runs on
448
+ * the caller's config before presets apply, so preset routes need their own. Arc's
449
+ * presets emit function handlers and never reach a branch here.
450
+ */
451
+ function warnDeprecatedPresetRoutes(presetName, resourceName, routes) {
452
+ for (const route of routes) {
453
+ const where = `(first seen on ${route.method} ${route.path} from preset '${presetName}' on resource '${resourceName}')`;
454
+ if (typeof route.handler === "string") warnDeprecated("A string `handler` on a preset route", `${PRESET_HANDLER_FIX} ${where}`);
455
+ if (route.controllerMethod !== void 0) warnDeprecated("`controllerMethod` on a preset route", `${PRESET_HANDLER_FIX} ${where}`);
456
+ if (typeof route.rawHandler === "string") warnDeprecated("A string `rawHandler` on a preset route", `Return the function itself: \`rawHandler: async (request, reply) => { ... }\`. ${where}`);
457
+ }
458
+ }
352
459
  /**
353
460
  * Merge preset into config
354
461
  */
355
- function mergePreset(config, preset) {
462
+ function mergePreset(config, preset, controller) {
356
463
  const result = { ...config };
357
464
  if (preset.routes) {
358
- const resolved = typeof preset.routes === "function" ? preset.routes(config.permissions ?? {}) : preset.routes;
465
+ notePresetSource(controller, preset.name);
466
+ const resolved = typeof preset.routes === "function" ? preset.routes(config.permissions ?? {}, controller) : preset.routes;
467
+ warnDeprecatedPresetRoutes(preset.name, config.name, resolved);
359
468
  result.routes = [...result.routes ?? [], ...resolved];
360
469
  }
361
470
  if (preset.middlewares) {
@@ -394,4 +503,4 @@ function mergePreset(config, preset) {
394
503
  }
395
504
  return result;
396
505
  }
397
- export { treePreset as a, ownedByUserPreset as c, registerPreset as i, bulkPreset as l, getAvailablePresets as n, softDeletePreset as o, getPreset as r, slugLookupPreset as s, applyPresets as t, auditedPreset as u };
506
+ export { treePreset as a, ownedByUserPreset as c, createPresetControllerHandle as d, registerPreset as i, bulkPreset as l, getAvailablePresets as n, softDeletePreset as o, getPreset as r, slugLookupPreset as s, applyPresets as t, auditedPreset as u };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { c as getOrgId, f as getScopeContextMap, g as getUserId, m as getTeamId, x as isMember } from "./types-CcpISJe8.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { c as getOrgId, f as getScopeContextMap, g as getUserId, m as getTeamId, x as isMember } from "./types-ZvdR7MVa.mjs";
3
3
  // src/scope/projection.ts
4
4
  /**
5
5
  * Compute the request-scope projection. Returns `undefined` when no
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/http-cache/purgers/purger.types.ts
3
3
  /** A purge the CDN refused or never answered: a closed code plus the provider's own codes, never a credential. */
4
4
  var CachePurgeError = class extends Error {
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-HTi8KV7V.mjs";
3
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-G9QXHov1.mjs";
4
- import { t as hasEvents } from "./typeGuards-eoQLIOh6.mjs";
5
- import { t as MemoryCacheStore } from "./memory-Dkp6ZD3F.mjs";
6
- import { i as versionKey, r as tagVersionKey } from "./keys-t7i-lJ2r.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 declareRuntimeCapability } from "./runtimeCapabilities-DY20Pibh.mjs";
4
+ import { t as hasEvents } from "./typeGuards-Cr2_zEW0.mjs";
5
+ import { t as MemoryCacheStore } from "./memory-Ay0haw9n.mjs";
6
+ import { i as versionKey, r as tagVersionKey } from "./keys-DwvXJwUX.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  // src/cache/QueryCache.ts
9
9
  const MISS = Object.freeze({
@@ -0,0 +1,138 @@
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { g as getUserId } from "./types-ZvdR7MVa.mjs";
3
+ import { isIPv6 } from "node:net";
4
+ // src/scope/rateLimitKey.ts
5
+ /**
6
+ * Per-Tenant Rate Limit Key Generator
7
+ *
8
+ * Two named strategies (plus a custom function):
9
+ *
10
+ * - `'user'` — the signed-in user's id (`user:<id>`) when the scope has one, otherwise the
11
+ * client IP (IPv6 grouped by /64). This is `createApp`'s DEFAULT key when `rateLimit` has
12
+ * no `keyGenerator` and no `plan`: one office Wi-Fi or carrier NAT never throttles many
13
+ * signed-in users together, while sign-in / sign-up / reset (no user yet) stay per IP.
14
+ * - `'organization'` — the default when `strategy` is omitted (unchanged since 2.x): one
15
+ * quota per organisation. Opt into it with
16
+ * `keyGenerator: createTenantKeyGenerator({ strategy: 'organization' })`.
17
+ *
18
+ * The `'organization'` chain:
19
+ * - member → organizationId (per-tenant isolation)
20
+ * - authenticated → userId (per-user)
21
+ * - service → organizationId (required on service scope)
22
+ * - elevated → organizationId ?? userId ?? IP
23
+ * - public → IP address (fallback)
24
+ *
25
+ * ## IP fallback caveat
26
+ *
27
+ * When no scope is present on the request (e.g. calls that hit the app
28
+ * before auth runs, such as `/api/auth/get-session` or pre-branch-selection
29
+ * lookups that can't supply an `x-organization-id` header) the generator
30
+ * falls back to the caller's IP. In a multi-user NAT / office / shared-VPN
31
+ * scenario **one browser can exhaust the shared IP bucket** for every
32
+ * other user behind that IP.
33
+ *
34
+ * Mitigations:
35
+ * 1. Exempt heartbeat / pre-auth paths from rate limiting via the
36
+ * top-level `rateLimit: { skipPaths: ['/api/auth/*'] }` option.
37
+ * 2. Supply a custom `strategy` to this generator that reads a session
38
+ * cookie or signed token and derives a per-user key earlier in the
39
+ * request lifecycle.
40
+ * 3. Tighten `trustProxy` so the fallback uses the real client IP, not
41
+ * a shared load-balancer IP.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * import { createTenantKeyGenerator } from '@classytic/arc/scope';
46
+ *
47
+ * const app = await createApp({
48
+ * rateLimit: {
49
+ * max: 100,
50
+ * timeWindow: '1 minute',
51
+ * keyGenerator: createTenantKeyGenerator(),
52
+ * skipPaths: ['/api/auth/*'], // heartbeat endpoints bypass the bucket
53
+ * },
54
+ * });
55
+ * ```
56
+ */
57
+ /**
58
+ * Marks a key generator as SCOPE-AWARE, so `buildRateLimitOpts` can place the rate-limit
59
+ * hook after authentication instead of before it.
60
+ *
61
+ * Without this, the degradation is invisible: `@fastify/rate-limit` runs at `onRequest`,
62
+ * arc authenticates in a `preHandler`, so a scope-keyed generator sees `PUBLIC_SCOPE`,
63
+ * returns the IP for every caller, and — behind a proxy — buckets an entire deployment
64
+ * together. Nothing throws; the limiter simply answers a question nobody asked.
65
+ *
66
+ * `Symbol.for` so the marker survives two copies of arc in one tree.
67
+ */
68
+ const SCOPE_AWARE_KEY_GENERATOR = Symbol.for("arc.rateLimit.scopeAwareKeyGenerator");
69
+ /** True when this generator needs a resolved scope (see the symbol's docblock). */
70
+ function isScopeAwareKeyGenerator(fn) {
71
+ return typeof fn === "function" && fn[SCOPE_AWARE_KEY_GENERATOR] === true;
72
+ }
73
+ function createTenantKeyGenerator(opts) {
74
+ const strategy = opts?.strategy;
75
+ const generator = typeof strategy === "function" ? strategy : strategy === "user" ? userStrategy : defaultTenantStrategy;
76
+ /**
77
+ * Wrapped rather than tagged in place: a host's `strategy` is its own function, and
78
+ * stamping a symbol onto it would mutate a value it may reuse elsewhere.
79
+ */
80
+ const tagged = (ctx) => generator(ctx);
81
+ Object.defineProperty(tagged, SCOPE_AWARE_KEY_GENERATOR, {
82
+ value: true,
83
+ enumerable: false
84
+ });
85
+ return tagged;
86
+ }
87
+ /**
88
+ * Per user when signed in, per IP when anonymous. The `user:` prefix keeps a user id from
89
+ * ever sharing a bucket with an address; the IP stays bare so an `allowList` of addresses
90
+ * still matches anonymous traffic.
91
+ */
92
+ function userStrategy(ctx) {
93
+ const userId = ctx.scope ? getUserId(ctx.scope) : void 0;
94
+ return userId ? `user:${userId}` : ipBucket(ctx.ip);
95
+ }
96
+ /**
97
+ * The address bucket for anonymous traffic. IPv6 is grouped by /64 (one subscriber's
98
+ * allocation, `@fastify/rate-limit`'s own default) so rotating addresses inside it does not
99
+ * mint fresh buckets; IPv4-mapped IPv6 collapses to the IPv4 address.
100
+ */
101
+ function ipBucket(ip) {
102
+ if (!isIPv6(ip)) return ip.toLowerCase();
103
+ const groups = expandIPv6(ip);
104
+ if (!groups) return ip.toLowerCase();
105
+ if (groups.slice(0, 5).every((g) => g === 0) && groups[5] === 65535) {
106
+ const hi = groups[6] ?? 0;
107
+ const lo = groups[7] ?? 0;
108
+ return `${hi >> 8}.${hi & 255}.${lo >> 8}.${lo & 255}`;
109
+ }
110
+ return `${groups.slice(0, 4).map((g) => g.toString(16)).join(":")}::/64`;
111
+ }
112
+ function expandIPv6(ip) {
113
+ let s = ip.split("%", 1)[0] ?? "";
114
+ const v4 = /(\d+)\.(\d+)\.(\d+)\.(\d+)$/.exec(s);
115
+ if (v4) {
116
+ const [a, b, c, d] = v4.slice(1).map(Number);
117
+ s = `${s.slice(0, v4.index)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
118
+ }
119
+ const [head = "", tail] = s.split("::");
120
+ const h = head ? head.split(":") : [];
121
+ const t = tail === void 0 ? void 0 : tail ? tail.split(":") : [];
122
+ const parts = t === void 0 ? h : [
123
+ ...h,
124
+ ...new Array(8 - h.length - t.length).fill("0"),
125
+ ...t
126
+ ];
127
+ if (parts.length !== 8) return void 0;
128
+ return parts.map((p) => Number.parseInt(p, 16));
129
+ }
130
+ function defaultTenantStrategy(ctx) {
131
+ const scope = ctx.scope;
132
+ if (!scope || scope.kind === "public") return ctx.ip;
133
+ if (scope.kind === "member") return scope.organizationId;
134
+ if (scope.kind === "service") return scope.organizationId;
135
+ if (scope.kind === "elevated") return scope.organizationId ?? scope.userId ?? ctx.ip;
136
+ return scope.userId ?? ctx.ip;
137
+ }
138
+ export { ipBucket as n, isScopeAwareKeyGenerator as r, createTenantKeyGenerator as t };
@@ -1,14 +1,14 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-HTi8KV7V.mjs";
3
- import { n as arcRouteValidatorCompiler } from "./routeValidator-DnQ2BGnH.mjs";
4
- import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-Btmaf1MB.mjs";
5
- import { t as arcLog } from "./logger-IL7Btm-N.mjs";
6
- import { n as evaluateAndApplyPermission } from "./authorizationDecision-Dxj_cy6N.mjs";
7
- import { t as applyFieldReadPermissions } from "./fields-C5J8WTd2.mjs";
8
- import { n as getUserRoles } from "./userHelpers-Cp5zqlEN.mjs";
9
- import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-D5dOqbbj.mjs";
10
- import { a as registerSseStats, r as openSseStream } from "./sseStream-hQxQjvre.mjs";
11
- import { a as promoteStreamTokenToHeader } from "./streaming-CQiOktsh.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 arcRouteValidatorCompiler } from "./routeValidator-Bn-x2gaJ.mjs";
4
+ import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-YuRYsOPr.mjs";
5
+ import { t as arcLog } from "./logger-DdMS0XC_.mjs";
6
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-gB5-bHDp.mjs";
7
+ import { t as applyFieldReadPermissions } from "./fields-B7fuROWK.mjs";
8
+ import { n as getUserRoles } from "./userHelpers-CwpEK36a.mjs";
9
+ import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-Qbl-11cE.mjs";
10
+ import { a as registerSseStats, r as openSseStream } from "./sseStream-BsBesrfw.mjs";
11
+ import { a as promoteStreamTokenToHeader } from "./streaming-DKziqs1Z.mjs";
12
12
  import { STREAM_FRAMES } from "@classytic/repo-core/sync";
13
13
  import fp from "fastify-plugin";
14
14
  // src/plugins/realtime.ts
@@ -1,6 +1,6 @@
1
1
 
2
- import "../fastify-augmentation-baQc3MaO.mjs";
3
- import { F as ResourceDefinition, G as CrudRouteKey, M as ResourceRegistry, N as RouteRow, S as IntrospectionPluginOptions, V as ResolvedTenantPurge, j as RegisterOptions, o as RegistryEntry } from "../index-DLCcLUQT.mjs";
2
+ import "../fastify-augmentation-DjxuSRG4.mjs";
3
+ import { F as ResourceDefinition, K as CrudRouteKey, M as ResourceRegistry, N as RouteRow, S as IntrospectionPluginOptions, V as ResolvedTenantPurge, j as RegisterOptions, o as RegistryEntry } from "../index-DtHACefu.mjs";
4
4
  import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
5
5
  import { FastifyPluginAsync } from "fastify";
6
6
  interface AssertNoTenantDataOptions {
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { a as getCascadingResources, i as cascadeDeleteForOrganization, n as buildResourceManifestFromRegistry, o as getCascadingResourcesWithMetadata, r as introspectionPlugin_default, s as assertNoTenantData, t as buildResourceManifest } from "../registry-DbQvODPH.mjs";
3
- import { t as ResourceRegistry } from "../ResourceRegistry-BelzCRMy.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { a as getCascadingResources, i as cascadeDeleteForOrganization, n as buildResourceManifestFromRegistry, o as getCascadingResourcesWithMetadata, r as introspectionPlugin_default, s as assertNoTenantData, t as buildResourceManifest } from "../registry-BQsdAlZ_.mjs";
3
+ import { t as ResourceRegistry } from "../ResourceRegistry-Ck7RFodL.mjs";
4
4
  export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "./constants-DH41jnNT.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "./constants-D9EiaO5s.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  // src/registry/assertNoTenantData.ts
5
5
  /**
@@ -1,8 +1,9 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { t as arcLog } from "./logger-IL7Btm-N.mjs";
3
- import { n as evictToSize, r as touch } from "./boundedMap-DOBai-H3.mjs";
4
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-DfqfssAw.mjs";
5
- import { t as claimedAttempts } from "./claimed-DJPk4VZr.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as arcLog } from "./logger-DdMS0XC_.mjs";
3
+ import { n as warnDeprecated } from "./deprecation-DX625dth.mjs";
4
+ import { n as evictToSize, r as touch } from "./boundedMap-Ddw2yGb2.mjs";
5
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-D1yIVa91.mjs";
6
+ import { t as claimedAttempts } from "./claimed-CM_-lFHX.mjs";
6
7
  import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
7
8
  import { InvalidOutboxEventError, OutboxConflictError, OutboxOwnershipError, outboxPayloadFingerprint } from "@classytic/primitives/outbox";
8
9
  import { update } from "@classytic/repo-core/update";
@@ -529,16 +530,14 @@ var EventOutbox = class {
529
530
  } catch {}
530
531
  }
531
532
  /**
532
- * Relay pending events to transport and return the number of successful
533
- * publish+acknowledge pairs.
533
+ * Relay pending events and return the count of published AND acknowledged events.
534
534
  *
535
- * For richer observability (per-kind counts, publishMany detection, etc.)
536
- * use {@link relayBatch} which returns a {@link RelayResult}. This method
537
- * is the backward-compatible shortcut that returns just the count.
538
- *
539
- * @returns Number of successfully published AND acknowledged events
535
+ * @deprecated Use `(await outbox.relayBatch()).relayed` — {@link relayBatch}
536
+ * returns the full {@link RelayResult}. Warns once per process; removed in the
537
+ * next minor.
540
538
  */
541
539
  async relay() {
540
+ warnDeprecated("`EventOutbox.relay()`", "Use `(await outbox.relayBatch()).relayed`.");
542
541
  return (await this.relayBatch()).relayed;
543
542
  }
544
543
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
2
  // src/lock/renewingLease.ts
3
3
  /**
4
4
  * Start renewing an ALREADY-ACQUIRED lease. The caller performed the
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-HTi8KV7V.mjs";
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
3
3
  import { toCanonicalList } from "@classytic/repo-core/pagination";
4
4
  import fp from "fastify-plugin";
5
5
  // src/plugins/replyHelpers.ts
@@ -1,4 +1,5 @@
1
- /*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
2
+ import { n as warnDeprecated } from "./deprecation-DX625dth.mjs";
2
3
  import { AsyncLocalStorage } from "node:async_hooks";
3
4
  // src/context/requestContext.ts
4
5
  /**
@@ -36,7 +37,7 @@ const storage = new AsyncLocalStorage();
36
37
  *
37
38
  * - `get()` — returns current store or undefined if outside request scope
38
39
  * - `run(store, fn)` — run a function with a specific store (used by Arc internals)
39
- * - `getStore()` — alias for get() (matches Node.js API naming)
40
+ * - `getStore()` — deprecated alias for get()
40
41
  */
41
42
  const requestContext = {
42
43
  /**
@@ -47,9 +48,13 @@ const requestContext = {
47
48
  return storage.getStore();
48
49
  },
49
50
  /**
50
- * Alias for get() — matches Node.js AsyncLocalStorage API naming.
51
+ * Alias for get().
52
+ *
53
+ * @deprecated Use `requestContext.get()`. Warns once per process; removed
54
+ * in the next minor.
51
55
  */
52
56
  getStore() {
57
+ warnDeprecated("`requestContext.getStore()`", "Use `requestContext.get()`.");
53
58
  return storage.getStore();
54
59
  },
55
60
  /**