@web-ts-toolkit/access-router 0.54.0 → 0.56.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/README.md CHANGED
@@ -17,6 +17,8 @@ ACL-aware Express routers and in-memory data services for Mongoose-backed APIs.
17
17
  [Virtuals](#virtuals-computed-fields) · [Hook admission](#hook-admission-and-reentrant-service-calls) ·
18
18
  [Persistence limits](#persistence-concurrency-and-resource-limits)
19
19
 
20
+ **Private virtual inputs:** [Populated dependencies and runnable example](#private-populated-dependencies)
21
+
20
22
  **Migration:** [Removed overrides](#breaking-release-service-overrides-migration) ·
21
23
  [Server-owned hydration](#breaking-release-server-owned-hydration) ·
22
24
  [Named helpers](#breaking-release-named-helpers-and-default-behavior) ·
@@ -124,7 +126,7 @@ package-managed execution, falling back to `defaultRuntime` outside it.
124
126
 
125
127
  | Layer / public type | Where to put it | Scope and examples |
126
128
  | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
127
- | Runtime/global — `GlobalOptions` | `api.setGlobalOptions({...})`, `api.setGlobalOption(key, value)`; `api.set` is an alias for these forms | That runtime's request grants (`globalPermissions`, `requestPermissionField`), logger, registered-populate policy and `requestComplexity`. |
129
+ | Runtime/global — `GlobalOptions` | `api.setGlobalOptions({...})`, `api.setGlobalOption(key, value)`; `api.set` is an alias for these forms | That runtime's request grants (`globalPermissions`, `requestPermissionField`), logger, registered-populate/private-input read policy and `requestComplexity`. |
128
130
  | Model defaults — `DefaultModelRouterOptions` | `api.setDefaultModelOptions({...})`, `api.setDefaultModelOption(path, value)` | Shared model starting values such as `listHardLimit`, IDs, route segments, `operationAccess`, `hydration` and metadata posture. Data/root routers do not inherit them. |
129
131
  | Model router — `ModelRouterOptions<Model, Virtuals>` | `api.createRouter(Model, {...})`, then `router.setOptions`, `router.setOption` / `router.set` | One registered model's guards, `permissionSchema`, hooks, virtuals, request schemas, `hydration` and method defaults. Routers for the same model/runtime share its stored options. |
130
132
  | Data router — `DataRouterOptions<Data>` | `api.createDataRouter(name, {...})`, its setters, or `api.runtime.setDataOptions` / `setDataOption` | Owned in-memory `data`, list/read guards, request-only fields/filters and decorators. No model `defaults` or model authorization policy. Set `idParam` and `idField` explicitly for data identifier routes. |
@@ -1927,6 +1929,7 @@ Root entrypoint (`@web-ts-toolkit/access-router`):
1927
1929
  - option helpers: `setGlobalOptions`, `setGlobalOption`, `getGlobalOptions`, `getGlobalOption`, `setModelOptions`, `setModelOption`, `getModelOptions`, `getModelOption`, `getModelNames`, `getModelJsonSchema`, `setDefaultModelOptions`, `setDefaultModelOption`, `getDefaultModelOptions`, `getDefaultModelOption`
1928
1930
  - route-policy types: `OperationAccess`, `SubOperationAccess`, `Validation`, `GuardHook`, `RouteVariantAccess`, `ModelRouterOptions`, `DefaultModelRouterOptions`, `DataRouterOptions`, `ExtendedModelRouterOptions`, `ExtendedDefaultModelRouterOptions`, and `ExtendedDataRouterOptions` for typed setters; `PermissionSchema` / `FieldOperationAccess` are separate base-operation field grants. These types are also available from `/advanced`.
1929
1931
  - fetch configuration types (also `/advanced`): `HydrationMode`, `ModelHydrationOptions` — server-owned model/default configuration, never per-call/wire options.
1932
+ - virtual types (also `/advanced`): `ModelVirtualGetter`, `ModelVirtualDescriptor`, `ModelVirtualAccessRecord`, `ModelVirtualLeaf`, `ModelVirtuals`, `ModelVirtualDoc`, `ModelVirtualContext`, `ModelVirtualPopulateDependency`, `ModelVirtualPopulateInputs`. Explicit private target maps type only the fourth getter argument; see [Private populated dependencies](#private-populated-dependencies).
1930
1933
  - trusted service policy types (also `/advanced`): `ServiceAuthorization` (reads), `MutationAuthorization` (update/upsert), `CreateAuthorization`, `InputFieldAuthorization`, `InputFieldPath`, `OutputAuthorization`, `FieldAuthorization`, `RowAuthorization`, `OperationAuthorization`, `RelatedAuthorization`, `OutputFieldPath`. Input paths use persisted types only; output paths also include virtuals. Unknown models have an explicit runtime-validated string fallback; grant arrays may be readonly.
1931
1934
  - named helper/result types (also `/advanced`): `OutputPlanningOptions`, `OutputFieldOptions`, `AllowedOutputFieldOptions`, opaque `DocumentAuthorization`, `ServiceOutputContext`, `ServiceOutputDecorator`, `AuthorizedSingleResult`, `AuthorizedListResult`, `NewArgs`, `NewOptions`. Acquire the service from a router/request; there is no standalone `Service` export or public issuer/execution/prepared API.
1932
1935
 
@@ -2484,8 +2487,12 @@ Only returned field values are committed via document-aware helpers;
2484
2487
  `undefined` omits the field; a throw omits it fail-closed with a structural
2485
2488
  log (no raw values or secret-bearing text). Sibling virtual values are never
2486
2489
  visible regardless of completion order, and mutating getter input cannot change
2487
- response data or lifecycle snapshots. Related documents finalize before parent
2488
- getters run, and embedded children finalize before their parent getter.
2490
+ response data or lifecycle snapshots implicitly. Public related documents finalize
2491
+ before parent getters run, and embedded children finalize before their parent getter.
2492
+ The first getter argument retains that ordinary persisted/local/public-related
2493
+ view. An opted-in getter receives its declaration-scoped **private populated inputs
2494
+ separately in argument four**; see below. A trusted getter may deliberately return
2495
+ a value derived from private inputs, subject to the virtual's output authorization.
2489
2496
 
2490
2497
  Coverage: every document-bearing public model output uses its own model's
2491
2498
  definitions, permissions, selection, and effective access — direct
@@ -2524,9 +2531,8 @@ A create-only getter runs only on create/upsert-create responses; an
2524
2531
  update-only getter only on update/upsert-update responses. On other responses
2525
2532
  the name stays a registered virtual: omitted from output and never entering
2526
2533
  persisted projections, write admission, or sort/filter/distinct handling. A
2527
- read-denied virtual (explicit deny, or document grants fail the rule) never
2528
- runs its getter on any path and fetches nothing for it; a document-dependent
2529
- rule defers to post-fetch evaluation with real grants.
2534
+ known-denied virtual adds no dependency-only fetch and never runs its getter;
2535
+ a document-dependent rule may fetch inputs before real grants deny the getter.
2530
2536
 
2531
2537
  Output-only database/write restrictions: registered virtual names for any
2532
2538
  access (including bare `permissionSchema: true` rules and inapplicable
@@ -2548,7 +2554,9 @@ object or logical branch is retained; a wholly virtual ordinary filter becomes `
2548
2554
 
2549
2555
  Trusted `decorate`/`decorateAll`/tasks boundary: virtuals evaluate before
2550
2556
  `decorate`/`decorateAll`/tasks; internal-only dependency fields are stripped
2551
- before those hooks see the object. Trusted hooks may deliberately construct new
2557
+ before those hooks see the object. Private fourth-argument maps are never implicitly
2558
+ transported there; an authorized getter's deliberate returned value is output.
2559
+ Trusted hooks may deliberately construct new
2552
2560
  output from trusted context; no second authorization pass after those hooks is
2553
2561
  promised.
2554
2562
 
@@ -2559,8 +2567,408 @@ data over per-row database calls. On a 24-row list with 2 getters at
2559
2567
  label via `populate: [{ path: 'addrId', select: ['label'] }]` and a getter
2560
2568
  reading the finalized `doc.addrId` object issued 2 driver reads (batched `$in`)
2561
2569
  with identical output and the same peak bound. Bounds do not collapse N+1
2562
- into 1. Parent getters see only finalized related/embedded outputs and must
2563
- not rely on a related model's stripped private fields.
2570
+ into 1. Argument one contains finalized public related/embedded outputs; it cannot
2571
+ recover stripped related fields. Use an explicit `dependsOnPopulate` declaration
2572
+ and the separate fourth argument when an authorized virtual needs private inputs.
2573
+
2574
+ ### Private populated dependencies
2575
+
2576
+ `dependsOnPopulate: [{ path: 'account', select: ['balance', 'creditLimit'] }]`
2577
+ is trusted **server virtual configuration**, available from the existing root and
2578
+ `/advanced` types. It grants the declaring getter private persisted **input fields**,
2579
+ even when source `account` or target `balance`/`creditLimit` output is denied.
2580
+ The source ref is retained automatically; repeating it in local `dependsOn` is unnecessary.
2581
+
2582
+ - `dependsOn` supplies persisted fields in the current scope through argument one.
2583
+ - Ordinary query `populate` requests public related output under source and target
2584
+ authorization, selection and match rules.
2585
+ - `dependsOnPopulate` supplies one-hop persisted target values **only to that
2586
+ resolved getter's fourth argument**. It neither requests public population nor
2587
+ grants output. HTTP, root, service query and client options cannot declare it.
2588
+
2589
+ #### Runtime private-read mode
2590
+
2591
+ `GlobalOptions.requireReadOperationAccessForPopulateDependencies` defaults to **true**.
2592
+ True requires the original caller's captured target base `operationAccess.read` before
2593
+ private loading. Set **literal boolean false** on the owning runtime to allow declared
2594
+ private computation inputs despite that operation denial:
2595
+
2596
+ <!-- doc-example: partial -->
2597
+
2598
+ ```ts
2599
+ import { createAccessRuntime, type GlobalOptions } from '@web-ts-toolkit/access-router';
2600
+
2601
+ const api = createAccessRuntime();
2602
+ api.setGlobalOptions({ requireReadOperationAccessForPopulateDependencies: false });
2603
+ // The exact setter and api.set(key, value)/api.set(options) aliases are also typed.
2604
+ api.setGlobalOption('requireReadOperationAccessForPopulateDependencies', false);
2605
+ const snapshot: GlobalOptions = api.getGlobalOptions();
2606
+ const mode: boolean | undefined = api.getGlobalOption('requireReadOperationAccessForPopulateDependencies');
2607
+ void [snapshot, mode];
2608
+ ```
2609
+
2610
+ Missing/undefined or malformed JavaScript values (`'false'`, `0`, null, objects)
2611
+ use the conservative true mode; typed setters accept only boolean/undefined. An
2612
+ omitted property in a shallow object setter preserves the current setting. The
2613
+ flag is captured with source/target configuration and query intent **before the first
2614
+ await**. Nested related/embedded/subdocument output retains that call's mode; later
2615
+ calls see updates. Separate runtimes remain isolated.
2616
+
2617
+ This is **server/runtime configuration**, not a model default, service query option,
2618
+ HTTP/root/client control or persisted capability. Business fields with the same
2619
+ spelling keep ordinary data semantics. It is independent of
2620
+ `requireRegisteredPopulateModels`: private targets still require eager registration
2621
+ and valid static server declarations in either mode.
2622
+
2623
+ False bypasses **only private target-operation read admission**. Source/target
2624
+ `permissionSchema` input-field rules are already bypassed by the declaration;
2625
+ the virtual's own output authorization still governs its result. Target request-mode
2626
+ `baseFilter.read`, `overrideFilter.read` and retained source IDs still constrain every
2627
+ private read. False grants no public target read, field, row, query or write authority.
2628
+ If only the virtual is output-eligible, false mode adds no operation check solely to
2629
+ fetch its private inputs. A potentially visible reference has a separate target-read
2630
+ output check in **both** modes, as [specified below](#target-authority-selection-and-reconstruction).
2631
+
2632
+ #### Runnable private dependency example
2633
+
2634
+ Save as `private-populate-example.mts` and run with Node 22.18+ or compile with
2635
+ TypeScript/NodeNext. Install the package, Express and Mongoose as above. This
2636
+ self-contained example creates/removes a uniquely named database, registers the
2637
+ target **before** the source, and checks population, exact IDs and omission, including
2638
+ false-mode computation with a selected/permitted source and denied target. The example
2639
+ tenant is server-owned; real applications derive it from their authenticated actor.
2640
+
2641
+ <!-- doc-example: complete-runtime -->
2642
+
2643
+ ```ts
2644
+ import assert from 'node:assert/strict';
2645
+ import { randomUUID } from 'node:crypto';
2646
+ import { once } from 'node:events';
2647
+ import type { Server } from 'node:http';
2648
+ import express from 'express';
2649
+ import mongoose from 'mongoose';
2650
+ import { createAccessRuntime, type ModelVirtualDescriptor } from '@web-ts-toolkit/access-router';
2651
+
2652
+ interface Account {
2653
+ name: string;
2654
+ balance: number;
2655
+ creditLimit: number;
2656
+ tenantId: string;
2657
+ }
2658
+ interface Order {
2659
+ total: number;
2660
+ account: mongoose.Types.ObjectId | null; // stays a persisted ref, not an Account
2661
+ }
2662
+ interface OrderVirtuals {
2663
+ canPlaceOrder: boolean;
2664
+ }
2665
+
2666
+ async function runPrivatePopulateExample() {
2667
+ const connection = await mongoose
2668
+ .createConnection(process.env.MONGODB_URL ?? 'mongodb://127.0.0.1:27017', {
2669
+ dbName: `private_populate_example_${randomUUID().replaceAll('-', '')}`,
2670
+ })
2671
+ .asPromise();
2672
+ let server: Server | undefined;
2673
+ try {
2674
+ const api = createAccessRuntime();
2675
+ api.setGlobalOptions({ globalPermissions: () => [] });
2676
+ const AccountModel = connection.model<Account>(
2677
+ 'PrivateExampleAccount',
2678
+ new mongoose.Schema<Account>({
2679
+ name: String,
2680
+ balance: { type: Number, select: false },
2681
+ creditLimit: Number,
2682
+ tenantId: String,
2683
+ }),
2684
+ );
2685
+ // Both the actual model instance and its options must exist in this runtime first.
2686
+ const accounts = api.createRouter(AccountModel, {
2687
+ operationAccess: { read: true },
2688
+ baseFilter: { read: () => ({ tenantId: 'shop-a' }) },
2689
+ permissionSchema: { name: true, balance: false, creditLimit: false },
2690
+ stripPermissionsField: true,
2691
+ });
2692
+ const OrderModel = connection.model<Order>(
2693
+ 'PrivateExampleOrder',
2694
+ new mongoose.Schema<Order>({
2695
+ total: Number,
2696
+ account: { type: mongoose.Schema.Types.ObjectId, ref: AccountModel.modelName },
2697
+ }),
2698
+ );
2699
+ // Explicit target map: an ObjectId alone cannot infer its related model.
2700
+ const canPlaceOrder: ModelVirtualDescriptor<Order, boolean, { account: Account }> = {
2701
+ dependsOn: ['total'],
2702
+ dependsOnPopulate: [{ path: 'account', select: ['balance', 'creditLimit'] }],
2703
+ get(doc, _permissions, _context, populated = {}) {
2704
+ const account = populated.account;
2705
+ if (doc.total === undefined || account?.balance === undefined || account.creditLimit === undefined)
2706
+ return undefined;
2707
+ return doc.total <= account.balance + account.creditLimit;
2708
+ },
2709
+ };
2710
+ const orders = api.createRouter<Order, OrderVirtuals>(OrderModel, {
2711
+ basePath: '/orders',
2712
+ operationAccess: { read: true },
2713
+ permissionSchema: { total: false, account: true, canPlaceOrder: true },
2714
+ virtuals: { canPlaceOrder }, // assign the separately typed descriptor normally
2715
+ stripPermissionsField: true,
2716
+ });
2717
+ const account = await AccountModel.create({ name: 'Main', balance: 80, creditLimit: 20, tenantId: 'shop-a' });
2718
+ const order = await OrderModel.create({ total: 90, account: account._id });
2719
+ const app = express();
2720
+ app.use(express.json());
2721
+ app.use(orders.routes);
2722
+ server = app.listen(0, '127.0.0.1');
2723
+ await once(server, 'listening');
2724
+ const address = server.address();
2725
+ assert.ok(address && typeof address !== 'string');
2726
+ const url = `http://127.0.0.1:${address.port}/orders/__query/${order._id}`;
2727
+ async function read(args: object) {
2728
+ const response = await fetch(url, {
2729
+ method: 'POST',
2730
+ headers: { 'content-type': 'application/json' },
2731
+ body: JSON.stringify(args),
2732
+ });
2733
+ assert.equal(response.status, 200);
2734
+ return response.json();
2735
+ }
2736
+ const select = ['account', 'canPlaceOrder', '-_id'];
2737
+ // 1. Public population: fetch name + private inputs, return only the public mask.
2738
+ assert.deepEqual(await read({ select, populate: [{ path: 'account', select: 'name -_id' }] }), {
2739
+ account: { name: 'Main' },
2740
+ canPlaceOrder: true,
2741
+ });
2742
+ // 2. No ordinary population: restore the exact selected/permitted original ID.
2743
+ assert.deepEqual(await read({ select }), { account: String(account._id), canPlaceOrder: true });
2744
+ // 3. Unselected reference: compute privately, omit account entirely.
2745
+ assert.deepEqual(await read({ select: ['canPlaceOrder', '-_id'] }), { canPlaceOrder: true });
2746
+ // Readable-but-unrequested private fields still do not join public output.
2747
+ accounts.setOption('permissionSchema', { name: true, balance: true, creditLimit: true });
2748
+ assert.deepEqual(await read({ select, populate: [{ path: 'account', select: 'name -_id' }] }), {
2749
+ account: { name: 'Main' },
2750
+ canPlaceOrder: true,
2751
+ });
2752
+ // Denying the source field also leaves only the authorized virtual result.
2753
+ orders.permissionSchema('account', false);
2754
+ assert.deepEqual(await read({ select }), { canPlaceOrder: true });
2755
+ // Default true: input-field authority does not bypass the target's base read operation.
2756
+ accounts.setOption('operationAccess.read', false);
2757
+ assert.deepEqual(await read({ select: ['canPlaceOrder', '-_id'] }), {});
2758
+ // Select and permit the source ref: denied target read removes even its ID.
2759
+ orders.permissionSchema('account', true);
2760
+ assert.deepEqual(await read({ select }), {});
2761
+ api.setGlobalOptions({ requireReadOperationAccessForPopulateDependencies: false });
2762
+ assert.deepEqual(await read({ select }), { canPlaceOrder: true });
2763
+ // An ordinary list-populate grant cannot override the additional base-read visibility gate.
2764
+ accounts.setOption('operationAccess.list', true);
2765
+ assert.deepEqual(await read({ select, populate: [{ path: 'account', select: 'name -_id', access: 'list' }] }), {
2766
+ canPlaceOrder: true,
2767
+ });
2768
+ // Strict control: denied target read now prevents private computation too.
2769
+ api.setGlobalOption('requireReadOperationAccessForPopulateDependencies', true);
2770
+ assert.deepEqual(await read({ select }), {});
2771
+ // Allowed-target controls in BOTH modes: original public mask or exact original ID.
2772
+ accounts.setOption('operationAccess.read', true);
2773
+ for (const strict of [true, false]) {
2774
+ api.setGlobalOption('requireReadOperationAccessForPopulateDependencies', strict);
2775
+ assert.deepEqual(await read({ select, populate: [{ path: 'account', select: 'name -_id' }] }), {
2776
+ account: { name: 'Main' },
2777
+ canPlaceOrder: true,
2778
+ });
2779
+ assert.deepEqual(await read({ select }), { account: String(account._id), canPlaceOrder: true });
2780
+ }
2781
+ } finally {
2782
+ if (server)
2783
+ await new Promise<void>((resolve, reject) => server!.close((error) => (error ? reject(error) : resolve())));
2784
+ await connection.dropDatabase();
2785
+ await connection.close();
2786
+ }
2787
+ }
2788
+ runPrivatePopulateExample().catch((error: unknown) => {
2789
+ console.error(error);
2790
+ process.exitCode = 1;
2791
+ });
2792
+ ```
2793
+
2794
+ #### Typing and isolated getter inputs
2795
+
2796
+ `ModelVirtualGetter`, `ModelVirtualDescriptor`, `ModelVirtualAccessRecord` and
2797
+ `ModelVirtualLeaf` accept a third generic `TPopulated`, defaulting to an empty
2798
+ shape. `ModelVirtualPopulateInputs<Source, { account: Account }>` is the fourth
2799
+ argument's type. Known source keys are checked, scalar/array cardinality follows
2800
+ the persisted source field, and unknown cardinality allows both. No target shape
2801
+ is guessed without an annotation; the annotation grants no runtime authority.
2802
+ Neither persisted/write models nor public selected-output models are widened.
2803
+
2804
+ Each mapped key is optional. A scalar is a deeply partial/readonly target or null;
2805
+ an array is a readonly array of partial targets/null slots, or null. Guard missing
2806
+ fields. Native Date/Buffer/BSON scalar types remain native; mutable methods still
2807
+ exist, but every getter, row and repeated array slot receives an isolated copy.
2808
+ The runtime always supplies argument four (`{}` without a declaration). Its type
2809
+ is optional to preserve existing three-argument callbacks **and direct calls**;
2810
+ use `populated = {}` or guard undefined in typed getters.
2811
+
2812
+ Argument one remains the ordinary persisted/local-dependency/finalized-public-related
2813
+ view for every getter. Automatically fetched private-only refs are not added there;
2814
+ an existing local `dependsOn` on that ref keeps its ordinary behavior. Each getter
2815
+ sees only its own resolved declarations and target selections in argument four.
2816
+ Private maps/raw targets are not implicitly attached to response DTOs, contexts,
2817
+ lifecycle snapshots, public permission hooks/metadata, document handles, or ordinary
2818
+ decorate/decorateAll/task inputs. **Only an authorized getter's deliberate return
2819
+ becomes computed output**; this is not a prohibition on returning derived values.
2820
+
2821
+ #### Target authority, selection and reconstruction
2822
+
2823
+ Private targets use captured base **`read`** row semantics, including array refs,
2824
+ source lists, writes and templates. The original actor's `operationAccess.read` gates
2825
+ private loading in default/true mode; false bypasses only that admission. In either
2826
+ mode, `overrideFilter.read` (starting with `{}`) and `baseFilter.read` use request row
2827
+ authority with their normal exact → default → bare fallback/cache rules (including
2828
+ runtime defaults). Mandatory source IDs are ANDed afterward, preserving tenant scope.
2829
+ There is no private read-to-list fallback or route-variant gate. `authorization.related` governs only an ordinary
2830
+ requested populate/include; its grants/replacement rows, public `match`, `access`
2831
+ and `select` cannot redefine private inputs. A related policy naming only a
2832
+ dependency-only path is unused/invalid.
2833
+
2834
+ Only selected, applicable, not-definitely-denied virtuals add dependency work;
2835
+ document-dependent authorization may defer until after fetching. Compatible public
2836
+ and private reads share a positive persisted **fetch union**, including internal
2837
+ identity/hook/join requirements. Their original authorization/output masks stay
2838
+ separate and immutable. Even a readable private field is omitted unless originally
2839
+ selected and permitted. Public exclusions and `-_id` remain effective. Different
2840
+ public match/access/row scopes require independent queries.
2841
+
2842
+ **Independent reference visibility, in both modes:** for paths in an **active selected/
2843
+ applicable `dependsOnPopulate` plan**, the captured target base **read** rule and original
2844
+ actor/permissions decide visibility separately from private fetch availability. It uses
2845
+ the same exact/default/bare/runtime-default semantics, not a route variant or an ordinary
2846
+ populate list/custom rule. A public `authorization.related` operation grant cannot
2847
+ override it. Strict private admission is reused for this decision; false mode evaluates
2848
+ the output-only check only after source selection/field authorization makes output eligible.
2849
+
2850
+ | Source field / captured caller target base read / original query | Returned dependency-backed reference in either mode |
2851
+ | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
2852
+ | Source unselected, excluded or denied | Omitted entirely |
2853
+ | Source selected/permitted, target read denied or check failed | Omitted entirely, **including its ID**, with or without ordinary population |
2854
+ | Source selected/permitted, target read allowed, ordinary population requested/admitted | Original requested and authorized populated projection |
2855
+ | Source selected/permitted, target read allowed, no ordinary population | Exact original ID/array of IDs |
2856
+
2857
+ The original query includes resolved server defaults. A default populate is ordinary
2858
+ population; explicit `populate: []` suppresses it. Allowed ordinary population retains
2859
+ its original target projection, match/missing/null/array behavior. Without admitted
2860
+ ordinary population, read-allowed refs restore exact pre-populate IDs/arrays, including
2861
+ missing target IDs, order, duplicates, nulls, empty arrays and own absence. Denied/failed
2862
+ target-read visibility always takes precedence over ID restoration, including after
2863
+ private row denial/query failure or getter omission/failure/deferred authorization denial.
2864
+ Cleanup runs before output copying/handles and presentation hooks/tasks. **No active
2865
+ dependency plan means ordinary reference/populate behavior is unchanged**; this is not
2866
+ a new gate on every reference in a model with virtuals.
2867
+
2868
+ #### Supported declarations and validation
2869
+
2870
+ - Entries accept **only `{ path, select? }`**: no shorthand string, model, match,
2871
+ access, populate or arbitrary Mongoose options. Duplicate paths within a resolved
2872
+ declaration reject. Different virtuals may declare the same path.
2873
+ - `path` is a top-level, scope-local ObjectId scalar or one-dimensional ObjectId
2874
+ ref array with a static string ref to an actual same-connection, same-runtime,
2875
+ registered ObjectId-identity model. Embedded object/nested/document-array virtuals
2876
+ use their `.sub` scope (declare `account`, not `contacts.account`). Dotted source
2877
+ paths, Map/Mixed/dynamic refs, refPath, function/model-valued refs, virtual populate,
2878
+ discriminator-varying source scopes or discriminator targets, cross-connection
2879
+ targets, non-ObjectId IDs and multidimensional ref arrays reject explicitly.
2880
+ - Target `select` accepts comma/space strings, string arrays, or **1/-1** objects
2881
+ (not Mongo's 1/0). Omitted/undefined/effectively empty (`''`, `[]`, `{}`) means all
2882
+ eligible static persisted fields. Exclusion-only subtracts from that universe;
2883
+ positive paths select eligible descendants, with explicit negatives winning.
2884
+ `_id` is included unless `-_id` (or `{ _id: -1 }`) is declared; association identity
2885
+ is still privately fetched. For example `{ balance: 1, _id: -1 }` supplies only balance.
2886
+ - Static embedded/dotted target fields work. Containers expand to eligible stored
2887
+ leaves; stored target refs remain IDs only. Explicit target virtuals/aliases,
2888
+ unknown/unsafe/control/metadata/version paths, dynamic Map/Mixed paths, ref
2889
+ traversal, `+` tokens, non-string array entries and invalid object values reject,
2890
+ including invalid exclusions. No recursive target virtual computation/private
2891
+ population occurs. Target `requireExplicitSelect` and service defaults do not
2892
+ replace the declaration's selection.
2893
+ - Shared per-access `dependsOnPopulate` inherits independently of `dependsOn`:
2894
+ exact access getter → default getter; a bare getter inherits its shared lists.
2895
+ A leaf's defined list replaces the shared list wholesale, `[]` clears it,
2896
+ undefined inherits, and null rejects. Descriptor arrays/masks and target policies
2897
+ are captured with the getter before asynchronous work; later calls see updates.
2898
+ - Validation is eager and atomic for constructors, bulk and dotted setters. Target
2899
+ model instances **and options must be registered first**, even with
2900
+ `requireRegisteredPopulateModels: false`. For mutually referencing models, register
2901
+ both options before assigning virtuals; self-refs use the proposed source options.
2902
+ Operation capture rechecks schema/target/metadata binding before hooks or writes.
2903
+
2904
+ #### Absence, errors, lifecycle and measured work
2905
+
2906
+ Absent/undefined source refs omit the virtual without invoking it. Present null and
2907
+ empty arrays invoke the getter with null/[] without a target query when private
2908
+ admission/row policy permits. Deleted/out-of-scope target rows become scalar null or null array slots;
2909
+ private arrays preserve original order, duplicates and null/missing slots. Missing
2910
+ target fields remain partial inputs; null/false/zero/empty-string stay present and
2911
+ the getter decides what to return.
2912
+
2913
+ In true mode, target read denial makes dependencies unavailable; in either mode,
2914
+ a terminal false `overrideFilter.read`/`baseFilter.read` does so. Affected virtuals
2915
+ are omitted even for null/empty source refs. In false mode, a denied/failed output-only
2916
+ read check hides the ref without removing otherwise available private computation. A
2917
+ dependency-only query/hook/cast failure also omits them with structural-only logging.
2918
+ There is no raw fallback, retry or new retryable write error: a successful write
2919
+ stays successful. A failed query that also serves ordinary public population keeps
2920
+ that ordinary error path. Getter undefined/throw omits fail-closed; invalid server
2921
+ configuration is a preflight error, not an unavailable input.
2922
+
2923
+ Support covers direct/root/trusted reads, create/update/both upsert branches, `new`,
2924
+ ordinary populated and legacy/correlated included targets, embedded scopes, and
2925
+ visible dedicated subdocument list/read/create/update/bulkUpdate outputs. Count,
2926
+ distinct, exists, delete identities, include-count and field helpers add no private
2927
+ dependency I/O/getters. `SubPopulate` remains path/select-only. Writes capture
2928
+ post-save/post-afterPersist refs on detached output copies after lifecycle work;
2929
+ hidden mutation rows do not run getters. `new` still ignores `args.select`, uses
2930
+ create access, and loads present default refs under the captured private-read mode and
2931
+ request read-row scope without saving.
2932
+
2933
+ Private fetches use the receiving output's captured hydration: source read mode for
2934
+ direct reads/populate, fixed lean for include targets, hydrated for dedicated child
2935
+ read/list and ordinary writes/templates, fixed lean for child mutation visibility.
2936
+ Restoration is exact relative to that pre-populate materialized value, not raw BSON
2937
+ parity across modes. Defaults/getters/transforms/init hooks and dotted projection's
2938
+ omitted null containers can differ; see the [hydration caveat](#breaking-release-server-owned-hydration).
2939
+
2940
+ Measured batching: with two compatible target groups, **1 and 24 source rows both
2941
+ issued 1 parent find + 2 target finds**, in lean and hydrated modes. Getter counts
2942
+ were 4 and 96; observed persistence/getter peaks were 1/1 or 2/2 at matching limits.
2943
+ Compatible rows/virtuals/scopes batch and deduplicate fetched IDs, not reconstructed
2944
+ slots or public authorization. Covered raw work can be reused only within its
2945
+ captured request/runtime/family/private-read mode, hydration and ID/projection coverage. Different scopes
2946
+ still query separately; ordinary per-parent correlated public queries remain
2947
+ per-parent. This is not a constant-query-count promise for independent includes.
2948
+
2949
+ **Compatibility:** existing bare/descriptor/per-access getters and local `dependsOn`
2950
+ keep their first-argument and three-argument direct-call contract. Opt in by adding
2951
+ the declaration and a separately typed descriptor/default fourth argument; no new
2952
+ router-wide generic, entrypoint, client API or persisted-field migration is required.
2953
+ The declaration's opt-in constraints are eager target registration and strict static
2954
+ reference/target-selection validation; ordinary public populate grammar is unchanged.
2955
+
2956
+ #### Release compatibility: dependency-reference omission
2957
+
2958
+ This release intentionally tightens the earlier private-dependency **D1** contract:
2959
+ for active dependency-backed refs, denied/failed caller target base read now removes
2960
+ the **entire field, including IDs**, even in default/true mode. Earlier denied ordinary
2961
+ population could leave IDs behind; that fallback is superseded in this scope, even
2962
+ without an ordinary populate descriptor and even with public list/custom access or a
2963
+ trusted related-operation grant. No active plan/no feature retains ordinary behavior.
2964
+
2965
+ Consumers must handle absent dependency-backed refs rather than assuming a denied
2966
+ population leaves an ID. Keep the default true for strict private admission, or set
2967
+ false explicitly when the authorized virtual is intended to compute despite target
2968
+ operation denial. False does **not** restore denied IDs or relax row filters. To return
2969
+ references, independently permit the source field and caller-context target base read;
2970
+ ordinary population still applies its original requested/authorized mask. Existing local
2971
+ views, fourth-argument isolation, registration, static-ref and hydration limitations remain.
2564
2972
 
2565
2973
  ### Hook admission and reentrant service calls
2566
2974
 
package/advanced.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualRecordAccess, b2 as ModelVirtuals, b3 as MutationAuthorization, b4 as NewArgs, b5 as NewOptions, b6 as OperationAccess, b7 as OperationAuthorization, b8 as OutputAuthorization, b9 as OutputFieldOptions, ba as OutputFieldPath, bb as OutputPlanningOptions, bc as PERMISSIONS, bd as PERMISSION_KEYS, be as PairedRouteAccess, bf as ParentRef, bg as PathValue, bh as PermissionSchema, bi as Populate, bj as PopulateAccess, bk as PopulatePlanningOptions, bl as PrepareAccess, bm as Projection, bn as PublicCreateArgs, bo as PublicCreateOptions, bp as PublicErrorResult, bq as PublicListArgs, br as PublicListOptions, bs as PublicListResult, bt as PublicOutput, bu as PublicReadArgs, bv as PublicReadOptions, bw as PublicServiceResult, bx as PublicSingleResult, by as PublicSubdocumentCreateOptions, bz as PublicSubdocumentListOptions, bA as PublicSubdocumentMutationOptions, bB as PublicSubdocumentReadOptions, bC as PublicUpdateArgs, bD as PublicUpdateOptions, bE as PublicUpsertArgs, bF as PublicUpsertOptions, bG as ReadQueryInput, bH as RelatedAuthorization, bI as Request, bJ as RequestSchemaAdapter, bK as RequestSchemaFailure, bL as RequestSchemaIssue, bM as RequestSchemaLike, bN as RequestSchemaOptions, bO as RequestSchemaResult, bP as RequestSchemaSuccess, bQ as RequestSchemaValidator, bR as RequestSchemas, bS as RootDataListQueryEntry, bT as RootDataOperation, bU as RootDataReadByFilterQueryEntry, bV as RootDataReadByIdQueryEntry, bW as RootModelCountQueryEntry, bX as RootModelCreateQueryEntry, bY as RootModelDeleteQueryEntry, bZ as RootModelDistinctQueryEntry, b_ as RootModelListQueryEntry, b$ as RootModelNewQueryEntry, c0 as RootModelOperation, c1 as RootModelReadByFilterQueryEntry, c2 as RootModelReadByIdQueryEntry, c3 as RootModelSubBulkUpdateQueryEntry, c4 as RootModelSubCreateQueryEntry, c5 as RootModelSubDeleteQueryEntry, c6 as RootModelSubListQueryEntry, c7 as RootModelSubReadQueryEntry, c8 as RootModelSubUpdateQueryEntry, c9 as RootModelUpdateQueryEntry, ca as RootModelUpsertQueryEntry, cb as RootOperationResult, cc as RootQueryEntry, cd as RootRouterOptions, ce as RootSubOperation, cf as RootTarget, cg as RouteBaseAccess, ch as RouteGuardAccess, ci as RouteVariant, cj as RouteVariantAccess, ck as RowAuthorization, cl as SelectAccess, cm as SelectedPopulatedPublicOutput, cn as SelectedPublicOutput, co as ServiceAuthorization, cp as ServiceOutputContext, cq as ServiceOutputDecorator, cr as ServiceResult, cs as SingleResult, ct as Sort, cu as SortOrder, cv as StandardSchemaFailure, cw as StandardSchemaInferOutput, cx as StandardSchemaIssue, cy as StandardSchemaPathSegment, cz as StandardSchemaResult, cA as StandardSchemaSuccess, cB as StandardSchemaV1, cC as StatusCodes, cD as SubListBody, cE as SubOperationAccess, cF as SubPopulate, cG as SubQueryEntry, cH as SubReadBody, cI as SubRouteGuardOptions, cJ as SubdocumentBulkRecord, cK as SubdocumentBulkUpdateInput, cL as SubdocumentCreateAuthorization, cM as SubdocumentCreateInput, cN as SubdocumentCreateOptions, cO as SubdocumentCreateVisibilityAuthorization, cP as SubdocumentDeleteAuthorization, cQ as SubdocumentDeleteOptions, cR as SubdocumentGateAuthorization, cS as SubdocumentId, cT as SubdocumentInputAuthorization, cU as SubdocumentListOptions, cV as SubdocumentModel, cW as SubdocumentMutationAuthorization, cX as SubdocumentName, cY as SubdocumentOutputAuthorization, cZ as SubdocumentParentArgs, c_ as SubdocumentParentOptions, c$ as SubdocumentReadAuthorization, d0 as SubdocumentReadOptions, d1 as SubdocumentRecord, d2 as SubdocumentUpdateOptions, d3 as SubdocumentVirtuals, d4 as SubdocumentVisibilityAuthorization, d5 as SuperstructFailureLike, d6 as SuperstructValidateLike, d7 as Task, d8 as TaskType, d9 as TransformAccess, da as TypedFilter, db as UpdateByIdArgs, dc as UpdateByIdOptions, dd as UpdateOneArgs, de as UpdateOneOptions, df as UpdateQueryInput, dg as UpsertArgs, dh as UpsertOptions, di as UpsertQueryInput, dj as ValibotIssueLike, dk as ValibotPathItemLike, dl as ValibotSafeParseLike, dm as ValibotSafeParseResult, dn as ValidateAccess, dp as ValidateRule, dq as Validation, dr as ValidationError, ds as VineValidationErrorLike, dt as VineValidationMessageLike, du as VineValidatorLike, dv as VirtualSubModel, dw as WithVirtuals, dx as YupSchemaLike, dy as YupValidationErrorLike, dz as defineRequestSchema, dA as fromAjv, dB as fromArkType, dC as fromIoTs, dD as fromJoi, dE as fromStandardSchema, dF as fromSuperstruct, dG as fromValibot, dH as fromVine, dI as fromYup, dJ as fromZod, dK as parseBody, dL as parseBodyWithSchema, dM as parseNestedBodyWithSchema, dN as parsePathParam, dO as parseQuery } from './parsers-ZSrF7SNu.mjs';
1
+ export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-BXKoUKMa.mjs';
2
2
  import { z } from 'zod';
3
3
  import 'mongoose';
4
4
  import 'express';
package/advanced.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualRecordAccess, b2 as ModelVirtuals, b3 as MutationAuthorization, b4 as NewArgs, b5 as NewOptions, b6 as OperationAccess, b7 as OperationAuthorization, b8 as OutputAuthorization, b9 as OutputFieldOptions, ba as OutputFieldPath, bb as OutputPlanningOptions, bc as PERMISSIONS, bd as PERMISSION_KEYS, be as PairedRouteAccess, bf as ParentRef, bg as PathValue, bh as PermissionSchema, bi as Populate, bj as PopulateAccess, bk as PopulatePlanningOptions, bl as PrepareAccess, bm as Projection, bn as PublicCreateArgs, bo as PublicCreateOptions, bp as PublicErrorResult, bq as PublicListArgs, br as PublicListOptions, bs as PublicListResult, bt as PublicOutput, bu as PublicReadArgs, bv as PublicReadOptions, bw as PublicServiceResult, bx as PublicSingleResult, by as PublicSubdocumentCreateOptions, bz as PublicSubdocumentListOptions, bA as PublicSubdocumentMutationOptions, bB as PublicSubdocumentReadOptions, bC as PublicUpdateArgs, bD as PublicUpdateOptions, bE as PublicUpsertArgs, bF as PublicUpsertOptions, bG as ReadQueryInput, bH as RelatedAuthorization, bI as Request, bJ as RequestSchemaAdapter, bK as RequestSchemaFailure, bL as RequestSchemaIssue, bM as RequestSchemaLike, bN as RequestSchemaOptions, bO as RequestSchemaResult, bP as RequestSchemaSuccess, bQ as RequestSchemaValidator, bR as RequestSchemas, bS as RootDataListQueryEntry, bT as RootDataOperation, bU as RootDataReadByFilterQueryEntry, bV as RootDataReadByIdQueryEntry, bW as RootModelCountQueryEntry, bX as RootModelCreateQueryEntry, bY as RootModelDeleteQueryEntry, bZ as RootModelDistinctQueryEntry, b_ as RootModelListQueryEntry, b$ as RootModelNewQueryEntry, c0 as RootModelOperation, c1 as RootModelReadByFilterQueryEntry, c2 as RootModelReadByIdQueryEntry, c3 as RootModelSubBulkUpdateQueryEntry, c4 as RootModelSubCreateQueryEntry, c5 as RootModelSubDeleteQueryEntry, c6 as RootModelSubListQueryEntry, c7 as RootModelSubReadQueryEntry, c8 as RootModelSubUpdateQueryEntry, c9 as RootModelUpdateQueryEntry, ca as RootModelUpsertQueryEntry, cb as RootOperationResult, cc as RootQueryEntry, cd as RootRouterOptions, ce as RootSubOperation, cf as RootTarget, cg as RouteBaseAccess, ch as RouteGuardAccess, ci as RouteVariant, cj as RouteVariantAccess, ck as RowAuthorization, cl as SelectAccess, cm as SelectedPopulatedPublicOutput, cn as SelectedPublicOutput, co as ServiceAuthorization, cp as ServiceOutputContext, cq as ServiceOutputDecorator, cr as ServiceResult, cs as SingleResult, ct as Sort, cu as SortOrder, cv as StandardSchemaFailure, cw as StandardSchemaInferOutput, cx as StandardSchemaIssue, cy as StandardSchemaPathSegment, cz as StandardSchemaResult, cA as StandardSchemaSuccess, cB as StandardSchemaV1, cC as StatusCodes, cD as SubListBody, cE as SubOperationAccess, cF as SubPopulate, cG as SubQueryEntry, cH as SubReadBody, cI as SubRouteGuardOptions, cJ as SubdocumentBulkRecord, cK as SubdocumentBulkUpdateInput, cL as SubdocumentCreateAuthorization, cM as SubdocumentCreateInput, cN as SubdocumentCreateOptions, cO as SubdocumentCreateVisibilityAuthorization, cP as SubdocumentDeleteAuthorization, cQ as SubdocumentDeleteOptions, cR as SubdocumentGateAuthorization, cS as SubdocumentId, cT as SubdocumentInputAuthorization, cU as SubdocumentListOptions, cV as SubdocumentModel, cW as SubdocumentMutationAuthorization, cX as SubdocumentName, cY as SubdocumentOutputAuthorization, cZ as SubdocumentParentArgs, c_ as SubdocumentParentOptions, c$ as SubdocumentReadAuthorization, d0 as SubdocumentReadOptions, d1 as SubdocumentRecord, d2 as SubdocumentUpdateOptions, d3 as SubdocumentVirtuals, d4 as SubdocumentVisibilityAuthorization, d5 as SuperstructFailureLike, d6 as SuperstructValidateLike, d7 as Task, d8 as TaskType, d9 as TransformAccess, da as TypedFilter, db as UpdateByIdArgs, dc as UpdateByIdOptions, dd as UpdateOneArgs, de as UpdateOneOptions, df as UpdateQueryInput, dg as UpsertArgs, dh as UpsertOptions, di as UpsertQueryInput, dj as ValibotIssueLike, dk as ValibotPathItemLike, dl as ValibotSafeParseLike, dm as ValibotSafeParseResult, dn as ValidateAccess, dp as ValidateRule, dq as Validation, dr as ValidationError, ds as VineValidationErrorLike, dt as VineValidationMessageLike, du as VineValidatorLike, dv as VirtualSubModel, dw as WithVirtuals, dx as YupSchemaLike, dy as YupValidationErrorLike, dz as defineRequestSchema, dA as fromAjv, dB as fromArkType, dC as fromIoTs, dD as fromJoi, dE as fromStandardSchema, dF as fromSuperstruct, dG as fromValibot, dH as fromVine, dI as fromYup, dJ as fromZod, dK as parseBody, dL as parseBodyWithSchema, dM as parseNestedBodyWithSchema, dN as parsePathParam, dO as parseQuery } from './parsers-ZSrF7SNu.js';
1
+ export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-BXKoUKMa.js';
2
2
  import { z } from 'zod';
3
3
  import 'mongoose';
4
4
  import 'express';