vona-module-a-orm 5.0.65 → 5.0.67
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/bean/bean.model/bean.model_cache.d.ts +1 -2
- package/dist/bean/bean.model/bean.model_crud.d.ts +1 -2
- package/dist/bean/bean.model/bean.model_crud_inner.d.ts +1 -2
- package/dist/bean/bean.model/bean.model_crud_table.d.ts +1 -2
- package/dist/bean/bean.model/bean.model_utils.d.ts +2 -3
- package/dist/common/buildWhere.d.ts +0 -1
- package/dist/index.js +17 -30
- package/dist/types/dto/dtoSelectAndCount.d.ts +1 -2
- package/dist/types/relations.d.ts +1 -2
- package/dist/types/relationsAggr.d.ts +1 -2
- package/dist/types/relationsGroup.d.ts +1 -1
- package/package.json +2 -4
|
@@ -40,7 +40,7 @@ export default async function (options: IMetadataCustomGenerateOptions): Promise
|
|
|
40
40
|
deleteBulk<T extends IModelDeleteOptions<${entityName},${className}>>(ids: TableIdentity[], options?: T): Promise<void>;
|
|
41
41
|
mutate<T extends IModelMutateOptions<${entityName},${className}>>(data?: TypeModelMutateRelationData<${entityName},${className}, T>, options?: T): Promise<TypeModelMutateRelationData<${entityName},${className}, T>>;
|
|
42
42
|
mutateBulk<T extends IModelMutateOptions<${entityName},${className}>>(items: TypeModelMutateRelationData<${entityName},${className}, T>[], options?: T): Promise<TypeModelMutateRelationData<${entityName},${className}, T>[]>;
|
|
43
|
-
count<T extends IModelSelectCountParams<${entityName},${className},ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<
|
|
43
|
+
count<T extends IModelSelectCountParams<${entityName},${className},ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<string | undefined>;
|
|
44
44
|
aggregate<T extends IModelSelectAggrParams<${entityName},${className},ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelAggrRelationResult<T>>;
|
|
45
45
|
group<T extends IModelSelectGroupParams<${entityName},${className},ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelGroupRelationResult<${entityName}, T>[]>;
|
|
46
46
|
${magics.join('\n')}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { ServiceDb } from '../../service/db_.ts';
|
|
3
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';
|
|
4
|
-
import BigNumber from 'bignumber.js';
|
|
5
4
|
import { ServiceCacheEntity } from '../../service/cacheEntity_.ts';
|
|
6
5
|
import { ServiceCacheQuery } from '../../service/cacheQuery_.ts';
|
|
7
6
|
import { ServiceRelations } from '../../service/relations_.ts';
|
|
@@ -21,7 +20,7 @@ export declare class BeanModelCache<TRecord extends {} = {}> extends BeanModelCr
|
|
|
21
20
|
__mutateBulk_raw(table: keyof ITableRecord | undefined, items: Partial<TRecord>[], options?: IModelMutateOptions<TRecord>): Promise<TRecord[]>;
|
|
22
21
|
mget<T extends IModelGetOptions<TRecord>>(ids: TableIdentity[], options?: T): Promise<Partial<TRecord>[]>;
|
|
23
22
|
private __mget_raw;
|
|
24
|
-
count<T extends IModelSelectCountParams<TRecord>, ModelJoins extends TypeModelsClassLikeGeneral | undefined>(params?: T, options?: IModelMethodOptions, _modelJoins?: ModelJoins): Promise<
|
|
23
|
+
count<T extends IModelSelectCountParams<TRecord>, ModelJoins extends TypeModelsClassLikeGeneral | undefined>(params?: T, options?: IModelMethodOptions, _modelJoins?: ModelJoins): Promise<string | undefined>;
|
|
25
24
|
aggregate<T extends IModelSelectAggrParams<TRecord>, ModelJoins extends TypeModelsClassLikeGeneral | undefined>(params?: T, options?: IModelMethodOptions, _modelJoins?: ModelJoins): Promise<TypeModelAggrRelationResult<T>>;
|
|
26
25
|
private __aggregate_raw;
|
|
27
26
|
group<T extends IModelSelectGroupParams<TRecord>, ModelJoins extends TypeModelsClassLikeGeneral | undefined>(params?: T, options?: IModelMethodOptions, _modelJoins?: ModelJoins): Promise<TypeModelGroupRelationResult<TRecord, T>[]>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { TableIdentity } from 'table-identity';
|
|
3
2
|
import type { IModelCountParams, IModelGetOptionsGeneral, IModelMethodOptionsGeneral, IModelSelectParams, IModelUpdateOptionsGeneral, TypeModelWhere } from '../../types/index.ts';
|
|
4
3
|
import { BeanModelCrudInner } from './bean.model_crud_inner.ts';
|
|
@@ -6,7 +5,7 @@ export declare class BeanModelCrud<TRecord extends {} = {}> extends BeanModelCru
|
|
|
6
5
|
mget(ids: TableIdentity[], options?: IModelGetOptionsGeneral<TRecord>): Promise<Partial<TRecord>[]>;
|
|
7
6
|
select(params?: IModelSelectParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<Partial<TRecord>[]>;
|
|
8
7
|
get(where: TypeModelWhere<TRecord>, options?: IModelGetOptionsGeneral<TRecord>): Promise<Partial<TRecord> | undefined>;
|
|
9
|
-
count(params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<
|
|
8
|
+
count(params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<string | undefined>;
|
|
10
9
|
insert(data?: Partial<TRecord>, options?: IModelMethodOptionsGeneral): Promise<TRecord>;
|
|
11
10
|
insertBulk(data: Partial<TRecord>[], options?: IModelMethodOptionsGeneral): Promise<TRecord[]>;
|
|
12
11
|
update(data: Partial<TRecord>, options?: IModelUpdateOptionsGeneral<TRecord>): Promise<Partial<TRecord>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { Knex } from 'knex';
|
|
3
2
|
import type { TableIdentity } from 'table-identity';
|
|
4
3
|
import type { IModelCountParams, IModelGetOptionsGeneral, IModelMethodOptionsGeneral, IModelSelectGeneralParams, IModelSelectParams, IModelUpdateOptionsGeneral, ITableRecord, TypeModelWhere } from '../../types/index.ts';
|
|
@@ -9,7 +8,7 @@ export declare class BeanModelCrudInner<TRecord extends {}> extends BeanModelVie
|
|
|
9
8
|
protected _select<T extends IModelSelectParams<TRecord>>(table?: keyof ITableRecord, params?: T, options?: IModelMethodOptionsGeneral, builder?: Knex.QueryBuilder<TRecord, TRecord[]>): Promise<TRecord[]>;
|
|
10
9
|
protected _select_buildParams<T extends IModelSelectGeneralParams<TRecord>>(table: keyof ITableRecord, params?: T, options?: IModelMethodOptionsGeneral): Knex.QueryBuilder<TRecord, TRecord[]>;
|
|
11
10
|
protected _get(table: keyof ITableRecord | undefined, where: TypeModelWhere<TRecord>, options?: IModelGetOptionsGeneral<TRecord>): Promise<TRecord | undefined>;
|
|
12
|
-
protected _count(table?: keyof ITableRecord, params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<
|
|
11
|
+
protected _count(table?: keyof ITableRecord, params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<string | undefined>;
|
|
13
12
|
protected _insertBulk(table?: keyof ITableRecord, data?: Partial<TRecord> | Partial<TRecord>[], options?: IModelMethodOptionsGeneral): Promise<TRecord | TRecord[]>;
|
|
14
13
|
protected _update(table: keyof ITableRecord | undefined, data: Partial<TRecord>, options?: IModelUpdateOptionsGeneral<TRecord>): Promise<Partial<TRecord>>;
|
|
15
14
|
protected _delete(table?: keyof ITableRecord, where?: TypeModelWhere<TRecord>, options?: IModelMethodOptionsGeneral): Promise<void>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { TableIdentity } from 'table-identity';
|
|
3
2
|
import type { IModelCountParams, IModelGetOptionsGeneral, IModelMethodOptionsGeneral, IModelSelectParams, IModelUpdateOptionsGeneral, ITableRecord, TypeModelWhere } from '../../types/index.ts';
|
|
4
3
|
import { BeanModelCrudInner } from './bean.model_crud_inner.ts';
|
|
@@ -6,7 +5,7 @@ export declare class BeanModelCrudTable<TRecord extends {}> extends BeanModelCru
|
|
|
6
5
|
mget(table: keyof ITableRecord, ids: TableIdentity[], options?: Omit<IModelGetOptionsGeneral<TRecord>, 'include' | 'with'>): Promise<TRecord[]>;
|
|
7
6
|
select(table: keyof ITableRecord, params?: Omit<IModelSelectParams<TRecord>, 'include' | 'with'>, options?: IModelMethodOptionsGeneral): Promise<TRecord[]>;
|
|
8
7
|
get(table: keyof ITableRecord, where: TypeModelWhere<TRecord>, options?: Omit<IModelGetOptionsGeneral<TRecord>, 'include' | 'with'>): Promise<TRecord | undefined>;
|
|
9
|
-
count(table: keyof ITableRecord, params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<
|
|
8
|
+
count(table: keyof ITableRecord, params?: IModelCountParams<TRecord>, options?: IModelMethodOptionsGeneral): Promise<string | undefined>;
|
|
10
9
|
insert(table: keyof ITableRecord, data?: Partial<TRecord>, options?: IModelMethodOptionsGeneral): Promise<TRecord>;
|
|
11
10
|
insertBulk(table: keyof ITableRecord, data: Partial<TRecord>[], options?: IModelMethodOptionsGeneral): Promise<TRecord[]>;
|
|
12
11
|
update(table: keyof ITableRecord, data: Partial<TRecord>, options?: IModelUpdateOptionsGeneral<TRecord>): Promise<Partial<TRecord>>;
|
|
@@ -29,9 +29,8 @@ export declare class BeanModelUtils<TRecord extends {}> extends BeanModelMeta<TR
|
|
|
29
29
|
prepareHaving(builder: Knex.QueryBuilder, having?: TypeModelWhere<TRecord, TypeModelSelectGroupParamsColumns<TRecord>>): void;
|
|
30
30
|
buildHaving(builder: Knex.QueryBuilder, having: TypeModelWhere<TRecord, TypeModelSelectGroupParamsColumns<TRecord>>): void;
|
|
31
31
|
prepareWhere(builder: Knex.QueryBuilder, table?: keyof ITableRecord, where?: TypeModelWhere<TRecord>, options?: IModelMethodOptionsGeneral): void;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
extractFirstNumber<T = number | BigNumber | undefined>(result: Array<object> | object, defaultValue?: T, columnName?: string): T extends undefined ? BigNumber | undefined : BigNumber;
|
|
32
|
+
extractCount(result: Array<object> | object, columnName?: string): string;
|
|
33
|
+
extractFirstNumber<T = number | string | undefined>(result: Array<object> | object, defaultValue?: T, columnName?: string): T extends undefined ? string | undefined : string;
|
|
35
34
|
extractFirstValue(result: Array<object> | object, defaultValue?: any, columnName?: string): any | undefined;
|
|
36
35
|
private _extractFirstValue;
|
|
37
36
|
protected _prepareWhereByOptions(table: keyof ITableRecord, where: any, options?: IModelMethodOptionsGeneral): any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
2
|
import type { TypeModelWhere } from '../types/modelWhere.ts';
|
|
3
3
|
export declare function buildWhere<TRecord>(knex: Knex, builder: Knex.QueryBuilder, wheres: TypeModelWhere<TRecord>, having?: boolean): void;
|
|
4
|
-
export declare function isAggrColumn(column: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BigNumber
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BeanInfo, BeanAopMethodBase, BeanBase, deepExtend, appResource, Virtual, beanFullNameFromOnionName, cast, useApp, BeanSimple, combineConfigDefault, BeanScopeBase, createBeanDecorator, PickClassInner, $Class } from 'vona';
|
|
3
3
|
import { AopMethod, Aspect } from 'vona-module-a-aspect';
|
|
4
4
|
import { Service, Bean, Scope } from 'vona-module-a-bean';
|
|
@@ -1115,11 +1115,6 @@ function _checkHavingColumn(knex, column) {
|
|
|
1115
1115
|
if (aggr === 'count' && name === 'all') name = '*';
|
|
1116
1116
|
return knex.raw(`${_safeOp(aggr)}(${_safeColumn(name)})`);
|
|
1117
1117
|
}
|
|
1118
|
-
function isAggrColumn(column) {
|
|
1119
|
-
const [aggr, name] = cast(column).split('_');
|
|
1120
|
-
if (!OpAggrs.includes(aggr) || !name) return false;
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
1118
|
function _checkOpJoint(op) {
|
|
1124
1119
|
for (const item of OpJointValues) {
|
|
1125
1120
|
if (op.startsWith(item)) {
|
|
@@ -1691,25 +1686,13 @@ class BeanModelUtils extends BeanModelMeta {
|
|
|
1691
1686
|
// build
|
|
1692
1687
|
this.buildWhere(builder, where);
|
|
1693
1688
|
}
|
|
1694
|
-
convertItemsToBigNumber(items) {
|
|
1695
|
-
for (const item of items) {
|
|
1696
|
-
for (const key in item) {
|
|
1697
|
-
if (isAggrColumn(key)) {
|
|
1698
|
-
if (!isNil(item[key])) {
|
|
1699
|
-
item[key] = BigNumber(item[key]);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
return items;
|
|
1705
|
-
}
|
|
1706
1689
|
extractCount(result, columnName) {
|
|
1707
1690
|
return this.extractFirstNumber(result, 0, columnName);
|
|
1708
1691
|
}
|
|
1709
1692
|
extractFirstNumber(result, defaultValue, columnName) {
|
|
1710
1693
|
const value = this.extractFirstValue(result, defaultValue, columnName);
|
|
1711
1694
|
if (value === undefined || value === null) return undefined;
|
|
1712
|
-
return
|
|
1695
|
+
return String(value);
|
|
1713
1696
|
}
|
|
1714
1697
|
extractFirstValue(result, defaultValue, columnName) {
|
|
1715
1698
|
const value = this._extractFirstValue(result, columnName);
|
|
@@ -3047,7 +3030,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3047
3030
|
table = table || this.getTable(params?.where);
|
|
3048
3031
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3049
3032
|
const items = await this.__select_cache(table, params, options);
|
|
3050
|
-
return
|
|
3033
|
+
return items;
|
|
3051
3034
|
}
|
|
3052
3035
|
async group(params, options, _modelJoins) {
|
|
3053
3036
|
return await this.__group_raw(undefined, params, options);
|
|
@@ -3057,7 +3040,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3057
3040
|
table = table || this.getTable(params?.where);
|
|
3058
3041
|
if (!table) return this.scopeOrm.error.ShouldSpecifyTable.throw();
|
|
3059
3042
|
const items = await this.__select_cache(table, params, options);
|
|
3060
|
-
return
|
|
3043
|
+
return items;
|
|
3061
3044
|
}
|
|
3062
3045
|
async selectAndCount(params, options, modelJoins) {
|
|
3063
3046
|
// pageNo/pageSize
|
|
@@ -3072,16 +3055,16 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3072
3055
|
offset: undefined
|
|
3073
3056
|
});
|
|
3074
3057
|
let count = await this.count(paramsCount, options, modelJoins);
|
|
3075
|
-
if (!count) count =
|
|
3058
|
+
if (!count) count = '0';
|
|
3076
3059
|
// list
|
|
3077
3060
|
let list;
|
|
3078
|
-
if (count
|
|
3061
|
+
if (count === '0') {
|
|
3079
3062
|
list = [];
|
|
3080
3063
|
} else {
|
|
3081
3064
|
list = await this.select(params, options, modelJoins);
|
|
3082
3065
|
}
|
|
3083
3066
|
// pageNo/pageSize/pageCount
|
|
3084
|
-
const pageCount = Math.ceil(count.div(pageSize).toNumber());
|
|
3067
|
+
const pageCount = Math.ceil(BigNumber(count).div(pageSize).toNumber());
|
|
3085
3068
|
// ok
|
|
3086
3069
|
return {
|
|
3087
3070
|
list,
|
|
@@ -3730,7 +3713,7 @@ function config(_app) {
|
|
|
3730
3713
|
}
|
|
3731
3714
|
},
|
|
3732
3715
|
table: {
|
|
3733
|
-
identityType: '
|
|
3716
|
+
identityType: 'bigint'
|
|
3734
3717
|
},
|
|
3735
3718
|
model: {
|
|
3736
3719
|
disableDeleted: false,
|
|
@@ -3805,10 +3788,12 @@ function ExtendTableBuilder(app) {
|
|
|
3805
3788
|
options = options || {};
|
|
3806
3789
|
if (options.id !== false) {
|
|
3807
3790
|
const _identityType = identityType ?? scope.config.table.identityType;
|
|
3808
|
-
if (_identityType === '
|
|
3791
|
+
if (_identityType === 'bigint') {
|
|
3809
3792
|
this.bigIncrements();
|
|
3810
3793
|
} else if (_identityType === 'number') {
|
|
3811
3794
|
this.increments();
|
|
3795
|
+
} else {
|
|
3796
|
+
throw new Error('Should create column id by yourself');
|
|
3812
3797
|
}
|
|
3813
3798
|
}
|
|
3814
3799
|
if (options.timestamps !== false) this.timestamps(true, true, true);
|
|
@@ -3826,10 +3811,12 @@ function ExtendTableBuilder(app) {
|
|
|
3826
3811
|
});
|
|
3827
3812
|
knex.TableBuilder.extend('tableIdentity', function (columnName) {
|
|
3828
3813
|
const _identityType = scope.config.table.identityType;
|
|
3829
|
-
if (_identityType === '
|
|
3814
|
+
if (_identityType === 'bigint') {
|
|
3830
3815
|
return this.bigInteger(columnName); // default value is null
|
|
3831
3816
|
} else if (_identityType === 'number') {
|
|
3832
3817
|
return this.integer(columnName); // default value is null
|
|
3818
|
+
} else {
|
|
3819
|
+
throw new Error(`Should create column ${columnName} by yourself`);
|
|
3833
3820
|
}
|
|
3834
3821
|
});
|
|
3835
3822
|
knex.TableBuilder.extend('userId', function (columnName) {
|
|
@@ -3959,7 +3946,7 @@ function _DtoAggregate_inner(classTarget, _modelLike, aggrs) {
|
|
|
3959
3946
|
if (!columns) continue;
|
|
3960
3947
|
for (const column of columns) {
|
|
3961
3948
|
const column2 = `${key}_${column === '*' ? 'all' : column}`;
|
|
3962
|
-
Api.field(v.optional(),
|
|
3949
|
+
Api.field(v.optional(), z.string())(classTarget.prototype, column2);
|
|
3963
3950
|
}
|
|
3964
3951
|
}
|
|
3965
3952
|
return classTarget;
|
|
@@ -4184,7 +4171,7 @@ function DtoSelectAndCount(modelLike, params) {
|
|
|
4184
4171
|
class TargetClass {}
|
|
4185
4172
|
const DtoGetResult = DtoGet(modelLike, params);
|
|
4186
4173
|
Api.field(v.array(DtoGetResult))(TargetClass.prototype, 'list');
|
|
4187
|
-
Api.field(
|
|
4174
|
+
Api.field(z.string())(TargetClass.prototype, 'total');
|
|
4188
4175
|
Api.field(z.number())(TargetClass.prototype, 'pageCount');
|
|
4189
4176
|
Api.field(z.number())(TargetClass.prototype, 'pageSize');
|
|
4190
4177
|
Api.field(z.number())(TargetClass.prototype, 'pageNo');
|
|
@@ -4415,4 +4402,4 @@ const $relationMutate = {
|
|
|
4415
4402
|
belongsToMany
|
|
4416
4403
|
};
|
|
4417
4404
|
|
|
4418
|
-
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, Database, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, Errors, EventClientNameReal, EventColumnsClear, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, Main, Model, Op, OpAggrs, OpJoint, OpJointValues, OpNormal, OpNormalValues, OpValues, QueueDoubleDelete, ScheduleSoftDeletionPrune, ScopeModuleAOrm, ServiceCacheEntity, ServiceCacheQuery, ServiceColumns, ServiceColumnsCache, ServiceDatabase, ServiceDatabaseAsyncLocalStorage, ServiceDatabaseClient, ServiceDb, ServiceEntityResolver, ServiceModelResolver, ServiceRelations, ServiceTransaction, ServiceTransactionAsyncLocalStorage, ServiceTransactionConsistency, ServiceTransactionFiber, ServiceTransactionState, SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyFieldsMore, SymbolKeyModelOptions, TransactionIsolationLevelsMap, buildWhere, config, configDefault, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName,
|
|
4405
|
+
export { $Dto, $column, $columns, $columnsAll, $locale, $relation, $relationDynamic, $relationMutate, $tableColumns, $tableComments, $tableDefaults, $tableName, AopMethodTransaction, BeanDatabase, BeanDatabaseDialectBase, BeanModel, BeanModelBase, BeanModelMeta, BroadcastColumnsClear, Database, DatabaseDialect, DtoQueryBase, DtoQueryPageBase, Entity, EntityBase, EntityBaseEmpty, EntityBaseInner, EntityBaseSimple, Errors, EventClientNameReal, EventColumnsClear, ExtendKnex, ExtendSchemaBuilder, ExtendTableBuilder, Main, Model, Op, OpAggrs, OpJoint, OpJointValues, OpNormal, OpNormalValues, OpValues, QueueDoubleDelete, ScheduleSoftDeletionPrune, ScopeModuleAOrm, ServiceCacheEntity, ServiceCacheQuery, ServiceColumns, ServiceColumnsCache, ServiceDatabase, ServiceDatabaseAsyncLocalStorage, ServiceDatabaseClient, ServiceDb, ServiceEntityResolver, ServiceModelResolver, ServiceRelations, ServiceTransaction, ServiceTransactionAsyncLocalStorage, ServiceTransactionConsistency, ServiceTransactionFiber, ServiceTransactionState, SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyFieldsMore, SymbolKeyModelOptions, TransactionIsolationLevelsMap, buildWhere, config, configDefault, getClassEntityFromClassModel, getTableOrTableAlias, getTargetColumnName, isRaw, isRef, locales, prepareClassModel, prepareColumns };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { BeanModelMeta } from '../../bean/bean.model/bean.model_meta.ts';
|
|
3
2
|
import type { IModelClassRecord } from '../onion/model.ts';
|
|
4
3
|
import type { TypeDtoGetResult } from './dtoGet.ts';
|
|
5
4
|
export interface TypeDtoSelectAndCountResult<ModelLike extends BeanModelMeta | (keyof IModelClassRecord), TOptionsRelation> {
|
|
6
5
|
list: TypeDtoGetResult<ModelLike, TOptionsRelation>[];
|
|
7
|
-
total:
|
|
6
|
+
total: string;
|
|
8
7
|
pageCount: number;
|
|
9
8
|
pageSize: number;
|
|
10
9
|
pageNo: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { Constructable, OmitNever } from 'vona';
|
|
3
2
|
import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
4
3
|
import type { TypeDepthPrev, TypeDepthPrevMax } from './depth.ts';
|
|
@@ -100,7 +99,7 @@ export type TypeUtilEntityPartial<TRecord, TColumns> = [
|
|
|
100
99
|
export type TypeUtilGetColumnsFromRelationAndIncludeWrapper<Relation, IncludeWrapper extends {} | undefined | unknown> = TypeUtilGetParamsColumns<IncludeWrapper> extends string | string[] ? TypeUtilGetParamsColumns<IncludeWrapper> : TypeUtilGetRelationOptionsColumns<Relation>;
|
|
101
100
|
export interface TypeModelSelectAndCount<TRecord, TModel extends BeanModelMeta | undefined, TOptionsRelation, TColumns = undefined, Aggrs = undefined, Groups = undefined, Depth extends TypeDepthPrev[number] = TypeDepthPrevMax> {
|
|
102
101
|
list: TypeModelRelationResult<TRecord, TModel, TOptionsRelation, TColumns, Aggrs, Groups, Depth>[];
|
|
103
|
-
total:
|
|
102
|
+
total: string;
|
|
104
103
|
pageCount: number;
|
|
105
104
|
pageSize: number;
|
|
106
105
|
pageNo: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
1
|
import type { TypeUtilGetParamsAggrs, TypeUtilGetRelationOptionsAggrs } from './relations.ts';
|
|
3
2
|
export type TypeModelAggrRelationResult<TOptions> = TypeUtilGetParamsAggrs<TOptions> extends {} ? TypeModelAggrRelationResultAggrs<TypeUtilGetParamsAggrs<TOptions>> : {};
|
|
4
3
|
export type TypeModelAggrRelationResultAggrs<Aggrs> = Aggrs extends {} ? TypeRecordAggrsValuesToObject<TypeRecordAggrsValues<{
|
|
@@ -8,7 +7,7 @@ export type TypeModelAggrRelationResultAggr<Aggr extends string, Columns extends
|
|
|
8
7
|
export type TypeUtilAggrPrepareColumns<TColumns> = TColumns extends string[] ? TColumns[number] : TColumns extends string ? TColumns : undefined;
|
|
9
8
|
export type TypeRecordAggrsValues<TRecord extends Record<string, any>> = TRecord[keyof TRecord];
|
|
10
9
|
export type TypeRecordAggrsValuesToObject<AggrValues extends string> = {
|
|
11
|
-
[K in AggrValues]:
|
|
10
|
+
[K in AggrValues]: string | undefined;
|
|
12
11
|
};
|
|
13
12
|
export type TypeUtilGetAggrsFromRelationAndIncludeWrapper<Relation, IncludeWrapper extends {} | undefined | unknown> = TypeUtilGetRelationOptionsAggrs<Relation> extends {} ? TypeUtilGetParamsAggrs<IncludeWrapper> extends {} ? TypeUtilGetAggrsFromRelationAndIncludeWrapper_Mixed<TypeUtilGetRelationOptionsAggrs<Relation>, TypeUtilGetParamsAggrs<IncludeWrapper>> : TypeUtilGetRelationOptionsAggrs<Relation> : undefined;
|
|
14
13
|
export type TypeUtilGetAggrsFromRelationAndIncludeWrapper_Mixed<RelationAggrs extends {}, IncludeWrapperAggrs extends {}> = {
|
|
@@ -16,6 +16,6 @@ export type TypeModelSelectGroupParamsColumns<TRecord, ColumnNames extends TypeM
|
|
|
16
16
|
[K in TypeUtilAggrPrepareColumns<ColumnNames>]: K extends keyof TRecord ? TRecord[K] : never;
|
|
17
17
|
} : {}) & TypeModelAggrRelationResultAggrsToNumberType<TypeModelAggrRelationResultAggrs<Aggrs>>;
|
|
18
18
|
export type TypeModelAggrRelationResultAggrsToNumberType<Columns> = {
|
|
19
|
-
[K in keyof Columns]:
|
|
19
|
+
[K in keyof Columns]: string;
|
|
20
20
|
};
|
|
21
21
|
export type TypeUtilGetGroupsFromRelationAndIncludeWrapper<Relation, IncludeWrapper extends {} | undefined | unknown> = TypeUtilGetParamsGroups<IncludeWrapper> extends string | string[] ? TypeUtilGetParamsGroups<IncludeWrapper> : TypeUtilGetRelationOptionsGroups<Relation>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-orm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.67",
|
|
5
5
|
"title": "a-orm",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
11
11
|
"globalDependencies": {
|
|
12
|
-
"bignumber.js": true,
|
|
13
12
|
"knex": true,
|
|
14
13
|
"table-identity": true
|
|
15
14
|
},
|
|
@@ -59,9 +58,8 @@
|
|
|
59
58
|
"static"
|
|
60
59
|
],
|
|
61
60
|
"dependencies": {
|
|
62
|
-
"bignumber.js": "^9.3.1",
|
|
63
61
|
"knex": "^3.1.0",
|
|
64
|
-
"table-identity": "^1.0.
|
|
62
|
+
"table-identity": "^1.0.11"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
65
|
"clean-package": "^2.2.0",
|