not-node 6.5.11 → 6.5.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.5.11",
3
+ "version": "6.5.13",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -53,6 +53,9 @@
53
53
  "field_userId_placeholder": "",
54
54
  "field_UUID_label": "UUID",
55
55
  "field_UUID_placeholder": "UUID",
56
+ "crud_get_action_waiting": "Чтение записи...",
57
+ "crud_get_action_form_title": "Детали",
58
+ "crud_get_action_form_description": "Просмотр документа",
56
59
  "crud_create_action_waiting": "Создание записи...",
57
60
  "crud_create_action_form_title": "Добавление",
58
61
  "crud_create_action_form_description": "Добавить новый документ",
@@ -21,8 +21,28 @@ const extraActionsBuilder = (
21
21
  const POST_FIX_RECORD_ID = "/:record[_id]";
22
22
  const POST_FIX_ACTION_NAME = "/:actionName";
23
23
 
24
- module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
25
- return {
24
+ const DEFAULT_LOCALES_STRINGS = ["title", "description"];
25
+
26
+ const getFormActionLocaleString = (
27
+ strName,
28
+ MODULE_NAME,
29
+ modelName,
30
+ actionName,
31
+ commonFormTitles = false
32
+ ) => {
33
+ return commonFormTitles
34
+ ? `not-node:crud_${actionName}_action_form_${strName}`
35
+ : `${MODULE_NAME}:${modelName}_form_${actionName}_${strName}`;
36
+ };
37
+
38
+ module.exports = (
39
+ MODULE_NAME,
40
+ modelName,
41
+ FIELDS = [],
42
+ actions = {},
43
+ options = {}
44
+ ) => {
45
+ const resultManifest = {
26
46
  model: modelName,
27
47
  url: "/api/:modelName",
28
48
  fields: FIELDS,
@@ -37,7 +57,6 @@ module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
37
57
  root: true,
38
58
  },
39
59
  ],
40
- title: `${MODULE_NAME}:${modelName}_form_create_title`,
41
60
  },
42
61
  update: {
43
62
  method: "POST",
@@ -53,7 +72,6 @@ module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
53
72
  root: true,
54
73
  },
55
74
  ],
56
- title: `${MODULE_NAME}:${modelName}_form_update_title`,
57
75
  },
58
76
  list: {
59
77
  method: "GET",
@@ -108,7 +126,6 @@ module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
108
126
  root: true,
109
127
  },
110
128
  ],
111
- title: `${MODULE_NAME}:${modelName}_form_details_title`,
112
129
  },
113
130
  getByID: {
114
131
  method: "GET",
@@ -118,9 +135,6 @@ module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
118
135
  {
119
136
  root: true,
120
137
  },
121
- {
122
- auth: false,
123
- },
124
138
  ],
125
139
  },
126
140
  getRaw: {
@@ -146,4 +160,22 @@ module.exports = (MODULE_NAME, modelName, FIELDS = [], actions = {}) => {
146
160
  ...extraActionsBuilder(MODULE_NAME, modelName, FIELDS, actions),
147
161
  },
148
162
  };
163
+
164
+ Object.keys(resultManifest.actions).forEach((actionName) => {
165
+ const actionData = resultManifest.actions[actionName];
166
+ const lst = options?.localesStrings ?? DEFAULT_LOCALES_STRINGS;
167
+ lst.forEach((strName) => {
168
+ if (!Object.hasOwn(actionData, strName)) {
169
+ actionData[strName] = getFormActionLocaleString(
170
+ strName,
171
+ MODULE_NAME,
172
+ modelName,
173
+ actionName,
174
+ options?.commonFormTitles
175
+ );
176
+ }
177
+ });
178
+ });
179
+
180
+ return resultManifest;
149
181
  };