taon 19.0.45 → 19.0.47

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 (176) hide show
  1. package/browser/fesm2022/taon.mjs +113 -31
  2. package/browser/fesm2022/taon.mjs.map +1 -1
  3. package/browser/lib/context-db-migrations.d.ts +1 -1
  4. package/browser/lib/create-context.d.ts +9 -0
  5. package/browser/lib/endpoint-context.d.ts +4 -0
  6. package/browser/package.json +1 -1
  7. package/cli.js.map +1 -1
  8. package/index.js.map +1 -1
  9. package/lib/base-classes/base-abstract-entity.js.map +1 -1
  10. package/lib/base-classes/base-angular-service.js.map +1 -1
  11. package/lib/base-classes/base-class.js.map +1 -1
  12. package/lib/base-classes/base-context.js.map +1 -1
  13. package/lib/base-classes/base-controller.js.map +1 -1
  14. package/lib/base-classes/base-crud-controller.js.map +1 -1
  15. package/lib/base-classes/base-custom-repository.js.map +1 -1
  16. package/lib/base-classes/base-entity.js.map +1 -1
  17. package/lib/base-classes/base-injector.js.map +1 -1
  18. package/lib/base-classes/base-migration.js.map +1 -1
  19. package/lib/base-classes/base-provider.js.map +1 -1
  20. package/lib/base-classes/base-repository.js.map +1 -1
  21. package/lib/base-classes/base-subscriber-for-entity.js.map +1 -1
  22. package/lib/base-classes/base.js.map +1 -1
  23. package/lib/build-info._auto-generated_.d.ts +1 -1
  24. package/lib/build-info._auto-generated_.js +1 -1
  25. package/lib/build-info._auto-generated_.js.map +1 -1
  26. package/lib/constants.js.map +1 -1
  27. package/lib/context-db-migrations.js.map +1 -1
  28. package/lib/create-context.d.ts +9 -0
  29. package/lib/create-context.js +10 -2
  30. package/lib/create-context.js.map +1 -1
  31. package/lib/decorators/classes/controller-decorator.js.map +1 -1
  32. package/lib/decorators/classes/entity-decorator.js.map +1 -1
  33. package/lib/decorators/classes/migration-decorator.js.map +1 -1
  34. package/lib/decorators/classes/provider-decorator.js.map +1 -1
  35. package/lib/decorators/classes/repository-decorator.js.map +1 -1
  36. package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
  37. package/lib/decorators/http/http-decorators.js.map +1 -1
  38. package/lib/decorators/http/http-methods-decorators.js.map +1 -1
  39. package/lib/decorators/http/http-params-decorators.js.map +1 -1
  40. package/lib/dependency-injection/di-container.js.map +1 -1
  41. package/lib/endpoint-context.d.ts +4 -0
  42. package/lib/endpoint-context.js +205 -121
  43. package/lib/endpoint-context.js.map +1 -1
  44. package/lib/entity-process.js.map +1 -1
  45. package/lib/env/env.angular-node-app.d.ts +6 -0
  46. package/lib/env/env.angular-node-app.js +8 -2
  47. package/lib/env/env.angular-node-app.js.map +1 -1
  48. package/lib/env/env.docs-webapp.d.ts +6 -0
  49. package/lib/env/env.docs-webapp.js +8 -2
  50. package/lib/env/env.docs-webapp.js.map +1 -1
  51. package/lib/env/env.electron-app.d.ts +6 -0
  52. package/lib/env/env.electron-app.js +8 -2
  53. package/lib/env/env.electron-app.js.map +1 -1
  54. package/lib/env/env.mobile-app.d.ts +6 -0
  55. package/lib/env/env.mobile-app.js +8 -2
  56. package/lib/env/env.mobile-app.js.map +1 -1
  57. package/lib/env/env.npm-lib-and-cli-tool.d.ts +6 -0
  58. package/lib/env/env.npm-lib-and-cli-tool.js +8 -2
  59. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  60. package/lib/env/env.vscode-plugin.d.ts +6 -0
  61. package/lib/env/env.vscode-plugin.js +8 -2
  62. package/lib/env/env.vscode-plugin.js.map +1 -1
  63. package/lib/env/index.js.map +1 -1
  64. package/lib/formly/formly-group-wrapper-component.js.map +1 -1
  65. package/lib/formly/formly-repeat-component.js.map +1 -1
  66. package/lib/formly/formly.models.js.map +1 -1
  67. package/lib/formly/fromly.js.map +1 -1
  68. package/lib/formly/type-from-entity.js.map +1 -1
  69. package/lib/get-response-value.js.map +1 -1
  70. package/lib/helpers/class-helpers.js.map +1 -1
  71. package/lib/helpers/taon-helpers.js.map +1 -1
  72. package/lib/index._auto-generated_.js.map +1 -1
  73. package/lib/index.js.map +1 -1
  74. package/lib/inject.js.map +1 -1
  75. package/lib/models.js.map +1 -1
  76. package/lib/orm.js.map +1 -1
  77. package/lib/realtime/realtime-client.js.map +1 -1
  78. package/lib/realtime/realtime-core.js.map +1 -1
  79. package/lib/realtime/realtime-server.js.map +1 -1
  80. package/lib/realtime/realtime-strategy/index.js.map +1 -1
  81. package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
  82. package/lib/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
  83. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -1
  84. package/lib/realtime/realtime-strategy/realtime-strategy.js.map +1 -1
  85. package/lib/realtime/realtime-subs-manager.js.map +1 -1
  86. package/lib/realtime/realtime.models.js.map +1 -1
  87. package/lib/symbols.js.map +1 -1
  88. package/lib/ui/index.js +2 -2
  89. package/lib/ui/index.js.map +1 -1
  90. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  91. package/lib/ui/taon-admin-mode-configuration/index.js.map +1 -1
  92. package/lib/validators.js.map +1 -1
  93. package/migrations/index.js.map +1 -1
  94. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  95. package/old-app .js.map +1 -1
  96. package/package.json +1 -1
  97. package/playground.js.map +1 -1
  98. package/websql/fesm2022/taon.mjs +135 -62
  99. package/websql/fesm2022/taon.mjs.map +1 -1
  100. package/websql/lib/create-context.d.ts +9 -0
  101. package/websql/lib/endpoint-context.d.ts +4 -0
  102. package/websql/package.json +1 -1
  103. package/browser/lib/env.d.ts +0 -3
  104. package/env.d.ts +0 -3
  105. package/environments/angular-node-app/env.angular-node-app.__.d.ts +0 -3
  106. package/environments/angular-node-app/env.angular-node-app.dev.d.ts +0 -3
  107. package/environments/angular-node-app/env.angular-node-app.localhost.d.ts +0 -3
  108. package/environments/angular-node-app/env.angular-node-app.prod.d.ts +0 -3
  109. package/environments/angular-node-app/env.angular-node-app.stage.d.ts +0 -3
  110. package/environments/docs-webapp/env.docs-webapp.__.d.ts +0 -3
  111. package/environments/electron-app/env.electron-app.__.d.ts +0 -3
  112. package/environments/electron-app/env.electron-app.prod.d.ts +0 -3
  113. package/environments/mobile-app/env.mobile-app.__.d.ts +0 -3
  114. package/environments/mobile-app/env.mobile-app.prod.d.ts +0 -3
  115. package/environments/npm-lib-and-cli-tool/env.npm-lib-and-cli-tool.__.d.ts +0 -3
  116. package/environments/npm-lib-and-cli-tool/env.npm-lib-and-cli-tool.prod.d.ts +0 -3
  117. package/environments/vscode-plugin/env.vscode-plugin.__.d.ts +0 -6
  118. package/environments/vscode-plugin/env.vscode-plugin.prod.d.ts +0 -4
  119. package/lib/env.d.ts +0 -2
  120. package/lib/env.js +0 -7
  121. package/lib/env.js.map +0 -1
  122. package/lib/storage.d.ts +0 -1
  123. package/lib/storage.js +0 -6
  124. package/lib/storage.js.map +0 -1
  125. package/lib/ui/directives/index.d.ts +0 -3
  126. package/lib/ui/directives/index.js +0 -5
  127. package/lib/ui/directives/index.js.map +0 -1
  128. package/lib/ui/directives/safe.pipe.d.ts +0 -7
  129. package/lib/ui/directives/taon-inject-html.directive.d.ts +0 -6
  130. package/lib/ui/directives/taon-long-press.directive.d.ts +0 -22
  131. package/lib/ui/directives/view-mode.d.ts +0 -5
  132. package/lib/ui/directives/view-mode.js +0 -10
  133. package/lib/ui/directives/view-mode.js.map +0 -1
  134. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +0 -43
  135. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.d.ts +0 -5
  136. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js +0 -3
  137. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +0 -1
  138. package/lib/ui/taon-full-material.module.d.ts +0 -5
  139. package/lib/ui/taon-github-fork-me-corner/index.d.ts +0 -2
  140. package/lib/ui/taon-github-fork-me-corner/index.js +0 -5
  141. package/lib/ui/taon-github-fork-me-corner/index.js.map +0 -1
  142. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +0 -3
  143. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +0 -2
  144. package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +0 -2
  145. package/lib/ui/taon-github-fork-me-ribbon/index.js +0 -5
  146. package/lib/ui/taon-github-fork-me-ribbon/index.js.map +0 -1
  147. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +0 -3
  148. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +0 -2
  149. package/lib/ui/taon-notifications/index.d.ts +0 -4
  150. package/lib/ui/taon-notifications/index.js +0 -24
  151. package/lib/ui/taon-notifications/index.js.map +0 -1
  152. package/lib/ui/taon-notifications/taon-notifications.component.d.ts +0 -9
  153. package/lib/ui/taon-notifications/taon-notifications.models.d.ts +0 -6
  154. package/lib/ui/taon-notifications/taon-notifications.models.js +0 -5
  155. package/lib/ui/taon-notifications/taon-notifications.models.js.map +0 -1
  156. package/lib/ui/taon-notifications/taon-notifications.module.d.ts +0 -2
  157. package/lib/ui/taon-notifications/taon-notifications.service.d.ts +0 -11
  158. package/lib/ui/taon-progress-bar/index.d.ts +0 -2
  159. package/lib/ui/taon-progress-bar/index.js +0 -5
  160. package/lib/ui/taon-progress-bar/index.js.map +0 -1
  161. package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +0 -13
  162. package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +0 -2
  163. package/lib/ui/taon-session-passcode/index.d.ts +0 -1
  164. package/lib/ui/taon-session-passcode/index.js +0 -5
  165. package/lib/ui/taon-session-passcode/index.js.map +0 -1
  166. package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +0 -35
  167. package/lib/ui/taon-table/index.d.ts +0 -2
  168. package/lib/ui/taon-table/index.js +0 -5
  169. package/lib/ui/taon-table/index.js.map +0 -1
  170. package/lib/ui/taon-table/taon-table.component.d.ts +0 -34
  171. package/lib/ui/taon-table/taon-table.module.d.ts +0 -2
  172. package/lib/ui/taon.models.d.ts +0 -11
  173. package/lib/ui/taon.models.js +0 -3
  174. package/lib/ui/taon.models.js.map +0 -1
  175. package/tmp-environment.json +0 -32
  176. package/websql/lib/env.d.ts +0 -3
@@ -12,21 +12,21 @@ const express = require("express"); // @backend
12
12
  const fileUpload = require("express-fileupload"); // @backend
13
13
  const expressSession = require("express-session"); // @backend
14
14
  const lib_1 = require("json10/lib");
15
+ const lib_2 = require("lodash-walk-object/lib");
15
16
  const methodOverride = require("method-override"); // @backend
16
- const lib_2 = require("ng2-rest/lib");
17
+ const lib_3 = require("ng2-rest/lib");
17
18
  const rxjs_1 = require("rxjs");
18
- const lib_3 = require("taon-typeorm/lib"); // @websql
19
19
  const lib_4 = require("taon-typeorm/lib"); // @websql
20
- const lib_5 = require("taon-typeorm/lib");
21
- const lib_6 = require("tnp-core/lib"); // @backend
22
- const lib_7 = require("tnp-core/lib");
20
+ const lib_5 = require("taon-typeorm/lib"); // @websql
21
+ const lib_6 = require("taon-typeorm/lib");
22
+ const lib_7 = require("tnp-core/lib"); // @backend
23
23
  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
+ const lib_11 = require("tnp-core/lib");
26
27
  const context_db_migrations_1 = require("./context-db-migrations");
27
28
  const di_container_1 = require("./dependency-injection/di-container");
28
29
  const entity_process_1 = require("./entity-process");
29
- const env_1 = require("./env");
30
30
  const get_response_value_1 = require("./get-response-value");
31
31
  const class_helpers_1 = require("./helpers/class-helpers");
32
32
  const taon_helpers_1 = require("./helpers/taon-helpers");
@@ -39,6 +39,10 @@ class EndpointContext {
39
39
  originalConfig;
40
40
  configFn;
41
41
  //#region static
42
+ /**
43
+ * JUST FOR TESTING PURPOSES
44
+ */
45
+ USE_MARIADB_MYSQL_IN_DOCKER = false;
42
46
  /* */
43
47
  /* */
44
48
  /* */
@@ -147,31 +151,31 @@ class EndpointContext {
147
151
  //#endregion
148
152
  //#region fields / logs
149
153
  get logHttp() {
150
- if (lib_9._.isObject(this.config?.logs)) {
154
+ if (lib_10._.isObject(this.config?.logs)) {
151
155
  return !!this.config.logs.http;
152
156
  }
153
157
  return this.config?.logs === true;
154
158
  }
155
159
  get logRealtime() {
156
- if (lib_9._.isObject(this.config?.logs)) {
160
+ if (lib_10._.isObject(this.config?.logs)) {
157
161
  return !!this.config.logs.realtime;
158
162
  }
159
163
  return this.config?.logs === true;
160
164
  }
161
165
  get logFramework() {
162
- if (lib_9._.isObject(this.config?.logs)) {
166
+ if (lib_10._.isObject(this.config?.logs)) {
163
167
  return !!this.config.logs.framework;
164
168
  }
165
169
  return this.config?.logs === true;
166
170
  }
167
171
  get logDb() {
168
- if (lib_9._.isObject(this.config?.logs)) {
172
+ if (lib_10._.isObject(this.config?.logs)) {
169
173
  return !!this.config.logs.db;
170
174
  }
171
175
  return this.config?.logs === true;
172
176
  }
173
177
  get logMigrations() {
174
- if (lib_9._.isObject(this.config?.logs)) {
178
+ if (lib_10._.isObject(this.config?.logs)) {
175
179
  return !!this.config.logs.migrations;
176
180
  }
177
181
  return this.config?.logs === true;
@@ -192,17 +196,17 @@ class EndpointContext {
192
196
  this.onlyMigrationRun = onlyMigrationRun;
193
197
  // @ts-ignore
194
198
  this.onlyMigrationRevertToTimestamp = onlyMigrationRevertToTimestamp;
195
- this.config = this.configFn(env_1.ENV);
196
- if (lib_9._.isObject(this.config.database)) {
199
+ this.config = this.configFn({});
200
+ if (lib_10._.isObject(this.config.database)) {
197
201
  this.config.database = models_1.Models.DatabaseConfig.from(this.config.database).databaseConfigTypeORM;
198
202
  }
199
203
  if (overrideHost && overrideRemoteHost) {
200
- lib_9.Helpers.throw(`[taon-config] You can't have overrideHost and overrideRemoteHost at the same time`);
204
+ lib_10.Helpers.throw(`[taon-config] You can't have overrideHost and overrideRemoteHost at the same time`);
201
205
  }
202
- this.config.host = !lib_9._.isUndefined(overrideHost)
206
+ this.config.host = !lib_10._.isUndefined(overrideHost)
203
207
  ? overrideHost
204
208
  : this.config.host;
205
- this.config.remoteHost = !lib_9._.isUndefined(overrideRemoteHost)
209
+ this.config.remoteHost = !lib_10._.isUndefined(overrideRemoteHost)
206
210
  ? overrideRemoteHost
207
211
  : this.config.remoteHost;
208
212
  this.config.host = this.host === null ? void 0 : this.host;
@@ -211,19 +215,19 @@ class EndpointContext {
211
215
  if (this.config.host &&
212
216
  !this.config.host.startsWith('http://') &&
213
217
  !this.config.host.startsWith('https://')) {
214
- lib_9.Helpers.throw(`[taon-config] Your 'host' must start with http:// or https://`);
218
+ lib_10.Helpers.throw(`[taon-config] Your 'host' must start with http:// or https://`);
215
219
  }
216
- if (lib_9._.isUndefined(this.config.useIpcWhenElectron)) {
220
+ if (lib_10._.isUndefined(this.config.useIpcWhenElectron)) {
217
221
  this.config.useIpcWhenElectron = true;
218
222
  }
219
223
  if (this.config.remoteHost &&
220
224
  !this.config.remoteHost.startsWith('http://') &&
221
225
  !this.config.remoteHost.startsWith('https://')) {
222
- lib_9.Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
226
+ lib_10.Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
223
227
  }
224
228
  //#region resolve if skipping writing server routes
225
229
  //@ts-expect-error overriding readonly
226
- this.skipWritingServerRoutes = lib_9._.isBoolean(this.config.skipWritingServerRoutes)
230
+ this.skipWritingServerRoutes = lib_10._.isBoolean(this.config.skipWritingServerRoutes)
227
231
  ? this.config.skipWritingServerRoutes
228
232
  : false;
229
233
  //#endregion
@@ -235,12 +239,12 @@ class EndpointContext {
235
239
  }
236
240
  if (this.config.remoteHost) {
237
241
  if (this.config.host) {
238
- lib_9.Helpers.throw(`[taon] You can't have remoteHost and host at the same time`);
242
+ lib_10.Helpers.throw(`[taon] You can't have remoteHost and host at the same time`);
239
243
  }
240
244
  this.mode = 'remote-backend(tcp+udp)';
241
245
  }
242
- if (this.config.useIpcWhenElectron && lib_9.Helpers.isElectron) {
243
- if (lib_9.Helpers.isWebSQL) {
246
+ if (this.config.useIpcWhenElectron && lib_10.Helpers.isElectron) {
247
+ if (lib_10.Helpers.isWebSQL) {
244
248
  this.mode = 'backend-frontend(websql-electron)';
245
249
  }
246
250
  else {
@@ -248,7 +252,7 @@ class EndpointContext {
248
252
  }
249
253
  }
250
254
  if (!this.mode && !this.config.abstract) {
251
- lib_9.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
255
+ lib_10.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
252
256
  //#region @backend
253
257
  process.exit(1);
254
258
  //#endregion
@@ -256,15 +260,39 @@ class EndpointContext {
256
260
  //#endregion
257
261
  //#region resolve database config
258
262
  if (this.config.database === true) {
263
+ this.logFramework &&
264
+ console.log(`
265
+
266
+ ASSIGNING AUTO GENERATED DATABASE CONFIG
267
+
268
+ `);
259
269
  this.databaseConfig = this.getAutoGeneratedConfig();
260
270
  }
261
- else if (lib_9._.isObject(this.config.database)) {
262
- this.databaseConfig = lib_9._.merge(this.getAutoGeneratedConfig(), lib_9._.cloneDeep(this.config.database));
271
+ else if (lib_10._.isObject(this.config.database)) {
272
+ this.logFramework &&
273
+ console.log(`
274
+
275
+ OVERRIDE DATABASE CONFIG FROM CONFIGURATION
276
+
277
+ `);
278
+ this.databaseConfig = this.getAutoGeneratedConfig();
279
+ lib_2.walk.Object(this.config.database, (value, lodashPath) => {
280
+ if (lib_10._.isNil(value) || lib_10._.isFunction(value) || lib_10._.isObject(value)) {
281
+ // skipping
282
+ }
283
+ else {
284
+ this.logFramework &&
285
+ console.info(`Overriding database config: ${lodashPath}=${value}`);
286
+ lib_10._.set(this.databaseConfig, lodashPath, value);
287
+ }
288
+ }, {
289
+ walkGetters: false,
290
+ });
263
291
  }
264
292
  //#endregion
265
293
  //#region resolve session
266
294
  if (this.config.session) {
267
- this.session = lib_9._.cloneDeep(this.config.session);
295
+ this.session = lib_10._.cloneDeep(this.config.session);
268
296
  const oneHour = 1000 * 60 * 60 * 1; // 24;
269
297
  if (!this.session.cookieMaxAge) {
270
298
  this.session.cookieMaxAge = oneHour;
@@ -356,11 +384,11 @@ class EndpointContext {
356
384
  this.expressApp = express();
357
385
  this.initMiddlewares();
358
386
  this.serverTcpUdp = this.isHttpServer
359
- ? new lib_6.https.Server({
387
+ ? new lib_7.https.Server({
360
388
  key: this.config.https?.key,
361
389
  cert: this.config.https?.cert,
362
390
  }, this.expressApp)
363
- : new lib_6.http.Server(this.expressApp);
391
+ : new lib_7.http.Server(this.expressApp);
364
392
  this.publicAssets.forEach(asset => {
365
393
  this.expressApp.use(asset.serverPath, express.static(asset.locationOnDisk));
366
394
  });
@@ -371,7 +399,7 @@ class EndpointContext {
371
399
  if (!this.config.abstract) {
372
400
  this.disabledRealtime = !!this.config.disabledRealtime;
373
401
  //#region @backend
374
- if (lib_9.Helpers.isRunningIn.cliMode()) {
402
+ if (lib_10.Helpers.isRunningIn.cliMode()) {
375
403
  // TODO for now...
376
404
  this.disabledRealtime = true;
377
405
  }
@@ -384,16 +412,16 @@ class EndpointContext {
384
412
  // console.log({ ref })
385
413
  if (this.config.abstract) {
386
414
  this.logFramework &&
387
- lib_9.Helpers.info(`[taon] Create abstract context: ${this.config.contextName}`);
415
+ lib_10.Helpers.info(`[taon] Create abstract context: ${this.config.contextName}`);
388
416
  }
389
417
  else {
390
418
  if (this.config.remoteHost) {
391
419
  this.logFramework &&
392
- lib_9.Helpers.info(`[taon] Create context for remote host: ${this.config.remoteHost}`);
420
+ lib_10.Helpers.info(`[taon] Create context for remote host: ${this.config.remoteHost}`);
393
421
  }
394
422
  else {
395
423
  this.logFramework &&
396
- lib_9.Helpers.info(`[taon] Create context for host: ${this.config.host}`);
424
+ lib_10.Helpers.info(`[taon] Create context for host: ${this.config.host}`);
397
425
  }
398
426
  }
399
427
  //#endregion
@@ -405,42 +433,87 @@ class EndpointContext {
405
433
  //#endregion
406
434
  //#region methods & getters / get auto generated config
407
435
  getAutoGeneratedConfig() {
436
+ this.logFramework &&
437
+ console.log(`
438
+
439
+
440
+ IS RUNNING IN DOCKER: ${lib_8.UtilsOs.isRunningInDocker()}
441
+
442
+ `);
408
443
  //#region @websqlFunc
409
444
  let databaseConfig = models_1.Models.DatabaseConfig.from({});
410
- if (lib_7.UtilsOs.isRunningInDocker()) {
411
- lib_9.Helpers.info('Running in docker, using in mysql database');
412
- // TODO auto resolve database config in docker
413
- databaseConfig = models_1.Models.DatabaseConfig.from({
414
- database: `db-${this.contextName}.sqlite`,
415
- type: 'mysql',
416
- recreateMode: 'PRESERVE_DATA+MIGRATIONS',
417
- logging: this.logDb,
418
- databasePort: 3306,
419
- databaseHost: 'localhost',
420
- databaseUsername: 'root',
421
- databasePassword: 'admin',
422
- });
445
+ if (lib_8.UtilsOs.isRunningInDocker()) {
446
+ if (this.USE_MARIADB_MYSQL_IN_DOCKER) {
447
+ // Helpers.info('Running in docker, using in mysql database');
448
+ // // TODO auto resolve database config in docker
449
+ // databaseConfig = Models.DatabaseConfig.from({
450
+ // database: `db-${this.contextName}.sqlite`,
451
+ // type: 'mysql',
452
+ // recreateMode: 'PRESERVE_DATA+MIGRATIONS',
453
+ // logging: this.logDb,
454
+ // databasePort: 3306,
455
+ // databaseHost: 'localhost',
456
+ // databaseUsername: 'root',
457
+ // databasePassword: 'admin',
458
+ // });
459
+ }
460
+ else {
461
+ // TOOD @LAST for now.. just use sqljs in docker
462
+ this.logFramework &&
463
+ console.log(`
464
+
465
+ USING GENERATED CONFIG FOR SQLJS IN DOCKER
466
+
467
+ `);
468
+ //#region @backend
469
+ const locationOfTheDatabase = (0, lib_9.crossPlatformPath)([
470
+ process.cwd(),
471
+ `db-${this.contextName}.sqlite`,
472
+ ]);
473
+ //#endregion
474
+ databaseConfig = databaseConfig = models_1.Models.DatabaseConfig.from({
475
+ location: `db-${this.contextName}.sqlite`,
476
+ type: 'sqljs',
477
+ useLocalForage: false,
478
+ recreateMode: 'PRESERVE_DATA+MIGRATIONS',
479
+ logging: true,
480
+ });
481
+ //#region @backend
482
+ if (!lib_7.fse.existsSync(locationOfTheDatabase)) {
483
+ databaseConfig.recreateMode = 'DROP_DB+MIGRATIONS';
484
+ }
485
+ // TODO @LAST add same thing for mariadb/mysql
486
+ this.logFramework &&
487
+ console.log(`
488
+ location of database: ${locationOfTheDatabase}
489
+ db file exists: ${lib_7.fse.existsSync(locationOfTheDatabase)}
490
+ synchronize: ${databaseConfig.synchronize}
491
+ dropSchema: ${databaseConfig.dropSchema}
492
+ `);
493
+ //#endregion
494
+ }
423
495
  }
424
496
  else {
497
+ //#region auto resolve db config
425
498
  this.logFramework &&
426
- lib_9.Helpers.info(`[taon][database] Automatically resolving database config for mode ${this.mode}`);
499
+ lib_10.Helpers.info(`[taon][database] Automatically resolving database config for mode ${this.mode}`);
427
500
  switch (this.mode) {
428
501
  //#region resolve database config for backend-frontend(ipc-electron)
429
502
  case 'backend-frontend(ipc-electron)':
430
503
  let dbLocationInOs;
431
504
  //#region @backend
432
- if (lib_7.UtilsOs.isElectron) {
433
- dbLocationInOs = (0, lib_8.crossPlatformPath)([
434
- lib_6.os.userInfo().homedir,
435
- `.taon/databases-for-electron-apps/${this.appId || lib_9._.snakeCase(process.cwd()).replace(/\_/, '.')}/${this.contextName}.sqlite`,
505
+ if (lib_8.UtilsOs.isElectron) {
506
+ dbLocationInOs = (0, lib_9.crossPlatformPath)([
507
+ lib_7.os.userInfo().homedir,
508
+ `.taon/databases-for-electron-apps/${this.appId || lib_10._.snakeCase(process.cwd()).replace(/\_/, '.')}/${this.contextName}.sqlite`,
436
509
  ]);
437
- if (!lib_9.Helpers.exists(lib_10.path.dirname(dbLocationInOs))) {
438
- lib_9.Helpers.mkdirp(lib_10.path.dirname(dbLocationInOs));
510
+ if (!lib_10.Helpers.exists(lib_11.path.dirname(dbLocationInOs))) {
511
+ lib_10.Helpers.mkdirp(lib_11.path.dirname(dbLocationInOs));
439
512
  }
440
513
  }
441
514
  //#endregion
442
515
  databaseConfig = models_1.Models.DatabaseConfig.from({
443
- location: lib_7.UtilsOs.isElectron
516
+ location: lib_8.UtilsOs.isElectron
444
517
  ? dbLocationInOs
445
518
  : `db-${this.contextName}.sqlite`,
446
519
  type: 'sqljs',
@@ -479,6 +552,7 @@ class EndpointContext {
479
552
  break;
480
553
  //#endregion
481
554
  }
555
+ //#endregion
482
556
  }
483
557
  return databaseConfig.databaseConfigTypeORM;
484
558
  //#endregion
@@ -500,8 +574,9 @@ class EndpointContext {
500
574
  if (this.mode === 'backend-frontend(tcp+udp)') {
501
575
  return await new Promise(resolve => {
502
576
  // this.displayRoutes(this.expressApp);
503
- this.serverTcpUdp.listen(Number(this.uri.port), () => {
504
- lib_9.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
577
+ this.serverTcpUdp.listen(Number(this.uri.port), '0.0.0.0', () => {
578
+ lib_10.Helpers.log(`Express server started 0.0.0.0:${this.uri.port}`);
579
+ lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uri.port}, hostname: ${this.uri.pathname},
505
580
  address: ${this.uri.protocol}//localhost:${this.uri.port}${this.uri.pathname}
506
581
  env: ${this.expressApp.settings.env}
507
582
  `);
@@ -511,7 +586,7 @@ class EndpointContext {
511
586
  }
512
587
  else {
513
588
  this.logFramework &&
514
- lib_9.Helpers.info('Ipc communication enable instead tcp/upd');
589
+ lib_10.Helpers.info('Ipc communication enable instead tcp/upd');
515
590
  }
516
591
  //#endregion
517
592
  }
@@ -619,7 +694,7 @@ class EndpointContext {
619
694
  for (const key of Object.keys(classesInput || {})) {
620
695
  const BaseClass = classesInput[key];
621
696
  if (!BaseClass) {
622
- lib_9.Helpers.error(`Class ${key} is not defined in context ${ctx.contextName}
697
+ lib_10.Helpers.error(`Class ${key} is not defined in context ${ctx.contextName}
623
698
 
624
699
  Please check if you have correct import in context file
625
700
 
@@ -698,7 +773,7 @@ class EndpointContext {
698
773
  let entityName = '';
699
774
  // entity thing is only for repositories local repositories
700
775
  // if (className === 'BaseRepository') {
701
- const entityFn = lib_9._.first(locaInstanceConstructorArgs);
776
+ const entityFn = lib_10._.first(locaInstanceConstructorArgs);
702
777
  const entity = entityFn && entityFn();
703
778
  entityName = (entity && class_helpers_1.ClassHelpers.getName(entity)) || '';
704
779
  // console.log(`entityName `, entityName);
@@ -761,7 +836,7 @@ class EndpointContext {
761
836
  //#endregion
762
837
  //#region methods & getters / check if context initialized
763
838
  checkIfContextInitialized() {
764
- if (lib_9._.isUndefined(this.config)) {
839
+ if (lib_10._.isUndefined(this.config)) {
765
840
  throw new Error(`Please check if your context has been initialized.
766
841
 
767
842
  // ...
@@ -847,7 +922,7 @@ class EndpointContext {
847
922
  const controllers = this.getClassesInstancesArrBy(models_1.Models.ClassType.CONTROLLER);
848
923
  // console.log('CONTROLLERS TO REINIT', controllers);
849
924
  for (const ctrl of controllers) {
850
- if (lib_9._.isFunction(ctrl.initExampleDbData)) {
925
+ if (lib_10._.isFunction(ctrl.initExampleDbData)) {
851
926
  await ctrl.initExampleDbData();
852
927
  }
853
928
  }
@@ -874,7 +949,7 @@ class EndpointContext {
874
949
  ]) {
875
950
  //#region init class static _ property
876
951
  for (const classFun of this.getClassFunByArr(classTypeName)) {
877
- if (lib_9._.isFunction(classFun._)) {
952
+ if (lib_10._.isFunction(classFun._)) {
878
953
  await classFun._();
879
954
  }
880
955
  }
@@ -891,7 +966,7 @@ class EndpointContext {
891
966
  // `[taon] REINITING _ INS FN ${classTypeName} ${this.contextName} STARTED`,
892
967
  // );
893
968
  for (const ctrl of this.getClassesInstancesArrBy(classTypeName)) {
894
- if (lib_9._.isFunction(ctrl._)) {
969
+ if (lib_10._.isFunction(ctrl._)) {
895
970
  await ctrl._();
896
971
  }
897
972
  }
@@ -977,7 +1052,7 @@ class EndpointContext {
977
1052
  const options = Reflect.getMetadata(symbols_1.Symbols.metadata.options.subscriber, subscriberClassFn);
978
1053
  // console.log('subscriber options', options);
979
1054
  // const nameForSubscriber = ClassHelpers.getName(subscriber);
980
- (0, lib_3.EventSubscriber)()(subscriberClassFn);
1055
+ (0, lib_4.EventSubscriber)()(subscriberClassFn);
981
1056
  }
982
1057
  //#endregion
983
1058
  }
@@ -991,7 +1066,7 @@ class EndpointContext {
991
1066
  const entities = this.getClassFunByArr(models_1.Models.ClassType.ENTITY);
992
1067
  for (const entity of entities) {
993
1068
  const options = Reflect.getMetadata(symbols_1.Symbols.metadata.options.entity, entity);
994
- const createTable = lib_9._.isUndefined(options.createTable)
1069
+ const createTable = lib_10._.isUndefined(options.createTable)
995
1070
  ? true
996
1071
  : options.createTable;
997
1072
  const nameForEntity = class_helpers_1.ClassHelpers.getName(entity);
@@ -999,7 +1074,7 @@ class EndpointContext {
999
1074
  this.logDb &&
1000
1075
  console.info(`[taon][typeorm] create table for entity "${nameForEntity}" ? '${createTable}'`);
1001
1076
  // console.log('TypeormEntity', { TypeormEntity });
1002
- (0, lib_4.Entity)(nameForEntity)(entity);
1077
+ (0, lib_5.Entity)(nameForEntity)(entity);
1003
1078
  }
1004
1079
  else {
1005
1080
  this.logDb &&
@@ -1038,7 +1113,19 @@ class EndpointContext {
1038
1113
  return class_helpers_1.ClassHelpers.getOrginalClass(entityFn);
1039
1114
  });
1040
1115
  const subscribers = this.getClassFunByArr(models_1.Models.ClassType.SUBSCRIBER);
1041
- const dataSourceDbConfig = lib_9._.isObject(this.databaseConfig)
1116
+ let autoSave = false;
1117
+ if (!lib_10._.isNil(this.databaseConfig.autoSave)) {
1118
+ autoSave = this.databaseConfig.autoSave;
1119
+ }
1120
+ else {
1121
+ if (this.USE_MARIADB_MYSQL_IN_DOCKER) {
1122
+ autoSave = !lib_8.UtilsOs.isRunningInDocker(); // in docker I am using mysql or posgress
1123
+ }
1124
+ else {
1125
+ autoSave = true; // on docker with sqljs I need to save db
1126
+ }
1127
+ }
1128
+ const dataSourceDbConfig = lib_10._.isObject(this.databaseConfig)
1042
1129
  ? {
1043
1130
  type: this.databaseConfig.type,
1044
1131
  port: this.databaseConfig.databasePort,
@@ -1053,9 +1140,7 @@ class EndpointContext {
1053
1140
  synchronize: this.isRunOrRevertOnlyMigrationAppStart
1054
1141
  ? false
1055
1142
  : this.databaseConfig.synchronize,
1056
- autoSave: !lib_9._.isNil(this.databaseConfig.autoSave)
1057
- ? this.databaseConfig.autoSave
1058
- : !lib_7.UtilsOs.isRunningInDocker(), // in docker I am using mysql or posgress
1143
+ autoSave,
1059
1144
  dropSchema: this.isRunOrRevertOnlyMigrationAppStart
1060
1145
  ? false
1061
1146
  : this.databaseConfig.dropSchema,
@@ -1069,14 +1154,17 @@ class EndpointContext {
1069
1154
  if (this.modeAllowsDatabaseCreation && this.databaseConfig) {
1070
1155
  this.logDb &&
1071
1156
  this.logFramework &&
1072
- lib_9.Helpers.info('[taon][database] prepare typeorm connection...');
1157
+ lib_10.Helpers.info('[taon][database] prepare typeorm connection...');
1073
1158
  try {
1074
- const connection = new lib_5.DataSource(dataSourceDbConfig);
1159
+ const connection = new lib_6.DataSource(dataSourceDbConfig);
1075
1160
  this.connection = connection;
1076
1161
  await this.connection.initialize();
1077
1162
  }
1078
1163
  catch (error) {
1164
+ console.error(`[taon][typeorm] Error while initializing connection for ${this.contextName}, ERROR STARTED `);
1165
+ console.error(error?.stack || '< No stack trace > ');
1079
1166
  console.error(error?.message || error);
1167
+ console.error(`[taon][typeorm] Error while initializing connection for ${this.contextName}, ERROR ENDS `);
1080
1168
  }
1081
1169
  if (!this.connection?.isInitialized) {
1082
1170
  console.log('WRONG CONFIG', dataSourceDbConfig);
@@ -1106,7 +1194,7 @@ class EndpointContext {
1106
1194
  // debugger;
1107
1195
  }
1108
1196
  else {
1109
- lib_9.Helpers.info(`[taon][typeorm] Not initing db for mode ${this.mode}`);
1197
+ lib_10.Helpers.info(`[taon][typeorm] Not initing db for mode ${this.mode}`);
1110
1198
  }
1111
1199
  //#endregion
1112
1200
  }
@@ -1124,7 +1212,7 @@ class EndpointContext {
1124
1212
  const configs = class_helpers_1.ClassHelpers.getControllerConfigs(controllerClassFn);
1125
1213
  // console.log(`Class config for ${ClassHelpers.getName(controllerClassFn)}`, configs)
1126
1214
  const classConfig = configs[0];
1127
- const parentscalculatedPath = lib_9._.slice(configs, 1)
1215
+ const parentscalculatedPath = lib_10._.slice(configs, 1)
1128
1216
  .reverse()
1129
1217
  .map(bc => {
1130
1218
  if (taon_helpers_1.TaonHelpers.isGoodPath(bc.path)) {
@@ -1142,13 +1230,13 @@ class EndpointContext {
1142
1230
  .replace(/\/\//g, '/')
1143
1231
  .split('/')
1144
1232
  .reduce((acc, bc) => {
1145
- return lib_9._.last(acc) === bc ? acc : [...acc, bc];
1233
+ return lib_10._.last(acc) === bc ? acc : [...acc, bc];
1146
1234
  }, [])
1147
1235
  .join('/');
1148
1236
  }
1149
- lib_9._.slice(configs, 1).forEach(bc => {
1237
+ lib_10._.slice(configs, 1).forEach(bc => {
1150
1238
  const alreadyIs = classConfig.methods;
1151
- const toMerge = lib_9._.cloneDeep(bc.methods);
1239
+ const toMerge = lib_10._.cloneDeep(bc.methods);
1152
1240
  for (const key in toMerge) {
1153
1241
  if (toMerge.hasOwnProperty(key) && !alreadyIs[key]) {
1154
1242
  const element = toMerge[key];
@@ -1157,7 +1245,7 @@ class EndpointContext {
1157
1245
  }
1158
1246
  });
1159
1247
  //#region @backend
1160
- if (!lib_9.Helpers.isRunningIn.cliMode()) {
1248
+ if (!lib_10.Helpers.isRunningIn.cliMode()) {
1161
1249
  //#endregion
1162
1250
  this.logHttp &&
1163
1251
  console.groupCollapsed(`[taon][express-server] routes [${classConfig.className}]`);
@@ -1174,7 +1262,7 @@ class EndpointContext {
1174
1262
  ? `/${methodConfig.path?.replace(/\//, '')}`
1175
1263
  : taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
1176
1264
  // console.log({ expressPath })
1177
- if (lib_9.Helpers.isNode || lib_9.Helpers.isWebSQL) {
1265
+ if (lib_10.Helpers.isNode || lib_10.Helpers.isWebSQL) {
1178
1266
  //#region @websql
1179
1267
  const { routePath, method } = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
1180
1268
  this.activeRoutes.push({
@@ -1183,7 +1271,7 @@ class EndpointContext {
1183
1271
  });
1184
1272
  //#endregion
1185
1273
  }
1186
- const shouldInitClient = lib_9.Helpers.isBrowser || this.remoteHost || lib_9.Helpers.isWebSQL;
1274
+ const shouldInitClient = lib_10.Helpers.isBrowser || this.remoteHost || lib_10.Helpers.isWebSQL;
1187
1275
  // console.log('shouldInitClient', shouldInitClient);
1188
1276
  if (shouldInitClient) {
1189
1277
  // console.log(
@@ -1197,7 +1285,7 @@ class EndpointContext {
1197
1285
  }
1198
1286
  }
1199
1287
  //#region @backend
1200
- if (!lib_9.Helpers.isRunningIn.cliMode()) {
1288
+ if (!lib_10.Helpers.isRunningIn.cliMode()) {
1201
1289
  //#endregion
1202
1290
  this.logHttp && console.groupEnd();
1203
1291
  //#region @backend
@@ -1215,11 +1303,11 @@ class EndpointContext {
1215
1303
  }
1216
1304
  const contexts = [this];
1217
1305
  //#region @websql
1218
- const troutes = lib_7.Utils.uniqArray(this.activeRoutes.map(f => {
1306
+ const troutes = lib_8.Utils.uniqArray(this.activeRoutes.map(f => {
1219
1307
  return `${f.method} ${f.routePath}`;
1220
1308
  })).map(f => {
1221
1309
  const [method, routePath] = f.split(' ');
1222
- return (`\n### ${lib_9._.startCase(lib_9._.last(routePath.split('/')))}\n` +
1310
+ return (`\n### ${lib_10._.startCase(lib_10._.last(routePath.split('/')))}\n` +
1223
1311
  taon_helpers_1.TaonHelpers.fillUpTo(method.toUpperCase() + ' ', 10) +
1224
1312
  this.uri.href.replace(/\/$/, '') +
1225
1313
  routePath);
@@ -1230,7 +1318,7 @@ class EndpointContext {
1230
1318
  ...['', `# ROUTES FOR HOST ${this.uri.href} `],
1231
1319
  ...troutes,
1232
1320
  ].join('\n');
1233
- const fileName = (0, lib_8.crossPlatformPath)([
1321
+ const fileName = (0, lib_9.crossPlatformPath)([
1234
1322
  //#region @backend
1235
1323
  process.cwd(),
1236
1324
  //#endregion
@@ -1239,8 +1327,8 @@ class EndpointContext {
1239
1327
  this.logFramework && console.log(`[taon] routes file: ${fileName} `);
1240
1328
  // Helpers.log(JSON.stringify(routes, null, 4))
1241
1329
  //#region @backend
1242
- if (!lib_7.UtilsOs.isElectron) {
1243
- lib_9.Helpers.writeFile(fileName, routes);
1330
+ if (!lib_8.UtilsOs.isElectron) {
1331
+ lib_10.Helpers.writeFile(fileName, routes);
1244
1332
  }
1245
1333
  //#endregion
1246
1334
  //#endregion
@@ -1272,7 +1360,7 @@ class EndpointContext {
1272
1360
  app.use(methodOverride());
1273
1361
  app.use(cookieParser());
1274
1362
  if (this.session) {
1275
- lib_9.Helpers.info('[taon][express-server] session enabled for this context ' +
1363
+ lib_10.Helpers.info('[taon][express-server] session enabled for this context ' +
1276
1364
  this.contextName);
1277
1365
  const { cookieMaxAge } = this.session;
1278
1366
  const frontendHost = this.config.frontendHost;
@@ -1298,7 +1386,7 @@ class EndpointContext {
1298
1386
  else {
1299
1387
  // if(this.config?.serverLogs) {
1300
1388
  this.logHttp &&
1301
- lib_9.Helpers.info(`[taon][express-server] session not enabled for this context '${this.contextName}'`);
1389
+ lib_10.Helpers.info(`[taon][express-server] session not enabled for this context '${this.contextName}'`);
1302
1390
  // }
1303
1391
  app.use(cors({
1304
1392
  // origin: "http://localhost:5555",
@@ -1379,7 +1467,7 @@ class EndpointContext {
1379
1467
  expressPath = expressPath.replace(/\/\//g, '/');
1380
1468
  // console.log(`BACKEND: expressPath: ${ expressPath } `)
1381
1469
  //#endregion
1382
- if (lib_9.Helpers.isElectron) {
1470
+ if (lib_10.Helpers.isElectron) {
1383
1471
  //#region @backend
1384
1472
  const ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
1385
1473
  electron_1.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
@@ -1395,7 +1483,7 @@ class EndpointContext {
1395
1483
  if (!this.remoteHost) {
1396
1484
  //#region apply dummy websql express routers
1397
1485
  //#region @websql
1398
- if (lib_9.Helpers.isWebSQL) {
1486
+ if (lib_10.Helpers.isWebSQL) {
1399
1487
  if (!this.expressApp[type.toLowerCase()]) {
1400
1488
  this.expressApp[type.toLowerCase()] = () => { };
1401
1489
  }
@@ -1428,7 +1516,7 @@ class EndpointContext {
1428
1516
  if (req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS]) {
1429
1517
  try {
1430
1518
  const entity = JSON.parse(req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS]);
1431
- tBody = lib_2.Mapping.encode(tBody, entity);
1519
+ tBody = lib_3.Mapping.encode(tBody, entity);
1432
1520
  }
1433
1521
  catch (e) { }
1434
1522
  }
@@ -1436,7 +1524,7 @@ class EndpointContext {
1436
1524
  Object.keys(tBody).forEach(paramName => {
1437
1525
  try {
1438
1526
  const entityForParam = JSON.parse(req.headers[`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${paramName} `]);
1439
- tBody[paramName] = lib_2.Mapping.encode(tBody[paramName], entityForParam);
1527
+ tBody[paramName] = lib_3.Mapping.encode(tBody[paramName], entityForParam);
1440
1528
  }
1441
1529
  catch (e) { }
1442
1530
  });
@@ -1446,7 +1534,7 @@ class EndpointContext {
1446
1534
  if (req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]) {
1447
1535
  try {
1448
1536
  const entity = JSON.parse(req.headers[symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]);
1449
- tQuery = taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(lib_2.Mapping.encode(tQuery, entity));
1537
+ tQuery = taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(lib_3.Mapping.encode(tQuery, entity));
1450
1538
  }
1451
1539
  catch (e) { }
1452
1540
  }
@@ -1455,14 +1543,14 @@ class EndpointContext {
1455
1543
  try {
1456
1544
  const entityForParam = JSON.parse(req.headers[`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${queryParamName} `]);
1457
1545
  let beforeTransofrm = tQuery[queryParamName];
1458
- if (lib_9._.isString(beforeTransofrm)) {
1546
+ if (lib_10._.isString(beforeTransofrm)) {
1459
1547
  try {
1460
1548
  const paresed = taon_helpers_1.TaonHelpers.tryTransformParam(beforeTransofrm);
1461
1549
  beforeTransofrm = paresed;
1462
1550
  }
1463
1551
  catch (e) { }
1464
1552
  }
1465
- const afterEncoding = lib_2.Mapping.encode(beforeTransofrm, entityForParam);
1553
+ const afterEncoding = lib_3.Mapping.encode(beforeTransofrm, entityForParam);
1466
1554
  tQuery[queryParamName] =
1467
1555
  taon_helpers_1.TaonHelpers.parseJSONwithStringJSONs(afterEncoding);
1468
1556
  }
@@ -1517,7 +1605,7 @@ class EndpointContext {
1517
1605
  res.end(file);
1518
1606
  //#endregion
1519
1607
  }
1520
- else if (lib_9._.isString(result) &&
1608
+ else if (lib_10._.isString(result) &&
1521
1609
  methodConfig.responseType ===
1522
1610
  'blob') {
1523
1611
  // console.log('BASE64')
@@ -1544,7 +1632,7 @@ class EndpointContext {
1544
1632
  }
1545
1633
  catch (error) {
1546
1634
  //#region process error
1547
- if (lib_9._.isString(error)) {
1635
+ if (lib_10._.isString(error)) {
1548
1636
  res.status(400).send(lib_1.JSON10.stringify({
1549
1637
  message: `
1550
1638
  Error inside: ${req.path}
@@ -1555,21 +1643,21 @@ class EndpointContext {
1555
1643
  }));
1556
1644
  }
1557
1645
  else if (error instanceof models_1.Models.Http.Errors) {
1558
- lib_9.Helpers.error(error, true, false);
1646
+ lib_10.Helpers.error(error, true, false);
1559
1647
  const err = error;
1560
1648
  res.status(400).send(lib_1.JSON10.stringify(err));
1561
1649
  }
1562
1650
  else if (error instanceof Error) {
1563
1651
  const err = error;
1564
- lib_9.Helpers.error(error, true, false);
1652
+ lib_10.Helpers.error(error, true, false);
1565
1653
  res.status(400).send(lib_1.JSON10.stringify({
1566
1654
  stack: err.stack,
1567
1655
  message: err.message,
1568
1656
  }));
1569
1657
  }
1570
1658
  else {
1571
- lib_9.Helpers.log(error);
1572
- lib_9.Helpers.error(`[Taon] Bad result isomorphic method: ${error} `, true, false);
1659
+ lib_10.Helpers.log(error);
1660
+ lib_10.Helpers.error(`[Taon] Bad result isomorphic method: ${error} `, true, false);
1573
1661
  res.status(400).send(lib_1.JSON10.stringify(error));
1574
1662
  }
1575
1663
  //#endregion
@@ -1595,19 +1683,12 @@ class EndpointContext {
1595
1683
  this.logHttp && console.log(`${type?.toUpperCase()} ${expressPath} `);
1596
1684
  // console.log('INITING', methodConfig); // TODO inject in static
1597
1685
  //#region resolve storage
1598
- let storage;
1599
- if (lib_9.Helpers.isBrowser) {
1600
- storage = window;
1601
- }
1602
- //#region @backend
1603
- if (lib_9.Helpers.isNode) {
1604
- storage = global;
1605
- }
1606
- //#endregion
1686
+ // TODO not a good idea
1687
+ const storage = globalThis;
1607
1688
  //#endregion
1608
1689
  const orgMethods = target.prototype[methodConfig.methodName];
1609
1690
  //#region handle electron ipc request
1610
- if (lib_9.Helpers.isElectron) {
1691
+ if (lib_10.Helpers.isElectron) {
1611
1692
  const ipcRenderer = window.require('electron').ipcRenderer;
1612
1693
  target.prototype[methodConfig.methodName] = function (...args) {
1613
1694
  const received = new Promise(async (resolve, reject) => {
@@ -1801,6 +1882,9 @@ class EndpointContext {
1801
1882
  /* */
1802
1883
  /* */
1803
1884
  /* */
1885
+ /* */
1886
+ /* */
1887
+ /* */
1804
1888
  //#endregion
1805
1889
  //#region handle normal request
1806
1890
  target.prototype[methodConfig.methodName] = function (...args) {
@@ -1816,25 +1900,25 @@ class EndpointContext {
1816
1900
  if (!endpoints[ctx.uri.href][expressPath]) {
1817
1901
  let headers = {};
1818
1902
  if (methodConfig.contentType && !methodConfig.responseType) {
1819
- 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({
1903
+ 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({
1820
1904
  'Content-Type': methodConfig.contentType,
1821
1905
  Accept: methodConfig.contentType,
1822
1906
  }));
1823
1907
  }
1824
1908
  else if (methodConfig.contentType && methodConfig.responseType) {
1825
- 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({
1909
+ 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({
1826
1910
  'Content-Type': methodConfig.contentType,
1827
1911
  Accept: methodConfig.contentType,
1828
1912
  responsetypeaxios: methodConfig.responseType,
1829
1913
  }));
1830
1914
  }
1831
1915
  else if (!methodConfig.contentType && methodConfig.responseType) {
1832
- 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({
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({
1833
1917
  responsetypeaxios: methodConfig.responseType,
1834
1918
  }));
1835
1919
  }
1836
1920
  else {
1837
- rest = lib_2.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
1921
+ rest = lib_3.Resource.create(ctx.uri.href, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
1838
1922
  }
1839
1923
  endpoints[ctx.uri.href][expressPath] = rest;
1840
1924
  }
@@ -1860,18 +1944,18 @@ class EndpointContext {
1860
1944
  }
1861
1945
  if (currentParam.paramType === 'Query') {
1862
1946
  if (currentParam.paramName) {
1863
- const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1947
+ const mapping = lib_3.Mapping.decode(param, !ctx.isProductionMode);
1864
1948
  if (mapping) {
1865
1949
  rest.headers.set(`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
1866
1950
  }
1867
1951
  queryParams[currentParam.paramName] = param;
1868
1952
  }
1869
1953
  else {
1870
- const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1954
+ const mapping = lib_3.Mapping.decode(param, !ctx.isProductionMode);
1871
1955
  if (mapping) {
1872
1956
  rest.headers.set(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
1873
1957
  }
1874
- queryParams = lib_9._.cloneDeep(param);
1958
+ queryParams = lib_10._.cloneDeep(param);
1875
1959
  }
1876
1960
  }
1877
1961
  if (currentParam.paramType === 'Header') {
@@ -1891,7 +1975,7 @@ class EndpointContext {
1891
1975
  }
1892
1976
  }
1893
1977
  if (currentParam.paramType === 'Cookie') {
1894
- lib_2.Resource.Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
1978
+ lib_3.Resource.Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
1895
1979
  }
1896
1980
  if (currentParam.paramType === 'Body') {
1897
1981
  if (currentParam.paramName) {
@@ -1908,14 +1992,14 @@ instead
1908
1992
  // ...
1909
1993
  `);
1910
1994
  }
1911
- const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
1995
+ const mapping = lib_3.Mapping.decode(param, !ctx.isProductionMode);
1912
1996
  if (mapping) {
1913
1997
  rest.headers.set(`${symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
1914
1998
  }
1915
1999
  bodyObject[currentParam.paramName] = param;
1916
2000
  }
1917
2001
  else {
1918
- const mapping = lib_2.Mapping.decode(param, !ctx.isProductionMode);
2002
+ const mapping = lib_3.Mapping.decode(param, !ctx.isProductionMode);
1919
2003
  if (mapping) {
1920
2004
  rest.headers.set(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
1921
2005
  }