taon 21.0.52 → 21.0.53
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 +33 -0
- package/lib-prod/base-classes/base-angular-service.js +56 -0
- package/lib-prod/base-classes/base-class.js +37 -0
- package/lib-prod/base-classes/base-context.js +21 -0
- package/lib-prod/base-classes/base-controller.js +162 -0
- package/lib-prod/base-classes/base-crud-controller.js +235 -0
- package/lib-prod/base-classes/base-custom-repository.js +20 -0
- package/lib-prod/base-classes/base-electron-service.js +0 -0
- package/lib-prod/base-classes/base-entity.js +32 -0
- package/lib-prod/base-classes/base-file-upload.middleware.js +78 -0
- package/lib-prod/base-classes/base-injector.js +202 -0
- package/lib-prod/base-classes/base-middleware.js +6 -0
- package/lib-prod/base-classes/base-migration.js +23 -0
- package/lib-prod/base-classes/base-provider.js +6 -0
- package/lib-prod/base-classes/base-repository.js +589 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.js +154 -0
- package/lib-prod/base-classes/base.js +0 -0
- package/lib-prod/build-info._auto-generated_.js +14 -0
- package/lib-prod/config/controller-config.js +28 -0
- package/lib-prod/config/controller-options.js +6 -0
- package/lib-prod/config/method-config.js +9 -0
- package/lib-prod/config/param-config.js +9 -0
- package/lib-prod/constants.js +29 -0
- package/lib-prod/context-db-migrations.js +339 -0
- package/lib-prod/create-context.js +152 -0
- package/lib-prod/decorators/classes/controller-decorator.js +21 -0
- package/lib-prod/decorators/classes/entity-decorator.js +49 -0
- package/lib-prod/decorators/classes/middleware-decorator.js +26 -0
- package/lib-prod/decorators/classes/migration-decorator.js +24 -0
- package/lib-prod/decorators/classes/provider-decorator.js +25 -0
- package/lib-prod/decorators/classes/repository-decorator.js +24 -0
- package/lib-prod/decorators/classes/subscriber-decorator.js +25 -0
- package/lib-prod/decorators/decorator-abstract-opt.js +5 -0
- package/lib-prod/decorators/http/http-decorators.js +5 -0
- package/lib-prod/decorators/http/http-methods-decorators.js +144 -0
- package/lib-prod/decorators/http/http-params-decorators.js +68 -0
- package/lib-prod/dependency-injection/di-container.js +31 -0
- package/lib-prod/endpoint-context-storage.js +36 -0
- package/lib-prod/endpoint-context.js +2033 -0
- package/lib-prod/entity-process.js +214 -0
- package/lib-prod/env/env.angular-node-app.js +130 -0
- package/lib-prod/env/env.docs-webapp.js +130 -0
- package/lib-prod/env/env.electron-app.js +130 -0
- package/lib-prod/env/env.mobile-app.js +130 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -0
- package/lib-prod/env/env.vscode-plugin.js +130 -0
- package/lib-prod/env/index.js +6 -0
- package/lib-prod/express-types.js +0 -0
- package/lib-prod/formly/formly.models.js +0 -0
- package/lib-prod/formly/fromly.js +184 -0
- package/lib-prod/formly/type-from-entity.js +58 -0
- package/lib-prod/get-response-value.js +19 -0
- package/lib-prod/global-state/taon-global-state/index.js +5 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +20 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +10 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +34 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +47 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +11 -0
- package/lib-prod/global-state/taon-transaction-registry/index.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +8 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +41 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +56 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +36 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +6 -0
- package/lib-prod/helpers/class-helpers.js +195 -0
- package/lib-prod/helpers/clone-obj.js +21 -0
- package/lib-prod/helpers/taon-helpers.js +129 -0
- package/lib-prod/index._auto-generated_.js +0 -0
- package/lib-prod/index.js +231 -0
- package/lib-prod/inject.js +34 -0
- package/lib-prod/migrations/index.js +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -0
- package/lib-prod/models.js +109 -0
- package/lib-prod/orm/columns.js +124 -0
- package/lib-prod/orm/index.js +1 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +196 -0
- package/lib-prod/realtime/realtime-core.js +82 -0
- package/lib-prod/realtime/realtime-server.js +252 -0
- package/lib-prod/realtime/realtime-strategy/index.js +4 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +226 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +262 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +21 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +14 -0
- package/lib-prod/realtime/realtime-subs-manager.js +96 -0
- package/lib-prod/realtime/realtime.models.js +0 -0
- package/lib-prod/symbols.js +109 -0
- package/lib-prod/ui/index.js +5 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +5 -0
- package/lib-prod/validators.js +74 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/base-classes/base-abstract-entity.ts +0 -34
- package/lib-prod/base-classes/base-angular-service.ts +0 -107
- package/lib-prod/base-classes/base-class.ts +0 -46
- package/lib-prod/base-classes/base-context.ts +0 -21
- package/lib-prod/base-classes/base-controller.ts +0 -240
- package/lib-prod/base-classes/base-crud-controller.ts +0 -298
- package/lib-prod/base-classes/base-custom-repository.ts +0 -10
- package/lib-prod/base-classes/base-electron-service.ts +0 -60
- package/lib-prod/base-classes/base-entity.ts +0 -28
- package/lib-prod/base-classes/base-file-upload.middleware.ts +0 -92
- package/lib-prod/base-classes/base-injector.ts +0 -278
- package/lib-prod/base-classes/base-middleware.ts +0 -71
- package/lib-prod/base-classes/base-migration.ts +0 -26
- package/lib-prod/base-classes/base-provider.ts +0 -8
- package/lib-prod/base-classes/base-repository.ts +0 -942
- package/lib-prod/base-classes/base-subscriber-for-entity.ts +0 -196
- package/lib-prod/base-classes/base.ts +0 -31
- package/lib-prod/build-info._auto-generated_.ts +0 -27
- package/lib-prod/config/controller-config.ts +0 -58
- package/lib-prod/config/controller-options.ts +0 -19
- package/lib-prod/config/method-config.ts +0 -55
- package/lib-prod/config/param-config.ts +0 -16
- package/lib-prod/constants.ts +0 -63
- package/lib-prod/context-db-migrations.ts +0 -488
- package/lib-prod/create-context.ts +0 -345
- package/lib-prod/decorators/classes/controller-decorator.ts +0 -25
- package/lib-prod/decorators/classes/entity-decorator.ts +0 -57
- package/lib-prod/decorators/classes/middleware-decorator.ts +0 -29
- package/lib-prod/decorators/classes/migration-decorator.ts +0 -27
- package/lib-prod/decorators/classes/provider-decorator.ts +0 -28
- package/lib-prod/decorators/classes/repository-decorator.ts +0 -26
- package/lib-prod/decorators/classes/subscriber-decorator.ts +0 -28
- package/lib-prod/decorators/decorator-abstract-opt.ts +0 -4
- package/lib-prod/decorators/http/http-decorators.ts +0 -26
- package/lib-prod/decorators/http/http-methods-decorators.ts +0 -275
- package/lib-prod/decorators/http/http-params-decorators.ts +0 -105
- package/lib-prod/dependency-injection/di-container.ts +0 -39
- package/lib-prod/endpoint-context-storage.ts +0 -47
- package/lib-prod/endpoint-context.ts +0 -3110
- package/lib-prod/entity-process.ts +0 -286
- package/lib-prod/env/env.angular-node-app.ts +0 -66
- package/lib-prod/env/env.docs-webapp.ts +0 -66
- package/lib-prod/env/env.electron-app.ts +0 -66
- package/lib-prod/env/env.mobile-app.ts +0 -66
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +0 -66
- package/lib-prod/env/env.vscode-plugin.ts +0 -66
- package/lib-prod/env/index.ts +0 -6
- package/lib-prod/express-types.ts +0 -4
- package/lib-prod/formly/formly.models.ts +0 -7
- package/lib-prod/formly/fromly.ts +0 -261
- package/lib-prod/formly/type-from-entity.ts +0 -80
- package/lib-prod/get-response-value.ts +0 -30
- package/lib-prod/global-state/taon-global-state/index.ts +0 -6
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.ts +0 -21
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.ts +0 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.ts +0 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.ts +0 -40
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.ts +0 -12
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.ts +0 -48
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.ts +0 -16
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.ts +0 -47
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.ts +0 -18
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.ts +0 -21
- package/lib-prod/global-state/taon-transaction-registry/index.ts +0 -11
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.ts +0 -23
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.ts +0 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.ts +0 -38
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.ts +0 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.ts +0 -12
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.ts +0 -6
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.ts +0 -16
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.ts +0 -29
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.ts +0 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.ts +0 -9
- package/lib-prod/helpers/class-helpers.ts +0 -315
- package/lib-prod/helpers/clone-obj.ts +0 -24
- package/lib-prod/helpers/taon-helpers.ts +0 -181
- package/lib-prod/index._auto-generated_.ts +0 -5
- package/lib-prod/index.ts +0 -323
- package/lib-prod/inject.ts +0 -111
- package/lib-prod/lib-info.md +0 -8
- package/lib-prod/migrations/index.ts +0 -2
- package/lib-prod/migrations/migrations-info.md +0 -6
- package/lib-prod/migrations/migrations_index._auto-generated_.ts +0 -5
- package/lib-prod/models.ts +0 -427
- package/lib-prod/orm/columns.ts +0 -121
- package/lib-prod/orm/index.ts +0 -62
- package/lib-prod/realtime/realtime-client.ts +0 -288
- package/lib-prod/realtime/realtime-core.ts +0 -134
- package/lib-prod/realtime/realtime-server.ts +0 -398
- package/lib-prod/realtime/realtime-strategy/index.ts +0 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.ts +0 -344
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.ts +0 -349
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.ts +0 -30
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.ts +0 -21
- package/lib-prod/realtime/realtime-subs-manager.ts +0 -127
- package/lib-prod/realtime/realtime.models.ts +0 -33
- package/lib-prod/symbols.ts +0 -136
- package/lib-prod/ui/index.ts +0 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.ts +0 -1
- package/lib-prod/validators.ts +0 -103
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import * as FormData from "form-data";
|
|
2
|
+
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";
|
|
3
|
+
import { CLASS } from "typescript-class-helpers/lib-prod";
|
|
4
|
+
import {
|
|
5
|
+
controllerConfigFrom
|
|
6
|
+
} from "../config/controller-config";
|
|
7
|
+
import { Symbols__NS__classNameStaticProperty, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__orignalClass } from "../symbols";
|
|
8
|
+
import { Validators__NS__classNameVlidation } from "../validators";
|
|
9
|
+
const ClassHelpers__NS__getClassFnFromObject = (json) => {
|
|
10
|
+
if (___NS__isUndefined(json) || ___NS__isNull(json)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (json.constructor) {
|
|
14
|
+
return json.constructor;
|
|
15
|
+
}
|
|
16
|
+
const p = Object.getPrototypeOf(json);
|
|
17
|
+
return p && p.constructor && p.constructor.name !== "Object" ? p.constructor : void 0;
|
|
18
|
+
};
|
|
19
|
+
const ClassHelpers__NS__getName = (classFnOrObject) => {
|
|
20
|
+
if (classFnOrObject instanceof FormData) {
|
|
21
|
+
return "FormData";
|
|
22
|
+
}
|
|
23
|
+
if (!classFnOrObject) {
|
|
24
|
+
console.error("OBJECT OR CLASS", classFnOrObject);
|
|
25
|
+
throw new Error(`Cannot get name from this object or class.`);
|
|
26
|
+
}
|
|
27
|
+
return (classFnOrObject[Symbols__NS__classNameStaticProperty] ? classFnOrObject[Symbols__NS__classNameStaticProperty] : classFnOrObject?.constructor[Symbols__NS__classNameStaticProperty]) || (___NS__isFunction(classFnOrObject) ? CLASS.getName(classFnOrObject) : void 0);
|
|
28
|
+
};
|
|
29
|
+
const ClassHelpers__NS__getOrginalClass = (classFnOrObject) => {
|
|
30
|
+
const org = classFnOrObject[Symbols__NS__orignalClass];
|
|
31
|
+
if (!org) {
|
|
32
|
+
return classFnOrObject;
|
|
33
|
+
}
|
|
34
|
+
return ClassHelpers__NS__getOrginalClass(org);
|
|
35
|
+
};
|
|
36
|
+
const ClassHelpers__NS__getFullInternalName = (classFnOrObject) => {
|
|
37
|
+
if (!classFnOrObject) {
|
|
38
|
+
throw new Error(`Cannot get name from: ${classFnOrObject}`);
|
|
39
|
+
}
|
|
40
|
+
return (classFnOrObject[Symbols__NS__fullClassNameStaticProperty] ? classFnOrObject[Symbols__NS__fullClassNameStaticProperty] : classFnOrObject?.constructor[Symbols__NS__fullClassNameStaticProperty]) || void 0;
|
|
41
|
+
};
|
|
42
|
+
const ClassHelpers__NS__getUniqueKey = (classFnOrObject) => {
|
|
43
|
+
const classFn = ___NS__isFunction(classFnOrObject) ? classFnOrObject : classFnOrObject.constructor;
|
|
44
|
+
const config = Reflect.getMetadata(
|
|
45
|
+
Symbols__NS__metadata.options.entity,
|
|
46
|
+
classFn
|
|
47
|
+
);
|
|
48
|
+
return config.uniqueKeyProp;
|
|
49
|
+
};
|
|
50
|
+
const ClassHelpers__NS__isContextClassObject = (obj) => {
|
|
51
|
+
if (!___NS__isObject(obj) || ___NS__isArray(obj) || ___NS__isRegExp(obj) || ___NS__isBuffer(obj) || ___NS__isArrayBuffer(obj)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (___NS__isDate(obj)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
const className = ClassHelpers__NS__getName(obj);
|
|
58
|
+
return ___NS__isString(className) && className !== "Object";
|
|
59
|
+
};
|
|
60
|
+
const ClassHelpers__NS__setName = (target, className) => {
|
|
61
|
+
Validators__NS__classNameVlidation(className, target);
|
|
62
|
+
target[Symbols__NS__classNameStaticProperty] = className;
|
|
63
|
+
};
|
|
64
|
+
const ClassHelpers__NS__hasParentClassWithName = (target, className, targets = []) => {
|
|
65
|
+
if (!target) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
targets.push(target);
|
|
69
|
+
let targetProto = Object.getPrototypeOf(target);
|
|
70
|
+
if (___NS__isFunction(targetProto) && ClassHelpers__NS__getName(targetProto) === className) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return ClassHelpers__NS__hasParentClassWithName(targetProto, className, targets);
|
|
74
|
+
};
|
|
75
|
+
const notAllowedAsMethodName = [
|
|
76
|
+
"length",
|
|
77
|
+
"name",
|
|
78
|
+
"arguments",
|
|
79
|
+
"caller",
|
|
80
|
+
"constructor",
|
|
81
|
+
"apply",
|
|
82
|
+
"bind",
|
|
83
|
+
"call",
|
|
84
|
+
"toString",
|
|
85
|
+
"__defineGetter__",
|
|
86
|
+
"__defineSetter__",
|
|
87
|
+
"hasOwnProperty",
|
|
88
|
+
"__lookupGetter__",
|
|
89
|
+
"__lookupSetter__",
|
|
90
|
+
"isPrototypeOf",
|
|
91
|
+
"propertyIsEnumerable",
|
|
92
|
+
"valueOf",
|
|
93
|
+
"__proto__",
|
|
94
|
+
"toLocaleString"
|
|
95
|
+
];
|
|
96
|
+
const ClassHelpers__NS__asyncHandler = (fn) => (req, res, next) => {
|
|
97
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
98
|
+
};
|
|
99
|
+
const ClassHelpers__NS__getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
100
|
+
if (!classOrClassInstance) {
|
|
101
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
102
|
+
}
|
|
103
|
+
const isClassFunction = ___NS__isFunction(classOrClassInstance);
|
|
104
|
+
const classFun = isClassFunction ? classOrClassInstance : Object.getPrototypeOf(classOrClassInstance);
|
|
105
|
+
const objectToCheck = isClassFunction ? classOrClassInstance?.prototype : classOrClassInstance;
|
|
106
|
+
const prototypeObj = Object.getPrototypeOf(objectToCheck || {});
|
|
107
|
+
const properties = ___NS__uniq([
|
|
108
|
+
...Object.getOwnPropertyNames(objectToCheck || {}),
|
|
109
|
+
...Object.getOwnPropertyNames(prototypeObj || {}),
|
|
110
|
+
...Object.keys(objectToCheck || {}),
|
|
111
|
+
...Object.keys(prototypeObj || {})
|
|
112
|
+
]).filter((f) => !!f && !notAllowedAsMethodName.includes(f));
|
|
113
|
+
properties.filter((methodName) => typeof objectToCheck[methodName] === "function").forEach((p) => allMethodsNames.push(p));
|
|
114
|
+
if (!classFun || !classFun.constructor || classFun?.constructor?.name === "Object") {
|
|
115
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
116
|
+
}
|
|
117
|
+
return ClassHelpers__NS__getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
|
|
118
|
+
};
|
|
119
|
+
const ClassHelpers__NS__getControllerConfigs = (target, configs = [], callerTarget) => {
|
|
120
|
+
if (!___NS__isFunction(target)) {
|
|
121
|
+
throw `[typescript-class-helper][getControllerConfigs] Cannot get class config from: ${target}`;
|
|
122
|
+
}
|
|
123
|
+
let config;
|
|
124
|
+
const parentClass = Object.getPrototypeOf(target);
|
|
125
|
+
const parentName = parentClass ? ClassHelpers__NS__getName(parentClass) : void 0;
|
|
126
|
+
const isValidParent = ___NS__isFunction(parentClass) && parentName !== "";
|
|
127
|
+
config = controllerConfigFrom(ClassHelpers__NS__getClassConfig(target));
|
|
128
|
+
configs.push(config);
|
|
129
|
+
return isValidParent ? ClassHelpers__NS__getControllerConfigs(parentClass, configs, target) : configs;
|
|
130
|
+
};
|
|
131
|
+
const ClassHelpers__NS__ensureClassConfig = (target) => {
|
|
132
|
+
let cfg = Reflect.getOwnMetadata(
|
|
133
|
+
Symbols__NS__metadata.options.controller,
|
|
134
|
+
// META_KEYS.class,
|
|
135
|
+
target
|
|
136
|
+
);
|
|
137
|
+
if (!cfg) {
|
|
138
|
+
cfg = { methods: {} };
|
|
139
|
+
const parent = Object.getPrototypeOf(target);
|
|
140
|
+
if (parent && parent !== Function.prototype) {
|
|
141
|
+
const parentCfg = Reflect.getMetadata(
|
|
142
|
+
Symbols__NS__metadata.options.controller,
|
|
143
|
+
// META_KEYS.class,
|
|
144
|
+
parent
|
|
145
|
+
);
|
|
146
|
+
if (parentCfg) {
|
|
147
|
+
const clonedMethods = {};
|
|
148
|
+
for (const [k, v] of Object.entries(parentCfg.methods)) {
|
|
149
|
+
clonedMethods[k] = {
|
|
150
|
+
...v,
|
|
151
|
+
parameters: { ...v.parameters }
|
|
152
|
+
// shallow clone parameters too
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
cfg = {
|
|
156
|
+
...parentCfg,
|
|
157
|
+
methods: clonedMethods
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.controller, cfg, target);
|
|
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;
|
|
173
|
+
};
|
|
174
|
+
const ClassHelpers__NS__getClassConfig = (constructor) => {
|
|
175
|
+
return Reflect.getMetadata(
|
|
176
|
+
Symbols__NS__metadata.options.controller,
|
|
177
|
+
constructor
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
ClassHelpers__NS__asyncHandler,
|
|
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
|
|
195
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
const cloneObj = (override, classFn) => {
|
|
4
|
+
const result = ___NS__merge(new classFn(), ___NS__cloneDeep(void 0));
|
|
5
|
+
walk.Object(
|
|
6
|
+
override || {},
|
|
7
|
+
(value, lodashPath) => {
|
|
8
|
+
if (___NS__isNil(value) || ___NS__isFunction(value) || ___NS__isObject(value)) {
|
|
9
|
+
} else {
|
|
10
|
+
___NS__set(result, lodashPath, value);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
walkGetters: false
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
cloneObj
|
|
21
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as JSON5 from "json5";
|
|
2
|
+
import { ___NS__cloneDeep, ___NS__first, ___NS__isObject, ___NS__times } from "tnp-core/lib-prod";
|
|
3
|
+
import { ClassHelpers__NS__getName } from "./class-helpers";
|
|
4
|
+
const TaonHelpers__NS__fillUpTo = (s, nCharacters) => {
|
|
5
|
+
return ___NS__times(nCharacters, (n) => {
|
|
6
|
+
if (s.charAt(n)) {
|
|
7
|
+
return s.charAt(n);
|
|
8
|
+
}
|
|
9
|
+
return " ";
|
|
10
|
+
}).join("");
|
|
11
|
+
};
|
|
12
|
+
const TaonHelpers__NS__isGoodPath = (p) => {
|
|
13
|
+
return p && typeof p === "string" && p.trim() !== "";
|
|
14
|
+
};
|
|
15
|
+
const TaonHelpers__NS__firstStringOrElemFromArray = (stringOrArrayOfString) => {
|
|
16
|
+
if (Array.isArray(stringOrArrayOfString)) {
|
|
17
|
+
return ___NS__first(stringOrArrayOfString);
|
|
18
|
+
}
|
|
19
|
+
return stringOrArrayOfString;
|
|
20
|
+
};
|
|
21
|
+
const TaonHelpers__NS__tryTransformParam = (param) => {
|
|
22
|
+
if (typeof param === "string") {
|
|
23
|
+
let n = Number(param);
|
|
24
|
+
if (!isNaN(n)) return n;
|
|
25
|
+
const bool = param.trim().toLowerCase();
|
|
26
|
+
if (bool === "true") {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (bool === "false") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const t = JSON5.parse(param);
|
|
34
|
+
return t;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return param;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return param;
|
|
40
|
+
};
|
|
41
|
+
const TaonHelpers__NS__getExpressPath = (c, pathOrClassConfig) => {
|
|
42
|
+
if (typeof pathOrClassConfig === "string")
|
|
43
|
+
return `${c.calculatedPath}${pathOrClassConfig}`.replace(/\/$/, "");
|
|
44
|
+
return `${c.calculatedPath}${pathOrClassConfig.path}`.replace(/\/$/, "");
|
|
45
|
+
};
|
|
46
|
+
const TaonHelpers__NS__defaultType = (value) => {
|
|
47
|
+
if (typeof value === "string") return "";
|
|
48
|
+
if (typeof value === "boolean") return false;
|
|
49
|
+
if (Array.isArray(value)) return {};
|
|
50
|
+
if (typeof value === "object") return {};
|
|
51
|
+
};
|
|
52
|
+
const TaonHelpers__NS__parseJSONwithStringJSONs = (object, waring = false) => {
|
|
53
|
+
if (!___NS__isObject(object)) {
|
|
54
|
+
if (waring) {
|
|
55
|
+
console.error(
|
|
56
|
+
`
|
|
57
|
+
parseJSONwithStringJSONs(...)
|
|
58
|
+
Parameter should be a object, but is ${typeof object}
|
|
59
|
+
`,
|
|
60
|
+
object
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return object;
|
|
64
|
+
}
|
|
65
|
+
let res = ___NS__cloneDeep(object);
|
|
66
|
+
Object.keys(res).forEach((key) => {
|
|
67
|
+
let isJson = false;
|
|
68
|
+
try {
|
|
69
|
+
const possibleJSON = JSON.parse(res[key]);
|
|
70
|
+
res[key] = possibleJSON;
|
|
71
|
+
isJson = true;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
isJson = false;
|
|
74
|
+
}
|
|
75
|
+
if (isJson) {
|
|
76
|
+
res[key] = TaonHelpers__NS__parseJSONwithStringJSONs(res[key], false);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return res;
|
|
80
|
+
};
|
|
81
|
+
const TaonHelpers__NS__isPlainFileOrFolder = (filePath) => {
|
|
82
|
+
return /^([a-zA-Z]|\-|\_|\@|\#|\$|\!|\^|\&|\*|\(|\))+$/.test(filePath);
|
|
83
|
+
};
|
|
84
|
+
const TaonHelpers__NS__ipcKeyNameResponse = (target, methodConfig, expressPath) => {
|
|
85
|
+
return [
|
|
86
|
+
"response",
|
|
87
|
+
ClassHelpers__NS__getName(target),
|
|
88
|
+
methodConfig.methodName,
|
|
89
|
+
methodConfig.type,
|
|
90
|
+
expressPath
|
|
91
|
+
].join("--");
|
|
92
|
+
};
|
|
93
|
+
const TaonHelpers__NS__ipcKeyNameRequest = (target, methodConfig, expressPath) => {
|
|
94
|
+
return [
|
|
95
|
+
"request",
|
|
96
|
+
ClassHelpers__NS__getName(target),
|
|
97
|
+
methodConfig.methodName,
|
|
98
|
+
methodConfig.type,
|
|
99
|
+
expressPath
|
|
100
|
+
].join("--");
|
|
101
|
+
};
|
|
102
|
+
const TaonHelpers__NS__websqlMocks = (headers) => {
|
|
103
|
+
const response = {
|
|
104
|
+
status(status) {
|
|
105
|
+
return {
|
|
106
|
+
send(send) {
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
setHeader(key, value) {
|
|
111
|
+
headers[key] = value;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const request = {};
|
|
115
|
+
return { request, response };
|
|
116
|
+
};
|
|
117
|
+
export {
|
|
118
|
+
TaonHelpers__NS__defaultType,
|
|
119
|
+
TaonHelpers__NS__fillUpTo,
|
|
120
|
+
TaonHelpers__NS__firstStringOrElemFromArray,
|
|
121
|
+
TaonHelpers__NS__getExpressPath,
|
|
122
|
+
TaonHelpers__NS__ipcKeyNameRequest,
|
|
123
|
+
TaonHelpers__NS__ipcKeyNameResponse,
|
|
124
|
+
TaonHelpers__NS__isGoodPath,
|
|
125
|
+
TaonHelpers__NS__isPlainFileOrFolder,
|
|
126
|
+
TaonHelpers__NS__parseJSONwithStringJSONs,
|
|
127
|
+
TaonHelpers__NS__tryTransformParam,
|
|
128
|
+
TaonHelpers__NS__websqlMocks
|
|
129
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { UtilsOs__NS__isBrowser, UtilsOs__NS__isElectron, UtilsOs__NS__isNode, UtilsOs__NS__isWebSQL } from "tnp-core/lib-prod";
|
|
3
|
+
import * as createContextFn from "./create-context";
|
|
4
|
+
import * as getResponse from "./get-response-value";
|
|
5
|
+
import * as injectFn from "./inject";
|
|
6
|
+
export * from "./constants";
|
|
7
|
+
export * from "./context-db-migrations";
|
|
8
|
+
export * from "./create-context";
|
|
9
|
+
export * from "./endpoint-context-storage";
|
|
10
|
+
export * from "./endpoint-context";
|
|
11
|
+
export * from "./entity-process";
|
|
12
|
+
export * from "./get-response-value";
|
|
13
|
+
export * from "./inject";
|
|
14
|
+
export * from "./models";
|
|
15
|
+
export * from "./symbols";
|
|
16
|
+
export * from "./validators";
|
|
17
|
+
export * from "./base-classes/base-abstract-entity";
|
|
18
|
+
export * from "./base-classes/base-angular-service";
|
|
19
|
+
export * from "./base-classes/base-class";
|
|
20
|
+
export * from "./base-classes/base-context";
|
|
21
|
+
export * from "./base-classes/base-controller";
|
|
22
|
+
export * from "./base-classes/base-crud-controller";
|
|
23
|
+
export * from "./base-classes/base-custom-repository";
|
|
24
|
+
export * from "./base-classes/base-entity";
|
|
25
|
+
export * from "./base-classes/base-file-upload.middleware";
|
|
26
|
+
export * from "./base-classes/base-injector";
|
|
27
|
+
export * from "./base-classes/base-middleware";
|
|
28
|
+
export * from "./base-classes/base-migration";
|
|
29
|
+
export * from "./base-classes/base-provider";
|
|
30
|
+
export * from "./base-classes/base-repository";
|
|
31
|
+
export * from "./base-classes/base-subscriber-for-entity";
|
|
32
|
+
export * from "./config/controller-config";
|
|
33
|
+
export * from "./config/controller-options";
|
|
34
|
+
export * from "./config/method-config";
|
|
35
|
+
export * from "./config/param-config";
|
|
36
|
+
export * from "./decorators/decorator-abstract-opt";
|
|
37
|
+
export * from "./dependency-injection/di-container";
|
|
38
|
+
export * from "./helpers/class-helpers";
|
|
39
|
+
export * from "./helpers/clone-obj";
|
|
40
|
+
export * from "./helpers/taon-helpers";
|
|
41
|
+
export * from "./orm/columns";
|
|
42
|
+
export * from "./realtime/realtime-client";
|
|
43
|
+
export * from "./realtime/realtime-core";
|
|
44
|
+
export * from "./realtime/realtime-server";
|
|
45
|
+
export * from "./realtime/realtime-subs-manager";
|
|
46
|
+
export * from "./realtime/realtime.models";
|
|
47
|
+
export * from "./decorators/classes/controller-decorator";
|
|
48
|
+
export * from "./decorators/classes/entity-decorator";
|
|
49
|
+
export * from "./decorators/classes/middleware-decorator";
|
|
50
|
+
export * from "./decorators/classes/migration-decorator";
|
|
51
|
+
export * from "./decorators/classes/provider-decorator";
|
|
52
|
+
export * from "./decorators/classes/repository-decorator";
|
|
53
|
+
export * from "./decorators/classes/subscriber-decorator";
|
|
54
|
+
export * from "./decorators/http/http-methods-decorators";
|
|
55
|
+
export * from "./decorators/http/http-params-decorators";
|
|
56
|
+
export * from "./realtime/realtime-strategy/realtime-strategy-ipc";
|
|
57
|
+
export * from "./realtime/realtime-strategy/realtime-strategy-mock";
|
|
58
|
+
export * from "./realtime/realtime-strategy/realtime-strategy-socket-io";
|
|
59
|
+
export * from "./realtime/realtime-strategy/realtime-strategy";
|
|
60
|
+
const Taon__NS__removeLoader = (afterMS = 0) => {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
globalThis?.window?.document?.getElementById("taonpreloadertoremove")?.remove();
|
|
64
|
+
const body = globalThis?.window?.document?.body;
|
|
65
|
+
if (body && body.style) {
|
|
66
|
+
body.style.backgroundColor = "";
|
|
67
|
+
}
|
|
68
|
+
resolve();
|
|
69
|
+
}, afterMS);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const Taon__NS__error = (opt) => {
|
|
73
|
+
throw () => {
|
|
74
|
+
if (typeof opt === "string") {
|
|
75
|
+
opt = {
|
|
76
|
+
message: opt
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return opt;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const Taon__NS__getResponseValue = getResponse.getResponseValue;
|
|
83
|
+
const Taon__NS__isBrowser = UtilsOs__NS__isBrowser;
|
|
84
|
+
const Taon__NS__isNode = UtilsOs__NS__isNode;
|
|
85
|
+
const Taon__NS__isWebSQL = UtilsOs__NS__isWebSQL;
|
|
86
|
+
const Taon__NS__isElectron = UtilsOs__NS__isElectron;
|
|
87
|
+
const Taon__NS__createContext = createContextFn.createContext;
|
|
88
|
+
const Taon__NS__createContextTemplate = createContextFn.createContextTemplate;
|
|
89
|
+
const Taon__NS__inject = injectFn.inject;
|
|
90
|
+
const Taon__NS__init = async (options) => {
|
|
91
|
+
const TaonBaseContext = (await import("./base-classes/base-context")).TaonBaseContext;
|
|
92
|
+
const context = Taon__NS__createContext(() => ({
|
|
93
|
+
appId: "default-app-not-used-anymore",
|
|
94
|
+
contextName: "default",
|
|
95
|
+
host: options.host,
|
|
96
|
+
contexts: { TaonBaseContext },
|
|
97
|
+
database: true,
|
|
98
|
+
entities: Array.from(options.entities),
|
|
99
|
+
controllers: Array.from(options.controllers)
|
|
100
|
+
}));
|
|
101
|
+
await context.initialize();
|
|
102
|
+
return context;
|
|
103
|
+
};
|
|
104
|
+
const TAON_FLATTEN_MAPPING = {
|
|
105
|
+
"taon/src": {
|
|
106
|
+
// =====================
|
|
107
|
+
// Taon.Http.*
|
|
108
|
+
// =====================
|
|
109
|
+
"Taon.Http.GET": "GET",
|
|
110
|
+
"Taon.Http.POST": "POST",
|
|
111
|
+
"Taon.Http.PUT": "PUT",
|
|
112
|
+
"Taon.Http.DELETE": "DELETE",
|
|
113
|
+
"Taon.Http.PATCH": "PATCH",
|
|
114
|
+
"Taon.Http.HEAD": "HEAD",
|
|
115
|
+
"Taon.Http.HTML": "HTML",
|
|
116
|
+
"Taon.Http.Response": "HttpResponse",
|
|
117
|
+
"Taon.Http.Param.Query": "Query",
|
|
118
|
+
"Taon.Http.Param.Path": "Path",
|
|
119
|
+
"Taon.Http.Param.Body": "Body",
|
|
120
|
+
"Taon.Http.Param.Cookie": "Cookie",
|
|
121
|
+
"Taon.Http.Param.Header": "Header",
|
|
122
|
+
// =====================
|
|
123
|
+
// Taon.Base.*
|
|
124
|
+
// =====================
|
|
125
|
+
"Taon.Base.Controller": "TaonBaseController",
|
|
126
|
+
"Taon.Base.CrudController": "TaonBaseCrudController",
|
|
127
|
+
"Taon.Base.Entity": "TaonBaseEntity",
|
|
128
|
+
"Taon.Base.AbstractEntity": "TaonBaseAbstractEntity",
|
|
129
|
+
"Taon.Base.AbstractEntityOmitKeys": "AbstractEntityOmitKeys",
|
|
130
|
+
"Taon.Base.Provider": "TaonBaseProvider",
|
|
131
|
+
"Taon.Base.Class": "TaonBaseClass",
|
|
132
|
+
"Taon.Base.Repository": "TaonBaseRepository",
|
|
133
|
+
"Taon.Base.CustomRepository": "TaonBaseCustomRepository",
|
|
134
|
+
"Taon.Base.SubscriberForEntity": "TaonBaseSubscriberForEntity",
|
|
135
|
+
"Taon.Base.Migration": "TaonBaseMigration",
|
|
136
|
+
"Taon.Base.Middleware": "TaonBaseMiddleware",
|
|
137
|
+
"Taon.Base.AngularService": "TaonBaseAngularService",
|
|
138
|
+
"Taon.Base.Context": "TaonBaseContext",
|
|
139
|
+
// =====================
|
|
140
|
+
// Taon.Controller.* (decorators)
|
|
141
|
+
// =====================
|
|
142
|
+
"Taon.Controller": "TaonController",
|
|
143
|
+
"Taon.Entity": "TaonEntity",
|
|
144
|
+
"Taon.Provider": "TaonProvider",
|
|
145
|
+
"Taon.Repository": "TaonRepository",
|
|
146
|
+
"Taon.Subscriber": "TaonSubscriber",
|
|
147
|
+
"Taon.Migration": "TaonMigration",
|
|
148
|
+
"Taon.Middleware": "TaonMiddleware",
|
|
149
|
+
// =====================
|
|
150
|
+
// Taon.Orm.*
|
|
151
|
+
// =====================
|
|
152
|
+
"Taon.Orm.Repository": "Repository",
|
|
153
|
+
"Taon.Orm.Connection": "Connection",
|
|
154
|
+
// ListenEvent
|
|
155
|
+
"Taon.Orm.ListenEvent.AfterInsert": "AfterInsert",
|
|
156
|
+
"Taon.Orm.ListenEvent.AfterLoad": "AfterLoad",
|
|
157
|
+
"Taon.Orm.ListenEvent.AfterRecover": "AfterRecover",
|
|
158
|
+
"Taon.Orm.ListenEvent.AfterRemove": "AfterRemove",
|
|
159
|
+
"Taon.Orm.ListenEvent.AfterSoftRemove": "AfterSoftRemove",
|
|
160
|
+
"Taon.Orm.ListenEvent.AfterUpdate": "AfterUpdate",
|
|
161
|
+
"Taon.Orm.ListenEvent.BeforeInsert": "BeforeInsert",
|
|
162
|
+
"Taon.Orm.ListenEvent.BeforeRecover": "BeforeRecover",
|
|
163
|
+
"Taon.Orm.ListenEvent.BeforeRemove": "BeforeRemove",
|
|
164
|
+
"Taon.Orm.ListenEvent.BeforeSoftRemove": "BeforeSoftRemove",
|
|
165
|
+
"Taon.Orm.ListenEvent.BeforeUpdate": "BeforeUpdate",
|
|
166
|
+
// Tree
|
|
167
|
+
"Taon.Orm.Tree.Children": "TreeChildren",
|
|
168
|
+
"Taon.Orm.Tree.Parent": "TreeParent",
|
|
169
|
+
// Column
|
|
170
|
+
"Taon.Orm.Column.Generated": "Generated",
|
|
171
|
+
"Taon.Orm.Column.Primary": "PrimaryColumn",
|
|
172
|
+
"Taon.Orm.Column.Index": "Index",
|
|
173
|
+
"Taon.Orm.Column.CreateDate": "CreateDateColumn",
|
|
174
|
+
"Taon.Orm.Column.UpdateDate": "UpdateDateColumn",
|
|
175
|
+
"Taon.Orm.Column.DeleteDate": "DeleteDateColumn",
|
|
176
|
+
"Taon.Orm.Column.Custom": "Column",
|
|
177
|
+
"Taon.Orm.Column.String": "StringColumn",
|
|
178
|
+
"Taon.Orm.Column.String100": "String100Column",
|
|
179
|
+
"Taon.Orm.Column.String45": "String45Column",
|
|
180
|
+
"Taon.Orm.Column.String500": "String500Column",
|
|
181
|
+
"Taon.Orm.Column.String200": "String200Column",
|
|
182
|
+
"Taon.Orm.Column.Number": "NumberColumn",
|
|
183
|
+
"Taon.Orm.Column.DecimalNumber": "DecimalNumberColumn",
|
|
184
|
+
"Taon.Orm.Column.SimpleJson": "SimpleJsonColumn",
|
|
185
|
+
"Taon.Orm.Column.Boolean": "BooleanColumn",
|
|
186
|
+
"Taon.Orm.Column.DateTIme": "DateTimeColumn",
|
|
187
|
+
"Taon.Orm.Column.Version": "VersionColumn",
|
|
188
|
+
"Taon.Orm.Column.Virtual": "VirtualColumn",
|
|
189
|
+
// Join
|
|
190
|
+
"Taon.Orm.Join.Table": "JoinTable",
|
|
191
|
+
"Taon.Orm.Join.Column": "JoinColumn",
|
|
192
|
+
// Relation
|
|
193
|
+
"Taon.Orm.Relation.OneToMany": "OneToMany",
|
|
194
|
+
"Taon.Orm.Relation.OneToOne": "OneToOne",
|
|
195
|
+
"Taon.Orm.Relation.ManyToMany": "ManyToMany",
|
|
196
|
+
"Taon.Orm.Relation.ManyToOne": "ManyToOne"
|
|
197
|
+
},
|
|
198
|
+
"taon-storage/src": {
|
|
199
|
+
// =====================
|
|
200
|
+
// Stor.* (new clean API)
|
|
201
|
+
// =====================
|
|
202
|
+
"Stor.Property.In.LocalStorage": "StorPropertyInLocalStorage",
|
|
203
|
+
"Stor.Property.In.IndexedDb": "StorPropertyInIndexedDb",
|
|
204
|
+
// short alias style (if you prefer this pattern in some codebases)
|
|
205
|
+
"Stor.In.LocalStorage": "StorPropertyInLocalStorage",
|
|
206
|
+
"Stor.In.IndexedDb": "StorPropertyInIndexedDb",
|
|
207
|
+
// =====================
|
|
208
|
+
// Stor.property.in.* (back-compat chain you mentioned)
|
|
209
|
+
// =====================
|
|
210
|
+
"Stor.property.in.localstorage": "StorPropertyInLocalStorage",
|
|
211
|
+
"Stor.property.in.indexedb": "StorPropertyInIndexedDb",
|
|
212
|
+
"Stor.property.in.indexedDb": "StorPropertyInIndexedDb",
|
|
213
|
+
// Optional: if your old code had Stor.proper... (typo)
|
|
214
|
+
"Stor.proper.in.localstorage": "StorPropertyInLocalStorage",
|
|
215
|
+
"Stor.proper.in.indexedb": "StorPropertyInIndexedDb"
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
export {
|
|
219
|
+
TAON_FLATTEN_MAPPING,
|
|
220
|
+
Taon__NS__createContext,
|
|
221
|
+
Taon__NS__createContextTemplate,
|
|
222
|
+
Taon__NS__error,
|
|
223
|
+
Taon__NS__getResponseValue,
|
|
224
|
+
Taon__NS__init,
|
|
225
|
+
Taon__NS__inject,
|
|
226
|
+
Taon__NS__isBrowser,
|
|
227
|
+
Taon__NS__isElectron,
|
|
228
|
+
Taon__NS__isNode,
|
|
229
|
+
Taon__NS__isWebSQL,
|
|
230
|
+
Taon__NS__removeLoader
|
|
231
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Symbols__NS__classMethodsNames, Symbols__NS__ctxInClassOrClassObj } from "./symbols";
|
|
2
|
+
const inject = (entity) => {
|
|
3
|
+
return new Proxy(
|
|
4
|
+
{},
|
|
5
|
+
{
|
|
6
|
+
get: (_, propName) => {
|
|
7
|
+
if (propName === "hasOwnProperty") {
|
|
8
|
+
return () => false;
|
|
9
|
+
}
|
|
10
|
+
const ctor = entity();
|
|
11
|
+
const contextFromClass = ctor[Symbols__NS__ctxInClassOrClassObj];
|
|
12
|
+
const resultContext = contextFromClass;
|
|
13
|
+
if (resultContext) {
|
|
14
|
+
let instance = resultContext.inject(ctor, {
|
|
15
|
+
parentInstanceThatWillGetInjectedStuff: void 0
|
|
16
|
+
});
|
|
17
|
+
if (propName === "getOriginalPrototype") {
|
|
18
|
+
return () => Object.getPrototypeOf(instance);
|
|
19
|
+
}
|
|
20
|
+
if (propName === "getOriginalConstructor") {
|
|
21
|
+
return () => instance.constructor;
|
|
22
|
+
}
|
|
23
|
+
const methods = ctor[Symbols__NS__classMethodsNames] || [];
|
|
24
|
+
const isMethods = methods.includes(propName);
|
|
25
|
+
const methodOrProperty = isMethods ? instance[propName].bind(instance) : instance[propName];
|
|
26
|
+
return methodOrProperty;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
inject
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./migrations_index._auto-generated_";
|
|
File without changes
|