@classytic/arc 2.28.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.
Files changed (83) hide show
  1. package/dist/{BaseController-B65zbz9m.mjs → BaseController-B5DwufbB.mjs} +12 -10
  2. package/dist/EventTransport-C6YA8xY9.mjs +103 -0
  3. package/dist/{HookSystem-C1vB_Gc9.mjs → HookSystem-WkIougo6.mjs} +15 -35
  4. package/dist/applyPermissionResult-Cf6zUCvb.mjs +257 -0
  5. package/dist/audit/index.d.mts +2 -2
  6. package/dist/audit/index.mjs +1 -1
  7. package/dist/auth/index.d.mts +2 -2
  8. package/dist/auth/index.mjs +1 -1
  9. package/dist/{buildHandler-Dtwd8fdz.mjs → buildHandler-BYS3Vkfz.mjs} +32 -6
  10. package/dist/cleanup/index.d.mts +2 -2
  11. package/dist/cleanup/index.mjs +1 -1
  12. package/dist/cli/commands/describe.d.mts +1 -1
  13. package/dist/cli/commands/docs.mjs +1 -1
  14. package/dist/core/index.d.mts +2 -2
  15. package/dist/core/index.mjs +5 -4
  16. package/dist/{core-BGa8TXJR.mjs → core-poalJLvp.mjs} +2 -48
  17. package/dist/{createActionRouter-C-N7z2EL.mjs → createActionRouter-BxuywVRB.mjs} +2 -2
  18. package/dist/{createAggregationRouter-wzwFa_dW.mjs → createAggregationRouter-BiY-lGdY.mjs} +7 -20
  19. package/dist/{createApp-Du5G54TM.mjs → createApp-CXrKFciH.mjs} +24 -3
  20. package/dist/defineAggregation-ufWjUwml.mjs +47 -0
  21. package/dist/{defineResource-2zvVVpxg.mjs → defineResource-CxWqDCAy.mjs} +35 -42
  22. package/dist/docs/index.d.mts +1 -1
  23. package/dist/docs/index.mjs +1 -1
  24. package/dist/{eventPlugin-DrQ_FesK.mjs → eventPlugin-D2NNR4py.mjs} +2 -103
  25. package/dist/events/index.mjs +4 -339
  26. package/dist/factory/index.d.mts +4 -4
  27. package/dist/factory/index.mjs +1 -1
  28. package/dist/{fastify-augmentation-OzYGIiU1.d.mts → fastify-augmentation-0WhPnUH7.d.mts} +3 -3
  29. package/dist/{applyPermissionResult-BnyVE9eD.mjs → fields-CQ_7KQWw.mjs} +1 -107
  30. package/dist/hooks/index.d.mts +1 -1
  31. package/dist/hooks/index.mjs +1 -1
  32. package/dist/idempotency/index.mjs +1 -1
  33. package/dist/{index-CZY4EGga.d.mts → index-CCzVR-N3.d.mts} +1 -1
  34. package/dist/{index-BMnbzvtO.d.mts → index-Ch16aAah.d.mts} +201 -21
  35. package/dist/{index-CjVg-Epg.d.mts → index-Cx7bro4R.d.mts} +4 -4
  36. package/dist/{index-DPRH0Cme.d.mts → index-Q5gzEIWY.d.mts} +97 -66
  37. package/dist/index.d.mts +6 -6
  38. package/dist/index.mjs +8 -7
  39. package/dist/integrations/index.d.mts +1 -1
  40. package/dist/integrations/mcp/index.d.mts +6 -6
  41. package/dist/integrations/mcp/index.mjs +1 -1
  42. package/dist/integrations/mcp/testing.d.mts +1 -1
  43. package/dist/integrations/mcp/testing.mjs +1 -1
  44. package/dist/{mcpPlugin-Cs6nRGCt.mjs → mcpPlugin-nRzm5g2s.mjs} +36 -43
  45. package/dist/middleware/index.d.mts +1 -1
  46. package/dist/migrations/index.d.mts +0 -3
  47. package/dist/migrations/index.mjs +0 -3
  48. package/dist/{openapi-BLV4OMXb.mjs → openapi-B8Vkbxbn.mjs} +1 -1
  49. package/dist/permissions/index.d.mts +3 -3
  50. package/dist/permissions/index.mjs +4 -3
  51. package/dist/{permissions-BrtiBKGs.mjs → permissions-Bfu_8y1U.mjs} +318 -289
  52. package/dist/pipeline/index.d.mts +1 -1
  53. package/dist/{pipeline-BGRnV-To.mjs → pipeline-BJnpkY9i.mjs} +4 -18
  54. package/dist/plugins/index.d.mts +4 -4
  55. package/dist/plugins/index.mjs +2 -2
  56. package/dist/plugins/tracing-entry.mjs +1 -1
  57. package/dist/{preloadResources-CM4uUaFv.d.mts → preloadResources-DCfa2egz.d.mts} +3 -3
  58. package/dist/presets/filesUpload.d.mts +2 -2
  59. package/dist/presets/filesUpload.mjs +1 -1
  60. package/dist/presets/index.d.mts +14 -2
  61. package/dist/presets/index.mjs +1 -1
  62. package/dist/presets/multiTenant.d.mts +1 -1
  63. package/dist/presets/search.d.mts +2 -2
  64. package/dist/presets/search.mjs +1 -1
  65. package/dist/{presets-DwFDVKP0.mjs → presets-CJOEXLuk.mjs} +25 -9
  66. package/dist/projection-UBDgfMwu.mjs +17 -0
  67. package/dist/{realtime-DEuDu9io.mjs → realtime-B9nmIY5V.mjs} +2 -1
  68. package/dist/{registerRoute-DTp18Ah_.mjs → registerRoute-JkxIEBJq.mjs} +3 -1
  69. package/dist/registry/index.d.mts +2 -2
  70. package/dist/registry/index.mjs +1 -1
  71. package/dist/{registry-9km_w1aP.mjs → registry-BYXUUg21.mjs} +1 -1
  72. package/dist/repositoryFilter-Dz8k3S4P.mjs +44 -0
  73. package/dist/subscribe-helpers-DfzsivM6.mjs +339 -0
  74. package/dist/testing/index.d.mts +34 -6
  75. package/dist/testing/index.mjs +314 -211
  76. package/dist/types/index.d.mts +3 -3
  77. package/dist/{types-QFGc3Cjv.d.mts → types-Bmmn-fO0.d.mts} +1 -1
  78. package/dist/{types-Dmw-6Qeo.d.mts → types-ChvvVNP8.d.mts} +93 -88
  79. package/dist/{types-Cu6vVJmh.d.mts → types-D_n8L6VY.d.mts} +32 -1
  80. package/dist/usage/index.d.mts +1 -1
  81. package/dist/usage/index.mjs +0 -0
  82. package/dist/utils/index.d.mts +2 -5
  83. package/package.json +539 -539
@@ -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 { c as AnyRecord, i as UserBase, t as PermissionCheck } from "./types-Dmw-6Qeo.mjs";
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` since 2.15.0 — `configure()` rebuilds it when the host
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` since 2.15.0 — `configure()` rebuilds it when the host
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: ParsedQuery): Promise<IControllerResponse<ListResult<TDoc>> | null>;
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: ParsedQuery): Promise<IControllerResponse<TDoc> | null>;
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: ParsedQuery, req: IRequestContext): Promise<ListResult<TDoc>>;
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: ParsedQuery, req: IRequestContext): Promise<{
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
- * **v2.10.6:** previously, pulling tenant/user/role info from inside a
1329
- * controller override meant digging through `req.metadata._scope` and
1330
- * calling `getOrgId(scope)` / `getUserId(user)` manually. This projection
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
- * **v2.10.6:** the previous `[key: string]: unknown` index signature made
1534
- * real class instances fail structural assignment (`new ScrapController()`
1535
- * needed a `as unknown as ControllerLike` cast, because class instances
1536
- * don't have an index signature). Dropped — arc only invokes the CRUD
1537
- * methods at runtime, so the rest of the shape is the caller's concern.
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
- * **v2.10.8:** `context` and a first-class `scope` projection are now
2322
- * forwarded from the internal `HookContext`. Before this release, inline
2323
- * `config.hooks` handlers had no way to reach the caller's tenant or
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` (v2.10.6) so the same
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 non-fatal diagnostic produced during resource validation.
3254
+ * One diagnostic produced during resource validation.
3242
3255
  *
3243
- * - `severity`: log level the host logger uses (`warn` for misconfigurations
3244
- * the host should clean up, `info` for deprecation hints).
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
- filters?: Record<string, unknown>;
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-DPRH0Cme.mjs";
2
- import { c as AnyRecord, i as UserBase, l as ArcRequest, n as PermissionContext, p as UserOrganization, r as PermissionResult, t as PermissionCheck, u as JWTPayload } from "./types-Dmw-6Qeo.mjs";
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-OzYGIiU1.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-CjVg-Epg.mjs";
6
- import { A as allOf, E as DynamicPermissionMatrixConfig, F as requireAuth, I as requireOwnership, L as requireRoles, M as anyOf, N as denyAll, O as createDynamicPermissionMatrix, T as DynamicPermissionMatrix, c as publicReadAdminWrite, d as requireOrgMembership, f as requireOrgRole, h as requireTeamMembership, i as ownerWithAdminBypass, j as allowPublic, k as createOrgPermissions, 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 when } from "./index-BMnbzvtO.mjs";
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 PermissionResult, 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 };
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,12 +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-B65zbz9m.mjs";
4
- import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, o as fields } from "./applyPermissionResult-BnyVE9eD.mjs";
5
- import { a as ResourceDefinition, t as defineResource } from "./defineResource-2zvVVpxg.mjs";
6
- import { c as getControllerScope } from "./pipeline-BGRnV-To.mjs";
7
- import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction, s as defineAggregation } from "./core-BGa8TXJR.mjs";
8
- import { A as requireAuth, D as anyOf, E as allowPublic, M as requireRoles, O as denyAll, P as when, T as allOf, _ as requireOrgMembership, b as requireServiceScope, c as publicReadAdminWrite, g as requireOrgInScope, h as createOrgPermissions, i as ownerWithAdminBypass, j as requireOwnership, l as readOnly, m as createDynamicPermissionMatrix, n as authenticated, o as presets_exports, r as fullPublic, s as publicRead, t as adminOnly, v as requireOrgRole, x as requireTeamMembership, y as requireScopeContext } from "./permissions-BrtiBKGs.mjs";
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";
9
10
  //#region src/index.ts
10
- const version = "2.28.0";
11
+ const version = "2.30.0";
11
12
  //#endregion
12
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-QFGc3Cjv.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-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-DPRH0Cme.mjs";
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 { t as PermissionCheck } from "../../types-Dmw-6Qeo.mjs";
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-QFGc3Cjv.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-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
- * `PermissionResult.scope`, the MCP tool handler must install it on the request
344
- * context the same way CRUD/action routes do. This parameter follows the exact
345
- * same non-downgrade rule as `applyPermissionResult`: it overrides only when
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-Cs6nRGCt.mjs";
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-QFGc3Cjv.mjs";
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-Cs6nRGCt.mjs";
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