vona-module-a-orm 5.0.64 → 5.0.66
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 +22 -27
- package/dist/types/dto/dtoSelectAndCount.d.ts +4 -2
- package/dist/types/relations.d.ts +4 -2
- package/dist/types/relationsAggr.d.ts +1 -2
- package/dist/types/relationsGroup.d.ts +1 -1
- package/package.json +1 -3
|
@@ -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,9 +3040,13 @@ 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) {
|
|
3046
|
+
// pageNo/pageSize
|
|
3047
|
+
const pageSize = params?.limit;
|
|
3048
|
+
if (!pageSize) throw new Error('should specify the page size');
|
|
3049
|
+
const pageNo = Math.floor(params.offset / pageSize) + 1;
|
|
3063
3050
|
// count
|
|
3064
3051
|
const paramsCount = Object.assign({}, params, {
|
|
3065
3052
|
columns: undefined,
|
|
@@ -3068,18 +3055,23 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3068
3055
|
offset: undefined
|
|
3069
3056
|
});
|
|
3070
3057
|
let count = await this.count(paramsCount, options, modelJoins);
|
|
3071
|
-
if (!count) count =
|
|
3058
|
+
if (!count) count = '0';
|
|
3072
3059
|
// list
|
|
3073
3060
|
let list;
|
|
3074
|
-
if (count
|
|
3061
|
+
if (count === '0') {
|
|
3075
3062
|
list = [];
|
|
3076
3063
|
} else {
|
|
3077
3064
|
list = await this.select(params, options, modelJoins);
|
|
3078
3065
|
}
|
|
3066
|
+
// pageNo/pageSize/pageCount
|
|
3067
|
+
const pageCount = Math.ceil(BigNumber(count).div(pageSize).toNumber());
|
|
3079
3068
|
// ok
|
|
3080
3069
|
return {
|
|
3081
3070
|
list,
|
|
3082
|
-
total: count
|
|
3071
|
+
total: count,
|
|
3072
|
+
pageCount,
|
|
3073
|
+
pageSize,
|
|
3074
|
+
pageNo
|
|
3083
3075
|
};
|
|
3084
3076
|
}
|
|
3085
3077
|
async select(params, options, _modelJoins) {
|
|
@@ -3950,7 +3942,7 @@ function _DtoAggregate_inner(classTarget, _modelLike, aggrs) {
|
|
|
3950
3942
|
if (!columns) continue;
|
|
3951
3943
|
for (const column of columns) {
|
|
3952
3944
|
const column2 = `${key}_${column === '*' ? 'all' : column}`;
|
|
3953
|
-
Api.field(v.optional(),
|
|
3945
|
+
Api.field(v.optional(), z.string())(classTarget.prototype, column2);
|
|
3954
3946
|
}
|
|
3955
3947
|
}
|
|
3956
3948
|
return classTarget;
|
|
@@ -4175,7 +4167,10 @@ function DtoSelectAndCount(modelLike, params) {
|
|
|
4175
4167
|
class TargetClass {}
|
|
4176
4168
|
const DtoGetResult = DtoGet(modelLike, params);
|
|
4177
4169
|
Api.field(v.array(DtoGetResult))(TargetClass.prototype, 'list');
|
|
4178
|
-
Api.field(
|
|
4170
|
+
Api.field(z.string())(TargetClass.prototype, 'total');
|
|
4171
|
+
Api.field(z.number())(TargetClass.prototype, 'pageCount');
|
|
4172
|
+
Api.field(z.number())(TargetClass.prototype, 'pageSize');
|
|
4173
|
+
Api.field(z.number())(TargetClass.prototype, 'pageNo');
|
|
4179
4174
|
return TargetClass;
|
|
4180
4175
|
}
|
|
4181
4176
|
|
|
@@ -4403,4 +4398,4 @@ const $relationMutate = {
|
|
|
4403
4398
|
belongsToMany
|
|
4404
4399
|
};
|
|
4405
4400
|
|
|
4406
|
-
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,
|
|
4401
|
+
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,8 +1,10 @@
|
|
|
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;
|
|
7
|
+
pageCount: number;
|
|
8
|
+
pageSize: number;
|
|
9
|
+
pageNo: number;
|
|
8
10
|
}
|
|
@@ -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,10 @@ 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;
|
|
103
|
+
pageCount: number;
|
|
104
|
+
pageSize: number;
|
|
105
|
+
pageNo: number;
|
|
104
106
|
}
|
|
105
107
|
export type TypeModelRelationResult<TRecord, TModel extends BeanModelMeta | undefined, TOptionsRelation, TColumns = undefined, Aggrs = undefined, Groups = undefined, Depth extends TypeDepthPrev[number] = TypeDepthPrevMax> = Groups extends string | string[] ? TypeModelGroupRelationResultGroups<TRecord, Aggrs, Groups, TColumns> : Aggrs extends {} ? TypeModelAggrRelationResultAggrs<Aggrs> : TypeModelRelationResult_Normal<TRecord, TModel, TOptionsRelation, TColumns, Depth>;
|
|
106
108
|
export type TypeModelRelationResult_Normal<TRecord, TModel extends BeanModelMeta | undefined, TOptionsRelation, TColumns = undefined, Depth extends TypeDepthPrev[number] = TypeDepthPrevMax> = TypeUtilEntitySelector<TRecord, TypeUtilPrepareColumns<TColumns extends string | string[] ? TColumns : TypeUtilGetParamsColumns<TOptionsRelation>>> & (TModel extends BeanModelMeta ? (OmitNever<TypeModelRelationResultMergeInclude<TypeUtilGetModelOptions<TModel>, TypeUtilGetParamsInlcude<TOptionsRelation>, Depth>> & OmitNever<TypeModelRelationResultMergeWith<TypeUtilGetParamsWith<TOptionsRelation>, Depth>>) : {});
|
|
@@ -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.66",
|
|
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,7 +58,6 @@
|
|
|
59
58
|
"static"
|
|
60
59
|
],
|
|
61
60
|
"dependencies": {
|
|
62
|
-
"bignumber.js": "^9.3.1",
|
|
63
61
|
"knex": "^3.1.0",
|
|
64
62
|
"table-identity": "^1.0.10"
|
|
65
63
|
},
|