taon 21.0.53 → 21.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/bin/taon +5 -5
  2. package/bin/taon-debug +5 -5
  3. package/bin/taon-debug-brk +4 -4
  4. package/browser/package.json +1 -1
  5. package/browser-prod/package.json +1 -1
  6. package/icon-menu-taon.svg +15 -15
  7. package/lib/build-info._auto-generated_.d.ts +1 -1
  8. package/lib/build-info._auto-generated_.js +1 -1
  9. package/lib/package.json +1 -1
  10. package/lib/ui/index.js +2 -2
  11. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  12. package/lib-prod/base-classes/base-abstract-entity.js +17 -31
  13. package/lib-prod/base-classes/base-angular-service.js +83 -55
  14. package/lib-prod/base-classes/base-class.js +33 -35
  15. package/lib-prod/base-classes/base-context.js +17 -19
  16. package/lib-prod/base-classes/base-controller.js +146 -154
  17. package/lib-prod/base-classes/base-crud-controller.js +250 -221
  18. package/lib-prod/base-classes/base-custom-repository.js +7 -18
  19. package/lib-prod/base-classes/base-electron-service.js +49 -0
  20. package/lib-prod/base-classes/base-entity.js +20 -30
  21. package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
  22. package/lib-prod/base-classes/base-injector.js +176 -194
  23. package/lib-prod/base-classes/base-middleware.js +8 -5
  24. package/lib-prod/base-classes/base-migration.js +19 -22
  25. package/lib-prod/base-classes/base-provider.js +7 -5
  26. package/lib-prod/base-classes/base-repository.js +601 -573
  27. package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
  28. package/lib-prod/base-classes/base.js +18 -0
  29. package/lib-prod/build-info._auto-generated_.js +26 -14
  30. package/lib-prod/config/controller-config.js +24 -24
  31. package/lib-prod/config/controller-options.js +2 -5
  32. package/lib-prod/config/method-config.js +6 -8
  33. package/lib-prod/config/param-config.js +2 -8
  34. package/lib-prod/constants.js +29 -25
  35. package/lib-prod/context-db-migrations.js +328 -324
  36. package/lib-prod/create-context.js +211 -146
  37. package/lib-prod/decorators/classes/controller-decorator.js +16 -20
  38. package/lib-prod/decorators/classes/entity-decorator.js +26 -47
  39. package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
  40. package/lib-prod/decorators/classes/migration-decorator.js +13 -22
  41. package/lib-prod/decorators/classes/provider-decorator.js +13 -23
  42. package/lib-prod/decorators/classes/repository-decorator.js +13 -22
  43. package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
  44. package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
  45. package/lib-prod/decorators/http/http-decorators.js +20 -5
  46. package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
  47. package/lib-prod/decorators/http/http-params-decorators.js +36 -62
  48. package/lib-prod/dependency-injection/di-container.js +28 -29
  49. package/lib-prod/endpoint-context-storage.js +27 -32
  50. package/lib-prod/endpoint-context.js +2294 -1930
  51. package/lib-prod/entity-process.js +209 -198
  52. package/lib-prod/env/env.angular-node-app.js +66 -130
  53. package/lib-prod/env/env.docs-webapp.js +66 -130
  54. package/lib-prod/env/env.electron-app.js +66 -130
  55. package/lib-prod/env/env.mobile-app.js +66 -130
  56. package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
  57. package/lib-prod/env/env.vscode-plugin.js +66 -130
  58. package/lib-prod/env/index.js +6 -6
  59. package/lib-prod/express-types.js +1 -0
  60. package/lib-prod/formly/formly.models.js +1 -0
  61. package/lib-prod/formly/fromly.js +196 -175
  62. package/lib-prod/formly/type-from-entity.js +45 -52
  63. package/lib-prod/get-response-value.js +21 -18
  64. package/lib-prod/global-state/taon-global-state/index.js +6 -5
  65. package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
  66. package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
  67. package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
  68. package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
  69. package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
  70. package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
  71. package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
  72. package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
  73. package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
  74. package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
  75. package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
  76. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
  77. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
  78. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
  79. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
  80. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
  81. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
  82. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
  83. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
  84. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
  85. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
  86. package/lib-prod/helpers/class-helpers.js +210 -177
  87. package/lib-prod/helpers/clone-obj.js +16 -20
  88. package/lib-prod/helpers/taon-helpers.js +132 -114
  89. package/lib-prod/index._auto-generated_.js +5 -0
  90. package/lib-prod/index.js +248 -227
  91. package/lib-prod/inject.js +88 -33
  92. package/lib-prod/migrations/index.js +2 -1
  93. package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
  94. package/lib-prod/models.js +72 -103
  95. package/lib-prod/orm/columns.js +58 -118
  96. package/lib-prod/orm/index.js +56 -1
  97. package/lib-prod/package.json +1 -1
  98. package/lib-prod/realtime/realtime-client.js +188 -186
  99. package/lib-prod/realtime/realtime-core.js +77 -78
  100. package/lib-prod/realtime/realtime-server.js +225 -240
  101. package/lib-prod/realtime/realtime-strategy/index.js +4 -4
  102. package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
  103. package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
  104. package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
  105. package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
  106. package/lib-prod/realtime/realtime-subs-manager.js +82 -90
  107. package/lib-prod/realtime/realtime.models.js +2 -0
  108. package/lib-prod/symbols.js +104 -105
  109. package/lib-prod/ui/index.js +1 -5
  110. package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
  111. package/lib-prod/validators.js +43 -37
  112. package/lib-prod.split-namespaces.json +32 -86
  113. package/package.json +1 -1
  114. package/websql/package.json +1 -1
  115. package/websql-prod/package.json +1 -1
@@ -1,25 +1,15 @@
1
- import { ClassHelpers__NS__setName } from "../../helpers/class-helpers";
2
- import { Symbols__NS__metadata } from "../../symbols";
3
- import { DecoratorAbstractOpt } from "../decorator-abstract-opt";
4
- function TaonSubscriber(options) {
5
- return function(constructor) {
6
- Reflect.defineMetadata(
7
- Symbols__NS__metadata.options.subscriber,
8
- options,
9
- constructor
10
- );
11
- Reflect.defineMetadata(
12
- Symbols__NS__metadata.className,
13
- options?.className || constructor.name,
14
- constructor
15
- );
16
- ClassHelpers__NS__setName(constructor, options?.className);
17
- };
1
+ import { ClassHelpers__NS__setName } from '../../helpers/class-helpers';
2
+ import { Symbols__NS__metadata } from '../../symbols';
3
+ import { DecoratorAbstractOpt } from '../decorator-abstract-opt';
4
+ /**
5
+ * Subscriber decorator
6
+ */
7
+ export function TaonSubscriber(options) {
8
+ return function (constructor) {
9
+ Reflect.defineMetadata(Symbols__NS__metadata.options.subscriber, options, constructor);
10
+ Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
11
+ ClassHelpers__NS__setName(constructor, options?.className);
12
+ };
18
13
  }
19
- class TaonSubscriberOptions extends DecoratorAbstractOpt {
20
- allowedEvents;
14
+ export class TaonSubscriberOptions extends DecoratorAbstractOpt {
21
15
  }
22
- export {
23
- TaonSubscriber,
24
- TaonSubscriberOptions
25
- };
@@ -1,5 +1,2 @@
1
- class DecoratorAbstractOpt {
1
+ export class DecoratorAbstractOpt {
2
2
  }
3
- export {
4
- DecoratorAbstractOpt
5
- };
@@ -1,5 +1,20 @@
1
- import { Models__NS__HttpResponse } from "ng2-rest/lib-prod";
2
- const HttpResponse = Models__NS__HttpResponse;
3
- export {
4
- HttpResponse
5
- };
1
+ import { Models__NS__HttpResponse } from 'ng2-rest/lib-prod';
2
+ export const HttpResponse = Models__NS__HttpResponse;
3
+ // TODO new 5.8 typescript is not allowing this
4
+ // export namespace Http {
5
+ // export import GET = methods.GET;
6
+ // export import POST = methods.POST;
7
+ // export import PUT = methods.PUT;
8
+ // export import DELETE = methods.DELETE;
9
+ // export import PATCH = methods.PATCH;
10
+ // export import HEAD = methods.HEAD;
11
+ // export import HTML = methods.HTML;
12
+ // export import Response = Models__NS__HttpResponse;
13
+ // export namespace Param {
14
+ // export import Query = params.Query;
15
+ // export import Path = params.Path;
16
+ // export import Body = params.Body;
17
+ // export import Cookie = params.Cookie;
18
+ // export import Header = params.Header;
19
+ // }
20
+ // }
@@ -1,144 +1,102 @@
1
- import { ___NS__isString } from "tnp-core/lib-prod";
2
- import { ClassHelpers__NS__ensureMethodConfig } from "../../helpers/class-helpers";
1
+ import { ___NS__isString } from 'tnp-core/lib-prod';
2
+ import { ClassHelpers__NS__ensureMethodConfig } from '../../helpers/class-helpers';
3
3
  const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
4
- const methodConfig = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
5
- let options;
6
- if (typeof pathOrOptions === "object") {
7
- options = pathOrOptions;
8
- pathOrOptions = options.path;
9
- pathIsGlobal = !!options.pathIsGlobal;
10
- path = options.path;
11
- } else {
12
- options = { pathOrOptions, pathIsGlobal };
13
- }
14
- const {
15
- overrideContentType,
16
- overrideResponseType,
17
- overrideExpressSendAsHtml,
18
- middlewares
19
- } = options;
20
- methodConfig.methodName = propertyKey;
21
- methodConfig.middlewares = middlewares;
22
- methodConfig.type = method;
23
- if (!path) {
24
- let paramsPathConcatedPath = "";
25
- for (const key in methodConfig.parameters) {
26
- if (methodConfig.parameters.hasOwnProperty(key)) {
27
- const element = methodConfig.parameters[key];
28
- if (element.paramType === "Path" && ___NS__isString(element.paramName) && element.paramName.trim().length > 0) {
29
- paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
4
+ const methodConfig = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
5
+ let options;
6
+ if (typeof pathOrOptions === 'object') {
7
+ options = pathOrOptions;
8
+ pathOrOptions = options.path;
9
+ pathIsGlobal = !!options.pathIsGlobal;
10
+ path = options.path;
11
+ }
12
+ else {
13
+ options = { pathOrOptions, pathIsGlobal };
14
+ }
15
+ const { overrideContentType, overrideResponseType, overrideExpressSendAsHtml, middlewares, } = options;
16
+ methodConfig.methodName = propertyKey;
17
+ methodConfig.middlewares = middlewares;
18
+ methodConfig.type = method;
19
+ if (!path) {
20
+ let paramsPathConcatedPath = '';
21
+ for (const key in methodConfig.parameters) {
22
+ if (methodConfig.parameters.hasOwnProperty(key)) {
23
+ const element = methodConfig.parameters[key];
24
+ if (element.paramType === 'Path' &&
25
+ ___NS__isString(element.paramName) &&
26
+ element.paramName.trim().length > 0) {
27
+ paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
28
+ }
29
+ }
30
30
  }
31
- }
31
+ methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
32
32
  }
33
- methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
34
- } else {
35
- methodConfig.path = path;
36
- }
37
- methodConfig.descriptor = descriptor;
38
- methodConfig.global = pathIsGlobal;
39
- methodConfig.contentType = overrideContentType;
40
- methodConfig.responseType = overrideResponseType;
41
- methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
33
+ else {
34
+ methodConfig.path = path;
35
+ }
36
+ methodConfig.descriptor = descriptor;
37
+ methodConfig.global = pathIsGlobal;
38
+ methodConfig.contentType = overrideContentType;
39
+ methodConfig.responseType = overrideResponseType;
40
+ methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
42
41
  };
43
- function GET(pathOrOptions, pathIsGlobal = false) {
44
- return function(target, propertyKey, descriptor) {
45
- metaReq(
46
- "get",
47
- pathOrOptions,
48
- target,
49
- propertyKey,
50
- descriptor,
51
- pathOrOptions,
52
- pathIsGlobal
53
- );
54
- };
42
+ export function GET(pathOrOptions, pathIsGlobal = false) {
43
+ return function (target, propertyKey, descriptor) {
44
+ metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
45
+ };
55
46
  }
56
- function HTML(pathOrOptions) {
57
- return function(target, propertyKey, descriptor) {
58
- const opt = pathOrOptions;
59
- opt.overrideExpressSendAsHtml = true;
60
- metaReq(
61
- "get",
62
- opt,
63
- target,
64
- propertyKey,
65
- descriptor,
66
- pathOrOptions,
67
- opt.pathIsGlobal
68
- );
69
- };
47
+ /**
48
+ * Method for sending html website from text
49
+ * Example
50
+ *
51
+ * ```ts
52
+ * ...
53
+ * // in your taon controller
54
+ * ..Taon.Http.HTML()
55
+ * sendHtmlDummyWebsite(): Taon.ResponseHtml {
56
+ * return `
57
+ <html>
58
+ <head>
59
+ <title>Dummy website</title>
60
+ </head>
61
+ <body>
62
+ <h1>This is dummy website</h1>
63
+ <p>Served as HTML string from Taon controller method</p>
64
+ </body>
65
+ </html>
66
+ * `; *
67
+ * }
68
+ * ...
69
+ * ```
70
+ */
71
+ export function HTML(pathOrOptions) {
72
+ return function (target, propertyKey, descriptor) {
73
+ const opt = pathOrOptions;
74
+ opt.overrideExpressSendAsHtml = true;
75
+ metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
76
+ };
70
77
  }
71
- function HEAD(pathOrOptions, pathIsGlobal = false) {
72
- return function(target, propertyKey, descriptor) {
73
- metaReq(
74
- "head",
75
- pathOrOptions,
76
- target,
77
- propertyKey,
78
- descriptor,
79
- pathOrOptions,
80
- pathIsGlobal
81
- );
82
- };
78
+ export function HEAD(pathOrOptions, pathIsGlobal = false) {
79
+ return function (target, propertyKey, descriptor) {
80
+ metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
81
+ };
83
82
  }
84
- function POST(pathOrOptions, pathIsGlobal = false) {
85
- return function(target, propertyKey, descriptor) {
86
- metaReq(
87
- "post",
88
- pathOrOptions,
89
- target,
90
- propertyKey,
91
- descriptor,
92
- pathOrOptions,
93
- pathIsGlobal
94
- );
95
- };
83
+ export function POST(pathOrOptions, pathIsGlobal = false) {
84
+ return function (target, propertyKey, descriptor) {
85
+ metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
86
+ };
96
87
  }
97
- function PUT(pathOrOptions, pathIsGlobal = false) {
98
- return function(target, propertyKey, descriptor) {
99
- metaReq(
100
- "put",
101
- pathOrOptions,
102
- target,
103
- propertyKey,
104
- descriptor,
105
- pathOrOptions,
106
- pathIsGlobal
107
- );
108
- };
88
+ export function PUT(pathOrOptions, pathIsGlobal = false) {
89
+ return function (target, propertyKey, descriptor) {
90
+ metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
91
+ };
109
92
  }
110
- function PATCH(pathOrOptions, pathIsGlobal = false) {
111
- return function(target, propertyKey, descriptor) {
112
- metaReq(
113
- "patch",
114
- pathOrOptions,
115
- target,
116
- propertyKey,
117
- descriptor,
118
- pathOrOptions,
119
- pathIsGlobal
120
- );
121
- };
93
+ export function PATCH(pathOrOptions, pathIsGlobal = false) {
94
+ return function (target, propertyKey, descriptor) {
95
+ metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
96
+ };
122
97
  }
123
- function DELETE(pathOrOptions, pathIsGlobal = false) {
124
- return function(target, propertyKey, descriptor) {
125
- metaReq(
126
- "delete",
127
- pathOrOptions,
128
- target,
129
- propertyKey,
130
- descriptor,
131
- pathOrOptions,
132
- pathIsGlobal
133
- );
134
- };
98
+ export function DELETE(pathOrOptions, pathIsGlobal = false) {
99
+ return function (target, propertyKey, descriptor) {
100
+ metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
101
+ };
135
102
  }
136
- export {
137
- DELETE,
138
- GET,
139
- HEAD,
140
- HTML,
141
- PATCH,
142
- POST,
143
- PUT
144
- };
@@ -1,68 +1,42 @@
1
- import { ClassHelpers__NS__ensureMethodConfig } from "../../helpers/class-helpers";
2
- function metaParam(param, name, expire, defaultValue = void 0, target, propertyKey, parameterIndex) {
3
- const methodCfg = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
4
- const nameKey = name ? name : param;
5
- methodCfg.parameters[nameKey] = {
6
- index: parameterIndex,
7
- paramName: name,
8
- paramType: param,
9
- defaultType: defaultValue,
10
- expireInSeconds: expire
11
- };
1
+ import { ClassHelpers__NS__ensureMethodConfig } from '../../helpers/class-helpers';
2
+ function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
3
+ const methodCfg = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
4
+ const nameKey = name ? name : param;
5
+ // const key = name || `${param}_${parameterIndex}`;
6
+ methodCfg.parameters[nameKey] = {
7
+ index: parameterIndex,
8
+ paramName: name,
9
+ paramType: param,
10
+ defaultType: defaultValue,
11
+ expireInSeconds: expire,
12
+ };
13
+ // console.log('params updated', methodConfig);
12
14
  }
13
- function Path(name) {
14
- return function(target, propertyKey, parameterIndex) {
15
- metaParam("Path", name, void 0, {}, target, propertyKey, parameterIndex);
16
- };
15
+ /**
16
+ * @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
17
+ */
18
+ export function Path(name) {
19
+ return function (target, propertyKey, parameterIndex) {
20
+ metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
21
+ };
17
22
  }
18
- function Query(name) {
19
- return function(target, propertyKey, parameterIndex) {
20
- metaParam(
21
- "Query",
22
- name,
23
- void 0,
24
- {},
25
- target,
26
- propertyKey,
27
- parameterIndex
28
- );
29
- };
23
+ export function Query(name) {
24
+ return function (target, propertyKey, parameterIndex) {
25
+ metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
26
+ };
30
27
  }
31
- function Cookie(name, expireInSecond = 3600) {
32
- return function(target, propertyKey, parameterIndex) {
33
- metaParam(
34
- "Cookie",
35
- name,
36
- expireInSecond,
37
- {},
38
- target,
39
- propertyKey,
40
- parameterIndex
41
- );
42
- };
28
+ export function Cookie(name, expireInSecond = 3600) {
29
+ return function (target, propertyKey, parameterIndex) {
30
+ metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
31
+ };
43
32
  }
44
- function Header(name) {
45
- return function(target, propertyKey, parameterIndex) {
46
- metaParam(
47
- "Header",
48
- name,
49
- void 0,
50
- {},
51
- target,
52
- propertyKey,
53
- parameterIndex
54
- );
55
- };
33
+ export function Header(name) {
34
+ return function (target, propertyKey, parameterIndex) {
35
+ metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
36
+ };
56
37
  }
57
- function Body(name) {
58
- return function(target, propertyKey, parameterIndex) {
59
- metaParam("Body", name, void 0, {}, target, propertyKey, parameterIndex);
60
- };
38
+ export function Body(name) {
39
+ return function (target, propertyKey, parameterIndex) {
40
+ metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
41
+ };
61
42
  }
62
- export {
63
- Body,
64
- Cookie,
65
- Header,
66
- Path,
67
- Query
68
- };
@@ -1,31 +1,30 @@
1
- class DITaonContainer {
2
- static instances = /* @__PURE__ */ new Map();
3
- static resolve(target) {
4
- if (DITaonContainer.instances.has(target)) {
5
- return DITaonContainer.instances.get(target);
6
- }
7
- const injections = [];
8
- const instance = new target(...injections);
9
- DITaonContainer.instances.set(target, instance);
10
- return instance;
11
- }
12
- static inject(target) {
13
- return new Proxy(
14
- {},
15
- {
16
- get: (_, propName) => {
17
- let instance = DITaonContainer.instances.get(target) || DITaonContainer.resolve(target);
18
- return typeof instance[propName] === "function" ? instance[propName].bind(instance) : instance[propName];
19
- },
20
- set: (_, propName, value) => {
21
- let instance = DITaonContainer.instances.get(target) || DITaonContainer.resolve(target);
22
- instance[propName] = value;
23
- return true;
1
+ export class DITaonContainer {
2
+ static { this.instances = new Map(); }
3
+ static resolve(target) {
4
+ if (DITaonContainer.instances.has(target)) {
5
+ return DITaonContainer.instances.get(target);
24
6
  }
25
- }
26
- );
27
- }
7
+ // const tokens = Reflect.getMetadata('design:paramtypes', target) || [];
8
+ const injections = []; // tokens.map(token => Container.inject<any>(token));
9
+ const instance = new target(...injections);
10
+ DITaonContainer.instances.set(target, instance);
11
+ return instance;
12
+ }
13
+ static inject(target) {
14
+ return new Proxy({}, {
15
+ get: (_, propName) => {
16
+ let instance = DITaonContainer.instances.get(target) ||
17
+ DITaonContainer.resolve(target);
18
+ return typeof instance[propName] === 'function'
19
+ ? instance[propName].bind(instance)
20
+ : instance[propName];
21
+ },
22
+ set: (_, propName, value) => {
23
+ let instance = DITaonContainer.instances.get(target) ||
24
+ DITaonContainer.resolve(target);
25
+ instance[propName] = value;
26
+ return true;
27
+ },
28
+ });
29
+ }
28
30
  }
29
- export {
30
- DITaonContainer
31
- };
@@ -1,36 +1,31 @@
1
- import { CoreModels__NS__SPECIAL_APP_READY_MESSAGE } from "tnp-core/lib-prod";
2
- class ContextsEndpointStorage {
3
- SPECIAL_APP_READY_MESSAGE = CoreModels__NS__SPECIAL_APP_READY_MESSAGE;
4
- taonEndpointContexts = /* @__PURE__ */ new Map();
5
- //#region singleton
6
- static instance;
7
- constructor() {
8
- }
9
- static get Instance() {
10
- if (!ContextsEndpointStorage.instance) {
11
- ContextsEndpointStorage.instance = new ContextsEndpointStorage();
1
+ import { CoreModels__NS__SPECIAL_APP_READY_MESSAGE } from 'tnp-core/lib-prod';
2
+ export class ContextsEndpointStorage {
3
+ constructor() {
4
+ this.SPECIAL_APP_READY_MESSAGE = CoreModels__NS__SPECIAL_APP_READY_MESSAGE;
5
+ this.taonEndpointContexts = new Map();
6
+ // Private constructor to prevent direct instantiation
12
7
  }
13
- return ContextsEndpointStorage.instance;
14
- }
15
- //#endregion
16
- set(context) {
17
- if (!this.taonEndpointContexts.has(context.contextName)) {
18
- this.taonEndpointContexts.set(context.contextName, context);
8
+ static get Instance() {
9
+ if (!ContextsEndpointStorage.instance) {
10
+ ContextsEndpointStorage.instance = new ContextsEndpointStorage();
11
+ }
12
+ return ContextsEndpointStorage.instance;
19
13
  }
20
- }
21
- get arr() {
22
- return Array.from(this.taonEndpointContexts.values()).filter(
23
- (f) => f.contextType === "normal"
24
- );
25
- }
26
- getBy(context) {
27
- if (typeof context === "string") {
28
- return this.taonEndpointContexts.get(context);
14
+ //#endregion
15
+ set(context) {
16
+ if (!this.taonEndpointContexts.has(context.contextName)) {
17
+ this.taonEndpointContexts.set(context.contextName, context);
18
+ }
19
+ }
20
+ get arr() {
21
+ return Array.from(this.taonEndpointContexts.values()).filter(f => f.contextType === 'normal');
22
+ }
23
+ getBy(context) {
24
+ if (typeof context === 'string') {
25
+ return this.taonEndpointContexts.get(context);
26
+ }
27
+ return this.taonEndpointContexts.get(context.contextName);
29
28
  }
30
- return this.taonEndpointContexts.get(context.contextName);
31
- }
32
29
  }
33
- globalThis["$$$ContextsEndpointStorage$$$"] = ContextsEndpointStorage.Instance;
34
- export {
35
- ContextsEndpointStorage
36
- };
30
+ // TODO QUICK_FIX @LAST encapsulate this => move to separate package
31
+ globalThis['$$$ContextsEndpointStorage$$$'] = ContextsEndpointStorage.Instance;