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