@classytic/arc 2.37.1 → 2.40.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 (183) hide show
  1. package/dist/{BaseController-Chkf0Aiw.mjs → BaseController-BqJtbiUA.mjs} +107 -23
  2. package/dist/{EventTransport-BEVP50ka.d.mts → EventTransport-BPOQsEer.d.mts} +45 -0
  3. package/dist/{EventTransport-CFdtK25P.mjs → EventTransport-BUkTwY_x.mjs} +51 -8
  4. package/dist/{HookSystem-Csy31WS-.mjs → HookSystem-96nzZLmk.mjs} +2 -2
  5. package/dist/{ResourceRegistry-OQA13slI.mjs → ResourceRegistry-B9WnuG2Q.mjs} +2 -2
  6. package/dist/{actionPermissions-DGGqqSIV.mjs → actionPermissions-4OGbe3Hf.mjs} +6 -6
  7. package/dist/audit/index.d.mts +1 -1
  8. package/dist/audit/index.mjs +2 -2
  9. package/dist/auth/audit.mjs +1 -1
  10. package/dist/auth/index.d.mts +1 -1
  11. package/dist/auth/index.mjs +6 -6
  12. package/dist/auth/redis-session.mjs +1 -1
  13. package/dist/{authorizationDecision-BzZi2bsf.mjs → authorizationDecision-D_LFvMlm.mjs} +2 -2
  14. package/dist/{buildHandler-CIz0NsGS.mjs → buildHandler-BG_CHXqQ.mjs} +4 -4
  15. package/dist/cache/index.mjs +4 -4
  16. package/dist/{caching-DldVgnC9.mjs → caching-Bqcn3Brl.mjs} +2 -2
  17. package/dist/cleanup/index.d.mts +2 -2
  18. package/dist/cleanup/index.mjs +21 -5
  19. package/dist/cli/commands/describe.d.mts +1 -1
  20. package/dist/cli/commands/describe.mjs +3 -3
  21. package/dist/cli/commands/docs.mjs +3 -3
  22. package/dist/cli/commands/doctor.mjs +1 -1
  23. package/dist/cli/commands/generate.mjs +2 -2
  24. package/dist/cli/commands/init.mjs +2 -2
  25. package/dist/cli/commands/introspect.mjs +2 -2
  26. package/dist/cli/index.mjs +3 -3
  27. package/dist/{constants-DDKf25s4.mjs → constants-BQ2FbhPB.mjs} +1 -1
  28. package/dist/context/index.d.mts +34 -6
  29. package/dist/context/index.mjs +12 -19
  30. package/dist/core/index.d.mts +2 -2
  31. package/dist/core/index.mjs +7 -7
  32. package/dist/{core-uHQonaHf.mjs → core-CsZR037F.mjs} +3 -3
  33. package/dist/{createActionRouter-C22Xn11N.mjs → createActionRouter-BR93gCKg.mjs} +7 -7
  34. package/dist/{createAggregationRouter-DgyksLHH.mjs → createAggregationRouter-CF40Aw95.mjs} +7 -7
  35. package/dist/createMcpServer-BVTs2S5G.d.mts +48 -0
  36. package/dist/{defineAggregation-B1m-45Fe.mjs → defineAggregation-BDA2Tw7v.mjs} +1 -1
  37. package/dist/{defineResource-DS3Uj2-8.mjs → defineResource-DaIySrQr.mjs} +20 -22
  38. package/dist/discovery/index.mjs +1 -1
  39. package/dist/docs/index.d.mts +1 -1
  40. package/dist/docs/index.mjs +3 -3
  41. package/dist/{elevation-9X0lGzTQ.mjs → elevation-CZy6n50b.mjs} +4 -4
  42. package/dist/encryption/index.mjs +3 -3
  43. package/dist/{errorHandler-DI5AN2b5.d.mts → errorHandler--4rSMMvq.d.mts} +7 -1
  44. package/dist/{errorHandler-BmEGKyO9.mjs → errorHandler-By9keRvX.mjs} +3 -3
  45. package/dist/{errors-CbxCF9M0.mjs → errors-BHD3L8of.mjs} +1 -1
  46. package/dist/{eventPlugin-B1ahehZH.mjs → eventPlugin-DB26V7uX.mjs} +6 -6
  47. package/dist/{eventPlugin-B47sfCJ8.d.mts → eventPlugin-DfHaKEWQ.d.mts} +10 -1
  48. package/dist/events/index.d.mts +4 -4
  49. package/dist/events/index.mjs +5 -5
  50. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  51. package/dist/events/transports/redis-stream-entry.mjs +21 -20
  52. package/dist/events/transports/redis.d.mts +1 -1
  53. package/dist/events/transports/redis.mjs +11 -8
  54. package/dist/factory/index.d.mts +4 -4
  55. package/dist/factory/index.mjs +5 -5
  56. package/dist/{fastify-augmentation-CRsNNhuo.d.mts → fastify-augmentation-HncZMmze.d.mts} +3 -3
  57. package/dist/{fields-f_MdWDl_.mjs → fields-fA-Dkou5.mjs} +37 -2
  58. package/dist/{generate-DxWn-XnM.mjs → generate-BSSdtiOy.mjs} +4 -3
  59. package/dist/{headers-DivLPMHe.mjs → headers-BFEEshDS.mjs} +2 -2
  60. package/dist/{health-W_BjgWf0.mjs → health-BlGHjkqZ.mjs} +1 -1
  61. package/dist/hooks/index.d.mts +1 -1
  62. package/dist/hooks/index.mjs +2 -2
  63. package/dist/idempotency/index.mjs +4 -4
  64. package/dist/idempotency/redis.mjs +1 -1
  65. package/dist/{index-BqRfP1kT.d.mts → index-D3sIPcD4.d.mts} +47 -11
  66. package/dist/{index-DCxxRwLC.d.mts → index-DbMglURO.d.mts} +2 -2
  67. package/dist/{index-CEmPspAB.d.mts → index-SCsOJxWB.d.mts} +2 -2
  68. package/dist/index.d.mts +3 -3
  69. package/dist/index.mjs +11 -11
  70. package/dist/{init-BJ6fdYnp.mjs → init-pl88PHzb.mjs} +9 -9
  71. package/dist/integrations/event-gateway.d.mts +1 -1
  72. package/dist/integrations/event-gateway.mjs +2 -2
  73. package/dist/integrations/index.d.mts +1 -1
  74. package/dist/integrations/index.mjs +1 -1
  75. package/dist/integrations/jobs/index.mjs +2 -2
  76. package/dist/integrations/mcp/index.d.mts +3 -46
  77. package/dist/integrations/mcp/index.mjs +2 -2
  78. package/dist/integrations/mcp/testing.d.mts +22 -2
  79. package/dist/integrations/mcp/testing.mjs +55 -33
  80. package/dist/integrations/streamline.mjs +3 -3
  81. package/dist/integrations/webhooks.d.mts +2 -2
  82. package/dist/integrations/webhooks.mjs +3 -3
  83. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  84. package/dist/integrations/websocket-redis.mjs +1 -1
  85. package/dist/integrations/websocket.mjs +13 -6
  86. package/dist/{interface-DeLndJ8G.mjs → interface-DjtFnZxH.mjs} +1 -1
  87. package/dist/{jsonBody-kApktjTc.mjs → jsonBody-Dx6jH_Nb.mjs} +2 -2
  88. package/dist/{keys-B1MgfDWi.mjs → keys-Ds3ekBiu.mjs} +1 -1
  89. package/dist/{loadResources-ma-Aaxp1.mjs → loadResources-E5UFlRrT.mjs} +2 -2
  90. package/dist/{loadResourcesFromEntry-xszlyXTs.mjs → loadResourcesFromEntry-C2jrJbWG.mjs} +2 -2
  91. package/dist/logger/index.mjs +1 -1
  92. package/dist/{mcpPlugin-97HuFA46.mjs → mcpPlugin-D-3OLxNz.mjs} +75 -31
  93. package/dist/{memory-DvASzOn3.mjs → memory-CNvjxzB2.mjs} +2 -2
  94. package/dist/{metrics-Dx-nkDE5.mjs → metrics-P37sNV5H.mjs} +2 -2
  95. package/dist/middleware/index.d.mts +1 -1
  96. package/dist/middleware/index.mjs +3 -3
  97. package/dist/migrations/index.mjs +2 -2
  98. package/dist/{module-CNKk_twm.mjs → module-CNcwCKUJ.mjs} +1 -1
  99. package/dist/{multipartBody-TDaYOHGZ.mjs → multipartBody-Bl_gU3Wg.mjs} +1 -1
  100. package/dist/{openapi-473gZ-8x.mjs → openapi-BYrL8zvY.mjs} +6 -6
  101. package/dist/outbox-admin/index.d.mts +1 -1
  102. package/dist/outbox-admin/index.mjs +4 -4
  103. package/dist/{outbox-module-DOAmyXOb.mjs → outbox-module-6DMC_WNu.mjs} +40 -21
  104. package/dist/{outbox-module-BbdaMyqy.d.mts → outbox-module-CzsKRBvO.d.mts} +11 -2
  105. package/dist/permissions/index.mjs +5 -5
  106. package/dist/{permissions-DnAc6zoZ.mjs → permissions-C0GpDsB_.mjs} +6 -6
  107. package/dist/{pipe-BoV-z4db.mjs → pipe-4_XamfxI.mjs} +2 -2
  108. package/dist/pipeline/index.d.mts +1 -1
  109. package/dist/pipeline/index.mjs +2 -2
  110. package/dist/plugins/index.d.mts +5 -5
  111. package/dist/plugins/index.mjs +17 -16
  112. package/dist/plugins/response-cache.mjs +2 -2
  113. package/dist/plugins/tracing-entry.mjs +2 -2
  114. package/dist/{pluralize-BiU5ocWw.mjs → pluralize-BaQ62hOW.mjs} +1 -1
  115. package/dist/{preloadResources-DJ7Lli0a.mjs → preloadResources-BAx5s9EF.mjs} +70 -21
  116. package/dist/{preloadResources-DHkyk3QN.d.mts → preloadResources-DVgPCNcD.d.mts} +7 -7
  117. package/dist/presets/filesUpload.d.mts +1 -1
  118. package/dist/presets/filesUpload.mjs +5 -5
  119. package/dist/presets/index.d.mts +1 -1
  120. package/dist/presets/index.mjs +2 -2
  121. package/dist/presets/multiTenant.d.mts +1 -1
  122. package/dist/presets/multiTenant.mjs +3 -3
  123. package/dist/presets/search.d.mts +1 -1
  124. package/dist/presets/search.mjs +2 -2
  125. package/dist/{presets-BMxH-Bb7.mjs → presets-CAaqVVcW.mjs} +4 -4
  126. package/dist/{projection-CRCM5S9T.mjs → projection-qbCOEvsh.mjs} +2 -2
  127. package/dist/{queryCachePlugin-Cl3zLG7g.mjs → queryCachePlugin-2Pp9w-8D.mjs} +5 -5
  128. package/dist/rateLimitKey-umrS6-vu.mjs +41 -0
  129. package/dist/{realtime-BWuHi-UI.mjs → realtime-zzoNLDtj.mjs} +9 -9
  130. package/dist/{redis-stream-mwLWlfHG.d.mts → redis-stream-DSsPyYzd.d.mts} +7 -2
  131. package/dist/{registerRoute-mvm6zY2H.mjs → registerRoute-_6zHiz0x.mjs} +10 -6
  132. package/dist/registry/index.d.mts +2 -2
  133. package/dist/registry/index.mjs +3 -3
  134. package/dist/{registry-3maEt__c.mjs → registry-CEpoRpLP.mjs} +2 -2
  135. package/dist/{renewingLease-C1-GAUpr.mjs → renewingLease-B5Grm0pI.mjs} +1 -1
  136. package/dist/{replyHelpers-DVcUoled.mjs → replyHelpers-9h-a592u.mjs} +2 -2
  137. package/dist/{requestContext-KzIdSmN2.mjs → requestContext-D4PuGhEw.mjs} +1 -1
  138. package/dist/{rolldown-runtime-NVzJrC-o.mjs → rolldown-runtime-DzE6ikSH.mjs} +1 -1
  139. package/dist/{runtimeCapabilities-OrGatf7r.mjs → runtimeCapabilities-Bo7rSKjm.mjs} +1 -1
  140. package/dist/{schedules-DeRI03eo.mjs → schedules-Dm21pqHU.mjs} +8 -4
  141. package/dist/{schemaConverter-cXTayNOW.mjs → schemaConverter-DENbixyA.mjs} +1 -1
  142. package/dist/{schemaIR-Cc9ZPVs2.mjs → schemaIR-C2qUNzC6.mjs} +2 -2
  143. package/dist/schemas/index.mjs +1 -1
  144. package/dist/scim/index.mjs +2 -2
  145. package/dist/scope/index.mjs +5 -5
  146. package/dist/{scope-C2r7_WGs.mjs → scope-CdYxQVxt.mjs} +4 -4
  147. package/dist/{simpleEqualityMatcher-Cr1F8jKZ.mjs → simpleEqualityMatcher-Cldubvul.mjs} +1 -1
  148. package/dist/{sse-BmZCVRGH.mjs → sse-DbyXoQun.mjs} +5 -5
  149. package/dist/{sseStream-nNPqvOeK.mjs → sseStream-BfZtL5-m.mjs} +2 -2
  150. package/dist/{store-helpers-C1r3-6M0.mjs → store-helpers-BfyOd5i6.mjs} +1 -1
  151. package/dist/{streaming-BxZDlH01.mjs → streaming-CFwCzEvU.mjs} +1 -1
  152. package/dist/{subscribe-helpers-Dca7Fcz2.mjs → subscribe-helpers-KgVEcn8L.mjs} +2 -2
  153. package/dist/sync/changelog.mjs +1 -1
  154. package/dist/testing/cleanupStoreContract.mjs +1 -1
  155. package/dist/testing/index.d.mts +4 -4
  156. package/dist/testing/index.mjs +10 -10
  157. package/dist/testing/outboxStoreContract.mjs +14 -3
  158. package/dist/testing/storageContract.mjs +1 -1
  159. package/dist/{transactionContext-6F7Gkbxg.mjs → transactionContext-46KyUADP.mjs} +1 -1
  160. package/dist/{typeGuards-BrXgbFi-.mjs → typeGuards-t_CVgRXN.mjs} +1 -1
  161. package/dist/types/index.d.mts +1 -1
  162. package/dist/types/index.mjs +1 -1
  163. package/dist/types/storage.mjs +1 -1
  164. package/dist/{types-rzNprqbE.d.mts → types-9rvxn5Ym.d.mts} +46 -1
  165. package/dist/{types-BMa2EPtv.d.mts → types-BVlowlm7.d.mts} +2 -2
  166. package/dist/{types-khJmBErP.mjs → types-CNQyOrLk.mjs} +4 -4
  167. package/dist/usage/index.mjs +0 -0
  168. package/dist/{userHelpers-Bi97zMEl.mjs → userHelpers-DLueLQdQ.mjs} +1 -1
  169. package/dist/utils/index.d.mts +4 -4
  170. package/dist/utils/index.mjs +11 -11
  171. package/dist/{utils-WlLDIKuw.mjs → utils-CUFBrhq-.mjs} +14 -6
  172. package/dist/{validate-pMke_boy.mjs → validate-DV3hRbsz.mjs} +2 -2
  173. package/dist/{versioning-CFK3c04-.mjs → versioning-BXwmj5SD.mjs} +3 -3
  174. package/dist/{versioning-DEs-_hFi.d.mts → versioning-P3V6ATyC.d.mts} +1 -1
  175. package/dist/workScope-CoGpuzDX.mjs +42 -0
  176. package/package.json +48 -39
  177. package/skills/arc/references/mcp.md +20 -0
  178. package/skills/arc/references/testing.md +0 -12
  179. package/skills/arc-code-review/references/anti-patterns.md +1 -1
  180. package/skills/arc-code-review/references/migration-recipes.md +0 -60
  181. package/skills/arc-code-review/references/mongokit-migration.md +0 -27
  182. package/skills/arc-module-publishing/references/package-manifest.md +3 -1
  183. package/dist/rateLimitKey-D4_rjP1K.mjs +0 -15
@@ -0,0 +1,41 @@
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ //#region src/scope/rateLimitKey.ts
3
+ /**
4
+ * Marks a key generator as SCOPE-AWARE, so `buildRateLimitOpts` can place the rate-limit
5
+ * hook after authentication instead of before it.
6
+ *
7
+ * Without this, the degradation is invisible: `@fastify/rate-limit` runs at `onRequest`,
8
+ * arc authenticates in a `preHandler`, so a scope-keyed generator sees `PUBLIC_SCOPE`,
9
+ * returns the IP for every caller, and — behind a proxy — buckets an entire deployment
10
+ * together. Nothing throws; the limiter simply answers a question nobody asked.
11
+ *
12
+ * `Symbol.for` so the marker survives two copies of arc in one tree.
13
+ */
14
+ const SCOPE_AWARE_KEY_GENERATOR = Symbol.for("arc.rateLimit.scopeAwareKeyGenerator");
15
+ /** True when this generator needs a resolved scope (see the symbol's docblock). */
16
+ function isScopeAwareKeyGenerator(fn) {
17
+ return typeof fn === "function" && fn[SCOPE_AWARE_KEY_GENERATOR] === true;
18
+ }
19
+ function createTenantKeyGenerator(opts) {
20
+ const generator = opts?.strategy ?? defaultTenantStrategy;
21
+ /**
22
+ * Wrapped rather than tagged in place: a host's `strategy` is its own function, and
23
+ * stamping a symbol onto it would mutate a value it may reuse elsewhere.
24
+ */
25
+ const tagged = (ctx) => generator(ctx);
26
+ Object.defineProperty(tagged, SCOPE_AWARE_KEY_GENERATOR, {
27
+ value: true,
28
+ enumerable: false
29
+ });
30
+ return tagged;
31
+ }
32
+ function defaultTenantStrategy(ctx) {
33
+ const scope = ctx.scope;
34
+ if (!scope || scope.kind === "public") return ctx.ip;
35
+ if (scope.kind === "member") return scope.organizationId;
36
+ if (scope.kind === "service") return scope.organizationId;
37
+ if (scope.kind === "elevated") return scope.organizationId ?? scope.userId ?? ctx.ip;
38
+ return scope.userId ?? ctx.ip;
39
+ }
40
+ //#endregion
41
+ export { isScopeAwareKeyGenerator as n, createTenantKeyGenerator as t };
@@ -1,13 +1,13 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-NVzJrC-o.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
3
  import { arcLog } from "./logger/index.mjs";
4
- import { n as evaluateAndApplyPermission } from "./authorizationDecision-BzZi2bsf.mjs";
5
- import { n as getUserRoles } from "./userHelpers-Bi97zMEl.mjs";
6
- import { c as getOrgId } from "./types-khJmBErP.mjs";
7
- import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-Cr1F8jKZ.mjs";
8
- import { t as applyFieldReadPermissions } from "./fields-f_MdWDl_.mjs";
9
- import { a as promoteStreamTokenToHeader } from "./streaming-BxZDlH01.mjs";
10
- import { t as openSseStream } from "./sseStream-nNPqvOeK.mjs";
4
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-D_LFvMlm.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
6
+ import { c as getOrgId } from "./types-CNQyOrLk.mjs";
7
+ import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-Cldubvul.mjs";
8
+ import { t as applyFieldReadPermissions } from "./fields-fA-Dkou5.mjs";
9
+ import { a as promoteStreamTokenToHeader } from "./streaming-CFwCzEvU.mjs";
10
+ import { t as openSseStream } from "./sseStream-BfZtL5-m.mjs";
11
11
  import fp from "fastify-plugin";
12
12
  //#region src/plugins/realtime.ts
13
13
  var realtime_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-BEVP50ka.mjs";
2
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-BPOQsEer.mjs";
3
3
  //#region src/events/transports/redis-stream.d.ts
4
4
  interface RedisStreamLike {
5
5
  xadd(key: string, id: string, ...fieldValues: string[]): Promise<string | null>;
@@ -232,8 +232,13 @@ declare class RedisStreamTransport implements EventTransport {
232
232
  private processEntries;
233
233
  private claimPending;
234
234
  private processEntry;
235
+ /**
236
+ * The canonical matcher from primitives — the SAME glob rules the memory
237
+ * transport speaks. A private matcher here once accepted `prefix.*` but not
238
+ * `prefix:*`, so an `order:*` subscription that worked in-process received
239
+ * nothing after a move to the stream, with no error.
240
+ */
235
241
  private getMatchingHandlers;
236
- private matchesPattern;
237
242
  private moveToDlq;
238
243
  /**
239
244
  * Reconstruct a `DeadLetteredEvent` for a message id. Reads the original
@@ -1,8 +1,9 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { n as evaluateAndApplyPermission } from "./authorizationDecision-BzZi2bsf.mjs";
3
- import { f as createError } from "./errors-CbxCF9M0.mjs";
4
- import { u as getRequestScope } from "./types-khJmBErP.mjs";
5
- import { n as requestContext } from "./requestContext-KzIdSmN2.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-D_LFvMlm.mjs";
3
+ import { f as createError } from "./errors-BHD3L8of.mjs";
4
+ import { u as getRequestScope } from "./types-CNQyOrLk.mjs";
5
+ import { r as deriveHiddenFieldPermissions } from "./fields-fA-Dkou5.mjs";
6
+ import { n as requestContext } from "./requestContext-D4PuGhEw.mjs";
6
7
  //#region src/core/middlewares/arcDecorator.ts
7
8
  /**
8
9
  * Build the `arcDecorator` preHandler for a resource.
@@ -18,7 +19,10 @@ import { n as requestContext } from "./requestContext-KzIdSmN2.mjs";
18
19
  * formatters).
19
20
  */
20
21
  function buildArcDecorator(meta) {
21
- const frozen = Object.freeze({ ...meta });
22
+ const frozen = Object.freeze({
23
+ ...meta,
24
+ fields: deriveHiddenFieldPermissions(meta.schemaOptions, meta.fields)
25
+ });
22
26
  return async (req, _reply) => {
23
27
  req.arc = frozen;
24
28
  const store = requestContext.get();
@@ -1,6 +1,6 @@
1
1
 
2
- import { K as ResolvedTenantPurge, R as RegisterOptions, V as ResourceDefinition, X as CrudRouteKey, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-BqRfP1kT.mjs";
3
- import "../fastify-augmentation-CRsNNhuo.mjs";
2
+ import { K as ResolvedTenantPurge, R as RegisterOptions, V as ResourceDefinition, X as CrudRouteKey, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-D3sIPcD4.mjs";
3
+ import "../fastify-augmentation-HncZMmze.mjs";
4
4
  import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
5
5
  import { FastifyPluginAsync } from "fastify";
6
6
  //#region src/registry/assertNoTenantData.d.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-3maEt__c.mjs";
3
- import { t as ResourceRegistry } from "../ResourceRegistry-OQA13slI.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-CEpoRpLP.mjs";
3
+ import { t as ResourceRegistry } from "../ResourceRegistry-B9WnuG2Q.mjs";
4
4
  export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "./constants-DDKf25s4.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "./constants-BQ2FbhPB.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/registry/assertNoTenantData.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region 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.37.1 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-NVzJrC-o.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
3
  import { toCanonicalList } from "@classytic/repo-core/pagination";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/plugins/replyHelpers.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context/requestContext.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import "node:module";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/runtimeCapabilities.ts
3
3
  /**
4
4
  * `Symbol.for` so declarations from two arc copies in one dependency graph
@@ -1,6 +1,7 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-NVzJrC-o.mjs";
3
- import { t as startRenewingLease } from "./renewingLease-C1-GAUpr.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
+ import { t as runWorkScope } from "./workScope-CoGpuzDX.mjs";
4
+ import { t as startRenewingLease } from "./renewingLease-B5Grm0pI.mjs";
4
5
  import fp from "fastify-plugin";
5
6
  //#region src/plugins/schedules.ts
6
7
  var schedules_exports = /* @__PURE__ */ __exportAll({
@@ -60,7 +61,10 @@ const schedulesPlugin = async (fastify, opts) => {
60
61
  }
61
62
  stat.runs++;
62
63
  stat.lastRunAt = (/* @__PURE__ */ new Date()).toISOString();
63
- await s.handler(fastify);
64
+ await runWorkScope({
65
+ kind: "job",
66
+ id: s.name
67
+ }, () => s.handler(fastify));
64
68
  stat.lastError = null;
65
69
  } catch (err) {
66
70
  stat.failures++;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  //#region src/utils/schemaConverter.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { o as toJsonSchema } from "./schemaConverter-cXTayNOW.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { o as toJsonSchema } from "./schemaConverter-DENbixyA.mjs";
3
3
  //#region src/core/schemaIR.ts
4
4
  /**
5
5
  * Schema IR — one canonical representation, two adapters.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
3
3
  import { Type, Type as Type$1 } from "typebox";
4
4
  //#region src/schemas/index.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as parseJsonBody } from "../jsonBody-kApktjTc.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as parseJsonBody } from "../jsonBody-Dx6jH_Nb.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/scim/errors.ts
5
5
  var ScimError = class extends Error {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-khJmBErP.mjs";
3
- import { n as elevation_default, t as elevationPlugin } from "../elevation-9X0lGzTQ.mjs";
4
- import { t as createTenantKeyGenerator } from "../rateLimitKey-D4_rjP1K.mjs";
5
- import { t as resolveOrgFromHeader } from "../scope-C2r7_WGs.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-CNQyOrLk.mjs";
3
+ import { n as elevation_default, t as elevationPlugin } from "../elevation-CZy6n50b.mjs";
4
+ import { t as createTenantKeyGenerator } from "../rateLimitKey-umrS6-vu.mjs";
5
+ import { t as resolveOrgFromHeader } from "../scope-CdYxQVxt.mjs";
6
6
  export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-CbxCF9M0.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-DivLPMHe.mjs";
4
- import { n as getUserRoles } from "./userHelpers-Bi97zMEl.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-BHD3L8of.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
4
+ import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
5
5
  //#region src/scope/resolveOrgFromHeader.ts
6
6
  /**
7
7
  * Create a preHandler hook that resolves org scope from a header.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/simpleEqualityMatcher.ts
3
3
  /**
4
4
  * `simpleEqualityMatcher` — a minimal, dialect-agnostic flat-key equality
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-NVzJrC-o.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
3
  import { arcLog } from "./logger/index.mjs";
4
- import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-khJmBErP.mjs";
5
- import { a as promoteStreamTokenToHeader } from "./streaming-BxZDlH01.mjs";
6
- import { t as openSseStream } from "./sseStream-nNPqvOeK.mjs";
4
+ import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-CNQyOrLk.mjs";
5
+ import { a as promoteStreamTokenToHeader } from "./streaming-CFwCzEvU.mjs";
6
+ import { t as openSseStream } from "./sseStream-BfZtL5-m.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  //#region src/plugins/sse.ts
9
9
  var sse_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { n as forwardedStreamHeaders } from "./streaming-BxZDlH01.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as forwardedStreamHeaders } from "./streaming-CFwCzEvU.mjs";
3
3
  //#region src/utils/sseStream.ts
4
4
  /**
5
5
  * Take over the reply socket and open an SSE stream. Call ONLY after every
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/store-helpers.ts
3
3
  /**
4
4
  * Classify an error thrown by `getOne` / `getById` / `update` as a
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { Readable } from "node:stream";
3
3
  //#region src/utils/streaming.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { r as createEvent } from "./EventTransport-CFdtK25P.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { r as createEvent } from "./EventTransport-BUkTwY_x.mjs";
3
3
  //#region src/events/defineEvent.ts
4
4
  /**
5
5
  * Typed event declarations, a registry for introspection, and `.create()` to
@@ -1,3 +1,3 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { CursorExpiredError, MemoryChangeLogStore } from "@classytic/repo-core/sync";
3
3
  export { CursorExpiredError, MemoryChangeLogStore };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/cleanupStoreContract.ts
4
4
  /**
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { i as RequestScope } from "../types-Ddl9OjmE.mjs";
3
3
  import { l as PermissionCheck, t as AnyRecord } from "../base-C-NL2fTi.mjs";
4
- import { V as ResourceDefinition } from "../index-BqRfP1kT.mjs";
5
- import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BMa2EPtv.mjs";
6
- import "../index-DCxxRwLC.mjs";
7
- import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-DHkyk3QN.mjs";
4
+ import { V as ResourceDefinition } from "../index-D3sIPcD4.mjs";
5
+ import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BVlowlm7.mjs";
6
+ import "../index-DbMglURO.mjs";
7
+ import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-DVgPCNcD.mjs";
8
8
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
9
9
  import { StandardRepo } from "@classytic/repo-core/repository";
10
10
  import { FastifyInstance, FastifyServerOptions } from "fastify";
@@ -1,12 +1,12 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-DDKf25s4.mjs";
3
- import { g as getUserId } from "../types-khJmBErP.mjs";
4
- import { t as BaseController } from "../BaseController-Chkf0Aiw.mjs";
5
- import { t as defineAggregation } from "../defineAggregation-B1m-45Fe.mjs";
6
- import { t as defineResource } from "../defineResource-DS3Uj2-8.mjs";
7
- import { E as requireOrgRole } from "../permissions-DnAc6zoZ.mjs";
8
- import { a as createApp, n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-DJ7Lli0a.mjs";
9
- import { n as getModuleExports } from "../module-CNKk_twm.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-BQ2FbhPB.mjs";
3
+ import { g as getUserId } from "../types-CNQyOrLk.mjs";
4
+ import { t as BaseController } from "../BaseController-BqJtbiUA.mjs";
5
+ import { t as defineAggregation } from "../defineAggregation-BDA2Tw7v.mjs";
6
+ import { t as defineResource } from "../defineResource-DaIySrQr.mjs";
7
+ import { E as requireOrgRole } from "../permissions-C0GpDsB_.mjs";
8
+ import { a as createApp, n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-BAx5s9EF.mjs";
9
+ import { n as getModuleExports } from "../module-CNcwCKUJ.mjs";
10
10
  import { runStorageContract } from "./storageContract.mjs";
11
11
  import Fastify from "fastify";
12
12
  import { afterAll, describe, expect, it, vi } from "vitest";
@@ -1504,7 +1504,7 @@ function pickDefaultAuth(authMode, callerAuth) {
1504
1504
  };
1505
1505
  }
1506
1506
  async function createTestApp(options = {}) {
1507
- const { createApp } = await import("../preloadResources-DJ7Lli0a.mjs").then((n) => n.o);
1507
+ const { createApp } = await import("../preloadResources-BAx5s9EF.mjs").then((n) => n.o);
1508
1508
  const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
1509
1509
  let dbHandle;
1510
1510
  let dbUri;
@@ -1,9 +1,20 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { OutboxOwnershipError } from "@classytic/primitives/outbox";
3
3
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
4
4
  //#region src/testing/outboxStoreContract.ts
5
5
  let seq = 0;
6
- /** A minimal well-formed event. Ids are unique per call. */
6
+ /**
7
+ * A minimal well-formed event. Ids are unique per call.
8
+ *
9
+ * It was NOT well-formed until 2.40: `meta` carried `occurredAt: string`, which
10
+ * is not a field of `EventMeta`, and omitted the REQUIRED `timestamp: Date`.
11
+ * An `as unknown as DomainEvent` made it compile — a total override that hid the
12
+ * mismatch, so every third party running this shipped suite conformance-tested
13
+ * their store against an event shape the transports never produce. `createEvent`
14
+ * in `@classytic/primitives` is the reference: `{ id, timestamp: new Date() }`.
15
+ *
16
+ * No cast now — if `EventMeta` changes, this stops compiling, which is the point.
17
+ */
7
18
  function event(type = "test.event") {
8
19
  seq += 1;
9
20
  return {
@@ -11,7 +22,7 @@ function event(type = "test.event") {
11
22
  payload: { n: seq },
12
23
  meta: {
13
24
  id: `evt-${Date.now()}-${seq}`,
14
- occurredAt: (/* @__PURE__ */ new Date()).toISOString()
25
+ timestamp: /* @__PURE__ */ new Date()
15
26
  }
16
27
  };
17
28
  }
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/storageContract.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context/transactionContext.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/typeGuards.ts
3
3
  /** Check if fastify has the events plugin registered */
4
4
  function hasEvents(instance) {
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { i as RequestScope } from "../types-Ddl9OjmE.mjs";
3
3
  import { a as UserLike, c as DataPolicy, d as UserBase, i as ObjectId, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "../base-C-NL2fTi.mjs";
4
- import { $ as OpenApiSchemas, A as RequestIdOptions, An as WriteVerbKey, At as RouteDefinition, C as RequestContext, D as HealthCheck, Dn as MutationWriteContext, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, G as OnTenantDeleteConfig, H as CrudController, I as MiddlewareHandler, In as IRequestContext, It as Authenticator, J as PresetHook, K as ResolvedTenantPurge, L as RequestWithExtras, Ln as RawRouteHandler, Lt as AuthenticatorContext, M as EventsDecorator, Mn as ControllerLike, Mt as RouteMethod, N as FastifyRequestExtras, Nn as FastifyHandler, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, Ot as ActionHandlerFn, P as FastifyWithAuth, Pn as IController, Pt as AuthHelpers, Q as MiddlewareConfig, Rn as RouteHandler, Rt as JwtContext, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, W as ResourcePermissions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jn as ControllerHandler, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kn as WriteContext, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, xn as BaseControllerOptions, y as OwnershipCheck, zt as TokenPair } from "../index-BqRfP1kT.mjs";
4
+ import { $ as OpenApiSchemas, A as RequestIdOptions, An as WriteVerbKey, At as RouteDefinition, C as RequestContext, D as HealthCheck, Dn as MutationWriteContext, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, G as OnTenantDeleteConfig, H as CrudController, I as MiddlewareHandler, In as IRequestContext, It as Authenticator, J as PresetHook, K as ResolvedTenantPurge, L as RequestWithExtras, Ln as RawRouteHandler, Lt as AuthenticatorContext, M as EventsDecorator, Mn as ControllerLike, Mt as RouteMethod, N as FastifyRequestExtras, Nn as FastifyHandler, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, Ot as ActionHandlerFn, P as FastifyWithAuth, Pn as IController, Pt as AuthHelpers, Q as MiddlewareConfig, Rn as RouteHandler, Rt as JwtContext, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, W as ResourcePermissions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jn as ControllerHandler, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kn as WriteContext, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, xn as BaseControllerOptions, y as OwnershipCheck, zt as TokenPair } from "../index-D3sIPcD4.mjs";
5
5
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-BXCfVcNG.mjs";
6
6
  export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, AuthorizationDecision, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, DataPolicy, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, MutationWriteContext, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RawRouteHandler, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, ResourceWrites, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, WriteContext, WriteVerbKey };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,5 +1,5 @@
1
1
 
2
- import { V as ResourceDefinition } from "./index-BqRfP1kT.mjs";
2
+ import { V as ResourceDefinition } from "./index-D3sIPcD4.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/integrations/mcp/types.d.ts
5
5
  /** Behavioral hints for MCP clients (tool annotations per MCP spec) */
@@ -275,6 +275,51 @@ interface McpPluginOptions {
275
275
  * - `McpAuthResolver` — custom function that resolves identity from headers
276
276
  */
277
277
  auth?: BetterAuthHandler | McpAuthResolver | false;
278
+ /**
279
+ * DNS-rebinding protection for the MCP routes — `Host` / `Origin` validation.
280
+ *
281
+ * The attack this closes: a page the developer visits can POST to
282
+ * `127.0.0.1:<port>`. If a DNS name the attacker controls resolves to
283
+ * loopback, the browser treats the response as same-origin and the page can
284
+ * READ it — every registered tool, from any website. Validating that `Host`
285
+ * names a host you expect is what breaks it, which is why the MCP SDK ships
286
+ * this as a default for localhost servers.
287
+ *
288
+ * **Default: on when `auth: false`, off otherwise.** Not a guess — it follows
289
+ * the threat:
290
+ * - `auth: false` is the local/dev shape the attack targets, and nothing else
291
+ * is standing in the way. Defaults to the SDK's localhost set
292
+ * (`localhost`, `127.0.0.1`, `[::1]`).
293
+ * - With auth configured, the endpoint is normally a real domain whose `Host`
294
+ * is not localhost — defaulting protection ON would 403 every production
295
+ * deployment. There, credentials are the gate.
296
+ *
297
+ * Set explicitly whenever the default's assumption is wrong for you: a
298
+ * localhost server that DOES use auth, or a deliberately-public `auth: false`
299
+ * endpoint that must keep answering (`false` to disable).
300
+ *
301
+ * Validation itself is `@modelcontextprotocol/server`'s `validateHostHeader` /
302
+ * `validateOriginHeader` — arc does not reimplement the matching rules.
303
+ * Hostnames only, no scheme or port; IPv6 in brackets (`[::1]`). A request
304
+ * with no `Origin` header passes (non-browser MCP clients send none); a
305
+ * present-but-unlisted `Origin` is rejected.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * // localhost server that uses auth — opt in explicitly
310
+ * mcpPlugin({ resources, auth, dnsRebindingProtection: {} });
311
+ * // reachable under a known public name
312
+ * mcpPlugin({ resources, dnsRebindingProtection: { allowedHosts: ['mcp.example.com'] } });
313
+ * // deliberately public, no Host constraint
314
+ * mcpPlugin({ resources, auth: false, dnsRebindingProtection: false });
315
+ * ```
316
+ */
317
+ dnsRebindingProtection?: false | {
318
+ /** Allowed `Host` hostnames. Default: `localhost`, `127.0.0.1`, `[::1]`. */
319
+ allowedHosts?: string[];
320
+ /** Allowed `Origin` hostnames. Default: same localhost set. */
321
+ allowedOrigins?: string[];
322
+ };
278
323
  /** MCP endpoint path (default: '/mcp') */
279
324
  prefix?: string;
280
325
  /** Server identity */
@@ -1,6 +1,6 @@
1
1
 
2
- import { n as DomainEvent, r as EventHandler } from "./EventTransport-BEVP50ka.mjs";
3
- import { n as ErrorMapper } from "./errorHandler-DI5AN2b5.mjs";
2
+ import { n as DomainEvent, r as EventHandler } from "./EventTransport-BPOQsEer.mjs";
3
+ import { n as ErrorMapper } from "./errorHandler--4rSMMvq.mjs";
4
4
  import { FastifyInstance, FastifyPluginAsync } from "fastify";
5
5
  import { LockAdapter } from "@classytic/repo-core/lock";
6
6
  //#region src/plugins/health.d.ts
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
2
- import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-CbxCF9M0.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-DivLPMHe.mjs";
4
- import { t as getUserId$1 } from "./userHelpers-Bi97zMEl.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-BHD3L8of.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
4
+ import { t as getUserId$1 } from "./userHelpers-DLueLQdQ.mjs";
5
5
  //#region src/scope/types.ts
6
6
  /**
7
7
  * Request Scope — The One Standard
Binary file
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.37.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/userHelpers.ts
3
3
  /**
4
4
  * Extract a user ID from a user object. Accepts `id` or `_id` — returns
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { F as getHeader, I as requireSingleHeaderValue, P as ArcHeaders } from "../types-Ddl9OjmE.mjs";
3
3
  import { f as getUserId, m as normalizeRoles, p as getUserRoles, t as AnyRecord } from "../base-C-NL2fTi.mjs";
4
- import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-BqRfP1kT.mjs";
5
- import { n as ErrorMapper } from "../errorHandler-DI5AN2b5.mjs";
4
+ import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-D3sIPcD4.mjs";
5
+ import { n as ErrorMapper } from "../errorHandler--4rSMMvq.mjs";
6
6
  import { a as NotFoundError, c as RateLimitError, d as ValidationError, f as createDomainError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorOptions, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-BGdVwP25.mjs";
7
7
  import { scheduleBackground } from "@classytic/repo-core/cache";
8
8
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
@@ -691,8 +691,8 @@ declare const paginationSchema: JsonSchema;
691
691
  * validation PER RESPONSE to pick the branch, on the hottest route of
692
692
  * every arc app. The merge keeps the exact bytes (pinned by
693
693
  * `tests/utils/list-response-serialization.test.ts`) and drops the
694
- * per-response branch validation. Only `data` is required — the one field
695
- * all four variants share.
694
+ * per-response branch validation. The list route also serves count, exists
695
+ * and distinct dispatch verbs, so no field is common to every valid shape.
696
696
  */
697
697
  declare function listResponse(itemSchema: JsonSchema): JsonSchema;
698
698
  /** Offset variant — `{ method: 'offset', data, page, limit, total, pages, hasNext, hasPrev }`. */