@easbot/utils 0.2.22 → 0.2.24

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.cts CHANGED
@@ -716,6 +716,43 @@ interface RetryOptions {
716
716
  }
717
717
  declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
718
718
 
719
+ type ResponseType = 'json' | 'text' | 'arrayBuffer' | 'blob' | 'buffer';
720
+ interface RequestOptions extends RequestInit {
721
+ timeout?: number;
722
+ retries?: number;
723
+ retryDelay?: number;
724
+ responseType?: ResponseType;
725
+ signal?: AbortSignal;
726
+ }
727
+ interface FetchResponse<T = any> {
728
+ ok: boolean;
729
+ status: number;
730
+ statusText: string;
731
+ headers: Headers;
732
+ data: T;
733
+ url: string;
734
+ }
735
+ interface ProxyOptions {
736
+ connectTimeout?: number;
737
+ keepAliveTimeout?: number;
738
+ httpProxy?: string;
739
+ httpsProxy?: string;
740
+ }
741
+ declare namespace Fetch {
742
+ function hasProxyConfigured(): boolean;
743
+ function getProxyUrl(): string | undefined;
744
+ function enableProxy(options?: ProxyOptions): void;
745
+ function disableProxy(): void;
746
+ function isProxyEnabled(): boolean;
747
+ function get<T = any>(url: string | URL, options?: RequestOptions): Promise<FetchResponse<T>>;
748
+ function post<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
749
+ function put<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
750
+ function del<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
751
+ function patch<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
752
+ function request<T = any>(url: string | URL, options?: RequestOptions): Promise<FetchResponse<T>>;
753
+ function autoProxy(options?: ProxyOptions): boolean;
754
+ }
755
+
719
756
  declare namespace Slug {
720
757
  function create(): string;
721
758
  }
@@ -1244,4 +1281,4 @@ declare function initLog(options: {
1244
1281
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1245
1282
  }): Promise<void>;
1246
1283
 
1247
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1284
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
package/dist/index.d.ts CHANGED
@@ -716,6 +716,43 @@ interface RetryOptions {
716
716
  }
717
717
  declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
718
718
 
719
+ type ResponseType = 'json' | 'text' | 'arrayBuffer' | 'blob' | 'buffer';
720
+ interface RequestOptions extends RequestInit {
721
+ timeout?: number;
722
+ retries?: number;
723
+ retryDelay?: number;
724
+ responseType?: ResponseType;
725
+ signal?: AbortSignal;
726
+ }
727
+ interface FetchResponse<T = any> {
728
+ ok: boolean;
729
+ status: number;
730
+ statusText: string;
731
+ headers: Headers;
732
+ data: T;
733
+ url: string;
734
+ }
735
+ interface ProxyOptions {
736
+ connectTimeout?: number;
737
+ keepAliveTimeout?: number;
738
+ httpProxy?: string;
739
+ httpsProxy?: string;
740
+ }
741
+ declare namespace Fetch {
742
+ function hasProxyConfigured(): boolean;
743
+ function getProxyUrl(): string | undefined;
744
+ function enableProxy(options?: ProxyOptions): void;
745
+ function disableProxy(): void;
746
+ function isProxyEnabled(): boolean;
747
+ function get<T = any>(url: string | URL, options?: RequestOptions): Promise<FetchResponse<T>>;
748
+ function post<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
749
+ function put<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
750
+ function del<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
751
+ function patch<T = any>(url: string | URL, body?: any, options?: RequestOptions): Promise<FetchResponse<T>>;
752
+ function request<T = any>(url: string | URL, options?: RequestOptions): Promise<FetchResponse<T>>;
753
+ function autoProxy(options?: ProxyOptions): boolean;
754
+ }
755
+
719
756
  declare namespace Slug {
720
757
  function create(): string;
721
758
  }
@@ -1244,4 +1281,4 @@ declare function initLog(options: {
1244
1281
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1245
1282
  }): Promise<void>;
1246
1283
 
1247
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1284
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };