@mx-space/api-client 1.1.0 → 1.2.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/.eslintcache +1 -1
- package/{types/interfaces/adapter.d.ts → dist/adapter-be44aa1e.d.ts} +12 -3
- package/dist/adaptors/axios.cjs +62 -41
- package/dist/adaptors/axios.d.ts +3 -28
- package/dist/adaptors/axios.global.js +13400 -0
- package/dist/adaptors/axios.js +32 -37
- package/dist/adaptors/fetch.cjs +105 -92
- package/dist/adaptors/fetch.d.ts +3 -23
- package/dist/adaptors/fetch.global.js +87 -0
- package/dist/adaptors/fetch.js +81 -91
- package/dist/adaptors/ky.cjs +91 -66
- package/dist/adaptors/ky.d.ts +18 -33
- package/dist/adaptors/ky.global.js +552 -0
- package/dist/adaptors/ky.js +60 -61
- package/dist/adaptors/umi-request.cjs +55 -34
- package/dist/adaptors/umi-request.d.ts +3 -28
- package/dist/adaptors/umi-request.global.js +7005 -0
- package/dist/adaptors/umi-request.js +31 -30
- package/dist/index.cjs +947 -955
- package/dist/index.d.ts +1555 -0
- package/dist/index.global.js +907 -0
- package/dist/index.js +889 -931
- package/dtos/index.ts +1 -0
- package/index.ts +3 -1
- package/mod-dts.mjs +18 -0
- package/models/index.ts +1 -0
- package/package.json +6 -47
- package/tsconfig.json +16 -4
- package/tsup.config.ts +18 -0
- package/dist/adaptors/axios.cjs.map +0 -1
- package/dist/adaptors/axios.js.map +0 -1
- package/dist/adaptors/axios.min.cjs +0 -2
- package/dist/adaptors/axios.min.cjs.map +0 -1
- package/dist/adaptors/axios.min.js +0 -2
- package/dist/adaptors/axios.min.js.map +0 -1
- package/dist/adaptors/axios.umd.js +0 -47
- package/dist/adaptors/axios.umd.js.map +0 -1
- package/dist/adaptors/axios.umd.min.js +0 -2
- package/dist/adaptors/axios.umd.min.js.map +0 -1
- package/dist/adaptors/fetch.cjs.map +0 -1
- package/dist/adaptors/fetch.js.map +0 -1
- package/dist/adaptors/fetch.min.cjs +0 -2
- package/dist/adaptors/fetch.min.cjs.map +0 -1
- package/dist/adaptors/fetch.min.js +0 -2
- package/dist/adaptors/fetch.min.js.map +0 -1
- package/dist/adaptors/fetch.umd.js +0 -105
- package/dist/adaptors/fetch.umd.js.map +0 -1
- package/dist/adaptors/fetch.umd.min.js +0 -2
- package/dist/adaptors/fetch.umd.min.js.map +0 -1
- package/dist/adaptors/ky.cjs.map +0 -1
- package/dist/adaptors/ky.js.map +0 -1
- package/dist/adaptors/ky.min.cjs +0 -2
- package/dist/adaptors/ky.min.cjs.map +0 -1
- package/dist/adaptors/ky.min.js +0 -2
- package/dist/adaptors/ky.min.js.map +0 -1
- package/dist/adaptors/ky.umd.js +0 -73
- package/dist/adaptors/ky.umd.js.map +0 -1
- package/dist/adaptors/ky.umd.min.js +0 -2
- package/dist/adaptors/ky.umd.min.js.map +0 -1
- package/dist/adaptors/umi-request.cjs.map +0 -1
- package/dist/adaptors/umi-request.js.map +0 -1
- package/dist/adaptors/umi-request.min.cjs +0 -2
- package/dist/adaptors/umi-request.min.cjs.map +0 -1
- package/dist/adaptors/umi-request.min.js +0 -2
- package/dist/adaptors/umi-request.min.js.map +0 -1
- package/dist/adaptors/umi-request.umd.js +0 -41
- package/dist/adaptors/umi-request.umd.js.map +0 -1
- package/dist/adaptors/umi-request.umd.min.js +0 -2
- package/dist/adaptors/umi-request.umd.min.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.min.cjs +0 -2
- package/dist/index.min.cjs.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/dist/index.umd.js +0 -1011
- package/dist/index.umd.js.map +0 -1
- package/dist/index.umd.min.js +0 -2
- package/dist/index.umd.min.js.map +0 -1
- package/esm/adaptors/axios.d.ts +0 -4
- package/esm/adaptors/axios.js +0 -37
- package/esm/adaptors/axios.js.map +0 -1
- package/esm/adaptors/fetch.d.ts +0 -2
- package/esm/adaptors/fetch.js +0 -95
- package/esm/adaptors/fetch.js.map +0 -1
- package/esm/adaptors/ky.d.ts +0 -23
- package/esm/adaptors/ky.js +0 -62
- package/esm/adaptors/ky.js.map +0 -1
- package/esm/adaptors/umi-request.d.ts +0 -4
- package/esm/adaptors/umi-request.js +0 -31
- package/esm/adaptors/umi-request.js.map +0 -1
- package/esm/controllers/aggregate.d.ts +0 -64
- package/esm/controllers/aggregate.js +0 -42
- package/esm/controllers/aggregate.js.map +0 -1
- package/esm/controllers/base.d.ts +0 -43
- package/esm/controllers/base.js +0 -27
- package/esm/controllers/base.js.map +0 -1
- package/esm/controllers/category.d.ts +0 -114
- package/esm/controllers/category.js +0 -68
- package/esm/controllers/category.js.map +0 -1
- package/esm/controllers/comment.d.ts +0 -81
- package/esm/controllers/comment.js +0 -47
- package/esm/controllers/comment.js.map +0 -1
- package/esm/controllers/index.d.ts +0 -18
- package/esm/controllers/index.js +0 -57
- package/esm/controllers/index.js.map +0 -1
- package/esm/controllers/link.d.ts +0 -20
- package/esm/controllers/link.js +0 -21
- package/esm/controllers/link.js.map +0 -1
- package/esm/controllers/note.d.ts +0 -123
- package/esm/controllers/note.js +0 -68
- package/esm/controllers/note.js.map +0 -1
- package/esm/controllers/page.d.ts +0 -59
- package/esm/controllers/page.js +0 -42
- package/esm/controllers/page.js.map +0 -1
- package/esm/controllers/post.d.ts +0 -72
- package/esm/controllers/post.js +0 -52
- package/esm/controllers/post.js.map +0 -1
- package/esm/controllers/project.d.ts +0 -15
- package/esm/controllers/project.js +0 -12
- package/esm/controllers/project.js.map +0 -1
- package/esm/controllers/recently.d.ts +0 -110
- package/esm/controllers/recently.js +0 -49
- package/esm/controllers/recently.js.map +0 -1
- package/esm/controllers/say.d.ts +0 -37
- package/esm/controllers/say.js +0 -21
- package/esm/controllers/say.js.map +0 -1
- package/esm/controllers/search.d.ts +0 -247
- package/esm/controllers/search.js +0 -28
- package/esm/controllers/search.js.map +0 -1
- package/esm/controllers/severless.d.ts +0 -24
- package/esm/controllers/severless.js +0 -16
- package/esm/controllers/severless.js.map +0 -1
- package/esm/controllers/snippet.d.ts +0 -24
- package/esm/controllers/snippet.js +0 -19
- package/esm/controllers/snippet.js.map +0 -1
- package/esm/controllers/topic.d.ts +0 -26
- package/esm/controllers/topic.js +0 -18
- package/esm/controllers/topic.js.map +0 -1
- package/esm/controllers/user.d.ts +0 -70
- package/esm/controllers/user.js +0 -40
- package/esm/controllers/user.js.map +0 -1
- package/esm/core/attach-request.d.ts +0 -2
- package/esm/core/attach-request.js +0 -36
- package/esm/core/attach-request.js.map +0 -1
- package/esm/core/client.d.ts +0 -29
- package/esm/core/client.js +0 -186
- package/esm/core/client.js.map +0 -1
- package/esm/core/error.d.ts +0 -6
- package/esm/core/error.js +0 -9
- package/esm/core/error.js.map +0 -1
- package/esm/core/index.d.ts +0 -2
- package/esm/core/index.js +0 -3
- package/esm/core/index.js.map +0 -1
- package/esm/dtos/comment.d.ts +0 -6
- package/esm/dtos/comment.js +0 -3
- package/esm/dtos/comment.js.map +0 -1
- package/esm/index.d.ts +0 -7
- package/esm/index.js +0 -8
- package/esm/index.js.map +0 -1
- package/esm/interfaces/adapter.d.ts +0 -14
- package/esm/interfaces/adapter.js +0 -2
- package/esm/interfaces/adapter.js.map +0 -1
- package/esm/interfaces/client.d.ts +0 -13
- package/esm/interfaces/client.js +0 -2
- package/esm/interfaces/client.js.map +0 -1
- package/esm/interfaces/controller.d.ts +0 -4
- package/esm/interfaces/controller.js +0 -2
- package/esm/interfaces/controller.js.map +0 -1
- package/esm/interfaces/instance.d.ts +0 -7
- package/esm/interfaces/instance.js +0 -2
- package/esm/interfaces/instance.js.map +0 -1
- package/esm/interfaces/options.d.ts +0 -1
- package/esm/interfaces/options.js +0 -2
- package/esm/interfaces/options.js.map +0 -1
- package/esm/interfaces/params.d.ts +0 -4
- package/esm/interfaces/params.js +0 -2
- package/esm/interfaces/params.js.map +0 -1
- package/esm/interfaces/request.d.ts +0 -43
- package/esm/interfaces/request.js +0 -2
- package/esm/interfaces/request.js.map +0 -1
- package/esm/interfaces/types.d.ts +0 -2
- package/esm/interfaces/types.js +0 -2
- package/esm/interfaces/types.js.map +0 -1
- package/esm/models/aggregate.d.ts +0 -53
- package/esm/models/aggregate.js +0 -6
- package/esm/models/aggregate.js.map +0 -1
- package/esm/models/base.d.ts +0 -41
- package/esm/models/base.js +0 -2
- package/esm/models/base.js.map +0 -1
- package/esm/models/category.d.ts +0 -22
- package/esm/models/category.js +0 -6
- package/esm/models/category.js.map +0 -1
- package/esm/models/comment.d.ts +0 -37
- package/esm/models/comment.js +0 -13
- package/esm/models/comment.js.map +0 -1
- package/esm/models/index.d.ts +0 -14
- package/esm/models/index.js +0 -15
- package/esm/models/index.js.map +0 -1
- package/esm/models/link.d.ts +0 -22
- package/esm/models/link.js +0 -14
- package/esm/models/link.js.map +0 -1
- package/esm/models/note.d.ts +0 -38
- package/esm/models/note.js +0 -2
- package/esm/models/note.js.map +0 -1
- package/esm/models/page.d.ts +0 -14
- package/esm/models/page.js +0 -7
- package/esm/models/page.js.map +0 -1
- package/esm/models/post.d.ts +0 -17
- package/esm/models/post.js +0 -2
- package/esm/models/post.js.map +0 -1
- package/esm/models/project.d.ts +0 -11
- package/esm/models/project.js +0 -2
- package/esm/models/project.js.map +0 -1
- package/esm/models/recently.d.ts +0 -20
- package/esm/models/recently.js +0 -7
- package/esm/models/recently.js.map +0 -1
- package/esm/models/say.d.ts +0 -6
- package/esm/models/say.js +0 -2
- package/esm/models/say.js.map +0 -1
- package/esm/models/setting.d.ts +0 -66
- package/esm/models/setting.js +0 -2
- package/esm/models/setting.js.map +0 -1
- package/esm/models/snippet.d.ts +0 -18
- package/esm/models/snippet.js +0 -8
- package/esm/models/snippet.js.map +0 -1
- package/esm/models/topic.d.ts +0 -8
- package/esm/models/topic.js +0 -2
- package/esm/models/topic.js.map +0 -1
- package/esm/models/user.d.ts +0 -21
- package/esm/models/user.js +0 -2
- package/esm/models/user.js.map +0 -1
- package/esm/utils/auto-bind.d.ts +0 -4
- package/esm/utils/auto-bind.js +0 -36
- package/esm/utils/auto-bind.js.map +0 -1
- package/esm/utils/camelcase-keys.d.ts +0 -6
- package/esm/utils/camelcase-keys.js +0 -23
- package/esm/utils/camelcase-keys.js.map +0 -1
- package/esm/utils/index.d.ts +0 -5
- package/esm/utils/index.js +0 -43
- package/esm/utils/index.js.map +0 -1
- package/esm/utils/path.d.ts +0 -1
- package/esm/utils/path.js +0 -7
- package/esm/utils/path.js.map +0 -1
- package/esm/vitest.config.d.ts +0 -2
- package/esm/vitest.config.js +0 -15
- package/esm/vitest.config.js.map +0 -1
- package/lib/adaptors/axios.d.ts +0 -4
- package/lib/adaptors/axios.js +0 -43
- package/lib/adaptors/axios.js.map +0 -1
- package/lib/adaptors/fetch.d.ts +0 -2
- package/lib/adaptors/fetch.js +0 -98
- package/lib/adaptors/fetch.js.map +0 -1
- package/lib/adaptors/ky.d.ts +0 -23
- package/lib/adaptors/ky.js +0 -69
- package/lib/adaptors/ky.js.map +0 -1
- package/lib/adaptors/umi-request.d.ts +0 -4
- package/lib/adaptors/umi-request.js +0 -34
- package/lib/adaptors/umi-request.js.map +0 -1
- package/lib/controllers/aggregate.d.ts +0 -64
- package/lib/controllers/aggregate.js +0 -46
- package/lib/controllers/aggregate.js.map +0 -1
- package/lib/controllers/base.d.ts +0 -43
- package/lib/controllers/base.js +0 -31
- package/lib/controllers/base.js.map +0 -1
- package/lib/controllers/category.d.ts +0 -114
- package/lib/controllers/category.js +0 -72
- package/lib/controllers/category.js.map +0 -1
- package/lib/controllers/comment.d.ts +0 -81
- package/lib/controllers/comment.js +0 -51
- package/lib/controllers/comment.js.map +0 -1
- package/lib/controllers/index.d.ts +0 -18
- package/lib/controllers/index.js +0 -74
- package/lib/controllers/index.js.map +0 -1
- package/lib/controllers/link.d.ts +0 -20
- package/lib/controllers/link.js +0 -25
- package/lib/controllers/link.js.map +0 -1
- package/lib/controllers/note.d.ts +0 -123
- package/lib/controllers/note.js +0 -72
- package/lib/controllers/note.js.map +0 -1
- package/lib/controllers/page.d.ts +0 -59
- package/lib/controllers/page.js +0 -46
- package/lib/controllers/page.js.map +0 -1
- package/lib/controllers/post.d.ts +0 -72
- package/lib/controllers/post.js +0 -56
- package/lib/controllers/post.js.map +0 -1
- package/lib/controllers/project.d.ts +0 -15
- package/lib/controllers/project.js +0 -16
- package/lib/controllers/project.js.map +0 -1
- package/lib/controllers/recently.d.ts +0 -110
- package/lib/controllers/recently.js +0 -53
- package/lib/controllers/recently.js.map +0 -1
- package/lib/controllers/say.d.ts +0 -37
- package/lib/controllers/say.js +0 -25
- package/lib/controllers/say.js.map +0 -1
- package/lib/controllers/search.d.ts +0 -247
- package/lib/controllers/search.js +0 -32
- package/lib/controllers/search.js.map +0 -1
- package/lib/controllers/severless.d.ts +0 -24
- package/lib/controllers/severless.js +0 -20
- package/lib/controllers/severless.js.map +0 -1
- package/lib/controllers/snippet.d.ts +0 -24
- package/lib/controllers/snippet.js +0 -23
- package/lib/controllers/snippet.js.map +0 -1
- package/lib/controllers/topic.d.ts +0 -26
- package/lib/controllers/topic.js +0 -22
- package/lib/controllers/topic.js.map +0 -1
- package/lib/controllers/user.d.ts +0 -70
- package/lib/controllers/user.js +0 -44
- package/lib/controllers/user.js.map +0 -1
- package/lib/core/attach-request.d.ts +0 -2
- package/lib/core/attach-request.js +0 -40
- package/lib/core/attach-request.js.map +0 -1
- package/lib/core/client.d.ts +0 -29
- package/lib/core/client.js +0 -190
- package/lib/core/client.js.map +0 -1
- package/lib/core/error.d.ts +0 -6
- package/lib/core/error.js +0 -13
- package/lib/core/error.js.map +0 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -19
- package/lib/core/index.js.map +0 -1
- package/lib/dtos/comment.d.ts +0 -6
- package/lib/dtos/comment.js +0 -7
- package/lib/dtos/comment.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -28
- package/lib/index.js.map +0 -1
- package/lib/interfaces/adapter.d.ts +0 -14
- package/lib/interfaces/adapter.js +0 -3
- package/lib/interfaces/adapter.js.map +0 -1
- package/lib/interfaces/client.d.ts +0 -13
- package/lib/interfaces/client.js +0 -3
- package/lib/interfaces/client.js.map +0 -1
- package/lib/interfaces/controller.d.ts +0 -4
- package/lib/interfaces/controller.js +0 -3
- package/lib/interfaces/controller.js.map +0 -1
- package/lib/interfaces/instance.d.ts +0 -7
- package/lib/interfaces/instance.js +0 -3
- package/lib/interfaces/instance.js.map +0 -1
- package/lib/interfaces/options.d.ts +0 -1
- package/lib/interfaces/options.js +0 -3
- package/lib/interfaces/options.js.map +0 -1
- package/lib/interfaces/params.d.ts +0 -4
- package/lib/interfaces/params.js +0 -3
- package/lib/interfaces/params.js.map +0 -1
- package/lib/interfaces/request.d.ts +0 -43
- package/lib/interfaces/request.js +0 -3
- package/lib/interfaces/request.js.map +0 -1
- package/lib/interfaces/types.d.ts +0 -2
- package/lib/interfaces/types.js +0 -3
- package/lib/interfaces/types.js.map +0 -1
- package/lib/models/aggregate.d.ts +0 -53
- package/lib/models/aggregate.js +0 -9
- package/lib/models/aggregate.js.map +0 -1
- package/lib/models/base.d.ts +0 -41
- package/lib/models/base.js +0 -3
- package/lib/models/base.js.map +0 -1
- package/lib/models/category.d.ts +0 -22
- package/lib/models/category.js +0 -9
- package/lib/models/category.js.map +0 -1
- package/lib/models/comment.d.ts +0 -37
- package/lib/models/comment.js +0 -16
- package/lib/models/comment.js.map +0 -1
- package/lib/models/index.d.ts +0 -14
- package/lib/models/index.js +0 -31
- package/lib/models/index.js.map +0 -1
- package/lib/models/link.d.ts +0 -22
- package/lib/models/link.js +0 -17
- package/lib/models/link.js.map +0 -1
- package/lib/models/note.d.ts +0 -38
- package/lib/models/note.js +0 -3
- package/lib/models/note.js.map +0 -1
- package/lib/models/page.d.ts +0 -14
- package/lib/models/page.js +0 -10
- package/lib/models/page.js.map +0 -1
- package/lib/models/post.d.ts +0 -17
- package/lib/models/post.js +0 -3
- package/lib/models/post.js.map +0 -1
- package/lib/models/project.d.ts +0 -11
- package/lib/models/project.js +0 -3
- package/lib/models/project.js.map +0 -1
- package/lib/models/recently.d.ts +0 -20
- package/lib/models/recently.js +0 -10
- package/lib/models/recently.js.map +0 -1
- package/lib/models/say.d.ts +0 -6
- package/lib/models/say.js +0 -3
- package/lib/models/say.js.map +0 -1
- package/lib/models/setting.d.ts +0 -66
- package/lib/models/setting.js +0 -3
- package/lib/models/setting.js.map +0 -1
- package/lib/models/snippet.d.ts +0 -18
- package/lib/models/snippet.js +0 -11
- package/lib/models/snippet.js.map +0 -1
- package/lib/models/topic.d.ts +0 -8
- package/lib/models/topic.js +0 -3
- package/lib/models/topic.js.map +0 -1
- package/lib/models/user.d.ts +0 -21
- package/lib/models/user.js +0 -3
- package/lib/models/user.js.map +0 -1
- package/lib/utils/auto-bind.d.ts +0 -4
- package/lib/utils/auto-bind.js +0 -40
- package/lib/utils/auto-bind.js.map +0 -1
- package/lib/utils/camelcase-keys.d.ts +0 -6
- package/lib/utils/camelcase-keys.js +0 -28
- package/lib/utils/camelcase-keys.js.map +0 -1
- package/lib/utils/index.d.ts +0 -5
- package/lib/utils/index.js +0 -50
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/path.d.ts +0 -1
- package/lib/utils/path.js +0 -11
- package/lib/utils/path.js.map +0 -1
- package/lib/vitest.config.d.ts +0 -2
- package/lib/vitest.config.js +0 -20
- package/lib/vitest.config.js.map +0 -1
- package/tsconfig.build.json +0 -4
- package/tsconfig.cjs.json +0 -7
- package/tsconfig.types.json +0 -15
- package/types/adaptors/axios.d.ts +0 -4
- package/types/adaptors/fetch.d.ts +0 -2
- package/types/adaptors/ky.d.ts +0 -23
- package/types/adaptors/umi-request.d.ts +0 -4
- package/types/controllers/aggregate.d.ts +0 -64
- package/types/controllers/base.d.ts +0 -43
- package/types/controllers/category.d.ts +0 -114
- package/types/controllers/comment.d.ts +0 -81
- package/types/controllers/index.d.ts +0 -18
- package/types/controllers/link.d.ts +0 -20
- package/types/controllers/note.d.ts +0 -123
- package/types/controllers/page.d.ts +0 -59
- package/types/controllers/post.d.ts +0 -72
- package/types/controllers/project.d.ts +0 -15
- package/types/controllers/recently.d.ts +0 -110
- package/types/controllers/say.d.ts +0 -37
- package/types/controllers/search.d.ts +0 -247
- package/types/controllers/severless.d.ts +0 -24
- package/types/controllers/snippet.d.ts +0 -24
- package/types/controllers/topic.d.ts +0 -26
- package/types/controllers/user.d.ts +0 -70
- package/types/core/attach-request.d.ts +0 -2
- package/types/core/client.d.ts +0 -29
- package/types/core/error.d.ts +0 -6
- package/types/core/index.d.ts +0 -2
- package/types/dtos/comment.d.ts +0 -6
- package/types/index.d.ts +0 -7
- package/types/interfaces/client.d.ts +0 -13
- package/types/interfaces/controller.d.ts +0 -4
- package/types/interfaces/instance.d.ts +0 -7
- package/types/interfaces/options.d.ts +0 -1
- package/types/interfaces/params.d.ts +0 -4
- package/types/interfaces/request.d.ts +0 -43
- package/types/interfaces/types.d.ts +0 -2
- package/types/models/aggregate.d.ts +0 -53
- package/types/models/base.d.ts +0 -41
- package/types/models/category.d.ts +0 -22
- package/types/models/comment.d.ts +0 -37
- package/types/models/index.d.ts +0 -14
- package/types/models/link.d.ts +0 -22
- package/types/models/note.d.ts +0 -38
- package/types/models/page.d.ts +0 -14
- package/types/models/post.d.ts +0 -17
- package/types/models/project.d.ts +0 -11
- package/types/models/recently.d.ts +0 -20
- package/types/models/say.d.ts +0 -6
- package/types/models/setting.d.ts +0 -66
- package/types/models/snippet.d.ts +0 -18
- package/types/models/topic.d.ts +0 -8
- package/types/models/user.d.ts +0 -21
- package/types/utils/auto-bind.d.ts +0 -4
- package/types/utils/camelcase-keys.d.ts +0 -6
- package/types/utils/index.d.ts +0 -5
- package/types/utils/path.d.ts +0 -1
- package/types/vitest.config.d.ts +0 -2
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/errors/HTTPError.js
|
|
4
|
+
var HTTPError = class extends Error {
|
|
5
|
+
constructor(response, request, options) {
|
|
6
|
+
const code = response.status || response.status === 0 ? response.status : "";
|
|
7
|
+
const title = response.statusText || "";
|
|
8
|
+
const status = `${code} ${title}`.trim();
|
|
9
|
+
const reason = status ? `status code ${status}` : "an unknown error";
|
|
10
|
+
super(`Request failed with ${reason}`);
|
|
11
|
+
Object.defineProperty(this, "response", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: void 0
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "request", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(this, "options", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
this.name = "HTTPError";
|
|
30
|
+
this.response = response;
|
|
31
|
+
this.request = request;
|
|
32
|
+
this.options = options;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/errors/TimeoutError.js
|
|
37
|
+
var TimeoutError = class extends Error {
|
|
38
|
+
constructor(request) {
|
|
39
|
+
super("Request timed out");
|
|
40
|
+
Object.defineProperty(this, "request", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
});
|
|
46
|
+
this.name = "TimeoutError";
|
|
47
|
+
this.request = request;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/utils/is.js
|
|
52
|
+
var isObject = (value) => value !== null && typeof value === "object";
|
|
53
|
+
|
|
54
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/utils/merge.js
|
|
55
|
+
var validateAndMerge = (...sources) => {
|
|
56
|
+
for (const source of sources) {
|
|
57
|
+
if ((!isObject(source) || Array.isArray(source)) && typeof source !== "undefined") {
|
|
58
|
+
throw new TypeError("The `options` argument must be an object");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return deepMerge({}, ...sources);
|
|
62
|
+
};
|
|
63
|
+
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
64
|
+
const result = new globalThis.Headers(source1);
|
|
65
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
66
|
+
const source = new globalThis.Headers(source2);
|
|
67
|
+
for (const [key, value] of source.entries()) {
|
|
68
|
+
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
69
|
+
result.delete(key);
|
|
70
|
+
} else {
|
|
71
|
+
result.set(key, value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
var deepMerge = (...sources) => {
|
|
77
|
+
let returnValue = {};
|
|
78
|
+
let headers = {};
|
|
79
|
+
for (const source of sources) {
|
|
80
|
+
if (Array.isArray(source)) {
|
|
81
|
+
if (!Array.isArray(returnValue)) {
|
|
82
|
+
returnValue = [];
|
|
83
|
+
}
|
|
84
|
+
returnValue = [...returnValue, ...source];
|
|
85
|
+
} else if (isObject(source)) {
|
|
86
|
+
for (let [key, value] of Object.entries(source)) {
|
|
87
|
+
if (isObject(value) && key in returnValue) {
|
|
88
|
+
value = deepMerge(returnValue[key], value);
|
|
89
|
+
}
|
|
90
|
+
returnValue = { ...returnValue, [key]: value };
|
|
91
|
+
}
|
|
92
|
+
if (isObject(source.headers)) {
|
|
93
|
+
headers = mergeHeaders(headers, source.headers);
|
|
94
|
+
returnValue.headers = headers;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return returnValue;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/core/constants.js
|
|
102
|
+
var supportsRequestStreams = (() => {
|
|
103
|
+
let duplexAccessed = false;
|
|
104
|
+
let hasContentType = false;
|
|
105
|
+
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
106
|
+
if (supportsReadableStream) {
|
|
107
|
+
hasContentType = new globalThis.Request("https://a.com", {
|
|
108
|
+
body: new globalThis.ReadableStream(),
|
|
109
|
+
method: "POST",
|
|
110
|
+
get duplex() {
|
|
111
|
+
duplexAccessed = true;
|
|
112
|
+
return "half";
|
|
113
|
+
}
|
|
114
|
+
}).headers.has("Content-Type");
|
|
115
|
+
}
|
|
116
|
+
return duplexAccessed && !hasContentType;
|
|
117
|
+
})();
|
|
118
|
+
var supportsAbortController = typeof globalThis.AbortController === "function";
|
|
119
|
+
var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
120
|
+
var supportsFormData = typeof globalThis.FormData === "function";
|
|
121
|
+
var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
122
|
+
var validate = () => void 0;
|
|
123
|
+
validate();
|
|
124
|
+
var responseTypes = {
|
|
125
|
+
json: "application/json",
|
|
126
|
+
text: "text/*",
|
|
127
|
+
formData: "multipart/form-data",
|
|
128
|
+
arrayBuffer: "*/*",
|
|
129
|
+
blob: "*/*"
|
|
130
|
+
};
|
|
131
|
+
var maxSafeTimeout = 2147483647;
|
|
132
|
+
var stop = Symbol("stop");
|
|
133
|
+
|
|
134
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/utils/normalize.js
|
|
135
|
+
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
136
|
+
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
137
|
+
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
138
|
+
var retryAfterStatusCodes = [413, 429, 503];
|
|
139
|
+
var defaultRetryOptions = {
|
|
140
|
+
limit: 2,
|
|
141
|
+
methods: retryMethods,
|
|
142
|
+
statusCodes: retryStatusCodes,
|
|
143
|
+
afterStatusCodes: retryAfterStatusCodes,
|
|
144
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
145
|
+
backoffLimit: Number.POSITIVE_INFINITY
|
|
146
|
+
};
|
|
147
|
+
var normalizeRetryOptions = (retry = {}) => {
|
|
148
|
+
if (typeof retry === "number") {
|
|
149
|
+
return {
|
|
150
|
+
...defaultRetryOptions,
|
|
151
|
+
limit: retry
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (retry.methods && !Array.isArray(retry.methods)) {
|
|
155
|
+
throw new Error("retry.methods must be an array");
|
|
156
|
+
}
|
|
157
|
+
if (retry.statusCodes && !Array.isArray(retry.statusCodes)) {
|
|
158
|
+
throw new Error("retry.statusCodes must be an array");
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...defaultRetryOptions,
|
|
162
|
+
...retry,
|
|
163
|
+
afterStatusCodes: retryAfterStatusCodes
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/utils/timeout.js
|
|
168
|
+
async function timeout(request, abortController, options) {
|
|
169
|
+
return new Promise((resolve, reject) => {
|
|
170
|
+
const timeoutId = setTimeout(() => {
|
|
171
|
+
if (abortController) {
|
|
172
|
+
abortController.abort();
|
|
173
|
+
}
|
|
174
|
+
reject(new TimeoutError(request));
|
|
175
|
+
}, options.timeout);
|
|
176
|
+
void options.fetch(request).then(resolve).catch(reject).then(() => {
|
|
177
|
+
clearTimeout(timeoutId);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/errors/DOMException.js
|
|
183
|
+
var isDomExceptionSupported = Boolean(globalThis.DOMException);
|
|
184
|
+
function composeAbortError(signal) {
|
|
185
|
+
if (isDomExceptionSupported) {
|
|
186
|
+
return new DOMException(signal?.reason ?? "The operation was aborted.", "AbortError");
|
|
187
|
+
}
|
|
188
|
+
const error = new Error(signal?.reason ?? "The operation was aborted.");
|
|
189
|
+
error.name = "AbortError";
|
|
190
|
+
return error;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/utils/delay.js
|
|
194
|
+
async function delay(ms, { signal }) {
|
|
195
|
+
return new Promise((resolve, reject) => {
|
|
196
|
+
if (signal) {
|
|
197
|
+
if (signal.aborted) {
|
|
198
|
+
reject(composeAbortError(signal));
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
signal.addEventListener("abort", handleAbort, { once: true });
|
|
202
|
+
}
|
|
203
|
+
function handleAbort() {
|
|
204
|
+
reject(composeAbortError(signal));
|
|
205
|
+
clearTimeout(timeoutId);
|
|
206
|
+
}
|
|
207
|
+
const timeoutId = setTimeout(() => {
|
|
208
|
+
signal?.removeEventListener("abort", handleAbort);
|
|
209
|
+
resolve();
|
|
210
|
+
}, ms);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/core/Ky.js
|
|
215
|
+
var Ky = class {
|
|
216
|
+
static create(input, options) {
|
|
217
|
+
const ky2 = new Ky(input, options);
|
|
218
|
+
const fn = async () => {
|
|
219
|
+
if (ky2._options.timeout > maxSafeTimeout) {
|
|
220
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
221
|
+
}
|
|
222
|
+
await Promise.resolve();
|
|
223
|
+
let response = await ky2._fetch();
|
|
224
|
+
for (const hook of ky2._options.hooks.afterResponse) {
|
|
225
|
+
const modifiedResponse = await hook(ky2.request, ky2._options, ky2._decorateResponse(response.clone()));
|
|
226
|
+
if (modifiedResponse instanceof globalThis.Response) {
|
|
227
|
+
response = modifiedResponse;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
ky2._decorateResponse(response);
|
|
231
|
+
if (!response.ok && ky2._options.throwHttpErrors) {
|
|
232
|
+
let error = new HTTPError(response, ky2.request, ky2._options);
|
|
233
|
+
for (const hook of ky2._options.hooks.beforeError) {
|
|
234
|
+
error = await hook(error);
|
|
235
|
+
}
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
if (ky2._options.onDownloadProgress) {
|
|
239
|
+
if (typeof ky2._options.onDownloadProgress !== "function") {
|
|
240
|
+
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
241
|
+
}
|
|
242
|
+
if (!supportsResponseStreams) {
|
|
243
|
+
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
244
|
+
}
|
|
245
|
+
return ky2._stream(response.clone(), ky2._options.onDownloadProgress);
|
|
246
|
+
}
|
|
247
|
+
return response;
|
|
248
|
+
};
|
|
249
|
+
const isRetriableMethod = ky2._options.retry.methods.includes(ky2.request.method.toLowerCase());
|
|
250
|
+
const result = isRetriableMethod ? ky2._retry(fn) : fn();
|
|
251
|
+
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
252
|
+
result[type] = async () => {
|
|
253
|
+
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
254
|
+
const awaitedResult = await result;
|
|
255
|
+
const response = awaitedResult.clone();
|
|
256
|
+
if (type === "json") {
|
|
257
|
+
if (response.status === 204) {
|
|
258
|
+
return "";
|
|
259
|
+
}
|
|
260
|
+
const arrayBuffer = await response.clone().arrayBuffer();
|
|
261
|
+
const responseSize = arrayBuffer.byteLength;
|
|
262
|
+
if (responseSize === 0) {
|
|
263
|
+
return "";
|
|
264
|
+
}
|
|
265
|
+
if (options.parseJson) {
|
|
266
|
+
return options.parseJson(await response.text());
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return response[type]();
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
constructor(input, options = {}) {
|
|
275
|
+
Object.defineProperty(this, "request", {
|
|
276
|
+
enumerable: true,
|
|
277
|
+
configurable: true,
|
|
278
|
+
writable: true,
|
|
279
|
+
value: void 0
|
|
280
|
+
});
|
|
281
|
+
Object.defineProperty(this, "abortController", {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
configurable: true,
|
|
284
|
+
writable: true,
|
|
285
|
+
value: void 0
|
|
286
|
+
});
|
|
287
|
+
Object.defineProperty(this, "_retryCount", {
|
|
288
|
+
enumerable: true,
|
|
289
|
+
configurable: true,
|
|
290
|
+
writable: true,
|
|
291
|
+
value: 0
|
|
292
|
+
});
|
|
293
|
+
Object.defineProperty(this, "_input", {
|
|
294
|
+
enumerable: true,
|
|
295
|
+
configurable: true,
|
|
296
|
+
writable: true,
|
|
297
|
+
value: void 0
|
|
298
|
+
});
|
|
299
|
+
Object.defineProperty(this, "_options", {
|
|
300
|
+
enumerable: true,
|
|
301
|
+
configurable: true,
|
|
302
|
+
writable: true,
|
|
303
|
+
value: void 0
|
|
304
|
+
});
|
|
305
|
+
this._input = input;
|
|
306
|
+
this._options = {
|
|
307
|
+
credentials: this._input.credentials || "same-origin",
|
|
308
|
+
...options,
|
|
309
|
+
headers: mergeHeaders(this._input.headers, options.headers),
|
|
310
|
+
hooks: deepMerge({
|
|
311
|
+
beforeRequest: [],
|
|
312
|
+
beforeRetry: [],
|
|
313
|
+
beforeError: [],
|
|
314
|
+
afterResponse: []
|
|
315
|
+
}, options.hooks),
|
|
316
|
+
method: normalizeRequestMethod(options.method ?? this._input.method),
|
|
317
|
+
prefixUrl: String(options.prefixUrl || ""),
|
|
318
|
+
retry: normalizeRetryOptions(options.retry),
|
|
319
|
+
throwHttpErrors: options.throwHttpErrors !== false,
|
|
320
|
+
timeout: typeof options.timeout === "undefined" ? 1e4 : options.timeout,
|
|
321
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
322
|
+
};
|
|
323
|
+
if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {
|
|
324
|
+
throw new TypeError("`input` must be a string, URL, or Request");
|
|
325
|
+
}
|
|
326
|
+
if (this._options.prefixUrl && typeof this._input === "string") {
|
|
327
|
+
if (this._input.startsWith("/")) {
|
|
328
|
+
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
329
|
+
}
|
|
330
|
+
if (!this._options.prefixUrl.endsWith("/")) {
|
|
331
|
+
this._options.prefixUrl += "/";
|
|
332
|
+
}
|
|
333
|
+
this._input = this._options.prefixUrl + this._input;
|
|
334
|
+
}
|
|
335
|
+
if (supportsAbortController) {
|
|
336
|
+
this.abortController = new globalThis.AbortController();
|
|
337
|
+
if (this._options.signal) {
|
|
338
|
+
const originalSignal = this._options.signal;
|
|
339
|
+
this._options.signal.addEventListener("abort", () => {
|
|
340
|
+
this.abortController.abort(originalSignal.reason);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
this._options.signal = this.abortController.signal;
|
|
344
|
+
}
|
|
345
|
+
if (supportsRequestStreams) {
|
|
346
|
+
this._options.duplex = "half";
|
|
347
|
+
}
|
|
348
|
+
this.request = new globalThis.Request(this._input, this._options);
|
|
349
|
+
if (this._options.searchParams) {
|
|
350
|
+
const textSearchParams = typeof this._options.searchParams === "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString();
|
|
351
|
+
const searchParams = "?" + textSearchParams;
|
|
352
|
+
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
353
|
+
if ((supportsFormData && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"])) {
|
|
354
|
+
this.request.headers.delete("content-type");
|
|
355
|
+
}
|
|
356
|
+
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
357
|
+
}
|
|
358
|
+
if (this._options.json !== void 0) {
|
|
359
|
+
this._options.body = JSON.stringify(this._options.json);
|
|
360
|
+
this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json");
|
|
361
|
+
this.request = new globalThis.Request(this.request, { body: this._options.body });
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
_calculateRetryDelay(error) {
|
|
365
|
+
this._retryCount++;
|
|
366
|
+
if (this._retryCount < this._options.retry.limit && !(error instanceof TimeoutError)) {
|
|
367
|
+
if (error instanceof HTTPError) {
|
|
368
|
+
if (!this._options.retry.statusCodes.includes(error.response.status)) {
|
|
369
|
+
return 0;
|
|
370
|
+
}
|
|
371
|
+
const retryAfter = error.response.headers.get("Retry-After");
|
|
372
|
+
if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
373
|
+
let after = Number(retryAfter);
|
|
374
|
+
if (Number.isNaN(after)) {
|
|
375
|
+
after = Date.parse(retryAfter) - Date.now();
|
|
376
|
+
} else {
|
|
377
|
+
after *= 1e3;
|
|
378
|
+
}
|
|
379
|
+
if (typeof this._options.retry.maxRetryAfter !== "undefined" && after > this._options.retry.maxRetryAfter) {
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
return after;
|
|
383
|
+
}
|
|
384
|
+
if (error.response.status === 413) {
|
|
385
|
+
return 0;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const BACKOFF_FACTOR = 0.3;
|
|
389
|
+
return Math.min(this._options.retry.backoffLimit, BACKOFF_FACTOR * 2 ** (this._retryCount - 1) * 1e3);
|
|
390
|
+
}
|
|
391
|
+
return 0;
|
|
392
|
+
}
|
|
393
|
+
_decorateResponse(response) {
|
|
394
|
+
if (this._options.parseJson) {
|
|
395
|
+
response.json = async () => this._options.parseJson(await response.text());
|
|
396
|
+
}
|
|
397
|
+
return response;
|
|
398
|
+
}
|
|
399
|
+
async _retry(fn) {
|
|
400
|
+
try {
|
|
401
|
+
return await fn();
|
|
402
|
+
} catch (error) {
|
|
403
|
+
const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
|
|
404
|
+
if (ms !== 0 && this._retryCount > 0) {
|
|
405
|
+
await delay(ms, { signal: this._options.signal });
|
|
406
|
+
for (const hook of this._options.hooks.beforeRetry) {
|
|
407
|
+
const hookResult = await hook({
|
|
408
|
+
request: this.request,
|
|
409
|
+
options: this._options,
|
|
410
|
+
error,
|
|
411
|
+
retryCount: this._retryCount
|
|
412
|
+
});
|
|
413
|
+
if (hookResult === stop) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return this._retry(fn);
|
|
418
|
+
}
|
|
419
|
+
throw error;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
async _fetch() {
|
|
423
|
+
for (const hook of this._options.hooks.beforeRequest) {
|
|
424
|
+
const result = await hook(this.request, this._options);
|
|
425
|
+
if (result instanceof Request) {
|
|
426
|
+
this.request = result;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
if (result instanceof Response) {
|
|
430
|
+
return result;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (this._options.timeout === false) {
|
|
434
|
+
return this._options.fetch(this.request.clone());
|
|
435
|
+
}
|
|
436
|
+
return timeout(this.request.clone(), this.abortController, this._options);
|
|
437
|
+
}
|
|
438
|
+
_stream(response, onDownloadProgress) {
|
|
439
|
+
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
440
|
+
let transferredBytes = 0;
|
|
441
|
+
if (response.status === 204) {
|
|
442
|
+
if (onDownloadProgress) {
|
|
443
|
+
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
444
|
+
}
|
|
445
|
+
return new globalThis.Response(null, {
|
|
446
|
+
status: response.status,
|
|
447
|
+
statusText: response.statusText,
|
|
448
|
+
headers: response.headers
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
return new globalThis.Response(new globalThis.ReadableStream({
|
|
452
|
+
async start(controller) {
|
|
453
|
+
const reader = response.body.getReader();
|
|
454
|
+
if (onDownloadProgress) {
|
|
455
|
+
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
456
|
+
}
|
|
457
|
+
async function read() {
|
|
458
|
+
const { done, value } = await reader.read();
|
|
459
|
+
if (done) {
|
|
460
|
+
controller.close();
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (onDownloadProgress) {
|
|
464
|
+
transferredBytes += value.byteLength;
|
|
465
|
+
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
466
|
+
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
467
|
+
}
|
|
468
|
+
controller.enqueue(value);
|
|
469
|
+
await read();
|
|
470
|
+
}
|
|
471
|
+
await read();
|
|
472
|
+
}
|
|
473
|
+
}), {
|
|
474
|
+
status: response.status,
|
|
475
|
+
statusText: response.statusText,
|
|
476
|
+
headers: response.headers
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// ../../node_modules/.pnpm/ky@0.33.2/node_modules/ky/distribution/index.js
|
|
482
|
+
var createInstance = (defaults) => {
|
|
483
|
+
const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
484
|
+
for (const method of requestMethods) {
|
|
485
|
+
ky2[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
486
|
+
}
|
|
487
|
+
ky2.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
488
|
+
ky2.extend = (newDefaults) => createInstance(validateAndMerge(defaults, newDefaults));
|
|
489
|
+
ky2.stop = stop;
|
|
490
|
+
return ky2;
|
|
491
|
+
};
|
|
492
|
+
var ky = createInstance();
|
|
493
|
+
var distribution_default = ky;
|
|
494
|
+
|
|
495
|
+
// adaptors/ky.ts
|
|
496
|
+
var $http = /* @__PURE__ */ distribution_default.create({});
|
|
497
|
+
var getDataFromKyResponse = async (response) => {
|
|
498
|
+
const res = await response;
|
|
499
|
+
const isJsonType = res.headers.get("content-type")?.includes("application/json");
|
|
500
|
+
const json = isJsonType ? await res.clone().json() : null;
|
|
501
|
+
const result = {
|
|
502
|
+
...res,
|
|
503
|
+
data: json ?? await res.clone().text()
|
|
504
|
+
};
|
|
505
|
+
return result;
|
|
506
|
+
};
|
|
507
|
+
var createKyAdaptor = (ky2) => {
|
|
508
|
+
const adaptor = Object.preventExtensions({
|
|
509
|
+
get default() {
|
|
510
|
+
return ky2;
|
|
511
|
+
},
|
|
512
|
+
responseWrapper: {},
|
|
513
|
+
get(url, options) {
|
|
514
|
+
return getDataFromKyResponse(ky2.get(url, options));
|
|
515
|
+
},
|
|
516
|
+
post(url, options) {
|
|
517
|
+
const data = options.data;
|
|
518
|
+
delete options.data;
|
|
519
|
+
const kyOptions = {
|
|
520
|
+
...options,
|
|
521
|
+
json: data
|
|
522
|
+
};
|
|
523
|
+
return getDataFromKyResponse(ky2.post(url, kyOptions));
|
|
524
|
+
},
|
|
525
|
+
put(url, options) {
|
|
526
|
+
const data = options.data;
|
|
527
|
+
delete options.data;
|
|
528
|
+
const kyOptions = {
|
|
529
|
+
...options,
|
|
530
|
+
json: data
|
|
531
|
+
};
|
|
532
|
+
return getDataFromKyResponse(ky2.put(url, kyOptions));
|
|
533
|
+
},
|
|
534
|
+
patch(url, options) {
|
|
535
|
+
const data = options.data;
|
|
536
|
+
delete options.data;
|
|
537
|
+
const kyOptions = {
|
|
538
|
+
...options,
|
|
539
|
+
json: data
|
|
540
|
+
};
|
|
541
|
+
return getDataFromKyResponse(ky2.patch(url, kyOptions));
|
|
542
|
+
},
|
|
543
|
+
delete(url, options) {
|
|
544
|
+
return getDataFromKyResponse(ky2.delete(url, options));
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return adaptor;
|
|
548
|
+
};
|
|
549
|
+
var defaultKyAdaptor = createKyAdaptor($http);
|
|
550
|
+
var ky_default = defaultKyAdaptor;
|
|
551
|
+
})();
|
|
552
|
+
/*! MIT License © Sindre Sorhus */
|
package/dist/adaptors/ky.js
CHANGED
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...res,
|
|
14
|
-
data: json ?? (await res.clone().text()),
|
|
15
|
-
};
|
|
16
|
-
return result;
|
|
1
|
+
// adaptors/ky.ts
|
|
2
|
+
import ky from "ky";
|
|
3
|
+
var $http = /* @__PURE__ */ ky.create({});
|
|
4
|
+
var getDataFromKyResponse = async (response) => {
|
|
5
|
+
const res = await response;
|
|
6
|
+
const isJsonType = res.headers.get("content-type")?.includes("application/json");
|
|
7
|
+
const json = isJsonType ? await res.clone().json() : null;
|
|
8
|
+
const result = {
|
|
9
|
+
...res,
|
|
10
|
+
data: json ?? await res.clone().text()
|
|
11
|
+
};
|
|
12
|
+
return result;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
14
|
+
var createKyAdaptor = (ky2) => {
|
|
15
|
+
const adaptor = Object.preventExtensions({
|
|
16
|
+
get default() {
|
|
17
|
+
return ky2;
|
|
18
|
+
},
|
|
19
|
+
responseWrapper: {},
|
|
20
|
+
get(url, options) {
|
|
21
|
+
return getDataFromKyResponse(ky2.get(url, options));
|
|
22
|
+
},
|
|
23
|
+
post(url, options) {
|
|
24
|
+
const data = options.data;
|
|
25
|
+
delete options.data;
|
|
26
|
+
const kyOptions = {
|
|
27
|
+
...options,
|
|
28
|
+
json: data
|
|
29
|
+
};
|
|
30
|
+
return getDataFromKyResponse(ky2.post(url, kyOptions));
|
|
31
|
+
},
|
|
32
|
+
put(url, options) {
|
|
33
|
+
const data = options.data;
|
|
34
|
+
delete options.data;
|
|
35
|
+
const kyOptions = {
|
|
36
|
+
...options,
|
|
37
|
+
json: data
|
|
38
|
+
};
|
|
39
|
+
return getDataFromKyResponse(ky2.put(url, kyOptions));
|
|
40
|
+
},
|
|
41
|
+
patch(url, options) {
|
|
42
|
+
const data = options.data;
|
|
43
|
+
delete options.data;
|
|
44
|
+
const kyOptions = {
|
|
45
|
+
...options,
|
|
46
|
+
json: data
|
|
47
|
+
};
|
|
48
|
+
return getDataFromKyResponse(ky2.patch(url, kyOptions));
|
|
49
|
+
},
|
|
50
|
+
delete(url, options) {
|
|
51
|
+
return getDataFromKyResponse(ky2.delete(url, options));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return adaptor;
|
|
55
|
+
};
|
|
56
|
+
var defaultKyAdaptor = createKyAdaptor($http);
|
|
57
|
+
var ky_default = defaultKyAdaptor;
|
|
58
|
+
export {
|
|
59
|
+
createKyAdaptor,
|
|
60
|
+
ky_default as default,
|
|
61
|
+
defaultKyAdaptor
|
|
59
62
|
};
|
|
60
|
-
const defaultKyAdaptor = createKyAdaptor($http);
|
|
61
|
-
|
|
62
|
-
export { createKyAdaptor, defaultKyAdaptor as default, defaultKyAdaptor };
|
|
63
|
-
//# sourceMappingURL=ky.js.map
|