@classytic/arc 2.17.1 → 2.18.1

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 (71) hide show
  1. package/dist/{BaseController-CgHomZ4d.mjs → BaseController-DPwe89qs.mjs} +1 -1
  2. package/dist/auth/index.d.mts +1 -1
  3. package/dist/cli/commands/describe.d.mts +1 -1
  4. package/dist/cli/commands/docs.mjs +1 -1
  5. package/dist/cli/commands/init.mjs +1 -1
  6. package/dist/cli/index.mjs +1 -1
  7. package/dist/context/index.d.mts +54 -1
  8. package/dist/context/index.mjs +65 -2
  9. package/dist/core/index.d.mts +2 -2
  10. package/dist/core/index.mjs +3 -3
  11. package/dist/{core-D8tpQ4ZL.mjs → core-B41eZxyM.mjs} +8 -5
  12. package/dist/{createActionRouter-BHUMb1-y.mjs → createActionRouter-CRaIwB5S.mjs} +2 -2
  13. package/dist/{createAggregationRouter-BYVvhfc5.mjs → createAggregationRouter-n3O6WdLO.mjs} +1 -1
  14. package/dist/{createApp-CzCEEsEm.mjs → createApp-DZvrb587.mjs} +29 -7
  15. package/dist/docs/index.d.mts +1 -1
  16. package/dist/docs/index.mjs +1 -1
  17. package/dist/{eventPlugin-CnJCUyM0.mjs → eventPlugin-Dxp9JlKK.mjs} +1 -1
  18. package/dist/events/index.d.mts +48 -0
  19. package/dist/events/index.mjs +27 -5
  20. package/dist/factory/index.d.mts +1 -1
  21. package/dist/factory/index.mjs +1 -1
  22. package/dist/{fastify-augmentation-7LIR0nDv.d.mts → fastify-augmentation-CL48B6gW.d.mts} +1 -1
  23. package/dist/hooks/index.d.mts +1 -1
  24. package/dist/{index-C1JSBan-.d.mts → index-C000faom.d.mts} +10 -1
  25. package/dist/{index-CruZir1o.d.mts → index-CNiryUMN.d.mts} +1 -1
  26. package/dist/index.d.mts +2 -2
  27. package/dist/index.mjs +4 -4
  28. package/dist/{init-DYzfniuX.mjs → init-DQ_rY1J7.mjs} +13 -13
  29. package/dist/integrations/event-gateway.d.mts +1 -1
  30. package/dist/integrations/index.d.mts +2 -2
  31. package/dist/integrations/mcp/index.d.mts +43 -3
  32. package/dist/integrations/mcp/index.mjs +102 -2
  33. package/dist/integrations/mcp/testing.d.mts +1 -1
  34. package/dist/integrations/mcp/testing.mjs +1 -1
  35. package/dist/integrations/streamline.d.mts +8 -1
  36. package/dist/integrations/streamline.mjs +34 -3
  37. package/dist/integrations/websocket-pushref-redis.d.mts +71 -0
  38. package/dist/integrations/websocket-pushref-redis.mjs +205 -0
  39. package/dist/integrations/websocket-redis.d.mts +1 -1
  40. package/dist/integrations/websocket.d.mts +3 -2
  41. package/dist/integrations/websocket.mjs +1142 -23
  42. package/dist/{mcpPlugin-C6FViZXw.mjs → mcpPlugin-BrepZ0cV.mjs} +3 -3
  43. package/dist/middleware/index.d.mts +1 -1
  44. package/dist/{openapi-DKDs9NfD.mjs → openapi-CLZx9bwS.mjs} +1 -1
  45. package/dist/pipeline/index.d.mts +1 -1
  46. package/dist/plugins/index.d.mts +17 -3
  47. package/dist/plugins/index.mjs +44 -3
  48. package/dist/plugins/tracing-entry.d.mts +1 -1
  49. package/dist/plugins/tracing-entry.mjs +1 -1
  50. package/dist/presets/filesUpload.d.mts +2 -2
  51. package/dist/presets/index.d.mts +1 -1
  52. package/dist/presets/multiTenant.d.mts +1 -1
  53. package/dist/presets/search.d.mts +1 -1
  54. package/dist/pushref-registry-Bq_-EVsC.d.mts +435 -0
  55. package/dist/registry/index.d.mts +1 -1
  56. package/dist/{requestContext-SSaaTgW8.mjs → requestContext-DDLS3NVU.mjs} +26 -1
  57. package/dist/{routerShared-nCyJGOKX.mjs → routerShared-Dl0A77Ba.mjs} +1 -1
  58. package/dist/{schemaIR-DAOvBWgT.mjs → schemaIR-Bk6Tns82.mjs} +17 -5
  59. package/dist/testing/index.d.mts +2 -2
  60. package/dist/testing/index.mjs +1 -1
  61. package/dist/testing/storageContract.d.mts +1 -1
  62. package/dist/types/index.d.mts +1 -1
  63. package/dist/types/storage.d.mts +1 -1
  64. package/dist/{types-BRmS8TNa.d.mts → types-DEEWwQFR.d.mts} +1 -1
  65. package/dist/{types-CoMjNmkF.d.mts → types-DH-7WO64.d.mts} +1 -1
  66. package/dist/utils/index.d.mts +1 -1
  67. package/dist/websocket-BZMUP7Gr.d.mts +456 -0
  68. package/package.json +12 -1
  69. package/dist/websocket-BJ0w-3Dt.d.mts +0 -186
  70. /package/dist/{storage-HcAgP5Ni.d.mts → storage-BFmamN5m.d.mts} +0 -0
  71. /package/dist/{tracing-bRqqUxFO.d.mts → tracing-BYQ3hsbM.d.mts} +0 -0
@@ -3,7 +3,7 @@ import { arcLog } from "./logger/index.mjs";
3
3
  import { d as createDomainError, f as createError, i as NotFoundError, r as ForbiddenError } from "./errors-j4aJm1Wg.mjs";
4
4
  import { b as isElevated, c as getOrgId } from "./types-Bi0r0vjG.mjs";
5
5
  import { I as simpleEqualityMatcher, b as ArcQueryParser, o as scheduleBackground, t as getUserId } from "./utils-BMQK8mRl.mjs";
6
- import { w as BodySanitizer } from "./routerShared-nCyJGOKX.mjs";
6
+ import { w as BodySanitizer } from "./routerShared-Dl0A77Ba.mjs";
7
7
  import { t as buildQueryKey } from "./keys-DopsCuyQ.mjs";
8
8
  //#region src/core/AccessControl.ts
9
9
  const log = arcLog("access-control");
@@ -1,4 +1,4 @@
1
- import { Bt as AuthHelpers, Vt as AuthPluginOptions } from "../index-C1JSBan-.mjs";
1
+ import { Bt as AuthHelpers, Vt as AuthPluginOptions } from "../index-C000faom.mjs";
2
2
  import { c as PermissionCheck } from "../fields-DqZLp5d6.mjs";
3
3
  import { t as ExternalOpenApiPaths } from "../externalPaths-ClykOQqa.mjs";
4
4
  import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-DlmaHUAl.mjs";
@@ -1,4 +1,4 @@
1
- import { V as ResourceDefinition, it as RateLimitConfig, mt as RouteSchemaOptions } from "../../index-C1JSBan-.mjs";
1
+ import { V as ResourceDefinition, it as RateLimitConfig, mt as RouteSchemaOptions } from "../../index-C000faom.mjs";
2
2
 
3
3
  //#region src/cli/commands/describe.d.ts
4
4
  interface DescribedResource {
@@ -1,4 +1,4 @@
1
- import { t as buildOpenApiSpec } from "../../openapi-DKDs9NfD.mjs";
1
+ import { t as buildOpenApiSpec } from "../../openapi-CLZx9bwS.mjs";
2
2
  import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-DCjYMgfC.mjs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { mkdirSync, writeFileSync } from "node:fs";
@@ -1,2 +1,2 @@
1
- import { t as init } from "../../init-DYzfniuX.mjs";
1
+ import { t as init } from "../../init-DQ_rY1J7.mjs";
2
2
  export { init };
@@ -2,6 +2,6 @@ import { describe } from "./commands/describe.mjs";
2
2
  import { exportDocs } from "./commands/docs.mjs";
3
3
  import { doctor } from "./commands/doctor.mjs";
4
4
  import { t as generate } from "../generate-CcM24hoq.mjs";
5
- import { t as init } from "../init-DYzfniuX.mjs";
5
+ import { t as init } from "../init-DQ_rY1J7.mjs";
6
6
  import { introspect } from "./commands/introspect.mjs";
7
7
  export { describe, doctor, exportDocs, generate, init, introspect };
@@ -23,6 +23,18 @@ interface RequestStore {
23
23
  resourceName?: string;
24
24
  /** Request start time (for timing) */
25
25
  startTime: number;
26
+ /**
27
+ * W3C Trace Context traceparent header (RFC 9457 / W3C Recommendation).
28
+ * Format: `00-<trace-id>-<parent-id>-<flags>` (e.g. `00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`).
29
+ * Populated by `requestIdPlugin` when the header is present and valid.
30
+ */
31
+ traceparent?: string;
32
+ /**
33
+ * W3C Trace Context tracestate header.
34
+ * Vendor-specific, comma-separated `key=value` pairs.
35
+ * Populated by `requestIdPlugin` when the header is present.
36
+ */
37
+ tracestate?: string;
26
38
  /** Additional context — extensible by app */
27
39
  [key: string]: unknown;
28
40
  }
@@ -54,5 +66,46 @@ declare const requestContext: {
54
66
  */
55
67
  storage: AsyncLocalStorage<RequestStore>;
56
68
  };
69
+ /**
70
+ * Returns the W3C Trace Context headers (`traceparent`, `tracestate`) from
71
+ * the current request context as a plain `Record<string, string>`, suitable
72
+ * for passing to `OutboxWriteOptions.headers` or forwarding to downstream
73
+ * HTTP clients.
74
+ *
75
+ * Returns `undefined` when called outside a request scope or when no trace
76
+ * context was propagated by the upstream caller.
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * // Propagate trace context through the outbox so downstream consumers
81
+ * // can stitch together distributed traces.
82
+ * const traceHeaders = getTraceHeaders();
83
+ * await outbox.store(event, { headers: traceHeaders });
84
+ * ```
85
+ */
86
+ declare function getTraceHeaders(): Record<string, string> | undefined;
87
+ //#endregion
88
+ //#region src/context/transactionContext.d.ts
89
+ /** DB session/transaction handle. Typed as unknown — arc is DB-agnostic. */
90
+ type DbSession = unknown;
91
+ /**
92
+ * Transaction context API.
93
+ *
94
+ * - `run(session, fn)` — install an active DB session for the duration of `fn`
95
+ * - `get()` — read the current session (undefined if outside a transaction scope)
96
+ */
97
+ declare const transactionContext: {
98
+ /**
99
+ * Run `fn` with `session` as the active DB transaction context.
100
+ * Any call to `get()` within `fn`'s async call stack returns `session`.
101
+ */
102
+ run<T>(session: DbSession, fn: () => T): T;
103
+ /**
104
+ * Get the current DB session, or `undefined` if not inside a
105
+ * `transactionContext.run(...)` scope.
106
+ */
107
+ get(): DbSession | undefined; /** The underlying AsyncLocalStorage instance. Exposed for advanced integrations. */
108
+ storage: AsyncLocalStorage<unknown>;
109
+ };
57
110
  //#endregion
58
- export { type RequestStore, requestContext };
111
+ export { type DbSession, type RequestStore, getTraceHeaders, requestContext, transactionContext };
@@ -1,2 +1,65 @@
1
- import { t as requestContext } from "../requestContext-SSaaTgW8.mjs";
2
- export { requestContext };
1
+ import { n as requestContext, t as getTraceHeaders } from "../requestContext-DDLS3NVU.mjs";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
3
+ //#region src/context/transactionContext.ts
4
+ /**
5
+ * Transaction Context via AsyncLocalStorage
6
+ *
7
+ * Provides a Unit-of-Work (UoW) hook so any code in the call stack can
8
+ * retrieve the active database session/transaction without it being threaded
9
+ * through every function parameter.
10
+ *
11
+ * Arc is DB-agnostic — the session type is `unknown` so any backend
12
+ * (Mongoose session, Prisma transaction, pg client, Drizzle client) can
13
+ * participate. Kit adapters call `runInTransaction(session, fn)` to install
14
+ * the active context; the outbox's `store()` reads it automatically when no
15
+ * explicit `options.session` is passed.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // In a Mongoose-backed service (mongokit adapter)
20
+ * import { transactionContext } from '@classytic/arc/context';
21
+ *
22
+ * await mongoose.connection.withSession(async (session) => {
23
+ * await session.withTransaction(async () => {
24
+ * await transactionContext.run(session, async () => {
25
+ * await orders.insertOne(order, { session });
26
+ * // outbox.store() auto-picks up `session` — no manual threading
27
+ * await outbox.store(orderCreatedEvent);
28
+ * });
29
+ * });
30
+ * });
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Opt-out: explicit session always wins over the ALS context
36
+ * await outbox.store(event, { session: explicitSession });
37
+ * ```
38
+ */
39
+ const storage = new AsyncLocalStorage();
40
+ /**
41
+ * Transaction context API.
42
+ *
43
+ * - `run(session, fn)` — install an active DB session for the duration of `fn`
44
+ * - `get()` — read the current session (undefined if outside a transaction scope)
45
+ */
46
+ const transactionContext = {
47
+ /**
48
+ * Run `fn` with `session` as the active DB transaction context.
49
+ * Any call to `get()` within `fn`'s async call stack returns `session`.
50
+ */
51
+ run(session, fn) {
52
+ return storage.run(session, fn);
53
+ },
54
+ /**
55
+ * Get the current DB session, or `undefined` if not inside a
56
+ * `transactionContext.run(...)` scope.
57
+ */
58
+ get() {
59
+ return storage.getStore();
60
+ },
61
+ /** The underlying AsyncLocalStorage instance. Exposed for advanced integrations. */
62
+ storage
63
+ };
64
+ //#endregion
65
+ export { getTraceHeaders, requestContext, transactionContext };
@@ -1,3 +1,3 @@
1
- import { $t as BaseController, At as AggregationRateLimit, B as defineResource, Cn as AccessControlConfig, Ct as AggMeasureShorthand, Dt as AggregationIndexHint, Et as AggregationDateRangeRequirement, Ot as AggregationMaterializedContext, Sn as AccessControl, St as AggMeasureInput, Tt as AggregationConfig, V as ResourceDefinition, an as SlugMixin, bn as BodySanitizer, cn as BaseControllerOptions, dn as ControllerConstructionOptions, en as SoftDeleteExt, fn as QueryResolver, in as SlugExt, jt as AggregationsMap, kt as AggregationMaterializedResult, ln as BaseCrudController, nn as TreeExt, on as BulkExt, pn as QueryResolverConfig, rn as TreeMixin, sn as BulkMixin, tn as SoftDeleteMixin, un as ControllerConfigurableOptions, wt as AggregationCacheConfig, xn as BodySanitizerConfig, yn as ListResult } from "../index-C1JSBan-.mjs";
2
- import { A as MAX_FILTER_DEPTH, C as DEFAULT_SORT, D as HOOK_PHASES, E as HOOK_OPERATIONS, F as RESERVED_QUERY_PARAMS, I as SYSTEM_FIELDS, M as MAX_SEARCH_LENGTH, N as MUTATION_OPERATIONS, O as HookOperation, P as MutationOperation, S as DEFAULT_MAX_LIMIT, T as DEFAULT_UPDATE_METHOD, _ as defineAggregation, a as createRequestContext, b as DEFAULT_ID_FIELD, c as sendControllerResponse, d as getEntityQuery, f as defineResourceVariants, g as createPermissionMiddleware, h as createCrudRouter, i as createFastifyHandler, j as MAX_REGEX_LENGTH, k as HookPhase, l as getEntityId, m as defineAction, n as isFieldReadable, o as getControllerContext, p as DefineActionConfig, r as createCrudHandlers, s as getControllerScope, t as collectReadBlockedFields, u as getEntityIdField, v as CRUD_OPERATIONS, w as DEFAULT_TENANT_FIELD, x as DEFAULT_LIMIT, y as CrudOperation } from "../index-CruZir1o.mjs";
1
+ import { $t as BaseController, At as AggregationRateLimit, B as defineResource, Cn as AccessControlConfig, Ct as AggMeasureShorthand, Dt as AggregationIndexHint, Et as AggregationDateRangeRequirement, Ot as AggregationMaterializedContext, Sn as AccessControl, St as AggMeasureInput, Tt as AggregationConfig, V as ResourceDefinition, an as SlugMixin, bn as BodySanitizer, cn as BaseControllerOptions, dn as ControllerConstructionOptions, en as SoftDeleteExt, fn as QueryResolver, in as SlugExt, jt as AggregationsMap, kt as AggregationMaterializedResult, ln as BaseCrudController, nn as TreeExt, on as BulkExt, pn as QueryResolverConfig, rn as TreeMixin, sn as BulkMixin, tn as SoftDeleteMixin, un as ControllerConfigurableOptions, wt as AggregationCacheConfig, xn as BodySanitizerConfig, yn as ListResult } from "../index-C000faom.mjs";
2
+ import { A as MAX_FILTER_DEPTH, C as DEFAULT_SORT, D as HOOK_PHASES, E as HOOK_OPERATIONS, F as RESERVED_QUERY_PARAMS, I as SYSTEM_FIELDS, M as MAX_SEARCH_LENGTH, N as MUTATION_OPERATIONS, O as HookOperation, P as MutationOperation, S as DEFAULT_MAX_LIMIT, T as DEFAULT_UPDATE_METHOD, _ as defineAggregation, a as createRequestContext, b as DEFAULT_ID_FIELD, c as sendControllerResponse, d as getEntityQuery, f as defineResourceVariants, g as createPermissionMiddleware, h as createCrudRouter, i as createFastifyHandler, j as MAX_REGEX_LENGTH, k as HookPhase, l as getEntityId, m as defineAction, n as isFieldReadable, o as getControllerContext, p as DefineActionConfig, r as createCrudHandlers, s as getControllerScope, t as collectReadBlockedFields, u as getEntityIdField, v as CRUD_OPERATIONS, w as DEFAULT_TENANT_FIELD, x as DEFAULT_LIMIT, y as CrudOperation } from "../index-CNiryUMN.mjs";
3
3
  export { AccessControl, AccessControlConfig, AggMeasureInput, AggMeasureShorthand, AggregationCacheConfig, AggregationConfig, AggregationDateRangeRequirement, AggregationIndexHint, AggregationMaterializedContext, AggregationMaterializedResult, AggregationRateLimit, AggregationsMap, BaseController, BaseControllerOptions, BaseCrudController, BodySanitizer, BodySanitizerConfig, BulkExt, BulkMixin, CRUD_OPERATIONS, ControllerConfigurableOptions, ControllerConstructionOptions, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, DefineActionConfig, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugExt, SlugMixin, SoftDeleteExt, SoftDeleteMixin, TreeExt, TreeMixin, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, sendControllerResponse };
@@ -1,5 +1,5 @@
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-TrJVIJl0.mjs";
2
- import { a as BulkMixin, c as collectReadBlockedFields, i as SlugMixin, l as isFieldReadable, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController, u as AccessControl } from "../BaseController-CgHomZ4d.mjs";
3
- import { S as sendControllerResponse, _ as createCrudHandlers, b as getControllerContext, v as createFastifyHandler, w as BodySanitizer, x as getControllerScope, y as createRequestContext } from "../routerShared-nCyJGOKX.mjs";
4
- import { a as defineResource, c as createCrudRouter, i as defineResourceVariants, l as createPermissionMiddleware, n as getEntityIdField, o as ResourceDefinition, r as getEntityQuery, s as defineAction, t as getEntityId, u as defineAggregation } from "../core-D8tpQ4ZL.mjs";
2
+ import { a as BulkMixin, c as collectReadBlockedFields, i as SlugMixin, l as isFieldReadable, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController, u as AccessControl } from "../BaseController-DPwe89qs.mjs";
3
+ import { S as sendControllerResponse, _ as createCrudHandlers, b as getControllerContext, v as createFastifyHandler, w as BodySanitizer, x as getControllerScope, y as createRequestContext } from "../routerShared-Dl0A77Ba.mjs";
4
+ import { a as defineResource, c as createCrudRouter, i as defineResourceVariants, l as createPermissionMiddleware, n as getEntityIdField, o as ResourceDefinition, r as getEntityQuery, s as defineAction, t as getEntityId, u as defineAggregation } from "../core-B41eZxyM.mjs";
5
5
  export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAction, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, sendControllerResponse };
@@ -1,11 +1,11 @@
1
1
  import { s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-TrJVIJl0.mjs";
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  import { N as assertValidConfig, f as getDefaultCrudSchemas, i as pipeUIMessageStreamToReply, r as isReadableStream } from "./utils-BMQK8mRl.mjs";
4
- import { t as BaseController } from "./BaseController-CgHomZ4d.mjs";
4
+ import { t as BaseController } from "./BaseController-DPwe89qs.mjs";
5
5
  import { t as applyPresets } from "./presets-BYbPobbF.mjs";
6
6
  import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-De34B1ZG.mjs";
7
7
  import { t as hasEvents } from "./typeGuards-BzkXkvVv.mjs";
8
- import { C as buildRequestScopeProjection, _ as createCrudHandlers, c as buildPipelineHandler, d as methodCarriesBody, f as resolvePipelineSteps, g as tryRegisterRoute, h as selectPluginMw, i as buildAuthMiddleware, l as buildPreHandlerChain, m as resolveRouterPluginMw, o as buildCrudPermissionMw, p as resolveRoutePreHandlers, r as buildArcDecorator, s as buildFieldWritePreHandler, u as buildRateLimitConfig, v as createFastifyHandler, y as createRequestContext } from "./routerShared-nCyJGOKX.mjs";
8
+ import { C as buildRequestScopeProjection, _ as createCrudHandlers, c as buildPipelineHandler, d as methodCarriesBody, f as resolvePipelineSteps, g as tryRegisterRoute, h as selectPluginMw, i as buildAuthMiddleware, l as buildPreHandlerChain, m as resolveRouterPluginMw, o as buildCrudPermissionMw, p as resolveRoutePreHandlers, r as buildArcDecorator, s as buildFieldWritePreHandler, u as buildRateLimitConfig, v as createFastifyHandler, y as createRequestContext } from "./routerShared-Dl0A77Ba.mjs";
9
9
  import { t as pluralize } from "./pluralize-B9M8xvy-.mjs";
10
10
  import { t as resolveActionPermission } from "./actionPermissions-Bjmvn7Eb.mjs";
11
11
  //#region src/core/aggregation/defineAggregation.ts
@@ -127,7 +127,10 @@ function createCustomRoutes(fastify, routes, controller, options) {
127
127
  reply.raw.setHeader("Cache-Control", "no-cache");
128
128
  reply.raw.setHeader("Connection", "keep-alive");
129
129
  const result = await handler(request, reply);
130
- if (isReadableStream(result)) await pipeUIMessageStreamToReply(reply, result);
130
+ if (isReadableStream(result)) {
131
+ await pipeUIMessageStreamToReply(reply, result);
132
+ return reply;
133
+ }
131
134
  return result;
132
135
  } : handler,
133
136
  ...rateLimitConfig ? { config: rateLimitConfig } : {}
@@ -1093,7 +1096,7 @@ function buildResourcePlugin(resource) {
1093
1096
  idField: resource.idField
1094
1097
  });
1095
1098
  if (resource.actions && Object.keys(resource.actions).length > 0) {
1096
- const { createActionRouter } = await import("./createActionRouter-BHUMb1-y.mjs").then((n) => n.n);
1099
+ const { createActionRouter } = await import("./createActionRouter-CRaIwB5S.mjs").then((n) => n.n);
1097
1100
  createActionRouter(typedInstance, {
1098
1101
  ...normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log),
1099
1102
  resourceName: resource.name,
@@ -1107,7 +1110,7 @@ function buildResourcePlugin(resource) {
1107
1110
  });
1108
1111
  }
1109
1112
  if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
1110
- const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-BYVvhfc5.mjs"), import("./validate-DFIP2VrM.mjs").then((n) => n.i)]);
1113
+ const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-n3O6WdLO.mjs"), import("./validate-DFIP2VrM.mjs").then((n) => n.i)]);
1111
1114
  const repoForAgg = resource.controller?.repository ?? resource.repository;
1112
1115
  if (!adapterSupportsAggregate(repoForAgg)) {
1113
1116
  const undispatchable = Object.entries(resource.aggregations).filter(([, cfg]) => !cfg.materialized).map(([name]) => name);
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
2
2
  import "./constants-TrJVIJl0.mjs";
3
3
  import { f as createError } from "./errors-j4aJm1Wg.mjs";
4
- import { S as sendControllerResponse, a as buildAuthMiddlewareForPermissions, f as resolvePipelineSteps, g as tryRegisterRoute, h as selectPluginMw, l as buildPreHandlerChain, m as resolveRouterPluginMw, n as buildActionPipelineHandler, r as buildArcDecorator, t as buildActionPermissionMw, u as buildRateLimitConfig } from "./routerShared-nCyJGOKX.mjs";
5
- import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-DAOvBWgT.mjs";
4
+ import { S as sendControllerResponse, a as buildAuthMiddlewareForPermissions, f as resolvePipelineSteps, g as tryRegisterRoute, h as selectPluginMw, l as buildPreHandlerChain, m as resolveRouterPluginMw, n as buildActionPipelineHandler, r as buildArcDecorator, t as buildActionPermissionMw, u as buildRateLimitConfig } from "./routerShared-Dl0A77Ba.mjs";
5
+ import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-Bk6Tns82.mjs";
6
6
  //#region src/core/createActionRouter.ts
7
7
  var createActionRouter_exports = /* @__PURE__ */ __exportAll({
8
8
  buildActionBodySchema: () => buildActionBodySchema,
@@ -1,5 +1,5 @@
1
1
  import { f as createError, l as UnauthorizedError, r as ForbiddenError } from "./errors-j4aJm1Wg.mjs";
2
- import { h as selectPluginMw, i as buildAuthMiddleware, l as buildPreHandlerChain, m as resolveRouterPluginMw, r as buildArcDecorator, u as buildRateLimitConfig } from "./routerShared-nCyJGOKX.mjs";
2
+ import { h as selectPluginMw, i as buildAuthMiddleware, l as buildPreHandlerChain, m as resolveRouterPluginMw, r as buildArcDecorator, u as buildRateLimitConfig } from "./routerShared-Dl0A77Ba.mjs";
3
3
  import { r as validateAggregations } from "./validate-DFIP2VrM.mjs";
4
4
  import { t as buildAggregationHandler } from "./buildHandler-C_SkBNF3.mjs";
5
5
  //#region src/core/aggregation/createAggregationRouter.ts
@@ -202,7 +202,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
202
202
  await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
203
203
  trackPlugin("arc-core");
204
204
  if (config.arcPlugins?.events !== false) {
205
- const { default: eventPlugin } = await import("./eventPlugin-CnJCUyM0.mjs").then((n) => n.n);
205
+ const { default: eventPlugin } = await import("./eventPlugin-Dxp9JlKK.mjs").then((n) => n.n);
206
206
  const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
207
207
  await fastify.register(eventPlugin, {
208
208
  ...eventOpts,
@@ -776,19 +776,36 @@ function validateDistributedRuntime(options) {
776
776
  if (options.runtime !== "distributed") return deferredWarnings;
777
777
  const missing = [];
778
778
  const events = options.stores?.events;
779
- if (!events || MEMORY_STORE_NAMES.has(events.name)) missing.push("events transport");
779
+ if (!events || MEMORY_STORE_NAMES.has(events.name)) missing.push({
780
+ key: "stores.events",
781
+ hint: "a Redis Streams or pub/sub transport"
782
+ });
780
783
  if (options.arcPlugins?.caching) {
781
784
  const cache = options.stores?.cache;
782
- if (!cache || cache.name !== void 0 && MEMORY_STORE_NAMES.has(cache.name)) missing.push("cache store");
785
+ if (!cache || cache.name !== void 0 && MEMORY_STORE_NAMES.has(cache.name)) missing.push({
786
+ key: "stores.cache",
787
+ hint: "a Redis-backed cache adapter"
788
+ });
783
789
  }
784
790
  const idempotency = options.stores?.idempotency;
785
- if (idempotency && MEMORY_STORE_NAMES.has(idempotency.name)) missing.push("idempotency store (memory-backed in distributed mode)");
791
+ if (idempotency && MEMORY_STORE_NAMES.has(idempotency.name)) missing.push({
792
+ key: "stores.idempotency",
793
+ hint: "a Redis/MongoDB store (currently memory-backed → instance-local)"
794
+ });
786
795
  else if (!idempotency) deferredWarnings.push("runtime: 'distributed' — no idempotency store configured. Write-path deduplication will be instance-local. If resources use the idempotency plugin, provide stores.idempotency with a Redis/MongoDB store.");
787
796
  if (options.arcPlugins?.queryCache) {
788
797
  const qc = options.stores?.queryCache;
789
- if (!qc || qc.name !== void 0 && MEMORY_STORE_NAMES.has(qc.name)) missing.push("queryCache store");
798
+ if (!qc || qc.name !== void 0 && MEMORY_STORE_NAMES.has(qc.name)) missing.push({
799
+ key: "stores.queryCache",
800
+ hint: "a Redis-backed query-cache adapter"
801
+ });
802
+ }
803
+ if (missing.length > 0) {
804
+ const lines = missing.map((m) => ` • ${m.key.padEnd(20)} → ${m.hint}`).join("\n");
805
+ throw new Error(`[Arc] runtime: 'distributed' requires durable (Redis/MongoDB) adapters, not memory.
806
+
807
+ Missing:\n${lines}\n\nFix: pass durable adapters under \`stores\`, or use runtime: 'memory' for single-instance dev.`);
790
808
  }
791
- if (missing.length > 0) throw new Error(`[Arc] runtime: 'distributed' requires Redis/durable adapters.\nMissing: ${missing.join(", ")}.\nProvide Redis-backed stores or use runtime: 'memory' for development.`);
792
809
  return deferredWarnings;
793
810
  }
794
811
  /**
@@ -828,7 +845,12 @@ async function createApp(options) {
828
845
  ...config.bodyLimit !== void 0 ? { bodyLimit: config.bodyLimit } : {},
829
846
  allowErrorHandlerOverride: true,
830
847
  routerOptions: {
831
- querystringParser: (str) => qs.parse(str),
848
+ querystringParser: (str) => qs.parse(str, {
849
+ depth: 5,
850
+ parameterLimit: 100,
851
+ arrayLimit: 20,
852
+ allowPrototypes: false
853
+ }),
832
854
  maxParamLength: config.maxParamLength ?? 400
833
855
  },
834
856
  ajv: { customOptions: {
@@ -1,4 +1,4 @@
1
- import { p as RegistryEntry } from "../index-C1JSBan-.mjs";
1
+ import { p as RegistryEntry } from "../index-C000faom.mjs";
2
2
  import { t as ExternalOpenApiPaths } from "../externalPaths-ClykOQqa.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { t as getUserRoles } from "../types-DV9WDfeg.mjs";
2
- import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-DKDs9NfD.mjs";
2
+ import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-CLZx9bwS.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/docs/scalar.ts
5
5
  const scalarPlugin = async (fastify, opts = {}) => {
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  import { d as createDomainError } from "./errors-j4aJm1Wg.mjs";
4
- import { t as requestContext } from "./requestContext-SSaaTgW8.mjs";
4
+ import { n as requestContext } from "./requestContext-DDLS3NVU.mjs";
5
5
  import { n as createEvent, t as MemoryEventTransport } from "./EventTransport-ClEDfiMS.mjs";
6
6
  import fp from "fastify-plugin";
7
7
  //#region src/events/retry.ts
@@ -450,6 +450,52 @@ interface EventOutboxOptions {
450
450
  * on next poll) — legacy behaviour, unchanged.
451
451
  */
452
452
  readonly failurePolicy?: OutboxFailurePolicy;
453
+ /**
454
+ * Unit-of-Work session provider (AsyncLocalStorage integration).
455
+ *
456
+ * When set, `store()` calls this to get the active DB session and uses
457
+ * it as `OutboxWriteOptions.session` — **only when the caller has not
458
+ * already passed an explicit `options.session`**. This eliminates the
459
+ * boilerplate of threading the transaction handle from the controller
460
+ * through every service layer down to the outbox call site.
461
+ *
462
+ * Wire up with arc's `transactionContext`:
463
+ * ```typescript
464
+ * import { transactionContext } from '@classytic/arc/context';
465
+ *
466
+ * const outbox = new EventOutbox({
467
+ * store: myOutboxStore,
468
+ * sessionProvider: () => transactionContext.get(),
469
+ * });
470
+ *
471
+ * // In your service layer — session is auto-picked up:
472
+ * await transactionContext.run(mongooseSession, async () => {
473
+ * await orders.insertOne(order, { session: mongooseSession });
474
+ * await outbox.store(orderCreatedEvent); // no session arg needed
475
+ * });
476
+ * ```
477
+ */
478
+ readonly sessionProvider?: () => unknown;
479
+ /**
480
+ * W3C Trace Context provider.
481
+ *
482
+ * When set, `store()` calls this and merges the returned headers into
483
+ * `OutboxWriteOptions.headers` — only when `traceparent` is not already
484
+ * present in the caller-supplied headers. Downstream relay workers can
485
+ * then forward the headers to the transport, preserving the distributed
486
+ * trace tree across service boundaries.
487
+ *
488
+ * Wire up with arc's `getTraceHeaders`:
489
+ * ```typescript
490
+ * import { getTraceHeaders } from '@classytic/arc/context';
491
+ *
492
+ * const outbox = new EventOutbox({
493
+ * store: myOutboxStore,
494
+ * traceContextProvider: getTraceHeaders,
495
+ * });
496
+ * ```
497
+ */
498
+ readonly traceContextProvider?: () => Record<string, string> | undefined;
453
499
  }
454
500
  declare class EventOutbox {
455
501
  private readonly _store;
@@ -459,6 +505,8 @@ declare class EventOutbox {
459
505
  private readonly _leaseMs;
460
506
  private readonly _onError?;
461
507
  private readonly _usePublishMany;
508
+ private readonly _sessionProvider?;
509
+ private readonly _traceContextProvider?;
462
510
  private readonly _failurePolicy?;
463
511
  /**
464
512
  * In-process attempt counter per event id. Accurate within this relay
@@ -1,6 +1,6 @@
1
1
  import { t as MemoryEventTransport } from "../EventTransport-ClEDfiMS.mjs";
2
2
  import { n as defineEvent, t as createEventRegistry } from "../defineEvent-NPKUJRt8.mjs";
3
- import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-CnJCUyM0.mjs";
3
+ import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-Dxp9JlKK.mjs";
4
4
  import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-5JgaxieH.mjs";
5
5
  import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
6
6
  import { update } from "@classytic/repo-core/update";
@@ -387,6 +387,8 @@ var EventOutbox = class {
387
387
  _leaseMs;
388
388
  _onError;
389
389
  _usePublishMany;
390
+ _sessionProvider;
391
+ _traceContextProvider;
390
392
  _failurePolicy;
391
393
  /**
392
394
  * In-process attempt counter per event id. Accurate within this relay
@@ -406,6 +408,8 @@ var EventOutbox = class {
406
408
  this._onError = opts.onError;
407
409
  this._usePublishMany = opts.usePublishMany ?? true;
408
410
  this._failurePolicy = opts.failurePolicy;
411
+ this._sessionProvider = opts.sessionProvider;
412
+ this._traceContextProvider = opts.traceContextProvider;
409
413
  }
410
414
  /** Unique consumer ID used for lease ownership when the store supports claims */
411
415
  get consumerId() {
@@ -427,11 +431,29 @@ var EventOutbox = class {
427
431
  if (!event || typeof event !== "object") throw new InvalidOutboxEventError("event is not an object");
428
432
  if (!event.type || typeof event.type !== "string") throw new InvalidOutboxEventError("event.type is required");
429
433
  if (!event.meta?.id || typeof event.meta.id !== "string") throw new InvalidOutboxEventError("event.meta.id is required");
430
- const effectiveOptions = options?.dedupeKey === void 0 && event.meta.idempotencyKey ? {
431
- ...options ?? {},
434
+ let effective = options;
435
+ if (effective?.session === void 0 && this._sessionProvider) {
436
+ const autoSession = this._sessionProvider();
437
+ if (autoSession !== void 0) effective = {
438
+ ...effective ?? {},
439
+ session: autoSession
440
+ };
441
+ }
442
+ if (!effective?.headers?.["traceparent"] && this._traceContextProvider) {
443
+ const traceHeaders = this._traceContextProvider();
444
+ if (traceHeaders && Object.keys(traceHeaders).length > 0) effective = {
445
+ ...effective ?? {},
446
+ headers: {
447
+ ...traceHeaders,
448
+ ...effective?.headers ?? {}
449
+ }
450
+ };
451
+ }
452
+ if (effective?.dedupeKey === void 0 && event.meta.idempotencyKey) effective = {
453
+ ...effective ?? {},
432
454
  dedupeKey: event.meta.idempotencyKey
433
- } : options;
434
- await this._store.save(event, effectiveOptions);
455
+ };
456
+ await this._store.save(event, effective);
435
457
  }
436
458
  _reportError(kind, error, event) {
437
459
  if (!this._onError) return;
@@ -1,4 +1,4 @@
1
- import { a as CustomPluginAuthOption, c as RawBodyOptions, d as preloadResourcesAsync, f as LoadResourcesOptions, h as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, m as ResourceModule, n as BetterAuthOption, o as JwtAuthOption, p as ResourceLike, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as preloadResources } from "../types-BRmS8TNa.mjs";
1
+ import { a as CustomPluginAuthOption, c as RawBodyOptions, d as preloadResourcesAsync, f as LoadResourcesOptions, h as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, m as ResourceModule, n as BetterAuthOption, o as JwtAuthOption, p as ResourceLike, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as preloadResources } from "../types-DEEWwQFR.mjs";
2
2
  import { FastifyInstance, FastifyServerOptions } from "fastify";
3
3
 
4
4
  //#region src/factory/createApp.d.ts
@@ -1,5 +1,5 @@
1
1
  import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-BOXzPhKU.mjs";
2
- import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-CzCEEsEm.mjs";
2
+ import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-DZvrb587.mjs";
3
3
  import { t as loadResources } from "../loadResources-fol6JuvW.mjs";
4
4
  //#region src/factory/edge.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { An as HookSystem, z as ResourceRegistry } from "./index-C1JSBan-.mjs";
1
+ import { An as HookSystem, z as ResourceRegistry } from "./index-C000faom.mjs";
2
2
  import { t as ExternalOpenApiPaths } from "./externalPaths-ClykOQqa.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
 
@@ -1,2 +1,2 @@
1
- import { An as HookSystem, Dn as HookOperation, En as HookHandler, Fn as beforeCreate, In as beforeDelete, Ln as beforeUpdate, Mn as afterCreate, Nn as afterDelete, On as HookPhase, Pn as afterUpdate, Rn as createHookSystem, Tn as HookContext, jn as HookSystemOptions, kn as HookRegistration, wn as DefineHookOptions, zn as defineHook } from "../index-C1JSBan-.mjs";
1
+ import { An as HookSystem, Dn as HookOperation, En as HookHandler, Fn as beforeCreate, In as beforeDelete, Ln as beforeUpdate, Mn as afterCreate, Nn as afterDelete, On as HookPhase, Pn as afterUpdate, Rn as createHookSystem, Tn as HookContext, jn as HookSystemOptions, kn as HookRegistration, wn as DefineHookOptions, zn as defineHook } from "../index-C000faom.mjs";
2
2
  export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
@@ -2854,7 +2854,16 @@ interface ResourceConfig<TDoc = AnyRecord> {
2854
2854
  * ```
2855
2855
  */
2856
2856
  aggregations?: AggregationsMap;
2857
- disableCrud?: boolean;
2857
+ /**
2858
+ * Turn off ALL auto-CRUD routes for this resource (custom `routes` /
2859
+ * `actions` / `aggregations` still mount). The canonical kill-switch —
2860
+ * `crud: false` is its declarative equivalent.
2861
+ *
2862
+ * Note: there is no `disableCrud` alias. A short-lived `disableCrud`
2863
+ * field shipped in the type but was never read by the router, so it
2864
+ * silently no-opped — removed in 2.18.0 so the only kill-switch is the
2865
+ * one that actually works.
2866
+ */
2858
2867
  disableDefaultRoutes?: boolean;
2859
2868
  /** Specific routes to disable (negative-form opt-out). */
2860
2869
  disabledRoutes?: CrudRouteKey[];
@@ -1,4 +1,4 @@
1
- import { C as RequestContext, F as FastifyWithDecorators, H as ActionDefinition, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, T as CrudRouterOptions, Tt as AggregationConfig, V as ResourceDefinition, bt as IRequestContext, ft as RouteMcpConfig, mt as RouteSchemaOptions, q as CrudController, st as ResourceConfig, vt as IController, yt as IControllerResponse } from "./index-C1JSBan-.mjs";
1
+ import { C as RequestContext, F as FastifyWithDecorators, H as ActionDefinition, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, T as CrudRouterOptions, Tt as AggregationConfig, V as ResourceDefinition, bt as IRequestContext, ft as RouteMcpConfig, mt as RouteSchemaOptions, q as CrudController, st as ResourceConfig, vt as IController, yt as IControllerResponse } from "./index-C000faom.mjs";
2
2
  import { i as RequestScope } from "./types-CfapW2t8.mjs";
3
3
  import { c as PermissionCheck } from "./fields-DqZLp5d6.mjs";
4
4
  import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $t as BaseController, A as RequestIdOptions, At as AggregationRateLimit, B as defineResource, C as RequestContext, Ct as AggMeasureShorthand, D as HealthCheck, Dt as AggregationIndexHint, E as GracefulShutdownOptions, Et as AggregationDateRangeRequirement, F as FastifyWithDecorators, J as CrudRouteKey, Jt as ArcRequest, Kt as AnyRecord, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationMaterializedContext, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, St as AggMeasureInput, T as CrudRouterOptions, Tt as AggregationConfig, V as ResourceDefinition, Vt as AuthPluginOptions, X as EventDefinition, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, _n as ArcListResult, a as InferAdapterDoc, an as SlugMixin, bt as IRequestContext, c as TypedController, cn as BaseControllerOptions, d as PaginationResult, dn as ControllerConstructionOptions, en as SoftDeleteExt, f as IntrospectionData, g as ArcInternalMetadata, gn as ArcGetResult, gt as ControllerLike, h as ResourceMetadata, hn as ArcDeleteResult, i as ValidationResult, in as SlugExt, it as RateLimitConfig, jt as AggregationsMap, k as IntrospectionPluginOptions, kt as AggregationMaterializedResult, l as TypedRepository, ln as BaseCrudController, m as RegistryStats, mn as ArcCreateResult, mt as RouteSchemaOptions, n as ConfigError, nn as TreeExt, o as InferDocType, on as BulkExt, p as RegistryEntry, q as CrudController, qt as ApiResponse, r as ValidateOptions, rn as TreeMixin, rt as PresetResult, s as InferResourceDoc, sn as BulkMixin, st as ResourceConfig, t as RouteHandlerMethod, tn as SoftDeleteMixin, tt as PresetFunction, u as TypedResourceConfig, un as ControllerConfigurableOptions, vn as ArcUpdateResult, vt as IController, w as ServiceContext, wt as AggregationCacheConfig, xt as RouteHandler, y as OwnershipCheck, yn as ListResult, yt as IControllerResponse } from "./index-C1JSBan-.mjs";
1
+ import { $t as BaseController, A as RequestIdOptions, At as AggregationRateLimit, B as defineResource, C as RequestContext, Ct as AggMeasureShorthand, D as HealthCheck, Dt as AggregationIndexHint, E as GracefulShutdownOptions, Et as AggregationDateRangeRequirement, F as FastifyWithDecorators, J as CrudRouteKey, Jt as ArcRequest, Kt as AnyRecord, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationMaterializedContext, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, St as AggMeasureInput, T as CrudRouterOptions, Tt as AggregationConfig, V as ResourceDefinition, Vt as AuthPluginOptions, X as EventDefinition, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, _n as ArcListResult, a as InferAdapterDoc, an as SlugMixin, bt as IRequestContext, c as TypedController, cn as BaseControllerOptions, d as PaginationResult, dn as ControllerConstructionOptions, en as SoftDeleteExt, f as IntrospectionData, g as ArcInternalMetadata, gn as ArcGetResult, gt as ControllerLike, h as ResourceMetadata, hn as ArcDeleteResult, i as ValidationResult, in as SlugExt, it as RateLimitConfig, jt as AggregationsMap, k as IntrospectionPluginOptions, kt as AggregationMaterializedResult, l as TypedRepository, ln as BaseCrudController, m as RegistryStats, mn as ArcCreateResult, mt as RouteSchemaOptions, n as ConfigError, nn as TreeExt, o as InferDocType, on as BulkExt, p as RegistryEntry, q as CrudController, qt as ApiResponse, r as ValidateOptions, rn as TreeMixin, rt as PresetResult, s as InferResourceDoc, sn as BulkMixin, st as ResourceConfig, t as RouteHandlerMethod, tn as SoftDeleteMixin, tt as PresetFunction, u as TypedResourceConfig, un as ControllerConfigurableOptions, vn as ArcUpdateResult, vt as IController, w as ServiceContext, wt as AggregationCacheConfig, xt as RouteHandler, y as OwnershipCheck, yn as ListResult, yt as IControllerResponse } from "./index-C000faom.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-DqZLp5d6.mjs";
3
- import { A as MAX_FILTER_DEPTH, C as DEFAULT_SORT, D as HOOK_PHASES, E as HOOK_OPERATIONS, F as RESERVED_QUERY_PARAMS, I as SYSTEM_FIELDS, M as MAX_SEARCH_LENGTH, N as MUTATION_OPERATIONS, O as HookOperation, P as MutationOperation, S as DEFAULT_MAX_LIMIT, T as DEFAULT_UPDATE_METHOD, _ as defineAggregation, b as DEFAULT_ID_FIELD, f as defineResourceVariants, j as MAX_REGEX_LENGTH, k as HookPhase, m as defineAction, s as getControllerScope, v as CRUD_OPERATIONS, w as DEFAULT_TENANT_FIELD, x as DEFAULT_LIMIT, y as CrudOperation } from "./index-CruZir1o.mjs";
3
+ import { A as MAX_FILTER_DEPTH, C as DEFAULT_SORT, D as HOOK_PHASES, E as HOOK_OPERATIONS, F as RESERVED_QUERY_PARAMS, I as SYSTEM_FIELDS, M as MAX_SEARCH_LENGTH, N as MUTATION_OPERATIONS, O as HookOperation, P as MutationOperation, S as DEFAULT_MAX_LIMIT, T as DEFAULT_UPDATE_METHOD, _ as defineAggregation, b as DEFAULT_ID_FIELD, f as defineResourceVariants, j as MAX_REGEX_LENGTH, k as HookPhase, m as defineAction, s as getControllerScope, v as CRUD_OPERATIONS, w as DEFAULT_TENANT_FIELD, x as DEFAULT_LIMIT, y as CrudOperation } from "./index-CNiryUMN.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-3L-adFJO.mjs";
5
5
  import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-4ZloYFvm.mjs";
6
6
 
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
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-TrJVIJl0.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
- import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-CgHomZ4d.mjs";
3
+ import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-DPwe89qs.mjs";
4
4
  import { C as requireAuth, D as when, M as applyFieldWritePermissions, N as fields, T as requireRoles, _ as requireTeamMembership, a as presets_exports, b as anyOf, c as readOnly, d as createOrgPermissions, f as requireOrgInScope, g as requireServiceScope, h as requireScopeContext, i as ownerWithAdminBypass, j as applyFieldReadPermissions, m as requireOrgRole, n as authenticated, o as publicRead, p as requireOrgMembership, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as createDynamicPermissionMatrix, v as allOf, w as requireOwnership, x as denyAll, y as allowPublic } from "./permissions-B1Qy55fg.mjs";
5
- import { x as getControllerScope } from "./routerShared-nCyJGOKX.mjs";
6
- import { a as defineResource, i as defineResourceVariants, o as ResourceDefinition, s as defineAction, u as defineAggregation } from "./core-D8tpQ4ZL.mjs";
5
+ import { x as getControllerScope } from "./routerShared-Dl0A77Ba.mjs";
6
+ import { a as defineResource, i as defineResourceVariants, o as ResourceDefinition, s as defineAction, u as defineAggregation } from "./core-B41eZxyM.mjs";
7
7
  //#region src/index.ts
8
- const version = "2.17.1";
8
+ const version = "2.18.1";
9
9
  //#endregion
10
10
  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, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };