not-node 6.4.12 → 6.4.13

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.4.12",
3
+ "version": "6.4.13",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,7 +5,6 @@ const getApp = require("../getApp.js"),
5
5
  { sayForModule } = require("not-locale"),
6
6
  { objHas, isFunc, executeFunctionAsAsync } = require("../common"),
7
7
  LogInit = require("not-log");
8
-
9
8
  module.exports = ({
10
9
  target,
11
10
  MODULE_NAME,
@@ -94,6 +93,7 @@ module.exports = ({
94
93
  if (form2) {
95
94
  return form2;
96
95
  }
96
+
97
97
  return createForm({
98
98
  app: getApp(),
99
99
  MODULE_NAME,
@@ -109,6 +109,7 @@ module.exports = ({
109
109
  JSON.stringify(req.notRouteData, null, 4)
110
110
  );
111
111
  const actionName = req.notRouteData.actionName;
112
+
112
113
  const trimmedActionName = actionName.replace("_", "");
113
114
  const FormValidator = getForm(trimmedActionName);
114
115
  const prepared = FormValidator
@@ -2,4 +2,7 @@ module.exports = {
2
2
  ui: {
3
3
  component: "UIHidden",
4
4
  },
5
+ model: {
6
+ safe: require("../safety.protocols").systemManageable,
7
+ },
5
8
  };
@@ -2,4 +2,7 @@ module.exports = {
2
2
  ui: {
3
3
  component: "UIHidden",
4
4
  },
5
+ model: {
6
+ safe: require("../safety.protocols").systemManageable,
7
+ },
5
8
  };
@@ -2,4 +2,7 @@ module.exports = {
2
2
  ui: {
3
3
  component: "UIHidden",
4
4
  },
5
+ model: {
6
+ safe: require("../safety.protocols").systemManageable,
7
+ },
5
8
  };
@@ -2,4 +2,7 @@ module.exports = {
2
2
  ui: {
3
3
  component: "UIHidden",
4
4
  },
5
+ model: {
6
+ safe: require("../safety.protocols").systemManageable,
7
+ },
5
8
  };
@@ -10,6 +10,6 @@ module.exports = {
10
10
  searchable: true,
11
11
  required: true,
12
12
  transformers: ["xss"],
13
- safe: require("../safety.protocols").ownerRootAdmin,
13
+ safe: require("../safety.protocols").systemManageable,
14
14
  },
15
15
  };
@@ -11,6 +11,7 @@ module.exports = {
11
11
  type: Date,
12
12
  required: true,
13
13
  default: Date.now,
14
- safe: require("../safety.protocols").ownerRootAdmin,
14
+
15
+ safe: require("../safety.protocols").systemManageable,
15
16
  },
16
17
  };
@@ -0,0 +1,24 @@
1
+ const Schema = require("mongoose").Schema;
2
+ const getApp = require("../getApp");
3
+ const { firstLetterToLower } = require("../common");
4
+
5
+ module.exports = ({ MODULE_NAME, MODEL_NAME, actionName = "data" }) => {
6
+ return {
7
+ model: {
8
+ type: Schema.Types.Mixed,
9
+ required: true,
10
+ validate: [
11
+ {
12
+ validator(val) {
13
+ return getApp()
14
+ .getForm(`${MODULE_NAME}//_${actionName}`)
15
+ .run(val);
16
+ },
17
+ message: `${MODULE_NAME}:${firstLetterToLower(
18
+ MODEL_NAME
19
+ )}_data_is_not_valid`,
20
+ },
21
+ ],
22
+ },
23
+ };
24
+ };
@@ -0,0 +1,28 @@
1
+ const Form = require("../form/form");
2
+
3
+ module.exports = ({
4
+ MODULE_NAME,
5
+ MODEL_NAME,
6
+ actionName = "_data",
7
+ validators = [],
8
+ afterExtract = async (input /*, req = null*/) => input,
9
+ }) => {
10
+ return class extends Form {
11
+ constructor({ app }) {
12
+ super({ app, MODULE_NAME, MODEL_NAME, actionName });
13
+ }
14
+
15
+ extract(data) {
16
+ return data;
17
+ }
18
+
19
+ async afterExtract(input, req) {
20
+ input = await super.afterExtract(input, req);
21
+ return await afterExtract(input, req);
22
+ }
23
+
24
+ getFormValidationRules() {
25
+ return validators;
26
+ }
27
+ };
28
+ };
@@ -0,0 +1,29 @@
1
+ const Form = require("../form/form");
2
+
3
+ module.exports = ({
4
+ MODULE_NAME,
5
+ MODEL_NAME,
6
+ actionName = "create",
7
+ dataFieldName = "data",
8
+ validators = [],
9
+ afterExtract = async (input /*, req*/) => input,
10
+ }) => {
11
+ const FIELDS = [
12
+ ["identity", "not-node//identity"],
13
+ ["data", `${MODULE_NAME}//_${dataFieldName}`],
14
+ ];
15
+ return class extends Form {
16
+ constructor({ app }) {
17
+ super({ FIELDS, app, MODULE_NAME, MODEL_NAME, actionName });
18
+ }
19
+
20
+ async afterExtract(input, req) {
21
+ input = await super.afterExtract(input, req);
22
+ return await afterExtract(input, req);
23
+ }
24
+
25
+ getFormValidationRules() {
26
+ return validators;
27
+ }
28
+ };
29
+ };
@@ -0,0 +1,31 @@
1
+ const Form = require("../form/form");
2
+
3
+ module.exports = ({
4
+ MODULE_NAME,
5
+ MODEL_NAME,
6
+ actionName = "update",
7
+ dataFieldName = "data",
8
+ validators = [],
9
+ afterExtract = async (input /*, req*/) => input,
10
+ }) => {
11
+ const FIELDS = [
12
+ ["targetId", { required: true }, "not-node//objectId"],
13
+ ["identity", "not-node//identity"],
14
+ ["data", `${MODULE_NAME}//_${dataFieldName}`],
15
+ ];
16
+
17
+ return class extends Form {
18
+ constructor({ app }) {
19
+ super({ FIELDS, app, MODULE_NAME, MODEL_NAME, actionName });
20
+ }
21
+
22
+ async afterExtract(input, req) {
23
+ input = await super.afterExtract(input, req);
24
+ return await afterExtract(input, req);
25
+ }
26
+
27
+ getFormValidationRules() {
28
+ return validators;
29
+ }
30
+ };
31
+ };
@@ -2,6 +2,10 @@ module.exports.GenericLogic = require("./logic.js");
2
2
  module.exports.GenericRoute = require("./route.js");
3
3
  module.exports.GenericGetByIdForm = require("./form.getById.js");
4
4
  module.exports.GenericGetByIDForm = require("./form.getByID.js");
5
+ module.exports.GenericDataField = require("./field._data.js");
6
+ module.exports.GenericDataForm = require("./form._data.js");
7
+ module.exports.GenericCreateForm = require("./form.create.js");
8
+ module.exports.GenericUpdateForm = require("./form.update.js");
5
9
  module.exports.GenericAuthorizedActionForm = require("./form.authorizedAction.js");
6
10
  module.exports.GenericListAndCountForm = require("./form.listAndCount.js");
7
11
  module.exports.GenericListForm = require("./form.list.js");