not-node 6.3.0 → 6.3.2
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/index.js +2 -0
- package/package.json +2 -2
- package/src/auth/const.js +17 -0
- package/src/auth/fields.js +10 -5
- package/src/auth/roles.js +2 -2
- package/src/auth/rules.js +49 -13
- package/src/bootstrap/logic.js +12 -11
- package/src/bootstrap/route.js +1 -1
- package/src/common.js +7 -0
- package/src/fields/filter.js +326 -0
- package/src/fields/index.js +2 -2
- package/src/form/env_extractors/activeUser.js +1 -1
- package/src/form/env_extractors/activeUserId.js +6 -0
- package/src/form/env_extractors/index.js +3 -0
- package/src/form/env_extractors/query.js +6 -0
- package/src/form/fabric.js +3 -3
- package/src/form/form.js +37 -10
- package/src/generic/form.authorizedAction.js +6 -8
- package/src/generic/form.getByID.js +8 -10
- package/src/generic/form.getById.js +8 -9
- package/src/generic/form.listAndCount.js +28 -26
- package/src/generic/logic.js +31 -85
- package/src/identity/index.js +6 -2
- package/src/identity/providers/session.js +14 -12
- package/src/identity/providers/token.js +14 -7
- package/src/init/lib/sessions/index.js +1 -1
- package/src/manifest/manifest.filter.js +118 -17
- package/src/manifest/manifest.js +8 -2
- package/src/manifest/module.js +21 -16
- package/src/manifest/registrator/fields.js +8 -1
- package/src/manifest/registrator/forms.js +1 -0
- package/src/manifest/registrator/locales.js +9 -1
- package/src/manifest/registrator/logics.js +2 -2
- package/src/manifest/registrator/models.js +2 -2
- package/src/manifest/registrator/routes.js +8 -8
- package/src/manifest/result.filter.js +3 -2
- package/src/manifest/route.js +42 -14
- package/src/model/default.js +1 -1
- package/src/model/proto.js +1 -1
- package/src/obsolete.js +23 -7
- package/src/types.js +83 -0
- package/test/auth/fields.js +2 -2
- package/test/auth/obsolete.js +16 -9
- package/test/extractors.js +60 -0
- package/test/filter.js +286 -0
- package/test/init/sessions.js +14 -2
- package/test/notManifestFilter.js +358 -19
- package/test/notModule.js +41 -1
- package/test/transformers.js +21 -0
- package/tmpl/files/module.server/layers/routes.manifest.ejs +9 -0
|
@@ -40,7 +40,6 @@ module.exports = class IdentityProviderToken {
|
|
|
40
40
|
const auth = req.get("Authorization");
|
|
41
41
|
if (auth && auth.length) {
|
|
42
42
|
const [, token] = auth.split(" ");
|
|
43
|
-
console.log("token found", token);
|
|
44
43
|
return token;
|
|
45
44
|
}
|
|
46
45
|
return null;
|
|
@@ -58,6 +57,10 @@ module.exports = class IdentityProviderToken {
|
|
|
58
57
|
return this.#token;
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @returns {Object}
|
|
63
|
+
*/
|
|
61
64
|
#decodeTokenContent() {
|
|
62
65
|
try {
|
|
63
66
|
if (this.#token) {
|
|
@@ -85,8 +88,11 @@ module.exports = class IdentityProviderToken {
|
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Decodes raw token and sets token object as #tokenContent
|
|
93
|
+
*/
|
|
94
|
+
#extractTokenContent() {
|
|
95
|
+
this.#tokenContent = this.#decodeTokenContent();
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
get tokenContent() {
|
|
@@ -221,7 +227,9 @@ module.exports = class IdentityProviderToken {
|
|
|
221
227
|
**/
|
|
222
228
|
setUserId(_id) {
|
|
223
229
|
if (this.tokenContent) {
|
|
224
|
-
|
|
230
|
+
if (_id === "") {
|
|
231
|
+
this.#tokenContent && delete this.#tokenContent._id;
|
|
232
|
+
}
|
|
225
233
|
this.#updateToken();
|
|
226
234
|
}
|
|
227
235
|
return this;
|
|
@@ -254,7 +262,7 @@ module.exports = class IdentityProviderToken {
|
|
|
254
262
|
/**
|
|
255
263
|
* Set auth data in session, user id and role
|
|
256
264
|
* @param {string} id user id
|
|
257
|
-
* @param {string} role user role
|
|
265
|
+
* @param {Array<string>} role user role
|
|
258
266
|
**/
|
|
259
267
|
setAuth(id, role) {
|
|
260
268
|
this.setUserId(id);
|
|
@@ -265,12 +273,11 @@ module.exports = class IdentityProviderToken {
|
|
|
265
273
|
* Set auth data in token to Guest
|
|
266
274
|
**/
|
|
267
275
|
setGuest() {
|
|
268
|
-
this.setAuth(
|
|
276
|
+
this.setAuth("", [CONST.DEFAULT_USER_ROLE_FOR_GUEST]);
|
|
269
277
|
}
|
|
270
278
|
|
|
271
279
|
/**
|
|
272
280
|
* Reset session
|
|
273
|
-
* @param {object} req Express Request
|
|
274
281
|
**/
|
|
275
282
|
cleanse() {
|
|
276
283
|
this.setGuest();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const merge = require("deepmerge");
|
|
2
2
|
const Auth = require("../auth");
|
|
3
|
+
const notFieldsFilter = require("../fields/filter");
|
|
4
|
+
const getApp = require("../getApp");
|
|
3
5
|
|
|
4
6
|
const DIRTY_FIELDS = [
|
|
5
7
|
"rules",
|
|
@@ -10,22 +12,27 @@ const DIRTY_FIELDS = [
|
|
|
10
12
|
"role",
|
|
11
13
|
"actionName",
|
|
12
14
|
"actionPrefix",
|
|
15
|
+
"actionSignature",
|
|
13
16
|
];
|
|
14
17
|
|
|
15
18
|
module.exports = class notManifestFilter {
|
|
19
|
+
static schemaLoader = (name) => getApp().getModelSchema(name);
|
|
20
|
+
|
|
16
21
|
/**
|
|
17
22
|
* Clear route from action variants that not permited for user according to
|
|
18
23
|
* his auth, role, root status
|
|
19
24
|
*
|
|
20
|
-
* @param {object}
|
|
21
|
-
* @param {boolean}
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {boolean}
|
|
25
|
+
* @param {object} route route object
|
|
26
|
+
* @param {boolean} auth user auth status
|
|
27
|
+
* @param {Array<string>} role user role status
|
|
28
|
+
* @param {boolean} root user root status
|
|
29
|
+
* @param {string} [moduleName=''] user root status
|
|
24
30
|
*
|
|
25
31
|
* @return {object} Return router with only actions user can access with current states of auth, role, root. With removed definitions of what rules of access are.
|
|
26
32
|
**/
|
|
27
|
-
static filterRoute(route, auth, role, root) {
|
|
33
|
+
static filterRoute(route, auth, role, root, moduleName = "") {
|
|
28
34
|
let result = JSON.parse(JSON.stringify(route));
|
|
35
|
+
const modelName = result.modelName;
|
|
29
36
|
result.actions = {};
|
|
30
37
|
if (!route || !route.actions) {
|
|
31
38
|
return result;
|
|
@@ -41,7 +48,9 @@ module.exports = class notManifestFilter {
|
|
|
41
48
|
auth,
|
|
42
49
|
role,
|
|
43
50
|
root,
|
|
44
|
-
result
|
|
51
|
+
result,
|
|
52
|
+
modelName,
|
|
53
|
+
moduleName
|
|
45
54
|
);
|
|
46
55
|
}
|
|
47
56
|
return result;
|
|
@@ -49,8 +58,27 @@ module.exports = class notManifestFilter {
|
|
|
49
58
|
|
|
50
59
|
/**
|
|
51
60
|
*
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @param {string} actionName
|
|
64
|
+
* @param {import('../types').notActionData} actionSet
|
|
65
|
+
* @param {boolean} auth
|
|
66
|
+
* @param {Array<string>} role
|
|
67
|
+
* @param {boolean} root
|
|
68
|
+
* @param {any} result
|
|
69
|
+
* @param {string} [modelName=""]
|
|
70
|
+
* @param {string} [moduleName=""]
|
|
52
71
|
*/
|
|
53
|
-
static filterRouteAction(
|
|
72
|
+
static filterRouteAction(
|
|
73
|
+
actionName,
|
|
74
|
+
actionSet,
|
|
75
|
+
auth,
|
|
76
|
+
role,
|
|
77
|
+
root,
|
|
78
|
+
result,
|
|
79
|
+
modelName = "",
|
|
80
|
+
moduleName = ""
|
|
81
|
+
) {
|
|
54
82
|
if (Array.isArray(actionSet.rules)) {
|
|
55
83
|
for (let i = 0; i < actionSet.rules.length; i++) {
|
|
56
84
|
if (
|
|
@@ -59,7 +87,15 @@ module.exports = class notManifestFilter {
|
|
|
59
87
|
result.actions[actionName] =
|
|
60
88
|
notManifestFilter.clearActionFromRules(
|
|
61
89
|
actionSet,
|
|
62
|
-
actionSet.rules[i]
|
|
90
|
+
actionSet.rules[i],
|
|
91
|
+
{
|
|
92
|
+
auth,
|
|
93
|
+
role,
|
|
94
|
+
root,
|
|
95
|
+
modelName,
|
|
96
|
+
moduleName,
|
|
97
|
+
actionSignature: actionSet.actionSignature,
|
|
98
|
+
}
|
|
63
99
|
);
|
|
64
100
|
break;
|
|
65
101
|
}
|
|
@@ -67,7 +103,18 @@ module.exports = class notManifestFilter {
|
|
|
67
103
|
} else {
|
|
68
104
|
if (Auth.checkCredentials(actionSet, auth, role, root)) {
|
|
69
105
|
result.actions[actionName] =
|
|
70
|
-
notManifestFilter.clearActionFromRules(
|
|
106
|
+
notManifestFilter.clearActionFromRules(
|
|
107
|
+
actionSet,
|
|
108
|
+
undefined,
|
|
109
|
+
{
|
|
110
|
+
auth,
|
|
111
|
+
role,
|
|
112
|
+
root,
|
|
113
|
+
modelName,
|
|
114
|
+
moduleName,
|
|
115
|
+
actionSignature: actionSet.actionSignature,
|
|
116
|
+
}
|
|
117
|
+
);
|
|
71
118
|
}
|
|
72
119
|
}
|
|
73
120
|
}
|
|
@@ -78,20 +125,22 @@ module.exports = class notManifestFilter {
|
|
|
78
125
|
*
|
|
79
126
|
* @param {object} manifest full raw manifest
|
|
80
127
|
* @param {boolean} auth user auth status
|
|
81
|
-
* @param {
|
|
128
|
+
* @param {Array<string>} role user role status
|
|
82
129
|
* @param {boolean} root user root status
|
|
130
|
+
* @param {string} [moduleName='']
|
|
83
131
|
*
|
|
84
132
|
* @return {object} filtered manifest
|
|
85
133
|
**/
|
|
86
134
|
|
|
87
|
-
static filter(manifest, auth, role, root) {
|
|
135
|
+
static filter(manifest, auth, role, root, moduleName = "") {
|
|
88
136
|
var result = {};
|
|
89
137
|
for (let routeName in manifest) {
|
|
90
138
|
let routeMan = notManifestFilter.filterRoute(
|
|
91
139
|
manifest[routeName],
|
|
92
140
|
auth,
|
|
93
141
|
role,
|
|
94
|
-
root
|
|
142
|
+
root,
|
|
143
|
+
moduleName
|
|
95
144
|
);
|
|
96
145
|
if (Object.keys(routeMan.actions).length > 0) {
|
|
97
146
|
result[routeName] = routeMan;
|
|
@@ -115,20 +164,72 @@ module.exports = class notManifestFilter {
|
|
|
115
164
|
);
|
|
116
165
|
}
|
|
117
166
|
|
|
167
|
+
static composeFullModelName(moduleName, modelName) {
|
|
168
|
+
if (modelName) {
|
|
169
|
+
if (moduleName) {
|
|
170
|
+
return `${moduleName}//${modelName}`;
|
|
171
|
+
} else {
|
|
172
|
+
return `${modelName}`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return "";
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
static loadSchema(fullModelName) {
|
|
179
|
+
if (fullModelName !== "") {
|
|
180
|
+
return this.schemaLoader(fullModelName);
|
|
181
|
+
} else {
|
|
182
|
+
return {};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
118
186
|
/**
|
|
119
187
|
* Clear action definition from rules of access
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
122
|
-
* @
|
|
188
|
+
* @param {object} action action data
|
|
189
|
+
* @param {object} [ruleSet] specific set of rules for this action
|
|
190
|
+
* @param {object} mods specific set of rules for this action
|
|
191
|
+
* @param {boolean} mods.auth
|
|
192
|
+
* @param {boolean} mods.root
|
|
193
|
+
* @param {Array<string>} mods.role
|
|
194
|
+
* @param {string} mods.modelName
|
|
195
|
+
* @param {string} mods.moduleName
|
|
196
|
+
* @param {string|undefined} mods.actionSignature create/read/update/delete
|
|
197
|
+
* @return {object} clean action data
|
|
123
198
|
**/
|
|
124
|
-
static clearActionFromRules(
|
|
199
|
+
static clearActionFromRules(
|
|
200
|
+
action,
|
|
201
|
+
ruleSet = null,
|
|
202
|
+
{
|
|
203
|
+
auth = false,
|
|
204
|
+
role = [Auth.DEFAULT_USER_ROLE_FOR_GUEST],
|
|
205
|
+
root = false,
|
|
206
|
+
modelName = "",
|
|
207
|
+
moduleName = "",
|
|
208
|
+
actionSignature = undefined,
|
|
209
|
+
} = {
|
|
210
|
+
auth: false,
|
|
211
|
+
role: [Auth.DEFAULT_USER_ROLE_FOR_GUEST],
|
|
212
|
+
root: false,
|
|
213
|
+
modelName: "",
|
|
214
|
+
moduleName: "",
|
|
215
|
+
actionSignature: undefined,
|
|
216
|
+
}
|
|
217
|
+
) {
|
|
125
218
|
let copy = merge({}, action);
|
|
126
219
|
notManifestFilter.clearFromDirtyFields(copy);
|
|
127
220
|
//copy fields list from rule to action if it exists
|
|
128
221
|
//fields list is used to restrict fields of data that could be accessed via
|
|
129
222
|
//this action
|
|
130
223
|
if (notManifestFilter.ruleSetHasFieldsDirective(ruleSet)) {
|
|
131
|
-
|
|
224
|
+
const fullModelName = this.composeFullModelName(
|
|
225
|
+
moduleName,
|
|
226
|
+
modelName
|
|
227
|
+
);
|
|
228
|
+
copy.fields = notFieldsFilter.filter(
|
|
229
|
+
[...ruleSet.fields],
|
|
230
|
+
this.loadSchema(fullModelName),
|
|
231
|
+
{ action: actionSignature, roles: role, auth, root, modelName }
|
|
232
|
+
);
|
|
132
233
|
}
|
|
133
234
|
return copy;
|
|
134
235
|
}
|
package/src/manifest/manifest.js
CHANGED
|
@@ -111,14 +111,20 @@ class notManifest {
|
|
|
111
111
|
*
|
|
112
112
|
* @param {object} manifest full raw manifest
|
|
113
113
|
* @param {boolean} auth user auth status
|
|
114
|
-
* @param {
|
|
114
|
+
* @param {Array<string>} role user role status
|
|
115
115
|
* @param {boolean} root user root status
|
|
116
116
|
*
|
|
117
117
|
* @return {object} filtered manifest
|
|
118
118
|
**/
|
|
119
119
|
|
|
120
120
|
filterManifest(manifest, auth, role, root) {
|
|
121
|
-
return notManifestFilter.filter(
|
|
121
|
+
return notManifestFilter.filter(
|
|
122
|
+
manifest,
|
|
123
|
+
auth,
|
|
124
|
+
role,
|
|
125
|
+
root,
|
|
126
|
+
this.moduleName
|
|
127
|
+
);
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
|
package/src/manifest/module.js
CHANGED
|
@@ -18,7 +18,7 @@ const DEFAULT_WS_ROUTE_ACTION_SPLITTER = "//";
|
|
|
18
18
|
/**
|
|
19
19
|
* List of methods to be binded from notApp to notModule
|
|
20
20
|
* @constant
|
|
21
|
-
* @type {string}
|
|
21
|
+
* @type {Array<string>}
|
|
22
22
|
*/
|
|
23
23
|
const MODULE_BINDINGS_LIST = ["getModel", "getModelSchema", "getModelFile"];
|
|
24
24
|
/**
|
|
@@ -62,12 +62,12 @@ class notModule {
|
|
|
62
62
|
if (this.path) {
|
|
63
63
|
this.initFromPath(this.path);
|
|
64
64
|
} else if (this.module) {
|
|
65
|
-
this.initFromModule(
|
|
65
|
+
this.initFromModule();
|
|
66
66
|
} else {
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
if (this.module === null || typeof this.module === "undefined") {
|
|
70
|
-
log.error(`Module ${this.path} not loaded`);
|
|
70
|
+
log && log.error(`Module ${this.path} not loaded`);
|
|
71
71
|
} else if (this.appIsSet()) {
|
|
72
72
|
mapBind(this.notApp, this.module, MODULE_BINDINGS_LIST);
|
|
73
73
|
}
|
|
@@ -83,7 +83,7 @@ class notModule {
|
|
|
83
83
|
}
|
|
84
84
|
} catch (e) {
|
|
85
85
|
this.faulty = true;
|
|
86
|
-
log.error(e);
|
|
86
|
+
log && log.error(e);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ class notModule {
|
|
|
92
92
|
this.registerContent();
|
|
93
93
|
} catch (e) {
|
|
94
94
|
this.faulty = true;
|
|
95
|
-
log.error(e);
|
|
95
|
+
log && log.error(e);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -107,11 +107,14 @@ class notModule {
|
|
|
107
107
|
getManifest(
|
|
108
108
|
{ auth, role, root } = {
|
|
109
109
|
auth: false,
|
|
110
|
-
role: Auth.DEFAULT_USER_ROLE_FOR_GUEST,
|
|
110
|
+
role: [Auth.DEFAULT_USER_ROLE_FOR_GUEST],
|
|
111
111
|
root: false,
|
|
112
112
|
}
|
|
113
113
|
) {
|
|
114
|
-
return
|
|
114
|
+
return (
|
|
115
|
+
this.manifest &&
|
|
116
|
+
this.manifest.filterManifest(this.manifests, auth, role, root)
|
|
117
|
+
);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
getRouteManifest(name) {
|
|
@@ -172,7 +175,7 @@ class notModule {
|
|
|
172
175
|
if (this.manifests && expressApp) {
|
|
173
176
|
notModuleInitializator.exec({ nModule: this });
|
|
174
177
|
this.initManifest(expressApp, moduleName);
|
|
175
|
-
this.manifest.registerRoutes(this.manifests);
|
|
178
|
+
this.manifest && this.manifest.registerRoutes(this.manifests);
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
|
|
@@ -182,9 +185,10 @@ class notModule {
|
|
|
182
185
|
|
|
183
186
|
async exec(methodName, params) {
|
|
184
187
|
if (!this.module) {
|
|
185
|
-
log
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
log &&
|
|
189
|
+
log.error(
|
|
190
|
+
`Cant exec ${methodName} in module ${this.path}, module not loaded`
|
|
191
|
+
);
|
|
188
192
|
return false;
|
|
189
193
|
}
|
|
190
194
|
await executeObjectFunction(this.module, methodName, [
|
|
@@ -369,11 +373,12 @@ class notModule {
|
|
|
369
373
|
const status = this.getStatus();
|
|
370
374
|
Object.keys(status).forEach((contentType) => {
|
|
371
375
|
if (status[contentType].count) {
|
|
372
|
-
log
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
log &&
|
|
377
|
+
log.log(
|
|
378
|
+
`${this.getName()} ${contentType}(${
|
|
379
|
+
status[contentType].count
|
|
380
|
+
}): ${status[contentType].list.join(", ")}`
|
|
381
|
+
);
|
|
377
382
|
}
|
|
378
383
|
});
|
|
379
384
|
}
|
|
@@ -83,7 +83,7 @@ module.exports = class notModuleRegistratorFields {
|
|
|
83
83
|
/**
|
|
84
84
|
* Searching fields in directory
|
|
85
85
|
* @param {Object} input
|
|
86
|
-
* @param {
|
|
86
|
+
* @param {import('../module')} input.nModule
|
|
87
87
|
* @param {string} input.srcDir
|
|
88
88
|
**/
|
|
89
89
|
findAll({ nModule, srcDir }) {
|
|
@@ -96,6 +96,13 @@ module.exports = class notModuleRegistratorFields {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Registering fields from specific path
|
|
101
|
+
*
|
|
102
|
+
* @param {Object} input
|
|
103
|
+
* @param {import('../module')} input.nModule
|
|
104
|
+
* @param {string} input.fromPath
|
|
105
|
+
*/
|
|
99
106
|
register({ nModule, fromPath }) {
|
|
100
107
|
let file = notModuleRegistratorFields.openFile(fromPath);
|
|
101
108
|
if (file && objHas(file, "FIELDS")) {
|
|
@@ -29,6 +29,7 @@ module.exports = class notModuleRegistratorForms {
|
|
|
29
29
|
* Searching forms in directory
|
|
30
30
|
* @param {Object} input
|
|
31
31
|
* @param {string} input.srcDir
|
|
32
|
+
* @param {import('../module')} input.nModule
|
|
32
33
|
**/
|
|
33
34
|
findAll({ nModule, srcDir }) {
|
|
34
35
|
fs.readdirSync(srcDir).forEach((file) => {
|
|
@@ -6,12 +6,20 @@ module.exports = class notModuleRegistratorLocales {
|
|
|
6
6
|
this.run({ nModule });
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {object} input
|
|
12
|
+
* @param {import('../module')} input.nModule
|
|
13
|
+
* @return {boolean}
|
|
14
|
+
*/
|
|
9
15
|
run({ nModule }) {
|
|
10
16
|
const srcDir = notModuleRegistratorLocales.getPath(nModule);
|
|
11
17
|
if (!srcDir) {
|
|
12
18
|
return false;
|
|
13
19
|
}
|
|
14
|
-
notLocale
|
|
20
|
+
notLocale
|
|
21
|
+
.fromDir(srcDir, nModule.getName())
|
|
22
|
+
.catch((e) => log && log.error(e));
|
|
15
23
|
return true;
|
|
16
24
|
}
|
|
17
25
|
|
|
@@ -6,7 +6,7 @@ const { tryFile, mapBind } = require("../../common");
|
|
|
6
6
|
/**
|
|
7
7
|
* List of methods to be binded from notApp to logics
|
|
8
8
|
* @constant
|
|
9
|
-
* @type {string}
|
|
9
|
+
* @type {Array<string>}
|
|
10
10
|
**/
|
|
11
11
|
const LOGIC_BINDINGS_LIST = [
|
|
12
12
|
"getModel",
|
|
@@ -44,7 +44,7 @@ module.exports = class notModuleRegistratorLogics {
|
|
|
44
44
|
* Searching fields in directory
|
|
45
45
|
* @static
|
|
46
46
|
* @param {Object} input
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {import('../module')} input.nModule
|
|
48
48
|
* @param {string} input.srcDir
|
|
49
49
|
**/
|
|
50
50
|
findAll({ nModule, srcDir }) {
|
|
@@ -6,7 +6,7 @@ const { tryFile, mapBind } = require("../../common");
|
|
|
6
6
|
/**
|
|
7
7
|
* List of methods to be binded from notApp to models
|
|
8
8
|
* @constant
|
|
9
|
-
* @type {string}
|
|
9
|
+
* @type {Array<string>}
|
|
10
10
|
**/
|
|
11
11
|
const MODEL_BINDINGS_LIST = [
|
|
12
12
|
"getModel",
|
|
@@ -41,7 +41,7 @@ module.exports = class notModuleRegistratorModels {
|
|
|
41
41
|
* Searching fields in directory
|
|
42
42
|
* @static
|
|
43
43
|
* @param {Object} input
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {import('../module')} input.nModule
|
|
45
45
|
* @param {string} input.srcDir
|
|
46
46
|
**/
|
|
47
47
|
findAll({ nModule, srcDir }) {
|
|
@@ -10,28 +10,28 @@ const notModuleRegistratorRoutesWS = require("./routes.ws");
|
|
|
10
10
|
/**
|
|
11
11
|
* Manifest files ending
|
|
12
12
|
* @constant
|
|
13
|
-
* @type {string}
|
|
13
|
+
* @type {Array<string>}
|
|
14
14
|
*/
|
|
15
15
|
const DEFAULT_MANIFEST_FILE_ENDINGS = [".manifest.js", ".manifest.cjs"];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Routes collection files ending
|
|
19
19
|
* @constant
|
|
20
|
-
* @type {string}
|
|
20
|
+
* @type {Array<string>}
|
|
21
21
|
*/
|
|
22
22
|
const DEFAULT_ROUTES_FILE_ENDINGS = [".js", ".cjs"];
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* WS End-points collection files ending
|
|
26
26
|
* @constant
|
|
27
|
-
* @type {string}
|
|
27
|
+
* @type {Array<string>}
|
|
28
28
|
*/
|
|
29
29
|
const DEFAULT_WS_ROUTES_FILE_ENDINGS = [".ws.js", ".ws.cjs"];
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* List of methods to be binded from notApp to routes and WS end-points
|
|
33
33
|
* @constant
|
|
34
|
-
* @type {string}
|
|
34
|
+
* @type {Array<string>}
|
|
35
35
|
*/
|
|
36
36
|
const ROUTE_BINDINGS_LIST = [
|
|
37
37
|
"getLogic",
|
|
@@ -68,9 +68,9 @@ module.exports = class notModuleRegistratorRoutes {
|
|
|
68
68
|
/**
|
|
69
69
|
* Searching fields in directory
|
|
70
70
|
* @static
|
|
71
|
-
* @param {Object}
|
|
72
|
-
* @param {
|
|
73
|
-
* @param {string}
|
|
71
|
+
* @param {Object} input
|
|
72
|
+
* @param {import('../module')} input.nModule
|
|
73
|
+
* @param {string} input.srcDir
|
|
74
74
|
**/
|
|
75
75
|
findAll({ nModule, srcDir }) {
|
|
76
76
|
fs.readdirSync(srcDir).forEach((file) =>
|
|
@@ -127,7 +127,7 @@ module.exports = class notModuleRegistratorRoutes {
|
|
|
127
127
|
});
|
|
128
128
|
return true;
|
|
129
129
|
} catch (e) {
|
|
130
|
-
log.error(e);
|
|
130
|
+
log && log.error(e);
|
|
131
131
|
return false;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -134,7 +134,8 @@ module.exports = class notManifestRouteResultFilter {
|
|
|
134
134
|
for (let filteringTargetName of filteringArray) {
|
|
135
135
|
const subTarget = notPath.get(
|
|
136
136
|
`${notPath.PATH_START_OBJECT}${filteringTargetName}`,
|
|
137
|
-
target
|
|
137
|
+
target,
|
|
138
|
+
{}
|
|
138
139
|
);
|
|
139
140
|
//if sub target Array filtering each item individualy
|
|
140
141
|
if (Array.isArray(subTarget)) {
|
|
@@ -231,7 +232,7 @@ module.exports = class notManifestRouteResultFilter {
|
|
|
231
232
|
static getFilteringTarget(result, notRouteData) {
|
|
232
233
|
if (result && typeof result == "object") {
|
|
233
234
|
const returnListRoot = this.getFilteringTargetPath(notRouteData);
|
|
234
|
-
return notPath.get(returnListRoot, result);
|
|
235
|
+
return notPath.get(returnListRoot, result, {});
|
|
235
236
|
} else {
|
|
236
237
|
return result;
|
|
237
238
|
}
|