@orpc/vue-query 0.37.0 → 0.39.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/index.js CHANGED
@@ -8,13 +8,25 @@ function buildKey(path, options) {
8
8
  }];
9
9
  }
10
10
 
11
+ // src/general-utils.ts
12
+ function createGeneralUtils(path) {
13
+ return {
14
+ key(options) {
15
+ return buildKey(path, options);
16
+ }
17
+ };
18
+ }
19
+
20
+ // src/procedure-utils.ts
21
+ import { computed } from "vue";
22
+
11
23
  // ../shared/src/object.ts
12
24
  function isObject(value) {
13
25
  if (!value || typeof value !== "object") {
14
26
  return false;
15
27
  }
16
28
  const proto = Object.getPrototypeOf(value);
17
- return proto === Object.prototype || proto === null;
29
+ return proto === Object.prototype || !proto || !proto.constructor;
18
30
  }
19
31
 
20
32
  // src/utils.ts
@@ -35,19 +47,10 @@ function unrefDeep(value) {
35
47
  return value;
36
48
  }
37
49
 
38
- // src/general-utils.ts
39
- function createGeneralUtils(path) {
40
- return {
41
- key(options) {
42
- return buildKey(path, unrefDeep(options));
43
- }
44
- };
45
- }
46
-
47
50
  // src/procedure-utils.ts
48
- import { computed } from "vue";
49
51
  function createProcedureUtils(client, path) {
50
52
  return {
53
+ call: client,
51
54
  queryOptions(...[{ input, context, ...rest } = {}]) {
52
55
  return {
53
56
  queryKey: computed(() => buildKey(path, { type: "query", input: unrefDeep(input) })),
@@ -1,8 +1,7 @@
1
1
  import type { QueryKey } from '@tanstack/vue-query';
2
2
  import type { BuildKeyOptions, KeyType } from './key';
3
- import type { MaybeRefDeep } from './types';
4
3
  export interface GeneralUtils<TInput> {
5
- key<UType extends KeyType = undefined>(options?: MaybeRefDeep<BuildKeyOptions<UType, TInput>>): QueryKey;
4
+ key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
6
5
  }
7
6
  export declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
8
7
  //# sourceMappingURL=general-utils.d.ts.map
@@ -1,11 +1,12 @@
1
- import type { Client } from '@orpc/contract';
1
+ import type { Client, ClientContext } from '@orpc/contract';
2
2
  import type { MaybeOptionalOptions } from '@orpc/shared';
3
3
  import type { InfiniteData } from '@tanstack/vue-query';
4
4
  import type { InfiniteOptionsBase, InfiniteOptionsIn, MutationOptionsBase, MutationOptionsIn, QueryOptionsBase, QueryOptionsIn } from './types';
5
- export interface ProcedureUtils<TClientContext, TInput, TOutput, TError extends Error> {
5
+ export interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
6
+ call: Client<TClientContext, TInput, TOutput, TError>;
6
7
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & QueryOptionsBase<TOutput, TError>>;
7
8
  infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & InfiniteOptionsBase<TOutput, TError, UPageParam>>;
8
9
  mutationOptions<U>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError>>): NoInfer<U & MutationOptionsBase<TInput, TOutput, TError>>;
9
10
  }
10
- export declare function createProcedureUtils<TClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
11
+ export declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
11
12
  //# sourceMappingURL=procedure-utils.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { ClientContext } from '@orpc/contract';
1
2
  import type { AnyFunction, SetOptional } from '@orpc/shared';
2
3
  import type { Enabled, MutationObserverOptions, QueryFunctionContext, QueryKey, QueryObserverOptions, UseInfiniteQueryOptions } from '@tanstack/vue-query';
3
4
  import type { ComputedRef, MaybeRef, MaybeRefOrGetter } from 'vue';
@@ -8,11 +9,11 @@ import type { ComputedRef, MaybeRef, MaybeRefOrGetter } from 'vue';
8
9
  export type MaybeRefDeep<T> = MaybeRef<T extends AnyFunction ? T : T extends object ? {
9
10
  [Property in keyof T]: MaybeRefDeep<T[Property]>;
10
11
  } : T>;
11
- export type QueryOptionsIn<TClientContext, TInput, TOutput, TError extends Error, TSelectData> = (undefined extends TInput ? {
12
+ export type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData> = (undefined extends TInput ? {
12
13
  input?: MaybeRefDeep<TInput>;
13
14
  } : {
14
15
  input: MaybeRefDeep<TInput>;
15
- }) & (undefined extends TClientContext ? {
16
+ }) & (Record<never, never> extends TClientContext ? {
16
17
  context?: MaybeRefDeep<TClientContext>;
17
18
  } : {
18
19
  context: MaybeRefDeep<TClientContext>;
@@ -28,9 +29,9 @@ export interface QueryOptionsBase<TOutput, TError extends Error> {
28
29
  queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
29
30
  retry?(failureCount: number, error: TError): boolean;
30
31
  }
31
- export type InfiniteOptionsIn<TClientContext, TInput, TOutput, TError extends Error, TSelectData, TPageParam> = {
32
+ export type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData, TPageParam> = {
32
33
  input: (pageParam: TPageParam) => MaybeRefDeep<TInput>;
33
- } & (undefined extends TClientContext ? {
34
+ } & (Record<never, never> extends TClientContext ? {
34
35
  context?: MaybeRefDeep<TClientContext>;
35
36
  } : {
36
37
  context: MaybeRefDeep<TClientContext>;
@@ -40,7 +41,7 @@ export interface InfiniteOptionsBase<TOutput, TError extends Error, TPageParam>
40
41
  queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
41
42
  retry?(failureCount: number, error: TError): boolean;
42
43
  }
43
- export type MutationOptionsIn<TClientContext, TInput, TOutput, TError extends Error> = (undefined extends TClientContext ? {
44
+ export type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (Record<never, never> extends TClientContext ? {
44
45
  context?: TClientContext;
45
46
  } : {
46
47
  context: TClientContext;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/vue-query",
3
3
  "type": "module",
4
- "version": "0.37.0",
4
+ "version": "0.39.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,8 +34,8 @@
34
34
  "peerDependencies": {
35
35
  "@tanstack/vue-query": ">=5.50.0",
36
36
  "vue": ">=3.3.0",
37
- "@orpc/contract": "0.37.0",
38
- "@orpc/client": "0.37.0"
37
+ "@orpc/client": "0.39.0",
38
+ "@orpc/contract": "0.39.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",