@hyper-fetch/orpc 0.0.0-stage → 9.8.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.
- package/README.md +100 -2
- package/__tests__/e2e/e2e.conformance.spec.ts +187 -0
- package/__tests__/e2e/e2e.orpc-server.ts +163 -0
- package/__tests__/e2e/e2e.orpc.spec.ts +338 -0
- package/__tests__/e2e/e2e.react.spec.tsx +219 -0
- package/__tests__/features/adapter/adapter.fetch.spec.ts +388 -0
- package/__tests__/features/adapter/adapter.lifecycle.spec.ts +529 -0
- package/__tests__/features/adapter/adapter.schema.spec.ts +271 -0
- package/__tests__/features/adapter/adapter.transport.spec.ts +346 -0
- package/__tests__/features/adapter/adapter.utils.spec.ts +329 -0
- package/__tests__/tsconfig.json +16 -0
- package/__tests__/vitest.setup.ts +5 -0
- package/dist/adapter/adapter.constants.d.ts +12 -0
- package/dist/adapter/adapter.constants.d.ts.map +1 -0
- package/dist/adapter/adapter.d.ts +10 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.fetch.d.ts +3 -0
- package/dist/adapter/adapter.fetch.d.ts.map +1 -0
- package/dist/adapter/adapter.schema.d.ts +50 -0
- package/dist/adapter/adapter.schema.d.ts.map +1 -0
- package/dist/adapter/adapter.types.d.ts +42 -0
- package/dist/adapter/adapter.types.d.ts.map +1 -0
- package/dist/adapter/adapter.utils.d.ts +52 -0
- package/dist/adapter/adapter.utils.d.ts.map +1 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +282 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +74 -4
- package/project.json +4 -0
- package/src/adapter/adapter.constants.ts +20 -0
- package/src/adapter/adapter.fetch.ts +227 -0
- package/src/adapter/adapter.schema.ts +73 -0
- package/src/adapter/adapter.ts +13 -0
- package/src/adapter/adapter.types.ts +65 -0
- package/src/adapter/adapter.utils.ts +189 -0
- package/src/adapter/index.ts +6 -0
- package/src/index.ts +3 -0
- package/tsconfig.json +12 -0
- package/vite.config.ts +42 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { createClient, getErrorMessage } from "@hyper-fetch/core";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createOrpcSerializer,
|
|
5
|
+
getOrpcAbortKey,
|
|
6
|
+
getOrpcHeaders,
|
|
7
|
+
getOrpcHttpRequest,
|
|
8
|
+
getOrpcRequestKey,
|
|
9
|
+
getOrpcResult,
|
|
10
|
+
maxGetUrlLength,
|
|
11
|
+
OrpcAdapter,
|
|
12
|
+
orpcEndpointMapper,
|
|
13
|
+
} from "../../../src/adapter";
|
|
14
|
+
|
|
15
|
+
const url = "http://localhost:3000/rpc";
|
|
16
|
+
|
|
17
|
+
describe("Orpc Adapter [ Utils ]", () => {
|
|
18
|
+
const serializer = createOrpcSerializer();
|
|
19
|
+
const client = createClient({ url }).setAdapter(OrpcAdapter());
|
|
20
|
+
|
|
21
|
+
const createQuery = (endpoint = "user/byId") =>
|
|
22
|
+
client.createRequest<{ response: unknown; payload: unknown; queryParams: Record<string, string> }>()({
|
|
23
|
+
endpoint,
|
|
24
|
+
});
|
|
25
|
+
const createMutation = (endpoint = "user/create") =>
|
|
26
|
+
client.createRequest<{ response: unknown; payload: unknown }>()({ endpoint, method: "MUTATION" });
|
|
27
|
+
|
|
28
|
+
describe("when mapping the endpoint", () => {
|
|
29
|
+
it.each([
|
|
30
|
+
["health", "/health"],
|
|
31
|
+
["/health", "/health"],
|
|
32
|
+
["user/byId", "/user/byId"],
|
|
33
|
+
["/user/byId/", "/user/byId"],
|
|
34
|
+
["//user//byId", "/user/byId"],
|
|
35
|
+
["user/with space", "/user/with%20space"],
|
|
36
|
+
["", "/"],
|
|
37
|
+
])("should map %j to %j", (endpoint, path) => {
|
|
38
|
+
expect(orpcEndpointMapper(endpoint)).toBe(path);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("when building the keys", () => {
|
|
43
|
+
it("should include the input in the cache and query keys", () => {
|
|
44
|
+
const first = getOrpcRequestKey(createQuery().setPayload({ id: 1 }), serializer);
|
|
45
|
+
const second = getOrpcRequestKey(createQuery().setPayload({ id: 2 }), serializer);
|
|
46
|
+
|
|
47
|
+
expect(first).toBe('QUERY_/user/byId-{"json":{"id":1}}-');
|
|
48
|
+
expect(second).not.toBe(first);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should not mix primitive inputs of a different type", () => {
|
|
52
|
+
const number = getOrpcRequestKey(createQuery().setPayload(1), serializer);
|
|
53
|
+
const string = getOrpcRequestKey(createQuery().setPayload("1"), serializer);
|
|
54
|
+
|
|
55
|
+
expect(number).not.toBe(string);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should keep the special types distinct from their JSON form", () => {
|
|
59
|
+
const date = new Date("2024-01-01T00:00:00.000Z");
|
|
60
|
+
const asDate = getOrpcRequestKey(createQuery().setPayload({ at: date }), serializer);
|
|
61
|
+
const asString = getOrpcRequestKey(createQuery().setPayload({ at: date.toISOString() }), serializer);
|
|
62
|
+
const asBigInt = getOrpcRequestKey(createQuery().setPayload({ total: 1n }), serializer);
|
|
63
|
+
const asNumber = getOrpcRequestKey(createQuery().setPayload({ total: 1 }), serializer);
|
|
64
|
+
|
|
65
|
+
expect(asDate).not.toBe(asString);
|
|
66
|
+
expect(asBigInt).not.toBe(asNumber);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("should share the keys between the SDK path and the procedure path", () => {
|
|
70
|
+
const fromSdk = getOrpcRequestKey(createQuery("/user/byId").setPayload({ id: 1 }), serializer);
|
|
71
|
+
const byHand = getOrpcRequestKey(createQuery("user/byId").setPayload({ id: 1 }), serializer);
|
|
72
|
+
|
|
73
|
+
expect(fromSdk).toBe(byHand);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("should separate the methods and query params", () => {
|
|
77
|
+
const query = getOrpcRequestKey(createQuery("user/create").setPayload({ id: 1 }), serializer);
|
|
78
|
+
const mutation = getOrpcRequestKey(createMutation().setPayload({ id: 1 }), serializer);
|
|
79
|
+
const withParams = getOrpcRequestKey(
|
|
80
|
+
createQuery("user/create").setPayload({ id: 1 }).setQueryParams({ v: "2" }),
|
|
81
|
+
serializer,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
expect(query).not.toBe(mutation);
|
|
85
|
+
expect(query).not.toBe(withParams);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("should tell the files apart by their metadata", () => {
|
|
89
|
+
const key = (file: File) => getOrpcRequestKey(createMutation().setPayload({ name: "a", file }), serializer);
|
|
90
|
+
const notes = new File(["notes"], "notes.txt", { type: "text/plain" });
|
|
91
|
+
|
|
92
|
+
expect(key(notes)).toBe(key(new File(["notes"], "notes.txt", { type: "text/plain" })));
|
|
93
|
+
expect(key(notes)).not.toBe(key(new File(["other"], "other.txt", { type: "text/plain" })));
|
|
94
|
+
expect(key(notes)).not.toBe(key(new File(["notes"], "notes.txt", { type: "text/markdown" })));
|
|
95
|
+
expect(key(notes)).not.toBe(key(new File(["longer notes"], "notes.txt", { type: "text/plain" })));
|
|
96
|
+
expect(key(notes)).toContain('"maps":[["file"]]');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("should not include the input in the abort key", () => {
|
|
100
|
+
const first = getOrpcAbortKey(createQuery().setPayload({ id: 1 }));
|
|
101
|
+
const second = getOrpcAbortKey(createQuery().setPayload({ id: 2 }));
|
|
102
|
+
|
|
103
|
+
expect(first).toBe("QUERY_/user/byId-false");
|
|
104
|
+
expect(second).toBe(first);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("should not throw for an input that can't be serialized", () => {
|
|
108
|
+
const failing = createOrpcSerializer([
|
|
109
|
+
{
|
|
110
|
+
type: 100,
|
|
111
|
+
condition: (value) => value instanceof Error,
|
|
112
|
+
serialize: () => {
|
|
113
|
+
throw new Error("Cannot serialize");
|
|
114
|
+
},
|
|
115
|
+
deserialize: (value) => value,
|
|
116
|
+
},
|
|
117
|
+
]);
|
|
118
|
+
|
|
119
|
+
expect(getOrpcRequestKey(createQuery().setPayload(new Error("input")), failing)).toBe("QUERY_/user/byId--");
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("when building the headers", () => {
|
|
124
|
+
it("should keep only the request headers", () => {
|
|
125
|
+
expect(getOrpcHeaders(createQuery().setHeaders({ authorization: "Bearer token" }))).toStrictEqual({
|
|
126
|
+
authorization: "Bearer token",
|
|
127
|
+
});
|
|
128
|
+
expect(getOrpcHeaders(createQuery())).toStrictEqual({});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("when building the http request", () => {
|
|
133
|
+
const build = ({
|
|
134
|
+
request = createQuery(),
|
|
135
|
+
payload,
|
|
136
|
+
queryParams,
|
|
137
|
+
queryMethod = "POST",
|
|
138
|
+
headers = {},
|
|
139
|
+
}: {
|
|
140
|
+
request?: ReturnType<typeof createQuery> | ReturnType<typeof createMutation>;
|
|
141
|
+
payload?: unknown;
|
|
142
|
+
queryParams?: unknown;
|
|
143
|
+
queryMethod?: "GET" | "POST";
|
|
144
|
+
headers?: Record<string, string>;
|
|
145
|
+
}) => {
|
|
146
|
+
return getOrpcHttpRequest({
|
|
147
|
+
request,
|
|
148
|
+
endpoint: orpcEndpointMapper(request.endpoint),
|
|
149
|
+
queryParams,
|
|
150
|
+
headers,
|
|
151
|
+
payload,
|
|
152
|
+
queryMethod,
|
|
153
|
+
serializer,
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
it("should send the input as a JSON body with POST", () => {
|
|
158
|
+
expect(build({ payload: { id: 1 }, headers: { "x-id": "1" } })).toStrictEqual({
|
|
159
|
+
url: `${url}/user/byId`,
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers: { "Content-Type": "application/json", "x-id": "1" },
|
|
162
|
+
body: '{"json":{"id":1}}',
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("should send an empty object without an input", () => {
|
|
167
|
+
expect(build({}).body).toBe("{}");
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("should describe the special types in the meta", () => {
|
|
171
|
+
const body = build({ payload: { at: new Date(0), total: 2n } }).body as string;
|
|
172
|
+
|
|
173
|
+
expect(JSON.parse(body)).toStrictEqual({
|
|
174
|
+
json: { at: "1970-01-01T00:00:00.000Z", total: "2" },
|
|
175
|
+
meta: [
|
|
176
|
+
[1, "at"],
|
|
177
|
+
[0, "total"],
|
|
178
|
+
],
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("should let the user content type win", () => {
|
|
183
|
+
expect(build({ payload: 1, headers: { "Content-Type": "text/plain" } }).headers).toStrictEqual({
|
|
184
|
+
"Content-Type": "text/plain",
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("should send the input in the data query param with GET", () => {
|
|
189
|
+
const request = build({ payload: { id: 1 }, queryMethod: "GET", headers: { "x-id": "1" } });
|
|
190
|
+
|
|
191
|
+
expect(request).toStrictEqual({
|
|
192
|
+
url: `${url}/user/byId?data=${encodeURIComponent('{"json":{"id":1}}')}`.replaceAll("%20", "+"),
|
|
193
|
+
method: "GET",
|
|
194
|
+
headers: { "x-id": "1" },
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("should send an empty object in the data query param without an input", () => {
|
|
199
|
+
expect(build({ queryMethod: "GET" }).url).toBe(`${url}/user/byId?data=%7B%7D`);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("should send mutations with POST even when queries use GET", () => {
|
|
203
|
+
expect(build({ request: createMutation(), payload: { id: 1 }, queryMethod: "GET" }).method).toBe("POST");
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it("should fall back to POST when the GET url is too long", () => {
|
|
207
|
+
const fits = "a".repeat(maxGetUrlLength - `${url}/user/byId?data=%7B%22json%22%3A%22%22%7D`.length);
|
|
208
|
+
|
|
209
|
+
expect(build({ payload: fits, queryMethod: "GET" }).method).toBe("GET");
|
|
210
|
+
expect(build({ payload: `${fits}a`, queryMethod: "GET" }).method).toBe("POST");
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("should send the files as multipart form data", () => {
|
|
214
|
+
const file = new File(["content"], "notes.txt", { type: "text/plain" });
|
|
215
|
+
|
|
216
|
+
const request = build({ payload: { file }, queryMethod: "GET", headers: { "x-id": "1" } });
|
|
217
|
+
|
|
218
|
+
expect(request.method).toBe("POST");
|
|
219
|
+
expect(request.headers).toStrictEqual({ "x-id": "1" });
|
|
220
|
+
expect(request.body).toBeInstanceOf(FormData);
|
|
221
|
+
const body = request.body as FormData;
|
|
222
|
+
expect(JSON.parse(body.get("data") as string)).toStrictEqual({ json: { file: {} }, maps: [["file"]] });
|
|
223
|
+
expect(body.get("0")).toBeInstanceOf(File);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it("should handle a trailing slash and a query string in the client url", () => {
|
|
227
|
+
const slashClient = createClient({ url: `${url}/?v=2&data=client` }).setAdapter(OrpcAdapter());
|
|
228
|
+
const request = slashClient.createRequest()({ endpoint: "health" });
|
|
229
|
+
|
|
230
|
+
const post = getOrpcHttpRequest({
|
|
231
|
+
request,
|
|
232
|
+
endpoint: "/health",
|
|
233
|
+
queryParams: undefined,
|
|
234
|
+
headers: {},
|
|
235
|
+
payload: undefined,
|
|
236
|
+
queryMethod: "POST",
|
|
237
|
+
serializer,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
expect(post.url).toBe(`${url}/health?v=2&data=client`);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("should append the query params without the reserved ones", () => {
|
|
244
|
+
expect(build({ queryParams: { page: "2", data: "user" } }).url).toBe(`${url}/user/byId?page=2`);
|
|
245
|
+
expect(build({ queryParams: "?page=2&data=user", payload: 1, queryMethod: "GET" }).url).toBe(
|
|
246
|
+
`${url}/user/byId?page=2&data=${encodeURIComponent('{"json":1}')}`,
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
describe("when reading the response", () => {
|
|
252
|
+
const read = (body: string | FormData, status = 200) => getOrpcResult({ body, status, serializer });
|
|
253
|
+
|
|
254
|
+
it("should read the data", () => {
|
|
255
|
+
expect(read('{"json":{"id":1}}')).toStrictEqual({ isSuccess: true, data: { id: 1 } });
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("should deserialize the special types", () => {
|
|
259
|
+
const body = JSON.stringify({
|
|
260
|
+
json: { at: "1970-01-01T00:00:00.000Z", total: "2" },
|
|
261
|
+
meta: [
|
|
262
|
+
[1, "at"],
|
|
263
|
+
[0, "total"],
|
|
264
|
+
],
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
expect(read(body)).toStrictEqual({ isSuccess: true, data: { at: new Date(0), total: 2n } });
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("should map a missing output to null", () => {
|
|
271
|
+
expect(read("")).toStrictEqual({ isSuccess: true, data: null });
|
|
272
|
+
expect(read("{}")).toStrictEqual({ isSuccess: true, data: null });
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it.each([[0], [false], [""]])("should keep the %j output", (data) => {
|
|
276
|
+
expect(read(JSON.stringify({ json: data }))).toStrictEqual({ isSuccess: true, data });
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it("should read a multipart body", () => {
|
|
280
|
+
const form = new FormData();
|
|
281
|
+
form.set("data", JSON.stringify({ json: { file: {} }, maps: [["file"]] }));
|
|
282
|
+
form.set("0", new File(["content"], "notes.txt"));
|
|
283
|
+
|
|
284
|
+
const result = read(form);
|
|
285
|
+
|
|
286
|
+
expect(result.isSuccess).toBe(true);
|
|
287
|
+
expect(result.isSuccess && (result.data as { file: File }).file.name).toBe("notes.txt");
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it("should read the error with all of its fields", () => {
|
|
291
|
+
const error = { defined: true, code: "NOT_FOUND", status: 404, message: "Missing", data: { id: 1 } };
|
|
292
|
+
|
|
293
|
+
expect(read(JSON.stringify({ json: { ...error, extra: "field" } }), 404)).toStrictEqual({
|
|
294
|
+
isSuccess: false,
|
|
295
|
+
error,
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it("should add the data key to an error without data", () => {
|
|
300
|
+
const result = read(
|
|
301
|
+
JSON.stringify({ json: { defined: false, code: "CONFLICT", status: 409, message: "" } }),
|
|
302
|
+
409,
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
expect(result).toStrictEqual({
|
|
306
|
+
isSuccess: false,
|
|
307
|
+
error: { defined: false, code: "CONFLICT", status: 409, message: "", data: undefined },
|
|
308
|
+
});
|
|
309
|
+
expect(result.isSuccess === false && Object.keys(result.error as object)).toContain("data");
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it.each([
|
|
313
|
+
["an HTML page", "<html>Bad gateway</html>", 502],
|
|
314
|
+
["a plain text", "Not found", 404],
|
|
315
|
+
["a number", "1", 200],
|
|
316
|
+
["a JSON without the error fields", '{"json":{"message":"Nope"}}', 500],
|
|
317
|
+
["an error with a wrong field type", '{"json":{"defined":false,"code":1,"status":500,"message":""}}', 500],
|
|
318
|
+
])("should fail for %s", (_name, body, status) => {
|
|
319
|
+
expect(read(body, status)).toStrictEqual({ isSuccess: false, error: getErrorMessage() });
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("should treat statuses from 400 up as errors", () => {
|
|
323
|
+
const error = { defined: false, code: "BAD_REQUEST", status: 400, message: "Bad", data: "details" };
|
|
324
|
+
|
|
325
|
+
expect(read(JSON.stringify({ json: error }), 399)).toStrictEqual({ isSuccess: true, data: error });
|
|
326
|
+
expect(read(JSON.stringify({ json: error }), 400)).toStrictEqual({ isSuccess: false, error });
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": true,
|
|
5
|
+
"noUnusedLocals": false,
|
|
6
|
+
"noUnusedParameters": false,
|
|
7
|
+
"types": ["vitest/globals", "jest-extended", "@types/node"],
|
|
8
|
+
"paths": {
|
|
9
|
+
"adapter": ["../src/adapter"],
|
|
10
|
+
"adapter/*": ["../src/adapter/*"],
|
|
11
|
+
"@hyper-fetch/orpc": ["../src"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"include": ["**/*.ts", "**/*.tsx", "../../../global.d.ts", "../../../vitest.d.ts"],
|
|
15
|
+
"exclude": ["node_modules"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OrpcExtraType } from './adapter.types';
|
|
2
|
+
export declare const defaultTimeout: number;
|
|
3
|
+
export declare const orpcExtra: OrpcExtraType;
|
|
4
|
+
export declare const OrpcMethods: {
|
|
5
|
+
readonly QUERY: "QUERY";
|
|
6
|
+
readonly MUTATION: "MUTATION";
|
|
7
|
+
};
|
|
8
|
+
/** Query string key owned by the oRPC RPC protocol - it wins over the user query params */
|
|
9
|
+
export declare const reservedQueryParams: string[];
|
|
10
|
+
/** Longer GET urls are sent with POST, the same limit as the `RPCLink` of oRPC */
|
|
11
|
+
export declare const maxGetUrlLength = 2083;
|
|
12
|
+
//# sourceMappingURL=adapter.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.constants.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,cAAc,QAAe,CAAC;AAE3C,eAAO,MAAM,SAAS,EAAE,aAEvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,UAAW,CAAC;AAE5C,kFAAkF;AAClF,eAAO,MAAM,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OrpcAdapterOptionsType, OrpcAdapterType } from './adapter.types';
|
|
2
|
+
/**
|
|
3
|
+
* Adapter calling oRPC procedures with the RPC protocol.
|
|
4
|
+
* The endpoint is the procedure path and the payload is the procedure input.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const client = createClient({ url: "http://localhost:3000/rpc" }).setAdapter(OrpcAdapter());
|
|
8
|
+
*/
|
|
9
|
+
export declare const OrpcAdapter: (options?: OrpcAdapterOptionsType) => OrpcAdapterType;
|
|
10
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,sBAAsB,KAAG,eAE9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.fetch.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.fetch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,sBAAsB,EACtB,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAyDzB,eAAO,MAAM,cAAc,GAAI,8DAG5B,sBAA2B,KAAG,eA4JhC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RequestModel } from '@hyper-fetch/core';
|
|
2
|
+
import { Client, NestedClient, ORPCError } from '@orpc/client';
|
|
3
|
+
import { AnyRouter, RouterClient } from '@orpc/server';
|
|
4
|
+
import { OrpcErrorType } from './adapter.types';
|
|
5
|
+
type OrpcHasNoInput<Input> = unknown extends Input ? true : [Input] extends [void | undefined] ? true : false;
|
|
6
|
+
/** Procedures without an input are sent without the payload */
|
|
7
|
+
type OrpcProcedurePayload<Input> = OrpcHasNoInput<Input> extends true ? undefined : Exclude<Input, void | undefined>;
|
|
8
|
+
/** An optional input doesn't have to be set before sending the request */
|
|
9
|
+
type OrpcProcedureHasPayload<Input> = OrpcHasNoInput<Input> extends true ? false : undefined extends Input ? true : false;
|
|
10
|
+
/** Errors from the `.errors()` map keep their code and data, any other error is not defined by the procedure */
|
|
11
|
+
type OrpcProcedureError<Error> = (Error extends ORPCError<infer Code, infer Data> ? OrpcErrorType<Code, Data> & {
|
|
12
|
+
defined: true;
|
|
13
|
+
} : never) | (OrpcErrorType & {
|
|
14
|
+
defined: false;
|
|
15
|
+
});
|
|
16
|
+
type OrpcProcedureModel<Input, Output, Error, Endpoint extends string> = RequestModel<{
|
|
17
|
+
response: Output;
|
|
18
|
+
payload: OrpcProcedurePayload<Input>;
|
|
19
|
+
hasPayload: OrpcProcedureHasPayload<Input>;
|
|
20
|
+
error: OrpcProcedureError<Error>;
|
|
21
|
+
endpoint: Endpoint;
|
|
22
|
+
}>;
|
|
23
|
+
/** Every procedure can be read with `$query` and changed with `$mutation`, the same as in the oRPC query utils */
|
|
24
|
+
type OrpcProcedureSchema<Input, Output, Error, Endpoint extends string> = {
|
|
25
|
+
$query: OrpcProcedureModel<Input, Output, Error, Endpoint>;
|
|
26
|
+
$mutation: OrpcProcedureModel<Input, Output, Error, Endpoint>;
|
|
27
|
+
};
|
|
28
|
+
type OrpcAnyClient = Client<any, any, any, any>;
|
|
29
|
+
/** Event iterators are not supported by the adapter, so they are not a part of the schema. Procedures that only throw stay. */
|
|
30
|
+
type OrpcSupportedKeys<Record> = {
|
|
31
|
+
[Key in keyof Record]: Record[Key] extends Client<any, any, infer Output, any> ? [Output] extends [never] ? Key : [Output] extends [{
|
|
32
|
+
[Symbol.asyncIterator]: unknown;
|
|
33
|
+
}] ? never : Key : Key;
|
|
34
|
+
}[keyof Record];
|
|
35
|
+
type OrpcClientSchema<Record, Path extends string> = {
|
|
36
|
+
[Key in OrpcSupportedKeys<Record> & string]: Record[Key] extends Client<any, infer Input, infer Output, infer Error> ? OrpcProcedureSchema<Input, Output, Error, `${Path}/${Key}`> : Record[Key] extends NestedClient<any> ? OrpcClientSchema<Record[Key], `${Path}/${Key}`> : never;
|
|
37
|
+
};
|
|
38
|
+
type OrpcRouterClient<Router> = Router extends OrpcAnyClient ? never : Router extends NestedClient<any> ? Router : Router extends AnyRouter ? RouterClient<Router> : never;
|
|
39
|
+
/**
|
|
40
|
+
* Maps the type of an oRPC router to the schema understood by `createSdk`.
|
|
41
|
+
* It takes the router, or the client type, like `ContractRouterClient<typeof contract>` for contract-first APIs.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const api = createSdk<typeof client, OrpcSchema<typeof router>>(client, { camelCaseToKebabCase: false });
|
|
45
|
+
*
|
|
46
|
+
* const { data } = await api.planet.find.$query.setPayload({ id: 1 }).send();
|
|
47
|
+
*/
|
|
48
|
+
export type OrpcSchema<Router extends AnyRouter | NestedClient<any>> = OrpcClientSchema<OrpcRouterClient<Router>, "">;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=adapter.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.schema.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.schema.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Adapter, DefaultMapperType, QueryParamsType, RequestInstance, stringifyQueryParams } from '@hyper-fetch/core';
|
|
2
|
+
import { StandardRPCCustomJsonSerializer } from '@orpc/client/standard';
|
|
3
|
+
import { OrpcMethods } from './adapter.constants';
|
|
4
|
+
export type OrpcMethod = (typeof OrpcMethods)[keyof typeof OrpcMethods];
|
|
5
|
+
export type OrpcExtraType = {
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* HTTP method used for the `QUERY` requests.
|
|
10
|
+
* The oRPC `RPCHandler` accepts only `POST` until `GET` is added to its `allowMethods`.
|
|
11
|
+
*/
|
|
12
|
+
export type OrpcQueryMethod = "POST" | "GET";
|
|
13
|
+
export type OrpcAdapterOptionsType = {
|
|
14
|
+
/**
|
|
15
|
+
* HTTP method of the `QUERY` requests, mutations always use `POST`.
|
|
16
|
+
* @default "POST"
|
|
17
|
+
*/
|
|
18
|
+
queryMethod?: OrpcQueryMethod;
|
|
19
|
+
/**
|
|
20
|
+
* Serializers of custom types, the same as the `customJsonSerializers` option of `RPCHandler` and `RPCLink`.
|
|
21
|
+
* Both sides need the same list.
|
|
22
|
+
*/
|
|
23
|
+
customJsonSerializers?: StandardRPCCustomJsonSerializer[];
|
|
24
|
+
};
|
|
25
|
+
export type FetchOrpcAdapterOptionsType = Omit<RequestInit, "method" | "headers" | "body" | "signal"> & {
|
|
26
|
+
timeout?: number;
|
|
27
|
+
/** Overrides the `queryMethod` of the adapter for one request */
|
|
28
|
+
queryMethod?: OrpcQueryMethod;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Error sent by an oRPC procedure, the JSON form of `ORPCError`.
|
|
32
|
+
* Errors from the `.errors()` map of the procedure have `defined: true`.
|
|
33
|
+
*/
|
|
34
|
+
export type OrpcErrorType<Code extends string = string, Data = unknown> = {
|
|
35
|
+
defined: boolean;
|
|
36
|
+
code: Code;
|
|
37
|
+
status: number;
|
|
38
|
+
message: string;
|
|
39
|
+
data: Data;
|
|
40
|
+
};
|
|
41
|
+
export type OrpcAdapterType = Adapter<FetchOrpcAdapterOptionsType, OrpcMethod, number, OrpcExtraType, QueryParamsType | string, QueryParamsType | string | undefined, string, (endpoint: string) => string, typeof stringifyQueryParams, (request: RequestInstance) => HeadersInit, DefaultMapperType>;
|
|
42
|
+
//# sourceMappingURL=adapter.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.types.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,+BAA+B,EAAE,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;IACtG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,GAAG,OAAO,IAAI;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,2BAA2B,EAC3B,UAAU,EACV,MAAM,EACN,aAAa,EACb,eAAe,GAAG,MAAM,EACxB,eAAe,GAAG,MAAM,GAAG,SAAS,EACpC,MAAM,EACN,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,EAC5B,OAAO,oBAAoB,EAC3B,CAAC,OAAO,EAAE,eAAe,KAAK,WAAW,EACzC,iBAAiB,CAClB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RequestInstance } from '@hyper-fetch/core';
|
|
2
|
+
import { StandardRPCCustomJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
|
3
|
+
import { OrpcQueryMethod } from './adapter.types';
|
|
4
|
+
/** Serializer of the oRPC RPC protocol, it handles types like `Date`, `BigInt`, `Map`, `Set` and files */
|
|
5
|
+
export declare const createOrpcSerializer: (customJsonSerializers?: StandardRPCCustomJsonSerializer[]) => StandardRPCSerializer;
|
|
6
|
+
export type OrpcSerializerType = ReturnType<typeof createOrpcSerializer>;
|
|
7
|
+
/** Turns the procedure path `user/byId` or `/user/byId` into the url path `/user/byId` */
|
|
8
|
+
export declare const orpcEndpointMapper: (endpoint: string) => string;
|
|
9
|
+
/** Key of the request response - the same procedure called with a different input is a different resource */
|
|
10
|
+
export declare const getOrpcRequestKey: (request: RequestInstance, serializer: OrpcSerializerType) => string;
|
|
11
|
+
/** The input is not a part of this key, so `request.abort()` stops every running call of the procedure */
|
|
12
|
+
export declare const getOrpcAbortKey: (request: RequestInstance) => string;
|
|
13
|
+
/** Only the user headers, the content type depends on the encoded body and is set while sending */
|
|
14
|
+
export declare const getOrpcHeaders: (request: RequestInstance) => HeadersInit;
|
|
15
|
+
type OrpcHttpRequestType = {
|
|
16
|
+
url: string;
|
|
17
|
+
method: "GET" | "POST";
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
body?: string | FormData;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
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.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getOrpcHttpRequest: ({ request, endpoint, queryParams, headers, payload, queryMethod, serializer, }: {
|
|
27
|
+
request: RequestInstance;
|
|
28
|
+
endpoint: string;
|
|
29
|
+
queryParams: unknown;
|
|
30
|
+
headers: HeadersInit;
|
|
31
|
+
payload: unknown;
|
|
32
|
+
queryMethod: OrpcQueryMethod;
|
|
33
|
+
serializer: OrpcSerializerType;
|
|
34
|
+
}) => OrpcHttpRequestType;
|
|
35
|
+
type OrpcResultType = {
|
|
36
|
+
isSuccess: true;
|
|
37
|
+
data: unknown;
|
|
38
|
+
} | {
|
|
39
|
+
isSuccess: false;
|
|
40
|
+
error: unknown;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Reads the serialized `{ json, meta }` body, or the multipart body when the output contains files.
|
|
44
|
+
* Statuses from 400 up are errors, the same as in oRPC.
|
|
45
|
+
*/
|
|
46
|
+
export declare const getOrpcResult: ({ body, status, serializer, }: {
|
|
47
|
+
body: string | FormData;
|
|
48
|
+
status: number;
|
|
49
|
+
serializer: OrpcSerializerType;
|
|
50
|
+
}) => OrpcResultType;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=adapter.utils.d.ts.map
|
|
@@ -0,0 +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,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,gFAQhC;IACD,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,EAAE,kBAAkB,CAAC;CAChC,KAAG,mBAyCH,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAC"}
|