@kubb/plugin-oas 3.0.0-alpha.3 → 3.0.0-alpha.31
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/README.md +13 -4
- package/dist/OperationGenerator-BgQeGRzk.d.cts +550 -0
- package/dist/OperationGenerator-BgQeGRzk.d.ts +550 -0
- package/dist/Schema-1iM2I0dK.d.ts +22 -0
- package/dist/Schema-5o-c5UOy.d.cts +22 -0
- package/dist/chunk-ABOQ73FL.cjs +36 -0
- package/dist/chunk-ABOQ73FL.cjs.map +1 -0
- package/dist/chunk-BG77DP54.js +30 -0
- package/dist/chunk-BG77DP54.js.map +1 -0
- package/dist/chunk-GF26SDHQ.js +28 -0
- package/dist/chunk-GF26SDHQ.js.map +1 -0
- package/dist/chunk-PADR76WZ.cjs +4 -0
- package/dist/chunk-PADR76WZ.cjs.map +1 -0
- package/dist/chunk-QAFBZLJA.cjs +48 -0
- package/dist/chunk-QAFBZLJA.cjs.map +1 -0
- package/dist/chunk-QT6ZFRNJ.cjs +752 -0
- package/dist/chunk-QT6ZFRNJ.cjs.map +1 -0
- package/dist/chunk-QWO5NQGQ.js +88 -0
- package/dist/chunk-QWO5NQGQ.js.map +1 -0
- package/dist/chunk-R47XMJ32.js +3 -0
- package/dist/chunk-R47XMJ32.js.map +1 -0
- package/dist/chunk-SR63CBLH.cjs +92 -0
- package/dist/chunk-SR63CBLH.cjs.map +1 -0
- package/dist/chunk-V2JO6RHI.js +744 -0
- package/dist/chunk-V2JO6RHI.js.map +1 -0
- package/dist/chunk-XNCEFOE6.js +45 -0
- package/dist/chunk-XNCEFOE6.js.map +1 -0
- package/dist/chunk-ZWHQ54JM.cjs +32 -0
- package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
- package/dist/components.cjs +20 -12
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +4 -7
- package/dist/components.d.ts +4 -7
- package/dist/components.js +3 -12
- package/dist/components.js.map +1 -1
- package/dist/generators.cjs +14 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.d.cts +9 -0
- package/dist/generators.d.ts +9 -0
- package/dist/generators.js +5 -0
- package/dist/generators.js.map +1 -0
- package/dist/hooks.cjs +102 -57
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +41 -10
- package/dist/hooks.d.ts +41 -10
- package/dist/hooks.js +91 -53
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +192 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +135 -228
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +32 -87
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +8 -43
- package/dist/utils.d.ts +8 -43
- package/dist/utils.js +8 -86
- package/dist/utils.js.map +1 -1
- package/package.json +20 -14
- package/src/OperationGenerator.ts +23 -30
- package/src/SchemaGenerator.ts +80 -23
- package/src/SchemaMapper.ts +7 -5
- package/src/components/Oas.tsx +1 -1
- package/src/components/Operation.tsx +1 -1
- package/src/components/Schema.tsx +2 -102
- package/src/{parser.tsx → generator.tsx} +31 -22
- package/src/generators/index.ts +1 -0
- package/src/generators/jsonGenerator.ts +32 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useOperationManager.ts +77 -29
- package/src/hooks/useSchemaManager.ts +77 -0
- package/src/index.ts +3 -3
- package/src/plugin.ts +67 -59
- package/src/types.ts +24 -16
- package/src/utils/getParams.ts +2 -2
- package/src/utils/getSchemaFactory.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/parseFromConfig.ts +7 -7
- package/dist/OperationGenerator-D7rSlflc.d.cts +0 -158
- package/dist/OperationGenerator-vw0Zf-Mi.d.ts +0 -158
- package/dist/Schema-DxyOIX7q.d.cts +0 -35
- package/dist/Schema-gHgN14i2.d.ts +0 -35
- package/dist/SchemaMapper-BM1IGWqD.d.cts +0 -248
- package/dist/SchemaMapper-BM1IGWqD.d.ts +0 -248
- package/dist/chunk-264TCCJF.cjs +0 -3973
- package/dist/chunk-264TCCJF.cjs.map +0 -1
- package/dist/chunk-7KIEQOVZ.cjs +0 -7
- package/dist/chunk-7KIEQOVZ.cjs.map +0 -1
- package/dist/chunk-FZN3PBEK.js +0 -3973
- package/dist/chunk-FZN3PBEK.js.map +0 -1
- package/dist/chunk-P42X362U.cjs +0 -101
- package/dist/chunk-P42X362U.cjs.map +0 -1
- package/dist/chunk-QLJIL3U5.cjs +0 -35
- package/dist/chunk-QLJIL3U5.cjs.map +0 -1
- package/dist/chunk-TWKZEVSM.js +0 -7
- package/dist/chunk-TWKZEVSM.js.map +0 -1
- package/dist/chunk-UB552H4J.js +0 -101
- package/dist/chunk-UB552H4J.js.map +0 -1
- package/dist/chunk-Y4V7HHX7.js +0 -35
- package/dist/chunk-Y4V7HHX7.js.map +0 -1
- package/dist/types-C2RXaY0_.d.cts +0 -143
- package/dist/types-C2RXaY0_.d.ts +0 -143
- package/src/utils/getGroupedByTagFiles.ts +0 -82
- package/src/utils/refSorter.ts +0 -13
package/src/utils/getParams.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isParameterObject } from '@kubb/oas'
|
|
2
2
|
|
|
3
|
+
import { camelCase } from '@kubb/core/transformers'
|
|
3
4
|
import type { FunctionParamsAST } from '@kubb/core/utils'
|
|
4
5
|
import type { OasTypes } from '@kubb/oas'
|
|
5
|
-
import type { Params } from '@kubb/react'
|
|
6
|
+
import type { Params } from '@kubb/react/types'
|
|
6
7
|
import type { OperationSchema } from '../types.ts'
|
|
7
|
-
import { camelCase } from '@kubb/core/transformers'
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
10
|
* @deprecated
|
|
@@ -26,7 +26,7 @@ export function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (s
|
|
|
26
26
|
const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'
|
|
27
27
|
|
|
28
28
|
return {
|
|
29
|
-
schema,
|
|
29
|
+
schema: oas.dereferenceWithRef(schema),
|
|
30
30
|
version,
|
|
31
31
|
} as SchemaResult<TWithRef>
|
|
32
32
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { getComments } from './getComments.ts'
|
|
2
|
-
export { getGroupedByTagFiles } from './getGroupedByTagFiles.ts'
|
|
3
2
|
export { getASTParams, getPathParams } from './getParams.ts'
|
|
4
3
|
export { getSchemaFactory } from './getSchemaFactory.ts'
|
|
5
4
|
export type { GetSchemasProps } from './getSchemas.ts'
|
|
6
5
|
export { getSchemas } from './getSchemas.ts'
|
|
7
|
-
export { refsSorter } from './refSorter.ts'
|
|
8
6
|
export { parseFromConfig } from './parseFromConfig.ts'
|
|
7
|
+
|
|
8
|
+
export { isOptional } from '@kubb/oas'
|
|
@@ -2,35 +2,35 @@ import { resolve } from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import { URLPath } from '@kubb/core/utils'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { parse } from '@kubb/oas/parser'
|
|
6
6
|
|
|
7
7
|
import type { Config } from '@kubb/core'
|
|
8
8
|
import { Oas, type OasTypes } from '@kubb/oas'
|
|
9
9
|
import yaml from '@stoplight/yaml'
|
|
10
10
|
|
|
11
|
-
export function parseFromConfig(config: Config,
|
|
11
|
+
export function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {
|
|
12
12
|
if ('data' in config.input) {
|
|
13
13
|
if (typeof config.input.data === 'object') {
|
|
14
14
|
const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument
|
|
15
|
-
return parse(api,
|
|
15
|
+
return parse(api, oasClass)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
try {
|
|
19
19
|
const api: string = yaml.parse(config.input.data as string) as string
|
|
20
20
|
|
|
21
|
-
return parse(api,
|
|
21
|
+
return parse(api, oasClass)
|
|
22
22
|
} catch (e) {
|
|
23
23
|
/* empty */
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument
|
|
27
27
|
|
|
28
|
-
return parse(api,
|
|
28
|
+
return parse(api, oasClass)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (new URLPath(config.input.path).isURL) {
|
|
32
|
-
return parse(config.input.path,
|
|
32
|
+
return parse(config.input.path, oasClass)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return parse(resolve(config.root, config.input.path),
|
|
35
|
+
return parse(resolve(config.root, config.input.path), oasClass)
|
|
36
36
|
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { FileMetaBase, ResolveNameParams, PluginFactoryOptions, Generator, PluginManager, Plugin } from '@kubb/core';
|
|
2
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
3
|
-
import { SchemaObject, Oas, contentType, Operation } from '@kubb/oas';
|
|
4
|
-
import { d as OperationSchema, b as Refs, g as Override, f as OperationsByMethod, e as OperationSchemas, E as Exclude, I as Include } from './types-C2RXaY0_.cjs';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema, c as SchemaKeywordMapper } from './SchemaMapper-BM1IGWqD.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 Generator<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(...parsers: Array<Parser<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 ParserOptions<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 Parser<TOptions extends PluginFactoryOptions> = ParserOptions<TOptions>;
|
|
95
|
-
declare function createParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserOptions<TOptions>): Parser<TOptions>;
|
|
96
|
-
type ParserReactOptions<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
|
-
declare function createReactParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserReactOptions<TOptions>): Parser<TOptions>;
|
|
103
|
-
|
|
104
|
-
type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
|
|
105
|
-
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
106
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
107
|
-
oas: Oas;
|
|
108
|
-
exclude: Array<Exclude> | undefined;
|
|
109
|
-
include: Array<Include> | undefined;
|
|
110
|
-
override: Array<Override<TOptions>> | undefined;
|
|
111
|
-
contentType: contentType | undefined;
|
|
112
|
-
pluginManager: PluginManager;
|
|
113
|
-
/**
|
|
114
|
-
* Current plugin
|
|
115
|
-
*/
|
|
116
|
-
plugin: Plugin<TPluginOptions>;
|
|
117
|
-
mode: KubbFile.Mode;
|
|
118
|
-
};
|
|
119
|
-
declare class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
120
|
-
#private;
|
|
121
|
-
get operationsByMethod(): OperationsByMethod;
|
|
122
|
-
set operationsByMethod(paths: OperationsByMethod);
|
|
123
|
-
getSchemas(operation: Operation, { forStatusCode, resolveName, }?: {
|
|
124
|
-
forStatusCode?: string | number;
|
|
125
|
-
resolveName?: (name: string) => string;
|
|
126
|
-
}): OperationSchemas;
|
|
127
|
-
build(...parsers: Array<Parser<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
128
|
-
/**
|
|
129
|
-
* Operation
|
|
130
|
-
*/
|
|
131
|
-
operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
132
|
-
/**
|
|
133
|
-
* GET
|
|
134
|
-
*/
|
|
135
|
-
get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
136
|
-
/**
|
|
137
|
-
* POST
|
|
138
|
-
*/
|
|
139
|
-
post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
140
|
-
/**
|
|
141
|
-
* PATCH
|
|
142
|
-
*/
|
|
143
|
-
patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
144
|
-
/**
|
|
145
|
-
* PUT
|
|
146
|
-
*/
|
|
147
|
-
put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
148
|
-
/**
|
|
149
|
-
* DELETE
|
|
150
|
-
*/
|
|
151
|
-
delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
152
|
-
/**
|
|
153
|
-
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
154
|
-
*/
|
|
155
|
-
all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, type ParserReactOptions as P, type SchemaGeneratorBuildOptions as S, OperationGenerator as a, type GetSchemaGeneratorOptions as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, createParser as f, createReactParser as g, type Parser as h, type ParserOptions as i };
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { FileMetaBase, ResolveNameParams, PluginFactoryOptions, Generator, PluginManager, Plugin } from '@kubb/core';
|
|
2
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
3
|
-
import { SchemaObject, Oas, contentType, Operation } from '@kubb/oas';
|
|
4
|
-
import { d as OperationSchema, b as Refs, g as Override, f as OperationsByMethod, e as OperationSchemas, E as Exclude, I as Include } from './types-C2RXaY0_.js';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema, c as SchemaKeywordMapper } from './SchemaMapper-BM1IGWqD.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 Generator<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(...parsers: Array<Parser<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 ParserOptions<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 Parser<TOptions extends PluginFactoryOptions> = ParserOptions<TOptions>;
|
|
95
|
-
declare function createParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserOptions<TOptions>): Parser<TOptions>;
|
|
96
|
-
type ParserReactOptions<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
|
-
declare function createReactParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserReactOptions<TOptions>): Parser<TOptions>;
|
|
103
|
-
|
|
104
|
-
type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
|
|
105
|
-
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
106
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
107
|
-
oas: Oas;
|
|
108
|
-
exclude: Array<Exclude> | undefined;
|
|
109
|
-
include: Array<Include> | undefined;
|
|
110
|
-
override: Array<Override<TOptions>> | undefined;
|
|
111
|
-
contentType: contentType | undefined;
|
|
112
|
-
pluginManager: PluginManager;
|
|
113
|
-
/**
|
|
114
|
-
* Current plugin
|
|
115
|
-
*/
|
|
116
|
-
plugin: Plugin<TPluginOptions>;
|
|
117
|
-
mode: KubbFile.Mode;
|
|
118
|
-
};
|
|
119
|
-
declare class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
120
|
-
#private;
|
|
121
|
-
get operationsByMethod(): OperationsByMethod;
|
|
122
|
-
set operationsByMethod(paths: OperationsByMethod);
|
|
123
|
-
getSchemas(operation: Operation, { forStatusCode, resolveName, }?: {
|
|
124
|
-
forStatusCode?: string | number;
|
|
125
|
-
resolveName?: (name: string) => string;
|
|
126
|
-
}): OperationSchemas;
|
|
127
|
-
build(...parsers: Array<Parser<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
128
|
-
/**
|
|
129
|
-
* Operation
|
|
130
|
-
*/
|
|
131
|
-
operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
132
|
-
/**
|
|
133
|
-
* GET
|
|
134
|
-
*/
|
|
135
|
-
get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
136
|
-
/**
|
|
137
|
-
* POST
|
|
138
|
-
*/
|
|
139
|
-
post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
140
|
-
/**
|
|
141
|
-
* PATCH
|
|
142
|
-
*/
|
|
143
|
-
patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
144
|
-
/**
|
|
145
|
-
* PUT
|
|
146
|
-
*/
|
|
147
|
-
put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
148
|
-
/**
|
|
149
|
-
* DELETE
|
|
150
|
-
*/
|
|
151
|
-
delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
|
|
152
|
-
/**
|
|
153
|
-
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
154
|
-
*/
|
|
155
|
-
all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, type ParserReactOptions as P, type SchemaGeneratorBuildOptions as S, OperationGenerator as a, type GetSchemaGeneratorOptions as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, createParser as f, createReactParser as g, type Parser as h, type ParserOptions as i };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
4
|
-
import { SchemaObject } from '@kubb/oas';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema$1 } from './SchemaMapper-BM1IGWqD.cjs';
|
|
7
|
-
|
|
8
|
-
type SchemaContextProps = {
|
|
9
|
-
name: string;
|
|
10
|
-
schema?: SchemaObject;
|
|
11
|
-
tree: Array<Schema$1>;
|
|
12
|
-
};
|
|
13
|
-
type Props = {
|
|
14
|
-
name: string;
|
|
15
|
-
value?: SchemaObject;
|
|
16
|
-
tree?: Array<Schema$1>;
|
|
17
|
-
children?: KubbNode;
|
|
18
|
-
};
|
|
19
|
-
declare function Schema({ name, value, tree, children }: Props): KubbNode;
|
|
20
|
-
declare namespace Schema {
|
|
21
|
-
var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
|
|
22
|
-
var Imports: ({ isTypeOnly, extName }: SchemaImportsProps) => ReactNode;
|
|
23
|
-
var Context: react.Context<SchemaContextProps>;
|
|
24
|
-
}
|
|
25
|
-
type FileProps = {
|
|
26
|
-
isTypeOnly?: boolean;
|
|
27
|
-
output: string | undefined;
|
|
28
|
-
children?: KubbNode;
|
|
29
|
-
};
|
|
30
|
-
type SchemaImportsProps = {
|
|
31
|
-
isTypeOnly?: boolean;
|
|
32
|
-
extName?: KubbFile.Extname;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export { Schema as S, type SchemaContextProps as a };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
4
|
-
import { SchemaObject } from '@kubb/oas';
|
|
5
|
-
import { KubbNode } from '@kubb/react';
|
|
6
|
-
import { S as Schema$1 } from './SchemaMapper-BM1IGWqD.js';
|
|
7
|
-
|
|
8
|
-
type SchemaContextProps = {
|
|
9
|
-
name: string;
|
|
10
|
-
schema?: SchemaObject;
|
|
11
|
-
tree: Array<Schema$1>;
|
|
12
|
-
};
|
|
13
|
-
type Props = {
|
|
14
|
-
name: string;
|
|
15
|
-
value?: SchemaObject;
|
|
16
|
-
tree?: Array<Schema$1>;
|
|
17
|
-
children?: KubbNode;
|
|
18
|
-
};
|
|
19
|
-
declare function Schema({ name, value, tree, children }: Props): KubbNode;
|
|
20
|
-
declare namespace Schema {
|
|
21
|
-
var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
|
|
22
|
-
var Imports: ({ isTypeOnly, extName }: SchemaImportsProps) => ReactNode;
|
|
23
|
-
var Context: react.Context<SchemaContextProps>;
|
|
24
|
-
}
|
|
25
|
-
type FileProps = {
|
|
26
|
-
isTypeOnly?: boolean;
|
|
27
|
-
output: string | undefined;
|
|
28
|
-
children?: KubbNode;
|
|
29
|
-
};
|
|
30
|
-
type SchemaImportsProps = {
|
|
31
|
-
isTypeOnly?: boolean;
|
|
32
|
-
extName?: KubbFile.Extname;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export { Schema as S, type SchemaContextProps as a };
|