vona-module-a-orm 5.0.51 → 5.0.52
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 +24 -0
- package/dist/bean/bean.databaseDialectBase.d.ts +1 -1
- package/dist/bean/bean.model/bean.model_cache.d.ts +4 -0
- package/dist/bean/queue.doubleDelete.d.ts +15 -0
- package/dist/config/config.d.ts +8 -0
- package/dist/index.js +251 -146
- package/dist/service/transactionConsistency/342/200/214_.d.ts +2 -2
- package/dist/types/database.d.ts +1 -1
- package/dist/types/modelWhere.d.ts +6 -2
- package/dist/types/onion/databaseDialect.d.ts +1 -1
- package/dist/types/onion/entity.d.ts +3 -1
- package/dist/types/onion/model.d.ts +1 -1
- package/package.json +1 -1
|
@@ -168,6 +168,29 @@ declare module 'vona-module-a-event' {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/** event: end */
|
|
171
|
+
/** queue: begin */
|
|
172
|
+
export * from '../bean/queue.doubleDelete.ts';
|
|
173
|
+
import { type IDecoratorQueueOptions } from 'vona-module-a-queue';
|
|
174
|
+
declare module 'vona-module-a-queue' {
|
|
175
|
+
interface IQueueRecord {
|
|
176
|
+
'a-orm:doubleDelete': IDecoratorQueueOptions;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
declare module 'vona-module-a-orm' {
|
|
180
|
+
interface QueueDoubleDelete {
|
|
181
|
+
}
|
|
182
|
+
interface QueueDoubleDelete {
|
|
183
|
+
get $beanFullName(): 'a-orm.queue.doubleDelete';
|
|
184
|
+
get $onionName(): 'a-orm:doubleDelete';
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/** queue: end */
|
|
188
|
+
/** queue: begin */
|
|
189
|
+
import type { QueueDoubleDelete } from '../bean/queue.doubleDelete.ts';
|
|
190
|
+
export interface IModuleQueue {
|
|
191
|
+
'doubleDelete': QueueDoubleDelete;
|
|
192
|
+
}
|
|
193
|
+
/** queue: end */
|
|
171
194
|
/** schedule: begin */
|
|
172
195
|
export * from '../bean/schedule.softDeletionPrune.ts';
|
|
173
196
|
import { type IDecoratorScheduleOptions } from 'vona-module-a-schedule';
|
|
@@ -226,6 +249,7 @@ export interface ScopeModuleAOrm {
|
|
|
226
249
|
service: IModuleService;
|
|
227
250
|
broadcast: IModuleBroadcast;
|
|
228
251
|
event: IModuleEvent;
|
|
252
|
+
queue: IModuleQueue;
|
|
229
253
|
}
|
|
230
254
|
import 'vona';
|
|
231
255
|
declare module 'vona' {
|
|
@@ -10,7 +10,7 @@ export declare class BeanDatabaseDialectBase extends BeanBase {
|
|
|
10
10
|
createDatabase(_schemaBuilder: Knex.SchemaBuilder, _databaseName: string): Promise<void>;
|
|
11
11
|
dropDatabase(_schemaBuilder: Knex.SchemaBuilder, _databaseName: string): Promise<void>;
|
|
12
12
|
fetchIndexes(_schemaBuilder: Knex.SchemaBuilder, _tableName: string): Promise<IFetchIndexesResultItem[]>;
|
|
13
|
-
insert(_builder: Knex.QueryBuilder): Promise<TableIdentity[]>;
|
|
13
|
+
insert(_builder: Knex.QueryBuilder, _datas: any[]): Promise<TableIdentity[]>;
|
|
14
14
|
query(_result: any): void;
|
|
15
15
|
viewDependents(_builder: Knex.QueryBuilder, _viewName: string): Promise<string[]>;
|
|
16
16
|
coerceColumn(column: Knex.ColumnInfo): ITableColumn;
|
|
@@ -44,8 +44,12 @@ export declare class BeanModelCache<TRecord extends {} = {}> extends BeanModelCr
|
|
|
44
44
|
private __filterMGetColumns;
|
|
45
45
|
private __filterGetColumns;
|
|
46
46
|
cacheEntityDel(id: TableIdentity | TableIdentity[], table?: keyof ITableRecord): Promise<void>;
|
|
47
|
+
cacheEntityDelInner(id: TableIdentity | TableIdentity[], table?: keyof ITableRecord): Promise<void>;
|
|
47
48
|
cacheEntityClear(table?: keyof ITableRecord): Promise<void>;
|
|
49
|
+
cacheEntityClearInner(table?: keyof ITableRecord): Promise<void>;
|
|
48
50
|
cacheQueryClear(table?: keyof ITableRecord): Promise<void>;
|
|
51
|
+
cacheQueryClearInner(table?: keyof ITableRecord): Promise<void>;
|
|
52
|
+
private _shardingCacheDoubleDelete;
|
|
49
53
|
private _cacheQueryClearModelsClear;
|
|
50
54
|
private _getModelsClear;
|
|
51
55
|
private _getModelsClearAll;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IQueueExecute, IQueuePushOptions } from 'vona-module-a-queue';
|
|
2
|
+
import type { IDatabaseClientRecord } from '../types/database.ts';
|
|
3
|
+
import type { ITableRecord } from '../types/onion/table.ts';
|
|
4
|
+
import { BeanQueueBase } from 'vona-module-a-queue';
|
|
5
|
+
export interface TypeQueueDoubleDeleteJobData {
|
|
6
|
+
beanFullName: string;
|
|
7
|
+
clientName: keyof IDatabaseClientRecord;
|
|
8
|
+
table: keyof ITableRecord;
|
|
9
|
+
method: 'cacheEntityDelInner' | 'cacheEntityClearInner' | 'cacheQueryClearInner';
|
|
10
|
+
args: any[];
|
|
11
|
+
}
|
|
12
|
+
export type TypeQueueDoubleDeleteJobResult = void;
|
|
13
|
+
export declare class QueueDoubleDelete extends BeanQueueBase<TypeQueueDoubleDeleteJobData, TypeQueueDoubleDeleteJobResult> implements IQueueExecute<TypeQueueDoubleDeleteJobData, TypeQueueDoubleDeleteJobResult> {
|
|
14
|
+
execute(data: TypeQueueDoubleDeleteJobData, _options?: IQueuePushOptions): Promise<TypeQueueDoubleDeleteJobResult>;
|
|
15
|
+
}
|
package/dist/config/config.d.ts
CHANGED
|
@@ -5,12 +5,20 @@ import type { TSummerCachePreset } from 'vona-module-a-summer';
|
|
|
5
5
|
import type { IDatabaseClientDialectRecord } from '../types/database.ts';
|
|
6
6
|
export type TypeDataBaseConfigDialects = Record<keyof IDatabaseClientDialectRecord, TypeBeanRecordGeneralSelectorKeys<'databaseDialect'>>;
|
|
7
7
|
export declare function config(_app: VonaApplication): {
|
|
8
|
+
sharding: {
|
|
9
|
+
cache: {
|
|
10
|
+
doubleDelete: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
8
13
|
rest: {
|
|
9
14
|
query: {
|
|
10
15
|
pageSize: {
|
|
11
16
|
default: number;
|
|
12
17
|
max: number;
|
|
13
18
|
};
|
|
19
|
+
orders: {
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
14
22
|
};
|
|
15
23
|
};
|
|
16
24
|
table: {
|
package/dist/index.js
CHANGED
|
@@ -7,31 +7,32 @@ import knex from 'knex';
|
|
|
7
7
|
import { isNil, safeBoolean, isClass, ensureArray, hashkey } from '@cabloy/utils';
|
|
8
8
|
import { swapDeps } from '@cabloy/deps';
|
|
9
9
|
import { prepareClassType, getTargetDecoratorRules, Api, v, OrderMaxBase, OrderCoreBase, getSchemaDynamic, SymbolSchemaDynamicRefId, addSchemaDynamic, mergeFieldsOpenapiMetadata } from 'vona-module-a-openapi';
|
|
10
|
-
import { ZodMetadata } from '@cabloy/zod-
|
|
10
|
+
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
11
11
|
import { SymbolDecoratorRuleColumn } from 'vona-module-a-openapiutils';
|
|
12
12
|
import z from 'zod';
|
|
13
13
|
import { Broadcast, BeanBroadcastBase } from 'vona-module-a-broadcast';
|
|
14
14
|
import { Event, BeanEventBase } from 'vona-module-a-event';
|
|
15
|
+
import { Queue, BeanQueueBase } from 'vona-module-a-queue';
|
|
15
16
|
import { Schedule } from 'vona-module-a-schedule';
|
|
16
17
|
import { configAllWithIgnoreNull, configAll, configRedisWithIgnoreNull, configRedis } from 'vona-module-a-summer';
|
|
17
18
|
import { ServiceDatabaseAsyncLocalStorage as ServiceDatabaseAsyncLocalStorage$1, ServiceTransactionConsistency as ServiceTransactionConsistency_ } from 'vona-module-a-orm';
|
|
18
19
|
import { mutate } from 'mutate-on-copy';
|
|
19
20
|
|
|
20
|
-
var _dec$
|
|
21
|
-
let AopMethodTransaction = (_dec$
|
|
21
|
+
var _dec$x, _dec2$x, _class$x;
|
|
22
|
+
let AopMethodTransaction = (_dec$x = AopMethod(), _dec2$x = BeanInfo({
|
|
22
23
|
module: "a-orm"
|
|
23
|
-
}), _dec$
|
|
24
|
+
}), _dec$x(_class$x = _dec2$x(_class$x = class AopMethodTransaction extends BeanAopMethodBase {
|
|
24
25
|
execute(options, _args, next, _receiver, _prop) {
|
|
25
26
|
return this.bean.database.current.transaction.begin(() => {
|
|
26
27
|
return next();
|
|
27
28
|
}, options);
|
|
28
29
|
}
|
|
29
|
-
}) || _class$
|
|
30
|
+
}) || _class$x) || _class$x);
|
|
30
31
|
|
|
31
|
-
var _dec$
|
|
32
|
-
let ServiceDatabaseAsyncLocalStorage = (_dec$
|
|
32
|
+
var _dec$w, _dec2$w, _class$w;
|
|
33
|
+
let ServiceDatabaseAsyncLocalStorage = (_dec$w = Service(), _dec2$w = BeanInfo({
|
|
33
34
|
module: "a-orm"
|
|
34
|
-
}), _dec$
|
|
35
|
+
}), _dec$w(_class$w = _dec2$w(_class$w = class ServiceDatabaseAsyncLocalStorage extends BeanBase {
|
|
35
36
|
constructor(...args) {
|
|
36
37
|
super(...args);
|
|
37
38
|
this.dbStorage = void 0;
|
|
@@ -50,14 +51,14 @@ let ServiceDatabaseAsyncLocalStorage = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
|
50
51
|
return fn();
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
}) || _class$
|
|
54
|
+
}) || _class$w) || _class$w);
|
|
54
55
|
|
|
55
|
-
var _dec$
|
|
56
|
+
var _dec$v, _dec2$v, _class$v;
|
|
56
57
|
const SymbolColumnsCache = Symbol('SymbolColumnsCache');
|
|
57
58
|
const SymbolColumnsDefaultCache = Symbol('SymbolColumnsDefaultCache');
|
|
58
|
-
let ServiceColumnsCache = (_dec$
|
|
59
|
+
let ServiceColumnsCache = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
59
60
|
module: "a-orm"
|
|
60
|
-
}), _dec$
|
|
61
|
+
}), _dec$v(_class$v = _dec2$v(_class$v = class ServiceColumnsCache extends BeanBase {
|
|
61
62
|
constructor(...args) {
|
|
62
63
|
super(...args);
|
|
63
64
|
this.clientName = void 0;
|
|
@@ -112,12 +113,12 @@ let ServiceColumnsCache = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
|
112
113
|
return exists;
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
|
-
}) || _class$
|
|
116
|
+
}) || _class$v) || _class$v);
|
|
116
117
|
|
|
117
|
-
var _dec$
|
|
118
|
-
let ServiceColumns = (_dec$
|
|
118
|
+
var _dec$u, _dec2$u, _class$u;
|
|
119
|
+
let ServiceColumns = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
119
120
|
module: "a-orm"
|
|
120
|
-
}), _dec$
|
|
121
|
+
}), _dec$u(_class$u = _dec2$u(_class$u = class ServiceColumns extends BeanBase {
|
|
121
122
|
constructor(...args) {
|
|
122
123
|
super(...args);
|
|
123
124
|
this._db = void 0;
|
|
@@ -168,7 +169,7 @@ let ServiceColumns = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
168
169
|
columnsClear(tableName) {
|
|
169
170
|
return this.scope.service.database.columnsClear(this.db.clientName, tableName);
|
|
170
171
|
}
|
|
171
|
-
}) || _class$
|
|
172
|
+
}) || _class$u) || _class$u);
|
|
172
173
|
|
|
173
174
|
const TransactionIsolationLevelsMap = {
|
|
174
175
|
DEFAULT: undefined,
|
|
@@ -181,10 +182,10 @@ const TransactionIsolationLevelsMap = {
|
|
|
181
182
|
|
|
182
183
|
// export type TransactionPropagation=''
|
|
183
184
|
|
|
184
|
-
var _dec$
|
|
185
|
-
let ServiceDatabase = (_dec$
|
|
185
|
+
var _dec$t, _dec2$t, _class$t;
|
|
186
|
+
let ServiceDatabase = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
186
187
|
module: "a-orm"
|
|
187
|
-
}), _dec$
|
|
188
|
+
}), _dec$t(_class$t = _dec2$t(_class$t = class ServiceDatabase extends BeanBase {
|
|
188
189
|
getDialect(client) {
|
|
189
190
|
if (!client) throw new Error('database dialect not specified');
|
|
190
191
|
const beanFullName = this.scope.config.dialects[client];
|
|
@@ -270,12 +271,12 @@ let ServiceDatabase = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
|
270
271
|
});
|
|
271
272
|
this.__columnsClearRaw(clientName);
|
|
272
273
|
}
|
|
273
|
-
}) || _class$
|
|
274
|
+
}) || _class$t) || _class$t);
|
|
274
275
|
|
|
275
|
-
var _dec$
|
|
276
|
-
let ServiceTransactionConsistency = (_dec$
|
|
276
|
+
var _dec$s, _dec2$s, _class$s;
|
|
277
|
+
let ServiceTransactionConsistency = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
277
278
|
module: "a-orm"
|
|
278
|
-
}), _dec$
|
|
279
|
+
}), _dec$s(_class$s = _dec2$s(_class$s = class ServiceTransactionConsistency extends BeanBase {
|
|
279
280
|
constructor(...args) {
|
|
280
281
|
super(...args);
|
|
281
282
|
this._commitCallbacks = [];
|
|
@@ -287,7 +288,7 @@ let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
287
288
|
compensate(cb) {
|
|
288
289
|
this._compensateCallbacks.unshift(AsyncResource.bind(cb));
|
|
289
290
|
}
|
|
290
|
-
async
|
|
291
|
+
async commitsDone() {
|
|
291
292
|
while (true) {
|
|
292
293
|
const cb = this._commitCallbacks.shift();
|
|
293
294
|
if (!cb) break;
|
|
@@ -295,7 +296,7 @@ let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
295
296
|
}
|
|
296
297
|
this._compensateCallbacks = [];
|
|
297
298
|
}
|
|
298
|
-
async
|
|
299
|
+
async compensatesDone() {
|
|
299
300
|
while (true) {
|
|
300
301
|
const cb = this._compensateCallbacks.shift();
|
|
301
302
|
if (!cb) break;
|
|
@@ -303,12 +304,12 @@ let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
303
304
|
}
|
|
304
305
|
this._commitCallbacks = [];
|
|
305
306
|
}
|
|
306
|
-
}) || _class$
|
|
307
|
+
}) || _class$s) || _class$s);
|
|
307
308
|
|
|
308
|
-
var _dec$
|
|
309
|
-
let ServiceTransactionFiber = (_dec$
|
|
309
|
+
var _dec$r, _dec2$r, _class$r;
|
|
310
|
+
let ServiceTransactionFiber = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
310
311
|
module: "a-orm"
|
|
311
|
-
}), _dec$
|
|
312
|
+
}), _dec$r(_class$r = _dec2$r(_class$r = class ServiceTransactionFiber extends BeanBase {
|
|
312
313
|
constructor(...args) {
|
|
313
314
|
super(...args);
|
|
314
315
|
this._connection = void 0;
|
|
@@ -329,20 +330,20 @@ let ServiceTransactionFiber = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
|
329
330
|
}
|
|
330
331
|
async doCommit() {
|
|
331
332
|
await this._connection.commit();
|
|
332
|
-
await this._transactionConsistency.
|
|
333
|
+
await this._transactionConsistency.commitsDone();
|
|
333
334
|
this._connection = undefined;
|
|
334
335
|
}
|
|
335
336
|
async doRollback() {
|
|
336
337
|
await this._connection.rollback();
|
|
337
|
-
await this._transactionConsistency.
|
|
338
|
+
await this._transactionConsistency.compensatesDone();
|
|
338
339
|
this._connection = undefined;
|
|
339
340
|
}
|
|
340
|
-
}) || _class$
|
|
341
|
+
}) || _class$r) || _class$r);
|
|
341
342
|
|
|
342
|
-
var _dec$
|
|
343
|
-
let ServiceTransactionState = (_dec$
|
|
343
|
+
var _dec$q, _dec2$q, _class$q;
|
|
344
|
+
let ServiceTransactionState = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
344
345
|
module: "a-orm"
|
|
345
|
-
}), _dec$
|
|
346
|
+
}), _dec$q(_class$q = _dec2$q(_class$q = class ServiceTransactionState extends BeanBase {
|
|
346
347
|
constructor(...args) {
|
|
347
348
|
super(...args);
|
|
348
349
|
this._fibers = {};
|
|
@@ -364,12 +365,12 @@ let ServiceTransactionState = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
|
364
365
|
const selector = this.serviceDatabase.prepareClientNameSelector(dbInfo);
|
|
365
366
|
delete this._fibers[selector];
|
|
366
367
|
}
|
|
367
|
-
}) || _class$
|
|
368
|
+
}) || _class$q) || _class$q);
|
|
368
369
|
|
|
369
|
-
var _dec$
|
|
370
|
-
let ServiceTransactionAsyncLocalStorage = (_dec$
|
|
370
|
+
var _dec$p, _dec2$p, _class$p;
|
|
371
|
+
let ServiceTransactionAsyncLocalStorage = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
371
372
|
module: "a-orm"
|
|
372
|
-
}), _dec$
|
|
373
|
+
}), _dec$p(_class$p = _dec2$p(_class$p = class ServiceTransactionAsyncLocalStorage extends BeanBase {
|
|
373
374
|
constructor(...args) {
|
|
374
375
|
super(...args);
|
|
375
376
|
this.transactionStorage = void 0;
|
|
@@ -390,12 +391,12 @@ let ServiceTransactionAsyncLocalStorage = (_dec$o = Service(), _dec2$o = BeanInf
|
|
|
390
391
|
return fn();
|
|
391
392
|
});
|
|
392
393
|
}
|
|
393
|
-
}) || _class$
|
|
394
|
+
}) || _class$p) || _class$p);
|
|
394
395
|
|
|
395
|
-
var _dec$
|
|
396
|
-
let ServiceTransaction = (_dec$
|
|
396
|
+
var _dec$o, _dec2$o, _class$o;
|
|
397
|
+
let ServiceTransaction = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
397
398
|
module: "a-orm"
|
|
398
|
-
}), _dec$
|
|
399
|
+
}), _dec$o(_class$o = _dec2$o(_class$o = class ServiceTransaction extends BeanBase {
|
|
399
400
|
constructor(...args) {
|
|
400
401
|
super(...args);
|
|
401
402
|
this._db = void 0;
|
|
@@ -516,7 +517,7 @@ let ServiceTransaction = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
|
516
517
|
}
|
|
517
518
|
return res;
|
|
518
519
|
}
|
|
519
|
-
}) || _class$
|
|
520
|
+
}) || _class$o) || _class$o);
|
|
520
521
|
function _translateTransactionOptions(options) {
|
|
521
522
|
if (!options) return undefined;
|
|
522
523
|
return {
|
|
@@ -525,10 +526,10 @@ function _translateTransactionOptions(options) {
|
|
|
525
526
|
};
|
|
526
527
|
}
|
|
527
528
|
|
|
528
|
-
var _dec$
|
|
529
|
-
let ServiceDb = (_dec$
|
|
529
|
+
var _dec$n, _dec2$n, _class$n;
|
|
530
|
+
let ServiceDb = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
530
531
|
module: "a-orm"
|
|
531
|
-
}), _dec$
|
|
532
|
+
}), _dec$n(_class$n = _dec2$n(_class$n = class ServiceDb extends BeanBase {
|
|
532
533
|
constructor(...args) {
|
|
533
534
|
super(...args);
|
|
534
535
|
this._client = void 0;
|
|
@@ -583,12 +584,12 @@ let ServiceDb = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
583
584
|
compensate(cb) {
|
|
584
585
|
return this.transaction.compensate(cb);
|
|
585
586
|
}
|
|
586
|
-
}) || _class$
|
|
587
|
+
}) || _class$n) || _class$n);
|
|
587
588
|
|
|
588
|
-
var _dec$
|
|
589
|
-
let ServiceDatabaseClient = (_dec$
|
|
589
|
+
var _dec$m, _dec2$m, _class$m;
|
|
590
|
+
let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
590
591
|
module: "a-orm"
|
|
591
|
-
}), _dec$
|
|
592
|
+
}), _dec$m(_class$m = _dec2$m(_class$m = class ServiceDatabaseClient extends BeanBase {
|
|
592
593
|
constructor(...args) {
|
|
593
594
|
super(...args);
|
|
594
595
|
this.level = void 0;
|
|
@@ -694,12 +695,12 @@ let ServiceDatabaseClient = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
|
694
695
|
// reload
|
|
695
696
|
await this.reload(config);
|
|
696
697
|
}
|
|
697
|
-
}) || _class$
|
|
698
|
+
}) || _class$m) || _class$m);
|
|
698
699
|
|
|
699
|
-
var _dec$
|
|
700
|
-
let BeanDatabase = (_dec$
|
|
700
|
+
var _dec$l, _dec2$l, _class$l;
|
|
701
|
+
let BeanDatabase = (_dec$l = Bean(), _dec2$l = BeanInfo({
|
|
701
702
|
module: "a-orm"
|
|
702
|
-
}), _dec$
|
|
703
|
+
}), _dec$l(_class$l = _dec2$l(_class$l = class BeanDatabase extends BeanBase {
|
|
703
704
|
get current() {
|
|
704
705
|
return this.bean._getBean(ServiceDatabaseAsyncLocalStorage).current;
|
|
705
706
|
}
|
|
@@ -729,12 +730,12 @@ let BeanDatabase = (_dec$k = Bean(), _dec2$k = BeanInfo({
|
|
|
729
730
|
return this.bean._getBean(ServiceTransactionAsyncLocalStorage).run(fn);
|
|
730
731
|
});
|
|
731
732
|
}
|
|
732
|
-
}) || _class$
|
|
733
|
+
}) || _class$l) || _class$l);
|
|
733
734
|
|
|
734
|
-
var _dec$
|
|
735
|
-
let BeanDatabaseDialectBase = (_dec$
|
|
735
|
+
var _dec$k, _dec2$k, _dec3$7, _class$k;
|
|
736
|
+
let BeanDatabaseDialectBase = (_dec$k = Bean(), _dec2$k = Virtual(), _dec3$7 = BeanInfo({
|
|
736
737
|
module: "a-orm"
|
|
737
|
-
}), _dec$
|
|
738
|
+
}), _dec$k(_class$k = _dec2$k(_class$k = _dec3$7(_class$k = class BeanDatabaseDialectBase extends BeanBase {
|
|
738
739
|
getConfigBase() {
|
|
739
740
|
return undefined;
|
|
740
741
|
}
|
|
@@ -750,7 +751,7 @@ let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = B
|
|
|
750
751
|
async fetchIndexes(_schemaBuilder, _tableName) {
|
|
751
752
|
throw new Error('Not Implemented');
|
|
752
753
|
}
|
|
753
|
-
async insert(_builder) {
|
|
754
|
+
async insert(_builder, _datas) {
|
|
754
755
|
throw new Error('Not Implemented');
|
|
755
756
|
}
|
|
756
757
|
query(_result) {
|
|
@@ -794,7 +795,7 @@ let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = B
|
|
|
794
795
|
_columnTypePrefixes(type, prefixes) {
|
|
795
796
|
return prefixes.some(prefix => type.includes(prefix));
|
|
796
797
|
}
|
|
797
|
-
}) || _class$
|
|
798
|
+
}) || _class$k) || _class$k) || _class$k);
|
|
798
799
|
|
|
799
800
|
const OpAggrs = ['count', 'sum', 'avg', 'max', 'min'];
|
|
800
801
|
const OpJoint = {
|
|
@@ -807,6 +808,8 @@ const OpJoint = {
|
|
|
807
808
|
const OpNormal = {
|
|
808
809
|
eq: '_eq_',
|
|
809
810
|
notEq: '_notEq_',
|
|
811
|
+
eqI: '_eqI_',
|
|
812
|
+
notEqI: '_notEqI_',
|
|
810
813
|
gt: '_gt_',
|
|
811
814
|
gte: '_gte_',
|
|
812
815
|
lt: '_lt_',
|
|
@@ -1018,10 +1021,23 @@ function _buildWhereColumn(having, knex, builder, column, value, op) {
|
|
|
1018
1021
|
}
|
|
1019
1022
|
function _buildWhereColumnOpNormal(having, knex, builder, column, value, op) {
|
|
1020
1023
|
column = _checkHavingColumn(knex, column);
|
|
1024
|
+
if (_shouldPatchLike(knex)) {
|
|
1025
|
+
if (op === Op.startsWith) op = Op.startsWithI;
|
|
1026
|
+
if (op === Op.endsWith) op = Op.endsWithI;
|
|
1027
|
+
if (op === Op.includes) op = Op.includesI;
|
|
1028
|
+
if (op === Op.eqI) op = Op.eq;
|
|
1029
|
+
if (op === Op.notEqI) op = Op.notEq;
|
|
1030
|
+
}
|
|
1021
1031
|
if (op === Op.eq) {
|
|
1022
1032
|
builder[having ? 'having' : 'where'](column, '=', value);
|
|
1023
1033
|
} else if (op === Op.notEq) {
|
|
1024
1034
|
builder[having ? 'having' : 'where'](column, '<>', value);
|
|
1035
|
+
} else if (op === Op.eqI) {
|
|
1036
|
+
builder[having ? 'havingILike' : 'whereILike'](column, value);
|
|
1037
|
+
} else if (op === Op.notEqI) {
|
|
1038
|
+
builder[having ? 'havingNot' : 'whereNot'](builder => {
|
|
1039
|
+
builder[having ? 'havingILike' : 'whereILike'](column, value);
|
|
1040
|
+
});
|
|
1025
1041
|
} else if (op === Op.gt) {
|
|
1026
1042
|
builder[having ? 'having' : 'where'](column, '>', value);
|
|
1027
1043
|
} else if (op === Op.gte) {
|
|
@@ -1058,6 +1074,13 @@ function _buildWhereColumnOpNormal(having, knex, builder, column, value, op) {
|
|
|
1058
1074
|
builder[having ? 'having' : 'where'](column, '=', knex.ref(value));
|
|
1059
1075
|
}
|
|
1060
1076
|
}
|
|
1077
|
+
function _shouldPatchLike(knex) {
|
|
1078
|
+
const dialectName = _getDialectName(knex);
|
|
1079
|
+
return dialectName === 'mysql' || dialectName === 'mysql2';
|
|
1080
|
+
}
|
|
1081
|
+
function _getDialectName(knex) {
|
|
1082
|
+
return knex.client.config.client;
|
|
1083
|
+
}
|
|
1061
1084
|
function _checkHavingColumn(knex, column) {
|
|
1062
1085
|
let [aggr, name] = cast(column).split('_');
|
|
1063
1086
|
if (!OpAggrs.includes(aggr) || !name) return column;
|
|
@@ -1131,7 +1154,8 @@ function $tableComments(classEntity) {
|
|
|
1131
1154
|
const comments = {};
|
|
1132
1155
|
for (const key in rules) {
|
|
1133
1156
|
const rule = rules[key];
|
|
1134
|
-
const
|
|
1157
|
+
const metadata = ZodMetadata.getOpenapiMetadata(rule);
|
|
1158
|
+
const comment = metadata?.description || metadata?.title;
|
|
1135
1159
|
comments[key] = comment ? app.meta.text(comment) : '';
|
|
1136
1160
|
}
|
|
1137
1161
|
// table comment
|
|
@@ -1177,66 +1201,69 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1177
1201
|
});
|
|
1178
1202
|
}
|
|
1179
1203
|
|
|
1180
|
-
var _dec$
|
|
1181
|
-
|
|
1204
|
+
var _dec$j, _dec2$j, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _dec7$1, _class$j, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1205
|
+
const app$1 = useApp();
|
|
1206
|
+
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1207
|
+
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1208
|
+
let DtoQueryBase = (_dec$j = Api.field(v.optional(), v.array(String, {
|
|
1182
1209
|
separator: ','
|
|
1183
|
-
})), _dec2$
|
|
1210
|
+
})), _dec2$j = 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 = Api.field(v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec7$1 = Reflect.metadata("design:type", Object), _class$j = class DtoQueryBase {
|
|
1184
1211
|
constructor() {
|
|
1185
1212
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1186
1213
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
1187
1214
|
_initializerDefineProperty(this, "orders", _descriptor3$1, this);
|
|
1188
1215
|
}
|
|
1189
|
-
}, _descriptor$4 = _applyDecoratedDescriptor(_class$
|
|
1216
|
+
}, _descriptor$4 = _applyDecoratedDescriptor(_class$j.prototype, "columns", [_dec$j, _dec2$j], {
|
|
1190
1217
|
configurable: true,
|
|
1191
1218
|
enumerable: true,
|
|
1192
1219
|
writable: true,
|
|
1193
1220
|
initializer: null
|
|
1194
|
-
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$
|
|
1221
|
+
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$j.prototype, "where", [_dec3$6, _dec4$4], {
|
|
1195
1222
|
configurable: true,
|
|
1196
1223
|
enumerable: true,
|
|
1197
1224
|
writable: true,
|
|
1198
1225
|
initializer: null
|
|
1199
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$
|
|
1226
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$j.prototype, "orders", [_dec5$1, _dec6$1, _dec7$1], {
|
|
1200
1227
|
configurable: true,
|
|
1201
1228
|
enumerable: true,
|
|
1202
1229
|
writable: true,
|
|
1203
1230
|
initializer: null
|
|
1204
|
-
}), _class$
|
|
1231
|
+
}), _class$j);
|
|
1205
1232
|
|
|
1206
|
-
var _dec$
|
|
1233
|
+
var _dec$i, _dec2$i, _dec3$5, _dec4$3, _class$i, _descriptor$3, _descriptor2$1;
|
|
1207
1234
|
const app = useApp();
|
|
1208
1235
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
1209
1236
|
const pageSizeDefault = ormConfig?.rest?.query?.pageSize?.default ?? 20;
|
|
1210
1237
|
const pageSizeMax = ormConfig?.rest?.query?.pageSize?.max ?? 100;
|
|
1211
|
-
let DtoQueryPageBase = (_dec$
|
|
1238
|
+
let DtoQueryPageBase = (_dec$i = Api.field(z.number().min(1).default(1)), _dec2$i = 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$i = class DtoQueryPageBase extends DtoQueryBase {
|
|
1212
1239
|
constructor(...args) {
|
|
1213
1240
|
super(...args);
|
|
1214
1241
|
_initializerDefineProperty(this, "pageNo", _descriptor$3, this);
|
|
1215
1242
|
_initializerDefineProperty(this, "pageSize", _descriptor2$1, this);
|
|
1216
1243
|
}
|
|
1217
|
-
}, _descriptor$3 = _applyDecoratedDescriptor(_class$
|
|
1244
|
+
}, _descriptor$3 = _applyDecoratedDescriptor(_class$i.prototype, "pageNo", [_dec$i, _dec2$i], {
|
|
1218
1245
|
configurable: true,
|
|
1219
1246
|
enumerable: true,
|
|
1220
1247
|
writable: true,
|
|
1221
1248
|
initializer: null
|
|
1222
|
-
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$
|
|
1249
|
+
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$i.prototype, "pageSize", [_dec3$5, _dec4$3], {
|
|
1223
1250
|
configurable: true,
|
|
1224
1251
|
enumerable: true,
|
|
1225
1252
|
writable: true,
|
|
1226
1253
|
initializer: null
|
|
1227
|
-
}), _class$
|
|
1254
|
+
}), _class$i);
|
|
1228
1255
|
|
|
1229
1256
|
const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
1230
1257
|
|
|
1231
1258
|
class EntityBaseEmpty {}
|
|
1232
1259
|
|
|
1233
|
-
var _dec$
|
|
1234
|
-
let EntityBaseInner = (_dec$
|
|
1260
|
+
var _dec$h, _dec2$h, _dec3$4, _dec4$2, _dec5, _dec6, _dec7, _dec8, _class$h, _descriptor$2, _descriptor2, _descriptor3, _descriptor4;
|
|
1261
|
+
let EntityBaseInner = (_dec$h = Api.field(v.openapi({
|
|
1235
1262
|
title: $locale('CreatedAt'),
|
|
1236
1263
|
rest: {
|
|
1237
1264
|
order: OrderMaxBase - 2
|
|
1238
1265
|
}
|
|
1239
|
-
})), _dec2$
|
|
1266
|
+
})), _dec2$h = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec3$4 = Api.field(v.openapi({
|
|
1240
1267
|
title: $locale('UpdatedAt'),
|
|
1241
1268
|
rest: {
|
|
1242
1269
|
order: OrderMaxBase - 1
|
|
@@ -1251,7 +1278,7 @@ let EntityBaseInner = (_dec$g = Api.field(v.openapi({
|
|
|
1251
1278
|
rest: {
|
|
1252
1279
|
visible: false
|
|
1253
1280
|
}
|
|
1254
|
-
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$
|
|
1281
|
+
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$h = class EntityBaseInner extends EntityBaseEmpty {
|
|
1255
1282
|
constructor(...args) {
|
|
1256
1283
|
super(...args);
|
|
1257
1284
|
_initializerDefineProperty(this, "createdAt", _descriptor$2, this);
|
|
@@ -1259,63 +1286,63 @@ let EntityBaseInner = (_dec$g = Api.field(v.openapi({
|
|
|
1259
1286
|
_initializerDefineProperty(this, "deleted", _descriptor3, this);
|
|
1260
1287
|
_initializerDefineProperty(this, "iid", _descriptor4, this);
|
|
1261
1288
|
}
|
|
1262
|
-
}, _descriptor$2 = _applyDecoratedDescriptor(_class$
|
|
1289
|
+
}, _descriptor$2 = _applyDecoratedDescriptor(_class$h.prototype, "createdAt", [_dec$h, _dec2$h], {
|
|
1263
1290
|
configurable: true,
|
|
1264
1291
|
enumerable: true,
|
|
1265
1292
|
writable: true,
|
|
1266
1293
|
initializer: null
|
|
1267
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class$
|
|
1294
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class$h.prototype, "updatedAt", [_dec3$4, _dec4$2], {
|
|
1268
1295
|
configurable: true,
|
|
1269
1296
|
enumerable: true,
|
|
1270
1297
|
writable: true,
|
|
1271
1298
|
initializer: null
|
|
1272
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class$
|
|
1299
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class$h.prototype, "deleted", [_dec5, _dec6], {
|
|
1273
1300
|
configurable: true,
|
|
1274
1301
|
enumerable: true,
|
|
1275
1302
|
writable: true,
|
|
1276
1303
|
initializer: null
|
|
1277
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class$
|
|
1304
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class$h.prototype, "iid", [_dec7, _dec8], {
|
|
1278
1305
|
configurable: true,
|
|
1279
1306
|
enumerable: true,
|
|
1280
1307
|
writable: true,
|
|
1281
1308
|
initializer: null
|
|
1282
|
-
}), _class$
|
|
1309
|
+
}), _class$h);
|
|
1283
1310
|
|
|
1284
|
-
var _dec$
|
|
1285
|
-
let EntityBase = (_dec$
|
|
1311
|
+
var _dec$g, _dec2$g, _class$g, _descriptor$1;
|
|
1312
|
+
let EntityBase = (_dec$g = Api.field(v.openapi({
|
|
1286
1313
|
title: $locale('TableIdentity'),
|
|
1287
1314
|
rest: {
|
|
1288
1315
|
order: OrderCoreBase + 1
|
|
1289
1316
|
}
|
|
1290
|
-
}), v.tableIdentity()), _dec2$
|
|
1317
|
+
}), v.tableIdentity()), _dec2$g = Reflect.metadata("design:type", typeof TableIdentity === "undefined" ? Object : TableIdentity), _class$g = class EntityBase extends EntityBaseInner {
|
|
1291
1318
|
constructor(...args) {
|
|
1292
1319
|
super(...args);
|
|
1293
1320
|
_initializerDefineProperty(this, "id", _descriptor$1, this);
|
|
1294
1321
|
}
|
|
1295
|
-
}, _descriptor$1 = _applyDecoratedDescriptor(_class$
|
|
1322
|
+
}, _descriptor$1 = _applyDecoratedDescriptor(_class$g.prototype, "id", [_dec$g, _dec2$g], {
|
|
1296
1323
|
configurable: true,
|
|
1297
1324
|
enumerable: true,
|
|
1298
1325
|
writable: true,
|
|
1299
1326
|
initializer: null
|
|
1300
|
-
}), _class$
|
|
1327
|
+
}), _class$g);
|
|
1301
1328
|
|
|
1302
|
-
var _dec$
|
|
1303
|
-
let EntityBaseSimple = (_dec$
|
|
1329
|
+
var _dec$f, _dec2$f, _class$f, _descriptor;
|
|
1330
|
+
let EntityBaseSimple = (_dec$f = Api.field(v.openapi({
|
|
1304
1331
|
title: $locale('TableIdentity'),
|
|
1305
1332
|
rest: {
|
|
1306
1333
|
order: OrderCoreBase + 1
|
|
1307
1334
|
}
|
|
1308
|
-
})), _dec2$
|
|
1335
|
+
})), _dec2$f = Reflect.metadata("design:type", Number), _class$f = class EntityBaseSimple extends EntityBaseInner {
|
|
1309
1336
|
constructor(...args) {
|
|
1310
1337
|
super(...args);
|
|
1311
1338
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
1312
1339
|
}
|
|
1313
|
-
}, _descriptor = _applyDecoratedDescriptor(_class$
|
|
1340
|
+
}, _descriptor = _applyDecoratedDescriptor(_class$f.prototype, "id", [_dec$f, _dec2$f], {
|
|
1314
1341
|
configurable: true,
|
|
1315
1342
|
enumerable: true,
|
|
1316
1343
|
writable: true,
|
|
1317
1344
|
initializer: null
|
|
1318
|
-
}), _class$
|
|
1345
|
+
}), _class$f);
|
|
1319
1346
|
|
|
1320
1347
|
const SymbolKeyEntity = Symbol('$entity');
|
|
1321
1348
|
const SymbolKeyEntityMeta = Symbol('$entityMeta');
|
|
@@ -2003,12 +2030,10 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
2003
2030
|
}
|
|
2004
2031
|
// builder
|
|
2005
2032
|
const builder = this.builder(table);
|
|
2006
|
-
//
|
|
2007
|
-
builder.
|
|
2008
|
-
// debug
|
|
2009
|
-
this.$loggerChild('model').debug('model.insert: %s', builder.toQuery());
|
|
2033
|
+
// // debug
|
|
2034
|
+
// this.$loggerChild('model').debug('model.insert: %s', builder.toQuery());
|
|
2010
2035
|
// dialect insert
|
|
2011
|
-
const ids = await this.dialect.insert(builder);
|
|
2036
|
+
const ids = await this.dialect.insert(builder, datas);
|
|
2012
2037
|
// combine
|
|
2013
2038
|
const result = [];
|
|
2014
2039
|
const dataDefault = await this.defaultData(table);
|
|
@@ -2109,10 +2134,10 @@ class BeanModelCrudTable extends BeanModelCrudInner {
|
|
|
2109
2134
|
}
|
|
2110
2135
|
}
|
|
2111
2136
|
|
|
2112
|
-
var _dec$
|
|
2113
|
-
let BeanModel = (_dec$
|
|
2137
|
+
var _dec$e, _dec2$e, _dec3$3, _class$e;
|
|
2138
|
+
let BeanModel = (_dec$e = Bean(), _dec2$e = Virtual(), _dec3$3 = BeanInfo({
|
|
2114
2139
|
module: "a-orm"
|
|
2115
|
-
}), _dec$
|
|
2140
|
+
}), _dec$e(_class$e = _dec2$e(_class$e = _dec3$3(_class$e = class BeanModel extends BeanModelCrudTable {}) || _class$e) || _class$e) || _class$e);
|
|
2116
2141
|
|
|
2117
2142
|
const SymbolCacheOptions = Symbol('SymbolCacheOptions');
|
|
2118
2143
|
const SymbolCacheEnabled = Symbol('SymbolCacheEnabled');
|
|
@@ -2187,10 +2212,10 @@ class ModelCacheBase extends BeanBase {
|
|
|
2187
2212
|
}
|
|
2188
2213
|
}
|
|
2189
2214
|
|
|
2190
|
-
var _dec$
|
|
2191
|
-
let ServiceCacheEntity = (_dec$
|
|
2215
|
+
var _dec$d, _dec2$d, _class$d;
|
|
2216
|
+
let ServiceCacheEntity = (_dec$d = Service(), _dec2$d = BeanInfo({
|
|
2192
2217
|
module: "a-orm"
|
|
2193
|
-
}), _dec$
|
|
2218
|
+
}), _dec$d(_class$d = _dec2$d(_class$d = class ServiceCacheEntity extends ModelCacheBase {
|
|
2194
2219
|
__init__(model) {
|
|
2195
2220
|
super.__init__(model, 'entity');
|
|
2196
2221
|
}
|
|
@@ -2213,12 +2238,12 @@ let ServiceCacheEntity = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
|
2213
2238
|
get keysAux() {
|
|
2214
2239
|
return this._model.options.cache?.keysAux;
|
|
2215
2240
|
}
|
|
2216
|
-
}) || _class$
|
|
2241
|
+
}) || _class$d) || _class$d);
|
|
2217
2242
|
|
|
2218
|
-
var _dec$
|
|
2219
|
-
let ServiceCacheQuery = (_dec$
|
|
2243
|
+
var _dec$c, _dec2$c, _class$c;
|
|
2244
|
+
let ServiceCacheQuery = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
2220
2245
|
module: "a-orm"
|
|
2221
|
-
}), _dec$
|
|
2246
|
+
}), _dec$c(_class$c = _dec2$c(_class$c = class ServiceCacheQuery extends ModelCacheBase {
|
|
2222
2247
|
__init__(model) {
|
|
2223
2248
|
super.__init__(model, 'query');
|
|
2224
2249
|
}
|
|
@@ -2228,12 +2253,12 @@ let ServiceCacheQuery = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2228
2253
|
const cache = this.getInstance(table);
|
|
2229
2254
|
await cache.clear();
|
|
2230
2255
|
}
|
|
2231
|
-
}) || _class$
|
|
2256
|
+
}) || _class$c) || _class$c);
|
|
2232
2257
|
|
|
2233
|
-
var _dec$
|
|
2234
|
-
let ServiceRelations = (_dec$
|
|
2258
|
+
var _dec$b, _dec2$b, _class$b;
|
|
2259
|
+
let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
2235
2260
|
module: "a-orm"
|
|
2236
|
-
}), _dec$
|
|
2261
|
+
}), _dec$b(_class$b = _dec2$b(_class$b = class ServiceRelations extends BeanBase {
|
|
2237
2262
|
constructor(...args) {
|
|
2238
2263
|
super(...args);
|
|
2239
2264
|
this._model = void 0;
|
|
@@ -2729,7 +2754,7 @@ let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
|
2729
2754
|
if (!columns) return [columns, true];
|
|
2730
2755
|
columns = Array.isArray(columns) ? columns : [columns];
|
|
2731
2756
|
if (columns.includes('*') || columns.includes(key)) return [columns, true];
|
|
2732
|
-
columns.
|
|
2757
|
+
columns = columns.concat(key);
|
|
2733
2758
|
return [columns, false];
|
|
2734
2759
|
}
|
|
2735
2760
|
__getModelTarget(modelClassTarget, meta) {
|
|
@@ -2774,7 +2799,7 @@ let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
|
2774
2799
|
}
|
|
2775
2800
|
return relations;
|
|
2776
2801
|
}
|
|
2777
|
-
}) || _class$
|
|
2802
|
+
}) || _class$b) || _class$b);
|
|
2778
2803
|
|
|
2779
2804
|
class BeanModelCrud extends BeanModelCrudInner {
|
|
2780
2805
|
async mget(ids, options) {
|
|
@@ -3244,17 +3269,73 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3244
3269
|
return data2;
|
|
3245
3270
|
}
|
|
3246
3271
|
async cacheEntityDel(id, table) {
|
|
3272
|
+
await this.cacheEntityDelInner(id, table);
|
|
3273
|
+
if (this.db.inTransaction) {
|
|
3274
|
+
this.db.commit(async () => {
|
|
3275
|
+
await this.cacheEntityDelInner(id, table);
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
this._shardingCacheDoubleDelete({
|
|
3279
|
+
beanFullName: this.$beanFullName,
|
|
3280
|
+
clientName: this.db.clientName,
|
|
3281
|
+
table: this.getTable(),
|
|
3282
|
+
method: 'cacheEntityDelInner',
|
|
3283
|
+
args: [id, table]
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
async cacheEntityDelInner(id, table) {
|
|
3247
3287
|
await this.cacheEntity.del(id, table);
|
|
3248
|
-
await this.
|
|
3288
|
+
await this.cacheQueryClearInner(table);
|
|
3249
3289
|
}
|
|
3250
3290
|
async cacheEntityClear(table) {
|
|
3291
|
+
await this.cacheEntityClearInner(table);
|
|
3292
|
+
if (this.db.inTransaction) {
|
|
3293
|
+
this.db.commit(async () => {
|
|
3294
|
+
await this.cacheEntityClearInner(table);
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
this._shardingCacheDoubleDelete({
|
|
3298
|
+
beanFullName: this.$beanFullName,
|
|
3299
|
+
clientName: this.db.clientName,
|
|
3300
|
+
table: this.getTable(),
|
|
3301
|
+
method: 'cacheEntityClearInner',
|
|
3302
|
+
args: [table]
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
async cacheEntityClearInner(table) {
|
|
3251
3306
|
await this.cacheEntity.clear(table);
|
|
3252
|
-
await this.
|
|
3307
|
+
await this.cacheQueryClearInner(table);
|
|
3253
3308
|
}
|
|
3254
3309
|
async cacheQueryClear(table) {
|
|
3310
|
+
await this.cacheQueryClearInner(table);
|
|
3311
|
+
if (this.db.inTransaction) {
|
|
3312
|
+
this.db.commit(async () => {
|
|
3313
|
+
await this.cacheQueryClearInner(table);
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
this._shardingCacheDoubleDelete({
|
|
3317
|
+
beanFullName: this.$beanFullName,
|
|
3318
|
+
clientName: this.db.clientName,
|
|
3319
|
+
table: this.getTable(),
|
|
3320
|
+
method: 'cacheQueryClearInner',
|
|
3321
|
+
args: [table]
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
async cacheQueryClearInner(table) {
|
|
3255
3325
|
await this.cacheQuery.clear(table);
|
|
3256
3326
|
await this._cacheQueryClearModelsClear();
|
|
3257
3327
|
}
|
|
3328
|
+
_shardingCacheDoubleDelete(jobData) {
|
|
3329
|
+
const doubleDelete = this.scopeOrm.config.sharding.cache.doubleDelete;
|
|
3330
|
+
if (!doubleDelete) return;
|
|
3331
|
+
if (this.db.inTransaction) {
|
|
3332
|
+
this.db.commit(() => {
|
|
3333
|
+
this.scopeOrm.queue.doubleDelete.push(jobData);
|
|
3334
|
+
});
|
|
3335
|
+
} else {
|
|
3336
|
+
this.scopeOrm.queue.doubleDelete.push(jobData);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3258
3339
|
async _cacheQueryClearModelsClear() {
|
|
3259
3340
|
const modelsClear = this._getModelsClear();
|
|
3260
3341
|
if (!modelsClear || modelsClear.length === 0) return;
|
|
@@ -3264,7 +3345,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3264
3345
|
if (modelsClearedByFn) {
|
|
3265
3346
|
await modelsClearedByFn(this.ctx, modelTarget, this);
|
|
3266
3347
|
} else {
|
|
3267
|
-
await modelTarget.
|
|
3348
|
+
await modelTarget.cacheQueryClearInner();
|
|
3268
3349
|
}
|
|
3269
3350
|
}
|
|
3270
3351
|
}
|
|
@@ -3340,16 +3421,16 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3340
3421
|
}
|
|
3341
3422
|
}
|
|
3342
3423
|
|
|
3343
|
-
var _dec$
|
|
3344
|
-
let BeanModelBase = (_dec$
|
|
3424
|
+
var _dec$a, _dec2$a, _dec3$2, _class$a;
|
|
3425
|
+
let BeanModelBase = (_dec$a = Bean(), _dec2$a = Virtual(), _dec3$2 = BeanInfo({
|
|
3345
3426
|
module: "a-orm"
|
|
3346
|
-
}), _dec$
|
|
3427
|
+
}), _dec$a(_class$a = _dec2$a(_class$a = _dec3$2(_class$a = class BeanModelBase extends BeanModelCache {}) || _class$a) || _class$a) || _class$a);
|
|
3347
3428
|
|
|
3348
|
-
var _dec$
|
|
3429
|
+
var _dec$9, _dec2$9, _dec3$1, _dec4$1, _class$9;
|
|
3349
3430
|
const SymbolModuleScope$1 = Symbol('SymbolModuleScope');
|
|
3350
|
-
let ServiceEntityResolver = (_dec$
|
|
3431
|
+
let ServiceEntityResolver = (_dec$9 = Service(), _dec2$9 = BeanInfo({
|
|
3351
3432
|
module: "a-orm"
|
|
3352
|
-
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3433
|
+
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$9(_class$9 = _dec2$9(_class$9 = _dec3$1(_class$9 = _dec4$1(_class$9 = class ServiceEntityResolver extends BeanBase {
|
|
3353
3434
|
constructor(moduleScope) {
|
|
3354
3435
|
super();
|
|
3355
3436
|
this[SymbolModuleScope$1] = void 0;
|
|
@@ -3364,13 +3445,13 @@ let ServiceEntityResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
|
3364
3445
|
}
|
|
3365
3446
|
return this.__instances[prop];
|
|
3366
3447
|
}
|
|
3367
|
-
}) || _class$
|
|
3448
|
+
}) || _class$9) || _class$9) || _class$9) || _class$9);
|
|
3368
3449
|
|
|
3369
|
-
var _dec$
|
|
3450
|
+
var _dec$8, _dec2$8, _dec3, _dec4, _class$8;
|
|
3370
3451
|
const SymbolModuleScope = Symbol('SymbolModuleScope');
|
|
3371
|
-
let ServiceModelResolver = (_dec$
|
|
3452
|
+
let ServiceModelResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
3372
3453
|
module: "a-orm"
|
|
3373
|
-
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3454
|
+
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$8(_class$8 = _dec2$8(_class$8 = _dec3(_class$8 = _dec4(_class$8 = class ServiceModelResolver extends BeanBase {
|
|
3374
3455
|
constructor(moduleScope) {
|
|
3375
3456
|
super();
|
|
3376
3457
|
this[SymbolModuleScope] = void 0;
|
|
@@ -3380,12 +3461,12 @@ let ServiceModelResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
3380
3461
|
const beanFullName = `${this[SymbolModuleScope]}.model.${prop}`;
|
|
3381
3462
|
return this.bean._getBean(beanFullName);
|
|
3382
3463
|
}
|
|
3383
|
-
}) || _class$
|
|
3464
|
+
}) || _class$8) || _class$8) || _class$8) || _class$8);
|
|
3384
3465
|
|
|
3385
|
-
var _dec$
|
|
3386
|
-
let BroadcastColumnsClear = (_dec$
|
|
3466
|
+
var _dec$7, _dec2$7, _class$7;
|
|
3467
|
+
let BroadcastColumnsClear = (_dec$7 = Broadcast(), _dec2$7 = BeanInfo({
|
|
3387
3468
|
module: "a-orm"
|
|
3388
|
-
}), _dec$
|
|
3469
|
+
}), _dec$7(_class$7 = _dec2$7(_class$7 = class BroadcastColumnsClear extends BeanBroadcastBase {
|
|
3389
3470
|
async execute(data, isEmitter) {
|
|
3390
3471
|
const {
|
|
3391
3472
|
clientName,
|
|
@@ -3395,12 +3476,12 @@ let BroadcastColumnsClear = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
|
3395
3476
|
await cast(this.scope.service.database).__columnsClearRaw(clientName, tableName);
|
|
3396
3477
|
}
|
|
3397
3478
|
}
|
|
3398
|
-
}) || _class$
|
|
3479
|
+
}) || _class$7) || _class$7);
|
|
3399
3480
|
|
|
3400
|
-
var _dec$
|
|
3401
|
-
let BroadcastDatabaseClientReload = (_dec$
|
|
3481
|
+
var _dec$6, _dec2$6, _class$6;
|
|
3482
|
+
let BroadcastDatabaseClientReload = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
3402
3483
|
module: "a-orm"
|
|
3403
|
-
}), _dec$
|
|
3484
|
+
}), _dec$6(_class$6 = _dec2$6(_class$6 = class BroadcastDatabaseClientReload extends BeanBroadcastBase {
|
|
3404
3485
|
async execute(data, isEmitter) {
|
|
3405
3486
|
const {
|
|
3406
3487
|
clientName,
|
|
@@ -3411,22 +3492,38 @@ let BroadcastDatabaseClientReload = (_dec$5 = Broadcast(), _dec2$5 = BeanInfo({
|
|
|
3411
3492
|
await cast(this.scope.service.database).__reloadAllClientsRaw(clientName, clientConfig, extraData);
|
|
3412
3493
|
}
|
|
3413
3494
|
}
|
|
3414
|
-
}) || _class$
|
|
3495
|
+
}) || _class$6) || _class$6);
|
|
3496
|
+
|
|
3497
|
+
var _dec$5, _dec2$5, _class$5;
|
|
3498
|
+
let EventClientNameReal = (_dec$5 = Event(), _dec2$5 = BeanInfo({
|
|
3499
|
+
module: "a-orm"
|
|
3500
|
+
}), _dec$5(_class$5 = _dec2$5(_class$5 = class EventClientNameReal extends BeanEventBase {}) || _class$5) || _class$5);
|
|
3415
3501
|
|
|
3416
3502
|
var _dec$4, _dec2$4, _class$4;
|
|
3417
|
-
let
|
|
3503
|
+
let EventColumnsClear = (_dec$4 = Event(), _dec2$4 = BeanInfo({
|
|
3418
3504
|
module: "a-orm"
|
|
3419
|
-
}), _dec$4(_class$4 = _dec2$4(_class$4 = class
|
|
3505
|
+
}), _dec$4(_class$4 = _dec2$4(_class$4 = class EventColumnsClear extends BeanEventBase {}) || _class$4) || _class$4);
|
|
3420
3506
|
|
|
3421
3507
|
var _dec$3, _dec2$3, _class$3;
|
|
3422
|
-
let
|
|
3508
|
+
let EventDatabaseClientReload = (_dec$3 = Event(), _dec2$3 = BeanInfo({
|
|
3423
3509
|
module: "a-orm"
|
|
3424
|
-
}), _dec$3(_class$3 = _dec2$3(_class$3 = class
|
|
3510
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class EventDatabaseClientReload extends BeanEventBase {}) || _class$3) || _class$3);
|
|
3425
3511
|
|
|
3426
3512
|
var _dec$2, _dec2$2, _class$2;
|
|
3427
|
-
let
|
|
3513
|
+
let QueueDoubleDelete = (_dec$2 = Queue({
|
|
3514
|
+
options: {
|
|
3515
|
+
job: {
|
|
3516
|
+
delay: 3 * 1000
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}), _dec2$2 = BeanInfo({
|
|
3428
3520
|
module: "a-orm"
|
|
3429
|
-
}), _dec$2(_class$2 = _dec2$2(_class$2 = class
|
|
3521
|
+
}), _dec$2(_class$2 = _dec2$2(_class$2 = class QueueDoubleDelete extends BeanQueueBase {
|
|
3522
|
+
async execute(data, _options) {
|
|
3523
|
+
const beanInstance = this.app.bean._newBean(data.beanFullName, data.clientName, data.table);
|
|
3524
|
+
await beanInstance[data.method](...data.args);
|
|
3525
|
+
}
|
|
3526
|
+
}) || _class$2) || _class$2);
|
|
3430
3527
|
|
|
3431
3528
|
var _dec$1, _dec2$1, _class$1;
|
|
3432
3529
|
let ScheduleSoftDeletionPrune = (_dec$1 = Schedule({
|
|
@@ -3470,11 +3567,19 @@ let ScheduleSoftDeletionPrune = (_dec$1 = Schedule({
|
|
|
3470
3567
|
|
|
3471
3568
|
function config(_app) {
|
|
3472
3569
|
return {
|
|
3570
|
+
sharding: {
|
|
3571
|
+
cache: {
|
|
3572
|
+
doubleDelete: false
|
|
3573
|
+
}
|
|
3574
|
+
},
|
|
3473
3575
|
rest: {
|
|
3474
3576
|
query: {
|
|
3475
3577
|
pageSize: {
|
|
3476
3578
|
default: 20,
|
|
3477
3579
|
max: 100
|
|
3580
|
+
},
|
|
3581
|
+
orders: {
|
|
3582
|
+
default: 'createdAt,desc'
|
|
3478
3583
|
}
|
|
3479
3584
|
}
|
|
3480
3585
|
},
|
|
@@ -3647,11 +3752,11 @@ class Main extends BeanSimple {
|
|
|
3647
3752
|
};
|
|
3648
3753
|
}
|
|
3649
3754
|
});
|
|
3650
|
-
Object.defineProperty(this.app.context, '
|
|
3755
|
+
Object.defineProperty(this.app.context, 'commitsDone', {
|
|
3651
3756
|
enumerable: false,
|
|
3652
3757
|
get() {
|
|
3653
3758
|
return function () {
|
|
3654
|
-
cast(this).transactionConsistency.
|
|
3759
|
+
return cast(this).transactionConsistency.commitsDone();
|
|
3655
3760
|
};
|
|
3656
3761
|
}
|
|
3657
3762
|
});
|
|
@@ -4241,4 +4346,4 @@ const $relationMutate = {
|
|
|
4241
4346
|
belongsToMany
|
|
4242
4347
|
};
|
|
4243
4348
|
|
|
4244
|
-
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, BroadcastDatabaseClientReload, Database, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, Errors, EventClientNameReal, EventColumnsClear, EventDatabaseClientReload, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, Main, Model, Op, OpAggrs, OpJoint, OpJointValues, OpNormal, OpNormalValues, OpValues, 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, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName, isAggrColumn, isRaw, isRef, locales, prepareClassModel, prepareColumns };
|
|
4349
|
+
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, BroadcastDatabaseClientReload, Database, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, Errors, EventClientNameReal, EventColumnsClear, EventDatabaseClientReload, 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, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName, isAggrColumn, isRaw, isRef, locales, prepareClassModel, prepareColumns };
|
|
@@ -5,6 +5,6 @@ export declare class ServiceTransactionConsistency extends BeanBase {
|
|
|
5
5
|
private _compensateCallbacks;
|
|
6
6
|
commit(cb: FunctionAny): void;
|
|
7
7
|
compensate(cb: FunctionAny): void;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
commitsDone(): Promise<void>;
|
|
9
|
+
compensatesDone(): Promise<void>;
|
|
10
10
|
}
|
package/dist/types/database.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare const OpJoint: {
|
|
|
10
10
|
export declare const OpNormal: {
|
|
11
11
|
readonly eq: "_eq_";
|
|
12
12
|
readonly notEq: "_notEq_";
|
|
13
|
+
readonly eqI: "_eqI_";
|
|
14
|
+
readonly notEqI: "_notEqI_";
|
|
13
15
|
readonly gt: "_gt_";
|
|
14
16
|
readonly gte: "_gte_";
|
|
15
17
|
readonly lt: "_lt_";
|
|
@@ -31,6 +33,8 @@ export declare const OpNormal: {
|
|
|
31
33
|
export declare const Op: {
|
|
32
34
|
readonly eq: "_eq_";
|
|
33
35
|
readonly notEq: "_notEq_";
|
|
36
|
+
readonly eqI: "_eqI_";
|
|
37
|
+
readonly notEqI: "_notEqI_";
|
|
34
38
|
readonly gt: "_gt_";
|
|
35
39
|
readonly gte: "_gte_";
|
|
36
40
|
readonly lt: "_lt_";
|
|
@@ -56,8 +60,8 @@ export declare const Op: {
|
|
|
56
60
|
readonly skip: "_skip_";
|
|
57
61
|
};
|
|
58
62
|
export declare const OpJointValues: ("_and_" | "_or_" | "_not_" | "_exists_" | "_notExists_")[];
|
|
59
|
-
export declare const OpNormalValues: ("_eq_" | "_notEq_" | "_gt_" | "_gte_" | "_lt_" | "_lte_" | "_in_" | "_notIn_" | "_is_" | "_isNot_" | "_between_" | "_notBetween_" | "_startsWith_" | "_endsWith_" | "_includes_" | "_startsWithI_" | "_endsWithI_" | "_includesI_" | "_ref_")[];
|
|
60
|
-
export declare const OpValues: ("
|
|
63
|
+
export declare const OpNormalValues: ("_eq_" | "_notEq_" | "_eqI_" | "_notEqI_" | "_gt_" | "_gte_" | "_lt_" | "_lte_" | "_in_" | "_notIn_" | "_is_" | "_isNot_" | "_between_" | "_notBetween_" | "_startsWith_" | "_endsWith_" | "_includes_" | "_startsWithI_" | "_endsWithI_" | "_includesI_" | "_ref_")[];
|
|
64
|
+
export declare const OpValues: ("_and_" | "_or_" | "_not_" | "_exists_" | "_notExists_" | "_skip_" | "_eq_" | "_notEq_" | "_eqI_" | "_notEqI_" | "_gt_" | "_gte_" | "_lt_" | "_lte_" | "_in_" | "_notIn_" | "_is_" | "_isNot_" | "_between_" | "_notBetween_" | "_startsWith_" | "_endsWith_" | "_includes_" | "_startsWithI_" | "_endsWithI_" | "_includesI_" | "_ref_")[];
|
|
61
65
|
export type TypeOpsJointPostfix<Op> = {
|
|
62
66
|
[KEY in keyof Op]: Op[KEY] | (KEY extends string ? `_${KEY}_${number}` : never);
|
|
63
67
|
};
|
|
@@ -5,7 +5,7 @@ export interface IDecoratorDatabaseDialectOptions {
|
|
|
5
5
|
}
|
|
6
6
|
declare module 'vona-module-a-onion' {
|
|
7
7
|
interface BeanOnion {
|
|
8
|
-
databaseDialect: ServiceOnion<
|
|
8
|
+
databaseDialect: ServiceOnion<IDatabaseDialectRecord>;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
declare module 'vona' {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OmitNever } from 'vona';
|
|
2
2
|
import type { ServiceOnion } from 'vona-module-a-onion';
|
|
3
3
|
import type { TypeOpenapiMetadata } from 'vona-module-a-openapi';
|
|
4
|
+
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
4
5
|
import type { SymbolKeyFieldsMore } from '../entity.ts';
|
|
5
6
|
import type { ITableRecord } from './table.ts';
|
|
6
7
|
export interface IEntityRecord {
|
|
@@ -10,10 +11,11 @@ export interface IDecoratorEntityOptions<FieldsMore = never> {
|
|
|
10
11
|
table?: keyof ITableRecord;
|
|
11
12
|
independent?: boolean;
|
|
12
13
|
openapi?: TypeOpenapiMetadata;
|
|
14
|
+
pipes?: SchemaLike | SchemaLike[];
|
|
13
15
|
}
|
|
14
16
|
declare module 'vona-module-a-onion' {
|
|
15
17
|
interface BeanOnion {
|
|
16
|
-
entity: ServiceOnion<
|
|
18
|
+
entity: ServiceOnion<IEntityRecord>;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
declare module 'vona' {
|
|
@@ -42,7 +42,7 @@ export interface IDecoratorModelOptions<TRecord extends EntityBaseEmpty = any> {
|
|
|
42
42
|
}
|
|
43
43
|
declare module 'vona-module-a-onion' {
|
|
44
44
|
interface BeanOnion {
|
|
45
|
-
model: ServiceOnion<
|
|
45
|
+
model: ServiceOnion<IModelRecord>;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
declare module 'vona' {
|