@opra/common 0.14.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/api-document.js +211 -0
- package/cjs/document/constants.js +6 -0
- package/cjs/document/data-type/api-field.js +82 -0
- package/cjs/document/data-type/builtin/any.type.js +14 -0
- package/cjs/document/data-type/builtin/base64.type.js +38 -0
- package/cjs/document/data-type/builtin/bigint.type.js +33 -0
- package/cjs/document/data-type/builtin/boolean.type.js +28 -0
- package/cjs/document/data-type/builtin/date.type.js +18 -0
- package/cjs/document/data-type/builtin/guid.type.js +35 -0
- package/cjs/document/data-type/builtin/index.js +13 -0
- package/cjs/document/data-type/builtin/integer.type.js +28 -0
- package/cjs/document/data-type/builtin/number.type.js +33 -0
- package/cjs/document/data-type/builtin/object.type.js +20 -0
- package/cjs/document/data-type/builtin/string.type.js +24 -0
- package/cjs/document/data-type/builtin/time.type.js +32 -0
- package/cjs/document/data-type/builtin/timestamp.type.js +29 -0
- package/cjs/document/data-type/complex-type.js +154 -0
- package/cjs/document/data-type/data-type.js +46 -0
- package/cjs/document/data-type/enum-type.js +62 -0
- package/cjs/document/data-type/mapped-type.js +96 -0
- package/cjs/document/data-type/simple-type.js +61 -0
- package/cjs/document/data-type/union-type.js +81 -0
- package/cjs/document/factory/add-references.js +20 -0
- package/cjs/document/factory/create-document.js +81 -0
- package/cjs/document/factory/factory.js +62 -0
- package/cjs/document/factory/import-resource-class.js +54 -0
- package/cjs/document/factory/import-type-class.js +137 -0
- package/cjs/document/factory/index.js +4 -0
- package/cjs/document/factory/process-resources.js +55 -0
- package/cjs/document/factory/process-types.js +191 -0
- package/cjs/document/index.js +17 -0
- package/cjs/document/resource/collection.js +185 -0
- package/cjs/document/resource/resource.js +38 -0
- package/cjs/document/resource/singleton.js +91 -0
- package/cjs/exception/opra-exception.js +2 -0
- package/cjs/exception/resource-errors/resource-not-found.error.js +4 -0
- package/cjs/filter/parse.js +3 -1
- package/cjs/helpers/function-utils.js +25 -0
- package/cjs/helpers/get-stack-filename.js +24 -0
- package/cjs/helpers/index.js +7 -0
- package/cjs/{utils → helpers}/is-url.js +2 -2
- package/cjs/{schema/utils/clone-object.util.js → helpers/object-utils.js} +13 -1
- package/cjs/{utils/path-to-tree.js → helpers/path-to-object-tree.js} +9 -9
- package/cjs/helpers/responsive-map.js +62 -14
- package/cjs/{utils → helpers}/type-guards.js +12 -5
- package/cjs/http/{param-codec → codecs}/boolean-codec.js +1 -2
- package/{esm/http/param-codec → cjs/http/codecs}/date-codec.js +5 -4
- package/cjs/http/{param-codec → codecs}/filter-codec.js +1 -2
- package/cjs/http/{param-codec → codecs}/number-codec.js +1 -3
- package/cjs/http/{param-codec → codecs}/string-codec.js +1 -3
- package/cjs/http/enums/http-headers-codes.enum.js +13 -4
- package/cjs/http/enums/http-status-messages.js +68 -0
- package/cjs/http/http-headers.js +138 -124
- package/cjs/http/http-message.host.js +251 -0
- package/cjs/http/http-params.js +78 -45
- package/cjs/http/http-request-message.js +152 -0
- package/cjs/http/http-response-message.js +238 -0
- package/cjs/http/index.js +8 -11
- package/cjs/http/multipart/batch-multipart.js +169 -153
- package/cjs/http/multipart/http-request-content.js +16 -11
- package/cjs/http/multipart/http-response-content.js +13 -10
- package/cjs/http/multipart/index.js +1 -3
- package/cjs/i18n/i18n.js +1 -1
- package/cjs/index.js +6 -5
- package/cjs/schema/constants.js +2 -9
- package/cjs/schema/data-type/complex-type.interface.js +7 -0
- package/cjs/schema/data-type/enum-type.interface.js +7 -0
- package/cjs/schema/data-type/mapped-type.interface.js +7 -0
- package/cjs/schema/data-type/simple-type.interface.js +7 -0
- package/cjs/schema/data-type/union-type.interface.js +7 -0
- package/cjs/schema/index.js +42 -26
- package/cjs/schema/resource/collection.interface.js +7 -0
- package/cjs/schema/resource/container.interface.js +7 -0
- package/cjs/schema/resource/resource.interface.js +2 -0
- package/cjs/schema/resource/singleton.interface.js +7 -0
- package/cjs/schema/type-guards.js +59 -0
- package/cjs/types.js +2 -0
- package/cjs/url/index.js +2 -2
- package/cjs/url/opra-url-path-component.js +2 -2
- package/cjs/url/opra-url-path.js +7 -4
- package/cjs/url/opra-url.js +86 -117
- package/cjs/url/utils/{path-utils.js → decode-path-component.js} +1 -46
- package/cjs/url/utils/encode-path-component.js +27 -0
- package/cjs/utils/path-utils.js +24 -0
- package/esm/document/api-document.js +211 -0
- package/esm/document/constants.js +6 -0
- package/esm/document/data-type/api-field.js +82 -0
- package/esm/document/data-type/builtin/any.type.js +14 -0
- package/esm/document/data-type/builtin/base64.type.js +38 -0
- package/esm/document/data-type/builtin/bigint.type.js +33 -0
- package/esm/document/data-type/builtin/boolean.type.js +28 -0
- package/esm/document/data-type/builtin/date.type.js +18 -0
- package/esm/document/data-type/builtin/guid.type.js +35 -0
- package/esm/document/data-type/builtin/index.js +13 -0
- package/esm/document/data-type/builtin/integer.type.js +28 -0
- package/esm/document/data-type/builtin/number.type.js +33 -0
- package/esm/document/data-type/builtin/object.type.js +20 -0
- package/esm/document/data-type/builtin/string.type.js +24 -0
- package/esm/document/data-type/builtin/time.type.js +32 -0
- package/esm/document/data-type/builtin/timestamp.type.js +29 -0
- package/esm/document/data-type/complex-type.js +154 -0
- package/esm/document/data-type/data-type.js +46 -0
- package/esm/document/data-type/enum-type.js +62 -0
- package/esm/document/data-type/mapped-type.js +96 -0
- package/esm/document/data-type/simple-type.js +61 -0
- package/esm/document/data-type/union-type.js +81 -0
- package/esm/document/factory/add-references.js +20 -0
- package/esm/document/factory/create-document.js +81 -0
- package/esm/document/factory/factory.js +62 -0
- package/esm/document/factory/import-resource-class.js +54 -0
- package/esm/document/factory/import-type-class.js +137 -0
- package/esm/document/factory/index.js +4 -0
- package/esm/document/factory/process-resources.js +55 -0
- package/esm/document/factory/process-types.js +191 -0
- package/esm/document/index.js +17 -0
- package/esm/document/resource/collection.js +185 -0
- package/esm/document/resource/resource.js +38 -0
- package/esm/document/resource/singleton.js +91 -0
- package/esm/document/utils/inspect.util.js +7 -0
- package/esm/document/utils/string-compare.util.js +11 -0
- 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 +9 -3
- package/esm/exception/resource-errors/resource-conflict.error.js +8 -4
- package/esm/exception/resource-errors/resource-not-found.error.js +12 -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 +22 -15
- package/esm/filter/utils.js +7 -2
- package/esm/helpers/function-utils.js +25 -0
- package/esm/helpers/get-stack-filename.js +24 -0
- package/esm/helpers/index.js +11 -1
- package/esm/helpers/is-url.js +8 -0
- package/esm/{schema/type-helpers/mixin.utils.js → helpers/mixin-utils.js} +7 -2
- package/esm/helpers/object-utils.js +31 -0
- package/esm/helpers/path-to-object-tree.js +28 -0
- package/esm/helpers/responsive-map.js +67 -15
- package/esm/{utils → helpers}/type-guards.js +24 -8
- package/esm/http/{param-codec → codecs}/boolean-codec.js +5 -2
- package/{cjs/http/param-codec → esm/http/codecs}/date-codec.js +1 -4
- package/{cjs/url/formats/filter-format.js → esm/http/codecs/filter-codec.js} +5 -6
- package/{cjs/url/formats/integer-format.js → esm/http/codecs/integer-codec.js} +6 -6
- package/esm/http/{param-codec → codecs}/number-codec.js +5 -3
- package/esm/http/{param-codec → codecs}/string-codec.js +5 -3
- package/esm/http/enums/http-headers-codes.enum.js +18 -6
- package/esm/http/enums/http-status-codes.enum.js +5 -2
- package/esm/http/enums/http-status-messages.js +68 -0
- package/esm/http/http-headers.js +144 -126
- package/esm/http/http-message.host.js +251 -0
- package/esm/http/http-params.js +86 -49
- package/esm/http/http-request-message.js +152 -0
- package/esm/http/http-response-message.js +238 -0
- package/esm/http/index.js +17 -17
- package/esm/http/interfaces/client-http-headers.interface.js +2 -1
- package/esm/http/interfaces/cookie-options.interface.js +2 -0
- package/esm/http/interfaces/server-http-headers.interface.js +2 -1
- package/esm/http/multipart/batch-multipart.js +170 -149
- package/esm/http/multipart/http-request-content.js +17 -8
- package/esm/http/multipart/http-response-content.js +14 -7
- package/esm/http/multipart/index.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 -10
- package/esm/schema/constants.js +4 -8
- package/esm/schema/data-type/complex-type.interface.js +7 -0
- package/esm/schema/data-type/data-type.interface.js +2 -0
- package/esm/schema/data-type/enum-type.interface.js +7 -0
- package/esm/schema/data-type/field.interface.js +2 -0
- package/esm/schema/data-type/mapped-type.interface.js +7 -0
- package/esm/schema/data-type/simple-type.interface.js +7 -0
- package/esm/schema/data-type/union-type.interface.js +7 -0
- package/esm/schema/document.interface.js +2 -0
- package/esm/schema/index.js +44 -25
- package/esm/schema/resource/collection.interface.js +7 -0
- package/esm/schema/resource/container.interface.js +7 -0
- package/esm/schema/resource/endpoint.interface.js +2 -0
- package/esm/schema/resource/resource.interface.js +2 -0
- package/esm/schema/resource/singleton.interface.js +7 -0
- package/esm/schema/type-guards.js +59 -0
- package/esm/types.js +2 -0
- package/esm/url/index.js +8 -5
- package/esm/url/opra-url-path-component.js +7 -3
- package/esm/url/opra-url-path.js +19 -12
- package/esm/url/opra-url.js +100 -127
- package/esm/url/utils/decode-path-component.js +41 -0
- package/esm/url/utils/encode-path-component.js +27 -0
- package/esm/utils/path-utils.js +24 -0
- package/package.json +23 -7
- package/types/document/api-document.d.ts +102 -0
- package/types/document/constants.d.ts +3 -0
- package/types/document/data-type/api-field.d.ts +41 -0
- package/types/document/data-type/builtin/any.type.d.ts +2 -0
- package/types/document/data-type/builtin/base64.type.d.ts +6 -0
- package/types/document/data-type/builtin/bigint.type.d.ts +6 -0
- package/types/document/data-type/builtin/boolean.type.d.ts +5 -0
- package/types/document/data-type/builtin/date.type.d.ts +4 -0
- package/types/document/data-type/builtin/guid.type.d.ts +7 -0
- package/types/document/data-type/builtin/index.d.ts +10 -0
- package/types/document/data-type/builtin/integer.type.d.ts +6 -0
- package/types/document/data-type/builtin/number.type.d.ts +6 -0
- package/types/document/data-type/builtin/object.type.d.ts +3 -0
- package/types/document/data-type/builtin/string.type.d.ts +5 -0
- package/types/document/data-type/builtin/time.type.d.ts +7 -0
- package/types/document/data-type/builtin/timestamp.type.d.ts +5 -0
- package/types/document/data-type/complex-type.d.ts +50 -0
- package/types/document/data-type/data-type.d.ts +33 -0
- package/types/document/data-type/enum-type.d.ts +32 -0
- package/types/document/data-type/mapped-type.d.ts +53 -0
- package/types/document/data-type/simple-type.d.ts +33 -0
- package/types/document/data-type/union-type.d.ts +42 -0
- package/types/document/factory/add-references.d.ts +4 -0
- package/types/document/factory/create-document.d.ts +12 -0
- package/types/document/factory/factory.d.ts +61 -0
- package/types/document/factory/import-resource-class.d.ts +10 -0
- package/types/document/factory/import-type-class.d.ts +17 -0
- package/types/document/factory/index.d.ts +1 -0
- package/types/document/factory/process-resources.d.ts +7 -0
- package/types/document/factory/process-types.d.ts +6 -0
- package/types/document/index.d.ts +14 -0
- package/types/document/resource/collection.d.ts +67 -0
- package/types/document/resource/resource.d.ts +29 -0
- package/types/document/resource/singleton.d.ts +49 -0
- package/{esm → types}/exception/resource-errors/resource-not-found.error.d.ts +4 -0
- package/types/helpers/function-utils.d.ts +4 -0
- package/types/helpers/get-stack-filename.d.ts +1 -0
- package/types/helpers/index.d.ts +8 -0
- package/types/helpers/is-url.d.ts +1 -0
- package/{esm/schema/utils/clone-object.util.d.ts → types/helpers/object-utils.d.ts} +1 -0
- package/types/helpers/path-to-object-tree.d.ts +4 -0
- package/types/helpers/responsive-map.d.ts +34 -0
- package/{esm/utils → types/helpers}/type-guards.d.ts +3 -1
- package/types/http/codecs/boolean-codec.d.ts +5 -0
- package/{esm/http/param-codec → types/http/codecs}/date-codec.d.ts +2 -2
- package/{esm/http/param-codec → types/http/codecs}/filter-codec.d.ts +2 -2
- package/types/http/codecs/integer-codec.d.ts +11 -0
- package/types/http/codecs/number-codec.d.ts +14 -0
- package/types/http/codecs/string-codec.d.ts +16 -0
- package/{esm → types}/http/enums/http-headers-codes.enum.d.ts +13 -4
- package/types/http/enums/http-status-messages.d.ts +65 -0
- package/types/http/http-headers.d.ts +86 -0
- package/types/http/http-message.host.d.ts +122 -0
- package/{esm → types}/http/http-params.d.ts +43 -29
- package/types/http/http-request-message.d.ts +213 -0
- package/types/http/http-response-message.d.ts +318 -0
- package/types/http/index.d.ts +14 -0
- package/types/http/interfaces/cookie-options.interface.d.ts +4 -0
- package/types/http/multipart/http-request-content.d.ts +0 -0
- package/types/http/multipart/http-response-content.d.ts +0 -0
- package/types/http/multipart/index.d.ts +0 -0
- package/{esm → types}/index.d.ts +6 -5
- package/types/schema/constants.d.ts +2 -0
- package/types/schema/data-type/complex-type.interface.d.ts +16 -0
- package/types/schema/data-type/data-type.interface.d.ts +14 -0
- package/types/schema/data-type/enum-type.interface.d.ts +15 -0
- package/types/schema/data-type/field.interface.d.ts +21 -0
- package/types/schema/data-type/mapped-type.interface.d.ts +11 -0
- package/types/schema/data-type/simple-type.interface.d.ts +18 -0
- package/types/schema/data-type/union-type.interface.d.ts +10 -0
- package/types/schema/document.interface.d.ts +34 -0
- package/types/schema/index.d.ts +51 -0
- package/types/schema/resource/collection.interface.d.ts +33 -0
- package/types/schema/resource/container.interface.d.ts +9 -0
- package/types/schema/resource/endpoint.interface.d.ts +29 -0
- package/types/schema/resource/resource.interface.d.ts +12 -0
- package/types/schema/resource/singleton.interface.d.ts +22 -0
- package/types/schema/type-guards.d.ts +20 -0
- package/{esm/schema → types}/types.d.ts +0 -3
- package/{esm → types}/url/index.d.ts +2 -2
- package/{esm → types}/url/opra-url.d.ts +10 -29
- package/types/url/utils/decode-path-component.d.ts +5 -0
- package/types/url/utils/encode-path-component.d.ts +1 -0
- package/types/utils/path-utils.d.ts +2 -0
- package/cjs/constants.js +0 -1
- package/cjs/http/http-param-codec.js +0 -6
- package/cjs/http/http-request-node.js +0 -105
- package/cjs/http/http-request.js +0 -89
- package/cjs/http/http-response.js +0 -23
- package/cjs/http/utils/encodeURIParam.js +0 -21
- package/cjs/http/utils/normalize-headers.js +0 -28
- package/cjs/schema/decorators/opr-collection-resource.decorator.js +0 -24
- package/cjs/schema/decorators/opr-complex-type.decorator.js +0 -28
- package/cjs/schema/decorators/opr-field.decorator.js +0 -29
- package/cjs/schema/decorators/opr-resolver.decorator.js +0 -81
- package/cjs/schema/decorators/opr-simple-type.decorator.js +0 -19
- package/cjs/schema/decorators/opr-singleton-resource.decorator.js +0 -24
- package/cjs/schema/implementation/data-type/builtin/any.type.js +0 -9
- package/cjs/schema/implementation/data-type/builtin/base64-binary.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/bigint.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/boolean.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/date-string.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/date.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/guid.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/integer.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/number.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/object.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin/string.type.js +0 -15
- package/cjs/schema/implementation/data-type/builtin-data-types.js +0 -37
- package/cjs/schema/implementation/data-type/complex-type.js +0 -110
- package/cjs/schema/implementation/data-type/data-type.js +0 -37
- package/cjs/schema/implementation/data-type/simple-type.js +0 -21
- package/cjs/schema/implementation/data-type/union-type.js +0 -24
- package/cjs/schema/implementation/document-builder.js +0 -140
- package/cjs/schema/implementation/opra-document.js +0 -183
- package/cjs/schema/implementation/query/collection-count-query.js +0 -17
- package/cjs/schema/implementation/query/collection-create-query.js +0 -23
- package/cjs/schema/implementation/query/collection-delete-many-query.js +0 -17
- package/cjs/schema/implementation/query/collection-delete-query.js +0 -25
- package/cjs/schema/implementation/query/collection-get-query.js +0 -32
- package/cjs/schema/implementation/query/collection-search-query.js +0 -45
- package/cjs/schema/implementation/query/collection-update-many-query.js +0 -18
- package/cjs/schema/implementation/query/collection-update-query.js +0 -33
- package/cjs/schema/implementation/query/field-get-query.js +0 -34
- package/cjs/schema/implementation/query/index.js +0 -22
- package/cjs/schema/implementation/query/singleton-get-query.js +0 -22
- package/cjs/schema/implementation/resource/collection-resource-info.js +0 -72
- package/cjs/schema/implementation/resource/container-resource-info.js +0 -30
- package/cjs/schema/implementation/resource/resource-info.js +0 -35
- package/cjs/schema/implementation/resource/singleton-resource-info.js +0 -44
- package/cjs/schema/implementation/schema-builder/extract-resource-metadata.util.js +0 -84
- package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +0 -94
- package/cjs/schema/opra-schema.definition.js +0 -49
- package/cjs/schema/type-helpers/extend-type.helper.js +0 -65
- package/cjs/schema/type-helpers/mixin-type.helper.js +0 -46
- package/cjs/schema/utils/class.utils.js +0 -8
- package/cjs/schema/utils/normalize-field-array.util.js +0 -44
- package/cjs/schema/utils/path-to-tree.util.js +0 -26
- package/cjs/url/formats/boolean-format.js +0 -25
- package/cjs/url/formats/date-format.js +0 -44
- package/cjs/url/formats/format.js +0 -6
- package/cjs/url/formats/number-format.js +0 -26
- package/cjs/url/formats/string-format.js +0 -25
- package/cjs/url/opra-url-search-params.js +0 -28
- package/cjs/utils/index.js +0 -6
- package/esm/constants.js +0 -1
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/responsive-map.d.ts +0 -32
- package/esm/http/http-headers.d.ts +0 -70
- package/esm/http/http-param-codec.d.ts +0 -4
- package/esm/http/http-param-codec.js +0 -2
- package/esm/http/http-request-node.d.ts +0 -34
- package/esm/http/http-request-node.js +0 -101
- package/esm/http/http-request.d.ts +0 -76
- package/esm/http/http-request.js +0 -85
- package/esm/http/http-response.d.ts +0 -41
- package/esm/http/http-response.js +0 -19
- package/esm/http/index.d.ts +0 -17
- package/esm/http/multipart/batch-multipart.d.ts +0 -31
- package/esm/http/multipart/http-request-content.d.ts +0 -8
- package/esm/http/multipart/http-response-content.d.ts +0 -7
- package/esm/http/multipart/index.d.ts +0 -1
- package/esm/http/param-codec/boolean-codec.d.ts +0 -5
- package/esm/http/param-codec/filter-codec.js +0 -14
- package/esm/http/param-codec/integer-codec.d.ts +0 -9
- package/esm/http/param-codec/integer-codec.js +0 -15
- package/esm/http/param-codec/number-codec.d.ts +0 -12
- package/esm/http/param-codec/string-codec.d.ts +0 -14
- package/esm/http/utils/encodeURIParam.d.ts +0 -1
- package/esm/http/utils/encodeURIParam.js +0 -17
- package/esm/http/utils/normalize-headers.d.ts +0 -1
- package/esm/http/utils/normalize-headers.js +0 -24
- package/esm/schema/constants.d.ts +0 -8
- package/esm/schema/decorators/opr-collection-resource.decorator.d.ts +0 -8
- package/esm/schema/decorators/opr-collection-resource.decorator.js +0 -19
- package/esm/schema/decorators/opr-complex-type.decorator.d.ts +0 -6
- package/esm/schema/decorators/opr-complex-type.decorator.js +0 -23
- package/esm/schema/decorators/opr-field.decorator.d.ts +0 -3
- package/esm/schema/decorators/opr-field.decorator.js +0 -24
- package/esm/schema/decorators/opr-resolver.decorator.d.ts +0 -8
- package/esm/schema/decorators/opr-resolver.decorator.js +0 -71
- package/esm/schema/decorators/opr-simple-type.decorator.d.ts +0 -6
- package/esm/schema/decorators/opr-simple-type.decorator.js +0 -14
- package/esm/schema/decorators/opr-singleton-resource.decorator.d.ts +0 -8
- package/esm/schema/decorators/opr-singleton-resource.decorator.js +0 -19
- package/esm/schema/implementation/data-type/builtin/any.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/any.type.js +0 -6
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/bigint.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/bigint.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/boolean.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/boolean.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/date-string.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/date-string.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/date.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/date.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/guid.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/guid.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/integer.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/integer.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/number.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/number.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/object.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/object.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin/string.type.d.ts +0 -2
- package/esm/schema/implementation/data-type/builtin/string.type.js +0 -12
- package/esm/schema/implementation/data-type/builtin-data-types.d.ts +0 -4
- package/esm/schema/implementation/data-type/builtin-data-types.js +0 -34
- package/esm/schema/implementation/data-type/complex-type.d.ts +0 -29
- package/esm/schema/implementation/data-type/complex-type.js +0 -106
- package/esm/schema/implementation/data-type/data-type.d.ts +0 -17
- package/esm/schema/implementation/data-type/data-type.js +0 -33
- package/esm/schema/implementation/data-type/simple-type.d.ts +0 -12
- package/esm/schema/implementation/data-type/simple-type.js +0 -17
- package/esm/schema/implementation/data-type/union-type.d.ts +0 -16
- package/esm/schema/implementation/data-type/union-type.js +0 -19
- package/esm/schema/implementation/document-builder.d.ts +0 -16
- package/esm/schema/implementation/document-builder.js +0 -135
- package/esm/schema/implementation/opra-document.d.ts +0 -44
- package/esm/schema/implementation/opra-document.js +0 -178
- package/esm/schema/implementation/query/collection-count-query.d.ts +0 -14
- package/esm/schema/implementation/query/collection-count-query.js +0 -13
- package/esm/schema/implementation/query/collection-create-query.d.ts +0 -18
- package/esm/schema/implementation/query/collection-create-query.js +0 -19
- package/esm/schema/implementation/query/collection-delete-many-query.d.ts +0 -14
- package/esm/schema/implementation/query/collection-delete-many-query.js +0 -13
- package/esm/schema/implementation/query/collection-delete-query.d.ts +0 -10
- package/esm/schema/implementation/query/collection-delete-query.js +0 -21
- package/esm/schema/implementation/query/collection-get-query.d.ts +0 -21
- package/esm/schema/implementation/query/collection-get-query.js +0 -28
- package/esm/schema/implementation/query/collection-search-query.d.ts +0 -30
- package/esm/schema/implementation/query/collection-search-query.js +0 -41
- package/esm/schema/implementation/query/collection-update-many-query.d.ts +0 -15
- package/esm/schema/implementation/query/collection-update-many-query.js +0 -14
- package/esm/schema/implementation/query/collection-update-query.d.ts +0 -19
- package/esm/schema/implementation/query/collection-update-query.js +0 -29
- package/esm/schema/implementation/query/field-get-query.d.ts +0 -30
- package/esm/schema/implementation/query/field-get-query.js +0 -30
- package/esm/schema/implementation/query/index.d.ts +0 -27
- package/esm/schema/implementation/query/index.js +0 -17
- package/esm/schema/implementation/query/singleton-get-query.d.ts +0 -20
- package/esm/schema/implementation/query/singleton-get-query.js +0 -18
- package/esm/schema/implementation/resource/collection-resource-info.d.ts +0 -22
- package/esm/schema/implementation/resource/collection-resource-info.js +0 -68
- package/esm/schema/implementation/resource/container-resource-info.d.ts +0 -13
- package/esm/schema/implementation/resource/container-resource-info.js +0 -26
- package/esm/schema/implementation/resource/resource-info.d.ts +0 -17
- package/esm/schema/implementation/resource/resource-info.js +0 -31
- package/esm/schema/implementation/resource/singleton-resource-info.d.ts +0 -15
- package/esm/schema/implementation/resource/singleton-resource-info.js +0 -40
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +0 -3
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.js +0 -80
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +0 -4
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +0 -90
- package/esm/schema/index.d.ts +0 -25
- package/esm/schema/interfaces/child-field-query.interface.d.ts +0 -4
- package/esm/schema/interfaces/child-field-query.interface.js +0 -1
- package/esm/schema/interfaces/data-type.metadata.d.ts +0 -18
- package/esm/schema/interfaces/data-type.metadata.js +0 -1
- package/esm/schema/interfaces/resource-container.interface.d.ts +0 -8
- package/esm/schema/interfaces/resource-container.interface.js +0 -1
- package/esm/schema/interfaces/resource.metadata.d.ts +0 -18
- package/esm/schema/interfaces/resource.metadata.js +0 -1
- package/esm/schema/opra-schema.definition.d.ts +0 -178
- package/esm/schema/opra-schema.definition.js +0 -46
- package/esm/schema/type-helpers/extend-type.helper.d.ts +0 -3
- package/esm/schema/type-helpers/extend-type.helper.js +0 -60
- package/esm/schema/type-helpers/mixin-type.helper.d.ts +0 -2
- package/esm/schema/type-helpers/mixin-type.helper.js +0 -42
- package/esm/schema/types.js +0 -1
- package/esm/schema/utils/class.utils.d.ts +0 -2
- package/esm/schema/utils/class.utils.js +0 -4
- package/esm/schema/utils/clone-object.util.js +0 -14
- package/esm/schema/utils/inspect.util.js +0 -4
- package/esm/schema/utils/normalize-field-array.util.d.ts +0 -3
- package/esm/schema/utils/normalize-field-array.util.js +0 -40
- package/esm/schema/utils/path-to-tree.util.d.ts +0 -4
- package/esm/schema/utils/path-to-tree.util.js +0 -22
- package/esm/schema/utils/string-compare.util.js +0 -7
- package/esm/url/formats/boolean-format.d.ts +0 -5
- package/esm/url/formats/boolean-format.js +0 -21
- package/esm/url/formats/date-format.d.ts +0 -16
- package/esm/url/formats/date-format.js +0 -40
- package/esm/url/formats/filter-format.d.ts +0 -6
- package/esm/url/formats/filter-format.js +0 -14
- package/esm/url/formats/format.d.ts +0 -4
- package/esm/url/formats/format.js +0 -2
- package/esm/url/formats/integer-format.d.ts +0 -9
- package/esm/url/formats/integer-format.js +0 -15
- package/esm/url/formats/number-format.d.ts +0 -12
- package/esm/url/formats/number-format.js +0 -22
- package/esm/url/formats/string-format.d.ts +0 -14
- package/esm/url/formats/string-format.js +0 -21
- package/esm/url/opra-url-search-params.d.ts +0 -5
- package/esm/url/opra-url-search-params.js +0 -24
- package/esm/url/utils/path-utils.d.ts +0 -8
- package/esm/url/utils/path-utils.js +0 -78
- package/esm/utils/index.d.ts +0 -3
- package/esm/utils/index.js +0 -3
- package/esm/utils/is-url.d.ts +0 -1
- package/esm/utils/is-url.js +0 -4
- package/esm/utils/path-to-tree.d.ts +0 -4
- package/esm/utils/path-to-tree.js +0 -24
- /package/cjs/{schema → document}/utils/inspect.util.js +0 -0
- /package/cjs/{schema → document}/utils/string-compare.util.js +0 -0
- /package/cjs/{schema/type-helpers/mixin.utils.js → helpers/mixin-utils.js} +0 -0
- /package/cjs/http/{param-codec → codecs}/integer-codec.js +0 -0
- /package/cjs/{schema/interfaces/child-field-query.interface.js → http/interfaces/cookie-options.interface.js} +0 -0
- /package/cjs/schema/{interfaces/data-type.metadata.js → data-type/data-type.interface.js} +0 -0
- /package/cjs/schema/{interfaces/resource-container.interface.js → data-type/field.interface.js} +0 -0
- /package/cjs/schema/{interfaces/resource.metadata.js → document.interface.js} +0 -0
- /package/cjs/schema/{types.js → resource/endpoint.interface.js} +0 -0
- /package/{esm/schema → types/document}/utils/inspect.util.d.ts +0 -0
- /package/{esm/schema → 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/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/schema/type-helpers/mixin.utils.d.ts → types/helpers/mixin-utils.d.ts} +0 -0
- /package/{esm → types}/http/enums/http-status-codes.enum.d.ts +0 -0
- /package/{esm → types}/http/interfaces/client-http-headers.interface.d.ts +0 -0
- /package/{esm → types}/http/interfaces/server-http-headers.interface.d.ts +0 -0
- /package/{esm/constants.d.ts → types/http/multipart/batch-multipart.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}/url/opra-url-path-component.d.ts +0 -0
- /package/{esm → types}/url/opra-url-path.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isContainer = exports.isSingleton = exports.isCollection = exports.isResource = exports.isEnumType = exports.isMappedType = exports.isUnionType = exports.isSimpleType = exports.isComplexType = exports.isDataType = void 0;
|
|
4
|
+
const complex_type_interface_js_1 = require("./data-type/complex-type.interface.js");
|
|
5
|
+
const enum_type_interface_js_1 = require("./data-type/enum-type.interface.js");
|
|
6
|
+
const mapped_type_interface_js_1 = require("./data-type/mapped-type.interface.js");
|
|
7
|
+
const simple_type_interface_js_1 = require("./data-type/simple-type.interface.js");
|
|
8
|
+
const union_type_interface_js_1 = require("./data-type/union-type.interface.js");
|
|
9
|
+
const collection_interface_js_1 = require("./resource/collection.interface.js");
|
|
10
|
+
const container_interface_js_1 = require("./resource/container.interface.js");
|
|
11
|
+
const singleton_interface_js_1 = require("./resource/singleton.interface.js");
|
|
12
|
+
function isDataType(obj) {
|
|
13
|
+
return obj && typeof obj === 'object' &&
|
|
14
|
+
(obj.kind === complex_type_interface_js_1.ComplexType.Kind ||
|
|
15
|
+
obj.kind === enum_type_interface_js_1.EnumType.Kind ||
|
|
16
|
+
obj.kind === mapped_type_interface_js_1.MappedType.Kind ||
|
|
17
|
+
obj.kind === simple_type_interface_js_1.SimpleType.Kind ||
|
|
18
|
+
obj.kind === union_type_interface_js_1.UnionType.Kind);
|
|
19
|
+
}
|
|
20
|
+
exports.isDataType = isDataType;
|
|
21
|
+
function isComplexType(obj) {
|
|
22
|
+
return obj && typeof obj === 'object' && obj.kind === complex_type_interface_js_1.ComplexType.Kind;
|
|
23
|
+
}
|
|
24
|
+
exports.isComplexType = isComplexType;
|
|
25
|
+
function isSimpleType(obj) {
|
|
26
|
+
return obj && typeof obj === 'object' && obj.kind === simple_type_interface_js_1.SimpleType.Kind;
|
|
27
|
+
}
|
|
28
|
+
exports.isSimpleType = isSimpleType;
|
|
29
|
+
function isUnionType(obj) {
|
|
30
|
+
return obj && typeof obj === 'object' && obj.kind === union_type_interface_js_1.UnionType.Kind;
|
|
31
|
+
}
|
|
32
|
+
exports.isUnionType = isUnionType;
|
|
33
|
+
function isMappedType(obj) {
|
|
34
|
+
return obj && typeof obj === 'object' && obj.kind === mapped_type_interface_js_1.MappedType.Kind;
|
|
35
|
+
}
|
|
36
|
+
exports.isMappedType = isMappedType;
|
|
37
|
+
function isEnumType(obj) {
|
|
38
|
+
return obj && typeof obj === 'object' && obj.kind === enum_type_interface_js_1.EnumType.Kind;
|
|
39
|
+
}
|
|
40
|
+
exports.isEnumType = isEnumType;
|
|
41
|
+
function isResource(obj) {
|
|
42
|
+
return obj && typeof obj === 'object' &&
|
|
43
|
+
(obj.kind === container_interface_js_1.Container.Kind ||
|
|
44
|
+
obj.kind === collection_interface_js_1.Collection.Kind ||
|
|
45
|
+
obj.kind === singleton_interface_js_1.Singleton.Kind);
|
|
46
|
+
}
|
|
47
|
+
exports.isResource = isResource;
|
|
48
|
+
function isCollection(obj) {
|
|
49
|
+
return obj && typeof obj === 'object' && obj.kind === collection_interface_js_1.Collection.Kind;
|
|
50
|
+
}
|
|
51
|
+
exports.isCollection = isCollection;
|
|
52
|
+
function isSingleton(obj) {
|
|
53
|
+
return obj && typeof obj === 'object' && obj.kind === singleton_interface_js_1.Singleton.Kind;
|
|
54
|
+
}
|
|
55
|
+
exports.isSingleton = isSingleton;
|
|
56
|
+
function isContainer(obj) {
|
|
57
|
+
return obj && typeof obj === 'object' && obj.kind === container_interface_js_1.Container.Kind;
|
|
58
|
+
}
|
|
59
|
+
exports.isContainer = isContainer;
|
package/cjs/types.js
ADDED
package/cjs/url/index.js
CHANGED
|
@@ -4,5 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./opra-url.js"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./opra-url-path.js"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./opra-url-path-component.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
8
|
-
tslib_1.__exportStar(require("./utils/path-
|
|
7
|
+
tslib_1.__exportStar(require("./utils/encode-path-component.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./utils/decode-path-component.js"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpraURLPathComponent = void 0;
|
|
4
|
-
const
|
|
4
|
+
const encode_path_component_js_1 = require("./utils/encode-path-component.js");
|
|
5
5
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
6
6
|
class OpraURLPathComponent {
|
|
7
7
|
constructor(init) {
|
|
@@ -10,7 +10,7 @@ class OpraURLPathComponent {
|
|
|
10
10
|
this.typeCast = init.typeCast;
|
|
11
11
|
}
|
|
12
12
|
toString() {
|
|
13
|
-
const obj = (0,
|
|
13
|
+
const obj = (0, encode_path_component_js_1.encodePathComponent)(this.resource, this.key, this.typeCast);
|
|
14
14
|
if (obj)
|
|
15
15
|
Object.setPrototypeOf(obj, OpraURLPathComponent.prototype);
|
|
16
16
|
return obj;
|
package/cjs/url/opra-url-path.js
CHANGED
|
@@ -3,9 +3,11 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.OpraURLPath = void 0;
|
|
5
5
|
const fast_tokenizer_1 = require("fast-tokenizer");
|
|
6
|
-
const index_js_1 = require("../
|
|
6
|
+
const index_js_1 = require("../helpers/index.js");
|
|
7
|
+
const path_utils_js_1 = require("../utils/path-utils.js");
|
|
7
8
|
const opra_url_path_component_js_1 = require("./opra-url-path-component.js");
|
|
8
|
-
const
|
|
9
|
+
const decode_path_component_js_1 = require("./utils/decode-path-component.js");
|
|
10
|
+
const encode_path_component_js_1 = require("./utils/encode-path-component.js");
|
|
9
11
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
10
12
|
const kEntries = Symbol('kEntries');
|
|
11
13
|
const kOptions = Symbol('kOptions');
|
|
@@ -89,7 +91,8 @@ class OpraURLPath {
|
|
|
89
91
|
return this.splice(0, 0, join);
|
|
90
92
|
}
|
|
91
93
|
toString() {
|
|
92
|
-
return this[kEntries]
|
|
94
|
+
return this[kEntries]
|
|
95
|
+
.map(x => (0, encode_path_component_js_1.encodePathComponent)(x.resource, x.key, x.typeCast)).join('/');
|
|
93
96
|
}
|
|
94
97
|
values() {
|
|
95
98
|
let i = -1;
|
|
@@ -113,7 +116,7 @@ class OpraURLPath {
|
|
|
113
116
|
delimiters: '/', quotes: true, brackets: true,
|
|
114
117
|
});
|
|
115
118
|
for (const x of pathTokenizer) {
|
|
116
|
-
const p = (0,
|
|
119
|
+
const p = (0, decode_path_component_js_1.decodePathComponent)(x);
|
|
117
120
|
target.push(new opra_url_path_component_js_1.OpraURLPathComponent(p));
|
|
118
121
|
}
|
|
119
122
|
return;
|
package/cjs/url/opra-url.js
CHANGED
|
@@ -3,9 +3,10 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.OpraURL = void 0;
|
|
5
5
|
const fast_tokenizer_1 = require("fast-tokenizer");
|
|
6
|
+
const index_js_1 = require("../http/index.js");
|
|
7
|
+
const path_utils_js_1 = require("../utils/path-utils.js");
|
|
6
8
|
const opra_url_path_js_1 = require("./opra-url-path.js");
|
|
7
|
-
const
|
|
8
|
-
const path_utils_js_1 = require("./utils/path-utils.js");
|
|
9
|
+
const decode_path_component_js_1 = require("./utils/decode-path-component.js");
|
|
9
10
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
10
11
|
const urlRegEx = /^(?:((?:[A-Z][A-Z+-.]+:)+)\/\/([^/?]+))?(.*)?$/i;
|
|
11
12
|
const schemeRegEx = /^([A-Z][A-Z+-.]+:?)+$/i;
|
|
@@ -13,34 +14,29 @@ const hostRegEx = /^([^/:]+)(?::(\d+))?$/;
|
|
|
13
14
|
const hostnameRegEx = /^([^/:]+)$/;
|
|
14
15
|
const kContext = Symbol('kContext');
|
|
15
16
|
const kPath = Symbol('kPath');
|
|
16
|
-
const
|
|
17
|
+
const kParams = Symbol('kParams');
|
|
17
18
|
class OpraURL {
|
|
18
|
-
constructor(input,
|
|
19
|
+
constructor(input, base) {
|
|
19
20
|
this[_a] = {
|
|
20
21
|
protocol: '',
|
|
21
22
|
username: '',
|
|
22
|
-
pathname: '',
|
|
23
23
|
prefix: '',
|
|
24
24
|
hostname: '',
|
|
25
25
|
port: '',
|
|
26
26
|
hash: '',
|
|
27
|
-
password: ''
|
|
28
|
-
search: '',
|
|
29
|
-
address: '',
|
|
30
|
-
needUpdate: true
|
|
27
|
+
password: ''
|
|
31
28
|
};
|
|
32
29
|
this[kPath] = new opra_url_path_js_1.OpraURLPath('', {
|
|
33
|
-
onChange: () =>
|
|
30
|
+
onChange: () => {
|
|
31
|
+
this[kContext].pathname = undefined;
|
|
32
|
+
this[kContext].address = undefined;
|
|
33
|
+
}
|
|
34
34
|
});
|
|
35
|
-
this[
|
|
36
|
-
onChange: () =>
|
|
35
|
+
this[kParams] = new index_js_1.HttpParams('', {
|
|
36
|
+
onChange: () => {
|
|
37
|
+
this[kContext].search = undefined;
|
|
38
|
+
}
|
|
37
39
|
});
|
|
38
|
-
const base = typeof arg1 === 'object' ? arg1.base : arg1;
|
|
39
|
-
if (typeof arg1 === 'object') {
|
|
40
|
-
const defineParams = arg1?.params;
|
|
41
|
-
if (defineParams)
|
|
42
|
-
Object.keys(defineParams).forEach(key => this.searchParams.define(key, defineParams[key]));
|
|
43
|
-
}
|
|
44
40
|
if (input)
|
|
45
41
|
this.parse(typeof input === 'object' ? input.toString() : input);
|
|
46
42
|
if (base) {
|
|
@@ -52,7 +48,19 @@ class OpraURL {
|
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
get address() {
|
|
55
|
-
this.
|
|
51
|
+
if (this[kContext].address == null) {
|
|
52
|
+
let address = '';
|
|
53
|
+
if (this[kContext].hostname) {
|
|
54
|
+
address += (this[kContext].protocol || 'http:') + '//' +
|
|
55
|
+
(this[kContext].username || this[kContext].password
|
|
56
|
+
? ((this[kContext].username ? encodeURIComponent(this[kContext].username) : '') +
|
|
57
|
+
(this[kContext].password ? ':' + encodeURIComponent(this[kContext].password) : '') + '@')
|
|
58
|
+
: '') + this.host;
|
|
59
|
+
}
|
|
60
|
+
this[kContext].address = address +
|
|
61
|
+
(this.prefix !== '/' ? this.prefix : '') +
|
|
62
|
+
(this.pathname !== '/' ? this.pathname : '');
|
|
63
|
+
}
|
|
56
64
|
return this[kContext].address;
|
|
57
65
|
}
|
|
58
66
|
get host() {
|
|
@@ -66,17 +74,16 @@ class OpraURL {
|
|
|
66
74
|
host: v,
|
|
67
75
|
code: 'ERR_INVALID_URL'
|
|
68
76
|
});
|
|
69
|
-
this
|
|
70
|
-
this
|
|
77
|
+
this.hostname = m[1];
|
|
78
|
+
this.port = m[2] || '';
|
|
71
79
|
}
|
|
72
80
|
else {
|
|
73
|
-
this
|
|
74
|
-
this
|
|
81
|
+
this.hostname = '';
|
|
82
|
+
this.port = '';
|
|
75
83
|
}
|
|
76
|
-
this._changed();
|
|
77
84
|
}
|
|
78
85
|
get hostname() {
|
|
79
|
-
return this[kContext].hostname
|
|
86
|
+
return this[kContext].hostname;
|
|
80
87
|
}
|
|
81
88
|
set hostname(v) {
|
|
82
89
|
if (v) {
|
|
@@ -89,7 +96,7 @@ class OpraURL {
|
|
|
89
96
|
}
|
|
90
97
|
else
|
|
91
98
|
this[kContext].hostname = '';
|
|
92
|
-
this.
|
|
99
|
+
this[kContext].address = undefined;
|
|
93
100
|
}
|
|
94
101
|
get href() {
|
|
95
102
|
return this.address + this.search + this.hash;
|
|
@@ -98,8 +105,8 @@ class OpraURL {
|
|
|
98
105
|
return this[kContext].password;
|
|
99
106
|
}
|
|
100
107
|
set password(v) {
|
|
101
|
-
this[kContext].password = v
|
|
102
|
-
this.
|
|
108
|
+
this[kContext].password = v ?? '';
|
|
109
|
+
this[kContext].address = undefined;
|
|
103
110
|
}
|
|
104
111
|
get port() {
|
|
105
112
|
return this[kContext].port;
|
|
@@ -107,17 +114,16 @@ class OpraURL {
|
|
|
107
114
|
set port(value) {
|
|
108
115
|
if (value) {
|
|
109
116
|
// noinspection SuspiciousTypeOfGuard
|
|
110
|
-
const v = parseInt(value, 10);
|
|
117
|
+
const v = typeof value === 'number' ? value : parseInt(value, 10);
|
|
111
118
|
if (isNaN(v) || v < 1 || v > 35535 || v % 1 > 0)
|
|
112
119
|
throw Object.assign(new TypeError('Invalid port'), {
|
|
113
120
|
hostname: v,
|
|
114
121
|
code: 'ERR_INVALID_URL'
|
|
115
122
|
});
|
|
116
|
-
this[kContext].port =
|
|
123
|
+
this[kContext].port = String(v);
|
|
117
124
|
}
|
|
118
125
|
else
|
|
119
126
|
this[kContext].port = '';
|
|
120
|
-
this._changed();
|
|
121
127
|
}
|
|
122
128
|
get prefix() {
|
|
123
129
|
return this[kContext].prefix;
|
|
@@ -129,10 +135,10 @@ class OpraURL {
|
|
|
129
135
|
}
|
|
130
136
|
else
|
|
131
137
|
this[kContext].prefix = '';
|
|
132
|
-
this.
|
|
138
|
+
this[kContext].address = undefined;
|
|
133
139
|
}
|
|
134
140
|
get protocol() {
|
|
135
|
-
return this[kContext].protocol
|
|
141
|
+
return this[kContext].protocol;
|
|
136
142
|
}
|
|
137
143
|
set protocol(v) {
|
|
138
144
|
if (v) {
|
|
@@ -145,14 +151,14 @@ class OpraURL {
|
|
|
145
151
|
}
|
|
146
152
|
else
|
|
147
153
|
this[kContext].protocol = '';
|
|
148
|
-
this.
|
|
154
|
+
this[kContext].address = undefined;
|
|
149
155
|
}
|
|
150
156
|
get username() {
|
|
151
157
|
return this[kContext].username;
|
|
152
158
|
}
|
|
153
159
|
set username(v) {
|
|
154
|
-
this[kContext].username = v
|
|
155
|
-
this.
|
|
160
|
+
this[kContext].username = v ?? '';
|
|
161
|
+
this[kContext].address = undefined;
|
|
156
162
|
}
|
|
157
163
|
get origin() {
|
|
158
164
|
return this.hostname ? (this.protocol + '//' + this.hostname) : '';
|
|
@@ -161,29 +167,35 @@ class OpraURL {
|
|
|
161
167
|
return this[kPath];
|
|
162
168
|
}
|
|
163
169
|
get pathname() {
|
|
164
|
-
this.
|
|
165
|
-
|
|
170
|
+
if (this[kContext].pathname == null)
|
|
171
|
+
this[kContext].pathname = '/' + this[kPath].toString();
|
|
172
|
+
return this[kContext].pathname;
|
|
166
173
|
}
|
|
167
174
|
set pathname(v) {
|
|
168
175
|
this._setPathname(v, false);
|
|
169
176
|
}
|
|
170
|
-
get searchParams() {
|
|
171
|
-
return this[kSearchParams];
|
|
172
|
-
}
|
|
173
177
|
get hash() {
|
|
174
|
-
return this[kContext].hash
|
|
178
|
+
return this[kContext].hash;
|
|
175
179
|
}
|
|
176
180
|
set hash(v) {
|
|
177
181
|
this[kContext].hash = v ? (v.startsWith('#') ? v : '#' + v) : '';
|
|
178
|
-
this._changed();
|
|
179
182
|
}
|
|
180
183
|
get search() {
|
|
181
|
-
this.
|
|
182
|
-
|
|
184
|
+
if (this[kContext].search == null) {
|
|
185
|
+
const s = this[kParams].toString();
|
|
186
|
+
this[kContext].search = s ? ('?' + s) : '';
|
|
187
|
+
}
|
|
188
|
+
return this[kContext].search;
|
|
183
189
|
}
|
|
184
190
|
set search(v) {
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
if (v) {
|
|
192
|
+
this[kParams].clear();
|
|
193
|
+
this[kParams].appendAll(v);
|
|
194
|
+
}
|
|
195
|
+
this[kContext].search = undefined;
|
|
196
|
+
}
|
|
197
|
+
get searchParams() {
|
|
198
|
+
return this[kParams];
|
|
187
199
|
}
|
|
188
200
|
parse(input) {
|
|
189
201
|
const m = urlRegEx.exec(input);
|
|
@@ -216,60 +228,18 @@ class OpraURL {
|
|
|
216
228
|
this.hash = tokenizer.join('#');
|
|
217
229
|
tokenizer = (0, fast_tokenizer_1.tokenize)(input, { delimiters: '?', quotes: true, brackets: true });
|
|
218
230
|
this._setPathname(tokenizer.next() || '', isAbsolute);
|
|
219
|
-
this.
|
|
220
|
-
this.searchParams.appendAll(tokenizer.join('&'));
|
|
221
|
-
this._changed();
|
|
231
|
+
this.search = tokenizer.join('&');
|
|
222
232
|
}
|
|
223
233
|
join(...source) {
|
|
224
234
|
this.path.join(...source);
|
|
225
235
|
return this;
|
|
226
236
|
}
|
|
227
|
-
addParam(name, value) {
|
|
228
|
-
this.searchParams.append(name, value);
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
setParam(name, value) {
|
|
232
|
-
this.searchParams.set(name, value);
|
|
233
|
-
return this;
|
|
234
|
-
}
|
|
235
|
-
setHost(v) {
|
|
236
|
-
this.host = v;
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
setHostname(v) {
|
|
240
|
-
this.hostname = v;
|
|
241
|
-
return this;
|
|
242
|
-
}
|
|
243
|
-
setProtocol(v) {
|
|
244
|
-
this.protocol = v;
|
|
245
|
-
return this;
|
|
246
|
-
}
|
|
247
|
-
setPort(v) {
|
|
248
|
-
this.port = v ? String(v) : '';
|
|
249
|
-
return this;
|
|
250
|
-
}
|
|
251
|
-
setPrefix(v) {
|
|
252
|
-
this.prefix = v;
|
|
253
|
-
return this;
|
|
254
|
-
}
|
|
255
|
-
setPathname(v) {
|
|
256
|
-
this.pathname = v;
|
|
257
|
-
return this;
|
|
258
|
-
}
|
|
259
|
-
setHash(v) {
|
|
260
|
-
this.hash = v;
|
|
261
|
-
return this;
|
|
262
|
-
}
|
|
263
|
-
setSearch(v) {
|
|
264
|
-
this.search = v;
|
|
265
|
-
return this;
|
|
266
|
-
}
|
|
267
237
|
toString() {
|
|
268
238
|
return this.href;
|
|
269
239
|
}
|
|
270
240
|
/* istanbul ignore next */
|
|
271
241
|
[(_a = kContext, nodeInspectCustom)]() {
|
|
272
|
-
this._update();
|
|
242
|
+
// this._update();
|
|
273
243
|
return {
|
|
274
244
|
protocol: this.protocol,
|
|
275
245
|
username: this.username,
|
|
@@ -281,29 +251,32 @@ class OpraURL {
|
|
|
281
251
|
path: this.path,
|
|
282
252
|
pathname: this.pathname,
|
|
283
253
|
search: this.search,
|
|
284
|
-
searchParams: this.searchParams,
|
|
285
254
|
hash: this.hash,
|
|
286
255
|
};
|
|
287
256
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
257
|
+
//
|
|
258
|
+
// protected _update() {
|
|
259
|
+
// if (!this[kContext].needUpdate)
|
|
260
|
+
// return;
|
|
261
|
+
// const ctx = this[kContext];
|
|
262
|
+
// ctx.needUpdate = false;
|
|
263
|
+
// let s = this.path.toString();
|
|
264
|
+
// ctx.pathname = s ? '/' + s : '';
|
|
265
|
+
// s = this.searchParams.toString();
|
|
266
|
+
// ctx.search = s ? '?' + s : '';
|
|
267
|
+
//
|
|
268
|
+
// let address = '';
|
|
269
|
+
// if (ctx.hostname) {
|
|
270
|
+
// address += (ctx.protocol || 'http:') + '//' +
|
|
271
|
+
// (ctx.username || ctx.password
|
|
272
|
+
// ? (
|
|
273
|
+
// (ctx.username ? encodeURIComponent(ctx.username) : '') +
|
|
274
|
+
// (ctx.password ? ':' + encodeURIComponent(ctx.password) : '') + '@'
|
|
275
|
+
// )
|
|
276
|
+
// : '') + this.host;
|
|
277
|
+
// }
|
|
278
|
+
// ctx.address = address + ctx.prefix + ctx.pathname;
|
|
279
|
+
// }
|
|
307
280
|
_setPathname(v, trimPrefix) {
|
|
308
281
|
this.path.clear();
|
|
309
282
|
if (!v)
|
|
@@ -322,16 +295,12 @@ class OpraURL {
|
|
|
322
295
|
}
|
|
323
296
|
}
|
|
324
297
|
for (const x of pathTokenizer) {
|
|
325
|
-
const p = (0,
|
|
298
|
+
const p = (0, decode_path_component_js_1.decodePathComponent)(x);
|
|
326
299
|
this.path.join(p);
|
|
327
300
|
}
|
|
328
|
-
this._changed();
|
|
329
|
-
}
|
|
330
|
-
_changed() {
|
|
331
|
-
this[kContext].needUpdate = true;
|
|
332
301
|
}
|
|
333
302
|
}
|
|
334
303
|
exports.OpraURL = OpraURL;
|
|
335
304
|
OpraURL.kContext = kContext;
|
|
336
305
|
OpraURL.kPath = kPath;
|
|
337
|
-
OpraURL.
|
|
306
|
+
OpraURL.kParams = kParams;
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.decodePathComponent = void 0;
|
|
5
4
|
const fast_tokenizer_1 = require("fast-tokenizer");
|
|
6
|
-
const putil_isplainobject_1 = tslib_1.__importDefault(require("putil-isplainobject"));
|
|
7
|
-
function normalizePath(p, noLeadingSlash) {
|
|
8
|
-
if (!p)
|
|
9
|
-
return '';
|
|
10
|
-
while (noLeadingSlash && p.startsWith('/'))
|
|
11
|
-
p = p.substring(1);
|
|
12
|
-
while (p.endsWith('/'))
|
|
13
|
-
p = p.substring(0, p.length - 1);
|
|
14
|
-
return p;
|
|
15
|
-
}
|
|
16
|
-
exports.normalizePath = normalizePath;
|
|
17
|
-
function joinPath(...p) {
|
|
18
|
-
const out = [];
|
|
19
|
-
let s;
|
|
20
|
-
for (let i = 0, l = p.length; i < l; i++) {
|
|
21
|
-
s = normalizePath(p[i], i > 0);
|
|
22
|
-
if (s)
|
|
23
|
-
out.push(s);
|
|
24
|
-
}
|
|
25
|
-
return out.join('/');
|
|
26
|
-
}
|
|
27
|
-
exports.joinPath = joinPath;
|
|
28
5
|
const pathComponentRegEx = /^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;
|
|
29
6
|
function decodePathComponent(input) {
|
|
30
7
|
const m = pathComponentRegEx.exec(input);
|
|
@@ -62,25 +39,3 @@ function decodePathComponent(input) {
|
|
|
62
39
|
return { resource, key };
|
|
63
40
|
}
|
|
64
41
|
exports.decodePathComponent = decodePathComponent;
|
|
65
|
-
function encodePathComponent(resource, key, typeCast) {
|
|
66
|
-
if (resource == null)
|
|
67
|
-
return '';
|
|
68
|
-
let keyString = '';
|
|
69
|
-
if (key !== '' && key != null) {
|
|
70
|
-
if ((0, putil_isplainobject_1.default)(key)) {
|
|
71
|
-
const arr = [];
|
|
72
|
-
for (const k of Object.keys(key)) {
|
|
73
|
-
arr.push(encodeURIComponent(k) + '=' + encodeURIComponent(key[k]));
|
|
74
|
-
}
|
|
75
|
-
keyString = arr.join(';');
|
|
76
|
-
}
|
|
77
|
-
else
|
|
78
|
-
keyString = encodeURIComponent('' + key);
|
|
79
|
-
}
|
|
80
|
-
if (typeCast)
|
|
81
|
-
typeCast = encodeURIComponent(typeCast);
|
|
82
|
-
return encodeURIComponent(resource).replace(/%24/, '$') +
|
|
83
|
-
(keyString ? '@' + keyString : '') +
|
|
84
|
-
(typeCast ? '::' + typeCast : '');
|
|
85
|
-
}
|
|
86
|
-
exports.encodePathComponent = encodePathComponent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodePathComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const putil_isplainobject_1 = tslib_1.__importDefault(require("putil-isplainobject"));
|
|
6
|
+
function encodePathComponent(resource, key, typeCast) {
|
|
7
|
+
if (resource == null)
|
|
8
|
+
return '';
|
|
9
|
+
let keyString = '';
|
|
10
|
+
if (key !== '' && key != null) {
|
|
11
|
+
if ((0, putil_isplainobject_1.default)(key)) {
|
|
12
|
+
const arr = [];
|
|
13
|
+
for (const k of Object.keys(key)) {
|
|
14
|
+
arr.push(encodeURIComponent(k) + '=' + encodeURIComponent(key[k]));
|
|
15
|
+
}
|
|
16
|
+
keyString = arr.join(';');
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
keyString = encodeURIComponent('' + key);
|
|
20
|
+
}
|
|
21
|
+
if (typeCast)
|
|
22
|
+
typeCast = encodeURIComponent(typeCast);
|
|
23
|
+
return encodeURIComponent(resource).replace(/%24/, '$') +
|
|
24
|
+
(keyString ? '@' + keyString : '') +
|
|
25
|
+
(typeCast ? '::' + typeCast : '');
|
|
26
|
+
}
|
|
27
|
+
exports.encodePathComponent = encodePathComponent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.joinPath = exports.normalizePath = void 0;
|
|
4
|
+
function normalizePath(p, noLeadingSlash) {
|
|
5
|
+
if (!p)
|
|
6
|
+
return '';
|
|
7
|
+
while (noLeadingSlash && p.startsWith('/'))
|
|
8
|
+
p = p.substring(1);
|
|
9
|
+
while (p.endsWith('/'))
|
|
10
|
+
p = p.substring(0, p.length - 1);
|
|
11
|
+
return p;
|
|
12
|
+
}
|
|
13
|
+
exports.normalizePath = normalizePath;
|
|
14
|
+
function joinPath(...p) {
|
|
15
|
+
const out = [];
|
|
16
|
+
let s;
|
|
17
|
+
for (let i = 0, l = p.length; i < l; i++) {
|
|
18
|
+
s = normalizePath(p[i], i > 0);
|
|
19
|
+
if (s)
|
|
20
|
+
out.push(s);
|
|
21
|
+
}
|
|
22
|
+
return out.join('/');
|
|
23
|
+
}
|
|
24
|
+
exports.joinPath = joinPath;
|