vona-module-a-orm 5.0.56 → 5.0.58
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/dist/.metadata/index.d.ts +21 -0
- package/dist/bean/bean.model/bean.model_meta.d.ts +5 -5
- package/dist/bean/broadcast.databaseClientDispose.d.ts +9 -0
- package/dist/bean/event.databaseClientDispose.d.ts +8 -0
- package/dist/bean/queue.doubleDelete.d.ts +1 -1
- package/dist/index.js +249 -200
- package/dist/service/database.d.ts +5 -1
- package/dist/service/databaseClient_.d.ts +2 -2
- package/dist/types/onion/model.d.ts +3 -2
- package/dist/types/relationsDef.d.ts +2 -3
- package/package.json +1 -1
|
@@ -3,7 +3,9 @@ import type { ConfigDatabaseClient } from '../types/config.ts';
|
|
|
3
3
|
import type { IDatabaseClientDialectRecord, IDatabaseClientRecord, IDbInfo } from '../types/database.ts';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
5
|
export declare class ServiceDatabase extends BeanBase {
|
|
6
|
+
get configDatabase(): import("../types/config.ts").ConfigDatabase;
|
|
6
7
|
getDialect(client: keyof IDatabaseClientDialectRecord): BeanDatabaseDialectBase;
|
|
8
|
+
getClientConfig(clientName: keyof IDatabaseClientRecord, original?: boolean): ConfigDatabaseClient;
|
|
7
9
|
prepareDbInfo(dbInfoOrClientName?: Partial<IDbInfo> | keyof IDatabaseClientRecord): IDbInfo;
|
|
8
10
|
prepareClientNameSelector(dbInfo: IDbInfo): string;
|
|
9
11
|
parseClientNameSelector(clientNameSelector: string): IDbInfo;
|
|
@@ -13,5 +15,7 @@ export declare class ServiceDatabase extends BeanBase {
|
|
|
13
15
|
columnsClear(clientName?: keyof IDatabaseClientRecord, tableName?: string): void;
|
|
14
16
|
private __columnsClearRaw;
|
|
15
17
|
reloadClients(clientName?: keyof IDatabaseClientRecord, clientConfig?: ConfigDatabaseClient, extraData?: any): Promise<void>;
|
|
16
|
-
|
|
18
|
+
reloadClientsRaw(clientName?: keyof IDatabaseClientRecord, clientConfig?: ConfigDatabaseClient, extraData?: any): Promise<void>;
|
|
19
|
+
disposeClients(clientName?: keyof IDatabaseClientRecord): Promise<void>;
|
|
20
|
+
disposeClientsRaw(clientName?: keyof IDatabaseClientRecord): Promise<void>;
|
|
17
21
|
}
|
|
@@ -15,6 +15,7 @@ export declare class ServiceDatabaseClient extends BeanBase {
|
|
|
15
15
|
private _knex;
|
|
16
16
|
private _db;
|
|
17
17
|
private _onDatabaseClientReloadCancel?;
|
|
18
|
+
private _onDatabaseClientDisposeCancel?;
|
|
18
19
|
get configDatabase(): import("../types/config.ts").ConfigDatabase;
|
|
19
20
|
get connection(): Knex;
|
|
20
21
|
get db(): ServiceDb;
|
|
@@ -23,8 +24,7 @@ export declare class ServiceDatabaseClient extends BeanBase {
|
|
|
23
24
|
private __load;
|
|
24
25
|
private __close;
|
|
25
26
|
reload(clientConfig?: ConfigDatabaseClient): Promise<void>;
|
|
26
|
-
getClientConfig(clientName: keyof IDatabaseClientRecord, original?: boolean): ConfigDatabaseClient;
|
|
27
27
|
getDatabaseName(): string;
|
|
28
28
|
private _prepareDatabaseName;
|
|
29
|
-
|
|
29
|
+
changeConfigConnectionAndReload(databaseName: string): Promise<void>;
|
|
30
30
|
}
|
|
@@ -10,7 +10,7 @@ export interface IModelRecord {
|
|
|
10
10
|
}
|
|
11
11
|
export interface IModelClassRecord {
|
|
12
12
|
}
|
|
13
|
-
export type TypeDynamicTableName = (ctx: VonaContext, defaultTable: keyof ITableRecord, modelInstance: any) => string;
|
|
13
|
+
export type TypeDynamicTableName = (ctx: VonaContext, where: any | undefined, defaultTable: keyof ITableRecord, modelInstance: any) => string;
|
|
14
14
|
export type TypeDynamicClientName = (ctx: VonaContext, modelInstance: any) => keyof IDatabaseClientRecord;
|
|
15
15
|
export type TypeModelsClearedByFn = (ctx: VonaContext, modelTarget: any, modelSource: any) => Promise<void>;
|
|
16
16
|
export type TypeSoftDeletionPruneHandler = (ctx: VonaContext, modelInstance: any, options: ISoftDeletionPruneHandlerOptions) => Promise<void>;
|
|
@@ -21,9 +21,10 @@ export interface ISoftDeletionPrune {
|
|
|
21
21
|
handler?: TypeSoftDeletionPruneHandler;
|
|
22
22
|
expired?: number;
|
|
23
23
|
}
|
|
24
|
+
export type TypeModelOptionsTable = TypeDynamicTableName | keyof ITableRecord;
|
|
24
25
|
export interface IDecoratorModelOptions<TRecord extends EntityBaseEmpty = any> {
|
|
25
26
|
entity?: Constructable<TRecord>;
|
|
26
|
-
table?:
|
|
27
|
+
table?: TypeModelOptionsTable;
|
|
27
28
|
disableDeleted?: boolean;
|
|
28
29
|
disableInstance?: boolean;
|
|
29
30
|
disableCreateTime?: boolean;
|
|
@@ -4,8 +4,7 @@ import type { IDatabaseClientRecord } from './database.ts';
|
|
|
4
4
|
import type { TypeModelSelectAggrParamsAggrs } from './modelAggr.ts';
|
|
5
5
|
import type { IBuildModelSelectGeneralParamsBasic } from './modelGeneral.ts';
|
|
6
6
|
import type { TypeModelColumn, TypeModelColumnsPatch, TypeModelColumnsStrict } from './modelWhere.ts';
|
|
7
|
-
import type { IModelClassRecord } from './onion/model.ts';
|
|
8
|
-
import type { ITableRecord } from './onion/table.ts';
|
|
7
|
+
import type { IModelClassRecord, TypeModelOptionsTable } from './onion/model.ts';
|
|
9
8
|
import type { TypeModelClassLike, TypeModelOfModelLike, TypeModelsClassLikeGeneral, TypeSymbolKeyEntity } from './relations.ts';
|
|
10
9
|
import type { TypeEntityTableColumnNamesOfGeneral, TypeEntityTableColumnsOfGeneral } from './relationsColumns.ts';
|
|
11
10
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
@@ -48,7 +47,7 @@ export interface IBuildModelRelationOptionsMany<TRecord, AUTOLOAD extends boolea
|
|
|
48
47
|
}
|
|
49
48
|
export interface IModelRelationOptionsMetaBasic {
|
|
50
49
|
client?: TypeModelRelationOptionsMetaClient;
|
|
51
|
-
table?:
|
|
50
|
+
table?: TypeModelOptionsTable;
|
|
52
51
|
}
|
|
53
52
|
export interface IModelRelationOptionsMeta extends IModelRelationOptionsMetaBasic {
|
|
54
53
|
middle?: IModelRelationOptionsMetaBasic;
|