not-node 6.3.54 → 6.3.56
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 +1 -1
- package/src/common.js +18 -1
- package/src/manifest/route.js +18 -11
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -104,7 +104,8 @@ module.exports.copyObj = (obj) => {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Copies object to secure it from changes
|
|
107
|
-
* @param {object} obj
|
|
107
|
+
* @param {object} obj original object
|
|
108
|
+
* @param {Array<string>} list properties list to include
|
|
108
109
|
* @return {object} copy of object
|
|
109
110
|
**/
|
|
110
111
|
module.exports.partCopyObj = (obj, list) => {
|
|
@@ -117,6 +118,22 @@ module.exports.partCopyObj = (obj, list) => {
|
|
|
117
118
|
return JSON.parse(JSON.stringify(partObj));
|
|
118
119
|
};
|
|
119
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Copies object to secure it from changes
|
|
123
|
+
* @param {object} obj original object
|
|
124
|
+
* @param {Array<string>} except properties list to exclude
|
|
125
|
+
* @return {object} copy of object
|
|
126
|
+
**/
|
|
127
|
+
module.exports.partCopyObjExcept = (obj, except) => {
|
|
128
|
+
let partObj = Object.keys(obj).reduce((prev, curr) => {
|
|
129
|
+
if (!except.includes(curr)) {
|
|
130
|
+
prev[curr] = obj[curr];
|
|
131
|
+
}
|
|
132
|
+
return prev;
|
|
133
|
+
}, {});
|
|
134
|
+
return JSON.parse(JSON.stringify(partObj));
|
|
135
|
+
};
|
|
136
|
+
|
|
120
137
|
/**
|
|
121
138
|
* Test argument type to be 'function'
|
|
122
139
|
* @param {any} func possible function
|
package/src/manifest/route.js
CHANGED
|
@@ -208,12 +208,15 @@ class notRoute {
|
|
|
208
208
|
|
|
209
209
|
async executeRoute(modRoute, actionName, { req, res, next }) {
|
|
210
210
|
try {
|
|
211
|
+
let prepared = undefined;
|
|
211
212
|
//waiting preparation
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if (modRoute[CONST_AFTER_ACTION]) {
|
|
214
|
+
prepared = await this.executeFunction(
|
|
215
|
+
modRoute,
|
|
216
|
+
CONST_BEFORE_ACTION,
|
|
217
|
+
[req, res, next]
|
|
218
|
+
);
|
|
219
|
+
}
|
|
217
220
|
//waiting results
|
|
218
221
|
let result = await this.executeFunction(modRoute, actionName, [
|
|
219
222
|
req,
|
|
@@ -234,12 +237,16 @@ class notRoute {
|
|
|
234
237
|
notManifestRouteResultFilter.filter(req.notRouteData, result);
|
|
235
238
|
}
|
|
236
239
|
//run after with results, continue without waiting when it finished
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
if (modRoute[CONST_AFTER_ACTION]) {
|
|
241
|
+
return this.executeFunction(modRoute, CONST_AFTER_ACTION, [
|
|
242
|
+
req,
|
|
243
|
+
res,
|
|
244
|
+
next,
|
|
245
|
+
result,
|
|
246
|
+
]);
|
|
247
|
+
} else {
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
243
250
|
} catch (e) {
|
|
244
251
|
next(e);
|
|
245
252
|
}
|