not-node 5.0.22 → 5.1.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/.eslintrc.json +1 -1
- package/bin/not-deploy.js +52 -0
- package/index.js +21 -19
- package/package.json +1 -1
- package/src/app.js +61 -58
- package/src/auth/abstract.js +17 -19
- package/src/auth/const.js +8 -12
- package/src/auth/fields.js +143 -124
- package/src/auth/index.js +14 -14
- package/src/auth/roles.js +64 -63
- package/src/auth/routes.js +89 -54
- package/src/auth/rules.js +63 -63
- package/src/auth/session.js +60 -62
- package/src/bootstrap/form.js +13 -13
- package/src/bootstrap/logic.js +45 -41
- package/src/bootstrap/model.js +14 -17
- package/src/bootstrap/route.js +132 -53
- package/src/common.js +86 -79
- package/src/core/fields/ID.js +6 -6
- package/src/core/fields/__closed.js +3 -3
- package/src/core/fields/__latest.js +3 -3
- package/src/core/fields/__version.js +3 -3
- package/src/core/fields/__versions.js +3 -3
- package/src/core/fields/_id.js +6 -6
- package/src/core/fields/active.js +9 -9
- package/src/core/fields/codeName.js +9 -9
- package/src/core/fields/createdAt.js +17 -17
- package/src/core/fields/default.js +9 -9
- package/src/core/fields/description.js +11 -11
- package/src/core/fields/email.js +9 -9
- package/src/core/fields/enabled.js +9 -9
- package/src/core/fields/expiredAt.js +16 -16
- package/src/core/fields/height.js +11 -11
- package/src/core/fields/ip.js +10 -10
- package/src/core/fields/objectId.js +10 -10
- package/src/core/fields/owner.js +13 -13
- package/src/core/fields/ownerModel.js +11 -11
- package/src/core/fields/price.js +11 -11
- package/src/core/fields/requiredObject.js +10 -10
- package/src/core/fields/session.js +10 -10
- package/src/core/fields/size.js +11 -11
- package/src/core/fields/telephone.js +9 -9
- package/src/core/fields/title.js +15 -15
- package/src/core/fields/updatedAt.js +17 -17
- package/src/core/fields/userId.js +11 -12
- package/src/core/fields/uuid.js +11 -11
- package/src/core/fields/validators/email.js +6 -4
- package/src/core/fields/validators/owner.js +6 -4
- package/src/core/fields/width.js +11 -11
- package/src/domain.js +435 -431
- package/src/env.js +23 -23
- package/src/error.js +20 -23
- package/src/exceptions/db.js +23 -0
- package/src/exceptions/http.js +43 -0
- package/src/fields/index.js +106 -111
- package/src/form/fabric.js +19 -24
- package/src/form/form.js +195 -186
- package/src/form/index.js +2 -2
- package/src/generic/index.js +2 -0
- package/src/generic/logic.js +595 -0
- package/src/generic/route.js +76 -0
- package/src/init/additional.js +7 -7
- package/src/init/app.js +75 -68
- package/src/init/bodyparser.js +14 -14
- package/src/init/compression.js +6 -7
- package/src/init/core.js +12 -12
- package/src/init/cors.js +22 -24
- package/src/init/db/index.js +41 -43
- package/src/init/db/ioredis.js +28 -20
- package/src/init/db/mongoose.js +42 -32
- package/src/init/db/redis.js +59 -48
- package/src/init/env.js +44 -36
- package/src/init/express.js +18 -21
- package/src/init/fileupload.js +8 -10
- package/src/init/http.js +65 -47
- package/src/init/index.js +141 -148
- package/src/init/informer.js +7 -9
- package/src/init/methodoverride.js +4 -6
- package/src/init/middleware.js +23 -26
- package/src/init/modules.js +4 -4
- package/src/init/monitoring.js +8 -8
- package/src/init/rateLimiter.js +53 -45
- package/src/init/routes.js +67 -69
- package/src/init/security.js +37 -33
- package/src/init/sequence.js +111 -107
- package/src/init/sequence.standart.js +54 -56
- package/src/init/sessions/index.js +21 -21
- package/src/init/sessions/mongoose.js +49 -36
- package/src/init/sessions/redis.js +28 -27
- package/src/init/static.js +53 -40
- package/src/init/template.js +17 -17
- package/src/lib.js +230 -200
- package/src/manifest/batchRunner.js +26 -25
- package/src/manifest/initializator/forms.js +24 -24
- package/src/manifest/initializator/index.js +8 -10
- package/src/manifest/initializator/manifests.js +45 -42
- package/src/manifest/initializator/models.js +37 -34
- package/src/manifest/manifest.filter.js +130 -97
- package/src/manifest/manifest.js +103 -77
- package/src/manifest/module.js +350 -360
- package/src/manifest/registrator/fields.js +90 -85
- package/src/manifest/registrator/forms.js +47 -47
- package/src/manifest/registrator/index.js +14 -16
- package/src/manifest/registrator/locales.js +17 -16
- package/src/manifest/registrator/logics.js +66 -64
- package/src/manifest/registrator/models.js +64 -62
- package/src/manifest/registrator/routes.js +171 -132
- package/src/manifest/registrator/routes.ws.js +109 -103
- package/src/manifest/route.js +216 -161
- package/src/model/buildValidator.js +53 -42
- package/src/model/default.js +304 -286
- package/src/model/enrich.js +69 -61
- package/src/model/increment.js +124 -137
- package/src/model/proto.js +179 -148
- package/src/model/routine.js +85 -76
- package/src/model/utils.js +33 -0
- package/src/model/versioning.js +148 -130
- package/src/obsolete.js +12 -8
- package/src/parser.js +29 -22
- package/src/repos.js +29 -31
- package/src/rollup.js +75 -65
- package/src/shell.helpers.js +28 -28
- package/static.js +31 -0
- package/src/generic/router.js +0 -16
- package/src/manifest/module.models.js +0 -0
- package/src/manifest/module.status.js +0 -0
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
const fs = require(
|
|
2
|
-
const path = require(
|
|
3
|
-
const logger = require(
|
|
4
|
-
const log = logger(module,
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const logger = require("not-log");
|
|
4
|
+
const log = logger(module, "registrator");
|
|
5
5
|
|
|
6
|
-
const {tryFile, mapBind} = require(
|
|
6
|
+
const { tryFile, mapBind } = require("../../common");
|
|
7
7
|
|
|
8
|
-
const notModuleRegistratorRoutesWS = require(
|
|
8
|
+
const notModuleRegistratorRoutesWS = require("./routes.ws");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Manifest files ending
|
|
12
12
|
* @constant
|
|
13
13
|
* @type {string}
|
|
14
14
|
*/
|
|
15
|
-
const DEFAULT_MANIFEST_FILE_ENDING =
|
|
15
|
+
const DEFAULT_MANIFEST_FILE_ENDING = ".manifest.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Routes collection files ending
|
|
19
19
|
* @constant
|
|
20
20
|
* @type {string}
|
|
21
21
|
*/
|
|
22
|
-
const DEFAULT_ROUTES_FILE_ENDING =
|
|
23
|
-
|
|
22
|
+
const DEFAULT_ROUTES_FILE_ENDING = ".js";
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* WS End-points collection files ending
|
|
27
26
|
* @constant
|
|
28
27
|
* @type {string}
|
|
29
28
|
*/
|
|
30
|
-
const DEFAULT_WS_ROUTES_FILE_ENDING =
|
|
29
|
+
const DEFAULT_WS_ROUTES_FILE_ENDING = ".ws.js";
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* List of methods to be binded from notApp to routes and WS end-points
|
|
@@ -35,139 +34,179 @@ const DEFAULT_WS_ROUTES_FILE_ENDING = '.ws.js';
|
|
|
35
34
|
* @type {string}
|
|
36
35
|
*/
|
|
37
36
|
const ROUTE_BINDINGS_LIST = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
"getLogic",
|
|
38
|
+
"getLogicFile",
|
|
39
|
+
"getModel",
|
|
40
|
+
"getModelFile",
|
|
41
|
+
"getModelSchema",
|
|
42
|
+
"getModule",
|
|
41
43
|
];
|
|
42
44
|
|
|
45
|
+
module.exports = class notModuleRegistratorRoutes {
|
|
46
|
+
static openFile = require;
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
constructor({ nModule }) {
|
|
49
|
+
this.run({ nModule });
|
|
50
|
+
}
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
run({ nModule }) {
|
|
53
|
+
const srcDir = notModuleRegistratorRoutes.getPath(nModule);
|
|
54
|
+
if (!srcDir) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
this.findAll({
|
|
58
|
+
nModule,
|
|
59
|
+
srcDir,
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!srcDir) { return false; }
|
|
54
|
-
this.findAll(
|
|
55
|
-
{
|
|
56
|
-
nModule,
|
|
57
|
-
srcDir
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
static getPath(nModule){
|
|
64
|
-
return nModule.module.paths.routes;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Searching fields in directory
|
|
69
|
-
* @static
|
|
70
|
-
* @param {Object} input
|
|
71
|
-
* @param {notModule} input.notModule
|
|
72
|
-
* @param {string} input.srcDir
|
|
73
|
-
**/
|
|
74
|
-
findAll({nModule,srcDir}){
|
|
75
|
-
fs.readdirSync(srcDir).forEach(file => this.findOne({nModule, file, srcDir}));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
findOne({nModule, srcDir, file}){
|
|
79
|
-
try {
|
|
80
|
-
//если имя похоже на название манифеста
|
|
81
|
-
if (file.indexOf(DEFAULT_MANIFEST_FILE_ENDING) === -1) { return false; }
|
|
82
|
-
const routeManifest = notModuleRegistratorRoutes.tryRouteManifestFile({srcDir, file});
|
|
83
|
-
//без манифеста ничего выставить наружу не выйдет
|
|
84
|
-
if(!routeManifest){ return false; }
|
|
85
|
-
const routeBasename = file.substr(0, file.indexOf(DEFAULT_MANIFEST_FILE_ENDING));
|
|
86
|
-
//ищем end-points
|
|
87
|
-
const route = notModuleRegistratorRoutes.tryRouteFile({srcDir, routeBasename});
|
|
88
|
-
const wsRoute = notModuleRegistratorRoutes.tryWSRouteFile({srcDir, routeBasename});
|
|
89
|
-
if(!route && !wsRoute){ return false; }
|
|
90
|
-
this.registerManifestAndRoutes({
|
|
91
|
-
nModule,
|
|
92
|
-
routeManifest,
|
|
93
|
-
routeName: route?route.thisRouteName:routeBasename,
|
|
94
|
-
route, wsRoute
|
|
95
|
-
});
|
|
96
|
-
return true;
|
|
97
|
-
} catch (e) {
|
|
98
|
-
log.error(e);
|
|
99
|
-
return false;
|
|
64
|
+
static getPath(nModule) {
|
|
65
|
+
return nModule.module.paths.routes;
|
|
100
66
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return false;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Searching fields in directory
|
|
70
|
+
* @static
|
|
71
|
+
* @param {Object} input
|
|
72
|
+
* @param {notModule} input.notModule
|
|
73
|
+
* @param {string} input.srcDir
|
|
74
|
+
**/
|
|
75
|
+
findAll({ nModule, srcDir }) {
|
|
76
|
+
fs.readdirSync(srcDir).forEach((file) =>
|
|
77
|
+
this.findOne({ nModule, file, srcDir })
|
|
78
|
+
);
|
|
114
79
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
80
|
+
|
|
81
|
+
findOne({ nModule, srcDir, file }) {
|
|
82
|
+
try {
|
|
83
|
+
//если имя похоже на название манифеста
|
|
84
|
+
if (file.indexOf(DEFAULT_MANIFEST_FILE_ENDING) === -1) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const routeManifest =
|
|
88
|
+
notModuleRegistratorRoutes.tryRouteManifestFile({
|
|
89
|
+
srcDir,
|
|
90
|
+
file,
|
|
91
|
+
});
|
|
92
|
+
//без манифеста ничего выставить наружу не выйдет
|
|
93
|
+
if (!routeManifest) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
const routeBasename = file.substr(
|
|
97
|
+
0,
|
|
98
|
+
file.indexOf(DEFAULT_MANIFEST_FILE_ENDING)
|
|
99
|
+
);
|
|
100
|
+
//ищем end-points
|
|
101
|
+
const route = notModuleRegistratorRoutes.tryRouteFile({
|
|
102
|
+
srcDir,
|
|
103
|
+
routeBasename,
|
|
104
|
+
});
|
|
105
|
+
const wsRoute = notModuleRegistratorRoutes.tryWSRouteFile({
|
|
106
|
+
srcDir,
|
|
107
|
+
routeBasename,
|
|
108
|
+
});
|
|
109
|
+
if (!route && !wsRoute) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
this.registerManifestAndRoutes({
|
|
113
|
+
nModule,
|
|
114
|
+
routeManifest,
|
|
115
|
+
routeName: route ? route.thisRouteName : routeBasename,
|
|
116
|
+
route,
|
|
117
|
+
wsRoute,
|
|
118
|
+
});
|
|
119
|
+
return true;
|
|
120
|
+
} catch (e) {
|
|
121
|
+
log.error(e);
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
|
|
126
|
+
static tryRouteFile({ srcDir, routeBasename }) {
|
|
127
|
+
const routePath = path.join(
|
|
128
|
+
srcDir,
|
|
129
|
+
routeBasename + DEFAULT_ROUTES_FILE_ENDING
|
|
130
|
+
);
|
|
131
|
+
if (tryFile(routePath)) {
|
|
132
|
+
const route = notModuleRegistratorRoutes.openFile(routePath);
|
|
133
|
+
route.filename = routePath;
|
|
134
|
+
if (!route.thisRouteName) {
|
|
135
|
+
route.thisRouteName = routeBasename;
|
|
136
|
+
}
|
|
137
|
+
return route;
|
|
138
|
+
} else {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
|
|
143
|
+
static tryRouteManifestFile({ srcDir, file }) {
|
|
144
|
+
const routeManifestPath = path.join(srcDir, file);
|
|
145
|
+
if (tryFile(routeManifestPath)) {
|
|
146
|
+
return notModuleRegistratorRoutes.openFile(routeManifestPath);
|
|
147
|
+
} else {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
146
150
|
}
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
|
|
152
|
+
static tryWSRouteFile({ srcDir, routeBasename }) {
|
|
153
|
+
const routeWSPath = path.join(
|
|
154
|
+
srcDir,
|
|
155
|
+
routeBasename + DEFAULT_WS_ROUTES_FILE_ENDING
|
|
156
|
+
);
|
|
157
|
+
if (tryFile(routeWSPath)) {
|
|
158
|
+
const wsRoute = notModuleRegistratorRoutes.openFile(routeWSPath);
|
|
159
|
+
if (!wsRoute.thisRouteName) {
|
|
160
|
+
wsRoute.thisRouteName = routeBasename;
|
|
161
|
+
}
|
|
162
|
+
return wsRoute;
|
|
163
|
+
} else {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
registerManifestAndRoutes({
|
|
169
|
+
nModule,
|
|
170
|
+
routeName,
|
|
171
|
+
routeManifest,
|
|
172
|
+
route,
|
|
173
|
+
wsRoute,
|
|
174
|
+
}) {
|
|
175
|
+
notModuleRegistratorRoutes.registerManifest({
|
|
176
|
+
nModule,
|
|
177
|
+
routeManifest,
|
|
178
|
+
routeName,
|
|
179
|
+
});
|
|
180
|
+
if (route) {
|
|
181
|
+
this.registerRoute({
|
|
182
|
+
nModule,
|
|
183
|
+
route,
|
|
184
|
+
routeName: route.thisRouteName,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (wsRoute) {
|
|
188
|
+
this.registerWSRoute({ nModule, wsRoute });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
registerRoute({ nModule, route, routeName }) {
|
|
193
|
+
nModule.setRoute(route.thisRouteName, route);
|
|
194
|
+
if (nModule.appIsSet()) {
|
|
195
|
+
mapBind(nModule.getApp(), route, ROUTE_BINDINGS_LIST);
|
|
196
|
+
}
|
|
197
|
+
route.log = logger(route, `Route#${routeName}`);
|
|
198
|
+
route.getThisModule = () => nModule;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
registerWSRoute({ nModule, wsRoute }) {
|
|
202
|
+
new notModuleRegistratorRoutesWS({
|
|
203
|
+
nModule,
|
|
204
|
+
wsRoute: wsRoute,
|
|
205
|
+
wsRouteName: wsRoute.thisRouteName,
|
|
206
|
+
});
|
|
149
207
|
}
|
|
150
|
-
}
|
|
151
208
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (nModule.appIsSet()) {
|
|
155
|
-
mapBind(nModule.getApp(), route, ROUTE_BINDINGS_LIST);
|
|
209
|
+
static registerManifest({ nModule, routeManifest, routeName }) {
|
|
210
|
+
nModule.setManifest(routeName, routeManifest);
|
|
156
211
|
}
|
|
157
|
-
route.log = logger(route, `Route#${routeName}`);
|
|
158
|
-
route.getThisModule = () => nModule;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
registerWSRoute({nModule, wsRoute}){
|
|
163
|
-
new notModuleRegistratorRoutesWS({
|
|
164
|
-
nModule,
|
|
165
|
-
wsRoute: wsRoute,
|
|
166
|
-
wsRouteName: wsRoute.thisRouteName
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
static registerManifest({nModule, routeManifest, routeName}) {
|
|
171
|
-
nModule.setManifest(routeName, routeManifest);
|
|
172
|
-
}
|
|
173
212
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {mapBind, objHas} = require(
|
|
1
|
+
const { mapBind, objHas } = require("../../common");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* List of methods to be binded from notApp to routes and WS end-points
|
|
@@ -6,122 +6,128 @@ const {mapBind, objHas} = require('../../common');
|
|
|
6
6
|
* @type {string}
|
|
7
7
|
*/
|
|
8
8
|
const WS_ROUTE_BINDINGS_LIST = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"getLogic",
|
|
10
|
+
"getLogicFile",
|
|
11
|
+
"getModel",
|
|
12
|
+
"getModelFile",
|
|
13
|
+
"getModelSchema",
|
|
14
|
+
"getModule",
|
|
12
15
|
];
|
|
13
16
|
|
|
14
|
-
module.exports = class notModuleRegistratorRoutesWS{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
wsRoute,
|
|
23
|
-
wsRouteName
|
|
24
|
-
});
|
|
25
|
-
}
|
|
17
|
+
module.exports = class notModuleRegistratorRoutesWS {
|
|
18
|
+
constructor({ nModule, wsRoute, wsRouteName }) {
|
|
19
|
+
this.run({
|
|
20
|
+
nModule,
|
|
21
|
+
wsRoute,
|
|
22
|
+
wsRouteName,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
this.registerServers(input);
|
|
39
|
-
this.registerClients(input);
|
|
26
|
+
run({ nModule, wsRoute, wsRouteName }) {
|
|
27
|
+
if (nModule.appIsSet()) {
|
|
28
|
+
const input = {
|
|
29
|
+
nModule,
|
|
30
|
+
wsRoute,
|
|
31
|
+
wsRouteName,
|
|
32
|
+
};
|
|
33
|
+
this.registerServers(input);
|
|
34
|
+
this.registerClients(input);
|
|
35
|
+
}
|
|
40
36
|
}
|
|
41
|
-
}
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
registerServers(input) {
|
|
39
|
+
this.registerCollectionType({
|
|
40
|
+
...input,
|
|
41
|
+
collectionType: "servers",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
registerClients(input) {
|
|
46
|
+
this.registerCollectionType({
|
|
47
|
+
...input,
|
|
48
|
+
collectionType: "clients",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
registerCollectionType({ nModule, wsRoute, wsRouteName, collectionType }) {
|
|
53
|
+
if (!objHas(wsRoute, collectionType)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
Object.keys(wsRoute[collectionType]).forEach((collectionName) =>
|
|
57
|
+
this.registerCollectionItem({
|
|
58
|
+
nModule,
|
|
59
|
+
wsRoute,
|
|
60
|
+
wsRouteName,
|
|
61
|
+
collectionType,
|
|
62
|
+
collectionName,
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
68
|
+
registerCollectionItem({
|
|
69
|
+
nModule,
|
|
70
|
+
wsRoute,
|
|
71
|
+
wsRouteName,
|
|
72
|
+
collectionType,
|
|
73
|
+
collectionName,
|
|
74
|
+
}) {
|
|
75
|
+
const collection = wsRoute[collectionType][collectionName];
|
|
76
|
+
mapBind(nModule.getApp(), collection, WS_ROUTE_BINDINGS_LIST);
|
|
77
|
+
this.registerEndPoints({
|
|
78
|
+
nModule,
|
|
79
|
+
wsRoute,
|
|
80
|
+
wsRouteName,
|
|
81
|
+
collectionType,
|
|
82
|
+
collectionName,
|
|
83
|
+
collection,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
+
registerEndPoints({
|
|
88
|
+
nModule,
|
|
89
|
+
wsRouteName,
|
|
90
|
+
collectionType,
|
|
91
|
+
collectionName,
|
|
92
|
+
collection,
|
|
93
|
+
}) {
|
|
94
|
+
Object.keys(collection).forEach((endPointType) => {
|
|
95
|
+
const endPoints = collection[endPointType];
|
|
96
|
+
//creating deep object structure if not exists
|
|
97
|
+
nModule.createEmptyIfNotExistsRouteWSType({
|
|
98
|
+
collectionType,
|
|
99
|
+
collectionName,
|
|
100
|
+
endPointType,
|
|
101
|
+
});
|
|
102
|
+
//
|
|
103
|
+
notModuleRegistratorRoutesWS.addEntityEndPointsOfType({
|
|
104
|
+
nModule,
|
|
105
|
+
endPoints,
|
|
106
|
+
collectionType,
|
|
107
|
+
collectionName,
|
|
108
|
+
endPointType,
|
|
109
|
+
wsRouteName,
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
87
113
|
|
|
88
|
-
|
|
89
|
-
nModule,
|
|
90
|
-
wsRouteName,
|
|
91
|
-
collectionType, collectionName, collection
|
|
92
|
-
}){
|
|
93
|
-
Object.keys(collection).forEach((endPointType) => {
|
|
94
|
-
const endPoints = collection[endPointType];
|
|
95
|
-
//creating deep object structure if not exists
|
|
96
|
-
nModule.createEmptyIfNotExistsRouteWSType({
|
|
97
|
-
collectionType, collectionName, endPointType
|
|
98
|
-
});
|
|
99
|
-
//
|
|
100
|
-
notModuleRegistratorRoutesWS.addEntityEndPointsOfType({
|
|
114
|
+
static addEntityEndPointsOfType({
|
|
101
115
|
nModule,
|
|
102
116
|
endPoints,
|
|
103
|
-
collectionType, collectionName,
|
|
104
|
-
endPointType, wsRouteName
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
static addEntityEndPointsOfType({
|
|
110
|
-
nModule,
|
|
111
|
-
endPoints,
|
|
112
|
-
collectionType, collectionName,
|
|
113
|
-
endPointType, wsRouteName
|
|
114
|
-
}){
|
|
115
|
-
Object.keys(endPoints).forEach((endPointName) => {
|
|
116
|
-
nModule.setRouteWS({
|
|
117
117
|
collectionType,
|
|
118
118
|
collectionName,
|
|
119
119
|
endPointType,
|
|
120
120
|
wsRouteName,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
}) {
|
|
122
|
+
Object.keys(endPoints).forEach((endPointName) => {
|
|
123
|
+
nModule.setRouteWS({
|
|
124
|
+
collectionType,
|
|
125
|
+
collectionName,
|
|
126
|
+
endPointType,
|
|
127
|
+
wsRouteName,
|
|
128
|
+
action: endPointName,
|
|
129
|
+
func: endPoints[endPointName],
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
127
133
|
};
|