@hyper-fetch/orpc 9.8.1 → 10.0.0

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.
Files changed (70) hide show
  1. package/README.md +35 -1
  2. package/__tests__/e2e/e2e.orpc-realtime-server.ts +181 -0
  3. package/__tests__/e2e/e2e.react-realtime.spec.tsx +181 -0
  4. package/__tests__/e2e/e2e.realtime.spec.ts +310 -0
  5. package/__tests__/features/socket/socket.schema.spec.ts +179 -0
  6. package/__tests__/features/stream-adapter/stream-adapter.environment.spec.ts +163 -0
  7. package/__tests__/features/stream-adapter/stream-adapter.lifecycle.spec.ts +509 -0
  8. package/__tests__/features/stream-adapter/stream-adapter.listener-lifecycle.spec.ts +291 -0
  9. package/__tests__/features/stream-adapter/stream-adapter.protocol.spec.ts +609 -0
  10. package/__tests__/features/stream-adapter/stream-adapter.subscriptions.spec.ts +270 -0
  11. package/__tests__/features/websocket-adapter/websocket-adapter.environment.spec.ts +147 -0
  12. package/__tests__/features/websocket-adapter/websocket-adapter.handshake-error.spec.ts +77 -0
  13. package/__tests__/features/websocket-adapter/websocket-adapter.lifecycle.spec.ts +326 -0
  14. package/__tests__/features/websocket-adapter/websocket-adapter.listener-lifecycle.spec.ts +222 -0
  15. package/__tests__/features/websocket-adapter/websocket-adapter.protocol.spec.ts +415 -0
  16. package/__tests__/features/websocket-adapter/websocket-adapter.subscriptions.spec.ts +172 -0
  17. package/__tests__/utils/controlled-fetch.ts +160 -0
  18. package/__tests__/utils/controlled-websocket.ts +140 -0
  19. package/__tests__/utils/socket-error.ts +7 -0
  20. package/__tests__/utils/stream-socket.ts +54 -0
  21. package/__tests__/utils/websocket-socket.ts +45 -0
  22. package/__tests__/vitest.setup.ts +20 -0
  23. package/dist/adapter/adapter.schema.d.ts +32 -0
  24. package/dist/adapter/adapter.schema.d.ts.map +1 -1
  25. package/dist/adapter/adapter.utils.d.ts +22 -4
  26. package/dist/adapter/adapter.utils.d.ts.map +1 -1
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.mjs +932 -11
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/socket/index.d.ts +3 -0
  32. package/dist/socket/index.d.ts.map +1 -0
  33. package/dist/socket/socket.subscriptions.d.ts +31 -0
  34. package/dist/socket/socket.subscriptions.d.ts.map +1 -0
  35. package/dist/socket/socket.types.d.ts +62 -0
  36. package/dist/socket/socket.types.d.ts.map +1 -0
  37. package/dist/socket/socket.utils.d.ts +56 -0
  38. package/dist/socket/socket.utils.d.ts.map +1 -0
  39. package/dist/stream-adapter/index.d.ts +3 -0
  40. package/dist/stream-adapter/index.d.ts.map +1 -0
  41. package/dist/stream-adapter/stream-adapter.d.ts +21 -0
  42. package/dist/stream-adapter/stream-adapter.d.ts.map +1 -0
  43. package/dist/stream-adapter/stream-adapter.types.d.ts +22 -0
  44. package/dist/stream-adapter/stream-adapter.types.d.ts.map +1 -0
  45. package/dist/stream-adapter/stream-adapter.utils.d.ts +22 -0
  46. package/dist/stream-adapter/stream-adapter.utils.d.ts.map +1 -0
  47. package/dist/websocket-adapter/index.d.ts +3 -0
  48. package/dist/websocket-adapter/index.d.ts.map +1 -0
  49. package/dist/websocket-adapter/websocket-adapter.d.ts +21 -0
  50. package/dist/websocket-adapter/websocket-adapter.d.ts.map +1 -0
  51. package/dist/websocket-adapter/websocket-adapter.types.d.ts +22 -0
  52. package/dist/websocket-adapter/websocket-adapter.types.d.ts.map +1 -0
  53. package/dist/websocket-adapter/websocket-adapter.utils.d.ts +35 -0
  54. package/dist/websocket-adapter/websocket-adapter.utils.d.ts.map +1 -0
  55. package/package.json +3 -1
  56. package/src/adapter/adapter.schema.ts +57 -0
  57. package/src/adapter/adapter.utils.ts +40 -10
  58. package/src/index.ts +3 -0
  59. package/src/socket/index.ts +2 -0
  60. package/src/socket/socket.subscriptions.ts +178 -0
  61. package/src/socket/socket.types.ts +64 -0
  62. package/src/socket/socket.utils.ts +110 -0
  63. package/src/stream-adapter/index.ts +2 -0
  64. package/src/stream-adapter/stream-adapter.ts +381 -0
  65. package/src/stream-adapter/stream-adapter.types.ts +31 -0
  66. package/src/stream-adapter/stream-adapter.utils.ts +98 -0
  67. package/src/websocket-adapter/index.ts +2 -0
  68. package/src/websocket-adapter/websocket-adapter.ts +417 -0
  69. package/src/websocket-adapter/websocket-adapter.types.ts +31 -0
  70. package/src/websocket-adapter/websocket-adapter.utils.ts +119 -0
@@ -0,0 +1,160 @@
1
+ /**
2
+ * A `fetch` stand-in driven by the test - the test plays the server and decides when the response comes, what the
3
+ * event stream sends and when it ends. No network and no timers inside, so it combines with fake timers freely.
4
+ *
5
+ * It follows the fetch behaviour that matters for the adapter:
6
+ * - aborting the signal before the response rejects the call with an `AbortError`
7
+ * - aborting the signal after the response errors the body stream, the pending read rejects
8
+ */
9
+ export class ControlledStreamCall {
10
+ /** Chunks pushed to the body, as the text the server wrote */
11
+ written: string[] = [];
12
+ /** `true` once the client aborted the call, before or after the response */
13
+ aborted = false;
14
+ responded = false;
15
+
16
+ private resolveResponse: (response: Response) => void = () => {};
17
+ private rejectResponse: (error: unknown) => void = () => {};
18
+ private streamController: ReadableStreamDefaultController<Uint8Array> | undefined;
19
+ private encoder = new TextEncoder();
20
+
21
+ readonly response: Promise<Response>;
22
+
23
+ constructor(
24
+ public url: string,
25
+ public init: RequestInit,
26
+ ) {
27
+ this.response = new Promise<Response>((resolve, reject) => {
28
+ this.resolveResponse = resolve;
29
+ this.rejectResponse = reject;
30
+ });
31
+
32
+ const { signal } = init;
33
+ signal?.addEventListener("abort", () => {
34
+ this.aborted = true;
35
+ const error = new DOMException("This operation was aborted", "AbortError");
36
+ if (!this.responded) {
37
+ this.rejectResponse(error);
38
+ return;
39
+ }
40
+ try {
41
+ this.streamController?.error(error);
42
+ } catch {
43
+ // The stream is closed already
44
+ }
45
+ });
46
+ }
47
+
48
+ get headers(): Record<string, string> {
49
+ return { ...(this.init.headers as Record<string, string>) };
50
+ }
51
+
52
+ /** The parsed JSON body - the serialized `{ json, meta }` input */
53
+ get body(): unknown {
54
+ return JSON.parse(this.init.body as string);
55
+ }
56
+
57
+ /** The server answers with an event stream, the test writes to it with `write` */
58
+ open({ status = 200, headers = {} }: { status?: number; headers?: Record<string, string> } = {}) {
59
+ const stream = new ReadableStream<Uint8Array>({
60
+ start: (controller) => {
61
+ this.streamController = controller;
62
+ },
63
+ });
64
+ this.responded = true;
65
+ this.resolveResponse(
66
+ new Response(stream, { status, headers: { "content-type": "text/event-stream", ...headers } }),
67
+ );
68
+ }
69
+
70
+ /** The server answers with a regular response */
71
+ respond({
72
+ status = 200,
73
+ body = "",
74
+ headers = { "content-type": "application/json" },
75
+ }: {
76
+ status?: number;
77
+ body?: string | null;
78
+ headers?: Record<string, string>;
79
+ } = {}) {
80
+ this.responded = true;
81
+ this.resolveResponse(new Response(body, { status, headers }));
82
+ }
83
+
84
+ /** The network fails before the response */
85
+ fail(error: unknown = new TypeError("fetch failed")) {
86
+ this.rejectResponse(error);
87
+ }
88
+
89
+ /** The server writes raw text to the event stream */
90
+ write(text: string) {
91
+ this.written.push(text);
92
+ this.writeBytes(this.encoder.encode(text));
93
+ }
94
+
95
+ /** The server writes raw bytes, e.g. half of a multi-byte character. Writes after the client aborted are lost. */
96
+ writeBytes(bytes: Uint8Array) {
97
+ if (!this.aborted) {
98
+ this.streamController?.enqueue(bytes);
99
+ }
100
+ }
101
+
102
+ /** The server sends one event in the oRPC format, `data` is the already serialized `{ json, meta }` value */
103
+ send({ event = "message", data, id, retry }: { event?: string; data?: unknown; id?: string; retry?: number }) {
104
+ let text = `event: ${event}\n`;
105
+ if (retry !== undefined) {
106
+ text += `retry: ${retry}\n`;
107
+ }
108
+ if (id !== undefined) {
109
+ text += `id: ${id}\n`;
110
+ }
111
+ if (data !== undefined) {
112
+ text += `data: ${JSON.stringify(data)}\n`;
113
+ }
114
+ this.write(`${text}\n`);
115
+ }
116
+
117
+ /** The server ends the stream */
118
+ close() {
119
+ this.streamController?.close();
120
+ }
121
+
122
+ /** The connection breaks in the middle of the stream */
123
+ break(error: unknown = new TypeError("terminated")) {
124
+ this.streamController?.error(error);
125
+ }
126
+ }
127
+
128
+ export const createControlledFetch = () => {
129
+ const calls: ControlledStreamCall[] = [];
130
+
131
+ const spy = vi.spyOn(globalThis, "fetch").mockImplementation((input, init) => {
132
+ const call = new ControlledStreamCall(String(input), init ?? {});
133
+ calls.push(call);
134
+ return call.response;
135
+ });
136
+
137
+ /** Calls that were not aborted - "how many streams does the client hold" */
138
+ const active = () => calls.filter((call) => !call.aborted);
139
+
140
+ const last = () => {
141
+ const call = calls.at(-1);
142
+ if (!call) {
143
+ throw new Error("[ControlledFetch] No call was made");
144
+ }
145
+ return call;
146
+ };
147
+
148
+ return { calls, active, last, spy };
149
+ };
150
+
151
+ /** Lets pending promise callbacks run - reading a stream takes many promise ticks */
152
+ export const flushPromises = async (rounds = 20) => {
153
+ for (let i = 0; i < rounds; i += 1) {
154
+ // Real timers stay untouched, only the microtask queue is drained
155
+ // eslint-disable-next-line no-await-in-loop
156
+ await new Promise<void>((resolve) => {
157
+ queueMicrotask(resolve);
158
+ });
159
+ }
160
+ };
@@ -0,0 +1,140 @@
1
+ /**
2
+ * A WebSocket stand-in that does nothing on its own - the test plays the oRPC server and decides when the
3
+ * connection opens, which messages arrive and when it closes. No timers and no network inside.
4
+ *
5
+ * It follows the browser behaviour that matters for the adapter:
6
+ * - `close()` on a connection that is still CONNECTING fails it with `error` + `close` (code 1006)
7
+ * - `close()` on an OPEN connection ends with a clean `close` carrying the requested code
8
+ * - `send()` throws while the connection is not OPEN
9
+ */
10
+ export class ControlledWebSocket extends EventTarget {
11
+ static readonly CONNECTING = 0;
12
+ static readonly OPEN = 1;
13
+ static readonly CLOSING = 2;
14
+ static readonly CLOSED = 3;
15
+
16
+ /** Every instance created since the last `install`, in creation order */
17
+ static instances: ControlledWebSocket[] = [];
18
+ /** When set, the next constructor call throws it - like an invalid url does in the browser */
19
+ static constructorError: Error | null = null;
20
+
21
+ static get last(): ControlledWebSocket {
22
+ const instance = ControlledWebSocket.instances.at(-1);
23
+ if (!instance) {
24
+ throw new Error("[ControlledWebSocket] No WebSocket was created");
25
+ }
26
+ return instance;
27
+ }
28
+
29
+ readonly CONNECTING = 0;
30
+ readonly OPEN = 1;
31
+ readonly CLOSING = 2;
32
+ readonly CLOSED = 3;
33
+
34
+ readyState: number = ControlledWebSocket.CONNECTING;
35
+ binaryType: BinaryType = "blob";
36
+ /** Frames passed to `send`, in order */
37
+ sent: string[] = [];
38
+ /** Arguments of client-side `close()` calls */
39
+ closeCalls: { code?: number; reason?: string }[] = [];
40
+
41
+ constructor(
42
+ public url: string,
43
+ public protocols?: string | string[],
44
+ ) {
45
+ super();
46
+ if (ControlledWebSocket.constructorError) {
47
+ const error = ControlledWebSocket.constructorError;
48
+ ControlledWebSocket.constructorError = null;
49
+ throw error;
50
+ }
51
+ ControlledWebSocket.instances.push(this);
52
+ }
53
+
54
+ send(frame: string) {
55
+ if (this.readyState !== ControlledWebSocket.OPEN) {
56
+ throw new Error("[ControlledWebSocket] Cannot send - the connection is not open");
57
+ }
58
+ this.sent.push(frame);
59
+ }
60
+
61
+ close(code?: number, reason?: string) {
62
+ this.closeCalls.push({ code, reason });
63
+ if (this.readyState === ControlledWebSocket.CLOSING || this.readyState === ControlledWebSocket.CLOSED) {
64
+ return;
65
+ }
66
+ const wasConnecting = this.readyState === ControlledWebSocket.CONNECTING;
67
+ this.readyState = ControlledWebSocket.CLOSED;
68
+ if (wasConnecting) {
69
+ this.dispatchEvent(new Event("error"));
70
+ this.dispatchEvent(new CloseEvent("close", { code: 1006, reason: "", wasClean: false }));
71
+ return;
72
+ }
73
+ this.dispatchEvent(new CloseEvent("close", { code: code ?? 1005, reason: reason ?? "", wasClean: true }));
74
+ }
75
+
76
+ // Server side - driven by the test
77
+
78
+ /** The server accepts the connection */
79
+ serverOpen() {
80
+ this.readyState = ControlledWebSocket.OPEN;
81
+ this.dispatchEvent(new Event("open"));
82
+ }
83
+
84
+ /** The server sends a raw frame */
85
+ serverSend(data: unknown) {
86
+ this.dispatchEvent(new MessageEvent("message", { data }));
87
+ }
88
+
89
+ /** The server sends a message of the oRPC peer protocol */
90
+ serverMessage(message: unknown) {
91
+ this.serverSend(JSON.stringify(message));
92
+ }
93
+
94
+ /** The server answers a request with the event iterator headers - the subscription runs */
95
+ serverStartIterator(id: string) {
96
+ this.serverMessage({ i: id, p: { h: { "content-type": "text/event-stream" } } });
97
+ }
98
+
99
+ /** The server sends an event of the iterator, `data` is the already serialized `{ json, meta }` value */
100
+ serverEvent(id: string, { event = "message", data, meta }: { event?: string; data?: unknown; meta?: unknown }) {
101
+ this.serverMessage({ i: id, t: 3, p: { e: event, d: data, m: meta } });
102
+ }
103
+
104
+ /**
105
+ * The handshake fails the way Node.js 22 reports it: an `error` event and no `close` - the socket stays CONNECTING.
106
+ * Browsers and newer Node.js versions always follow the error with a close event.
107
+ */
108
+ serverRefuseWithoutClose() {
109
+ this.dispatchEvent(new Event("error"));
110
+ }
111
+
112
+ /** The server (or the network) closes the connection */
113
+ serverClose({ code = 1006, reason = "" }: { code?: number; reason?: string } = {}) {
114
+ this.readyState = ControlledWebSocket.CLOSED;
115
+ this.dispatchEvent(new CloseEvent("close", { code, reason, wasClean: code === 1000 }));
116
+ }
117
+
118
+ /** Frames sent by the client, parsed */
119
+ get messages(): { i: string; t?: number; p?: { u: string; b: unknown; h?: Record<string, string> } }[] {
120
+ return this.sent.map((frame) => JSON.parse(frame));
121
+ }
122
+
123
+ /** Request messages sent by the client */
124
+ get requests() {
125
+ return this.messages.filter((message) => message.t === undefined);
126
+ }
127
+
128
+ /** Ids of the requests the client aborted */
129
+ get aborts() {
130
+ return this.messages.filter((message) => message.t === 4).map((message) => message.i);
131
+ }
132
+ }
133
+
134
+ /** Replaces the global WebSocket for the current test. Call `vi.unstubAllGlobals()` in `afterEach`. */
135
+ export const installControlledWebSocket = () => {
136
+ ControlledWebSocket.instances = [];
137
+ ControlledWebSocket.constructorError = null;
138
+ vi.stubGlobal("WebSocket", ControlledWebSocket);
139
+ return ControlledWebSocket;
140
+ };
@@ -0,0 +1,7 @@
1
+ import { OrpcSocketError } from "../../src/socket";
2
+
3
+ /** Asserts that the reported error is an `OrpcSocketError` and returns it typed */
4
+ export const asSocketError = (error: unknown): OrpcSocketError => {
5
+ expect(error).toBeInstanceOf(OrpcSocketError);
6
+ return error as OrpcSocketError;
7
+ };
@@ -0,0 +1,54 @@
1
+ import type { AppManager } from "@hyper-fetch/core";
2
+ import { Socket } from "@hyper-fetch/sockets";
3
+ import type { StandardRPCCustomJsonSerializer } from "@orpc/client/standard";
4
+
5
+ import { createOrpcSerializer } from "../../src/adapter";
6
+ import type { OrpcStreamAdapterOptionsType, OrpcStreamAdapterType } from "../../src/stream-adapter";
7
+ import { OrpcStreamAdapter } from "../../src/stream-adapter";
8
+
9
+ export type Planet = { id: number; name: string };
10
+
11
+ export const streamUrl = "http://localhost:3000/rpc";
12
+
13
+ /** The value in the `{ json, meta }` form the server sends */
14
+ export const serialize = (value: unknown, customJsonSerializers?: StandardRPCCustomJsonSerializer[]) => {
15
+ return createOrpcSerializer(customJsonSerializers).serialize(value);
16
+ };
17
+
18
+ export const createStreamSocket = ({
19
+ adapterOptions,
20
+ reconnect,
21
+ reconnectTime,
22
+ connectionTimeout,
23
+ appManager,
24
+ customJsonSerializers,
25
+ adapter = OrpcStreamAdapter({ customJsonSerializers }),
26
+ url = streamUrl,
27
+ }: {
28
+ adapterOptions?: OrpcStreamAdapterOptionsType;
29
+ reconnect?: number;
30
+ reconnectTime?: number;
31
+ connectionTimeout?: number;
32
+ appManager?: AppManager;
33
+ adapter?: OrpcStreamAdapterType;
34
+ customJsonSerializers?: StandardRPCCustomJsonSerializer[];
35
+ url?: string;
36
+ } = {}) => {
37
+ const socket = new Socket({
38
+ url,
39
+ adapter,
40
+ adapterOptions,
41
+ reconnect,
42
+ reconnectTime,
43
+ connectionTimeout,
44
+ appManager: appManager && (() => appManager),
45
+ });
46
+ const errors: Error[] = [];
47
+ socket.events.onError(({ error }) => {
48
+ errors.push(error as Error);
49
+ });
50
+
51
+ const onUpdate = socket.createListener<Planet, { id: number }>()({ topic: "planet/onUpdate" });
52
+
53
+ return { socket, errors, onUpdate };
54
+ };
@@ -0,0 +1,45 @@
1
+ import type { AppManager } from "@hyper-fetch/core";
2
+ import { Socket } from "@hyper-fetch/sockets";
3
+ import type { StandardRPCCustomJsonSerializer } from "@orpc/client/standard";
4
+
5
+ import type { OrpcWebsocketAdapterOptionsType, OrpcWebsocketAdapterType } from "../../src/websocket-adapter";
6
+ import { OrpcWebsocketAdapter } from "../../src/websocket-adapter";
7
+ import type { Planet } from "./stream-socket";
8
+
9
+ export const websocketUrl = "ws://localhost:3000/rpc";
10
+
11
+ export const createWebsocketSocket = ({
12
+ adapterOptions,
13
+ reconnect,
14
+ reconnectTime,
15
+ connectionTimeout,
16
+ appManager,
17
+ customJsonSerializers,
18
+ adapter = OrpcWebsocketAdapter({ customJsonSerializers }),
19
+ }: {
20
+ adapterOptions?: OrpcWebsocketAdapterOptionsType;
21
+ reconnect?: number;
22
+ reconnectTime?: number;
23
+ connectionTimeout?: number;
24
+ appManager?: AppManager;
25
+ adapter?: OrpcWebsocketAdapterType;
26
+ customJsonSerializers?: StandardRPCCustomJsonSerializer[];
27
+ } = {}) => {
28
+ const socket = new Socket({
29
+ url: websocketUrl,
30
+ adapter,
31
+ adapterOptions,
32
+ reconnect,
33
+ reconnectTime,
34
+ connectionTimeout,
35
+ appManager: appManager && (() => appManager),
36
+ });
37
+ const errors: Error[] = [];
38
+ socket.events.onError(({ error }) => {
39
+ errors.push(error as Error);
40
+ });
41
+
42
+ const onUpdate = socket.createListener<Planet, { id: number }>()({ topic: "planet/onUpdate" });
43
+
44
+ return { socket, errors, onUpdate };
45
+ };
@@ -3,3 +3,23 @@ import * as matchers from "jest-extended";
3
3
  import { expect } from "vitest";
4
4
 
5
5
  expect.extend(matchers);
6
+
7
+ /**
8
+ * Node.js 22 (the CI runtime) has no global `CloseEvent` - it came in Node.js 23. The controlled WebSocket of the
9
+ * tests dispatches close events with it, the same way the browser and newer Node.js versions do.
10
+ */
11
+ if (globalThis.CloseEvent === undefined) {
12
+ class TestCloseEvent extends Event {
13
+ readonly code: number;
14
+ readonly reason: string;
15
+ readonly wasClean: boolean;
16
+
17
+ constructor(type: string, init: CloseEventInit = {}) {
18
+ super(type, init);
19
+ this.code = init.code ?? 0;
20
+ this.reason = init.reason ?? "";
21
+ this.wasClean = init.wasClean ?? false;
22
+ }
23
+ }
24
+ globalThis.CloseEvent = TestCloseEvent as typeof globalThis.CloseEvent;
25
+ }
@@ -1,4 +1,5 @@
1
1
  import { RequestModel } from '@hyper-fetch/core';
2
+ import { ListenerModel } from '@hyper-fetch/sockets';
2
3
  import { Client, NestedClient, ORPCError } from '@orpc/client';
3
4
  import { AnyRouter, RouterClient } from '@orpc/server';
4
5
  import { OrpcErrorType } from './adapter.types';
@@ -46,5 +47,36 @@ type OrpcRouterClient<Router> = Router extends OrpcAnyClient ? never : Router ex
46
47
  * const { data } = await api.planet.find.$query.setPayload({ id: 1 }).send();
47
48
  */
48
49
  export type OrpcSchema<Router extends AnyRouter | NestedClient<any>> = OrpcClientSchema<OrpcRouterClient<Router>, "">;
50
+ /** The yielded value of an event iterator output, `never` for any other output */
51
+ type OrpcIteratorValue<Output> = [Output] extends [never] ? never : [Output] extends [AsyncIterator<infer Value, any, any>] ? Value : never;
52
+ type OrpcTopic<Path extends string, Key extends string> = Path extends "" ? Key : `${Path}/${Key}`;
53
+ type OrpcListenerModel<Input, Output, Topic extends string> = ListenerModel<{
54
+ response: OrpcIteratorValue<Output>;
55
+ payload: OrpcProcedurePayload<Input>;
56
+ hasPayload: OrpcProcedureHasPayload<Input>;
57
+ topic: Topic;
58
+ }>;
59
+ /** `true` for an event iterator procedure, and for a nested router with at least one of them */
60
+ type OrpcHasIterator<Value> = Value extends Client<any, any, infer Output, any> ? [OrpcIteratorValue<Output>] extends [never] ? false : true : Value extends NestedClient<any> ? true extends {
61
+ [Key in keyof Value]: OrpcHasIterator<Value[Key]>;
62
+ }[keyof Value] ? true : false : false;
63
+ type OrpcSocketClientSchema<Record, Path extends string> = {
64
+ [Key in keyof Record & string as OrpcHasIterator<Record[Key]> extends true ? Key : never]: Record[Key] extends Client<any, infer Input, infer Output, any> ? {
65
+ $listener: OrpcListenerModel<Input, Output, OrpcTopic<Path, Key>>;
66
+ } : OrpcSocketClientSchema<Record[Key], OrpcTopic<Path, Key>>;
67
+ };
68
+ /**
69
+ * Maps the type of an oRPC router to the schema understood by `createSocketSdk`. Every event iterator procedure
70
+ * becomes a `$listener` - the response is the yielded value, the payload is the input and the topic is the
71
+ * procedure path. Other procedures are not a part of it, call them with `OrpcSchema` and `OrpcAdapter`.
72
+ * It takes the router, or the client type, like `ContractRouterClient<typeof contract>` for contract-first APIs.
73
+ *
74
+ * @example
75
+ * const socket = new Socket({ url: "http://localhost:3000/rpc", adapter: OrpcStreamAdapter() });
76
+ * const sdk = createSocketSdk<typeof socket, OrpcSocketSchema<typeof router>>(socket, { camelCaseToKebabCase: false });
77
+ *
78
+ * sdk.planet.onUpdate.$listener.setPayload({ id: 1 }).listen(({ data }) => console.log(data));
79
+ */
80
+ export type OrpcSocketSchema<Router extends AnyRouter | NestedClient<any>> = OrpcSocketClientSchema<OrpcRouterClient<Router>, "">;
49
81
  export {};
50
82
  //# sourceMappingURL=adapter.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.schema.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,KAAK,EAAE,aAA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iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;KAAE,GACrE,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,sBAAsB,CACjG,gBAAgB,CAAC,MAAM,CAAC,EACxB,EAAE,CACH,CAAC"}
@@ -10,6 +10,11 @@ export declare const orpcEndpointMapper: (endpoint: string) => string;
10
10
  export declare const getOrpcRequestKey: (request: RequestInstance, serializer: OrpcSerializerType) => string;
11
11
  /** The input is not a part of this key, so `request.abort()` stops every running call of the procedure */
12
12
  export declare const getOrpcAbortKey: (request: RequestInstance) => string;
13
+ /**
14
+ * Key of a subscription - listeners of the same topic with the same input share one server subscription.
15
+ * The input is read in the wire format, so values like `Date` or `Map` stay distinct.
16
+ */
17
+ export declare const getOrpcSubscriptionKey: (topic: string, payload: unknown, serializer: OrpcSerializerType) => string;
13
18
  /** Only the user headers, the content type depends on the encoded body and is set while sending */
14
19
  export declare const getOrpcHeaders: (request: RequestInstance) => HeadersInit;
15
20
  type OrpcHttpRequestType = {
@@ -19,11 +24,24 @@ type OrpcHttpRequestType = {
19
24
  body?: string | FormData;
20
25
  };
21
26
  /**
22
- * Encodes the call as described by the oRPC RPC protocol.
23
- * GET sends the input in the `data` query param. Files and urls over the length limit fall back to POST,
24
- * the same as the `RPCLink` of oRPC.
27
+ * Encodes a call of the procedure as described by the oRPC RPC protocol, for any base `url` - the client url of a
28
+ * request or the url of a socket. GET sends the input in the `data` query param. Files and urls over the length limit
29
+ * fall back to POST, the same as the `RPCLink` of oRPC.
30
+ */
31
+ export declare const getOrpcCallRequest: ({ url: base, endpoint, queryParams, headers, payload, method, serializer, }: {
32
+ url: string;
33
+ endpoint: string;
34
+ queryParams: unknown;
35
+ headers: HeadersInit;
36
+ payload: unknown;
37
+ method: "GET" | "POST";
38
+ serializer: OrpcSerializerType;
39
+ }) => OrpcHttpRequestType;
40
+ /**
41
+ * Encodes the request as described by the oRPC RPC protocol.
42
+ * Queries use the `queryMethod`, mutations are always sent with POST.
25
43
  */
26
- export declare const getOrpcHttpRequest: ({ request, endpoint, queryParams, headers, payload, queryMethod, serializer, }: {
44
+ export declare const getOrpcHttpRequest: ({ request, queryMethod, ...call }: {
27
45
  request: RequestInstance;
28
46
  endpoint: string;
29
47
  queryParams: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.utils.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA+B,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAA6B,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGzF,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,0GAA0G;AAC1G,eAAO,MAAM,oBAAoB,GAAI,wBAAwB,+BAA+B,EAAE,0BAE7F,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEzE,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MAIrD,CAAC;AA0BF,6GAA6G;AAC7G,eAAO,MAAM,iBAAiB,GAAI,SAAS,eAAe,EAAE,YAAY,kBAAkB,KAAG,MAK5F,CAAC;AAEF,0GAA0G;AAC1G,eAAO,MAAM,eAAe,GAAI,SAAS,eAAe,KAAG,MAE1D,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,cAAc,GAAI,SAAS,eAAe,KAAG,WAEzD,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,GAA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,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,EAAE,kBAAkB,CAAC;CAChC,KAAG,mBAIH,CAAC;AAiBF,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhG;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,+BAI3B;IACD,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,kBAAkB,CAAC;CAChC,KAAG,cAwBH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  export * from './adapter';
2
+ export * from './socket';
3
+ export * from './stream-adapter';
4
+ export * from './websocket-adapter';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}