@falcondev-oss/trpc-vue-query 0.5.0-rc.12 → 0.5.0-rc.13

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 CHANGED
@@ -58,16 +58,16 @@ 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 }, { includeInput = false } = {}) {
61
+ function createQuery(_input, { trpcOptions, queryOptions }, { type = "query" } = {}) {
62
62
  return (0, import_vue_query.queryOptions)({
63
- queryKey: (0, import_vue.computed)(() => getQueryKey(path, (0, import_core.toValue)(_input), "query")),
63
+ queryKey: (0, import_vue.computed)(() => getQueryKey(path, (0, import_core.toValue)(_input), type)),
64
64
  queryFn: async ({ signal }) => {
65
65
  const input = (0, import_core.toValue)(_input);
66
66
  const output = await trpc.query(joinedPath, input, {
67
67
  signal,
68
68
  ...trpcOptions
69
69
  });
70
- if (includeInput) return { output, input };
70
+ if (type === "queries") return { output, input };
71
71
  return output;
72
72
  },
73
73
  ...maybeToRefs(queryOptions)
@@ -84,7 +84,7 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
84
84
  return (0, import_vue_query.useQueries)({
85
85
  queries: (0, import_vue.computed)(
86
86
  () => (0, import_core.toValue)(inputs).map(
87
- (i) => createQuery(i, { trpcOptions, queryOptions }, { includeInput: true })
87
+ (i) => createQuery(i, { trpcOptions, queryOptions }, { type: "queries" })
88
88
  )
89
89
  ),
90
90
  combine,
package/dist/index.d.cts CHANGED
@@ -61,7 +61,7 @@ type DecoratedProcedureRecord<TProcedures extends Record<string, any>, TRouter e
61
61
  [K in keyof TProcedures]: TProcedures[K] extends AnyTRPCProcedure ? DecorateProcedure<TProcedures[K], TRouter> : DecoratedProcedureRecord<TProcedures[K], TRouter>;
62
62
  };
63
63
 
64
- type QueryType = 'query' | 'infinite';
64
+ type QueryType = 'query' | 'queries' | 'infinite';
65
65
  type TRPCQueryKey = [readonly string[], {
66
66
  input?: unknown;
67
67
  type?: QueryType;
package/dist/index.d.ts CHANGED
@@ -61,7 +61,7 @@ type DecoratedProcedureRecord<TProcedures extends Record<string, any>, TRouter e
61
61
  [K in keyof TProcedures]: TProcedures[K] extends AnyTRPCProcedure ? DecorateProcedure<TProcedures[K], TRouter> : DecoratedProcedureRecord<TProcedures[K], TRouter>;
62
62
  };
63
63
 
64
- type QueryType = 'query' | 'infinite';
64
+ type QueryType = 'query' | 'queries' | 'infinite';
65
65
  type TRPCQueryKey = [readonly string[], {
66
66
  input?: unknown;
67
67
  type?: QueryType;
package/dist/index.mjs CHANGED
@@ -43,16 +43,16 @@ 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 }, { includeInput = false } = {}) {
46
+ function createQuery(_input, { trpcOptions, queryOptions }, { type = "query" } = {}) {
47
47
  return defineQueryOptions({
48
- queryKey: computed(() => getQueryKey(path, toValue(_input), "query")),
48
+ queryKey: computed(() => getQueryKey(path, toValue(_input), type)),
49
49
  queryFn: async ({ signal }) => {
50
50
  const input = toValue(_input);
51
51
  const output = await trpc.query(joinedPath, input, {
52
52
  signal,
53
53
  ...trpcOptions
54
54
  });
55
- if (includeInput) return { output, input };
55
+ if (type === "queries") return { output, input };
56
56
  return output;
57
57
  },
58
58
  ...maybeToRefs(queryOptions)
@@ -69,7 +69,7 @@ function createVueQueryProxyDecoration(name, trpc, queryClient) {
69
69
  return useQueries({
70
70
  queries: computed(
71
71
  () => toValue(inputs).map(
72
- (i) => createQuery(i, { trpcOptions, queryOptions }, { includeInput: true })
72
+ (i) => createQuery(i, { trpcOptions, queryOptions }, { type: "queries" })
73
73
  )
74
74
  ),
75
75
  combine,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@falcondev-oss/trpc-vue-query",
3
3
  "type": "module",
4
- "version": "0.5.0-rc.12",
4
+ "version": "0.5.0-rc.13",
5
5
  "description": "A tRPC wrapper around '@tanstack/vue-query'",
6
6
  "license": "MIT",
7
7
  "repository": "github:falcondev-oss/trpc-vue-query",