vona-module-a-openapi 5.0.50 → 5.0.52
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
|
@@ -779,66 +779,100 @@ function schemaCaptcha(options) {
|
|
|
779
779
|
});
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
|
-
|
|
782
|
+
|
|
783
|
+
function schemaOpenapi(refId, metadata) {
|
|
784
|
+
return function (schema) {
|
|
785
|
+
return schema.openapi(refId, metadata);
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
function schemaTitle(title) {
|
|
783
789
|
return function (schema) {
|
|
784
790
|
return schema.openapi({
|
|
785
|
-
|
|
791
|
+
title
|
|
786
792
|
});
|
|
787
793
|
};
|
|
788
794
|
}
|
|
789
|
-
function
|
|
795
|
+
function schemaDescription(description) {
|
|
790
796
|
return function (schema) {
|
|
791
797
|
return schema.openapi({
|
|
792
|
-
|
|
793
|
-
[serializerTransformName]: options
|
|
794
|
-
}
|
|
798
|
+
description
|
|
795
799
|
});
|
|
796
800
|
};
|
|
797
801
|
}
|
|
798
|
-
function
|
|
802
|
+
function schemaExample(example) {
|
|
799
803
|
return function (schema) {
|
|
800
804
|
return schema.openapi({
|
|
801
|
-
|
|
802
|
-
'a-serialization:sensitive': options
|
|
803
|
-
}
|
|
805
|
+
example
|
|
804
806
|
});
|
|
805
807
|
};
|
|
806
808
|
}
|
|
807
|
-
|
|
809
|
+
|
|
810
|
+
function schemaSerializerTransform(serializerTransformName, options) {
|
|
808
811
|
return function (schema) {
|
|
809
812
|
return schema.openapi({
|
|
810
813
|
serializerTransforms: {
|
|
811
|
-
|
|
812
|
-
getter
|
|
813
|
-
}
|
|
814
|
+
[serializerTransformName]: options
|
|
814
815
|
}
|
|
815
816
|
});
|
|
816
817
|
};
|
|
817
818
|
}
|
|
818
|
-
|
|
819
|
-
|
|
819
|
+
function schemaSerializerExclude(param) {
|
|
820
|
+
let options;
|
|
821
|
+
if (!param || typeof param === 'boolean') {
|
|
822
|
+
options = {
|
|
823
|
+
exclude: param
|
|
824
|
+
};
|
|
825
|
+
} else {
|
|
826
|
+
options = param;
|
|
827
|
+
}
|
|
820
828
|
return function (schema) {
|
|
821
|
-
return schema.openapi(
|
|
829
|
+
return schema.openapi({
|
|
830
|
+
serializerTransforms: {
|
|
831
|
+
'a-serialization:exclude': options
|
|
832
|
+
}
|
|
833
|
+
});
|
|
822
834
|
};
|
|
823
835
|
}
|
|
824
|
-
function
|
|
836
|
+
function schemaSerializerReplace(options) {
|
|
825
837
|
return function (schema) {
|
|
826
838
|
return schema.openapi({
|
|
827
|
-
|
|
839
|
+
serializerTransforms: {
|
|
840
|
+
'a-serialization:replace': options
|
|
841
|
+
}
|
|
828
842
|
});
|
|
829
843
|
};
|
|
830
844
|
}
|
|
831
|
-
function
|
|
845
|
+
function schemaSerializerGetter(param) {
|
|
846
|
+
let options;
|
|
847
|
+
if (typeof param === 'function') {
|
|
848
|
+
options = {
|
|
849
|
+
getter: param
|
|
850
|
+
};
|
|
851
|
+
} else {
|
|
852
|
+
options = param;
|
|
853
|
+
}
|
|
832
854
|
return function (schema) {
|
|
833
855
|
return schema.openapi({
|
|
834
|
-
|
|
856
|
+
serializerTransforms: {
|
|
857
|
+
'a-serialization:getter': options
|
|
858
|
+
}
|
|
835
859
|
});
|
|
836
860
|
};
|
|
837
861
|
}
|
|
838
|
-
function
|
|
862
|
+
function schemaSerializerCustom(param) {
|
|
863
|
+
let options;
|
|
864
|
+
if (typeof param === 'function') {
|
|
865
|
+
options = {
|
|
866
|
+
custom: param
|
|
867
|
+
};
|
|
868
|
+
} else {
|
|
869
|
+
options = param;
|
|
870
|
+
}
|
|
839
871
|
return function (schema) {
|
|
840
872
|
return schema.openapi({
|
|
841
|
-
|
|
873
|
+
serializerTransforms: {
|
|
874
|
+
'a-serialization:custom': options
|
|
875
|
+
}
|
|
842
876
|
});
|
|
843
877
|
};
|
|
844
878
|
}
|
|
@@ -952,8 +986,9 @@ const v = {
|
|
|
952
986
|
captcha: schemaCaptcha,
|
|
953
987
|
serializerExclude: schemaSerializerExclude,
|
|
954
988
|
serializerTransform: schemaSerializerTransform,
|
|
955
|
-
|
|
989
|
+
serializerReplace: schemaSerializerReplace,
|
|
956
990
|
serializerGetter: schemaSerializerGetter,
|
|
991
|
+
serializerCustom: schemaSerializerCustom,
|
|
957
992
|
// openapi
|
|
958
993
|
openapi: schemaOpenapi,
|
|
959
994
|
title: schemaTitle,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ISerializerTransformRecord, TypeSerializerTransformGetter } from 'vona-module-a-serialization';
|
|
2
1
|
import type { ISchemaObjectExtensionFieldCaptcha } from '../../../types/captcha.ts';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
export declare function schemaEmail(params?: string | z.core.$ZodEmailParams): (_schema: z.ZodString) => z.ZodEmail;
|
|
@@ -16,7 +15,3 @@ export declare function schemaUppercase(params?: string | z.core.$ZodCheckUpperC
|
|
|
16
15
|
export declare function schemaRegex(regex: RegExp, params?: string | z.core.$ZodCheckRegexParams): (schema: z.ZodString) => z.ZodString;
|
|
17
16
|
export declare function schemaTableIdentity(): (_schema?: any) => z.ZodString | z.ZodNumber;
|
|
18
17
|
export declare function schemaCaptcha(options: ISchemaObjectExtensionFieldCaptcha): (schema: z.ZodType) => z.ZodType;
|
|
19
|
-
export declare function schemaSerializerExclude(exclude?: boolean): (schema: z.ZodType) => z.ZodType;
|
|
20
|
-
export declare function schemaSerializerTransform<T extends keyof ISerializerTransformRecord>(serializerTransformName: T, options?: Partial<ISerializerTransformRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
|
21
|
-
export declare function schemaSerializerSensitive(options: ISerializerTransformRecord['a-serialization:sensitive']): (schema: z.ZodType) => z.ZodType;
|
|
22
|
-
export declare function schemaSerializerGetter(getter: TypeSerializerTransformGetter): (schema: z.ZodType) => z.ZodType;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ISerializerTransformOptionsCustom, ISerializerTransformOptionsExclude, ISerializerTransformOptionsGetter, ISerializerTransformRecord, TypeSerializerTransformCustom, TypeSerializerTransformGetter } from 'vona-module-a-serialization';
|
|
2
|
+
import type z from 'zod';
|
|
3
|
+
export declare function schemaSerializerTransform<T extends keyof ISerializerTransformRecord>(serializerTransformName: T, options?: Partial<ISerializerTransformRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
|
4
|
+
export declare function schemaSerializerExclude(options: Partial<ISerializerTransformOptionsExclude>): any;
|
|
5
|
+
export declare function schemaSerializerExclude(exclude?: boolean): any;
|
|
6
|
+
export declare function schemaSerializerReplace(options: ISerializerTransformRecord['a-serialization:replace']): (schema: z.ZodType) => z.ZodType;
|
|
7
|
+
export declare function schemaSerializerGetter(options: Partial<ISerializerTransformOptionsGetter>): any;
|
|
8
|
+
export declare function schemaSerializerGetter(getter: TypeSerializerTransformGetter): any;
|
|
9
|
+
export declare function schemaSerializerCustom(options: Partial<ISerializerTransformOptionsCustom>): any;
|
|
10
|
+
export declare function schemaSerializerCustom(getter: TypeSerializerTransformCustom): any;
|
package/dist/lib/schema/v.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex,
|
|
1
|
+
import { 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 { schemaSerializerCustom, schemaSerializerExclude, schemaSerializerGetter, schemaSerializerReplace, schemaSerializerTransform } from './v/serializer.ts';
|
|
3
4
|
import { schemaArray, schemaDefault, schemaLazy, schemaLooseObject, schemaObject, schemaOptional, schemaRequired, schemaStrictObject } from './v/system.ts';
|
|
4
5
|
import { schemaZodRefine, schemaZodTransform } from './v/zod.ts';
|
|
5
6
|
export declare const v: {
|
|
@@ -28,8 +29,9 @@ export declare const v: {
|
|
|
28
29
|
captcha: typeof schemaCaptcha;
|
|
29
30
|
serializerExclude: typeof schemaSerializerExclude;
|
|
30
31
|
serializerTransform: typeof schemaSerializerTransform;
|
|
31
|
-
|
|
32
|
+
serializerReplace: typeof schemaSerializerReplace;
|
|
32
33
|
serializerGetter: typeof schemaSerializerGetter;
|
|
34
|
+
serializerCustom: typeof schemaSerializerCustom;
|
|
33
35
|
openapi: typeof schemaOpenapi;
|
|
34
36
|
title: typeof schemaTitle;
|
|
35
37
|
description: typeof schemaDescription;
|