taon 21.0.34 → 21.0.37
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/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +3 -3
- package/browser-prod/fesm2022/taon-browser.mjs +315 -315
- package/browser-prod/fesm2022/taon-browser.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/taon-browser.d.ts +145 -145
- package/browser-prod.split-namespaces.json +162 -162
- 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/migrations/index.d.ts +1 -0
- package/lib/migrations/index.js +19 -0
- package/lib/migrations/index.js.map +1 -0
- package/lib/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib/migrations/migrations_index._auto-generated_.js +4 -0
- package/lib/migrations/migrations_index._auto-generated_.js.map +1 -0
- 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-class.js +1 -1
- package/lib-prod/base-classes/base-class.js.map +1 -1
- package/lib-prod/base-classes/base-context.d.ts +1 -1
- package/lib-prod/base-classes/base-controller.d.ts +5 -5
- package/lib-prod/base-classes/base-controller.js +2 -2
- package/lib-prod/base-classes/base-controller.js.map +1 -1
- package/lib-prod/base-classes/base-crud-controller.d.ts +13 -13
- package/lib-prod/base-classes/base-crud-controller.js +8 -8
- package/lib-prod/base-classes/base-crud-controller.js.map +1 -1
- package/lib-prod/base-classes/base-injector.js +11 -11
- package/lib-prod/base-classes/base-injector.js.map +1 -1
- package/lib-prod/base-classes/base-middleware.d.ts +2 -2
- package/lib-prod/base-classes/base-migration.js +3 -3
- package/lib-prod/base-classes/base-migration.js.map +1 -1
- package/lib-prod/base-classes/base-repository.js +4 -4
- package/lib-prod/base-classes/base-repository.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/config/method-config.d.ts +2 -2
- package/lib-prod/config/param-config.d.ts +2 -2
- package/lib-prod/context-db-migrations.js +12 -12
- package/lib-prod/context-db-migrations.js.map +1 -1
- package/lib-prod/create-context.d.ts +5 -5
- package/lib-prod/create-context.js +3 -3
- package/lib-prod/create-context.js.map +1 -1
- package/lib-prod/decorators/classes/controller-decorator.js +3 -3
- package/lib-prod/decorators/classes/controller-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/entity-decorator.d.ts +3 -3
- package/lib-prod/decorators/classes/entity-decorator.js +5 -5
- package/lib-prod/decorators/classes/entity-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/middleware-decorator.js +3 -3
- package/lib-prod/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/migration-decorator.js +3 -3
- package/lib-prod/decorators/classes/migration-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/provider-decorator.js +3 -3
- package/lib-prod/decorators/classes/provider-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/repository-decorator.js +3 -3
- package/lib-prod/decorators/classes/repository-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/subscriber-decorator.js +3 -3
- package/lib-prod/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib-prod/decorators/http/http-decorators.d.ts +3 -3
- package/lib-prod/decorators/http/http-decorators.js +2 -2
- package/lib-prod/decorators/http/http-decorators.js.map +1 -1
- package/lib-prod/decorators/http/http-methods-decorators.d.ts +5 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +2 -2
- package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib-prod/decorators/http/http-params-decorators.js +1 -1
- package/lib-prod/decorators/http/http-params-decorators.js.map +1 -1
- package/lib-prod/endpoint-context-storage.js +1 -1
- package/lib-prod/endpoint-context-storage.js.map +1 -1
- package/lib-prod/endpoint-context.d.ts +14 -14
- package/lib-prod/endpoint-context.js +171 -171
- package/lib-prod/endpoint-context.js.map +1 -1
- package/lib-prod/entity-process.js +14 -14
- package/lib-prod/entity-process.js.map +1 -1
- package/lib-prod/formly/fromly.d.ts +2 -2
- package/lib-prod/formly/fromly.js +1 -1
- package/lib-prod/formly/fromly.js.map +1 -1
- package/lib-prod/formly/type-from-entity.js +2 -2
- package/lib-prod/formly/type-from-entity.js.map +1 -1
- package/lib-prod/get-response-value.d.ts +2 -2
- package/lib-prod/get-response-value.js.map +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.d.ts +3 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js.map +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.d.ts +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +3 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js.map +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +2 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +2 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -1
- package/lib-prod/helpers/class-helpers.d.ts +14 -14
- package/lib-prod/helpers/class-helpers.js +54 -54
- package/lib-prod/helpers/class-helpers.js.map +1 -1
- package/lib-prod/helpers/taon-helpers.d.ts +11 -11
- package/lib-prod/helpers/taon-helpers.js +26 -26
- package/lib-prod/helpers/taon-helpers.js.map +1 -1
- package/lib-prod/index.d.ts +17 -17
- package/lib-prod/index.js +16 -16
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/inject.js +3 -3
- package/lib-prod/inject.js.map +1 -1
- package/lib-prod/migrations/index.d.ts +1 -0
- package/lib-prod/migrations/index.js +19 -0
- package/lib-prod/migrations/index.js.map +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +4 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +1 -0
- package/lib-prod/models.d.ts +37 -37
- package/lib-prod/models.js +25 -25
- package/lib-prod/models.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.d.ts +2 -2
- package/lib-prod/realtime/realtime-client.js +9 -9
- package/lib-prod/realtime/realtime-client.js.map +1 -1
- package/lib-prod/realtime/realtime-server.js +17 -17
- package/lib-prod/realtime/realtime-server.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +3 -3
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +2 -2
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +2 -2
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
- package/lib-prod/realtime/realtime-subs-manager.d.ts +2 -2
- package/lib-prod/realtime/realtime-subs-manager.js +6 -6
- package/lib-prod/realtime/realtime-subs-manager.js.map +1 -1
- package/lib-prod/realtime/realtime.models.d.ts +3 -3
- package/lib-prod/symbols.d.ts +9 -9
- package/lib-prod/symbols.js +10 -10
- package/lib-prod/symbols.js.map +1 -1
- package/lib-prod/ui/index.d.ts +1 -1
- package/lib-prod/ui/index.js +2 -2
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/validators.d.ts +4 -4
- package/lib-prod/validators.js +9 -9
- package/lib-prod/validators.js.map +1 -1
- package/lib-prod.split-namespaces.json +164 -164
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +3 -3
- package/websql-prod/fesm2022/taon-websql.mjs +389 -389
- package/websql-prod/fesm2022/taon-websql.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/taon-websql.d.ts +146 -146
- package/websql-prod.split-namespaces.json +164 -164
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as coreHelpers from 'tnp-core/browser-prod';
|
|
3
|
-
import { _,
|
|
3
|
+
import { _, Utils__NS__uniqArray, Helpers, UtilsOs__NS__isRunningInDocker, config, CoreModels__NS__SPECIAL_APP_READY_MESSAGE, UtilsOs__NS__isRunningInCliMode, crossPlatformPath, UtilsTerminal__NS__waitMilliseconds, CoreModels__NS__TaonHttpErrorCustomProp } from 'tnp-core/browser-prod';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import { JSON10 } from 'json10/browser-prod';
|
|
6
6
|
import { walk } from 'lodash-walk-object/browser-prod';
|
|
7
|
-
import { RestResponseWrapper, Resource,
|
|
7
|
+
import { RestResponseWrapper, Resource, Models__NS__HttpResponse, RestHeaders, Mapping__NS__decode, Mapping__NS__DefaultModelWithMapping, HttpResponseError, Mapping__NS__getModelsMapping } from 'ng2-rest/browser-prod';
|
|
8
8
|
import { Observable, from, Subject } from 'rxjs';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
10
|
import { InjectionToken, inject as inject$1, PLATFORM_ID, Injectable, ViewContainerRef, ViewChild, Component } from '@angular/core';
|
|
@@ -647,14 +647,14 @@ class Realtime {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
//namespace Symbols
|
|
650
|
-
const
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
const
|
|
656
|
-
const
|
|
657
|
-
const
|
|
650
|
+
const Symbols__NS__ctxInClassOrClassObj = Symbol();
|
|
651
|
+
const Symbols__NS__classNameStaticProperty = SYMBOL.ClassNameStaticProperty;
|
|
652
|
+
const Symbols__NS__fullClassNameStaticProperty = `$$fullclassName$$`;
|
|
653
|
+
const Symbols__NS__orignalClass = OrignalClassKey;
|
|
654
|
+
const Symbols__NS__orignalClassClonesObj = `$$originalClassClonesObj$$`;
|
|
655
|
+
const Symbols__NS__classMethodsNames = `$$classMethodsNames$$`;
|
|
656
|
+
const Symbols__NS__REALTIME = new Realtime();
|
|
657
|
+
const Symbols__NS__metadata = {
|
|
658
658
|
className: `class:realname`,
|
|
659
659
|
options: {
|
|
660
660
|
controller: `controller:options`,
|
|
@@ -665,7 +665,7 @@ const Symbols_metadata = {
|
|
|
665
665
|
migration: `migration:options`,
|
|
666
666
|
},
|
|
667
667
|
};
|
|
668
|
-
const
|
|
668
|
+
const Symbols__NS__old = {
|
|
669
669
|
HAS_TABLE_IN_DB: Symbol(),
|
|
670
670
|
MDC_KEY: `modeldataconfig`,
|
|
671
671
|
WEBSQL_REST_PROGRESS_FUN: Symbol(),
|
|
@@ -692,7 +692,7 @@ const Symbols_old = {
|
|
|
692
692
|
|
|
693
693
|
//namespace Validators
|
|
694
694
|
//#region vlidate class name
|
|
695
|
-
const
|
|
695
|
+
const Validators__NS__classNameVlidation = (className, target) => {
|
|
696
696
|
setTimeout(() => {
|
|
697
697
|
// console.log(`check after timeout ${className} , production mode: ${FrameworkContext.isProductionMode}`)
|
|
698
698
|
if (_.isUndefined(className)) {
|
|
@@ -719,7 +719,7 @@ const Validators_classNameVlidation = (className, target) => {
|
|
|
719
719
|
};
|
|
720
720
|
//#endregion
|
|
721
721
|
//#region validate method config
|
|
722
|
-
const
|
|
722
|
+
const Validators__NS__checkIfMethodsWithReponseTYpeAlowed = (methods, current) => {
|
|
723
723
|
const defaultResponseType = 'text or JSON';
|
|
724
724
|
if (!current.responseType) {
|
|
725
725
|
return;
|
|
@@ -742,7 +742,7 @@ const Validators_checkIfMethodsWithReponseTYpeAlowed = (methods, current) => {
|
|
|
742
742
|
//#endregion
|
|
743
743
|
//#region validate class functions
|
|
744
744
|
// TODO
|
|
745
|
-
const
|
|
745
|
+
const Validators__NS__validateClassFunctions = (controllers, entities, proviers, repositories) => {
|
|
746
746
|
if (_.isArray(controllers) &&
|
|
747
747
|
controllers.filter(f => !_.isFunction(f)).length > 0) {
|
|
748
748
|
console.error('controllers', controllers);
|
|
@@ -763,7 +763,7 @@ const Validators_validateClassFunctions = (controllers, entities, proviers, repo
|
|
|
763
763
|
}
|
|
764
764
|
};
|
|
765
765
|
//#endregion
|
|
766
|
-
const
|
|
766
|
+
const Validators__NS__preventUndefinedModel = (model, id) => {
|
|
767
767
|
if (_.isUndefined(model)) {
|
|
768
768
|
throw `Bad update by id, config, id: ${id}`;
|
|
769
769
|
}
|
|
@@ -778,7 +778,7 @@ const Validators_preventUndefinedModel = (model, id) => {
|
|
|
778
778
|
/**
|
|
779
779
|
* TODO - repalce in every place when getting class fn from object
|
|
780
780
|
*/
|
|
781
|
-
const
|
|
781
|
+
const ClassHelpers__NS__getClassFnFromObject = (json) => {
|
|
782
782
|
if (_.isUndefined(json) || _.isNull(json)) {
|
|
783
783
|
return;
|
|
784
784
|
}
|
|
@@ -792,7 +792,7 @@ const ClassHelpers_getClassFnFromObject = (json) => {
|
|
|
792
792
|
};
|
|
793
793
|
//#endregion
|
|
794
794
|
//#region get name
|
|
795
|
-
const
|
|
795
|
+
const ClassHelpers__NS__getName = (classFnOrObject) => {
|
|
796
796
|
// exception for FormData
|
|
797
797
|
if (classFnOrObject instanceof FormData) {
|
|
798
798
|
return 'FormData';
|
|
@@ -801,42 +801,42 @@ const ClassHelpers_getName = (classFnOrObject) => {
|
|
|
801
801
|
console.error('OBJECT OR CLASS', classFnOrObject);
|
|
802
802
|
throw new Error(`Cannot get name from this object or class.`);
|
|
803
803
|
}
|
|
804
|
-
return ((classFnOrObject[
|
|
805
|
-
? classFnOrObject[
|
|
806
|
-
: classFnOrObject?.constructor[
|
|
804
|
+
return ((classFnOrObject[Symbols__NS__classNameStaticProperty]
|
|
805
|
+
? classFnOrObject[Symbols__NS__classNameStaticProperty]
|
|
806
|
+
: classFnOrObject?.constructor[Symbols__NS__classNameStaticProperty]) ||
|
|
807
807
|
(_.isFunction(classFnOrObject) ? CLASS.getName(classFnOrObject) : void 0));
|
|
808
808
|
};
|
|
809
809
|
//#endregion
|
|
810
|
-
const
|
|
811
|
-
const org = classFnOrObject[
|
|
810
|
+
const ClassHelpers__NS__getOrginalClass = (classFnOrObject) => {
|
|
811
|
+
const org = classFnOrObject[Symbols__NS__orignalClass];
|
|
812
812
|
if (!org) {
|
|
813
813
|
return classFnOrObject;
|
|
814
814
|
}
|
|
815
|
-
return
|
|
815
|
+
return ClassHelpers__NS__getOrginalClass(org);
|
|
816
816
|
};
|
|
817
817
|
//#region get full internal name
|
|
818
|
-
const
|
|
818
|
+
const ClassHelpers__NS__getFullInternalName = (classFnOrObject) => {
|
|
819
819
|
// exception for FormData
|
|
820
820
|
if (!classFnOrObject) {
|
|
821
821
|
throw new Error(`Cannot get name from: ${classFnOrObject}`);
|
|
822
822
|
}
|
|
823
|
-
return ((classFnOrObject[
|
|
824
|
-
? classFnOrObject[
|
|
825
|
-
: classFnOrObject?.constructor[
|
|
823
|
+
return ((classFnOrObject[Symbols__NS__fullClassNameStaticProperty]
|
|
824
|
+
? classFnOrObject[Symbols__NS__fullClassNameStaticProperty]
|
|
825
|
+
: classFnOrObject?.constructor[Symbols__NS__fullClassNameStaticProperty]) ||
|
|
826
826
|
void 0);
|
|
827
827
|
};
|
|
828
828
|
//#endregion
|
|
829
829
|
//#region get unique key
|
|
830
|
-
const
|
|
830
|
+
const ClassHelpers__NS__getUniqueKey = (classFnOrObject) => {
|
|
831
831
|
const classFn = _.isFunction(classFnOrObject)
|
|
832
832
|
? classFnOrObject
|
|
833
833
|
: classFnOrObject.constructor;
|
|
834
|
-
const config = Reflect.getMetadata(
|
|
834
|
+
const config = Reflect.getMetadata(Symbols__NS__metadata.options.entity, classFn);
|
|
835
835
|
return config.uniqueKeyProp;
|
|
836
836
|
};
|
|
837
837
|
//#endregion
|
|
838
838
|
//#region is class object
|
|
839
|
-
const
|
|
839
|
+
const ClassHelpers__NS__isContextClassObject = (obj) => {
|
|
840
840
|
if (!_.isObject(obj) ||
|
|
841
841
|
_.isArray(obj) ||
|
|
842
842
|
_.isRegExp(obj) ||
|
|
@@ -847,30 +847,30 @@ const ClassHelpers_isContextClassObject = (obj) => {
|
|
|
847
847
|
if (_.isDate(obj)) {
|
|
848
848
|
return true;
|
|
849
849
|
}
|
|
850
|
-
const className =
|
|
850
|
+
const className = ClassHelpers__NS__getName(obj);
|
|
851
851
|
return _.isString(className) && className !== 'Object';
|
|
852
852
|
};
|
|
853
853
|
//#endregion
|
|
854
854
|
//#region get name
|
|
855
|
-
const
|
|
855
|
+
const ClassHelpers__NS__setName = (target, className) => {
|
|
856
856
|
// console.log('setName', className, target.name)
|
|
857
|
-
|
|
858
|
-
target[
|
|
857
|
+
Validators__NS__classNameVlidation(className, target);
|
|
858
|
+
target[Symbols__NS__classNameStaticProperty] = className;
|
|
859
859
|
};
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region has parent with class name
|
|
862
|
-
const
|
|
862
|
+
const ClassHelpers__NS__hasParentClassWithName = (target, className, targets = []) => {
|
|
863
863
|
if (!target) {
|
|
864
864
|
return false;
|
|
865
865
|
}
|
|
866
866
|
targets.push(target);
|
|
867
867
|
let targetProto = Object.getPrototypeOf(target);
|
|
868
868
|
if (_.isFunction(targetProto) &&
|
|
869
|
-
|
|
869
|
+
ClassHelpers__NS__getName(targetProto) === className) {
|
|
870
870
|
// console.log(`true "${_.first(targets).name}" for ${targets.map(d => d.name).join(',')}`)
|
|
871
871
|
return true;
|
|
872
872
|
}
|
|
873
|
-
return
|
|
873
|
+
return ClassHelpers__NS__hasParentClassWithName(targetProto, className, targets);
|
|
874
874
|
};
|
|
875
875
|
//#endregion
|
|
876
876
|
//#region get methods name
|
|
@@ -900,12 +900,12 @@ const notAllowedAsMethodName = [
|
|
|
900
900
|
/**
|
|
901
901
|
* Express async handler for middleware functions.
|
|
902
902
|
*/
|
|
903
|
-
const
|
|
903
|
+
const ClassHelpers__NS__asyncHandler = fn => (req, res, next) => {
|
|
904
904
|
Promise.resolve(fn(req, res, next)).catch(next);
|
|
905
905
|
};
|
|
906
|
-
const
|
|
906
|
+
const ClassHelpers__NS__getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
907
907
|
if (!classOrClassInstance) {
|
|
908
|
-
return
|
|
908
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
909
909
|
}
|
|
910
910
|
const isClassFunction = _.isFunction(classOrClassInstance);
|
|
911
911
|
const classFun = isClassFunction
|
|
@@ -927,37 +927,37 @@ const ClassHelpers_getMethodsNames = (classOrClassInstance, allMethodsNames = []
|
|
|
927
927
|
if (!classFun ||
|
|
928
928
|
!classFun.constructor ||
|
|
929
929
|
classFun?.constructor?.name === 'Object') {
|
|
930
|
-
return
|
|
930
|
+
return Utils__NS__uniqArray(allMethodsNames);
|
|
931
931
|
}
|
|
932
|
-
return
|
|
932
|
+
return ClassHelpers__NS__getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
|
|
933
933
|
};
|
|
934
934
|
//#endregion
|
|
935
935
|
//#region get controller configs
|
|
936
|
-
const
|
|
936
|
+
const ClassHelpers__NS__getControllerConfigs = (target, configs = [], callerTarget) => {
|
|
937
937
|
if (!_.isFunction(target)) {
|
|
938
938
|
throw `[typescript-class-helper][getControllerConfigs] Cannot get class config from: ${target}`;
|
|
939
939
|
}
|
|
940
940
|
let config;
|
|
941
941
|
const parentClass = Object.getPrototypeOf(target);
|
|
942
|
-
const parentName = parentClass ?
|
|
942
|
+
const parentName = parentClass ? ClassHelpers__NS__getName(parentClass) : void 0;
|
|
943
943
|
const isValidParent = _.isFunction(parentClass) && parentName !== '';
|
|
944
|
-
config = controllerConfigFrom(
|
|
944
|
+
config = controllerConfigFrom(ClassHelpers__NS__getClassConfig(target));
|
|
945
945
|
configs.push(config);
|
|
946
946
|
return isValidParent
|
|
947
|
-
?
|
|
947
|
+
? ClassHelpers__NS__getControllerConfigs(parentClass, configs, target)
|
|
948
948
|
: configs;
|
|
949
949
|
};
|
|
950
950
|
//#endregion
|
|
951
951
|
//#region ensure configs
|
|
952
952
|
// Ensure ClassConfig on constructor, clone parent if needed
|
|
953
|
-
const
|
|
954
|
-
let cfg = Reflect.getOwnMetadata(
|
|
953
|
+
const ClassHelpers__NS__ensureClassConfig = (target) => {
|
|
954
|
+
let cfg = Reflect.getOwnMetadata(Symbols__NS__metadata.options.controller, // META_KEYS.class,
|
|
955
955
|
target);
|
|
956
956
|
if (!cfg) {
|
|
957
957
|
cfg = { methods: {} };
|
|
958
958
|
const parent = Object.getPrototypeOf(target);
|
|
959
959
|
if (parent && parent !== Function.prototype) {
|
|
960
|
-
const parentCfg = Reflect.getMetadata(
|
|
960
|
+
const parentCfg = Reflect.getMetadata(Symbols__NS__metadata.options.controller, // META_KEYS.class,
|
|
961
961
|
parent);
|
|
962
962
|
if (parentCfg) {
|
|
963
963
|
// Deep copy each method config so child gets its own objects
|
|
@@ -974,13 +974,13 @@ const ClassHelpers_ensureClassConfig = (target) => {
|
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
|
-
Reflect.defineMetadata(
|
|
977
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.controller, cfg, target);
|
|
978
978
|
}
|
|
979
979
|
return cfg;
|
|
980
980
|
};
|
|
981
981
|
// Ensure MethodConfig inside ClassConfig
|
|
982
|
-
const
|
|
983
|
-
const classCfg =
|
|
982
|
+
const ClassHelpers__NS__ensureMethodConfig = (target, propertyKey) => {
|
|
983
|
+
const classCfg = ClassHelpers__NS__ensureClassConfig(target.constructor);
|
|
984
984
|
let methodCfg = classCfg.methods[propertyKey?.toString()];
|
|
985
985
|
if (!methodCfg) {
|
|
986
986
|
methodCfg = { methodName: propertyKey?.toString(), parameters: {} };
|
|
@@ -988,15 +988,15 @@ const ClassHelpers_ensureMethodConfig = (target, propertyKey) => {
|
|
|
988
988
|
}
|
|
989
989
|
return methodCfg;
|
|
990
990
|
};
|
|
991
|
-
const
|
|
992
|
-
return Reflect.getMetadata(
|
|
991
|
+
const ClassHelpers__NS__getClassConfig = (constructor) => {
|
|
992
|
+
return Reflect.getMetadata(Symbols__NS__metadata.options.controller, constructor);
|
|
993
993
|
};
|
|
994
994
|
//#endregion
|
|
995
995
|
//end of namespace ClassHelpers
|
|
996
996
|
|
|
997
997
|
//namespace TaonHelpers
|
|
998
998
|
//#region fillUpTo string
|
|
999
|
-
const
|
|
999
|
+
const TaonHelpers__NS__fillUpTo = (s, nCharacters) => {
|
|
1000
1000
|
return _.times(nCharacters, n => {
|
|
1001
1001
|
if (s.charAt(n)) {
|
|
1002
1002
|
return s.charAt(n);
|
|
@@ -1006,18 +1006,18 @@ const TaonHelpers_fillUpTo = (s, nCharacters) => {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
//#region is good path
|
|
1009
|
-
const
|
|
1009
|
+
const TaonHelpers__NS__isGoodPath = (p) => {
|
|
1010
1010
|
return p && typeof p === 'string' && p.trim() !== '';
|
|
1011
1011
|
};
|
|
1012
1012
|
//#endregion
|
|
1013
|
-
const
|
|
1013
|
+
const TaonHelpers__NS__firstStringOrElemFromArray = (stringOrArrayOfString) => {
|
|
1014
1014
|
if (Array.isArray(stringOrArrayOfString)) {
|
|
1015
1015
|
return _.first(stringOrArrayOfString);
|
|
1016
1016
|
}
|
|
1017
1017
|
return stringOrArrayOfString;
|
|
1018
1018
|
};
|
|
1019
1019
|
//#region try transform params
|
|
1020
|
-
const
|
|
1020
|
+
const TaonHelpers__NS__tryTransformParam = param => {
|
|
1021
1021
|
if (typeof param === 'string') {
|
|
1022
1022
|
let n = Number(param);
|
|
1023
1023
|
if (!isNaN(n))
|
|
@@ -1041,14 +1041,14 @@ const TaonHelpers_tryTransformParam = param => {
|
|
|
1041
1041
|
};
|
|
1042
1042
|
//#endregion
|
|
1043
1043
|
//#region get expores path
|
|
1044
|
-
const
|
|
1044
|
+
const TaonHelpers__NS__getExpressPath = (c, pathOrClassConfig) => {
|
|
1045
1045
|
if (typeof pathOrClassConfig === 'string')
|
|
1046
1046
|
return `${c.calculatedPath}${pathOrClassConfig}`.replace(/\/$/, '');
|
|
1047
1047
|
return `${c.calculatedPath}${pathOrClassConfig.path}`.replace(/\/$/, '');
|
|
1048
1048
|
};
|
|
1049
1049
|
//#endregion
|
|
1050
1050
|
//#region get default value tyep
|
|
1051
|
-
const
|
|
1051
|
+
const TaonHelpers__NS__defaultType = value => {
|
|
1052
1052
|
if (typeof value === 'string')
|
|
1053
1053
|
return '';
|
|
1054
1054
|
if (typeof value === 'boolean')
|
|
@@ -1060,7 +1060,7 @@ const TaonHelpers_defaultType = value => {
|
|
|
1060
1060
|
};
|
|
1061
1061
|
//#endregion
|
|
1062
1062
|
//#region parse json with string jsons
|
|
1063
|
-
const
|
|
1063
|
+
const TaonHelpers__NS__parseJSONwithStringJSONs = (object, waring = false) => {
|
|
1064
1064
|
// console.log('checking object', object)
|
|
1065
1065
|
if (!_.isObject(object)) {
|
|
1066
1066
|
if (waring) {
|
|
@@ -1084,22 +1084,22 @@ const TaonHelpers_parseJSONwithStringJSONs = (object, waring = false) => {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
// console.log(`key ${key} is json `, isJson)
|
|
1086
1086
|
if (isJson) {
|
|
1087
|
-
res[key] =
|
|
1087
|
+
res[key] = TaonHelpers__NS__parseJSONwithStringJSONs(res[key], false);
|
|
1088
1088
|
}
|
|
1089
1089
|
});
|
|
1090
1090
|
return res;
|
|
1091
1091
|
};
|
|
1092
1092
|
//#endregion
|
|
1093
1093
|
//#region is plain file or folder
|
|
1094
|
-
const
|
|
1094
|
+
const TaonHelpers__NS__isPlainFileOrFolder = filePath => {
|
|
1095
1095
|
return /^([a-zA-Z]|\-|\_|\@|\#|\$|\!|\^|\&|\*|\(|\))+$/.test(filePath);
|
|
1096
1096
|
};
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region ips key name repsonse
|
|
1099
|
-
const
|
|
1099
|
+
const TaonHelpers__NS__ipcKeyNameResponse = (target, methodConfig, expressPath) => {
|
|
1100
1100
|
return [
|
|
1101
1101
|
'response',
|
|
1102
|
-
|
|
1102
|
+
ClassHelpers__NS__getName(target),
|
|
1103
1103
|
methodConfig.methodName,
|
|
1104
1104
|
methodConfig.type,
|
|
1105
1105
|
expressPath,
|
|
@@ -1107,10 +1107,10 @@ const TaonHelpers_ipcKeyNameResponse = (target, methodConfig, expressPath) => {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
//#endregion
|
|
1109
1109
|
//#region ipc key name request
|
|
1110
|
-
const
|
|
1110
|
+
const TaonHelpers__NS__ipcKeyNameRequest = (target, methodConfig, expressPath) => {
|
|
1111
1111
|
return [
|
|
1112
1112
|
'request',
|
|
1113
|
-
|
|
1113
|
+
ClassHelpers__NS__getName(target),
|
|
1114
1114
|
methodConfig.methodName,
|
|
1115
1115
|
methodConfig.type,
|
|
1116
1116
|
expressPath,
|
|
@@ -1118,7 +1118,7 @@ const TaonHelpers_ipcKeyNameRequest = (target, methodConfig, expressPath) => {
|
|
|
1118
1118
|
};
|
|
1119
1119
|
//#endregion
|
|
1120
1120
|
//#region websql mocks
|
|
1121
|
-
const
|
|
1121
|
+
const TaonHelpers__NS__websqlMocks = headers => {
|
|
1122
1122
|
const response = {
|
|
1123
1123
|
status(status) {
|
|
1124
1124
|
// console.log({status})
|
|
@@ -1164,36 +1164,36 @@ const BaseTaonClassesNames = [
|
|
|
1164
1164
|
const TaonTempDatabasesFolder = 'databases';
|
|
1165
1165
|
const TaonTempRoutesFolder = 'routes';
|
|
1166
1166
|
//namespace Models
|
|
1167
|
-
const
|
|
1167
|
+
const Models__NS__DatabasesFolder = TaonTempDatabasesFolder;
|
|
1168
1168
|
//#region models / class types
|
|
1169
|
-
var
|
|
1170
|
-
(function (
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
})(
|
|
1179
|
-
const
|
|
1180
|
-
[
|
|
1181
|
-
[
|
|
1182
|
-
[
|
|
1183
|
-
[
|
|
1184
|
-
[
|
|
1185
|
-
[
|
|
1186
|
-
[
|
|
1169
|
+
var Models__NS__ClassType;
|
|
1170
|
+
(function (Models__NS__ClassType) {
|
|
1171
|
+
Models__NS__ClassType["ENTITY"] = "ENTITY";
|
|
1172
|
+
Models__NS__ClassType["CONTROLLER"] = "CONTROLLER";
|
|
1173
|
+
Models__NS__ClassType["REPOSITORY"] = "REPOSITORY";
|
|
1174
|
+
Models__NS__ClassType["PROVIDER"] = "PROVIDER";
|
|
1175
|
+
Models__NS__ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
1176
|
+
Models__NS__ClassType["MIGRATION"] = "MIGRATION";
|
|
1177
|
+
Models__NS__ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
1178
|
+
})(Models__NS__ClassType || (Models__NS__ClassType = {}));
|
|
1179
|
+
const Models__NS__ClassTypeKey = {
|
|
1180
|
+
[Models__NS__ClassType.ENTITY]: 'entities',
|
|
1181
|
+
[Models__NS__ClassType.CONTROLLER]: 'controllers',
|
|
1182
|
+
[Models__NS__ClassType.REPOSITORY]: 'repositories',
|
|
1183
|
+
[Models__NS__ClassType.PROVIDER]: 'providers',
|
|
1184
|
+
[Models__NS__ClassType.SUBSCRIBER]: 'subscribers',
|
|
1185
|
+
[Models__NS__ClassType.MIGRATION]: 'migrations',
|
|
1186
|
+
[Models__NS__ClassType.MIDDLEWARE]: 'middlewares',
|
|
1187
1187
|
};
|
|
1188
1188
|
//#endregion
|
|
1189
1189
|
//#region models / database connection options
|
|
1190
|
-
class
|
|
1190
|
+
class Models__NS__DatabaseConfigTypeOrm {
|
|
1191
1191
|
}
|
|
1192
1192
|
//#endregion
|
|
1193
1193
|
//#region models / database config
|
|
1194
|
-
class
|
|
1194
|
+
class Models__NS__DatabaseConfig extends Models__NS__DatabaseConfigTypeOrm {
|
|
1195
1195
|
static from(databasePartialConfig) {
|
|
1196
|
-
return _.merge(new
|
|
1196
|
+
return _.merge(new Models__NS__DatabaseConfig(), databasePartialConfig);
|
|
1197
1197
|
}
|
|
1198
1198
|
get databaseConfigTypeORM() {
|
|
1199
1199
|
/* */
|
|
@@ -1240,18 +1240,18 @@ class RealtimeSubsManager {
|
|
|
1240
1240
|
// console.info(`[BROWSER]][IPC] subscribe to "${this.options?.roomName}" by sending event: "${subscribeEvent}"`, this.options);
|
|
1241
1241
|
this.isListening = true;
|
|
1242
1242
|
if (this.options.customEvent) {
|
|
1243
|
-
const subscribeEvent =
|
|
1243
|
+
const subscribeEvent = Symbols__NS__REALTIME.ROOM_SUBSCRIBE_CUSTOM(this.options.core.ctx.contextName);
|
|
1244
1244
|
// this means: send to current client custom event notification
|
|
1245
1245
|
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1246
1246
|
}
|
|
1247
1247
|
else {
|
|
1248
1248
|
if (_.isString(this.options.property)) {
|
|
1249
|
-
const subscribeEvent =
|
|
1249
|
+
const subscribeEvent = Symbols__NS__REALTIME.ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1250
1250
|
// this means: send to current client entity property events updates
|
|
1251
1251
|
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1252
1252
|
}
|
|
1253
1253
|
else {
|
|
1254
|
-
const subscribeEvent =
|
|
1254
|
+
const subscribeEvent = Symbols__NS__REALTIME.ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1255
1255
|
// this means: send to current client entity update events
|
|
1256
1256
|
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1257
1257
|
}
|
|
@@ -1279,14 +1279,14 @@ class RealtimeSubsManager {
|
|
|
1279
1279
|
const { core, customEvent, roomName, property } = this.options;
|
|
1280
1280
|
const realtime = core.socketFE;
|
|
1281
1281
|
if (customEvent) {
|
|
1282
|
-
realtime.emit(
|
|
1282
|
+
realtime.emit(Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_CUSTOM(this.options.core.ctx.contextName), roomName);
|
|
1283
1283
|
}
|
|
1284
1284
|
else {
|
|
1285
1285
|
if (_.isString(property)) {
|
|
1286
|
-
realtime.emit(
|
|
1286
|
+
realtime.emit(Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1287
1287
|
}
|
|
1288
1288
|
else {
|
|
1289
|
-
realtime.emit(
|
|
1289
|
+
realtime.emit(Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
@@ -1333,7 +1333,7 @@ class RealtimeClient {
|
|
|
1333
1333
|
//#region prepare naspaces pathes
|
|
1334
1334
|
const nspPath = {
|
|
1335
1335
|
global: this.core.pathFor(),
|
|
1336
|
-
realtime: this.core.pathFor(
|
|
1336
|
+
realtime: this.core.pathFor(Symbols__NS__REALTIME.NAMESPACE(this.core.ctx.contextName)),
|
|
1337
1337
|
};
|
|
1338
1338
|
// console.log('[browser] nspPath', nspPath);
|
|
1339
1339
|
if (this.core.ctx.config.frontendHost &&
|
|
@@ -1402,15 +1402,15 @@ class RealtimeClient {
|
|
|
1402
1402
|
if (_.isObject(entityClassFnOrObj)) {
|
|
1403
1403
|
const orgObj = entityClassFnOrObj;
|
|
1404
1404
|
entityClassFnOrObj =
|
|
1405
|
-
|
|
1406
|
-
const uniqueKey =
|
|
1405
|
+
ClassHelpers__NS__getClassFnFromObject(entityClassFnOrObj);
|
|
1406
|
+
const uniqueKey = ClassHelpers__NS__getUniqueKey(entityClassFnOrObj);
|
|
1407
1407
|
if (uniqueKey) {
|
|
1408
1408
|
options.idOrUniqValue = orgObj[uniqueKey];
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
1411
|
//#region parameters validation
|
|
1412
1412
|
const { property, customEvent } = options;
|
|
1413
|
-
const className = !customEvent &&
|
|
1413
|
+
const className = !customEvent && ClassHelpers__NS__getName(entityClassFnOrObj);
|
|
1414
1414
|
if (_.isString(property)) {
|
|
1415
1415
|
if (property.trim() === '') {
|
|
1416
1416
|
throw new Error(`[Taon][listenChangesEntity.. incorrect property '' for ${className}`);
|
|
@@ -1434,12 +1434,12 @@ to use socket realtime connection;
|
|
|
1434
1434
|
}
|
|
1435
1435
|
let roomName;
|
|
1436
1436
|
if (customEvent) {
|
|
1437
|
-
roomName =
|
|
1437
|
+
roomName = Symbols__NS__REALTIME.ROOM_NAME_CUSTOM(this.core.ctx.contextName, customEvent);
|
|
1438
1438
|
}
|
|
1439
1439
|
else {
|
|
1440
1440
|
roomName = _.isString(property)
|
|
1441
|
-
?
|
|
1442
|
-
:
|
|
1441
|
+
? Symbols__NS__REALTIME.ROOM_NAME_UPDATE_ENTITY_PROPERTY(this.core.ctx.contextName, className, property, options.idOrUniqValue)
|
|
1442
|
+
: Symbols__NS__REALTIME.ROOM_NAME_UPDATE_ENTITY(this.core.ctx.contextName, className, options.idOrUniqValue);
|
|
1443
1443
|
}
|
|
1444
1444
|
const roomSubOptions = {
|
|
1445
1445
|
core: this.core,
|
|
@@ -1467,9 +1467,9 @@ to use socket realtime connection;
|
|
|
1467
1467
|
* Example: for pagination, lists update ...
|
|
1468
1468
|
*/
|
|
1469
1469
|
listenChangesEntityTable(entityClassFn) {
|
|
1470
|
-
const className =
|
|
1470
|
+
const className = ClassHelpers__NS__getName(entityClassFn);
|
|
1471
1471
|
return this.listenChangesEntity(entityClassFn, {
|
|
1472
|
-
customEvent:
|
|
1472
|
+
customEvent: Symbols__NS__REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className),
|
|
1473
1473
|
});
|
|
1474
1474
|
}
|
|
1475
1475
|
//#endregion
|
|
@@ -1766,7 +1766,7 @@ class RealtimeServer {
|
|
|
1766
1766
|
*/
|
|
1767
1767
|
idToTrigger) {
|
|
1768
1768
|
if (this.core.ctx.disabledRealtime) {
|
|
1769
|
-
const className =
|
|
1769
|
+
const className = ClassHelpers__NS__getName(entityObjOrClass);
|
|
1770
1770
|
console.warn(`[Taon][TriggerEntityChanges] Entity "${className}' is not realtime`);
|
|
1771
1771
|
return;
|
|
1772
1772
|
}
|
|
@@ -1786,7 +1786,7 @@ class RealtimeServer {
|
|
|
1786
1786
|
*/
|
|
1787
1787
|
idToTrigger) {
|
|
1788
1788
|
if (this.core.ctx.disabledRealtime) {
|
|
1789
|
-
const className =
|
|
1789
|
+
const className = ClassHelpers__NS__getName(entityObjOrClass);
|
|
1790
1790
|
console.warn(`[Taon][TriggerEntityPropertyChanges][property=${property}] Entity "${className}' is not realtime`);
|
|
1791
1791
|
return;
|
|
1792
1792
|
}
|
|
@@ -1802,12 +1802,12 @@ class RealtimeServer {
|
|
|
1802
1802
|
//#endregion
|
|
1803
1803
|
//#region methods & getters / trigger entity table changes
|
|
1804
1804
|
triggerEntityTableChanges(entityClassOrInstance) {
|
|
1805
|
-
const className =
|
|
1805
|
+
const className = ClassHelpers__NS__getName(entityClassOrInstance);
|
|
1806
1806
|
if (this.core.ctx.disabledRealtime) {
|
|
1807
1807
|
console.warn(`[Taon][TriggerEntityTableChanges] Entity "${className}' is not realtime`);
|
|
1808
1808
|
return;
|
|
1809
1809
|
}
|
|
1810
|
-
this.triggerChanges(entityClassOrInstance, void 0, void 0,
|
|
1810
|
+
this.triggerChanges(entityClassOrInstance, void 0, void 0, Symbols__NS__REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className));
|
|
1811
1811
|
}
|
|
1812
1812
|
//#endregion
|
|
1813
1813
|
//#endregion
|
|
@@ -2336,11 +2336,11 @@ class MockSocket {
|
|
|
2336
2336
|
//#region emit
|
|
2337
2337
|
emit(eventName, ...args) {
|
|
2338
2338
|
eventName = eventName || '';
|
|
2339
|
-
if (eventName.includes(`:${
|
|
2339
|
+
if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomSubscribe}`)) {
|
|
2340
2340
|
const room = args[0];
|
|
2341
2341
|
this.join(room);
|
|
2342
2342
|
}
|
|
2343
|
-
else if (eventName.includes(`:${
|
|
2343
|
+
else if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomUnsubscribe}`)) {
|
|
2344
2344
|
const room = args[0];
|
|
2345
2345
|
this.leave(room);
|
|
2346
2346
|
}
|
|
@@ -2628,18 +2628,18 @@ class EndpointContext {
|
|
|
2628
2628
|
//#endregion
|
|
2629
2629
|
//#region fields / types from contexts
|
|
2630
2630
|
this.injectableTypesfromContexts = [
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2631
|
+
Models__NS__ClassType.CONTROLLER,
|
|
2632
|
+
Models__NS__ClassType.PROVIDER,
|
|
2633
|
+
Models__NS__ClassType.MIDDLEWARE,
|
|
2634
|
+
Models__NS__ClassType.REPOSITORY,
|
|
2635
|
+
Models__NS__ClassType.SUBSCRIBER,
|
|
2636
|
+
Models__NS__ClassType.MIGRATION,
|
|
2637
2637
|
];
|
|
2638
2638
|
//#endregion
|
|
2639
2639
|
//#region fields / all types from contexts
|
|
2640
2640
|
this.allTypesfromContexts = [
|
|
2641
2641
|
...this.injectableTypesfromContexts,
|
|
2642
|
-
|
|
2642
|
+
Models__NS__ClassType.ENTITY,
|
|
2643
2643
|
];
|
|
2644
2644
|
//#endregion
|
|
2645
2645
|
//#region fields / express app
|
|
@@ -2664,7 +2664,7 @@ class EndpointContext {
|
|
|
2664
2664
|
// Return a new class that extends the base class
|
|
2665
2665
|
const cloneClass = () => {
|
|
2666
2666
|
var _a, _b, _c, _d, _e;
|
|
2667
|
-
if (TaonBaseClass[
|
|
2667
|
+
if (TaonBaseClass[Symbols__NS__fullClassNameStaticProperty] ===
|
|
2668
2668
|
`${ctx.contextName}.${className}`) {
|
|
2669
2669
|
return TaonBaseClass;
|
|
2670
2670
|
}
|
|
@@ -2676,7 +2676,7 @@ class EndpointContext {
|
|
|
2676
2676
|
// You can override prototype properties or methods here if needed
|
|
2677
2677
|
// static properties override allowed
|
|
2678
2678
|
}
|
|
2679
|
-
static { _a =
|
|
2679
|
+
static { _a = Symbols__NS__orignalClass, _b = Symbols__NS__fullClassNameStaticProperty, _c = Symbols__NS__classNameStaticProperty, _d = Symbols__NS__ctxInClassOrClassObj, _e = Symbols__NS__ctxInClassOrClassObj; }
|
|
2680
2680
|
// @ts-ignore
|
|
2681
2681
|
static { this[_a] = TaonBaseClass; }
|
|
2682
2682
|
// @ts-ignore
|
|
@@ -2686,13 +2686,13 @@ class EndpointContext {
|
|
|
2686
2686
|
static { this[_d] = ctx; }
|
|
2687
2687
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
2688
2688
|
static __getFullPathForClass__(arr = []) {
|
|
2689
|
-
const name = this[
|
|
2689
|
+
const name = this[Symbols__NS__fullClassNameStaticProperty];
|
|
2690
2690
|
arr.push(name);
|
|
2691
2691
|
// @ts-ignore
|
|
2692
|
-
if (this[
|
|
2693
|
-
this[
|
|
2692
|
+
if (this[Symbols__NS__orignalClass] && // @ts-ignore
|
|
2693
|
+
this[Symbols__NS__orignalClass].__getFullPathForClass__) {
|
|
2694
2694
|
// @ts-ignore
|
|
2695
|
-
this[
|
|
2695
|
+
this[Symbols__NS__orignalClass].__getFullPathForClass__(arr);
|
|
2696
2696
|
}
|
|
2697
2697
|
return arr.join('/');
|
|
2698
2698
|
}
|
|
@@ -2705,19 +2705,19 @@ class EndpointContext {
|
|
|
2705
2705
|
//#region gather all instances for all contexts
|
|
2706
2706
|
// TODO this is not needed anymore - for typeorm I use normal entities
|
|
2707
2707
|
// this thinng belowe is nice for debugging purpose
|
|
2708
|
-
// if (_.isUndefined(cloneClassFunction[
|
|
2709
|
-
// cloneClassFunction[
|
|
2708
|
+
// if (_.isUndefined(cloneClassFunction[Symbols__NS__orignalClassClonesObj])) {
|
|
2709
|
+
// cloneClassFunction[Symbols__NS__orignalClassClonesObj] = {};
|
|
2710
2710
|
// }
|
|
2711
|
-
// if (_.isUndefined(TaonBaseClass[
|
|
2712
|
-
// TaonBaseClass[
|
|
2711
|
+
// if (_.isUndefined(TaonBaseClass[Symbols__NS__orignalClassClonesObj])) {
|
|
2712
|
+
// TaonBaseClass[Symbols__NS__orignalClassClonesObj] = {};
|
|
2713
2713
|
// }
|
|
2714
2714
|
// const all = {
|
|
2715
|
-
// ...TaonBaseClass[
|
|
2716
|
-
// ...cloneClassFunction[
|
|
2715
|
+
// ...TaonBaseClass[Symbols__NS__orignalClassClonesObj],
|
|
2716
|
+
// ...cloneClassFunction[Symbols__NS__orignalClassClonesObj],
|
|
2717
2717
|
// };
|
|
2718
2718
|
// all[ctx.contextName] = cloneClassFunction;
|
|
2719
|
-
// cloneClassFunction[
|
|
2720
|
-
// TaonBaseClass[
|
|
2719
|
+
// cloneClassFunction[Symbols__NS__orignalClassClonesObj] = all;
|
|
2720
|
+
// TaonBaseClass[Symbols__NS__orignalClassClonesObj] = all;
|
|
2721
2721
|
//#endregion
|
|
2722
2722
|
return cloneClassFunction;
|
|
2723
2723
|
};
|
|
@@ -2736,13 +2736,13 @@ class EndpointContext {
|
|
|
2736
2736
|
|
|
2737
2737
|
`);
|
|
2738
2738
|
}
|
|
2739
|
-
var className = Reflect.getMetadata(
|
|
2739
|
+
var className = Reflect.getMetadata(Symbols__NS__metadata.className, TaonBaseClass);
|
|
2740
2740
|
// console.log('Metadata className', className, TaonBaseClass);
|
|
2741
2741
|
// if (!className) {
|
|
2742
2742
|
// console.warn(`Please provide className for ${TaonBaseClass.name} class`);
|
|
2743
2743
|
// }
|
|
2744
2744
|
className = className || key;
|
|
2745
|
-
TaonBaseClass[
|
|
2745
|
+
TaonBaseClass[Symbols__NS__classNameStaticProperty] = className;
|
|
2746
2746
|
const clonedClass = this.cloneClassWithNewMetadata({
|
|
2747
2747
|
TaonBaseClass,
|
|
2748
2748
|
className,
|
|
@@ -2755,7 +2755,7 @@ class EndpointContext {
|
|
|
2755
2755
|
return classes;
|
|
2756
2756
|
};
|
|
2757
2757
|
this.cloneOptions = this.cloneOptions || {};
|
|
2758
|
-
this.isRunningInsideDocker =
|
|
2758
|
+
this.isRunningInsideDocker = UtilsOs__NS__isRunningInDocker();
|
|
2759
2759
|
}
|
|
2760
2760
|
//#endregion
|
|
2761
2761
|
//#region methods & getters / init
|
|
@@ -2768,7 +2768,7 @@ class EndpointContext {
|
|
|
2768
2768
|
this.onlyMigrationRevertToTimestamp = onlyMigrationRevertToTimestamp;
|
|
2769
2769
|
this.config = this.configFn({});
|
|
2770
2770
|
if (_.isObject(this.config.database)) {
|
|
2771
|
-
this.config.database =
|
|
2771
|
+
this.config.database = Models__NS__DatabaseConfig.from(this.config.database).databaseConfigTypeORM;
|
|
2772
2772
|
}
|
|
2773
2773
|
this.config.host = this.host === null ? void 0 : this.host;
|
|
2774
2774
|
if (this.cloneOptions.overrideHost &&
|
|
@@ -2880,31 +2880,31 @@ class EndpointContext {
|
|
|
2880
2880
|
this.config.subscribers = this.config.subscribers || {};
|
|
2881
2881
|
this.config.migrations = this.config.migrations || {};
|
|
2882
2882
|
this.config.entities = {
|
|
2883
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2883
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.ENTITY)),
|
|
2884
2884
|
...this.config.entities,
|
|
2885
2885
|
};
|
|
2886
2886
|
this.config.controllers = {
|
|
2887
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2887
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.CONTROLLER)),
|
|
2888
2888
|
...this.config.controllers,
|
|
2889
2889
|
};
|
|
2890
2890
|
this.config.providers = {
|
|
2891
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2891
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.PROVIDER)),
|
|
2892
2892
|
...this.config.providers,
|
|
2893
2893
|
};
|
|
2894
2894
|
this.config.middlewares = {
|
|
2895
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2895
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.MIDDLEWARE)),
|
|
2896
2896
|
...this.config.middlewares,
|
|
2897
2897
|
};
|
|
2898
2898
|
this.config.subscribers = {
|
|
2899
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2899
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.SUBSCRIBER)),
|
|
2900
2900
|
...this.config.subscribers,
|
|
2901
2901
|
};
|
|
2902
2902
|
this.config.repositories = {
|
|
2903
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2903
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.REPOSITORY)),
|
|
2904
2904
|
...this.config.repositories,
|
|
2905
2905
|
};
|
|
2906
2906
|
this.config.migrations = {
|
|
2907
|
-
...(await this.getRecrusiveClassesfromContextsObj(
|
|
2907
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models__NS__ClassType.MIGRATION)),
|
|
2908
2908
|
...this.config.migrations,
|
|
2909
2909
|
};
|
|
2910
2910
|
// console.log(this.config);
|
|
@@ -2915,37 +2915,37 @@ class EndpointContext {
|
|
|
2915
2915
|
classesInput: this.config.controllers,
|
|
2916
2916
|
config: this.config,
|
|
2917
2917
|
ctx: this,
|
|
2918
|
-
classType:
|
|
2918
|
+
classType: Models__NS__ClassType.CONTROLLER,
|
|
2919
2919
|
});
|
|
2920
2920
|
this.config.repositories = this.cloneClassesObjWithNewMetadata({
|
|
2921
2921
|
classesInput: this.config.repositories,
|
|
2922
2922
|
config: this.config,
|
|
2923
2923
|
ctx: this,
|
|
2924
|
-
classType:
|
|
2924
|
+
classType: Models__NS__ClassType.REPOSITORY,
|
|
2925
2925
|
});
|
|
2926
2926
|
this.config.providers = this.cloneClassesObjWithNewMetadata({
|
|
2927
2927
|
classesInput: this.config.providers,
|
|
2928
2928
|
config: this.config,
|
|
2929
2929
|
ctx: this,
|
|
2930
|
-
classType:
|
|
2930
|
+
classType: Models__NS__ClassType.PROVIDER,
|
|
2931
2931
|
});
|
|
2932
2932
|
this.config.middlewares = this.cloneClassesObjWithNewMetadata({
|
|
2933
2933
|
classesInput: this.config.middlewares,
|
|
2934
2934
|
config: this.config,
|
|
2935
2935
|
ctx: this,
|
|
2936
|
-
classType:
|
|
2936
|
+
classType: Models__NS__ClassType.MIDDLEWARE,
|
|
2937
2937
|
});
|
|
2938
2938
|
this.config.subscribers = this.cloneClassesObjWithNewMetadata({
|
|
2939
2939
|
classesInput: this.config.subscribers,
|
|
2940
2940
|
config: this.config,
|
|
2941
2941
|
ctx: this,
|
|
2942
|
-
classType:
|
|
2942
|
+
classType: Models__NS__ClassType.SUBSCRIBER,
|
|
2943
2943
|
});
|
|
2944
2944
|
this.config.migrations = this.cloneClassesObjWithNewMetadata({
|
|
2945
2945
|
classesInput: this.config.migrations,
|
|
2946
2946
|
config: this.config,
|
|
2947
2947
|
ctx: this,
|
|
2948
|
-
classType:
|
|
2948
|
+
classType: Models__NS__ClassType.MIGRATION,
|
|
2949
2949
|
});
|
|
2950
2950
|
//#endregion
|
|
2951
2951
|
//#region prepare instances
|
|
@@ -2954,7 +2954,7 @@ class EndpointContext {
|
|
|
2954
2954
|
this.objWithClassesInstancesArr[classTypeName] = [];
|
|
2955
2955
|
}
|
|
2956
2956
|
for (const classTypeName of this.injectableTypesfromContexts) {
|
|
2957
|
-
await this.createInstances(this.config[
|
|
2957
|
+
await this.createInstances(this.config[Models__NS__ClassTypeKey[classTypeName]], classTypeName);
|
|
2958
2958
|
}
|
|
2959
2959
|
//#endregion
|
|
2960
2960
|
if (!this.isRunOrRevertOnlyMigrationAppStart) {
|
|
@@ -3271,7 +3271,7 @@ class EndpointContext {
|
|
|
3271
3271
|
async getRecrusiveClassesfromContextsObj(classType) {
|
|
3272
3272
|
const arr = await this.getRecrusiveClassesfromContexts(classType);
|
|
3273
3273
|
return arr.reduce((acc, c) => {
|
|
3274
|
-
acc[
|
|
3274
|
+
acc[ClassHelpers__NS__getName(c)] = c;
|
|
3275
3275
|
return acc;
|
|
3276
3276
|
}, {});
|
|
3277
3277
|
}
|
|
@@ -3311,9 +3311,9 @@ class EndpointContext {
|
|
|
3311
3311
|
//#endregion
|
|
3312
3312
|
//#region methods & getters / inject
|
|
3313
3313
|
inject(ctor, options) {
|
|
3314
|
-
const className =
|
|
3314
|
+
const className = ClassHelpers__NS__getName(ctor);
|
|
3315
3315
|
const locaInstanceConstructorArgs = options.locaInstanceConstructorArgs || [];
|
|
3316
|
-
if (this.isCLassType(
|
|
3316
|
+
if (this.isCLassType(Models__NS__ClassType.REPOSITORY, ctor)) {
|
|
3317
3317
|
options.localInstance = true;
|
|
3318
3318
|
}
|
|
3319
3319
|
if (options?.localInstance) {
|
|
@@ -3323,7 +3323,7 @@ class EndpointContext {
|
|
|
3323
3323
|
// if (className === 'TaonBaseRepository') {
|
|
3324
3324
|
const entityFn = _.first(locaInstanceConstructorArgs);
|
|
3325
3325
|
const entity = entityFn && entityFn();
|
|
3326
|
-
entityName = (entity &&
|
|
3326
|
+
entityName = (entity && ClassHelpers__NS__getName(entity)) || '';
|
|
3327
3327
|
// console.log(`entityName `, entityName);
|
|
3328
3328
|
// }
|
|
3329
3329
|
if (!options.contextClassInstance[this.localInstaceObjSymbol]) {
|
|
@@ -3333,12 +3333,12 @@ class EndpointContext {
|
|
|
3333
3333
|
const existed = options.contextClassInstance[this.localInstaceObjSymbol][instanceKey];
|
|
3334
3334
|
if (existed) {
|
|
3335
3335
|
// console.log(
|
|
3336
|
-
// `EXISTED ${
|
|
3336
|
+
// `EXISTED ${ClassHelpers__NS__getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
|
|
3337
3337
|
// );
|
|
3338
3338
|
return existed;
|
|
3339
3339
|
}
|
|
3340
3340
|
// console.log(
|
|
3341
|
-
// `NEW ${
|
|
3341
|
+
// `NEW ${ClassHelpers__NS__getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
|
|
3342
3342
|
// );
|
|
3343
3343
|
if (!ctxClassFn) {
|
|
3344
3344
|
throw new Error(`Not able to inject "${className}" inside context "${this.contextName}"
|
|
@@ -3364,11 +3364,11 @@ class EndpointContext {
|
|
|
3364
3364
|
*/
|
|
3365
3365
|
getInstanceBy(ctor) {
|
|
3366
3366
|
// if (!!this.__contextForControllerInstanceAccess) {
|
|
3367
|
-
// const className =
|
|
3368
|
-
// const allControllers = this.getClassFunByArr(
|
|
3367
|
+
// const className = ClassHelpers__NS__getName(ctor);
|
|
3368
|
+
// const allControllers = this.getClassFunByArr(Models__NS__ClassType.CONTROLLER);
|
|
3369
3369
|
// // TODO QUICK_FIX cache controllers
|
|
3370
3370
|
// for (const ctrl of allControllers) {
|
|
3371
|
-
// if (
|
|
3371
|
+
// if (ClassHelpers__NS__getName(ctrl) === className) {
|
|
3372
3372
|
// // console.log('injecting from contextForControllerInstanceAcesss', className);
|
|
3373
3373
|
// return this.__contextForControllerInstanceAccess.inject(ctor, {
|
|
3374
3374
|
// localInstance: false,
|
|
@@ -3400,24 +3400,24 @@ class EndpointContext {
|
|
|
3400
3400
|
getClassFunBy(classType) {
|
|
3401
3401
|
this.checkIfContextInitialized();
|
|
3402
3402
|
switch (classType) {
|
|
3403
|
-
case
|
|
3403
|
+
case Models__NS__ClassType.CONTROLLER:
|
|
3404
3404
|
return this.config.controllers;
|
|
3405
|
-
case
|
|
3405
|
+
case Models__NS__ClassType.ENTITY:
|
|
3406
3406
|
return this.config.entities;
|
|
3407
|
-
case
|
|
3407
|
+
case Models__NS__ClassType.PROVIDER:
|
|
3408
3408
|
return this.config.providers;
|
|
3409
|
-
case
|
|
3409
|
+
case Models__NS__ClassType.MIDDLEWARE:
|
|
3410
3410
|
return this.config.middlewares;
|
|
3411
|
-
case
|
|
3411
|
+
case Models__NS__ClassType.REPOSITORY:
|
|
3412
3412
|
return this.config.repositories;
|
|
3413
|
-
case
|
|
3413
|
+
case Models__NS__ClassType.SUBSCRIBER:
|
|
3414
3414
|
return this.config.subscribers;
|
|
3415
|
-
case
|
|
3415
|
+
case Models__NS__ClassType.MIGRATION:
|
|
3416
3416
|
return this.config.migrations;
|
|
3417
3417
|
}
|
|
3418
3418
|
}
|
|
3419
3419
|
isCLassType(classType, classFn) {
|
|
3420
|
-
return !!this.getClassFunBy(classType)[
|
|
3420
|
+
return !!this.getClassFunBy(classType)[ClassHelpers__NS__getName(classFn)];
|
|
3421
3421
|
}
|
|
3422
3422
|
/**
|
|
3423
3423
|
* Only for injectable types
|
|
@@ -3425,14 +3425,14 @@ class EndpointContext {
|
|
|
3425
3425
|
*/
|
|
3426
3426
|
getClassFunByClassName(className) {
|
|
3427
3427
|
for (const classTypeName of this.allTypesfromContexts) {
|
|
3428
|
-
const classesForInjectableType = this.config[
|
|
3428
|
+
const classesForInjectableType = this.config[Models__NS__ClassTypeKey[classTypeName]];
|
|
3429
3429
|
if (classesForInjectableType[className]) {
|
|
3430
3430
|
return classesForInjectableType[className];
|
|
3431
3431
|
}
|
|
3432
3432
|
}
|
|
3433
3433
|
}
|
|
3434
3434
|
getClassFunByClass(classFunction) {
|
|
3435
|
-
const className =
|
|
3435
|
+
const className = ClassHelpers__NS__getName(classFunction);
|
|
3436
3436
|
return this.getClassFunByClassName(className);
|
|
3437
3437
|
}
|
|
3438
3438
|
getClassFunByArr(classType) {
|
|
@@ -3451,11 +3451,11 @@ class EndpointContext {
|
|
|
3451
3451
|
]) {
|
|
3452
3452
|
const instance = DITaonContainer.resolve(classFn);
|
|
3453
3453
|
const classInstancesByNameObj = this.classInstancesByNameObj[classType];
|
|
3454
|
-
const className =
|
|
3454
|
+
const className = ClassHelpers__NS__getName(classFn);
|
|
3455
3455
|
// console.log({ classFn, classType, instance, place, className, 'classInstancesByNameObj': this.classInstancesByNameObj });
|
|
3456
3456
|
classInstancesByNameObj[className] = instance;
|
|
3457
3457
|
// update config
|
|
3458
|
-
this.config[
|
|
3458
|
+
this.config[Models__NS__ClassTypeKey[classType]][className] = classFn;
|
|
3459
3459
|
this.objWithClassesInstancesArr[classType].push(instance);
|
|
3460
3460
|
this.allClassesInstances[className] = instance;
|
|
3461
3461
|
}
|
|
@@ -3476,12 +3476,12 @@ class EndpointContext {
|
|
|
3476
3476
|
/* */
|
|
3477
3477
|
/* */
|
|
3478
3478
|
for (const classTypeName of [
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3479
|
+
Models__NS__ClassType.MIDDLEWARE,
|
|
3480
|
+
Models__NS__ClassType.PROVIDER,
|
|
3481
|
+
Models__NS__ClassType.REPOSITORY,
|
|
3482
|
+
Models__NS__ClassType.CONTROLLER,
|
|
3483
|
+
Models__NS__ClassType.ENTITY,
|
|
3484
|
+
Models__NS__ClassType.MIGRATION,
|
|
3485
3485
|
]) {
|
|
3486
3486
|
//#region init class static _ property
|
|
3487
3487
|
for (const classFun of this.getClassFunByArr(classTypeName)) {
|
|
@@ -3492,11 +3492,11 @@ class EndpointContext {
|
|
|
3492
3492
|
//#endregion
|
|
3493
3493
|
}
|
|
3494
3494
|
for (const classTypeName of [
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3495
|
+
Models__NS__ClassType.MIDDLEWARE,
|
|
3496
|
+
Models__NS__ClassType.PROVIDER,
|
|
3497
|
+
Models__NS__ClassType.REPOSITORY,
|
|
3498
|
+
Models__NS__ClassType.CONTROLLER,
|
|
3499
|
+
Models__NS__ClassType.MIGRATION,
|
|
3500
3500
|
]) {
|
|
3501
3501
|
//#region init providers, repositories _ property
|
|
3502
3502
|
// Helpers.taskStarted(
|
|
@@ -3516,7 +3516,7 @@ class EndpointContext {
|
|
|
3516
3516
|
//#endregion
|
|
3517
3517
|
//#region methods & getters / is active on
|
|
3518
3518
|
isActiveOn(classInstance) {
|
|
3519
|
-
let contextRef = classInstance[
|
|
3519
|
+
let contextRef = classInstance[Symbols__NS__ctxInClassOrClassObj];
|
|
3520
3520
|
return this === contextRef;
|
|
3521
3521
|
}
|
|
3522
3522
|
//#endregion
|
|
@@ -3879,20 +3879,20 @@ class EndpointContext {
|
|
|
3879
3879
|
const parentsCalculatedPath = _.slice(rawConfigs, 1)
|
|
3880
3880
|
.reverse()
|
|
3881
3881
|
.map(bc => {
|
|
3882
|
-
if (
|
|
3882
|
+
if (TaonHelpers__NS__isGoodPath(bc.path)) {
|
|
3883
3883
|
return bc.path;
|
|
3884
3884
|
}
|
|
3885
3885
|
return bc.className;
|
|
3886
3886
|
})
|
|
3887
3887
|
.join('/');
|
|
3888
3888
|
const contextNameForCommunication = this.contextNameForCommunication;
|
|
3889
|
-
if (
|
|
3889
|
+
if (TaonHelpers__NS__isGoodPath(classConfig.path)) {
|
|
3890
3890
|
classConfig.calculatedPath = classConfig.path;
|
|
3891
3891
|
}
|
|
3892
3892
|
else {
|
|
3893
3893
|
classConfig.calculatedPath = (`${this.uriPathnameOrNothingIfRoot}` +
|
|
3894
3894
|
`/${apiPrefix}/${contextNameForCommunication}/tcp${parentsCalculatedPath}/` +
|
|
3895
|
-
`${
|
|
3895
|
+
`${ClassHelpers__NS__getName(controllerClassFn)}`)
|
|
3896
3896
|
.replace(/\/\//g, '/')
|
|
3897
3897
|
.split('/')
|
|
3898
3898
|
.reduce((acc, bc) => {
|
|
@@ -3925,7 +3925,7 @@ class EndpointContext {
|
|
|
3925
3925
|
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
3926
3926
|
return;
|
|
3927
3927
|
}
|
|
3928
|
-
const allControllers = this.getClassFunByArr(
|
|
3928
|
+
const allControllers = this.getClassFunByArr(Models__NS__ClassType.CONTROLLER);
|
|
3929
3929
|
for (const controllerClassFn of allControllers) {
|
|
3930
3930
|
const instance = this.getInstanceBy(controllerClassFn);
|
|
3931
3931
|
if (_.isFunction(instance.afterAllCtxInited)) {
|
|
@@ -3937,21 +3937,21 @@ class EndpointContext {
|
|
|
3937
3937
|
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
3938
3938
|
return;
|
|
3939
3939
|
}
|
|
3940
|
-
const allControllers = this.getClassFunByArr(
|
|
3940
|
+
const allControllers = this.getClassFunByArr(Models__NS__ClassType.CONTROLLER);
|
|
3941
3941
|
// debugger
|
|
3942
3942
|
// console.log('allControllers', allControllers);
|
|
3943
3943
|
for (const controllerClassFn of allControllers) {
|
|
3944
|
-
// console.log(
|
|
3945
|
-
// const controllerName =
|
|
3944
|
+
// console.log(ClassHelpers__NS__getClassConfig(controllerClassFn));
|
|
3945
|
+
// const controllerName = ClassHelpers__NS__getName(controllerClassFn);
|
|
3946
3946
|
// console.log(
|
|
3947
3947
|
// `for ${controllerName}`,
|
|
3948
|
-
//
|
|
3948
|
+
// ClassHelpers__NS__getClassConfig(controllerClassFn),
|
|
3949
3949
|
// );
|
|
3950
|
-
controllerClassFn[
|
|
3951
|
-
|
|
3952
|
-
const rawConfigs =
|
|
3950
|
+
controllerClassFn[Symbols__NS__classMethodsNames] =
|
|
3951
|
+
ClassHelpers__NS__getMethodsNames(controllerClassFn);
|
|
3952
|
+
const rawConfigs = ClassHelpers__NS__getControllerConfigs(controllerClassFn);
|
|
3953
3953
|
// console.log(controllerName, { rawConfigs });
|
|
3954
|
-
// console.log(`Class config for ${
|
|
3954
|
+
// console.log(`Class config for ${ClassHelpers__NS__getName(controllerClassFn)}`, configs)
|
|
3955
3955
|
const classConfig = rawConfigs[0];
|
|
3956
3956
|
this.updateCalculatedPathsForControllers(rawConfigs, classConfig, controllerClassFn);
|
|
3957
3957
|
this.mergeControllerMethodsConfigs(rawConfigs, classConfig, controllerClassFn);
|
|
@@ -3962,7 +3962,7 @@ class EndpointContext {
|
|
|
3962
3962
|
classConfig.calculatedMiddlewaresControllerObj = rc.middlewares({
|
|
3963
3963
|
parentMiddlewares: classConfig.calculatedMiddlewaresControllerObj,
|
|
3964
3964
|
className(middlewareClass) {
|
|
3965
|
-
return
|
|
3965
|
+
return ClassHelpers__NS__getName(controllerClassFn);
|
|
3966
3966
|
},
|
|
3967
3967
|
});
|
|
3968
3968
|
}
|
|
@@ -3989,7 +3989,7 @@ class EndpointContext {
|
|
|
3989
3989
|
calculatedMiddlewaresMethodObj = parentMethodConfig.middlewares({
|
|
3990
3990
|
parentMiddlewares: calculatedMiddlewaresMethodObj,
|
|
3991
3991
|
className(middlewareClass) {
|
|
3992
|
-
return
|
|
3992
|
+
return ClassHelpers__NS__getName(controllerClassFn);
|
|
3993
3993
|
},
|
|
3994
3994
|
});
|
|
3995
3995
|
}
|
|
@@ -4012,7 +4012,7 @@ class EndpointContext {
|
|
|
4012
4012
|
: '';
|
|
4013
4013
|
const expressPath = methodConfig.global
|
|
4014
4014
|
? `${globalPathPart}/${methodConfig.path?.replace(/\/$/, '')}`.replace(/\/\//, '/')
|
|
4015
|
-
:
|
|
4015
|
+
: TaonHelpers__NS__getExpressPath(classConfig, methodConfig);
|
|
4016
4016
|
//#endregion
|
|
4017
4017
|
//#region init server
|
|
4018
4018
|
// console.log({ expressPath });
|
|
@@ -4039,7 +4039,7 @@ class EndpointContext {
|
|
|
4039
4039
|
if (shouldInitClient) {
|
|
4040
4040
|
// console.log(
|
|
4041
4041
|
// 'initClient',
|
|
4042
|
-
//
|
|
4042
|
+
// ClassHelpers__NS__getFullInternalName(controllerClassFn),
|
|
4043
4043
|
// type,
|
|
4044
4044
|
// methodConfig,
|
|
4045
4045
|
// expressPath,
|
|
@@ -4113,12 +4113,12 @@ class EndpointContext {
|
|
|
4113
4113
|
//#endregion
|
|
4114
4114
|
//#region methods & getters / init middlewares
|
|
4115
4115
|
async initCustomClientMiddlewares() {
|
|
4116
|
-
const middlewares = this.getClassesInstancesArrBy(
|
|
4116
|
+
const middlewares = this.getClassesInstancesArrBy(Models__NS__ClassType.MIDDLEWARE)
|
|
4117
4117
|
.map(f => f)
|
|
4118
4118
|
.filter(f => _.isFunction(f.interceptClient));
|
|
4119
4119
|
middlewares.forEach(middlewareInstanceName => {
|
|
4120
4120
|
const contextName = this.contextName;
|
|
4121
|
-
const interceptorName = `${contextName}-${
|
|
4121
|
+
const interceptorName = `${contextName}-${ClassHelpers__NS__getName(middlewareInstanceName)}`;
|
|
4122
4122
|
Resource.request.interceptors.set(interceptorName, {
|
|
4123
4123
|
intercept: ({ req, next }) => {
|
|
4124
4124
|
const url = new URL(req.url);
|
|
@@ -4290,7 +4290,7 @@ class EndpointContext {
|
|
|
4290
4290
|
const middlewareInstance = this.getInstanceBy(middlewareClassFun);
|
|
4291
4291
|
if (middlewareInstance &&
|
|
4292
4292
|
_.isFunction(middlewareInstance.interceptServerMethod)) {
|
|
4293
|
-
const middlewareFn =
|
|
4293
|
+
const middlewareFn = ClassHelpers__NS__asyncHandler(async (req, res, next) => {
|
|
4294
4294
|
await middlewareInstance.interceptServerMethod({
|
|
4295
4295
|
req,
|
|
4296
4296
|
res,
|
|
@@ -4631,7 +4631,7 @@ class EndpointContext {
|
|
|
4631
4631
|
.map(f => this.getInstanceBy(f))
|
|
4632
4632
|
.filter(f => _.isFunction(f.interceptClientMethod));
|
|
4633
4633
|
middlewaresInstances.forEach(instance => {
|
|
4634
|
-
const middlewareName =
|
|
4634
|
+
const middlewareName = ClassHelpers__NS__getName(instance);
|
|
4635
4635
|
// middlewareName - only needed for inheritace and uniqness of interceptors
|
|
4636
4636
|
const interceptorKey = `${middlewareName}-${methodConfig.type?.toUpperCase()}-${expressPath}`;
|
|
4637
4637
|
Resource.request.methodsInterceptors.set(interceptorKey, {
|
|
@@ -4663,14 +4663,14 @@ class EndpointContext {
|
|
|
4663
4663
|
target.prototype[methodConfig.methodName] = function (...args) {
|
|
4664
4664
|
const received = new Promise(async (resolve, reject) => {
|
|
4665
4665
|
const headers = {};
|
|
4666
|
-
const { request, response } =
|
|
4666
|
+
const { request, response } = TaonHelpers__NS__websqlMocks(headers);
|
|
4667
4667
|
//#region @browser
|
|
4668
|
-
ipcRenderer.once(
|
|
4668
|
+
ipcRenderer.once(TaonHelpers__NS__ipcKeyNameResponse(target, methodConfig, expressPath), (event, responseData) => {
|
|
4669
4669
|
let res = responseData;
|
|
4670
4670
|
console.log({ responseData });
|
|
4671
4671
|
try {
|
|
4672
4672
|
const body = res;
|
|
4673
|
-
res = new
|
|
4673
|
+
res = new Models__NS__HttpResponse({
|
|
4674
4674
|
body: void 0,
|
|
4675
4675
|
isArray: void 0,
|
|
4676
4676
|
method: methodConfig.type,
|
|
@@ -4686,7 +4686,7 @@ class EndpointContext {
|
|
|
4686
4686
|
reject(error);
|
|
4687
4687
|
}
|
|
4688
4688
|
});
|
|
4689
|
-
ipcRenderer.send(
|
|
4689
|
+
ipcRenderer.send(TaonHelpers__NS__ipcKeyNameRequest(target, methodConfig, expressPath), args);
|
|
4690
4690
|
//#endregion
|
|
4691
4691
|
});
|
|
4692
4692
|
received['observable'] = from(received);
|
|
@@ -4857,34 +4857,34 @@ class EndpointContext {
|
|
|
4857
4857
|
// console.log('[init method browser] FRONTEND expressPath', expressPath)
|
|
4858
4858
|
// const productionMode = FrameworkContext.isProductionMode;
|
|
4859
4859
|
//#region resolve frontend parameters
|
|
4860
|
-
if (!storage[
|
|
4861
|
-
storage[
|
|
4862
|
-
if (!storage[
|
|
4863
|
-
storage[
|
|
4864
|
-
const endpoints = storage[
|
|
4860
|
+
if (!storage[Symbols__NS__old.ENDPOINT_META_CONFIG])
|
|
4861
|
+
storage[Symbols__NS__old.ENDPOINT_META_CONFIG] = {};
|
|
4862
|
+
if (!storage[Symbols__NS__old.ENDPOINT_META_CONFIG][ctx.uriOrigin])
|
|
4863
|
+
storage[Symbols__NS__old.ENDPOINT_META_CONFIG][ctx.uriOrigin] = {};
|
|
4864
|
+
const endpoints = storage[Symbols__NS__old.ENDPOINT_META_CONFIG];
|
|
4865
4865
|
let rest;
|
|
4866
4866
|
if (!endpoints[ctx.uriOrigin][expressPath]) {
|
|
4867
4867
|
let headers = {};
|
|
4868
4868
|
if (methodConfig.contentType && !methodConfig.responseType) {
|
|
4869
|
-
rest = Resource.create(ctx.uriOrigin, expressPath,
|
|
4869
|
+
rest = Resource.create(ctx.uriOrigin, expressPath, Symbols__NS__old.MAPPING_CONFIG_HEADER, Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
|
|
4870
4870
|
'Content-Type': methodConfig.contentType,
|
|
4871
4871
|
Accept: methodConfig.contentType,
|
|
4872
4872
|
}));
|
|
4873
4873
|
}
|
|
4874
4874
|
else if (methodConfig.contentType && methodConfig.responseType) {
|
|
4875
|
-
rest = Resource.create(ctx.uriOrigin, expressPath,
|
|
4875
|
+
rest = Resource.create(ctx.uriOrigin, expressPath, Symbols__NS__old.MAPPING_CONFIG_HEADER, Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
|
|
4876
4876
|
'Content-Type': methodConfig.contentType,
|
|
4877
4877
|
Accept: methodConfig.contentType,
|
|
4878
4878
|
responsetypeaxios: methodConfig.responseType,
|
|
4879
4879
|
}));
|
|
4880
4880
|
}
|
|
4881
4881
|
else if (!methodConfig.contentType && methodConfig.responseType) {
|
|
4882
|
-
rest = Resource.create(ctx.uriOrigin, expressPath,
|
|
4882
|
+
rest = Resource.create(ctx.uriOrigin, expressPath, Symbols__NS__old.MAPPING_CONFIG_HEADER, Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
|
|
4883
4883
|
responsetypeaxios: methodConfig.responseType,
|
|
4884
4884
|
}));
|
|
4885
4885
|
}
|
|
4886
4886
|
else {
|
|
4887
|
-
rest = Resource.create(ctx.uriOrigin, expressPath,
|
|
4887
|
+
rest = Resource.create(ctx.uriOrigin, expressPath, Symbols__NS__old.MAPPING_CONFIG_HEADER, Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY);
|
|
4888
4888
|
}
|
|
4889
4889
|
endpoints[ctx.uriOrigin][expressPath] = rest;
|
|
4890
4890
|
}
|
|
@@ -4917,23 +4917,23 @@ class EndpointContext {
|
|
|
4917
4917
|
}
|
|
4918
4918
|
if (currentParam.paramType === 'Query') {
|
|
4919
4919
|
if (currentParam.paramName) {
|
|
4920
|
-
const mapping =
|
|
4920
|
+
const mapping = Mapping__NS__decode(param, !ctx.isProductionMode);
|
|
4921
4921
|
if (mapping) {
|
|
4922
|
-
rest.headers.set(`${
|
|
4922
|
+
rest.headers.set(`${Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
4923
4923
|
}
|
|
4924
4924
|
queryParams[currentParam.paramName] = param;
|
|
4925
4925
|
}
|
|
4926
4926
|
else {
|
|
4927
|
-
const mapping =
|
|
4927
|
+
const mapping = Mapping__NS__decode(param, !ctx.isProductionMode);
|
|
4928
4928
|
if (mapping) {
|
|
4929
|
-
rest.headers.set(
|
|
4929
|
+
rest.headers.set(Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
|
|
4930
4930
|
}
|
|
4931
4931
|
queryParams = _.cloneDeep(param);
|
|
4932
4932
|
}
|
|
4933
4933
|
}
|
|
4934
4934
|
if (currentParam.paramType === 'Header') {
|
|
4935
4935
|
if (currentParam.paramName) {
|
|
4936
|
-
if (currentParam.paramName ===
|
|
4936
|
+
if (currentParam.paramName === Symbols__NS__old.MDC_KEY) {
|
|
4937
4937
|
// parese MDC
|
|
4938
4938
|
rest.headers.set(currentParam.paramName, encodeURIComponent(JSON.stringify(param)));
|
|
4939
4939
|
}
|
|
@@ -4952,7 +4952,7 @@ class EndpointContext {
|
|
|
4952
4952
|
}
|
|
4953
4953
|
if (currentParam.paramType === 'Body') {
|
|
4954
4954
|
if (currentParam.paramName) {
|
|
4955
|
-
if (
|
|
4955
|
+
if (ClassHelpers__NS__getName(bodyObject) === 'FormData') {
|
|
4956
4956
|
throw new Error(`[taon - framework] Don use param names when posting / putting FormData.
|
|
4957
4957
|
Use this:
|
|
4958
4958
|
// ...
|
|
@@ -4965,35 +4965,35 @@ instead
|
|
|
4965
4965
|
// ...
|
|
4966
4966
|
`);
|
|
4967
4967
|
}
|
|
4968
|
-
const mapping =
|
|
4968
|
+
const mapping = Mapping__NS__decode(param, !ctx.isProductionMode);
|
|
4969
4969
|
if (mapping) {
|
|
4970
|
-
rest.headers.set(`${
|
|
4970
|
+
rest.headers.set(`${Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
4971
4971
|
}
|
|
4972
4972
|
bodyObject[currentParam.paramName] = param;
|
|
4973
4973
|
}
|
|
4974
4974
|
else {
|
|
4975
|
-
const mapping =
|
|
4975
|
+
const mapping = Mapping__NS__decode(param, !ctx.isProductionMode);
|
|
4976
4976
|
if (mapping) {
|
|
4977
|
-
rest.headers.set(
|
|
4977
|
+
rest.headers.set(Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
|
|
4978
4978
|
}
|
|
4979
4979
|
bodyObject = param;
|
|
4980
4980
|
}
|
|
4981
4981
|
}
|
|
4982
4982
|
});
|
|
4983
4983
|
if (typeof bodyObject === 'object' &&
|
|
4984
|
-
|
|
4984
|
+
ClassHelpers__NS__getName(bodyObject) !== 'FormData') {
|
|
4985
4985
|
let circuralFromItem = [];
|
|
4986
4986
|
bodyObject = JSON10.parse(JSON10.stringify(bodyObject, void 0, void 0, circs => {
|
|
4987
4987
|
circuralFromItem = circs;
|
|
4988
4988
|
}));
|
|
4989
|
-
rest.headers.set(
|
|
4989
|
+
rest.headers.set(Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, JSON10.stringify(circuralFromItem));
|
|
4990
4990
|
}
|
|
4991
4991
|
if (typeof queryParams === 'object') {
|
|
4992
4992
|
let circuralFromQueryParams = [];
|
|
4993
4993
|
queryParams = JSON10.parse(JSON10.stringify(queryParams, void 0, void 0, circs => {
|
|
4994
4994
|
circuralFromQueryParams = circs;
|
|
4995
4995
|
}));
|
|
4996
|
-
rest.headers.set(
|
|
4996
|
+
rest.headers.set(Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, JSON10.stringify(circuralFromQueryParams));
|
|
4997
4997
|
}
|
|
4998
4998
|
//#endregion
|
|
4999
4999
|
const httpResultObj = {
|
|
@@ -5059,7 +5059,7 @@ class TaonAdminService {
|
|
|
5059
5059
|
|
|
5060
5060
|
class ContextsEndpointStorage {
|
|
5061
5061
|
constructor() {
|
|
5062
|
-
this.SPECIAL_APP_READY_MESSAGE =
|
|
5062
|
+
this.SPECIAL_APP_READY_MESSAGE = CoreModels__NS__SPECIAL_APP_READY_MESSAGE;
|
|
5063
5063
|
this.taonEndpointContexts = new Map();
|
|
5064
5064
|
// Private constructor to prevent direct instantiation
|
|
5065
5065
|
}
|
|
@@ -5168,9 +5168,9 @@ const createContextFn = (configFn, cloneOptions) => {
|
|
|
5168
5168
|
return classFun;
|
|
5169
5169
|
//#region old
|
|
5170
5170
|
// TODO hmmmm for now context for controller inside api service
|
|
5171
|
-
// const allContexts = Object.values(classFun[
|
|
5171
|
+
// const allContexts = Object.values(classFun[Symbols__NS__orignalClassClonesObj] || {}).map(classFn => {
|
|
5172
5172
|
// return {
|
|
5173
|
-
// ctx: classFn[
|
|
5173
|
+
// ctx: classFn[Symbols__NS__ctxInClassOrClassObj] as EndpointContext,
|
|
5174
5174
|
// classFn,
|
|
5175
5175
|
// }
|
|
5176
5176
|
// })
|
|
@@ -5190,7 +5190,7 @@ const createContextFn = (configFn, cloneOptions) => {
|
|
|
5190
5190
|
return await new Promise(async (resolve, reject) => {
|
|
5191
5191
|
//#region init in set timeout
|
|
5192
5192
|
setTimeout(async () => {
|
|
5193
|
-
if (
|
|
5193
|
+
if (UtilsOs__NS__isRunningInDocker()) {
|
|
5194
5194
|
const activeContext = config?.activeContext || null;
|
|
5195
5195
|
if (_.isString(activeContext) &&
|
|
5196
5196
|
activeContext !== '' &&
|
|
@@ -5227,7 +5227,7 @@ const createContextFn = (configFn, cloneOptions) => {
|
|
|
5227
5227
|
keepWebsqlDbDataAfterReload =
|
|
5228
5228
|
TaonAdminService.Instance?.keepWebsqlDbDataAfterReload;
|
|
5229
5229
|
if (keepWebsqlDbDataAfterReload) {
|
|
5230
|
-
!
|
|
5230
|
+
!UtilsOs__NS__isRunningInCliMode() &&
|
|
5231
5231
|
Helpers.info(`[taon] Keeping websql data after reload ` +
|
|
5232
5232
|
`(context=${endpointContextRef.contextName}).`);
|
|
5233
5233
|
}
|
|
@@ -5305,7 +5305,7 @@ const inject = (entity) => {
|
|
|
5305
5305
|
return () => false;
|
|
5306
5306
|
}
|
|
5307
5307
|
const ctor = entity();
|
|
5308
|
-
const contextFromClass = ctor[
|
|
5308
|
+
const contextFromClass = ctor[Symbols__NS__ctxInClassOrClassObj];
|
|
5309
5309
|
const resultContext = contextFromClass;
|
|
5310
5310
|
if (resultContext) {
|
|
5311
5311
|
let instance = resultContext.inject(ctor, {
|
|
@@ -5318,7 +5318,7 @@ const inject = (entity) => {
|
|
|
5318
5318
|
if (propName === 'getOriginalConstructor') {
|
|
5319
5319
|
return () => instance.constructor;
|
|
5320
5320
|
}
|
|
5321
|
-
const methods = ctor[
|
|
5321
|
+
const methods = ctor[Symbols__NS__classMethodsNames] || [];
|
|
5322
5322
|
const isMethods = methods.includes(propName);
|
|
5323
5323
|
const methodOrProperty = isMethods
|
|
5324
5324
|
? instance[propName].bind(instance)
|
|
@@ -5356,7 +5356,7 @@ const inject = (entity) => {
|
|
|
5356
5356
|
// const subscriberClassFN: typeof TaonBaseClass =
|
|
5357
5357
|
// subscriberClassResolveFn() as any;
|
|
5358
5358
|
// const ctx = subscriberClassFN[
|
|
5359
|
-
//
|
|
5359
|
+
// Symbols__NS__ctxInClassOrClassObj
|
|
5360
5360
|
// ] as EndpointContext;
|
|
5361
5361
|
// if (!ctx) {
|
|
5362
5362
|
// throw new Error(
|
|
@@ -5397,12 +5397,12 @@ const getTransformFunction = (target) => {
|
|
|
5397
5397
|
if (!target) {
|
|
5398
5398
|
return;
|
|
5399
5399
|
}
|
|
5400
|
-
// const className =
|
|
5400
|
+
// const className = ClassHelpers__NS__getName(target)
|
|
5401
5401
|
// target = ClassHelpers.getBy(className);
|
|
5402
5402
|
if (!target) {
|
|
5403
5403
|
return void 0;
|
|
5404
5404
|
}
|
|
5405
|
-
const configs =
|
|
5405
|
+
const configs = ClassHelpers__NS__getControllerConfigs(target);
|
|
5406
5406
|
// console.log(`CONFIGS TO CHECK`, configs)
|
|
5407
5407
|
const functions = configs
|
|
5408
5408
|
.map(c => {
|
|
@@ -5427,13 +5427,13 @@ const getTransformFunction = (target) => {
|
|
|
5427
5427
|
* @deprecated
|
|
5428
5428
|
*/
|
|
5429
5429
|
const singleTransform = (json) => {
|
|
5430
|
-
let ptarget =
|
|
5430
|
+
let ptarget = ClassHelpers__NS__getClassFnFromObject(json);
|
|
5431
5431
|
let pbrowserTransformFn = getTransformFunction(ptarget);
|
|
5432
5432
|
if (pbrowserTransformFn) {
|
|
5433
5433
|
const newValue = pbrowserTransformFn(json);
|
|
5434
5434
|
if (!_.isObject(newValue)) {
|
|
5435
5435
|
console.error(`Please return object in transform function for class: ` +
|
|
5436
|
-
`${
|
|
5436
|
+
`${ClassHelpers__NS__getName(json)}`);
|
|
5437
5437
|
}
|
|
5438
5438
|
else {
|
|
5439
5439
|
json = newValue;
|
|
@@ -5511,7 +5511,7 @@ class EntityProcess {
|
|
|
5511
5511
|
//#region set headers
|
|
5512
5512
|
setHeaders() {
|
|
5513
5513
|
const { include } = { include: [] };
|
|
5514
|
-
const className =
|
|
5514
|
+
const className = ClassHelpers__NS__getName(this.data);
|
|
5515
5515
|
const doNothing = _.isNil(this.data) ||
|
|
5516
5516
|
[
|
|
5517
5517
|
'Object',
|
|
@@ -5524,10 +5524,10 @@ class EntityProcess {
|
|
|
5524
5524
|
breadthWalk: true,
|
|
5525
5525
|
include,
|
|
5526
5526
|
});
|
|
5527
|
-
this.entityMapping =
|
|
5528
|
-
this.response.set(
|
|
5527
|
+
this.entityMapping = Mapping__NS__decode(cleaned, !this.advancedManipulation);
|
|
5528
|
+
this.response.set(Symbols__NS__old.MAPPING_CONFIG_HEADER, JSON.stringify(this.entityMapping));
|
|
5529
5529
|
if (this.advancedManipulation) {
|
|
5530
|
-
this.response.set(
|
|
5530
|
+
this.response.set(Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, JSON.stringify(this.circural));
|
|
5531
5531
|
}
|
|
5532
5532
|
}
|
|
5533
5533
|
}
|
|
@@ -5544,10 +5544,10 @@ class EntityProcess {
|
|
|
5544
5544
|
_.set(toSend, lodashPath, null);
|
|
5545
5545
|
}
|
|
5546
5546
|
else {
|
|
5547
|
-
const fun = getTransformFunction(
|
|
5547
|
+
const fun = getTransformFunction(ClassHelpers__NS__getClassFnFromObject(value));
|
|
5548
5548
|
if (_.isFunction(fun)) {
|
|
5549
5549
|
_.set(toSend, `${lodashPath}.${browserKey}`, value[browserKey]);
|
|
5550
|
-
const indexProp =
|
|
5550
|
+
const indexProp = ClassHelpers__NS__getUniqueKey(value);
|
|
5551
5551
|
_.set(toSend, `${lodashPath}.${indexProp}`, value[indexProp]);
|
|
5552
5552
|
// skipObject()
|
|
5553
5553
|
}
|
|
@@ -5557,7 +5557,7 @@ class EntityProcess {
|
|
|
5557
5557
|
}
|
|
5558
5558
|
}, { checkCircural: true, breadthWalk: true, include });
|
|
5559
5559
|
if (!_.isArray(this.data)) {
|
|
5560
|
-
let funParent = getTransformFunction(
|
|
5560
|
+
let funParent = getTransformFunction(ClassHelpers__NS__getClassFnFromObject(this.data));
|
|
5561
5561
|
// if (this.mdc && this.mdc.exclude && this.mdc.exclude.length > 0) {
|
|
5562
5562
|
// console.log(`funParent !!! have fun? ${!!funParent} `)
|
|
5563
5563
|
// }
|
|
@@ -5571,12 +5571,12 @@ class EntityProcess {
|
|
|
5571
5571
|
const v = this.data[prop];
|
|
5572
5572
|
if (!((include.length > 0 && !include.includes(prop)) ||
|
|
5573
5573
|
(exclude.length > 0 && exclude.includes(prop)))) {
|
|
5574
|
-
if (
|
|
5575
|
-
_.isFunction(getTransformFunction(
|
|
5574
|
+
if (ClassHelpers__NS__isContextClassObject(v) &&
|
|
5575
|
+
_.isFunction(getTransformFunction(ClassHelpers__NS__getClassFnFromObject(v)))) {
|
|
5576
5576
|
toSend[prop] = {
|
|
5577
5577
|
[browserKey]: v[browserKey],
|
|
5578
5578
|
};
|
|
5579
|
-
const indexProp =
|
|
5579
|
+
const indexProp = ClassHelpers__NS__getUniqueKey(v);
|
|
5580
5580
|
toSend[prop][indexProp] = this.data[prop][indexProp];
|
|
5581
5581
|
for (const key in v) {
|
|
5582
5582
|
if (_.isObject(v) &&
|
|
@@ -5645,7 +5645,7 @@ class TaonBaseClass {
|
|
|
5645
5645
|
console.log(overrideObjOrFn);
|
|
5646
5646
|
throw new Error('String is not supported as .clone() method argument');
|
|
5647
5647
|
}
|
|
5648
|
-
const classFn =
|
|
5648
|
+
const classFn = ClassHelpers__NS__getClassFnFromObject(this);
|
|
5649
5649
|
if (_.isFunction(overrideObjOrFn)) {
|
|
5650
5650
|
// console.log('clone with fn');
|
|
5651
5651
|
const oldValues = (_.cloneDeep(this) || {});
|
|
@@ -5764,12 +5764,12 @@ function TaonEntity(options) {
|
|
|
5764
5764
|
return function (constructor) {
|
|
5765
5765
|
options = options || {};
|
|
5766
5766
|
options.uniqueKeyProp = options.uniqueKeyProp || 'id';
|
|
5767
|
-
|
|
5768
|
-
|
|
5767
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
5768
|
+
Mapping__NS__DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
|
|
5769
5769
|
// TODO when entit metadata generator read use this
|
|
5770
|
-
|
|
5771
|
-
Reflect.defineMetadata(
|
|
5772
|
-
Reflect.defineMetadata(
|
|
5770
|
+
Mapping__NS__DefaultModelWithMapping(void 0, {})(constructor);
|
|
5771
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.entity, options, constructor);
|
|
5772
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
5773
5773
|
/* */
|
|
5774
5774
|
/* */
|
|
5775
5775
|
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
@@ -5794,9 +5794,9 @@ TAON_GLOBAL_STATE = __decorate([
|
|
|
5794
5794
|
*/
|
|
5795
5795
|
function TaonController(options) {
|
|
5796
5796
|
return function (constructor) {
|
|
5797
|
-
|
|
5798
|
-
Reflect.defineMetadata(
|
|
5799
|
-
const cfg =
|
|
5797
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
5798
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
5799
|
+
const cfg = ClassHelpers__NS__ensureClassConfig(constructor);
|
|
5800
5800
|
options = options || {};
|
|
5801
5801
|
cfg.className = options.className || constructor.name;
|
|
5802
5802
|
cfg.path = options.path || '';
|
|
@@ -5806,7 +5806,7 @@ function TaonController(options) {
|
|
|
5806
5806
|
}
|
|
5807
5807
|
|
|
5808
5808
|
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
5809
|
-
const methodConfig =
|
|
5809
|
+
const methodConfig = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
|
|
5810
5810
|
let options;
|
|
5811
5811
|
if (typeof pathOrOptions === 'object') {
|
|
5812
5812
|
options = pathOrOptions;
|
|
@@ -5857,7 +5857,7 @@ function GET(pathOrOptions, pathIsGlobal = false) {
|
|
|
5857
5857
|
* ...
|
|
5858
5858
|
* // in your taon controller
|
|
5859
5859
|
* ..Taon.Http.HTML()
|
|
5860
|
-
* sendHtmlDummyWebsite():
|
|
5860
|
+
* sendHtmlDummyWebsite(): Taon__NS__ResponseHtml {
|
|
5861
5861
|
* return `
|
|
5862
5862
|
<html>
|
|
5863
5863
|
<head>
|
|
@@ -5907,7 +5907,7 @@ function DELETE(pathOrOptions, pathIsGlobal = false) {
|
|
|
5907
5907
|
}
|
|
5908
5908
|
|
|
5909
5909
|
function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
|
|
5910
|
-
const methodCfg =
|
|
5910
|
+
const methodCfg = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
|
|
5911
5911
|
const nameKey = name ? name : param;
|
|
5912
5912
|
// const key = name || `${param}_${parameterIndex}`;
|
|
5913
5913
|
methodCfg.parameters[nameKey] = {
|
|
@@ -5953,9 +5953,9 @@ function Body(name) {
|
|
|
5953
5953
|
*/
|
|
5954
5954
|
function TaonMiddleware(options) {
|
|
5955
5955
|
return function (constructor) {
|
|
5956
|
-
Reflect.defineMetadata(
|
|
5957
|
-
Reflect.defineMetadata(
|
|
5958
|
-
|
|
5956
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.provider, options, constructor);
|
|
5957
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
5958
|
+
ClassHelpers__NS__setName(constructor, options?.className || constructor.name);
|
|
5959
5959
|
};
|
|
5960
5960
|
}
|
|
5961
5961
|
class TaonMiddlewareOptions extends DecoratorAbstractOpt {
|
|
@@ -5977,7 +5977,7 @@ class TaonBaseInjector {
|
|
|
5977
5977
|
* Current endpoint context
|
|
5978
5978
|
*/
|
|
5979
5979
|
get __endpoint_context__() {
|
|
5980
|
-
return this[
|
|
5980
|
+
return this[Symbols__NS__ctxInClassOrClassObj];
|
|
5981
5981
|
}
|
|
5982
5982
|
/**
|
|
5983
5983
|
* get current endpoint context
|
|
@@ -6006,7 +6006,7 @@ class TaonBaseInjector {
|
|
|
6006
6006
|
localInstance: true,
|
|
6007
6007
|
locaInstanceConstructorArgs: [
|
|
6008
6008
|
() => {
|
|
6009
|
-
const classToProcess = this.ctx.allClassesInstances[
|
|
6009
|
+
const classToProcess = this.ctx.allClassesInstances[ClassHelpers__NS__getName(cutomRepositoryClass)];
|
|
6010
6010
|
return classToProcess.entityClassResolveFn();
|
|
6011
6011
|
},
|
|
6012
6012
|
],
|
|
@@ -6081,7 +6081,7 @@ class TaonBaseInjector {
|
|
|
6081
6081
|
const contextClassInstance = this;
|
|
6082
6082
|
return new Proxy({}, {
|
|
6083
6083
|
get: (__, propName) => {
|
|
6084
|
-
const contextFromClass = ctor && ctor[
|
|
6084
|
+
const contextFromClass = ctor && ctor[Symbols__NS__ctxInClassOrClassObj];
|
|
6085
6085
|
const resultContext = contextFromClass
|
|
6086
6086
|
? contextFromClass
|
|
6087
6087
|
: this.__endpoint_context__;
|
|
@@ -6096,17 +6096,17 @@ class TaonBaseInjector {
|
|
|
6096
6096
|
parentInstanceThatWillGetInjectedStuff: this,
|
|
6097
6097
|
});
|
|
6098
6098
|
if (!instance) {
|
|
6099
|
-
throw new Error(`Not able to inject "${
|
|
6100
|
-
`property "${propName?.toString()}" on class "${
|
|
6099
|
+
throw new Error(`Not able to inject "${ClassHelpers__NS__getName(ctor) || ctor.name}" inside ` +
|
|
6100
|
+
`property "${propName?.toString()}" on class "${ClassHelpers__NS__getName(this)}".
|
|
6101
6101
|
|
|
6102
|
-
Please add "${
|
|
6102
|
+
Please add "${ClassHelpers__NS__getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories or middlewares)
|
|
6103
6103
|
|
|
6104
6104
|
`);
|
|
6105
6105
|
}
|
|
6106
6106
|
const result = typeof instance[propName] === 'function'
|
|
6107
6107
|
? instance[propName].bind(instance)
|
|
6108
6108
|
: instance[propName];
|
|
6109
|
-
// console.log(`Accessing injected "${propName?.toString()}" from "${
|
|
6109
|
+
// console.log(`Accessing injected "${propName?.toString()}" from "${ClassHelpers__NS__getName(ctor) || ctor.name}"`,result)
|
|
6110
6110
|
return result;
|
|
6111
6111
|
}
|
|
6112
6112
|
//#region @browser
|
|
@@ -6114,7 +6114,7 @@ class TaonBaseInjector {
|
|
|
6114
6114
|
//#endregion
|
|
6115
6115
|
},
|
|
6116
6116
|
set: (__, propName, value) => {
|
|
6117
|
-
const contextFromClass = ctor && ctor[
|
|
6117
|
+
const contextFromClass = ctor && ctor[Symbols__NS__ctxInClassOrClassObj];
|
|
6118
6118
|
const resultContext = contextFromClass
|
|
6119
6119
|
? contextFromClass
|
|
6120
6120
|
: this.__endpoint_context__;
|
|
@@ -6129,11 +6129,11 @@ class TaonBaseInjector {
|
|
|
6129
6129
|
parentInstanceThatWillGetInjectedStuff: this,
|
|
6130
6130
|
});
|
|
6131
6131
|
if (!instance) {
|
|
6132
|
-
const classNameNotResolved =
|
|
6132
|
+
const classNameNotResolved = ClassHelpers__NS__getName(ctor) || ctor.name;
|
|
6133
6133
|
throw new Error(`Not able to inject "${classNameNotResolved}" inside ` +
|
|
6134
|
-
`property "${propName?.toString()}" on class "${
|
|
6134
|
+
`property "${propName?.toString()}" on class "${ClassHelpers__NS__getName(this)}".
|
|
6135
6135
|
|
|
6136
|
-
Please add "${
|
|
6136
|
+
Please add "${ClassHelpers__NS__getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories or middlewares)
|
|
6137
6137
|
|
|
6138
6138
|
`);
|
|
6139
6139
|
}
|
|
@@ -6312,7 +6312,7 @@ let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
|
|
|
6312
6312
|
let i = 0;
|
|
6313
6313
|
let httpErrorsCount = 0;
|
|
6314
6314
|
while (true) {
|
|
6315
|
-
await
|
|
6315
|
+
await UtilsTerminal__NS__waitMilliseconds(poolingInterval);
|
|
6316
6316
|
try {
|
|
6317
6317
|
const resp = await taonRequest({
|
|
6318
6318
|
reqIndexNum: i,
|
|
@@ -6326,7 +6326,7 @@ let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
|
|
|
6326
6326
|
httpErrorsCount++;
|
|
6327
6327
|
if (options.loopRequestsOnBackendError) {
|
|
6328
6328
|
const isProperTaonError = error instanceof HttpResponseError &&
|
|
6329
|
-
error.body.json[
|
|
6329
|
+
error.body.json[CoreModels__NS__TaonHttpErrorCustomProp];
|
|
6330
6330
|
const isHttpError = error instanceof HttpResponseError && !isProperTaonError;
|
|
6331
6331
|
const isUnknownError = !(error instanceof HttpResponseError);
|
|
6332
6332
|
const resBool = await options.loopRequestsOnBackendError({
|
|
@@ -6384,23 +6384,23 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
6384
6384
|
//#region init
|
|
6385
6385
|
async _() {
|
|
6386
6386
|
if (!_.isFunction(this.entityClassResolveFn)) {
|
|
6387
|
-
Helpers.warn(`Skipping initing CRUD controller ${
|
|
6387
|
+
Helpers.warn(`Skipping initing CRUD controller ${ClassHelpers__NS__getName(this)} because entityClassResolveFn is not provided.`);
|
|
6388
6388
|
return;
|
|
6389
6389
|
}
|
|
6390
6390
|
let entityClassFn = this.entityClassResolveFn();
|
|
6391
6391
|
this.db = this.injectRepo(entityClassFn);
|
|
6392
6392
|
if (entityClassFn) {
|
|
6393
|
-
const configEntity = Reflect.getMetadata(
|
|
6393
|
+
const configEntity = Reflect.getMetadata(Symbols__NS__metadata.options.entity, ClassHelpers__NS__getClassFnFromObject(this));
|
|
6394
6394
|
if (configEntity?.createTable === false) {
|
|
6395
|
-
Helpers.warn(`Table for entity ${
|
|
6395
|
+
Helpers.warn(`Table for entity ${ClassHelpers__NS__getName(entityClassFn)} will not be created. Crud will not work properly.`);
|
|
6396
6396
|
}
|
|
6397
6397
|
}
|
|
6398
6398
|
else {
|
|
6399
|
-
Helpers.error(`Entity class not provided for controller ${
|
|
6399
|
+
Helpers.error(`Entity class not provided for controller ${ClassHelpers__NS__getName(this)}.
|
|
6400
6400
|
|
|
6401
6401
|
Please provide entity as class property entityClassFn:
|
|
6402
6402
|
|
|
6403
|
-
class ${
|
|
6403
|
+
class ${ClassHelpers__NS__getName(this)} extends TaonBaseCrudController<Entity> {
|
|
6404
6404
|
// ...
|
|
6405
6405
|
entityClassResolveFn = ()=> MyEntityClass;
|
|
6406
6406
|
// ...
|
|
@@ -6679,9 +6679,9 @@ TaonBaseCrudController = __decorate([
|
|
|
6679
6679
|
*/
|
|
6680
6680
|
function TaonRepository(options) {
|
|
6681
6681
|
return function (constructor) {
|
|
6682
|
-
Reflect.defineMetadata(
|
|
6683
|
-
Reflect.defineMetadata(
|
|
6684
|
-
|
|
6682
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.repository, options, constructor);
|
|
6683
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
6684
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
6685
6685
|
};
|
|
6686
6686
|
}
|
|
6687
6687
|
class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
@@ -7431,9 +7431,9 @@ class TaonBaseProvider extends TaonBaseInjector {
|
|
|
7431
7431
|
*/
|
|
7432
7432
|
function TaonProvider(options) {
|
|
7433
7433
|
return function (constructor) {
|
|
7434
|
-
Reflect.defineMetadata(
|
|
7435
|
-
Reflect.defineMetadata(
|
|
7436
|
-
|
|
7434
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.provider, options, constructor);
|
|
7435
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
7436
|
+
ClassHelpers__NS__setName(constructor, options?.className || constructor.name);
|
|
7437
7437
|
};
|
|
7438
7438
|
}
|
|
7439
7439
|
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
@@ -7464,9 +7464,9 @@ TaonGlobalStateMiddleware = __decorate([
|
|
|
7464
7464
|
*/
|
|
7465
7465
|
function TaonSubscriber(options) {
|
|
7466
7466
|
return function (constructor) {
|
|
7467
|
-
Reflect.defineMetadata(
|
|
7468
|
-
Reflect.defineMetadata(
|
|
7469
|
-
|
|
7467
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.subscriber, options, constructor);
|
|
7468
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
7469
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
7470
7470
|
};
|
|
7471
7471
|
}
|
|
7472
7472
|
class TaonSubscriberOptions extends DecoratorAbstractOpt {
|
|
@@ -7674,13 +7674,13 @@ class TaonBaseMigration extends TaonBaseInjector {
|
|
|
7674
7674
|
return true;
|
|
7675
7675
|
}
|
|
7676
7676
|
getDescription() {
|
|
7677
|
-
return _.startCase(
|
|
7677
|
+
return _.startCase(ClassHelpers__NS__getName(this));
|
|
7678
7678
|
}
|
|
7679
7679
|
async up(queryRunner) {
|
|
7680
|
-
console.log(`[TaonBaseMigration] Running migration UP "${
|
|
7680
|
+
console.log(`[TaonBaseMigration] Running migration UP "${ClassHelpers__NS__getName(this)}"`);
|
|
7681
7681
|
}
|
|
7682
7682
|
async down(queryRunner) {
|
|
7683
|
-
console.log(`[TaonBaseMigration] Running migration DOWN "${
|
|
7683
|
+
console.log(`[TaonBaseMigration] Running migration DOWN "${ClassHelpers__NS__getName(this)}"`);
|
|
7684
7684
|
}
|
|
7685
7685
|
}
|
|
7686
7686
|
|
|
@@ -7839,7 +7839,7 @@ function typeFromEntity(component, entity) {
|
|
|
7839
7839
|
if (isArray) {
|
|
7840
7840
|
entity = _.first(entity);
|
|
7841
7841
|
}
|
|
7842
|
-
let name =
|
|
7842
|
+
let name = ClassHelpers__NS__getName(component);
|
|
7843
7843
|
let res = { name, component, entity, isArray };
|
|
7844
7844
|
// console.log(res);
|
|
7845
7845
|
return res;
|
|
@@ -7861,7 +7861,7 @@ function RegisterComponentType(className, ...optionslNames) {
|
|
|
7861
7861
|
RegisterComponentType.prototype.types = [];
|
|
7862
7862
|
}
|
|
7863
7863
|
return function (target, propertyKey, descriptor) {
|
|
7864
|
-
|
|
7864
|
+
ClassHelpers__NS__setName(target, className);
|
|
7865
7865
|
RegisterComponentType.prototype.types.push(typeFromEntity(target));
|
|
7866
7866
|
optionslNames.forEach(name => {
|
|
7867
7867
|
RegisterComponentType.prototype.types.push(typeFromName(target, name));
|
|
@@ -7883,7 +7883,7 @@ function getFromlyConfigFor(target, options = {}) {
|
|
|
7883
7883
|
if (level === maxLevel) {
|
|
7884
7884
|
return [];
|
|
7885
7885
|
}
|
|
7886
|
-
const mapping =
|
|
7886
|
+
const mapping = Mapping__NS__getModelsMapping(target);
|
|
7887
7887
|
// console.log('mapping', mapping)
|
|
7888
7888
|
const fieldNames = CLASS.describeProperites(target);
|
|
7889
7889
|
const checkExclude = _.isArray(keysPathesToExclude) && keysPathesToExclude.length > 0;
|
|
@@ -8147,9 +8147,9 @@ const DateTimeColumn = (defaultValue = null) => Column({ type: 'datetime', nulla
|
|
|
8147
8147
|
*/
|
|
8148
8148
|
function TaonMigration(options) {
|
|
8149
8149
|
return function (constructor) {
|
|
8150
|
-
Reflect.defineMetadata(
|
|
8151
|
-
Reflect.defineMetadata(
|
|
8152
|
-
|
|
8150
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.migration, options, constructor);
|
|
8151
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
8152
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
8153
8153
|
};
|
|
8154
8154
|
}
|
|
8155
8155
|
class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
@@ -8160,7 +8160,7 @@ class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
|
8160
8160
|
/**
|
|
8161
8161
|
* Remove global taon loader from env.ts [loading.preAngularBootstrap]
|
|
8162
8162
|
*/
|
|
8163
|
-
const
|
|
8163
|
+
const Taon__NS__removeLoader = (afterMS = 0) => {
|
|
8164
8164
|
return new Promise(resolve => {
|
|
8165
8165
|
setTimeout(() => {
|
|
8166
8166
|
globalThis?.window?.document
|
|
@@ -8174,7 +8174,7 @@ const Taon_removeLoader = (afterMS = 0) => {
|
|
|
8174
8174
|
}, afterMS);
|
|
8175
8175
|
});
|
|
8176
8176
|
};
|
|
8177
|
-
const
|
|
8177
|
+
const Taon__NS__error = (opt) => {
|
|
8178
8178
|
throw () => {
|
|
8179
8179
|
if (typeof opt === 'string') {
|
|
8180
8180
|
opt = {
|
|
@@ -8184,7 +8184,7 @@ const Taon_error = (opt) => {
|
|
|
8184
8184
|
return opt;
|
|
8185
8185
|
};
|
|
8186
8186
|
};
|
|
8187
|
-
const
|
|
8187
|
+
const Taon__NS__getResponseValue = getResponseValue;
|
|
8188
8188
|
//#region class decorators
|
|
8189
8189
|
// TODO new 5.8 typescript is not allowing this
|
|
8190
8190
|
// export import Controller = controllerDecorator.TaonController;
|
|
@@ -8196,22 +8196,22 @@ const Taon_getResponseValue = getResponseValue;
|
|
|
8196
8196
|
// export import Middleware = middlewareDecorator.TaonMiddleware;
|
|
8197
8197
|
//#endregion
|
|
8198
8198
|
//#region aliases to helpers
|
|
8199
|
-
const
|
|
8200
|
-
const
|
|
8201
|
-
const
|
|
8202
|
-
const
|
|
8199
|
+
const Taon__NS__isBrowser = coreHelpers.Helpers.isBrowser;
|
|
8200
|
+
const Taon__NS__isNode = coreHelpers.Helpers.isNode;
|
|
8201
|
+
const Taon__NS__isWebSQL = coreHelpers.Helpers.isWebSQL;
|
|
8202
|
+
const Taon__NS__isElectron = coreHelpers.Helpers.isElectron;
|
|
8203
8203
|
//#endregion
|
|
8204
|
-
const
|
|
8205
|
-
const
|
|
8206
|
-
const
|
|
8204
|
+
const Taon__NS__createContext = createContext;
|
|
8205
|
+
const Taon__NS__createContextTemplate = createContextTemplate;
|
|
8206
|
+
const Taon__NS__inject = inject;
|
|
8207
8207
|
/**
|
|
8208
8208
|
* @deprecated
|
|
8209
8209
|
* use createContext instead
|
|
8210
8210
|
*/
|
|
8211
|
-
const
|
|
8211
|
+
const Taon__NS__init = async (options) => {
|
|
8212
8212
|
const TaonBaseContext = (await Promise.resolve().then(function () { return baseContext; }))
|
|
8213
8213
|
.TaonBaseContext;
|
|
8214
|
-
const context =
|
|
8214
|
+
const context = Taon__NS__createContext(() => ({
|
|
8215
8215
|
appId: 'default-app-not-used-anymore',
|
|
8216
8216
|
contextName: 'default',
|
|
8217
8217
|
host: options.host,
|
|
@@ -8345,5 +8345,5 @@ const TAON_FLATTEN_MAPPING = {
|
|
|
8345
8345
|
* Generated bundle index. Do not edit.
|
|
8346
8346
|
*/
|
|
8347
8347
|
|
|
8348
|
-
export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL,
|
|
8348
|
+
export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers__NS__asyncHandler, ClassHelpers__NS__ensureClassConfig, ClassHelpers__NS__ensureMethodConfig, ClassHelpers__NS__getClassConfig, ClassHelpers__NS__getClassFnFromObject, ClassHelpers__NS__getControllerConfigs, ClassHelpers__NS__getFullInternalName, ClassHelpers__NS__getMethodsNames, ClassHelpers__NS__getName, ClassHelpers__NS__getOrginalClass, ClassHelpers__NS__getUniqueKey, ClassHelpers__NS__hasParentClassWithName, ClassHelpers__NS__isContextClassObject, ClassHelpers__NS__setName, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTimeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models__NS__ClassType, Models__NS__ClassTypeKey, Models__NS__DatabaseConfig, Models__NS__DatabaseConfigTypeOrm, Models__NS__DatabasesFolder, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String20Column, String45Column, String500Column, StringColumn, Symbols__NS__REALTIME, Symbols__NS__classMethodsNames, Symbols__NS__classNameStaticProperty, Symbols__NS__ctxInClassOrClassObj, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__old, Symbols__NS__orignalClass, Symbols__NS__orignalClassClonesObj, TAON_CONTEXT, TAON_FLATTEN_MAPPING, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers__NS__defaultType, TaonHelpers__NS__fillUpTo, TaonHelpers__NS__firstStringOrElemFromArray, TaonHelpers__NS__getExpressPath, TaonHelpers__NS__ipcKeyNameRequest, TaonHelpers__NS__ipcKeyNameResponse, TaonHelpers__NS__isGoodPath, TaonHelpers__NS__isPlainFileOrFolder, TaonHelpers__NS__parseJSONwithStringJSONs, TaonHelpers__NS__tryTransformParam, TaonHelpers__NS__websqlMocks, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Taon__NS__createContext, Taon__NS__createContextTemplate, Taon__NS__error, Taon__NS__getResponseValue, Taon__NS__init, Taon__NS__inject, Taon__NS__isBrowser, Taon__NS__isElectron, Taon__NS__isNode, Taon__NS__isWebSQL, Taon__NS__removeLoader, Validators__NS__checkIfMethodsWithReponseTYpeAlowed, Validators__NS__classNameVlidation, Validators__NS__preventUndefinedModel, Validators__NS__validateClassFunctions, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
|
|
8349
8349
|
//# sourceMappingURL=taon-browser.mjs.map
|