@bedrockio/model 0.1.3 → 0.1.4
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/validation.js +3 -1
- package/package.json +3 -2
- package/src/validation.js +3 -1
- package/types/schema.d.ts +3 -3
- package/types/validation.d.ts.map +1 -1
package/dist/cjs/validation.js
CHANGED
|
@@ -346,7 +346,9 @@ function getTupleValidator(types) {
|
|
|
346
346
|
types = types.map(type => {
|
|
347
347
|
return getSchemaForTypedef(type);
|
|
348
348
|
});
|
|
349
|
-
|
|
349
|
+
// Using "loose" here to allow empty arrays through,
|
|
350
|
+
// which mongoose defaults to for array fields.
|
|
351
|
+
return wrapSchemaAsValidator(_yada.default.tuple(types).loose());
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
// Returns an async function that will error on failure.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Bedrock utilities for model creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@bedrockio/logger": "^1.0.5",
|
|
29
|
-
"@bedrockio/yada": "^1.0.17",
|
|
30
29
|
"lodash": "^4.17.21"
|
|
31
30
|
},
|
|
32
31
|
"peerDependencies": {
|
|
32
|
+
"@bedrockio/yada": "^1.0.18",
|
|
33
33
|
"mongoose": "^6.9.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@babel/core": "^7.20.12",
|
|
38
38
|
"@babel/preset-env": "^7.20.2",
|
|
39
39
|
"@bedrockio/prettier-config": "^1.0.2",
|
|
40
|
+
"@bedrockio/yada": "^1.0.18",
|
|
40
41
|
"@shelf/jest-mongodb": "^4.1.6",
|
|
41
42
|
"babel-plugin-import-replacement": "^1.0.1",
|
|
42
43
|
"eslint": "^8.33.0",
|
package/src/validation.js
CHANGED
|
@@ -385,7 +385,9 @@ export function getTupleValidator(types) {
|
|
|
385
385
|
types = types.map((type) => {
|
|
386
386
|
return getSchemaForTypedef(type);
|
|
387
387
|
});
|
|
388
|
-
|
|
388
|
+
// Using "loose" here to allow empty arrays through,
|
|
389
|
+
// which mongoose defaults to for array fields.
|
|
390
|
+
return wrapSchemaAsValidator(yd.tuple(types).loose());
|
|
389
391
|
}
|
|
390
392
|
|
|
391
393
|
// Returns an async function that will error on failure.
|
package/types/schema.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
16
16
|
max?: number;
|
|
17
17
|
autoIndexId?: boolean;
|
|
18
18
|
};
|
|
19
|
-
collation?: import("mongodb").CollationOptions;
|
|
20
|
-
timeseries?: import("mongodb").TimeSeriesCollectionOptions;
|
|
19
|
+
collation?: import("mongoose/node_modules/mongodb").CollationOptions;
|
|
20
|
+
timeseries?: import("mongoose/node_modules/mongodb").TimeSeriesCollectionOptions;
|
|
21
21
|
expireAfterSeconds?: number;
|
|
22
22
|
expires?: string | number;
|
|
23
23
|
collection?: string;
|
|
@@ -29,7 +29,7 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
29
29
|
optimisticConcurrency?: boolean;
|
|
30
30
|
pluginTags?: string[];
|
|
31
31
|
read?: string;
|
|
32
|
-
writeConcern?: import("mongodb").WriteConcern;
|
|
32
|
+
writeConcern?: import("mongoose/node_modules/mongodb").WriteConcern;
|
|
33
33
|
safe?: boolean | {
|
|
34
34
|
w?: string | number;
|
|
35
35
|
wtimeout?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiEA,kDAEC;AAED,oEA0DC;AAaD,wEAeC;AAgOD;;;EAEC;AAED;;;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiEA,kDAEC;AAED,oEA0DC;AAaD,wEAeC;AAgOD;;;EAEC;AAED;;;EAOC;AA/WD,8EAUK"}
|