typedrest 0.3.5 → 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 +11 -11
- package/endpoints/Endpoint.ts +11 -11
- package/endpoints/EntryEndpoint.js +8 -8
- package/endpoints/EntryEndpoint.ts +8 -8
- package/endpoints/generic/ETagEndpointBase.js +20 -20
- package/endpoints/generic/ETagEndpointBase.ts +21 -21
- package/endpoints/generic/ElementEndpoint.js +30 -30
- package/endpoints/generic/ElementEndpoint.ts +30 -30
- package/endpoints/generic/GenericCollectionEndpoint.js +36 -36
- package/endpoints/generic/GenericCollectionEndpoint.ts +36 -36
- package/endpoints/generic/IndexerEndpoint.js +1 -1
- package/endpoints/generic/IndexerEndpoint.ts +1 -1
- 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/rpc/ActionEndpoint.js +4 -4
- package/endpoints/rpc/ActionEndpoint.ts +4 -4
- package/endpoints/rpc/ConsumerEndpoint.js +4 -4
- package/endpoints/rpc/ConsumerEndpoint.ts +4 -4
- package/endpoints/rpc/FunctionEndpoint.js +4 -4
- package/endpoints/rpc/FunctionEndpoint.ts +4 -4
- package/endpoints/rpc/ProducerEndpoint.js +4 -4
- package/endpoints/rpc/ProducerEndpoint.ts +4 -4
- package/endpoints/rpc/RpcEndpointBase.js +4 -4
- package/endpoints/rpc/RpcEndpointBase.ts +4 -4
- package/errors/DefaultErrorHandler.js +8 -8
- package/errors/DefaultErrorHandler.ts +8 -8
- package/errors/ErrorHandler.ts +1 -1
- package/errors/Errors.js +8 -9
- package/errors/Errors.ts +7 -9
- package/http/FetchHttpClient.js +2 -2
- package/http/FetchHttpClient.ts +2 -2
- package/jest.config.js +12 -0
- package/links/AggregateLinkExtractor.js +1 -1
- package/links/AggregateLinkExtractor.ts +1 -1
- package/links/HalLinkExtractor.js +1 -1
- package/links/HalLinkExtractor.ts +1 -1
- package/links/HeaderLinkExtractor.js +1 -1
- package/links/HeaderLinkExtractor.ts +1 -1
- package/package.json +9 -17
- package/serializers/JsonSerializer.js +3 -3
- package/serializers/JsonSerializer.ts +3 -3
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- 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
|
@@ -59,10 +59,10 @@ class GenericCollectionEndpoint extends ETagEndpointBase_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 ETagEndpointBase_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 ETagEndpointBase_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 ETagEndpointBase_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,40 +155,40 @@ class GenericCollectionEndpoint extends ETagEndpointBase_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
|
}
|
|
@@ -51,10 +51,10 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns all `TEntity`s in the collection.
|
|
53
53
|
* @param signal Used to cancel the request.
|
|
54
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
55
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
56
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
57
|
-
* @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
|
|
58
58
|
*/
|
|
59
59
|
async readAll(signal?: AbortSignal) {
|
|
60
60
|
return this.serializer.deserialize<TEntity[]>(await this.getContent(signal));
|
|
@@ -72,11 +72,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
72
72
|
* @param entity The new `TEntity`.
|
|
73
73
|
* @param signal Used to cancel the request.
|
|
74
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.
|
|
75
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
76
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
77
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
78
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
79
|
-
* @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
|
|
80
80
|
*/
|
|
81
81
|
async create(entity: TEntity, signal?: AbortSignal): Promise<TElementEndpoint | undefined> {
|
|
82
82
|
const response = await this.send(HttpMethod.Post, signal, {
|
|
@@ -113,11 +113,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
113
113
|
* Adds (or updates) multiple `TEntity`s as elements in the collection.
|
|
114
114
|
* @param entities The `TEntity`s to create or modify.
|
|
115
115
|
* @param signal Used to cancel the request.
|
|
116
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
117
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
118
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
119
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
120
|
-
* @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
|
|
121
121
|
*/
|
|
122
122
|
async createAll(entities: TEntity[], signal?: AbortSignal) {
|
|
123
123
|
await this.send(HttpMethod.Patch, signal, {
|
|
@@ -135,20 +135,20 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
135
135
|
/**
|
|
136
136
|
* Replaces the entire content of the collection with new `TEntity`s.
|
|
137
137
|
* @param entities The `TEntity`s to create or modify.
|
|
138
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
139
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
140
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
141
|
-
* @throws {@link ConflictError}: {@link HttpStatusCode.Conflict}
|
|
142
|
-
* @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
|
|
143
143
|
*/
|
|
144
144
|
async setAll(entities: TEntity[]) { await this.putContent(entities); }
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* Determines whether the collection contains a specific element.
|
|
148
148
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
149
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
150
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
151
|
-
* @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
|
|
152
152
|
*/
|
|
153
153
|
contains(element: (TEntity | string)) { return this.get(element).exists(); }
|
|
154
154
|
|
|
@@ -156,11 +156,11 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
156
156
|
* Sets/replaces an existing element in the collection.
|
|
157
157
|
* @param element The new state of the element.
|
|
158
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.
|
|
159
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
160
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
161
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
162
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
163
|
-
* @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
|
|
164
164
|
*/
|
|
165
165
|
set(element: TEntity) { return this.get(element).set(element); }
|
|
166
166
|
|
|
@@ -168,21 +168,21 @@ export class GenericCollectionEndpoint<TEntity, TElementEndpoint extends Element
|
|
|
168
168
|
* Modifies an existing element in the collection by merging changes on the server-side.
|
|
169
169
|
* @param element The `TEntity` data to merge with the existing element.
|
|
170
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.
|
|
171
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
172
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
173
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
174
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
175
|
-
* @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
|
|
176
176
|
*/
|
|
177
177
|
merge(element: TEntity) { return this.get(element).merge(element); }
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* Deletes an existing element from the collection.
|
|
181
181
|
* @param element The ID identifying the entity or an entity to extract the ID from.
|
|
182
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
183
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
184
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
185
|
-
* @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
|
|
186
186
|
*/
|
|
187
187
|
delete(element: (TEntity | string)) { return this.get(element).delete(); }
|
|
188
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
|
/**
|
|
@@ -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);
|
|
@@ -12,6 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UploadEndpoint = void 0;
|
|
13
13
|
const Endpoint_1 = require("../Endpoint");
|
|
14
14
|
const http_1 = require("../../http");
|
|
15
|
+
/**
|
|
16
|
+
* Endpoint that accepts binary uploads using multi-part form encoding or raw bodies.
|
|
17
|
+
*/
|
|
15
18
|
class UploadEndpoint extends Endpoint_1.Endpoint {
|
|
16
19
|
/**
|
|
17
20
|
* Creates a new upload endpoint.
|
|
@@ -29,11 +32,11 @@ class UploadEndpoint extends Endpoint_1.Endpoint {
|
|
|
29
32
|
* @param blob The blob to read the upload data from.
|
|
30
33
|
* @param fileName The name of the uploaded file.
|
|
31
34
|
* @param signal Used to cancel the request.
|
|
32
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
33
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
34
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
35
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
36
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
35
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
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
|
|
37
40
|
*/
|
|
38
41
|
upload(blob, fileName, signal) {
|
|
39
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -49,4 +52,4 @@ class UploadEndpoint extends Endpoint_1.Endpoint {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
exports.UploadEndpoint = UploadEndpoint;
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXBsb2FkRW5kcG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJVcGxvYWRFbmRwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSwwQ0FBdUM7QUFDdkMscUNBQW9EO0FBRXBEOztHQUVHO0FBQ0gsTUFBYSxjQUFlLFNBQVEsbUJBQVE7SUFDeEM7Ozs7O09BS0c7SUFDSCxZQUFZLFFBQWtCLEVBQUUsV0FBeUIsRUFBbUIsU0FBa0I7UUFDMUYsS0FBSyxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztRQUQyQyxjQUFTLEdBQVQsU0FBUyxDQUFTO1FBRTFGLElBQUksQ0FBQyxTQUFTLEdBQUcsU0FBUyxDQUFDO0lBQy9CLENBQUM7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0csTUFBTSxDQUFDLElBQVUsRUFBRSxRQUFpQixFQUFFLE1BQW9COztZQUM1RCxJQUFJLElBQUksQ0FBQyxTQUFTLEVBQUU7Z0JBQ2hCLE1BQU0sUUFBUSxHQUFHLElBQUksUUFBUSxFQUFFLENBQUM7Z0JBQ2hDLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxJQUFJLEVBQUUsUUFBUSxDQUFDLENBQUM7Z0JBQzdDLE1BQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxpQkFBVSxDQUFDLElBQUksRUFBRSxNQUFNLEVBQUUsRUFBRSxDQUFDLGlCQUFVLENBQUMsV0FBVyxDQUFDLEVBQUUscUJBQXFCLEVBQUUsRUFBRSxRQUFRLENBQUMsQ0FBQzthQUMzRztpQkFBTTtnQkFDSCxNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQVUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFLEVBQUUsQ0FBQyxpQkFBVSxDQUFDLFdBQVcsQ0FBQyxFQUFFLElBQUksQ0FBQyxJQUFJLEVBQUUsRUFBRSxJQUFJLENBQUMsQ0FBQzthQUMzRjtRQUNMLENBQUM7S0FBQTtDQUNKO0FBaENELHdDQWdDQyJ9
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Endpoint } from "../Endpoint";
|
|
2
2
|
import { HttpMethod, HttpHeader } from "../../http";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Endpoint that accepts binary uploads using multi-part form encoding or raw bodies.
|
|
6
|
+
*/
|
|
4
7
|
export class UploadEndpoint extends Endpoint {
|
|
5
8
|
/**
|
|
6
9
|
* Creates a new upload endpoint.
|
|
@@ -18,11 +21,11 @@ export class UploadEndpoint extends Endpoint {
|
|
|
18
21
|
* @param blob The blob to read the upload data from.
|
|
19
22
|
* @param fileName The name of the uploaded file.
|
|
20
23
|
* @param signal Used to cancel the request.
|
|
21
|
-
* @throws {@link BadRequestError}: {@link HttpStatusCode.BadRequest}
|
|
22
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
23
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
24
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
25
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
24
|
+
* @throws {@link errors!BadRequestError}: {@link http!HttpStatusCode.BadRequest}
|
|
25
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
26
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
27
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
28
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
26
29
|
*/
|
|
27
30
|
async upload(blob: Blob, fileName?: string, signal?: AbortSignal) {
|
|
28
31
|
if (this.formField) {
|
|
@@ -27,10 +27,10 @@ class ActionEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
|
|
|
27
27
|
/**
|
|
28
28
|
* Invokes the action.
|
|
29
29
|
* @param signal Used to cancel the request.
|
|
30
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
31
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
32
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
33
|
-
* @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
|
|
34
34
|
*/
|
|
35
35
|
invoke(signal) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -18,10 +18,10 @@ export class ActionEndpoint extends RpcEndpointBase {
|
|
|
18
18
|
/**
|
|
19
19
|
* Invokes the action.
|
|
20
20
|
* @param signal Used to cancel the request.
|
|
21
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
22
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
23
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
24
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
21
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
22
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
23
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
24
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
25
25
|
*/
|
|
26
26
|
async invoke(signal?: AbortSignal) {
|
|
27
27
|
await this.send(HttpMethod.Post, signal);
|
|
@@ -29,10 +29,10 @@ class ConsumerEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
|
|
|
29
29
|
* Sends the entity to the consumer.
|
|
30
30
|
* @param entity The `TEntity` to post as input.
|
|
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
|
invoke(entity, signal) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -20,10 +20,10 @@ export class ConsumerEndpoint<TEntity> extends RpcEndpointBase {
|
|
|
20
20
|
* Sends the entity to the consumer.
|
|
21
21
|
* @param entity The `TEntity` to post as input.
|
|
22
22
|
* @param signal Used to cancel the request.
|
|
23
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
24
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
25
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
26
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
23
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
24
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
25
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
26
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
27
27
|
*/
|
|
28
28
|
async invoke(entity: TEntity, signal?: AbortSignal) {
|
|
29
29
|
await this.send(HttpMethod.Post, signal, {
|
|
@@ -31,10 +31,10 @@ class FunctionEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
|
|
|
31
31
|
* @param entity The `TEntity` to post as input.
|
|
32
32
|
* @param signal Used to cancel the request.
|
|
33
33
|
* @returns The `TResult` returned by the server.
|
|
34
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
35
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
36
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
37
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
34
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
35
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
36
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
37
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
38
38
|
*/
|
|
39
39
|
invoke(entity, signal) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -22,10 +22,10 @@ export class FunctionEndpoint<TEntity, TResult> extends RpcEndpointBase {
|
|
|
22
22
|
* @param entity The `TEntity` to post as input.
|
|
23
23
|
* @param signal Used to cancel the request.
|
|
24
24
|
* @returns The `TResult` returned by the server.
|
|
25
|
-
* @throws {@link AuthenticationError}: {@link HttpStatusCode.Unauthorized}
|
|
26
|
-
* @throws {@link AuthorizationError}: {@link HttpStatusCode.Forbidden}
|
|
27
|
-
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
|
|
28
|
-
* @throws {@link HttpError}: Other non-success status code
|
|
25
|
+
* @throws {@link errors!AuthenticationError}: {@link http!HttpStatusCode.Unauthorized}
|
|
26
|
+
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
|
|
27
|
+
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
|
|
28
|
+
* @throws {@link errors!HttpError}: Other non-success status code
|
|
29
29
|
*/
|
|
30
30
|
async invoke(entity: TEntity, signal?: AbortSignal): Promise<TResult> {
|
|
31
31
|
const response = await this.send(HttpMethod.Post, signal, {
|
|
@@ -29,10 +29,10 @@ class ProducerEndpoint extends RpcEndpointBase_1.RpcEndpointBase {
|
|
|
29
29
|
* Gets a result from the producer.
|
|
30
30
|
* @param signal Used to cancel the request.
|
|
31
31
|
* @returns The `TResult` returned by the server.
|
|
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
|
invoke(signal) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|