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
@@ -0,0 +1,595 @@
1
+ const { objHas, isFunc, executeFunctionAsAsync } = require("../common");
2
+ const ModelRoutine = require("../model/routine");
3
+ const { deleteResponseSuccess } = require("../model/utils.js");
4
+ const { DBExceptionDeleteWasNotSuccessful } = require("../exceptions/db.js");
5
+ const {
6
+ DBExceptionDocumentIsNotOwnerByActiveUser,
7
+ } = require("../exceptions/http");
8
+ const isOwnerImported = require("../auth/fields.js").isOwner;
9
+ const { DOCUMENT_OWNER_FIELD_NAME } = require("../auth/const.js");
10
+ const notFilter = require("not-filter").filter;
11
+
12
+ module.exports = ({
13
+ MODEL_NAME,
14
+ MODULE_NAME,
15
+ Log,
16
+ LogAction,
17
+ say,
18
+ phrase,
19
+ config,
20
+ getModel,
21
+ getModelSchema,
22
+ getLogic,
23
+ getModelUser,
24
+ isOwner = isOwnerImported, // (doc, activeUser) => bool
25
+ ownerFieldName = DOCUMENT_OWNER_FIELD_NAME,
26
+ populateBuilders = {},
27
+ defaultPopulate = [],
28
+ }) => {
29
+ /**
30
+ * what to populate in action
31
+ */
32
+ const getPopulate = async (actionName, prepared) => {
33
+ if (
34
+ populateBuilders &&
35
+ objHas(populateBuilders, actionName) &&
36
+ isFunc(populateBuilders[actionName])
37
+ ) {
38
+ return await executeFunctionAsAsync(populateBuilders[actionName], [
39
+ prepared,
40
+ ]);
41
+ }
42
+ return defaultPopulate;
43
+ };
44
+
45
+ return class {
46
+ static Log = Log;
47
+ static LogAction = LogAction;
48
+ static say = say;
49
+ static phrase = phrase;
50
+ static config = config;
51
+ static getModel = getModel;
52
+ static getModelSchema = getModelSchema;
53
+ static getLogic = getLogic;
54
+ static getModelUser = getModelUser;
55
+
56
+ static async _create({
57
+ action,
58
+ data,
59
+ activeUser,
60
+ ip,
61
+ root = false,
62
+ shouldOwn = false,
63
+ }) {
64
+ Log.debug(
65
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
66
+ ip,
67
+ root
68
+ );
69
+ if (shouldOwn) {
70
+ data[ownerFieldName] = activeUser._id;
71
+ }
72
+ const res = await getModel().add(data);
73
+ LogAction(
74
+ {
75
+ action,
76
+ by: activeUser._id,
77
+ role: activeUser.role,
78
+ ip,
79
+ root,
80
+ },
81
+ {
82
+ targetId: res._id,
83
+ }
84
+ );
85
+ return res;
86
+ }
87
+
88
+ /**
89
+ * create item
90
+ * @param {Object} prepared
91
+ * @param {Object} prepared.data data extracted from request
92
+ * @param {Object} prepared.activeUser current user info
93
+ * @param {string} prepared.ip current user ip
94
+ * @param {boolean} prepared.root current user is root
95
+ * @returns {Promise<Object>} new document
96
+ **/
97
+ static async create({ data, activeUser, ip, root = false }) {
98
+ return await this._create({
99
+ data,
100
+ activeUser,
101
+ ip,
102
+ root,
103
+ action: "create",
104
+ shouldOwn: false,
105
+ });
106
+ }
107
+
108
+ /**
109
+ * create item and own it
110
+ * @param {Object} prepared
111
+ * @param {Object} prepared.data data extracted from request
112
+ * @param {Object} prepared.activeUser current user info
113
+ * @param {string} prepared.ip current user ip
114
+ * @param {boolean} prepared.root current user is root
115
+ * @returns {Promise<Object>} new document
116
+ **/
117
+ static async createOwn({ data, activeUser, ip, root = false }) {
118
+ return await this._create({
119
+ data,
120
+ activeUser,
121
+ ip,
122
+ root,
123
+ action: "createOwn",
124
+ shouldOwn: true,
125
+ });
126
+ }
127
+
128
+ async _updateOne({
129
+ targetId,
130
+ data,
131
+ activeUser,
132
+ action,
133
+ root,
134
+ ip,
135
+ shouldOwn = true,
136
+ }) {
137
+ Log.debug(
138
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
139
+ targetId,
140
+ ip,
141
+ root
142
+ );
143
+ let query = {
144
+ _id: targetId,
145
+ };
146
+ if (shouldOwn) {
147
+ query[ownerFieldName] = activeUser._id;
148
+ }
149
+ const result = await getModel().update(query, data).exec();
150
+ LogAction(
151
+ {
152
+ action,
153
+ by: activeUser._id,
154
+ role: activeUser.role,
155
+ ip,
156
+ },
157
+ {
158
+ targetId,
159
+ version: result.__version,
160
+ }
161
+ );
162
+ return result;
163
+ }
164
+
165
+ /**
166
+ * update item
167
+ * @param {Object} prepared
168
+ * @param {Object} prepared.targetId target item _id
169
+ * @param {Object} prepared.data data extracted from request
170
+ * @param {Object} prepared.activeUser current user info
171
+ * @param {string} prepared.ip current user ip
172
+ * @param {boolean} prepared.root current user is root
173
+ * @returns {Promise<Object>} updated document
174
+ **/
175
+ static async update({ targetId, data, activeUser, ip, root = false }) {
176
+ return await this._updateOne({
177
+ targetId,
178
+ data,
179
+ activeUser,
180
+ ip,
181
+ root,
182
+ action: "update",
183
+ shouldOwn: false,
184
+ });
185
+ }
186
+
187
+ /**
188
+ * update own item
189
+ * @param {Object} prepared
190
+ * @param {Object} prepared.targetId target item _id
191
+ * @param {Object} prepared.data data extracted from request
192
+ * @param {Object} prepared.activeUser current user info
193
+ * @param {string} prepared.ip current user ip
194
+ * @param {boolean} prepared.root current user is root
195
+ * @returns {Promise<Object>} updated document
196
+ **/
197
+ static async updateOwn({
198
+ targetId,
199
+ data,
200
+ activeUser,
201
+ ip,
202
+ root = false,
203
+ }) {
204
+ return await this._updateOne({
205
+ targetId,
206
+ data,
207
+ activeUser,
208
+ ip,
209
+ root,
210
+ action: "updateOwn",
211
+ shouldOwn: true,
212
+ });
213
+ }
214
+
215
+ /**
216
+ * get item with populated sub-documents
217
+ * @param {Object} prepared
218
+ * @param {Object} prepared.targetId target item _id
219
+ * @param {Object} prepared.activeUser current user info
220
+ * @param {string} prepared.ip current user ip
221
+ * @param {boolean} prepared.root current user is root
222
+ * @param {boolean} prepared.shouldOwn if user should be owner of target
223
+ * @returns {Promise<Object>} requested document
224
+ **/
225
+ async _getOne({
226
+ targetId,
227
+ action,
228
+ ip,
229
+ root,
230
+ activeUser,
231
+ shouldOwn = true,
232
+ }) {
233
+ Log.debug(
234
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
235
+ targetId,
236
+ ip,
237
+ root
238
+ );
239
+ let query = {};
240
+ if (shouldOwn) {
241
+ query[ownerFieldName] = activeUser._id;
242
+ }
243
+ let populate = getPopulate(action, {
244
+ targetId,
245
+ activeUser,
246
+ ip,
247
+ root,
248
+ });
249
+ const result = await getModel().getOne(targetId, populate, query);
250
+ LogAction(
251
+ {
252
+ action,
253
+ by: activeUser._id,
254
+ role: activeUser.role,
255
+ ip,
256
+ },
257
+ {
258
+ targetId,
259
+ version: result.__version,
260
+ }
261
+ );
262
+ return result;
263
+ }
264
+
265
+ /**
266
+ * get item with populated sub-documents
267
+ * @param {Object} prepared
268
+ * @param {Object} prepared.targetId target item _id
269
+ * @param {Object} prepared.activeUser current user info
270
+ * @param {string} prepared.ip current user ip
271
+ * @param {boolean} prepared.root current user is root
272
+ * @returns {Promise<Object>} requested document
273
+ **/
274
+ static async get({ targetId, activeUser, ip, root = false }) {
275
+ return await this._getOne({
276
+ targetId,
277
+ action: "get",
278
+ activeUser,
279
+ ip,
280
+ root,
281
+ shouldOwn: false,
282
+ });
283
+ }
284
+
285
+ /**
286
+ * get activeUser own item with populated sub-documents
287
+ * @param {Object} prepared
288
+ * @param {Object} prepared.targetId target item _id
289
+ * @param {Object} prepared.activeUser current user info
290
+ * @param {string} prepared.ip current user ip
291
+ * @param {boolean} prepared.root current user is root
292
+ * @returns {Promise<Object>} requested document
293
+ **/
294
+ static async getOwn({ targetId, activeUser, ip, root = false }) {
295
+ return await this._getOne({
296
+ targetId,
297
+ action: "getOwn",
298
+ activeUser,
299
+ ip,
300
+ root,
301
+ shouldOwn: true,
302
+ });
303
+ }
304
+
305
+ /**
306
+ * get item without populated sub-documents
307
+ * @param {Object} prepared
308
+ * @param {Object} prepared.targetId target item _id
309
+ * @param {Object} prepared.activeUser current user info
310
+ * @param {string} prepared.ip current user ip
311
+ * @param {boolean} prepared.root current user is root
312
+ * @param {boolean} prepared.shouldOwn if user should be owner of target
313
+ * @returns {Promise<Object>} requested document
314
+ **/
315
+ async _getOneRaw({
316
+ targetId,
317
+ activeUser,
318
+ ip,
319
+ root,
320
+ action,
321
+ shouldOwn = true,
322
+ }) {
323
+ Log.debug(
324
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
325
+ targetId,
326
+ ip,
327
+ root
328
+ );
329
+ let query = {};
330
+ if (shouldOwn) {
331
+ query[ownerFieldName] = activeUser._id;
332
+ }
333
+ const result = await getModel().getOneRaw(targetId, query);
334
+ Log.Action(
335
+ {
336
+ action,
337
+ by: activeUser._id,
338
+ role: activeUser.role,
339
+ ip,
340
+ root,
341
+ },
342
+ {
343
+ targetId,
344
+ version: result.__version,
345
+ }
346
+ );
347
+ return result;
348
+ }
349
+
350
+ /**
351
+ * get item without populated sub-documents
352
+ * @param {Object} prepared
353
+ * @param {Object} prepared.targetId target item _id
354
+ * @param {Object} prepared.activeUser current user info
355
+ * @param {string} prepared.ip current user ip
356
+ * @param {boolean} prepared.root current user is root
357
+ * @returns {Promise<Object>} requested document
358
+ **/
359
+ static async getRaw({ targetId, activeUser, ip, root = false }) {
360
+ return await this._getOneRaw({
361
+ targetId,
362
+ activeUser,
363
+ shouldOwn: false,
364
+ action: "getRaw",
365
+ ip,
366
+ root,
367
+ });
368
+ }
369
+
370
+ /**
371
+ * get item without populated sub-documents, if it's owned by activeUser
372
+ * @param {Object} prepared
373
+ * @param {Object} prepared.targetId target item _id
374
+ * @param {Object} prepared.activeUser current user info
375
+ * @param {string} prepared.ip current user ip
376
+ * @param {boolean} prepared.root current user is root
377
+ * @returns {Promise<Object>} requested document
378
+ **/
379
+ static async getOwnRaw({ targetId, activeUser, ip, root = false }) {
380
+ return await this._getOneRaw({
381
+ targetId,
382
+ activeUser,
383
+ shouldOwn: true,
384
+ action: "getOwnRaw",
385
+ ip,
386
+ root,
387
+ });
388
+ }
389
+
390
+ /**
391
+ * removes item by id, if activeUser is its owner
392
+ * @param {Object} prepared
393
+ * @param {Object} prepared.targetId target item _id
394
+ * @param {Object} prepared.activeUser current user info
395
+ * @param {string} prepared.ip current user ip
396
+ * @param {boolean} prepared.root current user is root
397
+ * @returns {Promise<Object>} requested document
398
+ **/
399
+ static async _delete({
400
+ action,
401
+ ip,
402
+ root,
403
+ targetId,
404
+ activeUser,
405
+ shouldOwn = false,
406
+ }) {
407
+ Log.debug(
408
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
409
+ targetId,
410
+ ip,
411
+ root
412
+ );
413
+ const model = getModel();
414
+ const versioning = ModelRoutine.versioning(model);
415
+ if (versioning) {
416
+ let itm = await model.getOneRaw(targetId);
417
+ if (shouldOwn && !isOwner(itm, activeUser)) {
418
+ throw new DBExceptionDocumentIsNotOwnerByActiveUser({
419
+ params: {
420
+ targetId,
421
+ activeUserId: activeUser._id,
422
+ role: activeUser.role,
423
+ versioning,
424
+ },
425
+ });
426
+ } else {
427
+ await itm.close();
428
+ }
429
+ } else {
430
+ let query = { _id: targetId };
431
+ if (shouldOwn) {
432
+ query[ownerFieldName] = activeUser._id;
433
+ }
434
+ const result = await model.findOneAndDelete(query).exec();
435
+ if (!deleteResponseSuccess(result)) {
436
+ throw new DBExceptionDeleteWasNotSuccessful({
437
+ params: {
438
+ result,
439
+ targetId,
440
+ activeUserId: activeUser._id,
441
+ role: activeUser.role,
442
+ versioning,
443
+ },
444
+ });
445
+ }
446
+ }
447
+ Log.Action(
448
+ {
449
+ action,
450
+ by: activeUser._id,
451
+ role: activeUser.role,
452
+ ip,
453
+ root,
454
+ },
455
+ {
456
+ targetId,
457
+ }
458
+ );
459
+ }
460
+
461
+ /**
462
+ * removes item by id
463
+ * @param {Object} prepared
464
+ * @param {Object} prepared.targetId target item _id
465
+ * @param {Object} prepared.activeUser current user info
466
+ * @param {string} prepared.ip current user ip
467
+ * @param {boolean} prepared.root current user is root
468
+ * @returns {Promise<Object>} requested document
469
+ **/
470
+ static async delete({ targetId, activeUser, ip, root = false }) {
471
+ await this._delete({
472
+ action: "delete",
473
+ targetId,
474
+ root,
475
+ ip,
476
+ activeUser,
477
+ shouldOwn: false,
478
+ });
479
+ }
480
+
481
+ /**
482
+ * removes item by id, if activeUser is its owner
483
+ * @param {Object} prepared
484
+ * @param {Object} prepared.targetId target item _id
485
+ * @param {Object} prepared.activeUser current user info
486
+ * @param {string} prepared.ip current user ip
487
+ * @param {boolean} prepared.root current user is root
488
+ * @returns {Promise<Object>} requested document
489
+ **/
490
+ static async deleteOwn({ targetId, activeUser, ip, root = false }) {
491
+ await this._delete({
492
+ action: "deleteOwn",
493
+ targetId,
494
+ ip,
495
+ root,
496
+ activeUser,
497
+ shouldOwn: true,
498
+ });
499
+ }
500
+
501
+ static async _listAll({
502
+ activeUser,
503
+ ip,
504
+ action,
505
+ shouldOwn = false,
506
+ root,
507
+ }) {
508
+ Log.debug(
509
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
510
+ ip,
511
+ root
512
+ );
513
+ let filter;
514
+ if (shouldOwn) {
515
+ filter = {
516
+ [ownerFieldName]: activeUser._id,
517
+ };
518
+ }
519
+ const result = await getModel().listAll(filter);
520
+ Log.Action({
521
+ action,
522
+ by: activeUser._id,
523
+ role: activeUser.role,
524
+ ip,
525
+ root,
526
+ shouldOwn,
527
+ });
528
+ return result;
529
+ }
530
+
531
+ static async _listAndCount({
532
+ query,
533
+ activeUser,
534
+ ip,
535
+ action,
536
+ root,
537
+ shouldOwn = false,
538
+ }) {
539
+ Log.debug(
540
+ `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
541
+ ip,
542
+ root
543
+ );
544
+ const { skip, size, sorter, filter, search } = query;
545
+ let populate = getPopulate(action, {
546
+ activeUser,
547
+ ip,
548
+ });
549
+ if (shouldOwn) {
550
+ notFilter.fitler.modifyRules(filter, {
551
+ [ownerFieldName]: activeUser._id,
552
+ });
553
+ }
554
+ const result = await getModel().listAndCount(
555
+ skip,
556
+ size,
557
+ sorter,
558
+ filter,
559
+ search,
560
+ populate
561
+ );
562
+ Log.Action({
563
+ action,
564
+ by: activeUser._id,
565
+ role: activeUser.role,
566
+ ip,
567
+ root,
568
+ shouldOwn,
569
+ });
570
+ return result;
571
+ }
572
+
573
+ static async listAndCount({ query, activeUser, ip, root }) {
574
+ return await this._listAndCount({
575
+ query,
576
+ activeUser,
577
+ ip,
578
+ root,
579
+ action: "listAndCount",
580
+ shouldOwn: false,
581
+ });
582
+ }
583
+
584
+ static async listAndCountOwn({ query, activeUser, ip, root }) {
585
+ return await this._listAndCount({
586
+ query,
587
+ activeUser,
588
+ ip,
589
+ root,
590
+ action: "listAndCountOwn",
591
+ shouldOwn: true,
592
+ });
593
+ }
594
+ };
595
+ };
@@ -0,0 +1,76 @@
1
+ module.exports = ({ getLogic, before, after }) => {
2
+ class notGenericRoute {
3
+ static before() {
4
+ return before(...arguments);
5
+ }
6
+
7
+ static after() {
8
+ return after(...arguments);
9
+ }
10
+
11
+ static async _create(req, res, next, prepared) {
12
+ prepared.root = true;
13
+ return await getLogic().create(prepared);
14
+ }
15
+
16
+ static async create(req, res, next, prepared) {
17
+ return await getLogic().createOwn(prepared);
18
+ }
19
+
20
+ static async _get(req, res, next, prepared) {
21
+ prepared.root = true;
22
+ return await getLogic().get(prepared);
23
+ }
24
+
25
+ static async get(req, res, next, prepared) {
26
+ return await getLogic().getOwn(prepared);
27
+ }
28
+
29
+ static async _getRaw(req, res, next, prepared) {
30
+ prepared.root = true;
31
+ return await getLogic().getRaw(prepared);
32
+ }
33
+
34
+ static async getRaw(req, res, next, prepared) {
35
+ return await getLogic().getOwnRaw(prepared);
36
+ }
37
+
38
+ static async _update(req, res, next, prepared) {
39
+ prepared.root = true;
40
+ return await getLogic().update(prepared);
41
+ }
42
+
43
+ static async update(req, res, next, prepared) {
44
+ return await getLogic().updateOwn(prepared);
45
+ }
46
+
47
+ static async _listAll(req, res, next, prepared) {
48
+ prepared.root = true;
49
+ return await getLogic().listAll(prepared);
50
+ }
51
+
52
+ static async listAll(req, res, next, prepared) {
53
+ return await getLogic().listAllOwn(prepared);
54
+ }
55
+
56
+ static async _listAndCount(req, res, next, prepared) {
57
+ prepared.root = true;
58
+ return await getLogic().listAndCount(prepared);
59
+ }
60
+
61
+ static async listAndCount(req, res, next, prepared) {
62
+ return await getLogic().listAndCountOwn(prepared);
63
+ }
64
+
65
+ static async _delete(req, res, next, prepared) {
66
+ prepared.root = true;
67
+ return await getLogic().delete(prepared);
68
+ }
69
+
70
+ static async delete(req, res, next, prepared) {
71
+ return await getLogic().deleteOwn(prepared);
72
+ }
73
+ }
74
+
75
+ return notGenericRoute;
76
+ };
@@ -1,13 +1,13 @@
1
- const {executeObjectFunction} = require('../common');
1
+ const { executeObjectFunction } = require("../common");
2
2
 
3
3
  let ADDITIONAL = {};
4
4
 
5
- module.exports.init = (val)=>{
6
- if(typeof val === 'object'){
7
- ADDITIONAL = {...val};
8
- }
5
+ module.exports.init = (val) => {
6
+ if (typeof val === "object") {
7
+ ADDITIONAL = { ...val };
8
+ }
9
9
  };
10
10
 
11
- module.exports.run = (path, params)=>{
12
- return executeObjectFunction(ADDITIONAL, path, [params]);
11
+ module.exports.run = (path, params) => {
12
+ return executeObjectFunction(ADDITIONAL, path, [params]);
13
13
  };