@classytic/arc 2.38.0 → 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-CYaDvmOB.mjs → BaseController-BqJtbiUA.mjs} +107 -23
  2. package/dist/{EventTransport-Cx60_s-6.d.mts → EventTransport-BPOQsEer.d.mts} +8 -0
  3. package/dist/{EventTransport-Gq7JWbWw.mjs → EventTransport-BUkTwY_x.mjs} +13 -2
  4. package/dist/{HookSystem-C0ikzqQf.mjs → HookSystem-96nzZLmk.mjs} +2 -2
  5. package/dist/{ResourceRegistry-DPcX--zk.mjs → ResourceRegistry-B9WnuG2Q.mjs} +2 -2
  6. package/dist/{actionPermissions-jlFZ1it4.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-BP8GHtjc.mjs → authorizationDecision-D_LFvMlm.mjs} +2 -2
  14. package/dist/{buildHandler-DjXOqIvX.mjs → buildHandler-BG_CHXqQ.mjs} +4 -4
  15. package/dist/cache/index.mjs +4 -4
  16. package/dist/{caching-a3ZEcJJs.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-BONghE1Y.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-8She7FgF.mjs → core-CsZR037F.mjs} +3 -3
  33. package/dist/{createActionRouter-Bqi6Bhhx.mjs → createActionRouter-BR93gCKg.mjs} +7 -7
  34. package/dist/{createAggregationRouter-BsYO7ktd.mjs → createAggregationRouter-CF40Aw95.mjs} +7 -7
  35. package/dist/createMcpServer-BVTs2S5G.d.mts +48 -0
  36. package/dist/{defineAggregation-0KBvqEEC.mjs → defineAggregation-BDA2Tw7v.mjs} +1 -1
  37. package/dist/{defineResource-BMdyRelW.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-C6woysGC.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-BdmIWPba.mjs → errorHandler-By9keRvX.mjs} +3 -3
  45. package/dist/{errors-2ExmOgIJ.mjs → errors-BHD3L8of.mjs} +1 -1
  46. package/dist/{eventPlugin-DJwpGMzx.mjs → eventPlugin-DB26V7uX.mjs} +5 -5
  47. package/dist/{eventPlugin-DFvHa4Nf.d.mts → eventPlugin-DfHaKEWQ.d.mts} +1 -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-jYA2oHyL.d.mts → fastify-augmentation-HncZMmze.d.mts} +3 -3
  57. package/dist/{fields-Cha2QCKH.mjs → fields-fA-Dkou5.mjs} +1 -1
  58. package/dist/{generate-BUP4Oydg.mjs → generate-BSSdtiOy.mjs} +4 -3
  59. package/dist/{headers-DeXNifVj.mjs → headers-BFEEshDS.mjs} +2 -2
  60. package/dist/{health-Bh0N_FLk.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-B78WZom8.d.mts → index-D3sIPcD4.d.mts} +47 -11
  66. package/dist/{index-D2uIUSQk.d.mts → index-DbMglURO.d.mts} +2 -2
  67. package/dist/{index-BRoDtjek.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-Dg_Am2o_.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-DYPVscCU.mjs → interface-DjtFnZxH.mjs} +1 -1
  87. package/dist/{jsonBody-DVui0uJl.mjs → jsonBody-Dx6jH_Nb.mjs} +2 -2
  88. package/dist/{keys-BSuxGS-B.mjs → keys-Ds3ekBiu.mjs} +1 -1
  89. package/dist/{loadResources-CNd1DWnK.mjs → loadResources-E5UFlRrT.mjs} +2 -2
  90. package/dist/{loadResourcesFromEntry-DNj8cpiY.mjs → loadResourcesFromEntry-C2jrJbWG.mjs} +2 -2
  91. package/dist/logger/index.mjs +1 -1
  92. package/dist/{mcpPlugin-KWsezMx7.mjs → mcpPlugin-D-3OLxNz.mjs} +75 -31
  93. package/dist/{memory-BiPVaCPg.mjs → memory-CNvjxzB2.mjs} +2 -2
  94. package/dist/{metrics-CsWaIVTa.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-BQXHxMEk.mjs → module-CNcwCKUJ.mjs} +1 -1
  99. package/dist/{multipartBody-u6VrS_iH.mjs → multipartBody-Bl_gU3Wg.mjs} +1 -1
  100. package/dist/{openapi-Dxc8RLy_.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-DyIqA5vo.mjs → outbox-module-6DMC_WNu.mjs} +40 -21
  104. package/dist/{outbox-module-CQXu_O6o.d.mts → outbox-module-CzsKRBvO.d.mts} +11 -2
  105. package/dist/permissions/index.mjs +5 -5
  106. package/dist/{permissions-H7Zcb82Z.mjs → permissions-C0GpDsB_.mjs} +6 -6
  107. package/dist/{pipe-SunhEaZ6.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-Da7IT_qJ.mjs → pluralize-BaQ62hOW.mjs} +1 -1
  115. package/dist/{preloadResources-DlhH81py.mjs → preloadResources-BAx5s9EF.mjs} +70 -21
  116. package/dist/{preloadResources-BbBkNkqK.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-CNyfaxGL.mjs → presets-CAaqVVcW.mjs} +4 -4
  126. package/dist/{projection-DSfEoooA.mjs → projection-qbCOEvsh.mjs} +2 -2
  127. package/dist/{queryCachePlugin-oTsmVyEQ.mjs → queryCachePlugin-2Pp9w-8D.mjs} +5 -5
  128. package/dist/rateLimitKey-umrS6-vu.mjs +41 -0
  129. package/dist/{realtime-CPmjjgqd.mjs → realtime-zzoNLDtj.mjs} +9 -9
  130. package/dist/{redis-stream-eh0eOtjh.d.mts → redis-stream-DSsPyYzd.d.mts} +7 -2
  131. package/dist/{registerRoute-XvcI_3sh.mjs → registerRoute-_6zHiz0x.mjs} +6 -6
  132. package/dist/registry/index.d.mts +2 -2
  133. package/dist/registry/index.mjs +3 -3
  134. package/dist/{registry-UFEJQN8R.mjs → registry-CEpoRpLP.mjs} +2 -2
  135. package/dist/{renewingLease-DuRGVOMe.mjs → renewingLease-B5Grm0pI.mjs} +1 -1
  136. package/dist/{replyHelpers-BHebarf0.mjs → replyHelpers-9h-a592u.mjs} +2 -2
  137. package/dist/{requestContext-DpmntRZy.mjs → requestContext-D4PuGhEw.mjs} +1 -1
  138. package/dist/{rolldown-runtime-Add2L50I.mjs → rolldown-runtime-DzE6ikSH.mjs} +1 -1
  139. package/dist/{runtimeCapabilities-D793Pxci.mjs → runtimeCapabilities-Bo7rSKjm.mjs} +1 -1
  140. package/dist/{schedules-DthM8Qag.mjs → schedules-Dm21pqHU.mjs} +8 -4
  141. package/dist/{schemaConverter-Db-MMsH6.mjs → schemaConverter-DENbixyA.mjs} +1 -1
  142. package/dist/{schemaIR-CIXShch7.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-D03sk17n.mjs → scope-CdYxQVxt.mjs} +4 -4
  147. package/dist/{simpleEqualityMatcher-B7qVjQBv.mjs → simpleEqualityMatcher-Cldubvul.mjs} +1 -1
  148. package/dist/{sse-D4MYqkic.mjs → sse-DbyXoQun.mjs} +5 -5
  149. package/dist/{sseStream-BuMNPR6r.mjs → sseStream-BfZtL5-m.mjs} +2 -2
  150. package/dist/{store-helpers-CIF4RG8s.mjs → store-helpers-BfyOd5i6.mjs} +1 -1
  151. package/dist/{streaming-DkpW1HwJ.mjs → streaming-CFwCzEvU.mjs} +1 -1
  152. package/dist/{subscribe-helpers-CBZOi6pk.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-DMmvcfdo.mjs → transactionContext-46KyUADP.mjs} +1 -1
  160. package/dist/{typeGuards-DHTnEs5X.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-LQFwC37d.d.mts → types-9rvxn5Ym.d.mts} +46 -1
  165. package/dist/{types-BRU-Kd3t.d.mts → types-BVlowlm7.d.mts} +2 -2
  166. package/dist/{types-BqLyyH0o.mjs → types-CNQyOrLk.mjs} +4 -4
  167. package/dist/usage/index.mjs +0 -0
  168. package/dist/{userHelpers-CXySQFRg.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-BbGG8XNT.mjs → utils-CUFBrhq-.mjs} +14 -6
  172. package/dist/{validate-CidSeUrx.mjs → validate-DV3hRbsz.mjs} +2 -2
  173. package/dist/{versioning-C2r0eOZ4.mjs → versioning-BXwmj5SD.mjs} +3 -3
  174. package/dist/{versioning-B843jOYX.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-CewdR-m6.mjs +0 -15
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-2ExmOgIJ.mjs";
3
- import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "../streaming-DkpW1HwJ.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-BHD3L8of.mjs";
3
+ import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "../streaming-CFwCzEvU.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/integrations/streamline.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
 
2
- import { a as EventTransport, n as DomainEvent } from "../EventTransport-Cx60_s-6.mjs";
3
- import { n as OutboxModuleOptions, r as createOutboxModule } from "../outbox-module-CQXu_O6o.mjs";
2
+ import { a as EventTransport, n as DomainEvent } from "../EventTransport-BPOQsEer.mjs";
3
+ import { n as OutboxModuleOptions, r as createOutboxModule } from "../outbox-module-CzsKRBvO.mjs";
4
4
  import { FastifyPluginAsync } from "fastify";
5
5
  import { OutboxFailurePolicy, OutboxStore } from "@classytic/primitives/outbox";
6
6
  //#region src/integrations/webhooks.d.ts
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-D793Pxci.mjs";
3
- import { i as exponentialBackoff, t as createOutboxModule } from "../outbox-module-DyIqA5vo.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-Bo7rSKjm.mjs";
3
+ import { i as exponentialBackoff, t as createOutboxModule } from "../outbox-module-6DMC_WNu.mjs";
4
4
  import { createHmac, timingSafeEqual } from "node:crypto";
5
5
  import fp from "fastify-plugin";
6
6
  import { createChildEvent } from "@classytic/primitives/events";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/integrations/websocket-pushref-redis.ts
3
3
  /**
4
4
  * Lua script for atomic claim. Runs server-side, single-roundtrip.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/integrations/websocket-redis.ts
3
3
  /**
4
4
  * Redis Pub/Sub adapter for cross-instance WebSocket broadcast.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { randomUUID } from "node:crypto";
3
3
  import sjson from "secure-json-parse";
4
4
  import fp from "fastify-plugin";
@@ -968,7 +968,7 @@ async function handleConnection(ctx, socket, request) {
968
968
  socket.close(4003, "Session expired");
969
969
  }
970
970
  }, options.reauthInterval);
971
- socket.on("message", async (raw) => {
971
+ socket.on("message", (raw) => safeAsync((async () => {
972
972
  if ((typeof raw === "string" ? Buffer.byteLength(raw) : raw.length) > options.maxMessageBytes) {
973
973
  socket.send(JSON.stringify({
974
974
  type: "error",
@@ -1057,12 +1057,19 @@ async function handleConnection(ctx, socket, request) {
1057
1057
  }
1058
1058
  default: await options.onMessage?.(client, msg);
1059
1059
  }
1060
- });
1061
- socket.on("close", async () => {
1060
+ })(), fastify.log, "ws.message", { clientId }));
1061
+ socket.on("close", () => safeAsync((async () => {
1062
1062
  if (heartbeatTimer) clearInterval(heartbeatTimer);
1063
1063
  if (reauthTimer) clearInterval(reauthTimer);
1064
1064
  if (rooms.getClient(clientId)?.socket === socket) {
1065
- await options.onDisconnect?.(client);
1065
+ try {
1066
+ await options.onDisconnect?.(client);
1067
+ } catch (err) {
1068
+ fastify.log.warn({
1069
+ err,
1070
+ clientId
1071
+ }, "[arc] websocket onDisconnect threw");
1072
+ }
1066
1073
  rooms.removeClient(clientId);
1067
1074
  }
1068
1075
  queue.dispose();
@@ -1070,7 +1077,7 @@ async function handleConnection(ctx, socket, request) {
1070
1077
  pushRef,
1071
1078
  generation
1072
1079
  });
1073
- });
1080
+ })(), fastify.log, "ws.close", { clientId }));
1074
1081
  socket.on("error", () => {
1075
1082
  if (heartbeatTimer) clearInterval(heartbeatTimer);
1076
1083
  if (reauthTimer) clearInterval(reauthTimer);
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/idempotency/stores/interface.ts
3
3
  /**
4
4
  * Helper to create a result object
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as ArcError } from "./errors-2ExmOgIJ.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "./errors-BHD3L8of.mjs";
3
3
  import sjson from "secure-json-parse";
4
4
  //#region src/utils/jsonBody.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/cache/keys.ts
3
3
  /**
4
4
  * Cache Key Utilities
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.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
4
  import { readdir } from "node:fs/promises";
5
5
  import { dirname, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as ResourceRegistry } from "./ResourceRegistry-DPcX--zk.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as ResourceRegistry } from "./ResourceRegistry-B9WnuG2Q.mjs";
3
3
  import { resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  //#region src/cli/utils/loadResourcesFromEntry.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | 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/logger/index.ts
4
4
  /**
@@ -1,18 +1,18 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { r as evaluatePermissionDecision } from "./authorizationDecision-BP8GHtjc.mjs";
3
- import { p as isArcError, t as ArcError } from "./errors-2ExmOgIJ.mjs";
4
- import { n as requireSingleHeaderValue } from "./headers-DeXNifVj.mjs";
5
- import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-BqLyyH0o.mjs";
6
- import { t as BaseController } from "./BaseController-CYaDvmOB.mjs";
7
- import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-Cha2QCKH.mjs";
8
- import { t as buildRequestScopeProjection } from "./projection-DSfEoooA.mjs";
9
- import { i as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-jlFZ1it4.mjs";
10
- import { t as executePipeline } from "./pipe-SunhEaZ6.mjs";
11
- import { t as pluralize } from "./pluralize-Da7IT_qJ.mjs";
12
- import { t as createIdempotencyResult } from "./interface-DYPVscCU.mjs";
13
- import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-CIXShch7.mjs";
14
- import { n as validateAggregations } from "./validate-CidSeUrx.mjs";
15
- import { n as executeAggregation } from "./buildHandler-DjXOqIvX.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { r as evaluatePermissionDecision } from "./authorizationDecision-D_LFvMlm.mjs";
3
+ import { p as isArcError, t as ArcError } from "./errors-BHD3L8of.mjs";
4
+ import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
5
+ import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-CNQyOrLk.mjs";
6
+ import { t as BaseController } from "./BaseController-BqJtbiUA.mjs";
7
+ import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-fA-Dkou5.mjs";
8
+ import { t as buildRequestScopeProjection } from "./projection-qbCOEvsh.mjs";
9
+ import { i as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-4OGbe3Hf.mjs";
10
+ import { t as executePipeline } from "./pipe-4_XamfxI.mjs";
11
+ import { t as pluralize } from "./pluralize-BaQ62hOW.mjs";
12
+ import { t as createIdempotencyResult } from "./interface-DjtFnZxH.mjs";
13
+ import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-C2qUNzC6.mjs";
14
+ import { n as validateAggregations } from "./validate-DV3hRbsz.mjs";
15
+ import { n as executeAggregation } from "./buildHandler-BG_CHXqQ.mjs";
16
16
  import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
17
17
  import { createHash, randomUUID } from "node:crypto";
18
18
  import fp from "fastify-plugin";
@@ -50,7 +50,7 @@ import { z } from "zod";
50
50
  * @returns McpServer instance (not yet connected to a transport)
51
51
  */
52
52
  async function createMcpServer(config, authRef) {
53
- const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
53
+ const { McpServer } = await import("@modelcontextprotocol/server");
54
54
  const server = new McpServer({
55
55
  name: config.name,
56
56
  version: config.version ?? "1.0.0"
@@ -130,25 +130,39 @@ function registerTool(server, tool, authRef) {
130
130
  const config = {};
131
131
  if (tool.title) config.title = tool.title;
132
132
  if (tool.description) config.description = tool.description;
133
+ /**
134
+ * Flat SHAPES are passed straight through. v2's `registerTool` carries a
135
+ * `ZodRawShape` overload and auto-wraps it in `z.object()` itself, so arc's
136
+ * host-facing ergonomic (`{ name: z.string() }`) needs no adaptation layer.
137
+ *
138
+ * arc's own MIGRATION-V2 notes claimed v2 "requires z.object(), raw shapes no
139
+ * longer accepted" and a wrap was written here on that basis. That was true of
140
+ * the PRE-ALPHA and is not true of 2.0.0 — checked against the shipped
141
+ * overloads. Wrapping anyway would have been arc maintaining an adapter for a
142
+ * conversion the SDK already owns.
143
+ */
133
144
  if (tool.inputSchema) config.inputSchema = tool.inputSchema;
134
145
  if (tool.outputSchema) config.outputSchema = tool.outputSchema;
135
146
  if (tool.annotations) config.annotations = tool.annotations;
136
- srv.registerTool(tool.name, config, (input, extra) => {
147
+ srv.registerTool(tool.name, config, (input, mcpCtx) => {
137
148
  const ctx = {
138
149
  session: authRef?.current ?? null,
150
+ /**
151
+ * v2 exposes logging as `ctx.mcpReq.log(level, message)` — the SDK builds
152
+ * the `notifications/message` envelope and correlates it to the in-flight
153
+ * request. v1 handed over a raw `sendNotification` that arc had to frame
154
+ * itself; that hand-framed envelope carried no request id, so a log line
155
+ * from a tool arrived uncorrelated.
156
+ *
157
+ * Still best-effort: a transport that has already closed must not turn a
158
+ * successful tool call into a failed one.
159
+ */
139
160
  log: async (level, message) => {
140
161
  try {
141
- const notify = extra?.sendNotification;
142
- if (notify) await notify({
143
- method: "notifications/message",
144
- params: {
145
- level,
146
- data: message
147
- }
148
- });
162
+ await (mcpCtx?.mcpReq)?.log?.(level, message);
149
163
  } catch {}
150
164
  },
151
- extra
165
+ extra: mcpCtx
152
166
  };
153
167
  return tool.handler(input, ctx);
154
168
  });
@@ -2035,7 +2049,7 @@ function resourceToTools(resource, config = {}) {
2035
2049
  */
2036
2050
  function registerSchemaResources(server, resources, overrides) {
2037
2051
  const srv = server;
2038
- srv.resource("schemas", "arc://schemas", {
2052
+ srv.registerResource("schemas", "arc://schemas", {
2039
2053
  title: "Arc Resource Schemas",
2040
2054
  description: "All available resources",
2041
2055
  mimeType: "application/json"
@@ -2053,7 +2067,7 @@ function registerSchemaResources(server, resources, overrides) {
2053
2067
  for (const r of resources) {
2054
2068
  const uri = `arc://schemas/${r.name}`;
2055
2069
  const schemaOpts = r.schemaOptions;
2056
- srv.resource(`schema-${r.name}`, uri, {
2070
+ srv.registerResource(`schema-${r.name}`, uri, {
2057
2071
  title: `${r.displayName} Schema`,
2058
2072
  description: `Schema for ${r.displayName}`,
2059
2073
  mimeType: "application/json"
@@ -2181,7 +2195,7 @@ var McpSessionCache = class {
2181
2195
  closeTransport(entry) {
2182
2196
  try {
2183
2197
  const transport = entry.transport;
2184
- if (transport && typeof transport.close === "function") transport.close();
2198
+ if (transport && typeof transport.close === "function") Promise.resolve(transport.close()).catch(() => {});
2185
2199
  } catch {}
2186
2200
  }
2187
2201
  };
@@ -2219,9 +2233,9 @@ var McpSessionCache = class {
2219
2233
  const mcpPluginImpl = async (fastify, options) => {
2220
2234
  let StreamableHTTPServerTransport;
2221
2235
  try {
2222
- StreamableHTTPServerTransport = (await import("@modelcontextprotocol/sdk/server/streamableHttp.js")).StreamableHTTPServerTransport;
2236
+ StreamableHTTPServerTransport = (await import("@modelcontextprotocol/node")).NodeStreamableHTTPServerTransport;
2223
2237
  } catch {
2224
- throw new Error("@modelcontextprotocol/sdk is required for MCP support. Install it: npm install @modelcontextprotocol/sdk");
2238
+ throw new Error("@modelcontextprotocol/server and @modelcontextprotocol/node are required for MCP support. Install them: npm install @modelcontextprotocol/server @modelcontextprotocol/node");
2225
2239
  }
2226
2240
  try {
2227
2241
  await import("zod");
@@ -2286,6 +2300,36 @@ const mcpPluginImpl = async (fastify, options) => {
2286
2300
  const more = allTools.length > 5 ? ` (+${allTools.length - 5} more)` : "";
2287
2301
  fastify.log.warn(`[arc/mcp] MCP server registered at "${prefix}" with auth DISABLED. Anyone who can reach this URL has full access to ${allTools.length} tools across ${enabledResources.length} resources: ${toolList}${more}. Pass \`auth: betterAuthInstance\` or \`auth: async (headers) => ...\` to gate access. Safe only for stdio transports, local development, or explicitly-public read-only APIs.`);
2288
2302
  }
2303
+ const rebindOption = options.dnsRebindingProtection;
2304
+ if (rebindOption === void 0 ? options.auth === false : rebindOption !== false) {
2305
+ const { validateHostHeader, validateOriginHeader, localhostAllowedHostnames } = await import("@modelcontextprotocol/server");
2306
+ const cfg = rebindOption === void 0 || rebindOption === false ? {} : rebindOption;
2307
+ const allowedHosts = cfg.allowedHosts ?? localhostAllowedHostnames();
2308
+ const allowedOrigins = cfg.allowedOrigins ?? allowedHosts;
2309
+ const healthPath = `${prefix}/health`;
2310
+ fastify.addHook("onRequest", async (request, reply) => {
2311
+ if (!request.url.startsWith(prefix)) return;
2312
+ if (request.url.split("?")[0] === healthPath) return;
2313
+ const host = validateHostHeader(request.headers.host, allowedHosts);
2314
+ if (!host.ok) return reply.code(403).send({
2315
+ jsonrpc: "2.0",
2316
+ error: {
2317
+ code: -32e3,
2318
+ message: host.message
2319
+ },
2320
+ id: null
2321
+ });
2322
+ const origin = validateOriginHeader(request.headers.origin, allowedOrigins);
2323
+ if (!origin.ok) return reply.code(403).send({
2324
+ jsonrpc: "2.0",
2325
+ error: {
2326
+ code: -32e3,
2327
+ message: origin.message
2328
+ },
2329
+ id: null
2330
+ });
2331
+ });
2332
+ }
2289
2333
  fastify.get(`${prefix}/health`, async (request, reply) => {
2290
2334
  const liveness = {
2291
2335
  status: "ok",
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
3
  //#region src/cache/memory.ts
4
4
  var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
5
5
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/plugins/metrics.ts
5
5
  var metrics_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
 
2
- import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-B78WZom8.mjs";
2
+ import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-D3sIPcD4.mjs";
3
3
  import { RouteHandlerMethod } from "fastify";
4
4
  //#region src/middleware/middleware.d.ts
5
5
  interface NamedMiddleware {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-BONghE1Y.mjs";
3
- import { t as multipartBody } from "../multipartBody-u6VrS_iH.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-BQ2FbhPB.mjs";
3
+ import { t as multipartBody } from "../multipartBody-Bl_gU3Wg.mjs";
4
4
  //#region src/middleware/middleware.ts
5
5
  /**
6
6
  * Named Middleware — Priority-based, conditional middleware execution.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as startRenewingLease } from "../renewingLease-DuRGVOMe.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as startRenewingLease } from "../renewingLease-B5Grm0pI.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  //#region src/migrations/index.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/factory/module/index.ts
3
3
  /**
4
4
  * Identity helper for authoring a typed module — mirrors `defineResource`.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import sjson from "secure-json-parse";
3
3
  //#region src/middleware/multipartBody.ts
4
4
  const DEFAULT_MAX_FILE_SIZE = 10485760;
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { n as getUserRoles } from "./userHelpers-CXySQFRg.mjs";
3
- import { n as convertRouteSchema } from "./schemaConverter-Db-MMsH6.mjs";
4
- import { t as resolveActionPermission } from "./actionPermissions-jlFZ1it4.mjs";
5
- import { t as pluralize } from "./pluralize-Da7IT_qJ.mjs";
6
- import { t as buildActionBodySchema } from "./createActionRouter-Bqi6Bhhx.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
3
+ import { n as convertRouteSchema } from "./schemaConverter-DENbixyA.mjs";
4
+ import { t as resolveActionPermission } from "./actionPermissions-4OGbe3Hf.mjs";
5
+ import { t as pluralize } from "./pluralize-BaQ62hOW.mjs";
6
+ import { t as buildActionBodySchema } from "./createActionRouter-BR93gCKg.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  //#region src/docs/openapi/canonical-schemas.ts
9
9
  /**
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { l as PermissionCheck } from "../base-C-NL2fTi.mjs";
3
- import { t as ArcModule } from "../types-BRU-Kd3t.mjs";
3
+ import { t as ArcModule } from "../types-BVlowlm7.mjs";
4
4
  import { OutboxStore } from "@classytic/primitives/outbox";
5
5
  //#region src/outbox-admin/module.d.ts
6
6
  /**
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { i as NotFoundError, u as ValidationError } from "../errors-2ExmOgIJ.mjs";
3
- import { t as defineResource } from "../defineResource-BMdyRelW.mjs";
4
- import { n as getModuleExports, t as defineModule } from "../module-BQXHxMEk.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { i as NotFoundError, u as ValidationError } from "../errors-BHD3L8of.mjs";
3
+ import { t as defineResource } from "../defineResource-DaIySrQr.mjs";
4
+ import { n as getModuleExports, t as defineModule } from "../module-CNcwCKUJ.mjs";
5
5
  //#region src/outbox-admin/module.ts
6
6
  /**
7
7
  * Strip the domain payload and the stack unless explicitly opted in.
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as transactionContext } from "./transactionContext-DMmvcfdo.mjs";
3
- import { i as resolveEventTransport } from "./EventTransport-Gq7JWbWw.mjs";
4
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-CIF4RG8s.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as transactionContext } from "./transactionContext-46KyUADP.mjs";
3
+ import { i as resolveEventTransport } from "./EventTransport-BUkTwY_x.mjs";
4
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-BfyOd5i6.mjs";
5
5
  import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
6
6
  import { randomBytes } from "node:crypto";
7
7
  import { InvalidOutboxEventError, OutboxOwnershipError } from "@classytic/primitives/outbox";
@@ -807,25 +807,44 @@ function createOutboxModule(options) {
807
807
  * module exists to prevent, arrived at from the other side.
808
808
  */
809
809
  if (transport === void 0) throw new Error(`Outbox module "${name}" could not resolve an event transport, so its relay would tick forever without publishing while the store grows. Register arc's events plugin (it is on by default — check \`arcPlugins.events !== false\`), or pass an explicit \`transport\` to \`createOutboxModule\`. Note the outbox needs the RAW EventTransport, not the \`fastify.events\` facade: the facade takes \`(type, payload, meta?)\` and fails open, which would acknowledge rows whose publish actually failed.`);
810
+ const relay = new EventOutbox({
811
+ store,
812
+ transport,
813
+ ...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
814
+ ...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
815
+ consumerId: options.consumerId ?? mintConsumerId(name),
816
+ onError: options.onError ?? ((info) => {
817
+ fastify.log.error({
818
+ err: info.error,
819
+ kind: info.kind,
820
+ ...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
821
+ ...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
822
+ }, `outbox relay "${name}" failed`);
823
+ }),
824
+ ...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
825
+ ...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
826
+ });
827
+ /**
828
+ * One pass per burst of requests. `drainQueued` stays true from the
829
+ * first request until the pass STARTS, so a request landing mid-pass
830
+ * schedules the next one — a row written during a pass is never left
831
+ * waiting for the interval.
832
+ */
833
+ let drainQueued = false;
834
+ const requestDrain = () => {
835
+ if (drainQueued) return;
836
+ drainQueued = true;
837
+ setImmediate(() => {
838
+ drainQueued = false;
839
+ relay.relayBatch().catch((err) => {
840
+ fastify.log.error({ err }, `outbox relay "${name}" requested drain failed`);
841
+ });
842
+ });
843
+ };
810
844
  exports = {
811
845
  store,
812
- relay: new EventOutbox({
813
- store,
814
- transport,
815
- ...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
816
- ...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
817
- consumerId: options.consumerId ?? mintConsumerId(name),
818
- onError: options.onError ?? ((info) => {
819
- fastify.log.error({
820
- err: info.error,
821
- kind: info.kind,
822
- ...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
823
- ...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
824
- }, `outbox relay "${name}" failed`);
825
- }),
826
- ...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
827
- ...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
828
- })
846
+ relay,
847
+ requestDrain
829
848
  };
830
849
  return exports;
831
850
  },
@@ -1,6 +1,6 @@
1
1
 
2
- import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-Cx60_s-6.mjs";
3
- import { t as ArcModule } from "./types-BRU-Kd3t.mjs";
2
+ import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-BPOQsEer.mjs";
3
+ import { t as ArcModule } from "./types-BVlowlm7.mjs";
4
4
  import { FastifyInstance } from "fastify";
5
5
  import { MemoryOutboxStore } from "@classytic/primitives/memory-outbox";
6
6
  import { OutboxFailurePolicy, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
@@ -372,6 +372,15 @@ interface OutboxModuleExports {
372
372
  store: OutboxStore;
373
373
  /** The relay, for a host that wants to drain on demand (tests, admin actions). */
374
374
  relay: EventOutbox;
375
+ /**
376
+ * Ask for a relay pass SOON, without waiting for the interval. Coalesced:
377
+ * any number of calls before the pass runs produce ONE pass. Never throws
378
+ * and returns nothing — a unit of work calls this after commit so a row it
379
+ * just wrote is delivered in milliseconds rather than up to `relayEveryMs`
380
+ * later. Safe under concurrency: the store's lease and fence token make an
381
+ * extra pass a no-op, not a double publish.
382
+ */
383
+ requestDrain: () => void;
375
384
  }
376
385
  /**
377
386
  * Compose the outbox as a module.
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { a as conjoinPolicyFilters, i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-BP8GHtjc.mjs";
3
- import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-CXySQFRg.mjs";
4
- import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-Cha2QCKH.mjs";
5
- import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-H7Zcb82Z.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { a as conjoinPolicyFilters, i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-D_LFvMlm.mjs";
3
+ import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-DLueLQdQ.mjs";
4
+ import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-fA-Dkou5.mjs";
5
+ import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-C0GpDsB_.mjs";
6
6
  export { GRANT_MODES, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, scopeOf, when };
@@ -1,10 +1,10 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.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 { a as conjoinPolicyFilters, i as normalizeToDecision } from "./authorizationDecision-BP8GHtjc.mjs";
5
- import { n as getUserRoles } from "./userHelpers-CXySQFRg.mjs";
6
- import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-BqLyyH0o.mjs";
7
- import { t as MemoryCacheStore } from "./memory-BiPVaCPg.mjs";
4
+ import { a as conjoinPolicyFilters, i as normalizeToDecision } from "./authorizationDecision-D_LFvMlm.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
6
+ import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-CNQyOrLk.mjs";
7
+ import { t as MemoryCacheStore } from "./memory-CNvjxzB2.mjs";
8
8
  import { randomUUID } from "node:crypto";
9
9
  //#region src/permissions/context.ts
10
10
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { r as ForbiddenError } from "./errors-2ExmOgIJ.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { r as ForbiddenError } from "./errors-BHD3L8of.mjs";
3
3
  //#region src/pipeline/pipe.ts
4
4
  /**
5
5
  * Compose pipeline steps into an ordered array.
@@ -1,5 +1,5 @@
1
1
 
2
- import { Ct as PipelineStep, Fn as IControllerResponse, St as PipelineContext, _t as Guard, bt as OperationFilter, vt as Interceptor, wt as Transform, xt as PipelineConfig, yt as NextFunction } from "../index-B78WZom8.mjs";
2
+ import { Ct as PipelineStep, Fn as IControllerResponse, St as PipelineContext, _t as Guard, bt as OperationFilter, vt as Interceptor, wt as Transform, xt as PipelineConfig, yt as NextFunction } from "../index-D3sIPcD4.mjs";
3
3
  //#region src/pipeline/guard.d.ts
4
4
  interface GuardOptions {
5
5
  operations?: OperationFilter;
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { n as pipe, t as executePipeline } from "../pipe-SunhEaZ6.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as pipe, t as executePipeline } from "../pipe-4_XamfxI.mjs";
3
3
  //#region src/pipeline/guard.ts
4
4
  /**
5
5
  * Create a named guard.
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { t as AnyRecord } from "../base-C-NL2fTi.mjs";
3
- import { At as RouteDefinition, J as PresetHook, Q as MiddlewareConfig, et as RouteSchemaOptions } from "../index-B78WZom8.mjs";
4
- import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-DI5AN2b5.mjs";
5
- import { _ as HealthCheck, b as healthPlugin, f as ScheduleDefinition, g as schedulesPlugin, h as _default$8, m as SchedulesPluginOptions, p as ScheduleStats, v as HealthOptions, y as _default$3 } from "../types-BRU-Kd3t.mjs";
6
- import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-jYA2oHyL.mjs";
7
- import { _ as CachingRule, a as MetricsCollector, c as metricsPlugin, d as _default$6, f as realtimePlugin, g as CachingOptions, h as ssePlugin, i as MetricEntry, l as ChangeOperation, m as _default$9, n as _default$10, o as MetricsOptions, p as SSEOptions, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as RealtimeOptions, v as _default$1, y as cachingPlugin } from "../versioning-B843jOYX.mjs";
3
+ import { At as RouteDefinition, J as PresetHook, Q as MiddlewareConfig, et as RouteSchemaOptions } from "../index-D3sIPcD4.mjs";
4
+ import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler--4rSMMvq.mjs";
5
+ import { _ as HealthCheck, b as healthPlugin, f as ScheduleDefinition, g as schedulesPlugin, h as _default$8, m as SchedulesPluginOptions, p as ScheduleStats, v as HealthOptions, y as _default$3 } from "../types-BVlowlm7.mjs";
6
+ import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-HncZMmze.mjs";
7
+ import { _ as CachingRule, a as MetricsCollector, c as metricsPlugin, d as _default$6, f as realtimePlugin, g as CachingOptions, h as ssePlugin, i as MetricEntry, l as ChangeOperation, m as _default$9, n as _default$10, o as MetricsOptions, p as SSEOptions, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as RealtimeOptions, v as _default$1, y as cachingPlugin } from "../versioning-P3V6ATyC.mjs";
8
8
  import { t as TracingOptions } from "../tracing-Dro5eH6j.mjs";
9
9
  import { PaginatedResult } from "@classytic/repo-core/pagination";
10
10
  import { FastifyInstance, FastifyPluginAsync } from "fastify";