@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.
@@ -227,13 +227,13 @@ function applyScopeExtension(typedef, definition) {
227
227
  ...options
228
228
  };
229
229
  } else {
230
- val = attributesToMongoose({
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/schema.js CHANGED
@@ -236,13 +236,13 @@ function applyScopeExtension(typedef, definition) {
236
236
  ...options,
237
237
  };
238
238
  } else {
239
- val = attributesToMongoose({
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.
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,sCAJW,MAAM,QACN,MAAM,OAahB;AAED;;;;GAIG;AACH,sCAFW,MAAM,mBAkBhB"}
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, 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?: mongoose.AddThisParameter<any, mongoose.Model<any, {}, {}, {}, any, any>>;
64
- methods?: mongoose.AddThisParameter<any, any> & mongoose.AnyObject;
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>;
@@ -1 +1 @@
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"}
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"}