taon 19.0.5 → 19.0.7

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 (148) hide show
  1. package/browser/fesm2022/taon.mjs +3473 -2463
  2. package/browser/fesm2022/taon.mjs.map +1 -1
  3. package/browser/lib/base-classes/base-angular-service.d.ts +14 -0
  4. package/browser/lib/base-classes/base-class.d.ts +1 -1
  5. package/browser/lib/base-classes/base-context.d.ts +6 -6
  6. package/browser/lib/base-classes/base-injector.d.ts +12 -7
  7. package/browser/lib/base-classes/base-repository.d.ts +5 -6
  8. package/browser/lib/base-classes/base.d.ts +12 -10
  9. package/browser/lib/create-context.d.ts +14 -13
  10. package/browser/lib/endpoint-context.d.ts +6 -5
  11. package/browser/lib/index.d.ts +24 -24
  12. package/browser/lib/inject.d.ts +4 -1
  13. package/browser/lib/ui/taon-table/taon-table.component.d.ts +8 -7
  14. package/browser/package.json +1 -1
  15. package/client/fesm2022/taon.mjs +3473 -2463
  16. package/client/fesm2022/taon.mjs.map +1 -1
  17. package/client/lib/base-classes/base-angular-service.d.ts +14 -0
  18. package/client/lib/base-classes/base-class.d.ts +1 -1
  19. package/client/lib/base-classes/base-context.d.ts +6 -6
  20. package/client/lib/base-classes/base-injector.d.ts +12 -7
  21. package/client/lib/base-classes/base-repository.d.ts +5 -6
  22. package/client/lib/base-classes/base.d.ts +12 -10
  23. package/client/lib/create-context.d.ts +14 -13
  24. package/client/lib/endpoint-context.d.ts +6 -5
  25. package/client/lib/index.d.ts +24 -24
  26. package/client/lib/inject.d.ts +4 -1
  27. package/client/lib/ui/taon-table/taon-table.component.d.ts +8 -7
  28. package/client/package.json +1 -1
  29. package/lib/base-classes/base-abstract-entity.js +2 -2
  30. package/lib/base-classes/base-abstract-entity.js.map +1 -1
  31. package/lib/base-classes/base-angular-service.d.ts +10 -0
  32. package/lib/base-classes/base-angular-service.js +19 -0
  33. package/lib/base-classes/base-angular-service.js.map +1 -0
  34. package/lib/base-classes/base-class.d.ts +1 -1
  35. package/lib/base-classes/base-class.js +13 -4
  36. package/lib/base-classes/base-class.js.map +1 -1
  37. package/lib/base-classes/base-context.d.ts +6 -6
  38. package/lib/base-classes/base-crud-controller.js +6 -6
  39. package/lib/base-classes/base-crud-controller.js.map +1 -1
  40. package/lib/base-classes/base-entity.js +2 -2
  41. package/lib/base-classes/base-entity.js.map +1 -1
  42. package/lib/base-classes/base-injector.d.ts +12 -7
  43. package/lib/base-classes/base-injector.js +21 -19
  44. package/lib/base-classes/base-injector.js.map +1 -1
  45. package/lib/base-classes/base-migration.d.ts +1 -1
  46. package/lib/base-classes/base-migration.js +2 -2
  47. package/lib/base-classes/base-migration.js.map +1 -1
  48. package/lib/base-classes/base-repository.d.ts +3 -5
  49. package/lib/base-classes/base-repository.js +22 -61
  50. package/lib/base-classes/base-repository.js.map +1 -1
  51. package/lib/base-classes/base-subscriber-for-entity.d.ts +1 -1
  52. package/lib/base-classes/base.d.ts +12 -10
  53. package/lib/base-classes/base.js +7 -5
  54. package/lib/base-classes/base.js.map +1 -1
  55. package/lib/build-info._auto-generated_.d.ts +2 -1
  56. package/lib/build-info._auto-generated_.js +3 -2
  57. package/lib/build-info._auto-generated_.js.map +1 -1
  58. package/lib/context-db-migrations.d.ts +1 -1
  59. package/lib/context-db-migrations.js +7 -7
  60. package/lib/context-db-migrations.js.map +1 -1
  61. package/lib/create-context.d.ts +13 -12
  62. package/lib/create-context.js +13 -17
  63. package/lib/create-context.js.map +1 -1
  64. package/lib/decorators/classes/entity-decorator.d.ts +1 -1
  65. package/lib/decorators/classes/entity-decorator.js +8 -8
  66. package/lib/decorators/classes/entity-decorator.js.map +1 -1
  67. package/lib/decorators/http/http-decorators.d.ts +1 -1
  68. package/lib/decorators/http/http-decorators.js +2 -2
  69. package/lib/decorators/http/http-decorators.js.map +1 -1
  70. package/lib/decorators/http/http-methods-decorators.d.ts +1 -1
  71. package/lib/decorators/http/http-methods-decorators.js +2 -2
  72. package/lib/decorators/http/http-methods-decorators.js.map +1 -1
  73. package/lib/endpoint-context.d.ts +8 -5
  74. package/lib/endpoint-context.js +170 -179
  75. package/lib/endpoint-context.js.map +1 -1
  76. package/lib/entity-process.js +35 -35
  77. package/lib/entity-process.js.map +1 -1
  78. package/lib/env.js +2 -2
  79. package/lib/env.js.map +1 -1
  80. package/lib/formly/fromly.d.ts +1 -1
  81. package/lib/formly/fromly.js +26 -26
  82. package/lib/formly/fromly.js.map +1 -1
  83. package/lib/formly/type-from-entity.js +6 -6
  84. package/lib/formly/type-from-entity.js.map +1 -1
  85. package/lib/get-response-value.js +2 -2
  86. package/lib/get-response-value.js.map +1 -1
  87. package/lib/helpers/class-helpers.js +21 -21
  88. package/lib/helpers/class-helpers.js.map +1 -1
  89. package/lib/helpers/taon-helpers.js +4 -4
  90. package/lib/helpers/taon-helpers.js.map +1 -1
  91. package/lib/index.d.ts +24 -24
  92. package/lib/index.js +8 -9
  93. package/lib/index.js.map +1 -1
  94. package/lib/inject.js +3 -6
  95. package/lib/inject.js.map +1 -1
  96. package/lib/models.d.ts +1 -1
  97. package/lib/models.js +5 -5
  98. package/lib/models.js.map +1 -1
  99. package/lib/orm.d.ts +16 -3
  100. package/lib/orm.js +43 -5
  101. package/lib/orm.js.map +1 -1
  102. package/lib/realtime/realtime-client.js +3 -3
  103. package/lib/realtime/realtime-client.js.map +1 -1
  104. package/lib/realtime/realtime-core.js +3 -3
  105. package/lib/realtime/realtime-core.js.map +1 -1
  106. package/lib/realtime/realtime-server.js +7 -7
  107. package/lib/realtime/realtime-server.js.map +1 -1
  108. package/lib/realtime/realtime-subs-manager.js +3 -3
  109. package/lib/realtime/realtime-subs-manager.js.map +1 -1
  110. package/lib/storage.js +2 -2
  111. package/lib/storage.js.map +1 -1
  112. package/lib/symbols.js +7 -7
  113. package/lib/symbols.js.map +1 -1
  114. package/lib/ui/directives/index.js +2 -2
  115. package/lib/ui/index.js +2 -2
  116. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  117. package/lib/ui/taon-github-fork-me-corner/index.js +2 -2
  118. package/lib/ui/taon-github-fork-me-ribbon/index.js +2 -2
  119. package/lib/ui/taon-notifications/taon-notifications.models.js +2 -2
  120. package/lib/ui/taon-progress-bar/index.js +2 -2
  121. package/lib/ui/taon-session-passcode/index.js +2 -2
  122. package/lib/ui/taon-table/index.js +2 -2
  123. package/lib/ui/taon-table/taon-table.component.d.ts +7 -6
  124. package/lib/ui/taon.models.d.ts +1 -1
  125. package/lib/validators.js +8 -8
  126. package/lib/validators.js.map +1 -1
  127. package/old-app .js +1 -1
  128. package/old-app .js.map +1 -1
  129. package/package.json +1 -1
  130. package/tmp-environment.json +4 -4
  131. package/websql/fesm2022/taon.mjs +4983 -3644
  132. package/websql/fesm2022/taon.mjs.map +1 -1
  133. package/websql/lib/base-classes/base-angular-service.d.ts +14 -0
  134. package/websql/lib/base-classes/base-class.d.ts +1 -1
  135. package/websql/lib/base-classes/base-context.d.ts +6 -6
  136. package/websql/lib/base-classes/base-injector.d.ts +12 -7
  137. package/websql/lib/base-classes/base-repository.d.ts +3 -5
  138. package/websql/lib/base-classes/base.d.ts +12 -10
  139. package/websql/lib/create-context.d.ts +14 -13
  140. package/websql/lib/endpoint-context.d.ts +8 -5
  141. package/websql/lib/index.d.ts +24 -24
  142. package/websql/lib/inject.d.ts +4 -1
  143. package/websql/lib/orm.d.ts +15 -2
  144. package/websql/lib/ui/taon-table/taon-table.component.d.ts +8 -7
  145. package/websql/package.json +1 -1
  146. package/browser/lib/storage.d.ts +0 -2
  147. package/client/lib/storage.d.ts +0 -2
  148. package/websql/lib/storage.d.ts +0 -2
@@ -1,43 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EndpointContext = void 0;
4
- /* eslint-disable @typescript-eslint/typedef */
5
- //#region imports
6
- //#region @websql
7
- const taon_typeorm_1 = require("taon-typeorm");
8
- const taon_typeorm_2 = require("taon-typeorm");
9
- //#endregion
10
- //#region @backend
11
- const express = require("express");
12
- const expressSession = require("express-session");
13
- const cors = require("cors");
14
- const bodyParser = require("body-parser");
15
- const cookieParser = require("cookie-parser");
16
- const methodOverride = require("method-override");
17
- const fileUpload = require("express-fileupload");
18
- const url_1 = require("url");
19
- const tnp_core_1 = require("tnp-core");
20
- //#endregion
21
- /* */
4
+ const url_1 = require("url"); // @backend
22
5
  /* */
23
- const tnp_core_2 = require("tnp-core");
24
- const tnp_core_3 = require("tnp-core");
25
- const models_1 = require("./models");
26
- const class_helpers_1 = require("./helpers/class-helpers");
27
- const symbols_1 = require("./symbols");
28
- const tnp_core_4 = require("tnp-core");
29
- const di_container_1 = require("./dependency-injection/di-container");
30
- const taon_helpers_1 = require("./helpers/taon-helpers");
31
- const ng2_rest_1 = require("ng2-rest");
32
- const json10_1 = require("json10");
6
+ const axios_1 = require("axios");
7
+ const bodyParser = require("body-parser"); // @backend
8
+ const cookieParser = require("cookie-parser"); // @backend
9
+ const cors = require("cors"); // @backend
10
+ const express = require("express"); // @backend
11
+ const fileUpload = require("express-fileupload"); // @backend
12
+ const expressSession = require("express-session"); // @backend
13
+ const lib_1 = require("json10/lib");
14
+ const methodOverride = require("method-override"); // @backend
15
+ const lib_2 = require("ng2-rest/lib");
33
16
  const rxjs_1 = require("rxjs");
17
+ const lib_3 = require("taon-typeorm/lib"); // @websql
18
+ const lib_4 = require("taon-typeorm/lib"); // @websql
19
+ const lib_5 = require("taon-typeorm/lib");
20
+ const lib_6 = require("tnp-core/lib"); // @backend
21
+ const lib_7 = require("tnp-core/lib");
22
+ const lib_8 = require("tnp-core/lib");
23
+ const lib_9 = require("tnp-core/lib");
24
+ const context_db_migrations_1 = require("./context-db-migrations");
25
+ const di_container_1 = require("./dependency-injection/di-container");
34
26
  const entity_process_1 = require("./entity-process");
35
- const get_response_value_1 = require("./get-response-value");
36
- const axios_1 = require("axios");
37
- const taon_typeorm_3 = require("taon-typeorm");
38
27
  const env_1 = require("./env");
28
+ const get_response_value_1 = require("./get-response-value");
29
+ const class_helpers_1 = require("./helpers/class-helpers");
30
+ const taon_helpers_1 = require("./helpers/taon-helpers");
31
+ const models_1 = require("./models");
39
32
  const realtime_core_1 = require("./realtime/realtime-core");
40
- const context_db_migrations_1 = require("./context-db-migrations");
33
+ const symbols_1 = require("./symbols");
34
+ /* */
41
35
  //#endregion
42
36
  class EndpointContext {
43
37
  originalConfig;
@@ -45,10 +39,12 @@ class EndpointContext {
45
39
  //#region static
46
40
  /* */
47
41
  /* */
48
- static initNgZone(ngZone) {
49
- /* */
50
- /* */
51
- }
42
+ /* */
43
+ /* */
44
+ /* */
45
+ /* */
46
+ /* */
47
+ /* */
52
48
  // public static findForTraget(classFnOrObject: any): EndpointContext {
53
49
  // const obj = ClassHelpers.getClassFnFromObject(classFnOrObject) || {};
54
50
  // return (
@@ -84,6 +80,11 @@ class EndpointContext {
84
80
  //#region fields / active routes
85
81
  activeRoutes = [];
86
82
  //#endregion
83
+ //#region fields / typeorm repositories
84
+ //#region @websql
85
+ repos = new Map();
86
+ //#endregion
87
+ //#endregion
87
88
  skipWritingServerRoutes = false;
88
89
  //#region fields / types from contexts
89
90
  injectableTypesfromContexts = [
@@ -144,31 +145,31 @@ class EndpointContext {
144
145
  //#endregion
145
146
  //#region fields / logs
146
147
  get logHttp() {
147
- if (tnp_core_4._.isObject(this.config?.logs)) {
148
+ if (lib_9._.isObject(this.config?.logs)) {
148
149
  return !!this.config.logs.http;
149
150
  }
150
151
  return this.config?.logs === true;
151
152
  }
152
153
  get logRealtime() {
153
- if (tnp_core_4._.isObject(this.config?.logs)) {
154
+ if (lib_9._.isObject(this.config?.logs)) {
154
155
  return !!this.config.logs.realtime;
155
156
  }
156
157
  return this.config?.logs === true;
157
158
  }
158
159
  get logFramework() {
159
- if (tnp_core_4._.isObject(this.config?.logs)) {
160
+ if (lib_9._.isObject(this.config?.logs)) {
160
161
  return !!this.config.logs.framework;
161
162
  }
162
163
  return this.config?.logs === true;
163
164
  }
164
165
  get logDb() {
165
- if (tnp_core_4._.isObject(this.config?.logs)) {
166
+ if (lib_9._.isObject(this.config?.logs)) {
166
167
  return !!this.config.logs.db;
167
168
  }
168
169
  return this.config?.logs === true;
169
170
  }
170
171
  get logMigrations() {
171
- if (tnp_core_4._.isObject(this.config?.logs)) {
172
+ if (lib_9._.isObject(this.config?.logs)) {
172
173
  return !!this.config.logs.migrations;
173
174
  }
174
175
  return this.config?.logs === true;
@@ -190,16 +191,16 @@ class EndpointContext {
190
191
  // @ts-ignore
191
192
  this.onlyMigrationRevertToTimestamp = onlyMigrationRevertToTimestamp;
192
193
  this.config = this.configFn(env_1.ENV);
193
- if (tnp_core_4._.isObject(this.config.database)) {
194
+ if (lib_9._.isObject(this.config.database)) {
194
195
  this.config.database = models_1.Models.DatabaseConfig.from(this.config.database).databaseConfigTypeORM;
195
196
  }
196
197
  if (overrideHost && overrideRemoteHost) {
197
- tnp_core_4.Helpers.throw(`[taon-config] You can't have overrideHost and overrideRemoteHost at the same time`);
198
+ lib_9.Helpers.throw(`[taon-config] You can't have overrideHost and overrideRemoteHost at the same time`);
198
199
  }
199
- this.config.host = !tnp_core_4._.isUndefined(overrideHost)
200
+ this.config.host = !lib_9._.isUndefined(overrideHost)
200
201
  ? overrideHost
201
202
  : this.config.host;
202
- this.config.remoteHost = !tnp_core_4._.isUndefined(overrideRemoteHost)
203
+ this.config.remoteHost = !lib_9._.isUndefined(overrideRemoteHost)
203
204
  ? overrideRemoteHost
204
205
  : this.config.remoteHost;
205
206
  this.config.host = this.host === null ? void 0 : this.host;
@@ -208,19 +209,19 @@ class EndpointContext {
208
209
  if (this.config.host &&
209
210
  !this.config.host.startsWith('http://') &&
210
211
  !this.config.host.startsWith('https://')) {
211
- tnp_core_4.Helpers.throw(`[taon-config] Your 'host' must start with http:// or https://`);
212
+ lib_9.Helpers.throw(`[taon-config] Your 'host' must start with http:// or https://`);
212
213
  }
213
- if (tnp_core_4._.isUndefined(this.config.useIpcWhenElectron)) {
214
+ if (lib_9._.isUndefined(this.config.useIpcWhenElectron)) {
214
215
  this.config.useIpcWhenElectron = true;
215
216
  }
216
217
  if (this.config.remoteHost &&
217
218
  !this.config.remoteHost.startsWith('http://') &&
218
219
  !this.config.remoteHost.startsWith('https://')) {
219
- tnp_core_4.Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
220
+ lib_9.Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
220
221
  }
221
222
  //#region resolve if skipping writing server routes
222
223
  //@ts-expect-error overriding readonly
223
- this.skipWritingServerRoutes = tnp_core_4._.isBoolean(this.config.skipWritingServerRoutes)
224
+ this.skipWritingServerRoutes = lib_9._.isBoolean(this.config.skipWritingServerRoutes)
224
225
  ? this.config.skipWritingServerRoutes
225
226
  : false;
226
227
  //#endregion
@@ -232,12 +233,12 @@ class EndpointContext {
232
233
  }
233
234
  if (this.config.remoteHost) {
234
235
  if (this.config.host) {
235
- tnp_core_4.Helpers.throw(`[taon] You can't have remoteHost and host at the same time`);
236
+ lib_9.Helpers.throw(`[taon] You can't have remoteHost and host at the same time`);
236
237
  }
237
238
  this.mode = 'remote-backend(tcp+udp)';
238
239
  }
239
- if (this.config.useIpcWhenElectron && tnp_core_4.Helpers.isElectron) {
240
- if (tnp_core_4.Helpers.isWebSQL) {
240
+ if (this.config.useIpcWhenElectron && lib_9.Helpers.isElectron) {
241
+ if (lib_9.Helpers.isWebSQL) {
241
242
  this.mode = 'backend-frontend(websql-electron)';
242
243
  }
243
244
  else {
@@ -245,7 +246,7 @@ class EndpointContext {
245
246
  }
246
247
  }
247
248
  if (!this.mode && !this.config.abstract) {
248
- tnp_core_4.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
249
+ lib_9.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
249
250
  //#region @backend
250
251
  process.exit(1);
251
252
  //#endregion
@@ -255,13 +256,13 @@ class EndpointContext {
255
256
  if (this.config.database === true) {
256
257
  this.databaseConfig = this.getAutoGeneratedConfig();
257
258
  }
258
- else if (tnp_core_4._.isObject(this.config.database)) {
259
- this.databaseConfig = tnp_core_4._.merge(this.getAutoGeneratedConfig(), tnp_core_4._.cloneDeep(this.config.database));
259
+ else if (lib_9._.isObject(this.config.database)) {
260
+ this.databaseConfig = lib_9._.merge(this.getAutoGeneratedConfig(), lib_9._.cloneDeep(this.config.database));
260
261
  }
261
262
  //#endregion
262
263
  //#region resolve session
263
264
  if (this.config.session) {
264
- this.session = tnp_core_4._.cloneDeep(this.config.session);
265
+ this.session = lib_9._.cloneDeep(this.config.session);
265
266
  const oneHour = 1000 * 60 * 60 * 1; // 24;
266
267
  if (!this.session.cookieMaxAge) {
267
268
  this.session.cookieMaxAge = oneHour;
@@ -353,11 +354,11 @@ class EndpointContext {
353
354
  this.expressApp = express();
354
355
  this.initMiddlewares();
355
356
  this.serverTcpUdp = this.isHttpServer
356
- ? new tnp_core_1.https.Server({
357
+ ? new lib_6.https.Server({
357
358
  key: this.config.https?.key,
358
359
  cert: this.config.https?.cert,
359
360
  }, this.expressApp)
360
- : new tnp_core_1.http.Server(this.expressApp);
361
+ : new lib_6.http.Server(this.expressApp);
361
362
  this.publicAssets.forEach(asset => {
362
363
  this.expressApp.use(asset.serverPath, express.static(asset.locationOnDisk));
363
364
  });
@@ -368,7 +369,7 @@ class EndpointContext {
368
369
  if (!this.config.abstract) {
369
370
  this.disabledRealtime = !!this.config.disabledRealtime;
370
371
  //#region @backend
371
- if (tnp_core_4.Helpers.isRunningIn.cliMode()) {
372
+ if (lib_9.Helpers.isRunningIn.cliMode()) {
372
373
  // TODO for now...
373
374
  this.disabledRealtime = true;
374
375
  }
@@ -381,16 +382,16 @@ class EndpointContext {
381
382
  // console.log({ ref })
382
383
  if (this.config.abstract) {
383
384
  this.logFramework &&
384
- tnp_core_4.Helpers.info(`[taon] Create abstract context: ${this.config.contextName}`);
385
+ lib_9.Helpers.info(`[taon] Create abstract context: ${this.config.contextName}`);
385
386
  }
386
387
  else {
387
388
  if (this.config.remoteHost) {
388
389
  this.logFramework &&
389
- tnp_core_4.Helpers.info(`[taon] Create context for remote host: ${this.config.remoteHost}`);
390
+ lib_9.Helpers.info(`[taon] Create context for remote host: ${this.config.remoteHost}`);
390
391
  }
391
392
  else {
392
393
  this.logFramework &&
393
- tnp_core_4.Helpers.info(`[taon] Create context for host: ${this.config.host}`);
394
+ lib_9.Helpers.info(`[taon] Create context for host: ${this.config.host}`);
394
395
  }
395
396
  }
396
397
  //#endregion
@@ -404,8 +405,8 @@ class EndpointContext {
404
405
  getAutoGeneratedConfig() {
405
406
  //#region @websqlFunc
406
407
  let databaseConfig = models_1.Models.DatabaseConfig.from({});
407
- if (tnp_core_2.UtilsOs.isRunningInDocker()) {
408
- tnp_core_4.Helpers.info('Running in docker, using in mysql database');
408
+ if (lib_7.UtilsOs.isRunningInDocker()) {
409
+ lib_9.Helpers.info('Running in docker, using in mysql database');
409
410
  // TODO auto resolve database config in docker
410
411
  databaseConfig = models_1.Models.DatabaseConfig.from({
411
412
  database: `db-${this.contextName}.sqlite`,
@@ -420,7 +421,7 @@ class EndpointContext {
420
421
  }
421
422
  else {
422
423
  this.logFramework &&
423
- tnp_core_4.Helpers.info(`[taon][database] Automatically resolving database config for mode ${this.mode}`);
424
+ lib_9.Helpers.info(`[taon][database] Automatically resolving database config for mode ${this.mode}`);
424
425
  switch (this.mode) {
425
426
  //#region resolve database config for mode backend-frontend(tcp+udp)
426
427
  case 'backend-frontend(ipc-electron)':
@@ -475,23 +476,26 @@ class EndpointContext {
475
476
  }
476
477
  //#endregion
477
478
  //#region methods & getters / start server
478
- startServer() {
479
+ async startServer() {
479
480
  //#region @backendFunc
480
481
  if (this.remoteHost || this.isRunOrRevertOnlyMigrationAppStart) {
481
482
  return;
482
483
  }
483
484
  if (this.mode === 'backend-frontend(tcp+udp)') {
484
- // this.displayRoutes(this.expressApp);
485
- this.serverTcpUdp.listen(Number(this.uri.port), () => {
486
- tnp_core_4.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
485
+ return await new Promise(resolve => {
486
+ // this.displayRoutes(this.expressApp);
487
+ this.serverTcpUdp.listen(Number(this.uri.port), () => {
488
+ lib_9.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
487
489
  address: ${this.uri.protocol}//localhost:${this.uri.port}${this.uri.pathname}
488
490
  env: ${this.expressApp.settings.env}
489
491
  `);
492
+ resolve(void 0);
493
+ });
490
494
  });
491
495
  }
492
496
  else {
493
497
  this.logFramework &&
494
- tnp_core_4.Helpers.info('Ipc communication enable instead tcp/upd');
498
+ lib_9.Helpers.info('Ipc communication enable instead tcp/upd');
495
499
  }
496
500
  //#endregion
497
501
  }
@@ -536,7 +540,6 @@ class EndpointContext {
536
540
  }
537
541
  //#endregion
538
542
  //#region methods & getters / clone class
539
- // eslint-disable-next-line @typescript-eslint/typedef
540
543
  cloneClassWithNewMetadata = ({ BaseClass, className, config, ctx, classType, }) => {
541
544
  // Return a new class that extends the base class
542
545
  const cloneClass = () => {
@@ -546,18 +549,14 @@ class EndpointContext {
546
549
  }
547
550
  return class extends BaseClass {
548
551
  // static ['_'] = BaseClass['_'];
549
- // eslint-disable-next-line @typescript-eslint/typedef
550
552
  // @ts-ignore
551
553
  static [symbols_1.Symbols.orignalClass] = BaseClass;
552
- // eslint-disable-next-line @typescript-eslint/typedef
553
554
  // @ts-ignore
554
555
  static [symbols_1.Symbols.fullClassNameStaticProperty] = `${ctx.contextName}.${className}`;
555
- // eslint-disable-next-line @typescript-eslint/typedef
556
556
  // @ts-ignore
557
557
  static [symbols_1.Symbols.classNameStaticProperty] = className;
558
- // eslint-disable-next-line @typescript-eslint/typedef
559
558
  static [symbols_1.Symbols.ctxInClassOrClassObj] = ctx;
560
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/typedef
559
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
561
560
  static __getFullPathForClass__(arr = []) {
562
561
  const name = this[symbols_1.Symbols.fullClassNameStaticProperty];
563
562
  arr.push(name);
@@ -604,7 +603,7 @@ class EndpointContext {
604
603
  for (const key of Object.keys(classesInput || {})) {
605
604
  const BaseClass = classesInput[key];
606
605
  if (!BaseClass) {
607
- tnp_core_4.Helpers.error(`Class ${key} is not defined in context ${ctx.contextName}
606
+ lib_9.Helpers.error(`Class ${key} is not defined in context ${ctx.contextName}
608
607
 
609
608
  Please check if you have correct import in context file
610
609
 
@@ -673,9 +672,6 @@ class EndpointContext {
673
672
  //#endregion
674
673
  //#region methods & getters / inject
675
674
  inject(ctor, options) {
676
- if (!options) {
677
- options = {};
678
- }
679
675
  const className = class_helpers_1.ClassHelpers.getName(ctor);
680
676
  const locaInstanceConstructorArgs = options.locaInstanceConstructorArgs || [];
681
677
  if (this.isCLassType(models_1.Models.ClassType.REPOSITORY, ctor)) {
@@ -684,20 +680,27 @@ class EndpointContext {
684
680
  if (options?.localInstance) {
685
681
  const ctxClassFn = this.getClassFunByClassName(className);
686
682
  let entityName = '';
687
- if (className === 'BaseRepository') {
688
- const entityFn = locaInstanceConstructorArgs[0];
689
- const entity = entityFn && entityFn();
690
- entityName = entity && class_helpers_1.ClassHelpers.getName(entity);
691
- }
683
+ // entity thing is only for repositories local repositories
684
+ // if (className === 'BaseRepository') {
685
+ const entityFn = lib_9._.first(locaInstanceConstructorArgs);
686
+ const entity = entityFn && entityFn();
687
+ entityName = (entity && class_helpers_1.ClassHelpers.getName(entity)) || '';
688
+ // console.log(`entityName `, entityName);
689
+ // }
692
690
  if (!options.contextClassInstance[this.localInstaceObjSymbol]) {
693
691
  options.contextClassInstance[this.localInstaceObjSymbol] = {};
694
692
  }
695
693
  const instanceKey = className + (entityName ? `.${entityName}` : '');
696
694
  const existed = options.contextClassInstance[this.localInstaceObjSymbol][instanceKey];
697
695
  if (existed) {
698
- // console.log(`exited `, existed)
696
+ // console.log(
697
+ // `EXISTED ${ClassHelpers.getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
698
+ // );
699
699
  return existed;
700
700
  }
701
+ // console.log(
702
+ // `NEW ${ClassHelpers.getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
703
+ // );
701
704
  if (!ctxClassFn) {
702
705
  throw new Error(`Not able to inject "${className}" inside context "${this.contextName}"
703
706
 
@@ -734,12 +737,15 @@ class EndpointContext {
734
737
  // }
735
738
  // }
736
739
  // }
737
- return this.inject(ctor, { localInstance: false });
740
+ return this.inject(ctor, {
741
+ localInstance: false,
742
+ parentInstanceThatWillGetInjectedStuff: this,
743
+ });
738
744
  }
739
745
  //#endregion
740
746
  //#region methods & getters / check if context initialized
741
747
  checkIfContextInitialized() {
742
- if (tnp_core_4._.isUndefined(this.config)) {
748
+ if (lib_9._.isUndefined(this.config)) {
743
749
  throw new Error(`Please check if your context has been initialized.
744
750
 
745
751
  // ...
@@ -825,11 +831,8 @@ class EndpointContext {
825
831
  const controllers = this.getClassesInstancesArrBy(models_1.Models.ClassType.CONTROLLER);
826
832
  // console.log('CONTROLLERS TO REINIT', controllers);
827
833
  for (const ctrl of controllers) {
828
- if (tnp_core_4._.isFunction(ctrl.initExampleDbData)) {
829
- await tnp_core_4.Helpers.runSyncOrAsync({
830
- functionFn: ctrl.initExampleDbData,
831
- context: ctrl,
832
- });
834
+ if (lib_9._.isFunction(ctrl.initExampleDbData)) {
835
+ await ctrl.initExampleDbData();
833
836
  }
834
837
  }
835
838
  // Helpers.taskDone(
@@ -840,6 +843,12 @@ class EndpointContext {
840
843
  if (this.remoteHost) {
841
844
  return;
842
845
  }
846
+ //#region @websql
847
+ for (const classFun of this.getClassFunByArr(models_1.Models.ClassType.ENTITY)) {
848
+ const repo = (await this.connection.getRepository(class_helpers_1.ClassHelpers.getOrginalClass(classFun)));
849
+ this.repos.set(class_helpers_1.ClassHelpers.getName(classFun), repo);
850
+ }
851
+ //#endregion
843
852
  for (const classTypeName of [
844
853
  models_1.Models.ClassType.PROVIDER,
845
854
  models_1.Models.ClassType.REPOSITORY,
@@ -848,26 +857,11 @@ class EndpointContext {
848
857
  models_1.Models.ClassType.MIGRATION,
849
858
  ]) {
850
859
  //#region init class static _ property
851
- // Helpers.taskStarted(
852
- // `[taon] REINITING _ CLASS FN ${classTypeName} ${this.contextName} STARTED`,
853
- // );
854
860
  for (const classFun of this.getClassFunByArr(classTypeName)) {
855
- if (tnp_core_4._.isFunction(classFun._)) {
856
- await tnp_core_4.Helpers.runSyncOrAsync({
857
- functionFn: classFun._,
858
- context: classFun,
859
- });
860
- // const orgClass = ClassHelpers.getOrginalClass(classFun);
861
- // // orgClass['ctrl'] = classFun['ctrl'];
862
- // await Helpers.runSyncOrAsync({
863
- // functionFn: orgClass._,
864
- // context: orgClass,
865
- // });
861
+ if (lib_9._.isFunction(classFun._)) {
862
+ await classFun._();
866
863
  }
867
864
  }
868
- // Helpers.taskStarted(
869
- // `[taon] REINITING _ CLASS FN ${classTypeName} ${this.contextName} DONE`,
870
- // );
871
865
  //#endregion
872
866
  }
873
867
  for (const classTypeName of [
@@ -881,11 +875,8 @@ class EndpointContext {
881
875
  // `[taon] REINITING _ INS FN ${classTypeName} ${this.contextName} STARTED`,
882
876
  // );
883
877
  for (const ctrl of this.getClassesInstancesArrBy(classTypeName)) {
884
- if (tnp_core_4._.isFunction(ctrl._)) {
885
- await tnp_core_4.Helpers.runSyncOrAsync({
886
- functionFn: ctrl._,
887
- context: ctrl,
888
- });
878
+ if (lib_9._.isFunction(ctrl._)) {
879
+ await ctrl._();
889
880
  }
890
881
  }
891
882
  // Helpers.taskStarted(
@@ -967,7 +958,7 @@ class EndpointContext {
967
958
  const options = Reflect.getMetadata(symbols_1.Symbols.metadata.options.subscriber, subscriberClassFn);
968
959
  // console.log('subscriber options', options);
969
960
  // const nameForSubscriber = ClassHelpers.getName(subscriber);
970
- (0, taon_typeorm_1.EventSubscriber)()(subscriberClassFn);
961
+ (0, lib_3.EventSubscriber)()(subscriberClassFn);
971
962
  }
972
963
  //#endregion
973
964
  }
@@ -981,15 +972,15 @@ class EndpointContext {
981
972
  const entities = this.getClassFunByArr(models_1.Models.ClassType.ENTITY);
982
973
  for (const entity of entities) {
983
974
  const options = Reflect.getMetadata(symbols_1.Symbols.metadata.options.entity, entity);
984
- const createTable = tnp_core_4._.isUndefined(options.createTable)
975
+ const createTable = lib_9._.isUndefined(options.createTable)
985
976
  ? true
986
977
  : options.createTable;
987
978
  const nameForEntity = class_helpers_1.ClassHelpers.getName(entity);
988
- if (tnp_core_4._.isUndefined(options.createTable) ? true : options.createTable) {
979
+ if (createTable) {
989
980
  this.logDb &&
990
981
  console.info(`[taon][typeorm] create table for entity "${nameForEntity}" ? '${createTable}'`);
991
982
  // console.log('TypeormEntity', { TypeormEntity });
992
- (0, taon_typeorm_2.Entity)(nameForEntity)(entity);
983
+ (0, lib_4.Entity)(nameForEntity)(entity);
993
984
  }
994
985
  else {
995
986
  this.logDb &&
@@ -1028,7 +1019,7 @@ class EndpointContext {
1028
1019
  return class_helpers_1.ClassHelpers.getOrginalClass(entityFn);
1029
1020
  });
1030
1021
  const subscribers = this.getClassFunByArr(models_1.Models.ClassType.SUBSCRIBER);
1031
- const dataSourceDbConfig = tnp_core_4._.isObject(this.databaseConfig)
1022
+ const dataSourceDbConfig = lib_9._.isObject(this.databaseConfig)
1032
1023
  ? {
1033
1024
  type: this.databaseConfig.type,
1034
1025
  port: this.databaseConfig.databasePort,
@@ -1043,9 +1034,9 @@ class EndpointContext {
1043
1034
  synchronize: this.isRunOrRevertOnlyMigrationAppStart
1044
1035
  ? false
1045
1036
  : this.databaseConfig.synchronize,
1046
- autoSave: !tnp_core_4._.isNil(this.databaseConfig.autoSave)
1037
+ autoSave: !lib_9._.isNil(this.databaseConfig.autoSave)
1047
1038
  ? this.databaseConfig.autoSave
1048
- : !tnp_core_2.UtilsOs.isRunningInDocker(), // in docker I am using mysql or posgress
1039
+ : !lib_7.UtilsOs.isRunningInDocker(), // in docker I am using mysql or posgress
1049
1040
  dropSchema: this.isRunOrRevertOnlyMigrationAppStart
1050
1041
  ? false
1051
1042
  : this.databaseConfig.dropSchema,
@@ -1059,9 +1050,9 @@ class EndpointContext {
1059
1050
  if (this.modeAllowsDatabaseCreation && this.databaseConfig) {
1060
1051
  this.logDb &&
1061
1052
  this.logFramework &&
1062
- tnp_core_4.Helpers.info('[taon][database] prepare typeorm connection...');
1053
+ lib_9.Helpers.info('[taon][database] prepare typeorm connection...');
1063
1054
  try {
1064
- const connection = new taon_typeorm_3.DataSource(dataSourceDbConfig);
1055
+ const connection = new lib_5.DataSource(dataSourceDbConfig);
1065
1056
  this.connection = connection;
1066
1057
  await this.connection.initialize();
1067
1058
  }
@@ -1096,7 +1087,7 @@ class EndpointContext {
1096
1087
  // debugger;
1097
1088
  }
1098
1089
  else {
1099
- tnp_core_4.Helpers.info(`[taon][typeorm] Not initing db for mode ${this.mode}`);
1090
+ lib_9.Helpers.info(`[taon][typeorm] Not initing db for mode ${this.mode}`);
1100
1091
  }
1101
1092
  //#endregion
1102
1093
  }
@@ -1114,7 +1105,7 @@ class EndpointContext {
1114
1105
  const configs = class_helpers_1.ClassHelpers.getControllerConfigs(controllerClassFn);
1115
1106
  // console.log(`Class config for ${ClassHelpers.getName(controllerClassFn)}`, configs)
1116
1107
  const classConfig = configs[0];
1117
- const parentscalculatedPath = tnp_core_4._.slice(configs, 1)
1108
+ const parentscalculatedPath = lib_9._.slice(configs, 1)
1118
1109
  .reverse()
1119
1110
  .map(bc => {
1120
1111
  if (taon_helpers_1.TaonHelpers.isGoodPath(bc.path)) {
@@ -1132,13 +1123,13 @@ class EndpointContext {
1132
1123
  .replace(/\/\//g, '/')
1133
1124
  .split('/')
1134
1125
  .reduce((acc, bc) => {
1135
- return tnp_core_4._.last(acc) === bc ? acc : [...acc, bc];
1126
+ return lib_9._.last(acc) === bc ? acc : [...acc, bc];
1136
1127
  }, [])
1137
1128
  .join('/');
1138
1129
  }
1139
- tnp_core_4._.slice(configs, 1).forEach(bc => {
1130
+ lib_9._.slice(configs, 1).forEach(bc => {
1140
1131
  const alreadyIs = classConfig.methods;
1141
- const toMerge = tnp_core_4._.cloneDeep(bc.methods);
1132
+ const toMerge = lib_9._.cloneDeep(bc.methods);
1142
1133
  for (const key in toMerge) {
1143
1134
  if (toMerge.hasOwnProperty(key) && !alreadyIs[key]) {
1144
1135
  const element = toMerge[key];
@@ -1147,7 +1138,7 @@ class EndpointContext {
1147
1138
  }
1148
1139
  });
1149
1140
  //#region @backend
1150
- if (!tnp_core_4.Helpers.isRunningIn.cliMode()) {
1141
+ if (!lib_9.Helpers.isRunningIn.cliMode()) {
1151
1142
  //#endregion
1152
1143
  this.logHttp &&
1153
1144
  console.groupCollapsed(`[taon][express-server] routes [${classConfig.className}]`);
@@ -1163,7 +1154,7 @@ class EndpointContext {
1163
1154
  ? `/${methodConfig.path?.replace(/\//, '')}`
1164
1155
  : taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
1165
1156
  // console.log({ expressPath })
1166
- if (tnp_core_4.Helpers.isNode || tnp_core_4.Helpers.isWebSQL) {
1157
+ if (lib_9.Helpers.isNode || lib_9.Helpers.isWebSQL) {
1167
1158
  //#region @websql
1168
1159
  const { routePath, method } = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
1169
1160
  this.activeRoutes.push({
@@ -1172,7 +1163,7 @@ class EndpointContext {
1172
1163
  });
1173
1164
  //#endregion
1174
1165
  }
1175
- const shouldInitClient = tnp_core_4.Helpers.isBrowser || this.remoteHost || tnp_core_4.Helpers.isWebSQL;
1166
+ const shouldInitClient = lib_9.Helpers.isBrowser || this.remoteHost || lib_9.Helpers.isWebSQL;
1176
1167
  // console.log('shouldInitClient', shouldInitClient);
1177
1168
  if (shouldInitClient) {
1178
1169
  // console.log(
@@ -1186,7 +1177,7 @@ class EndpointContext {
1186
1177
  }
1187
1178
  });
1188
1179
  //#region @backend
1189
- if (!tnp_core_4.Helpers.isRunningIn.cliMode()) {
1180
+ if (!lib_9.Helpers.isRunningIn.cliMode()) {
1190
1181
  //#endregion
1191
1182
  this.logHttp && console.groupEnd();
1192
1183
  //#region @backend
@@ -1204,11 +1195,11 @@ class EndpointContext {
1204
1195
  }
1205
1196
  const contexts = [this];
1206
1197
  //#region @websql
1207
- const troutes = tnp_core_2.Utils.uniqArray(this.activeRoutes.map(f => {
1198
+ const troutes = lib_7.Utils.uniqArray(this.activeRoutes.map(f => {
1208
1199
  return `${f.method} ${f.routePath}`;
1209
1200
  })).map(f => {
1210
1201
  const [method, routePath] = f.split(' ');
1211
- return (`\n### ${tnp_core_4._.startCase(tnp_core_4._.last(routePath.split('/')))}\n` +
1202
+ return (`\n### ${lib_9._.startCase(lib_9._.last(routePath.split('/')))}\n` +
1212
1203
  taon_helpers_1.TaonHelpers.fillUpTo(method.toUpperCase() + ' ', 10) +
1213
1204
  this.uri.href.replace(/\/$/, '') +
1214
1205
  routePath);
@@ -1219,7 +1210,7 @@ class EndpointContext {
1219
1210
  ...['', `# ROUTES FOR HOST ${this.uri.href} `],
1220
1211
  ...troutes,
1221
1212
  ].join('\n');
1222
- const fileName = (0, tnp_core_3.crossPlatformPath)([
1213
+ const fileName = (0, lib_8.crossPlatformPath)([
1223
1214
  //#region @backend
1224
1215
  process.cwd(),
1225
1216
  //#endregion
@@ -1228,7 +1219,7 @@ class EndpointContext {
1228
1219
  this.logFramework && console.log(`[taon] routes file: ${fileName} `);
1229
1220
  // Helpers.log(JSON.stringify(routes, null, 4))
1230
1221
  //#region @backend
1231
- tnp_core_4.Helpers.writeFile(fileName, routes);
1222
+ lib_9.Helpers.writeFile(fileName, routes);
1232
1223
  //#endregion
1233
1224
  //#endregion
1234
1225
  }
@@ -1259,7 +1250,7 @@ class EndpointContext {
1259
1250
  app.use(methodOverride());
1260
1251
  app.use(cookieParser());
1261
1252
  if (this.session) {
1262
- tnp_core_4.Helpers.info('[taon][express-server] session enabled for this context ' +
1253
+ lib_9.Helpers.info('[taon][express-server] session enabled for this context ' +
1263
1254
  this.contextName);
1264
1255
  const { cookieMaxAge } = this.session;
1265
1256
  const frontendHost = this.config.frontendHost;
@@ -1285,7 +1276,7 @@ class EndpointContext {
1285
1276
  else {
1286
1277
  // if(this.config?.serverLogs) {
1287
1278
  this.logHttp &&
1288
- tnp_core_4.Helpers.info(`[taon][express-server] session not enabled for this context '${this.contextName}'`);
1279
+ lib_9.Helpers.info(`[taon][express-server] session not enabled for this context '${this.contextName}'`);
1289
1280
  // }
1290
1281
  app.use(cors({
1291
1282
  // origin: "http://localhost:5555",
@@ -1366,10 +1357,10 @@ class EndpointContext {
1366
1357
  expressPath = expressPath.replace(/\/\//g, '/');
1367
1358
  // console.log(`BACKEND: expressPath: ${ expressPath } `)
1368
1359
  //#endregion
1369
- if (tnp_core_4.Helpers.isElectron) {
1360
+ if (lib_9.Helpers.isElectron) {
1370
1361
  //#region @backend
1371
1362
  const ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
1372
- tnp_core_4.Helpers.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
1363
+ lib_9.Helpers.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
1373
1364
  const responseJsonData = await getResult(paramsFromBrowser, void 0, void 0);
1374
1365
  event.sender.send(taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), responseJsonData);
1375
1366
  });
@@ -1382,7 +1373,7 @@ class EndpointContext {
1382
1373
  if (!this.remoteHost) {
1383
1374
  //#region apply dummy websql express routers
1384
1375
  //#region @websql
1385
- if (tnp_core_4.Helpers.isWebSQL) {
1376
+ if (lib_9.Helpers.isWebSQL) {
1386
1377
  if (!this.expressApp[type.toLowerCase()]) {
1387
1378
  this.expressApp[type.toLowerCase()] = () => { };
1388
1379
  }
@@ -1415,7 +1406,7 @@ class EndpointContext {
1415
1406
  if (req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS]) {
1416
1407
  try {
1417
1408
  const entity = JSON.parse(req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS]);
1418
- tBody = ng2_rest_1.Mapping.encode(tBody, entity);
1409
+ tBody = lib_2.Mapping.encode(tBody, entity);
1419
1410
  }
1420
1411
  catch (e) { }
1421
1412
  }
@@ -1423,7 +1414,7 @@ class EndpointContext {
1423
1414
  Object.keys(tBody).forEach(paramName => {
1424
1415
  try {
1425
1416
  const entityForParam = JSON.parse(req.headers[`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${paramName} `]);
1426
- tBody[paramName] = ng2_rest_1.Mapping.encode(tBody[paramName], entityForParam);
1417
+ tBody[paramName] = lib_2.Mapping.encode(tBody[paramName], entityForParam);
1427
1418
  }
1428
1419
  catch (e) { }
1429
1420
  });
@@ -1433,7 +1424,7 @@ class EndpointContext {
1433
1424
  if (req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]) {
1434
1425
  try {
1435
1426
  const entity = JSON.parse(req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]);
1436
- tQuery = taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(ng2_rest_1.Mapping.encode(tQuery, entity));
1427
+ tQuery = taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(lib_2.Mapping.encode(tQuery, entity));
1437
1428
  }
1438
1429
  catch (e) { }
1439
1430
  }
@@ -1442,14 +1433,14 @@ class EndpointContext {
1442
1433
  try {
1443
1434
  const entityForParam = JSON.parse(req.headers[`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${queryParamName} `]);
1444
1435
  let beforeTransofrm = tQuery[queryParamName];
1445
- if (tnp_core_4._.isString(beforeTransofrm)) {
1436
+ if (lib_9._.isString(beforeTransofrm)) {
1446
1437
  try {
1447
1438
  const paresed = taon_helpers_1.TaonHelpers.tryTransformParam(beforeTransofrm);
1448
1439
  beforeTransofrm = paresed;
1449
1440
  }
1450
1441
  catch (e) { }
1451
1442
  }
1452
- const afterEncoding = ng2_rest_1.Mapping.encode(beforeTransofrm, entityForParam);
1443
+ const afterEncoding = lib_2.Mapping.encode(beforeTransofrm, entityForParam);
1453
1444
  tQuery[queryParamName] =
1454
1445
  taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(afterEncoding);
1455
1446
  }
@@ -1504,7 +1495,7 @@ class EndpointContext {
1504
1495
  res.end(file);
1505
1496
  //#endregion
1506
1497
  }
1507
- else if (tnp_core_4._.isString(result) &&
1498
+ else if (lib_9._.isString(result) &&
1508
1499
  methodConfig.responseType ===
1509
1500
  'blob') {
1510
1501
  // console.log('BASE64')
@@ -1531,8 +1522,8 @@ class EndpointContext {
1531
1522
  }
1532
1523
  catch (error) {
1533
1524
  //#region process error
1534
- if (tnp_core_4._.isString(error)) {
1535
- res.status(400).send(json10_1.JSON10.stringify({
1525
+ if (lib_9._.isString(error)) {
1526
+ res.status(400).send(lib_1.JSON10.stringify({
1536
1527
  message: `
1537
1528
  Error inside: ${req.path}
1538
1529
 
@@ -1542,22 +1533,22 @@ class EndpointContext {
1542
1533
  }));
1543
1534
  }
1544
1535
  else if (error instanceof models_1.Models.Http.Errors) {
1545
- tnp_core_4.Helpers.error(error, true, false);
1536
+ lib_9.Helpers.error(error, true, false);
1546
1537
  const err = error;
1547
- res.status(400).send(json10_1.JSON10.stringify(err));
1538
+ res.status(400).send(lib_1.JSON10.stringify(err));
1548
1539
  }
1549
1540
  else if (error instanceof Error) {
1550
1541
  const err = error;
1551
- tnp_core_4.Helpers.error(error, true, false);
1552
- res.status(400).send(json10_1.JSON10.stringify({
1542
+ lib_9.Helpers.error(error, true, false);
1543
+ res.status(400).send(lib_1.JSON10.stringify({
1553
1544
  stack: err.stack,
1554
1545
  message: err.message,
1555
1546
  }));
1556
1547
  }
1557
1548
  else {
1558
- tnp_core_4.Helpers.log(error);
1559
- tnp_core_4.Helpers.error(`[Taon] Bad result isomorphic method: ${error} `, true, false);
1560
- res.status(400).send(json10_1.JSON10.stringify(error));
1549
+ lib_9.Helpers.log(error);
1550
+ lib_9.Helpers.error(`[Taon] Bad result isomorphic method: ${error} `, true, false);
1551
+ res.status(400).send(lib_1.JSON10.stringify(error));
1561
1552
  }
1562
1553
  //#endregion
1563
1554
  }
@@ -1583,36 +1574,36 @@ class EndpointContext {
1583
1574
  // console.log('INITING', methodConfig); // TODO inject in static
1584
1575
  //#region resolve storage
1585
1576
  let storage;
1586
- if (tnp_core_4.Helpers.isBrowser) {
1577
+ if (lib_9.Helpers.isBrowser) {
1587
1578
  storage = window;
1588
1579
  }
1589
1580
  //#region @backend
1590
- if (tnp_core_4.Helpers.isNode) {
1581
+ if (lib_9.Helpers.isNode) {
1591
1582
  storage = global;
1592
1583
  }
1593
1584
  //#endregion
1594
1585
  //#endregion
1595
1586
  const orgMethods = target.prototype[methodConfig.methodName];
1596
1587
  //#region handle electron ipc request
1597
- if (tnp_core_4.Helpers.isElectron) {
1588
+ if (lib_9.Helpers.isElectron) {
1598
1589
  target.prototype[methodConfig.methodName] = function (...args) {
1599
1590
  const received = new Promise(async (resolve, reject) => {
1600
1591
  const headers = {};
1601
1592
  const { request, response } = taon_helpers_1.TaonHelpers.websqlMocks(headers);
1602
- tnp_core_4.Helpers.ipcRenderer.once(taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), (event, responseData) => {
1593
+ lib_9.Helpers.ipcRenderer.once(taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), (event, responseData) => {
1603
1594
  let res = responseData;
1604
1595
  console.log({ responseData });
1605
1596
  try {
1606
1597
  const body = res;
1607
- res = new ng2_rest_1.Models.HttpResponse({
1598
+ res = new lib_2.Models.HttpResponse({
1608
1599
  body: void 0,
1609
1600
  isArray: void 0,
1610
1601
  method: methodConfig.type,
1611
1602
  url: `${ctx.uri.origin}${'' // TODO express path
1612
1603
  }${methodConfig.path} `,
1613
- }, tnp_core_4.Helpers.isBlob(body) || tnp_core_4._.isString(body)
1604
+ }, lib_9.Helpers.isBlob(body) || lib_9._.isString(body)
1614
1605
  ? body
1615
- : JSON.stringify(body), ng2_rest_1.RestHeaders.from(headers), void 0, () => body);
1606
+ : JSON.stringify(body), lib_2.RestHeaders.from(headers), void 0, () => body);
1616
1607
  resolve(res);
1617
1608
  }
1618
1609
  catch (error) {
@@ -1620,7 +1611,7 @@ class EndpointContext {
1620
1611
  reject(error);
1621
1612
  }
1622
1613
  });
1623
- tnp_core_4.Helpers.ipcRenderer.send(taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath), args);
1614
+ lib_9.Helpers.ipcRenderer.send(taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath), args);
1624
1615
  });
1625
1616
  received['observable'] = (0, rxjs_1.from)(received);
1626
1617
  return {
@@ -1788,25 +1779,25 @@ class EndpointContext {
1788
1779
  if (!endpoints[ctx.uri.href][expressPath]) {
1789
1780
  let headers = {};
1790
1781
  if (methodConfig.contentType && !methodConfig.responseType) {
1791
- rest = ng2_rest_1.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, ng2_rest_1.RestHeaders.from({
1782
+ rest = lib_2.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_2.RestHeaders.from({
1792
1783
  'Content-Type': methodConfig.contentType,
1793
1784
  Accept: methodConfig.contentType,
1794
1785
  }));
1795
1786
  }
1796
1787
  else if (methodConfig.contentType && methodConfig.responseType) {
1797
- rest = ng2_rest_1.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, ng2_rest_1.RestHeaders.from({
1788
+ rest = lib_2.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_2.RestHeaders.from({
1798
1789
  'Content-Type': methodConfig.contentType,
1799
1790
  Accept: methodConfig.contentType,
1800
1791
  responsetypeaxios: methodConfig.responseType,
1801
1792
  }));
1802
1793
  }
1803
1794
  else if (!methodConfig.contentType && methodConfig.responseType) {
1804
- rest = ng2_rest_1.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, ng2_rest_1.RestHeaders.from({
1795
+ rest = lib_2.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_2.RestHeaders.from({
1805
1796
  responsetypeaxios: methodConfig.responseType,
1806
1797
  }));
1807
1798
  }
1808
1799
  else {
1809
- rest = ng2_rest_1.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
1800
+ rest = lib_2.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
1810
1801
  }
1811
1802
  endpoints[ctx.uri.href][expressPath] = rest;
1812
1803
  }
@@ -1832,18 +1823,18 @@ class EndpointContext {
1832
1823
  }
1833
1824
  if (currentParam.paramType === 'Query') {
1834
1825
  if (currentParam.paramName) {
1835
- const mapping = ng2_rest_1.Mapping.decode(param, !ctx.isProductionMode);
1826
+ const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1836
1827
  if (mapping) {
1837
1828
  rest.headers.set(`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
1838
1829
  }
1839
1830
  queryParams[currentParam.paramName] = param;
1840
1831
  }
1841
1832
  else {
1842
- const mapping = ng2_rest_1.Mapping.decode(param, !ctx.isProductionMode);
1833
+ const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1843
1834
  if (mapping) {
1844
1835
  rest.headers.set(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
1845
1836
  }
1846
- queryParams = tnp_core_4._.cloneDeep(param);
1837
+ queryParams = lib_9._.cloneDeep(param);
1847
1838
  }
1848
1839
  }
1849
1840
  if (currentParam.paramType === 'Header') {
@@ -1863,7 +1854,7 @@ class EndpointContext {
1863
1854
  }
1864
1855
  }
1865
1856
  if (currentParam.paramType === 'Cookie') {
1866
- ng2_rest_1.Resource.Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
1857
+ lib_2.Resource.Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
1867
1858
  }
1868
1859
  if (currentParam.paramType === 'Body') {
1869
1860
  if (currentParam.paramName) {
@@ -1880,14 +1871,14 @@ instead
1880
1871
  // ...
1881
1872
  `);
1882
1873
  }
1883
- const mapping = ng2_rest_1.Mapping.decode(param, !ctx.isProductionMode);
1874
+ const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1884
1875
  if (mapping) {
1885
1876
  rest.headers.set(`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
1886
1877
  }
1887
1878
  bodyObject[currentParam.paramName] = param;
1888
1879
  }
1889
1880
  else {
1890
- const mapping = ng2_rest_1.Mapping.decode(param, !ctx.isProductionMode);
1881
+ const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1891
1882
  if (mapping) {
1892
1883
  rest.headers.set(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
1893
1884
  }
@@ -1898,17 +1889,17 @@ instead
1898
1889
  if (typeof bodyObject === 'object' &&
1899
1890
  class_helpers_1.ClassHelpers.getName(bodyObject) !== 'FormData') {
1900
1891
  let circuralFromItem = [];
1901
- bodyObject = json10_1.JSON10.parse(json10_1.JSON10.stringify(bodyObject, void 0, void 0, circs => {
1892
+ bodyObject = lib_1.JSON10.parse(lib_1.JSON10.stringify(bodyObject, void 0, void 0, circs => {
1902
1893
  circuralFromItem = circs;
1903
1894
  }));
1904
- rest.headers.set(symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, json10_1.JSON10.stringify(circuralFromItem));
1895
+ rest.headers.set(symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_1.JSON10.stringify(circuralFromItem));
1905
1896
  }
1906
1897
  if (typeof queryParams === 'object') {
1907
1898
  let circuralFromQueryParams = [];
1908
- queryParams = json10_1.JSON10.parse(json10_1.JSON10.stringify(queryParams, void 0, void 0, circs => {
1899
+ queryParams = lib_1.JSON10.parse(lib_1.JSON10.stringify(queryParams, void 0, void 0, circs => {
1909
1900
  circuralFromQueryParams = circs;
1910
1901
  }));
1911
- rest.headers.set(symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, json10_1.JSON10.stringify(circuralFromQueryParams));
1902
+ rest.headers.set(symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, lib_1.JSON10.stringify(circuralFromQueryParams));
1912
1903
  }
1913
1904
  //#endregion
1914
1905
  const httpResultObj = {