cabloy 5.1.249 → 5.1.251
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/.cabloy-version +1 -1
- package/.github/workflows/create-cabloy.yml +50 -3
- package/CHANGELOG.md +23 -0
- package/package.json +1 -1
- package/repo-agent-governance/managed-assets.json +12 -12
- package/repo-agent-governance/skills/cabloy-spec-execution/references/status-and-evidence.md +1 -1
- package/repo-agent-governance/skills/cabloy-spec-generation/references/canonical-spec-input.md +1 -1
- package/repo-agent-governance/skills/cabloy-spec-generation/references/repo-specs-document-set.md +2 -2
- package/repo-agent-governance/skills/cabloy-spec-generation/references/traceability-and-status-rules.md +1 -1
- package/repo-agent-governance/tools/spec-charts/generate-implementation-charts.mjs +73 -22
- package/repo-agent-governance/tools/spec-charts/generate-implementation-charts.test.mjs +98 -7
- package/repo-docs/ai/playbook-spec-execution.md +1 -1
- package/repo-docs/backend/crud-workflow.md +92 -1
- package/repo-docs/backend/dto-guide.md +16 -1
- package/repo-docs/backend/dto-infer-generation.md +23 -5
- package/repo-docs/backend/orm-aggregate-group-guide.md +32 -0
- package/repo-docs/backend/validation-guide.md +38 -2
- package/repo-e2e/specs/cabloy-basic.spec.ts +9 -2
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/aggregate/src/dto/{{resourceName}}AggregateRes.tsx_ +11 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/common/src/lib/{{resourceName}}Analysis.ts_ +14 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/common/test/{{resourceName}}Analysis.test.ts_ +81 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/group/src/dto/{{resourceName}}GroupResItem.tsx_ +11 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/controller/{{resourceName}}.ts_ +18 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}SelectReq.tsx_ +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/service/{{resourceName}}.ts_ +14 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/test/{{resourceName}}.test.ts_ +4 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/4-zh-cn.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/controller/{{resourceName}}.ts_ +18 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}SelectReq.tsx_ +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/service/{{resourceName}}.ts_ +14 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/test/{{resourceName}}.test.ts_ +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/4-zh-cn.ts +2 -0
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudBasic.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudStart.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.masterDetail.ts +9 -1
- package/vona/packages-cli/cli-set-api/src/lib/crudAnalysis.ts +11 -0
- package/vona/packages-cli/cli-set-api/test/crudAnalysis.test.ts +385 -0
- package/vona/packages-utils/babel-plugin-vona-bean-module/package.json +1 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +143 -88
- package/vona/pnpm-workspace.yaml +1 -1
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/index.ts +18 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/controller/student.ts +28 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentAggregateRes.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentGroupResItem.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/lib/studentAnalysis.ts +12 -0
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +22 -1
- package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +4 -0
- package/vona/src/suite/a-training/modules/training-student/test/studentAnalysis.test.ts +422 -0
- package/vona/src/suite-vendor/a-cabloy/modules/a-rbac/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/package.json +2 -2
- package/vona/src/suite-vendor/a-captcha/modules/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-hmr/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-locale/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapi/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/utils.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/.metadata/index.ts +26 -26
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/aggregateResult.ts +53 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/controls.ts +163 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/execute.ts +49 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/index.ts +3 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/policy.ts +140 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/bean.model/bean.model_cache.ts +4 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/bean.model/bean.model_crud_inner.ts +8 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dto.ts +3 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoAggregate.ts +4 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoAnalysis.ts +34 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/analysis.ts +137 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsAggr.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/aggregateResult.test.ts +81 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/analysis.test.ts +208 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/analysis.types.test.ts +112 -0
- package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-queue/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ratelimit/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-user/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/.metadata/index.ts +40 -40
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/pipe.filter.ts +44 -3
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/analysisFilter.ts +69 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/arguments.ts +6 -4
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/types/dto.ts +2 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/types/filter.ts +7 -2
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/package.json +2 -2
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-utils/zova-vite/package.json +1 -1
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +1 -1
- package/zova/pnpm-lock.yaml +11 -11
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +16 -2
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +201 -7
- package/zova/src/suite/a-training/modules/training-student/src/api/trainingStudent.ts +42 -0
- package/zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts +10 -0
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +5 -5
- /package/vona/patches/{zova-core@5.1.95.patch → zova-core@5.1.96.patch} +0 -0
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
// eslint-disable
|
|
2
|
+
/** filterTransform: begin */
|
|
3
|
+
export * from '../bean/filterTransform.base.ts';
|
|
4
|
+
export * from '../bean/filterTransform.dateRange.ts';
|
|
5
|
+
import type { IFilterTransformOptionsBase } from '../bean/filterTransform.base.ts';
|
|
6
|
+
import type { IFilterTransformOptionsDateRange } from '../bean/filterTransform.dateRange.ts';
|
|
7
|
+
import 'vona-module-a-web';
|
|
8
|
+
declare module 'vona-module-a-web' {
|
|
9
|
+
|
|
10
|
+
export interface IFilterTransformRecord {
|
|
11
|
+
'a-web:base': IFilterTransformOptionsBase;
|
|
12
|
+
'a-web:dateRange': IFilterTransformOptionsDateRange;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
declare module 'vona-module-a-web' {
|
|
18
|
+
|
|
19
|
+
export interface FilterTransformBase {
|
|
20
|
+
/** @internal */
|
|
21
|
+
get scope(): ScopeModuleAWeb;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface FilterTransformBase {
|
|
25
|
+
get $beanFullName(): 'a-web.filterTransform.base';
|
|
26
|
+
get $onionName(): 'a-web:base';
|
|
27
|
+
get $onionOptions(): IFilterTransformOptionsBase;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FilterTransformDateRange {
|
|
31
|
+
/** @internal */
|
|
32
|
+
get scope(): ScopeModuleAWeb;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface FilterTransformDateRange {
|
|
36
|
+
get $beanFullName(): 'a-web.filterTransform.dateRange';
|
|
37
|
+
get $onionName(): 'a-web:dateRange';
|
|
38
|
+
get $onionOptions(): IFilterTransformOptionsDateRange;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** filterTransform: end */
|
|
2
42
|
/** pipe: begin */
|
|
3
43
|
export * from '../bean/pipe.filter.ts';
|
|
4
44
|
export * from '../bean/pipe.valid.ts';
|
|
@@ -167,46 +207,6 @@ declare module 'vona-module-a-web' {
|
|
|
167
207
|
}
|
|
168
208
|
}
|
|
169
209
|
/** startup: end */
|
|
170
|
-
/** filterTransform: begin */
|
|
171
|
-
export * from '../bean/filterTransform.base.ts';
|
|
172
|
-
export * from '../bean/filterTransform.dateRange.ts';
|
|
173
|
-
import type { IFilterTransformOptionsBase } from '../bean/filterTransform.base.ts';
|
|
174
|
-
import type { IFilterTransformOptionsDateRange } from '../bean/filterTransform.dateRange.ts';
|
|
175
|
-
import 'vona-module-a-web';
|
|
176
|
-
declare module 'vona-module-a-web' {
|
|
177
|
-
|
|
178
|
-
export interface IFilterTransformRecord {
|
|
179
|
-
'a-web:base': IFilterTransformOptionsBase;
|
|
180
|
-
'a-web:dateRange': IFilterTransformOptionsDateRange;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
declare module 'vona-module-a-web' {
|
|
186
|
-
|
|
187
|
-
export interface FilterTransformBase {
|
|
188
|
-
/** @internal */
|
|
189
|
-
get scope(): ScopeModuleAWeb;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export interface FilterTransformBase {
|
|
193
|
-
get $beanFullName(): 'a-web.filterTransform.base';
|
|
194
|
-
get $onionName(): 'a-web:base';
|
|
195
|
-
get $onionOptions(): IFilterTransformOptionsBase;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface FilterTransformDateRange {
|
|
199
|
-
/** @internal */
|
|
200
|
-
get scope(): ScopeModuleAWeb;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface FilterTransformDateRange {
|
|
204
|
-
get $beanFullName(): 'a-web.filterTransform.dateRange';
|
|
205
|
-
get $onionName(): 'a-web:dateRange';
|
|
206
|
-
get $onionOptions(): IFilterTransformOptionsDateRange;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/** filterTransform: end */
|
|
210
210
|
/** config: begin */
|
|
211
211
|
export * from '../config/config.ts';
|
|
212
212
|
import type { config } from '../config/config.ts';
|
|
@@ -8,13 +8,15 @@ import type {
|
|
|
8
8
|
ITableQuery,
|
|
9
9
|
RouteHandlerArgumentMeta,
|
|
10
10
|
} from 'vona-module-a-openapi';
|
|
11
|
+
import type { IAnalysisPolicy, TypeAnalysisMode } from 'vona-module-a-orm';
|
|
11
12
|
import type { ValidatorOptions } from 'vona-module-a-validation';
|
|
12
13
|
|
|
13
14
|
import { isNil, isNilOrEmptyString } from '@cabloy/utils';
|
|
14
15
|
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
15
16
|
import { isNullableSchema } from '@cabloy/zod-query';
|
|
16
|
-
import { BeanBase, beanFullNameFromOnionName, cast } from 'vona';
|
|
17
|
+
import { BeanBase, beanFullNameFromOnionName, cast, runWithZodQueryCoercion } from 'vona';
|
|
17
18
|
import { createArgumentPipe, Pipe } from 'vona-module-a-aspect';
|
|
19
|
+
import { analysisFailure, resolveAnalysis } from 'vona-module-a-orm';
|
|
18
20
|
|
|
19
21
|
import type {
|
|
20
22
|
IFilterTransformRecord,
|
|
@@ -28,9 +30,13 @@ export type TypePipeFilterResult = TypeQueryParamsPatch;
|
|
|
28
30
|
type TypeQueryJoin = NonNullable<TypeQueryParamsPatch['joins']>[number];
|
|
29
31
|
|
|
30
32
|
export interface IPipeOptionsFilter
|
|
31
|
-
extends IDecoratorPipeOptions, IDecoratorPipeOptionsArgument, ValidatorOptions {
|
|
33
|
+
extends IDecoratorPipeOptions, IDecoratorPipeOptionsArgument, ValidatorOptions {
|
|
34
|
+
analysis?: IAnalysisPolicy;
|
|
35
|
+
analysisMode?: TypeAnalysisMode;
|
|
36
|
+
}
|
|
32
37
|
|
|
33
38
|
const __FieldsSystem = ['columns', 'where', 'orders', 'pageNo', 'pageSize'];
|
|
39
|
+
const __AnalysisControls = ['groups', 'aggrs', 'having', 'joins', 'distinct', 'include', 'with'];
|
|
34
40
|
|
|
35
41
|
@Pipe<IPipeOptionsFilter>({
|
|
36
42
|
// ValidatorOptions
|
|
@@ -53,6 +59,7 @@ export class PipeFilter
|
|
|
53
59
|
`should specify the schema of pipeFilter: ${metadata.controller.name}.${metadata.method}#${metadata.index}`,
|
|
54
60
|
);
|
|
55
61
|
}
|
|
62
|
+
value = this._prepareAnalysisControls(value, options);
|
|
56
63
|
// validateSchema
|
|
57
64
|
value = (await this.bean.validator.validateSchema(
|
|
58
65
|
options.schema,
|
|
@@ -66,6 +73,35 @@ export class PipeFilter
|
|
|
66
73
|
return params;
|
|
67
74
|
}
|
|
68
75
|
|
|
76
|
+
private _prepareAnalysisControls(value: TypePipeFilterData, options: IPipeOptionsFilter) {
|
|
77
|
+
if (!!options.analysis !== !!options.analysisMode) {
|
|
78
|
+
throw new Error('Analysis filter requires both a policy and an action mode');
|
|
79
|
+
}
|
|
80
|
+
if (!value || typeof value !== 'object') return value;
|
|
81
|
+
const prepared = { ...value };
|
|
82
|
+
for (const key of __AnalysisControls) {
|
|
83
|
+
if (!Object.hasOwn(value, key)) continue;
|
|
84
|
+
if (!options.analysisMode) analysisFailure(`Select does not support ${key}`);
|
|
85
|
+
if (key !== 'aggrs' && !(key === 'groups' && options.analysisMode === 'group')) {
|
|
86
|
+
analysisFailure(`Analysis ${options.analysisMode} does not support ${key}`);
|
|
87
|
+
}
|
|
88
|
+
if (typeof value[key] === 'string') {
|
|
89
|
+
try {
|
|
90
|
+
prepared[key] = JSON.parse(value[key]);
|
|
91
|
+
} catch {
|
|
92
|
+
analysisFailure(`Analysis ${key} must be valid JSON`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (options.analysis && options.analysisMode) {
|
|
97
|
+
// Validate native shapes before permissive generic query coercion runs.
|
|
98
|
+
runWithZodQueryCoercion(false, () =>
|
|
99
|
+
resolveAnalysis(options.analysis!, options.analysisMode!, prepared),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return prepared;
|
|
103
|
+
}
|
|
104
|
+
|
|
69
105
|
private async _transform(value: TypePipeFilterData, options: IPipeOptionsFilter) {
|
|
70
106
|
// 1. system: columns/where/orders/pageNo/pageSize
|
|
71
107
|
const params = this._transformSystem(value);
|
|
@@ -76,6 +112,10 @@ export class PipeFilter
|
|
|
76
112
|
await this._transformFields(params, value, options, rootOpenapi);
|
|
77
113
|
// 3. system: orders
|
|
78
114
|
this._transformOrders(params, options, rootOpenapi);
|
|
115
|
+
if (options.analysis && options.analysisMode) {
|
|
116
|
+
if (params.joins?.length) analysisFailure('Analysis does not support joined filters');
|
|
117
|
+
Object.assign(params, resolveAnalysis(options.analysis, options.analysisMode, value));
|
|
118
|
+
}
|
|
79
119
|
// ok
|
|
80
120
|
return params;
|
|
81
121
|
}
|
|
@@ -188,7 +228,8 @@ export class PipeFilter
|
|
|
188
228
|
options: IPipeOptionsFilter,
|
|
189
229
|
rootOpenapi: ISchemaObjectExtensionField | undefined,
|
|
190
230
|
) {
|
|
191
|
-
if (__FieldsSystem.includes(key))
|
|
231
|
+
if (__FieldsSystem.includes(key) || (options.analysisMode && __AnalysisControls.includes(key)))
|
|
232
|
+
return;
|
|
192
233
|
const info = this._resolveField(key, options, rootOpenapi);
|
|
193
234
|
if (!info) return;
|
|
194
235
|
const { fieldSchema, fieldSchemaInner, openapi, originalName, fullName, joinInfo } = info;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
import type { ISchemaObjectExtensionField } from 'vona-module-a-openapi';
|
|
3
|
+
import type { IAnalysisPolicy, TypeAnalysisMode } from 'vona-module-a-orm';
|
|
4
|
+
import type z from 'zod';
|
|
5
|
+
|
|
6
|
+
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
7
|
+
import { appResource } from 'vona';
|
|
8
|
+
import { $schema } from 'vona-module-a-openapiutils';
|
|
9
|
+
import { analysisCapabilities, analysisControlSchemas } from 'vona-module-a-orm';
|
|
10
|
+
|
|
11
|
+
import type { IDecoratorDtoOptions } from '../types/dto.ts';
|
|
12
|
+
|
|
13
|
+
export interface IArgFilterOptions {
|
|
14
|
+
mode?: TypeAnalysisMode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function prepareAnalysisFilter(
|
|
18
|
+
schemaLike: z.ZodType | Constructable,
|
|
19
|
+
options?: IArgFilterOptions,
|
|
20
|
+
) {
|
|
21
|
+
const schema = $schema(schemaLike as Constructable);
|
|
22
|
+
if (!options?.mode) return { schema };
|
|
23
|
+
const policy = (
|
|
24
|
+
appResource.getBean(schemaLike as Constructable)?.options as IDecoratorDtoOptions | undefined
|
|
25
|
+
)?.analysis;
|
|
26
|
+
if (!policy) throw new Error('Analysis filter requires a DTO analysis policy');
|
|
27
|
+
return {
|
|
28
|
+
schema: createAnalysisFilterSchema(schema, policy, options.mode),
|
|
29
|
+
analysis: policy,
|
|
30
|
+
analysisMode: options.mode,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createAnalysisFilterSchema(
|
|
35
|
+
schema: z.ZodType,
|
|
36
|
+
policy: IAnalysisPolicy,
|
|
37
|
+
mode: TypeAnalysisMode,
|
|
38
|
+
) {
|
|
39
|
+
const inner = ZodMetadata.unwrapChained(schema);
|
|
40
|
+
if (inner.type !== 'object') throw new Error('Analysis filter requires an object DTO schema');
|
|
41
|
+
const object = schema as z.ZodObject;
|
|
42
|
+
if (typeof object.safeExtend !== 'function') {
|
|
43
|
+
throw new TypeError('Analysis filter requires an extensible object DTO schema');
|
|
44
|
+
}
|
|
45
|
+
for (const key of ['groups', 'aggrs', 'having', 'joins', 'distinct']) {
|
|
46
|
+
if (key in object.shape) throw new Error(`Analysis control conflicts with DTO field: ${key}`);
|
|
47
|
+
}
|
|
48
|
+
const controls = analysisControlSchemas(policy, mode);
|
|
49
|
+
const capabilities = analysisCapabilities(policy, mode);
|
|
50
|
+
const metadata: ISchemaObjectExtensionField = {
|
|
51
|
+
filter: { capabilities: { analysis: capabilities } },
|
|
52
|
+
};
|
|
53
|
+
const shape: Record<string, z.ZodType> = {
|
|
54
|
+
aggrs: controls.aggrs.openapi(metadata),
|
|
55
|
+
};
|
|
56
|
+
if (controls.groups) shape.groups = controls.groups.openapi(metadata);
|
|
57
|
+
const derived = object.safeExtend(shape);
|
|
58
|
+
const original = ZodMetadata.getOpenapiMetadata(schema) as
|
|
59
|
+
| ISchemaObjectExtensionField
|
|
60
|
+
| undefined;
|
|
61
|
+
const ref = ZodMetadata.getRefId(schema);
|
|
62
|
+
return derived.openapi(`${ref ?? 'filter'}_${mode}`, {
|
|
63
|
+
...original,
|
|
64
|
+
filter: {
|
|
65
|
+
...original?.filter,
|
|
66
|
+
capabilities: { ...original?.filter?.capabilities, analysis: capabilities },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -3,8 +3,10 @@ import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
|
3
3
|
import type z from 'zod';
|
|
4
4
|
|
|
5
5
|
import { setArgumentPipe } from 'vona-module-a-aspect';
|
|
6
|
-
import { $schema } from 'vona-module-a-openapiutils';
|
|
7
6
|
|
|
7
|
+
import type { IArgFilterOptions } from '../analysisFilter.ts';
|
|
8
|
+
|
|
9
|
+
import { prepareAnalysisFilter } from '../analysisFilter.ts';
|
|
8
10
|
import { createPipesArgumentDecorator } from './pipesArgument.ts';
|
|
9
11
|
|
|
10
12
|
function Param(): ParameterDecorator;
|
|
@@ -71,10 +73,10 @@ function RbacScopeCurrent(): ParameterDecorator {
|
|
|
71
73
|
return createPipesArgumentDecorator('rbacScopeCurrent')();
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
function ArgFilter(schemaLike: z.ZodType | Constructable): any {
|
|
76
|
+
function ArgFilter(schemaLike: z.ZodType | Constructable, options?: IArgFilterOptions): any {
|
|
75
77
|
return function (target: object, prop: MetadataKey | undefined, index: number) {
|
|
76
|
-
const
|
|
77
|
-
setArgumentPipe('a-web:filter', { type: 'query',
|
|
78
|
+
const prepared = prepareAnalysisFilter(schemaLike, options);
|
|
79
|
+
setArgumentPipe('a-web:filter', { type: 'query', ...prepared }, target, prop, index);
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -2,7 +2,7 @@ import type { OmitNever } from 'vona';
|
|
|
2
2
|
import type { ServiceOnion } from 'vona-module-a-onion';
|
|
3
3
|
import type { ISchemaObjectExtensionField, TypeSchemaScene } from 'vona-module-a-openapi';
|
|
4
4
|
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
5
|
-
import type { SymbolKeyFieldsMore } from 'vona-module-a-orm';
|
|
5
|
+
import type { IAnalysisPolicy, SymbolKeyFieldsMore } from 'vona-module-a-orm';
|
|
6
6
|
|
|
7
7
|
export interface IDtoRecord {}
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ export interface IDecoratorDtoOptions<FieldsMore = never> {
|
|
|
10
10
|
[SymbolKeyFieldsMore]?: FieldsMore;
|
|
11
11
|
independent?: boolean;
|
|
12
12
|
schemaScene?: TypeSchemaScene;
|
|
13
|
+
analysis?: IAnalysisPolicy;
|
|
13
14
|
openapi?: ISchemaObjectExtensionField;
|
|
14
15
|
pipes?: SchemaLike | SchemaLike[];
|
|
15
16
|
blocks?: any[];
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
IAnalysisCapabilities,
|
|
3
|
+
IModelSelectParamsJoinType,
|
|
4
|
+
ITableRecord,
|
|
5
|
+
TypeOpsNormal,
|
|
6
|
+
} from 'vona-module-a-orm';
|
|
2
7
|
|
|
3
8
|
import type {
|
|
4
9
|
IDecoratorFilterTransformOptions,
|
|
@@ -15,7 +20,7 @@ export interface ISchemaObjectExtensionFieldFilterCapabilities {
|
|
|
15
20
|
where?: boolean;
|
|
16
21
|
// filter?: boolean;
|
|
17
22
|
order?: boolean;
|
|
18
|
-
|
|
23
|
+
analysis?: IAnalysisCapabilities;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export type TypeSchemaObjectExtensionFieldFilterTransform = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.124",
|
|
4
4
|
"gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
|
|
5
5
|
"description": "zova cli",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@cabloy/process-helper": "^3.1.9",
|
|
45
45
|
"fs-extra": "^11.3.5",
|
|
46
46
|
"semver": "^7.6.2",
|
|
47
|
-
"zova-cli-set-front": "^1.2.
|
|
47
|
+
"zova-cli-set-front": "^1.2.122"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"clean-package": "^2.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.122",
|
|
4
4
|
"gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
|
|
5
5
|
"description": "zova cli-set-front",
|
|
6
6
|
"keywords": [
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"vite": "^8.3.4",
|
|
71
71
|
"yaml": "^2.8.3",
|
|
72
72
|
"zova-openapi": "^1.1.17",
|
|
73
|
-
"zova-vite": "^1.1.
|
|
73
|
+
"zova-vite": "^1.1.53"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"clean-package": "^2.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-jsx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.96",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "Zova JSX",
|
|
6
6
|
"keywords": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@cabloy/word-utils": "^2.1.14",
|
|
51
51
|
"typestyle": "^2.4.0",
|
|
52
52
|
"vue": "^3.5.38",
|
|
53
|
-
"zova-core": "^5.1.
|
|
53
|
+
"zova-core": "^5.1.96"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"clean-package": "^2.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.180",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "A vue3 framework with ioc",
|
|
6
6
|
"keywords": [
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"postpack": "clean-package restore"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"zova-core": "^5.1.
|
|
49
|
-
"zova-suite-a-zova": "^5.1.
|
|
48
|
+
"zova-core": "^5.1.96",
|
|
49
|
+
"zova-suite-a-zova": "^5.1.179"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"clean-package": "^2.2.0",
|
package/zova/pnpm-lock.yaml
CHANGED
|
@@ -294,7 +294,7 @@ importers:
|
|
|
294
294
|
specifier: workspace:^
|
|
295
295
|
version: link:packages-zova/zova
|
|
296
296
|
zova-jsx:
|
|
297
|
-
specifier: ^1.1.
|
|
297
|
+
specifier: ^1.1.96
|
|
298
298
|
version: link:packages-utils/zova-jsx
|
|
299
299
|
zova-module-a-api:
|
|
300
300
|
specifier: workspace:^
|
|
@@ -598,7 +598,7 @@ importers:
|
|
|
598
598
|
specifier: ^7.6.2
|
|
599
599
|
version: 7.8.5
|
|
600
600
|
zova-cli-set-front:
|
|
601
|
-
specifier: ^1.2.
|
|
601
|
+
specifier: ^1.2.122
|
|
602
602
|
version: link:../cli-set-front
|
|
603
603
|
devDependencies:
|
|
604
604
|
clean-package:
|
|
@@ -707,7 +707,7 @@ importers:
|
|
|
707
707
|
specifier: ^1.1.17
|
|
708
708
|
version: link:../../packages-utils/zova-openapi
|
|
709
709
|
zova-vite:
|
|
710
|
-
specifier: ^1.1.
|
|
710
|
+
specifier: ^1.1.53
|
|
711
711
|
version: link:../../packages-utils/zova-vite
|
|
712
712
|
devDependencies:
|
|
713
713
|
clean-package:
|
|
@@ -875,7 +875,7 @@ importers:
|
|
|
875
875
|
specifier: ^3.5.38
|
|
876
876
|
version: 3.5.42(typescript@5.9.3)
|
|
877
877
|
zova-core:
|
|
878
|
-
specifier: ^5.1.
|
|
878
|
+
specifier: ^5.1.96
|
|
879
879
|
version: link:../../packages-zova/zova-core
|
|
880
880
|
devDependencies:
|
|
881
881
|
clean-package:
|
|
@@ -1016,10 +1016,10 @@ importers:
|
|
|
1016
1016
|
packages-zova/zova:
|
|
1017
1017
|
dependencies:
|
|
1018
1018
|
zova-core:
|
|
1019
|
-
specifier: ^5.1.
|
|
1019
|
+
specifier: ^5.1.96
|
|
1020
1020
|
version: link:../zova-core
|
|
1021
1021
|
zova-suite-a-zova:
|
|
1022
|
-
specifier: ^5.1.
|
|
1022
|
+
specifier: ^5.1.179
|
|
1023
1023
|
version: link:../../src/suite-vendor/a-zova
|
|
1024
1024
|
devDependencies:
|
|
1025
1025
|
clean-package:
|
|
@@ -1264,25 +1264,25 @@ importers:
|
|
|
1264
1264
|
specifier: ^5.1.36
|
|
1265
1265
|
version: link:modules/a-routertabs
|
|
1266
1266
|
zova-module-a-ssr:
|
|
1267
|
-
specifier: ^5.1.
|
|
1267
|
+
specifier: ^5.1.44
|
|
1268
1268
|
version: link:modules/a-ssr
|
|
1269
1269
|
zova-module-a-ssrhmr:
|
|
1270
1270
|
specifier: ^5.1.24
|
|
1271
1271
|
version: link:modules/a-ssrhmr
|
|
1272
1272
|
zova-module-a-ssrserver:
|
|
1273
|
-
specifier: ^5.1.
|
|
1273
|
+
specifier: ^5.1.29
|
|
1274
1274
|
version: link:modules/a-ssrserver
|
|
1275
1275
|
zova-module-a-style:
|
|
1276
1276
|
specifier: ^5.1.36
|
|
1277
1277
|
version: link:modules/a-style
|
|
1278
1278
|
zova-module-a-table:
|
|
1279
|
-
specifier: ^5.1.
|
|
1279
|
+
specifier: ^5.1.47
|
|
1280
1280
|
version: link:modules/a-table
|
|
1281
1281
|
zova-module-a-zod:
|
|
1282
1282
|
specifier: ^5.1.39
|
|
1283
1283
|
version: link:modules/a-zod
|
|
1284
1284
|
zova-module-a-zova:
|
|
1285
|
-
specifier: ^5.1.
|
|
1285
|
+
specifier: ^5.1.115
|
|
1286
1286
|
version: link:modules/a-zova
|
|
1287
1287
|
|
|
1288
1288
|
src/suite-vendor/a-zova/modules/a-api:
|
|
@@ -1615,7 +1615,7 @@ importers:
|
|
|
1615
1615
|
specifier: ^3.7.2
|
|
1616
1616
|
version: 3.7.2
|
|
1617
1617
|
zova-jsx:
|
|
1618
|
-
specifier: ^1.1.
|
|
1618
|
+
specifier: ^1.1.96
|
|
1619
1619
|
version: link:../../../../../packages-utils/zova-jsx
|
|
1620
1620
|
devDependencies:
|
|
1621
1621
|
'@cabloy/cli':
|
|
@@ -463,6 +463,14 @@ export type ApiSchemaAImageDtoImageView_a83c3e638bca4b30ec8675860cdc52d66f6a16d1
|
|
|
463
463
|
components['schemas']['a-image.dto.imageView_a83c3e638bca4b30ec8675860cdc52d66f6a16d1_2d063d28bc7243bed02ebd8bddf1212a93c6305b_efb37794d7c03c65122279f90d79919f009c34e5_1816ff740d81c738ec055c7038bbd93beb9405a7_537cd6552a384183a9457fb6a920bbae337277f6'];
|
|
464
464
|
export type ApiSchemaAImageDtoImageView_a83c3e638bca4b30ec8675860cdc52d66f6a16d1_2d063d28bc7243bed02ebd8bddf1212a93c6305b_efb37794d7c03c65122279f90d79919f009c34e5_1816ff740d81c738ec055c7038bbd93beb9405a7_537cd6552a384183a9457fb6a920bbae337277f6Partial =
|
|
465
465
|
Partial<ApiSchemaAImageDtoImageView_a83c3e638bca4b30ec8675860cdc52d66f6a16d1_2d063d28bc7243bed02ebd8bddf1212a93c6305b_efb37794d7c03c65122279f90d79919f009c34e5_1816ff740d81c738ec055c7038bbd93beb9405a7_537cd6552a384183a9457fb6a920bbae337277f6>;
|
|
466
|
+
export type ApiSchemaTrainingStudentDtoStudentGroupResItem =
|
|
467
|
+
components['schemas']['training-student.dto.studentGroupResItem'];
|
|
468
|
+
export type ApiSchemaTrainingStudentDtoStudentGroupResItemPartial =
|
|
469
|
+
Partial<ApiSchemaTrainingStudentDtoStudentGroupResItem>;
|
|
470
|
+
export type ApiSchemaTrainingStudentDtoStudentAggregateRes =
|
|
471
|
+
components['schemas']['training-student.dto.studentAggregateRes'];
|
|
472
|
+
export type ApiSchemaTrainingStudentDtoStudentAggregateResPartial =
|
|
473
|
+
Partial<ApiSchemaTrainingStudentDtoStudentAggregateRes>;
|
|
466
474
|
export type ApiSchemaTrainingStudentDtoStudentView_2d063d28bc7243bed02ebd8bddf1212a93c6305b_4826fc678e47603ec467782ddb0d02463792cd60 =
|
|
467
475
|
components['schemas']['training-student.dto.studentView_2d063d28bc7243bed02ebd8bddf1212a93c6305b_4826fc678e47603ec467782ddb0d02463792cd60'];
|
|
468
476
|
export type ApiSchemaTrainingStudentDtoStudentView_2d063d28bc7243bed02ebd8bddf1212a93c6305b_4826fc678e47603ec467782ddb0d02463792cd60Partial =
|
|
@@ -597,8 +605,14 @@ export type ApiSchemaTestVonaEntityPost_729883d7de16ce4401b26f75bebe618c8948ff64
|
|
|
597
605
|
components['schemas']['test-vona.entity.post_729883d7de16ce4401b26f75bebe618c8948ff64'];
|
|
598
606
|
export type ApiSchemaTestVonaEntityPost_729883d7de16ce4401b26f75bebe618c8948ff64Partial =
|
|
599
607
|
Partial<ApiSchemaTestVonaEntityPost_729883d7de16ce4401b26f75bebe618c8948ff64>;
|
|
600
|
-
export type
|
|
601
|
-
|
|
608
|
+
export type ApiSchemaTestVonaDtoUserCreate_1ff20af69286149eb0b25291d9450172f7bd0054 =
|
|
609
|
+
components['schemas']['test-vona.dto.userCreate_1ff20af69286149eb0b25291d9450172f7bd0054'];
|
|
610
|
+
export type ApiSchemaTestVonaDtoUserCreate_1ff20af69286149eb0b25291d9450172f7bd0054Partial =
|
|
611
|
+
Partial<ApiSchemaTestVonaDtoUserCreate_1ff20af69286149eb0b25291d9450172f7bd0054>;
|
|
612
|
+
export type ApiSchemaTestVonaDtoUserUpdate_fb27bcbbc8bfc8a865e086eb43abd766c7107326 =
|
|
613
|
+
components['schemas']['test-vona.dto.userUpdate_fb27bcbbc8bfc8a865e086eb43abd766c7107326'];
|
|
614
|
+
export type ApiSchemaTestVonaDtoUserUpdate_fb27bcbbc8bfc8a865e086eb43abd766c7107326Partial =
|
|
615
|
+
Partial<ApiSchemaTestVonaDtoUserUpdate_fb27bcbbc8bfc8a865e086eb43abd766c7107326>;
|
|
602
616
|
export type ApiSchemaTestVonaEntityCategory_2c7d642ee581efa300341e343180fbb0ecdc785d =
|
|
603
617
|
components['schemas']['test-vona.entity.category_2c7d642ee581efa300341e343180fbb0ecdc785d'];
|
|
604
618
|
export type ApiSchemaTestVonaEntityCategory_2c7d642ee581efa300341e343180fbb0ecdc785dPartial =
|