not-node 6.2.25 → 6.2.26
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/docs/module-Model_Default.html +2048 -1960
- package/docs/quicksearch.html +8 -5
- package/docs/scripts/docstrap.lib.js +24455 -11
- package/docs/scripts/prettify/jquery.min.js +5695 -3
- package/package.json +1 -1
- package/src/model/default.js +13 -5
- package/test/validators.js +28 -20
package/package.json
CHANGED
package/src/model/default.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const routine = require("./routine");
|
|
3
3
|
const notQuery = require("not-filter");
|
|
4
4
|
const { objHas } = require("../common");
|
|
5
|
+
const notPath = require("not-path");
|
|
5
6
|
|
|
6
7
|
const defaultFilter = (obj) => {
|
|
7
8
|
if (obj.schema.statics.__versioning) {
|
|
@@ -106,10 +107,10 @@ function getOne(id, population = [], condition = {}) {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
|
-
* Retrieves one record by unique
|
|
110
|
+
* Retrieves one record by unique number ID
|
|
110
111
|
* If versioning ON, it retrieves __latest and not __closed
|
|
111
112
|
* @static
|
|
112
|
-
* @param {number} ID some unique
|
|
113
|
+
* @param {number} ID some unique number identificator
|
|
113
114
|
* @param {Object} condition optional if needed additional condition
|
|
114
115
|
* @param {Array} population optional if needed population of some fields
|
|
115
116
|
* @return {Promise} Promise of document, if increment is OFF - then Promise.resolve(null)
|
|
@@ -367,7 +368,7 @@ module.exports.thisStatics = {
|
|
|
367
368
|
|
|
368
369
|
/**
|
|
369
370
|
* Returns incremental ID for this doc
|
|
370
|
-
* @return {
|
|
371
|
+
* @return {number} ID
|
|
371
372
|
*/
|
|
372
373
|
function getID() {
|
|
373
374
|
return this.schema.statics.__incField
|
|
@@ -378,9 +379,16 @@ function getID() {
|
|
|
378
379
|
/**
|
|
379
380
|
* Closes document and saves it
|
|
380
381
|
* This is replaces remove when Versioning is ON
|
|
381
|
-
* @
|
|
382
|
+
* @param {object} [data=undefined] if we want update some fields
|
|
383
|
+
* @return {number} ID
|
|
382
384
|
*/
|
|
383
|
-
function close() {
|
|
385
|
+
function close(data = undefined) {
|
|
386
|
+
if (data && Object.keys(data)) {
|
|
387
|
+
Object.keys(data).forEach((fieldName) => {
|
|
388
|
+
notPath.setValueByPath(this, fieldName, data[fieldName]);
|
|
389
|
+
this.markModified(fieldName);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
384
392
|
this.__closed = true;
|
|
385
393
|
return this.save();
|
|
386
394
|
}
|
package/test/validators.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
title: [
|
|
3
|
+
{
|
|
4
|
+
validator: "isLength",
|
|
5
|
+
arguments: [3, 500],
|
|
6
|
+
message: "Название компании должно быть от 3 до 500 символов",
|
|
7
|
+
},
|
|
8
|
+
],
|
|
9
|
+
tripleID: [
|
|
10
|
+
{
|
|
11
|
+
validator: "isnumber",
|
|
12
|
+
message: "ID number must be specified",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
objectId: [
|
|
16
|
+
{
|
|
17
|
+
validator: "isLength",
|
|
18
|
+
arguments: [10, 55],
|
|
19
|
+
message: "Owner should be specified",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
text: [
|
|
23
|
+
{
|
|
24
|
+
validator: "isLength",
|
|
25
|
+
arguments: [1, 500],
|
|
26
|
+
message: "от 1 до 500 знаков",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|