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