taon 21.0.53 → 21.0.55

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 (115) hide show
  1. package/bin/taon +5 -5
  2. package/bin/taon-debug +5 -5
  3. package/bin/taon-debug-brk +4 -4
  4. package/browser/package.json +1 -1
  5. package/browser-prod/package.json +1 -1
  6. package/icon-menu-taon.svg +15 -15
  7. package/lib/build-info._auto-generated_.d.ts +1 -1
  8. package/lib/build-info._auto-generated_.js +1 -1
  9. package/lib/package.json +1 -1
  10. package/lib/ui/index.js +2 -2
  11. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  12. package/lib-prod/base-classes/base-abstract-entity.js +17 -31
  13. package/lib-prod/base-classes/base-angular-service.js +83 -55
  14. package/lib-prod/base-classes/base-class.js +33 -35
  15. package/lib-prod/base-classes/base-context.js +17 -19
  16. package/lib-prod/base-classes/base-controller.js +146 -154
  17. package/lib-prod/base-classes/base-crud-controller.js +250 -221
  18. package/lib-prod/base-classes/base-custom-repository.js +7 -18
  19. package/lib-prod/base-classes/base-electron-service.js +49 -0
  20. package/lib-prod/base-classes/base-entity.js +20 -30
  21. package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
  22. package/lib-prod/base-classes/base-injector.js +176 -194
  23. package/lib-prod/base-classes/base-middleware.js +8 -5
  24. package/lib-prod/base-classes/base-migration.js +19 -22
  25. package/lib-prod/base-classes/base-provider.js +7 -5
  26. package/lib-prod/base-classes/base-repository.js +601 -573
  27. package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
  28. package/lib-prod/base-classes/base.js +18 -0
  29. package/lib-prod/build-info._auto-generated_.js +26 -14
  30. package/lib-prod/config/controller-config.js +24 -24
  31. package/lib-prod/config/controller-options.js +2 -5
  32. package/lib-prod/config/method-config.js +6 -8
  33. package/lib-prod/config/param-config.js +2 -8
  34. package/lib-prod/constants.js +29 -25
  35. package/lib-prod/context-db-migrations.js +328 -324
  36. package/lib-prod/create-context.js +211 -146
  37. package/lib-prod/decorators/classes/controller-decorator.js +16 -20
  38. package/lib-prod/decorators/classes/entity-decorator.js +26 -47
  39. package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
  40. package/lib-prod/decorators/classes/migration-decorator.js +13 -22
  41. package/lib-prod/decorators/classes/provider-decorator.js +13 -23
  42. package/lib-prod/decorators/classes/repository-decorator.js +13 -22
  43. package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
  44. package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
  45. package/lib-prod/decorators/http/http-decorators.js +20 -5
  46. package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
  47. package/lib-prod/decorators/http/http-params-decorators.js +36 -62
  48. package/lib-prod/dependency-injection/di-container.js +28 -29
  49. package/lib-prod/endpoint-context-storage.js +27 -32
  50. package/lib-prod/endpoint-context.js +2294 -1930
  51. package/lib-prod/entity-process.js +209 -198
  52. package/lib-prod/env/env.angular-node-app.js +66 -130
  53. package/lib-prod/env/env.docs-webapp.js +66 -130
  54. package/lib-prod/env/env.electron-app.js +66 -130
  55. package/lib-prod/env/env.mobile-app.js +66 -130
  56. package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
  57. package/lib-prod/env/env.vscode-plugin.js +66 -130
  58. package/lib-prod/env/index.js +6 -6
  59. package/lib-prod/express-types.js +1 -0
  60. package/lib-prod/formly/formly.models.js +1 -0
  61. package/lib-prod/formly/fromly.js +196 -175
  62. package/lib-prod/formly/type-from-entity.js +45 -52
  63. package/lib-prod/get-response-value.js +21 -18
  64. package/lib-prod/global-state/taon-global-state/index.js +6 -5
  65. package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
  66. package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
  67. package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
  68. package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
  69. package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
  70. package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
  71. package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
  72. package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
  73. package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
  74. package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
  75. package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
  76. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
  77. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
  78. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
  79. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
  80. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
  81. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
  82. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
  83. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
  84. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
  85. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
  86. package/lib-prod/helpers/class-helpers.js +210 -177
  87. package/lib-prod/helpers/clone-obj.js +16 -20
  88. package/lib-prod/helpers/taon-helpers.js +132 -114
  89. package/lib-prod/index._auto-generated_.js +5 -0
  90. package/lib-prod/index.js +248 -227
  91. package/lib-prod/inject.js +88 -33
  92. package/lib-prod/migrations/index.js +2 -1
  93. package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
  94. package/lib-prod/models.js +72 -103
  95. package/lib-prod/orm/columns.js +58 -118
  96. package/lib-prod/orm/index.js +56 -1
  97. package/lib-prod/package.json +1 -1
  98. package/lib-prod/realtime/realtime-client.js +188 -186
  99. package/lib-prod/realtime/realtime-core.js +77 -78
  100. package/lib-prod/realtime/realtime-server.js +225 -240
  101. package/lib-prod/realtime/realtime-strategy/index.js +4 -4
  102. package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
  103. package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
  104. package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
  105. package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
  106. package/lib-prod/realtime/realtime-subs-manager.js +82 -90
  107. package/lib-prod/realtime/realtime.models.js +2 -0
  108. package/lib-prod/symbols.js +104 -105
  109. package/lib-prod/ui/index.js +1 -5
  110. package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
  111. package/lib-prod/validators.js +43 -37
  112. package/lib-prod.split-namespaces.json +32 -86
  113. package/package.json +1 -1
  114. package/websql/package.json +1 -1
  115. package/websql-prod/package.json +1 -1
@@ -1,184 +1,205 @@
1
- import { Mapping__NS__getModelsMapping } from "ng2-rest/lib-prod";
2
- import { ___NS__first, ___NS__isArray, ___NS__isBoolean, ___NS__isDate, ___NS__isFunction, ___NS__isString, ___NS__isUndefined, ___NS__startCase } from "tnp-core/lib-prod";
3
- import { CLASS } from "typescript-class-helpers/lib-prod";
4
- import { findTypeForEntity } from "./type-from-entity";
5
- function getFromlyConfigFor(target, options = {}) {
6
- const {
7
- formType = "material",
8
- keysPathesToExclude = [],
9
- keysPathesToInclude = [],
10
- parentModel,
11
- relativePath = "",
12
- level = 0,
13
- maxLevel = 4
14
- } = options;
15
- if (level === maxLevel) {
16
- return [];
17
- }
18
- const mapping = Mapping__NS__getModelsMapping(target);
19
- const fieldNames = CLASS.describeProperites(target);
20
- const checkExclude = ___NS__isArray(keysPathesToExclude) && keysPathesToExclude.length > 0;
21
- const checkInclude = ___NS__isArray(keysPathesToInclude) && keysPathesToInclude.length > 0;
22
- if (checkExclude && checkInclude) {
23
- throw new Error(
24
- `In Taon function getFromlyConfigFor(...) please use keysPathesToInclude or keysPathesToExclude, `
25
- );
26
- }
27
- let fields = [];
28
- function inputToPush(key, type, model, inptToPushOptions) {
29
- const { targetChild, selectOptions } = inptToPushOptions || {};
30
- let res;
31
- if (type === "repeat") {
32
- const fieldGroup = getFromlyConfigFor(targetChild, {
33
- formType,
34
- keysPathesToInclude,
35
- keysPathesToExclude,
36
- relativePath: `${relativePath}.${key}`,
37
- level: level + 1,
38
- maxLevel
39
- });
40
- if (fieldGroup.length > 0) {
41
- res = {
42
- key,
43
- type,
44
- defaultValue: [],
45
- fieldArray: {
46
- fieldGroupClassName: "row",
47
- templateOptions: {
48
- label: `Add new ${___NS__startCase(key)}`
49
- },
50
- fieldGroup
51
- }
52
- };
53
- }
54
- } else if (type === "group") {
55
- const fieldGroup = getFromlyConfigFor(targetChild, {
56
- formType,
57
- keysPathesToInclude,
58
- keysPathesToExclude,
59
- parentModel: model,
60
- relativePath: `${relativePath}.${key}`,
61
- level: level + 1,
62
- maxLevel
63
- });
64
- if (fieldGroup.length > 0) {
65
- res = {
66
- fieldGroupClassName: "row",
67
- templateOptions: {
68
- label: `${___NS__startCase(key)}`
69
- },
70
- wrappers: ["groupwrap"],
71
- fieldGroup
72
- };
73
- }
74
- } else {
75
- res = {
76
- key,
77
- model,
78
- type,
79
- defaultValue: !___NS__isUndefined(target.prototype[key]) ? target.prototype[key] : void 0,
80
- templateOptions: {
81
- label: ___NS__isString(model) ? `${model.split(".").map((l) => ___NS__startCase(l)).join(" / ")} / ${___NS__startCase(key)}` : ___NS__startCase(key),
82
- options: selectOptions
83
- }
84
- };
85
- }
86
- if (res) {
87
- Object.keys(res).forEach(
88
- (key2) => res[key2] === void 0 ? delete res[key2] : ""
89
- );
1
+ import { Mapping__NS__getModelsMapping } from 'ng2-rest/lib-prod';
2
+ import { ___NS__first, ___NS__isArray, ___NS__isBoolean, ___NS__isDate, ___NS__isFunction, ___NS__isString, ___NS__isUndefined, ___NS__startCase } from 'tnp-core/lib-prod';
3
+ import { CLASS } from 'typescript-class-helpers/lib-prod';
4
+ import { findTypeForEntity } from './type-from-entity';
5
+ export function getFromlyConfigFor(target, options = {}) {
6
+ const { formType = 'material', keysPathesToExclude = [], keysPathesToInclude = [], parentModel, relativePath = '', level = 0, maxLevel = 4, } = options;
7
+ if (level === maxLevel) {
8
+ return [];
90
9
  }
91
- return res;
92
- }
93
- function isAlowedPath(key) {
94
- let isAlowed = true;
95
- const matchPath = relativePath === "" ? key : `${relativePath}:${key}`;
96
- if (checkExclude) {
97
- if (keysPathesToExclude.includes(matchPath)) {
98
- isAlowed = false;
99
- } else {
100
- isAlowed = true;
101
- }
102
- } else if (checkInclude) {
103
- if (keysPathesToInclude.includes(matchPath)) {
104
- isAlowed = true;
105
- } else {
106
- isAlowed = false;
107
- }
10
+ const mapping = Mapping__NS__getModelsMapping(target);
11
+ // console.log('mapping', mapping)
12
+ const fieldNames = CLASS.describeProperites(target);
13
+ const checkExclude = ___NS__isArray(keysPathesToExclude) && keysPathesToExclude.length > 0;
14
+ const checkInclude = ___NS__isArray(keysPathesToInclude) && keysPathesToInclude.length > 0;
15
+ if (checkExclude && checkInclude) {
16
+ throw new Error(`In Taon function getFromlyConfigFor(...) please use keysPathesToInclude or keysPathesToExclude, `);
108
17
  }
109
- return isAlowed;
110
- }
111
- const simpleResolved = [];
112
- function resolveSimpleTypes() {
113
- for (const key in target.prototype) {
114
- if (target.prototype.hasOwnProperty(key) && !___NS__isFunction(target.prototype[key])) {
115
- if (!isAlowedPath(key)) {
116
- continue;
18
+ // if (checkInclude) {
19
+ // console.log('check include', keysPathesToExclude)
20
+ // }
21
+ // if (checkExclude) {
22
+ // console.log('check exclude', keysPathesToExclude)
23
+ // }
24
+ let fields = [];
25
+ //#region input to push
26
+ function inputToPush(key, type, model, inptToPushOptions) {
27
+ const { targetChild, selectOptions } = inptToPushOptions || {};
28
+ // console.log(`key(${key}) type: ${type} | model: ${model} targetChild: ${targetChild && targetChild.name}`)
29
+ let res;
30
+ if (type === 'repeat') {
31
+ const fieldGroup = getFromlyConfigFor(targetChild, {
32
+ formType,
33
+ keysPathesToInclude,
34
+ keysPathesToExclude,
35
+ relativePath: `${relativePath}.${key}`,
36
+ level: level + 1,
37
+ maxLevel,
38
+ });
39
+ if (fieldGroup.length > 0) {
40
+ res = {
41
+ key,
42
+ type,
43
+ defaultValue: [],
44
+ fieldArray: {
45
+ fieldGroupClassName: 'row',
46
+ templateOptions: {
47
+ label: `Add new ${___NS__startCase(key)}`,
48
+ },
49
+ fieldGroup,
50
+ },
51
+ };
52
+ }
53
+ }
54
+ else if (type === 'group') {
55
+ const fieldGroup = getFromlyConfigFor(targetChild, {
56
+ formType,
57
+ keysPathesToInclude,
58
+ keysPathesToExclude,
59
+ parentModel: model,
60
+ relativePath: `${relativePath}.${key}`,
61
+ level: level + 1,
62
+ maxLevel,
63
+ });
64
+ if (fieldGroup.length > 0) {
65
+ res = {
66
+ fieldGroupClassName: 'row',
67
+ templateOptions: {
68
+ label: `${___NS__startCase(key)}`,
69
+ },
70
+ wrappers: ['groupwrap'],
71
+ fieldGroup,
72
+ };
73
+ }
74
+ }
75
+ else {
76
+ res = {
77
+ key,
78
+ model,
79
+ type,
80
+ defaultValue: !___NS__isUndefined(target.prototype[key])
81
+ ? target.prototype[key]
82
+ : undefined,
83
+ templateOptions: {
84
+ label: ___NS__isString(model)
85
+ ? `${model
86
+ .split('.')
87
+ .map(l => ___NS__startCase(l))
88
+ .join(' / ')} / ${___NS__startCase(key)}`
89
+ : ___NS__startCase(key),
90
+ options: selectOptions,
91
+ },
92
+ };
117
93
  }
118
- if (!___NS__isUndefined(mapping[key])) {
119
- continue;
94
+ if (res) {
95
+ Object.keys(res).forEach(key => res[key] === undefined ? delete res[key] : '');
96
+ }
97
+ return res;
98
+ }
99
+ //#endregion
100
+ //#region is allowed path
101
+ function isAlowedPath(key) {
102
+ let isAlowed = true;
103
+ const matchPath = relativePath === '' ? key : `${relativePath}:${key}`;
104
+ if (checkExclude) {
105
+ if (keysPathesToExclude.includes(matchPath)) {
106
+ // console.log(`Not allowed key: ${key}`)
107
+ isAlowed = false;
108
+ }
109
+ else {
110
+ isAlowed = true;
111
+ }
120
112
  }
121
- const element = target.prototype[key];
122
- let type = "input";
123
- if (___NS__isBoolean(element)) {
124
- type = "switch";
125
- } else if (___NS__isDate(element)) {
126
- type = "datepicker";
127
- } else if (___NS__isFunction(target["getOptionsFor"])) {
128
- var selectOptions = target["getOptionsFor"](key);
129
- if (!___NS__isUndefined(selectOptions)) {
130
- type = "select";
131
- }
132
- } else if (___NS__isFunction(target.prototype?.getOptionsFor)) {
133
- var selectOptions = target.prototype?.getOptionsFor(key);
134
- if (!___NS__isUndefined(selectOptions)) {
135
- type = "select";
136
- }
113
+ else if (checkInclude) {
114
+ if (keysPathesToInclude.includes(matchPath)) {
115
+ // console.log(`Allowed key: ${key}`)
116
+ isAlowed = true;
117
+ }
118
+ else {
119
+ isAlowed = false;
120
+ }
137
121
  }
138
- fields.push(inputToPush(key, type, parentModel, { selectOptions }));
139
- simpleResolved.push(key);
140
- }
122
+ // console.log(`Is allowed;${matchPath} `, isAlowed)
123
+ return isAlowed;
141
124
  }
142
- }
143
- function resolveComplexTypes() {
144
- fieldNames.filter((key) => !simpleResolved.includes(key)).forEach((key) => {
145
- if (isAlowedPath(key) && !___NS__isUndefined(mapping[key])) {
146
- let className = mapping[key];
147
- const isArray = ___NS__isArray(className);
148
- className = isArray ? ___NS__first(className) : className;
149
- if (className === "Date") {
150
- fields.push(inputToPush(key, "datepicker", parentModel));
151
- } else {
152
- const targetChild = CLASS.getBy(className);
153
- if (targetChild) {
154
- const ftype = findTypeForEntity(targetChild, isArray);
155
- if (ftype) {
156
- fields = fields.concat(
157
- inputToPush(key, ftype.name, key)
158
- );
159
- } else {
160
- if (isArray) {
161
- fields = fields.concat(
162
- inputToPush(key, "repeat", key, { targetChild })
163
- );
164
- } else {
165
- fields = fields.concat(
166
- inputToPush(key, "group", key, { targetChild })
167
- );
168
- }
125
+ //#endregion
126
+ const simpleResolved = [];
127
+ //#region resolve simple types
128
+ function resolveSimpleTypes() {
129
+ for (const key in target.prototype) {
130
+ if (target.prototype.hasOwnProperty(key) &&
131
+ !___NS__isFunction(target.prototype[key])) {
132
+ if (!isAlowedPath(key)) {
133
+ continue;
134
+ }
135
+ if (!___NS__isUndefined(mapping[key])) {
136
+ continue;
137
+ }
138
+ const element = target.prototype[key];
139
+ let type = 'input';
140
+ if (___NS__isBoolean(element)) {
141
+ type = 'switch';
142
+ }
143
+ else if (___NS__isDate(element)) {
144
+ type = 'datepicker';
145
+ }
146
+ else if (___NS__isFunction(target['getOptionsFor'])) {
147
+ var selectOptions = target['getOptionsFor'](key);
148
+ if (!___NS__isUndefined(selectOptions)) {
149
+ type = 'select';
150
+ }
151
+ }
152
+ else if (___NS__isFunction(target.prototype?.getOptionsFor)) {
153
+ var selectOptions = target.prototype?.getOptionsFor(key);
154
+ if (!___NS__isUndefined(selectOptions)) {
155
+ type = 'select';
156
+ }
157
+ }
158
+ fields.push(inputToPush(key, type, parentModel, { selectOptions }));
159
+ simpleResolved.push(key);
169
160
  }
170
- }
171
161
  }
172
- }
173
- });
174
- }
175
- function generate() {
176
- resolveSimpleTypes();
177
- resolveComplexTypes();
178
- }
179
- generate();
180
- return fields.filter((f) => !!f);
162
+ }
163
+ //#endregion
164
+ //#region resolve complex types
165
+ function resolveComplexTypes() {
166
+ fieldNames
167
+ .filter(key => !simpleResolved.includes(key))
168
+ .forEach(key => {
169
+ if (isAlowedPath(key) && !___NS__isUndefined(mapping[key])) {
170
+ let className = mapping[key];
171
+ const isArray = ___NS__isArray(className);
172
+ className = isArray ? ___NS__first(className) : className;
173
+ if (className === 'Date') {
174
+ fields.push(inputToPush(key, 'datepicker', parentModel));
175
+ }
176
+ else {
177
+ const targetChild = CLASS.getBy(className);
178
+ if (targetChild) {
179
+ const ftype = findTypeForEntity(targetChild, isArray);
180
+ if (ftype) {
181
+ fields = fields.concat(inputToPush(key, ftype.name, key));
182
+ }
183
+ else {
184
+ if (isArray) {
185
+ fields = fields.concat(inputToPush(key, 'repeat', key, { targetChild }));
186
+ }
187
+ else {
188
+ fields = fields.concat(inputToPush(key, 'group', key, { targetChild }));
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ });
195
+ }
196
+ //#endregion
197
+ function generate() {
198
+ resolveSimpleTypes();
199
+ // console.log('after simple', fields);
200
+ resolveComplexTypes();
201
+ // console.log('after complext', fields);
202
+ }
203
+ generate();
204
+ return fields.filter(f => !!f);
181
205
  }
182
- export {
183
- getFromlyConfigFor
184
- };
@@ -1,58 +1,51 @@
1
- import { ClassHelpers__NS__getName, ClassHelpers__NS__setName } from "../helpers/class-helpers";
2
- import { ___NS__first, ___NS__isArray } from "tnp-core/lib-prod";
3
- function findTypeForEntity(entity, isArray = false) {
4
- if (!___NS__isArray(RegisterComponentType.prototype.types)) {
5
- RegisterComponentType.prototype.types = [];
6
- }
7
- return getRegisteredComponents().find(
8
- (c) => c.entity === entity && c.isArray === isArray
9
- );
1
+ import { ClassHelpers__NS__getName, ClassHelpers__NS__setName } from '../helpers/class-helpers';
2
+ import { ___NS__first, ___NS__isArray } from 'tnp-core/lib-prod';
3
+ export function findTypeForEntity(entity, isArray = false) {
4
+ if (!___NS__isArray(RegisterComponentType.prototype.types)) {
5
+ RegisterComponentType.prototype.types = [];
6
+ }
7
+ return getRegisteredComponents().find(c => c.entity === entity && c.isArray === isArray);
10
8
  }
11
- function typeFromEntity(component, entity) {
12
- const isArray = ___NS__isArray(entity);
13
- if (isArray) {
14
- entity = ___NS__first(entity);
15
- }
16
- let name = ClassHelpers__NS__getName(component);
17
- let res = { name, component, entity, isArray };
18
- return res;
9
+ export function typeFromEntity(component, entity) {
10
+ const isArray = ___NS__isArray(entity);
11
+ if (isArray) {
12
+ entity = ___NS__first(entity);
13
+ }
14
+ let name = ClassHelpers__NS__getName(component);
15
+ let res = { name, component, entity, isArray };
16
+ // console.log(res);
17
+ return res;
19
18
  }
20
- function typeFromName(component, name) {
21
- let res = { name, component };
22
- return res;
19
+ export function typeFromName(component, name) {
20
+ let res = { name, component };
21
+ return res;
23
22
  }
24
- function RegisterComponentTypeForEntity(entity) {
25
- if (!___NS__isArray(RegisterComponentType.prototype.types)) {
26
- RegisterComponentType.prototype.types = [];
27
- }
28
- return function(target, propertyKey, descriptor) {
29
- RegisterComponentType.prototype.types.push(typeFromEntity(target, entity));
30
- };
23
+ export function RegisterComponentTypeForEntity(entity) {
24
+ if (!___NS__isArray(RegisterComponentType.prototype.types)) {
25
+ RegisterComponentType.prototype.types = [];
26
+ }
27
+ return function (target, propertyKey, descriptor) {
28
+ RegisterComponentType.prototype.types.push(typeFromEntity(target, entity));
29
+ };
31
30
  }
32
- function RegisterComponentType(className, ...optionslNames) {
33
- if (!___NS__isArray(RegisterComponentType.prototype.types)) {
34
- RegisterComponentType.prototype.types = [];
35
- }
36
- return function(target, propertyKey, descriptor) {
37
- ClassHelpers__NS__setName(target, className);
38
- RegisterComponentType.prototype.types.push(typeFromEntity(target));
39
- optionslNames.forEach((name) => {
40
- RegisterComponentType.prototype.types.push(typeFromName(target, name));
41
- });
42
- };
31
+ export function RegisterComponentType(className, ...optionslNames) {
32
+ if (!___NS__isArray(RegisterComponentType.prototype.types)) {
33
+ RegisterComponentType.prototype.types = [];
34
+ }
35
+ return function (target, propertyKey, descriptor) {
36
+ ClassHelpers__NS__setName(target, className);
37
+ RegisterComponentType.prototype.types.push(typeFromEntity(target));
38
+ optionslNames.forEach(name => {
39
+ RegisterComponentType.prototype.types.push(typeFromName(target, name));
40
+ });
41
+ };
43
42
  }
44
- function getRegisteredComponents() {
45
- let registered = RegisterComponentType.prototype.types;
46
- if (!Array.isArray(registered)) {
47
- return [];
48
- }
49
- return registered;
43
+ // RegisterComponentType.prototype.types = []
44
+ export function getRegisteredComponents() {
45
+ let registered = RegisterComponentType.prototype.types;
46
+ if (!Array.isArray(registered)) {
47
+ return [];
48
+ }
49
+ // console.log(registered)
50
+ return registered;
50
51
  }
51
- export {
52
- RegisterComponentType,
53
- RegisterComponentTypeForEntity,
54
- findTypeForEntity,
55
- getRegisteredComponents,
56
- typeFromEntity,
57
- typeFromName
58
- };
@@ -1,19 +1,22 @@
1
- const getResponseValue = (response, options) => {
2
- const { req, res } = options || {};
3
- return new Promise(async (resolve, reject) => {
4
- if (typeof response === "function") {
5
- const asyncResponse = response;
6
- try {
7
- const result = await asyncResponse(req, res);
8
- resolve(result);
9
- } catch (e) {
10
- reject(e);
11
- }
12
- } else {
13
- reject(`[taon] Not recognized type of response ${response}`);
14
- }
15
- });
16
- };
17
- export {
18
- getResponseValue
1
+ export const getResponseValue = (response, options) => {
2
+ //#region @websqlFunc
3
+ const { req, res } = options || {};
4
+ return new Promise(async (resolve, reject) => {
5
+ //#region @websql
6
+ if (typeof response === 'function') {
7
+ const asyncResponse = response;
8
+ try {
9
+ const result = await asyncResponse(req, res);
10
+ resolve(result);
11
+ }
12
+ catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+ else {
17
+ reject(`[taon] Not recognized type of response ${response}`);
18
+ }
19
+ //#endregion
20
+ });
21
+ //#endregion
19
22
  };
@@ -1,5 +1,6 @@
1
- export * from "./taon-global-state.constants";
2
- export * from "./taon-global-state.entity";
3
- export * from "./taon-global-state.controller";
4
- export * from "./taon-global-state.repository";
5
- export * from "./taon-global-state.abstract.context";
1
+ /* */
2
+ export * from './taon-global-state.constants';
3
+ export * from './taon-global-state.entity';
4
+ export * from './taon-global-state.controller';
5
+ export * from './taon-global-state.repository';
6
+ export * from './taon-global-state.abstract.context';
@@ -1,20 +1,19 @@
1
- import { createContext } from "../../create-context";
2
- import { TAON_GLOBAL_STATE } from "./taon-global-state.entity";
3
- import { TaonGlobalStateController } from "./taon-global-state.controller";
4
- import { TaonGlobalStateRepository } from "./taon-global-state.repository";
5
- import { TaonGlobalStateProvider } from "./taon-global-state.provider";
6
- import { TaonGlobalStateMiddleware } from "./taon-global-state.middleware";
7
- import { TaonGlobalStateSubscriber } from "./taon-global-state.subscriber";
8
- const TaonGlobalStateContext = createContext(() => ({
9
- contextName: "TaonGlobalStateContext",
10
- abstract: true,
11
- entities: { TAON_GLOBAL_STATE },
12
- controllers: { TaonGlobalStateController },
13
- repositories: { TaonGlobalStateRepository },
14
- providers: { TaonGlobalStateProvider },
15
- middlewares: { TaonGlobalStateMiddleware },
16
- subscribers: { TaonGlobalStateSubscriber }
1
+ //#region imports
2
+ import { createContext } from '../../create-context';
3
+ import { TAON_GLOBAL_STATE } from './taon-global-state.entity';
4
+ import { TaonGlobalStateController } from './taon-global-state.controller';
5
+ import { TaonGlobalStateRepository } from './taon-global-state.repository';
6
+ import { TaonGlobalStateProvider } from './taon-global-state.provider';
7
+ import { TaonGlobalStateMiddleware } from './taon-global-state.middleware';
8
+ import { TaonGlobalStateSubscriber } from './taon-global-state.subscriber';
9
+ //#endregion
10
+ export const TaonGlobalStateContext = createContext(() => ({
11
+ contextName: 'TaonGlobalStateContext',
12
+ abstract: true,
13
+ entities: { TAON_GLOBAL_STATE },
14
+ controllers: { TaonGlobalStateController },
15
+ repositories: { TaonGlobalStateRepository },
16
+ providers: { TaonGlobalStateProvider },
17
+ middlewares: { TaonGlobalStateMiddleware },
18
+ subscribers: { TaonGlobalStateSubscriber },
17
19
  }));
18
- export {
19
- TaonGlobalStateContext
20
- };
@@ -1,10 +1,7 @@
1
- import { TaonGlobalStateStatus } from "./taon-global-state.models";
2
- const TaonGlobalStateDefaultsValues = {
3
- description: "",
4
- version: 0,
5
- id: void 0,
6
- status: TaonGlobalStateStatus.NORMAL
7
- };
8
- export {
9
- TaonGlobalStateDefaultsValues
1
+ import { TaonGlobalStateStatus } from './taon-global-state.models';
2
+ export const TaonGlobalStateDefaultsValues = {
3
+ description: '',
4
+ version: 0,
5
+ id: void 0,
6
+ status: TaonGlobalStateStatus.NORMAL,
10
7
  };