taon 19.0.86 → 21.0.6

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 (194) hide show
  1. package/browser/fesm2022/taon.mjs +1953 -1238
  2. package/browser/fesm2022/taon.mjs.map +1 -1
  3. package/browser/package.json +1 -1
  4. package/browser/types/taon.d.ts +2152 -0
  5. package/lib/base-classes/base-abstract-entity.d.ts +1 -1
  6. package/lib/base-classes/base-abstract-entity.js +12 -12
  7. package/lib/base-classes/base-abstract-entity.js.map +1 -1
  8. package/lib/base-classes/base-angular-service.d.ts +1 -1
  9. package/lib/base-classes/base-angular-service.js +6 -3
  10. package/lib/base-classes/base-angular-service.js.map +1 -1
  11. package/lib/base-classes/base-context.d.ts +2 -2
  12. package/lib/base-classes/base-controller.js +7 -1
  13. package/lib/base-classes/base-controller.js.map +1 -1
  14. package/lib/base-classes/base-crud-controller.js +52 -12
  15. package/lib/base-classes/base-crud-controller.js.map +1 -1
  16. package/lib/base-classes/base-entity.js +2 -6
  17. package/lib/base-classes/base-entity.js.map +1 -1
  18. package/lib/base-classes/base-repository.d.ts +1 -1
  19. package/lib/base-classes/base-repository.js +15 -10
  20. package/lib/base-classes/base-repository.js.map +1 -1
  21. package/lib/base-classes/base.d.ts +1 -46
  22. package/lib/base-classes/base.js +17 -30
  23. package/lib/base-classes/base.js.map +1 -1
  24. package/lib/build-info._auto-generated_.d.ts +1 -1
  25. package/lib/build-info._auto-generated_.js +1 -1
  26. package/lib/build-info._auto-generated_.js.map +1 -1
  27. package/lib/create-context.d.ts +4 -4
  28. package/lib/decorators/classes/entity-decorator.js +1 -1
  29. package/lib/decorators/classes/entity-decorator.js.map +1 -1
  30. package/lib/decorators/http/http-decorators.d.ts +1 -19
  31. package/lib/decorators/http/http-decorators.js +20 -22
  32. package/lib/decorators/http/http-decorators.js.map +1 -1
  33. package/lib/endpoint-context.d.ts +2 -2
  34. package/lib/formly/{formly-group-wrapper-component.d.ts → formly-group-wrapper.component.d.ts} +1 -1
  35. package/lib/formly/{formly-repeat-component.d.ts → formly-repeat.component.d.ts} +1 -1
  36. package/lib/formly/fromly.js +24 -24
  37. package/lib/formly/fromly.js.map +1 -1
  38. package/lib/index.d.ts +146 -45
  39. package/lib/index.js +166 -55
  40. package/lib/index.js.map +1 -1
  41. package/lib/orm/columns.d.ts +28 -0
  42. package/lib/orm/columns.js +102 -0
  43. package/lib/orm/columns.js.map +1 -0
  44. package/lib/orm/index.d.ts +1 -0
  45. package/lib/orm/index.js +73 -0
  46. package/lib/orm/index.js.map +1 -0
  47. package/lib/realtime/realtime-core.d.ts +1 -1
  48. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +1 -2
  49. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -1
  50. package/lib/realtime/realtime-strategy/realtime-strategy.d.ts +1 -1
  51. package/lib/realtime/realtime-subs-manager.d.ts +1 -1
  52. package/lib/symbols.d.ts +31 -31
  53. package/lib/symbols.js +59 -59
  54. package/lib/symbols.js.map +1 -1
  55. package/lib/ui/index.js +2 -2
  56. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  57. package/package.json +6 -6
  58. package/websql/fesm2022/taon.mjs +1316 -648
  59. package/websql/fesm2022/taon.mjs.map +1 -1
  60. package/websql/package.json +1 -1
  61. package/websql/types/taon.d.ts +2161 -0
  62. package/browser/index.d.ts +0 -6
  63. package/browser/lib/base-classes/base-abstract-entity.d.ts +0 -8
  64. package/browser/lib/base-classes/base-angular-service.d.ts +0 -34
  65. package/browser/lib/base-classes/base-class.d.ts +0 -16
  66. package/browser/lib/base-classes/base-context.d.ts +0 -21
  67. package/browser/lib/base-classes/base-controller.d.ts +0 -83
  68. package/browser/lib/base-classes/base-crud-controller.d.ts +0 -29
  69. package/browser/lib/base-classes/base-custom-repository.d.ts +0 -4
  70. package/browser/lib/base-classes/base-entity.d.ts +0 -17
  71. package/browser/lib/base-classes/base-file-upload.middleware.d.ts +0 -15
  72. package/browser/lib/base-classes/base-injector.d.ts +0 -68
  73. package/browser/lib/base-classes/base-middleware.d.ts +0 -39
  74. package/browser/lib/base-classes/base-migration.d.ts +0 -12
  75. package/browser/lib/base-classes/base-provider.d.ts +0 -9
  76. package/browser/lib/base-classes/base-repository.d.ts +0 -267
  77. package/browser/lib/base-classes/base-subscriber-for-entity.d.ts +0 -82
  78. package/browser/lib/base-classes/base.d.ts +0 -47
  79. package/browser/lib/config/controller-config.d.ts +0 -22
  80. package/browser/lib/config/controller-options.d.ts +0 -17
  81. package/browser/lib/config/method-config.d.ts +0 -40
  82. package/browser/lib/config/param-config.d.ts +0 -9
  83. package/browser/lib/constants.d.ts +0 -10
  84. package/browser/lib/context-db-migrations.d.ts +0 -18
  85. package/browser/lib/create-context.d.ts +0 -79
  86. package/browser/lib/decorators/classes/controller-decorator.d.ts +0 -6
  87. package/browser/lib/decorators/classes/entity-decorator.d.ts +0 -20
  88. package/browser/lib/decorators/classes/middleware-decorator.d.ts +0 -8
  89. package/browser/lib/decorators/classes/migration-decorator.d.ts +0 -8
  90. package/browser/lib/decorators/classes/provider-decorator.d.ts +0 -8
  91. package/browser/lib/decorators/classes/repository-decorator.d.ts +0 -8
  92. package/browser/lib/decorators/classes/subscriber-decorator.d.ts +0 -9
  93. package/browser/lib/decorators/decorator-abstract-opt.d.ts +0 -4
  94. package/browser/lib/decorators/http/http-decorators.d.ts +0 -21
  95. package/browser/lib/decorators/http/http-methods-decorators.d.ts +0 -71
  96. package/browser/lib/decorators/http/http-params-decorators.d.ts +0 -9
  97. package/browser/lib/dependency-injection/di-container.d.ts +0 -6
  98. package/browser/lib/endpoint-context-storage.d.ts +0 -12
  99. package/browser/lib/endpoint-context.d.ts +0 -198
  100. package/browser/lib/entity-process.d.ts +0 -40
  101. package/browser/lib/get-response-value.d.ts +0 -7
  102. package/browser/lib/helpers/class-helpers.d.ts +0 -25
  103. package/browser/lib/helpers/clone-obj.d.ts +0 -2
  104. package/browser/lib/helpers/taon-helpers.d.ts +0 -19
  105. package/browser/lib/index.d.ts +0 -129
  106. package/browser/lib/inject.d.ts +0 -5
  107. package/browser/lib/models.d.ts +0 -257
  108. package/browser/lib/orm.d.ts +0 -3
  109. package/browser/lib/realtime/realtime-client.d.ts +0 -42
  110. package/browser/lib/realtime/realtime-core.d.ts +0 -41
  111. package/browser/lib/realtime/realtime-server.d.ts +0 -44
  112. package/browser/lib/realtime/realtime-strategy/index.d.ts +0 -5
  113. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -82
  114. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -15
  115. package/browser/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
  116. package/browser/lib/realtime/realtime-strategy/realtime-strategy.d.ts +0 -12
  117. package/browser/lib/realtime/realtime-subs-manager.d.ts +0 -15
  118. package/browser/lib/realtime/realtime.models.d.ts +0 -28
  119. package/browser/lib/symbols.d.ts +0 -66
  120. package/browser/lib/ui/index.d.ts +0 -2
  121. package/browser/lib/ui/taon-admin-mode-configuration/index.d.ts +0 -2
  122. package/browser/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +0 -22
  123. package/browser/lib/validators.d.ts +0 -8
  124. package/browser/public-api.d.ts +0 -2
  125. package/lib/formly/formly-group-wrapper-component.js +0 -51
  126. package/lib/formly/formly-group-wrapper-component.js.map +0 -1
  127. package/lib/formly/formly-repeat-component.js +0 -95
  128. package/lib/formly/formly-repeat-component.js.map +0 -1
  129. package/lib/orm.d.ts +0 -68
  130. package/lib/orm.js +0 -112
  131. package/lib/orm.js.map +0 -1
  132. package/websql/index.d.ts +0 -6
  133. package/websql/lib/base-classes/base-abstract-entity.d.ts +0 -8
  134. package/websql/lib/base-classes/base-angular-service.d.ts +0 -34
  135. package/websql/lib/base-classes/base-class.d.ts +0 -16
  136. package/websql/lib/base-classes/base-context.d.ts +0 -21
  137. package/websql/lib/base-classes/base-controller.d.ts +0 -83
  138. package/websql/lib/base-classes/base-crud-controller.d.ts +0 -29
  139. package/websql/lib/base-classes/base-custom-repository.d.ts +0 -4
  140. package/websql/lib/base-classes/base-entity.d.ts +0 -17
  141. package/websql/lib/base-classes/base-file-upload.middleware.d.ts +0 -15
  142. package/websql/lib/base-classes/base-injector.d.ts +0 -68
  143. package/websql/lib/base-classes/base-middleware.d.ts +0 -39
  144. package/websql/lib/base-classes/base-migration.d.ts +0 -12
  145. package/websql/lib/base-classes/base-provider.d.ts +0 -9
  146. package/websql/lib/base-classes/base-repository.d.ts +0 -272
  147. package/websql/lib/base-classes/base-subscriber-for-entity.d.ts +0 -82
  148. package/websql/lib/base-classes/base.d.ts +0 -47
  149. package/websql/lib/config/controller-config.d.ts +0 -22
  150. package/websql/lib/config/controller-options.d.ts +0 -17
  151. package/websql/lib/config/method-config.d.ts +0 -40
  152. package/websql/lib/config/param-config.d.ts +0 -9
  153. package/websql/lib/constants.d.ts +0 -10
  154. package/websql/lib/context-db-migrations.d.ts +0 -18
  155. package/websql/lib/create-context.d.ts +0 -79
  156. package/websql/lib/decorators/classes/controller-decorator.d.ts +0 -6
  157. package/websql/lib/decorators/classes/entity-decorator.d.ts +0 -20
  158. package/websql/lib/decorators/classes/middleware-decorator.d.ts +0 -8
  159. package/websql/lib/decorators/classes/migration-decorator.d.ts +0 -8
  160. package/websql/lib/decorators/classes/provider-decorator.d.ts +0 -8
  161. package/websql/lib/decorators/classes/repository-decorator.d.ts +0 -8
  162. package/websql/lib/decorators/classes/subscriber-decorator.d.ts +0 -9
  163. package/websql/lib/decorators/decorator-abstract-opt.d.ts +0 -4
  164. package/websql/lib/decorators/http/http-decorators.d.ts +0 -21
  165. package/websql/lib/decorators/http/http-methods-decorators.d.ts +0 -71
  166. package/websql/lib/decorators/http/http-params-decorators.d.ts +0 -9
  167. package/websql/lib/dependency-injection/di-container.d.ts +0 -6
  168. package/websql/lib/endpoint-context-storage.d.ts +0 -12
  169. package/websql/lib/endpoint-context.d.ts +0 -200
  170. package/websql/lib/entity-process.d.ts +0 -40
  171. package/websql/lib/get-response-value.d.ts +0 -7
  172. package/websql/lib/helpers/class-helpers.d.ts +0 -25
  173. package/websql/lib/helpers/clone-obj.d.ts +0 -2
  174. package/websql/lib/helpers/taon-helpers.d.ts +0 -19
  175. package/websql/lib/index.d.ts +0 -129
  176. package/websql/lib/inject.d.ts +0 -5
  177. package/websql/lib/models.d.ts +0 -261
  178. package/websql/lib/orm.d.ts +0 -69
  179. package/websql/lib/realtime/realtime-client.d.ts +0 -42
  180. package/websql/lib/realtime/realtime-core.d.ts +0 -41
  181. package/websql/lib/realtime/realtime-server.d.ts +0 -44
  182. package/websql/lib/realtime/realtime-strategy/index.d.ts +0 -5
  183. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -82
  184. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -15
  185. package/websql/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
  186. package/websql/lib/realtime/realtime-strategy/realtime-strategy.d.ts +0 -12
  187. package/websql/lib/realtime/realtime-subs-manager.d.ts +0 -15
  188. package/websql/lib/realtime/realtime.models.d.ts +0 -28
  189. package/websql/lib/symbols.d.ts +0 -66
  190. package/websql/lib/ui/index.d.ts +0 -2
  191. package/websql/lib/ui/taon-admin-mode-configuration/index.d.ts +0 -2
  192. package/websql/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +0 -22
  193. package/websql/lib/validators.d.ts +0 -8
  194. package/websql/public-api.d.ts +0 -2
@@ -0,0 +1,2161 @@
1
+ // @ts-nocheck
2
+ import * as taon from 'taon';
3
+ import * as express from 'express';
4
+ import express__default, { Request, Response, RequestHandler, Application } from 'express';
5
+ import * as i0 from '@angular/core';
6
+ import { NgZone, InjectionToken, ViewContainerRef } from '@angular/core';
7
+ import { Models as Models$1, RestResponseWrapper, TaonServerMiddlewareInterceptOptions, TaonClientMiddlewareInterceptOptions, HttpResponseError, RestErrorResponseWrapper, Mapping } from 'ng2-rest/websql';
8
+ export { TaonClientMiddlewareInterceptOptions, TaonServerMiddlewareInterceptOptions } from 'ng2-rest/websql';
9
+ import { Server } from 'http';
10
+ import { DataSource, Repository, SaveOptions, DeepPartial, QueryDeepPartialEntity, InsertResult, UpsertOptions, FindOptionsWhere, UpdateResult, FindManyOptions, FindOneOptions, QueryRunner, SelectQueryBuilder, Table, RelationPath, MigrationInterface, EntitySubscriberInterface, InsertEvent, UpdateEvent, RemoveEvent, SoftRemoveEvent, RecoverEvent, TransactionStartEvent, TransactionCommitEvent, TransactionRollbackEvent } from 'taon-typeorm/websql';
11
+ 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';
12
+ import { MySqlQuerySource } from 'taon-type-sql/websql';
13
+ import { CoreModels } from 'tnp-core/websql';
14
+ import { AxiosResponse } from 'axios';
15
+ import * as rxjs from 'rxjs';
16
+ import { Observable, Subscriber } from 'rxjs';
17
+ import * as multer from 'multer';
18
+ import * as _ngx_formly_core from '@ngx-formly/core';
19
+ import { FieldWrapper, FieldArrayType, FormlyFormBuilder, FormlyFieldConfig } from '@ngx-formly/core';
20
+ import { ServerOptions, Server as Server$1, DefaultEventsMap } from 'socket.io';
21
+ import { io, Socket } from 'socket.io-client';
22
+ import { ipcRenderer } from 'electron';
23
+
24
+ declare abstract class TaonBaseCustomRepository extends TaonBaseInjector {
25
+ }
26
+
27
+ declare abstract class TaonBaseRepository<Entity extends {
28
+ id?: any;
29
+ }> extends TaonBaseCustomRepository {
30
+ abstract entityClassResolveFn: () => any;
31
+ constructor(__entityClassResolveFn: () => any);
32
+ private __dbQuery;
33
+ get dbQuery(): MySqlQuerySource;
34
+ get connection(): DataSource;
35
+ protected get repository(): Repository<Entity>;
36
+ /**
37
+ * target for repository
38
+ */
39
+ get target(): Function;
40
+ /**
41
+ * alias to repository
42
+ */
43
+ protected get repo(): Repository<Entity>;
44
+ get repositoryExists(): boolean;
45
+ /**
46
+ * Checks if entity has an id.
47
+ * If entity composite compose ids, it will check them all.
48
+ */
49
+ hasId(entity: Entity): boolean;
50
+ /**
51
+ * Gets entity mixed id.
52
+ */
53
+ getId(entity: Entity): any;
54
+ /**
55
+ Saves a given entity in the database.
56
+ * If entity does not exist in the database then inserts, otherwise updates.
57
+ */
58
+ save(item: Entity, options?: SaveOptions & {
59
+ reload: false;
60
+ }): Promise<Entity>;
61
+ /**
62
+ * alias to save
63
+ * -> it will actuall create new entity in db
64
+ * in oposite to typeorm create method
65
+ */
66
+ /**
67
+ * Creates a new entity instance.
68
+ */
69
+ create(): Entity;
70
+ /**
71
+ * Creates new entities and copies all entity properties from given objects into their new entities.
72
+ * Note that it copies only properties that are present in entity schema.
73
+ */
74
+ create(entityLikeArray: DeepPartial<Entity>[]): Entity[];
75
+ /**
76
+ * Creates a new entity instance and copies all entity properties from this object into a new entity.
77
+ * Note that it copies only properties that are present in entity schema.
78
+ */
79
+ create(entityLike: DeepPartial<Entity>): Entity;
80
+ bulkSave(items: Entity[], options?: SaveOptions & {
81
+ reload: false;
82
+ }): Promise<Entity[]>;
83
+ /**
84
+ * @deprecated use bulkSave instead
85
+ */
86
+ bulkCreate(items: Entity[], options?: SaveOptions & {
87
+ reload: false;
88
+ }): Promise<Entity[]>;
89
+ /**
90
+ * Saves all given entities in the database.
91
+ * If entities do not exist in the database then inserts, otherwise updates.
92
+ */
93
+ /**
94
+ * Merges multiple entities (or entity-like objects) into a given entity.
95
+ */
96
+ merge(mergeIntoEntity: Entity, ...entityLikes: Entity[]): Entity;
97
+ /**
98
+ * Creates a new entity from the given plain javascript object. If entity already exist in the database, then
99
+ * it loads it (and everything related to it), replaces all values with the new ones from the given object
100
+ * and returns this new entity. This new entity is actually a loaded from the db entity with all properties
101
+ * replaced from the new object.
102
+ *
103
+ * Note that given entity-like object must have an entity id / primary key to find entity by.
104
+ * Returns undefined if entity with given id was not found.
105
+ */
106
+ preload(entityLike: Entity): Promise<Entity | undefined>;
107
+ /**
108
+ * Removes a given entities from the database.
109
+ */
110
+ remove(idOrEntity: number | string | Entity): Promise<Entity>;
111
+ /**
112
+ * alias to remove
113
+ */
114
+ delete(idOrEntity: number | string | Partial<Entity>): Promise<Entity>;
115
+ /**
116
+ * alias to removeById
117
+ */
118
+ deleteById(id: number | string): Promise<Entity>;
119
+ bulkRemove(idsOrEntities: (number | string | Entity)[]): Promise<Entity[]>;
120
+ bulkDelete(ids: (number | string | Entity)[]): Promise<Entity[]>;
121
+ /**
122
+ * Records the delete date of all given entities.
123
+ */
124
+ softRemove<T extends Entity>(entities: T[], options: SaveOptions & {
125
+ reload: false;
126
+ }): Promise<T[]>;
127
+ /**
128
+ * Records the delete date of all given entities.
129
+ */
130
+ softRemove<T extends Entity>(entities: T[], options?: SaveOptions): Promise<(T & Entity)[]>;
131
+ /**
132
+ * Records the delete date of a given entity.
133
+ */
134
+ softRemove<T extends Entity>(entity: T, options: SaveOptions & {
135
+ reload: false;
136
+ }): Promise<T>;
137
+ /**
138
+ * Recovers all given entities in the database.
139
+ */
140
+ recover<T extends Entity>(entities: T[], options: SaveOptions & {
141
+ reload: false;
142
+ }): Promise<T[]>;
143
+ /**
144
+ * Recovers all given entities in the database.
145
+ */
146
+ recover<T extends Entity>(entities: T[], options?: SaveOptions): Promise<(T & Entity)[]>;
147
+ /**
148
+ * Recovers a given entity in the database.
149
+ */
150
+ recover<T extends Entity>(entity: T, options: SaveOptions & {
151
+ reload: false;
152
+ }): Promise<T>;
153
+ /**
154
+ * Inserts a given entity into the database.
155
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
156
+ * Executes fast and efficient INSERT query.
157
+ * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
158
+ */
159
+ insert(entity: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[]): Promise<InsertResult>;
160
+ update(item: Entity): Promise<Entity>;
161
+ private allowedTypesToUpdate;
162
+ updateById<ENTITY = Entity>(id: number | string, item: Entity): Promise<ENTITY>;
163
+ bulkUpdate(items: Entity[]): Promise<{
164
+ models: any[];
165
+ }>;
166
+ /**
167
+ * Inserts a given entity into the database, unless a unique constraint conflicts then updates the entity
168
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
169
+ * Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
170
+ */
171
+ upsert(entityOrEntities: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[], conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult>;
172
+ /**
173
+ * Records the delete date of entities by a given criteria.
174
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
175
+ * Executes fast and efficient SOFT-DELETE query.
176
+ * Does not check if entity exist in the database.
177
+ */
178
+ softDelete(criteria: string | string[] | number | number[] | Date | Date[] | FindOptionsWhere<Entity>): Promise<UpdateResult>;
179
+ /**
180
+ * Restores entities by a given criteria.
181
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
182
+ * Executes fast and efficient SOFT-DELETE query.
183
+ * Does not check if entity exist in the database.
184
+ */
185
+ restore(criteria: string | string[] | number | number[] | Date | Date[] | FindOptionsWhere<Entity>): Promise<UpdateResult>;
186
+ /**
187
+ * Counts entities that match given options.
188
+ * Useful for pagination.
189
+ */
190
+ count(options?: FindManyOptions<Entity>): Promise<number>;
191
+ /**
192
+ * Counts entities that match given conditions.
193
+ * Useful for pagination.
194
+ */
195
+ countBy(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<number>;
196
+ /**
197
+ * Finds entities that match given find options.
198
+ */
199
+ find(options?: FindManyOptions<Entity>): Promise<Entity[]>;
200
+ /**
201
+ * Finds entities that match given find options.
202
+ */
203
+ findBy(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity[]>;
204
+ /**
205
+ * Finds entities that match given find options.
206
+ * Also counts all entities that match given conditions,
207
+ * but ignores pagination settings (from and take options).
208
+ */
209
+ findAndCount(options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;
210
+ /**
211
+ * Finds entities that match given WHERE conditions.
212
+ * Also counts all entities that match given conditions,
213
+ * but ignores pagination settings (from and take options).
214
+ */
215
+ findAndCountBy(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<[Entity[], number]>;
216
+ /**
217
+ * Finds entities with ids.
218
+ * Optionally find options or conditions can be applied.
219
+ *
220
+ * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
221
+ *
222
+ * .findBy({
223
+ * id: In([1, 2, 3])
224
+ * })
225
+ */
226
+ findByIds(ids: any[]): Promise<Entity[]>;
227
+ /**
228
+ * Finds first entity by a given find options.
229
+ * If entity was not found in the database - returns null.
230
+ */
231
+ findOne(options: FindOneOptions<Entity>): Promise<Entity | null>;
232
+ /**
233
+ * Finds first entity that matches given where condition.
234
+ * If entity was not found in the database - returns null.
235
+ */
236
+ findOneBy(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity | null>;
237
+ /**
238
+ * Finds first entity that matches given id.
239
+ * If entity was not found in the database - returns null.
240
+ *
241
+ * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:
242
+ *
243
+ * .findOneBy({
244
+ * id: 1 // where "id" is your primary column name
245
+ * })
246
+ */
247
+ findOneById(id: number | string | Date): Promise<Entity | null>;
248
+ /**
249
+ * Finds first entity by a given find options.
250
+ * If entity was not found in the database - rejects with error.
251
+ */
252
+ findOneOrFail(options: FindOneOptions<Entity>): Promise<Entity>;
253
+ /**
254
+ * Finds first entity that matches given where condition.
255
+ * If entity was not found in the database - rejects with error.
256
+ */
257
+ findOneByOrFail(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity>;
258
+ /**
259
+ * Executes a raw SQL query and returns a raw database results.
260
+ * Raw query execution is supported only by relational databases (MongoDB is not supported).
261
+ */
262
+ query(query: string, parameters?: any[]): Promise<any>;
263
+ /**
264
+ * Executes a raw SQL query and returns a raw database results.
265
+ * Raw query execution is supported only by relational databases (MongoDB is not supported).
266
+ */
267
+ createQueryBuilder(alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
268
+ /**
269
+ * Clears all the data from the given table/collection (truncates/drops it).
270
+ *
271
+ * Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
272
+ * @see https://stackoverflow.com/a/5972738/925151
273
+ */
274
+ clear(): Promise<void>;
275
+ /**
276
+ * Increments some column by provided value of the entities matched given conditions.
277
+ */
278
+ increment(conditions: FindOptionsWhere<Entity>, propertyPath: string, value: number | string): Promise<UpdateResult>;
279
+ /**
280
+ * Decrements some column by provided value of the entities matched given conditions.
281
+ */
282
+ decrement(conditions: FindOptionsWhere<Entity>, propertyPath: string, value: number | string): Promise<UpdateResult>;
283
+ /**
284
+ * @deprecated use findAndCount instead
285
+ */
286
+ getAll(): Promise<{
287
+ models: Entity[];
288
+ totalCount: number;
289
+ }>;
290
+ getBy(id: number | string): Promise<Entity>;
291
+ }
292
+
293
+ declare class TaonBaseInjector {
294
+ /**
295
+ * for proxy purposes
296
+ */
297
+ getOriginalPrototype: () => any;
298
+ /**
299
+ * for proxy purposes
300
+ */
301
+ getOriginalConstructor: () => any;
302
+ /**
303
+ * class initialization hook
304
+ * taon after class instace creation
305
+ */
306
+ _(): Promise<void>;
307
+ /**
308
+ * @deprecated use ctx instead
309
+ * Current endpoint context
310
+ */
311
+ get __endpoint_context__(): EndpointContext;
312
+ /**
313
+ * get current endpoint context
314
+ */
315
+ get ctx(): EndpointContext;
316
+ /**
317
+ * inject crud repo for entity
318
+ */
319
+ injectRepo<T>(entityForCrud: new (...args: any[]) => T): TaonBaseRepository<T>;
320
+ injectCustomRepository<T extends TaonBaseCustomRepository>(cutomRepositoryClass: new (...args: any[]) => T): T;
321
+ /**
322
+ * aliast to this.injectRepository()
323
+ */
324
+ injectCustomRepo<T extends TaonBaseCustomRepository>(cutomRepositoryClass: new (...args: any[]) => T): T;
325
+ /**
326
+ * example usage:
327
+ * ...
328
+ * exampleController = this.injectController(ExampleController);
329
+ * ...
330
+ */
331
+ injectController<T>(ctor: new (...args: any[]) => T): T;
332
+ /**
333
+ * example usage:
334
+ * ...
335
+ * exampleSubscriber = this.injectSubscriber(ExampleSubscriber)
336
+ * ...
337
+ */
338
+ injectSubscriber<T>(ctor: new (...args: any[]) => T): T;
339
+ /**
340
+ * aliast to .injectController()
341
+ */
342
+ injectCtrl<T>(ctor: new (...args: any[]) => T): T;
343
+ /**
344
+ * inject middleware for context
345
+ */
346
+ injectMiddleware<T>(ctor: new (...args: any[]) => T): T;
347
+ /**
348
+ * inject provider for context
349
+ */
350
+ injectProvider<T>(ctor: new (...args: any[]) => T): T;
351
+ /**
352
+ * Inject: Controllers, Providers, Repositories, Services, etc.
353
+ * TODO addd nest js injecting
354
+ */
355
+ private __inject;
356
+ }
357
+
358
+ type MigrationStatus = 'completed' | 'pending';
359
+ declare class ContextDbMigrations {
360
+ private ctx;
361
+ readonly DEFAULT_MIGRATION_TABLE_NAME = "TAON_MIGRATION_META";
362
+ readonly MIGRATION_STATUS_COMPLETED: MigrationStatus;
363
+ readonly MIGRATION_STATUS_PENDING: MigrationStatus;
364
+ readonly table: Table;
365
+ constructor(ctx: EndpointContext);
366
+ ensureMigrationTableExists(): Promise<void>;
367
+ private logSelectALl;
368
+ revertMigrationToTimestamp(timestamp: number): Promise<void>;
369
+ clearMigrationTable(): Promise<void>;
370
+ markAllMigrationsAsApplied(): Promise<void>;
371
+ runAllNotCompletedMigrations(): Promise<void>;
372
+ }
373
+
374
+ declare class ContextsEndpointStorage {
375
+ SPECIAL_APP_READY_MESSAGE: string;
376
+ private taonEndpointContexts;
377
+ private static instance;
378
+ private constructor();
379
+ static get Instance(): ContextsEndpointStorage;
380
+ set(context: EndpointContext): void;
381
+ get arr(): EndpointContext[];
382
+ getBy(context: Partial<EndpointContext> | string): EndpointContext | undefined;
383
+ }
384
+
385
+ declare class TaonRestResponseWrapper extends RestResponseWrapper {
386
+ }
387
+ declare const BaseTaonClassesNames: readonly ["BaseCrudController", "BaseController", "BaseAbstractEntity", "BaseEntity", "BaseContext", "BaseCustomRepository", "BaseFileUploadMiddleware", "BaseMiddleware", "BaseClass", "BaseInjector", "BaseMigration", "BaseProvider", "BaseRepository", "BaseSubscriberForEntity", "BaseCliWorkerController", "PortsController", "PortsContext"];
388
+ declare const TaonTempDatabasesFolder = "databases";
389
+ declare const TaonTempRoutesFolder = "routes";
390
+ declare namespace Models {
391
+ const DatabasesFolder = "databases";
392
+ type FrameworkMode = 'backend-frontend(tcp+udp)' | 'remote-backend(tcp+udp)' | 'backend-frontend(ipc-electron)' | 'backend-frontend(websql-electron)' | 'backend-frontend(websql)';
393
+ enum ClassType {
394
+ ENTITY = "ENTITY",
395
+ CONTROLLER = "CONTROLLER",
396
+ REPOSITORY = "REPOSITORY",
397
+ PROVIDER = "PROVIDER",
398
+ SUBSCRIBER = "SUBSCRIBER",
399
+ MIGRATION = "MIGRATION",
400
+ MIDDLEWARE = "MIDDLEWARE"
401
+ }
402
+ const ClassTypeKey: { [key in ClassType]: keyof ContextOptions<any, any, any, any, any, any, any, any>; };
403
+ type MiddlewareType = [Function, any[]];
404
+ /**
405
+ * DROP_DB+MIGRATIONS (default for development)
406
+ * Drop all tables + recreate them + run migrations
407
+ * synchronize: true , dropSchema: true
408
+ * use migrations: true
409
+ *
410
+ * MIGRATIONS (default for production)
411
+ * Do not drop tables, only run migrations
412
+ * synchronize: false, dropSchema: false
413
+ * use migrations: true
414
+ */
415
+ type DBRecreateMode = 'DROP_DB+MIGRATIONS' | 'PRESERVE_DATA+MIGRATIONS';
416
+ class DatabaseConfigTypeOrm {
417
+ /**
418
+ * database name
419
+ */
420
+ database?: string;
421
+ /**
422
+ * only for file base db: sqlite, sqljs
423
+ */
424
+ location?: string;
425
+ synchronize: boolean;
426
+ dropSchema: boolean;
427
+ type?: CoreModels.DatabaseType;
428
+ /**
429
+ * Persists db on disk/local-storage if serverless db
430
+ */
431
+ autoSave?: boolean;
432
+ /**
433
+ * for websql db mode
434
+ * true by default
435
+ */
436
+ useLocalForage?: boolean;
437
+ logging: boolean;
438
+ databasePort?: number;
439
+ databaseHost?: string;
440
+ databaseUsername?: string;
441
+ databasePassword?: string;
442
+ }
443
+ class DatabaseConfig extends DatabaseConfigTypeOrm {
444
+ /**
445
+ * Default value 'DROP_ALL'.
446
+ *
447
+ * Tell framework what is happening with db
448
+ * when context is starting.
449
+ */
450
+ recreateMode?: DBRecreateMode;
451
+ static from(databasePartialConfig: Partial<Omit<DatabaseConfig, 'synchronize' | 'dropSchema' | 'databaseConfigTypeORM'>>): DatabaseConfig;
452
+ get databaseConfigTypeORM(): DatabaseConfigTypeOrm;
453
+ }
454
+ type ISession = {
455
+ secret?: string;
456
+ saveUninitialized?: boolean;
457
+ /**
458
+ * max age of session
459
+ */
460
+ cookieMaxAge?: number;
461
+ secure?: boolean;
462
+ resave?: boolean;
463
+ };
464
+ type ConnectionOptionsLogs = {
465
+ http?: boolean;
466
+ realtime?: boolean;
467
+ framework?: boolean;
468
+ db?: boolean;
469
+ migrations?: boolean;
470
+ routes?: boolean;
471
+ };
472
+ interface ContextOptions<CONTEXTS, CONTROLLERS, ENTITIES, REPOSITORIES, PROVIDERS, SUBSCRIBERS, MIGRATIONS, MIDDLEWARES> {
473
+ appId?: string;
474
+ contextName: string;
475
+ /**
476
+ * if defined and different from contextName
477
+ * - context will NOT be initialized
478
+ */
479
+ activeContext?: string | null;
480
+ /**
481
+ * IMPORTANT! provide full url that starts with http:// or https://
482
+ * host/port for initing backend server
483
+ */
484
+ host?: string;
485
+ /**
486
+ * Needs to be specified in docker environment only
487
+ */
488
+ hostPortNumber?: number;
489
+ /**
490
+ * IMPORTANT! provide full url that starts with http:// or https://
491
+ * frontend host only needed when we are
492
+ * using withCredentials for axios
493
+ * and session cookie
494
+ * or realtime communication
495
+ */
496
+ frontendHost?: string;
497
+ /**
498
+ * Needs to be specified in docker environment only
499
+ */
500
+ frontendHostPortNumber?: number;
501
+ /**
502
+ * User ipc for communication between BE/FE
503
+ * when electron is used as a platform
504
+ * Default: true
505
+ */
506
+ useIpcWhenElectron?: boolean;
507
+ /**
508
+ * taon contexts here
509
+ * (module like structure)
510
+ */
511
+ contexts?: CONTEXTS;
512
+ /**
513
+ * taon controller here
514
+ * (glue between frontend and backend)
515
+ */
516
+ controllers?: CONTROLLERS;
517
+ /**
518
+ * taon entities
519
+ * (entities are used to create tables in db)
520
+ */
521
+ entities?: ENTITIES;
522
+ /**
523
+ * taon repositories
524
+ * (repositories are used to access data from db)
525
+ */
526
+ repositories?: REPOSITORIES;
527
+ /**
528
+ * taon providers
529
+ * (context singletons)
530
+ */
531
+ providers?: PROVIDERS;
532
+ /**
533
+ * taon subscribers
534
+ * (subscribers are used to listen to db events)
535
+ */
536
+ subscribers?: SUBSCRIBERS;
537
+ /**
538
+ * taon migrations
539
+ * (migrations are used to update db schema and achieve proper CI/CD)
540
+ */
541
+ migrations?: MIGRATIONS;
542
+ /**
543
+ * taon middlewares
544
+ * middlewares are used to intercept requests
545
+ * and responses in the context
546
+ */
547
+ middlewares?: MIDDLEWARES;
548
+ /**
549
+ * Config for express session
550
+ */
551
+ session?: ISession;
552
+ /**
553
+ * taon is not going to write .rest files to cwd()
554
+ */
555
+ skipWritingServerRoutes?: boolean;
556
+ /**
557
+ * TODO - this is still in progress
558
+ * @deprecated
559
+ */
560
+ productionMode?: boolean;
561
+ /**
562
+ * If you want your context to never be started as separated server
563
+ * use abstract: true
564
+ * @default: false
565
+ */
566
+ abstract?: boolean;
567
+ logs?: boolean | ConnectionOptionsLogs;
568
+ database?: boolean | Partial<DatabaseConfig>;
569
+ /**
570
+ * disable default realtime communication through TCP upgrade sockets
571
+ */
572
+ disabledRealtime?: boolean;
573
+ /**
574
+ * Will be removed soon - cloud will handle certs and https
575
+ * @deprecated
576
+ */
577
+ https?: {
578
+ key: string;
579
+ cert: string;
580
+ };
581
+ /**
582
+ * TODO - will be removed soon
583
+ * @deprecated
584
+ */
585
+ publicAssets?: {
586
+ serverPath: string;
587
+ locationOnDisk: string;
588
+ }[];
589
+ /**
590
+ * by default cwd === process.cwd()
591
+ */
592
+ cwd?: string;
593
+ }
594
+ namespace Http {
595
+ export import Rest = Models$1;
596
+ type ContextENDPOINT = {
597
+ target: Function;
598
+ initFN: Function;
599
+ };
600
+ type FormlyFromType = 'material' | 'bootstrap';
601
+ type ExpressContext<T> = (req: Request, res: Response) => T;
602
+ type SyncResponse<T> = string | T;
603
+ type ResponseFuncOpt<T> = {
604
+ limitSize?: (enties: Function | Function[], include: string[], exclude: string[]) => void;
605
+ };
606
+ type SyncResponseFunc<T> = (options?: ResponseFuncOpt<T>) => SyncResponse<T>;
607
+ type MixResponse<T> = SyncResponse<T> | ExpressContext<T>;
608
+ interface ClientAction<T> {
609
+ /**
610
+ * @deprecated use request() mehods instead
611
+ */
612
+ readonly received?: Rest.PromiseObservableMix<Rest.HttpResponse<T>>;
613
+ request?(axiosConfig?: Models$1.Ng2RestAxiosRequestConfig): Rest.PromiseObservableMix<Rest.HttpResponse<T>>;
614
+ }
615
+ interface AsyncResponse<T> {
616
+ (req?: Request, res?: Response): Promise<SyncResponse<T> | SyncResponseFunc<T>>;
617
+ }
618
+ type Response<T = string> = AsyncResponse<T> & ClientAction<T>;
619
+ interface AuthCallBack {
620
+ (methodReference: Function): RequestHandler;
621
+ }
622
+ }
623
+ interface StartParams {
624
+ port: number;
625
+ args: string[];
626
+ onlyMigrationRun?: boolean;
627
+ onlyMigrationRevertToTimestamp?: number;
628
+ }
629
+ interface TaonInitializeParams {
630
+ onlyMigrationRun?: boolean;
631
+ onlyMigrationRevertToTimestamp?: number;
632
+ }
633
+ interface TaonCtxCloneParams {
634
+ useAsRemoteContext?: boolean;
635
+ overrideRemoteHost?: string;
636
+ overrideHost?: string;
637
+ sourceContext?: EndpointContext;
638
+ }
639
+ }
640
+
641
+ declare class EndpointContext {
642
+ private originalConfig;
643
+ private configFn;
644
+ /**
645
+ * (@default: false)
646
+ * If TRUE context is NOT going to create db/express server/http endpoints
647
+ * PURPOSE OF THIS PROPERTY
648
+ * -> ONLY remote access from backend or frontend to specific backend
649
+ */
650
+ private readonly cloneOptions;
651
+ private static ngZone;
652
+ static initNgZone(ngZone: NgZone): void;
653
+ /**
654
+ * JUST FOR TESTING PURPOSES
655
+ */
656
+ readonly USE_MARIADB_MYSQL_IN_DOCKER: boolean;
657
+ disabledRealtime: boolean;
658
+ /**
659
+ * check whether context is inited
660
+ * (with init() function )
661
+ */
662
+ inited: boolean;
663
+ readonly dbMigrations: ContextDbMigrations;
664
+ private readonly localInstaceObjSymbol;
665
+ /**
666
+ * all instances of classes from context
667
+ * key is class name
668
+ */
669
+ readonly allClassesInstances: {};
670
+ private readonly classInstancesByNameObj;
671
+ private readonly objWithClassesInstancesArr;
672
+ readonly activeRoutes: {
673
+ expressPath: string;
674
+ method: Models.Http.Rest.HttpMethod;
675
+ }[];
676
+ repos: Map<string, Repository<any>>;
677
+ get sourceContext(): EndpointContext | undefined;
678
+ readonly skipWritingServerRoutes: boolean;
679
+ private injectableTypesfromContexts;
680
+ private allTypesfromContexts;
681
+ expressApp: Application;
682
+ serverTcpUdp: Server;
683
+ databaseConfig?: Models.DatabaseConfigTypeOrm;
684
+ mode: Models.FrameworkMode;
685
+ readonly onlyMigrationRun?: boolean;
686
+ readonly onlyMigrationRevertToTimestamp?: number;
687
+ get isRunOrRevertOnlyMigrationAppStart(): boolean;
688
+ session?: Models.ISession;
689
+ connection: DataSource;
690
+ private entitiesTriggers;
691
+ private realtime;
692
+ get realtimeClient(): taon.RealtimeClient;
693
+ get realtimeServer(): taon.RealtimeServer;
694
+ /**
695
+ * available after init()
696
+ */
697
+ config: Models.ContextOptions<any, any, any, any, any, any, any, any>;
698
+ get logHttp(): boolean;
699
+ get logRealtime(): boolean;
700
+ get logFramework(): boolean;
701
+ get logRoutes(): boolean;
702
+ get logDb(): boolean;
703
+ get logMigrations(): boolean;
704
+ /**
705
+ * Inside docker there is not need for https secure server
706
+ */
707
+ readonly isRunningInsideDocker: boolean;
708
+ constructor(originalConfig: Models.ContextOptions<any, any, any, any, any, any, any, any>, configFn: (env: any) => Models.ContextOptions<any, any, any, any, any, any, any, any>,
709
+ /**
710
+ * (@default: false)
711
+ * If TRUE context is NOT going to create db/express server/http endpoints
712
+ * PURPOSE OF THIS PROPERTY
713
+ * -> ONLY remote access from backend or frontend to specific backend
714
+ */
715
+ cloneOptions: Models.TaonCtxCloneParams);
716
+ init(options?: {
717
+ initFromRecrusiveContextResovle?: boolean;
718
+ onlyMigrationRun?: boolean;
719
+ onlyMigrationRevertToTimestamp?: number;
720
+ }): Promise<void>;
721
+ private getAutoGeneratedConfig;
722
+ get ngZone(): any;
723
+ startServer(): Promise<void>;
724
+ displayRoutes(app: any): void;
725
+ get modeAllowsDatabaseCreation(): boolean;
726
+ private cloneClassWithNewMetadata;
727
+ private cloneClassesObjWithNewMetadata;
728
+ private getRecrusiveClassesfromContextsObj;
729
+ private getRecrusiveClassesfromContexts;
730
+ getClassInstanceObjBy(classType: Models.ClassType): any;
731
+ private getClassesInstancesArrBy;
732
+ inject<T>(ctor: new (...args: any[]) => T, options: {
733
+ localInstance?: boolean;
734
+ contextClassInstance?: TaonBaseInjector;
735
+ locaInstanceConstructorArgs?: ConstructorParameters<typeof ctor>;
736
+ parentInstanceThatWillGetInjectedStuff: object;
737
+ }): T;
738
+ /**
739
+ * alias for inject
740
+ */
741
+ getInstanceBy<T>(ctor: new (...args: any[]) => T): T;
742
+ checkIfContextInitialized(): void;
743
+ getClassFunBy(classType: Models.ClassType): any;
744
+ isCLassType(classType: Models.ClassType, classFn: Function): boolean;
745
+ /**
746
+ * Only for injectable types
747
+ * Only for classType: CONTROLLER, REPOSITORY, PROVIDER, MIDDLEWARES
748
+ */
749
+ getClassFunByClassName(className: string): Function;
750
+ getClassFunByClass(classFunction: Function): Function;
751
+ getClassFunByArr(classType: Models.ClassType): Function[];
752
+ private createInstances;
753
+ initClasses(): Promise<void>;
754
+ isActiveOn(classInstance: object): boolean;
755
+ get frontendHostUri(): URL;
756
+ get uri(): URL | undefined;
757
+ get uriProtocol(): string | undefined;
758
+ /**
759
+ * Examples
760
+ * http://localhost:3000
761
+ * https://localhost (from localhost:80) *
762
+ */
763
+ get uriOrigin(): string | undefined;
764
+ /**
765
+ * Exampels
766
+ * http://localhost:3000/path/to/somewhere
767
+ * https://localhost/path/to/somewhere (from localhost:80)
768
+ */
769
+ get uriPathname(): string | undefined;
770
+ /**
771
+ * Examples
772
+ * http://localhost:3000/path/to/somewhere -> '/path/to/somewhere'
773
+ * http://localhost:3000 -> '' #
774
+ * https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
775
+ */
776
+ get uriPathnameOrNothingIfRoot(): string;
777
+ get uriPort(): string | undefined;
778
+ /**
779
+ * Port from uri as number
780
+ * @returns {Number | undefined}
781
+ */
782
+ get port(): Number | undefined;
783
+ get isHttpServer(): boolean;
784
+ /**
785
+ * Check if context is for remote only
786
+ */
787
+ get isRemoteHost(): boolean;
788
+ /**
789
+ * ipc/udp needs this
790
+ */
791
+ get contextName(): string;
792
+ /**
793
+ * ipc/udp needs this
794
+ */
795
+ get contextNameForCommunication(): string;
796
+ /**
797
+ * Check context type
798
+ */
799
+ get contextType(): 'normal' | 'remote' | 'abstract' | 'invalid';
800
+ get cwd(): string;
801
+ get activeContext(): string | null;
802
+ get appId(): string;
803
+ get publicAssets(): {
804
+ serverPath: string;
805
+ locationOnDisk: string;
806
+ }[];
807
+ get isProductionMode(): boolean;
808
+ get host(): string | undefined;
809
+ get origin(): string | undefined;
810
+ initSubscribers(): Promise<void>;
811
+ initEntities(): Promise<void>;
812
+ destroy(): Promise<void>;
813
+ initDatabaseConnection(): Promise<void>;
814
+ private updateCalculatedPathsForControllers;
815
+ private mergeControllerMethodsConfigs;
816
+ initControllersHook(ctxStorage: ContextsEndpointStorage): Promise<void>;
817
+ initControllers(): Promise<void>;
818
+ writeActiveRoutes(): void;
819
+ get middlewares(): Models.MiddlewareType[];
820
+ private initCustomClientMiddlewares;
821
+ private initCustomBackendMiddlewares;
822
+ private initBackendMiddlewares;
823
+ private initServer;
824
+ protected sendError(res: express.Response, error: unknown, req: express.Request, expressPath: string): void;
825
+ /**
826
+ * client can be browser or nodejs (when remote host)
827
+ */
828
+ private initClient;
829
+ }
830
+
831
+ /**
832
+ * for backendSocket.in(ROOM_NAME).emit(EVENT)
833
+ *
834
+ * Room names are uniqe..
835
+ * here I am limiting number of event for clients.
836
+ */
837
+ declare class Realtime {
838
+ NAMESPACE(contextName: string): string;
839
+ TABLE_CHANGE(contextName: string, tableName: string): string;
840
+ readonly KEYroomSubscribe = "roomSubscribe";
841
+ readonly KEYroomUnsubscribe = "roomUnsubscribe";
842
+ ROOM_NAME_CUSTOM(contextName: string, customEvent: string): string;
843
+ ROOM_SUBSCRIBE_CUSTOM(contextName: string): string;
844
+ ROOM_UNSUBSCRIBE_CUSTOM(contextName: string): string;
845
+ ROOM_NAME_UPDATE_ENTITY(contextName: string, className: string, entityId: number | string): string;
846
+ ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName: string): string;
847
+ ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName: string): string;
848
+ ROOM_NAME_UPDATE_ENTITY_PROPERTY(contextName: string, className: string, property: string, entityId: number | string): string;
849
+ ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName: string): string;
850
+ ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName: string): string;
851
+ }
852
+ declare namespace Symbols {
853
+ const ctxInClassOrClassObj: unique symbol;
854
+ const classNameStaticProperty: string;
855
+ const fullClassNameStaticProperty: string;
856
+ const orignalClass: string;
857
+ const orignalClassClonesObj: string;
858
+ const classMethodsNames: string;
859
+ const REALTIME: Realtime;
860
+ const metadata: {
861
+ className: string;
862
+ options: {
863
+ controller: string;
864
+ entity: string;
865
+ repository: string;
866
+ provider: string;
867
+ subscriber: string;
868
+ migration: string;
869
+ };
870
+ };
871
+ const old: {
872
+ HAS_TABLE_IN_DB: symbol;
873
+ MDC_KEY: string;
874
+ WEBSQL_REST_PROGRESS_FUN: symbol;
875
+ WEBSQL_REST_PROGRESS_FUN_START: symbol;
876
+ WEBSQL_REST_PROGRESS_FUN_DONE: symbol;
877
+ WEBSQL_REST_PROGRESS_TIMEOUT: symbol;
878
+ X_TOTAL_COUNT: string;
879
+ CIRCURAL_OBJECTS_MAP_BODY: string;
880
+ CIRCURAL_OBJECTS_MAP_QUERY_PARAM: string;
881
+ MAPPING_CONFIG_HEADER: string;
882
+ MAPPING_CONFIG_HEADER_BODY_PARAMS: string;
883
+ MAPPING_CONFIG_HEADER_QUERY_PARAMS: string;
884
+ ENDPOINT_META_CONFIG: string;
885
+ CLASS_DECORATOR_CONTEXT: string;
886
+ SOCKET_MSG: string;
887
+ ANGULAR: {
888
+ INPUT_NAMES: symbol;
889
+ };
890
+ ERROR_MESSAGES: {
891
+ CLASS_NAME_MATCH: string;
892
+ };
893
+ };
894
+ }
895
+
896
+ /**
897
+ * @returns function that returns context function.
898
+ * Context function can be used to dynamically
899
+ * create context with specific configuration.
900
+ */
901
+ declare const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARE extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARE>) => () => {
902
+ readonly contextName: string;
903
+ readonly appId: string;
904
+ cloneAsRemote: (cloneOpt?: {
905
+ overrideRemoteHost?: string;
906
+ }) => /*elided*/ any;
907
+ cloneAsNormal: (cloneOpt?: {
908
+ overrideHost?: string;
909
+ }) => /*elided*/ any;
910
+ /**
911
+ * @deprecated
912
+ * - get reference to internal context
913
+ */
914
+ __ref(): Promise<EndpointContext>;
915
+ /**
916
+ * only for internal use
917
+ * @deprecated
918
+ */
919
+ readonly __refSync: EndpointContext;
920
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
921
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
922
+ /**
923
+ * - create controller instances for context
924
+ * - init database (if enable) + migation scripts
925
+ */
926
+ initialize: (overrideOptions?: Models.TaonInitializeParams) => Promise<EndpointContext>;
927
+ /**
928
+ * realtime communication with server
929
+ * TCP(upgrade) socket.io (or ipc) based.
930
+ */
931
+ readonly realtime: {
932
+ readonly client: taon.RealtimeClient;
933
+ readonly server: taon.RealtimeServer;
934
+ };
935
+ };
936
+ declare const createContext: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARES extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARES>) => {
937
+ readonly contextName: string;
938
+ readonly appId: string;
939
+ cloneAsRemote: (cloneOpt?: {
940
+ overrideRemoteHost?: string;
941
+ }) => /*elided*/ any;
942
+ cloneAsNormal: (cloneOpt?: {
943
+ overrideHost?: string;
944
+ }) => /*elided*/ any;
945
+ /**
946
+ * @deprecated
947
+ * - get reference to internal context
948
+ */
949
+ __ref(): Promise<EndpointContext>;
950
+ /**
951
+ * only for internal use
952
+ * @deprecated
953
+ */
954
+ readonly __refSync: EndpointContext;
955
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
956
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
957
+ /**
958
+ * - create controller instances for context
959
+ * - init database (if enable) + migation scripts
960
+ */
961
+ initialize: (overrideOptions?: Models.TaonInitializeParams) => Promise<EndpointContext>;
962
+ /**
963
+ * realtime communication with server
964
+ * TCP(upgrade) socket.io (or ipc) based.
965
+ */
966
+ readonly realtime: {
967
+ readonly client: taon.RealtimeClient;
968
+ readonly server: taon.RealtimeServer;
969
+ };
970
+ };
971
+ type TaonContext = ReturnType<typeof createContext>;
972
+
973
+ type TaonEntityKeysToOmit = 'ctrl' | 'clone' | '__endpoint_context__' | 'ctx' | 'inject' | '_' | 'relation' | 'relations' | 'inject' | 'injectRepo' | 'injectCustomRepository' | 'injectCustomRepo' | 'injectController' | 'injectCtrl' | 'injectProvider' | 'injectMiddleware';
974
+ declare const TaonEntityKeysToOmitArr: TaonEntityKeysToOmit[];
975
+
976
+ declare let TAON_CONTEXT: InjectionToken<TaonContext>;
977
+ declare let CURRENT_HOST_BACKEND_PORT: InjectionToken<number>;
978
+ declare let CURRENT_HOST_URL: InjectionToken<string>;
979
+
980
+ declare const apiPrefix = "api";
981
+
982
+ /**
983
+ * @deprecated
984
+ */
985
+ declare const getTransformFunction: (target: Function) => (entity: any) => any;
986
+ /**
987
+ * @deprecated
988
+ */
989
+ declare const singleTransform: (json: any) => any;
990
+ declare class EntityProcess {
991
+ /**
992
+ * Data from backend
993
+ */
994
+ private result;
995
+ private response;
996
+ static init(result: any, response: Response): Promise<void>;
997
+ /**
998
+ * Data to send
999
+ */
1000
+ data: any;
1001
+ /**
1002
+ * Say yes to:
1003
+ * - circural object
1004
+ * - transform browser fn in decorator
1005
+ */
1006
+ private advancedManipulation;
1007
+ private entityMapping;
1008
+ private circural;
1009
+ constructor(
1010
+ /**
1011
+ * Data from backend
1012
+ */
1013
+ result: any, response: Response);
1014
+ private checkAdvancedManiupulation;
1015
+ run(): Promise<void>;
1016
+ applayTransformFn(): void;
1017
+ setHeaders(): void;
1018
+ send(): void;
1019
+ }
1020
+
1021
+ declare const getResponseValue: <T>(response: Models.Http.Response<T>, options?: {
1022
+ req: Request;
1023
+ res: Response;
1024
+ }) => Promise<T>;
1025
+
1026
+ declare const inject: <T>(entity: () => new (...args: any[]) => T) => T;
1027
+
1028
+ interface TaonAdditionalMiddlewareMethodInfo {
1029
+ methodName: string;
1030
+ expressPath: string;
1031
+ httpRequestType: CoreModels.HttpMethod;
1032
+ }
1033
+ /**
1034
+ * TODO
1035
+ * - global provider available in all contexts
1036
+ * - provider available in own context
1037
+ */
1038
+ declare abstract class TaonBaseMiddleware extends TaonBaseInjector {
1039
+ }
1040
+ interface TaonBaseMiddleware {
1041
+ /**
1042
+ * Global interceptor for whole context
1043
+ * backend request
1044
+ */
1045
+ interceptServer({ req, res, next, }: TaonServerMiddlewareInterceptOptions): Promise<void> | void;
1046
+ /**
1047
+ * Global interceptor for whole context
1048
+ * client requests
1049
+ */
1050
+ interceptClient({ req, next, }: TaonClientMiddlewareInterceptOptions): Observable<AxiosResponse<any>>;
1051
+ /**
1052
+ * Specyfic controller method interceptor
1053
+ */
1054
+ interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType, }: TaonAdditionalMiddlewareMethodInfo): Promise<void> | void;
1055
+ /**
1056
+ * Controller method frontned interceptor
1057
+ * TODO not needed ?
1058
+ */
1059
+ interceptClientMethod({ req, next }: TaonClientMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType, }: TaonAdditionalMiddlewareMethodInfo): Observable<AxiosResponse<any>>;
1060
+ }
1061
+
1062
+ type TaonMiddlewareInheritanceObj = {
1063
+ [parentMiddlewaresName: string]: typeof TaonBaseMiddleware;
1064
+ };
1065
+ type TaonMiddlewareFunction = (options: {
1066
+ /**
1067
+ * middlewares inherited from parent class
1068
+ */
1069
+ parentMiddlewares: TaonMiddlewareInheritanceObj;
1070
+ /**
1071
+ * Get real class name - needed when code is minified
1072
+ */
1073
+ className: (middlewareClass: Function) => string;
1074
+ }) => TaonMiddlewareInheritanceObj;
1075
+ interface TaonHttpDecoratorOptions {
1076
+ /**
1077
+ * @deprecated don't use in production - keep stuff encapsulated
1078
+ * normally path is generated from method name and its params
1079
+ */
1080
+ path?: string;
1081
+ /**
1082
+ * If true, the path will be global
1083
+ *
1084
+ * ! BE CAREFUL ! global path IS NOT GLOBAL inside dockerized app
1085
+ * (/api/contextName is automatically added to global path in docker)
1086
+ *
1087
+ * @deprecated don't use in production - keep stuff encapsulated
1088
+ */
1089
+ pathIsGlobal?: boolean;
1090
+ overrideContentType?: CoreModels.ContentType;
1091
+ overrideResponseType?: Models$1.ResponseTypeAxios;
1092
+ /**
1093
+ * Express will send response as HTML string with proper headers
1094
+ */
1095
+ overrideExpressSendAsHtml?: boolean;
1096
+ middlewares?: TaonMiddlewareFunction;
1097
+ }
1098
+ declare function GET(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1099
+ /**
1100
+ * Method for sending html website from text
1101
+ * Example
1102
+ *
1103
+ * ```ts
1104
+ * ...
1105
+ * // in your taon controller
1106
+ * ..Taon.Http.HTML()
1107
+ * sendHtmlDummyWebsite(): Taon.ResponseHtml {
1108
+ * return `
1109
+ <html>
1110
+ <head>
1111
+ <title>Dummy website</title>
1112
+ </head>
1113
+ <body>
1114
+ <h1>This is dummy website</h1>
1115
+ <p>Served as HTML string from Taon controller method</p>
1116
+ </body>
1117
+ </html>
1118
+ * `; *
1119
+ * }
1120
+ * ...
1121
+ * ```
1122
+ */
1123
+ declare function HTML(pathOrOptions?: Pick<TaonHttpDecoratorOptions, 'path' | 'pathIsGlobal'>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1124
+ declare function HEAD(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1125
+ declare function POST(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1126
+ declare function PUT(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1127
+ declare function PATCH(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1128
+ declare function DELETE(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1129
+
1130
+ declare class ParamConfig {
1131
+ paramName: string;
1132
+ paramType: CoreModels.ParamType;
1133
+ index: number;
1134
+ defaultType: any;
1135
+ expireInSeconds?: number;
1136
+ }
1137
+
1138
+ /**
1139
+ * @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
1140
+ */
1141
+ declare class MethodConfig implements Pick<TaonHttpDecoratorOptions, 'path' | 'middlewares'> {
1142
+ methodName: string;
1143
+ global?: boolean;
1144
+ /**
1145
+ * override default content type
1146
+ */
1147
+ contentType?: any;
1148
+ /**
1149
+ * override default axiso response type
1150
+ */
1151
+ responseType?: any;
1152
+ overrideExpressSendAsHtml?: boolean;
1153
+ path: string;
1154
+ descriptor: PropertyDescriptor;
1155
+ type: CoreModels.HttpMethod;
1156
+ parameters: {
1157
+ [paramName: string]: Partial<ParamConfig>;
1158
+ };
1159
+ /**
1160
+ * Middlewares from controller method options
1161
+ */
1162
+ middlewares?: TaonMiddlewareFunction;
1163
+ /**
1164
+ * Calculated middlewares object from parents controllers
1165
+ */
1166
+ calculatedMiddlewaresMethodObj?: TaonMiddlewareInheritanceObj;
1167
+ /**
1168
+ * Middlewares array in proper order and ready to be used in
1169
+ * express or in axios interceptors.
1170
+ */
1171
+ calculatedMiddlewares: (typeof TaonBaseMiddleware)[];
1172
+ }
1173
+
1174
+ declare namespace Validators {
1175
+ const classNameVlidation: (className: any, target: Function) => any;
1176
+ const checkIfMethodsWithReponseTYpeAlowed: (methods: MethodConfig[], current: MethodConfig) => void;
1177
+ const validateClassFunctions: (controllers: any[], entities: any[], proviers: any[], repositories: any[]) => void;
1178
+ const preventUndefinedModel: (model: any, id: any) => void;
1179
+ }
1180
+
1181
+ declare class TaonBaseClass<CloneT extends TaonBaseClass = any> {
1182
+ /**
1183
+ * class initialization hook
1184
+ * taon after class instance creation
1185
+ */
1186
+ _(): Promise<void>;
1187
+ /**
1188
+ *
1189
+ * @param overrideObjOrFn if object is provided it will override values in cloned object,
1190
+ * if function is provided it will be called with old cloned values and should return
1191
+ * object with values to override
1192
+ * @returns cloned instance of the class
1193
+ */
1194
+ clone(overrideObjOrFn?: Partial<CloneT> | ((oldValues: Partial<CloneT>) => Partial<CloneT>)): CloneT;
1195
+ }
1196
+
1197
+ declare abstract class TaonBaseEntity<
1198
+ /**
1199
+ * type for cloning
1200
+ */
1201
+ CloneT extends TaonBaseClass = any> extends TaonBaseClass<CloneT> {
1202
+ /**
1203
+ * simple check if relation is ok
1204
+ */
1205
+ relation(relationName: RelationPath<CloneT>): string;
1206
+ /**
1207
+ * simple check if relation is ok
1208
+ */
1209
+ relations(relationNames: RelationPath<CloneT>[]): string[];
1210
+ }
1211
+
1212
+ declare abstract class TaonBaseAbstractEntity<CloneT extends TaonBaseClass = any> extends TaonBaseEntity<CloneT> {
1213
+ id: string;
1214
+ version: number;
1215
+ }
1216
+ type AbstractEntityOmitKeys<ENTITY> = Omit<ENTITY, 'id' | 'version' | '_' | 'clone'>;
1217
+
1218
+ /**
1219
+ * TODO prevent calling methods when not initialized
1220
+ * with init(ctx)
1221
+ */
1222
+ declare abstract class TaonBaseAngularService {
1223
+ protected readonly currentContext: TaonContext;
1224
+ /**
1225
+ * @deprecated
1226
+ * current context host backend port (for localhost backend)
1227
+ */
1228
+ protected readonly CURRENT_HOST_BACKEND_PORT: number | undefined;
1229
+ /**
1230
+ * @deprecated
1231
+ * current context host URL (for localhost backend)
1232
+ */
1233
+ protected readonly CURRENT_HOST_URL: string | undefined;
1234
+ constructor();
1235
+ /**
1236
+ * @deprecated
1237
+ * Returns the host URL for the backend service
1238
+ * that is running on localhost (normal NodeJS/ExpressJS mode).
1239
+ */
1240
+ get host(): string;
1241
+ injectController<T>(ctor: new (...args: any[]) => T,
1242
+ /**
1243
+ * optional override context
1244
+ */
1245
+ overrideCurrentContext?: TaonContext): T;
1246
+ static ɵfac: i0.ɵɵFactoryDeclaration<TaonBaseAngularService, never>;
1247
+ static ɵprov: i0.ɵɵInjectableDeclaration<TaonBaseAngularService>;
1248
+ }
1249
+
1250
+ declare const TaonBaseContext: {
1251
+ readonly contextName: string;
1252
+ readonly appId: string;
1253
+ cloneAsRemote: (cloneOpt?: {
1254
+ overrideRemoteHost?: string;
1255
+ }) => /*elided*/ any;
1256
+ cloneAsNormal: (cloneOpt?: {
1257
+ overrideHost?: string;
1258
+ }) => /*elided*/ any;
1259
+ __ref(): Promise<taon.EndpointContext>;
1260
+ readonly __refSync: taon.EndpointContext;
1261
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
1262
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
1263
+ initialize: (overrideOptions?: taon.Models.TaonInitializeParams) => Promise<taon.EndpointContext>;
1264
+ readonly realtime: {
1265
+ readonly client: taon.RealtimeClient;
1266
+ readonly server: taon.RealtimeServer;
1267
+ };
1268
+ };
1269
+
1270
+ interface MulterFileUploadResponse {
1271
+ ok: boolean;
1272
+ originalName: string;
1273
+ /**
1274
+ * name change to this to avoid confusion with originalname
1275
+ * (similar to originalname with added uniq part)
1276
+ */
1277
+ savedAs: string;
1278
+ size: number;
1279
+ mimetype: string;
1280
+ }
1281
+ declare class TaonBaseController<UPLOAD_FILE_QUERY_PARAMS = {}> extends TaonBaseInjector {
1282
+ /**
1283
+ * Hook that is called when taon app is inited
1284
+ * (all contexts are created and inited)
1285
+ */
1286
+ afterAllCtxInited(options: {
1287
+ ctxStorage: ContextsEndpointStorage;
1288
+ }): Promise<void>;
1289
+ uploadFormDataToServer(formData: FormData, queryParams?: UPLOAD_FILE_QUERY_PARAMS): Models.Http.Response<MulterFileUploadResponse[]>;
1290
+ /**
1291
+ * Hook after file is uploaded
1292
+ * through `uploadFormDataToServer` or `uploadLocalFileToServer`
1293
+ */
1294
+ protected afterFileUploadAction(file?: MulterFileUploadResponse, queryParams?: UPLOAD_FILE_QUERY_PARAMS): void | Promise<void>;
1295
+ uploadLocalFileToServer(absFilePath: string, options?: Pick<Models.Http.Rest.Ng2RestAxiosRequestConfig, 'onUploadProgress'>, queryParams?: UPLOAD_FILE_QUERY_PARAMS): Promise<MulterFileUploadResponse[]>;
1296
+ /**
1297
+ * Easy way to wait for status change with http (1s default) pooling.
1298
+ *
1299
+ * example (in sub class):
1300
+ * ```ts
1301
+ async check() {
1302
+ await this.waitForProperStatusChange({
1303
+ request: () => this.uploadFormDataToServer(void 0, void 0).request(),
1304
+ statusCheck: resp => resp.body.json[0].ok,
1305
+ });
1306
+ }
1307
+ * ```
1308
+ */
1309
+ _waitForProperStatusChange<T>(options: {
1310
+ actionName: string;
1311
+ /**
1312
+ * Request for pooling
1313
+ */
1314
+ request: (opt?: {
1315
+ /**
1316
+ * optional index number to identify request in logs
1317
+ * (starts from 0 and increments by 1 on each try)
1318
+ */
1319
+ reqIndexNum?: number;
1320
+ httpErrorsCount?: number;
1321
+ }) => ReturnType<Models.Http.Response<T>['request']>;
1322
+ poolingInterval?: number;
1323
+ /**
1324
+ * default infinite tries
1325
+ */
1326
+ maxTries?: number;
1327
+ /**
1328
+ * default infiniti allowed http errors
1329
+ */
1330
+ allowedHttpErrors?: number;
1331
+ /**
1332
+ * condition to be met
1333
+ */
1334
+ statusCheck?: (response: Awaited<ReturnType<typeof options.request>>) => boolean;
1335
+ /**
1336
+ * if return true.. loop will continue
1337
+ * if false .. will exit the loop
1338
+ */
1339
+ loopRequestsOnBackendError?: (opt: {
1340
+ unknownError: Error;
1341
+ unknownHttpError: HttpResponseError<any>;
1342
+ taonError: HttpResponseError<RestErrorResponseWrapper>;
1343
+ reqIndexNum?: number;
1344
+ httpErrorsCount?: number;
1345
+ }) => boolean | Promise<boolean>;
1346
+ }): Promise<void>;
1347
+ }
1348
+
1349
+ /**
1350
+ * Please override property entityClassFn with entity class.
1351
+ */
1352
+ declare abstract class TaonBaseCrudController<Entity, UPLOAD_FILE_QUERY_PARAMS = {}> extends TaonBaseController<UPLOAD_FILE_QUERY_PARAMS> {
1353
+ protected db: TaonBaseRepository<Entity>;
1354
+ /**
1355
+ * Please provide entity as class property entityClassFn:
1356
+ * @returns class function
1357
+ *
1358
+ */
1359
+ abstract entityClassResolveFn: () => any;
1360
+ _(): Promise<void>;
1361
+ bufforedChanges(id: number | string, property: string, alreadyLength?: number): Models.Http.Response<string | any[]>;
1362
+ pagination(pageNumber?: number, pageSize?: number, search?: string): Models.Http.Response<Entity[]>;
1363
+ getAll(): Models.Http.Response<Entity[]>;
1364
+ getBy(id: number | string): Models.Http.Response<Entity>;
1365
+ updateById(id: number | string, item: Entity): Models.Http.Response<Entity>;
1366
+ patchById(id: number | string, item: Entity): Models.Http.Response<Entity>;
1367
+ bulkUpdate(items: Entity[]): Models.Http.Response<Entity[]>;
1368
+ deleteById(id: number | string): Models.Http.Response<Entity>;
1369
+ bulkDelete(ids: (number | string)[]): Models.Http.Response<(number | string | Entity)[]>;
1370
+ clearTable(): Models.Http.Response<void>;
1371
+ save(item: Entity): Models.Http.Response<Entity>;
1372
+ bulkCreate(items: Entity): Models.Http.Response<Entity[]>;
1373
+ }
1374
+
1375
+ /**
1376
+ * Configurable file upload middleware (multer based)
1377
+ */
1378
+ declare class TaonBaseFileUploadMiddleware extends TaonBaseMiddleware {
1379
+ interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath }: TaonAdditionalMiddlewareMethodInfo): Promise<void>;
1380
+ uploadDir(): string;
1381
+ storage(): multer.StorageEngine;
1382
+ upload(): multer.Multer;
1383
+ middleware(): express__default.RequestHandler;
1384
+ }
1385
+
1386
+ declare class TaonBaseMigration extends TaonBaseInjector implements MigrationInterface {
1387
+ /**
1388
+ * by default is READY to run
1389
+ */
1390
+ isReadyToRun(): boolean;
1391
+ getDescription(): string;
1392
+ up(queryRunner: QueryRunner): Promise<any>;
1393
+ down(queryRunner: QueryRunner): Promise<any>;
1394
+ }
1395
+
1396
+ /**
1397
+ * TODO
1398
+ * - global provider available in all contexts
1399
+ * - provider available in own context
1400
+ */
1401
+ declare class TaonBaseProvider extends TaonBaseInjector {
1402
+ }
1403
+
1404
+ declare abstract class TaonBaseSubscriberForEntity<Entity = any> extends TaonBaseInjector implements EntitySubscriberInterface {
1405
+ abstract listenTo(): new (...args: any[]) => Entity;
1406
+ /**
1407
+ * Called after entity is loaded.
1408
+ */
1409
+ afterLoad(entity: any): void;
1410
+ /**
1411
+ * Called before query execution.
1412
+ */
1413
+ beforeQuery(event: any): void;
1414
+ /**
1415
+ * Called after query execution.
1416
+ */
1417
+ afterQuery(event: any): void;
1418
+ /**
1419
+ * Called before entity insertion.
1420
+ */
1421
+ beforeInsert(event: InsertEvent<any>): void;
1422
+ /**
1423
+ * Called after entity insertion.
1424
+ */
1425
+ afterInsert(event: InsertEvent<any>): void;
1426
+ /**
1427
+ * Called before entity update.
1428
+ */
1429
+ beforeUpdate(event: UpdateEvent<any>): void;
1430
+ /**
1431
+ * Called after entity update.
1432
+ */
1433
+ afterUpdate(event: UpdateEvent<any>): void;
1434
+ /**
1435
+ * Called before entity removal.
1436
+ */
1437
+ beforeRemove(event: RemoveEvent<any>): void;
1438
+ /**
1439
+ * Called after entity removal.
1440
+ */
1441
+ afterRemove(event: RemoveEvent<any>): void;
1442
+ /**
1443
+ * Called before entity removal.
1444
+ */
1445
+ beforeSoftRemove(event: SoftRemoveEvent<any>): void;
1446
+ /**
1447
+ * Called after entity removal.
1448
+ */
1449
+ afterSoftRemove(event: SoftRemoveEvent<any>): void;
1450
+ /**
1451
+ * Called before entity recovery.
1452
+ */
1453
+ beforeRecover(event: RecoverEvent<any>): void;
1454
+ /**
1455
+ * Called after entity recovery.
1456
+ */
1457
+ afterRecover(event: RecoverEvent<any>): void;
1458
+ /**
1459
+ * Called before transaction start.
1460
+ */
1461
+ beforeTransactionStart(event: TransactionStartEvent): void;
1462
+ /**
1463
+ * Called after transaction start.
1464
+ */
1465
+ afterTransactionStart(event: TransactionStartEvent): void;
1466
+ /**
1467
+ * Called before transaction commit.
1468
+ */
1469
+ beforeTransactionCommit(event: TransactionCommitEvent): void;
1470
+ /**
1471
+ * Called after transaction commit.
1472
+ */
1473
+ afterTransactionCommit(event: TransactionCommitEvent): void;
1474
+ /**
1475
+ * Called before transaction rollback.
1476
+ */
1477
+ beforeTransactionRollback(event: TransactionRollbackEvent): void;
1478
+ /**
1479
+ * Called after transaction rollback.
1480
+ */
1481
+ afterTransactionRollback(event: TransactionRollbackEvent): void;
1482
+ }
1483
+
1484
+ declare class DecoratorAbstractOpt {
1485
+ className: string;
1486
+ }
1487
+
1488
+ declare class TaonControllerOptions<ControllerClass = any> extends DecoratorAbstractOpt {
1489
+ /**
1490
+ * typeorm realtime subscribtion // TODO disabled for now, does not make sense ?s
1491
+ */
1492
+ realtime?: boolean;
1493
+ /**
1494
+ * override default path for controller api
1495
+ */
1496
+ path?: string;
1497
+ /**
1498
+ * Middlewares to be applied to all methods in the controller
1499
+ */
1500
+ middlewares?: TaonMiddlewareFunction;
1501
+ }
1502
+
1503
+ declare class ControllerConfig extends TaonControllerOptions {
1504
+ methods: {
1505
+ [methodName: string]: Partial<MethodConfig>;
1506
+ };
1507
+ /**
1508
+ * Calculated path from parents controllers
1509
+ */
1510
+ calculatedPath?: string;
1511
+ /**
1512
+ * a way to transform entity before sending to browser
1513
+ */
1514
+ browserTransformFn?: (entity: any) => any;
1515
+ /**
1516
+ * Calculated middlewares object from parents controllers
1517
+ */
1518
+ calculatedMiddlewaresControllerObj?: TaonMiddlewareInheritanceObj;
1519
+ }
1520
+ declare const controllerConfigFrom: (partial: Partial<ControllerConfig>) => ControllerConfig;
1521
+
1522
+ declare class DITaonContainer {
1523
+ private static instances;
1524
+ static resolve<T>(target: Function): T;
1525
+ static inject<T>(target: new (...args: any[]) => T): T;
1526
+ }
1527
+
1528
+ declare class FormlyHorizontalWrapper extends FieldWrapper {
1529
+ fieldComponent: ViewContainerRef;
1530
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormlyHorizontalWrapper, never>;
1531
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormlyHorizontalWrapper, "formly-horizontal-wrapper", never, {}, {}, never, never, false, never>;
1532
+ }
1533
+
1534
+ declare class RepeatTypeComponent extends FieldArrayType {
1535
+ get labelTemplate(): any;
1536
+ constructor(builder: FormlyFormBuilder);
1537
+ static ɵfac: i0.ɵɵFactoryDeclaration<RepeatTypeComponent, never>;
1538
+ static ɵcmp: i0.ɵɵComponentDeclaration<RepeatTypeComponent, "formly-repeat-section", never, {}, {}, never, never, false, never>;
1539
+ }
1540
+
1541
+ type FormlyInputType = 'input' | 'switch' | 'datepicker' | 'repeat' | 'group' | 'select';
1542
+
1543
+ declare function getFromlyConfigFor(target: Function, options?: {
1544
+ formType?: CoreModels.UIFramework;
1545
+ keysPathesToInclude?: string[];
1546
+ keysPathesToExclude?: string[];
1547
+ parentModel?: string;
1548
+ relativePath?: string;
1549
+ level?: number;
1550
+ maxLevel?: number;
1551
+ }): FormlyFieldConfig<_ngx_formly_core.FormlyFieldProps & {
1552
+ [additionalProperties: string]: any;
1553
+ }>[];
1554
+ type FormlyArrayTransformFn = (fieldsArray: FormlyFieldConfig[], fieldObject?: {
1555
+ [propKey: string]: FormlyFieldConfig;
1556
+ }) => FormlyFieldConfig[];
1557
+
1558
+ declare function findTypeForEntity(entity: Function, isArray?: boolean): FormlyEntityType;
1559
+ type FormlyEntityType = {
1560
+ name: string;
1561
+ component: Function;
1562
+ entity?: Function;
1563
+ isArray?: boolean;
1564
+ };
1565
+ declare function typeFromEntity(component: Function, entity?: Function | Function[]): {
1566
+ name: string;
1567
+ component: Function;
1568
+ entity: Function | Function[];
1569
+ isArray: boolean;
1570
+ };
1571
+ declare function typeFromName(component: Function, name: string): {
1572
+ name: string;
1573
+ component: Function;
1574
+ };
1575
+ declare function RegisterComponentTypeForEntity(entity: Function | Function[]): any;
1576
+ declare function RegisterComponentType(className: string, ...optionslNames: string[]): any;
1577
+ declare function getRegisteredComponents(): FormlyEntityType[];
1578
+
1579
+ declare namespace ClassHelpers {
1580
+ /**
1581
+ * TODO - repalce in every place when getting class fn from object
1582
+ */
1583
+ const getClassFnFromObject: (json: Object) => any;
1584
+ const getName: (classFnOrObject: any) => string;
1585
+ const getOrginalClass: (classFnOrObject: any) => any;
1586
+ const getFullInternalName: (classFnOrObject: any) => string;
1587
+ const getUniqueKey: (classFnOrObject: any) => string;
1588
+ const isContextClassObject: (obj: any) => boolean;
1589
+ const setName: (target: Function, className: string) => void;
1590
+ const hasParentClassWithName: (target: Function, className: string, targets?: any[]) => boolean;
1591
+ /**
1592
+ * Express async handler for middleware functions.
1593
+ */
1594
+ const asyncHandler: (fn: any) => (req: any, res: any, next: any) => void;
1595
+ const getMethodsNames: (classOrClassInstance: any, allMethodsNames?: any[]) => string[];
1596
+ const getControllerConfigs: (target: Function, configs?: ControllerConfig[], callerTarget?: Function) => ControllerConfig[];
1597
+ const ensureClassConfig: (target: Function) => Partial<ControllerConfig>;
1598
+ const ensureMethodConfig: (target: any, propertyKey: string | symbol) => Partial<MethodConfig>;
1599
+ const getClassConfig: (constructor: Function) => Partial<ControllerConfig> | undefined;
1600
+ }
1601
+
1602
+ declare const cloneObj: <CloneT>(override: Partial<CloneT>, classFn: Function) => CloneT;
1603
+
1604
+ declare namespace TaonHelpers {
1605
+ const fillUpTo: (s: string, nCharacters: number) => string;
1606
+ const isGoodPath: (p: string) => boolean;
1607
+ const firstStringOrElemFromArray: (stringOrArrayOfString: string[] | string) => string;
1608
+ const tryTransformParam: (param: any) => any;
1609
+ const getExpressPath: (c: ControllerConfig, pathOrClassConfig: Partial<MethodConfig>) => string;
1610
+ const defaultType: (value: any) => {};
1611
+ const parseJSONwithStringJSONs: (object: Object, waring?: boolean) => Object;
1612
+ const isPlainFileOrFolder: (filePath: any) => boolean;
1613
+ const ipcKeyNameResponse: (target: Function, methodConfig: Partial<MethodConfig>, expressPath: string) => string;
1614
+ const ipcKeyNameRequest: (target: Function, methodConfig: Partial<MethodConfig>, expressPath: string) => string;
1615
+ const websqlMocks: (headers: any) => {
1616
+ request: Express.Request;
1617
+ response: Express.Response;
1618
+ };
1619
+ }
1620
+
1621
+ /**
1622
+ * 100 default characters varchar
1623
+ */
1624
+ declare const StringColumn: <T = string>(defaultValue?: T, length?: number) => PropertyDecorator;
1625
+ /**
1626
+ * 100 characters varchar
1627
+ */
1628
+ declare const String100Column: <T = string>(defaultValue?: T) => PropertyDecorator;
1629
+ /**
1630
+ * 100 characters varchar
1631
+ */
1632
+ declare const String45Column: <T = string>(defaultValue?: T) => PropertyDecorator;
1633
+ /**
1634
+ * 500 characters varchar
1635
+ */
1636
+ declare const String500Column: <T = string>(defaultValue?: T) => PropertyDecorator;
1637
+ /**
1638
+ * 200 characters varchar
1639
+ */
1640
+ declare const String200Column: <T = string>(defaultValue?: T) => PropertyDecorator;
1641
+ declare const NumberColumn: () => PropertyDecorator;
1642
+ declare const DecimalNumberColumn: () => PropertyDecorator;
1643
+ declare const SimpleJsonColumn: () => PropertyDecorator;
1644
+ declare const BooleanColumn: (defaultValue: boolean | null) => PropertyDecorator;
1645
+ declare const DateTImeColumn: (defaultValue?: boolean | null) => PropertyDecorator;
1646
+
1647
+ /**
1648
+ * Server for realtime communication
1649
+ * you can trigger:
1650
+ * - entity changes (any property in table changed)
1651
+ * - entity custom property changes (specific property changed)
1652
+ * - entity table changes (new instance added, instance removed)
1653
+ * - custom events
1654
+ *
1655
+ * and also listen to:
1656
+ * - custom events from yourself
1657
+ */
1658
+ declare class RealtimeServer {
1659
+ private core;
1660
+ constructor(core: RealtimeCore);
1661
+ private init;
1662
+ private triggerChanges;
1663
+ triggerEntityChanges(entityObjOrClass: Function | object,
1664
+ /**
1665
+ * value of unique key property of entity instance
1666
+ * (this value is not needed if entityObjOrClass is instance of entity)
1667
+ */
1668
+ idToTrigger?: number | string): void;
1669
+ triggerEntityPropertyChanges(entityObjOrClass: Function | object,
1670
+ /**
1671
+ * property name or array of property names that changed
1672
+ * for entity instance
1673
+ */
1674
+ property: string | string[],
1675
+ /**
1676
+ * value of unique key property of entity instance
1677
+ * (this value is not needed if entityObjOrClass is instance of entity)
1678
+ */
1679
+ idToTrigger?: number | string): void;
1680
+ triggerEntityTableChanges(entityClassOrInstance: Function | object): void;
1681
+ triggerCustomEvent(customEvent: string, dataToPush: any): void;
1682
+ /**
1683
+ * Listen to custom events from users
1684
+ * @param customEvent global event name
1685
+ */
1686
+ listenChangesCustomEvent(customEvent: string): Observable<any>;
1687
+ }
1688
+
1689
+ declare abstract class RealtimeStrategy {
1690
+ protected ctx: EndpointContext;
1691
+ constructor(ctx: EndpointContext);
1692
+ get ioClient(): typeof io;
1693
+ ioServer(url: string, opt: ServerOptions): Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
1694
+ abstract toString(): string;
1695
+ }
1696
+
1697
+ declare namespace RealtimeModels {
1698
+ type SubsManagerOpt = {
1699
+ core: RealtimeCore;
1700
+ customEvent: string;
1701
+ roomName: string;
1702
+ property: string;
1703
+ };
1704
+ interface ChangeOption {
1705
+ /**
1706
+ * Specify property name to listen changes on that property only;
1707
+ */
1708
+ property?: string;
1709
+ /**
1710
+ * Override custom event name to listen
1711
+ */
1712
+ customEvent?: string;
1713
+ /**
1714
+ * Value from entity object.
1715
+ * Key for this value is usually id or unique key
1716
+ * property defined in entity decorator.
1717
+ * TODO @LAST IMPLEMENT unique key support
1718
+ */
1719
+ idOrUniqValue?: any;
1720
+ }
1721
+ type EventHandler = (...args: any[]) => void;
1722
+ }
1723
+
1724
+ declare class MockServerIpc {
1725
+ contextName: string;
1726
+ static serverByContextName: Map<string, MockServerIpc>;
1727
+ static from(contextName: string): MockServerIpc;
1728
+ namespacesByName: Map<string, MockNamespaceIpc>;
1729
+ constructor(contextName: string);
1730
+ of(namespace: string): MockNamespaceIpc;
1731
+ }
1732
+ declare class MockNamespaceIpc {
1733
+ /**
1734
+ * Namespace name
1735
+ */
1736
+ name: string;
1737
+ server: MockServerIpc;
1738
+ electronClients: Set<Electron.WebContents>;
1739
+ roomsByRoomName: {
1740
+ [roomName: string]: Set<Electron.WebContents>;
1741
+ };
1742
+ private namespaceEventHandlers;
1743
+ constructor(
1744
+ /**
1745
+ * Namespace name
1746
+ */
1747
+ name: string, server: MockServerIpc);
1748
+ on(eventName: string, callback: RealtimeModels.EventHandler): any;
1749
+ off(event: string, callback?: RealtimeModels.EventHandler): any;
1750
+ emit(eventName: string, ...args: any[]): any;
1751
+ to(roomName: string): RoomEmitterIpc;
1752
+ in(roomName: string): RoomEmitterIpc;
1753
+ join(webContents: Electron.WebContents, roomName: string): void;
1754
+ leave(webContents: Electron.WebContents, roomName: string): void;
1755
+ path(): string;
1756
+ get nsp(): {
1757
+ readonly name: string;
1758
+ };
1759
+ }
1760
+ declare class RoomEmitterIpc {
1761
+ private electronClients;
1762
+ /**
1763
+ * namespace name
1764
+ */
1765
+ private name;
1766
+ private includeSender;
1767
+ private sender;
1768
+ constructor(electronClients: Set<Electron.WebContents>,
1769
+ /**
1770
+ * namespace name
1771
+ */
1772
+ name: string, includeSender?: boolean, sender?: MockSocketIpc);
1773
+ emit(eventName: string, ...args: any[]): void;
1774
+ }
1775
+ declare class MockSocketIpc {
1776
+ namespaceName: string;
1777
+ ipcRenderer: typeof ipcRenderer;
1778
+ private socketEventHandlers;
1779
+ get name(): string;
1780
+ /**
1781
+ * @param namespaceName instead url for ipc
1782
+ */
1783
+ constructor(namespaceName: string);
1784
+ on(eventName: string, callback: (event: any, ...args: any[]) => void): void;
1785
+ off(event: string, callback?: (event: any, ...args: any[]) => void): void;
1786
+ emit(event: string, ...args: any[]): void;
1787
+ }
1788
+ /**
1789
+ * Purpose:
1790
+ * - backend-browser communication between 2 processes in electron mode
1791
+ */
1792
+ declare class RealtimeStrategyIpc extends RealtimeStrategy {
1793
+ protected ctx: EndpointContext;
1794
+ toString(): string;
1795
+ constructor(ctx: EndpointContext);
1796
+ ioServer(__: string, opt: ServerOptions): any;
1797
+ get ioClient(): any;
1798
+ }
1799
+
1800
+ /**
1801
+ * Purpose:
1802
+ * - browser-browser communication mock (in websql mode)
1803
+ */
1804
+ declare class RealtimeStrategyMock extends RealtimeStrategy {
1805
+ protected ctx: EndpointContext;
1806
+ toString(): string;
1807
+ constructor(ctx: EndpointContext);
1808
+ ioServer(url: string, opt: ServerOptions): any;
1809
+ get ioClient(): any;
1810
+ }
1811
+
1812
+ /**
1813
+ * Purpose:
1814
+ * - backend-browser communication
1815
+ * - backend-backend communication
1816
+ */
1817
+ declare class RealtimeStrategySocketIO extends RealtimeStrategy {
1818
+ protected ctx: EndpointContext;
1819
+ toString(): string;
1820
+ constructor(ctx: EndpointContext);
1821
+ ioServer(...args: any[]): any;
1822
+ get ioClient(): typeof io;
1823
+ }
1824
+
1825
+ /**
1826
+ * Realtime class
1827
+ * - mock (when browser-browser)
1828
+ * - sockets (from socket io when backend-browser)
1829
+ * - ipc (when electron is used or between processes)
1830
+ * - webworker (when webworker is used in browser or nodejs)
1831
+ */
1832
+ declare class RealtimeCore {
1833
+ ctx: EndpointContext;
1834
+ readonly allHttpMethods: string[];
1835
+ readonly client: RealtimeClient;
1836
+ readonly server: RealtimeServer;
1837
+ readonly strategy: RealtimeStrategy;
1838
+ /**
1839
+ * global FE socket - only for established connection
1840
+ */
1841
+ conectSocketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
1842
+ /**
1843
+ * socket for namespaces and rooms
1844
+ */
1845
+ socketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
1846
+ /**
1847
+ * global BE socket - only for established connection
1848
+ */
1849
+ connectSocketBE: Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
1850
+ /**
1851
+ * socket for namespaces and rooms
1852
+ */
1853
+ socketBE: Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
1854
+ constructor(ctx: EndpointContext);
1855
+ private resolveStrategy;
1856
+ pathFor(namespace?: string): URL;
1857
+ }
1858
+
1859
+ /**
1860
+ * Client for realtime communication
1861
+ * you can listen to:
1862
+ * - entity changes (any property in table changed)
1863
+ * - entity custom property changes (specific property changed)
1864
+ * - entity table changes (new instance added, instance removed)
1865
+ * - custom events
1866
+ */
1867
+ declare class RealtimeClient {
1868
+ private core;
1869
+ private subsManagers;
1870
+ constructor(core: RealtimeCore);
1871
+ private init;
1872
+ /**
1873
+ * Usage:
1874
+ * myContext.realtimeClient.listenChangesEntity(myEntityInstance);
1875
+ *
1876
+ *
1877
+ * Changes trigger on backend needs to be done manually.. example code:
1878
+ *
1879
+ * myContext.realtimeServer.triggerEntityChanges(myEntityInstance);
1880
+ * ...
1881
+ */
1882
+ listenChangesEntity<RESULT = any>(entityClassFnOrObj: Function | object, options?: RealtimeModels.ChangeOption): Observable<RESULT>;
1883
+ /**
1884
+ * Listen changes entity table
1885
+ * Example: for pagination, lists update ...
1886
+ */
1887
+ listenChangesEntityTable<RESULT = any>(entityClassFn: Function): Observable<RESULT>;
1888
+ listenChangesCustomEvent<RESULT = any>(customEvent: string): Observable<RESULT>;
1889
+ /**
1890
+ * Trigger custom event on backend
1891
+ * @param customEvent global event name
1892
+ * @param dataToPush
1893
+ */
1894
+ triggerCustomEvent(customEvent: string, dataToPush?: any): void;
1895
+ private getUniqueIdentifierForConnection;
1896
+ }
1897
+
1898
+ declare class RealtimeSubsManager {
1899
+ private options;
1900
+ private isListening;
1901
+ private observers;
1902
+ constructor(options: RealtimeModels.SubsManagerOpt);
1903
+ startListenIfNotStarted(realtime: Socket<DefaultEventsMap, DefaultEventsMap>): void;
1904
+ add(observer: Subscriber<any>): void;
1905
+ remove(observer: Subscriber<any>): void;
1906
+ private update;
1907
+ }
1908
+
1909
+ /**
1910
+ * Controller decorator
1911
+ */
1912
+ declare function TaonController<ControllerClass = any>(options?: TaonControllerOptions<ControllerClass>): (constructor: Function) => void;
1913
+
1914
+ /**
1915
+ * Entity decorator
1916
+ */
1917
+ declare function TaonEntity<T = any>(options?: TaonEntityOptions<T>): (constructor: Function) => void;
1918
+ declare class TaonEntityOptions<T = any> extends DecoratorAbstractOpt {
1919
+ /**
1920
+ * default unique property is "id"
1921
+ * for your entity it may be something else
1922
+ */
1923
+ uniqueKeyProp?: string;
1924
+ createTable?: boolean;
1925
+ defaultModelValues?: Mapping.ModelValue<T>;
1926
+ defaultModelMapping?: Mapping.Mapping<T>;
1927
+ defaultModelMappingDeep?: {
1928
+ [lodashPathes: string]: string | [string];
1929
+ };
1930
+ }
1931
+
1932
+ /**
1933
+ * Provider decorator
1934
+ */
1935
+ declare function TaonMiddleware<T = any>(options?: TaonMiddlewareOptions<T>): (constructor: Function) => void;
1936
+ declare class TaonMiddlewareOptions<T = any> extends DecoratorAbstractOpt {
1937
+ }
1938
+
1939
+ /**
1940
+ * Migration decorator
1941
+ */
1942
+ declare function TaonMigration(options: TaonMigrationOptions): any;
1943
+ declare class TaonMigrationOptions<T = any> extends DecoratorAbstractOpt {
1944
+ }
1945
+
1946
+ /**
1947
+ * Provider decorator
1948
+ */
1949
+ declare function TaonProvider<T = any>(options?: TaonProviderOptions<T>): (constructor: Function) => void;
1950
+ declare class TaonProviderOptions<T = any> extends DecoratorAbstractOpt {
1951
+ }
1952
+
1953
+ /**
1954
+ * Repository decorator
1955
+ */
1956
+ declare function TaonRepository(options: TaonRepositoryOptions): (constructor: Function) => void;
1957
+ declare class TaonRepositoryOptions<T = any> extends DecoratorAbstractOpt {
1958
+ }
1959
+
1960
+ /**
1961
+ * Subscriber decorator
1962
+ */
1963
+ declare function TaonSubscriber(options: TaonSubscriberOptions): any;
1964
+ declare class TaonSubscriberOptions<T = any> extends DecoratorAbstractOpt {
1965
+ allowedEvents?: (keyof T)[];
1966
+ }
1967
+
1968
+ /**
1969
+ * @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
1970
+ */
1971
+ declare function Path(name: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
1972
+ declare function Query(name?: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
1973
+ declare function Cookie(name: string, expireInSecond?: number): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
1974
+ declare function Header(name?: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
1975
+ declare function Body(name?: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
1976
+
1977
+ declare class TaonAdminService {
1978
+ private static _instance;
1979
+ static get Instance(): TaonAdminService;
1980
+ scrollableEnabled: boolean;
1981
+ private onEditMode;
1982
+ onEditMode$: rxjs.Observable<unknown>;
1983
+ adminPanelIsOpen: boolean;
1984
+ draggablePopupMode: boolean;
1985
+ draggablePopupModeFullScreen: boolean;
1986
+ /**
1987
+ * Property used in taon
1988
+ */
1989
+ keepWebsqlDbDataAfterReload: boolean;
1990
+ constructor();
1991
+ setEditMode(value: boolean): void;
1992
+ setKeepWebsqlDbDataAfterReload(value: boolean): void;
1993
+ enabledTabs: any[];
1994
+ hide(): void;
1995
+ show(): void;
1996
+ logout(): void;
1997
+ }
1998
+
1999
+ declare namespace Taon {
2000
+ const error: (opt: Pick<RestErrorResponseWrapper, "message" | "status" | "details" | "code"> | string) => void;
2001
+ type ResponseHtml = Models.Http.Response<string>;
2002
+ export import Response = Models.Http.Response;
2003
+ export import StartParams = Models.StartParams;
2004
+ const getResponseValue: <T>(response: Response<T>, options?: {
2005
+ req: express.Request;
2006
+ res: express.Response;
2007
+ }) => Promise<T>;
2008
+ const isBrowser: boolean;
2009
+ const isNode: boolean;
2010
+ const isWebSQL: boolean;
2011
+ const isElectron: boolean;
2012
+ const createContext: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARES extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARES>) => {
2013
+ readonly contextName: string;
2014
+ readonly appId: string;
2015
+ cloneAsRemote: (cloneOpt?: {
2016
+ overrideRemoteHost?: string;
2017
+ }) => /*elided*/ any;
2018
+ cloneAsNormal: (cloneOpt?: {
2019
+ overrideHost?: string;
2020
+ }) => /*elided*/ any;
2021
+ __ref(): Promise<EndpointContext>;
2022
+ readonly __refSync: EndpointContext;
2023
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
2024
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
2025
+ initialize: (overrideOptions?: Models.TaonInitializeParams) => Promise<EndpointContext>;
2026
+ readonly realtime: {
2027
+ readonly client: taon.RealtimeClient;
2028
+ readonly server: taon.RealtimeServer;
2029
+ };
2030
+ };
2031
+ const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARE extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARE>) => () => {
2032
+ readonly contextName: string;
2033
+ readonly appId: string;
2034
+ cloneAsRemote: (cloneOpt?: {
2035
+ overrideRemoteHost?: string;
2036
+ }) => /*elided*/ any;
2037
+ cloneAsNormal: (cloneOpt?: {
2038
+ overrideHost?: string;
2039
+ }) => /*elided*/ any;
2040
+ __ref(): Promise<EndpointContext>;
2041
+ readonly __refSync: EndpointContext;
2042
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
2043
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
2044
+ initialize: (overrideOptions?: Models.TaonInitializeParams) => Promise<EndpointContext>;
2045
+ readonly realtime: {
2046
+ readonly client: taon.RealtimeClient;
2047
+ readonly server: taon.RealtimeServer;
2048
+ };
2049
+ };
2050
+ const inject: <T>(entity: () => new (...args: any[]) => T) => T;
2051
+ const initNgZone: (ngZone: NgZone) => void;
2052
+ const symbols: typeof Symbols;
2053
+ /**
2054
+ * @deprecated
2055
+ * use createContext instead
2056
+ */
2057
+ const init: (options: {
2058
+ host: string;
2059
+ entities: Function[];
2060
+ controllers: Function[];
2061
+ }) => Promise<{
2062
+ readonly contextName: string;
2063
+ readonly appId: string;
2064
+ cloneAsRemote: (cloneOpt?: {
2065
+ overrideRemoteHost?: string;
2066
+ }) => /*elided*/ any;
2067
+ cloneAsNormal: (cloneOpt?: {
2068
+ overrideHost?: string;
2069
+ }) => /*elided*/ any;
2070
+ __ref(): Promise<EndpointContext>;
2071
+ readonly __refSync: EndpointContext;
2072
+ getClassInstance<T>(ctor: new (...args: any[]) => T): T;
2073
+ getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
2074
+ initialize: (overrideOptions?: Models.TaonInitializeParams) => Promise<EndpointContext>;
2075
+ readonly realtime: {
2076
+ readonly client: taon.RealtimeClient;
2077
+ readonly server: taon.RealtimeServer;
2078
+ };
2079
+ }>;
2080
+ }
2081
+ declare const TAON_FLATTEN_MAPPING: {
2082
+ 'taon/src': {
2083
+ 'Taon.Http.GET': string;
2084
+ 'Taon.Http.POST': string;
2085
+ 'Taon.Http.PUT': string;
2086
+ 'Taon.Http.DELETE': string;
2087
+ 'Taon.Http.PATCH': string;
2088
+ 'Taon.Http.HEAD': string;
2089
+ 'Taon.Http.HTML': string;
2090
+ 'Taon.Http.Response': string;
2091
+ 'Taon.Http.Param.Query': string;
2092
+ 'Taon.Http.Param.Path': string;
2093
+ 'Taon.Http.Param.Body': string;
2094
+ 'Taon.Http.Param.Cookie': string;
2095
+ 'Taon.Http.Param.Header': string;
2096
+ 'Taon.Base.Controller': string;
2097
+ 'Taon.Base.CrudController': string;
2098
+ 'Taon.Base.Entity': string;
2099
+ 'Taon.Base.AbstractEntity': string;
2100
+ 'Taon.Base.AbstractEntityOmitKeys': string;
2101
+ 'Taon.Base.Provider': string;
2102
+ 'Taon.Base.Class': string;
2103
+ 'Taon.Base.Repository': string;
2104
+ 'Taon.Base.CustomRepository': string;
2105
+ 'Taon.Base.SubscriberForEntity': string;
2106
+ 'Taon.Base.Migration': string;
2107
+ 'Taon.Base.Middleware': string;
2108
+ 'Taon.Base.AngularService': string;
2109
+ 'Taon.Base.Context': string;
2110
+ 'Taon.Controller': string;
2111
+ 'Taon.Entity': string;
2112
+ 'Taon.Provider': string;
2113
+ 'Taon.Repository': string;
2114
+ 'Taon.Subscriber': string;
2115
+ 'Taon.Migration': string;
2116
+ 'Taon.Middleware': string;
2117
+ 'Taon.Orm.Repository': string;
2118
+ 'Taon.Orm.Connection': string;
2119
+ 'Taon.Orm.ListenEvent.AfterInsert': string;
2120
+ 'Taon.Orm.ListenEvent.AfterLoad': string;
2121
+ 'Taon.Orm.ListenEvent.AfterRecover': string;
2122
+ 'Taon.Orm.ListenEvent.AfterRemove': string;
2123
+ 'Taon.Orm.ListenEvent.AfterSoftRemove': string;
2124
+ 'Taon.Orm.ListenEvent.AfterUpdate': string;
2125
+ 'Taon.Orm.ListenEvent.BeforeInsert': string;
2126
+ 'Taon.Orm.ListenEvent.BeforeRecover': string;
2127
+ 'Taon.Orm.ListenEvent.BeforeRemove': string;
2128
+ 'Taon.Orm.ListenEvent.BeforeSoftRemove': string;
2129
+ 'Taon.Orm.ListenEvent.BeforeUpdate': string;
2130
+ 'Taon.Orm.Tree.Children': string;
2131
+ 'Taon.Orm.Tree.Parent': string;
2132
+ 'Taon.Orm.Column.Generated': string;
2133
+ 'Taon.Orm.Column.Primary': string;
2134
+ 'Taon.Orm.Column.Index': string;
2135
+ 'Taon.Orm.Column.CreateDate': string;
2136
+ 'Taon.Orm.Column.UpdateDate': string;
2137
+ 'Taon.Orm.Column.DeleteDate': string;
2138
+ 'Taon.Orm.Column.Custom': string;
2139
+ 'Taon.Orm.Column.String': string;
2140
+ 'Taon.Orm.Column.String100': string;
2141
+ 'Taon.Orm.Column.String45': string;
2142
+ 'Taon.Orm.Column.String500': string;
2143
+ 'Taon.Orm.Column.String200': string;
2144
+ 'Taon.Orm.Column.Number': string;
2145
+ 'Taon.Orm.Column.DecimalNumber': string;
2146
+ 'Taon.Orm.Column.SimpleJson': string;
2147
+ 'Taon.Orm.Column.Boolean': string;
2148
+ 'Taon.Orm.Column.DateTIme': string;
2149
+ 'Taon.Orm.Column.Version': string;
2150
+ 'Taon.Orm.Column.Virtual': string;
2151
+ 'Taon.Orm.Join.Table': string;
2152
+ 'Taon.Orm.Join.Column': string;
2153
+ 'Taon.Orm.Relation.OneToMany': string;
2154
+ 'Taon.Orm.Relation.OneToOne': string;
2155
+ 'Taon.Orm.Relation.ManyToMany': string;
2156
+ 'Taon.Orm.Relation.ManyToOne': string;
2157
+ };
2158
+ };
2159
+
2160
+ 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, RealtimeModels, 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 };
2161
+ export type { AbstractEntityOmitKeys, FormlyArrayTransformFn, FormlyEntityType, FormlyInputType, MigrationStatus, MulterFileUploadResponse, TaonAdditionalMiddlewareMethodInfo, TaonContext, TaonEntityKeysToOmit, TaonHttpDecoratorOptions, TaonMiddlewareFunction, TaonMiddlewareInheritanceObj };