mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-27 21:43:35 +00:00
refactor(infra): hide utility option types
This commit is contained in:
@@ -17,12 +17,12 @@ export function resolveTimezone(value: string): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
export type FormatTimestampOptions = {
|
||||
type FormatTimestampOptions = {
|
||||
/** Include seconds in the output. Default: false */
|
||||
displaySeconds?: boolean;
|
||||
};
|
||||
|
||||
export type FormatZonedTimestampOptions = FormatTimestampOptions & {
|
||||
type FormatZonedTimestampOptions = FormatTimestampOptions & {
|
||||
/** IANA timezone string (e.g., 'America/New_York'). Default: system timezone */
|
||||
timeZone?: string;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* - `formatRelativeTimestamp(epochMs)` — format an epoch timestamp relative to now (handles future)
|
||||
*/
|
||||
|
||||
export type FormatTimeAgoOptions = {
|
||||
type FormatTimeAgoOptions = {
|
||||
/** Append "ago" suffix. Default: true. When false, returns bare unit: "5m", "2h" */
|
||||
suffix?: boolean;
|
||||
/** Return value for invalid/null/negative input. Default: "unknown" */
|
||||
@@ -51,7 +51,7 @@ export function formatTimeAgo(
|
||||
return suffix ? `${days}d ago` : `${days}d`;
|
||||
}
|
||||
|
||||
export type FormatRelativeTimestampOptions = {
|
||||
type FormatRelativeTimestampOptions = {
|
||||
/** If true, fall back to short date (e.g. "Oct 5") for timestamps >7 days. Default: false */
|
||||
dateFallback?: boolean;
|
||||
/** IANA timezone for date fallback display */
|
||||
|
||||
@@ -108,7 +108,7 @@ type GuardedFetchInternalOptions = GuardedFetchOptions & {
|
||||
useEnvProxyForEligibleUrls?: boolean;
|
||||
};
|
||||
|
||||
export type GuardedFetchConfiguredLocalOriginOptions = GuardedFetchOptions & {
|
||||
type GuardedFetchConfiguredLocalOriginOptions = GuardedFetchOptions & {
|
||||
configuredLocalOriginBaseUrl: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { ManagedProxyTlsOptions } from "./proxy-tls.js";
|
||||
export type ActiveManagedProxyUrl = Readonly<URL>;
|
||||
|
||||
/** Managed proxy loopback behavior shared by gateway and child-process fetch paths. */
|
||||
export type ActiveManagedProxyLoopbackMode = NonNullable<NonNullable<ProxyConfig>["loopbackMode"]>;
|
||||
type ActiveManagedProxyLoopbackMode = NonNullable<NonNullable<ProxyConfig>["loopbackMode"]>;
|
||||
|
||||
/** Ref-counted active proxy handle; callers must stop it when their proxy scope ends. */
|
||||
export type ActiveManagedProxyRegistration = {
|
||||
@@ -17,7 +17,7 @@ export type ActiveManagedProxyRegistration = {
|
||||
};
|
||||
|
||||
/** Registration metadata for managed proxy URLs and their TLS trust material. */
|
||||
export type RegisterActiveManagedProxyOptions = {
|
||||
type RegisterActiveManagedProxyOptions = {
|
||||
loopbackMode?: ActiveManagedProxyLoopbackMode;
|
||||
proxyTls?: ManagedProxyTlsOptions;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
type ManagedProxyTlsOptions,
|
||||
} from "./proxy-tls.js";
|
||||
|
||||
export type ManagedEnvHttpProxyAgentOptions = ConstructorParameters<typeof EnvHttpProxyAgent>[0];
|
||||
type ManagedEnvHttpProxyAgentOptions = ConstructorParameters<typeof EnvHttpProxyAgent>[0];
|
||||
|
||||
function readProxyTlsRecord(options: object | undefined): Record<string, unknown> | undefined {
|
||||
if (!options || !("proxyTls" in options)) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@openclaw/proxyline";
|
||||
import type { ProxyConfig } from "../../../config/zod-schema.proxy.js";
|
||||
|
||||
export type ProxyLoopbackMode = NonNullable<NonNullable<ProxyConfig>["loopbackMode"]>;
|
||||
type ProxyLoopbackMode = NonNullable<NonNullable<ProxyConfig>["loopbackMode"]>;
|
||||
import { isLoopbackIpAddress } from "@openclaw/net-policy/ip";
|
||||
import { logInfo, logWarn } from "../../../logger.js";
|
||||
import { forceResetGlobalDispatcher } from "../undici-global-dispatcher.js";
|
||||
|
||||
Reference in New Issue
Block a user