@orpc/vue-colada 0.0.0-next.f17a1a0 → 0.0.0-next.f47352c

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 />
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
3
  </div>
4
4
 
5
5
  <h1></h1>
@@ -32,7 +32,7 @@
32
32
  - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
33
  - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
34
  - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
36
  - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
37
  - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
38
  - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
@@ -53,11 +53,16 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
53
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
54
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
55
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
57
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
58
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
59
+ - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
60
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
58
61
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
62
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
60
63
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
64
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
65
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
61
66
 
62
67
  ## `@orpc/vue-colada`
63
68
 
@@ -92,6 +97,14 @@ export function Setup() {
92
97
  }
93
98
  ```
94
99
 
100
+ ## Sponsors
101
+
102
+ <p align="center">
103
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
104
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
105
+ </a>
106
+ </p>
107
+
95
108
  ## License
96
109
 
97
110
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,52 @@
1
+ import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
+ import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
+ import { MaybeRefOrGetter } from 'vue';
5
+
6
+ interface BuildKeyOptions<TInput> {
7
+ input?: TInput;
8
+ }
9
+ declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
+
11
+ interface GeneralUtils<TInput> {
12
+ key(options?: BuildKeyOptions<TInput>): EntryKey;
13
+ }
14
+ declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
15
+
16
+ type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
17
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
18
+ input?: MaybeRefOrGetter<TInput>;
19
+ } : {
20
+ input: MaybeRefOrGetter<TInput>;
21
+ }) & (Record<never, never> extends TClientContext ? {
22
+ context?: MaybeRefOrGetter<TClientContext>;
23
+ } : {
24
+ context: MaybeRefOrGetter<TClientContext>;
25
+ }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
26
+ type QueryOptions<TOutput, TError, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
27
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
28
+ context?: MaybeRefOrGetter<TClientContext>;
29
+ } : {
30
+ context: MaybeRefOrGetter<TClientContext>;
31
+ }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
32
+ type MutationOptions<TInput, TOutput, TError, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
33
+
34
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
35
+ call: Client<TClientContext, TInput, TOutput, TError>;
36
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
37
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
38
+ }
39
+ interface CreateProcedureUtilsOptions {
40
+ path: string[];
41
+ }
42
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
43
+
44
+ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
45
+ [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
46
+ } & GeneralUtils<unknown>;
47
+ interface CreateRouterUtilsOptions {
48
+ path?: string[];
49
+ }
50
+ declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
51
+
52
+ export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
@@ -0,0 +1,52 @@
1
+ import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
+ import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
+ import { MaybeRefOrGetter } from 'vue';
5
+
6
+ interface BuildKeyOptions<TInput> {
7
+ input?: TInput;
8
+ }
9
+ declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
+
11
+ interface GeneralUtils<TInput> {
12
+ key(options?: BuildKeyOptions<TInput>): EntryKey;
13
+ }
14
+ declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
15
+
16
+ type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
17
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
18
+ input?: MaybeRefOrGetter<TInput>;
19
+ } : {
20
+ input: MaybeRefOrGetter<TInput>;
21
+ }) & (Record<never, never> extends TClientContext ? {
22
+ context?: MaybeRefOrGetter<TClientContext>;
23
+ } : {
24
+ context: MaybeRefOrGetter<TClientContext>;
25
+ }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
26
+ type QueryOptions<TOutput, TError, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
27
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
28
+ context?: MaybeRefOrGetter<TClientContext>;
29
+ } : {
30
+ context: MaybeRefOrGetter<TClientContext>;
31
+ }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
32
+ type MutationOptions<TInput, TOutput, TError, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
33
+
34
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
35
+ call: Client<TClientContext, TInput, TOutput, TError>;
36
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
37
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
38
+ }
39
+ interface CreateProcedureUtilsOptions {
40
+ path: string[];
41
+ }
42
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
43
+
44
+ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
45
+ [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
46
+ } & GeneralUtils<unknown>;
47
+ interface CreateRouterUtilsOptions {
48
+ path?: string[];
49
+ }
50
+ declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
51
+
52
+ export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
package/dist/index.mjs ADDED
@@ -0,0 +1,71 @@
1
+ import { StandardRPCJsonSerializer } from '@orpc/client/standard';
2
+ import { stringifyJSON } from '@orpc/shared';
3
+ import { toValue, computed } from 'vue';
4
+
5
+ function buildKey(path, options) {
6
+ if (options?.input === void 0) {
7
+ return path;
8
+ }
9
+ const [json, meta] = new StandardRPCJsonSerializer().serialize(options.input);
10
+ return [
11
+ ...path,
12
+ { input: stringifyJSON({ json, meta }) }
13
+ ];
14
+ }
15
+
16
+ function createGeneralUtils(path) {
17
+ return {
18
+ key(options) {
19
+ return buildKey(path, options);
20
+ }
21
+ };
22
+ }
23
+
24
+ function createProcedureUtils(client, options) {
25
+ return {
26
+ call: client,
27
+ queryOptions(...[{ input, context, ...rest } = {}]) {
28
+ return {
29
+ key: computed(() => buildKey(options.path, { input: toValue(input) })),
30
+ query: ({ signal }) => client(toValue(input), { signal, context: toValue(context) }),
31
+ ...rest
32
+ };
33
+ },
34
+ mutationOptions(...[{ context, ...rest } = {}]) {
35
+ return {
36
+ key: (input) => buildKey(options.path, { input }),
37
+ mutation: (input) => client(input, { context: toValue(context) }),
38
+ ...rest
39
+ };
40
+ }
41
+ };
42
+ }
43
+
44
+ function createRouterUtils(client, options = {}) {
45
+ const path = options.path ?? [];
46
+ const generalUtils = createGeneralUtils(path);
47
+ const procedureUtils = createProcedureUtils(client, { path });
48
+ const recursive = new Proxy({
49
+ ...generalUtils,
50
+ ...procedureUtils
51
+ }, {
52
+ get(target, prop) {
53
+ const value = Reflect.get(target, prop);
54
+ if (typeof prop !== "string") {
55
+ return value;
56
+ }
57
+ const nextUtils = createRouterUtils(client[prop], { ...options, path: [...path, prop] });
58
+ if (typeof value !== "function") {
59
+ return nextUtils;
60
+ }
61
+ return new Proxy(value, {
62
+ get(_, prop2) {
63
+ return Reflect.get(nextUtils, prop2);
64
+ }
65
+ });
66
+ }
67
+ });
68
+ return recursive;
69
+ }
70
+
71
+ export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/vue-colada",
3
3
  "type": "module",
4
- "version": "0.0.0-next.f17a1a0",
4
+ "version": "0.0.0-next.f47352c",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -19,17 +19,12 @@
19
19
  ],
20
20
  "exports": {
21
21
  ".": {
22
- "types": "./dist/src/index.d.ts",
23
- "import": "./dist/index.js",
24
- "default": "./dist/index.js"
25
- },
26
- "./🔒/*": {
27
- "types": "./dist/src/*.d.ts"
22
+ "types": "./dist/index.d.mts",
23
+ "import": "./dist/index.mjs",
24
+ "default": "./dist/index.mjs"
28
25
  }
29
26
  },
30
27
  "files": [
31
- "!**/*.map",
32
- "!**/*.tsbuildinfo",
33
28
  "dist"
34
29
  ],
35
30
  "peerDependencies": {
@@ -37,14 +32,14 @@
37
32
  "vue": ">=3.3.0"
38
33
  },
39
34
  "dependencies": {
40
- "@orpc/shared": "0.0.0-next.f17a1a0",
41
- "@orpc/client": "0.0.0-next.f17a1a0"
35
+ "@orpc/client": "0.0.0-next.f47352c",
36
+ "@orpc/shared": "0.0.0-next.f47352c"
42
37
  },
43
38
  "devDependencies": {
44
39
  "pinia": "^2.3.0"
45
40
  },
46
41
  "scripts": {
47
- "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
42
+ "build": "unbuild",
48
43
  "build:watch": "pnpm run build --watch",
49
44
  "type:check": "tsc -b"
50
45
  }
package/dist/index.js DELETED
@@ -1,102 +0,0 @@
1
- // src/key.ts
2
- import { RPCJsonSerializer } from "@orpc/client/rpc";
3
- function buildKey(path, options) {
4
- if (options?.input === void 0) {
5
- return path;
6
- }
7
- const [json, meta] = new RPCJsonSerializer().serialize(options.input);
8
- return [
9
- ...path,
10
- { input: JSON.stringify({ json, meta }) }
11
- ];
12
- }
13
-
14
- // src/general-utils.ts
15
- function createGeneralUtils(path) {
16
- return {
17
- key(options) {
18
- return buildKey(path, options);
19
- }
20
- };
21
- }
22
-
23
- // src/procedure-utils.ts
24
- import { computed } from "vue";
25
-
26
- // src/utils.ts
27
- import { isObject } from "@orpc/shared";
28
- import { isRef } from "vue";
29
- function unrefDeep(value) {
30
- if (isRef(value)) {
31
- return unrefDeep(value.value);
32
- }
33
- if (Array.isArray(value)) {
34
- return value.map(unrefDeep);
35
- }
36
- if (isObject(value)) {
37
- return Object.keys(value).reduce((acc, key) => {
38
- acc[key] = unrefDeep(value[key]);
39
- return acc;
40
- }, {});
41
- }
42
- return value;
43
- }
44
-
45
- // src/procedure-utils.ts
46
- function createProcedureUtils(client, path) {
47
- return {
48
- call: client,
49
- queryOptions(...[{ input, context, ...rest } = {}]) {
50
- return {
51
- key: computed(() => buildKey(path, { input: unrefDeep(input) })),
52
- query: ({ signal }) => client(unrefDeep(input), { signal, context: unrefDeep(context) }),
53
- ...rest
54
- };
55
- },
56
- mutationOptions(...[{ context, ...rest } = {}]) {
57
- return {
58
- key: (input) => buildKey(path, { input }),
59
- mutation: (input) => client(input, { context: unrefDeep(context) }),
60
- ...rest
61
- };
62
- }
63
- };
64
- }
65
-
66
- // src/router-utils.ts
67
- function createRouterUtils(client, path = []) {
68
- const generalUtils = createGeneralUtils(path);
69
- const procedureUtils = createProcedureUtils(client, path);
70
- const recursive = new Proxy({
71
- ...generalUtils,
72
- ...procedureUtils
73
- }, {
74
- get(target, prop) {
75
- const value = Reflect.get(target, prop);
76
- if (typeof prop !== "string") {
77
- return value;
78
- }
79
- const nextUtils = createRouterUtils(client[prop], [...path, prop]);
80
- if (typeof value !== "function") {
81
- return nextUtils;
82
- }
83
- return new Proxy(value, {
84
- get(_, prop2) {
85
- return Reflect.get(nextUtils, prop2);
86
- }
87
- });
88
- }
89
- });
90
- return recursive;
91
- }
92
-
93
- // src/index.ts
94
- var createORPCVueColadaUtils = createRouterUtils;
95
- export {
96
- buildKey,
97
- createGeneralUtils,
98
- createORPCVueColadaUtils,
99
- createProcedureUtils,
100
- createRouterUtils
101
- };
102
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- import type { EntryKey } from '@pinia/colada';
2
- import type { BuildKeyOptions } from './key';
3
- export interface GeneralUtils<TInput> {
4
- key(options?: BuildKeyOptions<TInput>): EntryKey;
5
- }
6
- export declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
7
- //# sourceMappingURL=general-utils.d.ts.map
@@ -1,8 +0,0 @@
1
- import { createRouterUtils } from './router-utils';
2
- export * from './general-utils';
3
- export * from './key';
4
- export * from './procedure-utils';
5
- export * from './router-utils';
6
- export * from './types';
7
- export declare const createORPCVueColadaUtils: typeof createRouterUtils;
8
- //# sourceMappingURL=index.d.ts.map
package/dist/src/key.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { EntryKey } from '@pinia/colada';
2
- export interface BuildKeyOptions<TInput> {
3
- input?: TInput;
4
- }
5
- export declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
6
- //# sourceMappingURL=key.d.ts.map
@@ -1,10 +0,0 @@
1
- import type { Client, ClientContext } from '@orpc/client';
2
- import type { MaybeOptionalOptions } from '@orpc/shared';
3
- import type { MutationOptions, MutationOptionsIn, QueryOptions, QueryOptionsIn } from './types';
4
- export interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
5
- call: Client<TClientContext, TInput, TOutput, TError>;
6
- queryOptions(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError>>): QueryOptions<TOutput, TError>;
7
- mutationOptions(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError>>): MutationOptions<TInput, TOutput, TError>;
8
- }
9
- 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>;
10
- //# sourceMappingURL=procedure-utils.d.ts.map
@@ -1,12 +0,0 @@
1
- import type { Client, NestedClient } from '@orpc/client';
2
- import { type GeneralUtils } from './general-utils';
3
- import { type ProcedureUtils } from './procedure-utils';
4
- export type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
5
- [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
6
- } & GeneralUtils<unknown>;
7
- /**
8
- * @param client - Any kind of oRPC clients: `createRouterClient`, `createORPCClient`, ...
9
- * @param path - The base path for query key, when it it will be prefix to all keys
10
- */
11
- export declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?: string[]): RouterUtils<T>;
12
- //# sourceMappingURL=router-utils.d.ts.map
@@ -1,25 +0,0 @@
1
- import type { ClientContext } from '@orpc/client';
2
- import type { AnyFunction, SetOptional } from '@orpc/shared';
3
- import type { UseMutationOptions, UseQueryOptions } from '@pinia/colada';
4
- import type { MaybeRef } from 'vue';
5
- export type MaybeRefDeep<T> = MaybeRef<T extends AnyFunction ? T : T extends object ? {
6
- [K in keyof T]: MaybeRefDeep<T[K]>;
7
- } : T>;
8
- export type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
9
- export type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (undefined extends TInput ? {
10
- input?: MaybeRefDeep<TInput>;
11
- } : {
12
- input: MaybeRefDeep<TInput>;
13
- }) & (Record<never, never> extends TClientContext ? {
14
- context?: MaybeRefDeep<TClientContext>;
15
- } : {
16
- context: MaybeRefDeep<TClientContext>;
17
- }) & SetOptional<UseQueryOptions<TOutput, TError>, 'key' | 'query'>;
18
- export type QueryOptions<TOutput, TError extends Error> = UseQueryOptions<TOutput, TError>;
19
- export type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (Record<never, never> extends TClientContext ? {
20
- context?: MaybeRefDeep<TClientContext>;
21
- } : {
22
- context: MaybeRefDeep<TClientContext>;
23
- }) & SetOptional<UseMutationOptions<TOutput, TInput, TError>, 'mutation'>;
24
- export type MutationOptions<TInput, TOutput, TError extends Error> = UseMutationOptions<TOutput, TInput, TError>;
25
- //# sourceMappingURL=types.d.ts.map
@@ -1,7 +0,0 @@
1
- import type { Ref } from 'vue';
2
- import { type AnyFunction } from '@orpc/shared';
3
- export type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunction ? T : T extends object ? {
4
- [K in keyof T]: UnrefDeep<T[K]>;
5
- } : T;
6
- export declare function unrefDeep<T>(value: T): UnrefDeep<T>;
7
- //# sourceMappingURL=utils.d.ts.map