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.
- package/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +17 -31
- package/lib-prod/base-classes/base-angular-service.js +83 -55
- package/lib-prod/base-classes/base-class.js +33 -35
- package/lib-prod/base-classes/base-context.js +17 -19
- package/lib-prod/base-classes/base-controller.js +146 -154
- package/lib-prod/base-classes/base-crud-controller.js +250 -221
- package/lib-prod/base-classes/base-custom-repository.js +7 -18
- package/lib-prod/base-classes/base-electron-service.js +49 -0
- package/lib-prod/base-classes/base-entity.js +20 -30
- package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
- package/lib-prod/base-classes/base-injector.js +176 -194
- package/lib-prod/base-classes/base-middleware.js +8 -5
- package/lib-prod/base-classes/base-migration.js +19 -22
- package/lib-prod/base-classes/base-provider.js +7 -5
- package/lib-prod/base-classes/base-repository.js +601 -573
- package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
- package/lib-prod/base-classes/base.js +18 -0
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/config/controller-config.js +24 -24
- package/lib-prod/config/controller-options.js +2 -5
- package/lib-prod/config/method-config.js +6 -8
- package/lib-prod/config/param-config.js +2 -8
- package/lib-prod/constants.js +29 -25
- package/lib-prod/context-db-migrations.js +328 -324
- package/lib-prod/create-context.js +211 -146
- package/lib-prod/decorators/classes/controller-decorator.js +16 -20
- package/lib-prod/decorators/classes/entity-decorator.js +26 -47
- package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
- package/lib-prod/decorators/classes/migration-decorator.js +13 -22
- package/lib-prod/decorators/classes/provider-decorator.js +13 -23
- package/lib-prod/decorators/classes/repository-decorator.js +13 -22
- package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
- package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
- package/lib-prod/decorators/http/http-decorators.js +20 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
- package/lib-prod/decorators/http/http-params-decorators.js +36 -62
- package/lib-prod/dependency-injection/di-container.js +28 -29
- package/lib-prod/endpoint-context-storage.js +27 -32
- package/lib-prod/endpoint-context.js +2294 -1930
- package/lib-prod/entity-process.js +209 -198
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/express-types.js +1 -0
- package/lib-prod/formly/formly.models.js +1 -0
- package/lib-prod/formly/fromly.js +196 -175
- package/lib-prod/formly/type-from-entity.js +45 -52
- package/lib-prod/get-response-value.js +21 -18
- package/lib-prod/global-state/taon-global-state/index.js +6 -5
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
- package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
- package/lib-prod/helpers/class-helpers.js +210 -177
- package/lib-prod/helpers/clone-obj.js +16 -20
- package/lib-prod/helpers/taon-helpers.js +132 -114
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +248 -227
- package/lib-prod/inject.js +88 -33
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/models.js +72 -103
- package/lib-prod/orm/columns.js +58 -118
- package/lib-prod/orm/index.js +56 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +188 -186
- package/lib-prod/realtime/realtime-core.js +77 -78
- package/lib-prod/realtime/realtime-server.js +225 -240
- package/lib-prod/realtime/realtime-strategy/index.js +4 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
- package/lib-prod/realtime/realtime-subs-manager.js +82 -90
- package/lib-prod/realtime/realtime.models.js +2 -0
- package/lib-prod/symbols.js +104 -105
- package/lib-prod/ui/index.js +1 -5
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
- package/lib-prod/validators.js +43 -37
- package/lib-prod.split-namespaces.json +32 -86
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,184 +1,205 @@
|
|
|
1
|
-
import { Mapping__NS__getModelsMapping } from
|
|
2
|
-
import { ___NS__first, ___NS__isArray, ___NS__isBoolean, ___NS__isDate, ___NS__isFunction, ___NS__isString, ___NS__isUndefined, ___NS__startCase } from
|
|
3
|
-
import { CLASS } from
|
|
4
|
-
import { findTypeForEntity } from
|
|
5
|
-
function getFromlyConfigFor(target, options = {}) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
if (checkExclude) {
|
|
97
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 (
|
|
119
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
122
|
+
// console.log(`Is allowed;${matchPath} `, isAlowed)
|
|
123
|
+
return isAlowed;
|
|
141
124
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
|
2
|
-
import { ___NS__first, ___NS__isArray } from
|
|
3
|
-
function findTypeForEntity(entity, isArray = false) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
19
|
+
export function typeFromName(component, name) {
|
|
20
|
+
let res = { name, component };
|
|
21
|
+
return res;
|
|
23
22
|
}
|
|
24
|
-
function RegisterComponentTypeForEntity(entity) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
2
|
-
const TaonGlobalStateDefaultsValues = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
};
|