@classytic/arc 2.37.1 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseController-Chkf0Aiw.mjs → BaseController-BqJtbiUA.mjs} +107 -23
- package/dist/{EventTransport-BEVP50ka.d.mts → EventTransport-BPOQsEer.d.mts} +45 -0
- package/dist/{EventTransport-CFdtK25P.mjs → EventTransport-BUkTwY_x.mjs} +51 -8
- package/dist/{HookSystem-Csy31WS-.mjs → HookSystem-96nzZLmk.mjs} +2 -2
- package/dist/{ResourceRegistry-OQA13slI.mjs → ResourceRegistry-B9WnuG2Q.mjs} +2 -2
- package/dist/{actionPermissions-DGGqqSIV.mjs → actionPermissions-4OGbe3Hf.mjs} +6 -6
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +2 -2
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.mjs +6 -6
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-BzZi2bsf.mjs → authorizationDecision-D_LFvMlm.mjs} +2 -2
- package/dist/{buildHandler-CIz0NsGS.mjs → buildHandler-BG_CHXqQ.mjs} +4 -4
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DldVgnC9.mjs → caching-Bqcn3Brl.mjs} +2 -2
- package/dist/cleanup/index.d.mts +2 -2
- package/dist/cleanup/index.mjs +21 -5
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +3 -3
- 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-DDKf25s4.mjs → constants-BQ2FbhPB.mjs} +1 -1
- package/dist/context/index.d.mts +34 -6
- package/dist/context/index.mjs +12 -19
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-uHQonaHf.mjs → core-CsZR037F.mjs} +3 -3
- package/dist/{createActionRouter-C22Xn11N.mjs → createActionRouter-BR93gCKg.mjs} +7 -7
- package/dist/{createAggregationRouter-DgyksLHH.mjs → createAggregationRouter-CF40Aw95.mjs} +7 -7
- package/dist/createMcpServer-BVTs2S5G.d.mts +48 -0
- package/dist/{defineAggregation-B1m-45Fe.mjs → defineAggregation-BDA2Tw7v.mjs} +1 -1
- package/dist/{defineResource-DS3Uj2-8.mjs → defineResource-DaIySrQr.mjs} +20 -22
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-9X0lGzTQ.mjs → elevation-CZy6n50b.mjs} +4 -4
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-DI5AN2b5.d.mts → errorHandler--4rSMMvq.d.mts} +7 -1
- package/dist/{errorHandler-BmEGKyO9.mjs → errorHandler-By9keRvX.mjs} +3 -3
- package/dist/{errors-CbxCF9M0.mjs → errors-BHD3L8of.mjs} +1 -1
- package/dist/{eventPlugin-B1ahehZH.mjs → eventPlugin-DB26V7uX.mjs} +6 -6
- package/dist/{eventPlugin-B47sfCJ8.d.mts → eventPlugin-DfHaKEWQ.d.mts} +10 -1
- package/dist/events/index.d.mts +4 -4
- package/dist/events/index.mjs +5 -5
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +21 -20
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +11 -8
- package/dist/factory/index.d.mts +4 -4
- package/dist/factory/index.mjs +5 -5
- package/dist/{fastify-augmentation-CRsNNhuo.d.mts → fastify-augmentation-HncZMmze.d.mts} +3 -3
- package/dist/{fields-f_MdWDl_.mjs → fields-fA-Dkou5.mjs} +37 -2
- package/dist/{generate-DxWn-XnM.mjs → generate-BSSdtiOy.mjs} +4 -3
- package/dist/{headers-DivLPMHe.mjs → headers-BFEEshDS.mjs} +2 -2
- package/dist/{health-W_BjgWf0.mjs → health-BlGHjkqZ.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.mjs +4 -4
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-BqRfP1kT.d.mts → index-D3sIPcD4.d.mts} +47 -11
- package/dist/{index-DCxxRwLC.d.mts → index-DbMglURO.d.mts} +2 -2
- package/dist/{index-CEmPspAB.d.mts → index-SCsOJxWB.d.mts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +11 -11
- package/dist/{init-BJ6fdYnp.mjs → init-pl88PHzb.mjs} +9 -9
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +2 -2
- package/dist/integrations/mcp/index.d.mts +3 -46
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +22 -2
- package/dist/integrations/mcp/testing.mjs +55 -33
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +2 -2
- package/dist/integrations/webhooks.mjs +3 -3
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +13 -6
- package/dist/{interface-DeLndJ8G.mjs → interface-DjtFnZxH.mjs} +1 -1
- package/dist/{jsonBody-kApktjTc.mjs → jsonBody-Dx6jH_Nb.mjs} +2 -2
- package/dist/{keys-B1MgfDWi.mjs → keys-Ds3ekBiu.mjs} +1 -1
- package/dist/{loadResources-ma-Aaxp1.mjs → loadResources-E5UFlRrT.mjs} +2 -2
- package/dist/{loadResourcesFromEntry-xszlyXTs.mjs → loadResourcesFromEntry-C2jrJbWG.mjs} +2 -2
- package/dist/logger/index.mjs +1 -1
- package/dist/{mcpPlugin-97HuFA46.mjs → mcpPlugin-D-3OLxNz.mjs} +75 -31
- package/dist/{memory-DvASzOn3.mjs → memory-CNvjxzB2.mjs} +2 -2
- package/dist/{metrics-Dx-nkDE5.mjs → metrics-P37sNV5H.mjs} +2 -2
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-CNKk_twm.mjs → module-CNcwCKUJ.mjs} +1 -1
- package/dist/{multipartBody-TDaYOHGZ.mjs → multipartBody-Bl_gU3Wg.mjs} +1 -1
- package/dist/{openapi-473gZ-8x.mjs → openapi-BYrL8zvY.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +1 -1
- package/dist/outbox-admin/index.mjs +4 -4
- package/dist/{outbox-module-DOAmyXOb.mjs → outbox-module-6DMC_WNu.mjs} +40 -21
- package/dist/{outbox-module-BbdaMyqy.d.mts → outbox-module-CzsKRBvO.d.mts} +11 -2
- package/dist/permissions/index.mjs +5 -5
- package/dist/{permissions-DnAc6zoZ.mjs → permissions-C0GpDsB_.mjs} +6 -6
- package/dist/{pipe-BoV-z4db.mjs → pipe-4_XamfxI.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plugins/index.d.mts +5 -5
- package/dist/plugins/index.mjs +17 -16
- package/dist/plugins/response-cache.mjs +2 -2
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-BiU5ocWw.mjs → pluralize-BaQ62hOW.mjs} +1 -1
- package/dist/{preloadResources-DJ7Lli0a.mjs → preloadResources-BAx5s9EF.mjs} +70 -21
- package/dist/{preloadResources-DHkyk3QN.d.mts → preloadResources-DVgPCNcD.d.mts} +7 -7
- package/dist/presets/filesUpload.d.mts +1 -1
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +3 -3
- package/dist/presets/search.d.mts +1 -1
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-BMxH-Bb7.mjs → presets-CAaqVVcW.mjs} +4 -4
- package/dist/{projection-CRCM5S9T.mjs → projection-qbCOEvsh.mjs} +2 -2
- package/dist/{queryCachePlugin-Cl3zLG7g.mjs → queryCachePlugin-2Pp9w-8D.mjs} +5 -5
- package/dist/rateLimitKey-umrS6-vu.mjs +41 -0
- package/dist/{realtime-BWuHi-UI.mjs → realtime-zzoNLDtj.mjs} +9 -9
- package/dist/{redis-stream-mwLWlfHG.d.mts → redis-stream-DSsPyYzd.d.mts} +7 -2
- package/dist/{registerRoute-mvm6zY2H.mjs → registerRoute-_6zHiz0x.mjs} +10 -6
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-3maEt__c.mjs → registry-CEpoRpLP.mjs} +2 -2
- package/dist/{renewingLease-C1-GAUpr.mjs → renewingLease-B5Grm0pI.mjs} +1 -1
- package/dist/{replyHelpers-DVcUoled.mjs → replyHelpers-9h-a592u.mjs} +2 -2
- package/dist/{requestContext-KzIdSmN2.mjs → requestContext-D4PuGhEw.mjs} +1 -1
- package/dist/{rolldown-runtime-NVzJrC-o.mjs → rolldown-runtime-DzE6ikSH.mjs} +1 -1
- package/dist/{runtimeCapabilities-OrGatf7r.mjs → runtimeCapabilities-Bo7rSKjm.mjs} +1 -1
- package/dist/{schedules-DeRI03eo.mjs → schedules-Dm21pqHU.mjs} +8 -4
- package/dist/{schemaConverter-cXTayNOW.mjs → schemaConverter-DENbixyA.mjs} +1 -1
- package/dist/{schemaIR-Cc9ZPVs2.mjs → schemaIR-C2qUNzC6.mjs} +2 -2
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-C2r7_WGs.mjs → scope-CdYxQVxt.mjs} +4 -4
- package/dist/{simpleEqualityMatcher-Cr1F8jKZ.mjs → simpleEqualityMatcher-Cldubvul.mjs} +1 -1
- package/dist/{sse-BmZCVRGH.mjs → sse-DbyXoQun.mjs} +5 -5
- package/dist/{sseStream-nNPqvOeK.mjs → sseStream-BfZtL5-m.mjs} +2 -2
- package/dist/{store-helpers-C1r3-6M0.mjs → store-helpers-BfyOd5i6.mjs} +1 -1
- package/dist/{streaming-BxZDlH01.mjs → streaming-CFwCzEvU.mjs} +1 -1
- package/dist/{subscribe-helpers-Dca7Fcz2.mjs → subscribe-helpers-KgVEcn8L.mjs} +2 -2
- package/dist/sync/changelog.mjs +1 -1
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +4 -4
- package/dist/testing/index.mjs +10 -10
- package/dist/testing/outboxStoreContract.mjs +14 -3
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{transactionContext-6F7Gkbxg.mjs → transactionContext-46KyUADP.mjs} +1 -1
- package/dist/{typeGuards-BrXgbFi-.mjs → typeGuards-t_CVgRXN.mjs} +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-rzNprqbE.d.mts → types-9rvxn5Ym.d.mts} +46 -1
- package/dist/{types-BMa2EPtv.d.mts → types-BVlowlm7.d.mts} +2 -2
- package/dist/{types-khJmBErP.mjs → types-CNQyOrLk.mjs} +4 -4
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-Bi97zMEl.mjs → userHelpers-DLueLQdQ.mjs} +1 -1
- package/dist/utils/index.d.mts +4 -4
- package/dist/utils/index.mjs +11 -11
- package/dist/{utils-WlLDIKuw.mjs → utils-CUFBrhq-.mjs} +14 -6
- package/dist/{validate-pMke_boy.mjs → validate-DV3hRbsz.mjs} +2 -2
- package/dist/{versioning-CFK3c04-.mjs → versioning-BXwmj5SD.mjs} +3 -3
- package/dist/{versioning-DEs-_hFi.d.mts → versioning-P3V6ATyC.d.mts} +1 -1
- package/dist/workScope-CoGpuzDX.mjs +42 -0
- package/package.json +48 -39
- package/skills/arc/references/mcp.md +20 -0
- package/skills/arc/references/testing.md +0 -12
- package/skills/arc-code-review/references/anti-patterns.md +1 -1
- package/skills/arc-code-review/references/migration-recipes.md +0 -60
- package/skills/arc-code-review/references/mongokit-migration.md +0 -27
- package/skills/arc-module-publishing/references/package-manifest.md +3 -1
- package/dist/rateLimitKey-D4_rjP1K.mjs +0 -15
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as workSeedFromEvent, t as runWorkScope } from "../../workScope-CoGpuzDX.mjs";
|
|
2
3
|
import sjson from "secure-json-parse";
|
|
3
4
|
//#region src/events/transports/redis.ts
|
|
4
5
|
/**
|
|
@@ -107,14 +108,16 @@ var RedisEventTransport = class {
|
|
|
107
108
|
} catch {
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
runWorkScope(workSeedFromEvent(event), () => {
|
|
112
|
+
for (const handler of handlers) try {
|
|
113
|
+
const result = handler(event);
|
|
114
|
+
if (result && typeof result === "object" && "catch" in result) result.catch((err) => {
|
|
115
|
+
this.logger.error(`[RedisEventTransport] Handler error for ${event.type}:`, err);
|
|
116
|
+
});
|
|
117
|
+
} catch (err) {
|
|
113
118
|
this.logger.error(`[RedisEventTransport] Handler error for ${event.type}:`, err);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
this.logger.error(`[RedisEventTransport] Handler error for ${event.type}:`, err);
|
|
117
|
-
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
118
121
|
}
|
|
119
122
|
/**
|
|
120
123
|
* Convert an Arc event pattern to a Redis channel/pattern string.
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { _ as HealthCheck, a as ModuleContribution, c as LoadResourcesOptions, d as loadResources, i as EventHandlerDefinition, l as ResourceLike, n as ArcModuleInput, o as ModuleDisposer, r as ArcModuleRegistry, s as ModuleSetupContext, t as ArcModule, u as ResourceModule } from "../types-
|
|
3
|
-
import { _ as collectModuleScheduledJobs, a as lazyModuleExports, c as getModuleState, d as resolveModule, f as orderModules, g as collectModuleHealthChecks, h as extendModule, i as hasModuleExports, l as hasModule, m as ModuleExtension, n as getModuleExports, o as lazyRequiredModuleExports, p as subscribeModuleEventHandlers, r as getOptionalModuleExports, s as ModuleState, t as defineModule, u as resolveContribution, v as collectModuleWorkflows } from "../index-
|
|
4
|
-
import { c as ResolvedResourceDescriptor, l as describeResolvedModule, o as ResolvedModuleDescriptor, s as ResolvedModuleLifecycle } from "../fastify-augmentation-
|
|
5
|
-
import { a as RawBodyOptions, c as BetterAuthOption, d as JwtAuthOption, i as MultipartOptions, l as CustomAuthenticatorOption, n as preloadResourcesAsync, o as UnderPressureOptions, r as CreateAppOptions, s as AuthOption, t as preloadResources, u as CustomPluginAuthOption } from "../preloadResources-
|
|
2
|
+
import { _ as HealthCheck, a as ModuleContribution, c as LoadResourcesOptions, d as loadResources, i as EventHandlerDefinition, l as ResourceLike, n as ArcModuleInput, o as ModuleDisposer, r as ArcModuleRegistry, s as ModuleSetupContext, t as ArcModule, u as ResourceModule } from "../types-BVlowlm7.mjs";
|
|
3
|
+
import { _ as collectModuleScheduledJobs, a as lazyModuleExports, c as getModuleState, d as resolveModule, f as orderModules, g as collectModuleHealthChecks, h as extendModule, i as hasModuleExports, l as hasModule, m as ModuleExtension, n as getModuleExports, o as lazyRequiredModuleExports, p as subscribeModuleEventHandlers, r as getOptionalModuleExports, s as ModuleState, t as defineModule, u as resolveContribution, v as collectModuleWorkflows } from "../index-DbMglURO.mjs";
|
|
4
|
+
import { c as ResolvedResourceDescriptor, l as describeResolvedModule, o as ResolvedModuleDescriptor, s as ResolvedModuleLifecycle } from "../fastify-augmentation-HncZMmze.mjs";
|
|
5
|
+
import { a as RawBodyOptions, c as BetterAuthOption, d as JwtAuthOption, i as MultipartOptions, l as CustomAuthenticatorOption, n as preloadResourcesAsync, o as UnderPressureOptions, r as CreateAppOptions, s as AuthOption, t as preloadResources, u as CustomPluginAuthOption } from "../preloadResources-DVgPCNcD.mjs";
|
|
6
6
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
7
7
|
//#region src/factory/createApp.d.ts
|
|
8
8
|
/**
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as mergeHealthChecks, t as healthPlugin } from "../health-
|
|
3
|
-
import { S as resolveModule, _ as describeResolvedModule, a as createApp, b as collectModuleWorkflows, c as edgePreset, d as testingPreset, f as workerPreset, g as subscribeModuleEventHandlers, h as orderModules, i as DEFAULT_LOGGER_REDACT_PATHS, l as getPreset, m as hasModule, n as preloadResourcesAsync, p as getModuleState, r as ArcFactory, s as developmentPreset, t as preloadResources, u as productionPreset, v as collectModuleHealthChecks, x as resolveContribution, y as collectModuleScheduledJobs } from "../preloadResources-
|
|
4
|
-
import { a as lazyModuleExports, i as hasModuleExports, n as getModuleExports, o as lazyRequiredModuleExports, r as getOptionalModuleExports, t as defineModule } from "../module-
|
|
5
|
-
import { t as loadResources } from "../loadResources-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as mergeHealthChecks, t as healthPlugin } from "../health-BlGHjkqZ.mjs";
|
|
3
|
+
import { S as resolveModule, _ as describeResolvedModule, a as createApp, b as collectModuleWorkflows, c as edgePreset, d as testingPreset, f as workerPreset, g as subscribeModuleEventHandlers, h as orderModules, i as DEFAULT_LOGGER_REDACT_PATHS, l as getPreset, m as hasModule, n as preloadResourcesAsync, p as getModuleState, r as ArcFactory, s as developmentPreset, t as preloadResources, u as productionPreset, v as collectModuleHealthChecks, x as resolveContribution, y as collectModuleScheduledJobs } from "../preloadResources-BAx5s9EF.mjs";
|
|
4
|
+
import { a as lazyModuleExports, i as hasModuleExports, n as getModuleExports, o as lazyRequiredModuleExports, r as getOptionalModuleExports, t as defineModule } from "../module-CNcwCKUJ.mjs";
|
|
5
|
+
import { t as loadResources } from "../loadResources-E5UFlRrT.mjs";
|
|
6
6
|
//#region src/factory/module/extend.ts
|
|
7
7
|
/** Concatenate two contributions, resolving factories only when arc asks. */
|
|
8
8
|
function mergeContribution(own, extra) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { on as HookSystem, z as ResourceRegistry } from "./index-
|
|
2
|
+
import { on as HookSystem, z as ResourceRegistry } from "./index-D3sIPcD4.mjs";
|
|
3
3
|
import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
|
|
4
|
-
import { _ as HealthCheck, f as ScheduleDefinition, r as ArcModuleRegistry, t as ArcModule } from "./types-
|
|
5
|
-
import { s as ModuleState } from "./index-
|
|
4
|
+
import { _ as HealthCheck, f as ScheduleDefinition, r as ArcModuleRegistry, t as ArcModule } from "./types-BVlowlm7.mjs";
|
|
5
|
+
import { s as ModuleState } from "./index-DbMglURO.mjs";
|
|
6
6
|
import { FastifyPluginAsync } from "fastify";
|
|
7
7
|
//#region src/factory/module/descriptor.d.ts
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
2
|
//#region src/permissions/fields.ts
|
|
3
3
|
/**
|
|
4
4
|
* Field-Level Permissions
|
|
@@ -93,6 +93,41 @@ const fields = {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
|
+
* Field permissions implied by `schemaOptions.fieldRules[x].hidden === true`.
|
|
97
|
+
*
|
|
98
|
+
* `hidden` is documented — in `fieldRulePredicates.ts` and in arc's own adapter
|
|
99
|
+
* tests ("must never appear in API", "never surfaced") — as meaning the field is
|
|
100
|
+
* not readable AT ALL. Every read surface honoured that except the one that
|
|
101
|
+
* matters most: the response body. `select=`, `_distinct` and aggregations were
|
|
102
|
+
* gated while a plain `GET /:id` returned the value, so a resource declaring
|
|
103
|
+
* `fieldRules: { secret: { hidden: true } }` shipped the secret in every payload
|
|
104
|
+
* and nothing said so.
|
|
105
|
+
*
|
|
106
|
+
* Deriving a `hidden()` PERMISSION here routes it through the single existing
|
|
107
|
+
* response stripper rather than adding a second one — two strippers is how the
|
|
108
|
+
* two halves drift apart again.
|
|
109
|
+
*
|
|
110
|
+
* An explicit `fields` entry WINS: it is the more specific statement about
|
|
111
|
+
* visibility, and silently overriding an operator's `visibleTo([...])` with a
|
|
112
|
+
* broad query-surface flag would be the general defeating the specific.
|
|
113
|
+
*/
|
|
114
|
+
function deriveHiddenFieldPermissions(schemaOptions, explicit) {
|
|
115
|
+
const rules = schemaOptions?.fieldRules;
|
|
116
|
+
if (!rules) return explicit;
|
|
117
|
+
const derived = {};
|
|
118
|
+
let any = false;
|
|
119
|
+
for (const [name, rule] of Object.entries(rules)) {
|
|
120
|
+
if (rule?.hidden !== true) continue;
|
|
121
|
+
derived[name] = { _type: "hidden" };
|
|
122
|
+
any = true;
|
|
123
|
+
}
|
|
124
|
+
if (!any) return explicit;
|
|
125
|
+
return {
|
|
126
|
+
...derived,
|
|
127
|
+
...explicit ?? {}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
96
131
|
* Apply field-level READ permissions to a response object.
|
|
97
132
|
* Strips hidden fields, enforces visibility, and applies redaction.
|
|
98
133
|
*
|
|
@@ -161,4 +196,4 @@ function resolveEffectiveRoles(userRoles, orgRoles) {
|
|
|
161
196
|
return [.../* @__PURE__ */ new Set([...userRoles, ...orgRoles])];
|
|
162
197
|
}
|
|
163
198
|
//#endregion
|
|
164
|
-
export { resolveEffectiveRoles as i, applyFieldWritePermissions as n,
|
|
199
|
+
export { resolveEffectiveRoles as a, fields as i, applyFieldWritePermissions as n, deriveHiddenFieldPermissions as r, applyFieldReadPermissions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as pluralize } from "./pluralize-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as pluralize } from "./pluralize-BaQ62hOW.mjs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
//#region src/cli/commands/generate/name-helpers.ts
|
|
@@ -470,7 +470,8 @@ export default ${camel}Resource;
|
|
|
470
470
|
*/
|
|
471
471
|
|
|
472
472
|
import { defineTool } from '@classytic/arc/mcp';
|
|
473
|
-
|
|
473
|
+
import { z } from 'zod';
|
|
474
|
+
|
|
474
475
|
// Example: domain-specific action tool
|
|
475
476
|
// export const activate${name}Tool = defineTool('activate_${fileName}', {
|
|
476
477
|
// description: 'Activate a ${name.toLowerCase()} by ID',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { u as ValidationError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { u as ValidationError } from "./errors-BHD3L8of.mjs";
|
|
3
3
|
//#region src/utils/headers.ts
|
|
4
4
|
/**
|
|
5
5
|
* Canonical header typing + accessor.
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { an as HookRegistration, cn as afterCreate, dn as beforeCreate, en as DefineHookOptions, fn as beforeDelete, hn as defineHook, in as HookPhase, ln as afterDelete, mn as createHookSystem, nn as HookHandler, on as HookSystem, pn as beforeUpdate, rn as HookOperation, sn as HookSystemOptions, tn as HookContext, un as afterUpdate } from "../index-
|
|
2
|
+
import { an as HookRegistration, cn as afterCreate, dn as beforeCreate, en as DefineHookOptions, fn as beforeDelete, hn as defineHook, in as HookPhase, ln as afterDelete, mn as createHookSystem, nn as HookHandler, on as HookSystem, pn as beforeUpdate, rn as HookOperation, sn as HookSystemOptions, tn as HookContext, un as afterUpdate } from "../index-D3sIPcD4.mjs";
|
|
3
3
|
export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-96nzZLmk.mjs";
|
|
3
3
|
export { HookSystem, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as requireSingleHeaderValue } from "../headers-
|
|
3
|
-
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-
|
|
4
|
-
import { t as createIdempotencyResult } from "../interface-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requireSingleHeaderValue } from "../headers-BFEEshDS.mjs";
|
|
3
|
+
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-BfyOd5i6.mjs";
|
|
4
|
+
import { t as createIdempotencyResult } from "../interface-DjtFnZxH.mjs";
|
|
5
5
|
import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import fp from "fastify-plugin";
|
|
@@ -5,7 +5,7 @@ import { a as QueryCacheConfig } from "./QueryCache-DFA-QrU9.mjs";
|
|
|
5
5
|
import "./elevation-BXCfVcNG.mjs";
|
|
6
6
|
import { n as FieldPermissionMap } from "./fields-I_EeRWND.mjs";
|
|
7
7
|
import { n as EncryptionDirective } from "./types-ByHn9rEO.mjs";
|
|
8
|
-
import { n as DomainEvent } from "./EventTransport-
|
|
8
|
+
import { n as DomainEvent } from "./EventTransport-BPOQsEer.mjs";
|
|
9
9
|
import { Filter } from "@classytic/repo-core/filter";
|
|
10
10
|
import { AggDateBucket, AggMeasure, AggTopN, QueryOptions, StandardRepo, TenantPurgeStrategy, TransactionHandle } from "@classytic/repo-core/repository";
|
|
11
11
|
import { KeysetPaginationResult, OffsetPaginationResult } from "@classytic/repo-core/pagination";
|
|
@@ -516,6 +516,17 @@ type ArcControllerLike = {
|
|
|
516
516
|
update: (...args: never[]) => unknown;
|
|
517
517
|
delete: (...args: never[]) => unknown;
|
|
518
518
|
};
|
|
519
|
+
/**
|
|
520
|
+
* Constructor constraint for the four preset mixins (`BulkMixin`, `SlugMixin`,
|
|
521
|
+
* `SoftDeleteMixin`, `TreeMixin`).
|
|
522
|
+
*
|
|
523
|
+
* This is the ONE place `any[]` is unavoidable: TypeScript requires a mixin's
|
|
524
|
+
* base-class constraint to be `new (...args: any[]) => T` — `unknown[]` and
|
|
525
|
+
* `never[]` are both rejected with "A mixin class must have a constructor with
|
|
526
|
+
* a single rest parameter of type 'any[]'". Each mixin used to carry its own
|
|
527
|
+
* copy of this line and its own lint waiver; one definition, one waiver.
|
|
528
|
+
*/
|
|
529
|
+
type MixinConstructor<T> = new (...args: any[]) => T;
|
|
519
530
|
/**
|
|
520
531
|
* Return type of the controller's `list` method.
|
|
521
532
|
*
|
|
@@ -1104,6 +1115,33 @@ declare class QueryResolver {
|
|
|
1104
1115
|
* doesn't gate visibility — see `core/fieldRulePredicates.ts`.
|
|
1105
1116
|
*/
|
|
1106
1117
|
private getBlockedFields;
|
|
1118
|
+
/**
|
|
1119
|
+
* Is this projection path blocked — by its own name, or by a hidden ANCESTOR?
|
|
1120
|
+
*
|
|
1121
|
+
* `hidden: { secret: true }` hides the object, and an exact-name match left its children
|
|
1122
|
+
* reachable: `?select=secret.value` projected the very field the rule exists to withhold.
|
|
1123
|
+
* A rule on a parent covers everything under it, which is what "hidden" already means to
|
|
1124
|
+
* whoever wrote it.
|
|
1125
|
+
*/
|
|
1126
|
+
private isBlockedProjection;
|
|
1127
|
+
/**
|
|
1128
|
+
* Refuse a read that FILTERS or SORTS on a `hidden` field.
|
|
1129
|
+
*
|
|
1130
|
+
* `hidden` was enforced on the surfaces that RETURN a value — the response, `select=`,
|
|
1131
|
+
* `_distinct`, aggregations — but a filter key never returns the field, it INTERROGATES it:
|
|
1132
|
+
* `?passwordHash[like]=^ab` narrows the result set, so the row count answers a question about
|
|
1133
|
+
* a value the caller may not read. A resource with no `allowedFilterFields` was a blind
|
|
1134
|
+
* existence oracle over every hidden field it declared.
|
|
1135
|
+
*
|
|
1136
|
+
* Rejected rather than dropped, unlike `select`. Dropping a projection narrows what comes
|
|
1137
|
+
* back; dropping a filter WIDENS the rows, which is the silent-permissive shape this
|
|
1138
|
+
* framework fails loudly on everywhere else.
|
|
1139
|
+
*
|
|
1140
|
+
* Compound keys (`$or`, `$and`) are walked, because the offending key can be nested inside
|
|
1141
|
+
* one. A dotted path is blocked by its own name or by a hidden ancestor, so a rule on
|
|
1142
|
+
* `secret` also covers `secret.value`.
|
|
1143
|
+
*/
|
|
1144
|
+
private assertNoBlockedReadKeys;
|
|
1107
1145
|
}
|
|
1108
1146
|
//#endregion
|
|
1109
1147
|
//#region src/core/BaseCrudController.d.ts
|
|
@@ -1392,7 +1430,9 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
1392
1430
|
count: number;
|
|
1393
1431
|
}>>;
|
|
1394
1432
|
/** `?_distinct=field` → `repo.distinct(field, filter)` */
|
|
1395
|
-
protected dispatchDistinct(req: IRequestContext, field: string): Promise<IControllerResponse<
|
|
1433
|
+
protected dispatchDistinct(req: IRequestContext, field: string): Promise<IControllerResponse<{
|
|
1434
|
+
values: unknown[];
|
|
1435
|
+
}>>;
|
|
1396
1436
|
/** `?_exists=true` → `repo.exists(filter)` */
|
|
1397
1437
|
protected dispatchExists(req: IRequestContext): Promise<IControllerResponse<{
|
|
1398
1438
|
exists: boolean;
|
|
@@ -1425,7 +1465,6 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
1425
1465
|
}
|
|
1426
1466
|
//#endregion
|
|
1427
1467
|
//#region src/core/mixins/bulk.d.ts
|
|
1428
|
-
type Constructor$3<T> = new (...args: any[]) => T;
|
|
1429
1468
|
/** Public surface contributed by BulkMixin. */
|
|
1430
1469
|
interface BulkExt {
|
|
1431
1470
|
bulkCreate(req: IRequestContext): Promise<IControllerResponse<AnyRecord[]>>;
|
|
@@ -1437,33 +1476,30 @@ interface BulkExt {
|
|
|
1437
1476
|
deletedCount: number;
|
|
1438
1477
|
}>>;
|
|
1439
1478
|
}
|
|
1440
|
-
declare function BulkMixin<TBase extends
|
|
1479
|
+
declare function BulkMixin<TBase extends MixinConstructor<BaseCrudController>>(Base: TBase): TBase & MixinConstructor<BulkExt>;
|
|
1441
1480
|
//#endregion
|
|
1442
1481
|
//#region src/core/mixins/slug.d.ts
|
|
1443
|
-
type Constructor$2<T> = new (...args: any[]) => T;
|
|
1444
1482
|
/** Public surface contributed by SlugMixin. */
|
|
1445
1483
|
interface SlugExt {
|
|
1446
1484
|
getBySlug(req: IRequestContext): Promise<IControllerResponse<AnyRecord>>;
|
|
1447
1485
|
}
|
|
1448
|
-
declare function SlugMixin<TBase extends
|
|
1486
|
+
declare function SlugMixin<TBase extends MixinConstructor<BaseCrudController>>(Base: TBase): TBase & MixinConstructor<SlugExt>;
|
|
1449
1487
|
//#endregion
|
|
1450
1488
|
//#region src/core/mixins/tree.d.ts
|
|
1451
|
-
type Constructor$1<T> = new (...args: any[]) => T;
|
|
1452
1489
|
/** Public surface contributed by TreeMixin. */
|
|
1453
1490
|
interface TreeExt {
|
|
1454
1491
|
getTree(req: IRequestContext): Promise<IControllerResponse<AnyRecord[]>>;
|
|
1455
1492
|
getChildren(req: IRequestContext): Promise<IControllerResponse<AnyRecord[]>>;
|
|
1456
1493
|
}
|
|
1457
|
-
declare function TreeMixin<TBase extends
|
|
1494
|
+
declare function TreeMixin<TBase extends MixinConstructor<BaseCrudController>>(Base: TBase): TBase & MixinConstructor<TreeExt>;
|
|
1458
1495
|
//#endregion
|
|
1459
1496
|
//#region src/core/mixins/softDelete.d.ts
|
|
1460
|
-
type Constructor<T> = new (...args: any[]) => T;
|
|
1461
1497
|
/** Public surface contributed by SoftDeleteMixin. */
|
|
1462
1498
|
interface SoftDeleteExt {
|
|
1463
1499
|
getDeleted(req: IRequestContext): Promise<IControllerResponse<PaginationResult<AnyRecord>>>;
|
|
1464
1500
|
restore(req: IRequestContext): Promise<IControllerResponse<AnyRecord>>;
|
|
1465
1501
|
}
|
|
1466
|
-
declare function SoftDeleteMixin<TBase extends
|
|
1502
|
+
declare function SoftDeleteMixin<TBase extends MixinConstructor<BaseCrudController>>(Base: TBase): TBase & MixinConstructor<SoftDeleteExt>;
|
|
1467
1503
|
//#endregion
|
|
1468
1504
|
//#region src/core/BaseController.d.ts
|
|
1469
1505
|
/**
|
|
@@ -1531,7 +1567,7 @@ interface BaseController<TDoc extends AnyRecord = AnyRecord, _TRepository extend
|
|
|
1531
1567
|
deletedCount: number;
|
|
1532
1568
|
}>>;
|
|
1533
1569
|
}
|
|
1534
|
-
declare const BaseController_base: (new (repository: any, options?: BaseControllerOptions) => BaseCrudController<AnyRecord, any>) &
|
|
1570
|
+
declare const BaseController_base: (new (repository: any, options?: BaseControllerOptions) => BaseCrudController<AnyRecord, any>) & MixinConstructor<BulkExt> & MixinConstructor<SlugExt> & MixinConstructor<TreeExt> & MixinConstructor<SoftDeleteExt>;
|
|
1535
1571
|
/**
|
|
1536
1572
|
* Fully-composed controller: `BaseCrudController` + SoftDelete + Tree +
|
|
1537
1573
|
* Slug + Bulk. Drop-in replacement for the pre-2.11 god class. The
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { _ as HealthCheck, a as ModuleContribution, f as ScheduleDefinition, n as ArcModuleInput, r as ArcModuleRegistry, s as ModuleSetupContext, t as ArcModule } from "./types-
|
|
2
|
+
import { _ as HealthCheck, a as ModuleContribution, f as ScheduleDefinition, n as ArcModuleInput, r as ArcModuleRegistry, s as ModuleSetupContext, t as ArcModule } from "./types-BVlowlm7.mjs";
|
|
3
3
|
import { FastifyInstance } from "fastify";
|
|
4
4
|
//#region src/factory/module/contributions.d.ts
|
|
5
5
|
/**
|
|
@@ -201,7 +201,7 @@ declare function getModuleExports<TExports = unknown>(fastify: FastifyInstance,
|
|
|
201
201
|
* spelling that question as
|
|
202
202
|
*
|
|
203
203
|
* ```ts
|
|
204
|
-
* (fastify as
|
|
204
|
+
* (fastify as { arc?: { modules?: Record<string, unknown> } })
|
|
205
205
|
* .arc?.modules?.inventory;
|
|
206
206
|
* ```
|
|
207
207
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "./types-Ddl9OjmE.mjs";
|
|
3
3
|
import { l as PermissionCheck, t as AnyRecord } from "./base-C-NL2fTi.mjs";
|
|
4
|
-
import { C as RequestContext, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, H as CrudController, In as IRequestContext, L as RequestWithExtras, Pn as IController, T as CrudRouterOptions, U as ResourceConfig, V as ResourceDefinition, et as RouteSchemaOptions, jt as RouteMcpConfig, tt as ArcFieldRule, ut as AggregationConfig } from "./index-
|
|
5
|
-
import "./fastify-augmentation-
|
|
4
|
+
import { C as RequestContext, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, H as CrudController, In as IRequestContext, L as RequestWithExtras, Pn as IController, T as CrudRouterOptions, U as ResourceConfig, V as ResourceDefinition, et as RouteSchemaOptions, jt as RouteMcpConfig, tt as ArcFieldRule, ut as AggregationConfig } from "./index-D3sIPcD4.mjs";
|
|
5
|
+
import "./fastify-augmentation-HncZMmze.mjs";
|
|
6
6
|
import { Filter } from "@classytic/repo-core/filter";
|
|
7
7
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
8
8
|
import { z } from "zod";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
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-C-NL2fTi.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-
|
|
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-D3sIPcD4.mjs";
|
|
4
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-
|
|
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-
|
|
5
|
+
import "./fastify-augmentation-HncZMmze.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-SCsOJxWB.mjs";
|
|
7
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-BtYoMip1.mjs";
|
|
8
8
|
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-BGdVwP25.mjs";
|
|
9
9
|
//#region src/index.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
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-
|
|
3
|
-
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-
|
|
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-
|
|
5
|
-
import { t as defineAggregation } from "./defineAggregation-
|
|
6
|
-
import {
|
|
7
|
-
import { l as getControllerScope } from "./actionPermissions-
|
|
8
|
-
import { a as ResourceDefinition, t as defineResource } from "./defineResource-
|
|
9
|
-
import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-
|
|
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.40.0 | 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-BQ2FbhPB.mjs";
|
|
3
|
+
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-BHD3L8of.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-BqJtbiUA.mjs";
|
|
5
|
+
import { t as defineAggregation } from "./defineAggregation-BDA2Tw7v.mjs";
|
|
6
|
+
import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-fA-Dkou5.mjs";
|
|
7
|
+
import { l as getControllerScope } from "./actionPermissions-4OGbe3Hf.mjs";
|
|
8
|
+
import { a as ResourceDefinition, t as defineResource } from "./defineResource-DaIySrQr.mjs";
|
|
9
|
+
import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-CsZR037F.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-C0GpDsB_.mjs";
|
|
11
11
|
//#region src/index.ts
|
|
12
|
-
const version = "2.
|
|
12
|
+
const version = "2.40.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.
|
|
1
|
+
/*! @classytic/arc v2.40.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";
|
|
@@ -605,7 +605,7 @@ export const authResource = defineResource({
|
|
|
605
605
|
tag: 'Authentication',
|
|
606
606
|
prefix: '/auth',
|
|
607
607
|
|
|
608
|
-
adapter: createAdapter(User${ts ? " as
|
|
608
|
+
adapter: createAdapter(User${ts ? " as never" : ""}, userRepository${ts ? " as never" : ""}),
|
|
609
609
|
disableDefaultRoutes: true,
|
|
610
610
|
|
|
611
611
|
routes: [
|
|
@@ -661,7 +661,7 @@ export const userProfileResource = defineResource({
|
|
|
661
661
|
tag: 'User Profile',
|
|
662
662
|
prefix: '/users',
|
|
663
663
|
|
|
664
|
-
adapter: createAdapter(User${ts ? " as
|
|
664
|
+
adapter: createAdapter(User${ts ? " as never" : ""}, userRepository${ts ? " as never" : ""}),
|
|
665
665
|
disableDefaultRoutes: true,
|
|
666
666
|
|
|
667
667
|
routes: [
|
|
@@ -702,7 +702,7 @@ import { mongodbAdapter } from '@better-auth/mongo-adapter';` : "";
|
|
|
702
702
|
useBearer ? `import { bearer } from 'better-auth/plugins/bearer';` : "",
|
|
703
703
|
useApiKey ? `import { apiKey } from '@better-auth/api-key';` : ""
|
|
704
704
|
].filter(Boolean).join("\n");
|
|
705
|
-
const dbAdapter = useMongo ? config.typescript ? `database: mongodbAdapter(mongoose.connection.getClient().db() as
|
|
705
|
+
const dbAdapter = useMongo ? config.typescript ? `database: mongodbAdapter(mongoose.connection.getClient().db() as never),` : `database: mongodbAdapter(mongoose.connection.getClient().db()),` : `// Configure your database adapter here
|
|
706
706
|
// See: https://www.better-auth.com/docs/concepts/database`;
|
|
707
707
|
const pluginEntries = [
|
|
708
708
|
useBearer ? ` bearer(),` : "",
|
|
@@ -962,7 +962,7 @@ export async function resetPassword(request${ts ? ": FastifyRequest" : ""}, repl
|
|
|
962
962
|
*/
|
|
963
963
|
export async function getUserProfile(request${ts ? ": FastifyRequest" : ""}, reply${ts ? ": FastifyReply" : ""}) {
|
|
964
964
|
try {
|
|
965
|
-
const requestUser = (request${ts ? " as
|
|
965
|
+
const requestUser = (request${ts ? " as { user?: { _id?: string; id?: string } }" : ""}).user;
|
|
966
966
|
const userId = requestUser?._id || requestUser?.id;
|
|
967
967
|
if (!userId) {
|
|
968
968
|
return reply.code(401).send({ error: 'Authentication required', code: 'arc.unauthorized' });
|
|
@@ -985,7 +985,7 @@ export async function getUserProfile(request${ts ? ": FastifyRequest" : ""}, rep
|
|
|
985
985
|
*/
|
|
986
986
|
export async function updateUserProfile(request${ts ? ": FastifyRequest" : ""}, reply${ts ? ": FastifyReply" : ""}) {
|
|
987
987
|
try {
|
|
988
|
-
const requestUser = (request${ts ? " as
|
|
988
|
+
const requestUser = (request${ts ? " as { user?: { _id?: string; id?: string } }" : ""}).user;
|
|
989
989
|
const userId = requestUser?._id || requestUser?.id;
|
|
990
990
|
if (!userId) {
|
|
991
991
|
return reply.code(401).send({ error: 'Authentication required', code: 'arc.unauthorized' });
|
|
@@ -2727,7 +2727,7 @@ interface FlexibleMultiTenantOptions {
|
|
|
2727
2727
|
tenantField?: string;
|
|
2728
2728
|
}
|
|
2729
2729
|
` : `
|
|
2730
|
-
|
|
2730
|
+
import { multiTenantPreset } from '@classytic/arc/presets/tenant';
|
|
2731
2731
|
`}
|
|
2732
2732
|
export function flexibleMultiTenantPreset(options${ts ? ": FlexibleMultiTenantOptions = {}" : " = {}"}) {
|
|
2733
2733
|
const { tenantField = 'organizationId' } = options;
|
|
@@ -2972,7 +2972,7 @@ ${ts ? "import type { UserDocument } from './user.model.js';\nimport type { Clie
|
|
|
2972
2972
|
${ts ? "type ID = string | Types.ObjectId;\n" : ""}
|
|
2973
2973
|
class UserRepository extends Repository${ts ? "<UserDocument>" : ""} {
|
|
2974
2974
|
constructor() {
|
|
2975
|
-
super(User${ts ? " as
|
|
2975
|
+
super(User${ts ? " as never" : ""}, [
|
|
2976
2976
|
methodRegistryPlugin(),
|
|
2977
2977
|
mongoOperationsPlugin(),
|
|
2978
2978
|
]);
|
|
@@ -3058,7 +3058,7 @@ import userRepository from './user.repository.js';
|
|
|
3058
3058
|
|
|
3059
3059
|
class UserController extends BaseController {
|
|
3060
3060
|
constructor() {
|
|
3061
|
-
super(userRepository${config.typescript ? " as
|
|
3061
|
+
super(userRepository${config.typescript ? " as never" : ""});
|
|
3062
3062
|
}
|
|
3063
3063
|
|
|
3064
3064
|
// Custom user operations can be added here
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as DomainEvent } from "../EventTransport-
|
|
2
|
+
import { n as DomainEvent } from "../EventTransport-BPOQsEer.mjs";
|
|
3
3
|
import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-BOXVggMf.mjs";
|
|
4
4
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
5
5
|
//#region src/integrations/event-gateway.d.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.40.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
5
|
const { auth = true, orgScoped = false, 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-DbyXoQun.mjs").then((n) => n.r);
|
|
9
9
|
await fastify.register(ssePlugin, {
|
|
10
10
|
path: opts.sse?.path ?? "/events/stream",
|
|
11
11
|
requireAuth: auth,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BOXVggMf.mjs";
|
|
3
3
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
4
4
|
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-eyg5WEcy.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-
|
|
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-9rvxn5Ym.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.40.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-D_LFvMlm.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/jobs/execution.ts
|
|
5
5
|
async function executeTimedHandler(options) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "../../types-Ddl9OjmE.mjs";
|
|
3
3
|
import { l as PermissionCheck } from "../../base-C-NL2fTi.mjs";
|
|
4
|
-
import { Fn as IControllerResponse, In as IRequestContext, V as ResourceDefinition, zn as ServerAccessor } from "../../index-
|
|
4
|
+
import { Fn as IControllerResponse, In as IRequestContext, V as ResourceDefinition, zn as ServerAccessor } from "../../index-D3sIPcD4.mjs";
|
|
5
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-
|
|
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-9rvxn5Ym.mjs";
|
|
7
|
+
import { i as resolveToolCollisions, n as McpServerInstance, r as createMcpServer, t as AuthRef } from "../../createMcpServer-BVTs2S5G.mjs";
|
|
7
8
|
import { ErrorContract } from "@classytic/repo-core/errors";
|
|
8
9
|
import { FastifyPluginAsync } from "fastify";
|
|
9
10
|
import { z } from "zod";
|
|
@@ -96,50 +97,6 @@ interface CreateMcpAuthFromBetterAuthApiKeyOptions {
|
|
|
96
97
|
*/
|
|
97
98
|
declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, options?: CreateMcpAuthFromBetterAuthApiKeyOptions): McpAuthResolver;
|
|
98
99
|
//#endregion
|
|
99
|
-
//#region src/integrations/mcp/createMcpServer.d.ts
|
|
100
|
-
/**
|
|
101
|
-
* Mutable auth ref — updated per-request by mcpPlugin.
|
|
102
|
-
* Tool handlers read from this to get the current request's auth context.
|
|
103
|
-
*/
|
|
104
|
-
interface AuthRef {
|
|
105
|
-
current: McpAuthResult | null;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create a configured MCP server from declarative config.
|
|
109
|
-
*
|
|
110
|
-
* @param config - Server name, version, tools, prompts
|
|
111
|
-
* @returns McpServer instance (not yet connected to a transport)
|
|
112
|
-
*/
|
|
113
|
-
declare function createMcpServer(config: CreateMcpServerConfig, authRef?: AuthRef): Promise<McpServerInstance>;
|
|
114
|
-
/**
|
|
115
|
-
* Detect and resolve duplicate MCP tool names across the assembled tool list.
|
|
116
|
-
*
|
|
117
|
-
* Two outcomes:
|
|
118
|
-
*
|
|
119
|
-
* 1. **Auto-namespace** — when one tool's `source` carries a `preset:<name>`
|
|
120
|
-
* prefix and the other doesn't, the preset tool is renamed to
|
|
121
|
-
* `<presetName>_<originalName>` (e.g. softDelete's `restore_post`
|
|
122
|
-
* becomes `softdelete_restore_post` when the user defines
|
|
123
|
-
* `actions.restore`). The user's tool wins the canonical name because
|
|
124
|
-
* it's the more-specific intent.
|
|
125
|
-
*
|
|
126
|
-
* 2. **Typed throw** — every other collision (two user actions, two
|
|
127
|
-
* custom routes, two presets) raises `ArcError('arc.mcp.tool_name_collision')`
|
|
128
|
-
* naming both sources so the host's stack trace points at the
|
|
129
|
-
* resource definitions, not the MCP SDK internals.
|
|
130
|
-
*
|
|
131
|
-
* Exported for the testing harness so collision behaviour can be exercised
|
|
132
|
-
* without a full server boot.
|
|
133
|
-
*/
|
|
134
|
-
declare function resolveToolCollisions(tools: readonly ToolDefinition[]): ToolDefinition[];
|
|
135
|
-
/** Minimal interface for McpServer — avoids hard SDK type dependency */
|
|
136
|
-
interface McpServerInstance {
|
|
137
|
-
connect: (transport: unknown) => Promise<void>;
|
|
138
|
-
registerTool: (name: string, config: Record<string, unknown>, handler: (input: Record<string, unknown>, extra: Record<string, unknown>) => unknown) => unknown;
|
|
139
|
-
registerPrompt: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>) => unknown) => void;
|
|
140
|
-
resource: (...args: unknown[]) => void;
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
100
|
//#region src/integrations/mcp/crud-tools.d.ts
|
|
144
101
|
/**
|
|
145
102
|
* Default description for a CRUD tool. Enriches list descriptions with the
|