@orpc/vue-colada 0.0.0-next.e7d7758 → 0.0.0-next.ed15210

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.
@@ -8,7 +8,7 @@ export type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
8
8
  export type InferCursor<T> = T extends {
9
9
  cursor?: any;
10
10
  } ? T['cursor'] : never;
11
- export type QueryOptions<TInput, TOutput, TClientContext> = (undefined extends TInput ? {
11
+ export type QueryOptionsExtra<TClientContext, TInput, TOutput, TError extends Error> = (undefined extends TInput ? {
12
12
  input?: MaybeDeepRef<TInput>;
13
13
  } : {
14
14
  input: MaybeDeepRef<TInput>;
@@ -16,10 +16,12 @@ export type QueryOptions<TInput, TOutput, TClientContext> = (undefined extends T
16
16
  context?: MaybeDeepRef<TClientContext>;
17
17
  } : {
18
18
  context: MaybeDeepRef<TClientContext>;
19
- }) & SetOptional<UseQueryOptions<TOutput>, 'key' | 'query'>;
20
- export type MutationOptions<TInput, TOutput, TClientContext> = (undefined extends TClientContext ? {
19
+ }) & SetOptional<UseQueryOptions<TOutput, TError>, 'key' | 'query'>;
20
+ export type QueryOptions<TOutput, TError extends Error> = UseQueryOptions<TOutput, TError>;
21
+ export type MutationOptionsExtra<TClientContext, TInput, TOutput, TError extends Error> = (undefined extends TClientContext ? {
21
22
  context?: MaybeDeepRef<TClientContext>;
22
23
  } : {
23
24
  context: MaybeDeepRef<TClientContext>;
24
- }) & SetOptional<UseMutationOptions<TOutput, TInput>, 'mutation'>;
25
+ }) & SetOptional<UseMutationOptions<TOutput, TInput, TError>, 'mutation'>;
26
+ export type MutationOptions<TInput, TOutput, TError extends Error> = UseMutationOptions<TOutput, TInput, TError>;
25
27
  //# sourceMappingURL=types.d.ts.map
@@ -1,26 +1,11 @@
1
- import type { ProcedureClient } from '@orpc/server';
2
- import type { IsEqual } from '@orpc/shared';
3
- import type { EntryKey } from '@pinia/colada';
4
- import type { ComputedRef } from 'vue';
5
- import type { MutationOptions, QueryOptions, UseQueryFnContext } from './types';
1
+ import type { Client } from '@orpc/contract';
2
+ import type { MutationOptions, MutationOptionsExtra, QueryOptions, QueryOptionsExtra } from './types';
6
3
  /**
7
4
  * Utils at procedure level
8
5
  */
9
- export interface ProcedureUtils<TInput, TOutput, TClientContext> {
10
- queryOptions: <U extends QueryOptions<TInput, TOutput, TClientContext>>(...opt: [options: U] | (undefined extends TInput & TClientContext ? [] : never)) => IsEqual<U, QueryOptions<TInput, TOutput, TClientContext>> extends true ? {
11
- key: ComputedRef<EntryKey>;
12
- query: (ctx: UseQueryFnContext) => Promise<TOutput>;
13
- } : Omit<{
14
- key: ComputedRef<EntryKey>;
15
- query: (ctx: UseQueryFnContext) => Promise<TOutput>;
16
- }, keyof U> & U;
17
- mutationOptions: <U extends MutationOptions<TInput, TOutput, TClientContext>>(...opt: [options: U] | (undefined extends TClientContext ? [] : never)) => IsEqual<U, MutationOptions<TInput, TOutput, TClientContext>> extends true ? {
18
- key: (input: TInput) => EntryKey;
19
- mutation: (input: TInput) => Promise<TOutput>;
20
- } : Omit<{
21
- key: (input: TInput) => EntryKey;
22
- mutation: (input: TInput) => Promise<TOutput>;
23
- }, keyof U> & U;
6
+ export interface ProcedureUtils<TClientContext, TInput, TOutput, TError extends Error> {
7
+ queryOptions: <U extends QueryOptionsExtra<TClientContext, TInput, TOutput, TError>>(...opt: [options: U] | (undefined extends TInput & TClientContext ? [] : never)) => QueryOptions<TOutput, TError>;
8
+ mutationOptions: <U extends MutationOptionsExtra<TClientContext, TInput, TOutput, TError>>(...opt: [options: U] | (undefined extends TClientContext ? [] : never)) => MutationOptions<TInput, TOutput, TError>;
24
9
  }
25
- export declare function createProcedureUtils<TInput, TOutput, TClientContext>(client: ProcedureClient<TInput, TOutput, TClientContext>, path: string[]): ProcedureUtils<TInput, TOutput, TClientContext>;
10
+ export declare function createProcedureUtils<TClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
26
11
  //# sourceMappingURL=utils-procedure.d.ts.map
@@ -1,12 +1,12 @@
1
- import type { ProcedureClient, RouterClient } from '@orpc/server';
1
+ import type { Client, NestedClient } from '@orpc/contract';
2
2
  import { type GeneralUtils } from './utils-general';
3
3
  import { type ProcedureUtils } from './utils-procedure';
4
- export type RouterUtils<T extends RouterClient<any, any>> = T extends ProcedureClient<infer TInput, infer TOutput, infer TClientContext> ? ProcedureUtils<TInput, TOutput, TClientContext> & GeneralUtils<TInput> : {
5
- [K in keyof T]: T[K] extends RouterClient<any, any> ? RouterUtils<T[K]> : never;
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
6
  } & GeneralUtils<unknown>;
7
7
  /**
8
8
  * @param client - The client create form `@orpc/client`
9
9
  * @param path - The base path for query key
10
10
  */
11
- export declare function createRouterUtils<T extends RouterClient<any, any>>(client: T, path?: string[]): RouterUtils<T>;
11
+ export declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?: string[]): RouterUtils<T>;
12
12
  //# sourceMappingURL=utils-router.d.ts.map
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.e7d7758",
4
+ "version": "0.0.0-next.ed15210",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -35,12 +35,11 @@
35
35
  "peerDependencies": {
36
36
  "@pinia/colada": ">=0.13.1",
37
37
  "vue": ">=3.3.0",
38
- "@orpc/client": "0.0.0-next.e7d7758",
39
- "@orpc/contract": "0.0.0-next.e7d7758",
40
- "@orpc/server": "0.0.0-next.e7d7758"
38
+ "@orpc/client": "0.0.0-next.ed15210",
39
+ "@orpc/contract": "0.0.0-next.ed15210"
41
40
  },
42
41
  "dependencies": {
43
- "@orpc/server": "0.0.0-next.e7d7758"
42
+ "@orpc/server": "0.0.0-next.ed15210"
44
43
  },
45
44
  "devDependencies": {
46
45
  "@pinia/colada": "^0.13.1",