@orpc/shared 0.0.0-next.e98b833 → 0.0.0-next.ea0903c

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
@@ -37,7 +37,7 @@
37
37
  - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
38
38
  - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
39
39
  - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
40
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid), Pinia Colada, and more.
40
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
41
41
  - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
42
42
  - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
43
43
  - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
@@ -61,14 +61,25 @@ You can find the full documentation [here](https://orpc.unnoq.com).
61
61
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
62
62
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
63
63
  - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
64
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
64
65
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
65
66
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
66
67
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
68
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
69
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
67
70
 
68
71
  ## `@orpc/shared`
69
72
 
70
73
  Provides shared utilities for oRPC packages.
71
74
 
75
+ ## Sponsors
76
+
77
+ <p align="center">
78
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
79
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
80
+ </a>
81
+ </p>
82
+
72
83
  ## License
73
84
 
74
85
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { Promisable } from 'type-fest';
2
2
  export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
3
- export { group, guard, mapEntries, mapValues, omit, retry, trim } from 'radash';
3
+ export { group, guard, mapEntries, mapValues, omit } from 'radash';
4
+
5
+ type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
6
+ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>): T;
7
+
8
+ declare function toArray<T>(value: T | T[] | null | undefined): T[];
4
9
 
5
10
  type AnyFunction = (...args: any[]) => any;
6
11
  declare function once<T extends () => any>(fn: T): () => ReturnType<T>;
@@ -75,10 +80,10 @@ declare function isObject(value: unknown): value is Record<PropertyKey, unknown>
75
80
  declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
76
81
  declare function clone<T>(value: T): T;
77
82
 
78
- type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
79
83
  type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
84
+ type IntersectPick<T, U> = Pick<T, keyof T & keyof U>;
80
85
 
81
86
  type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
82
87
  declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): Promise<T extends Value<infer U, any> ? U : never>;
83
88
 
84
- export { type AnyFunction, type InterceptableOptions, type Interceptor, type InterceptorOptions, type MaybeOptionalOptions, type OmitChainMethodDeep, type OnFinishState, type Segment, type SetOptional, type Value, clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, stringifyJSON, toError, value };
89
+ export { type AnyFunction, type InterceptableOptions, type Interceptor, type InterceptorOptions, type IntersectPick, type MaybeOptionalOptions, type OmitChainMethodDeep, type OnFinishState, type Segment, type SetOptional, type Value, clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, stringifyJSON, toArray, toError, value };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { Promisable } from 'type-fest';
2
2
  export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
3
- export { group, guard, mapEntries, mapValues, omit, retry, trim } from 'radash';
3
+ export { group, guard, mapEntries, mapValues, omit } from 'radash';
4
+
5
+ type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
6
+ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>): T;
7
+
8
+ declare function toArray<T>(value: T | T[] | null | undefined): T[];
4
9
 
5
10
  type AnyFunction = (...args: any[]) => any;
6
11
  declare function once<T extends () => any>(fn: T): () => ReturnType<T>;
@@ -75,10 +80,10 @@ declare function isObject(value: unknown): value is Record<PropertyKey, unknown>
75
80
  declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
76
81
  declare function clone<T>(value: T): T;
77
82
 
78
- type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
79
83
  type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
84
+ type IntersectPick<T, U> = Pick<T, keyof T & keyof U>;
80
85
 
81
86
  type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
82
87
  declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): Promise<T extends Value<infer U, any> ? U : never>;
83
88
 
84
- export { type AnyFunction, type InterceptableOptions, type Interceptor, type InterceptorOptions, type MaybeOptionalOptions, type OmitChainMethodDeep, type OnFinishState, type Segment, type SetOptional, type Value, clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, stringifyJSON, toError, value };
89
+ export { type AnyFunction, type InterceptableOptions, type Interceptor, type InterceptorOptions, type IntersectPick, type MaybeOptionalOptions, type OmitChainMethodDeep, type OnFinishState, type Segment, type SetOptional, type Value, clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, stringifyJSON, toArray, toError, value };
package/dist/index.mjs CHANGED
@@ -1,4 +1,12 @@
1
- export { group, guard, mapEntries, mapValues, omit, retry, trim } from 'radash';
1
+ export { group, guard, mapEntries, mapValues, omit } from 'radash';
2
+
3
+ function resolveMaybeOptionalOptions(rest) {
4
+ return rest[0] ?? {};
5
+ }
6
+
7
+ function toArray(value) {
8
+ return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
9
+ }
2
10
 
3
11
  function toError(error) {
4
12
  if (error instanceof Error) {
@@ -135,4 +143,4 @@ function value(value2, ...args) {
135
143
  return value2;
136
144
  }
137
145
 
138
- export { clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, stringifyJSON, toError, value };
146
+ export { clone, findDeepMatches, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, stringifyJSON, toArray, toError, value };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/shared",
3
3
  "type": "module",
4
- "version": "0.0.0-next.e98b833",
4
+ "version": "0.0.0-next.ea0903c",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {