@opra/common 0.13.0 → 0.15.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 +53 -0
- package/cjs/document/factory/import-type-class.js +130 -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/cjs/http/{param-codec → codecs}/date-codec.js +1 -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 +84 -115
- 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.d.ts +102 -0
- package/esm/document/api-document.js +207 -0
- package/esm/document/constants.d.ts +3 -0
- package/esm/document/constants.js +3 -0
- package/esm/document/data-type/api-field.d.ts +41 -0
- package/esm/document/data-type/api-field.js +79 -0
- package/esm/document/data-type/builtin/any.type.d.ts +2 -0
- package/esm/document/data-type/builtin/any.type.js +11 -0
- package/esm/document/data-type/builtin/base64.type.d.ts +6 -0
- package/esm/document/data-type/builtin/base64.type.js +35 -0
- package/esm/document/data-type/builtin/bigint.type.d.ts +6 -0
- package/esm/document/data-type/builtin/bigint.type.js +30 -0
- package/esm/document/data-type/builtin/boolean.type.d.ts +5 -0
- package/esm/document/data-type/builtin/boolean.type.js +25 -0
- package/esm/document/data-type/builtin/date.type.d.ts +4 -0
- package/esm/document/data-type/builtin/date.type.js +15 -0
- package/esm/document/data-type/builtin/guid.type.d.ts +7 -0
- package/esm/document/data-type/builtin/guid.type.js +32 -0
- package/esm/document/data-type/builtin/index.d.ts +10 -0
- package/esm/document/data-type/builtin/index.js +10 -0
- package/esm/document/data-type/builtin/integer.type.d.ts +6 -0
- package/esm/document/data-type/builtin/integer.type.js +25 -0
- package/esm/document/data-type/builtin/number.type.d.ts +6 -0
- package/esm/document/data-type/builtin/number.type.js +30 -0
- package/esm/document/data-type/builtin/object.type.d.ts +3 -0
- package/esm/document/data-type/builtin/object.type.js +17 -0
- package/esm/document/data-type/builtin/string.type.d.ts +5 -0
- package/esm/document/data-type/builtin/string.type.js +21 -0
- package/esm/document/data-type/builtin/time.type.d.ts +7 -0
- package/esm/document/data-type/builtin/time.type.js +29 -0
- package/esm/document/data-type/builtin/timestamp.type.d.ts +5 -0
- package/esm/document/data-type/builtin/timestamp.type.js +26 -0
- package/esm/document/data-type/complex-type.d.ts +50 -0
- package/esm/document/data-type/complex-type.js +150 -0
- package/esm/document/data-type/data-type.d.ts +33 -0
- package/esm/document/data-type/data-type.js +43 -0
- package/esm/document/data-type/enum-type.d.ts +32 -0
- package/esm/document/data-type/enum-type.js +58 -0
- package/esm/document/data-type/mapped-type.d.ts +53 -0
- package/esm/document/data-type/mapped-type.js +91 -0
- package/esm/document/data-type/simple-type.d.ts +33 -0
- package/esm/document/data-type/simple-type.js +57 -0
- package/esm/document/data-type/union-type.d.ts +42 -0
- package/esm/document/data-type/union-type.js +78 -0
- package/esm/document/factory/add-references.d.ts +4 -0
- package/esm/document/factory/add-references.js +16 -0
- package/esm/document/factory/create-document.d.ts +12 -0
- package/esm/document/factory/create-document.js +75 -0
- package/esm/document/factory/factory.d.ts +61 -0
- package/esm/document/factory/factory.js +58 -0
- package/esm/document/factory/import-resource-class.d.ts +9 -0
- package/esm/document/factory/import-resource-class.js +47 -0
- package/esm/document/factory/import-type-class.d.ts +17 -0
- package/esm/document/factory/import-type-class.js +120 -0
- package/esm/document/factory/index.d.ts +1 -0
- package/esm/document/factory/index.js +1 -0
- package/esm/document/factory/process-resources.d.ts +7 -0
- package/esm/document/factory/process-resources.js +49 -0
- package/esm/document/factory/process-types.d.ts +6 -0
- package/esm/document/factory/process-types.js +185 -0
- package/esm/document/index.d.ts +14 -0
- package/esm/document/index.js +14 -0
- package/esm/document/resource/collection.d.ts +67 -0
- package/esm/document/resource/collection.js +181 -0
- package/esm/document/resource/resource.d.ts +29 -0
- package/esm/document/resource/resource.js +35 -0
- package/esm/document/resource/singleton.d.ts +49 -0
- package/esm/document/resource/singleton.js +87 -0
- package/esm/exception/opra-exception.js +2 -0
- package/esm/exception/resource-errors/resource-not-found.error.d.ts +4 -0
- package/esm/exception/resource-errors/resource-not-found.error.js +4 -0
- package/esm/filter/parse.js +3 -1
- package/esm/helpers/function-utils.d.ts +4 -0
- package/esm/helpers/function-utils.js +19 -0
- package/esm/helpers/get-stack-filename.d.ts +1 -0
- package/esm/helpers/get-stack-filename.js +20 -0
- package/esm/helpers/index.d.ts +7 -0
- package/esm/helpers/index.js +7 -0
- package/esm/helpers/is-url.d.ts +1 -0
- package/esm/helpers/is-url.js +4 -0
- package/esm/{schema/utils/clone-object.util.d.ts → helpers/object-utils.d.ts} +1 -0
- package/esm/{schema/utils/clone-object.util.js → helpers/object-utils.js} +11 -0
- package/esm/helpers/path-to-object-tree.d.ts +4 -0
- package/esm/{utils/path-to-tree.js → helpers/path-to-object-tree.js} +7 -7
- package/esm/helpers/responsive-map.d.ts +15 -13
- package/esm/helpers/responsive-map.js +62 -14
- package/esm/{utils → helpers}/type-guards.d.ts +3 -1
- package/esm/{utils → helpers}/type-guards.js +9 -3
- package/esm/http/codecs/boolean-codec.d.ts +5 -0
- package/esm/http/{param-codec → codecs}/boolean-codec.js +1 -2
- package/esm/http/{param-codec → codecs}/date-codec.d.ts +2 -2
- package/esm/http/{param-codec → codecs}/date-codec.js +1 -4
- package/esm/http/{param-codec → codecs}/filter-codec.d.ts +2 -2
- package/esm/http/{param-codec → codecs}/filter-codec.js +1 -2
- package/esm/http/codecs/integer-codec.d.ts +11 -0
- package/esm/http/codecs/number-codec.d.ts +14 -0
- package/esm/http/{param-codec → codecs}/number-codec.js +1 -3
- package/esm/http/codecs/string-codec.d.ts +16 -0
- package/esm/http/{param-codec → codecs}/string-codec.js +1 -3
- package/esm/http/enums/http-headers-codes.enum.d.ts +13 -4
- package/esm/http/enums/http-headers-codes.enum.js +13 -4
- package/esm/http/enums/http-status-messages.d.ts +65 -0
- package/esm/http/enums/http-status-messages.js +65 -0
- package/esm/http/http-headers.d.ts +50 -34
- package/esm/http/http-headers.js +137 -123
- package/esm/http/http-message.host.d.ts +122 -0
- package/esm/http/http-message.host.js +246 -0
- package/esm/http/http-params.d.ts +43 -29
- package/esm/http/http-params.js +75 -43
- package/esm/http/http-request-message.d.ts +213 -0
- package/esm/http/http-request-message.js +148 -0
- package/esm/http/http-response-message.d.ts +318 -0
- package/esm/http/http-response-message.js +233 -0
- package/esm/http/index.d.ts +8 -11
- package/esm/http/index.js +8 -11
- package/esm/http/interfaces/cookie-options.interface.d.ts +4 -0
- package/esm/http/multipart/batch-multipart.d.ts +0 -31
- package/esm/http/multipart/batch-multipart.js +170 -149
- package/esm/http/multipart/http-request-content.d.ts +0 -8
- package/esm/http/multipart/http-request-content.js +17 -8
- package/esm/http/multipart/http-response-content.d.ts +0 -7
- package/esm/http/multipart/http-response-content.js +14 -7
- package/esm/http/multipart/index.d.ts +0 -1
- package/esm/http/multipart/index.js +2 -1
- package/esm/i18n/i18n.js +1 -1
- package/esm/index.d.ts +6 -5
- package/esm/index.js +6 -5
- package/esm/schema/constants.d.ts +2 -8
- package/esm/schema/constants.js +1 -8
- package/esm/schema/data-type/complex-type.interface.d.ts +16 -0
- package/esm/schema/data-type/complex-type.interface.js +4 -0
- package/esm/schema/data-type/data-type.interface.d.ts +14 -0
- package/esm/schema/data-type/enum-type.interface.d.ts +15 -0
- package/esm/schema/data-type/enum-type.interface.js +4 -0
- package/esm/schema/data-type/field.interface.d.ts +21 -0
- package/esm/schema/data-type/mapped-type.interface.d.ts +11 -0
- package/esm/schema/data-type/mapped-type.interface.js +4 -0
- package/esm/schema/data-type/simple-type.interface.d.ts +18 -0
- package/esm/schema/data-type/simple-type.interface.js +4 -0
- package/esm/schema/data-type/union-type.interface.d.ts +10 -0
- package/esm/schema/data-type/union-type.interface.js +4 -0
- package/esm/schema/document.interface.d.ts +34 -0
- package/esm/schema/index.d.ts +51 -25
- package/esm/schema/index.js +41 -25
- package/esm/schema/resource/collection.interface.d.ts +33 -0
- package/esm/schema/resource/collection.interface.js +4 -0
- package/esm/schema/resource/container.interface.d.ts +9 -0
- package/esm/schema/resource/container.interface.js +4 -0
- package/esm/schema/resource/endpoint.interface.d.ts +29 -0
- package/esm/schema/resource/resource.interface.d.ts +12 -0
- package/esm/schema/resource/resource.interface.js +1 -0
- package/esm/schema/resource/singleton.interface.d.ts +22 -0
- package/esm/schema/resource/singleton.interface.js +4 -0
- package/esm/schema/type-guards.d.ts +20 -0
- package/esm/schema/type-guards.js +46 -0
- package/esm/{schema/types.d.ts → types.d.ts} +0 -3
- package/esm/types.js +1 -0
- package/esm/url/index.d.ts +2 -2
- package/esm/url/index.js +2 -2
- package/esm/url/opra-url-path-component.js +1 -1
- package/esm/url/opra-url-path.js +6 -3
- package/esm/url/opra-url.d.ts +8 -27
- package/esm/url/opra-url.js +83 -114
- package/esm/url/utils/decode-path-component.d.ts +5 -0
- package/esm/url/utils/{path-utils.js → decode-path-component.js} +0 -41
- package/esm/url/utils/encode-path-component.d.ts +1 -0
- package/esm/url/utils/encode-path-component.js +22 -0
- package/esm/utils/path-utils.d.ts +2 -0
- package/esm/utils/path-utils.js +19 -0
- package/package.json +21 -6
- 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/filter-format.js +0 -18
- package/cjs/url/formats/format.js +0 -6
- package/cjs/url/formats/integer-format.js +0 -19
- 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.d.ts +0 -0
- package/esm/constants.js +0 -1
- 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/param-codec/boolean-codec.d.ts +0 -5
- package/esm/http/param-codec/integer-codec.d.ts +0 -9
- 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/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/interfaces/child-field-query.interface.d.ts +0 -4
- package/esm/schema/interfaces/data-type.metadata.d.ts +0 -18
- package/esm/schema/interfaces/resource-container.interface.d.ts +0 -8
- package/esm/schema/interfaces/resource.metadata.d.ts +0 -18
- 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/utils/class.utils.d.ts +0 -2
- package/esm/schema/utils/class.utils.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/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/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/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 → document}/utils/inspect.util.d.ts +0 -0
- /package/esm/{schema → document}/utils/inspect.util.js +0 -0
- /package/esm/{schema → document}/utils/string-compare.util.d.ts +0 -0
- /package/esm/{schema → document}/utils/string-compare.util.js +0 -0
- /package/esm/{schema/type-helpers/mixin.utils.d.ts → helpers/mixin-utils.d.ts} +0 -0
- /package/esm/{schema/type-helpers/mixin.utils.js → helpers/mixin-utils.js} +0 -0
- /package/esm/http/{param-codec → codecs}/integer-codec.js +0 -0
- /package/esm/{schema/interfaces/child-field-query.interface.js → http/interfaces/cookie-options.interface.js} +0 -0
- /package/esm/schema/{interfaces/data-type.metadata.js → data-type/data-type.interface.js} +0 -0
- /package/esm/schema/{interfaces/resource-container.interface.js → data-type/field.interface.js} +0 -0
- /package/esm/schema/{interfaces/resource.metadata.js → document.interface.js} +0 -0
- /package/esm/schema/{types.js → resource/endpoint.interface.js} +0 -0
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { HttpHeaders, HttpHeadersInit } from './http-headers.js';
|
|
2
|
-
export interface HttpResponseInit {
|
|
3
|
-
headers?: HttpHeadersInit;
|
|
4
|
-
status?: number;
|
|
5
|
-
statusText?: string;
|
|
6
|
-
url?: string;
|
|
7
|
-
body?: any;
|
|
8
|
-
hasBody?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare class HttpResponse<TBody = any> {
|
|
11
|
-
/**
|
|
12
|
-
* Contains the Headers object associated with the response.
|
|
13
|
-
*/
|
|
14
|
-
readonly headers: HttpHeaders;
|
|
15
|
-
/**
|
|
16
|
-
* Contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
|
|
17
|
-
*/
|
|
18
|
-
readonly ok: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Contains the HTTP status codes of the response
|
|
21
|
-
*/
|
|
22
|
-
readonly status: number;
|
|
23
|
-
/**
|
|
24
|
-
* Contains the status message corresponding to the HTTP status code in status property
|
|
25
|
-
*/
|
|
26
|
-
readonly statusText: string;
|
|
27
|
-
/**
|
|
28
|
-
* Contains the URL of the response
|
|
29
|
-
*/
|
|
30
|
-
readonly url: string | null;
|
|
31
|
-
/**
|
|
32
|
-
* Body contents
|
|
33
|
-
*/
|
|
34
|
-
readonly body: TBody | null;
|
|
35
|
-
/**
|
|
36
|
-
* Returns true if response has body to be received
|
|
37
|
-
*/
|
|
38
|
-
readonly hasBody: boolean;
|
|
39
|
-
constructor(init?: HttpResponseInit);
|
|
40
|
-
clone(update?: HttpResponseInit): HttpResponse;
|
|
41
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { HttpHeaders } from './http-headers.js';
|
|
2
|
-
export class HttpResponse {
|
|
3
|
-
constructor(init) {
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if response has body to be received
|
|
6
|
-
*/
|
|
7
|
-
this.hasBody = false;
|
|
8
|
-
this.headers = new HttpHeaders(init?.headers);
|
|
9
|
-
this.status = init?.status || 200;
|
|
10
|
-
this.statusText = init?.statusText || 'OK';
|
|
11
|
-
this.url = init?.url || null;
|
|
12
|
-
this.ok = this.status >= 200 && this.status < 300;
|
|
13
|
-
this.body = init?.body;
|
|
14
|
-
this.hasBody = init?.body != null || !!init?.hasBody;
|
|
15
|
-
}
|
|
16
|
-
clone(update) {
|
|
17
|
-
return new HttpResponse({ ...this, ...update });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NumberCodec, NumberFormatOptions } from './number-codec.js';
|
|
2
|
-
export interface IntegerFormatOptions extends NumberFormatOptions {
|
|
3
|
-
enum?: number[];
|
|
4
|
-
}
|
|
5
|
-
export declare class IntegerCodec extends NumberCodec {
|
|
6
|
-
enum?: number[];
|
|
7
|
-
constructor(options?: IntegerFormatOptions);
|
|
8
|
-
decode(value: string): number;
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { HttpParamCodec } from '../http-param-codec.js';
|
|
2
|
-
export interface NumberFormatOptions {
|
|
3
|
-
max?: number;
|
|
4
|
-
min?: number;
|
|
5
|
-
}
|
|
6
|
-
export declare class NumberCodec extends HttpParamCodec {
|
|
7
|
-
max?: number;
|
|
8
|
-
min?: number;
|
|
9
|
-
constructor(options?: NumberFormatOptions);
|
|
10
|
-
decode(value: string): number;
|
|
11
|
-
encode(value: any): string;
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { HttpParamCodec } from '../http-param-codec.js';
|
|
2
|
-
export interface StringFormatOptions {
|
|
3
|
-
maxLength?: number;
|
|
4
|
-
minLength?: number;
|
|
5
|
-
enum?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare class StringCodec extends HttpParamCodec {
|
|
8
|
-
maxLength?: number;
|
|
9
|
-
minLength?: number;
|
|
10
|
-
enum?: string[];
|
|
11
|
-
constructor(options?: StringFormatOptions);
|
|
12
|
-
decode(value: string): string;
|
|
13
|
-
encode(value: any): string;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function encodeURIParam(v: string): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encode input string with standard encodeURIComponent and then un-encode specific characters.
|
|
3
|
-
*/
|
|
4
|
-
const ENCODING_REGEX = /%(\d[a-f0-9])/gi;
|
|
5
|
-
const ENCODING_REPLACEMENTS = {
|
|
6
|
-
'2C': ',',
|
|
7
|
-
'2F': '/',
|
|
8
|
-
'24': '$',
|
|
9
|
-
'3A': ':',
|
|
10
|
-
'3B': ';',
|
|
11
|
-
'3D': '=',
|
|
12
|
-
'3F': '?',
|
|
13
|
-
'40': '@'
|
|
14
|
-
};
|
|
15
|
-
export function encodeURIParam(v) {
|
|
16
|
-
return encodeURIComponent(v).replace(ENCODING_REGEX, (s, t) => ENCODING_REPLACEMENTS[t] ?? s);
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function normalizeHeaders(headers: any, normalCase?: boolean): Record<string, string | string[]>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { HttpHeaderCodes } from '../enums/http-headers-codes.enum.js';
|
|
2
|
-
const knownKeys = Object.keys(HttpHeaderCodes);
|
|
3
|
-
const knownKeysLower = knownKeys.map(x => x.toLowerCase());
|
|
4
|
-
export function normalizeHeaders(headers, normalCase) {
|
|
5
|
-
if (!headers)
|
|
6
|
-
return {};
|
|
7
|
-
return Object.keys(headers).reduce((o, k) => {
|
|
8
|
-
const v = headers[k];
|
|
9
|
-
const key = normalCase
|
|
10
|
-
? knownKeys[knownKeysLower.indexOf(k.toLowerCase())] || camelize(k) :
|
|
11
|
-
k.toLowerCase();
|
|
12
|
-
if (k.toLowerCase() === 'set-cookie')
|
|
13
|
-
o[key] = Array.isArray(v) ? v : [v];
|
|
14
|
-
else {
|
|
15
|
-
o[key] = Array.isArray(v) ? v.join(';') : v;
|
|
16
|
-
}
|
|
17
|
-
return o;
|
|
18
|
-
}, {}) || {};
|
|
19
|
-
}
|
|
20
|
-
function camelize(str) {
|
|
21
|
-
return str.replace(/(^\w|[A-Z]|\b\w)/g, function (word) {
|
|
22
|
-
return word.toUpperCase();
|
|
23
|
-
});
|
|
24
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { PartialSome, StrictOmit } from 'ts-gems';
|
|
3
|
-
import { CollectionResourceMetadata } from '../interfaces/resource.metadata.js';
|
|
4
|
-
import { TypeThunkAsync } from '../types.js';
|
|
5
|
-
export type CollectionResourceOptions = PartialSome<StrictOmit<CollectionResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'count' | 'get' | 'update' | 'updateMany' | 'delete' | 'deleteMany' | 'search'>, 'keyFields'> & {
|
|
6
|
-
name?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function OprCollectionResource(entityFunc: TypeThunkAsync, options?: CollectionResourceOptions): (target: Function) => void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import omit from 'lodash.omit';
|
|
3
|
-
import { RESOURCE_METADATA } from '../constants.js';
|
|
4
|
-
const NESTJS_INJECTABLE_WATERMARK = '__injectable__';
|
|
5
|
-
const NAME_PATTERN = /^(.*)Resource$/;
|
|
6
|
-
export function OprCollectionResource(entityFunc, options) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
9
|
-
const meta = {
|
|
10
|
-
kind: 'CollectionResource',
|
|
11
|
-
type: entityFunc,
|
|
12
|
-
name
|
|
13
|
-
};
|
|
14
|
-
Object.assign(meta, omit(options, Object.keys(meta)));
|
|
15
|
-
Reflect.defineMetadata(RESOURCE_METADATA, meta, target);
|
|
16
|
-
/* Define Injectable metadata for NestJS support*/
|
|
17
|
-
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StrictOmit } from 'ts-gems';
|
|
2
|
-
import { ComplexTypeMetadata } from '../interfaces/data-type.metadata.js';
|
|
3
|
-
export type ComplexTypeDecoratorOptions = Partial<StrictOmit<ComplexTypeMetadata, 'name' | 'kind' | 'ctor' | 'fields' | 'extends'>> & {
|
|
4
|
-
name?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function OprComplexType(options?: ComplexTypeDecoratorOptions): ClassDecorator;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import omit from 'lodash.omit';
|
|
2
|
-
import { DATATYPE_METADATA } from '../constants.js';
|
|
3
|
-
const NAME_PATTERN = /^(.*)Type$/;
|
|
4
|
-
export function OprComplexType(options) {
|
|
5
|
-
return (target) => {
|
|
6
|
-
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
7
|
-
const meta = {
|
|
8
|
-
kind: 'ComplexType',
|
|
9
|
-
name,
|
|
10
|
-
};
|
|
11
|
-
Object.assign(meta, omit(options, Object.keys(meta)));
|
|
12
|
-
const base = Object.getPrototypeOf(target);
|
|
13
|
-
const baseMeta = Reflect.getMetadata(DATATYPE_METADATA, base);
|
|
14
|
-
if (baseMeta) {
|
|
15
|
-
if (baseMeta.additionalFields && meta.additionalFields == null)
|
|
16
|
-
meta.additionalFields = true;
|
|
17
|
-
meta.extends = [{
|
|
18
|
-
type: base
|
|
19
|
-
}];
|
|
20
|
-
}
|
|
21
|
-
Reflect.defineMetadata(DATATYPE_METADATA, meta, target);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import omit from 'lodash.omit';
|
|
2
|
-
import { COMPLEXTYPE_FIELDS } from '../constants.js';
|
|
3
|
-
export function OprField(args) {
|
|
4
|
-
return (target, propertyKey) => {
|
|
5
|
-
if (typeof propertyKey !== 'string')
|
|
6
|
-
throw new TypeError(`Symbol properties can't be used as field`);
|
|
7
|
-
const designType = Reflect.getMetadata('design:type', target, propertyKey);
|
|
8
|
-
const metadata = {
|
|
9
|
-
type: args?.type
|
|
10
|
-
};
|
|
11
|
-
Object.assign(metadata, omit(args, Object.keys(metadata)));
|
|
12
|
-
if (designType === Array) {
|
|
13
|
-
metadata.isArray = true;
|
|
14
|
-
metadata.type = metadata.type || 'any';
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
delete metadata.isArray;
|
|
18
|
-
metadata.type = metadata.type || designType;
|
|
19
|
-
}
|
|
20
|
-
const fields = Reflect.getOwnMetadata(COMPLEXTYPE_FIELDS, target.constructor) || {};
|
|
21
|
-
fields[propertyKey] = metadata;
|
|
22
|
-
Reflect.defineMetadata(COMPLEXTYPE_FIELDS, fields, target.constructor);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ICreateResolverMetadata, IDeleteManyResolverMetadata, IDeleteResolverMetadata, IGetResolverMetadata, ISearchResolverMetadata, IUpdateManyResolverMetadata, IUpdateResolverMetadata } from '../interfaces/resource.metadata.js';
|
|
2
|
-
export declare function OprCreateResolver(options?: ICreateResolverMetadata): (target: Object, propertyKey: 'create') => void;
|
|
3
|
-
export declare function OprDeleteResolver(options?: IDeleteResolverMetadata): (target: Object, propertyKey: 'delete') => void;
|
|
4
|
-
export declare function OprDeleteManyResolver(options?: IDeleteManyResolverMetadata): (target: Object, propertyKey: 'deleteMany') => void;
|
|
5
|
-
export declare function OprUpdateResolver(options?: IUpdateResolverMetadata): (target: Object, propertyKey: 'update') => void;
|
|
6
|
-
export declare function OprUpdateManyResolver(options?: IUpdateManyResolverMetadata): (target: Object, propertyKey: 'updateMany') => void;
|
|
7
|
-
export declare function OprGetResolver(options?: IGetResolverMetadata): (target: Object, propertyKey: 'get') => void;
|
|
8
|
-
export declare function OprSearchResolver(options?: ISearchResolverMetadata): (target: Object, propertyKey: 'search') => void;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { RESOLVER_METADATA } from '../constants.js';
|
|
2
|
-
export function OprCreateResolver(options) {
|
|
3
|
-
return (target, propertyKey) => {
|
|
4
|
-
if (propertyKey !== 'create')
|
|
5
|
-
throw new TypeError('This decorator can only be applied for the "create" property');
|
|
6
|
-
const metadata = {
|
|
7
|
-
...options
|
|
8
|
-
};
|
|
9
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function OprDeleteResolver(options) {
|
|
13
|
-
return (target, propertyKey) => {
|
|
14
|
-
if (propertyKey !== 'delete')
|
|
15
|
-
throw new TypeError('This decorator can only be applied for the "delete" property');
|
|
16
|
-
const metadata = {
|
|
17
|
-
...options
|
|
18
|
-
};
|
|
19
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function OprDeleteManyResolver(options) {
|
|
23
|
-
return (target, propertyKey) => {
|
|
24
|
-
if (propertyKey !== 'deleteMany')
|
|
25
|
-
throw new TypeError('This decorator can only be applied for the "deleteMany" property');
|
|
26
|
-
const metadata = {
|
|
27
|
-
...options
|
|
28
|
-
};
|
|
29
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export function OprUpdateResolver(options) {
|
|
33
|
-
return (target, propertyKey) => {
|
|
34
|
-
if (propertyKey !== 'update')
|
|
35
|
-
throw new TypeError('This decorator can only be applied for the "update" property');
|
|
36
|
-
const metadata = {
|
|
37
|
-
...options
|
|
38
|
-
};
|
|
39
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export function OprUpdateManyResolver(options) {
|
|
43
|
-
return (target, propertyKey) => {
|
|
44
|
-
if (propertyKey !== 'updateMany')
|
|
45
|
-
throw new TypeError('This decorator can only be applied for the "updateMany" property');
|
|
46
|
-
const metadata = {
|
|
47
|
-
...options
|
|
48
|
-
};
|
|
49
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export function OprGetResolver(options) {
|
|
53
|
-
return (target, propertyKey) => {
|
|
54
|
-
if (propertyKey !== 'get')
|
|
55
|
-
throw new TypeError('This decorator can only be applied for the "get" property');
|
|
56
|
-
const metadata = {
|
|
57
|
-
...options
|
|
58
|
-
};
|
|
59
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export function OprSearchResolver(options) {
|
|
63
|
-
return (target, propertyKey) => {
|
|
64
|
-
if (propertyKey !== 'search')
|
|
65
|
-
throw new TypeError('This decorator can only be applied for the "search" property');
|
|
66
|
-
const metadata = {
|
|
67
|
-
...options
|
|
68
|
-
};
|
|
69
|
-
Reflect.defineMetadata(RESOLVER_METADATA, metadata, target, propertyKey);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StrictOmit } from 'ts-gems';
|
|
2
|
-
import { SimpleTypeMetadata } from '../interfaces/data-type.metadata.js';
|
|
3
|
-
export type SimpleTypeDecoratorOptions = Partial<StrictOmit<SimpleTypeMetadata, 'name' | 'kind'>> & {
|
|
4
|
-
name?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function OprSimpleType(options?: SimpleTypeDecoratorOptions): ClassDecorator;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import omit from 'lodash.omit';
|
|
2
|
-
import { DATATYPE_METADATA } from '../constants.js';
|
|
3
|
-
const NAME_PATTERN = /^(.*)Type$/;
|
|
4
|
-
export function OprSimpleType(options) {
|
|
5
|
-
return (target) => {
|
|
6
|
-
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
7
|
-
const meta = {
|
|
8
|
-
kind: 'SimpleType',
|
|
9
|
-
name
|
|
10
|
-
};
|
|
11
|
-
Object.assign(meta, omit(options, Object.keys(meta)));
|
|
12
|
-
Reflect.defineMetadata(DATATYPE_METADATA, meta, target);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { StrictOmit } from 'ts-gems';
|
|
3
|
-
import { SingletonResourceMetadata } from '../interfaces/resource.metadata.js';
|
|
4
|
-
import { TypeThunkAsync } from '../types.js';
|
|
5
|
-
export type SingletonResourceOptions = StrictOmit<SingletonResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'get' | 'update' | 'delete'> & {
|
|
6
|
-
name?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function OprSingletonResource(type: TypeThunkAsync | string, options?: SingletonResourceOptions): (target: Function) => void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import omit from 'lodash.omit';
|
|
3
|
-
import { RESOURCE_METADATA } from '../constants.js';
|
|
4
|
-
const NESTJS_INJECTABLE_WATERMARK = '__injectable__';
|
|
5
|
-
const NAME_PATTERN = /^(.*)Resource$/;
|
|
6
|
-
export function OprSingletonResource(type, options) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
9
|
-
const meta = {
|
|
10
|
-
kind: 'SingletonResource',
|
|
11
|
-
type,
|
|
12
|
-
name
|
|
13
|
-
};
|
|
14
|
-
Object.assign(meta, omit(options, Object.keys(meta)));
|
|
15
|
-
Reflect.defineMetadata(RESOURCE_METADATA, meta, target);
|
|
16
|
-
/* Define Injectable metadata for NestJS support*/
|
|
17
|
-
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const BufferConstructor = Object.getPrototypeOf(Buffer.from('')).constructor;
|
|
2
|
-
export const Base64BinaryType = {
|
|
3
|
-
kind: 'SimpleType',
|
|
4
|
-
description: 'A stream of bytes, base64 encoded',
|
|
5
|
-
ctor: BufferConstructor,
|
|
6
|
-
parse(v) {
|
|
7
|
-
return Buffer.from(v);
|
|
8
|
-
},
|
|
9
|
-
serialize(v) {
|
|
10
|
-
return Buffer.isBuffer(v) ? v.toString('base64') : undefined;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const BigIntConstructor = Object.getPrototypeOf(BigInt(0)).constructor;
|
|
2
|
-
export const BigIntType = {
|
|
3
|
-
kind: 'SimpleType',
|
|
4
|
-
description: 'BigInt number',
|
|
5
|
-
ctor: BigIntConstructor,
|
|
6
|
-
parse(v) {
|
|
7
|
-
return BigInt(v);
|
|
8
|
-
},
|
|
9
|
-
serialize(v) {
|
|
10
|
-
return String(v);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { toString } from 'putil-varhelpers';
|
|
2
|
-
export const DateStringType = {
|
|
3
|
-
kind: 'SimpleType',
|
|
4
|
-
description: 'A date, date-time or partial date in string format',
|
|
5
|
-
ctor: String,
|
|
6
|
-
parse(v) {
|
|
7
|
-
return toString(v);
|
|
8
|
-
},
|
|
9
|
-
serialize(v) {
|
|
10
|
-
return toString(v);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { toNumber } from 'putil-varhelpers';
|
|
2
|
-
export const NumberType = {
|
|
3
|
-
kind: 'SimpleType',
|
|
4
|
-
description: 'Both Integer as well as Floating-Point numbers',
|
|
5
|
-
ctor: Number,
|
|
6
|
-
parse(v) {
|
|
7
|
-
return toNumber(v);
|
|
8
|
-
},
|
|
9
|
-
serialize(v) {
|
|
10
|
-
return toNumber(v);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ResponsiveMap } from '../../../helpers/responsive-map.js';
|
|
2
|
-
import { OpraSchema } from '../../opra-schema.definition.js';
|
|
3
|
-
export declare const builtInTypes: ResponsiveMap<string, OpraSchema.DataType>;
|
|
4
|
-
export declare const primitiveClasses: Map<Function, string>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ResponsiveMap } from '../../../helpers/responsive-map.js';
|
|
2
|
-
import { AnyType } from './builtin/any.type.js';
|
|
3
|
-
import { Base64BinaryType } from './builtin/base64-binary.type.js';
|
|
4
|
-
import { BigIntType } from './builtin/bigint.type.js';
|
|
5
|
-
import { BooleanType } from './builtin/boolean.type.js';
|
|
6
|
-
import { DateType } from './builtin/date.type.js';
|
|
7
|
-
import { DateStringType } from './builtin/date-string.type.js';
|
|
8
|
-
import { GuidType } from './builtin/guid.type.js';
|
|
9
|
-
import { IntegerType } from './builtin/integer.type.js';
|
|
10
|
-
import { NumberType } from './builtin/number.type.js';
|
|
11
|
-
import { ObjectType } from './builtin/object.type.js';
|
|
12
|
-
import { StringType } from './builtin/string.type.js';
|
|
13
|
-
const BigIntConstructor = Object.getPrototypeOf(BigInt(0)).constructor;
|
|
14
|
-
const BufferConstructor = Object.getPrototypeOf(Buffer.from('')).constructor;
|
|
15
|
-
export const builtInTypes = new ResponsiveMap();
|
|
16
|
-
builtInTypes.set('any', AnyType);
|
|
17
|
-
builtInTypes.set('base64Binary', Base64BinaryType);
|
|
18
|
-
builtInTypes.set('bigint', BigIntType);
|
|
19
|
-
builtInTypes.set('boolean', BooleanType);
|
|
20
|
-
builtInTypes.set('date', DateType);
|
|
21
|
-
builtInTypes.set('dateString', DateStringType);
|
|
22
|
-
builtInTypes.set('guid', GuidType);
|
|
23
|
-
builtInTypes.set('integer', IntegerType);
|
|
24
|
-
builtInTypes.set('number', NumberType);
|
|
25
|
-
builtInTypes.set('object', ObjectType);
|
|
26
|
-
builtInTypes.set('string', StringType);
|
|
27
|
-
export const primitiveClasses = new Map();
|
|
28
|
-
primitiveClasses.set(Boolean, 'boolean');
|
|
29
|
-
primitiveClasses.set(String, 'string');
|
|
30
|
-
primitiveClasses.set(Number, 'number');
|
|
31
|
-
primitiveClasses.set(Date, 'date');
|
|
32
|
-
primitiveClasses.set(BigIntConstructor, 'bigint');
|
|
33
|
-
primitiveClasses.set(BufferConstructor, 'base64Binary');
|
|
34
|
-
primitiveClasses.set(Object, 'object');
|