@mixedbread/sdk 0.2.2 → 0.4.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 +23 -0
- package/README.md +110 -37
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/{_shims/auto/runtime.js → api-promise.js} +3 -5
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +236 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +236 -0
- package/client.d.ts.map +1 -0
- package/client.js +527 -0
- package/client.js.map +1 -0
- package/client.mjs +500 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +47 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +47 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +84 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +80 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +47 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +47 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +67 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +67 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +120 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +114 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +1 -46
- package/error.d.ts.map +1 -1
- package/error.js +16 -110
- package/error.js.map +1 -1
- package/error.mjs +1 -96
- package/error.mjs.map +1 -1
- package/index.d.mts +7 -169
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -168
- package/index.d.ts.map +1 -1
- package/index.js +14 -157
- package/index.js.map +1 -1
- package/index.mjs +6 -130
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +75 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +75 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +21 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +21 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +77 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +72 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +13 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +13 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +36 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +33 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +33 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +28 -0
- package/internal/shim-types.d.ts +28 -0
- package/internal/shims/crypto.d.mts +13 -0
- package/internal/shims/crypto.d.mts.map +1 -0
- package/internal/shims/crypto.d.ts +13 -0
- package/internal/shims/crypto.d.ts.map +1 -0
- package/internal/shims/crypto.js +13 -0
- package/internal/shims/crypto.js.map +1 -0
- package/internal/shims/crypto.mjs +9 -0
- package/internal/shims/crypto.mjs.map +1 -0
- package/internal/shims/file.d.mts +23 -0
- package/internal/shims/file.d.mts.map +1 -0
- package/internal/shims/file.d.ts +23 -0
- package/internal/shims/file.d.ts.map +1 -0
- package/internal/shims/file.js +16 -0
- package/internal/shims/file.js.map +1 -0
- package/internal/shims/file.mjs +12 -0
- package/internal/shims/file.mjs.map +1 -0
- package/internal/shims/getBuiltinModule.d.mts +11 -0
- package/internal/shims/getBuiltinModule.d.mts.map +1 -0
- package/internal/shims/getBuiltinModule.d.ts +11 -0
- package/internal/shims/getBuiltinModule.d.ts.map +1 -0
- package/internal/shims/getBuiltinModule.js +68 -0
- package/internal/shims/getBuiltinModule.js.map +1 -0
- package/internal/shims/getBuiltinModule.mjs +64 -0
- package/internal/shims/getBuiltinModule.mjs.map +1 -0
- package/internal/shims/nullGetBuiltinModule.d.mts +2 -0
- package/internal/shims/nullGetBuiltinModule.d.mts.map +1 -0
- package/internal/shims/nullGetBuiltinModule.d.ts +2 -0
- package/internal/shims/nullGetBuiltinModule.d.ts.map +1 -0
- package/internal/shims/nullGetBuiltinModule.js +5 -0
- package/internal/shims/nullGetBuiltinModule.js.map +1 -0
- package/internal/shims/nullGetBuiltinModule.mjs +2 -0
- package/internal/shims/nullGetBuiltinModule.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +93 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +46 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +46 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +87 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/types.d.mts +68 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +68 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +44 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +44 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +131 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +122 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +33 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +28 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +38 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +38 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +58 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +53 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +20 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +16 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +16 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +16 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +109 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +92 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/{_shims/auto/runtime-bun.js → internal/utils.js} +8 -5
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/polling.d.mts +48 -0
- package/lib/polling.d.mts.map +1 -0
- package/lib/polling.d.ts.map +1 -1
- package/lib/polling.js +0 -1
- package/lib/polling.js.map +1 -1
- package/lib/polling.mjs +0 -1
- package/lib/polling.mjs.map +1 -1
- package/package.json +126 -63
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +1 -29
- package/pagination.d.ts.map +1 -1
- package/pagination.js +16 -42
- package/pagination.js.map +1 -1
- package/pagination.mjs +1 -40
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +1 -5
- package/resource.d.ts.map +1 -1
- package/resource.js +16 -8
- package/resource.js.map +1 -1
- package/resource.mjs +1 -6
- package/resource.mjs.map +1 -1
- package/resources/embeddings.d.mts +46 -0
- package/resources/embeddings.d.mts.map +1 -0
- package/resources/embeddings.d.ts +4 -3
- package/resources/embeddings.d.ts.map +1 -1
- package/resources/embeddings.js +1 -1
- package/resources/embeddings.js.map +1 -1
- package/resources/embeddings.mjs +1 -1
- package/resources/embeddings.mjs.map +1 -1
- package/resources/extractions/content.d.mts +34 -0
- package/resources/extractions/content.d.mts.map +1 -0
- package/resources/extractions/content.d.ts +4 -3
- package/resources/extractions/content.d.ts.map +1 -1
- package/resources/extractions/content.js +1 -1
- package/resources/extractions/content.js.map +1 -1
- package/resources/extractions/content.mjs +1 -1
- package/resources/extractions/content.mjs.map +1 -1
- package/resources/extractions/extractions.d.mts +18 -0
- package/resources/extractions/extractions.d.mts.map +1 -0
- package/resources/extractions/extractions.d.ts +1 -1
- package/resources/extractions/extractions.d.ts.map +1 -1
- package/resources/extractions/extractions.js +1 -1
- package/resources/extractions/extractions.js.map +1 -1
- package/resources/extractions/extractions.mjs +1 -1
- package/resources/extractions/index.d.mts +5 -0
- package/resources/extractions/index.d.mts.map +1 -0
- package/resources/extractions/index.d.ts.map +1 -1
- package/resources/extractions/jobs.d.mts +85 -0
- package/resources/extractions/jobs.d.mts.map +1 -0
- package/resources/extractions/jobs.d.ts +5 -4
- package/resources/extractions/jobs.d.ts.map +1 -1
- package/resources/extractions/jobs.js +4 -3
- package/resources/extractions/jobs.js.map +1 -1
- package/resources/extractions/jobs.mjs +4 -3
- package/resources/extractions/jobs.mjs.map +1 -1
- package/resources/extractions/schema.d.mts +86 -0
- package/resources/extractions/schema.d.mts.map +1 -0
- package/resources/extractions/schema.d.ts +6 -5
- package/resources/extractions/schema.d.ts.map +1 -1
- package/resources/extractions/schema.js +1 -1
- package/resources/extractions/schema.js.map +1 -1
- package/resources/extractions/schema.mjs +1 -1
- package/resources/extractions/schema.mjs.map +1 -1
- package/resources/extractions.d.mts +2 -0
- package/resources/extractions.d.mts.map +1 -0
- package/resources/extractions.d.ts.map +1 -1
- package/resources/files.d.mts +125 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +16 -16
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +24 -46
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +23 -21
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +8 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/resources/parsing/index.d.mts +3 -0
- package/resources/parsing/index.d.mts.map +1 -0
- package/resources/parsing/index.d.ts +1 -1
- package/resources/parsing/index.d.ts.map +1 -1
- package/resources/parsing/index.js +1 -2
- package/resources/parsing/index.js.map +1 -1
- package/resources/parsing/index.mjs +1 -1
- package/resources/parsing/index.mjs.map +1 -1
- package/resources/parsing/jobs.d.mts +289 -0
- package/resources/parsing/jobs.d.mts.map +1 -0
- package/resources/parsing/jobs.d.ts +16 -17
- package/resources/parsing/jobs.d.ts.map +1 -1
- package/resources/parsing/jobs.js +18 -18
- package/resources/parsing/jobs.js.map +1 -1
- package/resources/parsing/jobs.mjs +17 -16
- package/resources/parsing/jobs.mjs.map +1 -1
- package/resources/parsing/parsing.d.mts +10 -0
- package/resources/parsing/parsing.d.mts.map +1 -0
- package/resources/parsing/parsing.d.ts +2 -2
- package/resources/parsing/parsing.d.ts.map +1 -1
- package/resources/parsing/parsing.js +1 -2
- package/resources/parsing/parsing.js.map +1 -1
- package/resources/parsing/parsing.mjs +2 -3
- package/resources/parsing/parsing.mjs.map +1 -1
- package/resources/parsing.d.mts +2 -0
- package/resources/parsing.d.mts.map +1 -0
- package/resources/parsing.d.ts.map +1 -1
- package/resources/shared.d.mts +49 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/top-level.d.mts +184 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts.map +1 -1
- package/resources/vector-stores/files.d.mts +303 -0
- package/resources/vector-stores/files.d.mts.map +1 -0
- package/resources/vector-stores/files.d.ts +27 -16
- package/resources/vector-stores/files.d.ts.map +1 -1
- package/resources/vector-stores/files.js +23 -23
- package/resources/vector-stores/files.js.map +1 -1
- package/resources/vector-stores/files.mjs +22 -21
- package/resources/vector-stores/files.mjs.map +1 -1
- package/resources/vector-stores/index.d.mts +3 -0
- package/resources/vector-stores/index.d.mts.map +1 -0
- package/resources/vector-stores/index.d.ts +2 -2
- package/resources/vector-stores/index.d.ts.map +1 -1
- package/resources/vector-stores/index.js +1 -3
- package/resources/vector-stores/index.js.map +1 -1
- package/resources/vector-stores/index.mjs +2 -2
- package/resources/vector-stores/index.mjs.map +1 -1
- package/resources/vector-stores/vector-stores.d.mts +428 -0
- package/resources/vector-stores/vector-stores.d.mts.map +1 -0
- package/resources/vector-stores/vector-stores.d.ts +15 -16
- package/resources/vector-stores/vector-stores.d.ts.map +1 -1
- package/resources/vector-stores/vector-stores.js +18 -19
- package/resources/vector-stores/vector-stores.js.map +1 -1
- package/resources/vector-stores/vector-stores.mjs +18 -18
- package/resources/vector-stores/vector-stores.mjs.map +1 -1
- package/resources/vector-stores.d.mts +2 -0
- package/resources/vector-stores.d.mts.map +1 -0
- package/resources/vector-stores.d.ts.map +1 -1
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts.map +1 -1
- package/src/api-promise.ts +2 -0
- package/src/client.ts +860 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +183 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -130
- package/src/index.ts +6 -330
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +96 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +37 -0
- package/src/internal/shim-types.d.ts +28 -0
- package/src/internal/shims/crypto.ts +18 -0
- package/src/internal/shims/file.ts +32 -0
- package/src/internal/shims/getBuiltinModule.ts +64 -0
- package/src/internal/shims/nullGetBuiltinModule.ts +1 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +152 -0
- package/src/internal/types.ts +92 -0
- package/src/internal/uploads.ts +175 -0
- package/src/internal/utils/base64.ts +37 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +65 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +19 -0
- package/src/internal/utils/values.ts +102 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/polling.ts +0 -1
- package/src/pagination.ts +2 -82
- package/src/resource.ts +2 -11
- package/src/resources/embeddings.ts +5 -4
- package/src/resources/extractions/content.ts +4 -3
- package/src/resources/extractions/extractions.ts +1 -1
- package/src/resources/extractions/jobs.ts +7 -5
- package/src/resources/extractions/schema.ts +6 -5
- package/src/resources/files.ts +30 -34
- package/src/resources/index.ts +2 -2
- package/src/resources/parsing/index.ts +1 -1
- package/src/resources/parsing/jobs.ts +23 -32
- package/src/resources/parsing/parsing.ts +2 -3
- package/src/resources/vector-stores/files.ts +51 -49
- package/src/resources/vector-stores/index.ts +4 -2
- package/src/resources/vector-stores/vector-stores.ts +27 -38
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +2 -255
- package/src/version.ts +1 -1
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +1 -74
- package/uploads.d.ts.map +1 -1
- package/uploads.js +16 -168
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -157
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -83
- package/_shims/index.js +0 -17
- package/_shims/index.mjs +0 -11
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -252
- package/core.d.ts.map +0 -1
- package/core.js +0 -917
- package/core.js.map +0 -1
- package/core.mjs +0 -885
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -83
- package/src/_shims/index.js +0 -17
- package/src/_shims/index.mjs +0 -11
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1227
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/internal/types.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC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":3,"file":"types.mjs","sourceRoot":"","sources":["../src/internal/types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
import { type RequestOptions } from "./request-options.mjs";
|
4
|
+
import type { FilePropertyBag, Fetch } from "./builtin-types.mjs";
|
5
|
+
import type { Mixedbread } from "../client.mjs";
|
6
|
+
import { type File } from "./shims/file.mjs";
|
7
|
+
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
|
8
|
+
type FsReadStream = AsyncIterable<Uint8Array> & {
|
9
|
+
path: string | {
|
10
|
+
toString(): string;
|
11
|
+
};
|
12
|
+
};
|
13
|
+
interface BunFile extends Blob {
|
14
|
+
readonly name?: string | undefined;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Typically, this is a native "File" class.
|
18
|
+
*
|
19
|
+
* We provide the {@link toFile} utility to convert a variety of objects
|
20
|
+
* into the File class.
|
21
|
+
*
|
22
|
+
* For convenience, you can also pass a fetch Response, or in Node,
|
23
|
+
* the result of fs.createReadStream().
|
24
|
+
*/
|
25
|
+
export type Uploadable = File | Response | FsReadStream | BunFile;
|
26
|
+
/**
|
27
|
+
* Construct a `File` instance. This is used to ensure a helpful error is thrown
|
28
|
+
* for environments that don't define a global `File` yet.
|
29
|
+
*/
|
30
|
+
export declare function makeFile(fileBits: BlobPart[], fileName: string | undefined, options?: FilePropertyBag): File;
|
31
|
+
export declare function getName(value: any): string | undefined;
|
32
|
+
export declare const isAsyncIterable: (value: any) => value is AsyncIterable<any>;
|
33
|
+
/**
|
34
|
+
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
35
|
+
* Otherwise returns the request as is.
|
36
|
+
*/
|
37
|
+
export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: Mixedbread | Fetch) => Promise<RequestOptions>;
|
38
|
+
type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & {
|
39
|
+
body: unknown;
|
40
|
+
};
|
41
|
+
export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: Mixedbread | Fetch) => Promise<RequestOptions>;
|
42
|
+
export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: Mixedbread | Fetch) => Promise<FormData>;
|
43
|
+
export {};
|
44
|
+
//# sourceMappingURL=uploads.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["../src/internal/uploads.ts"],"names":[],"mappings":";;OAAO,EAAE,KAAK,cAAc,EAAE;OACvB,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;OAC/B,KAAK,EAAE,UAAU,EAAE;OACnB,EAAE,KAAK,IAAI,EAAW;AAG7B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,QAAQ,CAAC;AAChF,KAAK,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,IAAI,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAG1F,UAAU,OAAQ,SAAQ,IAAI;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;AAElE;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,QAAQ,EAAE,EACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAGN;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CActD;AAED,eAAO,MAAM,eAAe,UAAW,GAAG,gCACuD,CAAC;AAElG;;;GAGG;AACH,eAAO,MAAM,gCAAgC,SACrC,cAAc,SACb,UAAU,GAAG,KAAK,KACxB,QAAQ,cAAc,CAIxB,CAAC;AAEF,KAAK,2BAA2B,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,eAAO,MAAM,2BAA2B,SAChC,2BAA2B,SAC1B,UAAU,GAAG,KAAK,KACxB,QAAQ,cAAc,CAExB,CAAC;AAkCF,eAAO,MAAM,UAAU,4DAEd,UAAU,GAAG,KAAK,KACxB,QAAQ,QAAQ,CASlB,CAAC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
import { type RequestOptions } from "./request-options.js";
|
4
|
+
import type { FilePropertyBag, Fetch } from "./builtin-types.js";
|
5
|
+
import type { Mixedbread } from "../client.js";
|
6
|
+
import { type File } from "./shims/file.js";
|
7
|
+
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
|
8
|
+
type FsReadStream = AsyncIterable<Uint8Array> & {
|
9
|
+
path: string | {
|
10
|
+
toString(): string;
|
11
|
+
};
|
12
|
+
};
|
13
|
+
interface BunFile extends Blob {
|
14
|
+
readonly name?: string | undefined;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Typically, this is a native "File" class.
|
18
|
+
*
|
19
|
+
* We provide the {@link toFile} utility to convert a variety of objects
|
20
|
+
* into the File class.
|
21
|
+
*
|
22
|
+
* For convenience, you can also pass a fetch Response, or in Node,
|
23
|
+
* the result of fs.createReadStream().
|
24
|
+
*/
|
25
|
+
export type Uploadable = File | Response | FsReadStream | BunFile;
|
26
|
+
/**
|
27
|
+
* Construct a `File` instance. This is used to ensure a helpful error is thrown
|
28
|
+
* for environments that don't define a global `File` yet.
|
29
|
+
*/
|
30
|
+
export declare function makeFile(fileBits: BlobPart[], fileName: string | undefined, options?: FilePropertyBag): File;
|
31
|
+
export declare function getName(value: any): string | undefined;
|
32
|
+
export declare const isAsyncIterable: (value: any) => value is AsyncIterable<any>;
|
33
|
+
/**
|
34
|
+
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
35
|
+
* Otherwise returns the request as is.
|
36
|
+
*/
|
37
|
+
export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: Mixedbread | Fetch) => Promise<RequestOptions>;
|
38
|
+
type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & {
|
39
|
+
body: unknown;
|
40
|
+
};
|
41
|
+
export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: Mixedbread | Fetch) => Promise<RequestOptions>;
|
42
|
+
export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: Mixedbread | Fetch) => Promise<FormData>;
|
43
|
+
export {};
|
44
|
+
//# sourceMappingURL=uploads.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../src/internal/uploads.ts"],"names":[],"mappings":";;OAAO,EAAE,KAAK,cAAc,EAAE;OACvB,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;OAC/B,KAAK,EAAE,UAAU,EAAE;OACnB,EAAE,KAAK,IAAI,EAAW;AAG7B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,QAAQ,CAAC;AAChF,KAAK,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,IAAI,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAG1F,UAAU,OAAQ,SAAQ,IAAI;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;AAElE;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,QAAQ,EAAE,EACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAGN;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CActD;AAED,eAAO,MAAM,eAAe,UAAW,GAAG,gCACuD,CAAC;AAElG;;;GAGG;AACH,eAAO,MAAM,gCAAgC,SACrC,cAAc,SACb,UAAU,GAAG,KAAK,KACxB,QAAQ,cAAc,CAIxB,CAAC;AAEF,KAAK,2BAA2B,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,eAAO,MAAM,2BAA2B,SAChC,2BAA2B,SAC1B,UAAU,GAAG,KAAK,KACxB,QAAQ,cAAc,CAExB,CAAC;AAkCF,eAAO,MAAM,UAAU,4DAEd,UAAU,GAAG,KAAK,KACxB,QAAQ,QAAQ,CASlB,CAAC"}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createForm = exports.multipartFormRequestOptions = exports.maybeMultipartFormRequestOptions = exports.isAsyncIterable = exports.getName = exports.makeFile = void 0;
|
4
|
+
const file_1 = require("./shims/file.js");
|
5
|
+
const shims_1 = require("./shims.js");
|
6
|
+
/**
|
7
|
+
* Construct a `File` instance. This is used to ensure a helpful error is thrown
|
8
|
+
* for environments that don't define a global `File` yet.
|
9
|
+
*/
|
10
|
+
function makeFile(fileBits, fileName, options) {
|
11
|
+
const File = (0, file_1.getFile)();
|
12
|
+
return new File(fileBits, fileName ?? 'unknown_file', options);
|
13
|
+
}
|
14
|
+
exports.makeFile = makeFile;
|
15
|
+
function getName(value) {
|
16
|
+
return (((typeof value === 'object' &&
|
17
|
+
value !== null &&
|
18
|
+
(('name' in value && value.name && String(value.name)) ||
|
19
|
+
('url' in value && value.url && String(value.url)) ||
|
20
|
+
('filename' in value && value.filename && String(value.filename)) ||
|
21
|
+
('path' in value && value.path && String(value.path)))) ||
|
22
|
+
'')
|
23
|
+
.split(/[\\/]/)
|
24
|
+
.pop() || undefined);
|
25
|
+
}
|
26
|
+
exports.getName = getName;
|
27
|
+
const isAsyncIterable = (value) => value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
|
28
|
+
exports.isAsyncIterable = isAsyncIterable;
|
29
|
+
/**
|
30
|
+
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
31
|
+
* Otherwise returns the request as is.
|
32
|
+
*/
|
33
|
+
const maybeMultipartFormRequestOptions = async (opts, fetch) => {
|
34
|
+
if (!hasUploadableValue(opts.body))
|
35
|
+
return opts;
|
36
|
+
return { ...opts, body: await (0, exports.createForm)(opts.body, fetch) };
|
37
|
+
};
|
38
|
+
exports.maybeMultipartFormRequestOptions = maybeMultipartFormRequestOptions;
|
39
|
+
const multipartFormRequestOptions = async (opts, fetch) => {
|
40
|
+
return { ...opts, body: await (0, exports.createForm)(opts.body, fetch) };
|
41
|
+
};
|
42
|
+
exports.multipartFormRequestOptions = multipartFormRequestOptions;
|
43
|
+
const supportsFormDataMap = new WeakMap();
|
44
|
+
/**
|
45
|
+
* node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
|
46
|
+
* properly-encoded form data, it just stringifies the object, resulting in a request body of "[object FormData]".
|
47
|
+
* This function detects if the fetch function provided supports the global FormData object to avoid
|
48
|
+
* confusing error messages later on.
|
49
|
+
*/
|
50
|
+
function supportsFormData(fetchObject) {
|
51
|
+
const fetch = typeof fetchObject === 'function' ? fetchObject : fetchObject.fetch;
|
52
|
+
const cached = supportsFormDataMap.get(fetch);
|
53
|
+
if (cached)
|
54
|
+
return cached;
|
55
|
+
const promise = (async () => {
|
56
|
+
try {
|
57
|
+
const FetchResponse = ('Response' in fetch ?
|
58
|
+
fetch.Response
|
59
|
+
: (await fetch('data:,')).constructor);
|
60
|
+
const data = new FormData();
|
61
|
+
if (data.toString() === (await new FetchResponse(data).text())) {
|
62
|
+
return false;
|
63
|
+
}
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
catch {
|
67
|
+
// avoid false negatives
|
68
|
+
return true;
|
69
|
+
}
|
70
|
+
})();
|
71
|
+
supportsFormDataMap.set(fetch, promise);
|
72
|
+
return promise;
|
73
|
+
}
|
74
|
+
const createForm = async (body, fetch) => {
|
75
|
+
if (!(await supportsFormData(fetch))) {
|
76
|
+
throw new TypeError('The provided fetch function does not support file uploads with the current global FormData class.');
|
77
|
+
}
|
78
|
+
const form = new FormData();
|
79
|
+
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
80
|
+
return form;
|
81
|
+
};
|
82
|
+
exports.createForm = createForm;
|
83
|
+
// We check for Blob not File because Bun.File doesn't inherit from File,
|
84
|
+
// but they both inherit from Blob and have a `name` property at runtime.
|
85
|
+
const isNamedBlob = (value) => value instanceof (0, file_1.getFile)() || (value instanceof Blob && 'name' in value);
|
86
|
+
const isUploadable = (value) => typeof value === 'object' &&
|
87
|
+
value !== null &&
|
88
|
+
(value instanceof Response || (0, exports.isAsyncIterable)(value) || isNamedBlob(value));
|
89
|
+
const hasUploadableValue = (value) => {
|
90
|
+
if (isUploadable(value))
|
91
|
+
return true;
|
92
|
+
if (Array.isArray(value))
|
93
|
+
return value.some(hasUploadableValue);
|
94
|
+
if (value && typeof value === 'object') {
|
95
|
+
for (const k in value) {
|
96
|
+
if (hasUploadableValue(value[k]))
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return false;
|
101
|
+
};
|
102
|
+
const addFormValue = async (form, key, value) => {
|
103
|
+
if (value === undefined)
|
104
|
+
return;
|
105
|
+
if (value == null) {
|
106
|
+
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
107
|
+
}
|
108
|
+
// TODO: make nested formats configurable
|
109
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
110
|
+
form.append(key, String(value));
|
111
|
+
}
|
112
|
+
else if (value instanceof Response) {
|
113
|
+
form.append(key, makeFile([await value.blob()], getName(value)));
|
114
|
+
}
|
115
|
+
else if ((0, exports.isAsyncIterable)(value)) {
|
116
|
+
form.append(key, makeFile([await new Response((0, shims_1.ReadableStreamFrom)(value)).blob()], getName(value)));
|
117
|
+
}
|
118
|
+
else if (isNamedBlob(value)) {
|
119
|
+
form.append(key, value, getName(value));
|
120
|
+
}
|
121
|
+
else if (Array.isArray(value)) {
|
122
|
+
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
|
123
|
+
}
|
124
|
+
else if (typeof value === 'object') {
|
125
|
+
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
129
|
+
}
|
130
|
+
};
|
131
|
+
//# sourceMappingURL=uploads.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../src/internal/uploads.ts"],"names":[],"mappings":";;;AAGA,0CAAkD;AAClD,sCAA6C;AAqB7C;;;GAGG;AACH,SAAgB,QAAQ,CACtB,QAAoB,EACpB,QAA4B,EAC5B,OAAyB;IAEzB,MAAM,IAAI,GAAG,IAAA,cAAO,GAAE,CAAC;IACvB,OAAO,IAAI,IAAI,CAAC,QAAe,EAAE,QAAQ,IAAI,cAAc,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAPD,4BAOC;AAED,SAAgB,OAAO,CAAC,KAAU;IAChC,OAAO,CACL,CACE,CAAC,OAAO,KAAK,KAAK,QAAQ;QACxB,KAAK,KAAK,IAAI;QACd,CAAC,CAAC,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC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,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import { getFile } from "./shims/file.mjs";
|
2
|
+
import { ReadableStreamFrom } from "./shims.mjs";
|
3
|
+
/**
|
4
|
+
* Construct a `File` instance. This is used to ensure a helpful error is thrown
|
5
|
+
* for environments that don't define a global `File` yet.
|
6
|
+
*/
|
7
|
+
export function makeFile(fileBits, fileName, options) {
|
8
|
+
const File = getFile();
|
9
|
+
return new File(fileBits, fileName ?? 'unknown_file', options);
|
10
|
+
}
|
11
|
+
export function getName(value) {
|
12
|
+
return (((typeof value === 'object' &&
|
13
|
+
value !== null &&
|
14
|
+
(('name' in value && value.name && String(value.name)) ||
|
15
|
+
('url' in value && value.url && String(value.url)) ||
|
16
|
+
('filename' in value && value.filename && String(value.filename)) ||
|
17
|
+
('path' in value && value.path && String(value.path)))) ||
|
18
|
+
'')
|
19
|
+
.split(/[\\/]/)
|
20
|
+
.pop() || undefined);
|
21
|
+
}
|
22
|
+
export const isAsyncIterable = (value) => value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
|
23
|
+
/**
|
24
|
+
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
25
|
+
* Otherwise returns the request as is.
|
26
|
+
*/
|
27
|
+
export const maybeMultipartFormRequestOptions = async (opts, fetch) => {
|
28
|
+
if (!hasUploadableValue(opts.body))
|
29
|
+
return opts;
|
30
|
+
return { ...opts, body: await createForm(opts.body, fetch) };
|
31
|
+
};
|
32
|
+
export const multipartFormRequestOptions = async (opts, fetch) => {
|
33
|
+
return { ...opts, body: await createForm(opts.body, fetch) };
|
34
|
+
};
|
35
|
+
const supportsFormDataMap = new WeakMap();
|
36
|
+
/**
|
37
|
+
* node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
|
38
|
+
* properly-encoded form data, it just stringifies the object, resulting in a request body of "[object FormData]".
|
39
|
+
* This function detects if the fetch function provided supports the global FormData object to avoid
|
40
|
+
* confusing error messages later on.
|
41
|
+
*/
|
42
|
+
function supportsFormData(fetchObject) {
|
43
|
+
const fetch = typeof fetchObject === 'function' ? fetchObject : fetchObject.fetch;
|
44
|
+
const cached = supportsFormDataMap.get(fetch);
|
45
|
+
if (cached)
|
46
|
+
return cached;
|
47
|
+
const promise = (async () => {
|
48
|
+
try {
|
49
|
+
const FetchResponse = ('Response' in fetch ?
|
50
|
+
fetch.Response
|
51
|
+
: (await fetch('data:,')).constructor);
|
52
|
+
const data = new FormData();
|
53
|
+
if (data.toString() === (await new FetchResponse(data).text())) {
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
return true;
|
57
|
+
}
|
58
|
+
catch {
|
59
|
+
// avoid false negatives
|
60
|
+
return true;
|
61
|
+
}
|
62
|
+
})();
|
63
|
+
supportsFormDataMap.set(fetch, promise);
|
64
|
+
return promise;
|
65
|
+
}
|
66
|
+
export const createForm = async (body, fetch) => {
|
67
|
+
if (!(await supportsFormData(fetch))) {
|
68
|
+
throw new TypeError('The provided fetch function does not support file uploads with the current global FormData class.');
|
69
|
+
}
|
70
|
+
const form = new FormData();
|
71
|
+
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
72
|
+
return form;
|
73
|
+
};
|
74
|
+
// We check for Blob not File because Bun.File doesn't inherit from File,
|
75
|
+
// but they both inherit from Blob and have a `name` property at runtime.
|
76
|
+
const isNamedBlob = (value) => value instanceof getFile() || (value instanceof Blob && 'name' in value);
|
77
|
+
const isUploadable = (value) => typeof value === 'object' &&
|
78
|
+
value !== null &&
|
79
|
+
(value instanceof Response || isAsyncIterable(value) || isNamedBlob(value));
|
80
|
+
const hasUploadableValue = (value) => {
|
81
|
+
if (isUploadable(value))
|
82
|
+
return true;
|
83
|
+
if (Array.isArray(value))
|
84
|
+
return value.some(hasUploadableValue);
|
85
|
+
if (value && typeof value === 'object') {
|
86
|
+
for (const k in value) {
|
87
|
+
if (hasUploadableValue(value[k]))
|
88
|
+
return true;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return false;
|
92
|
+
};
|
93
|
+
const addFormValue = async (form, key, value) => {
|
94
|
+
if (value === undefined)
|
95
|
+
return;
|
96
|
+
if (value == null) {
|
97
|
+
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
98
|
+
}
|
99
|
+
// TODO: make nested formats configurable
|
100
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
101
|
+
form.append(key, String(value));
|
102
|
+
}
|
103
|
+
else if (value instanceof Response) {
|
104
|
+
form.append(key, makeFile([await value.blob()], getName(value)));
|
105
|
+
}
|
106
|
+
else if (isAsyncIterable(value)) {
|
107
|
+
form.append(key, makeFile([await new Response(ReadableStreamFrom(value)).blob()], getName(value)));
|
108
|
+
}
|
109
|
+
else if (isNamedBlob(value)) {
|
110
|
+
form.append(key, value, getName(value));
|
111
|
+
}
|
112
|
+
else if (Array.isArray(value)) {
|
113
|
+
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
|
114
|
+
}
|
115
|
+
else if (typeof value === 'object') {
|
116
|
+
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
//# sourceMappingURL=uploads.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["../src/internal/uploads.ts"],"names":[],"mappings":"OAGO,EAAa,OAAO,EAAE;OACtB,EAAE,kBAAkB,EAAE;AAqB7B;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,QAAoB,EACpB,QAA4B,EAC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C,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KAChF;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.d.mts","sourceRoot":"","sources":["../../src/internal/utils/base64.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,SAAU,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,KAAG,MAgBvE,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,UAcxC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/internal/utils/base64.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,SAAU,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,KAAG,MAgBvE,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,UAcxC,CAAC"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.fromBase64 = exports.toBase64 = void 0;
|
5
|
+
const error_1 = require("../../core/error.js");
|
6
|
+
const toBase64 = (data) => {
|
7
|
+
if (!data)
|
8
|
+
return '';
|
9
|
+
if (typeof data === 'string') {
|
10
|
+
data = new globalThis.TextEncoder().encode(data);
|
11
|
+
}
|
12
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
13
|
+
return globalThis.Buffer.from(data).toString('base64');
|
14
|
+
}
|
15
|
+
if (typeof btoa !== 'undefined') {
|
16
|
+
return btoa(String.fromCharCode.apply(null, data));
|
17
|
+
}
|
18
|
+
throw new error_1.MixedbreadError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
|
19
|
+
};
|
20
|
+
exports.toBase64 = toBase64;
|
21
|
+
const fromBase64 = (str) => {
|
22
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
23
|
+
return new Uint8Array(globalThis.Buffer.from(str, 'base64'));
|
24
|
+
}
|
25
|
+
if (typeof atob !== 'undefined') {
|
26
|
+
return new Uint8Array(atob(str)
|
27
|
+
.split('')
|
28
|
+
.map((c) => c.charCodeAt(0)));
|
29
|
+
}
|
30
|
+
throw new error_1.MixedbreadError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
|
31
|
+
};
|
32
|
+
exports.fromBase64 = fromBase64;
|
33
|
+
//# sourceMappingURL=base64.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/internal/utils/base64.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,+CAAmD;AAE5C,MAAM,QAAQ,GAAG,CAAC,IAA4C,EAAU,EAAE;IAC/E,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,WAAW,EAAE;QACrD,OAAQ,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACjE;IAED,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC;KAC3D;IAED,MAAM,IAAI,uBAAe,CAAC,0EAA0E,CAAC,CAAC;AACxG,CAAC,CAAC;AAhBW,QAAA,QAAQ,YAgBnB;AAEK,MAAM,UAAU,GAAG,CAAC,GAAW,EAAc,EAAE;IACpD,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,WAAW,EAAE;QACrD,OAAO,IAAI,UAAU,CAAE,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;KACvE;IAED,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,GAAG,CAAC;aACN,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAC;KACH;IAED,MAAM,IAAI,uBAAe,CAAC,wEAAwE,CAAC,CAAC;AACtG,CAAC,CAAC;AAdW,QAAA,UAAU,cAcrB"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
import { MixedbreadError } from "../../core/error.mjs";
|
3
|
+
export const toBase64 = (data) => {
|
4
|
+
if (!data)
|
5
|
+
return '';
|
6
|
+
if (typeof data === 'string') {
|
7
|
+
data = new globalThis.TextEncoder().encode(data);
|
8
|
+
}
|
9
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
10
|
+
return globalThis.Buffer.from(data).toString('base64');
|
11
|
+
}
|
12
|
+
if (typeof btoa !== 'undefined') {
|
13
|
+
return btoa(String.fromCharCode.apply(null, data));
|
14
|
+
}
|
15
|
+
throw new MixedbreadError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
|
16
|
+
};
|
17
|
+
export const fromBase64 = (str) => {
|
18
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
19
|
+
return new Uint8Array(globalThis.Buffer.from(str, 'base64'));
|
20
|
+
}
|
21
|
+
if (typeof atob !== 'undefined') {
|
22
|
+
return new Uint8Array(atob(str)
|
23
|
+
.split('')
|
24
|
+
.map((c) => c.charCodeAt(0)));
|
25
|
+
}
|
26
|
+
throw new MixedbreadError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
|
27
|
+
};
|
28
|
+
//# sourceMappingURL=base64.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.mjs","sourceRoot":"","sources":["../../src/internal/utils/base64.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,eAAe,EAAE;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAA4C,EAAU,EAAE;IAC/E,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,WAAW,EAAE;QACrD,OAAQ,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACjE;IAED,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC;KAC3D;IAED,MAAM,IAAI,eAAe,CAAC,0EAA0E,CAAC,CAAC;AACxG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAc,EAAE;IACpD,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,WAAW,EAAE;QACrD,OAAO,IAAI,UAAU,CAAE,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;KACvE;IAED,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,GAAG,CAAC;aACN,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAC;KACH;IAED,MAAM,IAAI,eAAe,CAAC,wEAAwE,CAAC,CAAC;AACtG,CAAC,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Read an environment variable.
|
3
|
+
*
|
4
|
+
* Trims beginning and trailing whitespace.
|
5
|
+
*
|
6
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
7
|
+
*/
|
8
|
+
export declare const readEnv: (env: string) => string | undefined;
|
9
|
+
//# sourceMappingURL=env.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAM,GAAG,SAQ9C,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Read an environment variable.
|
3
|
+
*
|
4
|
+
* Trims beginning and trailing whitespace.
|
5
|
+
*
|
6
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
7
|
+
*/
|
8
|
+
export declare const readEnv: (env: string) => string | undefined;
|
9
|
+
//# sourceMappingURL=env.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAM,GAAG,SAQ9C,CAAC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.readEnv = void 0;
|
5
|
+
/**
|
6
|
+
* Read an environment variable.
|
7
|
+
*
|
8
|
+
* Trims beginning and trailing whitespace.
|
9
|
+
*
|
10
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
11
|
+
*/
|
12
|
+
const readEnv = (env) => {
|
13
|
+
if (typeof globalThis.process !== 'undefined') {
|
14
|
+
return globalThis.process.env?.[env]?.trim() ?? undefined;
|
15
|
+
}
|
16
|
+
if (typeof globalThis.Deno !== 'undefined') {
|
17
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
18
|
+
}
|
19
|
+
return undefined;
|
20
|
+
};
|
21
|
+
exports.readEnv = readEnv;
|
22
|
+
//# sourceMappingURL=env.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF;;;;;;GAMG;AACI,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE;QACtD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;KACpE;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE;QACnD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;KACzD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
/**
|
3
|
+
* Read an environment variable.
|
4
|
+
*
|
5
|
+
* Trims beginning and trailing whitespace.
|
6
|
+
*
|
7
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
8
|
+
*/
|
9
|
+
export const readEnv = (env) => {
|
10
|
+
if (typeof globalThis.process !== 'undefined') {
|
11
|
+
return globalThis.process.env?.[env]?.trim() ?? undefined;
|
12
|
+
}
|
13
|
+
if (typeof globalThis.Deno !== 'undefined') {
|
14
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
15
|
+
}
|
16
|
+
return undefined;
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=env.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"env.mjs","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE;QACtD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;KACpE;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE;QACnD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;KACzD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
import { type Mixedbread } from "../../client.mjs";
|
3
|
+
import { RequestOptions } from "../request-options.mjs";
|
4
|
+
type LogFn = (message: string, ...rest: unknown[]) => void;
|
5
|
+
export type Logger = {
|
6
|
+
error: LogFn;
|
7
|
+
warn: LogFn;
|
8
|
+
info: LogFn;
|
9
|
+
debug: LogFn;
|
10
|
+
};
|
11
|
+
export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
|
12
|
+
export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: Mixedbread) => LogLevel | undefined;
|
13
|
+
export declare function loggerFor(client: Mixedbread): Logger;
|
14
|
+
export declare const formatRequestDetails: (details: {
|
15
|
+
options?: RequestOptions | undefined;
|
16
|
+
headers?: Headers | Record<string, string> | undefined;
|
17
|
+
retryOfRequestLogID?: string | undefined;
|
18
|
+
retryOf?: string | undefined;
|
19
|
+
url?: string | undefined;
|
20
|
+
status?: number | undefined;
|
21
|
+
method?: string | undefined;
|
22
|
+
durationMs?: number | undefined;
|
23
|
+
message?: unknown;
|
24
|
+
body?: unknown;
|
25
|
+
}) => {
|
26
|
+
options?: RequestOptions | undefined;
|
27
|
+
headers?: Headers | Record<string, string> | undefined;
|
28
|
+
retryOfRequestLogID?: string | undefined;
|
29
|
+
retryOf?: string | undefined;
|
30
|
+
url?: string | undefined;
|
31
|
+
status?: number | undefined;
|
32
|
+
method?: string | undefined;
|
33
|
+
durationMs?: number | undefined;
|
34
|
+
message?: unknown;
|
35
|
+
body?: unknown;
|
36
|
+
};
|
37
|
+
export {};
|
38
|
+
//# sourceMappingURL=log.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log.d.mts","sourceRoot":"","sources":["../../src/internal/utils/log.ts"],"names":[],"mappings":";OAGO,EAAE,KAAK,UAAU,EAAE;OACnB,EAAE,cAAc,EAAE;AAEzB,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAC3D,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,KAAK,CAAC;I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