@bedrockio/model 0.1.7 → 0.1.8
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/include.js +5 -3
- package/dist/cjs/validation.js +3 -0
- package/package.json +1 -1
- package/src/include.js +5 -3
- package/src/validation.js +4 -0
- package/types/include.d.ts.map +1 -1
- package/types/validation.d.ts.map +1 -1
package/dist/cjs/include.js
CHANGED
|
@@ -16,9 +16,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
// Overloading mongoose Query prototype to
|
|
18
18
|
// allow an "include" method for queries.
|
|
19
|
-
_mongoose.default.Query.prototype.include = function include(
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
_mongoose.default.Query.prototype.include = function include(arg) {
|
|
20
|
+
if (arg) {
|
|
21
|
+
const filter = this.getFilter();
|
|
22
|
+
filter.include = arg;
|
|
23
|
+
}
|
|
22
24
|
return this;
|
|
23
25
|
};
|
|
24
26
|
const DESCRIPTION = 'Field to be selected or populated.';
|
package/dist/cjs/validation.js
CHANGED
|
@@ -114,6 +114,9 @@ function applyValidation(schema, definition) {
|
|
|
114
114
|
model: this
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
|
+
schema.static('getIncludeValidation', function getIncludeValidation() {
|
|
118
|
+
return _include.INCLUDE_FIELD_SCHEMA;
|
|
119
|
+
});
|
|
117
120
|
schema.static('getBaseSchema', function getBaseSchema() {
|
|
118
121
|
return getSchemaFromMongoose(schema);
|
|
119
122
|
});
|
package/package.json
CHANGED
package/src/include.js
CHANGED
|
@@ -8,9 +8,11 @@ import { POPULATE_MAX_DEPTH } from './const';
|
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
// Overloading mongoose Query prototype to
|
|
10
10
|
// allow an "include" method for queries.
|
|
11
|
-
mongoose.Query.prototype.include = function include(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
mongoose.Query.prototype.include = function include(arg) {
|
|
12
|
+
if (arg) {
|
|
13
|
+
const filter = this.getFilter();
|
|
14
|
+
filter.include = arg;
|
|
15
|
+
}
|
|
14
16
|
return this;
|
|
15
17
|
};
|
|
16
18
|
|
package/src/validation.js
CHANGED
|
@@ -126,6 +126,10 @@ export function applyValidation(schema, definition) {
|
|
|
126
126
|
}
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
+
schema.static('getIncludeValidation', function getIncludeValidation() {
|
|
130
|
+
return INCLUDE_FIELD_SCHEMA;
|
|
131
|
+
});
|
|
132
|
+
|
|
129
133
|
schema.static('getBaseSchema', function getBaseSchema() {
|
|
130
134
|
return getSchemaFromMongoose(schema);
|
|
131
135
|
});
|
package/types/include.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAoCC;AAMD,uDA4BC;AAGD,2DAIC;AApFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAkEA,kDAEC;AAED,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAkEA,kDAEC;AAED,oEAiEC;AAaD,wEAkBC;AA0PD;;;EAEC;AAED;;;EAOC;AAnZD,8EAUK"}
|