vona-module-a-openapiutils 5.0.17 → 5.1.2
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/LICENSE +0 -0
- package/dist/.metadata/index.d.ts +1 -0
- package/dist/.metadata/index.d.ts.map +1 -0
- package/dist/.metadata/locales.d.ts +1 -0
- package/dist/.metadata/locales.d.ts.map +1 -0
- package/dist/.metadata/this.d.ts +1 -0
- package/dist/.metadata/this.d.ts.map +1 -0
- package/dist/config/locale/en-us.d.ts +1 -0
- package/dist/config/locale/en-us.d.ts.map +1 -0
- package/dist/config/locale/zh-cn.d.ts +1 -0
- package/dist/config/locale/zh-cn.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +137 -79
- package/dist/index.js.map +1 -0
- package/dist/lib/const/database.d.ts +1 -0
- package/dist/lib/const/database.d.ts.map +1 -0
- package/dist/lib/const/decorator.d.ts +1 -0
- package/dist/lib/const/decorator.d.ts.map +1 -0
- package/dist/lib/const/index.d.ts +1 -0
- package/dist/lib/const/index.d.ts.map +1 -0
- package/dist/lib/decorator/api.d.ts +1 -0
- package/dist/lib/decorator/api.d.ts.map +1 -0
- package/dist/lib/decorator/field.d.ts +1 -0
- package/dist/lib/decorator/field.d.ts.map +1 -0
- package/dist/lib/decorator/index.d.ts +1 -0
- package/dist/lib/decorator/index.d.ts.map +1 -0
- package/dist/lib/decorator/resource.d.ts +1 -0
- package/dist/lib/decorator/resource.d.ts.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/schema/bodySchemaWrapper.d.ts +1 -0
- package/dist/lib/schema/bodySchemaWrapper.d.ts.map +1 -0
- package/dist/lib/schema/index.d.ts +2 -0
- package/dist/lib/schema/index.d.ts.map +1 -0
- package/dist/lib/schema/makeMetadata.d.ts +4 -0
- package/dist/lib/schema/makeMetadata.d.ts.map +1 -0
- package/dist/lib/schema/makeSchemaLikes.d.ts +3 -2
- package/dist/lib/schema/makeSchemaLikes.d.ts.map +1 -0
- package/dist/lib/schema/schemaDynamic.d.ts +1 -0
- package/dist/lib/schema/schemaDynamic.d.ts.map +1 -0
- package/dist/lib/schema/v/component.d.ts +5 -0
- package/dist/lib/schema/v/component.d.ts.map +1 -0
- package/dist/lib/schema/v/filter.d.ts +1 -0
- package/dist/lib/schema/v/filter.d.ts.map +1 -0
- package/dist/lib/schema/v/helpers.d.ts +1 -2
- package/dist/lib/schema/v/helpers.d.ts.map +1 -0
- package/dist/lib/schema/v/openapi.d.ts +1 -0
- package/dist/lib/schema/v/openapi.d.ts.map +1 -0
- package/dist/lib/schema/v/rest.d.ts +4 -4
- package/dist/lib/schema/v/rest.d.ts.map +1 -0
- package/dist/lib/schema/v/serializer.d.ts +1 -0
- package/dist/lib/schema/v/serializer.d.ts.map +1 -0
- package/dist/lib/schema/v/system.d.ts +2 -1
- package/dist/lib/schema/v/system.d.ts.map +1 -0
- package/dist/lib/schema/v/utils.d.ts +4 -0
- package/dist/lib/schema/v/utils.d.ts.map +1 -0
- package/dist/lib/schema/v/zod.d.ts +1 -0
- package/dist/lib/schema/v/zod.d.ts.map +1 -0
- package/dist/lib/schema/v.d.ts +7 -5
- package/dist/lib/schema/v.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +4 -1
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/web.d.ts +2 -2
- package/dist/lib/web.d.ts.map +1 -0
- package/dist/types/api.d.ts +1 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/component.d.ts +12 -0
- package/dist/types/component.d.ts.map +1 -0
- package/dist/types/decorator.d.ts +1 -0
- package/dist/types/decorator.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/order.d.ts +1 -0
- package/dist/types/order.d.ts.map +1 -0
- package/package.json +21 -16
- package/src/.metadata/index.ts +35 -0
- package/src/.metadata/locales.ts +13 -0
- package/src/.metadata/this.ts +2 -0
- package/src/config/locale/en-us.ts +3 -0
- package/src/config/locale/zh-cn.ts +3 -0
- package/src/index.ts +4 -0
- package/src/lib/const/database.ts +10 -0
- package/src/lib/const/decorator.ts +6 -0
- package/src/lib/const/index.ts +2 -0
- package/src/lib/decorator/api.ts +107 -0
- package/src/lib/decorator/field.ts +19 -0
- package/src/lib/decorator/index.ts +2 -0
- package/src/lib/decorator/resource.ts +10 -0
- package/src/lib/index.ts +6 -0
- package/src/lib/schema/bodySchemaWrapper.ts +9 -0
- package/src/lib/schema/index.ts +5 -0
- package/src/lib/schema/makeMetadata.ts +12 -0
- package/src/lib/schema/makeSchemaLikes.ts +107 -0
- package/src/lib/schema/schemaDynamic.ts +17 -0
- package/src/lib/schema/v/component.ts +78 -0
- package/src/lib/schema/v/filter.tsx +40 -0
- package/src/lib/schema/v/helpers.ts +110 -0
- package/src/lib/schema/v/openapi.ts +29 -0
- package/src/lib/schema/v/rest.ts +50 -0
- package/src/lib/schema/v/serializer.ts +86 -0
- package/src/lib/schema/v/system.ts +72 -0
- package/src/lib/schema/v/utils.ts +6 -0
- package/src/lib/schema/v/zod.ts +36 -0
- package/src/lib/schema/v.ts +88 -0
- package/src/lib/utils.ts +100 -0
- package/src/lib/web.ts +11 -0
- package/src/types/api.ts +99 -0
- package/src/types/component.ts +19 -0
- package/src/types/decorator.ts +7 -0
- package/src/types/index.ts +4 -0
- package/src/types/order.ts +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACxF,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAOxG,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,IAC3D,QAAQ,CAAC,KAAG,CAAC,CAG/B;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,IACvE,QAAQ,CAAC,KAAG,CAAC,CAG/B;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAC7C,QAAQ,CAAC,KAAG,CAAC,CAG/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { TypeDateFormat, TypeRenderComponent, TypeSchemaScene } from 'vona-module-a-openapi';
|
|
1
|
+
import type { ISchemaObjectExtensionFieldRest, ISchemaObjectExtensionFieldRestScene, TypeRenderComponent, TypeSchemaScene } from 'vona-module-a-openapi';
|
|
3
2
|
import type z from 'zod';
|
|
4
3
|
import type { TypeSchemaOrderLevel } from '../../../types/order.ts';
|
|
4
|
+
export declare function schemaRest<T extends z.ZodType>(rest?: ISchemaObjectExtensionFieldRestScene | ISchemaObjectExtensionFieldRest, scene?: TypeSchemaScene): (schema: T) => T;
|
|
5
|
+
export declare function schemaCustomKey<T extends z.ZodType>(customKey: string, scene?: TypeSchemaScene): (schema: T) => T;
|
|
5
6
|
export declare function schemaOrder<T extends z.ZodType>(order: number, level?: TypeSchemaOrderLevel, scene?: TypeSchemaScene): (schema: T) => T;
|
|
6
7
|
export declare function schemaRender<T extends z.ZodType>(render: TypeRenderComponent, scene?: TypeSchemaScene): (schema: T) => T;
|
|
7
8
|
export declare function schemaVisible<T extends z.ZodType>(visible?: boolean, scene?: TypeSchemaScene): (schema: T) => T;
|
|
8
|
-
|
|
9
|
-
export declare function schemaDate<T extends z.ZodType>(dateFormat?: TypeDateFormat, scene?: TypeSchemaScene): (schema: T) => T;
|
|
9
|
+
//# sourceMappingURL=rest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,mBAAmB,EACnB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAKpE,wBAAgB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAC5C,IAAI,CAAC,EAAE,oCAAoC,GAAG,+BAA+B,EAC7E,KAAK,CAAC,EAAE,eAAe,IAEN,QAAQ,CAAC,KAAG,CAAC,CAG/B;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,eAAe,IAC5E,QAAQ,CAAC,KAAG,CAAC,CAI/B;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,eAAe,IAElG,QAAQ,CAAC,KAAG,CAAC,CAI/B;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,eAAe,IACnF,QAAQ,CAAC,KAAG,CAAC,CAI/B;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,eAAe,IAC1E,QAAQ,CAAC,KAAG,CAAC,CAI/B"}
|
|
@@ -8,3 +8,4 @@ export declare function schemaSerializerGetter(options: Partial<ISerializerTrans
|
|
|
8
8
|
export declare function schemaSerializerGetter(getter: TypeSerializerTransformGetter): any;
|
|
9
9
|
export declare function schemaSerializerCustom(options: Partial<ISerializerTransformOptionsCustom>): any;
|
|
10
10
|
export declare function schemaSerializerCustom(getter: TypeSerializerTransformCustom): any;
|
|
11
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,0BAA0B,EAC1B,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,0BAA0B,EAClF,uBAAuB,EAAE,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,IAE/B,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAO/C;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,kCAAkC,CAAC,OAAE;AAC9F,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,OAAE;AAiB3D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,CAAC,yBAAyB,CAAC,IACnF,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAO/C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,iCAAiC,CAAC,OAAE;AAC5F,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,6BAA6B,OAAE;AAiB9E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,iCAAiC,CAAC,OAAE;AAC5F,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,6BAA6B,OAAE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Constructable, ILocaleMagic } from 'vona';
|
|
2
2
|
import type { ISchemaObjectOptions } from 'vona-module-a-openapi';
|
|
3
|
-
import type { SchemaLike } from '../../../types/decorator.ts';
|
|
4
3
|
import { z } from 'zod';
|
|
4
|
+
import type { SchemaLike } from '../../../types/decorator.ts';
|
|
5
5
|
export declare function schemaDefault(defaultValue: any | Function): (schema: z.ZodType) => z.ZodType;
|
|
6
6
|
export declare function schemaOptional(): (schema: z.ZodType) => z.ZodType;
|
|
7
7
|
export declare function schemaLazy<T>(...schemaLikes: SchemaLike<T>[]): (_schema?: z.ZodType) => z.ZodType<T>;
|
|
@@ -12,3 +12,4 @@ export declare function schemaArray(schemaLike?: SchemaLike, params?: z.core.$Zo
|
|
|
12
12
|
export declare function schemaStrictObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
13
13
|
export declare function schemaLooseObject(): (schema: z.ZodObject) => z.ZodObject;
|
|
14
14
|
export declare function schemaRequired(params?: string | ILocaleMagic | z.core.$ZodStringParams): (schema: z.ZodType) => z.ZodType;
|
|
15
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAM9D,wBAAgB,aAAa,CAAC,YAAY,EAAE,GAAG,GAAG,QAAQ,IACvC,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAG/C;AAED,wBAAgB,cAAc,KACX,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAG/C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAC1C,UAAU,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAGpD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,IACxE,UAAU,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAGpD;AAED,wBAAgB,WAAW,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,IAC1F,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAa/C;AAED,wBAAgB,kBAAkB,KACf,QAAQ,CAAC,CAAC,SAAS,KAAG,CAAC,CAAC,SAAS,CAGnD;AAED,wBAAgB,iBAAiB,KACd,QAAQ,CAAC,CAAC,SAAS,KAAG,CAAC,CAAC,SAAS,CAGnD;AAED,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,IAEpE,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAI/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,eAAe,KAEvG"}
|
|
@@ -2,3 +2,4 @@ import type { IZodRefineRecord, IZodTransformRecord } from 'vona-module-a-zod';
|
|
|
2
2
|
import type z from 'zod';
|
|
3
3
|
export declare function schemaZodRefine<T extends keyof IZodRefineRecord>(zodRefineName: T, options?: Partial<IZodRefineRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
|
4
4
|
export declare function schemaZodTransform<T extends keyof IZodTransformRecord>(zodTransformName: T, options?: Partial<IZodTransformRecord[T]>): (schema: z.ZodType) => z.ZodType;
|
|
5
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../src/lib/schema/v/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAwB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,aAAa,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IACvG,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAa/C;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,gBAAgB,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IACnH,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAAO,CAa/C"}
|
package/dist/lib/schema/v.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { schemaComponent } from './v/component.ts';
|
|
1
2
|
import { schemaFilter, schemaFilterDateRange, schemaFilterTransform } from './v/filter.tsx';
|
|
2
|
-
import {
|
|
3
|
+
import { schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex, schemaTableIdentity, schemaToLowerCase, schemaToUpperCase, schemaTrim, schemaUppercase, schemaUrl, schemaUuid } from './v/helpers.ts';
|
|
3
4
|
import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from './v/openapi.ts';
|
|
4
|
-
import {
|
|
5
|
+
import { schemaCustomKey, schemaOrder, schemaRender, schemaRest, schemaVisible } from './v/rest.ts';
|
|
5
6
|
import { schemaSerializerCustom, schemaSerializerExclude, schemaSerializerGetter, schemaSerializerReplace, schemaSerializerTransform } from './v/serializer.ts';
|
|
6
7
|
import { schemaArray, schemaDefault, schemaLazy, schemaLooseObject, schemaObject, schemaOptional, schemaRequired, schemaStrictObject } from './v/system.ts';
|
|
7
8
|
import { schemaZodRefine, schemaZodTransform } from './v/zod.ts';
|
|
@@ -28,7 +29,6 @@ export declare const v: {
|
|
|
28
29
|
uppercase: typeof schemaUppercase;
|
|
29
30
|
regex: typeof schemaRegex;
|
|
30
31
|
tableIdentity: typeof schemaTableIdentity;
|
|
31
|
-
captcha: typeof schemaCaptcha;
|
|
32
32
|
serializerExclude: typeof schemaSerializerExclude;
|
|
33
33
|
serializerTransform: typeof schemaSerializerTransform;
|
|
34
34
|
serializerReplace: typeof schemaSerializerReplace;
|
|
@@ -41,11 +41,13 @@ export declare const v: {
|
|
|
41
41
|
title: typeof schemaTitle;
|
|
42
42
|
description: typeof schemaDescription;
|
|
43
43
|
example: typeof schemaExample;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
rest: typeof schemaRest;
|
|
45
|
+
customKey: typeof schemaCustomKey;
|
|
46
46
|
order: typeof schemaOrder;
|
|
47
47
|
render: typeof schemaRender;
|
|
48
48
|
visible: typeof schemaVisible;
|
|
49
|
+
component: typeof schemaComponent;
|
|
49
50
|
refine: typeof schemaZodRefine;
|
|
50
51
|
transform: typeof schemaZodTransform;
|
|
51
52
|
};
|
|
53
|
+
//# sourceMappingURL=v.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/lib/schema/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDb,CAAC"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Constructable, ILocaleMagic } from 'vona';
|
|
2
2
|
import type { TypeOpenapiMetadata } from 'vona-module-a-openapi';
|
|
3
|
-
import type { TypeDecoratorRules } from '../types/decorator.ts';
|
|
4
3
|
import { z } from 'zod';
|
|
4
|
+
import type { TypeDecoratorRules } from '../types/decorator.ts';
|
|
5
|
+
import type { TypeSchemaOrderLevel } from '../types/order.ts';
|
|
5
6
|
export declare function getTargetDecoratorRules(target: object, disableRegisterMetadata?: boolean): TypeDecoratorRules;
|
|
6
7
|
export declare function getTargetDecoratorRuleColumns(target: object): string[];
|
|
7
8
|
export declare function getTargetDecoratorRuleColumnsMap(target: object): Record<string, string>;
|
|
@@ -9,3 +10,5 @@ export declare function mergeFieldsOpenapiMetadata(target: Constructable): void;
|
|
|
9
10
|
export declare function mergeFieldOpenapiMetadata(target: object, prop: string, fieldRule?: TypeOpenapiMetadata | z.ZodType): TypeDecoratorRules;
|
|
10
11
|
export declare function prepareClassType<T>(classType: (() => Constructable<T>) | Constructable<T>): Constructable<T>;
|
|
11
12
|
export declare function normalizeErrorParams(params?: string | ILocaleMagic | any, errorDefault?: any): any;
|
|
13
|
+
export declare function $order(order: number, level?: TypeSchemaOrderLevel): number;
|
|
14
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAK9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,uBAAuB,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAS7G;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOvF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,QAU/D;AAGD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,mBAAmB,GAAG,CAAC,CAAC,OAAO,GAAG,kBAAkB,CA6BvI;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5G;AAED,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,OAO5F;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB,UAGjE"}
|
package/dist/lib/web.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IApiPathRecord
|
|
1
|
+
import type { IApiPathRecord } from 'vona-module-a-web';
|
|
2
2
|
export declare function $apiPath<K extends keyof IApiPathRecord>(path: K): K;
|
|
3
3
|
export declare function $apiPathAndCombineParamsAndQuery<K extends keyof IApiPathRecord>(path: K, options?: {
|
|
4
4
|
params?: object;
|
|
5
5
|
query?: object;
|
|
6
6
|
}): string;
|
|
7
|
-
|
|
7
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/lib/web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE/I"}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -36,3 +36,4 @@ export interface IOpenapiOptions {
|
|
|
36
36
|
setHeaders?: IResponseHeaders;
|
|
37
37
|
}
|
|
38
38
|
export type TypeResponseContentType = 'application/json' | 'application/xml' | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | 'text/html' | 'application/octet-stream' | 'application/pdf' | 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'image/bmp' | 'image/tiff' | 'image/vnd.microsoft.icon' | 'image/vnd.wap.wbmp' | 'image/x-icon' | 'image/x-jng' | 'image/x-ms-bmp' | 'image/x-portable-bitmap' | 'image/x-portable-graymap' | 'image/x-portable-pixmap' | 'image/x-xbitmap' | 'image/x-xpixmap' | 'image/x-xwindowdump' | 'image/bmp' | 'image/x-bmp' | 'image/x-xbitmap' | 'image/x-win-bitmap' | 'image/x-windows-bmp' | 'image/ms-bmp' | 'image/x-ms-bmp' | 'image/x-icon' | 'image/x-ico' | 'image/vnd.microsoft.icon' | 'image/ico' | 'image/icon' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application/javascript' | 'application/ecmascript' | 'application/json' | 'application/ld+json' | 'application/manifest+json' | 'application/javascript' | 'application/x-javascript' | 'application/x-json' | 'application/x-ms-application';
|
|
39
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,KAAK,CAAC;AAC/C,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,eAAe,CAAC;IACrB,GAAG,EAAE,eAAe,CAAC;CACtB;AACD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;AAE/F,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAAC;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,iBAAiB,GACjB,mCAAmC,GACnC,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,0BAA0B,GAC1B,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,eAAe,GACf,WAAW,GACX,YAAY,GACZ,0BAA0B,GAC1B,oBAAoB,GACpB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,yBAAyB,GACzB,0BAA0B,GAC1B,yBAAyB,GACzB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,oBAAoB,GACpB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,0BAA0B,GAC1B,WAAW,GACX,YAAY,GACZ,UAAU,GACV,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,UAAU,GACV,wBAAwB,GACxB,wBAAwB,GACxB,kBAAkB,GAClB,qBAAqB,GACrB,2BAA2B,GAC3B,wBAAwB,GACxB,0BAA0B,GAC1B,oBAAoB,GACpB,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CurrencyOptions } from '@zhennann/currency';
|
|
2
|
+
import type { ICaptchaOptions, IResourcePickerOptions, ISelectOptions, ITextareaOptions, IToggleOptions, TypeDateFormat } from 'vona-module-a-openapi';
|
|
3
|
+
export interface ISchemaComponentRecord {
|
|
4
|
+
currency: CurrencyOptions;
|
|
5
|
+
date: TypeDateFormat;
|
|
6
|
+
captcha: ICaptchaOptions;
|
|
7
|
+
toggle: IToggleOptions;
|
|
8
|
+
select: ISelectOptions;
|
|
9
|
+
resourcePicker: IResourcePickerOptions;
|
|
10
|
+
textarea: ITextareaOptions;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,sBAAsB,CAAC;IACvC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B"}
|
|
@@ -3,3 +3,4 @@ import type z from 'zod';
|
|
|
3
3
|
export type SchemaLikeCreate = (schema: any) => any;
|
|
4
4
|
export type SchemaLike<T = unknown> = SchemaLikeCreate | z.ZodType<T> | Constructable;
|
|
5
5
|
export type TypeDecoratorRules = Record<string, z.ZodType | undefined>;
|
|
6
|
+
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/types/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;AACpD,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;AAEtF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
package/dist/types/order.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/types/order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-openapiutils",
|
|
3
|
-
"
|
|
4
|
-
"version": "5.0.17",
|
|
5
|
-
"title": "a-openapiutils",
|
|
6
|
-
"vonaModule": {
|
|
7
|
-
"dependencies": {}
|
|
8
|
-
},
|
|
3
|
+
"version": "5.1.2",
|
|
9
4
|
"description": "",
|
|
10
|
-
"author": "",
|
|
11
5
|
"keywords": [
|
|
12
6
|
"Vona Module"
|
|
13
7
|
],
|
|
8
|
+
"author": "",
|
|
9
|
+
"files": [
|
|
10
|
+
"assets",
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"types": [
|
|
@@ -21,15 +22,19 @@
|
|
|
21
22
|
},
|
|
22
23
|
"./package.json": "./package.json"
|
|
23
24
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
27
|
+
"tsc:publish": "npm run clean && vona :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
28
|
+
"prepublishOnly": "npm run tsc:publish",
|
|
29
|
+
"prepack": "clean-package",
|
|
30
|
+
"postpack": "clean-package restore && npm run clean"
|
|
31
|
+
},
|
|
28
32
|
"dependencies": {
|
|
29
33
|
"@zhennann/currency": "^2.0.0"
|
|
30
34
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
}
|
|
35
|
-
|
|
35
|
+
"title": "a-openapiutils",
|
|
36
|
+
"vonaModule": {
|
|
37
|
+
"dependencies": {}
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d"
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// eslint-disable
|
|
2
|
+
/** locale: begin */
|
|
3
|
+
import { locales } from './locales.ts';
|
|
4
|
+
/** locale: end */
|
|
5
|
+
/** scope: begin */
|
|
6
|
+
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleLocales, type TypeLocaleBase } from 'vona';
|
|
7
|
+
import { Scope } from 'vona-module-a-bean';
|
|
8
|
+
|
|
9
|
+
@Scope()
|
|
10
|
+
export class ScopeModuleAOpenapiutils extends BeanScopeBase {}
|
|
11
|
+
|
|
12
|
+
export interface ScopeModuleAOpenapiutils {
|
|
13
|
+
util: BeanScopeUtil;
|
|
14
|
+
locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
import 'vona';
|
|
18
|
+
declare module 'vona' {
|
|
19
|
+
export interface IBeanScopeRecord {
|
|
20
|
+
'a-openapiutils': ScopeModuleAOpenapiutils;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IBeanScopeContainer {
|
|
24
|
+
openapiutils: ScopeModuleAOpenapiutils;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export interface IBeanScopeLocale {
|
|
30
|
+
'a-openapiutils': (typeof locales)[TypeLocaleBase];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
/** scope: end */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TypeLocaleBase } from 'vona';
|
|
2
|
+
import { $makeLocaleMagic } from 'vona';
|
|
3
|
+
import locale_en_us from '../config/locale/en-us.ts';
|
|
4
|
+
import locale_zh_cn from '../config/locale/zh-cn.ts';
|
|
5
|
+
|
|
6
|
+
export const locales = {
|
|
7
|
+
'en-us': locale_en_us,
|
|
8
|
+
'zh-cn': locale_zh_cn,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K, ...args: any[]): any {
|
|
12
|
+
return $makeLocaleMagic(`a-openapiutils::${key}`, ...args);
|
|
13
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const OrderCoreBase = 100;
|
|
2
|
+
export const OrderBusinessBase = 1000;
|
|
3
|
+
export const OrderUnknownBase = 10000;
|
|
4
|
+
export const OrderMaxBase = 100000;
|
|
5
|
+
|
|
6
|
+
export const OrderLevelBaseMap = {
|
|
7
|
+
core: OrderCoreBase,
|
|
8
|
+
business: OrderBusinessBase,
|
|
9
|
+
max: OrderMaxBase,
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SymbolRouteHandlersArgumentsMeta = Symbol('SymbolRouteHandlersArgumentsMeta');
|
|
2
|
+
export const SymbolRouteHandlersArgumentsValue = Symbol('SymbolRouteHandlersArgumentsValue');
|
|
3
|
+
|
|
4
|
+
export const SymbolOpenApiOptions = Symbol('SymbolOpenApiOptions');
|
|
5
|
+
export const SymbolDecoratorRule = Symbol('SymbolDecoratorRule');
|
|
6
|
+
export const SymbolControllerResource = Symbol('SymbolControllerResource');
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { MetadataKey } from 'vona';
|
|
2
|
+
|
|
3
|
+
import { appMetadata } from 'vona';
|
|
4
|
+
|
|
5
|
+
import type { IOpenapiHeader, IOpenapiOptions, TypeResponseContentType } from '../../types/api.ts';
|
|
6
|
+
import type { SchemaLike, SchemaLikeCreate } from '../../types/decorator.ts';
|
|
7
|
+
|
|
8
|
+
import { SymbolOpenApiOptions } from '../const/decorator.ts';
|
|
9
|
+
import { makeSchemaLikes } from '../schema/makeSchemaLikes.ts';
|
|
10
|
+
import { Field } from './field.ts';
|
|
11
|
+
|
|
12
|
+
function httpCode(httpCode: number): MethodDecorator {
|
|
13
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
14
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
15
|
+
options.httpCode = httpCode;
|
|
16
|
+
return descriptor;
|
|
17
|
+
} as any;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function contentType(contentType: TypeResponseContentType): MethodDecorator {
|
|
21
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
22
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
23
|
+
options.contentType = contentType;
|
|
24
|
+
return descriptor;
|
|
25
|
+
} as any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function body(...schemaLikes: SchemaLike[]): MethodDecorator {
|
|
29
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
30
|
+
// schema
|
|
31
|
+
const metaType = appMetadata.getDesignReturntype(target, prop);
|
|
32
|
+
const schema = makeSchemaLikes(schemaLikes, metaType);
|
|
33
|
+
// options
|
|
34
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
35
|
+
options.bodySchema = schema;
|
|
36
|
+
return descriptor;
|
|
37
|
+
} as any;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function bodyCustom(bodySchemaWrapper: SchemaLikeCreate | false, ...schemaLikes: SchemaLike[]): MethodDecorator {
|
|
41
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
42
|
+
// schema
|
|
43
|
+
const metaType = appMetadata.getDesignReturntype(target, prop);
|
|
44
|
+
const schema = makeSchemaLikes(schemaLikes, metaType);
|
|
45
|
+
// options
|
|
46
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
47
|
+
options.bodySchema = schema;
|
|
48
|
+
options.bodySchemaWrapper = bodySchemaWrapper;
|
|
49
|
+
return descriptor;
|
|
50
|
+
} as any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function exclude(): ClassDecorator & MethodDecorator {
|
|
54
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
55
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
56
|
+
options.exclude = true;
|
|
57
|
+
return descriptor;
|
|
58
|
+
} as any;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function tags(tags: string[]): ClassDecorator & MethodDecorator {
|
|
62
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
63
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
64
|
+
options.tags = tags;
|
|
65
|
+
return descriptor;
|
|
66
|
+
} as any;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function header(header: IOpenapiHeader): ClassDecorator & MethodDecorator {
|
|
70
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
71
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
72
|
+
if (!options.headers) options.headers = [];
|
|
73
|
+
options.headers.push(header);
|
|
74
|
+
return descriptor;
|
|
75
|
+
} as any;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function headers(headers: IOpenapiHeader[]): ClassDecorator & MethodDecorator {
|
|
79
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
80
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
81
|
+
if (!options.headers) options.headers = [];
|
|
82
|
+
options.headers.push(...headers);
|
|
83
|
+
return descriptor;
|
|
84
|
+
} as any;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function setHeader(field: { [key: string]: string | string[] }): ClassDecorator & MethodDecorator;
|
|
88
|
+
function setHeader(field: string, val: string | string[]): ClassDecorator & MethodDecorator;
|
|
89
|
+
function setHeader(field: any, val?: any): ClassDecorator & MethodDecorator {
|
|
90
|
+
return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
91
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
92
|
+
if (!options.setHeaders) options.setHeaders = {};
|
|
93
|
+
if (typeof field === 'string') {
|
|
94
|
+
options.setHeaders[field] = val;
|
|
95
|
+
} else {
|
|
96
|
+
Object.assign(options.setHeaders, field);
|
|
97
|
+
}
|
|
98
|
+
return descriptor;
|
|
99
|
+
} as any;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const Api = { field: Field, httpCode, contentType, body, bodyCustom, exclude, tags, header, headers, setHeader };
|
|
103
|
+
|
|
104
|
+
export function setPublic(target: object, prop?: MetadataKey, _descriptor?: PropertyDescriptor, value?: boolean) {
|
|
105
|
+
const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
|
|
106
|
+
options.public = value;
|
|
107
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MetadataKey } from 'vona';
|
|
2
|
+
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
3
|
+
|
|
4
|
+
import { appMetadata } from 'vona';
|
|
5
|
+
|
|
6
|
+
import { makeSchemaLikes } from '../schema/makeSchemaLikes.ts';
|
|
7
|
+
import { v } from '../schema/v.ts';
|
|
8
|
+
import { mergeFieldOpenapiMetadata } from '../utils.ts';
|
|
9
|
+
|
|
10
|
+
export function Field(...schemaLikes: SchemaLike[]): PropertyDecorator {
|
|
11
|
+
return function (target: object, prop: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
12
|
+
const metaType = appMetadata.getDesignType(target, prop);
|
|
13
|
+
const schema = makeSchemaLikes(schemaLikes, metaType);
|
|
14
|
+
const rules = mergeFieldOpenapiMetadata(target, prop as string, schema);
|
|
15
|
+
if (descriptor?.get) {
|
|
16
|
+
rules[prop as string] = v.serializerGetter(descriptor.get)(rules[prop as string]!);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { appMetadata } from 'vona';
|
|
2
|
+
|
|
3
|
+
import { SymbolControllerResource } from '../const/decorator.ts';
|
|
4
|
+
|
|
5
|
+
export function Resource(): ClassDecorator {
|
|
6
|
+
return function (target: object) {
|
|
7
|
+
// controller resource
|
|
8
|
+
appMetadata.defineMetadata(SymbolControllerResource, true, target);
|
|
9
|
+
};
|
|
10
|
+
}
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
|
|
2
|
+
|
|
3
|
+
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
4
|
+
|
|
5
|
+
import type { SchemaLike } from '../../types/decorator.ts';
|
|
6
|
+
|
|
7
|
+
import { $makeSchema } from './makeSchemaLikes.ts';
|
|
8
|
+
|
|
9
|
+
export function $makeMetadata<T>(...schemaLikes: SchemaLike<T>[]): ZodOpenAPIMetadata<T> | undefined {
|
|
10
|
+
const schema = $makeSchema(...schemaLikes);
|
|
11
|
+
return ZodMetadata.getOpenapiMetadata(schema);
|
|
12
|
+
}
|