@bedrockio/model 0.19.0 → 0.19.1
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/CHANGELOG.md +5 -0
- package/dist/cjs/cache.js +4 -1
- package/package.json +1 -1
- package/src/cache.js +5 -1
- package/types/schema.d.ts +5 -8
- package/types/schema.d.ts.map +1 -1
- package/types/search.d.ts +0 -5
- package/types/search.d.ts.map +1 -1
- package/types/validation-schemas.d.ts +0 -20
- package/types/validation-schemas.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/cache.js
CHANGED
|
@@ -227,10 +227,13 @@ function getUpdates(doc, fields) {
|
|
|
227
227
|
function getIncludes(fields) {
|
|
228
228
|
const includes = new Set();
|
|
229
229
|
for (let field of fields) {
|
|
230
|
-
includes.add(field.
|
|
230
|
+
includes.add(getPathBase(field.path));
|
|
231
231
|
}
|
|
232
232
|
return includes;
|
|
233
233
|
}
|
|
234
|
+
function getPathBase(path) {
|
|
235
|
+
return path.split('.').slice(0, -1).join('.');
|
|
236
|
+
}
|
|
234
237
|
|
|
235
238
|
// Assertions
|
|
236
239
|
|
package/package.json
CHANGED
package/src/cache.js
CHANGED
|
@@ -232,11 +232,15 @@ function getUpdates(doc, fields) {
|
|
|
232
232
|
function getIncludes(fields) {
|
|
233
233
|
const includes = new Set();
|
|
234
234
|
for (let field of fields) {
|
|
235
|
-
includes.add(field.
|
|
235
|
+
includes.add(getPathBase(field.path));
|
|
236
236
|
}
|
|
237
237
|
return includes;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
function getPathBase(path) {
|
|
241
|
+
return path.split('.').slice(0, -1).join('.');
|
|
242
|
+
}
|
|
243
|
+
|
|
240
244
|
// Assertions
|
|
241
245
|
|
|
242
246
|
function assertIncludeModule(Model) {
|
package/types/schema.d.ts
CHANGED
|
@@ -28,9 +28,7 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
28
28
|
id?: boolean;
|
|
29
29
|
_id?: boolean;
|
|
30
30
|
minimize?: boolean;
|
|
31
|
-
optimisticConcurrency?: boolean
|
|
32
|
-
exclude: string[];
|
|
33
|
-
};
|
|
31
|
+
optimisticConcurrency?: boolean;
|
|
34
32
|
pluginTags?: string[];
|
|
35
33
|
read?: string;
|
|
36
34
|
readConcern?: {
|
|
@@ -49,16 +47,16 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
49
47
|
getters: boolean;
|
|
50
48
|
versionKey: boolean;
|
|
51
49
|
transform: (doc: any, ret: any, options: any) => void;
|
|
52
|
-
} | mongoose.ToObjectOptions<any
|
|
50
|
+
} | mongoose.ToObjectOptions<any>;
|
|
53
51
|
toObject: {
|
|
54
52
|
getters: boolean;
|
|
55
53
|
versionKey: boolean;
|
|
56
54
|
transform: (doc: any, ret: any, options: any) => void;
|
|
57
|
-
} | mongoose.ToObjectOptions<any
|
|
55
|
+
} | mongoose.ToObjectOptions<any>;
|
|
58
56
|
typeKey?: string;
|
|
59
57
|
validateBeforeSave?: boolean;
|
|
60
58
|
validateModifiedOnly?: boolean;
|
|
61
|
-
versionKey?: string |
|
|
59
|
+
versionKey?: string | boolean;
|
|
62
60
|
selectPopulatedPaths?: boolean;
|
|
63
61
|
skipVersioning?: {
|
|
64
62
|
[key: string]: boolean;
|
|
@@ -66,13 +64,12 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
66
64
|
storeSubdocValidationError?: boolean;
|
|
67
65
|
timestamps: boolean | mongoose.SchemaTimestampsConfig;
|
|
68
66
|
suppressReservedKeysWarning?: boolean;
|
|
69
|
-
statics?: mongoose.AddThisParameter<any, mongoose.Model<any,
|
|
67
|
+
statics?: mongoose.AddThisParameter<any, mongoose.Model<any, {}, {}, {}, any, any>>;
|
|
70
68
|
methods?: mongoose.AddThisParameter<any, any> & mongoose.AnyObject;
|
|
71
69
|
query?: any;
|
|
72
70
|
castNonArrays?: boolean;
|
|
73
71
|
virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
|
|
74
72
|
overwriteModels?: boolean;
|
|
75
|
-
encryptionType?: "csfle" | "queryableEncryption";
|
|
76
73
|
}, any, any>;
|
|
77
74
|
export function normalizeAttributes(arg: any, path?: any[]): any;
|
|
78
75
|
import mongoose from 'mongoose';
|
package/types/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa;;;;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa;;;;;;;YAuC/B,CAAC;WAAa,CAAC;mBACF,CAAC;;;;;;;;;;;;;;;;;;;;;SAsHkC,CAAC;gBACzC,CAAA;SAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA9GrB;AAED,iEAcC;qBA9FoB,UAAU"}
|
package/types/search.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export function applySearch(schema: any, definition: any): void;
|
|
2
2
|
export function searchValidation(options?: {}): {
|
|
3
|
-
validateInput(): void;
|
|
4
3
|
setup(): void;
|
|
5
4
|
get(path?: string | Array<string>): any;
|
|
6
5
|
unwind(path?: string | Array<string>): any;
|
|
@@ -11,10 +10,6 @@ export function searchValidation(options?: {}): {
|
|
|
11
10
|
transform(fn: Function, root?: boolean): /*elided*/ any;
|
|
12
11
|
export(): any;
|
|
13
12
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
14
|
-
stripEmpty(): /*elided*/ any;
|
|
15
|
-
stripUnknown(): /*elided*/ any;
|
|
16
|
-
allowFlatKeys(): /*elided*/ any;
|
|
17
|
-
expandFlatKeys(): /*elided*/ any;
|
|
18
13
|
options(options?: {
|
|
19
14
|
stripEmpty?: boolean;
|
|
20
15
|
stripUnknown?: boolean;
|
package/types/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAuBA,gEAaC;AAED
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAuBA,gEAaC;AAED;;;;;;;;;;;;kBAmHU,CAAC;oBAGD,CAAP;qBACoB,CAAC;sBAGlB,CAAD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA7B6B,CAAC;;;;;;;;;;;;;;EApElC;AAED;;;;;;;;;;;;;;;;mBA1BmD,CAAC;;;;;;;;;;;;qBAuBlD,CAAC;sBAGmB,CAAC;sBACrB,CAAC;wBAA8B,CAAC;wBACrB,CAAC;;;4BAwBc,CAAC;kCAK3B,CAAD;wBACc,CAAC;wBAA+B,CAAC;wCACtB,CAAC;2BAGhB,CAAC;kCAES,CAAC;2BACd,CAAC;qBACL,CAAJ;;;uBAuBgC,CAAC;6BAEjB,CAAC;8BACF,CAAC;6BAGZ,CAAH;0BACgB,CAAC;6BACZ,CAAF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAL8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA5FgB,CAAC;;;;;;;;;;;;qBAuBlD,CAAC;sBAGmB,CAAC;sBACrB,CAAC;wBAA8B,CAAC;wBACrB,CAAC;;;4BAwBc,CAAC;kCAK3B,CAAD;wBACc,CAAC;wBAA+B,CAAC;wCACtB,CAAC;2BAGhB,CAAC;kCAES,CAAC;2BACd,CAAC;qBACL,CAAJ;;;uBAuBgC,CAAC;6BAEjB,CAAC;8BACF,CAAC;6BAGZ,CAAH;0BACgB,CAAC;6BACZ,CAAF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAL8B,CAAC;;;;;;;;;;;;;;;;;EArDlC"}
|
|
@@ -162,7 +162,6 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
162
162
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
163
163
|
};
|
|
164
164
|
export const NUMBER_RANGE_SCHEMA: {
|
|
165
|
-
validateInput(): void;
|
|
166
165
|
setup(): void;
|
|
167
166
|
get(path?: string | Array<string>): any;
|
|
168
167
|
unwind(path?: string | Array<string>): any;
|
|
@@ -173,10 +172,6 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
173
172
|
transform(fn: Function, root?: boolean): /*elided*/ any;
|
|
174
173
|
export(): any;
|
|
175
174
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
176
|
-
stripEmpty(): /*elided*/ any;
|
|
177
|
-
stripUnknown(): /*elided*/ any;
|
|
178
|
-
allowFlatKeys(): /*elided*/ any;
|
|
179
|
-
expandFlatKeys(): /*elided*/ any;
|
|
180
175
|
options(options?: {
|
|
181
176
|
stripEmpty?: boolean;
|
|
182
177
|
stripUnknown?: boolean;
|
|
@@ -226,7 +221,6 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
226
221
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
227
222
|
};
|
|
228
223
|
export const STRING_RANGE_SCHEMA: {
|
|
229
|
-
validateInput(): void;
|
|
230
224
|
setup(): void;
|
|
231
225
|
get(path?: string | Array<string>): any;
|
|
232
226
|
unwind(path?: string | Array<string>): any;
|
|
@@ -237,10 +231,6 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
237
231
|
transform(fn: Function, root?: boolean): /*elided*/ any;
|
|
238
232
|
export(): any;
|
|
239
233
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
240
|
-
stripEmpty(): /*elided*/ any;
|
|
241
|
-
stripUnknown(): /*elided*/ any;
|
|
242
|
-
allowFlatKeys(): /*elided*/ any;
|
|
243
|
-
expandFlatKeys(): /*elided*/ any;
|
|
244
234
|
options(options?: {
|
|
245
235
|
stripEmpty?: boolean;
|
|
246
236
|
stripUnknown?: boolean;
|
|
@@ -290,7 +280,6 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
290
280
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
291
281
|
};
|
|
292
282
|
export const DATE_RANGE_SCHEMA: {
|
|
293
|
-
validateInput(): void;
|
|
294
283
|
setup(): void;
|
|
295
284
|
get(path?: string | Array<string>): any;
|
|
296
285
|
unwind(path?: string | Array<string>): any;
|
|
@@ -301,10 +290,6 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
301
290
|
transform(fn: Function, root?: boolean): /*elided*/ any;
|
|
302
291
|
export(): any;
|
|
303
292
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
304
|
-
stripEmpty(): /*elided*/ any;
|
|
305
|
-
stripUnknown(): /*elided*/ any;
|
|
306
|
-
allowFlatKeys(): /*elided*/ any;
|
|
307
|
-
expandFlatKeys(): /*elided*/ any;
|
|
308
293
|
options(options?: {
|
|
309
294
|
stripEmpty?: boolean;
|
|
310
295
|
stripUnknown?: boolean;
|
|
@@ -355,7 +340,6 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
355
340
|
};
|
|
356
341
|
export const REFERENCE_SCHEMA: import("@bedrockio/yada/types/Schema").default;
|
|
357
342
|
export const INCLUDE_FIELD_SCHEMA: {
|
|
358
|
-
validateInput(): void;
|
|
359
343
|
setup(): void;
|
|
360
344
|
get(path?: string | Array<string>): any;
|
|
361
345
|
unwind(path?: string | Array<string>): any;
|
|
@@ -366,10 +350,6 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
366
350
|
transform(fn: Function, root?: boolean): /*elided*/ any;
|
|
367
351
|
export(): any;
|
|
368
352
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
369
|
-
stripEmpty(): /*elided*/ any;
|
|
370
|
-
stripUnknown(): /*elided*/ any;
|
|
371
|
-
allowFlatKeys(): /*elided*/ any;
|
|
372
|
-
expandFlatKeys(): /*elided*/ any;
|
|
373
353
|
options(options?: {
|
|
374
354
|
stripEmpty?: boolean;
|
|
375
355
|
stripUnknown?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2FwE,CAAC;aACjE,CAAC;uBAGc,CAAC;;;;;;;;;;;eAO2H,CAAC;;;;;;;;;;;;;;;;EAtG1F;AAE1D;;;;;;;;;;;;;;;eAwBwB,CAAC;;;;;;;;;;;;iBAoBjB,CAAC;kBAEC,CAAC;kBAEH,CAAH;oBAA8B,CAAC;oBAEhC,CAAD;;;wBA4BW,CAAC;8BAEK,CAAA;oBAEd,CAAF;oBAEiB,CAAC;oCACjB,CAAC;uBAEF,CAAD;8BACkB,CAAC;uBAAkC,CAAC;iBAA4B,CAAC;;;mBAYjC,CAAC;yBAAoC,CAAC;0BAAqC,CAAC;yBAAoC,CAAC;sBAAiC,CAAC;yBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAA1F,CAAC;;;;;;;;;;;;;;;;EA5F/I;AAEL
|
|
1
|
+
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2FwE,CAAC;aACjE,CAAC;uBAGc,CAAC;;;;;;;;;;;eAO2H,CAAC;;;;;;;;;;;;;;;;EAtG1F;AAE1D;;;;;;;;;;;;;;;eAwBwB,CAAC;;;;;;;;;;;;iBAoBjB,CAAC;kBAEC,CAAC;kBAEH,CAAH;oBAA8B,CAAC;oBAEhC,CAAD;;;wBA4BW,CAAC;8BAEK,CAAA;oBAEd,CAAF;oBAEiB,CAAC;oCACjB,CAAC;uBAEF,CAAD;8BACkB,CAAC;uBAAkC,CAAC;iBAA4B,CAAC;;;mBAYjC,CAAC;yBAAoC,CAAC;0BAAqC,CAAC;yBAAoC,CAAC;sBAAiC,CAAC;yBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAA1F,CAAC;;;;;;;;;;;;;;;;EA5F/I;AAEL;;;;;;;;;;;;kBA0FghB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAje,CAAC;;;;;;;;;;;;;;EAhF/I;AAEL;;;;;;;;;;;;kBA8EghB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAje,CAAC;;;;;;;;;;;;;;EApE/I;AAEL;;;;;;;;;;;;kBAkEghB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAje,CAAC;;;;;;;;;;;;;;EAhC/I;AAEL,8EAqBK;AAEL;;;;;;;;;;;;kBAOghB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAje,CAAC;;;;;;;;;;;;;;EADjJ"}
|