taon 19.0.48 → 19.0.50

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 (168) hide show
  1. package/browser/fesm2022/taon.mjs +304 -198
  2. package/browser/fesm2022/taon.mjs.map +1 -1
  3. package/browser/lib/constants.d.ts +2 -1
  4. package/browser/lib/endpoint-context.d.ts +28 -1
  5. package/browser/lib/helpers/class-helpers.d.ts +0 -1
  6. package/browser/lib/models.d.ts +19 -0
  7. package/browser/lib/realtime/realtime-core.d.ts +2 -2
  8. package/browser/lib/realtime/realtime-server.d.ts +2 -2
  9. package/browser/package.json +1 -1
  10. package/lib/base-classes/base-subscriber.d.ts +4 -0
  11. package/lib/base-classes/base-subscriber.js +25 -0
  12. package/lib/base-classes/base-subscriber.js.map +1 -0
  13. package/lib/build-info._auto-generated_.d.ts +17 -1
  14. package/lib/build-info._auto-generated_.js +18 -2
  15. package/lib/build-info._auto-generated_.js.map +1 -1
  16. package/lib/constants.d.ts +1 -0
  17. package/lib/constants.js +2 -1
  18. package/lib/constants.js.map +1 -1
  19. package/lib/create-context.js +15 -0
  20. package/lib/create-context.js.map +1 -1
  21. package/lib/endpoint-context.d.ts +28 -1
  22. package/lib/endpoint-context.js +132 -56
  23. package/lib/endpoint-context.js.map +1 -1
  24. package/lib/env.js +5 -1
  25. package/lib/env.js.map +1 -1
  26. package/lib/helpers/class-helpers.d.ts +0 -1
  27. package/lib/helpers/class-helpers.js +13 -14
  28. package/lib/helpers/class-helpers.js.map +1 -1
  29. package/lib/models.d.ts +19 -0
  30. package/lib/models.js +3 -0
  31. package/lib/models.js.map +1 -1
  32. package/lib/realtime/realtime-client.js +9 -0
  33. package/lib/realtime/realtime-client.js.map +1 -1
  34. package/lib/realtime/realtime-core.d.ts +2 -2
  35. package/lib/realtime/realtime-core.js +6 -5
  36. package/lib/realtime/realtime-core.js.map +1 -1
  37. package/lib/realtime/realtime-server.d.ts +2 -2
  38. package/lib/realtime/realtime-server.js +20 -23
  39. package/lib/realtime/realtime-server.js.map +1 -1
  40. package/lib/realtime/realtime-strategy/realtime-abstract-mock.d.ts +10 -0
  41. package/lib/realtime/realtime-strategy/realtime-abstract-mock.js +214 -0
  42. package/lib/realtime/realtime-strategy/realtime-abstract-mock.js.map +1 -0
  43. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts +0 -0
  44. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +5 -0
  45. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +1 -0
  46. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +22 -0
  47. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +139 -0
  48. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +1 -0
  49. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +16 -0
  50. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +68 -0
  51. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +1 -0
  52. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +10 -0
  53. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +56 -0
  54. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +1 -0
  55. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +10 -0
  56. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +50 -0
  57. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +1 -0
  58. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +13 -0
  59. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +3 -0
  60. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +1 -0
  61. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +2 -0
  62. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +6 -0
  63. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +1 -0
  64. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +16 -0
  65. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +54 -0
  66. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +1 -0
  67. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +17 -0
  68. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +52 -0
  69. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +1 -0
  70. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +11 -0
  71. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +39 -0
  72. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +1 -0
  73. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +13 -0
  74. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +46 -0
  75. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +1 -0
  76. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +11 -0
  77. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +3 -0
  78. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +1 -0
  79. package/lib/realtime/realtime-strategy/realtime-strategy-mock.js +2 -2
  80. package/lib/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
  81. package/lib/storage.d.ts +1 -1
  82. package/lib/storage.js +5 -1
  83. package/lib/storage.js.map +1 -1
  84. package/lib/ui/directives/firedev-inject-html.directive.d.ts +6 -0
  85. package/lib/ui/directives/firedev-long-press.directive.d.ts +22 -0
  86. package/lib/ui/directives/index.d.ts +3 -0
  87. package/lib/ui/directives/index.js +5 -0
  88. package/lib/ui/directives/index.js.map +1 -0
  89. package/lib/ui/directives/safe.pipe.d.ts +7 -0
  90. package/lib/ui/directives/taon-inject-html.directive.d.ts +6 -0
  91. package/lib/ui/directives/taon-long-press.directive.d.ts +22 -0
  92. package/lib/ui/directives/view-mode.d.ts +5 -0
  93. package/lib/ui/directives/view-mode.js +10 -0
  94. package/lib/ui/directives/view-mode.js.map +1 -0
  95. package/lib/ui/index.js +2 -2
  96. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +2 -0
  97. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +5 -0
  98. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +1 -0
  99. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +29 -0
  100. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +2 -0
  101. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +1 -0
  102. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +5 -0
  103. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +1 -0
  104. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +8 -0
  105. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +2 -0
  106. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +5 -0
  107. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +1 -0
  108. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +13 -0
  109. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +2 -0
  110. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  111. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +5 -0
  112. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +3 -0
  113. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +1 -0
  114. package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +14 -0
  115. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +43 -0
  116. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +2 -0
  117. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.d.ts +5 -0
  118. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js +3 -0
  119. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +1 -0
  120. package/lib/ui/taon-full-material.module.d.ts +5 -0
  121. package/lib/ui/taon-github-fork-me-corner/index.d.ts +2 -0
  122. package/lib/ui/taon-github-fork-me-corner/index.js +5 -0
  123. package/lib/ui/taon-github-fork-me-corner/index.js.map +1 -0
  124. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +3 -0
  125. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +2 -0
  126. package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +2 -0
  127. package/lib/ui/taon-github-fork-me-ribbon/index.js +5 -0
  128. package/lib/ui/taon-github-fork-me-ribbon/index.js.map +1 -0
  129. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +3 -0
  130. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +2 -0
  131. package/lib/ui/taon-notifications/index.d.ts +4 -0
  132. package/lib/ui/taon-notifications/index.js +24 -0
  133. package/lib/ui/taon-notifications/index.js.map +1 -0
  134. package/lib/ui/taon-notifications/taon-notifications.component.d.ts +9 -0
  135. package/lib/ui/taon-notifications/taon-notifications.models.d.ts +6 -0
  136. package/lib/ui/taon-notifications/taon-notifications.models.js +5 -0
  137. package/lib/ui/taon-notifications/taon-notifications.models.js.map +1 -0
  138. package/lib/ui/taon-notifications/taon-notifications.module.d.ts +2 -0
  139. package/lib/ui/taon-notifications/taon-notifications.service.d.ts +11 -0
  140. package/lib/ui/taon-progress-bar/index.d.ts +2 -0
  141. package/lib/ui/taon-progress-bar/index.js +5 -0
  142. package/lib/ui/taon-progress-bar/index.js.map +1 -0
  143. package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +13 -0
  144. package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +2 -0
  145. package/lib/ui/taon-session-passcode/index.d.ts +1 -0
  146. package/lib/ui/taon-session-passcode/index.js +5 -0
  147. package/lib/ui/taon-session-passcode/index.js.map +1 -0
  148. package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +35 -0
  149. package/lib/ui/taon-table/index.d.ts +2 -0
  150. package/lib/ui/taon-table/index.js +5 -0
  151. package/lib/ui/taon-table/index.js.map +1 -0
  152. package/lib/ui/taon-table/taon-table.component.d.ts +34 -0
  153. package/lib/ui/taon-table/taon-table.module.d.ts +2 -0
  154. package/lib/ui/taon.models.d.ts +11 -0
  155. package/lib/ui/taon.models.js +3 -0
  156. package/lib/ui/taon.models.js.map +1 -0
  157. package/lib/ui/toan-full-material.module.d.ts +2 -0
  158. package/package.json +1 -1
  159. package/tmp-environment.json +43 -0
  160. package/websql/fesm2022/taon.mjs +335 -230
  161. package/websql/fesm2022/taon.mjs.map +1 -1
  162. package/websql/lib/constants.d.ts +2 -1
  163. package/websql/lib/endpoint-context.d.ts +28 -1
  164. package/websql/lib/helpers/class-helpers.d.ts +0 -1
  165. package/websql/lib/models.d.ts +19 -0
  166. package/websql/lib/realtime/realtime-core.d.ts +2 -2
  167. package/websql/lib/realtime/realtime-server.d.ts +2 -2
  168. package/websql/package.json +1 -1
@@ -24,6 +24,7 @@ const lib_8 = require("tnp-core/lib");
24
24
  const lib_9 = require("tnp-core/lib");
25
25
  const lib_10 = require("tnp-core/lib");
26
26
  const lib_11 = require("tnp-core/lib");
27
+ const constants_1 = require("./constants");
27
28
  const context_db_migrations_1 = require("./context-db-migrations");
28
29
  const di_container_1 = require("./dependency-injection/di-container");
29
30
  const entity_process_1 = require("./entity-process");
@@ -183,9 +184,14 @@ class EndpointContext {
183
184
  //#endregion
184
185
  //#endregion
185
186
  //#region constructor
187
+ /**
188
+ * Inside docker there is not need for https secure server
189
+ */
190
+ isRunningInsideDocker = false;
186
191
  constructor(originalConfig, configFn) {
187
192
  this.originalConfig = originalConfig;
188
193
  this.configFn = configFn;
194
+ this.isRunningInsideDocker = lib_8.UtilsOs.isRunningInDocker();
189
195
  }
190
196
  //#endregion
191
197
  //#region methods & getters / init
@@ -243,6 +249,10 @@ class EndpointContext {
243
249
  }
244
250
  this.mode = 'remote-backend(tcp+udp)';
245
251
  }
252
+ // console.log(`
253
+ // useIpcWhenElectron: ${this.config.useIpcWhenElectron}
254
+ // Helpers.isElectron: ${Helpers.isElectron}
255
+ // `)
246
256
  if (this.config.useIpcWhenElectron && lib_10.Helpers.isElectron) {
247
257
  if (lib_10.Helpers.isWebSQL) {
248
258
  this.mode = 'backend-frontend(websql-electron)';
@@ -251,6 +261,11 @@ class EndpointContext {
251
261
  this.mode = 'backend-frontend(ipc-electron)';
252
262
  }
253
263
  }
264
+ // mode === undefined for BaseContext => ok behavior
265
+ // console.log(`Mode for BE/FE communication: ${this.mode}`);
266
+ // if(!this.mode) {
267
+ // console.log(this.config)
268
+ // }
254
269
  if (!this.mode && !this.config.abstract) {
255
270
  lib_10.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
256
271
  //#region @backend
@@ -383,7 +398,14 @@ class EndpointContext {
383
398
  //#region @backend
384
399
  this.expressApp = express();
385
400
  this.initMiddlewares();
386
- this.serverTcpUdp = this.isHttpServer
401
+ const shouldStartHttpsSecureServer = this.isHttpServer && !this.isRunningInsideDocker;
402
+ this.logFramework &&
403
+ lib_10.Helpers.info(`
404
+
405
+ Starting server ${shouldStartHttpsSecureServer ? 'with' : 'without'} HTTPS secure server
406
+
407
+ `);
408
+ this.serverTcpUdp = shouldStartHttpsSecureServer
387
409
  ? new lib_7.https.Server({
388
410
  key: this.config.https?.key,
389
411
  cert: this.config.https?.cert,
@@ -437,12 +459,12 @@ class EndpointContext {
437
459
  console.log(`
438
460
 
439
461
 
440
- IS RUNNING IN DOCKER: ${lib_8.UtilsOs.isRunningInDocker()}
462
+ IS RUNNING IN DOCKER: ${this.isRunningInsideDocker}
441
463
 
442
464
  `);
443
465
  //#region @websqlFunc
444
466
  let databaseConfig = models_1.Models.DatabaseConfig.from({});
445
- if (lib_8.UtilsOs.isRunningInDocker()) {
467
+ if (this.isRunningInsideDocker) {
446
468
  if (this.USE_MARIADB_MYSQL_IN_DOCKER) {
447
469
  // Helpers.info('Running in docker, using in mysql database');
448
470
  // // TODO auto resolve database config in docker
@@ -573,12 +595,12 @@ class EndpointContext {
573
595
  }
574
596
  if (this.mode === 'backend-frontend(tcp+udp)') {
575
597
  return await new Promise(resolve => {
576
- if (lib_8.UtilsOs.isRunningInDocker()) {
598
+ if (this.isRunningInsideDocker) {
577
599
  // this.displayRoutes(this.expressApp);
578
- this.serverTcpUdp.listen(Number(this.uri.port), '0.0.0.0', () => {
579
- lib_10.Helpers.log(`Express server (inside docker) started 0.0.0.0:${this.uri.port}`);
580
- lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
581
- address: ${this.uri.protocol}//localhost:${this.uri.port}${this.uri.pathname}
600
+ this.serverTcpUdp.listen(Number(this.uriPort), '0.0.0.0', () => {
601
+ lib_10.Helpers.log(`Express server (inside docker) started 0.0.0.0:${this.uriPort}`);
602
+ lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uriPort}, hostname: ${this.uriPathname},
603
+ address: ${this.uriProtocol}//localhost:${this.uriPort}${this.uriPathname}
582
604
  env: ${this.expressApp.settings.env}
583
605
  `);
584
606
  resolve(void 0);
@@ -586,10 +608,10 @@ class EndpointContext {
586
608
  }
587
609
  else {
588
610
  // this.displayRoutes(this.expressApp);
589
- this.serverTcpUdp.listen(Number(this.uri.port), () => {
590
- lib_10.Helpers.log(`Express server (inside nodejs app) started on localhost:${this.uri.port}`);
591
- lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
592
- address: ${this.uri.protocol}//localhost:${this.uri.port}${this.uri.pathname}
611
+ this.serverTcpUdp.listen(Number(this.uriPort), () => {
612
+ lib_10.Helpers.log(`Express server (inside nodejs app) started on localhost:${this.uriPort}`);
613
+ lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uriPort}, hostname: ${this.uriPathname},
614
+ address: ${this.uriProtocol}//localhost:${this.uriPort}${this.uriPathname}
593
615
  env: ${this.expressApp.settings.env}
594
616
  `);
595
617
  resolve(void 0);
@@ -997,6 +1019,13 @@ class EndpointContext {
997
1019
  }
998
1020
  //#endregion
999
1021
  //#region methods & getters / uri
1022
+ get frontendHostUri() {
1023
+ const url = this.config?.frontendHost?.startsWith('http')
1024
+ ? this.config.frontendHost
1025
+ : `${globalThis?.location?.protocol || 'http:'}//${this.config?.frontendHost}`;
1026
+ const uri = new url_1.URL(url.replace(/\/$/, ''));
1027
+ return uri;
1028
+ }
1000
1029
  get uri() {
1001
1030
  const url = this.host
1002
1031
  ? new url_1.URL(this.host)
@@ -1006,16 +1035,56 @@ class EndpointContext {
1006
1035
  return url;
1007
1036
  }
1008
1037
  //#endregion
1038
+ get uriPort() {
1039
+ if (!this.uri?.origin?.includes('localhost')) {
1040
+ return this.config?.hostPortNumber?.toString();
1041
+ }
1042
+ return this.uri?.port;
1043
+ }
1044
+ get uriProtocol() {
1045
+ return this.uri?.protocol;
1046
+ }
1047
+ /**
1048
+ * Examples
1049
+ * http://localhost:3000
1050
+ * https://localhost (from localhost:80) *
1051
+ */
1052
+ get uriOrigin() {
1053
+ return this.uri?.origin;
1054
+ }
1055
+ /**
1056
+ * Exampels
1057
+ * http://localhost:3000/path/to/somewhere
1058
+ * https://localhost/path/to/somewhere (from localhost:80)
1059
+ */
1060
+ // get uriOriginWithPathname(): string | undefined {
1061
+ // return this.uri?.origin
1062
+ // ? this.uri?.origin + this.uriPathnameOrNothingIfRoot.replace(/\/$/, '')
1063
+ // : undefined;
1064
+ // }
1065
+ get uriPathname() {
1066
+ return this.uri?.pathname;
1067
+ }
1068
+ /**
1069
+ * Examples
1070
+ * http://localhost:3000/path/to/somewhere -> '/path/to/somewhere'
1071
+ * http://localhost:3000 -> '' #
1072
+ * https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
1073
+ */
1074
+ get uriPathnameOrNothingIfRoot() {
1075
+ const isNonRootProperPathName = this.uri?.pathname && this.uri.pathname !== '/';
1076
+ return isNonRootProperPathName ? this.uri.pathname.replace(/\/$/, '') : '';
1077
+ }
1009
1078
  /**
1010
1079
  * Port from uri as number
1011
1080
  * @returns {Number | undefined}
1012
1081
  */
1013
1082
  get port() {
1014
- return this.uri?.port ? Number(this.uri.port) : undefined;
1083
+ return this.uri?.port ? Number(this.uriPort) : undefined;
1015
1084
  }
1016
1085
  //#region methods & getters / is https server
1017
1086
  get isHttpServer() {
1018
- return this.uri.protocol === 'https:';
1087
+ return this.uriProtocol === 'https:';
1019
1088
  }
1020
1089
  //#endregion
1021
1090
  //#region methods & getters / public assets
@@ -1026,6 +1095,9 @@ class EndpointContext {
1026
1095
  return this.config.contextName;
1027
1096
  }
1028
1097
  //#endregion
1098
+ get activeContext() {
1099
+ return this.config.activeContext || null;
1100
+ }
1029
1101
  get appId() {
1030
1102
  return this.config.appId;
1031
1103
  }
@@ -1132,7 +1204,7 @@ class EndpointContext {
1132
1204
  }
1133
1205
  else {
1134
1206
  if (this.USE_MARIADB_MYSQL_IN_DOCKER) {
1135
- autoSave = !lib_8.UtilsOs.isRunningInDocker(); // in docker I am using mysql or posgress
1207
+ autoSave = !this.isRunningInsideDocker; // in docker I am using mysql or posgress
1136
1208
  }
1137
1209
  else {
1138
1210
  autoSave = true; // on docker with sqljs I need to save db
@@ -1218,7 +1290,7 @@ class EndpointContext {
1218
1290
  return;
1219
1291
  }
1220
1292
  const allControllers = this.getClassFunByArr(models_1.Models.ClassType.CONTROLLER);
1221
- // console.log('allControllers', allControllers)11
1293
+ // console.log('allControllers', allControllers);
1222
1294
  for (const controllerClassFn of allControllers) {
1223
1295
  controllerClassFn[symbols_1.Symbols.classMethodsNames] =
1224
1296
  class_helpers_1.ClassHelpers.getMethodsNames(controllerClassFn);
@@ -1238,15 +1310,17 @@ class EndpointContext {
1238
1310
  classConfig.calculatedPath = classConfig.path;
1239
1311
  }
1240
1312
  else {
1241
- classConfig.calculatedPath =
1242
- `${parentscalculatedPath}/${class_helpers_1.ClassHelpers.getName(controllerClassFn)}`
1243
- .replace(/\/\//g, '/')
1244
- .split('/')
1245
- .reduce((acc, bc) => {
1246
- return lib_10._.last(acc) === bc ? acc : [...acc, bc];
1247
- }, [])
1248
- .join('/');
1313
+ classConfig.calculatedPath = (`${this.uriPathnameOrNothingIfRoot}` +
1314
+ `/${constants_1.apiPrefix}/${this.contextName}/tcp${parentscalculatedPath}/` +
1315
+ `${class_helpers_1.ClassHelpers.getName(controllerClassFn)}`)
1316
+ .replace(/\/\//g, '/')
1317
+ .split('/')
1318
+ .reduce((acc, bc) => {
1319
+ return lib_10._.last(acc) === bc ? acc : [...acc, bc];
1320
+ }, [])
1321
+ .join('/');
1249
1322
  }
1323
+ // console.log('calculatedPath', classConfig.calculatedPath);
1250
1324
  lib_10._.slice(configs, 1).forEach(bc => {
1251
1325
  const alreadyIs = classConfig.methods;
1252
1326
  const toMerge = lib_10._.cloneDeep(bc.methods);
@@ -1271,16 +1345,21 @@ class EndpointContext {
1271
1345
  const methodConfig = classConfig.methods[methodName];
1272
1346
  // debugger
1273
1347
  const type = methodConfig.type;
1348
+ // this is quick fix - in docker global path should not be used
1349
+ const globalPathPart = this.isRunningInsideDocker ||
1350
+ !this.frontendHostUri?.origin?.includes('localhost') // fe with domain -> is in docker
1351
+ ? `${this.uriPathnameOrNothingIfRoot.replace(/\/$/, '')}/${constants_1.apiPrefix}/${this.contextName}`.replace(/\/\//, '/')
1352
+ : '';
1274
1353
  const expressPath = methodConfig.global
1275
- ? `/${methodConfig.path?.replace(/\//, '')}`
1354
+ ? `${globalPathPart}/${methodConfig.path?.replace(/\/$/, '')}`.replace(/\/\//, '/')
1276
1355
  : taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
1277
- // console.log({ expressPath })
1356
+ // console.log({ expressPath });
1278
1357
  if (lib_10.Helpers.isNode || lib_10.Helpers.isWebSQL) {
1279
1358
  //#region @websql
1280
- const { routePath, method } = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
1359
+ const route = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
1281
1360
  this.activeRoutes.push({
1282
- routePath,
1283
- method,
1361
+ expressPath: route.expressPath,
1362
+ method: route.method,
1284
1363
  });
1285
1364
  //#endregion
1286
1365
  }
@@ -1314,21 +1393,21 @@ class EndpointContext {
1314
1393
  this.skipWritingServerRoutes) {
1315
1394
  return;
1316
1395
  }
1317
- const contexts = [this];
1396
+ // const contexts: EndpointContext[] = [this];
1318
1397
  //#region @websql
1319
1398
  const troutes = lib_8.Utils.uniqArray(this.activeRoutes.map(f => {
1320
- return `${f.method} ${f.routePath}`;
1399
+ return `${f.method} ${f.expressPath}`;
1321
1400
  })).map(f => {
1322
- const [method, routePath] = f.split(' ');
1323
- return (`\n### ${lib_10._.startCase(lib_10._.last(routePath.split('/')))}\n` +
1401
+ const [method, expressPath] = f.split(' ');
1402
+ return (`\n### ${lib_10._.startCase(lib_10._.last(expressPath.split('/')))}\n` +
1324
1403
  taon_helpers_1.TaonHelpers.fillUpTo(method.toUpperCase() + ' ', 10) +
1325
- this.uri.href.replace(/\/$/, '') +
1326
- routePath);
1404
+ this.uriOrigin +
1405
+ expressPath);
1327
1406
  // return `${TaonHelpers.string(method.toUpperCase() + ':')
1328
- // .fillUpTo(10)}${context.uri.href.replace(/\/$/, '')}${routePath}`
1407
+ // .fillUpTo(10)}${context.uriHref.replace(/\/$/, '')}${expressPath}`
1329
1408
  });
1330
1409
  const routes = [
1331
- ...['', `# ROUTES FOR HOST ${this.uri.href} `],
1410
+ ...['', `# ROUTES FOR HOST ${this.uriOrigin} `],
1332
1411
  ...troutes,
1333
1412
  ].join('\n');
1334
1413
  const fileName = (0, lib_9.crossPlatformPath)([
@@ -1457,7 +1536,7 @@ class EndpointContext {
1457
1536
  next();
1458
1537
  };
1459
1538
  //#endregion
1460
- const url = this.uri;
1539
+ // const url = this.uri;
1461
1540
  //#region get result
1462
1541
  const getResult = async (resolvedParams, req, res) => {
1463
1542
  const response = methodConfig.descriptor.value.apply(
@@ -1473,22 +1552,19 @@ class EndpointContext {
1473
1552
  return result;
1474
1553
  };
1475
1554
  //#endregion
1476
- url.pathname = url.pathname.replace(/\/$/, '');
1477
- expressPath = url.pathname.startsWith('/')
1478
- ? `${url.pathname}${expressPath}`
1479
- : expressPath;
1480
- expressPath = expressPath.replace(/\/\//g, '/');
1481
- // console.log(`BACKEND: expressPath: ${ expressPath } `)
1555
+ // console.log(`BACKEND: expressPath: "${expressPath}" `);
1482
1556
  //#endregion
1483
1557
  if (lib_10.Helpers.isElectron) {
1484
1558
  //#region @backend
1485
1559
  const ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
1486
1560
  electron_1.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
1487
1561
  const responseJsonData = await getResult(paramsFromBrowser, void 0, void 0);
1488
- event.sender.send(taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), responseJsonData);
1562
+ const sendToIpsMainOn = taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath);
1563
+ // console.log({ sendToIpsMainOn });
1564
+ event.sender.send(sendToIpsMainOn, responseJsonData);
1489
1565
  });
1490
1566
  return {
1491
- routePath: expressPath,
1567
+ expressPath,
1492
1568
  method: methodConfig.type,
1493
1569
  };
1494
1570
  //#endregion
@@ -1679,7 +1755,7 @@ class EndpointContext {
1679
1755
  //#endregion
1680
1756
  }
1681
1757
  return {
1682
- routePath: expressPath,
1758
+ expressPath: expressPath,
1683
1759
  method: methodConfig.type,
1684
1760
  };
1685
1761
  }
@@ -1906,37 +1982,37 @@ class EndpointContext {
1906
1982
  //#region resolve frontend parameters
1907
1983
  if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG])
1908
1984
  storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG] = {};
1909
- if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uri.href])
1910
- storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uri.href] = {};
1985
+ if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uriOrigin])
1986
+ storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uriOrigin] = {};
1911
1987
  const endpoints = storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG];
1912
1988
  let rest;
1913
- if (!endpoints[ctx.uri.href][expressPath]) {
1989
+ if (!endpoints[ctx.uriOrigin][expressPath]) {
1914
1990
  let headers = {};
1915
1991
  if (methodConfig.contentType && !methodConfig.responseType) {
1916
- rest = lib_3.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
1992
+ rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
1917
1993
  'Content-Type': methodConfig.contentType,
1918
1994
  Accept: methodConfig.contentType,
1919
1995
  }));
1920
1996
  }
1921
1997
  else if (methodConfig.contentType && methodConfig.responseType) {
1922
- rest = lib_3.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
1998
+ rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
1923
1999
  'Content-Type': methodConfig.contentType,
1924
2000
  Accept: methodConfig.contentType,
1925
2001
  responsetypeaxios: methodConfig.responseType,
1926
2002
  }));
1927
2003
  }
1928
2004
  else if (!methodConfig.contentType && methodConfig.responseType) {
1929
- rest = lib_3.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
2005
+ rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
1930
2006
  responsetypeaxios: methodConfig.responseType,
1931
2007
  }));
1932
2008
  }
1933
2009
  else {
1934
- rest = lib_3.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
2010
+ rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
1935
2011
  }
1936
- endpoints[ctx.uri.href][expressPath] = rest;
2012
+ endpoints[ctx.uriOrigin][expressPath] = rest;
1937
2013
  }
1938
2014
  else {
1939
- rest = endpoints[ctx.uri.href][expressPath];
2015
+ rest = endpoints[ctx.uriOrigin][expressPath];
1940
2016
  }
1941
2017
  const method = type.toLowerCase();
1942
2018
  const isWithBody = method === 'put' || method === 'post';