@roarkanalytics/sdk 0.1.0-alpha.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 +25 -0
- package/LICENSE +201 -0
- package/README.md +344 -0
- 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 +186 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +186 -0
- package/client.d.ts.map +1 -0
- package/client.js +449 -0
- package/client.js.map +1 -0
- package/client.mjs +422 -0
- package/client.mjs.map +1 -0
- package/error.d.mts +47 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -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 +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/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/internal/utils.js +24 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +119 -0
- package/resource.d.mts +6 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/calls.d.mts +85 -0
- package/resources/calls.d.mts.map +1 -0
- package/resources/calls.d.ts +85 -0
- package/resources/calls.d.ts.map +1 -0
- package/resources/calls.js +15 -0
- package/resources/calls.js.map +1 -0
- package/resources/calls.mjs +11 -0
- package/resources/calls.mjs.map +1 -0
- package/resources/index.d.mts +2 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +7 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -0
- package/src/api-promise.ts +92 -0
- package/src/client.ts +646 -0
- package/src/error.ts +130 -0
- package/src/index.ts +22 -0
- 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/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/calls.ts +118 -0
- package/src/resources/index.ts +3 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +1 -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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import type { FinalRequestOptions } from "./request-options.js";
|
|
3
|
+
import { type Petstore } from "../client.js";
|
|
4
|
+
export type APIResponseProps = {
|
|
5
|
+
response: Response;
|
|
6
|
+
options: FinalRequestOptions;
|
|
7
|
+
controller: AbortController;
|
|
8
|
+
};
|
|
9
|
+
export declare function defaultParseResponse<T>(client: Petstore, props: APIResponseProps): Promise<T>;
|
|
10
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":";OAEO,KAAK,EAAE,mBAAmB,EAAE;OAC5B,EAAE,KAAK,QAAQ,EAAE;AAGxB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CA4BnG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.defaultParseResponse = void 0;
|
|
5
|
+
const log_1 = require("./utils/log.js");
|
|
6
|
+
async function defaultParseResponse(client, props) {
|
|
7
|
+
const { response } = props;
|
|
8
|
+
// fetch refuses to read the body when the status code is 204.
|
|
9
|
+
if (response.status === 204) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (props.options.__binaryResponse) {
|
|
13
|
+
return response;
|
|
14
|
+
}
|
|
15
|
+
const contentType = response.headers.get('content-type');
|
|
16
|
+
const isJSON = contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
|
|
17
|
+
if (isJSON) {
|
|
18
|
+
const json = await response.json();
|
|
19
|
+
(0, log_1.logger)(client).debug('response', response.status, response.url, response.headers, json);
|
|
20
|
+
return json;
|
|
21
|
+
}
|
|
22
|
+
const text = await response.text();
|
|
23
|
+
(0, log_1.logger)(client).debug('response', response.status, response.url, response.headers, text);
|
|
24
|
+
// TODO handle blob, arraybuffer, other content types, etc.
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
exports.defaultParseResponse =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 +1,24 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { logger } from "./utils/log.mjs";
|
|
3
|
+
export async function defaultParseResponse(client, props) {
|
|
4
|
+
const { response } = props;
|
|
5
|
+
// fetch refuses to read the body when the status code is 204.
|
|
6
|
+
if (response.status === 204) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (props.options.__binaryResponse) {
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
const contentType = response.headers.get('content-type');
|
|
13
|
+
const isJSON = contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
|
|
14
|
+
if (isJSON) {
|
|
15
|
+
const json = await response.json();
|
|
16
|
+
logger(client).debug('response', response.status, response.url, response.headers, json);
|
|
17
|
+
return json;
|
|
18
|
+
}
|
|
19
|
+
const text = await response.text();
|
|
20
|
+
logger(client).debug('response', response.status, response.url, response.headers, text);
|
|
21
|
+
// TODO handle blob, arraybuffer, other content types, etc.
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=parse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.mjs","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAI/E,EAAE,MAAM,EAAE;AAQjB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAI,MAAgB,EAAE,KAAuB;IACrF,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,8DAA8D;IAC9D,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;QAC3B,OAAO,IAAS,CAAC;KAClB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAClC,OAAO,QAAwB,CAAC;KACjC;IAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACzD,MAAM,MAAM,GACV,WAAW,EAAE,QAAQ,CAAC,kBAAkB,CAAC,IAAI,WAAW,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IACjG,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEnC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAExF,OAAO,IAAS,CAAC;KAClB;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAExF,2DAA2D;IAC3D,OAAO,IAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const crypto: {
|
|
2
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
|
|
3
|
+
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
|
|
4
|
+
/**
|
|
5
|
+
* Available only in secure contexts.
|
|
6
|
+
*
|
|
7
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
|
|
8
|
+
*/
|
|
9
|
+
randomUUID?: () => string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
if (typeof require !== 'undefined') {
|
|
2
|
+
if (globalThis.crypto) {
|
|
3
|
+
exports.crypto = globalThis.crypto;
|
|
4
|
+
} else {
|
|
5
|
+
try {
|
|
6
|
+
// Use [require][0](...) and not require(...) so bundlers don't try to bundle the
|
|
7
|
+
// crypto module.
|
|
8
|
+
exports.crypto = [require][0]('node:crypto').webcrypto;
|
|
9
|
+
} catch (e) {}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file polyfills the global `File` object for you if it's not already defined
|
|
3
|
+
* when running on Node.js
|
|
4
|
+
*
|
|
5
|
+
* This is only needed on Node.js v18 & v19. Newer versions already define `File`
|
|
6
|
+
* as a global.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
if (typeof require !== 'undefined') {
|
|
10
|
+
if (!globalThis.File) {
|
|
11
|
+
try {
|
|
12
|
+
// Use [require][0](...) and not require(...) so bundlers don't try to bundle the
|
|
13
|
+
// buffer module.
|
|
14
|
+
globalThis.File = [require][0]('node:buffer').File;
|
|
15
|
+
} catch (e) {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { NullableHeaders } from "./headers.mjs";
|
|
3
|
+
import type { BodyInit } from "./builtin-types.mjs";
|
|
4
|
+
import type { HTTPMethod, MergedRequestInit } from "./types.mjs";
|
|
5
|
+
import { type HeadersLike } from "./headers.mjs";
|
|
6
|
+
export type FinalRequestOptions = RequestOptions & {
|
|
7
|
+
method: HTTPMethod;
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
export type RequestOptions = {
|
|
11
|
+
method?: HTTPMethod;
|
|
12
|
+
path?: string;
|
|
13
|
+
query?: object | undefined | null;
|
|
14
|
+
body?: unknown;
|
|
15
|
+
headers?: HeadersLike;
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
stream?: boolean | undefined;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
fetchOptions?: MergedRequestInit;
|
|
20
|
+
signal?: AbortSignal | undefined | null;
|
|
21
|
+
idempotencyKey?: string;
|
|
22
|
+
__binaryResponse?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const isRequestOptions: (obj: unknown) => obj is RequestOptions;
|
|
25
|
+
export type EncodedContent = {
|
|
26
|
+
bodyHeaders: HeadersLike;
|
|
27
|
+
body: BodyInit;
|
|
28
|
+
};
|
|
29
|
+
export type RequestEncoder = (request: {
|
|
30
|
+
headers: NullableHeaders;
|
|
31
|
+
body: unknown;
|
|
32
|
+
}) => EncodedContent;
|
|
33
|
+
export declare const FallbackEncoder: RequestEncoder;
|
|
34
|
+
//# 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;OAEjB,KAAK,EAAE,UAAU,EAAY,iBAAiB,EAAE;OAChD,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,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAsBF,eAAO,MAAM,gBAAgB,QAAS,OAAO,0BAO5C,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,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { NullableHeaders } from "./headers.js";
|
|
3
|
+
import type { BodyInit } from "./builtin-types.js";
|
|
4
|
+
import type { HTTPMethod, MergedRequestInit } from "./types.js";
|
|
5
|
+
import { type HeadersLike } from "./headers.js";
|
|
6
|
+
export type FinalRequestOptions = RequestOptions & {
|
|
7
|
+
method: HTTPMethod;
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
export type RequestOptions = {
|
|
11
|
+
method?: HTTPMethod;
|
|
12
|
+
path?: string;
|
|
13
|
+
query?: object | undefined | null;
|
|
14
|
+
body?: unknown;
|
|
15
|
+
headers?: HeadersLike;
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
stream?: boolean | undefined;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
fetchOptions?: MergedRequestInit;
|
|
20
|
+
signal?: AbortSignal | undefined | null;
|
|
21
|
+
idempotencyKey?: string;
|
|
22
|
+
__binaryResponse?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const isRequestOptions: (obj: unknown) => obj is RequestOptions;
|
|
25
|
+
export type EncodedContent = {
|
|
26
|
+
bodyHeaders: HeadersLike;
|
|
27
|
+
body: BodyInit;
|
|
28
|
+
};
|
|
29
|
+
export type RequestEncoder = (request: {
|
|
30
|
+
headers: NullableHeaders;
|
|
31
|
+
body: unknown;
|
|
32
|
+
}) => EncodedContent;
|
|
33
|
+
export declare const FallbackEncoder: RequestEncoder;
|
|
34
|
+
//# sourceMappingURL=request-options.d.ts.map
|
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B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.FallbackEncoder = exports.isRequestOptions = void 0;
|
|
5
|
+
const values_1 = require("./utils/values.js");
|
|
6
|
+
// This is required so that we can determine if a given object matches the RequestOptions
|
|
7
|
+
// type at runtime. While this requires duplication, it is enforced by the TypeScript
|
|
8
|
+
// compiler such that any missing / extraneous keys will cause an error.
|
|
9
|
+
const requestOptionsKeys = {
|
|
10
|
+
method: true,
|
|
11
|
+
path: true,
|
|
12
|
+
query: true,
|
|
13
|
+
body: true,
|
|
14
|
+
headers: true,
|
|
15
|
+
maxRetries: true,
|
|
16
|
+
stream: true,
|
|
17
|
+
timeout: true,
|
|
18
|
+
fetchOptions: true,
|
|
19
|
+
signal: true,
|
|
20
|
+
idempotencyKey: true,
|
|
21
|
+
__binaryResponse: true,
|
|
22
|
+
};
|
|
23
|
+
const isRequestOptions = (obj) => {
|
|
24
|
+
return (typeof obj === 'object' &&
|
|
25
|
+
obj !== null &&
|
|
26
|
+
!(0, values_1.isEmptyObj)(obj) &&
|
|
27
|
+
Object.keys(obj).every((k) => (0, values_1.hasOwn)(requestOptionsKeys, k)));
|
|
28
|
+
};
|
|
29
|
+
exports.isRequestOptions = isRequestOptions;
|
|
30
|
+
const FallbackEncoder = ({ headers, body }) => {
|
|
31
|
+
return {
|
|
32
|
+
bodyHeaders: {
|
|
33
|
+
'content-type': 'application/json',
|
|
34
|
+
},
|
|
35
|
+
body: JSON.stringify(body),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.FallbackEncoder = FallbackEncoder;
|
|
39
|
+
//# 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;;;AAKtF,8CAAoD;AAsBpD,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;AAEK,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAyB,EAAE;IACtE,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,CAAC,IAAA,mBAAU,EAAC,GAAG,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,eAAM,EAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAKK,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,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;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,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 Petstore({ 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,qJAAqJ,CACtJ,CAAC;AACJ,CAAC;AARD,0CAQC;AAwBD;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,qEA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