@bedrockio/model 0.2.19 → 0.2.20
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/dist/cjs/schema.js +3 -3
- package/package.json +1 -1
- package/src/schema.js +3 -3
- package/types/load.d.ts +67 -1
- package/types/load.d.ts.map +1 -1
- package/types/schema.d.ts +7 -3
- package/types/schema.d.ts.map +1 -1
package/dist/cjs/schema.js
CHANGED
|
@@ -227,13 +227,13 @@ function applyScopeExtension(typedef, definition) {
|
|
|
227
227
|
...options
|
|
228
228
|
};
|
|
229
229
|
} else {
|
|
230
|
-
val =
|
|
230
|
+
val = {
|
|
231
231
|
type: 'Object',
|
|
232
232
|
attributes: val,
|
|
233
233
|
...options
|
|
234
|
-
}
|
|
234
|
+
};
|
|
235
235
|
}
|
|
236
|
-
definition[key] = val;
|
|
236
|
+
definition[key] = attributesToMongoose(val);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
package/package.json
CHANGED
package/src/schema.js
CHANGED
|
@@ -236,13 +236,13 @@ function applyScopeExtension(typedef, definition) {
|
|
|
236
236
|
...options,
|
|
237
237
|
};
|
|
238
238
|
} else {
|
|
239
|
-
val =
|
|
239
|
+
val = {
|
|
240
240
|
type: 'Object',
|
|
241
241
|
attributes: val,
|
|
242
242
|
...options,
|
|
243
|
-
}
|
|
243
|
+
};
|
|
244
244
|
}
|
|
245
|
-
definition[key] = val;
|
|
245
|
+
definition[key] = attributesToMongoose(val);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
package/types/load.d.ts
CHANGED
|
@@ -4,7 +4,73 @@
|
|
|
4
4
|
* @param {string} name
|
|
5
5
|
* @returns mongoose.Model
|
|
6
6
|
*/
|
|
7
|
-
export function loadModel(definition: object, name: string): any
|
|
7
|
+
export function loadModel(definition: object, name: string): mongoose.Model<any, any, any, any, any, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, any, any, any, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, {
|
|
10
|
+
autoIndex?: boolean;
|
|
11
|
+
autoCreate?: boolean;
|
|
12
|
+
bufferCommands?: boolean;
|
|
13
|
+
bufferTimeoutMS?: number;
|
|
14
|
+
capped?: number | boolean | {
|
|
15
|
+
size?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
autoIndexId?: boolean;
|
|
18
|
+
};
|
|
19
|
+
collation?: mongoose.mongo.CollationOptions;
|
|
20
|
+
collectionOptions?: mongoose.mongo.CreateCollectionOptions;
|
|
21
|
+
timeseries?: mongoose.mongo.TimeSeriesCollectionOptions;
|
|
22
|
+
expireAfterSeconds?: number;
|
|
23
|
+
expires?: string | number;
|
|
24
|
+
collection?: string;
|
|
25
|
+
discriminatorKey?: string;
|
|
26
|
+
excludeIndexes?: boolean;
|
|
27
|
+
id?: boolean;
|
|
28
|
+
_id?: boolean;
|
|
29
|
+
minimize?: boolean;
|
|
30
|
+
optimisticConcurrency?: boolean;
|
|
31
|
+
pluginTags?: string[];
|
|
32
|
+
read?: string;
|
|
33
|
+
writeConcern?: mongoose.mongo.WriteConcern;
|
|
34
|
+
safe?: boolean | {
|
|
35
|
+
w?: string | number;
|
|
36
|
+
wtimeout?: number;
|
|
37
|
+
j?: boolean;
|
|
38
|
+
};
|
|
39
|
+
shardKey?: Record<string, unknown>;
|
|
40
|
+
strict?: boolean | "throw";
|
|
41
|
+
strictQuery?: boolean | "throw";
|
|
42
|
+
toJSON: {
|
|
43
|
+
getters: boolean;
|
|
44
|
+
versionKey: boolean;
|
|
45
|
+
transform: (doc: any, ret: any, options: any) => void;
|
|
46
|
+
} | mongoose.ToObjectOptions<any>;
|
|
47
|
+
toObject: {
|
|
48
|
+
getters: boolean;
|
|
49
|
+
versionKey: boolean;
|
|
50
|
+
transform: (doc: any, ret: any, options: any) => void;
|
|
51
|
+
} | mongoose.ToObjectOptions<any>;
|
|
52
|
+
typeKey?: string;
|
|
53
|
+
validateBeforeSave?: boolean;
|
|
54
|
+
validateModifiedOnly?: boolean;
|
|
55
|
+
versionKey?: string | boolean;
|
|
56
|
+
selectPopulatedPaths?: boolean;
|
|
57
|
+
skipVersioning?: {
|
|
58
|
+
[key: string]: boolean;
|
|
59
|
+
};
|
|
60
|
+
storeSubdocValidationError?: boolean;
|
|
61
|
+
timestamps: boolean | mongoose.SchemaTimestampsConfig;
|
|
62
|
+
suppressReservedKeysWarning?: boolean;
|
|
63
|
+
statics?: {
|
|
64
|
+
[x: string]: any;
|
|
65
|
+
};
|
|
66
|
+
methods?: any;
|
|
67
|
+
query?: any;
|
|
68
|
+
castNonArrays?: boolean;
|
|
69
|
+
virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
|
|
70
|
+
overwriteModels?: boolean;
|
|
71
|
+
}, any, any>> & {
|
|
72
|
+
[x: string]: any;
|
|
73
|
+
};
|
|
8
74
|
/**
|
|
9
75
|
* Loads all model definitions in the given directory.
|
|
10
76
|
* Returns the full loaded model set.
|
package/types/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,sCAJW,MAAM,QACN,MAAM
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,sCAJW,MAAM,QACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAahB;AAED;;;;GAIG;AACH,sCAFW,MAAM,mBAkBhB"}
|
package/types/schema.d.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* @param {mongoose.SchemaOptions} options
|
|
7
7
|
* @returns mongoose.Schema
|
|
8
8
|
*/
|
|
9
|
-
export function createSchema(definition: object, options?: mongoose.SchemaOptions): mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, any, any, any,
|
|
9
|
+
export function createSchema(definition: object, options?: mongoose.SchemaOptions): mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, any, any, any, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, {
|
|
10
12
|
autoIndex?: boolean;
|
|
11
13
|
autoCreate?: boolean;
|
|
12
14
|
bufferCommands?: boolean;
|
|
@@ -60,8 +62,10 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
60
62
|
storeSubdocValidationError?: boolean;
|
|
61
63
|
timestamps: boolean | mongoose.SchemaTimestampsConfig;
|
|
62
64
|
suppressReservedKeysWarning?: boolean;
|
|
63
|
-
statics?:
|
|
64
|
-
|
|
65
|
+
statics?: {
|
|
66
|
+
[x: string]: any;
|
|
67
|
+
};
|
|
68
|
+
methods?: any;
|
|
65
69
|
query?: any;
|
|
66
70
|
castNonArrays?: boolean;
|
|
67
71
|
virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
|
package/types/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,SAAS,aAAa
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,SAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAuChC;AAED,iEAsBC"}
|