@classytic/arc 2.18.4 → 2.19.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 (160) hide show
  1. package/dist/{BaseController-B-uXzf6I.mjs → BaseController-Dy6EQHjM.mjs} +7 -7
  2. package/dist/{QueryCache-Dsyv2mLS.d.mts → QueryCache-TRfXau3W.d.mts} +1 -1
  3. package/dist/{ResourceRegistry-CWmOggxS.mjs → ResourceRegistry-5fKZwhK_.mjs} +1 -1
  4. package/dist/{pipeline-D4sqiokR.mjs → actionPermissions-D7NGwcAR.mjs} +29 -5
  5. package/dist/audit/index.d.mts +1 -1
  6. package/dist/auth/index.d.mts +4 -4
  7. package/dist/auth/index.mjs +262 -6
  8. package/dist/auth/redis-session.d.mts +1 -1
  9. package/dist/betterAuthOpenApi-CV1lxpRX.mjs +2 -0
  10. package/dist/{buildHandler-Cvrc2p7r.mjs → buildHandler-B0qvAguf.mjs} +1 -1
  11. package/dist/cache/index.d.mts +3 -3
  12. package/dist/cache/index.mjs +3 -3
  13. package/dist/{caching-C0DdKiYB.mjs → caching-_NJeDd1_.mjs} +1 -1
  14. package/dist/cli/commands/describe.d.mts +1 -1
  15. package/dist/cli/commands/describe.mjs +2 -2
  16. package/dist/cli/commands/docs.mjs +2 -2
  17. package/dist/cli/commands/generate.d.mts +2 -2
  18. package/dist/cli/commands/generate.mjs +1 -1
  19. package/dist/cli/commands/init.d.mts +2 -2
  20. package/dist/cli/commands/init.mjs +1 -1
  21. package/dist/cli/commands/introspect.mjs +1 -1
  22. package/dist/cli/index.d.mts +2 -2
  23. package/dist/cli/index.mjs +2 -2
  24. package/dist/context/index.mjs +1 -1
  25. package/dist/core/index.d.mts +3 -3
  26. package/dist/core/index.mjs +4 -4
  27. package/dist/{core-C88uIwd3.mjs → core-Ba-6Sue6.mjs} +67 -63
  28. package/dist/{createActionRouter-DGCCp-kP.mjs → createActionRouter-B_WzBFyf.mjs} +10 -10
  29. package/dist/{createAggregationRouter-Ca77b8iK.mjs → createAggregationRouter-B_G_nIjm.mjs} +4 -4
  30. package/dist/{createApp-J1iPXY9p.mjs → createApp--703hQE1.mjs} +14 -14
  31. package/dist/docs/index.d.mts +2 -2
  32. package/dist/docs/index.mjs +2 -2
  33. package/dist/{elevation-BzhyVWfn.mjs → elevation-COpYKt2h.mjs} +2 -2
  34. package/dist/encryption/index.d.mts +222 -0
  35. package/dist/encryption/index.mjs +270 -0
  36. package/dist/{errorHandler-Bua97SEt.mjs → errorHandler-Dxf6P_kV.mjs} +2 -2
  37. package/dist/{eventPlugin-Bw4bUDEO.mjs → eventPlugin-DJG2D7sy.mjs} +106 -5
  38. package/dist/{eventPlugin-C1W1CRbf.d.mts → eventPlugin-DbBFd3x_.d.mts} +1 -1
  39. package/dist/events/index.d.mts +3 -3
  40. package/dist/events/index.mjs +189 -5
  41. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  42. package/dist/events/transports/redis.d.mts +1 -1
  43. package/dist/factory/index.d.mts +1 -1
  44. package/dist/factory/index.mjs +3 -3
  45. package/dist/{fastify-augmentation-BdCl_eNo.d.mts → fastify-augmentation-D-5_yQJi.d.mts} +2 -2
  46. package/dist/{fields-CKLrhyOb.d.mts → fields-C7ahdGYf.d.mts} +1 -1
  47. package/dist/{generate-BaxDdmJ8.mjs → generate-Brans3fW.mjs} +1 -1
  48. package/dist/hooks/index.d.mts +1 -1
  49. package/dist/hooks/index.mjs +1 -1
  50. package/dist/idempotency/index.d.mts +2 -2
  51. package/dist/idempotency/index.mjs +1 -1
  52. package/dist/idempotency/redis.d.mts +1 -1
  53. package/dist/{index-Cvo1u9n6.d.mts → index-CP6A1Ffj.d.mts} +9 -9
  54. package/dist/{index-vcWUGkwf.d.mts → index-CRKiiP5o.d.mts} +3 -3
  55. package/dist/{index-QYma8mdC.d.mts → index-CUTG2Cuo.d.mts} +88 -7
  56. package/dist/index.d.mts +5 -5
  57. package/dist/index.mjs +7 -7
  58. package/dist/{init-DSsdRfk9.mjs → init-Bqpt1Hxf.mjs} +274 -130
  59. package/dist/integrations/event-gateway.d.mts +2 -2
  60. package/dist/integrations/event-gateway.mjs +1 -1
  61. package/dist/integrations/index.d.mts +3 -3
  62. package/dist/integrations/mcp/index.d.mts +4 -4
  63. package/dist/integrations/mcp/index.mjs +1 -1
  64. package/dist/integrations/mcp/testing.d.mts +1 -1
  65. package/dist/integrations/mcp/testing.mjs +1 -1
  66. package/dist/integrations/streamline.mjs +7 -3
  67. package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
  68. package/dist/integrations/websocket-redis.d.mts +1 -1
  69. package/dist/integrations/websocket.d.mts +3 -3
  70. package/dist/{loadResources-CwXt9MCh.mjs → loadResources-B8UmpITt.mjs} +1 -1
  71. package/dist/{loadResourcesFromEntry-XHNeUWpu.mjs → loadResourcesFromEntry-BTlFEx05.mjs} +1 -1
  72. package/dist/{mcpPlugin-CzKdt3B8.mjs → mcpPlugin-C088Nd-G.mjs} +10 -11
  73. package/dist/{memory-TdTHCS9-.mjs → memory-CLXA2VeJ.mjs} +1 -1
  74. package/dist/{metrics-Da2EUPi9.mjs → metrics-fdxI5mn_.mjs} +1 -1
  75. package/dist/middleware/index.d.mts +1 -1
  76. package/dist/middleware/index.mjs +2 -2
  77. package/dist/{openapi-ButnRyOM.mjs → openapi-DZ-5a5Op.mjs} +5 -5
  78. package/dist/permissions/index.d.mts +3 -3
  79. package/dist/permissions/index.mjs +2 -2
  80. package/dist/{permissions-3uzwkbQt.mjs → permissions-BPB1xqGf.mjs} +4 -4
  81. package/dist/{pipe-9Tl-OAus.mjs → pipe-BOLmGIxa.mjs} +1 -1
  82. package/dist/pipeline/index.d.mts +1 -1
  83. package/dist/pipeline/index.mjs +1 -1
  84. package/dist/plugins/index.d.mts +6 -7
  85. package/dist/plugins/index.mjs +12 -12
  86. package/dist/plugins/response-cache.mjs +1 -1
  87. package/dist/plugins/tracing-entry.d.mts +1 -1
  88. package/dist/plugins/tracing-entry.mjs +1 -1
  89. package/dist/presets/filesUpload.d.mts +4 -4
  90. package/dist/presets/filesUpload.mjs +4 -4
  91. package/dist/presets/index.d.mts +1 -1
  92. package/dist/presets/index.mjs +1 -1
  93. package/dist/presets/multiTenant.d.mts +1 -1
  94. package/dist/presets/multiTenant.mjs +2 -2
  95. package/dist/presets/search.d.mts +2 -2
  96. package/dist/presets/search.mjs +1 -1
  97. package/dist/{presets-CF79RHEo.mjs → presets-BtyFwTO4.mjs} +2 -2
  98. package/dist/{queryCachePlugin-CnAeFqju.mjs → queryCachePlugin-emHb0CuX.mjs} +4 -4
  99. package/dist/{queryCachePlugin-Bd2tYgh5.d.mts → queryCachePlugin-xzFyKAjT.d.mts} +2 -2
  100. package/dist/{redis-3hqH_Qk_.d.mts → redis-C3W0qbz8.d.mts} +1 -1
  101. package/dist/{redis-stream-BtEUtjxZ.d.mts → redis-stream-DsP1vqZB.d.mts} +1 -1
  102. package/dist/{rateLimit-yKvxWAky.mjs → registerRoute-BdV8DDwU.mjs} +127 -2
  103. package/dist/registry/index.d.mts +1 -1
  104. package/dist/registry/index.mjs +2 -2
  105. package/dist/{registry-Br15xdGM.mjs → registry-Bm9LjWKs.mjs} +1 -1
  106. package/dist/{replyHelpers-DXHVxrrj.mjs → replyHelpers-67tRawQZ.mjs} +1 -1
  107. package/dist/{schemaIR-CE6USIRi.mjs → schemaIR-D1MJwqmp.mjs} +1 -1
  108. package/dist/schemas/index.d.mts +64 -65
  109. package/dist/scope/index.d.mts +2 -2
  110. package/dist/scope/index.mjs +3 -3
  111. package/dist/{sse-BrY1W6U8.mjs → sse-CfUjwjDk.mjs} +7 -4
  112. package/dist/streaming-BQcW6_Kq.mjs +162 -0
  113. package/dist/testing/index.d.mts +7 -7
  114. package/dist/testing/index.mjs +3 -3
  115. package/dist/testing/storageContract.d.mts +1 -1
  116. package/dist/types/index.d.mts +5 -5
  117. package/dist/types/storage.d.mts +1 -1
  118. package/dist/{types-WVlAVp8T.d.mts → types-9_wtNPsI.d.mts} +10 -10
  119. package/dist/{types-BWBcb88c.d.mts → types-DpvSF5Hh.d.mts} +1 -1
  120. package/dist/{types-Bi0r0vjG.mjs → types-bHblZ9YN.mjs} +1 -1
  121. package/dist/utils/index.d.mts +42 -4
  122. package/dist/utils/index.mjs +6 -5
  123. package/dist/{utils-xAQeDyU_.mjs → utils-C6QQ9-hd.mjs} +1415 -1524
  124. package/dist/{validate-0__MuUsK.mjs → validate-CRcaWzp2.mjs} +1 -1
  125. package/dist/{versioning-BSEDGXKC.d.mts → versioning-D_eBCfNr.d.mts} +8 -1
  126. package/dist/{versioning-C0K8KQLx.mjs → versioning-Dk-71iIz.mjs} +1 -1
  127. package/dist/{websocket-BFBT5rH-.d.mts → websocket-MlYlrYq0.d.mts} +1 -1
  128. package/package.json +45 -30
  129. package/dist/EventTransport-7LPXLEUX.mjs +0 -103
  130. package/dist/actionPermissions-CX9QIMTd.mjs +0 -24
  131. package/dist/betterAuthOpenApi-DAAhMZff.mjs +0 -251
  132. package/dist/defineEvent-DC981g-o.mjs +0 -188
  133. package/dist/registerRoute-BEYn0ylk.mjs +0 -108
  134. /package/dist/{EventTransport-CaaXM5Y1.d.mts → EventTransport-IEn7Tn-Q.d.mts} +0 -0
  135. /package/dist/{HookSystem-BfCpWbwM.mjs → HookSystem-C1vB_Gc9.mjs} +0 -0
  136. /package/dist/{constants-TrJVIJl0.mjs → constants-gaEeMlz-.mjs} +0 -0
  137. /package/dist/{elevation-DW90z5bT.d.mts → elevation-xGUBq6p_.d.mts} +0 -0
  138. /package/dist/{errorHandler-_Lp2k9M3.d.mts → errorHandler-BtUUDPEa.d.mts} +0 -0
  139. /package/dist/{errors-DZOemeGa.d.mts → errors-DOHkjQlD.d.mts} +0 -0
  140. /package/dist/{errors-j4aJm1Wg.mjs → errors-DkO8Nk6-.mjs} +0 -0
  141. /package/dist/{externalPaths-DLle0R07.d.mts → externalPaths-BE6wFpYv.d.mts} +0 -0
  142. /package/dist/{generate-Dmk8cfvX.d.mts → generate-BnsL9GBm.d.mts} +0 -0
  143. /package/dist/{init-BS4Daqnv.d.mts → init-BPEu8cs-.d.mts} +0 -0
  144. /package/dist/{interface-DL7LlWS5.d.mts → interface-C1_WLTMK.d.mts} +0 -0
  145. /package/dist/{interface-CsrGR8LF.d.mts → interface-Uk8ONJv7.d.mts} +0 -0
  146. /package/dist/{keys-B3yyBEyH.mjs → keys-Cd316u_y.mjs} +0 -0
  147. /package/dist/{multipartBody-709YcXi1.mjs → multipartBody-CHEQSZ6G.mjs} +0 -0
  148. /package/dist/{pluralize-BxdUl2P4.mjs → pluralize-DccFV9R7.mjs} +0 -0
  149. /package/dist/{preloadResources-B-j-iqo-.mjs → preloadResources-CHw3_oA_.mjs} +0 -0
  150. /package/dist/{pushref-registry-Dqclzjy7.d.mts → pushref-registry-DnCqL3aa.d.mts} +0 -0
  151. /package/dist/{requestContext-DDLS3NVU.mjs → requestContext-BZKOr13H.mjs} +0 -0
  152. /package/dist/{chunk-BpYLSNr0.mjs → rolldown-runtime-8H4AJuhK.mjs} +0 -0
  153. /package/dist/{schemaConverter-DatAaVNj.mjs → schemaConverter-U0MnO9vd.mjs} +0 -0
  154. /package/dist/{sessionManager-CyHpYXoB.d.mts → sessionManager-BXG-HGwG.d.mts} +0 -0
  155. /package/dist/{storage-C5q8fuEt.d.mts → storage-Co_PQpeQ.d.mts} +0 -0
  156. /package/dist/{store-helpers-DjSYI2uP.mjs → store-helpers-DY6xq4sM.mjs} +0 -0
  157. /package/dist/{tracing-Bnb1-YVd.d.mts → tracing-D8jlGXP7.d.mts} +0 -0
  158. /package/dist/{typeGuards-CcFZXgU7.mjs → typeGuards-C9KXUly6.mjs} +0 -0
  159. /package/dist/{types-BJwJN2Pg.d.mts → types-LNebCoJx.d.mts} +0 -0
  160. /package/dist/{types-D57iXYb8.mjs → types-XTApa8b6.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { c as McpAuthResult, l as McpPluginOptions } from "../../types-BWBcb88c.mjs";
1
+ import { c as McpAuthResult, l as McpPluginOptions } from "../../types-DpvSF5Hh.mjs";
2
2
 
3
3
  //#region src/integrations/mcp/testing.d.ts
4
4
  interface TestMcpClientOptions {
@@ -1,4 +1,4 @@
1
- import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-CzKdt3B8.mjs";
1
+ import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-C088Nd-G.mjs";
2
2
  //#region src/integrations/mcp/testing.ts
3
3
  /**
4
4
  * @classytic/arc/mcp/testing — MCP Test Utilities
@@ -1,4 +1,5 @@
1
- import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-j4aJm1Wg.mjs";
1
+ import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-DkO8Nk6-.mjs";
2
+ import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "../streaming-BQcW6_Kq.mjs";
2
3
  import fp from "fastify-plugin";
3
4
  //#region src/integrations/streamline.ts
4
5
  /**
@@ -293,7 +294,9 @@ const streamlinePluginImpl = async (fastify, options) => {
293
294
  }, `Failed to bridge ${eventName}`);
294
295
  });
295
296
  });
296
- if (enableStreaming && wf.container?.eventBus) fastify.get(`${routePrefix}/runs/:runId/stream`, { preHandler: authPreHandler }, async (request, reply) => {
297
+ if (enableStreaming && wf.container?.eventBus) fastify.get(`${routePrefix}/runs/:runId/stream`, { preHandler: [async (request) => {
298
+ promoteStreamTokenToHeader(request);
299
+ }, ...authPreHandler] }, async (request, reply) => {
297
300
  if (!await checkPerm("get", request)) throw new ForbiddenError();
298
301
  const { runId } = request.params;
299
302
  await assertRunVisible(request, runId);
@@ -303,7 +306,8 @@ const streamlinePluginImpl = async (fastify, options) => {
303
306
  "Content-Type": "text/event-stream",
304
307
  "Cache-Control": "no-cache",
305
308
  Connection: "keep-alive",
306
- "X-Accel-Buffering": "no"
309
+ "X-Accel-Buffering": "no",
310
+ ...forwardedStreamHeaders(reply)
307
311
  });
308
312
  reply.raw.flushHeaders();
309
313
  const terminalEvents = new Set(STREAMLINE_TERMINAL_EVENTS);
@@ -1,4 +1,4 @@
1
- import { c as SerializedEntry, i as Principal, n as FencedWriteOutcome, s as PushRefStore, t as EnvelopeSnapshot } from "../pushref-registry-Dqclzjy7.mjs";
1
+ import { c as SerializedEntry, i as Principal, n as FencedWriteOutcome, s as PushRefStore, t as EnvelopeSnapshot } from "../pushref-registry-DnCqL3aa.mjs";
2
2
 
3
3
  //#region src/integrations/websocket-pushref-redis.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { f as WebSocketAdapter } from "../websocket-BFBT5rH-.mjs";
1
+ import { f as WebSocketAdapter } from "../websocket-MlYlrYq0.mjs";
2
2
 
3
3
  //#region src/integrations/websocket-redis.d.ts
4
4
  interface RedisLike {
@@ -1,3 +1,3 @@
1
- import { a as GeoRoomOptions, c as WebSocketClient, d as LocalWebSocketAdapter, f as WebSocketAdapter, i as GeoRoom, l as WebSocketMessage, n as GeoPoint, o as RoomManager, r as GeoPublishOpts, s as AuthResult, t as websocketPlugin, u as WebSocketPluginOptions } from "../websocket-BFBT5rH-.mjs";
2
- import { a as PushRefRegistry, c as SerializedEntry, i as Principal, o as PushRefRegistryOptions, r as MemoryPushRefStore, s as PushRefStore } from "../pushref-registry-Dqclzjy7.mjs";
3
- export { AuthResult, GeoPoint, GeoPublishOpts, GeoRoom, GeoRoomOptions, LocalWebSocketAdapter, MemoryPushRefStore, Principal, PushRefRegistry, PushRefRegistryOptions, PushRefStore, RoomManager, SerializedEntry, WebSocketAdapter, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, websocketPlugin };
1
+ import { a as GeoRoomOptions, c as WebSocketClient, d as LocalWebSocketAdapter, f as WebSocketAdapter, i as GeoRoom, l as WebSocketMessage, n as GeoPoint, o as RoomManager, r as GeoPublishOpts, s as AuthResult, t as websocketPlugin, u as WebSocketPluginOptions } from "../websocket-MlYlrYq0.mjs";
2
+ import { a as PushRefRegistry, c as SerializedEntry, i as Principal, o as PushRefRegistryOptions, r as MemoryPushRefStore, s as PushRefStore } from "../pushref-registry-DnCqL3aa.mjs";
3
+ export { type AuthResult, type GeoPoint, type GeoPublishOpts, GeoRoom, type GeoRoomOptions, LocalWebSocketAdapter, MemoryPushRefStore, type Principal, PushRefRegistry, type PushRefRegistryOptions, type PushRefStore, RoomManager, type SerializedEntry, type WebSocketAdapter, type WebSocketClient, type WebSocketMessage, type WebSocketPluginOptions, websocketPlugin };
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { dirname, join, resolve } from "node:path";
@@ -1,4 +1,4 @@
1
- import { t as ResourceRegistry } from "./ResourceRegistry-CWmOggxS.mjs";
1
+ import { t as ResourceRegistry } from "./ResourceRegistry-5fKZwhK_.mjs";
2
2
  import { resolve } from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  //#region src/cli/utils/loadResourcesFromEntry.ts
@@ -1,15 +1,14 @@
1
- import { p as isArcError, t as ArcError } from "./errors-j4aJm1Wg.mjs";
2
- import { t as BaseController } from "./BaseController-B-uXzf6I.mjs";
3
- import { N as normalizePermissionResult } from "./permissions-3uzwkbQt.mjs";
4
- import { t as executePipeline } from "./pipe-9Tl-OAus.mjs";
5
- import { r as resolvePipelineSteps } from "./pipeline-D4sqiokR.mjs";
6
- import { n as validateAggregations } from "./validate-0__MuUsK.mjs";
7
- import { n as executeAggregation } from "./buildHandler-Cvrc2p7r.mjs";
8
- import { t as pluralize } from "./pluralize-BxdUl2P4.mjs";
9
- import { t as resolveActionPermission } from "./actionPermissions-CX9QIMTd.mjs";
10
- import { i as shouldRejectAdditionalProperties, r as schemaIRToZodShape, t as normalizeSchemaIR } from "./schemaIR-CE6USIRi.mjs";
11
- import { createHash, randomUUID } from "node:crypto";
1
+ import { p as isArcError, t as ArcError } from "./errors-DkO8Nk6-.mjs";
2
+ import { t as BaseController } from "./BaseController-Dy6EQHjM.mjs";
3
+ import { N as normalizePermissionResult } from "./permissions-BPB1xqGf.mjs";
4
+ import { i as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-D7NGwcAR.mjs";
5
+ import { t as executePipeline } from "./pipe-BOLmGIxa.mjs";
6
+ import { t as pluralize } from "./pluralize-DccFV9R7.mjs";
7
+ import { i as shouldRejectAdditionalProperties, r as schemaIRToZodShape, t as normalizeSchemaIR } from "./schemaIR-D1MJwqmp.mjs";
8
+ import { n as validateAggregations } from "./validate-CRcaWzp2.mjs";
9
+ import { n as executeAggregation } from "./buildHandler-B0qvAguf.mjs";
12
10
  import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
11
+ import { createHash, randomUUID } from "node:crypto";
13
12
  import fp from "fastify-plugin";
14
13
  import { z } from "zod";
15
14
  //#region src/integrations/mcp/createMcpServer.ts
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  //#region src/cache/memory.ts
3
3
  var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import fp from "fastify-plugin";
3
3
  //#region src/plugins/metrics.ts
4
4
  var metrics_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-QYma8mdC.mjs";
1
+ import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-CUTG2Cuo.mjs";
2
2
  import { RouteHandlerMethod } from "fastify";
3
3
 
4
4
  //#region src/middleware/middleware.d.ts
@@ -1,5 +1,5 @@
1
- import { t as CRUD_OPERATIONS } from "../constants-TrJVIJl0.mjs";
2
- import { t as multipartBody } from "../multipartBody-709YcXi1.mjs";
1
+ import { t as CRUD_OPERATIONS } from "../constants-gaEeMlz-.mjs";
2
+ import { t as multipartBody } from "../multipartBody-CHEQSZ6G.mjs";
3
3
  //#region src/middleware/middleware.ts
4
4
  /**
5
5
  * Named Middleware — Priority-based, conditional middleware execution.
@@ -1,8 +1,8 @@
1
- import { t as getUserRoles } from "./types-D57iXYb8.mjs";
2
- import { n as convertRouteSchema } from "./schemaConverter-DatAaVNj.mjs";
3
- import { t as pluralize } from "./pluralize-BxdUl2P4.mjs";
4
- import { t as resolveActionPermission } from "./actionPermissions-CX9QIMTd.mjs";
5
- import { t as buildActionBodySchema } from "./createActionRouter-DGCCp-kP.mjs";
1
+ import { t as getUserRoles } from "./types-XTApa8b6.mjs";
2
+ import { n as convertRouteSchema } from "./schemaConverter-U0MnO9vd.mjs";
3
+ import { t as resolveActionPermission } from "./actionPermissions-D7NGwcAR.mjs";
4
+ import { t as pluralize } from "./pluralize-DccFV9R7.mjs";
5
+ import { t as buildActionBodySchema } from "./createActionRouter-B_WzBFyf.mjs";
6
6
  import fp from "fastify-plugin";
7
7
  //#region src/docs/openapi/canonical-schemas.ts
8
8
  /**
@@ -1,3 +1,3 @@
1
- import { a as applyFieldWritePermissions, c as PermissionCheck, d as UserBase, f as getUserRoles, i as applyFieldReadPermissions, l as PermissionContext, n as FieldPermissionMap, o as fields, p as normalizeRoles, r as FieldPermissionType, s as resolveEffectiveRoles, t as FieldPermission, u as PermissionResult } from "../fields-CKLrhyOb.mjs";
2
- import { A as requireRoles, C as allOf, D as not, E as denyAll, F as RequireAgentScopeOptions, I as RequireMandateOptions, L as requireAgentScope, M as when, N as applyPermissionResult, O as requireAuth, P as normalizePermissionResult, R as requireDPoP, S as createOrgPermissions, T as anyOf, _ as ConnectEventsOptions, a as presets_d_exports, b as PermissionEventBus, c as readOnly, d as requireOrgRole, f as requireScopeContext, g as createRoleHierarchy, h as RoleHierarchy, i as ownerWithAdminBypass, j as roles, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig, z as requireMandate } from "../index-vcWUGkwf.mjs";
3
- export { ConnectEventsOptions, DynamicPermissionMatrix, DynamicPermissionMatrixConfig, FieldPermission, FieldPermissionMap, FieldPermissionType, PermissionCheck, PermissionContext, PermissionEventBus, PermissionResult, RequireAgentScopeOptions, RequireMandateOptions, RoleHierarchy, UserBase, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, applyPermissionResult, authenticated, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, denyAll, fields, fullPublic, getUserRoles, normalizePermissionResult, normalizeRoles, not, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, when };
1
+ import { a as applyFieldWritePermissions, c as PermissionCheck, d as UserBase, f as getUserRoles, i as applyFieldReadPermissions, l as PermissionContext, n as FieldPermissionMap, o as fields, p as normalizeRoles, r as FieldPermissionType, s as resolveEffectiveRoles, t as FieldPermission, u as PermissionResult } from "../fields-C7ahdGYf.mjs";
2
+ import { A as requireRoles, C as allOf, D as not, E as denyAll, F as RequireAgentScopeOptions, I as RequireMandateOptions, L as requireAgentScope, M as when, N as applyPermissionResult, O as requireAuth, P as normalizePermissionResult, R as requireDPoP, S as createOrgPermissions, T as anyOf, _ as ConnectEventsOptions, a as presets_d_exports, b as PermissionEventBus, c as readOnly, d as requireOrgRole, f as requireScopeContext, g as createRoleHierarchy, h as RoleHierarchy, i as ownerWithAdminBypass, j as roles, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig, z as requireMandate } from "../index-CRKiiP5o.mjs";
3
+ export { type ConnectEventsOptions, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type FieldPermission, type FieldPermissionMap, type FieldPermissionType, type PermissionCheck, type PermissionContext, type PermissionEventBus, type PermissionResult, type RequireAgentScopeOptions, type RequireMandateOptions, type RoleHierarchy, type UserBase, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, applyPermissionResult, authenticated, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, denyAll, fields, fullPublic, getUserRoles, normalizePermissionResult, normalizeRoles, not, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, when };
@@ -1,3 +1,3 @@
1
- import { A as requireMandate, C as requireAuth, D as when, E as roles, F as applyFieldWritePermissions, I as fields, L as resolveEffectiveRoles, N as normalizePermissionResult, O as requireAgentScope, P as applyFieldReadPermissions, S as not, T as requireRoles, _ as requireTeamMembership, a as presets_exports, b as anyOf, c as readOnly, d as createOrgPermissions, f as requireOrgInScope, g as requireServiceScope, h as requireScopeContext, i as ownerWithAdminBypass, j as applyPermissionResult, k as requireDPoP, l as createRoleHierarchy, m as requireOrgRole, n as authenticated, o as publicRead, p as requireOrgMembership, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as createDynamicPermissionMatrix, v as allOf, w as requireOwnership, x as denyAll, y as allowPublic } from "../permissions-3uzwkbQt.mjs";
2
- import { n as normalizeRoles, t as getUserRoles } from "../types-D57iXYb8.mjs";
1
+ import { A as requireMandate, C as requireAuth, D as when, E as roles, F as applyFieldWritePermissions, I as fields, L as resolveEffectiveRoles, N as normalizePermissionResult, O as requireAgentScope, P as applyFieldReadPermissions, S as not, T as requireRoles, _ as requireTeamMembership, a as presets_exports, b as anyOf, c as readOnly, d as createOrgPermissions, f as requireOrgInScope, g as requireServiceScope, h as requireScopeContext, i as ownerWithAdminBypass, j as applyPermissionResult, k as requireDPoP, l as createRoleHierarchy, m as requireOrgRole, n as authenticated, o as publicRead, p as requireOrgMembership, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as createDynamicPermissionMatrix, v as allOf, w as requireOwnership, x as denyAll, y as allowPublic } from "../permissions-BPB1xqGf.mjs";
2
+ import { n as normalizeRoles, t as getUserRoles } from "../types-XTApa8b6.mjs";
3
3
  export { adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, applyPermissionResult, authenticated, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, denyAll, fields, fullPublic, getUserRoles, normalizePermissionResult, normalizeRoles, not, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, when };
@@ -1,7 +1,7 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
2
- 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, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-Bi0r0vjG.mjs";
3
- import { t as getUserRoles } from "./types-D57iXYb8.mjs";
4
- import { t as MemoryCacheStore } from "./memory-TdTHCS9-.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ 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, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-bHblZ9YN.mjs";
3
+ import { t as getUserRoles } from "./types-XTApa8b6.mjs";
4
+ import { t as MemoryCacheStore } from "./memory-CLXA2VeJ.mjs";
5
5
  import { randomUUID } from "node:crypto";
6
6
  //#region src/permissions/fields.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { r as ForbiddenError } from "./errors-j4aJm1Wg.mjs";
1
+ import { r as ForbiddenError } from "./errors-DkO8Nk6-.mjs";
2
2
  //#region src/pipeline/pipe.ts
3
3
  /**
4
4
  * Compose pipeline steps into an ordered array.
@@ -1,4 +1,4 @@
1
- import { Ft as OperationFilter, It as PipelineConfig, Lt as PipelineContext, Mt as Guard, Nt as Interceptor, Pt as NextFunction, Rt as PipelineStep, yt as IControllerResponse, zt as Transform } from "../index-QYma8mdC.mjs";
1
+ import { Bt as Transform, Ft as NextFunction, It as OperationFilter, Lt as PipelineConfig, Nt as Guard, Pt as Interceptor, Rt as PipelineContext, bt as IControllerResponse, zt as PipelineStep } from "../index-CUTG2Cuo.mjs";
2
2
 
3
3
  //#region src/pipeline/guard.d.ts
4
4
  interface GuardOptions {
@@ -1,4 +1,4 @@
1
- import { n as pipe, t as executePipeline } from "../pipe-9Tl-OAus.mjs";
1
+ import { n as pipe, t as executePipeline } from "../pipe-BOLmGIxa.mjs";
2
2
  //#region src/pipeline/guard.ts
3
3
  /**
4
4
  * Create a named guard.
@@ -1,9 +1,8 @@
1
- import { Kt as AnyRecord, Q as MiddlewareConfig, dt as RouteDefinition, mt as RouteSchemaOptions, nt as PresetHook } from "../index-QYma8mdC.mjs";
2
- import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-BdCl_eNo.mjs";
3
- import { _ as HealthOptions, a as MetricsCollector, c as metricsPlugin, d as ssePlugin, f as CachingOptions, g as HealthCheck, h as cachingPlugin, i as MetricEntry, l as SSEOptions, m as _default$1, n as _default$7, o as MetricsOptions, p as CachingRule, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as _default$6, v as _default$3, y as healthPlugin } from "../versioning-BSEDGXKC.mjs";
4
- import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-_Lp2k9M3.mjs";
5
- import { t as TracingOptions } from "../tracing-Bnb1-YVd.mjs";
6
- import * as _$node_stream0 from "node:stream";
1
+ import { Q as MiddlewareConfig, ft as RouteDefinition, ht as RouteSchemaOptions, nt as PresetHook, qt as AnyRecord } from "../index-CUTG2Cuo.mjs";
2
+ import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-D-5_yQJi.mjs";
3
+ import { _ as HealthOptions, a as MetricsCollector, c as metricsPlugin, d as ssePlugin, f as CachingOptions, g as HealthCheck, h as cachingPlugin, i as MetricEntry, l as SSEOptions, m as _default$1, n as _default$7, o as MetricsOptions, p as CachingRule, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as _default$6, v as _default$3, y as healthPlugin } from "../versioning-D_eBCfNr.mjs";
4
+ import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-BtUUDPEa.mjs";
5
+ import { t as TracingOptions } from "../tracing-D8jlGXP7.mjs";
7
6
  import { PaginatedResult } from "@classytic/repo-core/pagination";
8
7
  import { FastifyInstance, FastifyPluginAsync } from "fastify";
9
8
 
@@ -103,7 +102,7 @@ declare module "fastify" {
103
102
  * @example
104
103
  * return reply.stream(csvReadable, { contentType: 'text/csv', filename: 'export.csv' });
105
104
  */
106
- stream(source: _$node_stream0.Readable | Buffer | AsyncIterable<unknown>, options: {
105
+ stream(source: import("node:stream").Readable | Buffer | AsyncIterable<unknown>, options: {
107
106
  contentType: string;
108
107
  filename?: string;
109
108
  statusCode?: number;
@@ -1,15 +1,15 @@
1
- import { p as MUTATION_OPERATIONS } from "../constants-TrJVIJl0.mjs";
2
- import { c as getOrgId } from "../types-Bi0r0vjG.mjs";
3
- import { n as requestContext } from "../requestContext-DDLS3NVU.mjs";
4
- import { t as hasEvents } from "../typeGuards-CcFZXgU7.mjs";
5
- import { t as HookSystem } from "../HookSystem-BfCpWbwM.mjs";
6
- import { t as ResourceRegistry } from "../ResourceRegistry-CWmOggxS.mjs";
7
- import { n as caching_default, t as cachingPlugin } from "../caching-C0DdKiYB.mjs";
8
- import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-Bua97SEt.mjs";
9
- import { n as metrics_default, t as metricsPlugin } from "../metrics-Da2EUPi9.mjs";
10
- import { t as replyHelpersPlugin } from "../replyHelpers-DXHVxrrj.mjs";
11
- import { n as sse_default, t as ssePlugin } from "../sse-BrY1W6U8.mjs";
12
- import { n as versioning_default, t as versioningPlugin } from "../versioning-C0K8KQLx.mjs";
1
+ import { p as MUTATION_OPERATIONS } from "../constants-gaEeMlz-.mjs";
2
+ import { c as getOrgId } from "../types-bHblZ9YN.mjs";
3
+ import { n as requestContext } from "../requestContext-BZKOr13H.mjs";
4
+ import { t as hasEvents } from "../typeGuards-C9KXUly6.mjs";
5
+ import { t as HookSystem } from "../HookSystem-C1vB_Gc9.mjs";
6
+ import { t as ResourceRegistry } from "../ResourceRegistry-5fKZwhK_.mjs";
7
+ import { n as caching_default, t as cachingPlugin } from "../caching-_NJeDd1_.mjs";
8
+ import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-Dxf6P_kV.mjs";
9
+ import { n as metrics_default, t as metricsPlugin } from "../metrics-fdxI5mn_.mjs";
10
+ import { t as replyHelpersPlugin } from "../replyHelpers-67tRawQZ.mjs";
11
+ import { n as sse_default, t as ssePlugin } from "../sse-CfUjwjDk.mjs";
12
+ import { n as versioning_default, t as versioningPlugin } from "../versioning-Dk-71iIz.mjs";
13
13
  import { randomUUID } from "node:crypto";
14
14
  import fp from "fastify-plugin";
15
15
  //#region src/core/arcCorePlugin.ts
@@ -1,4 +1,4 @@
1
- import { t as hasEvents } from "../typeGuards-CcFZXgU7.mjs";
1
+ import { t as hasEvents } from "../typeGuards-C9KXUly6.mjs";
2
2
  import fp from "fastify-plugin";
3
3
  //#region src/plugins/response-cache.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-Bnb1-YVd.mjs";
1
+ import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-D8jlGXP7.mjs";
2
2
  export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
@@ -58,7 +58,7 @@ try {
58
58
  function createTracerProvider(options) {
59
59
  if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
60
60
  const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
61
- const resolvedVersion = serviceVersion ?? "2.18.4";
61
+ const resolvedVersion = serviceVersion ?? "2.19.0";
62
62
  const exporter = new OTLPTraceExporter({ url: exporterUrl });
63
63
  const provider = new NodeTracerProvider({ resource: { attributes: {
64
64
  "service.name": serviceName,
@@ -1,7 +1,7 @@
1
- import { rt as PresetResult } from "../index-QYma8mdC.mjs";
2
- import { i as RequestScope } from "../types-BJwJN2Pg.mjs";
3
- import { c as PermissionCheck } from "../fields-CKLrhyOb.mjs";
4
- import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-C5q8fuEt.mjs";
1
+ import { rt as PresetResult } from "../index-CUTG2Cuo.mjs";
2
+ import { i as RequestScope } from "../types-LNebCoJx.mjs";
3
+ import { c as PermissionCheck } from "../fields-C7ahdGYf.mjs";
4
+ import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Co_PQpeQ.mjs";
5
5
 
6
6
  //#region src/presets/filesUpload.d.ts
7
7
  interface FilesUploadPresetRoutes {
@@ -1,7 +1,7 @@
1
- import { i as NotFoundError, u as ValidationError } from "../errors-j4aJm1Wg.mjs";
2
- import { c as getOrgId, g as getUserId } from "../types-Bi0r0vjG.mjs";
3
- import { C as requireAuth, y as allowPublic } from "../permissions-3uzwkbQt.mjs";
4
- import { t as multipartBody } from "../multipartBody-709YcXi1.mjs";
1
+ import { i as NotFoundError, u as ValidationError } from "../errors-DkO8Nk6-.mjs";
2
+ import { c as getOrgId, g as getUserId } from "../types-bHblZ9YN.mjs";
3
+ import { C as requireAuth, y as allowPublic } from "../permissions-BPB1xqGf.mjs";
4
+ import { t as multipartBody } from "../multipartBody-CHEQSZ6G.mjs";
5
5
  //#region src/presets/filesUpload.ts
6
6
  const DEFAULT_FIELD_NAME = "file";
7
7
  const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
@@ -1,4 +1,4 @@
1
- import { Kt as AnyRecord, bt as IRequestContext, d as PaginationResult, rt as PresetResult, st as ResourceConfig, yt as IControllerResponse } from "../index-QYma8mdC.mjs";
1
+ import { bt as IControllerResponse, d as PaginationResult, qt as AnyRecord, rt as PresetResult, st as ResourceConfig, xt as IRequestContext } from "../index-CUTG2Cuo.mjs";
2
2
  import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
3
3
  import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
4
4
  import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
@@ -1,5 +1,5 @@
1
1
  import { multiTenantPreset } from "./multiTenant.mjs";
2
- import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-CF79RHEo.mjs";
2
+ import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-BtyFwTO4.mjs";
3
3
  import { filesUploadPreset } from "./filesUpload.mjs";
4
4
  import { searchPreset } from "./search.mjs";
5
5
  export { applyPresets, auditedPreset, bulkPreset, filesUploadPreset, flexibleMultiTenantPreset, getAvailablePresets, getPreset, multiTenantPreset, ownedByUserPreset, registerPreset, searchPreset, slugLookupPreset, softDeletePreset, treePreset };
@@ -1,4 +1,4 @@
1
- import { J as CrudRouteKey, rt as PresetResult } from "../index-QYma8mdC.mjs";
1
+ import { J as CrudRouteKey, rt as PresetResult } from "../index-CUTG2Cuo.mjs";
2
2
 
3
3
  //#region src/presets/multiTenant.d.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import "../constants-TrJVIJl0.mjs";
2
- import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-Bi0r0vjG.mjs";
1
+ import "../constants-gaEeMlz-.mjs";
2
+ import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-bHblZ9YN.mjs";
3
3
  //#region src/presets/multiTenant.ts
4
4
  /**
5
5
  * Resolve a single TenantFieldSpec against the current scope.
@@ -1,5 +1,5 @@
1
- import { dt as RouteDefinition, ft as RouteMcpConfig, ht as ControllerHandler, rt as PresetResult } from "../index-QYma8mdC.mjs";
2
- import { c as PermissionCheck } from "../fields-CKLrhyOb.mjs";
1
+ import { ft as RouteDefinition, gt as ControllerHandler, pt as RouteMcpConfig, rt as PresetResult } from "../index-CUTG2Cuo.mjs";
2
+ import { c as PermissionCheck } from "../fields-C7ahdGYf.mjs";
3
3
 
4
4
  //#region src/presets/search.d.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { C as requireAuth, y as allowPublic } from "../permissions-3uzwkbQt.mjs";
1
+ import { C as requireAuth, y as allowPublic } from "../permissions-BPB1xqGf.mjs";
2
2
  //#region src/presets/search.ts
3
3
  const BUILTINS = [
4
4
  {
@@ -1,5 +1,5 @@
1
- import { b as isElevated, n as PUBLIC_SCOPE } from "./types-Bi0r0vjG.mjs";
2
- import { C as requireAuth, T as requireRoles, y as allowPublic } from "./permissions-3uzwkbQt.mjs";
1
+ import { b as isElevated, n as PUBLIC_SCOPE } from "./types-bHblZ9YN.mjs";
2
+ import { C as requireAuth, T as requireRoles, y as allowPublic } from "./permissions-BPB1xqGf.mjs";
3
3
  import { multiTenantPreset } from "./presets/multiTenant.mjs";
4
4
  //#region src/presets/ownedByUser.ts
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
2
- import { t as MemoryCacheStore } from "./memory-TdTHCS9-.mjs";
3
- import { t as hasEvents } from "./typeGuards-CcFZXgU7.mjs";
4
- import { i as versionKey, r as tagVersionKey } from "./keys-B3yyBEyH.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { i as versionKey, r as tagVersionKey } from "./keys-Cd316u_y.mjs";
3
+ import { t as MemoryCacheStore } from "./memory-CLXA2VeJ.mjs";
4
+ import { t as hasEvents } from "./typeGuards-C9KXUly6.mjs";
5
5
  import fp from "fastify-plugin";
6
6
  //#region src/cache/QueryCache.ts
7
7
  var QueryCache = class {
@@ -1,5 +1,5 @@
1
- import { r as CacheStore } from "./interface-DL7LlWS5.mjs";
2
- import { i as QueryCache } from "./QueryCache-Dsyv2mLS.mjs";
1
+ import { r as CacheStore } from "./interface-C1_WLTMK.mjs";
2
+ import { i as QueryCache } from "./QueryCache-TRfXau3W.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
 
5
5
  //#region src/cache/queryCachePlugin.d.ts
@@ -1,4 +1,4 @@
1
- import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-CsrGR8LF.mjs";
1
+ import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-Uk8ONJv7.mjs";
2
2
 
3
3
  //#region src/idempotency/stores/redis.d.ts
4
4
  interface RedisClient {
@@ -1,4 +1,4 @@
1
- import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-CaaXM5Y1.mjs";
1
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-IEn7Tn-Q.mjs";
2
2
 
3
3
  //#region src/events/transports/redis-stream.d.ts
4
4
  interface RedisStreamLike {
@@ -1,4 +1,6 @@
1
- import { n as requestContext } from "./requestContext-DDLS3NVU.mjs";
1
+ import { f as createError } from "./errors-DkO8Nk6-.mjs";
2
+ import { M as evaluateAndApplyPermission } from "./permissions-BPB1xqGf.mjs";
3
+ import { n as requestContext } from "./requestContext-BZKOr13H.mjs";
2
4
  //#region src/core/middlewares/arcDecorator.ts
3
5
  /**
4
6
  * Build the `arcDecorator` preHandler for a resource.
@@ -157,6 +159,76 @@ function describeValue(v) {
157
159
  return `${typeof v} (${JSON.stringify(v).slice(0, 80)})`;
158
160
  }
159
161
  //#endregion
162
+ //#region src/core/middlewares/permissions.ts
163
+ /**
164
+ * Build a PermissionContext from a Fastify request. Extracted so the CRUD
165
+ * permission middleware and the dynamic action-permission check use the same
166
+ * field layout — divergence here silently broke policy filters for actions.
167
+ */
168
+ function buildPermissionContext(req, opts) {
169
+ const reqWithExtras = req;
170
+ const params = req.params;
171
+ return {
172
+ user: reqWithExtras.user ?? null,
173
+ request: req,
174
+ resource: opts.resource,
175
+ action: opts.action,
176
+ resourceId: opts.resourceId ?? params?.id,
177
+ params,
178
+ data: opts.data ?? req.body
179
+ };
180
+ }
181
+ /**
182
+ * Static per-route CRUD permission gate. The permission and action are known
183
+ * at route-registration time, so the gate is a plain preHandler.
184
+ *
185
+ * Actions use the dynamic counterpart `buildActionPermissionMw` — their
186
+ * permission is resolved from `body.action` at request time.
187
+ */
188
+ function buildCrudPermissionMw(permissionCheck, resourceName, action) {
189
+ if (!permissionCheck) return null;
190
+ return async (req, reply) => {
191
+ await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
192
+ resource: resourceName,
193
+ action
194
+ }), req, reply);
195
+ };
196
+ }
197
+ /**
198
+ * Dynamic per-action permission gate for the action router.
199
+ *
200
+ * Resolves the permission from `body.action` at request time and runs
201
+ * `evaluateAndApplyPermission` from the canonical `permissionMw` slot — so
202
+ * `_policyFilters` and `request.scope` are installed BEFORE `pluginMw`
203
+ * (idempotency) and `routeGuards` run. Previously this check lived inside
204
+ * the main action handler, which meant idempotency recorded unauthorized
205
+ * requests and route guards saw unfiltered scope — the very divergence
206
+ * routerShared exists to prevent.
207
+ *
208
+ * Also acts as a defensive fallback for invalid action names — the
209
+ * `oneOf` body schema normally rejects these at AJV validation, but
210
+ * hosts that disable schema validation still get a 400 here.
211
+ */
212
+ function buildActionPermissionMw(actionEnum, actionPermissions, globalAuth, resourceName) {
213
+ const enumSet = new Set(actionEnum);
214
+ const validActions = [...actionEnum];
215
+ return async (req, reply) => {
216
+ const body = req.body ?? {};
217
+ const action = body.action;
218
+ if (!action || !enumSet.has(action)) throw createError(400, `Invalid action '${action ?? ""}'. Valid actions: ${validActions.join(", ")}`, { validActions });
219
+ const permissionCheck = actionPermissions[action] ?? globalAuth;
220
+ if (!permissionCheck) return;
221
+ const { action: _discard, ...data } = body;
222
+ const params = req.params;
223
+ await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
224
+ resource: resourceName,
225
+ action,
226
+ resourceId: params?.id,
227
+ data
228
+ }), req, reply, { defaultDenialMessage: (user) => user ? `Permission denied for '${action}'` : "Authentication required" });
229
+ };
230
+ }
231
+ //#endregion
160
232
  //#region src/core/middlewares/pluginMw.ts
161
233
  /**
162
234
  * Pick the request-lifecycle plugin middleware for an HTTP method:
@@ -188,6 +260,24 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
188
260
  //#endregion
189
261
  //#region src/core/middlewares/rateLimit.ts
190
262
  /**
263
+ * Build the per-route Fastify `config` object shared by the CRUD, custom, and
264
+ * action routers. Two independent concerns ride on `routeOptions.config`:
265
+ * - `config.rateLimit` — read by `@fastify/rate-limit`.
266
+ * - `config.arcExtensions` — read by arc plugins (encryption, …) at request
267
+ * time, sourced from `defineResource({ extensions })`.
268
+ *
269
+ * Returns `{}` (no `config` key) when neither is present, so routes without
270
+ * either stay config-free and the spread is a genuine no-op. Both fields are
271
+ * optional in the return type, so no cast is needed when only one is set.
272
+ */
273
+ function buildRouteConfig(rateLimitConfig, extensions) {
274
+ if (!rateLimitConfig && !extensions) return {};
275
+ return { config: {
276
+ ...rateLimitConfig ?? {},
277
+ ...extensions ? { arcExtensions: extensions } : {}
278
+ } };
279
+ }
280
+ /**
191
281
  * Build the `config` object for Fastify route options so
192
282
  * @fastify/rate-limit picks up per-route overrides.
193
283
  *
@@ -204,4 +294,39 @@ function buildRateLimitConfig(rateLimit) {
204
294
  } };
205
295
  }
206
296
  //#endregion
207
- export { resolveRoutePreHandlers as a, buildArcDecorator as c, buildPreHandlerChain as i, resolveRouterPluginMw as n, buildAuthMiddleware as o, selectPluginMw as r, buildAuthMiddlewareForPermissions as s, buildRateLimitConfig as t };
297
+ //#region src/core/middlewares/registerRoute.ts
298
+ /**
299
+ * Register a route with friendly handling of `FST_ERR_DUPLICATED_ROUTE`.
300
+ *
301
+ * Boot-time `validateRouteCrudCollisions()` catches custom-route → auto-CRUD
302
+ * overlaps before Fastify ever runs, but a few cases still slip through to
303
+ * Fastify itself: two presets contributing the same `routes` entry, hosts
304
+ * mounting two resources at the same prefix, custom routes that share a
305
+ * URL with another plugin. Fastify's default message ("Method 'GET'
306
+ * already declared for route '/'") gives no hint at the resource-shaped
307
+ * fix — `disabledRoutes: ['list']` — so wrap it with one.
308
+ */
309
+ function tryRegisterRoute(fastify, opts, context) {
310
+ try {
311
+ fastify.route(opts);
312
+ } catch (err) {
313
+ const fastifyErr = err;
314
+ if (fastifyErr?.code !== "FST_ERR_DUPLICATED_ROUTE") throw err;
315
+ const method = opts.method;
316
+ const url = opts.url;
317
+ const opHint = context.op ? ` (op: ${context.op})` : "";
318
+ const fixHint = context.op && [
319
+ "list",
320
+ "get",
321
+ "create",
322
+ "update",
323
+ "delete"
324
+ ].includes(context.op) ? ` Suppress the auto-CRUD route with \`disabledRoutes: ['${context.op}']\`.` : " If a custom route in `routes:` collides with auto-CRUD, add `disabledRoutes: ['list' | 'get' | 'create' | 'update' | 'delete']` to `defineResource()` to suppress the matching auto-CRUD route.";
325
+ const enhanced = /* @__PURE__ */ new Error(`[arc] Duplicate route ${method} ${url} on resource "${context.resourceName}"${opHint}.${fixHint} Original: ${fastifyErr.message ?? "FST_ERR_DUPLICATED_ROUTE"}`);
326
+ enhanced.code = "FST_ERR_DUPLICATED_ROUTE";
327
+ enhanced.cause = err;
328
+ throw enhanced;
329
+ }
330
+ }
331
+ //#endregion
332
+ export { selectPluginMw as a, buildPreHandlerChain as c, buildAuthMiddlewareForPermissions as d, buildArcDecorator as f, resolveRouterPluginMw as i, resolveRoutePreHandlers as l, buildRateLimitConfig as n, buildActionPermissionMw as o, buildRouteConfig as r, buildCrudPermissionMw as s, tryRegisterRoute as t, buildAuthMiddleware as u };
@@ -1,4 +1,4 @@
1
- import { J as CrudRouteKey, R as RegisterOptions, V as ResourceDefinition, at as ResolvedTenantPurge, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-QYma8mdC.mjs";
1
+ import { J as CrudRouteKey, R as RegisterOptions, V as ResourceDefinition, at as ResolvedTenantPurge, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-CUTG2Cuo.mjs";
2
2
  import { FastifyPluginAsync } from "fastify";
3
3
  import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
4
4
 
@@ -1,3 +1,3 @@
1
- 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-Br15xdGM.mjs";
2
- import { t as ResourceRegistry } from "../ResourceRegistry-CWmOggxS.mjs";
1
+ 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-Bm9LjWKs.mjs";
2
+ import { t as ResourceRegistry } from "../ResourceRegistry-5fKZwhK_.mjs";
3
3
  export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
@@ -1,4 +1,4 @@
1
- import { t as CRUD_OPERATIONS } from "./constants-TrJVIJl0.mjs";
1
+ import { t as CRUD_OPERATIONS } from "./constants-gaEeMlz-.mjs";
2
2
  import fp from "fastify-plugin";
3
3
  //#region src/registry/assertNoTenantData.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { toCanonicalList } from "@classytic/repo-core/pagination";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/plugins/replyHelpers.ts