soda-tanstack-query 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -16
- package/dist/utils/createUseMutation.cjs +5 -5
- package/dist/utils/createUseMutation.d.ts +1 -1
- package/dist/utils/createUseQuery.cjs +5 -5
- package/dist/utils/createUseQuery.d.ts +2 -2
- package/package.json +4 -4
- package/src/utils/createUseMutation.ts +3 -1
- package/src/utils/createUseQuery.ts +9 -7
- package/tsconfig.json +3 -0
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
"@/utils/createUseMutation"
|
|
3
|
+
"@/utils/createUseMutation" (module) {
|
|
4
4
|
module.exports = require("./utils/createUseMutation.cjs");
|
|
5
5
|
},
|
|
6
|
-
"@/utils/createUseQuery"
|
|
6
|
+
"@/utils/createUseQuery" (module) {
|
|
7
7
|
module.exports = require("./utils/createUseQuery.cjs");
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -39,7 +39,7 @@ function __webpack_require__(moduleId) {
|
|
|
39
39
|
})();
|
|
40
40
|
(()=>{
|
|
41
41
|
__webpack_require__.r = (exports1)=>{
|
|
42
|
-
if (
|
|
42
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
43
43
|
value: 'Module'
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -50,20 +50,16 @@ function __webpack_require__(moduleId) {
|
|
|
50
50
|
var __webpack_exports__ = {};
|
|
51
51
|
(()=>{
|
|
52
52
|
__webpack_require__.r(__webpack_exports__);
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
for(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
for(var __WEBPACK_IMPORT_KEY__ in _utils_createUseQuery__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
62
|
-
return _utils_createUseQuery__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
63
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
64
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
53
|
+
var _utils_createUseMutation__rspack_import_0 = __webpack_require__("@/utils/createUseMutation");
|
|
54
|
+
var __rspack_reexport = {};
|
|
55
|
+
for(const __rspack_import_key in _utils_createUseMutation__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_utils_createUseMutation__rspack_import_0[__rspack_import_key];
|
|
56
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
57
|
+
var _utils_createUseQuery__rspack_import_1 = __webpack_require__("@/utils/createUseQuery");
|
|
58
|
+
var __rspack_reexport = {};
|
|
59
|
+
for(const __rspack_import_key in _utils_createUseQuery__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_utils_createUseQuery__rspack_import_1[__rspack_import_key];
|
|
60
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
65
61
|
})();
|
|
66
|
-
for(var
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
67
63
|
Object.defineProperty(exports, '__esModule', {
|
|
68
64
|
value: true
|
|
69
65
|
});
|
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
createUseMutation: ()=>createUseMutation,
|
|
28
|
+
withUseMutationDefaults: ()=>withUseMutationDefaults
|
|
29
29
|
});
|
|
30
30
|
const react_query_namespaceObject = require("@tanstack/react-query");
|
|
31
31
|
function createUseMutation(baseOptions, baseQueryClient) {
|
|
@@ -67,10 +67,10 @@ function withUseMutationDefaults(defaultOptions = {}) {
|
|
|
67
67
|
}
|
|
68
68
|
exports.createUseMutation = __webpack_exports__.createUseMutation;
|
|
69
69
|
exports.withUseMutationDefaults = __webpack_exports__.withUseMutationDefaults;
|
|
70
|
-
for(var
|
|
70
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
71
71
|
"createUseMutation",
|
|
72
72
|
"withUseMutationDefaults"
|
|
73
|
-
].indexOf(
|
|
73
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
74
74
|
Object.defineProperty(exports, '__esModule', {
|
|
75
75
|
value: true
|
|
76
76
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultError, QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
1
|
+
import { type DefaultError, type QueryClient, type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
|
|
2
2
|
type MutationFn = (param: any) => any;
|
|
3
3
|
export type CreateUseMutationOptions<TMutationFn extends MutationFn> = Omit<UseMutationOptions<Awaited<ReturnType<TMutationFn>>, unknown, Parameters<TMutationFn>[0], unknown>, "mutationFn"> & {
|
|
4
4
|
mutationFn: TMutationFn;
|
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
createUseQuery: ()=>createUseQuery,
|
|
28
|
+
setUseQuery: ()=>setUseQuery
|
|
29
29
|
});
|
|
30
30
|
const react_query_namespaceObject = require("@tanstack/react-query");
|
|
31
31
|
let __useQuery = react_query_namespaceObject.useQuery;
|
|
@@ -57,10 +57,10 @@ function createUseQuery(params, client) {
|
|
|
57
57
|
}
|
|
58
58
|
exports.createUseQuery = __webpack_exports__.createUseQuery;
|
|
59
59
|
exports.setUseQuery = __webpack_exports__.setUseQuery;
|
|
60
|
-
for(var
|
|
60
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
61
|
"createUseQuery",
|
|
62
62
|
"setUseQuery"
|
|
63
|
-
].indexOf(
|
|
63
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
64
64
|
Object.defineProperty(exports, '__esModule', {
|
|
65
65
|
value: true
|
|
66
66
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Assign, IsParamRequired, StrictPartial } from "soda-type";
|
|
1
|
+
import { type DefinedInitialDataOptions, type DefinedUseQueryResult, type QueryClient, type UndefinedInitialDataOptions, type UseQueryOptions, type UseQueryResult, useQuery as _useQuery } from "@tanstack/react-query";
|
|
2
|
+
import type { Assign, IsParamRequired, StrictPartial } from "soda-type";
|
|
3
3
|
/** 参数必须的 useQuery */
|
|
4
4
|
interface _UseQueryWithParams<TFn extends (params: any) => any, TInitSelectData = Awaited<ReturnType<TFn>>, TParams = Parameters<TFn>[0], TResponse = Awaited<ReturnType<TFn>>> {
|
|
5
5
|
<TData = TInitSelectData>(params: TParams): UseQueryResult<NoInfer<TData>, Error>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soda-tanstack-query",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/1adybug/deepsea/tree/main/packages/soda-tanstack-query",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"typescript": "^6.0.3",
|
|
39
|
+
"soda-type": "6.7.8"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@tanstack/react-query": "^5.90.21",
|
|
43
|
-
"@types/react": "
|
|
43
|
+
"@types/react": "^19.2.15",
|
|
44
44
|
"react": ">=19.2.3"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-restricted-syntax */
|
|
2
|
+
|
|
3
|
+
import { type DefaultError, type QueryClient, type UseMutationOptions, type UseMutationResult, useMutation } from "@tanstack/react-query"
|
|
2
4
|
|
|
3
5
|
type MutationFn = (param: any) => any
|
|
4
6
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-syntax */
|
|
2
|
+
|
|
1
3
|
import {
|
|
4
|
+
type DefinedInitialDataOptions,
|
|
5
|
+
type DefinedUseQueryResult,
|
|
6
|
+
type QueryClient,
|
|
7
|
+
type UndefinedInitialDataOptions,
|
|
8
|
+
type UseQueryOptions,
|
|
9
|
+
type UseQueryResult,
|
|
2
10
|
useQuery as _useQuery,
|
|
3
|
-
DefinedInitialDataOptions,
|
|
4
|
-
DefinedUseQueryResult,
|
|
5
|
-
QueryClient,
|
|
6
|
-
UndefinedInitialDataOptions,
|
|
7
|
-
UseQueryOptions,
|
|
8
|
-
UseQueryResult,
|
|
9
11
|
} from "@tanstack/react-query"
|
|
10
|
-
import { Assign, IsParamRequired, StrictPartial } from "soda-type"
|
|
12
|
+
import type { Assign, IsParamRequired, StrictPartial } from "soda-type"
|
|
11
13
|
|
|
12
14
|
// 要在第一个加一个重载,因为 options 是可选的,如果不加这个重载,options 类型会匹配到 DefinedInitialDataOptions,会误认为 initialData 被传递了,造成返回类型必定不为 undefined
|
|
13
15
|
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"rootDir": "src",
|
|
3
4
|
"strict": true,
|
|
4
5
|
"declaration": true,
|
|
5
6
|
"skipLibCheck": true,
|
|
@@ -7,6 +8,8 @@
|
|
|
7
8
|
"target": "ESNext",
|
|
8
9
|
"module": "ESNext",
|
|
9
10
|
"moduleResolution": "Bundler",
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"types": ["node"],
|
|
10
13
|
"paths": {
|
|
11
14
|
"@/*": ["./src/*"]
|
|
12
15
|
}
|