@hyper-fetch/core 10.0.0 → 10.1.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 +126 -86
- package/__tests__/features/adapter/adapter.base.spec.ts +32 -0
- package/__tests__/features/adapter/adapter.bindings.progress.spec.ts +14 -0
- package/__tests__/features/adapter/adapter.bindings.spec.ts +17 -0
- package/__tests__/features/adapter/adapter.query-params-resolver.spec.ts +93 -0
- package/__tests__/features/adapter/adapter.server.spec.ts +46 -0
- package/__tests__/features/cache/cache.timing.spec.ts +34 -12
- package/__tests__/features/dispatcher/dispatcher.cancel.spec.ts +72 -0
- package/__tests__/features/dispatcher/dispatcher.lazy-storage.spec.ts +237 -0
- package/__tests__/features/dispatcher/dispatcher.persistence.spec.ts +187 -0
- package/__tests__/features/dispatcher/dispatcher.retry-time.spec.ts +142 -0
- package/__tests__/features/http-adapter/http-adapter.e2e.spec.ts +146 -0
- package/__tests__/features/managers/app/app.manager.events.spec.ts +46 -1
- package/__tests__/features/request/request.inference.spec.ts +78 -0
- package/__tests__/features/sdk/sdk.base.spec.ts +39 -0
- package/__tests__/features/sdk/sdk.request-fields.spec.ts +23 -0
- package/__tests__/features/sdk/sdk.types.spec.ts +28 -1
- package/dist/adapter/adapter.bindings.d.ts.map +1 -1
- package/dist/adapter/adapter.d.ts +18 -0
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/cache/cache.d.ts +2 -1
- package/dist/cache/cache.d.ts.map +1 -1
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.d.ts +28 -1
- package/dist/dispatcher/dispatcher.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.types.d.ts +17 -0
- package/dist/dispatcher/dispatcher.types.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.fetch.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.types.d.ts +12 -0
- package/dist/http-adapter/http-adapter.types.d.ts.map +1 -1
- package/dist/index.mjs +280 -42
- package/dist/index.mjs.map +1 -1
- package/dist/managers/app/app.manager.d.ts +5 -0
- package/dist/managers/app/app.manager.d.ts.map +1 -1
- package/dist/managers/request/request.manager.d.ts +7 -0
- package/dist/managers/request/request.manager.d.ts.map +1 -1
- package/dist/request/request.d.ts +3 -3
- package/dist/request/request.d.ts.map +1 -1
- package/dist/request/request.types.d.ts +45 -7
- package/dist/request/request.types.d.ts.map +1 -1
- package/dist/request/request.utils.d.ts +26 -1
- package/dist/request/request.utils.d.ts.map +1 -1
- package/dist/sdk/sdk.d.ts +22 -3
- package/dist/sdk/sdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapter/adapter.bindings.ts +5 -3
- package/src/adapter/adapter.ts +24 -1
- package/src/cache/cache.ts +5 -2
- package/src/client/client.ts +10 -3
- package/src/dispatcher/dispatcher.ts +161 -6
- package/src/dispatcher/dispatcher.types.ts +18 -0
- package/src/http-adapter/http-adapter.fetch.ts +76 -19
- package/src/http-adapter/http-adapter.types.ts +13 -0
- package/src/managers/app/app.manager.ts +17 -2
- package/src/managers/request/request.manager.ts +15 -1
- package/src/request/request.ts +5 -4
- package/src/request/request.types.ts +71 -11
- package/src/request/request.utils.ts +55 -0
- package/src/sdk/sdk.ts +33 -3
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Client } from "@hyper-fetch/core";
|
|
5
5
|
import http from "http";
|
|
6
6
|
import type { AddressInfo } from "net";
|
|
7
|
+
import { gzipSync } from "zlib";
|
|
7
8
|
|
|
8
9
|
import { createDeferred } from "../../utils/controlled-adapter.utils";
|
|
9
10
|
|
|
@@ -20,6 +21,8 @@ type Echo = {
|
|
|
20
21
|
* teardown) releases them, so nothing here depends on how fast the machine is.
|
|
21
22
|
*/
|
|
22
23
|
describe("E2E [ Fetch adapter ]", () => {
|
|
24
|
+
const binaryData = Buffer.from(Array.from({ length: 256 }, (_, index) => index));
|
|
25
|
+
const gzipData = Array.from({ length: 5000 }, (_, index) => ({ id: index, name: "compressible user name" }));
|
|
23
26
|
let server: http.Server;
|
|
24
27
|
let baseUrl = "";
|
|
25
28
|
let hits: string[] = [];
|
|
@@ -91,6 +94,26 @@ describe("E2E [ Fetch adapter ]", () => {
|
|
|
91
94
|
heldResponses.push(res);
|
|
92
95
|
return received.resolve(res);
|
|
93
96
|
}
|
|
97
|
+
// Every byte value - not valid UTF-8, so decoding it as text corrupts it
|
|
98
|
+
if (pathname === "/binary") {
|
|
99
|
+
res.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Length": String(binaryData.length) });
|
|
100
|
+
return res.end(binaryData);
|
|
101
|
+
}
|
|
102
|
+
if (pathname === "/binary-error") {
|
|
103
|
+
return sendJson(res, 404, { message: "File not found" });
|
|
104
|
+
}
|
|
105
|
+
// Compressed body - Content-Length tells the size of the compressed bytes, fetch reads the decompressed ones
|
|
106
|
+
if (pathname === "/gzip") {
|
|
107
|
+
const compressed = gzipSync(JSON.stringify(gzipData));
|
|
108
|
+
res.writeHead(200, {
|
|
109
|
+
"Content-Type": "application/json",
|
|
110
|
+
"Content-Encoding": "gzip",
|
|
111
|
+
"Content-Length": String(compressed.length),
|
|
112
|
+
});
|
|
113
|
+
const half = Math.floor(compressed.length / 2);
|
|
114
|
+
res.write(compressed.subarray(0, half));
|
|
115
|
+
return setImmediate(() => res.end(compressed.subarray(half)));
|
|
116
|
+
}
|
|
94
117
|
if (pathname === "/chunks") {
|
|
95
118
|
res.writeHead(200, { "Content-Type": "text/plain", "Content-Length": "9" });
|
|
96
119
|
res.write("aaa");
|
|
@@ -476,6 +499,97 @@ describe("E2E [ Fetch adapter ]", () => {
|
|
|
476
499
|
});
|
|
477
500
|
});
|
|
478
501
|
|
|
502
|
+
describe("When choosing the response type", () => {
|
|
503
|
+
const getBinary = <Response>(endpoint: string, responseType: "blob" | "arrayBuffer" | "text" | "json") =>
|
|
504
|
+
createClient().createRequest<{ response: Response; error: { message: string } }>()({
|
|
505
|
+
endpoint,
|
|
506
|
+
options: { responseType },
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
it("should give the body as an ArrayBuffer without changing the bytes", async () => {
|
|
510
|
+
const { data } = await getBinary<ArrayBuffer>("/binary", "arrayBuffer").send();
|
|
511
|
+
|
|
512
|
+
expect(data).toBeInstanceOf(ArrayBuffer);
|
|
513
|
+
expect(Buffer.from(data!)).toStrictEqual(binaryData);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it("should give the body as a Blob with the content type of the response", async () => {
|
|
517
|
+
const { data } = await getBinary<Blob>("/binary", "blob").send();
|
|
518
|
+
|
|
519
|
+
expect(data).toBeInstanceOf(Blob);
|
|
520
|
+
expect(data!.type).toBe("application/octet-stream");
|
|
521
|
+
expect(Buffer.from(await data!.arrayBuffer())).toStrictEqual(binaryData);
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it("should give a JSON body as text without parsing it", async () => {
|
|
525
|
+
const { data } = await getBinary<string>("/status/200", "text").send();
|
|
526
|
+
|
|
527
|
+
expect(data).toBe(JSON.stringify({ status: 200 }));
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it("should parse a JSON body with the json response type", async () => {
|
|
531
|
+
const { data } = await getBinary<{ status: number }>("/status/200", "json").send();
|
|
532
|
+
|
|
533
|
+
expect(data).toStrictEqual({ status: 200 });
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it("should parse the error body of a binary request", async () => {
|
|
537
|
+
const { data, error, status } = await getBinary<Blob>("/binary-error", "blob").send();
|
|
538
|
+
|
|
539
|
+
expect(data).toBeNull();
|
|
540
|
+
expect(status).toBe(404);
|
|
541
|
+
expect(error).toStrictEqual({ message: "File not found" });
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it("should report the download progress of a binary body", async () => {
|
|
545
|
+
const progress: number[] = [];
|
|
546
|
+
|
|
547
|
+
await getBinary<ArrayBuffer>("/binary", "arrayBuffer").send({
|
|
548
|
+
onDownloadProgress: (event) => progress.push(event.progress),
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
expect(progress.at(-1)).toBe(100);
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
it("should not pass the response type to fetch", async () => {
|
|
555
|
+
const fetchSpy = vi.spyOn(globalThis, "fetch");
|
|
556
|
+
|
|
557
|
+
await getBinary<ArrayBuffer>("/binary", "arrayBuffer").send();
|
|
558
|
+
|
|
559
|
+
expect(fetchSpy.mock.calls[0][1]).not.toHaveProperty("responseType");
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
describe("When the response is compressed", () => {
|
|
564
|
+
it("should decompress the body", async () => {
|
|
565
|
+
const request = createClient().createRequest<{ response: typeof gzipData }>()({ endpoint: "/gzip" });
|
|
566
|
+
|
|
567
|
+
const { data } = await request.send();
|
|
568
|
+
|
|
569
|
+
expect(data).toStrictEqual(gzipData);
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
it("should never report the download progress above 100%", async () => {
|
|
573
|
+
const request = createClient().createRequest<{ response: typeof gzipData }>()({ endpoint: "/gzip" });
|
|
574
|
+
const progress: number[] = [];
|
|
575
|
+
|
|
576
|
+
await request.send({ onDownloadProgress: (event) => progress.push(event.progress) });
|
|
577
|
+
|
|
578
|
+
expect(progress.length).toBeGreaterThan(1);
|
|
579
|
+
expect(Math.max(...progress)).toBe(100);
|
|
580
|
+
expect(progress.at(-1)).toBe(100);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
it("should report the size of the decompressed body as the total", async () => {
|
|
584
|
+
const request = createClient().createRequest<{ response: typeof gzipData }>()({ endpoint: "/gzip" });
|
|
585
|
+
const totals: number[] = [];
|
|
586
|
+
|
|
587
|
+
await request.send({ onDownloadProgress: (event) => totals.push(event.total) });
|
|
588
|
+
|
|
589
|
+
expect(totals.at(-1)).toBe(Buffer.byteLength(JSON.stringify(gzipData)));
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
|
|
479
593
|
describe("When the server redirects", () => {
|
|
480
594
|
it.each([301, 302, 303, 307, 308])("should follow the %i redirect", async (status) => {
|
|
481
595
|
const request = createClient().createRequest<{ response: Echo }>()({ endpoint: `/redirect/${status}` });
|
|
@@ -868,6 +982,38 @@ describe("E2E [ Fetch adapter ]", () => {
|
|
|
868
982
|
expect(progress.at(-1)).toEqual({ loaded: size, total: size });
|
|
869
983
|
});
|
|
870
984
|
|
|
985
|
+
it("should report the finished upload only once the server has the body", async () => {
|
|
986
|
+
// Fetch has no upload events - the response is the first sign that the whole body was sent
|
|
987
|
+
const finishedAfterServerGotBody: boolean[] = [];
|
|
988
|
+
|
|
989
|
+
await createEcho().send({
|
|
990
|
+
payload: { text: "x".repeat(10_000) },
|
|
991
|
+
onUploadProgress: ({ loaded, total }) => {
|
|
992
|
+
if (loaded === total) finishedAfterServerGotBody.push(hits.includes("/echo"));
|
|
993
|
+
},
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
expect(finishedAfterServerGotBody).toEqual([true]);
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
it.each([
|
|
1000
|
+
["Blob", () => new Blob(["a".repeat(2048)]), 2048],
|
|
1001
|
+
["ArrayBuffer", () => new Uint8Array(1024).buffer, 1024],
|
|
1002
|
+
["typed array", () => new Uint8Array(512), 512],
|
|
1003
|
+
["URLSearchParams", () => new URLSearchParams({ name: "żółw" }), Buffer.byteLength("name=%C5%BC%C3%B3%C5%82w")],
|
|
1004
|
+
])("should report the size of a %s payload as the upload total", async (_, createPayload, size) => {
|
|
1005
|
+
const progress: { loaded: number; total: number }[] = [];
|
|
1006
|
+
|
|
1007
|
+
const { data } = await createEcho().send({
|
|
1008
|
+
payload: createPayload(),
|
|
1009
|
+
onUploadProgress: ({ loaded, total }) => progress.push({ loaded, total }),
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
expect(data?.bodyLength).toBe(size);
|
|
1013
|
+
expect(progress[0]).toEqual({ loaded: 0, total: size });
|
|
1014
|
+
expect(progress.at(-1)).toEqual({ loaded: size, total: size });
|
|
1015
|
+
});
|
|
1016
|
+
|
|
871
1017
|
it("should call the lifecycle callbacks once", async () => {
|
|
872
1018
|
const onRequestStart = vi.fn();
|
|
873
1019
|
const onResponseStart = vi.fn();
|
|
@@ -32,6 +32,44 @@ describe("AppManager [ Events ]", () => {
|
|
|
32
32
|
vi.restoreAllMocks();
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
describe("When the page unloads", () => {
|
|
36
|
+
it("should start without unloading", () => {
|
|
37
|
+
const manager = createManager();
|
|
38
|
+
manager.initialize();
|
|
39
|
+
|
|
40
|
+
expect(manager.isUnloading).toBeFalse();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should be unloading once the page gets hidden for good", () => {
|
|
44
|
+
const manager = createManager();
|
|
45
|
+
manager.initialize();
|
|
46
|
+
|
|
47
|
+
window.dispatchEvent(new Event("pagehide"));
|
|
48
|
+
|
|
49
|
+
expect(manager.isUnloading).toBeTrue();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("should stop unloading when the page comes back from the back-forward cache", () => {
|
|
53
|
+
const manager = createManager();
|
|
54
|
+
manager.initialize();
|
|
55
|
+
|
|
56
|
+
window.dispatchEvent(new Event("pagehide"));
|
|
57
|
+
window.dispatchEvent(new Event("pageshow"));
|
|
58
|
+
|
|
59
|
+
expect(manager.isUnloading).toBeFalse();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should not track the page after unmount", () => {
|
|
63
|
+
const manager = createManager();
|
|
64
|
+
manager.initialize();
|
|
65
|
+
manager.unmount();
|
|
66
|
+
|
|
67
|
+
window.dispatchEvent(new Event("pagehide"));
|
|
68
|
+
|
|
69
|
+
expect(manager.isUnloading).toBeFalse();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
35
73
|
describe("When the document visibility changes", () => {
|
|
36
74
|
it("should lose the focus when the document gets hidden", () => {
|
|
37
75
|
const manager = createManager();
|
|
@@ -181,7 +219,14 @@ describe("AppManager [ Events ]", () => {
|
|
|
181
219
|
manager.initialize();
|
|
182
220
|
manager.unmount();
|
|
183
221
|
|
|
184
|
-
expect(windowAdd.mock.calls.map(([name]) => name)).toIncludeSameMembers([
|
|
222
|
+
expect(windowAdd.mock.calls.map(([name]) => name)).toIncludeSameMembers([
|
|
223
|
+
"blur",
|
|
224
|
+
"focus",
|
|
225
|
+
"offline",
|
|
226
|
+
"online",
|
|
227
|
+
"pagehide",
|
|
228
|
+
"pageshow",
|
|
229
|
+
]);
|
|
185
230
|
expect(documentAdd.mock.calls.map(([name]) => name)).toStrictEqual(["visibilitychange"]);
|
|
186
231
|
expect(windowRemove.mock.calls).toStrictEqual(windowAdd.mock.calls);
|
|
187
232
|
expect(documentRemove.mock.calls).toStrictEqual(documentAdd.mock.calls);
|
|
@@ -80,6 +80,34 @@ describe("Request [ Type inference ]", () => {
|
|
|
80
80
|
expect(true).toBe(true);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
it("should not read the colons of a GraphQL document as params", () => {
|
|
84
|
+
expectTypeOf<ExtractUrlParams<"mutation D($id: ID!) { del(id: $id) }">>().toEqualTypeOf<null | undefined>();
|
|
85
|
+
expectTypeOf<ExtractUrlParams<"query { user(id: 1) { name } }">>().toEqualTypeOf<null | undefined>();
|
|
86
|
+
expectTypeOf<ExtractUrlParams<"query U($id: ID!) {\n user(id: $id) { name }\n}">>().toEqualTypeOf<
|
|
87
|
+
null | undefined
|
|
88
|
+
>();
|
|
89
|
+
expect(true).toBe(true);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("should read only the params of an absolute url", () => {
|
|
93
|
+
expectTypeOf<ExtractUrlParams<"http://localhost:3000/users/:userId">>().toEqualTypeOf<{
|
|
94
|
+
userId: ParamType;
|
|
95
|
+
}>();
|
|
96
|
+
expectTypeOf<ExtractUrlParams<"https://api.test/:_version/items">>().toEqualTypeOf<{ _version: ParamType }>();
|
|
97
|
+
expect(true).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("should send a request with a GraphQL string document without params", () => {
|
|
101
|
+
const deleteUser = client.createRequest<{ response: User; payload: { id: string } }>()({
|
|
102
|
+
endpoint: "mutation D($id: ID!) { del(id: $id) }",
|
|
103
|
+
method: "POST",
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
expectTypeOf<ExtractParamsType<typeof deleteUser>>().toEqualTypeOf<null | undefined>();
|
|
107
|
+
expectTypeOf(deleteUser.send).toBeCallableWith({ payload: { id: "1" } });
|
|
108
|
+
expect(deleteUser.endpoint).toBe("mutation D($id: ID!) { del(id: $id) }");
|
|
109
|
+
});
|
|
110
|
+
|
|
83
111
|
it("should keep the literal type of the endpoint", () => {
|
|
84
112
|
expectTypeOf(getUser.requestOptions.endpoint).toEqualTypeOf<"/users/:userId">();
|
|
85
113
|
expect(getUser.requestOptions.endpoint).toBe("/users/:userId");
|
|
@@ -266,4 +294,54 @@ describe("Request [ Type inference ]", () => {
|
|
|
266
294
|
expect(withCallback.retryOnError).toBeDefined();
|
|
267
295
|
});
|
|
268
296
|
});
|
|
297
|
+
|
|
298
|
+
describe("When the endpoint carries its types", () => {
|
|
299
|
+
/** The decoration graphql-codegen and gql.tada put on documents, here on a REST path */
|
|
300
|
+
type TypedEndpoint<Response, Payload> = string & { __apiType?: (payload: Payload) => Response };
|
|
301
|
+
|
|
302
|
+
const createUser = "/users" as TypedEndpoint<User, { name: string }>;
|
|
303
|
+
const listUsers = "/users" as TypedEndpoint<User[], { [key: string]: never }>;
|
|
304
|
+
|
|
305
|
+
it("should take the response and the payload from the endpoint", () => {
|
|
306
|
+
const request = client.createRequest()({ endpoint: createUser, method: "POST" });
|
|
307
|
+
|
|
308
|
+
expectTypeOf<ExtractResponseType<typeof request>>().toEqualTypeOf<User>();
|
|
309
|
+
expectTypeOf<ExtractPayloadType<typeof request>>().toEqualTypeOf<{ name: string }>();
|
|
310
|
+
request.send({ payload: { name: "Ann" } });
|
|
311
|
+
// @ts-expect-error the payload comes from the endpoint
|
|
312
|
+
request.send({ payload: { name: 1 } });
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it("should not need a payload for an endpoint without one", () => {
|
|
316
|
+
const request = client.createRequest()({ endpoint: listUsers });
|
|
317
|
+
|
|
318
|
+
expectTypeOf<ExtractPayloadType<typeof request>>().toEqualTypeOf<undefined>();
|
|
319
|
+
expectTypeOf(request.send).toBeCallableWith();
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("should let the declared generics win over the endpoint", () => {
|
|
323
|
+
const request = client.createRequest<{ response: { id: number } }>()({ endpoint: createUser, method: "POST" });
|
|
324
|
+
|
|
325
|
+
expectTypeOf<ExtractResponseType<typeof request>>().toEqualTypeOf<{ id: number }>();
|
|
326
|
+
expectTypeOf<ExtractPayloadType<typeof request>>().toEqualTypeOf<{ name: string }>();
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it("should combine the endpoint types with the other declared generics", () => {
|
|
330
|
+
const request = client.createRequest<{ error: ApiError; queryParams: { page: number } }>()({
|
|
331
|
+
endpoint: createUser,
|
|
332
|
+
method: "POST",
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
expectTypeOf<ExtractResponseType<typeof request>>().toEqualTypeOf<User>();
|
|
336
|
+
expectTypeOf<ExtractErrorType<typeof request>>().toEqualTypeOf<ApiError | GlobalError>();
|
|
337
|
+
expectTypeOf<ExtractQueryParamsType<typeof request>>().toEqualTypeOf<{ page: number }>();
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it("should keep undefined types for endpoints without the decoration", () => {
|
|
341
|
+
const request = client.createRequest()({ endpoint: "/users" });
|
|
342
|
+
|
|
343
|
+
expectTypeOf<ExtractResponseType<typeof request>>().toEqualTypeOf<undefined>();
|
|
344
|
+
expectTypeOf<ExtractPayloadType<typeof request>>().toEqualTypeOf<undefined>();
|
|
345
|
+
});
|
|
346
|
+
});
|
|
269
347
|
});
|
|
@@ -124,4 +124,43 @@ describe("SDK [ Base ]", () => {
|
|
|
124
124
|
expect(request.method).toBe("POST");
|
|
125
125
|
expect(request.endpoint).toBe("/acceptInvitation");
|
|
126
126
|
});
|
|
127
|
+
|
|
128
|
+
describe("when keys are mapped to path segments", () => {
|
|
129
|
+
it("should use the mapped segment over the kebab-case conversion", () => {
|
|
130
|
+
const sdk = createSdk<TestClient, TestSchema>(client, { pathSegments: { acceptInvitation: "acceptInvitation" } });
|
|
131
|
+
|
|
132
|
+
expect(sdk.acceptInvitation.$post.endpoint).toBe("/acceptInvitation");
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("should convert the keys which are not mapped", () => {
|
|
136
|
+
const sdk = createSdk<TestClient, TestSchema>(client, { pathSegments: { other: "other-segment" } });
|
|
137
|
+
|
|
138
|
+
expect(sdk.acceptInvitation.$post.endpoint).toBe("/accept-invitation");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("should map nested keys and keep the params", () => {
|
|
142
|
+
const sdk = createSdk<TestClient, TestSchema>(client, { pathSegments: { posts: "blog_posts" } });
|
|
143
|
+
|
|
144
|
+
const request = sdk.users.$userId.posts.$postId.$delete.setParams({ userId: "1", postId: "2" });
|
|
145
|
+
|
|
146
|
+
expect(request.endpoint).toBe("/users/1/blog_posts/2");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("should not read the segments from the object prototype", () => {
|
|
150
|
+
const sdk = createSdk<TestClient, TestSchema>(client, { pathSegments: {} });
|
|
151
|
+
// A key named like an Object.prototype member - its segment is not read from the prototype of the map
|
|
152
|
+
const prototypeKey = (sdk as unknown as Record<string, unknown>)["constructor"] as { $get: { endpoint: string } };
|
|
153
|
+
|
|
154
|
+
expect(prototypeKey.$get.endpoint).toBe("/constructor");
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("should keep the mapped segments in the configured sdk", () => {
|
|
158
|
+
const sdk = createSdk<TestClient, TestSchema>(client, {
|
|
159
|
+
pathSegments: { acceptInvitation: "acceptInvitation" },
|
|
160
|
+
}).$configure({ "*": { retry: 2 } });
|
|
161
|
+
|
|
162
|
+
expect(sdk.acceptInvitation.$post.endpoint).toBe("/acceptInvitation");
|
|
163
|
+
expect(sdk.acceptInvitation.$post.retry).toBe(2);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
127
166
|
});
|
|
@@ -78,3 +78,26 @@ describe("SDK [ Request fields ]", () => {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
describe("SDK [ Keys taken by the request properties ]", () => {
|
|
83
|
+
type Schema = {
|
|
84
|
+
messages: {
|
|
85
|
+
$get: RequestModel<{ response: { id: string }[]; endpoint: "/messages" }>;
|
|
86
|
+
// Procedure style key - the key is the method
|
|
87
|
+
list: RequestModel<{ response: { id: string }[]; endpoint: "/messages" }>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
it("should give the request property for a nested key with its name, so such a key can't be a path", () => {
|
|
92
|
+
const client = createClient<{ error: Error }>({ url: "http://localhost:3000" });
|
|
93
|
+
const sdk = createSdk<TestClient, Schema>(client);
|
|
94
|
+
const messages: unknown = sdk.messages;
|
|
95
|
+
|
|
96
|
+
const { send } = messages as { send: { endpoint?: string } };
|
|
97
|
+
|
|
98
|
+
// The `send` method of the request, not a request for "/messages/send"
|
|
99
|
+
expect(send).toBeInstanceOf(Function);
|
|
100
|
+
expect(send.endpoint).toBeUndefined();
|
|
101
|
+
expect(sdk.messages.list.method).toBe("LIST");
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -3,7 +3,7 @@ import type { ClientInstance, Client } from "client";
|
|
|
3
3
|
import type { HttpAdapterType } from "http-adapter";
|
|
4
4
|
import type { Request, RequestInstance, RequestModel } from "request";
|
|
5
5
|
import { createSdk } from "sdk";
|
|
6
|
-
import type { InjectClient } from "sdk";
|
|
6
|
+
import type { InjectClient, SdkReservedKeyError } from "sdk";
|
|
7
7
|
import { describe, it, expect, expectTypeOf } from "vitest";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -281,3 +281,30 @@ describe("$configure - dot-path callback narrowing", () => {
|
|
|
281
281
|
expect(true).toBe(true);
|
|
282
282
|
});
|
|
283
283
|
});
|
|
284
|
+
|
|
285
|
+
describe("SdkInstance - keys taken by the request properties", () => {
|
|
286
|
+
type Schema = {
|
|
287
|
+
send: { $post: RequestModel<{ response: User; endpoint: "/send" }> };
|
|
288
|
+
messages: {
|
|
289
|
+
$get: RequestModel<{ response: User[]; endpoint: "/messages" }>;
|
|
290
|
+
send: RequestModel<{ response: User; endpoint: "/messages/send" }>;
|
|
291
|
+
cache: { $get: RequestModel<{ response: User; endpoint: "/messages/cache" }> };
|
|
292
|
+
list: RequestModel<{ response: User[]; endpoint: "/messages/list" }>;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
type Sdk = ReturnType<typeof createSdk<TestClient, Schema>>;
|
|
296
|
+
|
|
297
|
+
it("should flag a nested key named like a request property", () => {
|
|
298
|
+
expectTypeOf<Sdk["messages"]["send"]>().not.toMatchTypeOf<RequestInstance>();
|
|
299
|
+
expectTypeOf<Sdk["messages"]["cache"]>().not.toMatchTypeOf<{ $get: RequestInstance }>();
|
|
300
|
+
expectTypeOf<Sdk["messages"]["send"]>().toEqualTypeOf<SdkReservedKeyError<"send">>();
|
|
301
|
+
expect(true).toBe(true);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("should keep the other keys and the top level keys", () => {
|
|
305
|
+
expectTypeOf<Sdk["messages"]["list"]>().toMatchTypeOf<RequestInstance>();
|
|
306
|
+
expectTypeOf<Sdk["messages"]["$get"]>().toMatchTypeOf<RequestInstance>();
|
|
307
|
+
expectTypeOf<Sdk["send"]["$post"]>().toMatchTypeOf<RequestInstance>();
|
|
308
|
+
expect(true).toBe(true);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.bindings.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.bindings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gBE;QACD,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;QACpC,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;KACnC;;eAmHQ,GAAG;;;;EAtBb,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,EAAE,EAC3D,OAAO,EACP,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,GACP,EAAE;IACD,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;CACnF,IAGe,2BAIX;IACD,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;IACpC,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;CACnC,KAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAoCvC"}
|
|
@@ -76,6 +76,11 @@ export declare class Adapter<AdapterOptions, MethodType extends string, StatusTy
|
|
|
76
76
|
unstable_endpointMapper: EndpointMapperType;
|
|
77
77
|
/** Method to get request data and transform them to the required format. */
|
|
78
78
|
unstable_queryParamsMapper: QueryParamsMapperType;
|
|
79
|
+
/**
|
|
80
|
+
* Turns query params given as a callback into data, at the moment they are set on a request. Unset by default, so
|
|
81
|
+
* adapters without it store query params as given. See {@link Adapter.setQueryParamsResolver}.
|
|
82
|
+
*/
|
|
83
|
+
unstable_queryParamsResolver?: (callback: (...args: any[]) => unknown) => unknown;
|
|
79
84
|
/** Get default adapter options for the request. */
|
|
80
85
|
unstable_getAdapterDefaults?: (request: ExtendRequest<RequestInstance, {
|
|
81
86
|
client: Client<any, Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType, RequestOptions>>;
|
|
@@ -126,6 +131,19 @@ export declare class Adapter<AdapterOptions, MethodType extends string, StatusTy
|
|
|
126
131
|
* Set the query params mapping function which get triggered before request get sent
|
|
127
132
|
*/
|
|
128
133
|
setQueryParamsMapper: <NewQueryParamsMapper extends QueryParamsMapper<QueryParams>>(queryParamsMapper: NewQueryParamsMapper) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, NewQueryParamsMapper, HeaderMapperType, PayloadMapperType, RequestOptions>;
|
|
134
|
+
/**
|
|
135
|
+
* Let requests take query params as a callback. When a request gets a function as its query params (in
|
|
136
|
+
* `createRequest`, `setQueryParams` or `send`), the resolver runs right away and the request stores what it returns,
|
|
137
|
+
* so cache keys, query keys and `toJSON()` only ever see data. The resolver decides what the callback receives.
|
|
138
|
+
*
|
|
139
|
+
* Opt-in: adapters without a resolver store query params as given. Declare the callback in the adapter's query params
|
|
140
|
+
* type so requests accept it.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // The Firebase adapter passes a constraints builder and stores the constraints it collected
|
|
144
|
+
* adapter.setQueryParamsResolver((callback) => callback(createConstraints()).toJSON());
|
|
145
|
+
*/
|
|
146
|
+
setQueryParamsResolver: (resolver: (callback: (...args: any[]) => unknown) => unknown) => this;
|
|
129
147
|
/** Set the configuration object passed as the second argument to the query params mapper. */
|
|
130
148
|
setQueryParamsMapperConfig: <NewQueryParamsMapperConfig extends Parameters<QueryParamsMapperType>[1]>(config: NewQueryParamsMapperConfig) => this;
|
|
131
149
|
/** Set the configuration object passed as the second argument to the header mapper. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAA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;IAEF;;;;OAIG;IAEH,4HAA4H;IACrH,UAAU,CACf,OAAO,EAAE,kBAAkB,CACzB,OAAO,CACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,CACf,CACF;IAMH,2HAA2H;IAC9G,KAAK,CAChB,OAAO,EAAE,aAAa,CACpB,eAAe,EACf;QAEE,MAAM,EAAE,MAAM,CACZ,GAAG,EACH,OAAO,CACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,CACf,CACF,CAAC;KACH,CACF,EACD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,KAAK,EAAE,CA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C9G,KAAK,CAChB,OAAO,EAAE,aAAa,CACpB,eAAe,EACf;QAEE,MAAM,EAAE,MAAM,CACZ,GAAG,EACH,OAAO,CACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,CACf,CACF,CAAC;KACH,CACF,EACD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;CAwFjD"}
|
package/dist/cache/cache.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export declare class Cache<Adapter extends AdapterInstance> {
|
|
|
37
37
|
hydrated?: boolean;
|
|
38
38
|
}) => void;
|
|
39
39
|
/**
|
|
40
|
-
* Update the cache data with partial response data
|
|
40
|
+
* Update the cache data with partial response data. The `responseTimestamp` is set to the time of the update, so
|
|
41
|
+
* the `cacheTime` and `staleTime` count from the update. Use `set` to store the data with another timestamp.
|
|
41
42
|
* @param request
|
|
42
43
|
* @param partialResponse
|
|
43
44
|
* @returns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/cache/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAgB,cAAc,EAAoB,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,kBA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BAAiB,aAAa,CAC5B,OAAO,CACL,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAChG,mBAAmB,CACtB,CACF,KACA,IAAI,CAiBL;IAEF;;;;OAIG;IACH,GAAG,GAAI,QAAQ,EAAE,KAAK,EAAE,UAAU,MAAM,KAAG,cAAc,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS,CAS7F;IAEF;;;OAGG;IACH,IAAI,QAAO,MAAM,EAAE,CAIjB;IAEF;;;OAGG;IACH,MAAM,GAAI,UAAU,MAAM,KAAG,IAAI,CAiB/B;IAEF;;;;;OAKG;IACH,UAAU,GAAI,YAAW,MAAM,GAAG,MAAM,GAAG,eAAe,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC,EAAS,UA2CvG;IAEF;;;OAGG;IACH,eAAe,GAAU,QAAQ,EAAE,KAAK,EACtC,UAAU,MAAM,KACf,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAuC9D;IAEF;;OAEG;IACH,WAAW,0BAIT;IAEF;;OAEG;IACH,UAAU,0BAMR;IAEF;;;;OAIG;IACH,wBAAwB,GAAI,UAAU,MAAM,UA0C1C;IAEF;;;OAGG;IACH,OAAO,CAAC,WAAW,CASjB;IAEF;;;OAGG;IACH,OAAO,CAAC,cAAc,CAkBpB;IAEF;;;OAGG;IACH,KAAK,QAAa,OAAO,CAAC,IAAI,CAAC,CAe7B;CACH"}
|
package/dist/client/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Dispatcher } from '../dispatcher';
|
|
|
5
5
|
import { HttpAdapterType } from '../http-adapter';
|
|
6
6
|
import { LogLevel, AppManager, LoggerManager, RequestManager } from '../managers';
|
|
7
7
|
import { PluginInstance, PluginMethodParameters, PluginMethods } from '../plugin';
|
|
8
|
-
import { RequestInstance, RequestJSON, RequestOptionsType, Request } from '../request';
|
|
8
|
+
import { ExtractEndpointPayloadType, ExtractEndpointResponseType, RequestInstance, RequestJSON, RequestOptionsType, Request } from '../request';
|
|
9
9
|
import { EmptyTypes, TypeWithDefaults, ExtractAdapterMethodType, ExtractAdapterOptionsType, ExtractAdapterQueryParamsType, ExtractAdapterEndpointType, ExtractUnionAdapter, HydrateDataType, HydrationOptions, ExtractAdapterDefaultQueryParamsType, ExtractAdapterRequestOptionsType } from '../types';
|
|
10
10
|
/**
|
|
11
11
|
* **Client** is a class that allows you to configure the connection with the server and then use it to create
|
|
@@ -198,7 +198,7 @@ export declare class Client<GlobalErrorType extends ClientErrorType = Error, Ada
|
|
|
198
198
|
*
|
|
199
199
|
* This solution will be removed once https://github.com/microsoft/TypeScript/issues/10571 get resolved.
|
|
200
200
|
*/
|
|
201
|
-
_USE_DOUBLE_INITIALIZATION?: never) => <EndpointType extends ExtractAdapterEndpointType<Adapter>, AdapterOptions extends ExtractAdapterOptionsType<Adapter>, MethodType extends ExtractAdapterMethodType<Adapter>>(params: RequestOptionsType<EndpointType, AdapterOptions, MethodType> & ExtractAdapterRequestOptionsType<Adapter>) => Request<TypeWithDefaults<RequestProperties, "response",
|
|
201
|
+
_USE_DOUBLE_INITIALIZATION?: never) => <EndpointType extends ExtractAdapterEndpointType<Adapter>, AdapterOptions extends ExtractAdapterOptionsType<Adapter>, MethodType extends ExtractAdapterMethodType<Adapter>>(params: RequestOptionsType<EndpointType, AdapterOptions, MethodType> & ExtractAdapterRequestOptionsType<Adapter>) => Request<TypeWithDefaults<RequestProperties, "response", ExtractEndpointResponseType<EndpointType>>, TypeWithDefaults<RequestProperties, "payload", ExtractEndpointPayloadType<EndpointType>>, TypeWithDefaults<RequestProperties, "queryParams", ExtractAdapterDefaultQueryParamsType<Adapter>, never>, TypeWithDefaults<RequestProperties, "error", GlobalErrorType>, TypeWithDefaults<RequestProperties, "endpoint", EndpointType> extends string ? TypeWithDefaults<RequestProperties, "endpoint", EndpointType> : any, Client<GlobalErrorType, ExtractUnionAdapter<Adapter, {
|
|
202
202
|
method: MethodType;
|
|
203
203
|
options: AdapterOptions;
|
|
204
204
|
queryParams: TypeWithDefaults<RequestProperties, "queryParams", ExtractAdapterDefaultQueryParamsType<Adapter>, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACpF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,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IACH,uBAAuB,GAAU,UAAU,YAAY,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,SAAS,eAAe,0DAM3G;IAEL;;;;OAIG;IACH,QAAQ,GAAI,iBAAiB,SAAS,kBAAkB,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EACnG,MAAM,WAAW,CAAC,eAAe,CAAC,KAU6C,OAAO,iSAKpF,gEAAiB,MAAM,6DAAc,MAAM,EAC3C,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CACjC,CACD;IAEF;;OAEG;IACH,KAAK,aAuCH;IAEF;;;;OAIG;IACH,OAAO,GACL,eAAe,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,EAC/C,UAAU,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAwC5F;IAEF;;;;OAIG;IACH,aAAa,GAAI,iBAAiB,SAAS,kBAAkB,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE;IACxG;;;;;;;;;;;;;;;OAeG;IAEH,6BAA6B,KAAK,MAShC,YAAY,SAAS,0BAA0B,CAAC,OAAO,CAAC,EACxD,cAAc,SAAS,yBAAyB,CAAC,OAAO,CAAC,EACzD,UAAU,SAAS,wBAAwB,CAAC,OAAO,CAAC,EAEpD,QAAQ,kBAAkB,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,CAAC,GAAG,gCAAgC,CAAC,OAAO,CAAC;gBAapG,UAAU;iBACT,cAAc;;;gBADf,UAAU;iBACT,cAAc;;yCA4B7B;CACH"}
|
|
@@ -36,9 +36,30 @@ export declare class Dispatcher<Adapter extends AdapterInstance> {
|
|
|
36
36
|
private sentCount;
|
|
37
37
|
/** Cache element (by its storage key) to the order number of the request whose data it holds */
|
|
38
38
|
private cachedOrder;
|
|
39
|
+
/** Sends the queue restored from the storage once the client is configured */
|
|
40
|
+
private startTimer;
|
|
41
|
+
/** Operations of the lazy storage run one after another, so it always ends with the latest state of the queues */
|
|
42
|
+
private lazyOperations;
|
|
39
43
|
private logger;
|
|
40
44
|
private client;
|
|
41
45
|
constructor(options?: DispatcherOptionsType | undefined);
|
|
46
|
+
/**
|
|
47
|
+
* Lazy storage is an external resource - its failures are logged, they must not take the requests down
|
|
48
|
+
*/
|
|
49
|
+
private runLazyOperation;
|
|
50
|
+
/**
|
|
51
|
+
* Snapshot of the queue as JSON data - taken right away, as the queue objects change after the write is scheduled
|
|
52
|
+
*/
|
|
53
|
+
private getLazyQueueData;
|
|
54
|
+
/**
|
|
55
|
+
* The sync storage stays the source of truth, its changes are written through to the lazy storage
|
|
56
|
+
*/
|
|
57
|
+
private withLazyStorage;
|
|
58
|
+
/**
|
|
59
|
+
* Reads the queues persisted by the previous run. Persisted requests are older than the ones added since the start,
|
|
60
|
+
* so they go first. Requests already in the queue are not added twice.
|
|
61
|
+
*/
|
|
62
|
+
private restoreLazyQueues;
|
|
42
63
|
private isRequestJSON;
|
|
43
64
|
initialize: (client: ClientInstance<{
|
|
44
65
|
adapter: Adapter;
|
|
@@ -98,7 +119,8 @@ export declare class Dispatcher<Adapter extends AdapterInstance> {
|
|
|
98
119
|
private emitRemovedItems;
|
|
99
120
|
/**
|
|
100
121
|
* A request can be sent when it is not in flight, not held by `stopRequest`, not waiting for its retry,
|
|
101
|
-
* not just answered and - for the requests kept for later with the `offline` option - when there is a connection
|
|
122
|
+
* not just answered and - for the requests kept for later with the `offline` option - when there is a connection.
|
|
123
|
+
* Nothing is sent while the page unloads - the browser would cancel it right away.
|
|
102
124
|
*/
|
|
103
125
|
private canPerformRequest;
|
|
104
126
|
/**
|
|
@@ -197,6 +219,11 @@ export declare class Dispatcher<Adapter extends AdapterInstance> {
|
|
|
197
219
|
* The `retryOnError` callback belongs to the user - when it throws, the request is not retried
|
|
198
220
|
*/
|
|
199
221
|
private getShouldRetryOnError;
|
|
222
|
+
/**
|
|
223
|
+
* Delay of the next attempt from the `retryTime` of the request. The function form belongs to the user - when it
|
|
224
|
+
* throws, the request is not retried (`null`). Anything but a positive finite delay retries right away.
|
|
225
|
+
*/
|
|
226
|
+
private getRetryDelay;
|
|
200
227
|
/**
|
|
201
228
|
* Request can run for some time, once it's done, we have to check if it's successful or if it was aborted
|
|
202
229
|
* It can be different once the previous call was set as cancelled and removed from queue before this request got resolved
|