@opra/common 0.15.0 → 0.16.1
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,5 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
// Generated from ./src/filter/antlr/OpraFilter.g4 by ANTLR 4.11.2-SNAPSHOT
|
|
2
|
-
|
|
4
|
+
const antlr4_1 = require("@browsery/antlr4");
|
|
3
5
|
/**
|
|
4
6
|
* This interface defines a complete generic visitor for a parse tree produced
|
|
5
7
|
* by `OpraFilterParser`.
|
|
@@ -7,5 +9,6 @@ import { ParseTreeVisitor } from '@browsery/antlr4';
|
|
|
7
9
|
* @param <Result> The return type of the visit operation. Use `void` for
|
|
8
10
|
* operations with no return type.
|
|
9
11
|
*/
|
|
10
|
-
|
|
12
|
+
class OpraFilterVisitor extends antlr4_1.ParseTreeVisitor {
|
|
11
13
|
}
|
|
14
|
+
exports.default = OpraFilterVisitor;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Expression = void 0;
|
|
4
|
+
const ast_js_1 = require("./ast.js");
|
|
5
|
+
class Expression extends ast_js_1.Ast {
|
|
3
6
|
}
|
|
7
|
+
exports.Expression = Expression;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Literal = void 0;
|
|
4
|
+
const term_js_1 = require("./term.js");
|
|
5
|
+
class Literal extends term_js_1.Term {
|
|
3
6
|
constructor(value) {
|
|
4
7
|
super();
|
|
5
8
|
this.value = value;
|
|
@@ -8,3 +11,4 @@ export class Literal extends Term {
|
|
|
8
11
|
return '' + this.value;
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
exports.Literal = Literal;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Term = void 0;
|
|
4
|
+
const expression_js_1 = require("./expression.js");
|
|
5
|
+
class Term extends expression_js_1.Expression {
|
|
3
6
|
}
|
|
7
|
+
exports.Term = Term;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArithmeticExpressionItem = exports.ArithmeticExpression = void 0;
|
|
4
|
+
const expression_js_1 = require("../abstract/expression.js");
|
|
5
|
+
class ArithmeticExpression extends expression_js_1.Expression {
|
|
3
6
|
constructor() {
|
|
4
7
|
super();
|
|
5
8
|
this.items = [];
|
|
@@ -15,8 +18,10 @@ export class ArithmeticExpression extends Expression {
|
|
|
15
18
|
return this.items.map((child, i) => (i > 0 ? child.op : '') + child.expression).join('');
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
exports.ArithmeticExpression = ArithmeticExpression;
|
|
22
|
+
class ArithmeticExpressionItem {
|
|
19
23
|
constructor(o) {
|
|
20
24
|
Object.assign(this, o);
|
|
21
25
|
}
|
|
22
26
|
}
|
|
27
|
+
exports.ArithmeticExpressionItem = ArithmeticExpressionItem;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayExpression = void 0;
|
|
4
|
+
const term_js_1 = require("../abstract/term.js");
|
|
5
|
+
class ArrayExpression extends term_js_1.Term {
|
|
3
6
|
constructor(items) {
|
|
4
7
|
super();
|
|
5
8
|
this.items = items;
|
|
@@ -8,3 +11,4 @@ export class ArrayExpression extends Term {
|
|
|
8
11
|
return '[' + this.items.map(child => '' + child).join(',') + ']';
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
exports.ArrayExpression = ArrayExpression;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComparisonExpression = void 0;
|
|
4
|
+
const expression_js_1 = require("../abstract/expression.js");
|
|
2
5
|
const WORD_PATTERN = /\w/;
|
|
3
|
-
|
|
6
|
+
class ComparisonExpression extends expression_js_1.Expression {
|
|
4
7
|
constructor(o) {
|
|
5
8
|
super();
|
|
6
9
|
Object.assign(this, o);
|
|
@@ -9,3 +12,4 @@ export class ComparisonExpression extends Expression {
|
|
|
9
12
|
return `${this.left}${WORD_PATTERN.test(this.op) ? ' ' + this.op + ' ' : this.op}${this.right}`;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
15
|
+
exports.ComparisonExpression = ComparisonExpression;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogicalExpression = void 0;
|
|
4
|
+
const expression_js_1 = require("../abstract/expression.js");
|
|
5
|
+
class LogicalExpression extends expression_js_1.Expression {
|
|
3
6
|
constructor(o) {
|
|
4
7
|
super();
|
|
5
8
|
Object.assign(this, o);
|
|
@@ -10,3 +13,4 @@ export class LogicalExpression extends Expression {
|
|
|
10
13
|
.join(' ' + this.op + ' ');
|
|
11
14
|
}
|
|
12
15
|
}
|
|
16
|
+
exports.LogicalExpression = LogicalExpression;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParenthesesExpression = void 0;
|
|
4
|
+
const expression_js_1 = require("../abstract/expression.js");
|
|
5
|
+
class ParenthesesExpression extends expression_js_1.Expression {
|
|
3
6
|
constructor(expression) {
|
|
4
7
|
super();
|
|
5
8
|
this.expression = expression;
|
|
@@ -8,3 +11,4 @@ export class ParenthesesExpression extends Expression {
|
|
|
8
11
|
return `(${this.expression})`;
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
exports.ParenthesesExpression = ParenthesesExpression;
|
package/esm/filter/ast/index.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./abstract/ast.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./abstract/expression.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./abstract/literal.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./abstract/term.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./expressions/arithmetic-expression.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./expressions/array-expression.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./expressions/comparison-expression.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./expressions/logical-expression.js"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./expressions/parentheses-expression.js"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./terms/boolean-literal.js"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./terms/date-literal.js"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./terms/null-literal.js"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./terms/number-literal.js"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./terms/qualified-identifier.js"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./terms/string-literal.js"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./terms/time-literal.js"), exports);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BooleanLiteral = void 0;
|
|
4
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
5
|
+
class BooleanLiteral extends literal_js_1.Literal {
|
|
3
6
|
constructor(value) {
|
|
4
7
|
super(value);
|
|
5
8
|
}
|
|
6
9
|
}
|
|
10
|
+
exports.BooleanLiteral = BooleanLiteral;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateLiteral = void 0;
|
|
4
|
+
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
5
|
+
const errors_js_1 = require("../../errors.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
5
8
|
// const DATE_PATTERN = /^(\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)/;
|
|
6
9
|
const NullDate = new Date(0);
|
|
7
|
-
|
|
10
|
+
class DateLiteral extends literal_js_1.Literal {
|
|
8
11
|
constructor(value) {
|
|
9
12
|
super('');
|
|
10
13
|
if (value instanceof Date) {
|
|
@@ -12,13 +15,14 @@ export class DateLiteral extends Literal {
|
|
|
12
15
|
return;
|
|
13
16
|
}
|
|
14
17
|
// noinspection SuspiciousTypeOfGuard
|
|
15
|
-
if (typeof value === 'string' && toDateDef(value, NullDate) !== NullDate) {
|
|
18
|
+
if (typeof value === 'string' && (0, putil_varhelpers_1.toDateDef)(value, NullDate) !== NullDate) {
|
|
16
19
|
this.value = value;
|
|
17
20
|
return;
|
|
18
21
|
}
|
|
19
|
-
throw new ValidationError(`Invalid date value "${value}"`);
|
|
22
|
+
throw new errors_js_1.ValidationError(`Invalid date value "${value}"`);
|
|
20
23
|
}
|
|
21
24
|
toString() {
|
|
22
|
-
return quoteFilterString(this.value);
|
|
25
|
+
return (0, utils_js_1.quoteFilterString)(this.value);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
28
|
+
exports.DateLiteral = DateLiteral;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExternalConstant = void 0;
|
|
4
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
5
|
+
class ExternalConstant extends literal_js_1.Literal {
|
|
3
6
|
constructor(value) {
|
|
4
7
|
super('' + value);
|
|
5
8
|
}
|
|
@@ -7,3 +10,4 @@ export class ExternalConstant extends Literal {
|
|
|
7
10
|
return '@' + super.toString();
|
|
8
11
|
}
|
|
9
12
|
}
|
|
13
|
+
exports.ExternalConstant = ExternalConstant;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NullLiteral = void 0;
|
|
4
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
5
|
+
class NullLiteral extends literal_js_1.Literal {
|
|
3
6
|
constructor() {
|
|
4
7
|
super(null);
|
|
5
8
|
this.value = null;
|
|
6
9
|
}
|
|
7
10
|
}
|
|
11
|
+
exports.NullLiteral = NullLiteral;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberLiteral = void 0;
|
|
4
|
+
const errors_js_1 = require("../../errors.js");
|
|
5
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
6
|
+
class NumberLiteral extends literal_js_1.Literal {
|
|
4
7
|
constructor(value) {
|
|
5
8
|
super(0);
|
|
6
9
|
if (typeof value === 'number' || typeof value === 'bigint') {
|
|
@@ -25,7 +28,7 @@ export class NumberLiteral extends Literal {
|
|
|
25
28
|
catch {
|
|
26
29
|
//
|
|
27
30
|
}
|
|
28
|
-
throw new ValidationError(`Invalid number literal ${value}`);
|
|
31
|
+
throw new errors_js_1.ValidationError(`Invalid number literal ${value}`);
|
|
29
32
|
}
|
|
30
33
|
toString() {
|
|
31
34
|
return typeof this.value === 'bigint'
|
|
@@ -33,3 +36,4 @@ export class NumberLiteral extends Literal {
|
|
|
33
36
|
: ('' + this.value);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
39
|
+
exports.NumberLiteral = NumberLiteral;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QualifiedIdentifier = void 0;
|
|
4
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
5
|
+
class QualifiedIdentifier extends literal_js_1.Literal {
|
|
3
6
|
constructor(value) {
|
|
4
7
|
super('' + value);
|
|
5
8
|
}
|
|
6
9
|
}
|
|
10
|
+
exports.QualifiedIdentifier = QualifiedIdentifier;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringLiteral = void 0;
|
|
4
|
+
const utils_js_1 = require("../../utils.js");
|
|
5
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
6
|
+
class StringLiteral extends literal_js_1.Literal {
|
|
4
7
|
constructor(value) {
|
|
5
8
|
super('' + value);
|
|
6
9
|
}
|
|
7
10
|
toString() {
|
|
8
|
-
return quoteFilterString(this.value);
|
|
11
|
+
return (0, utils_js_1.quoteFilterString)(this.value);
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
exports.StringLiteral = StringLiteral;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeLiteral = void 0;
|
|
4
|
+
const errors_js_1 = require("../../errors.js");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
const literal_js_1 = require("../abstract/literal.js");
|
|
4
7
|
const TIME_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;
|
|
5
|
-
|
|
8
|
+
class TimeLiteral extends literal_js_1.Literal {
|
|
6
9
|
constructor(value) {
|
|
7
10
|
super('');
|
|
8
11
|
if (value instanceof Date) {
|
|
@@ -17,12 +20,13 @@ export class TimeLiteral extends Literal {
|
|
|
17
20
|
this.value = value;
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
|
-
throw new ValidationError(`Invalid time value "${value}"`);
|
|
23
|
+
throw new errors_js_1.ValidationError(`Invalid time value "${value}"`);
|
|
21
24
|
}
|
|
22
25
|
toString() {
|
|
23
|
-
return quoteFilterString(this.value);
|
|
26
|
+
return (0, utils_js_1.quoteFilterString)(this.value);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
exports.TimeLiteral = TimeLiteral;
|
|
26
30
|
function pad(n) {
|
|
27
31
|
return n <= 9 ? '0' + n : '' + n;
|
|
28
32
|
}
|
package/esm/filter/build.js
CHANGED
|
@@ -1,66 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return new LogicalExpression({ op: '
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return new
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$arithmetic = exports.$paren = exports.$notILike = exports.$ilike = exports.$notLike = exports.$like = exports.$notIn = exports.$in = exports.$lte = exports.$lt = exports.$gte = exports.$gt = exports.$ne = exports.$eq = exports.$field = exports.$array = exports.$number = exports.$time = exports.$date = exports.$and = exports.$or = void 0;
|
|
4
|
+
const index_js_1 = require("./ast/index.js");
|
|
5
|
+
function $or(...items) {
|
|
6
|
+
return new index_js_1.LogicalExpression({ op: 'or', items });
|
|
7
|
+
}
|
|
8
|
+
exports.$or = $or;
|
|
9
|
+
function $and(...items) {
|
|
10
|
+
return new index_js_1.LogicalExpression({ op: 'and', items });
|
|
11
|
+
}
|
|
12
|
+
exports.$and = $and;
|
|
13
|
+
function $date(v) {
|
|
14
|
+
return new index_js_1.DateLiteral(v);
|
|
15
|
+
}
|
|
16
|
+
exports.$date = $date;
|
|
17
|
+
function $time(v) {
|
|
18
|
+
return new index_js_1.TimeLiteral(v);
|
|
19
|
+
}
|
|
20
|
+
exports.$time = $time;
|
|
21
|
+
function $number(v) {
|
|
22
|
+
return new index_js_1.NumberLiteral(v);
|
|
23
|
+
}
|
|
24
|
+
exports.$number = $number;
|
|
25
|
+
function $array(...items) {
|
|
26
|
+
return new index_js_1.ArrayExpression(items.map(wrapEntryValue));
|
|
27
|
+
}
|
|
28
|
+
exports.$array = $array;
|
|
29
|
+
function $field(v) {
|
|
30
|
+
return new index_js_1.QualifiedIdentifier(v);
|
|
31
|
+
}
|
|
32
|
+
exports.$field = $field;
|
|
33
|
+
function $eq(left, right) {
|
|
24
34
|
return comparisonExpression('=', left, right);
|
|
25
35
|
}
|
|
26
|
-
|
|
36
|
+
exports.$eq = $eq;
|
|
37
|
+
function $ne(left, right) {
|
|
27
38
|
return comparisonExpression('!=', left, right);
|
|
28
39
|
}
|
|
29
|
-
|
|
40
|
+
exports.$ne = $ne;
|
|
41
|
+
function $gt(left, right) {
|
|
30
42
|
return comparisonExpression('>', left, right);
|
|
31
43
|
}
|
|
32
|
-
|
|
44
|
+
exports.$gt = $gt;
|
|
45
|
+
function $gte(left, right) {
|
|
33
46
|
return comparisonExpression('>=', left, right);
|
|
34
47
|
}
|
|
35
|
-
|
|
48
|
+
exports.$gte = $gte;
|
|
49
|
+
function $lt(left, right) {
|
|
36
50
|
return comparisonExpression('<', left, right);
|
|
37
51
|
}
|
|
38
|
-
|
|
52
|
+
exports.$lt = $lt;
|
|
53
|
+
function $lte(left, right) {
|
|
39
54
|
return comparisonExpression('<=', left, right);
|
|
40
55
|
}
|
|
41
|
-
|
|
56
|
+
exports.$lte = $lte;
|
|
57
|
+
function $in(left, right) {
|
|
42
58
|
return comparisonExpression('in', left, right);
|
|
43
59
|
}
|
|
44
|
-
|
|
60
|
+
exports.$in = $in;
|
|
61
|
+
function $notIn(left, right) {
|
|
45
62
|
return comparisonExpression('!in', left, right);
|
|
46
63
|
}
|
|
47
|
-
|
|
64
|
+
exports.$notIn = $notIn;
|
|
65
|
+
function $like(left, right) {
|
|
48
66
|
return comparisonExpression('like', left, right);
|
|
49
67
|
}
|
|
50
|
-
|
|
68
|
+
exports.$like = $like;
|
|
69
|
+
function $notLike(left, right) {
|
|
51
70
|
return comparisonExpression('!like', left, right);
|
|
52
71
|
}
|
|
53
|
-
|
|
72
|
+
exports.$notLike = $notLike;
|
|
73
|
+
function $ilike(left, right) {
|
|
54
74
|
return comparisonExpression('ilike', left, right);
|
|
55
75
|
}
|
|
56
|
-
|
|
76
|
+
exports.$ilike = $ilike;
|
|
77
|
+
function $notILike(left, right) {
|
|
57
78
|
return comparisonExpression('!ilike', left, right);
|
|
58
79
|
}
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
exports.$notILike = $notILike;
|
|
81
|
+
function $paren(expression) {
|
|
82
|
+
return new index_js_1.ParenthesesExpression(expression);
|
|
61
83
|
}
|
|
62
|
-
|
|
63
|
-
|
|
84
|
+
exports.$paren = $paren;
|
|
85
|
+
function $arithmetic(n) {
|
|
86
|
+
const exp = new index_js_1.ArithmeticExpression();
|
|
64
87
|
exp.add = (expression) => {
|
|
65
88
|
exp.append('+', _wrapEntryValue(expression));
|
|
66
89
|
return exp;
|
|
@@ -80,10 +103,11 @@ export function $arithmetic(n) {
|
|
|
80
103
|
exp.append('+', wrapEntryValue(n));
|
|
81
104
|
return exp;
|
|
82
105
|
}
|
|
106
|
+
exports.$arithmetic = $arithmetic;
|
|
83
107
|
function comparisonExpression(op, left, right) {
|
|
84
108
|
const lex = wrapEntryValue(left);
|
|
85
109
|
const rex = wrapEntryValue(right);
|
|
86
|
-
return new ComparisonExpression({ op, left: lex, right: rex });
|
|
110
|
+
return new index_js_1.ComparisonExpression({ op, left: lex, right: rex });
|
|
87
111
|
}
|
|
88
112
|
const wrapEntryValue = (v) => {
|
|
89
113
|
return Array.isArray(v)
|
|
@@ -91,15 +115,15 @@ const wrapEntryValue = (v) => {
|
|
|
91
115
|
: _wrapEntryValue(v);
|
|
92
116
|
};
|
|
93
117
|
const _wrapEntryValue = (v) => {
|
|
94
|
-
if (v instanceof Expression)
|
|
118
|
+
if (v instanceof index_js_1.Expression)
|
|
95
119
|
return v;
|
|
96
120
|
if (typeof v === 'boolean')
|
|
97
|
-
return new BooleanLiteral(v);
|
|
121
|
+
return new index_js_1.BooleanLiteral(v);
|
|
98
122
|
if (typeof v === 'number' || typeof v === 'bigint')
|
|
99
|
-
return new NumberLiteral(v);
|
|
123
|
+
return new index_js_1.NumberLiteral(v);
|
|
100
124
|
if (v == null)
|
|
101
|
-
return new NullLiteral();
|
|
125
|
+
return new index_js_1.NullLiteral();
|
|
102
126
|
if (v instanceof Date)
|
|
103
|
-
return new DateLiteral(v);
|
|
104
|
-
return new StringLiteral('' + v);
|
|
127
|
+
return new index_js_1.DateLiteral(v);
|
|
128
|
+
return new index_js_1.StringLiteral('' + v);
|
|
105
129
|
};
|
package/esm/filter/errors.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterParseError = exports.ValidationError = exports.SyntaxError = void 0;
|
|
4
|
+
class SyntaxError extends TypeError {
|
|
2
5
|
}
|
|
3
|
-
|
|
6
|
+
exports.SyntaxError = SyntaxError;
|
|
7
|
+
class ValidationError extends TypeError {
|
|
4
8
|
}
|
|
5
|
-
|
|
9
|
+
exports.ValidationError = ValidationError;
|
|
10
|
+
class FilterParseError extends Error {
|
|
6
11
|
constructor(message, args) {
|
|
7
12
|
super(message);
|
|
8
13
|
Object.assign(this, args);
|
|
9
14
|
}
|
|
10
15
|
}
|
|
16
|
+
exports.FilterParseError = FilterParseError;
|