@opra/common 0.15.0 → 0.16.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/document/factory/import-resource-class.js +1 -0
- package/cjs/document/factory/import-type-class.js +9 -2
- package/cjs/document/resource/collection.js +9 -9
- package/cjs/document/resource/singleton.js +4 -4
- package/cjs/url/opra-url.js +7 -7
- package/esm/document/api-document.js +37 -33
- package/esm/document/constants.js +6 -3
- package/esm/document/data-type/api-field.js +15 -12
- package/esm/document/data-type/builtin/any.type.js +8 -5
- package/esm/document/data-type/builtin/base64.type.js +8 -5
- package/esm/document/data-type/builtin/bigint.type.js +8 -5
- package/esm/document/data-type/builtin/boolean.type.js +11 -8
- package/esm/document/data-type/builtin/date.type.js +10 -7
- package/esm/document/data-type/builtin/guid.type.js +12 -9
- package/esm/document/data-type/builtin/index.js +13 -10
- package/esm/document/data-type/builtin/integer.type.js +13 -10
- package/esm/document/data-type/builtin/number.type.js +10 -7
- package/esm/document/data-type/builtin/object.type.js +8 -5
- package/esm/document/data-type/builtin/string.type.js +11 -8
- package/esm/document/data-type/builtin/time.type.js +10 -7
- package/esm/document/data-type/builtin/timestamp.type.js +12 -9
- package/esm/document/data-type/complex-type.js +34 -30
- package/esm/document/data-type/data-type.js +12 -9
- package/esm/document/data-type/enum-type.js +19 -15
- package/esm/document/data-type/mapped-type.js +29 -24
- package/esm/document/data-type/simple-type.js +21 -17
- package/esm/document/data-type/union-type.js +29 -26
- package/esm/document/factory/add-references.js +7 -3
- package/esm/document/factory/create-document.js +16 -10
- package/esm/document/factory/factory.js +37 -33
- package/esm/document/factory/import-resource-class.js +22 -15
- package/esm/document/factory/import-type-class.js +43 -26
- package/esm/document/factory/index.js +4 -1
- package/esm/document/factory/process-resources.js +16 -10
- package/esm/document/factory/process-types.js +37 -31
- package/esm/document/index.js +17 -14
- package/esm/document/resource/collection.js +50 -46
- package/esm/document/resource/resource.js +12 -9
- package/esm/document/resource/singleton.js +29 -25
- package/esm/document/utils/inspect.util.js +7 -4
- package/esm/document/utils/string-compare.util.js +5 -1
- package/esm/exception/enums/issue-severity.enum.js +5 -2
- package/esm/exception/error-issue.js +2 -1
- package/esm/exception/http-errors/bad-request.error.js +8 -4
- package/esm/exception/http-errors/failed-dependency.error.js +8 -4
- package/esm/exception/http-errors/forbidden.error.js +8 -4
- package/esm/exception/http-errors/internal-server.error.js +8 -4
- package/esm/exception/http-errors/method-not-allowed.error.js +8 -4
- package/esm/exception/http-errors/not-acceptable.error.js +8 -4
- package/esm/exception/http-errors/not-found.error.js +8 -4
- package/esm/exception/http-errors/unauthorized.error.js +8 -4
- package/esm/exception/http-errors/unprocessable-entity.error.js +8 -4
- package/esm/exception/index.js +18 -15
- package/esm/exception/opra-exception.js +7 -3
- package/esm/exception/resource-errors/resource-conflict.error.js +8 -4
- package/esm/exception/resource-errors/resource-not-found.error.js +8 -4
- package/esm/exception/wrap-exception.js +24 -20
- package/esm/filter/antlr/OpraFilterLexer.js +9 -6
- package/esm/filter/antlr/OpraFilterListener.js +5 -2
- package/esm/filter/antlr/OpraFilterParser.js +126 -79
- package/esm/filter/antlr/OpraFilterVisitor.js +5 -2
- package/esm/filter/ast/abstract/ast.js +5 -1
- package/esm/filter/ast/abstract/expression.js +6 -2
- package/esm/filter/ast/abstract/literal.js +6 -2
- package/esm/filter/ast/abstract/term.js +6 -2
- package/esm/filter/ast/expressions/arithmetic-expression.js +8 -3
- package/esm/filter/ast/expressions/array-expression.js +6 -2
- package/esm/filter/ast/expressions/comparison-expression.js +6 -2
- package/esm/filter/ast/expressions/logical-expression.js +6 -2
- package/esm/filter/ast/expressions/parentheses-expression.js +6 -2
- package/esm/filter/ast/index.js +19 -16
- package/esm/filter/ast/terms/boolean-literal.js +6 -2
- package/esm/filter/ast/terms/date-literal.js +12 -8
- package/esm/filter/ast/terms/external-constant.js +6 -2
- package/esm/filter/ast/terms/null-literal.js +6 -2
- package/esm/filter/ast/terms/number-literal.js +8 -4
- package/esm/filter/ast/terms/qualified-identifier.js +6 -2
- package/esm/filter/ast/terms/string-literal.js +8 -4
- package/esm/filter/ast/terms/time-literal.js +10 -6
- package/esm/filter/build.js +69 -45
- package/esm/filter/errors.js +9 -3
- package/esm/filter/filter-tree-visitor.js +31 -26
- package/esm/filter/index.js +8 -5
- package/esm/filter/opra-error-listener.js +8 -4
- package/esm/filter/parse.js +19 -14
- package/esm/filter/utils.js +7 -2
- package/esm/helpers/function-utils.js +14 -8
- package/esm/helpers/get-stack-filename.js +5 -1
- package/esm/helpers/index.js +11 -8
- package/esm/helpers/is-url.js +5 -1
- package/esm/helpers/mixin-utils.js +7 -2
- package/esm/helpers/object-utils.js +12 -6
- package/esm/helpers/path-to-object-tree.js +5 -1
- package/esm/helpers/responsive-map.js +5 -1
- package/esm/helpers/type-guards.js +17 -7
- package/esm/http/codecs/boolean-codec.js +5 -1
- package/esm/http/codecs/date-codec.js +5 -1
- package/esm/http/codecs/filter-codec.js +9 -5
- package/esm/http/codecs/integer-codec.js +6 -2
- package/esm/http/codecs/number-codec.js +5 -1
- package/esm/http/codecs/string-codec.js +5 -1
- package/esm/http/enums/http-headers-codes.enum.js +5 -2
- package/esm/http/enums/http-status-codes.enum.js +5 -2
- package/esm/http/enums/http-status-messages.js +4 -1
- package/esm/http/http-headers.js +9 -5
- package/esm/http/http-message.host.js +18 -13
- package/esm/http/http-params.js +25 -20
- package/esm/http/http-request-message.js +22 -18
- package/esm/http/http-response-message.js +28 -23
- package/esm/http/index.js +17 -14
- package/esm/http/interfaces/client-http-headers.interface.js +2 -1
- package/esm/http/interfaces/cookie-options.interface.js +2 -1
- package/esm/http/interfaces/server-http-headers.interface.js +2 -1
- package/esm/i18n/i18n.js +28 -23
- package/esm/i18n/index.js +9 -5
- package/esm/i18n/string-utils.js +7 -2
- package/esm/i18n/translate.js +7 -3
- package/esm/index.js +16 -11
- package/esm/schema/constants.js +4 -1
- package/esm/schema/data-type/complex-type.interface.js +5 -2
- package/esm/schema/data-type/data-type.interface.js +2 -1
- package/esm/schema/data-type/enum-type.interface.js +5 -2
- package/esm/schema/data-type/field.interface.js +2 -1
- package/esm/schema/data-type/mapped-type.interface.js +5 -2
- package/esm/schema/data-type/simple-type.interface.js +5 -2
- package/esm/schema/data-type/union-type.interface.js +5 -2
- package/esm/schema/document.interface.js +2 -1
- package/esm/schema/index.js +34 -31
- package/esm/schema/resource/collection.interface.js +5 -2
- package/esm/schema/resource/container.interface.js +5 -2
- package/esm/schema/resource/endpoint.interface.js +2 -1
- package/esm/schema/resource/resource.interface.js +2 -1
- package/esm/schema/resource/singleton.interface.js +5 -2
- package/esm/schema/type-guards.js +53 -40
- package/esm/types.js +2 -1
- package/esm/url/index.js +8 -5
- package/esm/url/opra-url-path-component.js +7 -3
- package/esm/url/opra-url-path.js +18 -14
- package/esm/url/opra-url.js +25 -21
- package/esm/url/utils/decode-path-component.js +8 -4
- package/esm/url/utils/encode-path-component.js +8 -3
- package/esm/utils/path-utils.js +7 -2
- package/package.json +5 -4
- package/{esm → types}/document/factory/import-resource-class.d.ts +1 -0
- package/{esm → types}/document/resource/collection.d.ts +10 -10
- package/{esm → types}/document/resource/singleton.d.ts +4 -4
- package/{esm → types}/schema/resource/collection.interface.d.ts +6 -6
- package/{esm → types}/url/opra-url.d.ts +3 -3
- package/{esm → types}/document/api-document.d.ts +0 -0
- package/{esm → types}/document/constants.d.ts +0 -0
- package/{esm → types}/document/data-type/api-field.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/any.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/base64.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/bigint.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/boolean.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/date.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/guid.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/index.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/integer.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/number.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/object.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/string.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/time.type.d.ts +0 -0
- package/{esm → types}/document/data-type/builtin/timestamp.type.d.ts +0 -0
- package/{esm → types}/document/data-type/complex-type.d.ts +0 -0
- package/{esm → types}/document/data-type/data-type.d.ts +0 -0
- package/{esm → types}/document/data-type/enum-type.d.ts +0 -0
- package/{esm → types}/document/data-type/mapped-type.d.ts +0 -0
- package/{esm → types}/document/data-type/simple-type.d.ts +0 -0
- package/{esm → types}/document/data-type/union-type.d.ts +0 -0
- package/{esm → types}/document/factory/add-references.d.ts +0 -0
- package/{esm → types}/document/factory/create-document.d.ts +0 -0
- package/{esm → types}/document/factory/factory.d.ts +0 -0
- package/{esm → types}/document/factory/import-type-class.d.ts +0 -0
- package/{esm → types}/document/factory/index.d.ts +0 -0
- package/{esm → types}/document/factory/process-resources.d.ts +0 -0
- package/{esm → types}/document/factory/process-types.d.ts +0 -0
- package/{esm → types}/document/index.d.ts +0 -0
- package/{esm → types}/document/resource/resource.d.ts +0 -0
- package/{esm → types}/document/utils/inspect.util.d.ts +0 -0
- package/{esm → types}/document/utils/string-compare.util.d.ts +0 -0
- package/{esm → types}/exception/enums/issue-severity.enum.d.ts +0 -0
- package/{esm → types}/exception/error-issue.d.ts +0 -0
- package/{esm → types}/exception/http-errors/bad-request.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/failed-dependency.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/forbidden.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/internal-server.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/method-not-allowed.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/not-acceptable.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/not-found.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/unauthorized.error.d.ts +0 -0
- package/{esm → types}/exception/http-errors/unprocessable-entity.error.d.ts +0 -0
- package/{esm → types}/exception/index.d.ts +0 -0
- package/{esm → types}/exception/opra-exception.d.ts +0 -0
- package/{esm → types}/exception/resource-errors/resource-conflict.error.d.ts +0 -0
- package/{esm → types}/exception/resource-errors/resource-not-found.error.d.ts +0 -0
- package/{esm → types}/exception/wrap-exception.d.ts +0 -0
- package/{esm → types}/filter/antlr/OpraFilterLexer.d.ts +0 -0
- package/{esm → types}/filter/antlr/OpraFilterListener.d.ts +0 -0
- package/{esm → types}/filter/antlr/OpraFilterParser.d.ts +0 -0
- package/{esm → types}/filter/antlr/OpraFilterVisitor.d.ts +0 -0
- package/{esm → types}/filter/ast/abstract/ast.d.ts +0 -0
- package/{esm → types}/filter/ast/abstract/expression.d.ts +0 -0
- package/{esm → types}/filter/ast/abstract/literal.d.ts +0 -0
- package/{esm → types}/filter/ast/abstract/term.d.ts +0 -0
- package/{esm → types}/filter/ast/expressions/arithmetic-expression.d.ts +0 -0
- package/{esm → types}/filter/ast/expressions/array-expression.d.ts +0 -0
- package/{esm → types}/filter/ast/expressions/comparison-expression.d.ts +0 -0
- package/{esm → types}/filter/ast/expressions/logical-expression.d.ts +0 -0
- package/{esm → types}/filter/ast/expressions/parentheses-expression.d.ts +0 -0
- package/{esm → types}/filter/ast/index.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/boolean-literal.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/date-literal.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/external-constant.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/null-literal.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/number-literal.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/qualified-identifier.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/string-literal.d.ts +0 -0
- package/{esm → types}/filter/ast/terms/time-literal.d.ts +0 -0
- package/{esm → types}/filter/build.d.ts +0 -0
- package/{esm → types}/filter/errors.d.ts +0 -0
- package/{esm → types}/filter/filter-tree-visitor.d.ts +0 -0
- package/{esm → types}/filter/index.d.ts +0 -0
- package/{esm → types}/filter/opra-error-listener.d.ts +0 -0
- package/{esm → types}/filter/parse.d.ts +0 -0
- package/{esm → types}/filter/utils.d.ts +0 -0
- package/{esm → types}/helpers/function-utils.d.ts +0 -0
- package/{esm → types}/helpers/get-stack-filename.d.ts +0 -0
- package/{esm → types}/helpers/index.d.ts +0 -0
- package/{esm → types}/helpers/is-url.d.ts +0 -0
- package/{esm → types}/helpers/mixin-utils.d.ts +0 -0
- package/{esm → types}/helpers/object-utils.d.ts +0 -0
- package/{esm → types}/helpers/path-to-object-tree.d.ts +0 -0
- package/{esm → types}/helpers/responsive-map.d.ts +0 -0
- package/{esm → types}/helpers/type-guards.d.ts +0 -0
- package/{esm → types}/http/codecs/boolean-codec.d.ts +0 -0
- package/{esm → types}/http/codecs/date-codec.d.ts +0 -0
- package/{esm → types}/http/codecs/filter-codec.d.ts +0 -0
- package/{esm → types}/http/codecs/integer-codec.d.ts +0 -0
- package/{esm → types}/http/codecs/number-codec.d.ts +0 -0
- package/{esm → types}/http/codecs/string-codec.d.ts +0 -0
- package/{esm → types}/http/enums/http-headers-codes.enum.d.ts +0 -0
- package/{esm → types}/http/enums/http-status-codes.enum.d.ts +0 -0
- package/{esm → types}/http/enums/http-status-messages.d.ts +0 -0
- package/{esm → types}/http/http-headers.d.ts +0 -0
- package/{esm → types}/http/http-message.host.d.ts +0 -0
- package/{esm → types}/http/http-params.d.ts +0 -0
- package/{esm → types}/http/http-request-message.d.ts +0 -0
- package/{esm → types}/http/http-response-message.d.ts +0 -0
- package/{esm → types}/http/index.d.ts +0 -0
- package/{esm → types}/http/interfaces/client-http-headers.interface.d.ts +0 -0
- package/{esm → types}/http/interfaces/cookie-options.interface.d.ts +0 -0
- package/{esm → types}/http/interfaces/server-http-headers.interface.d.ts +0 -0
- package/{esm → types}/http/multipart/batch-multipart.d.ts +0 -0
- package/{esm → types}/http/multipart/http-request-content.d.ts +0 -0
- package/{esm → types}/http/multipart/http-response-content.d.ts +0 -0
- package/{esm → types}/http/multipart/index.d.ts +0 -0
- package/{esm → types}/i18n/i18n.d.ts +0 -0
- package/{esm → types}/i18n/index.d.ts +0 -0
- package/{esm → types}/i18n/string-utils.d.ts +0 -0
- package/{esm → types}/i18n/translate.d.ts +0 -0
- package/{esm → types}/index.d.ts +0 -0
- package/{esm → types}/schema/constants.d.ts +0 -0
- package/{esm → types}/schema/data-type/complex-type.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/data-type.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/enum-type.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/field.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/mapped-type.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/simple-type.interface.d.ts +0 -0
- package/{esm → types}/schema/data-type/union-type.interface.d.ts +0 -0
- package/{esm → types}/schema/document.interface.d.ts +0 -0
- package/{esm → types}/schema/index.d.ts +0 -0
- package/{esm → types}/schema/resource/container.interface.d.ts +0 -0
- package/{esm → types}/schema/resource/endpoint.interface.d.ts +0 -0
- package/{esm → types}/schema/resource/resource.interface.d.ts +0 -0
- package/{esm → types}/schema/resource/singleton.interface.d.ts +2 -2
- /package/{esm → types}/schema/type-guards.d.ts +0 -0
- /package/{esm → types}/types.d.ts +0 -0
- /package/{esm → types}/url/index.d.ts +0 -0
- /package/{esm → types}/url/opra-url-path-component.d.ts +0 -0
- /package/{esm → types}/url/opra-url-path.d.ts +0 -0
- /package/{esm → types}/url/utils/decode-path-component.d.ts +0 -0
- /package/{esm → types}/url/utils/encode-path-component.d.ts +0 -0
- /package/{esm → types}/utils/path-utils.d.ts +0 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterTreeVisitor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const antlr4_1 = tslib_1.__importDefault(require("@browsery/antlr4"));
|
|
6
|
+
const OpraFilterParser_js_1 = require("./antlr/OpraFilterParser.js");
|
|
7
|
+
const index_js_1 = require("./ast/index.js");
|
|
8
|
+
const external_constant_js_1 = require("./ast/terms/external-constant.js");
|
|
9
|
+
const errors_js_1 = require("./errors.js");
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
7
11
|
// Fix: antlr4 d.ts files are invalid
|
|
8
|
-
const ParseTreeVisitor =
|
|
9
|
-
|
|
12
|
+
const ParseTreeVisitor = antlr4_1.default.tree.ParseTreeVisitor;
|
|
13
|
+
class FilterTreeVisitor extends ParseTreeVisitor {
|
|
10
14
|
constructor(options) {
|
|
11
15
|
super();
|
|
12
16
|
this._timeZone = options?.timeZone;
|
|
@@ -27,31 +31,31 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
27
31
|
return ctx.getText();
|
|
28
32
|
}
|
|
29
33
|
visitNullLiteral() {
|
|
30
|
-
return new NullLiteral();
|
|
34
|
+
return new index_js_1.NullLiteral();
|
|
31
35
|
}
|
|
32
36
|
visitBooleanLiteral(ctx) {
|
|
33
|
-
return new BooleanLiteral(ctx.getText() === 'true');
|
|
37
|
+
return new index_js_1.BooleanLiteral(ctx.getText() === 'true');
|
|
34
38
|
}
|
|
35
39
|
visitNumberLiteral(ctx) {
|
|
36
|
-
return new NumberLiteral(ctx.getText());
|
|
40
|
+
return new index_js_1.NumberLiteral(ctx.getText());
|
|
37
41
|
}
|
|
38
42
|
visitStringLiteral(ctx) {
|
|
39
|
-
return new StringLiteral(unquoteFilterString(ctx.getText()));
|
|
43
|
+
return new index_js_1.StringLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
40
44
|
}
|
|
41
45
|
visitInfinityLiteral() {
|
|
42
|
-
return new NumberLiteral(Infinity);
|
|
46
|
+
return new index_js_1.NumberLiteral(Infinity);
|
|
43
47
|
}
|
|
44
48
|
visitDateLiteral(ctx) {
|
|
45
|
-
return new DateLiteral(unquoteFilterString(ctx.getText()));
|
|
49
|
+
return new index_js_1.DateLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
46
50
|
}
|
|
47
51
|
visitDateTimeLiteral(ctx) {
|
|
48
|
-
return new DateLiteral(unquoteFilterString(ctx.getText()));
|
|
52
|
+
return new index_js_1.DateLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
49
53
|
}
|
|
50
54
|
visitTimeLiteral(ctx) {
|
|
51
|
-
return new TimeLiteral(unquoteFilterString(ctx.getText()));
|
|
55
|
+
return new index_js_1.TimeLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
52
56
|
}
|
|
53
57
|
visitQualifiedIdentifierTerm(ctx) {
|
|
54
|
-
return new QualifiedIdentifier(ctx.getText());
|
|
58
|
+
return new index_js_1.QualifiedIdentifier(ctx.getText());
|
|
55
59
|
}
|
|
56
60
|
visitPolarityExpression(ctx) {
|
|
57
61
|
const x = this.visit(ctx.expression());
|
|
@@ -60,20 +64,20 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
60
64
|
x.value *= -1;
|
|
61
65
|
return x;
|
|
62
66
|
}
|
|
63
|
-
throw new SyntaxError('Unexpected token "' + ctx.getText() + '"');
|
|
67
|
+
throw new errors_js_1.SyntaxError('Unexpected token "' + ctx.getText() + '"');
|
|
64
68
|
}
|
|
65
69
|
visitExternalConstantTerm(ctx) {
|
|
66
|
-
return new ExternalConstant(ctx.externalConstant().getText().substring(1));
|
|
70
|
+
return new external_constant_js_1.ExternalConstant(ctx.externalConstant().getText().substring(1));
|
|
67
71
|
}
|
|
68
72
|
visitParenthesizedExpression(ctx) {
|
|
69
73
|
const expression = this.visit(ctx.expression());
|
|
70
|
-
return new ParenthesesExpression(expression);
|
|
74
|
+
return new index_js_1.ParenthesesExpression(expression);
|
|
71
75
|
}
|
|
72
76
|
visitArrayExpression(ctx) {
|
|
73
|
-
return new ArrayExpression(ctx.expression_list().map(child => this.visit(child)));
|
|
77
|
+
return new index_js_1.ArrayExpression(ctx.expression_list().map(child => this.visit(child)));
|
|
74
78
|
}
|
|
75
79
|
visitComparisonExpression(ctx) {
|
|
76
|
-
return new ComparisonExpression({
|
|
80
|
+
return new index_js_1.ComparisonExpression({
|
|
77
81
|
op: ctx.compOp().getText(),
|
|
78
82
|
left: this.visit(ctx.expression(0)),
|
|
79
83
|
right: this.visit(ctx.expression(1))
|
|
@@ -83,7 +87,7 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
83
87
|
const items = [];
|
|
84
88
|
const wrapChildren = (arr, op) => {
|
|
85
89
|
for (const c of arr) {
|
|
86
|
-
if (c instanceof LogicalExpressionContext && c.logOp().getText() === op) {
|
|
90
|
+
if (c instanceof OpraFilterParser_js_1.LogicalExpressionContext && c.logOp().getText() === op) {
|
|
87
91
|
wrapChildren(c.expression_list(), c.logOp().getText());
|
|
88
92
|
continue;
|
|
89
93
|
}
|
|
@@ -92,17 +96,17 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
98
|
wrapChildren(ctx.expression_list(), ctx.logOp().getText());
|
|
95
|
-
return new LogicalExpression({
|
|
99
|
+
return new index_js_1.LogicalExpression({
|
|
96
100
|
op: ctx.logOp().getText(),
|
|
97
101
|
items
|
|
98
102
|
});
|
|
99
103
|
}
|
|
100
104
|
visitArithmeticExpression(ctx) {
|
|
101
|
-
const exp = new ArithmeticExpression();
|
|
105
|
+
const exp = new index_js_1.ArithmeticExpression();
|
|
102
106
|
const wrapChildren = (children, op) => {
|
|
103
107
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
104
108
|
const child = children[i];
|
|
105
|
-
if (child instanceof ArithmeticExpressionContext) {
|
|
109
|
+
if (child instanceof OpraFilterParser_js_1.ArithmeticExpressionContext) {
|
|
106
110
|
wrapChildren(child.expression_list(), child.arthOp().getText());
|
|
107
111
|
continue;
|
|
108
112
|
}
|
|
@@ -114,3 +118,4 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
114
118
|
return exp;
|
|
115
119
|
}
|
|
116
120
|
}
|
|
121
|
+
exports.FilterTreeVisitor = FilterTreeVisitor;
|
package/esm/filter/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./ast/index.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./parse.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./build.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./opra-error-listener.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./filter-tree-visitor.js"), exports);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpraErrorListener = void 0;
|
|
4
|
+
const antlr4_1 = require("@browsery/antlr4");
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
class OpraErrorListener extends antlr4_1.ErrorListener {
|
|
4
7
|
constructor(errors) {
|
|
5
8
|
super();
|
|
6
9
|
this.errors = errors;
|
|
7
10
|
}
|
|
8
11
|
syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
|
|
9
|
-
this.errors.push(new FilterParseError(msg, { recognizer, offendingSymbol, line, column, e }));
|
|
12
|
+
this.errors.push(new errors_js_1.FilterParseError(msg, { recognizer, offendingSymbol, line, column, e }));
|
|
10
13
|
}
|
|
11
14
|
}
|
|
15
|
+
exports.OpraErrorListener = OpraErrorListener;
|
package/esm/filter/parse.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFilter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const antlr4_1 = require("@browsery/antlr4");
|
|
6
|
+
const OpraFilterLexer_js_1 = tslib_1.__importDefault(require("./antlr/OpraFilterLexer.js"));
|
|
7
|
+
const OpraFilterParser_js_1 = tslib_1.__importDefault(require("./antlr/OpraFilterParser.js"));
|
|
8
|
+
const errors_js_1 = require("./errors.js");
|
|
9
|
+
const filter_tree_visitor_js_1 = require("./filter-tree-visitor.js");
|
|
10
|
+
const opra_error_listener_js_1 = require("./opra-error-listener.js");
|
|
11
|
+
function parseFilter(text, visitor) {
|
|
12
|
+
const chars = new antlr4_1.CharStream(text);
|
|
13
|
+
const lexer = new OpraFilterLexer_js_1.default(chars);
|
|
14
|
+
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
|
|
15
|
+
const parser = new OpraFilterParser_js_1.default(tokenStream);
|
|
12
16
|
parser.buildParseTrees = true;
|
|
13
17
|
const errors = [];
|
|
14
|
-
const errorListener = new OpraErrorListener(errors);
|
|
18
|
+
const errorListener = new opra_error_listener_js_1.OpraErrorListener(errors);
|
|
15
19
|
lexer.removeErrorListeners();
|
|
16
20
|
lexer.addErrorListener(errorListener);
|
|
17
21
|
parser.removeErrorListeners();
|
|
18
22
|
parser.addErrorListener(errorListener);
|
|
19
23
|
const tree = parser.root();
|
|
20
|
-
visitor = visitor || new FilterTreeVisitor();
|
|
24
|
+
visitor = visitor || new filter_tree_visitor_js_1.FilterTreeVisitor();
|
|
21
25
|
const result = visitor.visit(tree);
|
|
22
26
|
if (errors.length) {
|
|
23
27
|
const errMsgs = [];
|
|
@@ -27,9 +31,10 @@ export function parseFilter(text, visitor) {
|
|
|
27
31
|
? (' at ' + 'line: ' + err.line + ' column: ' + err.column)
|
|
28
32
|
: (' at ' + ' column: ' + err.column)));
|
|
29
33
|
}
|
|
30
|
-
const e = new SyntaxError(errMsgs.join('\n'));
|
|
34
|
+
const e = new errors_js_1.SyntaxError(errMsgs.join('\n'));
|
|
31
35
|
e.errors = errors;
|
|
32
36
|
throw e;
|
|
33
37
|
}
|
|
34
38
|
return result;
|
|
35
39
|
}
|
|
40
|
+
exports.parseFilter = parseFilter;
|
package/esm/filter/utils.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unquoteFilterString = exports.quoteFilterString = void 0;
|
|
1
4
|
const quotesRegEx = /'/g;
|
|
2
5
|
const escapeRegEx = /(\\)/g;
|
|
3
6
|
const unescapeRegEx = /\\(.)/g;
|
|
@@ -7,15 +10,17 @@ function escapeString(s) {
|
|
|
7
10
|
function unescapeString(s) {
|
|
8
11
|
return s.replace(unescapeRegEx, '$1');
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
function quoteFilterString(s) {
|
|
11
14
|
return "'" +
|
|
12
15
|
escapeString(s).replace(quotesRegEx, '\\\'') +
|
|
13
16
|
"'";
|
|
14
17
|
}
|
|
15
|
-
|
|
18
|
+
exports.quoteFilterString = quoteFilterString;
|
|
19
|
+
function unquoteFilterString(s) {
|
|
16
20
|
if (s && (s.startsWith("'") || s.startsWith('"')) && s.endsWith(s.charAt(0))) {
|
|
17
21
|
return unescapeString(s.substring(1, s.length - 1));
|
|
18
22
|
}
|
|
19
23
|
/* istanbul ignore next */
|
|
20
24
|
return s;
|
|
21
25
|
}
|
|
26
|
+
exports.unquoteFilterString = unquoteFilterString;
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveClass = exports.resolveThunk = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify"));
|
|
6
|
+
const type_guards_js_1 = require("./type-guards.js");
|
|
7
|
+
async function resolveThunk(thunk) {
|
|
8
|
+
thunk = putil_promisify_1.default.isPromise(thunk) ? await thunk : thunk;
|
|
5
9
|
if (typeof thunk === 'function') {
|
|
6
|
-
if (isConstructor(thunk))
|
|
10
|
+
if ((0, type_guards_js_1.isConstructor)(thunk))
|
|
7
11
|
return thunk;
|
|
8
12
|
return resolveClass(thunk());
|
|
9
13
|
}
|
|
10
14
|
return thunk;
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
exports.resolveThunk = resolveThunk;
|
|
17
|
+
async function resolveClass(thunk) {
|
|
18
|
+
thunk = putil_promisify_1.default.isPromise(thunk) ? await thunk : thunk;
|
|
14
19
|
if (typeof thunk !== 'function')
|
|
15
20
|
throw new Error(`No Class type resolved`);
|
|
16
|
-
if (isConstructor(thunk))
|
|
21
|
+
if ((0, type_guards_js_1.isConstructor)(thunk))
|
|
17
22
|
return thunk;
|
|
18
23
|
return resolveClass(thunk());
|
|
19
24
|
}
|
|
25
|
+
exports.resolveClass = resolveClass;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStackFileName = void 0;
|
|
1
4
|
const PATH_PATTERN = /^(?:file:\/\/)?(.+)$/;
|
|
2
|
-
|
|
5
|
+
function getStackFileName(position = 1) {
|
|
3
6
|
if (position >= Error.stackTraceLimit) {
|
|
4
7
|
throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' +
|
|
5
8
|
position + '` and Error.stackTraceLimit was: `' + Error.stackTraceLimit + '`');
|
|
@@ -18,3 +21,4 @@ export function getStackFileName(position = 1) {
|
|
|
18
21
|
}
|
|
19
22
|
return '';
|
|
20
23
|
}
|
|
24
|
+
exports.getStackFileName = getStackFileName;
|
package/esm/helpers/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./function-utils.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./get-stack-filename.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./is-url.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./mixin-utils.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./object-utils.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./path-to-object-tree.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./responsive-map.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./type-guards.js"), exports);
|
package/esm/helpers/is-url.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUrl = void 0;
|
|
1
4
|
const URL_PATTERN = /^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;
|
|
2
|
-
|
|
5
|
+
function isUrl(url) {
|
|
3
6
|
return URL_PATTERN.test(url);
|
|
4
7
|
}
|
|
8
|
+
exports.isUrl = isUrl;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inheritPropertyInitializers = exports.applyMixins = void 0;
|
|
4
|
+
function applyMixins(derivedCtor, baseCtor, filter) {
|
|
2
5
|
for (const k of Object.getOwnPropertyNames(baseCtor.prototype)) {
|
|
3
6
|
if ((k === 'constructor' || k === '__proto__' || k === 'toJSON' || k === 'toString') ||
|
|
4
7
|
filter && !filter(k))
|
|
@@ -7,7 +10,8 @@ export function applyMixins(derivedCtor, baseCtor, filter) {
|
|
|
7
10
|
Object.create(null));
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.applyMixins = applyMixins;
|
|
14
|
+
function inheritPropertyInitializers(target, sourceClass,
|
|
11
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
16
|
isPropertyInherited = (key) => true) {
|
|
13
17
|
try {
|
|
@@ -25,3 +29,4 @@ isPropertyInherited = (key) => true) {
|
|
|
25
29
|
//
|
|
26
30
|
}
|
|
27
31
|
}
|
|
32
|
+
exports.inheritPropertyInitializers = inheritPropertyInitializers;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.omitUndefined = exports.cloneObject = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const putil_isplainobject_1 = tslib_1.__importDefault(require("putil-isplainobject"));
|
|
6
|
+
const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
|
|
7
|
+
function cloneObject(obj, jsonOnly) {
|
|
8
|
+
return (0, putil_merge_1.default)({}, obj, {
|
|
5
9
|
deep: true,
|
|
6
10
|
clone: true,
|
|
7
11
|
filter: (source, key) => {
|
|
8
12
|
const v = source[key];
|
|
9
13
|
return v != null &&
|
|
10
14
|
!jsonOnly || (typeof v !== 'function' &&
|
|
11
|
-
(typeof v !== 'object' ||
|
|
15
|
+
(typeof v !== 'object' || (0, putil_isplainobject_1.default)(v) || Array.isArray(v)));
|
|
12
16
|
}
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
|
-
|
|
19
|
+
exports.cloneObject = cloneObject;
|
|
20
|
+
function omitUndefined(obj) {
|
|
16
21
|
if (!(obj && typeof obj === 'object'))
|
|
17
22
|
return obj;
|
|
18
23
|
for (const k of Object.keys(obj)) {
|
|
@@ -23,3 +28,4 @@ export function omitUndefined(obj) {
|
|
|
23
28
|
}
|
|
24
29
|
return obj;
|
|
25
30
|
}
|
|
31
|
+
exports.omitUndefined = omitUndefined;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pathToObjectTree = void 0;
|
|
1
4
|
const DOT_PATTERN = /^([^.]+)\.(.*)$/;
|
|
2
|
-
|
|
5
|
+
function pathToObjectTree(arr, lowerCaseKeys) {
|
|
3
6
|
if (!(arr && arr.length))
|
|
4
7
|
return;
|
|
5
8
|
return _pathToObjectTree(arr, {}, lowerCaseKeys);
|
|
6
9
|
}
|
|
10
|
+
exports.pathToObjectTree = pathToObjectTree;
|
|
7
11
|
function _pathToObjectTree(arr, target, lowerCaseKeys) {
|
|
8
12
|
for (let k of arr) {
|
|
9
13
|
if (lowerCaseKeys)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var _a, _b, _c, _d;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ResponsiveMap = void 0;
|
|
2
5
|
function isMap(v) {
|
|
3
6
|
return v && typeof v.forEach === 'function';
|
|
4
7
|
}
|
|
@@ -9,7 +12,7 @@ const kOptions = Symbol('kOptions');
|
|
|
9
12
|
/**
|
|
10
13
|
* A Map implementation that supports case-insensitivity and ordered keys
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
class ResponsiveMap extends Map {
|
|
13
16
|
constructor(init, options) {
|
|
14
17
|
super();
|
|
15
18
|
this[_a] = new Map();
|
|
@@ -161,3 +164,4 @@ export class ResponsiveMap extends Map {
|
|
|
161
164
|
return key.toLowerCase();
|
|
162
165
|
}
|
|
163
166
|
}
|
|
167
|
+
exports.ResponsiveMap = ResponsiveMap;
|
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isURL = exports.isFormData = exports.isBlob = exports.isReadableStream = exports.isReadable = exports.isStream = exports.isConstructor = void 0;
|
|
4
|
+
function isConstructor(fn) {
|
|
2
5
|
return typeof fn === 'function' && fn.prototype &&
|
|
3
6
|
fn.prototype.constructor === fn &&
|
|
4
7
|
fn.prototype.constructor.name !== 'Function' &&
|
|
5
8
|
fn.prototype.constructor.name !== 'anonymous';
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
exports.isConstructor = isConstructor;
|
|
11
|
+
function isStream(stream) {
|
|
8
12
|
return stream !== null
|
|
9
13
|
&& typeof stream === 'object'
|
|
10
14
|
&& typeof stream.pipe === 'function';
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
exports.isStream = isStream;
|
|
17
|
+
function isReadable(x) {
|
|
13
18
|
return isStream(x)
|
|
14
19
|
&& x.readable !== false
|
|
15
20
|
&& typeof x._read === 'function'
|
|
16
21
|
&& typeof x._readableState === 'object';
|
|
17
22
|
}
|
|
18
|
-
|
|
23
|
+
exports.isReadable = isReadable;
|
|
24
|
+
function isReadableStream(x) {
|
|
19
25
|
return isStream(x)
|
|
20
26
|
&& x.readable !== false
|
|
21
27
|
&& typeof x.getReader === 'function'
|
|
22
28
|
&& typeof x.pipeThrough === 'function'
|
|
23
29
|
&& typeof x.pipeTo === 'function';
|
|
24
30
|
}
|
|
25
|
-
|
|
31
|
+
exports.isReadableStream = isReadableStream;
|
|
32
|
+
function isBlob(x) {
|
|
26
33
|
return x !== null
|
|
27
34
|
&& typeof x === 'object'
|
|
28
35
|
&& typeof x.size === 'number'
|
|
29
36
|
&& typeof x.arrayBuffer === 'function'
|
|
30
37
|
&& typeof x.stream === 'function';
|
|
31
38
|
}
|
|
32
|
-
|
|
39
|
+
exports.isBlob = isBlob;
|
|
40
|
+
function isFormData(x) {
|
|
33
41
|
return x !== null
|
|
34
42
|
&& typeof x.constructor === 'function'
|
|
35
43
|
&& x.constructor.name === 'FormData'
|
|
36
44
|
&& typeof x.append === 'function'
|
|
37
45
|
&& typeof x.getAll === 'function';
|
|
38
46
|
}
|
|
39
|
-
|
|
47
|
+
exports.isFormData = isFormData;
|
|
48
|
+
function isURL(x) {
|
|
40
49
|
return x !== null
|
|
41
50
|
&& typeof x.host === 'string'
|
|
42
51
|
&& typeof x.href === 'string';
|
|
43
52
|
}
|
|
53
|
+
exports.isURL = isURL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BooleanCodec = void 0;
|
|
1
4
|
const trueValues = ['true', 't', 'yes', 'y', '1'];
|
|
2
5
|
const falseValues = ['false', 'f', 'no', 'n', '0'];
|
|
3
|
-
|
|
6
|
+
class BooleanCodec {
|
|
4
7
|
decode(value) {
|
|
5
8
|
if (value === '')
|
|
6
9
|
return true;
|
|
@@ -18,3 +21,4 @@ export class BooleanCodec {
|
|
|
18
21
|
(value ? 'true' : 'false') : '';
|
|
19
22
|
}
|
|
20
23
|
}
|
|
24
|
+
exports.BooleanCodec = BooleanCodec;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateCodec = void 0;
|
|
1
4
|
// noinspection RegExpUnnecessaryNonCapturingGroup
|
|
2
5
|
const DATE_FORMAT_PATTERN = /^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;
|
|
3
|
-
|
|
6
|
+
class DateCodec {
|
|
4
7
|
constructor(options) {
|
|
5
8
|
this.max = options?.max ? coerceToDateString(options.max) : undefined;
|
|
6
9
|
this.min = options?.min ? coerceToDateString(options.min) : undefined;
|
|
@@ -19,6 +22,7 @@ export class DateCodec {
|
|
|
19
22
|
return coerceToDateString(value, this.time, this.timeZone);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
25
|
+
exports.DateCodec = DateCodec;
|
|
22
26
|
function coerceToDateString(value, time, timeZone) {
|
|
23
27
|
if (value === '' || value == null)
|
|
24
28
|
return '';
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterCodec = void 0;
|
|
4
|
+
const index_js_1 = require("../../filter/ast/index.js");
|
|
5
|
+
const parse_js_1 = require("../../filter/parse.js");
|
|
6
|
+
class FilterCodec {
|
|
4
7
|
decode(value) {
|
|
5
|
-
if (value instanceof Expression)
|
|
8
|
+
if (value instanceof index_js_1.Expression)
|
|
6
9
|
return value;
|
|
7
|
-
return parseFilter(value);
|
|
10
|
+
return (0, parse_js_1.parseFilter)(value);
|
|
8
11
|
}
|
|
9
12
|
encode(value) {
|
|
10
13
|
// @ts-ignore
|
|
11
14
|
return value ? '' + value : '';
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
exports.FilterCodec = FilterCodec;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegerCodec = void 0;
|
|
4
|
+
const number_codec_js_1 = require("./number-codec.js");
|
|
5
|
+
class IntegerCodec extends number_codec_js_1.NumberCodec {
|
|
3
6
|
constructor(options) {
|
|
4
7
|
super(options);
|
|
5
8
|
this.enum = options?.enum;
|
|
@@ -13,3 +16,4 @@ export class IntegerCodec extends NumberCodec {
|
|
|
13
16
|
return v;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
19
|
+
exports.IntegerCodec = IntegerCodec;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberCodec = void 0;
|
|
4
|
+
class NumberCodec {
|
|
2
5
|
constructor(options) {
|
|
3
6
|
this.max = options?.max;
|
|
4
7
|
this.min = options?.min;
|
|
@@ -18,3 +21,4 @@ export class NumberCodec {
|
|
|
18
21
|
return typeof value === 'number' ? '' + value : '';
|
|
19
22
|
}
|
|
20
23
|
}
|
|
24
|
+
exports.NumberCodec = NumberCodec;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringCodec = void 0;
|
|
4
|
+
class StringCodec {
|
|
2
5
|
constructor(options) {
|
|
3
6
|
this.maxLength = options?.maxLength;
|
|
4
7
|
this.minLength = options?.minLength;
|
|
@@ -17,3 +20,4 @@ export class StringCodec {
|
|
|
17
20
|
return value == null ? '' : '' + value;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
exports.StringCodec = StringCodec;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// noinspection JSUnusedGlobalSymbols
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.HttpHeaderCodes = void 0;
|
|
2
5
|
/**
|
|
3
6
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#controls
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
var HttpHeaderCodes;
|
|
6
9
|
(function (HttpHeaderCodes) {
|
|
7
10
|
/* *** Opra Headers *** */
|
|
8
11
|
HttpHeaderCodes["X_Opra_Version"] = "X-OPRA-Version";
|
|
@@ -407,4 +410,4 @@ export var HttpHeaderCodes;
|
|
|
407
410
|
*
|
|
408
411
|
*/
|
|
409
412
|
HttpHeaderCodes["Max_Forwards"] = "Max-Forwards";
|
|
410
|
-
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
413
|
+
})(HttpHeaderCodes = exports.HttpHeaderCodes || (exports.HttpHeaderCodes = {}));
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// noinspection JSUnusedGlobalSymbols
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.HttpStatusCodes = void 0;
|
|
2
5
|
/**
|
|
3
6
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
var HttpStatusCodes;
|
|
6
9
|
(function (HttpStatusCodes) {
|
|
7
10
|
/* *** Information responses *** */
|
|
8
11
|
/**
|
|
@@ -294,4 +297,4 @@ export var HttpStatusCodes;
|
|
|
294
297
|
* Indicates that the client needs to authenticate to gain network access.
|
|
295
298
|
*/
|
|
296
299
|
HttpStatusCodes[HttpStatusCodes["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
297
|
-
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
300
|
+
})(HttpStatusCodes = exports.HttpStatusCodes || (exports.HttpStatusCodes = {}));
|