@orpc/shared 0.0.0-next.f56d2b3 → 0.0.0-next.f81b4a2
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 +86 -0
- package/dist/index.d.mts +93 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.mjs +152 -0
- package/package.json +6 -13
- package/dist/index.js +0 -198
- package/dist/src/chain.d.ts +0 -5
- package/dist/src/constants.d.ts +0 -3
- package/dist/src/error.d.ts +0 -2
- package/dist/src/function.d.ts +0 -2
- package/dist/src/hook.d.ts +0 -42
- package/dist/src/index.d.ts +0 -13
- package/dist/src/json.d.ts +0 -2
- package/dist/src/object.d.ts +0 -8
- package/dist/src/proxy.d.ts +0 -3
- package/dist/src/value.d.ts +0 -4
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
>
|
|
3
|
+
> `@orpc/shared` is an internal dependency of oRPC packages. It does not follow semver and may change at any time without notice.
|
|
4
|
+
> Please do not use it in your project.
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<h1></h1>
|
|
11
|
+
|
|
12
|
+
<div align="center">
|
|
13
|
+
<a href="https://codecov.io/gh/unnoq/orpc">
|
|
14
|
+
<img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@orpc/shared">
|
|
17
|
+
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fshared?logo=npm" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
|
|
20
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://discord.gg/TXEbwRBvQn">
|
|
23
|
+
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
28
|
+
|
|
29
|
+
**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.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Highlights
|
|
34
|
+
|
|
35
|
+
- **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
|
|
36
|
+
- **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
|
|
37
|
+
- **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
|
|
38
|
+
- **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
|
|
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, Svelte), Pinia Colada, and more.
|
|
41
|
+
- **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
|
|
42
|
+
- **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
|
|
43
|
+
- **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
|
|
44
|
+
- **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
|
|
45
|
+
- **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
|
|
46
|
+
- **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
|
|
47
|
+
- **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
|
|
48
|
+
- **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
|
|
49
|
+
- **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
|
|
50
|
+
- **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
You can find the full documentation [here](https://orpc.unnoq.com).
|
|
55
|
+
|
|
56
|
+
## Packages
|
|
57
|
+
|
|
58
|
+
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
59
|
+
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
60
|
+
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
61
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
62
|
+
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
63
|
+
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
64
|
+
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
65
|
+
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
|
66
|
+
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
67
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
68
|
+
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
69
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
70
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
71
|
+
|
|
72
|
+
## `@orpc/shared`
|
|
73
|
+
|
|
74
|
+
Provides shared utilities for oRPC packages.
|
|
75
|
+
|
|
76
|
+
## Sponsors
|
|
77
|
+
|
|
78
|
+
<p align="center">
|
|
79
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
|
80
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
|
81
|
+
</a>
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Promisable } from 'type-fest';
|
|
2
|
+
export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
|
|
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 extends readonly any[] ? T : Exclude<T, undefined | null>[];
|
|
9
|
+
declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
|
|
10
|
+
|
|
11
|
+
type AnyFunction = (...args: any[]) => any;
|
|
12
|
+
declare function once<T extends () => any>(fn: T): () => ReturnType<T>;
|
|
13
|
+
|
|
14
|
+
type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
15
|
+
[P in keyof Omit<T, K>]: T[P] extends AnyFunction ? ((...args: Parameters<T[P]>) => OmitChainMethodDeep<ReturnType<T[P]>, K>) : T[P];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
19
|
+
type IntersectPick<T, U> = Pick<T, keyof T & keyof U>;
|
|
20
|
+
type PromiseWithError<T, TError> = Promise<T> & {
|
|
21
|
+
__error?: {
|
|
22
|
+
type: TError;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The place where you can config the orpc types.
|
|
27
|
+
*
|
|
28
|
+
* - `throwableError` the error type that represent throwable errors should be `Error` or `null | undefined | {}` if you want more strict.
|
|
29
|
+
*/
|
|
30
|
+
interface Registry {
|
|
31
|
+
}
|
|
32
|
+
type ThrowableError = Registry extends {
|
|
33
|
+
throwableError: infer T;
|
|
34
|
+
} ? T : Error;
|
|
35
|
+
|
|
36
|
+
type InterceptableOptions = Record<string, any>;
|
|
37
|
+
type InterceptorOptions<TOptions extends InterceptableOptions, TResult, TError> = Omit<TOptions, 'next'> & {
|
|
38
|
+
next(options?: TOptions): PromiseWithError<TResult, TError>;
|
|
39
|
+
};
|
|
40
|
+
type Interceptor<TOptions extends InterceptableOptions, TResult, TError> = (options: InterceptorOptions<TOptions, TResult, TError>) => Promisable<TResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Can used for interceptors or middlewares
|
|
43
|
+
*/
|
|
44
|
+
declare function onStart<T, TOptions extends {
|
|
45
|
+
next(): any;
|
|
46
|
+
}, TRest extends any[]>(callback: NoInfer<(options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
47
|
+
/**
|
|
48
|
+
* Can used for interceptors or middlewares
|
|
49
|
+
*/
|
|
50
|
+
declare function onSuccess<T, TOptions extends {
|
|
51
|
+
next(): any;
|
|
52
|
+
}, TRest extends any[]>(callback: NoInfer<(result: Awaited<ReturnType<TOptions['next']>>, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
53
|
+
/**
|
|
54
|
+
* Can used for interceptors or middlewares
|
|
55
|
+
*/
|
|
56
|
+
declare function onError<T, TOptions extends {
|
|
57
|
+
next(): any;
|
|
58
|
+
}, TRest extends any[]>(callback: NoInfer<(error: ReturnType<TOptions['next']> extends PromiseWithError<any, infer E> ? E : ThrowableError, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
59
|
+
type OnFinishState<TResult, TError> = [error: TError, data: undefined, isSuccess: false] | [error: null, data: TResult, isSuccess: true];
|
|
60
|
+
/**
|
|
61
|
+
* Can used for interceptors or middlewares
|
|
62
|
+
*/
|
|
63
|
+
declare function onFinish<T, TOptions extends {
|
|
64
|
+
next(): any;
|
|
65
|
+
}, TRest extends any[]>(callback: NoInfer<(state: OnFinishState<Awaited<ReturnType<TOptions['next']>>, ReturnType<TOptions['next']> extends PromiseWithError<any, infer E> ? E : ThrowableError>, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
66
|
+
declare function intercept<TOptions extends InterceptableOptions, TResult, TError>(interceptors: Interceptor<TOptions, TResult, TError>[], options: NoInfer<TOptions>, main: NoInfer<(options: TOptions) => Promisable<TResult>>): Promise<TResult>;
|
|
67
|
+
|
|
68
|
+
declare function isAsyncIteratorObject(maybe: unknown): maybe is AsyncIteratorObject<any, any, any>;
|
|
69
|
+
|
|
70
|
+
declare function parseEmptyableJSON(text: string | null | undefined): unknown;
|
|
71
|
+
declare function stringifyJSON<T>(value: T): undefined extends T ? undefined | string : string;
|
|
72
|
+
|
|
73
|
+
type Segment = string | number;
|
|
74
|
+
declare function findDeepMatches(check: (value: unknown) => boolean, payload: unknown, segments?: Segment[], maps?: Segment[][], values?: unknown[]): {
|
|
75
|
+
maps: Segment[][];
|
|
76
|
+
values: unknown[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Check if the value is an object even it created by `Object.create(null)` or more tricky way.
|
|
80
|
+
*/
|
|
81
|
+
declare function isObject(value: unknown): value is Record<PropertyKey, unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* Check if the value satisfy a `object` type in typescript
|
|
84
|
+
*/
|
|
85
|
+
declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
|
|
86
|
+
declare function clone<T>(value: T): T;
|
|
87
|
+
declare function get(object: object, path: readonly string[]): unknown;
|
|
88
|
+
|
|
89
|
+
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
|
|
90
|
+
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): Promise<T extends Value<infer U, any> ? U : never>;
|
|
91
|
+
|
|
92
|
+
export { clone, findDeepMatches, get, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, splitInHalf, stringifyJSON, toArray, value };
|
|
93
|
+
export type { AnyFunction, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OmitChainMethodDeep, OnFinishState, PromiseWithError, Registry, Segment, SetOptional, ThrowableError, Value };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Promisable } from 'type-fest';
|
|
2
|
+
export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
|
|
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 extends readonly any[] ? T : Exclude<T, undefined | null>[];
|
|
9
|
+
declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
|
|
10
|
+
|
|
11
|
+
type AnyFunction = (...args: any[]) => any;
|
|
12
|
+
declare function once<T extends () => any>(fn: T): () => ReturnType<T>;
|
|
13
|
+
|
|
14
|
+
type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
15
|
+
[P in keyof Omit<T, K>]: T[P] extends AnyFunction ? ((...args: Parameters<T[P]>) => OmitChainMethodDeep<ReturnType<T[P]>, K>) : T[P];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
19
|
+
type IntersectPick<T, U> = Pick<T, keyof T & keyof U>;
|
|
20
|
+
type PromiseWithError<T, TError> = Promise<T> & {
|
|
21
|
+
__error?: {
|
|
22
|
+
type: TError;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The place where you can config the orpc types.
|
|
27
|
+
*
|
|
28
|
+
* - `throwableError` the error type that represent throwable errors should be `Error` or `null | undefined | {}` if you want more strict.
|
|
29
|
+
*/
|
|
30
|
+
interface Registry {
|
|
31
|
+
}
|
|
32
|
+
type ThrowableError = Registry extends {
|
|
33
|
+
throwableError: infer T;
|
|
34
|
+
} ? T : Error;
|
|
35
|
+
|
|
36
|
+
type InterceptableOptions = Record<string, any>;
|
|
37
|
+
type InterceptorOptions<TOptions extends InterceptableOptions, TResult, TError> = Omit<TOptions, 'next'> & {
|
|
38
|
+
next(options?: TOptions): PromiseWithError<TResult, TError>;
|
|
39
|
+
};
|
|
40
|
+
type Interceptor<TOptions extends InterceptableOptions, TResult, TError> = (options: InterceptorOptions<TOptions, TResult, TError>) => Promisable<TResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Can used for interceptors or middlewares
|
|
43
|
+
*/
|
|
44
|
+
declare function onStart<T, TOptions extends {
|
|
45
|
+
next(): any;
|
|
46
|
+
}, TRest extends any[]>(callback: NoInfer<(options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
47
|
+
/**
|
|
48
|
+
* Can used for interceptors or middlewares
|
|
49
|
+
*/
|
|
50
|
+
declare function onSuccess<T, TOptions extends {
|
|
51
|
+
next(): any;
|
|
52
|
+
}, TRest extends any[]>(callback: NoInfer<(result: Awaited<ReturnType<TOptions['next']>>, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
53
|
+
/**
|
|
54
|
+
* Can used for interceptors or middlewares
|
|
55
|
+
*/
|
|
56
|
+
declare function onError<T, TOptions extends {
|
|
57
|
+
next(): any;
|
|
58
|
+
}, TRest extends any[]>(callback: NoInfer<(error: ReturnType<TOptions['next']> extends PromiseWithError<any, infer E> ? E : ThrowableError, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
59
|
+
type OnFinishState<TResult, TError> = [error: TError, data: undefined, isSuccess: false] | [error: null, data: TResult, isSuccess: true];
|
|
60
|
+
/**
|
|
61
|
+
* Can used for interceptors or middlewares
|
|
62
|
+
*/
|
|
63
|
+
declare function onFinish<T, TOptions extends {
|
|
64
|
+
next(): any;
|
|
65
|
+
}, TRest extends any[]>(callback: NoInfer<(state: OnFinishState<Awaited<ReturnType<TOptions['next']>>, ReturnType<TOptions['next']> extends PromiseWithError<any, infer E> ? E : ThrowableError>, options: TOptions, ...rest: TRest) => Promisable<void>>): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>>;
|
|
66
|
+
declare function intercept<TOptions extends InterceptableOptions, TResult, TError>(interceptors: Interceptor<TOptions, TResult, TError>[], options: NoInfer<TOptions>, main: NoInfer<(options: TOptions) => Promisable<TResult>>): Promise<TResult>;
|
|
67
|
+
|
|
68
|
+
declare function isAsyncIteratorObject(maybe: unknown): maybe is AsyncIteratorObject<any, any, any>;
|
|
69
|
+
|
|
70
|
+
declare function parseEmptyableJSON(text: string | null | undefined): unknown;
|
|
71
|
+
declare function stringifyJSON<T>(value: T): undefined extends T ? undefined | string : string;
|
|
72
|
+
|
|
73
|
+
type Segment = string | number;
|
|
74
|
+
declare function findDeepMatches(check: (value: unknown) => boolean, payload: unknown, segments?: Segment[], maps?: Segment[][], values?: unknown[]): {
|
|
75
|
+
maps: Segment[][];
|
|
76
|
+
values: unknown[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Check if the value is an object even it created by `Object.create(null)` or more tricky way.
|
|
80
|
+
*/
|
|
81
|
+
declare function isObject(value: unknown): value is Record<PropertyKey, unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* Check if the value satisfy a `object` type in typescript
|
|
84
|
+
*/
|
|
85
|
+
declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
|
|
86
|
+
declare function clone<T>(value: T): T;
|
|
87
|
+
declare function get(object: object, path: readonly string[]): unknown;
|
|
88
|
+
|
|
89
|
+
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
|
|
90
|
+
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): Promise<T extends Value<infer U, any> ? U : never>;
|
|
91
|
+
|
|
92
|
+
export { clone, findDeepMatches, get, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, splitInHalf, stringifyJSON, toArray, value };
|
|
93
|
+
export type { AnyFunction, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OmitChainMethodDeep, OnFinishState, PromiseWithError, Registry, Segment, SetOptional, ThrowableError, Value };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
}
|
|
10
|
+
function splitInHalf(arr) {
|
|
11
|
+
const half = Math.ceil(arr.length / 2);
|
|
12
|
+
return [arr.slice(0, half), arr.slice(half)];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function once(fn) {
|
|
16
|
+
let cached;
|
|
17
|
+
return () => {
|
|
18
|
+
if (cached) {
|
|
19
|
+
return cached.result;
|
|
20
|
+
}
|
|
21
|
+
const result = fn();
|
|
22
|
+
cached = { result };
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onStart(callback) {
|
|
28
|
+
return async (options, ...rest) => {
|
|
29
|
+
await callback(options, ...rest);
|
|
30
|
+
return await options.next();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function onSuccess(callback) {
|
|
34
|
+
return async (options, ...rest) => {
|
|
35
|
+
const result = await options.next();
|
|
36
|
+
await callback(result, options, ...rest);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function onError(callback) {
|
|
41
|
+
return async (options, ...rest) => {
|
|
42
|
+
try {
|
|
43
|
+
return await options.next();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
await callback(error, options, ...rest);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function onFinish(callback) {
|
|
51
|
+
let state;
|
|
52
|
+
return async (options, ...rest) => {
|
|
53
|
+
try {
|
|
54
|
+
const result = await options.next();
|
|
55
|
+
state = [null, result, true];
|
|
56
|
+
return result;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
state = [error, void 0, false];
|
|
59
|
+
throw error;
|
|
60
|
+
} finally {
|
|
61
|
+
await callback(state, options, ...rest);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function intercept(interceptors, options, main) {
|
|
66
|
+
const next = async (options2, index) => {
|
|
67
|
+
const interceptor = interceptors[index];
|
|
68
|
+
if (!interceptor) {
|
|
69
|
+
return await main(options2);
|
|
70
|
+
}
|
|
71
|
+
return await interceptor({
|
|
72
|
+
...options2,
|
|
73
|
+
next: (newOptions = options2) => next(newOptions, index + 1)
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
return next(options, 0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isAsyncIteratorObject(maybe) {
|
|
80
|
+
if (!maybe || typeof maybe !== "object") {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return Symbol.asyncIterator in maybe && typeof maybe[Symbol.asyncIterator] === "function";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function parseEmptyableJSON(text) {
|
|
87
|
+
if (!text) {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
return JSON.parse(text);
|
|
91
|
+
}
|
|
92
|
+
function stringifyJSON(value) {
|
|
93
|
+
return JSON.stringify(value);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function findDeepMatches(check, payload, segments = [], maps = [], values = []) {
|
|
97
|
+
if (check(payload)) {
|
|
98
|
+
maps.push(segments);
|
|
99
|
+
values.push(payload);
|
|
100
|
+
} else if (Array.isArray(payload)) {
|
|
101
|
+
payload.forEach((v, i) => {
|
|
102
|
+
findDeepMatches(check, v, [...segments, i], maps, values);
|
|
103
|
+
});
|
|
104
|
+
} else if (isObject(payload)) {
|
|
105
|
+
for (const key in payload) {
|
|
106
|
+
findDeepMatches(check, payload[key], [...segments, key], maps, values);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { maps, values };
|
|
110
|
+
}
|
|
111
|
+
function isObject(value) {
|
|
112
|
+
if (!value || typeof value !== "object") {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const proto = Object.getPrototypeOf(value);
|
|
116
|
+
return proto === Object.prototype || !proto || !proto.constructor;
|
|
117
|
+
}
|
|
118
|
+
function isTypescriptObject(value) {
|
|
119
|
+
return !!value && (typeof value === "object" || typeof value === "function");
|
|
120
|
+
}
|
|
121
|
+
function clone(value) {
|
|
122
|
+
if (Array.isArray(value)) {
|
|
123
|
+
return value.map(clone);
|
|
124
|
+
}
|
|
125
|
+
if (isObject(value)) {
|
|
126
|
+
const result = {};
|
|
127
|
+
for (const key in value) {
|
|
128
|
+
result[key] = clone(value[key]);
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function get(object, path) {
|
|
135
|
+
let current = object;
|
|
136
|
+
for (const key of path) {
|
|
137
|
+
if (!isTypescriptObject(current)) {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
current = current[key];
|
|
141
|
+
}
|
|
142
|
+
return current;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function value(value2, ...args) {
|
|
146
|
+
if (typeof value2 === "function") {
|
|
147
|
+
return value2(...args);
|
|
148
|
+
}
|
|
149
|
+
return value2;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { clone, findDeepMatches, get, intercept, isAsyncIteratorObject, isObject, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, resolveMaybeOptionalOptions, splitInHalf, stringifyJSON, toArray, 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.
|
|
4
|
+
"version": "0.0.0-next.f81b4a2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -15,27 +15,20 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"import": "./dist/index.
|
|
20
|
-
"default": "./dist/index.
|
|
21
|
-
},
|
|
22
|
-
"./🔒/*": {
|
|
23
|
-
"types": "./dist/src/*.d.ts"
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"default": "./dist/index.mjs"
|
|
24
21
|
}
|
|
25
22
|
},
|
|
26
23
|
"files": [
|
|
27
|
-
"!**/*.map",
|
|
28
|
-
"!**/*.tsbuildinfo",
|
|
29
24
|
"dist"
|
|
30
25
|
],
|
|
31
26
|
"dependencies": {
|
|
32
|
-
"@standard-schema/spec": "1.0.0-beta.4",
|
|
33
|
-
"is-what": "^5.0.2",
|
|
34
27
|
"radash": "^12.1.0",
|
|
35
|
-
"type-fest": "^4.
|
|
28
|
+
"type-fest": "^4.39.1"
|
|
36
29
|
},
|
|
37
30
|
"scripts": {
|
|
38
|
-
"build": "
|
|
31
|
+
"build": "unbuild",
|
|
39
32
|
"build:watch": "pnpm run build --watch",
|
|
40
33
|
"type:check": "tsc -b"
|
|
41
34
|
}
|
package/dist/index.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
// src/constants.ts
|
|
2
|
-
var ORPC_HANDLER_HEADER = "x-orpc-handler";
|
|
3
|
-
var ORPC_HANDLER_VALUE = "orpc";
|
|
4
|
-
|
|
5
|
-
// src/error.ts
|
|
6
|
-
import { isPlainObject } from "is-what";
|
|
7
|
-
function toError(error) {
|
|
8
|
-
if (error instanceof Error) {
|
|
9
|
-
return error;
|
|
10
|
-
}
|
|
11
|
-
if (typeof error === "string") {
|
|
12
|
-
return new Error(error, { cause: error });
|
|
13
|
-
}
|
|
14
|
-
if (isPlainObject(error)) {
|
|
15
|
-
if ("message" in error && typeof error.message === "string") {
|
|
16
|
-
return new Error(error.message, { cause: error });
|
|
17
|
-
}
|
|
18
|
-
if ("name" in error && typeof error.name === "string") {
|
|
19
|
-
return new Error(error.name, { cause: error });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return new Error("Unknown error", { cause: error });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// src/hook.ts
|
|
26
|
-
async function executeWithHooks(options) {
|
|
27
|
-
const interceptors = convertToArray(options.hooks?.interceptor);
|
|
28
|
-
const onStarts = convertToArray(options.hooks?.onStart);
|
|
29
|
-
const onSuccesses = convertToArray(options.hooks?.onSuccess);
|
|
30
|
-
const onErrors = convertToArray(options.hooks?.onError);
|
|
31
|
-
const onFinishes = convertToArray(options.hooks?.onFinish);
|
|
32
|
-
let currentExecuteIndex = 0;
|
|
33
|
-
const next = async () => {
|
|
34
|
-
const execute = interceptors[currentExecuteIndex];
|
|
35
|
-
if (execute) {
|
|
36
|
-
currentExecuteIndex++;
|
|
37
|
-
return await execute(options.input, options.context, {
|
|
38
|
-
...options.meta,
|
|
39
|
-
next
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
let state = { status: "pending", input: options.input, output: void 0, error: void 0 };
|
|
43
|
-
try {
|
|
44
|
-
for (const onStart of onStarts) {
|
|
45
|
-
await onStart(state, options.context, options.meta);
|
|
46
|
-
}
|
|
47
|
-
const output = await options.execute();
|
|
48
|
-
state = { status: "success", input: options.input, output, error: void 0 };
|
|
49
|
-
for (let i = onSuccesses.length - 1; i >= 0; i--) {
|
|
50
|
-
await onSuccesses[i](state, options.context, options.meta);
|
|
51
|
-
}
|
|
52
|
-
} catch (e) {
|
|
53
|
-
state = { status: "error", input: options.input, error: toError(e), output: void 0 };
|
|
54
|
-
for (let i = onErrors.length - 1; i >= 0; i--) {
|
|
55
|
-
try {
|
|
56
|
-
await onErrors[i](state, options.context, options.meta);
|
|
57
|
-
} catch (e2) {
|
|
58
|
-
state = { status: "error", input: options.input, error: toError(e2), output: void 0 };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
for (let i = onFinishes.length - 1; i >= 0; i--) {
|
|
63
|
-
try {
|
|
64
|
-
await onFinishes[i](state, options.context, options.meta);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
state = { status: "error", input: options.input, error: toError(e), output: void 0 };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (state.status === "error") {
|
|
70
|
-
throw state.error;
|
|
71
|
-
}
|
|
72
|
-
return state.output;
|
|
73
|
-
};
|
|
74
|
-
return await next();
|
|
75
|
-
}
|
|
76
|
-
function convertToArray(value2) {
|
|
77
|
-
if (value2 === void 0) {
|
|
78
|
-
return [];
|
|
79
|
-
}
|
|
80
|
-
return Array.isArray(value2) ? value2 : [value2];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// src/json.ts
|
|
84
|
-
function parseJSONSafely(text) {
|
|
85
|
-
if (text === "")
|
|
86
|
-
return void 0;
|
|
87
|
-
try {
|
|
88
|
-
return JSON.parse(text);
|
|
89
|
-
} catch {
|
|
90
|
-
return text;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// src/object.ts
|
|
95
|
-
import { isPlainObject as isPlainObject2 } from "is-what";
|
|
96
|
-
function set(root, segments, value2) {
|
|
97
|
-
const ref = { root };
|
|
98
|
-
let currentRef = ref;
|
|
99
|
-
let preSegment = "root";
|
|
100
|
-
for (const segment of segments) {
|
|
101
|
-
currentRef = currentRef[preSegment];
|
|
102
|
-
preSegment = segment;
|
|
103
|
-
}
|
|
104
|
-
currentRef[preSegment] = value2;
|
|
105
|
-
return ref.root;
|
|
106
|
-
}
|
|
107
|
-
function get(root, segments) {
|
|
108
|
-
const ref = { root };
|
|
109
|
-
let currentRef = ref;
|
|
110
|
-
let preSegment = "root";
|
|
111
|
-
for (const segment of segments) {
|
|
112
|
-
if (typeof currentRef !== "object" && typeof currentRef !== "function" || currentRef === null) {
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
currentRef = currentRef[preSegment];
|
|
116
|
-
preSegment = segment;
|
|
117
|
-
}
|
|
118
|
-
if (typeof currentRef !== "object" && typeof currentRef !== "function" || currentRef === null) {
|
|
119
|
-
return void 0;
|
|
120
|
-
}
|
|
121
|
-
return currentRef[preSegment];
|
|
122
|
-
}
|
|
123
|
-
function findDeepMatches(check, payload, segments = [], maps = [], values = []) {
|
|
124
|
-
if (check(payload)) {
|
|
125
|
-
maps.push(segments);
|
|
126
|
-
values.push(payload);
|
|
127
|
-
} else if (Array.isArray(payload)) {
|
|
128
|
-
payload.forEach((v, i) => {
|
|
129
|
-
findDeepMatches(check, v, [...segments, i], maps, values);
|
|
130
|
-
});
|
|
131
|
-
} else if (isPlainObject2(payload)) {
|
|
132
|
-
for (const key in payload) {
|
|
133
|
-
findDeepMatches(check, payload[key], [...segments, key], maps, values);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return { maps, values };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// src/proxy.ts
|
|
140
|
-
function createCallableObject(obj, handler) {
|
|
141
|
-
const proxy = new Proxy(handler, {
|
|
142
|
-
has(target, key) {
|
|
143
|
-
return Reflect.has(obj, key) || Reflect.has(target, key);
|
|
144
|
-
},
|
|
145
|
-
ownKeys(target) {
|
|
146
|
-
return Array.from(new Set(Reflect.ownKeys(obj).concat(...Reflect.ownKeys(target))));
|
|
147
|
-
},
|
|
148
|
-
get(target, key) {
|
|
149
|
-
if (!Reflect.has(target, key) || Reflect.has(obj, key)) {
|
|
150
|
-
return Reflect.get(obj, key);
|
|
151
|
-
}
|
|
152
|
-
return Reflect.get(target, key);
|
|
153
|
-
},
|
|
154
|
-
defineProperty(_, key, descriptor) {
|
|
155
|
-
return Reflect.defineProperty(obj, key, descriptor);
|
|
156
|
-
},
|
|
157
|
-
set(_, key, value2) {
|
|
158
|
-
return Reflect.set(obj, key, value2);
|
|
159
|
-
},
|
|
160
|
-
deleteProperty(target, key) {
|
|
161
|
-
return Reflect.deleteProperty(target, key) && Reflect.deleteProperty(obj, key);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return proxy;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// src/value.ts
|
|
168
|
-
function value(value2, ...args) {
|
|
169
|
-
if (typeof value2 === "function") {
|
|
170
|
-
return value2(...args);
|
|
171
|
-
}
|
|
172
|
-
return value2;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// src/index.ts
|
|
176
|
-
import { isPlainObject as isPlainObject3 } from "is-what";
|
|
177
|
-
import { group, guard, mapEntries, mapValues, omit, trim } from "radash";
|
|
178
|
-
export {
|
|
179
|
-
ORPC_HANDLER_HEADER,
|
|
180
|
-
ORPC_HANDLER_VALUE,
|
|
181
|
-
convertToArray,
|
|
182
|
-
createCallableObject,
|
|
183
|
-
executeWithHooks,
|
|
184
|
-
findDeepMatches,
|
|
185
|
-
get,
|
|
186
|
-
group,
|
|
187
|
-
guard,
|
|
188
|
-
isPlainObject3 as isPlainObject,
|
|
189
|
-
mapEntries,
|
|
190
|
-
mapValues,
|
|
191
|
-
omit,
|
|
192
|
-
parseJSONSafely,
|
|
193
|
-
set,
|
|
194
|
-
toError,
|
|
195
|
-
trim,
|
|
196
|
-
value
|
|
197
|
-
};
|
|
198
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/chain.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnyFunction } from './function';
|
|
2
|
-
export type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
3
|
-
[P in keyof Omit<T, K>]: T[P] extends AnyFunction ? ((...args: Parameters<T[P]>) => OmitChainMethodDeep<ReturnType<T[P]>, K>) : T[P];
|
|
4
|
-
};
|
|
5
|
-
//# sourceMappingURL=chain.d.ts.map
|
package/dist/src/constants.d.ts
DELETED
package/dist/src/error.d.ts
DELETED
package/dist/src/function.d.ts
DELETED
package/dist/src/hook.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Arrayable, Promisable } from 'type-fest';
|
|
2
|
-
export type OnStartState<TInput> = {
|
|
3
|
-
status: 'pending';
|
|
4
|
-
input: TInput;
|
|
5
|
-
output: undefined;
|
|
6
|
-
error: undefined;
|
|
7
|
-
};
|
|
8
|
-
export type OnSuccessState<TInput, TOutput> = {
|
|
9
|
-
status: 'success';
|
|
10
|
-
input: TInput;
|
|
11
|
-
output: TOutput;
|
|
12
|
-
error: undefined;
|
|
13
|
-
};
|
|
14
|
-
export type OnErrorState<TInput> = {
|
|
15
|
-
status: 'error';
|
|
16
|
-
input: TInput;
|
|
17
|
-
output: undefined;
|
|
18
|
-
error: Error;
|
|
19
|
-
};
|
|
20
|
-
export interface BaseHookMeta<TOutput> {
|
|
21
|
-
next(): Promise<TOutput>;
|
|
22
|
-
}
|
|
23
|
-
export interface Hooks<TInput, TOutput, TContext, TMeta extends (Record<string, any> & {
|
|
24
|
-
next?: never;
|
|
25
|
-
}) | undefined> {
|
|
26
|
-
interceptor?: Arrayable<(input: TInput, context: TContext, meta: (TMeta extends undefined ? unknown : TMeta) & BaseHookMeta<TOutput>) => Promise<TOutput>>;
|
|
27
|
-
onStart?: Arrayable<(state: OnStartState<TInput>, context: TContext, meta: TMeta) => Promisable<void>>;
|
|
28
|
-
onSuccess?: Arrayable<(state: OnSuccessState<TInput, TOutput>, context: TContext, meta: TMeta) => Promisable<void>>;
|
|
29
|
-
onError?: Arrayable<(state: OnErrorState<TInput>, context: TContext, meta: TMeta) => Promisable<void>>;
|
|
30
|
-
onFinish?: Arrayable<(state: OnSuccessState<TInput, TOutput> | OnErrorState<TInput>, context: TContext, meta: TMeta) => Promisable<void>>;
|
|
31
|
-
}
|
|
32
|
-
export declare function executeWithHooks<TInput, TOutput, TContext, TMeta extends (Record<string, any> & {
|
|
33
|
-
next?: never;
|
|
34
|
-
}) | undefined>(options: {
|
|
35
|
-
hooks?: Hooks<TInput, TOutput, TContext, TMeta>;
|
|
36
|
-
input: TInput;
|
|
37
|
-
context: TContext;
|
|
38
|
-
meta: TMeta;
|
|
39
|
-
execute: BaseHookMeta<TOutput>['next'];
|
|
40
|
-
}): Promise<TOutput>;
|
|
41
|
-
export declare function convertToArray<T>(value: undefined | T | readonly T[]): readonly T[];
|
|
42
|
-
//# sourceMappingURL=hook.d.ts.map
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './chain';
|
|
2
|
-
export * from './constants';
|
|
3
|
-
export * from './error';
|
|
4
|
-
export * from './function';
|
|
5
|
-
export * from './hook';
|
|
6
|
-
export * from './json';
|
|
7
|
-
export * from './object';
|
|
8
|
-
export * from './proxy';
|
|
9
|
-
export * from './value';
|
|
10
|
-
export { isPlainObject } from 'is-what';
|
|
11
|
-
export { group, guard, mapEntries, mapValues, omit, trim } from 'radash';
|
|
12
|
-
export type * from 'type-fest';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/json.d.ts
DELETED
package/dist/src/object.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type Segment = string | number;
|
|
2
|
-
export declare function set(root: Readonly<Record<string, unknown> | unknown[]>, segments: Readonly<Segment[]>, value: unknown): unknown;
|
|
3
|
-
export declare function get(root: Readonly<Record<string, unknown> | unknown[]>, segments: Readonly<Segment[]>): unknown;
|
|
4
|
-
export declare function findDeepMatches(check: (value: unknown) => boolean, payload: unknown, segments?: Segment[], maps?: Segment[][], values?: unknown[]): {
|
|
5
|
-
maps: Segment[][];
|
|
6
|
-
values: unknown[];
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=object.d.ts.map
|
package/dist/src/proxy.d.ts
DELETED
package/dist/src/value.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from 'type-fest';
|
|
2
|
-
export type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
|
|
3
|
-
export declare function value<T extends Value<any, TArgs>, TArgs extends any[] = []>(value: T, ...args: TArgs): Promise<T extends Value<infer U, any> ? U : never>;
|
|
4
|
-
//# sourceMappingURL=value.d.ts.map
|