@roarkanalytics/sdk 2.21.0 → 2.21.1
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 +8 -0
- package/README.md +83 -45
- package/api-promise.d.mts +47 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +47 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +84 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +80 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +201 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +201 -0
- package/client.d.ts.map +1 -0
- package/client.js +454 -0
- package/client.js.map +1 -0
- package/client.mjs +427 -0
- package/client.mjs.map +1 -0
- package/error.d.mts +47 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +2 -2
- package/error.js.map +1 -1
- package/error.mjs +1 -1
- package/error.mjs.map +1 -1
- package/index.d.mts +4 -130
- package/index.d.mts.map +1 -0
- package/index.d.ts +4 -130
- package/index.d.ts.map +1 -1
- package/index.js +10 -128
- package/index.js.map +1 -1
- package/index.mjs +4 -102
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +65 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +65 -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 +26 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +21 -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 +10 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +10 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +28 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +24 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/polyfill/crypto.node.d.ts +10 -0
- package/internal/polyfill/crypto.node.js +11 -0
- package/internal/polyfill/crypto.node.mjs +2 -0
- package/internal/polyfill/file.node.d.ts +9 -0
- package/internal/polyfill/file.node.js +17 -0
- package/internal/polyfill/file.node.mjs +9 -0
- package/internal/qs/formats.d.mts +6 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/utils.d.mts +14 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/request-options.d.mts +34 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +34 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +39 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +34 -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.d.mts +61 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +61 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +101 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +92 -0
- package/internal/shims.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 +73 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +73 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +208 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +200 -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 +4 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +4 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +47 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +43 -0
- package/internal/utils/log.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 +15 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +11 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +15 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +15 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +100 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +84 -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/package.json +83 -66
- package/resource.d.mts +6 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -2
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/call.d.mts +1197 -0
- package/resources/call.d.mts.map +1 -0
- package/resources/call.d.ts +13 -24
- package/resources/call.d.ts.map +1 -1
- package/resources/call.js +15 -15
- package/resources/call.js.map +1 -1
- package/resources/call.mjs +15 -15
- package/resources/call.mjs.map +1 -1
- package/resources/evaluation.d.mts +1295 -0
- package/resources/evaluation.d.mts.map +1 -0
- package/resources/evaluation.d.ts +13 -26
- package/resources/evaluation.d.ts.map +1 -1
- package/resources/evaluation.js +13 -13
- package/resources/evaluation.js.map +1 -1
- package/resources/evaluation.mjs +13 -13
- package/resources/evaluation.mjs.map +1 -1
- package/resources/health.d.mts +29 -0
- package/resources/health.d.mts.map +1 -0
- package/resources/health.d.ts +3 -2
- package/resources/health.d.ts.map +1 -1
- package/resources/health.js.map +1 -1
- package/resources/health.mjs.map +1 -1
- package/resources/index.d.mts +8 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/integrations.d.mts +81 -0
- package/resources/integrations.d.mts.map +1 -0
- package/resources/integrations.d.ts +8 -40
- package/resources/integrations.d.ts.map +1 -1
- package/resources/integrations.js +0 -25
- package/resources/integrations.js.map +1 -1
- package/resources/integrations.mjs +0 -25
- package/resources/integrations.mjs.map +1 -1
- package/resources/metric.d.mts +75 -0
- package/resources/metric.d.mts.map +1 -0
- package/resources/metric.d.ts +3 -2
- package/resources/metric.d.ts.map +1 -1
- package/resources/metric.js.map +1 -1
- package/resources/metric.mjs.map +1 -1
- package/resources/persona.d.mts +491 -0
- package/resources/persona.d.mts.map +1 -0
- package/resources/persona.d.ts +13 -51
- package/resources/persona.d.ts.map +1 -1
- package/resources/persona.js +10 -26
- package/resources/persona.js.map +1 -1
- package/resources/persona.mjs +10 -26
- package/resources/persona.mjs.map +1 -1
- package/resources/simulation.d.mts +756 -0
- package/resources/simulation.d.mts.map +1 -0
- package/resources/simulation.d.ts +11 -58
- package/resources/simulation.d.ts.map +1 -1
- package/resources/simulation.js +13 -43
- package/resources/simulation.js.map +1 -1
- package/resources/simulation.mjs +13 -43
- package/resources/simulation.mjs.map +1 -1
- package/src/api-promise.ts +92 -0
- package/src/client.ts +751 -0
- package/src/error.ts +1 -1
- package/src/index.ts +4 -307
- package/src/internal/builtin-types.ts +79 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +22 -0
- package/src/internal/headers.ts +96 -0
- package/src/internal/parse.ts +41 -0
- package/src/internal/polyfill/crypto.node.d.ts +10 -0
- package/src/internal/polyfill/crypto.node.js +11 -0
- package/src/internal/polyfill/crypto.node.mjs +2 -0
- package/src/internal/polyfill/file.node.d.ts +9 -0
- package/src/internal/polyfill/file.node.js +17 -0
- package/src/internal/polyfill/file.node.mjs +9 -0
- package/src/internal/request-options.ts +67 -0
- package/src/internal/shim-types.d.ts +28 -0
- package/src/internal/shims.ts +145 -0
- package/src/internal/types.ts +98 -0
- package/src/internal/uploads.ts +307 -0
- package/src/internal/utils/base64.ts +37 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +49 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +13 -0
- package/src/internal/utils/values.ts +94 -0
- package/src/internal/utils.ts +8 -0
- package/src/resource.ts +2 -2
- package/src/resources/call.ts +22 -42
- package/src/resources/evaluation.ts +25 -42
- package/src/resources/health.ts +3 -2
- package/src/resources/integrations.ts +10 -34
- package/src/resources/metric.ts +3 -2
- package/src/resources/persona.ts +22 -61
- package/src/resources/simulation.ts +22 -84
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +1 -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 +3 -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 +0 -21
- 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 -255
- package/core.d.ts.map +0 -1
- package/core.js +0 -929
- package/core.js.map +0 -1
- package/core.mjs +0 -897
- package/core.mjs.map +0 -1
- package/resources.d.ts +0 -2
- package/resources.d.ts.map +0 -1
- package/resources.js +0 -18
- package/resources.js.map +0 -1
- package/resources.mjs +0 -2
- package/resources.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 -1242
- package/src/resources.ts +0 -1
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { isEmptyObj, hasOwn } from "./utils/values.mjs";
|
|
3
|
+
// This is required so that we can determine if a given object matches the RequestOptions
|
|
4
|
+
// type at runtime. While this requires duplication, it is enforced by the TypeScript
|
|
5
|
+
// compiler such that any missing / extraneous keys will cause an error.
|
|
6
|
+
const requestOptionsKeys = {
|
|
7
|
+
method: true,
|
|
8
|
+
path: true,
|
|
9
|
+
query: true,
|
|
10
|
+
body: true,
|
|
11
|
+
headers: true,
|
|
12
|
+
maxRetries: true,
|
|
13
|
+
stream: true,
|
|
14
|
+
timeout: true,
|
|
15
|
+
fetchOptions: true,
|
|
16
|
+
signal: true,
|
|
17
|
+
idempotencyKey: true,
|
|
18
|
+
__binaryResponse: true,
|
|
19
|
+
};
|
|
20
|
+
export const isRequestOptions = (obj) => {
|
|
21
|
+
return (typeof obj === 'object' &&
|
|
22
|
+
obj !== null &&
|
|
23
|
+
!isEmptyObj(obj) &&
|
|
24
|
+
Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k)));
|
|
25
|
+
};
|
|
26
|
+
export const FallbackEncoder = ({ headers, body }) => {
|
|
27
|
+
return {
|
|
28
|
+
bodyHeaders: {
|
|
29
|
+
'content-type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify(body),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//# 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;OAK/E,EAAE,UAAU,EAAE,MAAM,EAAE;AAsB7B,yFAAyF;AACzF,qFAAqF;AACrF,wEAAwE;AACxE,MAAM,kBAAkB,GAA6B;IACnD,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IAEb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,IAAI;IAEpB,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAyB,EAAE;IACtE,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,CAAC,UAAU,CAAC,GAAG,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC;AAKF,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,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shims for types that we can't always rely on being available globally.
|
|
5
|
+
*
|
|
6
|
+
* Note: these only exist at the type-level, there is no corresponding runtime
|
|
7
|
+
* version for any of these symbols.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* In order to properly access the global `NodeJS` type, if it's available, we
|
|
12
|
+
* need to make use of declaration shadowing. Without this, any checks for the
|
|
13
|
+
* presence of `NodeJS.ReadableStream` will fail.
|
|
14
|
+
*/
|
|
15
|
+
declare namespace NodeJS {
|
|
16
|
+
interface ReadableStream {}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type HasProperties<T> = keyof T extends never ? false : true;
|
|
20
|
+
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
type _ReadableStream<R = any> =
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
HasProperties<NodeJS.ReadableStream> extends true ? NodeJS.ReadableStream<R> : ReadableStream<R>;
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
|
|
28
|
+
export { _ReadableStream as ReadableStream };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shims for types that we can't always rely on being available globally.
|
|
5
|
+
*
|
|
6
|
+
* Note: these only exist at the type-level, there is no corresponding runtime
|
|
7
|
+
* version for any of these symbols.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* In order to properly access the global `NodeJS` type, if it's available, we
|
|
12
|
+
* need to make use of declaration shadowing. Without this, any checks for the
|
|
13
|
+
* presence of `NodeJS.ReadableStream` will fail.
|
|
14
|
+
*/
|
|
15
|
+
declare namespace NodeJS {
|
|
16
|
+
interface ReadableStream {}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type HasProperties<T> = keyof T extends never ? false : true;
|
|
20
|
+
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
type _ReadableStream<R = any> =
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
HasProperties<NodeJS.ReadableStream> extends true ? NodeJS.ReadableStream<R> : ReadableStream<R>;
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
|
|
28
|
+
export { _ReadableStream as ReadableStream };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Fetch } from "./builtin-types.mjs";
|
|
2
|
+
import { type ReadableStream } from "./shim-types.mjs";
|
|
3
|
+
export declare function getDefaultFetch(): Fetch;
|
|
4
|
+
/**
|
|
5
|
+
* A minimal copy of the NodeJS `stream.Readable` class so that we can
|
|
6
|
+
* accept the NodeJS types in certain places, e.g. file uploads
|
|
7
|
+
*
|
|
8
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
9
|
+
*/
|
|
10
|
+
export interface ReadableLike {
|
|
11
|
+
readable: boolean;
|
|
12
|
+
readonly readableEnded: boolean;
|
|
13
|
+
readonly readableFlowing: boolean | null;
|
|
14
|
+
readonly readableHighWaterMark: number;
|
|
15
|
+
readonly readableLength: number;
|
|
16
|
+
readonly readableObjectMode: boolean;
|
|
17
|
+
destroyed: boolean;
|
|
18
|
+
read(size?: number): any;
|
|
19
|
+
pause(): this;
|
|
20
|
+
resume(): this;
|
|
21
|
+
isPaused(): boolean;
|
|
22
|
+
destroy(error?: Error): this;
|
|
23
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Determines if the given value looks like a NodeJS `stream.Readable`
|
|
27
|
+
* object and that it is readable, i.e. has not been consumed.
|
|
28
|
+
*
|
|
29
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
30
|
+
*/
|
|
31
|
+
export declare function isReadableLike(value: any): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A minimal copy of the NodeJS `fs.ReadStream` class for usage within file uploads.
|
|
34
|
+
*
|
|
35
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
36
|
+
*/
|
|
37
|
+
export interface FsReadStreamLike extends ReadableLike {
|
|
38
|
+
path: {};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Determines if the given value looks like a NodeJS `fs.ReadStream`
|
|
42
|
+
* object.
|
|
43
|
+
*
|
|
44
|
+
* This just checks if the object matches our `Readable` interface
|
|
45
|
+
* and defines a `path` property, there may be false positives.
|
|
46
|
+
*
|
|
47
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
48
|
+
*/
|
|
49
|
+
export declare function isFsReadStreamLike(value: any): value is FsReadStreamLike;
|
|
50
|
+
type ReadableStreamArgs = ConstructorParameters<typeof ReadableStream>;
|
|
51
|
+
export declare function makeReadableStream(...args: ReadableStreamArgs): ReadableStream;
|
|
52
|
+
export declare function ReadableStreamFrom<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
55
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
56
|
+
*
|
|
57
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
58
|
+
*/
|
|
59
|
+
export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=shims.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.d.mts","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":"OASO,EAAE,KAAK,KAAK,EAAE;OACd,EAAE,KAAK,cAAc,EAAE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B,6BAA6B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAyBtF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Fetch } from "./builtin-types.js";
|
|
2
|
+
import { type ReadableStream } from "./shim-types.js";
|
|
3
|
+
export declare function getDefaultFetch(): Fetch;
|
|
4
|
+
/**
|
|
5
|
+
* A minimal copy of the NodeJS `stream.Readable` class so that we can
|
|
6
|
+
* accept the NodeJS types in certain places, e.g. file uploads
|
|
7
|
+
*
|
|
8
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
9
|
+
*/
|
|
10
|
+
export interface ReadableLike {
|
|
11
|
+
readable: boolean;
|
|
12
|
+
readonly readableEnded: boolean;
|
|
13
|
+
readonly readableFlowing: boolean | null;
|
|
14
|
+
readonly readableHighWaterMark: number;
|
|
15
|
+
readonly readableLength: number;
|
|
16
|
+
readonly readableObjectMode: boolean;
|
|
17
|
+
destroyed: boolean;
|
|
18
|
+
read(size?: number): any;
|
|
19
|
+
pause(): this;
|
|
20
|
+
resume(): this;
|
|
21
|
+
isPaused(): boolean;
|
|
22
|
+
destroy(error?: Error): this;
|
|
23
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Determines if the given value looks like a NodeJS `stream.Readable`
|
|
27
|
+
* object and that it is readable, i.e. has not been consumed.
|
|
28
|
+
*
|
|
29
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
30
|
+
*/
|
|
31
|
+
export declare function isReadableLike(value: any): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A minimal copy of the NodeJS `fs.ReadStream` class for usage within file uploads.
|
|
34
|
+
*
|
|
35
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
36
|
+
*/
|
|
37
|
+
export interface FsReadStreamLike extends ReadableLike {
|
|
38
|
+
path: {};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Determines if the given value looks like a NodeJS `fs.ReadStream`
|
|
42
|
+
* object.
|
|
43
|
+
*
|
|
44
|
+
* This just checks if the object matches our `Readable` interface
|
|
45
|
+
* and defines a `path` property, there may be false positives.
|
|
46
|
+
*
|
|
47
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
48
|
+
*/
|
|
49
|
+
export declare function isFsReadStreamLike(value: any): value is FsReadStreamLike;
|
|
50
|
+
type ReadableStreamArgs = ConstructorParameters<typeof ReadableStream>;
|
|
51
|
+
export declare function makeReadableStream(...args: ReadableStreamArgs): ReadableStream;
|
|
52
|
+
export declare function ReadableStreamFrom<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
55
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
56
|
+
*
|
|
57
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
58
|
+
*/
|
|
59
|
+
export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=shims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":"OASO,EAAE,KAAK,KAAK,EAAE;OACd,EAAE,KAAK,cAAc,EAAE;AAE9B,wBAAgB,eAAe,IAAI,KAAK,CAQvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,IAAI,OAAO,CAAC;IACpB,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAC;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,WAIxC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,EAAE,CAAC;CACV;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB,CAExE;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"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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.ReadableStreamToAsyncIterable = exports.ReadableStreamFrom = exports.makeReadableStream = exports.isFsReadStreamLike = exports.isReadableLike = exports.getDefaultFetch = void 0;
|
|
5
|
+
function getDefaultFetch() {
|
|
6
|
+
if (typeof fetch !== 'undefined') {
|
|
7
|
+
return fetch;
|
|
8
|
+
}
|
|
9
|
+
throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new Roark({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
|
|
10
|
+
}
|
|
11
|
+
exports.getDefaultFetch = getDefaultFetch;
|
|
12
|
+
/**
|
|
13
|
+
* Determines if the given value looks like a NodeJS `stream.Readable`
|
|
14
|
+
* object and that it is readable, i.e. has not been consumed.
|
|
15
|
+
*
|
|
16
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
17
|
+
*/
|
|
18
|
+
function isReadableLike(value) {
|
|
19
|
+
// We declare our own class of Readable here, so it's not feasible to
|
|
20
|
+
// do an 'instanceof' check. Instead, check for Readable-like properties.
|
|
21
|
+
return !!value && value.readable === true && typeof value.read === 'function';
|
|
22
|
+
}
|
|
23
|
+
exports.isReadableLike = isReadableLike;
|
|
24
|
+
/**
|
|
25
|
+
* Determines if the given value looks like a NodeJS `fs.ReadStream`
|
|
26
|
+
* object.
|
|
27
|
+
*
|
|
28
|
+
* This just checks if the object matches our `Readable` interface
|
|
29
|
+
* and defines a `path` property, there may be false positives.
|
|
30
|
+
*
|
|
31
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
32
|
+
*/
|
|
33
|
+
function isFsReadStreamLike(value) {
|
|
34
|
+
return isReadableLike(value) && 'path' in value;
|
|
35
|
+
}
|
|
36
|
+
exports.isFsReadStreamLike = isFsReadStreamLike;
|
|
37
|
+
function makeReadableStream(...args) {
|
|
38
|
+
const ReadableStream = globalThis.ReadableStream;
|
|
39
|
+
if (typeof ReadableStream === 'undefined') {
|
|
40
|
+
// Note: All of the platforms / runtimes we officially support already define
|
|
41
|
+
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
|
|
42
|
+
throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`');
|
|
43
|
+
}
|
|
44
|
+
return new ReadableStream(...args);
|
|
45
|
+
}
|
|
46
|
+
exports.makeReadableStream = makeReadableStream;
|
|
47
|
+
function ReadableStreamFrom(iterable) {
|
|
48
|
+
let iter = Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
49
|
+
return makeReadableStream({
|
|
50
|
+
start() { },
|
|
51
|
+
async pull(controller) {
|
|
52
|
+
const { done, value } = await iter.next();
|
|
53
|
+
if (done) {
|
|
54
|
+
controller.close();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
controller.enqueue(value);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async cancel() {
|
|
61
|
+
await iter.return?.();
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.ReadableStreamFrom = ReadableStreamFrom;
|
|
66
|
+
/**
|
|
67
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
68
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
69
|
+
*
|
|
70
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
71
|
+
*/
|
|
72
|
+
function ReadableStreamToAsyncIterable(stream) {
|
|
73
|
+
if (stream[Symbol.asyncIterator])
|
|
74
|
+
return stream;
|
|
75
|
+
const reader = stream.getReader();
|
|
76
|
+
return {
|
|
77
|
+
async next() {
|
|
78
|
+
try {
|
|
79
|
+
const result = await reader.read();
|
|
80
|
+
if (result?.done)
|
|
81
|
+
reader.releaseLock(); // release lock when stream becomes closed
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
86
|
+
throw e;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async return() {
|
|
90
|
+
const cancelPromise = reader.cancel();
|
|
91
|
+
reader.releaseLock();
|
|
92
|
+
await cancelPromise;
|
|
93
|
+
return { done: true, value: undefined };
|
|
94
|
+
},
|
|
95
|
+
[Symbol.asyncIterator]() {
|
|
96
|
+
return this;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
exports.ReadableStreamToAsyncIterable = ReadableStreamToAsyncIterable;
|
|
101
|
+
//# sourceMappingURL=shims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims.js","sourceRoot":"","sources":["../src/internal/shims.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAYtF,SAAgB,eAAe;IAC7B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAChC,OAAO,KAAY,CAAC;KACrB;IAED,MAAM,IAAI,KAAK,CACb,kJAAkJ,CACnJ,CAAC;AACJ,CAAC;AARD,0CAQC;AAwBD;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,qEAAqE;IACrE,yEAAyE;IACzE,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAChF,CAAC;AAJD,wCAIC;AAWD;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,MAAM,IAAI,KAAK,CAAC;AAClD,CAAC;AAFD,gDAEC;AAID,SAAgB,kBAAkB,CAAC,GAAG,IAAwB;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,cAAc,CAAC;IAC1D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;QACzC,6EAA6E;QAC7E,yFAAyF;QACzF,MAAM,IAAI,KAAK,CACb,yHAAyH,CAC1H,CAAC;KACH;IAED,OAAO,IAAI,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACrC,CAAC;AAXD,gDAWC;AAED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,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;AAzBD,sEAyBC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
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 Roark({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Determines if the given value looks like a NodeJS `stream.Readable`
|
|
10
|
+
* object and that it is readable, i.e. has not been consumed.
|
|
11
|
+
*
|
|
12
|
+
* https://nodejs.org/api/stream.html#class-streamreadable
|
|
13
|
+
*/
|
|
14
|
+
export function isReadableLike(value) {
|
|
15
|
+
// We declare our own class of Readable here, so it's not feasible to
|
|
16
|
+
// do an 'instanceof' check. Instead, check for Readable-like properties.
|
|
17
|
+
return !!value && value.readable === true && typeof value.read === 'function';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Determines if the given value looks like a NodeJS `fs.ReadStream`
|
|
21
|
+
* object.
|
|
22
|
+
*
|
|
23
|
+
* This just checks if the object matches our `Readable` interface
|
|
24
|
+
* and defines a `path` property, there may be false positives.
|
|
25
|
+
*
|
|
26
|
+
* https://nodejs.org/api/fs.html#class-fsreadstream
|
|
27
|
+
*/
|
|
28
|
+
export function isFsReadStreamLike(value) {
|
|
29
|
+
return isReadableLike(value) && 'path' in value;
|
|
30
|
+
}
|
|
31
|
+
export function makeReadableStream(...args) {
|
|
32
|
+
const ReadableStream = globalThis.ReadableStream;
|
|
33
|
+
if (typeof ReadableStream === 'undefined') {
|
|
34
|
+
// Note: All of the platforms / runtimes we officially support already define
|
|
35
|
+
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
|
|
36
|
+
throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`');
|
|
37
|
+
}
|
|
38
|
+
return new ReadableStream(...args);
|
|
39
|
+
}
|
|
40
|
+
export function ReadableStreamFrom(iterable) {
|
|
41
|
+
let iter = Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
42
|
+
return makeReadableStream({
|
|
43
|
+
start() { },
|
|
44
|
+
async pull(controller) {
|
|
45
|
+
const { done, value } = await iter.next();
|
|
46
|
+
if (done) {
|
|
47
|
+
controller.close();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
controller.enqueue(value);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
async cancel() {
|
|
54
|
+
await iter.return?.();
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
60
|
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
61
|
+
*
|
|
62
|
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
63
|
+
*/
|
|
64
|
+
export function ReadableStreamToAsyncIterable(stream) {
|
|
65
|
+
if (stream[Symbol.asyncIterator])
|
|
66
|
+
return stream;
|
|
67
|
+
const reader = stream.getReader();
|
|
68
|
+
return {
|
|
69
|
+
async next() {
|
|
70
|
+
try {
|
|
71
|
+
const result = await reader.read();
|
|
72
|
+
if (result?.done)
|
|
73
|
+
reader.releaseLock(); // release lock when stream becomes closed
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
78
|
+
throw e;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
async return() {
|
|
82
|
+
const cancelPromise = reader.cancel();
|
|
83
|
+
reader.releaseLock();
|
|
84
|
+
await cancelPromise;
|
|
85
|
+
return { done: true, value: undefined };
|
|
86
|
+
},
|
|
87
|
+
[Symbol.asyncIterator]() {
|
|
88
|
+
return this;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# 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;QAChC,OAAO,KAAY,CAAC;KACrB;IAED,MAAM,IAAI,KAAK,CACb,kJAAkJ,CACnJ,CAAC;AACJ,CAAC;AAwBD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAU;IACvC,qEAAqE;IACrE,yEAAyE;IACzE,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAChF,CAAC;AAWD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC3C,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,MAAM,IAAI,KAAK,CAAC;AAClD,CAAC;AAID,MAAM,UAAU,kBAAkB,CAAC,GAAG,IAAwB;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,cAAc,CAAC;IAC1D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;QACzC,6EAA6E;QAC7E,yFAAyF;QACzF,MAAM,IAAI,KAAK,CACb,yHAAyH,CAC1H,CAAC;KACH;IAED,OAAO,IAAI,cAAc,CAAC,GAAG,IAAI,CAA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,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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
export type PromiseOrValue<T> = T | Promise<T>;
|
|
3
|
+
export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
4
|
+
export type KeysEnum<T> = {
|
|
5
|
+
[P in keyof Required<T>]: true;
|
|
6
|
+
};
|
|
7
|
+
type NotAny<T> = [unknown] extends [T] ? never : T;
|
|
8
|
+
type Literal<T> = PropertyKey extends T ? never : T;
|
|
9
|
+
type MappedLiteralKeys<T> = T extends any ? Literal<keyof T> : never;
|
|
10
|
+
type MappedIndex<T, K> = T extends any ? K extends keyof T ? T[K] : never : never;
|
|
11
|
+
/**
|
|
12
|
+
* Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
|
|
13
|
+
*/
|
|
14
|
+
type OverloadedParameters<T> = T extends ({
|
|
15
|
+
(...args: infer A): unknown;
|
|
16
|
+
(...args: infer B): unknown;
|
|
17
|
+
(...args: infer C): unknown;
|
|
18
|
+
(...args: infer D): unknown;
|
|
19
|
+
}) ? A | B | C | D : T extends ({
|
|
20
|
+
(...args: infer A): unknown;
|
|
21
|
+
(...args: infer B): unknown;
|
|
22
|
+
(...args: infer C): unknown;
|
|
23
|
+
}) ? A | B | C : T extends ({
|
|
24
|
+
(...args: infer A): unknown;
|
|
25
|
+
(...args: infer B): unknown;
|
|
26
|
+
}) ? A | B : T extends (...args: infer A) => unknown ? A : never;
|
|
27
|
+
/**
|
|
28
|
+
* These imports attempt to get types from a parent package's dependencies.
|
|
29
|
+
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
30
|
+
* would cause typescript to show types not present at runtime. To avoid this, we import
|
|
31
|
+
* directly from parent node_modules folders.
|
|
32
|
+
*
|
|
33
|
+
* We need to check multiple levels because we don't know what directory structure we'll be in.
|
|
34
|
+
* For example, pnpm generates directories like this:
|
|
35
|
+
* ```
|
|
36
|
+
* node_modules
|
|
37
|
+
* ├── .pnpm
|
|
38
|
+
* │ └── pkg@1.0.0
|
|
39
|
+
* │ └── node_modules
|
|
40
|
+
* │ └── pkg
|
|
41
|
+
* │ └── internal
|
|
42
|
+
* │ └── types.d.ts
|
|
43
|
+
* ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
|
|
44
|
+
* └── undici
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
48
|
+
*/
|
|
49
|
+
/** @ts-ignore For users with \@types/node */
|
|
50
|
+
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types').RequestInit> | NotAny<import('../../node_modules/undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types').RequestInit>;
|
|
51
|
+
/** @ts-ignore For users with undici */
|
|
52
|
+
type UndiciRequestInit = NotAny<import('../node_modules/undici').RequestInit> | NotAny<import('../../node_modules/undici').RequestInit> | NotAny<import('../../../node_modules/undici').RequestInit> | NotAny<import('../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici').RequestInit>;
|
|
53
|
+
/** @ts-ignore For users with \@types/bun */
|
|
54
|
+
type BunRequestInit = globalThis.FetchRequestInit;
|
|
55
|
+
/** @ts-ignore For users with node-fetch */
|
|
56
|
+
type NodeFetchRequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
57
|
+
/** @ts-ignore For users who use Deno */
|
|
58
|
+
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
59
|
+
type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetchRequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
|
|
60
|
+
/**
|
|
61
|
+
* This type contains `RequestInit` options that may be available on the current runtime,
|
|
62
|
+
* including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
|
|
63
|
+
*/
|
|
64
|
+
export type MergedRequestInit = {
|
|
65
|
+
[K in MappedLiteralKeys<RequestInits>]?: MappedIndex<RequestInits, K> | undefined;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/internal/types.ts"],"names":[],"m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MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE7B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;KAC7B,CAAC,IAAI,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,GAAG,SAAS;CAClF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
export type PromiseOrValue<T> = T | Promise<T>;
|
|
3
|
+
export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
4
|
+
export type KeysEnum<T> = {
|
|
5
|
+
[P in keyof Required<T>]: true;
|
|
6
|
+
};
|
|
7
|
+
type NotAny<T> = [unknown] extends [T] ? never : T;
|
|
8
|
+
type Literal<T> = PropertyKey extends T ? never : T;
|
|
9
|
+
type MappedLiteralKeys<T> = T extends any ? Literal<keyof T> : never;
|
|
10
|
+
type MappedIndex<T, K> = T extends any ? K extends keyof T ? T[K] : never : never;
|
|
11
|
+
/**
|
|
12
|
+
* Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
|
|
13
|
+
*/
|
|
14
|
+
type OverloadedParameters<T> = T extends ({
|
|
15
|
+
(...args: infer A): unknown;
|
|
16
|
+
(...args: infer B): unknown;
|
|
17
|
+
(...args: infer C): unknown;
|
|
18
|
+
(...args: infer D): unknown;
|
|
19
|
+
}) ? A | B | C | D : T extends ({
|
|
20
|
+
(...args: infer A): unknown;
|
|
21
|
+
(...args: infer B): unknown;
|
|
22
|
+
(...args: infer C): unknown;
|
|
23
|
+
}) ? A | B | C : T extends ({
|
|
24
|
+
(...args: infer A): unknown;
|
|
25
|
+
(...args: infer B): unknown;
|
|
26
|
+
}) ? A | B : T extends (...args: infer A) => unknown ? A : never;
|
|
27
|
+
/**
|
|
28
|
+
* These imports attempt to get types from a parent package's dependencies.
|
|
29
|
+
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
30
|
+
* would cause typescript to show types not present at runtime. To avoid this, we import
|
|
31
|
+
* directly from parent node_modules folders.
|
|
32
|
+
*
|
|
33
|
+
* We need to check multiple levels because we don't know what directory structure we'll be in.
|
|
34
|
+
* For example, pnpm generates directories like this:
|
|
35
|
+
* ```
|
|
36
|
+
* node_modules
|
|
37
|
+
* ├── .pnpm
|
|
38
|
+
* │ └── pkg@1.0.0
|
|
39
|
+
* │ └── node_modules
|
|
40
|
+
* │ └── pkg
|
|
41
|
+
* │ └── internal
|
|
42
|
+
* │ └── types.d.ts
|
|
43
|
+
* ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
|
|
44
|
+
* └── undici
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
48
|
+
*/
|
|
49
|
+
/** @ts-ignore For users with \@types/node */
|
|
50
|
+
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types').RequestInit> | NotAny<import('../../node_modules/undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types').RequestInit>;
|
|
51
|
+
/** @ts-ignore For users with undici */
|
|
52
|
+
type UndiciRequestInit = NotAny<import('../node_modules/undici').RequestInit> | NotAny<import('../../node_modules/undici').RequestInit> | NotAny<import('../../../node_modules/undici').RequestInit> | NotAny<import('../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici').RequestInit>;
|
|
53
|
+
/** @ts-ignore For users with \@types/bun */
|
|
54
|
+
type BunRequestInit = globalThis.FetchRequestInit;
|
|
55
|
+
/** @ts-ignore For users with node-fetch */
|
|
56
|
+
type NodeFetchRequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
57
|
+
/** @ts-ignore For users who use Deno */
|
|
58
|
+
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
59
|
+
type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetchRequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
|
|
60
|
+
/**
|
|
61
|
+
* This type contains `RequestInit` options that may be available on the current runtime,
|
|
62
|
+
* including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
|
|
63
|
+
*/
|
|
64
|
+
export type MergedRequestInit = {
|
|
65
|
+
[K in MappedLiteralKeys<RequestInits>]?: MappedIndex<RequestInits, K> | undefined;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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,O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AAM,iBAAiB,GAAG;KAC7B,CAAC,IAAI,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,GAAG,SAAS;CAClF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/internal/types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/internal/types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|