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