@tuyau/react-query 1.1.0 → 1.1.2
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/build/index.d.ts +5 -8
- package/build/index.js +3 -3
- package/package.json +12 -12
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SchemaEndpoint, ResponseOf, RawRequestArgs, ErrorOf, TuyauRegistry, InferTree, AdonisEndpoint, InferRoutes } from '@tuyau/core/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
-
import { SkipToken, DataTag, QueryFilters, UseMutationOptions, InfiniteData, UnusedSkipTokenInfiniteOptions, DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions, DefinedInitialDataOptions,
|
|
3
|
+
import { SkipToken, DataTag, QueryFilters, UseMutationOptions, InfiniteData, UnusedSkipTokenInfiniteOptions, DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, UnusedSkipTokenOptions, UndefinedInitialDataOptions } from '@tanstack/react-query';
|
|
4
4
|
import { TuyauQueryKey, WithRequired, DistributiveOmit, TuyauQueryBaseOptions, TuyauMutationKey, TuyauRequestOptions, DecorateRouterKeyable, CreateQueryFnOptions } from '@tuyau/query-core';
|
|
5
5
|
export { DecorateRouterKeyable, DistributiveOmit, QueryType, TuyauMutationKey, TuyauQueryBaseOptions, TuyauQueryKey, WithRequired } from '@tuyau/query-core';
|
|
6
6
|
import { Tuyau } from '@tuyau/core/client';
|
|
@@ -59,6 +59,7 @@ interface TuyauMutationOptionsOptions {
|
|
|
59
59
|
opts?: TuyauMutationOptionsIn<any, any, any, any>;
|
|
60
60
|
routeName: string;
|
|
61
61
|
client: Tuyau<any>;
|
|
62
|
+
globalOptions?: TuyauRequestOptions;
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Builds a TanStack React Query `mutationOptions` object from Tuyau route information.
|
|
@@ -223,11 +224,7 @@ type TuyauQueryOptionsOptions = CreateQueryFnOptions & {
|
|
|
223
224
|
*/
|
|
224
225
|
declare function tuyauQueryOptions(options: TuyauQueryOptionsOptions): _tanstack_react_query.UseQueryOptions<any, Error, any, readonly unknown[]> & {
|
|
225
226
|
initialData?: any;
|
|
226
|
-
} &
|
|
227
|
-
queryKey: readonly unknown[] & {
|
|
228
|
-
[dataTagSymbol]: any;
|
|
229
|
-
[dataTagErrorSymbol]: Error;
|
|
230
|
-
};
|
|
231
|
-
};
|
|
227
|
+
} & _tanstack_react_query.QueryKeyWithDataTag<readonly unknown[], any, Error>;
|
|
232
228
|
|
|
233
|
-
export {
|
|
229
|
+
export { createTuyauReactQueryClient, tuyauMutationOptions, tuyauQueryOptions };
|
|
230
|
+
export type { DecorateMutationFn, DefinedTuyauQueryOptionsIn, DefinedTuyauQueryOptionsOut, EndpointNode, TransformToReactQuery, TuyauMutationOptionsIn, TuyauMutationOptionsOptions, TuyauMutationOptionsOut, TuyauQueryOptionsOptions, TuyauReactMutationOptions, TuyauReactQuery, TuyauReactRequestOptions, UndefinedTuyauQueryOptionsIn, UndefinedTuyauQueryOptionsOut, UnusedSkipTokenTuyauQueryOptionsIn, UnusedSkipTokenTuyauQueryOptionsOut };
|
package/build/index.js
CHANGED
|
@@ -30,9 +30,9 @@ function tuyauInfiniteQueryOptions(options) {
|
|
|
30
30
|
import { mutationOptions } from "@tanstack/react-query";
|
|
31
31
|
import { getMutationKeyInternal, createMutationFn } from "@tuyau/query-core";
|
|
32
32
|
function tuyauMutationOptions(options) {
|
|
33
|
-
const { opts, routeName, client } = options;
|
|
33
|
+
const { opts, routeName, client, globalOptions } = options;
|
|
34
34
|
const mutationKey = getMutationKeyInternal({ segments: routeName.split(".") });
|
|
35
|
-
const mutationFn = createMutationFn({ opts, routeName, client });
|
|
35
|
+
const mutationFn = createMutationFn({ opts, routeName, client, globalOptions });
|
|
36
36
|
return mutationOptions({ ...opts, mutationKey, mutationFn });
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -81,7 +81,7 @@ function createTuyauReactQueryClient(options) {
|
|
|
81
81
|
/**
|
|
82
82
|
* Mutations
|
|
83
83
|
*/
|
|
84
|
-
mutationOptions: (opts) => tuyauMutationOptions({ opts, client, routeName }),
|
|
84
|
+
mutationOptions: (opts) => tuyauMutationOptions({ opts, client, routeName, globalOptions }),
|
|
85
85
|
mutationKey: () => getMutationKeyInternal2({ segments }),
|
|
86
86
|
/**
|
|
87
87
|
* Paths
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuyau/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "Tanstack Query integration for Tuyau",
|
|
6
6
|
"author": "Julien Ripouteau <julien@ripouteau.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,23 +33,23 @@
|
|
|
33
33
|
"node": ">=24.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tuyau/query-core": "1.1.
|
|
36
|
+
"@tuyau/query-core": "1.1.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@tanstack/react-query": "^5.74.7",
|
|
40
40
|
"@tuyau/core": "^1.0.0-beta.9"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@adonisjs/core": "^7.0
|
|
44
|
-
"@faker-js/faker": "^10.
|
|
45
|
-
"@happy-dom/global-registrator": "^
|
|
46
|
-
"@tanstack/react-query": "^5.
|
|
47
|
-
"@testing-library/react": "^16.3.
|
|
48
|
-
"@types/react": "^19.
|
|
49
|
-
"@vinejs/vine": "^4.
|
|
50
|
-
"nock": "^
|
|
51
|
-
"react": "^19.
|
|
52
|
-
"@tuyau/core": "1.
|
|
43
|
+
"@adonisjs/core": "^7.6.0",
|
|
44
|
+
"@faker-js/faker": "^10.6.0",
|
|
45
|
+
"@happy-dom/global-registrator": "^21.0.1",
|
|
46
|
+
"@tanstack/react-query": "^5.104.3",
|
|
47
|
+
"@testing-library/react": "^16.3.3",
|
|
48
|
+
"@types/react": "^19.3.0",
|
|
49
|
+
"@vinejs/vine": "^4.4.0",
|
|
50
|
+
"nock": "^15.0.1",
|
|
51
|
+
"react": "^19.3.1",
|
|
52
|
+
"@tuyau/core": "1.3.0"
|
|
53
53
|
},
|
|
54
54
|
"tsup": {
|
|
55
55
|
"entry": [
|