@bedrockio/model 0.13.3 → 0.14.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 +12 -0
- package/dist/cjs/assign.js +20 -51
- package/dist/cjs/cache.js +1 -1
- package/dist/cjs/delete-hooks.js +1 -1
- package/dist/cjs/include.js +3 -3
- package/dist/cjs/load.js +1 -1
- package/dist/cjs/schema.js +9 -9
- package/dist/cjs/search.js +4 -4
- package/dist/cjs/serialization.js +1 -1
- package/dist/cjs/soft-delete.js +2 -2
- package/dist/cjs/validation.js +13 -5
- package/eslint.config.js +1 -1
- package/package.json +14 -14
- package/src/assign.js +20 -51
- package/src/cache.js +1 -1
- package/src/delete-hooks.js +1 -1
- package/src/include.js +3 -3
- package/src/load.js +1 -1
- package/src/schema.js +9 -10
- package/src/search.js +6 -6
- package/src/serialization.js +1 -1
- package/src/soft-delete.js +2 -3
- package/src/validation.js +19 -11
- package/types/assign.d.ts.map +1 -1
- package/types/include.d.ts +7 -1
- package/types/include.d.ts.map +1 -1
- package/types/load.d.ts.map +1 -1
- package/types/schema.d.ts +8 -5
- package/types/schema.d.ts.map +1 -1
- package/types/search.d.ts +15 -1
- package/types/search.d.ts.map +1 -1
- package/types/soft-delete.d.ts.map +1 -1
- package/types/validation-schemas.d.ts +29 -3
- package/types/validation-schemas.d.ts.map +1 -1
- package/types/validation.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.14.1
|
|
2
|
+
|
|
3
|
+
- Ensure includes are allowed on `getUpdateValidattion`.
|
|
4
|
+
|
|
5
|
+
## 0.14.0
|
|
6
|
+
|
|
7
|
+
- More clearly defined assign behavior on nested fields.
|
|
8
|
+
- Flat syntax will be equivalent to PATCH behavior.
|
|
9
|
+
- Nested syntax will be equivalent to PUT behavior.
|
|
10
|
+
- Both types are consistent across objects and arrays.
|
|
11
|
+
- Version bumps.
|
|
12
|
+
|
|
1
13
|
## 0.13.3
|
|
2
14
|
|
|
3
15
|
- Bumped yada version.
|
package/dist/cjs/assign.js
CHANGED
|
@@ -5,62 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyAssign = applyAssign;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
9
|
-
var _utils = require("./utils");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
8
|
function applyAssign(schema) {
|
|
12
9
|
schema.method('assign', function assign(fields) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (value === null || value === '') {
|
|
16
|
-
this.set(path, undefined);
|
|
17
|
-
} else {
|
|
18
|
-
this.set(path, value);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
10
|
+
fields = unsetFalsyValues(fields);
|
|
11
|
+
this.set(fields);
|
|
21
12
|
});
|
|
22
13
|
}
|
|
23
14
|
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Flattens nested objects to a dot syntax.
|
|
40
|
-
// Effectively the inverse of lodash get:
|
|
41
|
-
// { foo: { bar: 3 } } -> { 'foo.bar': 3 }
|
|
42
|
-
function flattenObject(obj, root = {}, rootPath = []) {
|
|
43
|
-
for (let [key, val] of Object.entries(obj)) {
|
|
44
|
-
const path = [...rootPath, key];
|
|
45
|
-
if (hasEnumerableFields(val)) {
|
|
46
|
-
flattenObject(val, root, path);
|
|
47
|
-
} else {
|
|
48
|
-
root[path.join('.')] = val;
|
|
15
|
+
// Force falsy fields to undefined to unset then instead of
|
|
16
|
+
// saving to the db (null, empty string, etc).
|
|
17
|
+
// Note that as of version 8.18.2 Mongoose will still happily
|
|
18
|
+
// set `null` or empty string directly in the db. However note
|
|
19
|
+
// that in mongodb querying on `null` will match both `null` and
|
|
20
|
+
// unset fields.
|
|
21
|
+
function unsetFalsyValues(arg) {
|
|
22
|
+
if ((0, _lodash.isPlainObject)(arg)) {
|
|
23
|
+
const result = {};
|
|
24
|
+
for (let [key, value] of Object.entries(arg)) {
|
|
25
|
+
result[key] = unsetFalsyValues(value);
|
|
49
26
|
}
|
|
27
|
+
return result;
|
|
28
|
+
} else if (Array.isArray(arg)) {
|
|
29
|
+
return arg.map(unsetFalsyValues);
|
|
30
|
+
} else if (arg === '' || arg === null) {
|
|
31
|
+
return undefined;
|
|
32
|
+
} else {
|
|
33
|
+
return arg;
|
|
50
34
|
}
|
|
51
|
-
return root;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Only plain objects and arrays with fields should
|
|
55
|
-
// be enumerated to allow setting of their inner fields.
|
|
56
|
-
// Note that mongoose documents etc should NOT be enumerated
|
|
57
|
-
// over as their value should be set directly for the field.
|
|
58
|
-
// Additionally if an array is empty it should not have its
|
|
59
|
-
// fields enumerated but instead directly set the empty array
|
|
60
|
-
// for the field.
|
|
61
|
-
function hasEnumerableFields(arg) {
|
|
62
|
-
if ((0, _lodash.isPlainObject)(arg) || Array.isArray(arg)) {
|
|
63
|
-
return Object.keys(arg).length > 0;
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
35
|
}
|
package/dist/cjs/cache.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.applyCache = applyCache;
|
|
7
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
8
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
9
9
|
var _utils = require("./utils");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const definitionMap = new Map();
|
package/dist/cjs/delete-hooks.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.applyDeleteHooks = applyDeleteHooks;
|
|
7
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
8
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
9
9
|
var _errors = require("./errors");
|
|
10
10
|
var _utils = require("./utils");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/dist/cjs/include.js
CHANGED
|
@@ -8,11 +8,11 @@ exports.applyInclude = applyInclude;
|
|
|
8
8
|
exports.checkSelects = checkSelects;
|
|
9
9
|
exports.getDocumentParams = getDocumentParams;
|
|
10
10
|
exports.getParams = getParams;
|
|
11
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
11
|
var _yada = _interopRequireDefault(require("@bedrockio/yada"));
|
|
14
|
-
var
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
15
14
|
var _const = require("./const");
|
|
15
|
+
var _utils = require("./utils");
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
// Overloading mongoose Query prototype to
|
package/dist/cjs/load.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.loadModel = loadModel;
|
|
|
7
7
|
exports.loadModelDir = loadModelDir;
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
11
10
|
var _lodash = require("lodash");
|
|
11
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
12
12
|
var _schema = require("./schema");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
/**
|
package/dist/cjs/schema.js
CHANGED
|
@@ -5,21 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createSchema = createSchema;
|
|
7
7
|
exports.normalizeAttributes = normalizeAttributes;
|
|
8
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
9
8
|
var _lodash = require("lodash");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var _slug = require("./slug");
|
|
9
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
10
|
+
var _assign = require("./assign");
|
|
13
11
|
var _cache = require("./cache");
|
|
14
12
|
var _clone = require("./clone");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _upsert = require("./upsert");
|
|
13
|
+
var _deleteHooks = require("./delete-hooks");
|
|
14
|
+
var _disallowed = require("./disallowed");
|
|
18
15
|
var _hydrate = require("./hydrate");
|
|
19
16
|
var _include = require("./include");
|
|
17
|
+
var _search = require("./search");
|
|
18
|
+
var _serialization = require("./serialization");
|
|
19
|
+
var _slug = require("./slug");
|
|
20
20
|
var _softDelete = require("./soft-delete");
|
|
21
|
-
var
|
|
22
|
-
var
|
|
21
|
+
var _upsert = require("./upsert");
|
|
22
|
+
var _utils = require("./utils");
|
|
23
23
|
var _validation = require("./validation");
|
|
24
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
25
|
/**
|
package/dist/cjs/search.js
CHANGED
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.applySearch = applySearch;
|
|
7
7
|
exports.exportValidation = exportValidation;
|
|
8
8
|
exports.searchValidation = searchValidation;
|
|
9
|
-
var _yada = _interopRequireDefault(require("@bedrockio/yada"));
|
|
10
9
|
var _logger = _interopRequireDefault(require("@bedrockio/logger"));
|
|
11
|
-
var
|
|
10
|
+
var _yada = _interopRequireDefault(require("@bedrockio/yada"));
|
|
12
11
|
var _lodash = require("lodash");
|
|
13
|
-
var
|
|
12
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
14
13
|
var _const = require("./const");
|
|
15
|
-
var _validationSchemas = require("./validation-schemas");
|
|
16
14
|
var _env = require("./env");
|
|
17
15
|
var _query = require("./query");
|
|
16
|
+
var _utils = require("./utils");
|
|
17
|
+
var _validationSchemas = require("./validation-schemas");
|
|
18
18
|
var _warn = _interopRequireDefault(require("./warn"));
|
|
19
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
const {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.serializeOptions = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _access = require("./access");
|
|
8
9
|
var _include = require("./include");
|
|
9
10
|
var _utils = require("./utils");
|
|
10
|
-
var _access = require("./access");
|
|
11
11
|
const DISALLOWED_FIELDS = ['deleted', 'deletedRefs'];
|
|
12
12
|
const serializeOptions = exports.serializeOptions = {
|
|
13
13
|
getters: true,
|
package/dist/cjs/soft-delete.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.applySoftDelete = applySoftDelete;
|
|
7
7
|
exports.assertUnique = assertUnique;
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
|
-
var _warn = _interopRequireDefault(require("./warn"));
|
|
10
|
-
var _query = require("./query");
|
|
11
9
|
var _errors = require("./errors");
|
|
10
|
+
var _query = require("./query");
|
|
11
|
+
var _warn = _interopRequireDefault(require("./warn"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function applySoftDelete(schema) {
|
|
14
14
|
applyQueries(schema);
|
package/dist/cjs/validation.js
CHANGED
|
@@ -8,15 +8,15 @@ exports.applyValidation = applyValidation;
|
|
|
8
8
|
exports.getNamedValidator = getNamedValidator;
|
|
9
9
|
exports.getTupleValidator = getTupleValidator;
|
|
10
10
|
exports.getValidationSchema = getValidationSchema;
|
|
11
|
-
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
12
11
|
var _yada = _interopRequireDefault(require("@bedrockio/yada"));
|
|
13
12
|
var _lodash = require("lodash");
|
|
13
|
+
var _mongoose = _interopRequireDefault(require("mongoose"));
|
|
14
14
|
var _access = require("./access");
|
|
15
|
+
var _errors = require("./errors");
|
|
16
|
+
var _include = require("./include");
|
|
15
17
|
var _search = require("./search");
|
|
16
18
|
var _softDelete = require("./soft-delete");
|
|
17
|
-
var _errors = require("./errors");
|
|
18
19
|
var _utils = require("./utils");
|
|
19
|
-
var _include = require("./include");
|
|
20
20
|
var _validationSchemas = require("./validation-schemas");
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
const NAMED_SCHEMAS = {
|
|
@@ -80,7 +80,8 @@ function applyValidation(schema, definition) {
|
|
|
80
80
|
skipRequired: true,
|
|
81
81
|
stripUnknown: true,
|
|
82
82
|
stripDeleted: true,
|
|
83
|
-
|
|
83
|
+
allowFlatKeys: true,
|
|
84
|
+
allowInclude: true,
|
|
84
85
|
stripTimestamps: true,
|
|
85
86
|
allowExpandedRefs: true,
|
|
86
87
|
requireWriteAccess: true,
|
|
@@ -103,6 +104,7 @@ function applyValidation(schema, definition) {
|
|
|
103
104
|
skipRequired: true,
|
|
104
105
|
allowInclude: true,
|
|
105
106
|
stripDeleted: true,
|
|
107
|
+
allowFlatKeys: true,
|
|
106
108
|
unwindArrayFields: true,
|
|
107
109
|
requireReadAccess: true,
|
|
108
110
|
...rest
|
|
@@ -187,7 +189,8 @@ function getObjectSchema(arg, options) {
|
|
|
187
189
|
} else if (typeof arg === 'object') {
|
|
188
190
|
const {
|
|
189
191
|
stripUnknown,
|
|
190
|
-
stripEmpty
|
|
192
|
+
stripEmpty,
|
|
193
|
+
allowFlatKeys
|
|
191
194
|
} = options;
|
|
192
195
|
const map = {};
|
|
193
196
|
for (let [key, field] of Object.entries(arg)) {
|
|
@@ -206,6 +209,11 @@ function getObjectSchema(arg, options) {
|
|
|
206
209
|
stripEmpty: true
|
|
207
210
|
});
|
|
208
211
|
}
|
|
212
|
+
if (allowFlatKeys) {
|
|
213
|
+
schema = schema.options({
|
|
214
|
+
allowFlatKeys: true
|
|
215
|
+
});
|
|
216
|
+
}
|
|
209
217
|
return schema;
|
|
210
218
|
} else {
|
|
211
219
|
return getSchemaForType(arg, options);
|
package/eslint.config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { jest,
|
|
1
|
+
import { jest, nodeImports, recommended } from '@bedrockio/eslint-plugin';
|
|
2
2
|
export default [jest, recommended, nodeImports];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Bedrock utilities for model creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
"lodash": "^4.17.21"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@bedrockio/yada": "^1.
|
|
34
|
-
"mongoose": "^8.
|
|
33
|
+
"@bedrockio/yada": "^1.8.0",
|
|
34
|
+
"mongoose": "^8.18.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/cli": "^7.26.4",
|
|
38
38
|
"@babel/core": "^7.26.0",
|
|
39
39
|
"@babel/preset-env": "^7.26.0",
|
|
40
|
-
"@bedrockio/eslint-plugin": "^1.
|
|
41
|
-
"@bedrockio/prettier-config": "^1.
|
|
42
|
-
"@bedrockio/yada": "^1.
|
|
43
|
-
"@shelf/jest-mongodb": "^5.
|
|
44
|
-
"eslint": "^9.
|
|
45
|
-
"jest": "^
|
|
46
|
-
"jest-environment-node": "^
|
|
47
|
-
"mongodb": "^6.
|
|
48
|
-
"mongoose": "^8.
|
|
49
|
-
"prettier": "^3.
|
|
50
|
-
"typescript": "^5.
|
|
40
|
+
"@bedrockio/eslint-plugin": "^1.2.2",
|
|
41
|
+
"@bedrockio/prettier-config": "^1.1.1",
|
|
42
|
+
"@bedrockio/yada": "^1.8.0",
|
|
43
|
+
"@shelf/jest-mongodb": "^5.2.2",
|
|
44
|
+
"eslint": "^9.36.0",
|
|
45
|
+
"jest": "^30.2.0",
|
|
46
|
+
"jest-environment-node": "^30.2.0",
|
|
47
|
+
"mongodb": "^6.20.0",
|
|
48
|
+
"mongoose": "^8.18.2",
|
|
49
|
+
"prettier": "^3.6.2",
|
|
50
|
+
"typescript": "^5.9.2"
|
|
51
51
|
},
|
|
52
52
|
"prettier": "@bedrockio/prettier-config",
|
|
53
53
|
"volta": {
|
package/src/assign.js
CHANGED
|
@@ -1,61 +1,30 @@
|
|
|
1
1
|
import { isPlainObject } from 'lodash';
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { isReferenceField, getField } from './utils';
|
|
5
2
|
|
|
6
3
|
export function applyAssign(schema) {
|
|
7
4
|
schema.method('assign', function assign(fields) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (value === null || value === '') {
|
|
11
|
-
this.set(path, undefined);
|
|
12
|
-
} else {
|
|
13
|
-
this.set(path, value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
5
|
+
fields = unsetFalsyValues(fields);
|
|
6
|
+
this.set(fields);
|
|
16
7
|
});
|
|
17
8
|
}
|
|
18
9
|
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
// Force falsy fields to undefined to unset then instead of
|
|
11
|
+
// saving to the db (null, empty string, etc).
|
|
12
|
+
// Note that as of version 8.18.2 Mongoose will still happily
|
|
13
|
+
// set `null` or empty string directly in the db. However note
|
|
14
|
+
// that in mongodb querying on `null` will match both `null` and
|
|
15
|
+
// unset fields.
|
|
16
|
+
function unsetFalsyValues(arg) {
|
|
17
|
+
if (isPlainObject(arg)) {
|
|
18
|
+
const result = {};
|
|
19
|
+
for (let [key, value] of Object.entries(arg)) {
|
|
20
|
+
result[key] = unsetFalsyValues(value);
|
|
30
21
|
}
|
|
22
|
+
return result;
|
|
23
|
+
} else if (Array.isArray(arg)) {
|
|
24
|
+
return arg.map(unsetFalsyValues);
|
|
25
|
+
} else if (arg === '' || arg === null) {
|
|
26
|
+
return undefined;
|
|
27
|
+
} else {
|
|
28
|
+
return arg;
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
// Flattens nested objects to a dot syntax.
|
|
35
|
-
// Effectively the inverse of lodash get:
|
|
36
|
-
// { foo: { bar: 3 } } -> { 'foo.bar': 3 }
|
|
37
|
-
function flattenObject(obj, root = {}, rootPath = []) {
|
|
38
|
-
for (let [key, val] of Object.entries(obj)) {
|
|
39
|
-
const path = [...rootPath, key];
|
|
40
|
-
if (hasEnumerableFields(val)) {
|
|
41
|
-
flattenObject(val, root, path);
|
|
42
|
-
} else {
|
|
43
|
-
root[path.join('.')] = val;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return root;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Only plain objects and arrays with fields should
|
|
50
|
-
// be enumerated to allow setting of their inner fields.
|
|
51
|
-
// Note that mongoose documents etc should NOT be enumerated
|
|
52
|
-
// over as their value should be set directly for the field.
|
|
53
|
-
// Additionally if an array is empty it should not have its
|
|
54
|
-
// fields enumerated but instead directly set the empty array
|
|
55
|
-
// for the field.
|
|
56
|
-
function hasEnumerableFields(arg) {
|
|
57
|
-
if (isPlainObject(arg) || Array.isArray(arg)) {
|
|
58
|
-
return Object.keys(arg).length > 0;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
package/src/cache.js
CHANGED
package/src/delete-hooks.js
CHANGED
package/src/include.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
import { escapeRegExp } from 'lodash';
|
|
3
1
|
import yd from '@bedrockio/yada';
|
|
2
|
+
import { escapeRegExp } from 'lodash';
|
|
3
|
+
import mongoose from 'mongoose';
|
|
4
4
|
|
|
5
|
-
import { getInnerField, isSchemaTypedef } from './utils';
|
|
6
5
|
import { POPULATE_MAX_DEPTH } from './const';
|
|
6
|
+
import { getInnerField, isSchemaTypedef } from './utils';
|
|
7
7
|
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
// Overloading mongoose Query prototype to
|
package/src/load.js
CHANGED
package/src/schema.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
import { camelCase, capitalize, isPlainObject, pick } from 'lodash';
|
|
1
2
|
import mongoose from 'mongoose';
|
|
2
|
-
import { pick, isPlainObject, capitalize, camelCase } from 'lodash';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { serializeOptions } from './serialization';
|
|
7
|
-
import { applySlug } from './slug';
|
|
4
|
+
import { applyAssign } from './assign';
|
|
8
5
|
import { applyCache } from './cache';
|
|
9
6
|
import { applyClone } from './clone';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { applyUpsert } from './upsert';
|
|
7
|
+
import { applyDeleteHooks } from './delete-hooks';
|
|
8
|
+
import { applyDisallowed } from './disallowed';
|
|
13
9
|
import { applyHydrate } from './hydrate';
|
|
14
10
|
import { applyInclude } from './include';
|
|
11
|
+
import { applySearch } from './search';
|
|
12
|
+
import { serializeOptions } from './serialization';
|
|
13
|
+
import { applySlug } from './slug';
|
|
15
14
|
import { applySoftDelete } from './soft-delete';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { applyUpsert } from './upsert';
|
|
16
|
+
import { isSchemaTypedef } from './utils';
|
|
18
17
|
|
|
19
18
|
import {
|
|
20
19
|
applyValidation,
|
package/src/search.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import yd from '@bedrockio/yada';
|
|
2
1
|
import logger from '@bedrockio/logger';
|
|
2
|
+
import yd from '@bedrockio/yada';
|
|
3
|
+
import { escapeRegExp, isEmpty, isPlainObject, memoize, pick } from 'lodash';
|
|
3
4
|
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
import { SEARCH_DEFAULTS } from './const';
|
|
7
|
+
import { debug } from './env';
|
|
8
|
+
import { mergeQuery, wrapQuery } from './query';
|
|
5
9
|
|
|
6
10
|
import {
|
|
7
11
|
getField,
|
|
@@ -12,11 +16,7 @@ import {
|
|
|
12
16
|
resolveRefPath,
|
|
13
17
|
} from './utils';
|
|
14
18
|
|
|
15
|
-
import { SEARCH_DEFAULTS } from './const';
|
|
16
19
|
import { OBJECT_ID_SCHEMA } from './validation-schemas';
|
|
17
|
-
import { debug } from './env';
|
|
18
|
-
import { mergeQuery, wrapQuery } from './query';
|
|
19
|
-
|
|
20
20
|
import warn from './warn';
|
|
21
21
|
|
|
22
22
|
const { ObjectId } = mongoose.Types;
|
package/src/serialization.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isPlainObject } from 'lodash';
|
|
2
2
|
|
|
3
|
+
import { hasAccess } from './access';
|
|
3
4
|
import { checkSelects } from './include';
|
|
4
5
|
import { getField, getInnerField } from './utils';
|
|
5
|
-
import { hasAccess } from './access';
|
|
6
6
|
|
|
7
7
|
const DISALLOWED_FIELDS = ['deleted', 'deletedRefs'];
|
|
8
8
|
|
package/src/soft-delete.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { isEqual } from 'lodash';
|
|
2
2
|
|
|
3
|
-
import warn from './warn';
|
|
4
|
-
|
|
5
|
-
import { wrapQuery } from './query';
|
|
6
3
|
import { UniqueConstraintError } from './errors';
|
|
4
|
+
import { wrapQuery } from './query';
|
|
5
|
+
import warn from './warn';
|
|
7
6
|
|
|
8
7
|
export function applySoftDelete(schema) {
|
|
9
8
|
applyQueries(schema);
|
package/src/validation.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
1
|
import yd from '@bedrockio/yada';
|
|
3
|
-
|
|
4
|
-
import
|
|
2
|
+
import { get, lowerFirst, omit } from 'lodash';
|
|
3
|
+
import mongoose from 'mongoose';
|
|
5
4
|
|
|
6
5
|
import { hasAccess } from './access';
|
|
7
|
-
import {
|
|
6
|
+
import { ImplementationError, PermissionsError } from './errors';
|
|
7
|
+
import { INCLUDE_FIELD_SCHEMA } from './include';
|
|
8
|
+
import { exportValidation, searchValidation } from './search';
|
|
8
9
|
import { assertUnique } from './soft-delete';
|
|
9
|
-
import { PermissionsError, ImplementationError } from './errors';
|
|
10
10
|
import { isMongooseSchema, isSchemaTypedef } from './utils';
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
import {
|
|
13
|
+
DATE_RANGE_SCHEMA,
|
|
13
14
|
DATE_SCHEMA,
|
|
14
|
-
REFERENCE_SCHEMA,
|
|
15
|
-
OBJECT_ID_SCHEMA,
|
|
16
15
|
NUMBER_RANGE_SCHEMA,
|
|
16
|
+
OBJECT_ID_SCHEMA,
|
|
17
|
+
REFERENCE_SCHEMA,
|
|
17
18
|
STRING_RANGE_SCHEMA,
|
|
18
|
-
DATE_RANGE_SCHEMA,
|
|
19
19
|
} from './validation-schemas';
|
|
20
20
|
|
|
21
21
|
const NAMED_SCHEMAS = {
|
|
@@ -84,7 +84,8 @@ export function applyValidation(schema, definition) {
|
|
|
84
84
|
skipRequired: true,
|
|
85
85
|
stripUnknown: true,
|
|
86
86
|
stripDeleted: true,
|
|
87
|
-
|
|
87
|
+
allowFlatKeys: true,
|
|
88
|
+
allowInclude: true,
|
|
88
89
|
stripTimestamps: true,
|
|
89
90
|
allowExpandedRefs: true,
|
|
90
91
|
requireWriteAccess: true,
|
|
@@ -106,6 +107,7 @@ export function applyValidation(schema, definition) {
|
|
|
106
107
|
skipRequired: true,
|
|
107
108
|
allowInclude: true,
|
|
108
109
|
stripDeleted: true,
|
|
110
|
+
allowFlatKeys: true,
|
|
109
111
|
unwindArrayFields: true,
|
|
110
112
|
requireReadAccess: true,
|
|
111
113
|
...rest,
|
|
@@ -199,7 +201,7 @@ function getObjectSchema(arg, options) {
|
|
|
199
201
|
} else if (Array.isArray(arg)) {
|
|
200
202
|
return getArraySchema(arg, options);
|
|
201
203
|
} else if (typeof arg === 'object') {
|
|
202
|
-
const { stripUnknown, stripEmpty } = options;
|
|
204
|
+
const { stripUnknown, stripEmpty, allowFlatKeys } = options;
|
|
203
205
|
const map = {};
|
|
204
206
|
for (let [key, field] of Object.entries(arg)) {
|
|
205
207
|
if (!isExcludedField(field, options)) {
|
|
@@ -221,6 +223,12 @@ function getObjectSchema(arg, options) {
|
|
|
221
223
|
});
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
if (allowFlatKeys) {
|
|
227
|
+
schema = schema.options({
|
|
228
|
+
allowFlatKeys: true,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
224
232
|
return schema;
|
|
225
233
|
} else {
|
|
226
234
|
return getSchemaForType(arg, options);
|
package/types/assign.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/assign.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/assign.js"],"names":[],"mappings":"AAEA,+CAKC"}
|
package/types/include.d.ts
CHANGED
|
@@ -9,12 +9,15 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
9
9
|
pick(...names?: string[]): /*elided*/ any;
|
|
10
10
|
omit(...names?: string[]): /*elided*/ any;
|
|
11
11
|
require(...fields: string[]): /*elided*/ any;
|
|
12
|
+
requireAll(): /*elided*/ any;
|
|
13
|
+
requireAllWithin(): /*elided*/ any;
|
|
12
14
|
export(): any;
|
|
13
15
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
14
16
|
options(options?: {
|
|
15
17
|
stripEmpty?: boolean;
|
|
16
18
|
stripUnknown?: boolean;
|
|
17
|
-
|
|
19
|
+
allowFlatKeys?: boolean;
|
|
20
|
+
expandFlatKeys?: boolean;
|
|
18
21
|
}): /*elided*/ any;
|
|
19
22
|
format(name: any, fn: any): /*elided*/ any;
|
|
20
23
|
toString(): any;
|
|
@@ -38,6 +41,9 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
38
41
|
getAnyType(): {
|
|
39
42
|
type: string[];
|
|
40
43
|
};
|
|
44
|
+
getFormat(): {
|
|
45
|
+
format: any;
|
|
46
|
+
};
|
|
41
47
|
getDefault(): {
|
|
42
48
|
default?: undefined;
|
|
43
49
|
} | {
|
package/types/include.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,yDAIC;AAaD,yEAUC;AA9ID
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,yDAIC;AAaD,yEAUC;AA9ID;;;;;;;;;;;;kBAwGwB,CAAC;oBAEnB,CADL;qBAAgC,CAAC;sBACxB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAnCqD,CAAC;;;;;;;;;;;;;;;;;EAlE9D"}
|
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,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,OAahB;AAED;;;;GAIG;AACH,sCAFW,MAAM,mBAkBhB;qBA3CoB,UAAU"}
|
package/types/schema.d.ts
CHANGED
|
@@ -28,7 +28,9 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
28
28
|
id?: boolean;
|
|
29
29
|
_id?: boolean;
|
|
30
30
|
minimize?: boolean;
|
|
31
|
-
optimisticConcurrency?: boolean
|
|
31
|
+
optimisticConcurrency?: boolean | string[] | {
|
|
32
|
+
exclude: string[];
|
|
33
|
+
};
|
|
32
34
|
pluginTags?: string[];
|
|
33
35
|
read?: string;
|
|
34
36
|
readConcern?: {
|
|
@@ -47,16 +49,16 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
47
49
|
getters: boolean;
|
|
48
50
|
versionKey: boolean;
|
|
49
51
|
transform: (doc: any, ret: any, options: any) => void;
|
|
50
|
-
} | mongoose.ToObjectOptions<any>;
|
|
52
|
+
} | mongoose.ToObjectOptions<any, any>;
|
|
51
53
|
toObject: {
|
|
52
54
|
getters: boolean;
|
|
53
55
|
versionKey: boolean;
|
|
54
56
|
transform: (doc: any, ret: any, options: any) => void;
|
|
55
|
-
} | mongoose.ToObjectOptions<any>;
|
|
57
|
+
} | mongoose.ToObjectOptions<any, any>;
|
|
56
58
|
typeKey?: string;
|
|
57
59
|
validateBeforeSave?: boolean;
|
|
58
60
|
validateModifiedOnly?: boolean;
|
|
59
|
-
versionKey?: string |
|
|
61
|
+
versionKey?: string | false;
|
|
60
62
|
selectPopulatedPaths?: boolean;
|
|
61
63
|
skipVersioning?: {
|
|
62
64
|
[key: string]: boolean;
|
|
@@ -64,12 +66,13 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
|
|
|
64
66
|
storeSubdocValidationError?: boolean;
|
|
65
67
|
timestamps: boolean | mongoose.SchemaTimestampsConfig;
|
|
66
68
|
suppressReservedKeysWarning?: boolean;
|
|
67
|
-
statics?: mongoose.AddThisParameter<any, mongoose.Model<any,
|
|
69
|
+
statics?: mongoose.AddThisParameter<any, mongoose.Model<any, any, any, any, any, any>>;
|
|
68
70
|
methods?: mongoose.AddThisParameter<any, any> & mongoose.AnyObject;
|
|
69
71
|
query?: any;
|
|
70
72
|
castNonArrays?: boolean;
|
|
71
73
|
virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
|
|
72
74
|
overwriteModels?: boolean;
|
|
75
|
+
encryptionType?: "csfle" | "queryableEncryption";
|
|
73
76
|
}, any, any>;
|
|
74
77
|
export function normalizeAttributes(arg: any, path?: any[]): any;
|
|
75
78
|
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":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa;;;;;;;YAgDJ,CAAC;WAC1B,CAAF;mBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;SA2HlB,CAAC;gBACL,CAAC;SAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAlId;AAED,iEAsBC;qBA9FoB,UAAU"}
|
package/types/search.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ export function searchValidation(options?: {}): {
|
|
|
6
6
|
pick(...names?: string[]): /*elided*/ any;
|
|
7
7
|
omit(...names?: string[]): /*elided*/ any;
|
|
8
8
|
require(...fields: string[]): /*elided*/ any;
|
|
9
|
+
requireAll(): /*elided*/ any;
|
|
10
|
+
requireAllWithin(): /*elided*/ any;
|
|
9
11
|
export(): any;
|
|
10
12
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
11
13
|
options(options?: {
|
|
12
14
|
stripEmpty?: boolean;
|
|
13
15
|
stripUnknown?: boolean;
|
|
14
|
-
|
|
16
|
+
allowFlatKeys?: boolean;
|
|
17
|
+
expandFlatKeys?: boolean;
|
|
15
18
|
}): /*elided*/ any;
|
|
16
19
|
format(name: any, fn: any): /*elided*/ any;
|
|
17
20
|
toString(): any;
|
|
@@ -35,6 +38,9 @@ export function searchValidation(options?: {}): {
|
|
|
35
38
|
getAnyType(): {
|
|
36
39
|
type: string[];
|
|
37
40
|
};
|
|
41
|
+
getFormat(): {
|
|
42
|
+
format: any;
|
|
43
|
+
};
|
|
38
44
|
getDefault(): {
|
|
39
45
|
default?: undefined;
|
|
40
46
|
} | {
|
|
@@ -137,6 +143,9 @@ export function exportValidation(options?: {}): {
|
|
|
137
143
|
getAnyType(): {
|
|
138
144
|
type: string[];
|
|
139
145
|
};
|
|
146
|
+
getFormat(): {
|
|
147
|
+
format: any;
|
|
148
|
+
};
|
|
140
149
|
getDefault(): {
|
|
141
150
|
default?: undefined;
|
|
142
151
|
} | {
|
|
@@ -146,6 +155,7 @@ export function exportValidation(options?: {}): {
|
|
|
146
155
|
nullable: boolean;
|
|
147
156
|
};
|
|
148
157
|
getEnum(): any;
|
|
158
|
+
requireAllWithin(): /*elided*/ any;
|
|
149
159
|
expandExtra(extra?: {}): {};
|
|
150
160
|
inspect(): string;
|
|
151
161
|
get(): void;
|
|
@@ -239,6 +249,9 @@ export function exportValidation(options?: {}): {
|
|
|
239
249
|
getAnyType(): {
|
|
240
250
|
type: string[];
|
|
241
251
|
};
|
|
252
|
+
getFormat(): {
|
|
253
|
+
format: any;
|
|
254
|
+
};
|
|
242
255
|
getDefault(): {
|
|
243
256
|
default?: undefined;
|
|
244
257
|
} | {
|
|
@@ -248,6 +261,7 @@ export function exportValidation(options?: {}): {
|
|
|
248
261
|
nullable: boolean;
|
|
249
262
|
};
|
|
250
263
|
getEnum(): any;
|
|
264
|
+
requireAllWithin(): /*elided*/ any;
|
|
251
265
|
expandExtra(extra?: {}): {};
|
|
252
266
|
inspect(): string;
|
|
253
267
|
get(): void;
|
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;;;;;;;;;;;;kBA8GU,CAAP;oBACmB,CAAC;qBAGX,CAAN;sBAEE,CAAR;;;;;;;;;;;;;;;;;;;;;;;;;;;;eArDE,CADF;;;;;;;;;;;;;;;;;EArCC;AAED;;;;;;;;;;;;;;;;;mBAtBI,CAAA;;;;;;;;;;;;qBAuBC,CAAC;sBAA4B,CAAC;sBACvB,CAAC;wBAA8B,CAAC;wBAEnC,CAAC;;;4BA2BK,CAAC;kCACwB,CAAC;wBACrC,CAAA;wBAA+B,CAAC;wCAK9B,CAAJ;2BAAkC,CAAC;kCACP,CAAC;2BAIhB,CAAC;qBAA4B,CAAC;;;uBAsBT,CAAC;6BACH,CAAC;8BAI7B,CAAF;6BAAoC,CAAC;0BAClB,CAAC;6BAIhB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAvCN,CADF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAzDI,CAAA;;;;;;;;;;;;qBAuBC,CAAC;sBAA4B,CAAC;sBACvB,CAAC;wBAA8B,CAAC;wBAEnC,CAAC;;;4BA2BK,CAAC;kCACwB,CAAC;wBACrC,CAAA;wBAA+B,CAAC;wCAK9B,CAAJ;2BAAkC,CAAC;kCACP,CAAC;2BAIhB,CAAC;qBAA4B,CAAC;;;uBAsBT,CAAC;6BACH,CAAC;8BAI7B,CAAF;6BAAoC,CAAC;0BAClB,CAAC;6BAIhB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAvCN,CADF;;;;;;;;;;;;;;;;;;;;EAtBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soft-delete.d.ts","sourceRoot":"","sources":["../src/soft-delete.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"soft-delete.d.ts","sourceRoot":"","sources":["../src/soft-delete.js"],"names":[],"mappings":"AAMA,mDAIC;AAED,0DAwBC"}
|
|
@@ -30,6 +30,9 @@ export const DATE_SCHEMA: {
|
|
|
30
30
|
getAnyType(): {
|
|
31
31
|
type: string[];
|
|
32
32
|
};
|
|
33
|
+
getFormat(): {
|
|
34
|
+
format: any;
|
|
35
|
+
};
|
|
33
36
|
getDefault(): {
|
|
34
37
|
default?: undefined;
|
|
35
38
|
} | {
|
|
@@ -39,6 +42,7 @@ export const DATE_SCHEMA: {
|
|
|
39
42
|
nullable: boolean;
|
|
40
43
|
};
|
|
41
44
|
getEnum(): any;
|
|
45
|
+
requireAllWithin(): /*elided*/ any;
|
|
42
46
|
expandExtra(extra?: {}): {};
|
|
43
47
|
inspect(): string;
|
|
44
48
|
get(): void;
|
|
@@ -132,6 +136,9 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
132
136
|
getAnyType(): {
|
|
133
137
|
type: string[];
|
|
134
138
|
};
|
|
139
|
+
getFormat(): {
|
|
140
|
+
format: any;
|
|
141
|
+
};
|
|
135
142
|
getDefault(): {
|
|
136
143
|
default?: undefined;
|
|
137
144
|
} | {
|
|
@@ -141,6 +148,7 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
141
148
|
nullable: boolean;
|
|
142
149
|
};
|
|
143
150
|
getEnum(): any;
|
|
151
|
+
requireAllWithin(): /*elided*/ any;
|
|
144
152
|
expandExtra(extra?: {}): {};
|
|
145
153
|
inspect(): string;
|
|
146
154
|
get(): void;
|
|
@@ -159,12 +167,15 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
159
167
|
pick(...names?: string[]): /*elided*/ any;
|
|
160
168
|
omit(...names?: string[]): /*elided*/ any;
|
|
161
169
|
require(...fields: string[]): /*elided*/ any;
|
|
170
|
+
requireAll(): /*elided*/ any;
|
|
171
|
+
requireAllWithin(): /*elided*/ any;
|
|
162
172
|
export(): any;
|
|
163
173
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
164
174
|
options(options?: {
|
|
165
175
|
stripEmpty?: boolean;
|
|
166
176
|
stripUnknown?: boolean;
|
|
167
|
-
|
|
177
|
+
allowFlatKeys?: boolean;
|
|
178
|
+
expandFlatKeys?: boolean;
|
|
168
179
|
}): /*elided*/ any;
|
|
169
180
|
format(name: any, fn: any): /*elided*/ any;
|
|
170
181
|
toString(): any;
|
|
@@ -188,6 +199,9 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
188
199
|
getAnyType(): {
|
|
189
200
|
type: string[];
|
|
190
201
|
};
|
|
202
|
+
getFormat(): {
|
|
203
|
+
format: any;
|
|
204
|
+
};
|
|
191
205
|
getDefault(): {
|
|
192
206
|
default?: undefined;
|
|
193
207
|
} | {
|
|
@@ -214,12 +228,15 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
214
228
|
pick(...names?: string[]): /*elided*/ any;
|
|
215
229
|
omit(...names?: string[]): /*elided*/ any;
|
|
216
230
|
require(...fields: string[]): /*elided*/ any;
|
|
231
|
+
requireAll(): /*elided*/ any;
|
|
232
|
+
requireAllWithin(): /*elided*/ any;
|
|
217
233
|
export(): any;
|
|
218
234
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
219
235
|
options(options?: {
|
|
220
236
|
stripEmpty?: boolean;
|
|
221
237
|
stripUnknown?: boolean;
|
|
222
|
-
|
|
238
|
+
allowFlatKeys?: boolean;
|
|
239
|
+
expandFlatKeys?: boolean;
|
|
223
240
|
}): /*elided*/ any;
|
|
224
241
|
format(name: any, fn: any): /*elided*/ any;
|
|
225
242
|
toString(): any;
|
|
@@ -243,6 +260,9 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
243
260
|
getAnyType(): {
|
|
244
261
|
type: string[];
|
|
245
262
|
};
|
|
263
|
+
getFormat(): {
|
|
264
|
+
format: any;
|
|
265
|
+
};
|
|
246
266
|
getDefault(): {
|
|
247
267
|
default?: undefined;
|
|
248
268
|
} | {
|
|
@@ -269,12 +289,15 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
269
289
|
pick(...names?: string[]): /*elided*/ any;
|
|
270
290
|
omit(...names?: string[]): /*elided*/ any;
|
|
271
291
|
require(...fields: string[]): /*elided*/ any;
|
|
292
|
+
requireAll(): /*elided*/ any;
|
|
293
|
+
requireAllWithin(): /*elided*/ any;
|
|
272
294
|
export(): any;
|
|
273
295
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
274
296
|
options(options?: {
|
|
275
297
|
stripEmpty?: boolean;
|
|
276
298
|
stripUnknown?: boolean;
|
|
277
|
-
|
|
299
|
+
allowFlatKeys?: boolean;
|
|
300
|
+
expandFlatKeys?: boolean;
|
|
278
301
|
}): /*elided*/ any;
|
|
279
302
|
format(name: any, fn: any): /*elided*/ any;
|
|
280
303
|
toString(): any;
|
|
@@ -298,6 +321,9 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
298
321
|
getAnyType(): {
|
|
299
322
|
type: string[];
|
|
300
323
|
};
|
|
324
|
+
getFormat(): {
|
|
325
|
+
format: any;
|
|
326
|
+
};
|
|
301
327
|
getDefault(): {
|
|
302
328
|
default?: undefined;
|
|
303
329
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAwFsB,CAAC;;;;;;;;;;;;;;;;;;;EAxFmC;AAE1D;;;;;;;;;;;;;;;;eAyBwB,CAAC;;;;;;;;;;;;iBAuBjB,CAAA;kBAA4B,CAAC;kBAEjC,CAAF;oBAEI,CAAC;oBAEI,CAAC;;;wBA2BC,CAAC;8BAGI,CAAC;oBAA+B,CAAC;oBAE1C,CAAC;oCAEL,CAAC;uBAAkC,CAAC;8BAAyC,CAAC;uBACzD,CAAC;iBAA4B,CAAC;;;mBAG0V,CAAC;yBAAoC,CAAC;0BAAqC,CAAC;yBAAoC,CAAC;sBAAiC,CAAC;yBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eANpjB,CAAC;;;;;;;;;;;;;;;;;;;EA9ElB;AAEL;;;;;;;;;;;;kBAkFmtB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;eANjyB,CAAC;;;;;;;;;;;;;;;;;EAlElB;AAEL;;;;;;;;;;;;kBAsEmtB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;eANjyB,CAAC;;;;;;;;;;;;;;;;;EAtDlB;AAEL;;;;;;;;;;;;kBA0DmtB,CAAC;oBAA+B,CAAC;qBAAgC,CAAC;sBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;eANjyB,CAAC;;;;;;;;;;;;;;;;;EAlBlB;AAEL,8EAqBK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AA0DA,kDAEC;AAED,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AA0DA,kDAEC;AAED,oEA4FC;AAsBD,wEAiBC;AA8SD;;;EAEC;AAED;;;EAOC"}
|