@orpc/client 0.0.0-next.fc1ae52 → 0.0.0-next.fc2dc8f
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 +6 -3
- package/dist/adapters/fetch/index.d.mts +5 -5
- package/dist/adapters/fetch/index.d.ts +5 -5
- package/dist/adapters/fetch/index.mjs +3 -2
- package/dist/adapters/message-port/index.d.mts +30 -9
- package/dist/adapters/message-port/index.d.ts +30 -9
- package/dist/adapters/message-port/index.mjs +25 -10
- package/dist/adapters/standard/index.d.mts +3 -3
- package/dist/adapters/standard/index.d.ts +3 -3
- package/dist/adapters/standard/index.mjs +3 -2
- package/dist/adapters/websocket/index.d.mts +5 -5
- package/dist/adapters/websocket/index.d.ts +5 -5
- package/dist/adapters/websocket/index.mjs +4 -3
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +4 -3
- package/dist/plugins/index.d.mts +56 -9
- package/dist/plugins/index.d.ts +56 -9
- package/dist/plugins/index.mjs +84 -5
- package/dist/shared/{client.BG98rYdO.d.ts → client.2jUAqzYU.d.ts} +1 -1
- package/dist/shared/{client.iscbSr1G.mjs → client.6DHUcvyB.mjs} +2 -1
- package/dist/shared/{client.CVVVqf1Y.d.ts → client.B3pNRBih.d.ts} +2 -2
- package/dist/shared/{client._Y_enhib.d.mts → client.BFAVy68H.d.mts} +2 -2
- package/dist/shared/client.BLtwTQUg.mjs +40 -0
- package/dist/shared/{client.Dy2hnYJS.mjs → client.CM-FejDR.mjs} +3 -40
- package/dist/shared/{client.Bwgm6dgk.d.mts → client.CpCa3si8.d.mts} +1 -1
- package/dist/shared/client.i2uoJbEp.d.mts +83 -0
- package/dist/shared/client.i2uoJbEp.d.ts +83 -0
- package/package.json +7 -7
- package/dist/shared/client.BOYsZIRq.d.mts +0 -29
- package/dist/shared/client.BOYsZIRq.d.ts +0 -29
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/unnoq/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
45
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
46
49
|
|
|
47
50
|
## Packages
|
|
48
51
|
|
|
@@ -63,7 +66,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
63
66
|
|
|
64
67
|
## `@orpc/client`
|
|
65
68
|
|
|
66
|
-
Consume your API on the client with type-safety. Read the [documentation](https://orpc.
|
|
69
|
+
Consume your API on the client with type-safety. Read the [documentation](https://orpc.dev/docs/client/client-side) for more information.
|
|
67
70
|
|
|
68
71
|
```ts
|
|
69
72
|
import { createORPCClient } from '@orpc/client'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Interceptor } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
3
3
|
import { ToFetchRequestOptions } from '@orpc/standard-server-fetch';
|
|
4
|
-
import { b as ClientContext, c as ClientOptions } from '../../shared/client.
|
|
5
|
-
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.
|
|
6
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
|
4
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.mjs';
|
|
5
|
+
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.CpCa3si8.mjs';
|
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.BFAVy68H.mjs';
|
|
7
7
|
|
|
8
8
|
interface LinkFetchPlugin<T extends ClientContext> extends StandardLinkPlugin<T> {
|
|
9
9
|
initRuntimeAdapter?(options: LinkFetchClientOptions<T>): void;
|
|
@@ -35,8 +35,8 @@ interface RPCLinkOptions<T extends ClientContext> extends LinkFetchClientOptions
|
|
|
35
35
|
/**
|
|
36
36
|
* The RPC Link communicates with the server using the RPC protocol.
|
|
37
37
|
*
|
|
38
|
-
* @see {@link https://orpc.
|
|
39
|
-
* @see {@link https://orpc.
|
|
38
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
39
|
+
* @see {@link https://orpc.dev/docs/advanced/rpc-protocol RPC Protocol Docs}
|
|
40
40
|
*/
|
|
41
41
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
42
42
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Interceptor } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
3
3
|
import { ToFetchRequestOptions } from '@orpc/standard-server-fetch';
|
|
4
|
-
import { b as ClientContext, c as ClientOptions } from '../../shared/client.
|
|
5
|
-
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.
|
|
6
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
|
4
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.js';
|
|
5
|
+
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.2jUAqzYU.js';
|
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.B3pNRBih.js';
|
|
7
7
|
|
|
8
8
|
interface LinkFetchPlugin<T extends ClientContext> extends StandardLinkPlugin<T> {
|
|
9
9
|
initRuntimeAdapter?(options: LinkFetchClientOptions<T>): void;
|
|
@@ -35,8 +35,8 @@ interface RPCLinkOptions<T extends ClientContext> extends LinkFetchClientOptions
|
|
|
35
35
|
/**
|
|
36
36
|
* The RPC Link communicates with the server using the RPC protocol.
|
|
37
37
|
*
|
|
38
|
-
* @see {@link https://orpc.
|
|
39
|
-
* @see {@link https://orpc.
|
|
38
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
39
|
+
* @see {@link https://orpc.dev/docs/advanced/rpc-protocol RPC Protocol Docs}
|
|
40
40
|
*/
|
|
41
41
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
42
42
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { toArray, intercept } from '@orpc/shared';
|
|
2
2
|
import { toFetchRequest, toStandardLazyResponse } from '@orpc/standard-server-fetch';
|
|
3
|
-
import { C as CompositeStandardLinkPlugin, c as StandardRPCLink } from '../../shared/client.
|
|
3
|
+
import { C as CompositeStandardLinkPlugin, c as StandardRPCLink } from '../../shared/client.6DHUcvyB.mjs';
|
|
4
4
|
import '@orpc/standard-server';
|
|
5
|
-
import '../../shared/client.
|
|
5
|
+
import '../../shared/client.CM-FejDR.mjs';
|
|
6
|
+
import '../../shared/client.BLtwTQUg.mjs';
|
|
6
7
|
|
|
7
8
|
class CompositeLinkFetchPlugin extends CompositeStandardLinkPlugin {
|
|
8
9
|
initRuntimeAdapter(options) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Value, Promisable } from '@orpc/shared';
|
|
1
2
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { f as
|
|
5
|
-
import '
|
|
3
|
+
import { DecodedRequestMessage } from '@orpc/standard-server-peer';
|
|
4
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.mjs';
|
|
5
|
+
import { f as StandardLinkClient } from '../../shared/client.CpCa3si8.mjs';
|
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.BFAVy68H.mjs';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The message port used by electron in main process
|
|
@@ -11,7 +12,7 @@ interface MessagePortMainLike {
|
|
|
11
12
|
on: <T extends string>(event: T, callback: (event?: {
|
|
12
13
|
data: any;
|
|
13
14
|
}) => void) => void;
|
|
14
|
-
postMessage: (data: any) => void;
|
|
15
|
+
postMessage: (data: any, transfer?: any[]) => void;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* The message port used by browser extension
|
|
@@ -29,13 +30,33 @@ type SupportedMessagePort = Pick<MessagePort, 'addEventListener' | 'postMessage'
|
|
|
29
30
|
/**
|
|
30
31
|
* Message port can support [The structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)
|
|
31
32
|
*/
|
|
32
|
-
type SupportedMessagePortData =
|
|
33
|
-
declare function postMessagePortMessage(port: SupportedMessagePort, data: SupportedMessagePortData): void;
|
|
33
|
+
type SupportedMessagePortData = any;
|
|
34
|
+
declare function postMessagePortMessage(port: SupportedMessagePort, data: SupportedMessagePortData, transfer?: any[]): void;
|
|
34
35
|
declare function onMessagePortMessage(port: SupportedMessagePort, callback: (data: SupportedMessagePortData) => void): void;
|
|
35
36
|
declare function onMessagePortClose(port: SupportedMessagePort, callback: () => void): void;
|
|
36
37
|
|
|
37
38
|
interface LinkMessagePortClientOptions {
|
|
38
39
|
port: SupportedMessagePort;
|
|
40
|
+
/**
|
|
41
|
+
* By default, oRPC serializes request/response messages to string/binary data before sending over message port.
|
|
42
|
+
* If needed, you can define the this option to utilize full power of [MessagePort: postMessage() method](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage),
|
|
43
|
+
* such as transferring ownership of objects to the other side or support unserializable objects like `OffscreenCanvas`.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* - return null | undefined to disable this feature
|
|
47
|
+
*
|
|
48
|
+
* @warning Make sure your message port supports `transfer` before using this feature.
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* experimental_transfer: (message, port) => {
|
|
52
|
+
* const transfer = deepFindTransferableObjects(message) // implement your own logic
|
|
53
|
+
* return transfer.length ? transfer : null // only enable when needed
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see {@link https://orpc.dev/docs/adapters/message-port#transfer Message Port Transfer Docs}
|
|
58
|
+
*/
|
|
59
|
+
experimental_transfer?: Value<Promisable<object[] | null | undefined>, [message: DecodedRequestMessage, port: SupportedMessagePort]>;
|
|
39
60
|
}
|
|
40
61
|
declare class LinkMessagePortClient<T extends ClientContext> implements StandardLinkClient<T> {
|
|
41
62
|
private readonly peer;
|
|
@@ -48,8 +69,8 @@ interface RPCLinkOptions<T extends ClientContext> extends Omit<StandardRPCLinkOp
|
|
|
48
69
|
/**
|
|
49
70
|
* The RPC Link for common message port implementations.
|
|
50
71
|
*
|
|
51
|
-
* @see {@link https://orpc.
|
|
52
|
-
* @see {@link https://orpc.
|
|
72
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
73
|
+
* @see {@link https://orpc.dev/docs/adapters/message-port Message Port Adapter Docs}
|
|
53
74
|
*/
|
|
54
75
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
55
76
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Value, Promisable } from '@orpc/shared';
|
|
1
2
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { f as
|
|
5
|
-
import '
|
|
3
|
+
import { DecodedRequestMessage } from '@orpc/standard-server-peer';
|
|
4
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.js';
|
|
5
|
+
import { f as StandardLinkClient } from '../../shared/client.2jUAqzYU.js';
|
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.B3pNRBih.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The message port used by electron in main process
|
|
@@ -11,7 +12,7 @@ interface MessagePortMainLike {
|
|
|
11
12
|
on: <T extends string>(event: T, callback: (event?: {
|
|
12
13
|
data: any;
|
|
13
14
|
}) => void) => void;
|
|
14
|
-
postMessage: (data: any) => void;
|
|
15
|
+
postMessage: (data: any, transfer?: any[]) => void;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* The message port used by browser extension
|
|
@@ -29,13 +30,33 @@ type SupportedMessagePort = Pick<MessagePort, 'addEventListener' | 'postMessage'
|
|
|
29
30
|
/**
|
|
30
31
|
* Message port can support [The structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)
|
|
31
32
|
*/
|
|
32
|
-
type SupportedMessagePortData =
|
|
33
|
-
declare function postMessagePortMessage(port: SupportedMessagePort, data: SupportedMessagePortData): void;
|
|
33
|
+
type SupportedMessagePortData = any;
|
|
34
|
+
declare function postMessagePortMessage(port: SupportedMessagePort, data: SupportedMessagePortData, transfer?: any[]): void;
|
|
34
35
|
declare function onMessagePortMessage(port: SupportedMessagePort, callback: (data: SupportedMessagePortData) => void): void;
|
|
35
36
|
declare function onMessagePortClose(port: SupportedMessagePort, callback: () => void): void;
|
|
36
37
|
|
|
37
38
|
interface LinkMessagePortClientOptions {
|
|
38
39
|
port: SupportedMessagePort;
|
|
40
|
+
/**
|
|
41
|
+
* By default, oRPC serializes request/response messages to string/binary data before sending over message port.
|
|
42
|
+
* If needed, you can define the this option to utilize full power of [MessagePort: postMessage() method](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage),
|
|
43
|
+
* such as transferring ownership of objects to the other side or support unserializable objects like `OffscreenCanvas`.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* - return null | undefined to disable this feature
|
|
47
|
+
*
|
|
48
|
+
* @warning Make sure your message port supports `transfer` before using this feature.
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* experimental_transfer: (message, port) => {
|
|
52
|
+
* const transfer = deepFindTransferableObjects(message) // implement your own logic
|
|
53
|
+
* return transfer.length ? transfer : null // only enable when needed
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see {@link https://orpc.dev/docs/adapters/message-port#transfer Message Port Transfer Docs}
|
|
58
|
+
*/
|
|
59
|
+
experimental_transfer?: Value<Promisable<object[] | null | undefined>, [message: DecodedRequestMessage, port: SupportedMessagePort]>;
|
|
39
60
|
}
|
|
40
61
|
declare class LinkMessagePortClient<T extends ClientContext> implements StandardLinkClient<T> {
|
|
41
62
|
private readonly peer;
|
|
@@ -48,8 +69,8 @@ interface RPCLinkOptions<T extends ClientContext> extends Omit<StandardRPCLinkOp
|
|
|
48
69
|
/**
|
|
49
70
|
* The RPC Link for common message port implementations.
|
|
50
71
|
*
|
|
51
|
-
* @see {@link https://orpc.
|
|
52
|
-
* @see {@link https://orpc.
|
|
72
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
73
|
+
* @see {@link https://orpc.dev/docs/adapters/message-port Message Port Adapter Docs}
|
|
53
74
|
*/
|
|
54
75
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
55
76
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '@orpc/
|
|
3
|
-
import { c as StandardRPCLink } from '../../shared/client.
|
|
1
|
+
import { value, isObject } from '@orpc/shared';
|
|
2
|
+
import { experimental_ClientPeerWithoutCodec, serializeRequestMessage, encodeRequestMessage, deserializeResponseMessage, decodeResponseMessage } from '@orpc/standard-server-peer';
|
|
3
|
+
import { c as StandardRPCLink } from '../../shared/client.6DHUcvyB.mjs';
|
|
4
4
|
import '@orpc/standard-server';
|
|
5
|
-
import '../../shared/client.
|
|
5
|
+
import '../../shared/client.CM-FejDR.mjs';
|
|
6
6
|
import '@orpc/standard-server-fetch';
|
|
7
|
+
import '../../shared/client.BLtwTQUg.mjs';
|
|
7
8
|
|
|
8
|
-
function postMessagePortMessage(port, data) {
|
|
9
|
-
|
|
9
|
+
function postMessagePortMessage(port, data, transfer) {
|
|
10
|
+
if (transfer) {
|
|
11
|
+
port.postMessage(data, transfer);
|
|
12
|
+
} else {
|
|
13
|
+
port.postMessage(data);
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
function onMessagePortMessage(port, callback) {
|
|
12
17
|
if ("addEventListener" in port) {
|
|
@@ -46,11 +51,21 @@ function onMessagePortClose(port, callback) {
|
|
|
46
51
|
class LinkMessagePortClient {
|
|
47
52
|
peer;
|
|
48
53
|
constructor(options) {
|
|
49
|
-
this.peer = new
|
|
50
|
-
|
|
54
|
+
this.peer = new experimental_ClientPeerWithoutCodec(async (message) => {
|
|
55
|
+
const [id, type, payload] = message;
|
|
56
|
+
const transfer = await value(options.experimental_transfer, message, options.port);
|
|
57
|
+
if (transfer) {
|
|
58
|
+
postMessagePortMessage(options.port, serializeRequestMessage(id, type, payload), transfer);
|
|
59
|
+
} else {
|
|
60
|
+
postMessagePortMessage(options.port, await encodeRequestMessage(id, type, payload));
|
|
61
|
+
}
|
|
51
62
|
});
|
|
52
63
|
onMessagePortMessage(options.port, async (message) => {
|
|
53
|
-
|
|
64
|
+
if (isObject(message)) {
|
|
65
|
+
await this.peer.message(deserializeResponseMessage(message));
|
|
66
|
+
} else {
|
|
67
|
+
await this.peer.message(await decodeResponseMessage(message));
|
|
68
|
+
}
|
|
54
69
|
});
|
|
55
70
|
onMessagePortClose(options.port, () => {
|
|
56
71
|
this.peer.close();
|
|
@@ -65,7 +80,7 @@ class LinkMessagePortClient {
|
|
|
65
80
|
class RPCLink extends StandardRPCLink {
|
|
66
81
|
constructor(options) {
|
|
67
82
|
const linkClient = new LinkMessagePortClient(options);
|
|
68
|
-
super(linkClient, { ...options, url: "orpc
|
|
83
|
+
super(linkClient, { ...options, url: "http://orpc" });
|
|
69
84
|
}
|
|
70
85
|
}
|
|
71
86
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.
|
|
2
|
-
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.
|
|
1
|
+
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.CpCa3si8.mjs';
|
|
2
|
+
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.BFAVy68H.mjs';
|
|
3
3
|
import { StandardHeaders } from '@orpc/standard-server';
|
|
4
|
-
import { H as HTTPPath } from '../../shared/client.
|
|
4
|
+
import { H as HTTPPath } from '../../shared/client.i2uoJbEp.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
declare function toHttpPath(path: readonly string[]): HTTPPath;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.
|
|
2
|
-
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.
|
|
1
|
+
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.2jUAqzYU.js';
|
|
2
|
+
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.B3pNRBih.js';
|
|
3
3
|
import { StandardHeaders } from '@orpc/standard-server';
|
|
4
|
-
import { H as HTTPPath } from '../../shared/client.
|
|
4
|
+
import { H as HTTPPath } from '../../shared/client.i2uoJbEp.js';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
declare function toHttpPath(path: readonly string[]): HTTPPath;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLink, d as StandardRPCLinkCodec, e as StandardRPCSerializer, g as getMalformedResponseErrorCode, t as toHttpPath, f as toStandardHeaders } from '../../shared/client.
|
|
1
|
+
export { C as CompositeStandardLinkPlugin, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLink, d as StandardRPCLinkCodec, e as StandardRPCSerializer, g as getMalformedResponseErrorCode, t as toHttpPath, f as toStandardHeaders } from '../../shared/client.6DHUcvyB.mjs';
|
|
2
2
|
import '@orpc/shared';
|
|
3
3
|
import '@orpc/standard-server';
|
|
4
|
-
import '../../shared/client.
|
|
4
|
+
import '../../shared/client.CM-FejDR.mjs';
|
|
5
5
|
import '@orpc/standard-server-fetch';
|
|
6
|
+
import '../../shared/client.BLtwTQUg.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
2
|
-
import { b as ClientContext, c as ClientOptions } from '../../shared/client.
|
|
3
|
-
import { f as StandardLinkClient } from '../../shared/client.
|
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
|
2
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.mjs';
|
|
3
|
+
import { f as StandardLinkClient } from '../../shared/client.CpCa3si8.mjs';
|
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.BFAVy68H.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
interface LinkWebsocketClientOptions {
|
|
@@ -18,8 +18,8 @@ interface RPCLinkOptions<T extends ClientContext> extends Omit<StandardRPCLinkOp
|
|
|
18
18
|
/**
|
|
19
19
|
* The RPC Link communicates with the server using the RPC protocol over WebSocket.
|
|
20
20
|
*
|
|
21
|
-
* @see {@link https://orpc.
|
|
22
|
-
* @see {@link https://orpc.
|
|
21
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
22
|
+
* @see {@link https://orpc.dev/docs/adapters/websocket WebSocket Adapter Docs}
|
|
23
23
|
*/
|
|
24
24
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
25
25
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
2
|
-
import { b as ClientContext, c as ClientOptions } from '../../shared/client.
|
|
3
|
-
import { f as StandardLinkClient } from '../../shared/client.
|
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
|
2
|
+
import { b as ClientContext, c as ClientOptions } from '../../shared/client.i2uoJbEp.js';
|
|
3
|
+
import { f as StandardLinkClient } from '../../shared/client.2jUAqzYU.js';
|
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.B3pNRBih.js';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
interface LinkWebsocketClientOptions {
|
|
@@ -18,8 +18,8 @@ interface RPCLinkOptions<T extends ClientContext> extends Omit<StandardRPCLinkOp
|
|
|
18
18
|
/**
|
|
19
19
|
* The RPC Link communicates with the server using the RPC protocol over WebSocket.
|
|
20
20
|
*
|
|
21
|
-
* @see {@link https://orpc.
|
|
22
|
-
* @see {@link https://orpc.
|
|
21
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link RPC Link Docs}
|
|
22
|
+
* @see {@link https://orpc.dev/docs/adapters/websocket WebSocket Adapter Docs}
|
|
23
23
|
*/
|
|
24
24
|
declare class RPCLink<T extends ClientContext> extends StandardRPCLink<T> {
|
|
25
25
|
constructor(options: RPCLinkOptions<T>);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { readAsBuffer } from '@orpc/shared';
|
|
2
2
|
import { ClientPeer } from '@orpc/standard-server-peer';
|
|
3
|
-
import { c as StandardRPCLink } from '../../shared/client.
|
|
3
|
+
import { c as StandardRPCLink } from '../../shared/client.6DHUcvyB.mjs';
|
|
4
4
|
import '@orpc/standard-server';
|
|
5
|
-
import '../../shared/client.
|
|
5
|
+
import '../../shared/client.CM-FejDR.mjs';
|
|
6
6
|
import '@orpc/standard-server-fetch';
|
|
7
|
+
import '../../shared/client.BLtwTQUg.mjs';
|
|
7
8
|
|
|
8
9
|
const WEBSOCKET_CONNECTING = 0;
|
|
9
10
|
class LinkWebsocketClient {
|
|
@@ -39,7 +40,7 @@ class LinkWebsocketClient {
|
|
|
39
40
|
class RPCLink extends StandardRPCLink {
|
|
40
41
|
constructor(options) {
|
|
41
42
|
const linkClient = new LinkWebsocketClient(options);
|
|
42
|
-
super(linkClient, { ...options, url: "orpc
|
|
43
|
+
super(linkClient, { ...options, url: "http://orpc" });
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { N as NestedClient, C as ClientLink, I as InferClientContext, a as ClientPromiseResult, b as ClientContext, F as FriendlyClientOptions, c as ClientOptions, d as Client, e as ClientRest } from './shared/client.
|
|
2
|
-
export { f as HTTPMethod, H as HTTPPath } from './shared/client.
|
|
1
|
+
import { N as NestedClient, C as ClientLink, I as InferClientContext, a as ClientPromiseResult, b as ClientContext, F as FriendlyClientOptions, c as ClientOptions, d as Client, e as ClientRest } from './shared/client.i2uoJbEp.mjs';
|
|
2
|
+
export { f as HTTPMethod, H as HTTPPath, h as InferClientBodyInputs, j as InferClientBodyOutputs, l as InferClientErrorUnion, k as InferClientErrors, g as InferClientInputs, i as InferClientOutputs } from './shared/client.i2uoJbEp.mjs';
|
|
3
3
|
import { MaybeOptionalOptions, ThrowableError, OnFinishState, Promisable, AsyncIteratorClass } from '@orpc/shared';
|
|
4
|
-
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
4
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
5
5
|
export { ErrorEvent } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
interface createORPCClientOptions {
|
|
@@ -13,7 +13,7 @@ interface createORPCClientOptions {
|
|
|
13
13
|
/**
|
|
14
14
|
* Create a oRPC client-side client from a link.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link https://orpc.
|
|
16
|
+
* @see {@link https://orpc.dev/docs/client/client-side Client-side Client Docs}
|
|
17
17
|
*/
|
|
18
18
|
declare function createORPCClient<T extends NestedClient<any>>(link: ClientLink<InferClientContext<T>>, options?: createORPCClientOptions): T;
|
|
19
19
|
|
|
@@ -156,7 +156,7 @@ type SafeResult<TOutput, TError> = [error: null, data: TOutput, isDefined: false
|
|
|
156
156
|
* Works like try/catch, but can infer error types.
|
|
157
157
|
*
|
|
158
158
|
* @info support both tuple `[error, data, isDefined, isSuccess]` and object `{ error, data, isDefined, isSuccess }` styles.
|
|
159
|
-
* @see {@link https://orpc.
|
|
159
|
+
* @see {@link https://orpc.dev/docs/client/error-handling Client Error Handling Docs}
|
|
160
160
|
*/
|
|
161
161
|
declare function safe<TOutput, TError = ThrowableError>(promise: ClientPromiseResult<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
|
|
162
162
|
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
@@ -202,18 +202,18 @@ type SafeClient<T extends NestedClient<any>> = T extends Client<infer UContext,
|
|
|
202
202
|
* const { error, data, isDefined } = await safeClient.doSomething({ id: '123' })
|
|
203
203
|
* ```
|
|
204
204
|
*
|
|
205
|
-
* @see {@link https://orpc.
|
|
205
|
+
* @see {@link https://orpc.dev/docs/client/error-handling#using-createsafeclient Safe Client Docs}
|
|
206
206
|
*/
|
|
207
207
|
declare function createSafeClient<T extends NestedClient<any>>(client: T): SafeClient<T>;
|
|
208
208
|
|
|
209
209
|
declare const ORPC_CLIENT_PACKAGE_NAME = "@orpc/client";
|
|
210
|
-
declare const ORPC_CLIENT_PACKAGE_VERSION = "0.0.0-next.
|
|
210
|
+
declare const ORPC_CLIENT_PACKAGE_VERSION = "0.0.0-next.fc2dc8f";
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
214
214
|
* based on the request path, input, and context.
|
|
215
215
|
*
|
|
216
|
-
* @see {@link https://orpc.
|
|
216
|
+
* @see {@link https://orpc.dev/docs/client/dynamic-link Dynamic Link Docs}
|
|
217
217
|
*/
|
|
218
218
|
declare class DynamicLink<TClientContext extends ClientContext> implements ClientLink<TClientContext> {
|
|
219
219
|
private readonly linkResolver;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { N as NestedClient, C as ClientLink, I as InferClientContext, a as ClientPromiseResult, b as ClientContext, F as FriendlyClientOptions, c as ClientOptions, d as Client, e as ClientRest } from './shared/client.
|
|
2
|
-
export { f as HTTPMethod, H as HTTPPath } from './shared/client.
|
|
1
|
+
import { N as NestedClient, C as ClientLink, I as InferClientContext, a as ClientPromiseResult, b as ClientContext, F as FriendlyClientOptions, c as ClientOptions, d as Client, e as ClientRest } from './shared/client.i2uoJbEp.js';
|
|
2
|
+
export { f as HTTPMethod, H as HTTPPath, h as InferClientBodyInputs, j as InferClientBodyOutputs, l as InferClientErrorUnion, k as InferClientErrors, g as InferClientInputs, i as InferClientOutputs } from './shared/client.i2uoJbEp.js';
|
|
3
3
|
import { MaybeOptionalOptions, ThrowableError, OnFinishState, Promisable, AsyncIteratorClass } from '@orpc/shared';
|
|
4
|
-
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
4
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
5
5
|
export { ErrorEvent } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
interface createORPCClientOptions {
|
|
@@ -13,7 +13,7 @@ interface createORPCClientOptions {
|
|
|
13
13
|
/**
|
|
14
14
|
* Create a oRPC client-side client from a link.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link https://orpc.
|
|
16
|
+
* @see {@link https://orpc.dev/docs/client/client-side Client-side Client Docs}
|
|
17
17
|
*/
|
|
18
18
|
declare function createORPCClient<T extends NestedClient<any>>(link: ClientLink<InferClientContext<T>>, options?: createORPCClientOptions): T;
|
|
19
19
|
|
|
@@ -156,7 +156,7 @@ type SafeResult<TOutput, TError> = [error: null, data: TOutput, isDefined: false
|
|
|
156
156
|
* Works like try/catch, but can infer error types.
|
|
157
157
|
*
|
|
158
158
|
* @info support both tuple `[error, data, isDefined, isSuccess]` and object `{ error, data, isDefined, isSuccess }` styles.
|
|
159
|
-
* @see {@link https://orpc.
|
|
159
|
+
* @see {@link https://orpc.dev/docs/client/error-handling Client Error Handling Docs}
|
|
160
160
|
*/
|
|
161
161
|
declare function safe<TOutput, TError = ThrowableError>(promise: ClientPromiseResult<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
|
|
162
162
|
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
@@ -202,18 +202,18 @@ type SafeClient<T extends NestedClient<any>> = T extends Client<infer UContext,
|
|
|
202
202
|
* const { error, data, isDefined } = await safeClient.doSomething({ id: '123' })
|
|
203
203
|
* ```
|
|
204
204
|
*
|
|
205
|
-
* @see {@link https://orpc.
|
|
205
|
+
* @see {@link https://orpc.dev/docs/client/error-handling#using-createsafeclient Safe Client Docs}
|
|
206
206
|
*/
|
|
207
207
|
declare function createSafeClient<T extends NestedClient<any>>(client: T): SafeClient<T>;
|
|
208
208
|
|
|
209
209
|
declare const ORPC_CLIENT_PACKAGE_NAME = "@orpc/client";
|
|
210
|
-
declare const ORPC_CLIENT_PACKAGE_VERSION = "0.0.0-next.
|
|
210
|
+
declare const ORPC_CLIENT_PACKAGE_VERSION = "0.0.0-next.fc2dc8f";
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
214
214
|
* based on the request path, input, and context.
|
|
215
215
|
*
|
|
216
|
-
* @see {@link https://orpc.
|
|
216
|
+
* @see {@link https://orpc.dev/docs/client/dynamic-link Dynamic Link Docs}
|
|
217
217
|
*/
|
|
218
218
|
declare class DynamicLink<TClientContext extends ClientContext> implements ClientLink<TClientContext> {
|
|
219
219
|
private readonly linkResolver;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { preventNativeAwait, isTypescriptObject } from '@orpc/shared';
|
|
2
|
-
export { AsyncIteratorClass, EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
3
|
-
import { i as isDefinedError } from './shared/client.
|
|
4
|
-
export { C as COMMON_ORPC_ERROR_DEFS, c as ORPCError, O as ORPC_CLIENT_PACKAGE_NAME, a as ORPC_CLIENT_PACKAGE_VERSION, g as createORPCErrorFromJson, b as fallbackORPCErrorMessage, f as fallbackORPCErrorStatus, e as isORPCErrorJson, d as isORPCErrorStatus,
|
|
2
|
+
export { AsyncIteratorClass, EventPublisher, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
3
|
+
import { i as isDefinedError } from './shared/client.CM-FejDR.mjs';
|
|
4
|
+
export { C as COMMON_ORPC_ERROR_DEFS, c as ORPCError, O as ORPC_CLIENT_PACKAGE_NAME, a as ORPC_CLIENT_PACKAGE_VERSION, g as createORPCErrorFromJson, b as fallbackORPCErrorMessage, f as fallbackORPCErrorStatus, e as isORPCErrorJson, d as isORPCErrorStatus, t as toORPCError } from './shared/client.CM-FejDR.mjs';
|
|
5
|
+
export { m as mapEventIterator } from './shared/client.BLtwTQUg.mjs';
|
|
5
6
|
export { ErrorEvent } from '@orpc/standard-server';
|
|
6
7
|
|
|
7
8
|
async function safe(promise) {
|