@opra/common 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/constants.js +1 -0
- package/cjs/exception/enums/issue-severity.enum.js +23 -0
- package/cjs/{types.js → exception/error-issue.js} +0 -0
- package/cjs/exception/http-errors/bad-request.error.js +22 -0
- package/cjs/exception/http-errors/failed-dependency.error.js +21 -0
- package/cjs/exception/http-errors/forbidden.error.js +23 -0
- package/cjs/exception/http-errors/internal-server.error.js +21 -0
- package/cjs/exception/http-errors/method-not-allowed.error.js +22 -0
- package/cjs/exception/http-errors/not-acceptable.error.js +22 -0
- package/cjs/exception/http-errors/not-found.error.js +25 -0
- package/cjs/exception/http-errors/unauthorized.error.js +22 -0
- package/cjs/exception/http-errors/unprocessable-entity.error.js +21 -0
- package/cjs/exception/index.js +18 -0
- package/cjs/exception/opra-exception.js +56 -0
- package/cjs/exception/resource-errors/resource-conflict.error.js +20 -0
- package/cjs/exception/resource-errors/resource-not-found.error.js +20 -0
- package/cjs/exception/wrap-exception.js +42 -0
- package/cjs/filter/antlr/OpraFilterLexer.js +386 -0
- package/cjs/filter/antlr/OpraFilterParser.js +2070 -0
- package/cjs/filter/antlr/OpraFilterVisitor.js +3 -0
- package/cjs/filter/ast/abstract/ast.js +10 -0
- package/cjs/filter/ast/abstract/expression.js +7 -0
- package/cjs/filter/ast/abstract/literal.js +14 -0
- package/cjs/filter/ast/abstract/term.js +7 -0
- package/cjs/filter/ast/expressions/arithmetic-expression.js +29 -0
- package/cjs/filter/ast/expressions/array-expression.js +15 -0
- package/cjs/filter/ast/expressions/comparison-expression.js +18 -0
- package/cjs/filter/ast/expressions/logical-expression.js +18 -0
- package/cjs/filter/ast/expressions/parentheses-expression.js +15 -0
- package/cjs/filter/ast/index.js +19 -0
- package/cjs/filter/ast/terms/boolean-literal.js +10 -0
- package/cjs/filter/ast/terms/date-literal.js +28 -0
- package/cjs/filter/ast/terms/external-constant.js +13 -0
- package/cjs/filter/ast/terms/null-literal.js +11 -0
- package/cjs/filter/ast/terms/number-literal.js +40 -0
- package/cjs/filter/ast/terms/qualified-identifier.js +10 -0
- package/cjs/filter/ast/terms/string-literal.js +14 -0
- package/cjs/filter/ast/terms/time-literal.js +33 -0
- package/cjs/filter/build.js +129 -0
- package/cjs/filter/error-listener.js +14 -0
- package/cjs/filter/errors.js +21 -0
- package/cjs/filter/filter-tree-visitor.js +113 -0
- package/cjs/filter/index.js +8 -0
- package/cjs/filter/parse.js +37 -0
- package/cjs/filter/utils.js +26 -0
- package/cjs/helpers/index.js +4 -0
- package/cjs/{responsive-map.js → helpers/responsive-map.js} +1 -1
- package/cjs/http/enums/http-headers.enum.js +404 -0
- package/cjs/http/enums/http-status.enum.js +300 -0
- package/cjs/http/http-request.js +118 -0
- package/cjs/http/index.js +9 -0
- package/cjs/http/interfaces/client-http-headers.interface.js +2 -0
- package/cjs/http/interfaces/server-http-headers.interface.js +2 -0
- package/cjs/http/multipart/batch-multipart.js +155 -0
- package/cjs/http/multipart/http-request-content.js +16 -0
- package/cjs/http/multipart/http-response-content.js +14 -0
- package/cjs/http/multipart/index.js +4 -0
- package/cjs/http/utils/normalize-headers.js +28 -0
- package/cjs/i18n/i18n.js +175 -0
- package/cjs/i18n/index.js +10 -0
- package/cjs/i18n/string-utils.js +13 -0
- package/cjs/i18n/translate.js +15 -0
- package/cjs/index.js +12 -2
- package/cjs/schema/constants.js +11 -0
- package/cjs/schema/decorators/opr-collection-resource.decorator.js +23 -0
- package/cjs/schema/decorators/opr-complex-type.decorator.js +27 -0
- package/cjs/schema/decorators/opr-field.decorator.js +28 -0
- package/cjs/schema/decorators/opr-resolver.decorator.js +81 -0
- package/cjs/schema/decorators/opr-simple-type.decorator.js +18 -0
- package/cjs/schema/decorators/opr-singleton-resource.decorator.js +23 -0
- package/cjs/schema/implementation/data-type/builtin/any.type.js +9 -0
- package/cjs/schema/implementation/data-type/builtin/base64-binary.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/bigint.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/boolean.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/date-string.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/date.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/guid.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/integer.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/number.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/object.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin/string.type.js +15 -0
- package/cjs/schema/implementation/data-type/builtin-data-types.js +37 -0
- package/cjs/schema/implementation/data-type/complex-type.js +111 -0
- package/cjs/schema/implementation/data-type/data-type.js +36 -0
- package/cjs/schema/implementation/data-type/simple-type.js +21 -0
- package/cjs/schema/implementation/data-type/union-type.js +25 -0
- package/cjs/schema/implementation/document-builder.js +140 -0
- package/cjs/schema/implementation/opra-document.js +181 -0
- package/cjs/schema/implementation/query/collection-count-query.js +19 -0
- package/cjs/schema/implementation/query/collection-create-query.js +28 -0
- package/cjs/schema/implementation/query/collection-delete-many-query.js +19 -0
- package/cjs/schema/implementation/query/collection-delete-query.js +27 -0
- package/cjs/schema/implementation/query/collection-get-query.js +38 -0
- package/cjs/schema/implementation/query/collection-search-query.js +55 -0
- package/cjs/schema/implementation/query/collection-update-many-query.js +21 -0
- package/cjs/schema/implementation/query/collection-update-query.js +39 -0
- package/cjs/schema/implementation/query/field-get-query.js +45 -0
- package/cjs/schema/implementation/query/index.js +22 -0
- package/cjs/schema/implementation/query/singleton-get-query.js +27 -0
- package/cjs/schema/implementation/resource/collection-resource-info.js +58 -0
- package/cjs/schema/implementation/resource/container-resource-info.js +30 -0
- package/cjs/schema/implementation/resource/resource-info.js +39 -0
- package/cjs/schema/implementation/resource/singleton-resource-info.js +37 -0
- package/cjs/schema/implementation/schema-builder/extract-resource-metadata.util.js +84 -0
- package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +94 -0
- package/cjs/schema/index.js +28 -0
- package/cjs/schema/interfaces/child-field-query.interface.js +2 -0
- package/cjs/schema/interfaces/data-type.metadata.js +2 -0
- package/cjs/schema/interfaces/resource-container.interface.js +2 -0
- package/cjs/schema/interfaces/resource.metadata.js +2 -0
- package/cjs/schema/opra-schema.definition.js +49 -0
- package/cjs/schema/type-helpers/extend-type.helper.js +65 -0
- package/cjs/schema/type-helpers/mixin-type.helper.js +46 -0
- package/cjs/schema/type-helpers/mixin.utils.js +32 -0
- package/cjs/schema/types.js +2 -0
- package/cjs/schema/utils/class.utils.js +8 -0
- package/cjs/schema/utils/clone-object.util.js +19 -0
- package/cjs/schema/utils/inspect.util.js +7 -0
- package/cjs/schema/utils/normalize-field-array.util.js +44 -0
- package/cjs/schema/utils/path-to-tree.util.js +26 -0
- package/cjs/schema/utils/string-compare.util.js +11 -0
- package/cjs/url/formats/boolean-format.js +25 -0
- package/cjs/url/formats/date-format.js +48 -0
- package/cjs/url/formats/filter-format.js +18 -0
- package/cjs/url/formats/format.js +6 -0
- package/cjs/url/formats/integer-format.js +20 -0
- package/cjs/url/formats/number-format.js +28 -0
- package/cjs/url/formats/string-format.js +28 -0
- package/cjs/url/index.js +8 -0
- package/cjs/url/opra-url-path-component.js +33 -0
- package/cjs/url/opra-url-path.js +128 -0
- package/cjs/url/opra-url-search-params.js +247 -0
- package/cjs/url/opra-url.js +299 -0
- package/cjs/url/utils/path-utils.js +86 -0
- package/cjs/utils/index.js +6 -0
- package/cjs/utils/is-url.js +8 -0
- package/cjs/utils/path-to-tree.js +28 -0
- package/cjs/utils/type-guards.js +46 -0
- package/esm/constants.d.ts +0 -0
- package/esm/constants.js +1 -0
- package/esm/exception/enums/issue-severity.enum.d.ts +13 -0
- package/esm/exception/enums/issue-severity.enum.js +20 -0
- package/esm/exception/error-issue.d.ts +9 -0
- package/esm/{types.js → exception/error-issue.js} +0 -0
- package/esm/exception/http-errors/bad-request.error.d.ts +10 -0
- package/esm/exception/http-errors/bad-request.error.js +18 -0
- package/esm/exception/http-errors/failed-dependency.error.d.ts +9 -0
- package/esm/exception/http-errors/failed-dependency.error.js +17 -0
- package/esm/exception/http-errors/forbidden.error.d.ts +11 -0
- package/esm/exception/http-errors/forbidden.error.js +19 -0
- package/esm/exception/http-errors/internal-server.error.d.ts +9 -0
- package/esm/exception/http-errors/internal-server.error.js +17 -0
- package/esm/exception/http-errors/method-not-allowed.error.d.ts +10 -0
- package/esm/exception/http-errors/method-not-allowed.error.js +18 -0
- package/esm/exception/http-errors/not-acceptable.error.d.ts +10 -0
- package/esm/exception/http-errors/not-acceptable.error.js +18 -0
- package/esm/exception/http-errors/not-found.error.d.ts +13 -0
- package/esm/exception/http-errors/not-found.error.js +21 -0
- package/esm/exception/http-errors/unauthorized.error.d.ts +10 -0
- package/esm/exception/http-errors/unauthorized.error.js +18 -0
- package/esm/exception/http-errors/unprocessable-entity.error.d.ts +9 -0
- package/esm/exception/http-errors/unprocessable-entity.error.js +17 -0
- package/esm/exception/index.d.ts +15 -0
- package/esm/exception/index.js +15 -0
- package/esm/exception/opra-exception.d.ts +15 -0
- package/esm/exception/opra-exception.js +52 -0
- package/esm/exception/resource-errors/resource-conflict.error.d.ts +5 -0
- package/esm/exception/resource-errors/resource-conflict.error.js +16 -0
- package/esm/exception/resource-errors/resource-not-found.error.d.ts +4 -0
- package/esm/exception/resource-errors/resource-not-found.error.js +16 -0
- package/esm/exception/wrap-exception.d.ts +2 -0
- package/esm/exception/wrap-exception.js +38 -0
- package/esm/filter/antlr/OpraFilterLexer.d.ts +78 -0
- package/esm/filter/antlr/OpraFilterLexer.js +381 -0
- package/esm/filter/antlr/OpraFilterParser.d.ts +365 -0
- package/esm/filter/antlr/OpraFilterParser.js +2022 -0
- package/esm/filter/antlr/OpraFilterVisitor.d.ts +290 -0
- package/esm/filter/antlr/OpraFilterVisitor.js +2 -0
- package/esm/filter/ast/abstract/ast.d.ts +5 -0
- package/esm/filter/ast/abstract/ast.js +6 -0
- package/esm/filter/ast/abstract/expression.d.ts +3 -0
- package/esm/filter/ast/abstract/expression.js +3 -0
- package/esm/filter/ast/abstract/literal.d.ts +6 -0
- package/esm/filter/ast/abstract/literal.js +10 -0
- package/esm/filter/ast/abstract/term.d.ts +3 -0
- package/esm/filter/ast/abstract/term.js +3 -0
- package/esm/filter/ast/expressions/arithmetic-expression.d.ts +13 -0
- package/esm/filter/ast/expressions/arithmetic-expression.js +24 -0
- package/esm/filter/ast/expressions/array-expression.d.ts +7 -0
- package/esm/filter/ast/expressions/array-expression.js +11 -0
- package/esm/filter/ast/expressions/comparison-expression.d.ts +10 -0
- package/esm/filter/ast/expressions/comparison-expression.js +14 -0
- package/esm/filter/ast/expressions/logical-expression.d.ts +8 -0
- package/esm/filter/ast/expressions/logical-expression.js +14 -0
- package/esm/filter/ast/expressions/parentheses-expression.d.ts +6 -0
- package/esm/filter/ast/expressions/parentheses-expression.js +11 -0
- package/esm/filter/ast/index.d.ts +16 -0
- package/esm/filter/ast/index.js +16 -0
- package/esm/filter/ast/terms/boolean-literal.d.ts +5 -0
- package/esm/filter/ast/terms/boolean-literal.js +6 -0
- package/esm/filter/ast/terms/date-literal.d.ts +6 -0
- package/esm/filter/ast/terms/date-literal.js +24 -0
- package/esm/filter/ast/terms/external-constant.d.ts +5 -0
- package/esm/filter/ast/terms/external-constant.js +9 -0
- package/esm/filter/ast/terms/null-literal.d.ts +5 -0
- package/esm/filter/ast/terms/null-literal.js +7 -0
- package/esm/filter/ast/terms/number-literal.d.ts +6 -0
- package/esm/filter/ast/terms/number-literal.js +36 -0
- package/esm/filter/ast/terms/qualified-identifier.d.ts +4 -0
- package/esm/filter/ast/terms/qualified-identifier.js +6 -0
- package/esm/filter/ast/terms/string-literal.d.ts +5 -0
- package/esm/filter/ast/terms/string-literal.js +10 -0
- package/esm/filter/ast/terms/time-literal.d.ts +6 -0
- package/esm/filter/ast/terms/time-literal.js +29 -0
- package/esm/filter/build.d.ts +31 -0
- package/esm/filter/build.js +105 -0
- package/esm/filter/error-listener.d.ts +8 -0
- package/esm/filter/error-listener.js +10 -0
- package/esm/filter/errors.d.ts +20 -0
- package/esm/filter/errors.js +15 -0
- package/esm/filter/filter-tree-visitor.d.ts +30 -0
- package/esm/filter/filter-tree-visitor.js +109 -0
- package/esm/filter/index.d.ts +5 -0
- package/esm/filter/index.js +5 -0
- package/esm/filter/parse.d.ts +2 -0
- package/esm/filter/parse.js +33 -0
- package/esm/filter/utils.d.ts +2 -0
- package/esm/filter/utils.js +21 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/{responsive-map.d.ts → helpers/responsive-map.d.ts} +0 -0
- package/esm/{responsive-map.js → helpers/responsive-map.js} +1 -1
- package/esm/http/enums/http-headers.enum.d.ts +379 -0
- package/esm/http/enums/http-headers.enum.js +401 -0
- package/esm/http/enums/http-status.enum.d.ts +290 -0
- package/esm/http/enums/http-status.enum.js +297 -0
- package/esm/http/http-request.d.ts +34 -0
- package/esm/http/http-request.js +114 -0
- package/esm/http/index.d.ts +6 -0
- package/esm/http/index.js +6 -0
- package/esm/http/interfaces/client-http-headers.interface.d.ts +65 -0
- package/esm/http/interfaces/client-http-headers.interface.js +1 -0
- package/esm/http/interfaces/server-http-headers.interface.d.ts +1 -0
- package/esm/http/interfaces/server-http-headers.interface.js +1 -0
- package/esm/http/multipart/batch-multipart.d.ts +30 -0
- package/esm/http/multipart/batch-multipart.js +150 -0
- package/esm/http/multipart/http-request-content.d.ts +8 -0
- package/esm/http/multipart/http-request-content.js +12 -0
- package/esm/http/multipart/http-response-content.d.ts +7 -0
- package/esm/http/multipart/http-response-content.js +10 -0
- package/esm/http/multipart/index.d.ts +1 -0
- package/esm/http/multipart/index.js +1 -0
- package/esm/http/utils/normalize-headers.d.ts +1 -0
- package/esm/http/utils/normalize-headers.js +24 -0
- package/esm/i18n/i18n.d.ts +28 -0
- package/esm/i18n/i18n.js +170 -0
- package/esm/i18n/index.d.ts +5 -0
- package/esm/i18n/index.js +6 -0
- package/esm/i18n/string-utils.d.ts +2 -0
- package/esm/i18n/string-utils.js +8 -0
- package/esm/i18n/translate.d.ts +4 -0
- package/esm/i18n/translate.js +11 -0
- package/esm/index.d.ts +10 -2
- package/esm/index.js +10 -2
- package/esm/schema/constants.d.ts +8 -0
- package/esm/schema/constants.js +8 -0
- package/esm/schema/decorators/opr-collection-resource.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-collection-resource.decorator.js +19 -0
- package/esm/schema/decorators/opr-complex-type.decorator.d.ts +6 -0
- package/esm/schema/decorators/opr-complex-type.decorator.js +23 -0
- package/esm/schema/decorators/opr-field.decorator.d.ts +3 -0
- package/esm/schema/decorators/opr-field.decorator.js +24 -0
- package/esm/schema/decorators/opr-resolver.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-resolver.decorator.js +71 -0
- package/esm/schema/decorators/opr-simple-type.decorator.d.ts +6 -0
- package/esm/schema/decorators/opr-simple-type.decorator.js +14 -0
- package/esm/schema/decorators/opr-singleton-resource.decorator.d.ts +8 -0
- package/esm/schema/decorators/opr-singleton-resource.decorator.js +19 -0
- package/esm/schema/implementation/data-type/builtin/any.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/any.type.js +6 -0
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/base64-binary.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/bigint.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/bigint.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/boolean.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/boolean.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/date-string.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/date-string.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/date.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/date.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/guid.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/guid.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/integer.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/integer.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/number.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/number.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/object.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/object.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin/string.type.d.ts +2 -0
- package/esm/schema/implementation/data-type/builtin/string.type.js +12 -0
- package/esm/schema/implementation/data-type/builtin-data-types.d.ts +4 -0
- package/esm/schema/implementation/data-type/builtin-data-types.js +34 -0
- package/esm/schema/implementation/data-type/complex-type.d.ts +29 -0
- package/esm/schema/implementation/data-type/complex-type.js +107 -0
- package/esm/schema/implementation/data-type/data-type.d.ts +16 -0
- package/esm/schema/implementation/data-type/data-type.js +32 -0
- package/esm/schema/implementation/data-type/simple-type.d.ts +12 -0
- package/esm/schema/implementation/data-type/simple-type.js +17 -0
- package/esm/schema/implementation/data-type/union-type.d.ts +16 -0
- package/esm/schema/implementation/data-type/union-type.js +21 -0
- package/esm/schema/implementation/document-builder.d.ts +16 -0
- package/esm/schema/implementation/document-builder.js +135 -0
- package/esm/schema/implementation/opra-document.d.ts +44 -0
- package/esm/schema/implementation/opra-document.js +177 -0
- package/esm/schema/implementation/query/collection-count-query.d.ts +14 -0
- package/esm/schema/implementation/query/collection-count-query.js +15 -0
- package/esm/schema/implementation/query/collection-create-query.d.ts +18 -0
- package/esm/schema/implementation/query/collection-create-query.js +24 -0
- package/esm/schema/implementation/query/collection-delete-many-query.d.ts +14 -0
- package/esm/schema/implementation/query/collection-delete-many-query.js +15 -0
- package/esm/schema/implementation/query/collection-delete-query.d.ts +10 -0
- package/esm/schema/implementation/query/collection-delete-query.js +23 -0
- package/esm/schema/implementation/query/collection-get-query.d.ts +21 -0
- package/esm/schema/implementation/query/collection-get-query.js +34 -0
- package/esm/schema/implementation/query/collection-search-query.d.ts +30 -0
- package/esm/schema/implementation/query/collection-search-query.js +51 -0
- package/esm/schema/implementation/query/collection-update-many-query.d.ts +15 -0
- package/esm/schema/implementation/query/collection-update-many-query.js +17 -0
- package/esm/schema/implementation/query/collection-update-query.d.ts +19 -0
- package/esm/schema/implementation/query/collection-update-query.js +35 -0
- package/esm/schema/implementation/query/field-get-query.d.ts +30 -0
- package/esm/schema/implementation/query/field-get-query.js +41 -0
- package/esm/schema/implementation/query/index.d.ts +27 -0
- package/esm/schema/implementation/query/index.js +17 -0
- package/esm/schema/implementation/query/singleton-get-query.d.ts +20 -0
- package/esm/schema/implementation/query/singleton-get-query.js +23 -0
- package/esm/schema/implementation/resource/collection-resource-info.d.ts +19 -0
- package/esm/schema/implementation/resource/collection-resource-info.js +54 -0
- package/esm/schema/implementation/resource/container-resource-info.d.ts +13 -0
- package/esm/schema/implementation/resource/container-resource-info.js +26 -0
- package/esm/schema/implementation/resource/resource-info.d.ts +17 -0
- package/esm/schema/implementation/resource/resource-info.js +35 -0
- package/esm/schema/implementation/resource/singleton-resource-info.d.ts +14 -0
- package/esm/schema/implementation/resource/singleton-resource-info.js +33 -0
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +3 -0
- package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.js +80 -0
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +4 -0
- package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +89 -0
- package/esm/schema/index.d.ts +25 -0
- package/esm/schema/index.js +25 -0
- package/esm/schema/interfaces/child-field-query.interface.d.ts +4 -0
- package/esm/schema/interfaces/child-field-query.interface.js +1 -0
- package/esm/schema/interfaces/data-type.metadata.d.ts +18 -0
- package/esm/schema/interfaces/data-type.metadata.js +1 -0
- package/esm/schema/interfaces/resource-container.interface.d.ts +8 -0
- package/esm/schema/interfaces/resource-container.interface.js +1 -0
- package/esm/schema/interfaces/resource.metadata.d.ts +18 -0
- package/esm/schema/interfaces/resource.metadata.js +1 -0
- package/esm/schema/opra-schema.definition.d.ts +178 -0
- package/esm/schema/opra-schema.definition.js +46 -0
- package/esm/schema/type-helpers/extend-type.helper.d.ts +3 -0
- package/esm/schema/type-helpers/extend-type.helper.js +59 -0
- package/esm/schema/type-helpers/mixin-type.helper.d.ts +2 -0
- package/esm/schema/type-helpers/mixin-type.helper.js +41 -0
- package/esm/schema/type-helpers/mixin.utils.d.ts +3 -0
- package/esm/schema/type-helpers/mixin.utils.js +27 -0
- package/esm/{types.d.ts → schema/types.d.ts} +8 -1
- package/esm/schema/types.js +1 -0
- package/esm/schema/utils/class.utils.d.ts +2 -0
- package/esm/schema/utils/class.utils.js +4 -0
- package/esm/schema/utils/clone-object.util.d.ts +1 -0
- package/esm/schema/utils/clone-object.util.js +14 -0
- package/esm/schema/utils/inspect.util.d.ts +4 -0
- package/esm/schema/utils/inspect.util.js +4 -0
- package/esm/schema/utils/normalize-field-array.util.d.ts +3 -0
- package/esm/schema/utils/normalize-field-array.util.js +40 -0
- package/esm/schema/utils/path-to-tree.util.d.ts +4 -0
- package/esm/schema/utils/path-to-tree.util.js +22 -0
- package/esm/schema/utils/string-compare.util.d.ts +1 -0
- package/esm/schema/utils/string-compare.util.js +7 -0
- package/esm/url/formats/boolean-format.d.ts +5 -0
- package/esm/url/formats/boolean-format.js +21 -0
- package/esm/url/formats/date-format.d.ts +16 -0
- package/esm/url/formats/date-format.js +44 -0
- package/esm/url/formats/filter-format.d.ts +6 -0
- package/esm/url/formats/filter-format.js +14 -0
- package/esm/url/formats/format.d.ts +4 -0
- package/esm/url/formats/format.js +2 -0
- package/esm/url/formats/integer-format.d.ts +9 -0
- package/esm/url/formats/integer-format.js +16 -0
- package/esm/url/formats/number-format.d.ts +12 -0
- package/esm/url/formats/number-format.js +24 -0
- package/esm/url/formats/string-format.d.ts +14 -0
- package/esm/url/formats/string-format.js +24 -0
- package/esm/url/index.d.ts +5 -0
- package/esm/url/index.js +5 -0
- package/esm/url/opra-url-path-component.d.ts +15 -0
- package/esm/url/opra-url-path-component.js +29 -0
- package/esm/url/opra-url-path.d.ts +30 -0
- package/esm/url/opra-url-path.js +124 -0
- package/esm/url/opra-url-search-params.d.ts +46 -0
- package/esm/url/opra-url-search-params.js +243 -0
- package/esm/url/opra-url.d.ts +79 -0
- package/esm/url/opra-url.js +295 -0
- package/esm/url/utils/path-utils.d.ts +8 -0
- package/esm/url/utils/path-utils.js +78 -0
- package/esm/utils/index.d.ts +3 -0
- package/esm/utils/index.js +3 -0
- package/esm/utils/is-url.d.ts +1 -0
- package/esm/utils/is-url.js +4 -0
- package/esm/utils/path-to-tree.d.ts +4 -0
- package/esm/utils/path-to-tree.js +24 -0
- package/esm/utils/type-guards.d.ts +9 -0
- package/esm/utils/type-guards.js +37 -0
- package/package.json +30 -10
- package/umd/opra-common.umd.min.js +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
const trueValues = ['true', 't', 'yes', 'y', '1'];
|
|
3
|
+
const falseValues = ['false', 'f', 'no', 'n', '0'];
|
|
4
|
+
export class BooleanFormat extends Format {
|
|
5
|
+
parse(value) {
|
|
6
|
+
if (value === '')
|
|
7
|
+
return true;
|
|
8
|
+
// noinspection SuspiciousTypeOfGuard
|
|
9
|
+
if (typeof value === 'boolean')
|
|
10
|
+
return value;
|
|
11
|
+
if (trueValues.includes(value.toLowerCase()))
|
|
12
|
+
return true;
|
|
13
|
+
if (falseValues.includes(value.toLowerCase()))
|
|
14
|
+
return false;
|
|
15
|
+
throw new TypeError(`"${value}" is not a valid boolean`);
|
|
16
|
+
}
|
|
17
|
+
stringify(value) {
|
|
18
|
+
return typeof value === 'boolean' ?
|
|
19
|
+
(value ? 'true' : 'false') : '';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
export interface DateFormatOptions {
|
|
3
|
+
time?: boolean;
|
|
4
|
+
timeZone?: boolean;
|
|
5
|
+
min?: string;
|
|
6
|
+
max?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class DateFormat extends Format {
|
|
9
|
+
time: boolean;
|
|
10
|
+
timeZone: boolean;
|
|
11
|
+
min?: string;
|
|
12
|
+
max?: string;
|
|
13
|
+
constructor(options?: DateFormatOptions);
|
|
14
|
+
parse(value: string): string;
|
|
15
|
+
stringify(value: any): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import { Format } from './format.js';
|
|
3
|
+
// noinspection RegExpUnnecessaryNonCapturingGroup
|
|
4
|
+
const DATE_FORMAT_PATTERN = /^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;
|
|
5
|
+
export class DateFormat extends Format {
|
|
6
|
+
time;
|
|
7
|
+
timeZone;
|
|
8
|
+
min;
|
|
9
|
+
max;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
super();
|
|
12
|
+
this.max = options?.max ? coerceToDateString(options.max) : undefined;
|
|
13
|
+
this.min = options?.min ? coerceToDateString(options.min) : undefined;
|
|
14
|
+
this.time = options?.time ?? true;
|
|
15
|
+
this.timeZone = options?.timeZone ?? true;
|
|
16
|
+
}
|
|
17
|
+
parse(value) {
|
|
18
|
+
const v = coerceToDateString(value, this.time, this.timeZone);
|
|
19
|
+
if (this.min != null && v < this.min)
|
|
20
|
+
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
21
|
+
if (this.max != null && v > this.max)
|
|
22
|
+
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
23
|
+
return v;
|
|
24
|
+
}
|
|
25
|
+
stringify(value) {
|
|
26
|
+
return coerceToDateString(value, this.time, this.timeZone);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function coerceToDateString(value, time, timeZone) {
|
|
30
|
+
if (value === '' || value == null)
|
|
31
|
+
return '';
|
|
32
|
+
const m = value.match(DATE_FORMAT_PATTERN);
|
|
33
|
+
if (!m)
|
|
34
|
+
throw new TypeError(`"${value}" is not a valid date.`);
|
|
35
|
+
let v = m[1] + '-' + (m[2] || '01') + '-' + (m[3] || '01');
|
|
36
|
+
if (time) {
|
|
37
|
+
v += 'T' + (m[4] || '00') + ':' + (m[5] || '00') + ':' + (m[6] || '00') +
|
|
38
|
+
(m[7] ? '.' + m[7] : '');
|
|
39
|
+
if (timeZone)
|
|
40
|
+
v += m[8] ? 'Z' :
|
|
41
|
+
(m[9] ? (m[9] + (m[10] || '00') + ':' + (m[11] || '00')) : '');
|
|
42
|
+
}
|
|
43
|
+
return v;
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Expression } from '../../filter/ast/index.js';
|
|
2
|
+
import { parseFilter } from '../../filter/parse.js';
|
|
3
|
+
import { Format } from './format.js';
|
|
4
|
+
export class FilterFormat extends Format {
|
|
5
|
+
parse(value) {
|
|
6
|
+
if (value instanceof Expression)
|
|
7
|
+
return value;
|
|
8
|
+
return parseFilter(value);
|
|
9
|
+
}
|
|
10
|
+
stringify(value) {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
return value ? '' + value : '';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NumberFormat, NumberFormatOptions } from './number-format.js';
|
|
2
|
+
export interface IntegerFormatOptions extends NumberFormatOptions {
|
|
3
|
+
enum?: number[];
|
|
4
|
+
}
|
|
5
|
+
export declare class IntegerFormat extends NumberFormat {
|
|
6
|
+
enum?: number[];
|
|
7
|
+
constructor(options?: IntegerFormatOptions);
|
|
8
|
+
parse(value: string): number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NumberFormat } from './number-format.js';
|
|
2
|
+
export class IntegerFormat extends NumberFormat {
|
|
3
|
+
enum;
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super(options);
|
|
6
|
+
this.enum = options?.enum;
|
|
7
|
+
}
|
|
8
|
+
parse(value) {
|
|
9
|
+
const v = super.parse(value);
|
|
10
|
+
if (!Number.isInteger(v))
|
|
11
|
+
throw new TypeError(`"${value}" is not a valid integer`);
|
|
12
|
+
if (this.enum && !this.enum.includes(v))
|
|
13
|
+
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
14
|
+
return v;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
export interface NumberFormatOptions {
|
|
3
|
+
max?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class NumberFormat extends Format {
|
|
7
|
+
max?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
constructor(options?: NumberFormatOptions);
|
|
10
|
+
parse(value: string): number;
|
|
11
|
+
stringify(value: any): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
export class NumberFormat extends Format {
|
|
3
|
+
max;
|
|
4
|
+
min;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super();
|
|
7
|
+
this.max = options?.max;
|
|
8
|
+
this.min = options?.min;
|
|
9
|
+
}
|
|
10
|
+
parse(value) {
|
|
11
|
+
// noinspection SuspiciousTypeOfGuard
|
|
12
|
+
const v = typeof value === 'number' ? value : parseFloat(value);
|
|
13
|
+
if (isNaN(v))
|
|
14
|
+
throw new TypeError(`"${value}" is not a valid number`);
|
|
15
|
+
if (this.min != null && v < this.min)
|
|
16
|
+
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
17
|
+
if (this.max != null && v > this.max)
|
|
18
|
+
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
19
|
+
return v;
|
|
20
|
+
}
|
|
21
|
+
stringify(value) {
|
|
22
|
+
return typeof value === 'number' ? '' + value : '';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
export interface StringFormatOptions {
|
|
3
|
+
maxLength?: number;
|
|
4
|
+
minLength?: number;
|
|
5
|
+
enum?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class StringFormat extends Format {
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minLength?: number;
|
|
10
|
+
enum?: string[];
|
|
11
|
+
constructor(options?: StringFormatOptions);
|
|
12
|
+
parse(value: string): string;
|
|
13
|
+
stringify(value: any): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Format } from './format.js';
|
|
2
|
+
export class StringFormat extends Format {
|
|
3
|
+
maxLength;
|
|
4
|
+
minLength;
|
|
5
|
+
enum;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super();
|
|
8
|
+
this.maxLength = options?.maxLength;
|
|
9
|
+
this.minLength = options?.minLength;
|
|
10
|
+
this.enum = options?.enum;
|
|
11
|
+
}
|
|
12
|
+
parse(value) {
|
|
13
|
+
if (this.minLength != null && value.length < this.minLength)
|
|
14
|
+
throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength > 1 ? 's' : ''} long.`);
|
|
15
|
+
if (this.maxLength != null && value.length > this.maxLength)
|
|
16
|
+
throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength > 1 ? 's' : ''} long.`);
|
|
17
|
+
if (this.enum && !this.enum.includes(value))
|
|
18
|
+
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
stringify(value) {
|
|
22
|
+
return value == null ? '' : '' + value;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/esm/url/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const nodeInspectCustom: unique symbol;
|
|
2
|
+
export declare type OpraURLPathComponentInit = {
|
|
3
|
+
resource: string;
|
|
4
|
+
key?: any;
|
|
5
|
+
typeCast?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class OpraURLPathComponent {
|
|
8
|
+
resource: string;
|
|
9
|
+
key?: any;
|
|
10
|
+
typeCast?: string;
|
|
11
|
+
constructor(init: OpraURLPathComponentInit);
|
|
12
|
+
toString(): string;
|
|
13
|
+
[nodeInspectCustom](): any;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { encodePathComponent } from './utils/path-utils.js';
|
|
2
|
+
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
3
|
+
export class OpraURLPathComponent {
|
|
4
|
+
resource;
|
|
5
|
+
key;
|
|
6
|
+
typeCast;
|
|
7
|
+
constructor(init) {
|
|
8
|
+
this.resource = init.resource;
|
|
9
|
+
this.key = init.key;
|
|
10
|
+
this.typeCast = init.typeCast;
|
|
11
|
+
}
|
|
12
|
+
toString() {
|
|
13
|
+
const obj = encodePathComponent(this.resource, this.key, this.typeCast);
|
|
14
|
+
if (obj)
|
|
15
|
+
Object.setPrototypeOf(obj, OpraURLPathComponent.prototype);
|
|
16
|
+
return obj;
|
|
17
|
+
}
|
|
18
|
+
/* istanbul ignore next */
|
|
19
|
+
[nodeInspectCustom]() {
|
|
20
|
+
const out = {
|
|
21
|
+
resource: this.resource,
|
|
22
|
+
};
|
|
23
|
+
if (this.key != null)
|
|
24
|
+
out.key = this.key;
|
|
25
|
+
if (this.typeCast != null)
|
|
26
|
+
out.typeCast = this.typeCast;
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { OpraURLPathComponent, OpraURLPathComponentInit } from './opra-url-path-component.js';
|
|
4
|
+
declare const nodeInspectCustom: unique symbol;
|
|
5
|
+
export declare class OpraURLPath extends EventEmitter {
|
|
6
|
+
private _entries;
|
|
7
|
+
constructor(...components: (OpraURLPathComponent | OpraURLPathComponentInit)[]);
|
|
8
|
+
constructor(init?: string | OpraURLPath | URL | OpraURLPathComponent | OpraURLPathComponentInit);
|
|
9
|
+
get size(): number;
|
|
10
|
+
add(component: OpraURLPathComponent | {
|
|
11
|
+
resource: string;
|
|
12
|
+
key?: any;
|
|
13
|
+
typeCast?: string;
|
|
14
|
+
}): void;
|
|
15
|
+
add(name: string, key?: any, typeCast?: string): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
get(index: number): OpraURLPathComponent;
|
|
18
|
+
join(pathString: string): this;
|
|
19
|
+
entries(): IterableIterator<[OpraURLPathComponent, number]>;
|
|
20
|
+
values(): IterableIterator<OpraURLPathComponent>;
|
|
21
|
+
forEach(callback: (name: string, key: any, _this: this) => void): void;
|
|
22
|
+
getResource(index: number): string | undefined;
|
|
23
|
+
getKey(index: number): any;
|
|
24
|
+
toString(): string;
|
|
25
|
+
[Symbol.iterator](): IterableIterator<[OpraURLPathComponent, number]>;
|
|
26
|
+
[nodeInspectCustom](): OpraURLPathComponent[];
|
|
27
|
+
protected _add(component: any, key?: any, typeCast?: string): void;
|
|
28
|
+
protected _parse(v: string): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { tokenize } from 'fast-tokenizer';
|
|
3
|
+
import { isURL } from '../utils/index.js';
|
|
4
|
+
import { OpraURLPathComponent } from './opra-url-path-component.js';
|
|
5
|
+
import { decodePathComponent, encodePathComponent, normalizePath } from './utils/path-utils.js';
|
|
6
|
+
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
7
|
+
export class OpraURLPath extends EventEmitter {
|
|
8
|
+
_entries = [];
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super();
|
|
11
|
+
for (const x of args) {
|
|
12
|
+
if (isURL(x)) {
|
|
13
|
+
this._parse(x.pathname);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
// noinspection SuspiciousTypeOfGuard
|
|
17
|
+
if (x instanceof OpraURLPath)
|
|
18
|
+
this._entries.push(...x._entries);
|
|
19
|
+
else
|
|
20
|
+
this.add(x);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
get size() {
|
|
24
|
+
return this._entries.length;
|
|
25
|
+
}
|
|
26
|
+
add(component, key, typeCast) {
|
|
27
|
+
this._add(component, key, typeCast);
|
|
28
|
+
this.emit('change');
|
|
29
|
+
}
|
|
30
|
+
clear() {
|
|
31
|
+
this._entries = [];
|
|
32
|
+
this.emit('change');
|
|
33
|
+
}
|
|
34
|
+
get(index) {
|
|
35
|
+
return this._entries[index];
|
|
36
|
+
}
|
|
37
|
+
join(pathString) {
|
|
38
|
+
const pathTokenizer = tokenize(normalizePath(pathString, true), {
|
|
39
|
+
delimiters: '/', quotes: true, brackets: true,
|
|
40
|
+
});
|
|
41
|
+
for (const x of pathTokenizer) {
|
|
42
|
+
const p = decodePathComponent(x);
|
|
43
|
+
this._add(p);
|
|
44
|
+
}
|
|
45
|
+
this.emit('change');
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
entries() {
|
|
49
|
+
let i = -1;
|
|
50
|
+
const arr = [...this._entries];
|
|
51
|
+
return {
|
|
52
|
+
[Symbol.iterator]() {
|
|
53
|
+
return this;
|
|
54
|
+
},
|
|
55
|
+
next() {
|
|
56
|
+
i++;
|
|
57
|
+
return {
|
|
58
|
+
done: i >= arr.length,
|
|
59
|
+
value: [arr[i], i]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
values() {
|
|
65
|
+
let i = -1;
|
|
66
|
+
const arr = [...this._entries];
|
|
67
|
+
return {
|
|
68
|
+
[Symbol.iterator]() {
|
|
69
|
+
return this;
|
|
70
|
+
},
|
|
71
|
+
next() {
|
|
72
|
+
i++;
|
|
73
|
+
return {
|
|
74
|
+
done: i >= arr.length,
|
|
75
|
+
value: arr[i]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
forEach(callback) {
|
|
81
|
+
for (const item of this._entries) {
|
|
82
|
+
callback.call(this, item.resource, item.key, this);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
getResource(index) {
|
|
86
|
+
const v = this._entries[index];
|
|
87
|
+
return v == null ? undefined : v.resource;
|
|
88
|
+
}
|
|
89
|
+
getKey(index) {
|
|
90
|
+
const v = this._entries[index];
|
|
91
|
+
return v == null ? undefined : v.key;
|
|
92
|
+
}
|
|
93
|
+
toString() {
|
|
94
|
+
return this._entries.map(x => encodePathComponent(x.resource, x.key, x.typeCast)).join('/');
|
|
95
|
+
}
|
|
96
|
+
[Symbol.iterator]() {
|
|
97
|
+
return this.entries();
|
|
98
|
+
}
|
|
99
|
+
/* istanbul ignore next */
|
|
100
|
+
[nodeInspectCustom]() {
|
|
101
|
+
return this._entries;
|
|
102
|
+
}
|
|
103
|
+
_add(component, key, typeCast) {
|
|
104
|
+
if (component instanceof OpraURLPathComponent) {
|
|
105
|
+
this._entries.push(component);
|
|
106
|
+
}
|
|
107
|
+
else if (typeof component === 'object')
|
|
108
|
+
this._entries.push(new OpraURLPathComponent(component));
|
|
109
|
+
else
|
|
110
|
+
this._entries.push(new OpraURLPathComponent({ resource: component, key, typeCast }));
|
|
111
|
+
}
|
|
112
|
+
_parse(v) {
|
|
113
|
+
if (!v)
|
|
114
|
+
return;
|
|
115
|
+
const pathTokenizer = tokenize(v, { delimiters: '/', quotes: true, brackets: true });
|
|
116
|
+
for (const x of pathTokenizer) {
|
|
117
|
+
if (!x)
|
|
118
|
+
continue;
|
|
119
|
+
const p = decodePathComponent(x);
|
|
120
|
+
this._add(p);
|
|
121
|
+
}
|
|
122
|
+
this.emit('change');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { StrictOmit } from 'ts-gems';
|
|
5
|
+
import { URLSearchParams } from 'url';
|
|
6
|
+
import { ResponsiveMap } from '../helpers/index.js';
|
|
7
|
+
import { Format } from './formats/format.js';
|
|
8
|
+
declare const nodeInspectCustom: unique symbol;
|
|
9
|
+
interface OpraURLSearchParamItem {
|
|
10
|
+
name: string;
|
|
11
|
+
format?: Format | string;
|
|
12
|
+
array?: boolean | 'strict';
|
|
13
|
+
arrayDelimiter?: string;
|
|
14
|
+
minArrayItems?: number;
|
|
15
|
+
maxArrayItems?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare class OpraURLSearchParams extends EventEmitter {
|
|
18
|
+
protected _params: ResponsiveMap<string, OpraURLSearchParamItem>;
|
|
19
|
+
private _entries;
|
|
20
|
+
private _size;
|
|
21
|
+
constructor(init?: (string | URLSearchParams | OpraURLSearchParams));
|
|
22
|
+
get size(): number;
|
|
23
|
+
addAll(values: URLSearchParams | OpraURLSearchParams | Map<string, any> | Record<string, any>): void;
|
|
24
|
+
append(name: string, value?: any): void;
|
|
25
|
+
clear(): void;
|
|
26
|
+
defineParam(name: string, options?: StrictOmit<OpraURLSearchParamItem, 'name'>): this;
|
|
27
|
+
delete(name: string): void;
|
|
28
|
+
entries(): IterableIterator<[string, any]>;
|
|
29
|
+
forEach(callback: (value: any, name: string, _this: this) => void): void;
|
|
30
|
+
get(name: string, index?: number): any | null;
|
|
31
|
+
getAll(name: string): any[];
|
|
32
|
+
has(name: string): boolean;
|
|
33
|
+
keys(): IterableIterator<string>;
|
|
34
|
+
set(name: string, value?: any): void;
|
|
35
|
+
sort(compareFn?: (a: string, b: string) => number): void;
|
|
36
|
+
values(): IterableIterator<any>;
|
|
37
|
+
toString(): string;
|
|
38
|
+
parse(input: string): void;
|
|
39
|
+
toURLSearchParams(): URLSearchParams;
|
|
40
|
+
[Symbol.iterator](): IterableIterator<[string, any]>;
|
|
41
|
+
get [Symbol.toStringTag](): string;
|
|
42
|
+
[nodeInspectCustom](): ResponsiveMap<string, any[]>;
|
|
43
|
+
protected _delete(name: string): boolean;
|
|
44
|
+
protected _add(name: string, value: any): boolean;
|
|
45
|
+
}
|
|
46
|
+
export {};
|