taon 21.0.3 → 21.0.9

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 (210) hide show
  1. package/browser/fesm2022/{taon.mjs → taon-browser.mjs} +1954 -1239
  2. package/browser/fesm2022/taon-browser.mjs.map +1 -0
  3. package/browser/package.json +1 -1
  4. package/browser/types/taon-browser.d.ts +2152 -0
  5. package/icon-menu-taon.svg +15 -15
  6. package/lib/base-classes/base-abstract-entity.d.ts +1 -1
  7. package/lib/base-classes/base-abstract-entity.js +12 -12
  8. package/lib/base-classes/base-abstract-entity.js.map +1 -1
  9. package/lib/base-classes/base-angular-service.d.ts +1 -1
  10. package/lib/base-classes/base-angular-service.js +6 -3
  11. package/lib/base-classes/base-angular-service.js.map +1 -1
  12. package/lib/base-classes/base-context.d.ts +2 -2
  13. package/lib/base-classes/base-controller.js +7 -1
  14. package/lib/base-classes/base-controller.js.map +1 -1
  15. package/lib/base-classes/base-crud-controller.js +52 -12
  16. package/lib/base-classes/base-crud-controller.js.map +1 -1
  17. package/lib/base-classes/base-entity.js +2 -6
  18. package/lib/base-classes/base-entity.js.map +1 -1
  19. package/lib/base-classes/base-repository.d.ts +3 -3
  20. package/lib/base-classes/base-repository.js +15 -10
  21. package/lib/base-classes/base-repository.js.map +1 -1
  22. package/lib/base-classes/base.d.ts +1 -46
  23. package/lib/base-classes/base.js +17 -30
  24. package/lib/base-classes/base.js.map +1 -1
  25. package/lib/build-info._auto-generated_.d.ts +1 -1
  26. package/lib/build-info._auto-generated_.js +1 -1
  27. package/lib/context-db-migrations.d.ts +2 -1
  28. package/lib/create-context.d.ts +4 -4
  29. package/lib/decorators/classes/entity-decorator.js +1 -1
  30. package/lib/decorators/classes/entity-decorator.js.map +1 -1
  31. package/lib/decorators/http/http-decorators.d.ts +1 -19
  32. package/lib/decorators/http/http-decorators.js +20 -22
  33. package/lib/decorators/http/http-decorators.js.map +1 -1
  34. package/lib/endpoint-context.d.ts +3 -2
  35. package/lib/express-types.d.ts +1 -0
  36. package/lib/express-types.js +3 -0
  37. package/lib/express-types.js.map +1 -0
  38. package/lib/formly/{formly-group-wrapper-component.d.ts → formly-group-wrapper.component.d.ts} +1 -1
  39. package/lib/formly/{formly-repeat-component.d.ts → formly-repeat.component.d.ts} +1 -1
  40. package/lib/formly/fromly.js +24 -24
  41. package/lib/formly/fromly.js.map +1 -1
  42. package/lib/get-response-value.d.ts +3 -3
  43. package/lib/get-response-value.js.map +1 -1
  44. package/lib/index.d.ts +148 -47
  45. package/lib/index.js +166 -55
  46. package/lib/index.js.map +1 -1
  47. package/lib/models.d.ts +3 -3
  48. package/lib/models.js.map +1 -1
  49. package/lib/orm/columns.d.ts +28 -0
  50. package/lib/orm/columns.js +102 -0
  51. package/lib/orm/columns.js.map +1 -0
  52. package/lib/orm/index.d.ts +1 -0
  53. package/lib/orm/index.js +73 -0
  54. package/lib/orm/index.js.map +1 -0
  55. package/lib/realtime/realtime-core.d.ts +1 -1
  56. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +1 -2
  57. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -1
  58. package/lib/realtime/realtime-strategy/realtime-strategy.d.ts +1 -1
  59. package/lib/realtime/realtime-subs-manager.d.ts +1 -1
  60. package/lib/symbols.d.ts +31 -31
  61. package/lib/symbols.js +59 -59
  62. package/lib/symbols.js.map +1 -1
  63. package/lib/ui/index.js +2 -2
  64. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  65. package/package.json +1 -1
  66. package/websql/fesm2022/{taon.mjs → taon-websql.mjs} +1317 -649
  67. package/websql/fesm2022/taon-websql.mjs.map +1 -0
  68. package/websql/package.json +1 -1
  69. package/websql/types/taon-websql.d.ts +2161 -0
  70. package/browser/fesm2022/taon.mjs.map +0 -1
  71. package/browser/index.d.ts +0 -6
  72. package/browser/lib/base-classes/base-abstract-entity.d.ts +0 -8
  73. package/browser/lib/base-classes/base-angular-service.d.ts +0 -34
  74. package/browser/lib/base-classes/base-class.d.ts +0 -16
  75. package/browser/lib/base-classes/base-context.d.ts +0 -21
  76. package/browser/lib/base-classes/base-controller.d.ts +0 -83
  77. package/browser/lib/base-classes/base-crud-controller.d.ts +0 -29
  78. package/browser/lib/base-classes/base-custom-repository.d.ts +0 -4
  79. package/browser/lib/base-classes/base-entity.d.ts +0 -17
  80. package/browser/lib/base-classes/base-file-upload.middleware.d.ts +0 -15
  81. package/browser/lib/base-classes/base-injector.d.ts +0 -68
  82. package/browser/lib/base-classes/base-middleware.d.ts +0 -39
  83. package/browser/lib/base-classes/base-migration.d.ts +0 -12
  84. package/browser/lib/base-classes/base-provider.d.ts +0 -9
  85. package/browser/lib/base-classes/base-repository.d.ts +0 -267
  86. package/browser/lib/base-classes/base-subscriber-for-entity.d.ts +0 -82
  87. package/browser/lib/base-classes/base.d.ts +0 -47
  88. package/browser/lib/config/controller-config.d.ts +0 -22
  89. package/browser/lib/config/controller-options.d.ts +0 -17
  90. package/browser/lib/config/method-config.d.ts +0 -40
  91. package/browser/lib/config/param-config.d.ts +0 -9
  92. package/browser/lib/constants.d.ts +0 -10
  93. package/browser/lib/context-db-migrations.d.ts +0 -18
  94. package/browser/lib/create-context.d.ts +0 -79
  95. package/browser/lib/decorators/classes/controller-decorator.d.ts +0 -6
  96. package/browser/lib/decorators/classes/entity-decorator.d.ts +0 -20
  97. package/browser/lib/decorators/classes/middleware-decorator.d.ts +0 -8
  98. package/browser/lib/decorators/classes/migration-decorator.d.ts +0 -8
  99. package/browser/lib/decorators/classes/provider-decorator.d.ts +0 -8
  100. package/browser/lib/decorators/classes/repository-decorator.d.ts +0 -8
  101. package/browser/lib/decorators/classes/subscriber-decorator.d.ts +0 -9
  102. package/browser/lib/decorators/decorator-abstract-opt.d.ts +0 -4
  103. package/browser/lib/decorators/http/http-decorators.d.ts +0 -21
  104. package/browser/lib/decorators/http/http-methods-decorators.d.ts +0 -71
  105. package/browser/lib/decorators/http/http-params-decorators.d.ts +0 -9
  106. package/browser/lib/dependency-injection/di-container.d.ts +0 -6
  107. package/browser/lib/endpoint-context-storage.d.ts +0 -12
  108. package/browser/lib/endpoint-context.d.ts +0 -198
  109. package/browser/lib/entity-process.d.ts +0 -40
  110. package/browser/lib/get-response-value.d.ts +0 -7
  111. package/browser/lib/helpers/class-helpers.d.ts +0 -25
  112. package/browser/lib/helpers/clone-obj.d.ts +0 -2
  113. package/browser/lib/helpers/taon-helpers.d.ts +0 -19
  114. package/browser/lib/index.d.ts +0 -129
  115. package/browser/lib/inject.d.ts +0 -5
  116. package/browser/lib/models.d.ts +0 -257
  117. package/browser/lib/orm.d.ts +0 -3
  118. package/browser/lib/realtime/realtime-client.d.ts +0 -42
  119. package/browser/lib/realtime/realtime-core.d.ts +0 -41
  120. package/browser/lib/realtime/realtime-server.d.ts +0 -44
  121. package/browser/lib/realtime/realtime-strategy/index.d.ts +0 -5
  122. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -82
  123. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -15
  124. package/browser/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
  125. package/browser/lib/realtime/realtime-strategy/realtime-strategy.d.ts +0 -12
  126. package/browser/lib/realtime/realtime-subs-manager.d.ts +0 -15
  127. package/browser/lib/realtime/realtime.models.d.ts +0 -28
  128. package/browser/lib/symbols.d.ts +0 -66
  129. package/browser/lib/ui/index.d.ts +0 -2
  130. package/browser/lib/ui/taon-admin-mode-configuration/index.d.ts +0 -2
  131. package/browser/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +0 -22
  132. package/browser/lib/validators.d.ts +0 -8
  133. package/browser/public-api.d.ts +0 -2
  134. package/lib/decorators/classes/controller-config.d.ts +0 -20
  135. package/lib/decorators/classes/controller-config.js +0 -21
  136. package/lib/decorators/classes/controller-config.js.map +0 -1
  137. package/lib/decorators/classes/controller-options.d.ts +0 -16
  138. package/lib/decorators/classes/controller-options.js +0 -20
  139. package/lib/decorators/classes/controller-options.js.map +0 -1
  140. package/lib/formly/formly-group-wrapper-component.js +0 -51
  141. package/lib/formly/formly-group-wrapper-component.js.map +0 -1
  142. package/lib/formly/formly-repeat-component.js +0 -95
  143. package/lib/formly/formly-repeat-component.js.map +0 -1
  144. package/lib/orm.d.ts +0 -68
  145. package/lib/orm.js +0 -112
  146. package/lib/orm.js.map +0 -1
  147. package/websql/fesm2022/taon.mjs.map +0 -1
  148. package/websql/index.d.ts +0 -6
  149. package/websql/lib/base-classes/base-abstract-entity.d.ts +0 -8
  150. package/websql/lib/base-classes/base-angular-service.d.ts +0 -34
  151. package/websql/lib/base-classes/base-class.d.ts +0 -16
  152. package/websql/lib/base-classes/base-context.d.ts +0 -21
  153. package/websql/lib/base-classes/base-controller.d.ts +0 -83
  154. package/websql/lib/base-classes/base-crud-controller.d.ts +0 -29
  155. package/websql/lib/base-classes/base-custom-repository.d.ts +0 -4
  156. package/websql/lib/base-classes/base-entity.d.ts +0 -17
  157. package/websql/lib/base-classes/base-file-upload.middleware.d.ts +0 -15
  158. package/websql/lib/base-classes/base-injector.d.ts +0 -68
  159. package/websql/lib/base-classes/base-middleware.d.ts +0 -39
  160. package/websql/lib/base-classes/base-migration.d.ts +0 -12
  161. package/websql/lib/base-classes/base-provider.d.ts +0 -9
  162. package/websql/lib/base-classes/base-repository.d.ts +0 -272
  163. package/websql/lib/base-classes/base-subscriber-for-entity.d.ts +0 -82
  164. package/websql/lib/base-classes/base.d.ts +0 -47
  165. package/websql/lib/config/controller-config.d.ts +0 -22
  166. package/websql/lib/config/controller-options.d.ts +0 -17
  167. package/websql/lib/config/method-config.d.ts +0 -40
  168. package/websql/lib/config/param-config.d.ts +0 -9
  169. package/websql/lib/constants.d.ts +0 -10
  170. package/websql/lib/context-db-migrations.d.ts +0 -18
  171. package/websql/lib/create-context.d.ts +0 -79
  172. package/websql/lib/decorators/classes/controller-decorator.d.ts +0 -6
  173. package/websql/lib/decorators/classes/entity-decorator.d.ts +0 -20
  174. package/websql/lib/decorators/classes/middleware-decorator.d.ts +0 -8
  175. package/websql/lib/decorators/classes/migration-decorator.d.ts +0 -8
  176. package/websql/lib/decorators/classes/provider-decorator.d.ts +0 -8
  177. package/websql/lib/decorators/classes/repository-decorator.d.ts +0 -8
  178. package/websql/lib/decorators/classes/subscriber-decorator.d.ts +0 -9
  179. package/websql/lib/decorators/decorator-abstract-opt.d.ts +0 -4
  180. package/websql/lib/decorators/http/http-decorators.d.ts +0 -21
  181. package/websql/lib/decorators/http/http-methods-decorators.d.ts +0 -71
  182. package/websql/lib/decorators/http/http-params-decorators.d.ts +0 -9
  183. package/websql/lib/dependency-injection/di-container.d.ts +0 -6
  184. package/websql/lib/endpoint-context-storage.d.ts +0 -12
  185. package/websql/lib/endpoint-context.d.ts +0 -200
  186. package/websql/lib/entity-process.d.ts +0 -40
  187. package/websql/lib/get-response-value.d.ts +0 -7
  188. package/websql/lib/helpers/class-helpers.d.ts +0 -25
  189. package/websql/lib/helpers/clone-obj.d.ts +0 -2
  190. package/websql/lib/helpers/taon-helpers.d.ts +0 -19
  191. package/websql/lib/index.d.ts +0 -129
  192. package/websql/lib/inject.d.ts +0 -5
  193. package/websql/lib/models.d.ts +0 -261
  194. package/websql/lib/orm.d.ts +0 -69
  195. package/websql/lib/realtime/realtime-client.d.ts +0 -42
  196. package/websql/lib/realtime/realtime-core.d.ts +0 -41
  197. package/websql/lib/realtime/realtime-server.d.ts +0 -44
  198. package/websql/lib/realtime/realtime-strategy/index.d.ts +0 -5
  199. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -82
  200. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -15
  201. package/websql/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
  202. package/websql/lib/realtime/realtime-strategy/realtime-strategy.d.ts +0 -12
  203. package/websql/lib/realtime/realtime-subs-manager.d.ts +0 -15
  204. package/websql/lib/realtime/realtime.models.d.ts +0 -28
  205. package/websql/lib/symbols.d.ts +0 -66
  206. package/websql/lib/ui/index.d.ts +0 -2
  207. package/websql/lib/ui/taon-admin-mode-configuration/index.d.ts +0 -2
  208. package/websql/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +0 -22
  209. package/websql/lib/validators.d.ts +0 -8
  210. package/websql/public-api.d.ts +0 -2
@@ -1,126 +1,140 @@
1
1
  import 'reflect-metadata';
2
2
  import * as coreHelpers from 'tnp-core/websql';
3
3
  import { _, Utils, UtilsMigrations, Helpers, UtilsOs, crossPlatformPath, config, CoreModels, UtilsTerminal } from 'tnp-core/websql';
4
- import { __decorate, __metadata, __param } from 'tslib';
5
- import * as tsorm from 'taon-typeorm/websql';
6
- import { OrignalClassKey, Entity, Table, TableIndex, EventSubscriber, DataSource } from 'taon-typeorm/websql';
7
- import { SYMBOL, CLASS } from 'typescript-class-helpers/websql';
8
- import { walk } from 'lodash-walk-object/websql';
9
- import * as i0 from '@angular/core';
10
- import { InjectionToken, inject as inject$1, Injectable } from '@angular/core';
11
4
  import axios from 'axios';
12
5
  import { JSON10 } from 'json10/websql';
6
+ import { walk } from 'lodash-walk-object/websql';
13
7
  import { RestResponseWrapper, Models as Models$1, Resource, RestHeaders, Mapping, HttpResponseError } from 'ng2-rest/websql';
14
8
  import { Observable, Subject, from } from 'rxjs';
9
+ import { OrignalClassKey, Table, TableIndex, EventSubscriber, Entity, DataSource, Column, PrimaryGeneratedColumn, VersionColumn } from 'taon-typeorm/websql';
10
+ export { AfterInsert, AfterLoad, AfterRecover, AfterRemove, AfterSoftRemove, AfterUpdate, BeforeInsert, BeforeRecover, BeforeRemove, BeforeSoftRemove, BeforeUpdate, Column, Connection, CreateDateColumn, Column as CustomColumn, DeleteDateColumn, Generated, Generated as GeneratedColumn, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, OneToOne, PrimaryColumn, PrimaryGeneratedColumn, Repository, TreeChildren, TreeParent, UpdateDateColumn, VersionColumn, VirtualColumn } from 'taon-typeorm/websql';
11
+ import * as i0 from '@angular/core';
12
+ import { InjectionToken, inject as inject$1, Injectable, ViewContainerRef, ViewChild, Component } from '@angular/core';
13
+ import { SYMBOL, CLASS } from 'typescript-class-helpers/websql';
15
14
  import * as JSON5 from 'json5';
16
15
  import { io } from 'socket.io-client';
16
+ import { __decorate, __metadata, __param } from 'tslib';
17
17
  import { MySqlQuerySource } from 'taon-type-sql/websql';
18
+ import * as i1 from '@ngx-formly/core';
19
+ import { FieldWrapper, FieldArrayType } from '@ngx-formly/core';
18
20
 
19
- //#region @websql
20
- //#region orm
21
- var Orm;
22
- (function (Orm) {
23
- //#region @websql
24
- Orm.Repository = tsorm.Repository;
25
- Orm.Connection = tsorm.Connection;
26
- let ListenEvent;
27
- (function (ListenEvent) {
28
- ListenEvent.AfterInsert = tsorm.AfterInsert;
29
- ListenEvent.AfterLoad = tsorm.AfterLoad;
30
- ListenEvent.AfterRecover = tsorm.AfterRecover;
31
- ListenEvent.AfterRemove = tsorm.AfterRemove;
32
- ListenEvent.AfterSoftRemove = tsorm.AfterSoftRemove;
33
- ListenEvent.AfterUpdate = tsorm.AfterUpdate;
34
- ListenEvent.BeforeInsert = tsorm.BeforeInsert;
35
- ListenEvent.BeforeRecover = tsorm.BeforeRecover;
36
- ListenEvent.BeforeRemove = tsorm.BeforeRemove;
37
- ListenEvent.BeforeSoftRemove = tsorm.BeforeSoftRemove;
38
- ListenEvent.BeforeUpdate = tsorm.BeforeUpdate;
39
- })(ListenEvent = Orm.ListenEvent || (Orm.ListenEvent = {}));
40
- let Tree;
41
- (function (Tree) {
42
- Tree.Children = tsorm.TreeChildren;
43
- Tree.Parent = tsorm.TreeParent;
44
- })(Tree = Orm.Tree || (Orm.Tree = {}));
45
- let Column;
46
- (function (Column) {
47
- Column.Generated = tsorm.PrimaryGeneratedColumn;
48
- Column.Primary = tsorm.PrimaryColumn;
49
- Column.Index = tsorm.Index;
50
- Column.CreateDate = tsorm.CreateDateColumn;
51
- Column.UpdateDate = tsorm.UpdateDateColumn;
52
- Column.DeleteDate = tsorm.DeleteDateColumn;
53
- Column.Custom = tsorm.Column;
54
- /**
55
- * 100 default characters varchar
56
- */
57
- Column.String = (defaultValue = null, length = 100) => tsorm.Column({
58
- type: 'varchar',
59
- length,
60
- nullable: _.isNil(defaultValue),
61
- default: defaultValue,
62
- });
63
- /**
64
- * 100 characters varchar
65
- */
66
- Column.String100 = (defaultValue = null) => tsorm.Column({
67
- type: 'varchar',
68
- length: 100,
69
- nullable: _.isNil(defaultValue),
70
- default: defaultValue,
71
- });
72
- /**
73
- * 100 characters varchar
74
- */
75
- Column.String45 = (defaultValue = null) => tsorm.Column({
76
- type: 'varchar',
77
- length: 45,
78
- nullable: _.isNil(defaultValue),
79
- default: defaultValue,
80
- });
81
- /**
82
- * 500 characters varchar
83
- */
84
- Column.String500 = (defaultValue = null) => tsorm.Column({
85
- type: 'varchar',
86
- length: 500,
87
- nullable: _.isNil(defaultValue),
88
- default: defaultValue,
89
- });
90
- /**
91
- * 200 characters varchar
92
- */
93
- Column.String200 = (defaultValue = null) => tsorm.Column({
94
- type: 'varchar',
95
- length: 200,
96
- nullable: _.isNil(defaultValue),
97
- default: defaultValue,
98
- });
99
- Column.Number = () => tsorm.Column({ type: 'int', nullable: true });
100
- Column.DecimalNumber = () => tsorm.Column({ type: 'float', nullable: true });
101
- Column.SimpleJson = () => tsorm.Column({ type: 'simple-json', nullable: true });
102
- Column.Boolean = (defaultValue) => tsorm.Column({ type: 'boolean', nullable: true, default: defaultValue });
103
- Column.DateTIme = (defaultValue = null) => tsorm.Column({ type: 'datetime', nullable: true, default: defaultValue });
104
- // TODO has limitation => comma in name
105
- // export const SimpleArray = () => tsorm.Column({ type: 'simple-array', nullable: true });
106
- Column.Version = tsorm.VersionColumn;
107
- Column.Virtual = tsorm.VirtualColumn;
108
- })(Column = Orm.Column || (Orm.Column = {}));
109
- let Join;
110
- (function (Join) {
111
- Join.Table = tsorm.JoinTable;
112
- Join.Column = tsorm.JoinColumn;
113
- })(Join = Orm.Join || (Orm.Join = {}));
114
- let Relation;
115
- (function (Relation) {
116
- Relation.OneToMany = tsorm.OneToMany;
117
- Relation.OneToOne = tsorm.OneToOne;
118
- Relation.ManyToMany = tsorm.ManyToMany;
119
- Relation.ManyToOne = tsorm.ManyToOne;
120
- })(Relation = Orm.Relation || (Orm.Relation = {}));
121
- //#endregion
122
- })(Orm || (Orm = {}));
21
+ const TaonEntityKeysToOmitArr = [
22
+ 'ctrl',
23
+ 'clone',
24
+ '__endpoint_context__',
25
+ 'ctx',
26
+ 'inject',
27
+ '_',
28
+ 'relation',
29
+ 'relations',
30
+ 'inject',
31
+ 'injectRepo',
32
+ 'injectCustomRepository',
33
+ 'injectCustomRepo',
34
+ 'injectController',
35
+ 'injectCtrl',
36
+ 'injectProvider',
37
+ 'injectMiddleware',
38
+ ];
39
+ let TAON_CONTEXT;
40
+ //#region @browser
41
+ TAON_CONTEXT = new InjectionToken('TAON_CONTEXT');
42
+ //#endregion
43
+ let CURRENT_HOST_BACKEND_PORT;
44
+ //#region @browser
45
+ CURRENT_HOST_BACKEND_PORT = new InjectionToken('CURRENT_HOST_BACKEND_PORT');
123
46
  //#endregion
47
+ let CURRENT_HOST_URL;
48
+ //#region @browser
49
+ CURRENT_HOST_URL = new InjectionToken('CURRENT_HOST_URL');
50
+ const apiPrefix = 'api';
51
+
52
+ // ! TODO make it as a nice way to wrap normal request
53
+ class TaonRestResponseWrapper extends RestResponseWrapper {
54
+ }
55
+ const BaseTaonClassesNames = [
56
+ 'BaseCrudController',
57
+ 'BaseController',
58
+ 'BaseAbstractEntity',
59
+ 'BaseEntity',
60
+ 'BaseContext',
61
+ 'BaseCustomRepository',
62
+ 'BaseFileUploadMiddleware',
63
+ 'BaseMiddleware',
64
+ 'BaseClass',
65
+ 'BaseInjector',
66
+ 'BaseMigration',
67
+ 'BaseProvider',
68
+ 'BaseRepository',
69
+ 'BaseSubscriberForEntity',
70
+ 'BaseCliWorkerController',
71
+ 'PortsController',
72
+ 'PortsContext',
73
+ ];
74
+ const TaonTempDatabasesFolder = 'databases';
75
+ const TaonTempRoutesFolder = 'routes';
76
+ var Models;
77
+ (function (Models) {
78
+ Models.DatabasesFolder = TaonTempDatabasesFolder;
79
+ //#region models / class types
80
+ let ClassType;
81
+ (function (ClassType) {
82
+ ClassType["ENTITY"] = "ENTITY";
83
+ ClassType["CONTROLLER"] = "CONTROLLER";
84
+ ClassType["REPOSITORY"] = "REPOSITORY";
85
+ ClassType["PROVIDER"] = "PROVIDER";
86
+ ClassType["SUBSCRIBER"] = "SUBSCRIBER";
87
+ ClassType["MIGRATION"] = "MIGRATION";
88
+ ClassType["MIDDLEWARE"] = "MIDDLEWARE";
89
+ })(ClassType = Models.ClassType || (Models.ClassType = {}));
90
+ Models.ClassTypeKey = {
91
+ [ClassType.ENTITY]: 'entities',
92
+ [ClassType.CONTROLLER]: 'controllers',
93
+ [ClassType.REPOSITORY]: 'repositories',
94
+ [ClassType.PROVIDER]: 'providers',
95
+ [ClassType.SUBSCRIBER]: 'subscribers',
96
+ [ClassType.MIGRATION]: 'migrations',
97
+ [ClassType.MIDDLEWARE]: 'middlewares',
98
+ };
99
+ //#endregion
100
+ //#region models / database connection options
101
+ class DatabaseConfigTypeOrm {
102
+ }
103
+ Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
104
+ //#endregion
105
+ //#region models / database config
106
+ class DatabaseConfig extends DatabaseConfigTypeOrm {
107
+ static from(databasePartialConfig) {
108
+ return _.merge(new DatabaseConfig(), databasePartialConfig);
109
+ }
110
+ get databaseConfigTypeORM() {
111
+ //#region @websqlFunc
112
+ const result = _.cloneDeep(this);
113
+ if (result.recreateMode) {
114
+ if (result.recreateMode === 'DROP_DB+MIGRATIONS') {
115
+ result.synchronize = true;
116
+ result.dropSchema = true;
117
+ }
118
+ else if (result.recreateMode === 'PRESERVE_DATA+MIGRATIONS') {
119
+ result.synchronize = false;
120
+ result.dropSchema = false;
121
+ }
122
+ }
123
+ delete result.recreateMode;
124
+ return result;
125
+ //#endregion
126
+ }
127
+ }
128
+ Models.DatabaseConfig = DatabaseConfig;
129
+ //#endregion
130
+ //#region models / http
131
+ let Http;
132
+ (function (Http) {
133
+ Http.Rest = Models$1;
134
+ //#endregion
135
+ })(Http = Models.Http || (Models.Http = {}));
136
+ //#endregion
137
+ })(Models || (Models = {}));
124
138
 
125
139
  class DecoratorAbstractOpt {
126
140
  }
@@ -156,6 +170,68 @@ const controllerConfigFrom = (partial) => {
156
170
  return newObj;
157
171
  };
158
172
 
173
+ /**
174
+ * for backendSocket.in(ROOM_NAME).emit(EVENT)
175
+ *
176
+ * Room names are uniqe..
177
+ * here I am limiting number of event for clients.
178
+ */
179
+ class Realtime {
180
+ constructor() {
181
+ this.KEYroomSubscribe = `roomSubscribe`;
182
+ this.KEYroomUnsubscribe = `roomUnsubscribe`;
183
+ //#endregion
184
+ }
185
+ NAMESPACE(contextName) {
186
+ return `${contextName}-taonRealtimeNsp`;
187
+ }
188
+ TABLE_CHANGE(contextName, tableName) {
189
+ return `${contextName}:listentablename${tableName}`;
190
+ }
191
+ // /**
192
+ // * TODO use it or not?
193
+ // * @deprecated
194
+ // */
195
+ // ROOM_NAME_SUBSCRIBER_EVENT(
196
+ // contextName: string,
197
+ // className: string,
198
+ // propertyName: string,
199
+ // ) {
200
+ // return `${contextName}:room${_.camelCase(className)}${propertyName}`.toLowerCase();
201
+ // }
202
+ //#region custom events in rooms
203
+ ROOM_NAME_CUSTOM(contextName, customEvent) {
204
+ return `${contextName}:CustomRoomEvent${customEvent}`;
205
+ }
206
+ ROOM_SUBSCRIBE_CUSTOM(contextName) {
207
+ return `${contextName}:${this.KEYroomSubscribe}CustomRoomEvent`;
208
+ }
209
+ ROOM_UNSUBSCRIBE_CUSTOM(contextName) {
210
+ return `${contextName}:${this.KEYroomUnsubscribe}CustomRoomEvent`;
211
+ }
212
+ //#endregion
213
+ //#region entity events
214
+ ROOM_NAME_UPDATE_ENTITY(contextName, className, entityId) {
215
+ return `${contextName}:room${_.camelCase(className)}${entityId}`.toLowerCase();
216
+ }
217
+ ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
218
+ return `${contextName}:${this.KEYroomSubscribe}EntityEvents`;
219
+ }
220
+ ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
221
+ return `${contextName}:${this.KEYroomUnsubscribe}EntityEvents`;
222
+ }
223
+ //#endregion
224
+ //#region entity property events
225
+ ROOM_NAME_UPDATE_ENTITY_PROPERTY(contextName, className, property, entityId) {
226
+ return `${contextName}:room${_.camelCase(className)}${_.camelCase(property)}${entityId}`.toLowerCase();
227
+ }
228
+ ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
229
+ return `${contextName}:${this.KEYroomSubscribe}EntityPropertyEvents`;
230
+ }
231
+ ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
232
+ return `${contextName}:${this.KEYroomUnsubscribe}EntityPropertyEvents`;
233
+ }
234
+ }
159
235
  var Symbols;
160
236
  (function (Symbols) {
161
237
  Symbols.ctxInClassOrClassObj = Symbol();
@@ -164,68 +240,6 @@ var Symbols;
164
240
  Symbols.orignalClass = OrignalClassKey;
165
241
  Symbols.orignalClassClonesObj = `$$originalClassClonesObj$$`;
166
242
  Symbols.classMethodsNames = `$$classMethodsNames$$`;
167
- /**
168
- * for backendSocket.in(ROOM_NAME).emit(EVENT)
169
- *
170
- * Room names are uniqe..
171
- * here I am limiting number of event for clients.
172
- */
173
- class Realtime {
174
- constructor() {
175
- this.KEYroomSubscribe = `roomSubscribe`;
176
- this.KEYroomUnsubscribe = `roomUnsubscribe`;
177
- //#endregion
178
- }
179
- NAMESPACE(contextName) {
180
- return `${contextName}-taonRealtimeNsp`;
181
- }
182
- TABLE_CHANGE(contextName, tableName) {
183
- return `${contextName}:listentablename${tableName}`;
184
- }
185
- // /**
186
- // * TODO use it or not?
187
- // * @deprecated
188
- // */
189
- // ROOM_NAME_SUBSCRIBER_EVENT(
190
- // contextName: string,
191
- // className: string,
192
- // propertyName: string,
193
- // ) {
194
- // return `${contextName}:room${_.camelCase(className)}${propertyName}`.toLowerCase();
195
- // }
196
- //#region custom events in rooms
197
- ROOM_NAME_CUSTOM(contextName, customEvent) {
198
- return `${contextName}:CustomRoomEvent${customEvent}`;
199
- }
200
- ROOM_SUBSCRIBE_CUSTOM(contextName) {
201
- return `${contextName}:${this.KEYroomSubscribe}CustomRoomEvent`;
202
- }
203
- ROOM_UNSUBSCRIBE_CUSTOM(contextName) {
204
- return `${contextName}:${this.KEYroomUnsubscribe}CustomRoomEvent`;
205
- }
206
- //#endregion
207
- //#region entity events
208
- ROOM_NAME_UPDATE_ENTITY(contextName, className, entityId) {
209
- return `${contextName}:room${_.camelCase(className)}${entityId}`.toLowerCase();
210
- }
211
- ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
212
- return `${contextName}:${this.KEYroomSubscribe}EntityEvents`;
213
- }
214
- ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
215
- return `${contextName}:${this.KEYroomUnsubscribe}EntityEvents`;
216
- }
217
- //#endregion
218
- //#region entity property events
219
- ROOM_NAME_UPDATE_ENTITY_PROPERTY(contextName, className, property, entityId) {
220
- return `${contextName}:room${_.camelCase(className)}${_.camelCase(property)}${entityId}`.toLowerCase();
221
- }
222
- ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
223
- return `${contextName}:${this.KEYroomSubscribe}EntityPropertyEvents`;
224
- }
225
- ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
226
- return `${contextName}:${this.KEYroomUnsubscribe}EntityPropertyEvents`;
227
- }
228
- }
229
243
  Symbols.REALTIME = new Realtime();
230
244
  Symbols.metadata = {
231
245
  className: `class:realname`,
@@ -501,437 +515,73 @@ var ClassHelpers;
501
515
  .forEach(p => allMethodsNames.push(p));
502
516
  if (!classFun ||
503
517
  !classFun.constructor ||
504
- classFun?.constructor?.name === 'Object') {
505
- return Utils.uniqArray(allMethodsNames);
506
- }
507
- return ClassHelpers.getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
508
- };
509
- //#endregion
510
- //#region get controller configs
511
- ClassHelpers.getControllerConfigs = (target, configs = [], callerTarget) => {
512
- if (!_.isFunction(target)) {
513
- throw `[typescript-class-helper][getControllerConfigs] Cannot get class config from: ${target}`;
514
- }
515
- let config;
516
- const parentClass = Object.getPrototypeOf(target);
517
- const parentName = parentClass ? ClassHelpers.getName(parentClass) : void 0;
518
- const isValidParent = _.isFunction(parentClass) && parentName !== '';
519
- config = controllerConfigFrom(ClassHelpers.getClassConfig(target));
520
- configs.push(config);
521
- return isValidParent
522
- ? ClassHelpers.getControllerConfigs(parentClass, configs, target)
523
- : configs;
524
- };
525
- //#endregion
526
- //#region ensure configs
527
- // Ensure ClassConfig on constructor, clone parent if needed
528
- ClassHelpers.ensureClassConfig = (target) => {
529
- let cfg = Reflect.getOwnMetadata(Symbols.metadata.options.controller, // META_KEYS.class,
530
- target);
531
- if (!cfg) {
532
- cfg = { methods: {} };
533
- const parent = Object.getPrototypeOf(target);
534
- if (parent && parent !== Function.prototype) {
535
- const parentCfg = Reflect.getMetadata(Symbols.metadata.options.controller, // META_KEYS.class,
536
- parent);
537
- if (parentCfg) {
538
- // Deep copy each method config so child gets its own objects
539
- const clonedMethods = {};
540
- for (const [k, v] of Object.entries(parentCfg.methods)) {
541
- clonedMethods[k] = {
542
- ...v,
543
- parameters: { ...v.parameters }, // shallow clone parameters too
544
- };
545
- }
546
- cfg = {
547
- ...parentCfg,
548
- methods: clonedMethods,
549
- };
550
- }
551
- }
552
- Reflect.defineMetadata(Symbols.metadata.options.controller, cfg, target);
553
- }
554
- return cfg;
555
- };
556
- // Ensure MethodConfig inside ClassConfig
557
- ClassHelpers.ensureMethodConfig = (target, propertyKey) => {
558
- const classCfg = ClassHelpers.ensureClassConfig(target.constructor);
559
- let methodCfg = classCfg.methods[propertyKey?.toString()];
560
- if (!methodCfg) {
561
- methodCfg = { methodName: propertyKey?.toString(), parameters: {} };
562
- classCfg.methods[propertyKey?.toString()] = methodCfg;
563
- }
564
- return methodCfg;
565
- };
566
- ClassHelpers.getClassConfig = (constructor) => {
567
- return Reflect.getMetadata(Symbols.metadata.options.controller, constructor);
568
- };
569
- //#endregion
570
- })(ClassHelpers || (ClassHelpers = {}));
571
-
572
- const cloneObj = (override, classFn) => {
573
- const result = _.merge(new classFn(), _.cloneDeep(this));
574
- walk.Object(override || {}, (value, lodashPath) => {
575
- if (_.isNil(value) || _.isFunction(value) || _.isObject(value)) {
576
- // skipping
577
- }
578
- else {
579
- _.set(result, lodashPath, value);
580
- }
581
- }, {
582
- walkGetters: false,
583
- });
584
- // console.log({result})
585
- return result;
586
- };
587
-
588
- //#endregion
589
- class TaonBaseClass {
590
- //#region class initialization hook
591
- /**
592
- * class initialization hook
593
- * taon after class instance creation
594
- */
595
- async _() { }
596
- //#endregion
597
- //#region clone
598
- /**
599
- *
600
- * @param overrideObjOrFn if object is provided it will override values in cloned object,
601
- * if function is provided it will be called with old cloned values and should return
602
- * object with values to override
603
- * @returns cloned instance of the class
604
- */
605
- clone(overrideObjOrFn) {
606
- if (_.isString(overrideObjOrFn)) {
607
- console.log(overrideObjOrFn);
608
- throw new Error('String is not supported as .clone() method argument');
609
- }
610
- const classFn = ClassHelpers.getClassFnFromObject(this);
611
- if (_.isFunction(overrideObjOrFn)) {
612
- // console.log('clone with fn');
613
- const oldValues = (_.cloneDeep(this) || {});
614
- return cloneObj(overrideObjOrFn(oldValues), classFn);
615
- }
616
- // console.log('clone normal');
617
- return cloneObj(overrideObjOrFn, classFn);
618
- }
619
- }
620
-
621
- let EntityDecorator$1 = () => {
622
- return (target) => { };
623
- };
624
- //#region @websql
625
- EntityDecorator$1 = Entity;
626
- //#endregion
627
- let TaonBaseEntity = class TaonBaseEntity extends TaonBaseClass {
628
- /**
629
- * simple check if relation is ok
630
- */
631
- relation(relationName) {
632
- return relationName;
633
- }
634
- /**
635
- * simple check if relation is ok
636
- */
637
- relations(relationNames) {
638
- return relationNames;
639
- }
640
- };
641
- TaonBaseEntity = __decorate([
642
- EntityDecorator$1()
643
- ], TaonBaseEntity);
644
-
645
- // empty decorator
646
- let EntityDecorator = () => {
647
- return (target) => { };
648
- };
649
- //#region @websql
650
- EntityDecorator = Entity;
651
- //#endregion
652
- let TaonBaseAbstractEntity = class TaonBaseAbstractEntity extends TaonBaseEntity {
653
- };
654
- __decorate([
655
- Orm.Column.Generated()
656
- //#endregion
657
- ,
658
- __metadata("design:type", String)
659
- ], TaonBaseAbstractEntity.prototype, "id", void 0);
660
- __decorate([
661
- Orm.Column.Version()
662
- //#endregion
663
- ,
664
- __metadata("design:type", Number)
665
- ], TaonBaseAbstractEntity.prototype, "version", void 0);
666
- TaonBaseAbstractEntity = __decorate([
667
- EntityDecorator()
668
- ], TaonBaseAbstractEntity);
669
-
670
- const TaonEntityKeysToOmitArr = [
671
- 'ctrl',
672
- 'clone',
673
- '__endpoint_context__',
674
- 'ctx',
675
- 'inject',
676
- '_',
677
- 'relation',
678
- 'relations',
679
- 'inject',
680
- 'injectRepo',
681
- 'injectCustomRepository',
682
- 'injectCustomRepo',
683
- 'injectController',
684
- 'injectCtrl',
685
- 'injectProvider',
686
- 'injectMiddleware',
687
- ];
688
- let TAON_CONTEXT;
689
- //#region @browser
690
- TAON_CONTEXT = new InjectionToken('TAON_CONTEXT');
691
- //#endregion
692
- let CURRENT_HOST_BACKEND_PORT;
693
- //#region @browser
694
- CURRENT_HOST_BACKEND_PORT = new InjectionToken('CURRENT_HOST_BACKEND_PORT');
695
- //#endregion
696
- let CURRENT_HOST_URL;
697
- //#region @browser
698
- CURRENT_HOST_URL = new InjectionToken('CURRENT_HOST_URL');
699
- const apiPrefix = 'api';
700
-
701
- const inject = (entity) => {
702
- return new Proxy({}, {
703
- get: (_, propName) => {
704
- if (propName === 'hasOwnProperty') {
705
- return () => false;
706
- }
707
- const ctor = entity();
708
- const contextFromClass = ctor[Symbols.ctxInClassOrClassObj];
709
- const resultContext = contextFromClass;
710
- if (resultContext) {
711
- let instance = resultContext.inject(ctor, {
712
- parentInstanceThatWillGetInjectedStuff: this,
713
- });
714
- // console.log('instance', instance);
715
- if (propName === 'getOriginalPrototype') {
716
- return () => Object.getPrototypeOf(instance);
717
- }
718
- if (propName === 'getOriginalConstructor') {
719
- return () => instance.constructor;
720
- }
721
- const methods = ctor[Symbols.classMethodsNames] || [];
722
- const isMethods = methods.includes(propName);
723
- const methodOrProperty = isMethods
724
- ? instance[propName].bind(instance)
725
- : instance[propName];
726
- // console.log(
727
- // `methodOrProperty from proxy ${propName?.toString()} = isMethods:${isMethods}`,
728
- // methods,
729
- // );
730
- return methodOrProperty;
731
- }
732
- },
733
- });
734
- };
735
- // export const injectController = inject;
736
- // export type SubscriptionEvent<T> = {
737
- // name: keyof T;
738
- // data: any;
739
- // };
740
- /**
741
- * TODO
742
- */
743
- // export const injectEntityEvents = <T>(
744
- // subscriberClassResolveFn: () => new (...args: any[]) => T,
745
- // eventName?: keyof Omit<EntitySubscriberInterface,'listenTo'> ,
746
- // ): Observable<SubscriptionEvent<T>> => {
747
- // const eventsSrc = new Subject<SubscriptionEvent<T>>();
748
- // const obs = eventsSrc.asObservable();
749
- // let isFirstSubscription = true;
750
- // const proxyObservable = new Proxy(obs, {
751
- // get(target, prop, receiver) {
752
- // if (prop === 'subscribe') {
753
- // return (...args: any[]) => {
754
- // if (isFirstSubscription) {
755
- // isFirstSubscription = false;
756
- // const subscriberClassFN: typeof TaonBaseClass =
757
- // subscriberClassResolveFn() as any;
758
- // const ctx = subscriberClassFN[
759
- // Symbols.ctxInClassOrClassObj
760
- // ] as EndpointContext;
761
- // if (!ctx) {
762
- // throw new Error(
763
- // `You are trying to inject class without context. Use context like this:
764
- // class MyClassSubscriber extends BaseSubscriber {
765
- // ${eventName as any}() {
766
- // \/\/ your code here
767
- // }
768
- // }
769
- // Taon.injectSubscriberEvents( MyContext.getInstance(()=> MyClassSubscriber), '${eventName as any}' )
770
- // `,
771
- // );
772
- // }
773
- // const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
774
- // // subscriberInstance TODO @LAST subscriber event from instance
775
- // // const entity = subscriberClassFN.prototype.listenTo();
776
- // console.log('First subscription, you can access arguments here:', {
777
- // subscriberClassFN,
778
- // eventName,
779
- // });
780
- // }
781
- // return target.subscribe(...args);
782
- // };
783
- // }
784
- // return Reflect.get(target, prop, receiver);
785
- // },
786
- // });
787
- // return proxyObservable as Observable<SubscriptionEvent<T>>;
788
- // };
789
-
790
- /**
791
- * TODO prevent calling methods when not initialized
792
- * with init(ctx)
793
- */
794
- //#region @browser
795
- //#endregion
796
- class BaseAngularsService {
797
- //#endregion
798
- constructor() {
799
- //#region @browser
800
- this.currentContext = inject$1(TAON_CONTEXT);
801
- //#region @browser
802
- this.CURRENT_HOST_BACKEND_PORT = inject$1(CURRENT_HOST_BACKEND_PORT, {
803
- optional: true,
804
- });
805
- this.CURRENT_HOST_URL = inject$1(CURRENT_HOST_URL, {
806
- optional: true,
807
- });
808
- // #endregion
809
- }
810
- /**
811
- * @deprecated
812
- * Returns the host URL for the backend service
813
- * that is running on localhost (normal NodeJS/ExpressJS mode).
814
- */
815
- get host() {
816
- //#region @browser
817
- if (this.CURRENT_HOST_URL) {
818
- return this.CURRENT_HOST_URL;
819
- }
820
- return `http://localhost:${this.CURRENT_HOST_BACKEND_PORT}`;
821
- //#endregion
822
- return void 0;
823
- }
824
- injectController(ctor,
825
- /**
826
- * optional override context
827
- */
828
- overrideCurrentContext) {
829
- return inject(() => {
830
- let currentContext;
831
- //#region @browser
832
- currentContext = overrideCurrentContext
833
- ? overrideCurrentContext
834
- : this.currentContext;
835
- //#endregion
836
- if (!currentContext) {
837
- throw new Error('No context available. Make sure to initialize the context before injecting controllers.');
838
- }
839
- return currentContext ? currentContext.getClass(ctor) : void 0;
840
- });
841
- }
842
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseAngularsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
843
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseAngularsService }); }
844
- }
845
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseAngularsService, decorators: [{
846
- type: Injectable
847
- }], ctorParameters: () => [] });
848
-
849
- // ! TODO make it as a nice way to wrap normal request
850
- class TaonRestResponseWrapper extends RestResponseWrapper {
851
- }
852
- const BaseTaonClassesNames = [
853
- 'BaseCrudController',
854
- 'BaseController',
855
- 'BaseAbstractEntity',
856
- 'BaseEntity',
857
- 'BaseContext',
858
- 'BaseCustomRepository',
859
- 'BaseFileUploadMiddleware',
860
- 'BaseMiddleware',
861
- 'BaseClass',
862
- 'BaseInjector',
863
- 'BaseMigration',
864
- 'BaseProvider',
865
- 'BaseRepository',
866
- 'BaseSubscriberForEntity',
867
- 'BaseCliWorkerController',
868
- 'PortsController',
869
- 'PortsContext',
870
- ];
871
- const TaonTempDatabasesFolder = 'databases';
872
- const TaonTempRoutesFolder = 'routes';
873
- var Models;
874
- (function (Models) {
875
- Models.DatabasesFolder = TaonTempDatabasesFolder;
876
- //#region models / class types
877
- let ClassType;
878
- (function (ClassType) {
879
- ClassType["ENTITY"] = "ENTITY";
880
- ClassType["CONTROLLER"] = "CONTROLLER";
881
- ClassType["REPOSITORY"] = "REPOSITORY";
882
- ClassType["PROVIDER"] = "PROVIDER";
883
- ClassType["SUBSCRIBER"] = "SUBSCRIBER";
884
- ClassType["MIGRATION"] = "MIGRATION";
885
- ClassType["MIDDLEWARE"] = "MIDDLEWARE";
886
- })(ClassType = Models.ClassType || (Models.ClassType = {}));
887
- Models.ClassTypeKey = {
888
- [ClassType.ENTITY]: 'entities',
889
- [ClassType.CONTROLLER]: 'controllers',
890
- [ClassType.REPOSITORY]: 'repositories',
891
- [ClassType.PROVIDER]: 'providers',
892
- [ClassType.SUBSCRIBER]: 'subscribers',
893
- [ClassType.MIGRATION]: 'migrations',
894
- [ClassType.MIDDLEWARE]: 'middlewares',
518
+ classFun?.constructor?.name === 'Object') {
519
+ return Utils.uniqArray(allMethodsNames);
520
+ }
521
+ return ClassHelpers.getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
895
522
  };
896
523
  //#endregion
897
- //#region models / database connection options
898
- class DatabaseConfigTypeOrm {
899
- }
900
- Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
901
- //#endregion
902
- //#region models / database config
903
- class DatabaseConfig extends DatabaseConfigTypeOrm {
904
- static from(databasePartialConfig) {
905
- return _.merge(new DatabaseConfig(), databasePartialConfig);
524
+ //#region get controller configs
525
+ ClassHelpers.getControllerConfigs = (target, configs = [], callerTarget) => {
526
+ if (!_.isFunction(target)) {
527
+ throw `[typescript-class-helper][getControllerConfigs] Cannot get class config from: ${target}`;
906
528
  }
907
- get databaseConfigTypeORM() {
908
- //#region @websqlFunc
909
- const result = _.cloneDeep(this);
910
- if (result.recreateMode) {
911
- if (result.recreateMode === 'DROP_DB+MIGRATIONS') {
912
- result.synchronize = true;
913
- result.dropSchema = true;
914
- }
915
- else if (result.recreateMode === 'PRESERVE_DATA+MIGRATIONS') {
916
- result.synchronize = false;
917
- result.dropSchema = false;
529
+ let config;
530
+ const parentClass = Object.getPrototypeOf(target);
531
+ const parentName = parentClass ? ClassHelpers.getName(parentClass) : void 0;
532
+ const isValidParent = _.isFunction(parentClass) && parentName !== '';
533
+ config = controllerConfigFrom(ClassHelpers.getClassConfig(target));
534
+ configs.push(config);
535
+ return isValidParent
536
+ ? ClassHelpers.getControllerConfigs(parentClass, configs, target)
537
+ : configs;
538
+ };
539
+ //#endregion
540
+ //#region ensure configs
541
+ // Ensure ClassConfig on constructor, clone parent if needed
542
+ ClassHelpers.ensureClassConfig = (target) => {
543
+ let cfg = Reflect.getOwnMetadata(Symbols.metadata.options.controller, // META_KEYS.class,
544
+ target);
545
+ if (!cfg) {
546
+ cfg = { methods: {} };
547
+ const parent = Object.getPrototypeOf(target);
548
+ if (parent && parent !== Function.prototype) {
549
+ const parentCfg = Reflect.getMetadata(Symbols.metadata.options.controller, // META_KEYS.class,
550
+ parent);
551
+ if (parentCfg) {
552
+ // Deep copy each method config so child gets its own objects
553
+ const clonedMethods = {};
554
+ for (const [k, v] of Object.entries(parentCfg.methods)) {
555
+ clonedMethods[k] = {
556
+ ...v,
557
+ parameters: { ...v.parameters }, // shallow clone parameters too
558
+ };
559
+ }
560
+ cfg = {
561
+ ...parentCfg,
562
+ methods: clonedMethods,
563
+ };
918
564
  }
919
565
  }
920
- delete result.recreateMode;
921
- return result;
922
- //#endregion
566
+ Reflect.defineMetadata(Symbols.metadata.options.controller, cfg, target);
923
567
  }
924
- }
925
- Models.DatabaseConfig = DatabaseConfig;
926
- //#endregion
927
- //#region models / http
928
- let Http;
929
- (function (Http) {
930
- Http.Rest = Models$1;
931
- //#endregion
932
- })(Http = Models.Http || (Models.Http = {}));
568
+ return cfg;
569
+ };
570
+ // Ensure MethodConfig inside ClassConfig
571
+ ClassHelpers.ensureMethodConfig = (target, propertyKey) => {
572
+ const classCfg = ClassHelpers.ensureClassConfig(target.constructor);
573
+ let methodCfg = classCfg.methods[propertyKey?.toString()];
574
+ if (!methodCfg) {
575
+ methodCfg = { methodName: propertyKey?.toString(), parameters: {} };
576
+ classCfg.methods[propertyKey?.toString()] = methodCfg;
577
+ }
578
+ return methodCfg;
579
+ };
580
+ ClassHelpers.getClassConfig = (constructor) => {
581
+ return Reflect.getMetadata(Symbols.metadata.options.controller, constructor);
582
+ };
933
583
  //#endregion
934
- })(Models || (Models = {}));
584
+ })(ClassHelpers || (ClassHelpers = {}));
935
585
 
936
586
  //#region imports
937
587
  class ContextDbMigrations {
@@ -5381,11 +5031,575 @@ const createContextFn = (configFn, cloneOptions) => {
5381
5031
  return res;
5382
5032
  };
5383
5033
  //#endregion
5384
- const createContext = (configFn) => {
5385
- return createContextFn(configFn, { useAsRemoteContext: false });
5034
+ const createContext = (configFn) => {
5035
+ return createContextFn(configFn, { useAsRemoteContext: false });
5036
+ };
5037
+ // const AA = createContext(() => ({ contextName: 'aa' }));
5038
+ // const BB = AA.cloneAsRemoteContext();
5039
+
5040
+ const inject = (entity) => {
5041
+ return new Proxy({}, {
5042
+ get: (_, propName) => {
5043
+ if (propName === 'hasOwnProperty') {
5044
+ return () => false;
5045
+ }
5046
+ const ctor = entity();
5047
+ const contextFromClass = ctor[Symbols.ctxInClassOrClassObj];
5048
+ const resultContext = contextFromClass;
5049
+ if (resultContext) {
5050
+ let instance = resultContext.inject(ctor, {
5051
+ parentInstanceThatWillGetInjectedStuff: this,
5052
+ });
5053
+ // console.log('instance', instance);
5054
+ if (propName === 'getOriginalPrototype') {
5055
+ return () => Object.getPrototypeOf(instance);
5056
+ }
5057
+ if (propName === 'getOriginalConstructor') {
5058
+ return () => instance.constructor;
5059
+ }
5060
+ const methods = ctor[Symbols.classMethodsNames] || [];
5061
+ const isMethods = methods.includes(propName);
5062
+ const methodOrProperty = isMethods
5063
+ ? instance[propName].bind(instance)
5064
+ : instance[propName];
5065
+ // console.log(
5066
+ // `methodOrProperty from proxy ${propName?.toString()} = isMethods:${isMethods}`,
5067
+ // methods,
5068
+ // );
5069
+ return methodOrProperty;
5070
+ }
5071
+ },
5072
+ });
5073
+ };
5074
+ // export const injectController = inject;
5075
+ // export type SubscriptionEvent<T> = {
5076
+ // name: keyof T;
5077
+ // data: any;
5078
+ // };
5079
+ /**
5080
+ * TODO
5081
+ */
5082
+ // export const injectEntityEvents = <T>(
5083
+ // subscriberClassResolveFn: () => new (...args: any[]) => T,
5084
+ // eventName?: keyof Omit<EntitySubscriberInterface,'listenTo'> ,
5085
+ // ): Observable<SubscriptionEvent<T>> => {
5086
+ // const eventsSrc = new Subject<SubscriptionEvent<T>>();
5087
+ // const obs = eventsSrc.asObservable();
5088
+ // let isFirstSubscription = true;
5089
+ // const proxyObservable = new Proxy(obs, {
5090
+ // get(target, prop, receiver) {
5091
+ // if (prop === 'subscribe') {
5092
+ // return (...args: any[]) => {
5093
+ // if (isFirstSubscription) {
5094
+ // isFirstSubscription = false;
5095
+ // const subscriberClassFN: typeof TaonBaseClass =
5096
+ // subscriberClassResolveFn() as any;
5097
+ // const ctx = subscriberClassFN[
5098
+ // Symbols.ctxInClassOrClassObj
5099
+ // ] as EndpointContext;
5100
+ // if (!ctx) {
5101
+ // throw new Error(
5102
+ // `You are trying to inject class without context. Use context like this:
5103
+ // class MyClassSubscriber extends BaseSubscriber {
5104
+ // ${eventName as any}() {
5105
+ // \/\/ your code here
5106
+ // }
5107
+ // }
5108
+ // Taon.injectSubscriberEvents( MyContext.getInstance(()=> MyClassSubscriber), '${eventName as any}' )
5109
+ // `,
5110
+ // );
5111
+ // }
5112
+ // const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
5113
+ // // subscriberInstance TODO @LAST subscriber event from instance
5114
+ // // const entity = subscriberClassFN.prototype.listenTo();
5115
+ // console.log('First subscription, you can access arguments here:', {
5116
+ // subscriberClassFN,
5117
+ // eventName,
5118
+ // });
5119
+ // }
5120
+ // return target.subscribe(...args);
5121
+ // };
5122
+ // }
5123
+ // return Reflect.get(target, prop, receiver);
5124
+ // },
5125
+ // });
5126
+ // return proxyObservable as Observable<SubscriptionEvent<T>>;
5127
+ // };
5128
+
5129
+ //#region imports
5130
+ //#endregion
5131
+ //#region get transform function
5132
+ /**
5133
+ * @deprecated
5134
+ */
5135
+ const getTransformFunction = (target) => {
5136
+ if (!target) {
5137
+ return;
5138
+ }
5139
+ // const className = ClassHelpers.getName(target)
5140
+ // target = ClassHelpers.getBy(className);
5141
+ if (!target) {
5142
+ return void 0;
5143
+ }
5144
+ const configs = ClassHelpers.getControllerConfigs(target);
5145
+ // console.log(`CONFIGS TO CHECK`, configs)
5146
+ const functions = configs
5147
+ .map(c => {
5148
+ if (_.isFunction(c.browserTransformFn)) {
5149
+ return c.browserTransformFn;
5150
+ }
5151
+ })
5152
+ .filter(f => _.isFunction(f));
5153
+ return functions.length === 0
5154
+ ? void 0
5155
+ : function (entity) {
5156
+ for (let index = functions.length - 1; index >= 0; index--) {
5157
+ const transformFun = functions[index];
5158
+ transformFun(entity);
5159
+ }
5160
+ return entity;
5161
+ };
5162
+ };
5163
+ //#endregion
5164
+ //#region single transform
5165
+ /**
5166
+ * @deprecated
5167
+ */
5168
+ const singleTransform = (json) => {
5169
+ let ptarget = ClassHelpers.getClassFnFromObject(json);
5170
+ let pbrowserTransformFn = getTransformFunction(ptarget);
5171
+ if (pbrowserTransformFn) {
5172
+ const newValue = pbrowserTransformFn(json);
5173
+ if (!_.isObject(newValue)) {
5174
+ console.error(`Please return object in transform function for class: ` +
5175
+ `${ClassHelpers.getName(json)}`);
5176
+ }
5177
+ else {
5178
+ json = newValue;
5179
+ }
5180
+ }
5181
+ return json;
5182
+ };
5183
+ //#endregion
5184
+ class EntityProcess {
5185
+ //#region init
5186
+ static async init(result, response) {
5187
+ return await new EntityProcess(result, response).run();
5188
+ }
5189
+ //#endregion
5190
+ //#region constructor
5191
+ constructor(
5192
+ /**
5193
+ * Data from backend
5194
+ */
5195
+ result, response) {
5196
+ this.result = result;
5197
+ this.response = response;
5198
+ /**
5199
+ * Say yes to:
5200
+ * - circural object
5201
+ * - transform browser fn in decorator
5202
+ */
5203
+ this.advancedManipulation = false;
5204
+ this.circural = [];
5205
+ }
5206
+ //#endregion
5207
+ //#region check advanced manipulation
5208
+ checkAdvancedManiupulation() {
5209
+ if (_.isFunction(this.result)) {
5210
+ this.advancedManipulation = true;
5211
+ this.result = this.result();
5212
+ }
5213
+ }
5214
+ //#endregion
5215
+ //#region run
5216
+ async run() {
5217
+ this.checkAdvancedManiupulation();
5218
+ this.data = this.result;
5219
+ if (_.isObject(this.result)) {
5220
+ if (this.advancedManipulation) {
5221
+ this.applayTransformFn();
5222
+ }
5223
+ this.setHeaders();
5224
+ }
5225
+ this.send();
5226
+ }
5227
+ //#endregion
5228
+ //#region apply transform function
5229
+ applayTransformFn() {
5230
+ if (_.isObject(this.data) && !_.isArray(this.data)) {
5231
+ this.data = singleTransform(this.data);
5232
+ }
5233
+ const { include } = { include: [] };
5234
+ walk.Object(this.data, (value, lodashPath, changeValue, { skipObject, isCircural }) => {
5235
+ // console.log(`${isCircural ? 'CIR' : 'NOT'} : ${lodashPath}`)
5236
+ if (!isCircural) {
5237
+ if (!_.isArray(value) && _.isObject(value)) {
5238
+ changeValue(singleTransform(value));
5239
+ }
5240
+ }
5241
+ }, { checkCircural: true, breadthWalk: true, include });
5242
+ const { circs } = walk.Object(this.data, void 0, {
5243
+ checkCircural: true,
5244
+ breadthWalk: true,
5245
+ include,
5246
+ });
5247
+ this.circural = circs;
5248
+ }
5249
+ //#endregion
5250
+ //#region set headers
5251
+ setHeaders() {
5252
+ const { include } = { include: [] };
5253
+ const className = ClassHelpers.getName(this.data);
5254
+ const doNothing = _.isNil(this.data) ||
5255
+ [
5256
+ 'Object',
5257
+ '',
5258
+ // void 0, null // TODO not sure about commenting this
5259
+ ].includes(className);
5260
+ // console.log('doNothing', doNothing)
5261
+ if (!doNothing) {
5262
+ const cleaned = JSON10.cleaned(this.data, void 0, {
5263
+ breadthWalk: true,
5264
+ include,
5265
+ });
5266
+ this.entityMapping = Mapping.decode(cleaned, !this.advancedManipulation);
5267
+ this.response.set(Symbols.old.MAPPING_CONFIG_HEADER, JSON.stringify(this.entityMapping));
5268
+ if (this.advancedManipulation) {
5269
+ this.response.set(Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, JSON.stringify(this.circural));
5270
+ }
5271
+ }
5272
+ }
5273
+ //#endregion
5274
+ //#region send
5275
+ send() {
5276
+ if (this.advancedManipulation) {
5277
+ const browserKey = config.folder.browser;
5278
+ let toSend = _.isArray(this.data) ? [] : {};
5279
+ const { include = [], exclude = [] } = { include: [], exclude: [] };
5280
+ walk.Object(this.data, (value, lodashPath, changeVAlue, { isCircural, skipObject }) => {
5281
+ // console.log(`${isCircural ? 'CIR' : 'NOT'} ${lodashPath}`)
5282
+ if (isCircural) {
5283
+ _.set(toSend, lodashPath, null);
5284
+ }
5285
+ else {
5286
+ const fun = getTransformFunction(ClassHelpers.getClassFnFromObject(value));
5287
+ if (_.isFunction(fun)) {
5288
+ _.set(toSend, `${lodashPath}.${browserKey}`, value[browserKey]);
5289
+ const indexProp = ClassHelpers.getUniqueKey(value);
5290
+ _.set(toSend, `${lodashPath}.${indexProp}`, value[indexProp]);
5291
+ // skipObject()
5292
+ }
5293
+ else {
5294
+ _.set(toSend, lodashPath, value);
5295
+ }
5296
+ }
5297
+ }, { checkCircural: true, breadthWalk: true, include });
5298
+ if (!_.isArray(this.data)) {
5299
+ let funParent = getTransformFunction(ClassHelpers.getClassFnFromObject(this.data));
5300
+ // if (this.mdc && this.mdc.exclude && this.mdc.exclude.length > 0) {
5301
+ // console.log(`funParent !!! have fun? ${!!funParent} `)
5302
+ // }
5303
+ if (_.isFunction(funParent)) {
5304
+ toSend = {
5305
+ [browserKey]: toSend[browserKey],
5306
+ };
5307
+ }
5308
+ Object.keys(this.data).forEach(prop => {
5309
+ if (prop !== browserKey) {
5310
+ const v = this.data[prop];
5311
+ if (!((include.length > 0 && !include.includes(prop)) ||
5312
+ (exclude.length > 0 && exclude.includes(prop)))) {
5313
+ if (ClassHelpers.isContextClassObject(v) &&
5314
+ _.isFunction(getTransformFunction(ClassHelpers.getClassFnFromObject(v)))) {
5315
+ toSend[prop] = {
5316
+ [browserKey]: v[browserKey],
5317
+ };
5318
+ const indexProp = ClassHelpers.getUniqueKey(v);
5319
+ toSend[prop][indexProp] = this.data[prop][indexProp];
5320
+ for (const key in v) {
5321
+ if (_.isObject(v) &&
5322
+ v.hasOwnProperty(key) &&
5323
+ ![indexProp, config.folder.browser].includes(key) &&
5324
+ (_.isString(v[key]) ||
5325
+ _.isNumber(v[key]) ||
5326
+ _.isDate(v[key]) ||
5327
+ _.isNull(v[key]) ||
5328
+ _.isBoolean(v[key]))) {
5329
+ toSend[prop][key] = v[key];
5330
+ }
5331
+ }
5332
+ }
5333
+ else {
5334
+ toSend[prop] = v;
5335
+ }
5336
+ }
5337
+ }
5338
+ });
5339
+ }
5340
+ // toSend = Helpers.JSON.cleaned(toSend, void 0, { breadthWalk: true })
5341
+ this.response.json(toSend);
5342
+ }
5343
+ else {
5344
+ this.response.json(this.data);
5345
+ }
5346
+ }
5347
+ }
5348
+
5349
+ /**
5350
+ * 100 default characters varchar
5351
+ */
5352
+ const StringColumn = (defaultValue = null, length = 100) => Column({
5353
+ type: 'varchar',
5354
+ length,
5355
+ nullable: _.isNil(defaultValue),
5356
+ default: defaultValue,
5357
+ });
5358
+ /**
5359
+ * 100 characters varchar
5360
+ */
5361
+ const String100Column = (defaultValue = null) => Column({
5362
+ type: 'varchar',
5363
+ length: 100,
5364
+ nullable: _.isNil(defaultValue),
5365
+ default: defaultValue,
5366
+ });
5367
+ /**
5368
+ * 100 characters varchar
5369
+ */
5370
+ const String45Column = (defaultValue = null) => Column({
5371
+ type: 'varchar',
5372
+ length: 45,
5373
+ nullable: _.isNil(defaultValue),
5374
+ default: defaultValue,
5375
+ });
5376
+ /**
5377
+ * 500 characters varchar
5378
+ */
5379
+ const String500Column = (defaultValue = null) => Column({
5380
+ type: 'varchar',
5381
+ length: 500,
5382
+ nullable: _.isNil(defaultValue),
5383
+ default: defaultValue,
5384
+ });
5385
+ /**
5386
+ * 200 characters varchar
5387
+ */
5388
+ const String200Column = (defaultValue = null) => Column({
5389
+ type: 'varchar',
5390
+ length: 200,
5391
+ nullable: _.isNil(defaultValue),
5392
+ default: defaultValue,
5393
+ });
5394
+ const NumberColumn = () => Column({ type: 'int', nullable: true });
5395
+ const DecimalNumberColumn = () => Column({ type: 'float', nullable: true });
5396
+ const SimpleJsonColumn = () => Column({ type: 'simple-json', nullable: true });
5397
+ const BooleanColumn = (defaultValue) => Column({ type: 'boolean', nullable: true, default: defaultValue });
5398
+ const DateTImeColumn = (defaultValue = null) => Column({ type: 'datetime', nullable: true, default: defaultValue });
5399
+
5400
+ // TODO new 5.8 typescript is not allowing this
5401
+ // export namespace Orm {
5402
+ // export const Repository = tsorm.Repository;
5403
+ // export import Connection = tsorm.Connection;
5404
+ // export namespace ListenEvent {
5405
+ // export import AfterInsert = tsorm.AfterInsert;
5406
+ // export import AfterLoad = tsorm.AfterLoad;
5407
+ // export import AfterRecover = tsorm.AfterRecover;
5408
+ // export import AfterRemove = tsorm.AfterRemove;
5409
+ // export import AfterSoftRemove = tsorm.AfterSoftRemove;
5410
+ // export import AfterUpdate = tsorm.AfterUpdate;
5411
+ // export import BeforeInsert = tsorm.BeforeInsert;
5412
+ // export import BeforeRecover = tsorm.BeforeRecover;
5413
+ // export import BeforeRemove = tsorm.BeforeRemove;
5414
+ // export import BeforeSoftRemove = tsorm.BeforeSoftRemove;
5415
+ // export import BeforeUpdate = tsorm.BeforeUpdate;
5416
+ // }
5417
+ // export namespace Tree {
5418
+ // export import Children = tsorm.TreeChildren;
5419
+ // export import Parent = tsorm.TreeParent;
5420
+ // }
5421
+ // export namespace Column {
5422
+ // export import Generated = tsorm.PrimaryGeneratedColumn;
5423
+ // export import Primary = tsorm.PrimaryColumn;
5424
+ // export import Index = tsorm.Index;
5425
+ // export import CreateDate = tsorm.CreateDateColumn;
5426
+ // export import UpdateDate = tsorm.UpdateDateColumn;
5427
+ // export import DeleteDate = tsorm.DeleteDateColumn;
5428
+ // export import Custom = tsorm.Column;
5429
+ // export import String = additionalColumns.StringColumn;
5430
+ // export import String100 = additionalColumns.String100Column;
5431
+ // export import String45 = additionalColumns.String45Column;
5432
+ // export import String500 = additionalColumns.String500Column;
5433
+ // export import String200 = additionalColumns.String200Column;
5434
+ // export import Number = additionalColumns.NumberColumn;
5435
+ // export import DecimalNumber = additionalColumns.DecimalNumberColumn;
5436
+ // export import SimpleJson = additionalColumns.SimpleJsonColumn;
5437
+ // export import Boolean = additionalColumns.BooleanColumn;
5438
+ // export import DateTIme = additionalColumns.DateTImeColumn;
5439
+ // // TODO has limitation => comma in name
5440
+ // // export const SimpleArray = () => tsorm.Column({ type: 'simple-array', nullable: true });
5441
+ // export import Version = tsorm.VersionColumn;
5442
+ // export import Virtual = tsorm.VirtualColumn;
5443
+ // }
5444
+ // export namespace Join {
5445
+ // export import Table = tsorm.JoinTable;
5446
+ // export import Column = tsorm.JoinColumn;
5447
+ // }
5448
+ // export namespace Relation {
5449
+ // export import OneToMany = tsorm.OneToMany;
5450
+ // export import OneToOne = tsorm.OneToOne;
5451
+ // export import ManyToMany = tsorm.ManyToMany;
5452
+ // export import ManyToOne = tsorm.ManyToOne;
5453
+ // }
5454
+ // }
5455
+
5456
+ const cloneObj = (override, classFn) => {
5457
+ const result = _.merge(new classFn(), _.cloneDeep(this));
5458
+ walk.Object(override || {}, (value, lodashPath) => {
5459
+ if (_.isNil(value) || _.isFunction(value) || _.isObject(value)) {
5460
+ // skipping
5461
+ }
5462
+ else {
5463
+ _.set(result, lodashPath, value);
5464
+ }
5465
+ }, {
5466
+ walkGetters: false,
5467
+ });
5468
+ // console.log({result})
5469
+ return result;
5470
+ };
5471
+
5472
+ //#endregion
5473
+ class TaonBaseClass {
5474
+ //#region class initialization hook
5475
+ /**
5476
+ * class initialization hook
5477
+ * taon after class instance creation
5478
+ */
5479
+ async _() { }
5480
+ //#endregion
5481
+ //#region clone
5482
+ /**
5483
+ *
5484
+ * @param overrideObjOrFn if object is provided it will override values in cloned object,
5485
+ * if function is provided it will be called with old cloned values and should return
5486
+ * object with values to override
5487
+ * @returns cloned instance of the class
5488
+ */
5489
+ clone(overrideObjOrFn) {
5490
+ if (_.isString(overrideObjOrFn)) {
5491
+ console.log(overrideObjOrFn);
5492
+ throw new Error('String is not supported as .clone() method argument');
5493
+ }
5494
+ const classFn = ClassHelpers.getClassFnFromObject(this);
5495
+ if (_.isFunction(overrideObjOrFn)) {
5496
+ // console.log('clone with fn');
5497
+ const oldValues = (_.cloneDeep(this) || {});
5498
+ return cloneObj(overrideObjOrFn(oldValues), classFn);
5499
+ }
5500
+ // console.log('clone normal');
5501
+ return cloneObj(overrideObjOrFn, classFn);
5502
+ }
5503
+ }
5504
+
5505
+ //#region @websql
5506
+ let TaonBaseEntity = class TaonBaseEntity extends TaonBaseClass {
5507
+ /**
5508
+ * simple check if relation is ok
5509
+ */
5510
+ relation(relationName) {
5511
+ return relationName;
5512
+ }
5513
+ /**
5514
+ * simple check if relation is ok
5515
+ */
5516
+ relations(relationNames) {
5517
+ return relationNames;
5518
+ }
5386
5519
  };
5387
- // const AA = createContext(() => ({ contextName: 'aa' }));
5388
- // const BB = AA.cloneAsRemoteContext();
5520
+ TaonBaseEntity = __decorate([
5521
+ Entity()
5522
+ //#endregion
5523
+ ], TaonBaseEntity);
5524
+
5525
+ //#region @websql
5526
+ let TaonBaseAbstractEntity = class TaonBaseAbstractEntity extends TaonBaseEntity {
5527
+ };
5528
+ __decorate([
5529
+ PrimaryGeneratedColumn()
5530
+ //#endregion
5531
+ ,
5532
+ __metadata("design:type", String)
5533
+ ], TaonBaseAbstractEntity.prototype, "id", void 0);
5534
+ __decorate([
5535
+ VersionColumn()
5536
+ //#endregion
5537
+ ,
5538
+ __metadata("design:type", Number)
5539
+ ], TaonBaseAbstractEntity.prototype, "version", void 0);
5540
+ TaonBaseAbstractEntity = __decorate([
5541
+ Entity()
5542
+ //#endregion
5543
+ ], TaonBaseAbstractEntity);
5544
+
5545
+ /**
5546
+ * TODO prevent calling methods when not initialized
5547
+ * with init(ctx)
5548
+ */
5549
+ //#region @browser
5550
+ //#endregion
5551
+ class TaonBaseAngularService {
5552
+ //#endregion
5553
+ constructor() {
5554
+ //#region @browser
5555
+ this.currentContext = inject$1(TAON_CONTEXT);
5556
+ //#region @browser
5557
+ this.CURRENT_HOST_BACKEND_PORT = inject$1(CURRENT_HOST_BACKEND_PORT, {
5558
+ optional: true,
5559
+ });
5560
+ this.CURRENT_HOST_URL = inject$1(CURRENT_HOST_URL, {
5561
+ optional: true,
5562
+ });
5563
+ // #endregion
5564
+ }
5565
+ /**
5566
+ * @deprecated
5567
+ * Returns the host URL for the backend service
5568
+ * that is running on localhost (normal NodeJS/ExpressJS mode).
5569
+ */
5570
+ get host() {
5571
+ //#region @browser
5572
+ if (this.CURRENT_HOST_URL) {
5573
+ return this.CURRENT_HOST_URL;
5574
+ }
5575
+ return `http://localhost:${this.CURRENT_HOST_BACKEND_PORT}`;
5576
+ //#endregion
5577
+ return void 0;
5578
+ }
5579
+ injectController(ctor,
5580
+ /**
5581
+ * optional override context
5582
+ */
5583
+ overrideCurrentContext) {
5584
+ return inject(() => {
5585
+ let currentContext;
5586
+ //#region @browser
5587
+ currentContext = overrideCurrentContext
5588
+ ? overrideCurrentContext
5589
+ : this.currentContext;
5590
+ //#endregion
5591
+ if (!currentContext) {
5592
+ throw new Error('No context available. Make sure to initialize the context before injecting controllers.');
5593
+ }
5594
+ return currentContext ? currentContext.getClass(ctor) : void 0;
5595
+ });
5596
+ }
5597
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5598
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService }); }
5599
+ }
5600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService, decorators: [{
5601
+ type: Injectable
5602
+ }], ctorParameters: () => [] });
5389
5603
 
5390
5604
  /**
5391
5605
  * Provider decorator
@@ -7075,22 +7289,401 @@ TaonBaseSubscriberForEntity = __decorate([
7075
7289
  })
7076
7290
  ], TaonBaseSubscriberForEntity);
7077
7291
 
7078
- var Base;
7079
- (function (Base) {
7080
- Base.Controller = TaonBaseController;
7081
- Base.CrudController = TaonBaseCrudController;
7082
- Base.Entity = TaonBaseEntity;
7083
- Base.AbstractEntity = TaonBaseAbstractEntity;
7084
- Base.Provider = TaonBaseProvider;
7085
- Base.Class = TaonBaseClass;
7086
- Base.Repository = TaonBaseRepository;
7087
- Base.CustomRepository = TaonBaseCustomRepository;
7088
- Base.SubscriberForEntity = TaonBaseSubscriberForEntity;
7089
- Base.Migration = TaonBaseMigration;
7090
- Base.Middleware = TaonBaseMiddleware;
7091
- Base.AngularService = BaseAngularsService;
7092
- Base.Context = TaonBaseContext;
7093
- })(Base || (Base = {}));
7292
+ //#region models / method config
7293
+ /**
7294
+ * @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
7295
+ */
7296
+ class MethodConfig {
7297
+ }
7298
+ //#endregion
7299
+
7300
+ // import { cloneObj } from '../helpers/clone-obj';
7301
+ class ParamConfig {
7302
+ }
7303
+
7304
+ class FormlyHorizontalWrapper extends FieldWrapper {
7305
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormlyHorizontalWrapper, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
7306
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: FormlyHorizontalWrapper, isStandalone: false, selector: "formly-horizontal-wrapper", viewQueries: [{ propertyName: "fieldComponent", first: true, predicate: ["fieldComponent"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: `
7307
+ <div class="form-group row">
7308
+ <label
7309
+ [attr.for]="id"
7310
+ class="col-sm-2 col-form-label"
7311
+ *ngIf="to.label">
7312
+ {{ to.label }}
7313
+ <ng-container *ngIf="to.required && to.hideRequiredMarker !== true"
7314
+ >*</ng-container
7315
+ >
7316
+ </label>
7317
+ <div class="col-sm-10">
7318
+ <ng-template #fieldComponent></ng-template>
7319
+ </div>
7320
+ </div>
7321
+ `, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px dotted gray}\n"] }); }
7322
+ }
7323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormlyHorizontalWrapper, decorators: [{
7324
+ type: Component,
7325
+ args: [{ selector: 'formly-horizontal-wrapper', standalone: false, template: `
7326
+ <div class="form-group row">
7327
+ <label
7328
+ [attr.for]="id"
7329
+ class="col-sm-2 col-form-label"
7330
+ *ngIf="to.label">
7331
+ {{ to.label }}
7332
+ <ng-container *ngIf="to.required && to.hideRequiredMarker !== true"
7333
+ >*</ng-container
7334
+ >
7335
+ </label>
7336
+ <div class="col-sm-10">
7337
+ <ng-template #fieldComponent></ng-template>
7338
+ </div>
7339
+ </div>
7340
+ `, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px dotted gray}\n"] }]
7341
+ }], propDecorators: { fieldComponent: [{
7342
+ type: ViewChild,
7343
+ args: ['fieldComponent', { read: ViewContainerRef }]
7344
+ }] } });
7345
+
7346
+ /*
7347
+
7348
+ DON'T FORGET
7349
+ ...
7350
+ FormlyModule.forRoot({
7351
+ types: [
7352
+ { name: 'repeat', component: RepeatTypeComponent },
7353
+ ],
7354
+ }),
7355
+ ...
7356
+
7357
+ */
7358
+ class RepeatTypeComponent extends FieldArrayType {
7359
+ get labelTemplate() {
7360
+ // @ts-ignore
7361
+ return this.field.fieldArray.templateOptions.label; // TODO QUICK_FIX
7362
+ }
7363
+ constructor(builder) {
7364
+ // TODO QUICK_FIX
7365
+ // @ts-ignore
7366
+ super(builder);
7367
+ }
7368
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RepeatTypeComponent, deps: [{ token: i1.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
7369
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: RepeatTypeComponent, isStandalone: false, selector: "formly-repeat-section", usesInheritance: true, ngImport: i0, template: `
7370
+ <div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
7371
+ Press button to add new element...
7372
+ </div>
7373
+ <div
7374
+ *ngFor="let field of field.fieldGroup; let i = index"
7375
+ class="taon-formly-array">
7376
+ <formly-group
7377
+ [model]="model[i]"
7378
+ [field]="field"
7379
+ [options]="options"
7380
+ [form]="formControl">
7381
+ <div>
7382
+ <button
7383
+ class="btn btn-danger"
7384
+ type="button"
7385
+ (click)="remove(i)">
7386
+ Remove
7387
+ </button>
7388
+ </div>
7389
+ </formly-group>
7390
+ </div>
7391
+ <div>
7392
+ <button
7393
+ class="btn btn-primary"
7394
+ type="button"
7395
+ (click)="add()">
7396
+ {{ labelTemplate }}
7397
+ </button>
7398
+ </div>
7399
+ `, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px solid gray}formly-group{display:block;border:1px dashed gray;margin-bottom:5px;padding:5px}.taon-formly-array{padding:5px;background:#fff}\n"] }); }
7400
+ }
7401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RepeatTypeComponent, decorators: [{
7402
+ type: Component,
7403
+ args: [{ selector: 'formly-repeat-section', standalone: false, template: `
7404
+ <div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
7405
+ Press button to add new element...
7406
+ </div>
7407
+ <div
7408
+ *ngFor="let field of field.fieldGroup; let i = index"
7409
+ class="taon-formly-array">
7410
+ <formly-group
7411
+ [model]="model[i]"
7412
+ [field]="field"
7413
+ [options]="options"
7414
+ [form]="formControl">
7415
+ <div>
7416
+ <button
7417
+ class="btn btn-danger"
7418
+ type="button"
7419
+ (click)="remove(i)">
7420
+ Remove
7421
+ </button>
7422
+ </div>
7423
+ </formly-group>
7424
+ </div>
7425
+ <div>
7426
+ <button
7427
+ class="btn btn-primary"
7428
+ type="button"
7429
+ (click)="add()">
7430
+ {{ labelTemplate }}
7431
+ </button>
7432
+ </div>
7433
+ `, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px solid gray}formly-group{display:block;border:1px dashed gray;margin-bottom:5px;padding:5px}.taon-formly-array{padding:5px;background:#fff}\n"] }]
7434
+ }], ctorParameters: () => [{ type: i1.FormlyFormBuilder }] });
7435
+
7436
+ function findTypeForEntity(entity, isArray = false) {
7437
+ if (!_.isArray(RegisterComponentType.prototype.types)) {
7438
+ RegisterComponentType.prototype.types = [];
7439
+ }
7440
+ return getRegisteredComponents().find(c => c.entity === entity && c.isArray === isArray);
7441
+ }
7442
+ function typeFromEntity(component, entity) {
7443
+ const isArray = _.isArray(entity);
7444
+ if (isArray) {
7445
+ entity = _.first(entity);
7446
+ }
7447
+ let name = ClassHelpers.getName(component);
7448
+ let res = { name, component, entity, isArray };
7449
+ // console.log(res);
7450
+ return res;
7451
+ }
7452
+ function typeFromName(component, name) {
7453
+ let res = { name, component };
7454
+ return res;
7455
+ }
7456
+ function RegisterComponentTypeForEntity(entity) {
7457
+ if (!_.isArray(RegisterComponentType.prototype.types)) {
7458
+ RegisterComponentType.prototype.types = [];
7459
+ }
7460
+ return function (target, propertyKey, descriptor) {
7461
+ RegisterComponentType.prototype.types.push(typeFromEntity(target, entity));
7462
+ };
7463
+ }
7464
+ function RegisterComponentType(className, ...optionslNames) {
7465
+ if (!_.isArray(RegisterComponentType.prototype.types)) {
7466
+ RegisterComponentType.prototype.types = [];
7467
+ }
7468
+ return function (target, propertyKey, descriptor) {
7469
+ ClassHelpers.setName(target, className);
7470
+ RegisterComponentType.prototype.types.push(typeFromEntity(target));
7471
+ optionslNames.forEach(name => {
7472
+ RegisterComponentType.prototype.types.push(typeFromName(target, name));
7473
+ });
7474
+ };
7475
+ }
7476
+ // RegisterComponentType.prototype.types = []
7477
+ function getRegisteredComponents() {
7478
+ let registered = RegisterComponentType.prototype.types;
7479
+ if (!Array.isArray(registered)) {
7480
+ return [];
7481
+ }
7482
+ // console.log(registered)
7483
+ return registered;
7484
+ }
7485
+
7486
+ function getFromlyConfigFor(target, options = {}) {
7487
+ const { formType = 'material', keysPathesToExclude = [], keysPathesToInclude = [], parentModel, relativePath = '', level = 0, maxLevel = 4, } = options;
7488
+ if (level === maxLevel) {
7489
+ return [];
7490
+ }
7491
+ const mapping = Mapping.getModelsMapping(target);
7492
+ // console.log('mapping', mapping)
7493
+ const fieldNames = CLASS.describeProperites(target);
7494
+ const checkExclude = _.isArray(keysPathesToExclude) && keysPathesToExclude.length > 0;
7495
+ const checkInclude = _.isArray(keysPathesToInclude) && keysPathesToInclude.length > 0;
7496
+ if (checkExclude && checkInclude) {
7497
+ throw new Error(`In Taon function getFromlyConfigFor(...) please use keysPathesToInclude or keysPathesToExclude, `);
7498
+ }
7499
+ // if (checkInclude) {
7500
+ // console.log('check include', keysPathesToExclude)
7501
+ // }
7502
+ // if (checkExclude) {
7503
+ // console.log('check exclude', keysPathesToExclude)
7504
+ // }
7505
+ let fields = [];
7506
+ //#region input to push
7507
+ function inputToPush(key, type, model, inptToPushOptions) {
7508
+ const { targetChild, selectOptions } = inptToPushOptions || {};
7509
+ // console.log(`key(${key}) type: ${type} | model: ${model} targetChild: ${targetChild && targetChild.name}`)
7510
+ let res;
7511
+ if (type === 'repeat') {
7512
+ const fieldGroup = getFromlyConfigFor(targetChild, {
7513
+ formType,
7514
+ keysPathesToInclude,
7515
+ keysPathesToExclude,
7516
+ relativePath: `${relativePath}.${key}`,
7517
+ level: level + 1,
7518
+ maxLevel,
7519
+ });
7520
+ if (fieldGroup.length > 0) {
7521
+ res = {
7522
+ key,
7523
+ type,
7524
+ defaultValue: [],
7525
+ fieldArray: {
7526
+ fieldGroupClassName: 'row',
7527
+ templateOptions: {
7528
+ label: `Add new ${_.startCase(key)}`,
7529
+ },
7530
+ fieldGroup,
7531
+ },
7532
+ };
7533
+ }
7534
+ }
7535
+ else if (type === 'group') {
7536
+ const fieldGroup = getFromlyConfigFor(targetChild, {
7537
+ formType,
7538
+ keysPathesToInclude,
7539
+ keysPathesToExclude,
7540
+ parentModel: model,
7541
+ relativePath: `${relativePath}.${key}`,
7542
+ level: level + 1,
7543
+ maxLevel,
7544
+ });
7545
+ if (fieldGroup.length > 0) {
7546
+ res = {
7547
+ fieldGroupClassName: 'row',
7548
+ templateOptions: {
7549
+ label: `${_.startCase(key)}`,
7550
+ },
7551
+ wrappers: ['groupwrap'],
7552
+ fieldGroup,
7553
+ };
7554
+ }
7555
+ }
7556
+ else {
7557
+ res = {
7558
+ key,
7559
+ model,
7560
+ type,
7561
+ defaultValue: !_.isUndefined(target.prototype[key])
7562
+ ? target.prototype[key]
7563
+ : undefined,
7564
+ templateOptions: {
7565
+ label: _.isString(model)
7566
+ ? `${model
7567
+ .split('.')
7568
+ .map(l => _.startCase(l))
7569
+ .join(' / ')} / ${_.startCase(key)}`
7570
+ : _.startCase(key),
7571
+ options: selectOptions,
7572
+ },
7573
+ };
7574
+ }
7575
+ if (res) {
7576
+ Object.keys(res).forEach(key => res[key] === undefined ? delete res[key] : '');
7577
+ }
7578
+ return res;
7579
+ }
7580
+ //#endregion
7581
+ //#region is allowed path
7582
+ function isAlowedPath(key) {
7583
+ let isAlowed = true;
7584
+ const matchPath = relativePath === '' ? key : `${relativePath}:${key}`;
7585
+ if (checkExclude) {
7586
+ if (keysPathesToExclude.includes(matchPath)) {
7587
+ // console.log(`Not allowed key: ${key}`)
7588
+ isAlowed = false;
7589
+ }
7590
+ else {
7591
+ isAlowed = true;
7592
+ }
7593
+ }
7594
+ else if (checkInclude) {
7595
+ if (keysPathesToInclude.includes(matchPath)) {
7596
+ // console.log(`Allowed key: ${key}`)
7597
+ isAlowed = true;
7598
+ }
7599
+ else {
7600
+ isAlowed = false;
7601
+ }
7602
+ }
7603
+ // console.log(`Is allowed;${matchPath} `, isAlowed)
7604
+ return isAlowed;
7605
+ }
7606
+ //#endregion
7607
+ const simpleResolved = [];
7608
+ //#region resolve simple types
7609
+ function resolveSimpleTypes() {
7610
+ for (const key in target.prototype) {
7611
+ if (target.prototype.hasOwnProperty(key) &&
7612
+ !_.isFunction(target.prototype[key])) {
7613
+ if (!isAlowedPath(key)) {
7614
+ continue;
7615
+ }
7616
+ if (!_.isUndefined(mapping[key])) {
7617
+ continue;
7618
+ }
7619
+ const element = target.prototype[key];
7620
+ let type = 'input';
7621
+ if (_.isBoolean(element)) {
7622
+ type = 'switch';
7623
+ }
7624
+ else if (_.isDate(element)) {
7625
+ type = 'datepicker';
7626
+ }
7627
+ else if (_.isFunction(target['getOptionsFor'])) {
7628
+ var selectOptions = target['getOptionsFor'](key);
7629
+ if (!_.isUndefined(selectOptions)) {
7630
+ type = 'select';
7631
+ }
7632
+ }
7633
+ else if (_.isFunction(target.prototype?.getOptionsFor)) {
7634
+ var selectOptions = target.prototype?.getOptionsFor(key);
7635
+ if (!_.isUndefined(selectOptions)) {
7636
+ type = 'select';
7637
+ }
7638
+ }
7639
+ fields.push(inputToPush(key, type, parentModel, { selectOptions }));
7640
+ simpleResolved.push(key);
7641
+ }
7642
+ }
7643
+ }
7644
+ //#endregion
7645
+ //#region resolve complex types
7646
+ function resolveComplexTypes() {
7647
+ fieldNames
7648
+ .filter(key => !simpleResolved.includes(key))
7649
+ .forEach(key => {
7650
+ if (isAlowedPath(key) && !_.isUndefined(mapping[key])) {
7651
+ let className = mapping[key];
7652
+ const isArray = _.isArray(className);
7653
+ className = isArray ? _.first(className) : className;
7654
+ if (className === 'Date') {
7655
+ fields.push(inputToPush(key, 'datepicker', parentModel));
7656
+ }
7657
+ else {
7658
+ const targetChild = CLASS.getBy(className);
7659
+ if (targetChild) {
7660
+ const ftype = findTypeForEntity(targetChild, isArray);
7661
+ if (ftype) {
7662
+ fields = fields.concat(inputToPush(key, ftype.name, key));
7663
+ }
7664
+ else {
7665
+ if (isArray) {
7666
+ fields = fields.concat(inputToPush(key, 'repeat', key, { targetChild }));
7667
+ }
7668
+ else {
7669
+ fields = fields.concat(inputToPush(key, 'group', key, { targetChild }));
7670
+ }
7671
+ }
7672
+ }
7673
+ }
7674
+ }
7675
+ });
7676
+ }
7677
+ //#endregion
7678
+ function generate() {
7679
+ resolveSimpleTypes();
7680
+ // console.log('after simple', fields);
7681
+ resolveComplexTypes();
7682
+ // console.log('after complext', fields);
7683
+ }
7684
+ generate();
7685
+ return fields.filter(f => !!f);
7686
+ }
7094
7687
 
7095
7688
  /**
7096
7689
  * Entity decorator
@@ -7140,26 +7733,6 @@ function TaonProvider(options) {
7140
7733
  class TaonProviderOptions extends DecoratorAbstractOpt {
7141
7734
  }
7142
7735
 
7143
- var Http;
7144
- (function (Http) {
7145
- Http.GET = GET;
7146
- Http.POST = POST;
7147
- Http.PUT = PUT;
7148
- Http.DELETE = DELETE;
7149
- Http.PATCH = PATCH;
7150
- Http.HEAD = HEAD;
7151
- Http.HTML = HTML;
7152
- Http.Response = Models$1.HttpResponse;
7153
- let Param;
7154
- (function (Param) {
7155
- Param.Query = Query;
7156
- Param.Path = Path;
7157
- Param.Body = Body;
7158
- Param.Cookie = Cookie;
7159
- Param.Header = Header;
7160
- })(Param = Http.Param || (Http.Param = {}));
7161
- })(Http || (Http = {}));
7162
-
7163
7736
  // TODO export all things
7164
7737
  var Taon;
7165
7738
  (function (Taon) {
@@ -7173,18 +7746,16 @@ var Taon;
7173
7746
  return opt;
7174
7747
  };
7175
7748
  };
7176
- Taon.Http = Http;
7177
- Taon.Base = Base;
7178
- Taon.Orm = Orm;
7179
7749
  Taon.getResponseValue = getResponseValue;
7180
7750
  //#region class decorators
7181
- Taon.Controller = TaonController;
7182
- Taon.Entity = TaonEntity;
7183
- Taon.Provider = TaonProvider;
7184
- Taon.Repository = TaonRepository;
7185
- Taon.Subscriber = TaonSubscriber;
7186
- Taon.Migration = TaonMigration;
7187
- Taon.Middleware = TaonMiddleware;
7751
+ // TODO new 5.8 typescript is not allowing this
7752
+ // export import Controller = controllerDecorator.TaonController;
7753
+ // export import Entity = entityDecorator.TaonEntity;
7754
+ // export import Provider = providerDecorator.TaonProvider;
7755
+ // export import Repository = repositoryDecorator.TaonRepository;
7756
+ // export import Subscriber = subscriberDecorator.TaonSubscriber;
7757
+ // export import Migration = migrationDecorator.TaonMigration;
7758
+ // export import Middleware = middlewareDecorator.TaonMiddleware;
7188
7759
  //#endregion
7189
7760
  //#region aliases to helpers
7190
7761
  Taon.isBrowser = coreHelpers.Helpers.isBrowser;
@@ -7221,10 +7792,107 @@ var Taon;
7221
7792
  return context;
7222
7793
  };
7223
7794
  })(Taon || (Taon = {}));
7795
+ //#region taon flattening map
7796
+ const TAON_FLATTEN_MAPPING = {
7797
+ 'taon/src': {
7798
+ // =====================
7799
+ // Taon.Http.*
7800
+ // =====================
7801
+ 'Taon.Http.GET': 'GET',
7802
+ 'Taon.Http.POST': 'POST',
7803
+ 'Taon.Http.PUT': 'PUT',
7804
+ 'Taon.Http.DELETE': 'DELETE',
7805
+ 'Taon.Http.PATCH': 'PATCH',
7806
+ 'Taon.Http.HEAD': 'HEAD',
7807
+ 'Taon.Http.HTML': 'HTML',
7808
+ 'Taon.Http.Response': 'HttpResponse',
7809
+ 'Taon.Http.Param.Query': 'Query',
7810
+ 'Taon.Http.Param.Path': 'Path',
7811
+ 'Taon.Http.Param.Body': 'Body',
7812
+ 'Taon.Http.Param.Cookie': 'Cookie',
7813
+ 'Taon.Http.Param.Header': 'Header',
7814
+ // =====================
7815
+ // Taon.Base.*
7816
+ // =====================
7817
+ 'Taon.Base.Controller': 'TaonBaseController',
7818
+ 'Taon.Base.CrudController': 'TaonBaseCrudController',
7819
+ 'Taon.Base.Entity': 'TaonBaseEntity',
7820
+ 'Taon.Base.AbstractEntity': 'TaonBaseAbstractEntity',
7821
+ 'Taon.Base.AbstractEntityOmitKeys': 'AbstractEntityOmitKeys',
7822
+ 'Taon.Base.Provider': 'TaonBaseProvider',
7823
+ 'Taon.Base.Class': 'TaonBaseClass',
7824
+ 'Taon.Base.Repository': 'TaonBaseRepository',
7825
+ 'Taon.Base.CustomRepository': 'TaonBaseCustomRepository',
7826
+ 'Taon.Base.SubscriberForEntity': 'TaonBaseSubscriberForEntity',
7827
+ 'Taon.Base.Migration': 'TaonBaseMigration',
7828
+ 'Taon.Base.Middleware': 'TaonBaseMiddleware',
7829
+ 'Taon.Base.AngularService': 'TaonBaseAngularService',
7830
+ 'Taon.Base.Context': 'TaonBaseContext',
7831
+ // =====================
7832
+ // Taon.Controller.* (decorators)
7833
+ // =====================
7834
+ 'Taon.Controller': 'TaonController',
7835
+ 'Taon.Entity': 'TaonEntity',
7836
+ 'Taon.Provider': 'TaonProvider',
7837
+ 'Taon.Repository': 'TaonRepository',
7838
+ 'Taon.Subscriber': 'TaonSubscriber',
7839
+ 'Taon.Migration': 'TaonMigration',
7840
+ 'Taon.Middleware': 'TaonMiddleware',
7841
+ // =====================
7842
+ // Taon.Orm.*
7843
+ // =====================
7844
+ 'Taon.Orm.Repository': 'Repository',
7845
+ 'Taon.Orm.Connection': 'Connection',
7846
+ // ListenEvent
7847
+ 'Taon.Orm.ListenEvent.AfterInsert': 'AfterInsert',
7848
+ 'Taon.Orm.ListenEvent.AfterLoad': 'AfterLoad',
7849
+ 'Taon.Orm.ListenEvent.AfterRecover': 'AfterRecover',
7850
+ 'Taon.Orm.ListenEvent.AfterRemove': 'AfterRemove',
7851
+ 'Taon.Orm.ListenEvent.AfterSoftRemove': 'AfterSoftRemove',
7852
+ 'Taon.Orm.ListenEvent.AfterUpdate': 'AfterUpdate',
7853
+ 'Taon.Orm.ListenEvent.BeforeInsert': 'BeforeInsert',
7854
+ 'Taon.Orm.ListenEvent.BeforeRecover': 'BeforeRecover',
7855
+ 'Taon.Orm.ListenEvent.BeforeRemove': 'BeforeRemove',
7856
+ 'Taon.Orm.ListenEvent.BeforeSoftRemove': 'BeforeSoftRemove',
7857
+ 'Taon.Orm.ListenEvent.BeforeUpdate': 'BeforeUpdate',
7858
+ // Tree
7859
+ 'Taon.Orm.Tree.Children': 'TreeChildren',
7860
+ 'Taon.Orm.Tree.Parent': 'TreeParent',
7861
+ // Column
7862
+ 'Taon.Orm.Column.Generated': 'Generated',
7863
+ 'Taon.Orm.Column.Primary': 'PrimaryColumn',
7864
+ 'Taon.Orm.Column.Index': 'Index',
7865
+ 'Taon.Orm.Column.CreateDate': 'CreateDateColumn',
7866
+ 'Taon.Orm.Column.UpdateDate': 'UpdateDateColumn',
7867
+ 'Taon.Orm.Column.DeleteDate': 'DeleteDateColumn',
7868
+ 'Taon.Orm.Column.Custom': 'Column',
7869
+ 'Taon.Orm.Column.String': 'StringColumn',
7870
+ 'Taon.Orm.Column.String100': 'String100Column',
7871
+ 'Taon.Orm.Column.String45': 'String45Column',
7872
+ 'Taon.Orm.Column.String500': 'String500Column',
7873
+ 'Taon.Orm.Column.String200': 'String200Column',
7874
+ 'Taon.Orm.Column.Number': 'NumberColumn',
7875
+ 'Taon.Orm.Column.DecimalNumber': 'DecimalNumberColumn',
7876
+ 'Taon.Orm.Column.SimpleJson': 'SimpleJsonColumn',
7877
+ 'Taon.Orm.Column.Boolean': 'BooleanColumn',
7878
+ 'Taon.Orm.Column.DateTIme': 'DateTimeColumn',
7879
+ 'Taon.Orm.Column.Version': 'VersionColumn',
7880
+ 'Taon.Orm.Column.Virtual': 'VirtualColumn',
7881
+ // Join
7882
+ 'Taon.Orm.Join.Table': 'JoinTable',
7883
+ 'Taon.Orm.Join.Column': 'JoinColumn',
7884
+ // Relation
7885
+ 'Taon.Orm.Relation.OneToMany': 'OneToMany',
7886
+ 'Taon.Orm.Relation.OneToOne': 'OneToOne',
7887
+ 'Taon.Orm.Relation.ManyToMany': 'ManyToMany',
7888
+ 'Taon.Orm.Relation.ManyToOne': 'ManyToOne',
7889
+ },
7890
+ };
7891
+ //#endregion
7224
7892
 
7225
7893
  /**
7226
7894
  * Generated bundle index. Do not edit.
7227
7895
  */
7228
7896
 
7229
- export { BaseTaonClassesNames, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextsEndpointStorage, EndpointContext, Models, TAON_CONTEXT, Taon, TaonAdminService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonEntityKeysToOmitArr, TaonTempDatabasesFolder, TaonTempRoutesFolder, apiPrefix, createContext, inject };
7230
- //# sourceMappingURL=taon.mjs.map
7897
+ export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTImeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String45Column, String500Column, StringColumn, Symbols, TAON_CONTEXT, TAON_FLATTEN_MAPPING, Taon, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Validators, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
7898
+ //# sourceMappingURL=taon-websql.mjs.map