@kubb/plugin-ts 4.21.2 → 4.22.0
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.d.cts +3 -1
- package/dist/components.d.ts +3 -1
- package/dist/generators.d.cts +457 -1
- package/dist/generators.d.ts +457 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types-C2WYWYjC.d.ts +161 -0
- package/dist/types-DPguQrp_.d.cts +162 -0
- package/package.json +5 -5
- package/dist/types-Ct6STUWn.d.cts +0 -702
- package/dist/types-lrxr2PzI.d.ts +0 -701
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Oas, contentType } from "@kubb/oas";
|
|
2
|
+
import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
3
|
+
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
4
|
+
import { Generator } from "@kubb/plugin-oas/generators";
|
|
5
|
+
import ts from "typescript";
|
|
6
|
+
|
|
7
|
+
//#region rolldown:runtime
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/types.d.ts
|
|
10
|
+
type Options = {
|
|
11
|
+
/**
|
|
12
|
+
* Specify the export location for the files and define the behavior of the output
|
|
13
|
+
* @default { path: 'types', barrelType: 'named' }
|
|
14
|
+
*/
|
|
15
|
+
output?: Output<Oas>;
|
|
16
|
+
/**
|
|
17
|
+
* Define which contentType should be used.
|
|
18
|
+
* By default, uses the first valid JSON media type.
|
|
19
|
+
*/
|
|
20
|
+
contentType?: contentType;
|
|
21
|
+
/**
|
|
22
|
+
* Group the clients based on the provided name.
|
|
23
|
+
*/
|
|
24
|
+
group?: Group;
|
|
25
|
+
/**
|
|
26
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
27
|
+
*/
|
|
28
|
+
exclude?: Array<Exclude>;
|
|
29
|
+
/**
|
|
30
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
31
|
+
*/
|
|
32
|
+
include?: Array<Include>;
|
|
33
|
+
/**
|
|
34
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
35
|
+
*/
|
|
36
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
37
|
+
/**
|
|
38
|
+
* Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
|
|
39
|
+
* - 'enum' generates TypeScript enum declarations.
|
|
40
|
+
* - 'asConst' generates const objects with camelCase names and as const assertion.
|
|
41
|
+
* - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
|
|
42
|
+
* - 'constEnum' generates TypeScript const enum declarations.
|
|
43
|
+
* - 'literal' generates literal union types.
|
|
44
|
+
* - 'inlineLiteral' inline enum values directly into the type (default in v5).
|
|
45
|
+
* @default 'asConst'
|
|
46
|
+
* @note In Kubb v5, 'inlineLiteral' becomes the default.
|
|
47
|
+
*/
|
|
48
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
49
|
+
/**
|
|
50
|
+
* Choose the casing for enum key names.
|
|
51
|
+
* - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
|
|
52
|
+
* - 'snakeCase' generates keys in snake_case format.
|
|
53
|
+
* - 'pascalCase' generates keys in PascalCase format.
|
|
54
|
+
* - 'camelCase' generates keys in camelCase format.
|
|
55
|
+
* - 'none' uses the enum value as-is without transformation.
|
|
56
|
+
* @default 'none'
|
|
57
|
+
*/
|
|
58
|
+
enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
|
|
59
|
+
/**
|
|
60
|
+
* Switch between type or interface for creating TypeScript types.
|
|
61
|
+
* - 'type' generates type alias declarations.
|
|
62
|
+
* - 'interface' generates interface declarations.
|
|
63
|
+
* @default 'type'
|
|
64
|
+
*/
|
|
65
|
+
syntaxType?: 'type' | 'interface';
|
|
66
|
+
/**
|
|
67
|
+
* Set a suffix for the generated enums.
|
|
68
|
+
* @default 'enum'
|
|
69
|
+
*/
|
|
70
|
+
enumSuffix?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
73
|
+
* - 'string' represents dates as string values.
|
|
74
|
+
* - 'date' represents dates as JavaScript Date objects.
|
|
75
|
+
* @default 'string'
|
|
76
|
+
*/
|
|
77
|
+
dateType?: 'string' | 'date';
|
|
78
|
+
/**
|
|
79
|
+
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
80
|
+
* - 'any' allows any value.
|
|
81
|
+
* - 'unknown' requires type narrowing before use.
|
|
82
|
+
* - 'void' represents no value.
|
|
83
|
+
* @default 'any'
|
|
84
|
+
*/
|
|
85
|
+
unknownType?: 'any' | 'unknown' | 'void';
|
|
86
|
+
/**
|
|
87
|
+
* Which type to use for empty schema values.
|
|
88
|
+
* - 'any' allows any value.
|
|
89
|
+
* - 'unknown' requires type narrowing before use.
|
|
90
|
+
* - 'void' represents no value.
|
|
91
|
+
* @default `unknownType`
|
|
92
|
+
*/
|
|
93
|
+
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
94
|
+
/**
|
|
95
|
+
* Choose what to use as mode for an optional value.
|
|
96
|
+
* - 'questionToken' marks the property as optional with ? (e.g., type?: string).
|
|
97
|
+
* - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
|
|
98
|
+
* - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
|
|
99
|
+
* @default 'questionToken'
|
|
100
|
+
*/
|
|
101
|
+
optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
|
|
102
|
+
/**
|
|
103
|
+
* Choose between Array<string> or string[] for array types.
|
|
104
|
+
* - 'generic' generates Array<Type> syntax.
|
|
105
|
+
* - 'array' generates Type[] syntax.
|
|
106
|
+
* @default 'array'
|
|
107
|
+
*/
|
|
108
|
+
arrayType?: 'generic' | 'array';
|
|
109
|
+
transformers?: {
|
|
110
|
+
/**
|
|
111
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
112
|
+
*/
|
|
113
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @example
|
|
117
|
+
* Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature)
|
|
118
|
+
* category: factory.createPropertySignature(
|
|
119
|
+
* undefined,
|
|
120
|
+
* factory.createIdentifier("category"),
|
|
121
|
+
* factory.createToken(ts.SyntaxKind.QuestionToken),
|
|
122
|
+
* factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
|
|
123
|
+
* )
|
|
124
|
+
*/
|
|
125
|
+
mapper?: Record<string, ts.PropertySignature>;
|
|
126
|
+
/**
|
|
127
|
+
* How to style your params, by default no casing is applied
|
|
128
|
+
* - 'camelcase' uses camelCase for pathParams, queryParams and headerParams property names
|
|
129
|
+
* @default undefined
|
|
130
|
+
* @note response types (data/body) are NOT affected by this option
|
|
131
|
+
*/
|
|
132
|
+
paramsCasing?: 'camelcase';
|
|
133
|
+
/**
|
|
134
|
+
* Define some generators next to the ts generators
|
|
135
|
+
*/
|
|
136
|
+
generators?: Array<Generator<PluginTs>>;
|
|
137
|
+
/**
|
|
138
|
+
* Unstable naming for v5
|
|
139
|
+
*/
|
|
140
|
+
UNSTABLE_NAMING?: true;
|
|
141
|
+
};
|
|
142
|
+
type ResolvedOptions = {
|
|
143
|
+
output: Output<Oas>;
|
|
144
|
+
group: Options['group'];
|
|
145
|
+
override: NonNullable<Options['override']>;
|
|
146
|
+
enumType: NonNullable<Options['enumType']>;
|
|
147
|
+
enumKeyCasing: NonNullable<Options['enumKeyCasing']>;
|
|
148
|
+
enumSuffix: NonNullable<Options['enumSuffix']>;
|
|
149
|
+
dateType: NonNullable<Options['dateType']>;
|
|
150
|
+
unknownType: NonNullable<Options['unknownType']>;
|
|
151
|
+
emptySchemaType: NonNullable<Options['emptySchemaType']>;
|
|
152
|
+
optionalType: NonNullable<Options['optionalType']>;
|
|
153
|
+
arrayType: NonNullable<Options['arrayType']>;
|
|
154
|
+
transformers: NonNullable<Options['transformers']>;
|
|
155
|
+
syntaxType: NonNullable<Options['syntaxType']>;
|
|
156
|
+
mapper: Record<string, any>;
|
|
157
|
+
paramsCasing: Options['paramsCasing'];
|
|
158
|
+
};
|
|
159
|
+
type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { PluginTs as n, __name as r, Options as t };
|
|
162
|
+
//# sourceMappingURL=types-DPguQrp_.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.0",
|
|
4
4
|
"description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"@kubb/fabric-core": "0.12.11",
|
|
72
72
|
"@kubb/react-fabric": "0.12.11",
|
|
73
73
|
"natural-orderby": "^5.0.0",
|
|
74
|
-
"remeda": "^2.33.
|
|
74
|
+
"remeda": "^2.33.6",
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
|
-
"@kubb/core": "4.
|
|
77
|
-
"@kubb/oas": "4.
|
|
78
|
-
"@kubb/plugin-oas": "4.
|
|
76
|
+
"@kubb/core": "4.22.0",
|
|
77
|
+
"@kubb/oas": "4.22.0",
|
|
78
|
+
"@kubb/plugin-oas": "4.22.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@kubb/react-fabric": "0.12.11",
|