typedrest 0.4.0 → 0.5.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 +2 -0
- package/endpoints/Endpoint.js +14 -27
- package/endpoints/Endpoint.ts +5 -5
- package/endpoints/EntryEndpoint.js +3 -14
- package/endpoints/generic/ETagEndpointBase.js +27 -42
- package/endpoints/generic/ElementEndpoint.js +39 -60
- package/endpoints/generic/GenericCollectionEndpoint.js +70 -44
- package/endpoints/generic/GenericCollectionEndpoint.test.ts +123 -0
- package/endpoints/generic/GenericCollectionEndpoint.ts +54 -1
- package/endpoints/generic/PartialResponse.js +33 -0
- package/endpoints/generic/PartialResponse.ts +28 -0
- package/endpoints/generic/index.js +2 -1
- package/endpoints/generic/index.ts +1 -0
- package/endpoints/index.js +3 -2
- package/endpoints/index.ts +1 -0
- package/endpoints/raw/BlobEndpoint.js +10 -27
- package/endpoints/raw/UploadEndpoint.js +11 -23
- package/endpoints/raw/UploadEndpoint.test.ts +1 -4
- package/endpoints/raw/UploadEndpoint.ts +1 -2
- package/endpoints/reactive/Delay.js +27 -0
- package/endpoints/reactive/Delay.ts +26 -0
- package/endpoints/reactive/GenericStreamingCollectionEndpoint.js +79 -0
- package/endpoints/reactive/GenericStreamingCollectionEndpoint.ts +73 -0
- package/endpoints/reactive/PollingEndpoint.js +67 -0
- package/endpoints/reactive/PollingEndpoint.test.ts +84 -0
- package/endpoints/reactive/PollingEndpoint.ts +66 -0
- package/endpoints/reactive/SseStreamingEndpoint.js +120 -0
- package/endpoints/reactive/SseStreamingEndpoint.test.ts +169 -0
- package/endpoints/reactive/SseStreamingEndpoint.ts +115 -0
- package/endpoints/reactive/StreamingCollectionEndpoint.js +23 -0
- package/endpoints/reactive/StreamingCollectionEndpoint.test.ts +110 -0
- package/endpoints/reactive/StreamingCollectionEndpoint.ts +20 -0
- package/endpoints/reactive/StreamingEndpoint.js +56 -0
- package/endpoints/reactive/StreamingEndpoint.test.ts +130 -0
- package/endpoints/reactive/StreamingEndpoint.ts +50 -0
- package/endpoints/reactive/index.js +22 -0
- package/endpoints/reactive/index.ts +5 -0
- package/endpoints/rpc/ActionEndpoint.js +3 -14
- package/endpoints/rpc/ConsumerEndpoint.js +5 -16
- package/endpoints/rpc/FunctionEndpoint.js +6 -17
- package/endpoints/rpc/ProducerEndpoint.js +4 -15
- package/endpoints/rpc/RpcEndpointBase.js +3 -14
- package/errors/DefaultErrorHandler.js +20 -22
- package/errors/DefaultErrorHandler.ts +12 -4
- package/errors/Errors.js +8 -2
- package/errors/Errors.ts +5 -0
- package/http/EntityStream.js +42 -0
- package/http/EntityStream.ts +40 -0
- package/http/HttpContentRange.js +39 -0
- package/http/HttpContentRange.ts +41 -0
- package/http/HttpHeader.js +6 -1
- package/http/HttpHeader.ts +6 -1
- package/http/HttpStatusCode.js +4 -1
- package/http/HttpStatusCode.ts +4 -1
- package/http/ResponseCache.js +4 -15
- package/http/RetryAfter.js +24 -0
- package/http/RetryAfter.ts +19 -0
- package/http/ServerSentEvents.js +140 -0
- package/http/ServerSentEvents.ts +145 -0
- package/http/index.js +5 -1
- package/http/index.ts +4 -0
- package/jest.config.js +1 -1
- package/links/AggregateLinkExtractor.js +7 -18
- package/links/HalLinkExtractor.js +9 -20
- package/links/HeaderLinkExtractor.js +5 -16
- package/links/HeaderLinkExtractor.ts +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.delay = delay;
|
|
4
|
+
/**
|
|
5
|
+
* Waits for a specific amount of time.
|
|
6
|
+
* @param ms The time to wait in milliseconds.
|
|
7
|
+
* @param signal Used to cancel the wait.
|
|
8
|
+
* @returns `true` if the time has elapsed; `false` if the wait was cancelled via the `signal`.
|
|
9
|
+
*/
|
|
10
|
+
function delay(ms, signal) {
|
|
11
|
+
return new Promise(resolve => {
|
|
12
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
13
|
+
resolve(false);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const onAbort = () => {
|
|
17
|
+
clearTimeout(timeout);
|
|
18
|
+
resolve(false);
|
|
19
|
+
};
|
|
20
|
+
const timeout = setTimeout(() => {
|
|
21
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
22
|
+
resolve(true);
|
|
23
|
+
}, ms);
|
|
24
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGVsYXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJEZWxheS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQU1BLHNCQW1CQztBQXpCRDs7Ozs7R0FLRztBQUNILFNBQWdCLEtBQUssQ0FBQyxFQUFVLEVBQUUsTUFBb0I7SUFDbEQsT0FBTyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsRUFBRTtRQUN6QixJQUFJLE1BQU0sYUFBTixNQUFNLHVCQUFOLE1BQU0sQ0FBRSxPQUFPLEVBQUUsQ0FBQztZQUNsQixPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDZixPQUFPO1FBQ1gsQ0FBQztRQUVELE1BQU0sT0FBTyxHQUFHLEdBQUcsRUFBRTtZQUNqQixZQUFZLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDdEIsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ25CLENBQUMsQ0FBQztRQUVGLE1BQU0sT0FBTyxHQUFHLFVBQVUsQ0FBQyxHQUFHLEVBQUU7WUFDNUIsTUFBTSxhQUFOLE1BQU0sdUJBQU4sTUFBTSxDQUFFLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQztZQUM5QyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDbEIsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRVAsTUFBTSxhQUFOLE1BQU0sdUJBQU4sTUFBTSxDQUFFLGdCQUFnQixDQUFDLE9BQU8sRUFBRSxPQUFPLEVBQUUsRUFBRSxJQUFJLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQztJQUMvRCxDQUFDLENBQUMsQ0FBQztBQUNQLENBQUMifQ==
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waits for a specific amount of time.
|
|
3
|
+
* @param ms The time to wait in milliseconds.
|
|
4
|
+
* @param signal Used to cancel the wait.
|
|
5
|
+
* @returns `true` if the time has elapsed; `false` if the wait was cancelled via the `signal`.
|
|
6
|
+
*/
|
|
7
|
+
export function delay(ms: number, signal?: AbortSignal): Promise<boolean> {
|
|
8
|
+
return new Promise(resolve => {
|
|
9
|
+
if (signal?.aborted) {
|
|
10
|
+
resolve(false);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const onAbort = () => {
|
|
15
|
+
clearTimeout(timeout);
|
|
16
|
+
resolve(false);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const timeout = setTimeout(() => {
|
|
20
|
+
signal?.removeEventListener("abort", onAbort);
|
|
21
|
+
resolve(true);
|
|
22
|
+
}, ms);
|
|
23
|
+
|
|
24
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenericStreamingCollectionEndpoint = void 0;
|
|
4
|
+
const GenericCollectionEndpoint_1 = require("../generic/GenericCollectionEndpoint");
|
|
5
|
+
const Delay_1 = require("./Delay");
|
|
6
|
+
const http_1 = require("../../http");
|
|
7
|
+
const errors_1 = require("../../errors");
|
|
8
|
+
/**
|
|
9
|
+
* Endpoint for a collection of `TEntity`s observable as an append-only stream using long-polling.<br>
|
|
10
|
+
* Use {@link StreamingCollectionEndpoint} instead if you wish to use the default {@link ElementEndpoint} type.
|
|
11
|
+
* @typeParam TEntity The type of individual elements in the collection.
|
|
12
|
+
* @typeParam TElementEndpoint The type of {@link ElementEndpoint} to provide for individual `TEntity`s.
|
|
13
|
+
*/
|
|
14
|
+
class GenericStreamingCollectionEndpoint extends GenericCollectionEndpoint_1.GenericCollectionEndpoint {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* The interval in milliseconds to wait between polling requests.
|
|
19
|
+
* Automatically updated whenever the server sends a {@link http!HttpHeader.RetryAfter} header.
|
|
20
|
+
*/
|
|
21
|
+
this.pollingInterval = 3000;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
async handle(response) {
|
|
27
|
+
var _a;
|
|
28
|
+
await super.handle(response);
|
|
29
|
+
this.pollingInterval = (_a = (0, http_1.retryAfter)(response)) !== null && _a !== void 0 ? _a : this.pollingInterval;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provides a stream of `TEntity`s, polling the server for elements appended to the collection.
|
|
33
|
+
* @param startIndex The index of the first element to return. Use a negative value to start with the last `-startIndex` elements ("tail").
|
|
34
|
+
* @param signal Used to stop polling.
|
|
35
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
36
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
37
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
38
|
+
*/
|
|
39
|
+
async *stream(startIndex = 0, signal) {
|
|
40
|
+
var _a;
|
|
41
|
+
let currentStartIndex = startIndex;
|
|
42
|
+
while (!(signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
43
|
+
let response;
|
|
44
|
+
try {
|
|
45
|
+
response = (currentStartIndex >= 0)
|
|
46
|
+
// Offset
|
|
47
|
+
? await this.readRange(currentStartIndex, undefined, signal)
|
|
48
|
+
// Tail
|
|
49
|
+
: await this.readRange(undefined, -currentStartIndex, signal);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// Aborting is a regular way of ending the stream, not an error
|
|
53
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
54
|
+
return;
|
|
55
|
+
if (!(err instanceof errors_1.RangeNotSatisfiableError))
|
|
56
|
+
throw err;
|
|
57
|
+
// No new data available yet, keep polling
|
|
58
|
+
if (!await (0, Delay_1.delay)(this.pollingInterval, signal))
|
|
59
|
+
return;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
yield* response.elements;
|
|
63
|
+
if (response.endReached)
|
|
64
|
+
return;
|
|
65
|
+
// Continue polling for more data
|
|
66
|
+
if (((_a = response.range) === null || _a === void 0 ? void 0 : _a.to) === undefined)
|
|
67
|
+
return;
|
|
68
|
+
currentStartIndex = response.range.to + 1;
|
|
69
|
+
if (!await (0, Delay_1.delay)(this.pollingInterval, signal))
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Provides a stream of `TEntity`s using {@link stream}.
|
|
75
|
+
*/
|
|
76
|
+
[Symbol.asyncIterator]() { return this.stream(); }
|
|
77
|
+
}
|
|
78
|
+
exports.GenericStreamingCollectionEndpoint = GenericStreamingCollectionEndpoint;
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR2VuZXJpY1N0cmVhbWluZ0NvbGxlY3Rpb25FbmRwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkdlbmVyaWNTdHJlYW1pbmdDb2xsZWN0aW9uRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLC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ionEndpoint";
|
|
3
|
+
import { PartialResponse } from "../generic/PartialResponse";
|
|
4
|
+
import { delay } from "./Delay";
|
|
5
|
+
import { retryAfter } from "../../http";
|
|
6
|
+
import { RangeNotSatisfiableError } from "../../errors";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Endpoint for a collection of `TEntity`s observable as an append-only stream using long-polling.<br>
|
|
10
|
+
* Use {@link StreamingCollectionEndpoint} instead if you wish to use the default {@link ElementEndpoint} type.
|
|
11
|
+
* @typeParam TEntity The type of individual elements in the collection.
|
|
12
|
+
* @typeParam TElementEndpoint The type of {@link ElementEndpoint} to provide for individual `TEntity`s.
|
|
13
|
+
*/
|
|
14
|
+
export class GenericStreamingCollectionEndpoint<TEntity, TElementEndpoint extends ElementEndpoint<TEntity>> extends GenericCollectionEndpoint<TEntity, TElementEndpoint> {
|
|
15
|
+
/**
|
|
16
|
+
* The interval in milliseconds to wait between polling requests.
|
|
17
|
+
* Automatically updated whenever the server sends a {@link http!HttpHeader.RetryAfter} header.
|
|
18
|
+
*/
|
|
19
|
+
pollingInterval = 3000;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
protected async handle(response: Response) {
|
|
25
|
+
await super.handle(response);
|
|
26
|
+
this.pollingInterval = retryAfter(response) ?? this.pollingInterval;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Provides a stream of `TEntity`s, polling the server for elements appended to the collection.
|
|
31
|
+
* @param startIndex The index of the first element to return. Use a negative value to start with the last `-startIndex` elements ("tail").
|
|
32
|
+
* @param signal Used to stop polling.
|
|
33
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
34
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
35
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
36
|
+
*/
|
|
37
|
+
async *stream(startIndex: number = 0, signal?: AbortSignal): AsyncIterableIterator<TEntity> {
|
|
38
|
+
let currentStartIndex = startIndex;
|
|
39
|
+
|
|
40
|
+
while (!signal?.aborted) {
|
|
41
|
+
let response: PartialResponse<TEntity>;
|
|
42
|
+
try {
|
|
43
|
+
response = (currentStartIndex >= 0)
|
|
44
|
+
// Offset
|
|
45
|
+
? await this.readRange(currentStartIndex, undefined, signal)
|
|
46
|
+
// Tail
|
|
47
|
+
: await this.readRange(undefined, -currentStartIndex, signal);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
// Aborting is a regular way of ending the stream, not an error
|
|
50
|
+
if (signal?.aborted) return;
|
|
51
|
+
if (!(err instanceof RangeNotSatisfiableError)) throw err;
|
|
52
|
+
|
|
53
|
+
// No new data available yet, keep polling
|
|
54
|
+
if (!await delay(this.pollingInterval, signal)) return;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
yield* response.elements;
|
|
59
|
+
if (response.endReached) return;
|
|
60
|
+
|
|
61
|
+
// Continue polling for more data
|
|
62
|
+
if (response.range?.to === undefined) return;
|
|
63
|
+
currentStartIndex = response.range.to + 1;
|
|
64
|
+
|
|
65
|
+
if (!await delay(this.pollingInterval, signal)) return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Provides a stream of `TEntity`s using {@link stream}.
|
|
71
|
+
*/
|
|
72
|
+
[Symbol.asyncIterator]() { return this.stream(); }
|
|
73
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PollingEndpoint = void 0;
|
|
4
|
+
const ElementEndpoint_1 = require("../generic/ElementEndpoint");
|
|
5
|
+
const Delay_1 = require("./Delay");
|
|
6
|
+
const http_1 = require("../../http");
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint for a resource that can be polled for state changes.
|
|
9
|
+
* @typeParam TEntity The type of entity the endpoint represents.
|
|
10
|
+
*/
|
|
11
|
+
class PollingEndpoint extends ElementEndpoint_1.ElementEndpoint {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new polling endpoint.
|
|
14
|
+
* @param referrer The endpoint used to navigate to this one.
|
|
15
|
+
* @param relativeUri The URI of this endpoint relative to the `referrer`'s. Add a `./` prefix here to imply a trailing slash in the `referrer`'s URI.
|
|
16
|
+
* @param endCondition A check to determine whether the entity has reached its final state and no further polling is required.
|
|
17
|
+
*/
|
|
18
|
+
constructor(referrer, relativeUri, endCondition) {
|
|
19
|
+
super(referrer, relativeUri);
|
|
20
|
+
this.endCondition = endCondition;
|
|
21
|
+
/**
|
|
22
|
+
* The interval in milliseconds to wait between polling requests.
|
|
23
|
+
* Automatically updated whenever the server sends a {@link http!HttpHeader.RetryAfter} header.
|
|
24
|
+
*/
|
|
25
|
+
this.pollingInterval = 3000;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
async handle(response) {
|
|
31
|
+
var _a;
|
|
32
|
+
await super.handle(response);
|
|
33
|
+
this.pollingInterval = (_a = (0, http_1.retryAfter)(response)) !== null && _a !== void 0 ? _a : this.pollingInterval;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Provides a stream of the `TEntity`'s states, polling the server for changes.
|
|
37
|
+
* States that are identical to the previously provided one are skipped.
|
|
38
|
+
* @param signal Used to stop polling.
|
|
39
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
40
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
41
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
42
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
43
|
+
*/
|
|
44
|
+
async *stream(signal) {
|
|
45
|
+
var _a;
|
|
46
|
+
// NOTE: Compare the serialized form because every poll deserializes a new object instance.
|
|
47
|
+
let previous;
|
|
48
|
+
while (!(signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
49
|
+
const entity = await this.read(signal);
|
|
50
|
+
const serialized = this.serializer.serialize(entity);
|
|
51
|
+
if (serialized !== previous) {
|
|
52
|
+
previous = serialized;
|
|
53
|
+
yield entity;
|
|
54
|
+
}
|
|
55
|
+
if ((_a = this.endCondition) === null || _a === void 0 ? void 0 : _a.call(this, entity))
|
|
56
|
+
return;
|
|
57
|
+
if (!await (0, Delay_1.delay)(this.pollingInterval, signal))
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Provides a stream of the `TEntity`'s states using {@link stream}.
|
|
63
|
+
*/
|
|
64
|
+
[Symbol.asyncIterator]() { return this.stream(); }
|
|
65
|
+
}
|
|
66
|
+
exports.PollingEndpoint = PollingEndpoint;
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUG9sbGluZ0VuZHBvaW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiUG9sbGluZ0VuZHBvaW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLGdFQUE2RDtBQUU3RCxtQ0FBZ0M7QUFDaEMscUNBQXdDO0FBRXhDOzs7R0FHRztBQUNILE1BQWEsZUFBeUIsU0FBUSxpQ0FBd0I7SUFDbEU7Ozs7O09BS0c7SUFDSCxZQUFZLFFBQWtCLEVBQUUsV0FBeUIsRUFBbUIsWUFBMkM7UUFDbkgsS0FBSyxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztRQUQyQyxpQkFBWSxHQUFaLFlBQVksQ0FBK0I7UUFJdkg7OztXQUdHO1FBQ0gsb0JBQWUsR0FBRyxJQUFJLENBQUM7SUFOdkIsQ0FBQztJQVFEOztPQUVHO0lBQ08sS0FBSyxDQU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Q0FDckQ7QUF4REQsMENBd0RDIn0=
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fetchMock from 'jest-fetch-mock';
|
|
2
|
+
import { PollingEndpoint } from '.';
|
|
3
|
+
import { EntryEndpoint } from '..';
|
|
4
|
+
import { HttpHeader } from '../../http';
|
|
5
|
+
|
|
6
|
+
class MockEntity {
|
|
7
|
+
constructor(public id: number, public name: string) { }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
fetchMock.enableMocks();
|
|
11
|
+
let endpoint: PollingEndpoint<MockEntity>;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
fetchMock.resetMocks();
|
|
15
|
+
endpoint = new PollingEndpoint<MockEntity>(new EntryEndpoint('http://localhost/'), 'endpoint', x => x.id === 3);
|
|
16
|
+
endpoint.pollingInterval = 0;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
async function collect<T>(stream: AsyncIterable<T>) {
|
|
20
|
+
const result: T[] = [];
|
|
21
|
+
for await (const element of stream) result.push(element);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test('stream', async () => {
|
|
26
|
+
fetchMock.mockResponses(
|
|
27
|
+
'{"id":1,"name":"test"}',
|
|
28
|
+
'{"id":2,"name":"test"}',
|
|
29
|
+
['{"id":3,"name":"test"}', { headers: { [HttpHeader.RetryAfter]: '42' } }]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(await collect(endpoint.stream())).toEqual([
|
|
33
|
+
new MockEntity(1, 'test'),
|
|
34
|
+
new MockEntity(2, 'test'),
|
|
35
|
+
new MockEntity(3, 'test')
|
|
36
|
+
]);
|
|
37
|
+
expect(endpoint.pollingInterval).toBe(42000);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('streamSkipsUnchanged', async () => {
|
|
41
|
+
fetchMock.mockResponses(
|
|
42
|
+
'{"id":1,"name":"test"}',
|
|
43
|
+
'{"id":1,"name":"test"}',
|
|
44
|
+
'{"id":2,"name":"test"}',
|
|
45
|
+
'{"id":3,"name":"test"}'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
expect(await collect(endpoint.stream())).toEqual([
|
|
49
|
+
new MockEntity(1, 'test'),
|
|
50
|
+
new MockEntity(2, 'test'),
|
|
51
|
+
new MockEntity(3, 'test')
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('streamAsyncIterator', async () => {
|
|
56
|
+
fetchMock.mockResponses('{"id":3,"name":"test"}');
|
|
57
|
+
|
|
58
|
+
expect(await collect(endpoint)).toEqual([new MockEntity(3, 'test')]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('streamAbort', async () => {
|
|
62
|
+
fetchMock.mockResponse('{"id":1,"name":"test"}');
|
|
63
|
+
const controller = new AbortController();
|
|
64
|
+
|
|
65
|
+
const result: MockEntity[] = [];
|
|
66
|
+
for await (const element of endpoint.stream(controller.signal)) {
|
|
67
|
+
result.push(element);
|
|
68
|
+
controller.abort();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
expect(result).toEqual([new MockEntity(1, 'test')]);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('streamBreak', async () => {
|
|
75
|
+
fetchMock.mockResponse('{"id":1,"name":"test"}');
|
|
76
|
+
|
|
77
|
+
const result: MockEntity[] = [];
|
|
78
|
+
for await (const element of endpoint.stream()) {
|
|
79
|
+
result.push(element);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
expect(result).toEqual([new MockEntity(1, 'test')]);
|
|
84
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ElementEndpoint } from "../generic/ElementEndpoint";
|
|
2
|
+
import { Endpoint } from "../Endpoint";
|
|
3
|
+
import { delay } from "./Delay";
|
|
4
|
+
import { retryAfter } from "../../http";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Endpoint for a resource that can be polled for state changes.
|
|
8
|
+
* @typeParam TEntity The type of entity the endpoint represents.
|
|
9
|
+
*/
|
|
10
|
+
export class PollingEndpoint<TEntity> extends ElementEndpoint<TEntity> {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new polling endpoint.
|
|
13
|
+
* @param referrer The endpoint used to navigate to this one.
|
|
14
|
+
* @param relativeUri The URI of this endpoint relative to the `referrer`'s. Add a `./` prefix here to imply a trailing slash in the `referrer`'s URI.
|
|
15
|
+
* @param endCondition A check to determine whether the entity has reached its final state and no further polling is required.
|
|
16
|
+
*/
|
|
17
|
+
constructor(referrer: Endpoint, relativeUri: URL | string, private readonly endCondition?: (entity: TEntity) => boolean) {
|
|
18
|
+
super(referrer, relativeUri);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The interval in milliseconds to wait between polling requests.
|
|
23
|
+
* Automatically updated whenever the server sends a {@link http!HttpHeader.RetryAfter} header.
|
|
24
|
+
*/
|
|
25
|
+
pollingInterval = 3000;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
protected async handle(response: Response) {
|
|
31
|
+
await super.handle(response);
|
|
32
|
+
this.pollingInterval = retryAfter(response) ?? this.pollingInterval;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Provides a stream of the `TEntity`'s states, polling the server for changes.
|
|
37
|
+
* States that are identical to the previously provided one are skipped.
|
|
38
|
+
* @param signal Used to stop polling.
|
|
39
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
40
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
41
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
42
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
43
|
+
*/
|
|
44
|
+
async *stream(signal?: AbortSignal): AsyncIterableIterator<TEntity> {
|
|
45
|
+
// NOTE: Compare the serialized form because every poll deserializes a new object instance.
|
|
46
|
+
let previous: string | undefined;
|
|
47
|
+
|
|
48
|
+
while (!signal?.aborted) {
|
|
49
|
+
const entity = await this.read(signal);
|
|
50
|
+
|
|
51
|
+
const serialized = this.serializer.serialize(entity);
|
|
52
|
+
if (serialized !== previous) {
|
|
53
|
+
previous = serialized;
|
|
54
|
+
yield entity;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.endCondition?.(entity)) return;
|
|
58
|
+
if (!await delay(this.pollingInterval, signal)) return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Provides a stream of the `TEntity`'s states using {@link stream}.
|
|
64
|
+
*/
|
|
65
|
+
[Symbol.asyncIterator]() { return this.stream(); }
|
|
66
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SseStreamingEndpoint = void 0;
|
|
4
|
+
const Endpoint_1 = require("../Endpoint");
|
|
5
|
+
const Delay_1 = require("./Delay");
|
|
6
|
+
const http_1 = require("../../http");
|
|
7
|
+
const eventStreamMediaType = "text/event-stream";
|
|
8
|
+
/**
|
|
9
|
+
* Endpoint for a stream of `TEntity`s using Server-Sent Events (SSE).<br>
|
|
10
|
+
* Sends `Accept: text/event-stream`. By default, transparently reconnects on connection drops or transient errors,
|
|
11
|
+
* honoring the server-supplied `retry:` interval and resuming via the {@link http!HttpHeader.LastEventId} header.
|
|
12
|
+
* @typeParam TEntity The type of individual elements in the stream.
|
|
13
|
+
*/
|
|
14
|
+
class SseStreamingEndpoint extends Endpoint_1.Endpoint {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new SSE streaming endpoint.
|
|
17
|
+
* @param referrer The endpoint used to navigate to this one.
|
|
18
|
+
* @param relativeUri The URI of this endpoint relative to the `referrer`'s. Add a `./` prefix here to imply a trailing slash in the `referrer`'s URI.
|
|
19
|
+
* @param eventType If set, only events with this `event:` type are provided; others are ignored. Leave unspecified to provide all events.
|
|
20
|
+
*/
|
|
21
|
+
constructor(referrer, relativeUri, eventType) {
|
|
22
|
+
super(referrer, relativeUri);
|
|
23
|
+
this.eventType = eventType;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to transparently reconnect on connection drops, transient transport errors and 5xx responses.
|
|
26
|
+
*/
|
|
27
|
+
this.autoReconnect = true;
|
|
28
|
+
/**
|
|
29
|
+
* The reconnection interval in milliseconds used when the server has not (yet) supplied one via the SSE `retry:` field.
|
|
30
|
+
*/
|
|
31
|
+
this.defaultReconnectionInterval = 3000;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Provides a stream of `TEntity`s, reconnecting as needed unless {@link autoReconnect} is disabled.
|
|
35
|
+
* @param signal Used to close the connection.
|
|
36
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
37
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
38
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
39
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
40
|
+
*/
|
|
41
|
+
async *stream(signal) {
|
|
42
|
+
const state = { lastEventId: undefined, reconnectionInterval: this.defaultReconnectionInterval };
|
|
43
|
+
while (!(signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
44
|
+
let reconnect;
|
|
45
|
+
try {
|
|
46
|
+
reconnect = yield* this.consumeOnce(state, signal);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
// Aborting is a regular way of ending the stream, not an error
|
|
50
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
51
|
+
return;
|
|
52
|
+
// Transport-level failures are the ones worth retrying; anything else is the server telling us no
|
|
53
|
+
if (!this.autoReconnect || !SseStreamingEndpoint.isTransient(err))
|
|
54
|
+
throw err;
|
|
55
|
+
reconnect = true;
|
|
56
|
+
}
|
|
57
|
+
if (!reconnect)
|
|
58
|
+
return;
|
|
59
|
+
if (!await (0, Delay_1.delay)(state.reconnectionInterval, signal))
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Provides a stream of `TEntity`s using {@link stream}.
|
|
65
|
+
*/
|
|
66
|
+
[Symbol.asyncIterator]() { return this.stream(); }
|
|
67
|
+
/**
|
|
68
|
+
* Opens a connection and provides events until the stream ends.
|
|
69
|
+
* @param state Carries the last event id and the reconnection interval over to the next attempt.
|
|
70
|
+
* @param signal Used to close the connection.
|
|
71
|
+
* @returns `true` if another connection attempt should be made; `false` if the stream has ended for good.
|
|
72
|
+
*/
|
|
73
|
+
async *consumeOnce(state, signal) {
|
|
74
|
+
var _a;
|
|
75
|
+
// NOTE: Abort the request when the consumer stops iterating, not just when the caller's signal fires.
|
|
76
|
+
const controller = new AbortController();
|
|
77
|
+
const onAbort = () => controller.abort();
|
|
78
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
79
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
80
|
+
controller.abort();
|
|
81
|
+
try {
|
|
82
|
+
const headers = new Headers({ [http_1.HttpHeader.Accept]: eventStreamMediaType });
|
|
83
|
+
if (state.lastEventId)
|
|
84
|
+
headers.set(http_1.HttpHeader.LastEventId, state.lastEventId);
|
|
85
|
+
const response = await this.httpClient.send(this.uri, http_1.HttpMethod.Get, controller.signal, headers);
|
|
86
|
+
if (response.status === http_1.HttpStatusCode.NoContent)
|
|
87
|
+
return false;
|
|
88
|
+
if (this.autoReconnect && response.status >= 500)
|
|
89
|
+
return true;
|
|
90
|
+
await this.handle(response);
|
|
91
|
+
const reader = new http_1.SseReader(response);
|
|
92
|
+
try {
|
|
93
|
+
for await (const event of reader.events()) {
|
|
94
|
+
if (this.eventType !== undefined && event.type !== this.eventType)
|
|
95
|
+
continue;
|
|
96
|
+
yield this.serializer.deserialize(event.data);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
state.lastEventId = (_a = reader.lastEventId) !== null && _a !== void 0 ? _a : state.lastEventId;
|
|
101
|
+
if (reader.reconnectionInterval !== undefined)
|
|
102
|
+
state.reconnectionInterval = reader.reconnectionInterval;
|
|
103
|
+
}
|
|
104
|
+
return this.autoReconnect;
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
108
|
+
controller.abort();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Determines whether an error is a transport-level failure that may succeed on a retry.
|
|
113
|
+
* The Fetch API reports these as `TypeError`s, while responses the server actually sent become {@link errors!HttpError}s.
|
|
114
|
+
*/
|
|
115
|
+
static isTransient(err) {
|
|
116
|
+
return err instanceof TypeError;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.SseStreamingEndpoint = SseStreamingEndpoint;
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3NlU3RyZWFtaW5nRW5kcG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJTc2VTdHJlYW1pbmdFbmRwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBdUM7QUFDdkMsbUNBQWdDO0FBQ2hDLHFDQUErRTtBQUUvRSxNQUFNLG9CQUFvQixHQUFHLG1CQUFtQixDQUFDO0FBRWpEOzs7OztHQUtHO0FBQ0gsTUFBYSxvQkFBOEIsU0FBUSxtQkFBUTtJQUN2RDs7Ozs7T0FLRztJQUNILFlBQVksUUFBa0IsRUFBRSxXQUF5QixFQUFtQixTQUFrQjtRQUMxR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