@kubb/plugin-react-query 4.21.2 → 4.22.1
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-DLX0cp80.js → generators-DTkvanZK.js} +51 -11
- package/dist/generators-DTkvanZK.js.map +1 -0
- package/dist/{generators-BNYyHlZa.cjs → generators-DtDEbt56.cjs} +51 -11
- package/dist/generators-DtDEbt56.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +457 -1
- package/dist/generators.d.ts +457 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types-CgOcKVIt.d.cts +204 -0
- package/dist/types-DoN-nl4J.d.ts +203 -0
- package/package.json +8 -8
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +2 -2
- package/src/generators/__snapshots__/clientGetImportPath.ts +2 -2
- package/src/generators/__snapshots__/clientPostImportPath.ts +2 -2
- package/src/generators/__snapshots__/createUsersWithListInput.ts +2 -2
- package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +2 -2
- package/src/generators/__snapshots__/findByStatusAllOptional.ts +2 -5
- package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +2 -2
- package/src/generators/__snapshots__/findByTags.ts +2 -2
- package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByTags.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseByTags.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +2 -2
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +2 -2
- package/src/generators/__snapshots__/getPetIdCamelCase.ts +2 -2
- package/src/generators/__snapshots__/postAsQuery.ts +2 -2
- package/src/generators/__snapshots__/updatePetById.ts +2 -2
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +2 -2
- package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +2 -2
- package/src/generators/infiniteQueryGenerator.tsx +2 -2
- package/src/generators/mutationGenerator.tsx +2 -2
- package/src/generators/queryGenerator.tsx +2 -2
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +2 -2
- package/src/generators/suspenseQueryGenerator.tsx +2 -2
- package/dist/generators-BNYyHlZa.cjs.map +0 -1
- package/dist/generators-DLX0cp80.js.map +0 -1
- package/dist/types-CdpInNzi.d.ts +0 -877
- package/dist/types-Fb-3R-ua.d.cts +0 -878
package/dist/generators.d.ts
CHANGED
|
@@ -1,6 +1,462 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as PluginReactQuery } from "./types-DoN-nl4J.js";
|
|
3
|
+
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
|
+
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
5
|
+
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
6
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
7
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
8
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
9
|
|
|
10
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
11
|
+
type GetOasOptions = {
|
|
12
|
+
validate?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type Context$2 = {
|
|
15
|
+
getOas(options?: GetOasOptions): Promise<Oas>;
|
|
16
|
+
getBaseURL(): Promise<string | undefined>;
|
|
17
|
+
};
|
|
18
|
+
declare global {
|
|
19
|
+
namespace Kubb {
|
|
20
|
+
interface PluginContext extends Context$2 {}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
25
|
+
* @example import { Pet } from './Pet'
|
|
26
|
+
*
|
|
27
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
28
|
+
*
|
|
29
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
30
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
31
|
+
*/
|
|
32
|
+
type Ref = {
|
|
33
|
+
propertyName: string;
|
|
34
|
+
originalName: string;
|
|
35
|
+
path: KubbFile.Path;
|
|
36
|
+
pluginKey?: Plugin['key'];
|
|
37
|
+
};
|
|
38
|
+
type Refs = Record<string, Ref>;
|
|
39
|
+
type OperationSchema = {
|
|
40
|
+
/**
|
|
41
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
schema: SchemaObject;
|
|
45
|
+
operation?: Operation;
|
|
46
|
+
/**
|
|
47
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
48
|
+
*/
|
|
49
|
+
operationName: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
statusCode?: number;
|
|
52
|
+
keys?: string[];
|
|
53
|
+
keysToOmit?: string[];
|
|
54
|
+
withData?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type OperationSchemas = {
|
|
57
|
+
pathParams?: OperationSchema & {
|
|
58
|
+
keysToOmit?: never;
|
|
59
|
+
};
|
|
60
|
+
queryParams?: OperationSchema & {
|
|
61
|
+
keysToOmit?: never;
|
|
62
|
+
};
|
|
63
|
+
headerParams?: OperationSchema & {
|
|
64
|
+
keysToOmit?: never;
|
|
65
|
+
};
|
|
66
|
+
request?: OperationSchema;
|
|
67
|
+
response: OperationSchema;
|
|
68
|
+
responses: Array<OperationSchema>;
|
|
69
|
+
statusCodes?: Array<OperationSchema>;
|
|
70
|
+
errors?: Array<OperationSchema>;
|
|
71
|
+
};
|
|
72
|
+
type ByTag = {
|
|
73
|
+
type: 'tag';
|
|
74
|
+
pattern: string | RegExp;
|
|
75
|
+
};
|
|
76
|
+
type ByOperationId = {
|
|
77
|
+
type: 'operationId';
|
|
78
|
+
pattern: string | RegExp;
|
|
79
|
+
};
|
|
80
|
+
type ByPath = {
|
|
81
|
+
type: 'path';
|
|
82
|
+
pattern: string | RegExp;
|
|
83
|
+
};
|
|
84
|
+
type ByMethod = {
|
|
85
|
+
type: 'method';
|
|
86
|
+
pattern: HttpMethod | RegExp;
|
|
87
|
+
};
|
|
88
|
+
type BySchemaName = {
|
|
89
|
+
type: 'schemaName';
|
|
90
|
+
pattern: string | RegExp;
|
|
91
|
+
};
|
|
92
|
+
type ByContentType = {
|
|
93
|
+
type: 'contentType';
|
|
94
|
+
pattern: string | RegExp;
|
|
95
|
+
};
|
|
96
|
+
type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
97
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
98
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
99
|
+
options: Partial<TOptions>;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
103
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
104
|
+
fabric: Fabric;
|
|
105
|
+
oas: Oas;
|
|
106
|
+
exclude: Array<Exclude> | undefined;
|
|
107
|
+
include: Array<Include> | undefined;
|
|
108
|
+
override: Array<Override<TOptions>> | undefined;
|
|
109
|
+
contentType: contentType | undefined;
|
|
110
|
+
pluginManager: PluginManager;
|
|
111
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
112
|
+
/**
|
|
113
|
+
* Current plugin
|
|
114
|
+
*/
|
|
115
|
+
plugin: Plugin<TPluginOptions>;
|
|
116
|
+
mode: KubbFile.Mode;
|
|
117
|
+
UNSTABLE_NAMING?: true;
|
|
118
|
+
};
|
|
119
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
120
|
+
#private;
|
|
121
|
+
getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
|
|
122
|
+
getSchemas(operation: Operation, {
|
|
123
|
+
resolveName
|
|
124
|
+
}?: {
|
|
125
|
+
resolveName?: (name: string) => string;
|
|
126
|
+
}): OperationSchemas;
|
|
127
|
+
getOperations(): Promise<Array<{
|
|
128
|
+
path: string;
|
|
129
|
+
method: HttpMethod;
|
|
130
|
+
operation: Operation;
|
|
131
|
+
}>>;
|
|
132
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
136
|
+
type SchemaKeywordMapper = {
|
|
137
|
+
object: {
|
|
138
|
+
keyword: 'object';
|
|
139
|
+
args: {
|
|
140
|
+
properties: {
|
|
141
|
+
[x: string]: Schema[];
|
|
142
|
+
};
|
|
143
|
+
additionalProperties: Schema[];
|
|
144
|
+
patternProperties?: Record<string, Schema[]>;
|
|
145
|
+
strict?: boolean;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
url: {
|
|
149
|
+
keyword: 'url';
|
|
150
|
+
};
|
|
151
|
+
readOnly: {
|
|
152
|
+
keyword: 'readOnly';
|
|
153
|
+
};
|
|
154
|
+
writeOnly: {
|
|
155
|
+
keyword: 'writeOnly';
|
|
156
|
+
};
|
|
157
|
+
uuid: {
|
|
158
|
+
keyword: 'uuid';
|
|
159
|
+
};
|
|
160
|
+
email: {
|
|
161
|
+
keyword: 'email';
|
|
162
|
+
};
|
|
163
|
+
firstName: {
|
|
164
|
+
keyword: 'firstName';
|
|
165
|
+
};
|
|
166
|
+
lastName: {
|
|
167
|
+
keyword: 'lastName';
|
|
168
|
+
};
|
|
169
|
+
phone: {
|
|
170
|
+
keyword: 'phone';
|
|
171
|
+
};
|
|
172
|
+
password: {
|
|
173
|
+
keyword: 'password';
|
|
174
|
+
};
|
|
175
|
+
date: {
|
|
176
|
+
keyword: 'date';
|
|
177
|
+
args: {
|
|
178
|
+
type?: 'date' | 'string';
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
time: {
|
|
182
|
+
keyword: 'time';
|
|
183
|
+
args: {
|
|
184
|
+
type?: 'date' | 'string';
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
datetime: {
|
|
188
|
+
keyword: 'datetime';
|
|
189
|
+
args: {
|
|
190
|
+
offset?: boolean;
|
|
191
|
+
local?: boolean;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
tuple: {
|
|
195
|
+
keyword: 'tuple';
|
|
196
|
+
args: {
|
|
197
|
+
items: Schema[];
|
|
198
|
+
min?: number;
|
|
199
|
+
max?: number;
|
|
200
|
+
rest?: Schema;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
array: {
|
|
204
|
+
keyword: 'array';
|
|
205
|
+
args: {
|
|
206
|
+
items: Schema[];
|
|
207
|
+
min?: number;
|
|
208
|
+
max?: number;
|
|
209
|
+
unique?: boolean;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
enum: {
|
|
213
|
+
keyword: 'enum';
|
|
214
|
+
args: {
|
|
215
|
+
name: string;
|
|
216
|
+
typeName: string;
|
|
217
|
+
asConst: boolean;
|
|
218
|
+
items: Array<{
|
|
219
|
+
name: string | number;
|
|
220
|
+
format: 'string' | 'number' | 'boolean';
|
|
221
|
+
value?: string | number | boolean;
|
|
222
|
+
}>;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
and: {
|
|
226
|
+
keyword: 'and';
|
|
227
|
+
args: Schema[];
|
|
228
|
+
};
|
|
229
|
+
const: {
|
|
230
|
+
keyword: 'const';
|
|
231
|
+
args: {
|
|
232
|
+
name: string | number;
|
|
233
|
+
format: 'string' | 'number' | 'boolean';
|
|
234
|
+
value?: string | number | boolean;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
union: {
|
|
238
|
+
keyword: 'union';
|
|
239
|
+
args: Schema[];
|
|
240
|
+
};
|
|
241
|
+
ref: {
|
|
242
|
+
keyword: 'ref';
|
|
243
|
+
args: {
|
|
244
|
+
name: string;
|
|
245
|
+
$ref: string;
|
|
246
|
+
/**
|
|
247
|
+
* Full qualified path.
|
|
248
|
+
*/
|
|
249
|
+
path: KubbFile.Path;
|
|
250
|
+
/**
|
|
251
|
+
* When true `File.Import` is used.
|
|
252
|
+
* When false a reference is used inside the current file.
|
|
253
|
+
*/
|
|
254
|
+
isImportable: boolean;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
matches: {
|
|
258
|
+
keyword: 'matches';
|
|
259
|
+
args?: string;
|
|
260
|
+
};
|
|
261
|
+
boolean: {
|
|
262
|
+
keyword: 'boolean';
|
|
263
|
+
};
|
|
264
|
+
default: {
|
|
265
|
+
keyword: 'default';
|
|
266
|
+
args: string | number | boolean;
|
|
267
|
+
};
|
|
268
|
+
string: {
|
|
269
|
+
keyword: 'string';
|
|
270
|
+
};
|
|
271
|
+
integer: {
|
|
272
|
+
keyword: 'integer';
|
|
273
|
+
};
|
|
274
|
+
number: {
|
|
275
|
+
keyword: 'number';
|
|
276
|
+
};
|
|
277
|
+
max: {
|
|
278
|
+
keyword: 'max';
|
|
279
|
+
args: number;
|
|
280
|
+
};
|
|
281
|
+
min: {
|
|
282
|
+
keyword: 'min';
|
|
283
|
+
args: number;
|
|
284
|
+
};
|
|
285
|
+
exclusiveMaximum: {
|
|
286
|
+
keyword: 'exclusiveMaximum';
|
|
287
|
+
args: number;
|
|
288
|
+
};
|
|
289
|
+
exclusiveMinimum: {
|
|
290
|
+
keyword: 'exclusiveMinimum';
|
|
291
|
+
args: number;
|
|
292
|
+
};
|
|
293
|
+
describe: {
|
|
294
|
+
keyword: 'describe';
|
|
295
|
+
args: string;
|
|
296
|
+
};
|
|
297
|
+
example: {
|
|
298
|
+
keyword: 'example';
|
|
299
|
+
args: string;
|
|
300
|
+
};
|
|
301
|
+
deprecated: {
|
|
302
|
+
keyword: 'deprecated';
|
|
303
|
+
};
|
|
304
|
+
optional: {
|
|
305
|
+
keyword: 'optional';
|
|
306
|
+
};
|
|
307
|
+
undefined: {
|
|
308
|
+
keyword: 'undefined';
|
|
309
|
+
};
|
|
310
|
+
nullish: {
|
|
311
|
+
keyword: 'nullish';
|
|
312
|
+
};
|
|
313
|
+
nullable: {
|
|
314
|
+
keyword: 'nullable';
|
|
315
|
+
};
|
|
316
|
+
null: {
|
|
317
|
+
keyword: 'null';
|
|
318
|
+
};
|
|
319
|
+
any: {
|
|
320
|
+
keyword: 'any';
|
|
321
|
+
};
|
|
322
|
+
unknown: {
|
|
323
|
+
keyword: 'unknown';
|
|
324
|
+
};
|
|
325
|
+
void: {
|
|
326
|
+
keyword: 'void';
|
|
327
|
+
};
|
|
328
|
+
blob: {
|
|
329
|
+
keyword: 'blob';
|
|
330
|
+
};
|
|
331
|
+
schema: {
|
|
332
|
+
keyword: 'schema';
|
|
333
|
+
args: {
|
|
334
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
335
|
+
format?: string;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
name: {
|
|
339
|
+
keyword: 'name';
|
|
340
|
+
args: string;
|
|
341
|
+
};
|
|
342
|
+
catchall: {
|
|
343
|
+
keyword: 'catchall';
|
|
344
|
+
};
|
|
345
|
+
interface: {
|
|
346
|
+
keyword: 'interface';
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
type Schema = {
|
|
350
|
+
keyword: string;
|
|
351
|
+
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
354
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
355
|
+
fabric: Fabric;
|
|
356
|
+
oas: Oas;
|
|
357
|
+
pluginManager: PluginManager;
|
|
358
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
359
|
+
/**
|
|
360
|
+
* Current plugin
|
|
361
|
+
*/
|
|
362
|
+
plugin: Plugin<TPluginOptions>;
|
|
363
|
+
mode: KubbFile.Mode;
|
|
364
|
+
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
365
|
+
override: Array<Override<TOptions>> | undefined;
|
|
366
|
+
contentType?: contentType;
|
|
367
|
+
output?: string;
|
|
368
|
+
};
|
|
369
|
+
type SchemaGeneratorOptions = {
|
|
370
|
+
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
371
|
+
unknownType: 'any' | 'unknown' | 'void';
|
|
372
|
+
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
373
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
374
|
+
enumSuffix?: string;
|
|
375
|
+
/**
|
|
376
|
+
* @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
|
|
377
|
+
* When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
usedEnumNames?: Record<string, number>;
|
|
381
|
+
mapper?: Record<string, string>;
|
|
382
|
+
typed?: boolean;
|
|
383
|
+
transformers: {
|
|
384
|
+
/**
|
|
385
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
386
|
+
*/
|
|
387
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
388
|
+
/**
|
|
389
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
390
|
+
* TODO TODO add docs
|
|
391
|
+
* @beta
|
|
392
|
+
*/
|
|
393
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
type SchemaProps$1 = {
|
|
397
|
+
schema: SchemaObject | null;
|
|
398
|
+
name: string | null;
|
|
399
|
+
parentName: string | null;
|
|
400
|
+
rootName?: string | null;
|
|
401
|
+
};
|
|
402
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
403
|
+
#private;
|
|
404
|
+
refs: Refs;
|
|
405
|
+
/**
|
|
406
|
+
* Creates a type node from a given schema.
|
|
407
|
+
* Delegates to getBaseTypeFromSchema internally and
|
|
408
|
+
* optionally adds a union with null.
|
|
409
|
+
*/
|
|
410
|
+
parse(props: SchemaProps$1): Schema[];
|
|
411
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
412
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
413
|
+
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
414
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
418
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
419
|
+
name: string;
|
|
420
|
+
type: 'core';
|
|
421
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
422
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
423
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
424
|
+
};
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
427
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
428
|
+
config: Config;
|
|
429
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
430
|
+
plugin: Plugin<TOptions>;
|
|
431
|
+
operations: Array<Operation>;
|
|
432
|
+
};
|
|
433
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
434
|
+
config: Config;
|
|
435
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
436
|
+
plugin: Plugin<TOptions>;
|
|
437
|
+
operation: Operation;
|
|
438
|
+
};
|
|
439
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
440
|
+
config: Config;
|
|
441
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
442
|
+
plugin: Plugin<TOptions>;
|
|
443
|
+
schema: {
|
|
444
|
+
name: string;
|
|
445
|
+
tree: Array<Schema>;
|
|
446
|
+
value: SchemaObject;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
452
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
453
|
+
name: string;
|
|
454
|
+
type: 'react';
|
|
455
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
456
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
457
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
458
|
+
};
|
|
459
|
+
//#endregion
|
|
4
460
|
//#region src/generators/customHookOptionsFileGenerator.d.ts
|
|
5
461
|
declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
|
|
6
462
|
//#endregion
|
package/dist/generators.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-
|
|
1
|
+
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-DTkvanZK.js";
|
|
2
2
|
|
|
3
3
|
export { customHookOptionsFileGenerator, hookOptionsGenerator, infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_components = require('./components-B6Ze18_y.cjs');
|
|
2
|
-
const require_generators = require('./generators-
|
|
2
|
+
const require_generators = require('./generators-DtDEbt56.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_components.__toESM(node_path);
|
|
5
5
|
let _kubb_core = require("@kubb/core");
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as Options, r as PluginReactQuery } from "./types-
|
|
2
|
+
import { n as Options, r as PluginReactQuery } from "./types-DoN-nl4J.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import { d as QueryKey, s as MutationKey } from "./components-Bz8jAFux.js";
|
|
3
|
-
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-
|
|
3
|
+
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-DTkvanZK.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
6
6
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
|
|
2
|
+
import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
3
|
+
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
4
|
+
import { PluginClient } from "@kubb/plugin-client";
|
|
5
|
+
import { Generator } from "@kubb/plugin-oas/generators";
|
|
6
|
+
|
|
7
|
+
//#region rolldown:runtime
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/types.d.ts
|
|
10
|
+
type TransformerProps = {
|
|
11
|
+
operation: Operation;
|
|
12
|
+
schemas: OperationSchemas;
|
|
13
|
+
casing: 'camelcase' | undefined;
|
|
14
|
+
};
|
|
15
|
+
type Transformer = (props: TransformerProps) => unknown[];
|
|
16
|
+
type Suspense = object;
|
|
17
|
+
/**
|
|
18
|
+
* Customize the queryKey
|
|
19
|
+
*/
|
|
20
|
+
type QueryKey = Transformer;
|
|
21
|
+
/**
|
|
22
|
+
* Customize the mutationKey
|
|
23
|
+
*/
|
|
24
|
+
type MutationKey = Transformer;
|
|
25
|
+
type Query = {
|
|
26
|
+
/**
|
|
27
|
+
* Define which HttpMethods can be used for queries
|
|
28
|
+
* @default ['get']
|
|
29
|
+
*/
|
|
30
|
+
methods: Array<HttpMethod>;
|
|
31
|
+
/**
|
|
32
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
33
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
34
|
+
* Accepts relative and absolute paths.
|
|
35
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
36
|
+
* @default '@tanstack/react-query'
|
|
37
|
+
*/
|
|
38
|
+
importPath?: string;
|
|
39
|
+
};
|
|
40
|
+
type Mutation = {
|
|
41
|
+
/**
|
|
42
|
+
* Define which HttpMethods can be used for mutations
|
|
43
|
+
* @default ['post', 'put', 'delete']
|
|
44
|
+
*/
|
|
45
|
+
methods: Array<HttpMethod>;
|
|
46
|
+
/**
|
|
47
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
48
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
49
|
+
* Accepts relative and absolute paths.
|
|
50
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
51
|
+
* @default '@tanstack/react-query'
|
|
52
|
+
*/
|
|
53
|
+
importPath?: string;
|
|
54
|
+
};
|
|
55
|
+
type Infinite = {
|
|
56
|
+
/**
|
|
57
|
+
* Specify the params key used for `pageParam`.
|
|
58
|
+
* @default 'id'
|
|
59
|
+
*/
|
|
60
|
+
queryParam: string;
|
|
61
|
+
/**
|
|
62
|
+
* Which field of the data is used, set it to undefined when no cursor is known.
|
|
63
|
+
* @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
|
|
64
|
+
*/
|
|
65
|
+
cursorParam?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Which field of the data is used to get the cursor for the next page.
|
|
68
|
+
* Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
|
|
69
|
+
*/
|
|
70
|
+
nextParam?: string | string[] | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Which field of the data is used to get the cursor for the previous page.
|
|
73
|
+
* Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
|
|
74
|
+
*/
|
|
75
|
+
previousParam?: string | string[] | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* The initial value, the value of the first page.
|
|
78
|
+
* @default 0
|
|
79
|
+
*/
|
|
80
|
+
initialPageParam: unknown;
|
|
81
|
+
};
|
|
82
|
+
type CustomOptions = {
|
|
83
|
+
/**
|
|
84
|
+
* Path to the hook that is used to customize the hook options.
|
|
85
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
86
|
+
* It allows both relative and absolute paths but be aware that we will not change the path.
|
|
87
|
+
*/
|
|
88
|
+
importPath: string;
|
|
89
|
+
/**
|
|
90
|
+
* Name of the exported hook that is used to customize the hook options.
|
|
91
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
92
|
+
* @default 'useCustomHookOptions'
|
|
93
|
+
*/
|
|
94
|
+
name?: string;
|
|
95
|
+
};
|
|
96
|
+
type Options = {
|
|
97
|
+
/**
|
|
98
|
+
* Specify the export location for the files and define the behavior of the output
|
|
99
|
+
* @default { path: 'hooks', barrelType: 'named' }
|
|
100
|
+
*/
|
|
101
|
+
output?: Output<Oas>;
|
|
102
|
+
/**
|
|
103
|
+
* Define which contentType should be used.
|
|
104
|
+
* By default, the first JSON valid mediaType is used
|
|
105
|
+
*/
|
|
106
|
+
contentType?: contentType;
|
|
107
|
+
/**
|
|
108
|
+
* Group the @tanstack/query hooks based on the provided name.
|
|
109
|
+
*/
|
|
110
|
+
group?: Group;
|
|
111
|
+
client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
112
|
+
/**
|
|
113
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
114
|
+
*/
|
|
115
|
+
exclude?: Array<Exclude>;
|
|
116
|
+
/**
|
|
117
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
118
|
+
*/
|
|
119
|
+
include?: Array<Include>;
|
|
120
|
+
/**
|
|
121
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
122
|
+
*/
|
|
123
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
124
|
+
/**
|
|
125
|
+
* How to style your params, by default no casing is applied
|
|
126
|
+
* - 'camelcase' uses camelcase for the params names
|
|
127
|
+
*/
|
|
128
|
+
paramsCasing?: 'camelcase';
|
|
129
|
+
/**
|
|
130
|
+
* How to pass your params.
|
|
131
|
+
* - 'object' returns the params and pathParams as an object.
|
|
132
|
+
* - 'inline' returns the params as comma separated params.
|
|
133
|
+
* @default 'inline'
|
|
134
|
+
*/
|
|
135
|
+
paramsType?: 'object' | 'inline';
|
|
136
|
+
/**
|
|
137
|
+
* How to pass your pathParams.
|
|
138
|
+
* - 'object' returns the pathParams as an object.
|
|
139
|
+
* - 'inline': returns the pathParams as comma separated params.
|
|
140
|
+
* @default 'inline'
|
|
141
|
+
*/
|
|
142
|
+
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
143
|
+
/**
|
|
144
|
+
* When set, an infiniteQuery hooks is added.
|
|
145
|
+
*/
|
|
146
|
+
infinite?: Partial<Infinite> | false;
|
|
147
|
+
/**
|
|
148
|
+
* When set, a suspenseQuery hooks is added.
|
|
149
|
+
*/
|
|
150
|
+
suspense?: Partial<Suspense> | false;
|
|
151
|
+
queryKey?: QueryKey;
|
|
152
|
+
/**
|
|
153
|
+
* Override some useQuery behaviors.
|
|
154
|
+
*/
|
|
155
|
+
query?: Partial<Query> | false;
|
|
156
|
+
mutationKey?: MutationKey;
|
|
157
|
+
/**
|
|
158
|
+
* Override some useMutation behaviors.
|
|
159
|
+
*/
|
|
160
|
+
mutation?: Partial<Mutation> | false;
|
|
161
|
+
/**
|
|
162
|
+
* When set, a custom hook is used to customize the options of the generated hooks.
|
|
163
|
+
* It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
|
|
164
|
+
*/
|
|
165
|
+
customOptions?: CustomOptions;
|
|
166
|
+
/**
|
|
167
|
+
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
168
|
+
* `'zod'` uses `@kubb/plugin-zod` to parse the data.
|
|
169
|
+
*/
|
|
170
|
+
parser?: PluginClient['options']['parser'];
|
|
171
|
+
transformers?: {
|
|
172
|
+
/**
|
|
173
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
174
|
+
*/
|
|
175
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Define some generators next to the react-query generators
|
|
179
|
+
*/
|
|
180
|
+
generators?: Array<Generator<PluginReactQuery>>;
|
|
181
|
+
};
|
|
182
|
+
type ResolvedOptions = {
|
|
183
|
+
output: Output<Oas>;
|
|
184
|
+
group: Options['group'];
|
|
185
|
+
client: NonNullable<PluginReactQuery['options']['client']>;
|
|
186
|
+
parser: Required<NonNullable<Options['parser']>>;
|
|
187
|
+
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
188
|
+
paramsCasing: Options['paramsCasing'];
|
|
189
|
+
paramsType: NonNullable<Options['paramsType']>;
|
|
190
|
+
/**
|
|
191
|
+
* Only used of infinite
|
|
192
|
+
*/
|
|
193
|
+
infinite: NonNullable<Infinite> | false;
|
|
194
|
+
suspense: Suspense | false;
|
|
195
|
+
queryKey: QueryKey | undefined;
|
|
196
|
+
query: NonNullable<Required<Query>> | false;
|
|
197
|
+
mutationKey: MutationKey | undefined;
|
|
198
|
+
mutation: NonNullable<Required<Mutation>> | false;
|
|
199
|
+
customOptions: NonNullable<Required<CustomOptions>> | undefined;
|
|
200
|
+
};
|
|
201
|
+
type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
202
|
+
//#endregion
|
|
203
|
+
export { __name as a, Transformer as i, Options as n, PluginReactQuery as r, Infinite as t };
|
|
204
|
+
//# sourceMappingURL=types-CgOcKVIt.d.cts.map
|