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.
Files changed (126) hide show
  1. package/.eslintrc.json +1 -1
  2. package/bin/not-deploy.js +52 -0
  3. package/index.js +21 -19
  4. package/package.json +1 -1
  5. package/src/app.js +61 -58
  6. package/src/auth/abstract.js +17 -19
  7. package/src/auth/const.js +8 -12
  8. package/src/auth/fields.js +143 -124
  9. package/src/auth/index.js +14 -14
  10. package/src/auth/roles.js +64 -63
  11. package/src/auth/routes.js +89 -54
  12. package/src/auth/rules.js +63 -63
  13. package/src/auth/session.js +60 -62
  14. package/src/bootstrap/form.js +13 -13
  15. package/src/bootstrap/logic.js +45 -41
  16. package/src/bootstrap/model.js +14 -17
  17. package/src/bootstrap/route.js +132 -53
  18. package/src/common.js +86 -79
  19. package/src/core/fields/ID.js +6 -6
  20. package/src/core/fields/__closed.js +3 -3
  21. package/src/core/fields/__latest.js +3 -3
  22. package/src/core/fields/__version.js +3 -3
  23. package/src/core/fields/__versions.js +3 -3
  24. package/src/core/fields/_id.js +6 -6
  25. package/src/core/fields/active.js +9 -9
  26. package/src/core/fields/codeName.js +9 -9
  27. package/src/core/fields/createdAt.js +17 -17
  28. package/src/core/fields/default.js +9 -9
  29. package/src/core/fields/description.js +11 -11
  30. package/src/core/fields/email.js +9 -9
  31. package/src/core/fields/enabled.js +9 -9
  32. package/src/core/fields/expiredAt.js +16 -16
  33. package/src/core/fields/height.js +11 -11
  34. package/src/core/fields/ip.js +10 -10
  35. package/src/core/fields/objectId.js +10 -10
  36. package/src/core/fields/owner.js +13 -13
  37. package/src/core/fields/ownerModel.js +11 -11
  38. package/src/core/fields/price.js +11 -11
  39. package/src/core/fields/requiredObject.js +10 -10
  40. package/src/core/fields/session.js +10 -10
  41. package/src/core/fields/size.js +11 -11
  42. package/src/core/fields/telephone.js +9 -9
  43. package/src/core/fields/title.js +15 -15
  44. package/src/core/fields/updatedAt.js +17 -17
  45. package/src/core/fields/userId.js +11 -12
  46. package/src/core/fields/uuid.js +11 -11
  47. package/src/core/fields/validators/email.js +6 -4
  48. package/src/core/fields/validators/owner.js +6 -4
  49. package/src/core/fields/width.js +11 -11
  50. package/src/domain.js +435 -431
  51. package/src/env.js +23 -23
  52. package/src/error.js +20 -23
  53. package/src/exceptions/db.js +23 -0
  54. package/src/exceptions/http.js +43 -0
  55. package/src/fields/index.js +106 -111
  56. package/src/form/fabric.js +19 -24
  57. package/src/form/form.js +195 -186
  58. package/src/form/index.js +2 -2
  59. package/src/generic/index.js +2 -0
  60. package/src/generic/logic.js +595 -0
  61. package/src/generic/route.js +76 -0
  62. package/src/init/additional.js +7 -7
  63. package/src/init/app.js +75 -68
  64. package/src/init/bodyparser.js +14 -14
  65. package/src/init/compression.js +6 -7
  66. package/src/init/core.js +12 -12
  67. package/src/init/cors.js +22 -24
  68. package/src/init/db/index.js +41 -43
  69. package/src/init/db/ioredis.js +28 -20
  70. package/src/init/db/mongoose.js +42 -32
  71. package/src/init/db/redis.js +59 -48
  72. package/src/init/env.js +44 -36
  73. package/src/init/express.js +18 -21
  74. package/src/init/fileupload.js +8 -10
  75. package/src/init/http.js +65 -47
  76. package/src/init/index.js +141 -148
  77. package/src/init/informer.js +7 -9
  78. package/src/init/methodoverride.js +4 -6
  79. package/src/init/middleware.js +23 -26
  80. package/src/init/modules.js +4 -4
  81. package/src/init/monitoring.js +8 -8
  82. package/src/init/rateLimiter.js +53 -45
  83. package/src/init/routes.js +67 -69
  84. package/src/init/security.js +37 -33
  85. package/src/init/sequence.js +111 -107
  86. package/src/init/sequence.standart.js +54 -56
  87. package/src/init/sessions/index.js +21 -21
  88. package/src/init/sessions/mongoose.js +49 -36
  89. package/src/init/sessions/redis.js +28 -27
  90. package/src/init/static.js +53 -40
  91. package/src/init/template.js +17 -17
  92. package/src/lib.js +230 -200
  93. package/src/manifest/batchRunner.js +26 -25
  94. package/src/manifest/initializator/forms.js +24 -24
  95. package/src/manifest/initializator/index.js +8 -10
  96. package/src/manifest/initializator/manifests.js +45 -42
  97. package/src/manifest/initializator/models.js +37 -34
  98. package/src/manifest/manifest.filter.js +130 -97
  99. package/src/manifest/manifest.js +103 -77
  100. package/src/manifest/module.js +350 -360
  101. package/src/manifest/registrator/fields.js +90 -85
  102. package/src/manifest/registrator/forms.js +47 -47
  103. package/src/manifest/registrator/index.js +14 -16
  104. package/src/manifest/registrator/locales.js +17 -16
  105. package/src/manifest/registrator/logics.js +66 -64
  106. package/src/manifest/registrator/models.js +64 -62
  107. package/src/manifest/registrator/routes.js +171 -132
  108. package/src/manifest/registrator/routes.ws.js +109 -103
  109. package/src/manifest/route.js +216 -161
  110. package/src/model/buildValidator.js +53 -42
  111. package/src/model/default.js +304 -286
  112. package/src/model/enrich.js +69 -61
  113. package/src/model/increment.js +124 -137
  114. package/src/model/proto.js +179 -148
  115. package/src/model/routine.js +85 -76
  116. package/src/model/utils.js +33 -0
  117. package/src/model/versioning.js +148 -130
  118. package/src/obsolete.js +12 -8
  119. package/src/parser.js +29 -22
  120. package/src/repos.js +29 -31
  121. package/src/rollup.js +75 -65
  122. package/src/shell.helpers.js +28 -28
  123. package/static.js +31 -0
  124. package/src/generic/router.js +0 -16
  125. package/src/manifest/module.models.js +0 -0
  126. package/src/manifest/module.status.js +0 -0
@@ -1,33 +1,26 @@
1
1
  //importing modules
2
- const
3
- fs = require('fs'),
4
- Auth = require('../auth'),
5
- logger = require('not-log'),
6
- log = logger(module, 'notModule'),
7
- notManifest = require('./manifest.js'),
8
- notModuleRegistrator = require('./registrator'),
9
- notModuleInitializator = require('./initializator'),
10
- {objHas, mapBind, isAsync, isFunc} = require('../common');
11
-
2
+ const fs = require("fs"),
3
+ Auth = require("../auth"),
4
+ logger = require("not-log"),
5
+ log = logger(module, "notModule"),
6
+ notManifest = require("./manifest.js"),
7
+ notModuleRegistrator = require("./registrator"),
8
+ notModuleInitializator = require("./initializator"),
9
+ { objHas, mapBind, isAsync, isFunc } = require("../common");
12
10
 
13
11
  /**
14
12
  * Standart splitter of module resources paths
15
13
  * @constant
16
14
  * @type {string}
17
15
  */
18
- const DEFAULT_WS_ROUTE_ACTION_SPLITTER = '//';
19
-
16
+ const DEFAULT_WS_ROUTE_ACTION_SPLITTER = "//";
20
17
 
21
18
  /**
22
19
  * List of methods to be binded from notApp to notModule
23
20
  * @constant
24
21
  * @type {string}
25
22
  */
26
- const MODULE_BINDINGS_LIST = [
27
- 'getModel',
28
- 'getModelSchema',
29
- 'getModelFile'
30
- ];
23
+ const MODULE_BINDINGS_LIST = ["getModel", "getModelSchema", "getModelFile"];
31
24
  /**
32
25
  * Module representation
33
26
  * @class
@@ -36,353 +29,350 @@ const MODULE_BINDINGS_LIST = [
36
29
  * @param {Object} options.modObject loaded module object
37
30
  **/
38
31
  class notModule {
39
- constructor(options) {
40
- this.path = options.modPath;
41
- this.module = options.modObject;
42
- this.mongoose = options.mongoose;
43
- this.notApp = options.notApp;
44
- this.routes = {};
45
- this.routesWS = {
46
- servers: {},
47
- clients: {},
48
- };
49
- this.models = {};
50
- this.logics = {};
51
- this.forms = {};
52
- this.formsConstructors = {};
53
- this.fields = {};
54
- this.manifests = {};
55
- this.faulty = false;
56
- this.paths = {
57
- routes: {},
58
- models: {}
59
- };
60
- this.fieldsImportRules = (objHas(options, 'fields') && options.fields) ? options.fields : {};
61
-
62
- // log.info(`Creating module: ${this.getName()}`);
63
- this.init();
64
- return this;
65
- }
66
-
67
-
68
- init() {
69
- if (this.path) {
70
- this.initFromPath(this.path);
71
- } else if (this.module) {
72
- this.initFromModule(this.module);
73
- }else{
74
- return false;
75
- }
76
- if (this.module === null || typeof this.module === 'undefined') {
77
- log.error(`Module ${this.path} not loaded`);
78
- } else if(this.appIsSet()) {
79
- mapBind(this.notApp, this.module, MODULE_BINDINGS_LIST);
80
- }
81
- }
82
-
83
- initFromPath(modulePath) {
84
- try {
85
- if (fs.lstatSync(modulePath).isDirectory()) {
86
- this.module = require(modulePath);
87
- this.registerContent();
88
- }else{
89
- return false;
90
- }
91
- } catch (e) {
92
- this.faulty = true;
93
- log.error(e);
94
- }
95
- }
96
-
97
- initFromModule() {
98
- try {
99
- this.registerContent();
100
- } catch (e) {
101
- this.faulty = true;
102
- log.error(e);
103
- }
104
- }
105
-
106
- registerContent(){
107
- notModuleRegistrator.exec({nModule: this});
108
- }
109
-
110
- getEndPoints() {
111
- return this.routesWS;
112
- }
113
-
114
- getManifest({
115
- auth,
116
- role,
117
- root
118
- } = {
119
- auth: false,
120
- role: Auth.DEFAULT_USER_ROLE_FOR_GUEST,
121
- root: false
122
- }) {
123
- return this.manifest.filterManifest(
124
- this.manifests,
125
- auth,
126
- role,
127
- root
128
- );
129
- }
130
-
131
- getRouteManifest(name){
132
- return this.manifests[name];
133
- }
134
-
135
- getRoutesManifests(){
136
- return this.manifests;
137
- }
138
-
139
- getModelFile(modelName) {
140
- if (this.models && objHas(this.models, modelName)) {
141
- return this.models[modelName];
142
- } else {
143
- return null;
144
- }
145
- }
146
-
147
- getModel(modelName) {
148
- let modelFile = this.getModelFile(modelName);
149
- if (modelFile && (modelName in modelFile)) {
150
- return modelFile[modelName];
151
- } else {
152
- return null;
153
- }
154
- }
155
-
156
- getModels(){
157
- return this.models;
158
- }
159
-
160
- getLogicFile(logicName) {
161
- if (this.logics && objHas(this.logics, logicName)) {
162
- return this.logics[logicName];
163
- } else {
164
- return null;
165
- }
166
- }
167
-
168
- getLogic(logicName) {
169
- let logicFile = this.getLogicFile(logicName);
170
- if (logicFile && (logicName in logicFile)) {
171
- return logicFile[logicName];
172
- } else {
173
- return null;
174
- }
175
- }
176
-
177
- getModelSchema(modelName) {
178
- let modelFile = this.getModelFile(modelName);
179
- if (modelFile && objHas(modelFile, modelName) && modelFile.thisSchema) {
180
- return modelFile.thisSchema;
181
- }
182
- return null;
183
- }
184
-
185
- expose(expressApp, moduleName) {
186
- if (this.manifests && expressApp) {
187
- notModuleInitializator.exec({nModule: this});
188
- this.initManifest(expressApp, moduleName);
189
- this.manifest.registerRoutes(this.manifests);
190
- }
191
- }
192
-
193
- initManifest(expressApp, moduleName){
194
- this.manifest = new notManifest(expressApp, this.notApp, moduleName);
195
- }
196
-
197
- async exec(methodName) {
198
- if (!this.module) {
199
- log.error(`Cant exec ${methodName} in module ${this.path}, module not loaded`);
200
- return false;
201
- }
202
- if ((objHas(this.module, methodName)) && (isFunc(this.module[methodName]))) {
203
- try {
204
- if (isAsync(this.module[methodName])) {
205
- await this.module[methodName](this.notApp);
32
+ constructor(options) {
33
+ this.path = options.modPath;
34
+ this.module = options.modObject;
35
+ this.mongoose = options.mongoose;
36
+ this.notApp = options.notApp;
37
+ this.routes = {};
38
+ this.routesWS = {
39
+ servers: {},
40
+ clients: {},
41
+ };
42
+ this.models = {};
43
+ this.logics = {};
44
+ this.forms = {};
45
+ this.formsConstructors = {};
46
+ this.fields = {};
47
+ this.manifests = {};
48
+ this.faulty = false;
49
+ this.paths = {
50
+ routes: {},
51
+ models: {},
52
+ };
53
+ this.fieldsImportRules =
54
+ objHas(options, "fields") && options.fields ? options.fields : {};
55
+
56
+ // log.info(`Creating module: ${this.getName()}`);
57
+ this.init();
58
+ return this;
59
+ }
60
+
61
+ init() {
62
+ if (this.path) {
63
+ this.initFromPath(this.path);
64
+ } else if (this.module) {
65
+ this.initFromModule(this.module);
206
66
  } else {
207
- this.module[methodName](this.notApp);
67
+ return false;
68
+ }
69
+ if (this.module === null || typeof this.module === "undefined") {
70
+ log.error(`Module ${this.path} not loaded`);
71
+ } else if (this.appIsSet()) {
72
+ mapBind(this.notApp, this.module, MODULE_BINDINGS_LIST);
73
+ }
74
+ }
75
+
76
+ initFromPath(modulePath) {
77
+ try {
78
+ if (fs.lstatSync(modulePath).isDirectory()) {
79
+ this.module = require(modulePath);
80
+ this.registerContent();
81
+ } else {
82
+ return false;
83
+ }
84
+ } catch (e) {
85
+ this.faulty = true;
86
+ log.error(e);
208
87
  }
209
- return true;
210
- } catch (e) {
211
- log.error(e);
212
- return false;
213
- }
214
- }else{
215
- return false;
216
- }
217
- }
218
-
219
- getStatus() {
220
- const formsList = Object.keys(this.forms);
221
- const modelsList = Object.keys(this.models);
222
- const routesList = Object.keys(this.routes);
223
- const actionsList = this.getActionsList();
224
- return {
225
- forms: {
226
- count: formsList.length,
227
- list: formsList
228
- },
229
- models: {
230
- count: modelsList.length,
231
- list: modelsList,
232
- content: this.getModelsStatuses()
233
- },
234
- routes: {
235
- count: routesList.length,
236
- list: routesList,
237
- content: this.getRoutesStatuses()
238
- },
239
- actions: {
240
- count: actionsList.length,
241
- list: actionsList
242
- }
243
- };
244
- }
245
-
246
- getActionsList() {
247
- let list = [];
248
- for (let route in this.manifests) {
249
- if (this.manifests[route] && this.manifests[route].actions) {
250
- for (let action in this.manifests[route].actions) {
251
- list.push(`${route}//${action}`);
88
+ }
89
+
90
+ initFromModule() {
91
+ try {
92
+ this.registerContent();
93
+ } catch (e) {
94
+ this.faulty = true;
95
+ log.error(e);
252
96
  }
253
- }
254
- }
255
- return list;
256
- }
257
-
258
- getRoutesStatuses() {
259
- let result = {};
260
- for (let route in this.manifests) {
261
- if (this.manifests[route] && this.manifests[route].actions) {
262
- result[route] = this.manifests[route].actions;
263
- }
264
- }
265
- return result;
266
- }
267
-
268
- getModelsStatuses() {
269
- let content = {};
270
- Object.keys(this.models).forEach((name) => {
271
- content[name] = this.getModelSchema(name);
272
- });
273
- return content;
274
- }
275
-
276
- setManifest(key, val){
277
- this.manifests[key] = val;
278
- }
279
-
280
- getForm(key) {
281
- return this.forms[key];
282
- }
283
-
284
- setForm(key, val) {
285
- this.forms[key] = val;
286
- }
287
-
288
- getFormConstructor(key) {
289
- return this.formsConstructors[key];
290
- }
291
-
292
- setFormConstructor(key, val) {
293
- this.formsConstructors[key] = val;
294
- }
295
-
296
- getFormsConstructors(){
297
- return this.formsConstructors;
298
- }
299
-
300
- getField(key) {
301
- return this.fields[key];
302
- }
303
-
304
- setField(key, val) {
305
- this.fields[key] = val;
306
- }
307
-
308
- setModel(key, val){
309
- this.models[key] = val;
310
- }
311
-
312
- setRoute(key, val){
313
- this.routes[key] = val;
314
- }
315
-
316
- setLogic(key, val){
317
- this.logics[key] = val;
318
- }
319
-
320
- getRoute(routeName) {
321
- if (this.routes && objHas(this.routes, routeName)) {
322
- return this.routes[routeName];
323
- } else {
324
- return null;
325
- }
326
- }
327
-
328
- getRoutes(){
329
- return this.routes;
330
- }
331
-
332
- appIsSet(){
333
- return typeof this.notApp !== 'undefined';
334
- }
335
-
336
- getApp(){
337
- return this.notApp;
338
- }
339
-
340
- getName(){
341
- if(this.module && this.module.name){
342
- return this.module.name;
343
- }
344
- return this.path;
345
- }
346
-
347
- getOptions(){
348
- return (this.module && this.module.options)?this.module.options:{};
349
- }
350
-
351
- setRouteWS({
352
- collectionType,
353
- collectionName,
354
- endPointType,
355
- wsRouteName,
356
- action,
357
- func
358
- }) {
359
- //servers/client
360
- const collection = this.routesWS[collectionType];
361
- //concrete client or server
362
- const wsConnection = collection[collectionName];
363
- //request, event, response etc
364
- const endPoints = wsConnection[endPointType];
365
- //endPoint name
366
- const endPointName = `${wsRouteName}${DEFAULT_WS_ROUTE_ACTION_SPLITTER}${action}`;
367
- //finally assigning function
368
- endPoints[endPointName] = func;
369
- }
370
-
371
- createEmptyIfNotExistsRouteWSType(
372
- {
373
- collectionType, //client, server
374
- collectionName, //concrete client/server name
375
- endPointType //request,event,response, etc
376
- }
377
- ) {
378
- if (!objHas(this.routesWS[collectionType], collectionName)) {
379
- this.routesWS[collectionType][collectionName] = {};
380
- }
381
- if (!objHas(this.routesWS[collectionType][collectionName], endPointType)) {
382
- this.routesWS[collectionType][collectionName][endPointType] = {};
383
- }
384
- }
97
+ }
98
+
99
+ registerContent() {
100
+ notModuleRegistrator.exec({ nModule: this });
101
+ }
102
+
103
+ getEndPoints() {
104
+ return this.routesWS;
105
+ }
106
+
107
+ getManifest(
108
+ { auth, role, root } = {
109
+ auth: false,
110
+ role: Auth.DEFAULT_USER_ROLE_FOR_GUEST,
111
+ root: false,
112
+ }
113
+ ) {
114
+ return this.manifest.filterManifest(this.manifests, auth, role, root);
115
+ }
116
+
117
+ getRouteManifest(name) {
118
+ return this.manifests[name];
119
+ }
120
+
121
+ getRoutesManifests() {
122
+ return this.manifests;
123
+ }
124
+
125
+ getModelFile(modelName) {
126
+ if (this.models && objHas(this.models, modelName)) {
127
+ return this.models[modelName];
128
+ } else {
129
+ return null;
130
+ }
131
+ }
132
+
133
+ getModel(modelName) {
134
+ let modelFile = this.getModelFile(modelName);
135
+ if (modelFile && modelName in modelFile) {
136
+ return modelFile[modelName];
137
+ } else {
138
+ return null;
139
+ }
140
+ }
141
+
142
+ getModels() {
143
+ return this.models;
144
+ }
145
+
146
+ getLogicFile(logicName) {
147
+ if (this.logics && objHas(this.logics, logicName)) {
148
+ return this.logics[logicName];
149
+ } else {
150
+ return null;
151
+ }
152
+ }
153
+
154
+ getLogic(logicName) {
155
+ let logicFile = this.getLogicFile(logicName);
156
+ if (logicFile && logicName in logicFile) {
157
+ return logicFile[logicName];
158
+ } else {
159
+ return null;
160
+ }
161
+ }
162
+
163
+ getModelSchema(modelName) {
164
+ let modelFile = this.getModelFile(modelName);
165
+ if (modelFile && objHas(modelFile, modelName) && modelFile.thisSchema) {
166
+ return modelFile.thisSchema;
167
+ }
168
+ return null;
169
+ }
170
+
171
+ expose(expressApp, moduleName) {
172
+ if (this.manifests && expressApp) {
173
+ notModuleInitializator.exec({ nModule: this });
174
+ this.initManifest(expressApp, moduleName);
175
+ this.manifest.registerRoutes(this.manifests);
176
+ }
177
+ }
178
+
179
+ initManifest(expressApp, moduleName) {
180
+ this.manifest = new notManifest(expressApp, this.notApp, moduleName);
181
+ }
182
+
183
+ async exec(methodName) {
184
+ if (!this.module) {
185
+ log.error(
186
+ `Cant exec ${methodName} in module ${this.path}, module not loaded`
187
+ );
188
+ return false;
189
+ }
190
+ if (
191
+ objHas(this.module, methodName) &&
192
+ isFunc(this.module[methodName])
193
+ ) {
194
+ try {
195
+ if (isAsync(this.module[methodName])) {
196
+ await this.module[methodName](this.notApp);
197
+ } else {
198
+ this.module[methodName](this.notApp);
199
+ }
200
+ return true;
201
+ } catch (e) {
202
+ log.error(e);
203
+ return false;
204
+ }
205
+ } else {
206
+ return false;
207
+ }
208
+ }
385
209
 
210
+ getStatus() {
211
+ const formsList = Object.keys(this.forms);
212
+ const modelsList = Object.keys(this.models);
213
+ const routesList = Object.keys(this.routes);
214
+ const actionsList = this.getActionsList();
215
+ return {
216
+ forms: {
217
+ count: formsList.length,
218
+ list: formsList,
219
+ },
220
+ models: {
221
+ count: modelsList.length,
222
+ list: modelsList,
223
+ content: this.getModelsStatuses(),
224
+ },
225
+ routes: {
226
+ count: routesList.length,
227
+ list: routesList,
228
+ content: this.getRoutesStatuses(),
229
+ },
230
+ actions: {
231
+ count: actionsList.length,
232
+ list: actionsList,
233
+ },
234
+ };
235
+ }
236
+
237
+ getActionsList() {
238
+ let list = [];
239
+ for (let route in this.manifests) {
240
+ if (this.manifests[route] && this.manifests[route].actions) {
241
+ for (let action in this.manifests[route].actions) {
242
+ list.push(`${route}//${action}`);
243
+ }
244
+ }
245
+ }
246
+ return list;
247
+ }
248
+
249
+ getRoutesStatuses() {
250
+ let result = {};
251
+ for (let route in this.manifests) {
252
+ if (this.manifests[route] && this.manifests[route].actions) {
253
+ result[route] = this.manifests[route].actions;
254
+ }
255
+ }
256
+ return result;
257
+ }
258
+
259
+ getModelsStatuses() {
260
+ let content = {};
261
+ Object.keys(this.models).forEach((name) => {
262
+ content[name] = this.getModelSchema(name);
263
+ });
264
+ return content;
265
+ }
266
+
267
+ setManifest(key, val) {
268
+ this.manifests[key] = val;
269
+ }
270
+
271
+ getForm(key) {
272
+ return this.forms[key];
273
+ }
274
+
275
+ setForm(key, val) {
276
+ this.forms[key] = val;
277
+ }
278
+
279
+ getFormConstructor(key) {
280
+ return this.formsConstructors[key];
281
+ }
282
+
283
+ setFormConstructor(key, val) {
284
+ this.formsConstructors[key] = val;
285
+ }
286
+
287
+ getFormsConstructors() {
288
+ return this.formsConstructors;
289
+ }
290
+
291
+ getField(key) {
292
+ return this.fields[key];
293
+ }
294
+
295
+ setField(key, val) {
296
+ this.fields[key] = val;
297
+ }
298
+
299
+ setModel(key, val) {
300
+ this.models[key] = val;
301
+ }
302
+
303
+ setRoute(key, val) {
304
+ this.routes[key] = val;
305
+ }
306
+
307
+ setLogic(key, val) {
308
+ this.logics[key] = val;
309
+ }
310
+
311
+ getRoute(routeName) {
312
+ if (this.routes && objHas(this.routes, routeName)) {
313
+ return this.routes[routeName];
314
+ } else {
315
+ return null;
316
+ }
317
+ }
318
+
319
+ getRoutes() {
320
+ return this.routes;
321
+ }
322
+
323
+ appIsSet() {
324
+ return typeof this.notApp !== "undefined";
325
+ }
326
+
327
+ getApp() {
328
+ return this.notApp;
329
+ }
330
+
331
+ getName() {
332
+ if (this.module && this.module.name) {
333
+ return this.module.name;
334
+ }
335
+ return this.path;
336
+ }
337
+
338
+ getOptions() {
339
+ return this.module && this.module.options ? this.module.options : {};
340
+ }
341
+
342
+ setRouteWS({
343
+ collectionType,
344
+ collectionName,
345
+ endPointType,
346
+ wsRouteName,
347
+ action,
348
+ func,
349
+ }) {
350
+ //servers/client
351
+ const collection = this.routesWS[collectionType];
352
+ //concrete client or server
353
+ const wsConnection = collection[collectionName];
354
+ //request, event, response etc
355
+ const endPoints = wsConnection[endPointType];
356
+ //endPoint name
357
+ const endPointName = `${wsRouteName}${DEFAULT_WS_ROUTE_ACTION_SPLITTER}${action}`;
358
+ //finally assigning function
359
+ endPoints[endPointName] = func;
360
+ }
361
+
362
+ createEmptyIfNotExistsRouteWSType({
363
+ collectionType, //client, server
364
+ collectionName, //concrete client/server name
365
+ endPointType, //request,event,response, etc
366
+ }) {
367
+ if (!objHas(this.routesWS[collectionType], collectionName)) {
368
+ this.routesWS[collectionType][collectionName] = {};
369
+ }
370
+ if (
371
+ !objHas(this.routesWS[collectionType][collectionName], endPointType)
372
+ ) {
373
+ this.routesWS[collectionType][collectionName][endPointType] = {};
374
+ }
375
+ }
386
376
  }
387
377
 
388
378
  module.exports = notModule;