@opra/common 0.5.0 → 0.6.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/constants.js +1 -0
- package/cjs/exception/enums/issue-severity.enum.js +23 -0
- package/cjs/{types.js → exception/error-issue.js} +0 -0
- package/cjs/exception/http-errors/bad-request.error.js +22 -0
- package/cjs/exception/http-errors/failed-dependency.error.js +21 -0
- package/cjs/exception/http-errors/forbidden.error.js +23 -0
- package/cjs/exception/http-errors/internal-server.error.js +21 -0
- package/cjs/exception/http-errors/method-not-allowed.error.js +22 -0
- package/cjs/exception/http-errors/not-acceptable.error.js +22 -0
- package/cjs/exception/http-errors/not-found.error.js +25 -0
- package/cjs/exception/http-errors/unauthorized.error.js +22 -0
- package/cjs/exception/http-errors/unprocessable-entity.error.js +21 -0
- package/cjs/exception/index.js +18 -0
- package/cjs/exception/opra-exception.js +56 -0
- package/cjs/exception/resource-errors/resource-conflict.error.js +20 -0
- package/cjs/exception/resource-errors/resource-not-found.error.js +20 -0
- package/cjs/exception/wrap-exception.js +42 -0
- package/cjs/filter/antlr/OpraFilterLexer.js +386 -0
- package/cjs/filter/antlr/OpraFilterParser.js +2070 -0
- package/cjs/filter/antlr/OpraFilterVisitor.js +3 -0
- package/cjs/filter/ast/abstract/ast.js +10 -0
- package/cjs/filter/ast/abstract/expression.js +7 -0
- package/cjs/filter/ast/abstract/literal.js +14 -0
- package/cjs/filter/ast/abstract/term.js +7 -0
- package/cjs/filter/ast/expressions/arithmetic-expression.js +29 -0
- package/cjs/filter/ast/expressions/array-expression.js +15 -0
- package/cjs/filter/ast/expressions/comparison-expression.js +18 -0
- package/cjs/filter/ast/expressions/logical-expression.js +18 -0
- package/cjs/filter/ast/expressions/parentheses-expression.js +15 -0
- package/cjs/filter/ast/index.js +19 -0
- package/cjs/filter/ast/terms/boolean-literal.js +10 -0
- package/cjs/filter/ast/terms/date-literal.js +28 -0
- package/cjs/filter/ast/terms/external-constant.js +13 -0
- package/cjs/filter/ast/terms/null-literal.js +11 -0
- package/cjs/filter/ast/terms/number-literal.js +40 -0
- package/cjs/filter/ast/terms/qualified-identifier.js +10 -0
- package/cjs/filter/ast/terms/string-literal.js +14 -0
- package/cjs/filter/ast/terms/time-literal.js +33 -0
- package/cjs/filter/build.js +129 -0
- package/cjs/filter/error-listener.js +14 -0
- package/cjs/filter/errors.js +21 -0
- package/cjs/filter/filter-tree-visitor.js +113 -0
- package/cjs/filter/index.js +8 -0
- package/cjs/filter/parse.js +37 -0
- package/cjs/filter/utils.js +26 -0
- package/cjs/helpers/index.js +4 -0
- package/cjs/{classes → helpers}/responsive-map.js +1 -1
- package/cjs/{enums → http/enums}/http-headers.enum.js +9 -0
- package/cjs/{enums → http/enums}/http-status.enum.js +0 -0
- package/cjs/http/http-request.js +118 -0
- package/cjs/http/index.js +9 -0
- package/cjs/http/interfaces/client-http-headers.interface.js +2 -0
- package/cjs/http/interfaces/server-http-headers.interface.js +2 -0
- package/cjs/http/multipart/batch-multipart.js +155 -0
- package/cjs/http/multipart/http-request-content.js +16 -0
- package/cjs/http/multipart/http-response-content.js +14 -0
- package/cjs/http/multipart/index.js +4 -0
- package/cjs/http/utils/normalize-headers.js +28 -0
- package/cjs/i18n/i18n.js +175 -0
- package/cjs/i18n/index.js +10 -0
- package/cjs/i18n/string-utils.js +13 -0
- package/cjs/i18n/translate.js +15 -0
- package/cjs/index.js +12 -5
- package/cjs/schema/constants.js +11 -0
- package/cjs/schema/decorators/opr-collection-resource.decorator.js +23 -0
- package/cjs/schema/decorators/opr-complex-type.decorator.js +27 -0
- package/cjs/schema/decorators/opr-field.decorator.js +28 -0
- package/cjs/schema/decorators/opr-resolver.decorator.js +81 -0
- package/cjs/schema/decorators/opr-simple-type.decorator.js +18 -0
- package/cjs/schema/decorators/opr-singleton-resource.decorator.js +23 -0
- package/cjs/schema/implementation/data-type/builtin/any.type.js +9 -0
- package/cjs/schema/implementation/data-type/builtin/base64-binary.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/bigint.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/boolean.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/date-string.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/date.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/guid.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/integer.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/number.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/object.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/string.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin-data-types.js +37 -0
- package/cjs/schema/implementation/data-type/complex-type.js +111 -0
- package/cjs/schema/implementation/data-type/data-type.js +36 -0
- package/cjs/schema/implementation/data-type/simple-type.js +21 -0
- package/cjs/schema/implementation/data-type/union-type.js +25 -0
- package/cjs/schema/implementation/document-builder.js +140 -0
- package/cjs/schema/implementation/opra-document.js +181 -0
- package/cjs/schema/implementation/query/collection-count-query.js +19 -0
- package/cjs/schema/implementation/query/collection-create-query.js +28 -0
- package/cjs/schema/implementation/query/collection-delete-many-query.js +19 -0
- package/cjs/schema/implementation/query/collection-delete-query.js +27 -0
- package/cjs/schema/implementation/query/collection-get-query.js +38 -0
- package/cjs/schema/implementation/query/collection-search-query.js +55 -0
- package/cjs/schema/implementation/query/collection-update-many-query.js +21 -0
- package/cjs/schema/implementation/query/collection-update-query.js +39 -0
- package/cjs/schema/implementation/query/field-get-query.js +45 -0
- package/cjs/schema/implementation/query/index.js +22 -0
- package/cjs/schema/implementation/query/singleton-get-query.js +27 -0
- package/cjs/schema/implementation/resource/collection-resource-info.js +58 -0
- package/cjs/schema/implementation/resource/container-resource-info.js +30 -0
- package/cjs/schema/implementation/resource/resource-info.js +39 -0
- package/cjs/schema/implementation/resource/singleton-resource-info.js +37 -0
- package/cjs/schema/implementation/schema-builder/extract-resource-metadata.util.js +84 -0
- package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +94 -0
- package/cjs/schema/index.js +28 -0
- package/cjs/schema/interfaces/child-field-query.interface.js +2 -0
- package/cjs/schema/interfaces/data-type.metadata.js +2 -0
- package/cjs/schema/interfaces/resource-container.interface.js +2 -0
- package/cjs/schema/interfaces/resource.metadata.js +2 -0
- package/cjs/schema/opra-schema.definition.js +49 -0
- package/cjs/schema/type-helpers/extend-type.helper.js +65 -0
- package/cjs/schema/type-helpers/mixin-type.helper.js +46 -0
- package/cjs/schema/type-helpers/mixin.utils.js +32 -0
- package/cjs/schema/types.js +2 -0
- package/cjs/schema/utils/class.utils.js +8 -0
- package/cjs/schema/utils/clone-object.util.js +19 -0
- package/cjs/schema/utils/inspect.util.js +7 -0
- package/cjs/schema/utils/normalize-field-array.util.js +44 -0
- package/cjs/schema/utils/path-to-tree.util.js +26 -0
- package/cjs/schema/utils/string-compare.util.js +11 -0
- package/cjs/url/formats/boolean-format.js +25 -0
- package/cjs/url/formats/date-format.js +48 -0
- package/cjs/url/formats/filter-format.js +18 -0
- package/cjs/url/formats/format.js +6 -0
- package/cjs/url/formats/integer-format.js +20 -0
- package/cjs/url/formats/number-format.js +28 -0
- package/cjs/url/formats/string-format.js +28 -0
- package/cjs/url/index.js +8 -0
- package/cjs/url/opra-url-path-component.js +33 -0
- package/cjs/url/opra-url-path.js +128 -0
- package/cjs/url/opra-url-search-params.js +247 -0
- package/cjs/url/opra-url.js +299 -0
- package/cjs/url/utils/path-utils.js +86 -0
- package/cjs/utils/index.js +6 -0
- package/cjs/utils/is-url.js +8 -0
- package/cjs/utils/path-to-tree.js +28 -0
- package/cjs/utils/type-guards.js +46 -0
- package/esm/constants.d.ts +0 -0
- package/esm/constants.js +1 -0
- package/esm/exception/enums/issue-severity.enum.d.ts +13 -0
- package/esm/exception/enums/issue-severity.enum.js +20 -0
- package/esm/exception/error-issue.d.ts +9 -0
- package/esm/{types.js → exception/error-issue.js} +0 -0
- package/esm/exception/http-errors/bad-request.error.d.ts +10 -0
- package/esm/exception/http-errors/bad-request.error.js +18 -0
- package/esm/exception/http-errors/failed-dependency.error.d.ts +9 -0
- package/esm/exception/http-errors/failed-dependency.error.js +17 -0
- package/esm/exception/http-errors/forbidden.error.d.ts +11 -0
- package/esm/exception/http-errors/forbidden.error.js +19 -0
- package/esm/exception/http-errors/internal-server.error.d.ts +9 -0
- package/esm/exception/http-errors/internal-server.error.js +17 -0
- package/esm/exception/http-errors/method-not-allowed.error.d.ts +10 -0
- package/esm/exception/http-errors/method-not-allowed.error.js +18 -0
- package/esm/exception/http-errors/not-acceptable.error.d.ts +10 -0
- package/esm/exception/http-errors/not-acceptable.error.js +18 -0
- package/esm/exception/http-errors/not-found.error.d.ts +13 -0
- package/esm/exception/http-errors/not-found.error.js +21 -0
- package/esm/exception/http-errors/unauthorized.error.d.ts +10 -0
- package/esm/exception/http-errors/unauthorized.error.js +18 -0
- package/esm/exception/http-errors/unprocessable-entity.error.d.ts +9 -0
- package/esm/exception/http-errors/unprocessable-entity.error.js +17 -0
- package/esm/exception/index.d.ts +15 -0
- package/esm/exception/index.js +15 -0
- package/esm/exception/opra-exception.d.ts +15 -0
- package/esm/exception/opra-exception.js +52 -0
- package/esm/exception/resource-errors/resource-conflict.error.d.ts +5 -0
- package/esm/exception/resource-errors/resource-conflict.error.js +16 -0
- package/esm/exception/resource-errors/resource-not-found.error.d.ts +4 -0
- package/esm/exception/resource-errors/resource-not-found.error.js +16 -0
- package/esm/exception/wrap-exception.d.ts +2 -0
- package/esm/exception/wrap-exception.js +38 -0
- package/esm/filter/antlr/OpraFilterLexer.d.ts +78 -0
- package/esm/filter/antlr/OpraFilterLexer.js +381 -0
- package/esm/filter/antlr/OpraFilterParser.d.ts +365 -0
- package/esm/filter/antlr/OpraFilterParser.js +2022 -0
- package/esm/filter/antlr/OpraFilterVisitor.d.ts +290 -0
- package/esm/filter/antlr/OpraFilterVisitor.js +2 -0
- package/esm/filter/ast/abstract/ast.d.ts +5 -0
- package/esm/filter/ast/abstract/ast.js +6 -0
- package/esm/filter/ast/abstract/expression.d.ts +3 -0
- package/esm/filter/ast/abstract/expression.js +3 -0
- package/esm/filter/ast/abstract/literal.d.ts +6 -0
- package/esm/filter/ast/abstract/literal.js +10 -0
- package/esm/filter/ast/abstract/term.d.ts +3 -0
- package/esm/filter/ast/abstract/term.js +3 -0
- package/esm/filter/ast/expressions/arithmetic-expression.d.ts +13 -0
- package/esm/filter/ast/expressions/arithmetic-expression.js +24 -0
- package/esm/filter/ast/expressions/array-expression.d.ts +7 -0
- package/esm/filter/ast/expressions/array-expression.js +11 -0
- package/esm/filter/ast/expressions/comparison-expression.d.ts +10 -0
- package/esm/filter/ast/expressions/comparison-expression.js +14 -0
- package/esm/filter/ast/expressions/logical-expression.d.ts +8 -0
- package/esm/filter/ast/expressions/logical-expression.js +14 -0
- package/esm/filter/ast/expressions/parentheses-expression.d.ts +6 -0
- package/esm/filter/ast/expressions/parentheses-expression.js +11 -0
- package/esm/filter/ast/index.d.ts +16 -0
- package/esm/filter/ast/index.js +16 -0
- package/esm/filter/ast/terms/boolean-literal.d.ts +5 -0
- package/esm/filter/ast/terms/boolean-literal.js +6 -0
- package/esm/filter/ast/terms/date-literal.d.ts +6 -0
- package/esm/filter/ast/terms/date-literal.js +24 -0
- package/esm/filter/ast/terms/external-constant.d.ts +5 -0
- package/esm/filter/ast/terms/external-constant.js +9 -0
- package/esm/filter/ast/terms/null-literal.d.ts +5 -0
- package/esm/filter/ast/terms/null-literal.js +7 -0
- package/esm/filter/ast/terms/number-literal.d.ts +6 -0
- package/esm/filter/ast/terms/number-literal.js +36 -0
- package/esm/filter/ast/terms/qualified-identifier.d.ts +4 -0
- package/esm/filter/ast/terms/qualified-identifier.js +6 -0
- package/esm/filter/ast/terms/string-literal.d.ts +5 -0
- package/esm/filter/ast/terms/string-literal.js +10 -0
- package/esm/filter/ast/terms/time-literal.d.ts +6 -0
- package/esm/filter/ast/terms/time-literal.js +29 -0
- package/esm/filter/build.d.ts +31 -0
- package/esm/filter/build.js +105 -0
- package/esm/filter/error-listener.d.ts +8 -0
- package/esm/filter/error-listener.js +10 -0
- package/esm/filter/errors.d.ts +20 -0
- package/esm/filter/errors.js +15 -0
- package/esm/filter/filter-tree-visitor.d.ts +30 -0
- package/esm/filter/filter-tree-visitor.js +109 -0
- package/esm/filter/index.d.ts +5 -0
- package/esm/filter/index.js +5 -0
- package/esm/filter/parse.d.ts +2 -0
- package/esm/filter/parse.js +33 -0
- package/esm/filter/utils.d.ts +2 -0
- package/esm/filter/utils.js +21 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/{classes → helpers}/responsive-map.d.ts +0 -0
- package/esm/{classes → helpers}/responsive-map.js +1 -1
- package/esm/{enums → http/enums}/http-headers.enum.d.ts +9 -0
- package/esm/{enums → http/enums}/http-headers.enum.js +9 -0
- package/esm/{enums → http/enums}/http-status.enum.d.ts +0 -0
- package/esm/{enums → http/enums}/http-status.enum.js +0 -0
- package/esm/http/http-request.d.ts +34 -0
- package/esm/http/http-request.js +114 -0
- package/esm/http/index.d.ts +6 -0
- package/esm/http/index.js +6 -0
- package/esm/http/interfaces/client-http-headers.interface.d.ts +65 -0
- package/esm/http/interfaces/client-http-headers.interface.js +1 -0
- package/esm/http/interfaces/server-http-headers.interface.d.ts +1 -0
- package/esm/http/interfaces/server-http-headers.interface.js +1 -0
- package/esm/http/multipart/batch-multipart.d.ts +30 -0
- package/esm/http/multipart/batch-multipart.js +150 -0
- package/esm/http/multipart/http-request-content.d.ts +8 -0
- package/esm/http/multipart/http-request-content.js +12 -0
- package/esm/http/multipart/http-response-content.d.ts +7 -0
- package/esm/http/multipart/http-response-content.js +10 -0
- package/esm/http/multipart/index.d.ts +1 -0
- package/esm/http/multipart/index.js +1 -0
- package/esm/http/utils/normalize-headers.d.ts +1 -0
- package/esm/http/utils/normalize-headers.js +24 -0
- package/esm/i18n/i18n.d.ts +28 -0
- package/esm/i18n/i18n.js +170 -0
- package/esm/i18n/index.d.ts +5 -0
- package/esm/i18n/index.js +6 -0
- package/esm/i18n/string-utils.d.ts +2 -0
- package/esm/i18n/string-utils.js +8 -0
- package/esm/i18n/translate.d.ts +4 -0
- package/esm/i18n/translate.js +11 -0
- package/esm/index.d.ts +10 -5
- package/esm/index.js +10 -5
- package/esm/schema/constants.d.ts +8 -0
- package/esm/schema/constants.js +8 -0
- package/esm/schema/decorators/opr-collection-resource.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-collection-resource.decorator.js +19 -0
- package/esm/schema/decorators/opr-complex-type.decorator.d.ts +6 -0
- package/esm/schema/decorators/opr-complex-type.decorator.js +23 -0
- package/esm/schema/decorators/opr-field.decorator.d.ts +3 -0
- package/esm/schema/decorators/opr-field.decorator.js +24 -0
- package/esm/schema/decorators/opr-resolver.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-resolver.decorator.js +71 -0
- package/esm/schema/decorators/opr-simple-type.decorator.d.ts +6 -0
- package/esm/schema/decorators/opr-simple-type.decorator.js +14 -0
- package/esm/schema/decorators/opr-singleton-resource.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-singleton-resource.decorator.js +19 -0
- package/esm/schema/implementation/data-type/builtin/any.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/any.type.js +6 -0
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/bigint.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/bigint.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/boolean.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/boolean.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/date-string.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/date-string.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/date.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/date.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/guid.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/guid.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/integer.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/integer.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/number.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/number.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/object.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/object.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/string.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/string.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin-data-types.d.ts +4 -0
- package/esm/schema/implementation/data-type/builtin-data-types.js +34 -0
- package/esm/schema/implementation/data-type/complex-type.d.ts +29 -0
- package/esm/schema/implementation/data-type/complex-type.js +107 -0
- package/esm/schema/implementation/data-type/data-type.d.ts +16 -0
- package/esm/schema/implementation/data-type/data-type.js +32 -0
- package/esm/schema/implementation/data-type/simple-type.d.ts +12 -0
- package/esm/schema/implementation/data-type/simple-type.js +17 -0
- package/esm/schema/implementation/data-type/union-type.d.ts +16 -0
- package/esm/schema/implementation/data-type/union-type.js +21 -0
- package/esm/schema/implementation/document-builder.d.ts +16 -0
- package/esm/schema/implementation/document-builder.js +135 -0
- package/esm/schema/implementation/opra-document.d.ts +44 -0
- package/esm/schema/implementation/opra-document.js +177 -0
- package/esm/schema/implementation/query/collection-count-query.d.ts +14 -0
- package/esm/schema/implementation/query/collection-count-query.js +15 -0
- package/esm/schema/implementation/query/collection-create-query.d.ts +18 -0
- package/esm/schema/implementation/query/collection-create-query.js +24 -0
- package/esm/schema/implementation/query/collection-delete-many-query.d.ts +14 -0
- package/esm/schema/implementation/query/collection-delete-many-query.js +15 -0
- package/esm/schema/implementation/query/collection-delete-query.d.ts +10 -0
- package/esm/schema/implementation/query/collection-delete-query.js +23 -0
- package/esm/schema/implementation/query/collection-get-query.d.ts +21 -0
- package/esm/schema/implementation/query/collection-get-query.js +34 -0
- package/esm/schema/implementation/query/collection-search-query.d.ts +30 -0
- package/esm/schema/implementation/query/collection-search-query.js +51 -0
- package/esm/schema/implementation/query/collection-update-many-query.d.ts +15 -0
- package/esm/schema/implementation/query/collection-update-many-query.js +17 -0
- package/esm/schema/implementation/query/collection-update-query.d.ts +19 -0
- package/esm/schema/implementation/query/collection-update-query.js +35 -0
- package/esm/schema/implementation/query/field-get-query.d.ts +30 -0
- package/esm/schema/implementation/query/field-get-query.js +41 -0
- package/esm/schema/implementation/query/index.d.ts +27 -0
- package/esm/schema/implementation/query/index.js +17 -0
- package/esm/schema/implementation/query/singleton-get-query.d.ts +20 -0
- package/esm/schema/implementation/query/singleton-get-query.js +23 -0
- package/esm/schema/implementation/resource/collection-resource-info.d.ts +19 -0
- package/esm/schema/implementation/resource/collection-resource-info.js +54 -0
- package/esm/schema/implementation/resource/container-resource-info.d.ts +13 -0
- package/esm/schema/implementation/resource/container-resource-info.js +26 -0
- package/esm/schema/implementation/resource/resource-info.d.ts +17 -0
- package/esm/schema/implementation/resource/resource-info.js +35 -0
- package/esm/schema/implementation/resource/singleton-resource-info.d.ts +14 -0
- package/esm/schema/implementation/resource/singleton-resource-info.js +33 -0
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +3 -0
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.js +80 -0
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +4 -0
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +89 -0
- package/esm/schema/index.d.ts +25 -0
- package/esm/schema/index.js +25 -0
- package/esm/schema/interfaces/child-field-query.interface.d.ts +4 -0
- package/esm/schema/interfaces/child-field-query.interface.js +1 -0
- package/esm/schema/interfaces/data-type.metadata.d.ts +18 -0
- package/esm/schema/interfaces/data-type.metadata.js +1 -0
- package/esm/schema/interfaces/resource-container.interface.d.ts +8 -0
- package/esm/schema/interfaces/resource-container.interface.js +1 -0
- package/esm/schema/interfaces/resource.metadata.d.ts +18 -0
- package/esm/schema/interfaces/resource.metadata.js +1 -0
- package/esm/schema/opra-schema.definition.d.ts +178 -0
- package/esm/schema/opra-schema.definition.js +46 -0
- package/esm/schema/type-helpers/extend-type.helper.d.ts +3 -0
- package/esm/schema/type-helpers/extend-type.helper.js +59 -0
- package/esm/schema/type-helpers/mixin-type.helper.d.ts +2 -0
- package/esm/schema/type-helpers/mixin-type.helper.js +41 -0
- package/esm/schema/type-helpers/mixin.utils.d.ts +3 -0
- package/esm/schema/type-helpers/mixin.utils.js +27 -0
- package/esm/{types.d.ts → schema/types.d.ts} +8 -1
- package/esm/schema/types.js +1 -0
- package/esm/schema/utils/class.utils.d.ts +2 -0
- package/esm/schema/utils/class.utils.js +4 -0
- package/esm/schema/utils/clone-object.util.d.ts +1 -0
- package/esm/schema/utils/clone-object.util.js +14 -0
- package/esm/schema/utils/inspect.util.d.ts +4 -0
- package/esm/schema/utils/inspect.util.js +4 -0
- package/esm/schema/utils/normalize-field-array.util.d.ts +3 -0
- package/esm/schema/utils/normalize-field-array.util.js +40 -0
- package/esm/schema/utils/path-to-tree.util.d.ts +4 -0
- package/esm/schema/utils/path-to-tree.util.js +22 -0
- package/esm/schema/utils/string-compare.util.d.ts +1 -0
- package/esm/schema/utils/string-compare.util.js +7 -0
- package/esm/url/formats/boolean-format.d.ts +5 -0
- package/esm/url/formats/boolean-format.js +21 -0
- package/esm/url/formats/date-format.d.ts +16 -0
- package/esm/url/formats/date-format.js +44 -0
- package/esm/url/formats/filter-format.d.ts +6 -0
- package/esm/url/formats/filter-format.js +14 -0
- package/esm/url/formats/format.d.ts +4 -0
- package/esm/url/formats/format.js +2 -0
- package/esm/url/formats/integer-format.d.ts +9 -0
- package/esm/url/formats/integer-format.js +16 -0
- package/esm/url/formats/number-format.d.ts +12 -0
- package/esm/url/formats/number-format.js +24 -0
- package/esm/url/formats/string-format.d.ts +14 -0
- package/esm/url/formats/string-format.js +24 -0
- package/esm/url/index.d.ts +5 -0
- package/esm/url/index.js +5 -0
- package/esm/url/opra-url-path-component.d.ts +15 -0
- package/esm/url/opra-url-path-component.js +29 -0
- package/esm/url/opra-url-path.d.ts +30 -0
- package/esm/url/opra-url-path.js +124 -0
- package/esm/url/opra-url-search-params.d.ts +46 -0
- package/esm/url/opra-url-search-params.js +243 -0
- package/esm/url/opra-url.d.ts +79 -0
- package/esm/url/opra-url.js +295 -0
- package/esm/url/utils/path-utils.d.ts +8 -0
- package/esm/url/utils/path-utils.js +78 -0
- package/esm/utils/index.d.ts +3 -0
- package/esm/utils/index.js +3 -0
- package/esm/utils/is-url.d.ts +1 -0
- package/esm/utils/is-url.js +4 -0
- package/esm/utils/path-to-tree.d.ts +4 -0
- package/esm/utils/path-to-tree.js +24 -0
- package/esm/utils/type-guards.d.ts +9 -0
- package/esm/utils/type-guards.js +37 -0
- package/package.json +30 -10
- package/umd/opra-common.umd.min.js +1 -0
- package/cjs/classes/headers-map.js +0 -18
- package/esm/classes/headers-map.d.ts +0 -5
- package/esm/classes/headers-map.js +0 -14
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
|
2
|
+
import { ArithmeticExpressionContext, ArrayExpressionContext, ArthOpContext, BooleanContext, BooleanLiteralContext, ComparisonExpressionContext, CompOpContext, DateLiteralContext, DateTimeLiteralContext, DateTimePrecisionContext, ExpressionContext, ExternalConstantContext, ExternalConstantTermContext, FunctionContext, IdentifierContext, IndexerContext, InfinityContext, InfinityLiteralContext, InvocableContext, InvocationContext, LiteralContext, LiteralTermContext, LogicalExpressionContext, LogOpContext, MemberIndexContext, MemberInvocationContext, NullContext, NullLiteralContext, NumberIndexContext, NumberLiteralContext, ParamListContext, ParenthesizedExpressionContext, PluralDateTimePrecisionContext, PolarityExpressionContext, PolarOpContext, QualifiedIdentifierContext, QualifiedIdentifierTermContext, RootContext, StringLiteralContext, TermContext, TermExpressionContext, TimeLiteralContext, UnitContext } from "../antlr/OpraFilterParser.js";
|
|
3
|
+
/**
|
|
4
|
+
* This interface defines a complete generic visitor for a parse tree produced
|
|
5
|
+
* by `OpraFilterParser`.
|
|
6
|
+
*
|
|
7
|
+
* @param <Result> The return type of the visit operation. Use `void` for
|
|
8
|
+
* operations with no return type.
|
|
9
|
+
*/
|
|
10
|
+
export interface OpraFilterVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
11
|
+
/**
|
|
12
|
+
* Visit a parse tree produced by the `termExpression`
|
|
13
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
14
|
+
* @param ctx the parse tree
|
|
15
|
+
* @return the visitor result
|
|
16
|
+
*/
|
|
17
|
+
visitTermExpression?: (ctx: TermExpressionContext) => Result;
|
|
18
|
+
/**
|
|
19
|
+
* Visit a parse tree produced by the `polarityExpression`
|
|
20
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
21
|
+
* @param ctx the parse tree
|
|
22
|
+
* @return the visitor result
|
|
23
|
+
*/
|
|
24
|
+
visitPolarityExpression?: (ctx: PolarityExpressionContext) => Result;
|
|
25
|
+
/**
|
|
26
|
+
* Visit a parse tree produced by the `arithmeticExpression`
|
|
27
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
28
|
+
* @param ctx the parse tree
|
|
29
|
+
* @return the visitor result
|
|
30
|
+
*/
|
|
31
|
+
visitArithmeticExpression?: (ctx: ArithmeticExpressionContext) => Result;
|
|
32
|
+
/**
|
|
33
|
+
* Visit a parse tree produced by the `comparisonExpression`
|
|
34
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
35
|
+
* @param ctx the parse tree
|
|
36
|
+
* @return the visitor result
|
|
37
|
+
*/
|
|
38
|
+
visitComparisonExpression?: (ctx: ComparisonExpressionContext) => Result;
|
|
39
|
+
/**
|
|
40
|
+
* Visit a parse tree produced by the `logicalExpression`
|
|
41
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
42
|
+
* @param ctx the parse tree
|
|
43
|
+
* @return the visitor result
|
|
44
|
+
*/
|
|
45
|
+
visitLogicalExpression?: (ctx: LogicalExpressionContext) => Result;
|
|
46
|
+
/**
|
|
47
|
+
* Visit a parse tree produced by the `parenthesizedExpression`
|
|
48
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
49
|
+
* @param ctx the parse tree
|
|
50
|
+
* @return the visitor result
|
|
51
|
+
*/
|
|
52
|
+
visitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => Result;
|
|
53
|
+
/**
|
|
54
|
+
* Visit a parse tree produced by the `arrayExpression`
|
|
55
|
+
* labeled alternative in `OpraFilterParser.expression`.
|
|
56
|
+
* @param ctx the parse tree
|
|
57
|
+
* @return the visitor result
|
|
58
|
+
*/
|
|
59
|
+
visitArrayExpression?: (ctx: ArrayExpressionContext) => Result;
|
|
60
|
+
/**
|
|
61
|
+
* Visit a parse tree produced by the `memberIndex`
|
|
62
|
+
* labeled alternative in `OpraFilterParser.indexer`.
|
|
63
|
+
* @param ctx the parse tree
|
|
64
|
+
* @return the visitor result
|
|
65
|
+
*/
|
|
66
|
+
visitMemberIndex?: (ctx: MemberIndexContext) => Result;
|
|
67
|
+
/**
|
|
68
|
+
* Visit a parse tree produced by the `numberIndex`
|
|
69
|
+
* labeled alternative in `OpraFilterParser.indexer`.
|
|
70
|
+
* @param ctx the parse tree
|
|
71
|
+
* @return the visitor result
|
|
72
|
+
*/
|
|
73
|
+
visitNumberIndex?: (ctx: NumberIndexContext) => Result;
|
|
74
|
+
/**
|
|
75
|
+
* Visit a parse tree produced by the `numberLiteral`
|
|
76
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
77
|
+
* @param ctx the parse tree
|
|
78
|
+
* @return the visitor result
|
|
79
|
+
*/
|
|
80
|
+
visitNumberLiteral?: (ctx: NumberLiteralContext) => Result;
|
|
81
|
+
/**
|
|
82
|
+
* Visit a parse tree produced by the `infinityLiteral`
|
|
83
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
84
|
+
* @param ctx the parse tree
|
|
85
|
+
* @return the visitor result
|
|
86
|
+
*/
|
|
87
|
+
visitInfinityLiteral?: (ctx: InfinityLiteralContext) => Result;
|
|
88
|
+
/**
|
|
89
|
+
* Visit a parse tree produced by the `booleanLiteral`
|
|
90
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
91
|
+
* @param ctx the parse tree
|
|
92
|
+
* @return the visitor result
|
|
93
|
+
*/
|
|
94
|
+
visitBooleanLiteral?: (ctx: BooleanLiteralContext) => Result;
|
|
95
|
+
/**
|
|
96
|
+
* Visit a parse tree produced by the `nullLiteral`
|
|
97
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
98
|
+
* @param ctx the parse tree
|
|
99
|
+
* @return the visitor result
|
|
100
|
+
*/
|
|
101
|
+
visitNullLiteral?: (ctx: NullLiteralContext) => Result;
|
|
102
|
+
/**
|
|
103
|
+
* Visit a parse tree produced by the `dateLiteral`
|
|
104
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
105
|
+
* @param ctx the parse tree
|
|
106
|
+
* @return the visitor result
|
|
107
|
+
*/
|
|
108
|
+
visitDateLiteral?: (ctx: DateLiteralContext) => Result;
|
|
109
|
+
/**
|
|
110
|
+
* Visit a parse tree produced by the `dateTimeLiteral`
|
|
111
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
112
|
+
* @param ctx the parse tree
|
|
113
|
+
* @return the visitor result
|
|
114
|
+
*/
|
|
115
|
+
visitDateTimeLiteral?: (ctx: DateTimeLiteralContext) => Result;
|
|
116
|
+
/**
|
|
117
|
+
* Visit a parse tree produced by the `timeLiteral`
|
|
118
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
119
|
+
* @param ctx the parse tree
|
|
120
|
+
* @return the visitor result
|
|
121
|
+
*/
|
|
122
|
+
visitTimeLiteral?: (ctx: TimeLiteralContext) => Result;
|
|
123
|
+
/**
|
|
124
|
+
* Visit a parse tree produced by the `stringLiteral`
|
|
125
|
+
* labeled alternative in `OpraFilterParser.literal`.
|
|
126
|
+
* @param ctx the parse tree
|
|
127
|
+
* @return the visitor result
|
|
128
|
+
*/
|
|
129
|
+
visitStringLiteral?: (ctx: StringLiteralContext) => Result;
|
|
130
|
+
/**
|
|
131
|
+
* Visit a parse tree produced by the `memberInvocation`
|
|
132
|
+
* labeled alternative in `OpraFilterParser.invocation`.
|
|
133
|
+
* @param ctx the parse tree
|
|
134
|
+
* @return the visitor result
|
|
135
|
+
*/
|
|
136
|
+
visitMemberInvocation?: (ctx: MemberInvocationContext) => Result;
|
|
137
|
+
/**
|
|
138
|
+
* Visit a parse tree produced by the `literalTerm`
|
|
139
|
+
* labeled alternative in `OpraFilterParser.term`.
|
|
140
|
+
* @param ctx the parse tree
|
|
141
|
+
* @return the visitor result
|
|
142
|
+
*/
|
|
143
|
+
visitLiteralTerm?: (ctx: LiteralTermContext) => Result;
|
|
144
|
+
/**
|
|
145
|
+
* Visit a parse tree produced by the `qualifiedIdentifierTerm`
|
|
146
|
+
* labeled alternative in `OpraFilterParser.term`.
|
|
147
|
+
* @param ctx the parse tree
|
|
148
|
+
* @return the visitor result
|
|
149
|
+
*/
|
|
150
|
+
visitQualifiedIdentifierTerm?: (ctx: QualifiedIdentifierTermContext) => Result;
|
|
151
|
+
/**
|
|
152
|
+
* Visit a parse tree produced by the `externalConstantTerm`
|
|
153
|
+
* labeled alternative in `OpraFilterParser.term`.
|
|
154
|
+
* @param ctx the parse tree
|
|
155
|
+
* @return the visitor result
|
|
156
|
+
*/
|
|
157
|
+
visitExternalConstantTerm?: (ctx: ExternalConstantTermContext) => Result;
|
|
158
|
+
/**
|
|
159
|
+
* Visit a parse tree produced by `OpraFilterParser.root`.
|
|
160
|
+
* @param ctx the parse tree
|
|
161
|
+
* @return the visitor result
|
|
162
|
+
*/
|
|
163
|
+
visitRoot?: (ctx: RootContext) => Result;
|
|
164
|
+
/**
|
|
165
|
+
* Visit a parse tree produced by `OpraFilterParser.expression`.
|
|
166
|
+
* @param ctx the parse tree
|
|
167
|
+
* @return the visitor result
|
|
168
|
+
*/
|
|
169
|
+
visitExpression?: (ctx: ExpressionContext) => Result;
|
|
170
|
+
/**
|
|
171
|
+
* Visit a parse tree produced by `OpraFilterParser.term`.
|
|
172
|
+
* @param ctx the parse tree
|
|
173
|
+
* @return the visitor result
|
|
174
|
+
*/
|
|
175
|
+
visitTerm?: (ctx: TermContext) => Result;
|
|
176
|
+
/**
|
|
177
|
+
* Visit a parse tree produced by `OpraFilterParser.invocable`.
|
|
178
|
+
* @param ctx the parse tree
|
|
179
|
+
* @return the visitor result
|
|
180
|
+
*/
|
|
181
|
+
visitInvocable?: (ctx: InvocableContext) => Result;
|
|
182
|
+
/**
|
|
183
|
+
* Visit a parse tree produced by `OpraFilterParser.invocation`.
|
|
184
|
+
* @param ctx the parse tree
|
|
185
|
+
* @return the visitor result
|
|
186
|
+
*/
|
|
187
|
+
visitInvocation?: (ctx: InvocationContext) => Result;
|
|
188
|
+
/**
|
|
189
|
+
* Visit a parse tree produced by `OpraFilterParser.indexer`.
|
|
190
|
+
* @param ctx the parse tree
|
|
191
|
+
* @return the visitor result
|
|
192
|
+
*/
|
|
193
|
+
visitIndexer?: (ctx: IndexerContext) => Result;
|
|
194
|
+
/**
|
|
195
|
+
* Visit a parse tree produced by `OpraFilterParser.function`.
|
|
196
|
+
* @param ctx the parse tree
|
|
197
|
+
* @return the visitor result
|
|
198
|
+
*/
|
|
199
|
+
visitFunction?: (ctx: FunctionContext) => Result;
|
|
200
|
+
/**
|
|
201
|
+
* Visit a parse tree produced by `OpraFilterParser.paramList`.
|
|
202
|
+
* @param ctx the parse tree
|
|
203
|
+
* @return the visitor result
|
|
204
|
+
*/
|
|
205
|
+
visitParamList?: (ctx: ParamListContext) => Result;
|
|
206
|
+
/**
|
|
207
|
+
* Visit a parse tree produced by `OpraFilterParser.unit`.
|
|
208
|
+
* @param ctx the parse tree
|
|
209
|
+
* @return the visitor result
|
|
210
|
+
*/
|
|
211
|
+
visitUnit?: (ctx: UnitContext) => Result;
|
|
212
|
+
/**
|
|
213
|
+
* Visit a parse tree produced by `OpraFilterParser.dateTimePrecision`.
|
|
214
|
+
* @param ctx the parse tree
|
|
215
|
+
* @return the visitor result
|
|
216
|
+
*/
|
|
217
|
+
visitDateTimePrecision?: (ctx: DateTimePrecisionContext) => Result;
|
|
218
|
+
/**
|
|
219
|
+
* Visit a parse tree produced by `OpraFilterParser.pluralDateTimePrecision`.
|
|
220
|
+
* @param ctx the parse tree
|
|
221
|
+
* @return the visitor result
|
|
222
|
+
*/
|
|
223
|
+
visitPluralDateTimePrecision?: (ctx: PluralDateTimePrecisionContext) => Result;
|
|
224
|
+
/**
|
|
225
|
+
* Visit a parse tree produced by `OpraFilterParser.qualifiedIdentifier`.
|
|
226
|
+
* @param ctx the parse tree
|
|
227
|
+
* @return the visitor result
|
|
228
|
+
*/
|
|
229
|
+
visitQualifiedIdentifier?: (ctx: QualifiedIdentifierContext) => Result;
|
|
230
|
+
/**
|
|
231
|
+
* Visit a parse tree produced by `OpraFilterParser.externalConstant`.
|
|
232
|
+
* @param ctx the parse tree
|
|
233
|
+
* @return the visitor result
|
|
234
|
+
*/
|
|
235
|
+
visitExternalConstant?: (ctx: ExternalConstantContext) => Result;
|
|
236
|
+
/**
|
|
237
|
+
* Visit a parse tree produced by `OpraFilterParser.identifier`.
|
|
238
|
+
* @param ctx the parse tree
|
|
239
|
+
* @return the visitor result
|
|
240
|
+
*/
|
|
241
|
+
visitIdentifier?: (ctx: IdentifierContext) => Result;
|
|
242
|
+
/**
|
|
243
|
+
* Visit a parse tree produced by `OpraFilterParser.literal`.
|
|
244
|
+
* @param ctx the parse tree
|
|
245
|
+
* @return the visitor result
|
|
246
|
+
*/
|
|
247
|
+
visitLiteral?: (ctx: LiteralContext) => Result;
|
|
248
|
+
/**
|
|
249
|
+
* Visit a parse tree produced by `OpraFilterParser.compOp`.
|
|
250
|
+
* @param ctx the parse tree
|
|
251
|
+
* @return the visitor result
|
|
252
|
+
*/
|
|
253
|
+
visitCompOp?: (ctx: CompOpContext) => Result;
|
|
254
|
+
/**
|
|
255
|
+
* Visit a parse tree produced by `OpraFilterParser.arthOp`.
|
|
256
|
+
* @param ctx the parse tree
|
|
257
|
+
* @return the visitor result
|
|
258
|
+
*/
|
|
259
|
+
visitArthOp?: (ctx: ArthOpContext) => Result;
|
|
260
|
+
/**
|
|
261
|
+
* Visit a parse tree produced by `OpraFilterParser.polarOp`.
|
|
262
|
+
* @param ctx the parse tree
|
|
263
|
+
* @return the visitor result
|
|
264
|
+
*/
|
|
265
|
+
visitPolarOp?: (ctx: PolarOpContext) => Result;
|
|
266
|
+
/**
|
|
267
|
+
* Visit a parse tree produced by `OpraFilterParser.logOp`.
|
|
268
|
+
* @param ctx the parse tree
|
|
269
|
+
* @return the visitor result
|
|
270
|
+
*/
|
|
271
|
+
visitLogOp?: (ctx: LogOpContext) => Result;
|
|
272
|
+
/**
|
|
273
|
+
* Visit a parse tree produced by `OpraFilterParser.boolean`.
|
|
274
|
+
* @param ctx the parse tree
|
|
275
|
+
* @return the visitor result
|
|
276
|
+
*/
|
|
277
|
+
visitBoolean?: (ctx: BooleanContext) => Result;
|
|
278
|
+
/**
|
|
279
|
+
* Visit a parse tree produced by `OpraFilterParser.null`.
|
|
280
|
+
* @param ctx the parse tree
|
|
281
|
+
* @return the visitor result
|
|
282
|
+
*/
|
|
283
|
+
visitNull?: (ctx: NullContext) => Result;
|
|
284
|
+
/**
|
|
285
|
+
* Visit a parse tree produced by `OpraFilterParser.infinity`.
|
|
286
|
+
* @param ctx the parse tree
|
|
287
|
+
* @return the visitor result
|
|
288
|
+
*/
|
|
289
|
+
visitInfinity?: (ctx: InfinityContext) => Result;
|
|
290
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
export declare type ArithmeticOperator = '+' | '-' | '*' | '/';
|
|
3
|
+
export declare class ArithmeticExpression extends Expression {
|
|
4
|
+
items: ArithmeticExpressionItem[];
|
|
5
|
+
constructor();
|
|
6
|
+
append(op: ArithmeticOperator, expression: Expression): this;
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ArithmeticExpressionItem {
|
|
10
|
+
op: ArithmeticOperator;
|
|
11
|
+
expression: Expression;
|
|
12
|
+
constructor(o: ArithmeticExpressionItem);
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
export class ArithmeticExpression extends Expression {
|
|
3
|
+
items = [];
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
append(op, expression) {
|
|
8
|
+
this.items.push(new ArithmeticExpressionItem({
|
|
9
|
+
op,
|
|
10
|
+
expression
|
|
11
|
+
}));
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
toString() {
|
|
15
|
+
return this.items.map((child, i) => (i > 0 ? child.op : '') + child.expression).join('');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ArithmeticExpressionItem {
|
|
19
|
+
op;
|
|
20
|
+
expression;
|
|
21
|
+
constructor(o) {
|
|
22
|
+
Object.assign(this, o);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StrictOmit } from 'ts-gems';
|
|
2
|
+
import { Expression } from '../abstract/expression.js';
|
|
3
|
+
export declare type ComparisonOperator = '<=' | '<' | '>' | '>=' | '=' | '!=' | 'in' | '!in' | 'like' | '!like' | 'ilike' | '!ilike';
|
|
4
|
+
export declare class ComparisonExpression extends Expression {
|
|
5
|
+
op: ComparisonOperator;
|
|
6
|
+
left: Expression;
|
|
7
|
+
right: Expression;
|
|
8
|
+
constructor(o: StrictOmit<ComparisonExpression, 'kind'>);
|
|
9
|
+
toString(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
const WORD_PATTERN = /\w/;
|
|
3
|
+
export class ComparisonExpression extends Expression {
|
|
4
|
+
op;
|
|
5
|
+
left;
|
|
6
|
+
right;
|
|
7
|
+
constructor(o) {
|
|
8
|
+
super();
|
|
9
|
+
Object.assign(this, o);
|
|
10
|
+
}
|
|
11
|
+
toString() {
|
|
12
|
+
return `${this.left}${WORD_PATTERN.test(this.op) ? ' ' + this.op + ' ' : this.op}${this.right}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
export declare type LogicalOperator = 'and' | 'or';
|
|
3
|
+
export declare class LogicalExpression extends Expression {
|
|
4
|
+
op: LogicalOperator;
|
|
5
|
+
items: Expression[];
|
|
6
|
+
constructor(o: Omit<LogicalExpression, 'kind'>);
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
export class LogicalExpression extends Expression {
|
|
3
|
+
op;
|
|
4
|
+
items;
|
|
5
|
+
constructor(o) {
|
|
6
|
+
super();
|
|
7
|
+
Object.assign(this, o);
|
|
8
|
+
}
|
|
9
|
+
toString() {
|
|
10
|
+
return this.items
|
|
11
|
+
.map(child => '' + child)
|
|
12
|
+
.join(' ' + this.op + ' ');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Expression } from '../abstract/expression.js';
|
|
2
|
+
export class ParenthesesExpression extends Expression {
|
|
3
|
+
expression;
|
|
4
|
+
constructor(expression) {
|
|
5
|
+
super();
|
|
6
|
+
this.expression = expression;
|
|
7
|
+
}
|
|
8
|
+
toString() {
|
|
9
|
+
return `(${this.expression})`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './abstract/ast.js';
|
|
2
|
+
export * from './abstract/expression.js';
|
|
3
|
+
export * from './abstract/literal.js';
|
|
4
|
+
export * from './abstract/term.js';
|
|
5
|
+
export * from './expressions/arithmetic-expression.js';
|
|
6
|
+
export * from './expressions/array-expression.js';
|
|
7
|
+
export * from './expressions/comparison-expression.js';
|
|
8
|
+
export * from './expressions/logical-expression.js';
|
|
9
|
+
export * from './expressions/parentheses-expression.js';
|
|
10
|
+
export * from './terms/boolean-literal.js';
|
|
11
|
+
export * from './terms/date-literal.js';
|
|
12
|
+
export * from './terms/null-literal.js';
|
|
13
|
+
export * from './terms/number-literal.js';
|
|
14
|
+
export * from './terms/qualified-identifier.js';
|
|
15
|
+
export * from './terms/string-literal.js';
|
|
16
|
+
export * from './terms/time-literal.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './abstract/ast.js';
|
|
2
|
+
export * from './abstract/expression.js';
|
|
3
|
+
export * from './abstract/literal.js';
|
|
4
|
+
export * from './abstract/term.js';
|
|
5
|
+
export * from './expressions/arithmetic-expression.js';
|
|
6
|
+
export * from './expressions/array-expression.js';
|
|
7
|
+
export * from './expressions/comparison-expression.js';
|
|
8
|
+
export * from './expressions/logical-expression.js';
|
|
9
|
+
export * from './expressions/parentheses-expression.js';
|
|
10
|
+
export * from './terms/boolean-literal.js';
|
|
11
|
+
export * from './terms/date-literal.js';
|
|
12
|
+
export * from './terms/null-literal.js';
|
|
13
|
+
export * from './terms/number-literal.js';
|
|
14
|
+
export * from './terms/qualified-identifier.js';
|
|
15
|
+
export * from './terms/string-literal.js';
|
|
16
|
+
export * from './terms/time-literal.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DateTime } from 'luxon'; // todo dont use luxon. it has circular deps!
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { quoteFilterString } from '../../utils.js';
|
|
4
|
+
import { Literal } from '../abstract/literal.js';
|
|
5
|
+
const DATE_PATTERN = /^(\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)/;
|
|
6
|
+
export class DateLiteral extends Literal {
|
|
7
|
+
value;
|
|
8
|
+
constructor(value) {
|
|
9
|
+
super('');
|
|
10
|
+
if (value instanceof Date) {
|
|
11
|
+
this.value = value.toISOString();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// noinspection SuspiciousTypeOfGuard
|
|
15
|
+
if (typeof value === 'string' && DATE_PATTERN.test(value) && DateTime.fromISO(value).isValid) {
|
|
16
|
+
this.value = value;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
throw new ValidationError(`Invalid date value "${value}"`);
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return quoteFilterString(this.value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ValidationError } from '../../errors.js';
|
|
2
|
+
import { Literal } from '../abstract/literal.js';
|
|
3
|
+
export class NumberLiteral extends Literal {
|
|
4
|
+
value;
|
|
5
|
+
constructor(value) {
|
|
6
|
+
super(0);
|
|
7
|
+
if (typeof value === 'number' || typeof value === 'bigint') {
|
|
8
|
+
this.value = value;
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
// noinspection SuspiciousTypeOfGuard
|
|
13
|
+
if (typeof value === 'string') {
|
|
14
|
+
if (value.includes('.')) {
|
|
15
|
+
this.value = parseFloat(value);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const n = Number(value);
|
|
19
|
+
if ('' + n === value)
|
|
20
|
+
this.value = n;
|
|
21
|
+
else
|
|
22
|
+
this.value = BigInt(value);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
//
|
|
28
|
+
}
|
|
29
|
+
throw new ValidationError(`Invalid number literal ${value}`);
|
|
30
|
+
}
|
|
31
|
+
toString() {
|
|
32
|
+
return typeof this.value === 'bigint'
|
|
33
|
+
? ('' + this.value).replace(/n$/, '')
|
|
34
|
+
: ('' + this.value);
|
|
35
|
+
}
|
|
36
|
+
}
|