@opra/common 0.6.0 → 0.8.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/cjs/exception/http-errors/bad-request.error.js +4 -1
- package/cjs/exception/http-errors/failed-dependency.error.js +4 -1
- package/cjs/exception/http-errors/forbidden.error.js +4 -1
- package/cjs/exception/http-errors/internal-server.error.js +4 -1
- package/cjs/exception/http-errors/method-not-allowed.error.js +4 -1
- package/cjs/exception/http-errors/not-acceptable.error.js +4 -1
- package/cjs/exception/http-errors/not-found.error.js +4 -1
- package/cjs/exception/http-errors/unauthorized.error.js +4 -1
- package/cjs/exception/http-errors/unprocessable-entity.error.js +4 -1
- package/cjs/exception/opra-exception.js +1 -3
- package/cjs/exception/resource-errors/resource-conflict.error.js +1 -1
- package/cjs/filter/antlr/OpraFilterLexer.js +349 -350
- package/cjs/filter/antlr/OpraFilterParser.js +177 -178
- package/cjs/filter/ast/abstract/ast.js +0 -1
- package/cjs/filter/ast/expressions/arithmetic-expression.js +1 -3
- package/cjs/filter/ast/expressions/array-expression.js +0 -1
- package/cjs/filter/ast/expressions/comparison-expression.js +0 -3
- package/cjs/filter/ast/expressions/logical-expression.js +0 -2
- package/cjs/filter/ast/expressions/parentheses-expression.js +0 -1
- package/cjs/filter/ast/terms/date-literal.js +0 -1
- package/cjs/filter/ast/terms/null-literal.js +1 -1
- package/cjs/filter/ast/terms/number-literal.js +0 -1
- package/cjs/filter/ast/terms/time-literal.js +0 -1
- package/cjs/filter/error-listener.js +0 -1
- package/cjs/filter/errors.js +0 -5
- package/cjs/filter/filter-tree-visitor.js +0 -1
- package/cjs/helpers/responsive-map.js +3 -3
- package/cjs/http/http-request.js +4 -18
- package/cjs/http/multipart/batch-multipart.js +2 -3
- package/cjs/http/multipart/http-request-content.js +0 -4
- package/cjs/http/multipart/http-response-content.js +0 -3
- package/cjs/schema/implementation/data-type/complex-type.js +3 -4
- package/cjs/schema/implementation/data-type/data-type.js +0 -3
- package/cjs/schema/implementation/data-type/union-type.js +0 -2
- package/cjs/schema/implementation/document-builder.js +6 -7
- package/cjs/schema/implementation/opra-document.js +3 -3
- package/cjs/schema/implementation/query/collection-count-query.js +3 -5
- package/cjs/schema/implementation/query/collection-create-query.js +3 -8
- package/cjs/schema/implementation/query/collection-delete-many-query.js +3 -5
- package/cjs/schema/implementation/query/collection-delete-query.js +3 -5
- package/cjs/schema/implementation/query/collection-get-query.js +3 -9
- package/cjs/schema/implementation/query/collection-search-query.js +3 -13
- package/cjs/schema/implementation/query/collection-update-many-query.js +3 -6
- package/cjs/schema/implementation/query/collection-update-query.js +3 -9
- package/cjs/schema/implementation/query/field-get-query.js +3 -14
- package/cjs/schema/implementation/query/singleton-get-query.js +3 -8
- package/cjs/schema/implementation/resource/collection-resource-info.js +0 -1
- package/cjs/schema/implementation/resource/resource-info.js +0 -4
- package/cjs/schema/implementation/resource/singleton-resource-info.js +0 -1
- package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +5 -5
- package/cjs/schema/type-helpers/extend-type.helper.js +4 -4
- package/cjs/schema/type-helpers/mixin-type.helper.js +4 -4
- package/cjs/url/formats/date-format.js +0 -4
- package/cjs/url/formats/integer-format.js +0 -1
- package/cjs/url/formats/number-format.js +0 -2
- package/cjs/url/formats/string-format.js +0 -3
- package/cjs/url/opra-url-path-component.js +0 -3
- package/cjs/url/opra-url-path.js +1 -1
- package/cjs/url/opra-url-search-params.js +4 -5
- package/cjs/url/opra-url.js +0 -3
- package/esm/exception/http-errors/bad-request.error.js +4 -1
- package/esm/exception/http-errors/failed-dependency.error.js +4 -1
- package/esm/exception/http-errors/forbidden.error.js +4 -1
- package/esm/exception/http-errors/internal-server.error.js +4 -1
- package/esm/exception/http-errors/method-not-allowed.error.js +4 -1
- package/esm/exception/http-errors/not-acceptable.error.js +4 -1
- package/esm/exception/http-errors/not-found.error.js +4 -1
- package/esm/exception/http-errors/unauthorized.error.js +4 -1
- package/esm/exception/http-errors/unprocessable-entity.error.js +4 -1
- package/esm/exception/opra-exception.js +1 -3
- package/esm/exception/resource-errors/resource-conflict.error.js +1 -1
- package/esm/filter/antlr/OpraFilterLexer.js +349 -350
- package/esm/filter/antlr/OpraFilterParser.js +177 -178
- package/esm/filter/ast/abstract/ast.js +0 -1
- package/esm/filter/ast/expressions/arithmetic-expression.js +1 -3
- package/esm/filter/ast/expressions/array-expression.js +0 -1
- package/esm/filter/ast/expressions/comparison-expression.js +0 -3
- package/esm/filter/ast/expressions/logical-expression.js +0 -2
- package/esm/filter/ast/expressions/parentheses-expression.js +0 -1
- package/esm/filter/ast/terms/date-literal.js +0 -1
- package/esm/filter/ast/terms/null-literal.js +1 -1
- package/esm/filter/ast/terms/number-literal.js +0 -1
- package/esm/filter/ast/terms/time-literal.js +0 -1
- package/esm/filter/error-listener.js +0 -1
- package/esm/filter/errors.js +0 -5
- package/esm/filter/filter-tree-visitor.js +0 -1
- package/esm/helpers/responsive-map.js +3 -3
- package/esm/http/http-request.js +4 -18
- package/esm/http/multipart/batch-multipart.d.ts +2 -1
- package/esm/http/multipart/batch-multipart.js +2 -3
- package/esm/http/multipart/http-request-content.js +0 -4
- package/esm/http/multipart/http-response-content.js +0 -3
- package/esm/schema/implementation/data-type/complex-type.js +3 -4
- package/esm/schema/implementation/data-type/data-type.js +0 -3
- package/esm/schema/implementation/data-type/union-type.js +0 -2
- package/esm/schema/implementation/document-builder.js +6 -6
- package/esm/schema/implementation/opra-document.js +3 -3
- package/esm/schema/implementation/query/collection-count-query.js +3 -5
- package/esm/schema/implementation/query/collection-create-query.js +3 -8
- package/esm/schema/implementation/query/collection-delete-many-query.js +3 -5
- package/esm/schema/implementation/query/collection-delete-query.js +3 -5
- package/esm/schema/implementation/query/collection-get-query.js +3 -9
- package/esm/schema/implementation/query/collection-search-query.js +3 -13
- package/esm/schema/implementation/query/collection-update-many-query.js +3 -6
- package/esm/schema/implementation/query/collection-update-query.js +3 -9
- package/esm/schema/implementation/query/field-get-query.js +3 -14
- package/esm/schema/implementation/query/singleton-get-query.js +3 -8
- package/esm/schema/implementation/resource/collection-resource-info.js +0 -1
- package/esm/schema/implementation/resource/resource-info.js +0 -4
- package/esm/schema/implementation/resource/singleton-resource-info.js +0 -1
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +5 -4
- package/esm/schema/type-helpers/extend-type.helper.js +4 -3
- package/esm/schema/type-helpers/mixin-type.helper.js +4 -3
- package/esm/url/formats/date-format.js +0 -4
- package/esm/url/formats/integer-format.js +0 -1
- package/esm/url/formats/number-format.js +0 -2
- package/esm/url/formats/string-format.js +0 -3
- package/esm/url/opra-url-path-component.js +0 -3
- package/esm/url/opra-url-path.js +1 -1
- package/esm/url/opra-url-search-params.d.ts +0 -2
- package/esm/url/opra-url-search-params.js +3 -4
- package/esm/url/opra-url.js +0 -3
- package/package.json +10 -17
- package/README.md +0 -3
- package/umd/opra-common.umd.min.js +0 -1
|
@@ -9,7 +9,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
9
9
|
* (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
|
|
10
10
|
*/
|
|
11
11
|
class BadRequestError extends opra_exception_js_1.OpraException {
|
|
12
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.status = 400;
|
|
15
|
+
}
|
|
13
16
|
setIssue(issue) {
|
|
14
17
|
super.setIssue({
|
|
15
18
|
message: (0, index_js_1.translate)('error:BAD_REQUEST', 'Bad request'),
|
|
@@ -8,7 +8,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
8
8
|
* The request failed due to failure of a previous request.
|
|
9
9
|
*/
|
|
10
10
|
class FailedDependencyError extends opra_exception_js_1.OpraException {
|
|
11
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.status = 424;
|
|
14
|
+
}
|
|
12
15
|
setIssue(issue) {
|
|
13
16
|
super.setIssue({
|
|
14
17
|
message: (0, index_js_1.translate)('error:FAILED_DEPENDENCY', 'The request failed due to failure of a previous request'),
|
|
@@ -10,7 +10,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
10
10
|
* the client's identity is known to the server.
|
|
11
11
|
*/
|
|
12
12
|
class ForbiddenError extends opra_exception_js_1.OpraException {
|
|
13
|
-
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.status = 403;
|
|
16
|
+
}
|
|
14
17
|
setIssue(issue) {
|
|
15
18
|
super.setIssue({
|
|
16
19
|
message: (0, index_js_1.translate)('error:FORBIDDEN', 'You are not authorized to perform this action'),
|
|
@@ -8,7 +8,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
8
8
|
* The server has encountered a situation it does not know how to handle.
|
|
9
9
|
*/
|
|
10
10
|
class InternalServerError extends opra_exception_js_1.OpraException {
|
|
11
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.status = 500;
|
|
14
|
+
}
|
|
12
15
|
setIssue(issue) {
|
|
13
16
|
super.setIssue({
|
|
14
17
|
message: (0, index_js_1.translate)('error:INTERNAL_SERVER_ERROR', 'Internal server error'),
|
|
@@ -9,7 +9,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
9
9
|
* For example, an API may not allow calling DELETE to remove a resource.
|
|
10
10
|
*/
|
|
11
11
|
class MethodNotAllowedError extends opra_exception_js_1.OpraException {
|
|
12
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.status = 405;
|
|
15
|
+
}
|
|
13
16
|
setIssue(issue) {
|
|
14
17
|
super.setIssue({
|
|
15
18
|
message: (0, index_js_1.translate)('error:METHOD_NOT_ALLOWED', 'Method not allowed'),
|
|
@@ -9,7 +9,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
9
9
|
* doesn't find any content that conforms to the criteria given by the user agent.
|
|
10
10
|
*/
|
|
11
11
|
class NotAcceptableError extends opra_exception_js_1.OpraException {
|
|
12
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.status = 406;
|
|
15
|
+
}
|
|
13
16
|
setIssue(issue) {
|
|
14
17
|
super.setIssue({
|
|
15
18
|
message: (0, index_js_1.translate)('error:NOT_ACCEPTABLE', 'Not Acceptable'),
|
|
@@ -12,7 +12,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
12
12
|
* frequent occurrence on the web.
|
|
13
13
|
*/
|
|
14
14
|
class NotFoundError extends opra_exception_js_1.OpraException {
|
|
15
|
-
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.status = 404;
|
|
18
|
+
}
|
|
16
19
|
setIssue(issue) {
|
|
17
20
|
super.setIssue({
|
|
18
21
|
message: (0, index_js_1.translate)('error:NOT_FOUND', 'Not found'),
|
|
@@ -9,7 +9,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
9
9
|
* That is, the client must authenticate itself to get the requested response.
|
|
10
10
|
*/
|
|
11
11
|
class UnauthorizedError extends opra_exception_js_1.OpraException {
|
|
12
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.status = 401;
|
|
15
|
+
}
|
|
13
16
|
setIssue(issue) {
|
|
14
17
|
super.setIssue({
|
|
15
18
|
message: (0, index_js_1.translate)('error:UNAUTHORIZED', 'You have not been authenticated to perform this action'),
|
|
@@ -8,7 +8,10 @@ const opra_exception_js_1 = require("../opra-exception.js");
|
|
|
8
8
|
* The request was well-formed but was unable to be followed due to semantic errors.
|
|
9
9
|
*/
|
|
10
10
|
class UnprocessableEntityError extends opra_exception_js_1.OpraException {
|
|
11
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.status = 422;
|
|
14
|
+
}
|
|
12
15
|
setIssue(issue) {
|
|
13
16
|
super.setIssue({
|
|
14
17
|
message: (0, index_js_1.translate)('error:UNPROCESSABLE_ENTITY', 'Unprocessable entity'),
|
|
@@ -6,11 +6,9 @@ const index_js_1 = require("../i18n/index.js");
|
|
|
6
6
|
* Defines the base Opra exception, which is handled by the default Exceptions Handler.
|
|
7
7
|
*/
|
|
8
8
|
class OpraException extends Error {
|
|
9
|
-
_issue;
|
|
10
|
-
status = 500;
|
|
11
|
-
cause;
|
|
12
9
|
constructor(issue, cause) {
|
|
13
10
|
super('');
|
|
11
|
+
this.status = 500;
|
|
14
12
|
this._initName();
|
|
15
13
|
if (cause) {
|
|
16
14
|
this.cause = cause;
|
|
@@ -4,7 +4,6 @@ exports.ResourceConflictError = void 0;
|
|
|
4
4
|
const index_js_1 = require("../../i18n/index.js");
|
|
5
5
|
const opra_exception_js_1 = require("../opra-exception.js");
|
|
6
6
|
class ResourceConflictError extends opra_exception_js_1.OpraException {
|
|
7
|
-
status = 409;
|
|
8
7
|
constructor(resource, fields, cause) {
|
|
9
8
|
super({
|
|
10
9
|
message: (0, index_js_1.translate)(`error:RESOURCE_CONFLICT`, { resource, fields }, `There is already an other {{resource}} resource with same field values ({{fields}})`),
|
|
@@ -15,6 +14,7 @@ class ResourceConflictError extends opra_exception_js_1.OpraException {
|
|
|
15
14
|
location: fields
|
|
16
15
|
},
|
|
17
16
|
}, cause);
|
|
17
|
+
this.status = 409;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.ResourceConflictError = ResourceConflictError;
|