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,195 +1,228 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import * as FormData from 'form-data'; // @backend
|
|
3
|
+
import { ___NS__isArray, ___NS__isArrayBuffer, ___NS__isBuffer, ___NS__isDate, ___NS__isFunction, ___NS__isNull, ___NS__isObject, ___NS__isRegExp, ___NS__isString, ___NS__isUndefined, ___NS__uniq, Utils__NS__uniqArray } from 'tnp-core/lib-prod';
|
|
4
|
+
import { CLASS } from 'typescript-class-helpers/lib-prod';
|
|
5
|
+
import { controllerConfigFrom, } from '../config/controller-config';
|
|
6
|
+
import { Symbols__NS__classNameStaticProperty, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__orignalClass } from '../symbols';
|
|
7
|
+
import { Validators__NS__classNameVlidation } from '../validators';
|
|
8
|
+
//#endregion
|
|
9
|
+
//namespace ClassHelpers
|
|
10
|
+
//#region get class from name
|
|
11
|
+
/**
|
|
12
|
+
* TODO - repalce in every place when getting class fn from object
|
|
13
|
+
*/
|
|
14
|
+
export const ClassHelpers__NS__getClassFnFromObject = (json) => {
|
|
15
|
+
if (___NS__isUndefined(json) || ___NS__isNull(json)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (json.constructor) {
|
|
19
|
+
return json.constructor;
|
|
20
|
+
}
|
|
21
|
+
const p = Object.getPrototypeOf(json);
|
|
22
|
+
return p && p.constructor && p.constructor.name !== 'Object'
|
|
23
|
+
? p.constructor
|
|
24
|
+
: void 0;
|
|
18
25
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region get name
|
|
28
|
+
export const ClassHelpers__NS__getName = (classFnOrObject) => {
|
|
29
|
+
// exception for FormData
|
|
30
|
+
if (classFnOrObject instanceof FormData) {
|
|
31
|
+
return 'FormData';
|
|
32
|
+
}
|
|
33
|
+
if (!classFnOrObject) {
|
|
34
|
+
console.error('OBJECT OR CLASS', classFnOrObject);
|
|
35
|
+
throw new Error(`Cannot get name from this object or class.`);
|
|
36
|
+
}
|
|
37
|
+
return ((classFnOrObject[Symbols__NS__classNameStaticProperty]
|
|
38
|
+
? classFnOrObject[Symbols__NS__classNameStaticProperty]
|
|
39
|
+
: classFnOrObject?.constructor[Symbols__NS__classNameStaticProperty]) ||
|
|
40
|
+
(___NS__isFunction(classFnOrObject) ? CLASS.getName(classFnOrObject) : void 0));
|
|
28
41
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
export const ClassHelpers__NS__getOrginalClass = (classFnOrObject) => {
|
|
44
|
+
const org = classFnOrObject[Symbols__NS__orignalClass];
|
|
45
|
+
if (!org) {
|
|
46
|
+
return classFnOrObject;
|
|
47
|
+
}
|
|
48
|
+
return ClassHelpers__NS__getOrginalClass(org);
|
|
35
49
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
//#region get full internal name
|
|
51
|
+
export const ClassHelpers__NS__getFullInternalName = (classFnOrObject) => {
|
|
52
|
+
// exception for FormData
|
|
53
|
+
if (!classFnOrObject) {
|
|
54
|
+
throw new Error(`Cannot get name from: ${classFnOrObject}`);
|
|
55
|
+
}
|
|
56
|
+
return ((classFnOrObject[Symbols__NS__fullClassNameStaticProperty]
|
|
57
|
+
? classFnOrObject[Symbols__NS__fullClassNameStaticProperty]
|
|
58
|
+
: classFnOrObject?.constructor[Symbols__NS__fullClassNameStaticProperty]) ||
|
|
59
|
+
void 0);
|
|
41
60
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region get unique key
|
|
63
|
+
export const ClassHelpers__NS__getUniqueKey = (classFnOrObject) => {
|
|
64
|
+
const classFn = ___NS__isFunction(classFnOrObject)
|
|
65
|
+
? classFnOrObject
|
|
66
|
+
: classFnOrObject.constructor;
|
|
67
|
+
const config = Reflect.getMetadata(Symbols__NS__metadata.options.entity, classFn);
|
|
68
|
+
return config.uniqueKeyProp;
|
|
49
69
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region is class object
|
|
72
|
+
export const ClassHelpers__NS__isContextClassObject = (obj) => {
|
|
73
|
+
if (!___NS__isObject(obj) ||
|
|
74
|
+
___NS__isArray(obj) ||
|
|
75
|
+
___NS__isRegExp(obj) ||
|
|
76
|
+
___NS__isBuffer(obj) ||
|
|
77
|
+
___NS__isArrayBuffer(obj)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (___NS__isDate(obj)) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const className = ClassHelpers__NS__getName(obj);
|
|
84
|
+
return ___NS__isString(className) && className !== 'Object';
|
|
59
85
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region get name
|
|
88
|
+
export const ClassHelpers__NS__setName = (target, className) => {
|
|
89
|
+
// console.log('setName', className, target.name)
|
|
90
|
+
Validators__NS__classNameVlidation(className, target);
|
|
91
|
+
target[Symbols__NS__classNameStaticProperty] = className;
|
|
63
92
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region has parent with class name
|
|
95
|
+
export const ClassHelpers__NS__hasParentClassWithName = (target, className, targets = []) => {
|
|
96
|
+
if (!target) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
targets.push(target);
|
|
100
|
+
let targetProto = Object.getPrototypeOf(target);
|
|
101
|
+
if (___NS__isFunction(targetProto) &&
|
|
102
|
+
ClassHelpers__NS__getName(targetProto) === className) {
|
|
103
|
+
// console.log(`true "${___NS__first(targets).name}" for ${targets.map(d => d.name).join(',')}`)
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return ClassHelpers__NS__hasParentClassWithName(targetProto, className, targets);
|
|
74
107
|
};
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region get methods name
|
|
110
|
+
//#region not allowed as method name
|
|
75
111
|
const notAllowedAsMethodName = [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
'length',
|
|
113
|
+
'name',
|
|
114
|
+
'arguments',
|
|
115
|
+
'caller',
|
|
116
|
+
'constructor',
|
|
117
|
+
'apply',
|
|
118
|
+
'bind',
|
|
119
|
+
'call',
|
|
120
|
+
'toString',
|
|
121
|
+
'__defineGetter__',
|
|
122
|
+
'__defineSetter__',
|
|
123
|
+
'hasOwnProperty',
|
|
124
|
+
'__lookupGetter__',
|
|
125
|
+
'__lookupSetter__',
|
|
126
|
+
'isPrototypeOf',
|
|
127
|
+
'propertyIsEnumerable',
|
|
128
|
+
'valueOf',
|
|
129
|
+
'__proto__',
|
|
130
|
+
'toLocaleString',
|
|
95
131
|
];
|
|
96
|
-
|
|
97
|
-
|
|
132
|
+
//#endregion
|
|
133
|
+
/**
|
|
134
|
+
* Express async handler for middleware functions.
|
|
135
|
+
*/
|
|
136
|
+
export const ClassHelpers__NS__asyncHandler = fn => (req, res, next) => {
|
|
137
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
98
138
|
};
|
|
99
|
-
const ClassHelpers__NS__getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
139
|
+
export const ClassHelpers__NS__getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
140
|
+
if (!classOrClassInstance) {
|
|
141
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
142
|
+
}
|
|
143
|
+
const isClassFunction = ___NS__isFunction(classOrClassInstance);
|
|
144
|
+
const classFun = isClassFunction
|
|
145
|
+
? classOrClassInstance
|
|
146
|
+
: Object.getPrototypeOf(classOrClassInstance);
|
|
147
|
+
const objectToCheck = isClassFunction
|
|
148
|
+
? classOrClassInstance?.prototype
|
|
149
|
+
: classOrClassInstance;
|
|
150
|
+
const prototypeObj = Object.getPrototypeOf(objectToCheck || {});
|
|
151
|
+
const properties = ___NS__uniq([
|
|
152
|
+
...Object.getOwnPropertyNames(objectToCheck || {}),
|
|
153
|
+
...Object.getOwnPropertyNames(prototypeObj || {}),
|
|
154
|
+
...Object.keys(objectToCheck || {}),
|
|
155
|
+
...Object.keys(prototypeObj || {}),
|
|
156
|
+
]).filter(f => !!f && !notAllowedAsMethodName.includes(f));
|
|
157
|
+
properties
|
|
158
|
+
.filter(methodName => typeof objectToCheck[methodName] === 'function')
|
|
159
|
+
.forEach(p => allMethodsNames.push(p));
|
|
160
|
+
if (!classFun ||
|
|
161
|
+
!classFun.constructor ||
|
|
162
|
+
classFun?.constructor?.name === 'Object') {
|
|
163
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
164
|
+
}
|
|
165
|
+
return ClassHelpers__NS__getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
|
|
118
166
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region get controller configs
|
|
169
|
+
export const ClassHelpers__NS__getControllerConfigs = (target, configs = [], callerTarget) => {
|
|
170
|
+
if (!___NS__isFunction(target)) {
|
|
171
|
+
throw `[typescript-class-helper][getControllerConfigs] Cannot get class config from: ${target}`;
|
|
172
|
+
}
|
|
173
|
+
let config;
|
|
174
|
+
const parentClass = Object.getPrototypeOf(target);
|
|
175
|
+
const parentName = parentClass ? ClassHelpers__NS__getName(parentClass) : void 0;
|
|
176
|
+
const isValidParent = ___NS__isFunction(parentClass) && parentName !== '';
|
|
177
|
+
config = controllerConfigFrom(ClassHelpers__NS__getClassConfig(target));
|
|
178
|
+
configs.push(config);
|
|
179
|
+
return isValidParent
|
|
180
|
+
? ClassHelpers__NS__getControllerConfigs(parentClass, configs, target)
|
|
181
|
+
: configs;
|
|
130
182
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region ensure configs
|
|
185
|
+
// Ensure ClassConfig on constructor, clone parent if needed
|
|
186
|
+
export const ClassHelpers__NS__ensureClassConfig = (target) => {
|
|
187
|
+
let cfg = Reflect.getOwnMetadata(Symbols__NS__metadata.options.controller, // META_KEYS.class,
|
|
188
|
+
target);
|
|
189
|
+
if (!cfg) {
|
|
190
|
+
cfg = { methods: {} };
|
|
191
|
+
const parent = Object.getPrototypeOf(target);
|
|
192
|
+
if (parent && parent !== Function.prototype) {
|
|
193
|
+
const parentCfg = Reflect.getMetadata(Symbols__NS__metadata.options.controller, // META_KEYS.class,
|
|
194
|
+
parent);
|
|
195
|
+
if (parentCfg) {
|
|
196
|
+
// Deep copy each method config so child gets its own objects
|
|
197
|
+
const clonedMethods = {};
|
|
198
|
+
for (const [k, v] of Object.entries(parentCfg.methods)) {
|
|
199
|
+
clonedMethods[k] = {
|
|
200
|
+
...v,
|
|
201
|
+
parameters: { ...v.parameters }, // shallow clone parameters too
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
cfg = {
|
|
205
|
+
...parentCfg,
|
|
206
|
+
methods: clonedMethods,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
154
209
|
}
|
|
155
|
-
cfg
|
|
156
|
-
...parentCfg,
|
|
157
|
-
methods: clonedMethods
|
|
158
|
-
};
|
|
159
|
-
}
|
|
210
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.controller, cfg, target);
|
|
160
211
|
}
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
return cfg;
|
|
164
|
-
};
|
|
165
|
-
const ClassHelpers__NS__ensureMethodConfig = (target, propertyKey) => {
|
|
166
|
-
const classCfg = ClassHelpers__NS__ensureClassConfig(target.constructor);
|
|
167
|
-
let methodCfg = classCfg.methods[propertyKey?.toString()];
|
|
168
|
-
if (!methodCfg) {
|
|
169
|
-
methodCfg = { methodName: propertyKey?.toString(), parameters: {} };
|
|
170
|
-
classCfg.methods[propertyKey?.toString()] = methodCfg;
|
|
171
|
-
}
|
|
172
|
-
return methodCfg;
|
|
212
|
+
return cfg;
|
|
173
213
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
214
|
+
// Ensure MethodConfig inside ClassConfig
|
|
215
|
+
export const ClassHelpers__NS__ensureMethodConfig = (target, propertyKey) => {
|
|
216
|
+
const classCfg = ClassHelpers__NS__ensureClassConfig(target.constructor);
|
|
217
|
+
let methodCfg = classCfg.methods[propertyKey?.toString()];
|
|
218
|
+
if (!methodCfg) {
|
|
219
|
+
methodCfg = { methodName: propertyKey?.toString(), parameters: {} };
|
|
220
|
+
classCfg.methods[propertyKey?.toString()] = methodCfg;
|
|
221
|
+
}
|
|
222
|
+
return methodCfg;
|
|
179
223
|
};
|
|
180
|
-
export {
|
|
181
|
-
|
|
182
|
-
ClassHelpers__NS__ensureClassConfig,
|
|
183
|
-
ClassHelpers__NS__ensureMethodConfig,
|
|
184
|
-
ClassHelpers__NS__getClassConfig,
|
|
185
|
-
ClassHelpers__NS__getClassFnFromObject,
|
|
186
|
-
ClassHelpers__NS__getControllerConfigs,
|
|
187
|
-
ClassHelpers__NS__getFullInternalName,
|
|
188
|
-
ClassHelpers__NS__getMethodsNames,
|
|
189
|
-
ClassHelpers__NS__getName,
|
|
190
|
-
ClassHelpers__NS__getOrginalClass,
|
|
191
|
-
ClassHelpers__NS__getUniqueKey,
|
|
192
|
-
ClassHelpers__NS__hasParentClassWithName,
|
|
193
|
-
ClassHelpers__NS__isContextClassObject,
|
|
194
|
-
ClassHelpers__NS__setName
|
|
224
|
+
export const ClassHelpers__NS__getClassConfig = (constructor) => {
|
|
225
|
+
return Reflect.getMetadata(Symbols__NS__metadata.options.controller, constructor);
|
|
195
226
|
};
|
|
227
|
+
//#endregion
|
|
228
|
+
//end of namespace ClassHelpers
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { walk } from
|
|
2
|
-
import { ___NS__cloneDeep, ___NS__isFunction, ___NS__isNil, ___NS__isObject, ___NS__merge, ___NS__set } from
|
|
3
|
-
const cloneObj = (override, classFn) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
cloneObj
|
|
1
|
+
import { walk } from 'lodash-walk-object/lib-prod';
|
|
2
|
+
import { ___NS__cloneDeep, ___NS__isFunction, ___NS__isNil, ___NS__isObject, ___NS__merge, ___NS__set } from 'tnp-core/lib-prod';
|
|
3
|
+
export const cloneObj = (override, classFn) => {
|
|
4
|
+
const result = ___NS__merge(new classFn(), ___NS__cloneDeep(this));
|
|
5
|
+
walk.Object(override || {}, (value, lodashPath) => {
|
|
6
|
+
if (___NS__isNil(value) || ___NS__isFunction(value) || ___NS__isObject(value)) {
|
|
7
|
+
// skipping
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
___NS__set(result, lodashPath, value);
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
walkGetters: false,
|
|
14
|
+
});
|
|
15
|
+
// console.log({result})
|
|
16
|
+
return result;
|
|
21
17
|
};
|