vona-module-a-openapi 5.0.11 → 5.0.13
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 +222 -0
- package/dist/.metadata/this.d.ts +2 -0
- package/dist/config/config.d.ts +12 -0
- package/dist/config/locale/en-us.d.ts +80 -0
- package/dist/config/locale/zh-cn.d.ts +80 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +779 -0
- package/dist/lib/decorator/api.d.ts +23 -0
- package/dist/lib/decorator/arguments.d.ts +38 -0
- package/dist/lib/decorator/field.d.ts +2 -0
- package/dist/lib/decorator/index.d.ts +3 -0
- package/dist/lib/decorator/pipesArgument.d.ts +2 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/schema/bodySchemaWrapper.d.ts +14 -0
- package/dist/lib/schema/index.d.ts +4 -0
- package/dist/lib/schema/makeSchemaLikes.d.ts +4 -0
- package/dist/lib/schema/schema.d.ts +11 -0
- package/dist/lib/schema/v/helpers.d.ts +13 -0
- package/dist/lib/schema/v/openapi.d.ts +7 -0
- package/dist/lib/schema/v/system.d.ts +9 -0
- package/dist/lib/schema/v.d.ts +20 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/zod/errorUtil.d.ts +9 -0
- package/dist/lib/zod/errorsAdapter.d.ts +2 -0
- package/dist/lib/zod/index.d.ts +2 -0
- package/dist/main.d.ts +7 -0
- package/dist/service/openapi.d.ts +19 -0
- package/dist/types/actions.d.ts +15 -0
- package/dist/types/api.d.ts +33 -0
- package/dist/types/behavior.d.ts +10 -0
- package/dist/types/component.d.ts +11 -0
- package/dist/types/database.d.ts +4 -0
- package/dist/types/decorator.d.ts +30 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/rest.d.ts +37 -0
- package/package.json +7 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MetadataKey } from 'vona';
|
|
2
|
+
import type { IOpenApiHeader, TypeResponseContentType } from '../../types/api.ts';
|
|
3
|
+
import type { SchemaLike, SchemaLikeCreate } from '../../types/decorator.ts';
|
|
4
|
+
import { Field } from './field.ts';
|
|
5
|
+
export declare function setPublic(target: object, prop?: MetadataKey, _descriptor?: PropertyDescriptor, value?: boolean): void;
|
|
6
|
+
declare function contentType(contentType: TypeResponseContentType): MethodDecorator;
|
|
7
|
+
declare function body(...schemaLikes: SchemaLike[]): MethodDecorator;
|
|
8
|
+
declare function bodyCustom(bodySchemaWrapper: SchemaLikeCreate | false, ...schemaLikes: SchemaLike[]): MethodDecorator;
|
|
9
|
+
declare function exclude(): ClassDecorator & MethodDecorator;
|
|
10
|
+
declare function tags(tags: string[]): ClassDecorator & MethodDecorator;
|
|
11
|
+
declare function header(header: IOpenApiHeader): ClassDecorator & MethodDecorator;
|
|
12
|
+
declare function headers(headers: IOpenApiHeader[]): ClassDecorator & MethodDecorator;
|
|
13
|
+
export declare const Api: {
|
|
14
|
+
field: typeof Field;
|
|
15
|
+
contentType: typeof contentType;
|
|
16
|
+
body: typeof body;
|
|
17
|
+
bodyCustom: typeof bodyCustom;
|
|
18
|
+
exclude: typeof exclude;
|
|
19
|
+
tags: typeof tags;
|
|
20
|
+
header: typeof header;
|
|
21
|
+
headers: typeof headers;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SchemaLike } from '../../types/decorator.ts';
|
|
2
|
+
declare function Param(): ParameterDecorator;
|
|
3
|
+
declare function Param(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
4
|
+
declare function Param(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
5
|
+
declare function Query(): ParameterDecorator;
|
|
6
|
+
declare function Query(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
7
|
+
declare function Query(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
8
|
+
declare function Body(): ParameterDecorator;
|
|
9
|
+
declare function Body(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
10
|
+
declare function Body(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
11
|
+
declare function Headers(): ParameterDecorator;
|
|
12
|
+
declare function Headers(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
13
|
+
declare function Headers(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
14
|
+
declare function Fields(): ParameterDecorator;
|
|
15
|
+
declare function Fields(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
16
|
+
declare function Fields(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
17
|
+
declare function Field(): ParameterDecorator;
|
|
18
|
+
declare function Field(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
19
|
+
declare function Field(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
20
|
+
declare function Files(): ParameterDecorator;
|
|
21
|
+
declare function Files(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
22
|
+
declare function Files(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
23
|
+
declare function File(): ParameterDecorator;
|
|
24
|
+
declare function File(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
25
|
+
declare function File(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
26
|
+
declare function User(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
27
|
+
export declare const Arg: {
|
|
28
|
+
param: typeof Param;
|
|
29
|
+
query: typeof Query;
|
|
30
|
+
body: typeof Body;
|
|
31
|
+
headers: typeof Headers;
|
|
32
|
+
fields: typeof Fields;
|
|
33
|
+
field: typeof Field;
|
|
34
|
+
files: typeof Files;
|
|
35
|
+
file: typeof File;
|
|
36
|
+
user: typeof User;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RouteHandlerArgumentType, SchemaLike, TypeExtractValue } from '../../types/decorator.ts';
|
|
2
|
+
export declare function createPipesArgumentDecorator(paramType: RouteHandlerArgumentType, extractValue?: TypeExtractValue): (field?: string | SchemaLike, ...schemaLikes: SchemaLike[]) => ParameterDecorator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare function bodySchemaWrapperDefault(bodySchema: any): z.ZodObject<{
|
|
3
|
+
code: z.ZodString;
|
|
4
|
+
message: z.ZodString;
|
|
5
|
+
data: any;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
message: string;
|
|
8
|
+
code: string;
|
|
9
|
+
data?: any;
|
|
10
|
+
}, {
|
|
11
|
+
message: string;
|
|
12
|
+
code: string;
|
|
13
|
+
data?: any;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { SchemaLike } from '../../types/decorator.ts';
|
|
3
|
+
export declare function makeSchemaLikes(schemaLikes: SchemaLike[], typeInit: any): z.ZodSchema;
|
|
4
|
+
export declare function makeSchemaLike(schemaLike: SchemaLike | undefined, schemaPrevious: z.ZodSchema): z.ZodSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
import type { ISchemaObjectOptions } from '../../types/decorator.ts';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare function $schema(schemaLike: z.ZodSchema): z.ZodSchema;
|
|
5
|
+
export declare function $schema(classType: StringConstructor): z.ZodString;
|
|
6
|
+
export declare function $schema(classType: NumberConstructor): z.ZodNumber;
|
|
7
|
+
export declare function $schema(classType: BooleanConstructor): z.ZodBoolean;
|
|
8
|
+
export declare function $schema(classType: DateConstructor): z.ZodDate;
|
|
9
|
+
export declare function $schema(classType: BigIntConstructor): z.ZodBigInt;
|
|
10
|
+
export declare function $schema(classType: ArrayConstructor): z.ZodArray<z.ZodAny>;
|
|
11
|
+
export declare function $schema<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): z.ZodSchema<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IpVersion } from 'zod';
|
|
2
|
+
import type { errorUtil } from '../../zod/errorUtil.ts';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare function schemaEmail(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
|
|
5
|
+
export declare function schemaUrl(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
|
|
6
|
+
export declare function schemaUuid(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
|
|
7
|
+
export declare function schemaIp(options?: string | {
|
|
8
|
+
version?: IpVersion;
|
|
9
|
+
message?: string;
|
|
10
|
+
}): (schema: z.ZodString) => z.ZodString;
|
|
11
|
+
export declare function schemaMin(min: number, message?: errorUtil.ErrMessage): (schema: any) => any;
|
|
12
|
+
export declare function schemaMax(max: number, message?: errorUtil.ErrMessage): (schema: any) => any;
|
|
13
|
+
export declare function schemaTableIdentity(): (_schema: any) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ZodOpenAPIMetadata } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
import type { z, ZodTypeAny } from 'zod';
|
|
3
|
+
export declare function schemaOpenapi<T extends ZodTypeAny>(metadata: Partial<ZodOpenAPIMetadata<z.input<T>>>): any;
|
|
4
|
+
export declare function schemaOpenapi<T extends ZodTypeAny>(refId: string, metadata?: Partial<ZodOpenAPIMetadata<z.input<T>>>): any;
|
|
5
|
+
export declare function schemaTitle<T extends ZodTypeAny>(title?: string): (schema: T) => T;
|
|
6
|
+
export declare function schemaDescription<T extends ZodTypeAny>(description?: string): (schema: T) => T;
|
|
7
|
+
export declare function schemaExample<T extends ZodTypeAny>(example?: any): (schema: T) => T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
import type { ISchemaObjectOptions, SchemaLike } from '../../../types/decorator.ts';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare function schemaDefault<T>(defaultValue: T): (schema: z.ZodSchema) => z.ZodSchema;
|
|
5
|
+
export declare function schemaOptional(): (schema: z.ZodSchema) => z.ZodSchema;
|
|
6
|
+
export declare function schemaObject<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): (_schema: z.ZodSchema) => z.ZodSchema<T>;
|
|
7
|
+
export declare function schemaArray(schemaLike?: SchemaLike, params?: z.RawCreateParams & {
|
|
8
|
+
separator?: string;
|
|
9
|
+
}): (schema: z.ZodSchema) => z.ZodSchema;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { schemaEmail, schemaIp, schemaMax, schemaMin, schemaTableIdentity, schemaUrl, schemaUuid } from './v/helpers.ts';
|
|
2
|
+
import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from './v/openapi.ts';
|
|
3
|
+
import { schemaArray, schemaDefault, schemaObject, schemaOptional } from './v/system.ts';
|
|
4
|
+
export declare const v: {
|
|
5
|
+
array: typeof schemaArray;
|
|
6
|
+
default: typeof schemaDefault;
|
|
7
|
+
object: typeof schemaObject;
|
|
8
|
+
optional: typeof schemaOptional;
|
|
9
|
+
email: typeof schemaEmail;
|
|
10
|
+
url: typeof schemaUrl;
|
|
11
|
+
uuid: typeof schemaUuid;
|
|
12
|
+
ip: typeof schemaIp;
|
|
13
|
+
min: typeof schemaMin;
|
|
14
|
+
max: typeof schemaMax;
|
|
15
|
+
tableIdentity: typeof schemaTableIdentity;
|
|
16
|
+
openapi: typeof schemaOpenapi;
|
|
17
|
+
title: typeof schemaTitle;
|
|
18
|
+
description: typeof schemaDescription;
|
|
19
|
+
example: typeof schemaExample;
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
export declare function getTargetDecoratorRules(target: object): Record<PropertyKey, unknown>;
|
|
3
|
+
export declare function getTargetDecoratorRuleColumns(target: object): Record<PropertyKey, unknown>;
|
|
4
|
+
export declare function mergeFieldsOpenAPIMetadata(target: Constructable): void;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
import type { IOpenAPIObject } from '../types/api.ts';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
export declare class ServiceOpenapi extends BeanBase {
|
|
5
|
+
generateJson<K extends keyof IOpenAPIObject>(version?: K): IOpenAPIObject[K];
|
|
6
|
+
generateJsonOfControllerAction<K extends keyof IOpenAPIObject>(controller: Constructable, actionKey: string, version?: K): IOpenAPIObject[K];
|
|
7
|
+
private _translate;
|
|
8
|
+
private _translateSchema;
|
|
9
|
+
private _translateStrings;
|
|
10
|
+
private _translateString;
|
|
11
|
+
private _collectRegistry;
|
|
12
|
+
private _collectController;
|
|
13
|
+
private _registerControllerAction;
|
|
14
|
+
private _collectRequest;
|
|
15
|
+
private _collectResponses;
|
|
16
|
+
private _parseBodySchema;
|
|
17
|
+
private _prepareArgsMeta;
|
|
18
|
+
private _combineArgHeaders;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IResourceActionTableOptions {
|
|
2
|
+
}
|
|
3
|
+
export interface IResourceActionRowOptions {
|
|
4
|
+
}
|
|
5
|
+
export interface TypeResourceActionTableRecord {
|
|
6
|
+
create: IResourceActionTableOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface TypeResourceActionRowRecord {
|
|
9
|
+
view: IResourceActionRowOptions;
|
|
10
|
+
update: IResourceActionRowOptions;
|
|
11
|
+
delete: IResourceActionRowOptions;
|
|
12
|
+
}
|
|
13
|
+
export type TypeResourceActionRowRecordRender = {
|
|
14
|
+
[key in keyof TypeResourceActionRowRecord as `action${Capitalize<key>}`]: TypeResourceActionRowRecord[key];
|
|
15
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { OpenAPIObject as OpenAPIObject30, SchemaObject as SchemaObject30 } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { OpenAPIObject as OpenAPIObject31, SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';
|
|
3
|
+
import type { VonaApplication } from 'vona';
|
|
4
|
+
import type { z } from 'zod';
|
|
5
|
+
import type { SchemaLikeCreate } from './decorator.ts';
|
|
6
|
+
export declare const SymbolOpenApiOptions: unique symbol;
|
|
7
|
+
export interface IOpenApiHeader {
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IOpenApiOptions {
|
|
12
|
+
public?: boolean;
|
|
13
|
+
description?: string;
|
|
14
|
+
summary?: string;
|
|
15
|
+
contentType?: TypeResponseContentType;
|
|
16
|
+
bodySchema?: z.ZodSchema;
|
|
17
|
+
bodySchemaWrapper?: SchemaLikeCreate | false;
|
|
18
|
+
exclude?: boolean;
|
|
19
|
+
tags?: string[];
|
|
20
|
+
operationId?: string;
|
|
21
|
+
headers?: IOpenApiHeader[];
|
|
22
|
+
}
|
|
23
|
+
export type TypeOpenApiVersion = 'V30' | 'V31';
|
|
24
|
+
export interface IOpenAPIObject {
|
|
25
|
+
V30: OpenAPIObject30;
|
|
26
|
+
V31: OpenAPIObject31;
|
|
27
|
+
}
|
|
28
|
+
export interface IOpenAPISchemaObject {
|
|
29
|
+
V30: SchemaObject30;
|
|
30
|
+
V31: SchemaObject31;
|
|
31
|
+
}
|
|
32
|
+
export type TypeSecuritySchemes = Record<string, ((this: VonaApplication) => object) | object>;
|
|
33
|
+
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';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IBehaviorRecord {
|
|
2
|
+
}
|
|
3
|
+
export type TypeBehaviorRecordSelector<PREFIX extends string> = {
|
|
4
|
+
[K in keyof IBehaviorRecord as K extends `${string}:${PREFIX}${string}` ? K : never]: IBehaviorRecord[K];
|
|
5
|
+
};
|
|
6
|
+
export type TypeBehaviorRecordSelectorKeys<PREFIX extends string> = keyof TypeBehaviorRecordSelector<PREFIX>;
|
|
7
|
+
export type TypeBehaviorRecordSelectorStrict<PREFIX extends string> = {
|
|
8
|
+
[K in keyof IBehaviorRecord as K extends `${string}:${PREFIX}` ? K : never]: IBehaviorRecord[K];
|
|
9
|
+
};
|
|
10
|
+
export type TypeBehaviorRecordSelectorKeysStrict<PREFIX extends string> = keyof TypeBehaviorRecordSelectorStrict<PREFIX>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IComponentRecord {
|
|
2
|
+
}
|
|
3
|
+
export type TypeComponentRecordSelector<PREFIX extends string> = {
|
|
4
|
+
[K in keyof IComponentRecord as K extends `${string}:${PREFIX}${string}` ? K : never]: IComponentRecord[K];
|
|
5
|
+
};
|
|
6
|
+
export type TypeComponentRecordSelectorKeys<PREFIX extends string> = keyof TypeComponentRecordSelector<PREFIX>;
|
|
7
|
+
export type TypeComponentRecordSelectorStrict<PREFIX extends string> = {
|
|
8
|
+
[K in keyof IComponentRecord as K extends `${string}:${PREFIX}` ? K : never]: IComponentRecord[K];
|
|
9
|
+
};
|
|
10
|
+
export type TypeComponentRecordSelectorKeysStrict<PREFIX extends string> = keyof TypeComponentRecordSelectorStrict<PREFIX>;
|
|
11
|
+
export type TypeComponentLayoutRecord = TypeComponentRecordSelector<'layout'>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Constructable, Type, VonaContext } from 'vona';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
export declare const SymbolDecoratorRule: unique symbol;
|
|
4
|
+
export declare const SymbolDecoratorRuleColumn: unique symbol;
|
|
5
|
+
export type SchemaLikeCreate = (schema: any) => any;
|
|
6
|
+
export type SchemaLike = SchemaLikeCreate | z.ZodSchema | Constructable;
|
|
7
|
+
export interface ISchemaObjectOptions {
|
|
8
|
+
passthrough?: boolean;
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RouteHandlerArgumentMetaDecorator {
|
|
12
|
+
index: number;
|
|
13
|
+
type: RouteHandlerArgumentType;
|
|
14
|
+
field?: string;
|
|
15
|
+
pipes: (Function | z.ZodSchema)[];
|
|
16
|
+
schema: z.ZodSchema;
|
|
17
|
+
extractValue?: TypeExtractValue;
|
|
18
|
+
}
|
|
19
|
+
export interface RouteHandlerArgumentMeta {
|
|
20
|
+
type: RouteHandlerArgumentType;
|
|
21
|
+
field?: string;
|
|
22
|
+
metaType?: Type<any>;
|
|
23
|
+
controller: Constructable;
|
|
24
|
+
method: string;
|
|
25
|
+
index: number;
|
|
26
|
+
}
|
|
27
|
+
export type RouteHandlerArgumentType = 'request' | 'response' | 'body' | 'query' | 'param' | 'headers' | 'session' | 'fields' | 'field' | 'files' | 'file' | 'host' | 'ip' | 'rawBody' | 'string' | 'user';
|
|
28
|
+
export declare const SymbolRouteHandlersArgumentsMeta: unique symbol;
|
|
29
|
+
export declare const SymbolRouteHandlersArgumentsValue: unique symbol;
|
|
30
|
+
export type TypeExtractValue = (ctx: VonaContext, argMeta: RouteHandlerArgumentMetaDecorator) => Promise<any>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ZodOpenAPIMetadata } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
import type { CurrencyOptions } from '@zhennann/currency';
|
|
3
|
+
import type { z, ZodTypeAny } from 'zod';
|
|
4
|
+
import type { TypeResourceActionRowRecordRender } from './actions.ts';
|
|
5
|
+
import type { IOpenApiOptions } from './api.ts';
|
|
6
|
+
import type { IComponentRecord } from './component.ts';
|
|
7
|
+
import 'openapi3-ts/oas30';
|
|
8
|
+
import 'openapi3-ts/oas31';
|
|
9
|
+
export interface ISchemaObjectExtensionFieldRest {
|
|
10
|
+
render?: TypeFieldRenderComponent;
|
|
11
|
+
currency?: CurrencyOptions | boolean;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
order?: number;
|
|
14
|
+
table?: Omit<ISchemaObjectExtensionFieldRest, 'table' | 'form'>;
|
|
15
|
+
form?: Omit<ISchemaObjectExtensionFieldRest, 'table' | 'form'>;
|
|
16
|
+
}
|
|
17
|
+
export interface ISchemaObjectExtensionField {
|
|
18
|
+
rest?: ISchemaObjectExtensionFieldRest;
|
|
19
|
+
}
|
|
20
|
+
declare module 'openapi3-ts/oas30' {
|
|
21
|
+
interface SchemaObject extends ISchemaObjectExtensionField {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare module 'openapi3-ts/oas31' {
|
|
25
|
+
interface SchemaObject extends ISchemaObjectExtensionField {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export type TypeFieldRenderComponent = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'text' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'image' | 'file' | 'color' | 'password' | 'email' | 'url';
|
|
29
|
+
export type TypeFieldRenderComponentProvider = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'input' | 'textarea' | 'select';
|
|
30
|
+
export type TypeSchemaScene = 'table' | 'form';
|
|
31
|
+
export type TypeOpenAPIMetadata<T extends ZodTypeAny = ZodTypeAny> = Partial<ZodOpenAPIMetadata<z.input<T>>>;
|
|
32
|
+
export type TypeEntityOptionsFields<T extends {}, More extends string | undefined = never> = {
|
|
33
|
+
[key in ((keyof Omit<T, '$column' | '$columns' | '$table'>) | (More extends string ? More : never))]?: TypeOpenAPIMetadata | z.ZodSchema;
|
|
34
|
+
};
|
|
35
|
+
export type TypeControllerOptionsActions<T extends {}> = {
|
|
36
|
+
[key in (keyof T)]?: IOpenApiOptions;
|
|
37
|
+
};
|
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.13",
|
|
5
5
|
"title": "a-openapi",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -40,9 +40,13 @@
|
|
|
40
40
|
"openapi3-ts": "^4.4.0",
|
|
41
41
|
"zod": "^3.23.8"
|
|
42
42
|
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"clean-package": "^2.2.0",
|
|
45
|
+
"rimraf": "^6.0.1"
|
|
46
|
+
},
|
|
43
47
|
"gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
|
|
44
48
|
"scripts": {
|
|
45
|
-
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
46
|
-
"tsc:publish": "npm run clean && tsc"
|
|
49
|
+
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
50
|
+
"tsc:publish": "npm run clean && vona :bin:buildModule && tsc -p tsconfig.build.json"
|
|
47
51
|
}
|
|
48
52
|
}
|