notdiamond 1.1.4 → 2.0.0-rc10
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 +143 -0
- package/LICENSE +201 -0
- package/README.md +642 -96
- 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/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +192 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +192 -0
- package/client.d.ts.map +1 -0
- package/client.js +463 -0
- package/client.js.map +1 -0
- package/client.mjs +459 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -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/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 +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -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 +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -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 +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.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 +92 -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 +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -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 +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -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 +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -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 +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.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 +24 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +20 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -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 +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -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 +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -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/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +129 -123
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/custom-router.d.mts +145 -0
- package/resources/custom-router.d.mts.map +1 -0
- package/resources/custom-router.d.ts +145 -0
- package/resources/custom-router.d.ts.map +1 -0
- package/resources/custom-router.js +83 -0
- package/resources/custom-router.js.map +1 -0
- package/resources/custom-router.mjs +79 -0
- package/resources/custom-router.mjs.map +1 -0
- package/resources/index.d.mts +7 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +17 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -0
- package/resources/index.mjs.map +1 -0
- package/resources/model-router.d.mts +196 -0
- package/resources/model-router.d.mts.map +1 -0
- package/resources/model-router.d.ts +196 -0
- package/resources/model-router.d.ts.map +1 -0
- package/resources/model-router.js +70 -0
- package/resources/model-router.js.map +1 -0
- package/resources/model-router.mjs +66 -0
- package/resources/model-router.mjs.map +1 -0
- package/resources/models.d.mts +110 -0
- package/resources/models.d.mts.map +1 -0
- package/resources/models.d.ts +110 -0
- package/resources/models.d.ts.map +1 -0
- package/resources/models.js +49 -0
- package/resources/models.js.map +1 -0
- package/resources/models.mjs +45 -0
- package/resources/models.mjs.map +1 -0
- package/resources/preferences.d.mts +97 -0
- package/resources/preferences.d.mts.map +1 -0
- package/resources/preferences.d.ts +97 -0
- package/resources/preferences.d.ts.map +1 -0
- package/resources/preferences.js +70 -0
- package/resources/preferences.js.map +1 -0
- package/resources/preferences.mjs +66 -0
- package/resources/preferences.mjs.map +1 -0
- package/resources/prompt-adaptation.d.mts +679 -0
- package/resources/prompt-adaptation.d.mts.map +1 -0
- package/resources/prompt-adaptation.d.ts +679 -0
- package/resources/prompt-adaptation.d.ts.map +1 -0
- package/resources/prompt-adaptation.js +266 -0
- package/resources/prompt-adaptation.js.map +1 -0
- package/resources/prompt-adaptation.mjs +262 -0
- package/resources/prompt-adaptation.mjs.map +1 -0
- package/resources/report/index.d.mts +3 -0
- package/resources/report/index.d.mts.map +1 -0
- package/resources/report/index.d.ts +3 -0
- package/resources/report/index.d.ts.map +1 -0
- package/resources/report/index.js +9 -0
- package/resources/report/index.js.map +1 -0
- package/resources/report/index.mjs +4 -0
- package/resources/report/index.mjs.map +1 -0
- package/resources/report/metrics.d.mts +87 -0
- package/resources/report/metrics.d.mts.map +1 -0
- package/resources/report/metrics.d.ts +87 -0
- package/resources/report/metrics.d.ts.map +1 -0
- package/resources/report/metrics.js +57 -0
- package/resources/report/metrics.js.map +1 -0
- package/resources/report/metrics.mjs +53 -0
- package/resources/report/metrics.mjs.map +1 -0
- package/resources/report/report.d.mts +10 -0
- package/resources/report/report.d.mts.map +1 -0
- package/resources/report/report.d.ts +10 -0
- package/resources/report/report.d.ts.map +1 -0
- package/resources/report/report.js +17 -0
- package/resources/report/report.js.map +1 -0
- package/resources/report/report.mjs +12 -0
- package/resources/report/report.mjs.map +1 -0
- package/resources/report.d.mts +2 -0
- package/resources/report.d.mts.map +1 -0
- package/resources/report.d.ts +2 -0
- package/resources/report.d.ts.map +1 -0
- package/resources/report.js +6 -0
- package/resources/report.js.map +1 -0
- package/resources/report.mjs +3 -0
- package/resources/report.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +791 -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/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- 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 +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +20 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/custom-router.ts +168 -0
- package/src/resources/index.ts +33 -0
- package/src/resources/model-router.ts +224 -0
- package/src/resources/models.ts +133 -0
- package/src/resources/preferences.ts +121 -0
- package/src/resources/prompt-adaptation.ts +770 -0
- package/src/resources/report/index.ts +4 -0
- package/src/resources/report/metrics.ts +99 -0
- package/src/resources/report/report.ts +19 -0
- package/src/resources/report.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/LICENCE +0 -21
- package/dist/index.cjs +0 -601
- package/dist/index.d.cts +0 -228
- package/dist/index.d.mts +0 -228
- package/dist/index.d.ts +0 -228
- package/dist/index.mjs +0 -580
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { NullableHeaders } from "./headers.mjs";
|
|
2
|
+
import type { BodyInit } from "./builtin-types.mjs";
|
|
3
|
+
import type { HTTPMethod, MergedRequestInit } from "./types.mjs";
|
|
4
|
+
import { type HeadersLike } from "./headers.mjs";
|
|
5
|
+
export type FinalRequestOptions = RequestOptions & {
|
|
6
|
+
method: HTTPMethod;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
export type RequestOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
|
|
12
|
+
*/
|
|
13
|
+
method?: HTTPMethod;
|
|
14
|
+
/**
|
|
15
|
+
* The URL path for the request.
|
|
16
|
+
*
|
|
17
|
+
* @example "/v1/foo"
|
|
18
|
+
*/
|
|
19
|
+
path?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Query parameters to include in the request URL.
|
|
22
|
+
*/
|
|
23
|
+
query?: object | undefined | null;
|
|
24
|
+
/**
|
|
25
|
+
* The request body. Can be a string, JSON object, FormData, or other supported types.
|
|
26
|
+
*/
|
|
27
|
+
body?: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
|
|
30
|
+
*/
|
|
31
|
+
headers?: HeadersLike;
|
|
32
|
+
/**
|
|
33
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
34
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
35
|
+
*
|
|
36
|
+
* @default 2
|
|
37
|
+
*/
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
stream?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
42
|
+
* from the server before timing out a single request.
|
|
43
|
+
*
|
|
44
|
+
* @unit milliseconds
|
|
45
|
+
*/
|
|
46
|
+
timeout?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Additional `RequestInit` options to be passed to the underlying `fetch` call.
|
|
49
|
+
* These options will be merged with the client's default fetch options.
|
|
50
|
+
*/
|
|
51
|
+
fetchOptions?: MergedRequestInit;
|
|
52
|
+
/**
|
|
53
|
+
* An AbortSignal that can be used to cancel the request.
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal | undefined | null;
|
|
56
|
+
/**
|
|
57
|
+
* A unique key for this request to enable idempotency.
|
|
58
|
+
*/
|
|
59
|
+
idempotencyKey?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Override the default base URL for this specific request.
|
|
62
|
+
*/
|
|
63
|
+
defaultBaseURL?: string | undefined;
|
|
64
|
+
__binaryResponse?: boolean | undefined;
|
|
65
|
+
};
|
|
66
|
+
export type EncodedContent = {
|
|
67
|
+
bodyHeaders: HeadersLike;
|
|
68
|
+
body: BodyInit;
|
|
69
|
+
};
|
|
70
|
+
export type RequestEncoder = (request: {
|
|
71
|
+
headers: NullableHeaders;
|
|
72
|
+
body: unknown;
|
|
73
|
+
}) => EncodedContent;
|
|
74
|
+
export declare const FallbackEncoder: RequestEncoder;
|
|
75
|
+
//# sourceMappingURL=request-options.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-options.d.mts","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE;OAEnB,KAAK,EAAE,QAAQ,EAAE;OACjB,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE;OACtC,EAAE,KAAK,WAAW,EAAE;AAE3B,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAEjC;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,KAAK,cAAc,CAAC;AAEtG,eAAO,MAAM,eAAe,EAAE,cAO7B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { NullableHeaders } from "./headers.js";
|
|
2
|
+
import type { BodyInit } from "./builtin-types.js";
|
|
3
|
+
import type { HTTPMethod, MergedRequestInit } from "./types.js";
|
|
4
|
+
import { type HeadersLike } from "./headers.js";
|
|
5
|
+
export type FinalRequestOptions = RequestOptions & {
|
|
6
|
+
method: HTTPMethod;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
export type RequestOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
|
|
12
|
+
*/
|
|
13
|
+
method?: HTTPMethod;
|
|
14
|
+
/**
|
|
15
|
+
* The URL path for the request.
|
|
16
|
+
*
|
|
17
|
+
* @example "/v1/foo"
|
|
18
|
+
*/
|
|
19
|
+
path?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Query parameters to include in the request URL.
|
|
22
|
+
*/
|
|
23
|
+
query?: object | undefined | null;
|
|
24
|
+
/**
|
|
25
|
+
* The request body. Can be a string, JSON object, FormData, or other supported types.
|
|
26
|
+
*/
|
|
27
|
+
body?: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
|
|
30
|
+
*/
|
|
31
|
+
headers?: HeadersLike;
|
|
32
|
+
/**
|
|
33
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
34
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
35
|
+
*
|
|
36
|
+
* @default 2
|
|
37
|
+
*/
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
stream?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
42
|
+
* from the server before timing out a single request.
|
|
43
|
+
*
|
|
44
|
+
* @unit milliseconds
|
|
45
|
+
*/
|
|
46
|
+
timeout?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Additional `RequestInit` options to be passed to the underlying `fetch` call.
|
|
49
|
+
* These options will be merged with the client's default fetch options.
|
|
50
|
+
*/
|
|
51
|
+
fetchOptions?: MergedRequestInit;
|
|
52
|
+
/**
|
|
53
|
+
* An AbortSignal that can be used to cancel the request.
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal | undefined | null;
|
|
56
|
+
/**
|
|
57
|
+
* A unique key for this request to enable idempotency.
|
|
58
|
+
*/
|
|
59
|
+
idempotencyKey?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Override the default base URL for this specific request.
|
|
62
|
+
*/
|
|
63
|
+
defaultBaseURL?: string | undefined;
|
|
64
|
+
__binaryResponse?: boolean | undefined;
|
|
65
|
+
};
|
|
66
|
+
export type EncodedContent = {
|
|
67
|
+
bodyHeaders: HeadersLike;
|
|
68
|
+
body: BodyInit;
|
|
69
|
+
};
|
|
70
|
+
export type RequestEncoder = (request: {
|
|
71
|
+
headers: NullableHeaders;
|
|
72
|
+
body: unknown;
|
|
73
|
+
}) => EncodedContent;
|
|
74
|
+
export declare const FallbackEncoder: RequestEncoder;
|
|
75
|
+
//# sourceMappingURL=request-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-options.d.ts","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE;OAEnB,KAAK,EAAE,QAAQ,EAAE;OACjB,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE;OACtC,EAAE,KAAK,WAAW,EAAE;AAE3B,MAAM,MAAM,mBAAmB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|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FallbackEncoder = void 0;
|
|
5
|
+
const FallbackEncoder = ({ headers, body }) => {
|
|
6
|
+
return {
|
|
7
|
+
bodyHeaders: {
|
|
8
|
+
'content-type': 'application/json',
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify(body),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.FallbackEncoder = FallbackEncoder;
|
|
14
|
+
//# sourceMappingURL=request-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-options.js","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAmF/E,MAAM,eAAe,GAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACnE,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,eAAe,mBAO1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export const FallbackEncoder = ({ headers, body }) => {
|
|
3
|
+
return {
|
|
4
|
+
bodyHeaders: {
|
|
5
|
+
'content-type': 'application/json',
|
|
6
|
+
},
|
|
7
|
+
body: JSON.stringify(body),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=request-options.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-options.mjs","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAmFtF,MAAM,CAAC,MAAM,eAAe,GAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACnE,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shims for types that we can't always rely on being available globally.
|
|
3
|
+
*
|
|
4
|
+
* Note: these only exist at the type-level, there is no corresponding runtime
|
|
5
|
+
* version for any of these symbols.
|
|
6
|
+
*/
|
|
7
|
+
type NeverToAny<T> = T extends never ? any : T;
|
|
8
|
+
/** @ts-ignore */
|
|
9
|
+
type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
|
|
10
|
+
/** @ts-ignore */
|
|
11
|
+
type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;
|
|
12
|
+
type _ConditionalNodeReadableStream<R = any> = typeof globalThis extends {
|
|
13
|
+
ReadableStream: any;
|
|
14
|
+
} ? never : _NodeReadableStream<R>;
|
|
15
|
+
type _ReadableStream<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
|
|
16
|
+
export type { _ReadableStream as ReadableStream };
|
|
17
|
+
//# sourceMappingURL=shim-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-types.d.mts","sourceRoot":"","sources":["../src/internal/shim-types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;AAE/C,iBAAiB;AACjB,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEhE,iBAAiB;AACjB,KAAK,mBAAmB,CAAC,CAAC,GAAG,GAAG,IAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AAE3E,KAAK,8BAA8B,CAAC,CAAC,GAAG,GAAG,IACzC,OAAO,UAAU,SAAS;IAAE,cAAc,EAAE,GAAG,CAAA;CAAE,GAAG,KAAK,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAErF,KAAK,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,UAAU,CACtC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,GACzE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAC,CACpG,CAAC;AAEF,YAAY,EAAE,eAAe,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shims for types that we can't always rely on being available globally.
|
|
3
|
+
*
|
|
4
|
+
* Note: these only exist at the type-level, there is no corresponding runtime
|
|
5
|
+
* version for any of these symbols.
|
|
6
|
+
*/
|
|
7
|
+
type NeverToAny<T> = T extends never ? any : T;
|
|
8
|
+
/** @ts-ignore */
|
|
9
|
+
type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
|
|
10
|
+
/** @ts-ignore */
|
|
11
|
+
type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;
|
|
12
|
+
type _ConditionalNodeReadableStream<R = any> = typeof globalThis extends {
|
|
13
|
+
ReadableStream: any;
|
|
14
|
+
} ? never : _NodeReadableStream<R>;
|
|
15
|
+
type _ReadableStream<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
|
|
16
|
+
export type { _ReadableStream as ReadableStream };
|
|
17
|
+
//# sourceMappingURL=shim-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-types.d.ts","sourceRoot":"","sources":["../src/internal/shim-types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;AAE/C,iBAAiB;AACjB,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEhE,iBAAiB;AACjB,KAAK,mBAAmB,CAAC,CAAC,GAAG,GAAG,IAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AAE3E,KAAK,8BAA8B,CAAC,CAAC,GAAG,GAAG,IACzC,OAAO,UAAU,SAAS;IAAE,cAAc,EAAE,GAAG,CAAA;CAAE,GAAG,KAAK,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAErF,KAAK,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,UAAU,CACtC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,GACzE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAC,CACpG,CAAC;AAEF,YAAY,EAAE,eAAe,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-types.js","sourceRoot":"","sources":["../src/internal/shim-types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-types.mjs","sourceRoot":"","sources":["../src/internal/shim-types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Fetch } from "./builtin-types.mjs";
|
|
2
|
+
import type { ReadableStream } from "./shim-types.mjs";
|
|
3
|
+
export declare function getDefaultFetch(): Fetch;
|
|
4
|
+
type ReadableStreamArgs = ConstructorParameters<typeof ReadableStream>;
|
|
5
|
+
export declare function makeReadableStream(...args: ReadableStreamArgs): ReadableStream;
|
|
6
|
+
export declare function ReadableStreamFrom<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
9
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
10
|
+
*
|
|
11
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
12
|
+
*/
|
|
13
|
+
export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Cancels a ReadableStream we don't need to consume.
|
|
16
|
+
* See https://undici.nodejs.org/#/?id=garbage-collection
|
|
17
|
+
*/
|
|
18
|
+
export declare function CancelReadableStream(stream: any): Promise<void>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=shims.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.d.mts","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":"OASO,KAAK,EAAE,KAAK,EAAE;OACd,KAAK,EAAE,cAAc,EAAE;AAE9B,wBAAgB,eAAe,IAAI,KAAK,CAQvC;AAED,KAAK,kBAAkB,GAAG,qBAAqB,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,kBAAkB,GAAG,cAAc,CAW9E;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAkBjG;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAyBtF;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAYrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Fetch } from "./builtin-types.js";
|
|
2
|
+
import type { ReadableStream } from "./shim-types.js";
|
|
3
|
+
export declare function getDefaultFetch(): Fetch;
|
|
4
|
+
type ReadableStreamArgs = ConstructorParameters<typeof ReadableStream>;
|
|
5
|
+
export declare function makeReadableStream(...args: ReadableStreamArgs): ReadableStream;
|
|
6
|
+
export declare function ReadableStreamFrom<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
9
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
10
|
+
*
|
|
11
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
12
|
+
*/
|
|
13
|
+
export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Cancels a ReadableStream we don't need to consume.
|
|
16
|
+
* See https://undici.nodejs.org/#/?id=garbage-collection
|
|
17
|
+
*/
|
|
18
|
+
export declare function CancelReadableStream(stream: any): Promise<void>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=shims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":"OASO,KAAK,EAAE,KAAK,EAAE;OACd,KAAK,EAAE,cAAc,EAAE;AAE9B,wBAAgB,eAAe,IAAI,KAAK,CAQvC;AAED,KAAK,kBAAkB,GAAG,qBAAqB,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,kBAAkB,GAAG,cAAc,CAW9E;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAkBjG;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAyBtF;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAYrE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
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.getDefaultFetch = getDefaultFetch;
|
|
5
|
+
exports.makeReadableStream = makeReadableStream;
|
|
6
|
+
exports.ReadableStreamFrom = ReadableStreamFrom;
|
|
7
|
+
exports.ReadableStreamToAsyncIterable = ReadableStreamToAsyncIterable;
|
|
8
|
+
exports.CancelReadableStream = CancelReadableStream;
|
|
9
|
+
function getDefaultFetch() {
|
|
10
|
+
if (typeof fetch !== 'undefined') {
|
|
11
|
+
return fetch;
|
|
12
|
+
}
|
|
13
|
+
throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new NotDiamond({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
|
|
14
|
+
}
|
|
15
|
+
function makeReadableStream(...args) {
|
|
16
|
+
const ReadableStream = globalThis.ReadableStream;
|
|
17
|
+
if (typeof ReadableStream === 'undefined') {
|
|
18
|
+
// Note: All of the platforms / runtimes we officially support already define
|
|
19
|
+
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
|
|
20
|
+
throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`');
|
|
21
|
+
}
|
|
22
|
+
return new ReadableStream(...args);
|
|
23
|
+
}
|
|
24
|
+
function ReadableStreamFrom(iterable) {
|
|
25
|
+
let iter = Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
26
|
+
return makeReadableStream({
|
|
27
|
+
start() { },
|
|
28
|
+
async pull(controller) {
|
|
29
|
+
const { done, value } = await iter.next();
|
|
30
|
+
if (done) {
|
|
31
|
+
controller.close();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
controller.enqueue(value);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
async cancel() {
|
|
38
|
+
await iter.return?.();
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
44
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
45
|
+
*
|
|
46
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
47
|
+
*/
|
|
48
|
+
function ReadableStreamToAsyncIterable(stream) {
|
|
49
|
+
if (stream[Symbol.asyncIterator])
|
|
50
|
+
return stream;
|
|
51
|
+
const reader = stream.getReader();
|
|
52
|
+
return {
|
|
53
|
+
async next() {
|
|
54
|
+
try {
|
|
55
|
+
const result = await reader.read();
|
|
56
|
+
if (result?.done)
|
|
57
|
+
reader.releaseLock(); // release lock when stream becomes closed
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
async return() {
|
|
66
|
+
const cancelPromise = reader.cancel();
|
|
67
|
+
reader.releaseLock();
|
|
68
|
+
await cancelPromise;
|
|
69
|
+
return { done: true, value: undefined };
|
|
70
|
+
},
|
|
71
|
+
[Symbol.asyncIterator]() {
|
|
72
|
+
return this;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Cancels a ReadableStream we don't need to consume.
|
|
78
|
+
* See https://undici.nodejs.org/#/?id=garbage-collection
|
|
79
|
+
*/
|
|
80
|
+
async function CancelReadableStream(stream) {
|
|
81
|
+
if (stream === null || typeof stream !== 'object')
|
|
82
|
+
return;
|
|
83
|
+
if (stream[Symbol.asyncIterator]) {
|
|
84
|
+
await stream[Symbol.asyncIterator]().return?.();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const reader = stream.getReader();
|
|
88
|
+
const cancelPromise = reader.cancel();
|
|
89
|
+
reader.releaseLock();
|
|
90
|
+
await cancelPromise;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=shims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.js","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAYtF,0CAQC;AAID,gDAWC;AAED,gDAkBC;AAQD,sEAyBC;AAMD,oDAYC;AA9FD,SAAgB,eAAe;IAC7B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,KAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CACb,uJAAuJ,CACxJ,CAAC;AACJ,CAAC;AAID,SAAgB,kBAAkB,CAAC,GAAG,IAAwB;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,cAAc,CAAC;IAC1D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;QAC1C,6EAA6E;QAC7E,yFAAyF;QACzF,MAAM,IAAI,KAAK,CACb,yHAAyH,CAC1H,CAAC;IACJ,CAA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M,CAAC,CAAC;YACV,CAAC;QACH,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,aAAa,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC1C,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CAAC,MAAW;IACpD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO;IAE1D,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,WAAW,EAAE,CAAC;IACrB,MAAM,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export function getDefaultFetch() {
|
|
3
|
+
if (typeof fetch !== 'undefined') {
|
|
4
|
+
return fetch;
|
|
5
|
+
}
|
|
6
|
+
throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new NotDiamond({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
|
|
7
|
+
}
|
|
8
|
+
export function makeReadableStream(...args) {
|
|
9
|
+
const ReadableStream = globalThis.ReadableStream;
|
|
10
|
+
if (typeof ReadableStream === 'undefined') {
|
|
11
|
+
// Note: All of the platforms / runtimes we officially support already define
|
|
12
|
+
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
|
|
13
|
+
throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`');
|
|
14
|
+
}
|
|
15
|
+
return new ReadableStream(...args);
|
|
16
|
+
}
|
|
17
|
+
export function ReadableStreamFrom(iterable) {
|
|
18
|
+
let iter = Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
19
|
+
return makeReadableStream({
|
|
20
|
+
start() { },
|
|
21
|
+
async pull(controller) {
|
|
22
|
+
const { done, value } = await iter.next();
|
|
23
|
+
if (done) {
|
|
24
|
+
controller.close();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
controller.enqueue(value);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
async cancel() {
|
|
31
|
+
await iter.return?.();
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
37
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
38
|
+
*
|
|
39
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
40
|
+
*/
|
|
41
|
+
export function ReadableStreamToAsyncIterable(stream) {
|
|
42
|
+
if (stream[Symbol.asyncIterator])
|
|
43
|
+
return stream;
|
|
44
|
+
const reader = stream.getReader();
|
|
45
|
+
return {
|
|
46
|
+
async next() {
|
|
47
|
+
try {
|
|
48
|
+
const result = await reader.read();
|
|
49
|
+
if (result?.done)
|
|
50
|
+
reader.releaseLock(); // release lock when stream becomes closed
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
55
|
+
throw e;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
async return() {
|
|
59
|
+
const cancelPromise = reader.cancel();
|
|
60
|
+
reader.releaseLock();
|
|
61
|
+
await cancelPromise;
|
|
62
|
+
return { done: true, value: undefined };
|
|
63
|
+
},
|
|
64
|
+
[Symbol.asyncIterator]() {
|
|
65
|
+
return this;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Cancels a ReadableStream we don't need to consume.
|
|
71
|
+
* See https://undici.nodejs.org/#/?id=garbage-collection
|
|
72
|
+
*/
|
|
73
|
+
export async function CancelReadableStream(stream) {
|
|
74
|
+
if (stream === null || typeof stream !== 'object')
|
|
75
|
+
return;
|
|
76
|
+
if (stream[Symbol.asyncIterator]) {
|
|
77
|
+
await stream[Symbol.asyncIterator]().return?.();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const reader = stream.getReader();
|
|
81
|
+
const cancelPromise = reader.cancel();
|
|
82
|
+
reader.releaseLock();
|
|
83
|
+
await cancelPromise;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=shims.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.mjs","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAYtF,MAAM,UAAU,eAAe;IAC7B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,KAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CACb,uJAAuJ,CACxJ,CAAC;AACJ,CAAC;AAID,MAAM,UAAU,kBAAkB,CAAC,GAAG,IAAwB;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,cAAc,CAAC;IAC1D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;QAC1C,6EAA6E;QAC7E,yFAAyF;QACzF,MAAM,IAAI,KAAK,CACb,yHAAyH,CAC1H,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,cAAc,CAAC,GAA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QACH,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,aAAa,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC1C,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAW;IACpD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO;IAE1D,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,WAAW,EAAE,CAAC;IACrB,MAAM,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FilePropertyBag } from "./builtin-types.mjs";
|
|
2
|
+
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView;
|
|
3
|
+
/**
|
|
4
|
+
* Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc.
|
|
5
|
+
* Don't add arrayBuffer here, node-fetch doesn't have it
|
|
6
|
+
*/
|
|
7
|
+
interface BlobLike {
|
|
8
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
|
|
9
|
+
readonly size: number;
|
|
10
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
|
|
11
|
+
readonly type: string;
|
|
12
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
13
|
+
text(): Promise<string>;
|
|
14
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
15
|
+
slice(start?: number, end?: number): BlobLike;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Intended to match DOM File, node:buffer File, undici File, etc.
|
|
19
|
+
*/
|
|
20
|
+
interface FileLike extends BlobLike {
|
|
21
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
|
|
22
|
+
readonly lastModified: number;
|
|
23
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
|
|
24
|
+
readonly name?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Intended to match DOM Response, node-fetch Response, undici Response, etc.
|
|
28
|
+
*/
|
|
29
|
+
export interface ResponseLike {
|
|
30
|
+
url: string;
|
|
31
|
+
blob(): Promise<BlobLike>;
|
|
32
|
+
}
|
|
33
|
+
export type ToFileInput = FileLike | ResponseLike | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>;
|
|
34
|
+
/**
|
|
35
|
+
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
36
|
+
* @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts
|
|
37
|
+
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
38
|
+
* @param {Object=} options additional properties
|
|
39
|
+
* @param {string=} options.type the MIME type of the content
|
|
40
|
+
* @param {number=} options.lastModified the last modified timestamp
|
|
41
|
+
* @returns a {@link File} with the given properties
|
|
42
|
+
*/
|
|
43
|
+
export declare function toFile(value: ToFileInput | PromiseLike<ToFileInput>, name?: string | null | undefined, options?: FilePropertyBag | undefined): Promise<File>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=to-file.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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FilePropertyBag } from "./builtin-types.js";
|
|
2
|
+
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView;
|
|
3
|
+
/**
|
|
4
|
+
* Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc.
|
|
5
|
+
* Don't add arrayBuffer here, node-fetch doesn't have it
|
|
6
|
+
*/
|
|
7
|
+
interface BlobLike {
|
|
8
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
|
|
9
|
+
readonly size: number;
|
|
10
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
|
|
11
|
+
readonly type: string;
|
|
12
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
13
|
+
text(): Promise<string>;
|
|
14
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
15
|
+
slice(start?: number, end?: number): BlobLike;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Intended to match DOM File, node:buffer File, undici File, etc.
|
|
19
|
+
*/
|
|
20
|
+
interface FileLike extends BlobLike {
|
|
21
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
|
|
22
|
+
readonly lastModified: number;
|
|
23
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
|
|
24
|
+
readonly name?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Intended to match DOM Response, node-fetch Response, undici Response, etc.
|
|
28
|
+
*/
|
|
29
|
+
export interface ResponseLike {
|
|
30
|
+
url: string;
|
|
31
|
+
blob(): Promise<BlobLike>;
|
|
32
|
+
}
|
|
33
|
+
export type ToFileInput = FileLike | ResponseLike | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>;
|
|
34
|
+
/**
|
|
35
|
+
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
36
|
+
* @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts
|
|
37
|
+
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
38
|
+
* @param {Object=} options additional properties
|
|
39
|
+
* @param {string=} options.type the MIME type of the content
|
|
40
|
+
* @param {number=} options.lastModified the last modified timestamp
|
|
41
|
+
* @returns a {@link File} with the given properties
|
|
42
|
+
*/
|
|
43
|
+
export declare function toFile(value: ToFileInput | PromiseLike<ToFileInput>, name?: string | null | undefined, options?: FilePropertyBag | undefined): Promise<File>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=to-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-file.d.ts","sourceRoot":"","sources":["../src/internal/to-file.ts"],"names":[],"mappings":"OACO,KAAK,EAAE,eAAe,EAAE;AAG/B,KAAK,YAAY,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjF;;;GAGG;AACH,UAAU,QAAQ;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,6EAA6E;IAC7E,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/C;AAcD;;GAEG;AACH,UAAU,QAAS,SAAQ,QAAQ;IACjC,oFAAoF;IACpF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAYD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;I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