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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.2.25",
3
+ "version": "6.2.26",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 numeric ID
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 numeric identificator
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 {numeric} ID
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
- * @return {numeric} ID
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
  }
@@ -1,21 +1,29 @@
1
1
  module.exports = {
2
- title: [{
3
- validator: 'isLength',
4
- arguments: [3, 500],
5
- message: 'Название компании должно быть от 3 до 500 символов'
6
- }],
7
- tripleID: [{
8
- validator: 'isNumeric',
9
- message: 'ID number must be specified'
10
- }],
11
- objectId: [{
12
- validator: 'isLength',
13
- arguments: [10, 55],
14
- message: 'Owner should be specified'
15
- }],
16
- text: [{
17
- validator: 'isLength',
18
- arguments: [1, 500],
19
- message: 'от 1 до 500 знаков'
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
+ };