@orpc/vue-colada 0.37.0 → 0.39.0
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 +14 -11
- package/dist/src/general-utils.d.ts +1 -2
- package/dist/src/procedure-utils.d.ts +4 -3
- package/dist/src/types.d.ts +4 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -7,13 +7,25 @@ function buildKey(path, options) {
|
|
7
7
|
];
|
8
8
|
}
|
9
9
|
|
10
|
+
// src/general-utils.ts
|
11
|
+
function createGeneralUtils(path) {
|
12
|
+
return {
|
13
|
+
key(options) {
|
14
|
+
return buildKey(path, options);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}
|
18
|
+
|
19
|
+
// src/procedure-utils.ts
|
20
|
+
import { computed } from "vue";
|
21
|
+
|
10
22
|
// ../shared/src/object.ts
|
11
23
|
function isObject(value) {
|
12
24
|
if (!value || typeof value !== "object") {
|
13
25
|
return false;
|
14
26
|
}
|
15
27
|
const proto = Object.getPrototypeOf(value);
|
16
|
-
return proto === Object.prototype || proto
|
28
|
+
return proto === Object.prototype || !proto || !proto.constructor;
|
17
29
|
}
|
18
30
|
|
19
31
|
// src/utils.ts
|
@@ -34,19 +46,10 @@ function unrefDeep(value) {
|
|
34
46
|
return value;
|
35
47
|
}
|
36
48
|
|
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
49
|
// src/procedure-utils.ts
|
47
|
-
import { computed } from "vue";
|
48
50
|
function createProcedureUtils(client, path) {
|
49
51
|
return {
|
52
|
+
call: client,
|
50
53
|
queryOptions(...[{ input, context, ...rest } = {}]) {
|
51
54
|
return {
|
52
55
|
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/contract';
|
1
|
+
import type { Client, ClientContext } from '@orpc/contract';
|
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
|
package/dist/src/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { ClientContext } from '@orpc/contract';
|
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.
|
4
|
+
"version": "0.39.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -35,11 +35,11 @@
|
|
35
35
|
"peerDependencies": {
|
36
36
|
"@pinia/colada": "^0.13.5",
|
37
37
|
"vue": ">=3.3.0",
|
38
|
-
"@orpc/client": "0.
|
39
|
-
"@orpc/contract": "0.
|
38
|
+
"@orpc/client": "0.39.0",
|
39
|
+
"@orpc/contract": "0.39.0"
|
40
40
|
},
|
41
41
|
"dependencies": {
|
42
|
-
"@orpc/server": "0.
|
42
|
+
"@orpc/server": "0.39.0"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
45
45
|
"pinia": "^2.3.0"
|