@classytic/arc 2.41.0 → 2.43.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.
- package/dist/{EventTransport-CbUKDzZZ.d.mts → EventTransport-CiicKz2Z.d.mts} +1 -1
- package/dist/{EventTransport-n7qO5Cz3.mjs → EventTransport-tzA7CAB4.mjs} +22 -17
- package/dist/{HookSystem-CxvZBo77.mjs → HookSystem-B6UaKRbF.mjs} +2 -2
- package/dist/{QueryCache-DFA-QrU9.d.mts → QueryCache--5uAuYPW.d.mts} +7 -3
- package/dist/{ResourceRegistry-Cu7uTJp9.mjs → ResourceRegistry-CuCARu2B.mjs} +44 -13
- package/dist/actionPermissions-BotX1YOa.mjs +776 -0
- package/dist/audit/index.d.mts +43 -5
- package/dist/audit/index.mjs +48 -26
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +43 -13
- package/dist/auth/index.mjs +130 -155
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-2YY_Kaj1.mjs → authorizationDecision-DQYrkl5f.mjs} +7 -102
- package/dist/{base-CxrV1LmG.d.mts → base-CZyixEQR.d.mts} +27 -5
- package/dist/boundedMap-BULzfXYU.mjs +57 -0
- package/dist/{buildHandler-CUhjGHGZ.mjs → buildHandler-CRQ8EcX5.mjs} +4 -4
- package/dist/cache/index.d.mts +22 -34
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DsWDjIxx.mjs → caching-Cc2M1DwO.mjs} +3 -3
- package/dist/claimed-B10RTfkM.mjs +8 -0
- package/dist/cleanup/index.d.mts +6 -10
- package/dist/cleanup/index.mjs +27 -73
- package/dist/cli/commands/describe.d.mts +4 -2
- package/dist/cli/commands/describe.mjs +7 -4
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-BxLgNFF7.mjs → constants-Cu7Mx7_U.mjs} +4 -2
- package/dist/context/index.d.mts +2 -5
- package/dist/context/index.mjs +18 -38
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +8 -8
- package/dist/{core-iNGqYerO.mjs → core-Cb0LjccA.mjs} +5 -4
- package/dist/{createActionRouter-BBlbPs3k.mjs → createActionRouter-xjqonMRO.mjs} +87 -39
- package/dist/{createAggregationRouter-Dv5SuK2x.mjs → createAggregationRouter-zRYWw_5D.mjs} +11 -8
- package/dist/{preloadResources-Bbp4QJ8V.mjs → createApp-D-953ZAq.mjs} +299 -390
- package/dist/{createMcpServer-CbDWkZ1T.d.mts → createMcpServer-C9cxS8zt.d.mts} +1 -1
- package/dist/{defineAggregation-UyeurGkp.mjs → defineAggregation-Bm8RjMbq.mjs} +1 -1
- package/dist/{defineResource-DzGT-2LP.mjs → defineResource-DIC7JZGU.mjs} +118 -1024
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +10 -4
- package/dist/docs/index.mjs +4 -4
- package/dist/{elevation-BXCfVcNG.d.mts → elevation-BW2J3tNj.d.mts} +1 -2
- package/dist/{elevation-BF-vhGxY.mjs → elevation-DG8SrLN-.mjs} +41 -12
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-CIMkCOWm.mjs → errorHandler-BnfDviL1.mjs} +26 -5
- package/dist/{errors-C_YhELhe.mjs → errors-CtrywMHP.mjs} +58 -23
- package/dist/{errors-BGdVwP25.d.mts → errors-JYc9vwqE.d.mts} +9 -0
- package/dist/{eventPlugin-B52abJ8W.d.mts → eventPlugin-BtmA4-3P.d.mts} +65 -9
- package/dist/{eventPlugin-CmXaPWLv.mjs → eventPlugin-Q6BhzHzs.mjs} +82 -21
- package/dist/{subscribe-helpers-AVYPgqTl.mjs → eventTypes-Cdhm6ZlV.mjs} +151 -17
- package/dist/events/index.d.mts +33 -8
- package/dist/events/index.mjs +49 -53
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +139 -157
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +32 -17
- package/dist/factory/index.mjs +213 -32
- package/dist/{fastify-augmentation-Cq2nHVaW.d.mts → fastify-augmentation-DhUJ-mvo.d.mts} +11 -25
- package/dist/{fields-I_EeRWND.d.mts → fields-BBSpf8pS.d.mts} +1 -1
- package/dist/{fields-BTyPLHK0.mjs → fields-ToPYpMqS.mjs} +1 -1
- package/dist/filter-merge-IpGywvym.mjs +99 -0
- package/dist/{generate-D_YmiCNf.mjs → generate-DRTkLlIl.mjs} +2 -2
- package/dist/{headers-CNECDE6q.mjs → headers-BbkIF6vA.mjs} +2 -2
- package/dist/health-D-Ft6JM6.mjs +22 -0
- package/dist/{health-CxQzbJmr.mjs → health-DqbsG-_w.mjs} +115 -55
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.d.mts +31 -7
- package/dist/idempotency/index.mjs +155 -98
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +48 -11
- package/dist/{index-BHdZD8zK.d.mts → index-Bxriq3so.d.mts} +84 -21
- package/dist/{preloadResources-CjS2OfpU.d.mts → index-C8zVGYsk.d.mts} +37 -38
- package/dist/{index-D4u76eQW.d.mts → index-CRoPtISf.d.mts} +23 -73
- package/dist/{index-CbJiYrfv.d.mts → index-Chgz3d0i.d.mts} +1 -1
- package/dist/index-JdbZAIsm.d.mts +510 -0
- package/dist/{index-DHbyPo5j.d.mts → index-mqaqZNpe.d.mts} +253 -254
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +11 -11
- package/dist/{init-Y2MlSN9n.mjs → init-B_oUYDXI.mjs} +1 -1
- package/dist/integrations/event-gateway.d.mts +8 -3
- package/dist/integrations/event-gateway.mjs +4 -4
- package/dist/integrations/index.d.mts +3 -3
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +18 -5
- package/dist/integrations/mcp/index.d.mts +72 -59
- package/dist/integrations/mcp/index.mjs +19 -4
- package/dist/integrations/mcp/testing.d.mts +2 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +78 -136
- package/dist/integrations/streamline.mjs +116 -54
- package/dist/integrations/webhooks.d.mts +60 -120
- package/dist/integrations/webhooks.mjs +36 -80
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.d.mts +3 -3
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{interface-DEWNOMza.d.mts → interface-C0395yUN.d.mts} +13 -1
- package/dist/{jsonBody-Cq9KYl2Z.mjs → jsonBody-B4YVGcql.mjs} +2 -2
- package/dist/{keys-Cmv4cBRa.mjs → keys-B2KtgMLJ.mjs} +7 -18
- package/dist/{loadResources-CblF7xt2.mjs → loadResources-Dn4lalw2.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-99fIMC3p.mjs → loadResourcesFromEntry-3sLYbuse.mjs} +2 -2
- package/dist/logger/index.d.mts +1 -8
- package/dist/logger/index.mjs +3 -153
- package/dist/logger-DXjfIqjV.mjs +160 -0
- package/dist/{mcpPlugin-xF3Gw-HW.mjs → mcpPlugin-C08HalN5.mjs} +433 -170
- package/dist/{memory-CpDZ9NPw.mjs → memory-9Cp7611C.mjs} +36 -34
- package/dist/{metrics-BaKnq8ag.mjs → metrics-CWI11eRu.mjs} +39 -72
- package/dist/middleware/index.d.mts +2 -2
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-BkQEesNQ.mjs → module-BSvOQC7E.mjs} +8 -8
- package/dist/multiTenant-cY0FkDiA.d.mts +104 -0
- package/dist/{multipartBody-C92aJ8am.mjs → multipartBody-CXM2a-Dy.mjs} +46 -7
- package/dist/{openapi-C3LFRzPq.mjs → openapi-DT_G4VhY.mjs} +48 -10
- package/dist/outbox-admin/index.d.mts +3 -3
- package/dist/outbox-admin/index.mjs +6 -18
- package/dist/{outbox-module-dsCyLxXH.mjs → outbox-module-Bjgzl6tg.mjs} +203 -33
- package/dist/{outbox-module-BHdUnuuK.d.mts → outbox-module-gZCHoE4H.d.mts} +79 -6
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +8 -6
- package/dist/{permissions-DiHXy8Ck.mjs → permissions-Cm0uYHvd.mjs} +149 -33
- package/dist/{pipe-CBVmUJ-j.mjs → pipe-BqeGT6UO.mjs} +2 -2
- package/dist/pipeline/index.d.mts +2 -2
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plan-FVR6LP59.mjs +565 -0
- package/dist/{BaseController-DYJRZ0EJ.mjs → plugin-BccET1tL.mjs} +1256 -344
- package/dist/plugins/index.d.mts +14 -11
- package/dist/plugins/index.mjs +44 -22
- package/dist/plugins/response-cache.mjs +8 -14
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-2_U6QZQg.mjs → pluralize-CVIOcgMF.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +2 -2
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +26 -31
- package/dist/presets/index.mjs +4 -4
- package/dist/presets/multiTenant.d.mts +2 -107
- package/dist/presets/multiTenant.mjs +22 -162
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-BdlugYTc.mjs → presets-Cpvj6fGO.mjs} +99 -107
- package/dist/{projection-Uvgp-EEj.mjs → projection-Ce4aQhQk.mjs} +2 -2
- package/dist/{pushref-registry-Dov9l4qE.d.mts → pushref-registry-UxCkoA4C.d.mts} +1 -1
- package/dist/{queryCachePlugin-BzqxconG.d.mts → queryCachePlugin-C2lZjTxk.d.mts} +1 -1
- package/dist/{queryCachePlugin-B5F09bYr.mjs → queryCachePlugin-CFWNH8aT.mjs} +12 -14
- package/dist/{rateLimitKey-CK-EU2L8.mjs → rateLimitKey-C4O-kPm0.mjs} +1 -1
- package/dist/{realtime-FnnD0n3Z.mjs → realtime-DmPE9S54.mjs} +25 -21
- package/dist/redis-stream-BMk-bpQS.d.mts +219 -0
- package/dist/{redis-Bzi1y3F9.d.mts → redis-vLvtcGy_.d.mts} +13 -24
- package/dist/redisShapes-CQksY67q.d.mts +55 -0
- package/dist/registry/index.d.mts +9 -4
- package/dist/registry/index.mjs +4 -4
- package/dist/{registry-D3y8VEJ1.mjs → registry-Bcz9G1bh.mjs} +10 -8
- package/dist/{renewingLease-B3VYh5aU.mjs → renewingLease-qODa7KJQ.mjs} +1 -1
- package/dist/{replyHelpers-DPHsdw-5.mjs → replyHelpers-CG_VtVgS.mjs} +2 -2
- package/dist/{requestContext-cSVKnYPk.mjs → requestContext-Dsu9P1bV.mjs} +1 -1
- package/dist/requirement-CbiLdQ1n.d.mts +22 -0
- package/dist/requirement-KDdoRcOP.mjs +35 -0
- package/dist/resourceRateLimit-Wf6d6FL9.d.mts +30 -0
- package/dist/resourceRateLimit-dSjVr1pk.mjs +180 -0
- package/dist/{rolldown-runtime-DjDuyglE.mjs → rolldown-runtime-D1w9Y1VJ.mjs} +1 -1
- package/dist/routeValidator-D36SW8qt.mjs +70 -0
- package/dist/{runtimeCapabilities-DSA_dH1_.mjs → runtimeCapabilities-0tccjRlj.mjs} +1 -1
- package/dist/{schedules-BktJb3Y3.mjs → schedules-C-OpmHBq.mjs} +46 -37
- package/dist/{schemaConverter-BLCSmNbr.mjs → schemaConverter-BORek3O-.mjs} +2 -2
- package/dist/{schemaIR-K16Bb5BX.mjs → schemaIR-C7Vbp71I.mjs} +2 -2
- package/dist/schemas/index.d.mts +10 -0
- package/dist/schemas/index.mjs +8 -3
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +6 -6
- package/dist/{scope-jSxuBTFM.mjs → scope-DQthe88b.mjs} +4 -4
- package/dist/shutdown-MqA81z_P.mjs +59 -0
- package/dist/{simpleEqualityMatcher-BiOnyflP.mjs → simpleEqualityMatcher-auW8QjXN.mjs} +1 -1
- package/dist/{sse-CH7Slxc1.mjs → sse-CYzQBVFe.mjs} +11 -15
- package/dist/{sseStream-CN-Lh1Tu.mjs → sseStream-B5_Afiqn.mjs} +2 -2
- package/dist/{store-helpers-9DX9-1j_.mjs → store-helpers-BOzk-CuX.mjs} +1 -1
- package/dist/{streaming-dvppnxsr.mjs → streaming-DjTQhZrN.mjs} +1 -1
- package/dist/subscriberIdentity-CW39uA8G.mjs +28 -0
- package/dist/tenancy--ed9eH_z.mjs +43 -0
- package/dist/tenantPreparation-BKon6Yox.mjs +67 -0
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +193 -175
- package/dist/testing/index.mjs +286 -212
- package/dist/testing/outboxStoreContract.mjs +137 -2
- package/dist/testing/requiredPorts.d.mts +17 -0
- package/dist/testing/requiredPorts.mjs +65 -0
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/timing-qczZ0YC-.mjs +46 -0
- package/dist/{transactionContext-DCWMI6hV.mjs → transactionContext-DjFkrNG6.mjs} +1 -1
- package/dist/{typeGuards-D7tHFdH6.mjs → typeGuards-CySF12G-.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-CWQn9-IC.d.mts → types-B4Aq4Sdj.d.mts} +22 -9
- package/dist/{types-DfVDvkdP.d.mts → types-BJ-2XqVF.d.mts} +189 -204
- package/dist/{types-CDy3-zw1.mjs → types-Bk9NOgOC.mjs} +4 -4
- package/dist/usage/index.d.mts +2 -3
- package/dist/usage/index.mjs +5 -5
- package/dist/{userHelpers-DDMOZ_Pm.mjs → userHelpers-aklawRaK.mjs} +1 -1
- package/dist/utils/index.d.mts +84 -223
- package/dist/utils/index.mjs +13 -12
- package/dist/{utils-B-zj_b__.mjs → utils-ec1oTo1n.mjs} +315 -404
- package/dist/{validate-R0G_JrnK.mjs → validate-9yzHC1e2.mjs} +6 -14
- package/dist/{versioning-D6JIK8Tk.d.mts → versioning-Bsb51gGT.d.mts} +28 -13
- package/dist/{versioning-DuVWcu-F.mjs → versioning-fhhWHV74.mjs} +4 -4
- package/dist/{websocket-BOXVggMf.d.mts → websocket-Cs4awVyD.d.mts} +1 -1
- package/dist/{workScope-BhsWde4k.mjs → workScope-zpPyge4t.mjs} +2 -2
- package/package.json +578 -574
- package/skills/arc/SKILL.md +13 -4
- package/skills/arc/references/auth.md +8 -5
- package/skills/arc/references/integrations.md +1 -1
- package/skills/arc/references/mcp.md +8 -6
- package/skills/arc/references/multi-tenancy.md +19 -14
- package/skills/arc/references/production.md +27 -10
- package/dist/actionPermissions-DPwPWPOV.mjs +0 -350
- package/dist/index-CFfLKMH4.d.mts +0 -290
- package/dist/interface-BIpgzbZl.mjs +0 -17
- package/dist/redis-stream-BPKscsTB.d.mts +0 -260
- package/dist/registerRoute-DRsSHPSM.mjs +0 -364
- package/dist/sync/changelog.d.mts +0 -3
- 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-
|
|
3
|
-
import { A as
|
|
4
|
-
import { a as
|
|
5
|
-
import "./fastify-augmentation-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-
|
|
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, An as WriteContext, Bt as TreeMixin, C as RequestIdOptions, Cn as ControllerConstructionOptions, D as FastifyWithAuth, E as FastifyRequestExtras, F as ResourceDefinition, Fn as IController, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Ht as SlugMixin, I as CrudController, In as IControllerResponse, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Ln as IRequestContext, Lt as SoftDeleteExt, Nn as ControllerLike, O as FastifyWithDecorators, On as MutationWriteContext, P as defineResource, Q as FieldRule, Rn as RawRouteHandler, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ControllerConfigurableOptions, Ut as BulkExt, Vt as SlugExt, W as PresetResult, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, _n as ArcDeleteResult, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, bn as ArcUpdateResult, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, gn as ArcCreateResult, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jn as WriteVerbKey, jt as AuthPluginOptions, kn as ResourceWrites, 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, vn as ArcGetResult, wn as ListResult, x as HealthOptions, xn as BaseControllerOptions, y as GracefulShutdownOptions, yn as ArcListResult, zn as RouteHandler, zt as TreeExt } from "./index-mqaqZNpe.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-DhUJ-mvo.mjs";
|
|
6
|
+
import { C as AdapterLike, E as mergeResourceConfig, F as DEFAULT_LIMIT, G as MAX_FILTER_DEPTH, H as HOOK_PHASES, I as DEFAULT_MAX_LIMIT, J as MUTATION_OPERATIONS, K as MAX_REGEX_LENGTH, L as DEFAULT_SORT, M as CRUD_OPERATIONS, N as CrudOperation, O as defineAction, P as DEFAULT_ID_FIELD, R as DEFAULT_TENANT_FIELD, S as defineResourceVariants, T as SeamedResourceConfig, U as HookOperation, V as HOOK_OPERATIONS, W as HookPhase, X as RESERVED_QUERY_PARAMS, Y as MutationOperation, Z as SYSTEM_FIELDS, c as nativePolicyFilter, j as defineAggregation, m as getControllerScope, q as MAX_SEARCH_LENGTH, s as NativePolicyFilter, w as ResourceSeams, z as DEFAULT_UPDATE_METHOD } from "./index-CRoPtISf.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
10
|
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
|
|
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, version, when };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as DEFAULT_SORT,
|
|
3
|
-
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-
|
|
4
|
-
import {
|
|
5
|
-
import { t as defineAggregation } from "./defineAggregation-
|
|
6
|
-
import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
9
|
-
import { a as
|
|
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-
|
|
1
|
+
/*! @classytic/arc v2.43.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-Cu7Mx7_U.mjs";
|
|
3
|
+
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-CtrywMHP.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-BccET1tL.mjs";
|
|
5
|
+
import { t as defineAggregation } from "./defineAggregation-Bm8RjMbq.mjs";
|
|
6
|
+
import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-ToPYpMqS.mjs";
|
|
7
|
+
import { S as getControllerScope } from "./actionPermissions-BotX1YOa.mjs";
|
|
8
|
+
import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-Cb0LjccA.mjs";
|
|
9
|
+
import { a as ResourceDefinition, t as defineResource } from "./defineResource-DIC7JZGU.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-Cm0uYHvd.mjs";
|
|
11
11
|
//#region src/index.ts
|
|
12
|
-
const version = "2.
|
|
12
|
+
const version = "2.43.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,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as DomainEvent } from "../EventTransport-
|
|
3
|
-
import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-
|
|
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
6
|
interface EventGatewayOptions {
|
|
@@ -11,7 +11,12 @@ interface EventGatewayOptions {
|
|
|
11
11
|
userId?: string;
|
|
12
12
|
organizationId?: string;
|
|
13
13
|
} | null>;
|
|
14
|
-
/**
|
|
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: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.43.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
|
|
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-
|
|
8
|
+
const { default: ssePlugin } = await import("../sse-CYzQBVFe.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-
|
|
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-
|
|
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-
|
|
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-B4Aq4Sdj.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.
|
|
1
|
+
/*! @classytic/arc v2.43.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-
|
|
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.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-
|
|
1
|
+
/*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-DQYrkl5f.mjs";
|
|
3
|
+
import { i as runAdmittedWork, r as registerShutdownParticipant } from "../../shutdown-MqA81z_P.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
|
-
|
|
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
|
|
458
|
-
|
|
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-
|
|
4
|
-
import {
|
|
5
|
-
import { n as FieldPermissionMap } from "../../fields-
|
|
6
|
-
import
|
|
7
|
-
import { i as
|
|
3
|
+
import { l as PermissionCheck } from "../../base-CZyixEQR.mjs";
|
|
4
|
+
import { Bn as ServerAccessor, F as ResourceDefinition, In as IControllerResponse, Ln as IRequestContext } from "../../index-mqaqZNpe.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-B4Aq4Sdj.mjs";
|
|
8
|
+
import { i as resolveToolCollisions, n as McpServerInstance, r as createMcpServer, t as AuthRef } from "../../createMcpServer-C9cxS8zt.mjs";
|
|
8
9
|
import { ErrorContract } from "@classytic/repo-core/errors";
|
|
9
10
|
import { FastifyPluginAsync } from "fastify";
|
|
10
11
|
import { z } from "zod";
|
|
@@ -97,6 +98,60 @@ interface CreateMcpAuthFromBetterAuthApiKeyOptions {
|
|
|
97
98
|
*/
|
|
98
99
|
declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, options?: CreateMcpAuthFromBetterAuthApiKeyOptions): McpAuthResolver;
|
|
99
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
|
+
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>;
|
|
154
|
+
//#endregion
|
|
100
155
|
//#region src/integrations/mcp/crud-tools.d.ts
|
|
101
156
|
/**
|
|
102
157
|
* Default description for a CRUD tool. Enriches list descriptions with the
|
|
@@ -265,56 +320,6 @@ declare function requireOrgId(orgId: string): McpGuard;
|
|
|
265
320
|
*/
|
|
266
321
|
declare function customGuard(check: (ctx: ToolContext) => boolean | Promise<boolean>, errorMessage: string): McpGuard;
|
|
267
322
|
//#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;
|
|
317
|
-
//#endregion
|
|
318
323
|
//#region src/integrations/mcp/invokeController.d.ts
|
|
319
324
|
/**
|
|
320
325
|
* Options threaded into {@link invokeController}. `session` is required so
|
|
@@ -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
|
/**
|
|
@@ -499,11 +506,10 @@ interface ResourceFilterInputs {
|
|
|
499
506
|
readonly exclude?: readonly string[];
|
|
500
507
|
}
|
|
501
508
|
/**
|
|
502
|
-
* Resolve `expose` / `
|
|
503
|
-
*
|
|
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
|
|
@@ -594,6 +600,13 @@ interface ResourceToToolsConfig extends McpResourceConfig {
|
|
|
594
600
|
*/
|
|
595
601
|
declare function resourceToTools(resource: ResourceDefinition, config?: ResourceToToolsConfig): ToolDefinition[];
|
|
596
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
|
+
declare function toolInputShape(schema: ToolInputSchema | undefined): Record<string, z.ZodTypeAny> | undefined;
|
|
609
|
+
//#endregion
|
|
597
610
|
//#region src/integrations/mcp/tool-helpers.d.ts
|
|
598
611
|
/**
|
|
599
612
|
* Convert a controller response envelope into an MCP `CallToolResult`.
|
|
@@ -646,4 +659,4 @@ declare function permissionDeniedResult(args: {
|
|
|
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, 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, toolInputShape };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as
|
|
1
|
+
/*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
|
|
2
|
+
import { _ as resolveToolCollisions, a as toolInputShape, c as resolveCrudDescription, d as permissionDeniedResult, f as toCallToolError, g as createMcpServer, h as buildRequestContext, i as isZodTypeSchema, l as invokeController, m as toCallToolSuccess, n as mcpPlugin, o as fieldRulesToZod, p as toCallToolResult, r as resourceToTools, s as defaultCrudDescription, t as filterResourcesForMcp, u as mcpHandlerAdapter } from "../../mcpPlugin-C08HalN5.mjs";
|
|
3
3
|
//#region src/integrations/mcp/defineTool.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define a type-safe MCP tool.
|
|
@@ -277,6 +277,9 @@ function definePrompt(name, config) {
|
|
|
277
277
|
}
|
|
278
278
|
//#endregion
|
|
279
279
|
//#region src/integrations/mcp/realtimeBridge.ts
|
|
280
|
+
function isPlainArgs(value) {
|
|
281
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
282
|
+
}
|
|
280
283
|
/**
|
|
281
284
|
* Dispatch a batch of tool calls through the host's MCP tool registry.
|
|
282
285
|
*
|
|
@@ -329,7 +332,19 @@ async function dispatchOne(def, call, ctx) {
|
|
|
329
332
|
response: { error: "arguments_json is not valid JSON" }
|
|
330
333
|
};
|
|
331
334
|
}
|
|
332
|
-
if (def.inputSchema) {
|
|
335
|
+
if (isZodTypeSchema(def.inputSchema)) {
|
|
336
|
+
const result = def.inputSchema.safeParse(parsedArgs);
|
|
337
|
+
if (!result.success) return {
|
|
338
|
+
id: call.id,
|
|
339
|
+
name: call.name,
|
|
340
|
+
isError: true,
|
|
341
|
+
response: {
|
|
342
|
+
error: "argument validation failed",
|
|
343
|
+
fields: result.error.issues.map((i) => `${i.path.join(".") || "input"}: ${i.message}`)
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
parsedArgs = isPlainArgs(result.data) ? result.data : {};
|
|
347
|
+
} else if (def.inputSchema) {
|
|
333
348
|
const fieldErrors = [];
|
|
334
349
|
const validated = {};
|
|
335
350
|
for (const [key, schema] of Object.entries(def.inputSchema)) {
|
|
@@ -376,4 +391,4 @@ function normalizeResult(result) {
|
|
|
376
391
|
return {};
|
|
377
392
|
}
|
|
378
393
|
//#endregion
|
|
379
|
-
export { 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 };
|
|
394
|
+
export { 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, toolInputShape };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-
|
|
3
|
-
import { n as McpServerInstance } from "../../createMcpServer-
|
|
2
|
+
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-B4Aq4Sdj.mjs";
|
|
3
|
+
import { n as McpServerInstance } from "../../createMcpServer-C9cxS8zt.mjs";
|
|
4
4
|
import { Client } from "@modelcontextprotocol/client";
|
|
5
5
|
//#region src/integrations/mcp/testing.d.ts
|
|
6
6
|
/** An MCP client bound to a live loopback server, plus its teardown. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
|
|
2
|
+
import { g as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-C08HalN5.mjs";
|
|
3
3
|
//#region src/integrations/mcp/testing.ts
|
|
4
4
|
/**
|
|
5
5
|
* Serve an already-built `McpServer` on an ephemeral loopback port and connect
|