@web-ts-toolkit/access-router 0.52.0 → 0.54.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 +175 -14
- package/advanced.d.mts +1 -4
- package/advanced.d.ts +1 -4
- package/advanced.js +81 -5
- package/advanced.mjs +81 -5
- package/index.d.mts +7 -4
- package/index.d.ts +7 -4
- package/index.js +840 -658
- package/index.mjs +436 -254
- package/llms.txt +4 -1
- package/package.json +3 -3
- package/{parsers-BnmChTfF.d.mts → parsers-ZSrF7SNu.d.mts} +71 -26
- package/{parsers-BnmChTfF.d.ts → parsers-ZSrF7SNu.d.ts} +71 -26
- package/processors.js +86 -47
- package/processors.mjs +49 -10
package/llms.txt
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- [Installation](README.md#installation) · [Shortest public-read router](README.md#quick-start)
|
|
17
17
|
- [Configuration-layer map](README.md#configuration-layers) · [Assignment, precedence and capture](README.md#assignment-precedence-and-capture) · [Wire placement](README.md#wire-placement-and-option-names)
|
|
18
18
|
- [Names with different jobs](README.md#names-with-different-jobs) · [skim: deprecated compatibility no-op](README.md#skim-compatibility-no-op)
|
|
19
|
-
- [Runtime isolation and nullish grants](README.md#default-runtime-vs-isolated-runtime) · [Factory overloads](README.md#createrouter-overloads) · [Optional
|
|
19
|
+
- [Runtime isolation and nullish grants](README.md#default-runtime-vs-isolated-runtime) · [Factory overloads](README.md#createrouter-overloads) · [Optional raw-document metadata getter](README.md#optional-permissions-plugin)
|
|
20
20
|
- [Operation matrix and fallback](README.md#basic-and-advanced-operation-access) · [Live setters](README.md#live-updates-and-option-snapshots)
|
|
21
21
|
- [Data list/read](README.md#data-routers) · [Data ownership/native values](README.md#in-memory-data-ownership) · [Runnable data example](README.md#runnable-data-router-split)
|
|
22
22
|
- [Root batches: maxOrderGroups bounds both group count and numeric order](README.md#root-batch-bounds)
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
## Business and migration contracts
|
|
26
26
|
|
|
27
|
+
- [Server-owned hydration and migration](README.md#breaking-release-server-owned-hydration): root/advanced types `HydrationMode` and `ModelHydrationOptions`; model/starting-default `hydration` has exactly publicList (built-in lean), publicRead/find/findOne/findById (built-in hydrated). Records replace shallowly; exact dotted setters update one member. Fresh calls capture their owning runtime; in-flight calls keep theirs. Move defaults.*Options.lean/service.defaults deliberately to model-wide configuration (true → 'lean', false → 'hydrated'); legacy method-default controls throw. No per-call/client/wire replacement; stale permissive keys are inert, strict correlated options still reject, and business fields keep their meaning.
|
|
28
|
+
- [Fixed/related modes and value caveat](README.md#breaking-release-server-owned-hydration): includes/post-save subdocument visibility stay lean; raw parents/lifecycle documents stay hydrated; $$sq uses target public configuration; populate inherits its parent query. Plain finalized results do not imply identical schema defaults/getters/transforms/init-hook values or a measured speedup.
|
|
29
|
+
- [Finalized permissions alias](README.md#finalized-permissions-alias): non-enumerable value alias to already-exposed canonical metadata, including dotted paths, independent of hydration/plugin. Stripping suppresses it; business/virtual/include collisions win. Package copies preserve it where metadata exists; no metadata synthesis or arbitrary-copy/client-wrapper promise. The optional Mongoose raw getter is separate.
|
|
27
30
|
- [Trusted service authorization](README.md#trusted-service-authorization) · [Request admission](README.md#public-request-admission-and-backend-options): policy is server-only; wire/default control slots reject it.
|
|
28
31
|
- [Selection, grants and document handles](README.md#selection-grants-and-document-results) · [Runnable Mongo authorization example](README.md#runnable-authorization-and-handle-reuse)
|
|
29
32
|
- [Independent mutation input](README.md#independent-mutation-input-authority) · [Scoped subdocuments](README.md#dedicated-subdocument-authorization) · [Successful hidden-write responses](README.md#subdocument-writes-with-hidden-responses)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/access-router",
|
|
3
3
|
"description": "ACL-aware Express routers and in-memory data services for Mongoose-backed APIs",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/access-router",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.54.0",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"./**/index.js",
|
|
8
8
|
"./**/index.mjs",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"node": ">=22"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@web-ts-toolkit/express-json-router": "0.
|
|
61
|
-
"@web-ts-toolkit/utils": "0.
|
|
60
|
+
"@web-ts-toolkit/express-json-router": "0.54.0",
|
|
61
|
+
"@web-ts-toolkit/utils": "0.54.0",
|
|
62
62
|
"just-diff": "^6.0.2",
|
|
63
63
|
"mongoose-schema-jsonschema": "^4.0.1",
|
|
64
64
|
"sift": "^17.1.3",
|
|
@@ -334,6 +334,7 @@ interface PublicListArgs {
|
|
|
334
334
|
pageSize?: string | number;
|
|
335
335
|
tasks?: Task | Task[];
|
|
336
336
|
}
|
|
337
|
+
/** Request presentation options. Fetch mode is server model hydration.publicList (built-in lean). */
|
|
337
338
|
interface PublicListOptions {
|
|
338
339
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
339
340
|
skim?: boolean;
|
|
@@ -349,8 +350,6 @@ interface PublicListOptions {
|
|
|
349
350
|
/** Exact authorized match total, independent of pagination (default false). Wire requests also control HTTP metadata exposure. */
|
|
350
351
|
includeCount?: boolean;
|
|
351
352
|
populateAccess?: PopulateAccess;
|
|
352
|
-
/** Mongoose hydration choice (public list default true); authorization and virtuals still run. Supported by service/root options. */
|
|
353
|
-
lean?: boolean;
|
|
354
353
|
}
|
|
355
354
|
|
|
356
355
|
interface KeyValueProjection {
|
|
@@ -981,17 +980,24 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
981
980
|
protected model: any;
|
|
982
981
|
protected get options(): ModelRouterOptions<TModel, TVirtuals>;
|
|
983
982
|
private defaultsOverride?;
|
|
983
|
+
/**
|
|
984
|
+
* Presentation/query defaults for this service instance; an explicit assignment
|
|
985
|
+
* replaces the runtime defaults bag, not a per-bucket merge. Fetch mode belongs
|
|
986
|
+
* to the owning model's hydration configuration and affects all its services.
|
|
987
|
+
* Legacy method-option lean/hydration keys throw on assignment and before calls
|
|
988
|
+
* if an assigned JavaScript bag is later mutated.
|
|
989
|
+
*/
|
|
984
990
|
get defaults(): Defaults<TModel>;
|
|
985
991
|
set defaults(value: Defaults<TModel>);
|
|
986
992
|
protected baseFields: string[];
|
|
987
993
|
protected get baseFieldsExt(): string[];
|
|
988
994
|
private readonly hookGate;
|
|
989
995
|
private readonly persist;
|
|
996
|
+
/** Raw hydrated parent/null. Fetch mode is fixed, independent of model read settings. */
|
|
990
997
|
findRawParentDoc(args: {
|
|
991
998
|
filter: Filter<TModel>;
|
|
992
999
|
select: string;
|
|
993
1000
|
populate: unknown;
|
|
994
|
-
lean: boolean;
|
|
995
1001
|
}): any;
|
|
996
1002
|
protected createModelAdapter(modelName: string): any;
|
|
997
1003
|
protected getModelRouterOptions(modelName: string): ModelRouterOptions<TModel, TVirtuals>;
|
|
@@ -1103,19 +1109,6 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
1103
1109
|
finalizePopulateForSubParent(parentDoc: unknown, populateEntries: Populate[], parentOperation: string, hookLimit?: number, sharedGate?: SharedHookGate): Promise<void>;
|
|
1104
1110
|
private filterAllowedFieldsForVirtuals;
|
|
1105
1111
|
private stripVirtualsFromFilterForSnapshot;
|
|
1106
|
-
/**
|
|
1107
|
-
* Preserve the `permissions` Mongoose virtual (from `permissionsPlugin`) for
|
|
1108
|
-
* hydrated outputs. `isolateDocForOutput` uses `toObject({ virtuals: false })`
|
|
1109
|
-
* so Mongoose getter virtuals never leak into package-virtual planning;
|
|
1110
|
-
* `lean: true` therefore drops them (explicit parity rule). For `lean: false`
|
|
1111
|
-
* (hydrated Mongoose documents) the historical contract exposes
|
|
1112
|
-
* `doc.permissions` as an alias of the document-permission field. The shared
|
|
1113
|
-
* finalizer keeps only the document-permission field, so restore the alias
|
|
1114
|
-
* here for backward compatibility when the input was hydrated and the
|
|
1115
|
-
* virtual existed. Lean outputs stay without the virtual. Models without
|
|
1116
|
-
* the plugin never had the virtual and stay unchanged.
|
|
1117
|
-
*/
|
|
1118
|
-
private preservePermissionsVirtual;
|
|
1119
1112
|
/**
|
|
1120
1113
|
* VIRT-05 populate + association helpers.
|
|
1121
1114
|
*
|
|
@@ -1302,6 +1295,7 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
1302
1295
|
createSub<S extends string>(id: SubdocumentId, sub: S, data: SubdocumentCreateInput, options?: SubdocumentCreateOptions<TModel, SubdocumentModel<TModel, S>, SubdocumentVirtuals<TVirtuals, S>>): Promise<ListResult | ErrorResult>;
|
|
1303
1296
|
/** Trusted parent-update/child-delete gates and rows; no fields/visibility policy. Returns the removed ID. */
|
|
1304
1297
|
deleteSub<S extends string>(id: SubdocumentId, sub: S, subId: SubdocumentId, options?: SubdocumentDeleteOptions<TModel, SubdocumentModel<TModel, S>>): Promise<SingleResult | ErrorResult>;
|
|
1298
|
+
/** Raw hydrated parent/null, with row policy and populate; no finalized permission metadata. */
|
|
1305
1299
|
getParentDoc(id: SubdocumentId, sub: SubdocumentName, args?: SubdocumentParentArgs, options?: SubdocumentParentOptions): Promise<any>;
|
|
1306
1300
|
}
|
|
1307
1301
|
|
|
@@ -1556,9 +1550,9 @@ type PublicSubdocumentMutationOptions = Readonly<Record<string, never>>;
|
|
|
1556
1550
|
interface SubdocumentParentArgs {
|
|
1557
1551
|
populate?: SubPopulate | SubPopulate[];
|
|
1558
1552
|
}
|
|
1553
|
+
/** Request-only raw-parent lookup access. The returned parent is always hydrated. */
|
|
1559
1554
|
interface SubdocumentParentOptions {
|
|
1560
1555
|
access?: BaseFilterAccess;
|
|
1561
|
-
lean?: boolean;
|
|
1562
1556
|
}
|
|
1563
1557
|
|
|
1564
1558
|
type CrossResourceModelOperation = 'list' | 'read' | 'count';
|
|
@@ -1886,11 +1880,14 @@ interface PublicReadArgs {
|
|
|
1886
1880
|
include?: Include | Include[];
|
|
1887
1881
|
tasks?: Task | Task[];
|
|
1888
1882
|
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Request presentation options. Server model hydration.publicRead (built-in hydrated)
|
|
1885
|
+
* governs both identifier/filter reads and both attempts of their list fallback.
|
|
1886
|
+
*/
|
|
1889
1887
|
interface PublicReadOptions {
|
|
1890
1888
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
1891
1889
|
skim?: boolean;
|
|
1892
1890
|
populateAccess?: PopulateAccess;
|
|
1893
|
-
lean?: boolean;
|
|
1894
1891
|
includePermissions?: boolean;
|
|
1895
1892
|
/**
|
|
1896
1893
|
* Include field-level `_view`/`_edit` maps. Defaults to `includePermissions`
|
|
@@ -2631,6 +2628,7 @@ interface FindArgs<T = unknown> {
|
|
|
2631
2628
|
page?: string | number;
|
|
2632
2629
|
pageSize?: string | number;
|
|
2633
2630
|
}
|
|
2631
|
+
/** Internal list options. Fetch mode is model hydration.find, never a per-call/default lean option. */
|
|
2634
2632
|
interface FindOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> {
|
|
2635
2633
|
/** Trusted server-only per-call policy. Omitted dimensions use request authority; never a wire/default option. */
|
|
2636
2634
|
readonly authorization?: ServiceAuthorization<TModel, TVirtuals>;
|
|
@@ -2648,8 +2646,6 @@ interface FindOptions<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
2648
2646
|
/** Compute exact authorized totalCount independently of pagination (default false). count is returned-row count. */
|
|
2649
2647
|
includeCount?: boolean;
|
|
2650
2648
|
populateAccess?: PopulateAccess;
|
|
2651
|
-
/** Fetch without Mongoose hydration (internal default false). Finalized output still enforces fields and computes virtuals. */
|
|
2652
|
-
lean?: boolean;
|
|
2653
2649
|
}
|
|
2654
2650
|
interface FindOneArgs<T = unknown> {
|
|
2655
2651
|
select?: Projection;
|
|
@@ -2657,6 +2653,7 @@ interface FindOneArgs<T = unknown> {
|
|
|
2657
2653
|
populate?: Populate[] | string;
|
|
2658
2654
|
include?: Include | Include[];
|
|
2659
2655
|
}
|
|
2656
|
+
/** Internal read options. Fetch mode is model hydration.findOne, not an option in this bag. */
|
|
2660
2657
|
interface FindOneOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> {
|
|
2661
2658
|
/** Trusted server-only rows/output/related policy; ordinary selection remains in args.select. */
|
|
2662
2659
|
readonly authorization?: ServiceAuthorization<TModel, TVirtuals>;
|
|
@@ -2664,8 +2661,6 @@ interface FindOneOptions<TModel = unknown, TVirtuals extends object = Record<nev
|
|
|
2664
2661
|
populateAccess?: PopulateAccess;
|
|
2665
2662
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
2666
2663
|
skim?: boolean;
|
|
2667
|
-
/** Fetch without Mongoose hydration (default false), retaining the same output authorization and virtuals. */
|
|
2668
|
-
lean?: boolean;
|
|
2669
2664
|
includePermissions?: boolean;
|
|
2670
2665
|
/**
|
|
2671
2666
|
* Include field-level `_view`/`_edit` maps. Defaults to `includePermissions`
|
|
@@ -2681,6 +2676,7 @@ interface FindByIdArgs<T = unknown> {
|
|
|
2681
2676
|
populate?: Populate[] | string;
|
|
2682
2677
|
include?: Include | Include[];
|
|
2683
2678
|
}
|
|
2679
|
+
/** By-ID options inherit presentation/policy fields, not hydration.findOne; use model hydration.findById. */
|
|
2684
2680
|
interface FindByIdOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> extends FindOneOptions<TModel, TVirtuals> {
|
|
2685
2681
|
}
|
|
2686
2682
|
|
|
@@ -2951,6 +2947,8 @@ interface DataRequestSchemas {
|
|
|
2951
2947
|
* policy belongs here. Each fresh model-service call captures the originating runtime's
|
|
2952
2948
|
* current defaults; nested stages retain that call's snapshot. Explicit service.defaults
|
|
2953
2949
|
* assignments override runtime defaults. Router setters shallowly replace supplied values.
|
|
2950
|
+
* Fetch mode belongs to ModelRouterOptions.hydration; legacy lean/hydration keys
|
|
2951
|
+
* in method option buckets fail with migration diagnostics.
|
|
2954
2952
|
* See README Configuration layers for delegation.
|
|
2955
2953
|
*/
|
|
2956
2954
|
interface Defaults<TModel = unknown> {
|
|
@@ -3124,11 +3122,52 @@ interface DocPermissions {
|
|
|
3124
3122
|
read?: ModelDocPermissionsHook;
|
|
3125
3123
|
update?: ModelDocPermissionsHook;
|
|
3126
3124
|
}
|
|
3125
|
+
/**
|
|
3126
|
+
* Mongoose fetch mode, not an output type. Both modes finalize plain objects;
|
|
3127
|
+
* schema defaults, getters, transforms and init hooks can still change values.
|
|
3128
|
+
*/
|
|
3129
|
+
type HydrationMode = 'lean' | 'hydrated';
|
|
3130
|
+
/**
|
|
3131
|
+
* Server-only model configuration, captured by the owning runtime per call.
|
|
3132
|
+
* Set through ModelRouterOptions/DefaultModelRouterOptions and their whole-record
|
|
3133
|
+
* or exact hydration.<method> setters (including existing model/default decorators).
|
|
3134
|
+
* A supplied record replaces the previous record shallowly; omitted/undefined
|
|
3135
|
+
* members use built-ins, not an older/default record. Whole-record undefined clears
|
|
3136
|
+
* it. Invalid records/keys/modes throw before publication. Fresh calls observe owner
|
|
3137
|
+
* updates; in-flight calls retain their captured configuration.
|
|
3138
|
+
* Includes stay fixed lean; raw parents/lifecycle stages stay hydrated; subdocument
|
|
3139
|
+
* post-save visibility stays lean. Populate inherits its parent query; $$sq uses
|
|
3140
|
+
* target public settings. No per-call, wire, global, data/root or service.defaults
|
|
3141
|
+
* setting exists. Migrate defaults.*Options.lean explicitly (true -> 'lean', false
|
|
3142
|
+
* -> 'hydrated'); a former service-instance choice becomes model-wide in its runtime.
|
|
3143
|
+
* Legacy method-default lean/hydration controls throw migration diagnostics; stale
|
|
3144
|
+
* permissive per-call/wire controls are inert, not a supported configuration path.
|
|
3145
|
+
*/
|
|
3146
|
+
interface ModelHydrationOptions {
|
|
3147
|
+
/** Public lists default to lean. */
|
|
3148
|
+
publicList?: HydrationMode;
|
|
3149
|
+
/** Identifier/filter reads and their list fallback default to hydrated. */
|
|
3150
|
+
publicRead?: HydrationMode;
|
|
3151
|
+
/** Internal find defaults to hydrated, independently of publicList. */
|
|
3152
|
+
find?: HydrationMode;
|
|
3153
|
+
/** Internal findOne defaults to hydrated, independently of publicRead/findById. */
|
|
3154
|
+
findOne?: HydrationMode;
|
|
3155
|
+
/** Internal findById defaults to hydrated; does not inherit findOne's setting. */
|
|
3156
|
+
findById?: HydrationMode;
|
|
3157
|
+
}
|
|
3127
3158
|
/** Model starting defaults; data/root routers do not inherit these. Nested values assign shallowly. */
|
|
3128
3159
|
interface DefaultModelRouterOptions<TModel = unknown> {
|
|
3160
|
+
/** Server-owned fetch choices, captured per call. Not a per-call or method-default option. */
|
|
3161
|
+
hydration?: ModelHydrationOptions;
|
|
3129
3162
|
/** Maximum returned list rows (default 1000), independent of exact match/count totals. */
|
|
3130
3163
|
listHardLimit?: number;
|
|
3131
|
-
/**
|
|
3164
|
+
/**
|
|
3165
|
+
* Serialized metadata path (default `_permissions`, dotted paths supported).
|
|
3166
|
+
* Finalized rows carrying it also get a non-enumerable `permissions` value alias,
|
|
3167
|
+
* independent of hydration/plugin, unless that output property already exists.
|
|
3168
|
+
* The alias is not authority or a live binding; JSON/spread omit it. Include output
|
|
3169
|
+
* cannot equal, contain or descend from the canonical metadata path.
|
|
3170
|
+
*/
|
|
3132
3171
|
documentPermissionField?: string;
|
|
3133
3172
|
/** Express route parameter name (default `id`); fixed at router construction. */
|
|
3134
3173
|
idParam?: string;
|
|
@@ -3178,12 +3217,13 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3178
3217
|
/**
|
|
3179
3218
|
* When `true`, the document permissions field (`documentPermissionField`,
|
|
3180
3219
|
* default `_permissions`) is removed from all outputs — including its empty
|
|
3181
|
-
* placeholder — and
|
|
3220
|
+
* placeholder — and its generated `permissions` alias. Client `includePermissions`/`includeFieldPermissions`
|
|
3182
3221
|
* input (query params, body/root-batch options and service-direct options)
|
|
3183
3222
|
* as well as per-operation `defaults` are ignored (both resolve to `false`).
|
|
3184
3223
|
* Output matches `includePermissions: false` with the permissions field
|
|
3185
3224
|
* removed entirely. Enforcement still runs; only output metadata is
|
|
3186
|
-
* affected
|
|
3225
|
+
* affected; existing business output named `permissions` is not a generated alias.
|
|
3226
|
+
* Defaults to `false`.
|
|
3187
3227
|
*/
|
|
3188
3228
|
stripPermissionsField?: boolean;
|
|
3189
3229
|
/**
|
|
@@ -3196,6 +3236,11 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3196
3236
|
disableFieldPermissions?: boolean;
|
|
3197
3237
|
}
|
|
3198
3238
|
interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
3239
|
+
'hydration.publicList'?: HydrationMode;
|
|
3240
|
+
'hydration.publicRead'?: HydrationMode;
|
|
3241
|
+
'hydration.find'?: HydrationMode;
|
|
3242
|
+
'hydration.findOne'?: HydrationMode;
|
|
3243
|
+
'hydration.findById'?: HydrationMode;
|
|
3199
3244
|
'operationAccess.default'?: Validation;
|
|
3200
3245
|
'operationAccess.new'?: Validation;
|
|
3201
3246
|
'operationAccess.list'?: Validation;
|
|
@@ -3566,4 +3611,4 @@ declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): R
|
|
|
3566
3611
|
declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
|
|
3567
3612
|
declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
|
|
3568
3613
|
|
|
3569
|
-
export { type DecorateAccess as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type CorrelatedReadByFilterInclude as D, type CorrelatedReadByIdInclude as E, type CountBody as F, type CreateArgs as G, type CreateAuthorization as H, type CreateOptions as I, type CreateQueryInput as J, CustomHeaders as K, DATA_MIDDLEWARE as L, type DataBaseFilterHook as M, type DataFieldOptions as N, type DataFilter as O, type DataFindArgs as P, type DataFindOneArgs as Q, type DataFindOneOptions as R, type DataFindOptions as S, type DataHook as T, type DataHookContext as U, type DataIdentifierHook as V, type DataListHook as W, type DataOverrideFilterHook as X, type DataRequest as Y, type DataRequestSchemas as Z, type DataRouterOptions as _, type AccessRouterFieldKey as a, type
|
|
3614
|
+
export { type DecorateAccess as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type CorrelatedReadByFilterInclude as D, type CorrelatedReadByIdInclude as E, type CountBody as F, type CreateArgs as G, type CreateAuthorization as H, type CreateOptions as I, type CreateQueryInput as J, CustomHeaders as K, DATA_MIDDLEWARE as L, type DataBaseFilterHook as M, type DataFieldOptions as N, type DataFilter as O, type DataFindArgs as P, type DataFindOneArgs as Q, type DataFindOneOptions as R, type DataFindOptions as S, type DataHook as T, type DataHookContext as U, type DataIdentifierHook as V, type DataListHook as W, type DataOverrideFilterHook as X, type DataRequest as Y, type DataRequestSchemas as Z, type DataRouterOptions as _, type AccessRouterFieldKey as a, type ModelVirtualGetter as a$, type DecorateAllAccess as a0, type DeepFieldPath as a1, type DefaultModelRouterOptions as a2, type Defaults as a3, type DistinctArgs as a4, type DistinctBody as a5, type DocPermissionsAccess as a6, type DocumentAuthorization as a7, type ErrorResult as a8, type ExistsOptions as a9, type JoiValidationErrorDetailLike as aA, type KeyValueProjection as aB, type LegacyInclude as aC, type ListQueryInput as aD, type ListResult as aE, MIDDLEWARE as aF, type MaybePromise as aG, type ModelBaseFilterHook as aH, type ModelChangeHook as aI, type ModelDeleteHook as aJ, type ModelDocPermissionsHook as aK, type ModelDocument as aL, type ModelDocumentHook as aM, type ModelHook as aN, type ModelHookContext as aO, type ModelHydrationOptions as aP, type ModelIdentifierHook as aQ, type ModelListHook as aR, type ModelOverrideFilterHook as aS, type ModelRequest as aT, type ModelRouterOptions as aU, type ModelValidateHook as aV, type ModelVirtualAccess as aW, type ModelVirtualAccessRecord as aX, type ModelVirtualContext as aY, type ModelVirtualDescriptor as aZ, type ModelVirtualDoc as a_, type ExtendedDataRouterOptions as aa, type ExtendedDefaultModelRouterOptions as ab, type ExtendedModelRouterOptions as ac, type FieldAuthorization as ad, type FieldOperationAccess as ae, type Filter as af, FilterOperator as ag, type FindAccess as ah, type FindArgs as ai, type FindByIdArgs as aj, type FindByIdOptions as ak, type FindOneArgs as al, type FindOneOptions as am, type FindOptions as an, type GlobalOptions as ao, type GlobalPermissionValue as ap, type GuardHook as aq, type HydrationMode as ar, type IdentifierHook as as, type Include as at, type InputFieldAuthorization as au, type InputFieldPath as av, type IoTsContextEntryLike as aw, type IoTsDecodeErrorLike as ax, type IoTsDecoderLike as ay, type JoiSchemaLike as az, type AccessRouterLogger as b, type RootModelNewQueryEntry as b$, type ModelVirtualLeaf as b0, type ModelVirtualRecordAccess as b1, type ModelVirtuals as b2, type MutationAuthorization as b3, type NewArgs as b4, type NewOptions as b5, type OperationAccess as b6, type OperationAuthorization as b7, type OutputAuthorization as b8, type OutputFieldOptions as b9, type PublicSubdocumentMutationOptions as bA, type PublicSubdocumentReadOptions as bB, type PublicUpdateArgs as bC, type PublicUpdateOptions as bD, type PublicUpsertArgs as bE, type PublicUpsertOptions as bF, type ReadQueryInput as bG, type RelatedAuthorization as bH, type Request as bI, type RequestSchemaAdapter as bJ, type RequestSchemaFailure as bK, type RequestSchemaIssue as bL, type RequestSchemaLike as bM, type RequestSchemaOptions as bN, type RequestSchemaResult as bO, type RequestSchemaSuccess as bP, type RequestSchemaValidator as bQ, type RequestSchemas as bR, type RootDataListQueryEntry as bS, type RootDataOperation as bT, type RootDataReadByFilterQueryEntry as bU, type RootDataReadByIdQueryEntry as bV, type RootModelCountQueryEntry as bW, type RootModelCreateQueryEntry as bX, type RootModelDeleteQueryEntry as bY, type RootModelDistinctQueryEntry as bZ, type RootModelListQueryEntry as b_, type OutputFieldPath as ba, type OutputPlanningOptions as bb, PERMISSIONS as bc, PERMISSION_KEYS as bd, type PairedRouteAccess as be, type ParentRef as bf, type PathValue as bg, type PermissionSchema as bh, type Populate as bi, type PopulateAccess as bj, type PopulatePlanningOptions as bk, type PrepareAccess as bl, type Projection as bm, type PublicCreateArgs as bn, type PublicCreateOptions as bo, type PublicErrorResult as bp, type PublicListArgs as bq, type PublicListOptions as br, type PublicListResult as bs, type PublicOutput as bt, type PublicReadArgs as bu, type PublicReadOptions as bv, type PublicServiceResult as bw, type PublicSingleResult as bx, type PublicSubdocumentCreateOptions as by, type PublicSubdocumentListOptions as bz, type AccessRouterRequest as c, type SubdocumentReadAuthorization as c$, type RootModelOperation as c0, type RootModelReadByFilterQueryEntry as c1, type RootModelReadByIdQueryEntry as c2, type RootModelSubBulkUpdateQueryEntry as c3, type RootModelSubCreateQueryEntry as c4, type RootModelSubDeleteQueryEntry as c5, type RootModelSubListQueryEntry as c6, type RootModelSubReadQueryEntry as c7, type RootModelSubUpdateQueryEntry as c8, type RootModelUpdateQueryEntry as c9, type StandardSchemaSuccess as cA, type StandardSchemaV1 as cB, StatusCodes as cC, type SubListBody as cD, type SubOperationAccess as cE, type SubPopulate as cF, type SubQueryEntry as cG, type SubReadBody as cH, type SubRouteGuardOptions as cI, type SubdocumentBulkRecord as cJ, type SubdocumentBulkUpdateInput as cK, type SubdocumentCreateAuthorization as cL, type SubdocumentCreateInput as cM, type SubdocumentCreateOptions as cN, type SubdocumentCreateVisibilityAuthorization as cO, type SubdocumentDeleteAuthorization as cP, type SubdocumentDeleteOptions as cQ, type SubdocumentGateAuthorization as cR, type SubdocumentId as cS, type SubdocumentInputAuthorization as cT, type SubdocumentListOptions as cU, type SubdocumentModel as cV, type SubdocumentMutationAuthorization as cW, type SubdocumentName as cX, type SubdocumentOutputAuthorization as cY, type SubdocumentParentArgs as cZ, type SubdocumentParentOptions as c_, type RootModelUpsertQueryEntry as ca, type RootOperationResult as cb, type RootQueryEntry as cc, type RootRouterOptions as cd, type RootSubOperation as ce, type RootTarget as cf, type RouteBaseAccess as cg, type RouteGuardAccess as ch, type RouteVariant as ci, type RouteVariantAccess as cj, type RowAuthorization as ck, type SelectAccess as cl, type SelectedPopulatedPublicOutput as cm, type SelectedPublicOutput as cn, type ServiceAuthorization as co, type ServiceOutputContext as cp, type ServiceOutputDecorator as cq, type ServiceResult as cr, type SingleResult as cs, type Sort as ct, type SortOrder as cu, type StandardSchemaFailure as cv, type StandardSchemaInferOutput as cw, type StandardSchemaIssue as cx, type StandardSchemaPathSegment as cy, type StandardSchemaResult as cz, type AccessRouterRequestExtensions as d, type AccessRouterPermissions as d$, type SubdocumentReadOptions as d0, type SubdocumentRecord as d1, type SubdocumentUpdateOptions as d2, type SubdocumentVirtuals as d3, type SubdocumentVisibilityAuthorization as d4, type SuperstructFailureLike as d5, type SuperstructValidateLike as d6, type Task as d7, type TaskType as d8, type TransformAccess as d9, fromAjv as dA, fromArkType as dB, fromIoTs as dC, fromJoi as dD, fromStandardSchema as dE, fromSuperstruct as dF, fromValibot as dG, fromVine as dH, fromYup as dI, fromZod as dJ, parseBody as dK, parseBodyWithSchema as dL, parseNestedBodyWithSchema as dM, parsePathParam as dN, parseQuery as dO, AccessRuntime as dP, DataService as dQ, Service as dR, PublicService as dS, type OpenApiRouterOptions as dT, type OpenApiRegistryOptions as dU, type OpenApiRouteDescriptor as dV, type OpenApiDocumentOptions as dW, type OpenApiParameter as dX, type OpenApiSchema as dY, type OpenApiResponses as dZ, type AccessRouterPermissionMap as d_, type TypedFilter as da, type UpdateByIdArgs as db, type UpdateByIdOptions as dc, type UpdateOneArgs as dd, type UpdateOneOptions as de, type UpdateQueryInput as df, type UpsertArgs as dg, type UpsertOptions as dh, type UpsertQueryInput as di, type ValibotIssueLike as dj, type ValibotPathItemLike as dk, type ValibotSafeParseLike as dl, type ValibotSafeParseResult as dm, type ValidateAccess as dn, type ValidateRule as dp, type Validation as dq, type ValidationError as dr, type VineValidationErrorLike as ds, type VineValidationMessageLike as dt, type VineValidatorLike as du, type VirtualSubModel as dv, type WithVirtuals as dw, type YupSchemaLike as dx, type YupValidationErrorLike as dy, defineRequestSchema as dz, type AdvancedCreateBody as e, type OpenApiMethod as e0, type Permissions as e1, defaultRuntime as e2, 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 AllowedOutputFieldOptions as o, type ArkTypeErrorsLike as p, type ArkTypeLike as q, type ArkTypeProblemLike as r, type AuthorizedListResult as s, type AuthorizedSingleResult as t, Codes as u, type CorrelatedCountInclude as v, type CorrelatedFilter as w, type CorrelatedInclude as x, type CorrelatedIncludeArgs as y, type CorrelatedListInclude as z };
|
|
@@ -334,6 +334,7 @@ interface PublicListArgs {
|
|
|
334
334
|
pageSize?: string | number;
|
|
335
335
|
tasks?: Task | Task[];
|
|
336
336
|
}
|
|
337
|
+
/** Request presentation options. Fetch mode is server model hydration.publicList (built-in lean). */
|
|
337
338
|
interface PublicListOptions {
|
|
338
339
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
339
340
|
skim?: boolean;
|
|
@@ -349,8 +350,6 @@ interface PublicListOptions {
|
|
|
349
350
|
/** Exact authorized match total, independent of pagination (default false). Wire requests also control HTTP metadata exposure. */
|
|
350
351
|
includeCount?: boolean;
|
|
351
352
|
populateAccess?: PopulateAccess;
|
|
352
|
-
/** Mongoose hydration choice (public list default true); authorization and virtuals still run. Supported by service/root options. */
|
|
353
|
-
lean?: boolean;
|
|
354
353
|
}
|
|
355
354
|
|
|
356
355
|
interface KeyValueProjection {
|
|
@@ -981,17 +980,24 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
981
980
|
protected model: any;
|
|
982
981
|
protected get options(): ModelRouterOptions<TModel, TVirtuals>;
|
|
983
982
|
private defaultsOverride?;
|
|
983
|
+
/**
|
|
984
|
+
* Presentation/query defaults for this service instance; an explicit assignment
|
|
985
|
+
* replaces the runtime defaults bag, not a per-bucket merge. Fetch mode belongs
|
|
986
|
+
* to the owning model's hydration configuration and affects all its services.
|
|
987
|
+
* Legacy method-option lean/hydration keys throw on assignment and before calls
|
|
988
|
+
* if an assigned JavaScript bag is later mutated.
|
|
989
|
+
*/
|
|
984
990
|
get defaults(): Defaults<TModel>;
|
|
985
991
|
set defaults(value: Defaults<TModel>);
|
|
986
992
|
protected baseFields: string[];
|
|
987
993
|
protected get baseFieldsExt(): string[];
|
|
988
994
|
private readonly hookGate;
|
|
989
995
|
private readonly persist;
|
|
996
|
+
/** Raw hydrated parent/null. Fetch mode is fixed, independent of model read settings. */
|
|
990
997
|
findRawParentDoc(args: {
|
|
991
998
|
filter: Filter<TModel>;
|
|
992
999
|
select: string;
|
|
993
1000
|
populate: unknown;
|
|
994
|
-
lean: boolean;
|
|
995
1001
|
}): any;
|
|
996
1002
|
protected createModelAdapter(modelName: string): any;
|
|
997
1003
|
protected getModelRouterOptions(modelName: string): ModelRouterOptions<TModel, TVirtuals>;
|
|
@@ -1103,19 +1109,6 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
1103
1109
|
finalizePopulateForSubParent(parentDoc: unknown, populateEntries: Populate[], parentOperation: string, hookLimit?: number, sharedGate?: SharedHookGate): Promise<void>;
|
|
1104
1110
|
private filterAllowedFieldsForVirtuals;
|
|
1105
1111
|
private stripVirtualsFromFilterForSnapshot;
|
|
1106
|
-
/**
|
|
1107
|
-
* Preserve the `permissions` Mongoose virtual (from `permissionsPlugin`) for
|
|
1108
|
-
* hydrated outputs. `isolateDocForOutput` uses `toObject({ virtuals: false })`
|
|
1109
|
-
* so Mongoose getter virtuals never leak into package-virtual planning;
|
|
1110
|
-
* `lean: true` therefore drops them (explicit parity rule). For `lean: false`
|
|
1111
|
-
* (hydrated Mongoose documents) the historical contract exposes
|
|
1112
|
-
* `doc.permissions` as an alias of the document-permission field. The shared
|
|
1113
|
-
* finalizer keeps only the document-permission field, so restore the alias
|
|
1114
|
-
* here for backward compatibility when the input was hydrated and the
|
|
1115
|
-
* virtual existed. Lean outputs stay without the virtual. Models without
|
|
1116
|
-
* the plugin never had the virtual and stay unchanged.
|
|
1117
|
-
*/
|
|
1118
|
-
private preservePermissionsVirtual;
|
|
1119
1112
|
/**
|
|
1120
1113
|
* VIRT-05 populate + association helpers.
|
|
1121
1114
|
*
|
|
@@ -1302,6 +1295,7 @@ declare class Service<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
1302
1295
|
createSub<S extends string>(id: SubdocumentId, sub: S, data: SubdocumentCreateInput, options?: SubdocumentCreateOptions<TModel, SubdocumentModel<TModel, S>, SubdocumentVirtuals<TVirtuals, S>>): Promise<ListResult | ErrorResult>;
|
|
1303
1296
|
/** Trusted parent-update/child-delete gates and rows; no fields/visibility policy. Returns the removed ID. */
|
|
1304
1297
|
deleteSub<S extends string>(id: SubdocumentId, sub: S, subId: SubdocumentId, options?: SubdocumentDeleteOptions<TModel, SubdocumentModel<TModel, S>>): Promise<SingleResult | ErrorResult>;
|
|
1298
|
+
/** Raw hydrated parent/null, with row policy and populate; no finalized permission metadata. */
|
|
1305
1299
|
getParentDoc(id: SubdocumentId, sub: SubdocumentName, args?: SubdocumentParentArgs, options?: SubdocumentParentOptions): Promise<any>;
|
|
1306
1300
|
}
|
|
1307
1301
|
|
|
@@ -1556,9 +1550,9 @@ type PublicSubdocumentMutationOptions = Readonly<Record<string, never>>;
|
|
|
1556
1550
|
interface SubdocumentParentArgs {
|
|
1557
1551
|
populate?: SubPopulate | SubPopulate[];
|
|
1558
1552
|
}
|
|
1553
|
+
/** Request-only raw-parent lookup access. The returned parent is always hydrated. */
|
|
1559
1554
|
interface SubdocumentParentOptions {
|
|
1560
1555
|
access?: BaseFilterAccess;
|
|
1561
|
-
lean?: boolean;
|
|
1562
1556
|
}
|
|
1563
1557
|
|
|
1564
1558
|
type CrossResourceModelOperation = 'list' | 'read' | 'count';
|
|
@@ -1886,11 +1880,14 @@ interface PublicReadArgs {
|
|
|
1886
1880
|
include?: Include | Include[];
|
|
1887
1881
|
tasks?: Task | Task[];
|
|
1888
1882
|
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Request presentation options. Server model hydration.publicRead (built-in hydrated)
|
|
1885
|
+
* governs both identifier/filter reads and both attempts of their list fallback.
|
|
1886
|
+
*/
|
|
1889
1887
|
interface PublicReadOptions {
|
|
1890
1888
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
1891
1889
|
skim?: boolean;
|
|
1892
1890
|
populateAccess?: PopulateAccess;
|
|
1893
|
-
lean?: boolean;
|
|
1894
1891
|
includePermissions?: boolean;
|
|
1895
1892
|
/**
|
|
1896
1893
|
* Include field-level `_view`/`_edit` maps. Defaults to `includePermissions`
|
|
@@ -2631,6 +2628,7 @@ interface FindArgs<T = unknown> {
|
|
|
2631
2628
|
page?: string | number;
|
|
2632
2629
|
pageSize?: string | number;
|
|
2633
2630
|
}
|
|
2631
|
+
/** Internal list options. Fetch mode is model hydration.find, never a per-call/default lean option. */
|
|
2634
2632
|
interface FindOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> {
|
|
2635
2633
|
/** Trusted server-only per-call policy. Omitted dimensions use request authority; never a wire/default option. */
|
|
2636
2634
|
readonly authorization?: ServiceAuthorization<TModel, TVirtuals>;
|
|
@@ -2648,8 +2646,6 @@ interface FindOptions<TModel = unknown, TVirtuals extends object = Record<never,
|
|
|
2648
2646
|
/** Compute exact authorized totalCount independently of pagination (default false). count is returned-row count. */
|
|
2649
2647
|
includeCount?: boolean;
|
|
2650
2648
|
populateAccess?: PopulateAccess;
|
|
2651
|
-
/** Fetch without Mongoose hydration (internal default false). Finalized output still enforces fields and computes virtuals. */
|
|
2652
|
-
lean?: boolean;
|
|
2653
2649
|
}
|
|
2654
2650
|
interface FindOneArgs<T = unknown> {
|
|
2655
2651
|
select?: Projection;
|
|
@@ -2657,6 +2653,7 @@ interface FindOneArgs<T = unknown> {
|
|
|
2657
2653
|
populate?: Populate[] | string;
|
|
2658
2654
|
include?: Include | Include[];
|
|
2659
2655
|
}
|
|
2656
|
+
/** Internal read options. Fetch mode is model hydration.findOne, not an option in this bag. */
|
|
2660
2657
|
interface FindOneOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> {
|
|
2661
2658
|
/** Trusted server-only rows/output/related policy; ordinary selection remains in args.select. */
|
|
2662
2659
|
readonly authorization?: ServiceAuthorization<TModel, TVirtuals>;
|
|
@@ -2664,8 +2661,6 @@ interface FindOneOptions<TModel = unknown, TVirtuals extends object = Record<nev
|
|
|
2664
2661
|
populateAccess?: PopulateAccess;
|
|
2665
2662
|
/** @deprecated Compatibility no-op. Authorization, document grants, virtuals and decoration always run. */
|
|
2666
2663
|
skim?: boolean;
|
|
2667
|
-
/** Fetch without Mongoose hydration (default false), retaining the same output authorization and virtuals. */
|
|
2668
|
-
lean?: boolean;
|
|
2669
2664
|
includePermissions?: boolean;
|
|
2670
2665
|
/**
|
|
2671
2666
|
* Include field-level `_view`/`_edit` maps. Defaults to `includePermissions`
|
|
@@ -2681,6 +2676,7 @@ interface FindByIdArgs<T = unknown> {
|
|
|
2681
2676
|
populate?: Populate[] | string;
|
|
2682
2677
|
include?: Include | Include[];
|
|
2683
2678
|
}
|
|
2679
|
+
/** By-ID options inherit presentation/policy fields, not hydration.findOne; use model hydration.findById. */
|
|
2684
2680
|
interface FindByIdOptions<TModel = unknown, TVirtuals extends object = Record<never, never>> extends FindOneOptions<TModel, TVirtuals> {
|
|
2685
2681
|
}
|
|
2686
2682
|
|
|
@@ -2951,6 +2947,8 @@ interface DataRequestSchemas {
|
|
|
2951
2947
|
* policy belongs here. Each fresh model-service call captures the originating runtime's
|
|
2952
2948
|
* current defaults; nested stages retain that call's snapshot. Explicit service.defaults
|
|
2953
2949
|
* assignments override runtime defaults. Router setters shallowly replace supplied values.
|
|
2950
|
+
* Fetch mode belongs to ModelRouterOptions.hydration; legacy lean/hydration keys
|
|
2951
|
+
* in method option buckets fail with migration diagnostics.
|
|
2954
2952
|
* See README Configuration layers for delegation.
|
|
2955
2953
|
*/
|
|
2956
2954
|
interface Defaults<TModel = unknown> {
|
|
@@ -3124,11 +3122,52 @@ interface DocPermissions {
|
|
|
3124
3122
|
read?: ModelDocPermissionsHook;
|
|
3125
3123
|
update?: ModelDocPermissionsHook;
|
|
3126
3124
|
}
|
|
3125
|
+
/**
|
|
3126
|
+
* Mongoose fetch mode, not an output type. Both modes finalize plain objects;
|
|
3127
|
+
* schema defaults, getters, transforms and init hooks can still change values.
|
|
3128
|
+
*/
|
|
3129
|
+
type HydrationMode = 'lean' | 'hydrated';
|
|
3130
|
+
/**
|
|
3131
|
+
* Server-only model configuration, captured by the owning runtime per call.
|
|
3132
|
+
* Set through ModelRouterOptions/DefaultModelRouterOptions and their whole-record
|
|
3133
|
+
* or exact hydration.<method> setters (including existing model/default decorators).
|
|
3134
|
+
* A supplied record replaces the previous record shallowly; omitted/undefined
|
|
3135
|
+
* members use built-ins, not an older/default record. Whole-record undefined clears
|
|
3136
|
+
* it. Invalid records/keys/modes throw before publication. Fresh calls observe owner
|
|
3137
|
+
* updates; in-flight calls retain their captured configuration.
|
|
3138
|
+
* Includes stay fixed lean; raw parents/lifecycle stages stay hydrated; subdocument
|
|
3139
|
+
* post-save visibility stays lean. Populate inherits its parent query; $$sq uses
|
|
3140
|
+
* target public settings. No per-call, wire, global, data/root or service.defaults
|
|
3141
|
+
* setting exists. Migrate defaults.*Options.lean explicitly (true -> 'lean', false
|
|
3142
|
+
* -> 'hydrated'); a former service-instance choice becomes model-wide in its runtime.
|
|
3143
|
+
* Legacy method-default lean/hydration controls throw migration diagnostics; stale
|
|
3144
|
+
* permissive per-call/wire controls are inert, not a supported configuration path.
|
|
3145
|
+
*/
|
|
3146
|
+
interface ModelHydrationOptions {
|
|
3147
|
+
/** Public lists default to lean. */
|
|
3148
|
+
publicList?: HydrationMode;
|
|
3149
|
+
/** Identifier/filter reads and their list fallback default to hydrated. */
|
|
3150
|
+
publicRead?: HydrationMode;
|
|
3151
|
+
/** Internal find defaults to hydrated, independently of publicList. */
|
|
3152
|
+
find?: HydrationMode;
|
|
3153
|
+
/** Internal findOne defaults to hydrated, independently of publicRead/findById. */
|
|
3154
|
+
findOne?: HydrationMode;
|
|
3155
|
+
/** Internal findById defaults to hydrated; does not inherit findOne's setting. */
|
|
3156
|
+
findById?: HydrationMode;
|
|
3157
|
+
}
|
|
3127
3158
|
/** Model starting defaults; data/root routers do not inherit these. Nested values assign shallowly. */
|
|
3128
3159
|
interface DefaultModelRouterOptions<TModel = unknown> {
|
|
3160
|
+
/** Server-owned fetch choices, captured per call. Not a per-call or method-default option. */
|
|
3161
|
+
hydration?: ModelHydrationOptions;
|
|
3129
3162
|
/** Maximum returned list rows (default 1000), independent of exact match/count totals. */
|
|
3130
3163
|
listHardLimit?: number;
|
|
3131
|
-
/**
|
|
3164
|
+
/**
|
|
3165
|
+
* Serialized metadata path (default `_permissions`, dotted paths supported).
|
|
3166
|
+
* Finalized rows carrying it also get a non-enumerable `permissions` value alias,
|
|
3167
|
+
* independent of hydration/plugin, unless that output property already exists.
|
|
3168
|
+
* The alias is not authority or a live binding; JSON/spread omit it. Include output
|
|
3169
|
+
* cannot equal, contain or descend from the canonical metadata path.
|
|
3170
|
+
*/
|
|
3132
3171
|
documentPermissionField?: string;
|
|
3133
3172
|
/** Express route parameter name (default `id`); fixed at router construction. */
|
|
3134
3173
|
idParam?: string;
|
|
@@ -3178,12 +3217,13 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3178
3217
|
/**
|
|
3179
3218
|
* When `true`, the document permissions field (`documentPermissionField`,
|
|
3180
3219
|
* default `_permissions`) is removed from all outputs — including its empty
|
|
3181
|
-
* placeholder — and
|
|
3220
|
+
* placeholder — and its generated `permissions` alias. Client `includePermissions`/`includeFieldPermissions`
|
|
3182
3221
|
* input (query params, body/root-batch options and service-direct options)
|
|
3183
3222
|
* as well as per-operation `defaults` are ignored (both resolve to `false`).
|
|
3184
3223
|
* Output matches `includePermissions: false` with the permissions field
|
|
3185
3224
|
* removed entirely. Enforcement still runs; only output metadata is
|
|
3186
|
-
* affected
|
|
3225
|
+
* affected; existing business output named `permissions` is not a generated alias.
|
|
3226
|
+
* Defaults to `false`.
|
|
3187
3227
|
*/
|
|
3188
3228
|
stripPermissionsField?: boolean;
|
|
3189
3229
|
/**
|
|
@@ -3196,6 +3236,11 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3196
3236
|
disableFieldPermissions?: boolean;
|
|
3197
3237
|
}
|
|
3198
3238
|
interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
3239
|
+
'hydration.publicList'?: HydrationMode;
|
|
3240
|
+
'hydration.publicRead'?: HydrationMode;
|
|
3241
|
+
'hydration.find'?: HydrationMode;
|
|
3242
|
+
'hydration.findOne'?: HydrationMode;
|
|
3243
|
+
'hydration.findById'?: HydrationMode;
|
|
3199
3244
|
'operationAccess.default'?: Validation;
|
|
3200
3245
|
'operationAccess.new'?: Validation;
|
|
3201
3246
|
'operationAccess.list'?: Validation;
|
|
@@ -3566,4 +3611,4 @@ declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): R
|
|
|
3566
3611
|
declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
|
|
3567
3612
|
declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
|
|
3568
3613
|
|
|
3569
|
-
export { type DecorateAccess as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type CorrelatedReadByFilterInclude as D, type CorrelatedReadByIdInclude as E, type CountBody as F, type CreateArgs as G, type CreateAuthorization as H, type CreateOptions as I, type CreateQueryInput as J, CustomHeaders as K, DATA_MIDDLEWARE as L, type DataBaseFilterHook as M, type DataFieldOptions as N, type DataFilter as O, type DataFindArgs as P, type DataFindOneArgs as Q, type DataFindOneOptions as R, type DataFindOptions as S, type DataHook as T, type DataHookContext as U, type DataIdentifierHook as V, type DataListHook as W, type DataOverrideFilterHook as X, type DataRequest as Y, type DataRequestSchemas as Z, type DataRouterOptions as _, type AccessRouterFieldKey as a, type
|
|
3614
|
+
export { type DecorateAccess as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type CorrelatedReadByFilterInclude as D, type CorrelatedReadByIdInclude as E, type CountBody as F, type CreateArgs as G, type CreateAuthorization as H, type CreateOptions as I, type CreateQueryInput as J, CustomHeaders as K, DATA_MIDDLEWARE as L, type DataBaseFilterHook as M, type DataFieldOptions as N, type DataFilter as O, type DataFindArgs as P, type DataFindOneArgs as Q, type DataFindOneOptions as R, type DataFindOptions as S, type DataHook as T, type DataHookContext as U, type DataIdentifierHook as V, type DataListHook as W, type DataOverrideFilterHook as X, type DataRequest as Y, type DataRequestSchemas as Z, type DataRouterOptions as _, type AccessRouterFieldKey as a, type ModelVirtualGetter as a$, type DecorateAllAccess as a0, type DeepFieldPath as a1, type DefaultModelRouterOptions as a2, type Defaults as a3, type DistinctArgs as a4, type DistinctBody as a5, type DocPermissionsAccess as a6, type DocumentAuthorization as a7, type ErrorResult as a8, type ExistsOptions as a9, type JoiValidationErrorDetailLike as aA, type KeyValueProjection as aB, type LegacyInclude as aC, type ListQueryInput as aD, type ListResult as aE, MIDDLEWARE as aF, type MaybePromise as aG, type ModelBaseFilterHook as aH, type ModelChangeHook as aI, type ModelDeleteHook as aJ, type ModelDocPermissionsHook as aK, type ModelDocument as aL, type ModelDocumentHook as aM, type ModelHook as aN, type ModelHookContext as aO, type ModelHydrationOptions as aP, type ModelIdentifierHook as aQ, type ModelListHook as aR, type ModelOverrideFilterHook as aS, type ModelRequest as aT, type ModelRouterOptions as aU, type ModelValidateHook as aV, type ModelVirtualAccess as aW, type ModelVirtualAccessRecord as aX, type ModelVirtualContext as aY, type ModelVirtualDescriptor as aZ, type ModelVirtualDoc as a_, type ExtendedDataRouterOptions as aa, type ExtendedDefaultModelRouterOptions as ab, type ExtendedModelRouterOptions as ac, type FieldAuthorization as ad, type FieldOperationAccess as ae, type Filter as af, FilterOperator as ag, type FindAccess as ah, type FindArgs as ai, type FindByIdArgs as aj, type FindByIdOptions as ak, type FindOneArgs as al, type FindOneOptions as am, type FindOptions as an, type GlobalOptions as ao, type GlobalPermissionValue as ap, type GuardHook as aq, type HydrationMode as ar, type IdentifierHook as as, type Include as at, type InputFieldAuthorization as au, type InputFieldPath as av, type IoTsContextEntryLike as aw, type IoTsDecodeErrorLike as ax, type IoTsDecoderLike as ay, type JoiSchemaLike as az, type AccessRouterLogger as b, type RootModelNewQueryEntry as b$, type ModelVirtualLeaf as b0, type ModelVirtualRecordAccess as b1, type ModelVirtuals as b2, type MutationAuthorization as b3, type NewArgs as b4, type NewOptions as b5, type OperationAccess as b6, type OperationAuthorization as b7, type OutputAuthorization as b8, type OutputFieldOptions as b9, type PublicSubdocumentMutationOptions as bA, type PublicSubdocumentReadOptions as bB, type PublicUpdateArgs as bC, type PublicUpdateOptions as bD, type PublicUpsertArgs as bE, type PublicUpsertOptions as bF, type ReadQueryInput as bG, type RelatedAuthorization as bH, type Request as bI, type RequestSchemaAdapter as bJ, type RequestSchemaFailure as bK, type RequestSchemaIssue as bL, type RequestSchemaLike as bM, type RequestSchemaOptions as bN, type RequestSchemaResult as bO, type RequestSchemaSuccess as bP, type RequestSchemaValidator as bQ, type RequestSchemas as bR, type RootDataListQueryEntry as bS, type RootDataOperation as bT, type RootDataReadByFilterQueryEntry as bU, type RootDataReadByIdQueryEntry as bV, type RootModelCountQueryEntry as bW, type RootModelCreateQueryEntry as bX, type RootModelDeleteQueryEntry as bY, type RootModelDistinctQueryEntry as bZ, type RootModelListQueryEntry as b_, type OutputFieldPath as ba, type OutputPlanningOptions as bb, PERMISSIONS as bc, PERMISSION_KEYS as bd, type PairedRouteAccess as be, type ParentRef as bf, type PathValue as bg, type PermissionSchema as bh, type Populate as bi, type PopulateAccess as bj, type PopulatePlanningOptions as bk, type PrepareAccess as bl, type Projection as bm, type PublicCreateArgs as bn, type PublicCreateOptions as bo, type PublicErrorResult as bp, type PublicListArgs as bq, type PublicListOptions as br, type PublicListResult as bs, type PublicOutput as bt, type PublicReadArgs as bu, type PublicReadOptions as bv, type PublicServiceResult as bw, type PublicSingleResult as bx, type PublicSubdocumentCreateOptions as by, type PublicSubdocumentListOptions as bz, type AccessRouterRequest as c, type SubdocumentReadAuthorization as c$, type RootModelOperation as c0, type RootModelReadByFilterQueryEntry as c1, type RootModelReadByIdQueryEntry as c2, type RootModelSubBulkUpdateQueryEntry as c3, type RootModelSubCreateQueryEntry as c4, type RootModelSubDeleteQueryEntry as c5, type RootModelSubListQueryEntry as c6, type RootModelSubReadQueryEntry as c7, type RootModelSubUpdateQueryEntry as c8, type RootModelUpdateQueryEntry as c9, type StandardSchemaSuccess as cA, type StandardSchemaV1 as cB, StatusCodes as cC, type SubListBody as cD, type SubOperationAccess as cE, type SubPopulate as cF, type SubQueryEntry as cG, type SubReadBody as cH, type SubRouteGuardOptions as cI, type SubdocumentBulkRecord as cJ, type SubdocumentBulkUpdateInput as cK, type SubdocumentCreateAuthorization as cL, type SubdocumentCreateInput as cM, type SubdocumentCreateOptions as cN, type SubdocumentCreateVisibilityAuthorization as cO, type SubdocumentDeleteAuthorization as cP, type SubdocumentDeleteOptions as cQ, type SubdocumentGateAuthorization as cR, type SubdocumentId as cS, type SubdocumentInputAuthorization as cT, type SubdocumentListOptions as cU, type SubdocumentModel as cV, type SubdocumentMutationAuthorization as cW, type SubdocumentName as cX, type SubdocumentOutputAuthorization as cY, type SubdocumentParentArgs as cZ, type SubdocumentParentOptions as c_, type RootModelUpsertQueryEntry as ca, type RootOperationResult as cb, type RootQueryEntry as cc, type RootRouterOptions as cd, type RootSubOperation as ce, type RootTarget as cf, type RouteBaseAccess as cg, type RouteGuardAccess as ch, type RouteVariant as ci, type RouteVariantAccess as cj, type RowAuthorization as ck, type SelectAccess as cl, type SelectedPopulatedPublicOutput as cm, type SelectedPublicOutput as cn, type ServiceAuthorization as co, type ServiceOutputContext as cp, type ServiceOutputDecorator as cq, type ServiceResult as cr, type SingleResult as cs, type Sort as ct, type SortOrder as cu, type StandardSchemaFailure as cv, type StandardSchemaInferOutput as cw, type StandardSchemaIssue as cx, type StandardSchemaPathSegment as cy, type StandardSchemaResult as cz, type AccessRouterRequestExtensions as d, type AccessRouterPermissions as d$, type SubdocumentReadOptions as d0, type SubdocumentRecord as d1, type SubdocumentUpdateOptions as d2, type SubdocumentVirtuals as d3, type SubdocumentVisibilityAuthorization as d4, type SuperstructFailureLike as d5, type SuperstructValidateLike as d6, type Task as d7, type TaskType as d8, type TransformAccess as d9, fromAjv as dA, fromArkType as dB, fromIoTs as dC, fromJoi as dD, fromStandardSchema as dE, fromSuperstruct as dF, fromValibot as dG, fromVine as dH, fromYup as dI, fromZod as dJ, parseBody as dK, parseBodyWithSchema as dL, parseNestedBodyWithSchema as dM, parsePathParam as dN, parseQuery as dO, AccessRuntime as dP, DataService as dQ, Service as dR, PublicService as dS, type OpenApiRouterOptions as dT, type OpenApiRegistryOptions as dU, type OpenApiRouteDescriptor as dV, type OpenApiDocumentOptions as dW, type OpenApiParameter as dX, type OpenApiSchema as dY, type OpenApiResponses as dZ, type AccessRouterPermissionMap as d_, type TypedFilter as da, type UpdateByIdArgs as db, type UpdateByIdOptions as dc, type UpdateOneArgs as dd, type UpdateOneOptions as de, type UpdateQueryInput as df, type UpsertArgs as dg, type UpsertOptions as dh, type UpsertQueryInput as di, type ValibotIssueLike as dj, type ValibotPathItemLike as dk, type ValibotSafeParseLike as dl, type ValibotSafeParseResult as dm, type ValidateAccess as dn, type ValidateRule as dp, type Validation as dq, type ValidationError as dr, type VineValidationErrorLike as ds, type VineValidationMessageLike as dt, type VineValidatorLike as du, type VirtualSubModel as dv, type WithVirtuals as dw, type YupSchemaLike as dx, type YupValidationErrorLike as dy, defineRequestSchema as dz, type AdvancedCreateBody as e, type OpenApiMethod as e0, type Permissions as e1, defaultRuntime as e2, 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 AllowedOutputFieldOptions as o, type ArkTypeErrorsLike as p, type ArkTypeLike as q, type ArkTypeProblemLike as r, type AuthorizedListResult as s, type AuthorizedSingleResult as t, Codes as u, type CorrelatedCountInclude as v, type CorrelatedFilter as w, type CorrelatedInclude as x, type CorrelatedIncludeArgs as y, type CorrelatedListInclude as z };
|