@falcondev-oss/trpc-vue-query 0.5.0-rc.10 → 0.5.0-rc.12
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 -9
- package/dist/index.mjs +12 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -58,17 +58,18 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
|
|
|
58
58
|
if (prop === "query") {
|
|
59
59
|
return trpc.query(joinedPath, firstArg, opts);
|
|
60
60
|
}
|
|
61
|
-
function createQuery(_input, { trpcOptions, queryOptions }) {
|
|
62
|
-
const input = (0, import_core.toValue)(_input);
|
|
61
|
+
function createQuery(_input, { trpcOptions, queryOptions }, { includeInput = false } = {}) {
|
|
63
62
|
return (0, import_vue_query.queryOptions)({
|
|
64
|
-
queryKey: (0, import_vue.computed)(() => getQueryKey(path,
|
|
65
|
-
queryFn: async ({ signal }) =>
|
|
66
|
-
|
|
63
|
+
queryKey: (0, import_vue.computed)(() => getQueryKey(path, (0, import_core.toValue)(_input), "query")),
|
|
64
|
+
queryFn: async ({ signal }) => {
|
|
65
|
+
const input = (0, import_core.toValue)(_input);
|
|
66
|
+
const output = await trpc.query(joinedPath, input, {
|
|
67
67
|
signal,
|
|
68
68
|
...trpcOptions
|
|
69
|
-
})
|
|
70
|
-
input
|
|
71
|
-
|
|
69
|
+
});
|
|
70
|
+
if (includeInput) return { output, input };
|
|
71
|
+
return output;
|
|
72
|
+
},
|
|
72
73
|
...maybeToRefs(queryOptions)
|
|
73
74
|
});
|
|
74
75
|
}
|
|
@@ -82,7 +83,9 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
|
|
|
82
83
|
const inputs = firstArg;
|
|
83
84
|
return (0, import_vue_query.useQueries)({
|
|
84
85
|
queries: (0, import_vue.computed)(
|
|
85
|
-
() => (0, import_core.toValue)(inputs).map(
|
|
86
|
+
() => (0, import_core.toValue)(inputs).map(
|
|
87
|
+
(i) => createQuery(i, { trpcOptions, queryOptions }, { includeInput: true })
|
|
88
|
+
)
|
|
86
89
|
),
|
|
87
90
|
combine,
|
|
88
91
|
...maybeToRefs({ shallow })
|
package/dist/index.mjs
CHANGED
|
@@ -43,17 +43,18 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
|
|
|
43
43
|
if (prop === "query") {
|
|
44
44
|
return trpc.query(joinedPath, firstArg, opts);
|
|
45
45
|
}
|
|
46
|
-
function createQuery(_input, { trpcOptions, queryOptions }) {
|
|
47
|
-
const input = toValue(_input);
|
|
46
|
+
function createQuery(_input, { trpcOptions, queryOptions }, { includeInput = false } = {}) {
|
|
48
47
|
return defineQueryOptions({
|
|
49
|
-
queryKey: computed(() => getQueryKey(path,
|
|
50
|
-
queryFn: async ({ signal }) =>
|
|
51
|
-
|
|
48
|
+
queryKey: computed(() => getQueryKey(path, toValue(_input), "query")),
|
|
49
|
+
queryFn: async ({ signal }) => {
|
|
50
|
+
const input = toValue(_input);
|
|
51
|
+
const output = await trpc.query(joinedPath, input, {
|
|
52
52
|
signal,
|
|
53
53
|
...trpcOptions
|
|
54
|
-
})
|
|
55
|
-
input
|
|
56
|
-
|
|
54
|
+
});
|
|
55
|
+
if (includeInput) return { output, input };
|
|
56
|
+
return output;
|
|
57
|
+
},
|
|
57
58
|
...maybeToRefs(queryOptions)
|
|
58
59
|
});
|
|
59
60
|
}
|
|
@@ -67,7 +68,9 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
|
|
|
67
68
|
const inputs = firstArg;
|
|
68
69
|
return useQueries({
|
|
69
70
|
queries: computed(
|
|
70
|
-
() => toValue(inputs).map(
|
|
71
|
+
() => toValue(inputs).map(
|
|
72
|
+
(i) => createQuery(i, { trpcOptions, queryOptions }, { includeInput: true })
|
|
73
|
+
)
|
|
71
74
|
),
|
|
72
75
|
combine,
|
|
73
76
|
...maybeToRefs({ shallow })
|
package/package.json
CHANGED