@bedrockio/model 0.18.4 → 0.18.5
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/utils.js +9 -1
- package/dist/cjs/warn.js +2 -3
- package/package.json +1 -1
- package/src/utils.js +9 -1
- package/src/warn.js +2 -3
- package/types/schema.d.ts +5 -9
- package/types/schema.d.ts.map +1 -1
- package/types/utils.d.ts.map +1 -1
- package/types/warn.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/utils.js
CHANGED
|
@@ -142,7 +142,15 @@ function getInnerField(obj, path) {
|
|
|
142
142
|
}
|
|
143
143
|
function resolveInnerField(field) {
|
|
144
144
|
if (Array.isArray(field?.type)) {
|
|
145
|
-
|
|
145
|
+
// An unspecified array type has no inner
|
|
146
|
+
// fields so return Array as the type.
|
|
147
|
+
if (field.type.length === 0) {
|
|
148
|
+
return {
|
|
149
|
+
type: 'Array'
|
|
150
|
+
};
|
|
151
|
+
} else {
|
|
152
|
+
field = field.type[0];
|
|
153
|
+
}
|
|
146
154
|
}
|
|
147
155
|
if (field?.type instanceof _mongoose.default.Schema) {
|
|
148
156
|
field = field.type.obj;
|
package/dist/cjs/warn.js
CHANGED
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = warn;
|
|
7
|
-
var _logger = _interopRequireDefault(require("@bedrockio/logger"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
7
|
function warn(...lines) {
|
|
10
8
|
if (process.env.ENV_NAME !== 'test') {
|
|
11
|
-
|
|
9
|
+
// Allow warnings to be traced.
|
|
10
|
+
process.emitWarning(lines.join('\n'));
|
|
12
11
|
}
|
|
13
12
|
}
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -130,7 +130,15 @@ export function getInnerField(obj, path) {
|
|
|
130
130
|
|
|
131
131
|
function resolveInnerField(field) {
|
|
132
132
|
if (Array.isArray(field?.type)) {
|
|
133
|
-
|
|
133
|
+
// An unspecified array type has no inner
|
|
134
|
+
// fields so return Array as the type.
|
|
135
|
+
if (field.type.length === 0) {
|
|
136
|
+
return {
|
|
137
|
+
type: 'Array',
|
|
138
|
+
};
|
|
139
|
+
} else {
|
|
140
|
+
field = field.type[0];
|
|
141
|
+
}
|
|
134
142
|
}
|
|
135
143
|
if (field?.type instanceof mongoose.Schema) {
|
|
136
144
|
field = field.type.obj;
|
package/src/warn.js
CHANGED
package/types/schema.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
19
19
|
};
|
|
20
20
|
collation?: mongoose.mongo.CollationOptions;
|
|
21
21
|
collectionOptions?: mongoose.mongo.CreateCollectionOptions;
|
|
22
|
-
lean?: boolean | mongoose.LeanOptions;
|
|
23
22
|
timeseries?: mongoose.mongo.TimeSeriesCollectionOptions;
|
|
24
23
|
expireAfterSeconds?: number;
|
|
25
24
|
expires?: number | string;
|
|
@@ -29,9 +28,7 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
29
28
|
id?: boolean;
|
|
30
29
|
_id?: boolean;
|
|
31
30
|
minimize?: boolean;
|
|
32
|
-
optimisticConcurrency?: boolean
|
|
33
|
-
exclude: string[];
|
|
34
|
-
};
|
|
31
|
+
optimisticConcurrency?: boolean;
|
|
35
32
|
pluginTags?: string[];
|
|
36
33
|
read?: string;
|
|
37
34
|
readConcern?: {
|
|
@@ -50,16 +47,16 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
50
47
|
getters: boolean;
|
|
51
48
|
versionKey: boolean;
|
|
52
49
|
transform: (doc: any, ret: any, options: any) => void;
|
|
53
|
-
} | mongoose.ToObjectOptions<any
|
|
50
|
+
} | mongoose.ToObjectOptions<any>;
|
|
54
51
|
toObject: {
|
|
55
52
|
getters: boolean;
|
|
56
53
|
versionKey: boolean;
|
|
57
54
|
transform: (doc: any, ret: any, options: any) => void;
|
|
58
|
-
} | mongoose.ToObjectOptions<any
|
|
55
|
+
} | mongoose.ToObjectOptions<any>;
|
|
59
56
|
typeKey?: string;
|
|
60
57
|
validateBeforeSave?: boolean;
|
|
61
58
|
validateModifiedOnly?: boolean;
|
|
62
|
-
versionKey?: string |
|
|
59
|
+
versionKey?: string | boolean;
|
|
63
60
|
selectPopulatedPaths?: boolean;
|
|
64
61
|
skipVersioning?: {
|
|
65
62
|
[key: string]: boolean;
|
|
@@ -67,13 +64,12 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
67
64
|
storeSubdocValidationError?: boolean;
|
|
68
65
|
timestamps: boolean | mongoose.SchemaTimestampsConfig;
|
|
69
66
|
suppressReservedKeysWarning?: boolean;
|
|
70
|
-
statics?: mongoose.AddThisParameter<any, mongoose.Model<any,
|
|
67
|
+
statics?: mongoose.AddThisParameter<any, mongoose.Model<any, {}, {}, {}, any, any>>;
|
|
71
68
|
methods?: mongoose.AddThisParameter<any, any> & mongoose.AnyObject;
|
|
72
69
|
query?: any;
|
|
73
70
|
castNonArrays?: boolean;
|
|
74
71
|
virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
|
|
75
72
|
overwriteModels?: boolean;
|
|
76
|
-
encryptionType?: "csfle" | "queryableEncryption";
|
|
77
73
|
}, any, any>;
|
|
78
74
|
export function normalizeAttributes(arg: any, path?: any[]): any;
|
|
79
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/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAQA,iDAcC;AAED,gHAEC;AAED,+DAEC;AAED,0DAEC;AAED,4DAEC;AAED,4DAEC;AAED,2DAGC;AAOD,mDAGC;AAuBD,mDAgBC;AAKD;;;;EAoBC;AAKD,wDAEC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAQA,iDAcC;AAED,gHAEC;AAED,+DAEC;AAED,0DAEC;AAED,4DAEC;AAED,4DAEC;AAED,2DAGC;AAOD,mDAGC;AAuBD,mDAgBC;AAKD;;;;EAoBC;AAKD,wDAEC;AAsBD,iDAYC;qBAlKoB,UAAU"}
|
package/types/warn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../src/warn.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../src/warn.js"],"names":[],"mappings":"AAAA,oDAKC"}
|