@moostjs/swagger 0.3.10 → 0.3.12

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.d.ts CHANGED
@@ -1,94 +1,82 @@
1
- import { Mate } from '@prostojs/mate';
2
- import { THeaderHook } from '@wooksjs/event-http';
3
- import { TMateParamMeta } from '@prostojs/mate';
4
- import { TMoostMetadata } from 'moost';
5
- import { TStatusHook } from '@wooksjs/event-http';
6
- import { z } from '@moostjs/zod';
7
-
8
- export declare function getSwaggerMate(): Mate<TMoostMetadata<TEmpty> & TSwaggerMate & {
9
- params: (TEmpty & TMateParamMeta)[];
10
- }, TMoostMetadata<TEmpty> & TSwaggerMate & {
11
- params: (TEmpty & TMateParamMeta)[];
12
- }>;
13
-
14
- export declare class SwaggerController {
15
- protected title: string;
16
- constructor(title?: string);
17
- assetPath: string;
18
- serveIndex(url: string, location: THeaderHook, status: TStatusHook): string;
19
- 'swagger-initializer.js'(): string;
20
- spec?: Record<string, unknown>;
21
- 'spec.json'(): Promise<Record<string, unknown>>;
22
- files(url: string): Promise<unknown>;
23
- serve(path: string): Promise<unknown>;
24
- }
25
-
26
- export declare const SwaggerDescription: (descr: string) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
27
-
28
- export declare const SwaggerExclude: () => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
29
-
30
- export declare function SwaggerRequestBody(opt: TSwaggerResponseOpts): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
31
-
32
- export declare function SwaggerResponse(opts: TSwaggerResponseOpts): MethodDecorator;
33
-
34
- export declare function SwaggerResponse(code: number, opts: TSwaggerResponseOpts): MethodDecorator;
35
-
36
- export declare const SwaggerTag: (tag: string) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
37
-
38
- declare interface TEmpty {
39
- }
40
-
41
- declare type TFunction = Function;
42
-
43
- export declare interface TSwaggerMate {
44
- swaggerTags: string[];
45
- swaggerExclude: boolean;
46
- swaggerDescription: string;
47
- swaggerResponses: Record<number, Record<string, TSwaggerResponseConfigValue>>;
48
- swaggerRequestBody: Record<string, TSwaggerResponseConfigValue>;
49
- }
50
-
51
- declare interface TSwaggerResponseConfig {
52
- contentType?: string;
53
- description?: string;
54
- response: TSwaggerResponseConfigValue;
55
- }
56
-
57
- export declare type TSwaggerResponseConfigValue = TFunction | z.ZodType | TSwaggerSchema;
58
-
59
- export declare type TSwaggerResponseOpts = TSwaggerResponseConfigValue | TSwaggerResponseConfig;
60
-
61
- declare interface TSwaggerSchema {
62
- type?: string;
63
- $ref?: string;
64
- title?: string;
65
- description?: string;
66
- format?: string;
67
- default?: unknown;
68
- enum?: string[];
69
- nullable?: boolean;
70
- readOnly?: boolean;
71
- writeOnly?: boolean;
72
- example?: unknown;
73
- minLength?: number;
74
- maxLength?: number;
75
- pattern?: string;
76
- minimum?: number;
77
- maximum?: number;
78
- exclusiveMinimum?: number;
79
- exclusiveMaximum?: number;
80
- multipleOf?: number;
81
- items?: TSwaggerSchema | TSwaggerSchema[];
82
- minItems?: number;
83
- maxItems?: number;
84
- uniqueItems?: boolean;
85
- properties?: Record<string, TSwaggerSchema>;
86
- additionalProperties?: boolean | TSwaggerSchema;
87
- required?: string[];
88
- allOf?: TSwaggerSchema[];
89
- anyOf?: TSwaggerSchema[];
90
- oneOf?: TSwaggerSchema[];
91
- not?: TSwaggerSchema;
92
- }
93
-
94
- export { }
1
+ import { THeaderHook, TStatusHook } from '@wooksjs/event-http';
2
+ import * as _prostojs_mate from '@prostojs/mate';
3
+ import * as moost from 'moost';
4
+ import { z } from '@moostjs/zod';
5
+
6
+ declare class SwaggerController {
7
+ protected title: string;
8
+ constructor(title?: string);
9
+ assetPath: string;
10
+ serveIndex(url: string, location: THeaderHook, status: TStatusHook): string;
11
+ 'swagger-initializer.js'(): string;
12
+ spec?: Record<string, unknown>;
13
+ 'spec.json'(): Promise<Record<string, unknown>>;
14
+ files(url: string): Promise<unknown>;
15
+ serve(path: string): Promise<unknown>;
16
+ }
17
+
18
+ type TFunction = Function;
19
+ interface TEmpty {
20
+ }
21
+
22
+ interface TSwaggerSchema {
23
+ type?: string;
24
+ $ref?: string;
25
+ title?: string;
26
+ description?: string;
27
+ format?: string;
28
+ default?: unknown;
29
+ enum?: string[];
30
+ nullable?: boolean;
31
+ readOnly?: boolean;
32
+ writeOnly?: boolean;
33
+ example?: unknown;
34
+ minLength?: number;
35
+ maxLength?: number;
36
+ pattern?: string;
37
+ minimum?: number;
38
+ maximum?: number;
39
+ exclusiveMinimum?: number;
40
+ exclusiveMaximum?: number;
41
+ multipleOf?: number;
42
+ items?: TSwaggerSchema | TSwaggerSchema[];
43
+ minItems?: number;
44
+ maxItems?: number;
45
+ uniqueItems?: boolean;
46
+ properties?: Record<string, TSwaggerSchema>;
47
+ additionalProperties?: boolean | TSwaggerSchema;
48
+ required?: string[];
49
+ allOf?: TSwaggerSchema[];
50
+ anyOf?: TSwaggerSchema[];
51
+ oneOf?: TSwaggerSchema[];
52
+ not?: TSwaggerSchema;
53
+ }
54
+
55
+ declare function getSwaggerMate(): _prostojs_mate.Mate<moost.TMoostMetadata<TEmpty> & TSwaggerMate & {
56
+ params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
57
+ }, moost.TMoostMetadata<TEmpty> & TSwaggerMate & {
58
+ params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
59
+ }>;
60
+ interface TSwaggerMate {
61
+ swaggerTags: string[];
62
+ swaggerExclude: boolean;
63
+ swaggerDescription: string;
64
+ swaggerResponses: Record<number, Record<string, TSwaggerResponseConfigValue>>;
65
+ swaggerRequestBody: Record<string, TSwaggerResponseConfigValue>;
66
+ }
67
+ type TSwaggerResponseConfigValue = TFunction | z.ZodType | TSwaggerSchema;
68
+ interface TSwaggerResponseConfig {
69
+ contentType?: string;
70
+ description?: string;
71
+ response: TSwaggerResponseConfigValue;
72
+ }
73
+ type TSwaggerResponseOpts = TSwaggerResponseConfigValue | TSwaggerResponseConfig;
74
+
75
+ declare const SwaggerTag: (tag: string) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
76
+ declare const SwaggerExclude: () => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
77
+ declare const SwaggerDescription: (descr: string) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
78
+ declare function SwaggerResponse(opts: TSwaggerResponseOpts): MethodDecorator;
79
+ declare function SwaggerResponse(code: number, opts: TSwaggerResponseOpts): MethodDecorator;
80
+ declare function SwaggerRequestBody(opt: TSwaggerResponseOpts): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
81
+
82
+ export { SwaggerController, SwaggerDescription, SwaggerExclude, SwaggerRequestBody, SwaggerResponse, SwaggerTag, type TSwaggerMate, type TSwaggerResponseConfigValue, type TSwaggerResponseOpts, getSwaggerMate };