vona-module-a-orm 5.0.56 → 5.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.metadata/index.d.ts +21 -0
- package/dist/bean/bean.model/bean.model_meta.d.ts +5 -5
- package/dist/bean/broadcast.databaseClientDispose.d.ts +9 -0
- package/dist/bean/event.databaseClientDispose.d.ts +8 -0
- package/dist/bean/queue.doubleDelete.d.ts +1 -1
- package/dist/index.js +249 -200
- package/dist/service/database.d.ts +5 -1
- package/dist/service/databaseClient_.d.ts +2 -2
- package/dist/types/onion/model.d.ts +3 -2
- package/dist/types/relationsDef.d.ts +2 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,21 +17,21 @@ import { configAllWithIgnoreNull, configAll, configRedisWithIgnoreNull, configRe
|
|
|
17
17
|
import { ServiceDatabaseAsyncLocalStorage as ServiceDatabaseAsyncLocalStorage$1, ServiceTransactionConsistency as ServiceTransactionConsistency_ } from 'vona-module-a-orm';
|
|
18
18
|
import { mutate } from 'mutate-on-copy';
|
|
19
19
|
|
|
20
|
-
var _dec$
|
|
21
|
-
let AopMethodTransaction = (_dec$
|
|
20
|
+
var _dec$z, _dec2$z, _class$z;
|
|
21
|
+
let AopMethodTransaction = (_dec$z = AopMethod(), _dec2$z = BeanInfo({
|
|
22
22
|
module: "a-orm"
|
|
23
|
-
}), _dec$
|
|
23
|
+
}), _dec$z(_class$z = _dec2$z(_class$z = class AopMethodTransaction extends BeanAopMethodBase {
|
|
24
24
|
execute(options, _args, next, _receiver, _prop) {
|
|
25
25
|
return this.bean.database.current.transaction.begin(() => {
|
|
26
26
|
return next();
|
|
27
27
|
}, options);
|
|
28
28
|
}
|
|
29
|
-
}) || _class$
|
|
29
|
+
}) || _class$z) || _class$z);
|
|
30
30
|
|
|
31
|
-
var _dec$
|
|
32
|
-
let ServiceDatabaseAsyncLocalStorage = (_dec$
|
|
31
|
+
var _dec$y, _dec2$y, _class$y;
|
|
32
|
+
let ServiceDatabaseAsyncLocalStorage = (_dec$y = Service(), _dec2$y = BeanInfo({
|
|
33
33
|
module: "a-orm"
|
|
34
|
-
}), _dec$
|
|
34
|
+
}), _dec$y(_class$y = _dec2$y(_class$y = class ServiceDatabaseAsyncLocalStorage extends BeanBase {
|
|
35
35
|
constructor(...args) {
|
|
36
36
|
super(...args);
|
|
37
37
|
this.dbStorage = void 0;
|
|
@@ -50,14 +50,14 @@ let ServiceDatabaseAsyncLocalStorage = (_dec$w = Service(), _dec2$w = BeanInfo({
|
|
|
50
50
|
return fn();
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
}) || _class$
|
|
53
|
+
}) || _class$y) || _class$y);
|
|
54
54
|
|
|
55
|
-
var _dec$
|
|
55
|
+
var _dec$x, _dec2$x, _class$x;
|
|
56
56
|
const SymbolColumnsCache = Symbol('SymbolColumnsCache');
|
|
57
57
|
const SymbolColumnsDefaultCache = Symbol('SymbolColumnsDefaultCache');
|
|
58
|
-
let ServiceColumnsCache = (_dec$
|
|
58
|
+
let ServiceColumnsCache = (_dec$x = Service(), _dec2$x = BeanInfo({
|
|
59
59
|
module: "a-orm"
|
|
60
|
-
}), _dec$
|
|
60
|
+
}), _dec$x(_class$x = _dec2$x(_class$x = class ServiceColumnsCache extends BeanBase {
|
|
61
61
|
constructor(...args) {
|
|
62
62
|
super(...args);
|
|
63
63
|
this.clientName = void 0;
|
|
@@ -112,12 +112,12 @@ let ServiceColumnsCache = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
|
112
112
|
return exists;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
}) || _class$
|
|
115
|
+
}) || _class$x) || _class$x);
|
|
116
116
|
|
|
117
|
-
var _dec$
|
|
118
|
-
let ServiceColumns = (_dec$
|
|
117
|
+
var _dec$w, _dec2$w, _class$w;
|
|
118
|
+
let ServiceColumns = (_dec$w = Service(), _dec2$w = BeanInfo({
|
|
119
119
|
module: "a-orm"
|
|
120
|
-
}), _dec$
|
|
120
|
+
}), _dec$w(_class$w = _dec2$w(_class$w = class ServiceColumns extends BeanBase {
|
|
121
121
|
constructor(...args) {
|
|
122
122
|
super(...args);
|
|
123
123
|
this._db = void 0;
|
|
@@ -168,7 +168,7 @@ let ServiceColumns = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
|
168
168
|
columnsClear(tableName) {
|
|
169
169
|
return this.scope.service.database.columnsClear(this.db.clientName, tableName);
|
|
170
170
|
}
|
|
171
|
-
}) || _class$
|
|
171
|
+
}) || _class$w) || _class$w);
|
|
172
172
|
|
|
173
173
|
const TransactionIsolationLevelsMap = {
|
|
174
174
|
DEFAULT: undefined,
|
|
@@ -181,10 +181,13 @@ const TransactionIsolationLevelsMap = {
|
|
|
181
181
|
|
|
182
182
|
// export type TransactionPropagation=''
|
|
183
183
|
|
|
184
|
-
var _dec$
|
|
185
|
-
let ServiceDatabase = (_dec$
|
|
184
|
+
var _dec$v, _dec2$v, _class$v;
|
|
185
|
+
let ServiceDatabase = (_dec$v = Service(), _dec2$v = BeanInfo({
|
|
186
186
|
module: "a-orm"
|
|
187
|
-
}), _dec$
|
|
187
|
+
}), _dec$v(_class$v = _dec2$v(_class$v = class ServiceDatabase extends BeanBase {
|
|
188
|
+
get configDatabase() {
|
|
189
|
+
return this.app.config.database;
|
|
190
|
+
}
|
|
188
191
|
getDialect(client) {
|
|
189
192
|
if (!client) throw new Error('database dialect not specified');
|
|
190
193
|
const beanFullName = this.scope.config.dialects[client];
|
|
@@ -192,6 +195,23 @@ let ServiceDatabase = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
192
195
|
if (!dialect) throw new Error(`database dialect not found: ${client}`);
|
|
193
196
|
return dialect;
|
|
194
197
|
}
|
|
198
|
+
getClientConfig(clientName, original = false) {
|
|
199
|
+
// clientConfig
|
|
200
|
+
let clientConfig = this.configDatabase.clients[clientName];
|
|
201
|
+
if (original) return clientConfig;
|
|
202
|
+
// check
|
|
203
|
+
if (!clientConfig) {
|
|
204
|
+
throw new Error(`database config not found: ${clientName}`);
|
|
205
|
+
}
|
|
206
|
+
// configBaseClient
|
|
207
|
+
const dialect = this.scope.service.database.getDialect(clientConfig.client);
|
|
208
|
+
const configBaseClient = dialect.getConfigBase();
|
|
209
|
+
// combine
|
|
210
|
+
const configBase = this.configDatabase.base;
|
|
211
|
+
clientConfig = deepExtend({}, configBase, configBaseClient, clientConfig);
|
|
212
|
+
// ready
|
|
213
|
+
return clientConfig;
|
|
214
|
+
}
|
|
195
215
|
prepareDbInfo(dbInfoOrClientName) {
|
|
196
216
|
let level;
|
|
197
217
|
let clientName;
|
|
@@ -262,14 +282,14 @@ let ServiceDatabase = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
262
282
|
});
|
|
263
283
|
}
|
|
264
284
|
async reloadClients(clientName, clientConfig, extraData) {
|
|
265
|
-
await this.
|
|
285
|
+
await this.reloadClientsRaw(clientName, clientConfig, extraData);
|
|
266
286
|
this.scope.broadcast.databaseClientReload.emit({
|
|
267
287
|
clientName,
|
|
268
288
|
clientConfig,
|
|
269
289
|
extraData
|
|
270
290
|
});
|
|
271
291
|
}
|
|
272
|
-
async
|
|
292
|
+
async reloadClientsRaw(clientName, clientConfig, extraData) {
|
|
273
293
|
await this.scope.event.databaseClientReload.emit({
|
|
274
294
|
clientName: this.prepareClientName(clientName),
|
|
275
295
|
clientConfig,
|
|
@@ -277,12 +297,24 @@ let ServiceDatabase = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
|
277
297
|
});
|
|
278
298
|
this.__columnsClearRaw(clientName);
|
|
279
299
|
}
|
|
280
|
-
|
|
300
|
+
async disposeClients(clientName) {
|
|
301
|
+
await this.disposeClientsRaw(clientName);
|
|
302
|
+
this.scope.broadcast.databaseClientDispose.emit({
|
|
303
|
+
clientName
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
async disposeClientsRaw(clientName) {
|
|
307
|
+
await this.scope.event.databaseClientDispose.emit({
|
|
308
|
+
clientName: this.prepareClientName(clientName)
|
|
309
|
+
});
|
|
310
|
+
this.__columnsClearRaw(clientName);
|
|
311
|
+
}
|
|
312
|
+
}) || _class$v) || _class$v);
|
|
281
313
|
|
|
282
|
-
var _dec$
|
|
283
|
-
let ServiceTransactionConsistency = (_dec$
|
|
314
|
+
var _dec$u, _dec2$u, _class$u;
|
|
315
|
+
let ServiceTransactionConsistency = (_dec$u = Service(), _dec2$u = BeanInfo({
|
|
284
316
|
module: "a-orm"
|
|
285
|
-
}), _dec$
|
|
317
|
+
}), _dec$u(_class$u = _dec2$u(_class$u = class ServiceTransactionConsistency extends BeanBase {
|
|
286
318
|
constructor(...args) {
|
|
287
319
|
super(...args);
|
|
288
320
|
this._commitCallbacks = [];
|
|
@@ -310,12 +342,12 @@ let ServiceTransactionConsistency = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
|
310
342
|
}
|
|
311
343
|
this._commitCallbacks = [];
|
|
312
344
|
}
|
|
313
|
-
}) || _class$
|
|
345
|
+
}) || _class$u) || _class$u);
|
|
314
346
|
|
|
315
|
-
var _dec$
|
|
316
|
-
let ServiceTransactionFiber = (_dec$
|
|
347
|
+
var _dec$t, _dec2$t, _class$t;
|
|
348
|
+
let ServiceTransactionFiber = (_dec$t = Service(), _dec2$t = BeanInfo({
|
|
317
349
|
module: "a-orm"
|
|
318
|
-
}), _dec$
|
|
350
|
+
}), _dec$t(_class$t = _dec2$t(_class$t = class ServiceTransactionFiber extends BeanBase {
|
|
319
351
|
constructor(...args) {
|
|
320
352
|
super(...args);
|
|
321
353
|
this._connection = void 0;
|
|
@@ -344,12 +376,12 @@ let ServiceTransactionFiber = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
344
376
|
await this._transactionConsistency.compensatesDone();
|
|
345
377
|
this._connection = undefined;
|
|
346
378
|
}
|
|
347
|
-
}) || _class$
|
|
379
|
+
}) || _class$t) || _class$t);
|
|
348
380
|
|
|
349
|
-
var _dec$
|
|
350
|
-
let ServiceTransactionState = (_dec$
|
|
381
|
+
var _dec$s, _dec2$s, _class$s;
|
|
382
|
+
let ServiceTransactionState = (_dec$s = Service(), _dec2$s = BeanInfo({
|
|
351
383
|
module: "a-orm"
|
|
352
|
-
}), _dec$
|
|
384
|
+
}), _dec$s(_class$s = _dec2$s(_class$s = class ServiceTransactionState extends BeanBase {
|
|
353
385
|
constructor(...args) {
|
|
354
386
|
super(...args);
|
|
355
387
|
this._fibers = {};
|
|
@@ -371,12 +403,12 @@ let ServiceTransactionState = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
|
371
403
|
const selector = this.serviceDatabase.prepareClientNameSelector(dbInfo);
|
|
372
404
|
delete this._fibers[selector];
|
|
373
405
|
}
|
|
374
|
-
}) || _class$
|
|
406
|
+
}) || _class$s) || _class$s);
|
|
375
407
|
|
|
376
|
-
var _dec$
|
|
377
|
-
let ServiceTransactionAsyncLocalStorage = (_dec$
|
|
408
|
+
var _dec$r, _dec2$r, _class$r;
|
|
409
|
+
let ServiceTransactionAsyncLocalStorage = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
378
410
|
module: "a-orm"
|
|
379
|
-
}), _dec$
|
|
411
|
+
}), _dec$r(_class$r = _dec2$r(_class$r = class ServiceTransactionAsyncLocalStorage extends BeanBase {
|
|
380
412
|
constructor(...args) {
|
|
381
413
|
super(...args);
|
|
382
414
|
this.transactionStorage = void 0;
|
|
@@ -397,12 +429,12 @@ let ServiceTransactionAsyncLocalStorage = (_dec$p = Service(), _dec2$p = BeanInf
|
|
|
397
429
|
return fn();
|
|
398
430
|
});
|
|
399
431
|
}
|
|
400
|
-
}) || _class$
|
|
432
|
+
}) || _class$r) || _class$r);
|
|
401
433
|
|
|
402
|
-
var _dec$
|
|
403
|
-
let ServiceTransaction = (_dec$
|
|
434
|
+
var _dec$q, _dec2$q, _class$q;
|
|
435
|
+
let ServiceTransaction = (_dec$q = Service(), _dec2$q = BeanInfo({
|
|
404
436
|
module: "a-orm"
|
|
405
|
-
}), _dec$
|
|
437
|
+
}), _dec$q(_class$q = _dec2$q(_class$q = class ServiceTransaction extends BeanBase {
|
|
406
438
|
constructor(...args) {
|
|
407
439
|
super(...args);
|
|
408
440
|
this._db = void 0;
|
|
@@ -521,7 +553,7 @@ let ServiceTransaction = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
|
521
553
|
}
|
|
522
554
|
return res;
|
|
523
555
|
}
|
|
524
|
-
}) || _class$
|
|
556
|
+
}) || _class$q) || _class$q);
|
|
525
557
|
function _translateTransactionOptions(options) {
|
|
526
558
|
if (!options) return undefined;
|
|
527
559
|
return {
|
|
@@ -530,10 +562,10 @@ function _translateTransactionOptions(options) {
|
|
|
530
562
|
};
|
|
531
563
|
}
|
|
532
564
|
|
|
533
|
-
var _dec$
|
|
534
|
-
let ServiceDb = (_dec$
|
|
565
|
+
var _dec$p, _dec2$p, _class$p;
|
|
566
|
+
let ServiceDb = (_dec$p = Service(), _dec2$p = BeanInfo({
|
|
535
567
|
module: "a-orm"
|
|
536
|
-
}), _dec$
|
|
568
|
+
}), _dec$p(_class$p = _dec2$p(_class$p = class ServiceDb extends BeanBase {
|
|
537
569
|
constructor(...args) {
|
|
538
570
|
super(...args);
|
|
539
571
|
this._client = void 0;
|
|
@@ -588,12 +620,12 @@ let ServiceDb = (_dec$n = Service(), _dec2$n = BeanInfo({
|
|
|
588
620
|
compensate(cb) {
|
|
589
621
|
return this.transaction.compensate(cb);
|
|
590
622
|
}
|
|
591
|
-
}) || _class$
|
|
623
|
+
}) || _class$p) || _class$p);
|
|
592
624
|
|
|
593
|
-
var _dec$
|
|
594
|
-
let ServiceDatabaseClient = (_dec$
|
|
625
|
+
var _dec$o, _dec2$o, _class$o;
|
|
626
|
+
let ServiceDatabaseClient = (_dec$o = Service(), _dec2$o = BeanInfo({
|
|
595
627
|
module: "a-orm"
|
|
596
|
-
}), _dec$
|
|
628
|
+
}), _dec$o(_class$o = _dec2$o(_class$o = class ServiceDatabaseClient extends BeanBase {
|
|
597
629
|
constructor(...args) {
|
|
598
630
|
super(...args);
|
|
599
631
|
this.level = void 0;
|
|
@@ -603,6 +635,7 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
603
635
|
this._knex = void 0;
|
|
604
636
|
this._db = void 0;
|
|
605
637
|
this._onDatabaseClientReloadCancel = void 0;
|
|
638
|
+
this._onDatabaseClientDisposeCancel = void 0;
|
|
606
639
|
}
|
|
607
640
|
get configDatabase() {
|
|
608
641
|
return this.app.config.database;
|
|
@@ -618,7 +651,7 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
618
651
|
this._db = this.bean._newBean(ServiceDb, this);
|
|
619
652
|
// load
|
|
620
653
|
this.__load(clientNameSelector, clientConfig);
|
|
621
|
-
// event
|
|
654
|
+
// event: databaseClientReload
|
|
622
655
|
this._onDatabaseClientReloadCancel = this.scope.event.databaseClientReload.on(async ({
|
|
623
656
|
clientName,
|
|
624
657
|
clientConfig
|
|
@@ -628,11 +661,23 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
628
661
|
}
|
|
629
662
|
await next();
|
|
630
663
|
});
|
|
664
|
+
// event: databaseClientDispose
|
|
665
|
+
this._onDatabaseClientDisposeCancel = this.scope.event.databaseClientDispose.on(async ({
|
|
666
|
+
clientName
|
|
667
|
+
}, next) => {
|
|
668
|
+
if (clientName === this.clientName) {
|
|
669
|
+
await this.bean.disposeInstance(this.$beanInstanceKey);
|
|
670
|
+
}
|
|
671
|
+
await next();
|
|
672
|
+
});
|
|
631
673
|
}
|
|
632
674
|
async __dispose__() {
|
|
633
675
|
this._db = undefined;
|
|
634
676
|
await this.__close();
|
|
635
677
|
this._onDatabaseClientReloadCancel?.();
|
|
678
|
+
this._onDatabaseClientDisposeCancel?.();
|
|
679
|
+
this._onDatabaseClientReloadCancel = undefined;
|
|
680
|
+
this._onDatabaseClientDisposeCancel = undefined;
|
|
636
681
|
}
|
|
637
682
|
__load(clientNameSelector, clientConfig) {
|
|
638
683
|
// name
|
|
@@ -641,7 +686,7 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
641
686
|
this.level = dbInfo.level;
|
|
642
687
|
this.clientName = dbInfo.clientName;
|
|
643
688
|
// config
|
|
644
|
-
this.clientConfig = clientConfig ? deepExtend({}, clientConfig) : this.getClientConfig(this.clientName);
|
|
689
|
+
this.clientConfig = clientConfig ? deepExtend({}, clientConfig) : this.scope.service.database.getClientConfig(this.clientName);
|
|
645
690
|
this.$loggerChild('database').debug('clientName: %s, clientConfig: %j', this.clientName, this.clientConfig);
|
|
646
691
|
// knex
|
|
647
692
|
this._knex = knex(this.clientConfig);
|
|
@@ -656,23 +701,6 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
656
701
|
await this.__close();
|
|
657
702
|
this.__load(this.clientNameSelector, clientConfig);
|
|
658
703
|
}
|
|
659
|
-
getClientConfig(clientName, original = false) {
|
|
660
|
-
// clientConfig
|
|
661
|
-
let clientConfig = this.configDatabase.clients[clientName];
|
|
662
|
-
if (original) return clientConfig;
|
|
663
|
-
// check
|
|
664
|
-
if (!clientConfig) {
|
|
665
|
-
throw new Error(`database config not found: ${clientName}`);
|
|
666
|
-
}
|
|
667
|
-
// configBaseClient
|
|
668
|
-
const dialect = this.scope.service.database.getDialect(clientConfig.client);
|
|
669
|
-
const configBaseClient = dialect.getConfigBase();
|
|
670
|
-
// combine
|
|
671
|
-
const configBase = this.configDatabase.base;
|
|
672
|
-
clientConfig = deepExtend({}, configBase, configBaseClient, clientConfig);
|
|
673
|
-
// ready
|
|
674
|
-
return clientConfig;
|
|
675
|
-
}
|
|
676
704
|
getDatabaseName() {
|
|
677
705
|
const connection = this.clientConfig.connection;
|
|
678
706
|
return connection.database || connection.filename;
|
|
@@ -687,24 +715,27 @@ let ServiceDatabaseClient = (_dec$m = Service(), _dec2$m = BeanInfo({
|
|
|
687
715
|
}
|
|
688
716
|
return result;
|
|
689
717
|
}
|
|
690
|
-
|
|
718
|
+
|
|
719
|
+
// only used by startup, so no consider that workers broadcast
|
|
720
|
+
async changeConfigConnectionAndReload(databaseName) {
|
|
691
721
|
// set databaseName
|
|
692
722
|
const connDatabaseName = this._prepareDatabaseName(databaseName);
|
|
693
723
|
// set config
|
|
694
724
|
// * should not use this.clientConfig.connection, because password is hidden
|
|
695
|
-
const config = this.getClientConfig(this.clientName, true);
|
|
725
|
+
const config = this.scope.service.database.getClientConfig(this.clientName, true);
|
|
696
726
|
config.connection = Object.assign({}, config.connection, connDatabaseName);
|
|
697
727
|
// only used by startup, so no consider that workers broadcast
|
|
698
728
|
this.configDatabase.clients[this.clientName] = config;
|
|
699
729
|
// reload
|
|
700
|
-
await this.scope.service.database.
|
|
730
|
+
await this.scope.service.database.reloadClientsRaw(this.clientName, config);
|
|
731
|
+
// await this.scope.service.database.reloadClients(this.clientName, config);
|
|
701
732
|
}
|
|
702
|
-
}) || _class$
|
|
733
|
+
}) || _class$o) || _class$o);
|
|
703
734
|
|
|
704
|
-
var _dec$
|
|
705
|
-
let BeanDatabase = (_dec$
|
|
735
|
+
var _dec$n, _dec2$n, _class$n;
|
|
736
|
+
let BeanDatabase = (_dec$n = Bean(), _dec2$n = BeanInfo({
|
|
706
737
|
module: "a-orm"
|
|
707
|
-
}), _dec$
|
|
738
|
+
}), _dec$n(_class$n = _dec2$n(_class$n = class BeanDatabase extends BeanBase {
|
|
708
739
|
get current() {
|
|
709
740
|
return this.bean._getBean(ServiceDatabaseAsyncLocalStorage).current;
|
|
710
741
|
}
|
|
@@ -734,12 +765,12 @@ let BeanDatabase = (_dec$l = Bean(), _dec2$l = BeanInfo({
|
|
|
734
765
|
return this.bean._getBean(ServiceTransactionAsyncLocalStorage).run(fn);
|
|
735
766
|
});
|
|
736
767
|
}
|
|
737
|
-
}) || _class$
|
|
768
|
+
}) || _class$n) || _class$n);
|
|
738
769
|
|
|
739
|
-
var _dec$
|
|
740
|
-
let BeanDatabaseDialectBase = (_dec$
|
|
770
|
+
var _dec$m, _dec2$m, _dec3$7, _class$m;
|
|
771
|
+
let BeanDatabaseDialectBase = (_dec$m = Bean(), _dec2$m = Virtual(), _dec3$7 = BeanInfo({
|
|
741
772
|
module: "a-orm"
|
|
742
|
-
}), _dec$
|
|
773
|
+
}), _dec$m(_class$m = _dec2$m(_class$m = _dec3$7(_class$m = class BeanDatabaseDialectBase extends BeanBase {
|
|
743
774
|
getConfigBase() {
|
|
744
775
|
return undefined;
|
|
745
776
|
}
|
|
@@ -799,7 +830,7 @@ let BeanDatabaseDialectBase = (_dec$k = Bean(), _dec2$k = Virtual(), _dec3$7 = B
|
|
|
799
830
|
_columnTypePrefixes(type, prefixes) {
|
|
800
831
|
return prefixes.some(prefix => type.includes(prefix));
|
|
801
832
|
}
|
|
802
|
-
}) || _class$
|
|
833
|
+
}) || _class$m) || _class$m) || _class$m);
|
|
803
834
|
|
|
804
835
|
const OpAggrs = ['count', 'sum', 'avg', 'max', 'min'];
|
|
805
836
|
const OpJoint = {
|
|
@@ -1205,69 +1236,69 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1205
1236
|
});
|
|
1206
1237
|
}
|
|
1207
1238
|
|
|
1208
|
-
var _dec$
|
|
1239
|
+
var _dec$l, _dec2$l, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _dec7$1, _class$l, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1209
1240
|
const app$1 = useApp();
|
|
1210
1241
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1211
1242
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1212
|
-
let DtoQueryBase = (_dec$
|
|
1243
|
+
let DtoQueryBase = (_dec$l = Api.field(v.optional(), v.array(String, {
|
|
1213
1244
|
separator: ','
|
|
1214
|
-
})), _dec2$
|
|
1245
|
+
})), _dec2$l = 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$l = class DtoQueryBase {
|
|
1215
1246
|
constructor() {
|
|
1216
1247
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1217
1248
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
1218
1249
|
_initializerDefineProperty(this, "orders", _descriptor3$1, this);
|
|
1219
1250
|
}
|
|
1220
|
-
}, _descriptor$4 = _applyDecoratedDescriptor(_class$
|
|
1251
|
+
}, _descriptor$4 = _applyDecoratedDescriptor(_class$l.prototype, "columns", [_dec$l, _dec2$l], {
|
|
1221
1252
|
configurable: true,
|
|
1222
1253
|
enumerable: true,
|
|
1223
1254
|
writable: true,
|
|
1224
1255
|
initializer: null
|
|
1225
|
-
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$
|
|
1256
|
+
}), _descriptor2$2 = _applyDecoratedDescriptor(_class$l.prototype, "where", [_dec3$6, _dec4$4], {
|
|
1226
1257
|
configurable: true,
|
|
1227
1258
|
enumerable: true,
|
|
1228
1259
|
writable: true,
|
|
1229
1260
|
initializer: null
|
|
1230
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$
|
|
1261
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$l.prototype, "orders", [_dec5$1, _dec6$1, _dec7$1], {
|
|
1231
1262
|
configurable: true,
|
|
1232
1263
|
enumerable: true,
|
|
1233
1264
|
writable: true,
|
|
1234
1265
|
initializer: null
|
|
1235
|
-
}), _class$
|
|
1266
|
+
}), _class$l);
|
|
1236
1267
|
|
|
1237
|
-
var _dec$
|
|
1268
|
+
var _dec$k, _dec2$k, _dec3$5, _dec4$3, _class$k, _descriptor$3, _descriptor2$1;
|
|
1238
1269
|
const app = useApp();
|
|
1239
1270
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
1240
1271
|
const pageSizeDefault = ormConfig?.rest?.query?.pageSize?.default ?? 20;
|
|
1241
1272
|
const pageSizeMax = ormConfig?.rest?.query?.pageSize?.max ?? 100;
|
|
1242
|
-
let DtoQueryPageBase = (_dec$
|
|
1273
|
+
let DtoQueryPageBase = (_dec$k = Api.field(z.number().min(1).default(1)), _dec2$k = 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$k = class DtoQueryPageBase extends DtoQueryBase {
|
|
1243
1274
|
constructor(...args) {
|
|
1244
1275
|
super(...args);
|
|
1245
1276
|
_initializerDefineProperty(this, "pageNo", _descriptor$3, this);
|
|
1246
1277
|
_initializerDefineProperty(this, "pageSize", _descriptor2$1, this);
|
|
1247
1278
|
}
|
|
1248
|
-
}, _descriptor$3 = _applyDecoratedDescriptor(_class$
|
|
1279
|
+
}, _descriptor$3 = _applyDecoratedDescriptor(_class$k.prototype, "pageNo", [_dec$k, _dec2$k], {
|
|
1249
1280
|
configurable: true,
|
|
1250
1281
|
enumerable: true,
|
|
1251
1282
|
writable: true,
|
|
1252
1283
|
initializer: null
|
|
1253
|
-
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$
|
|
1284
|
+
}), _descriptor2$1 = _applyDecoratedDescriptor(_class$k.prototype, "pageSize", [_dec3$5, _dec4$3], {
|
|
1254
1285
|
configurable: true,
|
|
1255
1286
|
enumerable: true,
|
|
1256
1287
|
writable: true,
|
|
1257
1288
|
initializer: null
|
|
1258
|
-
}), _class$
|
|
1289
|
+
}), _class$k);
|
|
1259
1290
|
|
|
1260
1291
|
const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
1261
1292
|
|
|
1262
1293
|
class EntityBaseEmpty {}
|
|
1263
1294
|
|
|
1264
|
-
var _dec$
|
|
1265
|
-
let EntityBaseInner = (_dec$
|
|
1295
|
+
var _dec$j, _dec2$j, _dec3$4, _dec4$2, _dec5, _dec6, _dec7, _dec8, _class$j, _descriptor$2, _descriptor2, _descriptor3, _descriptor4;
|
|
1296
|
+
let EntityBaseInner = (_dec$j = Api.field(v.openapi({
|
|
1266
1297
|
title: $locale('CreatedAt'),
|
|
1267
1298
|
rest: {
|
|
1268
1299
|
order: OrderMaxBase - 2
|
|
1269
1300
|
}
|
|
1270
|
-
})), _dec2$
|
|
1301
|
+
})), _dec2$j = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec3$4 = Api.field(v.openapi({
|
|
1271
1302
|
title: $locale('UpdatedAt'),
|
|
1272
1303
|
rest: {
|
|
1273
1304
|
order: OrderMaxBase - 1
|
|
@@ -1282,7 +1313,7 @@ let EntityBaseInner = (_dec$h = Api.field(v.openapi({
|
|
|
1282
1313
|
rest: {
|
|
1283
1314
|
visible: false
|
|
1284
1315
|
}
|
|
1285
|
-
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$
|
|
1316
|
+
}), v.default(0)), _dec8 = Reflect.metadata("design:type", Number), _class$j = class EntityBaseInner extends EntityBaseEmpty {
|
|
1286
1317
|
constructor(...args) {
|
|
1287
1318
|
super(...args);
|
|
1288
1319
|
_initializerDefineProperty(this, "createdAt", _descriptor$2, this);
|
|
@@ -1290,63 +1321,63 @@ let EntityBaseInner = (_dec$h = Api.field(v.openapi({
|
|
|
1290
1321
|
_initializerDefineProperty(this, "deleted", _descriptor3, this);
|
|
1291
1322
|
_initializerDefineProperty(this, "iid", _descriptor4, this);
|
|
1292
1323
|
}
|
|
1293
|
-
}, _descriptor$2 = _applyDecoratedDescriptor(_class$
|
|
1324
|
+
}, _descriptor$2 = _applyDecoratedDescriptor(_class$j.prototype, "createdAt", [_dec$j, _dec2$j], {
|
|
1294
1325
|
configurable: true,
|
|
1295
1326
|
enumerable: true,
|
|
1296
1327
|
writable: true,
|
|
1297
1328
|
initializer: null
|
|
1298
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class$
|
|
1329
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class$j.prototype, "updatedAt", [_dec3$4, _dec4$2], {
|
|
1299
1330
|
configurable: true,
|
|
1300
1331
|
enumerable: true,
|
|
1301
1332
|
writable: true,
|
|
1302
1333
|
initializer: null
|
|
1303
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class$
|
|
1334
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class$j.prototype, "deleted", [_dec5, _dec6], {
|
|
1304
1335
|
configurable: true,
|
|
1305
1336
|
enumerable: true,
|
|
1306
1337
|
writable: true,
|
|
1307
1338
|
initializer: null
|
|
1308
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class$
|
|
1339
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class$j.prototype, "iid", [_dec7, _dec8], {
|
|
1309
1340
|
configurable: true,
|
|
1310
1341
|
enumerable: true,
|
|
1311
1342
|
writable: true,
|
|
1312
1343
|
initializer: null
|
|
1313
|
-
}), _class$
|
|
1344
|
+
}), _class$j);
|
|
1314
1345
|
|
|
1315
|
-
var _dec$
|
|
1316
|
-
let EntityBase = (_dec$
|
|
1346
|
+
var _dec$i, _dec2$i, _class$i, _descriptor$1;
|
|
1347
|
+
let EntityBase = (_dec$i = Api.field(v.openapi({
|
|
1317
1348
|
title: $locale('TableIdentity'),
|
|
1318
1349
|
rest: {
|
|
1319
1350
|
order: OrderCoreBase + 1
|
|
1320
1351
|
}
|
|
1321
|
-
}), v.tableIdentity()), _dec2$
|
|
1352
|
+
}), v.tableIdentity()), _dec2$i = Reflect.metadata("design:type", typeof TableIdentity === "undefined" ? Object : TableIdentity), _class$i = class EntityBase extends EntityBaseInner {
|
|
1322
1353
|
constructor(...args) {
|
|
1323
1354
|
super(...args);
|
|
1324
1355
|
_initializerDefineProperty(this, "id", _descriptor$1, this);
|
|
1325
1356
|
}
|
|
1326
|
-
}, _descriptor$1 = _applyDecoratedDescriptor(_class$
|
|
1357
|
+
}, _descriptor$1 = _applyDecoratedDescriptor(_class$i.prototype, "id", [_dec$i, _dec2$i], {
|
|
1327
1358
|
configurable: true,
|
|
1328
1359
|
enumerable: true,
|
|
1329
1360
|
writable: true,
|
|
1330
1361
|
initializer: null
|
|
1331
|
-
}), _class$
|
|
1362
|
+
}), _class$i);
|
|
1332
1363
|
|
|
1333
|
-
var _dec$
|
|
1334
|
-
let EntityBaseSimple = (_dec$
|
|
1364
|
+
var _dec$h, _dec2$h, _class$h, _descriptor;
|
|
1365
|
+
let EntityBaseSimple = (_dec$h = Api.field(v.openapi({
|
|
1335
1366
|
title: $locale('TableIdentity'),
|
|
1336
1367
|
rest: {
|
|
1337
1368
|
order: OrderCoreBase + 1
|
|
1338
1369
|
}
|
|
1339
|
-
})), _dec2$
|
|
1370
|
+
})), _dec2$h = Reflect.metadata("design:type", Number), _class$h = class EntityBaseSimple extends EntityBaseInner {
|
|
1340
1371
|
constructor(...args) {
|
|
1341
1372
|
super(...args);
|
|
1342
1373
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
1343
1374
|
}
|
|
1344
|
-
}, _descriptor = _applyDecoratedDescriptor(_class$
|
|
1375
|
+
}, _descriptor = _applyDecoratedDescriptor(_class$h.prototype, "id", [_dec$h, _dec2$h], {
|
|
1345
1376
|
configurable: true,
|
|
1346
1377
|
enumerable: true,
|
|
1347
1378
|
writable: true,
|
|
1348
1379
|
initializer: null
|
|
1349
|
-
}), _class$
|
|
1380
|
+
}), _class$h);
|
|
1350
1381
|
|
|
1351
1382
|
const SymbolKeyEntity = Symbol('$entity');
|
|
1352
1383
|
const SymbolKeyEntityMeta = Symbol('$entityMeta');
|
|
@@ -1406,15 +1437,15 @@ class BeanModelMeta extends BeanBase {
|
|
|
1406
1437
|
// db
|
|
1407
1438
|
return this.bean.database.getDb(clientName);
|
|
1408
1439
|
}
|
|
1409
|
-
getTable() {
|
|
1410
|
-
return this
|
|
1440
|
+
getTable(where) {
|
|
1441
|
+
return this._getTable(where);
|
|
1411
1442
|
}
|
|
1412
|
-
_getTable() {
|
|
1413
|
-
const table = this.options.table;
|
|
1443
|
+
_getTable(where) {
|
|
1444
|
+
const table = this[SymbolModelTable] ?? this.options.table;
|
|
1414
1445
|
if (table && typeof table === 'string') return table;
|
|
1415
1446
|
const defaultTable = this.options.entity && $tableName(this.options.entity);
|
|
1416
1447
|
if (table && typeof table === 'function') {
|
|
1417
|
-
return table(this.ctx, defaultTable, this);
|
|
1448
|
+
return table(this.ctx, where, defaultTable, this);
|
|
1418
1449
|
}
|
|
1419
1450
|
if (defaultTable) return defaultTable;
|
|
1420
1451
|
throw new Error(`not found table of ${this.$beanFullName}`);
|
|
@@ -1494,6 +1525,7 @@ class BeanModelMeta extends BeanBase {
|
|
|
1494
1525
|
const beanOptions = appResource.getBean(modelClass2);
|
|
1495
1526
|
const beanFullName = beanOptions.beanFullName;
|
|
1496
1527
|
const options = beanOptions?.options;
|
|
1528
|
+
// client
|
|
1497
1529
|
if (isNil(client) || client === '_auto_') {
|
|
1498
1530
|
client = options?.client ? '_initial_' : '_inherit_';
|
|
1499
1531
|
}
|
|
@@ -1513,7 +1545,7 @@ class BeanModelUtils extends BeanModelMeta {
|
|
|
1513
1545
|
table = undefined;
|
|
1514
1546
|
}
|
|
1515
1547
|
// table
|
|
1516
|
-
table = table || this.getTable();
|
|
1548
|
+
table = table || this.getTable(item);
|
|
1517
1549
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1518
1550
|
// item
|
|
1519
1551
|
if (!item) return [{}, {}];
|
|
@@ -1539,11 +1571,11 @@ class BeanModelUtils extends BeanModelMeta {
|
|
|
1539
1571
|
if (this.options.entity) {
|
|
1540
1572
|
return $tableDefaults(this.options.entity);
|
|
1541
1573
|
}
|
|
1542
|
-
table = table || this.getTable();
|
|
1574
|
+
table = table || this.getTable(undefined);
|
|
1543
1575
|
return await this.db.columns.defaultData(table);
|
|
1544
1576
|
}
|
|
1545
1577
|
async columns(table) {
|
|
1546
|
-
table = table || this.getTable();
|
|
1578
|
+
table = table || this.getTable(undefined);
|
|
1547
1579
|
return await this.db.columns.columns(table);
|
|
1548
1580
|
}
|
|
1549
1581
|
isRaw(raw) {
|
|
@@ -1658,7 +1690,7 @@ class BeanModelUtils extends BeanModelMeta {
|
|
|
1658
1690
|
}
|
|
1659
1691
|
prepareWhere(builder, table, where, options) {
|
|
1660
1692
|
// table
|
|
1661
|
-
table = table || this.getTable();
|
|
1693
|
+
table = table || this.getTable(where);
|
|
1662
1694
|
if (!table) throw new Error('should specify the table name');
|
|
1663
1695
|
// disableInstance/disableDeleted
|
|
1664
1696
|
where = Object.assign({}, where);
|
|
@@ -1738,7 +1770,7 @@ class BeanModelKnex extends BeanModelUtils {
|
|
|
1738
1770
|
}
|
|
1739
1771
|
builder(table) {
|
|
1740
1772
|
// table
|
|
1741
|
-
table = table || this.getTable();
|
|
1773
|
+
table = table || this.getTable(undefined);
|
|
1742
1774
|
if (table) {
|
|
1743
1775
|
return this.connection(table);
|
|
1744
1776
|
}
|
|
@@ -1750,7 +1782,7 @@ class BeanModelKnex extends BeanModelUtils {
|
|
|
1750
1782
|
table = undefined;
|
|
1751
1783
|
}
|
|
1752
1784
|
// table
|
|
1753
|
-
table = table || this.getTable();
|
|
1785
|
+
table = table || this.getTable(undefined);
|
|
1754
1786
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1755
1787
|
// builder
|
|
1756
1788
|
const builder = this.builder(table);
|
|
@@ -1911,7 +1943,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
1911
1943
|
// with undefined
|
|
1912
1944
|
async _mget_original(table, ids, options) {
|
|
1913
1945
|
// table
|
|
1914
|
-
table = table || this.getTable();
|
|
1946
|
+
table = table || this.getTable(undefined);
|
|
1915
1947
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1916
1948
|
// ids maybe empty
|
|
1917
1949
|
if (!ids || ids.length === 0) return [];
|
|
@@ -1940,7 +1972,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
1940
1972
|
}
|
|
1941
1973
|
async _select(table, params, options, builder) {
|
|
1942
1974
|
// table
|
|
1943
|
-
table = table || this.getTable();
|
|
1975
|
+
table = table || this.getTable(params?.where);
|
|
1944
1976
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1945
1977
|
// builder
|
|
1946
1978
|
builder = builder ?? this._select_buildParams(table, params, options);
|
|
@@ -1976,7 +2008,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
1976
2008
|
}
|
|
1977
2009
|
async _get(table, where, options) {
|
|
1978
2010
|
// table
|
|
1979
|
-
table = table || this.getTable();
|
|
2011
|
+
table = table || this.getTable(where);
|
|
1980
2012
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1981
2013
|
// params
|
|
1982
2014
|
const params = {
|
|
@@ -1994,7 +2026,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
1994
2026
|
}
|
|
1995
2027
|
async _count(table, params, options) {
|
|
1996
2028
|
// table
|
|
1997
|
-
table = table || this.getTable();
|
|
2029
|
+
table = table || this.getTable(params?.where);
|
|
1998
2030
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
1999
2031
|
// params
|
|
2000
2032
|
params = params || {};
|
|
@@ -2012,12 +2044,12 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
2012
2044
|
return this.extractFirstNumber(res);
|
|
2013
2045
|
}
|
|
2014
2046
|
async _insertBulk(table, data, options) {
|
|
2015
|
-
// table
|
|
2016
|
-
table = table || this.getTable();
|
|
2017
|
-
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2018
2047
|
// data
|
|
2019
2048
|
data = data || {};
|
|
2020
2049
|
const datasTemp = Array.isArray(data) ? data : [data];
|
|
2050
|
+
// table
|
|
2051
|
+
table = table || this.getTable(datasTemp[0]);
|
|
2052
|
+
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2021
2053
|
// options
|
|
2022
2054
|
const datas = [];
|
|
2023
2055
|
const datasOriginal = [];
|
|
@@ -2052,7 +2084,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
2052
2084
|
}
|
|
2053
2085
|
async _update(table, data, options) {
|
|
2054
2086
|
// table
|
|
2055
|
-
table = table || this.getTable();
|
|
2087
|
+
table = table || this.getTable(data);
|
|
2056
2088
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2057
2089
|
// data
|
|
2058
2090
|
[data] = await this.prepareData(table, data);
|
|
@@ -2085,7 +2117,7 @@ class BeanModelCrudInner extends BeanModelView {
|
|
|
2085
2117
|
}
|
|
2086
2118
|
async _delete(table, where, options) {
|
|
2087
2119
|
// table
|
|
2088
|
-
table = table || this.getTable();
|
|
2120
|
+
table = table || this.getTable(where);
|
|
2089
2121
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2090
2122
|
// disableDeleted
|
|
2091
2123
|
if (!this._checkDisableDeletedByOptions(options)) {
|
|
@@ -2138,10 +2170,10 @@ class BeanModelCrudTable extends BeanModelCrudInner {
|
|
|
2138
2170
|
}
|
|
2139
2171
|
}
|
|
2140
2172
|
|
|
2141
|
-
var _dec$
|
|
2142
|
-
let BeanModel = (_dec$
|
|
2173
|
+
var _dec$g, _dec2$g, _dec3$3, _class$g;
|
|
2174
|
+
let BeanModel = (_dec$g = Bean(), _dec2$g = Virtual(), _dec3$3 = BeanInfo({
|
|
2143
2175
|
module: "a-orm"
|
|
2144
|
-
}), _dec$
|
|
2176
|
+
}), _dec$g(_class$g = _dec2$g(_class$g = _dec3$3(_class$g = class BeanModel extends BeanModelCrudTable {}) || _class$g) || _class$g) || _class$g);
|
|
2145
2177
|
|
|
2146
2178
|
const SymbolCacheOptions = Symbol('SymbolCacheOptions');
|
|
2147
2179
|
const SymbolCacheEnabled = Symbol('SymbolCacheEnabled');
|
|
@@ -2216,22 +2248,22 @@ class ModelCacheBase extends BeanBase {
|
|
|
2216
2248
|
}
|
|
2217
2249
|
}
|
|
2218
2250
|
|
|
2219
|
-
var _dec$
|
|
2220
|
-
let ServiceCacheEntity = (_dec$
|
|
2251
|
+
var _dec$f, _dec2$f, _class$f;
|
|
2252
|
+
let ServiceCacheEntity = (_dec$f = Service(), _dec2$f = BeanInfo({
|
|
2221
2253
|
module: "a-orm"
|
|
2222
|
-
}), _dec$
|
|
2254
|
+
}), _dec$f(_class$f = _dec2$f(_class$f = class ServiceCacheEntity extends ModelCacheBase {
|
|
2223
2255
|
__init__(model) {
|
|
2224
2256
|
super.__init__(model, 'entity');
|
|
2225
2257
|
}
|
|
2226
2258
|
async clear(table) {
|
|
2227
2259
|
if (!this.enabled) return;
|
|
2228
|
-
table = table || this._model.getTable();
|
|
2260
|
+
table = table || this._model.getTable(undefined);
|
|
2229
2261
|
const cache = this.getInstance(table);
|
|
2230
2262
|
await cache.clear();
|
|
2231
2263
|
}
|
|
2232
2264
|
async del(id, table) {
|
|
2233
2265
|
if (!this.enabled) return;
|
|
2234
|
-
table = table || this._model.getTable();
|
|
2266
|
+
table = table || this._model.getTable(undefined);
|
|
2235
2267
|
const cache = this.getInstance(table);
|
|
2236
2268
|
if (Array.isArray(id)) {
|
|
2237
2269
|
await cache.mdel(id);
|
|
@@ -2242,22 +2274,22 @@ let ServiceCacheEntity = (_dec$d = Service(), _dec2$d = BeanInfo({
|
|
|
2242
2274
|
get keysAux() {
|
|
2243
2275
|
return this._model.options.cache?.keysAux;
|
|
2244
2276
|
}
|
|
2245
|
-
}) || _class$
|
|
2277
|
+
}) || _class$f) || _class$f);
|
|
2246
2278
|
|
|
2247
|
-
var _dec$
|
|
2248
|
-
let ServiceCacheQuery = (_dec$
|
|
2279
|
+
var _dec$e, _dec2$e, _class$e;
|
|
2280
|
+
let ServiceCacheQuery = (_dec$e = Service(), _dec2$e = BeanInfo({
|
|
2249
2281
|
module: "a-orm"
|
|
2250
|
-
}), _dec$
|
|
2282
|
+
}), _dec$e(_class$e = _dec2$e(_class$e = class ServiceCacheQuery extends ModelCacheBase {
|
|
2251
2283
|
__init__(model) {
|
|
2252
2284
|
super.__init__(model, 'query');
|
|
2253
2285
|
}
|
|
2254
2286
|
async clear(table) {
|
|
2255
2287
|
if (!this.enabled) return;
|
|
2256
|
-
table = table || this._model.getTable();
|
|
2288
|
+
table = table || this._model.getTable(undefined);
|
|
2257
2289
|
const cache = this.getInstance(table);
|
|
2258
2290
|
await cache.clear();
|
|
2259
2291
|
}
|
|
2260
|
-
}) || _class$
|
|
2292
|
+
}) || _class$e) || _class$e);
|
|
2261
2293
|
|
|
2262
2294
|
function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
2263
2295
|
// collect
|
|
@@ -2302,10 +2334,10 @@ function handleRelationsCollection(relationsStatic, includeWrapper) {
|
|
|
2302
2334
|
return relations;
|
|
2303
2335
|
}
|
|
2304
2336
|
|
|
2305
|
-
var _dec$
|
|
2306
|
-
let ServiceRelations = (_dec$
|
|
2337
|
+
var _dec$d, _dec2$d, _class$d;
|
|
2338
|
+
let ServiceRelations = (_dec$d = Service(), _dec2$d = BeanInfo({
|
|
2307
2339
|
module: "a-orm"
|
|
2308
|
-
}), _dec$
|
|
2340
|
+
}), _dec$d(_class$d = _dec2$d(_class$d = class ServiceRelations extends BeanBase {
|
|
2309
2341
|
constructor(...args) {
|
|
2310
2342
|
super(...args);
|
|
2311
2343
|
this._model = void 0;
|
|
@@ -2368,7 +2400,6 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2368
2400
|
options
|
|
2369
2401
|
} = relationReal;
|
|
2370
2402
|
const modelTarget = this.__getModelTarget(model, options?.meta);
|
|
2371
|
-
const tableNameTarget = modelTarget.getTable();
|
|
2372
2403
|
const optionsReal = Object.assign({}, options, {
|
|
2373
2404
|
include: includeReal,
|
|
2374
2405
|
with: withReal
|
|
@@ -2406,21 +2437,21 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2406
2437
|
if (optionsReal.groups) {
|
|
2407
2438
|
const options2 = deepExtend({}, optionsReal, {
|
|
2408
2439
|
where: {
|
|
2409
|
-
[
|
|
2440
|
+
[key]: idFrom
|
|
2410
2441
|
}
|
|
2411
2442
|
});
|
|
2412
2443
|
entity[relationName] = await modelTarget.group(options2, methodOptionsReal);
|
|
2413
2444
|
} else if (optionsReal.aggrs) {
|
|
2414
2445
|
const options2 = deepExtend({}, optionsReal, {
|
|
2415
2446
|
where: {
|
|
2416
|
-
[
|
|
2447
|
+
[key]: idFrom
|
|
2417
2448
|
}
|
|
2418
2449
|
});
|
|
2419
2450
|
entity[relationName] = await modelTarget.aggregate(options2, methodOptionsReal);
|
|
2420
2451
|
} else {
|
|
2421
2452
|
const options2 = deepExtend({}, optionsReal, {
|
|
2422
2453
|
where: {
|
|
2423
|
-
[
|
|
2454
|
+
[key]: idFrom
|
|
2424
2455
|
}
|
|
2425
2456
|
});
|
|
2426
2457
|
entity[relationName] = await modelTarget.select(options2, methodOptionsReal);
|
|
@@ -2441,14 +2472,14 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2441
2472
|
if (optionsReal.groups) {
|
|
2442
2473
|
const options2 = deepExtend({}, optionsReal, {
|
|
2443
2474
|
where: {
|
|
2444
|
-
|
|
2475
|
+
id: idsTo
|
|
2445
2476
|
}
|
|
2446
2477
|
});
|
|
2447
2478
|
entity[relationName] = await modelTarget.group(options2, methodOptionsReal);
|
|
2448
2479
|
} else if (optionsReal.aggrs) {
|
|
2449
2480
|
const options2 = deepExtend({}, optionsReal, {
|
|
2450
2481
|
where: {
|
|
2451
|
-
|
|
2482
|
+
id: idsTo
|
|
2452
2483
|
}
|
|
2453
2484
|
});
|
|
2454
2485
|
entity[relationName] = await modelTarget.aggregate(options2, methodOptionsReal);
|
|
@@ -2471,7 +2502,6 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2471
2502
|
options
|
|
2472
2503
|
} = relationReal;
|
|
2473
2504
|
const modelTarget = this.__getModelTarget(model, options?.meta);
|
|
2474
|
-
const tableNameTarget = modelTarget.getTable();
|
|
2475
2505
|
const optionsReal = Object.assign({}, options, {
|
|
2476
2506
|
include: includeReal,
|
|
2477
2507
|
with: withReal
|
|
@@ -2513,11 +2543,11 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2513
2543
|
} else if (type === 'hasMany') {
|
|
2514
2544
|
const idsFrom = entities.map(item => cast(item).id).filter(id => !isNil(id));
|
|
2515
2545
|
if (optionsReal.groups) {
|
|
2516
|
-
const groups = [
|
|
2546
|
+
const groups = [key].concat(optionsReal.groups);
|
|
2517
2547
|
const options2 = deepExtend({}, optionsReal, {
|
|
2518
2548
|
groups,
|
|
2519
2549
|
where: {
|
|
2520
|
-
[
|
|
2550
|
+
[key]: idsFrom
|
|
2521
2551
|
}
|
|
2522
2552
|
});
|
|
2523
2553
|
const items = await modelTarget.group(options2, methodOptionsReal);
|
|
@@ -2532,9 +2562,9 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2532
2562
|
}
|
|
2533
2563
|
} else if (optionsReal.aggrs) {
|
|
2534
2564
|
const options2 = deepExtend({}, optionsReal, {
|
|
2535
|
-
groups:
|
|
2565
|
+
groups: key,
|
|
2536
2566
|
where: {
|
|
2537
|
-
[
|
|
2567
|
+
[key]: idsFrom
|
|
2538
2568
|
}
|
|
2539
2569
|
});
|
|
2540
2570
|
const items = await modelTarget.group(options2, methodOptionsReal);
|
|
@@ -2550,7 +2580,7 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2550
2580
|
const options2 = deepExtend({}, optionsReal, {
|
|
2551
2581
|
columns,
|
|
2552
2582
|
where: {
|
|
2553
|
-
[
|
|
2583
|
+
[key]: idsFrom
|
|
2554
2584
|
}
|
|
2555
2585
|
});
|
|
2556
2586
|
const items = await modelTarget.select(options2, methodOptionsReal);
|
|
@@ -2583,7 +2613,7 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2583
2613
|
const options2 = deepExtend({}, optionsReal, {
|
|
2584
2614
|
groups: optionsReal.groups,
|
|
2585
2615
|
where: {
|
|
2586
|
-
|
|
2616
|
+
id: idsTo
|
|
2587
2617
|
}
|
|
2588
2618
|
});
|
|
2589
2619
|
entity[relationName] = await modelTarget.group(options2, methodOptionsReal);
|
|
@@ -2593,7 +2623,7 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2593
2623
|
const idsTo = itemsMiddle.filter(item => item[keyFrom] === cast(entity).id).map(item => item[keyTo]);
|
|
2594
2624
|
const options2 = deepExtend({}, optionsReal, {
|
|
2595
2625
|
where: {
|
|
2596
|
-
|
|
2626
|
+
id: idsTo
|
|
2597
2627
|
}
|
|
2598
2628
|
});
|
|
2599
2629
|
entity[relationName] = await modelTarget.aggregate(options2, methodOptionsReal);
|
|
@@ -2839,7 +2869,7 @@ let ServiceRelations = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
|
2839
2869
|
handleRelationsCollection(includeWrapper) {
|
|
2840
2870
|
return handleRelationsCollection(this._model.options.relations, includeWrapper);
|
|
2841
2871
|
}
|
|
2842
|
-
}) || _class$
|
|
2872
|
+
}) || _class$d) || _class$d);
|
|
2843
2873
|
|
|
2844
2874
|
class BeanModelCrud extends BeanModelCrudInner {
|
|
2845
2875
|
async mget(ids, options) {
|
|
@@ -2900,7 +2930,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
2900
2930
|
async __insertBulk_raw(table, items, options) {
|
|
2901
2931
|
if (items.length === 0) return [];
|
|
2902
2932
|
// table
|
|
2903
|
-
table = table || this.getTable();
|
|
2933
|
+
table = table || this.getTable(items[0]);
|
|
2904
2934
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2905
2935
|
// insert
|
|
2906
2936
|
const res = await this._insertBulk(table, items, options);
|
|
@@ -2918,7 +2948,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
2918
2948
|
}
|
|
2919
2949
|
async __mutateBulk_raw(table, items, options) {
|
|
2920
2950
|
// table
|
|
2921
|
-
table = table || this.getTable();
|
|
2951
|
+
table = table || this.getTable(items[0]);
|
|
2922
2952
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2923
2953
|
// check
|
|
2924
2954
|
const indexesInsert = [];
|
|
@@ -2980,7 +3010,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
2980
3010
|
}
|
|
2981
3011
|
async __mget_raw(table, ids, options) {
|
|
2982
3012
|
// table
|
|
2983
|
-
table = table || this.getTable();
|
|
3013
|
+
table = table || this.getTable(undefined);
|
|
2984
3014
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
2985
3015
|
// check if cache
|
|
2986
3016
|
if (this._checkDisableCacheEntityByOptions(options)) {
|
|
@@ -3021,7 +3051,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3021
3051
|
}
|
|
3022
3052
|
async __aggregate_raw(table, params, options) {
|
|
3023
3053
|
// table
|
|
3024
|
-
table = table || this.getTable();
|
|
3054
|
+
table = table || this.getTable(params?.where);
|
|
3025
3055
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3026
3056
|
const items = await this.__select_cache(table, params, options);
|
|
3027
3057
|
return this.convertItemsToBigNumber(items);
|
|
@@ -3031,7 +3061,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3031
3061
|
}
|
|
3032
3062
|
async __group_raw(table, params, options) {
|
|
3033
3063
|
// table
|
|
3034
|
-
table = table || this.getTable();
|
|
3064
|
+
table = table || this.getTable(params?.where);
|
|
3035
3065
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3036
3066
|
const items = await this.__select_cache(table, params, options);
|
|
3037
3067
|
return this.convertItemsToBigNumber(items);
|
|
@@ -3076,7 +3106,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3076
3106
|
}
|
|
3077
3107
|
async __select_raw(table, params, options) {
|
|
3078
3108
|
// table
|
|
3079
|
-
table = table || this.getTable();
|
|
3109
|
+
table = table || this.getTable(params?.where);
|
|
3080
3110
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3081
3111
|
// check if cache
|
|
3082
3112
|
if (this._checkDisableCacheEntityByOptions(options)) {
|
|
@@ -3144,7 +3174,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3144
3174
|
}
|
|
3145
3175
|
async __get_raw(table, where, options) {
|
|
3146
3176
|
// table
|
|
3147
|
-
table = table || this.getTable();
|
|
3177
|
+
table = table || this.getTable(where);
|
|
3148
3178
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3149
3179
|
// check if cache
|
|
3150
3180
|
if (this._checkDisableCacheEntityByOptions(options)) {
|
|
@@ -3199,7 +3229,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3199
3229
|
}
|
|
3200
3230
|
async __update_raw(table, data, options) {
|
|
3201
3231
|
// table
|
|
3202
|
-
table = table || this.getTable();
|
|
3232
|
+
table = table || this.getTable(data);
|
|
3203
3233
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3204
3234
|
// check if cache
|
|
3205
3235
|
if (this._checkDisableCacheEntityByOptions(options)) {
|
|
@@ -3277,7 +3307,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3277
3307
|
}
|
|
3278
3308
|
async __delete_raw(table, where, options) {
|
|
3279
3309
|
// table
|
|
3280
|
-
table = table || this.getTable();
|
|
3310
|
+
table = table || this.getTable(where);
|
|
3281
3311
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3282
3312
|
// check if cache
|
|
3283
3313
|
if (this._checkDisableCacheEntityByOptions(options)) {
|
|
@@ -3361,7 +3391,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3361
3391
|
this._shardingCacheDoubleDelete({
|
|
3362
3392
|
beanFullName: this.$beanFullName,
|
|
3363
3393
|
clientName: this.db.clientName,
|
|
3364
|
-
table
|
|
3394
|
+
table,
|
|
3365
3395
|
method: 'cacheEntityDelInner',
|
|
3366
3396
|
args: [id, table]
|
|
3367
3397
|
});
|
|
@@ -3380,7 +3410,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3380
3410
|
this._shardingCacheDoubleDelete({
|
|
3381
3411
|
beanFullName: this.$beanFullName,
|
|
3382
3412
|
clientName: this.db.clientName,
|
|
3383
|
-
table
|
|
3413
|
+
table,
|
|
3384
3414
|
method: 'cacheEntityClearInner',
|
|
3385
3415
|
args: [table]
|
|
3386
3416
|
});
|
|
@@ -3399,7 +3429,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3399
3429
|
this._shardingCacheDoubleDelete({
|
|
3400
3430
|
beanFullName: this.$beanFullName,
|
|
3401
3431
|
clientName: this.db.clientName,
|
|
3402
|
-
table
|
|
3432
|
+
table,
|
|
3403
3433
|
method: 'cacheQueryClearInner',
|
|
3404
3434
|
args: [table]
|
|
3405
3435
|
});
|
|
@@ -3500,16 +3530,16 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3500
3530
|
}
|
|
3501
3531
|
}
|
|
3502
3532
|
|
|
3503
|
-
var _dec$
|
|
3504
|
-
let BeanModelBase = (_dec$
|
|
3533
|
+
var _dec$c, _dec2$c, _dec3$2, _class$c;
|
|
3534
|
+
let BeanModelBase = (_dec$c = Bean(), _dec2$c = Virtual(), _dec3$2 = BeanInfo({
|
|
3505
3535
|
module: "a-orm"
|
|
3506
|
-
}), _dec$
|
|
3536
|
+
}), _dec$c(_class$c = _dec2$c(_class$c = _dec3$2(_class$c = class BeanModelBase extends BeanModelCache {}) || _class$c) || _class$c) || _class$c);
|
|
3507
3537
|
|
|
3508
|
-
var _dec$
|
|
3538
|
+
var _dec$b, _dec2$b, _dec3$1, _dec4$1, _class$b;
|
|
3509
3539
|
const SymbolModuleScope$1 = Symbol('SymbolModuleScope');
|
|
3510
|
-
let ServiceEntityResolver = (_dec$
|
|
3540
|
+
let ServiceEntityResolver = (_dec$b = Service(), _dec2$b = BeanInfo({
|
|
3511
3541
|
module: "a-orm"
|
|
3512
|
-
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3542
|
+
}), _dec3$1 = Reflect.metadata("design:type", Function), _dec4$1 = Reflect.metadata("design:paramtypes", [String]), _dec$b(_class$b = _dec2$b(_class$b = _dec3$1(_class$b = _dec4$1(_class$b = class ServiceEntityResolver extends BeanBase {
|
|
3513
3543
|
constructor(moduleScope) {
|
|
3514
3544
|
super();
|
|
3515
3545
|
this[SymbolModuleScope$1] = void 0;
|
|
@@ -3524,13 +3554,13 @@ let ServiceEntityResolver = (_dec$9 = Service(), _dec2$9 = BeanInfo({
|
|
|
3524
3554
|
}
|
|
3525
3555
|
return this.__instances[prop];
|
|
3526
3556
|
}
|
|
3527
|
-
}) || _class$
|
|
3557
|
+
}) || _class$b) || _class$b) || _class$b) || _class$b);
|
|
3528
3558
|
|
|
3529
|
-
var _dec$
|
|
3559
|
+
var _dec$a, _dec2$a, _dec3, _dec4, _class$a;
|
|
3530
3560
|
const SymbolModuleScope = Symbol('SymbolModuleScope');
|
|
3531
|
-
let ServiceModelResolver = (_dec$
|
|
3561
|
+
let ServiceModelResolver = (_dec$a = Service(), _dec2$a = BeanInfo({
|
|
3532
3562
|
module: "a-orm"
|
|
3533
|
-
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$
|
|
3563
|
+
}), _dec3 = Reflect.metadata("design:type", Function), _dec4 = Reflect.metadata("design:paramtypes", [String]), _dec$a(_class$a = _dec2$a(_class$a = _dec3(_class$a = _dec4(_class$a = class ServiceModelResolver extends BeanBase {
|
|
3534
3564
|
constructor(moduleScope) {
|
|
3535
3565
|
super();
|
|
3536
3566
|
this[SymbolModuleScope] = void 0;
|
|
@@ -3540,12 +3570,12 @@ let ServiceModelResolver = (_dec$8 = Service(), _dec2$8 = BeanInfo({
|
|
|
3540
3570
|
const beanFullName = `${this[SymbolModuleScope]}.model.${prop}`;
|
|
3541
3571
|
return this.bean._getBean(beanFullName);
|
|
3542
3572
|
}
|
|
3543
|
-
}) || _class$
|
|
3573
|
+
}) || _class$a) || _class$a) || _class$a) || _class$a);
|
|
3544
3574
|
|
|
3545
|
-
var _dec$
|
|
3546
|
-
let BroadcastColumnsClear = (_dec$
|
|
3575
|
+
var _dec$9, _dec2$9, _class$9;
|
|
3576
|
+
let BroadcastColumnsClear = (_dec$9 = Broadcast(), _dec2$9 = BeanInfo({
|
|
3547
3577
|
module: "a-orm"
|
|
3548
|
-
}), _dec$
|
|
3578
|
+
}), _dec$9(_class$9 = _dec2$9(_class$9 = class BroadcastColumnsClear extends BeanBroadcastBase {
|
|
3549
3579
|
async execute(data, isEmitter) {
|
|
3550
3580
|
const {
|
|
3551
3581
|
clientName,
|
|
@@ -3555,12 +3585,26 @@ let BroadcastColumnsClear = (_dec$7 = Broadcast(), _dec2$7 = BeanInfo({
|
|
|
3555
3585
|
await cast(this.scope.service.database).__columnsClearRaw(clientName, tableName);
|
|
3556
3586
|
}
|
|
3557
3587
|
}
|
|
3558
|
-
}) || _class$
|
|
3588
|
+
}) || _class$9) || _class$9);
|
|
3559
3589
|
|
|
3560
|
-
var _dec$
|
|
3561
|
-
let
|
|
3590
|
+
var _dec$8, _dec2$8, _class$8;
|
|
3591
|
+
let BroadcastDatabaseClientDispose = (_dec$8 = Broadcast(), _dec2$8 = BeanInfo({
|
|
3562
3592
|
module: "a-orm"
|
|
3563
|
-
}), _dec$
|
|
3593
|
+
}), _dec$8(_class$8 = _dec2$8(_class$8 = class BroadcastDatabaseClientDispose extends BeanBroadcastBase {
|
|
3594
|
+
async execute(data, isEmitter) {
|
|
3595
|
+
const {
|
|
3596
|
+
clientName
|
|
3597
|
+
} = data;
|
|
3598
|
+
if (!isEmitter) {
|
|
3599
|
+
await cast(this.scope.service.database).disposeClientsRaw(clientName);
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
}) || _class$8) || _class$8);
|
|
3603
|
+
|
|
3604
|
+
var _dec$7, _dec2$7, _class$7;
|
|
3605
|
+
let BroadcastDatabaseClientReload = (_dec$7 = Broadcast(), _dec2$7 = BeanInfo({
|
|
3606
|
+
module: "a-orm"
|
|
3607
|
+
}), _dec$7(_class$7 = _dec2$7(_class$7 = class BroadcastDatabaseClientReload extends BeanBroadcastBase {
|
|
3564
3608
|
async execute(data, isEmitter) {
|
|
3565
3609
|
const {
|
|
3566
3610
|
clientName,
|
|
@@ -3568,20 +3612,25 @@ let BroadcastDatabaseClientReload = (_dec$6 = Broadcast(), _dec2$6 = BeanInfo({
|
|
|
3568
3612
|
extraData
|
|
3569
3613
|
} = data;
|
|
3570
3614
|
if (!isEmitter) {
|
|
3571
|
-
await cast(this.scope.service.database).
|
|
3615
|
+
await cast(this.scope.service.database).reloadClientsRaw(clientName, clientConfig, extraData);
|
|
3572
3616
|
}
|
|
3573
3617
|
}
|
|
3574
|
-
}) || _class$
|
|
3618
|
+
}) || _class$7) || _class$7);
|
|
3619
|
+
|
|
3620
|
+
var _dec$6, _dec2$6, _class$6;
|
|
3621
|
+
let EventClientNameReal = (_dec$6 = Event(), _dec2$6 = BeanInfo({
|
|
3622
|
+
module: "a-orm"
|
|
3623
|
+
}), _dec$6(_class$6 = _dec2$6(_class$6 = class EventClientNameReal extends BeanEventBase {}) || _class$6) || _class$6);
|
|
3575
3624
|
|
|
3576
3625
|
var _dec$5, _dec2$5, _class$5;
|
|
3577
|
-
let
|
|
3626
|
+
let EventColumnsClear = (_dec$5 = Event(), _dec2$5 = BeanInfo({
|
|
3578
3627
|
module: "a-orm"
|
|
3579
|
-
}), _dec$5(_class$5 = _dec2$5(_class$5 = class
|
|
3628
|
+
}), _dec$5(_class$5 = _dec2$5(_class$5 = class EventColumnsClear extends BeanEventBase {}) || _class$5) || _class$5);
|
|
3580
3629
|
|
|
3581
3630
|
var _dec$4, _dec2$4, _class$4;
|
|
3582
|
-
let
|
|
3631
|
+
let EventDatabaseClientDispose = (_dec$4 = Event(), _dec2$4 = BeanInfo({
|
|
3583
3632
|
module: "a-orm"
|
|
3584
|
-
}), _dec$4(_class$4 = _dec2$4(_class$4 = class
|
|
3633
|
+
}), _dec$4(_class$4 = _dec2$4(_class$4 = class EventDatabaseClientDispose extends BeanEventBase {}) || _class$4) || _class$4);
|
|
3585
3634
|
|
|
3586
3635
|
var _dec$3, _dec2$3, _class$3;
|
|
3587
3636
|
let EventDatabaseClientReload = (_dec$3 = Event(), _dec2$3 = BeanInfo({
|
|
@@ -4345,4 +4394,4 @@ const $relationMutate = {
|
|
|
4345
4394
|
belongsToMany
|
|
4346
4395
|
};
|
|
4347
4396
|
|
|
4348
|
-
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 };
|
|
4397
|
+
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, BroadcastDatabaseClientDispose, BroadcastDatabaseClientReload, Database, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, Errors, EventClientNameReal, EventColumnsClear, EventDatabaseClientDispose, 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 };
|