@web-ts-toolkit/access-router 0.44.0 → 0.46.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.
@@ -30,6 +30,7 @@ declare class Service<TModel = unknown> extends Base<TModel> {
30
30
  defaults: Defaults<TModel>;
31
31
  protected baseFields: string[];
32
32
  protected baseFieldsExt: string[];
33
+ private readonly persist;
33
34
  findRawParentDoc(args: {
34
35
  filter: Filter<TModel>;
35
36
  select: string;
@@ -53,18 +54,46 @@ declare class Service<TModel = unknown> extends Base<TModel> {
53
54
  skim?: boolean;
54
55
  includePermissions?: boolean;
55
56
  }): Promise<SingleResult<TModel>>;
57
+ /**
58
+ * Update at authorized policy paths: admitted leaves preserve omitted siblings;
59
+ * whole-authorized objects/arrays replace. Shared by updateById and existing-row
60
+ * upsert. Validation precedes trusted prepare output (not re-filtered); partial
61
+ * prepare containers preserve omissions. Transform retains explicit document-setter
62
+ * replacement authority. Send nested client JSON, not literal dotted update keys.
63
+ */
56
64
  updateOne(filter: Filter<TModel>, data: Record<string, unknown>, args?: UpdateOneArgs<TModel>, options?: UpdateOneOptions, decorate?: (doc: unknown, context?: ModelHookContext) => unknown): Promise<SingleResult<TModel> | ErrorResult>;
57
65
  updateById(id: string, data: Record<string, unknown>, args?: UpdateByIdArgs<TModel>, options?: UpdateByIdOptions, decorate?: (doc: unknown, context?: ModelHookContext) => unknown): Promise<SingleResult<TModel> | ErrorResult>;
58
66
  upsert(filter: Filter<TModel>, data: Record<string, unknown>, args?: UpsertArgs<TModel>, options?: UpsertOptions, decorate?: (doc: unknown, context?: ModelHookContext) => unknown): Promise<ServiceResult<TModel>>;
59
67
  delete(id: string): Promise<SingleResult<unknown> | ErrorResult>;
68
+ /**
69
+ * Check existence under row policy (read by default). Terminal false returns a
70
+ * Forbidden ErrorResult before adapter dispatch, in both includeId modes.
71
+ * Allowed matches return true or an `{ _id }` record; misses return false or null.
72
+ * Custom HTTP routes must map ErrorResult to their intended response status.
73
+ */
60
74
  exists(filter: Filter<TModel>, options: ExistsOptions & {
61
75
  includeId: true;
62
76
  }): Promise<SingleResult<unknown> | ErrorResult>;
77
+ /** Boolean existence; terminal false policy returns Forbidden, not successful false. */
63
78
  exists(filter: Filter<TModel>, options?: ExistsOptions): Promise<SingleResult<boolean> | ErrorResult>;
64
79
  protected isValidDistinctFieldName(field: unknown): boolean;
65
80
  protected authorizeDistinctField(field: string): Promise<ErrorResult | null>;
66
81
  distinct(field: string, args?: DistinctArgs<TModel>): Promise<ListResult<unknown> | ErrorResult>;
67
82
  count(filter: Filter<TModel>, access?: BaseFilterAccess): Promise<SingleResult<number> | ErrorResult>;
83
+ /**
84
+ * Trusted count for correlated includes (ACI-03): the caller already
85
+ * resolved parent references, revalidated expanded operands, and applied
86
+ * explicit `count` access via `genFilter`. This skips client-filter
87
+ * validation and subquery parsing so substituted parent data stays inert.
88
+ */
89
+ countTrusted(authorizedFilter: Filter<TModel>): Promise<SingleResult<number> | ErrorResult>;
90
+ /**
91
+ * Group target document IDs by original parent-key aliases using one aggregate.
92
+ * Resolves the requested row policy (legacy count includes pass `count`), casts
93
+ * authorized filters/foreign operands with the target schema, and deduplicates IDs
94
+ * independently of pagination. Cast failures return BadRequest; false policy returns
95
+ * Forbidden. Casting does not execute countDocuments middleware/plugins.
96
+ */
68
97
  countByFieldValues(foreignField: string, values: unknown[], filter?: Filter<TModel>, access?: BaseFilterAccess): Promise<SingleResult<Map<string, Set<string>>> | ErrorResult>;
69
98
  getDocPermissions(doc: unknown): Record<string, unknown>;
70
99
  private resolveFindOneArgs;
@@ -86,8 +115,28 @@ declare class Service<TModel = unknown> extends Base<TModel> {
86
115
  private getAccessibleIdSet;
87
116
  listSub(id: SubdocumentId, sub: SubdocumentName, options?: SubdocumentListOptions<TModel>): Promise<ListResult | ErrorResult>;
88
117
  readSub(id: SubdocumentId, sub: SubdocumentName, subId: SubdocumentId, options?: SubdocumentReadOptions): Promise<SingleResult | ErrorResult>;
118
+ /**
119
+ * Apply authorized policy-path updates, preserving protected siblings, then save.
120
+ * Output requires post-save parent read and subdocument read operation/row access;
121
+ * hidden output is successful `data: null` (direct/root-entry 200), not a failed write.
122
+ * Visible output uses read fields plus `_id`. Do not retry solely for null output.
123
+ */
89
124
  updateSub(id: SubdocumentId, sub: SubdocumentName, subId: SubdocumentId, data: Record<string, unknown>): Promise<SingleResult | ErrorResult>;
125
+ /**
126
+ * Save authorized targeted updates, then return readable targets in stored order.
127
+ * Requires parent/subdocument read access for output, not subdocument list access;
128
+ * uses read fields plus `_id`. Hidden output succeeds with `data: [], count: 0`
129
+ * (direct/root-entry 200); count measures visible rows, not all updated rows.
130
+ */
90
131
  bulkUpdateSub(id: SubdocumentId, sub: SubdocumentName, data: SubdocumentBulkUpdateInput | Record<string, unknown>): Promise<ListResult | ErrorResult>;
132
+ /**
133
+ * Append/prepend admitted rows, then return the visible full array (including when
134
+ * input is empty). Output requires post-save parent read and subdocument list AND
135
+ * read guards/row filters; fields use read projection plus `_id`.
136
+ * Hidden output succeeds with code `created`, `data: [], count: 0`
137
+ * (direct/root-entry 201). Visible count/order follow filtered stored rows.
138
+ * Empty output does not mean the write failed; addFirst is a service option.
139
+ */
91
140
  createSub(id: SubdocumentId, sub: SubdocumentName, data: SubdocumentCreateInput, options?: SubdocumentCreateOptions): Promise<ListResult | ErrorResult>;
92
141
  deleteSub(id: SubdocumentId, sub: SubdocumentName, subId: SubdocumentId): Promise<SingleResult | ErrorResult>;
93
142
  getParentDoc(id: SubdocumentId, sub: SubdocumentName, args?: SubdocumentParentArgs, options?: SubdocumentParentOptions): Promise<any>;
@@ -121,6 +170,11 @@ declare class PublicService<TModel = unknown> extends Service<TModel> {
121
170
  select?: TSelect;
122
171
  populate?: TPopulate;
123
172
  }, options?: PublicUpdateOptions): Promise<SingleResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
173
+ /**
174
+ * With an _id, check update-policy existence then update: terminal denial returns
175
+ * Forbidden, an allowed miss remains Unauthorized, and neither creates a row.
176
+ * Without an _id, use the create path.
177
+ */
124
178
  _upsert<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(data: Record<string, unknown>, args?: Omit<PublicUpsertArgs, 'select' | 'populate'> & {
125
179
  select?: TSelect;
126
180
  populate?: TPopulate;
@@ -237,12 +291,32 @@ type AjvErrorObjectLike = {
237
291
  };
238
292
  };
239
293
  type AjvValidationErrorLike = {
240
- errors?: ReadonlyArray<AjvErrorObjectLike> | null;
294
+ ajv: true;
295
+ validation: true;
296
+ errors: ReadonlyArray<AjvErrorObjectLike>;
241
297
  };
242
- type AjvValidatorLike<T = unknown> = {
243
- (value: unknown): boolean | Promise<T | boolean>;
298
+ /**
299
+ * Structural AJV contract; AJV is not a runtime dependency of access-router.
300
+ * Sync validators return boolean verdicts and expose mutable errors, snapshotted
301
+ * in the same turn. Tagged `$async: true` validators resolve with data (even
302
+ * false/true/null), or reject with AJV ValidationError diagnostics.
303
+ *
304
+ * Untagged promises/thenables are unsupported. Migrate async boolean-verdict
305
+ * wrappers to RequestSchemaValidator, or return data/reject validation errors
306
+ * and retain the literal `$async: true` tag. Real AJV ValidateFunction and
307
+ * AsyncValidateFunction overloads infer output via their type guard without casts; a synchronous
308
+ * structural validator's output type can be supplied explicitly to fromAjv<T>.
309
+ * AJV can type inline async schemas through a sync overload; an AsyncSchema-typed
310
+ * schema selects its async compile/compileAsync overload. Runtime uses the tag.
311
+ */
312
+ type AjvValidatorLike<T = unknown> = ({
313
+ (value: unknown): boolean;
314
+ $async?: false;
315
+ } | {
316
+ (value: unknown): PromiseLike<T>;
317
+ $async: true;
318
+ }) & {
244
319
  errors?: ReadonlyArray<AjvErrorObjectLike> | null;
245
- $async?: boolean;
246
320
  };
247
321
  type ValibotPathItemLike = {
248
322
  key?: unknown;
@@ -440,21 +514,232 @@ interface RequestComplexityOptions {
440
514
  maxBulkItems?: number;
441
515
  maxIncludeCount?: number;
442
516
  maxSubQueryCount?: number;
517
+ /**
518
+ * Defaults to 10. Shared request-and-runtime-owned ceiling on awaited model-service
519
+ * adapter/document persistence operations, including nested includes/root entries.
520
+ * Recursive orchestration holds no permit; internal map/run bounds are per call.
521
+ * One operation may issue multiple driver commands via Mongoose middleware/populate;
522
+ * direct DB/network calls from trusted application hooks are outside this ceiling.
523
+ * Not a process-wide connection limit or protection against competing edits.
524
+ */
443
525
  maxBulkConcurrency?: number;
444
526
  maxHookConcurrency?: number;
527
+ /** Cumulative correlated target executions per request/runtime (default 100); permit release does not refund this budget. */
528
+ maxCorrelatedQueries?: number;
529
+ /** Correlated template nesting bound (default 5), independent of persistence concurrency. */
530
+ maxCorrelatedDepth?: number;
445
531
  }
446
532
 
533
+ type OpenApiMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
534
+ type OpenApiSchema = Record<string, unknown>;
535
+ type OpenApiSchemaSource = unknown;
536
+ type OpenApiParameter = {
537
+ name: string;
538
+ in: 'path' | 'query';
539
+ required?: boolean;
540
+ description?: string;
541
+ schema?: OpenApiSchema;
542
+ };
543
+ type OpenApiResponse = {
544
+ description: string;
545
+ content?: Record<string, {
546
+ schema: OpenApiSchema;
547
+ }>;
548
+ };
549
+ type OpenApiResponses = Record<string, OpenApiResponse>;
550
+ type OpenApiRouteDescriptor = {
551
+ method: OpenApiMethod;
552
+ path: string;
553
+ operationId?: string;
554
+ summary?: string;
555
+ description?: string;
556
+ tags?: string[];
557
+ acl?: string;
558
+ deprecated?: boolean;
559
+ query?: OpenApiSchemaSource;
560
+ body?: OpenApiSchemaSource;
561
+ pathParams?: Record<string, OpenApiSchemaSource>;
562
+ responses?: OpenApiResponses;
563
+ /**
564
+ * When true, replaces an existing registration with the same method/path
565
+ * even when the descriptors differ. When false (default), conflicting
566
+ * registrations throw at registration time so consumers can detect
567
+ * accidental route shadowing.
568
+ */
569
+ allowReplace?: boolean;
570
+ /**
571
+ * When true, this exact descriptor is idempotent and registering the same
572
+ * method/path with an equivalent descriptor again is silently accepted.
573
+ * Differing re-registrations still throw unless {@link allowReplace} is set.
574
+ * Additionally, an idempotent descriptor may share its operationId with
575
+ * another idempotent descriptor mounted at a different path on the same
576
+ * registry, so reserved operations (e.g. the root batch route) can be
577
+ * exposed from multiple base paths without triggering strict-mode
578
+ * duplicate-operationId rejection.
579
+ */
580
+ idempotent?: boolean;
581
+ };
582
+ type OpenApiRegistryOptions = {
583
+ /**
584
+ * Throw when the same method/path is registered twice with differing
585
+ * descriptors, instead of silently replacing. Default: true (strict).
586
+ * The {@link AccessRuntime} registry is constructed in strict mode by
587
+ * default; construct {@link OpenApiRegistry} directly with
588
+ * `rejectConflicts: false` for legacy replacement semantics.
589
+ */
590
+ rejectConflicts?: boolean;
591
+ /**
592
+ * Throw when the same operationId is registered more than once, including
593
+ * when {@link OpenApiRouteDescriptor.allowReplace} is set. Default: true.
594
+ */
595
+ rejectDuplicateOperationIds?: boolean;
596
+ };
597
+ type OpenApiDocumentOptions = {
598
+ title: string;
599
+ version: string;
600
+ description?: string;
601
+ servers?: Array<{
602
+ url: string;
603
+ description?: string;
604
+ }>;
605
+ };
606
+ type OpenApiRouterOptions = Partial<OpenApiDocumentOptions> & {
607
+ jsonPath?: string;
608
+ docsPath?: string | false;
609
+ swaggerUiCssUrl?: string;
610
+ swaggerUiBundleUrl?: string;
611
+ };
612
+
613
+ type ModelReferenceMap = {
614
+ [key: string]: string | ModelReferenceMap;
615
+ };
616
+ declare class AccessRuntime {
617
+ private readonly allowGlobalModelLookup;
618
+ constructor(options?: {
619
+ allowGlobalModelLookup?: boolean;
620
+ });
621
+ private readonly globalOptions;
622
+ private readonly defaultModelOptions;
623
+ private readonly modelOptions;
624
+ private readonly modelJsonSchemas;
625
+ private readonly dataOptions;
626
+ private readonly modelRefs;
627
+ private readonly modelSubs;
628
+ private readonly modelAtts;
629
+ private readonly modelInstances;
630
+ private readonly openApiRegistry;
631
+ private openApiPathPrefix;
632
+ registerModelInstance<TModel>(modelName: string, model: mongoose.Model<TModel>): void;
633
+ hasModelInstance(modelName: string): boolean;
634
+ getModelInstance<TModel = unknown>(modelName: string): mongoose.Model<TModel> | null;
635
+ registerOpenApiRoute(route: OpenApiRouteDescriptor): void;
636
+ /**
637
+ * Compose OpenAPI paths while synchronously constructing mounted routers.
638
+ * Prefixes apply before collision checks; prior descriptors and Express paths
639
+ * are unchanged. Nested calls compose and the prior scope is restored even on
640
+ * failure. The callback must finish registration synchronously (no async work).
641
+ */
642
+ withOpenApiPathPrefix<T>(prefix: string, build: () => T): T;
643
+ /**
644
+ * Enable strict OpenAPI collision detection for the remainder of this
645
+ * runtime's lifetime. After this call, conflicting method/path
646
+ * registrations and duplicate operationIds throw {@link OpenApiCollisionError}
647
+ * instead of silently replacing. Existing already-registered routes are
648
+ * not retroactively re-validated.
649
+ */
650
+ enableOpenApiCollisionDetection(): void;
651
+ getOpenApiRoutes(): OpenApiRouteDescriptor[];
652
+ clearOpenApiRoutes(): void;
653
+ getOpenApiSpec(info: OpenApiDocumentOptions): {
654
+ openapi: string;
655
+ info: Omit<OpenApiDocumentOptions, "servers">;
656
+ servers?: OpenApiDocumentOptions["servers"];
657
+ paths: Record<string, Record<string, {
658
+ [key: `x-${string}`]: unknown;
659
+ operationId?: string;
660
+ summary?: string;
661
+ description?: string;
662
+ tags?: string[];
663
+ deprecated?: boolean;
664
+ parameters?: OpenApiParameter[];
665
+ requestBody?: {
666
+ required?: boolean;
667
+ content: Record<string, {
668
+ schema: OpenApiSchema;
669
+ }>;
670
+ };
671
+ responses: OpenApiResponses;
672
+ }>>;
673
+ };
674
+ createBootstrapSnapshot(): {
675
+ globalOptions: GlobalOptions;
676
+ defaultModelOptions: DefaultModelRouterOptions;
677
+ modelOptions: Record<string, ModelRouterOptions>;
678
+ dataOptions: Record<string, DataRouterOptions>;
679
+ modelInstances: Record<string, mongoose.Model<unknown>>;
680
+ modelJsonSchemas: Record<string, Record<string, unknown>>;
681
+ modelRefs: Record<string, ModelReferenceMap>;
682
+ modelSubs: Record<string, string[]>;
683
+ modelAtts: Record<string, string[]>;
684
+ openApi: {
685
+ routes: OpenApiRouteDescriptor[];
686
+ options: Required<OpenApiRegistryOptions>;
687
+ };
688
+ };
689
+ restoreBootstrapSnapshot(snapshot: ReturnType<AccessRuntime['createBootstrapSnapshot']>): void;
690
+ setGlobalOptions(options: GlobalOptions): void;
691
+ setGlobalOption<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]): void;
692
+ getGlobalOptions(): GlobalOptions;
693
+ getGlobalOption<K extends keyof GlobalOptions>(key: K, defaultValue?: GlobalOptions[K]): GlobalOptions[K];
694
+ setDefaultModelOptions(options: DefaultModelRouterOptions): void;
695
+ setDefaultModelOption<K extends keyof ExtendedDefaultModelRouterOptions>(key: K, value: ExtendedDefaultModelRouterOptions[K]): void;
696
+ getDefaultModelOptions(): DefaultModelRouterOptions<unknown>;
697
+ getDefaultModelOption<K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]): ExtendedDefaultModelRouterOptions<unknown>[K];
698
+ private createModelOptions;
699
+ private getOrCreateModelOptions;
700
+ setModelOptions<TModel = unknown>(modelName: string, options: ModelRouterOptions<TModel>): void;
701
+ setModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K, value: ExtendedModelRouterOptions<TModel>[K]): void;
702
+ getModelOptions<TModel = unknown>(modelName: string): ModelRouterOptions<TModel>;
703
+ getModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions<TModel>[K]): ExtendedModelRouterOptions<TModel>[K];
704
+ getExactModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K | string): ExtendedModelRouterOptions<TModel>[K];
705
+ getModelNames(): string[];
706
+ hasModel(modelName: string): boolean;
707
+ getModelJsonSchema(modelName: string): Record<string, unknown>;
708
+ private createDataOptions;
709
+ private getOrCreateDataOptions;
710
+ setDataOptions<TData = unknown>(dataName: string, options: DataRouterOptions<TData>): void;
711
+ setDataOption<K extends keyof DataRouterOptions<TData>, TData = unknown>(dataName: string, key: K, value: DataRouterOptions<TData>[K]): void;
712
+ getDataOptions<TData = unknown>(dataName: string): DataRouterOptions<TData>;
713
+ getDataSnapshot<TData = unknown>(dataName: string): readonly TData[];
714
+ getDataOption<K extends keyof DataRouterOptions<TData>, TData = unknown>(dataName: string, key: K | string, defaultValue?: DataRouterOptions<TData>[K]): DataRouterOptions<TData>[K];
715
+ getExactDataOption<K extends keyof ExtendedDataRouterOptions<TData>, TData = unknown>(dataName: string, key: K | string): ExtendedDataRouterOptions<TData>[K];
716
+ getDataNames(): string[];
717
+ ensureModelMeta(modelName: string): void;
718
+ getModelRef(modelName: string, refPath: string): string | null;
719
+ getModelSub(modelName: string): string[];
720
+ getModelAtt(modelName: string): string[];
721
+ }
722
+ declare const defaultRuntime: AccessRuntime;
723
+
447
724
  declare class RequestConcurrencyScheduler {
448
725
  readonly limit: number;
726
+ private activeWork;
727
+ private readonly waiters;
449
728
  constructor(limit: number);
450
729
  map<TInput, TOutput>(items: TInput[], iteratee: (item: TInput, index: number, scheduled: true) => Promise<TOutput>): Promise<TOutput[]>;
451
730
  run<TOutput>(iteratee: (scheduled: true) => Promise<TOutput>): Promise<TOutput>;
731
+ work<TOutput>(operation: () => TOutput | PromiseLike<TOutput>): Promise<TOutput>;
452
732
  }
453
733
 
454
734
  type CrossResourceModelOperation = 'list' | 'read' | 'count';
735
+ interface CorrelatedExecState {
736
+ totalQueries: number;
737
+ scheduler: RequestConcurrencyScheduler;
738
+ }
455
739
  declare class Base<TModel = unknown> {
456
740
  protected req: ModelRequest;
457
741
  protected modelName: string;
742
+ protected readonly requestRuntime: AccessRuntime;
458
743
  constructor(req: ModelRequest, modelName: string);
459
744
  decorate<T>(doc: T, access: DecorateAccess, context: ModelHookContext): Promise<T>;
460
745
  decorateAll<T>(docs: T[], access: DecorateAllAccess, context: ModelHookContext): Promise<T[]>;
@@ -488,10 +773,14 @@ declare class Base<TModel = unknown> {
488
773
  protected throwClientRequestError(code: ErrorResult['code'], detail: string): never;
489
774
  protected getAuthorizedTargetService(modelName: string, op: CrossResourceModelOperation): Promise<PublicService<unknown>>;
490
775
  protected processInclude(include: Include | Include[]): {
491
- includes: Include[];
776
+ includes: LegacyInclude[];
777
+ correlatedIncludes: CorrelatedInclude[];
492
778
  includeLocalFields: string[];
493
779
  includePaths: string[];
780
+ correlatedReferenceFields: string[];
494
781
  };
782
+ private validateIncludeOutputPath;
783
+ private assertIncludeOutputPaths;
495
784
  private getForeignKeyValues;
496
785
  private getForeignKey;
497
786
  private buildForeignKeyIndex;
@@ -503,6 +792,13 @@ declare class Base<TModel = unknown> {
503
792
  private includeDocsRead;
504
793
  private includeDocsList;
505
794
  private includeDocsCount;
795
+ protected getCorrelatedExecState(): CorrelatedExecState;
796
+ protected claimCorrelatedQuerySlot(): void;
797
+ private sanitizeCorrelatedArgs;
798
+ protected includeCorrelatedDocs<TDoc>(docs: TDoc[], correlatedIncludes: CorrelatedInclude[], snapshots?: unknown[], depth?: number): Promise<TDoc[]>;
799
+ private includeCorrelatedRead;
800
+ private includeCorrelatedList;
801
+ private includeCorrelatedCount;
506
802
  protected parseClientData<TValue>(filter: TValue, scheduler?: RequestConcurrencyScheduler, scheduled?: boolean): Promise<TValue>;
507
803
  private handleSubQuery;
508
804
  private handleDate;
@@ -690,6 +986,7 @@ interface PublicReadOptions {
690
986
  populateAccess?: PopulateAccess;
691
987
  lean?: boolean;
692
988
  includePermissions?: boolean;
989
+ /** Retry an authorized read miss with list access (default true); requires list operation access. Forbidden/BadRequest never retry. */
693
990
  tryList?: boolean;
694
991
  }
695
992
 
@@ -702,6 +999,7 @@ interface PublicUpsertArgs extends PublicUpdateArgs {
702
999
  }
703
1000
  interface UpdateOneArgs<T = unknown> extends Omit<PublicUpdateArgs, 'select' | 'tasks'> {
704
1001
  overrides?: {
1002
+ /** Trusted replacement: nullish generates row policy; false returns Forbidden without filter generation or persistence. */
705
1003
  filter?: Filter<T>;
706
1004
  populate?: Populate[] | string;
707
1005
  };
@@ -709,6 +1007,7 @@ interface UpdateOneArgs<T = unknown> extends Omit<PublicUpdateArgs, 'select' | '
709
1007
  interface UpdateByIdArgs<T = unknown> extends Omit<UpdateOneArgs<T>, 'overrides'> {
710
1008
  overrides?: {
711
1009
  populate?: Populate[] | string;
1010
+ /** Nullish resolves the identifier; false denies without ID/filter generation or persistence. Objects still receive row policy. */
712
1011
  idFilter?: Filter<T>;
713
1012
  };
714
1013
  }
@@ -839,9 +1138,21 @@ type TypedFilterObject<T> = {
839
1138
  };
840
1139
  type TypedFilter<T> = false | TypedFilterObject<WithDefaultId<T>>;
841
1140
  type Filter<T = unknown> = IsUnknown<T> extends true ? LooseFilter : TypedFilter<T>;
842
- interface Include {
1141
+ /**
1142
+ * Batched related-data join. Count uses one grouped aggregate per execution,
1143
+ * counting distinct authorized target documents independently of list pagination.
1144
+ * The target schema casts authorized filters/foreign operands; invalid casts return
1145
+ * BadRequest. Query casting does not execute countDocuments middleware/plugins.
1146
+ */
1147
+ interface LegacyInclude {
1148
+ mode?: 'legacy';
843
1149
  model: string;
844
1150
  op: 'list' | 'read' | 'count';
1151
+ /**
1152
+ * Output path; must not overlap the receiving model's documentPermissionField
1153
+ * (equal, ancestor or descendant, including equivalent bracket paths).
1154
+ * Nested receiving-model settings apply. Rejected before target persistence.
1155
+ */
845
1156
  path: string;
846
1157
  filter?: Filter;
847
1158
  localField: string;
@@ -849,6 +1160,62 @@ interface Include {
849
1160
  args?: unknown;
850
1161
  options?: unknown;
851
1162
  }
1163
+ /**
1164
+ * Explicit structural marker referencing a field of the immediate parent
1165
+ * document (ACI-01 D2.1). Recognized only in filter/id value positions of
1166
+ * correlated includes; magic `$field` strings are never markers.
1167
+ */
1168
+ interface ParentRef {
1169
+ $parent: string;
1170
+ }
1171
+ /** Filter template for correlated includes; values may carry {@link ParentRef} markers. */
1172
+ type CorrelatedFilter = Record<string, unknown>;
1173
+ interface CorrelatedIncludeArgs {
1174
+ select?: Projection;
1175
+ sort?: Sort;
1176
+ skip?: number | string;
1177
+ limit?: number | string;
1178
+ page?: number | string;
1179
+ pageSize?: number | string;
1180
+ include?: Include | Include[];
1181
+ }
1182
+ interface CorrelatedIncludeBase {
1183
+ mode: 'correlated';
1184
+ model: string;
1185
+ op: 'list' | 'read' | 'count';
1186
+ /**
1187
+ * Output-only field path. Must not equal, contain or descend from the receiving
1188
+ * model's documentPermissionField (default `_permissions`). The include tree is
1189
+ * preflighted before target persistence; violations return BadRequest.
1190
+ */
1191
+ path: string;
1192
+ args?: CorrelatedIncludeArgs;
1193
+ options?: Record<string, never>;
1194
+ }
1195
+ /** Identifier read: exactly one of `id` / `filter` must be present. */
1196
+ interface CorrelatedReadByIdInclude extends CorrelatedIncludeBase {
1197
+ op: 'read';
1198
+ id: string | ParentRef;
1199
+ filter?: never;
1200
+ }
1201
+ interface CorrelatedReadByFilterInclude extends CorrelatedIncludeBase {
1202
+ op: 'read';
1203
+ filter: CorrelatedFilter;
1204
+ id?: never;
1205
+ }
1206
+ interface CorrelatedListInclude extends CorrelatedIncludeBase {
1207
+ op: 'list';
1208
+ filter: CorrelatedFilter;
1209
+ id?: never;
1210
+ }
1211
+ interface CorrelatedCountInclude extends CorrelatedIncludeBase {
1212
+ op: 'count';
1213
+ filter: CorrelatedFilter;
1214
+ id?: never;
1215
+ }
1216
+ type CorrelatedInclude = CorrelatedReadByIdInclude | CorrelatedReadByFilterInclude | CorrelatedListInclude | CorrelatedCountInclude;
1217
+ /** Related output cannot overwrite authorization metadata at any supported nested level. */
1218
+ type Include = LegacyInclude | CorrelatedInclude;
852
1219
  type FindAccess = 'list' | 'read';
853
1220
  type PopulateAccess = 'list' | 'read';
854
1221
  interface Populate {
@@ -1056,10 +1423,11 @@ interface SubQueryEntry {
1056
1423
  compact?: boolean;
1057
1424
  };
1058
1425
  }
1426
+ type TaskType = 'COPY_AND_DEPOPULATE' | 'COPY' | 'MOVE' | 'SLICE' | 'COUNT' | 'MASK' | string;
1059
1427
  interface Task {
1060
- type: string;
1428
+ type: TaskType;
1061
1429
  args: unknown;
1062
- options: Record<string, unknown>;
1430
+ options?: Record<string, unknown>;
1063
1431
  }
1064
1432
  interface AccessRouterBaseRequest extends AccessRouterRequest {
1065
1433
  query: Record<'skip' | 'limit' | 'page' | 'page_size' | 'try_list' | 'skim' | 'include_permissions' | 'include_count' | 'include_extra_headers' | 'returning_all', string>;
@@ -1144,6 +1512,7 @@ interface FindArgs<T = unknown> {
1144
1512
  page?: string | number;
1145
1513
  pageSize?: string | number;
1146
1514
  overrides?: {
1515
+ /** Trusted replacement: nullish generates row policy; false returns Forbidden without filter generation or persistence. */
1147
1516
  filter?: Filter<T>;
1148
1517
  select?: Projection;
1149
1518
  populate?: Populate[] | string;
@@ -1162,6 +1531,7 @@ interface FindOneArgs<T = unknown> {
1162
1531
  populate?: Populate[] | string;
1163
1532
  include?: Include | Include[];
1164
1533
  overrides?: {
1534
+ /** Trusted replacement: nullish generates row policy; false returns Forbidden without filter generation or persistence. */
1165
1535
  filter?: Filter<T>;
1166
1536
  select?: Projection;
1167
1537
  populate?: Populate[] | string;
@@ -1181,14 +1551,18 @@ interface FindByIdArgs<T = unknown> {
1181
1551
  overrides?: {
1182
1552
  select?: Projection;
1183
1553
  populate?: Populate[] | string;
1554
+ /** Nullish resolves the identifier; false denies without ID/filter generation or persistence. Objects still receive row policy. */
1184
1555
  idFilter?: Filter<T>;
1185
1556
  };
1186
1557
  }
1187
1558
  interface FindByIdOptions extends FindOneOptions {
1188
1559
  }
1189
1560
 
1561
+ /** Terminal false row policy returns Forbidden in either result mode, before adapter dispatch. */
1190
1562
  interface ExistsOptions {
1563
+ /** Row-policy access, defaulting to read. */
1191
1564
  access?: BaseFilterAccess;
1565
+ /** Return an `{ _id }` record or null instead of a match/miss boolean. Denial is an ErrorResult, never a miss. */
1192
1566
  includeId?: boolean;
1193
1567
  }
1194
1568
 
@@ -1306,6 +1680,7 @@ interface RootRouterOptions {
1306
1680
  operationAccess?: Validation;
1307
1681
  maxBatchEntries?: number;
1308
1682
  maxOrderGroups?: number;
1683
+ /** Whole root operations per order group; separate from requestComplexity.maxBulkConcurrency persistence admission. */
1309
1684
  maxConcurrentOperations?: number;
1310
1685
  }
1311
1686
  interface OperationAccess {
@@ -1330,6 +1705,7 @@ interface DocPermissions {
1330
1705
  }
1331
1706
  interface DefaultModelRouterOptions<TModel = unknown> {
1332
1707
  listHardLimit?: number;
1708
+ /** Authorization metadata path (default `_permissions`); include output cannot equal, contain or descend from it. */
1333
1709
  documentPermissionField?: string;
1334
1710
  idParam?: string;
1335
1711
  idField?: string;
@@ -1356,6 +1732,11 @@ interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultMod
1356
1732
  interface ModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
1357
1733
  modelName?: string;
1358
1734
  basePath?: string;
1735
+ /**
1736
+ * Update grants define assignment boundaries: authorized leaves preserve omitted
1737
+ * siblings; a whole-object/array grant permits replacement (no generic deep merge).
1738
+ * Send nested JSON; literal dotted client keys are not update operators.
1739
+ */
1359
1740
  permissionSchema?: PermissionSchema<AccessRouterFieldKey<TModel>>;
1360
1741
  alwaysSelectFields?: string[];
1361
1742
  docPermissions?: DocPermissions | ModelDocPermissionsHook;
@@ -1364,7 +1745,19 @@ interface ModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions
1364
1745
  decorate?: ModelHook<TModel> | Record<string, ModelHook<TModel>>;
1365
1746
  decorateAll?: ModelListHook<TModel> | Record<string, ModelListHook<TModel>>;
1366
1747
  validate?: ValidateRule | ModelValidateHook | Record<string, ValidateRule | ModelValidateHook>;
1748
+ /**
1749
+ * Trusted model hook after validation of selected client data; output is not
1750
+ * re-filtered and may add protected/server-only fields. During update, supplied
1751
+ * children at partial policy ancestors apply without deleting omitted siblings.
1752
+ * Explicit null/undefined can clear/unset a parent; no output means no assignments.
1753
+ * Use transform document setters for deliberate whole-parent replacement.
1754
+ */
1367
1755
  prepare?: ModelHook<TModel> | Record<string, ModelHook<TModel>>;
1756
+ /**
1757
+ * Trusted live-document hook after update assignment and before save. May replace
1758
+ * protected state explicitly with document setters; do not blindly reintroduce
1759
+ * unfiltered context.originalData. Model hooks are not added to subdocument writes.
1760
+ */
1368
1761
  transform?: ModelDocumentHook<TModel> | Record<string, ModelDocumentHook<TModel>>;
1369
1762
  afterPersist?: ModelDocumentHook<TModel> | Record<string, ModelDocumentHook<TModel>>;
1370
1763
  onChange?: Record<string, ModelChangeHook>;
@@ -1549,11 +1942,22 @@ declare function fromJoi<TSchema extends JoiSchemaLike>(schema: TSchema): Reques
1549
1942
  * diagnostics via mutable `validator.errors`; those errors are snapshotted
1550
1943
  * synchronously before any suspension so concurrent same-turn validations do
1551
1944
  * 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.
1945
+ * (`$async: true`) resolve with validated data, including false/true/null.
1946
+ * AJV `ValidationError` rejections (`ajv: true`, `validation: true`, `errors`
1947
+ * array) are normalized; other throws/rejections preserve operational identity.
1948
+ * Async paths never read shared `validator.errors`.
1949
+ *
1950
+ * Untagged promises/thenables throw TypeError and are observed to prevent
1951
+ * unhandled rejection. Migrate async boolean-verdict wrappers to a custom
1952
+ * RequestSchemaValidator, or retain `$async: true` and return data/reject AJV
1953
+ * validation errors. Sync validators must return boolean verdicts. Real AJV
1954
+ * sync/async validators are accepted without casts; no runtime AJV import is used.
1955
+ * Output is inferred from genuine AJV's type-guard overload (including its async
1956
+ * subtype); structural async output is inferred from the promise. Pass TValue
1957
+ * explicitly for a structural sync boolean validator without a type guard.
1556
1958
  */
1959
+ declare function fromAjv<TValue>(validator: AjvValidatorLike<TValue> & ((value: unknown) => value is TValue)): RequestSchemaValidator<TValue>;
1960
+ /** Adapts structural AJV validators with the same sync-verdict / tagged-async-data contract. */
1557
1961
  declare function fromAjv<TValue = unknown>(validator: AjvValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1558
1962
  declare function fromValibot<TSchema, TOutput = unknown>(schema: TSchema, safeParse: ValibotSafeParseLike): RequestSchemaValidator<TOutput>;
1559
1963
  /**
@@ -1575,4 +1979,4 @@ declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): R
1575
1979
  declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
1576
1980
  declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1577
1981
 
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 };
1982
+ export { type DistinctArgs as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type CreateArgs as D, type CreateOptions as E, type CreateQueryInput as F, CustomHeaders as G, DATA_MIDDLEWARE as H, type DataBaseFilterHook as I, type DataFilter as J, type DataFindArgs as K, type DataFindOneArgs as L, type DataFindOneOptions as M, type DataFindOptions as N, type DataHook as O, type DataHookContext as P, type DataIdentifierHook as Q, type DataListHook as R, type DataOverrideFilterHook as S, type DataRequest as T, type DataRequestSchemas as U, type DataRouterOptions as V, type DecorateAccess as W, type DecorateAllAccess as X, type DeepFieldPath as Y, type DefaultModelRouterOptions as Z, type Defaults as _, type AccessRouterFieldKey as a, type PublicReadOptions as a$, type DistinctBody as a0, type DocPermissionsAccess as a1, type ErrorResult as a2, type ExistsOptions as a3, type ExtendedDataRouterOptions as a4, type ExtendedDefaultModelRouterOptions as a5, type ExtendedModelRouterOptions as a6, type Filter as a7, FilterOperator as a8, type FindAccess as a9, type ModelDocument as aA, type ModelDocumentHook as aB, type ModelHook as aC, type ModelHookContext as aD, type ModelIdentifierHook as aE, type ModelListHook as aF, type ModelOverrideFilterHook as aG, type ModelRequest as aH, type ModelRouterOptions as aI, type ModelValidateHook as aJ, PERMISSIONS as aK, PERMISSION_KEYS as aL, type ParentRef as aM, type PathValue as aN, type PermissionSchema as aO, type Populate as aP, type PopulateAccess as aQ, type PrepareAccess as aR, type Projection as aS, type PublicCreateArgs as aT, type PublicCreateOptions as aU, type PublicErrorResult as aV, type PublicListArgs as aW, type PublicListOptions as aX, type PublicListResult as aY, type PublicOutput as aZ, type PublicReadArgs as a_, type FindArgs as aa, type FindByIdArgs as ab, type FindByIdOptions as ac, type FindOneArgs as ad, type FindOneOptions as ae, type FindOptions as af, type GlobalOptions as ag, type GlobalPermissionValue as ah, type GuardHook as ai, type IdentifierHook as aj, type Include as ak, type IoTsContextEntryLike as al, type IoTsDecodeErrorLike as am, type IoTsDecoderLike as an, type JoiSchemaLike as ao, type JoiValidationErrorDetailLike as ap, type KeyValueProjection as aq, type LegacyInclude as ar, type ListQueryInput as as, type ListResult as at, MIDDLEWARE as au, type MaybePromise as av, type ModelBaseFilterHook as aw, type ModelChangeHook as ax, type ModelDeleteHook as ay, type ModelDocPermissionsHook as az, type AccessRouterLogger as b, type SubdocumentBulkRecord as b$, type PublicServiceResult as b0, type PublicSingleResult as b1, type PublicUpdateArgs as b2, type PublicUpdateOptions as b3, type PublicUpsertArgs as b4, type PublicUpsertOptions as b5, type ReadQueryInput as b6, type Request as b7, type RequestSchemaAdapter as b8, type RequestSchemaFailure as b9, type RootModelUpdateQueryEntry as bA, type RootModelUpsertQueryEntry as bB, type RootOperationResult as bC, type RootQueryEntry as bD, type RootRouterOptions as bE, type RootSubOperation as bF, type RootTarget as bG, type RouteGuardAccess as bH, type SelectAccess as bI, type SelectedPopulatedPublicOutput as bJ, type SelectedPublicOutput as bK, type ServiceResult as bL, type SingleResult as bM, type Sort as bN, type SortOrder as bO, type StandardSchemaFailure as bP, type StandardSchemaInferOutput as bQ, type StandardSchemaIssue as bR, type StandardSchemaPathSegment as bS, type StandardSchemaResult as bT, type StandardSchemaSuccess as bU, type StandardSchemaV1 as bV, StatusCodes as bW, type SubListBody as bX, type SubPopulate as bY, type SubQueryEntry as bZ, type SubReadBody as b_, type RequestSchemaIssue as ba, type RequestSchemaLike as bb, type RequestSchemaOptions as bc, type RequestSchemaResult as bd, type RequestSchemaSuccess as be, type RequestSchemaValidator as bf, type RequestSchemas as bg, type RootDataListQueryEntry as bh, type RootDataOperation as bi, type RootDataReadByFilterQueryEntry as bj, type RootDataReadByIdQueryEntry as bk, type RootModelCountQueryEntry as bl, type RootModelCreateQueryEntry as bm, type RootModelDeleteQueryEntry as bn, type RootModelDistinctQueryEntry as bo, type RootModelListQueryEntry as bp, type RootModelNewQueryEntry as bq, type RootModelOperation as br, type RootModelReadByFilterQueryEntry as bs, type RootModelReadByIdQueryEntry as bt, type RootModelSubBulkUpdateQueryEntry as bu, type RootModelSubCreateQueryEntry as bv, type RootModelSubDeleteQueryEntry as bw, type RootModelSubListQueryEntry as bx, type RootModelSubReadQueryEntry as by, type RootModelSubUpdateQueryEntry as bz, type AccessRouterRequest as c, type OpenApiResponses as c$, type SubdocumentBulkUpdateInput as c0, type SubdocumentCreateInput as c1, type SubdocumentCreateOptions as c2, type SubdocumentId as c3, type SubdocumentListOptions as c4, type SubdocumentName as c5, type SubdocumentParentArgs as c6, type SubdocumentParentOptions as c7, type SubdocumentReadOptions as c8, type SubdocumentRecord as c9, type YupValidationErrorLike as cA, defineRequestSchema as cB, fromAjv as cC, fromArkType as cD, fromIoTs as cE, fromJoi as cF, fromStandardSchema as cG, fromSuperstruct as cH, fromValibot as cI, fromVine as cJ, fromYup as cK, fromZod as cL, parseBody as cM, parseBodyWithSchema as cN, parseNestedBodyWithSchema as cO, parsePathParam as cP, parseQuery as cQ, AccessRuntime as cR, DataService as cS, Service as cT, PublicService as cU, type OpenApiRouterOptions as cV, type OpenApiRegistryOptions as cW, type OpenApiRouteDescriptor as cX, type OpenApiDocumentOptions as cY, type OpenApiParameter as cZ, type OpenApiSchema as c_, type SuperstructFailureLike as ca, type SuperstructValidateLike as cb, type Task as cc, type TaskType as cd, type TransformAccess as ce, type TypedFilter as cf, type UpdateByIdArgs as cg, type UpdateByIdOptions as ch, type UpdateOneArgs as ci, type UpdateOneOptions as cj, type UpdateQueryInput as ck, type UpsertArgs as cl, type UpsertOptions as cm, type UpsertQueryInput as cn, type ValibotIssueLike as co, type ValibotPathItemLike as cp, type ValibotSafeParseLike as cq, type ValibotSafeParseResult as cr, type ValidateAccess as cs, type ValidateRule as ct, type Validation as cu, type ValidationError as cv, type VineValidationErrorLike as cw, type VineValidationMessageLike as cx, type VineValidatorLike as cy, type YupSchemaLike as cz, type AccessRouterRequestExtensions as d, type AccessRouterPermissionMap as d0, type AccessRouterPermissions as d1, type OpenApiMethod as d2, type Permissions as d3, defaultRuntime as d4, 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 CorrelatedCountInclude as s, type CorrelatedFilter as t, type CorrelatedInclude as u, type CorrelatedIncludeArgs as v, type CorrelatedListInclude as w, type CorrelatedReadByFilterInclude as x, type CorrelatedReadByIdInclude as y, type CountBody as z };