@classytic/arc 2.41.1 → 2.44.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 (248) hide show
  1. package/dist/{EventTransport-CbUKDzZZ.d.mts → EventTransport-CiicKz2Z.d.mts} +1 -1
  2. package/dist/{EventTransport-DSqD_Xsg.mjs → EventTransport-DZWDsaPa.mjs} +22 -17
  3. package/dist/{HookSystem-CMF94SEA.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
  4. package/dist/{QueryCache-DFA-QrU9.d.mts → QueryCache--5uAuYPW.d.mts} +7 -3
  5. package/dist/{ResourceRegistry-MGpXoxHZ.mjs → ResourceRegistry-DJxHUpE4.mjs} +44 -13
  6. package/dist/acquire-BozJ-9yt.mjs +35 -0
  7. package/dist/actionPermissions-5N04zBL4.mjs +772 -0
  8. package/dist/audit/index.d.mts +46 -8
  9. package/dist/audit/index.mjs +48 -26
  10. package/dist/auth/audit.d.mts +8 -8
  11. package/dist/auth/audit.mjs +1 -1
  12. package/dist/auth/index.d.mts +46 -16
  13. package/dist/auth/index.mjs +134 -156
  14. package/dist/auth/redis-session.d.mts +4 -5
  15. package/dist/auth/redis-session.mjs +1 -1
  16. package/dist/{authorizationDecision-DawKGoXb.mjs → authorizationDecision-wX3SA9w_.mjs} +7 -102
  17. package/dist/{base-CxrV1LmG.d.mts → base-CZyixEQR.d.mts} +27 -5
  18. package/dist/boundedMap-DWiKW7lP.mjs +57 -0
  19. package/dist/{buildHandler-CvxKOc0m.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
  20. package/dist/cache/index.d.mts +31 -43
  21. package/dist/cache/index.mjs +4 -4
  22. package/dist/{caching-DbCBxlgw.mjs → caching-Drp68DIS.mjs} +3 -3
  23. package/dist/claimed-DYvQoZLv.mjs +8 -0
  24. package/dist/cleanup/index.d.mts +18 -22
  25. package/dist/cleanup/index.mjs +27 -73
  26. package/dist/cli/commands/describe.d.mts +7 -5
  27. package/dist/cli/commands/describe.mjs +7 -4
  28. package/dist/cli/commands/docs.d.mts +2 -3
  29. package/dist/cli/commands/docs.mjs +3 -3
  30. package/dist/cli/commands/doctor.d.mts +2 -3
  31. package/dist/cli/commands/doctor.mjs +1 -1
  32. package/dist/cli/commands/generate.mjs +2 -3
  33. package/dist/cli/commands/init.mjs +2 -3
  34. package/dist/cli/commands/introspect.d.mts +2 -3
  35. package/dist/cli/commands/introspect.mjs +2 -2
  36. package/dist/cli/index.mjs +3 -3
  37. package/dist/{constants-D5Ubn1fe.mjs → constants-B2QHb6u6.mjs} +4 -2
  38. package/dist/context/index.d.mts +11 -14
  39. package/dist/context/index.mjs +18 -38
  40. package/dist/core/index.d.mts +3 -3
  41. package/dist/core/index.mjs +8 -8
  42. package/dist/{core-5lazhva9.mjs → core-COcqo0Cp.mjs} +15 -5
  43. package/dist/{createActionRouter-DNqoaK81.mjs → createActionRouter-zG13rpPJ.mjs} +97 -39
  44. package/dist/{createAggregationRouter-BcbQJf10.mjs → createAggregationRouter-CWRz96Vr.mjs} +11 -8
  45. package/dist/{preloadResources-f3boenVZ.mjs → createApp-BGLYtErt.mjs} +305 -394
  46. package/dist/{createMcpServer-CbDWkZ1T.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
  47. package/dist/{defineAggregation-D_eJjm5A.mjs → defineAggregation--3xguLkk.mjs} +1 -1
  48. package/dist/{defineResource-DxkMTjRn.mjs → defineResource-gUp9ug66.mjs} +118 -1024
  49. package/dist/discovery/index.d.mts +6 -7
  50. package/dist/discovery/index.mjs +1 -1
  51. package/dist/docs/index.d.mts +11 -5
  52. package/dist/docs/index.mjs +4 -4
  53. package/dist/{elevation-CkvG0LG2.mjs → elevation-BG4gnMsJ.mjs} +41 -12
  54. package/dist/{elevation-BXCfVcNG.d.mts → elevation-BW2J3tNj.d.mts} +1 -2
  55. package/dist/encryption/index.d.mts +5 -5
  56. package/dist/encryption/index.mjs +3 -3
  57. package/dist/{errorHandler-D1GHKGlV.mjs → errorHandler-COHw3N1b.mjs} +26 -5
  58. package/dist/{errors-BH7YU_9O.mjs → errors-CW4anJBy.mjs} +58 -23
  59. package/dist/{errors-BGdVwP25.d.mts → errors-JYc9vwqE.d.mts} +9 -0
  60. package/dist/{eventPlugin-B52abJ8W.d.mts → eventPlugin-BtmA4-3P.d.mts} +65 -9
  61. package/dist/{eventPlugin-zZY-unhr.mjs → eventPlugin-BweHAVws.mjs} +82 -21
  62. package/dist/{subscribe-helpers-DatDkcuG.mjs → eventTypes-N4-omQFR.mjs} +151 -17
  63. package/dist/events/index.d.mts +43 -18
  64. package/dist/events/index.mjs +49 -53
  65. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  66. package/dist/events/transports/redis-stream-entry.mjs +139 -157
  67. package/dist/events/transports/redis.d.mts +5 -6
  68. package/dist/events/transports/redis.mjs +2 -2
  69. package/dist/factory/index.d.mts +42 -27
  70. package/dist/factory/index.mjs +213 -32
  71. package/dist/{fastify-augmentation-Cq2nHVaW.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +11 -25
  72. package/dist/{fields-BHrkoF5y.mjs → fields-A5crhsJb.mjs} +1 -1
  73. package/dist/{fields-I_EeRWND.d.mts → fields-BBSpf8pS.d.mts} +1 -1
  74. package/dist/filter-merge-DGM-GQ1J.mjs +99 -0
  75. package/dist/{generate-BLRf2m3y.mjs → generate-BXKo2Gc8.mjs} +2 -2
  76. package/dist/{headers-BIXWKrzQ.mjs → headers-DKZQKL-Z.mjs} +2 -2
  77. package/dist/health-BYAwA6YS.mjs +22 -0
  78. package/dist/{health-ZRHeDHXH.mjs → health-CrqUp3sz.mjs} +115 -55
  79. package/dist/hooks/index.d.mts +2 -2
  80. package/dist/hooks/index.mjs +2 -3
  81. package/dist/idempotency/index.d.mts +36 -10
  82. package/dist/idempotency/index.mjs +230 -111
  83. package/dist/idempotency/redis.d.mts +1 -1
  84. package/dist/idempotency/redis.mjs +77 -12
  85. package/dist/{index-D4u76eQW.d.mts → index-Beg3aNnK.d.mts} +23 -101
  86. package/dist/{preloadResources-CjS2OfpU.d.mts → index-BkV55WlV.d.mts} +37 -38
  87. package/dist/{index-BHdZD8zK.d.mts → index-Bxriq3so.d.mts} +84 -21
  88. package/dist/index-CUJvoyw3.d.mts +510 -0
  89. package/dist/{index-CbJiYrfv.d.mts → index-Chgz3d0i.d.mts} +1 -1
  90. package/dist/{index-DHbyPo5j.d.mts → index-WH7xgvxS.d.mts} +304 -254
  91. package/dist/index.d.mts +9 -9
  92. package/dist/index.mjs +11 -11
  93. package/dist/{init-CpLkjU18.mjs → init-BPzK5Lnr.mjs} +1 -1
  94. package/dist/integrations/event-gateway.d.mts +11 -7
  95. package/dist/integrations/event-gateway.mjs +4 -4
  96. package/dist/integrations/index.d.mts +3 -3
  97. package/dist/integrations/index.mjs +1 -1
  98. package/dist/integrations/jobs/index.d.mts +1 -1
  99. package/dist/integrations/jobs/index.mjs +18 -5
  100. package/dist/integrations/mcp/index.d.mts +102 -89
  101. package/dist/integrations/mcp/index.mjs +19 -4
  102. package/dist/integrations/mcp/testing.d.mts +8 -9
  103. package/dist/integrations/mcp/testing.mjs +2 -2
  104. package/dist/integrations/streamline.d.mts +85 -144
  105. package/dist/integrations/streamline.mjs +131 -55
  106. package/dist/integrations/webhooks.d.mts +83 -143
  107. package/dist/integrations/webhooks.mjs +36 -80
  108. package/dist/integrations/websocket-pushref-redis.d.mts +5 -6
  109. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  110. package/dist/integrations/websocket-redis.d.mts +5 -6
  111. package/dist/integrations/websocket-redis.mjs +1 -1
  112. package/dist/integrations/websocket.d.mts +3 -3
  113. package/dist/integrations/websocket.mjs +2 -2
  114. package/dist/{interface-DEWNOMza.d.mts → interface-JJzwH4Ro.d.mts} +34 -2
  115. package/dist/{jsonBody-ELR9lfeU.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
  116. package/dist/{keys-cpZCtcIE.mjs → keys-CpoiZ8hU.mjs} +7 -18
  117. package/dist/{loadResources-BPfWiI5s.mjs → loadResources-6jO52-RR.mjs} +3 -3
  118. package/dist/{loadResourcesFromEntry-ixtfL3J2.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
  119. package/dist/logger/index.d.mts +9 -17
  120. package/dist/logger/index.mjs +2 -153
  121. package/dist/logger-D4V1zGLI.mjs +160 -0
  122. package/dist/{mcpPlugin-BX5PujI0.mjs → mcpPlugin-srPc7ItN.mjs} +446 -170
  123. package/dist/{memory-Iotz0cCx.mjs → memory-CTa5pOCW.mjs} +36 -34
  124. package/dist/{metrics-NMsmpRmY.mjs → metrics-DsZrvnpB.mjs} +39 -72
  125. package/dist/middleware/index.d.mts +5 -5
  126. package/dist/middleware/index.mjs +3 -3
  127. package/dist/migrations/index.d.mts +13 -13
  128. package/dist/migrations/index.mjs +2 -2
  129. package/dist/{module-DpLJG2_N.mjs → module--L0iBIZz.mjs} +8 -8
  130. package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
  131. package/dist/mongoose-CYJCLyi-.mjs +67451 -0
  132. package/dist/multiTenant-CAtYlW6H.d.mts +104 -0
  133. package/dist/{multipartBody-DtRWM6_U.mjs → multipartBody-Cc7eZ9cq.mjs} +46 -7
  134. package/dist/node-D8UZv_8c.mjs +41236 -0
  135. package/dist/{openapi-CmFf3yq_.mjs → openapi-CMegfsm8.mjs} +48 -10
  136. package/dist/outbox-admin/index.d.mts +5 -5
  137. package/dist/outbox-admin/index.mjs +6 -18
  138. package/dist/{outbox-module-D2z5WkDY.mjs → outbox-module-Ryk270jd.mjs} +203 -33
  139. package/dist/{outbox-module-BHdUnuuK.d.mts → outbox-module-gZCHoE4H.d.mts} +79 -6
  140. package/dist/permissions/index.d.mts +5 -4
  141. package/dist/permissions/index.mjs +8 -6
  142. package/dist/{permissions-D8TBH44E.mjs → permissions-C5ijIz5Q.mjs} +149 -33
  143. package/dist/{pipe-FMWNheSO.mjs → pipe-D81zMtWs.mjs} +2 -2
  144. package/dist/pipeline/index.d.mts +7 -7
  145. package/dist/pipeline/index.mjs +2 -2
  146. package/dist/plan-CJGMKoui.mjs +565 -0
  147. package/dist/{BaseController-CYEwjyjN.mjs → plugin-DALd9dcF.mjs} +1269 -346
  148. package/dist/plugins/index.d.mts +17 -14
  149. package/dist/plugins/index.mjs +44 -22
  150. package/dist/plugins/response-cache.d.mts +5 -6
  151. package/dist/plugins/response-cache.mjs +8 -14
  152. package/dist/plugins/tracing-entry.mjs +2 -2
  153. package/dist/{pluralize-CXWZIzTv.mjs → pluralize-COUNYo3d.mjs} +1 -1
  154. package/dist/presets/filesUpload.d.mts +8 -8
  155. package/dist/presets/filesUpload.mjs +5 -5
  156. package/dist/presets/index.d.mts +35 -40
  157. package/dist/presets/index.mjs +4 -4
  158. package/dist/presets/multiTenant.d.mts +2 -107
  159. package/dist/presets/multiTenant.mjs +22 -162
  160. package/dist/presets/search.d.mts +9 -10
  161. package/dist/presets/search.mjs +2 -2
  162. package/dist/{presets-ZJSPgmT2.mjs → presets-CONf2Qem.mjs} +99 -107
  163. package/dist/{projection-BzIgzoKZ.mjs → projection-wFoLqdss.mjs} +2 -2
  164. package/dist/{pushref-registry-Dov9l4qE.d.mts → pushref-registry-UxCkoA4C.d.mts} +1 -1
  165. package/dist/{queryCachePlugin-DZHPOm9p.mjs → queryCachePlugin-BATECpyh.mjs} +12 -14
  166. package/dist/{queryCachePlugin-BzqxconG.d.mts → queryCachePlugin-C2lZjTxk.d.mts} +1 -1
  167. package/dist/{rateLimitKey-BvOvcBDi.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
  168. package/dist/{realtime-8tIQWZz4.mjs → realtime-xyubMKSB.mjs} +25 -21
  169. package/dist/{redis-Bzi1y3F9.d.mts → redis-BDgv9Glw.d.mts} +17 -24
  170. package/dist/redis-stream-BMk-bpQS.d.mts +219 -0
  171. package/dist/redisShapes-CQksY67q.d.mts +55 -0
  172. package/dist/registry/index.d.mts +15 -10
  173. package/dist/registry/index.mjs +4 -4
  174. package/dist/{registry-DNkgGQcK.mjs → registry-Bdzg-hdm.mjs} +13 -10
  175. package/dist/{renewingLease-yF8BdW4b.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
  176. package/dist/{replyHelpers-CNdvMfM4.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
  177. package/dist/{requestContext-cDkAUr-P.mjs → requestContext-C10UeFe5.mjs} +1 -1
  178. package/dist/requirement-Bu50QALH.mjs +35 -0
  179. package/dist/requirement-CbiLdQ1n.d.mts +22 -0
  180. package/dist/resourceRateLimit-Wf6d6FL9.d.mts +30 -0
  181. package/dist/resourceRateLimit-urWPJxrt.mjs +180 -0
  182. package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
  183. package/dist/routeValidator-DHtpzrzk.mjs +70 -0
  184. package/dist/{runtimeCapabilities-CkhS6jn6.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
  185. package/dist/{schedules-j6uXXAeJ.mjs → schedules-CKTs5ys8.mjs} +46 -37
  186. package/dist/{schemaConverter-BVA7cFRG.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
  187. package/dist/{schemaIR-CTvPDoPB.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
  188. package/dist/schemas/index.d.mts +20 -10
  189. package/dist/schemas/index.mjs +8 -3
  190. package/dist/scim/index.d.mts +13 -13
  191. package/dist/scim/index.mjs +2 -2
  192. package/dist/scope/index.d.mts +4 -4
  193. package/dist/scope/index.mjs +6 -6
  194. package/dist/{scope-BUi1xV1I.mjs → scope-DINaj7Ax.mjs} +4 -4
  195. package/dist/shutdown-LpLMH8T1.mjs +59 -0
  196. package/dist/{simpleEqualityMatcher-C9bzq2gO.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
  197. package/dist/{sse-BeqVKQKu.mjs → sse-BzJFPX_1.mjs} +11 -15
  198. package/dist/{sseStream-Ppzo-WUH.mjs → sseStream-DQChzGTs.mjs} +2 -2
  199. package/dist/{store-helpers-dW71XVWL.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
  200. package/dist/{streaming-IcRFjWQU.mjs → streaming-JzB5CAga.mjs} +1 -1
  201. package/dist/subscriberIdentity-DeyppIif.mjs +28 -0
  202. package/dist/tenancy-DxV8OuX2.mjs +43 -0
  203. package/dist/tenantPreparation-CBvvAcAj.mjs +67 -0
  204. package/dist/testing/cleanupStoreContract.d.mts +4 -5
  205. package/dist/testing/cleanupStoreContract.mjs +1 -1
  206. package/dist/testing/index.d.mts +215 -197
  207. package/dist/testing/index.mjs +289 -214
  208. package/dist/testing/outboxStoreContract.d.mts +4 -5
  209. package/dist/testing/outboxStoreContract.mjs +137 -2
  210. package/dist/testing/requiredPorts.d.mts +16 -0
  211. package/dist/testing/requiredPorts.mjs +65 -0
  212. package/dist/testing/storageContract.d.mts +4 -5
  213. package/dist/testing/storageContract.mjs +1 -1
  214. package/dist/timing-CntavTlR.mjs +46 -0
  215. package/dist/{transactionContext-CPbdlnVw.mjs → transactionContext-orvnGu4F.mjs} +1 -1
  216. package/dist/{typeGuards-BLjPgVBm.mjs → typeGuards-kEaP_WmO.mjs} +1 -1
  217. package/dist/types/index.d.mts +4 -4
  218. package/dist/types/index.mjs +1 -1
  219. package/dist/types/storage.mjs +1 -1
  220. package/dist/{types-DfVDvkdP.d.mts → types-BJ-2XqVF.d.mts} +189 -204
  221. package/dist/{types-CWQn9-IC.d.mts → types-D3Ixsh00.d.mts} +22 -9
  222. package/dist/{types-CgenB1gv.mjs → types-fvO6Ovzx.mjs} +4 -4
  223. package/dist/usage/index.d.mts +5 -6
  224. package/dist/usage/index.mjs +5 -5
  225. package/dist/{userHelpers-ChRvkuSZ.mjs → userHelpers-C76zD5pa.mjs} +1 -1
  226. package/dist/utils/index.d.mts +125 -264
  227. package/dist/utils/index.mjs +13 -12
  228. package/dist/{utils-CxcctrAh.mjs → utils-BpkVZ8rB.mjs} +315 -404
  229. package/dist/{validate-DrYWnOzI.mjs → validate-CWp-lsrm.mjs} +6 -14
  230. package/dist/{versioning-D6JIK8Tk.d.mts → versioning-Bsb51gGT.d.mts} +28 -13
  231. package/dist/{versioning-DKkT4hNJ.mjs → versioning-CHhL9P3o.mjs} +4 -4
  232. package/dist/{websocket-BOXVggMf.d.mts → websocket-Cs4awVyD.d.mts} +1 -1
  233. package/dist/{workScope-CxKqoIFn.mjs → workScope-n9a7d_lZ.mjs} +2 -2
  234. package/package.json +57 -59
  235. package/skills/arc/SKILL.md +13 -4
  236. package/skills/arc/references/auth.md +8 -5
  237. package/skills/arc/references/integrations.md +1 -1
  238. package/skills/arc/references/mcp.md +8 -6
  239. package/skills/arc/references/multi-tenancy.md +19 -14
  240. package/skills/arc/references/production.md +27 -10
  241. package/dist/actionPermissions-BoPGQ5-4.mjs +0 -350
  242. package/dist/index-CFfLKMH4.d.mts +0 -290
  243. package/dist/interface-YzIbF7Ii.mjs +0 -17
  244. package/dist/redis-stream-BPKscsTB.d.mts +0 -260
  245. package/dist/registerRoute-Bsnk6NiZ.mjs +0 -364
  246. package/dist/rolldown-runtime-eysyzFAF.mjs +0 -15
  247. package/dist/sync/changelog.d.mts +0 -3
  248. package/dist/sync/changelog.mjs +0 -3
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
1
 
2
- import { c as DataPolicy, d as UserBase, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "./base-CxrV1LmG.mjs";
3
- import { A as RequestIdOptions, An as WriteVerbKey, B as defineResource, Bt as BaseController, C as RequestContext, Cn as ControllerConstructionOptions, D as HealthCheck, Dn as MutationWriteContext, E as GracefulShutdownOptions, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, Gt as SlugExt, H as CrudController, Ht as SoftDeleteMixin, In as IRequestContext, Jt as BulkMixin, Kt as SlugMixin, L as RequestWithExtras, Ln as RawRouteHandler, Mn as ControllerLike, N as FastifyRequestExtras, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, P as FastifyWithAuth, Pn as IController, Q as MiddlewareConfig, Rn as RouteHandler, S as QueryParserInterface, Sn as ControllerConfigurableOptions, T as CrudRouterOptions, U as ResourceConfig, Ut as TreeExt, V as ResourceDefinition, Vt as SoftDeleteExt, Wt as TreeMixin, X as CrudRouteKey, Y as PresetResult, Yt as BaseCrudController, Z as CrudSchemas, _n as ArcDeleteResult, a as InferAdapterDoc, bn as ArcUpdateResult, c as TypedController, ct as AggMeasureShorthand, d as PaginationResult, dt as AggregationDateRangeRequirement, et as RouteSchemaOptions, f as IntrospectionData, ft as AggregationIndexHint, g as ArcInternalMetadata, gn as ArcCreateResult, gt as AggregationsMap, h as ResourceMetadata, ht as AggregationRateLimit, i as ValidationResult, k as IntrospectionPluginOptions, kn as WriteContext, l as TypedRepository, lt as AggregationCacheConfig, m as RegistryStats, mt as AggregationMaterializedResult, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, pt as AggregationMaterializedContext, q as PresetFunction, qt as BulkExt, r as ValidateOptions, s as InferResourceDoc, st as AggMeasureInput, t as RouteHandlerMethod, u as TypedResourceConfig, ut as AggregationConfig, vn as ArcGetResult, w as ServiceContext, wn as ListResult, xn as BaseControllerOptions, y as OwnershipCheck, yn as ArcListResult } from "./index-DHbyPo5j.mjs";
4
- import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-I_EeRWND.mjs";
5
- import "./fastify-augmentation-Cq2nHVaW.mjs";
6
- import { A as CRUD_OPERATIONS, B as HookOperation, C as SeamedResourceConfig, E as defineAction, F as DEFAULT_SORT, G as MUTATION_OPERATIONS, H as MAX_FILTER_DEPTH, I as DEFAULT_TENANT_FIELD, J as SYSTEM_FIELDS, K as MutationOperation, L as DEFAULT_UPDATE_METHOD, M as DEFAULT_ID_FIELD, N as DEFAULT_LIMIT, P as DEFAULT_MAX_LIMIT, R as HOOK_OPERATIONS, S as ResourceSeams, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, b as defineResourceVariants, c as nativePolicyFilter, h as getControllerScope, j as CrudOperation, k as defineAggregation, q as RESERVED_QUERY_PARAMS, s as NativePolicyFilter, w as mergeResourceConfig, x as AdapterLike, z as HOOK_PHASES } from "./index-D4u76eQW.mjs";
7
- import { $ as requireAuth, C as requireServiceScope, G as createOrgPermissions, H as DynamicPermissionMatrixConfig, J as allowPublic, K as allOf, S as requireScopeContext, V as DynamicPermissionMatrix, W as createDynamicPermissionMatrix, Y as anyOf, Z as denyAll, _ as publicReadAdminWrite, b as requireOrgMembership, d as authenticated, et as requireOwnership, f as fullPublic, g as publicRead, h as presets_d_exports, it as when, nt as requireRoles, p as ownerWithAdminBypass, u as adminOnly, v as readOnly, w as requireTeamMembership, x as requireOrgRole, y as requireOrgInScope } from "./index-BHdZD8zK.mjs";
8
- import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-BGdVwP25.mjs";
2
+ import { c as DataPolicy, d as UserBase, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "./base-CZyixEQR.mjs";
3
+ import { A as RequestWithExtras, Bn as IController, Bt as TreeMixin, C as RequestIdOptions, Cn as ArcGetResult, D as FastifyWithAuth, Dn as ControllerConfigurableOptions, E as FastifyRequestExtras, En as BaseControllerOptions, F as ResourceDefinition, Fn as WriteContext, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Hn as IRequestContext, Ht as SlugMixin, I as CrudController, In as WriteVerbKey, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Lt as SoftDeleteExt, Nn as MutationWriteContext, O as FastifyWithDecorators, On as ControllerConstructionOptions, P as defineResource, Pn as ResourceWrites, Q as FieldRule, Rn as ControllerLike, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ArcDeleteResult, Tn as ArcUpdateResult, Un as RawRouteHandler, Ut as BulkExt, Vn as IControllerResponse, Vt as SlugExt, W as PresetResult, Wn as RouteHandler, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jt as AuthPluginOptions, kn as ListResult, kt as RateLimitConfig, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, wn as ArcListResult, x as HealthOptions, xn as ArcCreateResult, y as GracefulShutdownOptions, zt as TreeExt } from "./index-WH7xgvxS.mjs";
4
+ import { a as applyFieldReadPermissions, n as FieldPermissionMap, o as applyFieldWritePermissions, s as fields, t as FieldPermission } from "./fields-BBSpf8pS.mjs";
5
+ import "./fastify-augmentation-DRlCIWE9.mjs";
6
+ import { A as CrudOperation, B as HookOperation, C as mergeResourceConfig, F as DEFAULT_TENANT_FIELD, G as MUTATION_OPERATIONS, H as MAX_FILTER_DEPTH, I as DEFAULT_UPDATE_METHOD, J as SYSTEM_FIELDS, K as MutationOperation, M as DEFAULT_LIMIT, N as DEFAULT_MAX_LIMIT, O as defineAggregation, P as DEFAULT_SORT, R as HOOK_OPERATIONS, S as SeamedResourceConfig, T as defineAction, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, b as AdapterLike, c as nativePolicyFilter, j as DEFAULT_ID_FIELD, k as CRUD_OPERATIONS, m as getControllerScope, q as RESERVED_QUERY_PARAMS, s as NativePolicyFilter, x as ResourceSeams, y as defineResourceVariants, z as HOOK_PHASES } from "./index-Beg3aNnK.mjs";
7
+ import { C as requireScopeContext, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, J as PublicPolicy, K as createOrgPermissions, Q as anyOf, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, Y as allOf, Z as allowPublic, _ as publicRead, at as requireRoles, b as requireOrgInScope, d as adminOnly, et as denyAll, f as authenticated, g as presets_d_exports, m as ownerWithAdminBypass, nt as requireAuth, p as fullPublic, q as AllowPublicOptions, rt as requireOwnership, st as when, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly } from "./index-Bxriq3so.mjs";
8
+ import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-JYc9vwqE.mjs";
9
9
  //#region src/index.d.ts
10
- declare const version: string;
10
+ export declare const version: string;
11
11
  //#endregion
12
- export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
12
+ export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, when };
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
2
- import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "./constants-D5Ubn1fe.mjs";
3
- import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-BH7YU_9O.mjs";
4
- import { a as BulkMixin, h as nativePolicyFilter, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-CYEwjyjN.mjs";
5
- import { t as defineAggregation } from "./defineAggregation-D_eJjm5A.mjs";
6
- import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-BHrkoF5y.mjs";
7
- import { l as getControllerScope } from "./actionPermissions-BoPGQ5-4.mjs";
8
- import { a as ResourceDefinition, t as defineResource } from "./defineResource-DxkMTjRn.mjs";
9
- import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-5lazhva9.mjs";
10
- import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-D8TBH44E.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-B2QHb6u6.mjs";
3
+ import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-CW4anJBy.mjs";
4
+ import { S as nativePolicyFilter, c as BaseController, d as SlugMixin, f as BulkMixin, l as TreeMixin, p as BaseCrudController, u as SoftDeleteMixin } from "./plugin-DALd9dcF.mjs";
5
+ import { t as defineAggregation } from "./defineAggregation--3xguLkk.mjs";
6
+ import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-A5crhsJb.mjs";
7
+ import { S as getControllerScope } from "./actionPermissions-5N04zBL4.mjs";
8
+ import { a as defineResourceVariants, o as mergeResourceConfig, s as defineAction } from "./core-COcqo0Cp.mjs";
9
+ import { a as ResourceDefinition, t as defineResource } from "./defineResource-gUp9ug66.mjs";
10
+ import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-C5ijIz5Q.mjs";
11
11
  //#region src/index.ts
12
- const version = "2.41.1";
12
+ const version = "2.44.0";
13
13
  //#endregion
14
14
  export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
  import { dirname, join } from "node:path";
@@ -1,9 +1,9 @@
1
1
 
2
- import { n as DomainEvent } from "../EventTransport-CbUKDzZZ.mjs";
3
- import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-BOXVggMf.mjs";
2
+ import { n as DomainEvent } from "../EventTransport-CiicKz2Z.mjs";
3
+ import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-Cs4awVyD.mjs";
4
4
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
5
5
  //#region src/integrations/event-gateway.d.ts
6
- interface EventGatewayOptions {
6
+ export interface EventGatewayOptions {
7
7
  /** Require auth for all real-time connections (default: true) */
8
8
  auth?: boolean;
9
9
  /** Custom auth function for WebSocket upgrade */
@@ -11,7 +11,12 @@ interface EventGatewayOptions {
11
11
  userId?: string;
12
12
  organizationId?: string;
13
13
  } | null>;
14
- /** Filter events by org from request.scope (default: false) */
14
+ /**
15
+ * SSE tenant filtering — forwarded to `ssePlugin`'s `orgScoped`, whose
16
+ * default (**true**) applies when this is omitted. Deliberately not
17
+ * defaulted here: two defaults for one decision is how the stream stayed
18
+ * cross-tenant after the rest of arc failed closed.
19
+ */
15
20
  orgScoped?: boolean;
16
21
  /** Room/subscription authorization policy */
17
22
  roomPolicy?: (client: {
@@ -41,6 +46,5 @@ interface EventGatewayOptions {
41
46
  onDisconnect?: (client: WebSocketClient) => void | Promise<void>;
42
47
  };
43
48
  }
44
- declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
45
- //#endregion
46
- export { EventGatewayOptions, eventGatewayPlugin };
49
+ export declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
50
+ //#endregion
@@ -1,17 +1,17 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  import fp from "fastify-plugin";
3
3
  //#region src/integrations/event-gateway.ts
4
4
  const eventGatewayPluginImpl = async (fastify, opts = {}) => {
5
- const { auth = true, orgScoped = false, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
5
+ const { auth = true, orgScoped, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
6
6
  if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
7
7
  if (opts.sse !== false) {
8
- const { default: ssePlugin } = await import("../sse-BeqVKQKu.mjs").then((n) => n.r);
8
+ const { default: ssePlugin } = await import("../sse-BzJFPX_1.mjs").then((n) => n.n);
9
9
  await fastify.register(ssePlugin, {
10
10
  path: opts.sse?.path ?? "/events/stream",
11
11
  requireAuth: auth,
12
12
  patterns: opts.sse?.patterns ?? ["*"],
13
13
  heartbeat: opts.sse?.heartbeat ?? 3e4,
14
- orgScoped,
14
+ ...orgScoped !== void 0 ? { orgScoped } : {},
15
15
  filter: opts.sse?.filter
16
16
  });
17
17
  }
@@ -1,8 +1,8 @@
1
1
 
2
- import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BOXVggMf.mjs";
2
+ import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-Cs4awVyD.mjs";
3
3
  import { EventGatewayOptions } from "./event-gateway.mjs";
4
- import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-CbJiYrfv.mjs";
5
- import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-CWQn9-IC.mjs";
4
+ import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-Chgz3d0i.mjs";
5
+ import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-D3Ixsh00.mjs";
6
6
  import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
7
7
  import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
8
8
  export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,3 +1,3 @@
1
1
 
2
- import { a as JobMeta, c as JobsPluginOptions, d as ExecuteTimedHandlerOptions, f as TimedHandlerLogger, i as JobDispatcher, l as QueueStats, n as JobDefinition, o as JobRepeatOptions, p as executeTimedHandler, r as JobDispatchOptions, s as JobStatus, t as jobsPlugin, u as defineJob } from "../../index-CbJiYrfv.mjs";
2
+ import { a as JobMeta, c as JobsPluginOptions, d as ExecuteTimedHandlerOptions, f as TimedHandlerLogger, i as JobDispatcher, l as QueueStats, n as JobDefinition, o as JobRepeatOptions, p as executeTimedHandler, r as JobDispatchOptions, s as JobStatus, t as jobsPlugin, u as defineJob } from "../../index-Chgz3d0i.mjs";
3
3
  export { type ExecuteTimedHandlerOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobRepeatOptions, type JobStatus, type JobsPluginOptions, type QueueStats, type TimedHandlerLogger, defineJob, executeTimedHandler, jobsPlugin };
@@ -1,5 +1,6 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
2
- import { n as evaluateAndApplyPermission } from "../../authorizationDecision-DawKGoXb.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { n as evaluateAndApplyPermission } from "../../authorizationDecision-wX3SA9w_.mjs";
3
+ import { i as runAdmittedWork, r as registerShutdownParticipant } from "../../shutdown-LpLMH8T1.mjs";
3
4
  import fp from "fastify-plugin";
4
5
  //#region src/integrations/jobs/execution.ts
5
6
  async function executeTimedHandler(options) {
@@ -150,6 +151,7 @@ const jobsPluginImpl = async (fastify, options) => {
150
151
  const queues = /* @__PURE__ */ new Map();
151
152
  const dlqQueues = /* @__PURE__ */ new Map();
152
153
  const workers = /* @__PURE__ */ new Map();
154
+ const activeHandlers = /* @__PURE__ */ new Set();
153
155
  const throttledJobs = /* @__PURE__ */ new Map();
154
156
  const seenNames = /* @__PURE__ */ new Set();
155
157
  for (const job of jobs) {
@@ -255,7 +257,11 @@ const jobsPluginImpl = async (fastify, options) => {
255
257
  timestamp: Date.now(),
256
258
  signal
257
259
  };
258
- return job.handler(bullJob.data, meta);
260
+ const pending = runAdmittedWork(() => job.handler(bullJob.data, meta));
261
+ activeHandlers.add(pending);
262
+ return pending.finally(() => {
263
+ activeHandlers.delete(pending);
264
+ });
259
265
  }
260
266
  });
261
267
  if (bridgeEvents && fastify.events?.publish) try {
@@ -454,8 +460,15 @@ const jobsPluginImpl = async (fastify, options) => {
454
460
  };
455
461
  });
456
462
  }
457
- fastify.addHook("onClose", async () => {
458
- await dispatcher.close();
463
+ registerShutdownParticipant(fastify, {
464
+ name: "jobs",
465
+ stop: async () => {
466
+ await Promise.all(Array.from(workers.values()).map((worker) => worker.pause(true)));
467
+ },
468
+ drain: async () => {
469
+ await dispatcher.close();
470
+ await Promise.allSettled([...activeHandlers]);
471
+ }
459
472
  });
460
473
  };
461
474
  /**
@@ -1,10 +1,11 @@
1
1
 
2
2
  import { i as RequestScope } from "../../types-Ddl9OjmE.mjs";
3
- import { l as PermissionCheck } from "../../base-CxrV1LmG.mjs";
4
- import { Fn as IControllerResponse, In as IRequestContext, V as ResourceDefinition, zn as ServerAccessor } from "../../index-DHbyPo5j.mjs";
5
- import { n as FieldPermissionMap } from "../../fields-I_EeRWND.mjs";
6
- import { _ as ToolDefinition, a as CrudDescriptionOverride, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, i as CrudDescriptionMeta, l as McpExecutionWiring, m as SessionEntry, n as CallToolResult, o as CrudOperation, p as PromptResult, r as CreateMcpServerConfig, s as McpAuthResolver, t as BetterAuthHandler, u as McpPluginOptions } from "../../types-CWQn9-IC.mjs";
7
- import { i as resolveToolCollisions, n as McpServerInstance, r as createMcpServer, t as AuthRef } from "../../createMcpServer-CbDWkZ1T.mjs";
3
+ import { l as PermissionCheck } from "../../base-CZyixEQR.mjs";
4
+ import { F as ResourceDefinition, Gn as ServerAccessor, Hn as IRequestContext, Vn as IControllerResponse } from "../../index-WH7xgvxS.mjs";
5
+ import { n as FieldPermissionMap } from "../../fields-BBSpf8pS.mjs";
6
+ import "../../resourceRateLimit-Wf6d6FL9.mjs";
7
+ import { _ as ToolDefinition, a as CrudDescriptionOverride, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, i as CrudDescriptionMeta, l as McpExecutionWiring, m as SessionEntry, n as CallToolResult, o as CrudOperation, p as PromptResult, r as CreateMcpServerConfig, s as McpAuthResolver, t as BetterAuthHandler, u as McpPluginOptions, v as ToolInputSchema } from "../../types-D3Ixsh00.mjs";
8
+ import { i as resolveToolCollisions, n as McpServerInstance, r as createMcpServer, t as AuthRef } from "../../createMcpServer-DSztofa9.mjs";
8
9
  import { ErrorContract } from "@classytic/repo-core/errors";
9
10
  import { FastifyPluginAsync } from "fastify";
10
11
  import { z } from "zod";
@@ -34,7 +35,7 @@ interface McpBridge {
34
35
  guard?: (ctx: ToolContext) => string | null;
35
36
  }
36
37
  /** Convert a McpBridge into a registered MCP tool. */
37
- declare function bridgeToMcp(bridge: McpBridge): ToolDefinition;
38
+ export declare function bridgeToMcp(bridge: McpBridge): ToolDefinition;
38
39
  interface BuildMcpToolsFromBridgesOptions {
39
40
  /** If set, only bridges whose `name` is in this array are registered. */
40
41
  include?: string[];
@@ -54,7 +55,7 @@ interface BuildMcpToolsFromBridgesOptions {
54
55
  * extraTools: [...buildMcpToolsFromBridges(allBridges, { exclude: ['trigger_job'] })]
55
56
  * ```
56
57
  */
57
- declare function buildMcpToolsFromBridges(bridges: readonly McpBridge[], options?: BuildMcpToolsFromBridgesOptions): ToolDefinition[];
58
+ export declare function buildMcpToolsFromBridges(bridges: readonly McpBridge[], options?: BuildMcpToolsFromBridgesOptions): ToolDefinition[];
58
59
  //#endregion
59
60
  //#region src/integrations/mcp/betterAuthApiKey.d.ts
60
61
  /** Minimal subset of Better Auth's API-key record the helper needs. */
@@ -95,7 +96,61 @@ interface CreateMcpAuthFromBetterAuthApiKeyOptions {
95
96
  * Build an {@link McpAuthResolver} that authenticates MCP requests against
96
97
  * Better Auth's API-key plugin. See module docstring for the rationale.
97
98
  */
98
- declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, options?: CreateMcpAuthFromBetterAuthApiKeyOptions): McpAuthResolver;
99
+ export declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, options?: CreateMcpAuthFromBetterAuthApiKeyOptions): McpAuthResolver;
100
+ //#endregion
101
+ //#region src/integrations/mcp/buildRequestContext.d.ts
102
+ type McpOperation = "list" | "get" | "create" | "update" | "delete" | "action";
103
+ /**
104
+ * Optional context extras — the pieces of `IRequestContext` that HTTP's
105
+ * `createRequestContext` assembles from Fastify decorators and the MCP
106
+ * synthetic path historically DROPPED. Without them, controller code that
107
+ * reads `metadata.arc.hooks` (the whole hook system — including the
108
+ * arcCorePlugin after-hook that publishes `<resource>.<op>d` events) or
109
+ * `ctx.server.events` silently no-ops on MCP calls: agents could mutate
110
+ * records without hooks firing, events publishing, realtime feeds updating,
111
+ * or webhooks dispatching. Thread these through `invokeController` /
112
+ * `resourceToTools({ wiring })` to restore full HTTP ↔ MCP parity.
113
+ */
114
+ interface McpContextExtras {
115
+ tenantMiddlewares?: readonly unknown[];
116
+ /**
117
+ * Resource wiring — becomes `metadata.arc`, the same frozen shape
118
+ * `buildArcDecorator` stamps on HTTP requests (`ArcRouteMeta`).
119
+ */
120
+ arc?: {
121
+ readonly resourceName: string;
122
+ readonly schemaOptions?: unknown;
123
+ readonly permissions?: unknown;
124
+ readonly hooks?: unknown;
125
+ readonly events?: unknown;
126
+ readonly fields?: unknown;
127
+ readonly idField?: string;
128
+ };
129
+ /** Server accessor — `ctx.server.events/audit/log`, mirroring HTTP. */
130
+ server?: ServerAccessor;
131
+ }
132
+ /**
133
+ * Build an IRequestContext from MCP tool input and session auth.
134
+ *
135
+ * | Operation | params | query | body |
136
+ * |-----------|------------|----------------------|---------------------|
137
+ * | list | {} | all input fields | undefined |
138
+ * | get | { id } | {} | undefined |
139
+ * | create | {} | {} | all input fields |
140
+ * | update | { id } | {} | input minus id |
141
+ * | delete | { id } | {} | undefined |
142
+ *
143
+ * **scopeOverride** — when a permission check (e.g. `requireApiKey()`) returns
144
+ * an `AuthorizationDecision.scope`, the MCP tool handler must install it on the
145
+ * request context the same way CRUD/action routes do. This parameter follows the exact
146
+ * same non-downgrade rule as `applyAuthorizationDecision`: it overrides only when
147
+ * the session-derived scope is `public` (i.e. MCP called with `auth: false`).
148
+ * An authenticated session scope is never overwritten.
149
+ */
150
+ export declare function buildRequestContext(input: Record<string, unknown>, auth: McpAuthResult | null, operation: McpOperation, policyFilters?: Record<string, unknown>, scopeOverride?: RequestScope, extras?: McpContextExtras): IRequestContext;
151
+ //#endregion
152
+ //#region src/integrations/mcp/http-parity.d.ts
153
+ type ToolAdmission = (session: McpAuthResult | null, scope?: RequestScope) => boolean | Promise<boolean>;
99
154
  //#endregion
100
155
  //#region src/integrations/mcp/crud-tools.d.ts
101
156
  /**
@@ -107,7 +162,7 @@ declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, opti
107
162
  * override can call this from their own override to keep the auto-derived
108
163
  * blurb intact and only append extra context.
109
164
  */
110
- declare function defaultCrudDescription(op: CrudOperation, displayName: string, softDelete: boolean, queryMeta?: {
165
+ export declare function defaultCrudDescription(op: CrudOperation, displayName: string, softDelete: boolean, queryMeta?: {
111
166
  filterableFields?: readonly string[];
112
167
  allowedOperators?: readonly string[];
113
168
  sortableFields?: readonly string[];
@@ -119,7 +174,7 @@ declare function defaultCrudDescription(op: CrudOperation, displayName: string,
119
174
  *
120
175
  * Falls back to {@link defaultCrudDescription} when no override is set.
121
176
  */
122
- declare function resolveCrudDescription(override: CrudDescriptionOverride | undefined, meta: CrudDescriptionMeta): string;
177
+ export declare function resolveCrudDescription(override: CrudDescriptionOverride | undefined, meta: CrudDescriptionMeta): string;
123
178
  //#endregion
124
179
  //#region src/integrations/mcp/definePrompt.d.ts
125
180
  /** definePrompt() config */
@@ -136,7 +191,7 @@ interface DefinePromptConfig<TArgs extends Record<string, z.ZodTypeAny>> {
136
191
  * @param name - Prompt name (snake_case recommended)
137
192
  * @param config - Description, args schema, handler
138
193
  */
139
- declare function definePrompt<TArgs extends Record<string, z.ZodTypeAny>>(name: string, config: DefinePromptConfig<TArgs>): PromptDefinition;
194
+ export declare function definePrompt<TArgs extends Record<string, z.ZodTypeAny>>(name: string, config: DefinePromptConfig<TArgs>): PromptDefinition;
140
195
  //#endregion
141
196
  //#region src/integrations/mcp/defineTool.d.ts
142
197
  /**
@@ -163,7 +218,7 @@ interface DefineToolConfig<TInput extends Record<string, z.ZodTypeAny>, TSession
163
218
  * @param name - Tool name (snake_case recommended)
164
219
  * @param config - Tool description, input schema, annotations, handler
165
220
  */
166
- declare function defineTool<TInput extends Record<string, z.ZodTypeAny>, TSession = McpAuthResult>(name: string, config: DefineToolConfig<TInput, TSession>): ToolDefinition<TSession>;
221
+ export declare function defineTool<TInput extends Record<string, z.ZodTypeAny>, TSession = McpAuthResult>(name: string, config: DefineToolConfig<TInput, TSession>): ToolDefinition<TSession>;
167
222
  //#endregion
168
223
  //#region src/integrations/mcp/fieldRulesToZod.d.ts
169
224
  interface FieldRulesToZodOptions {
@@ -212,21 +267,21 @@ interface FieldRuleEntry {
212
267
  *
213
268
  * @returns Flat shape `Record<string, z.ZodTypeAny>` — pass directly to defineTool() or registerTool()
214
269
  */
215
- declare function fieldRulesToZod(fieldRules: Record<string, FieldRuleEntry> | undefined, options?: FieldRulesToZodOptions): Record<string, z.ZodTypeAny>;
270
+ export declare function fieldRulesToZod(fieldRules: Record<string, FieldRuleEntry> | undefined, options?: FieldRulesToZodOptions): Record<string, z.ZodTypeAny>;
216
271
  //#endregion
217
272
  //#region src/integrations/mcp/guards.d.ts
218
273
  /** Check if the tool context has an authenticated user (not anonymous/null) */
219
- declare function isAuthenticated(ctx: ToolContext): boolean;
274
+ export declare function isAuthenticated(ctx: ToolContext): boolean;
220
275
  /** Check if the tool context has an organization scope */
221
- declare function hasOrg(ctx: ToolContext): boolean;
276
+ export declare function hasOrg(ctx: ToolContext): boolean;
222
277
  /** Check if the tool context matches a specific org */
223
- declare function isOrg(ctx: ToolContext, orgId: string): boolean;
278
+ export declare function isOrg(ctx: ToolContext, orgId: string): boolean;
224
279
  /** Get the current user ID from context (undefined if anonymous/null) */
225
- declare function getUserId(ctx: ToolContext): string | undefined;
280
+ export declare function getUserId(ctx: ToolContext): string | undefined;
226
281
  /** Get the current org ID from context */
227
- declare function getOrgId(ctx: ToolContext): string | undefined;
282
+ export declare function getOrgId(ctx: ToolContext): string | undefined;
228
283
  /** Create a denied (isError) CallToolResult */
229
- declare function denied(reason: string): CallToolResult;
284
+ export declare function denied(reason: string): CallToolResult;
230
285
  /** Guard type — checks ToolContext, returns error message or null (pass) */
231
286
  type McpGuard = (ctx: ToolContext) => string | null | Promise<string | null>;
232
287
  /**
@@ -243,15 +298,15 @@ type McpGuard = (ctx: ToolContext) => string | null | Promise<string | null>;
243
298
  * });
244
299
  * ```
245
300
  */
246
- declare function guard(...args: [...McpGuard[], (input: Record<string, unknown>, ctx: ToolContext) => Promise<CallToolResult>]): (input: Record<string, unknown>, ctx: ToolContext) => Promise<CallToolResult>;
301
+ export declare function guard(...args: [...McpGuard[], (input: Record<string, unknown>, ctx: ToolContext) => Promise<CallToolResult>]): (input: Record<string, unknown>, ctx: ToolContext) => Promise<CallToolResult>;
247
302
  /** Require authenticated user (not anonymous) */
248
- declare const requireAuth: McpGuard;
303
+ export declare const requireAuth: McpGuard;
249
304
  /** Require organization context */
250
- declare const requireOrg: McpGuard;
305
+ export declare const requireOrg: McpGuard;
251
306
  /** Require specific user role (checks session metadata if available) */
252
- declare function requireRole(...roles: string[]): McpGuard;
307
+ export declare function requireRole(...roles: string[]): McpGuard;
253
308
  /** Require specific organization */
254
- declare function requireOrgId(orgId: string): McpGuard;
309
+ export declare function requireOrgId(orgId: string): McpGuard;
255
310
  /**
256
311
  * Custom guard from a predicate function.
257
312
  *
@@ -263,57 +318,7 @@ declare function requireOrgId(orgId: string): McpGuard;
263
318
  * );
264
319
  * ```
265
320
  */
266
- declare function customGuard(check: (ctx: ToolContext) => boolean | Promise<boolean>, errorMessage: string): McpGuard;
267
- //#endregion
268
- //#region src/integrations/mcp/buildRequestContext.d.ts
269
- type McpOperation = "list" | "get" | "create" | "update" | "delete" | "action";
270
- /**
271
- * Optional context extras — the pieces of `IRequestContext` that HTTP's
272
- * `createRequestContext` assembles from Fastify decorators and the MCP
273
- * synthetic path historically DROPPED. Without them, controller code that
274
- * reads `metadata.arc.hooks` (the whole hook system — including the
275
- * arcCorePlugin after-hook that publishes `<resource>.<op>d` events) or
276
- * `ctx.server.events` silently no-ops on MCP calls: agents could mutate
277
- * records without hooks firing, events publishing, realtime feeds updating,
278
- * or webhooks dispatching. Thread these through `invokeController` /
279
- * `resourceToTools({ wiring })` to restore full HTTP ↔ MCP parity.
280
- */
281
- interface McpContextExtras {
282
- /**
283
- * Resource wiring — becomes `metadata.arc`, the same frozen shape
284
- * `buildArcDecorator` stamps on HTTP requests (`ArcRouteMeta`).
285
- */
286
- arc?: {
287
- readonly resourceName: string;
288
- readonly schemaOptions?: unknown;
289
- readonly permissions?: unknown;
290
- readonly hooks?: unknown;
291
- readonly events?: unknown;
292
- readonly fields?: unknown;
293
- readonly idField?: string;
294
- };
295
- /** Server accessor — `ctx.server.events/audit/log`, mirroring HTTP. */
296
- server?: ServerAccessor;
297
- }
298
- /**
299
- * Build an IRequestContext from MCP tool input and session auth.
300
- *
301
- * | Operation | params | query | body |
302
- * |-----------|------------|----------------------|---------------------|
303
- * | list | {} | all input fields | undefined |
304
- * | get | { id } | {} | undefined |
305
- * | create | {} | {} | all input fields |
306
- * | update | { id } | {} | input minus id |
307
- * | delete | { id } | {} | undefined |
308
- *
309
- * **scopeOverride** — when a permission check (e.g. `requireApiKey()`) returns
310
- * an `AuthorizationDecision.scope`, the MCP tool handler must install it on the
311
- * request context the same way CRUD/action routes do. This parameter follows the exact
312
- * same non-downgrade rule as `applyAuthorizationDecision`: it overrides only when
313
- * the session-derived scope is `public` (i.e. MCP called with `auth: false`).
314
- * An authenticated session scope is never overwritten.
315
- */
316
- declare function buildRequestContext(input: Record<string, unknown>, auth: McpAuthResult | null, operation: McpOperation, policyFilters?: Record<string, unknown>, scopeOverride?: RequestScope, extras?: McpContextExtras): IRequestContext;
321
+ export declare function customGuard(check: (ctx: ToolContext) => boolean | Promise<boolean>, errorMessage: string): McpGuard;
317
322
  //#endregion
318
323
  //#region src/integrations/mcp/invokeController.d.ts
319
324
  /**
@@ -322,8 +327,10 @@ declare function buildRequestContext(input: Record<string, unknown>, auth: McpAu
322
327
  * identity; everything else is optional and falls back to sensible defaults.
323
328
  */
324
329
  interface InvokeControllerOptions {
330
+ readonly allow?: ToolAdmission;
325
331
  /** Resolved identity for this invocation — `null` runs as public scope. */
326
332
  readonly session: McpAuthResult | null;
333
+ readonly tenantMiddlewares?: readonly unknown[];
327
334
  /** Resource name surfaced into the permission context (`PermissionContext.resource`). */
328
335
  readonly resourceName: string;
329
336
  /**
@@ -405,7 +412,7 @@ interface InvokeControllerOptions {
405
412
  * `McpAuthResult` the HTTP MCP plugin produces, so the same permission
406
413
  * checks compose.
407
414
  */
408
- declare function invokeController(controller: unknown, op: McpOperation, input: Record<string, unknown>, options: InvokeControllerOptions): Promise<CallToolResult>;
415
+ export declare function invokeController(controller: unknown, op: McpOperation, input: Record<string, unknown>, options: InvokeControllerOptions): Promise<CallToolResult>;
409
416
  /**
410
417
  * Wrap an async function as a {@link ToolDefinition} handler — handles the
411
418
  * try/catch → canonical-error translation in one place so MCP tools that
@@ -433,7 +440,7 @@ declare function invokeController(controller: unknown, op: McpOperation, input:
433
440
  * });
434
441
  * ```
435
442
  */
436
- declare function mcpHandlerAdapter<TSession = McpAuthResult>(fn: (input: Record<string, unknown>, ctx: ToolContext<TSession>) => Promise<unknown>): ToolDefinition<TSession>["handler"];
443
+ export declare function mcpHandlerAdapter<TSession = McpAuthResult>(fn: (input: Record<string, unknown>, ctx: ToolContext<TSession>) => Promise<unknown>): ToolDefinition<TSession>["handler"];
437
444
  //#endregion
438
445
  //#region src/integrations/mcp/sessionCache.d.ts
439
446
  declare class McpSessionCache {
@@ -499,11 +506,10 @@ interface ResourceFilterInputs {
499
506
  readonly exclude?: readonly string[];
500
507
  }
501
508
  /**
502
- * Resolve `expose` / `include` / `exclude` into the filtered resource list
503
- * `mcpPlugin` should surface. Three mutually exclusive intents:
509
+ * Resolve `expose` / `exclude` into the filtered resource list `mcpPlugin`
510
+ * should surface. Two mutually exclusive intents:
504
511
  *
505
512
  * - `expose`: default-deny allowlist (preferred — new resources auto-deny).
506
- * - `include`: legacy alias for `expose`, kept for back-compat.
507
513
  * - `exclude`: default-allow opt-out (drift-prone — new resources auto-leak).
508
514
  *
509
515
  * Conflicting combinations throw with an actionable message so a host that
@@ -520,11 +526,11 @@ interface ResourceFilterInputs {
520
526
  * Exported so `mcp/testing.ts` and external test harnesses can apply the
521
527
  * same precedence rules without duplicating them.
522
528
  */
523
- declare function filterResourcesForMcp<T extends {
529
+ export declare function filterResourcesForMcp<T extends {
524
530
  name: string;
525
531
  mcp?: boolean;
526
532
  }>(resources: readonly T[], inputs: ResourceFilterInputs): T[];
527
- declare const mcpPlugin: FastifyPluginAsync<McpPluginOptions>;
533
+ export declare const mcpPlugin: FastifyPluginAsync<McpPluginOptions>;
528
534
  //#endregion
529
535
  //#region src/integrations/mcp/realtimeBridge.d.ts
530
536
  /**
@@ -564,7 +570,7 @@ interface DispatchOptions<TSession = unknown> {
564
570
  * handler throw). The realtime client uses the `id` to correlate
565
571
  * responses to the original calls.
566
572
  */
567
- declare function dispatchRealtimeToolCall<TSession = unknown>(tools: readonly ToolDefinition[], calls: readonly RealtimeToolCall[], opts?: DispatchOptions<TSession>): Promise<RealtimeToolResponse[]>;
573
+ export declare function dispatchRealtimeToolCall<TSession = unknown>(tools: readonly ToolDefinition[], calls: readonly RealtimeToolCall[], opts?: DispatchOptions<TSession>): Promise<RealtimeToolResponse[]>;
568
574
  //#endregion
569
575
  //#region src/integrations/mcp/resourceToTools.d.ts
570
576
  interface ResourceToToolsConfig extends McpResourceConfig {
@@ -592,7 +598,14 @@ interface ResourceToToolsConfig extends McpResourceConfig {
592
598
  * @param resource - Arc resource definition
593
599
  * @param config - Optional overrides (operations, descriptions, hideFields, prefix, names)
594
600
  */
595
- declare function resourceToTools(resource: ResourceDefinition, config?: ResourceToToolsConfig): ToolDefinition[];
601
+ export declare function resourceToTools(resource: ResourceDefinition, config?: ResourceToToolsConfig): ToolDefinition[];
602
+ //#endregion
603
+ //#region src/integrations/mcp/route-input-schema.d.ts
604
+ /**
605
+ * The field shape a tool advertises — the flat record itself, or a whole object
606
+ * schema's `.shape`. `undefined` for a union, which has no single shape.
607
+ */
608
+ export declare function toolInputShape(schema: ToolInputSchema | undefined): Record<string, z.ZodTypeAny> | undefined;
596
609
  //#endregion
597
610
  //#region src/integrations/mcp/tool-helpers.d.ts
598
611
  /**
@@ -603,7 +616,7 @@ declare function resourceToTools(resource: ResourceDefinition, config?: Resource
603
616
  * Errors are not represented here — controllers throw `ArcError` and the
604
617
  * MCP tool wrapper catches them via {@link toCallToolError}.
605
618
  */
606
- declare function toCallToolResult(result: IControllerResponse): CallToolResult;
619
+ export declare function toCallToolResult(result: IControllerResponse): CallToolResult;
607
620
  /**
608
621
  * Wrap a raw success payload as an MCP `CallToolResult`. Use when the
609
622
  * tool produced a value directly (action handler return, aggregation
@@ -613,7 +626,7 @@ declare function toCallToolResult(result: IControllerResponse): CallToolResult;
613
626
  * the HTTP wire follows. The `isError: true` flag on `CallToolResult`
614
627
  * is the success/error discriminant for MCP, mirroring HTTP status.
615
628
  */
616
- declare function toCallToolSuccess(value: unknown): CallToolResult;
629
+ export declare function toCallToolSuccess(value: unknown): CallToolResult;
617
630
  /**
618
631
  * Wrap an error as an MCP `CallToolResult` with the canonical
619
632
  * `ErrorContract` shape inside the text payload. Single source of truth
@@ -627,7 +640,7 @@ declare function toCallToolSuccess(value: unknown): CallToolResult;
627
640
  * - A partial contract `{code, message, status, details?}` → used as-is.
628
641
  * - Any other `Error` → falls back to `arc.internal_error` 500.
629
642
  */
630
- declare function toCallToolError(input: Error | {
643
+ export declare function toCallToolError(input: Error | {
631
644
  code: string;
632
645
  message: string;
633
646
  status?: number;
@@ -639,11 +652,11 @@ declare function toCallToolError(input: Error | {
639
652
  * 403 (session present, denied — "Permission denied"). Mirrors the
640
653
  * status split the HTTP `errorHandler` plugin uses.
641
654
  */
642
- declare function permissionDeniedResult(args: {
655
+ export declare function permissionDeniedResult(args: {
643
656
  resource: string;
644
657
  operation: string;
645
658
  reason?: string;
646
659
  session: McpAuthResult | null;
647
660
  }): CallToolResult;
648
661
  //#endregion
649
- export { type AuthRef, type BetterAuthHandler, type BuildMcpToolsFromBridgesOptions, type CallToolResult, type CreateMcpAuthFromBetterAuthApiKeyOptions, type CreateMcpServerConfig, type CrudDescriptionMeta, type CrudDescriptionOverride, type CrudOperation, type DefinePromptConfig, type DefineToolConfig, type DispatchOptions, type FieldRuleEntry, type FieldRulesToZodOptions, type InvokeControllerOptions, type McpAuthResolver, type McpAuthResult, type McpBridge, type McpGuard, type McpOperation, type McpPluginOptions, type McpResourceConfig, type McpServerInstance, type PromptDefinition, type PromptResult, type RealtimeToolCall, type RealtimeToolResponse, type ResourceToToolsConfig, type ToolAnnotations, type ToolContext, type ToolDefinition, bridgeToMcp, buildMcpToolsFromBridges, buildRequestContext, createMcpAuthFromBetterAuthApiKey, createMcpServer, customGuard, defaultCrudDescription, definePrompt, defineTool, denied, dispatchRealtimeToolCall, fieldRulesToZod, filterResourcesForMcp, getOrgId, getUserId, guard, hasOrg, invokeController, isAuthenticated, isOrg, mcpHandlerAdapter, mcpPlugin, permissionDeniedResult, requireAuth, requireOrg, requireOrgId, requireRole, resolveCrudDescription, resolveToolCollisions, resourceToTools, toCallToolError, toCallToolResult, toCallToolSuccess };
662
+ export { type AuthRef, type BetterAuthHandler, type BuildMcpToolsFromBridgesOptions, type CallToolResult, type CreateMcpAuthFromBetterAuthApiKeyOptions, type CreateMcpServerConfig, type CrudDescriptionMeta, type CrudDescriptionOverride, type CrudOperation, type DefinePromptConfig, type DefineToolConfig, type DispatchOptions, type FieldRuleEntry, type FieldRulesToZodOptions, type InvokeControllerOptions, type McpAuthResolver, type McpAuthResult, type McpBridge, type McpContextExtras, type McpGuard, type McpOperation, type McpPluginOptions, type McpResourceConfig, type McpServerInstance, type PromptDefinition, type PromptResult, type RealtimeToolCall, type RealtimeToolResponse, type ResourceToToolsConfig, type ToolAnnotations, type ToolContext, type ToolDefinition, type ToolInputSchema, createMcpServer, resolveToolCollisions };