vona-module-a-openapi 5.0.40 → 5.0.42
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/index.js
CHANGED
|
@@ -683,13 +683,6 @@ function $locale(key) {
|
|
|
683
683
|
}
|
|
684
684
|
/** scope: end */
|
|
685
685
|
|
|
686
|
-
function schemaRequired(params) {
|
|
687
|
-
params = params || $locale('ZodErrorRequired');
|
|
688
|
-
return function (schema) {
|
|
689
|
-
schema._zod.def.error = z.util.normalizeParams(params).error;
|
|
690
|
-
return schema;
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
686
|
function schemaEmail(params) {
|
|
694
687
|
return function (_schema) {
|
|
695
688
|
return z.email(params);
|
|
@@ -768,9 +761,7 @@ function schemaTableIdentity() {
|
|
|
768
761
|
const ormConfig = app.util.getModuleConfigRaw('a-orm');
|
|
769
762
|
const _identityType = ormConfig?.table?.identityType ?? 'bigint';
|
|
770
763
|
return function (_schema) {
|
|
771
|
-
if (_identityType === '
|
|
772
|
-
return z.string();
|
|
773
|
-
} else if (_identityType === 'number') {
|
|
764
|
+
if (_identityType === 'number') {
|
|
774
765
|
return z.number();
|
|
775
766
|
} else if (_identityType === 'bigint') {
|
|
776
767
|
return z.string().regex(/^\d+$/);
|
|
@@ -892,6 +883,13 @@ function schemaLooseObject() {
|
|
|
892
883
|
return z.looseObject(schema.shape);
|
|
893
884
|
};
|
|
894
885
|
}
|
|
886
|
+
function schemaRequired(params) {
|
|
887
|
+
params = params || $locale('ZodErrorRequired');
|
|
888
|
+
return function (schema) {
|
|
889
|
+
schema._zod.def.error = z.util.normalizeParams(params).error;
|
|
890
|
+
return schema;
|
|
891
|
+
};
|
|
892
|
+
}
|
|
895
893
|
|
|
896
894
|
function schemaZodRefine(zodRefineName, options) {
|
|
897
895
|
return function (schema) {
|
|
@@ -925,15 +923,15 @@ function schemaZodTransform(zodTransformName, options) {
|
|
|
925
923
|
}
|
|
926
924
|
|
|
927
925
|
const v = {
|
|
928
|
-
|
|
929
|
-
|
|
926
|
+
required: schemaRequired,
|
|
927
|
+
optional: schemaOptional,
|
|
930
928
|
default: schemaDefault,
|
|
931
929
|
object: schemaObject,
|
|
932
|
-
optional: schemaOptional,
|
|
933
930
|
strictObject: schemaStrictObject,
|
|
934
931
|
looseObject: schemaLooseObject,
|
|
932
|
+
array: schemaArray,
|
|
933
|
+
lazy: schemaLazy,
|
|
935
934
|
// helpers
|
|
936
|
-
required: schemaRequired,
|
|
937
935
|
email: schemaEmail,
|
|
938
936
|
url: schemaUrl,
|
|
939
937
|
uuid: schemaUuid,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ISerializerTransformRecord, TypeSerializerTransformGetter } from 'vona-module-a-serialization';
|
|
2
2
|
import type { ISchemaObjectExtensionFieldCaptcha } from '../../../types/captcha.ts';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
export declare function schemaRequired(params?: string | z.core.$ZodStringParams): (schema: z.ZodType) => z.ZodType;
|
|
5
4
|
export declare function schemaEmail(params?: string | z.core.$ZodEmailParams): (_schema: z.ZodString) => z.ZodEmail;
|
|
6
5
|
export declare function schemaUrl(params?: string | z.core.$ZodURLParams): (_schema: z.ZodString) => z.ZodURL;
|
|
7
6
|
export declare function schemaUuid(params?: string | z.core.$ZodUUIDParams): (_schema: z.ZodString) => z.ZodUUID;
|
|
@@ -11,3 +11,4 @@ export declare function schemaArray(schemaLike?: SchemaLike, params?: z.core.$Zo
|
|
|
11
11
|
}): (schema: z.ZodType) => z.ZodType;
|
|
12
12
|
export declare function schemaStrictObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
13
13
|
export declare function schemaLooseObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
14
|
+
export declare function schemaRequired(params?: string | z.core.$ZodStringParams): (schema: z.ZodType) => z.ZodType;
|
package/dist/lib/schema/v.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex,
|
|
1
|
+
import { schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex, schemaSerializerExclude, schemaSerializerGetter, schemaSerializerSensitive, schemaSerializerTransform, 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, schemaLooseObject, schemaObject, schemaOptional, schemaStrictObject } from './v/system.ts';
|
|
3
|
+
import { schemaArray, schemaDefault, schemaLazy, schemaLooseObject, schemaObject, schemaOptional, schemaRequired, schemaStrictObject } from './v/system.ts';
|
|
4
4
|
import { schemaZodRefine, schemaZodTransform } from './v/zod.ts';
|
|
5
5
|
export declare const v: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
required: typeof schemaRequired;
|
|
7
|
+
optional: typeof schemaOptional;
|
|
8
8
|
default: typeof schemaDefault;
|
|
9
9
|
object: typeof schemaObject;
|
|
10
|
-
optional: typeof schemaOptional;
|
|
11
10
|
strictObject: typeof schemaStrictObject;
|
|
12
11
|
looseObject: typeof schemaLooseObject;
|
|
13
|
-
|
|
12
|
+
array: typeof schemaArray;
|
|
13
|
+
lazy: typeof schemaLazy;
|
|
14
14
|
email: typeof schemaEmail;
|
|
15
15
|
url: typeof schemaUrl;
|
|
16
16
|
uuid: typeof schemaUuid;
|