typedrest 0.3.4 → 0.3.7
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/endpoints/Endpoint.js +13 -13
- package/endpoints/Endpoint.ts +13 -13
- package/endpoints/EntryEndpoint.js +12 -12
- package/endpoints/EntryEndpoint.ts +9 -9
- package/endpoints/generic/CollectionEndpoint.js +5 -4
- package/endpoints/generic/CollectionEndpoint.ts +2 -1
- package/endpoints/generic/ETagEndpointBase.js +20 -20
- package/endpoints/generic/ETagEndpointBase.ts +21 -21
- package/endpoints/generic/ElementEndpoint.js +33 -33
- package/endpoints/generic/ElementEndpoint.ts +31 -31
- package/endpoints/generic/GenericCollectionEndpoint.js +39 -39
- package/endpoints/generic/GenericCollectionEndpoint.ts +38 -37
- package/endpoints/generic/IndexerEndpoint.js +1 -1
- package/endpoints/generic/IndexerEndpoint.ts +1 -1
- package/endpoints/generic/index.js +6 -2
- package/endpoints/index.js +6 -2
- package/endpoints/raw/BlobEndpoint.js +22 -19
- package/endpoints/raw/BlobEndpoint.ts +21 -18
- package/endpoints/raw/UploadEndpoint.js +9 -6
- package/endpoints/raw/UploadEndpoint.ts +8 -5
- package/endpoints/raw/index.js +6 -2
- package/endpoints/rpc/ActionEndpoint.js +7 -7
- package/endpoints/rpc/ActionEndpoint.ts +5 -5
- package/endpoints/rpc/ConsumerEndpoint.js +7 -7
- package/endpoints/rpc/ConsumerEndpoint.ts +5 -5
- package/endpoints/rpc/FunctionEndpoint.js +7 -7
- package/endpoints/rpc/FunctionEndpoint.ts +5 -5
- package/endpoints/rpc/ProducerEndpoint.js +7 -7
- package/endpoints/rpc/ProducerEndpoint.ts +5 -5
- package/endpoints/rpc/RpcEndpointBase.js +4 -4
- package/endpoints/rpc/RpcEndpointBase.ts +4 -4
- package/endpoints/rpc/index.js +6 -2
- package/errors/DefaultErrorHandler.js +18 -18
- package/errors/DefaultErrorHandler.ts +10 -9
- package/errors/ErrorHandler.ts +1 -1
- package/errors/Errors.js +8 -9
- package/errors/Errors.ts +7 -9
- package/errors/index.js +6 -2
- package/http/FetchHttpClient.js +3 -3
- package/http/FetchHttpClient.ts +4 -3
- package/http/HttpClient.ts +1 -1
- package/http/ResponseCache.js +3 -3
- package/http/ResponseCache.ts +1 -1
- package/http/index.js +6 -2
- package/index.js +6 -2
- package/jest.config.js +12 -0
- package/links/AggregateLinkExtractor.js +2 -2
- package/links/AggregateLinkExtractor.ts +3 -2
- package/links/HalLinkExtractor.js +4 -4
- package/links/HalLinkExtractor.ts +3 -2
- package/links/HeaderLinkExtractor.js +4 -4
- package/links/HeaderLinkExtractor.ts +3 -2
- package/links/LinkExtractor.ts +1 -1
- package/links/index.js +6 -2
- package/package.json +9 -17
- package/serializers/JsonSerializer.js +3 -3
- package/serializers/JsonSerializer.ts +4 -4
- package/serializers/index.js +6 -2
- package/docs/assets/js/main.js +0 -51
- package/endpoints/_doc.js +0 -7
- package/endpoints/_doc.ts +0 -5
- package/endpoints/generic/_doc.js +0 -6
- package/endpoints/generic/_doc.ts +0 -4
- package/endpoints/raw/_doc.js +0 -6
- package/endpoints/raw/_doc.ts +0 -4
- package/endpoints/rpc/_doc.js +0 -6
- package/endpoints/rpc/_doc.ts +0 -4
- package/errors/_doc.js +0 -7
- package/errors/_doc.ts +0 -5
- package/http/_doc.js +0 -6
- package/http/_doc.ts +0 -4
- package/links/_doc.js +0 -7
- package/links/_doc.ts +0 -5
- package/serializers/_doc.js +0 -6
- package/serializers/_doc.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ETagEndpointBase } from "
|
|
1
|
+
import { ETagEndpointBase } from "./ETagEndpointBase";
|
|
2
2
|
import { Endpoint } from "../Endpoint";
|
|
3
3
|
import { HttpMethod, HttpHeader, HttpStatusCode } from "../../http";
|
|
4
4
|
import { ConcurrencyError } from "../../errors";
|
|
@@ -29,10 +29,10 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
29
29
|
/**
|
|
30
30
|
* Returns the `TEntity`.
|
|
31
31
|
* @param signal Used to cancel the request.
|
|
32
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
33
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
34
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
35
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
32
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
33
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
34
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
35
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
36
36
|
*/
|
|
37
37
|
async read(signal?: AbortSignal) {
|
|
38
38
|
return this.serializer.deserialize<TEntity>(await this.getContent(signal));
|
|
@@ -41,9 +41,9 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
41
41
|
/**
|
|
42
42
|
* Determines whether the element currently exists.
|
|
43
43
|
* @param signal Used to cancel the request.
|
|
44
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
45
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
46
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
44
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
45
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
46
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
47
47
|
*/
|
|
48
48
|
async exists(signal?: AbortSignal) {
|
|
49
49
|
const response = await this.httpClient.send(this.uri, HttpMethod.Head, signal);
|
|
@@ -66,12 +66,12 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
66
66
|
* @param entity The new `TEntity`.
|
|
67
67
|
* @param signal Used to cancel the request.
|
|
68
68
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
69
|
-
* @throws {@link ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
70
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
71
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
72
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
73
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
74
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
69
|
+
* @throws {@link errors!ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
70
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
71
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
72
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
73
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
74
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
75
75
|
*/
|
|
76
76
|
async set(entity: TEntity, signal?: AbortSignal): Promise<(TEntity | undefined)> {
|
|
77
77
|
const response = await this.putContent(entity, signal);
|
|
@@ -93,12 +93,12 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
93
93
|
* @param entity The `TEntity` data to merge with the existing element.
|
|
94
94
|
* @param signal Used to cancel the request.
|
|
95
95
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
96
|
-
* @throws {@link ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
97
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
98
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
99
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
100
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
101
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
96
|
+
* @throws {@link errors!ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
97
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
98
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
99
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
100
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
101
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
102
102
|
*/
|
|
103
103
|
async merge(entity: TEntity, signal?: AbortSignal): Promise<(TEntity | undefined)> {
|
|
104
104
|
this.responseCache = undefined;
|
|
@@ -118,12 +118,12 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
118
118
|
* @param maxRetries The maximum number of retries to perform for optimistic concurrency before giving up.
|
|
119
119
|
* @param signal Used to cancel the request.
|
|
120
120
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
121
|
-
* @throws {@link ConcurrencyError}: The maximum number of retries to perform for optimistic concurrency before giving up.
|
|
122
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
123
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
124
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
125
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
126
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
121
|
+
* @throws {@link errors!ConcurrencyError}: The maximum number of retries to perform for optimistic concurrency before giving up.
|
|
122
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
123
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
124
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
125
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
126
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
127
127
|
*/
|
|
128
128
|
async update(updateAction: (entity: TEntity) => void, maxRetries: number = 3, signal?: AbortSignal): Promise<(TEntity | undefined)> {
|
|
129
129
|
let retryCounter = 0;
|
|
@@ -149,11 +149,11 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
|
|
|
149
149
|
/**
|
|
150
150
|
* Deletes the element.
|
|
151
151
|
* @param signal Used to cancel the request.
|
|
152
|
-
* @throws {@link ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
153
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
154
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
155
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
156
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
152
|
+
* @throws {@link errors!ConcurrencyError}: The entity has changed since it was last retrieved with {@link read}. Your changes were rejected to prevent a lost update.
|
|
153
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
154
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
155
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
156
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
157
157
|
*/
|
|
158
158
|
async delete(signal?: AbortSignal) {
|
|
159
159
|
await this.deleteContent(signal);
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenericCollectionEndpoint = void 0;
|
|
13
|
-
const
|
|
13
|
+
const ETagEndpointBase_1 = require("./ETagEndpointBase");
|
|
14
14
|
const http_1 = require("../../http");
|
|
15
15
|
/**
|
|
16
16
|
* Endpoint for a collection of `TEntity`s addressable as `TElementEndpoint`s.<br>
|
|
@@ -18,7 +18,7 @@ const http_1 = require("../../http");
|
|
|
18
18
|
* @typeParam TEntity The type of individual elements in the collection.
|
|
19
19
|
* @typeParam TElementEndpoint The type of {@link ElementEndpoint} to provide for individual `TEntity`s.
|
|
20
20
|
*/
|
|
21
|
-
class GenericCollectionEndpoint extends
|
|
21
|
+
class GenericCollectionEndpoint extends ETagEndpointBase_1.ETagEndpointBase {
|
|
22
22
|
/**
|
|
23
23
|
* Creates a new collection endpoint.
|
|
24
24
|
* @param referrer The endpoint used to navigate to this one.
|
|
@@ -59,10 +59,10 @@ class GenericCollectionEndpoint extends _1.ETagEndpointBase {
|
|
|
59
59
|
/**
|
|
60
60
|
* Returns all `TEntity`s in the collection.
|
|
61
61
|
* @param signal Used to cancel the request.
|
|
62
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
63
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
64
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
65
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
62
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
63
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
64
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
65
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
66
66
|
*/
|
|
67
67
|
readAll(signal) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -80,11 +80,11 @@ class GenericCollectionEndpoint extends _1.ETagEndpointBase {
|
|
|
80
80
|
* @param entity The new `TEntity`.
|
|
81
81
|
* @param signal Used to cancel the request.
|
|
82
82
|
* @returns An endpoint for the newly created entity; `undefined` if the server returned neither a "Location" header nor an entity with an ID in the response body.
|
|
83
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
84
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
85
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
86
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
87
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
83
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
84
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
85
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
86
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
87
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
88
88
|
*/
|
|
89
89
|
create(entity, signal) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -121,11 +121,11 @@ class GenericCollectionEndpoint extends _1.ETagEndpointBase {
|
|
|
121
121
|
* Adds (or updates) multiple `TEntity`s as elements in the collection.
|
|
122
122
|
* @param entities The `TEntity`s to create or modify.
|
|
123
123
|
* @param signal Used to cancel the request.
|
|
124
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
125
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
126
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
127
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
128
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
124
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
125
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
126
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
127
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
128
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
129
129
|
*/
|
|
130
130
|
createAll(entities, signal) {
|
|
131
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -143,11 +143,11 @@ class GenericCollectionEndpoint extends _1.ETagEndpointBase {
|
|
|
143
143
|
/**
|
|
144
144
|
* Replaces the entire content of the collection with new `TEntity`s.
|
|
145
145
|
* @param entities The `TEntity`s to create or modify.
|
|
146
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
147
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
148
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
149
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
150
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
146
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
147
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
148
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
149
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
150
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
151
151
|
*/
|
|
152
152
|
setAll(entities) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function* () { yield this.putContent(entities); });
|
|
@@ -155,42 +155,42 @@ class GenericCollectionEndpoint extends _1.ETagEndpointBase {
|
|
|
155
155
|
/**
|
|
156
156
|
* Determines whether the collection contains a specific element.
|
|
157
157
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
158
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
159
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
160
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
158
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
159
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
160
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
161
161
|
*/
|
|
162
162
|
contains(element) { return this.get(element).exists(); }
|
|
163
163
|
/**
|
|
164
164
|
* Sets/replaces an existing element in the collection.
|
|
165
165
|
* @param element The new state of the element.
|
|
166
166
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
167
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
168
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
169
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
170
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
171
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
167
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
168
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
169
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
170
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
171
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
172
172
|
*/
|
|
173
173
|
set(element) { return this.get(element).set(element); }
|
|
174
174
|
/**
|
|
175
175
|
* Modifies an existing element in the collection by merging changes on the server-side.
|
|
176
176
|
* @param element The `TEntity` data to merge with the existing element.
|
|
177
177
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
178
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
179
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
180
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
181
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
182
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
178
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
179
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
180
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
181
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
182
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
183
183
|
*/
|
|
184
184
|
merge(element) { return this.get(element).merge(element); }
|
|
185
185
|
/**
|
|
186
186
|
* Deletes an existing element from the collection.
|
|
187
187
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
188
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
189
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
190
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
191
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
188
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
189
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
190
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
191
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
192
192
|
*/
|
|
193
193
|
delete(element) { return this.get(element).delete(); }
|
|
194
194
|
}
|
|
195
195
|
exports.GenericCollectionEndpoint = GenericCollectionEndpoint;
|
|
196
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
196
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR2VuZXJpY0NvbGxlY3Rpb25FbmRwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkdlbmVyaWNDb2xsZWN0aW9uRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEseURBQXNEO0FBSXRELHFDQUFtRTtBQUVuRTs7Ozs7R0FLRztBQUNILE1BQWEseUJBQXNGLFNBQVEsbUNBQWdCO0lBQ3ZIOzs7OztPQUtHO0lBQ0gsWUFBWSxRQUFrQixFQUFFLFdBQXlCLEVBQW1CLGVBQXVFO1FBQy9JLEtBQUssQ0FBQyxRQUFRLEVBQUUsV0FBVyxDQUFDLENBQUM7UUFEMkMsb0JBQWUsR0FBZixlQUFlLENBQXdEO1FBRS9JLElBQUksQ0FBQyxzQkFBc0IsQ0FBQyxPQUFPLEVBQUUsUUFBUSxDQUFDLENBQUM7SUFDbkQsQ0FBQztJQUVEOzs7T0FHRztJQUNILEdBQUcsQ0FBQyxPQUEyQjtRQUMzQixJQUFJLE9BQU8sSUFBSSxJQUFJO1lBQUUsTUFBTSxJQUFJLEtBQUssQ0FBQywwQ0FBMEMsQ0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BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUVoRTs7Ozs7Ozs7O09BU0c7SUFDSCxLQUFLLENBQUMsT0FBZ0IsSUFBSSxPQUFPLElBQUksQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUVwRTs7Ozs7OztPQU9HO0lBQ0gsTUFBTSxDQUFDLE9BQTJCLElBQUksT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUMsQ0FBQztDQUM3RTtBQS9LRCw4REErS0MifQ==
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ETagEndpointBase
|
|
1
|
+
import { ETagEndpointBase } from "./ETagEndpointBase";
|
|
2
|
+
import { ElementEndpoint } from "./ElementEndpoint";
|
|
2
3
|
import { Endpoint } from "../Endpoint";
|
|
3
4
|
import { CachingEndpoint } from "../CachingEndpoint";
|
|
4
5
|
import { HttpMethod, HttpHeader, ResponseCache } from "../../http";
|
|
@@ -50,10 +51,10 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
50
51
|
/**
|
|
51
52
|
* Returns all `TEntity`s in the collection.
|
|
52
53
|
* @param signal Used to cancel the request.
|
|
53
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
54
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
55
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
56
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
54
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
55
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
56
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
57
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
57
58
|
*/
|
|
58
59
|
async readAll(signal?: AbortSignal) {
|
|
59
60
|
return this.serializer.deserialize<TEntity[]>(await this.getContent(signal));
|
|
@@ -71,11 +72,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
71
72
|
* @param entity The new `TEntity`.
|
|
72
73
|
* @param signal Used to cancel the request.
|
|
73
74
|
* @returns An endpoint for the newly created entity; `undefined` if the server returned neither a "Location" header nor an entity with an ID in the response body.
|
|
74
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
75
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
76
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
77
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
78
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
75
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
76
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
77
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
78
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
79
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
79
80
|
*/
|
|
80
81
|
async create(entity: TEntity, signal?: AbortSignal): Promise<TElementEndpoint | undefined> {
|
|
81
82
|
const response = await this.send(HttpMethod.Post, signal, {
|
|
@@ -112,11 +113,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
112
113
|
* Adds (or updates) multiple `TEntity`s as elements in the collection.
|
|
113
114
|
* @param entities The `TEntity`s to create or modify.
|
|
114
115
|
* @param signal Used to cancel the request.
|
|
115
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
116
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
117
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
118
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
119
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
116
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
117
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
118
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
119
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
120
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
120
121
|
*/
|
|
121
122
|
async createAll(entities: TEntity[], signal?: AbortSignal) {
|
|
122
123
|
await this.send(HttpMethod.Patch, signal, {
|
|
@@ -134,20 +135,20 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
134
135
|
/**
|
|
135
136
|
* Replaces the entire content of the collection with new `TEntity`s.
|
|
136
137
|
* @param entities The `TEntity`s to create or modify.
|
|
137
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
138
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
139
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
140
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
141
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
138
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
139
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
140
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
141
|
+
* @throws {@link errors!ConflictError}: {@link http!HttpStatusCode.Conflict}
|
|
142
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
142
143
|
*/
|
|
143
144
|
async setAll(entities: TEntity[]) { await this.putContent(entities); }
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
147
|
* Determines whether the collection contains a specific element.
|
|
147
148
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
148
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
149
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
150
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
149
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
150
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
151
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
151
152
|
*/
|
|
152
153
|
contains(element: (TEntity | string)) { return this.get(element).exists(); }
|
|
153
154
|
|
|
@@ -155,11 +156,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
155
156
|
* Sets/replaces an existing element in the collection.
|
|
156
157
|
* @param element The new state of the element.
|
|
157
158
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
158
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
159
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
160
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
161
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
162
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
159
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
160
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
161
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
162
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
163
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
163
164
|
*/
|
|
164
165
|
set(element: TEntity) { return this.get(element).set(element); }
|
|
165
166
|
|
|
@@ -167,21 +168,21 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
167
168
|
* Modifies an existing element in the collection by merging changes on the server-side.
|
|
168
169
|
* @param element The `TEntity` data to merge with the existing element.
|
|
169
170
|
* @returns The `TEntity` as returned by the server, possibly with additional fields set. undefined if the server does not respond with a result entity.
|
|
170
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
171
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
172
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
173
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
174
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
171
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
172
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
173
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
174
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
175
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
175
176
|
*/
|
|
176
177
|
merge(element: TEntity) { return this.get(element).merge(element); }
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
180
|
* Deletes an existing element from the collection.
|
|
180
181
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
181
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
182
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
183
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
184
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
182
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
183
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
184
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
185
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
185
186
|
*/
|
|
186
187
|
delete(element: (TEntity | string)) { return this.get(element).delete(); }
|
|
187
188
|
}
|
|
@@ -4,7 +4,7 @@ exports.IndexerEndpoint = void 0;
|
|
|
4
4
|
const Endpoint_1 = require("../Endpoint");
|
|
5
5
|
/**
|
|
6
6
|
* Endpoint that addresses child `TElementEndpoint`s by ID.
|
|
7
|
-
* @typeParam The type of @
|
|
7
|
+
* @typeParam TElementEndpoint The type of {@link Endpoint} to provide for individual elements.
|
|
8
8
|
*/
|
|
9
9
|
class IndexerEndpoint extends Endpoint_1.Endpoint {
|
|
10
10
|
/**
|
|
@@ -2,7 +2,7 @@ import { Endpoint } from "../Endpoint";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Endpoint that addresses child `TElementEndpoint`s by ID.
|
|
5
|
-
* @typeParam The type of @
|
|
5
|
+
* @typeParam TElementEndpoint The type of {@link Endpoint} to provide for individual elements.
|
|
6
6
|
*/
|
|
7
7
|
export class IndexerEndpoint<TElementEndpoint extends Endpoint> extends Endpoint {
|
|
8
8
|
/**
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -15,4 +19,4 @@ __exportStar(require("./ETagEndpointBase"), exports);
|
|
|
15
19
|
__exportStar(require("./GenericCollectionEndpoint"), exports);
|
|
16
20
|
__exportStar(require("./CollectionEndpoint"), exports);
|
|
17
21
|
__exportStar(require("./ElementEndpoint"), exports);
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQWtDO0FBQ2xDLHFEQUFtQztBQUNuQyw4REFBNEM7QUFDNUMsdURBQXFDO0FBQ3JDLG9EQUFrQyJ9
|
package/endpoints/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -29,4 +33,4 @@ exports.raw = __importStar(require("./raw"));
|
|
|
29
33
|
__exportStar(require("./Endpoint"), exports);
|
|
30
34
|
__exportStar(require("./EntryEndpoint"), exports);
|
|
31
35
|
__exportStar(require("./CachingEndpoint"), exports);
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHFEQUFxQztBQUNyQyw2Q0FBNkI7QUFDN0IsNkNBQTZCO0FBRTdCLDZDQUEyQjtBQUMzQixrREFBZ0M7QUFDaEMsb0RBQWtDIn0=
|
|
@@ -12,6 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BlobEndpoint = void 0;
|
|
13
13
|
const Endpoint_1 = require("../Endpoint");
|
|
14
14
|
const http_1 = require("../../http");
|
|
15
|
+
/**
|
|
16
|
+
* Endpoint for a binary blob that can be downloaded or uploaded.
|
|
17
|
+
*/
|
|
15
18
|
class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
16
19
|
/**
|
|
17
20
|
* Creates a new blob endpoint.
|
|
@@ -24,10 +27,10 @@ class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
|
24
27
|
/**
|
|
25
28
|
* Queries the server about capabilities of the endpoint without performing any action.
|
|
26
29
|
* @param signal Used to cancel the request.
|
|
27
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
28
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
29
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
30
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
30
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
31
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
32
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
33
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
31
34
|
*/
|
|
32
35
|
probe(signal) {
|
|
33
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -43,11 +46,11 @@ class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
|
43
46
|
/**
|
|
44
47
|
* Downloads the blob's content.
|
|
45
48
|
* @param signal Used to cancel the request.
|
|
46
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
47
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
48
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
49
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
50
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
49
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
50
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
51
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
52
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
53
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
51
54
|
*/
|
|
52
55
|
download(signal) {
|
|
53
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -65,10 +68,10 @@ class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
|
65
68
|
* Uploads data as the blob's content.
|
|
66
69
|
* @param blob The blob to read the upload data from.
|
|
67
70
|
* @param signal Used to cancel the request.
|
|
68
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
69
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
70
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
71
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
71
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
72
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
73
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
74
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
72
75
|
*/
|
|
73
76
|
upload(blob, signal) {
|
|
74
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -84,11 +87,11 @@ class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
|
84
87
|
/**
|
|
85
88
|
* Deletes the blob from the server.
|
|
86
89
|
* @param signal Used to cancel the request.
|
|
87
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
88
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
89
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
90
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
91
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
90
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
91
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
92
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
93
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
94
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
92
95
|
*/
|
|
93
96
|
delete(signal) {
|
|
94
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -97,4 +100,4 @@ class BlobEndpoint extends Endpoint_1.Endpoint {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
exports.BlobEndpoint = BlobEndpoint;
|
|
100
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
103
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmxvYkVuZHBvaW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiQmxvYkVuZHBvaW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLDBDQUF1QztBQUN2QyxxQ0FBb0Q7QUFFcEQ7O0dBRUc7QUFDSCxNQUFhLFlBQWEsU0FBUSxtQkFBUTtJQUN0Qzs7OztPQUlHO0lBQ0gsWUFBWSxRQUFrQixFQUFFLFdBQXlCO1FBQ3JELEtBQUssQ0FBQyxRQUFRLEVBQUUsV0FBVyxDQUFDLENBQUM7SUFDakMsQ0FBQztJQUVEOzs7Ozs7O09BT0c7SUFDRyxLQUFLLENBQUMsTUFBb0I7O1lBQzVCLE1BQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxpQkFBVSxDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQztRQUNoRCxDQUFDO0tBQUE7SUFFRDs7OztPQUlHO0lBQ0gsSUFBSSxlQUFlLEtBQUssT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLGlCQUFVLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXRFOzs7Ozs7OztPQVFHO0lBQ0csUUFBUSxDQUFDLE1BQW9COztZQUMvQixNQUFNLFFBQVEsR0FBRyxNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxHQUFHLEVBQUUsTUFBTSxDQUFDLENBQUM7WUFDekQsT0FBTyxRQUFRLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDM0IsQ0FBQztLQUFBO0lBRUQ7Ozs7T0FJRztJQUNILElBQUksYUFBYSxLQUFLLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxpQkFBVSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUVwRTs7Ozs7Ozs7T0FRRztJQUNHLE1BQU0sQ0FBQyxJQUFVLEVBQUUsTUFBb0I7O1lBQ3pDLE1BQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxpQkFBVSxDQUFDLEdBQUcsRUFBRSxNQUFNLEVBQUUsRUFBRSxDQUFDLGlCQUFVLENBQUMsV0FBVyxDQUFDLEVBQUUsSUFBSSxDQUFDLElBQUksRUFBRSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzNGLENBQUM7S0FBQTtJQUVEOzs7O09BSUc7SUFDSCxJQUFJLGFBQWEsS0FBSyxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsaUJBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFdkU7Ozs7Ozs7O09BUUc7SUFDRyxNQUFNLENBQUMsTUFBb0I7O1lBQzdCLE1BQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxpQkFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsQ0FBQztRQUMvQyxDQUFDO0tBQUE7Q0FDSjtBQWxGRCxvQ0FrRkMifQ==
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Endpoint } from "../Endpoint";
|
|
2
2
|
import { HttpMethod, HttpHeader } from "../../http";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Endpoint for a binary blob that can be downloaded or uploaded.
|
|
6
|
+
*/
|
|
4
7
|
export class BlobEndpoint extends Endpoint {
|
|
5
8
|
/**
|
|
6
9
|
* Creates a new blob endpoint.
|
|
@@ -14,10 +17,10 @@ export class BlobEndpoint extends Endpoint {
|
|
|
14
17
|
/**
|
|
15
18
|
* Queries the server about capabilities of the endpoint without performing any action.
|
|
16
19
|
* @param signal Used to cancel the request.
|
|
17
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
18
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
19
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
20
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
20
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
21
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
22
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
23
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
21
24
|
*/
|
|
22
25
|
async probe(signal?: AbortSignal) {
|
|
23
26
|
await this.send(HttpMethod.Options, signal);
|
|
@@ -33,11 +36,11 @@ export class BlobEndpoint extends Endpoint {
|
|
|
33
36
|
/**
|
|
34
37
|
* Downloads the blob's content.
|
|
35
38
|
* @param signal Used to cancel the request.
|
|
36
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
37
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
38
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
39
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
40
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
39
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
40
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
41
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
42
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
43
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
41
44
|
*/
|
|
42
45
|
async download(signal?: AbortSignal): Promise<Blob> {
|
|
43
46
|
const response = await this.send(HttpMethod.Get, signal);
|
|
@@ -55,10 +58,10 @@ export class BlobEndpoint extends Endpoint {
|
|
|
55
58
|
* Uploads data as the blob's content.
|
|
56
59
|
* @param blob The blob to read the upload data from.
|
|
57
60
|
* @param signal Used to cancel the request.
|
|
58
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
59
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
60
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
61
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
61
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
62
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
63
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
64
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
62
65
|
*/
|
|
63
66
|
async upload(blob: Blob, signal?: AbortSignal) {
|
|
64
67
|
await this.send(HttpMethod.Put, signal, { [HttpHeader.ContentType]: blob.type }, blob);
|
|
@@ -74,11 +77,11 @@ export class BlobEndpoint extends Endpoint {
|
|
|
74
77
|
/**
|
|
75
78
|
* Deletes the blob from the server.
|
|
76
79
|
* @param signal Used to cancel the request.
|
|
77
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
78
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
79
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
80
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
81
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
80
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
81
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
82
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
83
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
84
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
82
85
|
*/
|
|
83
86
|
async delete(signal?: AbortSignal) {
|
|
84
87
|
await this.send(HttpMethod.Delete, signal);
|