keq 2.8.14 → 2.10.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/CHANGELOG.md +14 -0
- package/dist/esm/src/constant.d.ts +2 -0
- package/dist/esm/src/constant.js +2 -0
- package/dist/esm/src/core.d.ts +30 -0
- package/dist/esm/src/core.js +162 -53
- package/dist/esm/src/create-request.js +2 -0
- package/dist/esm/src/exception/abort.exception.d.ts +3 -0
- package/dist/esm/src/exception/abort.exception.js +6 -0
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/is/is-abort-signal.d.ts +1 -0
- package/dist/esm/src/is/is-abort-signal.js +8 -0
- package/dist/esm/src/middlewares/fetch-arguments-middleware.js +5 -1
- package/dist/esm/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
- package/dist/esm/src/middlewares/mutex-flow-control-middleware.js +22 -0
- package/dist/esm/src/middlewares/retry-middleware.js +20 -3
- package/dist/esm/src/middlewares/timeout-middleware.js +3 -1
- package/dist/esm/src/types/keq-context.d.ts +10 -1
- package/dist/esm/src/types/keq-context.js +1 -1
- package/dist/esm/src/types/keq-flow-control.d.ts +1 -1
- package/dist/esm/src/types/keq-global.d.ts +1 -0
- package/dist/umd/src/constant.d.ts +2 -0
- package/dist/umd/src/constant.js +3 -1
- package/dist/umd/src/core.d.ts +30 -0
- package/dist/umd/src/core.js +162 -53
- package/dist/umd/src/create-request.js +3 -1
- package/dist/umd/src/exception/abort.exception.d.ts +3 -0
- package/dist/umd/src/exception/abort.exception.js +20 -0
- package/dist/umd/src/index.d.ts +1 -0
- package/dist/umd/src/index.js +4 -2
- package/dist/umd/src/is/is-abort-signal.d.ts +1 -0
- package/dist/umd/src/is/is-abort-signal.js +22 -0
- package/dist/umd/src/middlewares/fetch-arguments-middleware.js +4 -0
- package/dist/umd/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
- package/dist/umd/src/middlewares/mutex-flow-control-middleware.js +36 -0
- package/dist/umd/src/middlewares/retry-middleware.js +21 -4
- package/dist/umd/src/middlewares/timeout-middleware.js +4 -2
- package/dist/umd/src/types/keq-context.d.ts +10 -1
- package/dist/umd/src/types/keq-flow-control.d.ts +1 -1
- package/dist/umd/src/types/keq-global.d.ts +1 -0
- package/package.json +10 -13
- package/packages/cache/.turbo/turbo-build.log +0 -14
- package/packages/cache/dist/cache-entry/cache-entry.d.ts +0 -17
- package/packages/cache/dist/cache-entry/cache-entry.d.ts.map +0 -1
- package/packages/cache/dist/cache-entry/index.d.ts +0 -4
- package/packages/cache/dist/cache-entry/index.d.ts.map +0 -1
- package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts +0 -8
- package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts.map +0 -1
- package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts +0 -7
- package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts.map +0 -1
- package/packages/cache/dist/cache.d.ts +0 -44
- package/packages/cache/dist/cache.d.ts.map +0 -1
- package/packages/cache/dist/constants/eviction.enum.d.ts +0 -7
- package/packages/cache/dist/constants/eviction.enum.d.ts.map +0 -1
- package/packages/cache/dist/constants/index.d.ts +0 -5
- package/packages/cache/dist/constants/index.d.ts.map +0 -1
- package/packages/cache/dist/constants/max-expired-at.d.ts +0 -2
- package/packages/cache/dist/constants/max-expired-at.d.ts.map +0 -1
- package/packages/cache/dist/constants/size.enum.d.ts +0 -7
- package/packages/cache/dist/constants/size.enum.d.ts.map +0 -1
- package/packages/cache/dist/constants/strategy.enum.d.ts +0 -7
- package/packages/cache/dist/constants/strategy.enum.d.ts.map +0 -1
- package/packages/cache/dist/exceptions/cache-exception.d.ts +0 -5
- package/packages/cache/dist/exceptions/cache-exception.d.ts.map +0 -1
- package/packages/cache/dist/exceptions/index.d.ts +0 -2
- package/packages/cache/dist/exceptions/index.d.ts.map +0 -1
- package/packages/cache/dist/index.d.ts +0 -6
- package/packages/cache/dist/index.d.ts.map +0 -1
- package/packages/cache/dist/index.js +0 -1336
- package/packages/cache/dist/index.js.map +0 -1
- package/packages/cache/dist/index.mjs +0 -1305
- package/packages/cache/dist/index.mjs.map +0 -1
- package/packages/cache/dist/request-cache-handler/index.d.ts +0 -2
- package/packages/cache/dist/request-cache-handler/index.d.ts.map +0 -1
- package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts +0 -23
- package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts.map +0 -1
- package/packages/cache/dist/storage/index.d.ts +0 -6
- package/packages/cache/dist/storage/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +0 -22
- package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts +0 -2
- package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/index.d.ts +0 -3
- package/packages/cache/dist/storage/indexed-db-storage/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts +0 -12
- package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts +0 -11
- package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts +0 -11
- package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts +0 -11
- package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts +0 -11
- package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts +0 -7
- package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts +0 -12
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts +0 -8
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts +0 -14
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts +0 -29
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +0 -14
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +0 -1
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts +0 -13
- package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts.map +0 -1
- package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts +0 -16
- package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/internal-storage/types/events.d.ts +0 -16
- package/packages/cache/dist/storage/internal-storage/types/events.d.ts.map +0 -1
- package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts +0 -20
- package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts.map +0 -1
- package/packages/cache/dist/storage/keq-cache-storage.d.ts +0 -20
- package/packages/cache/dist/storage/keq-cache-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts +0 -31
- package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/index.d.ts +0 -3
- package/packages/cache/dist/storage/memory-storage/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts +0 -11
- package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts +0 -11
- package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts +0 -13
- package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts +0 -11
- package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts +0 -11
- package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/types/index.d.ts +0 -3
- package/packages/cache/dist/storage/memory-storage/types/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts +0 -9
- package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts +0 -13
- package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts +0 -6
- package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/utils/index.d.ts +0 -3
- package/packages/cache/dist/storage/memory-storage/utils/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts +0 -6
- package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts.map +0 -1
- package/packages/cache/dist/storage/multi-tier-storage/index.d.ts +0 -3
- package/packages/cache/dist/storage/multi-tier-storage/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts +0 -36
- package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts +0 -2
- package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts +0 -5
- package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts.map +0 -1
- package/packages/cache/dist/storage/tier-storage/index.d.ts +0 -3
- package/packages/cache/dist/storage/tier-storage/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts +0 -15
- package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts.map +0 -1
- package/packages/cache/dist/storage/tier-storage/types/index.d.ts +0 -2
- package/packages/cache/dist/storage/tier-storage/types/index.d.ts.map +0 -1
- package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts +0 -21
- package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts.map +0 -1
- package/packages/cache/dist/strategies/cache-first.d.ts +0 -3
- package/packages/cache/dist/strategies/cache-first.d.ts.map +0 -1
- package/packages/cache/dist/strategies/index.d.ts +0 -5
- package/packages/cache/dist/strategies/index.d.ts.map +0 -1
- package/packages/cache/dist/strategies/network-first.d.ts +0 -3
- package/packages/cache/dist/strategies/network-first.d.ts.map +0 -1
- package/packages/cache/dist/strategies/network-only.d.ts +0 -3
- package/packages/cache/dist/strategies/network-only.d.ts.map +0 -1
- package/packages/cache/dist/strategies/stale-while-revalidate.d.ts +0 -3
- package/packages/cache/dist/strategies/stale-while-revalidate.d.ts.map +0 -1
- package/packages/cache/dist/types/index.d.ts +0 -6
- package/packages/cache/dist/types/index.d.ts.map +0 -1
- package/packages/cache/dist/types/keq-cache-key.d.ts +0 -4
- package/packages/cache/dist/types/keq-cache-key.d.ts.map +0 -1
- package/packages/cache/dist/types/keq-cache-pattern.d.ts +0 -3
- package/packages/cache/dist/types/keq-cache-pattern.d.ts.map +0 -1
- package/packages/cache/dist/types/keq-cache-rule.d.ts +0 -6
- package/packages/cache/dist/types/keq-cache-rule.d.ts.map +0 -1
- package/packages/cache/dist/types/keq-cache-strategy.d.ts +0 -6
- package/packages/cache/dist/types/keq-cache-strategy.d.ts.map +0 -1
- package/packages/cache/dist/types/request-cache-options.d.ts +0 -45
- package/packages/cache/dist/types/request-cache-options.d.ts.map +0 -1
- package/packages/cache/dist/utils/get-response-bytes.d.ts +0 -2
- package/packages/cache/dist/utils/get-response-bytes.d.ts.map +0 -1
- package/packages/cache/dist/utils/index.d.ts +0 -4
- package/packages/cache/dist/utils/index.d.ts.map +0 -1
- package/packages/cache/dist/utils/logger.d.ts +0 -5
- package/packages/cache/dist/utils/logger.d.ts.map +0 -1
- package/packages/cache/dist/utils/random.d.ts +0 -2
- package/packages/cache/dist/utils/random.d.ts.map +0 -1
- package/packages/cli/.turbo/turbo-build.log +0 -11
- package/packages/cli/dist/cli.cjs +0 -2968
- package/packages/cli/dist/cli.cjs.map +0 -1
- package/packages/cli/dist/cli.d.ts +0 -3
- package/packages/cli/dist/cli.d.ts.map +0 -1
- package/packages/cli/dist/cli.js +0 -2945
- package/packages/cli/dist/cli.js.map +0 -1
- package/packages/cli/dist/compiler/compiler.d.ts +0 -17
- package/packages/cli/dist/compiler/compiler.d.ts.map +0 -1
- package/packages/cli/dist/compiler/index.d.ts +0 -4
- package/packages/cli/dist/compiler/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/intercepter/index.d.ts +0 -3
- package/packages/cli/dist/compiler/intercepter/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts +0 -3
- package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts.map +0 -1
- package/packages/cli/dist/compiler/intercepter/print-information.d.ts +0 -5
- package/packages/cli/dist/compiler/intercepter/print-information.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/compile/index.d.ts +0 -6
- package/packages/cli/dist/compiler/tasks/compile/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/download/index.d.ts +0 -10
- package/packages/cli/dist/compiler/tasks/download/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/index.d.ts +0 -6
- package/packages/cli/dist/compiler/tasks/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/persist/index.d.ts +0 -5
- package/packages/cli/dist/compiler/tasks/persist/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/setup/index.d.ts +0 -15
- package/packages/cli/dist/compiler/tasks/setup/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts +0 -6
- package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts +0 -5
- package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts +0 -3
- package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts +0 -3
- package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts +0 -6
- package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/types/index.d.ts +0 -3
- package/packages/cli/dist/compiler/tasks/types/index.d.ts.map +0 -1
- package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts +0 -4
- package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts.map +0 -1
- package/packages/cli/dist/compiler/types/compiler-context.d.ts +0 -11
- package/packages/cli/dist/compiler/types/compiler-context.d.ts.map +0 -1
- package/packages/cli/dist/compiler/types/compiler-hooks.d.ts +0 -19
- package/packages/cli/dist/compiler/types/compiler-hooks.d.ts.map +0 -1
- package/packages/cli/dist/compiler/types/index.d.ts +0 -3
- package/packages/cli/dist/compiler/types/index.d.ts.map +0 -1
- package/packages/cli/dist/constants/file-naming-style.d.ts +0 -14
- package/packages/cli/dist/constants/file-naming-style.d.ts.map +0 -1
- package/packages/cli/dist/constants/index.d.ts +0 -4
- package/packages/cli/dist/constants/index.d.ts.map +0 -1
- package/packages/cli/dist/constants/qs-array-format.d.ts +0 -9
- package/packages/cli/dist/constants/qs-array-format.d.ts.map +0 -1
- package/packages/cli/dist/constants/supported-methods.d.ts +0 -2
- package/packages/cli/dist/constants/supported-methods.d.ts.map +0 -1
- package/packages/cli/dist/define-config.d.ts +0 -3
- package/packages/cli/dist/define-config.d.ts.map +0 -1
- package/packages/cli/dist/exception.d.ts +0 -6
- package/packages/cli/dist/exception.d.ts.map +0 -1
- package/packages/cli/dist/generators/index.d.ts +0 -2
- package/packages/cli/dist/generators/index.d.ts.map +0 -1
- package/packages/cli/dist/index.cjs +0 -2899
- package/packages/cli/dist/index.cjs.map +0 -1
- package/packages/cli/dist/index.d.ts +0 -6
- package/packages/cli/dist/index.d.ts.map +0 -1
- package/packages/cli/dist/index.js +0 -2853
- package/packages/cli/dist/index.js.map +0 -1
- package/packages/cli/dist/models/anchor.d.ts +0 -20
- package/packages/cli/dist/models/anchor.d.ts.map +0 -1
- package/packages/cli/dist/models/api-document_v3_1.d.ts +0 -16
- package/packages/cli/dist/models/api-document_v3_1.d.ts.map +0 -1
- package/packages/cli/dist/models/artifact.d.ts +0 -17
- package/packages/cli/dist/models/artifact.d.ts.map +0 -1
- package/packages/cli/dist/models/asset.d.ts +0 -5
- package/packages/cli/dist/models/asset.d.ts.map +0 -1
- package/packages/cli/dist/models/index.d.ts +0 -8
- package/packages/cli/dist/models/index.d.ts.map +0 -1
- package/packages/cli/dist/models/module-definition.d.ts +0 -8
- package/packages/cli/dist/models/module-definition.d.ts.map +0 -1
- package/packages/cli/dist/models/operation-definition.d.ts +0 -23
- package/packages/cli/dist/models/operation-definition.d.ts.map +0 -1
- package/packages/cli/dist/models/schema-definition.d.ts +0 -20
- package/packages/cli/dist/models/schema-definition.d.ts.map +0 -1
- package/packages/cli/dist/models/utils/to-comment.d.ts +0 -2
- package/packages/cli/dist/models/utils/to-comment.d.ts.map +0 -1
- package/packages/cli/dist/plugins/body-fallback/index.d.ts +0 -6
- package/packages/cli/dist/plugins/body-fallback/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts +0 -5
- package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts +0 -2
- package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts +0 -8
- package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/download-http-file/index.d.ts +0 -2
- package/packages/cli/dist/plugins/download-http-file/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts +0 -6
- package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/download-local-file/index.d.ts +0 -2
- package/packages/cli/dist/plugins/download-local-file/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/eslint/index.d.ts +0 -15
- package/packages/cli/dist/plugins/eslint/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts +0 -12
- package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts +0 -15
- package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts +0 -3
- package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts +0 -15
- package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts +0 -15
- package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-declaration/index.d.ts +0 -3
- package/packages/cli/dist/plugins/generate-declaration/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts +0 -11
- package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts +0 -11
- package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts +0 -3
- package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts +0 -15
- package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts +0 -11
- package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-micro-function/index.d.ts +0 -3
- package/packages/cli/dist/plugins/generate-micro-function/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts +0 -10
- package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts +0 -10
- package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts +0 -2
- package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts +0 -14
- package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts.map +0 -1
- package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts +0 -3
- package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/index.d.ts +0 -15
- package/packages/cli/dist/plugins/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/initialize/index.d.ts +0 -2
- package/packages/cli/dist/plugins/initialize/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts +0 -15
- package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts +0 -2
- package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts +0 -20
- package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts +0 -2
- package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts +0 -18
- package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/prettier/index.d.ts +0 -2
- package/packages/cli/dist/plugins/prettier/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts +0 -6
- package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/shaking/index.d.ts +0 -2
- package/packages/cli/dist/plugins/shaking/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts +0 -8
- package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/index.d.ts +0 -2
- package/packages/cli/dist/plugins/terminal-select/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts +0 -18
- package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts +0 -2
- package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/types/index.d.ts +0 -2
- package/packages/cli/dist/plugins/terminal-select/types/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts +0 -2
- package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts.map +0 -1
- package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts +0 -5
- package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts.map +0 -1
- package/packages/cli/dist/plugins.cjs +0 -2438
- package/packages/cli/dist/plugins.cjs.map +0 -1
- package/packages/cli/dist/plugins.js +0 -2378
- package/packages/cli/dist/plugins.js.map +0 -1
- package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts +0 -8
- package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/api-document/index.d.ts +0 -2
- package/packages/cli/dist/transformers/api-document/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts +0 -14
- package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts +0 -12
- package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts +0 -10
- package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/entrypoint/index.d.ts +0 -2
- package/packages/cli/dist/transformers/entrypoint/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/index.d.ts +0 -6
- package/packages/cli/dist/transformers/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts +0 -8
- package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts +0 -26
- package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/index.d.ts +0 -4
- package/packages/cli/dist/transformers/json-schema/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts +0 -7
- package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts +0 -5
- package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts +0 -5
- package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/types/index.d.ts +0 -3
- package/packages/cli/dist/transformers/json-schema/types/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts +0 -7
- package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts +0 -8
- package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts +0 -20
- package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/index.d.ts +0 -3
- package/packages/cli/dist/transformers/operation-definition/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts +0 -19
- package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts +0 -15
- package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts +0 -11
- package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts +0 -22
- package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts +0 -2
- package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts +0 -4
- package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts.map +0 -1
- package/packages/cli/dist/transformers/schema-definition/index.d.ts +0 -2
- package/packages/cli/dist/transformers/schema-definition/index.d.ts.map +0 -1
- package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts +0 -10
- package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts.map +0 -1
- package/packages/cli/dist/transformers/types/renderer.d.ts +0 -4
- package/packages/cli/dist/transformers/types/renderer.d.ts.map +0 -1
- package/packages/cli/dist/types/address.d.ts +0 -8
- package/packages/cli/dist/types/address.d.ts.map +0 -1
- package/packages/cli/dist/types/build-cli-options.d.ts +0 -19
- package/packages/cli/dist/types/build-cli-options.d.ts.map +0 -1
- package/packages/cli/dist/types/generator.d.ts +0 -7
- package/packages/cli/dist/types/generator.d.ts.map +0 -1
- package/packages/cli/dist/types/index.d.ts +0 -7
- package/packages/cli/dist/types/index.d.ts.map +0 -1
- package/packages/cli/dist/types/plugin.d.ts +0 -5
- package/packages/cli/dist/types/plugin.d.ts.map +0 -1
- package/packages/cli/dist/types/runtime-config.d.ts +0 -41
- package/packages/cli/dist/types/runtime-config.d.ts.map +0 -1
- package/packages/cli/dist/types/to-code-options.d.ts +0 -4
- package/packages/cli/dist/types/to-code-options.d.ts.map +0 -1
- package/packages/cli/dist/utils/debugger.d.ts +0 -7
- package/packages/cli/dist/utils/debugger.d.ts.map +0 -1
- package/packages/cli/dist/utils/ignore-matcher.d.ts +0 -18
- package/packages/cli/dist/utils/ignore-matcher.d.ts.map +0 -1
- package/packages/cli/dist/utils/indent.d.ts +0 -2
- package/packages/cli/dist/utils/indent.d.ts.map +0 -1
- package/packages/cli/dist/utils/is-keywords.d.ts +0 -2
- package/packages/cli/dist/utils/is-keywords.d.ts.map +0 -1
- package/packages/cli/dist/utils/is-reserved-word.d.ts +0 -2
- package/packages/cli/dist/utils/is-reserved-word.d.ts.map +0 -1
- package/packages/cli/dist/utils/is-valid-url.d.ts +0 -16
- package/packages/cli/dist/utils/is-valid-url.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/index.d.ts +0 -11
- package/packages/cli/dist/utils/json-schema-utils/index.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts +0 -3
- package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts +0 -4
- package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts +0 -3
- package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts +0 -3
- package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts +0 -5
- package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts.map +0 -1
- package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts +0 -7
- package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts.map +0 -1
- package/packages/cli/dist/utils/logger.d.ts +0 -6
- package/packages/cli/dist/utils/logger.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts +0 -3
- package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts +0 -4
- package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/dereference.d.ts +0 -3
- package/packages/cli/dist/utils/openapi-utils/dereference.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/index.d.ts +0 -19
- package/packages/cli/dist/utils/openapi-utils/index.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts +0 -3
- package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts +0 -4
- package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts +0 -4
- package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts +0 -3
- package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts.map +0 -1
- package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts +0 -3
- package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts.map +0 -1
- package/packages/cli/node_modules/.bin/eslint +0 -21
- package/packages/cli/node_modules/.bin/jiti +0 -21
- package/packages/cli/node_modules/.bin/js-yaml +0 -21
- package/packages/cli/node_modules/.bin/jsonpath +0 -21
- package/packages/cli/node_modules/.bin/jsonpath-plus +0 -21
- package/packages/cli/node_modules/.bin/semver +0 -21
- package/packages/cli/node_modules/.bin/tsc +0 -21
- package/packages/cli/node_modules/.bin/tsserver +0 -21
- package/packages/exception/.turbo/turbo-build.log +0 -34
- package/packages/exception/dist/catch-exception.d.ts +0 -4
- package/packages/exception/dist/catch-exception.d.ts.map +0 -1
- package/packages/exception/dist/index.d.ts +0 -4
- package/packages/exception/dist/index.d.ts.map +0 -1
- package/packages/exception/dist/index.js +0 -112
- package/packages/exception/dist/index.js.map +0 -1
- package/packages/exception/dist/index.mjs +0 -111
- package/packages/exception/dist/index.mjs.map +0 -1
- package/packages/exception/dist/plugins/index.d.mts +0 -12
- package/packages/exception/dist/plugins/index.d.ts +0 -12
- package/packages/exception/dist/plugins/index.js +0 -95
- package/packages/exception/dist/plugins/index.mjs +0 -68
- package/packages/exception/dist/throw-exception.d.ts +0 -5
- package/packages/exception/dist/throw-exception.d.ts.map +0 -1
- package/packages/exception/dist/validate-status-code.d.ts +0 -3
- package/packages/exception/dist/validate-status-code.d.ts.map +0 -1
- package/packages/exception/node_modules/.bin/keq +0 -21
- package/packages/headers/.turbo/turbo-build.log +0 -21
- package/packages/headers/dist/index.d.ts +0 -42
- package/packages/headers/dist/index.d.ts.map +0 -1
- package/packages/headers/dist/index.js +0 -77
- package/packages/headers/dist/index.js.map +0 -1
- package/packages/headers/dist/index.mjs +0 -56
- package/packages/headers/dist/index.mjs.map +0 -1
- package/packages/keq/.turbo/turbo-build.log +0 -19
- package/packages/keq/dist/context/execution-context.d.ts +0 -26
- package/packages/keq/dist/context/execution-context.d.ts.map +0 -1
- package/packages/keq/dist/context/index.d.ts +0 -5
- package/packages/keq/dist/context/index.d.ts.map +0 -1
- package/packages/keq/dist/context/middleware-context.d.ts +0 -11
- package/packages/keq/dist/context/middleware-context.d.ts.map +0 -1
- package/packages/keq/dist/context/orchestrator-context.d.ts +0 -18
- package/packages/keq/dist/context/orchestrator-context.d.ts.map +0 -1
- package/packages/keq/dist/context/shared-context.d.ts +0 -43
- package/packages/keq/dist/context/shared-context.d.ts.map +0 -1
- package/packages/keq/dist/context/types/index.d.ts +0 -6
- package/packages/keq/dist/context/types/index.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-data.d.ts +0 -7
- package/packages/keq/dist/context/types/keq-context-data.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-emitter.d.ts +0 -35
- package/packages/keq/dist/context/types/keq-context-emitter.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/index.d.ts +0 -6
- package/packages/keq/dist/context/types/keq-context-options/index.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts +0 -5
- package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts +0 -33
- package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts +0 -5
- package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts +0 -2
- package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts +0 -9
- package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-context.d.ts +0 -17
- package/packages/keq/dist/context/types/keq-context.d.ts.map +0 -1
- package/packages/keq/dist/context/types/keq-global.d.ts +0 -12
- package/packages/keq/dist/context/types/keq-global.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/assign-shared-context.d.ts +0 -3
- package/packages/keq/dist/context/utils/assign-shared-context.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/clone-shared-context.d.ts +0 -3
- package/packages/keq/dist/context/utils/clone-shared-context.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/create-proxy-response.d.ts +0 -2
- package/packages/keq/dist/context/utils/create-proxy-response.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/fork.d.ts +0 -6
- package/packages/keq/dist/context/utils/fork.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/index.d.ts +0 -5
- package/packages/keq/dist/context/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/context/utils/watch-object.d.ts +0 -5
- package/packages/keq/dist/context/utils/watch-object.d.ts.map +0 -1
- package/packages/keq/dist/exception/abort.exception.d.ts +0 -4
- package/packages/keq/dist/exception/abort.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/exception.d.ts +0 -5
- package/packages/keq/dist/exception/exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/index.d.ts +0 -22
- package/packages/keq/dist/exception/http-exceptions/index.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts +0 -12
- package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts +0 -5
- package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/index.d.ts +0 -6
- package/packages/keq/dist/exception/index.d.ts.map +0 -1
- package/packages/keq/dist/exception/timeout.exception.d.ts +0 -5
- package/packages/keq/dist/exception/timeout.exception.d.ts.map +0 -1
- package/packages/keq/dist/exception/type.exception.d.ts +0 -5
- package/packages/keq/dist/exception/type.exception.d.ts.map +0 -1
- package/packages/keq/dist/index.d.ts +0 -8
- package/packages/keq/dist/index.d.ts.map +0 -1
- package/packages/keq/dist/index.js +0 -1991
- package/packages/keq/dist/index.js.map +0 -1
- package/packages/keq/dist/index.mjs +0 -1960
- package/packages/keq/dist/index.mjs.map +0 -1
- package/packages/keq/dist/middleware/index.d.ts +0 -3
- package/packages/keq/dist/middleware/index.d.ts.map +0 -1
- package/packages/keq/dist/middleware/types/index.d.ts +0 -3
- package/packages/keq/dist/middleware/types/index.d.ts.map +0 -1
- package/packages/keq/dist/middleware/types/keq-middleware.d.ts +0 -8
- package/packages/keq/dist/middleware/types/keq-middleware.d.ts.map +0 -1
- package/packages/keq/dist/middleware/types/keq-next.d.ts +0 -2
- package/packages/keq/dist/middleware/types/keq-next.d.ts.map +0 -1
- package/packages/keq/dist/middleware/utils/compose-middleware.d.ts +0 -7
- package/packages/keq/dist/middleware/utils/compose-middleware.d.ts.map +0 -1
- package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts +0 -3
- package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts.map +0 -1
- package/packages/keq/dist/middleware/utils/index.d.ts +0 -3
- package/packages/keq/dist/middleware/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts +0 -6
- package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts +0 -3
- package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts +0 -4
- package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts +0 -3
- package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts +0 -9
- package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/index.d.ts +0 -4
- package/packages/keq/dist/middlewares/index.d.ts.map +0 -1
- package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts +0 -6
- package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts.map +0 -1
- package/packages/keq/dist/orchestrator/executor.d.ts +0 -13
- package/packages/keq/dist/orchestrator/executor.d.ts.map +0 -1
- package/packages/keq/dist/orchestrator/index.d.ts +0 -3
- package/packages/keq/dist/orchestrator/index.d.ts.map +0 -1
- package/packages/keq/dist/orchestrator/orchestrator.d.ts +0 -25
- package/packages/keq/dist/orchestrator/orchestrator.d.ts.map +0 -1
- package/packages/keq/dist/request/core.d.ts +0 -48
- package/packages/keq/dist/request/core.d.ts.map +0 -1
- package/packages/keq/dist/request/create-request.d.ts +0 -7
- package/packages/keq/dist/request/create-request.d.ts.map +0 -1
- package/packages/keq/dist/request/index.d.ts +0 -6
- package/packages/keq/dist/request/index.d.ts.map +0 -1
- package/packages/keq/dist/request/keq.d.ts +0 -120
- package/packages/keq/dist/request/keq.d.ts.map +0 -1
- package/packages/keq/dist/request/request.d.ts +0 -79
- package/packages/keq/dist/request/request.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts +0 -42
- package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/api-schema.d.ts +0 -8
- package/packages/keq/dist/request/types/api-schema/api-schema.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/default-operation.d.ts +0 -18
- package/packages/keq/dist/request/types/api-schema/default-operation.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts +0 -31
- package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/index.d.ts +0 -6
- package/packages/keq/dist/request/types/api-schema/index.d.ts.map +0 -1
- package/packages/keq/dist/request/types/api-schema/operation.d.ts +0 -17
- package/packages/keq/dist/request/types/api-schema/operation.d.ts.map +0 -1
- package/packages/keq/dist/request/types/content-type.d.ts +0 -3
- package/packages/keq/dist/request/types/content-type.d.ts.map +0 -1
- package/packages/keq/dist/request/types/index.d.ts +0 -8
- package/packages/keq/dist/request/types/index.d.ts.map +0 -1
- package/packages/keq/dist/request/types/keq-attachable-file.d.ts +0 -2
- package/packages/keq/dist/request/types/keq-attachable-file.d.ts.map +0 -1
- package/packages/keq/dist/request/types/keq-param-value.d.ts +0 -3
- package/packages/keq/dist/request/types/keq-param-value.d.ts.map +0 -1
- package/packages/keq/dist/request/types/keq-query-options.d.ts +0 -7
- package/packages/keq/dist/request/types/keq-query-options.d.ts.map +0 -1
- package/packages/keq/dist/request/types/keq-query-value.d.ts +0 -8
- package/packages/keq/dist/request/types/keq-query-value.d.ts.map +0 -1
- package/packages/keq/dist/request/types/server-sent-event.d.ts +0 -3
- package/packages/keq/dist/request/types/server-sent-event.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/fix-content-type.d.ts +0 -4
- package/packages/keq/dist/request/utils/fix-content-type.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/get-location-id.d.ts +0 -2
- package/packages/keq/dist/request/utils/get-location-id.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/index.d.ts +0 -7
- package/packages/keq/dist/request/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts +0 -2
- package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts +0 -3
- package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/query-stringify.d.ts +0 -3
- package/packages/keq/dist/request/utils/query-stringify.d.ts.map +0 -1
- package/packages/keq/dist/request/utils/resolve-with.d.ts +0 -3
- package/packages/keq/dist/request/utils/resolve-with.d.ts.map +0 -1
- package/packages/keq/dist/request-init/index.d.ts +0 -4
- package/packages/keq/dist/request-init/index.d.ts.map +0 -1
- package/packages/keq/dist/request-init/request-init.d.ts +0 -42
- package/packages/keq/dist/request-init/request-init.d.ts.map +0 -1
- package/packages/keq/dist/request-init/types/index.d.ts +0 -3
- package/packages/keq/dist/request-init/types/index.d.ts.map +0 -1
- package/packages/keq/dist/request-init/types/keq-body-init.d.ts +0 -2
- package/packages/keq/dist/request-init/types/keq-body-init.d.ts.map +0 -1
- package/packages/keq/dist/request-init/types/keq-request-method.d.ts +0 -2
- package/packages/keq/dist/request-init/types/keq-request-method.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/assign-request-init.d.ts +0 -3
- package/packages/keq/dist/request-init/utils/assign-request-init.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/clone-body.d.ts +0 -2
- package/packages/keq/dist/request-init/utils/clone-body.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/clone-headers.d.ts +0 -2
- package/packages/keq/dist/request-init/utils/clone-headers.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/clone-request-init.d.ts +0 -3
- package/packages/keq/dist/request-init/utils/clone-request-init.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/compile-url.d.ts +0 -3
- package/packages/keq/dist/request-init/utils/compile-url.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/index.d.ts +0 -7
- package/packages/keq/dist/request-init/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/to-form-data.d.ts +0 -2
- package/packages/keq/dist/request-init/utils/to-form-data.d.ts.map +0 -1
- package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts +0 -2
- package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts.map +0 -1
- package/packages/keq/dist/router/index.d.ts +0 -4
- package/packages/keq/dist/router/index.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-host-route.d.ts +0 -3
- package/packages/keq/dist/router/keq-host-route.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-location-route.d.ts +0 -3
- package/packages/keq/dist/router/keq-location-route.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-method-route.d.ts +0 -3
- package/packages/keq/dist/router/keq-method-route.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-module-route.d.ts +0 -3
- package/packages/keq/dist/router/keq-module-route.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-pathname-route.d.ts +0 -3
- package/packages/keq/dist/router/keq-pathname-route.d.ts.map +0 -1
- package/packages/keq/dist/router/keq-router.d.ts +0 -32
- package/packages/keq/dist/router/keq-router.d.ts.map +0 -1
- package/packages/keq/dist/router/types/index.d.ts +0 -2
- package/packages/keq/dist/router/types/index.d.ts.map +0 -1
- package/packages/keq/dist/router/types/keq-route.d.ts +0 -7
- package/packages/keq/dist/router/types/keq-route.d.ts.map +0 -1
- package/packages/keq/dist/router/utils/compose-route.d.ts +0 -3
- package/packages/keq/dist/router/utils/compose-route.d.ts.map +0 -1
- package/packages/keq/dist/router/utils/index.d.ts +0 -2
- package/packages/keq/dist/router/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/types/enabled-if-string-index.d.ts +0 -24
- package/packages/keq/dist/types/enabled-if-string-index.d.ts.map +0 -1
- package/packages/keq/dist/types/exclude-unknown-properties.d.ts +0 -19
- package/packages/keq/dist/types/exclude-unknown-properties.d.ts.map +0 -1
- package/packages/keq/dist/types/index-keys.d.ts +0 -18
- package/packages/keq/dist/types/index-keys.d.ts.map +0 -1
- package/packages/keq/dist/types/index.d.ts +0 -7
- package/packages/keq/dist/types/index.d.ts.map +0 -1
- package/packages/keq/dist/types/literal-keys.d.ts +0 -18
- package/packages/keq/dist/types/literal-keys.d.ts.map +0 -1
- package/packages/keq/dist/types/loose-nested-like.d.ts +0 -11
- package/packages/keq/dist/types/loose-nested-like.d.ts.map +0 -1
- package/packages/keq/dist/types/string-index-value-of.d.ts +0 -18
- package/packages/keq/dist/types/string-index-value-of.d.ts.map +0 -1
- package/packages/keq/dist/utils/base64.d.ts +0 -3
- package/packages/keq/dist/utils/base64.d.ts.map +0 -1
- package/packages/keq/dist/utils/index.d.ts +0 -4
- package/packages/keq/dist/utils/index.d.ts.map +0 -1
- package/packages/keq/dist/utils/shallow-clone.d.ts +0 -5
- package/packages/keq/dist/utils/shallow-clone.d.ts.map +0 -1
- package/packages/keq/dist/utils/sleep.d.ts +0 -2
- package/packages/keq/dist/utils/sleep.d.ts.map +0 -1
- package/packages/keq/dist/validator/index.d.ts +0 -2
- package/packages/keq/dist/validator/index.d.ts.map +0 -1
- package/packages/keq/dist/validator/validator.d.ts +0 -65
- package/packages/keq/dist/validator/validator.d.ts.map +0 -1
- package/packages/nestjs/.turbo/turbo-build.log +0 -14
- package/packages/nestjs/dist/index.d.ts +0 -3
- package/packages/nestjs/dist/index.d.ts.map +0 -1
- package/packages/nestjs/dist/index.js +0 -70
- package/packages/nestjs/dist/index.js.map +0 -1
- package/packages/nestjs/dist/index.mjs +0 -45
- package/packages/nestjs/dist/index.mjs.map +0 -1
- package/packages/nestjs/dist/keq.module-definition.d.ts +0 -3
- package/packages/nestjs/dist/keq.module-definition.d.ts.map +0 -1
- package/packages/nestjs/dist/keq.module.d.ts +0 -7
- package/packages/nestjs/dist/keq.module.d.ts.map +0 -1
- package/packages/nestjs/dist/types/index.d.ts +0 -2
- package/packages/nestjs/dist/types/index.d.ts.map +0 -1
- package/packages/nestjs/dist/types/keq-module-options.d.ts +0 -5
- package/packages/nestjs/dist/types/keq-module-options.d.ts.map +0 -1
- package/packages/test/.turbo/turbo-build.log +0 -6
- package/packages/url/.turbo/turbo-build.log +0 -21
- package/packages/url/dist/index.d.ts +0 -5
- package/packages/url/dist/index.d.ts.map +0 -1
- package/packages/url/dist/index.js +0 -67
- package/packages/url/dist/index.js.map +0 -1
- package/packages/url/dist/index.mjs +0 -46
- package/packages/url/dist/index.mjs.map +0 -1
|
@@ -1,1960 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
-
// src/exception/exception.ts
|
|
6
|
-
import { CustomError } from "ts-custom-error";
|
|
7
|
-
var Exception = class extends CustomError {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
Object.defineProperty(this, "name", { value: "KeqError" });
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/exception/type.exception.ts
|
|
15
|
-
var TypeException = class extends Exception {
|
|
16
|
-
constructor(msg) {
|
|
17
|
-
super(msg || "Invalid Type");
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// src/exception/abort.exception.ts
|
|
22
|
-
var AbortException = class _AbortException extends DOMException {
|
|
23
|
-
constructor(msg) {
|
|
24
|
-
super(msg, "AbortError");
|
|
25
|
-
Object.setPrototypeOf(this, _AbortException.prototype);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// src/exception/timeout.exception.ts
|
|
30
|
-
var TimeoutException = class extends AbortException {
|
|
31
|
-
constructor(msg) {
|
|
32
|
-
super(msg);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// src/exception/http-exceptions/request.exception.ts
|
|
37
|
-
var RequestException = class extends Exception {
|
|
38
|
-
constructor(statusCode, message, options) {
|
|
39
|
-
super(message);
|
|
40
|
-
__publicField(this, "statusCode");
|
|
41
|
-
__publicField(this, "retry");
|
|
42
|
-
__publicField(this, "response");
|
|
43
|
-
this.statusCode = statusCode;
|
|
44
|
-
this.retry = !(options == null ? void 0 : options.fatal);
|
|
45
|
-
this.response = options == null ? void 0 : options.response;
|
|
46
|
-
Object.defineProperty(this, "name", { value: "RequestException" });
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// src/exception/http-exceptions/bad-request.exception.ts
|
|
51
|
-
var BadRequestException = class extends RequestException {
|
|
52
|
-
constructor(message = "Bad Request", options) {
|
|
53
|
-
super(400, message, { fatal: true, ...options });
|
|
54
|
-
Object.defineProperty(this, "name", { value: "BadRequestException" });
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// src/exception/http-exceptions/unauthorized.exception.ts
|
|
59
|
-
var UnauthorizedException = class extends RequestException {
|
|
60
|
-
constructor(message = "Unauthorized", options) {
|
|
61
|
-
super(401, message, { fatal: true, ...options });
|
|
62
|
-
Object.defineProperty(this, "name", { value: "UnauthorizedException" });
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// src/exception/http-exceptions/forbidden.exception.ts
|
|
67
|
-
var ForbiddenException = class extends RequestException {
|
|
68
|
-
constructor(message = "Forbidden", options) {
|
|
69
|
-
super(403, message, { fatal: true, ...options });
|
|
70
|
-
Object.defineProperty(this, "name", { value: "ForbiddenException" });
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// src/exception/http-exceptions/not-founded.exception.ts
|
|
75
|
-
var NotFoundedException = class extends RequestException {
|
|
76
|
-
constructor(message = "Not Founded", options) {
|
|
77
|
-
super(404, message, { fatal: true, ...options });
|
|
78
|
-
Object.defineProperty(this, "name", { value: "NotFoundedException" });
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/exception/http-exceptions/method-not-allowed.exception.ts
|
|
83
|
-
var MethodNotAllowedException = class extends RequestException {
|
|
84
|
-
constructor(message = "Method Not Allowed", options) {
|
|
85
|
-
super(405, message, { fatal: true, ...options });
|
|
86
|
-
Object.defineProperty(this, "name", {
|
|
87
|
-
value: "MethodNotAllowedException"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// src/exception/http-exceptions/not-acceptable.exception.ts
|
|
93
|
-
var NotAcceptableException = class extends RequestException {
|
|
94
|
-
constructor(message = "Not Acceptable", options) {
|
|
95
|
-
super(406, message, { fatal: true, ...options });
|
|
96
|
-
Object.defineProperty(this, "name", { value: "NotAcceptableException" });
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// src/exception/http-exceptions/proxy-authentication-required.exception.ts
|
|
101
|
-
var ProxyAuthenticationRequiredException = class extends RequestException {
|
|
102
|
-
constructor(message = "Proxy Authentication Required", options) {
|
|
103
|
-
super(407, message, { fatal: true, ...options });
|
|
104
|
-
Object.defineProperty(this, "name", {
|
|
105
|
-
value: "ProxyAuthenticationRequiredException"
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// src/exception/http-exceptions/request-timeout.exception.ts
|
|
111
|
-
var RequestTimeoutException = class extends RequestException {
|
|
112
|
-
constructor(message = "Request Timeout", options) {
|
|
113
|
-
super(408, message, { fatal: false, ...options });
|
|
114
|
-
Object.defineProperty(this, "name", {
|
|
115
|
-
value: "RequestTimeoutException"
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// src/exception/http-exceptions/conflict.exception.ts
|
|
121
|
-
var ConflictException = class extends RequestException {
|
|
122
|
-
constructor(message = "Conflict", options) {
|
|
123
|
-
super(409, message, { fatal: true, ...options });
|
|
124
|
-
Object.defineProperty(this, "name", { value: "ConflictException" });
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
// src/exception/http-exceptions/precondition-failed.exception.ts
|
|
129
|
-
var PreconditionFailedException = class extends RequestException {
|
|
130
|
-
constructor(message = "Precondition Failed", options) {
|
|
131
|
-
super(412, message, { fatal: true, ...options });
|
|
132
|
-
Object.defineProperty(this, "name", {
|
|
133
|
-
value: "PreconditionFailedException"
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// src/exception/http-exceptions/content-too-large.exception.ts
|
|
139
|
-
var ContentTooLargeException = class extends RequestException {
|
|
140
|
-
constructor(message = "Content Too Large", options) {
|
|
141
|
-
super(413, message, { fatal: true, ...options });
|
|
142
|
-
Object.defineProperty(this, "name", {
|
|
143
|
-
value: "ContentTooLargeException"
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// src/exception/http-exceptions/uri-too-long.exception.ts
|
|
149
|
-
var UriTooLongException = class extends RequestException {
|
|
150
|
-
constructor(message = "URI Too Long", options) {
|
|
151
|
-
super(414, message, { fatal: true, ...options });
|
|
152
|
-
Object.defineProperty(this, "name", { value: "UriTooLongException" });
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// src/exception/http-exceptions/unsupported-media-type.exception.ts
|
|
157
|
-
var UnsupportedMediaTypeException = class extends RequestException {
|
|
158
|
-
constructor(message = "Unsupported Media Type", options) {
|
|
159
|
-
super(415, message, { fatal: true, ...options });
|
|
160
|
-
Object.defineProperty(this, "name", { value: "UnsupportedMediaTypeException" });
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// src/exception/http-exceptions/im-a-teapot.exception.ts
|
|
165
|
-
var ImATeapotException = class extends RequestException {
|
|
166
|
-
constructor(message = "I'm a teapot", options) {
|
|
167
|
-
super(418, message, { fatal: true, ...options });
|
|
168
|
-
Object.defineProperty(this, "name", { value: "ImATeapotException" });
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// src/exception/http-exceptions/too-many-requests.exception.ts
|
|
173
|
-
var TooManyRequestsException = class extends RequestException {
|
|
174
|
-
constructor(message = "Too Many Requests", options) {
|
|
175
|
-
super(429, message, { fatal: false, ...options });
|
|
176
|
-
Object.defineProperty(this, "name", { value: "TooManyRequestsException" });
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// src/exception/http-exceptions/internal-server-error.exception.ts
|
|
181
|
-
var InternalServerErrorException = class extends RequestException {
|
|
182
|
-
constructor(message = "Internal Server Error", options) {
|
|
183
|
-
super(500, message, { fatal: false, ...options });
|
|
184
|
-
Object.defineProperty(this, "name", {
|
|
185
|
-
value: "InternalServerErrorException"
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
// src/exception/http-exceptions/not-implemented.exception.ts
|
|
191
|
-
var NotImplementedException = class extends RequestException {
|
|
192
|
-
constructor(message = "Not Implemented", options) {
|
|
193
|
-
super(501, message, { fatal: true, ...options });
|
|
194
|
-
Object.defineProperty(this, "name", { value: "NotImplementedException" });
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// src/exception/http-exceptions/bad-gateway.exception.ts
|
|
199
|
-
var BadGatewayException = class extends RequestException {
|
|
200
|
-
constructor(message = "Bad Gateway", options) {
|
|
201
|
-
super(502, message, { fatal: false, ...options });
|
|
202
|
-
Object.defineProperty(this, "name", { value: "BadGatewayException" });
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// src/exception/http-exceptions/service-unavailable.exception.ts
|
|
207
|
-
var ServiceUnavailableException = class extends RequestException {
|
|
208
|
-
constructor(message = "Service Unavailable", options) {
|
|
209
|
-
super(503, message, { fatal: false, ...options });
|
|
210
|
-
Object.defineProperty(this, "name", {
|
|
211
|
-
value: "ServiceUnavailableException"
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// src/exception/http-exceptions/gateway-timeout.exception.ts
|
|
217
|
-
var GatewayTimeoutException = class extends RequestException {
|
|
218
|
-
constructor(message = "Gateway Timeout", options) {
|
|
219
|
-
super(504, message, { fatal: false, ...options });
|
|
220
|
-
Object.defineProperty(this, "name", { value: "GatewayTimeoutException" });
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// src/utils/base64.ts
|
|
225
|
-
var base64Encode = globalThis.btoa || ((str) => Buffer.from(str).toString("base64"));
|
|
226
|
-
var base64Decode = globalThis.atob || ((str) => Buffer.from(str, "base64").toString("utf8"));
|
|
227
|
-
|
|
228
|
-
// src/validator/validator.ts
|
|
229
|
-
var Validator = class _Validator {
|
|
230
|
-
/**
|
|
231
|
-
* 检查是否为浏览器环境
|
|
232
|
-
*/
|
|
233
|
-
static isBrowser() {
|
|
234
|
-
return typeof window !== "undefined";
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* 检查是否为字符串
|
|
238
|
-
*/
|
|
239
|
-
static isString(value) {
|
|
240
|
-
return typeof value === "string";
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* 检查是否为对象
|
|
244
|
-
*/
|
|
245
|
-
static isObject(value) {
|
|
246
|
-
return typeof value === "object" && value !== null;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* 检查是否为函数
|
|
250
|
-
*/
|
|
251
|
-
static isFunction(value) {
|
|
252
|
-
return typeof value === "function";
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* 检查是否为 ArrayBuffer
|
|
256
|
-
*/
|
|
257
|
-
static isArrayBuffer(body) {
|
|
258
|
-
return body instanceof ArrayBuffer;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* 检查是否为 ReadableStream
|
|
262
|
-
*/
|
|
263
|
-
static isReadableStream(body) {
|
|
264
|
-
return body instanceof ReadableStream;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* 检查是否为 Blob 或 File 类对象
|
|
268
|
-
*/
|
|
269
|
-
static isBlob(value) {
|
|
270
|
-
if (value instanceof Blob) return true;
|
|
271
|
-
const names = ["Blob", "File"];
|
|
272
|
-
return _Validator.isObject(value) && _Validator.isString(value["type"]) && _Validator.isFunction(value["arrayBuffer"]) && _Validator.isFunction(value["stream"]) && _Validator.isFunction(value.constructor) && names.includes(value.constructor.name) && "size" in value;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* 检查是否为 File
|
|
276
|
-
*/
|
|
277
|
-
static isFile(object) {
|
|
278
|
-
if (_Validator.isBrowser()) return object instanceof Blob;
|
|
279
|
-
return _Validator.isBlob(object);
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* 检查是否为 Buffer
|
|
283
|
-
*/
|
|
284
|
-
static isBuffer(obj) {
|
|
285
|
-
return _Validator.isBrowser() ? false : Buffer.isBuffer(obj);
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* 检查是否为 FormData
|
|
289
|
-
*/
|
|
290
|
-
static isFormData(object) {
|
|
291
|
-
if (object instanceof FormData) return true;
|
|
292
|
-
return _Validator.isObject(object) && _Validator.isFunction(object["append"]) && _Validator.isFunction(object["delete"]) && _Validator.isFunction(object["get"]) && _Validator.isFunction(object["getAll"]) && _Validator.isFunction(object["has"]) && _Validator.isFunction(object["set"]) && _Validator.isFunction(object["entries"]) && _Validator.isFunction(object["keys"]) && _Validator.isFunction(object["values"]);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* 检查是否为 Headers
|
|
296
|
-
*/
|
|
297
|
-
static isHeaders(obj) {
|
|
298
|
-
if (obj instanceof Headers) return true;
|
|
299
|
-
if (_Validator.isObject(obj) && _Validator.isFunction(obj["forEach"]) && _Validator.isFunction(obj["get"]) && _Validator.isFunction(obj["has"]) && _Validator.isFunction(obj["set"]) && _Validator.isFunction(obj["append"]) && _Validator.isFunction(obj["delete"]) && _Validator.isFunction(obj["entries"]) && _Validator.isFunction(obj["keys"]) && _Validator.isFunction(obj["values"])) {
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* 检查是否为 URLSearchParams
|
|
306
|
-
*/
|
|
307
|
-
static isUrlSearchParams(obj) {
|
|
308
|
-
if (obj instanceof URLSearchParams) return true;
|
|
309
|
-
return _Validator.isObject(obj) && _Validator.isFunction(obj["append"]) && _Validator.isFunction(obj["delete"]) && _Validator.isFunction(obj["entries"]) && _Validator.isFunction(obj["forEach"]) && _Validator.isFunction(obj["get"]) && _Validator.isFunction(obj["getAll"]) && _Validator.isFunction(obj["has"]) && _Validator.isFunction(obj["keys"]) && _Validator.isFunction(obj["set"]) && _Validator.isFunction(obj["values"]) && _Validator.isFunction(obj["sort"]) && _Validator.isFunction(obj["toString"]);
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* 检查是否为合法的 Header 值
|
|
313
|
-
* 允许范围: HTAB(\t), 0x20-0x7E, 0x80-0xFF
|
|
314
|
-
* 禁止换行等控制字符
|
|
315
|
-
*/
|
|
316
|
-
static isHeaderValue(str) {
|
|
317
|
-
const regex = /^[\t\x20-\x7E\x80-\xFF]*$/;
|
|
318
|
-
return regex.test(String(str));
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* 检查是否为 BodyInit 类型
|
|
322
|
-
* BodyInit 包括: Blob | ArrayBuffer | TypedArray | DataView | FormData | URLSearchParams | ReadableStream | string
|
|
323
|
-
*/
|
|
324
|
-
static isBodyInit(value) {
|
|
325
|
-
if (value === null || value === void 0) return false;
|
|
326
|
-
return _Validator.isString(value) || _Validator.isBlob(value) || _Validator.isArrayBuffer(value) || _Validator.isFormData(value) || _Validator.isUrlSearchParams(value) || _Validator.isReadableStream(value) || _Validator.isBuffer(value) || ArrayBuffer.isView(value);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
// src/utils/shallow-clone.ts
|
|
331
|
-
function shallowClone(obj) {
|
|
332
|
-
if (Array.isArray(obj)) {
|
|
333
|
-
return [...obj];
|
|
334
|
-
}
|
|
335
|
-
if (Validator.isObject(obj)) {
|
|
336
|
-
return { ...obj };
|
|
337
|
-
}
|
|
338
|
-
return obj;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// src/utils/sleep.ts
|
|
342
|
-
function sleep(ms) {
|
|
343
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// src/request-init/utils/clone-body.ts
|
|
347
|
-
function cloneBody(obj) {
|
|
348
|
-
if (Validator.isFormData(obj)) {
|
|
349
|
-
const formData = new FormData();
|
|
350
|
-
for (const [key, value] of obj.entries()) {
|
|
351
|
-
formData.append(key, value);
|
|
352
|
-
}
|
|
353
|
-
return formData;
|
|
354
|
-
}
|
|
355
|
-
if (Validator.isUrlSearchParams(obj)) {
|
|
356
|
-
const urlSearchParams = new URLSearchParams();
|
|
357
|
-
for (const [key, value] of obj.entries()) {
|
|
358
|
-
urlSearchParams.append(key, value);
|
|
359
|
-
}
|
|
360
|
-
return urlSearchParams;
|
|
361
|
-
}
|
|
362
|
-
if (Validator.isFile(obj)) {
|
|
363
|
-
return obj;
|
|
364
|
-
}
|
|
365
|
-
if (Validator.isBlob(obj)) {
|
|
366
|
-
return obj;
|
|
367
|
-
}
|
|
368
|
-
if (Validator.isBuffer(obj)) {
|
|
369
|
-
return obj;
|
|
370
|
-
}
|
|
371
|
-
if (obj === null) {
|
|
372
|
-
return null;
|
|
373
|
-
}
|
|
374
|
-
if (Array.isArray(obj)) {
|
|
375
|
-
return obj.map(cloneBody);
|
|
376
|
-
}
|
|
377
|
-
if (Validator.isObject(obj)) {
|
|
378
|
-
const cloned = {};
|
|
379
|
-
for (const key in obj) {
|
|
380
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
381
|
-
cloned[key] = cloneBody(obj[key]);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return cloned;
|
|
385
|
-
}
|
|
386
|
-
return obj;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// src/request-init/utils/clone-headers.ts
|
|
390
|
-
function cloneHeaders(headers) {
|
|
391
|
-
const cloned = new Headers();
|
|
392
|
-
for (const [key, value] of headers.entries()) {
|
|
393
|
-
cloned.append(key, value);
|
|
394
|
-
}
|
|
395
|
-
return cloned;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// src/request-init/utils/compile-url.ts
|
|
399
|
-
import { UriTemplateParser } from "@opendoc/uri-template";
|
|
400
|
-
function compileUrl(obj, pathParameters) {
|
|
401
|
-
const url = new URL(typeof obj === "string" ? obj : obj.href);
|
|
402
|
-
url.pathname = new UriTemplateParser(
|
|
403
|
-
decodeURIComponent(url.pathname),
|
|
404
|
-
pathParameters
|
|
405
|
-
).expand();
|
|
406
|
-
return url;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
// src/request-init/utils/to-form-data.ts
|
|
410
|
-
function toFormData(body) {
|
|
411
|
-
const form = new FormData();
|
|
412
|
-
for (const [key, value] of Object.entries(body)) {
|
|
413
|
-
if (Array.isArray(value)) {
|
|
414
|
-
for (const v of value) {
|
|
415
|
-
form.append(key, v);
|
|
416
|
-
}
|
|
417
|
-
} else {
|
|
418
|
-
form.append(key, value);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return form;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// src/request-init/utils/to-url-search-params.ts
|
|
425
|
-
function toUrlSearchParams(body) {
|
|
426
|
-
const params = new URLSearchParams();
|
|
427
|
-
Object.entries(body).map(([key, value]) => {
|
|
428
|
-
if (Array.isArray(value)) {
|
|
429
|
-
for (const v of value) {
|
|
430
|
-
params.append(key, v);
|
|
431
|
-
}
|
|
432
|
-
} else {
|
|
433
|
-
params.append(key, value);
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
return params;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// src/request-init/utils/clone-request-init.ts
|
|
440
|
-
function cloneRequestInit(init) {
|
|
441
|
-
return new KeqRequestInit({
|
|
442
|
-
url: init.url,
|
|
443
|
-
pathParameters: init.pathParameters,
|
|
444
|
-
method: init.method,
|
|
445
|
-
headers: init.headers,
|
|
446
|
-
body: init.body,
|
|
447
|
-
cache: init.cache,
|
|
448
|
-
credentials: init.credentials,
|
|
449
|
-
integrity: init.integrity,
|
|
450
|
-
keepalive: init.keepalive,
|
|
451
|
-
mode: init.mode,
|
|
452
|
-
redirect: init.redirect,
|
|
453
|
-
referrer: init.referrer,
|
|
454
|
-
referrerPolicy: init.referrerPolicy
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// src/request-init/request-init.ts
|
|
459
|
-
var AbortControllerProperty = "__KeqProtectedProperty(context.request.abortController)__";
|
|
460
|
-
var _a;
|
|
461
|
-
_a = AbortControllerProperty;
|
|
462
|
-
var KeqRequestInit = class {
|
|
463
|
-
constructor(options) {
|
|
464
|
-
__publicField(this, "url");
|
|
465
|
-
__publicField(this, "pathParameters");
|
|
466
|
-
__publicField(this, "method");
|
|
467
|
-
__publicField(this, "headers");
|
|
468
|
-
__publicField(this, "body");
|
|
469
|
-
__publicField(this, "cache");
|
|
470
|
-
__publicField(this, "credentials");
|
|
471
|
-
__publicField(this, "integrity");
|
|
472
|
-
__publicField(this, "keepalive");
|
|
473
|
-
__publicField(this, "mode");
|
|
474
|
-
__publicField(this, "redirect");
|
|
475
|
-
__publicField(this, "referrer");
|
|
476
|
-
__publicField(this, "referrerPolicy");
|
|
477
|
-
__publicField(this, _a, new AbortController());
|
|
478
|
-
this.url = new URL(options.url.href);
|
|
479
|
-
this.pathParameters = shallowClone(options.pathParameters);
|
|
480
|
-
this.method = options.method;
|
|
481
|
-
this.headers = cloneHeaders(options.headers);
|
|
482
|
-
this.body = cloneBody(options.body);
|
|
483
|
-
this.cache = options.cache;
|
|
484
|
-
this.credentials = options.credentials;
|
|
485
|
-
this.integrity = options.integrity;
|
|
486
|
-
this.keepalive = options.keepalive;
|
|
487
|
-
this.mode = options.mode;
|
|
488
|
-
this.redirect = options.redirect;
|
|
489
|
-
this.referrer = options.referrer;
|
|
490
|
-
this.referrerPolicy = options.referrerPolicy;
|
|
491
|
-
}
|
|
492
|
-
// the url merged pathParameters
|
|
493
|
-
get __url__() {
|
|
494
|
-
return compileUrl(this.url, this.pathParameters);
|
|
495
|
-
}
|
|
496
|
-
get signal() {
|
|
497
|
-
return this[AbortControllerProperty].signal;
|
|
498
|
-
}
|
|
499
|
-
abort(reason) {
|
|
500
|
-
if (!this[AbortControllerProperty].signal.aborted) {
|
|
501
|
-
this[AbortControllerProperty].abort(reason);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
getContentType() {
|
|
505
|
-
const contentType = this.headers.get("Content-Type");
|
|
506
|
-
if (contentType) return contentType;
|
|
507
|
-
if (!this.body) return void 0;
|
|
508
|
-
if (Validator.isFormData(this.body)) return "multipart/form-data";
|
|
509
|
-
if (Validator.isUrlSearchParams(this.body)) return "application/x-www-form-urlencoded";
|
|
510
|
-
if (Validator.isArrayBuffer(this.body)) return "application/octet-stream";
|
|
511
|
-
if (typeof this.body === "object") return "application/json";
|
|
512
|
-
return void 0;
|
|
513
|
-
}
|
|
514
|
-
toFetchBody(contentType) {
|
|
515
|
-
const body = this.body;
|
|
516
|
-
if (body === void 0) return;
|
|
517
|
-
if (body === null) return null;
|
|
518
|
-
if (Validator.isBodyInit(body)) return body;
|
|
519
|
-
if (!contentType || contentType === "application/json") {
|
|
520
|
-
return JSON.stringify(body);
|
|
521
|
-
}
|
|
522
|
-
if (contentType === "application/x-www-form-urlencoded") {
|
|
523
|
-
if (Array.isArray(body)) {
|
|
524
|
-
throw new Exception("request.body is an array, that cannot be serialized as application/x-www-form-urlencoded format");
|
|
525
|
-
}
|
|
526
|
-
return toUrlSearchParams(body);
|
|
527
|
-
}
|
|
528
|
-
if (contentType === "multipart/form-data") {
|
|
529
|
-
if (Array.isArray(body)) {
|
|
530
|
-
throw new Exception("FormData cannot send array");
|
|
531
|
-
}
|
|
532
|
-
return toFormData(body);
|
|
533
|
-
}
|
|
534
|
-
throw new Exception("Cannot auto serialize request.body with Content-Type: ".concat(contentType));
|
|
535
|
-
}
|
|
536
|
-
toFetchArguments() {
|
|
537
|
-
const contentType = this.getContentType();
|
|
538
|
-
const headers = cloneHeaders(this.headers);
|
|
539
|
-
if (contentType) headers.set("Content-Type", contentType);
|
|
540
|
-
const body = this.toFetchBody(contentType);
|
|
541
|
-
if (contentType === "multipart/form-data") {
|
|
542
|
-
headers.delete("Content-Type");
|
|
543
|
-
}
|
|
544
|
-
const requestInit = {
|
|
545
|
-
method: this.method.toUpperCase(),
|
|
546
|
-
headers,
|
|
547
|
-
body,
|
|
548
|
-
cache: this.cache,
|
|
549
|
-
credentials: this.credentials,
|
|
550
|
-
integrity: this.integrity,
|
|
551
|
-
keepalive: this.keepalive,
|
|
552
|
-
mode: this.mode,
|
|
553
|
-
redirect: this.redirect,
|
|
554
|
-
referrer: this.referrer,
|
|
555
|
-
referrerPolicy: this.referrerPolicy,
|
|
556
|
-
signal: this.signal
|
|
557
|
-
};
|
|
558
|
-
return [this.__url__.href, requestInit];
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
// src/context/orchestrator-context.ts
|
|
563
|
-
var OrchestratorProperty = "__KeyProtectedProperty(context.orchestration.orchestrator)__";
|
|
564
|
-
var ExecutorProperty = "__KeyProtectedProperty(context.orchestration.executor)__";
|
|
565
|
-
var _a2, _b;
|
|
566
|
-
_b = OrchestratorProperty, _a2 = ExecutorProperty;
|
|
567
|
-
var KeqOrchestratorContext = class {
|
|
568
|
-
constructor(orchestrator, executor) {
|
|
569
|
-
__publicField(this, _b);
|
|
570
|
-
__publicField(this, _a2);
|
|
571
|
-
this[OrchestratorProperty] = orchestrator;
|
|
572
|
-
this[ExecutorProperty] = executor;
|
|
573
|
-
}
|
|
574
|
-
get middlewares() {
|
|
575
|
-
return this[OrchestratorProperty].executors.map((exe) => exe.context);
|
|
576
|
-
}
|
|
577
|
-
// NOTE: For Future
|
|
578
|
-
// get executing(): KeqMiddlewareContext {
|
|
579
|
-
// const current = this[OrchestratorProperty].current
|
|
580
|
-
// const executors = this[OrchestratorProperty].executors
|
|
581
|
-
// const executor = executors[current]
|
|
582
|
-
// return executor.context
|
|
583
|
-
// }
|
|
584
|
-
/**
|
|
585
|
-
* The middleware context of the current middleware
|
|
586
|
-
*/
|
|
587
|
-
get middleware() {
|
|
588
|
-
return this[ExecutorProperty].context;
|
|
589
|
-
}
|
|
590
|
-
fork() {
|
|
591
|
-
return this[OrchestratorProperty].fork();
|
|
592
|
-
}
|
|
593
|
-
merge(source) {
|
|
594
|
-
this[OrchestratorProperty].merge(source);
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
// src/context/execution-context.ts
|
|
599
|
-
var ContextOrchestratorProperty = "__KeyProtectedProperty(context.orchestrator)__";
|
|
600
|
-
var ContextOrchestrationProperty = "__KeyProtectedProperty(context.orchestration)__";
|
|
601
|
-
var _a3, _b2;
|
|
602
|
-
_b2 = ContextOrchestratorProperty, _a3 = ContextOrchestrationProperty;
|
|
603
|
-
var KeqExecutionContext = class {
|
|
604
|
-
constructor(orchestrator, executor) {
|
|
605
|
-
__publicField(this, _b2);
|
|
606
|
-
__publicField(this, _a3);
|
|
607
|
-
this[ContextOrchestratorProperty] = orchestrator;
|
|
608
|
-
this[ContextOrchestrationProperty] = new KeqOrchestratorContext(orchestrator, executor);
|
|
609
|
-
}
|
|
610
|
-
get orchestration() {
|
|
611
|
-
return this[ContextOrchestrationProperty];
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* The unique identifier of the request's location in the code
|
|
615
|
-
*/
|
|
616
|
-
get locationId() {
|
|
617
|
-
return this[ContextOrchestratorProperty].context.locationId;
|
|
618
|
-
}
|
|
619
|
-
get request() {
|
|
620
|
-
return this[ContextOrchestratorProperty].context.request;
|
|
621
|
-
}
|
|
622
|
-
get global() {
|
|
623
|
-
return this[ContextOrchestratorProperty].context.global;
|
|
624
|
-
}
|
|
625
|
-
get emitter() {
|
|
626
|
-
return this[ContextOrchestratorProperty].context.emitter;
|
|
627
|
-
}
|
|
628
|
-
get options() {
|
|
629
|
-
return this[ContextOrchestratorProperty].context.options;
|
|
630
|
-
}
|
|
631
|
-
// The result get by user if resolveWith is set to 'intelligent' or not set
|
|
632
|
-
set output(value) {
|
|
633
|
-
if (this.options.resolveWith && this.options.resolveWith !== "intelligent") {
|
|
634
|
-
console.warn("The request is configured to resolve with ".concat(this.options.resolveWith, ", so setting context.output maybe no effect."));
|
|
635
|
-
}
|
|
636
|
-
this[ContextOrchestratorProperty].context.output = value;
|
|
637
|
-
}
|
|
638
|
-
// The original response
|
|
639
|
-
get res() {
|
|
640
|
-
return this[ContextOrchestratorProperty].context.res;
|
|
641
|
-
}
|
|
642
|
-
// The original response
|
|
643
|
-
set res(value) {
|
|
644
|
-
this[ContextOrchestratorProperty].context.res = value;
|
|
645
|
-
}
|
|
646
|
-
// The request response
|
|
647
|
-
get response() {
|
|
648
|
-
return this[ContextOrchestratorProperty].context.response;
|
|
649
|
-
}
|
|
650
|
-
// The properties extends by middleware
|
|
651
|
-
get data() {
|
|
652
|
-
return this[ContextOrchestratorProperty].context.data;
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
// src/context/shared-context.ts
|
|
657
|
-
import mitt from "mitt";
|
|
658
|
-
|
|
659
|
-
// src/context/utils/watch-object.ts
|
|
660
|
-
function watchObject(obj, listeners) {
|
|
661
|
-
return new Proxy(obj, {
|
|
662
|
-
get(target, prop) {
|
|
663
|
-
if (prop in listeners) {
|
|
664
|
-
return new Proxy(target[prop], {
|
|
665
|
-
apply(target2, thisArg, argArray) {
|
|
666
|
-
const listener = listeners[prop];
|
|
667
|
-
listener(target2, thisArg, argArray);
|
|
668
|
-
return target2.apply(thisArg, argArray);
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
return target[prop];
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
// src/context/utils/clone-shared-context.ts
|
|
678
|
-
import { klona } from "klona";
|
|
679
|
-
function cloneSharedContext(context) {
|
|
680
|
-
const cloned = new KeqSharedContext({
|
|
681
|
-
locationId: context[ContextLocationIdProperty],
|
|
682
|
-
request: cloneRequestInit(context[ContextRequestProperty]),
|
|
683
|
-
global: context[ContextGlobalProperty],
|
|
684
|
-
options: klona(context[ContextOptionsProperty]),
|
|
685
|
-
data: klona(context[ContextDataProperty])
|
|
686
|
-
});
|
|
687
|
-
context[ContextEmitterProperty].all.forEach((handlers, type) => {
|
|
688
|
-
for (const handler of handlers) {
|
|
689
|
-
cloned.emitter.on(type, handler);
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
return cloned;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
// src/context/utils/fork.ts
|
|
696
|
-
import { klona as klona2 } from "klona/json";
|
|
697
|
-
var ForkedObjectBrandPropertyKey = "__KeqProtectedProperty(forked.object.brand)__";
|
|
698
|
-
var ARRAY_MUTATORS = /* @__PURE__ */ new Set([
|
|
699
|
-
"push",
|
|
700
|
-
"pop",
|
|
701
|
-
"shift",
|
|
702
|
-
"unshift",
|
|
703
|
-
"splice",
|
|
704
|
-
"sort",
|
|
705
|
-
"reverse",
|
|
706
|
-
"fill",
|
|
707
|
-
"copyWithin"
|
|
708
|
-
]);
|
|
709
|
-
function objectPath(obj, path) {
|
|
710
|
-
return path.reduce((o, k) => o[k], obj);
|
|
711
|
-
}
|
|
712
|
-
function fork(original) {
|
|
713
|
-
if (original === null || typeof original !== "object") {
|
|
714
|
-
return original;
|
|
715
|
-
}
|
|
716
|
-
let current = original;
|
|
717
|
-
const ensureCopy = () => {
|
|
718
|
-
if (current === original) {
|
|
719
|
-
current = klona2(original);
|
|
720
|
-
}
|
|
721
|
-
return current;
|
|
722
|
-
};
|
|
723
|
-
const createProxy = (path = []) => {
|
|
724
|
-
const getTarget = () => objectPath(current, path);
|
|
725
|
-
return new Proxy(getTarget(), {
|
|
726
|
-
get(target, prop) {
|
|
727
|
-
const realTarget = getTarget();
|
|
728
|
-
if (prop === ForkedObjectBrandPropertyKey) return realTarget;
|
|
729
|
-
const value = realTarget[prop];
|
|
730
|
-
if (current !== original) {
|
|
731
|
-
return value;
|
|
732
|
-
}
|
|
733
|
-
if (Array.isArray(realTarget) && ARRAY_MUTATORS.has(prop)) {
|
|
734
|
-
return new Proxy(value, {
|
|
735
|
-
apply(fn, thisArg, args) {
|
|
736
|
-
ensureCopy();
|
|
737
|
-
const t = objectPath(current, path);
|
|
738
|
-
return Reflect.apply(t[prop], t, args);
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
if (typeof value === "object" && value !== null) {
|
|
743
|
-
return createProxy([...path, prop]);
|
|
744
|
-
}
|
|
745
|
-
return value;
|
|
746
|
-
},
|
|
747
|
-
set(target, prop, value) {
|
|
748
|
-
ensureCopy();
|
|
749
|
-
objectPath(current, path)[prop] = value;
|
|
750
|
-
return true;
|
|
751
|
-
},
|
|
752
|
-
deleteProperty(target, prop) {
|
|
753
|
-
ensureCopy();
|
|
754
|
-
delete objectPath(current, path)[prop];
|
|
755
|
-
return true;
|
|
756
|
-
},
|
|
757
|
-
ownKeys(target) {
|
|
758
|
-
const realTarget = getTarget();
|
|
759
|
-
return Reflect.ownKeys(realTarget);
|
|
760
|
-
},
|
|
761
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
762
|
-
const realTarget = getTarget();
|
|
763
|
-
return Reflect.getOwnPropertyDescriptor(realTarget, prop);
|
|
764
|
-
}
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
return createProxy();
|
|
768
|
-
}
|
|
769
|
-
function unwrap(proxy) {
|
|
770
|
-
return proxy && proxy[ForkedObjectBrandPropertyKey] ? proxy[ForkedObjectBrandPropertyKey] : proxy;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
// src/context/utils/create-proxy-response.ts
|
|
774
|
-
var JsonCachePropertyKey = "__KeqProtectedProperty(response.proxy.cache.json)__";
|
|
775
|
-
var TextCachePropertyKey = "__KeqProtectedProperty(response.proxy.cache.text)__";
|
|
776
|
-
function createProxyResponse(response) {
|
|
777
|
-
return new Proxy(response, {
|
|
778
|
-
get(res, prop) {
|
|
779
|
-
if (typeof prop === "string") {
|
|
780
|
-
if (prop === "json") {
|
|
781
|
-
return new Proxy(res[prop], {
|
|
782
|
-
apply() {
|
|
783
|
-
if (res[JsonCachePropertyKey]) {
|
|
784
|
-
return fork(res[JsonCachePropertyKey]);
|
|
785
|
-
}
|
|
786
|
-
return res.clone().json().then((body) => {
|
|
787
|
-
res[JsonCachePropertyKey] = body;
|
|
788
|
-
return fork(body);
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
} else if (prop === "text") {
|
|
793
|
-
return new Proxy(res[prop], {
|
|
794
|
-
apply() {
|
|
795
|
-
if (res[TextCachePropertyKey]) {
|
|
796
|
-
return fork(res[TextCachePropertyKey]);
|
|
797
|
-
}
|
|
798
|
-
return res.clone().text().then((body) => {
|
|
799
|
-
res[TextCachePropertyKey] = body;
|
|
800
|
-
return body;
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
} else if (["arrayBuffer", "blob", "buffer", "formData"].includes(prop)) {
|
|
805
|
-
return new Proxy(res[prop], {
|
|
806
|
-
apply(target, thisArg, argArray) {
|
|
807
|
-
return res.clone()[prop](...argArray);
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
} else if (prop === "body") {
|
|
811
|
-
const mirror = res.clone();
|
|
812
|
-
return mirror.body;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
if (typeof res[prop] === "function") {
|
|
816
|
-
return res[prop].bind(res);
|
|
817
|
-
}
|
|
818
|
-
return res[prop];
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
// src/context/shared-context.ts
|
|
824
|
-
var ContextLocationIdProperty = "__KeqProtectedProperty(context.locationId)__";
|
|
825
|
-
var ContextRequestProperty = "__KeqProtectedProperty(context.request)__";
|
|
826
|
-
var ContextGlobalProperty = "__KeqProtectedProperty(context.global)__";
|
|
827
|
-
var ContextEmitterProperty = "__KeqProtectedProperty(context.emitter)__";
|
|
828
|
-
var ContextOptionsProperty = "__KeqProtectedProperty(context.options)__";
|
|
829
|
-
var ContextDataProperty = "__KeqProtectedProperty(context.data)__";
|
|
830
|
-
var ContextOutputProperty = "__KeqProtectedProperty(context.output)__";
|
|
831
|
-
var _a4, _b3, _c, _d, _e, _f, _g;
|
|
832
|
-
_g = ContextLocationIdProperty, _f = ContextRequestProperty, _e = ContextGlobalProperty, _d = ContextEmitterProperty, _c = ContextOptionsProperty, _b3 = ContextOutputProperty, _a4 = ContextDataProperty;
|
|
833
|
-
var KeqSharedContext = class {
|
|
834
|
-
constructor(options) {
|
|
835
|
-
__publicField(this, _g);
|
|
836
|
-
__publicField(this, _f);
|
|
837
|
-
__publicField(this, _e);
|
|
838
|
-
__publicField(this, _d);
|
|
839
|
-
__publicField(this, _c);
|
|
840
|
-
__publicField(this, _b3);
|
|
841
|
-
// The properties extends by middleware
|
|
842
|
-
__publicField(this, _a4, {});
|
|
843
|
-
/**
|
|
844
|
-
* original response
|
|
845
|
-
*/
|
|
846
|
-
__publicField(this, "res");
|
|
847
|
-
this[ContextLocationIdProperty] = options.locationId;
|
|
848
|
-
this[ContextRequestProperty] = watchObject(new KeqRequestInit(options.request), {
|
|
849
|
-
abort: (target, thisArg, argArray) => {
|
|
850
|
-
this[ContextEmitterProperty].emit("abort", { context: this, reason: argArray[0] });
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
this[ContextEmitterProperty] = options.emitter || mitt();
|
|
854
|
-
this[ContextGlobalProperty] = options.global;
|
|
855
|
-
this[ContextOptionsProperty] = options.options ? shallowClone(options.options) : {};
|
|
856
|
-
this[ContextDataProperty] = options.data || {};
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* The unique identifier of the request's location in the code
|
|
860
|
-
*/
|
|
861
|
-
get locationId() {
|
|
862
|
-
return this[ContextLocationIdProperty];
|
|
863
|
-
}
|
|
864
|
-
get request() {
|
|
865
|
-
return this[ContextRequestProperty];
|
|
866
|
-
}
|
|
867
|
-
get global() {
|
|
868
|
-
return this[ContextGlobalProperty];
|
|
869
|
-
}
|
|
870
|
-
get emitter() {
|
|
871
|
-
return this[ContextEmitterProperty];
|
|
872
|
-
}
|
|
873
|
-
get options() {
|
|
874
|
-
return this[ContextOptionsProperty];
|
|
875
|
-
}
|
|
876
|
-
set output(value) {
|
|
877
|
-
this[ContextOutputProperty] = value;
|
|
878
|
-
}
|
|
879
|
-
get response() {
|
|
880
|
-
if (!this.res) return void 0;
|
|
881
|
-
return createProxyResponse(this.res);
|
|
882
|
-
}
|
|
883
|
-
get data() {
|
|
884
|
-
return this[ContextDataProperty];
|
|
885
|
-
}
|
|
886
|
-
};
|
|
887
|
-
|
|
888
|
-
// src/middleware/utils/get-middleware-name.ts
|
|
889
|
-
function getMiddlewareName(middleware) {
|
|
890
|
-
return middleware.__keqMiddlewareName__ || middleware.name || "anonymous";
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
// src/middleware/utils/compose-middleware.ts
|
|
894
|
-
function composeMiddleware(middlewares, options) {
|
|
895
|
-
if (!middlewares.length) {
|
|
896
|
-
throw new TypeException("At least one middleware");
|
|
897
|
-
}
|
|
898
|
-
const middleware = [...middlewares].reverse().reduce(function(prev, curr) {
|
|
899
|
-
return async (ctx, next) => {
|
|
900
|
-
await curr(ctx, async () => prev(ctx, next));
|
|
901
|
-
};
|
|
902
|
-
});
|
|
903
|
-
if (options == null ? void 0 : options.name) {
|
|
904
|
-
middleware.__keqMiddlewareName__ = options.name;
|
|
905
|
-
} else {
|
|
906
|
-
middleware.__keqMiddlewareName__ = "composeMiddleware(".concat(middlewares.map((i) => getMiddlewareName(i)).join(", "), ")");
|
|
907
|
-
}
|
|
908
|
-
return middleware;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// src/context/middleware-context.ts
|
|
912
|
-
var ExecutorProperty2 = "__KeyProtectedProperty(context.orchestration.middlewares)__";
|
|
913
|
-
var _a5;
|
|
914
|
-
_a5 = ExecutorProperty2;
|
|
915
|
-
var KeqMiddlewareContext = class {
|
|
916
|
-
constructor(executor) {
|
|
917
|
-
__publicField(this, _a5);
|
|
918
|
-
this[ExecutorProperty2] = executor;
|
|
919
|
-
}
|
|
920
|
-
get name() {
|
|
921
|
-
return this[ExecutorProperty2].name;
|
|
922
|
-
}
|
|
923
|
-
get status() {
|
|
924
|
-
return this[ExecutorProperty2].status;
|
|
925
|
-
}
|
|
926
|
-
get finished() {
|
|
927
|
-
return this.status === "fulfilled" || this.status === "rejected";
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
|
|
931
|
-
// src/orchestrator/executor.ts
|
|
932
|
-
var KeqMiddlewareExecutor = class {
|
|
933
|
-
constructor(middleware) {
|
|
934
|
-
this.middleware = middleware;
|
|
935
|
-
__publicField(this, "name");
|
|
936
|
-
__publicField(this, "status", "idle");
|
|
937
|
-
__publicField(this, "context");
|
|
938
|
-
this.name = getMiddlewareName(middleware);
|
|
939
|
-
this.context = new KeqMiddlewareContext(this);
|
|
940
|
-
}
|
|
941
|
-
async execute(context, next) {
|
|
942
|
-
if (this.status !== "idle") {
|
|
943
|
-
throw new Exception('Middleware "'.concat(this.name, '" has already been executed.'));
|
|
944
|
-
}
|
|
945
|
-
try {
|
|
946
|
-
this.status = "pending";
|
|
947
|
-
context.emitter.emit("middleware:before", { context });
|
|
948
|
-
await this.middleware(context, next);
|
|
949
|
-
context.emitter.emit("middleware:after", { context });
|
|
950
|
-
if (this.status === "pending") {
|
|
951
|
-
this.status = "fulfilled";
|
|
952
|
-
}
|
|
953
|
-
} catch (error) {
|
|
954
|
-
if (this.status === "pending") {
|
|
955
|
-
this.status = "rejected";
|
|
956
|
-
}
|
|
957
|
-
throw error;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
// src/request-init/utils/assign-request-init.ts
|
|
963
|
-
function assignRequestInit(target, source) {
|
|
964
|
-
target.url = source.url;
|
|
965
|
-
target.pathParameters = source.pathParameters;
|
|
966
|
-
target.method = source.method;
|
|
967
|
-
target.headers = source.headers;
|
|
968
|
-
target.body = source.body;
|
|
969
|
-
target.cache = source.cache;
|
|
970
|
-
target.credentials = source.credentials;
|
|
971
|
-
target.integrity = source.integrity;
|
|
972
|
-
target.keepalive = source.keepalive;
|
|
973
|
-
target.mode = source.mode;
|
|
974
|
-
target.redirect = source.redirect;
|
|
975
|
-
target.referrer = source.referrer;
|
|
976
|
-
target.referrerPolicy = source.referrerPolicy;
|
|
977
|
-
target[AbortControllerProperty] = source[AbortControllerProperty];
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
// src/context/utils/assign-shared-context.ts
|
|
981
|
-
function assignSharedContext(target, source) {
|
|
982
|
-
assignRequestInit(target.request, source.request);
|
|
983
|
-
Object.assign(target.global, source.global);
|
|
984
|
-
Object.assign(target.options, source.options);
|
|
985
|
-
Object.assign(target.data, source.data);
|
|
986
|
-
target[ContextEmitterProperty] = source[ContextEmitterProperty];
|
|
987
|
-
target[ContextOutputProperty] = source[ContextOutputProperty];
|
|
988
|
-
target.res = source.res;
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
// src/orchestrator/orchestrator.ts
|
|
992
|
-
var KeqMiddlewareOrchestrator = class _KeqMiddlewareOrchestrator {
|
|
993
|
-
constructor(context, middlewares = [], inherit) {
|
|
994
|
-
__publicField(this, "main");
|
|
995
|
-
__publicField(this, "status", "idle");
|
|
996
|
-
__publicField(this, "context");
|
|
997
|
-
__publicField(this, "executors", []);
|
|
998
|
-
__publicField(this, "current", -1);
|
|
999
|
-
this.context = context;
|
|
1000
|
-
this.executors = middlewares.map((mw) => new KeqMiddlewareExecutor(mw));
|
|
1001
|
-
if (inherit == null ? void 0 : inherit.main) this.main = inherit.main;
|
|
1002
|
-
}
|
|
1003
|
-
cancelNotFinished() {
|
|
1004
|
-
const current = this.current;
|
|
1005
|
-
for (let i = current + 1; i < this.executors.length; i++) {
|
|
1006
|
-
const executor = this.executors[i];
|
|
1007
|
-
if (executor.status === "pending") {
|
|
1008
|
-
executor.status = "canceled";
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
async run() {
|
|
1013
|
-
if (this.executors.length === 0) return;
|
|
1014
|
-
const executors = [...this.executors];
|
|
1015
|
-
const next = async (nextIndex) => {
|
|
1016
|
-
if (nextIndex >= executors.length) return;
|
|
1017
|
-
const nextExecutor = executors[nextIndex];
|
|
1018
|
-
if (nextExecutor.status !== "idle") {
|
|
1019
|
-
const msg = "Cannot call next() because the next Middleware(".concat(nextExecutor.name, ") status is ").concat(nextExecutor.status, ". If you want to re-execute it, please fork a new orchestrator.");
|
|
1020
|
-
throw new Exception(msg);
|
|
1021
|
-
}
|
|
1022
|
-
if (this.current + 1 !== nextIndex) {
|
|
1023
|
-
const parentExecutor = executors[nextIndex - 1];
|
|
1024
|
-
const msg = parentExecutor ? "Cannot call next() outside Middleware(".concat(parentExecutor.name, ") runtime. You can fork a new orchestration and execute the forked one anywhere.") : "Cannot jump to non-sequential middleware. Please call next() in order.";
|
|
1025
|
-
throw new Exception(msg);
|
|
1026
|
-
}
|
|
1027
|
-
const last = this.current;
|
|
1028
|
-
this.current = nextIndex;
|
|
1029
|
-
const context = new KeqExecutionContext(this, nextExecutor);
|
|
1030
|
-
try {
|
|
1031
|
-
await nextExecutor.execute(context, () => next.call(this, nextIndex + 1));
|
|
1032
|
-
} finally {
|
|
1033
|
-
if (this.current === last + 1) {
|
|
1034
|
-
this.current = last;
|
|
1035
|
-
} else if (this.current > last) {
|
|
1036
|
-
this.cancelNotFinished();
|
|
1037
|
-
this.current = last;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
|
-
await next.call(this, 0);
|
|
1042
|
-
}
|
|
1043
|
-
async execute() {
|
|
1044
|
-
if (this.status !== "idle") {
|
|
1045
|
-
throw new Exception("Orchestrator has already been executed.");
|
|
1046
|
-
}
|
|
1047
|
-
this.status = "pending";
|
|
1048
|
-
try {
|
|
1049
|
-
await this.run();
|
|
1050
|
-
this.status = "fulfilled";
|
|
1051
|
-
} catch (error) {
|
|
1052
|
-
this.status = "rejected";
|
|
1053
|
-
throw error;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
fork() {
|
|
1057
|
-
const context = cloneSharedContext(this.context);
|
|
1058
|
-
const next = this.current + 1;
|
|
1059
|
-
const middlewares = this.executors.slice(next).map((executor) => executor.middleware);
|
|
1060
|
-
const forkedOrchestrator = new _KeqMiddlewareOrchestrator(context, middlewares, {
|
|
1061
|
-
main: {
|
|
1062
|
-
orchestrator: this.main ? this.main.orchestrator : this,
|
|
1063
|
-
index: this.main ? this.main.index + next : next
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
return forkedOrchestrator;
|
|
1067
|
-
}
|
|
1068
|
-
merge(source) {
|
|
1069
|
-
if (!source.main) throw new TypeException("Source orchestrator is not a forked orchestrator.");
|
|
1070
|
-
const target = this.main ? this.main.orchestrator : this;
|
|
1071
|
-
if (source.main.orchestrator !== target) throw new TypeException("Cannot rebase to unrelated orchestrator");
|
|
1072
|
-
if (source.main.index !== this.current + 1) throw new TypeException("Cannot merge from non-current(expected: ".concat(this.current + 1, ", actual: ").concat(source.main.index, ") forked orchestrator"));
|
|
1073
|
-
assignSharedContext(this.context, source.context);
|
|
1074
|
-
for (const [i, executor] of this.executors.slice(source.main.index).entries()) {
|
|
1075
|
-
executor.status = source.executors[i].status;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
|
-
|
|
1080
|
-
// src/request/utils/fix-content-type.ts
|
|
1081
|
-
function fixContentType(contentType) {
|
|
1082
|
-
if (["json", "xml"].includes(contentType)) {
|
|
1083
|
-
return "application/".concat(contentType);
|
|
1084
|
-
} else if (["html", "css"].includes(contentType)) {
|
|
1085
|
-
return "text/".concat(contentType);
|
|
1086
|
-
} else if (["form-data"].includes(contentType)) {
|
|
1087
|
-
return "multipart/".concat(contentType);
|
|
1088
|
-
} else if (["jpeg", "bmp", "apng", "gif", "x-icon", "png", "webp", "tiff"].includes(contentType)) {
|
|
1089
|
-
return "image/".concat(contentType);
|
|
1090
|
-
} else if (contentType === "form") {
|
|
1091
|
-
return "application/x-www-form-urlencoded";
|
|
1092
|
-
} else if (contentType === "svg") {
|
|
1093
|
-
return "image/svg+xml";
|
|
1094
|
-
}
|
|
1095
|
-
return contentType;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
// src/request/utils/get-location-id.ts
|
|
1099
|
-
function getLocationId(depth = 0) {
|
|
1100
|
-
const err = new Error();
|
|
1101
|
-
if (!err.stack) return "";
|
|
1102
|
-
const stackLine = err.stack.split("\n")[depth + 2];
|
|
1103
|
-
return stackLine.trim();
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
// src/request/utils/resolve-with.ts
|
|
1107
|
-
import { EventSourceParserStream } from "eventsource-parser/stream";
|
|
1108
|
-
async function resolveWith(response, mode) {
|
|
1109
|
-
if (mode === "response") return response.clone();
|
|
1110
|
-
if (mode === "text") return await response.text();
|
|
1111
|
-
if (mode === "json") return unwrap(await response.json());
|
|
1112
|
-
if (mode === "form-data") return await response.formData();
|
|
1113
|
-
if (mode === "blob") return await response.blob();
|
|
1114
|
-
if (mode === "array-buffer") return await response.arrayBuffer();
|
|
1115
|
-
if (mode === "sse") {
|
|
1116
|
-
if (!response.body) return response.body;
|
|
1117
|
-
return response.clone().body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
|
|
1118
|
-
}
|
|
1119
|
-
return void 0;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// src/request/utils/intelligent-parse-response.ts
|
|
1123
|
-
async function intelligentParseResponse(response) {
|
|
1124
|
-
if (!response) return void 0;
|
|
1125
|
-
if (response.status === 204) {
|
|
1126
|
-
return void 0;
|
|
1127
|
-
}
|
|
1128
|
-
const contentType = response.headers.get("content-type") || "";
|
|
1129
|
-
try {
|
|
1130
|
-
if (contentType.match(/^application\/(.+\+)?json/)) {
|
|
1131
|
-
return resolveWith(response, "json");
|
|
1132
|
-
} else if (contentType.includes("multipart/form-data")) {
|
|
1133
|
-
return resolveWith(response, "form-data");
|
|
1134
|
-
} else if (contentType.includes("plain/text")) {
|
|
1135
|
-
return resolveWith(response, "text");
|
|
1136
|
-
} else if (contentType.includes("text/event-stream")) {
|
|
1137
|
-
return resolveWith(response, "sse");
|
|
1138
|
-
}
|
|
1139
|
-
} catch (err) {
|
|
1140
|
-
console.warn("Failed to intelligent parse response body: ".concat(response.url), err);
|
|
1141
|
-
throw err;
|
|
1142
|
-
}
|
|
1143
|
-
return void 0;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
// src/request/utils/merge-keq-request-body.ts
|
|
1147
|
-
function mergeKeqRequestBody(left, right) {
|
|
1148
|
-
if (right === void 0) return left;
|
|
1149
|
-
if (typeof right === "number") {
|
|
1150
|
-
throw new TypeError("Cannot set request body to a number.");
|
|
1151
|
-
}
|
|
1152
|
-
if (left === null || right === null || Validator.isBuffer(right) || Validator.isArrayBuffer(right) || Validator.isBlob(right) || Validator.isReadableStream(right) || Validator.isBuffer(left) || Validator.isArrayBuffer(left) || Validator.isBlob(left) || Validator.isReadableStream(left) || Array.isArray(left) || Array.isArray(right) || typeof left !== "object" && left !== void 0 || typeof right !== "object") {
|
|
1153
|
-
return Array.isArray(right) ? [...right] : right;
|
|
1154
|
-
}
|
|
1155
|
-
const result = left || {};
|
|
1156
|
-
if (Validator.isUrlSearchParams(right)) {
|
|
1157
|
-
const keys = right.keys();
|
|
1158
|
-
for (const key of keys) {
|
|
1159
|
-
const values = right.getAll(key);
|
|
1160
|
-
if (values.length === 1) {
|
|
1161
|
-
result[key] = values[0];
|
|
1162
|
-
} else if (values.length > 1) {
|
|
1163
|
-
result[key] = values;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
} else if (Validator.isFormData(right)) {
|
|
1167
|
-
const keys = right.keys();
|
|
1168
|
-
for (const key of keys) {
|
|
1169
|
-
const values = right.getAll(key);
|
|
1170
|
-
if (values.length === 1) {
|
|
1171
|
-
result[key] = values[0];
|
|
1172
|
-
} else if (values.length > 1) {
|
|
1173
|
-
result[key] = values;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
} else if (typeof right === "object") {
|
|
1177
|
-
for (const key in right) {
|
|
1178
|
-
result[key] = right[key];
|
|
1179
|
-
}
|
|
1180
|
-
} else {
|
|
1181
|
-
throw new Exception("Not support request body type: ".concat(typeof right));
|
|
1182
|
-
}
|
|
1183
|
-
return result;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
// src/request/utils/query-stringify.ts
|
|
1187
|
-
import qs from "qs";
|
|
1188
|
-
function normalize(value, options) {
|
|
1189
|
-
if (Array.isArray(value)) {
|
|
1190
|
-
return value.map((v) => normalize(v, options));
|
|
1191
|
-
}
|
|
1192
|
-
if (typeof value === "bigint") {
|
|
1193
|
-
return value.toString();
|
|
1194
|
-
}
|
|
1195
|
-
if (typeof value === "object" && value !== null) {
|
|
1196
|
-
const obj = { ...value };
|
|
1197
|
-
for (const key of Object.keys(obj)) {
|
|
1198
|
-
obj[key] = normalize(obj[key], options);
|
|
1199
|
-
}
|
|
1200
|
-
return obj;
|
|
1201
|
-
}
|
|
1202
|
-
return value;
|
|
1203
|
-
}
|
|
1204
|
-
function queryStringify(query, options) {
|
|
1205
|
-
const value = normalize(query, options);
|
|
1206
|
-
const opts = {};
|
|
1207
|
-
if ((options == null ? void 0 : options.allowDots) !== void 0) {
|
|
1208
|
-
opts.allowDots = options.allowDots;
|
|
1209
|
-
}
|
|
1210
|
-
if ((options == null ? void 0 : options.indices) !== void 0) {
|
|
1211
|
-
opts.indices = options.indices;
|
|
1212
|
-
}
|
|
1213
|
-
if ((options == null ? void 0 : options.arrayFormat) === "pipe") {
|
|
1214
|
-
opts.filter = (_, val) => {
|
|
1215
|
-
if (Array.isArray(val)) return val.join("|");
|
|
1216
|
-
return val;
|
|
1217
|
-
};
|
|
1218
|
-
} else if ((options == null ? void 0 : options.arrayFormat) === "space") {
|
|
1219
|
-
opts.filter = (_, val) => {
|
|
1220
|
-
if (Array.isArray(val)) return val.join(" ");
|
|
1221
|
-
return val;
|
|
1222
|
-
};
|
|
1223
|
-
} else if (options == null ? void 0 : options.arrayFormat) {
|
|
1224
|
-
opts.arrayFormat = options.arrayFormat;
|
|
1225
|
-
}
|
|
1226
|
-
return qs.stringify(value, opts);
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
// src/request/core.ts
|
|
1230
|
-
var Core = class {
|
|
1231
|
-
constructor(url, options) {
|
|
1232
|
-
/**
|
|
1233
|
-
* The unique identifier of the request's location in the code
|
|
1234
|
-
*/
|
|
1235
|
-
__publicField(this, "__locationId__");
|
|
1236
|
-
__publicField(this, "requestPromise");
|
|
1237
|
-
__publicField(this, "requestInit");
|
|
1238
|
-
__publicField(this, "__listeners__", {});
|
|
1239
|
-
__publicField(this, "__global__");
|
|
1240
|
-
__publicField(this, "__prepend_middlewares__", []);
|
|
1241
|
-
__publicField(this, "__append_middlewares__", []);
|
|
1242
|
-
__publicField(this, "__qs__");
|
|
1243
|
-
__publicField(this, "__options__", {
|
|
1244
|
-
resolveWithFullResponse: false,
|
|
1245
|
-
resolveWith: "intelligent"
|
|
1246
|
-
});
|
|
1247
|
-
this.__global__ = options.global || {};
|
|
1248
|
-
this.__locationId__ = options.locationId;
|
|
1249
|
-
this.__qs__ = options.qs;
|
|
1250
|
-
this.requestInit = new KeqRequestInit({
|
|
1251
|
-
method: "get",
|
|
1252
|
-
headers: new Headers(),
|
|
1253
|
-
pathParameters: {},
|
|
1254
|
-
body: void 0,
|
|
1255
|
-
...options,
|
|
1256
|
-
url: new URL(url.href)
|
|
1257
|
-
});
|
|
1258
|
-
if (options.middlewares) {
|
|
1259
|
-
this.__append_middlewares__.push(...options.middlewares);
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
get __middlewares__() {
|
|
1263
|
-
return [...this.__prepend_middlewares__, ...this.__append_middlewares__];
|
|
1264
|
-
}
|
|
1265
|
-
// prependMiddlewares(...middlewares: KeqMiddleware[]): this {
|
|
1266
|
-
// this.__prepend_middlewares__.push(...middlewares)
|
|
1267
|
-
// return this
|
|
1268
|
-
// }
|
|
1269
|
-
// /**
|
|
1270
|
-
// * Appends middlewares to the end of the middleware chain.
|
|
1271
|
-
// * Using this method indiscriminately is discouraged;
|
|
1272
|
-
// * prefer using `.use` to maintain predictable execution order.
|
|
1273
|
-
// */
|
|
1274
|
-
// appendMiddlewares(...middlewares: KeqMiddleware[]): this {
|
|
1275
|
-
// this.__append_middlewares__.unshift(...middlewares)
|
|
1276
|
-
// return this
|
|
1277
|
-
// }
|
|
1278
|
-
use(...middlewares) {
|
|
1279
|
-
this.__prepend_middlewares__.push(...middlewares);
|
|
1280
|
-
return this;
|
|
1281
|
-
}
|
|
1282
|
-
on(event, listener) {
|
|
1283
|
-
this.__listeners__[event] = this.__listeners__[event] || [];
|
|
1284
|
-
this.__listeners__[event].push(listener);
|
|
1285
|
-
return this;
|
|
1286
|
-
}
|
|
1287
|
-
option(key, value = true) {
|
|
1288
|
-
this.__options__[key] = value;
|
|
1289
|
-
return this;
|
|
1290
|
-
}
|
|
1291
|
-
options(opts) {
|
|
1292
|
-
for (const [key, value] of Object.entries(opts)) {
|
|
1293
|
-
this.__options__[key] = value;
|
|
1294
|
-
}
|
|
1295
|
-
return this;
|
|
1296
|
-
}
|
|
1297
|
-
buildSharedContext() {
|
|
1298
|
-
const coreContext = new KeqSharedContext({
|
|
1299
|
-
locationId: this.__locationId__,
|
|
1300
|
-
request: this.requestInit,
|
|
1301
|
-
global: this.__global__,
|
|
1302
|
-
options: this.__options__
|
|
1303
|
-
});
|
|
1304
|
-
for (const eventName in this.__listeners__) {
|
|
1305
|
-
const listeners = this.__listeners__[eventName];
|
|
1306
|
-
for (const listener of listeners) {
|
|
1307
|
-
coreContext.emitter.on(eventName, listener);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
return coreContext;
|
|
1311
|
-
}
|
|
1312
|
-
async run() {
|
|
1313
|
-
var _a6, _b4, _c2, _d2;
|
|
1314
|
-
let attempt;
|
|
1315
|
-
while (true) {
|
|
1316
|
-
const attemptWithDefault = attempt || 0;
|
|
1317
|
-
const sharedContext = this.buildSharedContext();
|
|
1318
|
-
const orchestrator = new KeqMiddlewareOrchestrator(sharedContext, this.__middlewares__);
|
|
1319
|
-
if (attempt !== void 0) sharedContext.data.retry = { attempt };
|
|
1320
|
-
if (attempt && attempt >= 1) sharedContext.emitter.emit("retry", { context: sharedContext });
|
|
1321
|
-
let error = null;
|
|
1322
|
-
try {
|
|
1323
|
-
await orchestrator.execute();
|
|
1324
|
-
} catch (err) {
|
|
1325
|
-
error = err;
|
|
1326
|
-
}
|
|
1327
|
-
const retryOn = typeof ((_a6 = sharedContext.options.retry) == null ? void 0 : _a6.on) === "function" ? sharedContext.options.retry.on : (attempt2, error2) => {
|
|
1328
|
-
if (error2 instanceof RequestException && error2.retry === false) return false;
|
|
1329
|
-
return !!error2;
|
|
1330
|
-
};
|
|
1331
|
-
let retryTimes = ((_b4 = sharedContext.options.retry) == null ? void 0 : _b4.times) || 0;
|
|
1332
|
-
if (retryTimes) {
|
|
1333
|
-
if (retryTimes < 0) retryTimes = 0;
|
|
1334
|
-
else if (!Number.isInteger(retryTimes)) retryTimes = Math.floor(retryTimes);
|
|
1335
|
-
}
|
|
1336
|
-
if (attemptWithDefault >= retryTimes || await retryOn(attemptWithDefault, error, sharedContext) === false) {
|
|
1337
|
-
if (error) {
|
|
1338
|
-
sharedContext.emitter.emit("error", { context: sharedContext });
|
|
1339
|
-
throw error;
|
|
1340
|
-
}
|
|
1341
|
-
return sharedContext;
|
|
1342
|
-
}
|
|
1343
|
-
const retryDelay = typeof ((_c2 = sharedContext.options.retry) == null ? void 0 : _c2.delay) === "function" ? await sharedContext.options.retry.delay(attemptWithDefault, error, sharedContext) : ((_d2 = sharedContext.options.retry) == null ? void 0 : _d2.delay) || 0;
|
|
1344
|
-
if (retryDelay) await sleep(retryDelay);
|
|
1345
|
-
attempt = attemptWithDefault + 1;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
async end() {
|
|
1349
|
-
var _a6;
|
|
1350
|
-
const coreContext = await this.run();
|
|
1351
|
-
const resolveWithMode = coreContext.options.resolveWith;
|
|
1352
|
-
if (resolveWithMode === "response") {
|
|
1353
|
-
return (_a6 = coreContext.response) == null ? void 0 : _a6.clone();
|
|
1354
|
-
}
|
|
1355
|
-
const response = coreContext.response;
|
|
1356
|
-
if (!resolveWithMode || resolveWithMode === "intelligent") {
|
|
1357
|
-
const output = coreContext.output;
|
|
1358
|
-
if (output !== void 0) {
|
|
1359
|
-
return output;
|
|
1360
|
-
}
|
|
1361
|
-
return await intelligentParseResponse(response);
|
|
1362
|
-
}
|
|
1363
|
-
if (!response) {
|
|
1364
|
-
throw new Exception([
|
|
1365
|
-
"Unable to process the response with '".concat(resolveWithMode, "'. Possible causes:"),
|
|
1366
|
-
"1. The request was never initiated or sent",
|
|
1367
|
-
"2. The request failed before a response was received."
|
|
1368
|
-
].join("\n"));
|
|
1369
|
-
}
|
|
1370
|
-
return await resolveWith(response, resolveWithMode);
|
|
1371
|
-
}
|
|
1372
|
-
/**
|
|
1373
|
-
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
1374
|
-
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
1375
|
-
* @param onrejected The callback to execute when the Promise is rejected.
|
|
1376
|
-
* @returns A Promise for the completion of which ever callback is executed.
|
|
1377
|
-
*/
|
|
1378
|
-
then(onfulfilled, onrejected) {
|
|
1379
|
-
if (!this.requestPromise) this.requestPromise = this.end();
|
|
1380
|
-
return this.requestPromise.then(onfulfilled, onrejected);
|
|
1381
|
-
}
|
|
1382
|
-
catch(onrejected) {
|
|
1383
|
-
return this.end().catch(onrejected);
|
|
1384
|
-
}
|
|
1385
|
-
finally(onfinally) {
|
|
1386
|
-
return this.end().finally(onfinally);
|
|
1387
|
-
}
|
|
1388
|
-
};
|
|
1389
|
-
|
|
1390
|
-
// src/request/keq.ts
|
|
1391
|
-
var Keq = class extends Core {
|
|
1392
|
-
set(headersOrName, value) {
|
|
1393
|
-
if (Validator.isHeaders(headersOrName)) {
|
|
1394
|
-
headersOrName.forEach((value2, key) => {
|
|
1395
|
-
this.requestInit.headers.set(key, value2);
|
|
1396
|
-
});
|
|
1397
|
-
} else if (typeof headersOrName === "string" && value) {
|
|
1398
|
-
if (!Validator.isHeaderValue(value)) {
|
|
1399
|
-
throw new Exception("[Invalid header] Key: ".concat(headersOrName, " Value: ").concat(value));
|
|
1400
|
-
}
|
|
1401
|
-
this.requestInit.headers.set(headersOrName, String(value));
|
|
1402
|
-
} else if (typeof headersOrName === "object") {
|
|
1403
|
-
for (const [key, value2] of Object.entries(headersOrName)) {
|
|
1404
|
-
if (!Validator.isHeaderValue(value2)) {
|
|
1405
|
-
throw new Exception("[Invalid header] Key: ".concat(key, " Value: ").concat(String(value2)));
|
|
1406
|
-
}
|
|
1407
|
-
this.requestInit.headers.set(key, String(value2));
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
return this;
|
|
1411
|
-
}
|
|
1412
|
-
headers(headersOrName, value) {
|
|
1413
|
-
return this.set(headersOrName, value);
|
|
1414
|
-
}
|
|
1415
|
-
query(arg1, arg2, arg3) {
|
|
1416
|
-
if (Validator.isObject(arg1)) {
|
|
1417
|
-
const str = queryStringify(arg1, arg2 || this.__qs__);
|
|
1418
|
-
for (const [k, v] of new URLSearchParams(str).entries()) {
|
|
1419
|
-
for (const item of Array.isArray(v) ? v : [v]) {
|
|
1420
|
-
this.requestInit.url.searchParams.append(k, item);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
this.requestInit.url.search = this.requestInit.url.searchParams.toString().replace(/\+/g, "%20");
|
|
1424
|
-
return this;
|
|
1425
|
-
}
|
|
1426
|
-
if (typeof arg1 === "string") {
|
|
1427
|
-
this.query({ [arg1]: arg2 }, arg3);
|
|
1428
|
-
return this;
|
|
1429
|
-
}
|
|
1430
|
-
throw new TypeException("Invalid Arguments for .query()");
|
|
1431
|
-
}
|
|
1432
|
-
params(arg1, arg2) {
|
|
1433
|
-
if (typeof arg1 === "string" && arg2 !== void 0) {
|
|
1434
|
-
this.requestInit.pathParameters[arg1] = arg2;
|
|
1435
|
-
} else if (typeof arg1 === "object" && arg1 !== null) {
|
|
1436
|
-
for (const k of Object.keys(arg1)) {
|
|
1437
|
-
if (arg1[k]) this.requestInit.pathParameters[k] = arg1[k];
|
|
1438
|
-
}
|
|
1439
|
-
} else {
|
|
1440
|
-
throw new TypeError("Invalid Arguments for .params()");
|
|
1441
|
-
}
|
|
1442
|
-
return this;
|
|
1443
|
-
}
|
|
1444
|
-
/**
|
|
1445
|
-
* Set request body
|
|
1446
|
-
*/
|
|
1447
|
-
body(value) {
|
|
1448
|
-
this.requestInit.body = value;
|
|
1449
|
-
return this;
|
|
1450
|
-
}
|
|
1451
|
-
type(contentType) {
|
|
1452
|
-
const type = fixContentType(contentType);
|
|
1453
|
-
this.set("content-type", type);
|
|
1454
|
-
return this;
|
|
1455
|
-
}
|
|
1456
|
-
/**
|
|
1457
|
-
* Http Basic Authentication
|
|
1458
|
-
*/
|
|
1459
|
-
auth(username, password) {
|
|
1460
|
-
this.set("Authorization", "Basic ".concat(base64Encode("".concat(username, ":").concat(password))));
|
|
1461
|
-
return this;
|
|
1462
|
-
}
|
|
1463
|
-
setTypeIfEmpty(contentType) {
|
|
1464
|
-
if (!this.requestInit.headers.has("Content-Type")) void this.type(contentType);
|
|
1465
|
-
}
|
|
1466
|
-
send(value) {
|
|
1467
|
-
this.requestInit.body = mergeKeqRequestBody(this.requestInit.body, value);
|
|
1468
|
-
if (Validator.isUrlSearchParams(value)) {
|
|
1469
|
-
this.setTypeIfEmpty("form");
|
|
1470
|
-
} else if (Validator.isFormData(value)) {
|
|
1471
|
-
this.setTypeIfEmpty("form-data");
|
|
1472
|
-
} else if (Validator.isBlob(value) || Validator.isReadableStream(value) || Validator.isArrayBuffer(value)) {
|
|
1473
|
-
} else if (typeof value === "object") {
|
|
1474
|
-
this.setTypeIfEmpty("json");
|
|
1475
|
-
}
|
|
1476
|
-
return this;
|
|
1477
|
-
}
|
|
1478
|
-
field(arg1, arg2) {
|
|
1479
|
-
if (typeof arg1 === "object") {
|
|
1480
|
-
this.requestInit.body = mergeKeqRequestBody(this.requestInit.body, arg1);
|
|
1481
|
-
} else if (arg2) {
|
|
1482
|
-
this.requestInit.body = mergeKeqRequestBody(this.requestInit.body, { [arg1]: arg2 });
|
|
1483
|
-
} else {
|
|
1484
|
-
throw new TypeException("Invalid arguments for .field()");
|
|
1485
|
-
}
|
|
1486
|
-
this.setTypeIfEmpty("form-data");
|
|
1487
|
-
return this;
|
|
1488
|
-
}
|
|
1489
|
-
attach(key, value, arg3 = "file") {
|
|
1490
|
-
const formData = new FormData();
|
|
1491
|
-
const appendFile = (file) => {
|
|
1492
|
-
if (Validator.isBlob(file)) {
|
|
1493
|
-
formData.append(key, file, arg3);
|
|
1494
|
-
} else if (Validator.isFile(file)) {
|
|
1495
|
-
formData.append(key, file);
|
|
1496
|
-
} else if (Validator.isBuffer(file)) {
|
|
1497
|
-
formData.append(key, new Blob([file]), arg3);
|
|
1498
|
-
} else {
|
|
1499
|
-
throw new TypeException("Invalid file type for .attach()");
|
|
1500
|
-
}
|
|
1501
|
-
};
|
|
1502
|
-
if (Array.isArray(value)) {
|
|
1503
|
-
if (value.length === 0) {
|
|
1504
|
-
throw new TypeException("Empty array provided to .attach() is not valid");
|
|
1505
|
-
}
|
|
1506
|
-
for (const item of value) {
|
|
1507
|
-
appendFile(item);
|
|
1508
|
-
}
|
|
1509
|
-
} else {
|
|
1510
|
-
appendFile(value);
|
|
1511
|
-
}
|
|
1512
|
-
const files = formData.getAll(key);
|
|
1513
|
-
this.requestInit.body = mergeKeqRequestBody(
|
|
1514
|
-
this.requestInit.body,
|
|
1515
|
-
{
|
|
1516
|
-
[key]: files.length === 1 ? files[0] : files
|
|
1517
|
-
}
|
|
1518
|
-
);
|
|
1519
|
-
this.setTypeIfEmpty("form-data");
|
|
1520
|
-
return this;
|
|
1521
|
-
}
|
|
1522
|
-
/**
|
|
1523
|
-
*
|
|
1524
|
-
* @param retryTimes Max number of retries per call
|
|
1525
|
-
* @param retryDelay Initial value used to calculate the retry in milliseconds (This is still randomized following the randomization factor)
|
|
1526
|
-
* @param retryCallback Will be called after request failed
|
|
1527
|
-
*/
|
|
1528
|
-
retry(retryTimes, retryDelay = 0, retryOn = (attempt, error) => !!error) {
|
|
1529
|
-
this.option("retry", {
|
|
1530
|
-
times: retryTimes,
|
|
1531
|
-
delay: retryDelay,
|
|
1532
|
-
on: retryOn
|
|
1533
|
-
});
|
|
1534
|
-
return this;
|
|
1535
|
-
}
|
|
1536
|
-
redirect(mod) {
|
|
1537
|
-
this.requestInit.redirect = mod;
|
|
1538
|
-
return this;
|
|
1539
|
-
}
|
|
1540
|
-
credentials(mod) {
|
|
1541
|
-
this.requestInit.credentials = mod;
|
|
1542
|
-
return this;
|
|
1543
|
-
}
|
|
1544
|
-
mode(mod) {
|
|
1545
|
-
this.requestInit.mode = mod;
|
|
1546
|
-
return this;
|
|
1547
|
-
}
|
|
1548
|
-
flowControl(mode, arg2, arg3) {
|
|
1549
|
-
const concurrencyLimit = typeof arg2 === "number" ? arg2 : void 0;
|
|
1550
|
-
const sig = typeof arg2 === "function" || typeof arg2 === "string" ? arg2 : arg3 && (typeof arg3 === "function" || typeof arg3 === "string") ? arg3 : this.__locationId__;
|
|
1551
|
-
if (!sig) {
|
|
1552
|
-
throw new Exception("please set signal to .flowControl()");
|
|
1553
|
-
}
|
|
1554
|
-
const flowControl = {
|
|
1555
|
-
mode,
|
|
1556
|
-
concurrencyLimit,
|
|
1557
|
-
signal: sig
|
|
1558
|
-
};
|
|
1559
|
-
this.option("flowControl", flowControl);
|
|
1560
|
-
return this;
|
|
1561
|
-
}
|
|
1562
|
-
timeout(milliseconds) {
|
|
1563
|
-
this.option("timeout", { millisecond: milliseconds });
|
|
1564
|
-
return this;
|
|
1565
|
-
}
|
|
1566
|
-
resolveWith(m2) {
|
|
1567
|
-
this.option("resolveWith", m2);
|
|
1568
|
-
return this;
|
|
1569
|
-
}
|
|
1570
|
-
};
|
|
1571
|
-
|
|
1572
|
-
// src/router/utils/compose-route.ts
|
|
1573
|
-
function composeRoute(routes) {
|
|
1574
|
-
if (!routes.length) {
|
|
1575
|
-
throw new Exception("At least one route");
|
|
1576
|
-
}
|
|
1577
|
-
return async (ctx) => {
|
|
1578
|
-
const results = await Promise.all(routes.map((route) => route(ctx)));
|
|
1579
|
-
return results.every((result) => result === true);
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
// src/router/keq-host-route.ts
|
|
1584
|
-
function keqHostRoute(host) {
|
|
1585
|
-
return (ctx) => ctx.request.url.host === host;
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
// src/router/keq-location-route.ts
|
|
1589
|
-
function keqLocationRoute() {
|
|
1590
|
-
return (ctx) => Validator.isBrowser() && ctx.request.url.host === window.location.host;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
// src/router/keq-method-route.ts
|
|
1594
|
-
function keqMethodRoute(method) {
|
|
1595
|
-
return (ctx) => ctx.request.method.toLowerCase() === method.toLowerCase();
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
// src/router/keq-module-route.ts
|
|
1599
|
-
function keqModuleRoute(moduleName) {
|
|
1600
|
-
if (!moduleName) {
|
|
1601
|
-
throw new Exception("Module name should not be empty");
|
|
1602
|
-
}
|
|
1603
|
-
return (ctx) => {
|
|
1604
|
-
var _a6;
|
|
1605
|
-
return ((_a6 = ctx.options.module) == null ? void 0 : _a6.name) === moduleName;
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
// src/router/keq-pathname-route.ts
|
|
1610
|
-
import * as m from "minimatch";
|
|
1611
|
-
function keqPathnameRoute(pathname) {
|
|
1612
|
-
return (ctx) => {
|
|
1613
|
-
return m.minimatch(ctx.request.url.pathname, pathname);
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
// src/router/keq-router.ts
|
|
1618
|
-
var KeqRouter = class _KeqRouter {
|
|
1619
|
-
constructor(middlewares = []) {
|
|
1620
|
-
this.middlewares = middlewares;
|
|
1621
|
-
}
|
|
1622
|
-
static buildMiddleware(route, middlewares) {
|
|
1623
|
-
if (middlewares.length === 0) {
|
|
1624
|
-
throw new TypeException("At least one middleware is required to build a route middleware");
|
|
1625
|
-
}
|
|
1626
|
-
const composedMiddleware = middlewares.length > 1 ? composeMiddleware(middlewares) : middlewares[0];
|
|
1627
|
-
const middleware = async function router(ctx, next) {
|
|
1628
|
-
if (route(ctx)) await composedMiddleware(ctx, next);
|
|
1629
|
-
else await next();
|
|
1630
|
-
};
|
|
1631
|
-
return middleware;
|
|
1632
|
-
}
|
|
1633
|
-
route(route, middleware, ...additionalMiddlewares) {
|
|
1634
|
-
const mid = _KeqRouter.route(route, middleware, ...additionalMiddlewares);
|
|
1635
|
-
this.middlewares.push(mid);
|
|
1636
|
-
return this;
|
|
1637
|
-
}
|
|
1638
|
-
host(host, middleware, ...additionalMiddlewares) {
|
|
1639
|
-
const mid = _KeqRouter.host(host, middleware, ...additionalMiddlewares);
|
|
1640
|
-
this.middlewares.push(mid);
|
|
1641
|
-
return this;
|
|
1642
|
-
}
|
|
1643
|
-
method(method, middleware, ...additionalMiddlewares) {
|
|
1644
|
-
const mid = _KeqRouter.method(method, middleware, ...additionalMiddlewares);
|
|
1645
|
-
this.middlewares.push(mid);
|
|
1646
|
-
return this;
|
|
1647
|
-
}
|
|
1648
|
-
pathname(pathname, middleware, ...additionalMiddlewares) {
|
|
1649
|
-
const mid = _KeqRouter.pathname(pathname, middleware, ...additionalMiddlewares);
|
|
1650
|
-
this.middlewares.push(mid);
|
|
1651
|
-
return this;
|
|
1652
|
-
}
|
|
1653
|
-
location(middleware, ...additionalMiddlewares) {
|
|
1654
|
-
const mid = _KeqRouter.location(middleware, ...additionalMiddlewares);
|
|
1655
|
-
this.middlewares.push(mid);
|
|
1656
|
-
return this;
|
|
1657
|
-
}
|
|
1658
|
-
module(moduleName, middleware, ...additionalMiddlewares) {
|
|
1659
|
-
const mid = _KeqRouter.module(moduleName, middleware, ...additionalMiddlewares);
|
|
1660
|
-
this.middlewares.push(mid);
|
|
1661
|
-
return this;
|
|
1662
|
-
}
|
|
1663
|
-
static route(route, middleware, ...additionalMiddlewares) {
|
|
1664
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1665
|
-
const mid = _KeqRouter.buildMiddleware(route, list);
|
|
1666
|
-
mid.__keqMiddlewareName__ = "route(".concat(route.__keqRouteName__ || route.name, ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1667
|
-
return mid;
|
|
1668
|
-
}
|
|
1669
|
-
static host(host, middleware, ...additionalMiddlewares) {
|
|
1670
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1671
|
-
const mid = _KeqRouter.buildMiddleware(keqHostRoute(host), list);
|
|
1672
|
-
mid.__keqMiddlewareName__ = "host(".concat(JSON.stringify(host), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1673
|
-
return mid;
|
|
1674
|
-
}
|
|
1675
|
-
static method(method, middleware, ...additionalMiddlewares) {
|
|
1676
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1677
|
-
const mid = _KeqRouter.buildMiddleware(keqMethodRoute(method), list);
|
|
1678
|
-
mid.__keqMiddlewareName__ = "method(".concat(JSON.stringify(method), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1679
|
-
return mid;
|
|
1680
|
-
}
|
|
1681
|
-
static pathname(pathname, middleware, ...additionalMiddlewares) {
|
|
1682
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1683
|
-
const mid = _KeqRouter.buildMiddleware(keqPathnameRoute(pathname), list);
|
|
1684
|
-
mid.__keqMiddlewareName__ = "pathname(".concat(JSON.stringify(pathname), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1685
|
-
return mid;
|
|
1686
|
-
}
|
|
1687
|
-
static location(middleware, ...additionalMiddlewares) {
|
|
1688
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1689
|
-
const mid = _KeqRouter.buildMiddleware(keqLocationRoute(), list);
|
|
1690
|
-
mid.__keqMiddlewareName__ = "location(".concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1691
|
-
return mid;
|
|
1692
|
-
}
|
|
1693
|
-
static module(moduleName, middleware, ...additionalMiddlewares) {
|
|
1694
|
-
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1695
|
-
const mid = _KeqRouter.buildMiddleware(keqModuleRoute(moduleName), list);
|
|
1696
|
-
mid.__keqMiddlewareName__ = "module(".concat(JSON.stringify(moduleName), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1697
|
-
return mid;
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1700
|
-
|
|
1701
|
-
// src/middlewares/timeout-middleware/index.ts
|
|
1702
|
-
function keqTimeoutMiddleware() {
|
|
1703
|
-
return async function timeoutMiddleware(ctx, next) {
|
|
1704
|
-
if (!ctx.options.timeout || ctx.options.timeout.millisecond <= 0) {
|
|
1705
|
-
await next();
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
const millisecond = ctx.options.timeout.millisecond;
|
|
1709
|
-
ctx.emitter.on("fetch:after", ({ context }) => {
|
|
1710
|
-
setTimeout(
|
|
1711
|
-
() => {
|
|
1712
|
-
const err = new TimeoutException("keq request timeout(".concat(millisecond, "ms)"));
|
|
1713
|
-
context.request.abort(err);
|
|
1714
|
-
context.emitter.emit("timeout", { context });
|
|
1715
|
-
},
|
|
1716
|
-
millisecond
|
|
1717
|
-
);
|
|
1718
|
-
});
|
|
1719
|
-
await next();
|
|
1720
|
-
};
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
// src/middlewares/flow-control-middleware/serial-flow-control-middleware.ts
|
|
1724
|
-
import * as fastq from "fastq";
|
|
1725
|
-
function keqSerialFlowControlMiddleware() {
|
|
1726
|
-
return async function serialFlowControlMiddleware(ctx, next) {
|
|
1727
|
-
if (!ctx.options.flowControl || !["serial", "concurrent"].includes(ctx.options.flowControl.mode)) {
|
|
1728
|
-
await next();
|
|
1729
|
-
return;
|
|
1730
|
-
}
|
|
1731
|
-
const { signal } = ctx.options.flowControl;
|
|
1732
|
-
const concurrent = ctx.options.flowControl.mode === "serial" ? 1 : !ctx.options.flowControl.concurrencyLimit ? 1 : ctx.options.flowControl.concurrencyLimit < 1 ? 1 : parseInt(ctx.options.flowControl.concurrencyLimit, 10);
|
|
1733
|
-
const key = typeof signal === "string" ? signal : signal(ctx);
|
|
1734
|
-
if (!ctx.global.core) ctx.global.core = {};
|
|
1735
|
-
if (!ctx.global.core.serialFlowControl) ctx.global.core.serialFlowControl = {};
|
|
1736
|
-
if (!ctx.global.core.serialFlowControl[key]) {
|
|
1737
|
-
ctx.global.core.serialFlowControl[key] = fastq.promise(async ({ next: next2 }) => {
|
|
1738
|
-
await next2();
|
|
1739
|
-
}, concurrent);
|
|
1740
|
-
}
|
|
1741
|
-
const queue = ctx.global.core.serialFlowControl[key];
|
|
1742
|
-
await queue.push({ next });
|
|
1743
|
-
};
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
// src/middlewares/flow-control-middleware/abort-flow-control-middleware.ts
|
|
1747
|
-
function keqAbortFlowControlMiddleware() {
|
|
1748
|
-
return async function abortFlowControlMiddleware(ctx, next) {
|
|
1749
|
-
if (!ctx.options.flowControl || ctx.options.flowControl.mode !== "abort") {
|
|
1750
|
-
await next();
|
|
1751
|
-
return;
|
|
1752
|
-
}
|
|
1753
|
-
const { signal } = ctx.options.flowControl;
|
|
1754
|
-
const key = typeof signal === "string" ? signal : signal(ctx);
|
|
1755
|
-
if (!ctx.global.core) ctx.global.core = {};
|
|
1756
|
-
if (!ctx.global.core.abortFlowControl) ctx.global.core.abortFlowControl = {};
|
|
1757
|
-
const abort = ctx.global.core.abortFlowControl[key];
|
|
1758
|
-
if (abort) {
|
|
1759
|
-
const reason = new AbortException('Previous request was aborted by AbortFlowControl with key "'.concat(key, '"'));
|
|
1760
|
-
abort(reason);
|
|
1761
|
-
}
|
|
1762
|
-
const fn = ctx.request.abort.bind(ctx.request);
|
|
1763
|
-
ctx.global.core.abortFlowControl[key] = fn;
|
|
1764
|
-
try {
|
|
1765
|
-
await next();
|
|
1766
|
-
} finally {
|
|
1767
|
-
if (ctx.global.core.abortFlowControl[key] === fn) {
|
|
1768
|
-
ctx.global.core.abortFlowControl[key] = void 0;
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
};
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
// src/middlewares/flow-control-middleware/index.ts
|
|
1775
|
-
function keqFlowControlMiddleware() {
|
|
1776
|
-
return composeMiddleware(
|
|
1777
|
-
[keqSerialFlowControlMiddleware(), keqAbortFlowControlMiddleware()],
|
|
1778
|
-
{ name: "flowControlMiddleware" }
|
|
1779
|
-
);
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
// src/middlewares/fetch-middleware/index.ts
|
|
1783
|
-
function keqFetchMiddleware() {
|
|
1784
|
-
return async function fetchMiddleware(context) {
|
|
1785
|
-
const fetch = context.options.fetchAPI || globalThis.fetch;
|
|
1786
|
-
context.emitter.emit("fetch:before", { context });
|
|
1787
|
-
const response = await fetch(...context.request.toFetchArguments());
|
|
1788
|
-
context.emitter.emit("fetch:after", { context });
|
|
1789
|
-
context.res = response;
|
|
1790
|
-
};
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
// src/request/request.ts
|
|
1794
|
-
var KeqRequest = class {
|
|
1795
|
-
constructor(options) {
|
|
1796
|
-
__publicField(this, "baseOrigin");
|
|
1797
|
-
__publicField(this, "qs");
|
|
1798
|
-
/**
|
|
1799
|
-
* share data between requests, used to implement flowControl
|
|
1800
|
-
* @description 跨请求共享数据,用于实现 flowControl的功能
|
|
1801
|
-
*/
|
|
1802
|
-
__publicField(this, "global", {});
|
|
1803
|
-
__publicField(this, "preMiddlewares", []);
|
|
1804
|
-
__publicField(this, "postMiddlewares", []);
|
|
1805
|
-
if (options == null ? void 0 : options.baseOrigin) {
|
|
1806
|
-
this.baseOrigin = options.baseOrigin;
|
|
1807
|
-
} else {
|
|
1808
|
-
this.baseOrigin = Validator.isBrowser() ? location.origin : "http://127.0.0.1";
|
|
1809
|
-
}
|
|
1810
|
-
this.qs = options == null ? void 0 : options.qs;
|
|
1811
|
-
this.postMiddlewares = (options == null ? void 0 : options.postMiddlewares) || [
|
|
1812
|
-
keqFlowControlMiddleware(),
|
|
1813
|
-
keqTimeoutMiddleware(),
|
|
1814
|
-
keqFetchMiddleware()
|
|
1815
|
-
];
|
|
1816
|
-
this.preMiddlewares = (options == null ? void 0 : options.preMiddlewares) || [];
|
|
1817
|
-
}
|
|
1818
|
-
__formatUrl__(url) {
|
|
1819
|
-
if (typeof url === "string") {
|
|
1820
|
-
return new URL(url, this.baseOrigin);
|
|
1821
|
-
}
|
|
1822
|
-
return new URL(url.href);
|
|
1823
|
-
}
|
|
1824
|
-
__fetch__(url, init, locationId) {
|
|
1825
|
-
const keq = new Keq(
|
|
1826
|
-
this.__formatUrl__(url),
|
|
1827
|
-
{
|
|
1828
|
-
...init,
|
|
1829
|
-
locationId,
|
|
1830
|
-
global: this.global,
|
|
1831
|
-
qs: this.qs,
|
|
1832
|
-
middlewares: [
|
|
1833
|
-
...this.preMiddlewares,
|
|
1834
|
-
...this.postMiddlewares
|
|
1835
|
-
]
|
|
1836
|
-
}
|
|
1837
|
-
);
|
|
1838
|
-
return keq;
|
|
1839
|
-
}
|
|
1840
|
-
fetch(url, init) {
|
|
1841
|
-
return this.__fetch__(
|
|
1842
|
-
url,
|
|
1843
|
-
init,
|
|
1844
|
-
getLocationId(1)
|
|
1845
|
-
);
|
|
1846
|
-
}
|
|
1847
|
-
get(url) {
|
|
1848
|
-
return this.__fetch__(
|
|
1849
|
-
url,
|
|
1850
|
-
{ method: "get" },
|
|
1851
|
-
getLocationId(1)
|
|
1852
|
-
);
|
|
1853
|
-
}
|
|
1854
|
-
put(url) {
|
|
1855
|
-
return this.__fetch__(
|
|
1856
|
-
url,
|
|
1857
|
-
{ method: "put" },
|
|
1858
|
-
getLocationId(1)
|
|
1859
|
-
);
|
|
1860
|
-
}
|
|
1861
|
-
delete(url) {
|
|
1862
|
-
return this.__fetch__(
|
|
1863
|
-
url,
|
|
1864
|
-
{ method: "delete" },
|
|
1865
|
-
getLocationId(1)
|
|
1866
|
-
);
|
|
1867
|
-
}
|
|
1868
|
-
del(url) {
|
|
1869
|
-
return this.delete(url);
|
|
1870
|
-
}
|
|
1871
|
-
post(url) {
|
|
1872
|
-
return this.__fetch__(
|
|
1873
|
-
url,
|
|
1874
|
-
{ method: "post" },
|
|
1875
|
-
getLocationId(1)
|
|
1876
|
-
);
|
|
1877
|
-
}
|
|
1878
|
-
head(url) {
|
|
1879
|
-
return this.__fetch__(
|
|
1880
|
-
url,
|
|
1881
|
-
{ method: "head" },
|
|
1882
|
-
getLocationId(1)
|
|
1883
|
-
);
|
|
1884
|
-
}
|
|
1885
|
-
patch(url) {
|
|
1886
|
-
return this.__fetch__(
|
|
1887
|
-
url,
|
|
1888
|
-
{ method: "patch" },
|
|
1889
|
-
getLocationId(1)
|
|
1890
|
-
);
|
|
1891
|
-
}
|
|
1892
|
-
options(url) {
|
|
1893
|
-
return this.__fetch__(
|
|
1894
|
-
url,
|
|
1895
|
-
{ method: "options" },
|
|
1896
|
-
getLocationId(1)
|
|
1897
|
-
);
|
|
1898
|
-
}
|
|
1899
|
-
use(firstMiddleware, ...middleware) {
|
|
1900
|
-
this.preMiddlewares.push(firstMiddleware, ...middleware);
|
|
1901
|
-
return this;
|
|
1902
|
-
}
|
|
1903
|
-
useRouter() {
|
|
1904
|
-
return new KeqRouter(this.preMiddlewares);
|
|
1905
|
-
}
|
|
1906
|
-
on(event, listener) {
|
|
1907
|
-
const middleware = async (context, next) => {
|
|
1908
|
-
context.emitter.on(event, listener);
|
|
1909
|
-
await next();
|
|
1910
|
-
};
|
|
1911
|
-
middleware.__keqMiddlewareName__ = "listen(".concat(event, ", ").concat(listener.name || "anonymous", ")");
|
|
1912
|
-
this.use(middleware);
|
|
1913
|
-
return this;
|
|
1914
|
-
}
|
|
1915
|
-
};
|
|
1916
|
-
var request = new KeqRequest();
|
|
1917
|
-
|
|
1918
|
-
// src/request/create-request.ts
|
|
1919
|
-
function createRequest(options) {
|
|
1920
|
-
return new KeqRequest(options);
|
|
1921
|
-
}
|
|
1922
|
-
export {
|
|
1923
|
-
AbortException,
|
|
1924
|
-
BadGatewayException,
|
|
1925
|
-
BadRequestException,
|
|
1926
|
-
ConflictException,
|
|
1927
|
-
ContentTooLargeException,
|
|
1928
|
-
Exception,
|
|
1929
|
-
ForbiddenException,
|
|
1930
|
-
GatewayTimeoutException,
|
|
1931
|
-
ImATeapotException,
|
|
1932
|
-
InternalServerErrorException,
|
|
1933
|
-
Keq,
|
|
1934
|
-
KeqExecutionContext,
|
|
1935
|
-
KeqMiddlewareExecutor,
|
|
1936
|
-
KeqMiddlewareOrchestrator,
|
|
1937
|
-
KeqRequest,
|
|
1938
|
-
KeqSharedContext,
|
|
1939
|
-
MethodNotAllowedException,
|
|
1940
|
-
NotAcceptableException,
|
|
1941
|
-
NotFoundedException,
|
|
1942
|
-
NotImplementedException,
|
|
1943
|
-
PreconditionFailedException,
|
|
1944
|
-
ProxyAuthenticationRequiredException,
|
|
1945
|
-
RequestException,
|
|
1946
|
-
RequestTimeoutException,
|
|
1947
|
-
ServiceUnavailableException,
|
|
1948
|
-
TimeoutException,
|
|
1949
|
-
TooManyRequestsException,
|
|
1950
|
-
TypeException,
|
|
1951
|
-
UnauthorizedException,
|
|
1952
|
-
UnsupportedMediaTypeException,
|
|
1953
|
-
UriTooLongException,
|
|
1954
|
-
composeMiddleware,
|
|
1955
|
-
composeRoute,
|
|
1956
|
-
createProxyResponse,
|
|
1957
|
-
createRequest,
|
|
1958
|
-
request
|
|
1959
|
-
};
|
|
1960
|
-
//# sourceMappingURL=index.mjs.map
|