@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
package/dist/context/index.d.mts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { CacheAdapter } from "@classytic/repo-core/cache";
|
|
4
|
+
import { DomainEvent } from "@classytic/primitives/events";
|
|
4
5
|
//#region src/context/requestContext.d.ts
|
|
6
|
+
/** What started this unit of work. See `workScope.ts`. */
|
|
7
|
+
type WorkKind = "request" | "event" | "job";
|
|
5
8
|
/**
|
|
6
9
|
* Shape of the request-scoped context store.
|
|
7
|
-
* Populated by Arc's onRequest hook in arcCorePlugin
|
|
10
|
+
* Populated by Arc's onRequest hook in arcCorePlugin, or by `runWorkScope`
|
|
11
|
+
* for an event dispatch or a job run.
|
|
8
12
|
*/
|
|
9
13
|
interface RequestStore {
|
|
10
|
-
/**
|
|
14
|
+
/** Absent on stores created before scopes had kinds; treat as `'request'`. */
|
|
15
|
+
kind?: WorkKind;
|
|
16
|
+
/** Unique request identifier — the correlation key of an event or job scope. */
|
|
11
17
|
requestId?: string;
|
|
12
18
|
/** Authenticated user (if any) */
|
|
13
19
|
user?: {
|
|
@@ -88,14 +94,15 @@ declare function getTraceHeaders(): Record<string, string> | undefined;
|
|
|
88
94
|
//#endregion
|
|
89
95
|
//#region src/context/requestScopedCache.d.ts
|
|
90
96
|
/**
|
|
91
|
-
* The cache for the CURRENT request,
|
|
97
|
+
* The cache for the CURRENT unit of work — a request, an event dispatch or a
|
|
98
|
+
* job run (see `runWorkScope`) — or `undefined` outside one.
|
|
92
99
|
*
|
|
93
|
-
* Lazily created on first use, so a
|
|
100
|
+
* Lazily created on first use, so a scope that never touches a cached
|
|
94
101
|
* repository allocates nothing.
|
|
95
102
|
*/
|
|
96
103
|
declare function requestScopedCache(): CacheAdapter | undefined;
|
|
97
104
|
/**
|
|
98
|
-
* Whether the current
|
|
105
|
+
* Whether the current scope has allocated a cache yet. Diagnostics and
|
|
99
106
|
* tests only — never branch application behaviour on this.
|
|
100
107
|
*/
|
|
101
108
|
declare function hasRequestScopedCache(): boolean;
|
|
@@ -124,4 +131,25 @@ declare const transactionContext: {
|
|
|
124
131
|
storage: AsyncLocalStorage<unknown>;
|
|
125
132
|
};
|
|
126
133
|
//#endregion
|
|
127
|
-
|
|
134
|
+
//#region src/context/workScope.d.ts
|
|
135
|
+
interface WorkSeed {
|
|
136
|
+
readonly kind: WorkKind;
|
|
137
|
+
/** Becomes `requestId` — the correlation key for anything published inside. */
|
|
138
|
+
readonly id: string;
|
|
139
|
+
readonly organizationId?: string;
|
|
140
|
+
}
|
|
141
|
+
/** Enter a scope for `fn`, or run it inside the active one. */
|
|
142
|
+
declare function runWorkScope<T>(seed: WorkSeed, fn: () => T): T;
|
|
143
|
+
/**
|
|
144
|
+
* A per-scope memo slot: created once on first use, the same instance after.
|
|
145
|
+
* `undefined` outside a scope.
|
|
146
|
+
*/
|
|
147
|
+
declare function scopedValue<T>(slot: symbol, create: () => T): T | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* The scope an event dispatch runs in. The correlation id is the scope id so a
|
|
150
|
+
* child event published from a handler chains to the same correlation; the
|
|
151
|
+
* tenant rides `meta`, never the payload.
|
|
152
|
+
*/
|
|
153
|
+
declare function workSeedFromEvent(event: DomainEvent): WorkSeed;
|
|
154
|
+
//#endregion
|
|
155
|
+
export { type DbSession, type RequestStore, type WorkKind, type WorkSeed, getTraceHeaders, hasRequestScopedCache, requestContext, requestScopedCache, runWorkScope, scopedValue, transactionContext, workSeedFromEvent };
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as transactionContext } from "../transactionContext-
|
|
3
|
-
import { n as requestContext, t as getTraceHeaders } from "../requestContext-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as transactionContext } from "../transactionContext-46KyUADP.mjs";
|
|
3
|
+
import { n as requestContext, t as getTraceHeaders } from "../requestContext-D4PuGhEw.mjs";
|
|
4
|
+
import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-CoGpuzDX.mjs";
|
|
4
5
|
//#region src/context/requestScopedCache.ts
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
* from the fields arc's own hooks populate on `RequestStore`.
|
|
8
|
-
*/
|
|
9
|
-
const SLOT = "_requestCache";
|
|
6
|
+
/** The memo slot the per-scope store hangs off. */
|
|
7
|
+
const SLOT = Symbol.for("arc.requestScopedCache");
|
|
10
8
|
/**
|
|
11
9
|
* A `Map`-backed `CacheAdapter` with NO eviction and NO TTL — both deliberate.
|
|
12
10
|
*
|
|
@@ -39,26 +37,21 @@ function createRequestCacheAdapter() {
|
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
/**
|
|
42
|
-
* The cache for the CURRENT request,
|
|
40
|
+
* The cache for the CURRENT unit of work — a request, an event dispatch or a
|
|
41
|
+
* job run (see `runWorkScope`) — or `undefined` outside one.
|
|
43
42
|
*
|
|
44
|
-
* Lazily created on first use, so a
|
|
43
|
+
* Lazily created on first use, so a scope that never touches a cached
|
|
45
44
|
* repository allocates nothing.
|
|
46
45
|
*/
|
|
47
46
|
function requestScopedCache() {
|
|
48
|
-
|
|
49
|
-
if (!store) return void 0;
|
|
50
|
-
const existing = store[SLOT];
|
|
51
|
-
if (existing) return existing;
|
|
52
|
-
const created = createRequestCacheAdapter();
|
|
53
|
-
store[SLOT] = created;
|
|
54
|
-
return created;
|
|
47
|
+
return scopedValue(SLOT, createRequestCacheAdapter);
|
|
55
48
|
}
|
|
56
49
|
/**
|
|
57
|
-
* Whether the current
|
|
50
|
+
* Whether the current scope has allocated a cache yet. Diagnostics and
|
|
58
51
|
* tests only — never branch application behaviour on this.
|
|
59
52
|
*/
|
|
60
53
|
function hasRequestScopedCache() {
|
|
61
54
|
return requestContext.get()?.[SLOT] !== void 0;
|
|
62
55
|
}
|
|
63
56
|
//#endregion
|
|
64
|
-
export { getTraceHeaders, hasRequestScopedCache, requestContext, requestScopedCache, transactionContext };
|
|
57
|
+
export { getTraceHeaders, hasRequestScopedCache, requestContext, requestScopedCache, runWorkScope, scopedValue, transactionContext, workSeedFromEvent };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { $t as AccessControlConfig, B as defineResource, Bt as BaseController, Cn as ControllerConstructionOptions, En as BodySanitizerConfig, Gt as SlugExt, Ht as SoftDeleteMixin, Jt as BulkMixin, Kt as SlugMixin, Qt as AccessControl, Sn as ControllerConfigurableOptions, Tn as BodySanitizer, Ut as TreeExt, V as ResourceDefinition, Vt as SoftDeleteExt, Wt as TreeMixin, Xt as QueryResolver, Yt as BaseCrudController, Zt as QueryResolverConfig, ct as AggMeasureShorthand, dt as AggregationDateRangeRequirement, ft as AggregationIndexHint, gt as AggregationsMap, ht as AggregationRateLimit, lt as AggregationCacheConfig, mt as AggregationMaterializedResult, pt as AggregationMaterializedContext, qt as BulkExt, st as AggMeasureInput, ut as AggregationConfig, wn as ListResult, xn as BaseControllerOptions } from "../index-
|
|
3
|
-
import { A as CRUD_OPERATIONS, B as HookOperation, C as SeamedResourceConfig, D as createCrudRouter, 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, O as createPermissionMiddleware, P as DEFAULT_MAX_LIMIT, R as HOOK_OPERATIONS, S as ResourceSeams, T as DefineActionConfig, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, _ as getEntityId, a as formatValidationErrors, b as defineResourceVariants, c as nativePolicyFilter, d as createCrudHandlers, f as createFastifyHandler, g as sendControllerResponse, h as getControllerScope, i as assertValidConfig, j as CrudOperation, k as defineAggregation, l as collectReadBlockedFields, m as getControllerContext, n as ValidateOptions, o as validateResourceConfig, p as createRequestContext, q as RESERVED_QUERY_PARAMS, r as ValidationResult, s as NativePolicyFilter, t as ConfigError, u as isFieldReadable, v as getEntityIdField, w as mergeResourceConfig, x as AdapterLike, y as getEntityQuery, z as HOOK_PHASES } from "../index-
|
|
2
|
+
import { $t as AccessControlConfig, B as defineResource, Bt as BaseController, Cn as ControllerConstructionOptions, En as BodySanitizerConfig, Gt as SlugExt, Ht as SoftDeleteMixin, Jt as BulkMixin, Kt as SlugMixin, Qt as AccessControl, Sn as ControllerConfigurableOptions, Tn as BodySanitizer, Ut as TreeExt, V as ResourceDefinition, Vt as SoftDeleteExt, Wt as TreeMixin, Xt as QueryResolver, Yt as BaseCrudController, Zt as QueryResolverConfig, ct as AggMeasureShorthand, dt as AggregationDateRangeRequirement, ft as AggregationIndexHint, gt as AggregationsMap, ht as AggregationRateLimit, lt as AggregationCacheConfig, mt as AggregationMaterializedResult, pt as AggregationMaterializedContext, qt as BulkExt, st as AggMeasureInput, ut as AggregationConfig, wn as ListResult, xn as BaseControllerOptions } from "../index-D3sIPcD4.mjs";
|
|
3
|
+
import { A as CRUD_OPERATIONS, B as HookOperation, C as SeamedResourceConfig, D as createCrudRouter, 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, O as createPermissionMiddleware, P as DEFAULT_MAX_LIMIT, R as HOOK_OPERATIONS, S as ResourceSeams, T as DefineActionConfig, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, _ as getEntityId, a as formatValidationErrors, b as defineResourceVariants, c as nativePolicyFilter, d as createCrudHandlers, f as createFastifyHandler, g as sendControllerResponse, h as getControllerScope, i as assertValidConfig, j as CrudOperation, k as defineAggregation, l as collectReadBlockedFields, m as getControllerContext, n as ValidateOptions, o as validateResourceConfig, p as createRequestContext, q as RESERVED_QUERY_PARAMS, r as ValidationResult, s as NativePolicyFilter, t as ConfigError, u as isFieldReadable, v as getEntityIdField, w as mergeResourceConfig, x as AdapterLike, y as getEntityQuery, z as HOOK_PHASES } from "../index-SCsOJxWB.mjs";
|
|
4
4
|
export { AccessControl, type AccessControlConfig, type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, BaseController, type BaseControllerOptions, BaseCrudController, BodySanitizer, type BodySanitizerConfig, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DefineActionConfig, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, type NativePolicyFilter, QueryResolver, type QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, type ResourceSeams, SYSTEM_FIELDS, type SeamedResourceConfig, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type ValidateOptions, type ValidationResult, assertValidConfig, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, sendControllerResponse, validateResourceConfig };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 { a as BulkMixin, c as collectReadBlockedFields, f as BodySanitizer, h as nativePolicyFilter, i as SlugMixin, l as isFieldReadable, m as AccessControl, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController } from "../BaseController-
|
|
4
|
-
import { t as defineAggregation } from "../defineAggregation-
|
|
5
|
-
import { a as createCrudHandlers, c as getControllerContext, l as getControllerScope, o as createFastifyHandler, s as createRequestContext, u as sendControllerResponse } from "../actionPermissions-
|
|
6
|
-
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, o as createCrudRouter, r as formatValidationErrors, s as createPermissionMiddleware, t as defineResource } from "../defineResource-
|
|
7
|
-
import { a as mergeResourceConfig, i as defineResourceVariants, n as getEntityIdField, o as defineAction, r as getEntityQuery, t as getEntityId } from "../core-
|
|
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 { a as BulkMixin, c as collectReadBlockedFields, f as BodySanitizer, h as nativePolicyFilter, i as SlugMixin, l as isFieldReadable, m as AccessControl, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController } from "../BaseController-BqJtbiUA.mjs";
|
|
4
|
+
import { t as defineAggregation } from "../defineAggregation-BDA2Tw7v.mjs";
|
|
5
|
+
import { a as createCrudHandlers, c as getControllerContext, l as getControllerScope, o as createFastifyHandler, s as createRequestContext, u as sendControllerResponse } from "../actionPermissions-4OGbe3Hf.mjs";
|
|
6
|
+
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, o as createCrudRouter, r as formatValidationErrors, s as createPermissionMiddleware, t as defineResource } from "../defineResource-DaIySrQr.mjs";
|
|
7
|
+
import { a as mergeResourceConfig, i as defineResourceVariants, n as getEntityIdField, o as defineAction, r as getEntityQuery, t as getEntityId } from "../core-CsZR037F.mjs";
|
|
8
8
|
export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, assertValidConfig, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, sendControllerResponse, validateResourceConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import "./constants-
|
|
3
|
-
import { t as defineResource } from "./defineResource-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import "./constants-BQ2FbhPB.mjs";
|
|
3
|
+
import { t as defineResource } from "./defineResource-DaIySrQr.mjs";
|
|
4
4
|
//#region src/core/defineAction.ts
|
|
5
5
|
/**
|
|
6
6
|
* Build an `ActionDefinition` with a typed handler. The literal schema
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import "./constants-
|
|
4
|
-
import { f as createError } from "./errors-
|
|
5
|
-
import { i as resolvePipelineSteps, n as buildActionPipelineHandler, u as sendControllerResponse } from "./actionPermissions-
|
|
6
|
-
import { a as selectPluginMw, c as buildRouteHooks, f as buildAuthMiddlewareForPermissions, i as resolveRouterPluginMw, n as buildRateLimitConfig, o as buildActionPermissionMw, p as buildArcDecorator, r as buildRouteConfig, t as tryRegisterRoute, u as routeHookOptions } from "./registerRoute-
|
|
7
|
-
import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
|
|
3
|
+
import "./constants-BQ2FbhPB.mjs";
|
|
4
|
+
import { f as createError } from "./errors-BHD3L8of.mjs";
|
|
5
|
+
import { i as resolvePipelineSteps, n as buildActionPipelineHandler, u as sendControllerResponse } from "./actionPermissions-4OGbe3Hf.mjs";
|
|
6
|
+
import { a as selectPluginMw, c as buildRouteHooks, f as buildAuthMiddlewareForPermissions, i as resolveRouterPluginMw, n as buildRateLimitConfig, o as buildActionPermissionMw, p as buildArcDecorator, r as buildRouteConfig, t as tryRegisterRoute, u as routeHookOptions } from "./registerRoute-_6zHiz0x.mjs";
|
|
7
|
+
import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-C2qUNzC6.mjs";
|
|
8
8
|
//#region src/core/createActionRouter.ts
|
|
9
9
|
var createActionRouter_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
buildActionBodySchema: () => buildActionBodySchema,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "./authorizationDecision-
|
|
3
|
-
import { f as createError } from "./errors-
|
|
4
|
-
import { u as getRequestScope } from "./types-
|
|
5
|
-
import { a as selectPluginMw, c as buildRouteHooks, d as buildAuthMiddleware, i as resolveRouterPluginMw, n as buildRateLimitConfig, p as buildArcDecorator, u as routeHookOptions } from "./registerRoute-
|
|
6
|
-
import { n as validateAggregations } from "./validate-
|
|
7
|
-
import { t as buildAggregationHandler } from "./buildHandler-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-D_LFvMlm.mjs";
|
|
3
|
+
import { f as createError } from "./errors-BHD3L8of.mjs";
|
|
4
|
+
import { u as getRequestScope } from "./types-CNQyOrLk.mjs";
|
|
5
|
+
import { a as selectPluginMw, c as buildRouteHooks, d as buildAuthMiddleware, i as resolveRouterPluginMw, n as buildRateLimitConfig, p as buildArcDecorator, u as routeHookOptions } from "./registerRoute-_6zHiz0x.mjs";
|
|
6
|
+
import { n as validateAggregations } from "./validate-DV3hRbsz.mjs";
|
|
7
|
+
import { t as buildAggregationHandler } from "./buildHandler-BG_CHXqQ.mjs";
|
|
8
8
|
//#region src/core/aggregation/createAggregationRouter.ts
|
|
9
9
|
/**
|
|
10
10
|
* Register one Fastify route per aggregation. No-op when the map is
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
import { _ as ToolDefinition, c as McpAuthResult, r as CreateMcpServerConfig } from "./types-9rvxn5Ym.mjs";
|
|
3
|
+
//#region src/integrations/mcp/createMcpServer.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Mutable auth ref — updated per-request by mcpPlugin.
|
|
6
|
+
* Tool handlers read from this to get the current request's auth context.
|
|
7
|
+
*/
|
|
8
|
+
interface AuthRef {
|
|
9
|
+
current: McpAuthResult | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a configured MCP server from declarative config.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Server name, version, tools, prompts
|
|
15
|
+
* @returns McpServer instance (not yet connected to a transport)
|
|
16
|
+
*/
|
|
17
|
+
declare function createMcpServer(config: CreateMcpServerConfig, authRef?: AuthRef): Promise<McpServerInstance>;
|
|
18
|
+
/**
|
|
19
|
+
* Detect and resolve duplicate MCP tool names across the assembled tool list.
|
|
20
|
+
*
|
|
21
|
+
* Two outcomes:
|
|
22
|
+
*
|
|
23
|
+
* 1. **Auto-namespace** — when one tool's `source` carries a `preset:<name>`
|
|
24
|
+
* prefix and the other doesn't, the preset tool is renamed to
|
|
25
|
+
* `<presetName>_<originalName>` (e.g. softDelete's `restore_post`
|
|
26
|
+
* becomes `softdelete_restore_post` when the user defines
|
|
27
|
+
* `actions.restore`). The user's tool wins the canonical name because
|
|
28
|
+
* it's the more-specific intent.
|
|
29
|
+
*
|
|
30
|
+
* 2. **Typed throw** — every other collision (two user actions, two
|
|
31
|
+
* custom routes, two presets) raises `ArcError('arc.mcp.tool_name_collision')`
|
|
32
|
+
* naming both sources so the host's stack trace points at the
|
|
33
|
+
* resource definitions, not the MCP SDK internals.
|
|
34
|
+
*
|
|
35
|
+
* Exported for the testing harness so collision behaviour can be exercised
|
|
36
|
+
* without a full server boot.
|
|
37
|
+
*/
|
|
38
|
+
declare function resolveToolCollisions(tools: readonly ToolDefinition[]): ToolDefinition[];
|
|
39
|
+
/** Minimal interface for McpServer — avoids hard SDK type dependency */
|
|
40
|
+
interface McpServerInstance {
|
|
41
|
+
connect: (transport: unknown) => Promise<void>;
|
|
42
|
+
registerTool: (name: string, config: Record<string, unknown>, handler: (input: Record<string, unknown>, extra: Record<string, unknown>) => unknown) => unknown;
|
|
43
|
+
registerPrompt: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>) => unknown) => void;
|
|
44
|
+
/** v2 name. v1 called this `resource()` — same four arguments. */
|
|
45
|
+
registerResource: (...args: unknown[]) => void;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { resolveToolCollisions as i, McpServerInstance as n, createMcpServer as r, AuthRef as t };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { p as MUTATION_OPERATIONS, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { p as MUTATION_OPERATIONS, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-BQ2FbhPB.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { r as ForbiddenError } from "./errors-
|
|
5
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
6
|
-
import { b as isElevated, n as PUBLIC_SCOPE, x as isMember } from "./types-
|
|
7
|
-
import { d as isWriteVerbCapable, p as DEFAULT_FIELD_WRITE_DENIAL_POLICY, t as BaseController, u as detectOverriddenWriteSlots } from "./BaseController-
|
|
8
|
-
import { v as getDefaultCrudSchemas } from "./utils-
|
|
9
|
-
import {
|
|
10
|
-
import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-
|
|
11
|
-
import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-
|
|
12
|
-
import { a as createCrudHandlers, i as resolvePipelineSteps, o as createFastifyHandler, r as buildPipelineHandler, s as createRequestContext, t as resolveActionPermission } from "./actionPermissions-
|
|
13
|
-
import { a as selectPluginMw, c as buildRouteHooks, d as buildAuthMiddleware, i as resolveRouterPluginMw, l as resolveRoutePreHandlers, n as buildRateLimitConfig, p as buildArcDecorator, r as buildRouteConfig, s as buildCrudPermissionMw, t as tryRegisterRoute, u as routeHookOptions } from "./registerRoute-
|
|
14
|
-
import { t as hasEvents } from "./typeGuards-
|
|
15
|
-
import { B as requireAuth } from "./permissions-
|
|
16
|
-
import { r as getAvailablePresets, t as applyPresets } from "./presets-
|
|
17
|
-
import { t as pluralize } from "./pluralize-
|
|
4
|
+
import { r as ForbiddenError } from "./errors-BHD3L8of.mjs";
|
|
5
|
+
import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
|
|
6
|
+
import { b as isElevated, n as PUBLIC_SCOPE, x as isMember } from "./types-CNQyOrLk.mjs";
|
|
7
|
+
import { d as isWriteVerbCapable, p as DEFAULT_FIELD_WRITE_DENIAL_POLICY, t as BaseController, u as detectOverriddenWriteSlots } from "./BaseController-BqJtbiUA.mjs";
|
|
8
|
+
import { v as getDefaultCrudSchemas } from "./utils-CUFBrhq-.mjs";
|
|
9
|
+
import { a as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-fA-Dkou5.mjs";
|
|
10
|
+
import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-DENbixyA.mjs";
|
|
11
|
+
import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-CFwCzEvU.mjs";
|
|
12
|
+
import { a as createCrudHandlers, i as resolvePipelineSteps, o as createFastifyHandler, r as buildPipelineHandler, s as createRequestContext, t as resolveActionPermission } from "./actionPermissions-4OGbe3Hf.mjs";
|
|
13
|
+
import { a as selectPluginMw, c as buildRouteHooks, d as buildAuthMiddleware, i as resolveRouterPluginMw, l as resolveRoutePreHandlers, n as buildRateLimitConfig, p as buildArcDecorator, r as buildRouteConfig, s as buildCrudPermissionMw, t as tryRegisterRoute, u as routeHookOptions } from "./registerRoute-_6zHiz0x.mjs";
|
|
14
|
+
import { t as hasEvents } from "./typeGuards-t_CVgRXN.mjs";
|
|
15
|
+
import { B as requireAuth } from "./permissions-C0GpDsB_.mjs";
|
|
16
|
+
import { r as getAvailablePresets, t as applyPresets } from "./presets-CAaqVVcW.mjs";
|
|
17
|
+
import { t as pluralize } from "./pluralize-BaQ62hOW.mjs";
|
|
18
18
|
import { isReadOnlyRepo } from "@classytic/repo-core/repository";
|
|
19
19
|
//#region src/core/middlewares/fieldWrite.ts
|
|
20
20
|
/**
|
|
@@ -1425,7 +1425,7 @@ function buildResourcePlugin(resource) {
|
|
|
1425
1425
|
extensions: resource.extensions
|
|
1426
1426
|
});
|
|
1427
1427
|
if (resource.actions && Object.keys(resource.actions).length > 0) {
|
|
1428
|
-
const { createActionRouter } = await import("./createActionRouter-
|
|
1428
|
+
const { createActionRouter } = await import("./createActionRouter-BR93gCKg.mjs").then((n) => n.n);
|
|
1429
1429
|
createActionRouter(typedInstance, {
|
|
1430
1430
|
...normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log),
|
|
1431
1431
|
resourceName: resource.name,
|
|
@@ -1440,7 +1440,7 @@ function buildResourcePlugin(resource) {
|
|
|
1440
1440
|
});
|
|
1441
1441
|
}
|
|
1442
1442
|
if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
|
|
1443
|
-
const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-
|
|
1443
|
+
const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-CF40Aw95.mjs"), import("./validate-DV3hRbsz.mjs").then((n) => n.r)]);
|
|
1444
1444
|
const repoForAgg = resource.controller?.repository ?? resource.repository;
|
|
1445
1445
|
if (!adapterSupportsAggregate(repoForAgg)) {
|
|
1446
1446
|
const undispatchable = Object.entries(resource.aggregations).filter(([, cfg]) => !cfg.materialized).map(([name]) => name);
|
|
@@ -2457,10 +2457,8 @@ function defineResource(config) {
|
|
|
2457
2457
|
const configWithId = resolveIdField(normalisedConfig, repository);
|
|
2458
2458
|
const resolvedConfig = applyPresetsAndAutoInject(configWithId);
|
|
2459
2459
|
const hasCrudRoutes = computeHasCrudRoutes(resolvedConfig);
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
diagnostics = diagnostics.concat(collectUngatedCrudDiagnostics(resolvedConfig, strict));
|
|
2463
|
-
}
|
|
2460
|
+
const strict = resolvedConfig.strictPermissions ?? process.env.ARC_STRICT_PERMISSIONS === "true";
|
|
2461
|
+
diagnostics = diagnostics.concat(collectUngatedCrudDiagnostics(resolvedConfig, strict));
|
|
2464
2462
|
const fatal = diagnostics.filter((d) => d.severity === "error");
|
|
2465
2463
|
if (fatal.length > 0) throw new Error(fatal.map((d) => d.message).join("\n\n"));
|
|
2466
2464
|
const narrowedConfig = resolvedConfig;
|
package/dist/discovery/index.mjs
CHANGED
package/dist/docs/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { p as RegistryEntry } from "../index-
|
|
2
|
+
import { p as RegistryEntry } from "../index-D3sIPcD4.mjs";
|
|
3
3
|
import { t as ExternalOpenApiPaths } from "../externalPaths-CmGOxOtD.mjs";
|
|
4
4
|
import { FastifyPluginAsync } from "fastify";
|
|
5
5
|
//#region src/docs/openapi/types.d.ts
|
package/dist/docs/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as getUserRoles } from "../userHelpers-
|
|
3
|
-
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as getUserRoles } from "../userHelpers-DLueLQdQ.mjs";
|
|
3
|
+
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-BYrL8zvY.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/docs/scalar.ts
|
|
6
6
|
const scalarPlugin = async (fastify, opts = {}) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
5
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
4
|
+
import { n as requireSingleHeaderValue } from "./headers-BFEEshDS.mjs";
|
|
5
|
+
import { n as getUserRoles } from "./userHelpers-DLueLQdQ.mjs";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
7
7
|
//#region src/scope/elevation.ts
|
|
8
8
|
var elevation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as ArcError } from "../errors-
|
|
3
|
-
import { t as parseJsonBody } from "../jsonBody-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as ArcError } from "../errors-BHD3L8of.mjs";
|
|
3
|
+
import { t as parseJsonBody } from "../jsonBody-Dx6jH_Nb.mjs";
|
|
4
4
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
//#region src/encryption/fieldCipher.ts
|
|
@@ -7,7 +7,13 @@ import { FastifyInstance, FastifyRequest } from "fastify";
|
|
|
7
7
|
* to a partial `ErrorContract`. Highest-priority dispatch in the handler.
|
|
8
8
|
*/
|
|
9
9
|
interface ErrorMapper<T extends Error = Error> {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Only ever used as `error instanceof mapper.type` — the constructor is never
|
|
12
|
+
* CALLED through this interface, so `never[]` is the sound parameter type:
|
|
13
|
+
* every real class assigns to it (constructor parameters are contravariant),
|
|
14
|
+
* and nothing can invoke it. `any[]` here was a permission nothing used.
|
|
15
|
+
*/
|
|
16
|
+
type: abstract new (...args: never[]) => T;
|
|
11
17
|
toResponse: (error: T) => {
|
|
12
18
|
status: number;
|
|
13
19
|
code?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { m as statusToArcCode, p as isArcError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
|
|
3
|
+
import { m as statusToArcCode, p as isArcError } from "./errors-BHD3L8of.mjs";
|
|
4
4
|
import { isProductionEnv } from "@classytic/primitives/environment";
|
|
5
5
|
import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DzE6ikSH.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { d as createDomainError } from "./errors-
|
|
5
|
-
import { n as requestContext } from "./requestContext-
|
|
6
|
-
import { n as MemoryEventTransport, r as createEvent, t as ARC_EVENT_TRANSPORT } from "./EventTransport-
|
|
4
|
+
import { d as createDomainError } from "./errors-BHD3L8of.mjs";
|
|
5
|
+
import { n as requestContext } from "./requestContext-D4PuGhEw.mjs";
|
|
6
|
+
import { n as MemoryEventTransport, r as createEvent, t as ARC_EVENT_TRANSPORT } from "./EventTransport-BUkTwY_x.mjs";
|
|
7
7
|
import { isProductionEnv } from "@classytic/primitives/environment";
|
|
8
8
|
import fp from "fastify-plugin";
|
|
9
9
|
//#region src/events/retry.ts
|
|
@@ -147,7 +147,7 @@ const eventPlugin = async (fastify, opts = {}) => {
|
|
|
147
147
|
* from a host value afterwards.
|
|
148
148
|
*/
|
|
149
149
|
const ownsTransport = opts.transport === void 0;
|
|
150
|
-
const { transport = new MemoryEventTransport(), singleProcess = false, logEvents = false, failOpen = true, retry: retryOpts, deadLetterQueue: dlqOpts, wal, onPublish, onPublishError, registry, validateMode: rawValidateMode, warnOnDuplicate: rawWarnOnDuplicate } = opts;
|
|
150
|
+
const { transport = new MemoryEventTransport(opts.memoryTransport), singleProcess = false, logEvents = false, failOpen = true, retry: retryOpts, deadLetterQueue: dlqOpts, wal, onPublish, onPublishError, registry, validateMode: rawValidateMode, warnOnDuplicate: rawWarnOnDuplicate } = opts;
|
|
151
151
|
const validateMode = rawValidateMode ?? (registry ? "warn" : "off");
|
|
152
152
|
const warnOnDuplicate = rawWarnOnDuplicate ?? !isProductionEnv(process.env.NODE_ENV);
|
|
153
153
|
const DUP_WINDOW_MS = 5e3;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-
|
|
2
|
+
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler, s as MemoryEventTransportOptions } from "./EventTransport-BPOQsEer.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
//#region src/events/defineEvent.d.ts
|
|
5
5
|
interface EventSchema {
|
|
@@ -227,6 +227,15 @@ declare function createDeadLetterPublisher(events: {
|
|
|
227
227
|
interface EventPluginOptions {
|
|
228
228
|
/** Event transport (default: MemoryEventTransport) */
|
|
229
229
|
transport?: EventTransport;
|
|
230
|
+
/**
|
|
231
|
+
* Options for the DEFAULT `MemoryEventTransport`, when no `transport` is
|
|
232
|
+
* supplied. Ignored if you pass your own.
|
|
233
|
+
*
|
|
234
|
+
* Exists so the default path can reach `handlerDispatch` / `onHandlerError`
|
|
235
|
+
* at all: without it only an app that hand-constructs its transport could
|
|
236
|
+
* opt in, which is most of the fleet unable to change either setting.
|
|
237
|
+
*/
|
|
238
|
+
memoryTransport?: MemoryEventTransportOptions;
|
|
230
239
|
/**
|
|
231
240
|
* Declare that this deployment is ONE process on purpose — the in-memory
|
|
232
241
|
* transport is its intended configuration, not a forgotten default.
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions } from "../EventTransport-
|
|
3
|
-
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-
|
|
4
|
-
import { a as EventOutbox, c as OutboxRelayErrorKind, i as MemoryOutboxStore, l as RelayResult, n as OutboxModuleOptions, o as EventOutboxOptions, r as createOutboxModule, s as OutboxRelayErrorHandler, t as OutboxModuleExports } from "../outbox-module-
|
|
2
|
+
import { i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions } from "../EventTransport-BPOQsEer.mjs";
|
|
3
|
+
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-DfHaKEWQ.mjs";
|
|
4
|
+
import { a as EventOutbox, c as OutboxRelayErrorKind, i as MemoryOutboxStore, l as RelayResult, n as OutboxModuleOptions, o as EventOutboxOptions, r as createOutboxModule, s as OutboxRelayErrorHandler, t as OutboxModuleExports } from "../outbox-module-CzsKRBvO.mjs";
|
|
5
5
|
import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
|
|
6
|
-
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-
|
|
6
|
+
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-DSsPyYzd.mjs";
|
|
7
7
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
8
8
|
import { RepositoryLike } from "@classytic/repo-core/adapter";
|
|
9
9
|
//#region src/events/eventTypes.d.ts
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as MemoryEventTransport } from "../EventTransport-
|
|
3
|
-
import { a as createEventRegistry, i as wrapWithSchema, n as subscribeWithSchema, o as defineEvent, r as wrapWithBoundary, t as subscribeWithBoundary } from "../subscribe-helpers-
|
|
4
|
-
import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-
|
|
5
|
-
import { i as exponentialBackoff, n as EventOutbox, r as repositoryAsOutboxStore, t as createOutboxModule } from "../outbox-module-
|
|
1
|
+
/*! @classytic/arc v2.40.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as MemoryEventTransport } from "../EventTransport-BUkTwY_x.mjs";
|
|
3
|
+
import { a as createEventRegistry, i as wrapWithSchema, n as subscribeWithSchema, o as defineEvent, r as wrapWithBoundary, t as subscribeWithBoundary } from "../subscribe-helpers-KgVEcn8L.mjs";
|
|
4
|
+
import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-DB26V7uX.mjs";
|
|
5
|
+
import { i as exponentialBackoff, n as EventOutbox, r as repositoryAsOutboxStore, t as createOutboxModule } from "../outbox-module-6DMC_WNu.mjs";
|
|
6
6
|
import { MemoryOutboxStore } from "@classytic/primitives/memory-outbox";
|
|
7
7
|
//#region src/events/eventTypes.ts
|
|
8
8
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-
|
|
2
|
+
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-DSsPyYzd.mjs";
|
|
3
3
|
export { type RedisStreamLike, RedisStreamTransport, type RedisStreamTransportOptions };
|
|
@@ -1,5 +1,7 @@
|
|
|
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";
|
|
4
|
+
import { matchEventPattern } from "@classytic/primitives/events";
|
|
3
5
|
//#region src/events/transports/redis-stream.ts
|
|
4
6
|
/**
|
|
5
7
|
* Redis Stream Event Transport — Durable Event Delivery
|
|
@@ -183,7 +185,7 @@ var RedisStreamTransport = class {
|
|
|
183
185
|
this.generation++;
|
|
184
186
|
this.handlers.clear();
|
|
185
187
|
this.failureContext.clear();
|
|
186
|
-
if (this.pollPromise) {
|
|
188
|
+
if (this.pollPromise !== null) {
|
|
187
189
|
if (await Promise.race([this.pollPromise.then(() => "drained"), this.sleep(this.closeTimeoutMs).then(() => "timeout")]) === "timeout") {
|
|
188
190
|
if (!this.externalLifecycle) {
|
|
189
191
|
if (typeof this.redis.disconnect === "function") this.redis.disconnect();
|
|
@@ -278,14 +280,16 @@ var RedisStreamTransport = class {
|
|
|
278
280
|
let allSucceeded = true;
|
|
279
281
|
let lastError;
|
|
280
282
|
let lastHandlerName;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
283
|
+
await runWorkScope(workSeedFromEvent(event), async () => {
|
|
284
|
+
for (const handler of matchingHandlers) try {
|
|
285
|
+
await handler(event);
|
|
286
|
+
} catch (err) {
|
|
287
|
+
allSucceeded = false;
|
|
288
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
289
|
+
lastHandlerName = handler.name || lastHandlerName;
|
|
290
|
+
this.logger.error(`[RedisStreamTransport] Handler error for ${event.type}:`, err);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
289
293
|
if (allSucceeded) {
|
|
290
294
|
await this.redis.xack(this.stream, this.group, messageId);
|
|
291
295
|
this.failureContext.delete(messageId);
|
|
@@ -306,20 +310,17 @@ var RedisStreamTransport = class {
|
|
|
306
310
|
if (oldest !== void 0) this.failureContext.delete(oldest);
|
|
307
311
|
}
|
|
308
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* The canonical matcher from primitives — the SAME glob rules the memory
|
|
315
|
+
* transport speaks. A private matcher here once accepted `prefix.*` but not
|
|
316
|
+
* `prefix:*`, so an `order:*` subscription that worked in-process received
|
|
317
|
+
* nothing after a move to the stream, with no error.
|
|
318
|
+
*/
|
|
309
319
|
getMatchingHandlers(eventType) {
|
|
310
320
|
const matched = [];
|
|
311
|
-
for (const [pattern, handlers] of this.handlers) if (
|
|
321
|
+
for (const [pattern, handlers] of this.handlers) if (matchEventPattern(pattern, eventType)) for (const h of handlers) matched.push(h);
|
|
312
322
|
return matched;
|
|
313
323
|
}
|
|
314
|
-
matchesPattern(pattern, eventType) {
|
|
315
|
-
if (pattern === "*") return true;
|
|
316
|
-
if (pattern === eventType) return true;
|
|
317
|
-
if (pattern.endsWith(".*")) {
|
|
318
|
-
const prefix = pattern.slice(0, -2);
|
|
319
|
-
return eventType.startsWith(`${prefix}.`);
|
|
320
|
-
}
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
324
|
async moveToDlq(ids) {
|
|
324
325
|
if (this.deadLetterStream === false) {
|
|
325
326
|
for (const id of ids) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "../../EventTransport-
|
|
2
|
+
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "../../EventTransport-BPOQsEer.mjs";
|
|
3
3
|
//#region src/events/transports/redis.d.ts
|
|
4
4
|
interface RedisLike {
|
|
5
5
|
publish(channel: string, message: string): Promise<number>;
|