@kubb/plugin-oas 3.0.0-alpha.1 → 3.0.0-alpha.10
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/OperationGenerator-By5WOmWB.d.ts +165 -0
- package/dist/OperationGenerator-Gd1X7wUz.d.cts +165 -0
- package/dist/{Schema-DefwBJMc.d.ts → Schema-B1vcPGiK.d.ts} +3 -5
- package/dist/{Schema-an5hOrjZ.d.cts → Schema-DoSFh7Qd.d.cts} +3 -5
- package/dist/{SchemaMapper-CsBQ6eEx.d.cts → SchemaMapper-sGcY1xL5.d.cts} +1 -2
- package/dist/{SchemaMapper-CsBQ6eEx.d.ts → SchemaMapper-sGcY1xL5.d.ts} +1 -2
- package/dist/chunk-75BIOXB7.cjs +7 -0
- package/dist/chunk-75BIOXB7.cjs.map +1 -0
- package/dist/{chunk-DRLYORTT.cjs → chunk-IAUV3UKH.cjs} +735 -35
- package/dist/chunk-IAUV3UKH.cjs.map +1 -0
- package/dist/{chunk-LEACSHKT.js → chunk-M347763D.js} +714 -14
- package/dist/chunk-M347763D.js.map +1 -0
- package/dist/{chunk-Y4V7HHX7.js → chunk-N7EEVJA6.js} +3 -3
- package/dist/{chunk-P42X362U.cjs → chunk-NU4F7G47.cjs} +4 -16
- package/dist/chunk-NU4F7G47.cjs.map +1 -0
- package/dist/{chunk-QLJIL3U5.cjs → chunk-O76YQFZB.cjs} +3 -3
- package/dist/{chunk-QLJIL3U5.cjs.map → chunk-O76YQFZB.cjs.map} +1 -1
- package/dist/chunk-SQ64ESS4.js +7 -0
- package/dist/chunk-SQ64ESS4.js.map +1 -0
- package/dist/{chunk-UB552H4J.js → chunk-SZDO532A.js} +3 -15
- package/dist/{chunk-UB552H4J.js.map → chunk-SZDO532A.js.map} +1 -1
- package/dist/components.cjs +4 -9
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +13 -7
- package/dist/components.d.ts +13 -7
- package/dist/components.js +3 -8
- package/dist/components.js.map +1 -1
- package/dist/hooks.cjs +12 -13
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +4 -4
- package/dist/hooks.d.ts +4 -4
- package/dist/hooks.js +2 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +282 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -77
- package/dist/index.d.ts +8 -77
- package/dist/index.js +274 -223
- package/dist/index.js.map +1 -1
- package/dist/{types-Dte3MA6H.d.cts → types-CZTUCaE5.d.cts} +3 -1
- package/dist/{types-Dte3MA6H.d.ts → types-CZTUCaE5.d.ts} +3 -1
- package/dist/utils.cjs +12 -54
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +7 -33
- package/dist/utils.d.ts +7 -33
- package/dist/utils.js +6 -48
- package/dist/utils.js.map +1 -1
- package/package.json +11 -10
- package/src/OperationGenerator.ts +68 -32
- package/src/SchemaGenerator.ts +32 -15
- package/src/SchemaMapper.ts +1 -1
- package/src/components/Oas.tsx +9 -3
- package/src/components/Operation.tsx +1 -1
- package/src/components/Schema.tsx +29 -31
- package/src/generator.tsx +125 -0
- package/src/hooks/useOperationManager.ts +1 -0
- package/src/index.ts +3 -9
- package/src/plugin.ts +25 -38
- package/src/types.ts +2 -0
- package/src/utils/getParams.ts +1 -1
- package/src/utils/index.ts +2 -1
- package/dist/OperationGenerator-CeM_9pxW.d.cts +0 -60
- package/dist/OperationGenerator-DhUhvRJE.d.ts +0 -60
- package/dist/chunk-CJXRFYEF.cjs +0 -698
- package/dist/chunk-CJXRFYEF.cjs.map +0 -1
- package/dist/chunk-DRLYORTT.cjs.map +0 -1
- package/dist/chunk-K6KUETAI.js +0 -698
- package/dist/chunk-K6KUETAI.js.map +0 -1
- package/dist/chunk-LEACSHKT.js.map +0 -1
- package/dist/chunk-P42X362U.cjs.map +0 -1
- package/src/utils/getGroupedByTagFiles.ts +0 -82
- /package/dist/{chunk-Y4V7HHX7.js.map → chunk-N7EEVJA6.js.map} +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { FileMetaBase, ResolveNameParams, PluginFactoryOptions, BaseGenerator, PluginManager, Plugin } from '@kubb/core';
|
|
2
|
+
import * as KubbFile from '@kubb/fs/types';
|
|
3
|
+
import { SchemaObject, Oas, contentType, Operation } from '@kubb/oas';
|
|
4
|
+
import { KubbNode } from '@kubb/react/types';
|
|
5
|
+
import { d as OperationSchema, b as Refs, g as Override, f as OperationsByMethod, e as OperationSchemas, E as Exclude, I as Include } from './types-CZTUCaE5.js';
|
|
6
|
+
import { S as Schema, c as SchemaKeywordMapper } from './SchemaMapper-sGcY1xL5.js';
|
|
7
|
+
|
|
8
|
+
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
9
|
+
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
10
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
11
|
+
oas: Oas;
|
|
12
|
+
pluginManager: PluginManager;
|
|
13
|
+
/**
|
|
14
|
+
* Current plugin
|
|
15
|
+
*/
|
|
16
|
+
plugin: Plugin<TPluginOptions>;
|
|
17
|
+
mode: KubbFile.Mode;
|
|
18
|
+
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
19
|
+
override: Array<Override<TOptions>> | undefined;
|
|
20
|
+
contentType?: contentType;
|
|
21
|
+
output?: string;
|
|
22
|
+
};
|
|
23
|
+
type SchemaGeneratorOptions = {
|
|
24
|
+
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
25
|
+
unknownType: 'any' | 'unknown';
|
|
26
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
27
|
+
enumSuffix?: string;
|
|
28
|
+
usedEnumNames?: Record<string, number>;
|
|
29
|
+
mapper?: Record<string, string>;
|
|
30
|
+
typed?: boolean;
|
|
31
|
+
transformers: {
|
|
32
|
+
/**
|
|
33
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
34
|
+
*/
|
|
35
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Receive schema and name(propertName) and return FakerMeta array
|
|
38
|
+
* TODO TODO add docs
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
45
|
+
type SchemaProps$1 = {
|
|
46
|
+
schema?: SchemaObject;
|
|
47
|
+
name?: string;
|
|
48
|
+
parentName?: string;
|
|
49
|
+
};
|
|
50
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
51
|
+
#private;
|
|
52
|
+
refs: Refs;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a type node from a given schema.
|
|
55
|
+
* Delegates to getBaseTypeFromSchema internally and
|
|
56
|
+
* optionally adds a union with null.
|
|
57
|
+
*/
|
|
58
|
+
parse(props: SchemaProps$1): Schema[];
|
|
59
|
+
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
60
|
+
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
61
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
62
|
+
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
63
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
64
|
+
build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
65
|
+
/**
|
|
66
|
+
* Schema
|
|
67
|
+
*/
|
|
68
|
+
schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
72
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
73
|
+
options: TOptions['resolvedOptions'];
|
|
74
|
+
operations: Array<Operation>;
|
|
75
|
+
operationsByMethod: OperationsByMethod;
|
|
76
|
+
};
|
|
77
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
78
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
79
|
+
options: TOptions['resolvedOptions'];
|
|
80
|
+
operation: Operation;
|
|
81
|
+
};
|
|
82
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
83
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
84
|
+
name: string;
|
|
85
|
+
schema: SchemaObject;
|
|
86
|
+
options: TOptions['resolvedOptions'];
|
|
87
|
+
};
|
|
88
|
+
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
89
|
+
name: string;
|
|
90
|
+
operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
91
|
+
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
92
|
+
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
93
|
+
};
|
|
94
|
+
type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
|
|
95
|
+
declare function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions>;
|
|
96
|
+
type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
97
|
+
name: string;
|
|
98
|
+
Operations?: (props: OperationsProps<TOptions>) => KubbNode;
|
|
99
|
+
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
100
|
+
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
101
|
+
/**
|
|
102
|
+
* Combine all react nodes and only render ones(to string or render)
|
|
103
|
+
*/
|
|
104
|
+
render?: () => any;
|
|
105
|
+
};
|
|
106
|
+
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated
|
|
110
|
+
*/
|
|
111
|
+
type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
|
|
112
|
+
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
113
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
114
|
+
oas: Oas;
|
|
115
|
+
exclude: Array<Exclude> | undefined;
|
|
116
|
+
include: Array<Include> | undefined;
|
|
117
|
+
override: Array<Override<TOptions>> | undefined;
|
|
118
|
+
contentType: contentType | undefined;
|
|
119
|
+
pluginManager: PluginManager;
|
|
120
|
+
/**
|
|
121
|
+
* Current plugin
|
|
122
|
+
*/
|
|
123
|
+
plugin: Plugin<TPluginOptions>;
|
|
124
|
+
mode: KubbFile.Mode;
|
|
125
|
+
};
|
|
126
|
+
declare class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
127
|
+
#private;
|
|
128
|
+
get operationsByMethod(): OperationsByMethod;
|
|
129
|
+
set operationsByMethod(paths: OperationsByMethod);
|
|
130
|
+
getSchemas(operation: Operation, { forStatusCode, resolveName, }?: {
|
|
131
|
+
forStatusCode?: string | number;
|
|
132
|
+
resolveName?: (name: string) => string;
|
|
133
|
+
}): OperationSchemas;
|
|
134
|
+
build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
135
|
+
/**
|
|
136
|
+
* Operation
|
|
137
|
+
*/
|
|
138
|
+
operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
139
|
+
/**
|
|
140
|
+
* GET
|
|
141
|
+
*/
|
|
142
|
+
get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
143
|
+
/**
|
|
144
|
+
* POST
|
|
145
|
+
*/
|
|
146
|
+
post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
147
|
+
/**
|
|
148
|
+
* PATCH
|
|
149
|
+
*/
|
|
150
|
+
patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
151
|
+
/**
|
|
152
|
+
* PUT
|
|
153
|
+
*/
|
|
154
|
+
put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
155
|
+
/**
|
|
156
|
+
* DELETE
|
|
157
|
+
*/
|
|
158
|
+
delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
159
|
+
/**
|
|
160
|
+
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
161
|
+
*/
|
|
162
|
+
all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, OperationGenerator as a, type GetSchemaGeneratorOptions as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, createGenerator as f, createReactGenerator as g, type Generator as h, type GeneratorOptions as i };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { FileMetaBase, ResolveNameParams, PluginFactoryOptions, BaseGenerator, PluginManager, Plugin } from '@kubb/core';
|
|
2
|
+
import * as KubbFile from '@kubb/fs/types';
|
|
3
|
+
import { SchemaObject, Oas, contentType, Operation } from '@kubb/oas';
|
|
4
|
+
import { KubbNode } from '@kubb/react/types';
|
|
5
|
+
import { d as OperationSchema, b as Refs, g as Override, f as OperationsByMethod, e as OperationSchemas, E as Exclude, I as Include } from './types-CZTUCaE5.cjs';
|
|
6
|
+
import { S as Schema, c as SchemaKeywordMapper } from './SchemaMapper-sGcY1xL5.cjs';
|
|
7
|
+
|
|
8
|
+
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
9
|
+
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
10
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
11
|
+
oas: Oas;
|
|
12
|
+
pluginManager: PluginManager;
|
|
13
|
+
/**
|
|
14
|
+
* Current plugin
|
|
15
|
+
*/
|
|
16
|
+
plugin: Plugin<TPluginOptions>;
|
|
17
|
+
mode: KubbFile.Mode;
|
|
18
|
+
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
19
|
+
override: Array<Override<TOptions>> | undefined;
|
|
20
|
+
contentType?: contentType;
|
|
21
|
+
output?: string;
|
|
22
|
+
};
|
|
23
|
+
type SchemaGeneratorOptions = {
|
|
24
|
+
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
25
|
+
unknownType: 'any' | 'unknown';
|
|
26
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
27
|
+
enumSuffix?: string;
|
|
28
|
+
usedEnumNames?: Record<string, number>;
|
|
29
|
+
mapper?: Record<string, string>;
|
|
30
|
+
typed?: boolean;
|
|
31
|
+
transformers: {
|
|
32
|
+
/**
|
|
33
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
34
|
+
*/
|
|
35
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Receive schema and name(propertName) and return FakerMeta array
|
|
38
|
+
* TODO TODO add docs
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
45
|
+
type SchemaProps$1 = {
|
|
46
|
+
schema?: SchemaObject;
|
|
47
|
+
name?: string;
|
|
48
|
+
parentName?: string;
|
|
49
|
+
};
|
|
50
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
51
|
+
#private;
|
|
52
|
+
refs: Refs;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a type node from a given schema.
|
|
55
|
+
* Delegates to getBaseTypeFromSchema internally and
|
|
56
|
+
* optionally adds a union with null.
|
|
57
|
+
*/
|
|
58
|
+
parse(props: SchemaProps$1): Schema[];
|
|
59
|
+
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
60
|
+
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
61
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
62
|
+
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
63
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
64
|
+
build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
65
|
+
/**
|
|
66
|
+
* Schema
|
|
67
|
+
*/
|
|
68
|
+
schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
72
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
73
|
+
options: TOptions['resolvedOptions'];
|
|
74
|
+
operations: Array<Operation>;
|
|
75
|
+
operationsByMethod: OperationsByMethod;
|
|
76
|
+
};
|
|
77
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
78
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
79
|
+
options: TOptions['resolvedOptions'];
|
|
80
|
+
operation: Operation;
|
|
81
|
+
};
|
|
82
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
83
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
84
|
+
name: string;
|
|
85
|
+
schema: SchemaObject;
|
|
86
|
+
options: TOptions['resolvedOptions'];
|
|
87
|
+
};
|
|
88
|
+
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
89
|
+
name: string;
|
|
90
|
+
operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
91
|
+
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
92
|
+
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
93
|
+
};
|
|
94
|
+
type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
|
|
95
|
+
declare function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions>;
|
|
96
|
+
type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
97
|
+
name: string;
|
|
98
|
+
Operations?: (props: OperationsProps<TOptions>) => KubbNode;
|
|
99
|
+
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
100
|
+
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
101
|
+
/**
|
|
102
|
+
* Combine all react nodes and only render ones(to string or render)
|
|
103
|
+
*/
|
|
104
|
+
render?: () => any;
|
|
105
|
+
};
|
|
106
|
+
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated
|
|
110
|
+
*/
|
|
111
|
+
type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
|
|
112
|
+
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
113
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
114
|
+
oas: Oas;
|
|
115
|
+
exclude: Array<Exclude> | undefined;
|
|
116
|
+
include: Array<Include> | undefined;
|
|
117
|
+
override: Array<Override<TOptions>> | undefined;
|
|
118
|
+
contentType: contentType | undefined;
|
|
119
|
+
pluginManager: PluginManager;
|
|
120
|
+
/**
|
|
121
|
+
* Current plugin
|
|
122
|
+
*/
|
|
123
|
+
plugin: Plugin<TPluginOptions>;
|
|
124
|
+
mode: KubbFile.Mode;
|
|
125
|
+
};
|
|
126
|
+
declare class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
127
|
+
#private;
|
|
128
|
+
get operationsByMethod(): OperationsByMethod;
|
|
129
|
+
set operationsByMethod(paths: OperationsByMethod);
|
|
130
|
+
getSchemas(operation: Operation, { forStatusCode, resolveName, }?: {
|
|
131
|
+
forStatusCode?: string | number;
|
|
132
|
+
resolveName?: (name: string) => string;
|
|
133
|
+
}): OperationSchemas;
|
|
134
|
+
build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
135
|
+
/**
|
|
136
|
+
* Operation
|
|
137
|
+
*/
|
|
138
|
+
operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
139
|
+
/**
|
|
140
|
+
* GET
|
|
141
|
+
*/
|
|
142
|
+
get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
143
|
+
/**
|
|
144
|
+
* POST
|
|
145
|
+
*/
|
|
146
|
+
post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
147
|
+
/**
|
|
148
|
+
* PATCH
|
|
149
|
+
*/
|
|
150
|
+
patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
151
|
+
/**
|
|
152
|
+
* PUT
|
|
153
|
+
*/
|
|
154
|
+
put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
155
|
+
/**
|
|
156
|
+
* DELETE
|
|
157
|
+
*/
|
|
158
|
+
delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
159
|
+
/**
|
|
160
|
+
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
161
|
+
*/
|
|
162
|
+
all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, OperationGenerator as a, type GetSchemaGeneratorOptions as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, createGenerator as f, createReactGenerator as g, type Generator as h, type GeneratorOptions as i };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
4
3
|
import { SchemaObject } from '@kubb/oas';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema$1 } from './SchemaMapper-
|
|
4
|
+
import { KubbNode } from '@kubb/react/types';
|
|
5
|
+
import { S as Schema$1 } from './SchemaMapper-sGcY1xL5.js';
|
|
7
6
|
|
|
8
7
|
type SchemaContextProps = {
|
|
9
8
|
name: string;
|
|
@@ -19,7 +18,7 @@ type Props = {
|
|
|
19
18
|
declare function Schema({ name, value, tree, children }: Props): KubbNode;
|
|
20
19
|
declare namespace Schema {
|
|
21
20
|
var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
|
|
22
|
-
var Imports: ({ isTypeOnly
|
|
21
|
+
var Imports: ({ isTypeOnly }: SchemaImportsProps) => ReactNode;
|
|
23
22
|
var Context: react.Context<SchemaContextProps>;
|
|
24
23
|
}
|
|
25
24
|
type FileProps = {
|
|
@@ -29,7 +28,6 @@ type FileProps = {
|
|
|
29
28
|
};
|
|
30
29
|
type SchemaImportsProps = {
|
|
31
30
|
isTypeOnly?: boolean;
|
|
32
|
-
extName?: KubbFile.Extname;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export { Schema as S, type SchemaContextProps as a };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
4
3
|
import { SchemaObject } from '@kubb/oas';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema$1 } from './SchemaMapper-
|
|
4
|
+
import { KubbNode } from '@kubb/react/types';
|
|
5
|
+
import { S as Schema$1 } from './SchemaMapper-sGcY1xL5.cjs';
|
|
7
6
|
|
|
8
7
|
type SchemaContextProps = {
|
|
9
8
|
name: string;
|
|
@@ -19,7 +18,7 @@ type Props = {
|
|
|
19
18
|
declare function Schema({ name, value, tree, children }: Props): KubbNode;
|
|
20
19
|
declare namespace Schema {
|
|
21
20
|
var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
|
|
22
|
-
var Imports: ({ isTypeOnly
|
|
21
|
+
var Imports: ({ isTypeOnly }: SchemaImportsProps) => ReactNode;
|
|
23
22
|
var Context: react.Context<SchemaContextProps>;
|
|
24
23
|
}
|
|
25
24
|
type FileProps = {
|
|
@@ -29,7 +28,6 @@ type FileProps = {
|
|
|
29
28
|
};
|
|
30
29
|
type SchemaImportsProps = {
|
|
31
30
|
isTypeOnly?: boolean;
|
|
32
|
-
extName?: KubbFile.Extname;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export { Schema as S, type SchemaContextProps as a };
|
|
@@ -107,7 +107,6 @@ type SchemaKeywordMapper = {
|
|
|
107
107
|
args: {
|
|
108
108
|
name: string;
|
|
109
109
|
path: KubbFile.OptionalPath;
|
|
110
|
-
isTypeOnly?: boolean;
|
|
111
110
|
};
|
|
112
111
|
};
|
|
113
112
|
matches: {
|
|
@@ -245,4 +244,4 @@ type Schema = {
|
|
|
245
244
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
246
245
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
247
246
|
|
|
248
|
-
export { type Schema as S, type
|
|
247
|
+
export { type Schema as S, type SchemaKeyword as a, type SchemaKeywordBase as b, type SchemaKeywordMapper as c, type SchemaMapper as d, isKeyword as i, schemaKeywords as s };
|
|
@@ -107,7 +107,6 @@ type SchemaKeywordMapper = {
|
|
|
107
107
|
args: {
|
|
108
108
|
name: string;
|
|
109
109
|
path: KubbFile.OptionalPath;
|
|
110
|
-
isTypeOnly?: boolean;
|
|
111
110
|
};
|
|
112
111
|
};
|
|
113
112
|
matches: {
|
|
@@ -245,4 +244,4 @@ type Schema = {
|
|
|
245
244
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
246
245
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
247
246
|
|
|
248
|
-
export { type Schema as S, type
|
|
247
|
+
export { type Schema as S, type SchemaKeyword as a, type SchemaKeywordBase as b, type SchemaKeywordMapper as c, type SchemaMapper as d, isKeyword as i, schemaKeywords as s };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-75BIOXB7.cjs","../src/components/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,8CAAA,CAAA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-75BIOXB7.cjs","sourcesContent":[null,"export { Oas } from './Oas.tsx'\nexport { Operation } from './Operation.tsx'\nexport { Schema } from './Schema.tsx'\n"]}
|