vona-module-a-orm 5.0.86 → 5.0.88
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 +20 -19
- package/dist/.metadata/locales.d.ts +20 -0
- package/dist/bean/bean.model/bean.model_cache.d.ts +2 -6
- package/dist/bean/hmr.model.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +243 -197
- 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/databaseClient_.d.ts +1 -1
- package/dist/types/database.d.ts +1 -1
- package/package.json +2 -2
|
@@ -191,27 +191,29 @@ 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';
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
CreatedAt: string;
|
|
201
|
-
UpdatedAt: string;
|
|
202
|
-
Deleted: string;
|
|
203
|
-
InstanceId: string;
|
|
204
|
-
ShouldSpecifyTable: string;
|
|
205
|
-
};
|
|
206
|
-
'zh-cn': {
|
|
207
|
-
TableIdentity: string;
|
|
208
|
-
CreatedAt: string;
|
|
209
|
-
UpdatedAt: string;
|
|
210
|
-
Deleted: string;
|
|
211
|
-
InstanceId: string;
|
|
212
|
-
ShouldSpecifyTable: string;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
214
|
+
/** config: end */
|
|
215
|
+
/** locale: begin */
|
|
216
|
+
import { locales } from './locales.ts';
|
|
215
217
|
/** locale: end */
|
|
216
218
|
/** error: begin */
|
|
217
219
|
export * from '../config/errors.ts';
|
|
@@ -252,5 +254,4 @@ declare module 'vona' {
|
|
|
252
254
|
'a-orm': typeof errors;
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
|
-
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `a-orm::${K}`;
|
|
256
257
|
/** scope: end */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TypeLocaleBase } from 'vona';
|
|
2
|
+
export declare const locales: {
|
|
3
|
+
'en-us': {
|
|
4
|
+
TableIdentity: string;
|
|
5
|
+
CreatedAt: string;
|
|
6
|
+
UpdatedAt: string;
|
|
7
|
+
Deleted: string;
|
|
8
|
+
InstanceId: string;
|
|
9
|
+
ShouldSpecifyTable: string;
|
|
10
|
+
};
|
|
11
|
+
'zh-cn': {
|
|
12
|
+
TableIdentity: string;
|
|
13
|
+
CreatedAt: string;
|
|
14
|
+
UpdatedAt: string;
|
|
15
|
+
Deleted: string;
|
|
16
|
+
InstanceId: string;
|
|
17
|
+
ShouldSpecifyTable: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `a-orm::${K}`;
|
|
@@ -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.d.ts
CHANGED
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,10 +184,10 @@ 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
|
}
|
|
@@ -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
|
}
|
|
@@ -690,6 +691,7 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
690
691
|
}
|
|
691
692
|
async reload(clientConfig) {
|
|
692
693
|
const clientConfigReal = this.scope.service.database.getClientConfig(this.clientName, clientConfig);
|
|
694
|
+
this.$mutate([this.clientNameSelector, clientConfigReal]);
|
|
693
695
|
await this.__close();
|
|
694
696
|
this.__load(this.clientNameSelector, clientConfigReal);
|
|
695
697
|
}
|
|
@@ -722,12 +724,12 @@ let ServiceDatabaseClient = (_dec$k = Service(), _dec2$k = BeanInfo({
|
|
|
722
724
|
await this.scope.service.database.reloadClientsWorker(this.clientName, config);
|
|
723
725
|
// await this.scope.service.database.reloadClients(this.clientName, config);
|
|
724
726
|
}
|
|
725
|
-
}) || _class$
|
|
727
|
+
}) || _class$l) || _class$l);
|
|
726
728
|
|
|
727
|
-
var _dec$
|
|
728
|
-
let BeanDatabase = (_dec$
|
|
729
|
+
var _dec$k, _dec2$k, _class$k;
|
|
730
|
+
let BeanDatabase = (_dec$k = Bean(), _dec2$k = BeanInfo({
|
|
729
731
|
module: "a-orm"
|
|
730
|
-
}), _dec$
|
|
732
|
+
}), _dec$k(_class$k = _dec2$k(_class$k = class BeanDatabase extends BeanBase {
|
|
731
733
|
get current() {
|
|
732
734
|
return this.bean._getBean(ServiceDatabaseAsyncLocalStorage).current;
|
|
733
735
|
}
|
|
@@ -767,12 +769,12 @@ let BeanDatabase = (_dec$j = Bean(), _dec2$j = BeanInfo({
|
|
|
767
769
|
return this.bean._getBean(ServiceTransactionAsyncLocalStorage).run(fn);
|
|
768
770
|
});
|
|
769
771
|
}
|
|
770
|
-
}) || _class$
|
|
772
|
+
}) || _class$k) || _class$k);
|
|
771
773
|
|
|
772
|
-
var _dec$
|
|
773
|
-
let BeanDatabaseDialectBase = (_dec$
|
|
774
|
+
var _dec$j, _dec2$j, _dec3$7, _class$j;
|
|
775
|
+
let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = BeanInfo({
|
|
774
776
|
module: "a-orm"
|
|
775
|
-
}), _dec$
|
|
777
|
+
}), _dec$j(_class$j = _dec2$j(_class$j = _dec3$7(_class$j = class BeanDatabaseDialectBase extends BeanBase {
|
|
776
778
|
constructor(...args) {
|
|
777
779
|
super(...args);
|
|
778
780
|
this._capabilities = void 0;
|
|
@@ -889,7 +891,7 @@ let BeanDatabaseDialectBase = (_dec$i = Bean(), _dec2$i = Virtual(), _dec3$7 = B
|
|
|
889
891
|
_columnTypePrefixes(type, prefixes) {
|
|
890
892
|
return prefixes.some(prefix => type.includes(prefix));
|
|
891
893
|
}
|
|
892
|
-
}) || _class$
|
|
894
|
+
}) || _class$j) || _class$j) || _class$j);
|
|
893
895
|
|
|
894
896
|
const OpAggrs = ['count', 'sum', 'avg', 'max', 'min'];
|
|
895
897
|
const OpJoint = {
|
|
@@ -1279,69 +1281,95 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1279
1281
|
});
|
|
1280
1282
|
}
|
|
1281
1283
|
|
|
1282
|
-
var _dec$
|
|
1284
|
+
var _dec$i, _dec2$i, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _class$i, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1283
1285
|
const app$1 = useApp();
|
|
1284
1286
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1285
1287
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1286
|
-
let DtoQueryBase = (_dec$
|
|
1288
|
+
let DtoQueryBase = (_dec$i = Api.field(v.optional(), v.array(String, {
|
|
1287
1289
|
separator: ','
|
|
1288
|
-
})), _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 {
|
|
1289
1291
|
constructor() {
|
|
1290
1292
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1291
1293
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
1292
1294
|
_initializerDefineProperty(this, "orders", _descriptor3$1, this);
|
|
1293
1295
|
}
|
|
1294
|
-
}, _descriptor$4 = _applyDecoratedDescriptor(_class$
|
|
1296
|
+
}, _descriptor$4 = _applyDecoratedDescriptor(_class$i.prototype, "columns", [_dec$i, _dec2$i], {
|
|
1295
1297
|
configurable: true,
|
|
1296
1298
|
enumerable: true,
|
|
1297
1299
|
writable: true,
|
|
1298
1300
|
initializer: null
|
|
1299
|
-
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$
|
|
1301
|
+
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$i.prototype, "where", [_dec3$6, _dec4$4], {
|
|
1300
1302
|
configurable: true,
|
|
1301
1303
|
enumerable: true,
|
|
1302
1304
|
writable: true,
|
|
1303
1305
|
initializer: null
|
|
1304
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$
|
|
1306
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$i.prototype, "orders", [_dec5$1, _dec6$1], {
|
|
1305
1307
|
configurable: true,
|
|
1306
1308
|
enumerable: true,
|
|
1307
1309
|
writable: true,
|
|
1308
1310
|
initializer: null
|
|
1309
|
-
}), _class$
|
|
1311
|
+
}), _class$i);
|
|
1310
1312
|
|
|
1311
|
-
var _dec$
|
|
1313
|
+
var _dec$h, _dec2$h, _dec3$5, _dec4$3, _class$h, _descriptor$3, _descriptor2$1;
|
|
1312
1314
|
const app = useApp();
|
|
1313
1315
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
1314
1316
|
const pageSizeDefault = ormConfig?.rest?.query?.pageSize?.default ?? 20;
|
|
1315
1317
|
const pageSizeMax = ormConfig?.rest?.query?.pageSize?.max ?? 100;
|
|
1316
|
-
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 {
|
|
1317
1319
|
constructor(...args) {
|
|
1318
1320
|
super(...args);
|
|
1319
1321
|
_initializerDefineProperty(this, "pageNo", _descriptor$3, this);
|
|
1320
1322
|
_initializerDefineProperty(this, "pageSize", _descriptor2$1, this);
|
|
1321
1323
|
}
|
|
1322
|
-
}, _descriptor$3 = _applyDecoratedDescriptor(_class$
|
|
1324
|
+
}, _descriptor$3 = _applyDecoratedDescriptor(_class$h.prototype, "pageNo", [_dec$h, _dec2$h], {
|
|
1323
1325
|
configurable: true,
|
|
1324
1326
|
enumerable: true,
|
|
1325
1327
|
writable: true,
|
|
1326
1328
|
initializer: null
|
|
1327
|
-
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$
|
|
1329
|
+
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$h.prototype, "pageSize", [_dec3$5, _dec4$3], {
|
|
1328
1330
|
configurable: true,
|
|
1329
1331
|
enumerable: true,
|
|
1330
1332
|
writable: true,
|
|
1331
1333
|
initializer: null
|
|
1332
|
-
}), _class$
|
|
1334
|
+
}), _class$h);
|
|
1333
1335
|
|
|
1334
1336
|
const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
1335
1337
|
|
|
1338
|
+
var locale_en_us = {
|
|
1339
|
+
TableIdentity: 'ID',
|
|
1340
|
+
CreatedAt: 'Created At',
|
|
1341
|
+
UpdatedAt: 'Updated At',
|
|
1342
|
+
Deleted: 'Deleted',
|
|
1343
|
+
InstanceId: 'Instance ID',
|
|
1344
|
+
ShouldSpecifyTable: 'should specify the table name'
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
var locale_zh_cn = {
|
|
1348
|
+
TableIdentity: '标识',
|
|
1349
|
+
CreatedAt: '创建时间',
|
|
1350
|
+
UpdatedAt: '修改时间',
|
|
1351
|
+
Deleted: '已删除',
|
|
1352
|
+
InstanceId: '实例标识',
|
|
1353
|
+
ShouldSpecifyTable: '应该指定表名'
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
const locales = {
|
|
1357
|
+
'en-us': locale_en_us,
|
|
1358
|
+
'zh-cn': locale_zh_cn
|
|
1359
|
+
};
|
|
1360
|
+
function $locale(key) {
|
|
1361
|
+
return `a-orm::${key}`;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1336
1364
|
class EntityBaseEmpty {}
|
|
1337
1365
|
|
|
1338
|
-
var _dec$
|
|
1339
|
-
let EntityBaseInner = (_dec$
|
|
1366
|
+
var _dec$g, _dec2$g, _dec3$4, _dec4$2, _dec5, _dec6, _dec7, _dec8, _class$g, _descriptor$2, _descriptor2, _descriptor3, _descriptor4;
|
|
1367
|
+
let EntityBaseInner = (_dec$g = Api.field(v.openapi({
|
|
1340
1368
|
title: $locale('CreatedAt'),
|
|
1341
1369
|
rest: {
|
|
1342
1370
|
order: OrderMaxBase - 2
|
|
1343
1371
|
}
|
|
1344
|
-
})), _dec2$
|
|
1372
|
+
})), _dec2$g = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec3$4 = Api.field(v.openapi({
|
|
1345
1373
|
title: $locale('UpdatedAt'),
|
|
1346
1374
|
rest: {
|
|
1347
1375
|
order: OrderMaxBase - 1
|
|
@@ -1356,7 +1384,7 @@ let EntityBaseInner = (_dec$f = Api.field(v.openapi({
|
|
|
1356
1384
|
rest: {
|
|
1357
1385
|
visible: false
|
|
1358
1386
|
}
|
|
1359
|
-
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$
|
|
1387
|
+
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$g = class EntityBaseInner extends EntityBaseEmpty {
|
|
1360
1388
|
constructor(...args) {
|
|
1361
1389
|
super(...args);
|
|
1362
1390
|
_initializerDefineProperty(this, "createdAt", _descriptor$2, this);
|
|
@@ -1364,63 +1392,63 @@ let EntityBaseInner = (_dec$f = Api.field(v.openapi({
|
|
|
1364
1392
|
_initializerDefineProperty(this, "deleted", _descriptor3, this);
|
|
1365
1393
|
_initializerDefineProperty(this, "iid", _descriptor4, this);
|
|
1366
1394
|
}
|
|
1367
|
-
}, _descriptor$2 = _applyDecoratedDescriptor(_class$
|
|
1395
|
+
}, _descriptor$2 = _applyDecoratedDescriptor(_class$g.prototype, "createdAt", [_dec$g, _dec2$g], {
|
|
1368
1396
|
configurable: true,
|
|
1369
1397
|
enumerable: true,
|
|
1370
1398
|
writable: true,
|
|
1371
1399
|
initializer: null
|
|
1372
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class$
|
|
1400
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class$g.prototype, "updatedAt", [_dec3$4, _dec4$2], {
|
|
1373
1401
|
configurable: true,
|
|
1374
1402
|
enumerable: true,
|
|
1375
1403
|
writable: true,
|
|
1376
1404
|
initializer: null
|
|
1377
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class$
|
|
1405
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class$g.prototype, "deleted", [_dec5, _dec6], {
|
|
1378
1406
|
configurable: true,
|
|
1379
1407
|
enumerable: true,
|
|
1380
1408
|
writable: true,
|
|
1381
1409
|
initializer: null
|
|
1382
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class$
|
|
1410
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class$g.prototype, "iid", [_dec7, _dec8], {
|
|
1383
1411
|
configurable: true,
|
|
1384
1412
|
enumerable: true,
|
|
1385
1413
|
writable: true,
|
|
1386
1414
|
initializer: null
|
|
1387
|
-
}), _class$
|
|
1415
|
+
}), _class$g);
|
|
1388
1416
|
|
|
1389
|
-
var _dec$
|
|
1390
|
-
let EntityBase = (_dec$
|
|
1417
|
+
var _dec$f, _dec2$f, _class$f, _descriptor$1;
|
|
1418
|
+
let EntityBase = (_dec$f = Api.field(v.openapi({
|
|
1391
1419
|
title: $locale('TableIdentity'),
|
|
1392
1420
|
rest: {
|
|
1393
1421
|
order: OrderCoreBase + 1
|
|
1394
1422
|
}
|
|
1395
|
-
}), v.tableIdentity()), _dec2$
|
|
1423
|
+
}), v.tableIdentity()), _dec2$f = Reflect.metadata("design:type", typeof TableIdentity === "undefined" ? Object : TableIdentity), _class$f = class EntityBase extends EntityBaseInner {
|
|
1396
1424
|
constructor(...args) {
|
|
1397
1425
|
super(...args);
|
|
1398
1426
|
_initializerDefineProperty(this, "id", _descriptor$1, this);
|
|
1399
1427
|
}
|
|
1400
|
-
}, _descriptor$1 = _applyDecoratedDescriptor(_class$
|
|
1428
|
+
}, _descriptor$1 = _applyDecoratedDescriptor(_class$f.prototype, "id", [_dec$f, _dec2$f], {
|
|
1401
1429
|
configurable: true,
|
|
1402
1430
|
enumerable: true,
|
|
1403
1431
|
writable: true,
|
|
1404
1432
|
initializer: null
|
|
1405
|
-
}), _class$
|
|
1433
|
+
}), _class$f);
|
|
1406
1434
|
|
|
1407
|
-
var _dec$
|
|
1408
|
-
let EntityBaseSimple = (_dec$
|
|
1435
|
+
var _dec$e, _dec2$e, _class$e, _descriptor;
|
|
1436
|
+
let EntityBaseSimple = (_dec$e = Api.field(v.openapi({
|
|
1409
1437
|
title: $locale('TableIdentity'),
|
|
1410
1438
|
rest: {
|
|
1411
1439
|
order: OrderCoreBase + 1
|
|
1412
1440
|
}
|
|
1413
|
-
})), _dec2$
|
|
1441
|
+
})), _dec2$e = Reflect.metadata("design:type", Number), _class$e = class EntityBaseSimple extends EntityBaseInner {
|
|
1414
1442
|
constructor(...args) {
|
|
1415
1443
|
super(...args);
|
|
1416
1444
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
1417
1445
|
}
|
|
1418
|
-
}, _descriptor = _applyDecoratedDescriptor(_class$
|
|
1446
|
+
}, _descriptor = _applyDecoratedDescriptor(_class$e.prototype, "id", [_dec$e, _dec2$e], {
|
|
1419
1447
|
configurable: true,
|
|
1420
1448
|
enumerable: true,
|
|
1421
1449
|
writable: true,
|
|
1422
1450
|
initializer: null
|
|
1423
|
-
}), _class$
|
|
1451
|
+
}), _class$e);
|
|
1424
1452
|
|
|
1425
1453
|
const SymbolKeyEntity = Symbol('$entity');
|
|
1426
1454
|
const SymbolKeyEntityMeta = Symbol('$entityMeta');
|
|
@@ -2204,10 +2232,59 @@ class BeanModelCrudTable extends BeanModelCrudInner {
|
|
|
2204
2232
|
}
|
|
2205
2233
|
}
|
|
2206
2234
|
|
|
2207
|
-
var _dec$
|
|
2208
|
-
let BeanModel = (_dec$
|
|
2235
|
+
var _dec$d, _dec2$d, _dec3$3, _class$d;
|
|
2236
|
+
let BeanModel = (_dec$d = Bean(), _dec2$d = Virtual(), _dec3$3 = BeanInfo({
|
|
2209
2237
|
module: "a-orm"
|
|
2210
|
-
}), _dec$
|
|
2238
|
+
}), _dec$d(_class$d = _dec2$d(_class$d = _dec3$3(_class$d = class BeanModel extends BeanModelCrudTable {}) || _class$d) || _class$d) || _class$d);
|
|
2239
|
+
|
|
2240
|
+
const SymbolCacheModelsClear = Symbol('SymbolCacheModelsClearAll');
|
|
2241
|
+
const SymbolCacheModelCacheInstances = Symbol('SymbolCacheModelCacheInstances');
|
|
2242
|
+
function clearAllCacheModelsClear(app) {
|
|
2243
|
+
delete app.meta[SymbolCacheModelsClear];
|
|
2244
|
+
}
|
|
2245
|
+
async function clearCacheModelCacheInstance(app, beanFullName) {
|
|
2246
|
+
const cacheModelCacheInstances = getCacheModelCacheInstances(app);
|
|
2247
|
+
const instances = cacheModelCacheInstances[beanFullName];
|
|
2248
|
+
if (!instances) return;
|
|
2249
|
+
delete cacheModelCacheInstances[beanFullName];
|
|
2250
|
+
for (const cacheName in instances) {
|
|
2251
|
+
await app.bean._removeBean(instances[cacheName]);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
function getCacheModelCacheInstances(app) {
|
|
2255
|
+
if (!app.meta[SymbolCacheModelCacheInstances]) app.meta[SymbolCacheModelCacheInstances] = {};
|
|
2256
|
+
return app.meta[SymbolCacheModelCacheInstances];
|
|
2257
|
+
}
|
|
2258
|
+
function getCacheModelsClear(app) {
|
|
2259
|
+
if (!app.meta[SymbolCacheModelsClear]) {
|
|
2260
|
+
app.meta[SymbolCacheModelsClear] = _collectModelsClear(app);
|
|
2261
|
+
}
|
|
2262
|
+
return app.meta[SymbolCacheModelsClear];
|
|
2263
|
+
}
|
|
2264
|
+
function _collectModelsClear(app) {
|
|
2265
|
+
const modelsClearAll = {};
|
|
2266
|
+
const onionSlices = app.bean.onion.model.getOnionsEnabledCached();
|
|
2267
|
+
for (const onionSlice of onionSlices) {
|
|
2268
|
+
const modelName = onionSlice.name;
|
|
2269
|
+
if (!modelsClearAll[modelName]) modelsClearAll[modelName] = [];
|
|
2270
|
+
//
|
|
2271
|
+
const modelsClear = onionSlice.beanOptions.options?.cache?.modelsClear;
|
|
2272
|
+
if (modelsClear) {
|
|
2273
|
+
const modelsClear2 = Array.isArray(modelsClear) ? modelsClear : [modelsClear];
|
|
2274
|
+
modelsClearAll[modelName].push(...modelsClear2);
|
|
2275
|
+
}
|
|
2276
|
+
//
|
|
2277
|
+
const modelsClearedBy = onionSlice.beanOptions.options?.cache?.modelsClearedBy;
|
|
2278
|
+
if (modelsClearedBy) {
|
|
2279
|
+
const modelsClearedBy2 = Array.isArray(modelsClearedBy) ? modelsClearedBy : [modelsClearedBy];
|
|
2280
|
+
for (const modelName2 of modelsClearedBy2) {
|
|
2281
|
+
if (!modelsClearAll[modelName2]) modelsClearAll[modelName2] = [];
|
|
2282
|
+
modelsClearAll[modelName2].push(modelName);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
return modelsClearAll;
|
|
2287
|
+
}
|
|
2211
2288
|
|
|
2212
2289
|
const SymbolCacheOptions = Symbol('SymbolCacheOptions');
|
|
2213
2290
|
const SymbolCacheEnabled = Symbol('SymbolCacheEnabled');
|
|
@@ -2227,7 +2304,14 @@ class ModelCacheBase extends BeanBase {
|
|
|
2227
2304
|
}
|
|
2228
2305
|
getInstance(table) {
|
|
2229
2306
|
if (this.options === false) throw new Error('cache disabled');
|
|
2230
|
-
|
|
2307
|
+
const beanFullName = this._model.$beanFullName;
|
|
2308
|
+
const cacheName = this.getName(table);
|
|
2309
|
+
const cacheModelCacheInstances = getCacheModelCacheInstances(this.app);
|
|
2310
|
+
if (!cacheModelCacheInstances[beanFullName]) cacheModelCacheInstances[beanFullName] = {};
|
|
2311
|
+
if (!cacheModelCacheInstances[beanFullName][cacheName]) {
|
|
2312
|
+
cacheModelCacheInstances[beanFullName][cacheName] = this.app.bean.summer.cache(cacheName, this.options);
|
|
2313
|
+
}
|
|
2314
|
+
return cacheModelCacheInstances[beanFullName][cacheName];
|
|
2231
2315
|
}
|
|
2232
2316
|
getName(table) {
|
|
2233
2317
|
const clientNameReal = this.$scope.orm.service.database.prepareClientNameReal(this._model.db.clientName);
|
|
@@ -2282,10 +2366,10 @@ class ModelCacheBase extends BeanBase {
|
|
|
2282
2366
|
}
|
|
2283
2367
|
}
|
|
2284
2368
|
|
|
2285
|
-
var _dec$
|
|
2286
|
-
let ServiceCacheEntity = (_dec$
|
|
2369
|
+
var _dec$c, _dec2$c, _class$c;
|
|
2370
|
+
let ServiceCacheEntity = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
2287
2371
|
module: "a-orm"
|
|
2288
|
-
}), _dec$
|
|
2372
|
+
}), _dec$c(_class$c = _dec2$c(_class$c = class ServiceCacheEntity extends ModelCacheBase {
|
|
2289
2373
|
__init__(model) {
|
|
2290
2374
|
super.__init__(model, 'entity');
|
|
2291
2375
|
}
|
|
@@ -2308,12 +2392,12 @@ let ServiceCacheEntity = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2308
2392
|
get keysAux() {
|
|
2309
2393
|
return this._model.options.cache?.keysAux;
|
|
2310
2394
|
}
|
|
2311
|
-
}) || _class$
|
|
2395
|
+
}) || _class$c) || _class$c);
|
|
2312
2396
|
|
|
2313
|
-
var _dec$
|
|
2314
|
-
let ServiceCacheQuery = (_dec$
|
|
2397
|
+
var _dec$b, _dec2$b, _class$b;
|
|
2398
|
+
let ServiceCacheQuery = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
2315
2399
|
module: "a-orm"
|
|
2316
|
-
}), _dec$
|
|
2400
|
+
}), _dec$b(_class$b = _dec2$b(_class$b = class ServiceCacheQuery extends ModelCacheBase {
|
|
2317
2401
|
__init__(model) {
|
|
2318
2402
|
super.__init__(model, 'query');
|
|
2319
2403
|
}
|
|
@@ -2323,7 +2407,7 @@ let ServiceCacheQuery = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
|
2323
2407
|
const cache = this.getInstance(table);
|
|
2324
2408
|
await cache.clear();
|
|
2325
2409
|
}
|
|
2326
|
-
}) || _class$
|
|
2410
|
+
}) || _class$b) || _class$b);
|
|
2327
2411
|
|
|
2328
2412
|
function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
2329
2413
|
// collect
|
|
@@ -2368,10 +2452,10 @@ function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
|
2368
2452
|
return relations;
|
|
2369
2453
|
}
|
|
2370
2454
|
|
|
2371
|
-
var _dec$
|
|
2372
|
-
let ServiceRelations = (_dec$
|
|
2455
|
+
var _dec$a, _dec2$a, _class$a;
|
|
2456
|
+
let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
2373
2457
|
module: "a-orm"
|
|
2374
|
-
}), _dec$
|
|
2458
|
+
}), _dec$a(_class$a = _dec2$a(_class$a = class ServiceRelations extends BeanBase {
|
|
2375
2459
|
constructor(...args) {
|
|
2376
2460
|
super(...args);
|
|
2377
2461
|
this._model = void 0;
|
|
@@ -2903,7 +2987,7 @@ let ServiceRelations = (_dec$9 = Service(), _dec2$9 = BeanInfo({
|
|
|
2903
2987
|
handleRelationsCollection(includeWrapper) {
|
|
2904
2988
|
return handleRelationsCollection(this._model.options.relations, includeWrapper);
|
|
2905
2989
|
}
|
|
2906
|
-
}) || _class$
|
|
2990
|
+
}) || _class$a) || _class$a);
|
|
2907
2991
|
|
|
2908
2992
|
class BeanModelCrud extends BeanModelCrudInner {
|
|
2909
2993
|
async mget(ids, options) {
|
|
@@ -2932,14 +3016,12 @@ class BeanModelCrud extends BeanModelCrudInner {
|
|
|
2932
3016
|
}
|
|
2933
3017
|
}
|
|
2934
3018
|
|
|
2935
|
-
const SymbolModelsClearAll = Symbol('SymbolModelsClearAll');
|
|
2936
3019
|
class BeanModelCache extends BeanModelCrud {
|
|
2937
3020
|
constructor(...args) {
|
|
2938
3021
|
super(...args);
|
|
2939
3022
|
this.cacheQuery = void 0;
|
|
2940
3023
|
this.cacheEntity = void 0;
|
|
2941
3024
|
this.relations = void 0;
|
|
2942
|
-
this[SymbolModelsClearAll] = void 0;
|
|
2943
3025
|
}
|
|
2944
3026
|
__init__(clientName, table) {
|
|
2945
3027
|
super.__init__(clientName, table);
|
|
@@ -2947,6 +3029,10 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
2947
3029
|
this.cacheEntity = this.bean._newBean(ServiceCacheEntity, this);
|
|
2948
3030
|
this.relations = this.bean._newBean(ServiceRelations, this);
|
|
2949
3031
|
}
|
|
3032
|
+
async __dispose__() {
|
|
3033
|
+
await disposeInstance(this.cacheQuery);
|
|
3034
|
+
await disposeInstance(this.cacheEntity);
|
|
3035
|
+
}
|
|
2950
3036
|
async insert(data, options) {
|
|
2951
3037
|
if (!data) data = {};
|
|
2952
3038
|
const items = await this.insertBulk([data], options);
|
|
@@ -3490,39 +3576,9 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3490
3576
|
}
|
|
3491
3577
|
}
|
|
3492
3578
|
_getModelsClear(modelName) {
|
|
3493
|
-
const modelsClearAll = this.
|
|
3579
|
+
const modelsClearAll = getCacheModelsClear(this.app);
|
|
3494
3580
|
return modelsClearAll[modelName ?? this.$onionName];
|
|
3495
3581
|
}
|
|
3496
|
-
_getModelsClearAll() {
|
|
3497
|
-
if (!this[SymbolModelsClearAll]) {
|
|
3498
|
-
this[SymbolModelsClearAll] = this._collectModelsClearAll();
|
|
3499
|
-
}
|
|
3500
|
-
return this[SymbolModelsClearAll];
|
|
3501
|
-
}
|
|
3502
|
-
_collectModelsClearAll() {
|
|
3503
|
-
const modelsClearAll = {};
|
|
3504
|
-
const onionSlices = this.bean.onion.model.getOnionsEnabled();
|
|
3505
|
-
for (const onionSlice of onionSlices) {
|
|
3506
|
-
const modelName = onionSlice.name;
|
|
3507
|
-
if (!modelsClearAll[modelName]) modelsClearAll[modelName] = [];
|
|
3508
|
-
//
|
|
3509
|
-
const modelsClear = onionSlice.beanOptions.options?.cache?.modelsClear;
|
|
3510
|
-
if (modelsClear) {
|
|
3511
|
-
const modelsClear2 = Array.isArray(modelsClear) ? modelsClear : [modelsClear];
|
|
3512
|
-
modelsClearAll[modelName].push(...modelsClear2);
|
|
3513
|
-
}
|
|
3514
|
-
//
|
|
3515
|
-
const modelsClearedBy = onionSlice.beanOptions.options?.cache?.modelsClearedBy;
|
|
3516
|
-
if (modelsClearedBy) {
|
|
3517
|
-
const modelsClearedBy2 = Array.isArray(modelsClearedBy) ? modelsClearedBy : [modelsClearedBy];
|
|
3518
|
-
for (const modelName2 of modelsClearedBy2) {
|
|
3519
|
-
if (!modelsClearAll[modelName2]) modelsClearAll[modelName2] = [];
|
|
3520
|
-
modelsClearAll[modelName2].push(modelName);
|
|
3521
|
-
}
|
|
3522
|
-
}
|
|
3523
|
-
}
|
|
3524
|
-
return modelsClearAll;
|
|
3525
|
-
}
|
|
3526
3582
|
_checkDisableCacheQueryByOptions(options) {
|
|
3527
3583
|
if (options?.disableCacheQuery === true || options?.disableCacheQuery === false) {
|
|
3528
3584
|
return options?.disableCacheQuery;
|
|
@@ -3617,16 +3673,16 @@ function __parseMagicField(str) {
|
|
|
3617
3673
|
return [fieldName, op];
|
|
3618
3674
|
}
|
|
3619
3675
|
|
|
3620
|
-
var _dec$
|
|
3621
|
-
let BeanModelBase = (_dec$
|
|
3676
|
+
var _dec$9, _dec2$9, _dec3$2, _class$9;
|
|
3677
|
+
let BeanModelBase = (_dec$9 = Bean(), _dec2$9 = Virtual(), _dec3$2 = BeanInfo({
|
|
3622
3678
|
module: "a-orm"
|
|
3623
|
-
}), _dec$
|
|
3679
|
+
}), _dec$9(_class$9 = _dec2$9(_class$9 = _dec3$2(_class$9 = class BeanModelBase extends BeanModelCache {}) || _class$9) || _class$9) || _class$9);
|
|
3624
3680
|
|
|
3625
|
-
var _dec$
|
|
3681
|
+
var _dec$8, _dec2$8, _dec3$1, _dec4$1, _class$8;
|
|
3626
3682
|
const SymbolModuleScope$1 = Symbol('SymbolModuleScope');
|
|
3627
|
-
let ServiceEntityResolver = (_dec$
|
|
3683
|
+
let ServiceEntityResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
3628
3684
|
module: "a-orm"
|
|
3629
|
-
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3685
|
+
}), _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 {
|
|
3630
3686
|
constructor(moduleScope) {
|
|
3631
3687
|
super();
|
|
3632
3688
|
this[SymbolModuleScope$1] = void 0;
|
|
@@ -3641,13 +3697,13 @@ let ServiceEntityResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
3641
3697
|
}
|
|
3642
3698
|
return this.__instances[prop];
|
|
3643
3699
|
}
|
|
3644
|
-
}) || _class$
|
|
3700
|
+
}) || _class$8) || _class$8) || _class$8) || _class$8);
|
|
3645
3701
|
|
|
3646
|
-
var _dec$
|
|
3702
|
+
var _dec$7, _dec2$7, _dec3, _dec4, _class$7;
|
|
3647
3703
|
const SymbolModuleScope = Symbol('SymbolModuleScope');
|
|
3648
|
-
let ServiceModelResolver = (_dec$
|
|
3704
|
+
let ServiceModelResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
3649
3705
|
module: "a-orm"
|
|
3650
|
-
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3706
|
+
}), _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 {
|
|
3651
3707
|
constructor(moduleScope) {
|
|
3652
3708
|
super();
|
|
3653
3709
|
this[SymbolModuleScope] = void 0;
|
|
@@ -3657,12 +3713,12 @@ let ServiceModelResolver = (_dec$6 = Service(), _dec2$6 = BeanInfo({
|
|
|
3657
3713
|
const beanFullName = `${this[SymbolModuleScope]}.model.${prop}`;
|
|
3658
3714
|
return this.bean._getBean(beanFullName);
|
|
3659
3715
|
}
|
|
3660
|
-
}) || _class$
|
|
3716
|
+
}) || _class$7) || _class$7) || _class$7) || _class$7);
|
|
3661
3717
|
|
|
3662
|
-
var _dec$
|
|
3663
|
-
let BroadcastColumnsClear = (_dec$
|
|
3718
|
+
var _dec$6, _dec2$6, _class$6;
|
|
3719
|
+
let BroadcastColumnsClear = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
3664
3720
|
module: "a-orm"
|
|
3665
|
-
}), _dec$
|
|
3721
|
+
}), _dec$6(_class$6 = _dec2$6(_class$6 = class BroadcastColumnsClear extends BeanBroadcastBase {
|
|
3666
3722
|
async execute(data, isEmitter) {
|
|
3667
3723
|
const {
|
|
3668
3724
|
clientName,
|
|
@@ -3672,44 +3728,44 @@ let BroadcastColumnsClear = (_dec$5 = Broadcast(), _dec2$5 = BeanInfo({
|
|
|
3672
3728
|
await cast(this.scope.service.database).columnsClearWorker(clientName, tableName);
|
|
3673
3729
|
}
|
|
3674
3730
|
}
|
|
3675
|
-
}) || _class$
|
|
3731
|
+
}) || _class$6) || _class$6);
|
|
3676
3732
|
|
|
3677
|
-
var _dec$
|
|
3678
|
-
let EventClientNameReal = (_dec$
|
|
3733
|
+
var _dec$5, _dec2$5, _class$5;
|
|
3734
|
+
let EventClientNameReal = (_dec$5 = Event(), _dec2$5 = BeanInfo({
|
|
3679
3735
|
module: "a-orm"
|
|
3680
|
-
}), _dec$
|
|
3736
|
+
}), _dec$5(_class$5 = _dec2$5(_class$5 = class EventClientNameReal extends BeanEventBase {}) || _class$5) || _class$5);
|
|
3681
3737
|
|
|
3682
|
-
var _dec$
|
|
3683
|
-
let EventColumnsClear = (_dec$
|
|
3738
|
+
var _dec$4, _dec2$4, _class$4;
|
|
3739
|
+
let EventColumnsClear = (_dec$4 = Event(), _dec2$4 = BeanInfo({
|
|
3684
3740
|
module: "a-orm"
|
|
3685
|
-
}), _dec$
|
|
3741
|
+
}), _dec$4(_class$4 = _dec2$4(_class$4 = class EventColumnsClear extends BeanEventBase {}) || _class$4) || _class$4);
|
|
3686
3742
|
|
|
3687
|
-
var _dec$
|
|
3688
|
-
let QueueDoubleDelete = (_dec$
|
|
3743
|
+
var _dec$3, _dec2$3, _class$3;
|
|
3744
|
+
let QueueDoubleDelete = (_dec$3 = Queue({
|
|
3689
3745
|
options: {
|
|
3690
3746
|
job: {
|
|
3691
3747
|
delay: 3 * 1000
|
|
3692
3748
|
}
|
|
3693
3749
|
}
|
|
3694
|
-
}), _dec2$
|
|
3750
|
+
}), _dec2$3 = BeanInfo({
|
|
3695
3751
|
module: "a-orm"
|
|
3696
|
-
}), _dec$
|
|
3752
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class QueueDoubleDelete extends BeanQueueBase {
|
|
3697
3753
|
async execute(data, _options) {
|
|
3698
3754
|
const beanInstance = this.app.bean._newBean(data.beanFullName, data.clientName, data.table);
|
|
3699
3755
|
await beanInstance[data.method](...data.args);
|
|
3700
3756
|
}
|
|
3701
|
-
}) || _class$
|
|
3757
|
+
}) || _class$3) || _class$3);
|
|
3702
3758
|
|
|
3703
|
-
var _dec$
|
|
3704
|
-
let ScheduleSoftDeletionPrune = (_dec$
|
|
3759
|
+
var _dec$2, _dec2$2, _class$2;
|
|
3760
|
+
let ScheduleSoftDeletionPrune = (_dec$2 = Schedule({
|
|
3705
3761
|
repeat: {
|
|
3706
3762
|
every: 24 * 3600 * 1000
|
|
3707
3763
|
}
|
|
3708
|
-
}), _dec2$
|
|
3764
|
+
}), _dec2$2 = BeanInfo({
|
|
3709
3765
|
module: "a-orm"
|
|
3710
|
-
}), _dec$
|
|
3766
|
+
}), _dec$2(_class$2 = _dec2$2(_class$2 = class ScheduleSoftDeletionPrune extends BeanBase {
|
|
3711
3767
|
async execute() {
|
|
3712
|
-
const onionSlices = this.bean.onion.model.
|
|
3768
|
+
const onionSlices = this.bean.onion.model.getOnionsEnabledCached();
|
|
3713
3769
|
for (const onionSlice of onionSlices) {
|
|
3714
3770
|
if (onionSlice.beanOptions.options?.disableDeleted) continue;
|
|
3715
3771
|
let softDeletionPrune = onionSlice.beanOptions.options?.softDeletionPrune ?? this.scope.config.softDeletionPrune.enable;
|
|
@@ -3738,6 +3794,20 @@ let ScheduleSoftDeletionPrune = (_dec$1 = Schedule({
|
|
|
3738
3794
|
});
|
|
3739
3795
|
}
|
|
3740
3796
|
}
|
|
3797
|
+
}) || _class$2) || _class$2);
|
|
3798
|
+
|
|
3799
|
+
var _dec$1, _dec2$1, _class$1;
|
|
3800
|
+
// import { clearAllCacheModelsClear, clearCacheModelCacheInstance } from '../lib/const.ts';
|
|
3801
|
+
|
|
3802
|
+
let HmrModel = (_dec$1 = Hmr(), _dec2$1 = BeanInfo({
|
|
3803
|
+
module: "a-orm"
|
|
3804
|
+
}), _dec$1(_class$1 = _dec2$1(_class$1 = class HmrModel extends BeanBase {
|
|
3805
|
+
async reload(_beanOptions) {
|
|
3806
|
+
// more deps: dto/model
|
|
3807
|
+
this.app.bean.worker.reload();
|
|
3808
|
+
// clearAllCacheModelsClear(this.app);
|
|
3809
|
+
// await clearCacheModelCacheInstance(this.app, beanOptions.beanFullName);
|
|
3810
|
+
}
|
|
3741
3811
|
}) || _class$1) || _class$1);
|
|
3742
3812
|
|
|
3743
3813
|
function config(_app) {
|
|
@@ -3792,24 +3862,6 @@ function config(_app) {
|
|
|
3792
3862
|
};
|
|
3793
3863
|
}
|
|
3794
3864
|
|
|
3795
|
-
var locale_en_us = {
|
|
3796
|
-
TableIdentity: 'ID',
|
|
3797
|
-
CreatedAt: 'Created At',
|
|
3798
|
-
UpdatedAt: 'Updated At',
|
|
3799
|
-
Deleted: 'Deleted',
|
|
3800
|
-
InstanceId: 'Instance ID',
|
|
3801
|
-
ShouldSpecifyTable: 'should specify the table name'
|
|
3802
|
-
};
|
|
3803
|
-
|
|
3804
|
-
var locale_zh_cn = {
|
|
3805
|
-
TableIdentity: '标识',
|
|
3806
|
-
CreatedAt: '创建时间',
|
|
3807
|
-
UpdatedAt: '修改时间',
|
|
3808
|
-
Deleted: '已删除',
|
|
3809
|
-
InstanceId: '实例标识',
|
|
3810
|
-
ShouldSpecifyTable: '应该指定表名'
|
|
3811
|
-
};
|
|
3812
|
-
|
|
3813
3865
|
const errors = {
|
|
3814
3866
|
ShouldSpecifyTable: 1001
|
|
3815
3867
|
};
|
|
@@ -3954,16 +4006,10 @@ async function configTest(_app) {
|
|
|
3954
4006
|
}
|
|
3955
4007
|
|
|
3956
4008
|
var _dec, _dec2, _class;
|
|
3957
|
-
const locales = {
|
|
3958
|
-
'en-us': locale_en_us,
|
|
3959
|
-
'zh-cn': locale_zh_cn
|
|
3960
|
-
};
|
|
3961
4009
|
let ScopeModuleAOrm = (_dec = Scope(), _dec2 = BeanInfo({
|
|
3962
4010
|
module: "a-orm"
|
|
3963
4011
|
}), _dec(_class = _dec2(_class = class ScopeModuleAOrm extends BeanScopeBase {}) || _class) || _class);
|
|
3964
|
-
|
|
3965
|
-
return `a-orm::${key}`;
|
|
3966
|
-
}
|
|
4012
|
+
|
|
3967
4013
|
/** scope: end */
|
|
3968
4014
|
|
|
3969
4015
|
function DatabaseDialect(options) {
|
|
@@ -4439,4 +4485,4 @@ const $relationMutate = {
|
|
|
4439
4485
|
belongsToMany
|
|
4440
4486
|
};
|
|
4441
4487
|
|
|
4442
|
-
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 };
|
|
4488
|
+
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;
|
|
@@ -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.88",
|
|
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",
|