@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,14 +0,0 @@
|
|
|
1
|
-
import { Expression } from '../../../filter/index.js';
|
|
2
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
export type CollectionCountQueryOptions = {
|
|
4
|
-
filter?: string | Expression;
|
|
5
|
-
};
|
|
6
|
-
export declare class CollectionCountQuery {
|
|
7
|
-
readonly resource: CollectionResourceInfo;
|
|
8
|
-
readonly kind = "CollectionCountQuery";
|
|
9
|
-
readonly method = "count";
|
|
10
|
-
readonly operation = "read";
|
|
11
|
-
filter?: Expression;
|
|
12
|
-
constructor(resource: CollectionResourceInfo, options?: CollectionCountQueryOptions);
|
|
13
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { parseFilter } from '../../../filter/index.js';
|
|
2
|
-
export class CollectionCountQuery {
|
|
3
|
-
constructor(resource, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.kind = 'CollectionCountQuery';
|
|
6
|
-
this.method = 'count';
|
|
7
|
-
this.operation = 'read';
|
|
8
|
-
this.filter = typeof options?.filter === 'string' ? parseFilter(options.filter) : options?.filter;
|
|
9
|
-
}
|
|
10
|
-
get dataType() {
|
|
11
|
-
return this.resource.dataType;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
2
|
-
export type CollectionCreateQueryOptions = {
|
|
3
|
-
pick?: string[];
|
|
4
|
-
omit?: string[];
|
|
5
|
-
include?: string[];
|
|
6
|
-
};
|
|
7
|
-
export declare class CollectionCreateQuery {
|
|
8
|
-
readonly resource: CollectionResourceInfo;
|
|
9
|
-
data: {};
|
|
10
|
-
readonly kind = "CollectionCreateQuery";
|
|
11
|
-
readonly method = "create";
|
|
12
|
-
readonly operation = "create";
|
|
13
|
-
pick?: string[];
|
|
14
|
-
omit?: string[];
|
|
15
|
-
include?: string[];
|
|
16
|
-
constructor(resource: CollectionResourceInfo, data: {}, options?: CollectionCreateQueryOptions);
|
|
17
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
2
|
-
export class CollectionCreateQuery {
|
|
3
|
-
constructor(resource, data, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.data = data;
|
|
6
|
-
this.kind = 'CollectionCreateQuery';
|
|
7
|
-
this.method = 'create';
|
|
8
|
-
this.operation = 'create';
|
|
9
|
-
if (options?.pick)
|
|
10
|
-
this.pick = normalizeFieldArray(resource.document, resource.dataType, options.pick);
|
|
11
|
-
if (options?.omit)
|
|
12
|
-
this.omit = normalizeFieldArray(resource.document, resource.dataType, options.omit);
|
|
13
|
-
if (options?.include)
|
|
14
|
-
this.include = normalizeFieldArray(resource.document, resource.dataType, options.include);
|
|
15
|
-
}
|
|
16
|
-
get dataType() {
|
|
17
|
-
return this.resource.dataType;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Expression } from '../../../filter/index.js';
|
|
2
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
export type CollectionDeleteManyQueryOptions = {
|
|
4
|
-
filter?: string | Expression;
|
|
5
|
-
};
|
|
6
|
-
export declare class CollectionDeleteManyQuery {
|
|
7
|
-
readonly resource: CollectionResourceInfo;
|
|
8
|
-
readonly kind = "CollectionDeleteManyQuery";
|
|
9
|
-
readonly method = "deleteMany";
|
|
10
|
-
readonly operation = "delete";
|
|
11
|
-
filter?: Expression;
|
|
12
|
-
constructor(resource: CollectionResourceInfo, options?: CollectionDeleteManyQueryOptions);
|
|
13
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { parseFilter } from '../../../filter/index.js';
|
|
2
|
-
export class CollectionDeleteManyQuery {
|
|
3
|
-
constructor(resource, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.kind = 'CollectionDeleteManyQuery';
|
|
6
|
-
this.method = 'deleteMany';
|
|
7
|
-
this.operation = 'delete';
|
|
8
|
-
this.filter = typeof options?.filter === 'string' ? parseFilter(options.filter) : options?.filter;
|
|
9
|
-
}
|
|
10
|
-
get dataType() {
|
|
11
|
-
return this.resource.dataType;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
2
|
-
export declare class CollectionDeleteQuery {
|
|
3
|
-
readonly resource: CollectionResourceInfo;
|
|
4
|
-
readonly kind = "CollectionDeleteQuery";
|
|
5
|
-
readonly method = "delete";
|
|
6
|
-
readonly operation = "delete";
|
|
7
|
-
keyValue: any;
|
|
8
|
-
constructor(resource: CollectionResourceInfo, keyValue: any);
|
|
9
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
10
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class CollectionDeleteQuery {
|
|
2
|
-
constructor(resource, keyValue) {
|
|
3
|
-
this.resource = resource;
|
|
4
|
-
this.kind = 'CollectionDeleteQuery';
|
|
5
|
-
this.method = 'delete';
|
|
6
|
-
this.operation = 'delete';
|
|
7
|
-
if (resource.keyFields.length > 1) {
|
|
8
|
-
if (typeof keyValue !== 'object')
|
|
9
|
-
throw new Error(`You must provide an key/value object for all key fields (${resource.keyFields})`);
|
|
10
|
-
resource.keyFields.reduce((o, k) => {
|
|
11
|
-
o[k] = keyValue[k];
|
|
12
|
-
return o;
|
|
13
|
-
}, {});
|
|
14
|
-
}
|
|
15
|
-
else
|
|
16
|
-
this.keyValue = resource.dataType.getFieldType(resource.keyFields[0]).parse(keyValue);
|
|
17
|
-
}
|
|
18
|
-
get dataType() {
|
|
19
|
-
return this.resource.dataType;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
|
|
2
|
-
import type { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
import type { FieldGetQuery } from './field-get-query.js';
|
|
4
|
-
export type CollectionGetQueryOptions = {
|
|
5
|
-
pick?: string[];
|
|
6
|
-
omit?: string[];
|
|
7
|
-
include?: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare class CollectionGetQuery implements IChildFieldQuery {
|
|
10
|
-
readonly resource: CollectionResourceInfo;
|
|
11
|
-
readonly kind = "CollectionGetQuery";
|
|
12
|
-
readonly method = "get";
|
|
13
|
-
readonly operation = "read";
|
|
14
|
-
keyValue: any;
|
|
15
|
-
pick?: string[];
|
|
16
|
-
omit?: string[];
|
|
17
|
-
include?: string[];
|
|
18
|
-
child?: FieldGetQuery;
|
|
19
|
-
constructor(resource: CollectionResourceInfo, keyValue: any, options?: CollectionGetQueryOptions);
|
|
20
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
21
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
2
|
-
export class CollectionGetQuery {
|
|
3
|
-
constructor(resource, keyValue, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.kind = 'CollectionGetQuery';
|
|
6
|
-
this.method = 'get';
|
|
7
|
-
this.operation = 'read';
|
|
8
|
-
if (resource.keyFields.length > 1) {
|
|
9
|
-
if (typeof keyValue !== 'object')
|
|
10
|
-
throw new Error(`You must provide an key/value object for all key fields (${resource.keyFields})`);
|
|
11
|
-
resource.keyFields.reduce((o, k) => {
|
|
12
|
-
o[k] = keyValue[k];
|
|
13
|
-
return o;
|
|
14
|
-
}, {});
|
|
15
|
-
}
|
|
16
|
-
else
|
|
17
|
-
this.keyValue = resource.dataType.getFieldType(resource.keyFields[0]).parse(keyValue);
|
|
18
|
-
if (options?.pick)
|
|
19
|
-
this.pick = normalizeFieldArray(resource.document, resource.dataType, options.pick);
|
|
20
|
-
if (options?.omit)
|
|
21
|
-
this.omit = normalizeFieldArray(resource.document, resource.dataType, options.omit);
|
|
22
|
-
if (options?.include)
|
|
23
|
-
this.include = normalizeFieldArray(resource.document, resource.dataType, options.include);
|
|
24
|
-
}
|
|
25
|
-
get dataType() {
|
|
26
|
-
return this.resource.dataType;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Expression } from '../../../filter/index.js';
|
|
2
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
export type CollectionSearchQueryOptions = {
|
|
4
|
-
pick?: string[];
|
|
5
|
-
omit?: string[];
|
|
6
|
-
include?: string[];
|
|
7
|
-
filter?: string | Expression;
|
|
8
|
-
limit?: number;
|
|
9
|
-
skip?: number;
|
|
10
|
-
distinct?: boolean;
|
|
11
|
-
count?: boolean;
|
|
12
|
-
sort?: string[];
|
|
13
|
-
};
|
|
14
|
-
export declare class CollectionSearchQuery {
|
|
15
|
-
readonly resource: CollectionResourceInfo;
|
|
16
|
-
readonly kind = "CollectionSearchQuery";
|
|
17
|
-
readonly method = "search";
|
|
18
|
-
readonly operation = "read";
|
|
19
|
-
pick?: string[];
|
|
20
|
-
omit?: string[];
|
|
21
|
-
include?: string[];
|
|
22
|
-
filter?: Expression;
|
|
23
|
-
limit?: number;
|
|
24
|
-
skip?: number;
|
|
25
|
-
distinct?: boolean;
|
|
26
|
-
count?: boolean;
|
|
27
|
-
sort?: string[];
|
|
28
|
-
constructor(resource: CollectionResourceInfo, options?: CollectionSearchQueryOptions);
|
|
29
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
30
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { BadRequestError } from '../../../exception/index.js';
|
|
2
|
-
import { parseFilter } from '../../../filter/index.js';
|
|
3
|
-
import { translate } from '../../../i18n/index.js';
|
|
4
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
5
|
-
export class CollectionSearchQuery {
|
|
6
|
-
constructor(resource, options) {
|
|
7
|
-
this.resource = resource;
|
|
8
|
-
this.kind = 'CollectionSearchQuery';
|
|
9
|
-
this.method = 'search';
|
|
10
|
-
this.operation = 'read';
|
|
11
|
-
if (options?.pick)
|
|
12
|
-
this.pick = normalizeFieldArray(resource.document, resource.dataType, options.pick);
|
|
13
|
-
if (options?.omit)
|
|
14
|
-
this.omit = normalizeFieldArray(resource.document, resource.dataType, options.omit);
|
|
15
|
-
if (options?.include)
|
|
16
|
-
this.include = normalizeFieldArray(resource.document, resource.dataType, options.include);
|
|
17
|
-
this.filter = typeof options?.filter === 'string' ? parseFilter(options.filter) : options?.filter;
|
|
18
|
-
this.limit = options?.limit;
|
|
19
|
-
this.skip = options?.skip;
|
|
20
|
-
this.distinct = options?.distinct;
|
|
21
|
-
this.count = options?.count;
|
|
22
|
-
if (options?.sort) {
|
|
23
|
-
this.sort = normalizeFieldArray(resource.document, resource.dataType, options.sort);
|
|
24
|
-
const search = resource.search;
|
|
25
|
-
if (search && typeof search === 'object') {
|
|
26
|
-
const sortFields = search.sortFields;
|
|
27
|
-
if (sortFields) {
|
|
28
|
-
this.sort.forEach(field => {
|
|
29
|
-
if (!sortFields.find(x => x === field))
|
|
30
|
-
throw new BadRequestError({
|
|
31
|
-
message: translate('error:UNACCEPTED_SORT_FIELD', { field }, `Field '${field}' is not available for sort operation`),
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
get dataType() {
|
|
39
|
-
return this.resource.dataType;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Expression } from '../../../filter/index.js';
|
|
2
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
export type CollectionUpdateManyQueryOptions = {
|
|
4
|
-
filter?: string | Expression;
|
|
5
|
-
};
|
|
6
|
-
export declare class CollectionUpdateManyQuery {
|
|
7
|
-
readonly resource: CollectionResourceInfo;
|
|
8
|
-
data: {};
|
|
9
|
-
readonly kind = "CollectionUpdateManyQuery";
|
|
10
|
-
readonly method = "updateMany";
|
|
11
|
-
readonly operation = "update";
|
|
12
|
-
filter?: Expression;
|
|
13
|
-
constructor(resource: CollectionResourceInfo, data: {}, options?: CollectionUpdateManyQueryOptions);
|
|
14
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { parseFilter } from '../../../filter/index.js';
|
|
2
|
-
export class CollectionUpdateManyQuery {
|
|
3
|
-
constructor(resource, data, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.data = data;
|
|
6
|
-
this.kind = 'CollectionUpdateManyQuery';
|
|
7
|
-
this.method = 'updateMany';
|
|
8
|
-
this.operation = 'update';
|
|
9
|
-
this.filter = typeof options?.filter === 'string' ? parseFilter(options.filter) : options?.filter;
|
|
10
|
-
}
|
|
11
|
-
get dataType() {
|
|
12
|
-
return this.resource.dataType;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
2
|
-
export type CollectionUpdateQueryOptions = {
|
|
3
|
-
pick?: string[];
|
|
4
|
-
omit?: string[];
|
|
5
|
-
include?: string[];
|
|
6
|
-
};
|
|
7
|
-
export declare class CollectionUpdateQuery {
|
|
8
|
-
readonly resource: CollectionResourceInfo;
|
|
9
|
-
data: any;
|
|
10
|
-
readonly kind = "CollectionUpdateQuery";
|
|
11
|
-
readonly method = "update";
|
|
12
|
-
readonly operation = "update";
|
|
13
|
-
keyValue: any;
|
|
14
|
-
pick?: string[];
|
|
15
|
-
omit?: string[];
|
|
16
|
-
include?: string[];
|
|
17
|
-
constructor(resource: CollectionResourceInfo, keyValue: any, data: any, options?: CollectionUpdateQueryOptions);
|
|
18
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
19
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
2
|
-
export class CollectionUpdateQuery {
|
|
3
|
-
constructor(resource, keyValue, data, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.data = data;
|
|
6
|
-
this.kind = 'CollectionUpdateQuery';
|
|
7
|
-
this.method = 'update';
|
|
8
|
-
this.operation = 'update';
|
|
9
|
-
if (resource.keyFields.length > 1) {
|
|
10
|
-
if (typeof keyValue !== 'object')
|
|
11
|
-
throw new Error(`You must provide an key/value object for all key fields (${resource.keyFields})`);
|
|
12
|
-
resource.keyFields.reduce((o, k) => {
|
|
13
|
-
o[k] = keyValue[k];
|
|
14
|
-
return o;
|
|
15
|
-
}, {});
|
|
16
|
-
}
|
|
17
|
-
else
|
|
18
|
-
this.keyValue = resource.dataType.getFieldType(resource.keyFields[0]).parse(keyValue);
|
|
19
|
-
if (options?.pick)
|
|
20
|
-
this.pick = normalizeFieldArray(resource.document, resource.dataType, options.pick);
|
|
21
|
-
if (options?.omit)
|
|
22
|
-
this.omit = normalizeFieldArray(resource.document, resource.dataType, options.omit);
|
|
23
|
-
if (options?.include)
|
|
24
|
-
this.include = normalizeFieldArray(resource.document, resource.dataType, options.include);
|
|
25
|
-
}
|
|
26
|
-
get dataType() {
|
|
27
|
-
return this.resource.dataType;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
|
|
2
|
-
import { ComplexType, Field } from '../data-type/complex-type.js';
|
|
3
|
-
import type { DataType } from '../data-type/data-type.js';
|
|
4
|
-
import type { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
5
|
-
import type { SingletonResourceInfo } from '../resource/singleton-resource-info.js';
|
|
6
|
-
import type { CollectionGetQuery } from './collection-get-query.js';
|
|
7
|
-
import type { SingletonGetQuery } from './singleton-get-query.js';
|
|
8
|
-
export type FieldGetQueryOptions = {
|
|
9
|
-
pick?: string[];
|
|
10
|
-
omit?: string[];
|
|
11
|
-
include?: string[];
|
|
12
|
-
castingType?: ComplexType;
|
|
13
|
-
};
|
|
14
|
-
export declare class FieldGetQuery implements IChildFieldQuery {
|
|
15
|
-
readonly parent: CollectionGetQuery | SingletonGetQuery | FieldGetQuery;
|
|
16
|
-
readonly resource: CollectionResourceInfo | SingletonResourceInfo;
|
|
17
|
-
readonly kind = "FieldGetQuery";
|
|
18
|
-
readonly method = "get";
|
|
19
|
-
readonly operation = "read";
|
|
20
|
-
readonly fieldName: string;
|
|
21
|
-
readonly field?: Field;
|
|
22
|
-
readonly path: string;
|
|
23
|
-
readonly dataType: DataType;
|
|
24
|
-
readonly parentType: ComplexType;
|
|
25
|
-
pick?: string[];
|
|
26
|
-
omit?: string[];
|
|
27
|
-
include?: string[];
|
|
28
|
-
child?: FieldGetQuery;
|
|
29
|
-
constructor(parent: CollectionGetQuery | SingletonGetQuery | FieldGetQuery, fieldName: string, options?: FieldGetQueryOptions);
|
|
30
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
2
|
-
import { ComplexType } from '../data-type/complex-type.js';
|
|
3
|
-
export class FieldGetQuery {
|
|
4
|
-
constructor(parent, fieldName, options) {
|
|
5
|
-
this.parent = parent;
|
|
6
|
-
this.kind = 'FieldGetQuery';
|
|
7
|
-
this.method = 'get';
|
|
8
|
-
this.operation = 'read';
|
|
9
|
-
this.resource = parent.resource;
|
|
10
|
-
const parentType = options?.castingType || parent.dataType;
|
|
11
|
-
if (!parentType || !(parentType instanceof ComplexType))
|
|
12
|
-
throw new TypeError(`Data type of parent query is not a ComplexType`);
|
|
13
|
-
this.parentType = parentType;
|
|
14
|
-
this.field = parentType.additionalFields
|
|
15
|
-
? parentType.fields.get(fieldName)
|
|
16
|
-
: parentType.getField(fieldName);
|
|
17
|
-
this.fieldName = this.field ? this.field.name : fieldName;
|
|
18
|
-
this.dataType = this.resource.document.getDataType(this.field ? (this.field.type || 'string') : 'object');
|
|
19
|
-
this.path = (parent instanceof FieldGetQuery
|
|
20
|
-
? parent.path + '.' : '') + this.fieldName;
|
|
21
|
-
if (this.dataType instanceof ComplexType) {
|
|
22
|
-
if (options?.pick)
|
|
23
|
-
this.pick = normalizeFieldArray(this.resource.document, this.dataType, options.pick, this.path);
|
|
24
|
-
if (options?.omit)
|
|
25
|
-
this.omit = normalizeFieldArray(this.resource.document, this.dataType, options.omit, this.path);
|
|
26
|
-
if (options?.include)
|
|
27
|
-
this.include = normalizeFieldArray(this.resource.document, this.dataType, options.include, this.path);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
|
|
2
|
-
import { CollectionCountQuery } from './collection-count-query.js';
|
|
3
|
-
import { CollectionCreateQuery } from './collection-create-query.js';
|
|
4
|
-
import { CollectionDeleteManyQuery } from './collection-delete-many-query.js';
|
|
5
|
-
import { CollectionDeleteQuery } from './collection-delete-query.js';
|
|
6
|
-
import { CollectionGetQuery } from './collection-get-query.js';
|
|
7
|
-
import { CollectionSearchQuery } from './collection-search-query.js';
|
|
8
|
-
import { CollectionUpdateManyQuery } from './collection-update-many-query.js';
|
|
9
|
-
import { CollectionUpdateQuery } from './collection-update-query.js';
|
|
10
|
-
import { FieldGetQuery } from './field-get-query.js';
|
|
11
|
-
import { SingletonGetQuery } from './singleton-get-query.js';
|
|
12
|
-
export * from './collection-create-query.js';
|
|
13
|
-
export * from './collection-count-query.js';
|
|
14
|
-
export * from './collection-delete-many-query.js';
|
|
15
|
-
export * from './collection-delete-query.js';
|
|
16
|
-
export * from './collection-delete-many-query.js';
|
|
17
|
-
export * from './collection-get-query.js';
|
|
18
|
-
export * from './field-get-query.js';
|
|
19
|
-
export * from './singleton-get-query.js';
|
|
20
|
-
export * from './collection-search-query.js';
|
|
21
|
-
export * from './collection-update-many-query.js';
|
|
22
|
-
export * from './collection-update-query.js';
|
|
23
|
-
export type CollectionQuery = CollectionCountQuery | CollectionCreateQuery | CollectionDeleteManyQuery | CollectionDeleteQuery | CollectionGetQuery | CollectionSearchQuery | CollectionUpdateManyQuery | CollectionUpdateQuery;
|
|
24
|
-
export type FieldQuery = FieldGetQuery;
|
|
25
|
-
export type SingletonQuery = SingletonGetQuery;
|
|
26
|
-
export type OpraQuery = CollectionQuery | SingletonQuery | FieldQuery;
|
|
27
|
-
export declare function isChildFieldQuery(query: any): query is IChildFieldQuery;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './collection-create-query.js';
|
|
2
|
-
export * from './collection-count-query.js';
|
|
3
|
-
export * from './collection-delete-many-query.js';
|
|
4
|
-
export * from './collection-delete-query.js';
|
|
5
|
-
export * from './collection-delete-many-query.js';
|
|
6
|
-
export * from './collection-get-query.js';
|
|
7
|
-
export * from './field-get-query.js';
|
|
8
|
-
export * from './singleton-get-query.js';
|
|
9
|
-
export * from './collection-search-query.js';
|
|
10
|
-
export * from './collection-update-many-query.js';
|
|
11
|
-
export * from './collection-update-query.js';
|
|
12
|
-
export function isChildFieldQuery(query) {
|
|
13
|
-
return query &&
|
|
14
|
-
(query.kind === 'SingletonGetQuery' ||
|
|
15
|
-
query.kind === 'CollectionGetQuery' ||
|
|
16
|
-
query.kind === 'FieldGetQuery');
|
|
17
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
|
|
2
|
-
import type { SingletonResourceInfo } from '../resource/singleton-resource-info.js';
|
|
3
|
-
import type { FieldGetQuery } from './field-get-query.js';
|
|
4
|
-
export type SingletonGetQueryOptions = {
|
|
5
|
-
pick?: string[];
|
|
6
|
-
omit?: string[];
|
|
7
|
-
include?: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare class SingletonGetQuery implements IChildFieldQuery {
|
|
10
|
-
readonly resource: SingletonResourceInfo;
|
|
11
|
-
readonly kind = "SingletonGetQuery";
|
|
12
|
-
readonly method = "get";
|
|
13
|
-
readonly operation = "read";
|
|
14
|
-
pick?: string[];
|
|
15
|
-
omit?: string[];
|
|
16
|
-
include?: string[];
|
|
17
|
-
child?: FieldGetQuery;
|
|
18
|
-
constructor(resource: SingletonResourceInfo, options?: SingletonGetQueryOptions);
|
|
19
|
-
get dataType(): import("../data-type/complex-type.js").ComplexType;
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
2
|
-
export class SingletonGetQuery {
|
|
3
|
-
constructor(resource, options) {
|
|
4
|
-
this.resource = resource;
|
|
5
|
-
this.kind = 'SingletonGetQuery';
|
|
6
|
-
this.method = 'get';
|
|
7
|
-
this.operation = 'read';
|
|
8
|
-
if (options?.pick)
|
|
9
|
-
this.pick = normalizeFieldArray(resource.document, resource.dataType, options.pick);
|
|
10
|
-
if (options?.omit)
|
|
11
|
-
this.omit = normalizeFieldArray(resource.document, resource.dataType, options.omit);
|
|
12
|
-
if (options?.include)
|
|
13
|
-
this.include = normalizeFieldArray(resource.document, resource.dataType, options.include);
|
|
14
|
-
}
|
|
15
|
-
get dataType() {
|
|
16
|
-
return this.resource.dataType;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { OpraSchema } from '../../opra-schema.definition.js';
|
|
2
|
-
import { ComplexType } from '../data-type/complex-type.js';
|
|
3
|
-
import type { OpraDocument } from '../opra-document';
|
|
4
|
-
import { ResourceInfo } from './resource-info.js';
|
|
5
|
-
export declare class CollectionResourceInfo extends ResourceInfo {
|
|
6
|
-
readonly metadata: OpraSchema.CollectionResource;
|
|
7
|
-
readonly dataType: ComplexType;
|
|
8
|
-
constructor(document: OpraDocument, name: string, dataType: ComplexType, metadata: OpraSchema.CollectionResource);
|
|
9
|
-
get instance(): {} | undefined;
|
|
10
|
-
get keyFields(): string[];
|
|
11
|
-
get create(): OpraSchema.CreateMethodResolver | undefined;
|
|
12
|
-
get count(): OpraSchema.MethodResolver | undefined;
|
|
13
|
-
get delete(): OpraSchema.MethodResolver | undefined;
|
|
14
|
-
get deleteMany(): OpraSchema.DeleteManyMethodResolver | undefined;
|
|
15
|
-
get get(): OpraSchema.GetMethodResolver | undefined;
|
|
16
|
-
get update(): OpraSchema.UpdateMethodResolver | undefined;
|
|
17
|
-
get updateMany(): OpraSchema.UpdateManyMethodResolver | undefined;
|
|
18
|
-
get search(): OpraSchema.SearchMethodResolver | undefined;
|
|
19
|
-
getHandlerNames(): string[];
|
|
20
|
-
getHandler(method: string): Function;
|
|
21
|
-
getSchema(jsonOnly?: boolean): OpraSchema.CollectionResource;
|
|
22
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { collectionMethods } from '../../constants.js';
|
|
2
|
-
import { normalizeFieldArray } from '../../utils/normalize-field-array.util.js';
|
|
3
|
-
import { ResourceInfo } from './resource-info.js';
|
|
4
|
-
export class CollectionResourceInfo extends ResourceInfo {
|
|
5
|
-
constructor(document, name, dataType, metadata) {
|
|
6
|
-
if (!metadata.keyFields)
|
|
7
|
-
throw new TypeError(`You should provide key fields for ${name}`);
|
|
8
|
-
super(document, name, metadata);
|
|
9
|
-
metadata.keyFields = Array.isArray(metadata.keyFields) ? metadata.keyFields : [metadata.keyFields];
|
|
10
|
-
metadata.keyFields.forEach(f => dataType.getField(f));
|
|
11
|
-
this.dataType = dataType;
|
|
12
|
-
if (metadata.search && metadata.search.sortFields) {
|
|
13
|
-
metadata.search.sortFields = normalizeFieldArray(document, dataType, metadata.search.sortFields);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
get instance() {
|
|
17
|
-
return this.metadata.instance;
|
|
18
|
-
}
|
|
19
|
-
get keyFields() {
|
|
20
|
-
return this.metadata.keyFields;
|
|
21
|
-
}
|
|
22
|
-
get create() {
|
|
23
|
-
return this.metadata.create;
|
|
24
|
-
}
|
|
25
|
-
get count() {
|
|
26
|
-
return this.metadata.count;
|
|
27
|
-
}
|
|
28
|
-
get delete() {
|
|
29
|
-
return this.metadata.delete;
|
|
30
|
-
}
|
|
31
|
-
get deleteMany() {
|
|
32
|
-
return this.metadata.deleteMany;
|
|
33
|
-
}
|
|
34
|
-
get get() {
|
|
35
|
-
return this.metadata.get;
|
|
36
|
-
}
|
|
37
|
-
get update() {
|
|
38
|
-
return this.metadata.update;
|
|
39
|
-
}
|
|
40
|
-
get updateMany() {
|
|
41
|
-
return this.metadata.updateMany;
|
|
42
|
-
}
|
|
43
|
-
get search() {
|
|
44
|
-
return this.metadata.search;
|
|
45
|
-
}
|
|
46
|
-
getHandlerNames() {
|
|
47
|
-
const out = [];
|
|
48
|
-
collectionMethods.forEach(m => {
|
|
49
|
-
if (this.metadata[m])
|
|
50
|
-
out.push(m);
|
|
51
|
-
});
|
|
52
|
-
return out;
|
|
53
|
-
}
|
|
54
|
-
getHandler(method) {
|
|
55
|
-
const r = this.metadata[method];
|
|
56
|
-
return r && r.handler;
|
|
57
|
-
}
|
|
58
|
-
getSchema(jsonOnly) {
|
|
59
|
-
const out = super.getSchema(jsonOnly);
|
|
60
|
-
if (out.keyFields.length < 2)
|
|
61
|
-
out.keyFields = out.keyFields[0];
|
|
62
|
-
for (const k of collectionMethods) {
|
|
63
|
-
if (typeof out[k] === 'object' && !Object.keys(out[k]).length)
|
|
64
|
-
out[k] = true;
|
|
65
|
-
}
|
|
66
|
-
return out;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IResourceContainer } from '../../interfaces/resource-container.interface.js';
|
|
2
|
-
import { OpraSchema } from '../../opra-schema.definition.js';
|
|
3
|
-
import type { OpraDocument } from '../opra-document.js';
|
|
4
|
-
import { CollectionResourceInfo } from './collection-resource-info.js';
|
|
5
|
-
import { ResourceInfo } from './resource-info.js';
|
|
6
|
-
import { SingletonResourceInfo } from './singleton-resource-info.js';
|
|
7
|
-
export declare class ContainerResourceInfo extends ResourceInfo implements IResourceContainer {
|
|
8
|
-
readonly metadata: OpraSchema.ContainerResource;
|
|
9
|
-
constructor(service: OpraDocument, name: string, metadata: OpraSchema.ContainerResource);
|
|
10
|
-
getResource<T extends ResourceInfo>(name: string): T;
|
|
11
|
-
getCollectionResource(name: string): CollectionResourceInfo;
|
|
12
|
-
getSingletonResource(name: string): SingletonResourceInfo;
|
|
13
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CollectionResourceInfo } from './collection-resource-info.js';
|
|
2
|
-
import { ResourceInfo } from './resource-info.js';
|
|
3
|
-
import { SingletonResourceInfo } from './singleton-resource-info.js';
|
|
4
|
-
export class ContainerResourceInfo extends ResourceInfo {
|
|
5
|
-
constructor(service, name, metadata) {
|
|
6
|
-
super(service, name, metadata);
|
|
7
|
-
}
|
|
8
|
-
getResource(name) {
|
|
9
|
-
const t = this.metadata.resources[name];
|
|
10
|
-
if (!t)
|
|
11
|
-
throw new Error(`Resource "${name}" does not exists`);
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
getCollectionResource(name) {
|
|
15
|
-
const t = this.getResource(name);
|
|
16
|
-
if (!(t instanceof CollectionResourceInfo))
|
|
17
|
-
throw new Error(`"${name}" is not a Collection Resource`);
|
|
18
|
-
return t;
|
|
19
|
-
}
|
|
20
|
-
getSingletonResource(name) {
|
|
21
|
-
const t = this.getResource(name);
|
|
22
|
-
if (!(t instanceof SingletonResourceInfo))
|
|
23
|
-
throw new Error(`"${name}" is not a SingletonResource`);
|
|
24
|
-
return t;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OpraSchema } from '../../opra-schema.definition.js';
|
|
2
|
-
import { nodeInspectCustom } from '../../utils/inspect.util.js';
|
|
3
|
-
import type { OpraDocument } from '../opra-document.js';
|
|
4
|
-
export declare abstract class ResourceInfo {
|
|
5
|
-
readonly metadata: OpraSchema.Resource;
|
|
6
|
-
readonly document: OpraDocument;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
protected path: string;
|
|
9
|
-
protected constructor(document: OpraDocument, name: string, metadata: OpraSchema.Resource);
|
|
10
|
-
get instance(): {} | undefined;
|
|
11
|
-
get kind(): OpraSchema.ResourceKind;
|
|
12
|
-
get description(): string | undefined;
|
|
13
|
-
toString(): string;
|
|
14
|
-
validateQueryOptions(): any;
|
|
15
|
-
getSchema(jsonOnly?: boolean): OpraSchema.Resource;
|
|
16
|
-
[nodeInspectCustom](): string;
|
|
17
|
-
}
|