@web-ts-toolkit/access-router 0.42.2 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms.txt CHANGED
@@ -88,6 +88,9 @@ void [typed, conservative];
88
88
  - `/advanced` does NOT export `acl`, `defaultRuntime`, `createRouter`, or `createAccessRuntime` — those live on the root entry only
89
89
  - `/processors` `copyAndDepopulate(...)` defaults to conservative `CopyAndDepopulateOutput`; pass an explicit output type when the transformed shape is known. Unsafe paths and missing id fields throw plain `Error` instances.
90
90
  - `createDataRouter(...)` holds data in-memory; use it for lightweight/non-persisted resources
91
+ - ACL filter value `false` is a terminal denial. Trusted `overrideFilter` hooks may replace ordinary filters before base-filter composition, but are not called for an existing denial; returning `false` also denies the query.
92
+ - Shared-request cross-runtime composition keeps independent state: runtime B never reuses runtime A's permissions or base-filter cache, even with the same `requestPermissionField` name. Same-runtime middleware repeats reuse state without rerunning `globalPermissions`. Pre-populated request permission fields are application-supplied and preserved.
93
+ - Advanced mutation routes persist the final parsed body: nested `data` validators run before the whole-body (`default`) validator, and only final `data`/`select`/`populate`/`tasks` plus allowed `options` (`includePermissions`/`populateAccess`, plus `returningAll` for update/upsert) reach the service. Missing body options fall back to `returning_all`/`include_permissions` query params.
91
94
  - `package.json` declares `sideEffects` array listing the bundled runtime entries that run the lazy `mongoose-schema-jsonschema` patch on first runtime construction — bundlers must retain those entries
92
95
 
93
96
  ## Pointers
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@web-ts-toolkit/access-router",
3
3
  "description": "ACL-aware Express routers and in-memory data services for Mongoose-backed APIs",
4
4
  "homepage": "https://web-ts-toolkit.pages.dev/docs/packages/access-router",
5
- "version": "0.42.2",
5
+ "version": "0.44.0",
6
6
  "sideEffects": [
7
7
  "./**/index.js",
8
8
  "./**/index.mjs",
@@ -23,19 +23,31 @@
23
23
  "types": "./index.d.ts",
24
24
  "exports": {
25
25
  ".": {
26
- "types": "./index.d.ts",
26
+ "types": {
27
+ "import": "./index.d.mts",
28
+ "require": "./index.d.ts",
29
+ "default": "./index.d.ts"
30
+ },
27
31
  "import": "./index.mjs",
28
32
  "require": "./index.js",
29
33
  "default": "./index.js"
30
34
  },
31
35
  "./advanced": {
32
- "types": "./advanced.d.ts",
36
+ "types": {
37
+ "import": "./advanced.d.mts",
38
+ "require": "./advanced.d.ts",
39
+ "default": "./advanced.d.ts"
40
+ },
33
41
  "import": "./advanced.mjs",
34
42
  "require": "./advanced.js",
35
43
  "default": "./advanced.js"
36
44
  },
37
45
  "./processors": {
38
- "types": "./processors.d.ts",
46
+ "types": {
47
+ "import": "./processors.d.mts",
48
+ "require": "./processors.d.ts",
49
+ "default": "./processors.d.ts"
50
+ },
39
51
  "import": "./processors.mjs",
40
52
  "require": "./processors.js",
41
53
  "default": "./processors.js"
@@ -45,8 +57,8 @@
45
57
  "node": ">=22"
46
58
  },
47
59
  "dependencies": {
48
- "@web-ts-toolkit/express-json-router": "0.42.2",
49
- "@web-ts-toolkit/utils": "0.42.2",
60
+ "@web-ts-toolkit/express-json-router": "0.44.0",
61
+ "@web-ts-toolkit/utils": "0.44.0",
50
62
  "just-diff": "^6.0.2",
51
63
  "mongoose-schema-jsonschema": "^4.0.1",
52
64
  "sift": "^17.1.3",
@@ -196,7 +196,9 @@ type StandardSchemaV1<Input = unknown, Output = Input> = {
196
196
  type StandardSchemaInferOutput<TSchema extends StandardSchemaV1> = NonNullable<TSchema['~standard']['types']>['output'];
197
197
  type RequestSchemaLike<T = unknown> = RequestSchemaValidator<T> | RequestSchemaAdapter<T> | StandardSchemaV1;
198
198
  type YupValidationErrorLike = {
199
+ name: 'ValidationError';
199
200
  message: string;
201
+ errors: ReadonlyArray<string>;
200
202
  path?: string;
201
203
  inner?: ReadonlyArray<YupValidationErrorLike>;
202
204
  };
@@ -234,9 +236,13 @@ type AjvErrorObjectLike = {
234
236
  missingProperty?: string;
235
237
  };
236
238
  };
239
+ type AjvValidationErrorLike = {
240
+ errors?: ReadonlyArray<AjvErrorObjectLike> | null;
241
+ };
237
242
  type AjvValidatorLike<T = unknown> = {
238
- (value: unknown): boolean | Promise<boolean>;
243
+ (value: unknown): boolean | Promise<T | boolean>;
239
244
  errors?: ReadonlyArray<AjvErrorObjectLike> | null;
245
+ $async?: boolean;
240
246
  };
241
247
  type ValibotPathItemLike = {
242
248
  key?: unknown;
@@ -264,10 +270,13 @@ type ArkTypeProblemLike = {
264
270
  };
265
271
  type ArkTypeErrorsLike = ReadonlyArray<ArkTypeProblemLike> & {
266
272
  summary?: string;
273
+ readonly arkKind?: string;
274
+ readonly ' arkKind'?: string;
267
275
  };
268
276
  type ArkTypeLike<T = unknown> = {
269
- (value: unknown): T | ArkTypeErrorsLike;
277
+ (value: unknown): T | ArkTypeErrorsLike | Promise<T | ArkTypeErrorsLike>;
270
278
  errors?: unknown;
279
+ readonly '~standard'?: StandardSchemaV1['~standard'];
271
280
  };
272
281
  type IoTsContextEntryLike = {
273
282
  key: string;
@@ -299,6 +308,9 @@ type VineValidationMessageLike = {
299
308
  index?: number;
300
309
  };
301
310
  type VineValidationErrorLike = {
311
+ name?: string;
312
+ code?: string;
313
+ status?: number;
302
314
  messages: ReadonlyArray<VineValidationMessageLike>;
303
315
  };
304
316
  type VineValidatorLike<T = unknown> = {
@@ -526,6 +538,7 @@ type InternalModelHookContext = ModelHookContext & {
526
538
  declare class Core {
527
539
  private req;
528
540
  private caches;
541
+ private cachedPermissions;
529
542
  constructor(req: AccessRouterBaseRequest);
530
543
  getIdentifier(modelName: string): string;
531
544
  genIDFilter<TModel = unknown>(modelName: string, id: string): Promise<Filter<TModel>>;
@@ -565,6 +578,7 @@ declare class Core {
565
578
  declare class DataCore {
566
579
  private req;
567
580
  private caches;
581
+ private cachedPermissions;
568
582
  constructor(req: AccessRouterBaseRequest);
569
583
  genIDFilter<TData = unknown>(dataName: string, id: string): Promise<Filter<TData>>;
570
584
  genFilter<TData = unknown>(dataName: string, access?: BaseFilterAccess, _filter?: Filter<TData>): Promise<Filter<TData>>;
@@ -789,10 +803,11 @@ type PopulateEntryShape<T, TPath extends string, TValue> = TPath extends `${infe
789
803
  type PopulateOutputShape<T, TPopulateEntry> = PopulatePath<TPopulateEntry> extends infer TPath extends string ? PopulateEntryShape<T, TPath, PopulateLeafValue<PathValue<WithDefaultId<T>, TPath>, TPopulateEntry>> : {};
790
804
  type PopulateOutput<T, TPopulate> = string extends PopulatePath<PopulateInputs<TPopulate>> ? {} : [PopulatePath<PopulateInputs<TPopulate>>] extends [never] ? {} : Simplify<UnionToIntersection<PopulateOutputShape<T, Extract<PopulateInputs<TPopulate>, PopulateInput>>>>;
791
805
  type SelectedPopulatedPublicOutput<T, TProjection, TPopulate> = Simplify<SelectedPublicOutput<T, TProjection> & PopulateOutput<T, TPopulate>>;
792
- type DeepFieldPath<T, Depth extends number = 4> = [Depth] extends [never] ? never : Descend<T> extends NonTraversable ? never : {
793
- [K in Extract<keyof Descend<T>, string>]: K | (Descend<T>[K] extends NonTraversable ? never : Descend<T>[K] extends readonly (infer U)[] ? U extends NonTraversable ? never : `${K}.${DeepFieldPath<U, PrevDepth[Depth]>}` : Descend<T>[K] extends object ? `${K}.${DeepFieldPath<Descend<T>[K], PrevDepth[Depth]>}` : never);
794
- }[Extract<keyof Descend<T>, string>];
795
- type PathValue<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends Extract<keyof Descend<T>, string> ? PathValue<Descend<Descend<T>[Head]>, Tail> : unknown : TPath extends Extract<keyof Descend<T>, string> ? Descend<T>[TPath] : unknown;
806
+ type Unwrap<T> = NonNullable<Descend<T>>;
807
+ type DeepFieldPath<T, Depth extends number = 4> = [Depth] extends [never] ? never : Unwrap<T> extends NonTraversable ? never : {
808
+ [K in Extract<keyof Unwrap<T>, string>]: K | (NonNullable<Unwrap<T>[K]> extends NonTraversable ? never : NonNullable<Unwrap<T>[K]> extends readonly (infer U)[] ? Unwrap<U> extends NonTraversable ? never : `${K}.${DeepFieldPath<U, PrevDepth[Depth]>}` : NonNullable<Unwrap<T>[K]> extends object ? `${K}.${DeepFieldPath<NonNullable<Unwrap<T>[K]>, PrevDepth[Depth]>}` : never);
809
+ }[Extract<keyof Unwrap<T>, string>];
810
+ type PathValue<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends Extract<keyof Unwrap<T>, string> ? PathValue<Unwrap<Unwrap<T>[Head]>, Tail> : unknown : TPath extends Extract<keyof Unwrap<T>, string> ? Unwrap<T>[TPath] : unknown;
796
811
  type FieldFilterOperators<T> = {
797
812
  $eq?: T;
798
813
  $ne?: T;
@@ -1402,24 +1417,24 @@ interface ExtendedModelRouterOptions<TModel = unknown> extends ModelRouterOption
1402
1417
  'overrideFilter.read'?: ModelOverrideFilterHook;
1403
1418
  'overrideFilter.update'?: ModelOverrideFilterHook;
1404
1419
  'overrideFilter.delete'?: ModelOverrideFilterHook;
1405
- 'decorate.default'?: ModelHook;
1406
- 'decorate.list'?: ModelHook;
1407
- 'decorate.create'?: ModelHook;
1408
- 'decorate.read'?: ModelHook;
1409
- 'decorate.update'?: ModelHook;
1410
- 'decorateAll.default'?: ModelListHook;
1411
- 'decorateAll.list'?: ModelListHook;
1420
+ 'decorate.default'?: ModelHook<TModel>;
1421
+ 'decorate.list'?: ModelHook<TModel>;
1422
+ 'decorate.create'?: ModelHook<TModel>;
1423
+ 'decorate.read'?: ModelHook<TModel>;
1424
+ 'decorate.update'?: ModelHook<TModel>;
1425
+ 'decorateAll.default'?: ModelListHook<TModel>;
1426
+ 'decorateAll.list'?: ModelListHook<TModel>;
1412
1427
  'validate.default'?: ValidateRule | ModelValidateHook;
1413
1428
  'validate.create'?: ValidateRule | ModelValidateHook;
1414
1429
  'validate.update'?: ValidateRule | ModelValidateHook;
1415
- 'prepare.default'?: ModelHook;
1416
- 'prepare.create'?: ModelHook;
1417
- 'prepare.update'?: ModelHook;
1418
- 'transform.default'?: ModelDocumentHook;
1419
- 'transform.update'?: ModelDocumentHook;
1420
- 'afterPersist.default'?: ModelDocumentHook;
1421
- 'afterPersist.create'?: ModelDocumentHook;
1422
- 'afterPersist.update'?: ModelDocumentHook;
1430
+ 'prepare.default'?: ModelHook<TModel>;
1431
+ 'prepare.create'?: ModelHook<TModel>;
1432
+ 'prepare.update'?: ModelHook<TModel>;
1433
+ 'transform.default'?: ModelDocumentHook<TModel>;
1434
+ 'transform.update'?: ModelDocumentHook<TModel>;
1435
+ 'afterPersist.default'?: ModelDocumentHook<TModel>;
1436
+ 'afterPersist.create'?: ModelDocumentHook<TModel>;
1437
+ 'afterPersist.update'?: ModelDocumentHook<TModel>;
1423
1438
  onChange?: Record<string, ModelChangeHook>;
1424
1439
  'requestSchemas.create'?: RequestSchema;
1425
1440
  'requestSchemas.update'?: RequestSchema;
@@ -1515,6 +1530,11 @@ declare function defineRequestSchema<T = unknown>(validator: RequestSchemaValida
1515
1530
  /**
1516
1531
  * Adapts a Zod schema into a `RequestSchemaValidator` for `access-router`.
1517
1532
  *
1533
+ * Supports both synchronous schemas and schemas with async refinements or
1534
+ * transforms via `safeParseAsync` when available. Synchronous schemas keep
1535
+ * their existing output values and issue paths. Operational exceptions thrown
1536
+ * by `safeParseAsync` itself propagate unchanged.
1537
+ *
1518
1538
  * @example
1519
1539
  * const validator = fromZod(z.object({ name: z.string() }));
1520
1540
  */
@@ -1522,11 +1542,37 @@ declare function fromZod<TSchema extends z.ZodTypeAny>(schema: TSchema): Request
1522
1542
  declare function fromStandardSchema<TSchema extends StandardSchemaV1>(schema: TSchema): RequestSchemaValidator<StandardSchemaInferOutput<TSchema>>;
1523
1543
  declare function fromYup<TSchema extends YupSchemaLike>(schema: TSchema): RequestSchemaValidator;
1524
1544
  declare function fromJoi<TSchema extends JoiSchemaLike>(schema: TSchema): RequestSchemaValidator;
1545
+ /**
1546
+ * Adapts an AJV validator into a `RequestSchemaValidator`.
1547
+ *
1548
+ * Contract: synchronous validators return a boolean and expose input-local
1549
+ * diagnostics via mutable `validator.errors`; those errors are snapshotted
1550
+ * synchronously before any suspension so concurrent same-turn validations do
1551
+ * not observe another input's diagnostics. Asynchronous AJV schemas
1552
+ * (`$async: true`) return a promise that resolves with validated data on
1553
+ * success or rejects with a `ValidationError` carrying an `errors` array on
1554
+ * failure; rejection-carried errors are normalized, while any other rejection
1555
+ * propagates unchanged as an operational exception.
1556
+ */
1525
1557
  declare function fromAjv<TValue = unknown>(validator: AjvValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1526
1558
  declare function fromValibot<TSchema, TOutput = unknown>(schema: TSchema, safeParse: ValibotSafeParseLike): RequestSchemaValidator<TOutput>;
1559
+ /**
1560
+ * Adapts an ArkType type into a `RequestSchemaValidator`.
1561
+ *
1562
+ * Success/failure is discriminated via the supported ArkErrors brand key
1563
+ * (`hasArkKind(result, "errors")`, stored at runtime as `' arkKind'` with a
1564
+ * leading space; the unspaced `arkKind` alias is also accepted) or, when the
1565
+ * type exposes a Standard Schema `~standard.validate` contract, via that
1566
+ * contract. ArkType's Standard Schema `validate` returns `{ value }` on
1567
+ * success but returns raw `ArkErrors` on failure instead of `{ issues }`, so
1568
+ * both shapes are handled. Array shape and `message`/`path`-like record
1569
+ * fields are never used as discriminators, so valid empty/scalar/record/
1570
+ * nullable arrays pass through unchanged. Unexpected exceptions thrown by the
1571
+ * type propagate unchanged.
1572
+ */
1527
1573
  declare function fromArkType<TValue = unknown>(type: ArkTypeLike<TValue>): RequestSchemaValidator<TValue>;
1528
1574
  declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): RequestSchemaValidator<TValue>;
1529
1575
  declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
1530
1576
  declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1531
1577
 
1532
- export { type Filter as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, DATA_MIDDLEWARE as D, type DataFindOneOptions as E, type DataFindOptions as F, type DataHook as G, type DataHookContext as H, type DataIdentifierHook as I, type DataListHook as J, type DataOverrideFilterHook as K, type DataRequest as L, type DataRequestSchemas as M, type DataRouterOptions as N, type DecorateAccess as O, type DecorateAllAccess as P, type DeepFieldPath as Q, type DefaultModelRouterOptions as R, type Defaults as S, type DistinctArgs as T, type DistinctBody as U, type DocPermissionsAccess as V, type ErrorResult as W, type ExistsOptions as X, type ExtendedDataRouterOptions as Y, type ExtendedDefaultModelRouterOptions as Z, type ExtendedModelRouterOptions as _, type AccessRouterFieldKey as a, type RequestSchemaFailure as a$, FilterOperator as a0, type FindAccess as a1, type FindArgs as a2, type FindByIdArgs as a3, type FindByIdOptions as a4, type FindOneArgs as a5, type FindOneOptions as a6, type FindOptions as a7, type GlobalOptions as a8, type GlobalPermissionValue as a9, type ModelValidateHook as aA, PERMISSIONS as aB, PERMISSION_KEYS as aC, type PathValue as aD, type PermissionSchema as aE, type Populate as aF, type PopulateAccess as aG, type PrepareAccess as aH, type Projection as aI, type PublicCreateArgs as aJ, type PublicCreateOptions as aK, type PublicErrorResult as aL, type PublicListArgs as aM, type PublicListOptions as aN, type PublicListResult as aO, type PublicOutput as aP, type PublicReadArgs as aQ, type PublicReadOptions as aR, type PublicServiceResult as aS, type PublicSingleResult as aT, type PublicUpdateArgs as aU, type PublicUpdateOptions as aV, type PublicUpsertArgs as aW, type PublicUpsertOptions as aX, type ReadQueryInput as aY, type Request as aZ, type RequestSchemaAdapter as a_, type GuardHook as aa, type IdentifierHook as ab, type Include as ac, type IoTsContextEntryLike as ad, type IoTsDecodeErrorLike as ae, type IoTsDecoderLike as af, type JoiSchemaLike as ag, type JoiValidationErrorDetailLike as ah, type KeyValueProjection as ai, type ListQueryInput as aj, type ListResult as ak, MIDDLEWARE as al, type MaybePromise as am, type ModelBaseFilterHook as an, type ModelChangeHook as ao, type ModelDeleteHook as ap, type ModelDocPermissionsHook as aq, type ModelDocument as ar, type ModelDocumentHook as as, type ModelHook as at, type ModelHookContext as au, type ModelIdentifierHook as av, type ModelListHook as aw, type ModelOverrideFilterHook as ax, type ModelRequest as ay, type ModelRouterOptions as az, type AccessRouterLogger as b, type SubdocumentRecord as b$, type RequestSchemaIssue as b0, type RequestSchemaLike as b1, type RequestSchemaOptions as b2, type RequestSchemaResult as b3, type RequestSchemaSuccess as b4, type RequestSchemaValidator as b5, type RequestSchemas as b6, type RootDataListQueryEntry as b7, type RootDataOperation as b8, type RootDataReadByFilterQueryEntry as b9, type SelectedPublicOutput as bA, type ServiceResult as bB, type SingleResult as bC, type Sort as bD, type SortOrder as bE, type StandardSchemaFailure as bF, type StandardSchemaInferOutput as bG, type StandardSchemaIssue as bH, type StandardSchemaPathSegment as bI, type StandardSchemaResult as bJ, type StandardSchemaSuccess as bK, type StandardSchemaV1 as bL, StatusCodes as bM, type SubListBody as bN, type SubPopulate as bO, type SubQueryEntry as bP, type SubReadBody as bQ, type SubdocumentBulkRecord as bR, type SubdocumentBulkUpdateInput as bS, type SubdocumentCreateInput as bT, type SubdocumentCreateOptions as bU, type SubdocumentId as bV, type SubdocumentListOptions as bW, type SubdocumentName as bX, type SubdocumentParentArgs as bY, type SubdocumentParentOptions as bZ, type SubdocumentReadOptions as b_, type RootDataReadByIdQueryEntry as ba, type RootModelCountQueryEntry as bb, type RootModelCreateQueryEntry as bc, type RootModelDeleteQueryEntry as bd, type RootModelDistinctQueryEntry as be, type RootModelListQueryEntry as bf, type RootModelNewQueryEntry as bg, type RootModelOperation as bh, type RootModelReadByFilterQueryEntry as bi, type RootModelReadByIdQueryEntry as bj, type RootModelSubBulkUpdateQueryEntry as bk, type RootModelSubCreateQueryEntry as bl, type RootModelSubDeleteQueryEntry as bm, type RootModelSubListQueryEntry as bn, type RootModelSubReadQueryEntry as bo, type RootModelSubUpdateQueryEntry as bp, type RootModelUpdateQueryEntry as bq, type RootModelUpsertQueryEntry as br, type RootOperationResult as bs, type RootQueryEntry as bt, type RootRouterOptions as bu, type RootSubOperation as bv, type RootTarget as bw, type RouteGuardAccess as bx, type SelectAccess as by, type SelectedPopulatedPublicOutput as bz, type AccessRouterRequest as c, type SuperstructFailureLike as c0, type SuperstructValidateLike as c1, type Task as c2, type TransformAccess as c3, type TypedFilter as c4, type UpdateByIdArgs as c5, type UpdateByIdOptions as c6, type UpdateOneArgs as c7, type UpdateOneOptions as c8, type UpdateQueryInput as c9, fromZod as cA, parseBody as cB, parseBodyWithSchema as cC, parseNestedBodyWithSchema as cD, parsePathParam as cE, parseQuery as cF, DataService as cG, Service as cH, PublicService as cI, type AccessRouterPermissionMap as cJ, type AccessRouterPermissions as cK, type Permissions as cL, type UpsertArgs as ca, type UpsertOptions as cb, type UpsertQueryInput as cc, type ValibotIssueLike as cd, type ValibotPathItemLike as ce, type ValibotSafeParseLike as cf, type ValibotSafeParseResult as cg, type ValidateAccess as ch, type ValidateRule as ci, type Validation as cj, type ValidationError as ck, type VineValidationErrorLike as cl, type VineValidationMessageLike as cm, type VineValidatorLike as cn, type YupSchemaLike as co, type YupValidationErrorLike as cp, defineRequestSchema as cq, fromAjv as cr, fromArkType as cs, fromIoTs as ct, fromJoi as cu, fromStandardSchema as cv, fromSuperstruct as cw, fromValibot as cx, fromVine as cy, fromYup as cz, type AccessRouterRequestExtensions as d, type AdvancedCreateBody as e, type AdvancedListBody as f, type AdvancedReadBody as g, type AdvancedReadFilterBody as h, type AdvancedUpdateBody as i, type AdvancedUpsertBody as j, type AfterPersistAccess as k, type AjvErrorObjectLike as l, type AjvValidatorLike as m, type ArkTypeErrorsLike as n, type ArkTypeLike as o, type ArkTypeProblemLike as p, Codes as q, type CountBody as r, type CreateArgs as s, type CreateOptions as t, type CreateQueryInput as u, CustomHeaders as v, type DataBaseFilterHook as w, type DataFilter as x, type DataFindArgs as y, type DataFindOneArgs as z };
1578
+ export { type ExtendedModelRouterOptions as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, DATA_MIDDLEWARE as D, type DataFindOneArgs as E, type DataFindOneOptions as F, type DataFindOptions as G, type DataHook as H, type DataHookContext as I, type DataIdentifierHook as J, type DataListHook as K, type DataOverrideFilterHook as L, type DataRequest as M, type DataRequestSchemas as N, type DataRouterOptions as O, type DecorateAccess as P, type DecorateAllAccess as Q, type DeepFieldPath as R, type DefaultModelRouterOptions as S, type Defaults as T, type DistinctArgs as U, type DistinctBody as V, type DocPermissionsAccess as W, type ErrorResult as X, type ExistsOptions as Y, type ExtendedDataRouterOptions as Z, type ExtendedDefaultModelRouterOptions as _, type AccessRouterFieldKey as a, type RequestSchemaAdapter as a$, type Filter as a0, FilterOperator as a1, type FindAccess as a2, type FindArgs as a3, type FindByIdArgs as a4, type FindByIdOptions as a5, type FindOneArgs as a6, type FindOneOptions as a7, type FindOptions as a8, type GlobalOptions as a9, type ModelRouterOptions as aA, type ModelValidateHook as aB, PERMISSIONS as aC, PERMISSION_KEYS as aD, type PathValue as aE, type PermissionSchema as aF, type Populate as aG, type PopulateAccess as aH, type PrepareAccess as aI, type Projection as aJ, type PublicCreateArgs as aK, type PublicCreateOptions as aL, type PublicErrorResult as aM, type PublicListArgs as aN, type PublicListOptions as aO, type PublicListResult as aP, type PublicOutput as aQ, type PublicReadArgs as aR, type PublicReadOptions as aS, type PublicServiceResult as aT, type PublicSingleResult as aU, type PublicUpdateArgs as aV, type PublicUpdateOptions as aW, type PublicUpsertArgs as aX, type PublicUpsertOptions as aY, type ReadQueryInput as aZ, type Request as a_, type GlobalPermissionValue as aa, type GuardHook as ab, type IdentifierHook as ac, type Include as ad, type IoTsContextEntryLike as ae, type IoTsDecodeErrorLike as af, type IoTsDecoderLike as ag, type JoiSchemaLike as ah, type JoiValidationErrorDetailLike as ai, type KeyValueProjection as aj, type ListQueryInput as ak, type ListResult as al, MIDDLEWARE as am, type MaybePromise as an, type ModelBaseFilterHook as ao, type ModelChangeHook as ap, type ModelDeleteHook as aq, type ModelDocPermissionsHook as ar, type ModelDocument as as, type ModelDocumentHook as at, type ModelHook as au, type ModelHookContext as av, type ModelIdentifierHook as aw, type ModelListHook as ax, type ModelOverrideFilterHook as ay, type ModelRequest as az, type AccessRouterLogger as b, type SubdocumentReadOptions as b$, type RequestSchemaFailure as b0, type RequestSchemaIssue as b1, type RequestSchemaLike as b2, type RequestSchemaOptions as b3, type RequestSchemaResult as b4, type RequestSchemaSuccess as b5, type RequestSchemaValidator as b6, type RequestSchemas as b7, type RootDataListQueryEntry as b8, type RootDataOperation as b9, type SelectedPopulatedPublicOutput as bA, type SelectedPublicOutput as bB, type ServiceResult as bC, type SingleResult as bD, type Sort as bE, type SortOrder as bF, type StandardSchemaFailure as bG, type StandardSchemaInferOutput as bH, type StandardSchemaIssue as bI, type StandardSchemaPathSegment as bJ, type StandardSchemaResult as bK, type StandardSchemaSuccess as bL, type StandardSchemaV1 as bM, StatusCodes as bN, type SubListBody as bO, type SubPopulate as bP, type SubQueryEntry as bQ, type SubReadBody as bR, type SubdocumentBulkRecord as bS, type SubdocumentBulkUpdateInput as bT, type SubdocumentCreateInput as bU, type SubdocumentCreateOptions as bV, type SubdocumentId as bW, type SubdocumentListOptions as bX, type SubdocumentName as bY, type SubdocumentParentArgs as bZ, type SubdocumentParentOptions as b_, type RootDataReadByFilterQueryEntry as ba, type RootDataReadByIdQueryEntry as bb, type RootModelCountQueryEntry as bc, type RootModelCreateQueryEntry as bd, type RootModelDeleteQueryEntry as be, type RootModelDistinctQueryEntry as bf, type RootModelListQueryEntry as bg, type RootModelNewQueryEntry as bh, type RootModelOperation as bi, type RootModelReadByFilterQueryEntry as bj, type RootModelReadByIdQueryEntry as bk, type RootModelSubBulkUpdateQueryEntry as bl, type RootModelSubCreateQueryEntry as bm, type RootModelSubDeleteQueryEntry as bn, type RootModelSubListQueryEntry as bo, type RootModelSubReadQueryEntry as bp, type RootModelSubUpdateQueryEntry as bq, type RootModelUpdateQueryEntry as br, type RootModelUpsertQueryEntry as bs, type RootOperationResult as bt, type RootQueryEntry as bu, type RootRouterOptions as bv, type RootSubOperation as bw, type RootTarget as bx, type RouteGuardAccess as by, type SelectAccess as bz, type AccessRouterRequest as c, type SubdocumentRecord as c0, type SuperstructFailureLike as c1, type SuperstructValidateLike as c2, type Task as c3, type TransformAccess as c4, type TypedFilter as c5, type UpdateByIdArgs as c6, type UpdateByIdOptions as c7, type UpdateOneArgs as c8, type UpdateOneOptions as c9, fromYup as cA, fromZod as cB, parseBody as cC, parseBodyWithSchema as cD, parseNestedBodyWithSchema as cE, parsePathParam as cF, parseQuery as cG, DataService as cH, Service as cI, PublicService as cJ, type AccessRouterPermissionMap as cK, type AccessRouterPermissions as cL, type Permissions as cM, type UpdateQueryInput as ca, type UpsertArgs as cb, type UpsertOptions as cc, type UpsertQueryInput as cd, type ValibotIssueLike as ce, type ValibotPathItemLike as cf, type ValibotSafeParseLike as cg, type ValibotSafeParseResult as ch, type ValidateAccess as ci, type ValidateRule as cj, type Validation as ck, type ValidationError as cl, type VineValidationErrorLike as cm, type VineValidationMessageLike as cn, type VineValidatorLike as co, type YupSchemaLike as cp, type YupValidationErrorLike as cq, defineRequestSchema as cr, fromAjv as cs, fromArkType as ct, fromIoTs as cu, fromJoi as cv, fromStandardSchema as cw, fromSuperstruct as cx, fromValibot as cy, fromVine as cz, type AccessRouterRequestExtensions as d, type AdvancedCreateBody as e, type AdvancedListBody as f, type AdvancedReadBody as g, type AdvancedReadFilterBody as h, type AdvancedUpdateBody as i, type AdvancedUpsertBody as j, type AfterPersistAccess as k, type AjvErrorObjectLike as l, type AjvValidationErrorLike as m, type AjvValidatorLike as n, type ArkTypeErrorsLike as o, type ArkTypeLike as p, type ArkTypeProblemLike as q, Codes as r, type CountBody as s, type CreateArgs as t, type CreateOptions as u, type CreateQueryInput as v, CustomHeaders as w, type DataBaseFilterHook as x, type DataFilter as y, type DataFindArgs as z };
@@ -196,7 +196,9 @@ type StandardSchemaV1<Input = unknown, Output = Input> = {
196
196
  type StandardSchemaInferOutput<TSchema extends StandardSchemaV1> = NonNullable<TSchema['~standard']['types']>['output'];
197
197
  type RequestSchemaLike<T = unknown> = RequestSchemaValidator<T> | RequestSchemaAdapter<T> | StandardSchemaV1;
198
198
  type YupValidationErrorLike = {
199
+ name: 'ValidationError';
199
200
  message: string;
201
+ errors: ReadonlyArray<string>;
200
202
  path?: string;
201
203
  inner?: ReadonlyArray<YupValidationErrorLike>;
202
204
  };
@@ -234,9 +236,13 @@ type AjvErrorObjectLike = {
234
236
  missingProperty?: string;
235
237
  };
236
238
  };
239
+ type AjvValidationErrorLike = {
240
+ errors?: ReadonlyArray<AjvErrorObjectLike> | null;
241
+ };
237
242
  type AjvValidatorLike<T = unknown> = {
238
- (value: unknown): boolean | Promise<boolean>;
243
+ (value: unknown): boolean | Promise<T | boolean>;
239
244
  errors?: ReadonlyArray<AjvErrorObjectLike> | null;
245
+ $async?: boolean;
240
246
  };
241
247
  type ValibotPathItemLike = {
242
248
  key?: unknown;
@@ -264,10 +270,13 @@ type ArkTypeProblemLike = {
264
270
  };
265
271
  type ArkTypeErrorsLike = ReadonlyArray<ArkTypeProblemLike> & {
266
272
  summary?: string;
273
+ readonly arkKind?: string;
274
+ readonly ' arkKind'?: string;
267
275
  };
268
276
  type ArkTypeLike<T = unknown> = {
269
- (value: unknown): T | ArkTypeErrorsLike;
277
+ (value: unknown): T | ArkTypeErrorsLike | Promise<T | ArkTypeErrorsLike>;
270
278
  errors?: unknown;
279
+ readonly '~standard'?: StandardSchemaV1['~standard'];
271
280
  };
272
281
  type IoTsContextEntryLike = {
273
282
  key: string;
@@ -299,6 +308,9 @@ type VineValidationMessageLike = {
299
308
  index?: number;
300
309
  };
301
310
  type VineValidationErrorLike = {
311
+ name?: string;
312
+ code?: string;
313
+ status?: number;
302
314
  messages: ReadonlyArray<VineValidationMessageLike>;
303
315
  };
304
316
  type VineValidatorLike<T = unknown> = {
@@ -526,6 +538,7 @@ type InternalModelHookContext = ModelHookContext & {
526
538
  declare class Core {
527
539
  private req;
528
540
  private caches;
541
+ private cachedPermissions;
529
542
  constructor(req: AccessRouterBaseRequest);
530
543
  getIdentifier(modelName: string): string;
531
544
  genIDFilter<TModel = unknown>(modelName: string, id: string): Promise<Filter<TModel>>;
@@ -565,6 +578,7 @@ declare class Core {
565
578
  declare class DataCore {
566
579
  private req;
567
580
  private caches;
581
+ private cachedPermissions;
568
582
  constructor(req: AccessRouterBaseRequest);
569
583
  genIDFilter<TData = unknown>(dataName: string, id: string): Promise<Filter<TData>>;
570
584
  genFilter<TData = unknown>(dataName: string, access?: BaseFilterAccess, _filter?: Filter<TData>): Promise<Filter<TData>>;
@@ -789,10 +803,11 @@ type PopulateEntryShape<T, TPath extends string, TValue> = TPath extends `${infe
789
803
  type PopulateOutputShape<T, TPopulateEntry> = PopulatePath<TPopulateEntry> extends infer TPath extends string ? PopulateEntryShape<T, TPath, PopulateLeafValue<PathValue<WithDefaultId<T>, TPath>, TPopulateEntry>> : {};
790
804
  type PopulateOutput<T, TPopulate> = string extends PopulatePath<PopulateInputs<TPopulate>> ? {} : [PopulatePath<PopulateInputs<TPopulate>>] extends [never] ? {} : Simplify<UnionToIntersection<PopulateOutputShape<T, Extract<PopulateInputs<TPopulate>, PopulateInput>>>>;
791
805
  type SelectedPopulatedPublicOutput<T, TProjection, TPopulate> = Simplify<SelectedPublicOutput<T, TProjection> & PopulateOutput<T, TPopulate>>;
792
- type DeepFieldPath<T, Depth extends number = 4> = [Depth] extends [never] ? never : Descend<T> extends NonTraversable ? never : {
793
- [K in Extract<keyof Descend<T>, string>]: K | (Descend<T>[K] extends NonTraversable ? never : Descend<T>[K] extends readonly (infer U)[] ? U extends NonTraversable ? never : `${K}.${DeepFieldPath<U, PrevDepth[Depth]>}` : Descend<T>[K] extends object ? `${K}.${DeepFieldPath<Descend<T>[K], PrevDepth[Depth]>}` : never);
794
- }[Extract<keyof Descend<T>, string>];
795
- type PathValue<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends Extract<keyof Descend<T>, string> ? PathValue<Descend<Descend<T>[Head]>, Tail> : unknown : TPath extends Extract<keyof Descend<T>, string> ? Descend<T>[TPath] : unknown;
806
+ type Unwrap<T> = NonNullable<Descend<T>>;
807
+ type DeepFieldPath<T, Depth extends number = 4> = [Depth] extends [never] ? never : Unwrap<T> extends NonTraversable ? never : {
808
+ [K in Extract<keyof Unwrap<T>, string>]: K | (NonNullable<Unwrap<T>[K]> extends NonTraversable ? never : NonNullable<Unwrap<T>[K]> extends readonly (infer U)[] ? Unwrap<U> extends NonTraversable ? never : `${K}.${DeepFieldPath<U, PrevDepth[Depth]>}` : NonNullable<Unwrap<T>[K]> extends object ? `${K}.${DeepFieldPath<NonNullable<Unwrap<T>[K]>, PrevDepth[Depth]>}` : never);
809
+ }[Extract<keyof Unwrap<T>, string>];
810
+ type PathValue<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends Extract<keyof Unwrap<T>, string> ? PathValue<Unwrap<Unwrap<T>[Head]>, Tail> : unknown : TPath extends Extract<keyof Unwrap<T>, string> ? Unwrap<T>[TPath] : unknown;
796
811
  type FieldFilterOperators<T> = {
797
812
  $eq?: T;
798
813
  $ne?: T;
@@ -1402,24 +1417,24 @@ interface ExtendedModelRouterOptions<TModel = unknown> extends ModelRouterOption
1402
1417
  'overrideFilter.read'?: ModelOverrideFilterHook;
1403
1418
  'overrideFilter.update'?: ModelOverrideFilterHook;
1404
1419
  'overrideFilter.delete'?: ModelOverrideFilterHook;
1405
- 'decorate.default'?: ModelHook;
1406
- 'decorate.list'?: ModelHook;
1407
- 'decorate.create'?: ModelHook;
1408
- 'decorate.read'?: ModelHook;
1409
- 'decorate.update'?: ModelHook;
1410
- 'decorateAll.default'?: ModelListHook;
1411
- 'decorateAll.list'?: ModelListHook;
1420
+ 'decorate.default'?: ModelHook<TModel>;
1421
+ 'decorate.list'?: ModelHook<TModel>;
1422
+ 'decorate.create'?: ModelHook<TModel>;
1423
+ 'decorate.read'?: ModelHook<TModel>;
1424
+ 'decorate.update'?: ModelHook<TModel>;
1425
+ 'decorateAll.default'?: ModelListHook<TModel>;
1426
+ 'decorateAll.list'?: ModelListHook<TModel>;
1412
1427
  'validate.default'?: ValidateRule | ModelValidateHook;
1413
1428
  'validate.create'?: ValidateRule | ModelValidateHook;
1414
1429
  'validate.update'?: ValidateRule | ModelValidateHook;
1415
- 'prepare.default'?: ModelHook;
1416
- 'prepare.create'?: ModelHook;
1417
- 'prepare.update'?: ModelHook;
1418
- 'transform.default'?: ModelDocumentHook;
1419
- 'transform.update'?: ModelDocumentHook;
1420
- 'afterPersist.default'?: ModelDocumentHook;
1421
- 'afterPersist.create'?: ModelDocumentHook;
1422
- 'afterPersist.update'?: ModelDocumentHook;
1430
+ 'prepare.default'?: ModelHook<TModel>;
1431
+ 'prepare.create'?: ModelHook<TModel>;
1432
+ 'prepare.update'?: ModelHook<TModel>;
1433
+ 'transform.default'?: ModelDocumentHook<TModel>;
1434
+ 'transform.update'?: ModelDocumentHook<TModel>;
1435
+ 'afterPersist.default'?: ModelDocumentHook<TModel>;
1436
+ 'afterPersist.create'?: ModelDocumentHook<TModel>;
1437
+ 'afterPersist.update'?: ModelDocumentHook<TModel>;
1423
1438
  onChange?: Record<string, ModelChangeHook>;
1424
1439
  'requestSchemas.create'?: RequestSchema;
1425
1440
  'requestSchemas.update'?: RequestSchema;
@@ -1515,6 +1530,11 @@ declare function defineRequestSchema<T = unknown>(validator: RequestSchemaValida
1515
1530
  /**
1516
1531
  * Adapts a Zod schema into a `RequestSchemaValidator` for `access-router`.
1517
1532
  *
1533
+ * Supports both synchronous schemas and schemas with async refinements or
1534
+ * transforms via `safeParseAsync` when available. Synchronous schemas keep
1535
+ * their existing output values and issue paths. Operational exceptions thrown
1536
+ * by `safeParseAsync` itself propagate unchanged.
1537
+ *
1518
1538
  * @example
1519
1539
  * const validator = fromZod(z.object({ name: z.string() }));
1520
1540
  */
@@ -1522,11 +1542,37 @@ declare function fromZod<TSchema extends z.ZodTypeAny>(schema: TSchema): Request
1522
1542
  declare function fromStandardSchema<TSchema extends StandardSchemaV1>(schema: TSchema): RequestSchemaValidator<StandardSchemaInferOutput<TSchema>>;
1523
1543
  declare function fromYup<TSchema extends YupSchemaLike>(schema: TSchema): RequestSchemaValidator;
1524
1544
  declare function fromJoi<TSchema extends JoiSchemaLike>(schema: TSchema): RequestSchemaValidator;
1545
+ /**
1546
+ * Adapts an AJV validator into a `RequestSchemaValidator`.
1547
+ *
1548
+ * Contract: synchronous validators return a boolean and expose input-local
1549
+ * diagnostics via mutable `validator.errors`; those errors are snapshotted
1550
+ * synchronously before any suspension so concurrent same-turn validations do
1551
+ * not observe another input's diagnostics. Asynchronous AJV schemas
1552
+ * (`$async: true`) return a promise that resolves with validated data on
1553
+ * success or rejects with a `ValidationError` carrying an `errors` array on
1554
+ * failure; rejection-carried errors are normalized, while any other rejection
1555
+ * propagates unchanged as an operational exception.
1556
+ */
1525
1557
  declare function fromAjv<TValue = unknown>(validator: AjvValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1526
1558
  declare function fromValibot<TSchema, TOutput = unknown>(schema: TSchema, safeParse: ValibotSafeParseLike): RequestSchemaValidator<TOutput>;
1559
+ /**
1560
+ * Adapts an ArkType type into a `RequestSchemaValidator`.
1561
+ *
1562
+ * Success/failure is discriminated via the supported ArkErrors brand key
1563
+ * (`hasArkKind(result, "errors")`, stored at runtime as `' arkKind'` with a
1564
+ * leading space; the unspaced `arkKind` alias is also accepted) or, when the
1565
+ * type exposes a Standard Schema `~standard.validate` contract, via that
1566
+ * contract. ArkType's Standard Schema `validate` returns `{ value }` on
1567
+ * success but returns raw `ArkErrors` on failure instead of `{ issues }`, so
1568
+ * both shapes are handled. Array shape and `message`/`path`-like record
1569
+ * fields are never used as discriminators, so valid empty/scalar/record/
1570
+ * nullable arrays pass through unchanged. Unexpected exceptions thrown by the
1571
+ * type propagate unchanged.
1572
+ */
1527
1573
  declare function fromArkType<TValue = unknown>(type: ArkTypeLike<TValue>): RequestSchemaValidator<TValue>;
1528
1574
  declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): RequestSchemaValidator<TValue>;
1529
1575
  declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
1530
1576
  declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1531
1577
 
1532
- export { type Filter as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, DATA_MIDDLEWARE as D, type DataFindOneOptions as E, type DataFindOptions as F, type DataHook as G, type DataHookContext as H, type DataIdentifierHook as I, type DataListHook as J, type DataOverrideFilterHook as K, type DataRequest as L, type DataRequestSchemas as M, type DataRouterOptions as N, type DecorateAccess as O, type DecorateAllAccess as P, type DeepFieldPath as Q, type DefaultModelRouterOptions as R, type Defaults as S, type DistinctArgs as T, type DistinctBody as U, type DocPermissionsAccess as V, type ErrorResult as W, type ExistsOptions as X, type ExtendedDataRouterOptions as Y, type ExtendedDefaultModelRouterOptions as Z, type ExtendedModelRouterOptions as _, type AccessRouterFieldKey as a, type RequestSchemaFailure as a$, FilterOperator as a0, type FindAccess as a1, type FindArgs as a2, type FindByIdArgs as a3, type FindByIdOptions as a4, type FindOneArgs as a5, type FindOneOptions as a6, type FindOptions as a7, type GlobalOptions as a8, type GlobalPermissionValue as a9, type ModelValidateHook as aA, PERMISSIONS as aB, PERMISSION_KEYS as aC, type PathValue as aD, type PermissionSchema as aE, type Populate as aF, type PopulateAccess as aG, type PrepareAccess as aH, type Projection as aI, type PublicCreateArgs as aJ, type PublicCreateOptions as aK, type PublicErrorResult as aL, type PublicListArgs as aM, type PublicListOptions as aN, type PublicListResult as aO, type PublicOutput as aP, type PublicReadArgs as aQ, type PublicReadOptions as aR, type PublicServiceResult as aS, type PublicSingleResult as aT, type PublicUpdateArgs as aU, type PublicUpdateOptions as aV, type PublicUpsertArgs as aW, type PublicUpsertOptions as aX, type ReadQueryInput as aY, type Request as aZ, type RequestSchemaAdapter as a_, type GuardHook as aa, type IdentifierHook as ab, type Include as ac, type IoTsContextEntryLike as ad, type IoTsDecodeErrorLike as ae, type IoTsDecoderLike as af, type JoiSchemaLike as ag, type JoiValidationErrorDetailLike as ah, type KeyValueProjection as ai, type ListQueryInput as aj, type ListResult as ak, MIDDLEWARE as al, type MaybePromise as am, type ModelBaseFilterHook as an, type ModelChangeHook as ao, type ModelDeleteHook as ap, type ModelDocPermissionsHook as aq, type ModelDocument as ar, type ModelDocumentHook as as, type ModelHook as at, type ModelHookContext as au, type ModelIdentifierHook as av, type ModelListHook as aw, type ModelOverrideFilterHook as ax, type ModelRequest as ay, type ModelRouterOptions as az, type AccessRouterLogger as b, type SubdocumentRecord as b$, type RequestSchemaIssue as b0, type RequestSchemaLike as b1, type RequestSchemaOptions as b2, type RequestSchemaResult as b3, type RequestSchemaSuccess as b4, type RequestSchemaValidator as b5, type RequestSchemas as b6, type RootDataListQueryEntry as b7, type RootDataOperation as b8, type RootDataReadByFilterQueryEntry as b9, type SelectedPublicOutput as bA, type ServiceResult as bB, type SingleResult as bC, type Sort as bD, type SortOrder as bE, type StandardSchemaFailure as bF, type StandardSchemaInferOutput as bG, type StandardSchemaIssue as bH, type StandardSchemaPathSegment as bI, type StandardSchemaResult as bJ, type StandardSchemaSuccess as bK, type StandardSchemaV1 as bL, StatusCodes as bM, type SubListBody as bN, type SubPopulate as bO, type SubQueryEntry as bP, type SubReadBody as bQ, type SubdocumentBulkRecord as bR, type SubdocumentBulkUpdateInput as bS, type SubdocumentCreateInput as bT, type SubdocumentCreateOptions as bU, type SubdocumentId as bV, type SubdocumentListOptions as bW, type SubdocumentName as bX, type SubdocumentParentArgs as bY, type SubdocumentParentOptions as bZ, type SubdocumentReadOptions as b_, type RootDataReadByIdQueryEntry as ba, type RootModelCountQueryEntry as bb, type RootModelCreateQueryEntry as bc, type RootModelDeleteQueryEntry as bd, type RootModelDistinctQueryEntry as be, type RootModelListQueryEntry as bf, type RootModelNewQueryEntry as bg, type RootModelOperation as bh, type RootModelReadByFilterQueryEntry as bi, type RootModelReadByIdQueryEntry as bj, type RootModelSubBulkUpdateQueryEntry as bk, type RootModelSubCreateQueryEntry as bl, type RootModelSubDeleteQueryEntry as bm, type RootModelSubListQueryEntry as bn, type RootModelSubReadQueryEntry as bo, type RootModelSubUpdateQueryEntry as bp, type RootModelUpdateQueryEntry as bq, type RootModelUpsertQueryEntry as br, type RootOperationResult as bs, type RootQueryEntry as bt, type RootRouterOptions as bu, type RootSubOperation as bv, type RootTarget as bw, type RouteGuardAccess as bx, type SelectAccess as by, type SelectedPopulatedPublicOutput as bz, type AccessRouterRequest as c, type SuperstructFailureLike as c0, type SuperstructValidateLike as c1, type Task as c2, type TransformAccess as c3, type TypedFilter as c4, type UpdateByIdArgs as c5, type UpdateByIdOptions as c6, type UpdateOneArgs as c7, type UpdateOneOptions as c8, type UpdateQueryInput as c9, fromZod as cA, parseBody as cB, parseBodyWithSchema as cC, parseNestedBodyWithSchema as cD, parsePathParam as cE, parseQuery as cF, DataService as cG, Service as cH, PublicService as cI, type AccessRouterPermissionMap as cJ, type AccessRouterPermissions as cK, type Permissions as cL, type UpsertArgs as ca, type UpsertOptions as cb, type UpsertQueryInput as cc, type ValibotIssueLike as cd, type ValibotPathItemLike as ce, type ValibotSafeParseLike as cf, type ValibotSafeParseResult as cg, type ValidateAccess as ch, type ValidateRule as ci, type Validation as cj, type ValidationError as ck, type VineValidationErrorLike as cl, type VineValidationMessageLike as cm, type VineValidatorLike as cn, type YupSchemaLike as co, type YupValidationErrorLike as cp, defineRequestSchema as cq, fromAjv as cr, fromArkType as cs, fromIoTs as ct, fromJoi as cu, fromStandardSchema as cv, fromSuperstruct as cw, fromValibot as cx, fromVine as cy, fromYup as cz, type AccessRouterRequestExtensions as d, type AdvancedCreateBody as e, type AdvancedListBody as f, type AdvancedReadBody as g, type AdvancedReadFilterBody as h, type AdvancedUpdateBody as i, type AdvancedUpsertBody as j, type AfterPersistAccess as k, type AjvErrorObjectLike as l, type AjvValidatorLike as m, type ArkTypeErrorsLike as n, type ArkTypeLike as o, type ArkTypeProblemLike as p, Codes as q, type CountBody as r, type CreateArgs as s, type CreateOptions as t, type CreateQueryInput as u, CustomHeaders as v, type DataBaseFilterHook as w, type DataFilter as x, type DataFindArgs as y, type DataFindOneArgs as z };
1578
+ export { type ExtendedModelRouterOptions as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, DATA_MIDDLEWARE as D, type DataFindOneArgs as E, type DataFindOneOptions as F, type DataFindOptions as G, type DataHook as H, type DataHookContext as I, type DataIdentifierHook as J, type DataListHook as K, type DataOverrideFilterHook as L, type DataRequest as M, type DataRequestSchemas as N, type DataRouterOptions as O, type DecorateAccess as P, type DecorateAllAccess as Q, type DeepFieldPath as R, type DefaultModelRouterOptions as S, type Defaults as T, type DistinctArgs as U, type DistinctBody as V, type DocPermissionsAccess as W, type ErrorResult as X, type ExistsOptions as Y, type ExtendedDataRouterOptions as Z, type ExtendedDefaultModelRouterOptions as _, type AccessRouterFieldKey as a, type RequestSchemaAdapter as a$, type Filter as a0, FilterOperator as a1, type FindAccess as a2, type FindArgs as a3, type FindByIdArgs as a4, type FindByIdOptions as a5, type FindOneArgs as a6, type FindOneOptions as a7, type FindOptions as a8, type GlobalOptions as a9, type ModelRouterOptions as aA, type ModelValidateHook as aB, PERMISSIONS as aC, PERMISSION_KEYS as aD, type PathValue as aE, type PermissionSchema as aF, type Populate as aG, type PopulateAccess as aH, type PrepareAccess as aI, type Projection as aJ, type PublicCreateArgs as aK, type PublicCreateOptions as aL, type PublicErrorResult as aM, type PublicListArgs as aN, type PublicListOptions as aO, type PublicListResult as aP, type PublicOutput as aQ, type PublicReadArgs as aR, type PublicReadOptions as aS, type PublicServiceResult as aT, type PublicSingleResult as aU, type PublicUpdateArgs as aV, type PublicUpdateOptions as aW, type PublicUpsertArgs as aX, type PublicUpsertOptions as aY, type ReadQueryInput as aZ, type Request as a_, type GlobalPermissionValue as aa, type GuardHook as ab, type IdentifierHook as ac, type Include as ad, type IoTsContextEntryLike as ae, type IoTsDecodeErrorLike as af, type IoTsDecoderLike as ag, type JoiSchemaLike as ah, type JoiValidationErrorDetailLike as ai, type KeyValueProjection as aj, type ListQueryInput as ak, type ListResult as al, MIDDLEWARE as am, type MaybePromise as an, type ModelBaseFilterHook as ao, type ModelChangeHook as ap, type ModelDeleteHook as aq, type ModelDocPermissionsHook as ar, type ModelDocument as as, type ModelDocumentHook as at, type ModelHook as au, type ModelHookContext as av, type ModelIdentifierHook as aw, type ModelListHook as ax, type ModelOverrideFilterHook as ay, type ModelRequest as az, type AccessRouterLogger as b, type SubdocumentReadOptions as b$, type RequestSchemaFailure as b0, type RequestSchemaIssue as b1, type RequestSchemaLike as b2, type RequestSchemaOptions as b3, type RequestSchemaResult as b4, type RequestSchemaSuccess as b5, type RequestSchemaValidator as b6, type RequestSchemas as b7, type RootDataListQueryEntry as b8, type RootDataOperation as b9, type SelectedPopulatedPublicOutput as bA, type SelectedPublicOutput as bB, type ServiceResult as bC, type SingleResult as bD, type Sort as bE, type SortOrder as bF, type StandardSchemaFailure as bG, type StandardSchemaInferOutput as bH, type StandardSchemaIssue as bI, type StandardSchemaPathSegment as bJ, type StandardSchemaResult as bK, type StandardSchemaSuccess as bL, type StandardSchemaV1 as bM, StatusCodes as bN, type SubListBody as bO, type SubPopulate as bP, type SubQueryEntry as bQ, type SubReadBody as bR, type SubdocumentBulkRecord as bS, type SubdocumentBulkUpdateInput as bT, type SubdocumentCreateInput as bU, type SubdocumentCreateOptions as bV, type SubdocumentId as bW, type SubdocumentListOptions as bX, type SubdocumentName as bY, type SubdocumentParentArgs as bZ, type SubdocumentParentOptions as b_, type RootDataReadByFilterQueryEntry as ba, type RootDataReadByIdQueryEntry as bb, type RootModelCountQueryEntry as bc, type RootModelCreateQueryEntry as bd, type RootModelDeleteQueryEntry as be, type RootModelDistinctQueryEntry as bf, type RootModelListQueryEntry as bg, type RootModelNewQueryEntry as bh, type RootModelOperation as bi, type RootModelReadByFilterQueryEntry as bj, type RootModelReadByIdQueryEntry as bk, type RootModelSubBulkUpdateQueryEntry as bl, type RootModelSubCreateQueryEntry as bm, type RootModelSubDeleteQueryEntry as bn, type RootModelSubListQueryEntry as bo, type RootModelSubReadQueryEntry as bp, type RootModelSubUpdateQueryEntry as bq, type RootModelUpdateQueryEntry as br, type RootModelUpsertQueryEntry as bs, type RootOperationResult as bt, type RootQueryEntry as bu, type RootRouterOptions as bv, type RootSubOperation as bw, type RootTarget as bx, type RouteGuardAccess as by, type SelectAccess as bz, type AccessRouterRequest as c, type SubdocumentRecord as c0, type SuperstructFailureLike as c1, type SuperstructValidateLike as c2, type Task as c3, type TransformAccess as c4, type TypedFilter as c5, type UpdateByIdArgs as c6, type UpdateByIdOptions as c7, type UpdateOneArgs as c8, type UpdateOneOptions as c9, fromYup as cA, fromZod as cB, parseBody as cC, parseBodyWithSchema as cD, parseNestedBodyWithSchema as cE, parsePathParam as cF, parseQuery as cG, DataService as cH, Service as cI, PublicService as cJ, type AccessRouterPermissionMap as cK, type AccessRouterPermissions as cL, type Permissions as cM, type UpdateQueryInput as ca, type UpsertArgs as cb, type UpsertOptions as cc, type UpsertQueryInput as cd, type ValibotIssueLike as ce, type ValibotPathItemLike as cf, type ValibotSafeParseLike as cg, type ValibotSafeParseResult as ch, type ValidateAccess as ci, type ValidateRule as cj, type Validation as ck, type ValidationError as cl, type VineValidationErrorLike as cm, type VineValidationMessageLike as cn, type VineValidatorLike as co, type YupSchemaLike as cp, type YupValidationErrorLike as cq, defineRequestSchema as cr, fromAjv as cs, fromArkType as ct, fromIoTs as cu, fromJoi as cv, fromStandardSchema as cw, fromSuperstruct as cx, fromValibot as cy, fromVine as cz, type AccessRouterRequestExtensions as d, type AdvancedCreateBody as e, type AdvancedListBody as f, type AdvancedReadBody as g, type AdvancedReadFilterBody as h, type AdvancedUpdateBody as i, type AdvancedUpsertBody as j, type AfterPersistAccess as k, type AjvErrorObjectLike as l, type AjvValidationErrorLike as m, type AjvValidatorLike as n, type ArkTypeErrorsLike as o, type ArkTypeLike as p, type ArkTypeProblemLike as q, Codes as r, type CountBody as s, type CreateArgs as t, type CreateOptions as u, type CreateQueryInput as v, CustomHeaders as w, type DataBaseFilterHook as x, type DataFilter as y, type DataFindArgs as z };
package/processors.js CHANGED
@@ -92,8 +92,11 @@ var copyAndDepopulate = (docObject, operations, options = { mutable: true, idFie
92
92
  if (!(0, import_utils.isPlainObject)(target)) return ret;
93
93
  const targetObject = target;
94
94
  const next = targetObject[seg];
95
- if ((0, import_utils.isArray)(next)) ret.push(...next);
96
- else if (next !== null && next !== void 0) ret.push(next);
95
+ if ((0, import_utils.isArray)(next)) {
96
+ for (const item of next) {
97
+ ret.push(item);
98
+ }
99
+ } else if (next !== null && next !== void 0) ret.push(next);
97
100
  return ret;
98
101
  }, []);
99
102
  }
package/processors.mjs CHANGED
@@ -69,8 +69,11 @@ var copyAndDepopulate = (docObject, operations, options = { mutable: true, idFie
69
69
  if (!isPlainObject(target)) return ret;
70
70
  const targetObject = target;
71
71
  const next = targetObject[seg];
72
- if (isArray(next)) ret.push(...next);
73
- else if (next !== null && next !== void 0) ret.push(next);
72
+ if (isArray(next)) {
73
+ for (const item of next) {
74
+ ret.push(item);
75
+ }
76
+ } else if (next !== null && next !== void 0) ret.push(next);
74
77
  return ret;
75
78
  }, []);
76
79
  }