@opra/common 1.20.0 → 1.22.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/README.md +3 -0
- package/browser.js +12 -0
- package/{esm/document → document}/api-document.js +7 -7
- package/{esm/document → document}/common/api-base.js +2 -1
- package/{esm/document → document}/common/data-type-map.js +3 -6
- package/{esm/document → document}/common/document-init-context.js +4 -3
- package/{esm/document → document}/common/document-node.js +4 -0
- package/{esm/document → document}/common/opra-document-error.js +1 -1
- package/{esm/document → document}/common/value.js +4 -0
- package/{esm/document → document}/data-type/api-field.js +1 -0
- package/{types/document → document}/data-type/array-type.d.ts +1 -1
- package/{esm/document → document}/data-type/complex-type-base.js +3 -0
- package/{esm/document → document}/data-type/complex-type.js +1 -0
- package/{esm/document → document}/data-type/extended-types/base64.type.js +1 -0
- package/{esm/document → document}/data-type/extended-types/date-time-tz.type.js +2 -0
- package/{esm/document → document}/data-type/extended-types/date-time.type.js +3 -0
- package/{esm/document → document}/data-type/extended-types/date.type.js +3 -0
- package/{esm/document → document}/data-type/extended-types/email.type.js +9 -0
- package/{esm/document → document}/data-type/extended-types/field-path.type.js +2 -0
- package/{esm/document → document}/data-type/extended-types/filter.type.js +2 -0
- package/{esm/document → document}/data-type/extended-types/partial-date.type.js +2 -0
- package/{esm/document → document}/data-type/extended-types/time.type.js +2 -0
- package/{esm/document → document}/data-type/extended-types/uuid.type.js +1 -0
- package/{esm/document → document}/data-type/mapped-type.js +4 -0
- package/{esm/document → document}/data-type/primitive-types/number.type.js +2 -0
- package/{esm/document → document}/data-type/primitive-types/string.type.js +4 -0
- package/{esm/document → document}/data-type/simple-type.js +3 -0
- package/document/decorators/ws-param.decorator.d.ts +7 -0
- package/{esm/document → document}/decorators/ws-param.decorator.js +2 -2
- package/{esm/document → document}/factory/api-document.factory.js +1 -3
- package/{esm/document → document}/factory/ws-api.factory.js +14 -3
- package/{esm/document → document}/http/http-api.js +5 -4
- package/{esm/document → document}/http/http-multipart-field.js +3 -0
- package/{esm/document → document}/http/http-operation-response.js +3 -0
- package/{esm/document → document}/http/http-request-body.js +8 -1
- package/{esm/document → document}/http/http-status-range.js +2 -2
- package/{esm/document → document}/mq/mq-api.js +5 -4
- package/{esm/document → document}/mq/mq-operation-response.js +7 -1
- package/{esm/document → document}/ws/ws-api.js +4 -4
- package/{types/document → document}/ws/ws-operation.d.ts +15 -3
- package/{esm/document → document}/ws/ws-operation.js +10 -2
- package/{esm/exception → exception}/http-errors/bad-request.error.js +1 -4
- package/{esm/exception → exception}/http-errors/conflict.error.js +1 -4
- package/{esm/exception → exception}/http-errors/failed-dependency.error.js +1 -4
- package/{esm/exception → exception}/http-errors/forbidden.error.js +1 -4
- package/{esm/exception → exception}/http-errors/internal-server.error.js +1 -4
- package/{esm/exception → exception}/http-errors/method-not-allowed.error.js +1 -4
- package/{esm/exception → exception}/http-errors/not-acceptable.error.js +1 -4
- package/{esm/exception → exception}/http-errors/not-found.error.js +1 -4
- package/{esm/exception → exception}/http-errors/resource-conflict.error.js +1 -1
- package/{esm/exception → exception}/http-errors/unauthorized.error.js +1 -4
- package/{esm/exception → exception}/http-errors/unprocessable-entity.error.js +1 -4
- package/{esm/exception → exception}/opra-exception.js +5 -1
- package/{esm/exception → exception}/opra-http-error.js +1 -0
- package/filter/antlr/OpraFilterLexer.js +425 -0
- package/filter/antlr/OpraFilterListener.js +302 -0
- package/{esm/filter → filter}/antlr/OpraFilterParser.js +218 -214
- package/filter/antlr/OpraFilterVisitor.js +185 -0
- package/{esm/filter → filter}/ast/abstract/ast.js +1 -0
- package/{esm/filter → filter}/ast/expressions/arithmetic-expression.js +3 -1
- package/{esm/filter → filter}/ast/expressions/array-expression.js +1 -0
- package/{esm/filter → filter}/ast/expressions/comparison-expression.js +4 -0
- package/{esm/filter → filter}/ast/expressions/logical-expression.js +2 -0
- package/{esm/filter → filter}/ast/expressions/negative-expression.js +1 -0
- package/{esm/filter → filter}/ast/expressions/parenthesized-expression.js +1 -0
- package/{esm/filter → filter}/ast/terms/date-literal.js +1 -0
- package/{esm/filter → filter}/ast/terms/date-time-literal.js +1 -0
- package/{esm/filter → filter}/ast/terms/null-literal.js +1 -1
- package/{esm/filter → filter}/ast/terms/number-literal.js +1 -0
- package/{esm/filter → filter}/ast/terms/time-literal.js +1 -0
- package/{esm/filter → filter}/filter-rules.js +2 -2
- package/{esm/filter → filter}/filter-tree-visitor.js +1 -0
- package/{esm/filter → filter}/opra-error-listener.js +1 -0
- package/{esm/helpers → helpers}/parse-fields-projection.js +2 -0
- package/package.json +15 -35
- package/{types/schema → schema}/ws/ws-api.interface.d.ts +4 -0
- package/browser/index.cjs +0 -12
- package/browser/index.mjs +0 -12
- package/cjs/document/api-document.js +0 -182
- package/cjs/document/common/api-base.js +0 -31
- package/cjs/document/common/data-type-map.js +0 -77
- package/cjs/document/common/document-element.js +0 -34
- package/cjs/document/common/document-init-context.js +0 -69
- package/cjs/document/common/document-node.js +0 -145
- package/cjs/document/common/opra-document-error.js +0 -15
- package/cjs/document/common/value.js +0 -39
- package/cjs/document/constants.js +0 -18
- package/cjs/document/data-type/api-field.js +0 -124
- package/cjs/document/data-type/array-type.js +0 -78
- package/cjs/document/data-type/complex-type-base.js +0 -346
- package/cjs/document/data-type/complex-type.js +0 -127
- package/cjs/document/data-type/data-type.js +0 -67
- package/cjs/document/data-type/enum-type.js +0 -128
- package/cjs/document/data-type/extended-types/base64.type.js +0 -49
- package/cjs/document/data-type/extended-types/date-time-tz.type.js +0 -63
- package/cjs/document/data-type/extended-types/date-time.type.js +0 -76
- package/cjs/document/data-type/extended-types/date.type.js +0 -74
- package/cjs/document/data-type/extended-types/email.type.js +0 -95
- package/cjs/document/data-type/extended-types/field-path.type.js +0 -65
- package/cjs/document/data-type/extended-types/filter.type.js +0 -88
- package/cjs/document/data-type/extended-types/index.js +0 -16
- package/cjs/document/data-type/extended-types/object-id.type.js +0 -31
- package/cjs/document/data-type/extended-types/operation-result.type.js +0 -67
- package/cjs/document/data-type/extended-types/partial-date.type.js +0 -85
- package/cjs/document/data-type/extended-types/time.type.js +0 -55
- package/cjs/document/data-type/extended-types/url.type.js +0 -31
- package/cjs/document/data-type/extended-types/uuid.type.js +0 -37
- package/cjs/document/data-type/mapped-type.js +0 -120
- package/cjs/document/data-type/mixin-type.js +0 -123
- package/cjs/document/data-type/omit-type.js +0 -10
- package/cjs/document/data-type/partial-type.js +0 -12
- package/cjs/document/data-type/pick-type.js +0 -10
- package/cjs/document/data-type/primitive-types/any.type.js +0 -27
- package/cjs/document/data-type/primitive-types/bigint.type.js +0 -38
- package/cjs/document/data-type/primitive-types/boolean.type.js +0 -31
- package/cjs/document/data-type/primitive-types/index.js +0 -11
- package/cjs/document/data-type/primitive-types/integer.type.js +0 -38
- package/cjs/document/data-type/primitive-types/null.type.js +0 -31
- package/cjs/document/data-type/primitive-types/number.type.js +0 -50
- package/cjs/document/data-type/primitive-types/object.type.js +0 -20
- package/cjs/document/data-type/primitive-types/string.type.js +0 -70
- package/cjs/document/data-type/required-type.js +0 -12
- package/cjs/document/data-type/simple-type.js +0 -133
- package/cjs/document/data-type/union-type.js +0 -84
- package/cjs/document/data-type/utils/create-mapped-class.js +0 -56
- package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +0 -14
- package/cjs/document/decorators/api-field-decorator.js +0 -50
- package/cjs/document/decorators/complex-type.decorator.js +0 -31
- package/cjs/document/decorators/http-controller.decorator.js +0 -145
- package/cjs/document/decorators/http-operation-entity-create.decorator.js +0 -58
- package/cjs/document/decorators/http-operation-entity-delete-many.decorator.js +0 -41
- package/cjs/document/decorators/http-operation-entity-delete.decorator.js +0 -41
- package/cjs/document/decorators/http-operation-entity-find-many.decorator.js +0 -85
- package/cjs/document/decorators/http-operation-entity-get.decorator.js +0 -56
- package/cjs/document/decorators/http-operation-entity-replace.decorator.js +0 -56
- package/cjs/document/decorators/http-operation-entity-update-many.decorator.js +0 -50
- package/cjs/document/decorators/http-operation-entity-update.decorator.js +0 -66
- package/cjs/document/decorators/http-operation-entity.decorator.js +0 -143
- package/cjs/document/decorators/http-operation.decorator.js +0 -213
- package/cjs/document/decorators/mq-controller.decorator.js +0 -67
- package/cjs/document/decorators/mq-operation.decorator.js +0 -82
- package/cjs/document/decorators/simple-type.decorator.js +0 -67
- package/cjs/document/decorators/ws-controller.decorator.js +0 -51
- package/cjs/document/decorators/ws-operation.decorator.js +0 -42
- package/cjs/document/decorators/ws-param.decorator.js +0 -22
- package/cjs/document/factory/api-document.factory.js +0 -192
- package/cjs/document/factory/data-type.factory.js +0 -647
- package/cjs/document/factory/http-api.factory.js +0 -302
- package/cjs/document/factory/mq-api.factory.js +0 -203
- package/cjs/document/factory/ws-api.factory.js +0 -145
- package/cjs/document/http/http-api.js +0 -40
- package/cjs/document/http/http-controller.js +0 -159
- package/cjs/document/http/http-media-type.js +0 -104
- package/cjs/document/http/http-multipart-field.js +0 -32
- package/cjs/document/http/http-operation-response.js +0 -47
- package/cjs/document/http/http-operation.js +0 -126
- package/cjs/document/http/http-parameter.js +0 -57
- package/cjs/document/http/http-request-body.js +0 -27
- package/cjs/document/http/http-status-range.js +0 -45
- package/cjs/document/index.js +0 -70
- package/cjs/document/mq/mq-api.js +0 -54
- package/cjs/document/mq/mq-controller.js +0 -101
- package/cjs/document/mq/mq-header.js +0 -48
- package/cjs/document/mq/mq-operation-response.js +0 -66
- package/cjs/document/mq/mq-operation.js +0 -101
- package/cjs/document/utils/inspect.util.js +0 -7
- package/cjs/document/utils/parse-regexp.util.js +0 -21
- package/cjs/document/utils/string-compare.util.js +0 -10
- package/cjs/document/utils/test-scope-match.js +0 -15
- package/cjs/document/ws/ws-api.js +0 -52
- package/cjs/document/ws/ws-controller.js +0 -78
- package/cjs/document/ws/ws-operation.js +0 -64
- package/cjs/enums/http-headers-codes.enum.js +0 -411
- package/cjs/enums/http-status-codes.enum.js +0 -300
- package/cjs/enums/http-status-messages.js +0 -68
- package/cjs/enums/index.js +0 -7
- package/cjs/enums/mime-types.enum.js +0 -17
- package/cjs/exception/error-issue.js +0 -2
- package/cjs/exception/http-errors/bad-request.error.js +0 -23
- package/cjs/exception/http-errors/conflict.error.js +0 -22
- package/cjs/exception/http-errors/failed-dependency.error.js +0 -22
- package/cjs/exception/http-errors/forbidden.error.js +0 -25
- package/cjs/exception/http-errors/internal-server.error.js +0 -23
- package/cjs/exception/http-errors/method-not-allowed.error.js +0 -23
- package/cjs/exception/http-errors/not-acceptable.error.js +0 -23
- package/cjs/exception/http-errors/not-found.error.js +0 -26
- package/cjs/exception/http-errors/permission.error.js +0 -20
- package/cjs/exception/http-errors/resource-conflict.error.js +0 -19
- package/cjs/exception/http-errors/resource-not.available.error.js +0 -23
- package/cjs/exception/http-errors/unauthorized.error.js +0 -23
- package/cjs/exception/http-errors/unprocessable-entity.error.js +0 -23
- package/cjs/exception/index.js +0 -20
- package/cjs/exception/issue-severity.enum.js +0 -23
- package/cjs/exception/opra-exception.js +0 -70
- package/cjs/exception/opra-http-error.js +0 -25
- package/cjs/filter/antlr/OpraFilterLexer.js +0 -427
- package/cjs/filter/antlr/OpraFilterListener.js +0 -11
- package/cjs/filter/antlr/OpraFilterParser.js +0 -1851
- package/cjs/filter/antlr/OpraFilterVisitor.js +0 -14
- package/cjs/filter/ast/abstract/ast.js +0 -9
- package/cjs/filter/ast/abstract/expression.js +0 -7
- package/cjs/filter/ast/abstract/literal.js +0 -14
- package/cjs/filter/ast/abstract/term.js +0 -7
- package/cjs/filter/ast/expressions/arithmetic-expression.js +0 -29
- package/cjs/filter/ast/expressions/array-expression.js +0 -14
- package/cjs/filter/ast/expressions/comparison-expression.js +0 -15
- package/cjs/filter/ast/expressions/logical-expression.js +0 -18
- package/cjs/filter/ast/expressions/negative-expression.js +0 -14
- package/cjs/filter/ast/expressions/parenthesized-expression.js +0 -14
- package/cjs/filter/ast/index.js +0 -21
- package/cjs/filter/ast/terms/boolean-literal.js +0 -10
- package/cjs/filter/ast/terms/date-literal.js +0 -28
- package/cjs/filter/ast/terms/date-time-literal.js +0 -27
- package/cjs/filter/ast/terms/external-constant.js +0 -13
- package/cjs/filter/ast/terms/null-literal.js +0 -11
- package/cjs/filter/ast/terms/number-literal.js +0 -39
- package/cjs/filter/ast/terms/qualified-identifier.js +0 -10
- package/cjs/filter/ast/terms/string-literal.js +0 -14
- package/cjs/filter/ast/terms/time-literal.js +0 -34
- package/cjs/filter/build.js +0 -126
- package/cjs/filter/errors.js +0 -21
- package/cjs/filter/filter-rules.js +0 -150
- package/cjs/filter/filter-tree-visitor.js +0 -97
- package/cjs/filter/index.js +0 -5
- package/cjs/filter/opra-error-listener.js +0 -21
- package/cjs/filter/opra-filter.ns.js +0 -8
- package/cjs/filter/parse.js +0 -38
- package/cjs/filter/utils.js +0 -25
- package/cjs/helpers/function-utils.js +0 -15
- package/cjs/helpers/get-stack-filename.js +0 -51
- package/cjs/helpers/index.js +0 -12
- package/cjs/helpers/mixin-utils.js +0 -35
- package/cjs/helpers/object-utils.js +0 -19
- package/cjs/helpers/parse-fields-projection.js +0 -67
- package/cjs/helpers/responsive-map.js +0 -155
- package/cjs/helpers/safe-json-stringify.js +0 -16
- package/cjs/helpers/type-guards.js +0 -46
- package/cjs/i18n/i18n.js +0 -139
- package/cjs/i18n/index.js +0 -10
- package/cjs/i18n/string-utils.js +0 -12
- package/cjs/i18n/translate.js +0 -16
- package/cjs/index.js +0 -14
- package/cjs/package.json +0 -3
- package/cjs/polifils/array-find-last.js +0 -22
- package/cjs/schema/api-document.interface.js +0 -2
- package/cjs/schema/api.interface.js +0 -2
- package/cjs/schema/constants.js +0 -4
- package/cjs/schema/data-type/array-type.interface.js +0 -7
- package/cjs/schema/data-type/complex-type.interface.js +0 -7
- package/cjs/schema/data-type/data-type.interface.js +0 -2
- package/cjs/schema/data-type/enum-type.interface.js +0 -7
- package/cjs/schema/data-type/field.interface.js +0 -2
- package/cjs/schema/data-type/mapped-type.interface.js +0 -7
- package/cjs/schema/data-type/mixin-type.interface.js +0 -7
- package/cjs/schema/data-type/simple-type.interface.js +0 -7
- package/cjs/schema/data-type/union-type.interface.js +0 -7
- package/cjs/schema/data-type-container.interface.js +0 -2
- package/cjs/schema/http/http-api.interface.js +0 -2
- package/cjs/schema/http/http-controller.interface.js +0 -11
- package/cjs/schema/http/http-media-type.interface.js +0 -2
- package/cjs/schema/http/http-multipart-field.interface.js +0 -2
- package/cjs/schema/http/http-operation-response.interface.js +0 -2
- package/cjs/schema/http/http-operation.interface.js +0 -7
- package/cjs/schema/http/http-parameter.interface.js +0 -2
- package/cjs/schema/http/http-request-body.interface.js +0 -2
- package/cjs/schema/http/http-status-range.interface.js +0 -2
- package/cjs/schema/index.js +0 -6
- package/cjs/schema/mq/mq-api.interface.js +0 -2
- package/cjs/schema/mq/mq-controller.interface.js +0 -11
- package/cjs/schema/mq/mq-header.interface.js +0 -2
- package/cjs/schema/mq/mq-operation.interface.js +0 -7
- package/cjs/schema/opra-schema.js +0 -35
- package/cjs/schema/type-guards.js +0 -54
- package/cjs/schema/types.js +0 -2
- package/cjs/schema/value.interface.js +0 -2
- package/cjs/schema/ws/ws-api.interface.js +0 -2
- package/cjs/schema/ws/ws-controller.interface.js +0 -11
- package/cjs/schema/ws/ws-operation.interface.js +0 -7
- package/cjs/types.js +0 -2
- package/esm/filter/antlr/OpraFilterLexer.js +0 -425
- package/esm/filter/antlr/OpraFilterListener.js +0 -8
- package/esm/filter/antlr/OpraFilterVisitor.js +0 -11
- package/esm/helpers/monkey-patches.js +0 -14
- package/esm/package.json +0 -3
- package/types/document/decorators/ws-param.decorator.d.ts +0 -2
- package/types/index.d.cts +0 -9
- /package/{types/document → document}/api-document.d.ts +0 -0
- /package/{types/document → document}/common/api-base.d.ts +0 -0
- /package/{types/document → document}/common/data-type-map.d.ts +0 -0
- /package/{types/document → document}/common/document-element.d.ts +0 -0
- /package/{esm/document → document}/common/document-element.js +0 -0
- /package/{types/document → document}/common/document-init-context.d.ts +0 -0
- /package/{types/document → document}/common/document-node.d.ts +0 -0
- /package/{types/document → document}/common/opra-document-error.d.ts +0 -0
- /package/{types/document → document}/common/value.d.ts +0 -0
- /package/{types/document → document}/constants.d.ts +0 -0
- /package/{esm/document → document}/constants.js +0 -0
- /package/{types/document → document}/data-type/api-field.d.ts +0 -0
- /package/{esm/document → document}/data-type/array-type.js +0 -0
- /package/{types/document → document}/data-type/complex-type-base.d.ts +0 -0
- /package/{types/document → document}/data-type/complex-type.d.ts +0 -0
- /package/{types/document → document}/data-type/data-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/data-type.js +0 -0
- /package/{types/document → document}/data-type/enum-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/enum-type.js +0 -0
- /package/{types/document → document}/data-type/extended-types/base64.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/date-time-tz.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/date-time.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/date.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/email.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/field-path.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/filter.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/index.d.ts +0 -0
- /package/{esm/document → document}/data-type/extended-types/index.js +0 -0
- /package/{types/document → document}/data-type/extended-types/object-id.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/extended-types/object-id.type.js +0 -0
- /package/{types/document → document}/data-type/extended-types/operation-result.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/extended-types/operation-result.type.js +0 -0
- /package/{types/document → document}/data-type/extended-types/partial-date.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/time.type.d.ts +0 -0
- /package/{types/document → document}/data-type/extended-types/url.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/extended-types/url.type.js +0 -0
- /package/{types/document → document}/data-type/extended-types/uuid.type.d.ts +0 -0
- /package/{types/document → document}/data-type/mapped-type.d.ts +0 -0
- /package/{types/document → document}/data-type/mixin-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/mixin-type.js +0 -0
- /package/{types/document → document}/data-type/omit-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/omit-type.js +0 -0
- /package/{types/document → document}/data-type/partial-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/partial-type.js +0 -0
- /package/{types/document → document}/data-type/pick-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/pick-type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/any.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/any.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/bigint.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/bigint.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/boolean.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/boolean.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/index.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/index.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/integer.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/integer.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/null.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/null.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/number.type.d.ts +0 -0
- /package/{types/document → document}/data-type/primitive-types/object.type.d.ts +0 -0
- /package/{esm/document → document}/data-type/primitive-types/object.type.js +0 -0
- /package/{types/document → document}/data-type/primitive-types/string.type.d.ts +0 -0
- /package/{types/document → document}/data-type/required-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/required-type.js +0 -0
- /package/{types/document → document}/data-type/simple-type.d.ts +0 -0
- /package/{types/document → document}/data-type/union-type.d.ts +0 -0
- /package/{esm/document → document}/data-type/union-type.js +0 -0
- /package/{types/document → document}/data-type/utils/create-mapped-class.d.ts +0 -0
- /package/{esm/document → document}/data-type/utils/create-mapped-class.js +0 -0
- /package/{types/document → document}/data-type/utils/get-is-inherited-predicate-fn.d.ts +0 -0
- /package/{esm/document → document}/data-type/utils/get-is-inherited-predicate-fn.js +0 -0
- /package/{types/document → document}/decorators/api-field-decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/api-field-decorator.js +0 -0
- /package/{types/document → document}/decorators/complex-type.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/complex-type.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-controller.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-controller.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-create.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-create.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-delete-many.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-delete-many.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-delete.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-delete.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-find-many.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-find-many.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-get.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-get.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-replace.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-replace.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-update-many.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-update-many.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity-update.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity-update.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation-entity.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation-entity.decorator.js +0 -0
- /package/{types/document → document}/decorators/http-operation.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/http-operation.decorator.js +0 -0
- /package/{types/document → document}/decorators/mq-controller.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/mq-controller.decorator.js +0 -0
- /package/{types/document → document}/decorators/mq-operation.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/mq-operation.decorator.js +0 -0
- /package/{types/document → document}/decorators/simple-type.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/simple-type.decorator.js +0 -0
- /package/{types/document → document}/decorators/ws-controller.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/ws-controller.decorator.js +0 -0
- /package/{types/document → document}/decorators/ws-operation.decorator.d.ts +0 -0
- /package/{esm/document → document}/decorators/ws-operation.decorator.js +0 -0
- /package/{types/document → document}/factory/api-document.factory.d.ts +0 -0
- /package/{types/document → document}/factory/data-type.factory.d.ts +0 -0
- /package/{esm/document → document}/factory/data-type.factory.js +0 -0
- /package/{types/document → document}/factory/http-api.factory.d.ts +0 -0
- /package/{esm/document → document}/factory/http-api.factory.js +0 -0
- /package/{types/document → document}/factory/mq-api.factory.d.ts +0 -0
- /package/{esm/document → document}/factory/mq-api.factory.js +0 -0
- /package/{types/document → document}/factory/ws-api.factory.d.ts +0 -0
- /package/{types/document → document}/http/http-api.d.ts +0 -0
- /package/{types/document → document}/http/http-controller.d.ts +0 -0
- /package/{esm/document → document}/http/http-controller.js +0 -0
- /package/{types/document → document}/http/http-media-type.d.ts +0 -0
- /package/{esm/document → document}/http/http-media-type.js +0 -0
- /package/{types/document → document}/http/http-multipart-field.d.ts +0 -0
- /package/{types/document → document}/http/http-operation-response.d.ts +0 -0
- /package/{types/document → document}/http/http-operation.d.ts +0 -0
- /package/{esm/document → document}/http/http-operation.js +0 -0
- /package/{types/document → document}/http/http-parameter.d.ts +0 -0
- /package/{esm/document → document}/http/http-parameter.js +0 -0
- /package/{types/document → document}/http/http-request-body.d.ts +0 -0
- /package/{types/document → document}/http/http-status-range.d.ts +0 -0
- /package/{types/document → document}/index.d.ts +0 -0
- /package/{esm/document → document}/index.js +0 -0
- /package/{types/document → document}/mq/mq-api.d.ts +0 -0
- /package/{types/document → document}/mq/mq-controller.d.ts +0 -0
- /package/{esm/document → document}/mq/mq-controller.js +0 -0
- /package/{types/document → document}/mq/mq-header.d.ts +0 -0
- /package/{esm/document → document}/mq/mq-header.js +0 -0
- /package/{types/document → document}/mq/mq-operation-response.d.ts +0 -0
- /package/{types/document → document}/mq/mq-operation.d.ts +0 -0
- /package/{esm/document → document}/mq/mq-operation.js +0 -0
- /package/{types/document → document}/utils/inspect.util.d.ts +0 -0
- /package/{esm/document → document}/utils/inspect.util.js +0 -0
- /package/{types/document → document}/utils/parse-regexp.util.d.ts +0 -0
- /package/{esm/document → document}/utils/parse-regexp.util.js +0 -0
- /package/{types/document → document}/utils/string-compare.util.d.ts +0 -0
- /package/{esm/document → document}/utils/string-compare.util.js +0 -0
- /package/{types/document → document}/utils/test-scope-match.d.ts +0 -0
- /package/{esm/document → document}/utils/test-scope-match.js +0 -0
- /package/{types/document → document}/ws/ws-api.d.ts +0 -0
- /package/{types/document → document}/ws/ws-controller.d.ts +0 -0
- /package/{esm/document → document}/ws/ws-controller.js +0 -0
- /package/{types/enums → enums}/http-headers-codes.enum.d.ts +0 -0
- /package/{esm/enums → enums}/http-headers-codes.enum.js +0 -0
- /package/{types/enums → enums}/http-status-codes.enum.d.ts +0 -0
- /package/{esm/enums → enums}/http-status-codes.enum.js +0 -0
- /package/{types/enums → enums}/http-status-messages.d.ts +0 -0
- /package/{esm/enums → enums}/http-status-messages.js +0 -0
- /package/{types/enums → enums}/index.d.ts +0 -0
- /package/{esm/enums → enums}/index.js +0 -0
- /package/{types/enums → enums}/mime-types.enum.d.ts +0 -0
- /package/{esm/enums → enums}/mime-types.enum.js +0 -0
- /package/{types/exception → exception}/error-issue.d.ts +0 -0
- /package/{esm/exception → exception}/error-issue.js +0 -0
- /package/{types/exception → exception}/http-errors/bad-request.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/conflict.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/failed-dependency.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/forbidden.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/internal-server.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/method-not-allowed.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/not-acceptable.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/not-found.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/permission.error.d.ts +0 -0
- /package/{esm/exception → exception}/http-errors/permission.error.js +0 -0
- /package/{types/exception → exception}/http-errors/resource-conflict.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/resource-not.available.error.d.ts +0 -0
- /package/{esm/exception → exception}/http-errors/resource-not.available.error.js +0 -0
- /package/{types/exception → exception}/http-errors/unauthorized.error.d.ts +0 -0
- /package/{types/exception → exception}/http-errors/unprocessable-entity.error.d.ts +0 -0
- /package/{types/exception → exception}/index.d.ts +0 -0
- /package/{esm/exception → exception}/index.js +0 -0
- /package/{types/exception → exception}/issue-severity.enum.d.ts +0 -0
- /package/{esm/exception → exception}/issue-severity.enum.js +0 -0
- /package/{types/exception → exception}/opra-exception.d.ts +0 -0
- /package/{types/exception → exception}/opra-http-error.d.ts +0 -0
- /package/{types/filter → filter}/antlr/OpraFilterLexer.d.ts +0 -0
- /package/{types/filter → filter}/antlr/OpraFilterListener.d.ts +0 -0
- /package/{types/filter → filter}/antlr/OpraFilterParser.d.ts +0 -0
- /package/{types/filter → filter}/antlr/OpraFilterVisitor.d.ts +0 -0
- /package/{types/filter → filter}/ast/abstract/ast.d.ts +0 -0
- /package/{types/filter → filter}/ast/abstract/expression.d.ts +0 -0
- /package/{esm/filter → filter}/ast/abstract/expression.js +0 -0
- /package/{types/filter → filter}/ast/abstract/literal.d.ts +0 -0
- /package/{esm/filter → filter}/ast/abstract/literal.js +0 -0
- /package/{types/filter → filter}/ast/abstract/term.d.ts +0 -0
- /package/{esm/filter → filter}/ast/abstract/term.js +0 -0
- /package/{types/filter → filter}/ast/expressions/arithmetic-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/expressions/array-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/expressions/comparison-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/expressions/logical-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/expressions/negative-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/expressions/parenthesized-expression.d.ts +0 -0
- /package/{types/filter → filter}/ast/index.d.ts +0 -0
- /package/{esm/filter → filter}/ast/index.js +0 -0
- /package/{types/filter → filter}/ast/terms/boolean-literal.d.ts +0 -0
- /package/{esm/filter → filter}/ast/terms/boolean-literal.js +0 -0
- /package/{types/filter → filter}/ast/terms/date-literal.d.ts +0 -0
- /package/{types/filter → filter}/ast/terms/date-time-literal.d.ts +0 -0
- /package/{types/filter → filter}/ast/terms/external-constant.d.ts +0 -0
- /package/{esm/filter → filter}/ast/terms/external-constant.js +0 -0
- /package/{types/filter → filter}/ast/terms/null-literal.d.ts +0 -0
- /package/{types/filter → filter}/ast/terms/number-literal.d.ts +0 -0
- /package/{types/filter → filter}/ast/terms/qualified-identifier.d.ts +0 -0
- /package/{esm/filter → filter}/ast/terms/qualified-identifier.js +0 -0
- /package/{types/filter → filter}/ast/terms/string-literal.d.ts +0 -0
- /package/{esm/filter → filter}/ast/terms/string-literal.js +0 -0
- /package/{types/filter → filter}/ast/terms/time-literal.d.ts +0 -0
- /package/{types/filter → filter}/build.d.ts +0 -0
- /package/{esm/filter → filter}/build.js +0 -0
- /package/{types/filter → filter}/errors.d.ts +0 -0
- /package/{esm/filter → filter}/errors.js +0 -0
- /package/{types/filter → filter}/filter-rules.d.ts +0 -0
- /package/{types/filter → filter}/filter-tree-visitor.d.ts +0 -0
- /package/{types/filter → filter}/index.d.ts +0 -0
- /package/{esm/filter → filter}/index.js +0 -0
- /package/{types/filter → filter}/opra-error-listener.d.ts +0 -0
- /package/{types/filter → filter}/opra-filter.ns.d.ts +0 -0
- /package/{esm/filter → filter}/opra-filter.ns.js +0 -0
- /package/{types/filter → filter}/parse.d.ts +0 -0
- /package/{esm/filter → filter}/parse.js +0 -0
- /package/{types/filter → filter}/utils.d.ts +0 -0
- /package/{esm/filter → filter}/utils.js +0 -0
- /package/{types/helpers → helpers}/function-utils.d.ts +0 -0
- /package/{esm/helpers → helpers}/function-utils.js +0 -0
- /package/{types/helpers → helpers}/get-stack-filename.d.ts +0 -0
- /package/{esm/helpers → helpers}/get-stack-filename.js +0 -0
- /package/{types/helpers → helpers}/index.d.ts +0 -0
- /package/{esm/helpers → helpers}/index.js +0 -0
- /package/{types/helpers → helpers}/mixin-utils.d.ts +0 -0
- /package/{esm/helpers → helpers}/mixin-utils.js +0 -0
- /package/{types/helpers → helpers}/monkey-patches.d.ts +0 -0
- /package/{cjs/helpers → helpers}/monkey-patches.js +0 -0
- /package/{types/helpers → helpers}/object-utils.d.ts +0 -0
- /package/{esm/helpers → helpers}/object-utils.js +0 -0
- /package/{types/helpers → helpers}/parse-fields-projection.d.ts +0 -0
- /package/{types/helpers → helpers}/responsive-map.d.ts +0 -0
- /package/{esm/helpers → helpers}/responsive-map.js +0 -0
- /package/{types/helpers → helpers}/safe-json-stringify.d.ts +0 -0
- /package/{esm/helpers → helpers}/safe-json-stringify.js +0 -0
- /package/{types/helpers → helpers}/type-guards.d.ts +0 -0
- /package/{esm/helpers → helpers}/type-guards.js +0 -0
- /package/{types/i18n → i18n}/i18n.d.ts +0 -0
- /package/{esm/i18n → i18n}/i18n.js +0 -0
- /package/{types/i18n → i18n}/index.d.ts +0 -0
- /package/{esm/i18n → i18n}/index.js +0 -0
- /package/{types/i18n → i18n}/string-utils.d.ts +0 -0
- /package/{esm/i18n → i18n}/string-utils.js +0 -0
- /package/{types/i18n → i18n}/translate.d.ts +0 -0
- /package/{esm/i18n → i18n}/translate.js +0 -0
- /package/{types/index.d.ts → index.d.ts} +0 -0
- /package/{esm/index.js → index.js} +0 -0
- /package/{types/polifils → polifils}/array-find-last.d.ts +0 -0
- /package/{esm/polifils → polifils}/array-find-last.js +0 -0
- /package/{types/schema → schema}/api-document.interface.d.ts +0 -0
- /package/{esm/schema → schema}/api-document.interface.js +0 -0
- /package/{types/schema → schema}/api.interface.d.ts +0 -0
- /package/{esm/schema → schema}/api.interface.js +0 -0
- /package/{types/schema → schema}/constants.d.ts +0 -0
- /package/{esm/schema → schema}/constants.js +0 -0
- /package/{types/schema → schema}/data-type/array-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/array-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/complex-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/complex-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/data-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/data-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/enum-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/enum-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/field.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/field.interface.js +0 -0
- /package/{types/schema → schema}/data-type/mapped-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/mapped-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/mixin-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/mixin-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/simple-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/simple-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type/union-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type/union-type.interface.js +0 -0
- /package/{types/schema → schema}/data-type-container.interface.d.ts +0 -0
- /package/{esm/schema → schema}/data-type-container.interface.js +0 -0
- /package/{types/schema → schema}/http/http-api.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-api.interface.js +0 -0
- /package/{types/schema → schema}/http/http-controller.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-controller.interface.js +0 -0
- /package/{types/schema → schema}/http/http-media-type.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-media-type.interface.js +0 -0
- /package/{types/schema → schema}/http/http-multipart-field.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-multipart-field.interface.js +0 -0
- /package/{types/schema → schema}/http/http-operation-response.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-operation-response.interface.js +0 -0
- /package/{types/schema → schema}/http/http-operation.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-operation.interface.js +0 -0
- /package/{types/schema → schema}/http/http-parameter.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-parameter.interface.js +0 -0
- /package/{types/schema → schema}/http/http-request-body.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-request-body.interface.js +0 -0
- /package/{types/schema → schema}/http/http-status-range.interface.d.ts +0 -0
- /package/{esm/schema → schema}/http/http-status-range.interface.js +0 -0
- /package/{types/schema → schema}/index.d.ts +0 -0
- /package/{esm/schema → schema}/index.js +0 -0
- /package/{types/schema → schema}/mq/mq-api.interface.d.ts +0 -0
- /package/{esm/schema → schema}/mq/mq-api.interface.js +0 -0
- /package/{types/schema → schema}/mq/mq-controller.interface.d.ts +0 -0
- /package/{esm/schema → schema}/mq/mq-controller.interface.js +0 -0
- /package/{types/schema → schema}/mq/mq-header.interface.d.ts +0 -0
- /package/{esm/schema → schema}/mq/mq-header.interface.js +0 -0
- /package/{types/schema → schema}/mq/mq-operation.interface.d.ts +0 -0
- /package/{esm/schema → schema}/mq/mq-operation.interface.js +0 -0
- /package/{types/schema → schema}/opra-schema.d.ts +0 -0
- /package/{esm/schema → schema}/opra-schema.js +0 -0
- /package/{types/schema → schema}/type-guards.d.ts +0 -0
- /package/{esm/schema → schema}/type-guards.js +0 -0
- /package/{types/schema → schema}/types.d.ts +0 -0
- /package/{esm/schema → schema}/types.js +0 -0
- /package/{types/schema → schema}/value.interface.d.ts +0 -0
- /package/{esm/schema → schema}/value.interface.js +0 -0
- /package/{esm/schema → schema}/ws/ws-api.interface.js +0 -0
- /package/{types/schema → schema}/ws/ws-controller.interface.d.ts +0 -0
- /package/{esm/schema → schema}/ws/ws-controller.interface.js +0 -0
- /package/{types/schema → schema}/ws/ws-operation.interface.d.ts +0 -0
- /package/{esm/schema → schema}/ws/ws-operation.interface.js +0 -0
- /package/{types/types.d.ts → types.d.ts} +0 -0
- /package/{esm/types.js → types.js} +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const index_js_1 = require("../../enums/index.js");
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
-
const http_operation_js_1 = require("../http/http-operation.js");
|
|
7
|
-
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
8
|
-
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
9
|
-
/**
|
|
10
|
-
* HttpOperation.Entity.Update
|
|
11
|
-
*/
|
|
12
|
-
http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
13
|
-
let args;
|
|
14
|
-
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
15
|
-
args = arg0;
|
|
16
|
-
}
|
|
17
|
-
else
|
|
18
|
-
args = { ...arg1, type: arg0 };
|
|
19
|
-
/** Initialize the decorator and the chain */
|
|
20
|
-
const decoratorChain = [];
|
|
21
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
22
|
-
method: 'PATCH',
|
|
23
|
-
...args,
|
|
24
|
-
composition: 'Entity.Update',
|
|
25
|
-
requestBody: {
|
|
26
|
-
partial: 'deep',
|
|
27
|
-
immediateFetch: true,
|
|
28
|
-
allowPatchOperators: true,
|
|
29
|
-
keepKeyFields: true,
|
|
30
|
-
...args.requestBody,
|
|
31
|
-
required: true,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
decorator
|
|
35
|
-
.QueryParam('projection', {
|
|
36
|
-
description: 'Determines fields projection',
|
|
37
|
-
type: new index_js_2.FieldPathType({
|
|
38
|
-
dataType: args.type,
|
|
39
|
-
allowSigns: 'each',
|
|
40
|
-
}),
|
|
41
|
-
isArray: true,
|
|
42
|
-
arraySeparator: ',',
|
|
43
|
-
})
|
|
44
|
-
.RequestContent(args.requestBody?.type || args.type)
|
|
45
|
-
.Response(index_js_1.HttpStatusCode.OK, {
|
|
46
|
-
description: 'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',
|
|
47
|
-
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
48
|
-
type: args.type,
|
|
49
|
-
partial: 'deep',
|
|
50
|
-
})
|
|
51
|
-
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
52
|
-
description: 'Operation is successful but no resource found',
|
|
53
|
-
})
|
|
54
|
-
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
55
|
-
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
56
|
-
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
57
|
-
});
|
|
58
|
-
decoratorChain.push((operationMeta) => {
|
|
59
|
-
const compositionOptions = (operationMeta.compositionOptions =
|
|
60
|
-
operationMeta.compositionOptions || {});
|
|
61
|
-
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
62
|
-
});
|
|
63
|
-
decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain);
|
|
64
|
-
decorator.Filter = (0, http_operation_entity_decorator_js_1.createFilterDecorator)(decorator, decoratorChain, args.type);
|
|
65
|
-
return decorator;
|
|
66
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDataTypeName = getDataTypeName;
|
|
4
|
-
exports.createKeyParamDecorator = createKeyParamDecorator;
|
|
5
|
-
exports.createSortFieldsDecorator = createSortFieldsDecorator;
|
|
6
|
-
exports.createFilterDecorator = createFilterDecorator;
|
|
7
|
-
const filter_rules_js_1 = require("../../filter/filter-rules.js");
|
|
8
|
-
const constants_js_1 = require("../constants.js");
|
|
9
|
-
const complex_type_base_js_1 = require("../data-type/complex-type-base.js");
|
|
10
|
-
const enum_type_js_1 = require("../data-type/enum-type.js");
|
|
11
|
-
const index_js_1 = require("../data-type/extended-types/index.js");
|
|
12
|
-
const http_operation_js_1 = require("../http/http-operation.js");
|
|
13
|
-
/** Implementation **/
|
|
14
|
-
http_operation_js_1.HttpOperation.Entity = {};
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @param typ
|
|
18
|
-
*/
|
|
19
|
-
function getDataTypeName(typ) {
|
|
20
|
-
if (typeof typ === 'string')
|
|
21
|
-
return typ;
|
|
22
|
-
const metadata = Reflect.getMetadata(constants_js_1.DATATYPE_METADATA, typ);
|
|
23
|
-
if (!metadata)
|
|
24
|
-
throw new TypeError(`Type (${typ}) is not decorated with any datatype decorators`);
|
|
25
|
-
if (metadata?.name)
|
|
26
|
-
return metadata.name;
|
|
27
|
-
throw new TypeError(`You should provide named data type but embedded one found`);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
function createKeyParamDecorator(decorator, decoratorChain) {
|
|
33
|
-
return (name, prmOptions) => {
|
|
34
|
-
const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
|
|
35
|
-
? {
|
|
36
|
-
name,
|
|
37
|
-
location: 'path',
|
|
38
|
-
type: prmOptions,
|
|
39
|
-
keyParam: true,
|
|
40
|
-
}
|
|
41
|
-
: {
|
|
42
|
-
...prmOptions,
|
|
43
|
-
name,
|
|
44
|
-
location: 'path',
|
|
45
|
-
keyParam: true,
|
|
46
|
-
};
|
|
47
|
-
decorator.PathParam(name, paramMeta);
|
|
48
|
-
decoratorChain.push((meta) => {
|
|
49
|
-
if (!meta.path?.includes(':' + name))
|
|
50
|
-
meta.path = (meta.path || '') + '@:' + name;
|
|
51
|
-
meta.mergePath = true;
|
|
52
|
-
});
|
|
53
|
-
return decorator;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
function createSortFieldsDecorator(decorator, decoratorChain) {
|
|
60
|
-
return (...varargs) => {
|
|
61
|
-
const defObj = typeof varargs[0] === 'object'
|
|
62
|
-
? varargs[0]
|
|
63
|
-
: varargs.reduce((acc, k) => {
|
|
64
|
-
const a = k.split(':');
|
|
65
|
-
acc[a[0]] = a[1] || a[0];
|
|
66
|
-
return acc;
|
|
67
|
-
}, {});
|
|
68
|
-
const fieldsMap = Object.keys(defObj).reduce((acc, k) => {
|
|
69
|
-
const m1 = complex_type_base_js_1.FIELD_PATH_PATTERN.exec(k);
|
|
70
|
-
const m2 = complex_type_base_js_1.FIELD_PATH_PATTERN.exec(defObj[k]);
|
|
71
|
-
if (m1 && m2) {
|
|
72
|
-
acc[m1[2]] = m2[2];
|
|
73
|
-
}
|
|
74
|
-
return acc;
|
|
75
|
-
}, {});
|
|
76
|
-
const prmEnum = Object.keys(defObj).reduce((acc, k) => {
|
|
77
|
-
const m = complex_type_base_js_1.FIELD_PATH_PATTERN.exec(k);
|
|
78
|
-
if (m) {
|
|
79
|
-
if (m[1] != '-')
|
|
80
|
-
acc[m[2]] = m[2];
|
|
81
|
-
if (m[1] != '+')
|
|
82
|
-
acc['-' + m[2]] = '-' + m[2];
|
|
83
|
-
}
|
|
84
|
-
return acc;
|
|
85
|
-
}, {});
|
|
86
|
-
decoratorChain.push((operationMeta) => {
|
|
87
|
-
const compositionOptions = (operationMeta.compositionOptions =
|
|
88
|
-
operationMeta.compositionOptions || {});
|
|
89
|
-
compositionOptions.sortFields = fieldsMap;
|
|
90
|
-
});
|
|
91
|
-
decorator.QueryParam('sort', {
|
|
92
|
-
description: 'Determines sort fields',
|
|
93
|
-
type: (0, enum_type_js_1.EnumType)(prmEnum),
|
|
94
|
-
isArray: true,
|
|
95
|
-
arraySeparator: ',',
|
|
96
|
-
parser: (v) => v.map(x => {
|
|
97
|
-
const m = complex_type_base_js_1.FIELD_PATH_PATTERN.exec(x);
|
|
98
|
-
return m ? (m[1] || '') + fieldsMap[m[2]] : x;
|
|
99
|
-
}),
|
|
100
|
-
});
|
|
101
|
-
return decorator;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
function createFilterDecorator(decorator, decoratorChain, dataType) {
|
|
108
|
-
let filterRules = Reflect.getMetadata('FilterRules', decorator);
|
|
109
|
-
if (!filterRules) {
|
|
110
|
-
filterRules = new filter_rules_js_1.FilterRules();
|
|
111
|
-
Reflect.defineMetadata('FilterRules', filterRules, decorator);
|
|
112
|
-
}
|
|
113
|
-
let filterType = Reflect.getMetadata('FilterType', decorator);
|
|
114
|
-
if (!filterType) {
|
|
115
|
-
filterType = new index_js_1.FilterType({ dataType });
|
|
116
|
-
filterType.rules = {};
|
|
117
|
-
Reflect.defineMetadata('FilterType', filterType, decorator);
|
|
118
|
-
}
|
|
119
|
-
return (field, arg0) => {
|
|
120
|
-
const filterOptions = (Array.isArray(arg0)
|
|
121
|
-
? { operators: arg0 }
|
|
122
|
-
: typeof arg0 === 'string'
|
|
123
|
-
? {
|
|
124
|
-
operators: arg0.split(/\s*,\s*/),
|
|
125
|
-
}
|
|
126
|
-
: arg0) || {};
|
|
127
|
-
filterOptions.operators = filterOptions.operators || ['=', '!='];
|
|
128
|
-
if (field.includes(':')) {
|
|
129
|
-
const a = field.split(':');
|
|
130
|
-
field = a[0];
|
|
131
|
-
filterOptions.mappedField = a[1];
|
|
132
|
-
}
|
|
133
|
-
decoratorChain.push(() => {
|
|
134
|
-
filterRules.set(field, filterOptions);
|
|
135
|
-
filterType.rules = filterRules.toJSON();
|
|
136
|
-
});
|
|
137
|
-
decorator.QueryParam('filter', {
|
|
138
|
-
type: filterType,
|
|
139
|
-
description: 'Determines filter fields',
|
|
140
|
-
});
|
|
141
|
-
return decorator;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpOperationDecoratorFactory = HttpOperationDecoratorFactory;
|
|
4
|
-
const objects_1 = require("@jsopen/objects");
|
|
5
|
-
const index_js_1 = require("../../enums/index.js");
|
|
6
|
-
const index_js_2 = require("../../schema/index.js");
|
|
7
|
-
const constants_js_1 = require("../constants.js");
|
|
8
|
-
function HttpOperationDecoratorFactory(decoratorChain, options) {
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
const decorator = ((target, propertyKey) => {
|
|
13
|
-
if (typeof propertyKey !== 'string')
|
|
14
|
-
throw new TypeError(`Symbol properties can not be decorated`);
|
|
15
|
-
const operationMetadata = {
|
|
16
|
-
...options,
|
|
17
|
-
kind: index_js_2.OpraSchema.HttpOperation.Kind,
|
|
18
|
-
};
|
|
19
|
-
const controllerMetadata = (Reflect.getOwnMetadata(constants_js_1.HTTP_CONTROLLER_METADATA, target.constructor) || {});
|
|
20
|
-
controllerMetadata.operations = controllerMetadata.operations || {};
|
|
21
|
-
controllerMetadata.operations[propertyKey] = operationMetadata;
|
|
22
|
-
for (const fn of decoratorChain)
|
|
23
|
-
fn(operationMetadata);
|
|
24
|
-
Reflect.defineMetadata(constants_js_1.HTTP_CONTROLLER_METADATA, controllerMetadata, target.constructor);
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
decorator.Cookie = (name, arg1) => {
|
|
30
|
-
decoratorChain.push((meta) => {
|
|
31
|
-
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
32
|
-
? {
|
|
33
|
-
name,
|
|
34
|
-
location: 'cookie',
|
|
35
|
-
type: arg1,
|
|
36
|
-
}
|
|
37
|
-
: { ...arg1, name, location: 'cookie' };
|
|
38
|
-
if ((0, objects_1.isConstructor)(paramMeta.type))
|
|
39
|
-
paramMeta.designType = paramMeta.type;
|
|
40
|
-
if (meta.parameters) {
|
|
41
|
-
meta.parameters = meta.parameters.filter(p => !(p.location === 'cookie' && String(p.name) === String(name)));
|
|
42
|
-
}
|
|
43
|
-
else
|
|
44
|
-
meta.parameters = [];
|
|
45
|
-
meta.parameters.push(paramMeta);
|
|
46
|
-
});
|
|
47
|
-
return decorator;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
decorator.Header = (name, arg1) => {
|
|
53
|
-
decoratorChain.push((meta) => {
|
|
54
|
-
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
55
|
-
? {
|
|
56
|
-
name,
|
|
57
|
-
location: 'header',
|
|
58
|
-
type: arg1,
|
|
59
|
-
}
|
|
60
|
-
: { ...arg1, name, location: 'header' };
|
|
61
|
-
if ((0, objects_1.isConstructor)(paramMeta.type))
|
|
62
|
-
paramMeta.designType = paramMeta.type;
|
|
63
|
-
if (meta.parameters) {
|
|
64
|
-
meta.parameters = meta.parameters.filter(p => !(p.location === 'header' && String(p.name) === String(name)));
|
|
65
|
-
}
|
|
66
|
-
else
|
|
67
|
-
meta.parameters = [];
|
|
68
|
-
meta.parameters.push(paramMeta);
|
|
69
|
-
});
|
|
70
|
-
return decorator;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
decorator.QueryParam = (name, arg1) => {
|
|
76
|
-
decoratorChain.push((meta) => {
|
|
77
|
-
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
78
|
-
? {
|
|
79
|
-
name,
|
|
80
|
-
location: 'query',
|
|
81
|
-
type: arg1,
|
|
82
|
-
}
|
|
83
|
-
: { ...arg1, name, location: 'query' };
|
|
84
|
-
if ((0, objects_1.isConstructor)(paramMeta.type))
|
|
85
|
-
paramMeta.designType = paramMeta.type;
|
|
86
|
-
if (meta.parameters) {
|
|
87
|
-
meta.parameters = meta.parameters.filter(p => !(p.location === 'query' && String(p.name) === String(name)));
|
|
88
|
-
}
|
|
89
|
-
else
|
|
90
|
-
meta.parameters = [];
|
|
91
|
-
meta.parameters.push(paramMeta);
|
|
92
|
-
});
|
|
93
|
-
return decorator;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
*/
|
|
98
|
-
decorator.PathParam = (name, arg1) => {
|
|
99
|
-
decoratorChain.push((meta) => {
|
|
100
|
-
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
101
|
-
? {
|
|
102
|
-
name,
|
|
103
|
-
location: 'path',
|
|
104
|
-
type: arg1,
|
|
105
|
-
}
|
|
106
|
-
: { ...arg1, name, location: 'path' };
|
|
107
|
-
if ((0, objects_1.isConstructor)(paramMeta.type))
|
|
108
|
-
paramMeta.designType = paramMeta.type;
|
|
109
|
-
if (meta.parameters) {
|
|
110
|
-
meta.parameters = meta.parameters.filter(p => !(p.location === 'path' && String(p.name) === String(name)));
|
|
111
|
-
}
|
|
112
|
-
else
|
|
113
|
-
meta.parameters = [];
|
|
114
|
-
meta.parameters.push(paramMeta);
|
|
115
|
-
});
|
|
116
|
-
return decorator;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
120
|
-
*/
|
|
121
|
-
decorator.Response = (statusCode, responseOptions) => {
|
|
122
|
-
const responseMeta = {
|
|
123
|
-
...responseOptions,
|
|
124
|
-
statusCode,
|
|
125
|
-
};
|
|
126
|
-
if (responseMeta.type) {
|
|
127
|
-
responseMeta.contentType =
|
|
128
|
-
responseMeta.contentType || index_js_1.MimeTypes.opra_response_json;
|
|
129
|
-
responseMeta.contentEncoding = responseMeta.contentEncoding || 'utf-8';
|
|
130
|
-
}
|
|
131
|
-
if (responseMeta.contentType === index_js_1.MimeTypes.opra_response_json) {
|
|
132
|
-
responseMeta.contentEncoding = responseMeta.contentEncoding || 'utf-8';
|
|
133
|
-
}
|
|
134
|
-
if ((0, objects_1.isConstructor)(responseMeta.type))
|
|
135
|
-
responseMeta.designType = responseMeta.type;
|
|
136
|
-
decoratorChain.push((meta) => {
|
|
137
|
-
meta.responses = meta.responses || [];
|
|
138
|
-
meta.responses.push(responseMeta);
|
|
139
|
-
});
|
|
140
|
-
return decorator;
|
|
141
|
-
};
|
|
142
|
-
decorator.RequestContent = function (arg0) {
|
|
143
|
-
const contentMeta = typeof arg0 === 'object' ? arg0 : { type: arg0 };
|
|
144
|
-
if (contentMeta.type) {
|
|
145
|
-
contentMeta.contentType = contentMeta.contentType || index_js_1.MimeTypes.json;
|
|
146
|
-
contentMeta.contentEncoding = contentMeta.contentEncoding || 'utf-8';
|
|
147
|
-
if ((0, objects_1.isConstructor)(contentMeta.type))
|
|
148
|
-
contentMeta.designType = contentMeta.type;
|
|
149
|
-
}
|
|
150
|
-
decoratorChain.push((operationMetadata) => {
|
|
151
|
-
operationMetadata.requestBody = operationMetadata.requestBody || {
|
|
152
|
-
required: true,
|
|
153
|
-
content: [],
|
|
154
|
-
};
|
|
155
|
-
operationMetadata.requestBody.content =
|
|
156
|
-
operationMetadata.requestBody.content || [];
|
|
157
|
-
operationMetadata.requestBody.content.push(contentMeta);
|
|
158
|
-
});
|
|
159
|
-
return decorator;
|
|
160
|
-
};
|
|
161
|
-
decorator.MultipartContent = function (contentOpts, subInit) {
|
|
162
|
-
const contentMetadata = {
|
|
163
|
-
...contentOpts,
|
|
164
|
-
contentType: contentOpts?.contentType || 'multipart/form-data',
|
|
165
|
-
};
|
|
166
|
-
decoratorChain.push((operationMetadata) => {
|
|
167
|
-
operationMetadata.requestBody = operationMetadata.requestBody || {
|
|
168
|
-
required: true,
|
|
169
|
-
content: [],
|
|
170
|
-
};
|
|
171
|
-
operationMetadata.requestBody.content =
|
|
172
|
-
operationMetadata.requestBody.content || [];
|
|
173
|
-
operationMetadata.requestBody.content.push(contentMetadata);
|
|
174
|
-
});
|
|
175
|
-
if (subInit) {
|
|
176
|
-
const configScope = {
|
|
177
|
-
Field(fieldName, opts) {
|
|
178
|
-
contentMetadata.multipartFields =
|
|
179
|
-
contentMetadata.multipartFields || [];
|
|
180
|
-
contentMetadata.multipartFields.push({
|
|
181
|
-
fieldName,
|
|
182
|
-
fieldType: 'field',
|
|
183
|
-
...opts,
|
|
184
|
-
});
|
|
185
|
-
return configScope;
|
|
186
|
-
},
|
|
187
|
-
File(fieldName, opts) {
|
|
188
|
-
contentMetadata.multipartFields =
|
|
189
|
-
contentMetadata.multipartFields || [];
|
|
190
|
-
contentMetadata.multipartFields.push({
|
|
191
|
-
fieldName,
|
|
192
|
-
fieldType: 'file',
|
|
193
|
-
...opts,
|
|
194
|
-
});
|
|
195
|
-
return configScope;
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
subInit(configScope);
|
|
199
|
-
}
|
|
200
|
-
return decorator;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
*
|
|
204
|
-
*/
|
|
205
|
-
decorator.UseType = (...type) => {
|
|
206
|
-
decoratorChain.push((meta) => {
|
|
207
|
-
meta.types = meta.types || [];
|
|
208
|
-
meta.types.push(...type);
|
|
209
|
-
});
|
|
210
|
-
return decorator;
|
|
211
|
-
};
|
|
212
|
-
return decorator;
|
|
213
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MQControllerDecoratorFactory = MQControllerDecoratorFactory;
|
|
4
|
-
const objects_1 = require("@jsopen/objects");
|
|
5
|
-
const index_js_1 = require("../../schema/index.js");
|
|
6
|
-
const constants_js_1 = require("../constants.js");
|
|
7
|
-
const CLASS_NAME_PATTERN = /^(.*)(Controller)$/;
|
|
8
|
-
const augmentationRegistry = [];
|
|
9
|
-
function MQControllerDecoratorFactory(options) {
|
|
10
|
-
const decoratorChain = [];
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
const decorator = function (target) {
|
|
15
|
-
let name = options?.name;
|
|
16
|
-
if (!name)
|
|
17
|
-
name = CLASS_NAME_PATTERN.exec(target.name)?.[1] || target.name;
|
|
18
|
-
const metadata = {};
|
|
19
|
-
const baseMetadata = Reflect.getOwnMetadata(constants_js_1.MQ_CONTROLLER_METADATA, Object.getPrototypeOf(target));
|
|
20
|
-
if (baseMetadata)
|
|
21
|
-
(0, objects_1.merge)(metadata, baseMetadata, { deep: true });
|
|
22
|
-
const oldMetadata = Reflect.getOwnMetadata(constants_js_1.MQ_CONTROLLER_METADATA, target);
|
|
23
|
-
if (oldMetadata)
|
|
24
|
-
(0, objects_1.merge)(metadata, oldMetadata, { deep: true });
|
|
25
|
-
(0, objects_1.merge)(metadata, {
|
|
26
|
-
...options,
|
|
27
|
-
kind: index_js_1.OpraSchema.MQController.Kind,
|
|
28
|
-
name,
|
|
29
|
-
path: name,
|
|
30
|
-
}, { deep: true });
|
|
31
|
-
Reflect.defineMetadata(constants_js_1.MQ_CONTROLLER_METADATA, metadata, target);
|
|
32
|
-
for (const fn of decoratorChain)
|
|
33
|
-
fn(metadata, target);
|
|
34
|
-
Reflect.defineMetadata(constants_js_1.MQ_CONTROLLER_METADATA, metadata, target);
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
decorator.Header = (name, arg1) => {
|
|
40
|
-
decoratorChain.push((meta) => {
|
|
41
|
-
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
42
|
-
? {
|
|
43
|
-
name,
|
|
44
|
-
type: arg1,
|
|
45
|
-
}
|
|
46
|
-
: { ...arg1, name };
|
|
47
|
-
meta.headers = meta.headers || [];
|
|
48
|
-
meta.headers.push(paramMeta);
|
|
49
|
-
});
|
|
50
|
-
return decorator;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
decorator.UseType = (...type) => {
|
|
56
|
-
decoratorChain.push((meta) => {
|
|
57
|
-
meta.types = meta.types || [];
|
|
58
|
-
meta.types.push(...type);
|
|
59
|
-
});
|
|
60
|
-
return decorator;
|
|
61
|
-
};
|
|
62
|
-
augmentationRegistry.forEach(fn => fn(decorator, decoratorChain, options));
|
|
63
|
-
return decorator;
|
|
64
|
-
}
|
|
65
|
-
MQControllerDecoratorFactory.augment = function (fn) {
|
|
66
|
-
augmentationRegistry.push(fn);
|
|
67
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MQOperationDecoratorFactory = MQOperationDecoratorFactory;
|
|
4
|
-
const objects_1 = require("@jsopen/objects");
|
|
5
|
-
const index_js_1 = require("../../schema/index.js");
|
|
6
|
-
const constants_js_1 = require("../constants.js");
|
|
7
|
-
const augmentationRegistry = [];
|
|
8
|
-
function MQOperationDecoratorFactory(decoratorChain, type, options) {
|
|
9
|
-
let inResponse = false;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
const decorator = ((target, propertyKey) => {
|
|
14
|
-
if (typeof propertyKey !== 'string')
|
|
15
|
-
throw new TypeError(`Symbol properties can not be decorated`);
|
|
16
|
-
const operationMetadata = {
|
|
17
|
-
kind: index_js_1.OpraSchema.MQOperation.Kind,
|
|
18
|
-
channel: propertyKey,
|
|
19
|
-
type,
|
|
20
|
-
...(0, objects_1.omit)(options, ['kind', 'type']),
|
|
21
|
-
};
|
|
22
|
-
const controllerMetadata = (Reflect.getOwnMetadata(constants_js_1.MQ_CONTROLLER_METADATA, target.constructor) || {});
|
|
23
|
-
controllerMetadata.operations = controllerMetadata.operations || {};
|
|
24
|
-
controllerMetadata.operations[propertyKey] = operationMetadata;
|
|
25
|
-
for (const fn of decoratorChain)
|
|
26
|
-
fn(operationMetadata, target, propertyKey);
|
|
27
|
-
Reflect.defineMetadata(constants_js_1.MQ_CONTROLLER_METADATA, controllerMetadata, target.constructor);
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
decorator.UseType = (...types) => {
|
|
33
|
-
decoratorChain.push((meta) => {
|
|
34
|
-
meta.types = meta.types || [];
|
|
35
|
-
meta.types.push(...types);
|
|
36
|
-
});
|
|
37
|
-
return decorator;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
decorator.Header = (name, arg1) => {
|
|
43
|
-
decoratorChain.push((meta) => {
|
|
44
|
-
const headerMetadata = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
45
|
-
? {
|
|
46
|
-
name,
|
|
47
|
-
type: arg1,
|
|
48
|
-
}
|
|
49
|
-
: { ...arg1, name };
|
|
50
|
-
if ((0, objects_1.isConstructor)(headerMetadata.type))
|
|
51
|
-
headerMetadata.designType = headerMetadata.type;
|
|
52
|
-
const subMeta = inResponse ? meta.response : meta;
|
|
53
|
-
if (subMeta.headers) {
|
|
54
|
-
subMeta.headers = subMeta.headers.filter(p => String(p.name) !== String(name));
|
|
55
|
-
}
|
|
56
|
-
else
|
|
57
|
-
subMeta.headers = [];
|
|
58
|
-
subMeta.headers.push(headerMetadata);
|
|
59
|
-
});
|
|
60
|
-
return decorator;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
decorator.Response = (_type, _options) => {
|
|
66
|
-
decoratorChain.push((meta) => {
|
|
67
|
-
inResponse = true;
|
|
68
|
-
meta.response = {
|
|
69
|
-
..._options,
|
|
70
|
-
type: _type,
|
|
71
|
-
};
|
|
72
|
-
if ((0, objects_1.isConstructor)(_type))
|
|
73
|
-
meta.response.designType = _type;
|
|
74
|
-
});
|
|
75
|
-
return decorator;
|
|
76
|
-
};
|
|
77
|
-
augmentationRegistry.forEach(fn => fn(decorator, decoratorChain, type, options));
|
|
78
|
-
return decorator;
|
|
79
|
-
}
|
|
80
|
-
MQOperationDecoratorFactory.augment = function (fn) {
|
|
81
|
-
augmentationRegistry.push(fn);
|
|
82
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleTypeDecoratorFactory = SimpleTypeDecoratorFactory;
|
|
4
|
-
exports.AttributeDecoratorFactory = AttributeDecoratorFactory;
|
|
5
|
-
const index_js_1 = require("../../schema/index.js");
|
|
6
|
-
const constants_js_1 = require("../constants.js");
|
|
7
|
-
function SimpleTypeDecoratorFactory(options) {
|
|
8
|
-
const decoratorChain = [];
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
const decorator = function (target) {
|
|
13
|
-
let name;
|
|
14
|
-
if (!options?.embedded) {
|
|
15
|
-
if (options?.name) {
|
|
16
|
-
if (!constants_js_1.CLASS_NAME_PATTERN.test(options.name))
|
|
17
|
-
throw new TypeError(`"${options.name}" is not a valid type name`);
|
|
18
|
-
name = options.name;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
name = target.name;
|
|
22
|
-
name = name.toLowerCase();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const metadata = Reflect.getOwnMetadata(constants_js_1.DATATYPE_METADATA, target) || {};
|
|
26
|
-
if (options)
|
|
27
|
-
Object.assign(metadata, options);
|
|
28
|
-
metadata.kind = index_js_1.OpraSchema.SimpleType.Kind;
|
|
29
|
-
metadata.name = name;
|
|
30
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, target);
|
|
31
|
-
for (const fn of decoratorChain)
|
|
32
|
-
fn(metadata, target);
|
|
33
|
-
};
|
|
34
|
-
decorator.Example = (value, description) => {
|
|
35
|
-
decoratorChain.push((meta) => {
|
|
36
|
-
meta.examples = meta.examples || [];
|
|
37
|
-
meta.examples.push({
|
|
38
|
-
description,
|
|
39
|
-
value,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return decorator;
|
|
43
|
-
};
|
|
44
|
-
return decorator;
|
|
45
|
-
}
|
|
46
|
-
function AttributeDecoratorFactory(options) {
|
|
47
|
-
return (target, propertyKey) => {
|
|
48
|
-
if (typeof propertyKey !== 'string')
|
|
49
|
-
throw new TypeError(`Symbol properties can't be decorated with Attribute`);
|
|
50
|
-
const metadata = Reflect.getOwnMetadata(constants_js_1.DATATYPE_METADATA, target.constructor) ||
|
|
51
|
-
{};
|
|
52
|
-
const designType = Reflect.getMetadata('design:type', target, propertyKey);
|
|
53
|
-
let format = 'string';
|
|
54
|
-
if (designType === Boolean)
|
|
55
|
-
format = 'boolean';
|
|
56
|
-
else if (designType === Number)
|
|
57
|
-
format = 'number';
|
|
58
|
-
metadata.kind = index_js_1.OpraSchema.SimpleType.Kind;
|
|
59
|
-
metadata.attributes = metadata.attributes || {};
|
|
60
|
-
metadata.attributes[propertyKey] = {
|
|
61
|
-
format: options?.format || format,
|
|
62
|
-
description: options?.description,
|
|
63
|
-
deprecated: options?.deprecated,
|
|
64
|
-
};
|
|
65
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, target.constructor);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WSControllerDecoratorFactory = WSControllerDecoratorFactory;
|
|
4
|
-
const objects_1 = require("@jsopen/objects");
|
|
5
|
-
const index_js_1 = require("../../schema/index.js");
|
|
6
|
-
const constants_js_1 = require("../constants.js");
|
|
7
|
-
const CLASS_NAME_PATTERN = /^(.*)(Controller)$/;
|
|
8
|
-
const augmentationRegistry = [];
|
|
9
|
-
function WSControllerDecoratorFactory(options) {
|
|
10
|
-
const decoratorChain = [];
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
const decorator = function (target) {
|
|
15
|
-
let name = options?.name;
|
|
16
|
-
if (!name)
|
|
17
|
-
name = CLASS_NAME_PATTERN.exec(target.name)?.[1] || target.name;
|
|
18
|
-
const metadata = {};
|
|
19
|
-
const baseMetadata = Reflect.getOwnMetadata(constants_js_1.WS_CONTROLLER_METADATA, Object.getPrototypeOf(target));
|
|
20
|
-
if (baseMetadata)
|
|
21
|
-
(0, objects_1.merge)(metadata, baseMetadata, { deep: true });
|
|
22
|
-
const oldMetadata = Reflect.getOwnMetadata(constants_js_1.WS_CONTROLLER_METADATA, target);
|
|
23
|
-
if (oldMetadata)
|
|
24
|
-
(0, objects_1.merge)(metadata, oldMetadata, { deep: true });
|
|
25
|
-
(0, objects_1.merge)(metadata, {
|
|
26
|
-
...options,
|
|
27
|
-
kind: index_js_1.OpraSchema.WSController.Kind,
|
|
28
|
-
name,
|
|
29
|
-
path: name,
|
|
30
|
-
}, { deep: true });
|
|
31
|
-
Reflect.defineMetadata(constants_js_1.WS_CONTROLLER_METADATA, metadata, target);
|
|
32
|
-
for (const fn of decoratorChain)
|
|
33
|
-
fn(metadata, target);
|
|
34
|
-
Reflect.defineMetadata(constants_js_1.WS_CONTROLLER_METADATA, metadata, target);
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
decorator.UseType = (...type) => {
|
|
40
|
-
decoratorChain.push((meta) => {
|
|
41
|
-
meta.types = meta.types || [];
|
|
42
|
-
meta.types.push(...type);
|
|
43
|
-
});
|
|
44
|
-
return decorator;
|
|
45
|
-
};
|
|
46
|
-
augmentationRegistry.forEach(fn => fn(decorator, decoratorChain, options));
|
|
47
|
-
return decorator;
|
|
48
|
-
}
|
|
49
|
-
WSControllerDecoratorFactory.augment = function (fn) {
|
|
50
|
-
augmentationRegistry.push(fn);
|
|
51
|
-
};
|