@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,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PartialType = PartialType;
|
|
4
|
-
const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function PartialType(base, ...args) {
|
|
9
|
-
const keys = Array.isArray(args[0]) ? args[0] : true;
|
|
10
|
-
const options = Array.isArray(args[0]) ? args[1] : args[0];
|
|
11
|
-
return (0, create_mapped_class_js_1.createMappedClass)(base, { partial: keys }, options);
|
|
12
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PickType = PickType;
|
|
4
|
-
const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function PickType(baseType, keys, options) {
|
|
9
|
-
return (0, create_mapped_class_js_1.createMappedClass)(baseType, { pick: keys }, options);
|
|
10
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnyType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let AnyType = class AnyType {
|
|
9
|
-
constructor(properties) {
|
|
10
|
-
if (properties)
|
|
11
|
-
Object.assign(this, properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER]() {
|
|
14
|
-
return valgen_1.isAny;
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER]() {
|
|
17
|
-
return valgen_1.isAny;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.AnyType = AnyType;
|
|
21
|
-
exports.AnyType = AnyType = tslib_1.__decorate([
|
|
22
|
-
(0, simple_type_js_1.SimpleType)({
|
|
23
|
-
name: 'any',
|
|
24
|
-
description: 'Represents any value',
|
|
25
|
-
}),
|
|
26
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
27
|
-
], AnyType);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BigintType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
const number_type_js_1 = require("./number.type.js");
|
|
9
|
-
let BigintType = class BigintType extends number_type_js_1.NumberType {
|
|
10
|
-
constructor(attributes) {
|
|
11
|
-
super(attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const x = [];
|
|
15
|
-
if (properties.minValue != null)
|
|
16
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
17
|
-
if (properties.maxValue != null)
|
|
18
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
19
|
-
return x.length > 0
|
|
20
|
-
? valgen_1.vg.pipe([valgen_1.toBigint, ...x], { returnIndex: 0 })
|
|
21
|
-
: valgen_1.toBigint;
|
|
22
|
-
}
|
|
23
|
-
[constants_js_1.ENCODER](properties) {
|
|
24
|
-
return this[constants_js_1.DECODER](properties);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.BigintType = BigintType;
|
|
28
|
-
exports.BigintType = BigintType = tslib_1.__decorate([
|
|
29
|
-
(0, simple_type_js_1.SimpleType)({
|
|
30
|
-
name: 'bigint',
|
|
31
|
-
description: 'BigInt number',
|
|
32
|
-
nameMappings: {
|
|
33
|
-
js: 'bigint',
|
|
34
|
-
json: 'string',
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
38
|
-
], BigintType);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BooleanType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let BooleanType = class BooleanType {
|
|
9
|
-
constructor(properties) {
|
|
10
|
-
if (properties)
|
|
11
|
-
Object.assign(this, properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER]() {
|
|
14
|
-
return valgen_1.toBoolean;
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER]() {
|
|
17
|
-
return valgen_1.toBoolean;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.BooleanType = BooleanType;
|
|
21
|
-
exports.BooleanType = BooleanType = tslib_1.__decorate([
|
|
22
|
-
(0, simple_type_js_1.SimpleType)({
|
|
23
|
-
name: 'boolean',
|
|
24
|
-
description: 'Simple true/false value',
|
|
25
|
-
nameMappings: {
|
|
26
|
-
js: 'boolean',
|
|
27
|
-
json: 'boolean',
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
31
|
-
], BooleanType);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./any.type.js"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./bigint.type.js"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./boolean.type.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./integer.type.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./null.type.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./number.type.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./object.type.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./string.type.js"), exports);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntegerType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
const number_type_js_1 = require("./number.type.js");
|
|
9
|
-
let IntegerType = class IntegerType extends number_type_js_1.NumberType {
|
|
10
|
-
constructor(properties) {
|
|
11
|
-
super(properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const x = [];
|
|
15
|
-
if (properties.minValue != null)
|
|
16
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
17
|
-
if (properties.maxValue != null)
|
|
18
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
19
|
-
return x.length > 0
|
|
20
|
-
? valgen_1.vg.pipe([valgen_1.toInteger, ...x], { returnIndex: 0 })
|
|
21
|
-
: valgen_1.toInteger;
|
|
22
|
-
}
|
|
23
|
-
[constants_js_1.ENCODER](properties) {
|
|
24
|
-
return this[constants_js_1.DECODER](properties);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.IntegerType = IntegerType;
|
|
28
|
-
exports.IntegerType = IntegerType = tslib_1.__decorate([
|
|
29
|
-
(0, simple_type_js_1.SimpleType)({
|
|
30
|
-
name: 'integer',
|
|
31
|
-
description: 'An integer number',
|
|
32
|
-
nameMappings: {
|
|
33
|
-
js: 'number',
|
|
34
|
-
json: 'number',
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
38
|
-
], IntegerType);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NullType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let NullType = class NullType {
|
|
9
|
-
constructor(properties) {
|
|
10
|
-
if (properties)
|
|
11
|
-
Object.assign(this, properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER]() {
|
|
14
|
-
return valgen_1.isNull;
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER]() {
|
|
17
|
-
return valgen_1.isNull;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.NullType = NullType;
|
|
21
|
-
exports.NullType = NullType = tslib_1.__decorate([
|
|
22
|
-
(0, simple_type_js_1.SimpleType)({
|
|
23
|
-
name: 'null',
|
|
24
|
-
description: 'A Null value',
|
|
25
|
-
nameMappings: {
|
|
26
|
-
js: 'null',
|
|
27
|
-
json: 'null',
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
31
|
-
], NullType);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NumberType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let NumberType = class NumberType {
|
|
9
|
-
constructor(properties) {
|
|
10
|
-
if (properties)
|
|
11
|
-
Object.assign(this, properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const x = [];
|
|
15
|
-
if (properties.minValue != null)
|
|
16
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
17
|
-
if (properties.maxValue != null)
|
|
18
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
19
|
-
return x.length > 0
|
|
20
|
-
? valgen_1.vg.pipe([valgen_1.toNumber, ...x], { returnIndex: 0 })
|
|
21
|
-
: valgen_1.toNumber;
|
|
22
|
-
}
|
|
23
|
-
[constants_js_1.ENCODER](properties) {
|
|
24
|
-
return this[constants_js_1.DECODER](properties);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.NumberType = NumberType;
|
|
28
|
-
tslib_1.__decorate([
|
|
29
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
30
|
-
description: 'Determines the minimum value',
|
|
31
|
-
}),
|
|
32
|
-
tslib_1.__metadata("design:type", Number)
|
|
33
|
-
], NumberType.prototype, "minValue", void 0);
|
|
34
|
-
tslib_1.__decorate([
|
|
35
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
36
|
-
description: 'Determines the maximum value',
|
|
37
|
-
}),
|
|
38
|
-
tslib_1.__metadata("design:type", Number)
|
|
39
|
-
], NumberType.prototype, "maxValue", void 0);
|
|
40
|
-
exports.NumberType = NumberType = tslib_1.__decorate([
|
|
41
|
-
(0, simple_type_js_1.SimpleType)({
|
|
42
|
-
name: 'number',
|
|
43
|
-
description: 'Both Integer as well as Floating-Point numbers',
|
|
44
|
-
nameMappings: {
|
|
45
|
-
js: 'number',
|
|
46
|
-
json: 'number',
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
50
|
-
], NumberType);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const complex_type_js_1 = require("../complex-type.js");
|
|
6
|
-
let ObjectType = class ObjectType {
|
|
7
|
-
constructor(properties) {
|
|
8
|
-
if (properties)
|
|
9
|
-
Object.assign(this, properties);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
exports.ObjectType = ObjectType;
|
|
13
|
-
exports.ObjectType = ObjectType = tslib_1.__decorate([
|
|
14
|
-
(0, complex_type_js_1.ComplexType)({
|
|
15
|
-
name: 'object',
|
|
16
|
-
description: 'A non modelled object',
|
|
17
|
-
additionalFields: true,
|
|
18
|
-
}),
|
|
19
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
20
|
-
], ObjectType);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let StringType = class StringType {
|
|
9
|
-
constructor(properties) {
|
|
10
|
-
if (properties)
|
|
11
|
-
Object.assign(this, properties);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const x = [];
|
|
15
|
-
if (properties.pattern) {
|
|
16
|
-
let formatName = properties.patternName;
|
|
17
|
-
if (!formatName) {
|
|
18
|
-
const meta = Reflect.getMetadata(constants_js_1.DATATYPE_METADATA, Object.getPrototypeOf(this).constructor);
|
|
19
|
-
formatName = meta.name;
|
|
20
|
-
}
|
|
21
|
-
x.push(valgen_1.vg.matches(properties.pattern, { formatName }));
|
|
22
|
-
}
|
|
23
|
-
if (properties.minLength)
|
|
24
|
-
x.push(valgen_1.vg.lengthMin(properties.minLength));
|
|
25
|
-
if (properties.maxLength)
|
|
26
|
-
x.push(valgen_1.vg.lengthMax(properties.maxLength));
|
|
27
|
-
return x.length > 0
|
|
28
|
-
? valgen_1.vg.pipe([valgen_1.toString, ...x], { returnIndex: 0 })
|
|
29
|
-
: valgen_1.toString;
|
|
30
|
-
}
|
|
31
|
-
[constants_js_1.ENCODER](properties) {
|
|
32
|
-
return this[constants_js_1.DECODER](properties);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.StringType = StringType;
|
|
36
|
-
tslib_1.__decorate([
|
|
37
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
38
|
-
description: 'Regex pattern to be used for validation',
|
|
39
|
-
}),
|
|
40
|
-
tslib_1.__metadata("design:type", Object)
|
|
41
|
-
], StringType.prototype, "pattern", void 0);
|
|
42
|
-
tslib_1.__decorate([
|
|
43
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
44
|
-
description: 'Name of the pattern',
|
|
45
|
-
}),
|
|
46
|
-
tslib_1.__metadata("design:type", String)
|
|
47
|
-
], StringType.prototype, "patternName", void 0);
|
|
48
|
-
tslib_1.__decorate([
|
|
49
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
50
|
-
description: 'Minimum number of characters',
|
|
51
|
-
}),
|
|
52
|
-
tslib_1.__metadata("design:type", Number)
|
|
53
|
-
], StringType.prototype, "minLength", void 0);
|
|
54
|
-
tslib_1.__decorate([
|
|
55
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
56
|
-
description: 'Minimum number of characters',
|
|
57
|
-
}),
|
|
58
|
-
tslib_1.__metadata("design:type", Number)
|
|
59
|
-
], StringType.prototype, "maxLength", void 0);
|
|
60
|
-
exports.StringType = StringType = tslib_1.__decorate([
|
|
61
|
-
(0, simple_type_js_1.SimpleType)({
|
|
62
|
-
name: 'string',
|
|
63
|
-
description: 'A sequence of characters',
|
|
64
|
-
nameMappings: {
|
|
65
|
-
js: 'string',
|
|
66
|
-
json: 'string',
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
70
|
-
], StringType);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequiredType = RequiredType;
|
|
4
|
-
const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function RequiredType(base, ...args) {
|
|
9
|
-
const keys = Array.isArray(args[0]) ? args[0] : true;
|
|
10
|
-
const options = Array.isArray(args[0]) ? args[1] : args[0];
|
|
11
|
-
return (0, create_mapped_class_js_1.createMappedClass)(base, { required: keys }, options);
|
|
12
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleType = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const objects_1 = require("@jsopen/objects");
|
|
6
|
-
const ts_gems_1 = require("ts-gems");
|
|
7
|
-
const valgen_1 = require("valgen");
|
|
8
|
-
const index_js_1 = require("../../helpers/index.js");
|
|
9
|
-
const index_js_2 = require("../../schema/index.js");
|
|
10
|
-
const constants_js_1 = require("../constants.js");
|
|
11
|
-
const simple_type_decorator_js_1 = require("../decorators/simple-type.decorator.js");
|
|
12
|
-
const data_type_js_1 = require("./data-type.js");
|
|
13
|
-
/**
|
|
14
|
-
* SimpleType constructor
|
|
15
|
-
*/
|
|
16
|
-
exports.SimpleType = function (...args) {
|
|
17
|
-
// Decorator
|
|
18
|
-
if (!this)
|
|
19
|
-
return exports.SimpleType[constants_js_1.DECORATOR](...args);
|
|
20
|
-
// Constructor
|
|
21
|
-
const [owner, initArgs, context] = args;
|
|
22
|
-
data_type_js_1.DataType.call(this, owner, initArgs, context);
|
|
23
|
-
const _this = (0, ts_gems_1.asMutable)(this);
|
|
24
|
-
_this.kind = index_js_2.OpraSchema.SimpleType.Kind;
|
|
25
|
-
if (initArgs.base) {
|
|
26
|
-
// noinspection SuspiciousTypeOfGuard
|
|
27
|
-
if (!(initArgs.base instanceof exports.SimpleType)) {
|
|
28
|
-
throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${this.kind}"`);
|
|
29
|
-
}
|
|
30
|
-
_this.base = initArgs.base;
|
|
31
|
-
}
|
|
32
|
-
_this.properties = initArgs.properties;
|
|
33
|
-
_this.ownNameMappings = { ...initArgs.nameMappings };
|
|
34
|
-
_this.nameMappings = {
|
|
35
|
-
..._this.base?.nameMappings,
|
|
36
|
-
...initArgs.nameMappings,
|
|
37
|
-
};
|
|
38
|
-
_this.ownAttributes = (0, index_js_1.cloneObject)(initArgs.attributes || {});
|
|
39
|
-
_this.attributes = _this.base ? (0, index_js_1.cloneObject)(_this.base.attributes) : {};
|
|
40
|
-
if (_this.ownAttributes) {
|
|
41
|
-
for (const [k, el] of Object.entries(_this.ownAttributes)) {
|
|
42
|
-
if (_this.attributes[k]?.sealed)
|
|
43
|
-
throw new TypeError(`Sealed attribute "${k}" can not be overwritten`);
|
|
44
|
-
_this.attributes[k] = el;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
_this._generateDecoder = initArgs.generateDecoder;
|
|
48
|
-
_this._generateEncoder = initArgs.generateEncoder;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* @class SimpleType
|
|
53
|
-
*/
|
|
54
|
-
class SimpleTypeClass extends data_type_js_1.DataType {
|
|
55
|
-
extend(properties) {
|
|
56
|
-
Object.setPrototypeOf(properties, this);
|
|
57
|
-
return properties;
|
|
58
|
-
}
|
|
59
|
-
extendsFrom(baseType) {
|
|
60
|
-
if (!(baseType instanceof data_type_js_1.DataType))
|
|
61
|
-
baseType = this.node.getDataType(baseType);
|
|
62
|
-
if (!(baseType instanceof exports.SimpleType))
|
|
63
|
-
return false;
|
|
64
|
-
if (baseType === this)
|
|
65
|
-
return true;
|
|
66
|
-
return !!this.base?.extendsFrom(baseType);
|
|
67
|
-
}
|
|
68
|
-
generateCodec(codec, options, properties) {
|
|
69
|
-
const prop = {
|
|
70
|
-
...this.properties,
|
|
71
|
-
...properties,
|
|
72
|
-
};
|
|
73
|
-
if (codec === 'decode') {
|
|
74
|
-
let t = this;
|
|
75
|
-
while (t) {
|
|
76
|
-
if (t._generateDecoder)
|
|
77
|
-
return t._generateDecoder(prop, {
|
|
78
|
-
dataType: this,
|
|
79
|
-
element: options?.documentElement || this.owner,
|
|
80
|
-
scope: options?.scope,
|
|
81
|
-
});
|
|
82
|
-
t = this.base;
|
|
83
|
-
}
|
|
84
|
-
return valgen_1.isAny;
|
|
85
|
-
}
|
|
86
|
-
let t = this;
|
|
87
|
-
while (t) {
|
|
88
|
-
if (t._generateEncoder)
|
|
89
|
-
return t._generateEncoder(prop, {
|
|
90
|
-
dataType: this,
|
|
91
|
-
element: options?.documentElement || this.owner,
|
|
92
|
-
scope: options?.scope,
|
|
93
|
-
});
|
|
94
|
-
t = this.base;
|
|
95
|
-
}
|
|
96
|
-
return valgen_1.isAny;
|
|
97
|
-
}
|
|
98
|
-
toJSON(options) {
|
|
99
|
-
const superJson = super.toJSON(options);
|
|
100
|
-
const baseName = this.base
|
|
101
|
-
? this.node.getDataTypeNameWithNs(this.base)
|
|
102
|
-
: undefined;
|
|
103
|
-
const attributes = (0, objects_1.omitUndefined)(this.ownAttributes);
|
|
104
|
-
let properties;
|
|
105
|
-
if (this.properties && typeof this.properties.toJSON === 'function') {
|
|
106
|
-
properties = this.properties.toJSON(this.properties, this.owner, options);
|
|
107
|
-
}
|
|
108
|
-
else
|
|
109
|
-
properties = this.properties ? (0, index_js_1.cloneObject)(this.properties) : {};
|
|
110
|
-
const out = {
|
|
111
|
-
...superJson,
|
|
112
|
-
kind: this.kind,
|
|
113
|
-
base: baseName,
|
|
114
|
-
attributes: attributes && Object.keys(attributes).length ? attributes : undefined,
|
|
115
|
-
properties: Object.keys(properties).length ? properties : undefined,
|
|
116
|
-
};
|
|
117
|
-
if (Object.keys(this.ownNameMappings).length)
|
|
118
|
-
out.nameMappings = { ...this.ownNameMappings };
|
|
119
|
-
return (0, objects_1.omitUndefined)(out, true);
|
|
120
|
-
}
|
|
121
|
-
_locateBase(callback) {
|
|
122
|
-
if (!this.base)
|
|
123
|
-
return;
|
|
124
|
-
if (callback(this.base))
|
|
125
|
-
return this.base;
|
|
126
|
-
if (this.base._locateBase)
|
|
127
|
-
return this.base._locateBase(callback);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
exports.SimpleType.prototype = SimpleTypeClass.prototype;
|
|
131
|
-
Object.assign(exports.SimpleType, simple_type_decorator_js_1.SimpleTypeDecoratorFactory);
|
|
132
|
-
exports.SimpleType[constants_js_1.DECORATOR] = simple_type_decorator_js_1.SimpleTypeDecoratorFactory;
|
|
133
|
-
exports.SimpleType.Attribute = simple_type_decorator_js_1.AttributeDecoratorFactory;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnionType = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const objects_1 = require("@jsopen/objects");
|
|
6
|
-
const ts_gems_1 = require("ts-gems");
|
|
7
|
-
const valgen_1 = require("valgen");
|
|
8
|
-
const index_js_1 = require("../../schema/index.js");
|
|
9
|
-
const constants_js_1 = require("../constants.js");
|
|
10
|
-
const data_type_js_1 = require("./data-type.js");
|
|
11
|
-
/**
|
|
12
|
-
* @class UnionType
|
|
13
|
-
*/
|
|
14
|
-
exports.UnionType = function (...args) {
|
|
15
|
-
// UnionType factory
|
|
16
|
-
if (!this) {
|
|
17
|
-
return exports.UnionType[constants_js_1.DECORATOR].apply(undefined, args);
|
|
18
|
-
}
|
|
19
|
-
// Constructor
|
|
20
|
-
const [owner, initArgs, context] = args;
|
|
21
|
-
data_type_js_1.DataType.call(this, owner, initArgs, context);
|
|
22
|
-
const _this = (0, ts_gems_1.asMutable)(this);
|
|
23
|
-
_this.kind = index_js_1.OpraSchema.UnionType.Kind;
|
|
24
|
-
_this.discriminator = initArgs.discriminator;
|
|
25
|
-
_this.types = [];
|
|
26
|
-
for (const base of initArgs.types) {
|
|
27
|
-
_this.types.push(base);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @class UnionType
|
|
33
|
-
*/
|
|
34
|
-
class UnionTypeClass extends data_type_js_1.DataType {
|
|
35
|
-
toJSON(options) {
|
|
36
|
-
const superJson = super.toJSON(options);
|
|
37
|
-
return (0, objects_1.omitUndefined)({
|
|
38
|
-
...superJson,
|
|
39
|
-
kind: this.kind,
|
|
40
|
-
discriminator: this.discriminator,
|
|
41
|
-
types: this.types.map(base => {
|
|
42
|
-
const baseName = this.node.getDataTypeNameWithNs(base);
|
|
43
|
-
return baseName ? baseName : base.toJSON(options);
|
|
44
|
-
}),
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
generateCodec(codec, options) {
|
|
48
|
-
const codecs = this.types.map(t => {
|
|
49
|
-
const fn = t.generateCodec(codec, options);
|
|
50
|
-
if ((t.kind === index_js_1.OpraSchema.ComplexType.Kind ||
|
|
51
|
-
t.kind === index_js_1.OpraSchema.MappedType.Kind) &&
|
|
52
|
-
t.discriminatorField) {
|
|
53
|
-
return [
|
|
54
|
-
fn,
|
|
55
|
-
{ [t.discriminatorField]: valgen_1.vg.isEqual(t.discriminatorValue) },
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
return fn;
|
|
59
|
-
});
|
|
60
|
-
return valgen_1.vg.oneOf(codecs);
|
|
61
|
-
}
|
|
62
|
-
extendsFrom() {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
_locateBase() {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.UnionType.prototype = UnionTypeClass.prototype;
|
|
70
|
-
exports.UnionType[constants_js_1.DECORATOR] = UnionTypeFactory;
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
function UnionTypeFactory(clasRefs, options) {
|
|
75
|
-
class UnionClass {
|
|
76
|
-
}
|
|
77
|
-
const metadata = {
|
|
78
|
-
...options,
|
|
79
|
-
kind: index_js_1.OpraSchema.UnionType.Kind,
|
|
80
|
-
types: clasRefs,
|
|
81
|
-
};
|
|
82
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, UnionClass);
|
|
83
|
-
return UnionClass;
|
|
84
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMappedClass = createMappedClass;
|
|
4
|
-
const index_js_1 = require("../../../helpers/index.js");
|
|
5
|
-
const index_js_2 = require("../../../schema/index.js");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const mapped_type_js_1 = require("../mapped-type.js");
|
|
8
|
-
const get_is_inherited_predicate_fn_js_1 = require("./get-is-inherited-predicate-fn.js");
|
|
9
|
-
function createMappedClass(source, config, options) {
|
|
10
|
-
const isInheritedPredicate = (0, get_is_inherited_predicate_fn_js_1.getIsInheritedPredicateFn)(config.pick, config.omit);
|
|
11
|
-
const sourceName = typeof source === 'string'
|
|
12
|
-
? source.charAt(0).toUpperCase() + source.substring(1)
|
|
13
|
-
: source.name;
|
|
14
|
-
const className = options?.name || sourceName + 'Mapped';
|
|
15
|
-
const MappedClass = {
|
|
16
|
-
[className]: class {
|
|
17
|
-
constructor() {
|
|
18
|
-
if (typeof source === 'function')
|
|
19
|
-
(0, index_js_1.inheritPropertyInitializers)(this, source, isInheritedPredicate);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
}[className];
|
|
23
|
-
if (typeof source === 'function')
|
|
24
|
-
(0, index_js_1.mergePrototype)(MappedClass.prototype, source.prototype);
|
|
25
|
-
if (typeof source === 'function') {
|
|
26
|
-
const m = Reflect.getOwnMetadata(constants_js_1.DATATYPE_METADATA, source);
|
|
27
|
-
if (!m)
|
|
28
|
-
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
29
|
-
if (!(m.kind === index_js_2.OpraSchema.ComplexType.Kind ||
|
|
30
|
-
m.kind === index_js_2.OpraSchema.MappedType.Kind ||
|
|
31
|
-
m.kind === index_js_2.OpraSchema.MixinType.Kind)) {
|
|
32
|
-
throw new TypeError(`Class "${source}" is not a ${index_js_2.OpraSchema.ComplexType.Kind}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const metadata = {
|
|
36
|
-
...options,
|
|
37
|
-
kind: 'MappedType',
|
|
38
|
-
base: source,
|
|
39
|
-
};
|
|
40
|
-
if (config.pick)
|
|
41
|
-
metadata.pick = config.pick;
|
|
42
|
-
if (config.omit)
|
|
43
|
-
metadata.omit = config.omit;
|
|
44
|
-
if (config.partial)
|
|
45
|
-
metadata.partial = config.partial;
|
|
46
|
-
if (config.required)
|
|
47
|
-
metadata.required = config.required;
|
|
48
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, MappedClass);
|
|
49
|
-
if (typeof source === 'function') {
|
|
50
|
-
mapped_type_js_1.MappedType._applyMixin(MappedClass, source, {
|
|
51
|
-
...config,
|
|
52
|
-
isInheritedPredicate,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return MappedClass;
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIsInheritedPredicateFn = getIsInheritedPredicateFn;
|
|
4
|
-
function getIsInheritedPredicateFn(pick, omit) {
|
|
5
|
-
const pickKeys = pick?.map(x => String(x).toLowerCase());
|
|
6
|
-
const omitKeys = omit?.map(x => String(x).toLowerCase());
|
|
7
|
-
return (propertyName) => {
|
|
8
|
-
if (omitKeys && omitKeys.includes(propertyName.toLowerCase()))
|
|
9
|
-
return false;
|
|
10
|
-
if (pickKeys)
|
|
11
|
-
return pickKeys.includes(propertyName.toLowerCase());
|
|
12
|
-
return true;
|
|
13
|
-
};
|
|
14
|
-
}
|