@kubb/plugin-ts 3.16.1 → 3.16.3
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/components-6F5RoYuJ.js +2240 -0
- package/dist/components-6F5RoYuJ.js.map +1 -0
- package/dist/components-B-Jx1kI5.cjs +2256 -0
- package/dist/components-B-Jx1kI5.cjs.map +1 -0
- package/dist/components.cjs +3 -15
- package/dist/components.d.cts +40 -26
- package/dist/components.d.ts +40 -26
- package/dist/components.js +3 -3
- package/dist/generators.cjs +4 -16
- package/dist/generators.d.cts +8 -9
- package/dist/generators.d.ts +8 -9
- package/dist/generators.js +4 -4
- package/dist/index.cjs +4 -17
- package/dist/index.d.cts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +3 -6
- package/dist/plugin-BXxI6FcR.cjs +378 -0
- package/dist/plugin-BXxI6FcR.cjs.map +1 -0
- package/dist/plugin-DXUISuTd.js +355 -0
- package/dist/plugin-DXUISuTd.js.map +1 -0
- package/dist/types-BL0qEGbB.d.cts +1223 -0
- package/dist/types-DFDnGwpy.d.ts +1223 -0
- package/package.json +23 -28
- package/src/generators/typeGenerator.tsx +4 -4
- package/src/parser.ts +1 -1
- package/dist/chunk-5LFEQTFW.cjs +0 -387
- package/dist/chunk-5LFEQTFW.cjs.map +0 -1
- package/dist/chunk-AUTKC2ER.js +0 -358
- package/dist/chunk-AUTKC2ER.js.map +0 -1
- package/dist/chunk-G37NJ4JQ.js +0 -2585
- package/dist/chunk-G37NJ4JQ.js.map +0 -1
- package/dist/chunk-YB6JHIAR.cjs +0 -2611
- package/dist/chunk-YB6JHIAR.cjs.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types-DkvPgLAK.d.cts +0 -116
- package/dist/types-DkvPgLAK.d.ts +0 -116
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType } from '@kubb/oas';
|
|
3
|
-
import { Exclude, Include, Override, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
|
-
import ts from 'typescript';
|
|
5
|
-
|
|
6
|
-
type Options = {
|
|
7
|
-
/**
|
|
8
|
-
* Specify the export location for the files and define the behavior of the output
|
|
9
|
-
* @default { path: 'types', barrelType: 'named' }
|
|
10
|
-
*/
|
|
11
|
-
output?: Output<Oas>;
|
|
12
|
-
/**
|
|
13
|
-
* Define which contentType should be used.
|
|
14
|
-
* By default, the first JSON valid mediaType will be used
|
|
15
|
-
*/
|
|
16
|
-
contentType?: contentType;
|
|
17
|
-
/**
|
|
18
|
-
* Group the clients based on the provided name.
|
|
19
|
-
*/
|
|
20
|
-
group?: Group;
|
|
21
|
-
/**
|
|
22
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
23
|
-
*/
|
|
24
|
-
exclude?: Array<Exclude>;
|
|
25
|
-
/**
|
|
26
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
27
|
-
*/
|
|
28
|
-
include?: Array<Include>;
|
|
29
|
-
/**
|
|
30
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
31
|
-
*/
|
|
32
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
33
|
-
/**
|
|
34
|
-
* Choose to use `enum` or `as const` for enums
|
|
35
|
-
* @default 'asConst'
|
|
36
|
-
* asPascalConst is deprecated
|
|
37
|
-
*/
|
|
38
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
39
|
-
/**
|
|
40
|
-
* Switch between type or interface for creating TypeScript types
|
|
41
|
-
* @default 'type'
|
|
42
|
-
*/
|
|
43
|
-
syntaxType?: 'type' | 'interface';
|
|
44
|
-
/**
|
|
45
|
-
* Set a suffix for the generated enums.
|
|
46
|
-
* @default 'enum'
|
|
47
|
-
*/
|
|
48
|
-
enumSuffix?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
|
|
51
|
-
* @default 'string'
|
|
52
|
-
*/
|
|
53
|
-
dateType?: 'string' | 'date';
|
|
54
|
-
/**
|
|
55
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
56
|
-
* @default 'any'
|
|
57
|
-
*/
|
|
58
|
-
unknownType?: 'any' | 'unknown' | 'void';
|
|
59
|
-
/**
|
|
60
|
-
* Which type to use for empty schema values
|
|
61
|
-
* @default `unknownType`
|
|
62
|
-
*/
|
|
63
|
-
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
64
|
-
/**
|
|
65
|
-
* Choose what to use as mode for an optional value.
|
|
66
|
-
* @examples 'questionToken': type?: string
|
|
67
|
-
* @examples 'undefined': type: string | undefined
|
|
68
|
-
* @examples 'questionTokenAndUndefined': type?: string | undefined
|
|
69
|
-
* @default 'questionToken'
|
|
70
|
-
*/
|
|
71
|
-
optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
|
|
72
|
-
transformers?: {
|
|
73
|
-
/**
|
|
74
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
75
|
-
*/
|
|
76
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Export an Oas object as Oas type with `import type { Infer } from '@kubb/oas'`
|
|
80
|
-
*/
|
|
81
|
-
oasType?: 'infer' | false;
|
|
82
|
-
/**
|
|
83
|
-
* @example
|
|
84
|
-
* Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature)
|
|
85
|
-
* category: factory.createPropertySignature(
|
|
86
|
-
* undefined,
|
|
87
|
-
* factory.createIdentifier("category"),
|
|
88
|
-
* factory.createToken(ts.SyntaxKind.QuestionToken),
|
|
89
|
-
* factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
|
|
90
|
-
* )
|
|
91
|
-
*/
|
|
92
|
-
mapper?: Record<string, ts.PropertySignature>;
|
|
93
|
-
/**
|
|
94
|
-
* Define some generators next to the ts generators
|
|
95
|
-
*/
|
|
96
|
-
generators?: Array<Generator<PluginTs>>;
|
|
97
|
-
};
|
|
98
|
-
type ResolvedOptions = {
|
|
99
|
-
output: Output<Oas>;
|
|
100
|
-
group: Options['group'];
|
|
101
|
-
override: NonNullable<Options['override']>;
|
|
102
|
-
enumType: NonNullable<Options['enumType']>;
|
|
103
|
-
enumSuffix: NonNullable<Options['enumSuffix']>;
|
|
104
|
-
dateType: NonNullable<Options['dateType']>;
|
|
105
|
-
unknownType: NonNullable<Options['unknownType']>;
|
|
106
|
-
emptySchemaType: NonNullable<Options['emptySchemaType']>;
|
|
107
|
-
optionalType: NonNullable<Options['optionalType']>;
|
|
108
|
-
transformers: NonNullable<Options['transformers']>;
|
|
109
|
-
oasType: NonNullable<Options['oasType']>;
|
|
110
|
-
syntaxType: NonNullable<Options['syntaxType']>;
|
|
111
|
-
usedEnumNames: Record<string, number>;
|
|
112
|
-
mapper: Record<string, any>;
|
|
113
|
-
};
|
|
114
|
-
type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
115
|
-
|
|
116
|
-
export type { Options as O, PluginTs as P };
|
package/dist/types-DkvPgLAK.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType } from '@kubb/oas';
|
|
3
|
-
import { Exclude, Include, Override, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
|
-
import ts from 'typescript';
|
|
5
|
-
|
|
6
|
-
type Options = {
|
|
7
|
-
/**
|
|
8
|
-
* Specify the export location for the files and define the behavior of the output
|
|
9
|
-
* @default { path: 'types', barrelType: 'named' }
|
|
10
|
-
*/
|
|
11
|
-
output?: Output<Oas>;
|
|
12
|
-
/**
|
|
13
|
-
* Define which contentType should be used.
|
|
14
|
-
* By default, the first JSON valid mediaType will be used
|
|
15
|
-
*/
|
|
16
|
-
contentType?: contentType;
|
|
17
|
-
/**
|
|
18
|
-
* Group the clients based on the provided name.
|
|
19
|
-
*/
|
|
20
|
-
group?: Group;
|
|
21
|
-
/**
|
|
22
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
23
|
-
*/
|
|
24
|
-
exclude?: Array<Exclude>;
|
|
25
|
-
/**
|
|
26
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
27
|
-
*/
|
|
28
|
-
include?: Array<Include>;
|
|
29
|
-
/**
|
|
30
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
31
|
-
*/
|
|
32
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
33
|
-
/**
|
|
34
|
-
* Choose to use `enum` or `as const` for enums
|
|
35
|
-
* @default 'asConst'
|
|
36
|
-
* asPascalConst is deprecated
|
|
37
|
-
*/
|
|
38
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
39
|
-
/**
|
|
40
|
-
* Switch between type or interface for creating TypeScript types
|
|
41
|
-
* @default 'type'
|
|
42
|
-
*/
|
|
43
|
-
syntaxType?: 'type' | 'interface';
|
|
44
|
-
/**
|
|
45
|
-
* Set a suffix for the generated enums.
|
|
46
|
-
* @default 'enum'
|
|
47
|
-
*/
|
|
48
|
-
enumSuffix?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
|
|
51
|
-
* @default 'string'
|
|
52
|
-
*/
|
|
53
|
-
dateType?: 'string' | 'date';
|
|
54
|
-
/**
|
|
55
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
56
|
-
* @default 'any'
|
|
57
|
-
*/
|
|
58
|
-
unknownType?: 'any' | 'unknown' | 'void';
|
|
59
|
-
/**
|
|
60
|
-
* Which type to use for empty schema values
|
|
61
|
-
* @default `unknownType`
|
|
62
|
-
*/
|
|
63
|
-
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
64
|
-
/**
|
|
65
|
-
* Choose what to use as mode for an optional value.
|
|
66
|
-
* @examples 'questionToken': type?: string
|
|
67
|
-
* @examples 'undefined': type: string | undefined
|
|
68
|
-
* @examples 'questionTokenAndUndefined': type?: string | undefined
|
|
69
|
-
* @default 'questionToken'
|
|
70
|
-
*/
|
|
71
|
-
optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
|
|
72
|
-
transformers?: {
|
|
73
|
-
/**
|
|
74
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
75
|
-
*/
|
|
76
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Export an Oas object as Oas type with `import type { Infer } from '@kubb/oas'`
|
|
80
|
-
*/
|
|
81
|
-
oasType?: 'infer' | false;
|
|
82
|
-
/**
|
|
83
|
-
* @example
|
|
84
|
-
* Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature)
|
|
85
|
-
* category: factory.createPropertySignature(
|
|
86
|
-
* undefined,
|
|
87
|
-
* factory.createIdentifier("category"),
|
|
88
|
-
* factory.createToken(ts.SyntaxKind.QuestionToken),
|
|
89
|
-
* factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
|
|
90
|
-
* )
|
|
91
|
-
*/
|
|
92
|
-
mapper?: Record<string, ts.PropertySignature>;
|
|
93
|
-
/**
|
|
94
|
-
* Define some generators next to the ts generators
|
|
95
|
-
*/
|
|
96
|
-
generators?: Array<Generator<PluginTs>>;
|
|
97
|
-
};
|
|
98
|
-
type ResolvedOptions = {
|
|
99
|
-
output: Output<Oas>;
|
|
100
|
-
group: Options['group'];
|
|
101
|
-
override: NonNullable<Options['override']>;
|
|
102
|
-
enumType: NonNullable<Options['enumType']>;
|
|
103
|
-
enumSuffix: NonNullable<Options['enumSuffix']>;
|
|
104
|
-
dateType: NonNullable<Options['dateType']>;
|
|
105
|
-
unknownType: NonNullable<Options['unknownType']>;
|
|
106
|
-
emptySchemaType: NonNullable<Options['emptySchemaType']>;
|
|
107
|
-
optionalType: NonNullable<Options['optionalType']>;
|
|
108
|
-
transformers: NonNullable<Options['transformers']>;
|
|
109
|
-
oasType: NonNullable<Options['oasType']>;
|
|
110
|
-
syntaxType: NonNullable<Options['syntaxType']>;
|
|
111
|
-
usedEnumNames: Record<string, number>;
|
|
112
|
-
mapper: Record<string, any>;
|
|
113
|
-
};
|
|
114
|
-
type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
115
|
-
|
|
116
|
-
export type { Options as O, PluginTs as P };
|