@classytic/arc 2.25.0 → 2.30.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/README.md +2 -0
- package/dist/{BaseController--M8EMzt0.mjs → BaseController-B5DwufbB.mjs} +15 -11
- package/dist/EventTransport-C6YA8xY9.mjs +103 -0
- package/dist/{HookSystem-C1vB_Gc9.mjs → HookSystem-WkIougo6.mjs} +15 -35
- package/dist/applyPermissionResult-Cf6zUCvb.mjs +257 -0
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +1 -1
- package/dist/{buildHandler-Dtwd8fdz.mjs → buildHandler-BYS3Vkfz.mjs} +32 -6
- package/dist/cleanup/index.d.mts +313 -0
- package/dist/cleanup/index.mjs +1267 -0
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/docs.mjs +1 -1
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +5 -3
- package/dist/core-poalJLvp.mjs +175 -0
- package/dist/{createActionRouter-B6GvAuAX.mjs → createActionRouter-BxuywVRB.mjs} +2 -2
- package/dist/{createAggregationRouter-wzwFa_dW.mjs → createAggregationRouter-BiY-lGdY.mjs} +7 -20
- package/dist/{preloadResources-DfyngIN9.mjs → createApp-CXrKFciH.mjs} +25 -76
- package/dist/defineAggregation-ufWjUwml.mjs +47 -0
- package/dist/{core-EUNu0u07.mjs → defineResource-CxWqDCAy.mjs} +36 -261
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +1 -1
- package/dist/{eventPlugin-DrQ_FesK.mjs → eventPlugin-D2NNR4py.mjs} +2 -103
- package/dist/events/index.d.mts +28 -2
- package/dist/events/index.mjs +24 -343
- package/dist/factory/index.d.mts +4 -3
- package/dist/factory/index.mjs +3 -1
- package/dist/{fastify-augmentation-dPNBVeIj.d.mts → fastify-augmentation-0WhPnUH7.d.mts} +3 -2
- package/dist/{applyPermissionResult-Tw4iXtlf.mjs → fields-CQ_7KQWw.mjs} +1 -97
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.mjs +1 -1
- package/dist/index-CCzVR-N3.d.mts +107 -0
- package/dist/{index-BMnbzvtO.d.mts → index-Ch16aAah.d.mts} +201 -21
- package/dist/{index-f4PTrk3B.d.mts → index-Cx7bro4R.d.mts} +4 -4
- package/dist/{index-DPRH0Cme.d.mts → index-Q5gzEIWY.d.mts} +97 -66
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +8 -6
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/mcp/index.d.mts +6 -6
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/{mcpPlugin-Cb7olw0j.mjs → mcpPlugin-nRzm5g2s.mjs} +36 -43
- package/dist/middleware/index.d.mts +1 -1
- package/dist/migrations/index.d.mts +0 -3
- package/dist/migrations/index.mjs +0 -3
- package/dist/module-_-M7C5ES.mjs +29 -0
- package/dist/{openapi-DrLtog_B.mjs → openapi-B8Vkbxbn.mjs} +1 -1
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +4 -3
- package/dist/{permissions-BrtiBKGs.mjs → permissions-Bfu_8y1U.mjs} +318 -289
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/{pipeline-BN5G05rd.mjs → pipeline-BJnpkY9i.mjs} +4 -18
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.mjs +2 -2
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/{preloadResources-0oe-JSSS.d.mts → preloadResources-DCfa2egz.d.mts} +3 -2
- package/dist/preloadResources-DSY5HGpS.mjs +45 -0
- package/dist/presets/filesUpload.d.mts +2 -2
- package/dist/presets/filesUpload.mjs +1 -1
- package/dist/presets/index.d.mts +14 -2
- package/dist/presets/index.mjs +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-DwFDVKP0.mjs → presets-CJOEXLuk.mjs} +25 -9
- package/dist/projection-UBDgfMwu.mjs +17 -0
- package/dist/{realtime-Cuw_deA-.mjs → realtime-B9nmIY5V.mjs} +2 -1
- package/dist/{registerRoute-v0Wb6Plt.mjs → registerRoute-JkxIEBJq.mjs} +3 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +1 -1
- package/dist/{registry-vcOCtPij.mjs → registry-BYXUUg21.mjs} +16 -1
- package/dist/repositoryFilter-Dz8k3S4P.mjs +44 -0
- package/dist/subscribe-helpers-DfzsivM6.mjs +339 -0
- package/dist/testing/cleanupStoreContract.d.mts +10 -0
- package/dist/testing/cleanupStoreContract.mjs +375 -0
- package/dist/testing/index.d.mts +34 -5
- package/dist/testing/index.mjs +316 -211
- package/dist/testing/outboxStoreContract.d.mts +13 -0
- package/dist/testing/outboxStoreContract.mjs +247 -0
- package/dist/types/index.d.mts +3 -3
- package/dist/{types-QFGc3Cjv.d.mts → types-Bmmn-fO0.d.mts} +1 -1
- package/dist/types-C_ZZRcD6.d.mts +450 -0
- package/dist/{types-Dmw-6Qeo.d.mts → types-ChvvVNP8.d.mts} +93 -88
- package/dist/{index-KUoxjIq1.d.mts → types-D_n8L6VY.d.mts} +33 -106
- package/dist/usage/index.d.mts +1 -1
- package/dist/usage/index.mjs +0 -0
- package/dist/utils/index.d.mts +2 -5
- package/package.json +539 -524
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { a as QueryCacheConfig } from "./QueryCache-DOMT_iq7.mjs";
|
|
2
2
|
import { P as ArcHeaders, i as RequestScope } from "./types-DjC-KUCz.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as UserBase, l as AnyRecord, r as PermissionCheck } from "./types-ChvvVNP8.mjs";
|
|
4
4
|
import "./elevation-C9s5hFP_.mjs";
|
|
5
5
|
import { n as FieldPermissionMap } from "./fields-D3lhgzhD.mjs";
|
|
6
6
|
import { n as EncryptionDirective } from "./types-Cc91nXuA.mjs";
|
|
7
7
|
import { n as DomainEvent } from "./EventTransport-QmY7A258.mjs";
|
|
8
|
+
import { Filter } from "@classytic/repo-core/filter";
|
|
8
9
|
import { KeysetPaginationResult, OffsetPaginationResult } from "@classytic/repo-core/pagination";
|
|
9
10
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, RouteHandlerMethod, RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
10
11
|
import { DataAdapter, RepositoryLike } from "@classytic/repo-core/adapter";
|
|
@@ -188,6 +189,22 @@ interface ControllerConfigurableOptions {
|
|
|
188
189
|
*/
|
|
189
190
|
interface BaseControllerOptions extends ControllerConstructionOptions, ControllerConfigurableOptions {}
|
|
190
191
|
//#endregion
|
|
192
|
+
//#region src/scope/projection.d.ts
|
|
193
|
+
/**
|
|
194
|
+
* Lightweight projection of `RequestScope` — just the fields tenant-aware
|
|
195
|
+
* hooks and controllers usually read. Full discriminated-union access is
|
|
196
|
+
* still available through the underlying `RequestScope` for advanced
|
|
197
|
+
* branching on `scope.kind`.
|
|
198
|
+
*/
|
|
199
|
+
interface RequestScopeProjection$1 {
|
|
200
|
+
/** Tenant the caller is scoped to (member, pinned elevated admin, service key bound to an org). */
|
|
201
|
+
organizationId?: string;
|
|
202
|
+
/** Caller's user id when authenticated — undefined for public / service-only scopes. */
|
|
203
|
+
userId?: string;
|
|
204
|
+
/** Org-level roles (e.g. `['admin', 'warehouse-manager']`) — separate from global `user.roles`. */
|
|
205
|
+
orgRoles?: string[];
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
191
208
|
//#region src/hooks/HookSystem.d.ts
|
|
192
209
|
type HookPhase = "before" | "around" | "after";
|
|
193
210
|
type HookOperation = "create" | "update" | "delete" | "restore" | "read" | "list";
|
|
@@ -200,6 +217,18 @@ interface HookContext<T = AnyRecord> {
|
|
|
200
217
|
user?: UserBase;
|
|
201
218
|
context?: RequestContext;
|
|
202
219
|
meta?: AnyRecord;
|
|
220
|
+
/**
|
|
221
|
+
* Tenant/user projection of the validated `RequestScope` — the same shape
|
|
222
|
+
* `ResourceHookContext.scope` and `IRequestContext.scope` expose, from the
|
|
223
|
+
* same helper, so every surface reads identity identically.
|
|
224
|
+
*
|
|
225
|
+
* THIS is the identity source in a global hook. `ctx.user` comes from the
|
|
226
|
+
* auth adapter and is not scope-validated; the canonical `updatedBy` hook is
|
|
227
|
+
* `ctx.scope?.userId`, not `ctx.user?.id`. `undefined` on public/unscoped
|
|
228
|
+
* routes. Branch on `scope.kind` via `ctx.context._scope` when you need the
|
|
229
|
+
* full discriminated union.
|
|
230
|
+
*/
|
|
231
|
+
scope?: RequestScopeProjection$1;
|
|
203
232
|
}
|
|
204
233
|
type HookHandler<T = AnyRecord> = (ctx: HookContext<T>) => void | Promise<void> | T | Promise<T>;
|
|
205
234
|
/**
|
|
@@ -230,14 +259,8 @@ declare class HookSystem {
|
|
|
230
259
|
private logger;
|
|
231
260
|
private warn;
|
|
232
261
|
constructor(options?: HookSystemOptions);
|
|
233
|
-
/**
|
|
234
|
-
* Generate hook key
|
|
235
|
-
*/
|
|
236
262
|
private getKey;
|
|
237
|
-
/**
|
|
238
|
-
* Register a hook
|
|
239
|
-
* Supports both object parameter and positional arguments
|
|
240
|
-
*/
|
|
263
|
+
/** Supports both the object-parameter and positional argument forms. */
|
|
241
264
|
register<T = AnyRecord>(resourceOrOptions: string | {
|
|
242
265
|
name?: string;
|
|
243
266
|
resource: string;
|
|
@@ -247,13 +270,7 @@ declare class HookSystem {
|
|
|
247
270
|
priority?: number;
|
|
248
271
|
dependsOn?: string[];
|
|
249
272
|
}, operation?: HookOperation, phase?: HookPhase, handler?: HookHandler<T>, priority?: number): () => void;
|
|
250
|
-
/**
|
|
251
|
-
* Register before hook
|
|
252
|
-
*/
|
|
253
273
|
before<T = AnyRecord>(resource: string, operation: HookOperation, handler: HookHandler<T>, priority?: number): () => void;
|
|
254
|
-
/**
|
|
255
|
-
* Register after hook
|
|
256
|
-
*/
|
|
257
274
|
after<T = AnyRecord>(resource: string, operation: HookOperation, handler: HookHandler<T>, priority?: number): () => void;
|
|
258
275
|
/**
|
|
259
276
|
* Register around hook — wraps the core operation.
|
|
@@ -269,22 +286,13 @@ declare class HookSystem {
|
|
|
269
286
|
context?: RequestContext;
|
|
270
287
|
meta?: AnyRecord;
|
|
271
288
|
}): Promise<T | undefined>;
|
|
272
|
-
/**
|
|
273
|
-
* Execute hooks for a given context
|
|
274
|
-
*/
|
|
275
289
|
execute<T = AnyRecord>(ctx: HookContext<T>): Promise<T | undefined>;
|
|
276
|
-
/**
|
|
277
|
-
* Execute before hooks
|
|
278
|
-
*/
|
|
279
290
|
executeBefore<T = AnyRecord>(resource: string, operation: HookOperation, data: T, options?: {
|
|
280
291
|
user?: UserBase;
|
|
281
292
|
context?: RequestContext;
|
|
282
293
|
meta?: AnyRecord;
|
|
283
294
|
}): Promise<T>;
|
|
284
|
-
/**
|
|
285
|
-
* Execute after hooks
|
|
286
|
-
* Errors in after hooks are logged but don't fail the request
|
|
287
|
-
*/
|
|
295
|
+
/** Errors in after hooks are logged but never fail the request. */
|
|
288
296
|
executeAfter<T = AnyRecord>(resource: string, operation: HookOperation, result: T | T[], options?: {
|
|
289
297
|
user?: UserBase;
|
|
290
298
|
context?: RequestContext;
|
|
@@ -297,13 +305,7 @@ declare class HookSystem {
|
|
|
297
305
|
* Hooks without names or dependencies pass through in their original order.
|
|
298
306
|
*/
|
|
299
307
|
private topologicalSort;
|
|
300
|
-
/**
|
|
301
|
-
* Get all registered hooks
|
|
302
|
-
*/
|
|
303
308
|
getAll(): HookRegistration[];
|
|
304
|
-
/**
|
|
305
|
-
* Get hooks for a specific resource
|
|
306
|
-
*/
|
|
307
309
|
getForResource(resource: string): HookRegistration[];
|
|
308
310
|
/**
|
|
309
311
|
* Get hooks matching filter criteria.
|
|
@@ -347,13 +349,7 @@ declare class HookSystem {
|
|
|
347
349
|
* Check if any hooks exist for a specific resource/operation/phase combination.
|
|
348
350
|
*/
|
|
349
351
|
has(resource: string, operation: HookOperation, phase: HookPhase): boolean;
|
|
350
|
-
/**
|
|
351
|
-
* Clear all hooks
|
|
352
|
-
*/
|
|
353
352
|
clear(): void;
|
|
354
|
-
/**
|
|
355
|
-
* Clear hooks for a specific resource
|
|
356
|
-
*/
|
|
357
353
|
clearResource(resource: string): void;
|
|
358
354
|
}
|
|
359
355
|
/**
|
|
@@ -464,7 +460,7 @@ interface AccessControlConfig {
|
|
|
464
460
|
/** Minimal repository interface for access-controlled fetch operations */
|
|
465
461
|
interface AccessControlRepository {
|
|
466
462
|
getById(id: string, options?: QueryOptions): Promise<unknown>;
|
|
467
|
-
getOne?: (filter: AnyRecord, options?: QueryOptions) => Promise<unknown>;
|
|
463
|
+
getOne?: (filter: AnyRecord | Filter, options?: QueryOptions) => Promise<unknown>;
|
|
468
464
|
}
|
|
469
465
|
declare class AccessControl {
|
|
470
466
|
private readonly tenantField;
|
|
@@ -483,7 +479,7 @@ declare class AccessControl {
|
|
|
483
479
|
* Build filter for single-item operations (get/update/delete)
|
|
484
480
|
* Combines ID filter with policy/org filters for proper security enforcement
|
|
485
481
|
*/
|
|
486
|
-
buildIdFilter(id: string, req: IRequestContext): AnyRecord;
|
|
482
|
+
buildIdFilter(id: string, req: IRequestContext): AnyRecord | Filter;
|
|
487
483
|
/**
|
|
488
484
|
* Check if a post-fetch item matches the request's `_policyFilters`.
|
|
489
485
|
*
|
|
@@ -657,7 +653,7 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
657
653
|
/**
|
|
658
654
|
* Composable access control (ID filtering, policy checks, org scope, ownership).
|
|
659
655
|
*
|
|
660
|
-
* Not `readonly`
|
|
656
|
+
* Not `readonly` — `configure()` rebuilds it when the host
|
|
661
657
|
* supplies tenant/idField/matchesFilter post-construction. Same model as
|
|
662
658
|
* `queryResolver` after `setQueryParser` shipped in 2.10.9.
|
|
663
659
|
*/
|
|
@@ -665,7 +661,7 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
665
661
|
/**
|
|
666
662
|
* Composable body sanitization (field permissions, system fields).
|
|
667
663
|
*
|
|
668
|
-
* Not `readonly`
|
|
664
|
+
* Not `readonly` — `configure()` rebuilds it when the host
|
|
669
665
|
* supplies schemaOptions/onFieldWriteDenied post-construction.
|
|
670
666
|
*/
|
|
671
667
|
bodySanitizer: BodySanitizer;
|
|
@@ -854,9 +850,9 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
854
850
|
*/
|
|
855
851
|
private scheduleCacheRefresh;
|
|
856
852
|
/** Cached `list()` flow with SWR semantics. Returns null when cache is disabled. */
|
|
857
|
-
protected withListCache(req: IRequestContext, options:
|
|
853
|
+
protected withListCache(req: IRequestContext, options: ControllerQueryOptions): Promise<IControllerResponse<ListResult<TDoc>> | null>;
|
|
858
854
|
/** Cached `get()` flow with SWR semantics. Returns null when cache is disabled. */
|
|
859
|
-
protected withGetCache(req: IRequestContext, id: string, options:
|
|
855
|
+
protected withGetCache(req: IRequestContext, id: string, options: ControllerQueryOptions): Promise<IControllerResponse<TDoc> | null>;
|
|
860
856
|
list(req: IRequestContext): Promise<IControllerResponse<ListResult<TDoc>>>;
|
|
861
857
|
/**
|
|
862
858
|
* Resource-dispatch verbs router. Returns `null` when the request is
|
|
@@ -897,10 +893,10 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
897
893
|
*/
|
|
898
894
|
protected isFieldExposedForRead(field: string): boolean;
|
|
899
895
|
/** Execute list query through hooks (extracted for cache revalidation) */
|
|
900
|
-
protected executeListQuery(options:
|
|
896
|
+
protected executeListQuery(options: ControllerQueryOptions, req: IRequestContext): Promise<ListResult<TDoc>>;
|
|
901
897
|
get(req: IRequestContext): Promise<IControllerResponse<TDoc>>;
|
|
902
898
|
/** Execute get query through hooks (extracted for cache revalidation) */
|
|
903
|
-
protected executeGetQuery(id: string, options:
|
|
899
|
+
protected executeGetQuery(id: string, options: ControllerQueryOptions, req: IRequestContext): Promise<{
|
|
904
900
|
doc: TDoc | null;
|
|
905
901
|
reason: FetchDenialReason | null;
|
|
906
902
|
}>;
|
|
@@ -1325,11 +1321,9 @@ interface ServerAccessor {
|
|
|
1325
1321
|
/**
|
|
1326
1322
|
* First-class projection of `request._scope` for controller handlers.
|
|
1327
1323
|
*
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1331
|
-
* lifts the two fields most hosts need directly onto `req` so cross-kit
|
|
1332
|
-
* controller code reads:
|
|
1324
|
+
* Lifts the two fields most hosts need directly onto `req`, so a controller
|
|
1325
|
+
* override never digs through `req.metadata._scope` and calls
|
|
1326
|
+
* `getOrgId(scope)` / `getUserId(user)` by hand:
|
|
1333
1327
|
*
|
|
1334
1328
|
* ```ts
|
|
1335
1329
|
* async create(req: IRequestContext) {
|
|
@@ -1530,11 +1524,11 @@ interface IController<TDoc = unknown> {
|
|
|
1530
1524
|
* Flexible controller interface — accepts controllers with any handler style,
|
|
1531
1525
|
* including class instances with extra methods / private fields.
|
|
1532
1526
|
*
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1536
|
-
*
|
|
1537
|
-
*
|
|
1527
|
+
* Deliberately NO index signature: one would make real class instances fail
|
|
1528
|
+
* structural assignment (`new ScrapController()` would need an
|
|
1529
|
+
* `as unknown as ControllerLike` cast, because class instances don't have
|
|
1530
|
+
* one). Arc only invokes the CRUD methods at runtime, so the rest of the
|
|
1531
|
+
* shape is the caller's concern.
|
|
1538
1532
|
*
|
|
1539
1533
|
* The five CRUD slots stay optional so partial controllers (e.g. read-only)
|
|
1540
1534
|
* assign too. Additional domain methods on the controller are allowed by
|
|
@@ -2318,12 +2312,9 @@ interface ResourceExtensions {
|
|
|
2318
2312
|
* Hook context passed to resource-level hook handlers. Mirrors
|
|
2319
2313
|
* HookSystem's HookContext but with a simpler API for inline use.
|
|
2320
2314
|
*
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2323
|
-
*
|
|
2324
|
-
* user info — they had to bypass the documented API and push directly
|
|
2325
|
-
* into `resource._pendingHooks` to get the raw internal shape. Now the
|
|
2326
|
-
* documented DX is complete:
|
|
2315
|
+
* `context` and a first-class `scope` projection are forwarded from the
|
|
2316
|
+
* internal `HookContext`, so an inline handler reaches the caller's tenant
|
|
2317
|
+
* and user through the documented API:
|
|
2327
2318
|
*
|
|
2328
2319
|
* ```ts
|
|
2329
2320
|
* hooks: {
|
|
@@ -2358,7 +2349,7 @@ interface ResourceHookContext {
|
|
|
2358
2349
|
* First-class projection of request scope — `{ organizationId?, userId?, orgRoles? }`.
|
|
2359
2350
|
* Populated for every scoped request so multi-tenant hooks don't have to
|
|
2360
2351
|
* drill into `context._scope.organizationId` themselves. Matches the
|
|
2361
|
-
* identically-named field on `IRequestContext`
|
|
2352
|
+
* identically-named field on `IRequestContext` so the same
|
|
2362
2353
|
* read pattern works in controllers and hooks.
|
|
2363
2354
|
*/
|
|
2364
2355
|
scope?: {
|
|
@@ -2670,6 +2661,16 @@ interface PresetResult {
|
|
|
2670
2661
|
/** Preset routes — merged into the resource's `routes` array. */
|
|
2671
2662
|
routes?: RouteDefinition[] | ((permissions: ResourcePermissions) => RouteDefinition[]);
|
|
2672
2663
|
middlewares?: MiddlewareConfig;
|
|
2664
|
+
/**
|
|
2665
|
+
* Permission gates the preset contributes as SECURE DEFAULTS. Merged per-op
|
|
2666
|
+
* into the resource's `permissions`, but ONLY for operations the host has not
|
|
2667
|
+
* explicitly gated — the host's own permission always wins. Lets a preset make
|
|
2668
|
+
* authorization part of the permission/introspection model (required auth at
|
|
2669
|
+
* `onRequest`, MCP parity) instead of relying on middleware alone. Example:
|
|
2670
|
+
* `ownedByUser` injects `requireAuth()` on update/delete so an ownership
|
|
2671
|
+
* resource is never public-by-omission.
|
|
2672
|
+
*/
|
|
2673
|
+
permissions?: Partial<ResourcePermissions>;
|
|
2673
2674
|
schemaOptions?: RouteSchemaOptions;
|
|
2674
2675
|
controllerOptions?: Record<string, unknown>;
|
|
2675
2676
|
hooks?: PresetHook[];
|
|
@@ -3035,6 +3036,18 @@ interface ResourceConfig<TDoc = AnyRecord> {
|
|
|
3035
3036
|
skipValidation?: boolean;
|
|
3036
3037
|
/** Don't register in introspection */
|
|
3037
3038
|
skipRegistry?: boolean;
|
|
3039
|
+
/**
|
|
3040
|
+
* Fail-closed permission invariant. When `true`, any enabled CRUD WRITE
|
|
3041
|
+
* (create/update/delete) that mounts WITHOUT a permission gate is a FATAL
|
|
3042
|
+
* define-time error — `defineResource()` throws instead of shipping an
|
|
3043
|
+
* unauthenticated write with only a warning. Reads that are ungated stay a
|
|
3044
|
+
* non-fatal `info` hint (public catalogs are legitimate).
|
|
3045
|
+
*
|
|
3046
|
+
* Off by default (public-by-omission still only warns) so existing hosts are
|
|
3047
|
+
* not broken. Opt in per-resource here, or app-wide via the
|
|
3048
|
+
* `ARC_STRICT_PERMISSIONS=true` env — the recommended production posture.
|
|
3049
|
+
*/
|
|
3050
|
+
strictPermissions?: boolean;
|
|
3038
3051
|
/**
|
|
3039
3052
|
* Default `limit` value when the request omits `?limit=`. Default 20.
|
|
3040
3053
|
* Surfaced at the resource level (rather than only via a custom
|
|
@@ -3238,16 +3251,19 @@ interface ResourceConfig<TDoc = AnyRecord> {
|
|
|
3238
3251
|
* "this resource will never work" failures.
|
|
3239
3252
|
*/
|
|
3240
3253
|
/**
|
|
3241
|
-
* One
|
|
3254
|
+
* One diagnostic produced during resource validation.
|
|
3242
3255
|
*
|
|
3243
|
-
* - `severity`:
|
|
3244
|
-
* the
|
|
3256
|
+
* - `severity`: `error` is FATAL — `defineResource()` throws at define-time,
|
|
3257
|
+
* the resource never boots (used by strict security invariants like ungated
|
|
3258
|
+
* CRUD under `strictPermissions`). `warn` flags a misconfiguration the host
|
|
3259
|
+
* should clean up; `info` is a deprecation hint. `warn`/`info` are non-fatal
|
|
3260
|
+
* and flushed through the host logger on first mount.
|
|
3245
3261
|
* - `code`: stable identifier for the diagnostic — hosts and tests can match
|
|
3246
3262
|
* on this without parsing the human-readable message.
|
|
3247
3263
|
* - `message`: pre-formatted line, resource name already interpolated.
|
|
3248
3264
|
*/
|
|
3249
3265
|
interface ResourceDiagnostic {
|
|
3250
|
-
severity: "warn" | "info";
|
|
3266
|
+
severity: "error" | "warn" | "info";
|
|
3251
3267
|
code: string;
|
|
3252
3268
|
message: string;
|
|
3253
3269
|
}
|
|
@@ -3787,6 +3803,7 @@ interface ArcInternalMetadata extends RequestContext {
|
|
|
3787
3803
|
_ownershipCheck?: {
|
|
3788
3804
|
field: string;
|
|
3789
3805
|
userId: string;
|
|
3806
|
+
missingOwner?: "deny" | "allow";
|
|
3790
3807
|
};
|
|
3791
3808
|
/** Arc instance references (hooks, field permissions, etc.) */
|
|
3792
3809
|
arc?: {
|
|
@@ -3819,7 +3836,13 @@ interface ControllerQueryOptions {
|
|
|
3819
3836
|
*/
|
|
3820
3837
|
lookups?: LookupOption[];
|
|
3821
3838
|
select?: string | string[] | Record<string, 0 | 1>;
|
|
3822
|
-
|
|
3839
|
+
/**
|
|
3840
|
+
* Resolved row filter. Flat equality filters are a plain record; filters
|
|
3841
|
+
* carrying `$`-operators (`$or`/`$and`/`$gte`) are normalized to the portable
|
|
3842
|
+
* repo-core `Filter` IR at the repository boundary (see `toRepositoryFilter`)
|
|
3843
|
+
* so every kit compiles them. Repositories accept both (`FilterInput`).
|
|
3844
|
+
*/
|
|
3845
|
+
filters?: Record<string, unknown> | Filter;
|
|
3823
3846
|
search?: string;
|
|
3824
3847
|
lean?: boolean;
|
|
3825
3848
|
after?: string;
|
|
@@ -3875,6 +3898,14 @@ interface PopulateOption {
|
|
|
3875
3898
|
* parsers (MongoKit, PrismaKit) add fields without breaking Arc's types.
|
|
3876
3899
|
*/
|
|
3877
3900
|
interface ParsedQuery {
|
|
3901
|
+
/**
|
|
3902
|
+
* Row filter — a plain record in the parser's operator dialect. This is the
|
|
3903
|
+
* PARSER contract: a `QueryParser` (arc built-in, MongoKit, PrismaKit) emits a
|
|
3904
|
+
* record, never repo-core `Filter` IR. IR appears only AFTER security
|
|
3905
|
+
* composition, on `ControllerQueryOptions.filters` (via `toRepositoryFilter`).
|
|
3906
|
+
* Keeping this record-only means `QueryResolver` never has to guess whether a
|
|
3907
|
+
* parsed filter is an IR node it must not blindly spread tenant/policy onto.
|
|
3908
|
+
*/
|
|
3878
3909
|
filters?: Record<string, unknown>;
|
|
3879
3910
|
limit?: number;
|
|
3880
3911
|
sort?: string | Record<string, 1 | -1>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { $t as SlugExt, A as RequestIdOptions, An as ControllerConfigurableOptions, B as defineResource, Bt as RouteHandler, C as RequestContext, D as HealthCheck, Dn as ArcListResult, E as GracefulShutdownOptions, En as ArcGetResult, F as FastifyWithDecorators, Ft as ControllerLike, H as CrudController, Jt as BaseController, L as RequestWithExtras, Lt as IController, Mn as ListResult, N as FastifyRequestExtras, Nt as RateLimitConfig, O as HealthOptions, On as ArcUpdateResult, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as TreeMixin, Rt as IControllerResponse, S as QueryParserInterface, T as CrudRouterOptions, Tn as ArcDeleteResult, U as ResourceConfig, Ut as AuthPluginOptions, V as ResourceDefinition, X as CrudRouteKey, Xt as SoftDeleteMixin, Y as PresetResult, Yt as SoftDeleteExt, Z as CrudSchemas, Zt as TreeExt, a as InferAdapterDoc, c as TypedController, ct as AggMeasureShorthand, d as PaginationResult, dt as AggregationDateRangeRequirement, en as SlugMixin, et as RouteSchemaOptions, f as IntrospectionData, ft as AggregationIndexHint, g as ArcInternalMetadata, gt as AggregationsMap, h as ResourceMetadata, ht as AggregationRateLimit, i as ValidationResult, jn as ControllerConstructionOptions, k as IntrospectionPluginOptions, kn as BaseControllerOptions, l as TypedRepository, lt as AggregationCacheConfig, m as RegistryStats, mt as AggregationMaterializedResult, n as ConfigError, nn as BulkMixin, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, pt as AggregationMaterializedContext, q as PresetFunction, r as ValidateOptions, rn as BaseCrudController, s as InferResourceDoc, st as AggMeasureInput, t as RouteHandlerMethod, tn as BulkExt, u as TypedResourceConfig, ut as AggregationConfig, w as ServiceContext, wn as ArcCreateResult, y as OwnershipCheck, zt as IRequestContext } from "./index-
|
|
2
|
-
import {
|
|
1
|
+
import { $t as SlugExt, A as RequestIdOptions, An as ControllerConfigurableOptions, B as defineResource, Bt as RouteHandler, C as RequestContext, D as HealthCheck, Dn as ArcListResult, E as GracefulShutdownOptions, En as ArcGetResult, F as FastifyWithDecorators, Ft as ControllerLike, H as CrudController, Jt as BaseController, L as RequestWithExtras, Lt as IController, Mn as ListResult, N as FastifyRequestExtras, Nt as RateLimitConfig, O as HealthOptions, On as ArcUpdateResult, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as TreeMixin, Rt as IControllerResponse, S as QueryParserInterface, T as CrudRouterOptions, Tn as ArcDeleteResult, U as ResourceConfig, Ut as AuthPluginOptions, V as ResourceDefinition, X as CrudRouteKey, Xt as SoftDeleteMixin, Y as PresetResult, Yt as SoftDeleteExt, Z as CrudSchemas, Zt as TreeExt, a as InferAdapterDoc, c as TypedController, ct as AggMeasureShorthand, d as PaginationResult, dt as AggregationDateRangeRequirement, en as SlugMixin, et as RouteSchemaOptions, f as IntrospectionData, ft as AggregationIndexHint, g as ArcInternalMetadata, gt as AggregationsMap, h as ResourceMetadata, ht as AggregationRateLimit, i as ValidationResult, jn as ControllerConstructionOptions, k as IntrospectionPluginOptions, kn as BaseControllerOptions, l as TypedRepository, lt as AggregationCacheConfig, m as RegistryStats, mt as AggregationMaterializedResult, n as ConfigError, nn as BulkMixin, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, pt as AggregationMaterializedContext, q as PresetFunction, r as ValidateOptions, rn as BaseCrudController, s as InferResourceDoc, st as AggMeasureInput, t as RouteHandlerMethod, tn as BulkExt, u as TypedResourceConfig, ut as AggregationConfig, w as ServiceContext, wn as ArcCreateResult, y as OwnershipCheck, zt as IRequestContext } from "./index-Q5gzEIWY.mjs";
|
|
2
|
+
import { a as UserBase, d as JWTPayload, i as PermissionContext, l as AnyRecord, m as UserOrganization, n as DataPolicy, r as PermissionCheck, t as AuthorizationDecision, u as ArcRequest } from "./types-ChvvVNP8.mjs";
|
|
3
3
|
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-D3lhgzhD.mjs";
|
|
4
|
-
import "./fastify-augmentation-
|
|
5
|
-
import { A as DEFAULT_ID_FIELD, B as MAX_FILTER_DEPTH, D as defineAggregation, F as DEFAULT_UPDATE_METHOD, G as RESERVED_QUERY_PARAMS, H as MAX_SEARCH_LENGTH, I as HOOK_OPERATIONS, K as SYSTEM_FIELDS, L as HOOK_PHASES, M as DEFAULT_MAX_LIMIT, N as DEFAULT_SORT, O as CRUD_OPERATIONS, P as DEFAULT_TENANT_FIELD, R as HookOperation, S as mergeResourceConfig, U as MUTATION_OPERATIONS, V as MAX_REGEX_LENGTH, W as MutationOperation, b as ResourceSeams, j as DEFAULT_LIMIT, k as CrudOperation, p as getControllerScope, v as defineResourceVariants, w as defineAction, x as SeamedResourceConfig, y as AdapterLike, z as HookPhase } from "./index-
|
|
6
|
-
import {
|
|
4
|
+
import "./fastify-augmentation-0WhPnUH7.mjs";
|
|
5
|
+
import { A as DEFAULT_ID_FIELD, B as MAX_FILTER_DEPTH, D as defineAggregation, F as DEFAULT_UPDATE_METHOD, G as RESERVED_QUERY_PARAMS, H as MAX_SEARCH_LENGTH, I as HOOK_OPERATIONS, K as SYSTEM_FIELDS, L as HOOK_PHASES, M as DEFAULT_MAX_LIMIT, N as DEFAULT_SORT, O as CRUD_OPERATIONS, P as DEFAULT_TENANT_FIELD, R as HookOperation, S as mergeResourceConfig, U as MUTATION_OPERATIONS, V as MAX_REGEX_LENGTH, W as MutationOperation, b as ResourceSeams, j as DEFAULT_LIMIT, k as CrudOperation, p as getControllerScope, v as defineResourceVariants, w as defineAction, x as SeamedResourceConfig, y as AdapterLike, z as HookPhase } from "./index-Cx7bro4R.mjs";
|
|
6
|
+
import { B as anyOf, F as createDynamicPermissionMatrix, G as requireOwnership, H as denyAll, I as createOrgPermissions, J as when, K as requireRoles, L as allOf, M as DynamicPermissionMatrix, N as DynamicPermissionMatrixConfig, W as requireAuth, c as publicReadAdminWrite, d as requireOrgMembership, f as requireOrgRole, h as requireTeamMembership, i as ownerWithAdminBypass, l as readOnly, m as requireServiceScope, n as authenticated, o as presets_d_exports, p as requireScopeContext, r as fullPublic, s as publicRead, t as adminOnly, u as requireOrgInScope, z as allowPublic } from "./index-Ch16aAah.mjs";
|
|
7
7
|
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-DHcHVAgk.mjs";
|
|
8
8
|
//#region src/index.d.ts
|
|
9
9
|
declare const version: string;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type
|
|
11
|
+
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
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-DNre0wRg.mjs";
|
|
2
2
|
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-DkO8Nk6-.mjs";
|
|
3
|
-
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import { c as getControllerScope } from "./pipeline-
|
|
7
|
-
import {
|
|
3
|
+
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-B5DwufbB.mjs";
|
|
4
|
+
import { n as applyFieldWritePermissions, r as fields, t as applyFieldReadPermissions } from "./fields-CQ_7KQWw.mjs";
|
|
5
|
+
import { a as ResourceDefinition, t as defineResource } from "./defineResource-CxWqDCAy.mjs";
|
|
6
|
+
import { c as getControllerScope } from "./pipeline-BJnpkY9i.mjs";
|
|
7
|
+
import { t as defineAggregation } from "./defineAggregation-ufWjUwml.mjs";
|
|
8
|
+
import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-poalJLvp.mjs";
|
|
9
|
+
import { B as when, C as requireScopeContext, I as requireAuth, L as requireOwnership, M as anyOf, P as denyAll, R as requireRoles, S as requireOrgRole, T as requireTeamMembership, b as requireOrgInScope, c as publicReadAdminWrite, i as ownerWithAdminBypass, j as allowPublic, k as allOf, l as readOnly, n as authenticated, o as presets_exports, r as fullPublic, s as publicRead, t as adminOnly, v as createDynamicPermissionMatrix, w as requireServiceScope, x as requireOrgMembership, y as createOrgPermissions } from "./permissions-Bfu_8y1U.mjs";
|
|
8
10
|
//#region src/index.ts
|
|
9
|
-
const version = "2.
|
|
11
|
+
const version = "2.30.0";
|
|
10
12
|
//#endregion
|
|
11
13
|
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, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-_Pd0CgR0.mjs";
|
|
2
2
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
3
3
|
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-CG4yqMDB.mjs";
|
|
4
|
-
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-
|
|
4
|
+
import { _ 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-Bmmn-fO0.mjs";
|
|
5
5
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
6
6
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
7
7
|
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,8 +1,8 @@
|
|
|
1
|
-
import { Rt as IControllerResponse, V as ResourceDefinition, Vt as ServerAccessor, zt as IRequestContext } from "../../index-
|
|
1
|
+
import { Rt as IControllerResponse, V as ResourceDefinition, Vt as ServerAccessor, zt as IRequestContext } from "../../index-Q5gzEIWY.mjs";
|
|
2
2
|
import { i as RequestScope } from "../../types-DjC-KUCz.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { r as PermissionCheck } from "../../types-ChvvVNP8.mjs";
|
|
4
4
|
import { n as FieldPermissionMap } from "../../fields-D3lhgzhD.mjs";
|
|
5
|
-
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-
|
|
5
|
+
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-Bmmn-fO0.mjs";
|
|
6
6
|
import { ErrorContract } from "@classytic/repo-core/errors";
|
|
7
7
|
import { FastifyPluginAsync } from "fastify";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -340,9 +340,9 @@ interface McpContextExtras {
|
|
|
340
340
|
* | delete | { id } | {} | undefined |
|
|
341
341
|
*
|
|
342
342
|
* **scopeOverride** — when a permission check (e.g. `requireApiKey()`) returns
|
|
343
|
-
* `
|
|
344
|
-
* context the same way CRUD/action routes do. This parameter follows the exact
|
|
345
|
-
* same non-downgrade rule as `
|
|
343
|
+
* an `AuthorizationDecision.scope`, the MCP tool handler must install it on the
|
|
344
|
+
* request context the same way CRUD/action routes do. This parameter follows the exact
|
|
345
|
+
* same non-downgrade rule as `applyAuthorizationDecision`: it overrides only when
|
|
346
346
|
* the session-derived scope is `public` (i.e. MCP called with `auth: false`).
|
|
347
347
|
* An authenticated session scope is never overwritten.
|
|
348
348
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defaultCrudDescription, c as mcpHandlerAdapter, d as toCallToolResult, f as toCallToolSuccess, h as resolveToolCollisions, i as fieldRulesToZod, l as permissionDeniedResult, m as createMcpServer, n as mcpPlugin, o as resolveCrudDescription, p as buildRequestContext, r as resourceToTools, s as invokeController, t as filterResourcesForMcp, u as toCallToolError } from "../../mcpPlugin-
|
|
1
|
+
import { a as defaultCrudDescription, c as mcpHandlerAdapter, d as toCallToolResult, f as toCallToolSuccess, h as resolveToolCollisions, i as fieldRulesToZod, l as permissionDeniedResult, m as createMcpServer, n as mcpPlugin, o as resolveCrudDescription, p as buildRequestContext, r as resourceToTools, s as invokeController, t as filterResourcesForMcp, u as toCallToolError } from "../../mcpPlugin-nRzm5g2s.mjs";
|
|
2
2
|
//#region src/integrations/mcp/defineTool.ts
|
|
3
3
|
/**
|
|
4
4
|
* Define a type-safe MCP tool.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-
|
|
1
|
+
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-Bmmn-fO0.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.d.ts
|
|
3
3
|
interface TestMcpClientOptions {
|
|
4
4
|
/** MCP plugin options (resources, overrides, etc.) — same as mcpPlugin config */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-
|
|
1
|
+
import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-nRzm5g2s.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.ts
|
|
3
3
|
/**
|
|
4
4
|
* @classytic/arc/mcp/testing — MCP Test Utilities
|