@kubb/plugin-solid-query 4.4.0 → 4.5.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-CHqaXKs-.cjs → components-8LQKaeal.cjs} +3 -3
- package/dist/{components-CHqaXKs-.cjs.map → components-8LQKaeal.cjs.map} +1 -1
- package/dist/{components-Cp1BuWfr.js → components-TJW-A9oM.js} +2 -2
- package/dist/{components-Cp1BuWfr.js.map → components-TJW-A9oM.js.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-DnKjkxgk.js → generators-D8jwI0av.js} +86 -44
- package/dist/generators-D8jwI0av.js.map +1 -0
- package/dist/{generators-U3zy_ocI.cjs → generators-KioHO_rz.cjs} +90 -47
- package/dist/generators-KioHO_rz.cjs.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-DFPPpQGq.d.cts → types-CH_Y7MEC.d.ts} +189 -311
- package/dist/{types-C_UYwG2T.d.ts → types-CMt50Wv3.d.cts} +189 -311
- package/package.json +18 -14
- package/src/generators/mutationGenerator.tsx +34 -9
- package/src/generators/queryGenerator.tsx +36 -12
- package/src/plugin.ts +22 -1
- package/src/types.ts +4 -3
- package/dist/generators-DnKjkxgk.js.map +0 -1
- package/dist/generators-U3zy_ocI.cjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
1
|
import * as OasTypes from "oas/types";
|
|
3
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
5
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
6
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
6
|
import BaseOas from "oas";
|
|
7
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
8
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
9
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
10
11
|
|
|
@@ -57,121 +58,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
57
58
|
abstract build(...params: unknown[]): unknown;
|
|
58
59
|
}
|
|
59
60
|
//#endregion
|
|
60
|
-
//#region ../core/src/fs/types.d.ts
|
|
61
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
62
|
-
type Import = {
|
|
63
|
-
/**
|
|
64
|
-
* Import name to be used
|
|
65
|
-
* @example ["useState"]
|
|
66
|
-
* @example "React"
|
|
67
|
-
*/
|
|
68
|
-
name: string | Array<string | {
|
|
69
|
-
propertyName: string;
|
|
70
|
-
name?: string;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Path for the import
|
|
74
|
-
* @example '@kubb/core'
|
|
75
|
-
*/
|
|
76
|
-
path: string;
|
|
77
|
-
/**
|
|
78
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
79
|
-
*/
|
|
80
|
-
isTypeOnly?: boolean;
|
|
81
|
-
isNameSpace?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
84
|
-
*/
|
|
85
|
-
root?: string;
|
|
86
|
-
};
|
|
87
|
-
type Source = {
|
|
88
|
-
name?: string;
|
|
89
|
-
value?: string;
|
|
90
|
-
isTypeOnly?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Has const or type 'export'
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
isExportable?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* When set, barrel generation will add this
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
isIndexable?: boolean;
|
|
101
|
-
};
|
|
102
|
-
type Export = {
|
|
103
|
-
/**
|
|
104
|
-
* Export name to be used.
|
|
105
|
-
* @example ["useState"]
|
|
106
|
-
* @example "React"
|
|
107
|
-
*/
|
|
108
|
-
name?: string | Array<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Path for the import.
|
|
111
|
-
* @example '@kubb/core'
|
|
112
|
-
*/
|
|
113
|
-
path: string;
|
|
114
|
-
/**
|
|
115
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
116
|
-
*/
|
|
117
|
-
isTypeOnly?: boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
120
|
-
*/
|
|
121
|
-
asAlias?: boolean;
|
|
122
|
-
};
|
|
123
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
124
|
-
type Mode = 'single' | 'split';
|
|
125
|
-
/**
|
|
126
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
127
|
-
* Based on UNIX basename
|
|
128
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
129
|
-
*/
|
|
130
|
-
type BaseName = `${string}.${string}`;
|
|
131
|
-
/**
|
|
132
|
-
* Path will be full qualified path to a specified file
|
|
133
|
-
*/
|
|
134
|
-
type Path = string;
|
|
135
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
136
|
-
type OptionalPath = Path | undefined | null;
|
|
137
|
-
type File$1<TMeta extends object = object> = {
|
|
138
|
-
/**
|
|
139
|
-
* Name to be used to create the path
|
|
140
|
-
* Based on UNIX basename, `${name}.extname`
|
|
141
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
142
|
-
*/
|
|
143
|
-
baseName: BaseName;
|
|
144
|
-
/**
|
|
145
|
-
* Path will be full qualified path to a specified file
|
|
146
|
-
*/
|
|
147
|
-
path: AdvancedPath<BaseName> | Path;
|
|
148
|
-
sources: Array<Source>;
|
|
149
|
-
imports?: Array<Import>;
|
|
150
|
-
exports?: Array<Export>;
|
|
151
|
-
/**
|
|
152
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
153
|
-
*/
|
|
154
|
-
meta?: TMeta;
|
|
155
|
-
banner?: string;
|
|
156
|
-
footer?: string;
|
|
157
|
-
};
|
|
158
|
-
type ResolvedImport = Import;
|
|
159
|
-
type ResolvedExport = Export;
|
|
160
|
-
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
161
|
-
/**
|
|
162
|
-
* @default object-hash
|
|
163
|
-
*/
|
|
164
|
-
id: string;
|
|
165
|
-
/**
|
|
166
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
167
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
168
|
-
*/
|
|
169
|
-
name: string;
|
|
170
|
-
extname: Extname;
|
|
171
|
-
imports: Array<ResolvedImport>;
|
|
172
|
-
exports: Array<ResolvedExport>;
|
|
173
|
-
};
|
|
174
|
-
//#endregion
|
|
175
61
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
176
62
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
177
63
|
#private;
|
|
@@ -295,7 +181,7 @@ type Config<TInput = Input> = {
|
|
|
295
181
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
296
182
|
* @default { '.ts': '.ts'}
|
|
297
183
|
*/
|
|
298
|
-
extension?: Record<Extname, Extname | ''>;
|
|
184
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
299
185
|
/**
|
|
300
186
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
301
187
|
* @default 'named'
|
|
@@ -426,7 +312,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
426
312
|
* @type hookFirst
|
|
427
313
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
428
314
|
*/
|
|
429
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
315
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
430
316
|
/**
|
|
431
317
|
* Resolve to a name based on a string.
|
|
432
318
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -444,8 +330,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
444
330
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
445
331
|
type ResolvePathParams<TOptions = object> = {
|
|
446
332
|
pluginKey?: Plugin['key'];
|
|
447
|
-
baseName: BaseName;
|
|
448
|
-
mode?: Mode;
|
|
333
|
+
baseName: KubbFile.BaseName;
|
|
334
|
+
mode?: KubbFile.Mode;
|
|
449
335
|
/**
|
|
450
336
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
451
337
|
*/
|
|
@@ -470,8 +356,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
470
356
|
*/
|
|
471
357
|
fileManager: FileManager;
|
|
472
358
|
pluginManager: PluginManager;
|
|
473
|
-
addFile: (...file: Array<File
|
|
474
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
359
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
360
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
475
361
|
resolveName: (params: ResolveNameParams) => string;
|
|
476
362
|
logger: Logger;
|
|
477
363
|
/**
|
|
@@ -550,8 +436,8 @@ type Events = {
|
|
|
550
436
|
};
|
|
551
437
|
type GetFileProps<TOptions = object> = {
|
|
552
438
|
name: string;
|
|
553
|
-
mode?: Mode;
|
|
554
|
-
extname: Extname;
|
|
439
|
+
mode?: KubbFile.Mode;
|
|
440
|
+
extname: KubbFile.Extname;
|
|
555
441
|
pluginKey: Plugin['key'];
|
|
556
442
|
options?: TOptions;
|
|
557
443
|
};
|
|
@@ -570,10 +456,10 @@ declare class PluginManager {
|
|
|
570
456
|
extname,
|
|
571
457
|
pluginKey,
|
|
572
458
|
options
|
|
573
|
-
}: GetFileProps<TOptions>): File
|
|
459
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
574
460
|
pluginKey: Plugin['key'];
|
|
575
461
|
}>;
|
|
576
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
462
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
577
463
|
resolveName: (params: ResolveNameParams) => string;
|
|
578
464
|
/**
|
|
579
465
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -670,170 +556,6 @@ type FileMetaBase = {
|
|
|
670
556
|
pluginKey?: Plugin['key'];
|
|
671
557
|
};
|
|
672
558
|
//#endregion
|
|
673
|
-
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
674
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
675
|
-
name: string;
|
|
676
|
-
type: 'react';
|
|
677
|
-
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
678
|
-
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
679
|
-
Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
|
|
680
|
-
};
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region ../plugin-oas/src/generators/types.d.ts
|
|
683
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
684
|
-
/**
|
|
685
|
-
* @deprecated
|
|
686
|
-
*/
|
|
687
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
688
|
-
options: TOptions['resolvedOptions'];
|
|
689
|
-
operations: Array<Operation$1>;
|
|
690
|
-
};
|
|
691
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
692
|
-
/**
|
|
693
|
-
* @deprecated
|
|
694
|
-
*/
|
|
695
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
696
|
-
options: TOptions['resolvedOptions'];
|
|
697
|
-
operation: Operation$1;
|
|
698
|
-
};
|
|
699
|
-
type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
|
|
700
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
701
|
-
options: TOptions['resolvedOptions'];
|
|
702
|
-
schema: {
|
|
703
|
-
name: string;
|
|
704
|
-
tree: Array<Schema>;
|
|
705
|
-
value: SchemaObject$1;
|
|
706
|
-
};
|
|
707
|
-
};
|
|
708
|
-
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
711
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
712
|
-
name: string;
|
|
713
|
-
type: 'core';
|
|
714
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File$1[]>;
|
|
715
|
-
operation: (props: OperationProps<TOptions>) => Promise<File$1[]>;
|
|
716
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<File$1[]>;
|
|
717
|
-
};
|
|
718
|
-
//#endregion
|
|
719
|
-
//#region ../plugin-oas/src/types.d.ts
|
|
720
|
-
type ResolvePathOptions = {
|
|
721
|
-
pluginKey?: Plugin['key'];
|
|
722
|
-
group?: {
|
|
723
|
-
tag?: string;
|
|
724
|
-
path?: string;
|
|
725
|
-
};
|
|
726
|
-
type?: ResolveNameParams['type'];
|
|
727
|
-
};
|
|
728
|
-
/**
|
|
729
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
730
|
-
* @example import { Pet } from './Pet'
|
|
731
|
-
*
|
|
732
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
733
|
-
*
|
|
734
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
735
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
736
|
-
*/
|
|
737
|
-
type Ref = {
|
|
738
|
-
propertyName: string;
|
|
739
|
-
originalName: string;
|
|
740
|
-
path: OptionalPath;
|
|
741
|
-
pluginKey?: Plugin['key'];
|
|
742
|
-
};
|
|
743
|
-
type Refs = Record<string, Ref>;
|
|
744
|
-
type OperationSchema = {
|
|
745
|
-
/**
|
|
746
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
747
|
-
*/
|
|
748
|
-
name: string;
|
|
749
|
-
schema: SchemaObject$1;
|
|
750
|
-
operation?: Operation$1;
|
|
751
|
-
/**
|
|
752
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
753
|
-
*/
|
|
754
|
-
operationName: string;
|
|
755
|
-
description?: string;
|
|
756
|
-
statusCode?: number;
|
|
757
|
-
keys?: string[];
|
|
758
|
-
keysToOmit?: string[];
|
|
759
|
-
withData?: boolean;
|
|
760
|
-
};
|
|
761
|
-
type OperationSchemas = {
|
|
762
|
-
pathParams?: OperationSchema & {
|
|
763
|
-
keysToOmit?: never;
|
|
764
|
-
};
|
|
765
|
-
queryParams?: OperationSchema & {
|
|
766
|
-
keysToOmit?: never;
|
|
767
|
-
};
|
|
768
|
-
headerParams?: OperationSchema & {
|
|
769
|
-
keysToOmit?: never;
|
|
770
|
-
};
|
|
771
|
-
request?: OperationSchema;
|
|
772
|
-
response: OperationSchema;
|
|
773
|
-
responses: Array<OperationSchema>;
|
|
774
|
-
statusCodes?: Array<OperationSchema>;
|
|
775
|
-
errors?: Array<OperationSchema>;
|
|
776
|
-
};
|
|
777
|
-
type ByTag = {
|
|
778
|
-
type: 'tag';
|
|
779
|
-
pattern: string | RegExp;
|
|
780
|
-
};
|
|
781
|
-
type ByOperationId = {
|
|
782
|
-
type: 'operationId';
|
|
783
|
-
pattern: string | RegExp;
|
|
784
|
-
};
|
|
785
|
-
type ByPath = {
|
|
786
|
-
type: 'path';
|
|
787
|
-
pattern: string | RegExp;
|
|
788
|
-
};
|
|
789
|
-
type ByMethod = {
|
|
790
|
-
type: 'method';
|
|
791
|
-
pattern: HttpMethod | RegExp;
|
|
792
|
-
};
|
|
793
|
-
type BySchemaName = {
|
|
794
|
-
type: 'schemaName';
|
|
795
|
-
pattern: string | RegExp;
|
|
796
|
-
};
|
|
797
|
-
type ByContentType = {
|
|
798
|
-
type: 'contentType';
|
|
799
|
-
pattern: string | RegExp;
|
|
800
|
-
};
|
|
801
|
-
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
802
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
803
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
804
|
-
options: Partial<TOptions>;
|
|
805
|
-
};
|
|
806
|
-
//#endregion
|
|
807
|
-
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
808
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
809
|
-
fabric: Fabric;
|
|
810
|
-
oas: Oas;
|
|
811
|
-
exclude: Array<Exclude$1> | undefined;
|
|
812
|
-
include: Array<Include> | undefined;
|
|
813
|
-
override: Array<Override<TOptions>> | undefined;
|
|
814
|
-
contentType: contentType | undefined;
|
|
815
|
-
pluginManager: PluginManager;
|
|
816
|
-
/**
|
|
817
|
-
* Current plugin
|
|
818
|
-
*/
|
|
819
|
-
plugin: Plugin<TPluginOptions>;
|
|
820
|
-
mode: Mode;
|
|
821
|
-
};
|
|
822
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
823
|
-
#private;
|
|
824
|
-
getSchemas(operation: Operation$1, {
|
|
825
|
-
resolveName
|
|
826
|
-
}?: {
|
|
827
|
-
resolveName?: (name: string) => string;
|
|
828
|
-
}): OperationSchemas;
|
|
829
|
-
getOperations(): Promise<Array<{
|
|
830
|
-
path: string;
|
|
831
|
-
method: HttpMethod;
|
|
832
|
-
operation: Operation$1;
|
|
833
|
-
}>>;
|
|
834
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File$1<TFileMeta>>>;
|
|
835
|
-
}
|
|
836
|
-
//#endregion
|
|
837
559
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
838
560
|
type SchemaKeywordMapper = {
|
|
839
561
|
object: {
|
|
@@ -947,7 +669,7 @@ type SchemaKeywordMapper = {
|
|
|
947
669
|
/**
|
|
948
670
|
* Full qualified path.
|
|
949
671
|
*/
|
|
950
|
-
path: OptionalPath;
|
|
672
|
+
path: KubbFile.OptionalPath;
|
|
951
673
|
/**
|
|
952
674
|
* When true `File.Import` will be used.
|
|
953
675
|
* When false a reference will be used inside the current file.
|
|
@@ -1051,8 +773,96 @@ type Schema = {
|
|
|
1051
773
|
keyword: string;
|
|
1052
774
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
1053
775
|
//#endregion
|
|
776
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
777
|
+
type ResolvePathOptions = {
|
|
778
|
+
pluginKey?: Plugin['key'];
|
|
779
|
+
group?: {
|
|
780
|
+
tag?: string;
|
|
781
|
+
path?: string;
|
|
782
|
+
};
|
|
783
|
+
type?: ResolveNameParams['type'];
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
787
|
+
* @example import { Pet } from './Pet'
|
|
788
|
+
*
|
|
789
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
790
|
+
*
|
|
791
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
792
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
793
|
+
*/
|
|
794
|
+
type Ref = {
|
|
795
|
+
propertyName: string;
|
|
796
|
+
originalName: string;
|
|
797
|
+
path: KubbFile.OptionalPath;
|
|
798
|
+
pluginKey?: Plugin['key'];
|
|
799
|
+
};
|
|
800
|
+
type Refs = Record<string, Ref>;
|
|
801
|
+
type OperationSchema = {
|
|
802
|
+
/**
|
|
803
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
804
|
+
*/
|
|
805
|
+
name: string;
|
|
806
|
+
schema: SchemaObject$1;
|
|
807
|
+
operation?: Operation$1;
|
|
808
|
+
/**
|
|
809
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
810
|
+
*/
|
|
811
|
+
operationName: string;
|
|
812
|
+
description?: string;
|
|
813
|
+
statusCode?: number;
|
|
814
|
+
keys?: string[];
|
|
815
|
+
keysToOmit?: string[];
|
|
816
|
+
withData?: boolean;
|
|
817
|
+
};
|
|
818
|
+
type OperationSchemas = {
|
|
819
|
+
pathParams?: OperationSchema & {
|
|
820
|
+
keysToOmit?: never;
|
|
821
|
+
};
|
|
822
|
+
queryParams?: OperationSchema & {
|
|
823
|
+
keysToOmit?: never;
|
|
824
|
+
};
|
|
825
|
+
headerParams?: OperationSchema & {
|
|
826
|
+
keysToOmit?: never;
|
|
827
|
+
};
|
|
828
|
+
request?: OperationSchema;
|
|
829
|
+
response: OperationSchema;
|
|
830
|
+
responses: Array<OperationSchema>;
|
|
831
|
+
statusCodes?: Array<OperationSchema>;
|
|
832
|
+
errors?: Array<OperationSchema>;
|
|
833
|
+
};
|
|
834
|
+
type ByTag = {
|
|
835
|
+
type: 'tag';
|
|
836
|
+
pattern: string | RegExp;
|
|
837
|
+
};
|
|
838
|
+
type ByOperationId = {
|
|
839
|
+
type: 'operationId';
|
|
840
|
+
pattern: string | RegExp;
|
|
841
|
+
};
|
|
842
|
+
type ByPath = {
|
|
843
|
+
type: 'path';
|
|
844
|
+
pattern: string | RegExp;
|
|
845
|
+
};
|
|
846
|
+
type ByMethod = {
|
|
847
|
+
type: 'method';
|
|
848
|
+
pattern: HttpMethod | RegExp;
|
|
849
|
+
};
|
|
850
|
+
type BySchemaName = {
|
|
851
|
+
type: 'schemaName';
|
|
852
|
+
pattern: string | RegExp;
|
|
853
|
+
};
|
|
854
|
+
type ByContentType = {
|
|
855
|
+
type: 'contentType';
|
|
856
|
+
pattern: string | RegExp;
|
|
857
|
+
};
|
|
858
|
+
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
859
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
860
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
861
|
+
options: Partial<TOptions>;
|
|
862
|
+
};
|
|
863
|
+
//#endregion
|
|
1054
864
|
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
1055
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
865
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
1056
866
|
fabric: Fabric;
|
|
1057
867
|
oas: Oas;
|
|
1058
868
|
pluginManager: PluginManager;
|
|
@@ -1060,7 +870,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1060
870
|
* Current plugin
|
|
1061
871
|
*/
|
|
1062
872
|
plugin: Plugin<TPluginOptions>;
|
|
1063
|
-
mode: Mode;
|
|
873
|
+
mode: KubbFile.Mode;
|
|
1064
874
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1065
875
|
override: Array<Override<TOptions>> | undefined;
|
|
1066
876
|
contentType?: contentType;
|
|
@@ -1085,15 +895,15 @@ type SchemaGeneratorOptions = {
|
|
|
1085
895
|
* TODO TODO add docs
|
|
1086
896
|
* @beta
|
|
1087
897
|
*/
|
|
1088
|
-
schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
898
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
1089
899
|
};
|
|
1090
900
|
};
|
|
1091
|
-
type SchemaProps = {
|
|
901
|
+
type SchemaProps$1 = {
|
|
1092
902
|
schemaObject?: SchemaObject$1;
|
|
1093
903
|
name?: string;
|
|
1094
904
|
parentName?: string;
|
|
1095
905
|
};
|
|
1096
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
906
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
1097
907
|
#private;
|
|
1098
908
|
refs: Refs;
|
|
1099
909
|
/**
|
|
@@ -1101,14 +911,84 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1101
911
|
* Delegates to getBaseTypeFromSchema internally and
|
|
1102
912
|
* optionally adds a union with null.
|
|
1103
913
|
*/
|
|
1104
|
-
parse(props: SchemaProps): Schema[];
|
|
1105
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
1106
|
-
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
914
|
+
parse(props: SchemaProps$1): Schema[];
|
|
1107
915
|
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
1108
|
-
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1109
916
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1110
917
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1111
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
918
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
922
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
923
|
+
name: string;
|
|
924
|
+
type: 'core';
|
|
925
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
926
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
927
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
928
|
+
};
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
931
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
932
|
+
name: string;
|
|
933
|
+
type: 'react';
|
|
934
|
+
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
935
|
+
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
936
|
+
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
937
|
+
};
|
|
938
|
+
//#endregion
|
|
939
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
940
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
941
|
+
config: Config;
|
|
942
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
943
|
+
plugin: Plugin<TOptions>;
|
|
944
|
+
operations: Array<Operation$1>;
|
|
945
|
+
};
|
|
946
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
947
|
+
config: Config;
|
|
948
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
949
|
+
plugin: Plugin<TOptions>;
|
|
950
|
+
operation: Operation$1;
|
|
951
|
+
};
|
|
952
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
953
|
+
config: Config;
|
|
954
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
955
|
+
plugin: Plugin<TOptions>;
|
|
956
|
+
schema: {
|
|
957
|
+
name: string;
|
|
958
|
+
tree: Array<Schema>;
|
|
959
|
+
value: SchemaObject$1;
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
965
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
966
|
+
fabric: Fabric;
|
|
967
|
+
oas: Oas;
|
|
968
|
+
exclude: Array<Exclude$1> | undefined;
|
|
969
|
+
include: Array<Include> | undefined;
|
|
970
|
+
override: Array<Override<TOptions>> | undefined;
|
|
971
|
+
contentType: contentType | undefined;
|
|
972
|
+
pluginManager: PluginManager;
|
|
973
|
+
/**
|
|
974
|
+
* Current plugin
|
|
975
|
+
*/
|
|
976
|
+
plugin: Plugin<TPluginOptions>;
|
|
977
|
+
mode: KubbFile.Mode;
|
|
978
|
+
};
|
|
979
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
980
|
+
#private;
|
|
981
|
+
getSchemas(operation: Operation$1, {
|
|
982
|
+
resolveName
|
|
983
|
+
}?: {
|
|
984
|
+
resolveName?: (name: string) => string;
|
|
985
|
+
}): OperationSchemas;
|
|
986
|
+
getOperations(): Promise<Array<{
|
|
987
|
+
path: string;
|
|
988
|
+
method: HttpMethod;
|
|
989
|
+
operation: Operation$1;
|
|
990
|
+
}>>;
|
|
991
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1112
992
|
}
|
|
1113
993
|
//#endregion
|
|
1114
994
|
//#region ../plugin-client/src/types.d.ts
|
|
@@ -1155,7 +1035,6 @@ type Options$2 = {
|
|
|
1155
1035
|
* Path to the client import path that will be used to do the API calls.
|
|
1156
1036
|
* It will be used as `import client from '${client.importPath}'`.
|
|
1157
1037
|
* It allows both relative and absolute path but be aware that we will not change the path.
|
|
1158
|
-
* @default '@kubb/plugin-client/clients/axios'
|
|
1159
1038
|
*/
|
|
1160
1039
|
importPath?: string;
|
|
1161
1040
|
/**
|
|
@@ -1196,8 +1075,8 @@ type Options$2 = {
|
|
|
1196
1075
|
parser?: 'client' | 'zod';
|
|
1197
1076
|
/**
|
|
1198
1077
|
* Which client should be used to do the HTTP calls
|
|
1199
|
-
* - 'axios' will use `@kubb/plugin-client/
|
|
1200
|
-
* - 'fetch' will use `@kubb/plugin-client/
|
|
1078
|
+
* - 'axios' will use `@kubb/plugin-client/templates/axios` to fetch data.
|
|
1079
|
+
* - 'fetch' will use `@kubb/plugin-client/templates/fetch` to fetch data.
|
|
1201
1080
|
* @default 'axios'
|
|
1202
1081
|
*/
|
|
1203
1082
|
client?: 'axios' | 'fetch';
|
|
@@ -1216,9 +1095,10 @@ type ResolvedOptions$1 = {
|
|
|
1216
1095
|
output: Output<Oas>;
|
|
1217
1096
|
group?: Options$2['group'];
|
|
1218
1097
|
baseURL: string | undefined;
|
|
1098
|
+
client: Options$2['client'];
|
|
1219
1099
|
parser: NonNullable<Options$2['parser']>;
|
|
1220
1100
|
urlType: NonNullable<Options$2['urlType']>;
|
|
1221
|
-
importPath:
|
|
1101
|
+
importPath: Options$2['importPath'];
|
|
1222
1102
|
dataReturnType: NonNullable<Options$2['dataReturnType']>;
|
|
1223
1103
|
pathParamsType: NonNullable<Options$2['pathParamsType']>;
|
|
1224
1104
|
paramsType: NonNullable<Options$2['paramsType']>;
|
|
@@ -1286,7 +1166,7 @@ type Options$1 = {
|
|
|
1286
1166
|
* Group the @tanstack/query hooks based on the provided name.
|
|
1287
1167
|
*/
|
|
1288
1168
|
group?: Group;
|
|
1289
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1169
|
+
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1290
1170
|
/**
|
|
1291
1171
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1292
1172
|
*/
|
|
@@ -1347,9 +1227,7 @@ type Options$1 = {
|
|
|
1347
1227
|
type ResolvedOptions = {
|
|
1348
1228
|
output: Output<Oas>;
|
|
1349
1229
|
group: Options$1['group'];
|
|
1350
|
-
client:
|
|
1351
|
-
baseURL?: string;
|
|
1352
|
-
};
|
|
1230
|
+
client: NonNullable<PluginSolidQuery['options']['client']>;
|
|
1353
1231
|
parser: Required<NonNullable<Options$1['parser']>>;
|
|
1354
1232
|
paramsCasing: Options$1['paramsCasing'];
|
|
1355
1233
|
paramsType: NonNullable<Options$1['paramsType']>;
|
|
@@ -1361,5 +1239,5 @@ type ResolvedOptions = {
|
|
|
1361
1239
|
};
|
|
1362
1240
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1363
1241
|
//#endregion
|
|
1364
|
-
export {
|
|
1365
|
-
//# sourceMappingURL=types-
|
|
1242
|
+
export { OperationSchemas as a, ReactGenerator as i, PluginSolidQuery as n, UserPluginWithLifeCycle as o, Transformer as r, Operation$1 as s, Options$1 as t };
|
|
1243
|
+
//# sourceMappingURL=types-CMt50Wv3.d.cts.map
|