@monocloud/management-core 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -12
- package/dist/index.cjs +122 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +264 -13
- package/dist/index.d.mts +264 -13
- package/dist/index.mjs +119 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,102 +1,323 @@
|
|
|
1
1
|
//#region src/exceptions/monocloud-exception.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The MonoCloud Exception
|
|
4
|
+
* @export
|
|
5
|
+
* @class MonoCloudException
|
|
6
|
+
*/
|
|
2
7
|
declare class MonoCloudException extends Error {}
|
|
3
8
|
//#endregion
|
|
4
9
|
//#region src/models/problem-details.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* The Problem Details
|
|
12
|
+
* @export
|
|
13
|
+
* @class ProblemDetails
|
|
14
|
+
*/
|
|
5
15
|
declare class ProblemDetails {
|
|
16
|
+
/**
|
|
17
|
+
* The type of error
|
|
18
|
+
* @type {string}
|
|
19
|
+
* @memberof ProblemDetails
|
|
20
|
+
*/
|
|
6
21
|
type: string;
|
|
22
|
+
/**
|
|
23
|
+
* The title of the error
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof ProblemDetails
|
|
26
|
+
*/
|
|
7
27
|
title: string;
|
|
28
|
+
/**
|
|
29
|
+
* The status code representing the error
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @memberof ProblemDetails
|
|
32
|
+
*/
|
|
8
33
|
status: number;
|
|
34
|
+
/**
|
|
35
|
+
* The error details
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof ProblemDetails
|
|
38
|
+
*/
|
|
9
39
|
detail: string;
|
|
40
|
+
/**
|
|
41
|
+
* The instance
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @memberof ProblemDetails
|
|
44
|
+
*/
|
|
10
45
|
instance: string;
|
|
46
|
+
/**
|
|
47
|
+
* Additional data about the error
|
|
48
|
+
*/
|
|
11
49
|
[key: string]: any;
|
|
12
50
|
constructor(response: ProblemDetails);
|
|
13
51
|
}
|
|
14
52
|
//#endregion
|
|
15
53
|
//#region src/exceptions/monocloud-request-exception.d.ts
|
|
16
54
|
declare class MonoCloudRequestException extends MonoCloudException {
|
|
55
|
+
/**
|
|
56
|
+
* The problem details received from the server.
|
|
57
|
+
* @type {ProblemDetails}
|
|
58
|
+
* @memberof MonoCloudRequestException
|
|
59
|
+
*/
|
|
17
60
|
response?: ProblemDetails;
|
|
61
|
+
/**
|
|
62
|
+
* Initializes the MonoCloudRequestException Class
|
|
63
|
+
* @param response - The problem details returned from the server.
|
|
64
|
+
*/
|
|
18
65
|
constructor(response: ProblemDetails);
|
|
66
|
+
/**
|
|
67
|
+
* Initializes the MonoCloudRequestException Class
|
|
68
|
+
* @param message - The error message.
|
|
69
|
+
*/
|
|
19
70
|
constructor(message: string);
|
|
71
|
+
/**
|
|
72
|
+
* Initializes the MonoCloudRequestException Class
|
|
73
|
+
* @param response - The problem details returned from the server.
|
|
74
|
+
* @param message - The error message.
|
|
75
|
+
*/
|
|
20
76
|
constructor(response: ProblemDetails, message: string);
|
|
21
77
|
}
|
|
22
78
|
//#endregion
|
|
23
79
|
//#region src/exceptions/monocloud-bad-request-exception.d.ts
|
|
80
|
+
/**
|
|
81
|
+
* The MonoCloud Bad Request Exception
|
|
82
|
+
* @export
|
|
83
|
+
* @class MonoCloudBadRequestException
|
|
84
|
+
*/
|
|
24
85
|
declare class MonoCloudBadRequestException extends MonoCloudRequestException {
|
|
86
|
+
/**
|
|
87
|
+
* Initializes the MonoCloudBadRequestException Class
|
|
88
|
+
* @param response - The problem details returned from the server.
|
|
89
|
+
*/
|
|
25
90
|
constructor(response: ProblemDetails);
|
|
91
|
+
/**
|
|
92
|
+
* Initializes the MonoCloudBadRequestException Class
|
|
93
|
+
* @param message - The error message.
|
|
94
|
+
*/
|
|
26
95
|
constructor(message: string);
|
|
27
96
|
}
|
|
28
97
|
//#endregion
|
|
29
98
|
//#region src/exceptions/monocloud-conflict-exception.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* The MonoCloud Conflict Exception
|
|
101
|
+
* @export
|
|
102
|
+
* @class MonoCloudConflictException
|
|
103
|
+
*/
|
|
30
104
|
declare class MonoCloudConflictException extends MonoCloudRequestException {
|
|
105
|
+
/**
|
|
106
|
+
* Initializes the MonoCloudConflictException Class
|
|
107
|
+
* @param response - The problem details returned from the server.
|
|
108
|
+
*/
|
|
31
109
|
constructor(response: ProblemDetails);
|
|
110
|
+
/**
|
|
111
|
+
* Initializes the MonoCloudConflictException Class
|
|
112
|
+
* @param message - The error message.
|
|
113
|
+
*/
|
|
32
114
|
constructor(message: string);
|
|
33
115
|
}
|
|
34
116
|
//#endregion
|
|
35
|
-
//#region src/models/
|
|
36
|
-
|
|
117
|
+
//#region src/models/identity-error.d.ts
|
|
118
|
+
/**
|
|
119
|
+
* Identity Error: Represents a validation or processing error returned by the identity system.
|
|
120
|
+
* @export
|
|
121
|
+
* @class IdentityError
|
|
122
|
+
*/
|
|
123
|
+
declare class IdentityError {
|
|
124
|
+
/**
|
|
125
|
+
* Machine-readable error code.
|
|
126
|
+
* @type {string}
|
|
127
|
+
* @memberof IdentityError
|
|
128
|
+
*/
|
|
37
129
|
code: string;
|
|
130
|
+
/**
|
|
131
|
+
* Human-readable description of the error.
|
|
132
|
+
* @type {string}
|
|
133
|
+
* @memberof IdentityError
|
|
134
|
+
*/
|
|
38
135
|
description: string;
|
|
39
|
-
|
|
40
|
-
constructor(code: string, description: string, field?: string);
|
|
136
|
+
constructor(code: string, description: string);
|
|
41
137
|
}
|
|
42
138
|
//#endregion
|
|
43
|
-
//#region src/models/
|
|
44
|
-
declare class
|
|
45
|
-
errors:
|
|
139
|
+
//#region src/models/identity-validation-problem-details.d.ts
|
|
140
|
+
declare class IdentityValidationProblemDetails extends ProblemDetails {
|
|
141
|
+
errors: IdentityError[];
|
|
46
142
|
constructor(response: ProblemDetails);
|
|
47
143
|
}
|
|
48
144
|
//#endregion
|
|
49
|
-
//#region src/exceptions/monocloud-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
145
|
+
//#region src/exceptions/monocloud-identity-validation-exception.d.ts
|
|
146
|
+
/**
|
|
147
|
+
* The MonoCloud Identity Validation Exception
|
|
148
|
+
* @export
|
|
149
|
+
* @class MonoCloudIdentityValidationException
|
|
150
|
+
*/
|
|
151
|
+
declare class MonoCloudIdentityValidationException extends MonoCloudRequestException {
|
|
152
|
+
errors: IdentityError[];
|
|
153
|
+
/**
|
|
154
|
+
* Initializes the MonoCloudIdentityValidationException Class
|
|
155
|
+
* @param response - The problem details returned from the server.
|
|
156
|
+
*/
|
|
157
|
+
constructor(response: IdentityValidationProblemDetails);
|
|
53
158
|
}
|
|
54
159
|
//#endregion
|
|
55
160
|
//#region src/exceptions/monocloud-forbidden-exception.d.ts
|
|
161
|
+
/**
|
|
162
|
+
* The MonoCloud Forbidden Exception
|
|
163
|
+
* @export
|
|
164
|
+
* @class MonoCloudForbiddenException
|
|
165
|
+
*/
|
|
56
166
|
declare class MonoCloudForbiddenException extends MonoCloudRequestException {
|
|
167
|
+
/**
|
|
168
|
+
* Initializes the MonoCloudForbiddenException Class
|
|
169
|
+
* @param response - The problem details returned from the server.
|
|
170
|
+
*/
|
|
57
171
|
constructor(response: ProblemDetails);
|
|
172
|
+
/**
|
|
173
|
+
* Initializes the MonoCloudForbiddenException Class
|
|
174
|
+
* @param message - The error message.
|
|
175
|
+
*/
|
|
58
176
|
constructor(message: string);
|
|
59
177
|
}
|
|
60
178
|
//#endregion
|
|
61
179
|
//#region src/models/key-validation-problem-details.d.ts
|
|
180
|
+
/**
|
|
181
|
+
* The Key Validation Problem Details
|
|
182
|
+
* @export
|
|
183
|
+
* @class KeyValidationProblemDetails
|
|
184
|
+
*/
|
|
62
185
|
declare class KeyValidationProblemDetails extends ProblemDetails {
|
|
186
|
+
/**
|
|
187
|
+
* A collection of errors
|
|
188
|
+
* @type {Record<string, string[]>}
|
|
189
|
+
* @memberof KeyValidationProblemDetails
|
|
190
|
+
*/
|
|
63
191
|
errors: Record<string, string[]>;
|
|
64
192
|
constructor(response: ProblemDetails);
|
|
65
193
|
}
|
|
66
194
|
//#endregion
|
|
67
195
|
//#region src/exceptions/monocloud-key-validation-exception.d.ts
|
|
196
|
+
/**
|
|
197
|
+
* The MonoCloud Key Validation Exception
|
|
198
|
+
* @export
|
|
199
|
+
* @class MonoCloudKeyValidationException
|
|
200
|
+
*/
|
|
68
201
|
declare class MonoCloudKeyValidationException extends MonoCloudRequestException {
|
|
69
202
|
errors: Record<string, string[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Initializes the MonoCloudKeyValidationException Class
|
|
205
|
+
* @param response - The problem details returned from the server.
|
|
206
|
+
*/
|
|
70
207
|
constructor(response: KeyValidationProblemDetails);
|
|
71
208
|
}
|
|
72
209
|
//#endregion
|
|
73
210
|
//#region src/exceptions/monocloud-model-state-exception.d.ts
|
|
211
|
+
/**
|
|
212
|
+
* The MonoCloud Model State Exception
|
|
213
|
+
* @export
|
|
214
|
+
* @class MonoCloudModelStateException
|
|
215
|
+
*/
|
|
74
216
|
declare class MonoCloudModelStateException extends MonoCloudRequestException {
|
|
217
|
+
/**
|
|
218
|
+
* Initializes the MonoCloudModelStateException Class
|
|
219
|
+
* @param response - The problem details returned from the server.
|
|
220
|
+
*/
|
|
75
221
|
constructor(response: ProblemDetails);
|
|
222
|
+
/**
|
|
223
|
+
* Initializes the MonoCloudModelStateException Class
|
|
224
|
+
* @param message - The error message.
|
|
225
|
+
*/
|
|
76
226
|
constructor(message: string);
|
|
77
227
|
}
|
|
78
228
|
//#endregion
|
|
79
229
|
//#region src/exceptions/monocloud-not-found-exception.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* The MonoCloud Not Found Exception
|
|
232
|
+
* @export
|
|
233
|
+
* @class MonoCloudNotFoundException
|
|
234
|
+
*/
|
|
80
235
|
declare class MonoCloudNotFoundException extends MonoCloudRequestException {
|
|
236
|
+
/**
|
|
237
|
+
* Initializes the MonoCloudNotFoundException Class
|
|
238
|
+
* @param response - The problem details returned from the server.
|
|
239
|
+
*/
|
|
81
240
|
constructor(response: ProblemDetails);
|
|
241
|
+
/**
|
|
242
|
+
* Initializes the MonoCloudNotFoundException Class
|
|
243
|
+
* @param message - The error message.
|
|
244
|
+
*/
|
|
82
245
|
constructor(message: string);
|
|
83
246
|
}
|
|
84
247
|
//#endregion
|
|
85
248
|
//#region src/exceptions/monocloud-resource-exhausted-exception.d.ts
|
|
249
|
+
/**
|
|
250
|
+
* The MonoCloud Resource Exhausted Exception
|
|
251
|
+
* @export
|
|
252
|
+
* @class MonoCloudResourceExhaustedException
|
|
253
|
+
*/
|
|
86
254
|
declare class MonoCloudResourceExhaustedException extends MonoCloudRequestException {
|
|
255
|
+
/**
|
|
256
|
+
* Initializes the MonoCloudResourceExhaustedException Class
|
|
257
|
+
* @param response - The problem details returned from the server.
|
|
258
|
+
*/
|
|
87
259
|
constructor(response: ProblemDetails);
|
|
260
|
+
/**
|
|
261
|
+
* Initializes the MonoCloudResourceExhaustedException Class
|
|
262
|
+
* @param message - The error message.
|
|
263
|
+
*/
|
|
88
264
|
constructor(message: string);
|
|
89
265
|
}
|
|
90
266
|
//#endregion
|
|
91
267
|
//#region src/exceptions/monocloud-server-exception.d.ts
|
|
268
|
+
/**
|
|
269
|
+
* The MonoCloud Server Exception
|
|
270
|
+
* @export
|
|
271
|
+
* @class MonoCloudServerException
|
|
272
|
+
*/
|
|
92
273
|
declare class MonoCloudServerException extends MonoCloudRequestException {
|
|
274
|
+
/**
|
|
275
|
+
* Initializes the MonoCloudServerException Class
|
|
276
|
+
* @param response - The problem details returned from the server.
|
|
277
|
+
*/
|
|
93
278
|
constructor(response: ProblemDetails);
|
|
279
|
+
/**
|
|
280
|
+
* Initializes the MonoCloudServerException Class
|
|
281
|
+
* @param message - The error message.
|
|
282
|
+
*/
|
|
94
283
|
constructor(message: string);
|
|
95
284
|
}
|
|
96
285
|
//#endregion
|
|
97
286
|
//#region src/exceptions/monocloud-unauthorized-exception.d.ts
|
|
287
|
+
/**
|
|
288
|
+
* The MonoCloud Unauthorized Exception
|
|
289
|
+
* @export
|
|
290
|
+
* @class MonoCloudUnauthorizedException
|
|
291
|
+
*/
|
|
98
292
|
declare class MonoCloudUnauthorizedException extends MonoCloudRequestException {
|
|
293
|
+
/**
|
|
294
|
+
* Initializes the MonoCloudUnauthorizedException Class
|
|
295
|
+
* @param response - The problem details returned from the server.
|
|
296
|
+
*/
|
|
99
297
|
constructor(response: ProblemDetails);
|
|
298
|
+
/**
|
|
299
|
+
* Initializes the MonoCloudUnauthorizedException Class
|
|
300
|
+
* @param message - The error message.
|
|
301
|
+
*/
|
|
302
|
+
constructor(message: string);
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/exceptions/monocloud-payment-required-exception.d.ts
|
|
306
|
+
/**
|
|
307
|
+
* The MonoCloud Payment Required Exception
|
|
308
|
+
* @export
|
|
309
|
+
* @class MonoCloudPaymentRequiredException
|
|
310
|
+
*/
|
|
311
|
+
declare class MonoCloudPaymentRequiredException extends MonoCloudRequestException {
|
|
312
|
+
/**
|
|
313
|
+
* Initializes the MonoCloudPaymentRequiredException Class
|
|
314
|
+
* @param response - The problem details returned from the server.
|
|
315
|
+
*/
|
|
316
|
+
constructor(response: ProblemDetails);
|
|
317
|
+
/**
|
|
318
|
+
* Initializes the MonoCloudPaymentRequiredException Class
|
|
319
|
+
* @param message - The error message.
|
|
320
|
+
*/
|
|
100
321
|
constructor(message: string);
|
|
101
322
|
}
|
|
102
323
|
//#endregion
|
|
@@ -118,11 +339,41 @@ declare class MonoCloudResponse<TResult = unknown> {
|
|
|
118
339
|
}
|
|
119
340
|
//#endregion
|
|
120
341
|
//#region src/models/page-model.d.ts
|
|
342
|
+
/**
|
|
343
|
+
* The Page Model
|
|
344
|
+
* @export
|
|
345
|
+
* @interface PageModel
|
|
346
|
+
*/
|
|
121
347
|
interface PageModel {
|
|
348
|
+
/**
|
|
349
|
+
* Page Size
|
|
350
|
+
* @type {number}
|
|
351
|
+
* @memberof PageModel
|
|
352
|
+
*/
|
|
122
353
|
page_size: number;
|
|
354
|
+
/**
|
|
355
|
+
* Current Page
|
|
356
|
+
* @type {number}
|
|
357
|
+
* @memberof PageModel
|
|
358
|
+
*/
|
|
123
359
|
current_page: number;
|
|
360
|
+
/**
|
|
361
|
+
* Total Number of Items
|
|
362
|
+
* @type {number}
|
|
363
|
+
* @memberof PageModel
|
|
364
|
+
*/
|
|
124
365
|
total_count: number;
|
|
366
|
+
/**
|
|
367
|
+
* Specfies whether there is a previous page
|
|
368
|
+
* @type {boolean}
|
|
369
|
+
* @memberof PageModel
|
|
370
|
+
*/
|
|
125
371
|
has_previous: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Specfies whether there is a next page
|
|
374
|
+
* @type {boolean}
|
|
375
|
+
* @memberof PageModel
|
|
376
|
+
*/
|
|
126
377
|
has_next: boolean;
|
|
127
378
|
}
|
|
128
379
|
//#endregion
|
|
@@ -141,7 +392,7 @@ interface MonoCloudRequest {
|
|
|
141
392
|
}
|
|
142
393
|
//#endregion
|
|
143
394
|
//#region src/models/fetcher.d.ts
|
|
144
|
-
type Fetcher = (input: string | URL
|
|
395
|
+
type Fetcher = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
145
396
|
//#endregion
|
|
146
397
|
//#region src/base/monocloud-client-base.d.ts
|
|
147
398
|
declare abstract class MonoCloudClientBase {
|
|
@@ -155,5 +406,5 @@ declare abstract class MonoCloudClientBase {
|
|
|
155
406
|
private buildUrl;
|
|
156
407
|
}
|
|
157
408
|
//#endregion
|
|
158
|
-
export { type
|
|
409
|
+
export { type Fetcher, type IdentityError, IdentityValidationProblemDetails, KeyValidationProblemDetails, MonoCloudBadRequestException, MonoCloudClientBase, type MonoCloudConfig, MonoCloudConflictException, MonoCloudException, MonoCloudForbiddenException, MonoCloudIdentityValidationException, MonoCloudKeyValidationException, MonoCloudModelStateException, MonoCloudNotFoundException, MonoCloudPageResponse, MonoCloudPaymentRequiredException, type MonoCloudRequest, MonoCloudRequestException, MonoCloudResourceExhaustedException, MonoCloudResponse, MonoCloudServerException, MonoCloudUnauthorizedException, ProblemDetails };
|
|
159
410
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
//#region src/exceptions/monocloud-exception.ts
|
|
2
|
+
/**
|
|
3
|
+
* The MonoCloud Exception
|
|
4
|
+
* @export
|
|
5
|
+
* @class MonoCloudException
|
|
6
|
+
*/
|
|
2
7
|
var MonoCloudException = class extends Error {};
|
|
3
8
|
|
|
4
9
|
//#endregion
|
|
@@ -23,6 +28,11 @@ var MonoCloudRequestException = class extends MonoCloudException {
|
|
|
23
28
|
|
|
24
29
|
//#endregion
|
|
25
30
|
//#region src/exceptions/monocloud-bad-request-exception.ts
|
|
31
|
+
/**
|
|
32
|
+
* The MonoCloud Bad Request Exception
|
|
33
|
+
* @export
|
|
34
|
+
* @class MonoCloudBadRequestException
|
|
35
|
+
*/
|
|
26
36
|
var MonoCloudBadRequestException = class extends MonoCloudRequestException {
|
|
27
37
|
constructor(arg) {
|
|
28
38
|
if (typeof arg === "string") super(arg);
|
|
@@ -32,6 +42,11 @@ var MonoCloudBadRequestException = class extends MonoCloudRequestException {
|
|
|
32
42
|
|
|
33
43
|
//#endregion
|
|
34
44
|
//#region src/exceptions/monocloud-conflict-exception.ts
|
|
45
|
+
/**
|
|
46
|
+
* The MonoCloud Conflict Exception
|
|
47
|
+
* @export
|
|
48
|
+
* @class MonoCloudConflictException
|
|
49
|
+
*/
|
|
35
50
|
var MonoCloudConflictException = class extends MonoCloudRequestException {
|
|
36
51
|
constructor(arg) {
|
|
37
52
|
if (typeof arg === "string") super(arg);
|
|
@@ -40,8 +55,17 @@ var MonoCloudConflictException = class extends MonoCloudRequestException {
|
|
|
40
55
|
};
|
|
41
56
|
|
|
42
57
|
//#endregion
|
|
43
|
-
//#region src/exceptions/monocloud-
|
|
44
|
-
|
|
58
|
+
//#region src/exceptions/monocloud-identity-validation-exception.ts
|
|
59
|
+
/**
|
|
60
|
+
* The MonoCloud Identity Validation Exception
|
|
61
|
+
* @export
|
|
62
|
+
* @class MonoCloudIdentityValidationException
|
|
63
|
+
*/
|
|
64
|
+
var MonoCloudIdentityValidationException = class extends MonoCloudRequestException {
|
|
65
|
+
/**
|
|
66
|
+
* Initializes the MonoCloudIdentityValidationException Class
|
|
67
|
+
* @param response - The problem details returned from the server.
|
|
68
|
+
*/
|
|
45
69
|
constructor(response) {
|
|
46
70
|
super(response, `${response.title} : ${JSON.stringify(response.errors, void 0, 2)}`);
|
|
47
71
|
this.errors = response.errors;
|
|
@@ -50,6 +74,11 @@ var MonoCloudErrorCodeValidationException = class extends MonoCloudRequestExcept
|
|
|
50
74
|
|
|
51
75
|
//#endregion
|
|
52
76
|
//#region src/exceptions/monocloud-forbidden-exception.ts
|
|
77
|
+
/**
|
|
78
|
+
* The MonoCloud Forbidden Exception
|
|
79
|
+
* @export
|
|
80
|
+
* @class MonoCloudForbiddenException
|
|
81
|
+
*/
|
|
53
82
|
var MonoCloudForbiddenException = class extends MonoCloudRequestException {
|
|
54
83
|
constructor(arg) {
|
|
55
84
|
if (typeof arg === "string") super(arg);
|
|
@@ -59,7 +88,16 @@ var MonoCloudForbiddenException = class extends MonoCloudRequestException {
|
|
|
59
88
|
|
|
60
89
|
//#endregion
|
|
61
90
|
//#region src/exceptions/monocloud-key-validation-exception.ts
|
|
91
|
+
/**
|
|
92
|
+
* The MonoCloud Key Validation Exception
|
|
93
|
+
* @export
|
|
94
|
+
* @class MonoCloudKeyValidationException
|
|
95
|
+
*/
|
|
62
96
|
var MonoCloudKeyValidationException = class extends MonoCloudRequestException {
|
|
97
|
+
/**
|
|
98
|
+
* Initializes the MonoCloudKeyValidationException Class
|
|
99
|
+
* @param response - The problem details returned from the server.
|
|
100
|
+
*/
|
|
63
101
|
constructor(response) {
|
|
64
102
|
super(response, `${response.title} : ${JSON.stringify(response.errors, void 0, 2)}`);
|
|
65
103
|
this.errors = response.errors;
|
|
@@ -68,6 +106,11 @@ var MonoCloudKeyValidationException = class extends MonoCloudRequestException {
|
|
|
68
106
|
|
|
69
107
|
//#endregion
|
|
70
108
|
//#region src/exceptions/monocloud-model-state-exception.ts
|
|
109
|
+
/**
|
|
110
|
+
* The MonoCloud Model State Exception
|
|
111
|
+
* @export
|
|
112
|
+
* @class MonoCloudModelStateException
|
|
113
|
+
*/
|
|
71
114
|
var MonoCloudModelStateException = class extends MonoCloudRequestException {
|
|
72
115
|
constructor(arg) {
|
|
73
116
|
if (typeof arg === "string") super(arg);
|
|
@@ -77,6 +120,11 @@ var MonoCloudModelStateException = class extends MonoCloudRequestException {
|
|
|
77
120
|
|
|
78
121
|
//#endregion
|
|
79
122
|
//#region src/exceptions/monocloud-not-found-exception.ts
|
|
123
|
+
/**
|
|
124
|
+
* The MonoCloud Not Found Exception
|
|
125
|
+
* @export
|
|
126
|
+
* @class MonoCloudNotFoundException
|
|
127
|
+
*/
|
|
80
128
|
var MonoCloudNotFoundException = class extends MonoCloudRequestException {
|
|
81
129
|
constructor(arg) {
|
|
82
130
|
if (typeof arg === "string") super(arg);
|
|
@@ -86,6 +134,11 @@ var MonoCloudNotFoundException = class extends MonoCloudRequestException {
|
|
|
86
134
|
|
|
87
135
|
//#endregion
|
|
88
136
|
//#region src/exceptions/monocloud-resource-exhausted-exception.ts
|
|
137
|
+
/**
|
|
138
|
+
* The MonoCloud Resource Exhausted Exception
|
|
139
|
+
* @export
|
|
140
|
+
* @class MonoCloudResourceExhaustedException
|
|
141
|
+
*/
|
|
89
142
|
var MonoCloudResourceExhaustedException = class extends MonoCloudRequestException {
|
|
90
143
|
constructor(arg) {
|
|
91
144
|
if (typeof arg === "string") super(arg);
|
|
@@ -95,6 +148,11 @@ var MonoCloudResourceExhaustedException = class extends MonoCloudRequestExceptio
|
|
|
95
148
|
|
|
96
149
|
//#endregion
|
|
97
150
|
//#region src/exceptions/monocloud-server-exception.ts
|
|
151
|
+
/**
|
|
152
|
+
* The MonoCloud Server Exception
|
|
153
|
+
* @export
|
|
154
|
+
* @class MonoCloudServerException
|
|
155
|
+
*/
|
|
98
156
|
var MonoCloudServerException = class extends MonoCloudRequestException {
|
|
99
157
|
constructor(arg) {
|
|
100
158
|
if (typeof arg === "string") super(arg);
|
|
@@ -104,6 +162,11 @@ var MonoCloudServerException = class extends MonoCloudRequestException {
|
|
|
104
162
|
|
|
105
163
|
//#endregion
|
|
106
164
|
//#region src/exceptions/monocloud-unauthorized-exception.ts
|
|
165
|
+
/**
|
|
166
|
+
* The MonoCloud Unauthorized Exception
|
|
167
|
+
* @export
|
|
168
|
+
* @class MonoCloudUnauthorizedException
|
|
169
|
+
*/
|
|
107
170
|
var MonoCloudUnauthorizedException = class extends MonoCloudRequestException {
|
|
108
171
|
constructor(arg) {
|
|
109
172
|
if (typeof arg === "string") super(arg);
|
|
@@ -112,17 +175,40 @@ var MonoCloudUnauthorizedException = class extends MonoCloudRequestException {
|
|
|
112
175
|
};
|
|
113
176
|
|
|
114
177
|
//#endregion
|
|
115
|
-
//#region src/
|
|
116
|
-
|
|
117
|
-
|
|
178
|
+
//#region src/exceptions/monocloud-payment-required-exception.ts
|
|
179
|
+
/**
|
|
180
|
+
* The MonoCloud Payment Required Exception
|
|
181
|
+
* @export
|
|
182
|
+
* @class MonoCloudPaymentRequiredException
|
|
183
|
+
*/
|
|
184
|
+
var MonoCloudPaymentRequiredException = class extends MonoCloudRequestException {
|
|
185
|
+
constructor(arg) {
|
|
186
|
+
if (typeof arg === "string") super(arg);
|
|
187
|
+
else super(arg);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/models/identity-error.ts
|
|
193
|
+
/**
|
|
194
|
+
* Identity Error: Represents a validation or processing error returned by the identity system.
|
|
195
|
+
* @export
|
|
196
|
+
* @class IdentityError
|
|
197
|
+
*/
|
|
198
|
+
var IdentityError = class {
|
|
199
|
+
constructor(code, description) {
|
|
118
200
|
this.code = code;
|
|
119
201
|
this.description = description;
|
|
120
|
-
this.field = field;
|
|
121
202
|
}
|
|
122
203
|
};
|
|
123
204
|
|
|
124
205
|
//#endregion
|
|
125
206
|
//#region src/models/problem-details.ts
|
|
207
|
+
/**
|
|
208
|
+
* The Problem Details
|
|
209
|
+
* @export
|
|
210
|
+
* @class ProblemDetails
|
|
211
|
+
*/
|
|
126
212
|
var ProblemDetails = class {
|
|
127
213
|
constructor(response) {
|
|
128
214
|
this.type = response.type;
|
|
@@ -137,16 +223,21 @@ var ProblemDetails = class {
|
|
|
137
223
|
};
|
|
138
224
|
|
|
139
225
|
//#endregion
|
|
140
|
-
//#region src/models/
|
|
141
|
-
var
|
|
226
|
+
//#region src/models/identity-validation-problem-details.ts
|
|
227
|
+
var IdentityValidationProblemDetails = class extends ProblemDetails {
|
|
142
228
|
constructor(response) {
|
|
143
229
|
super(response);
|
|
144
|
-
this.errors = response.errors.map((err) => new
|
|
230
|
+
this.errors = response.errors.map((err) => new IdentityError(err.code, err.description));
|
|
145
231
|
}
|
|
146
232
|
};
|
|
147
233
|
|
|
148
234
|
//#endregion
|
|
149
235
|
//#region src/models/key-validation-problem-details.ts
|
|
236
|
+
/**
|
|
237
|
+
* The Key Validation Problem Details
|
|
238
|
+
* @export
|
|
239
|
+
* @class KeyValidationProblemDetails
|
|
240
|
+
*/
|
|
150
241
|
var KeyValidationProblemDetails = class extends ProblemDetails {
|
|
151
242
|
constructor(response) {
|
|
152
243
|
super(response);
|
|
@@ -182,16 +273,26 @@ const ValidationExceptionTypes = {
|
|
|
182
273
|
|
|
183
274
|
//#endregion
|
|
184
275
|
//#region src/exceptions/monocloud-exception-handler.ts
|
|
276
|
+
/**
|
|
277
|
+
* The MonoCloud Exception Handler
|
|
278
|
+
* @export
|
|
279
|
+
* @class MonoCloudExceptionHandler
|
|
280
|
+
*/
|
|
185
281
|
var MonoCloudExceptionHandler = class {
|
|
282
|
+
/**
|
|
283
|
+
* Converts the Problem Details returned from the server into an exception
|
|
284
|
+
* @param problemDetails - The problem details returned from the server.
|
|
285
|
+
*/
|
|
186
286
|
static ThrowProblemErr(problemDetails) {
|
|
187
287
|
switch (problemDetails.status) {
|
|
188
288
|
case 400: throw new MonoCloudBadRequestException(problemDetails);
|
|
189
289
|
case 401: throw new MonoCloudUnauthorizedException(problemDetails);
|
|
290
|
+
case 402: throw new MonoCloudPaymentRequiredException(problemDetails);
|
|
190
291
|
case 403: throw new MonoCloudUnauthorizedException(problemDetails);
|
|
191
292
|
case 404: throw new MonoCloudNotFoundException(problemDetails);
|
|
192
293
|
case 409: throw new MonoCloudConflictException(problemDetails);
|
|
193
294
|
case 422:
|
|
194
|
-
if (problemDetails instanceof
|
|
295
|
+
if (problemDetails instanceof IdentityValidationProblemDetails) throw new MonoCloudIdentityValidationException(problemDetails);
|
|
195
296
|
if (problemDetails instanceof KeyValidationProblemDetails) throw new MonoCloudKeyValidationException(problemDetails);
|
|
196
297
|
throw new MonoCloudModelStateException(problemDetails);
|
|
197
298
|
case 429: throw new MonoCloudResourceExhaustedException(problemDetails);
|
|
@@ -201,10 +302,16 @@ var MonoCloudExceptionHandler = class {
|
|
|
201
302
|
throw new MonoCloudException((_problemDetails$title = problemDetails.title) !== null && _problemDetails$title !== void 0 ? _problemDetails$title : "An Unknown Error Occured");
|
|
202
303
|
}
|
|
203
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Converts the error returned from the server into an exception
|
|
307
|
+
* @param statusCode - The response status code.
|
|
308
|
+
* @param message - The error message returned from the server.
|
|
309
|
+
*/
|
|
204
310
|
static ThrowErr(statusCode, message) {
|
|
205
311
|
switch (statusCode) {
|
|
206
312
|
case 400: throw new MonoCloudBadRequestException(message !== null && message !== void 0 ? message : "Bad Request");
|
|
207
313
|
case 401: throw new MonoCloudUnauthorizedException(message !== null && message !== void 0 ? message : "Unauthorized");
|
|
314
|
+
case 402: throw new MonoCloudPaymentRequiredException(message !== null && message !== void 0 ? message : "Payment Required");
|
|
208
315
|
case 403: throw new MonoCloudUnauthorizedException(message !== null && message !== void 0 ? message : "Forbidden");
|
|
209
316
|
case 404: throw new MonoCloudNotFoundException(message !== null && message !== void 0 ? message : "Not Found");
|
|
210
317
|
case 409: throw new MonoCloudConflictException(message !== null && message !== void 0 ? message : "Conflict");
|
|
@@ -288,7 +395,7 @@ var MonoCloudClientBase = class {
|
|
|
288
395
|
if (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith("application/problem+json")) {
|
|
289
396
|
const body = await response.json();
|
|
290
397
|
let result = body ? new ProblemDetails(body) : void 0;
|
|
291
|
-
if ((result === null || result === void 0 ? void 0 : result.type) === ValidationExceptionTypes.IdentityValidationError) result = new
|
|
398
|
+
if ((result === null || result === void 0 ? void 0 : result.type) === ValidationExceptionTypes.IdentityValidationError) result = new IdentityValidationProblemDetails(result);
|
|
292
399
|
if ((result === null || result === void 0 ? void 0 : result.type) === ValidationExceptionTypes.ValidationError) result = new KeyValidationProblemDetails(result);
|
|
293
400
|
if (!result) throw new MonoCloudException("Invalid body");
|
|
294
401
|
MonoCloudExceptionHandler.ThrowProblemErr(result);
|
|
@@ -328,5 +435,5 @@ var MonoCloudClientBase = class {
|
|
|
328
435
|
};
|
|
329
436
|
|
|
330
437
|
//#endregion
|
|
331
|
-
export {
|
|
438
|
+
export { IdentityValidationProblemDetails, KeyValidationProblemDetails, MonoCloudBadRequestException, MonoCloudClientBase, MonoCloudConflictException, MonoCloudException, MonoCloudForbiddenException, MonoCloudIdentityValidationException, MonoCloudKeyValidationException, MonoCloudModelStateException, MonoCloudNotFoundException, MonoCloudPageResponse, MonoCloudPaymentRequiredException, MonoCloudRequestException, MonoCloudResourceExhaustedException, MonoCloudResponse, MonoCloudServerException, MonoCloudUnauthorizedException, ProblemDetails };
|
|
332
439
|
//# sourceMappingURL=index.mjs.map
|