@evomap/evolver-adapter-public 2.0.0-beta.18 → 2.0.0-beta.19
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/auth/credentialStore.d.ts +87 -3
- package/dist/auth/credentialStore.js +1008 -10
- package/dist/auth/oauthDeviceToken.d.ts +9 -6
- package/dist/auth/oauthDeviceToken.js +71 -18
- package/dist/auth/oauthHttpTransport.d.ts +4 -0
- package/dist/auth/oauthHttpTransport.js +66 -15
- package/dist/hubCapability.d.ts +9 -3
- package/dist/hubCapability.js +139 -28
- package/dist/hubFetch.d.ts +43 -10
- package/dist/hubFetch.js +311 -76
- package/dist/hubReuse.d.ts +40 -0
- package/dist/hubReuse.js +312 -32
- package/dist/learningPacketFeedback.js +2 -1
- package/dist/learningPacketSink.js +1 -0
- package/dist/wireMap.d.ts +3 -1
- package/dist/wireMap.js +20 -1
- package/package.json +5 -2
package/dist/hubFetch.d.ts
CHANGED
|
@@ -9,21 +9,35 @@ export interface HubFetchResponse {
|
|
|
9
9
|
json: () => Promise<unknown>;
|
|
10
10
|
text: () => Promise<string>;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export interface HubFetchInit {
|
|
13
13
|
method: string;
|
|
14
14
|
headers: Record<string, string>;
|
|
15
15
|
body?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
json: () => Promise<unknown>;
|
|
21
|
-
text: () => Promise<string>;
|
|
22
|
-
}>;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
redirect?: 'manual';
|
|
18
|
+
}
|
|
19
|
+
export type FetchLike = (url: string, init: HubFetchInit) => Promise<HubFetchResponse>;
|
|
23
20
|
export declare const HUB_ERROR_TEXT_MAX_BYTES: number;
|
|
24
21
|
export declare const HUB_JSON_TEXT_MAX_BYTES: number;
|
|
25
22
|
export declare const HUB_UNREACHABLE_BACKOFF_BASE_MS = 60000;
|
|
26
23
|
export declare const HUB_UNREACHABLE_BACKOFF_MAX_MS: number;
|
|
24
|
+
export declare const HUB_GENERAL_TIMEOUT_MS = 15000;
|
|
25
|
+
export declare const HUB_SEARCH_TIMEOUT_MS = 8000;
|
|
26
|
+
export declare const HUB_HEARTBEAT_TIMEOUT_MS = 10000;
|
|
27
|
+
export declare const HUB_EVENT_POLL_TIMEOUT_MS = 60000;
|
|
28
|
+
export declare const HUB_HELLO_TIMEOUT_MS = 15000;
|
|
29
|
+
export interface HubOperationTimeouts {
|
|
30
|
+
generalMs: number;
|
|
31
|
+
searchMs: number;
|
|
32
|
+
heartbeatMs: number;
|
|
33
|
+
pollMs: number;
|
|
34
|
+
helloMs: number;
|
|
35
|
+
}
|
|
36
|
+
export type HubOperation = 'general' | 'search' | 'heartbeat' | 'poll' | 'hello';
|
|
37
|
+
export interface HubDeadlineScheduler {
|
|
38
|
+
set(callback: () => void, delayMs: number): unknown;
|
|
39
|
+
clear(handle: unknown): void;
|
|
40
|
+
}
|
|
27
41
|
export declare class AuthError extends Error {
|
|
28
42
|
readonly status: number;
|
|
29
43
|
readonly body?: unknown | undefined;
|
|
@@ -33,7 +47,8 @@ export declare class AuthError extends Error {
|
|
|
33
47
|
export declare class HubClientError extends Error {
|
|
34
48
|
readonly status: number;
|
|
35
49
|
readonly body: unknown;
|
|
36
|
-
|
|
50
|
+
readonly retryAfterMs?: number | undefined;
|
|
51
|
+
constructor(status: number, body: unknown, retryAfterMs?: number | undefined);
|
|
37
52
|
}
|
|
38
53
|
export declare class HubUnreachableError extends Error {
|
|
39
54
|
readonly details: {
|
|
@@ -42,6 +57,8 @@ export declare class HubUnreachableError extends Error {
|
|
|
42
57
|
bodySnippet?: string;
|
|
43
58
|
context?: string;
|
|
44
59
|
retryAfterMs?: number;
|
|
60
|
+
operation?: HubOperation;
|
|
61
|
+
timeoutMs?: number;
|
|
45
62
|
};
|
|
46
63
|
readonly code = "HUB_UNREACHABLE";
|
|
47
64
|
constructor(message: string, details?: {
|
|
@@ -50,6 +67,8 @@ export declare class HubUnreachableError extends Error {
|
|
|
50
67
|
bodySnippet?: string;
|
|
51
68
|
context?: string;
|
|
52
69
|
retryAfterMs?: number;
|
|
70
|
+
operation?: HubOperation;
|
|
71
|
+
timeoutMs?: number;
|
|
53
72
|
});
|
|
54
73
|
get retryAfterMs(): number;
|
|
55
74
|
}
|
|
@@ -58,6 +77,11 @@ export interface HubFetchDeps {
|
|
|
58
77
|
auth: hub.AuthProvider;
|
|
59
78
|
fetchFn: FetchLike;
|
|
60
79
|
senderId: () => string | undefined;
|
|
80
|
+
now?: () => number;
|
|
81
|
+
env?: Record<string, string | undefined>;
|
|
82
|
+
operationTimeouts?: Partial<HubOperationTimeouts>;
|
|
83
|
+
authTimeoutMs?: number;
|
|
84
|
+
deadlineScheduler?: HubDeadlineScheduler;
|
|
61
85
|
}
|
|
62
86
|
/**
|
|
63
87
|
* 公版 hub HTTP 客户端(M6-6). 每请求经 AuthProvider 取凭证: POST 通常注入 body; GET 与 strict hello envelope
|
|
@@ -68,20 +92,27 @@ export interface HubFetchDeps {
|
|
|
68
92
|
*/
|
|
69
93
|
export declare class HubFetch {
|
|
70
94
|
private readonly deps;
|
|
95
|
+
private readonly operationTimeouts;
|
|
96
|
+
private readonly deadlineScheduler;
|
|
71
97
|
constructor(deps: HubFetchDeps);
|
|
72
98
|
call<T>(method: string, path: string, bodyObj?: Record<string, unknown>, query?: Record<string, string | number | undefined>, requestHeaders?: Readonly<Record<string, string>>): Promise<T>;
|
|
73
99
|
}
|
|
100
|
+
export declare function resolveHubOperationTimeouts(env?: Record<string, string | undefined>, overrides?: Partial<HubOperationTimeouts>): HubOperationTimeouts;
|
|
74
101
|
export declare function hubResponseContentType(res: Pick<HubFetchResponse, 'headers'> | undefined): string;
|
|
75
102
|
export declare function isHubApiResponse(res: Pick<HubFetchResponse, 'headers'> | undefined): boolean;
|
|
76
103
|
export declare function hubUnreachableBackoffMs(failureCount: number): number;
|
|
77
104
|
export declare function isHubUnreachableError(err: unknown): boolean;
|
|
78
105
|
export declare function isHubUnreachableResponse(res: Pick<HubFetchResponse, 'headers'> | undefined): boolean;
|
|
79
|
-
export declare function drainHubResponse(res: Pick<HubFetchResponse, 'body'> | undefined
|
|
106
|
+
export declare function drainHubResponse(res: Pick<HubFetchResponse, 'body'> | undefined, opts?: {
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
}): Promise<void>;
|
|
80
109
|
export declare function readHubResponseText(res: Pick<HubFetchResponse, 'body' | 'text'>, opts?: {
|
|
81
110
|
maxBytes?: number;
|
|
111
|
+
signal?: AbortSignal;
|
|
82
112
|
}): Promise<string>;
|
|
83
113
|
export declare function readHubResponseJson(res: Pick<HubFetchResponse, 'body' | 'text'>, opts?: {
|
|
84
114
|
maxBytes?: number;
|
|
115
|
+
signal?: AbortSignal;
|
|
85
116
|
}): Promise<unknown>;
|
|
86
117
|
export declare function throwIfHubUnreachableResponse(res: HubFetchResponse, context?: string): Promise<void>;
|
|
87
118
|
/** https-only scheme guard: throws on invalid URL or non-https (unless the escape hatch is set). Called at both request and transport layers (defense in depth). */
|
|
@@ -89,6 +120,7 @@ export declare function assertHubUrlSecure(url: string, env?: Record<string, str
|
|
|
89
120
|
export type HubIpFamilyPolicy = 'ipv4first' | 'ipv4only' | 'auto';
|
|
90
121
|
export declare const HUB_CONNECT_TIMEOUT_MS = 10000;
|
|
91
122
|
export declare const HUB_IPV4FIRST_PRIMARY_CONNECT_TIMEOUT_MS = 2500;
|
|
123
|
+
export declare const HUB_TCP_KEEPALIVE_IDLE_MS = 15000;
|
|
92
124
|
interface HubConnectOptions {
|
|
93
125
|
rejectUnauthorized: true;
|
|
94
126
|
timeout: number;
|
|
@@ -107,6 +139,7 @@ export interface HubFetchTransportConfig {
|
|
|
107
139
|
export declare function resolveHubIpFamily(env?: Record<string, string | undefined>): HubIpFamilyPolicy;
|
|
108
140
|
export declare function _getHubFetchConfigForTest(env?: Record<string, string | undefined>): HubFetchTransportConfig;
|
|
109
141
|
export declare function _shouldFallbackFromIpv4ForTest(err: unknown, hubIpFamily?: HubIpFamilyPolicy): boolean;
|
|
142
|
+
export declare function _configureHubSocketForTest(socket: unknown): void;
|
|
110
143
|
type RawFetch = (url: string, init: Record<string, unknown>) => Promise<HubFetchResponse>;
|
|
111
144
|
export declare function _setFetchImplForTest(fn?: RawFetch): void;
|
|
112
145
|
/** Test seam: reset the one-time insecure-warning latch. */
|