@orpc/vue-colada 0.0.0-next.f4d410a → 0.0.0-next.f4ed9ab

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/README.md CHANGED
@@ -21,28 +21,24 @@
21
21
 
22
22
  <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
23
23
 
24
- **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards, ensuring a smooth and enjoyable developer experience.
24
+ **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
25
25
 
26
26
  ---
27
27
 
28
28
  ## Highlights
29
29
 
30
- - **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
31
- - **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
32
- - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
- - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
- - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
- - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
- - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
- - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
39
- - **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
40
- - **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
41
- - **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
42
- - **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
43
- - **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
44
- - **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
45
- - **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
30
+ - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
+ - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
+ - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
34
+ - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
+ - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
+ - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
37
+ - **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
38
+ - **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
39
+ - **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
40
+ - **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
41
+ - **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
46
42
 
47
43
  ## Documentation
48
44
 
@@ -53,6 +49,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
53
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
54
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
55
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
56
  - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
@@ -60,6 +58,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
60
58
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
61
59
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
62
60
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
63
63
 
64
64
  ## `@orpc/vue-colada`
65
65
 
@@ -94,6 +94,14 @@ export function Setup() {
94
94
  }
95
95
  ```
96
96
 
97
+ ## Sponsors
98
+
99
+ <p align="center">
100
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
101
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
102
+ </a>
103
+ </p>
104
+
97
105
  ## License
98
106
 
99
107
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
package/dist/index.d.mts CHANGED
@@ -9,12 +9,17 @@ interface BuildKeyOptions<TInput> {
9
9
  declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
10
 
11
11
  interface GeneralUtils<TInput> {
12
+ /**
13
+ * Generate a query/mutation key for checking status, invalidate, set, get, etc.
14
+ *
15
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-mutation-key Pinia Colada Query/Mutation Key Docs}
16
+ */
12
17
  key(options?: BuildKeyOptions<TInput>): EntryKey;
13
18
  }
14
19
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
15
20
 
16
21
  type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
17
- type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
22
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
18
23
  input?: MaybeRefOrGetter<TInput>;
19
24
  } : {
20
25
  input: MaybeRefOrGetter<TInput>;
@@ -23,23 +28,38 @@ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TErro
23
28
  } : {
24
29
  context: MaybeRefOrGetter<TClientContext>;
25
30
  }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
26
- type QueryOptions<TOutput, TError extends Error, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
27
- type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
31
+ type QueryOptions<TOutput, TError, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
32
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
28
33
  context?: MaybeRefOrGetter<TClientContext>;
29
34
  } : {
30
35
  context: MaybeRefOrGetter<TClientContext>;
31
36
  }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
32
- type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
37
+ type MutationOptions<TInput, TOutput, TError, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
33
38
 
34
- interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
39
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
40
+ /**
41
+ * Calling corresponding procedure client
42
+ *
43
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#calling-procedure-clients Pinia Colada Calling Procedure Client Docs}
44
+ */
35
45
  call: Client<TClientContext, TInput, TOutput, TError>;
46
+ /**
47
+ * Generate options used for useQuery/...
48
+ *
49
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-options-utility Pinia Colada Query Options Utility Docs}
50
+ */
36
51
  queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
52
+ /**
53
+ * Generate options used for useMutation/...
54
+ *
55
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#mutation-options Pinia Colada Mutation Options Docs}
56
+ */
37
57
  mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
38
58
  }
39
59
  interface CreateProcedureUtilsOptions {
40
60
  path: string[];
41
61
  }
42
- declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
62
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
43
63
 
44
64
  type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
45
65
  [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
@@ -47,6 +67,13 @@ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientCo
47
67
  interface CreateRouterUtilsOptions {
48
68
  path?: string[];
49
69
  }
70
+ /**
71
+ * Create a router utils from a client.
72
+ *
73
+ * @info Both client-side and server-side clients are supported.
74
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada Pinia Colada Docs}
75
+ */
50
76
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
51
77
 
52
- export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
78
+ export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
79
+ export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptions, QueryOptionsIn, RouterUtils, UseQueryFnContext };
package/dist/index.d.ts CHANGED
@@ -9,12 +9,17 @@ interface BuildKeyOptions<TInput> {
9
9
  declare function buildKey<TInput>(path: string[], options?: BuildKeyOptions<TInput>): EntryKey;
10
10
 
11
11
  interface GeneralUtils<TInput> {
12
+ /**
13
+ * Generate a query/mutation key for checking status, invalidate, set, get, etc.
14
+ *
15
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-mutation-key Pinia Colada Query/Mutation Key Docs}
16
+ */
12
17
  key(options?: BuildKeyOptions<TInput>): EntryKey;
13
18
  }
14
19
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
15
20
 
16
21
  type UseQueryFnContext = Parameters<UseQueryOptions<any>['query']>[0];
17
- type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
22
+ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TInitialData extends TOutput | undefined> = (undefined extends TInput ? {
18
23
  input?: MaybeRefOrGetter<TInput>;
19
24
  } : {
20
25
  input: MaybeRefOrGetter<TInput>;
@@ -23,23 +28,38 @@ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TErro
23
28
  } : {
24
29
  context: MaybeRefOrGetter<TClientContext>;
25
30
  }) & SetOptional<QueryOptions<TOutput, TError, TInitialData>, 'key' | 'query'>;
26
- type QueryOptions<TOutput, TError extends Error, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
27
- type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
31
+ type QueryOptions<TOutput, TError, TInitialData extends TOutput | undefined> = UseQueryOptions<TOutput, TError, TInitialData>;
32
+ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext extends Record<any, any>> = (Record<never, never> extends TClientContext ? {
28
33
  context?: MaybeRefOrGetter<TClientContext>;
29
34
  } : {
30
35
  context: MaybeRefOrGetter<TClientContext>;
31
36
  }) & SetOptional<UseMutationOptions<TOutput, TInput, TError, TMutationContext>, 'mutation'>;
32
- type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
37
+ type MutationOptions<TInput, TOutput, TError, TMutationContext extends Record<any, any>> = UseMutationOptions<TOutput, TInput, TError, TMutationContext>;
33
38
 
34
- interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
39
+ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
40
+ /**
41
+ * Calling corresponding procedure client
42
+ *
43
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#calling-procedure-clients Pinia Colada Calling Procedure Client Docs}
44
+ */
35
45
  call: Client<TClientContext, TInput, TOutput, TError>;
46
+ /**
47
+ * Generate options used for useQuery/...
48
+ *
49
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#query-options-utility Pinia Colada Query Options Utility Docs}
50
+ */
36
51
  queryOptions<UInitialData extends TOutput | undefined = TOutput | undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, UInitialData>>): QueryOptions<TOutput, TError, UInitialData>;
52
+ /**
53
+ * Generate options used for useMutation/...
54
+ *
55
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada#mutation-options Pinia Colada Mutation Options Docs}
56
+ */
37
57
  mutationOptions<UMutationContext extends Record<any, any> = _EmptyObject>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
38
58
  }
39
59
  interface CreateProcedureUtilsOptions {
40
60
  path: string[];
41
61
  }
42
- declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
62
+ declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
43
63
 
44
64
  type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
45
65
  [K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
@@ -47,6 +67,13 @@ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientCo
47
67
  interface CreateRouterUtilsOptions {
48
68
  path?: string[];
49
69
  }
70
+ /**
71
+ * Create a router utils from a client.
72
+ *
73
+ * @info Both client-side and server-side clients are supported.
74
+ * @see {@link https://orpc.unnoq.com/docs/pinia-colada Pinia Colada Docs}
75
+ */
50
76
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
51
77
 
52
- export { type BuildKeyOptions, type CreateProcedureUtilsOptions, type CreateRouterUtilsOptions, type GeneralUtils, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptions, type QueryOptionsIn, type RouterUtils, type UseQueryFnContext, buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
78
+ export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueColadaUtils, createProcedureUtils, createRouterUtils };
79
+ export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptions, QueryOptionsIn, RouterUtils, UseQueryFnContext };
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.f4d410a",
4
+ "version": "0.0.0-next.f4ed9ab",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -32,11 +32,13 @@
32
32
  "vue": ">=3.3.0"
33
33
  },
34
34
  "dependencies": {
35
- "@orpc/client": "0.0.0-next.f4d410a",
36
- "@orpc/shared": "0.0.0-next.f4d410a"
35
+ "@orpc/shared": "0.0.0-next.f4ed9ab",
36
+ "@orpc/client": "0.0.0-next.f4ed9ab"
37
37
  },
38
38
  "devDependencies": {
39
- "pinia": "^2.3.0"
39
+ "@pinia/colada": "^0.15.3",
40
+ "pinia": "^3.0.2",
41
+ "vue": "^3.5.14"
40
42
  },
41
43
  "scripts": {
42
44
  "build": "unbuild",