@xsai/shared 0.1.2 → 0.1.3
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/dist/index.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ declare class XSAIError extends Error {
|
|
|
3
3
|
constructor(message: string, response?: Response);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
type Fetch = (input: URL, init: RequestInit) => Promise<Response>;
|
|
7
|
+
|
|
6
8
|
interface CommonRequestOptions {
|
|
7
9
|
abortSignal?: AbortSignal;
|
|
8
10
|
apiKey?: string;
|
|
9
11
|
/** @example `https://api.openai.com/v1/` */
|
|
10
12
|
baseURL: string | URL;
|
|
11
|
-
fetch?: typeof globalThis.fetch;
|
|
13
|
+
fetch?: Fetch | typeof globalThis.fetch;
|
|
12
14
|
/** @default `undefined` */
|
|
13
15
|
headers?: Headers | Record<string, string>;
|
|
14
16
|
/** @example `gpt-4o` */
|
|
@@ -48,4 +50,4 @@ declare const responseCatch: (res: Response) => Promise<Response>;
|
|
|
48
50
|
|
|
49
51
|
declare const responseJSON: <T>(res: Response) => Promise<T>;
|
|
50
52
|
|
|
51
|
-
export { type CommonRequestOptions, XSAIError, clean, objCamelToSnake, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake };
|
|
53
|
+
export { type CommonRequestOptions, type Fetch, XSAIError, clean, objCamelToSnake, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake };
|