@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
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DATATYPE_METADATA, MAPPED_TYPE_METADATA } from '../constants.js';
|
|
2
|
-
import { applyMixins, inheritPropertyInitializers } from './mixin.utils.js';
|
|
3
|
-
const optionalsSymbol = Symbol.for('opra.optional-lib.sqb-connect');
|
|
4
|
-
export function MixinType(c1, c2, c3, c4) {
|
|
5
|
-
const clasRefs = [...arguments].filter(x => !!x);
|
|
6
|
-
if (!clasRefs.length)
|
|
7
|
-
throw new TypeError('You must provide base classeses');
|
|
8
|
-
if (clasRefs.length === 1)
|
|
9
|
-
return clasRefs[0];
|
|
10
|
-
class MappedClass {
|
|
11
|
-
constructor() {
|
|
12
|
-
for (const c of clasRefs)
|
|
13
|
-
inheritPropertyInitializers(this, c);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const mappedTypeMetadata = [];
|
|
17
|
-
for (const c of clasRefs) {
|
|
18
|
-
const m = Reflect.getOwnMetadata(DATATYPE_METADATA, c);
|
|
19
|
-
if (m) {
|
|
20
|
-
if (!(m.kind === 'ComplexType'))
|
|
21
|
-
throw new TypeError(`Class "${c}" is not a ComplexType`);
|
|
22
|
-
mappedTypeMetadata.push({
|
|
23
|
-
type: c
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
else if (Reflect.hasMetadata(MAPPED_TYPE_METADATA, c)) {
|
|
27
|
-
const mtm = Reflect.getMetadata(MAPPED_TYPE_METADATA, c);
|
|
28
|
-
if (mtm)
|
|
29
|
-
mappedTypeMetadata.push(...mtm);
|
|
30
|
-
}
|
|
31
|
-
else
|
|
32
|
-
throw new TypeError(`Class "${c}" doesn't have datatype metadata information`);
|
|
33
|
-
applyMixins(MappedClass, c);
|
|
34
|
-
}
|
|
35
|
-
const SqbConnect = globalThis[optionalsSymbol]?.SqbConnect;
|
|
36
|
-
if (SqbConnect) {
|
|
37
|
-
const { Entity } = SqbConnect;
|
|
38
|
-
Entity.mixin(MappedClass, ...clasRefs);
|
|
39
|
-
}
|
|
40
|
-
Reflect.defineMetadata(MAPPED_TYPE_METADATA, mappedTypeMetadata, MappedClass);
|
|
41
|
-
return MappedClass;
|
|
42
|
-
}
|
package/esm/schema/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import isPlainObject from 'putil-isplainobject';
|
|
2
|
-
import merge from 'putil-merge';
|
|
3
|
-
export function cloneObject(obj, jsonOnly) {
|
|
4
|
-
return merge({}, obj, {
|
|
5
|
-
deep: true,
|
|
6
|
-
clone: true,
|
|
7
|
-
filter: (source, key) => {
|
|
8
|
-
const v = source[key];
|
|
9
|
-
return v != null &&
|
|
10
|
-
!jsonOnly || (typeof v !== 'function' &&
|
|
11
|
-
(typeof v !== 'object' || isPlainObject(v) || Array.isArray(v)));
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ComplexType } from '../implementation/data-type/complex-type.js';
|
|
2
|
-
import type { OpraDocument } from '../implementation/opra-document.js';
|
|
3
|
-
export declare function normalizeFieldArray(document: OpraDocument, dataType: ComplexType | undefined, fields: string[], parentPath?: string): string[];
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComplexType } from '../implementation/data-type/complex-type.js';
|
|
2
|
-
import { pathToTree } from './path-to-tree.util.js';
|
|
3
|
-
export function normalizeFieldArray(document, dataType, fields, parentPath = '') {
|
|
4
|
-
const fieldsTree = pathToTree(fields) || {};
|
|
5
|
-
return _normalizeFieldsList([], document, dataType, fieldsTree, '', parentPath, {
|
|
6
|
-
additionalFields: true
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function _normalizeFieldsList(target, document, dataType, node, parentPath = '', actualPath = '', options) {
|
|
10
|
-
let curPath = '';
|
|
11
|
-
for (const k of Object.keys(node)) {
|
|
12
|
-
const nodeVal = node[k];
|
|
13
|
-
const prop = dataType?.fields.get(k);
|
|
14
|
-
if (!prop) {
|
|
15
|
-
curPath = parentPath ? parentPath + '.' + k : k;
|
|
16
|
-
if (!options?.additionalFields || (dataType && !dataType.additionalFields))
|
|
17
|
-
throw new TypeError(`Unknown field "${curPath}"`);
|
|
18
|
-
if (typeof nodeVal === 'object')
|
|
19
|
-
_normalizeFieldsList(target, document, undefined, nodeVal, curPath, actualPath, options);
|
|
20
|
-
else
|
|
21
|
-
target.push(curPath);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
curPath = parentPath ? parentPath + '.' + prop.name : prop.name;
|
|
25
|
-
const propType = document.getDataType(prop.type || 'string');
|
|
26
|
-
if (typeof nodeVal === 'object') {
|
|
27
|
-
if (!(propType && propType instanceof ComplexType))
|
|
28
|
-
throw new TypeError(`"${(actualPath ? actualPath + '.' + curPath : curPath)}" is not a complex type and has no sub fields`);
|
|
29
|
-
if (target.findIndex(x => x === parentPath) >= 0)
|
|
30
|
-
continue;
|
|
31
|
-
target = _normalizeFieldsList(target, document, propType, nodeVal, curPath, actualPath, options);
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (target.findIndex(x => x.startsWith(curPath + '.')) >= 0) {
|
|
35
|
-
target = target.filter(x => !x.startsWith(curPath + '.'));
|
|
36
|
-
}
|
|
37
|
-
target.push(curPath);
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const dotPattern = /^([^.]+)\.(.*)$/;
|
|
2
|
-
export function pathToTree(arr) {
|
|
3
|
-
if (!arr.length)
|
|
4
|
-
return;
|
|
5
|
-
return _stringPathToObjectTree(arr, {});
|
|
6
|
-
}
|
|
7
|
-
function _stringPathToObjectTree(arr, target) {
|
|
8
|
-
for (const k of arr) {
|
|
9
|
-
const m = dotPattern.exec(k);
|
|
10
|
-
if (m) {
|
|
11
|
-
const key = m[1];
|
|
12
|
-
if (target[key] === true)
|
|
13
|
-
continue;
|
|
14
|
-
const sub = target[key] = typeof target[key] === 'object' ? target[key] : {};
|
|
15
|
-
_stringPathToObjectTree([m[2]], sub);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
target[k] = true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
const trueValues = ['true', 't', 'yes', 'y', '1'];
|
|
3
|
-
const falseValues = ['false', 'f', 'no', 'n', '0'];
|
|
4
|
-
export class BooleanFormat extends Format {
|
|
5
|
-
parse(value) {
|
|
6
|
-
if (value === '')
|
|
7
|
-
return true;
|
|
8
|
-
// noinspection SuspiciousTypeOfGuard
|
|
9
|
-
if (typeof value === 'boolean')
|
|
10
|
-
return value;
|
|
11
|
-
if (trueValues.includes(value.toLowerCase()))
|
|
12
|
-
return true;
|
|
13
|
-
if (falseValues.includes(value.toLowerCase()))
|
|
14
|
-
return false;
|
|
15
|
-
throw new TypeError(`"${value}" is not a valid boolean`);
|
|
16
|
-
}
|
|
17
|
-
stringify(value) {
|
|
18
|
-
return typeof value === 'boolean' ?
|
|
19
|
-
(value ? 'true' : 'false') : '';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
export interface DateFormatOptions {
|
|
3
|
-
time?: boolean;
|
|
4
|
-
timeZone?: boolean;
|
|
5
|
-
min?: string;
|
|
6
|
-
max?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class DateFormat extends Format {
|
|
9
|
-
time: boolean;
|
|
10
|
-
timeZone: boolean;
|
|
11
|
-
min?: string;
|
|
12
|
-
max?: string;
|
|
13
|
-
constructor(options?: DateFormatOptions);
|
|
14
|
-
parse(value: string): string;
|
|
15
|
-
stringify(value: any): string;
|
|
16
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
import { Format } from './format.js';
|
|
3
|
-
// noinspection RegExpUnnecessaryNonCapturingGroup
|
|
4
|
-
const DATE_FORMAT_PATTERN = /^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;
|
|
5
|
-
export class DateFormat extends Format {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
super();
|
|
8
|
-
this.max = options?.max ? coerceToDateString(options.max) : undefined;
|
|
9
|
-
this.min = options?.min ? coerceToDateString(options.min) : undefined;
|
|
10
|
-
this.time = options?.time ?? true;
|
|
11
|
-
this.timeZone = options?.timeZone ?? true;
|
|
12
|
-
}
|
|
13
|
-
parse(value) {
|
|
14
|
-
const v = coerceToDateString(value, this.time, this.timeZone);
|
|
15
|
-
if (this.min != null && v < this.min)
|
|
16
|
-
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
17
|
-
if (this.max != null && v > this.max)
|
|
18
|
-
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
19
|
-
return v;
|
|
20
|
-
}
|
|
21
|
-
stringify(value) {
|
|
22
|
-
return coerceToDateString(value, this.time, this.timeZone);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function coerceToDateString(value, time, timeZone) {
|
|
26
|
-
if (value === '' || value == null)
|
|
27
|
-
return '';
|
|
28
|
-
const m = value.match(DATE_FORMAT_PATTERN);
|
|
29
|
-
if (!m)
|
|
30
|
-
throw new TypeError(`"${value}" is not a valid date.`);
|
|
31
|
-
let v = m[1] + '-' + (m[2] || '01') + '-' + (m[3] || '01');
|
|
32
|
-
if (time) {
|
|
33
|
-
v += 'T' + (m[4] || '00') + ':' + (m[5] || '00') + ':' + (m[6] || '00') +
|
|
34
|
-
(m[7] ? '.' + m[7] : '');
|
|
35
|
-
if (timeZone)
|
|
36
|
-
v += m[8] ? 'Z' :
|
|
37
|
-
(m[9] ? (m[9] + (m[10] || '00') + ':' + (m[11] || '00')) : '');
|
|
38
|
-
}
|
|
39
|
-
return v;
|
|
40
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Expression } from '../../filter/ast/index.js';
|
|
2
|
-
import { parseFilter } from '../../filter/parse.js';
|
|
3
|
-
import { Format } from './format.js';
|
|
4
|
-
export class FilterFormat extends Format {
|
|
5
|
-
parse(value) {
|
|
6
|
-
if (value instanceof Expression)
|
|
7
|
-
return value;
|
|
8
|
-
return parseFilter(value);
|
|
9
|
-
}
|
|
10
|
-
stringify(value) {
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
return value ? '' + value : '';
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NumberFormat, NumberFormatOptions } from './number-format.js';
|
|
2
|
-
export interface IntegerFormatOptions extends NumberFormatOptions {
|
|
3
|
-
enum?: number[];
|
|
4
|
-
}
|
|
5
|
-
export declare class IntegerFormat extends NumberFormat {
|
|
6
|
-
enum?: number[];
|
|
7
|
-
constructor(options?: IntegerFormatOptions);
|
|
8
|
-
parse(value: string): number;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NumberFormat } from './number-format.js';
|
|
2
|
-
export class IntegerFormat extends NumberFormat {
|
|
3
|
-
constructor(options) {
|
|
4
|
-
super(options);
|
|
5
|
-
this.enum = options?.enum;
|
|
6
|
-
}
|
|
7
|
-
parse(value) {
|
|
8
|
-
const v = super.parse(value);
|
|
9
|
-
if (!Number.isInteger(v))
|
|
10
|
-
throw new TypeError(`"${value}" is not a valid integer`);
|
|
11
|
-
if (this.enum && !this.enum.includes(v))
|
|
12
|
-
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
13
|
-
return v;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
export interface NumberFormatOptions {
|
|
3
|
-
max?: number;
|
|
4
|
-
min?: number;
|
|
5
|
-
}
|
|
6
|
-
export declare class NumberFormat extends Format {
|
|
7
|
-
max?: number;
|
|
8
|
-
min?: number;
|
|
9
|
-
constructor(options?: NumberFormatOptions);
|
|
10
|
-
parse(value: string): number;
|
|
11
|
-
stringify(value: any): string;
|
|
12
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
export class NumberFormat extends Format {
|
|
3
|
-
constructor(options) {
|
|
4
|
-
super();
|
|
5
|
-
this.max = options?.max;
|
|
6
|
-
this.min = options?.min;
|
|
7
|
-
}
|
|
8
|
-
parse(value) {
|
|
9
|
-
// noinspection SuspiciousTypeOfGuard
|
|
10
|
-
const v = typeof value === 'number' ? value : parseFloat(value);
|
|
11
|
-
if (isNaN(v))
|
|
12
|
-
throw new TypeError(`"${value}" is not a valid number`);
|
|
13
|
-
if (this.min != null && v < this.min)
|
|
14
|
-
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
15
|
-
if (this.max != null && v > this.max)
|
|
16
|
-
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
17
|
-
return v;
|
|
18
|
-
}
|
|
19
|
-
stringify(value) {
|
|
20
|
-
return typeof value === 'number' ? '' + value : '';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
export interface StringFormatOptions {
|
|
3
|
-
maxLength?: number;
|
|
4
|
-
minLength?: number;
|
|
5
|
-
enum?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare class StringFormat extends Format {
|
|
8
|
-
maxLength?: number;
|
|
9
|
-
minLength?: number;
|
|
10
|
-
enum?: string[];
|
|
11
|
-
constructor(options?: StringFormatOptions);
|
|
12
|
-
parse(value: string): string;
|
|
13
|
-
stringify(value: any): string;
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Format } from './format.js';
|
|
2
|
-
export class StringFormat extends Format {
|
|
3
|
-
constructor(options) {
|
|
4
|
-
super();
|
|
5
|
-
this.maxLength = options?.maxLength;
|
|
6
|
-
this.minLength = options?.minLength;
|
|
7
|
-
this.enum = options?.enum;
|
|
8
|
-
}
|
|
9
|
-
parse(value) {
|
|
10
|
-
if (this.minLength != null && value.length < this.minLength)
|
|
11
|
-
throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength > 1 ? 's' : ''} long.`);
|
|
12
|
-
if (this.maxLength != null && value.length > this.maxLength)
|
|
13
|
-
throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength > 1 ? 's' : ''} long.`);
|
|
14
|
-
if (this.enum && !this.enum.includes(value))
|
|
15
|
-
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
18
|
-
stringify(value) {
|
|
19
|
-
return value == null ? '' : '' + value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { HttpParams } from '../http/http-params.js';
|
|
2
|
-
import { IntegerCodec } from '../http/param-codec/integer-codec.js';
|
|
3
|
-
export class OpraURLSearchParams extends HttpParams {
|
|
4
|
-
constructor(init, options) {
|
|
5
|
-
super(init, {
|
|
6
|
-
...options,
|
|
7
|
-
params: {
|
|
8
|
-
'$filter': { codec: 'filter' },
|
|
9
|
-
'$limit': { codec: new IntegerCodec({ min: 0 }) },
|
|
10
|
-
'$skip': { codec: new IntegerCodec({ min: 0 }) },
|
|
11
|
-
'$pick': { codec: 'string', array: 'strict' },
|
|
12
|
-
'$omit': { codec: 'string', array: 'strict' },
|
|
13
|
-
'$include': { codec: 'string', array: 'strict' },
|
|
14
|
-
'$sort': { codec: 'string', array: 'strict' },
|
|
15
|
-
'$distinct': { codec: 'boolean' },
|
|
16
|
-
'$count': { codec: 'boolean' },
|
|
17
|
-
...options?.params
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
get [Symbol.toStringTag]() {
|
|
22
|
-
return 'URLSearchParams';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function normalizePath(p?: string, noLeadingSlash?: boolean): string;
|
|
2
|
-
export declare function joinPath(...p: string[]): string;
|
|
3
|
-
export declare function decodePathComponent(input: string): {
|
|
4
|
-
resource: string;
|
|
5
|
-
key?: any;
|
|
6
|
-
typeCast?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function encodePathComponent(resource: string, key?: any, typeCast?: string): string;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { splitString } from 'fast-tokenizer';
|
|
2
|
-
import isPlainObject from 'putil-isplainobject';
|
|
3
|
-
export function normalizePath(p, noLeadingSlash) {
|
|
4
|
-
if (!p)
|
|
5
|
-
return '';
|
|
6
|
-
while (noLeadingSlash && p.startsWith('/'))
|
|
7
|
-
p = p.substring(1);
|
|
8
|
-
while (p.endsWith('/'))
|
|
9
|
-
p = p.substring(0, p.length - 1);
|
|
10
|
-
return p;
|
|
11
|
-
}
|
|
12
|
-
export function joinPath(...p) {
|
|
13
|
-
const out = [];
|
|
14
|
-
let s;
|
|
15
|
-
for (let i = 0, l = p.length; i < l; i++) {
|
|
16
|
-
s = normalizePath(p[i], i > 0);
|
|
17
|
-
if (s)
|
|
18
|
-
out.push(s);
|
|
19
|
-
}
|
|
20
|
-
return out.join('/');
|
|
21
|
-
}
|
|
22
|
-
const pathComponentRegEx = /^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;
|
|
23
|
-
export function decodePathComponent(input) {
|
|
24
|
-
const m = pathComponentRegEx.exec(input);
|
|
25
|
-
if (!m)
|
|
26
|
-
throw Object.assign(new TypeError('Invalid URL path'), {
|
|
27
|
-
code: 'ERR_INVALID_URL_PATH',
|
|
28
|
-
input,
|
|
29
|
-
});
|
|
30
|
-
const resource = decodeURIComponent(m[1]);
|
|
31
|
-
let key;
|
|
32
|
-
if (m[2]) {
|
|
33
|
-
const s = decodeURIComponent(m[2] || '');
|
|
34
|
-
const b = splitString(s, { delimiters: ';', quotes: true, escape: false });
|
|
35
|
-
for (const k of b) {
|
|
36
|
-
const c = splitString(k, { delimiters: '=', quotes: true, escape: false });
|
|
37
|
-
if ((b.length > 1 && c.length < 2) ||
|
|
38
|
-
(key &&
|
|
39
|
-
(c.length >= 2 && typeof key !== 'object') ||
|
|
40
|
-
(c.length < 2 && typeof key === 'object')))
|
|
41
|
-
throw Object.assign(new TypeError('Invalid URL path. name:value pair required for multiple key format'), {
|
|
42
|
-
pathComponent: input,
|
|
43
|
-
code: 'ERR_INVALID_URL_PATH'
|
|
44
|
-
});
|
|
45
|
-
if (c.length >= 2) {
|
|
46
|
-
key = key || {};
|
|
47
|
-
key[c.shift() || ''] = c.join('=');
|
|
48
|
-
}
|
|
49
|
-
else
|
|
50
|
-
key = c[0];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (m[3]) {
|
|
54
|
-
return { resource, key, typeCast: m[3] };
|
|
55
|
-
}
|
|
56
|
-
return { resource, key };
|
|
57
|
-
}
|
|
58
|
-
export function encodePathComponent(resource, key, typeCast) {
|
|
59
|
-
if (resource == null)
|
|
60
|
-
return '';
|
|
61
|
-
let keyString = '';
|
|
62
|
-
if (key !== '' && key != null) {
|
|
63
|
-
if (isPlainObject(key)) {
|
|
64
|
-
const arr = [];
|
|
65
|
-
for (const k of Object.keys(key)) {
|
|
66
|
-
arr.push(encodeURIComponent(k) + '=' + encodeURIComponent(key[k]));
|
|
67
|
-
}
|
|
68
|
-
keyString = arr.join(';');
|
|
69
|
-
}
|
|
70
|
-
else
|
|
71
|
-
keyString = encodeURIComponent('' + key);
|
|
72
|
-
}
|
|
73
|
-
if (typeCast)
|
|
74
|
-
typeCast = encodeURIComponent(typeCast);
|
|
75
|
-
return encodeURIComponent(resource).replace(/%24/, '$') +
|
|
76
|
-
(keyString ? '@' + keyString : '') +
|
|
77
|
-
(typeCast ? '::' + typeCast : '');
|
|
78
|
-
}
|
package/esm/utils/index.d.ts
DELETED
package/esm/utils/index.js
DELETED
package/esm/utils/is-url.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isUrl(url: any): boolean;
|
package/esm/utils/is-url.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const dotPattern = /^([^.]+)\.(.*)$/;
|
|
2
|
-
export function pathToTree(arr, lowerCaseKeys) {
|
|
3
|
-
if (!arr.length)
|
|
4
|
-
return;
|
|
5
|
-
return _pathToTree(arr, {}, lowerCaseKeys);
|
|
6
|
-
}
|
|
7
|
-
function _pathToTree(arr, target, lowerCaseKeys) {
|
|
8
|
-
for (let k of arr) {
|
|
9
|
-
if (lowerCaseKeys)
|
|
10
|
-
k = k.toLowerCase();
|
|
11
|
-
const m = dotPattern.exec(k);
|
|
12
|
-
if (m) {
|
|
13
|
-
const key = m[1];
|
|
14
|
-
if (target[key] === true)
|
|
15
|
-
continue;
|
|
16
|
-
const sub = target[key] = typeof target[key] === 'object' ? target[key] : {};
|
|
17
|
-
_pathToTree([m[2]], sub);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
target[k] = true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return target;
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/cjs/schema/{interfaces/resource-container.interface.js → data-type/field.interface.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|