@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,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.mjs";
3
- import { t as startRenewingLease } from "./renewingLease-DuRGVOMe.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
+ import { t as runWorkScope } from "./workScope-CoGpuzDX.mjs";
4
+ import { t as startRenewingLease } from "./renewingLease-B5Grm0pI.mjs";
4
5
  import fp from "fastify-plugin";
5
6
  //#region src/plugins/schedules.ts
6
7
  var schedules_exports = /* @__PURE__ */ __exportAll({
@@ -60,7 +61,10 @@ const schedulesPlugin = async (fastify, opts) => {
60
61
  }
61
62
  stat.runs++;
62
63
  stat.lastRunAt = (/* @__PURE__ */ new Date()).toISOString();
63
- await s.handler(fastify);
64
+ await runWorkScope({
65
+ kind: "job",
66
+ id: s.name
67
+ }, () => s.handler(fastify));
64
68
  stat.lastError = null;
65
69
  } catch (err) {
66
70
  stat.failures++;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  //#region src/utils/schemaConverter.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { o as toJsonSchema } from "./schemaConverter-Db-MMsH6.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { o as toJsonSchema } from "./schemaConverter-DENbixyA.mjs";
3
3
  //#region src/core/schemaIR.ts
4
4
  /**
5
5
  * Schema IR — one canonical representation, two adapters.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
3
3
  import { Type, Type as Type$1 } from "typebox";
4
4
  //#region src/schemas/index.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as parseJsonBody } from "../jsonBody-DVui0uJl.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as parseJsonBody } from "../jsonBody-Dx6jH_Nb.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/scim/errors.ts
5
5
  var ScimError = class extends Error {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-BqLyyH0o.mjs";
3
- import { n as elevation_default, t as elevationPlugin } from "../elevation-C6woysGC.mjs";
4
- import { t as createTenantKeyGenerator } from "../rateLimitKey-CewdR-m6.mjs";
5
- import { t as resolveOrgFromHeader } from "../scope-D03sk17n.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-CNQyOrLk.mjs";
3
+ import { n as elevation_default, t as elevationPlugin } from "../elevation-CZy6n50b.mjs";
4
+ import { t as createTenantKeyGenerator } from "../rateLimitKey-umrS6-vu.mjs";
5
+ import { t as resolveOrgFromHeader } from "../scope-CdYxQVxt.mjs";
6
6
  export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-2ExmOgIJ.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-DeXNifVj.mjs";
4
- import { n as getUserRoles } from "./userHelpers-CXySQFRg.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-BHD3L8of.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
4
+ import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
5
5
  //#region src/scope/resolveOrgFromHeader.ts
6
6
  /**
7
7
  * Create a preHandler hook that resolves org scope from a header.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/simpleEqualityMatcher.ts
3
3
  /**
4
4
  * `simpleEqualityMatcher` — a minimal, dialect-agnostic flat-key equality
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.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 { c as getOrgId, n as PUBLIC_SCOPE } from "./types-BqLyyH0o.mjs";
5
- import { a as promoteStreamTokenToHeader } from "./streaming-DkpW1HwJ.mjs";
6
- import { t as openSseStream } from "./sseStream-BuMNPR6r.mjs";
4
+ import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-CNQyOrLk.mjs";
5
+ import { a as promoteStreamTokenToHeader } from "./streaming-CFwCzEvU.mjs";
6
+ import { t as openSseStream } from "./sseStream-BfZtL5-m.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  //#region src/plugins/sse.ts
9
9
  var sse_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { n as forwardedStreamHeaders } from "./streaming-DkpW1HwJ.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as forwardedStreamHeaders } from "./streaming-CFwCzEvU.mjs";
3
3
  //#region src/utils/sseStream.ts
4
4
  /**
5
5
  * Take over the reply socket and open an SSE stream. Call ONLY after every
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/store-helpers.ts
3
3
  /**
4
4
  * Classify an error thrown by `getOne` / `getById` / `update` as a
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { Readable } from "node:stream";
3
3
  //#region src/utils/streaming.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { r as createEvent } from "./EventTransport-Gq7JWbWw.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { r as createEvent } from "./EventTransport-BUkTwY_x.mjs";
3
3
  //#region src/events/defineEvent.ts
4
4
  /**
5
5
  * Typed event declarations, a registry for introspection, and `.create()` to
@@ -1,3 +1,3 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { CursorExpiredError, MemoryChangeLogStore } from "@classytic/repo-core/sync";
3
3
  export { CursorExpiredError, MemoryChangeLogStore };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/cleanupStoreContract.ts
4
4
  /**
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { i as RequestScope } from "../types-Ddl9OjmE.mjs";
3
3
  import { l as PermissionCheck, t as AnyRecord } from "../base-C-NL2fTi.mjs";
4
- import { V as ResourceDefinition } from "../index-B78WZom8.mjs";
5
- import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BRU-Kd3t.mjs";
6
- import "../index-D2uIUSQk.mjs";
7
- import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-BbBkNkqK.mjs";
4
+ import { V as ResourceDefinition } from "../index-D3sIPcD4.mjs";
5
+ import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BVlowlm7.mjs";
6
+ import "../index-DbMglURO.mjs";
7
+ import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-DVgPCNcD.mjs";
8
8
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
9
9
  import { StandardRepo } from "@classytic/repo-core/repository";
10
10
  import { FastifyInstance, FastifyServerOptions } from "fastify";
@@ -1,12 +1,12 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-BONghE1Y.mjs";
3
- import { g as getUserId } from "../types-BqLyyH0o.mjs";
4
- import { t as BaseController } from "../BaseController-CYaDvmOB.mjs";
5
- import { t as defineAggregation } from "../defineAggregation-0KBvqEEC.mjs";
6
- import { t as defineResource } from "../defineResource-BMdyRelW.mjs";
7
- import { E as requireOrgRole } from "../permissions-H7Zcb82Z.mjs";
8
- import { a as createApp, n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-DlhH81py.mjs";
9
- import { n as getModuleExports } from "../module-BQXHxMEk.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-BQ2FbhPB.mjs";
3
+ import { g as getUserId } from "../types-CNQyOrLk.mjs";
4
+ import { t as BaseController } from "../BaseController-BqJtbiUA.mjs";
5
+ import { t as defineAggregation } from "../defineAggregation-BDA2Tw7v.mjs";
6
+ import { t as defineResource } from "../defineResource-DaIySrQr.mjs";
7
+ import { E as requireOrgRole } from "../permissions-C0GpDsB_.mjs";
8
+ import { a as createApp, n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-BAx5s9EF.mjs";
9
+ import { n as getModuleExports } from "../module-CNcwCKUJ.mjs";
10
10
  import { runStorageContract } from "./storageContract.mjs";
11
11
  import Fastify from "fastify";
12
12
  import { afterAll, describe, expect, it, vi } from "vitest";
@@ -1504,7 +1504,7 @@ function pickDefaultAuth(authMode, callerAuth) {
1504
1504
  };
1505
1505
  }
1506
1506
  async function createTestApp(options = {}) {
1507
- const { createApp } = await import("../preloadResources-DlhH81py.mjs").then((n) => n.o);
1507
+ const { createApp } = await import("../preloadResources-BAx5s9EF.mjs").then((n) => n.o);
1508
1508
  const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
1509
1509
  let dbHandle;
1510
1510
  let dbUri;
@@ -1,9 +1,20 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { OutboxOwnershipError } from "@classytic/primitives/outbox";
3
3
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
4
4
  //#region src/testing/outboxStoreContract.ts
5
5
  let seq = 0;
6
- /** A minimal well-formed event. Ids are unique per call. */
6
+ /**
7
+ * A minimal well-formed event. Ids are unique per call.
8
+ *
9
+ * It was NOT well-formed until 2.40: `meta` carried `occurredAt: string`, which
10
+ * is not a field of `EventMeta`, and omitted the REQUIRED `timestamp: Date`.
11
+ * An `as unknown as DomainEvent` made it compile — a total override that hid the
12
+ * mismatch, so every third party running this shipped suite conformance-tested
13
+ * their store against an event shape the transports never produce. `createEvent`
14
+ * in `@classytic/primitives` is the reference: `{ id, timestamp: new Date() }`.
15
+ *
16
+ * No cast now — if `EventMeta` changes, this stops compiling, which is the point.
17
+ */
7
18
  function event(type = "test.event") {
8
19
  seq += 1;
9
20
  return {
@@ -11,7 +22,7 @@ function event(type = "test.event") {
11
22
  payload: { n: seq },
12
23
  meta: {
13
24
  id: `evt-${Date.now()}-${seq}`,
14
- occurredAt: (/* @__PURE__ */ new Date()).toISOString()
25
+ timestamp: /* @__PURE__ */ new Date()
15
26
  }
16
27
  };
17
28
  }
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/storageContract.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.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/context/transactionContext.ts
4
4
  /**
@@ -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/utils/typeGuards.ts
3
3
  /** Check if fastify has the events plugin registered */
4
4
  function hasEvents(instance) {
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { i as RequestScope } from "../types-Ddl9OjmE.mjs";
3
3
  import { a as UserLike, c as DataPolicy, d as UserBase, i as ObjectId, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "../base-C-NL2fTi.mjs";
4
- import { $ as OpenApiSchemas, A as RequestIdOptions, An as WriteVerbKey, At as RouteDefinition, C as RequestContext, D as HealthCheck, Dn as MutationWriteContext, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, G as OnTenantDeleteConfig, H as CrudController, I as MiddlewareHandler, In as IRequestContext, It as Authenticator, J as PresetHook, K as ResolvedTenantPurge, L as RequestWithExtras, Ln as RawRouteHandler, Lt as AuthenticatorContext, M as EventsDecorator, Mn as ControllerLike, Mt as RouteMethod, N as FastifyRequestExtras, Nn as FastifyHandler, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, Ot as ActionHandlerFn, P as FastifyWithAuth, Pn as IController, Pt as AuthHelpers, Q as MiddlewareConfig, Rn as RouteHandler, Rt as JwtContext, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, W as ResourcePermissions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jn as ControllerHandler, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kn as WriteContext, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, xn as BaseControllerOptions, y as OwnershipCheck, zt as TokenPair } from "../index-B78WZom8.mjs";
4
+ import { $ as OpenApiSchemas, A as RequestIdOptions, An as WriteVerbKey, At as RouteDefinition, C as RequestContext, D as HealthCheck, Dn as MutationWriteContext, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, G as OnTenantDeleteConfig, H as CrudController, I as MiddlewareHandler, In as IRequestContext, It as Authenticator, J as PresetHook, K as ResolvedTenantPurge, L as RequestWithExtras, Ln as RawRouteHandler, Lt as AuthenticatorContext, M as EventsDecorator, Mn as ControllerLike, Mt as RouteMethod, N as FastifyRequestExtras, Nn as FastifyHandler, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, Ot as ActionHandlerFn, P as FastifyWithAuth, Pn as IController, Pt as AuthHelpers, Q as MiddlewareConfig, Rn as RouteHandler, Rt as JwtContext, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, W as ResourcePermissions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jn as ControllerHandler, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kn as WriteContext, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, xn as BaseControllerOptions, y as OwnershipCheck, zt as TokenPair } from "../index-D3sIPcD4.mjs";
5
5
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-BXCfVcNG.mjs";
6
6
  export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, AuthorizationDecision, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, DataPolicy, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, MutationWriteContext, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RawRouteHandler, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, ResourceWrites, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, WriteContext, WriteVerbKey };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,5 +1,5 @@
1
1
 
2
- import { V as ResourceDefinition } from "./index-B78WZom8.mjs";
2
+ import { V as ResourceDefinition } from "./index-D3sIPcD4.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/integrations/mcp/types.d.ts
5
5
  /** Behavioral hints for MCP clients (tool annotations per MCP spec) */
@@ -275,6 +275,51 @@ interface McpPluginOptions {
275
275
  * - `McpAuthResolver` — custom function that resolves identity from headers
276
276
  */
277
277
  auth?: BetterAuthHandler | McpAuthResolver | false;
278
+ /**
279
+ * DNS-rebinding protection for the MCP routes — `Host` / `Origin` validation.
280
+ *
281
+ * The attack this closes: a page the developer visits can POST to
282
+ * `127.0.0.1:<port>`. If a DNS name the attacker controls resolves to
283
+ * loopback, the browser treats the response as same-origin and the page can
284
+ * READ it — every registered tool, from any website. Validating that `Host`
285
+ * names a host you expect is what breaks it, which is why the MCP SDK ships
286
+ * this as a default for localhost servers.
287
+ *
288
+ * **Default: on when `auth: false`, off otherwise.** Not a guess — it follows
289
+ * the threat:
290
+ * - `auth: false` is the local/dev shape the attack targets, and nothing else
291
+ * is standing in the way. Defaults to the SDK's localhost set
292
+ * (`localhost`, `127.0.0.1`, `[::1]`).
293
+ * - With auth configured, the endpoint is normally a real domain whose `Host`
294
+ * is not localhost — defaulting protection ON would 403 every production
295
+ * deployment. There, credentials are the gate.
296
+ *
297
+ * Set explicitly whenever the default's assumption is wrong for you: a
298
+ * localhost server that DOES use auth, or a deliberately-public `auth: false`
299
+ * endpoint that must keep answering (`false` to disable).
300
+ *
301
+ * Validation itself is `@modelcontextprotocol/server`'s `validateHostHeader` /
302
+ * `validateOriginHeader` — arc does not reimplement the matching rules.
303
+ * Hostnames only, no scheme or port; IPv6 in brackets (`[::1]`). A request
304
+ * with no `Origin` header passes (non-browser MCP clients send none); a
305
+ * present-but-unlisted `Origin` is rejected.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * // localhost server that uses auth — opt in explicitly
310
+ * mcpPlugin({ resources, auth, dnsRebindingProtection: {} });
311
+ * // reachable under a known public name
312
+ * mcpPlugin({ resources, dnsRebindingProtection: { allowedHosts: ['mcp.example.com'] } });
313
+ * // deliberately public, no Host constraint
314
+ * mcpPlugin({ resources, auth: false, dnsRebindingProtection: false });
315
+ * ```
316
+ */
317
+ dnsRebindingProtection?: false | {
318
+ /** Allowed `Host` hostnames. Default: `localhost`, `127.0.0.1`, `[::1]`. */
319
+ allowedHosts?: string[];
320
+ /** Allowed `Origin` hostnames. Default: same localhost set. */
321
+ allowedOrigins?: string[];
322
+ };
278
323
  /** MCP endpoint path (default: '/mcp') */
279
324
  prefix?: string;
280
325
  /** Server identity */
@@ -1,6 +1,6 @@
1
1
 
2
- import { n as DomainEvent, r as EventHandler } from "./EventTransport-Cx60_s-6.mjs";
3
- import { n as ErrorMapper } from "./errorHandler-DI5AN2b5.mjs";
2
+ import { n as DomainEvent, r as EventHandler } from "./EventTransport-BPOQsEer.mjs";
3
+ import { n as ErrorMapper } from "./errorHandler--4rSMMvq.mjs";
4
4
  import { FastifyInstance, FastifyPluginAsync } from "fastify";
5
5
  import { LockAdapter } from "@classytic/repo-core/lock";
6
6
  //#region src/plugins/health.d.ts
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-2ExmOgIJ.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-DeXNifVj.mjs";
4
- import { t as getUserId$1 } from "./userHelpers-CXySQFRg.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-BHD3L8of.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
4
+ import { t as getUserId$1 } from "./userHelpers-DLueLQdQ.mjs";
5
5
  //#region src/scope/types.ts
6
6
  /**
7
7
  * Request Scope — The One Standard
Binary file
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/userHelpers.ts
3
3
  /**
4
4
  * Extract a user ID from a user object. Accepts `id` or `_id` — returns
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { F as getHeader, I as requireSingleHeaderValue, P as ArcHeaders } from "../types-Ddl9OjmE.mjs";
3
3
  import { f as getUserId, m as normalizeRoles, p as getUserRoles, t as AnyRecord } from "../base-C-NL2fTi.mjs";
4
- import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-B78WZom8.mjs";
5
- import { n as ErrorMapper } from "../errorHandler-DI5AN2b5.mjs";
4
+ import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-D3sIPcD4.mjs";
5
+ import { n as ErrorMapper } from "../errorHandler--4rSMMvq.mjs";
6
6
  import { a as NotFoundError, c as RateLimitError, d as ValidationError, f as createDomainError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorOptions, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-BGdVwP25.mjs";
7
7
  import { scheduleBackground } from "@classytic/repo-core/cache";
8
8
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
@@ -691,8 +691,8 @@ declare const paginationSchema: JsonSchema;
691
691
  * validation PER RESPONSE to pick the branch, on the hottest route of
692
692
  * every arc app. The merge keeps the exact bytes (pinned by
693
693
  * `tests/utils/list-response-serialization.test.ts`) and drops the
694
- * per-response branch validation. Only `data` is required — the one field
695
- * all four variants share.
694
+ * per-response branch validation. The list route also serves count, exists
695
+ * and distinct dispatch verbs, so no field is common to every valid shape.
696
696
  */
697
697
  declare function listResponse(itemSchema: JsonSchema): JsonSchema;
698
698
  /** Offset variant — `{ method: 'offset', data, page, limit, total, pages, hasNext, hasPrev }`. */
@@ -1,12 +1,12 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-2ExmOgIJ.mjs";
3
- import { n as requireSingleHeaderValue, t as getHeader } from "../headers-DeXNifVj.mjs";
4
- import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-CXySQFRg.mjs";
5
- import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-B7qVjQBv.mjs";
6
- import { A as scheduleBackground, C as paginationSchema, D as createQueryParser, E as ArcQueryParser, O as MONGO_DIALECT, S as offsetListResponse, T as responses, _ as errorDetailSchema, a as defineCompensation, b as keysetListResponse, c as CircuitBreakerError, d as createCircuitBreaker, f as createCircuitBreakerRegistry, g as errorContractSchema, h as deleteResponse, i as defineErrorMapper, k as NEUTRAL_DIALECT, l as CircuitBreakerRegistry, m as bareListResponse, n as handleRaw, o as withCompensation, p as aggregateListResponse, r as defineGuard, s as CircuitBreaker, t as createStateMachine, u as CircuitState, v as getDefaultCrudSchemas, w as queryParams, x as listResponse, y as getListQueryParams } from "../utils-BbGG8XNT.mjs";
7
- import { a as isZodSchema, i as isJsonSchema, n as convertRouteSchema, o as toJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-Db-MMsH6.mjs";
8
- import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-DkpW1HwJ.mjs";
9
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-D793Pxci.mjs";
10
- import { t as openSseStream } from "../sseStream-BuMNPR6r.mjs";
11
- import { t as hasEvents } from "../typeGuards-DHTnEs5X.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-BHD3L8of.mjs";
3
+ import { n as requireSingleHeaderValue, t as getHeader } from "../headers-BFEEshDS.mjs";
4
+ import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-DLueLQdQ.mjs";
5
+ import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-Cldubvul.mjs";
6
+ import { A as scheduleBackground, C as paginationSchema, D as createQueryParser, E as ArcQueryParser, O as MONGO_DIALECT, S as offsetListResponse, T as responses, _ as errorDetailSchema, a as defineCompensation, b as keysetListResponse, c as CircuitBreakerError, d as createCircuitBreaker, f as createCircuitBreakerRegistry, g as errorContractSchema, h as deleteResponse, i as defineErrorMapper, k as NEUTRAL_DIALECT, l as CircuitBreakerRegistry, m as bareListResponse, n as handleRaw, o as withCompensation, p as aggregateListResponse, r as defineGuard, s as CircuitBreaker, t as createStateMachine, u as CircuitState, v as getDefaultCrudSchemas, w as queryParams, x as listResponse, y as getListQueryParams } from "../utils-CUFBrhq-.mjs";
7
+ import { a as isZodSchema, i as isJsonSchema, n as convertRouteSchema, o as toJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-DENbixyA.mjs";
8
+ import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-CFwCzEvU.mjs";
9
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-Bo7rSKjm.mjs";
10
+ import { t as openSseStream } from "../sseStream-BfZtL5-m.mjs";
11
+ import { t as hasEvents } from "../typeGuards-t_CVgRXN.mjs";
12
12
  export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, MONGO_DIALECT, NEUTRAL_DIALECT, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, declareRuntimeCapability, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, forwardedStreamHeaders, getDefaultCrudSchemas, getHeader, getListQueryParams, getUserId, getUserRoles, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, normalizeRoles, offsetListResponse, openSseStream, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, requireSingleHeaderValue, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, withCompensation };
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { m as RESERVED_QUERY_PARAMS } from "./constants-BONghE1Y.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { m as RESERVED_QUERY_PARAMS } from "./constants-BQ2FbhPB.mjs";
3
3
  import { arcLog } from "./logger/index.mjs";
4
- import { t as ArcError, u as ValidationError } from "./errors-2ExmOgIJ.mjs";
4
+ import { t as ArcError, u as ValidationError } from "./errors-BHD3L8of.mjs";
5
5
  import { scheduleBackground } from "@classytic/repo-core/cache";
6
6
  import { errorContractSchema as errorContractSchema$1, errorDetailSchema as errorDetailSchema$1 } from "@classytic/repo-core/errors";
7
7
  //#region src/utils/filter-dialect.ts
@@ -561,8 +561,8 @@ const paginationSchema = {
561
561
  * validation PER RESPONSE to pick the branch, on the hottest route of
562
562
  * every arc app. The merge keeps the exact bytes (pinned by
563
563
  * `tests/utils/list-response-serialization.test.ts`) and drops the
564
- * per-response branch validation. Only `data` is required — the one field
565
- * all four variants share.
564
+ * per-response branch validation. The list route also serves count, exists
565
+ * and distinct dispatch verbs, so no field is common to every valid shape.
566
566
  */
567
567
  function listResponse(itemSchema) {
568
568
  return {
@@ -577,6 +577,15 @@ function listResponse(itemSchema) {
577
577
  type: "array",
578
578
  items: itemSchema
579
579
  },
580
+ count: {
581
+ type: "integer",
582
+ minimum: 0
583
+ },
584
+ exists: { type: "boolean" },
585
+ values: {
586
+ type: "array",
587
+ items: {}
588
+ },
580
589
  page: {
581
590
  type: "integer",
582
591
  example: 1
@@ -607,7 +616,6 @@ function listResponse(itemSchema) {
607
616
  description: "Cursor token for the next page, or null."
608
617
  }
609
618
  },
610
- required: ["data"],
611
619
  additionalProperties: true
612
620
  };
613
621
  }
@@ -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/core/aggregation/normalize.ts
4
4
  /**
5
5
  * Framework cap on URL-driven aggregation limits when the host opts
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.38.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Add2L50I.mjs";
3
- import { d as createDomainError } from "./errors-2ExmOgIJ.mjs";
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
3
+ import { d as createDomainError } from "./errors-BHD3L8of.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/plugins/versioning.ts
6
6
  var versioning_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
 
2
- import { n as DomainEvent } from "./EventTransport-Cx60_s-6.mjs";
2
+ import { n as DomainEvent } from "./EventTransport-BPOQsEer.mjs";
3
3
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
4
4
  //#region src/plugins/caching.d.ts
5
5
  interface CachingRule {
@@ -0,0 +1,42 @@
1
+ /*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
2
+ import { n as requestContext } from "./requestContext-D4PuGhEw.mjs";
3
+ //#region src/context/workScope.ts
4
+ /** Enter a scope for `fn`, or run it inside the active one. */
5
+ function runWorkScope(seed, fn) {
6
+ if (requestContext.get()) return fn();
7
+ const store = {
8
+ kind: seed.kind,
9
+ requestId: seed.id,
10
+ startTime: performance.now(),
11
+ ...seed.organizationId !== void 0 ? { organizationId: seed.organizationId } : {}
12
+ };
13
+ return requestContext.run(store, fn);
14
+ }
15
+ /**
16
+ * A per-scope memo slot: created once on first use, the same instance after.
17
+ * `undefined` outside a scope.
18
+ */
19
+ function scopedValue(slot, create) {
20
+ const store = requestContext.get();
21
+ if (!store) return void 0;
22
+ const slots = store;
23
+ const existing = slots[slot];
24
+ if (existing !== void 0) return existing;
25
+ const created = create();
26
+ slots[slot] = created;
27
+ return created;
28
+ }
29
+ /**
30
+ * The scope an event dispatch runs in. The correlation id is the scope id so a
31
+ * child event published from a handler chains to the same correlation; the
32
+ * tenant rides `meta`, never the payload.
33
+ */
34
+ function workSeedFromEvent(event) {
35
+ return {
36
+ kind: "event",
37
+ id: event.meta.correlationId ?? event.meta.id,
38
+ ...event.meta.organizationId !== void 0 ? { organizationId: event.meta.organizationId } : {}
39
+ };
40
+ }
41
+ //#endregion
42
+ export { scopedValue as n, workSeedFromEvent as r, runWorkScope as t };