@classytic/arc 2.14.2 → 2.15.3

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 (47) hide show
  1. package/README.md +44 -0
  2. package/dist/{BaseController-Dv60tU83.mjs → BaseController-dx3m2J8V.mjs} +102 -2
  3. package/dist/auth/index.d.mts +1 -1
  4. package/dist/{buildHandler-jSZ6Fdvi.mjs → buildHandler-CcFOpJLh.mjs} +2 -19
  5. package/dist/cli/commands/describe.d.mts +1 -1
  6. package/dist/core/index.d.mts +3 -3
  7. package/dist/core/index.mjs +2 -2
  8. package/dist/{core-D29kkRL5.mjs → core-CvmOqEms.mjs} +70 -13
  9. package/dist/{createAggregationRouter-DhR-Ofiz.mjs → createAggregationRouter-B0bPDf5b.mjs} +7 -5
  10. package/dist/{createApp-BarYhXCZ.mjs → createApp-PFegs47-.mjs} +64 -4
  11. package/dist/docs/index.d.mts +1 -1
  12. package/dist/factory/index.d.mts +2 -2
  13. package/dist/factory/index.mjs +1 -1
  14. package/dist/hooks/index.d.mts +1 -1
  15. package/dist/{index-D1-Kp_dP.d.mts → index-BstGxcc3.d.mts} +1 -1
  16. package/dist/{index-Dwc0orNd.d.mts → index-BswOSJCE.d.mts} +88 -17
  17. package/dist/{index-Bt0F3nJj.d.mts → index-bRjYu21O.d.mts} +1 -1
  18. package/dist/index.d.mts +4 -4
  19. package/dist/index.mjs +3 -3
  20. package/dist/integrations/index.d.mts +1 -1
  21. package/dist/integrations/mcp/index.d.mts +2 -2
  22. package/dist/integrations/mcp/index.mjs +1 -1
  23. package/dist/integrations/mcp/testing.d.mts +1 -1
  24. package/dist/integrations/mcp/testing.mjs +1 -1
  25. package/dist/middleware/index.d.mts +1 -1
  26. package/dist/org/index.d.mts +1 -1
  27. package/dist/pipeline/index.d.mts +1 -1
  28. package/dist/plugins/index.d.mts +2 -35
  29. package/dist/plugins/tracing-entry.mjs +1 -1
  30. package/dist/presets/filesUpload.d.mts +1 -1
  31. package/dist/presets/index.d.mts +1 -1
  32. package/dist/presets/multiTenant.d.mts +1 -1
  33. package/dist/presets/multiTenant.mjs +2 -1
  34. package/dist/presets/search.d.mts +1 -1
  35. package/dist/registry/index.d.mts +1 -1
  36. package/dist/{resourceToTools-BM686jB4.mjs → resourceToTools-tFYUNmM0.mjs} +2 -2
  37. package/dist/testing/index.d.mts +2 -2
  38. package/dist/testing/index.mjs +1 -1
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/{types-C6ONJ_Z2.d.mts → types-BQsjgQzS.d.mts} +1 -1
  41. package/dist/{types-NGtx3uxV.d.mts → types-DrBaUwyV.d.mts} +40 -4
  42. package/dist/utils/index.d.mts +1 -1
  43. package/dist/{versioning-DTTvc80y.d.mts → versioning-hmkPcDlX.d.mts} +34 -1
  44. package/package.json +5 -5
  45. package/skills/arc/SKILL.md +77 -0
  46. package/skills/arc-code-review/references/anti-patterns.md +44 -0
  47. package/skills/arc-code-review/references/arc-cheatsheet.md +27 -0
@@ -551,8 +551,35 @@ declare class QueryResolver {
551
551
  }
552
552
  //#endregion
553
553
  //#region src/core/BaseCrudController.d.ts
554
- interface BaseControllerOptions {
555
- /** Schema options for field sanitization */
554
+ /**
555
+ * Construction-only options fields that participate in the
556
+ * controller's mixin composition / hook identity and **cannot** be
557
+ * re-tuned post-construction via `configure()`. Pass these once at
558
+ * construction; if they need to change, build a new controller.
559
+ *
560
+ * Layer split (2.15.0): keeping this distinct from the configurable
561
+ * surface makes the layer explicit at compile time — `configure()`
562
+ * can't accept these, so accidental "I'll re-name the resource at
563
+ * runtime" calls fail to typecheck.
564
+ */
565
+ interface ControllerConstructionOptions {
566
+ /** Resource name for hook execution (e.g., 'product' → 'product.created'). */
567
+ resourceName?: string;
568
+ }
569
+ /**
570
+ * Configurable options — fields arc can forward post-construction via
571
+ * `BaseController.configure(opts)`. `defineResource()` calls
572
+ * `configure()` automatically when a user-supplied controller exposes
573
+ * the method, so resource-level options reach the controller without a
574
+ * `super(repo, { ... })` dance. Everything except `resourceName` /
575
+ * `repository` lives here.
576
+ *
577
+ * Each field maps 1:1 to a resource-level option on `defineResource()`:
578
+ * the resource is the public-API source of truth, this interface is
579
+ * the controller-internal surface arc forwards into.
580
+ */
581
+ interface ControllerConfigurableOptions {
582
+ /** Schema options for field sanitization. */
556
583
  schemaOptions?: RouteSchemaOptions;
557
584
  /**
558
585
  * Query parser instance.
@@ -560,19 +587,17 @@ interface BaseControllerOptions {
560
587
  * Swap in MongoKit QueryParser, pgkit parser, etc.
561
588
  */
562
589
  queryParser?: QueryParserInterface;
563
- /** Maximum limit for pagination (default: 100) */
590
+ /** Maximum limit for pagination (default: 100). */
564
591
  maxLimit?: number;
565
- /** Default limit for pagination (default: 20) */
592
+ /** Default limit for pagination (default: 20). */
566
593
  defaultLimit?: number;
567
594
  /**
568
595
  * Default sort applied when the request doesn't specify one.
569
- * - `string` (default: `'-createdAt'`) — Mongo `-field` DESC convention.
570
- * - `false` — disable the default sort entirely (SQL/Drizzle resources
596
+ * - `string` (default: `'-createdAt'`) Mongo `-field` DESC convention.
597
+ * - `false` disable the default sort entirely (SQL/Drizzle resources
571
598
  * without a `createdAt` column).
572
599
  */
573
600
  defaultSort?: string | false;
574
- /** Resource name for hook execution (e.g., 'product' -> 'product.created') */
575
- resourceName?: string;
576
601
  /**
577
602
  * Field name used for multi-tenant scoping (default: 'organizationId').
578
603
  * Override to match your schema: 'workspaceId', 'tenantId', 'teamId', etc.
@@ -589,9 +614,9 @@ interface BaseControllerOptions {
589
614
  * Provided by the DataAdapter for non-MongoDB databases (SQL, etc.).
590
615
  */
591
616
  matchesFilter?: (item: unknown, filters: Record<string, unknown>) => boolean;
592
- /** Cache configuration for the resource */
617
+ /** Cache configuration for the resource. */
593
618
  cache?: ResourceCacheConfig;
594
- /** Internal preset fields map (slug, tree, etc.) */
619
+ /** Internal preset fields map (slug, tree, etc.). */
595
620
  presetFields?: {
596
621
  slugField?: string;
597
622
  parentField?: string;
@@ -603,6 +628,12 @@ interface BaseControllerOptions {
603
628
  */
604
629
  onFieldWriteDenied?: FieldWriteDenialPolicy;
605
630
  }
631
+ /**
632
+ * Full constructor options — union of construction-only + configurable.
633
+ * The constructor accepts everything; `configure()` accepts only
634
+ * `ControllerConfigurableOptions`.
635
+ */
636
+ interface BaseControllerOptions extends ControllerConstructionOptions, ControllerConfigurableOptions {}
606
637
  /**
607
638
  * Framework-agnostic CRUD controller implementing IController.
608
639
  *
@@ -622,10 +653,21 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
622
653
  protected resourceName?: string;
623
654
  protected tenantField: string | false;
624
655
  protected idField: string;
625
- /** Composable access control (ID filtering, policy checks, org scope, ownership) */
626
- readonly accessControl: AccessControl;
627
- /** Composable body sanitization (field permissions, system fields) */
628
- readonly bodySanitizer: BodySanitizer;
656
+ /**
657
+ * Composable access control (ID filtering, policy checks, org scope, ownership).
658
+ *
659
+ * Not `readonly` since 2.15.0 — `configure()` rebuilds it when the host
660
+ * supplies tenant/idField/matchesFilter post-construction. Same model as
661
+ * `queryResolver` after `setQueryParser` shipped in 2.10.9.
662
+ */
663
+ accessControl: AccessControl;
664
+ /**
665
+ * Composable body sanitization (field permissions, system fields).
666
+ *
667
+ * Not `readonly` since 2.15.0 — `configure()` rebuilds it when the host
668
+ * supplies schemaOptions/onFieldWriteDenied post-construction.
669
+ */
670
+ bodySanitizer: BodySanitizer;
629
671
  /**
630
672
  * Composable query resolution (parsing, pagination, sort, select/populate).
631
673
  *
@@ -654,6 +696,34 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
654
696
  * supplied; controllers that don't implement it are left untouched.
655
697
  */
656
698
  setQueryParser(queryParser: QueryParserInterface): void;
699
+ /**
700
+ * Apply resource-level options to a custom controller AFTER construction.
701
+ *
702
+ * Closes the pre-2.15 footgun where `defineResource({ controller, tenantField,
703
+ * schemaOptions, ... })` warned that the options were "dropped" because the
704
+ * user-supplied controller never received them. Hosts had to remember to
705
+ * forward each one through `super(repo, { ... })` — easy to miss, silently
706
+ * mis-scopes queries when missed.
707
+ *
708
+ * `defineResource()` now calls `controller.configure(resolvedOpts)` after
709
+ * `resolveOrAutoCreateController()` runs. Configure-aware controllers receive
710
+ * the resolved values; arc skips the dropped-options warn for them.
711
+ *
712
+ * Only the keys that affect cross-cutting state (tenant scope, schema/field
713
+ * rules, sort/limit policy, cache, write-denial policy) are honoured —
714
+ * `repository` / `resourceName` are constructor-only because they participate
715
+ * in mixin composition. Each known key rebuilds the affected sub-component
716
+ * (AccessControl / BodySanitizer / QueryResolver) so referentially-stable
717
+ * consumers don't see stale state.
718
+ *
719
+ * Idempotent: safe to call zero, one, or many times before first request;
720
+ * arc calls it exactly once.
721
+ *
722
+ * Type narrowed to `ControllerConfigurableOptions` — `resourceName` is
723
+ * construction-only and intentionally excluded so accidental "rename
724
+ * the resource at runtime" calls fail to typecheck.
725
+ */
726
+ configure(options: ControllerConfigurableOptions): void;
657
727
  /**
658
728
  * Get the tenant field name if multi-tenant scoping is enabled.
659
729
  * Returns `undefined` when `tenantField` is `false`.
@@ -960,10 +1030,11 @@ declare function SoftDeleteMixin<TBase extends Constructor<BaseCrudController>>(
960
1030
  * Spec reference: https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-classes-with-other-types
961
1031
  */
962
1032
  interface BaseController<TDoc extends AnyRecord = AnyRecord, _TRepository extends RepositoryLike = RepositoryLike<TDoc>> {
963
- readonly accessControl: AccessControl;
964
- readonly bodySanitizer: BodySanitizer;
1033
+ accessControl: AccessControl;
1034
+ bodySanitizer: BodySanitizer;
965
1035
  queryResolver: QueryResolver;
966
1036
  setQueryParser(queryParser: QueryParserInterface): void;
1037
+ configure(options: ControllerConfigurableOptions): void;
967
1038
  list(req: IRequestContext): Promise<IControllerResponse<ListResult<TDoc>>>;
968
1039
  get(req: IRequestContext): Promise<IControllerResponse<TDoc>>;
969
1040
  create(req: IRequestContext): Promise<IControllerResponse<TDoc>>;
@@ -3392,4 +3463,4 @@ interface ValidateOptions {
3392
3463
  strict?: boolean;
3393
3464
  }
3394
3465
  //#endregion
3395
- export { OpenApiSchemas as $, SoftDeleteMixin as $t, RequestIdOptions as A, afterUpdate as An, Guard as At, defineResource as B, Authenticator as Bt, RequestContext as C, HookOperation as Cn, AggregationConfig as Ct, HealthCheck as D, HookSystemOptions as Dn, AggregationMaterializedResult as Dt, GracefulShutdownOptions as E, HookSystem as En, AggregationMaterializedContext as Et, FastifyWithDecorators as F, defineHook as Fn, PipelineContext as Ft, ActionsMap as G, ApiResponse as Gt, ActionDefinition as H, JwtContext as Ht, MiddlewareHandler as I, PipelineStep as It, CrudRouteKey as J, ObjectId as Jt, ArcFieldRule as K, ArcRequest as Kt, RequestWithExtras as L, Transform as Lt, EventsDecorator as M, beforeDelete as Mn, NextFunction as Mt, FastifyRequestExtras as N, beforeUpdate as Nn, OperationFilter as Nt, HealthOptions as O, afterCreate as On, AggregationRateLimit as Ot, FastifyWithAuth as P, createHookSystem as Pn, PipelineConfig as Pt, MiddlewareConfig as Q, SoftDeleteExt as Qt, RegisterOptions as R, AuthHelpers as Rt, QueryParserInterface as S, HookHandler as Sn, AggregationCacheConfig as St, CrudRouterOptions as T, HookRegistration as Tn, AggregationIndexHint as Tt, ActionEntry as U, TokenPair as Ut, ResourceDefinition as V, AuthenticatorContext as Vt, ActionHandlerFn as W, AnyRecord as Wt, EventDefinition as X, UserOrganization as Xt, CrudSchemas as Y, UserLike as Yt, FieldRule$1 as Z, BaseController as Zt, ControllerQueryOptions as _, BodySanitizerConfig as _n, IControllerResponse as _t, InferAdapterDoc as a, BulkMixin as an, ResourceConfig as at, ParsedQuery as b, DefineHookOptions as bn, AggMeasureInput as bt, TypedController as c, QueryResolver as cn, ResourcePermissions as ct, PaginationResult as d, ArcDeleteResult as dn, RouteMethod as dt, TreeExt as en, PresetFunction as et, IntrospectionData as f, ArcGetResult as fn, RouteSchemaOptions as ft, ArcInternalMetadata as g, BodySanitizer as gn, IController as gt, ResourceMetadata as h, ListResult as hn, FastifyHandler as ht, ValidationResult as i, BulkExt as in, ResourceCacheConfig as it, ArcDecorator as j, beforeCreate as jn, Interceptor as jt, IntrospectionPluginOptions as k, afterDelete as kn, AggregationsMap as kt, TypedRepository as l, QueryResolverConfig as ln, RouteDefinition as lt, RegistryStats as m, ArcUpdateResult as mn, ControllerLike as mt, ConfigError as n, SlugExt as nn, PresetResult as nt, InferDocType as o, BaseControllerOptions as on, ResourceHookContext as ot, RegistryEntry as p, ArcListResult as pn, ControllerHandler as pt, CrudController as q, JWTPayload as qt, ValidateOptions as r, SlugMixin as rn, RateLimitConfig as rt, InferResourceDoc as s, BaseCrudController as sn, ResourceHooks as st, RouteHandlerMethod$1 as t, TreeMixin as tn, PresetHook as tt, TypedResourceConfig as u, ArcCreateResult as un, RouteMcpConfig as ut, LookupOption as v, AccessControl as vn, IRequestContext as vt, ServiceContext as w, HookPhase as wn, AggregationDateRangeRequirement as wt, PopulateOption as x, HookContext as xn, AggMeasureShorthand as xt, OwnershipCheck as y, AccessControlConfig as yn, RouteHandler as yt, ResourceRegistry as z, AuthPluginOptions as zt };
3466
+ export { OpenApiSchemas as $, SoftDeleteMixin as $t, RequestIdOptions as A, afterCreate as An, Guard as At, defineResource as B, Authenticator as Bt, RequestContext as C, HookContext as Cn, AggregationConfig as Ct, HealthCheck as D, HookRegistration as Dn, AggregationMaterializedResult as Dt, GracefulShutdownOptions as E, HookPhase as En, AggregationMaterializedContext as Et, FastifyWithDecorators as F, beforeUpdate as Fn, PipelineContext as Ft, ActionsMap as G, ApiResponse as Gt, ActionDefinition as H, JwtContext as Ht, MiddlewareHandler as I, createHookSystem as In, PipelineStep as It, CrudRouteKey as J, ObjectId as Jt, ArcFieldRule as K, ArcRequest as Kt, RequestWithExtras as L, defineHook as Ln, Transform as Lt, EventsDecorator as M, afterUpdate as Mn, NextFunction as Mt, FastifyRequestExtras as N, beforeCreate as Nn, OperationFilter as Nt, HealthOptions as O, HookSystem as On, AggregationRateLimit as Ot, FastifyWithAuth as P, beforeDelete as Pn, PipelineConfig as Pt, MiddlewareConfig as Q, SoftDeleteExt as Qt, RegisterOptions as R, AuthHelpers as Rt, QueryParserInterface as S, DefineHookOptions as Sn, AggregationCacheConfig as St, CrudRouterOptions as T, HookOperation as Tn, AggregationIndexHint as Tt, ActionEntry as U, TokenPair as Ut, ResourceDefinition as V, AuthenticatorContext as Vt, ActionHandlerFn as W, AnyRecord as Wt, EventDefinition as X, UserOrganization as Xt, CrudSchemas as Y, UserLike as Yt, FieldRule$1 as Z, BaseController as Zt, ControllerQueryOptions as _, ListResult as _n, IControllerResponse as _t, InferAdapterDoc as a, BulkMixin as an, ResourceConfig as at, ParsedQuery as b, AccessControl as bn, AggMeasureInput as bt, TypedController as c, ControllerConfigurableOptions as cn, ResourcePermissions as ct, PaginationResult as d, QueryResolverConfig as dn, RouteMethod as dt, TreeExt as en, PresetFunction as et, IntrospectionData as f, ArcCreateResult as fn, RouteSchemaOptions as ft, ArcInternalMetadata as g, ArcUpdateResult as gn, IController as gt, ResourceMetadata as h, ArcListResult as hn, FastifyHandler as ht, ValidationResult as i, BulkExt as in, ResourceCacheConfig as it, ArcDecorator as j, afterDelete as jn, Interceptor as jt, IntrospectionPluginOptions as k, HookSystemOptions as kn, AggregationsMap as kt, TypedRepository as l, ControllerConstructionOptions as ln, RouteDefinition as lt, RegistryStats as m, ArcGetResult as mn, ControllerLike as mt, ConfigError as n, SlugExt as nn, PresetResult as nt, InferDocType as o, BaseControllerOptions as on, ResourceHookContext as ot, RegistryEntry as p, ArcDeleteResult as pn, ControllerHandler as pt, CrudController as q, JWTPayload as qt, ValidateOptions as r, SlugMixin as rn, RateLimitConfig as rt, InferResourceDoc as s, BaseCrudController as sn, ResourceHooks as st, RouteHandlerMethod$1 as t, TreeMixin as tn, PresetHook as tt, TypedResourceConfig as u, QueryResolver as un, RouteMcpConfig as ut, LookupOption as v, BodySanitizer as vn, IRequestContext as vt, ServiceContext as w, HookHandler as wn, AggregationDateRangeRequirement as wt, PopulateOption as x, AccessControlConfig as xn, AggMeasureShorthand as xt, OwnershipCheck as y, BodySanitizerConfig as yn, RouteHandler as yt, ResourceRegistry as z, AuthPluginOptions as zt };
@@ -1,4 +1,4 @@
1
- import { $ as OpenApiSchemas, S as QueryParserInterface, Wt as AnyRecord, Yt as UserLike, at as ResourceConfig, b as ParsedQuery } from "./index-Dwc0orNd.mjs";
1
+ import { $ as OpenApiSchemas, S as QueryParserInterface, Wt as AnyRecord, Yt as UserLike, at as ResourceConfig, b as ParsedQuery } from "./index-BswOSJCE.mjs";
2
2
  import { n as ErrorMapper } from "./errorHandler-DFr45ZG4.mjs";
3
3
  import { HttpError, errorContractSchema as errorContractSchema$1, errorDetailSchema as errorDetailSchema$1 } from "@classytic/repo-core/errors";
4
4
  import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { $t as SoftDeleteMixin, A as RequestIdOptions, B as defineResource, C as RequestContext, Ct as AggregationConfig, D as HealthCheck, Dt as AggregationMaterializedResult, E as GracefulShutdownOptions, Et as AggregationMaterializedContext, F as FastifyWithDecorators, Gt as ApiResponse, J as CrudRouteKey, Kt as ArcRequest, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationRateLimit, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as SoftDeleteExt, S as QueryParserInterface, St as AggregationCacheConfig, T as CrudRouterOptions, Tt as AggregationIndexHint, V as ResourceDefinition, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Z as FieldRule, Zt as BaseController, _t as IControllerResponse, a as InferAdapterDoc, an as BulkMixin, at as ResourceConfig, bt as AggMeasureInput, c as TypedController, d as PaginationResult, dn as ArcDeleteResult, en as TreeExt, et as PresetFunction, f as IntrospectionData, fn as ArcGetResult, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, hn as ListResult, i as ValidationResult, in as BulkExt, k as IntrospectionPluginOptions, kt as AggregationsMap, l as TypedRepository, m as RegistryStats, mn as ArcUpdateResult, mt as ControllerLike, n as ConfigError, nn as SlugExt, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, p as RegistryEntry, pn as ArcListResult, q as CrudController, qt as JWTPayload, r as ValidateOptions, rn as SlugMixin, rt as RateLimitConfig, s as InferResourceDoc, sn as BaseCrudController, t as RouteHandlerMethod, tn as TreeMixin, u as TypedResourceConfig, un as ArcCreateResult, vt as IRequestContext, w as ServiceContext, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "./index-Dwc0orNd.mjs";
1
+ import { $t as SoftDeleteMixin, A as RequestIdOptions, B as defineResource, C as RequestContext, Ct as AggregationConfig, D as HealthCheck, Dt as AggregationMaterializedResult, E as GracefulShutdownOptions, Et as AggregationMaterializedContext, F as FastifyWithDecorators, Gt as ApiResponse, J as CrudRouteKey, Kt as ArcRequest, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationRateLimit, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as SoftDeleteExt, S as QueryParserInterface, St as AggregationCacheConfig, T as CrudRouterOptions, Tt as AggregationIndexHint, V as ResourceDefinition, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Z as FieldRule, Zt as BaseController, _n as ListResult, _t as IControllerResponse, a as InferAdapterDoc, an as BulkMixin, at as ResourceConfig, bt as AggMeasureInput, c as TypedController, cn as ControllerConfigurableOptions, d as PaginationResult, en as TreeExt, et as PresetFunction, f as IntrospectionData, fn as ArcCreateResult, ft as RouteSchemaOptions, g as ArcInternalMetadata, gn as ArcUpdateResult, gt as IController, h as ResourceMetadata, hn as ArcListResult, i as ValidationResult, in as BulkExt, k as IntrospectionPluginOptions, kt as AggregationsMap, l as TypedRepository, ln as ControllerConstructionOptions, m as RegistryStats, mn as ArcGetResult, mt as ControllerLike, n as ConfigError, nn as SlugExt, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, p as RegistryEntry, pn as ArcDeleteResult, q as CrudController, qt as JWTPayload, r as ValidateOptions, rn as SlugMixin, rt as RateLimitConfig, s as InferResourceDoc, sn as BaseCrudController, t as RouteHandlerMethod, tn as TreeMixin, u as TypedResourceConfig, vt as IRequestContext, w as ServiceContext, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "./index-BswOSJCE.mjs";
2
2
  import { a as applyFieldWritePermissions, c as PermissionCheck, d as UserBase, i as applyFieldReadPermissions, l as PermissionContext, n as FieldPermissionMap, o as fields, t as FieldPermission, u as PermissionResult } from "./fields-COhcH3fk.mjs";
3
- import { A as MAX_SEARCH_LENGTH, C as DEFAULT_UPDATE_METHOD, D as HookPhase, E as HookOperation, M as MutationOperation, N as RESERVED_QUERY_PARAMS, O as MAX_FILTER_DEPTH, P as SYSTEM_FIELDS, S as DEFAULT_TENANT_FIELD, T as HOOK_PHASES, _ as CrudOperation, b as DEFAULT_MAX_LIMIT, f as defineResourceVariants, g as CRUD_OPERATIONS, h as defineAggregation, j as MUTATION_OPERATIONS, k as MAX_REGEX_LENGTH, s as getControllerScope, v as DEFAULT_ID_FIELD, w as HOOK_OPERATIONS, x as DEFAULT_SORT, y as DEFAULT_LIMIT } from "./index-D1-Kp_dP.mjs";
3
+ import { A as MAX_SEARCH_LENGTH, C as DEFAULT_UPDATE_METHOD, D as HookPhase, E as HookOperation, M as MutationOperation, N as RESERVED_QUERY_PARAMS, O as MAX_FILTER_DEPTH, P as SYSTEM_FIELDS, S as DEFAULT_TENANT_FIELD, T as HOOK_PHASES, _ as CrudOperation, b as DEFAULT_MAX_LIMIT, f as defineResourceVariants, g as CRUD_OPERATIONS, h as defineAggregation, j as MUTATION_OPERATIONS, k as MAX_REGEX_LENGTH, s as getControllerScope, v as DEFAULT_ID_FIELD, w as HOOK_OPERATIONS, x as DEFAULT_SORT, y as DEFAULT_LIMIT } from "./index-BstGxcc3.mjs";
4
4
  import { A as requireRoles, C as allOf, E as denyAll, M as when, O as requireAuth, S as createOrgPermissions, T as anyOf, a as presets_d_exports, c as readOnly, d as requireOrgRole, f as requireScopeContext, i as ownerWithAdminBypass, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig } from "./index-BTqLEvhu.mjs";
5
- import { ct as NotFoundError, ht as createDomainError, it as ArcError, mt as ValidationError, pt as UnauthorizedError, st as ForbiddenError, t as getUserId } from "./index-Bt0F3nJj.mjs";
5
+ import { ct as NotFoundError, ht as createDomainError, it as ArcError, mt as ValidationError, pt as UnauthorizedError, st as ForbiddenError, t as getUserId } from "./index-bRjYu21O.mjs";
6
6
 
7
7
  //#region src/index.d.ts
8
8
  declare const version: string;
9
9
  //#endregion
10
- export { type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ApiResponse, 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 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 RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, 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, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, getUserId, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
10
+ export { type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ApiResponse, 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 RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, 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, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, getUserId, 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,11 @@
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-Cxde4rpC.mjs";
2
2
  import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-j4aJm1Wg.mjs";
3
3
  import { t as getUserId } from "./utils-_h9B3c57.mjs";
4
- import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-Dv60tU83.mjs";
4
+ import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-dx3m2J8V.mjs";
5
5
  import { C as allowPublic, D as requireAuth, O as requireOwnership, S as allOf, T as denyAll, _ as requireOrgMembership, a as presets_exports, b as requireServiceScope, c as readOnly, d as applyFieldWritePermissions, f as fields, g as requireOrgInScope, h as createOrgPermissions, i as ownerWithAdminBypass, j as when, k as requireRoles, m as createDynamicPermissionMatrix, n as authenticated, o as publicRead, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as applyFieldReadPermissions, v as requireOrgRole, w as anyOf, x as requireTeamMembership, y as requireScopeContext } from "./permissions-ohQyv50e.mjs";
6
6
  import { v as getControllerScope } from "./routerShared-DrOa-26E.mjs";
7
- import { a as defineResource, i as defineResourceVariants, l as defineAggregation, o as ResourceDefinition } from "./core-D29kkRL5.mjs";
7
+ import { a as defineResource, i as defineResourceVariants, l as defineAggregation, o as ResourceDefinition } from "./core-CvmOqEms.mjs";
8
8
  //#region src/index.ts
9
- const version = "2.14.2";
9
+ const version = "2.15.3";
10
10
  //#endregion
11
11
  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, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, getUserId, 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 { a as WebSocketMessage, i as WebSocketClient, o as WebSocketPluginOptions } from "../websocket-ChC2rqe1.mjs";
2
2
  import { EventGatewayOptions } from "./event-gateway.mjs";
3
3
  import { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats } from "./jobs.mjs";
4
- import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-C6ONJ_Z2.mjs";
4
+ import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-BQsjgQzS.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, type CallToolResult, type CreateMcpServerConfig, type CrudOperation, type EventGatewayOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobsPluginOptions, type McpAuthResult, type McpPluginOptions, type McpResourceConfig, type PromptDefinition, type QueueStats, type StreamlinePluginOptions, type ToolAnnotations, type ToolContext, type ToolDefinition, type WebSocketClient, type WebSocketMessage, type WebSocketPluginOptions, type WebhookDeliveryRecord, type WebhookManager, type WebhookPluginOptions, type WebhookStore, type WebhookSubscription, type WorkflowLike, type WorkflowRunLike };
@@ -1,5 +1,5 @@
1
- import { V as ResourceDefinition } from "../../index-Dwc0orNd.mjs";
2
- import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-C6ONJ_Z2.mjs";
1
+ import { V as ResourceDefinition } from "../../index-BswOSJCE.mjs";
2
+ import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-BQsjgQzS.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
  import { z } from "zod";
5
5
 
@@ -1,4 +1,4 @@
1
- import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-BM686jB4.mjs";
1
+ import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-tFYUNmM0.mjs";
2
2
  import { createHash, randomUUID } from "node:crypto";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/integrations/mcp/defineTool.ts
@@ -1,4 +1,4 @@
1
- import { o as McpAuthResult, s as McpPluginOptions } from "../../types-C6ONJ_Z2.mjs";
1
+ import { o as McpAuthResult, s as McpPluginOptions } from "../../types-BQsjgQzS.mjs";
2
2
 
3
3
  //#region src/integrations/mcp/testing.d.ts
4
4
  interface TestMcpClientOptions {
@@ -1,4 +1,4 @@
1
- import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-BM686jB4.mjs";
1
+ import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-tFYUNmM0.mjs";
2
2
  //#region src/integrations/mcp/testing.ts
3
3
  /**
4
4
  * @classytic/arc/mcp/testing — MCP Test Utilities
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-Dwc0orNd.mjs";
1
+ import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-BswOSJCE.mjs";
2
2
  import { RouteHandlerMethod } from "fastify";
3
3
 
4
4
  //#region src/middleware/middleware.d.ts
@@ -1,4 +1,4 @@
1
- import { yt as RouteHandler } from "../index-Dwc0orNd.mjs";
1
+ import { yt as RouteHandler } from "../index-BswOSJCE.mjs";
2
2
  import { d as UserBase } from "../fields-COhcH3fk.mjs";
3
3
  import { InvitationAdapter, InvitationDoc, MemberDoc, OrgAdapter, OrgDoc, OrgPermissionStatement, OrgRole, OrganizationPluginOptions } from "./types.mjs";
4
4
  import { FastifyPluginAsync, RouteHandlerMethod } from "fastify";
@@ -1,4 +1,4 @@
1
- import { At as Guard, Ft as PipelineContext, It as PipelineStep, Lt as Transform, Mt as NextFunction, Nt as OperationFilter, Pt as PipelineConfig, _t as IControllerResponse, jt as Interceptor } from "../index-Dwc0orNd.mjs";
1
+ import { At as Guard, Ft as PipelineContext, It as PipelineStep, Lt as Transform, Mt as NextFunction, Nt as OperationFilter, Pt as PipelineConfig, _t as IControllerResponse, jt as Interceptor } from "../index-BswOSJCE.mjs";
2
2
 
3
3
  //#region src/pipeline/guard.d.ts
4
4
  interface GuardOptions {
@@ -1,6 +1,6 @@
1
- import { En as HookSystem, Q as MiddlewareConfig, Wt as AnyRecord, ft as RouteSchemaOptions, lt as RouteDefinition, tt as PresetHook, z as ResourceRegistry } from "../index-Dwc0orNd.mjs";
1
+ import { On as HookSystem, Q as MiddlewareConfig, Wt as AnyRecord, ft as RouteSchemaOptions, lt as RouteDefinition, tt as PresetHook, z as ResourceRegistry } from "../index-BswOSJCE.mjs";
2
2
  import { t as ExternalOpenApiPaths } from "../externalPaths-BD5nw6St.mjs";
3
- import { a as MetricsCollector, c as metricsPlugin, d as ssePlugin, f as CachingOptions, h as cachingPlugin, i as MetricEntry, l as SSEOptions, m as _default$1, n as _default$7, o as MetricsOptions, p as CachingRule, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as _default$6 } from "../versioning-DTTvc80y.mjs";
3
+ import { _ as HealthOptions, a as MetricsCollector, c as metricsPlugin, d as ssePlugin, f as CachingOptions, g as HealthCheck, h as cachingPlugin, i as MetricEntry, l as SSEOptions, m as _default$1, n as _default$7, o as MetricsOptions, p as CachingRule, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as _default$6, v as _default$3, y as healthPlugin } from "../versioning-hmkPcDlX.mjs";
4
4
  import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-DFr45ZG4.mjs";
5
5
  import { t as TracingOptions } from "../tracing-QJVprktp.mjs";
6
6
  import { PaginatedResult } from "@classytic/repo-core/pagination";
@@ -137,39 +137,6 @@ declare module "fastify" {
137
137
  }
138
138
  declare const _default$2: FastifyPluginAsync<GracefulShutdownOptions>;
139
139
  //#endregion
140
- //#region src/plugins/health.d.ts
141
- declare module "fastify" {
142
- interface FastifyRequest {
143
- _startTime?: number;
144
- }
145
- }
146
- interface HealthCheck {
147
- /** Name of the dependency */
148
- name: string;
149
- /** Function that returns true if healthy, false otherwise */
150
- check: () => Promise<boolean> | boolean;
151
- /** Optional timeout in ms (default: 5000) */
152
- timeout?: number;
153
- /** Whether this check is critical for readiness (default: true) */
154
- critical?: boolean;
155
- }
156
- interface HealthOptions {
157
- /** Route prefix (default: '/_health') */
158
- prefix?: string;
159
- /** Health check dependencies */
160
- checks?: HealthCheck[];
161
- /** Enable metrics endpoint (default: false) */
162
- metrics?: boolean;
163
- /** Custom metrics collector function */
164
- metricsCollector?: () => Promise<string> | string;
165
- /** Version info to include in responses */
166
- version?: string;
167
- /** Collect HTTP request metrics (default: true if metrics enabled) */
168
- collectHttpMetrics?: boolean;
169
- }
170
- declare const healthPlugin: FastifyPluginAsync<HealthOptions>;
171
- declare const _default$3: FastifyPluginAsync<HealthOptions>;
172
- //#endregion
173
140
  //#region src/plugins/replyHelpers.d.ts
174
141
  declare module "fastify" {
175
142
  interface FastifyReply {
@@ -58,7 +58,7 @@ try {
58
58
  function createTracerProvider(options) {
59
59
  if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
60
60
  const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
61
- const resolvedVersion = serviceVersion ?? "2.14.2";
61
+ const resolvedVersion = serviceVersion ?? "2.15.3";
62
62
  const exporter = new OTLPTraceExporter({ url: exporterUrl });
63
63
  const provider = new NodeTracerProvider({ resource: { attributes: {
64
64
  "service.name": serviceName,
@@ -1,4 +1,4 @@
1
- import { nt as PresetResult } from "../index-Dwc0orNd.mjs";
1
+ import { nt as PresetResult } from "../index-BswOSJCE.mjs";
2
2
  import { i as RequestScope } from "../types-CTYvcwHe.mjs";
3
3
  import { c as PermissionCheck } from "../fields-COhcH3fk.mjs";
4
4
  import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Dfzt4VTl.mjs";
@@ -1,4 +1,4 @@
1
- import { Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, d as PaginationResult, nt as PresetResult, vt as IRequestContext } from "../index-Dwc0orNd.mjs";
1
+ import { Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, d as PaginationResult, nt as PresetResult, vt as IRequestContext } from "../index-BswOSJCE.mjs";
2
2
  import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
3
3
  import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
4
4
  import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
@@ -1,4 +1,4 @@
1
- import { J as CrudRouteKey, nt as PresetResult } from "../index-Dwc0orNd.mjs";
1
+ import { J as CrudRouteKey, nt as PresetResult } from "../index-BswOSJCE.mjs";
2
2
 
3
3
  //#region src/presets/multiTenant.d.ts
4
4
  /**
@@ -185,7 +185,8 @@ function multiTenantPreset(options = {}) {
185
185
  get: [getFilter("get")],
186
186
  create: [tenantInjection],
187
187
  update: [getFilter("update"), tenantInjection],
188
- delete: [getFilter("delete")]
188
+ delete: [getFilter("delete")],
189
+ aggregations: [strictTenantFilter]
189
190
  }
190
191
  };
191
192
  }
@@ -1,4 +1,4 @@
1
- import { lt as RouteDefinition, nt as PresetResult, pt as ControllerHandler, ut as RouteMcpConfig } from "../index-Dwc0orNd.mjs";
1
+ import { lt as RouteDefinition, nt as PresetResult, pt as ControllerHandler, ut as RouteMcpConfig } from "../index-BswOSJCE.mjs";
2
2
  import { c as PermissionCheck } from "../fields-COhcH3fk.mjs";
3
3
 
4
4
  //#region src/presets/search.d.ts
@@ -1,4 +1,4 @@
1
- import { R as RegisterOptions, k as IntrospectionPluginOptions, z as ResourceRegistry } from "../index-Dwc0orNd.mjs";
1
+ import { R as RegisterOptions, k as IntrospectionPluginOptions, z as ResourceRegistry } from "../index-BswOSJCE.mjs";
2
2
  import { FastifyPluginAsync } from "fastify";
3
3
 
4
4
  //#region src/registry/introspectionPlugin.d.ts
@@ -1,9 +1,9 @@
1
1
  import { p as isArcError } from "./errors-j4aJm1Wg.mjs";
2
- import { t as BaseController } from "./BaseController-Dv60tU83.mjs";
2
+ import { t as BaseController } from "./BaseController-dx3m2J8V.mjs";
3
3
  import { L as normalizePermissionResult } from "./permissions-ohQyv50e.mjs";
4
4
  import { t as executePipeline } from "./pipe-Zr0KXjQe.mjs";
5
5
  import { u as resolvePipelineSteps } from "./routerShared-DrOa-26E.mjs";
6
- import { n as executeAggregation, r as validateAggregations } from "./buildHandler-jSZ6Fdvi.mjs";
6
+ import { n as executeAggregation, r as validateAggregations } from "./buildHandler-CcFOpJLh.mjs";
7
7
  import { t as resolveActionPermission } from "./actionPermissions-CyUkQu6O.mjs";
8
8
  import { i as shouldRejectAdditionalProperties, r as schemaIRToZodShape, t as normalizeSchemaIR } from "./schemaIR-lYhC2gE5.mjs";
9
9
  import { t as pluralize } from "./pluralize-DQgqgifU.mjs";
@@ -1,5 +1,5 @@
1
- import { V as ResourceDefinition, Wt as AnyRecord } from "../index-Dwc0orNd.mjs";
2
- import { d as ResourceLike, r as CreateAppOptions } from "../types-NGtx3uxV.mjs";
1
+ import { V as ResourceDefinition, Wt as AnyRecord } from "../index-BswOSJCE.mjs";
2
+ import { d as ResourceLike, r as CreateAppOptions } from "../types-DrBaUwyV.mjs";
3
3
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
4
4
  import { FastifyInstance, FastifyServerOptions } from "fastify";
5
5
  import { Mock } from "vitest";
@@ -1070,7 +1070,7 @@ function pickDefaultAuth(authMode, callerAuth) {
1070
1070
  };
1071
1071
  }
1072
1072
  async function createTestApp(options = {}) {
1073
- const { createApp } = await import("../createApp-BarYhXCZ.mjs").then((n) => n.r);
1073
+ const { createApp } = await import("../createApp-PFegs47-.mjs").then((n) => n.r);
1074
1074
  const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
1075
1075
  let dbHandle;
1076
1076
  let dbUri;
@@ -1,4 +1,4 @@
1
- import { $ as OpenApiSchemas, A as RequestIdOptions, Bt as Authenticator, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as ApiResponse, H as ActionDefinition, Ht as JwtContext, I as MiddlewareHandler, J as CrudRouteKey, Jt as ObjectId, K as ArcFieldRule, Kt as ArcRequest, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Rt as AuthHelpers, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as TokenPair, Vt as AuthenticatorContext, W as ActionHandlerFn, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Yt as UserLike, Z as FieldRule, _ as ControllerQueryOptions, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, b as ParsedQuery, c as TypedController, ct as ResourcePermissions, d as PaginationResult, dt as RouteMethod, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, ht as FastifyHandler, i as ValidationResult, it as ResourceCacheConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as RouteDefinition, m as RegistryStats, mt as ControllerLike, n as ConfigError, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, ot as ResourceHookContext, p as RegistryEntry, pt as ControllerHandler, q as CrudController, qt as JWTPayload, r as ValidateOptions, rt as RateLimitConfig, s as InferResourceDoc, st as ResourceHooks, t as RouteHandlerMethod, tt as PresetHook, u as TypedResourceConfig, ut as RouteMcpConfig, v as LookupOption, vt as IRequestContext, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "../index-Dwc0orNd.mjs";
1
+ import { $ as OpenApiSchemas, A as RequestIdOptions, Bt as Authenticator, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as ApiResponse, H as ActionDefinition, Ht as JwtContext, I as MiddlewareHandler, J as CrudRouteKey, Jt as ObjectId, K as ArcFieldRule, Kt as ArcRequest, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Rt as AuthHelpers, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as TokenPair, Vt as AuthenticatorContext, W as ActionHandlerFn, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Yt as UserLike, Z as FieldRule, _ as ControllerQueryOptions, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, b as ParsedQuery, c as TypedController, ct as ResourcePermissions, d as PaginationResult, dt as RouteMethod, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, ht as FastifyHandler, i as ValidationResult, it as ResourceCacheConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as RouteDefinition, m as RegistryStats, mt as ControllerLike, n as ConfigError, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, ot as ResourceHookContext, p as RegistryEntry, pt as ControllerHandler, q as CrudController, qt as JWTPayload, r as ValidateOptions, rt as RateLimitConfig, s as InferResourceDoc, st as ResourceHooks, t as RouteHandlerMethod, tt as PresetHook, u as TypedResourceConfig, ut as RouteMcpConfig, v as LookupOption, vt as IRequestContext, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "../index-BswOSJCE.mjs";
2
2
  import { i as RequestScope } from "../types-CTYvcwHe.mjs";
3
3
  import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-COhcH3fk.mjs";
4
4
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-BXOWoGCF.mjs";
@@ -1,4 +1,4 @@
1
- import { V as ResourceDefinition } from "./index-Dwc0orNd.mjs";
1
+ import { V as ResourceDefinition } from "./index-BswOSJCE.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/integrations/mcp/types.d.ts
@@ -1,11 +1,11 @@
1
1
  import { r as CacheStore } from "./interface-beEtJyWM.mjs";
2
- import { Bt as Authenticator } from "./index-Dwc0orNd.mjs";
2
+ import { Bt as Authenticator } from "./index-BswOSJCE.mjs";
3
3
  import { n as ElevationOptions } from "./elevation-BXOWoGCF.mjs";
4
4
  import { a as EventTransport } from "./EventTransport-CT_52aWU.mjs";
5
5
  import { t as ExternalOpenApiPaths } from "./externalPaths-BD5nw6St.mjs";
6
6
  import { r as QueryCachePluginOptions } from "./queryCachePlugin-CqMdLI2-.mjs";
7
7
  import { t as EventPluginOptions } from "./eventPlugin-qXpqTebY.mjs";
8
- import { f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-DTTvc80y.mjs";
8
+ import { _ as HealthOptions, f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-hmkPcDlX.mjs";
9
9
  import { t as ErrorHandlerOptions } from "./errorHandler-DFr45ZG4.mjs";
10
10
  import { r as IdempotencyStore } from "./interface-DfLGcus7.mjs";
11
11
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
@@ -488,6 +488,16 @@ interface CreateAppOptions {
488
488
  trustProxy?: boolean;
489
489
  /** Fastify plugin/onReady timeout in ms (default: 10_000). Raise for slow boot work (index materialisation, WAL replay, external warm-up). */
490
490
  pluginTimeout?: number;
491
+ /**
492
+ * Maximum JSON body size in bytes. Pass-through to Fastify's
493
+ * server-level `bodyLimit` option; default is Fastify's 1 MiB
494
+ * (1_048_576 bytes). Raise for hosts shipping bulk-import / CSV ingest
495
+ * / JSON-RPC batch endpoints — without this, Fastify rejects oversized
496
+ * payloads with `FST_ERR_CTP_BODY_TOO_LARGE` (413) before any route
497
+ * handler runs. File uploads on `multipart` routes are governed
498
+ * separately by `multipart.limits.fileSize`. (2.15.1)
499
+ */
500
+ bodyLimit?: number;
491
501
  /**
492
502
  * Auth configuration
493
503
  *
@@ -578,8 +588,34 @@ interface CreateAppOptions {
578
588
  rawBody?: RawBodyOptions | false;
579
589
  /** Enable Arc plugins (requestId, health, gracefulShutdown, events, caching, sse) */
580
590
  arcPlugins?: {
581
- /** Request ID tracking (default: true) */requestId?: boolean; /** Health endpoints (default: true) */
582
- health?: boolean; /** Graceful shutdown handling (default: true) */
591
+ /** Request ID tracking (default: true) */requestId?: boolean;
592
+ /**
593
+ * Health endpoints (default: true).
594
+ *
595
+ * Three forms:
596
+ * - `true` (default) — register Arc's health plugin with no extra checks
597
+ * (`/_health/live` always 200, `/_health/ready` 200 unless explicit
598
+ * readiness probes are added later).
599
+ * - `false` — disable Arc's health plugin entirely; the host registers
600
+ * its own (or none).
601
+ * - `{ checks: HealthCheck[] }` — register Arc's health plugin AND
602
+ * attach the supplied readiness probes (Mongo connectivity, engine
603
+ * warmup, queue connectivity, etc.). Closes the pre-2.15.1 hole
604
+ * where adding checks meant `health: false` + manual re-registration.
605
+ *
606
+ * @example
607
+ * ```typescript
608
+ * arcPlugins: {
609
+ * health: {
610
+ * checks: [
611
+ * { name: 'mongo', check: async () => mongoose.connection.readyState === 1 },
612
+ * { name: 'catalog-engine', check: async () => catalog.isReady() },
613
+ * ],
614
+ * },
615
+ * }
616
+ * ```
617
+ */
618
+ health?: boolean | HealthOptions; /** Graceful shutdown handling (default: true) */
583
619
  gracefulShutdown?: boolean; /** Emit events for CRUD operations (default: true) */
584
620
  emitEvents?: boolean;
585
621
  /**
@@ -1,2 +1,2 @@
1
- import { $ as ValidateOptions, A as ArcQueryParserOptions, B as CompensationResult, C as keysetListResponse, D as queryParams, E as paginationSchema, F as defineGuard, G as CircuitBreakerError, H as defineCompensation, I as defineErrorMapper, J as CircuitBreakerStats, K as CircuitBreakerOptions, L as CompensationDefinition, M as handleRaw, N as Guard, O as responses, P as GuardConfig, Q as ConfigError, R as CompensationError, S as getListQueryParams, T as offsetListResponse, U as withCompensation, V as CompensationStep, W as CircuitBreaker, X as createCircuitBreaker, Y as CircuitState, Z as createCircuitBreakerRegistry, _ as bareListResponse, _t as isArcError, a as TransitionConfig, at as ConflictError, b as errorDetailSchema, c as JsonSchemaTarget, ct as NotFoundError, d as isJsonSchema, dt as RateLimitError, et as ValidationResult, f as isZodSchema, ft as ServiceUnavailableError, g as aggregateListResponse, gt as createError, h as JsonSchema, ht as createDomainError, i as StateMachine, it as ArcError, j as createQueryParser, k as ArcQueryParser, l as convertOpenApiSchemas, lt as OrgAccessDeniedError, m as scheduleBackground, mt as ValidationError, n as EventsDecorator, nt as formatValidationErrors, o as createStateMachine, ot as ErrorOptions, p as toJsonSchema, pt as UnauthorizedError, q as CircuitBreakerRegistry, r as hasEvents, rt as validateResourceConfig, s as simpleEqualityMatcher, st as ForbiddenError, t as getUserId, tt as assertValidConfig, u as convertRouteSchema, ut as OrgRequiredError, v as deleteResponse, w as listResponse, x as getDefaultCrudSchemas, y as errorContractSchema, z as CompensationHooks } from "../index-Bt0F3nJj.mjs";
1
+ import { $ as ValidateOptions, A as ArcQueryParserOptions, B as CompensationResult, C as keysetListResponse, D as queryParams, E as paginationSchema, F as defineGuard, G as CircuitBreakerError, H as defineCompensation, I as defineErrorMapper, J as CircuitBreakerStats, K as CircuitBreakerOptions, L as CompensationDefinition, M as handleRaw, N as Guard, O as responses, P as GuardConfig, Q as ConfigError, R as CompensationError, S as getListQueryParams, T as offsetListResponse, U as withCompensation, V as CompensationStep, W as CircuitBreaker, X as createCircuitBreaker, Y as CircuitState, Z as createCircuitBreakerRegistry, _ as bareListResponse, _t as isArcError, a as TransitionConfig, at as ConflictError, b as errorDetailSchema, c as JsonSchemaTarget, ct as NotFoundError, d as isJsonSchema, dt as RateLimitError, et as ValidationResult, f as isZodSchema, ft as ServiceUnavailableError, g as aggregateListResponse, gt as createError, h as JsonSchema, ht as createDomainError, i as StateMachine, it as ArcError, j as createQueryParser, k as ArcQueryParser, l as convertOpenApiSchemas, lt as OrgAccessDeniedError, m as scheduleBackground, mt as ValidationError, n as EventsDecorator, nt as formatValidationErrors, o as createStateMachine, ot as ErrorOptions, p as toJsonSchema, pt as UnauthorizedError, q as CircuitBreakerRegistry, r as hasEvents, rt as validateResourceConfig, s as simpleEqualityMatcher, st as ForbiddenError, t as getUserId, tt as assertValidConfig, u as convertRouteSchema, ut as OrgRequiredError, v as deleteResponse, w as listResponse, x as getDefaultCrudSchemas, y as errorContractSchema, z as CompensationHooks } from "../index-bRjYu21O.mjs";
2
2
  export { ArcError, ArcQueryParser, ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, CircuitBreakerOptions, CircuitBreakerRegistry, CircuitBreakerStats, CircuitState, CompensationDefinition, CompensationError, CompensationHooks, CompensationResult, CompensationStep, ConfigError, ConflictError, ErrorOptions, EventsDecorator, ForbiddenError, Guard, GuardConfig, JsonSchema, JsonSchemaTarget, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, StateMachine, TransitionConfig, UnauthorizedError, ValidateOptions, ValidationError, ValidationResult, aggregateListResponse, assertValidConfig, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, formatValidationErrors, getDefaultCrudSchemas, getListQueryParams, getUserId, handleRaw, hasEvents, isArcError, isJsonSchema, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
@@ -1,6 +1,39 @@
1
1
  import { n as DomainEvent } from "./EventTransport-CT_52aWU.mjs";
2
2
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
3
3
 
4
+ //#region src/plugins/health.d.ts
5
+ declare module "fastify" {
6
+ interface FastifyRequest {
7
+ _startTime?: number;
8
+ }
9
+ }
10
+ interface HealthCheck {
11
+ /** Name of the dependency */
12
+ name: string;
13
+ /** Function that returns true if healthy, false otherwise */
14
+ check: () => Promise<boolean> | boolean;
15
+ /** Optional timeout in ms (default: 5000) */
16
+ timeout?: number;
17
+ /** Whether this check is critical for readiness (default: true) */
18
+ critical?: boolean;
19
+ }
20
+ interface HealthOptions {
21
+ /** Route prefix (default: '/_health') */
22
+ prefix?: string;
23
+ /** Health check dependencies */
24
+ checks?: HealthCheck[];
25
+ /** Enable metrics endpoint (default: false) */
26
+ metrics?: boolean;
27
+ /** Custom metrics collector function */
28
+ metricsCollector?: () => Promise<string> | string;
29
+ /** Version info to include in responses */
30
+ version?: string;
31
+ /** Collect HTTP request metrics (default: true if metrics enabled) */
32
+ collectHttpMetrics?: boolean;
33
+ }
34
+ declare const healthPlugin: FastifyPluginAsync<HealthOptions>;
35
+ declare const _default$4: FastifyPluginAsync<HealthOptions>;
36
+ //#endregion
4
37
  //#region src/plugins/caching.d.ts
5
38
  interface CachingRule {
6
39
  /** Path prefix to match (e.g., '/api/products') */
@@ -114,4 +147,4 @@ declare module "fastify" {
114
147
  declare const versioningPlugin: FastifyPluginAsync<VersioningOptions>;
115
148
  declare const _default: FastifyPluginAsync<VersioningOptions>;
116
149
  //#endregion
117
- export { MetricsCollector as a, metricsPlugin as c, ssePlugin as d, CachingOptions as f, cachingPlugin as h, MetricEntry as i, SSEOptions as l, _default$3 as m, _default as n, MetricsOptions as o, CachingRule as p, versioningPlugin as r, _default$1 as s, VersioningOptions as t, _default$2 as u };
150
+ export { HealthOptions as _, MetricsCollector as a, metricsPlugin as c, ssePlugin as d, CachingOptions as f, HealthCheck as g, cachingPlugin as h, MetricEntry as i, SSEOptions as l, _default$3 as m, _default as n, MetricsOptions as o, CachingRule as p, versioningPlugin as r, _default$1 as s, VersioningOptions as t, _default$2 as u, _default$4 as v, healthPlugin as y };