@orpc/vue-colada 0.0.0-next.c12be86 → 0.0.0-next.c6c659d
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/src/types.d.ts
CHANGED
@@ -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
|
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
|
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
1
|
import type { ProcedureClient } from '@orpc/server';
|
2
|
-
import type {
|
3
|
-
import type { EntryKey } from '@pinia/colada';
|
4
|
-
import type { ComputedRef } from 'vue';
|
5
|
-
import type { MutationOptions, QueryOptions, UseQueryFnContext } from './types';
|
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,
|
10
|
-
queryOptions: <U extends
|
11
|
-
|
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,
|
10
|
+
export declare function createProcedureUtils<TClientContext, TInput, TOutput, TError extends Error>(client: ProcedureClient<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
26
11
|
//# sourceMappingURL=utils-procedure.d.ts.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ProcedureClient, RouterClient } from '@orpc/server';
|
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
|
4
|
+
export type RouterUtils<T extends RouterClient<any, any>> = T extends ProcedureClient<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
5
5
|
[K in keyof T]: T[K] extends RouterClient<any, any> ? RouterUtils<T[K]> : never;
|
6
6
|
} & GeneralUtils<unknown>;
|
7
7
|
/**
|
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.
|
4
|
+
"version": "0.0.0-next.c6c659d",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -35,12 +35,12 @@
|
|
35
35
|
"peerDependencies": {
|
36
36
|
"@pinia/colada": ">=0.13.1",
|
37
37
|
"vue": ">=3.3.0",
|
38
|
-
"@orpc/
|
39
|
-
"@orpc/server": "0.0.0-next.
|
40
|
-
"@orpc/
|
38
|
+
"@orpc/client": "0.0.0-next.c6c659d",
|
39
|
+
"@orpc/server": "0.0.0-next.c6c659d",
|
40
|
+
"@orpc/contract": "0.0.0-next.c6c659d"
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
|
-
"@orpc/server": "0.0.0-next.
|
43
|
+
"@orpc/server": "0.0.0-next.c6c659d"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@pinia/colada": "^0.13.1",
|