@kubb/plugin-ts 5.0.0-alpha.24 → 5.0.0-alpha.25
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.cjs +468 -473
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.js +472 -477
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Enum.tsx +1 -1
- package/src/constants.ts +10 -0
- package/src/factory.ts +122 -1
- package/src/generators/typeGenerator.tsx +107 -108
- package/src/generators/typeGeneratorLegacy.tsx +85 -80
- package/src/index.ts +0 -5
- package/src/plugin.ts +19 -49
- package/src/printers/functionPrinter.ts +6 -5
- package/src/printers/printerTs.ts +49 -181
- package/src/resolvers/resolverTs.ts +2 -2
- package/src/types.ts +6 -4
- package/src/utils.ts +41 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import ts from "typescript";
|
|
3
2
|
import { OperationParamsResolver } from "@kubb/ast";
|
|
3
|
+
import ts from "typescript";
|
|
4
4
|
import * as _$_kubb_core0 from "@kubb/core";
|
|
5
5
|
import { CompatibilityPreset, Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, PrinterFactoryOptions, ResolvePathOptions, Resolver, UserGroup } from "@kubb/core";
|
|
6
6
|
import { EnumSchemaNode, FunctionNode, OperationNode, ParameterNode, SchemaNode, StatusCode, Visitor } from "@kubb/ast/types";
|
|
@@ -27,7 +27,10 @@ type ResolverTs = Resolver & OperationParamsResolver & {
|
|
|
27
27
|
* @example
|
|
28
28
|
* resolver.resolvePathName('list pets', 'file') // → 'ListPets'
|
|
29
29
|
*/
|
|
30
|
-
resolvePathName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
|
|
30
|
+
resolvePathName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
|
|
31
|
+
/**
|
|
32
|
+
* Resolves the request body type name for an operation (required on ResolverTs).
|
|
33
|
+
*/
|
|
31
34
|
resolveDataName(node: OperationNode): string;
|
|
32
35
|
/**
|
|
33
36
|
* Resolves the name for an operation response by status code.
|
|
@@ -67,7 +70,9 @@ type ResolverTs = Resolver & OperationParamsResolver & {
|
|
|
67
70
|
* resolver.resolveEnumKeyName(node, 'Value') // → 'PetStatusValue'
|
|
68
71
|
* resolver.resolveEnumKeyName(node, '') // → 'PetStatus'
|
|
69
72
|
*/
|
|
70
|
-
resolveEnumKeyName(node:
|
|
73
|
+
resolveEnumKeyName(node: {
|
|
74
|
+
name?: string | null;
|
|
75
|
+
}, enumTypeSuffix: string): string;
|
|
71
76
|
/**
|
|
72
77
|
* Resolves the name for an operation's grouped path parameters type.
|
|
73
78
|
*
|
|
@@ -155,7 +160,7 @@ type EnumTypeOptions = {
|
|
|
155
160
|
/**
|
|
156
161
|
* Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
|
|
157
162
|
* - 'literal' generates literal union types.
|
|
158
|
-
* - 'inlineLiteral'
|
|
163
|
+
* - 'inlineLiteral' will inline enum values directly into the type (default in v5).
|
|
159
164
|
* @default 'asConst'
|
|
160
165
|
* @note In Kubb v5, 'inlineLiteral' becomes the default.
|
|
161
166
|
*/
|