@web-ts-toolkit/access-router 0.38.0 → 0.39.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 +51 -5
- package/advanced.d.mts +3 -3
- package/advanced.d.ts +3 -3
- package/advanced.js +170 -85
- package/advanced.mjs +144 -59
- package/index.d.mts +198 -3
- package/index.d.ts +198 -3
- package/index.js +519 -306
- package/index.mjs +540 -328
- package/llms.txt +25 -5
- package/package.json +3 -3
- package/{parsers--DZcTstL.d.mts → parsers-PMWujHUV.d.mts} +32 -204
- package/{parsers--DZcTstL.d.ts → parsers-PMWujHUV.d.ts} +32 -204
- package/processors.d.mts +20 -8
- package/processors.d.ts +20 -8
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ Peer dependencies:
|
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
+
<!-- doc-example: partial -->
|
|
28
|
+
|
|
27
29
|
```ts
|
|
28
30
|
import express from 'express';
|
|
29
31
|
import mongoose from 'mongoose';
|
|
@@ -92,6 +94,16 @@ app.listen(port, () => {
|
|
|
92
94
|
});
|
|
93
95
|
```
|
|
94
96
|
|
|
97
|
+
In-memory data routers default `listHardLimit` to `1000`, matching model routers. A list request without
|
|
98
|
+
`limit`/`pageSize`, or with a malformed limit passed through a trusted service call, is capped at that finite
|
|
99
|
+
default unless the router sets `listHardLimit` explicitly. `meta.totalCount` still reflects the full authorized
|
|
100
|
+
match set when counts are requested; only returned rows are trimmed and decorated. Per-row data trim/decorate
|
|
101
|
+
hooks run with bounded concurrency controlled by `requestComplexity.maxHookConcurrency` (default `10`).
|
|
102
|
+
Runtime options and data-router records are copied when configured, and option getter results are frozen
|
|
103
|
+
snapshots. Mutating the original options object, a fetched options snapshot, or the original `data` array does
|
|
104
|
+
not change live runtime policy or served in-memory records. Replace configured data through `router.data(next)`
|
|
105
|
+
or `setDataOption(name, 'data', next)`.
|
|
106
|
+
|
|
95
107
|
## Main Exports
|
|
96
108
|
|
|
97
109
|
Root entrypoint (`@web-ts-toolkit/access-router`):
|
|
@@ -108,31 +120,46 @@ Root entrypoint (`@web-ts-toolkit/access-router`):
|
|
|
108
120
|
Subpath entrypoints:
|
|
109
121
|
|
|
110
122
|
- `@web-ts-toolkit/access-router/advanced` — low-level runtime context, symbols (`MIDDLEWARE`, `PERMISSIONS`, ...), enums (`Codes`, `StatusCodes`), internals (`parseBody`, `parseQuery`, request schemas). Does NOT export `acl`, `defaultRuntime`, or router-creation helpers.
|
|
111
|
-
- `@web-ts-toolkit/access-router/processors` — `copyAndDepopulate` and its `ProcessCopy` / `CopyAndDepopulateOptions` types for transforming populated documents.
|
|
123
|
+
- `@web-ts-toolkit/access-router/processors` — `copyAndDepopulate` and its `ProcessCopy` / `CopyAndDepopulateOptions` / `CopyAndDepopulateOutput` types for transforming populated documents.
|
|
112
124
|
|
|
113
125
|
## Default runtime vs. isolated runtime
|
|
114
126
|
|
|
115
127
|
The default export `acl` is bound to a single shared `AccessRuntime`, which is fine for most services.
|
|
116
128
|
For tests, multi-tenant services, or libraries that must avoid global state, create an isolated runtime:
|
|
117
129
|
|
|
130
|
+
<!-- doc-example: complete-runtime -->
|
|
131
|
+
|
|
118
132
|
```ts
|
|
133
|
+
import mongoose, { type Model } from 'mongoose';
|
|
119
134
|
import { createAccessRuntime } from '@web-ts-toolkit/access-router';
|
|
120
135
|
|
|
136
|
+
type User = { name?: string };
|
|
137
|
+
|
|
121
138
|
const runtime = createAccessRuntime();
|
|
122
139
|
runtime.setGlobalOptions({ globalPermissions: () => [] });
|
|
140
|
+
const userSchema = new mongoose.Schema<User>({ name: String });
|
|
141
|
+
const UserModel: Model<User> = mongoose.model<User>('ReadmeRuntimeUser', userSchema);
|
|
142
|
+
const userRouter = runtime.createRouter(UserModel, { basePath: '/users' });
|
|
123
143
|
|
|
124
|
-
// `runtime.
|
|
125
|
-
// `runtime.
|
|
144
|
+
// `runtime.createDataRouter(...)`, `runtime.createOpenApiRouter(...)`,
|
|
145
|
+
// `runtime.registerModelInstance(...)`, ...
|
|
146
|
+
void userRouter;
|
|
126
147
|
```
|
|
127
148
|
|
|
128
149
|
Two isolated runtimes with the same model name resolve against their own model registry and options without interference.
|
|
150
|
+
An isolated runtime does not look up process-global `mongoose.models` by string name; pass a `mongoose.Model` instance
|
|
151
|
+
to `runtime.createRouter(model, options)` or call `runtime.registerModelInstance(name, model)` before constructing a
|
|
152
|
+
string-name router. The default `acl` runtime retains string-name compatibility with `mongoose.model(name, schema)` and
|
|
153
|
+
adopts that exact global model instance into its registry on first lookup.
|
|
129
154
|
|
|
130
155
|
## createRouter overloads
|
|
131
156
|
|
|
132
|
-
`createRouter(modelName, options)` — accept the Mongoose model name registered with `mongoose.model(name, schema)`.
|
|
157
|
+
`createRouter(modelName, options)` — on the default `acl` runtime, accept the Mongoose model name registered with `mongoose.model(name, schema)`. On isolated runtimes, the name must already be registered with that runtime.
|
|
133
158
|
|
|
134
159
|
`createRouter(model, options)` — accept a `mongoose.Model` instance directly. The instance is registered with the active runtime's registry, so a model attached to a non-default `mongoose.createConnection()` works without polluting the global registry.
|
|
135
160
|
|
|
161
|
+
<!-- doc-example: partial -->
|
|
162
|
+
|
|
136
163
|
```ts
|
|
137
164
|
import mongoose from 'mongoose';
|
|
138
165
|
import acl, { permissionsPlugin } from '@web-ts-toolkit/access-router';
|
|
@@ -147,10 +174,18 @@ const TenantUser = conn.model('TenantUser', schema);
|
|
|
147
174
|
const tenantRouter = acl.createRouter(TenantUser, { basePath: '/tenant-users' });
|
|
148
175
|
```
|
|
149
176
|
|
|
177
|
+
## Include Cardinality
|
|
178
|
+
|
|
179
|
+
Advanced read/list requests can attach related model data with `include` entries.
|
|
180
|
+
`op: 'count'` returns exact authorized counts and ignores include pagination fields such as `args.limit`.
|
|
181
|
+
`op: 'list'` materializes authorized related rows through the target model's normal list path, so target `limit`, `page`, `pageSize`, and `listHardLimit` bounds still apply to included rows.
|
|
182
|
+
|
|
150
183
|
## Import styles
|
|
151
184
|
|
|
152
185
|
The package ships both a default export and named exports:
|
|
153
186
|
|
|
187
|
+
<!-- doc-example: partial -->
|
|
188
|
+
|
|
154
189
|
```ts
|
|
155
190
|
// default export (preferred for the runtime API)
|
|
156
191
|
import acl from '@web-ts-toolkit/access-router';
|
|
@@ -161,10 +196,17 @@ import { createAccessRuntime, fromZod } from '@web-ts-toolkit/access-router';
|
|
|
161
196
|
|
|
162
197
|
### Subpath import example
|
|
163
198
|
|
|
199
|
+
<!-- doc-example: complete-runtime -->
|
|
200
|
+
|
|
164
201
|
```ts
|
|
165
202
|
import { copyAndDepopulate } from '@web-ts-toolkit/access-router/processors';
|
|
166
203
|
|
|
167
|
-
|
|
204
|
+
type DepopulatedItems = {
|
|
205
|
+
items: string[];
|
|
206
|
+
itemsSnapshot: Array<{ _id: string; name: string }>;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const { items, itemsSnapshot } = copyAndDepopulate<DepopulatedItems>(
|
|
168
210
|
{ items: [{ _id: 'a1', name: 'Apple' }] },
|
|
169
211
|
[{ src: 'items', dest: 'itemsSnapshot' }],
|
|
170
212
|
{ mutable: false },
|
|
@@ -172,6 +214,10 @@ const { items } = copyAndDepopulate(
|
|
|
172
214
|
// `items` is now `['a1']`; `itemsSnapshot` holds the original objects.
|
|
173
215
|
```
|
|
174
216
|
|
|
217
|
+
Without an explicit output type, `copyAndDepopulate(...)` returns the conservative `CopyAndDepopulateOutput`
|
|
218
|
+
record because runtime `src` and `dest` path strings can replace populated objects with ids and add new fields.
|
|
219
|
+
Unsafe paths or records missing the configured id field throw plain `Error` instances with descriptive messages.
|
|
220
|
+
|
|
175
221
|
## Documentation
|
|
176
222
|
|
|
177
223
|
- live docs: https://web-ts-toolkit.pages.dev/docs/packages/access-router
|
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 AjvValidatorLike, n as ArkTypeErrorsLike, o as ArkTypeLike, p as ArkTypeProblemLike, B as BaseFilterAccess, C as Change, q as Codes, r as CountBody, s as CreateArgs, t as CreateOptions, u as CreateQueryInput, v as CustomHeaders, D as DATA_MIDDLEWARE, w as DataBaseFilterHook, x as DataFilter, y as DataFindArgs, z as DataFindOneArgs, E as DataFindOneOptions, F as DataFindOptions, G as DataHook, H as DataHookContext, I as DataIdentifierHook, J as DataListHook, K as DataOverrideFilterHook, L as DataRequest, M as DataRequestSchemas, N as DataRouterOptions, O as DecorateAccess, P as DecorateAllAccess, Q as DeepFieldPath, R as DefaultModelRouterOptions, S as Defaults, T as DistinctArgs, U as DistinctBody, V as DocPermissionsAccess, W as ErrorResult, X as ExistsOptions, Y as ExtendedDataRouterOptions, Z as ExtendedDefaultModelRouterOptions, _ as ExtendedModelRouterOptions, $ as Filter, a0 as FilterOperator, a1 as FindAccess, a2 as FindArgs, a3 as FindByIdArgs, a4 as FindByIdOptions, a5 as FindOneArgs, a6 as FindOneOptions, a7 as FindOptions, a8 as GlobalOptions, a9 as GlobalPermissionValue, aa as GuardHook, ab as IdentifierHook, ac as Include, ad as IoTsContextEntryLike, ae as IoTsDecodeErrorLike, af as IoTsDecoderLike, ag as JoiSchemaLike, ah as JoiValidationErrorDetailLike, ai as KeyValueProjection, aj as ListQueryInput, ak as ListResult, al as MIDDLEWARE, am as MaybePromise, an as ModelBaseFilterHook, ao as ModelChangeHook, ap as ModelDeleteHook, aq as ModelDocPermissionsHook, ar as ModelDocument, as as ModelDocumentHook, at as ModelHook, au as ModelHookContext, av as ModelIdentifierHook, aw as ModelListHook, ax as ModelOverrideFilterHook, ay as ModelRequest, az as ModelRouterOptions, aA as ModelValidateHook, aB as PERMISSIONS, aC as PERMISSION_KEYS, aD as PathValue, aE as PermissionSchema, aF as Populate, aG as PopulateAccess, aH as PrepareAccess, aI as Projection, aJ as PublicCreateArgs, aK as PublicCreateOptions, aL as PublicErrorResult, aM as PublicListArgs, aN as PublicListOptions, aO as PublicListResult, aP as PublicOutput, aQ as PublicReadArgs, aR as PublicReadOptions, aS as PublicServiceResult, aT as PublicSingleResult, aU as PublicUpdateArgs, aV as PublicUpdateOptions, aW as PublicUpsertArgs, aX as PublicUpsertOptions, aY as ReadQueryInput, aZ as Request, a_ as RequestSchemaAdapter, a$ as RequestSchemaFailure, b0 as RequestSchemaIssue, b1 as RequestSchemaLike, b2 as RequestSchemaOptions, b3 as RequestSchemaResult, b4 as RequestSchemaSuccess, b5 as RequestSchemaValidator, b6 as RequestSchemas, b7 as RootDataListQueryEntry, b8 as RootDataOperation, b9 as RootDataReadByFilterQueryEntry, ba as RootDataReadByIdQueryEntry, bb as RootModelCountQueryEntry, bc as RootModelCreateQueryEntry, bd as RootModelDeleteQueryEntry, be as RootModelDistinctQueryEntry, bf as RootModelListQueryEntry, bg as RootModelNewQueryEntry, bh as RootModelOperation, bi as RootModelReadByFilterQueryEntry, bj as RootModelReadByIdQueryEntry, bk as RootModelSubBulkUpdateQueryEntry, bl as RootModelSubCreateQueryEntry, bm as RootModelSubDeleteQueryEntry, bn as RootModelSubListQueryEntry, bo as RootModelSubReadQueryEntry, bp as RootModelSubUpdateQueryEntry, bq as RootModelUpdateQueryEntry, br as RootModelUpsertQueryEntry, bs as RootOperationResult, bt as RootQueryEntry, bu as RootRouterOptions, bv as RootSubOperation, bw as RootTarget, bx as RouteGuardAccess, by as SelectAccess, bz as SelectedPopulatedPublicOutput, bA as SelectedPublicOutput, bB as ServiceResult, bC as SingleResult, bD as Sort, bE as SortOrder, bF as StandardSchemaFailure, bG as StandardSchemaInferOutput, bH as StandardSchemaIssue, bI as StandardSchemaPathSegment, bJ as StandardSchemaResult, bK as StandardSchemaSuccess, bL as StandardSchemaV1, bM as StatusCodes, bN as SubListBody, bO as SubPopulate, bP as SubQueryEntry, bQ as SubReadBody, bR as SubdocumentBulkRecord, bS as SubdocumentBulkUpdateInput, bT as SubdocumentCreateInput, bU as SubdocumentCreateOptions, bV as SubdocumentId, bW as SubdocumentListOptions, bX as SubdocumentName, bY as SubdocumentParentArgs, bZ as SubdocumentParentOptions, b_ as SubdocumentReadOptions, b$ as SubdocumentRecord, c0 as SuperstructFailureLike, c1 as SuperstructValidateLike, c2 as Task, c3 as TransformAccess, c4 as TypedFilter, c5 as UpdateByIdArgs, c6 as UpdateByIdOptions, c7 as UpdateOneArgs, c8 as UpdateOneOptions, c9 as UpdateQueryInput, ca as UpsertArgs, cb as UpsertOptions, cc as UpsertQueryInput, cd as ValibotIssueLike, ce as ValibotPathItemLike, cf as ValibotSafeParseLike, cg as ValibotSafeParseResult, ch as ValidateAccess, ci as ValidateRule, cj as Validation, ck as ValidationError, cl as VineValidationErrorLike, cm as VineValidationMessageLike, cn as VineValidatorLike, co as YupSchemaLike, cp as YupValidationErrorLike, cq as defineRequestSchema, cr as fromAjv, cs as fromArkType, ct as fromIoTs, cu as fromJoi, cv as fromStandardSchema, cw as fromSuperstruct, cx as fromValibot, cy as fromVine, cz as fromYup, cA as fromZod, cB as parseBody, cC as parseBodyWithSchema, cD as parseNestedBodyWithSchema, cE as parsePathParam, cF as parseQuery } from './parsers
|
|
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 AjvValidatorLike, n as ArkTypeErrorsLike, o as ArkTypeLike, p as ArkTypeProblemLike, B as BaseFilterAccess, C as Change, q as Codes, r as CountBody, s as CreateArgs, t as CreateOptions, u as CreateQueryInput, v as CustomHeaders, D as DATA_MIDDLEWARE, w as DataBaseFilterHook, x as DataFilter, y as DataFindArgs, z as DataFindOneArgs, E as DataFindOneOptions, F as DataFindOptions, G as DataHook, H as DataHookContext, I as DataIdentifierHook, J as DataListHook, K as DataOverrideFilterHook, L as DataRequest, M as DataRequestSchemas, N as DataRouterOptions, O as DecorateAccess, P as DecorateAllAccess, Q as DeepFieldPath, R as DefaultModelRouterOptions, S as Defaults, T as DistinctArgs, U as DistinctBody, V as DocPermissionsAccess, W as ErrorResult, X as ExistsOptions, Y as ExtendedDataRouterOptions, Z as ExtendedDefaultModelRouterOptions, _ as ExtendedModelRouterOptions, $ as Filter, a0 as FilterOperator, a1 as FindAccess, a2 as FindArgs, a3 as FindByIdArgs, a4 as FindByIdOptions, a5 as FindOneArgs, a6 as FindOneOptions, a7 as FindOptions, a8 as GlobalOptions, a9 as GlobalPermissionValue, aa as GuardHook, ab as IdentifierHook, ac as Include, ad as IoTsContextEntryLike, ae as IoTsDecodeErrorLike, af as IoTsDecoderLike, ag as JoiSchemaLike, ah as JoiValidationErrorDetailLike, ai as KeyValueProjection, aj as ListQueryInput, ak as ListResult, al as MIDDLEWARE, am as MaybePromise, an as ModelBaseFilterHook, ao as ModelChangeHook, ap as ModelDeleteHook, aq as ModelDocPermissionsHook, ar as ModelDocument, as as ModelDocumentHook, at as ModelHook, au as ModelHookContext, av as ModelIdentifierHook, aw as ModelListHook, ax as ModelOverrideFilterHook, ay as ModelRequest, az as ModelRouterOptions, aA as ModelValidateHook, aB as PERMISSIONS, aC as PERMISSION_KEYS, aD as PathValue, aE as PermissionSchema, aF as Populate, aG as PopulateAccess, aH as PrepareAccess, aI as Projection, aJ as PublicCreateArgs, aK as PublicCreateOptions, aL as PublicErrorResult, aM as PublicListArgs, aN as PublicListOptions, aO as PublicListResult, aP as PublicOutput, aQ as PublicReadArgs, aR as PublicReadOptions, aS as PublicServiceResult, aT as PublicSingleResult, aU as PublicUpdateArgs, aV as PublicUpdateOptions, aW as PublicUpsertArgs, aX as PublicUpsertOptions, aY as ReadQueryInput, aZ as Request, a_ as RequestSchemaAdapter, a$ as RequestSchemaFailure, b0 as RequestSchemaIssue, b1 as RequestSchemaLike, b2 as RequestSchemaOptions, b3 as RequestSchemaResult, b4 as RequestSchemaSuccess, b5 as RequestSchemaValidator, b6 as RequestSchemas, b7 as RootDataListQueryEntry, b8 as RootDataOperation, b9 as RootDataReadByFilterQueryEntry, ba as RootDataReadByIdQueryEntry, bb as RootModelCountQueryEntry, bc as RootModelCreateQueryEntry, bd as RootModelDeleteQueryEntry, be as RootModelDistinctQueryEntry, bf as RootModelListQueryEntry, bg as RootModelNewQueryEntry, bh as RootModelOperation, bi as RootModelReadByFilterQueryEntry, bj as RootModelReadByIdQueryEntry, bk as RootModelSubBulkUpdateQueryEntry, bl as RootModelSubCreateQueryEntry, bm as RootModelSubDeleteQueryEntry, bn as RootModelSubListQueryEntry, bo as RootModelSubReadQueryEntry, bp as RootModelSubUpdateQueryEntry, bq as RootModelUpdateQueryEntry, br as RootModelUpsertQueryEntry, bs as RootOperationResult, bt as RootQueryEntry, bu as RootRouterOptions, bv as RootSubOperation, bw as RootTarget, bx as RouteGuardAccess, by as SelectAccess, bz as SelectedPopulatedPublicOutput, bA as SelectedPublicOutput, bB as ServiceResult, bC as SingleResult, bD as Sort, bE as SortOrder, bF as StandardSchemaFailure, bG as StandardSchemaInferOutput, bH as StandardSchemaIssue, bI as StandardSchemaPathSegment, bJ as StandardSchemaResult, bK as StandardSchemaSuccess, bL as StandardSchemaV1, bM as StatusCodes, bN as SubListBody, bO as SubPopulate, bP as SubQueryEntry, bQ as SubReadBody, bR as SubdocumentBulkRecord, bS as SubdocumentBulkUpdateInput, bT as SubdocumentCreateInput, bU as SubdocumentCreateOptions, bV as SubdocumentId, bW as SubdocumentListOptions, bX as SubdocumentName, bY as SubdocumentParentArgs, bZ as SubdocumentParentOptions, b_ as SubdocumentReadOptions, b$ as SubdocumentRecord, c0 as SuperstructFailureLike, c1 as SuperstructValidateLike, c2 as Task, c3 as TransformAccess, c4 as TypedFilter, c5 as UpdateByIdArgs, c6 as UpdateByIdOptions, c7 as UpdateOneArgs, c8 as UpdateOneOptions, c9 as UpdateQueryInput, ca as UpsertArgs, cb as UpsertOptions, cc as UpsertQueryInput, cd as ValibotIssueLike, ce as ValibotPathItemLike, cf as ValibotSafeParseLike, cg as ValibotSafeParseResult, ch as ValidateAccess, ci as ValidateRule, cj as Validation, ck as ValidationError, cl as VineValidationErrorLike, cm as VineValidationMessageLike, cn as VineValidatorLike, co as YupSchemaLike, cp as YupValidationErrorLike, cq as defineRequestSchema, cr as fromAjv, cs as fromArkType, ct as fromIoTs, cu as fromJoi, cv as fromStandardSchema, cw as fromSuperstruct, cx as fromValibot, cy as fromVine, cz as fromYup, cA as fromZod, cB as parseBody, cC as parseBodyWithSchema, cD as parseNestedBodyWithSchema, cE as parsePathParam, cF as parseQuery } from './parsers-PMWujHUV.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'express';
|
|
@@ -448,7 +448,7 @@ declare const requestSchemas: {
|
|
|
448
448
|
declare const dataListBodySchema: z.ZodObject<{
|
|
449
449
|
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
450
450
|
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
451
|
-
sort: z.ZodOptional<z.ZodString
|
|
451
|
+
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
452
452
|
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
453
453
|
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
454
454
|
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
@@ -902,7 +902,7 @@ declare const rootQuerySchema: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
902
902
|
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
903
903
|
args: z.ZodOptional<z.ZodObject<{
|
|
904
904
|
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
905
|
-
sort: z.ZodOptional<z.ZodString
|
|
905
|
+
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
906
906
|
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
907
907
|
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
908
908
|
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
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 AjvValidatorLike, n as ArkTypeErrorsLike, o as ArkTypeLike, p as ArkTypeProblemLike, B as BaseFilterAccess, C as Change, q as Codes, r as CountBody, s as CreateArgs, t as CreateOptions, u as CreateQueryInput, v as CustomHeaders, D as DATA_MIDDLEWARE, w as DataBaseFilterHook, x as DataFilter, y as DataFindArgs, z as DataFindOneArgs, E as DataFindOneOptions, F as DataFindOptions, G as DataHook, H as DataHookContext, I as DataIdentifierHook, J as DataListHook, K as DataOverrideFilterHook, L as DataRequest, M as DataRequestSchemas, N as DataRouterOptions, O as DecorateAccess, P as DecorateAllAccess, Q as DeepFieldPath, R as DefaultModelRouterOptions, S as Defaults, T as DistinctArgs, U as DistinctBody, V as DocPermissionsAccess, W as ErrorResult, X as ExistsOptions, Y as ExtendedDataRouterOptions, Z as ExtendedDefaultModelRouterOptions, _ as ExtendedModelRouterOptions, $ as Filter, a0 as FilterOperator, a1 as FindAccess, a2 as FindArgs, a3 as FindByIdArgs, a4 as FindByIdOptions, a5 as FindOneArgs, a6 as FindOneOptions, a7 as FindOptions, a8 as GlobalOptions, a9 as GlobalPermissionValue, aa as GuardHook, ab as IdentifierHook, ac as Include, ad as IoTsContextEntryLike, ae as IoTsDecodeErrorLike, af as IoTsDecoderLike, ag as JoiSchemaLike, ah as JoiValidationErrorDetailLike, ai as KeyValueProjection, aj as ListQueryInput, ak as ListResult, al as MIDDLEWARE, am as MaybePromise, an as ModelBaseFilterHook, ao as ModelChangeHook, ap as ModelDeleteHook, aq as ModelDocPermissionsHook, ar as ModelDocument, as as ModelDocumentHook, at as ModelHook, au as ModelHookContext, av as ModelIdentifierHook, aw as ModelListHook, ax as ModelOverrideFilterHook, ay as ModelRequest, az as ModelRouterOptions, aA as ModelValidateHook, aB as PERMISSIONS, aC as PERMISSION_KEYS, aD as PathValue, aE as PermissionSchema, aF as Populate, aG as PopulateAccess, aH as PrepareAccess, aI as Projection, aJ as PublicCreateArgs, aK as PublicCreateOptions, aL as PublicErrorResult, aM as PublicListArgs, aN as PublicListOptions, aO as PublicListResult, aP as PublicOutput, aQ as PublicReadArgs, aR as PublicReadOptions, aS as PublicServiceResult, aT as PublicSingleResult, aU as PublicUpdateArgs, aV as PublicUpdateOptions, aW as PublicUpsertArgs, aX as PublicUpsertOptions, aY as ReadQueryInput, aZ as Request, a_ as RequestSchemaAdapter, a$ as RequestSchemaFailure, b0 as RequestSchemaIssue, b1 as RequestSchemaLike, b2 as RequestSchemaOptions, b3 as RequestSchemaResult, b4 as RequestSchemaSuccess, b5 as RequestSchemaValidator, b6 as RequestSchemas, b7 as RootDataListQueryEntry, b8 as RootDataOperation, b9 as RootDataReadByFilterQueryEntry, ba as RootDataReadByIdQueryEntry, bb as RootModelCountQueryEntry, bc as RootModelCreateQueryEntry, bd as RootModelDeleteQueryEntry, be as RootModelDistinctQueryEntry, bf as RootModelListQueryEntry, bg as RootModelNewQueryEntry, bh as RootModelOperation, bi as RootModelReadByFilterQueryEntry, bj as RootModelReadByIdQueryEntry, bk as RootModelSubBulkUpdateQueryEntry, bl as RootModelSubCreateQueryEntry, bm as RootModelSubDeleteQueryEntry, bn as RootModelSubListQueryEntry, bo as RootModelSubReadQueryEntry, bp as RootModelSubUpdateQueryEntry, bq as RootModelUpdateQueryEntry, br as RootModelUpsertQueryEntry, bs as RootOperationResult, bt as RootQueryEntry, bu as RootRouterOptions, bv as RootSubOperation, bw as RootTarget, bx as RouteGuardAccess, by as SelectAccess, bz as SelectedPopulatedPublicOutput, bA as SelectedPublicOutput, bB as ServiceResult, bC as SingleResult, bD as Sort, bE as SortOrder, bF as StandardSchemaFailure, bG as StandardSchemaInferOutput, bH as StandardSchemaIssue, bI as StandardSchemaPathSegment, bJ as StandardSchemaResult, bK as StandardSchemaSuccess, bL as StandardSchemaV1, bM as StatusCodes, bN as SubListBody, bO as SubPopulate, bP as SubQueryEntry, bQ as SubReadBody, bR as SubdocumentBulkRecord, bS as SubdocumentBulkUpdateInput, bT as SubdocumentCreateInput, bU as SubdocumentCreateOptions, bV as SubdocumentId, bW as SubdocumentListOptions, bX as SubdocumentName, bY as SubdocumentParentArgs, bZ as SubdocumentParentOptions, b_ as SubdocumentReadOptions, b$ as SubdocumentRecord, c0 as SuperstructFailureLike, c1 as SuperstructValidateLike, c2 as Task, c3 as TransformAccess, c4 as TypedFilter, c5 as UpdateByIdArgs, c6 as UpdateByIdOptions, c7 as UpdateOneArgs, c8 as UpdateOneOptions, c9 as UpdateQueryInput, ca as UpsertArgs, cb as UpsertOptions, cc as UpsertQueryInput, cd as ValibotIssueLike, ce as ValibotPathItemLike, cf as ValibotSafeParseLike, cg as ValibotSafeParseResult, ch as ValidateAccess, ci as ValidateRule, cj as Validation, ck as ValidationError, cl as VineValidationErrorLike, cm as VineValidationMessageLike, cn as VineValidatorLike, co as YupSchemaLike, cp as YupValidationErrorLike, cq as defineRequestSchema, cr as fromAjv, cs as fromArkType, ct as fromIoTs, cu as fromJoi, cv as fromStandardSchema, cw as fromSuperstruct, cx as fromValibot, cy as fromVine, cz as fromYup, cA as fromZod, cB as parseBody, cC as parseBodyWithSchema, cD as parseNestedBodyWithSchema, cE as parsePathParam, cF as parseQuery } from './parsers
|
|
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 AjvValidatorLike, n as ArkTypeErrorsLike, o as ArkTypeLike, p as ArkTypeProblemLike, B as BaseFilterAccess, C as Change, q as Codes, r as CountBody, s as CreateArgs, t as CreateOptions, u as CreateQueryInput, v as CustomHeaders, D as DATA_MIDDLEWARE, w as DataBaseFilterHook, x as DataFilter, y as DataFindArgs, z as DataFindOneArgs, E as DataFindOneOptions, F as DataFindOptions, G as DataHook, H as DataHookContext, I as DataIdentifierHook, J as DataListHook, K as DataOverrideFilterHook, L as DataRequest, M as DataRequestSchemas, N as DataRouterOptions, O as DecorateAccess, P as DecorateAllAccess, Q as DeepFieldPath, R as DefaultModelRouterOptions, S as Defaults, T as DistinctArgs, U as DistinctBody, V as DocPermissionsAccess, W as ErrorResult, X as ExistsOptions, Y as ExtendedDataRouterOptions, Z as ExtendedDefaultModelRouterOptions, _ as ExtendedModelRouterOptions, $ as Filter, a0 as FilterOperator, a1 as FindAccess, a2 as FindArgs, a3 as FindByIdArgs, a4 as FindByIdOptions, a5 as FindOneArgs, a6 as FindOneOptions, a7 as FindOptions, a8 as GlobalOptions, a9 as GlobalPermissionValue, aa as GuardHook, ab as IdentifierHook, ac as Include, ad as IoTsContextEntryLike, ae as IoTsDecodeErrorLike, af as IoTsDecoderLike, ag as JoiSchemaLike, ah as JoiValidationErrorDetailLike, ai as KeyValueProjection, aj as ListQueryInput, ak as ListResult, al as MIDDLEWARE, am as MaybePromise, an as ModelBaseFilterHook, ao as ModelChangeHook, ap as ModelDeleteHook, aq as ModelDocPermissionsHook, ar as ModelDocument, as as ModelDocumentHook, at as ModelHook, au as ModelHookContext, av as ModelIdentifierHook, aw as ModelListHook, ax as ModelOverrideFilterHook, ay as ModelRequest, az as ModelRouterOptions, aA as ModelValidateHook, aB as PERMISSIONS, aC as PERMISSION_KEYS, aD as PathValue, aE as PermissionSchema, aF as Populate, aG as PopulateAccess, aH as PrepareAccess, aI as Projection, aJ as PublicCreateArgs, aK as PublicCreateOptions, aL as PublicErrorResult, aM as PublicListArgs, aN as PublicListOptions, aO as PublicListResult, aP as PublicOutput, aQ as PublicReadArgs, aR as PublicReadOptions, aS as PublicServiceResult, aT as PublicSingleResult, aU as PublicUpdateArgs, aV as PublicUpdateOptions, aW as PublicUpsertArgs, aX as PublicUpsertOptions, aY as ReadQueryInput, aZ as Request, a_ as RequestSchemaAdapter, a$ as RequestSchemaFailure, b0 as RequestSchemaIssue, b1 as RequestSchemaLike, b2 as RequestSchemaOptions, b3 as RequestSchemaResult, b4 as RequestSchemaSuccess, b5 as RequestSchemaValidator, b6 as RequestSchemas, b7 as RootDataListQueryEntry, b8 as RootDataOperation, b9 as RootDataReadByFilterQueryEntry, ba as RootDataReadByIdQueryEntry, bb as RootModelCountQueryEntry, bc as RootModelCreateQueryEntry, bd as RootModelDeleteQueryEntry, be as RootModelDistinctQueryEntry, bf as RootModelListQueryEntry, bg as RootModelNewQueryEntry, bh as RootModelOperation, bi as RootModelReadByFilterQueryEntry, bj as RootModelReadByIdQueryEntry, bk as RootModelSubBulkUpdateQueryEntry, bl as RootModelSubCreateQueryEntry, bm as RootModelSubDeleteQueryEntry, bn as RootModelSubListQueryEntry, bo as RootModelSubReadQueryEntry, bp as RootModelSubUpdateQueryEntry, bq as RootModelUpdateQueryEntry, br as RootModelUpsertQueryEntry, bs as RootOperationResult, bt as RootQueryEntry, bu as RootRouterOptions, bv as RootSubOperation, bw as RootTarget, bx as RouteGuardAccess, by as SelectAccess, bz as SelectedPopulatedPublicOutput, bA as SelectedPublicOutput, bB as ServiceResult, bC as SingleResult, bD as Sort, bE as SortOrder, bF as StandardSchemaFailure, bG as StandardSchemaInferOutput, bH as StandardSchemaIssue, bI as StandardSchemaPathSegment, bJ as StandardSchemaResult, bK as StandardSchemaSuccess, bL as StandardSchemaV1, bM as StatusCodes, bN as SubListBody, bO as SubPopulate, bP as SubQueryEntry, bQ as SubReadBody, bR as SubdocumentBulkRecord, bS as SubdocumentBulkUpdateInput, bT as SubdocumentCreateInput, bU as SubdocumentCreateOptions, bV as SubdocumentId, bW as SubdocumentListOptions, bX as SubdocumentName, bY as SubdocumentParentArgs, bZ as SubdocumentParentOptions, b_ as SubdocumentReadOptions, b$ as SubdocumentRecord, c0 as SuperstructFailureLike, c1 as SuperstructValidateLike, c2 as Task, c3 as TransformAccess, c4 as TypedFilter, c5 as UpdateByIdArgs, c6 as UpdateByIdOptions, c7 as UpdateOneArgs, c8 as UpdateOneOptions, c9 as UpdateQueryInput, ca as UpsertArgs, cb as UpsertOptions, cc as UpsertQueryInput, cd as ValibotIssueLike, ce as ValibotPathItemLike, cf as ValibotSafeParseLike, cg as ValibotSafeParseResult, ch as ValidateAccess, ci as ValidateRule, cj as Validation, ck as ValidationError, cl as VineValidationErrorLike, cm as VineValidationMessageLike, cn as VineValidatorLike, co as YupSchemaLike, cp as YupValidationErrorLike, cq as defineRequestSchema, cr as fromAjv, cs as fromArkType, ct as fromIoTs, cu as fromJoi, cv as fromStandardSchema, cw as fromSuperstruct, cx as fromValibot, cy as fromVine, cz as fromYup, cA as fromZod, cB as parseBody, cC as parseBodyWithSchema, cD as parseNestedBodyWithSchema, cE as parsePathParam, cF as parseQuery } from './parsers-PMWujHUV.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'express';
|
|
@@ -448,7 +448,7 @@ declare const requestSchemas: {
|
|
|
448
448
|
declare const dataListBodySchema: z.ZodObject<{
|
|
449
449
|
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
450
450
|
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
451
|
-
sort: z.ZodOptional<z.ZodString
|
|
451
|
+
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
452
452
|
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
453
453
|
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
454
454
|
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
@@ -902,7 +902,7 @@ declare const rootQuerySchema: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
902
902
|
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
903
903
|
args: z.ZodOptional<z.ZodObject<{
|
|
904
904
|
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
905
|
-
sort: z.ZodOptional<z.ZodString
|
|
905
|
+
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
906
906
|
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
907
907
|
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
908
908
|
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|