@orpc/vue-colada 0.0.0-next.ff5907c → 0.0.0-next.ff68fdb

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 ADDED
@@ -0,0 +1,99 @@
1
+ <div align="center">
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
+ </div>
4
+
5
+ <h1></h1>
6
+
7
+ <div align="center">
8
+ <a href="https://codecov.io/gh/unnoq/orpc">
9
+ <img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/@orpc/vue-colada">
12
+ <img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fvue-colada?logo=npm" />
13
+ </a>
14
+ <a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
15
+ <img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
16
+ </a>
17
+ <a href="https://discord.gg/TXEbwRBvQn">
18
+ <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
+ </a>
20
+ </div>
21
+
22
+ <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
23
+
24
+ **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards, ensuring a smooth and enjoyable developer experience.
25
+
26
+ ---
27
+
28
+ ## Highlights
29
+
30
+ - **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
31
+ - **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
32
+ - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
+ - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
+ - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
+ - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
+ - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
+ - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
39
+ - **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
40
+ - **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
41
+ - **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
42
+ - **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
43
+ - **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
44
+ - **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
45
+ - **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
46
+
47
+ ## Documentation
48
+
49
+ You can find the full documentation [here](https://orpc.unnoq.com).
50
+
51
+ ## Packages
52
+
53
+ - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
+ - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
+ - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@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
+ - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
+ - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
59
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
60
+ - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
61
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
62
+ - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
63
+
64
+ ## `@orpc/vue-colada`
65
+
66
+ Integration with [Pinia Colada](https://pinia-colada.esm.dev/). Read the [documentation](https://orpc.unnoq.com/docs/pinia-colada) for more information.
67
+
68
+ ```ts
69
+ export function Setup() {
70
+ const query = useQuery(orpc.planet.find.queryOptions({
71
+ input: { id: 123 }, // Specify input if needed
72
+ context: { cache: true }, // Provide client context if needed
73
+ // additional options...
74
+ }))
75
+
76
+ const mutation = useMutation(orpc.planet.create.mutationOptions({
77
+ context: { cache: true }, // Provide client context if needed
78
+ // additional options...
79
+ }))
80
+
81
+ mutation.mutate({ name: 'Earth' })
82
+
83
+ const queryCache = useQueryCache()
84
+
85
+ // Invalidate all planet queries
86
+ queryCache.invalidateQueries({
87
+ key: orpc.planet.key(),
88
+ })
89
+
90
+ // Invalidate the planet find query with id 123
91
+ queryCache.invalidateQueries({
92
+ key: orpc.planet.find.key({ input: { id: 123 } })
93
+ })
94
+ }
95
+ ```
96
+
97
+ ## License
98
+
99
+ Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,55 @@
1
+ import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
+ import { AnyFunction, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
+ import { MaybeRef } 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 MaybeRefDeep<T> = MaybeRef<T extends AnyFunction ? T : T extends object ? {
17
+ [K in keyof T]: MaybeRefDeep<T[K]>;
18
+ } : T>;
19
+ type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
20
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
21
+ input?: MaybeRefDeep<TInput>;
22
+ } : {
23
+ input: MaybeRefDeep<TInput>;
24
+ }) & (Record<never, never> extends TClientContext ? {
25
+ context?: MaybeRefDeep<TClientContext>;
26
+ } : {
27
+ context: MaybeRefDeep<TClientContext>;
28
+ }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
29
+ type QueryOptions<TOutput, TError extends Error, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
30
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
31
+ context?: MaybeRefDeep<TClientContext>;
32
+ } : {
33
+ context: MaybeRefDeep<TClientContext>;
34
+ }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
35
+ type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
36
+
37
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
38
+ call: Client<TClientContext, TInput, TOutput, TError>;
39
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
40
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
41
+ }
42
+ interface CreateProcedureUtilsOptions {
43
+ path: string[];
44
+ }
45
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
46
+
47
+ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
48
+ [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
49
+ } & GeneralUtils<unknown>;
50
+ interface CreateRouterUtilsOptions {
51
+ path?: string[];
52
+ }
53
+ declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
54
+
55
+ export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MaybeRefDeep, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
@@ -0,0 +1,55 @@
1
+ import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
+ import { AnyFunction, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
+ import { MaybeRef } 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 MaybeRefDeep<T> = MaybeRef<T extends AnyFunction ? T : T extends object ? {
17
+ [K in keyof T]: MaybeRefDeep<T[K]>;
18
+ } : T>;
19
+ type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
20
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
21
+ input?: MaybeRefDeep<TInput>;
22
+ } : {
23
+ input: MaybeRefDeep<TInput>;
24
+ }) & (Record<never, never> extends TClientContext ? {
25
+ context?: MaybeRefDeep<TClientContext>;
26
+ } : {
27
+ context: MaybeRefDeep<TClientContext>;
28
+ }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
29
+ type QueryOptions<TOutput, TError extends Error, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
30
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
31
+ context?: MaybeRefDeep<TClientContext>;
32
+ } : {
33
+ context: MaybeRefDeep<TClientContext>;
34
+ }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
35
+ type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
36
+
37
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
38
+ call: Client<TClientContext, TInput, TOutput, TError>;
39
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
40
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
41
+ }
42
+ interface CreateProcedureUtilsOptions {
43
+ path: string[];
44
+ }
45
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
46
+
47
+ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
48
+ [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
49
+ } & GeneralUtils<unknown>;
50
+ interface CreateRouterUtilsOptions {
51
+ path?: string[];
52
+ }
53
+ declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
54
+
55
+ export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MaybeRefDeep, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
@@ -1,13 +1,18 @@
1
- // src/key.ts
2
- import { serializeRPCJson } from "@orpc/client/rpc";
1
+ import { RPCJsonSerializer } from '@orpc/client/standard';
2
+ import { stringifyJSON, isObject } from '@orpc/shared';
3
+ import { isRef, computed } from 'vue';
4
+
3
5
  function buildKey(path, options) {
6
+ if (options?.input === void 0) {
7
+ return path;
8
+ }
9
+ const [json, meta] = new RPCJsonSerializer().serialize(options.input);
4
10
  return [
5
11
  ...path,
6
- ...options?.input !== void 0 ? [{ input: JSON.stringify(serializeRPCJson(options.input)) }] : []
12
+ { input: stringifyJSON({ json, meta }) }
7
13
  ];
8
14
  }
9
15
 
10
- // src/general-utils.ts
11
16
  function createGeneralUtils(path) {
12
17
  return {
13
18
  key(options) {
@@ -16,12 +21,6 @@ function createGeneralUtils(path) {
16
21
  };
17
22
  }
18
23
 
19
- // src/procedure-utils.ts
20
- import { computed } from "vue";
21
-
22
- // src/utils.ts
23
- import { isObject } from "@orpc/shared";
24
- import { isRef } from "vue";
25
24
  function unrefDeep(value) {
26
25
  if (isRef(value)) {
27
26
  return unrefDeep(value.value);
@@ -38,20 +37,19 @@ function unrefDeep(value) {
38
37
  return value;
39
38
  }
40
39
 
41
- // src/procedure-utils.ts
42
- function createProcedureUtils(client, path) {
40
+ function createProcedureUtils(client, options) {
43
41
  return {
44
42
  call: client,
45
43
  queryOptions(...[{ input, context, ...rest } = {}]) {
46
44
  return {
47
- key: computed(() => buildKey(path, { input: unrefDeep(input) })),
45
+ key: computed(() => buildKey(options.path, { input: unrefDeep(input) })),
48
46
  query: ({ signal }) => client(unrefDeep(input), { signal, context: unrefDeep(context) }),
49
47
  ...rest
50
48
  };
51
49
  },
52
50
  mutationOptions(...[{ context, ...rest } = {}]) {
53
51
  return {
54
- key: (input) => buildKey(path, { input }),
52
+ key: (input) => buildKey(options.path, { input }),
55
53
  mutation: (input) => client(input, { context: unrefDeep(context) }),
56
54
  ...rest
57
55
  };
@@ -59,10 +57,10 @@ function createProcedureUtils(client, path) {
59
57
  };
60
58
  }
61
59
 
62
- // src/router-utils.ts
63
- function createRouterUtils(client, path = []) {
60
+ function createRouterUtils(client, options = {}) {
61
+ const path = options.path ?? [];
64
62
  const generalUtils = createGeneralUtils(path);
65
- const procedureUtils = createProcedureUtils(client, path);
63
+ const procedureUtils = createProcedureUtils(client, { path });
66
64
  const recursive = new Proxy({
67
65
  ...generalUtils,
68
66
  ...procedureUtils
@@ -72,7 +70,7 @@ function createRouterUtils(client, path = []) {
72
70
  if (typeof prop !== "string") {
73
71
  return value;
74
72
  }
75
- const nextUtils = createRouterUtils(client[prop], [...path, prop]);
73
+ const nextUtils = createRouterUtils(client[prop], { ...options, path: [...path, prop] });
76
74
  if (typeof value !== "function") {
77
75
  return nextUtils;
78
76
  }
@@ -86,13 +84,4 @@ function createRouterUtils(client, path = []) {
86
84
  return recursive;
87
85
  }
88
86
 
89
- // src/index.ts
90
- var createORPCVueColadaUtils = createRouterUtils;
91
- export {
92
- buildKey,
93
- createGeneralUtils,
94
- createORPCVueColadaUtils,
95
- createProcedureUtils,
96
- createRouterUtils
97
- };
98
- //# sourceMappingURL=index.js.map
87
+ 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.ff5907c",
4
+ "version": "0.0.0-next.ff68fdb",
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/client": "0.0.0-next.ff5907c",
41
- "@orpc/shared": "0.0.0-next.ff5907c"
35
+ "@orpc/client": "0.0.0-next.ff68fdb",
36
+ "@orpc/shared": "0.0.0-next.ff68fdb"
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
  }
@@ -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