vona-module-a-orm 5.0.93 → 5.0.95
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 +8 -0
- package/dist/.metadata/locales.d.ts +1 -1
- package/dist/bean/hmr.entity.d.ts +6 -0
- package/dist/index.js +200 -288
- package/package.json +1 -1
|
@@ -192,14 +192,22 @@ declare module 'vona-module-a-orm' {
|
|
|
192
192
|
}
|
|
193
193
|
/** schedule: end */
|
|
194
194
|
/** hmr: begin */
|
|
195
|
+
export * from '../bean/hmr.entity.ts';
|
|
195
196
|
export * from '../bean/hmr.model.ts';
|
|
196
197
|
import 'vona';
|
|
197
198
|
declare module 'vona' {
|
|
198
199
|
interface IHmrRecord {
|
|
200
|
+
'a-orm:entity': never;
|
|
199
201
|
'a-orm:model': never;
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
declare module 'vona-module-a-orm' {
|
|
205
|
+
interface HmrEntity {
|
|
206
|
+
}
|
|
207
|
+
interface HmrEntity {
|
|
208
|
+
get $beanFullName(): 'a-orm.hmr.entity';
|
|
209
|
+
get $onionName(): 'a-orm:entity';
|
|
210
|
+
}
|
|
203
211
|
interface HmrModel {
|
|
204
212
|
}
|
|
205
213
|
interface HmrModel {
|
|
@@ -17,4 +17,4 @@ export declare const locales: {
|
|
|
17
17
|
ShouldSpecifyTable: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): import("vona").ILocaleMagic<`a-orm::${K}`>;
|
|
20
|
+
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K, ...args: any[]): import("vona").ILocaleMagic<`a-orm::${K}`>;
|
|
@@ -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 HmrEntity extends BeanBase implements IHmrReload {
|
|
5
|
+
reload(_beanOptions: IDecoratorBeanOptionsBase): Promise<void>;
|
|
6
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BeanInfo, BeanAopMethodBase, BeanBase, deepExtend, appResource, beanFullNameFromOnionName, Virtual, cast, useApp, $makeLocaleMagic, disposeInstance, BeanSimple, combineConfigDefault, BeanScopeBase, createBeanDecorator, PickClassInner, $Class } from 'vona';
|
|
3
|
+
import { __decorate, __metadata } from 'tslib';
|
|
3
4
|
import { AopMethod } from 'vona-module-a-aspect';
|
|
4
5
|
import { Service, Bean, Scope } from 'vona-module-a-bean';
|
|
5
6
|
import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';
|
|
@@ -20,21 +21,18 @@ import { configAll, configRedis } from 'vona-module-a-summer';
|
|
|
20
21
|
import { ServiceDatabaseAsyncLocalStorage as ServiceDatabaseAsyncLocalStorage$1, ServiceTransactionConsistency as ServiceTransactionConsistency_ } from 'vona-module-a-orm';
|
|
21
22
|
import { mutate } from 'mutate-on-copy';
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
let AopMethodTransaction = (_dec$w = AopMethod(), _dec2$w = BeanInfo({
|
|
25
|
-
module: "a-orm"
|
|
26
|
-
}), _dec$w(_class$w = _dec2$w(_class$w = class AopMethodTransaction extends BeanAopMethodBase {
|
|
24
|
+
let AopMethodTransaction = class AopMethodTransaction extends BeanAopMethodBase {
|
|
27
25
|
execute(options, _args, next, _receiver, _prop) {
|
|
28
26
|
return this.bean.database.current.transaction.begin(() => {
|
|
29
27
|
return next();
|
|
30
28
|
}, options);
|
|
31
29
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _dec$v, _dec2$v, _class$v;
|
|
35
|
-
let ServiceDatabaseAsyncLocalStorage = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
30
|
+
};
|
|
31
|
+
AopMethodTransaction = __decorate([AopMethod(), BeanInfo({
|
|
36
32
|
module: "a-orm"
|
|
37
|
-
}),
|
|
33
|
+
})], AopMethodTransaction);
|
|
34
|
+
|
|
35
|
+
let ServiceDatabaseAsyncLocalStorage = class ServiceDatabaseAsyncLocalStorage extends BeanBase {
|
|
38
36
|
constructor(...args) {
|
|
39
37
|
super(...args);
|
|
40
38
|
this.dbStorage = void 0;
|
|
@@ -53,14 +51,14 @@ let ServiceDatabaseAsyncLocalStorage = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
|
53
51
|
return fn();
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
|
-
}
|
|
54
|
+
};
|
|
55
|
+
ServiceDatabaseAsyncLocalStorage = __decorate([Service(), BeanInfo({
|
|
56
|
+
module: "a-orm"
|
|
57
|
+
})], ServiceDatabaseAsyncLocalStorage);
|
|
57
58
|
|
|
58
|
-
var _dec$u, _dec2$u, _class$u;
|
|
59
59
|
const SymbolColumnsCache = Symbol('SymbolColumnsCache');
|
|
60
60
|
const SymbolColumnsDefaultCache = Symbol('SymbolColumnsDefaultCache');
|
|
61
|
-
let ServiceColumnsCache =
|
|
62
|
-
module: "a-orm"
|
|
63
|
-
}), _dec$u(_class$u = _dec2$u(_class$u = class ServiceColumnsCache extends BeanBase {
|
|
61
|
+
let ServiceColumnsCache = class ServiceColumnsCache extends BeanBase {
|
|
64
62
|
constructor(...args) {
|
|
65
63
|
super(...args);
|
|
66
64
|
this.clientName = void 0;
|
|
@@ -115,12 +113,12 @@ let ServiceColumnsCache = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
|
115
113
|
return exists;
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var _dec$t, _dec2$t, _class$t;
|
|
121
|
-
let ServiceColumns = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
116
|
+
};
|
|
117
|
+
ServiceColumnsCache = __decorate([Service(), BeanInfo({
|
|
122
118
|
module: "a-orm"
|
|
123
|
-
}),
|
|
119
|
+
})], ServiceColumnsCache);
|
|
120
|
+
|
|
121
|
+
let ServiceColumns = class ServiceColumns extends BeanBase {
|
|
124
122
|
constructor(...args) {
|
|
125
123
|
super(...args);
|
|
126
124
|
this._db = void 0;
|
|
@@ -171,7 +169,10 @@ let ServiceColumns = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
171
169
|
columnsClear(tableName) {
|
|
172
170
|
return this.scope.service.database.columnsClear(this.db.clientName, tableName);
|
|
173
171
|
}
|
|
174
|
-
}
|
|
172
|
+
};
|
|
173
|
+
ServiceColumns = __decorate([Service(), BeanInfo({
|
|
174
|
+
module: "a-orm"
|
|
175
|
+
})], ServiceColumns);
|
|
175
176
|
|
|
176
177
|
const TransactionIsolationLevelsMap = {
|
|
177
178
|
DEFAULT: undefined,
|
|
@@ -182,12 +183,7 @@ const TransactionIsolationLevelsMap = {
|
|
|
182
183
|
SNAPSHOT: 'snapshot'
|
|
183
184
|
};
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var _dec$s, _dec2$s, _class$s;
|
|
188
|
-
let ServiceDatabase = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
189
|
-
module: "a-orm"
|
|
190
|
-
}), _dec$s(_class$s = _dec2$s(_class$s = class ServiceDatabase extends BeanBase {
|
|
186
|
+
let ServiceDatabase = class ServiceDatabase extends BeanBase {
|
|
191
187
|
get configDatabase() {
|
|
192
188
|
return this.app.config.database;
|
|
193
189
|
}
|
|
@@ -306,12 +302,12 @@ let ServiceDatabase = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
|
306
302
|
});
|
|
307
303
|
this.columnsClear(clientName);
|
|
308
304
|
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
var _dec$r, _dec2$r, _class$r;
|
|
312
|
-
let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
305
|
+
};
|
|
306
|
+
ServiceDatabase = __decorate([Service(), BeanInfo({
|
|
313
307
|
module: "a-orm"
|
|
314
|
-
}),
|
|
308
|
+
})], ServiceDatabase);
|
|
309
|
+
|
|
310
|
+
let ServiceTransactionConsistency = class ServiceTransactionConsistency extends BeanBase {
|
|
315
311
|
constructor(...args) {
|
|
316
312
|
super(...args);
|
|
317
313
|
this._commitCallbacks = [];
|
|
@@ -339,12 +335,12 @@ let ServiceTransactionConsistency = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
339
335
|
}
|
|
340
336
|
this._commitCallbacks = [];
|
|
341
337
|
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
var _dec$q, _dec2$q, _class$q;
|
|
345
|
-
let ServiceTransactionFiber = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
338
|
+
};
|
|
339
|
+
ServiceTransactionConsistency = __decorate([Service(), BeanInfo({
|
|
346
340
|
module: "a-orm"
|
|
347
|
-
}),
|
|
341
|
+
})], ServiceTransactionConsistency);
|
|
342
|
+
|
|
343
|
+
let ServiceTransactionFiber = class ServiceTransactionFiber extends BeanBase {
|
|
348
344
|
constructor(...args) {
|
|
349
345
|
super(...args);
|
|
350
346
|
this._connection = void 0;
|
|
@@ -373,12 +369,12 @@ let ServiceTransactionFiber = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
|
373
369
|
await this._transactionConsistency.compensatesDone();
|
|
374
370
|
this._connection = undefined;
|
|
375
371
|
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
var _dec$p, _dec2$p, _class$p;
|
|
379
|
-
let ServiceTransactionState = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
372
|
+
};
|
|
373
|
+
ServiceTransactionFiber = __decorate([Service(), BeanInfo({
|
|
380
374
|
module: "a-orm"
|
|
381
|
-
}),
|
|
375
|
+
})], ServiceTransactionFiber);
|
|
376
|
+
|
|
377
|
+
let ServiceTransactionState = class ServiceTransactionState extends BeanBase {
|
|
382
378
|
constructor(...args) {
|
|
383
379
|
super(...args);
|
|
384
380
|
this._fibers = {};
|
|
@@ -400,12 +396,12 @@ let ServiceTransactionState = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
|
400
396
|
const selector = this.serviceDatabase.prepareClientNameSelector(db.info, db.dialect);
|
|
401
397
|
delete this._fibers[selector];
|
|
402
398
|
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
var _dec$o, _dec2$o, _class$o;
|
|
406
|
-
let ServiceTransactionAsyncLocalStorage = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
399
|
+
};
|
|
400
|
+
ServiceTransactionState = __decorate([Service(), BeanInfo({
|
|
407
401
|
module: "a-orm"
|
|
408
|
-
}),
|
|
402
|
+
})], ServiceTransactionState);
|
|
403
|
+
|
|
404
|
+
let ServiceTransactionAsyncLocalStorage = class ServiceTransactionAsyncLocalStorage extends BeanBase {
|
|
409
405
|
constructor(...args) {
|
|
410
406
|
super(...args);
|
|
411
407
|
this.transactionStorage = void 0;
|
|
@@ -426,12 +422,12 @@ let ServiceTransactionAsyncLocalStorage = (_dec$o = Service(), _dec2$o = BeanInf
|
|
|
426
422
|
return fn();
|
|
427
423
|
});
|
|
428
424
|
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
var _dec$n, _dec2$n, _class$n;
|
|
432
|
-
let ServiceTransaction = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
425
|
+
};
|
|
426
|
+
ServiceTransactionAsyncLocalStorage = __decorate([Service(), BeanInfo({
|
|
433
427
|
module: "a-orm"
|
|
434
|
-
}),
|
|
428
|
+
})], ServiceTransactionAsyncLocalStorage);
|
|
429
|
+
|
|
430
|
+
let ServiceTransaction = class ServiceTransaction extends BeanBase {
|
|
435
431
|
constructor(...args) {
|
|
436
432
|
super(...args);
|
|
437
433
|
this._db = void 0;
|
|
@@ -550,7 +546,10 @@ let ServiceTransaction = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
|
550
546
|
}
|
|
551
547
|
return res;
|
|
552
548
|
}
|
|
553
|
-
}
|
|
549
|
+
};
|
|
550
|
+
ServiceTransaction = __decorate([Service(), BeanInfo({
|
|
551
|
+
module: "a-orm"
|
|
552
|
+
})], ServiceTransaction);
|
|
554
553
|
function _translateTransactionOptions(options) {
|
|
555
554
|
if (!options) return undefined;
|
|
556
555
|
return {
|
|
@@ -559,10 +558,7 @@ function _translateTransactionOptions(options) {
|
|
|
559
558
|
};
|
|
560
559
|
}
|
|
561
560
|
|
|
562
|
-
|
|
563
|
-
let ServiceDb = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
564
|
-
module: "a-orm"
|
|
565
|
-
}), _dec$m(_class$m = _dec2$m(_class$m = class ServiceDb extends BeanBase {
|
|
561
|
+
let ServiceDb = class ServiceDb extends BeanBase {
|
|
566
562
|
constructor(...args) {
|
|
567
563
|
super(...args);
|
|
568
564
|
this._client = void 0;
|
|
@@ -617,12 +613,12 @@ let ServiceDb = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
617
613
|
compensate(cb) {
|
|
618
614
|
return this.transaction.compensate(cb);
|
|
619
615
|
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
var _dec$l, _dec2$l, _class$l;
|
|
623
|
-
let ServiceDatabaseClient = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
616
|
+
};
|
|
617
|
+
ServiceDb = __decorate([Service(), BeanInfo({
|
|
624
618
|
module: "a-orm"
|
|
625
|
-
}),
|
|
619
|
+
})], ServiceDb);
|
|
620
|
+
|
|
621
|
+
let ServiceDatabaseClient = class ServiceDatabaseClient extends BeanMutateBase {
|
|
626
622
|
constructor(...args) {
|
|
627
623
|
super(...args);
|
|
628
624
|
this.level = void 0;
|
|
@@ -709,7 +705,6 @@ let ServiceDatabaseClient = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
|
709
705
|
}
|
|
710
706
|
return result;
|
|
711
707
|
}
|
|
712
|
-
|
|
713
708
|
// only used by startup, so no consider that workers broadcast
|
|
714
709
|
async changeConfigConnectionAndReloadWorker(databaseName) {
|
|
715
710
|
// set databaseName
|
|
@@ -724,12 +719,12 @@ let ServiceDatabaseClient = (_dec$l = Service(), _dec2$l = BeanInfo({
|
|
|
724
719
|
await this.scope.service.database.reloadClientsWorker(this.clientName, config);
|
|
725
720
|
// await this.scope.service.database.reloadClients(this.clientName, config);
|
|
726
721
|
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
var _dec$k, _dec2$k, _class$k;
|
|
730
|
-
let BeanDatabase = (_dec$k = Bean(), _dec2$k = BeanInfo({
|
|
722
|
+
};
|
|
723
|
+
ServiceDatabaseClient = __decorate([Service(), BeanInfo({
|
|
731
724
|
module: "a-orm"
|
|
732
|
-
}),
|
|
725
|
+
})], ServiceDatabaseClient);
|
|
726
|
+
|
|
727
|
+
let BeanDatabase = class BeanDatabase extends BeanBase {
|
|
733
728
|
get current() {
|
|
734
729
|
return this.bean._getBean(ServiceDatabaseAsyncLocalStorage).current;
|
|
735
730
|
}
|
|
@@ -769,12 +764,12 @@ let BeanDatabase = (_dec$k = Bean(), _dec2$k = BeanInfo({
|
|
|
769
764
|
return this.bean._getBean(ServiceTransactionAsyncLocalStorage).run(fn);
|
|
770
765
|
});
|
|
771
766
|
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
var _dec$j, _dec2$j, _dec3$7, _class$j;
|
|
775
|
-
let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = BeanInfo({
|
|
767
|
+
};
|
|
768
|
+
BeanDatabase = __decorate([Bean(), BeanInfo({
|
|
776
769
|
module: "a-orm"
|
|
777
|
-
}),
|
|
770
|
+
})], BeanDatabase);
|
|
771
|
+
|
|
772
|
+
let BeanDatabaseDialectBase = class BeanDatabaseDialectBase extends BeanBase {
|
|
778
773
|
constructor(...args) {
|
|
779
774
|
super(...args);
|
|
780
775
|
this._capabilities = void 0;
|
|
@@ -882,7 +877,6 @@ let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = B
|
|
|
882
877
|
// others
|
|
883
878
|
return value;
|
|
884
879
|
}
|
|
885
|
-
|
|
886
880
|
// pg: nextval
|
|
887
881
|
_safeNumber(value) {
|
|
888
882
|
const num = Number(value);
|
|
@@ -891,7 +885,10 @@ let BeanDatabaseDialectBase = (_dec$j = Bean(), _dec2$j = Virtual(), _dec3$7 = B
|
|
|
891
885
|
_columnTypePrefixes(type, prefixes) {
|
|
892
886
|
return prefixes.some(prefix => type.includes(prefix));
|
|
893
887
|
}
|
|
894
|
-
}
|
|
888
|
+
};
|
|
889
|
+
BeanDatabaseDialectBase = __decorate([Bean(), Virtual(), BeanInfo({
|
|
890
|
+
module: "a-orm"
|
|
891
|
+
})], BeanDatabaseDialectBase);
|
|
895
892
|
|
|
896
893
|
const OpAggrs = ['count', 'sum', 'avg', 'max', 'min'];
|
|
897
894
|
const OpJoint = {
|
|
@@ -933,14 +930,6 @@ const OpJointValues = Object.values(OpJoint);
|
|
|
933
930
|
const OpNormalValues = Object.values(OpNormal);
|
|
934
931
|
const OpValues = Object.values(Op);
|
|
935
932
|
|
|
936
|
-
// not use TypeOpsJointPostfix, which cause type not take affect for table.field
|
|
937
|
-
// export type TypeOpsJoint = TypeRecordValues<TypeOpsJointPostfix<Pick<typeof Op, 'and' | 'or' | 'not' | 'exists' | 'notExists'>>>;
|
|
938
|
-
|
|
939
|
-
// not use Knex.Raw
|
|
940
|
-
|
|
941
|
-
// not use Knex.Raw
|
|
942
|
-
// Columns extends {} ? TypeModelWhereInner<Columns> | Knex.Raw : TypeModelWhereInner<TRecord> | Knex.Raw;
|
|
943
|
-
|
|
944
933
|
function isRaw(raw) {
|
|
945
934
|
return typeof raw?.constructor === 'function' && raw?.constructor?.name === 'Raw';
|
|
946
935
|
}
|
|
@@ -974,7 +963,6 @@ function getClassEntityFromClassModel(modelClass) {
|
|
|
974
963
|
const options = beanOptions.options;
|
|
975
964
|
return options.entity;
|
|
976
965
|
}
|
|
977
|
-
|
|
978
966
|
// export function formatValue(value) {
|
|
979
967
|
// if (typeof value !== 'object' || value instanceof Date) return value;
|
|
980
968
|
// // date
|
|
@@ -991,7 +979,6 @@ function getClassEntityFromClassModel(modelClass) {
|
|
|
991
979
|
// // others
|
|
992
980
|
// return value.val;
|
|
993
981
|
// }
|
|
994
|
-
|
|
995
982
|
// export function formatValueArray(value) {
|
|
996
983
|
// if (!value.val) return null;
|
|
997
984
|
// const arr = typeof value.val === 'string' ? value.val.split(',') : value.val;
|
|
@@ -1190,74 +1177,35 @@ function _safeColumn(column) {
|
|
|
1190
1177
|
return column.replace(/[\\.#%'"`;,() ]/g, '');
|
|
1191
1178
|
}
|
|
1192
1179
|
|
|
1193
|
-
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
1194
|
-
var a = {};
|
|
1195
|
-
return Object.keys(n).forEach(function (i) {
|
|
1196
|
-
a[i] = n[i];
|
|
1197
|
-
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
|
|
1198
|
-
return n(i, e, r) || r;
|
|
1199
|
-
}, a), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
1200
|
-
}
|
|
1201
|
-
function _initializerDefineProperty(e, i, r, l) {
|
|
1202
|
-
r && Object.defineProperty(e, i, {
|
|
1203
|
-
enumerable: r.enumerable,
|
|
1204
|
-
configurable: r.configurable,
|
|
1205
|
-
writable: r.writable,
|
|
1206
|
-
value: r.initializer ? r.initializer.call(l) : void 0
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
var _dec$i, _dec2$i, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _class$i, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1211
1180
|
const app$1 = useApp();
|
|
1212
1181
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1213
1182
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1214
|
-
|
|
1215
|
-
separator: ','
|
|
1216
|
-
})), _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 {
|
|
1183
|
+
class DtoQueryBase {
|
|
1217
1184
|
constructor() {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
configurable: true,
|
|
1229
|
-
enumerable: true,
|
|
1230
|
-
writable: true,
|
|
1231
|
-
initializer: null
|
|
1232
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$i.prototype, "orders", [_dec5$1, _dec6$1], {
|
|
1233
|
-
configurable: true,
|
|
1234
|
-
enumerable: true,
|
|
1235
|
-
writable: true,
|
|
1236
|
-
initializer: null
|
|
1237
|
-
}), _class$i);
|
|
1185
|
+
this.columns = void 0;
|
|
1186
|
+
this.where = void 0;
|
|
1187
|
+
this.orders = void 0;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
__decorate([Api.field(v.optional(), v.array(String, {
|
|
1191
|
+
separator: ','
|
|
1192
|
+
})), __metadata("design:type", Array)], DtoQueryBase.prototype, "columns", void 0);
|
|
1193
|
+
__decorate([Api.field(v.optional(), z.looseObject({})), __metadata("design:type", Object)], DtoQueryBase.prototype, "where", void 0);
|
|
1194
|
+
__decorate([Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), __metadata("design:type", Object)], DtoQueryBase.prototype, "orders", void 0);
|
|
1238
1195
|
|
|
1239
|
-
var _dec$h, _dec2$h, _dec3$5, _dec4$3, _class$h, _descriptor$3, _descriptor2$1;
|
|
1240
1196
|
const app = useApp();
|
|
1241
1197
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
1242
1198
|
const pageSizeDefault = ormConfig?.rest?.query?.pageSize?.default ?? 20;
|
|
1243
1199
|
const pageSizeMax = ormConfig?.rest?.query?.pageSize?.max ?? 100;
|
|
1244
|
-
|
|
1200
|
+
class DtoQueryPageBase extends DtoQueryBase {
|
|
1245
1201
|
constructor(...args) {
|
|
1246
1202
|
super(...args);
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
writable: true,
|
|
1254
|
-
initializer: null
|
|
1255
|
-
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$h.prototype, "pageSize", [_dec3$5, _dec4$3], {
|
|
1256
|
-
configurable: true,
|
|
1257
|
-
enumerable: true,
|
|
1258
|
-
writable: true,
|
|
1259
|
-
initializer: null
|
|
1260
|
-
}), _class$h);
|
|
1203
|
+
this.pageNo = void 0;
|
|
1204
|
+
this.pageSize = void 0;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
__decorate([Api.field(z.number().min(1).default(1)), __metadata("design:type", Number)], DtoQueryPageBase.prototype, "pageNo", void 0);
|
|
1208
|
+
__decorate([Api.field(z.number().min(1).max(pageSizeMax).default(pageSizeDefault)), __metadata("design:type", Number)], DtoQueryPageBase.prototype, "pageSize", void 0);
|
|
1261
1209
|
|
|
1262
1210
|
const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
1263
1211
|
|
|
@@ -1283,105 +1231,76 @@ const locales = {
|
|
|
1283
1231
|
'en-us': locale_en_us,
|
|
1284
1232
|
'zh-cn': locale_zh_cn
|
|
1285
1233
|
};
|
|
1286
|
-
function $locale(key) {
|
|
1287
|
-
return $makeLocaleMagic(`a-orm::${key}
|
|
1234
|
+
function $locale(key, ...args) {
|
|
1235
|
+
return $makeLocaleMagic(`a-orm::${key}`, ...args);
|
|
1288
1236
|
}
|
|
1289
1237
|
|
|
1290
1238
|
class EntityBaseEmpty {}
|
|
1291
1239
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1240
|
+
class EntityBaseInner extends EntityBaseEmpty {
|
|
1241
|
+
constructor(...args) {
|
|
1242
|
+
super(...args);
|
|
1243
|
+
this.createdAt = void 0;
|
|
1244
|
+
this.updatedAt = void 0;
|
|
1245
|
+
this.deleted = void 0;
|
|
1246
|
+
this.iid = void 0;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
__decorate([Api.field(v.openapi({
|
|
1294
1250
|
title: $locale('CreatedAt'),
|
|
1295
1251
|
rest: {
|
|
1296
1252
|
order: OrderMaxBase - 2
|
|
1297
1253
|
}
|
|
1298
|
-
})),
|
|
1254
|
+
})), __metadata("design:type", Date)], EntityBaseInner.prototype, "createdAt", void 0);
|
|
1255
|
+
__decorate([Api.field(v.openapi({
|
|
1299
1256
|
title: $locale('UpdatedAt'),
|
|
1300
1257
|
rest: {
|
|
1301
1258
|
order: OrderMaxBase - 1
|
|
1302
1259
|
}
|
|
1303
|
-
})),
|
|
1260
|
+
})), __metadata("design:type", Date)], EntityBaseInner.prototype, "updatedAt", void 0);
|
|
1261
|
+
__decorate([Api.field(v.openapi({
|
|
1304
1262
|
title: $locale('Deleted'),
|
|
1305
1263
|
rest: {
|
|
1306
1264
|
visible: false
|
|
1307
1265
|
}
|
|
1308
|
-
}), v.default(false)),
|
|
1266
|
+
}), v.default(false)), __metadata("design:type", Boolean)], EntityBaseInner.prototype, "deleted", void 0);
|
|
1267
|
+
__decorate([Api.field(v.openapi({
|
|
1309
1268
|
title: $locale('InstanceId'),
|
|
1310
1269
|
rest: {
|
|
1311
1270
|
visible: false
|
|
1312
1271
|
}
|
|
1313
|
-
}), v.default(0)),
|
|
1272
|
+
}), v.default(0)), __metadata("design:type", Number)], EntityBaseInner.prototype, "iid", void 0);
|
|
1273
|
+
|
|
1274
|
+
class EntityBase extends EntityBaseInner {
|
|
1314
1275
|
constructor(...args) {
|
|
1315
1276
|
super(...args);
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
}
|
|
1321
|
-
}, _descriptor$2 = _applyDecoratedDescriptor(_class$g.prototype, "createdAt", [_dec$g, _dec2$g], {
|
|
1322
|
-
configurable: true,
|
|
1323
|
-
enumerable: true,
|
|
1324
|
-
writable: true,
|
|
1325
|
-
initializer: null
|
|
1326
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class$g.prototype, "updatedAt", [_dec3$4, _dec4$2], {
|
|
1327
|
-
configurable: true,
|
|
1328
|
-
enumerable: true,
|
|
1329
|
-
writable: true,
|
|
1330
|
-
initializer: null
|
|
1331
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class$g.prototype, "deleted", [_dec5, _dec6], {
|
|
1332
|
-
configurable: true,
|
|
1333
|
-
enumerable: true,
|
|
1334
|
-
writable: true,
|
|
1335
|
-
initializer: null
|
|
1336
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class$g.prototype, "iid", [_dec7, _dec8], {
|
|
1337
|
-
configurable: true,
|
|
1338
|
-
enumerable: true,
|
|
1339
|
-
writable: true,
|
|
1340
|
-
initializer: null
|
|
1341
|
-
}), _class$g);
|
|
1342
|
-
|
|
1343
|
-
var _dec$f, _dec2$f, _class$f, _descriptor$1;
|
|
1344
|
-
let EntityBase = (_dec$f = Api.field(v.openapi({
|
|
1277
|
+
this.id = void 0;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
__decorate([Api.field(v.openapi({
|
|
1345
1281
|
title: $locale('TableIdentity'),
|
|
1346
1282
|
rest: {
|
|
1347
1283
|
order: OrderCoreBase + 1
|
|
1348
1284
|
}
|
|
1349
|
-
}), v.tableIdentity()),
|
|
1285
|
+
}), v.tableIdentity()), __metadata("design:type", Object)], EntityBase.prototype, "id", void 0);
|
|
1286
|
+
|
|
1287
|
+
class EntityBaseSimple extends EntityBaseInner {
|
|
1350
1288
|
constructor(...args) {
|
|
1351
1289
|
super(...args);
|
|
1352
|
-
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
enumerable: true,
|
|
1357
|
-
writable: true,
|
|
1358
|
-
initializer: null
|
|
1359
|
-
}), _class$f);
|
|
1360
|
-
|
|
1361
|
-
var _dec$e, _dec2$e, _class$e, _descriptor;
|
|
1362
|
-
let EntityBaseSimple = (_dec$e = Api.field(v.openapi({
|
|
1290
|
+
this.id = void 0;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
__decorate([Api.field(v.openapi({
|
|
1363
1294
|
title: $locale('TableIdentity'),
|
|
1364
1295
|
rest: {
|
|
1365
1296
|
order: OrderCoreBase + 1
|
|
1366
1297
|
}
|
|
1367
|
-
})),
|
|
1368
|
-
constructor(...args) {
|
|
1369
|
-
super(...args);
|
|
1370
|
-
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
1371
|
-
}
|
|
1372
|
-
}, _descriptor = _applyDecoratedDescriptor(_class$e.prototype, "id", [_dec$e, _dec2$e], {
|
|
1373
|
-
configurable: true,
|
|
1374
|
-
enumerable: true,
|
|
1375
|
-
writable: true,
|
|
1376
|
-
initializer: null
|
|
1377
|
-
}), _class$e);
|
|
1298
|
+
})), __metadata("design:type", Number)], EntityBaseSimple.prototype, "id", void 0);
|
|
1378
1299
|
|
|
1379
1300
|
const SymbolKeyEntity = Symbol('$entity');
|
|
1380
1301
|
const SymbolKeyEntityMeta = Symbol('$entityMeta');
|
|
1381
1302
|
const SymbolKeyModelOptions = Symbol('$modelOptions');
|
|
1382
1303
|
|
|
1383
|
-
// not use Groups extends string |string[]
|
|
1384
|
-
|
|
1385
1304
|
const SymbolModelDb = Symbol('SymbolModelDb');
|
|
1386
1305
|
const SymbolModelTable = Symbol('SymbolModelTable');
|
|
1387
1306
|
class BeanModelMeta extends BeanBase {
|
|
@@ -1588,11 +1507,9 @@ class BeanModelUtils extends BeanModelMeta {
|
|
|
1588
1507
|
const parts = Array.isArray(name) ? name : name.split(',');
|
|
1589
1508
|
return this.raw(parts.map(_ => '??').join(','), parts);
|
|
1590
1509
|
}
|
|
1591
|
-
|
|
1592
1510
|
// checkWhere(where: TypeModelWhere<TRecord>) {
|
|
1593
1511
|
// return checkWhere(where);
|
|
1594
1512
|
// }
|
|
1595
|
-
|
|
1596
1513
|
buildWhere(builder, wheres) {
|
|
1597
1514
|
if (!wheres) return;
|
|
1598
1515
|
return buildWhere(this.db, builder, wheres);
|
|
@@ -1925,7 +1842,6 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
1925
1842
|
const items = await this._mget_original(table, ids, options);
|
|
1926
1843
|
return items.filter(item => !isNil(item));
|
|
1927
1844
|
}
|
|
1928
|
-
|
|
1929
1845
|
// with undefined
|
|
1930
1846
|
async _mget_original(table, ids, options) {
|
|
1931
1847
|
// table
|
|
@@ -2158,10 +2074,10 @@ class BeanModelCrudTable extends BeanModelCrudInner {
|
|
|
2158
2074
|
}
|
|
2159
2075
|
}
|
|
2160
2076
|
|
|
2161
|
-
|
|
2162
|
-
|
|
2077
|
+
let BeanModel = class BeanModel extends BeanModelCrudTable {};
|
|
2078
|
+
BeanModel = __decorate([Bean(), Virtual(), BeanInfo({
|
|
2163
2079
|
module: "a-orm"
|
|
2164
|
-
}),
|
|
2080
|
+
})], BeanModel);
|
|
2165
2081
|
|
|
2166
2082
|
const SymbolCacheModelsClear = Symbol('SymbolCacheModelsClearAll');
|
|
2167
2083
|
const SymbolCacheModelCacheInstances = Symbol('SymbolCacheModelCacheInstances');
|
|
@@ -2292,10 +2208,7 @@ class ModelCacheBase extends BeanBase {
|
|
|
2292
2208
|
}
|
|
2293
2209
|
}
|
|
2294
2210
|
|
|
2295
|
-
|
|
2296
|
-
let ServiceCacheEntity = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
2297
|
-
module: "a-orm"
|
|
2298
|
-
}), _dec$c(_class$c = _dec2$c(_class$c = class ServiceCacheEntity extends ModelCacheBase {
|
|
2211
|
+
let ServiceCacheEntity = class ServiceCacheEntity extends ModelCacheBase {
|
|
2299
2212
|
__init__(model) {
|
|
2300
2213
|
super.__init__(model, 'entity');
|
|
2301
2214
|
}
|
|
@@ -2318,12 +2231,12 @@ let ServiceCacheEntity = (_dec$c = Service(), _dec2$c = BeanInfo({
|
|
|
2318
2231
|
get keysAux() {
|
|
2319
2232
|
return this._model.options.cache?.keysAux;
|
|
2320
2233
|
}
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
var _dec$b, _dec2$b, _class$b;
|
|
2324
|
-
let ServiceCacheQuery = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
2234
|
+
};
|
|
2235
|
+
ServiceCacheEntity = __decorate([Service(), BeanInfo({
|
|
2325
2236
|
module: "a-orm"
|
|
2326
|
-
}),
|
|
2237
|
+
})], ServiceCacheEntity);
|
|
2238
|
+
|
|
2239
|
+
let ServiceCacheQuery = class ServiceCacheQuery extends ModelCacheBase {
|
|
2327
2240
|
__init__(model) {
|
|
2328
2241
|
super.__init__(model, 'query');
|
|
2329
2242
|
}
|
|
@@ -2333,7 +2246,10 @@ let ServiceCacheQuery = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2333
2246
|
const cache = this.getInstance(table);
|
|
2334
2247
|
await cache.clear();
|
|
2335
2248
|
}
|
|
2336
|
-
}
|
|
2249
|
+
};
|
|
2250
|
+
ServiceCacheQuery = __decorate([Service(), BeanInfo({
|
|
2251
|
+
module: "a-orm"
|
|
2252
|
+
})], ServiceCacheQuery);
|
|
2337
2253
|
|
|
2338
2254
|
function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
2339
2255
|
// collect
|
|
@@ -2378,10 +2294,7 @@ function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
|
2378
2294
|
return relations;
|
|
2379
2295
|
}
|
|
2380
2296
|
|
|
2381
|
-
|
|
2382
|
-
let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
2383
|
-
module: "a-orm"
|
|
2384
|
-
}), _dec$a(_class$a = _dec2$a(_class$a = class ServiceRelations extends BeanBase {
|
|
2297
|
+
let ServiceRelations = class ServiceRelations extends BeanBase {
|
|
2385
2298
|
constructor(...args) {
|
|
2386
2299
|
super(...args);
|
|
2387
2300
|
this._model = void 0;
|
|
@@ -2916,7 +2829,10 @@ let ServiceRelations = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
|
2916
2829
|
handleRelationsCollection(includeWrapper) {
|
|
2917
2830
|
return handleRelationsCollection(this._model.options.relations, includeWrapper);
|
|
2918
2831
|
}
|
|
2919
|
-
}
|
|
2832
|
+
};
|
|
2833
|
+
ServiceRelations = __decorate([Service(), BeanInfo({
|
|
2834
|
+
module: "a-orm"
|
|
2835
|
+
})], ServiceRelations);
|
|
2920
2836
|
|
|
2921
2837
|
class BeanModelCrud extends BeanModelCrudInner {
|
|
2922
2838
|
async mget(ids, options) {
|
|
@@ -3602,16 +3518,13 @@ function __parseMagicField(str) {
|
|
|
3602
3518
|
return [fieldName, op];
|
|
3603
3519
|
}
|
|
3604
3520
|
|
|
3605
|
-
|
|
3606
|
-
|
|
3521
|
+
let BeanModelBase = class BeanModelBase extends BeanModelCache {};
|
|
3522
|
+
BeanModelBase = __decorate([Bean(), Virtual(), BeanInfo({
|
|
3607
3523
|
module: "a-orm"
|
|
3608
|
-
}),
|
|
3524
|
+
})], BeanModelBase);
|
|
3609
3525
|
|
|
3610
|
-
var _dec$8, _dec2$8, _dec3$1, _dec4$1, _class$8;
|
|
3611
3526
|
const SymbolModuleScope$1 = Symbol('SymbolModuleScope');
|
|
3612
|
-
let ServiceEntityResolver =
|
|
3613
|
-
module: "a-orm"
|
|
3614
|
-
}), _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 {
|
|
3527
|
+
let ServiceEntityResolver = class ServiceEntityResolver extends BeanBase {
|
|
3615
3528
|
constructor(moduleScope) {
|
|
3616
3529
|
super();
|
|
3617
3530
|
this[SymbolModuleScope$1] = void 0;
|
|
@@ -3626,13 +3539,13 @@ let ServiceEntityResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
|
3626
3539
|
}
|
|
3627
3540
|
return this.__instances[prop];
|
|
3628
3541
|
}
|
|
3629
|
-
}
|
|
3542
|
+
};
|
|
3543
|
+
ServiceEntityResolver = __decorate([Service(), __metadata("design:paramtypes", [String]), BeanInfo({
|
|
3544
|
+
module: "a-orm"
|
|
3545
|
+
})], ServiceEntityResolver);
|
|
3630
3546
|
|
|
3631
|
-
var _dec$7, _dec2$7, _dec3, _dec4, _class$7;
|
|
3632
3547
|
const SymbolModuleScope = Symbol('SymbolModuleScope');
|
|
3633
|
-
let ServiceModelResolver =
|
|
3634
|
-
module: "a-orm"
|
|
3635
|
-
}), _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 {
|
|
3548
|
+
let ServiceModelResolver = class ServiceModelResolver extends BeanBase {
|
|
3636
3549
|
constructor(moduleScope) {
|
|
3637
3550
|
super();
|
|
3638
3551
|
this[SymbolModuleScope] = void 0;
|
|
@@ -3642,12 +3555,12 @@ let ServiceModelResolver = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
3642
3555
|
const beanFullName = `${this[SymbolModuleScope]}.model.${prop}`;
|
|
3643
3556
|
return this.bean._getBean(beanFullName);
|
|
3644
3557
|
}
|
|
3645
|
-
}
|
|
3646
|
-
|
|
3647
|
-
var _dec$6, _dec2$6, _class$6;
|
|
3648
|
-
let BroadcastColumnsClear = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
3558
|
+
};
|
|
3559
|
+
ServiceModelResolver = __decorate([Service(), __metadata("design:paramtypes", [String]), BeanInfo({
|
|
3649
3560
|
module: "a-orm"
|
|
3650
|
-
}),
|
|
3561
|
+
})], ServiceModelResolver);
|
|
3562
|
+
|
|
3563
|
+
let BroadcastColumnsClear = class BroadcastColumnsClear extends BeanBroadcastBase {
|
|
3651
3564
|
async execute(data, isEmitter) {
|
|
3652
3565
|
const {
|
|
3653
3566
|
clientName,
|
|
@@ -3657,42 +3570,38 @@ let BroadcastColumnsClear = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
|
3657
3570
|
await cast(this.scope.service.database).columnsClearWorker(clientName, tableName);
|
|
3658
3571
|
}
|
|
3659
3572
|
}
|
|
3660
|
-
}
|
|
3573
|
+
};
|
|
3574
|
+
BroadcastColumnsClear = __decorate([Broadcast(), BeanInfo({
|
|
3575
|
+
module: "a-orm"
|
|
3576
|
+
})], BroadcastColumnsClear);
|
|
3661
3577
|
|
|
3662
|
-
|
|
3663
|
-
|
|
3578
|
+
let EventClientNameReal = class EventClientNameReal extends BeanEventBase {};
|
|
3579
|
+
EventClientNameReal = __decorate([Event(), BeanInfo({
|
|
3664
3580
|
module: "a-orm"
|
|
3665
|
-
}),
|
|
3581
|
+
})], EventClientNameReal);
|
|
3666
3582
|
|
|
3667
|
-
|
|
3668
|
-
|
|
3583
|
+
let EventColumnsClear = class EventColumnsClear extends BeanEventBase {};
|
|
3584
|
+
EventColumnsClear = __decorate([Event(), BeanInfo({
|
|
3669
3585
|
module: "a-orm"
|
|
3670
|
-
}),
|
|
3586
|
+
})], EventColumnsClear);
|
|
3671
3587
|
|
|
3672
|
-
|
|
3673
|
-
|
|
3588
|
+
let QueueDoubleDelete = class QueueDoubleDelete extends BeanQueueBase {
|
|
3589
|
+
async execute(data, _options) {
|
|
3590
|
+
const beanInstance = this.app.bean._newBean(data.beanFullName, data.clientName, data.table);
|
|
3591
|
+
await beanInstance[data.method](...data.args);
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
3594
|
+
QueueDoubleDelete = __decorate([Queue({
|
|
3674
3595
|
options: {
|
|
3675
3596
|
job: {
|
|
3676
3597
|
delay: 3 * 1000
|
|
3677
3598
|
}
|
|
3678
3599
|
}
|
|
3679
|
-
}),
|
|
3600
|
+
}), BeanInfo({
|
|
3680
3601
|
module: "a-orm"
|
|
3681
|
-
}),
|
|
3682
|
-
async execute(data, _options) {
|
|
3683
|
-
const beanInstance = this.app.bean._newBean(data.beanFullName, data.clientName, data.table);
|
|
3684
|
-
await beanInstance[data.method](...data.args);
|
|
3685
|
-
}
|
|
3686
|
-
}) || _class$3) || _class$3);
|
|
3602
|
+
})], QueueDoubleDelete);
|
|
3687
3603
|
|
|
3688
|
-
|
|
3689
|
-
let ScheduleSoftDeletionPrune = (_dec$2 = Schedule({
|
|
3690
|
-
repeat: {
|
|
3691
|
-
every: 24 * 3600 * 1000
|
|
3692
|
-
}
|
|
3693
|
-
}), _dec2$2 = BeanInfo({
|
|
3694
|
-
module: "a-orm"
|
|
3695
|
-
}), _dec$2(_class$2 = _dec2$2(_class$2 = class ScheduleSoftDeletionPrune extends BeanBase {
|
|
3604
|
+
let ScheduleSoftDeletionPrune = class ScheduleSoftDeletionPrune extends BeanBase {
|
|
3696
3605
|
async execute() {
|
|
3697
3606
|
const onionSlices = this.bean.onion.model.getOnionsEnabledCached();
|
|
3698
3607
|
for (const onionSlice of onionSlices) {
|
|
@@ -3723,21 +3632,36 @@ let ScheduleSoftDeletionPrune = (_dec$2 = Schedule({
|
|
|
3723
3632
|
});
|
|
3724
3633
|
}
|
|
3725
3634
|
}
|
|
3726
|
-
}
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3635
|
+
};
|
|
3636
|
+
ScheduleSoftDeletionPrune = __decorate([Schedule({
|
|
3637
|
+
repeat: {
|
|
3638
|
+
every: 24 * 3600 * 1000
|
|
3639
|
+
}
|
|
3640
|
+
}), BeanInfo({
|
|
3641
|
+
module: "a-orm"
|
|
3642
|
+
})], ScheduleSoftDeletionPrune);
|
|
3730
3643
|
|
|
3731
|
-
let
|
|
3644
|
+
let HmrEntity = class HmrEntity extends BeanBase {
|
|
3645
|
+
async reload(_beanOptions) {
|
|
3646
|
+
this.app.bean.worker.reload();
|
|
3647
|
+
}
|
|
3648
|
+
};
|
|
3649
|
+
HmrEntity = __decorate([Hmr(), BeanInfo({
|
|
3732
3650
|
module: "a-orm"
|
|
3733
|
-
}),
|
|
3651
|
+
})], HmrEntity);
|
|
3652
|
+
|
|
3653
|
+
// import { clearAllCacheModelsClear, clearCacheModelCacheInstance } from '../lib/const.ts';
|
|
3654
|
+
let HmrModel = class HmrModel extends BeanBase {
|
|
3734
3655
|
async reload(_beanOptions) {
|
|
3735
3656
|
// more deps: dto/model
|
|
3736
3657
|
this.app.bean.worker.reload();
|
|
3737
3658
|
// clearAllCacheModelsClear(this.app);
|
|
3738
3659
|
// await clearCacheModelCacheInstance(this.app, beanOptions.beanFullName);
|
|
3739
3660
|
}
|
|
3740
|
-
}
|
|
3661
|
+
};
|
|
3662
|
+
HmrModel = __decorate([Hmr(), BeanInfo({
|
|
3663
|
+
module: "a-orm"
|
|
3664
|
+
})], HmrModel);
|
|
3741
3665
|
|
|
3742
3666
|
function config(_app) {
|
|
3743
3667
|
return {
|
|
@@ -3934,11 +3858,10 @@ async function configTest(_app) {
|
|
|
3934
3858
|
return {};
|
|
3935
3859
|
}
|
|
3936
3860
|
|
|
3937
|
-
|
|
3938
|
-
|
|
3861
|
+
let ScopeModuleAOrm = class ScopeModuleAOrm extends BeanScopeBase {};
|
|
3862
|
+
ScopeModuleAOrm = __decorate([Scope(), BeanInfo({
|
|
3939
3863
|
module: "a-orm"
|
|
3940
|
-
}),
|
|
3941
|
-
|
|
3864
|
+
})], ScopeModuleAOrm);
|
|
3942
3865
|
/** scope: end */
|
|
3943
3866
|
|
|
3944
3867
|
function DatabaseDialect(options) {
|
|
@@ -4193,7 +4116,6 @@ function DtoSelectAndCount(modelLike, params) {
|
|
|
4193
4116
|
function DtoUpdate(modelLike, params) {
|
|
4194
4117
|
return _DtoMutate_raw(modelLike, params, 'update', ['id', 'iid', 'deleted', 'createdAt', 'updatedAt'], true, undefined);
|
|
4195
4118
|
}
|
|
4196
|
-
|
|
4197
4119
|
// not use Partial/$Class.partial, for form render at frontend
|
|
4198
4120
|
|
|
4199
4121
|
const $Dto = {
|
|
@@ -4207,8 +4129,6 @@ const $Dto = {
|
|
|
4207
4129
|
selectAndCount: DtoSelectAndCount
|
|
4208
4130
|
};
|
|
4209
4131
|
|
|
4210
|
-
// const __tableNames = new Set();
|
|
4211
|
-
|
|
4212
4132
|
function Entity(table, options) {
|
|
4213
4133
|
if (typeof table === 'string') {
|
|
4214
4134
|
options = Object.assign({}, options, {
|
|
@@ -4233,7 +4153,6 @@ function Model(options) {
|
|
|
4233
4153
|
}
|
|
4234
4154
|
|
|
4235
4155
|
function hasOne$2(classModel, key, options) {
|
|
4236
|
-
// : IModelRelationHasOne<MODEL, AUTOLOAD, COLUMNS> {
|
|
4237
4156
|
return {
|
|
4238
4157
|
type: 'hasOne',
|
|
4239
4158
|
model: classModel,
|
|
@@ -4242,7 +4161,6 @@ function hasOne$2(classModel, key, options) {
|
|
|
4242
4161
|
};
|
|
4243
4162
|
}
|
|
4244
4163
|
function belongsTo$1(_classModelSelf, classModel, key, options) {
|
|
4245
|
-
// : IModelRelationBelongsTo<MODELSelf, MODEL, AUTOLOAD, COLUMNS> {
|
|
4246
4164
|
return {
|
|
4247
4165
|
type: 'belongsTo',
|
|
4248
4166
|
model: classModel,
|
|
@@ -4251,7 +4169,6 @@ function belongsTo$1(_classModelSelf, classModel, key, options) {
|
|
|
4251
4169
|
};
|
|
4252
4170
|
}
|
|
4253
4171
|
function hasMany$2(classModel, key, options, _modelJoins, _group) {
|
|
4254
|
-
// : IModelRelationHasMany<MODEL, AUTOLOAD, COLUMNS, ModelJoins> {
|
|
4255
4172
|
return {
|
|
4256
4173
|
type: 'hasMany',
|
|
4257
4174
|
model: classModel,
|
|
@@ -4260,7 +4177,6 @@ function hasMany$2(classModel, key, options, _modelJoins, _group) {
|
|
|
4260
4177
|
};
|
|
4261
4178
|
}
|
|
4262
4179
|
function belongsToMany$2(classModelMiddle, classModel, keyFrom, keyTo, options, _modelJoins, _group) {
|
|
4263
|
-
// : IModelRelationBelongsToMany<MODELMiddle, MODEL, AUTOLOAD, COLUMNS, ModelJoins> {
|
|
4264
4180
|
return {
|
|
4265
4181
|
type: 'belongsToMany',
|
|
4266
4182
|
modelMiddle: classModelMiddle,
|
|
@@ -4276,7 +4192,6 @@ const $relation = {
|
|
|
4276
4192
|
hasMany: hasMany$2,
|
|
4277
4193
|
belongsToMany: belongsToMany$2
|
|
4278
4194
|
};
|
|
4279
|
-
|
|
4280
4195
|
// function hasMany<
|
|
4281
4196
|
// MODEL extends BeanModelMeta | (keyof IModelClassRecord),
|
|
4282
4197
|
// AUTOLOAD extends boolean = boolean,
|
|
@@ -4299,7 +4214,6 @@ const $relation = {
|
|
|
4299
4214
|
// ): any { // : IModelRelationHasMany<MODEL, AUTOLOAD, COLUMNS, ModelJoins> {
|
|
4300
4215
|
// return { type: 'hasMany', model: classModel, key, options };
|
|
4301
4216
|
// }
|
|
4302
|
-
|
|
4303
4217
|
// function belongsToMany<
|
|
4304
4218
|
// MODELMiddle extends BeanModelMeta | (keyof IModelClassRecord),
|
|
4305
4219
|
// MODEL extends BeanModelMeta | (keyof IModelClassRecord),
|
|
@@ -4375,7 +4289,6 @@ function hasOne(classModel, key, options) {
|
|
|
4375
4289
|
options
|
|
4376
4290
|
};
|
|
4377
4291
|
}
|
|
4378
|
-
|
|
4379
4292
|
// function belongsTo<
|
|
4380
4293
|
// MODELSelf extends BeanModelMeta | (keyof IModelClassRecord),
|
|
4381
4294
|
// MODEL extends BeanModelMeta | (keyof IModelClassRecord),
|
|
@@ -4388,7 +4301,6 @@ function hasOne(classModel, key, options) {
|
|
|
4388
4301
|
// ): IModelRelationBelongsToDynamic<MODELSelf, MODEL, OPTIONS> {
|
|
4389
4302
|
// return { type: 'belongsTo', model: classModel, key, options };
|
|
4390
4303
|
// }
|
|
4391
|
-
|
|
4392
4304
|
function hasMany(classModel, key, options) {
|
|
4393
4305
|
return {
|
|
4394
4306
|
type: 'hasMany',
|
|
@@ -4414,4 +4326,4 @@ const $relationMutate = {
|
|
|
4414
4326
|
belongsToMany
|
|
4415
4327
|
};
|
|
4416
4328
|
|
|
4417
|
-
export { $Dto, $locale, $relation, $relationDynamic, $relationMutate, 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 };
|
|
4329
|
+
export { $Dto, $locale, $relation, $relationDynamic, $relationMutate, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, EventClientNameReal, EventColumnsClear, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, HmrEntity, 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 };
|