@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,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FilterType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const filter_rules_js_1 = require("../../../filter/filter-rules.js");
|
|
7
|
-
const index_js_1 = require("../../../filter/index.js");
|
|
8
|
-
const constants_js_1 = require("../../constants.js");
|
|
9
|
-
const data_type_js_1 = require("../data-type.js");
|
|
10
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
11
|
-
let FilterType = class FilterType {
|
|
12
|
-
constructor(attributes) {
|
|
13
|
-
if (attributes)
|
|
14
|
-
Object.assign(this, attributes);
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.DECODER](properties, { element }) {
|
|
17
|
-
const dataType = properties.dataType
|
|
18
|
-
? element.node.getComplexType(properties.dataType)
|
|
19
|
-
: element.node.getComplexType('object');
|
|
20
|
-
const rules = properties.rules
|
|
21
|
-
? new filter_rules_js_1.FilterRules(properties.rules)
|
|
22
|
-
: undefined;
|
|
23
|
-
return decodeFilter(dataType, rules);
|
|
24
|
-
}
|
|
25
|
-
[constants_js_1.ENCODER]() {
|
|
26
|
-
return encodeFilter;
|
|
27
|
-
}
|
|
28
|
-
toJSON(properties, element, options) {
|
|
29
|
-
const dataType = properties.dataType
|
|
30
|
-
? element.node.getComplexType(properties.dataType)
|
|
31
|
-
: element.node.getComplexType('object');
|
|
32
|
-
/** Test scope */
|
|
33
|
-
data_type_js_1.DataType.prototype.toJSON.call(dataType, options);
|
|
34
|
-
const typeName = dataType
|
|
35
|
-
? element.node.getDataTypeNameWithNs(dataType)
|
|
36
|
-
: undefined;
|
|
37
|
-
return {
|
|
38
|
-
dataType: typeName ? typeName : dataType.toJSON(options),
|
|
39
|
-
rules: properties.rules,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
exports.FilterType = FilterType;
|
|
44
|
-
tslib_1.__decorate([
|
|
45
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
46
|
-
description: 'Data type which filtering fields belong to',
|
|
47
|
-
}),
|
|
48
|
-
tslib_1.__metadata("design:type", Object)
|
|
49
|
-
], FilterType.prototype, "dataType", void 0);
|
|
50
|
-
tslib_1.__decorate([
|
|
51
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
52
|
-
description: 'Stringified JSON object defines filtering rules',
|
|
53
|
-
format: 'string',
|
|
54
|
-
}),
|
|
55
|
-
tslib_1.__metadata("design:type", Object)
|
|
56
|
-
], FilterType.prototype, "rules", void 0);
|
|
57
|
-
exports.FilterType = FilterType = tslib_1.__decorate([
|
|
58
|
-
(0, simple_type_js_1.SimpleType)({
|
|
59
|
-
name: 'filter',
|
|
60
|
-
description: 'A query filter',
|
|
61
|
-
nameMappings: {
|
|
62
|
-
js: 'object',
|
|
63
|
-
json: 'string',
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
67
|
-
], FilterType);
|
|
68
|
-
const decodeFilter = (dataType, rules, scope) => (0, valgen_1.validator)('decodeFilter', (input, context, _this) => {
|
|
69
|
-
if (typeof input === 'string') {
|
|
70
|
-
try {
|
|
71
|
-
const filter = index_js_1.OpraFilter.parse(input);
|
|
72
|
-
if (rules)
|
|
73
|
-
return rules.normalizeFilter(filter, dataType, scope);
|
|
74
|
-
return filter;
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
context.fail(_this, `Not a valid filter expression. ${e.message}`, input);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
context.fail(_this, `Nt a valid filter expression string`, input);
|
|
82
|
-
});
|
|
83
|
-
const encodeFilter = (0, valgen_1.validator)('encodeFilter', (input, context, _this) => {
|
|
84
|
-
if (input instanceof index_js_1.OpraFilter.Ast) {
|
|
85
|
-
return input.toString();
|
|
86
|
-
}
|
|
87
|
-
context.fail(_this, `Not a valid filter expression`, input);
|
|
88
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./base64.type.js"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./date.type.js"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./date-time.type.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./date-time-tz.type.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./email.type.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./field-path.type.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./filter.type.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./object-id.type.js"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./operation-result.type.js"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./partial-date.type.js"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./time.type.js"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./url.type.js"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./uuid.type.js"), exports);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectIdType = 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 ObjectIdType = class ObjectIdType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER]() {
|
|
14
|
-
return valgen_1.vg.isObjectId({ coerce: true });
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER]() {
|
|
17
|
-
return valgen_1.vg.isObjectId({ coerce: true });
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.ObjectIdType = ObjectIdType;
|
|
21
|
-
exports.ObjectIdType = ObjectIdType = tslib_1.__decorate([
|
|
22
|
-
(0, simple_type_js_1.SimpleType)({
|
|
23
|
-
name: 'ObjectId',
|
|
24
|
-
description: 'A MongoDB ObjectID value',
|
|
25
|
-
nameMappings: {
|
|
26
|
-
js: 'object',
|
|
27
|
-
json: 'string',
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
31
|
-
], ObjectIdType);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OperationResult = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const api_field_js_1 = require("../api-field.js");
|
|
6
|
-
const complex_type_js_1 = require("../complex-type.js");
|
|
7
|
-
let OperationResult = class OperationResult {
|
|
8
|
-
constructor(init) {
|
|
9
|
-
if (init)
|
|
10
|
-
Object.assign(this, init);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
exports.OperationResult = OperationResult;
|
|
14
|
-
tslib_1.__decorate([
|
|
15
|
-
(0, api_field_js_1.ApiField)(),
|
|
16
|
-
tslib_1.__metadata("design:type", Number)
|
|
17
|
-
], OperationResult.prototype, "affected", void 0);
|
|
18
|
-
tslib_1.__decorate([
|
|
19
|
-
(0, api_field_js_1.ApiField)(),
|
|
20
|
-
tslib_1.__metadata("design:type", Number)
|
|
21
|
-
], OperationResult.prototype, "totalMatches", void 0);
|
|
22
|
-
tslib_1.__decorate([
|
|
23
|
-
(0, api_field_js_1.ApiField)(),
|
|
24
|
-
tslib_1.__metadata("design:type", String)
|
|
25
|
-
], OperationResult.prototype, "context", void 0);
|
|
26
|
-
tslib_1.__decorate([
|
|
27
|
-
(0, api_field_js_1.ApiField)(),
|
|
28
|
-
tslib_1.__metadata("design:type", String)
|
|
29
|
-
], OperationResult.prototype, "type", void 0);
|
|
30
|
-
tslib_1.__decorate([
|
|
31
|
-
(0, api_field_js_1.ApiField)(),
|
|
32
|
-
tslib_1.__metadata("design:type", String)
|
|
33
|
-
], OperationResult.prototype, "message", void 0);
|
|
34
|
-
tslib_1.__decorate([
|
|
35
|
-
(0, api_field_js_1.ApiField)({ type: 'any' }),
|
|
36
|
-
tslib_1.__metadata("design:type", Object)
|
|
37
|
-
], OperationResult.prototype, "payload", void 0);
|
|
38
|
-
tslib_1.__decorate([
|
|
39
|
-
(0, api_field_js_1.ApiField)({ type: 'object' }),
|
|
40
|
-
tslib_1.__metadata("design:type", Array)
|
|
41
|
-
], OperationResult.prototype, "errors", void 0);
|
|
42
|
-
exports.OperationResult = OperationResult = tslib_1.__decorate([
|
|
43
|
-
(0, complex_type_js_1.ComplexType)({
|
|
44
|
-
name: 'OperationResult',
|
|
45
|
-
description: 'Operation result',
|
|
46
|
-
}),
|
|
47
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
48
|
-
], OperationResult);
|
|
49
|
-
(function (OperationResult) {
|
|
50
|
-
function forPayload(type) {
|
|
51
|
-
let OperationResult_ = class OperationResult_ extends OperationResult {
|
|
52
|
-
constructor(...args) {
|
|
53
|
-
super(...args);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
tslib_1.__decorate([
|
|
57
|
-
(0, api_field_js_1.ApiField)({ type, required: true }),
|
|
58
|
-
tslib_1.__metadata("design:type", Object)
|
|
59
|
-
], OperationResult_.prototype, "payload", void 0);
|
|
60
|
-
OperationResult_ = tslib_1.__decorate([
|
|
61
|
-
(0, complex_type_js_1.ComplexType)({ embedded: true }),
|
|
62
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
63
|
-
], OperationResult_);
|
|
64
|
-
return OperationResult_;
|
|
65
|
-
}
|
|
66
|
-
OperationResult.forPayload = forPayload;
|
|
67
|
-
})(OperationResult || (exports.OperationResult = OperationResult = {}));
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PartialDateType = 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 PartialDateType = class PartialDateType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const fn = toPartialDate;
|
|
15
|
-
const x = [];
|
|
16
|
-
if (properties.minValue != null) {
|
|
17
|
-
(0, valgen_1.isDateString)(properties.minValue);
|
|
18
|
-
x.push(valgen_1.toString, valgen_1.vg.isGte(properties.minValue));
|
|
19
|
-
}
|
|
20
|
-
if (properties.maxValue != null) {
|
|
21
|
-
(0, valgen_1.isDateString)(properties.maxValue);
|
|
22
|
-
x.push(valgen_1.toString, valgen_1.vg.isLte(properties.maxValue));
|
|
23
|
-
}
|
|
24
|
-
return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
|
|
25
|
-
}
|
|
26
|
-
[constants_js_1.ENCODER](properties) {
|
|
27
|
-
const fn = toPartialDate;
|
|
28
|
-
const x = [];
|
|
29
|
-
if (properties.minValue != null) {
|
|
30
|
-
(0, valgen_1.isDateString)(properties.minValue);
|
|
31
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
32
|
-
}
|
|
33
|
-
if (properties.maxValue != null) {
|
|
34
|
-
(0, valgen_1.isDateString)(properties.maxValue);
|
|
35
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
36
|
-
}
|
|
37
|
-
return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.PartialDateType = PartialDateType;
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
43
|
-
description: 'Minimum value',
|
|
44
|
-
}),
|
|
45
|
-
tslib_1.__metadata("design:type", String)
|
|
46
|
-
], PartialDateType.prototype, "minValue", void 0);
|
|
47
|
-
tslib_1.__decorate([
|
|
48
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
49
|
-
description: 'Maximum value',
|
|
50
|
-
}),
|
|
51
|
-
tslib_1.__metadata("design:type", String)
|
|
52
|
-
], PartialDateType.prototype, "maxValue", void 0);
|
|
53
|
-
exports.PartialDateType = PartialDateType = tslib_1.__decorate([
|
|
54
|
-
((0, simple_type_js_1.SimpleType)({
|
|
55
|
-
name: 'partialdate',
|
|
56
|
-
description: 'Specifies a point in time using a 24-hour clock notation.\rFormat: YYYY-[MM-[DD-[T?HH:[MM:[SS[.S[S[S[S]]]]]]]]][+/-ZZ:ZZ].',
|
|
57
|
-
nameMappings: {
|
|
58
|
-
js: 'string',
|
|
59
|
-
json: 'string',
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
.Example('2021-04-18T22:30:15:22+03:00')
|
|
63
|
-
.Example('2021-04-18 22:30')
|
|
64
|
-
.Example('2021-04-18')
|
|
65
|
-
.Example('2021')),
|
|
66
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
67
|
-
], PartialDateType);
|
|
68
|
-
const _isDateString = valgen_1.vg.isDateString({
|
|
69
|
-
precisionMin: 'year',
|
|
70
|
-
});
|
|
71
|
-
const toPartialDate = (0, valgen_1.validator)((input) => {
|
|
72
|
-
if (input instanceof Date) {
|
|
73
|
-
let s = _isDateString(input, { coerce: true });
|
|
74
|
-
if (s.endsWith('Z'))
|
|
75
|
-
s = s.substring(0, s.length - 1);
|
|
76
|
-
if (s.endsWith('.000'))
|
|
77
|
-
s = s.substring(0, s.length - 4);
|
|
78
|
-
if (s.endsWith(':00'))
|
|
79
|
-
s = s.substring(0, s.length - 3);
|
|
80
|
-
if (s.endsWith('00:00'))
|
|
81
|
-
s = s.substring(0, s.length - 6);
|
|
82
|
-
return s;
|
|
83
|
-
}
|
|
84
|
-
return _isDateString(input, { coerce: false });
|
|
85
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeType = 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 TIME_PATTERN = /^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/;
|
|
9
|
-
let TimeType = class TimeType {
|
|
10
|
-
constructor(attributes) {
|
|
11
|
-
if (attributes)
|
|
12
|
-
Object.assign(this, attributes);
|
|
13
|
-
}
|
|
14
|
-
[constants_js_1.DECODER](properties) {
|
|
15
|
-
const fn = valgen_1.vg.matches(TIME_PATTERN, {
|
|
16
|
-
formatName: 'time',
|
|
17
|
-
coerce: true,
|
|
18
|
-
});
|
|
19
|
-
const x = [];
|
|
20
|
-
if (properties.minValue != null)
|
|
21
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
22
|
-
if (properties.maxValue != null)
|
|
23
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
24
|
-
return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
|
|
25
|
-
}
|
|
26
|
-
[constants_js_1.ENCODER](properties) {
|
|
27
|
-
return this[constants_js_1.DECODER](properties);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.TimeType = TimeType;
|
|
31
|
-
tslib_1.__decorate([
|
|
32
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
33
|
-
description: 'Minimum value',
|
|
34
|
-
}),
|
|
35
|
-
tslib_1.__metadata("design:type", String)
|
|
36
|
-
], TimeType.prototype, "minValue", void 0);
|
|
37
|
-
tslib_1.__decorate([
|
|
38
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
39
|
-
description: 'Maximum value',
|
|
40
|
-
}),
|
|
41
|
-
tslib_1.__metadata("design:type", String)
|
|
42
|
-
], TimeType.prototype, "maxValue", void 0);
|
|
43
|
-
exports.TimeType = TimeType = tslib_1.__decorate([
|
|
44
|
-
((0, simple_type_js_1.SimpleType)({
|
|
45
|
-
name: 'time',
|
|
46
|
-
description: 'Time string in 24h format',
|
|
47
|
-
nameMappings: {
|
|
48
|
-
js: 'string',
|
|
49
|
-
json: 'string',
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
.Example('18:23:00', 'Full time value')
|
|
53
|
-
.Example('18:23:00', 'Time value without seconds')),
|
|
54
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
55
|
-
], TimeType);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UrlType = 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 UrlType = class UrlType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER]() {
|
|
14
|
-
return valgen_1.vg.isURL({ coerce: true });
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER]() {
|
|
17
|
-
return valgen_1.vg.isURL({ coerce: true });
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.UrlType = UrlType;
|
|
21
|
-
exports.UrlType = UrlType = tslib_1.__decorate([
|
|
22
|
-
((0, simple_type_js_1.SimpleType)({
|
|
23
|
-
name: 'url',
|
|
24
|
-
description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
|
|
25
|
-
nameMappings: {
|
|
26
|
-
js: 'string',
|
|
27
|
-
json: 'string',
|
|
28
|
-
},
|
|
29
|
-
}).Example('http://tempuri.org')),
|
|
30
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
31
|
-
], UrlType);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UuidType = 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 UuidType = class UuidType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
return valgen_1.vg.isUUID(properties?.version, { coerce: true });
|
|
15
|
-
}
|
|
16
|
-
[constants_js_1.ENCODER](properties) {
|
|
17
|
-
return valgen_1.vg.isUUID(properties?.version, { coerce: true });
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.UuidType = UuidType;
|
|
21
|
-
tslib_1.__decorate([
|
|
22
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
23
|
-
description: 'Version of the UUID',
|
|
24
|
-
}),
|
|
25
|
-
tslib_1.__metadata("design:type", Number)
|
|
26
|
-
], UuidType.prototype, "version", void 0);
|
|
27
|
-
exports.UuidType = UuidType = tslib_1.__decorate([
|
|
28
|
-
(0, simple_type_js_1.SimpleType)({
|
|
29
|
-
name: 'uuid',
|
|
30
|
-
description: 'A Universal Unique Identifier (UUID) value',
|
|
31
|
-
nameMappings: {
|
|
32
|
-
js: 'string',
|
|
33
|
-
json: 'string',
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
37
|
-
], UuidType);
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MappedType = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const objects_1 = require("@jsopen/objects");
|
|
6
|
-
const ts_gems_1 = require("ts-gems");
|
|
7
|
-
const index_js_1 = require("../../schema/index.js");
|
|
8
|
-
const api_field_js_1 = require("./api-field.js");
|
|
9
|
-
const complex_type_base_js_1 = require("./complex-type-base.js");
|
|
10
|
-
const data_type_js_1 = require("./data-type.js");
|
|
11
|
-
const get_is_inherited_predicate_fn_js_1 = require("./utils/get-is-inherited-predicate-fn.js");
|
|
12
|
-
/**
|
|
13
|
-
* MappedType constructor
|
|
14
|
-
*/
|
|
15
|
-
exports.MappedType = function (...args) {
|
|
16
|
-
if (!this)
|
|
17
|
-
throw new TypeError('"this" should be passed to call class constructor');
|
|
18
|
-
// Constructor
|
|
19
|
-
const [owner, initArgs, context] = args;
|
|
20
|
-
complex_type_base_js_1.ComplexTypeBase.call(this, owner, initArgs, context);
|
|
21
|
-
const _this = (0, ts_gems_1.asMutable)(this);
|
|
22
|
-
_this.kind = index_js_1.OpraSchema.MappedType.Kind;
|
|
23
|
-
if (initArgs.base) {
|
|
24
|
-
// noinspection SuspiciousTypeOfGuard
|
|
25
|
-
if (!(initArgs.base instanceof complex_type_base_js_1.ComplexTypeBase)) {
|
|
26
|
-
throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${this.kind}"`);
|
|
27
|
-
}
|
|
28
|
-
_this.base = initArgs.base;
|
|
29
|
-
_this.ctor = initArgs.ctor || _this.base.ctor;
|
|
30
|
-
if (initArgs.pick)
|
|
31
|
-
_this.pick = initArgs.pick.map(f => _this.base.normalizeFieldPath(f));
|
|
32
|
-
else if (initArgs.omit)
|
|
33
|
-
_this.omit = initArgs.omit.map(f => _this.base.normalizeFieldPath(f));
|
|
34
|
-
else if (initArgs.partial) {
|
|
35
|
-
_this.partial = Array.isArray(initArgs.partial)
|
|
36
|
-
? initArgs.partial.map(f => _this.base.normalizeFieldPath(f))
|
|
37
|
-
: initArgs.partial;
|
|
38
|
-
}
|
|
39
|
-
else if (initArgs.required) {
|
|
40
|
-
_this.required = Array.isArray(initArgs.required)
|
|
41
|
-
? initArgs.required.map(f => _this.base.normalizeFieldPath(f))
|
|
42
|
-
: initArgs.required;
|
|
43
|
-
}
|
|
44
|
-
/** Copy fields from base */
|
|
45
|
-
const isInheritedPredicate = (0, get_is_inherited_predicate_fn_js_1.getIsInheritedPredicateFn)(_this.pick, _this.omit);
|
|
46
|
-
const partial = Array.isArray(_this.partial)
|
|
47
|
-
? _this.partial.map(x => x.toLowerCase())
|
|
48
|
-
: _this.partial;
|
|
49
|
-
const required = Array.isArray(_this.required)
|
|
50
|
-
? _this.required.map(x => x.toLowerCase())
|
|
51
|
-
: _this.required;
|
|
52
|
-
for (const [k, v] of _this.base.fieldEntries('*')) {
|
|
53
|
-
if (!isInheritedPredicate(k))
|
|
54
|
-
continue;
|
|
55
|
-
const meta = { ...v };
|
|
56
|
-
if (partial === true ||
|
|
57
|
-
(Array.isArray(partial) && partial.includes(v.name.toLowerCase()))) {
|
|
58
|
-
meta.required = false;
|
|
59
|
-
}
|
|
60
|
-
else if (required === true ||
|
|
61
|
-
(Array.isArray(required) && required.includes(v.name.toLowerCase()))) {
|
|
62
|
-
meta.required = true;
|
|
63
|
-
}
|
|
64
|
-
const field = new api_field_js_1.ApiField(this, meta);
|
|
65
|
-
_this._fields.set(field.name, field);
|
|
66
|
-
}
|
|
67
|
-
if (!_this.pick ||
|
|
68
|
-
_this.base.additionalFields === false ||
|
|
69
|
-
(Array.isArray(_this.base.additionalFields) &&
|
|
70
|
-
_this.base.additionalFields?.[0] === 'error')) {
|
|
71
|
-
_this.additionalFields = _this.base.additionalFields;
|
|
72
|
-
}
|
|
73
|
-
if (initArgs.base.keyField && isInheritedPredicate(initArgs.base.keyField))
|
|
74
|
-
_this.keyField = initArgs.base.keyField;
|
|
75
|
-
_this.discriminatorField = initArgs.base.discriminatorField;
|
|
76
|
-
_this.discriminatorValue = initArgs.base.discriminatorValue;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @class MappedType
|
|
82
|
-
*/
|
|
83
|
-
class MappedTypeClass extends complex_type_base_js_1.ComplexTypeBase {
|
|
84
|
-
extendsFrom(baseType) {
|
|
85
|
-
if (!(baseType instanceof data_type_js_1.DataType))
|
|
86
|
-
baseType = this.node.getDataType(baseType);
|
|
87
|
-
if (!(baseType instanceof complex_type_base_js_1.ComplexTypeBase))
|
|
88
|
-
return false;
|
|
89
|
-
if (baseType === this)
|
|
90
|
-
return true;
|
|
91
|
-
return !!this.base?.extendsFrom(baseType);
|
|
92
|
-
}
|
|
93
|
-
toJSON(options) {
|
|
94
|
-
const superJson = super.toJSON(options);
|
|
95
|
-
const baseName = this.base
|
|
96
|
-
? this.node.getDataTypeNameWithNs(this.base)
|
|
97
|
-
: undefined;
|
|
98
|
-
return (0, objects_1.omitUndefined)({
|
|
99
|
-
...superJson,
|
|
100
|
-
base: baseName ? baseName : this.base.toJSON(options),
|
|
101
|
-
kind: this.kind,
|
|
102
|
-
pick: this.pick,
|
|
103
|
-
omit: this.omit,
|
|
104
|
-
partial: this.partial,
|
|
105
|
-
required: this.required,
|
|
106
|
-
discriminatorField: this.discriminatorField,
|
|
107
|
-
discriminatorValue: this.discriminatorValue,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
_locateBase(callback) {
|
|
111
|
-
if (!this.base)
|
|
112
|
-
return;
|
|
113
|
-
if (callback(this.base))
|
|
114
|
-
return this.base;
|
|
115
|
-
if (this.base._locateBase)
|
|
116
|
-
return this.base._locateBase(callback);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.MappedType.prototype = MappedTypeClass.prototype;
|
|
120
|
-
exports.MappedType._applyMixin = () => undefined;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MixinType = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const objects_1 = require("@jsopen/objects");
|
|
6
|
-
const ts_gems_1 = require("ts-gems");
|
|
7
|
-
const index_js_1 = require("../../helpers/index.js");
|
|
8
|
-
const index_js_2 = require("../../schema/index.js");
|
|
9
|
-
const constants_js_1 = require("../constants.js");
|
|
10
|
-
const api_field_js_1 = require("./api-field.js");
|
|
11
|
-
const complex_type_base_js_1 = require("./complex-type-base.js");
|
|
12
|
-
const data_type_js_1 = require("./data-type.js");
|
|
13
|
-
/**
|
|
14
|
-
* @class MixinType
|
|
15
|
-
*/
|
|
16
|
-
exports.MixinType = function (...args) {
|
|
17
|
-
// MixinType factory
|
|
18
|
-
if (!this) {
|
|
19
|
-
return exports.MixinType[constants_js_1.DECORATOR].apply(undefined, args);
|
|
20
|
-
}
|
|
21
|
-
// Constructor
|
|
22
|
-
const [owner, initArgs, context] = args;
|
|
23
|
-
complex_type_base_js_1.ComplexTypeBase.call(this, owner, initArgs, context);
|
|
24
|
-
const _this = (0, ts_gems_1.asMutable)(this);
|
|
25
|
-
_this.kind = index_js_2.OpraSchema.MixinType.Kind;
|
|
26
|
-
_this.types = [];
|
|
27
|
-
for (const base of initArgs.types) {
|
|
28
|
-
if (_this.additionalFields !== true) {
|
|
29
|
-
if (base.additionalFields === true)
|
|
30
|
-
_this.additionalFields = true;
|
|
31
|
-
else if (!_this.additionalFields)
|
|
32
|
-
_this.additionalFields = base.additionalFields;
|
|
33
|
-
}
|
|
34
|
-
for (const v of base.fields('*')) {
|
|
35
|
-
const field = new api_field_js_1.ApiField(this, v);
|
|
36
|
-
_this._fields.set(field.name, field);
|
|
37
|
-
}
|
|
38
|
-
_this.types.push(base);
|
|
39
|
-
if (base.keyField)
|
|
40
|
-
_this.keyField = base.keyField;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @class MixinType
|
|
46
|
-
*/
|
|
47
|
-
class MixinTypeClass extends complex_type_base_js_1.ComplexTypeBase {
|
|
48
|
-
extendsFrom(baseType) {
|
|
49
|
-
if (!(baseType instanceof data_type_js_1.DataType))
|
|
50
|
-
baseType = this.node.getDataType(baseType);
|
|
51
|
-
if (!(baseType instanceof complex_type_base_js_1.ComplexTypeBase))
|
|
52
|
-
return false;
|
|
53
|
-
if (baseType === this)
|
|
54
|
-
return true;
|
|
55
|
-
for (const t of this.types) {
|
|
56
|
-
if (t.extendsFrom(baseType))
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
toJSON(options) {
|
|
62
|
-
const superJson = super.toJSON(options);
|
|
63
|
-
return (0, objects_1.omitUndefined)({
|
|
64
|
-
...superJson,
|
|
65
|
-
kind: this.kind,
|
|
66
|
-
types: this.types.map(base => {
|
|
67
|
-
const baseName = this.node.getDataTypeNameWithNs(base);
|
|
68
|
-
return baseName ? baseName : base.toJSON(options);
|
|
69
|
-
}),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
_locateBase(callback) {
|
|
73
|
-
for (const t of this.types) {
|
|
74
|
-
if (callback(t))
|
|
75
|
-
return t;
|
|
76
|
-
if (t._locateBase) {
|
|
77
|
-
const x = t._locateBase(callback);
|
|
78
|
-
if (x)
|
|
79
|
-
return x;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.MixinType.prototype = MixinTypeClass.prototype;
|
|
85
|
-
exports.MixinType[constants_js_1.DECORATOR] = MixinTypeFactory;
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
function MixinTypeFactory(clasRefs, options) {
|
|
90
|
-
// Filter undefined items
|
|
91
|
-
clasRefs = clasRefs.filter(x => typeof x === 'function');
|
|
92
|
-
if (!clasRefs.length)
|
|
93
|
-
throw new TypeError('No Class has been provided');
|
|
94
|
-
if (clasRefs.length === 1)
|
|
95
|
-
return clasRefs[0];
|
|
96
|
-
const className = clasRefs[0].name + 'Mixin';
|
|
97
|
-
const MixinClass = {
|
|
98
|
-
[className]: class {
|
|
99
|
-
constructor() {
|
|
100
|
-
for (const c of clasRefs)
|
|
101
|
-
(0, index_js_1.inheritPropertyInitializers)(this, c);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
}[className];
|
|
105
|
-
const metadata = {
|
|
106
|
-
...options,
|
|
107
|
-
kind: index_js_2.OpraSchema.MixinType.Kind,
|
|
108
|
-
types: [],
|
|
109
|
-
};
|
|
110
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, MixinClass);
|
|
111
|
-
for (const c of clasRefs) {
|
|
112
|
-
const itemMeta = Reflect.getMetadata(constants_js_1.DATATYPE_METADATA, c);
|
|
113
|
-
if (!(itemMeta &&
|
|
114
|
-
(itemMeta.kind === index_js_2.OpraSchema.ComplexType.Kind ||
|
|
115
|
-
itemMeta.kind === index_js_2.OpraSchema.MixinType.Kind ||
|
|
116
|
-
itemMeta.kind === index_js_2.OpraSchema.MappedType.Kind))) {
|
|
117
|
-
throw new TypeError(`Class "${c.name}" is not a ${index_js_2.OpraSchema.ComplexType.Kind}, ${index_js_2.OpraSchema.MixinType.Kind} or ${index_js_2.OpraSchema.MappedType.Kind}`);
|
|
118
|
-
}
|
|
119
|
-
metadata.types.push(c);
|
|
120
|
-
(0, index_js_1.mergePrototype)(MixinClass.prototype, c.prototype);
|
|
121
|
-
}
|
|
122
|
-
return MixinClass;
|
|
123
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OmitType = OmitType;
|
|
4
|
-
const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function OmitType(baseType, keys, options) {
|
|
9
|
-
return (0, create_mapped_class_js_1.createMappedClass)(baseType, { omit: keys }, options);
|
|
10
|
-
}
|