@orpc/vue-colada 0.0.0-next.d888fab → 0.0.0-next.d9485b0

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.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
2
  import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
- import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
3
+ import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
4
  import { MaybeRefOrGetter } from 'vue';
5
5
 
6
6
  interface BuildKeyOptions<TInput> {
7
- input?: TInput;
7
+ type?: 'query' | 'mutation';
8
+ input?: PartialDeep<TInput>;
8
9
  }
9
10
  declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
11
 
@@ -48,13 +49,13 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
48
49
  *
49
50
  * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-options-utility Pinia Colada Query Options Utility Docs}
50
51
  */
51
- queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
52
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): NoInfer<QueryOptions<TOutput, TError, UInitialData>>;
52
53
  /**
53
54
  * Generate options used for useMutation/...
54
55
  *
55
56
  * @see {@link https://orpc.unnoq.com/docs/pinia-colada#mutation-options Pinia Colada Mutation Options Docs}
56
57
  */
57
- mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
58
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
58
59
  }
59
60
  interface CreateProcedureUtilsOptions {
60
61
  path: string[];
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
2
  import { EntryKey, UseQueryOptions, UseMutationOptions, _EmptyObject } from '@pinia/colada';
3
- import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
3
+ import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
4
  import { MaybeRefOrGetter } from 'vue';
5
5
 
6
6
  interface BuildKeyOptions<TInput> {
7
- input?: TInput;
7
+ type?: 'query' | 'mutation';
8
+ input?: PartialDeep<TInput>;
8
9
  }
9
10
  declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
11
 
@@ -48,13 +49,13 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
48
49
  *
49
50
  * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-options-utility Pinia Colada Query Options Utility Docs}
50
51
  */
51
- queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
52
+ queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): NoInfer<QueryOptions<TOutput, TError, UInitialData>>;
52
53
  /**
53
54
  * Generate options used for useMutation/...
54
55
  *
55
56
  * @see {@link https://orpc.unnoq.com/docs/pinia-colada#mutation-options Pinia Colada Mutation Options Docs}
56
57
  */
57
- mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
58
+ mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
58
59
  }
59
60
  interface CreateProcedureUtilsOptions {
60
61
  path: string[];
package/dist/index.mjs CHANGED
@@ -1,15 +1,16 @@
1
1
  import { StandardRPCJsonSerializer } from '@orpc/client/standard';
2
- import { stringifyJSON } from '@orpc/shared';
3
2
  import { toValue, 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 StandardRPCJsonSerializer().serialize(options.input);
4
+ function buildKey(path, options = {}) {
5
+ const [json] = new StandardRPCJsonSerializer().serialize(options.input);
6
+ const withInput = json !== void 0 ? { input: json } : {};
7
+ const withType = options.type !== void 0 ? { type: options.type } : {};
10
8
  return [
11
- ...path,
12
- { input: stringifyJSON({ json, meta }) }
9
+ path,
10
+ {
11
+ ...withInput,
12
+ ...withType
13
+ }
13
14
  ];
14
15
  }
15
16
 
@@ -26,14 +27,14 @@ function createProcedureUtils(client, options) {
26
27
  call: client,
27
28
  queryOptions(...[{ input, context, ...rest } = {}]) {
28
29
  return {
29
- key: computed(() => buildKey(options.path, { input: toValue(input) })),
30
+ key: computed(() => buildKey(options.path, { type: "query", input: toValue(input) })),
30
31
  query: ({ signal }) => client(toValue(input), { signal, context: toValue(context) }),
31
32
  ...rest
32
33
  };
33
34
  },
34
35
  mutationOptions(...[{ context, ...rest } = {}]) {
35
36
  return {
36
- key: (input) => buildKey(options.path, { input }),
37
+ key: (input) => buildKey(options.path, { type: "mutation", input }),
37
38
  mutation: (input) => client(input, { context: toValue(context) }),
38
39
  ...rest
39
40
  };
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.d888fab",
4
+ "version": "0.0.0-next.d9485b0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -28,15 +28,17 @@
28
28
  "dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@pinia/colada": ">=0.13.5",
31
+ "@pinia/colada": ">=0.16.0",
32
32
  "vue": ">=3.3.0"
33
33
  },
34
34
  "dependencies": {
35
- "@orpc/shared": "0.0.0-next.d888fab",
36
- "@orpc/client": "0.0.0-next.d888fab"
35
+ "@orpc/client": "0.0.0-next.d9485b0",
36
+ "@orpc/shared": "0.0.0-next.d9485b0"
37
37
  },
38
38
  "devDependencies": {
39
- "pinia": "^3.0.0"
39
+ "@pinia/colada": "^0.16.1",
40
+ "pinia": "^3.0.2",
41
+ "vue": "^3.5.14"
40
42
  },
41
43
  "scripts": {
42
44
  "build": "unbuild",