vona-module-a-openapi 5.0.30 → 5.0.31
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/dist/.metadata/index.d.ts +2 -167
- package/dist/config/config.d.ts +2 -2
- package/dist/index.js +136 -45
- package/dist/lib/schema/bodySchemaWrapper.d.ts +1 -9
- package/dist/lib/schema/makeSchemaLikes.d.ts +2 -2
- package/dist/lib/schema/schema.d.ts +3 -3
- package/dist/lib/schema/v/helpers.d.ts +17 -13
- package/dist/lib/schema/v/openapi.d.ts +7 -7
- package/dist/lib/schema/v/system.d.ts +8 -6
- package/dist/lib/schema/v/zod.d.ts +4 -0
- package/dist/lib/schema/v.d.ts +16 -3
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/zod/index.d.ts +0 -2
- package/dist/types/captcha.d.ts +4 -0
- package/dist/types/decorator.d.ts +2 -2
- package/dist/types/query.d.ts +3 -1
- package/dist/types/rest.d.ts +6 -4
- package/package.json +10 -7
- package/dist/config/locale/en-us.d.ts +0 -80
- package/dist/config/locale/zh-cn.d.ts +0 -80
- package/dist/lib/zod/errorUtil.d.ts +0 -9
- package/dist/lib/zod/errorsAdapter.d.ts +0 -2
|
@@ -55,178 +55,17 @@ export interface IModuleSummerCache {
|
|
|
55
55
|
/** config: begin */
|
|
56
56
|
export * from '../config/config.ts';
|
|
57
57
|
import type { config } from '../config/config.ts';
|
|
58
|
-
|
|
59
|
-
'en-us': {
|
|
60
|
-
ZodError_invalid_input: string;
|
|
61
|
-
ZodError_invalid_type_required: string;
|
|
62
|
-
ZodError_invalid_type_requiredDetail: string;
|
|
63
|
-
ZodError_invalid_literal: string;
|
|
64
|
-
ZodError_unrecognized_keys: string;
|
|
65
|
-
ZodError_invalid_union: string;
|
|
66
|
-
ZodError_invalid_union_discriminator: string;
|
|
67
|
-
ZodError_invalid_enum_value: string;
|
|
68
|
-
ZodError_invalid_arguments: string;
|
|
69
|
-
ZodError_invalid_return_type: string;
|
|
70
|
-
ZodError_invalid_date: string;
|
|
71
|
-
ZodError_invalid_string_includes: string;
|
|
72
|
-
ZodError_invalid_string_includes_position: string;
|
|
73
|
-
ZodError_invalid_string_startsWith: string;
|
|
74
|
-
ZodError_invalid_string_endsWith: string;
|
|
75
|
-
ZodError_invalid_string_validation: string;
|
|
76
|
-
ZodError_invalid_string: string;
|
|
77
|
-
ZodError_too_small_array_exact: string;
|
|
78
|
-
ZodError_too_small_array_inclusive: string;
|
|
79
|
-
ZodError_too_small_array_not_inclusive: string;
|
|
80
|
-
ZodError_too_small_string_exact: string;
|
|
81
|
-
ZodError_too_small_string_inclusive: string;
|
|
82
|
-
ZodError_too_small_string_not_inclusive: string;
|
|
83
|
-
ZodError_too_small_number_exact: string;
|
|
84
|
-
ZodError_too_small_number_inclusive: string;
|
|
85
|
-
ZodError_too_small_number_not_inclusive: string;
|
|
86
|
-
ZodError_too_small_set_exact: string;
|
|
87
|
-
ZodError_too_small_set_inclusive: string;
|
|
88
|
-
ZodError_too_small_set_not_inclusive: string;
|
|
89
|
-
ZodError_too_small_date_exact: string;
|
|
90
|
-
ZodError_too_small_date_inclusive: string;
|
|
91
|
-
ZodError_too_small_date_not_inclusive: string;
|
|
92
|
-
ZodError_too_big_array_exact: string;
|
|
93
|
-
ZodError_too_big_array_inclusive: string;
|
|
94
|
-
ZodError_too_big_array_not_inclusive: string;
|
|
95
|
-
ZodError_too_big_string_exact: string;
|
|
96
|
-
ZodError_too_big_string_inclusive: string;
|
|
97
|
-
ZodError_too_big_string_not_inclusive: string;
|
|
98
|
-
ZodError_too_big_number_exact: string;
|
|
99
|
-
ZodError_too_big_number_inclusive: string;
|
|
100
|
-
ZodError_too_big_number_not_inclusive: string;
|
|
101
|
-
ZodError_too_big_set_exact: string;
|
|
102
|
-
ZodError_too_big_set_inclusive: string;
|
|
103
|
-
ZodError_too_big_set_not_inclusive: string;
|
|
104
|
-
ZodError_too_big_date_exact: string;
|
|
105
|
-
ZodError_too_big_date_inclusive: string;
|
|
106
|
-
ZodError_too_big_date_not_inclusive: string;
|
|
107
|
-
ZodError_custom: string;
|
|
108
|
-
ZodError_invalid_intersection_types: string;
|
|
109
|
-
ZodError_not_multiple_of: string;
|
|
110
|
-
ZodError_not_finite: string;
|
|
111
|
-
ZodError_validations_email: string;
|
|
112
|
-
ZodError_validations_url: string;
|
|
113
|
-
ZodError_validations_uuid: string;
|
|
114
|
-
ZodError_validations_cuid: string;
|
|
115
|
-
ZodError_validations_regex: string;
|
|
116
|
-
ZodError_validations_datetime: string;
|
|
117
|
-
ZodError_types_function: string;
|
|
118
|
-
ZodError_types_number: string;
|
|
119
|
-
ZodError_types_string: string;
|
|
120
|
-
ZodError_types_nan: string;
|
|
121
|
-
ZodError_types_integer: string;
|
|
122
|
-
ZodError_types_float: string;
|
|
123
|
-
ZodError_types_boolean: string;
|
|
124
|
-
ZodError_types_date: string;
|
|
125
|
-
ZodError_types_bigint: string;
|
|
126
|
-
ZodError_types_undefined: string;
|
|
127
|
-
ZodError_types_symbol: string;
|
|
128
|
-
ZodError_types_null: string;
|
|
129
|
-
ZodError_types_array: string;
|
|
130
|
-
ZodError_types_object: string;
|
|
131
|
-
ZodError_types_unknown: string;
|
|
132
|
-
ZodError_types_promise: string;
|
|
133
|
-
ZodError_types_void: string;
|
|
134
|
-
ZodError_types_never: string;
|
|
135
|
-
ZodError_types_map: string;
|
|
136
|
-
ZodError_types_set: string;
|
|
137
|
-
};
|
|
138
|
-
'zh-cn': {
|
|
139
|
-
ZodError_invalid_input: string;
|
|
140
|
-
ZodError_invalid_type_required: string;
|
|
141
|
-
ZodError_invalid_type_requiredDetail: string;
|
|
142
|
-
ZodError_invalid_literal: string;
|
|
143
|
-
ZodError_unrecognized_keys: string;
|
|
144
|
-
ZodError_invalid_union: string;
|
|
145
|
-
ZodError_invalid_union_discriminator: string;
|
|
146
|
-
ZodError_invalid_enum_value: string;
|
|
147
|
-
ZodError_invalid_arguments: string;
|
|
148
|
-
ZodError_invalid_return_type: string;
|
|
149
|
-
ZodError_invalid_date: string;
|
|
150
|
-
ZodError_invalid_string_includes: string;
|
|
151
|
-
ZodError_invalid_string_includes_position: string;
|
|
152
|
-
ZodError_invalid_string_startsWith: string;
|
|
153
|
-
ZodError_invalid_string_endsWith: string;
|
|
154
|
-
ZodError_invalid_string_validation: string;
|
|
155
|
-
ZodError_invalid_string: string;
|
|
156
|
-
ZodError_too_small_array_exact: string;
|
|
157
|
-
ZodError_too_small_array_inclusive: string;
|
|
158
|
-
ZodError_too_small_array_not_inclusive: string;
|
|
159
|
-
ZodError_too_small_string_exact: string;
|
|
160
|
-
ZodError_too_small_string_inclusive: string;
|
|
161
|
-
ZodError_too_small_string_not_inclusive: string;
|
|
162
|
-
ZodError_too_small_number_exact: string;
|
|
163
|
-
ZodError_too_small_number_inclusive: string;
|
|
164
|
-
ZodError_too_small_number_not_inclusive: string;
|
|
165
|
-
ZodError_too_small_set_exact: string;
|
|
166
|
-
ZodError_too_small_set_inclusive: string;
|
|
167
|
-
ZodError_too_small_set_not_inclusive: string;
|
|
168
|
-
ZodError_too_small_date_exact: string;
|
|
169
|
-
ZodError_too_small_date_inclusive: string;
|
|
170
|
-
ZodError_too_small_date_not_inclusive: string;
|
|
171
|
-
ZodError_too_big_array_exact: string;
|
|
172
|
-
ZodError_too_big_array_inclusive: string;
|
|
173
|
-
ZodError_too_big_array_not_inclusive: string;
|
|
174
|
-
ZodError_too_big_string_exact: string;
|
|
175
|
-
ZodError_too_big_string_inclusive: string;
|
|
176
|
-
ZodError_too_big_string_not_inclusive: string;
|
|
177
|
-
ZodError_too_big_number_exact: string;
|
|
178
|
-
ZodError_too_big_number_inclusive: string;
|
|
179
|
-
ZodError_too_big_number_not_inclusive: string;
|
|
180
|
-
ZodError_too_big_set_exact: string;
|
|
181
|
-
ZodError_too_big_set_inclusive: string;
|
|
182
|
-
ZodError_too_big_set_not_inclusive: string;
|
|
183
|
-
ZodError_too_big_date_exact: string;
|
|
184
|
-
ZodError_too_big_date_inclusive: string;
|
|
185
|
-
ZodError_too_big_date_not_inclusive: string;
|
|
186
|
-
ZodError_custom: string;
|
|
187
|
-
ZodError_invalid_intersection_types: string;
|
|
188
|
-
ZodError_not_multiple_of: string;
|
|
189
|
-
ZodError_not_finite: string;
|
|
190
|
-
ZodError_validations_email: string;
|
|
191
|
-
ZodError_validations_url: string;
|
|
192
|
-
ZodError_validations_uuid: string;
|
|
193
|
-
ZodError_validations_cuid: string;
|
|
194
|
-
ZodError_validations_regex: string;
|
|
195
|
-
ZodError_validations_datetime: string;
|
|
196
|
-
ZodError_types_function: string;
|
|
197
|
-
ZodError_types_number: string;
|
|
198
|
-
ZodError_types_string: string;
|
|
199
|
-
ZodError_types_nan: string;
|
|
200
|
-
ZodError_types_integer: string;
|
|
201
|
-
ZodError_types_float: string;
|
|
202
|
-
ZodError_types_boolean: string;
|
|
203
|
-
ZodError_types_date: string;
|
|
204
|
-
ZodError_types_bigint: string;
|
|
205
|
-
ZodError_types_undefined: string;
|
|
206
|
-
ZodError_types_symbol: string;
|
|
207
|
-
ZodError_types_null: string;
|
|
208
|
-
ZodError_types_array: string;
|
|
209
|
-
ZodError_types_object: string;
|
|
210
|
-
ZodError_types_unknown: string;
|
|
211
|
-
ZodError_types_promise: string;
|
|
212
|
-
ZodError_types_void: string;
|
|
213
|
-
ZodError_types_never: string;
|
|
214
|
-
ZodError_types_map: string;
|
|
215
|
-
ZodError_types_set: string;
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
/** locale: end */
|
|
58
|
+
/** config: end */
|
|
219
59
|
/** main: begin */
|
|
220
60
|
export * from '../main.ts';
|
|
221
61
|
/** main: end */
|
|
222
62
|
/** scope: begin */
|
|
223
|
-
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig
|
|
63
|
+
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig } from 'vona';
|
|
224
64
|
export declare class ScopeModuleAOpenapi extends BeanScopeBase {
|
|
225
65
|
}
|
|
226
66
|
export interface ScopeModuleAOpenapi {
|
|
227
67
|
util: BeanScopeUtil;
|
|
228
68
|
config: TypeModuleConfig<typeof config>;
|
|
229
|
-
locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
|
|
230
69
|
service: IModuleService;
|
|
231
70
|
summerCache: IModuleSummerCache;
|
|
232
71
|
}
|
|
@@ -241,9 +80,5 @@ declare module 'vona' {
|
|
|
241
80
|
interface IBeanScopeConfig {
|
|
242
81
|
'a-openapi': ReturnType<typeof config>;
|
|
243
82
|
}
|
|
244
|
-
interface IBeanScopeLocale {
|
|
245
|
-
'a-openapi': (typeof locales)[TypeLocaleBase];
|
|
246
|
-
}
|
|
247
83
|
}
|
|
248
|
-
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `a-openapi::${K}`;
|
|
249
84
|
/** scope: end */
|
package/dist/config/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OpenAPIObjectConfig as OpenAPIObjectConfigV30 } from '@
|
|
2
|
-
import type { OpenAPIObjectConfigV31 } from '@
|
|
1
|
+
import type { OpenAPIObjectConfig as OpenAPIObjectConfigV30 } from '@cabloy/zod-to-openapi/dist/v3.0/openapi-generator.ts';
|
|
2
|
+
import type { OpenAPIObjectConfigV31 } from '@cabloy/zod-to-openapi/dist/v3.1/openapi-generator.ts';
|
|
3
3
|
import type { VonaApplication } from 'vona';
|
|
4
4
|
import type { TypeOpenApiVersion, TypeSecuritySchemes } from 'vona-module-a-openapiutils';
|
|
5
5
|
export declare function config(_app: VonaApplication): {
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { registerMappedClassMetadataKey, appMetadata, appResource, cast, deepExtend, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase, useApp } from 'vona';
|
|
2
|
-
import { OpenApiGeneratorV3, OpenApiGeneratorV31, OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
|
|
1
|
+
import { registerMappedClassMetadataKey, appMetadata, appResource, cast, deepExtend, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase, useApp, beanFullNameFromOnionName } from 'vona';
|
|
3
2
|
import * as ModuleInfo from '@cabloy/module-info';
|
|
4
3
|
import { isClass, isEmptyObject, isNil } from '@cabloy/utils';
|
|
5
4
|
import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
6
|
-
import {
|
|
5
|
+
import { getInnerTypeName, coerceWithNil } from '@cabloy/zod-query';
|
|
6
|
+
import { OpenApiGeneratorV3, OpenApiGeneratorV31, OpenAPIRegistry } from '@cabloy/zod-to-openapi';
|
|
7
7
|
import { Service, Scope } from 'vona-module-a-bean';
|
|
8
8
|
import { Caching } from 'vona-module-a-caching';
|
|
9
9
|
import { SymbolDecoratorRule, SymbolDecoratorRuleColumn, SymbolOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
10
10
|
import { SymbolRequestMappingHandler } from 'vona-module-a-web';
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
12
13
|
import { SummerCache, BeanSummerCacheBase } from 'vona-module-a-summer';
|
|
13
|
-
import { locales as locales$1, setErrorMapDefault, setErrorMapSchema } from '@cabloy/zod-errors-custom';
|
|
14
14
|
import 'openapi3-ts/oas30';
|
|
15
15
|
import 'openapi3-ts/oas31';
|
|
16
16
|
|
|
@@ -54,13 +54,15 @@ function mergeFieldsOpenapiMetadata(target) {
|
|
|
54
54
|
const field = fields[key];
|
|
55
55
|
if (!field) continue;
|
|
56
56
|
const schemaCurrent = rules[key];
|
|
57
|
+
const metadataCurrent = schemaCurrent ? ZodMetadata.getOpenapiMetadata(schemaCurrent) : undefined;
|
|
57
58
|
if (Object.prototype.hasOwnProperty.call(field, 'parseAsync')) {
|
|
58
59
|
const schema = field;
|
|
59
|
-
|
|
60
|
+
const metadataCustom = ZodMetadata.getOpenapiMetadata(schema);
|
|
61
|
+
rules[key] = schema.openapi(deepExtend({}, metadataCurrent, metadataCustom));
|
|
60
62
|
} else {
|
|
61
63
|
// use deepExtend for sure strict
|
|
62
64
|
if (schemaCurrent) {
|
|
63
|
-
rules[key] = schemaCurrent.openapi(deepExtend({},
|
|
65
|
+
rules[key] = schemaCurrent.openapi(deepExtend({}, metadataCurrent, field));
|
|
64
66
|
} else {
|
|
65
67
|
rules[key] = z.any().openapi(deepExtend({}, field));
|
|
66
68
|
}
|
|
@@ -72,6 +74,7 @@ function prepareClassType(classType) {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
function makeSchemaLikes(schemaLikes, typeInit) {
|
|
77
|
+
if (!Array.isArray(schemaLikes)) schemaLikes = [schemaLikes];
|
|
75
78
|
// default schema
|
|
76
79
|
let argSchema = $schema(typeInit);
|
|
77
80
|
// loop
|
|
@@ -133,6 +136,10 @@ function $schema(classType, options) {
|
|
|
133
136
|
// static
|
|
134
137
|
const beanOptions = appResource.getBean(classType);
|
|
135
138
|
if (beanOptions) {
|
|
139
|
+
const pipes = cast(beanOptions.options)?.pipes;
|
|
140
|
+
if (pipes) {
|
|
141
|
+
schema = makeSchemaLikes(pipes, schema);
|
|
142
|
+
}
|
|
136
143
|
const openapi = cast(beanOptions.options)?.openapi;
|
|
137
144
|
schema = schema.openapi(beanOptions.beanFullName, openapi);
|
|
138
145
|
}
|
|
@@ -152,8 +159,8 @@ function _createSchemaLazy(schemaLikes) {
|
|
|
152
159
|
}
|
|
153
160
|
function _createSchemaObject(rules, options) {
|
|
154
161
|
let schema = z.object(rules);
|
|
155
|
-
if (options?.
|
|
156
|
-
if (options?.strict) schema = schema.
|
|
162
|
+
if (options?.loose) schema = z.looseObject(schema.shape);
|
|
163
|
+
if (options?.strict) schema = z.strictObject(schema.shape);
|
|
157
164
|
return schema;
|
|
158
165
|
}
|
|
159
166
|
|
|
@@ -429,7 +436,7 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
429
436
|
}
|
|
430
437
|
if (!schema) continue;
|
|
431
438
|
// check schema
|
|
432
|
-
if (
|
|
439
|
+
if (getInnerTypeName(schema) === 'any') {
|
|
433
440
|
throw new Error(`Invalid Openapi argument type: ${info.relativeName}:${controller.name}.${actionKey}#${argumentType}`);
|
|
434
441
|
}
|
|
435
442
|
// record
|
|
@@ -566,19 +573,6 @@ function config(_app) {
|
|
|
566
573
|
};
|
|
567
574
|
}
|
|
568
575
|
|
|
569
|
-
var locale_en_us = locales$1['en-us'];
|
|
570
|
-
|
|
571
|
-
var locale_zh_cn = locales$1['zh-cn'];
|
|
572
|
-
|
|
573
|
-
function errorsAdapter(app) {
|
|
574
|
-
setErrorMapDefault((text, ...args) => {
|
|
575
|
-
return app.meta.text(text, ...args);
|
|
576
|
-
});
|
|
577
|
-
setErrorMapSchema((text, ...args) => {
|
|
578
|
-
return app.meta.text(text, ...args);
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
|
|
582
576
|
function schemaRefCustomAdapter(_app) {
|
|
583
577
|
const registry = new OpenAPIRegistry();
|
|
584
578
|
const generator31 = new OpenApiGeneratorV31(registry.definitions);
|
|
@@ -610,23 +604,16 @@ function _patchGenerator(generator) {
|
|
|
610
604
|
class Main extends BeanSimple {
|
|
611
605
|
async moduleLoading() {}
|
|
612
606
|
async moduleLoaded() {
|
|
613
|
-
errorsAdapter(this.app);
|
|
614
607
|
schemaRefCustomAdapter(this.app);
|
|
615
608
|
}
|
|
616
609
|
async configLoaded(_config) {}
|
|
617
610
|
}
|
|
618
611
|
|
|
619
612
|
var _dec, _dec2, _class;
|
|
620
|
-
const locales = {
|
|
621
|
-
'en-us': locale_en_us,
|
|
622
|
-
'zh-cn': locale_zh_cn
|
|
623
|
-
};
|
|
624
613
|
let ScopeModuleAOpenapi = (_dec = Scope(), _dec2 = BeanInfo({
|
|
625
614
|
module: "a-openapi"
|
|
626
615
|
}), _dec(_class = _dec2(_class = class ScopeModuleAOpenapi extends BeanScopeBase {}) || _class) || _class);
|
|
627
|
-
|
|
628
|
-
return `a-openapi::${key}`;
|
|
629
|
-
}
|
|
616
|
+
|
|
630
617
|
/** scope: end */
|
|
631
618
|
|
|
632
619
|
function Field(...schemaLikes) {
|
|
@@ -734,34 +721,77 @@ const Api = {
|
|
|
734
721
|
setHeader
|
|
735
722
|
};
|
|
736
723
|
|
|
737
|
-
function schemaEmail(
|
|
724
|
+
function schemaEmail(params) {
|
|
725
|
+
return function (_schema) {
|
|
726
|
+
return z.email(params);
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function schemaUrl(params) {
|
|
730
|
+
return function (_schema) {
|
|
731
|
+
return z.url(params);
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function schemaUuid(params) {
|
|
735
|
+
return function (_schema) {
|
|
736
|
+
return z.uuid(params);
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function schemaIPv4(params) {
|
|
740
|
+
return function (_schema) {
|
|
741
|
+
return z.ipv4(params);
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
function schemaIPv6(params) {
|
|
745
|
+
return function (_schema) {
|
|
746
|
+
return z.ipv6(params);
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
function schemaMin(min, params) {
|
|
738
750
|
return function (schema) {
|
|
739
|
-
|
|
751
|
+
if (schema.type === 'string') {
|
|
752
|
+
return schema.min(min, params);
|
|
753
|
+
} else {
|
|
754
|
+
return schema.min(min, params);
|
|
755
|
+
}
|
|
740
756
|
};
|
|
741
757
|
}
|
|
742
|
-
function
|
|
758
|
+
function schemaMax(max, params) {
|
|
743
759
|
return function (schema) {
|
|
744
|
-
|
|
760
|
+
if (schema.type === 'string') {
|
|
761
|
+
return schema.max(max, params);
|
|
762
|
+
} else {
|
|
763
|
+
return schema.max(max, params);
|
|
764
|
+
}
|
|
745
765
|
};
|
|
746
766
|
}
|
|
747
|
-
function
|
|
767
|
+
function schemaTrim() {
|
|
748
768
|
return function (schema) {
|
|
749
|
-
return schema.
|
|
769
|
+
return schema.trim();
|
|
750
770
|
};
|
|
751
771
|
}
|
|
752
|
-
function
|
|
772
|
+
function schemaToLowerCase() {
|
|
753
773
|
return function (schema) {
|
|
754
|
-
return schema.
|
|
774
|
+
return schema.toLowerCase();
|
|
755
775
|
};
|
|
756
776
|
}
|
|
757
|
-
function
|
|
777
|
+
function schemaToUpperCase() {
|
|
758
778
|
return function (schema) {
|
|
759
|
-
return schema.
|
|
779
|
+
return schema.toUpperCase();
|
|
760
780
|
};
|
|
761
781
|
}
|
|
762
|
-
function
|
|
782
|
+
function schemaLowercase(params) {
|
|
763
783
|
return function (schema) {
|
|
764
|
-
return schema.
|
|
784
|
+
return schema.lowercase(params);
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function schemaUppercase(params) {
|
|
788
|
+
return function (schema) {
|
|
789
|
+
return schema.uppercase(params);
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
function schemaRegex(regex, params) {
|
|
793
|
+
return function (schema) {
|
|
794
|
+
return schema.regex(regex, params);
|
|
765
795
|
};
|
|
766
796
|
}
|
|
767
797
|
function schemaTableIdentity() {
|
|
@@ -782,6 +812,13 @@ function schemaBigNumber() {
|
|
|
782
812
|
return z.union([z.string(), z.number()]);
|
|
783
813
|
};
|
|
784
814
|
}
|
|
815
|
+
function schemaCaptcha(options) {
|
|
816
|
+
return function (schema) {
|
|
817
|
+
return schema.openapi({
|
|
818
|
+
captcha: options
|
|
819
|
+
});
|
|
820
|
+
};
|
|
821
|
+
}
|
|
785
822
|
|
|
786
823
|
function schemaOpenapi(refId, metadata) {
|
|
787
824
|
return function (schema) {
|
|
@@ -843,6 +880,47 @@ function schemaArray(schemaLike, params) {
|
|
|
843
880
|
);
|
|
844
881
|
};
|
|
845
882
|
}
|
|
883
|
+
function schemaStrictObject() {
|
|
884
|
+
return function (schema) {
|
|
885
|
+
return z.strictObject(schema.shape);
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function schemaLooseObject() {
|
|
889
|
+
return function (schema) {
|
|
890
|
+
return z.looseObject(schema.shape);
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function schemaZodRefine(zodRefineName, options) {
|
|
895
|
+
return function (schema) {
|
|
896
|
+
return schema.superRefine(async (value, refinementCtx) => {
|
|
897
|
+
const app = useApp();
|
|
898
|
+
const options2 = app.bean.onion.zodRefine.getOnionOptionsDynamic(zodRefineName, options);
|
|
899
|
+
// execute
|
|
900
|
+
const beanFullName = beanFullNameFromOnionName(zodRefineName, 'zodRefine');
|
|
901
|
+
const beanInstance = app.bean._getBean(beanFullName);
|
|
902
|
+
if (!beanInstance) {
|
|
903
|
+
throw new Error(`zodRefine bean not found: ${beanFullName}`);
|
|
904
|
+
}
|
|
905
|
+
return await beanInstance.execute(value, refinementCtx, options2);
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
function schemaZodTransform(zodTransformName, options) {
|
|
910
|
+
return function (schema) {
|
|
911
|
+
return schema.transform(async value => {
|
|
912
|
+
const app = useApp();
|
|
913
|
+
const options2 = app.bean.onion.zodTransform.getOnionOptionsDynamic(zodTransformName, options);
|
|
914
|
+
// execute
|
|
915
|
+
const beanFullName = beanFullNameFromOnionName(zodTransformName, 'zodTransform');
|
|
916
|
+
const beanInstance = app.bean._getBean(beanFullName);
|
|
917
|
+
if (!beanInstance) {
|
|
918
|
+
throw new Error(`zodTransform bean not found: ${beanFullName}`);
|
|
919
|
+
}
|
|
920
|
+
return await beanInstance.execute(value, options2);
|
|
921
|
+
});
|
|
922
|
+
};
|
|
923
|
+
}
|
|
846
924
|
|
|
847
925
|
const v = {
|
|
848
926
|
lazy: schemaLazy,
|
|
@@ -850,20 +928,33 @@ const v = {
|
|
|
850
928
|
default: schemaDefault,
|
|
851
929
|
object: schemaObject,
|
|
852
930
|
optional: schemaOptional,
|
|
931
|
+
strictObject: schemaStrictObject,
|
|
932
|
+
looseObject: schemaLooseObject,
|
|
853
933
|
// helpers
|
|
854
934
|
email: schemaEmail,
|
|
855
935
|
url: schemaUrl,
|
|
856
936
|
uuid: schemaUuid,
|
|
857
|
-
|
|
937
|
+
ipv4: schemaIPv4,
|
|
938
|
+
ipv6: schemaIPv6,
|
|
858
939
|
min: schemaMin,
|
|
859
940
|
max: schemaMax,
|
|
941
|
+
trim: schemaTrim,
|
|
942
|
+
toLowerCase: schemaToLowerCase,
|
|
943
|
+
toUpperCase: schemaToUpperCase,
|
|
944
|
+
lowercase: schemaLowercase,
|
|
945
|
+
uppercase: schemaUppercase,
|
|
946
|
+
regex: schemaRegex,
|
|
860
947
|
tableIdentity: schemaTableIdentity,
|
|
861
948
|
bigNumber: schemaBigNumber,
|
|
949
|
+
captcha: schemaCaptcha,
|
|
862
950
|
// openapi
|
|
863
951
|
openapi: schemaOpenapi,
|
|
864
952
|
title: schemaTitle,
|
|
865
953
|
description: schemaDescription,
|
|
866
|
-
example: schemaExample
|
|
954
|
+
example: schemaExample,
|
|
955
|
+
// zod
|
|
956
|
+
refine: schemaZodRefine,
|
|
957
|
+
transform: schemaZodTransform
|
|
867
958
|
};
|
|
868
959
|
|
|
869
960
|
const OrderCoreBase = 100;
|
|
@@ -871,4 +962,4 @@ const OrderBusinessBase = 1000;
|
|
|
871
962
|
const OrderUnknownBase = 10000;
|
|
872
963
|
const OrderMaxBase = 100000;
|
|
873
964
|
|
|
874
|
-
export { $
|
|
965
|
+
export { $schema, $schemaLazy, Api, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SummerCacheJson, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, SymbolSchemaDynamicRefId, addSchemaDynamic, bodySchemaWrapperDefault, config, getSchemaDynamic, getSchemasDynamic, getTargetDecoratorRuleColumns, getTargetDecoratorRules, makeSchemaLike, makeSchemaLikes, mergeFieldsOpenapiMetadata, prepareClassType, schemaRefCustomAdapter, v };
|
|
@@ -3,12 +3,4 @@ export declare function bodySchemaWrapperDefault(bodySchema: any): z.ZodObject<{
|
|
|
3
3
|
code: z.ZodString;
|
|
4
4
|
message: z.ZodString;
|
|
5
5
|
data: any;
|
|
6
|
-
},
|
|
7
|
-
message: string;
|
|
8
|
-
code: string;
|
|
9
|
-
data?: any;
|
|
10
|
-
}, {
|
|
11
|
-
message: string;
|
|
12
|
-
code: string;
|
|
13
|
-
data?: any;
|
|
14
|
-
}>;
|
|
6
|
+
}, z.core.$strip>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
export declare function makeSchemaLikes(schemaLikes: SchemaLike[], typeInit: any): z.
|
|
4
|
-
export declare function makeSchemaLike(schemaLike: SchemaLike | undefined, schemaPrevious: z.
|
|
3
|
+
export declare function makeSchemaLikes<T>(schemaLikes: SchemaLike<T> | SchemaLike<T>[], typeInit: any): z.ZodType<T>;
|
|
4
|
+
export declare function makeSchemaLike<T>(schemaLike: SchemaLike<T> | undefined, schemaPrevious: z.ZodType<T>): z.ZodType<T>;
|
|
@@ -2,12 +2,12 @@ import type { Constructable } from 'vona';
|
|
|
2
2
|
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
3
3
|
import type { ISchemaObjectOptions } from '../../types/decorator.ts';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
export declare function $schema(schemaLike: z.
|
|
5
|
+
export declare function $schema<T>(schemaLike: z.ZodType<T>): z.ZodType<T>;
|
|
6
6
|
export declare function $schema(classType: StringConstructor): z.ZodString;
|
|
7
7
|
export declare function $schema(classType: NumberConstructor): z.ZodNumber;
|
|
8
8
|
export declare function $schema(classType: BooleanConstructor): z.ZodBoolean;
|
|
9
9
|
export declare function $schema(classType: DateConstructor): z.ZodDate;
|
|
10
10
|
export declare function $schema(classType: BigIntConstructor): z.ZodBigInt;
|
|
11
11
|
export declare function $schema(classType: ArrayConstructor): z.ZodArray<z.ZodAny>;
|
|
12
|
-
export declare function $schema<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): z.
|
|
13
|
-
export declare function $schemaLazy<T>(...schemaLikes: SchemaLike[]): z.
|
|
12
|
+
export declare function $schema<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): z.ZodType<T>;
|
|
13
|
+
export declare function $schemaLazy<T>(...schemaLikes: SchemaLike<T>[]): z.ZodType<T>;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { errorUtil } from '../../zod/errorUtil.ts';
|
|
1
|
+
import type { ISchemaObjectExtensionFieldCaptcha } from '../../../types/captcha.ts';
|
|
3
2
|
import { z } from 'zod';
|
|
4
|
-
export declare function schemaEmail(
|
|
5
|
-
export declare function schemaUrl(
|
|
6
|
-
export declare function schemaUuid(
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
3
|
+
export declare function schemaEmail(params?: string | z.core.$ZodEmailParams): (_schema: z.ZodString) => z.ZodEmail;
|
|
4
|
+
export declare function schemaUrl(params?: string | z.core.$ZodURLParams): (_schema: z.ZodString) => z.ZodURL;
|
|
5
|
+
export declare function schemaUuid(params?: string | z.core.$ZodUUIDParams): (_schema: z.ZodString) => z.ZodUUID;
|
|
6
|
+
export declare function schemaIPv4(params?: string | z.core.$ZodIPv4Params): (_schema: z.ZodString) => z.ZodIPv4;
|
|
7
|
+
export declare function schemaIPv6(params?: string | z.core.$ZodIPv6Params): (_schema: z.ZodString) => z.ZodIPv6;
|
|
8
|
+
export declare function schemaMin(min: number, params?: string | z.core.$ZodCheckMinLengthParams | z.core.$ZodCheckGreaterThanParams): (schema: z.ZodString | z.ZodNumber) => z.ZodString | z.ZodNumber;
|
|
9
|
+
export declare function schemaMax(max: number, params?: string | z.core.$ZodCheckMaxLengthParams | z.core.$ZodCheckLessThanParams): (schema: z.ZodString | z.ZodNumber) => z.ZodString | z.ZodNumber;
|
|
10
|
+
export declare function schemaTrim(): (schema: z.ZodString) => z.ZodString;
|
|
11
|
+
export declare function schemaToLowerCase(): (schema: z.ZodString) => z.ZodString;
|
|
12
|
+
export declare function schemaToUpperCase(): (schema: z.ZodString) => z.ZodString;
|
|
13
|
+
export declare function schemaLowercase(params?: string | z.core.$ZodCheckLowerCaseParams): (schema: z.ZodString) => z.ZodString;
|
|
14
|
+
export declare function schemaUppercase(params?: string | z.core.$ZodCheckUpperCaseParams): (schema: z.ZodString) => z.ZodString;
|
|
15
|
+
export declare function schemaRegex(regex: RegExp, params?: string | z.core.$ZodCheckRegexParams): (schema: z.ZodString) => z.ZodString;
|
|
16
|
+
export declare function schemaTableIdentity(): (_schema?: any) => z.ZodString | z.ZodNumber;
|
|
17
|
+
export declare function schemaBigNumber(): (_schema: any) => z.ZodType;
|
|
18
|
+
export declare function schemaCaptcha(options: ISchemaObjectExtensionFieldCaptcha): (schema: z.ZodType) => z.ZodType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ZodOpenAPIMetadata } from '@
|
|
2
|
-
import type { z
|
|
3
|
-
export declare function schemaOpenapi<T extends
|
|
4
|
-
export declare function schemaOpenapi<T extends
|
|
5
|
-
export declare function schemaTitle<T extends
|
|
6
|
-
export declare function schemaDescription<T extends
|
|
7
|
-
export declare function schemaExample<T extends
|
|
1
|
+
import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
export declare function schemaOpenapi<T extends z.ZodType>(metadata: Partial<ZodOpenAPIMetadata<z.input<T>>>): T;
|
|
4
|
+
export declare function schemaOpenapi<T extends z.ZodType>(refId: string, metadata?: Partial<ZodOpenAPIMetadata<z.input<T>>>): T;
|
|
5
|
+
export declare function schemaTitle<T extends z.ZodType>(title?: string): (schema: T) => T;
|
|
6
|
+
export declare function schemaDescription<T extends z.ZodType>(description?: string): (schema: T) => T;
|
|
7
|
+
export declare function schemaExample<T extends z.ZodType>(example?: any): (schema: T) => T;
|
|
@@ -2,10 +2,12 @@ import type { Constructable } from 'vona';
|
|
|
2
2
|
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
3
3
|
import type { ISchemaObjectOptions } from '../../../types/decorator.ts';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
export declare function schemaDefault(defaultValue: any | Function): (schema: z.
|
|
6
|
-
export declare function schemaOptional(): (schema: z.
|
|
7
|
-
export declare function schemaLazy<T>(...schemaLikes: SchemaLike[]): (_schema?: z.
|
|
8
|
-
export declare function schemaObject<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): (_schema?: z.
|
|
9
|
-
export declare function schemaArray(schemaLike?: SchemaLike, params?: z.
|
|
5
|
+
export declare function schemaDefault(defaultValue: any | Function): (schema: z.ZodType) => z.ZodType;
|
|
6
|
+
export declare function schemaOptional(): (schema: z.ZodType) => z.ZodType;
|
|
7
|
+
export declare function schemaLazy<T>(...schemaLikes: SchemaLike<T>[]): (_schema?: z.ZodType) => z.ZodType<T>;
|
|
8
|
+
export declare function schemaObject<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): (_schema?: z.ZodType) => z.ZodType<T>;
|
|
9
|
+
export declare function schemaArray(schemaLike?: SchemaLike, params?: z.core.$ZodArrayParams & {
|
|
10
10
|
separator?: string;
|
|
11
|
-
}): (schema: z.
|
|
11
|
+
}): (schema: z.ZodType) => z.ZodType;
|
|
12
|
+
export declare function schemaStrictObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
13
|
+
export declare function schemaLooseObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IZodRefineRecord, IZodTransformRecord } from 'vona-module-a-zod';
|
|
2
|
+
import type z from 'zod';
|
|
3
|
+
export declare function schemaZodRefine<T extends keyof IZodRefineRecord>(zodRefineName: T, options?: Partial<IZodRefineRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
|
4
|
+
export declare function schemaZodTransform<T extends keyof IZodTransformRecord>(zodTransformName: T, options?: Partial<IZodTransformRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
package/dist/lib/schema/v.d.ts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { schemaBigNumber, schemaEmail,
|
|
1
|
+
import { schemaBigNumber, schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex, schemaTableIdentity, schemaToLowerCase, schemaToUpperCase, schemaTrim, schemaUppercase, schemaUrl, schemaUuid } from './v/helpers.ts';
|
|
2
2
|
import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from './v/openapi.ts';
|
|
3
|
-
import { schemaArray, schemaDefault, schemaLazy, schemaObject, schemaOptional } from './v/system.ts';
|
|
3
|
+
import { schemaArray, schemaDefault, schemaLazy, schemaLooseObject, schemaObject, schemaOptional, schemaStrictObject } from './v/system.ts';
|
|
4
|
+
import { schemaZodRefine, schemaZodTransform } from './v/zod.ts';
|
|
4
5
|
export declare const v: {
|
|
5
6
|
lazy: typeof schemaLazy;
|
|
6
7
|
array: typeof schemaArray;
|
|
7
8
|
default: typeof schemaDefault;
|
|
8
9
|
object: typeof schemaObject;
|
|
9
10
|
optional: typeof schemaOptional;
|
|
11
|
+
strictObject: typeof schemaStrictObject;
|
|
12
|
+
looseObject: typeof schemaLooseObject;
|
|
10
13
|
email: typeof schemaEmail;
|
|
11
14
|
url: typeof schemaUrl;
|
|
12
15
|
uuid: typeof schemaUuid;
|
|
13
|
-
|
|
16
|
+
ipv4: typeof schemaIPv4;
|
|
17
|
+
ipv6: typeof schemaIPv6;
|
|
14
18
|
min: typeof schemaMin;
|
|
15
19
|
max: typeof schemaMax;
|
|
20
|
+
trim: typeof schemaTrim;
|
|
21
|
+
toLowerCase: typeof schemaToLowerCase;
|
|
22
|
+
toUpperCase: typeof schemaToUpperCase;
|
|
23
|
+
lowercase: typeof schemaLowercase;
|
|
24
|
+
uppercase: typeof schemaUppercase;
|
|
25
|
+
regex: typeof schemaRegex;
|
|
16
26
|
tableIdentity: typeof schemaTableIdentity;
|
|
17
27
|
bigNumber: typeof schemaBigNumber;
|
|
28
|
+
captcha: typeof schemaCaptcha;
|
|
18
29
|
openapi: typeof schemaOpenapi;
|
|
19
30
|
title: typeof schemaTitle;
|
|
20
31
|
description: typeof schemaDescription;
|
|
21
32
|
example: typeof schemaExample;
|
|
33
|
+
refine: typeof schemaZodRefine;
|
|
34
|
+
transform: typeof schemaZodTransform;
|
|
22
35
|
};
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Constructable } from 'vona';
|
|
2
|
-
|
|
2
|
+
import type { TypeDecoratorRules } from 'vona-module-a-openapiutils';
|
|
3
|
+
export declare function getTargetDecoratorRules(target: object): TypeDecoratorRules;
|
|
3
4
|
export declare function getTargetDecoratorRuleColumns(target: object): Record<PropertyKey, unknown>;
|
|
4
5
|
export declare function mergeFieldsOpenapiMetadata(target: Constructable): void;
|
|
5
6
|
export declare function prepareClassType<T>(classType: (() => Constructable<T>) | Constructable<T>): Constructable<T>;
|
package/dist/lib/zod/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Constructable, Type, VonaContext } from 'vona';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
export interface ISchemaObjectOptions {
|
|
4
|
-
|
|
4
|
+
loose?: boolean;
|
|
5
5
|
strict?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface RouteHandlerArgumentMetaDecorator {
|
|
@@ -9,7 +9,7 @@ export interface RouteHandlerArgumentMetaDecorator {
|
|
|
9
9
|
type: RouteHandlerArgumentType;
|
|
10
10
|
field?: string;
|
|
11
11
|
pipes: Function[];
|
|
12
|
-
schema: z.
|
|
12
|
+
schema: z.ZodType;
|
|
13
13
|
extractValue?: TypeExtractValue;
|
|
14
14
|
}
|
|
15
15
|
export interface RouteHandlerArgumentMeta {
|
package/dist/types/query.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export interface ISchemaObjectExtensionFieldQueryJoin {
|
|
|
5
5
|
on: [string, string];
|
|
6
6
|
}
|
|
7
7
|
export interface ISchemaObjectExtensionFieldQuery {
|
|
8
|
-
|
|
8
|
+
table?: keyof ITableRecord;
|
|
9
|
+
joinType?: IModelSelectParamsJoinType;
|
|
10
|
+
joinOn?: [string, string];
|
|
9
11
|
originalName?: string;
|
|
10
12
|
op?: TypeOpsNormal;
|
|
11
13
|
}
|
package/dist/types/rest.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ZodOpenAPIMetadata } from '@
|
|
1
|
+
import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
|
|
2
2
|
import type { CurrencyOptions } from '@zhennann/currency';
|
|
3
3
|
import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
4
|
-
import type { z
|
|
4
|
+
import type { z } from 'zod';
|
|
5
5
|
import type { TypeResourceActionRowRecordRender } from './actions.ts';
|
|
6
|
+
import type { ISchemaObjectExtensionFieldCaptcha } from './captcha.ts';
|
|
6
7
|
import type { IComponentRecord } from './component.ts';
|
|
7
8
|
import type { ISchemaObjectExtensionFieldQuery } from './query.ts';
|
|
8
9
|
import 'openapi3-ts/oas30';
|
|
@@ -18,6 +19,7 @@ export interface ISchemaObjectExtensionFieldRest {
|
|
|
18
19
|
export interface ISchemaObjectExtensionField {
|
|
19
20
|
rest?: ISchemaObjectExtensionFieldRest;
|
|
20
21
|
query?: ISchemaObjectExtensionFieldQuery;
|
|
22
|
+
captcha?: ISchemaObjectExtensionFieldCaptcha;
|
|
21
23
|
}
|
|
22
24
|
declare module 'openapi3-ts/oas30' {
|
|
23
25
|
interface SchemaObject extends ISchemaObjectExtensionField {
|
|
@@ -30,9 +32,9 @@ declare module 'openapi3-ts/oas31' {
|
|
|
30
32
|
export type TypeFieldRenderComponent = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'text' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'image' | 'file' | 'color' | 'password' | 'email' | 'url';
|
|
31
33
|
export type TypeFieldRenderComponentProvider = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'input' | 'textarea' | 'select';
|
|
32
34
|
export type TypeSchemaScene = 'table' | 'form';
|
|
33
|
-
export type TypeOpenapiMetadata<T extends
|
|
35
|
+
export type TypeOpenapiMetadata<T extends z.ZodType = z.ZodType> = Partial<ZodOpenAPIMetadata<z.input<T>>>;
|
|
34
36
|
export type TypeEntityOptionsFields<T extends {}, More extends string | undefined = never> = {
|
|
35
|
-
[key in ((keyof T) | (More extends string ? More : never))]?: TypeOpenapiMetadata | z.
|
|
37
|
+
[key in ((keyof T) | (More extends string ? More : never))]?: TypeOpenapiMetadata | z.ZodType;
|
|
36
38
|
};
|
|
37
39
|
export type TypeControllerOptionsActions<T extends {}> = {
|
|
38
40
|
[key in (keyof T)]?: IOpenApiOptions;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.31",
|
|
5
5
|
"title": "a-openapi",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
11
11
|
"globalDependencies": {
|
|
12
|
-
"@
|
|
12
|
+
"@cabloy/zod-openapi": true,
|
|
13
|
+
"@cabloy/zod-to-openapi": true,
|
|
14
|
+
"openapi3-ts": true,
|
|
13
15
|
"zod": true
|
|
14
16
|
}
|
|
15
17
|
},
|
|
@@ -33,12 +35,13 @@
|
|
|
33
35
|
"static"
|
|
34
36
|
],
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@cabloy/zod-
|
|
38
|
-
"@cabloy/zod-query": "^
|
|
38
|
+
"@cabloy/zod-errors-custom": "^2.0.1",
|
|
39
|
+
"@cabloy/zod-openapi": "^1.0.1",
|
|
40
|
+
"@cabloy/zod-query": "^2.0.1",
|
|
41
|
+
"@cabloy/zod-to-openapi": "^8.1.1",
|
|
39
42
|
"@zhennann/currency": "^2.0.0",
|
|
40
|
-
"openapi3-ts": "^4.
|
|
41
|
-
"zod": "^
|
|
43
|
+
"openapi3-ts": "^4.5.0",
|
|
44
|
+
"zod": "^4.1.5"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"clean-package": "^2.2.0",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
ZodError_invalid_input: string;
|
|
3
|
-
ZodError_invalid_type_required: string;
|
|
4
|
-
ZodError_invalid_type_requiredDetail: string;
|
|
5
|
-
ZodError_invalid_literal: string;
|
|
6
|
-
ZodError_unrecognized_keys: string;
|
|
7
|
-
ZodError_invalid_union: string;
|
|
8
|
-
ZodError_invalid_union_discriminator: string;
|
|
9
|
-
ZodError_invalid_enum_value: string;
|
|
10
|
-
ZodError_invalid_arguments: string;
|
|
11
|
-
ZodError_invalid_return_type: string;
|
|
12
|
-
ZodError_invalid_date: string;
|
|
13
|
-
ZodError_invalid_string_includes: string;
|
|
14
|
-
ZodError_invalid_string_includes_position: string;
|
|
15
|
-
ZodError_invalid_string_startsWith: string;
|
|
16
|
-
ZodError_invalid_string_endsWith: string;
|
|
17
|
-
ZodError_invalid_string_validation: string;
|
|
18
|
-
ZodError_invalid_string: string;
|
|
19
|
-
ZodError_too_small_array_exact: string;
|
|
20
|
-
ZodError_too_small_array_inclusive: string;
|
|
21
|
-
ZodError_too_small_array_not_inclusive: string;
|
|
22
|
-
ZodError_too_small_string_exact: string;
|
|
23
|
-
ZodError_too_small_string_inclusive: string;
|
|
24
|
-
ZodError_too_small_string_not_inclusive: string;
|
|
25
|
-
ZodError_too_small_number_exact: string;
|
|
26
|
-
ZodError_too_small_number_inclusive: string;
|
|
27
|
-
ZodError_too_small_number_not_inclusive: string;
|
|
28
|
-
ZodError_too_small_set_exact: string;
|
|
29
|
-
ZodError_too_small_set_inclusive: string;
|
|
30
|
-
ZodError_too_small_set_not_inclusive: string;
|
|
31
|
-
ZodError_too_small_date_exact: string;
|
|
32
|
-
ZodError_too_small_date_inclusive: string;
|
|
33
|
-
ZodError_too_small_date_not_inclusive: string;
|
|
34
|
-
ZodError_too_big_array_exact: string;
|
|
35
|
-
ZodError_too_big_array_inclusive: string;
|
|
36
|
-
ZodError_too_big_array_not_inclusive: string;
|
|
37
|
-
ZodError_too_big_string_exact: string;
|
|
38
|
-
ZodError_too_big_string_inclusive: string;
|
|
39
|
-
ZodError_too_big_string_not_inclusive: string;
|
|
40
|
-
ZodError_too_big_number_exact: string;
|
|
41
|
-
ZodError_too_big_number_inclusive: string;
|
|
42
|
-
ZodError_too_big_number_not_inclusive: string;
|
|
43
|
-
ZodError_too_big_set_exact: string;
|
|
44
|
-
ZodError_too_big_set_inclusive: string;
|
|
45
|
-
ZodError_too_big_set_not_inclusive: string;
|
|
46
|
-
ZodError_too_big_date_exact: string;
|
|
47
|
-
ZodError_too_big_date_inclusive: string;
|
|
48
|
-
ZodError_too_big_date_not_inclusive: string;
|
|
49
|
-
ZodError_custom: string;
|
|
50
|
-
ZodError_invalid_intersection_types: string;
|
|
51
|
-
ZodError_not_multiple_of: string;
|
|
52
|
-
ZodError_not_finite: string;
|
|
53
|
-
ZodError_validations_email: string;
|
|
54
|
-
ZodError_validations_url: string;
|
|
55
|
-
ZodError_validations_uuid: string;
|
|
56
|
-
ZodError_validations_cuid: string;
|
|
57
|
-
ZodError_validations_regex: string;
|
|
58
|
-
ZodError_validations_datetime: string;
|
|
59
|
-
ZodError_types_function: string;
|
|
60
|
-
ZodError_types_number: string;
|
|
61
|
-
ZodError_types_string: string;
|
|
62
|
-
ZodError_types_nan: string;
|
|
63
|
-
ZodError_types_integer: string;
|
|
64
|
-
ZodError_types_float: string;
|
|
65
|
-
ZodError_types_boolean: string;
|
|
66
|
-
ZodError_types_date: string;
|
|
67
|
-
ZodError_types_bigint: string;
|
|
68
|
-
ZodError_types_undefined: string;
|
|
69
|
-
ZodError_types_symbol: string;
|
|
70
|
-
ZodError_types_null: string;
|
|
71
|
-
ZodError_types_array: string;
|
|
72
|
-
ZodError_types_object: string;
|
|
73
|
-
ZodError_types_unknown: string;
|
|
74
|
-
ZodError_types_promise: string;
|
|
75
|
-
ZodError_types_void: string;
|
|
76
|
-
ZodError_types_never: string;
|
|
77
|
-
ZodError_types_map: string;
|
|
78
|
-
ZodError_types_set: string;
|
|
79
|
-
};
|
|
80
|
-
export default _default;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
ZodError_invalid_input: string;
|
|
3
|
-
ZodError_invalid_type_required: string;
|
|
4
|
-
ZodError_invalid_type_requiredDetail: string;
|
|
5
|
-
ZodError_invalid_literal: string;
|
|
6
|
-
ZodError_unrecognized_keys: string;
|
|
7
|
-
ZodError_invalid_union: string;
|
|
8
|
-
ZodError_invalid_union_discriminator: string;
|
|
9
|
-
ZodError_invalid_enum_value: string;
|
|
10
|
-
ZodError_invalid_arguments: string;
|
|
11
|
-
ZodError_invalid_return_type: string;
|
|
12
|
-
ZodError_invalid_date: string;
|
|
13
|
-
ZodError_invalid_string_includes: string;
|
|
14
|
-
ZodError_invalid_string_includes_position: string;
|
|
15
|
-
ZodError_invalid_string_startsWith: string;
|
|
16
|
-
ZodError_invalid_string_endsWith: string;
|
|
17
|
-
ZodError_invalid_string_validation: string;
|
|
18
|
-
ZodError_invalid_string: string;
|
|
19
|
-
ZodError_too_small_array_exact: string;
|
|
20
|
-
ZodError_too_small_array_inclusive: string;
|
|
21
|
-
ZodError_too_small_array_not_inclusive: string;
|
|
22
|
-
ZodError_too_small_string_exact: string;
|
|
23
|
-
ZodError_too_small_string_inclusive: string;
|
|
24
|
-
ZodError_too_small_string_not_inclusive: string;
|
|
25
|
-
ZodError_too_small_number_exact: string;
|
|
26
|
-
ZodError_too_small_number_inclusive: string;
|
|
27
|
-
ZodError_too_small_number_not_inclusive: string;
|
|
28
|
-
ZodError_too_small_set_exact: string;
|
|
29
|
-
ZodError_too_small_set_inclusive: string;
|
|
30
|
-
ZodError_too_small_set_not_inclusive: string;
|
|
31
|
-
ZodError_too_small_date_exact: string;
|
|
32
|
-
ZodError_too_small_date_inclusive: string;
|
|
33
|
-
ZodError_too_small_date_not_inclusive: string;
|
|
34
|
-
ZodError_too_big_array_exact: string;
|
|
35
|
-
ZodError_too_big_array_inclusive: string;
|
|
36
|
-
ZodError_too_big_array_not_inclusive: string;
|
|
37
|
-
ZodError_too_big_string_exact: string;
|
|
38
|
-
ZodError_too_big_string_inclusive: string;
|
|
39
|
-
ZodError_too_big_string_not_inclusive: string;
|
|
40
|
-
ZodError_too_big_number_exact: string;
|
|
41
|
-
ZodError_too_big_number_inclusive: string;
|
|
42
|
-
ZodError_too_big_number_not_inclusive: string;
|
|
43
|
-
ZodError_too_big_set_exact: string;
|
|
44
|
-
ZodError_too_big_set_inclusive: string;
|
|
45
|
-
ZodError_too_big_set_not_inclusive: string;
|
|
46
|
-
ZodError_too_big_date_exact: string;
|
|
47
|
-
ZodError_too_big_date_inclusive: string;
|
|
48
|
-
ZodError_too_big_date_not_inclusive: string;
|
|
49
|
-
ZodError_custom: string;
|
|
50
|
-
ZodError_invalid_intersection_types: string;
|
|
51
|
-
ZodError_not_multiple_of: string;
|
|
52
|
-
ZodError_not_finite: string;
|
|
53
|
-
ZodError_validations_email: string;
|
|
54
|
-
ZodError_validations_url: string;
|
|
55
|
-
ZodError_validations_uuid: string;
|
|
56
|
-
ZodError_validations_cuid: string;
|
|
57
|
-
ZodError_validations_regex: string;
|
|
58
|
-
ZodError_validations_datetime: string;
|
|
59
|
-
ZodError_types_function: string;
|
|
60
|
-
ZodError_types_number: string;
|
|
61
|
-
ZodError_types_string: string;
|
|
62
|
-
ZodError_types_nan: string;
|
|
63
|
-
ZodError_types_integer: string;
|
|
64
|
-
ZodError_types_float: string;
|
|
65
|
-
ZodError_types_boolean: string;
|
|
66
|
-
ZodError_types_date: string;
|
|
67
|
-
ZodError_types_bigint: string;
|
|
68
|
-
ZodError_types_undefined: string;
|
|
69
|
-
ZodError_types_symbol: string;
|
|
70
|
-
ZodError_types_null: string;
|
|
71
|
-
ZodError_types_array: string;
|
|
72
|
-
ZodError_types_object: string;
|
|
73
|
-
ZodError_types_unknown: string;
|
|
74
|
-
ZodError_types_promise: string;
|
|
75
|
-
ZodError_types_void: string;
|
|
76
|
-
ZodError_types_never: string;
|
|
77
|
-
ZodError_types_map: string;
|
|
78
|
-
ZodError_types_set: string;
|
|
79
|
-
};
|
|
80
|
-
export default _default;
|