typedrest 0.4.1 → 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.
Files changed (62) hide show
  1. package/README.md +2 -0
  2. package/endpoints/Endpoint.js +9 -22
  3. package/endpoints/EntryEndpoint.js +3 -14
  4. package/endpoints/generic/ETagEndpointBase.js +27 -42
  5. package/endpoints/generic/ElementEndpoint.js +39 -60
  6. package/endpoints/generic/GenericCollectionEndpoint.js +70 -44
  7. package/endpoints/generic/GenericCollectionEndpoint.test.ts +123 -0
  8. package/endpoints/generic/GenericCollectionEndpoint.ts +54 -1
  9. package/endpoints/generic/PartialResponse.js +33 -0
  10. package/endpoints/generic/PartialResponse.ts +28 -0
  11. package/endpoints/generic/index.js +2 -1
  12. package/endpoints/generic/index.ts +1 -0
  13. package/endpoints/index.js +3 -2
  14. package/endpoints/index.ts +1 -0
  15. package/endpoints/raw/BlobEndpoint.js +10 -27
  16. package/endpoints/raw/UploadEndpoint.js +11 -22
  17. package/endpoints/reactive/Delay.js +27 -0
  18. package/endpoints/reactive/Delay.ts +26 -0
  19. package/endpoints/reactive/GenericStreamingCollectionEndpoint.js +79 -0
  20. package/endpoints/reactive/GenericStreamingCollectionEndpoint.ts +73 -0
  21. package/endpoints/reactive/PollingEndpoint.js +67 -0
  22. package/endpoints/reactive/PollingEndpoint.test.ts +84 -0
  23. package/endpoints/reactive/PollingEndpoint.ts +66 -0
  24. package/endpoints/reactive/SseStreamingEndpoint.js +120 -0
  25. package/endpoints/reactive/SseStreamingEndpoint.test.ts +169 -0
  26. package/endpoints/reactive/SseStreamingEndpoint.ts +115 -0
  27. package/endpoints/reactive/StreamingCollectionEndpoint.js +23 -0
  28. package/endpoints/reactive/StreamingCollectionEndpoint.test.ts +110 -0
  29. package/endpoints/reactive/StreamingCollectionEndpoint.ts +20 -0
  30. package/endpoints/reactive/StreamingEndpoint.js +56 -0
  31. package/endpoints/reactive/StreamingEndpoint.test.ts +130 -0
  32. package/endpoints/reactive/StreamingEndpoint.ts +50 -0
  33. package/endpoints/reactive/index.js +22 -0
  34. package/endpoints/reactive/index.ts +5 -0
  35. package/endpoints/rpc/ActionEndpoint.js +3 -14
  36. package/endpoints/rpc/ConsumerEndpoint.js +5 -16
  37. package/endpoints/rpc/FunctionEndpoint.js +6 -17
  38. package/endpoints/rpc/ProducerEndpoint.js +4 -15
  39. package/endpoints/rpc/RpcEndpointBase.js +3 -14
  40. package/errors/DefaultErrorHandler.js +19 -27
  41. package/errors/DefaultErrorHandler.ts +4 -1
  42. package/errors/Errors.js +8 -2
  43. package/errors/Errors.ts +5 -0
  44. package/http/EntityStream.js +42 -0
  45. package/http/EntityStream.ts +40 -0
  46. package/http/HttpContentRange.js +39 -0
  47. package/http/HttpContentRange.ts +41 -0
  48. package/http/HttpHeader.js +6 -1
  49. package/http/HttpHeader.ts +6 -1
  50. package/http/HttpStatusCode.js +4 -1
  51. package/http/HttpStatusCode.ts +4 -1
  52. package/http/ResponseCache.js +4 -15
  53. package/http/RetryAfter.js +24 -0
  54. package/http/RetryAfter.ts +19 -0
  55. package/http/ServerSentEvents.js +140 -0
  56. package/http/ServerSentEvents.ts +145 -0
  57. package/http/index.js +5 -1
  58. package/http/index.ts +4 -0
  59. package/links/AggregateLinkExtractor.js +7 -18
  60. package/links/HalLinkExtractor.js +9 -20
  61. package/links/HeaderLinkExtractor.js +4 -15
  62. package/package.json +8 -8
@@ -0,0 +1,110 @@
1
+ /**
2
+ * NOTE: The jsdom environment strips the "Range" request header, so these tests need the node environment.
3
+ * @jest-environment node
4
+ */
5
+
6
+ import fetchMock from 'jest-fetch-mock';
7
+ import { StreamingCollectionEndpoint } from '.';
8
+ import { EntryEndpoint } from '..';
9
+ import { HttpHeader, HttpStatusCode } from '../../http';
10
+
11
+ class MockEntity {
12
+ constructor(public id: number, public name: string) { }
13
+ }
14
+
15
+ fetchMock.enableMocks();
16
+ let endpoint: StreamingCollectionEndpoint<MockEntity>;
17
+
18
+ beforeEach(() => {
19
+ fetchMock.resetMocks();
20
+ endpoint = new StreamingCollectionEndpoint<MockEntity>(new EntryEndpoint('http://localhost/'), 'endpoint');
21
+ endpoint.pollingInterval = 0;
22
+ });
23
+
24
+ function mockRangeOnce(body: string, contentRange?: string, retryAfterHeader?: string) {
25
+ const headers: { [key: string]: string; } = {};
26
+ if (contentRange) headers[HttpHeader.ContentRange] = contentRange;
27
+ if (retryAfterHeader) headers[HttpHeader.RetryAfter] = retryAfterHeader;
28
+
29
+ fetchMock.mockResponseOnce(body, { status: HttpStatusCode.PartialContent, headers });
30
+ }
31
+
32
+ function requestHeader(index: number, header: HttpHeader) {
33
+ return new Headers(fetchMock.mock.calls[index][1]?.headers).get(header);
34
+ }
35
+
36
+ async function collect<T>(stream: AsyncIterable<T>) {
37
+ const result: T[] = [];
38
+ for await (const element of stream) result.push(element);
39
+ return result;
40
+ }
41
+
42
+ test('stream', async () => {
43
+ mockRangeOnce('[{"id":5,"name":"test1"},{"id":6,"name":"test2"}]', 'elements 0-1/*');
44
+ mockRangeOnce('[{"id":7,"name":"test3"}]', 'elements 2-2/3', '42');
45
+
46
+ expect(await collect(endpoint.stream())).toEqual([
47
+ new MockEntity(5, 'test1'),
48
+ new MockEntity(6, 'test2'),
49
+ new MockEntity(7, 'test3')
50
+ ]);
51
+ expect(requestHeader(0, HttpHeader.Range)).toBe('elements=0-');
52
+ expect(requestHeader(1, HttpHeader.Range)).toBe('elements=2-');
53
+ expect(endpoint.pollingInterval).toBe(42000);
54
+ });
55
+
56
+ test('streamOffset', async () => {
57
+ mockRangeOnce('[{"id":7,"name":"test3"}]', 'elements 2-2/3');
58
+
59
+ expect(await collect(endpoint.stream(2))).toEqual([new MockEntity(7, 'test3')]);
60
+ expect(requestHeader(0, HttpHeader.Range)).toBe('elements=2-');
61
+ });
62
+
63
+ test('streamTail', async () => {
64
+ mockRangeOnce('[{"id":7,"name":"test3"}]', 'elements 2-2/3');
65
+
66
+ expect(await collect(endpoint.stream(-1))).toEqual([new MockEntity(7, 'test3')]);
67
+ expect(requestHeader(0, HttpHeader.Range)).toBe('elements=-1');
68
+ });
69
+
70
+ test('streamAsyncIterator', async () => {
71
+ mockRangeOnce('[{"id":5,"name":"test1"}]', 'elements 0-0/1');
72
+
73
+ expect(await collect(endpoint)).toEqual([new MockEntity(5, 'test1')]);
74
+ });
75
+
76
+ test('streamKeepsPollingWhileRangeNotSatisfiable', async () => {
77
+ mockRangeOnce('[{"id":5,"name":"test1"}]', 'elements 0-0/*');
78
+ fetchMock.mockResponseOnce('', { status: HttpStatusCode.RangeNotSatisfiable });
79
+ mockRangeOnce('[{"id":6,"name":"test2"}]', 'elements 1-1/2');
80
+
81
+ expect(await collect(endpoint.stream())).toEqual([
82
+ new MockEntity(5, 'test1'),
83
+ new MockEntity(6, 'test2')
84
+ ]);
85
+ expect(requestHeader(1, HttpHeader.Range)).toBe('elements=1-');
86
+ expect(requestHeader(2, HttpHeader.Range)).toBe('elements=1-');
87
+ });
88
+
89
+ test('streamEndsWithoutContentRange', async () => {
90
+ fetchMock.mockResponseOnce('[{"id":5,"name":"test1"}]');
91
+
92
+ expect(await collect(endpoint.stream())).toEqual([new MockEntity(5, 'test1')]);
93
+ expect(fetchMock.mock.calls.length).toBe(1);
94
+ });
95
+
96
+ test('streamAbort', async () => {
97
+ fetchMock.mockResponse('[{"id":5,"name":"test1"}]', {
98
+ status: HttpStatusCode.PartialContent,
99
+ headers: { [HttpHeader.ContentRange]: 'elements 0-0/*' }
100
+ });
101
+ const controller = new AbortController();
102
+
103
+ const result: MockEntity[] = [];
104
+ for await (const element of endpoint.stream(0, controller.signal)) {
105
+ result.push(element);
106
+ controller.abort();
107
+ }
108
+
109
+ expect(result).toEqual([new MockEntity(5, 'test1')]);
110
+ });
@@ -0,0 +1,20 @@
1
+ import { GenericStreamingCollectionEndpoint } from "./GenericStreamingCollectionEndpoint";
2
+ import { ElementEndpoint } from "../generic/ElementEndpoint";
3
+ import { Endpoint } from "../Endpoint";
4
+
5
+ /**
6
+ * Endpoint for a collection of `TEntity`s observable as an append-only stream using long-polling,
7
+ * addressable as {@link ElementEndpoint}s.<br>
8
+ * Use {@link GenericStreamingCollectionEndpoint} instead if you wish to customize the element endpoint type.
9
+ * @typeParam TEntity The type of individual elements in the collection.
10
+ */
11
+ export class StreamingCollectionEndpoint<TEntity> extends GenericStreamingCollectionEndpoint<TEntity, ElementEndpoint<TEntity>> {
12
+ /**
13
+ * Creates a new streaming collection 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
+ */
17
+ constructor(referrer: Endpoint, relativeUri: URL | string) {
18
+ super(referrer, relativeUri, ElementEndpoint);
19
+ }
20
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StreamingEndpoint = void 0;
4
+ const Endpoint_1 = require("../Endpoint");
5
+ const http_1 = require("../../http");
6
+ /**
7
+ * Endpoint for a stream of `TEntity`s using a persistent HTTP connection.
8
+ * @typeParam TEntity The type of individual elements in the stream.
9
+ */
10
+ class StreamingEndpoint extends Endpoint_1.Endpoint {
11
+ /**
12
+ * Creates a new streaming 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 separator The character sequence used to detect that a new element starts in the HTTP stream.
16
+ */
17
+ constructor(referrer, relativeUri, separator = "\n") {
18
+ super(referrer, relativeUri);
19
+ this.separator = separator;
20
+ }
21
+ /**
22
+ * Provides a stream of `TEntity`s, keeping the HTTP connection open until the server closes it.
23
+ * @param signal Used to close the connection.
24
+ * @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
25
+ * @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
26
+ * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
27
+ * @throws {@link errors!HttpError}: Other non-success status code
28
+ */
29
+ async *stream(signal) {
30
+ // NOTE: Abort the request when the consumer stops iterating, not just when the caller's signal fires.
31
+ const controller = new AbortController();
32
+ const onAbort = () => controller.abort();
33
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
34
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted)
35
+ controller.abort();
36
+ try {
37
+ const response = await this.send(http_1.HttpMethod.Get, controller.signal);
38
+ yield* (0, http_1.entityStream)(response, this.serializer, this.separator);
39
+ }
40
+ catch (err) {
41
+ // Aborting is a regular way of ending the stream, not an error
42
+ if (!(signal === null || signal === void 0 ? void 0 : signal.aborted))
43
+ throw err;
44
+ }
45
+ finally {
46
+ signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
47
+ controller.abort();
48
+ }
49
+ }
50
+ /**
51
+ * Provides a stream of `TEntity`s using {@link stream}.
52
+ */
53
+ [Symbol.asyncIterator]() { return this.stream(); }
54
+ }
55
+ exports.StreamingEndpoint = StreamingEndpoint;
56
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3RyZWFtaW5nRW5kcG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJTdHJlYW1pbmdFbmRwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBdUM7QUFDdkMscUNBQXNEO0FBRXREOzs7R0FHRztBQUNILE1BQWEsaUJBQTJCLFNBQVEsbUJBQVE7SUFDcEQ7Ozs7O09BS0c7SUFDSCxZQUFZLFFBQWtCLEVBQUUsV0FBeUIsRUFBbUIsWUFBb0IsSUFBSTtRQUNoRyxLQUFLLENBQUMsUUFBUSxFQUFFLFdBQVcsQ0FBQyxDQUFDO1FBRDJDLGNBQVMsR0FBVCxTQUFTLENBQWU7SUFFcEc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BQzlDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUN2QixDQUFDO0lBQ0wsQ0FBQztJQUVEOztPQUVHO0lBQ0gsQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDLEtBQUssT0FBTyxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQyxDQUFDO0NBQ3JEO0FBMUNELDhDQTBDQyJ9
@@ -0,0 +1,130 @@
1
+ /**
2
+ * NOTE: The jsdom environment does not expose response bodies as streams, so these tests need the node environment.
3
+ * @jest-environment node
4
+ */
5
+
6
+ import fetchMock from 'jest-fetch-mock';
7
+ import { StreamingEndpoint } from '.';
8
+ import { EntryEndpoint } from '..';
9
+ import { NotFoundError } from '../../errors';
10
+ import { HttpStatusCode } from '../../http';
11
+
12
+ class MockEntity {
13
+ constructor(public id: number, public name: string) { }
14
+ }
15
+
16
+ fetchMock.enableMocks();
17
+ let entryEndpoint: EntryEndpoint;
18
+
19
+ beforeEach(() => {
20
+ fetchMock.resetMocks();
21
+ entryEndpoint = new EntryEndpoint('http://localhost/');
22
+ });
23
+
24
+ /**
25
+ * Mocks a response whose body is streamed in multiple chunks.
26
+ * @param chunks The chunks to send, in order.
27
+ * @param close Whether to close the connection after the last chunk.
28
+ * @returns A callback reporting whether the client has cancelled the connection.
29
+ */
30
+ function mockStream(chunks: string[], close: boolean = true) {
31
+ let cancelled = false;
32
+
33
+ fetchMock.mockImplementation(async (_input, init) => {
34
+ let streamController: ReadableStreamDefaultController<Uint8Array> | undefined;
35
+ const body = new ReadableStream<Uint8Array>({
36
+ start(controller) {
37
+ streamController = controller;
38
+ const encoder = new TextEncoder();
39
+ for (const chunk of chunks) controller.enqueue(encoder.encode(chunk));
40
+ if (close) controller.close();
41
+ },
42
+ cancel() { cancelled = true; }
43
+ });
44
+
45
+ // Emulate how aborting a real request fails the response body
46
+ init?.signal?.addEventListener('abort', () => {
47
+ try { streamController?.error(new Error('aborted')); } catch { }
48
+ }, { once: true });
49
+
50
+ return new Response(body);
51
+ });
52
+
53
+ return () => cancelled;
54
+ }
55
+
56
+ async function collect<T>(stream: AsyncIterable<T>) {
57
+ const result: T[] = [];
58
+ for await (const element of stream) result.push(element);
59
+ return result;
60
+ }
61
+
62
+ test('stream', async () => {
63
+ mockStream(['{"id":5,"name":"test1"}\n', '{"id":6,"name":"test2"}\n']);
64
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
65
+
66
+ expect(await collect(endpoint.stream())).toEqual([new MockEntity(5, 'test1'), new MockEntity(6, 'test2')]);
67
+ });
68
+
69
+ test('streamSplitAcrossChunks', async () => {
70
+ mockStream(['{"id":5,"na', 'me":"test1"}\n{"id":6,', '"name":"test2"}\n']);
71
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
72
+
73
+ expect(await collect(endpoint.stream())).toEqual([new MockEntity(5, 'test1'), new MockEntity(6, 'test2')]);
74
+ });
75
+
76
+ test('streamWithoutTrailingSeparator', async () => {
77
+ mockStream(['{"id":5,"name":"test1"}\n{"id":6,"name":"test2"}']);
78
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
79
+
80
+ expect(await collect(endpoint.stream())).toEqual([new MockEntity(5, 'test1'), new MockEntity(6, 'test2')]);
81
+ });
82
+
83
+ test('streamCustomSeparator', async () => {
84
+ mockStream(['{"id":5,"name":"test1"}|{"id":6,"name":"test2"}']);
85
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint', '|');
86
+
87
+ expect(await collect(endpoint.stream())).toEqual([new MockEntity(5, 'test1'), new MockEntity(6, 'test2')]);
88
+ });
89
+
90
+ test('streamAsyncIterator', async () => {
91
+ mockStream(['{"id":5,"name":"test1"}\n']);
92
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
93
+
94
+ expect(await collect(endpoint)).toEqual([new MockEntity(5, 'test1')]);
95
+ });
96
+
97
+ test('streamBreak', async () => {
98
+ const cancelled = mockStream(['{"id":5,"name":"test1"}\n', '{"id":6,"name":"test2"}\n'], false);
99
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
100
+
101
+ const result: MockEntity[] = [];
102
+ for await (const element of endpoint.stream()) {
103
+ result.push(element);
104
+ break;
105
+ }
106
+
107
+ expect(result).toEqual([new MockEntity(5, 'test1')]);
108
+ expect(cancelled()).toBe(true);
109
+ });
110
+
111
+ test('streamAbort', async () => {
112
+ mockStream(['{"id":5,"name":"test1"}\n', '{"id":6,"name":"test2"}\n'], false);
113
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
114
+ const controller = new AbortController();
115
+
116
+ const result: MockEntity[] = [];
117
+ for await (const element of endpoint.stream(controller.signal)) {
118
+ result.push(element);
119
+ if (result.length === 2) controller.abort();
120
+ }
121
+
122
+ expect(result).toEqual([new MockEntity(5, 'test1'), new MockEntity(6, 'test2')]);
123
+ });
124
+
125
+ test('streamError', async () => {
126
+ fetchMock.mockResponseOnce('', { status: HttpStatusCode.NotFound });
127
+ const endpoint = new StreamingEndpoint<MockEntity>(entryEndpoint, 'endpoint');
128
+
129
+ await expect(collect(endpoint.stream())).rejects.toThrow(NotFoundError);
130
+ });
@@ -0,0 +1,50 @@
1
+ import { Endpoint } from "../Endpoint";
2
+ import { HttpMethod, entityStream } from "../../http";
3
+
4
+ /**
5
+ * Endpoint for a stream of `TEntity`s using a persistent HTTP connection.
6
+ * @typeParam TEntity The type of individual elements in the stream.
7
+ */
8
+ export class StreamingEndpoint<TEntity> extends Endpoint {
9
+ /**
10
+ * Creates a new streaming endpoint.
11
+ * @param referrer The endpoint used to navigate to this one.
12
+ * @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.
13
+ * @param separator The character sequence used to detect that a new element starts in the HTTP stream.
14
+ */
15
+ constructor(referrer: Endpoint, relativeUri: URL | string, private readonly separator: string = "\n") {
16
+ super(referrer, relativeUri);
17
+ }
18
+
19
+ /**
20
+ * Provides a stream of `TEntity`s, keeping the HTTP connection open until the server closes it.
21
+ * @param signal Used to close the connection.
22
+ * @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
23
+ * @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
24
+ * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
25
+ * @throws {@link errors!HttpError}: Other non-success status code
26
+ */
27
+ async *stream(signal?: AbortSignal): AsyncIterableIterator<TEntity> {
28
+ // NOTE: Abort the request when the consumer stops iterating, not just when the caller's signal fires.
29
+ const controller = new AbortController();
30
+ const onAbort = () => controller.abort();
31
+ signal?.addEventListener("abort", onAbort, { once: true });
32
+ if (signal?.aborted) controller.abort();
33
+
34
+ try {
35
+ const response = await this.send(HttpMethod.Get, controller.signal);
36
+ yield* entityStream<TEntity>(response, this.serializer, this.separator);
37
+ } catch (err) {
38
+ // Aborting is a regular way of ending the stream, not an error
39
+ if (!signal?.aborted) throw err;
40
+ } finally {
41
+ signal?.removeEventListener("abort", onAbort);
42
+ controller.abort();
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Provides a stream of `TEntity`s using {@link stream}.
48
+ */
49
+ [Symbol.asyncIterator]() { return this.stream(); }
50
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./PollingEndpoint"), exports);
18
+ __exportStar(require("./StreamingEndpoint"), exports);
19
+ __exportStar(require("./SseStreamingEndpoint"), exports);
20
+ __exportStar(require("./GenericStreamingCollectionEndpoint"), exports);
21
+ __exportStar(require("./StreamingCollectionEndpoint"), exports);
22
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQWtDO0FBQ2xDLHNEQUFvQztBQUNwQyx5REFBdUM7QUFDdkMsdUVBQXFEO0FBQ3JELGdFQUE4QyJ9
@@ -0,0 +1,5 @@
1
+ export * from "./PollingEndpoint";
2
+ export * from "./StreamingEndpoint";
3
+ export * from "./SseStreamingEndpoint";
4
+ export * from "./GenericStreamingCollectionEndpoint";
5
+ export * from "./StreamingCollectionEndpoint";
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ActionEndpoint = void 0;
13
4
  const RpcEndpointBase_1 = require("./RpcEndpointBase");
@@ -32,11 +23,9 @@ class ActionEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
32
23
  * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
33
24
  * @throws {@link errors!HttpError}: Other non-success status code
34
25
  */
35
- invoke(signal) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- yield this.send(http_1.HttpMethod.Post, signal);
38
- });
26
+ async invoke(signal) {
27
+ await this.send(http_1.HttpMethod.Post, signal);
39
28
  }
40
29
  }
41
30
  exports.ActionEndpoint = ActionEndpoint;
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWN0aW9uRW5kcG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJBY3Rpb25FbmRwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSx1REFBb0Q7QUFFcEQscUNBQXdDO0FBRXhDOztHQUVHO0FBQ0gsTUFBYSxjQUFlLFNBQVEsaUNBQWU7SUFDL0M7Ozs7T0FJRztJQUNILFlBQVksUUFBa0IsRUFBRSxXQUF5QjtRQUNyRCxLQUFLLENBQUMsUUFBUSxFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBQ2pDLENBQUM7SUFFRDs7Ozs7OztPQU9HO0lBQ0csTUFBTSxDQUFDLE1BQW9COztZQUM3QixNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDN0MsQ0FBQztLQUFBO0NBQ0o7QUFyQkQsd0NBcUJDIn0=
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWN0aW9uRW5kcG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJBY3Rpb25FbmRwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx1REFBb0Q7QUFFcEQscUNBQXdDO0FBRXhDOztHQUVHO0FBQ0gsTUFBYSxjQUFlLFNBQVEsaUNBQWU7SUFDL0M7Ozs7T0FJRztJQUNILFlBQVksUUFBa0IsRUFBRSxXQUF5QjtRQUNyRCxLQUFLLENBQUMsUUFBUSxFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBQ2pDLENBQUM7SUFFRDs7Ozs7OztPQU9HO0lBQ0gsS0FBSyxDQUFDLE1BQU0sQ0FBQyxNQUFvQjtRQUM3QixNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0MsQ0FBQztDQUNKO0FBckJELHdDQXFCQyJ9
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ConsumerEndpoint = void 0;
13
4
  const RpcEndpointBase_1 = require("./RpcEndpointBase");
@@ -34,13 +25,11 @@ class ConsumerEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
34
25
  * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
35
26
  * @throws {@link errors!HttpError}: Other non-success status code
36
27
  */
37
- invoke(entity, signal) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- yield this.send(http_1.HttpMethod.Post, signal, {
40
- [http_1.HttpHeader.ContentType]: this.serializer.supportedMediaTypes[0]
41
- }, this.serializer.serialize(entity));
42
- });
28
+ async invoke(entity, signal) {
29
+ await this.send(http_1.HttpMethod.Post, signal, {
30
+ [http_1.HttpHeader.ContentType]: this.serializer.supportedMediaTypes[0]
31
+ }, this.serializer.serialize(entity));
43
32
  }
44
33
  }
45
34
  exports.ConsumerEndpoint = ConsumerEndpoint;
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZXJFbmRwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkNvbnN1bWVyRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsdURBQW9EO0FBRXBELHFDQUFvRDtBQUVwRDs7O0dBR0c7QUFDSCxNQUFhLGdCQUEwQixTQUFRLGlDQUFlO0lBQzFEOzs7O09BSUc7SUFDSCxZQUFZLFFBQWtCLEVBQUUsV0FBeUI7UUFDckQsS0FBSyxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDRyxNQUFNLENBQUMsTUFBZSxFQUFFLE1BQW9COztZQUM5QyxNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFO2dCQUNyQyxDQUFDLGlCQUFVLENBQUMsV0FBVyxDQUFDLEVBQUUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDLENBQUM7YUFDbkUsRUFBRSxJQUFJLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1FBQzFDLENBQUM7S0FBQTtDQUNKO0FBeEJELDRDQXdCQyJ9
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZXJFbmRwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkNvbnN1bWVyRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsdURBQW9EO0FBRXBELHFDQUFvRDtBQUVwRDs7O0dBR0c7QUFDSCxNQUFhLGdCQUEwQixTQUFRLGlDQUFlO0lBQzFEOzs7O09BSUc7SUFDSCxZQUFZLFFBQWtCLEVBQUUsV0FBeUI7UUFDckQsS0FBSyxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDSCxLQUFLLENBQUMsTUFBTSxDQUFDLE1BQWUsRUFBRSxNQUFvQjtRQUM5QyxNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFO1lBQ3JDLENBQUMsaUJBQVUsQ0FBQyxXQUFXLENBQUMsRUFBRSxJQUFJLENBQUMsVUFBVSxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQztTQUNuRSxFQUFFLElBQUksQ0FBQyxVQUFVLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7SUFDMUMsQ0FBQztDQUNKO0FBeEJELDRDQXdCQyJ9
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.FunctionEndpoint = void 0;
13
4
  const RpcEndpointBase_1 = require("./RpcEndpointBase");
@@ -36,14 +27,12 @@ class FunctionEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
36
27
  * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
37
28
  * @throws {@link errors!HttpError}: Other non-success status code
38
29
  */
39
- invoke(entity, signal) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const response = yield this.send(http_1.HttpMethod.Post, signal, {
42
- [http_1.HttpHeader.ContentType]: this.serializer.supportedMediaTypes[0]
43
- }, this.serializer.serialize(entity));
44
- return this.serializer.deserialize(yield response.text());
45
- });
30
+ async invoke(entity, signal) {
31
+ const response = await this.send(http_1.HttpMethod.Post, signal, {
32
+ [http_1.HttpHeader.ContentType]: this.serializer.supportedMediaTypes[0]
33
+ }, this.serializer.serialize(entity));
34
+ return this.serializer.deserialize(await response.text());
46
35
  }
47
36
  }
48
37
  exports.FunctionEndpoint = FunctionEndpoint;
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRnVuY3Rpb25FbmRwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkZ1bmN0aW9uRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsdURBQW9EO0FBRXBELHFDQUFvRDtBQUVwRDs7OztHQUlHO0FBQ0gsTUFBYSxnQkFBbUMsU0FBUSxpQ0FBZTtJQUNuRTs7OztPQUlHO0lBQ0gsWUFBWSxRQUFrQixFQUFFLFdBQXlCO1FBQ3JELEtBQUssQ0FBQyxRQUFRLEVBQUUsV0FBVyxDQUFDLENBQUM7SUFDakMsQ0FBQztJQUVEOzs7Ozs7Ozs7T0FTRztJQUNHLE1BQU0sQ0FBQyxNQUFlLEVBQUUsTUFBb0I7O1lBQzlDLE1BQ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csQ0FBQyxFQUFFLElBQUksQ0FBQyxVQUFVLENBQUMsbUJBQW1CLENBQUMsQ0FBQyxDQUFDO1NBQ25FLEVBQUUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztRQUV0QyxPQUFPLElBQUksQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFVLE1BQU0sUUFBUSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7SUFDdkUsQ0FBQztDQUNKO0FBM0JELDRDQTJCQyJ9
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ProducerEndpoint = void 0;
13
4
  const RpcEndpointBase_1 = require("./RpcEndpointBase");
@@ -34,12 +25,10 @@ class ProducerEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
34
25
  * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
35
26
  * @throws {@link errors!HttpError}: Other non-success status code
36
27
  */
37
- invoke(signal) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const response = yield this.send(http_1.HttpMethod.Post, signal);
40
- return this.serializer.deserialize(yield response.text());
41
- });
28
+ async invoke(signal) {
29
+ const response = await this.send(http_1.HttpMethod.Post, signal);
30
+ return this.serializer.deserialize(await response.text());
42
31
  }
43
32
  }
44
33
  exports.ProducerEndpoint = ProducerEndpo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FDckQsS0FBSyxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDSCxLQUFLLENBQUMsTUFBTSxDQUFDLE1BQW9CO1FBQzdCLE1BQU0sUUFBUSxHQUFHLE1BQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxpQkFBVSxDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsQ0FBQztRQUMxRCxPQUFPLElBQUksQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFVLE1BQU0sUUFBUSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7SUFDdkUsQ0FBQztDQUNKO0FBdkJELDRDQXVCQyJ9
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.RpcEndpointBase = void 0;
13
4
  const Endpoint_1 = require("../Endpoint");
@@ -32,10 +23,8 @@ class RpcEndpointBase extends Endpoint_1.Endpoint {
32
23
  * @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
33
24
  * @throws {@link errors!HttpError}: Other non-success status code
34
25
  */
35
- probe(signal) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- yield this.send(http_1.HttpMethod.Options, signal);
38
- });
26
+ async probe(signal) {
27
+ await this.send(http_1.HttpMethod.Options, signal);
39
28
  }
40
29
  /**
41
30
  * Shows whether the server has indicated that the invoke method is currently allowed.
@@ -45,4 +34,4 @@ class RpcEndpointBase extends Endpoint_1.Endpoint {
45
34
  get invokeAllowed() { return this.isMethodAllowed(http_1.HttpMethod.Post); }
46
35
  }
47
36
  exports.RpcEndpointBase = RpcEndpointBase;
48
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUnBjRW5kcG9pbnRCYXNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiUnBjRW5kcG9pbnRCYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLDBDQUF1QztBQUN2QyxxQ0FBd0M7QUFFeEM7O0dBRUc7QUFDSCxNQUFhLGVBQWdCLFNBQVEsbUJBQVE7SUFDekM7Ozs7T0FJRztJQUNILFlBQVksUUFBa0IsRUFBRSxXQUF5QjtRQUNyRCxLQUFLLENBQUMsUUFBUSxFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBQ2pDLENBQUM7SUFFRDs7Ozs7OztPQU9HO0lBQ0csS0FBSyxDQUFDLE1BQW9COztZQUM1QixNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxPQUFPLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDaEQsQ0FBQztLQUFBO0lBRUQ7Ozs7T0FJRztJQUNILElBQUksYUFBYSxLQUFLLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxpQkFBVSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztDQUN4RTtBQTVCRCwwQ0E0QkMifQ==
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUnBjRW5kcG9pbnRCYXNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiUnBjRW5kcG9pbnRCYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQ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