vona-module-a-orm 5.1.5 → 5.1.7
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/entity/metadata/generate.ts +13 -3
- package/cli/model/metadata/generate.ts +6 -3
- package/cli/model/metadata/magic.ts +6 -1
- package/dist/.metadata/index.d.ts +25 -25
- package/dist/.metadata/index.d.ts.map +1 -1
- package/dist/.metadata/locales.d.ts.map +1 -1
- package/dist/bean/aopMethod.transaction.d.ts.map +1 -1
- package/dist/bean/bean.database.d.ts.map +1 -1
- package/dist/bean/bean.databaseDialectBase.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_cache.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_crud.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_crud_inner.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_crud_table.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_knex.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_meta.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_utils.d.ts.map +1 -1
- package/dist/bean/bean.model/bean.model_view.d.ts.map +1 -1
- package/dist/bean/event.clientNameReal.d.ts.map +1 -1
- package/dist/bean/event.columnsClear.d.ts.map +1 -1
- package/dist/bean/queue.doubleDelete.d.ts.map +1 -1
- package/dist/bean/schedule.softDeletionPrune.d.ts.map +1 -1
- package/dist/common/buildWhere.d.ts.map +1 -1
- package/dist/common/utils.d.ts.map +1 -1
- package/dist/extend/schemaBuilder.d.ts.map +1 -1
- package/dist/extend/tableBuilder.d.ts.map +1 -1
- package/dist/index.js +33 -33
- package/dist/index.js.map +1 -1
- package/dist/lib/const.d.ts.map +1 -1
- package/dist/lib/databaseDialect.d.ts.map +1 -1
- package/dist/lib/dto/dtoAggregate.d.ts.map +1 -1
- package/dist/lib/dto/dtoCreate.d.ts.map +1 -1
- package/dist/lib/dto/dtoGet.d.ts.map +1 -1
- package/dist/lib/dto/dtoGroup.d.ts.map +1 -1
- package/dist/lib/dto/dtoListAndCount.d.ts.map +1 -1
- package/dist/lib/dto/dtoMutate.d.ts.map +1 -1
- package/dist/lib/dto/dtoQueryPage.d.ts.map +1 -1
- package/dist/lib/dto/dtoSelectAndCount.d.ts.map +1 -1
- package/dist/lib/dto/dtoUpdate.d.ts.map +1 -1
- package/dist/lib/entity.d.ts.map +1 -1
- package/dist/lib/modelCacheBase.d.ts.map +1 -1
- package/dist/lib/relations.d.ts.map +1 -1
- package/dist/lib/relationsDynamic.d.ts.map +1 -1
- package/dist/lib/relationsMutate.d.ts.map +1 -1
- package/dist/lib/relationsStatic.d.ts.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/service/columnsCache_.d.ts.map +1 -1
- package/dist/service/database.d.ts.map +1 -1
- package/dist/service/databaseClient_.d.ts.map +1 -1
- package/dist/service/relations_.d.ts.map +1 -1
- package/dist/service/transaction_.d.ts.map +1 -1
- package/dist/types/dto/dtoGet.d.ts.map +1 -1
- package/dist/types/dto/dtoGroup.d.ts.map +1 -1
- package/dist/types/dto/dtoMutate.d.ts.map +1 -1
- package/dist/types/dto/dtoQueryBase.d.ts.map +1 -1
- package/dist/types/dto/dtoSelectAndCount.d.ts.map +1 -1
- package/dist/types/entity.d.ts.map +1 -1
- package/dist/types/model.d.ts +5 -1
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/modelAggr.d.ts.map +1 -1
- package/dist/types/modelCount.d.ts.map +1 -1
- package/dist/types/modelGeneral.d.ts.map +1 -1
- package/dist/types/modelGroup.d.ts.map +1 -1
- package/dist/types/modelIncrement.d.ts.map +1 -1
- package/dist/types/modelWhere.d.ts.map +1 -1
- package/dist/types/onion/entity.d.ts +2 -2
- package/dist/types/onion/entity.d.ts.map +1 -1
- package/dist/types/onion/model.d.ts.map +1 -1
- package/dist/types/relations.d.ts.map +1 -1
- package/dist/types/relationsAggr.d.ts +1 -1
- package/dist/types/relationsAggr.d.ts.map +1 -1
- package/dist/types/relationsColumns.d.ts.map +1 -1
- package/dist/types/relationsDef.d.ts.map +1 -1
- package/dist/types/relationsDefDynamic.d.ts.map +1 -1
- package/dist/types/relationsDefMutate.d.ts.map +1 -1
- package/dist/types/relationsGroup.d.ts.map +1 -1
- package/dist/types/relationsMutate.d.ts.map +1 -1
- package/dist/types/relationsTables.d.ts.map +1 -1
- package/dist/types/transaction.d.ts.map +1 -1
- package/dist-cli/entity/metadata/generate.js +4 -1
- package/dist-cli/model/metadata/generate.js +4 -2
- package/package.json +1 -1
- package/src/.metadata/index.ts +39 -39
- package/src/.metadata/locales.ts +6 -1
- package/src/bean/aopMethod.transaction.ts +9 -2
- package/src/bean/bean.database.ts +33 -8
- package/src/bean/bean.databaseDialectBase.ts +42 -9
- package/src/bean/bean.model/bean.model_cache.ts +130 -46
- package/src/bean/bean.model/bean.model_crud.ts +28 -7
- package/src/bean/bean.model/bean.model_crud_inner.ts +17 -4
- package/src/bean/bean.model/bean.model_crud_table.ts +25 -5
- package/src/bean/bean.model/bean.model_knex.ts +18 -5
- package/src/bean/bean.model/bean.model_meta.ts +23 -5
- package/src/bean/bean.model/bean.model_utils.ts +55 -12
- package/src/bean/bean.model/bean.model_view.ts +20 -5
- package/src/bean/event.clientNameReal.ts +4 -1
- package/src/bean/event.columnsClear.ts +4 -1
- package/src/bean/queue.doubleDelete.ts +9 -2
- package/src/bean/schedule.softDeletionPrune.ts +3 -1
- package/src/common/buildWhere.ts +30 -5
- package/src/common/utils.ts +6 -2
- package/src/extend/schemaBuilder.ts +2 -1
- package/src/extend/tableBuilder.ts +32 -19
- package/src/lib/const.ts +3 -1
- package/src/lib/databaseDialect.ts +3 -1
- package/src/lib/dto/dtoAggregate.ts +18 -6
- package/src/lib/dto/dtoCreate.ts +24 -4
- package/src/lib/dto/dtoGet.ts +82 -17
- package/src/lib/dto/dtoGroup.ts +24 -8
- package/src/lib/dto/dtoListAndCount.ts +3 -1
- package/src/lib/dto/dtoMutate.ts +26 -7
- package/src/lib/dto/dtoQueryPage.ts +4 -1
- package/src/lib/dto/dtoSelectAndCount.ts +3 -1
- package/src/lib/dto/dtoUpdate.ts +24 -4
- package/src/lib/entity.ts +10 -4
- package/src/lib/modelCacheBase.ts +9 -3
- package/src/lib/relations.ts +22 -4
- package/src/lib/relationsDynamic.ts +29 -7
- package/src/lib/relationsMutate.ts +28 -5
- package/src/lib/relationsStatic.ts +4 -1
- package/src/lib/utils.ts +11 -2
- package/src/main.ts +10 -2
- package/src/service/columnsCache_.ts +8 -6
- package/src/service/database.ts +34 -10
- package/src/service/databaseClient_.ts +4 -1
- package/src/service/relations_.ts +98 -23
- package/src/service/transaction_.ts +14 -4
- package/src/types/dto/dtoGet.ts +14 -6
- package/src/types/dto/dtoGroup.ts +2 -1
- package/src/types/dto/dtoMutate.ts +102 -20
- package/src/types/dto/dtoQueryBase.ts +5 -1
- package/src/types/dto/dtoSelectAndCount.ts +4 -1
- package/src/types/entity.ts +3 -1
- package/src/types/entityBase.ts +1 -1
- package/src/types/entityBaseInner.ts +4 -4
- package/src/types/entityBaseSimple.ts +1 -1
- package/src/types/model.ts +73 -16
- package/src/types/modelAggr.ts +18 -6
- package/src/types/modelCount.ts +4 -1
- package/src/types/modelGeneral.ts +26 -5
- package/src/types/modelGroup.ts +8 -2
- package/src/types/modelIncrement.ts +4 -1
- package/src/types/modelWhere.ts +12 -3
- package/src/types/onion/entity.ts +2 -2
- package/src/types/onion/model.ts +20 -4
- package/src/types/relations.ts +151 -47
- package/src/types/relationsAggr.ts +35 -11
- package/src/types/relationsColumns.ts +80 -57
- package/src/types/relationsDef.ts +82 -29
- package/src/types/relationsDefDynamic.ts +59 -13
- package/src/types/relationsDefMutate.ts +3 -1
- package/src/types/relationsGroup.ts +32 -10
- package/src/types/relationsMutate.ts +60 -19
- package/src/types/relationsTables.ts +16 -14
- package/src/types/transaction.ts +14 -2
|
@@ -2,7 +2,10 @@ import type { BeanModelMeta } from '../../bean/bean.model/bean.model_meta.ts';
|
|
|
2
2
|
import type { IModelClassRecord } from '../onion/model.ts';
|
|
3
3
|
import type { TypeDtoGetResult } from './dtoGet.ts';
|
|
4
4
|
|
|
5
|
-
export interface TypeDtoSelectAndCountResult<
|
|
5
|
+
export interface TypeDtoSelectAndCountResult<
|
|
6
|
+
ModelLike extends BeanModelMeta | keyof IModelClassRecord,
|
|
7
|
+
TOptionsRelation,
|
|
8
|
+
> {
|
|
6
9
|
list: TypeDtoGetResult<ModelLike, TOptionsRelation>[];
|
|
7
10
|
total: string;
|
|
8
11
|
pageCount: number;
|
package/src/types/entity.ts
CHANGED
|
@@ -12,4 +12,6 @@ export const SymbolKeyFieldsMore = Symbol('$fieldsMore');
|
|
|
12
12
|
export type TypeSymbolKeyFieldsMore = typeof SymbolKeyFieldsMore;
|
|
13
13
|
|
|
14
14
|
export type TypeEntityStudentMetaSimple<T> = Omit<T, '$table' | '$comment' | '$default'>;
|
|
15
|
-
export type TypeEntityStudentMetaSimpleColumns<T> = PickString<
|
|
15
|
+
export type TypeEntityStudentMetaSimpleColumns<T> = PickString<
|
|
16
|
+
keyof TypeEntityStudentMetaSimple<T>
|
|
17
|
+
>;
|
package/src/types/entityBase.ts
CHANGED
|
@@ -6,6 +6,6 @@ import { $locale } from '../.metadata/locales.ts';
|
|
|
6
6
|
import { EntityBaseInner } from './entityBaseInner.ts';
|
|
7
7
|
|
|
8
8
|
export class EntityBase extends EntityBaseInner {
|
|
9
|
-
@Api.field(v.
|
|
9
|
+
@Api.field(v.title($locale('TableIdentity')), v.tableIdentity())
|
|
10
10
|
id: TableIdentity;
|
|
11
11
|
}
|
|
@@ -4,15 +4,15 @@ import { $locale } from '../.metadata/locales.ts';
|
|
|
4
4
|
import { EntityBaseEmpty } from './entityBaseEmpty.ts';
|
|
5
5
|
|
|
6
6
|
export class EntityBaseInner extends EntityBaseEmpty {
|
|
7
|
-
@Api.field(v.title($locale('CreatedAt'))
|
|
7
|
+
@Api.field(v.title($locale('CreatedAt')))
|
|
8
8
|
createdAt: Date;
|
|
9
9
|
|
|
10
|
-
@Api.field(v.title($locale('UpdatedAt'))
|
|
10
|
+
@Api.field(v.title($locale('UpdatedAt')))
|
|
11
11
|
updatedAt: Date;
|
|
12
12
|
|
|
13
|
-
@Api.field(v.title($locale('Deleted')), v.
|
|
13
|
+
@Api.field(v.title($locale('Deleted')), v.default(false))
|
|
14
14
|
deleted: boolean;
|
|
15
15
|
|
|
16
|
-
@Api.field(v.title($locale('InstanceId')), v.
|
|
16
|
+
@Api.field(v.title($locale('InstanceId')), v.default(0))
|
|
17
17
|
iid: number;
|
|
18
18
|
}
|
|
@@ -4,6 +4,6 @@ import { $locale } from '../.metadata/locales.ts';
|
|
|
4
4
|
import { EntityBaseInner } from './entityBaseInner.ts';
|
|
5
5
|
|
|
6
6
|
export class EntityBaseSimple extends EntityBaseInner {
|
|
7
|
-
@Api.field(v.
|
|
7
|
+
@Api.field(v.title($locale('TableIdentity')))
|
|
8
8
|
id: number;
|
|
9
9
|
}
|
package/src/types/model.ts
CHANGED
|
@@ -2,9 +2,22 @@ import type { Knex } from 'knex';
|
|
|
2
2
|
import type { TSummerCacheActionOptions } from 'vona-module-a-summer';
|
|
3
3
|
|
|
4
4
|
import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import type {
|
|
6
|
+
TypeModelColumn,
|
|
7
|
+
TypeModelColumns,
|
|
8
|
+
TypeModelColumnsPatch,
|
|
9
|
+
TypeModelWhere,
|
|
10
|
+
} from './modelWhere.ts';
|
|
11
|
+
import type {
|
|
12
|
+
TypeModelOfModelLike,
|
|
13
|
+
TypeModelParamsInclude,
|
|
14
|
+
TypeModelsClassLikeGeneral,
|
|
15
|
+
TypeSymbolKeyEntity,
|
|
16
|
+
} from './relations.ts';
|
|
17
|
+
import type {
|
|
18
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
19
|
+
TypeEntityTableColumnsOfGeneral,
|
|
20
|
+
} from './relationsColumns.ts';
|
|
8
21
|
import type { TypeModelMutateParamsInclude } from './relationsMutate.ts';
|
|
9
22
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
10
23
|
|
|
@@ -30,7 +43,11 @@ export type IModelSelectParamsJoin<TRecord, TableNames = undefined, ColumnNames
|
|
|
30
43
|
// order
|
|
31
44
|
export type IModelSelectParamsOrderDirection = 'asc' | 'desc';
|
|
32
45
|
export type IModelSelectParamsOrderNulls = 'first' | 'last';
|
|
33
|
-
export type IModelSelectParamsOrder<ColumnNames> = [
|
|
46
|
+
export type IModelSelectParamsOrder<ColumnNames> = [
|
|
47
|
+
ColumnNames,
|
|
48
|
+
IModelSelectParamsOrderDirection?,
|
|
49
|
+
IModelSelectParamsOrderNulls?,
|
|
50
|
+
];
|
|
34
51
|
|
|
35
52
|
export interface IBuildModelSelectParams<
|
|
36
53
|
TRecord,
|
|
@@ -39,7 +56,15 @@ export interface IBuildModelSelectParams<
|
|
|
39
56
|
ColumnNames = keyof TRecord,
|
|
40
57
|
Columns extends {} | undefined = undefined,
|
|
41
58
|
>
|
|
42
|
-
extends
|
|
59
|
+
extends
|
|
60
|
+
IModelRelationIncludeWrapper<Model>,
|
|
61
|
+
IBuildModelSelectParamsBasic<
|
|
62
|
+
TRecord,
|
|
63
|
+
TypeModelColumn<TRecord>,
|
|
64
|
+
TableNames,
|
|
65
|
+
ColumnNames,
|
|
66
|
+
Columns
|
|
67
|
+
> {}
|
|
43
68
|
|
|
44
69
|
export interface IBuildModelSelectParamsBasic<
|
|
45
70
|
TRecord,
|
|
@@ -101,11 +126,26 @@ export type IModelCountParams<
|
|
|
101
126
|
>;
|
|
102
127
|
|
|
103
128
|
export type IModelMethodOptions = IModelMethodOptionsGeneral;
|
|
104
|
-
export type IModelInsertOptions<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
export type
|
|
129
|
+
export type IModelInsertOptions<
|
|
130
|
+
TRecord,
|
|
131
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
132
|
+
> = IModelInsertOptionsGeneral<TRecord, Model>;
|
|
133
|
+
export type IModelUpdateOptions<
|
|
134
|
+
TRecord,
|
|
135
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
136
|
+
> = IModelUpdateOptionsGeneral<TRecord, Model>;
|
|
137
|
+
export type IModelDeleteOptions<
|
|
138
|
+
TRecord,
|
|
139
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
140
|
+
> = IModelDeleteOptionsGeneral<TRecord, Model>;
|
|
141
|
+
export type IModelGetOptions<
|
|
142
|
+
TRecord,
|
|
143
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
144
|
+
> = IModelGetOptionsGeneral<TRecord, Model>;
|
|
145
|
+
export type IModelMutateOptions<
|
|
146
|
+
TRecord,
|
|
147
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
148
|
+
> = IModelMutateOptionsGeneral<TRecord, Model>;
|
|
109
149
|
|
|
110
150
|
export interface IModelMethodOptionsGeneral {
|
|
111
151
|
disableDeleted?: boolean;
|
|
@@ -117,23 +157,38 @@ export interface IModelMethodOptionsGeneral {
|
|
|
117
157
|
cache?: TSummerCacheActionOptions<unknown, unknown>;
|
|
118
158
|
}
|
|
119
159
|
|
|
120
|
-
export interface IModelInsertOptionsGeneral<
|
|
160
|
+
export interface IModelInsertOptionsGeneral<
|
|
161
|
+
_TRecord,
|
|
162
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
163
|
+
>
|
|
121
164
|
extends IModelMethodOptionsGeneral, IModelMutateRelationIncludeWrapper<Model> {}
|
|
122
165
|
|
|
123
|
-
export interface IModelUpdateOptionsGeneral<
|
|
166
|
+
export interface IModelUpdateOptionsGeneral<
|
|
167
|
+
TRecord,
|
|
168
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
169
|
+
>
|
|
124
170
|
extends IModelMethodOptionsGeneral, IModelMutateRelationIncludeWrapper<Model> {
|
|
125
171
|
where?: TypeModelWhere<TRecord>;
|
|
126
172
|
}
|
|
127
173
|
|
|
128
|
-
export interface IModelDeleteOptionsGeneral<
|
|
174
|
+
export interface IModelDeleteOptionsGeneral<
|
|
175
|
+
_TRecord,
|
|
176
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
177
|
+
>
|
|
129
178
|
extends IModelMethodOptionsGeneral, IModelMutateRelationIncludeWrapper<Model> {}
|
|
130
179
|
|
|
131
|
-
export interface IModelGetOptionsGeneral<
|
|
180
|
+
export interface IModelGetOptionsGeneral<
|
|
181
|
+
TRecord,
|
|
182
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
183
|
+
>
|
|
132
184
|
extends IModelMethodOptionsGeneral, IModelRelationIncludeWrapper<Model> {
|
|
133
185
|
columns?: TypeModelColumns<TRecord>;
|
|
134
186
|
}
|
|
135
187
|
|
|
136
|
-
export interface IModelMutateOptionsGeneral<
|
|
188
|
+
export interface IModelMutateOptionsGeneral<
|
|
189
|
+
_TRecord,
|
|
190
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
191
|
+
>
|
|
137
192
|
extends IModelMethodOptionsGeneral, IModelMutateRelationIncludeWrapper<Model> {}
|
|
138
193
|
|
|
139
194
|
export interface IModelSelectParamsPage {
|
|
@@ -146,7 +201,9 @@ export interface IModelRelationIncludeWrapper<Model extends BeanModelMeta | unde
|
|
|
146
201
|
with?: Record<string, unknown>;
|
|
147
202
|
}
|
|
148
203
|
|
|
149
|
-
export interface IModelMutateRelationIncludeWrapper<
|
|
204
|
+
export interface IModelMutateRelationIncludeWrapper<
|
|
205
|
+
Model extends BeanModelMeta | undefined = undefined,
|
|
206
|
+
> {
|
|
150
207
|
include?: TypeModelMutateParamsInclude<Model>;
|
|
151
208
|
with?: Record<string, unknown>;
|
|
152
209
|
}
|
package/src/types/modelAggr.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
|
4
4
|
import type { IModelSelectParamsJoin } from './model.ts';
|
|
5
5
|
import type { TypeModelColumns, TypeModelWhere } from './modelWhere.ts';
|
|
6
6
|
import type { TypeModelsClassLikeGeneral } from './relations.ts';
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
9
|
+
TypeEntityTableColumnsOfGeneral,
|
|
10
|
+
} from './relationsColumns.ts';
|
|
8
11
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
9
12
|
|
|
10
13
|
// export interface TypeModelSelectAggrParamsAggrs<TRecord> {
|
|
@@ -17,13 +20,22 @@ import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
|
17
20
|
|
|
18
21
|
export interface TypeModelSelectAggrParamsAggrs<TRecord> {
|
|
19
22
|
count?: TypeModelColumns<TRecord>;
|
|
20
|
-
sum?:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
sum?:
|
|
24
|
+
| TypeEntityTableColumnNamesForAggrs<TRecord>
|
|
25
|
+
| Array<TypeEntityTableColumnNamesForAggrs<TRecord>>;
|
|
26
|
+
avg?:
|
|
27
|
+
| TypeEntityTableColumnNamesForAggrs<TRecord>
|
|
28
|
+
| Array<TypeEntityTableColumnNamesForAggrs<TRecord>>;
|
|
29
|
+
max?:
|
|
30
|
+
| TypeEntityTableColumnNamesForAggrs<TRecord>
|
|
31
|
+
| Array<TypeEntityTableColumnNamesForAggrs<TRecord>>;
|
|
32
|
+
min?:
|
|
33
|
+
| TypeEntityTableColumnNamesForAggrs<TRecord>
|
|
34
|
+
| Array<TypeEntityTableColumnNamesForAggrs<TRecord>>;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
export type TypeEntityTableColumnNamesForAggrs<Entity> =
|
|
37
|
+
export type TypeEntityTableColumnNamesForAggrs<Entity> =
|
|
38
|
+
keyof TypeEntityTableColumnsForAggrs<Entity>;
|
|
27
39
|
|
|
28
40
|
export type TypeEntityTableColumnsForAggrs<Entity> = OmitNever<
|
|
29
41
|
Omit<
|
package/src/types/modelCount.ts
CHANGED
|
@@ -2,7 +2,10 @@ import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
|
2
2
|
import type { IModelSelectParamsJoin } from './model.ts';
|
|
3
3
|
import type { TypeModelColumn, TypeModelWhere } from './modelWhere.ts';
|
|
4
4
|
import type { TypeModelsClassLikeGeneral } from './relations.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
7
|
+
TypeEntityTableColumnsOfGeneral,
|
|
8
|
+
} from './relationsColumns.ts';
|
|
6
9
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
7
10
|
|
|
8
11
|
export interface IBuildModelSelectCountParams<
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IModelRelationIncludeWrapper,
|
|
4
|
+
IModelSelectParamsJoin,
|
|
5
|
+
IModelSelectParamsOrder,
|
|
6
|
+
} from './model.ts';
|
|
3
7
|
import type { TypeModelSelectAggrParamsAggrs } from './modelAggr.ts';
|
|
4
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
TypeModelColumn,
|
|
10
|
+
TypeModelColumnsPatch,
|
|
11
|
+
TypeModelColumnsStrict,
|
|
12
|
+
TypeModelWhere,
|
|
13
|
+
} from './modelWhere.ts';
|
|
5
14
|
import type { TypeModelsClassLikeGeneral } from './relations.ts';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
15
|
+
import type {
|
|
16
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
17
|
+
TypeEntityTableColumnsOfGeneral,
|
|
18
|
+
} from './relationsColumns.ts';
|
|
19
|
+
import type {
|
|
20
|
+
TypeModelSelectGroupParamsColumnNames,
|
|
21
|
+
TypeModelSelectGroupParamsColumns,
|
|
22
|
+
} from './relationsGroup.ts';
|
|
8
23
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
9
24
|
|
|
10
25
|
export interface IBuildModelSelectGeneralParams<
|
|
@@ -16,7 +31,13 @@ export interface IBuildModelSelectGeneralParams<
|
|
|
16
31
|
>
|
|
17
32
|
extends
|
|
18
33
|
IModelRelationIncludeWrapper<Model>,
|
|
19
|
-
IBuildModelSelectGeneralParamsBasic<
|
|
34
|
+
IBuildModelSelectGeneralParamsBasic<
|
|
35
|
+
TRecord,
|
|
36
|
+
TypeModelColumn<TRecord>,
|
|
37
|
+
TableNames,
|
|
38
|
+
ColumnNames,
|
|
39
|
+
Columns
|
|
40
|
+
> {}
|
|
20
41
|
|
|
21
42
|
export interface IBuildModelSelectGeneralParamsBasic<
|
|
22
43
|
TRecord,
|
package/src/types/modelGroup.ts
CHANGED
|
@@ -3,8 +3,14 @@ import type { IModelSelectParamsJoin, IModelSelectParamsOrder } from './model.ts
|
|
|
3
3
|
import type { TypeModelSelectAggrParamsAggrs } from './modelAggr.ts';
|
|
4
4
|
import type { TypeModelColumnsStrict, TypeModelWhere } from './modelWhere.ts';
|
|
5
5
|
import type { TypeModelsClassLikeGeneral } from './relations.ts';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
6
|
+
import type {
|
|
7
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
8
|
+
TypeEntityTableColumnsOfGeneral,
|
|
9
|
+
} from './relationsColumns.ts';
|
|
10
|
+
import type {
|
|
11
|
+
TypeModelSelectGroupParamsColumnNames,
|
|
12
|
+
TypeModelSelectGroupParamsColumns,
|
|
13
|
+
} from './relationsGroup.ts';
|
|
8
14
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
9
15
|
|
|
10
16
|
export interface IBuildModelSelectGroupParams<
|
|
@@ -4,7 +4,10 @@ import type { BeanModelMeta } from '../bean/bean.model/bean.model_meta.ts';
|
|
|
4
4
|
import type { IModelSelectParamsJoin } from './model.ts';
|
|
5
5
|
import type { TypeModelWhere } from './modelWhere.ts';
|
|
6
6
|
import type { TypeModelsClassLikeGeneral } from './relations.ts';
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
TypeEntityTableColumnNamesOfGeneral,
|
|
9
|
+
TypeEntityTableColumnsOfGeneral,
|
|
10
|
+
} from './relationsColumns.ts';
|
|
8
11
|
import type { TypeEntityTableNamesOfGeneral } from './relationsTables.ts';
|
|
9
12
|
|
|
10
13
|
export type TypeModelIncrementParamsColumns<Entity> = OmitNever<
|
package/src/types/modelWhere.ts
CHANGED
|
@@ -52,7 +52,12 @@ export type TypeOpsNormal = TypeRecordValues<typeof OpNormal>;
|
|
|
52
52
|
export type TypeOpsAll = TypeRecordValues<typeof Op>;
|
|
53
53
|
|
|
54
54
|
// not use Knex.Raw
|
|
55
|
-
export type TypeModelColumnValue<TRecord, Column> =
|
|
55
|
+
export type TypeModelColumnValue<TRecord, Column> =
|
|
56
|
+
| keyof TRecord
|
|
57
|
+
| Column
|
|
58
|
+
| Column[]
|
|
59
|
+
| null
|
|
60
|
+
| '_skip_';
|
|
56
61
|
|
|
57
62
|
export type TypeModelWhere<TRecord, Columns extends {} | undefined = undefined> = Columns extends {}
|
|
58
63
|
? TypeModelWhereInner<Columns>
|
|
@@ -61,7 +66,9 @@ export type TypeModelWhere<TRecord, Columns extends {} | undefined = undefined>
|
|
|
61
66
|
// Columns extends {} ? TypeModelWhereInner<Columns> | Knex.Raw : TypeModelWhereInner<TRecord> | Knex.Raw;
|
|
62
67
|
|
|
63
68
|
export type TypeModelWhereInner<TRecord> = {
|
|
64
|
-
[prop in keyof TRecord]?:
|
|
69
|
+
[prop in keyof TRecord]?:
|
|
70
|
+
| TypeModelColumnValue<TRecord, TRecord[prop]>
|
|
71
|
+
| TypeModelWhereFieldAll<TRecord, TRecord[prop]>;
|
|
65
72
|
} & {
|
|
66
73
|
[key in TypeOpsJoint]?: TypeModelWhereInner<TRecord>;
|
|
67
74
|
};
|
|
@@ -78,7 +85,9 @@ export type TypeModelWhereFieldJoint<TRecord, Column> = {
|
|
|
78
85
|
|
|
79
86
|
export type TypeModelColumn<TRecord> = keyof TRecord | '*';
|
|
80
87
|
export type TypeModelColumns<TRecord> = TypeModelColumn<TRecord> | Array<TypeModelColumn<TRecord>>;
|
|
81
|
-
export type TypeModelColumnPatch<TRecord, TColumn> = TColumn extends '*'
|
|
88
|
+
export type TypeModelColumnPatch<TRecord, TColumn> = TColumn extends '*'
|
|
89
|
+
? TypeModelColumn<TRecord>
|
|
90
|
+
: TColumn;
|
|
82
91
|
export type TypeModelColumnsPatch<TRecord, TColumn> = [TColumn] extends [string]
|
|
83
92
|
? TypeModelColumnPatch<TRecord, TColumn> | Array<TypeModelColumnPatch<TRecord, TColumn>>
|
|
84
93
|
: TColumn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OmitNever } from 'vona';
|
|
2
2
|
import type { ServiceOnion } from 'vona-module-a-onion';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ISchemaObjectExtensionField } from 'vona-module-a-openapi';
|
|
4
4
|
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
5
5
|
|
|
6
6
|
import type { SymbolKeyFieldsMore } from '../entity.ts';
|
|
@@ -12,7 +12,7 @@ export interface IDecoratorEntityOptions<FieldsMore = never> {
|
|
|
12
12
|
[SymbolKeyFieldsMore]?: FieldsMore;
|
|
13
13
|
table?: keyof ITableRecord;
|
|
14
14
|
independent?: boolean;
|
|
15
|
-
openapi?:
|
|
15
|
+
openapi?: ISchemaObjectExtensionField;
|
|
16
16
|
pipes?: SchemaLike | SchemaLike[];
|
|
17
17
|
}
|
|
18
18
|
|
package/src/types/onion/model.ts
CHANGED
|
@@ -11,13 +11,29 @@ import type { ITableRecord } from './table.ts';
|
|
|
11
11
|
export interface IModelRecord {}
|
|
12
12
|
export interface IModelClassRecord {}
|
|
13
13
|
|
|
14
|
-
export type TypeDynamicTableName = (
|
|
14
|
+
export type TypeDynamicTableName = (
|
|
15
|
+
ctx: VonaContext,
|
|
16
|
+
where: any | undefined,
|
|
17
|
+
defaultTable: keyof ITableRecord,
|
|
18
|
+
modelInstance: any,
|
|
19
|
+
) => string;
|
|
15
20
|
|
|
16
|
-
export type TypeDynamicClientName = (
|
|
21
|
+
export type TypeDynamicClientName = (
|
|
22
|
+
ctx: VonaContext,
|
|
23
|
+
modelInstance: any,
|
|
24
|
+
) => keyof IDatabaseClientRecord;
|
|
17
25
|
|
|
18
|
-
export type TypeModelsClearedByFn = (
|
|
26
|
+
export type TypeModelsClearedByFn = (
|
|
27
|
+
ctx: VonaContext,
|
|
28
|
+
modelTarget: any,
|
|
29
|
+
modelSource: any,
|
|
30
|
+
) => Promise<void>;
|
|
19
31
|
|
|
20
|
-
export type TypeSoftDeletionPruneHandler = (
|
|
32
|
+
export type TypeSoftDeletionPruneHandler = (
|
|
33
|
+
ctx: VonaContext,
|
|
34
|
+
modelInstance: any,
|
|
35
|
+
options: ISoftDeletionPruneHandlerOptions,
|
|
36
|
+
) => Promise<void>;
|
|
21
37
|
|
|
22
38
|
export interface ISoftDeletionPruneHandlerOptions {
|
|
23
39
|
expired: number;
|