fix(client): Fix CI configuration, prevent socket hangs with auto-drain, and apply various client/core TypeScript fixes and test updates
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Core base exports - abstract classes and platform-agnostic types
|
||||
export * from './types.js';
|
||||
export * from './request.js';
|
||||
export * from './response.js';
|
||||
export * from './response.js';
|
||||
|
@@ -3,7 +3,10 @@ import * as types from './types.js';
|
||||
/**
|
||||
* Abstract Core Request class that defines the interface for all HTTP/HTTPS requests
|
||||
*/
|
||||
export abstract class CoreRequest<TOptions extends types.ICoreRequestOptions = types.ICoreRequestOptions, TResponse = any> {
|
||||
export abstract class CoreRequest<
|
||||
TOptions extends types.ICoreRequestOptions = types.ICoreRequestOptions,
|
||||
TResponse = any,
|
||||
> {
|
||||
/**
|
||||
* Tests if a URL is a unix socket
|
||||
*/
|
||||
@@ -41,5 +44,4 @@ export abstract class CoreRequest<TOptions extends types.ICoreRequestOptions = t
|
||||
* Fire the request and return the raw response (platform-specific)
|
||||
*/
|
||||
abstract fireCore(): Promise<any>;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -37,9 +37,9 @@ export abstract class CoreResponse<T = any> implements types.ICoreResponse<T> {
|
||||
* Get response as ArrayBuffer
|
||||
*/
|
||||
abstract arrayBuffer(): Promise<ArrayBuffer>;
|
||||
|
||||
|
||||
/**
|
||||
* Get response as a web-style ReadableStream
|
||||
*/
|
||||
abstract stream(): ReadableStream<Uint8Array> | null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,14 @@
|
||||
/**
|
||||
* HTTP Methods supported
|
||||
*/
|
||||
export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
||||
export type THttpMethod =
|
||||
| 'GET'
|
||||
| 'POST'
|
||||
| 'PUT'
|
||||
| 'DELETE'
|
||||
| 'PATCH'
|
||||
| 'HEAD'
|
||||
| 'OPTIONS';
|
||||
|
||||
/**
|
||||
* Response types supported
|
||||
@@ -39,14 +46,14 @@ export interface ICoreRequestOptions {
|
||||
timeout?: number;
|
||||
hardDataCuttingTimeout?: number;
|
||||
autoDrain?: boolean; // Auto-drain unconsumed responses (Node.js only, default: true)
|
||||
|
||||
|
||||
// Node.js specific options (ignored in fetch implementation)
|
||||
agent?: any;
|
||||
socketPath?: string;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
path?: string;
|
||||
|
||||
|
||||
// Fetch API specific options (ignored in Node.js implementation)
|
||||
credentials?: RequestCredentials;
|
||||
mode?: RequestMode;
|
||||
@@ -73,10 +80,10 @@ export interface ICoreResponse<T = any> {
|
||||
statusText: string;
|
||||
headers: Headers;
|
||||
url: string;
|
||||
|
||||
|
||||
// Methods
|
||||
json(): Promise<T>;
|
||||
text(): Promise<string>;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
stream(): ReadableStream<Uint8Array> | null; // Always returns web-style stream
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user