@orpc/vue-colada 0.0.0-next.7b09958 → 0.0.0-next.7d3bd71
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
@@ -1,5 +1,5 @@
|
|
1
1
|
// src/key.ts
|
2
|
-
import { serializeRPCJson } from "@orpc/
|
2
|
+
import { serializeRPCJson } from "@orpc/client/rpc";
|
3
3
|
function buildKey(path, options) {
|
4
4
|
return [
|
5
5
|
...path,
|
@@ -7,16 +7,20 @@ function buildKey(path, options) {
|
|
7
7
|
];
|
8
8
|
}
|
9
9
|
|
10
|
-
//
|
11
|
-
function
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
// src/general-utils.ts
|
11
|
+
function createGeneralUtils(path) {
|
12
|
+
return {
|
13
|
+
key(options) {
|
14
|
+
return buildKey(path, options);
|
15
|
+
}
|
16
|
+
};
|
17
17
|
}
|
18
18
|
|
19
|
+
// src/procedure-utils.ts
|
20
|
+
import { computed } from "vue";
|
21
|
+
|
19
22
|
// src/utils.ts
|
23
|
+
import { isObject } from "@orpc/shared";
|
20
24
|
import { isRef } from "vue";
|
21
25
|
function unrefDeep(value) {
|
22
26
|
if (isRef(value)) {
|
@@ -34,19 +38,10 @@ function unrefDeep(value) {
|
|
34
38
|
return value;
|
35
39
|
}
|
36
40
|
|
37
|
-
// src/general-utils.ts
|
38
|
-
function createGeneralUtils(path) {
|
39
|
-
return {
|
40
|
-
key(options) {
|
41
|
-
return buildKey(path, unrefDeep(options));
|
42
|
-
}
|
43
|
-
};
|
44
|
-
}
|
45
|
-
|
46
41
|
// src/procedure-utils.ts
|
47
|
-
import { computed } from "vue";
|
48
42
|
function createProcedureUtils(client, path) {
|
49
43
|
return {
|
44
|
+
call: client,
|
50
45
|
queryOptions(...[{ input, context, ...rest } = {}]) {
|
51
46
|
return {
|
52
47
|
key: computed(() => buildKey(path, { input: unrefDeep(input) })),
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import type { EntryKey } from '@pinia/colada';
|
2
2
|
import type { BuildKeyOptions } from './key';
|
3
|
-
import type { MaybeRefDeep } from './types';
|
4
3
|
export interface GeneralUtils<TInput> {
|
5
|
-
key(options?:
|
4
|
+
key(options?: BuildKeyOptions<TInput>): EntryKey;
|
6
5
|
}
|
7
6
|
export declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
8
7
|
//# sourceMappingURL=general-utils.d.ts.map
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import type { Client } from '@orpc/
|
1
|
+
import type { Client, ClientContext } from '@orpc/client';
|
2
2
|
import type { MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import type { MutationOptions, MutationOptionsIn, QueryOptions, QueryOptionsIn } from './types';
|
4
|
-
export interface ProcedureUtils<TClientContext, TInput, TOutput, TError extends Error> {
|
4
|
+
export interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
|
5
|
+
call: Client<TClientContext, TInput, TOutput, TError>;
|
5
6
|
queryOptions(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError>>): QueryOptions<TOutput, TError>;
|
6
7
|
mutationOptions(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError>>): MutationOptions<TInput, TOutput, TError>;
|
7
8
|
}
|
8
|
-
export declare function createProcedureUtils<TClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
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>;
|
9
10
|
//# sourceMappingURL=procedure-utils.d.ts.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Client, NestedClient } from '@orpc/
|
1
|
+
import type { Client, NestedClient } from '@orpc/client';
|
2
2
|
import { type GeneralUtils } from './general-utils';
|
3
3
|
import { type ProcedureUtils } from './procedure-utils';
|
4
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> : {
|
package/dist/src/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { ClientContext } from '@orpc/client';
|
1
2
|
import type { AnyFunction, SetOptional } from '@orpc/shared';
|
2
3
|
import type { UseMutationOptions, UseQueryOptions } from '@pinia/colada';
|
3
4
|
import type { MaybeRef } from 'vue';
|
@@ -5,17 +6,17 @@ export type MaybeRefDeep<T> = MaybeRef<T extends AnyFunction ? T : T extends obj
|
|
5
6
|
[K in keyof T]: MaybeRefDeep<T[K]>;
|
6
7
|
} : T>;
|
7
8
|
export type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
|
8
|
-
export type QueryOptionsIn<TClientContext, TInput, TOutput, TError extends Error> = (undefined extends TInput ? {
|
9
|
+
export type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (undefined extends TInput ? {
|
9
10
|
input?: MaybeRefDeep<TInput>;
|
10
11
|
} : {
|
11
12
|
input: MaybeRefDeep<TInput>;
|
12
|
-
}) & (
|
13
|
+
}) & (Record<never, never> extends TClientContext ? {
|
13
14
|
context?: MaybeRefDeep<TClientContext>;
|
14
15
|
} : {
|
15
16
|
context: MaybeRefDeep<TClientContext>;
|
16
17
|
}) & SetOptional<UseQueryOptions<TOutput, TError>, 'key' | 'query'>;
|
17
18
|
export type QueryOptions<TOutput, TError extends Error> = UseQueryOptions<TOutput, TError>;
|
18
|
-
export type MutationOptionsIn<TClientContext, TInput, TOutput, TError extends Error> = (
|
19
|
+
export type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (Record<never, never> extends TClientContext ? {
|
19
20
|
context?: MaybeRefDeep<TClientContext>;
|
20
21
|
} : {
|
21
22
|
context: MaybeRefDeep<TClientContext>;
|
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.7d3bd71",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -33,13 +33,12 @@
|
|
33
33
|
"dist"
|
34
34
|
],
|
35
35
|
"peerDependencies": {
|
36
|
-
"@pinia/colada": "
|
37
|
-
"vue": ">=3.3.0"
|
38
|
-
"@orpc/client": "0.0.0-next.7b09958",
|
39
|
-
"@orpc/contract": "0.0.0-next.7b09958"
|
36
|
+
"@pinia/colada": ">=0.13.5",
|
37
|
+
"vue": ">=3.3.0"
|
40
38
|
},
|
41
39
|
"dependencies": {
|
42
|
-
"@orpc/
|
40
|
+
"@orpc/client": "0.0.0-next.7d3bd71",
|
41
|
+
"@orpc/shared": "0.0.0-next.7d3bd71"
|
43
42
|
},
|
44
43
|
"devDependencies": {
|
45
44
|
"pinia": "^2.3.0"
|