taon 19.0.60 → 19.0.62

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 (142) hide show
  1. package/README.md +160 -160
  2. package/bin/start.js +281 -279
  3. package/bin/taon +6 -6
  4. package/bin/taon-debug +5 -5
  5. package/bin/taon-debug-brk +5 -5
  6. package/browser/README.md +24 -24
  7. package/browser/fesm2022/taon.mjs +82 -24
  8. package/browser/fesm2022/taon.mjs.map +1 -1
  9. package/browser/lib/base-classes/base-context.d.ts +1 -6
  10. package/browser/lib/base-classes/base-controller.d.ts +18 -2
  11. package/browser/lib/base-classes/base-repository.d.ts +1 -1
  12. package/browser/lib/base-classes/base.d.ts +1 -6
  13. package/browser/lib/create-context.d.ts +2 -12
  14. package/browser/lib/endpoint-context.d.ts +3 -0
  15. package/browser/lib/index.d.ts +5 -18
  16. package/browser/lib/models.d.ts +6 -0
  17. package/browser/lib/realtime/realtime-client.d.ts +2 -2
  18. package/browser/package.json +1 -1
  19. package/icon-menu-taon.svg +15 -15
  20. package/lib/base-classes/base-context.d.ts +1 -6
  21. package/lib/base-classes/base-controller.d.ts +18 -2
  22. package/lib/base-classes/base-controller.js +25 -5
  23. package/lib/base-classes/base-controller.js.map +1 -1
  24. package/lib/base-classes/base-repository.d.ts +1 -1
  25. package/lib/base-classes/base-repository.js +12 -6
  26. package/lib/base-classes/base-repository.js.map +1 -1
  27. package/lib/base-classes/base.d.ts +1 -6
  28. package/lib/build-info._auto-generated_.d.ts +1 -1
  29. package/lib/build-info._auto-generated_.js +1 -1
  30. package/lib/create-context.d.ts +2 -12
  31. package/lib/create-context.js +21 -11
  32. package/lib/create-context.js.map +1 -1
  33. package/lib/decorators/classes/controller-config.d.ts +0 -11
  34. package/lib/decorators/classes/controller-config.js +0 -10
  35. package/lib/decorators/classes/controller-config.js.map +1 -1
  36. package/lib/decorators/classes/controller-options.d.ts +0 -5
  37. package/lib/decorators/classes/controller-options.js +0 -4
  38. package/lib/decorators/classes/controller-options.js.map +1 -1
  39. package/lib/endpoint-context.d.ts +3 -0
  40. package/lib/endpoint-context.js +24 -6
  41. package/lib/endpoint-context.js.map +1 -1
  42. package/lib/env/env.angular-node-app.d.ts +2 -0
  43. package/lib/env/env.angular-node-app.js +4 -2
  44. package/lib/env/env.angular-node-app.js.map +1 -1
  45. package/lib/env/env.docs-webapp.d.ts +2 -0
  46. package/lib/env/env.docs-webapp.js +4 -2
  47. package/lib/env/env.docs-webapp.js.map +1 -1
  48. package/lib/env/env.electron-app.d.ts +2 -0
  49. package/lib/env/env.electron-app.js +4 -2
  50. package/lib/env/env.electron-app.js.map +1 -1
  51. package/lib/env/env.mobile-app.d.ts +2 -0
  52. package/lib/env/env.mobile-app.js +4 -2
  53. package/lib/env/env.mobile-app.js.map +1 -1
  54. package/lib/env/env.npm-lib-and-cli-tool.d.ts +2 -0
  55. package/lib/env/env.npm-lib-and-cli-tool.js +4 -2
  56. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  57. package/lib/env/env.vscode-plugin.d.ts +2 -0
  58. package/lib/env/env.vscode-plugin.js +4 -2
  59. package/lib/env/env.vscode-plugin.js.map +1 -1
  60. package/lib/env.d.ts +2 -0
  61. package/lib/env.js +7 -0
  62. package/lib/env.js.map +1 -0
  63. package/lib/index.d.ts +5 -18
  64. package/lib/index.js +3 -1
  65. package/lib/index.js.map +1 -1
  66. package/lib/models.d.ts +6 -0
  67. package/lib/models.js.map +1 -1
  68. package/lib/realtime/realtime-client.d.ts +2 -2
  69. package/lib/realtime/realtime-client.js +14 -7
  70. package/lib/realtime/realtime-client.js.map +1 -1
  71. package/lib/realtime/realtime-server.js +17 -14
  72. package/lib/realtime/realtime-server.js.map +1 -1
  73. package/lib/storage.d.ts +1 -0
  74. package/lib/storage.js +6 -0
  75. package/lib/storage.js.map +1 -0
  76. package/lib/ui/directives/index.d.ts +3 -0
  77. package/lib/ui/directives/index.js +5 -0
  78. package/lib/ui/directives/index.js.map +1 -0
  79. package/lib/ui/directives/safe.pipe.d.ts +7 -0
  80. package/lib/ui/directives/taon-inject-html.directive.d.ts +6 -0
  81. package/lib/ui/directives/taon-long-press.directive.d.ts +22 -0
  82. package/lib/ui/directives/view-mode.d.ts +5 -0
  83. package/lib/ui/directives/view-mode.js +10 -0
  84. package/lib/ui/directives/view-mode.js.map +1 -0
  85. package/lib/ui/index.js +2 -2
  86. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  87. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +43 -0
  88. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.d.ts +5 -0
  89. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js +3 -0
  90. package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +1 -0
  91. package/lib/ui/taon-full-material.module.d.ts +5 -0
  92. package/lib/ui/taon-github-fork-me-corner/index.d.ts +2 -0
  93. package/lib/ui/taon-github-fork-me-corner/index.js +5 -0
  94. package/lib/ui/taon-github-fork-me-corner/index.js.map +1 -0
  95. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +3 -0
  96. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +2 -0
  97. package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +2 -0
  98. package/lib/ui/taon-github-fork-me-ribbon/index.js +5 -0
  99. package/lib/ui/taon-github-fork-me-ribbon/index.js.map +1 -0
  100. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +3 -0
  101. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +2 -0
  102. package/lib/ui/taon-notifications/index.d.ts +4 -0
  103. package/lib/ui/taon-notifications/index.js +24 -0
  104. package/lib/ui/taon-notifications/index.js.map +1 -0
  105. package/lib/ui/taon-notifications/taon-notifications.component.d.ts +9 -0
  106. package/lib/ui/taon-notifications/taon-notifications.models.d.ts +6 -0
  107. package/lib/ui/taon-notifications/taon-notifications.models.js +5 -0
  108. package/lib/ui/taon-notifications/taon-notifications.models.js.map +1 -0
  109. package/lib/ui/taon-notifications/taon-notifications.module.d.ts +2 -0
  110. package/lib/ui/taon-notifications/taon-notifications.service.d.ts +11 -0
  111. package/lib/ui/taon-progress-bar/index.d.ts +2 -0
  112. package/lib/ui/taon-progress-bar/index.js +5 -0
  113. package/lib/ui/taon-progress-bar/index.js.map +1 -0
  114. package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +13 -0
  115. package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +2 -0
  116. package/lib/ui/taon-session-passcode/index.d.ts +1 -0
  117. package/lib/ui/taon-session-passcode/index.js +5 -0
  118. package/lib/ui/taon-session-passcode/index.js.map +1 -0
  119. package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +35 -0
  120. package/lib/ui/taon-table/index.d.ts +2 -0
  121. package/lib/ui/taon-table/index.js +5 -0
  122. package/lib/ui/taon-table/index.js.map +1 -0
  123. package/lib/ui/taon-table/taon-table.component.d.ts +34 -0
  124. package/lib/ui/taon-table/taon-table.module.d.ts +2 -0
  125. package/lib/ui/taon.models.d.ts +11 -0
  126. package/lib/ui/taon.models.js +3 -0
  127. package/lib/ui/taon.models.js.map +1 -0
  128. package/package.json +1 -1
  129. package/tmp-environment.json +39 -0
  130. package/websql/README.md +24 -24
  131. package/websql/fesm2022/taon.mjs +76 -20
  132. package/websql/fesm2022/taon.mjs.map +1 -1
  133. package/websql/lib/base-classes/base-context.d.ts +1 -6
  134. package/websql/lib/base-classes/base-controller.d.ts +18 -2
  135. package/websql/lib/base-classes/base-repository.d.ts +1 -1
  136. package/websql/lib/base-classes/base.d.ts +1 -6
  137. package/websql/lib/create-context.d.ts +2 -12
  138. package/websql/lib/endpoint-context.d.ts +3 -0
  139. package/websql/lib/index.d.ts +5 -18
  140. package/websql/lib/models.d.ts +6 -0
  141. package/websql/lib/realtime/realtime-client.d.ts +2 -2
  142. package/websql/package.json +1 -1
package/browser/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # MyLib
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
- > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # MyLib
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
+ > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -1545,9 +1545,7 @@ class RealtimeClient {
1545
1545
  this.subsManagers = {};
1546
1546
  this.core = core;
1547
1547
  if (!core.ctx.disabledRealtime) {
1548
- //#region @browser
1549
1548
  this.init();
1550
- //#endregion
1551
1549
  }
1552
1550
  }
1553
1551
  //#region methods & getters / init
@@ -1561,12 +1559,13 @@ class RealtimeClient {
1561
1559
  if (this.core.ctx.config.frontendHost &&
1562
1560
  this.core.ctx.config.frontendHost !== '' &&
1563
1561
  this.core.ctx.isRunningInsideDocker) {
1564
- console.log(`[${this.core.ctx.contextName}] USING FRONTEND HOST ${this.core.ctx.config.frontendHost}`);
1562
+ Helpers.logInfo(`[${this.core.ctx.contextName}] USING FRONTEND HOST` +
1563
+ ` ${this.core.ctx.config.frontendHost} FOR REALTIME`);
1565
1564
  nspPath.global = new URL(`${this.core.ctx.frontendHostUri.origin}${nspPath.global.pathname}`);
1566
1565
  nspPath.realtime = new URL(`${this.core.ctx.frontendHostUri.origin}${nspPath.realtime.pathname}`);
1567
1566
  }
1568
1567
  else {
1569
- console.log(`[${this.core.ctx.contextName}] NOT USING FRONTEND HOST`);
1568
+ Helpers.logInfo(`[${this.core.ctx.contextName}] Not using frontend host for realtime`);
1570
1569
  }
1571
1570
  this.core.ctx.logRealtime &&
1572
1571
  console.info('[CLIENT] NAMESPACE GLOBAL ', nspPath.global.href + ` host: ${this.core.ctx.host}`);
@@ -1711,7 +1710,13 @@ to use socket realtime connection;
1711
1710
  //#endregion
1712
1711
  //#region methods & getters / get room id from
1713
1712
  getUniqueIdentifierForConnection(options) {
1714
- const url = new URL(options.core.ctx.host);
1713
+ let url;
1714
+ if (UtilsOs.isBrowser) {
1715
+ url = new URL(options.core.ctx.host);
1716
+ }
1717
+ else {
1718
+ url = new URL(options.core.ctx.remoteHost); // backend-to-backend use remote host
1719
+ }
1715
1720
  return `${this.core.ctx.contextName}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
1716
1721
  }
1717
1722
  }
@@ -1731,15 +1736,18 @@ class RealtimeServer {
1731
1736
  }
1732
1737
  //#region methods & getters / init
1733
1738
  init() {
1734
- /* */
1735
- /* */
1736
- /* */
1737
- /* */
1738
- /* */
1739
- /* */
1740
- /* */
1741
- /* */
1742
- /* */
1739
+ //#region @browser
1740
+ if (!this.core.ctx.config.frontendHost) {
1741
+ console.warn(`[Taon][Realtime]
1742
+
1743
+ Frontend host is not defined
1744
+ REALTIME COMMUNICATION WILL NOT WORK
1745
+
1746
+ provide "frontendHost" property in your taon config
1747
+
1748
+ `);
1749
+ }
1750
+ //#endregion
1743
1751
  /* */
1744
1752
  /* */
1745
1753
  /* */
@@ -2966,6 +2974,7 @@ class EndpointContext {
2966
2974
  !this.config.remoteHost.startsWith('https://')) {
2967
2975
  Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
2968
2976
  }
2977
+ // console.log(`config for ${this.contextName}`, this.config);
2969
2978
  //#region resolve if skipping writing server routes
2970
2979
  //@ts-expect-error overriding readonly
2971
2980
  this.skipWritingServerRoutes = _.isBoolean(this.config.skipWritingServerRoutes)
@@ -3002,7 +3011,9 @@ class EndpointContext {
3002
3011
  // console.log(this.config)
3003
3012
  // }
3004
3013
  if (!this.mode && !this.config.abstract) {
3005
- Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
3014
+ const errMsg = `You need to provide host or remoteHost or ` +
3015
+ `useIpcWhenElectron (or mark it as abstract)`;
3016
+ Helpers.error(`[taon] Context "${this.contextName}": ${errMsg}`, false, true);
3006
3017
  /* */
3007
3018
  /* */
3008
3019
  }
@@ -3178,7 +3189,10 @@ class EndpointContext {
3178
3189
  //#endregion
3179
3190
  //#region prepare realtime
3180
3191
  if (!this.config.abstract) {
3181
- this.disabledRealtime = !!this.config.disabledRealtime;
3192
+ this.disabledRealtime = this.config.disabledRealtime;
3193
+ /* */
3194
+ /* */
3195
+ /* */
3182
3196
  /* */
3183
3197
  /* */
3184
3198
  /* */
@@ -4056,6 +4070,18 @@ class EndpointContext {
4056
4070
  });
4057
4071
  }
4058
4072
  //#endregion
4073
+ async initControllersHook(allInitedEndpointContexts) {
4074
+ if (this.isRunOrRevertOnlyMigrationAppStart) {
4075
+ return;
4076
+ }
4077
+ const allControllers = this.getClassFunByArr(Models.ClassType.CONTROLLER);
4078
+ for (const controllerClassFn of allControllers) {
4079
+ const instance = this.getInstanceBy(controllerClassFn);
4080
+ if (_.isFunction(instance.afterAllCtxInited)) {
4081
+ await instance.afterAllCtxInited(allInitedEndpointContexts);
4082
+ }
4083
+ }
4084
+ }
4059
4085
  async initControllers() {
4060
4086
  if (this.isRunOrRevertOnlyMigrationAppStart) {
4061
4087
  return;
@@ -5260,21 +5286,22 @@ const createContext = (configFn) => {
5260
5286
  /* */
5261
5287
  await endpointContextRef.initClasses();
5262
5288
  if (endpointContextRef.databaseConfig) {
5263
- let keepWebsqlDbDataAfterReload = false;
5289
+ //#region handle websql reload data
5264
5290
  //#region @browser
5291
+ let keepWebsqlDbDataAfterReload = false;
5265
5292
  keepWebsqlDbDataAfterReload =
5266
5293
  TaonAdminService.Instance?.keepWebsqlDbDataAfterReload;
5267
- //#endregion
5268
- if (!Helpers.isNode && keepWebsqlDbDataAfterReload) {
5294
+ if (keepWebsqlDbDataAfterReload) {
5269
5295
  !UtilsOs.isRunningInCliMode() &&
5270
5296
  Helpers.info(`[taon] Keeping websql data after reload ` +
5271
5297
  `(context=${endpointContextRef.contextName}).`);
5272
5298
  }
5273
5299
  else {
5274
- !UtilsOs.isRunningInCliMode() &&
5275
- Helpers.info(`[taon] Dropping all tables and data ` +
5276
- `(context=${endpointContextRef.contextName}).`);
5300
+ Helpers.info(`[taon] Dropping all tables and data ` +
5301
+ `(context=${endpointContextRef.contextName}).`);
5277
5302
  }
5303
+ //#endregion
5304
+ //#endregion
5278
5305
  //#region TODO this may be usefull but for now
5279
5306
  // 2 separate contexts are fine
5280
5307
  // const shouldStartRemoteHost = endpointContextRef.mode !== 'remote-backend(tcp+udp)';
@@ -5288,15 +5315,20 @@ const createContext = (configFn) => {
5288
5315
  // endpointContextRef.__contextForControllerInstanceAccess = endpointContextRemoteHostRef;
5289
5316
  // }
5290
5317
  //#endregion
5318
+ //#region run migrations tasks
5291
5319
  if (endpointContextRef.onlyMigrationRun) {
5320
+ Helpers.log(`[taon] Running only migrations (context=${endpointContextRef.contextName}).`);
5292
5321
  await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
5293
5322
  }
5294
5323
  else if (endpointContextRef.onlyMigrationRevertToTimestamp) {
5324
+ Helpers.log(`[taon] Reverting migrations to timestamp ${endpointContextRef.onlyMigrationRevertToTimestamp} (context=${endpointContextRef.contextName}).`);
5295
5325
  await endpointContextRef.dbMigrations.revertMigrationToTimestamp(endpointContextRef.onlyMigrationRevertToTimestamp);
5296
5326
  }
5297
5327
  else {
5328
+ Helpers.log(`[taon] Running all not applied migrations (context=${endpointContextRef.contextName}).`);
5298
5329
  await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
5299
5330
  }
5331
+ //#endregion
5300
5332
  }
5301
5333
  resolve(endpointContextRef);
5302
5334
  });
@@ -5834,6 +5866,14 @@ let BaseRepository = class BaseRepository extends BaseCustomRepository {
5834
5866
  /* */
5835
5867
  /* */
5836
5868
  /* */
5869
+ /* */
5870
+ /* */
5871
+ /* */
5872
+ /* */
5873
+ /* */
5874
+ /* */
5875
+ /* */
5876
+ /* */
5837
5877
  return (void 0);
5838
5878
  }
5839
5879
  /**
@@ -6368,6 +6408,11 @@ function Body(name) {
6368
6408
  /* */
6369
6409
  /* */
6370
6410
  let BaseController = class BaseController extends BaseInjector {
6411
+ /**
6412
+ * Hook that is called when taon app is inited
6413
+ * (all contexts are created and inited)
6414
+ */
6415
+ async afterAllCtxInited(allContexts) { }
6371
6416
  //#region upload form data to server
6372
6417
  uploadFormDataToServer(formData) {
6373
6418
  /* */
@@ -6391,11 +6436,24 @@ let BaseController = class BaseController extends BaseInjector {
6391
6436
  /* */
6392
6437
  /* */
6393
6438
  /* */
6439
+ /* */
6440
+ /* */
6441
+ /* */
6442
+ /* */
6443
+ /* */
6394
6444
  return (void 0);
6395
6445
  }
6396
6446
  //#endregion
6447
+ //#region after file upload hook
6448
+ /**
6449
+ * Hook after file is uploaded
6450
+ * through `uploadFormDataToServer` or `uploadLocalFileToServer`
6451
+ */
6452
+ afterFileUploadAction(file) {
6453
+ // empty
6454
+ }
6397
6455
  //#region upload local file to server
6398
- async uploadLocalFileToServer(absFilePath) {
6456
+ async uploadLocalFileToServer(absFilePath, options) {
6399
6457
  /* */
6400
6458
  /* */
6401
6459
  /* */
@@ -7034,5 +7092,5 @@ var Taon;
7034
7092
  * Generated bundle index. Do not edit.
7035
7093
  */
7036
7094
 
7037
- export { BaseContext, BaseController, BaseCustomRepository, BaseEntity, BaseMigration, BaseProvider, BaseRepository, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, EndpointContext, Models, TAON_CONTEXT, Taon, TaonAdminService, TaonEntityKeysToOmitArr, apiPrefix, createContext, inject };
7095
+ export { BaseContext, BaseController, BaseCustomRepository, BaseEntity, BaseFileUploadMiddleware, BaseMigration, BaseProvider, BaseRepository, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, EndpointContext, Models, TAON_CONTEXT, Taon, TaonAdminService, TaonEntityKeysToOmitArr, apiPrefix, createContext, inject };
7038
7096
  //# sourceMappingURL=taon.mjs.map