@opra/common 0.33.9 → 0.33.11
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/browser.js +66 -62
- package/cjs/document/resource/storage-decorator.js +4 -0
- package/cjs/exception/http-errors/forbidden.error.js +1 -1
- package/cjs/exception/resource-errors/resource-not.available.error.js +1 -1
- package/cjs/http/enums/http-status-codes.enum.js +60 -60
- package/esm/document/resource/storage-decorator.js +4 -0
- package/esm/exception/http-errors/forbidden.error.js +2 -2
- package/esm/exception/resource-errors/resource-not.available.error.js +2 -2
- package/esm/http/enums/http-status-codes.enum.js +59 -59
- package/package.json +3 -3
- package/types/document/resource/storage-decorator.d.ts +9 -7
- package/types/exception/http-errors/forbidden.error.d.ts +2 -2
- package/types/http/enums/http-status-codes.enum.d.ts +1 -1
- package/types/schema/resource/storage.interface.d.ts +2 -0
package/browser.js
CHANGED
|
@@ -1220,65 +1220,65 @@ var HttpHeaderCodes;
|
|
|
1220
1220
|
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
1221
1221
|
|
|
1222
1222
|
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
1223
|
-
var
|
|
1224
|
-
(function(
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
})(
|
|
1223
|
+
var HttpStatusCode;
|
|
1224
|
+
(function(HttpStatusCode2) {
|
|
1225
|
+
HttpStatusCode2[HttpStatusCode2["CONTINUE"] = 100] = "CONTINUE";
|
|
1226
|
+
HttpStatusCode2[HttpStatusCode2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
1227
|
+
HttpStatusCode2[HttpStatusCode2["PROCESSING"] = 102] = "PROCESSING";
|
|
1228
|
+
HttpStatusCode2[HttpStatusCode2["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
1229
|
+
HttpStatusCode2[HttpStatusCode2["OK"] = 200] = "OK";
|
|
1230
|
+
HttpStatusCode2[HttpStatusCode2["CREATED"] = 201] = "CREATED";
|
|
1231
|
+
HttpStatusCode2[HttpStatusCode2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
1232
|
+
HttpStatusCode2[HttpStatusCode2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
1233
|
+
HttpStatusCode2[HttpStatusCode2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
1234
|
+
HttpStatusCode2[HttpStatusCode2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
1235
|
+
HttpStatusCode2[HttpStatusCode2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
1236
|
+
HttpStatusCode2[HttpStatusCode2["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
1237
|
+
HttpStatusCode2[HttpStatusCode2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
1238
|
+
HttpStatusCode2[HttpStatusCode2["FOUND"] = 302] = "FOUND";
|
|
1239
|
+
HttpStatusCode2[HttpStatusCode2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
1240
|
+
HttpStatusCode2[HttpStatusCode2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
1241
|
+
HttpStatusCode2[HttpStatusCode2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
1242
|
+
HttpStatusCode2[HttpStatusCode2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
1243
|
+
HttpStatusCode2[HttpStatusCode2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
1244
|
+
HttpStatusCode2[HttpStatusCode2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
1245
|
+
HttpStatusCode2[HttpStatusCode2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
1246
|
+
HttpStatusCode2[HttpStatusCode2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
1247
|
+
HttpStatusCode2[HttpStatusCode2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
1248
|
+
HttpStatusCode2[HttpStatusCode2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
1249
|
+
HttpStatusCode2[HttpStatusCode2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
1250
|
+
HttpStatusCode2[HttpStatusCode2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
1251
|
+
HttpStatusCode2[HttpStatusCode2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
1252
|
+
HttpStatusCode2[HttpStatusCode2["CONFLICT"] = 409] = "CONFLICT";
|
|
1253
|
+
HttpStatusCode2[HttpStatusCode2["GONE"] = 410] = "GONE";
|
|
1254
|
+
HttpStatusCode2[HttpStatusCode2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
1255
|
+
HttpStatusCode2[HttpStatusCode2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
1256
|
+
HttpStatusCode2[HttpStatusCode2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
1257
|
+
HttpStatusCode2[HttpStatusCode2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
1258
|
+
HttpStatusCode2[HttpStatusCode2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
1259
|
+
HttpStatusCode2[HttpStatusCode2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
1260
|
+
HttpStatusCode2[HttpStatusCode2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
1261
|
+
HttpStatusCode2[HttpStatusCode2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
1262
|
+
HttpStatusCode2[HttpStatusCode2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
1263
|
+
HttpStatusCode2[HttpStatusCode2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
1264
|
+
HttpStatusCode2[HttpStatusCode2["LOCKED"] = 423] = "LOCKED";
|
|
1265
|
+
HttpStatusCode2[HttpStatusCode2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
1266
|
+
HttpStatusCode2[HttpStatusCode2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
1267
|
+
HttpStatusCode2[HttpStatusCode2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
1268
|
+
HttpStatusCode2[HttpStatusCode2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
1269
|
+
HttpStatusCode2[HttpStatusCode2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
1270
|
+
HttpStatusCode2[HttpStatusCode2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
1271
|
+
HttpStatusCode2[HttpStatusCode2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
1272
|
+
HttpStatusCode2[HttpStatusCode2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
1273
|
+
HttpStatusCode2[HttpStatusCode2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
1274
|
+
HttpStatusCode2[HttpStatusCode2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
1275
|
+
HttpStatusCode2[HttpStatusCode2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
1276
|
+
HttpStatusCode2[HttpStatusCode2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
1277
|
+
HttpStatusCode2[HttpStatusCode2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
1278
|
+
HttpStatusCode2[HttpStatusCode2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
1279
|
+
HttpStatusCode2[HttpStatusCode2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
1280
|
+
HttpStatusCode2[HttpStatusCode2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
1281
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
1282
1282
|
|
|
1283
1283
|
// ../../build/common/esm/http/enums/http-status-messages.js
|
|
1284
1284
|
var HttpStatusMessages = {
|
|
@@ -1354,7 +1354,7 @@ var ForbiddenError = class extends OpraException {
|
|
|
1354
1354
|
}
|
|
1355
1355
|
constructor() {
|
|
1356
1356
|
super(...arguments);
|
|
1357
|
-
this.status =
|
|
1357
|
+
this.status = HttpStatusCode.FORBIDDEN;
|
|
1358
1358
|
}
|
|
1359
1359
|
init(issue) {
|
|
1360
1360
|
super.init({
|
|
@@ -1593,7 +1593,7 @@ var ResourceNotAvailableError = class extends OpraException {
|
|
|
1593
1593
|
resource,
|
|
1594
1594
|
key: keyValue
|
|
1595
1595
|
}
|
|
1596
|
-
}, cause,
|
|
1596
|
+
}, cause, HttpStatusCode.UNPROCESSABLE_ENTITY);
|
|
1597
1597
|
}
|
|
1598
1598
|
};
|
|
1599
1599
|
|
|
@@ -11938,6 +11938,10 @@ Object.assign(StorageDecorator, ResourceDecorator);
|
|
|
11938
11938
|
list.push((operationMeta) => operationMeta.options.minFileSize = sizeInBytes);
|
|
11939
11939
|
return decorator;
|
|
11940
11940
|
};
|
|
11941
|
+
decorator.Returns = (t) => {
|
|
11942
|
+
list.push((operationMeta) => operationMeta.returnType = t);
|
|
11943
|
+
return decorator;
|
|
11944
|
+
};
|
|
11941
11945
|
return decorator;
|
|
11942
11946
|
}
|
|
11943
11947
|
__name(Post, "Post");
|
|
@@ -12277,7 +12281,7 @@ export {
|
|
|
12277
12281
|
FailedDependencyError,
|
|
12278
12282
|
ForbiddenError,
|
|
12279
12283
|
HttpHeaderCodes,
|
|
12280
|
-
|
|
12284
|
+
HttpStatusCode,
|
|
12281
12285
|
HttpStatusMessages,
|
|
12282
12286
|
I18n,
|
|
12283
12287
|
InternalServerError,
|
|
@@ -60,6 +60,10 @@ Object.assign(StorageDecorator, resource_decorator_js_1.ResourceDecorator);
|
|
|
60
60
|
list.push(operationMeta => operationMeta.options.minFileSize = sizeInBytes);
|
|
61
61
|
return decorator;
|
|
62
62
|
};
|
|
63
|
+
decorator.Returns = (t) => {
|
|
64
|
+
list.push(operationMeta => operationMeta.returnType = t);
|
|
65
|
+
return decorator;
|
|
66
|
+
};
|
|
63
67
|
return decorator;
|
|
64
68
|
}
|
|
65
69
|
StorageDecorator.Post = Post;
|
|
@@ -13,7 +13,7 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
13
13
|
class ForbiddenError extends opra_exception_js_1.OpraException {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
-
this.status = index_js_1.
|
|
16
|
+
this.status = index_js_1.HttpStatusCode.FORBIDDEN;
|
|
17
17
|
}
|
|
18
18
|
init(issue) {
|
|
19
19
|
super.init({
|
|
@@ -18,7 +18,7 @@ class ResourceNotAvailableError extends opra_exception_js_1.OpraException {
|
|
|
18
18
|
resource,
|
|
19
19
|
key: keyValue
|
|
20
20
|
}
|
|
21
|
-
}, cause, index_js_1.
|
|
21
|
+
}, cause, index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
exports.ResourceNotAvailableError = ResourceNotAvailableError;
|
|
@@ -1,131 +1,131 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// noinspection JSUnusedGlobalSymbols
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.HttpStatusCode = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
(function (
|
|
8
|
+
var HttpStatusCode;
|
|
9
|
+
(function (HttpStatusCode) {
|
|
10
10
|
/* *** Information responses *** */
|
|
11
11
|
/**
|
|
12
12
|
* This interim response indicates that the client should continue the request or
|
|
13
13
|
* ignore the response if the request is already finished.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
HttpStatusCode[HttpStatusCode["CONTINUE"] = 100] = "CONTINUE";
|
|
16
16
|
/**
|
|
17
17
|
* This code is sent in response to an Upgrade request header from the client and
|
|
18
18
|
* indicates the protocol the server is switching to.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
HttpStatusCode[HttpStatusCode["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
21
21
|
/**
|
|
22
22
|
* This code indicates that the server has received and is processing the request, but no response is available yet.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
HttpStatusCode[HttpStatusCode["PROCESSING"] = 102] = "PROCESSING";
|
|
25
25
|
/**
|
|
26
26
|
* This status code is primarily intended to be used with the Link header, letting the user agent
|
|
27
27
|
* start preloading resources while the server prepares a response.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
HttpStatusCode[HttpStatusCode["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
30
30
|
/* *** Successful responses *** */
|
|
31
31
|
/**
|
|
32
32
|
* The request succeeded.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
|
|
35
35
|
/**
|
|
36
36
|
* The request succeeded, and a new resource was created as a result.
|
|
37
37
|
* This is typically the response sent after POST requests, or some PUT requests.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
HttpStatusCode[HttpStatusCode["CREATED"] = 201] = "CREATED";
|
|
40
40
|
/**
|
|
41
41
|
* The request has been received but not yet acted upon. It is noncommittal,
|
|
42
42
|
* since there is no way in HTTP to later send an asynchronous response indicating
|
|
43
43
|
* the outcome of the request. It is intended for cases where another process or
|
|
44
44
|
* server handles the request, or for batch processing.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
HttpStatusCode[HttpStatusCode["ACCEPTED"] = 202] = "ACCEPTED";
|
|
47
47
|
/**
|
|
48
48
|
* This response code means the returned metadata is not exactly the same as is available from
|
|
49
49
|
* the origin server, but is collected from a local or a third-party copy. This is mostly used
|
|
50
50
|
* for mirrors or backups of another resource. Except for that specific case, the 200 OK
|
|
51
51
|
* response is preferred to this status.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
HttpStatusCode[HttpStatusCode["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
54
54
|
/**
|
|
55
55
|
* There is no content to send for this request, but the headers may be useful.
|
|
56
56
|
* The user agent may update its cached headers for this resource with the new ones.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
HttpStatusCode[HttpStatusCode["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
59
59
|
/**
|
|
60
60
|
* Tells the user agent to reset the document which sent this request.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
HttpStatusCode[HttpStatusCode["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
63
63
|
/**
|
|
64
64
|
* This response code is used when the Range header is sent from the client to request only part of a resource.
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
HttpStatusCode[HttpStatusCode["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
67
67
|
/* *** Redirection messages *** */
|
|
68
68
|
/**
|
|
69
69
|
* The request has more than one possible response. The user agent or user should choose one of them.
|
|
70
70
|
* (There is no standardized way of choosing one of the responses, but HTML links to the possibilities
|
|
71
71
|
* are recommended so the user can pick.)
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
HttpStatusCode[HttpStatusCode["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
74
74
|
/**
|
|
75
75
|
* The URL of the requested resource has been changed permanently. The new URL is given in the response.
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
HttpStatusCode[HttpStatusCode["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
78
78
|
/**
|
|
79
79
|
* This response code means that the URI of requested resource has been changed temporarily.
|
|
80
80
|
* Further changes in the URI might be made in the future. Therefore, this same URI should
|
|
81
81
|
* be used by the client in future requests.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
HttpStatusCode[HttpStatusCode["FOUND"] = 302] = "FOUND";
|
|
84
84
|
/**
|
|
85
85
|
* This is used for caching purposes. It tells the client that the response has not been modified,
|
|
86
86
|
* so the client can continue to use the same cached version of the response.
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
HttpStatusCode[HttpStatusCode["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
89
89
|
/**
|
|
90
90
|
*
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
HttpStatusCode[HttpStatusCode["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
93
93
|
/**
|
|
94
94
|
* The server sends this response to direct the client to get the requested resource at another
|
|
95
95
|
* URI with same method that was used in the prior request. This has the same semantics as
|
|
96
96
|
* the 302 Found HTTP response code, with the exception that the user agent must not change
|
|
97
97
|
* the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
|
|
98
98
|
*/
|
|
99
|
-
|
|
99
|
+
HttpStatusCode[HttpStatusCode["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
100
100
|
/**
|
|
101
101
|
* This means that the resource is now permanently located at another URI, specified by the Location:
|
|
102
102
|
* HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code,
|
|
103
103
|
* with the exception that the user agent must not change the HTTP method used: if a POST was used
|
|
104
104
|
* in the first request, a POST must be used in the second request.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
HttpStatusCode[HttpStatusCode["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
107
107
|
/* *** Client error responses *** */
|
|
108
108
|
/**
|
|
109
109
|
* The server cannot or will not process the request due to something that is perceived to be a client error
|
|
110
110
|
* (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
HttpStatusCode[HttpStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
113
113
|
/**
|
|
114
114
|
* Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated".
|
|
115
115
|
* That is, the client must authenticate itself to get the requested response.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
HttpStatusCode[HttpStatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
118
118
|
/**
|
|
119
119
|
* This response code is reserved for future use. The initial aim for creating this code was using
|
|
120
120
|
* it for digital payment systems, however this status code is used very rarely and no standard convention exists.
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
HttpStatusCode[HttpStatusCode["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
123
123
|
/**
|
|
124
124
|
* The client does not have access rights to the content; that is, it is unauthorized,
|
|
125
125
|
* so the server is refusing to give the requested resource. Unlike 401 Unauthorized,
|
|
126
126
|
* the client's identity is known to the server.
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
HttpStatusCode[HttpStatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
129
129
|
/**
|
|
130
130
|
* The server can not find the requested resource. In the browser, this means the URL is not recognized.
|
|
131
131
|
* In an API, this can also mean that the endpoint is valid but the resource itself does not exist.
|
|
@@ -133,21 +133,21 @@ var HttpStatusCodes;
|
|
|
133
133
|
* from an unauthorized client. This response code is probably the most well known due to its
|
|
134
134
|
* frequent occurrence on the web.
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
HttpStatusCode[HttpStatusCode["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
137
137
|
/**
|
|
138
138
|
* The request method is known by the server but is not supported by the target resource.
|
|
139
139
|
* For example, an API may not allow calling DELETE to remove a resource.
|
|
140
140
|
*/
|
|
141
|
-
|
|
141
|
+
HttpStatusCode[HttpStatusCode["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
142
142
|
/**
|
|
143
143
|
* This response is sent when the web server, after performing server-driven content negotiation,
|
|
144
144
|
* doesn't find any content that conforms to the criteria given by the user agent.
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
HttpStatusCode[HttpStatusCode["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
147
147
|
/**
|
|
148
148
|
* This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.
|
|
149
149
|
*/
|
|
150
|
-
|
|
150
|
+
HttpStatusCode[HttpStatusCode["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
151
151
|
/**
|
|
152
152
|
* This response is sent on an idle connection by some servers, even without any previous request by the client.
|
|
153
153
|
* It means that the server would like to shut down this unused connection.
|
|
@@ -155,107 +155,107 @@ var HttpStatusCodes;
|
|
|
155
155
|
* like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing.
|
|
156
156
|
* Also note that some servers merely shut down the connection without sending this message.
|
|
157
157
|
*/
|
|
158
|
-
|
|
158
|
+
HttpStatusCode[HttpStatusCode["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
159
159
|
/**
|
|
160
160
|
* This response is sent when a request conflicts with the current state of the server.
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
HttpStatusCode[HttpStatusCode["CONFLICT"] = 409] = "CONFLICT";
|
|
163
163
|
/**
|
|
164
164
|
* This response is sent when the requested content has been permanently deleted from server,
|
|
165
165
|
* with no forwarding address. Clients are expected to remove their caches and links to the resource.
|
|
166
166
|
* The HTTP specification intends this status code to be used for "limited-time, promotional services".
|
|
167
167
|
* APIs should not feel compelled to indicate resources that have been deleted with this status code.
|
|
168
168
|
*/
|
|
169
|
-
|
|
169
|
+
HttpStatusCode[HttpStatusCode["GONE"] = 410] = "GONE";
|
|
170
170
|
/**
|
|
171
171
|
* Server rejected the request because the Content-Length header field is not defined and the server requires it.
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
HttpStatusCode[HttpStatusCode["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
174
174
|
/**
|
|
175
175
|
* The client has indicated preconditions in its headers which the server does not meet.
|
|
176
176
|
*/
|
|
177
|
-
|
|
177
|
+
HttpStatusCode[HttpStatusCode["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
178
178
|
/**
|
|
179
179
|
* Request entity is larger than limits defined by server. The server might close the connection or
|
|
180
180
|
* return an Retry-After header field.
|
|
181
181
|
*/
|
|
182
|
-
|
|
182
|
+
HttpStatusCode[HttpStatusCode["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
183
183
|
/**
|
|
184
184
|
* The URI requested by the client is longer than the server is willing to interpret.
|
|
185
185
|
*/
|
|
186
|
-
|
|
186
|
+
HttpStatusCode[HttpStatusCode["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
187
187
|
/**
|
|
188
188
|
* The media format of the requested data is not supported by the server, so the server is rejecting the request.
|
|
189
189
|
*/
|
|
190
|
-
|
|
190
|
+
HttpStatusCode[HttpStatusCode["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
191
191
|
/**
|
|
192
192
|
* The range specified by the Range header field in the request cannot be fulfilled.
|
|
193
193
|
* It's possible that the range is outside the size of the target URI's data.
|
|
194
194
|
*/
|
|
195
|
-
|
|
195
|
+
HttpStatusCode[HttpStatusCode["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
196
196
|
/**
|
|
197
197
|
* This response code means the expectation indicated by the Expect request header field cannot be met by the server.
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
HttpStatusCode[HttpStatusCode["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
200
200
|
/**
|
|
201
201
|
* The server refuses the attempt to brew coffee with a teapot.
|
|
202
202
|
*/
|
|
203
|
-
|
|
203
|
+
HttpStatusCode[HttpStatusCode["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
204
204
|
/**
|
|
205
205
|
* The request was directed at a server that is not able to produce a response.
|
|
206
206
|
* This can be sent by a server that is not configured to produce responses for
|
|
207
207
|
* the combination of scheme and authority that are included in the request URI.
|
|
208
208
|
*/
|
|
209
|
-
|
|
209
|
+
HttpStatusCode[HttpStatusCode["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
210
210
|
/**
|
|
211
211
|
* The request was well-formed but was unable to be followed due to semantic errors.
|
|
212
212
|
*/
|
|
213
|
-
|
|
213
|
+
HttpStatusCode[HttpStatusCode["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
214
214
|
/**
|
|
215
215
|
* The resource that is being accessed is locked.
|
|
216
216
|
*/
|
|
217
|
-
|
|
217
|
+
HttpStatusCode[HttpStatusCode["LOCKED"] = 423] = "LOCKED";
|
|
218
218
|
/**
|
|
219
219
|
* The request failed due to failure of a previous request.
|
|
220
220
|
*/
|
|
221
|
-
|
|
221
|
+
HttpStatusCode[HttpStatusCode["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
222
222
|
/**
|
|
223
223
|
* Indicates that the server is unwilling to risk processing a request that might be replayed.
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
HttpStatusCode[HttpStatusCode["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
226
226
|
/**
|
|
227
227
|
* The server refuses to perform the request using the current protocol but might be willing
|
|
228
228
|
* to do so after the client upgrades to a different protocol. The server sends an Upgrade
|
|
229
229
|
* header in a 426 response to indicate the required protocol(s).
|
|
230
230
|
*/
|
|
231
|
-
|
|
231
|
+
HttpStatusCode[HttpStatusCode["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
232
232
|
/**
|
|
233
233
|
* The origin server requires the request to be conditional. This response is intended to prevent
|
|
234
234
|
* the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs
|
|
235
235
|
* it back to the server, when meanwhile a third party has modified the state on the server,
|
|
236
236
|
* leading to a conflict.
|
|
237
237
|
*/
|
|
238
|
-
|
|
238
|
+
HttpStatusCode[HttpStatusCode["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
239
239
|
/**
|
|
240
240
|
* The user has sent too many requests in a given amount of time ("rate limiting").
|
|
241
241
|
*/
|
|
242
|
-
|
|
242
|
+
HttpStatusCode[HttpStatusCode["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
243
243
|
/* *** Server error responses *** */
|
|
244
244
|
/**
|
|
245
245
|
* The server has encountered a situation it does not know how to handle.
|
|
246
246
|
*/
|
|
247
|
-
|
|
247
|
+
HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
248
248
|
/**
|
|
249
249
|
* The request method is not supported by the server and cannot be handled.
|
|
250
250
|
* The only methods that servers are required to support (and therefore that must not return this code)
|
|
251
251
|
* are GET and HEAD.
|
|
252
252
|
*/
|
|
253
|
-
|
|
253
|
+
HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
254
254
|
/**
|
|
255
255
|
* This error response means that the server, while working as a gateway to get
|
|
256
256
|
* a response needed to handle the request, got an invalid response.
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
HttpStatusCode[HttpStatusCode["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
259
259
|
/**
|
|
260
260
|
* The server is not ready to handle the request. Common causes are a server that is down for maintenance
|
|
261
261
|
* or that is overloaded. Note that together with this response, a user-friendly page explaining
|
|
@@ -265,36 +265,36 @@ var HttpStatusCodes;
|
|
|
265
265
|
* headers that are sent along with this response, as these temporary condition responses
|
|
266
266
|
* should usually not be cached.
|
|
267
267
|
*/
|
|
268
|
-
|
|
268
|
+
HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
269
269
|
/**
|
|
270
270
|
* This error response is given when the server is acting as a gateway and cannot get a response in time.
|
|
271
271
|
*/
|
|
272
|
-
|
|
272
|
+
HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
273
273
|
/**
|
|
274
274
|
* The HTTP version used in the request is not supported by the server.
|
|
275
275
|
*/
|
|
276
|
-
|
|
276
|
+
HttpStatusCode[HttpStatusCode["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
277
277
|
/**
|
|
278
278
|
* The server has an internal configuration error: the chosen variant resource is configured
|
|
279
279
|
* to engage in transparent content negotiation itself, and is therefore not a proper end
|
|
280
280
|
* point in the negotiation process.
|
|
281
281
|
*/
|
|
282
|
-
|
|
282
|
+
HttpStatusCode[HttpStatusCode["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
283
283
|
/**
|
|
284
284
|
* The method could not be performed on the resource because the server is unable to store
|
|
285
285
|
* the representation needed to successfully complete the request.
|
|
286
286
|
*/
|
|
287
|
-
|
|
287
|
+
HttpStatusCode[HttpStatusCode["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
288
288
|
/**
|
|
289
289
|
* The server detected an infinite loop while processing the request.
|
|
290
290
|
*/
|
|
291
|
-
|
|
291
|
+
HttpStatusCode[HttpStatusCode["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
292
292
|
/**
|
|
293
293
|
* Further extensions to the request are required for the server to fulfill it.
|
|
294
294
|
*/
|
|
295
|
-
|
|
295
|
+
HttpStatusCode[HttpStatusCode["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
296
296
|
/**
|
|
297
297
|
* Indicates that the client needs to authenticate to gain network access.
|
|
298
298
|
*/
|
|
299
|
-
|
|
300
|
-
})(
|
|
299
|
+
HttpStatusCode[HttpStatusCode["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
300
|
+
})(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
|
|
@@ -56,6 +56,10 @@ Object.assign(StorageDecorator, ResourceDecorator);
|
|
|
56
56
|
list.push(operationMeta => operationMeta.options.minFileSize = sizeInBytes);
|
|
57
57
|
return decorator;
|
|
58
58
|
};
|
|
59
|
+
decorator.Returns = (t) => {
|
|
60
|
+
list.push(operationMeta => operationMeta.returnType = t);
|
|
61
|
+
return decorator;
|
|
62
|
+
};
|
|
59
63
|
return decorator;
|
|
60
64
|
}
|
|
61
65
|
StorageDecorator.Post = Post;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpStatusCode } from '../../http/index.js';
|
|
2
2
|
import { translate } from '../../i18n/index.js';
|
|
3
3
|
import { OpraException } from '../opra-exception.js';
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ import { OpraException } from '../opra-exception.js';
|
|
|
10
10
|
export class ForbiddenError extends OpraException {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.status =
|
|
13
|
+
this.status = HttpStatusCode.FORBIDDEN;
|
|
14
14
|
}
|
|
15
15
|
init(issue) {
|
|
16
16
|
super.init({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpStatusCode } from '../../http/index.js';
|
|
2
2
|
import { translate } from '../../i18n/index.js';
|
|
3
3
|
import { OpraException } from '../opra-exception.js';
|
|
4
4
|
/**
|
|
@@ -15,6 +15,6 @@ export class ResourceNotAvailableError extends OpraException {
|
|
|
15
15
|
resource,
|
|
16
16
|
key: keyValue
|
|
17
17
|
}
|
|
18
|
-
}, cause,
|
|
18
|
+
}, cause, HttpStatusCode.UNPROCESSABLE_ENTITY);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -2,127 +2,127 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses
|
|
4
4
|
*/
|
|
5
|
-
export var
|
|
6
|
-
(function (
|
|
5
|
+
export var HttpStatusCode;
|
|
6
|
+
(function (HttpStatusCode) {
|
|
7
7
|
/* *** Information responses *** */
|
|
8
8
|
/**
|
|
9
9
|
* This interim response indicates that the client should continue the request or
|
|
10
10
|
* ignore the response if the request is already finished.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
HttpStatusCode[HttpStatusCode["CONTINUE"] = 100] = "CONTINUE";
|
|
13
13
|
/**
|
|
14
14
|
* This code is sent in response to an Upgrade request header from the client and
|
|
15
15
|
* indicates the protocol the server is switching to.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
HttpStatusCode[HttpStatusCode["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
18
18
|
/**
|
|
19
19
|
* This code indicates that the server has received and is processing the request, but no response is available yet.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
HttpStatusCode[HttpStatusCode["PROCESSING"] = 102] = "PROCESSING";
|
|
22
22
|
/**
|
|
23
23
|
* This status code is primarily intended to be used with the Link header, letting the user agent
|
|
24
24
|
* start preloading resources while the server prepares a response.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
HttpStatusCode[HttpStatusCode["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
27
27
|
/* *** Successful responses *** */
|
|
28
28
|
/**
|
|
29
29
|
* The request succeeded.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
|
|
32
32
|
/**
|
|
33
33
|
* The request succeeded, and a new resource was created as a result.
|
|
34
34
|
* This is typically the response sent after POST requests, or some PUT requests.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
HttpStatusCode[HttpStatusCode["CREATED"] = 201] = "CREATED";
|
|
37
37
|
/**
|
|
38
38
|
* The request has been received but not yet acted upon. It is noncommittal,
|
|
39
39
|
* since there is no way in HTTP to later send an asynchronous response indicating
|
|
40
40
|
* the outcome of the request. It is intended for cases where another process or
|
|
41
41
|
* server handles the request, or for batch processing.
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
HttpStatusCode[HttpStatusCode["ACCEPTED"] = 202] = "ACCEPTED";
|
|
44
44
|
/**
|
|
45
45
|
* This response code means the returned metadata is not exactly the same as is available from
|
|
46
46
|
* the origin server, but is collected from a local or a third-party copy. This is mostly used
|
|
47
47
|
* for mirrors or backups of another resource. Except for that specific case, the 200 OK
|
|
48
48
|
* response is preferred to this status.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
HttpStatusCode[HttpStatusCode["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
51
51
|
/**
|
|
52
52
|
* There is no content to send for this request, but the headers may be useful.
|
|
53
53
|
* The user agent may update its cached headers for this resource with the new ones.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
HttpStatusCode[HttpStatusCode["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
56
56
|
/**
|
|
57
57
|
* Tells the user agent to reset the document which sent this request.
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
HttpStatusCode[HttpStatusCode["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
60
60
|
/**
|
|
61
61
|
* This response code is used when the Range header is sent from the client to request only part of a resource.
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
HttpStatusCode[HttpStatusCode["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
64
64
|
/* *** Redirection messages *** */
|
|
65
65
|
/**
|
|
66
66
|
* The request has more than one possible response. The user agent or user should choose one of them.
|
|
67
67
|
* (There is no standardized way of choosing one of the responses, but HTML links to the possibilities
|
|
68
68
|
* are recommended so the user can pick.)
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
HttpStatusCode[HttpStatusCode["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
71
71
|
/**
|
|
72
72
|
* The URL of the requested resource has been changed permanently. The new URL is given in the response.
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
HttpStatusCode[HttpStatusCode["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
75
75
|
/**
|
|
76
76
|
* This response code means that the URI of requested resource has been changed temporarily.
|
|
77
77
|
* Further changes in the URI might be made in the future. Therefore, this same URI should
|
|
78
78
|
* be used by the client in future requests.
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
HttpStatusCode[HttpStatusCode["FOUND"] = 302] = "FOUND";
|
|
81
81
|
/**
|
|
82
82
|
* This is used for caching purposes. It tells the client that the response has not been modified,
|
|
83
83
|
* so the client can continue to use the same cached version of the response.
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
HttpStatusCode[HttpStatusCode["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
86
86
|
/**
|
|
87
87
|
*
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
HttpStatusCode[HttpStatusCode["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
90
90
|
/**
|
|
91
91
|
* The server sends this response to direct the client to get the requested resource at another
|
|
92
92
|
* URI with same method that was used in the prior request. This has the same semantics as
|
|
93
93
|
* the 302 Found HTTP response code, with the exception that the user agent must not change
|
|
94
94
|
* the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
HttpStatusCode[HttpStatusCode["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
97
97
|
/**
|
|
98
98
|
* This means that the resource is now permanently located at another URI, specified by the Location:
|
|
99
99
|
* HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code,
|
|
100
100
|
* with the exception that the user agent must not change the HTTP method used: if a POST was used
|
|
101
101
|
* in the first request, a POST must be used in the second request.
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
HttpStatusCode[HttpStatusCode["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
104
104
|
/* *** Client error responses *** */
|
|
105
105
|
/**
|
|
106
106
|
* The server cannot or will not process the request due to something that is perceived to be a client error
|
|
107
107
|
* (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
HttpStatusCode[HttpStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
110
110
|
/**
|
|
111
111
|
* Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated".
|
|
112
112
|
* That is, the client must authenticate itself to get the requested response.
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
HttpStatusCode[HttpStatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
115
115
|
/**
|
|
116
116
|
* This response code is reserved for future use. The initial aim for creating this code was using
|
|
117
117
|
* it for digital payment systems, however this status code is used very rarely and no standard convention exists.
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
HttpStatusCode[HttpStatusCode["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
120
120
|
/**
|
|
121
121
|
* The client does not have access rights to the content; that is, it is unauthorized,
|
|
122
122
|
* so the server is refusing to give the requested resource. Unlike 401 Unauthorized,
|
|
123
123
|
* the client's identity is known to the server.
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
HttpStatusCode[HttpStatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
126
126
|
/**
|
|
127
127
|
* The server can not find the requested resource. In the browser, this means the URL is not recognized.
|
|
128
128
|
* In an API, this can also mean that the endpoint is valid but the resource itself does not exist.
|
|
@@ -130,21 +130,21 @@ export var HttpStatusCodes;
|
|
|
130
130
|
* from an unauthorized client. This response code is probably the most well known due to its
|
|
131
131
|
* frequent occurrence on the web.
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
HttpStatusCode[HttpStatusCode["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
134
134
|
/**
|
|
135
135
|
* The request method is known by the server but is not supported by the target resource.
|
|
136
136
|
* For example, an API may not allow calling DELETE to remove a resource.
|
|
137
137
|
*/
|
|
138
|
-
|
|
138
|
+
HttpStatusCode[HttpStatusCode["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
139
139
|
/**
|
|
140
140
|
* This response is sent when the web server, after performing server-driven content negotiation,
|
|
141
141
|
* doesn't find any content that conforms to the criteria given by the user agent.
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
HttpStatusCode[HttpStatusCode["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
144
144
|
/**
|
|
145
145
|
* This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
HttpStatusCode[HttpStatusCode["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
148
148
|
/**
|
|
149
149
|
* This response is sent on an idle connection by some servers, even without any previous request by the client.
|
|
150
150
|
* It means that the server would like to shut down this unused connection.
|
|
@@ -152,107 +152,107 @@ export var HttpStatusCodes;
|
|
|
152
152
|
* like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing.
|
|
153
153
|
* Also note that some servers merely shut down the connection without sending this message.
|
|
154
154
|
*/
|
|
155
|
-
|
|
155
|
+
HttpStatusCode[HttpStatusCode["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
156
156
|
/**
|
|
157
157
|
* This response is sent when a request conflicts with the current state of the server.
|
|
158
158
|
*/
|
|
159
|
-
|
|
159
|
+
HttpStatusCode[HttpStatusCode["CONFLICT"] = 409] = "CONFLICT";
|
|
160
160
|
/**
|
|
161
161
|
* This response is sent when the requested content has been permanently deleted from server,
|
|
162
162
|
* with no forwarding address. Clients are expected to remove their caches and links to the resource.
|
|
163
163
|
* The HTTP specification intends this status code to be used for "limited-time, promotional services".
|
|
164
164
|
* APIs should not feel compelled to indicate resources that have been deleted with this status code.
|
|
165
165
|
*/
|
|
166
|
-
|
|
166
|
+
HttpStatusCode[HttpStatusCode["GONE"] = 410] = "GONE";
|
|
167
167
|
/**
|
|
168
168
|
* Server rejected the request because the Content-Length header field is not defined and the server requires it.
|
|
169
169
|
*/
|
|
170
|
-
|
|
170
|
+
HttpStatusCode[HttpStatusCode["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
171
171
|
/**
|
|
172
172
|
* The client has indicated preconditions in its headers which the server does not meet.
|
|
173
173
|
*/
|
|
174
|
-
|
|
174
|
+
HttpStatusCode[HttpStatusCode["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
175
175
|
/**
|
|
176
176
|
* Request entity is larger than limits defined by server. The server might close the connection or
|
|
177
177
|
* return an Retry-After header field.
|
|
178
178
|
*/
|
|
179
|
-
|
|
179
|
+
HttpStatusCode[HttpStatusCode["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
180
180
|
/**
|
|
181
181
|
* The URI requested by the client is longer than the server is willing to interpret.
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
HttpStatusCode[HttpStatusCode["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
184
184
|
/**
|
|
185
185
|
* The media format of the requested data is not supported by the server, so the server is rejecting the request.
|
|
186
186
|
*/
|
|
187
|
-
|
|
187
|
+
HttpStatusCode[HttpStatusCode["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
188
188
|
/**
|
|
189
189
|
* The range specified by the Range header field in the request cannot be fulfilled.
|
|
190
190
|
* It's possible that the range is outside the size of the target URI's data.
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
HttpStatusCode[HttpStatusCode["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
193
193
|
/**
|
|
194
194
|
* This response code means the expectation indicated by the Expect request header field cannot be met by the server.
|
|
195
195
|
*/
|
|
196
|
-
|
|
196
|
+
HttpStatusCode[HttpStatusCode["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
197
197
|
/**
|
|
198
198
|
* The server refuses the attempt to brew coffee with a teapot.
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
HttpStatusCode[HttpStatusCode["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
201
201
|
/**
|
|
202
202
|
* The request was directed at a server that is not able to produce a response.
|
|
203
203
|
* This can be sent by a server that is not configured to produce responses for
|
|
204
204
|
* the combination of scheme and authority that are included in the request URI.
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
HttpStatusCode[HttpStatusCode["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
207
207
|
/**
|
|
208
208
|
* The request was well-formed but was unable to be followed due to semantic errors.
|
|
209
209
|
*/
|
|
210
|
-
|
|
210
|
+
HttpStatusCode[HttpStatusCode["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
211
211
|
/**
|
|
212
212
|
* The resource that is being accessed is locked.
|
|
213
213
|
*/
|
|
214
|
-
|
|
214
|
+
HttpStatusCode[HttpStatusCode["LOCKED"] = 423] = "LOCKED";
|
|
215
215
|
/**
|
|
216
216
|
* The request failed due to failure of a previous request.
|
|
217
217
|
*/
|
|
218
|
-
|
|
218
|
+
HttpStatusCode[HttpStatusCode["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
219
219
|
/**
|
|
220
220
|
* Indicates that the server is unwilling to risk processing a request that might be replayed.
|
|
221
221
|
*/
|
|
222
|
-
|
|
222
|
+
HttpStatusCode[HttpStatusCode["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
223
223
|
/**
|
|
224
224
|
* The server refuses to perform the request using the current protocol but might be willing
|
|
225
225
|
* to do so after the client upgrades to a different protocol. The server sends an Upgrade
|
|
226
226
|
* header in a 426 response to indicate the required protocol(s).
|
|
227
227
|
*/
|
|
228
|
-
|
|
228
|
+
HttpStatusCode[HttpStatusCode["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
229
229
|
/**
|
|
230
230
|
* The origin server requires the request to be conditional. This response is intended to prevent
|
|
231
231
|
* the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs
|
|
232
232
|
* it back to the server, when meanwhile a third party has modified the state on the server,
|
|
233
233
|
* leading to a conflict.
|
|
234
234
|
*/
|
|
235
|
-
|
|
235
|
+
HttpStatusCode[HttpStatusCode["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
236
236
|
/**
|
|
237
237
|
* The user has sent too many requests in a given amount of time ("rate limiting").
|
|
238
238
|
*/
|
|
239
|
-
|
|
239
|
+
HttpStatusCode[HttpStatusCode["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
240
240
|
/* *** Server error responses *** */
|
|
241
241
|
/**
|
|
242
242
|
* The server has encountered a situation it does not know how to handle.
|
|
243
243
|
*/
|
|
244
|
-
|
|
244
|
+
HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
245
245
|
/**
|
|
246
246
|
* The request method is not supported by the server and cannot be handled.
|
|
247
247
|
* The only methods that servers are required to support (and therefore that must not return this code)
|
|
248
248
|
* are GET and HEAD.
|
|
249
249
|
*/
|
|
250
|
-
|
|
250
|
+
HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
251
251
|
/**
|
|
252
252
|
* This error response means that the server, while working as a gateway to get
|
|
253
253
|
* a response needed to handle the request, got an invalid response.
|
|
254
254
|
*/
|
|
255
|
-
|
|
255
|
+
HttpStatusCode[HttpStatusCode["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
256
256
|
/**
|
|
257
257
|
* The server is not ready to handle the request. Common causes are a server that is down for maintenance
|
|
258
258
|
* or that is overloaded. Note that together with this response, a user-friendly page explaining
|
|
@@ -262,36 +262,36 @@ export var HttpStatusCodes;
|
|
|
262
262
|
* headers that are sent along with this response, as these temporary condition responses
|
|
263
263
|
* should usually not be cached.
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
266
266
|
/**
|
|
267
267
|
* This error response is given when the server is acting as a gateway and cannot get a response in time.
|
|
268
268
|
*/
|
|
269
|
-
|
|
269
|
+
HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
270
270
|
/**
|
|
271
271
|
* The HTTP version used in the request is not supported by the server.
|
|
272
272
|
*/
|
|
273
|
-
|
|
273
|
+
HttpStatusCode[HttpStatusCode["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
274
274
|
/**
|
|
275
275
|
* The server has an internal configuration error: the chosen variant resource is configured
|
|
276
276
|
* to engage in transparent content negotiation itself, and is therefore not a proper end
|
|
277
277
|
* point in the negotiation process.
|
|
278
278
|
*/
|
|
279
|
-
|
|
279
|
+
HttpStatusCode[HttpStatusCode["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
280
280
|
/**
|
|
281
281
|
* The method could not be performed on the resource because the server is unable to store
|
|
282
282
|
* the representation needed to successfully complete the request.
|
|
283
283
|
*/
|
|
284
|
-
|
|
284
|
+
HttpStatusCode[HttpStatusCode["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
285
285
|
/**
|
|
286
286
|
* The server detected an infinite loop while processing the request.
|
|
287
287
|
*/
|
|
288
|
-
|
|
288
|
+
HttpStatusCode[HttpStatusCode["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
289
289
|
/**
|
|
290
290
|
* Further extensions to the request are required for the server to fulfill it.
|
|
291
291
|
*/
|
|
292
|
-
|
|
292
|
+
HttpStatusCode[HttpStatusCode["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
293
293
|
/**
|
|
294
294
|
* Indicates that the client needs to authenticate to gain network access.
|
|
295
295
|
*/
|
|
296
|
-
|
|
297
|
-
})(
|
|
296
|
+
HttpStatusCode[HttpStatusCode["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
297
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/common",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.11",
|
|
4
4
|
"description": "Opra common package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@browsery/util": "^0.4.0",
|
|
55
55
|
"@types/encodeurl": "^1.0.2",
|
|
56
56
|
"@types/lodash.omit": "^4.5.9",
|
|
57
|
-
"@types/validator": "^13.11.
|
|
57
|
+
"@types/validator": "^13.11.8",
|
|
58
58
|
"path-browserify": "^1.0.1",
|
|
59
|
-
"ts-gems": "^3.1.
|
|
59
|
+
"ts-gems": "^3.1.1"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=16.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Combine, StrictOmit, Type } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import { TypeThunkAsync } from '../../types.js';
|
|
3
4
|
import { ActionDecorator } from './action-decorator.js';
|
|
4
5
|
import { ResourceDecorator } from './resource-decorator.js';
|
|
5
6
|
import type { Storage } from './storage.js';
|
|
@@ -85,13 +86,14 @@ export declare namespace StorageDecorator {
|
|
|
85
86
|
* Post PropertyDecorator
|
|
86
87
|
*/
|
|
87
88
|
type PostDecorator = ((target: Object, propertyKey: 'post') => void) & {
|
|
88
|
-
Parameter
|
|
89
|
-
MaxFields
|
|
90
|
-
MaxFieldSize
|
|
91
|
-
MaxFiles
|
|
92
|
-
MaxFileSize
|
|
93
|
-
MaxTotalFileSize
|
|
94
|
-
MinFileSize
|
|
89
|
+
Parameter(name: string, optionsOrType?: ResourceDecorator.ParameterOptions | string | Type): PostDecorator;
|
|
90
|
+
MaxFields(amount: number): PostDecorator;
|
|
91
|
+
MaxFieldSize(sizeInBytes: number): PostDecorator;
|
|
92
|
+
MaxFiles(amount: number): PostDecorator;
|
|
93
|
+
MaxFileSize(sizeInBytes: number): PostDecorator;
|
|
94
|
+
MaxTotalFileSize(sizeInBytes: number): PostDecorator;
|
|
95
|
+
MinFileSize(sizeInBytes: number): PostDecorator;
|
|
96
|
+
Returns(t: TypeThunkAsync | string): PostDecorator;
|
|
95
97
|
};
|
|
96
98
|
function Post(options?: Post.Options): PostDecorator;
|
|
97
99
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpStatusCode } from '../../http/index.js';
|
|
2
2
|
import { ErrorIssue } from '../error-issue.js';
|
|
3
3
|
import { OpraException } from '../opra-exception.js';
|
|
4
4
|
/**
|
|
@@ -8,6 +8,6 @@ import { OpraException } from '../opra-exception.js';
|
|
|
8
8
|
* the client's identity is known to the server.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ForbiddenError extends OpraException {
|
|
11
|
-
status:
|
|
11
|
+
status: HttpStatusCode;
|
|
12
12
|
protected init(issue: Partial<ErrorIssue>): void;
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses
|
|
3
3
|
*/
|
|
4
|
-
export declare enum
|
|
4
|
+
export declare enum HttpStatusCode {
|
|
5
5
|
/**
|
|
6
6
|
* This interim response indicates that the client should continue the request or
|
|
7
7
|
* ignore the response if the request is already finished.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StrictOmit } from 'ts-gems';
|
|
2
|
+
import { DataType } from '../data-type/data-type.interface.js';
|
|
2
3
|
import type { Endpoint } from './endpoint.interface.js';
|
|
3
4
|
import type { ResourceBase } from './resource.interface.js';
|
|
4
5
|
export interface Storage extends StrictOmit<ResourceBase, 'kind'> {
|
|
@@ -18,6 +19,7 @@ export declare namespace Storage {
|
|
|
18
19
|
type Delete = Endpoint;
|
|
19
20
|
type Get = Endpoint;
|
|
20
21
|
type Post = Endpoint & {
|
|
22
|
+
returnType?: string | DataType;
|
|
21
23
|
/**
|
|
22
24
|
* the minium size of uploaded file
|
|
23
25
|
*
|