@kubb/plugin-react-query 4.19.1 → 4.20.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-B6Ze18_y.cjs.map +1 -1
- package/dist/components-Bz8jAFux.js.map +1 -1
- package/dist/components.d.cts +13 -13
- package/dist/components.d.ts +13 -13
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-B1zUGWD5.d.ts → types-CZphjgBO.d.ts} +5 -5
- package/dist/{types--JdHlnpa.d.cts → types-DGrhh8JD.d.cts} +5 -5
- package/package.json +9 -9
- package/src/components/InfiniteQuery.tsx +2 -2
- package/src/components/InfiniteQueryOptions.tsx +2 -2
- package/src/components/Mutation.tsx +2 -2
- package/src/components/MutationKey.tsx +2 -2
- package/src/components/MutationOptions.tsx +11 -2
- package/src/components/Query.tsx +2 -2
- package/src/components/QueryKey.tsx +2 -2
- package/src/components/QueryOptions.tsx +11 -2
- package/src/components/SuspenseInfiniteQuery.tsx +2 -2
- package/src/components/SuspenseInfiniteQueryOptions.tsx +2 -2
- package/src/components/SuspenseQuery.tsx +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-
|
|
2
|
+
import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-CZphjgBO.js";
|
|
3
3
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
4
|
-
import {
|
|
4
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
6
|
//#region src/components/InfiniteQuery.d.ts
|
|
7
7
|
type Props$10 = {
|
|
@@ -43,7 +43,7 @@ declare function InfiniteQuery({
|
|
|
43
43
|
initialPageParam,
|
|
44
44
|
queryParam,
|
|
45
45
|
customOptions
|
|
46
|
-
}: Props$10):
|
|
46
|
+
}: Props$10): FabricReactNode;
|
|
47
47
|
declare namespace InfiniteQuery {
|
|
48
48
|
var getParams: ({
|
|
49
49
|
paramsType,
|
|
@@ -90,7 +90,7 @@ declare function InfiniteQueryOptions({
|
|
|
90
90
|
pathParamsType,
|
|
91
91
|
queryParam,
|
|
92
92
|
queryKeyName
|
|
93
|
-
}: Props$9):
|
|
93
|
+
}: Props$9): FabricReactNode;
|
|
94
94
|
declare namespace InfiniteQueryOptions {
|
|
95
95
|
var getParams: ({
|
|
96
96
|
paramsType,
|
|
@@ -126,7 +126,7 @@ declare function Mutation({
|
|
|
126
126
|
operation,
|
|
127
127
|
mutationKeyName,
|
|
128
128
|
customOptions
|
|
129
|
-
}: Props$8):
|
|
129
|
+
}: Props$8): FabricReactNode;
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/components/MutationKey.d.ts
|
|
132
132
|
type Props$7 = {
|
|
@@ -150,7 +150,7 @@ declare function MutationKey({
|
|
|
150
150
|
operation,
|
|
151
151
|
typeName,
|
|
152
152
|
transformer
|
|
153
|
-
}: Props$7):
|
|
153
|
+
}: Props$7): FabricReactNode;
|
|
154
154
|
declare namespace MutationKey {
|
|
155
155
|
var getParams: ({}: GetParamsProps$7) => FunctionParams;
|
|
156
156
|
var getTransformer: Transformer;
|
|
@@ -179,7 +179,7 @@ declare function MutationOptions({
|
|
|
179
179
|
paramsType,
|
|
180
180
|
pathParamsType,
|
|
181
181
|
mutationKeyName
|
|
182
|
-
}: Props$6):
|
|
182
|
+
}: Props$6): FabricReactNode;
|
|
183
183
|
declare namespace MutationOptions {
|
|
184
184
|
var getParams: ({
|
|
185
185
|
typeSchemas
|
|
@@ -222,7 +222,7 @@ declare function Query({
|
|
|
222
222
|
typeSchemas,
|
|
223
223
|
operation,
|
|
224
224
|
customOptions
|
|
225
|
-
}: Props$5):
|
|
225
|
+
}: Props$5): FabricReactNode;
|
|
226
226
|
declare namespace Query {
|
|
227
227
|
var getParams: ({
|
|
228
228
|
paramsType,
|
|
@@ -256,7 +256,7 @@ declare function QueryKey({
|
|
|
256
256
|
operation,
|
|
257
257
|
typeName,
|
|
258
258
|
transformer
|
|
259
|
-
}: Props$4):
|
|
259
|
+
}: Props$4): FabricReactNode;
|
|
260
260
|
declare namespace QueryKey {
|
|
261
261
|
var getParams: ({
|
|
262
262
|
pathParamsType,
|
|
@@ -292,7 +292,7 @@ declare function QueryOptions({
|
|
|
292
292
|
paramsType,
|
|
293
293
|
pathParamsType,
|
|
294
294
|
queryKeyName
|
|
295
|
-
}: Props$3):
|
|
295
|
+
}: Props$3): FabricReactNode;
|
|
296
296
|
declare namespace QueryOptions {
|
|
297
297
|
var getParams: ({
|
|
298
298
|
paramsType,
|
|
@@ -342,7 +342,7 @@ declare function SuspenseInfiniteQuery({
|
|
|
342
342
|
customOptions,
|
|
343
343
|
initialPageParam,
|
|
344
344
|
queryParam
|
|
345
|
-
}: Props$2):
|
|
345
|
+
}: Props$2): FabricReactNode;
|
|
346
346
|
declare namespace SuspenseInfiniteQuery {
|
|
347
347
|
var getParams: ({
|
|
348
348
|
paramsType,
|
|
@@ -389,7 +389,7 @@ declare function SuspenseInfiniteQueryOptions({
|
|
|
389
389
|
pathParamsType,
|
|
390
390
|
queryParam,
|
|
391
391
|
queryKeyName
|
|
392
|
-
}: Props$1):
|
|
392
|
+
}: Props$1): FabricReactNode;
|
|
393
393
|
declare namespace SuspenseInfiniteQueryOptions {
|
|
394
394
|
var getParams: ({
|
|
395
395
|
paramsType,
|
|
@@ -442,7 +442,7 @@ declare function SuspenseQuery({
|
|
|
442
442
|
typeSchemas,
|
|
443
443
|
operation,
|
|
444
444
|
customOptions
|
|
445
|
-
}: Props):
|
|
445
|
+
}: Props): FabricReactNode;
|
|
446
446
|
declare namespace SuspenseQuery {
|
|
447
447
|
var getParams: ({
|
|
448
448
|
paramsType,
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ReactGenerator, l as __name, r as PluginReactQuery } from "./types
|
|
1
|
+
import { a as ReactGenerator, l as __name, r as PluginReactQuery } from "./types-DGrhh8JD.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/customHookOptionsFileGenerator.d.ts
|
|
4
4
|
declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { a as ReactGenerator, r as PluginReactQuery } from "./types-
|
|
2
|
+
import { a as ReactGenerator, r as PluginReactQuery } from "./types-CZphjgBO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/customHookOptionsFileGenerator.d.ts
|
|
5
5
|
declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as __name, n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types
|
|
1
|
+
import { l as __name, n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-DGrhh8JD.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginReactQueryName = "plugin-react-query";
|
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, s as UserPluginWithLifeCycle } from "./types-
|
|
2
|
+
import { n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-CZphjgBO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginReactQueryName = "plugin-react-query";
|
|
@@ -5,7 +5,7 @@ import BaseOas from "oas";
|
|
|
5
5
|
import { Operation } from "oas/operation";
|
|
6
6
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
7
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import {
|
|
8
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
9
9
|
|
|
10
10
|
//#region ../oas/src/types.d.ts
|
|
11
11
|
type contentType = 'application/json' | (string & {});
|
|
@@ -1164,9 +1164,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1164
1164
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1165
1165
|
name: string;
|
|
1166
1166
|
type: 'react';
|
|
1167
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1168
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1169
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1167
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1168
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1169
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1170
1170
|
};
|
|
1171
1171
|
//#endregion
|
|
1172
1172
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1532,4 +1532,4 @@ type ResolvedOptions = {
|
|
|
1532
1532
|
type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1533
1533
|
//#endregion
|
|
1534
1534
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, Options as n, OperationSchemas as o, PluginReactQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1535
|
-
//# sourceMappingURL=types-
|
|
1535
|
+
//# sourceMappingURL=types-CZphjgBO.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { Operation } from "oas/operation";
|
|
|
4
4
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
5
5
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
6
6
|
import { Fabric } from "@kubb/react-fabric";
|
|
7
|
-
import {
|
|
7
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
8
8
|
|
|
9
9
|
//#region rolldown:runtime
|
|
10
10
|
//#endregion
|
|
@@ -1165,9 +1165,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1165
1165
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1166
1166
|
name: string;
|
|
1167
1167
|
type: 'react';
|
|
1168
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1169
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1170
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1168
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1169
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1170
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1171
1171
|
};
|
|
1172
1172
|
//#endregion
|
|
1173
1173
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1533,4 +1533,4 @@ type ResolvedOptions = {
|
|
|
1533
1533
|
type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1534
1534
|
//#endregion
|
|
1535
1535
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, __name as l, Options as n, OperationSchemas as o, PluginReactQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1536
|
-
//# sourceMappingURL=types
|
|
1536
|
+
//# sourceMappingURL=types-DGrhh8JD.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.0",
|
|
4
4
|
"description": "React Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for React applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-query",
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@kubb/react-fabric": "0.12.
|
|
70
|
+
"@kubb/react-fabric": "0.12.7",
|
|
71
71
|
"remeda": "^2.33.4",
|
|
72
|
-
"@kubb/core": "4.
|
|
73
|
-
"@kubb/oas": "4.
|
|
74
|
-
"@kubb/plugin-client": "4.
|
|
75
|
-
"@kubb/plugin-oas": "4.
|
|
76
|
-
"@kubb/plugin-ts": "4.
|
|
77
|
-
"@kubb/plugin-zod": "4.
|
|
72
|
+
"@kubb/core": "4.20.0",
|
|
73
|
+
"@kubb/oas": "4.20.0",
|
|
74
|
+
"@kubb/plugin-client": "4.20.0",
|
|
75
|
+
"@kubb/plugin-oas": "4.20.0",
|
|
76
|
+
"@kubb/plugin-ts": "4.20.0",
|
|
77
|
+
"@kubb/plugin-zod": "4.20.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@kubb/react-fabric": "0.12.
|
|
80
|
+
"@kubb/react-fabric": "0.12.7"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=20"
|
|
@@ -2,7 +2,7 @@ import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
|
2
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
7
7
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
8
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -136,7 +136,7 @@ export function InfiniteQuery({
|
|
|
136
136
|
initialPageParam,
|
|
137
137
|
queryParam,
|
|
138
138
|
customOptions,
|
|
139
|
-
}: Props):
|
|
139
|
+
}: Props): FabricReactNode {
|
|
140
140
|
const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
141
141
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
142
142
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -4,7 +4,7 @@ import { Client } from '@kubb/plugin-client/components'
|
|
|
4
4
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
5
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
6
6
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
7
|
-
import type {
|
|
7
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
8
8
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
9
9
|
import { QueryKey } from './QueryKey.tsx'
|
|
10
10
|
|
|
@@ -127,7 +127,7 @@ export function InfiniteQueryOptions({
|
|
|
127
127
|
pathParamsType,
|
|
128
128
|
queryParam,
|
|
129
129
|
queryKeyName,
|
|
130
|
-
}: Props):
|
|
130
|
+
}: Props): FabricReactNode {
|
|
131
131
|
const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
132
132
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
133
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -2,7 +2,7 @@ import { isOptional, type Operation } from '@kubb/oas'
|
|
|
2
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
7
|
import { MutationKey } from './MutationKey.tsx'
|
|
8
8
|
import { MutationOptions } from './MutationOptions.tsx'
|
|
@@ -82,7 +82,7 @@ export function Mutation({
|
|
|
82
82
|
operation,
|
|
83
83
|
mutationKeyName,
|
|
84
84
|
customOptions,
|
|
85
|
-
}: Props):
|
|
85
|
+
}: Props): FabricReactNode {
|
|
86
86
|
const mutationKeyParams = MutationKey.getParams({
|
|
87
87
|
pathParamsType,
|
|
88
88
|
typeSchemas,
|
|
@@ -2,7 +2,7 @@ import { URLPath } from '@kubb/core/utils'
|
|
|
2
2
|
import type { Operation } from '@kubb/oas'
|
|
3
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
4
|
import { File, Function, FunctionParams, Type } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { PluginReactQuery, Transformer } from '../types'
|
|
7
7
|
|
|
8
8
|
type Props = {
|
|
@@ -30,7 +30,7 @@ const getTransformer: Transformer = ({ operation, casing }) => {
|
|
|
30
30
|
return [`{ url: '${path.toURLPath()}' }`]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props):
|
|
33
|
+
export function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props): FabricReactNode {
|
|
34
34
|
const params = getParams({ pathParamsType, typeSchemas })
|
|
35
35
|
const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })
|
|
36
36
|
|
|
@@ -3,7 +3,7 @@ import { Client } from '@kubb/plugin-client/components'
|
|
|
3
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
4
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
5
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
6
|
-
import type {
|
|
6
|
+
import type { FabricReactNode, Params } from '@kubb/react-fabric/types'
|
|
7
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
8
8
|
import { MutationKey } from './MutationKey.tsx'
|
|
9
9
|
|
|
@@ -33,7 +33,16 @@ function getParams({ typeSchemas }: GetParamsProps) {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function MutationOptions({
|
|
36
|
+
export function MutationOptions({
|
|
37
|
+
name,
|
|
38
|
+
clientName,
|
|
39
|
+
dataReturnType,
|
|
40
|
+
typeSchemas,
|
|
41
|
+
paramsCasing,
|
|
42
|
+
paramsType,
|
|
43
|
+
pathParamsType,
|
|
44
|
+
mutationKeyName,
|
|
45
|
+
}: Props): FabricReactNode {
|
|
37
46
|
const params = getParams({ typeSchemas })
|
|
38
47
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
39
48
|
const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'
|
package/src/components/Query.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
|
2
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
7
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
8
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -132,7 +132,7 @@ export function Query({
|
|
|
132
132
|
typeSchemas,
|
|
133
133
|
operation,
|
|
134
134
|
customOptions,
|
|
135
|
-
}: Props):
|
|
135
|
+
}: Props): FabricReactNode {
|
|
136
136
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
137
137
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
138
138
|
const returnType = `UseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
@@ -3,7 +3,7 @@ import { getDefaultValue, type Operation } from '@kubb/oas'
|
|
|
3
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
4
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
5
|
import { File, Function, FunctionParams, Type } from '@kubb/react-fabric'
|
|
6
|
-
import type {
|
|
6
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
7
7
|
import type { PluginReactQuery, Transformer } from '../types'
|
|
8
8
|
|
|
9
9
|
type Props = {
|
|
@@ -59,7 +59,7 @@ const getTransformer: Transformer = ({ operation, schemas, casing }) => {
|
|
|
59
59
|
return keys
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props):
|
|
62
|
+
export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): FabricReactNode {
|
|
63
63
|
const params = getParams({ pathParamsType, typeSchemas, paramsCasing })
|
|
64
64
|
const keys = transformer({
|
|
65
65
|
operation,
|
|
@@ -3,7 +3,7 @@ import { Client } from '@kubb/plugin-client/components'
|
|
|
3
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
4
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
5
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
6
|
-
import type {
|
|
6
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
7
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
8
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
9
9
|
|
|
@@ -107,7 +107,16 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge
|
|
|
107
107
|
})
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
export function QueryOptions({
|
|
110
|
+
export function QueryOptions({
|
|
111
|
+
name,
|
|
112
|
+
clientName,
|
|
113
|
+
dataReturnType,
|
|
114
|
+
typeSchemas,
|
|
115
|
+
paramsCasing,
|
|
116
|
+
paramsType,
|
|
117
|
+
pathParamsType,
|
|
118
|
+
queryKeyName,
|
|
119
|
+
}: Props): FabricReactNode {
|
|
111
120
|
const params = getParams({
|
|
112
121
|
paramsType,
|
|
113
122
|
paramsCasing,
|
|
@@ -2,7 +2,7 @@ import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
|
2
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
7
7
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
8
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -136,7 +136,7 @@ export function SuspenseInfiniteQuery({
|
|
|
136
136
|
customOptions,
|
|
137
137
|
initialPageParam,
|
|
138
138
|
queryParam,
|
|
139
|
-
}: Props):
|
|
139
|
+
}: Props): FabricReactNode {
|
|
140
140
|
const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
141
141
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
142
142
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -4,7 +4,7 @@ import { Client } from '@kubb/plugin-client/components'
|
|
|
4
4
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
5
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
6
6
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
7
|
-
import type {
|
|
7
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
8
8
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
9
9
|
import { QueryKey } from './QueryKey.tsx'
|
|
10
10
|
|
|
@@ -127,7 +127,7 @@ export function SuspenseInfiniteQueryOptions({
|
|
|
127
127
|
pathParamsType,
|
|
128
128
|
queryParam,
|
|
129
129
|
queryKeyName,
|
|
130
|
-
}: Props):
|
|
130
|
+
}: Props): FabricReactNode {
|
|
131
131
|
const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
132
132
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
133
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -2,7 +2,7 @@ import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
|
2
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
7
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
8
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -142,7 +142,7 @@ export function SuspenseQuery({
|
|
|
142
142
|
typeSchemas,
|
|
143
143
|
operation,
|
|
144
144
|
customOptions,
|
|
145
|
-
}: Props):
|
|
145
|
+
}: Props): FabricReactNode {
|
|
146
146
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
147
147
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
148
148
|
const returnType = `UseSuspenseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|