not-node 6.5.56 → 6.5.57

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.5.56",
3
+ "version": "6.5.57",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,16 @@
1
+ const Validators = require("not-node/src/core/validators");
2
+ const ObjectId = require("mongoose").SchemaTypes.ObjectId;
3
+
4
+ module.exports = {
5
+ ui: {
6
+ component: "UIHidden",
7
+ placeholder: "_ids",
8
+ label: "_ids",
9
+ readonly: true,
10
+ },
11
+ model: {
12
+ type: ObjectId,
13
+ safe: require("not-node/src/core/safety.protocols").systemManageable,
14
+ validate: Validators.ObjectId.list,
15
+ },
16
+ };
@@ -7,6 +7,7 @@ module.exports = {
7
7
  targetID: require("./ID.js"),
8
8
  _id: require("./targetId.js"),
9
9
  targetId: require("./targetId.js"),
10
+ targetIds: require("./targetIds.js"),
10
11
  activeUser: require("./activeUser.js"),
11
12
  activeUserId: require("./activeUserId.js"),
12
13
  ip: require("./ip.js"),
@@ -0,0 +1,6 @@
1
+ module.exports = (form, req) => {
2
+ return {
3
+ name: "targetIds",
4
+ value: req?.body?._ids || undefined,
5
+ };
6
+ };
@@ -431,7 +431,7 @@ function getID() {
431
431
  * @param {object} [data=undefined] if we want update some fields
432
432
  * @return {number} ID
433
433
  */
434
- function close(data = undefined) {
434
+ function close(data = undefined, saveOptions = {validateBeforeSave: true}) {
435
435
  if (this?.schema?.statics?.__versioning) {
436
436
  if (data && Object.keys(data)) {
437
437
  Object.keys(data).forEach((fieldName) => {
@@ -440,7 +440,7 @@ function close(data = undefined) {
440
440
  });
441
441
  }
442
442
  this.__closed = true;
443
- return this.save();
443
+ return this.save(saveOptions);
444
444
  } else {
445
445
  return this.deleteOne({ _id: this._id });
446
446
  }