vona-module-a-orm 5.0.85 → 5.0.87
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 +17 -0
- package/dist/bean/bean.database.d.ts +0 -1
- package/dist/bean/bean.databaseDialectBase.d.ts +2 -1
- package/dist/bean/bean.model/bean.model_cache.d.ts +2 -6
- package/dist/bean/hmr.model.d.ts +6 -0
- package/dist/index.js +229 -188
- package/dist/lib/const.d.ts +9 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/modelCacheBase.d.ts +2 -2
- package/dist/service/database.d.ts +1 -1
- package/dist/service/databaseClient_.d.ts +1 -1
- package/dist/types/database.d.ts +1 -1
- package/package.json +2 -2
|
@@ -191,6 +191,23 @@ declare module 'vona-module-a-orm' {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
/** schedule: end */
|
|
194
|
+
/** hmr: begin */
|
|
195
|
+
export * from '../bean/hmr.model.ts';
|
|
196
|
+
import 'vona';
|
|
197
|
+
declare module 'vona' {
|
|
198
|
+
interface IHmrRecord {
|
|
199
|
+
'a-orm:model': never;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
declare module 'vona-module-a-orm' {
|
|
203
|
+
interface HmrModel {
|
|
204
|
+
}
|
|
205
|
+
interface HmrModel {
|
|
206
|
+
get $beanFullName(): 'a-orm.hmr.model';
|
|
207
|
+
get $onionName(): 'a-orm:model';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** hmr: end */
|
|
194
211
|
/** config: begin */
|
|
195
212
|
export * from '../config/config.ts';
|
|
196
213
|
import type { config } from '../config/config.ts';
|
|
@@ -11,5 +11,4 @@ export declare class BeanDatabase extends BeanBase {
|
|
|
11
11
|
getDialect(client: keyof IDatabaseClientDialectRecord): BeanDatabaseDialectBase;
|
|
12
12
|
switchDbIsolate<RESULT>(fn: FunctionAsync<RESULT>, dbInfoOrClientName?: Partial<IDbInfo> | keyof IDatabaseClientRecord): Promise<RESULT>;
|
|
13
13
|
switchDb<RESULT>(fn: FunctionAsync<RESULT>, dbInfoOrClientName?: Partial<IDbInfo> | keyof IDatabaseClientRecord): Promise<RESULT>;
|
|
14
|
-
private _prepareClientConfig;
|
|
15
14
|
}
|
|
@@ -6,8 +6,9 @@ import type { IDatabaseDialectCapabilities, IFetchDatabasesResultItem, IFetchInd
|
|
|
6
6
|
import { BeanBase } from 'vona';
|
|
7
7
|
export declare class BeanDatabaseDialectBase extends BeanBase {
|
|
8
8
|
protected _capabilities?: IDatabaseDialectCapabilities;
|
|
9
|
+
protected _configBase?: Partial<ConfigDatabaseClient>;
|
|
9
10
|
get capabilities(): IDatabaseDialectCapabilities;
|
|
10
|
-
|
|
11
|
+
get configBase(): Partial<ConfigDatabaseClient> | undefined;
|
|
11
12
|
fetchDatabases(_schemaBuilder: Knex.SchemaBuilder, _databasePrefix: string): Promise<IFetchDatabasesResultItem[]>;
|
|
12
13
|
createDatabase(_schemaBuilder: Knex.SchemaBuilder, _databaseName: string): Promise<string>;
|
|
13
14
|
dropDatabase(_schemaBuilder: Knex.SchemaBuilder, _databaseName: string): Promise<void>;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { ServiceDb } from '../../service/db_.ts';
|
|
3
|
-
import type { IDatabaseClientRecord, IModelDeleteOptions, IModelGetOptions, IModelInsertOptions, IModelMethodOptions, IModelMethodOptionsGeneral, IModelMutateOptions,
|
|
3
|
+
import type { IDatabaseClientRecord, IModelDeleteOptions, IModelGetOptions, IModelInsertOptions, IModelMethodOptions, IModelMethodOptionsGeneral, IModelMutateOptions, IModelSelectAggrParams, IModelSelectCountParams, IModelSelectGroupParams, IModelSelectParams, IModelUpdateOptions, ITableRecord, TypeModelAggrRelationResult, TypeModelGroupRelationResult, TypeModelsClassLikeGeneral, TypeModelWhere } from '../../types/index.ts';
|
|
4
4
|
import { ServiceCacheEntity } from '../../service/cacheEntity_.ts';
|
|
5
5
|
import { ServiceCacheQuery } from '../../service/cacheQuery_.ts';
|
|
6
6
|
import { ServiceRelations } from '../../service/relations_.ts';
|
|
7
7
|
import { BeanModelCrud } from './bean.model_crud.ts';
|
|
8
|
-
declare const SymbolModelsClearAll: unique symbol;
|
|
9
8
|
export declare class BeanModelCache<TRecord extends {} = {}> extends BeanModelCrud<TRecord> {
|
|
10
9
|
cacheQuery: ServiceCacheQuery;
|
|
11
10
|
cacheEntity: ServiceCacheEntity;
|
|
12
11
|
protected relations: ServiceRelations;
|
|
13
|
-
protected [SymbolModelsClearAll]: Record<keyof IModelRecord, TypeModelClassLikeGeneral[]>;
|
|
14
12
|
protected __init__(clientName?: keyof IDatabaseClientRecord | ServiceDb, table?: keyof ITableRecord): void;
|
|
13
|
+
protected __dispose__(): Promise<void>;
|
|
15
14
|
insert<T extends IModelInsertOptions<TRecord>>(data?: Partial<TRecord>, options?: T): Promise<TRecord>;
|
|
16
15
|
insertBulk<T extends IModelInsertOptions<TRecord>>(items: Partial<TRecord>[], options?: T): Promise<TRecord[]>;
|
|
17
16
|
__insertBulk_raw(table: keyof ITableRecord | undefined, items: Partial<TRecord>[], options?: IModelMutateOptions<TRecord>): Promise<TRecord[]>;
|
|
@@ -51,12 +50,9 @@ export declare class BeanModelCache<TRecord extends {} = {}> extends BeanModelCr
|
|
|
51
50
|
private _shardingCacheDoubleDelete;
|
|
52
51
|
private _cacheQueryClearModelsClear;
|
|
53
52
|
private _getModelsClear;
|
|
54
|
-
private _getModelsClearAll;
|
|
55
|
-
private _collectModelsClearAll;
|
|
56
53
|
protected _checkDisableCacheQueryByOptions(options?: IModelMethodOptionsGeneral): boolean;
|
|
57
54
|
protected _checkDisableCacheEntityByOptions(options?: IModelMethodOptionsGeneral): boolean;
|
|
58
55
|
private __checkIfOnlyKey;
|
|
59
56
|
private __checkCacheKeyValid;
|
|
60
57
|
protected __get__(prop: string): ((fieldValue?: any, options?: any) => Promise<Partial<TRecord> | undefined>) | ((fieldValue?: any, params?: any, options?: any, modelJoins?: any) => Promise<any[]>) | ((fieldValue: any, data: any, options?: any) => Promise<Partial<TRecord>>) | ((fieldValue: any, options?: any) => Promise<void>) | undefined;
|
|
61
58
|
}
|
|
62
|
-
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IDecoratorBeanOptionsBase } from 'vona';
|
|
2
|
+
import type { IHmrReload } from 'vona-module-a-hmr';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
export declare class HmrModel extends BeanBase implements IHmrReload {
|
|
5
|
+
reload(_beanOptions: IDecoratorBeanOptionsBase): Promise<void>;
|
|
6
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { BeanInfo, BeanAopMethodBase, BeanBase, deepExtend, appResource, beanFullNameFromOnionName, Virtual, cast, useApp, BeanSimple, combineConfigDefault, BeanScopeBase, createBeanDecorator, PickClassInner, $Class } from 'vona';
|
|
2
|
+
import { BeanInfo, BeanAopMethodBase, BeanBase, deepExtend, appResource, beanFullNameFromOnionName, Virtual, cast, useApp, disposeInstance, BeanSimple, combineConfigDefault, BeanScopeBase, createBeanDecorator, PickClassInner, $Class } from 'vona';
|
|
3
3
|
import { AopMethod } from 'vona-module-a-aspect';
|
|
4
4
|
import { Service, Bean, Scope } from 'vona-module-a-bean';
|
|
5
5
|
import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';
|
|
@@ -15,25 +15,26 @@ import { Broadcast, BeanBroadcastBase } from 'vona-module-a-broadcast';
|
|
|
15
15
|
import { Event, BeanEventBase } from 'vona-module-a-event';
|
|
16
16
|
import { Queue, BeanQueueBase } from 'vona-module-a-queue';
|
|
17
17
|
import { Schedule } from 'vona-module-a-schedule';
|
|
18
|
+
import { Hmr } from 'vona-module-a-hmr';
|
|
18
19
|
import { configAll, configRedis } from 'vona-module-a-summer';
|
|
19
20
|
import { ServiceDatabaseAsyncLocalStorage as ServiceDatabaseAsyncLocalStorage$1, ServiceTransactionConsistency as ServiceTransactionConsistency_ } from 'vona-module-a-orm';
|
|
20
21
|
import { mutate } from 'mutate-on-copy';
|
|
21
22
|
|
|
22
|
-
var _dec$
|
|
23
|
-
let AopMethodTransaction = (_dec$
|
|
23
|
+
var _dec$w, _dec2$w, _class$w;
|
|
24
|
+
let AopMethodTransaction = (_dec$w = AopMethod(), _dec2$w = BeanInfo({
|
|
24
25
|
module: "a-orm"
|
|
25
|
-
}), _dec$
|
|
26
|
+
}), _dec$w(_class$w = _dec2$w(_class$w = class AopMethodTransaction extends BeanAopMethodBase {
|
|
26
27
|
execute(options, _args, next, _receiver, _prop) {
|
|
27
28
|
return this.bean.database.current.transaction.begin(() => {
|
|
28
29
|
return next();
|
|
29
30
|
}, options);
|
|
30
31
|
}
|
|
31
|
-
}) || _class$
|
|
32
|
+
}) || _class$w) || _class$w);
|
|
32
33
|
|
|
33
|
-
var _dec$
|
|
34
|
-
let ServiceDatabaseAsyncLocalStorage = (_dec$
|
|
34
|
+
var _dec$v, _dec2$v, _class$v;
|
|
35
|
+
let ServiceDatabaseAsyncLocalStorage = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
35
36
|
module: "a-orm"
|
|
36
|
-
}), _dec$
|
|
37
|
+
}), _dec$v(_class$v = _dec2$v(_class$v = class ServiceDatabaseAsyncLocalStorage extends BeanBase {
|
|
37
38
|
constructor(...args) {
|
|
38
39
|
super(...args);
|
|
39
40
|
this.dbStorage = void 0;
|
|
@@ -52,14 +53,14 @@ let ServiceDatabaseAsyncLocalStorage = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
|
52
53
|
return fn();
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
}) || _class$
|
|
56
|
+
}) || _class$v) || _class$v);
|
|
56
57
|
|
|
57
|
-
var _dec$
|
|
58
|
+
var _dec$u, _dec2$u, _class$u;
|
|
58
59
|
const SymbolColumnsCache = Symbol('SymbolColumnsCache');
|
|
59
60
|
const SymbolColumnsDefaultCache = Symbol('SymbolColumnsDefaultCache');
|
|
60
|
-
let ServiceColumnsCache = (_dec$
|
|
61
|
+
let ServiceColumnsCache = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
61
62
|
module: "a-orm"
|
|
62
|
-
}), _dec$
|
|
63
|
+
}), _dec$u(_class$u = _dec2$u(_class$u = class ServiceColumnsCache extends BeanBase {
|
|
63
64
|
constructor(...args) {
|
|
64
65
|
super(...args);
|
|
65
66
|
this.clientName = void 0;
|
|
@@ -114,12 +115,12 @@ let ServiceColumnsCache = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
114
115
|
return exists;
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
}) || _class$
|
|
118
|
+
}) || _class$u) || _class$u);
|
|
118
119
|
|
|
119
|
-
var _dec$
|
|
120
|
-
let ServiceColumns = (_dec$
|
|
120
|
+
var _dec$t, _dec2$t, _class$t;
|
|
121
|
+
let ServiceColumns = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
121
122
|
module: "a-orm"
|
|
122
|
-
}), _dec$
|
|
123
|
+
}), _dec$t(_class$t = _dec2$t(_class$t = class ServiceColumns extends BeanBase {
|
|
123
124
|
constructor(...args) {
|
|
124
125
|
super(...args);
|
|
125
126
|
this._db = void 0;
|
|
@@ -170,7 +171,7 @@ let ServiceColumns = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
|
170
171
|
columnsClear(tableName) {
|
|
171
172
|
return this.scope.service.database.columnsClear(this.db.clientName, tableName);
|
|
172
173
|
}
|
|
173
|
-
}) || _class$
|
|
174
|
+
}) || _class$t) || _class$t);
|
|
174
175
|
|
|
175
176
|
const TransactionIsolationLevelsMap = {
|
|
176
177
|
DEFAULT: undefined,
|
|
@@ -183,27 +184,27 @@ const TransactionIsolationLevelsMap = {
|
|
|
183
184
|
|
|
184
185
|
// export type TransactionPropagation=''
|
|
185
186
|
|
|
186
|
-
var _dec$
|
|
187
|
-
let ServiceDatabase = (_dec$
|
|
187
|
+
var _dec$s, _dec2$s, _class$s;
|
|
188
|
+
let ServiceDatabase = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
188
189
|
module: "a-orm"
|
|
189
|
-
}), _dec$
|
|
190
|
+
}), _dec$s(_class$s = _dec2$s(_class$s = class ServiceDatabase extends BeanBase {
|
|
190
191
|
get configDatabase() {
|
|
191
192
|
return this.app.config.database;
|
|
192
193
|
}
|
|
193
|
-
getClientConfig(clientName, original
|
|
194
|
+
getClientConfig(clientName, clientConfig, original) {
|
|
194
195
|
// clientConfig
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
if (!clientConfig) {
|
|
197
|
+
clientConfig = this.configDatabase.clients[clientName];
|
|
198
|
+
}
|
|
197
199
|
// check
|
|
198
200
|
if (!clientConfig) {
|
|
199
201
|
throw new Error(`database config not found: ${clientName}`);
|
|
200
202
|
}
|
|
203
|
+
if (original) return clientConfig;
|
|
201
204
|
// configBaseClient
|
|
202
205
|
const dialect = this.bean.database.getDialect(clientConfig.client);
|
|
203
|
-
const configBaseClient = dialect.getConfigBase();
|
|
204
206
|
// combine
|
|
205
|
-
|
|
206
|
-
clientConfig = deepExtend({}, configBase, configBaseClient, clientConfig);
|
|
207
|
+
clientConfig = deepExtend({}, this.configDatabase.base, dialect.configBase, clientConfig);
|
|
207
208
|
// ready
|
|
208
209
|
return clientConfig;
|
|
209
210
|
}
|
|
@@ -300,17 +301,17 @@ let ServiceDatabase = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
300
301
|
}
|
|
301
302
|
async disposeClients(clientName) {
|
|
302
303
|
clientName = this.prepareClientName(clientName);
|
|
303
|
-
await this.bean.mutate.
|
|
304
|
+
await this.bean.mutate.removeInstances(ServiceDatabaseClient, {
|
|
304
305
|
clientName
|
|
305
306
|
});
|
|
306
307
|
this.columnsClear(clientName);
|
|
307
308
|
}
|
|
308
|
-
}) || _class$
|
|
309
|
+
}) || _class$s) || _class$s);
|
|
309
310
|
|
|
310
|
-
var _dec$
|
|
311
|
-
let ServiceTransactionConsistency = (_dec$
|
|
311
|
+
var _dec$r, _dec2$r, _class$r;
|
|
312
|
+
let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
312
313
|
module: "a-orm"
|
|
313
|
-
}), _dec$
|
|
314
|
+
}), _dec$r(_class$r = _dec2$r(_class$r = class ServiceTransactionConsistency extends BeanBase {
|
|
314
315
|
constructor(...args) {
|
|
315
316
|
super(...args);
|
|
316
317
|
this._commitCallbacks = [];
|
|
@@ -338,12 +339,12 @@ let ServiceTransactionConsistency = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
|
338
339
|
}
|
|
339
340
|
this._commitCallbacks = [];
|
|
340
341
|
}
|
|
341
|
-
}) || _class$
|
|
342
|
+
}) || _class$r) || _class$r);
|
|
342
343
|
|
|
343
|
-
var _dec$
|
|
344
|
-
let ServiceTransactionFiber = (_dec$
|
|
344
|
+
var _dec$q, _dec2$q, _class$q;
|
|
345
|
+
let ServiceTransactionFiber = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
345
346
|
module: "a-orm"
|
|
346
|
-
}), _dec$
|
|
347
|
+
}), _dec$q(_class$q = _dec2$q(_class$q = class ServiceTransactionFiber extends BeanBase {
|
|
347
348
|
constructor(...args) {
|
|
348
349
|
super(...args);
|
|
349
350
|
this._connection = void 0;
|
|
@@ -372,12 +373,12 @@ let ServiceTransactionFiber = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
|
372
373
|
await this._transactionConsistency.compensatesDone();
|
|
373
374
|
this._connection = undefined;
|
|
374
375
|
}
|
|
375
|
-
}) || _class$
|
|
376
|
+
}) || _class$q) || _class$q);
|
|
376
377
|
|
|
377
|
-
var _dec$
|
|
378
|
-
let ServiceTransactionState = (_dec$
|
|
378
|
+
var _dec$p, _dec2$p, _class$p;
|
|
379
|
+
let ServiceTransactionState = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
379
380
|
module: "a-orm"
|
|
380
|
-
}), _dec$
|
|
381
|
+
}), _dec$p(_class$p = _dec2$p(_class$p = class ServiceTransactionState extends BeanBase {
|
|
381
382
|
constructor(...args) {
|
|
382
383
|
super(...args);
|
|
383
384
|
this._fibers = {};
|
|
@@ -399,12 +400,12 @@ let ServiceTransactionState = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
|
399
400
|
const selector = this.serviceDatabase.prepareClientNameSelector(db.info, db.dialect);
|
|
400
401
|
delete this._fibers[selector];
|
|
401
402
|
}
|
|
402
|
-
}) || _class$
|
|
403
|
+
}) || _class$p) || _class$p);
|
|
403
404
|
|
|
404
|
-
var _dec$
|
|
405
|
-
let ServiceTransactionAsyncLocalStorage = (_dec$
|
|
405
|
+
var _dec$o, _dec2$o, _class$o;
|
|
406
|
+
let ServiceTransactionAsyncLocalStorage = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
406
407
|
module: "a-orm"
|
|
407
|
-
}), _dec$
|
|
408
|
+
}), _dec$o(_class$o = _dec2$o(_class$o = class ServiceTransactionAsyncLocalStorage extends BeanBase {
|
|
408
409
|
constructor(...args) {
|
|
409
410
|
super(...args);
|
|
410
411
|
this.transactionStorage = void 0;
|
|
@@ -425,12 +426,12 @@ let ServiceTransactionAsyncLocalStorage = (_dec$n = Service(), _dec2$n = BeanInf
|
|
|
425
426
|
return fn();
|
|
426
427
|
});
|
|
427
428
|
}
|
|
428
|
-
}) || _class$
|
|
429
|
+
}) || _class$o) || _class$o);
|
|
429
430
|
|
|
430
|
-
var _dec$
|
|
431
|
-
let ServiceTransaction = (_dec$
|
|
431
|
+
var _dec$n, _dec2$n, _class$n;
|
|
432
|
+
let ServiceTransaction = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
432
433
|
module: "a-orm"
|
|
433
|
-
}), _dec$
|
|
434
|
+
}), _dec$n(_class$n = _dec2$n(_class$n = class ServiceTransaction extends BeanBase {
|
|
434
435
|
constructor(...args) {
|
|
435
436
|
super(...args);
|
|
436
437
|
this._db = void 0;
|
|
@@ -549,7 +550,7 @@ let ServiceTransaction = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
549
550
|
}
|
|
550
551
|
return res;
|
|
551
552
|
}
|
|
552
|
-
}) || _class$
|
|
553
|
+
}) || _class$n) || _class$n);
|
|
553
554
|
function _translateTransactionOptions(options) {
|
|
554
555
|
if (!options) return undefined;
|
|
555
556
|
return {
|
|
@@ -558,10 +559,10 @@ function _translateTransactionOptions(options) {
|
|
|
558
559
|
};
|
|
559
560
|
}
|
|
560
561
|
|
|
561
|
-
var _dec$
|
|
562
|
-
let ServiceDb = (_dec$
|
|
562
|
+
var _dec$m, _dec2$m, _class$m;
|
|
563
|
+
let ServiceDb = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
563
564
|
module: "a-orm"
|
|
564
|
-
}), _dec$
|
|
565
|
+
}), _dec$m(_class$m = _dec2$m(_class$m = class ServiceDb extends BeanBase {
|
|
565
566
|
constructor(...args) {
|
|
566
567
|
super(...args);
|
|
567
568
|
this._client = void 0;
|
|
@@ -616,12 +617,12 @@ let ServiceDb = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
|
616
617
|
compensate(cb) {
|
|
617
618
|
return this.transaction.compensate(cb);
|
|
618
619
|
}
|
|
619
|
-
}) || _class$
|
|
620
|
+
}) || _class$m) || _class$m);
|
|
620
621
|
|
|
621
|
-
var _dec$
|
|
622
|
-
let ServiceDatabaseClient = (_dec$
|
|
622
|
+
var _dec$l, _dec2$l, _class$l;
|
|
623
|
+
let ServiceDatabaseClient = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
623
624
|
module: "a-orm"
|
|
624
|
-
}), _dec$
|
|
625
|
+
}), _dec$l(_class$l = _dec2$l(_class$l = class ServiceDatabaseClient extends BeanMutateBase {
|
|
625
626
|
constructor(...args) {
|
|
626
627
|
super(...args);
|
|
627
628
|
this.level = void 0;
|
|
@@ -660,11 +661,11 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
660
661
|
await this.reload(clientConfig);
|
|
661
662
|
}
|
|
662
663
|
}
|
|
663
|
-
async
|
|
664
|
+
async onRemoveInstance({
|
|
664
665
|
clientName
|
|
665
666
|
}) {
|
|
666
667
|
if (clientName === this.clientName) {
|
|
667
|
-
await super.
|
|
668
|
+
await super.onRemoveInstance({
|
|
668
669
|
clientName
|
|
669
670
|
});
|
|
670
671
|
}
|
|
@@ -689,8 +690,10 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
689
690
|
}
|
|
690
691
|
}
|
|
691
692
|
async reload(clientConfig) {
|
|
693
|
+
const clientConfigReal = this.scope.service.database.getClientConfig(this.clientName, clientConfig);
|
|
694
|
+
this.$mutate([this.clientNameSelector, clientConfigReal]);
|
|
692
695
|
await this.__close();
|
|
693
|
-
this.__load(this.clientNameSelector,
|
|
696
|
+
this.__load(this.clientNameSelector, clientConfigReal);
|
|
694
697
|
}
|
|
695
698
|
getDatabaseName() {
|
|
696
699
|
const connection = this.clientConfig.connection;
|
|
@@ -713,7 +716,7 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
713
716
|
const connDatabaseName = this._prepareDatabaseName(databaseName);
|
|
714
717
|
// set config
|
|
715
718
|
// * should not use this.clientConfig.connection, because password is hidden
|
|
716
|
-
const config = this.scope.service.database.getClientConfig(this.clientName, true);
|
|
719
|
+
const config = this.scope.service.database.getClientConfig(this.clientName, undefined, true);
|
|
717
720
|
config.connection = Object.assign({}, config.connection, connDatabaseName);
|
|
718
721
|
// only used by startup, so no consider that workers broadcast
|
|
719
722
|
this.configDatabase.clients[this.clientName] = config;
|
|
@@ -721,18 +724,18 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
721
724
|
await this.scope.service.database.reloadClientsWorker(this.clientName, config);
|
|
722
725
|
// await this.scope.service.database.reloadClients(this.clientName, config);
|
|
723
726
|
}
|
|
724
|
-
}) || _class$
|
|
727
|
+
}) || _class$l) || _class$l);
|
|
725
728
|
|
|
726
|
-
var _dec$
|
|
727
|
-
let BeanDatabase = (_dec$
|
|
729
|
+
var _dec$k, _dec2$k, _class$k;
|
|
730
|
+
let BeanDatabase = (_dec$k = Bean(), _dec2$k = BeanInfo({
|
|
728
731
|
module: "a-orm"
|
|
729
|
-
}), _dec$
|
|
732
|
+
}), _dec$k(_class$k = _dec2$k(_class$k = class BeanDatabase extends BeanBase {
|
|
730
733
|
get current() {
|
|
731
734
|
return this.bean._getBean(ServiceDatabaseAsyncLocalStorage).current;
|
|
732
735
|
}
|
|
733
736
|
getClient(dbInfoOrClientName, clientConfig) {
|
|
734
737
|
const dbInfo = this.scope.service.database.prepareDbInfo(dbInfoOrClientName);
|
|
735
|
-
const clientConfigReal = this.
|
|
738
|
+
const clientConfigReal = this.scope.service.database.getClientConfig(dbInfo.clientName, clientConfig);
|
|
736
739
|
const selector = this.scope.service.database.prepareClientNameSelector(dbInfo, clientConfigReal.client);
|
|
737
740
|
return this.app.bean._getBeanSelector(ServiceDatabaseClient, selector, clientConfigReal);
|
|
738
741
|
}
|
|
@@ -766,27 +769,23 @@ let BeanDatabase = (_dec$j = Bean(), _dec2$j = BeanInfo({
|
|
|
766
769
|
return this.bean._getBean(ServiceTransactionAsyncLocalStorage).run(fn);
|
|
767
770
|
});
|
|
768
771
|
}
|
|
772
|
+
}) || _class$k) || _class$k);
|
|
769
773
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
return clientConfig ? deepExtend({}, clientConfig) : this.scope.service.database.getClientConfig(clientName);
|
|
773
|
-
}
|
|
774
|
-
}) || _class$j) || _class$j);
|
|
775
|
-
|
|
776
|
-
var _dec$i, _dec2$i, _dec3$7, _class$i;
|
|
777
|
-
let BeanDatabaseDialectBase = (_dec$i = Bean(), _dec2$i = Virtual(), _dec3$7 = BeanInfo({
|
|
774
|
+
var _dec$j, _dec2$j, _dec3$7, _class$j;
|
|
775
|
+
let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = BeanInfo({
|
|
778
776
|
module: "a-orm"
|
|
779
|
-
}), _dec$
|
|
777
|
+
}), _dec$j(_class$j = _dec2$j(_class$j = _dec3$7(_class$j = class BeanDatabaseDialectBase extends BeanBase {
|
|
780
778
|
constructor(...args) {
|
|
781
779
|
super(...args);
|
|
782
780
|
this._capabilities = void 0;
|
|
781
|
+
this._configBase = void 0;
|
|
783
782
|
}
|
|
784
783
|
get capabilities() {
|
|
785
784
|
if (!this._capabilities) throw new Error('Should provide dialect capabilities');
|
|
786
785
|
return this._capabilities;
|
|
787
786
|
}
|
|
788
|
-
|
|
789
|
-
return
|
|
787
|
+
get configBase() {
|
|
788
|
+
return this._configBase;
|
|
790
789
|
}
|
|
791
790
|
async fetchDatabases(_schemaBuilder, _databasePrefix) {
|
|
792
791
|
throw new Error('Not Implemented');
|
|
@@ -892,7 +891,7 @@ let BeanDatabaseDialectBase = (_dec$i = Bean(), _dec2$i = Virtual(), _dec3$7 = B
|
|
|
892
891
|
_columnTypePrefixes(type, prefixes) {
|
|
893
892
|
return prefixes.some(prefix => type.includes(prefix));
|
|
894
893
|
}
|
|
895
|
-
}) || _class$
|
|
894
|
+
}) || _class$j) || _class$j) || _class$j);
|
|
896
895
|
|
|
897
896
|
const OpAggrs = ['count', 'sum', 'avg', 'max', 'min'];
|
|
898
897
|
const OpJoint = {
|
|
@@ -1282,69 +1281,69 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1282
1281
|
});
|
|
1283
1282
|
}
|
|
1284
1283
|
|
|
1285
|
-
var _dec$
|
|
1284
|
+
var _dec$i, _dec2$i, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _class$i, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1286
1285
|
const app$1 = useApp();
|
|
1287
1286
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1288
1287
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1289
|
-
let DtoQueryBase = (_dec$
|
|
1288
|
+
let DtoQueryBase = (_dec$i = Api.field(v.optional(), v.array(String, {
|
|
1290
1289
|
separator: ','
|
|
1291
|
-
})), _dec2$
|
|
1290
|
+
})), _dec2$i = Reflect.metadata("design:type", Array), _dec3$6 = Api.field(v.optional(), z.looseObject({})), _dec4$4 = Reflect.metadata("design:type", Object), _dec5$1 = Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec6$1 = Reflect.metadata("design:type", Object), _class$i = class DtoQueryBase {
|
|
1292
1291
|
constructor() {
|
|
1293
1292
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1294
1293
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
1295
1294
|
_initializerDefineProperty(this, "orders", _descriptor3$1, this);
|
|
1296
1295
|
}
|
|
1297
|
-
}, _descriptor$4 = _applyDecoratedDescriptor(_class$
|
|
1296
|
+
}, _descriptor$4 = _applyDecoratedDescriptor(_class$i.prototype, "columns", [_dec$i, _dec2$i], {
|
|
1298
1297
|
configurable: true,
|
|
1299
1298
|
enumerable: true,
|
|
1300
1299
|
writable: true,
|
|
1301
1300
|
initializer: null
|
|
1302
|
-
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$
|
|
1301
|
+
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$i.prototype, "where", [_dec3$6, _dec4$4], {
|
|
1303
1302
|
configurable: true,
|
|
1304
1303
|
enumerable: true,
|
|
1305
1304
|
writable: true,
|
|
1306
1305
|
initializer: null
|
|
1307
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$
|
|
1306
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$i.prototype, "orders", [_dec5$1, _dec6$1], {
|
|
1308
1307
|
configurable: true,
|
|
1309
1308
|
enumerable: true,
|
|
1310
1309
|
writable: true,
|
|
1311
1310
|
initializer: null
|
|
1312
|
-
}), _class$
|
|
1311
|
+
}), _class$i);
|
|
1313
1312
|
|
|
1314
|
-
var _dec$
|
|
1313
|
+
var _dec$h, _dec2$h, _dec3$5, _dec4$3, _class$h, _descriptor$3, _descriptor2$1;
|
|
1315
1314
|
const app = useApp();
|
|
1316
1315
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
1317
1316
|
const pageSizeDefault = ormConfig?.rest?.query?.pageSize?.default ?? 20;
|
|
1318
1317
|
const pageSizeMax = ormConfig?.rest?.query?.pageSize?.max ?? 100;
|
|
1319
|
-
let DtoQueryPageBase = (_dec$
|
|
1318
|
+
let DtoQueryPageBase = (_dec$h = Api.field(z.number().min(1).default(1)), _dec2$h = Reflect.metadata("design:type", Number), _dec3$5 = Api.field(z.number().min(1).max(pageSizeMax).default(pageSizeDefault)), _dec4$3 = Reflect.metadata("design:type", Number), _class$h = class DtoQueryPageBase extends DtoQueryBase {
|
|
1320
1319
|
constructor(...args) {
|
|
1321
1320
|
super(...args);
|
|
1322
1321
|
_initializerDefineProperty(this, "pageNo", _descriptor$3, this);
|
|
1323
1322
|
_initializerDefineProperty(this, "pageSize", _descriptor2$1, this);
|
|
1324
1323
|
}
|
|
1325
|
-
}, _descriptor$3 = _applyDecoratedDescriptor(_class$
|
|
1324
|
+
}, _descriptor$3 = _applyDecoratedDescriptor(_class$h.prototype, "pageNo", [_dec$h, _dec2$h], {
|
|
1326
1325
|
configurable: true,
|
|
1327
1326
|
enumerable: true,
|
|
1328
1327
|
writable: true,
|
|
1329
1328
|
initializer: null
|
|
1330
|
-
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$
|
|
1329
|
+
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$h.prototype, "pageSize", [_dec3$5, _dec4$3], {
|
|
1331
1330
|
configurable: true,
|
|
1332
1331
|
enumerable: true,
|
|
1333
1332
|
writable: true,
|
|
1334
1333
|
initializer: null
|
|
1335
|
-
}), _class$
|
|
1334
|
+
}), _class$h);
|
|
1336
1335
|
|
|
1337
1336
|
const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
1338
1337
|
|
|
1339
1338
|
class EntityBaseEmpty {}
|
|
1340
1339
|
|
|
1341
|
-
var _dec$
|
|
1342
|
-
let EntityBaseInner = (_dec$
|
|
1340
|
+
var _dec$g, _dec2$g, _dec3$4, _dec4$2, _dec5, _dec6, _dec7, _dec8, _class$g, _descriptor$2, _descriptor2, _descriptor3, _descriptor4;
|
|
1341
|
+
let EntityBaseInner = (_dec$g = Api.field(v.openapi({
|
|
1343
1342
|
title: $locale('CreatedAt'),
|
|
1344
1343
|
rest: {
|
|
1345
1344
|
order: OrderMaxBase - 2
|
|
1346
1345
|
}
|
|
1347
|
-
})), _dec2$
|
|
1346
|
+
})), _dec2$g = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec3$4 = Api.field(v.openapi({
|
|
1348
1347
|
title: $locale('UpdatedAt'),
|
|
1349
1348
|
rest: {
|
|
1350
1349
|
order: OrderMaxBase - 1
|
|
@@ -1359,7 +1358,7 @@ let EntityBaseInner = (_dec$f = Api.field(v.openapi({
|
|
|
1359
1358
|
rest: {
|
|
1360
1359
|
visible: false
|
|
1361
1360
|
}
|
|
1362
|
-
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$
|
|
1361
|
+
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$g = class EntityBaseInner extends EntityBaseEmpty {
|
|
1363
1362
|
constructor(...args) {
|
|
1364
1363
|
super(...args);
|
|
1365
1364
|
_initializerDefineProperty(this, "createdAt", _descriptor$2, this);
|
|
@@ -1367,63 +1366,63 @@ let EntityBaseInner = (_dec$f = Api.field(v.openapi({
|
|
|
1367
1366
|
_initializerDefineProperty(this, "deleted", _descriptor3, this);
|
|
1368
1367
|
_initializerDefineProperty(this, "iid", _descriptor4, this);
|
|
1369
1368
|
}
|
|
1370
|
-
}, _descriptor$2 = _applyDecoratedDescriptor(_class$
|
|
1369
|
+
}, _descriptor$2 = _applyDecoratedDescriptor(_class$g.prototype, "createdAt", [_dec$g, _dec2$g], {
|
|
1371
1370
|
configurable: true,
|
|
1372
1371
|
enumerable: true,
|
|
1373
1372
|
writable: true,
|
|
1374
1373
|
initializer: null
|
|
1375
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class$
|
|
1374
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class$g.prototype, "updatedAt", [_dec3$4, _dec4$2], {
|
|
1376
1375
|
configurable: true,
|
|
1377
1376
|
enumerable: true,
|
|
1378
1377
|
writable: true,
|
|
1379
1378
|
initializer: null
|
|
1380
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class$
|
|
1379
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class$g.prototype, "deleted", [_dec5, _dec6], {
|
|
1381
1380
|
configurable: true,
|
|
1382
1381
|
enumerable: true,
|
|
1383
1382
|
writable: true,
|
|
1384
1383
|
initializer: null
|
|
1385
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class$
|
|
1384
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class$g.prototype, "iid", [_dec7, _dec8], {
|
|
1386
1385
|
configurable: true,
|
|
1387
1386
|
enumerable: true,
|
|
1388
1387
|
writable: true,
|
|
1389
1388
|
initializer: null
|
|
1390
|
-
}), _class$
|
|
1389
|
+
}), _class$g);
|
|
1391
1390
|
|
|
1392
|
-
var _dec$
|
|
1393
|
-
let EntityBase = (_dec$
|
|
1391
|
+
var _dec$f, _dec2$f, _class$f, _descriptor$1;
|
|
1392
|
+
let EntityBase = (_dec$f = Api.field(v.openapi({
|
|
1394
1393
|
title: $locale('TableIdentity'),
|
|
1395
1394
|
rest: {
|
|
1396
1395
|
order: OrderCoreBase + 1
|
|
1397
1396
|
}
|
|
1398
|
-
}), v.tableIdentity()), _dec2$
|
|
1397
|
+
}), v.tableIdentity()), _dec2$f = Reflect.metadata("design:type", typeof TableIdentity === "undefined" ? Object : TableIdentity), _class$f = class EntityBase extends EntityBaseInner {
|
|
1399
1398
|
constructor(...args) {
|
|
1400
1399
|
super(...args);
|
|
1401
1400
|
_initializerDefineProperty(this, "id", _descriptor$1, this);
|
|
1402
1401
|
}
|
|
1403
|
-
}, _descriptor$1 = _applyDecoratedDescriptor(_class$
|
|
1402
|
+
}, _descriptor$1 = _applyDecoratedDescriptor(_class$f.prototype, "id", [_dec$f, _dec2$f], {
|
|
1404
1403
|
configurable: true,
|
|
1405
1404
|
enumerable: true,
|
|
1406
1405
|
writable: true,
|
|
1407
1406
|
initializer: null
|
|
1408
|
-
}), _class$
|
|
1407
|
+
}), _class$f);
|
|
1409
1408
|
|
|
1410
|
-
var _dec$
|
|
1411
|
-
let EntityBaseSimple = (_dec$
|
|
1409
|
+
var _dec$e, _dec2$e, _class$e, _descriptor;
|
|
1410
|
+
let EntityBaseSimple = (_dec$e = Api.field(v.openapi({
|
|
1412
1411
|
title: $locale('TableIdentity'),
|
|
1413
1412
|
rest: {
|
|
1414
1413
|
order: OrderCoreBase + 1
|
|
1415
1414
|
}
|
|
1416
|
-
})), _dec2$
|
|
1415
|
+
})), _dec2$e = Reflect.metadata("design:type", Number), _class$e = class EntityBaseSimple extends EntityBaseInner {
|
|
1417
1416
|
constructor(...args) {
|
|
1418
1417
|
super(...args);
|
|
1419
1418
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
1420
1419
|
}
|
|
1421
|
-
}, _descriptor = _applyDecoratedDescriptor(_class$
|
|
1420
|
+
}, _descriptor = _applyDecoratedDescriptor(_class$e.prototype, "id", [_dec$e, _dec2$e], {
|
|
1422
1421
|
configurable: true,
|
|
1423
1422
|
enumerable: true,
|
|
1424
1423
|
writable: true,
|
|
1425
1424
|
initializer: null
|
|
1426
|
-
}), _class$
|
|
1425
|
+
}), _class$e);
|
|
1427
1426
|
|
|
1428
1427
|
const SymbolKeyEntity = Symbol('$entity');
|
|
1429
1428
|
const SymbolKeyEntityMeta = Symbol('$entityMeta');
|
|
@@ -2207,10 +2206,59 @@ class BeanModelCrudTable extends BeanModelCrudInner {
|
|
|
2207
2206
|
}
|
|
2208
2207
|
}
|
|
2209
2208
|
|
|
2210
|
-
var _dec$
|
|
2211
|
-
let BeanModel = (_dec$
|
|
2209
|
+
var _dec$d, _dec2$d, _dec3$3, _class$d;
|
|
2210
|
+
let BeanModel = (_dec$d = Bean(), _dec2$d = Virtual(), _dec3$3 = BeanInfo({
|
|
2212
2211
|
module: "a-orm"
|
|
2213
|
-
}), _dec$
|
|
2212
|
+
}), _dec$d(_class$d = _dec2$d(_class$d = _dec3$3(_class$d = class BeanModel extends BeanModelCrudTable {}) || _class$d) || _class$d) || _class$d);
|
|
2213
|
+
|
|
2214
|
+
const SymbolCacheModelsClear = Symbol('SymbolCacheModelsClearAll');
|
|
2215
|
+
const SymbolCacheModelCacheInstances = Symbol('SymbolCacheModelCacheInstances');
|
|
2216
|
+
function clearAllCacheModelsClear(app) {
|
|
2217
|
+
delete app.meta[SymbolCacheModelsClear];
|
|
2218
|
+
}
|
|
2219
|
+
async function clearCacheModelCacheInstance(app, beanFullName) {
|
|
2220
|
+
const cacheModelCacheInstances = getCacheModelCacheInstances(app);
|
|
2221
|
+
const instances = cacheModelCacheInstances[beanFullName];
|
|
2222
|
+
if (!instances) return;
|
|
2223
|
+
delete cacheModelCacheInstances[beanFullName];
|
|
2224
|
+
for (const cacheName in instances) {
|
|
2225
|
+
await app.bean._removeBean(instances[cacheName]);
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
function getCacheModelCacheInstances(app) {
|
|
2229
|
+
if (!app.meta[SymbolCacheModelCacheInstances]) app.meta[SymbolCacheModelCacheInstances] = {};
|
|
2230
|
+
return app.meta[SymbolCacheModelCacheInstances];
|
|
2231
|
+
}
|
|
2232
|
+
function getCacheModelsClear(app) {
|
|
2233
|
+
if (!app.meta[SymbolCacheModelsClear]) {
|
|
2234
|
+
app.meta[SymbolCacheModelsClear] = _collectModelsClear(app);
|
|
2235
|
+
}
|
|
2236
|
+
return app.meta[SymbolCacheModelsClear];
|
|
2237
|
+
}
|
|
2238
|
+
function _collectModelsClear(app) {
|
|
2239
|
+
const modelsClearAll = {};
|
|
2240
|
+
const onionSlices = app.bean.onion.model.getOnionsEnabledCached();
|
|
2241
|
+
for (const onionSlice of onionSlices) {
|
|
2242
|
+
const modelName = onionSlice.name;
|
|
2243
|
+
if (!modelsClearAll[modelName]) modelsClearAll[modelName] = [];
|
|
2244
|
+
//
|
|
2245
|
+
const modelsClear = onionSlice.beanOptions.options?.cache?.modelsClear;
|
|
2246
|
+
if (modelsClear) {
|
|
2247
|
+
const modelsClear2 = Array.isArray(modelsClear) ? modelsClear : [modelsClear];
|
|
2248
|
+
modelsClearAll[modelName].push(...modelsClear2);
|
|
2249
|
+
}
|
|
2250
|
+
//
|
|
2251
|
+
const modelsClearedBy = onionSlice.beanOptions.options?.cache?.modelsClearedBy;
|
|
2252
|
+
if (modelsClearedBy) {
|
|
2253
|
+
const modelsClearedBy2 = Array.isArray(modelsClearedBy) ? modelsClearedBy : [modelsClearedBy];
|
|
2254
|
+
for (const modelName2 of modelsClearedBy2) {
|
|
2255
|
+
if (!modelsClearAll[modelName2]) modelsClearAll[modelName2] = [];
|
|
2256
|
+
modelsClearAll[modelName2].push(modelName);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
return modelsClearAll;
|
|
2261
|
+
}
|
|
2214
2262
|
|
|
2215
2263
|
const SymbolCacheOptions = Symbol('SymbolCacheOptions');
|
|
2216
2264
|
const SymbolCacheEnabled = Symbol('SymbolCacheEnabled');
|
|
@@ -2230,7 +2278,14 @@ class ModelCacheBase extends BeanBase {
|
|
|
2230
2278
|
}
|
|
2231
2279
|
getInstance(table) {
|
|
2232
2280
|
if (this.options === false) throw new Error('cache disabled');
|
|
2233
|
-
|
|
2281
|
+
const beanFullName = this._model.$beanFullName;
|
|
2282
|
+
const cacheName = this.getName(table);
|
|
2283
|
+
const cacheModelCacheInstances = getCacheModelCacheInstances(this.app);
|
|
2284
|
+
if (!cacheModelCacheInstances[beanFullName]) cacheModelCacheInstances[beanFullName] = {};
|
|
2285
|
+
if (!cacheModelCacheInstances[beanFullName][cacheName]) {
|
|
2286
|
+
cacheModelCacheInstances[beanFullName][cacheName] = this.app.bean.summer.cache(cacheName, this.options);
|
|
2287
|
+
}
|
|
2288
|
+
return cacheModelCacheInstances[beanFullName][cacheName];
|
|
2234
2289
|
}
|
|
2235
2290
|
getName(table) {
|
|
2236
2291
|
const clientNameReal = this.$scope.orm.service.database.prepareClientNameReal(this._model.db.clientName);
|
|
@@ -2285,10 +2340,10 @@ class ModelCacheBase extends BeanBase {
|
|
|
2285
2340
|
}
|
|
2286
2341
|
}
|
|
2287
2342
|
|
|
2288
|
-
var _dec$
|
|
2289
|
-
let ServiceCacheEntity = (_dec$
|
|
2343
|
+
var _dec$c, _dec2$c, _class$c;
|
|
2344
|
+
let ServiceCacheEntity = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
2290
2345
|
module: "a-orm"
|
|
2291
|
-
}), _dec$
|
|
2346
|
+
}), _dec$c(_class$c = _dec2$c(_class$c = class ServiceCacheEntity extends ModelCacheBase {
|
|
2292
2347
|
__init__(model) {
|
|
2293
2348
|
super.__init__(model, 'entity');
|
|
2294
2349
|
}
|
|
@@ -2311,12 +2366,12 @@ let ServiceCacheEntity = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2311
2366
|
get keysAux() {
|
|
2312
2367
|
return this._model.options.cache?.keysAux;
|
|
2313
2368
|
}
|
|
2314
|
-
}) || _class$
|
|
2369
|
+
}) || _class$c) || _class$c);
|
|
2315
2370
|
|
|
2316
|
-
var _dec$
|
|
2317
|
-
let ServiceCacheQuery = (_dec$
|
|
2371
|
+
var _dec$b, _dec2$b, _class$b;
|
|
2372
|
+
let ServiceCacheQuery = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
2318
2373
|
module: "a-orm"
|
|
2319
|
-
}), _dec$
|
|
2374
|
+
}), _dec$b(_class$b = _dec2$b(_class$b = class ServiceCacheQuery extends ModelCacheBase {
|
|
2320
2375
|
__init__(model) {
|
|
2321
2376
|
super.__init__(model, 'query');
|
|
2322
2377
|
}
|
|
@@ -2326,7 +2381,7 @@ let ServiceCacheQuery = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
|
2326
2381
|
const cache = this.getInstance(table);
|
|
2327
2382
|
await cache.clear();
|
|
2328
2383
|
}
|
|
2329
|
-
}) || _class$
|
|
2384
|
+
}) || _class$b) || _class$b);
|
|
2330
2385
|
|
|
2331
2386
|
function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
2332
2387
|
// collect
|
|
@@ -2371,10 +2426,10 @@ function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
|
2371
2426
|
return relations;
|
|
2372
2427
|
}
|
|
2373
2428
|
|
|
2374
|
-
var _dec$
|
|
2375
|
-
let ServiceRelations = (_dec$
|
|
2429
|
+
var _dec$a, _dec2$a, _class$a;
|
|
2430
|
+
let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
2376
2431
|
module: "a-orm"
|
|
2377
|
-
}), _dec$
|
|
2432
|
+
}), _dec$a(_class$a = _dec2$a(_class$a = class ServiceRelations extends BeanBase {
|
|
2378
2433
|
constructor(...args) {
|
|
2379
2434
|
super(...args);
|
|
2380
2435
|
this._model = void 0;
|
|
@@ -2906,7 +2961,7 @@ let ServiceRelations = (_dec$9 = Service(), _dec2$9 = BeanInfo({
|
|
|
2906
2961
|
handleRelationsCollection(includeWrapper) {
|
|
2907
2962
|
return handleRelationsCollection(this._model.options.relations, includeWrapper);
|
|
2908
2963
|
}
|
|
2909
|
-
}) || _class$
|
|
2964
|
+
}) || _class$a) || _class$a);
|
|
2910
2965
|
|
|
2911
2966
|
class BeanModelCrud extends BeanModelCrudInner {
|
|
2912
2967
|
async mget(ids, options) {
|
|
@@ -2935,14 +2990,12 @@ class BeanModelCrud extends BeanModelCrudInner {
|
|
|
2935
2990
|
}
|
|
2936
2991
|
}
|
|
2937
2992
|
|
|
2938
|
-
const SymbolModelsClearAll = Symbol('SymbolModelsClearAll');
|
|
2939
2993
|
class BeanModelCache extends BeanModelCrud {
|
|
2940
2994
|
constructor(...args) {
|
|
2941
2995
|
super(...args);
|
|
2942
2996
|
this.cacheQuery = void 0;
|
|
2943
2997
|
this.cacheEntity = void 0;
|
|
2944
2998
|
this.relations = void 0;
|
|
2945
|
-
this[SymbolModelsClearAll] = void 0;
|
|
2946
2999
|
}
|
|
2947
3000
|
__init__(clientName, table) {
|
|
2948
3001
|
super.__init__(clientName, table);
|
|
@@ -2950,6 +3003,10 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
2950
3003
|
this.cacheEntity = this.bean._newBean(ServiceCacheEntity, this);
|
|
2951
3004
|
this.relations = this.bean._newBean(ServiceRelations, this);
|
|
2952
3005
|
}
|
|
3006
|
+
async __dispose__() {
|
|
3007
|
+
await disposeInstance(this.cacheQuery);
|
|
3008
|
+
await disposeInstance(this.cacheEntity);
|
|
3009
|
+
}
|
|
2953
3010
|
async insert(data, options) {
|
|
2954
3011
|
if (!data) data = {};
|
|
2955
3012
|
const items = await this.insertBulk([data], options);
|
|
@@ -3493,39 +3550,9 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3493
3550
|
}
|
|
3494
3551
|
}
|
|
3495
3552
|
_getModelsClear(modelName) {
|
|
3496
|
-
const modelsClearAll = this.
|
|
3553
|
+
const modelsClearAll = getCacheModelsClear(this.app);
|
|
3497
3554
|
return modelsClearAll[modelName ?? this.$onionName];
|
|
3498
3555
|
}
|
|
3499
|
-
_getModelsClearAll() {
|
|
3500
|
-
if (!this[SymbolModelsClearAll]) {
|
|
3501
|
-
this[SymbolModelsClearAll] = this._collectModelsClearAll();
|
|
3502
|
-
}
|
|
3503
|
-
return this[SymbolModelsClearAll];
|
|
3504
|
-
}
|
|
3505
|
-
_collectModelsClearAll() {
|
|
3506
|
-
const modelsClearAll = {};
|
|
3507
|
-
const onionSlices = this.bean.onion.model.getOnionsEnabled();
|
|
3508
|
-
for (const onionSlice of onionSlices) {
|
|
3509
|
-
const modelName = onionSlice.name;
|
|
3510
|
-
if (!modelsClearAll[modelName]) modelsClearAll[modelName] = [];
|
|
3511
|
-
//
|
|
3512
|
-
const modelsClear = onionSlice.beanOptions.options?.cache?.modelsClear;
|
|
3513
|
-
if (modelsClear) {
|
|
3514
|
-
const modelsClear2 = Array.isArray(modelsClear) ? modelsClear : [modelsClear];
|
|
3515
|
-
modelsClearAll[modelName].push(...modelsClear2);
|
|
3516
|
-
}
|
|
3517
|
-
//
|
|
3518
|
-
const modelsClearedBy = onionSlice.beanOptions.options?.cache?.modelsClearedBy;
|
|
3519
|
-
if (modelsClearedBy) {
|
|
3520
|
-
const modelsClearedBy2 = Array.isArray(modelsClearedBy) ? modelsClearedBy : [modelsClearedBy];
|
|
3521
|
-
for (const modelName2 of modelsClearedBy2) {
|
|
3522
|
-
if (!modelsClearAll[modelName2]) modelsClearAll[modelName2] = [];
|
|
3523
|
-
modelsClearAll[modelName2].push(modelName);
|
|
3524
|
-
}
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
|
-
return modelsClearAll;
|
|
3528
|
-
}
|
|
3529
3556
|
_checkDisableCacheQueryByOptions(options) {
|
|
3530
3557
|
if (options?.disableCacheQuery === true || options?.disableCacheQuery === false) {
|
|
3531
3558
|
return options?.disableCacheQuery;
|
|
@@ -3620,16 +3647,16 @@ function __parseMagicField(str) {
|
|
|
3620
3647
|
return [fieldName, op];
|
|
3621
3648
|
}
|
|
3622
3649
|
|
|
3623
|
-
var _dec$
|
|
3624
|
-
let BeanModelBase = (_dec$
|
|
3650
|
+
var _dec$9, _dec2$9, _dec3$2, _class$9;
|
|
3651
|
+
let BeanModelBase = (_dec$9 = Bean(), _dec2$9 = Virtual(), _dec3$2 = BeanInfo({
|
|
3625
3652
|
module: "a-orm"
|
|
3626
|
-
}), _dec$
|
|
3653
|
+
}), _dec$9(_class$9 = _dec2$9(_class$9 = _dec3$2(_class$9 = class BeanModelBase extends BeanModelCache {}) || _class$9) || _class$9) || _class$9);
|
|
3627
3654
|
|
|
3628
|
-
var _dec$
|
|
3655
|
+
var _dec$8, _dec2$8, _dec3$1, _dec4$1, _class$8;
|
|
3629
3656
|
const SymbolModuleScope$1 = Symbol('SymbolModuleScope');
|
|
3630
|
-
let ServiceEntityResolver = (_dec$
|
|
3657
|
+
let ServiceEntityResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
3631
3658
|
module: "a-orm"
|
|
3632
|
-
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3659
|
+
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$8(_class$8 = _dec2$8(_class$8 = _dec3$1(_class$8 = _dec4$1(_class$8 = class ServiceEntityResolver extends BeanBase {
|
|
3633
3660
|
constructor(moduleScope) {
|
|
3634
3661
|
super();
|
|
3635
3662
|
this[SymbolModuleScope$1] = void 0;
|
|
@@ -3644,13 +3671,13 @@ let ServiceEntityResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
3644
3671
|
}
|
|
3645
3672
|
return this.__instances[prop];
|
|
3646
3673
|
}
|
|
3647
|
-
}) || _class$
|
|
3674
|
+
}) || _class$8) || _class$8) || _class$8) || _class$8);
|
|
3648
3675
|
|
|
3649
|
-
var _dec$
|
|
3676
|
+
var _dec$7, _dec2$7, _dec3, _dec4, _class$7;
|
|
3650
3677
|
const SymbolModuleScope = Symbol('SymbolModuleScope');
|
|
3651
|
-
let ServiceModelResolver = (_dec$
|
|
3678
|
+
let ServiceModelResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
3652
3679
|
module: "a-orm"
|
|
3653
|
-
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3680
|
+
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$7(_class$7 = _dec2$7(_class$7 = _dec3(_class$7 = _dec4(_class$7 = class ServiceModelResolver extends BeanBase {
|
|
3654
3681
|
constructor(moduleScope) {
|
|
3655
3682
|
super();
|
|
3656
3683
|
this[SymbolModuleScope] = void 0;
|
|
@@ -3660,12 +3687,12 @@ let ServiceModelResolver = (_dec$6 = Service(), _dec2$6 = BeanInfo({
|
|
|
3660
3687
|
const beanFullName = `${this[SymbolModuleScope]}.model.${prop}`;
|
|
3661
3688
|
return this.bean._getBean(beanFullName);
|
|
3662
3689
|
}
|
|
3663
|
-
}) || _class$
|
|
3690
|
+
}) || _class$7) || _class$7) || _class$7) || _class$7);
|
|
3664
3691
|
|
|
3665
|
-
var _dec$
|
|
3666
|
-
let BroadcastColumnsClear = (_dec$
|
|
3692
|
+
var _dec$6, _dec2$6, _class$6;
|
|
3693
|
+
let BroadcastColumnsClear = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
3667
3694
|
module: "a-orm"
|
|
3668
|
-
}), _dec$
|
|
3695
|
+
}), _dec$6(_class$6 = _dec2$6(_class$6 = class BroadcastColumnsClear extends BeanBroadcastBase {
|
|
3669
3696
|
async execute(data, isEmitter) {
|
|
3670
3697
|
const {
|
|
3671
3698
|
clientName,
|
|
@@ -3675,44 +3702,44 @@ let BroadcastColumnsClear = (_dec$5 = Broadcast(), _dec2$5 = BeanInfo({
|
|
|
3675
3702
|
await cast(this.scope.service.database).columnsClearWorker(clientName, tableName);
|
|
3676
3703
|
}
|
|
3677
3704
|
}
|
|
3678
|
-
}) || _class$
|
|
3705
|
+
}) || _class$6) || _class$6);
|
|
3679
3706
|
|
|
3680
|
-
var _dec$
|
|
3681
|
-
let EventClientNameReal = (_dec$
|
|
3707
|
+
var _dec$5, _dec2$5, _class$5;
|
|
3708
|
+
let EventClientNameReal = (_dec$5 = Event(), _dec2$5 = BeanInfo({
|
|
3682
3709
|
module: "a-orm"
|
|
3683
|
-
}), _dec$
|
|
3710
|
+
}), _dec$5(_class$5 = _dec2$5(_class$5 = class EventClientNameReal extends BeanEventBase {}) || _class$5) || _class$5);
|
|
3684
3711
|
|
|
3685
|
-
var _dec$
|
|
3686
|
-
let EventColumnsClear = (_dec$
|
|
3712
|
+
var _dec$4, _dec2$4, _class$4;
|
|
3713
|
+
let EventColumnsClear = (_dec$4 = Event(), _dec2$4 = BeanInfo({
|
|
3687
3714
|
module: "a-orm"
|
|
3688
|
-
}), _dec$
|
|
3715
|
+
}), _dec$4(_class$4 = _dec2$4(_class$4 = class EventColumnsClear extends BeanEventBase {}) || _class$4) || _class$4);
|
|
3689
3716
|
|
|
3690
|
-
var _dec$
|
|
3691
|
-
let QueueDoubleDelete = (_dec$
|
|
3717
|
+
var _dec$3, _dec2$3, _class$3;
|
|
3718
|
+
let QueueDoubleDelete = (_dec$3 = Queue({
|
|
3692
3719
|
options: {
|
|
3693
3720
|
job: {
|
|
3694
3721
|
delay: 3 * 1000
|
|
3695
3722
|
}
|
|
3696
3723
|
}
|
|
3697
|
-
}), _dec2$
|
|
3724
|
+
}), _dec2$3 = BeanInfo({
|
|
3698
3725
|
module: "a-orm"
|
|
3699
|
-
}), _dec$
|
|
3726
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class QueueDoubleDelete extends BeanQueueBase {
|
|
3700
3727
|
async execute(data, _options) {
|
|
3701
3728
|
const beanInstance = this.app.bean._newBean(data.beanFullName, data.clientName, data.table);
|
|
3702
3729
|
await beanInstance[data.method](...data.args);
|
|
3703
3730
|
}
|
|
3704
|
-
}) || _class$
|
|
3731
|
+
}) || _class$3) || _class$3);
|
|
3705
3732
|
|
|
3706
|
-
var _dec$
|
|
3707
|
-
let ScheduleSoftDeletionPrune = (_dec$
|
|
3733
|
+
var _dec$2, _dec2$2, _class$2;
|
|
3734
|
+
let ScheduleSoftDeletionPrune = (_dec$2 = Schedule({
|
|
3708
3735
|
repeat: {
|
|
3709
3736
|
every: 24 * 3600 * 1000
|
|
3710
3737
|
}
|
|
3711
|
-
}), _dec2$
|
|
3738
|
+
}), _dec2$2 = BeanInfo({
|
|
3712
3739
|
module: "a-orm"
|
|
3713
|
-
}), _dec$
|
|
3740
|
+
}), _dec$2(_class$2 = _dec2$2(_class$2 = class ScheduleSoftDeletionPrune extends BeanBase {
|
|
3714
3741
|
async execute() {
|
|
3715
|
-
const onionSlices = this.bean.onion.model.
|
|
3742
|
+
const onionSlices = this.bean.onion.model.getOnionsEnabledCached();
|
|
3716
3743
|
for (const onionSlice of onionSlices) {
|
|
3717
3744
|
if (onionSlice.beanOptions.options?.disableDeleted) continue;
|
|
3718
3745
|
let softDeletionPrune = onionSlice.beanOptions.options?.softDeletionPrune ?? this.scope.config.softDeletionPrune.enable;
|
|
@@ -3741,6 +3768,20 @@ let ScheduleSoftDeletionPrune = (_dec$1 = Schedule({
|
|
|
3741
3768
|
});
|
|
3742
3769
|
}
|
|
3743
3770
|
}
|
|
3771
|
+
}) || _class$2) || _class$2);
|
|
3772
|
+
|
|
3773
|
+
var _dec$1, _dec2$1, _class$1;
|
|
3774
|
+
// import { clearAllCacheModelsClear, clearCacheModelCacheInstance } from '../lib/const.ts';
|
|
3775
|
+
|
|
3776
|
+
let HmrModel = (_dec$1 = Hmr(), _dec2$1 = BeanInfo({
|
|
3777
|
+
module: "a-orm"
|
|
3778
|
+
}), _dec$1(_class$1 = _dec2$1(_class$1 = class HmrModel extends BeanBase {
|
|
3779
|
+
async reload(_beanOptions) {
|
|
3780
|
+
// more deps: dto/model
|
|
3781
|
+
this.app.bean.worker.reload();
|
|
3782
|
+
// clearAllCacheModelsClear(this.app);
|
|
3783
|
+
// await clearCacheModelCacheInstance(this.app, beanOptions.beanFullName);
|
|
3784
|
+
}
|
|
3744
3785
|
}) || _class$1) || _class$1);
|
|
3745
3786
|
|
|
3746
3787
|
function config(_app) {
|
|
@@ -4442,4 +4483,4 @@ const $relationMutate = {
|
|
|
4442
4483
|
belongsToMany
|
|
4443
4484
|
};
|
|
4444
4485
|
|
|
4445
|
-
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, EventClientNameReal, EventColumnsClear, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, Main, Model, Op, OpAggrs, OpJoint, OpJointValues, OpNormal, OpNormalValues, OpValues, QueueDoubleDelete, ScheduleSoftDeletionPrune, ScopeModuleAOrm, ServiceCacheEntity, ServiceCacheQuery, ServiceColumns, ServiceColumnsCache, ServiceDatabase, ServiceDatabaseAsyncLocalStorage, ServiceDatabaseClient, ServiceDb, ServiceEntityResolver, ServiceModelResolver, ServiceRelations, ServiceTransaction, ServiceTransactionAsyncLocalStorage, ServiceTransactionConsistency, ServiceTransactionFiber, ServiceTransactionState, SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyFieldsMore, SymbolKeyModelOptions, TransactionIsolationLevelsMap, buildWhere, config, configDefault, errors, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName, isRaw, isRef, locales, prepareClassModel, prepareColumns };
|
|
4486
|
+
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, EventClientNameReal, EventColumnsClear, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, HmrModel, Main, Model, Op, OpAggrs, OpJoint, OpJointValues, OpNormal, OpNormalValues, OpValues, QueueDoubleDelete, ScheduleSoftDeletionPrune, ScopeModuleAOrm, ServiceCacheEntity, ServiceCacheQuery, ServiceColumns, ServiceColumnsCache, ServiceDatabase, ServiceDatabaseAsyncLocalStorage, ServiceDatabaseClient, ServiceDb, ServiceEntityResolver, ServiceModelResolver, ServiceRelations, ServiceTransaction, ServiceTransactionAsyncLocalStorage, ServiceTransactionConsistency, ServiceTransactionFiber, ServiceTransactionState, SymbolCacheModelCacheInstances, SymbolCacheModelsClear, SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyFieldsMore, SymbolKeyModelOptions, TransactionIsolationLevelsMap, buildWhere, clearAllCacheModelsClear, clearCacheModelCacheInstance, config, configDefault, errors, getCacheModelCacheInstances, getCacheModelsClear, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName, isRaw, isRef, locales, prepareClassModel, prepareColumns };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VonaApplication } from 'vona';
|
|
2
|
+
import type { IModelRecord } from '../types/onion/model.ts';
|
|
3
|
+
import type { TypeModelClassLikeGeneral } from '../types/relations.ts';
|
|
4
|
+
export declare const SymbolCacheModelsClear: unique symbol;
|
|
5
|
+
export declare const SymbolCacheModelCacheInstances: unique symbol;
|
|
6
|
+
export declare function clearAllCacheModelsClear(app: VonaApplication): void;
|
|
7
|
+
export declare function clearCacheModelCacheInstance(app: VonaApplication, beanFullName: string): Promise<void>;
|
|
8
|
+
export declare function getCacheModelCacheInstances(app: VonaApplication): any;
|
|
9
|
+
export declare function getCacheModelsClear(app: VonaApplication): Record<keyof IModelRecord, TypeModelClassLikeGeneral[]>;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IDecoratorSummerCacheOptions } from 'vona-module-a-summer';
|
|
1
|
+
import type { BeanSummerCacheBase, IDecoratorSummerCacheOptions } from 'vona-module-a-summer';
|
|
2
2
|
import type { BeanModelCache } from '../bean/bean.model/bean.model_cache.ts';
|
|
3
3
|
import type { TypeModelCacheType } from '../types/model.ts';
|
|
4
4
|
import type { ITableRecord } from '../types/onion/table.ts';
|
|
@@ -10,7 +10,7 @@ export declare class ModelCacheBase extends BeanBase {
|
|
|
10
10
|
private _cacheType;
|
|
11
11
|
protected __init__(model: BeanModelCache, cacheType: TypeModelCacheType): void;
|
|
12
12
|
private get scopeOrm();
|
|
13
|
-
getInstance(table: keyof ITableRecord):
|
|
13
|
+
getInstance(table: keyof ITableRecord): BeanSummerCacheBase;
|
|
14
14
|
getName(table: keyof ITableRecord): string;
|
|
15
15
|
get options(): false | IDecoratorSummerCacheOptions;
|
|
16
16
|
get enabled(): any;
|
|
@@ -4,7 +4,7 @@ import type { IDatabaseClientDialectRecord, IDatabaseClientRecord, IDbInfo } fro
|
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
5
|
export declare class ServiceDatabase extends BeanBase {
|
|
6
6
|
get configDatabase(): import("../types/config.ts").ConfigDatabase;
|
|
7
|
-
getClientConfig(clientName: keyof IDatabaseClientRecord, original?: boolean): ConfigDatabaseClient;
|
|
7
|
+
getClientConfig(clientName: keyof IDatabaseClientRecord, clientConfig?: ConfigDatabaseClient, original?: boolean): ConfigDatabaseClient;
|
|
8
8
|
prepareDbInfo(dbInfoOrClientName?: Partial<IDbInfo> | keyof IDatabaseClientRecord): IDbInfo;
|
|
9
9
|
prepareClientNameSelector(dbInfo: IDbInfo, dialect: BeanDatabaseDialectBase | keyof IDatabaseClientDialectRecord): string;
|
|
10
10
|
parseClientNameSelector(clientNameSelector: string): IDbInfo;
|
|
@@ -23,7 +23,7 @@ export declare class ServiceDatabaseClient extends BeanMutateBase {
|
|
|
23
23
|
clientName: any;
|
|
24
24
|
clientConfig: any;
|
|
25
25
|
}): Promise<void>;
|
|
26
|
-
protected
|
|
26
|
+
protected onRemoveInstance({ clientName }: {
|
|
27
27
|
clientName: any;
|
|
28
28
|
}): Promise<void>;
|
|
29
29
|
private __load;
|
package/dist/types/database.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ declare module 'vona' {
|
|
|
36
36
|
interface VonaConfigEnv {
|
|
37
37
|
DATABASE_DEFAULT_CLIENT: string | undefined;
|
|
38
38
|
DATABASE_CLIENT_SQLITE3_FILENAME: string | undefined;
|
|
39
|
-
DATABASE_CLIENT_SQLITE3_NATIVEBINDING: string | undefined;
|
|
39
|
+
DATABASE_CLIENT_SQLITE3_NATIVEBINDING: string | 'true' | 'false' | undefined;
|
|
40
40
|
DATABASE_CLIENT_PG_HOST: string | undefined;
|
|
41
41
|
DATABASE_CLIENT_PG_PORT: string | undefined;
|
|
42
42
|
DATABASE_CLIENT_PG_USER: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-orm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.87",
|
|
5
5
|
"title": "a-orm",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"knex": "^3.1.0",
|
|
64
|
-
"table-identity": "^1.0.
|
|
64
|
+
"table-identity": "^1.0.13"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"clean-package": "^2.2.0",
|