@classytic/arc 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/{BaseController-D-MHZ27_.mjs → BaseController-BnLYgE9A.mjs} +2 -2
  2. package/dist/{EventTransport-IEn7Tn-Q.d.mts → EventTransport-QmY7A258.d.mts} +0 -1
  3. package/dist/{QueryCache-TRfXau3W.d.mts → QueryCache-Z1B38koh.d.mts} +0 -1
  4. package/dist/{actionPermissions-C9RMiIpc.mjs → actionPermissions-ze70xXJi.mjs} +1 -1
  5. package/dist/audit/index.d.mts +9 -5
  6. package/dist/auth/audit.d.mts +7 -4
  7. package/dist/auth/audit.mjs +5 -0
  8. package/dist/auth/index.d.mts +7 -14
  9. package/dist/auth/index.mjs +1 -1
  10. package/dist/auth/redis-session.d.mts +1 -2
  11. package/dist/cache/index.d.mts +2 -3
  12. package/dist/cli/commands/describe.d.mts +1 -2
  13. package/dist/cli/commands/docs.mjs +1 -1
  14. package/dist/cli/commands/init.mjs +1 -1
  15. package/dist/cli/index.mjs +1 -1
  16. package/dist/context/index.d.mts +2 -2
  17. package/dist/core/index.d.mts +3 -3
  18. package/dist/core/index.mjs +4 -4
  19. package/dist/{core-CWhyGkiM.mjs → core-DZ6Xe1jR.mjs} +65 -10
  20. package/dist/{createActionRouter-HlQso0jO.mjs → createActionRouter-BWMDW-dL.mjs} +2 -2
  21. package/dist/{createAggregationRouter-5LzPzgw1.mjs → createAggregationRouter-l5mNdYrZ.mjs} +1 -1
  22. package/dist/{createApp-D6uwzCKu.mjs → createApp-Bi61XxqU.mjs} +149 -137
  23. package/dist/discovery/index.d.mts +0 -1
  24. package/dist/docs/index.d.mts +1 -2
  25. package/dist/docs/index.mjs +1 -1
  26. package/dist/{elevation-xGUBq6p_.d.mts → elevation-C9s5hFP_.d.mts} +0 -1
  27. package/dist/encryption/index.d.mts +2 -144
  28. package/dist/{errorHandler-BtUUDPEa.d.mts → errorHandler-B0e-bq-O.d.mts} +0 -1
  29. package/dist/{errors-DOHkjQlD.d.mts → errors-DHcHVAgk.d.mts} +0 -1
  30. package/dist/{eventPlugin-DbBFd3x_.d.mts → eventPlugin-A6EbthXR.d.mts} +10 -6
  31. package/dist/events/index.d.mts +9 -6
  32. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  33. package/dist/events/transports/redis.d.mts +1 -2
  34. package/dist/factory/index.d.mts +4 -4
  35. package/dist/factory/index.mjs +2 -2
  36. package/dist/{fastify-augmentation-CCQJEDgh.d.mts → fastify-augmentation-DafigGQp.d.mts} +2 -3
  37. package/dist/{fields-C7ahdGYf.d.mts → fields-BGqrAa_u.d.mts} +1 -2
  38. package/dist/hooks/index.d.mts +1 -1
  39. package/dist/idempotency/index.d.mts +4 -3
  40. package/dist/idempotency/redis.d.mts +1 -1
  41. package/dist/{index-DUa8WHz3.d.mts → index-B5N-NaHs.d.mts} +88 -7
  42. package/dist/{index-CdFkIMEd.d.mts → index-B5PoNbfu.d.mts} +36 -7
  43. package/dist/{index-_--GyzcO.d.mts → index-Dtrj6XZk.d.mts} +62 -28
  44. package/dist/index.d.mts +7 -7
  45. package/dist/index.mjs +6 -6
  46. package/dist/{init-YH_nslQR.mjs → init-0YhHkXGk.mjs} +154 -137
  47. package/dist/integrations/event-gateway.d.mts +2 -3
  48. package/dist/integrations/index.d.mts +2 -2
  49. package/dist/integrations/jobs.d.mts +0 -1
  50. package/dist/integrations/mcp/index.d.mts +6 -7
  51. package/dist/integrations/mcp/index.mjs +1 -1
  52. package/dist/integrations/mcp/testing.d.mts +1 -2
  53. package/dist/integrations/mcp/testing.mjs +1 -1
  54. package/dist/integrations/streamline.d.mts +2 -2
  55. package/dist/integrations/webhooks.d.mts +0 -1
  56. package/dist/integrations/websocket-pushref-redis.d.mts +1 -2
  57. package/dist/integrations/websocket-redis.d.mts +1 -2
  58. package/dist/integrations/websocket.d.mts +2 -2
  59. package/dist/{loadResources-B8UmpITt.mjs → loadResources-DpU8pfjV.mjs} +4 -3
  60. package/dist/{mcpPlugin-CuW6L_uD.mjs → mcpPlugin-B9XjjNVG.mjs} +3 -3
  61. package/dist/middleware/index.d.mts +1 -2
  62. package/dist/{module-JYH9V0I8.d.mts → module-WeuU5jfd.d.mts} +46 -1
  63. package/dist/{openapi-Dq6RbEGK.mjs → openapi-Kyod_di6.mjs} +2 -2
  64. package/dist/permissions/index.d.mts +3 -3
  65. package/dist/permissions/index.mjs +2 -2
  66. package/dist/{permissions-CgbOLJZG.mjs → permissions-BJMuKMl7.mjs} +33 -1
  67. package/dist/pipeline/index.d.mts +1 -2
  68. package/dist/plugins/index.d.mts +79 -7
  69. package/dist/plugins/index.mjs +88 -1
  70. package/dist/plugins/response-cache.d.mts +5 -3
  71. package/dist/plugins/tracing-entry.d.mts +1 -1
  72. package/dist/plugins/tracing-entry.mjs +1 -1
  73. package/dist/presets/filesUpload.d.mts +4 -5
  74. package/dist/presets/filesUpload.mjs +1 -1
  75. package/dist/presets/index.d.mts +1 -2
  76. package/dist/presets/index.mjs +1 -1
  77. package/dist/presets/multiTenant.d.mts +1 -2
  78. package/dist/presets/search.d.mts +2 -3
  79. package/dist/presets/search.mjs +1 -1
  80. package/dist/{presets-DWsYQdbV.mjs → presets-gw0ciIUD.mjs} +1 -1
  81. package/dist/{pushref-registry-DnCqL3aa.d.mts → pushref-registry-BbcnpNTm.d.mts} +4 -2
  82. package/dist/{queryCachePlugin-xzFyKAjT.d.mts → queryCachePlugin-CfYWq-Ak.d.mts} +1 -2
  83. package/dist/{redis-C3W0qbz8.d.mts → redis-UDtLaNj6.d.mts} +0 -1
  84. package/dist/{redis-stream-DsP1vqZB.d.mts → redis-stream-iVR2l7aS.d.mts} +1 -2
  85. package/dist/{registerRoute-DGSREwPw.mjs → registerRoute-oGAl0oA8.mjs} +1 -1
  86. package/dist/registry/index.d.mts +2 -2
  87. package/dist/schemas/index.d.mts +0 -1
  88. package/dist/scim/index.d.mts +0 -1
  89. package/dist/scope/index.d.mts +2 -3
  90. package/dist/{sessionManager-BXG-HGwG.d.mts → sessionManager-BHOM3N_0.d.mts} +10 -6
  91. package/dist/{storage-Co_PQpeQ.d.mts → storage-DLUZ04kK.d.mts} +8 -4
  92. package/dist/testing/index.d.mts +2 -3
  93. package/dist/testing/index.mjs +5 -2
  94. package/dist/testing/storageContract.d.mts +1 -2
  95. package/dist/{tracing-D8jlGXP7.d.mts → tracing-CsGKQJGg.d.mts} +0 -1
  96. package/dist/types/index.d.mts +4 -4
  97. package/dist/types/storage.d.mts +1 -1
  98. package/dist/types-Cc91nXuA.d.mts +132 -0
  99. package/dist/{types-LNebCoJx.d.mts → types-DH0GupI7.d.mts} +8 -4
  100. package/dist/{types-C9b2HR5W.d.mts → types-DRj-Ut4n.d.mts} +1 -2
  101. package/dist/{types-BHMKlMBU.d.mts → types-DpxoNX5v.d.mts} +61 -21
  102. package/dist/utils/index.d.mts +182 -128
  103. package/dist/utils/index.mjs +2 -2
  104. package/dist/{utils-ChjYQpjn.mjs → utils-CO8a3B_1.mjs} +70 -26
  105. package/dist/{versioning-D_eBCfNr.d.mts → versioning-DQ4mCvg0.d.mts} +1 -2
  106. package/dist/{websocket-MlYlrYq0.d.mts → websocket-uuWqM6UY.d.mts} +5 -4
  107. package/package.json +7 -7
  108. package/skills/arc-module-publishing/SKILL.md +242 -0
  109. package/skills/arc-module-publishing/references/authoring-modules.md +272 -0
  110. package/skills/arc-module-publishing/references/package-manifest.md +155 -0
  111. package/skills/arc-module-publishing/references/publishing-workflow.md +182 -0
@@ -1,6 +1,6 @@
1
1
  import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-CHw3_oA_.mjs";
2
- import { a as getModuleExports, c as developmentPreset, d as productionPreset, f as testingPreset, i as defineModule, l as edgePreset, n as createApp, o as orderModules, s as resolveModule, t as ArcFactory, u as getPreset } from "../createApp-D6uwzCKu.mjs";
3
- import { t as loadResources } from "../loadResources-B8UmpITt.mjs";
2
+ import { a as edgePreset, c as testingPreset, d as orderModules, f as resolveModule, i as developmentPreset, l as defineModule, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory, u as getModuleExports } from "../createApp-Bi61XxqU.mjs";
3
+ import { t as loadResources } from "../loadResources-DpU8pfjV.mjs";
4
4
  //#region src/factory/edge.ts
5
5
  /**
6
6
  * Convert a Fastify app into a Web Standards fetch handler.
@@ -1,8 +1,7 @@
1
- import { bn as HookSystem, z as ResourceRegistry } from "./index-_--GyzcO.mjs";
1
+ import { bn as HookSystem, z as ResourceRegistry } from "./index-Dtrj6XZk.mjs";
2
2
  import { t as ExternalOpenApiPaths } from "./externalPaths-BE6wFpYv.mjs";
3
- import { r as ArcModuleRegistry } from "./module-JYH9V0I8.mjs";
3
+ import { r as ArcModuleRegistry } from "./module-WeuU5jfd.mjs";
4
4
  import { FastifyPluginAsync } from "fastify";
5
-
6
5
  //#region src/core/arcCorePlugin.d.ts
7
6
  interface ArcCorePluginOptions {
8
7
  /** Enable event emission for CRUD operations (requires eventPlugin) */
@@ -1,6 +1,5 @@
1
- import { i as RequestScope } from "./types-LNebCoJx.mjs";
1
+ import { i as RequestScope } from "./types-DH0GupI7.mjs";
2
2
  import { FastifyRequest } from "fastify";
3
-
4
3
  //#region src/permissions/types.d.ts
5
4
  /**
6
5
  * User base interface - minimal shape Arc expects
@@ -1,2 +1,2 @@
1
- import { Cn as afterDelete, Dn as beforeUpdate, En as beforeDelete, On as createHookSystem, Sn as afterCreate, Tn as beforeCreate, _n as HookOperation, bn as HookSystem, gn as HookHandler, hn as HookContext, kn as defineHook, mn as DefineHookOptions, vn as HookPhase, wn as afterUpdate, xn as HookSystemOptions, yn as HookRegistration } from "../index-_--GyzcO.mjs";
1
+ import { Cn as afterDelete, Dn as beforeUpdate, En as beforeDelete, On as createHookSystem, Sn as afterCreate, Tn as beforeCreate, _n as HookOperation, bn as HookSystem, gn as HookHandler, hn as HookContext, kn as defineHook, mn as DefineHookOptions, vn as HookPhase, wn as afterUpdate, xn as HookSystemOptions, yn as HookRegistration } from "../index-Dtrj6XZk.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 };
@@ -1,8 +1,7 @@
1
1
  import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-Uk8ONJv7.mjs";
2
- import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-C3W0qbz8.mjs";
2
+ import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-UDtLaNj6.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
  import { RepositoryLike } from "@classytic/repo-core/adapter";
5
-
6
5
  //#region src/idempotency/idempotencyPlugin.d.ts
7
6
  interface IdempotencyPluginOptions {
8
7
  /** Enable idempotency (default: false) */
@@ -60,7 +59,9 @@ declare module "fastify" {
60
59
  interface FastifyInstance {
61
60
  /** Idempotency utilities */
62
61
  idempotency: {
63
- /** Manually invalidate an idempotency key */invalidate: (key: string) => Promise<void>; /** Check if a key has a cached response */
62
+ /** Manually invalidate an idempotency key */
63
+ invalidate: (key: string) => Promise<void>;
64
+ /** Check if a key has a cached response */
64
65
  has: (key: string) => Promise<boolean>;
65
66
  /**
66
67
  * Route-level preHandler for idempotency check + lock.
@@ -1,2 +1,2 @@
1
- import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-C3W0qbz8.mjs";
1
+ import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-UDtLaNj6.mjs";
2
2
  export { type IoredisLike, type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions, type UpstashRedisLike, ioredisAsIdempotencyClient, upstashAsIdempotencyClient };
@@ -1,11 +1,12 @@
1
- import { C as RequestContext, Et as AggregationConfig, F as FastifyWithDecorators, H as ActionDefinition, K as ArcFieldRule, L as RequestWithExtras, T as CrudRouterOptions, V as ResourceDefinition, bt as IControllerResponse, ht as RouteSchemaOptions, pt as RouteMcpConfig, q as CrudController, qt as AnyRecord, st as ResourceConfig, xt as IRequestContext, yt as IController } from "./index-_--GyzcO.mjs";
2
- import { i as RequestScope } from "./types-LNebCoJx.mjs";
3
- import { c as PermissionCheck } from "./fields-C7ahdGYf.mjs";
1
+ import { C as RequestContext, Et as AggregationConfig, F as FastifyWithDecorators, H as ActionDefinition, K as ArcFieldRule, L as RequestWithExtras, T as CrudRouterOptions, V as ResourceDefinition, bt as IControllerResponse, ht as RouteSchemaOptions, pt as RouteMcpConfig, q as CrudController, qt as AnyRecord, st as ResourceConfig, xt as IRequestContext, yt as IController } from "./index-Dtrj6XZk.mjs";
2
+ import { i as RequestScope } from "./types-DH0GupI7.mjs";
3
+ import { c as PermissionCheck } from "./fields-BGqrAa_u.mjs";
4
+ import "./fastify-augmentation-DafigGQp.mjs";
4
5
  import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
5
6
  import { z } from "zod";
7
+ import { DataAdapter } from "@classytic/repo-core/adapter";
6
8
  import { AggDateBucket, AggMeasure, AggTopN } from "@classytic/repo-core/repository";
7
9
  import { LookupSpec } from "@classytic/repo-core/lookup";
8
-
9
10
  //#region src/constants.d.ts
10
11
  /**
11
12
  * Arc Framework Constants — Single Source of Truth
@@ -130,7 +131,7 @@ declare function createPermissionMiddleware(permission: PermissionCheck, resourc
130
131
  * Plain JSON-Schema entries skip the inference path entirely (they go
131
132
  * through the untyped `ActionDefinition` form).
132
133
  */
133
- interface DefineActionConfig<TSchema extends z.ZodTypeAny | undefined = undefined, TData = (TSchema extends z.ZodTypeAny ? z.infer<TSchema> : Record<string, unknown>)> {
134
+ interface DefineActionConfig<TSchema extends z.ZodTypeAny | undefined = undefined, TData = TSchema extends z.ZodTypeAny ? z.infer<TSchema> : Record<string, unknown>> {
134
135
  /** Per-action body schema (Zod v4). Drives both AJV validation and the typed `data` param. */
135
136
  schema?: TSchema;
136
137
  /** Per-action permission gate. Falls back to resource-level if omitted. */
@@ -167,6 +168,86 @@ interface DefineActionConfig<TSchema extends z.ZodTypeAny | undefined = undefine
167
168
  */
168
169
  declare function defineAction<TSchema extends z.ZodTypeAny | undefined = undefined>(config: DefineActionConfig<TSchema>): ActionDefinition;
169
170
  //#endregion
171
+ //#region src/core/defineResource/seams.d.ts
172
+ /**
173
+ * Structural adapter boundary — the `ControllerLike` pattern (v2.10.6)
174
+ * applied to adapters. `DataAdapter<T>` is invariant in `T`, so a
175
+ * `DataAdapter<HydratedDocument<IProduct>>` built by the HOST does not
176
+ * assign to a module's `DataAdapter<AnyRecord>` slot; before this type,
177
+ * module authors erased the slot to `unknown` and cast at every use.
178
+ *
179
+ * Arc only reaches for these members at runtime — the rest of the adapter's
180
+ * shape is the caller's concern. All slots optional + `unknown` so every
181
+ * kit adapter (mongokit, sqlitekit, prismakit, custom) assigns structurally.
182
+ *
183
+ * Used by {@link ResourceSeams}; `ResourceConfig.adapter` itself stays
184
+ * `DataAdapter<TDoc>` so `defineResource`'s doc-type inference is untouched.
185
+ */
186
+ interface AdapterLike {
187
+ repository?: unknown;
188
+ generateSchemas?: unknown;
189
+ getSchemaMetadata?: unknown;
190
+ }
191
+ /**
192
+ * Seam-slot type transform, two widenings per property:
193
+ *
194
+ * - admits explicit `undefined` — {@link mergeResourceConfig} skips
195
+ * `undefined` values at runtime, so the type says so. Makes
196
+ * field-mapping seams (`{ permissions: cfg.permissionsMap, ... }`)
197
+ * ergonomic under `exactOptionalPropertyTypes: true` (stricter than
198
+ * arc's own tsconfig — found by a live spine-module smoke).
199
+ * - array slots also accept `readonly` arrays — hosts naturally write
200
+ * route/preset tables `as const` or behind `readonly` exports; the
201
+ * merge copies arrays into fresh mutable ones, so a frozen host table
202
+ * never leaks into arc's internals.
203
+ */
204
+ type SeamSlot<V> = V | undefined | (V extends (infer E)[] ? readonly E[] : never);
205
+ type SkippableUndefined<T> = { [K in keyof T]: SeamSlot<T[K]>; };
206
+ /**
207
+ * The host-injectable subset of a resource config — everything a module can
208
+ * let its host override, i.e. every `ResourceConfig` slot except the
209
+ * module-owned `name` (and the internal preset-tracking field).
210
+ *
211
+ * Type your module's per-resource override bundles as `ResourceSeams` (or a
212
+ * `Pick<ResourceSeams, ...>` allow-list when you want to constrain what
213
+ * hosts may touch) and pass them through {@link mergeResourceConfig}.
214
+ */
215
+ type ResourceSeams<TDoc = AnyRecord> = SkippableUndefined<Omit<ResourceConfig<TDoc>, "name" | "_appliedPresets" | "adapter">> & {
216
+ /** Any kit adapter — widened via {@link AdapterLike} at this boundary. */
217
+ adapter?: DataAdapter<TDoc> | AdapterLike | undefined;
218
+ };
219
+ /**
220
+ * Base-config input for {@link mergeResourceConfig} — a required `name`
221
+ * plus every seam slot (which is exactly `ResourceConfig` with the
222
+ * {@link AdapterLike} widening, `undefined`-skipping, and readonly-array
223
+ * acceptance the seams get). Module builders constructing DEFAULT adapters
224
+ * from untyped kernel engine bags hit the identical `DataAdapter<T>`
225
+ * invariance at the base as hosts do at the seam.
226
+ */
227
+ type SeamedResourceConfig<TDoc = AnyRecord> = {
228
+ name: string;
229
+ } & ResourceSeams<TDoc>;
230
+ /**
231
+ * Canonical slot-aware merge of a base resource config with host seams.
232
+ * Later seams win over earlier ones; `undefined` values never clobber.
233
+ *
234
+ * Merge semantics (value-driven — no per-slot registry to drift):
235
+ *
236
+ * - **Top-level arrays CONCAT** — `routes`, `middlewares`, `presets`,
237
+ * `routeGuards`, `disabledRoutes`: additive collections, base first.
238
+ * - **Plain objects merge recursively** — `permissions`, `actions`,
239
+ * `schemaOptions` (incl. `fieldRules`), `aggregations`, `customSchemas`,
240
+ * `fields`, `cache`, `events`: per-key composition. Arrays NESTED inside
241
+ * them replace (they're value lists — enums, sort specs), not concat.
242
+ * - **Everything else last-wins** — class instances (`adapter`,
243
+ * `controller`, `queryParser`), functions, scalars.
244
+ *
245
+ * The single `as` at the return is the one documented erasure for the
246
+ * {@link AdapterLike}-widened seam slots — inside the helper so no module
247
+ * author ever writes one (mirrors mongokit's one-cast-at-the-boundary rule).
248
+ */
249
+ declare function mergeResourceConfig<TDoc = AnyRecord>(base: SeamedResourceConfig<TDoc>, ...seams: ReadonlyArray<ResourceSeams<TDoc> | undefined>): ResourceConfig<TDoc>;
250
+ //#endregion
170
251
  //#region src/core/defineResourceVariants.d.ts
171
252
  /**
172
253
  * Required identity fields for each variant. The user MUST provide a unique
@@ -188,7 +269,7 @@ type VariantsMap<TDoc = AnyRecord> = Record<string, VariantOverride<TDoc>>;
188
269
  * Result type — preserves the variant keys so destructuring is type-safe:
189
270
  * `const { articlePublic, articleAdmin } = defineResourceVariants(...)`.
190
271
  */
191
- type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: ResourceDefinition<TDoc> };
272
+ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: ResourceDefinition<TDoc>; };
192
273
  /**
193
274
  * Define multiple resources from a shared base config and per-variant overrides.
194
275
  *
@@ -344,4 +425,4 @@ declare function isFieldReadable(rule: ArcFieldRule | undefined): boolean;
344
425
  */
345
426
  declare function collectReadBlockedFields(schemaOptions: RouteSchemaOptions | undefined): Set<string> | null;
346
427
  //#endregion
347
- export { MAX_FILTER_DEPTH as A, DEFAULT_SORT as C, HOOK_PHASES as D, HOOK_OPERATIONS as E, RESERVED_QUERY_PARAMS as F, SYSTEM_FIELDS as I, MAX_SEARCH_LENGTH as M, MUTATION_OPERATIONS as N, HookOperation as O, MutationOperation as P, DEFAULT_MAX_LIMIT as S, DEFAULT_UPDATE_METHOD as T, defineAggregation as _, createRequestContext as a, DEFAULT_ID_FIELD as b, sendControllerResponse as c, getEntityQuery as d, defineResourceVariants as f, createPermissionMiddleware as g, createCrudRouter as h, createFastifyHandler as i, MAX_REGEX_LENGTH as j, HookPhase as k, getEntityId as l, defineAction as m, isFieldReadable as n, getControllerContext as o, DefineActionConfig as p, createCrudHandlers as r, getControllerScope as s, collectReadBlockedFields as t, getEntityIdField as u, CRUD_OPERATIONS as v, DEFAULT_TENANT_FIELD as w, DEFAULT_LIMIT as x, CrudOperation as y };
428
+ export { HOOK_OPERATIONS as A, SYSTEM_FIELDS as B, CrudOperation as C, DEFAULT_SORT as D, DEFAULT_MAX_LIMIT as E, MAX_REGEX_LENGTH as F, MAX_SEARCH_LENGTH as I, MUTATION_OPERATIONS as L, HookOperation as M, HookPhase as N, DEFAULT_TENANT_FIELD as O, MAX_FILTER_DEPTH as P, MutationOperation as R, CRUD_OPERATIONS as S, DEFAULT_LIMIT as T, DefineActionConfig as _, createRequestContext as a, createPermissionMiddleware as b, sendControllerResponse as c, getEntityQuery as d, defineResourceVariants as f, mergeResourceConfig as g, SeamedResourceConfig as h, createFastifyHandler as i, HOOK_PHASES as j, DEFAULT_UPDATE_METHOD as k, getEntityId as l, ResourceSeams as m, isFieldReadable as n, getControllerContext as o, AdapterLike as p, createCrudHandlers as r, getControllerScope as s, collectReadBlockedFields as t, getEntityIdField as u, defineAction as v, DEFAULT_ID_FIELD as w, defineAggregation as x, createCrudRouter as y, RESERVED_QUERY_PARAMS as z };
@@ -1,8 +1,7 @@
1
1
  import { r as CacheStore, t as CacheLogger } from "./interface-C1_WLTMK.mjs";
2
- import { i as RequestScope, n as Mandate } from "./types-LNebCoJx.mjs";
3
- import { c as PermissionCheck, l as PermissionContext, u as PermissionResult } from "./fields-C7ahdGYf.mjs";
2
+ import { i as RequestScope, n as Mandate } from "./types-DH0GupI7.mjs";
3
+ import { c as PermissionCheck, l as PermissionContext, u as PermissionResult } from "./fields-BGqrAa_u.mjs";
4
4
  import { FastifyReply, FastifyRequest } from "fastify";
5
-
6
5
  //#region src/permissions/agent.d.ts
7
6
  /**
8
7
  * Require a sender-constrained credential — the inbound token MUST carry a
@@ -356,8 +355,11 @@ interface DynamicPermissionMatrixConfig {
356
355
  * and `ttlSeconds > 0`, Arc creates an internal MemoryCacheStore.
357
356
  */
358
357
  cache?: {
359
- /** Cache TTL in seconds */ttlSeconds: number; /** Optional custom cache key builder */
360
- key?: (ctx: PermissionContext) => string | null | undefined; /** Hard entry cap for internal memory store (default: 1000) */
358
+ /** Cache TTL in seconds */
359
+ ttlSeconds: number;
360
+ /** Optional custom cache key builder */
361
+ key?: (ctx: PermissionContext) => string | null | undefined;
362
+ /** Hard entry cap for internal memory store (default: 1000) */
361
363
  maxEntries?: number;
362
364
  };
363
365
  }
@@ -620,7 +622,7 @@ declare function requireOrgInScope<TDoc = Record<string, unknown>>(target: strin
620
622
  */
621
623
  declare function requireTeamMembership<TDoc = Record<string, unknown>>(): PermissionCheck<TDoc>;
622
624
  declare namespace presets_d_exports {
623
- export { adminOnly, authenticated, fullPublic, ownerWithAdminBypass, publicRead, publicReadAdminWrite, readOnly };
625
+ export { adminOnly, authenticated, fullPublic, ownerWithAdminBypass, permissionMatrix, publicRead, publicReadAdminWrite, readOnly };
624
626
  }
625
627
  /**
626
628
  * ResourcePermissions shape — matches the type in types/index.ts
@@ -652,6 +654,33 @@ declare function authenticated<TDoc = Record<string, unknown>>(overrides?: Permi
652
654
  * @param roles - Required roles (user needs at least one). Default: ['admin']
653
655
  */
654
656
  declare function adminOnly<TDoc = Record<string, unknown>>(roles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
657
+ /**
658
+ * Arbitrary-gate CRUD matrix — the generalization every host and arc-*
659
+ * module hand-rolls as `{ list: view, get: view, create: manage, ... }`.
660
+ *
661
+ * Unlike the fixed presets above, the gates are caller-supplied
662
+ * `PermissionCheck`s, so ANY combinator plugs in — org roles, ownership,
663
+ * `anyOf(...)`, service scopes, custom async checks. `delete` defaults to
664
+ * the `write` gate.
665
+ *
666
+ * @example
667
+ * ```typescript
668
+ * // Two-gate (view/manage) — the arc-* module convention:
669
+ * permissionMatrix({ read: requireAuth(), write: requireOrgRole('manager') })
670
+ *
671
+ * // Three-gate with a stricter delete:
672
+ * permissionMatrix({
673
+ * read: allowPublic(),
674
+ * write: requireOrgRole('manager'),
675
+ * delete: requireOrgRole('owner'),
676
+ * })
677
+ * ```
678
+ */
679
+ declare function permissionMatrix<TDoc = Record<string, unknown>>(gates: {
680
+ read: PermissionCheck<TDoc>;
681
+ write: PermissionCheck<TDoc>;
682
+ delete?: PermissionCheck<TDoc>;
683
+ }, overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
655
684
  /**
656
685
  * Owner-scoped with admin bypass.
657
686
  * list = auth (scoped to owner), get = auth, create = auth,
@@ -677,4 +706,4 @@ declare function fullPublic<TDoc = Record<string, unknown>>(overrides?: Permissi
677
706
  */
678
707
  declare function readOnly<TDoc = Record<string, unknown>>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
679
708
  //#endregion
680
- export { requireRoles as A, allOf as C, not as D, denyAll as E, RequireAgentScopeOptions as F, RequireMandateOptions as I, requireAgentScope as L, when as M, applyPermissionResult as N, requireAuth as O, normalizePermissionResult as P, requireDPoP as R, createOrgPermissions as S, anyOf as T, ConnectEventsOptions as _, presets_d_exports as a, PermissionEventBus as b, readOnly as c, requireOrgRole as d, requireScopeContext as f, createRoleHierarchy as g, RoleHierarchy as h, ownerWithAdminBypass as i, roles as j, requireOwnership as k, requireOrgInScope as l, requireTeamMembership as m, authenticated as n, publicRead as o, requireServiceScope as p, fullPublic as r, publicReadAdminWrite as s, adminOnly as t, requireOrgMembership as u, DynamicPermissionMatrix as v, allowPublic as w, createDynamicPermissionMatrix as x, DynamicPermissionMatrixConfig as y, requireMandate as z };
709
+ export { requireOwnership as A, requireMandate as B, createOrgPermissions as C, denyAll as D, anyOf as E, normalizePermissionResult as F, RequireAgentScopeOptions as I, RequireMandateOptions as L, roles as M, when as N, not as O, applyPermissionResult as P, requireAgentScope as R, createDynamicPermissionMatrix as S, allowPublic as T, createRoleHierarchy as _, permissionMatrix as a, DynamicPermissionMatrixConfig as b, publicReadAdminWrite as c, requireOrgMembership as d, requireOrgRole as f, RoleHierarchy as g, requireTeamMembership as h, ownerWithAdminBypass as i, requireRoles as j, requireAuth as k, readOnly as l, requireServiceScope as m, authenticated as n, presets_d_exports as o, requireScopeContext as p, fullPublic as r, publicRead as s, adminOnly as t, requireOrgInScope as u, ConnectEventsOptions as v, allOf as w, PermissionEventBus as x, DynamicPermissionMatrix as y, requireDPoP as z };
@@ -1,14 +1,15 @@
1
- import { a as QueryCacheConfig } from "./QueryCache-TRfXau3W.mjs";
2
- import { i as RequestScope } from "./types-LNebCoJx.mjs";
3
- import { c as PermissionCheck, d as UserBase, n as FieldPermissionMap } from "./fields-C7ahdGYf.mjs";
4
- import { n as DomainEvent } from "./EventTransport-IEn7Tn-Q.mjs";
1
+ import { a as QueryCacheConfig } from "./QueryCache-Z1B38koh.mjs";
2
+ import { i as RequestScope } from "./types-DH0GupI7.mjs";
3
+ import { c as PermissionCheck, d as UserBase, n as FieldPermissionMap } from "./fields-BGqrAa_u.mjs";
4
+ import "./elevation-C9s5hFP_.mjs";
5
+ import { n as EncryptionDirective } from "./types-Cc91nXuA.mjs";
6
+ import { n as DomainEvent } from "./EventTransport-QmY7A258.mjs";
5
7
  import { KeysetPaginationResult, OffsetPaginationResult } from "@classytic/repo-core/pagination";
6
8
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, RouteHandlerMethod, RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
7
9
  import { DataAdapter, RepositoryLike } from "@classytic/repo-core/adapter";
8
10
  import { AggDateBucket, AggMeasure, AggTopN, QueryOptions, StandardRepo, TenantPurgeStrategy } from "@classytic/repo-core/repository";
9
11
  import { LookupSpec } from "@classytic/repo-core/lookup";
10
12
  import { FieldRule, SchemaBuilderOptions } from "@classytic/repo-core/schema";
11
-
12
13
  //#region src/core/BodySanitizer.d.ts
13
14
  /**
14
15
  * Policy for handling fields the caller lacks write permission for.
@@ -1082,7 +1083,8 @@ type ObjectId = string | {
1082
1083
  * The actual user structure is defined by your app's auth system.
1083
1084
  */
1084
1085
  type UserLike = UserBase & {
1085
- /** User email (optional) */email?: string;
1086
+ /** User email (optional) */
1087
+ email?: string;
1086
1088
  };
1087
1089
  interface UserOrganization {
1088
1090
  userId: string;
@@ -1229,11 +1231,17 @@ interface AuthPluginOptions {
1229
1231
  * utilities are available in the authenticator context.
1230
1232
  */
1231
1233
  jwt?: {
1232
- /** JWT secret (required for JWT features) */secret: string; /** Access token expiry (default: '15m') */
1233
- expiresIn?: string; /** Refresh token secret (defaults to main secret) */
1234
- refreshSecret?: string; /** Refresh token expiry (default: '7d') */
1235
- refreshExpiresIn?: string; /** Additional `@fastify/jwt` sign options */
1236
- sign?: Record<string, unknown>; /** Additional `@fastify/jwt` verify options */
1234
+ /** JWT secret (required for JWT features) */
1235
+ secret: string;
1236
+ /** Access token expiry (default: '15m') */
1237
+ expiresIn?: string;
1238
+ /** Refresh token secret (defaults to main secret) */
1239
+ refreshSecret?: string;
1240
+ /** Refresh token expiry (default: '7d') */
1241
+ refreshExpiresIn?: string;
1242
+ /** Additional `@fastify/jwt` sign options */
1243
+ sign?: Record<string, unknown>;
1244
+ /** Additional `@fastify/jwt` verify options */
1237
1245
  verify?: Record<string, unknown>;
1238
1246
  };
1239
1247
  /**
@@ -2698,14 +2706,22 @@ interface ResourcePermissions {
2698
2706
  * Plugin extension namespace — arc's typed escape hatch for attaching
2699
2707
  * declarative, per-resource config that **plugins** read at request time.
2700
2708
  *
2701
- * This interface is intentionally **empty in core**. Each optional plugin
2702
- * augments it via TypeScript declaration merging to register its own typed
2709
+ * **External** plugins augment it via TypeScript declaration merging
2710
+ * (`declare module "@classytic/arc/types"`) to register their own typed
2703
2711
  * slice — exactly the model Fastify uses for `FastifyInstance` decorators.
2704
- * A host that never installs a plugin never sees its key; a host that does
2705
- * gets full autocomplete + compile-time checking on the matching
2712
+ * The host gets full autocomplete + compile-time checking on the matching
2706
2713
  * `extensions` block, and a typo (`extensions: { encyrption: … }`) is a
2707
2714
  * type error rather than a silent no-op.
2708
2715
  *
2716
+ * **First-party** slices (arc's own subpath plugins) are declared inline
2717
+ * below with type-only imports instead of `declare module`. Not a style
2718
+ * choice: arc bundles its declarations, and a relative module augmentation
2719
+ * (`declare module "../types/resource.js"`) survives bundling as an
2720
+ * unresolvable specifier — the merge silently never happens for consumers,
2721
+ * so the key would be a compile ERROR downstream while working inside this
2722
+ * repo. Inline declaration is bundler-proof; the type-only import is erased
2723
+ * at runtime, so the plugin stays fully opt-in.
2724
+ *
2709
2725
  * **The "React for backend" composition model.** `defineResource()` is the
2710
2726
  * declarative component, `extensions` is its typed props bag, and plugins
2711
2727
  * are the providers that consume those props at the framework boundary.
@@ -2718,11 +2734,11 @@ interface ResourcePermissions {
2718
2734
  * at request time via `request.routeOptions.config.arcExtensions` without
2719
2735
  * re-deriving which resource a route belongs to.
2720
2736
  *
2721
- * @example A plugin registers its slice (in `@classytic/arc/encryption`)
2737
+ * @example An external plugin package registers its slice
2722
2738
  * ```ts
2723
2739
  * declare module "@classytic/arc/types" {
2724
2740
  * interface ResourceExtensions {
2725
- * encryption?: import("@classytic/arc/encryption").EncryptionDirective;
2741
+ * myPlugin?: import("my-arc-plugin").MyPluginDirective;
2726
2742
  * }
2727
2743
  * }
2728
2744
  * ```
@@ -2735,7 +2751,16 @@ interface ResourcePermissions {
2735
2751
  * });
2736
2752
  * ```
2737
2753
  */
2738
- interface ResourceExtensions {}
2754
+ interface ResourceExtensions {
2755
+ /**
2756
+ * Encrypt this resource's responses — full-body JWE or specific fields.
2757
+ * Read at request time by `@classytic/arc/encryption`'s `encryptionPlugin`
2758
+ * from `request.routeOptions.config.arcExtensions.encryption`; inert (and
2759
+ * dependency-free — the import is type-only) unless that plugin is
2760
+ * registered.
2761
+ */
2762
+ encryption?: EncryptionDirective;
2763
+ }
2739
2764
  interface ResourceConfig<TDoc = AnyRecord> {
2740
2765
  name: string;
2741
2766
  displayName?: string;
@@ -2935,7 +2960,7 @@ interface ResourceConfig<TDoc = AnyRecord> {
2935
2960
  * });
2936
2961
  * ```
2937
2962
  */
2938
- crud?: false | { [K in CrudRouteKey]?: boolean };
2963
+ crud?: false | { [K in CrudRouteKey]?: boolean; };
2939
2964
  /**
2940
2965
  * Field name used for multi-tenant scoping (default: 'organizationId').
2941
2966
  * Override to match your schema: 'workspaceId', 'tenantId', etc.
@@ -3626,7 +3651,8 @@ type FastifyWithDecorators = FastifyInstance & {
3626
3651
  arc?: ArcDecorator;
3627
3652
  events?: EventsDecorator;
3628
3653
  authenticate?: (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
3629
- optionalAuthenticate?: (request: FastifyRequest, reply: FastifyReply) => Promise<void>; /** Organization-scoped filtering — from `multiTenant` preset */
3654
+ optionalAuthenticate?: (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
3655
+ /** Organization-scoped filtering — from `multiTenant` preset */
3630
3656
  organizationScoped?: (options?: {
3631
3657
  required?: boolean;
3632
3658
  }) => RouteHandlerMethod;
@@ -3991,8 +4017,10 @@ interface RegistryEntry extends ResourceMetadata {
3991
4017
  */
3992
4018
  actions?: Array<{
3993
4019
  readonly name: string;
3994
- readonly description?: string; /** Raw per-action schema (JSON Schema, Zod v4, or legacy field map) */
3995
- readonly schema?: unknown; /** Per-action permission check (if different from resource-level `actionPermissions`) */
4020
+ readonly description?: string;
4021
+ /** Raw per-action schema (JSON Schema, Zod v4, or legacy field map) */
4022
+ readonly schema?: unknown;
4023
+ /** Per-action permission check (if different from resource-level `actionPermissions`) */
3996
4024
  readonly permissions?: PermissionCheck;
3997
4025
  /**
3998
4026
  * 2.15.5: mount point — `true` (default) for `POST /:id/action`,
@@ -4001,7 +4029,8 @@ interface RegistryEntry extends ResourceMetadata {
4001
4029
  * resource manifests so callers can pick the right URL without
4002
4030
  * reading the action definition itself.
4003
4031
  */
4004
- readonly id?: boolean; /** MCP tool generation flag — `false` to skip, object for overrides */
4032
+ readonly id?: boolean;
4033
+ /** MCP tool generation flag — `false` to skip, object for overrides */
4005
4034
  readonly mcp?: boolean | {
4006
4035
  readonly description?: string;
4007
4036
  readonly annotations?: Record<string, unknown>;
@@ -4028,13 +4057,17 @@ interface RegistryEntry extends ResourceMetadata {
4028
4057
  readonly summary?: string;
4029
4058
  readonly description?: string;
4030
4059
  readonly permissions: PermissionCheck;
4031
- readonly groupBy?: string | readonly string[]; /** Measure aliases keyed to their op-tag (e.g. `'count'`, `'sum:price'`). */
4032
- readonly measures: Readonly<Record<string, string>>; /** Lookup alias names (`as` or `from`) — used by OpenAPI to know which dotted-path output keys nest. */
4033
- readonly lookupAliases: readonly string[]; /** Whether the aggregation requires a date range — surfaced in docs. */
4060
+ readonly groupBy?: string | readonly string[];
4061
+ /** Measure aliases keyed to their op-tag (e.g. `'count'`, `'sum:price'`). */
4062
+ readonly measures: Readonly<Record<string, string>>;
4063
+ /** Lookup alias names (`as` or `from`) — used by OpenAPI to know which dotted-path output keys nest. */
4064
+ readonly lookupAliases: readonly string[];
4065
+ /** Whether the aggregation requires a date range — surfaced in docs. */
4034
4066
  readonly requireDateRange?: {
4035
4067
  field: string;
4036
4068
  maxRangeDays?: number;
4037
- }; /** Whether the aggregation requires named filters — surfaced in docs. */
4069
+ };
4070
+ /** Whether the aggregation requires named filters — surfaced in docs. */
4038
4071
  readonly requireFilters?: readonly string[];
4039
4072
  /**
4040
4073
  * Static result-row cap (no URL override). Mutually exclusive with
@@ -4052,7 +4085,8 @@ interface RegistryEntry extends ResourceMetadata {
4052
4085
  * URL-driven limit ceiling (only meaningful with `defaultLimit`).
4053
4086
  * OpenAPI docs render this as the `maximum` constraint on `?limit`.
4054
4087
  */
4055
- readonly maxLimit?: number; /** MCP tool generation flag — `false` to skip, object for overrides. */
4088
+ readonly maxLimit?: number;
4089
+ /** MCP tool generation flag — `false` to skip, object for overrides. */
4056
4090
  readonly mcp?: boolean | {
4057
4091
  readonly description?: string;
4058
4092
  readonly annotations?: Record<string, unknown>;
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { $t as UserOrganization, A as RequestIdOptions, An as ArcCreateResult, At as AggregationMaterializedResult, B as defineResource, C as RequestContext, Ct as AggMeasureInput, D as HealthCheck, Dt as AggregationDateRangeRequirement, E as GracefulShutdownOptions, Et as AggregationConfig, F as FastifyWithDecorators, Fn as BaseControllerOptions, Ht as AuthPluginOptions, In as ControllerConfigurableOptions, J as CrudRouteKey, Jt as ApiResponse, L as RequestWithExtras, Ln as ControllerConstructionOptions, Mn as ArcGetResult, Mt as AggregationsMap, N as FastifyRequestExtras, Nn as ArcListResult, O as HealthOptions, Ot as AggregationIndexHint, P as FastifyWithAuth, Pn as ArcUpdateResult, Q as MiddlewareConfig, Rn as ListResult, S as QueryParserInterface, St as RouteHandler, T as CrudRouterOptions, Tt as AggregationCacheConfig, V as ResourceDefinition, X as EventDefinition, Xt as JWTPayload, Y as CrudSchemas, Yt as ArcRequest, Z as FieldRule, _t as ControllerLike, a as InferAdapterDoc, an as SlugExt, bt as IControllerResponse, c as TypedController, cn as BulkMixin, d as PaginationResult, en as BaseController, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, ht as RouteSchemaOptions, i as ValidationResult, in as TreeMixin, it as RateLimitConfig, jn as ArcDeleteResult, jt as AggregationRateLimit, k as IntrospectionPluginOptions, kt as AggregationMaterializedContext, l as TypedRepository, ln as BaseCrudController, m as RegistryStats, n as ConfigError, nn as SoftDeleteMixin, o as InferDocType, on as SlugMixin, p as RegistryEntry, q as CrudController, qt as AnyRecord, r as ValidateOptions, rn as TreeExt, rt as PresetResult, s as InferResourceDoc, sn as BulkExt, st as ResourceConfig, t as RouteHandlerMethod, tn as SoftDeleteExt, tt as PresetFunction, u as TypedResourceConfig, w as ServiceContext, wt as AggMeasureShorthand, xt as IRequestContext, y as OwnershipCheck, yt as IController } from "./index-_--GyzcO.mjs";
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-C7ahdGYf.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-DUa8WHz3.mjs";
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-CdFkIMEd.mjs";
5
- import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-DOHkjQlD.mjs";
6
-
1
+ import { $t as UserOrganization, A as RequestIdOptions, An as ArcCreateResult, At as AggregationMaterializedResult, B as defineResource, C as RequestContext, Ct as AggMeasureInput, D as HealthCheck, Dt as AggregationDateRangeRequirement, E as GracefulShutdownOptions, Et as AggregationConfig, F as FastifyWithDecorators, Fn as BaseControllerOptions, Ht as AuthPluginOptions, In as ControllerConfigurableOptions, J as CrudRouteKey, Jt as ApiResponse, L as RequestWithExtras, Ln as ControllerConstructionOptions, Mn as ArcGetResult, Mt as AggregationsMap, N as FastifyRequestExtras, Nn as ArcListResult, O as HealthOptions, Ot as AggregationIndexHint, P as FastifyWithAuth, Pn as ArcUpdateResult, Q as MiddlewareConfig, Rn as ListResult, S as QueryParserInterface, St as RouteHandler, T as CrudRouterOptions, Tt as AggregationCacheConfig, V as ResourceDefinition, X as EventDefinition, Xt as JWTPayload, Y as CrudSchemas, Yt as ArcRequest, Z as FieldRule, _t as ControllerLike, a as InferAdapterDoc, an as SlugExt, bt as IControllerResponse, c as TypedController, cn as BulkMixin, d as PaginationResult, en as BaseController, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, ht as RouteSchemaOptions, i as ValidationResult, in as TreeMixin, it as RateLimitConfig, jn as ArcDeleteResult, jt as AggregationRateLimit, k as IntrospectionPluginOptions, kt as AggregationMaterializedContext, l as TypedRepository, ln as BaseCrudController, m as RegistryStats, n as ConfigError, nn as SoftDeleteMixin, o as InferDocType, on as SlugMixin, p as RegistryEntry, q as CrudController, qt as AnyRecord, r as ValidateOptions, rn as TreeExt, rt as PresetResult, s as InferResourceDoc, sn as BulkExt, st as ResourceConfig, t as RouteHandlerMethod, tn as SoftDeleteExt, tt as PresetFunction, u as TypedResourceConfig, w as ServiceContext, wt as AggMeasureShorthand, xt as IRequestContext, y as OwnershipCheck, yt as IController } from "./index-Dtrj6XZk.mjs";
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-BGqrAa_u.mjs";
3
+ import "./fastify-augmentation-DafigGQp.mjs";
4
+ import { A as HOOK_OPERATIONS, B as SYSTEM_FIELDS, C as CrudOperation, D as DEFAULT_SORT, E as DEFAULT_MAX_LIMIT, F as MAX_REGEX_LENGTH, I as MAX_SEARCH_LENGTH, L as MUTATION_OPERATIONS, M as HookOperation, N as HookPhase, O as DEFAULT_TENANT_FIELD, P as MAX_FILTER_DEPTH, R as MutationOperation, S as CRUD_OPERATIONS, T as DEFAULT_LIMIT, f as defineResourceVariants, g as mergeResourceConfig, h as SeamedResourceConfig, j as HOOK_PHASES, k as DEFAULT_UPDATE_METHOD, m as ResourceSeams, p as AdapterLike, s as getControllerScope, v as defineAction, w as DEFAULT_ID_FIELD, x as defineAggregation, z as RESERVED_QUERY_PARAMS } from "./index-B5N-NaHs.mjs";
5
+ import { A as requireOwnership, C as createOrgPermissions, D as denyAll, E as anyOf, N as when, S as createDynamicPermissionMatrix, T as allowPublic, b as DynamicPermissionMatrixConfig, c as publicReadAdminWrite, d as requireOrgMembership, f as requireOrgRole, h as requireTeamMembership, i as ownerWithAdminBypass, j as requireRoles, k as requireAuth, l as readOnly, m as requireServiceScope, n as authenticated, o as presets_d_exports, p as requireScopeContext, r as fullPublic, s as publicRead, t as adminOnly, u as requireOrgInScope, w as allOf, y as DynamicPermissionMatrix } from "./index-B5PoNbfu.mjs";
6
+ import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-DHcHVAgk.mjs";
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 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, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
10
+ export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type 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 ResourceSeams, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
package/dist/index.mjs CHANGED
@@ -1,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-DNre0wRg.mjs";
2
2
  import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-DkO8Nk6-.mjs";
3
- import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-D-MHZ27_.mjs";
4
- import { C as requireAuth, D as when, F as applyFieldWritePermissions, I as fields, P as applyFieldReadPermissions, 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, 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-CgbOLJZG.mjs";
5
- import { a as defineResource, i as defineResourceVariants, o as ResourceDefinition, s as defineAction, u as defineAggregation } from "./core-CWhyGkiM.mjs";
6
- import { l as getControllerScope } from "./actionPermissions-C9RMiIpc.mjs";
3
+ import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-BnLYgE9A.mjs";
4
+ import { E as requireRoles, F as applyFieldReadPermissions, I as applyFieldWritePermissions, L as fields, O as when, S as denyAll, T as requireOwnership, _ as requireServiceScope, b as allowPublic, c as publicReadAdminWrite, d as createDynamicPermissionMatrix, f as createOrgPermissions, g as requireScopeContext, h as requireOrgRole, i as ownerWithAdminBypass, l as readOnly, m as requireOrgMembership, n as authenticated, o as presets_exports, p as requireOrgInScope, r as fullPublic, s as publicRead, t as adminOnly, v as requireTeamMembership, w as requireAuth, x as anyOf, y as allOf } from "./permissions-BJMuKMl7.mjs";
5
+ import { a as mergeResourceConfig, c as defineAction, d as defineAggregation, i as defineResourceVariants, o as defineResource, s as ResourceDefinition } from "./core-DZ6Xe1jR.mjs";
6
+ import { l as getControllerScope } from "./actionPermissions-ze70xXJi.mjs";
7
7
  //#region src/index.ts
8
- const version = "2.20.0";
8
+ const version = "2.21.0";
9
9
  //#endregion
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 };
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, mergeResourceConfig, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };