@openclaw/slack 2026.7.2-beta.2 → 2026.7.2-beta.4
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/{account-configured-DzC407uv.js → account-configured-BwfXBo_F.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{account-inspect-Di7ditqZ.js → account-inspect-jn1xLaVi.js} +9 -2
- package/dist/account-reply-mode-DrUXogvO.js +14 -0
- package/dist/{accounts-BOJJiHSr.js → accounts-BSr252c_.js} +13 -25
- package/dist/accounts.runtime-CjULMLTa.js +2 -0
- package/dist/{action-runtime-Cee2ih0s.js → action-runtime-CFU52n4W.js} +11 -17
- package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
- package/dist/{actions-BZiuSTIq.js → actions-D51foiwR.js} +5 -5
- package/dist/{actions.runtime-DoD0-gxw.js → actions.runtime-BMJwtf5C.js} +1 -1
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-CUPtIM4k.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
- package/dist/{channel-DaIiGUOp.js → channel-Ds8NKvfr.js} +75 -41
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-Cfm6_6n1.js → channel-type-DXkUajFP.js} +3 -3
- package/dist/{channel.setup-C-mLz50O.js → channel.setup-DOSTEDfA.js} +8 -5
- package/dist/{config-schema-xPSnK2VK.js → config-schema-B4j4tCOI.js} +236 -30
- package/dist/{directory-config-DRkFujwG.js → directory-config-B08pm5ZT.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-D_yZhjgp.js → directory-live-DpPKzPrn.js} +2 -2
- package/dist/doctor-contract-U6oVntbM.js +173 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-85UWiriS.js → group-policy-CdnQzQBI.js} +98 -125
- package/dist/{interactive-replies-BilWUdcI.js → interactive-replies-C3ffk6oN.js} +1 -1
- package/dist/interactive-replies-api.js +1 -1
- package/dist/{message-tool-api-CA9jZrCY.js → message-tool-api-ByVyIVOh.js} +3 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CalGciTs.js → monitor-CnB_WKvF.js} +3 -3
- package/dist/{outbound-adapter-BiLKcnyH.js → outbound-adapter-DuPz2HHt.js} +49 -5
- package/dist/{pipeline.runtime-DofAvTtb.js → pipeline.runtime-5rRYZuX5.js} +490 -345
- package/dist/{policy-BVs4LiSa.js → policy-C31RYSuT.js} +1 -1
- package/dist/probe-CVRuArHA.js +340 -0
- package/dist/{provider-CmeoUiIM.js → provider-htuIJGFD.js} +791 -359
- package/dist/{relay-source-DMmgtvg4.js → relay-source-Df9EaiTF.js} +6 -11
- package/dist/{replies-CJJCp6qz.js → replies-Cgr2Gli4.js} +3 -3
- package/dist/{resolve-channels-Rfts6POK.js → resolve-channels-DodP2TFx.js} +1 -1
- package/dist/{resolve-users-y6wAxR8E.js → resolve-users-M9eF8891.js} +1 -1
- package/dist/{runtime-api-BGDyOt1D.js → runtime-api-D5XYMMsf.js} +3 -2
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-CuxNQZ6v.js → scopes-CJRpHkDC.js} +1 -2
- package/dist/{secret-contract-CMohXFWS.js → secret-contract-DxmvbxBF.js} +1 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DYp8ca-l.js → send-BZ1tPv7-.js} +28 -11
- package/dist/send.runtime-a2pilFor.js +2 -0
- package/dist/setup-core-tPxMuFez.js +600 -0
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-oSd3NX9J.js → setup-surface-wV-S1dE_.js} +58 -32
- package/dist/{shared-D9yz5Otg.js → shared-BfMskaMx.js} +57 -10
- package/dist/{slash-dispatch.runtime-CSja9VuD.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +197 -1
- package/node_modules/axios/README.md +424 -256
- package/node_modules/axios/dist/axios.js +589 -204
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +630 -185
- package/node_modules/axios/dist/esm/axios.js +630 -185
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +949 -301
- package/node_modules/axios/index.d.cts +28 -5
- package/node_modules/axios/index.d.ts +24 -3
- package/node_modules/axios/lib/adapters/adapters.js +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +223 -49
- package/node_modules/axios/lib/adapters/http.js +408 -193
- package/node_modules/axios/lib/adapters/xhr.js +3 -1
- package/node_modules/axios/lib/core/Axios.js +4 -2
- package/node_modules/axios/lib/core/AxiosError.js +13 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
- package/node_modules/axios/lib/core/buildFullPath.js +29 -1
- package/node_modules/axios/lib/core/mergeConfig.js +35 -0
- package/node_modules/axios/lib/defaults/transitional.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/node_modules/axios/lib/helpers/buildURL.js +7 -4
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/cookies.js +5 -1
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
- package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
- package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
- package/node_modules/axios/lib/helpers/toFormData.js +48 -12
- package/node_modules/axios/lib/helpers/validator.js +1 -1
- package/node_modules/axios/lib/utils.js +105 -19
- package/node_modules/axios/package.json +31 -13
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.js +135 -158
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/npm-shrinkwrap.json +54 -27
- package/openclaw.plugin.json +1331 -1424
- package/package.json +92 -14
- package/dist/accounts.runtime-KvftRRek.js +0 -2
- package/dist/action-runtime.runtime-DZfd7IFr.js +0 -2
- package/dist/client-WIPAS3Yr.js +0 -160
- package/dist/config-api-Df9a1B8C.js +0 -3
- package/dist/doctor-contract-DddfkMlF.js +0 -134
- package/dist/probe-CN0ssfLN.js +0 -48
- package/dist/send.runtime-CJLxAt26.js +0 -2
- package/dist/setup-core-CkwVLzFO.js +0 -337
- package/node_modules/axios/dist/axios.js.map +0 -1
- package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
- package/node_modules/axios/dist/esm/axios.js.map +0 -1
- package/node_modules/axios/dist/node/axios.cjs.map +0 -1
|
@@ -50,6 +50,7 @@ declare class AxiosHeaders {
|
|
|
50
50
|
rewrite?: boolean | AxiosHeaderMatcher
|
|
51
51
|
): AxiosHeaders;
|
|
52
52
|
set(headers?: axios.RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|
53
|
+
set(headers?: Iterable<[string, axios.AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders;
|
|
53
54
|
|
|
54
55
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
55
56
|
get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;
|
|
@@ -66,7 +67,9 @@ declare class AxiosHeaders {
|
|
|
66
67
|
...targets: Array<AxiosHeaders | axios.RawAxiosHeaders | string | undefined | null>
|
|
67
68
|
): AxiosHeaders;
|
|
68
69
|
|
|
69
|
-
toJSON(asStrings
|
|
70
|
+
toJSON(asStrings: true): Record<string, string>;
|
|
71
|
+
toJSON(asStrings?: false): Record<string, string | string[]>;
|
|
72
|
+
toJSON(asStrings?: boolean): Record<string, string | string[]>;
|
|
70
73
|
|
|
71
74
|
static from(thing?: AxiosHeaders | axios.RawAxiosHeaders | string): AxiosHeaders;
|
|
72
75
|
|
|
@@ -117,6 +120,8 @@ declare class AxiosHeaders {
|
|
|
117
120
|
|
|
118
121
|
getSetCookie(): string[];
|
|
119
122
|
|
|
123
|
+
toString(): string;
|
|
124
|
+
|
|
120
125
|
[Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>;
|
|
121
126
|
}
|
|
122
127
|
|
|
@@ -162,7 +167,11 @@ declare class AxiosError<T = unknown, D = any> extends Error {
|
|
|
162
167
|
static readonly ETIMEDOUT = 'ETIMEDOUT';
|
|
163
168
|
}
|
|
164
169
|
|
|
165
|
-
declare class CanceledError<T> extends AxiosError<T> {
|
|
170
|
+
declare class CanceledError<T> extends AxiosError<T> {
|
|
171
|
+
constructor(message?: string, config?: axios.InternalAxiosRequestConfig, request?: any);
|
|
172
|
+
readonly name: 'CanceledError';
|
|
173
|
+
__CANCEL__?: boolean;
|
|
174
|
+
}
|
|
166
175
|
|
|
167
176
|
declare class Axios {
|
|
168
177
|
constructor(config?: axios.AxiosRequestConfig);
|
|
@@ -292,6 +301,12 @@ declare enum HttpStatusCode {
|
|
|
292
301
|
LoopDetected = 508,
|
|
293
302
|
NotExtended = 510,
|
|
294
303
|
NetworkAuthenticationRequired = 511,
|
|
304
|
+
WebServerIsDown = 521,
|
|
305
|
+
ConnectionTimedOut = 522,
|
|
306
|
+
OriginIsUnreachable = 523,
|
|
307
|
+
TimeoutOccurred = 524,
|
|
308
|
+
SslHandshakeFailed = 525,
|
|
309
|
+
InvalidSslCertificate = 526,
|
|
295
310
|
}
|
|
296
311
|
|
|
297
312
|
type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
|
@@ -392,6 +407,8 @@ declare namespace axios {
|
|
|
392
407
|
forcedJSONParsing?: boolean;
|
|
393
408
|
clarifyTimeoutError?: boolean;
|
|
394
409
|
legacyInterceptorReqResOrdering?: boolean;
|
|
410
|
+
advertiseZstdAcceptEncoding?: boolean;
|
|
411
|
+
validateStatusUndefinedResolves?: boolean;
|
|
395
412
|
}
|
|
396
413
|
|
|
397
414
|
interface GenericAbortSignal {
|
|
@@ -422,6 +439,8 @@ declare namespace axios {
|
|
|
422
439
|
dots?: boolean;
|
|
423
440
|
metaTokens?: boolean;
|
|
424
441
|
indexes?: boolean | null;
|
|
442
|
+
maxDepth?: number;
|
|
443
|
+
Blob?: { new (...args: any[]): any };
|
|
425
444
|
}
|
|
426
445
|
|
|
427
446
|
// tslint:disable-next-line
|
|
@@ -544,7 +563,7 @@ declare namespace axios {
|
|
|
544
563
|
| LookupAddress
|
|
545
564
|
>);
|
|
546
565
|
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
|
547
|
-
parseReviver?: (this: any, key: string, value: any, context?: { source
|
|
566
|
+
parseReviver?: (this: any, key: string, value: any, context?: { source?: string }) => any;
|
|
548
567
|
fetchOptions?:
|
|
549
568
|
| Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
|
|
550
569
|
| Record<string, any>;
|
|
@@ -554,6 +573,7 @@ declare namespace axios {
|
|
|
554
573
|
};
|
|
555
574
|
formDataHeaderPolicy?: 'legacy' | 'content-only';
|
|
556
575
|
redact?: string[];
|
|
576
|
+
sensitiveHeaders?: string[];
|
|
557
577
|
}
|
|
558
578
|
|
|
559
579
|
// Alias
|
|
@@ -618,6 +638,9 @@ declare namespace axios {
|
|
|
618
638
|
promise: Promise<Cancel>;
|
|
619
639
|
reason?: Cancel;
|
|
620
640
|
throwIfRequested(): void;
|
|
641
|
+
subscribe(listener: (cancel: Cancel | any) => void): void;
|
|
642
|
+
unsubscribe(listener: (cancel: Cancel | any) => void): void;
|
|
643
|
+
toAbortSignal(): AbortSignal;
|
|
621
644
|
}
|
|
622
645
|
|
|
623
646
|
interface CancelTokenSource {
|
|
@@ -684,14 +707,14 @@ declare namespace axios {
|
|
|
684
707
|
}
|
|
685
708
|
|
|
686
709
|
interface AxiosStatic extends AxiosInstance {
|
|
687
|
-
Cancel:
|
|
710
|
+
Cancel: typeof CanceledError;
|
|
688
711
|
CancelToken: CancelTokenStatic;
|
|
689
712
|
Axios: typeof Axios;
|
|
690
713
|
AxiosError: typeof AxiosError;
|
|
691
714
|
CanceledError: typeof CanceledError;
|
|
692
715
|
HttpStatusCode: typeof HttpStatusCode;
|
|
693
716
|
readonly VERSION: string;
|
|
694
|
-
isCancel(value: any): value is
|
|
717
|
+
isCancel<T = any>(value: any): value is CanceledError<T>;
|
|
695
718
|
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
|
696
719
|
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
|
697
720
|
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
|
@@ -31,6 +31,7 @@ export class AxiosHeaders {
|
|
|
31
31
|
rewrite?: boolean | AxiosHeaderMatcher
|
|
32
32
|
): AxiosHeaders;
|
|
33
33
|
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|
34
|
+
set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders;
|
|
34
35
|
|
|
35
36
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
36
37
|
get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
|
@@ -47,7 +48,9 @@ export class AxiosHeaders {
|
|
|
47
48
|
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
|
|
48
49
|
): AxiosHeaders;
|
|
49
50
|
|
|
50
|
-
toJSON(asStrings
|
|
51
|
+
toJSON(asStrings: true): Record<string, string>;
|
|
52
|
+
toJSON(asStrings?: false): Record<string, string | string[]>;
|
|
53
|
+
toJSON(asStrings?: boolean): Record<string, string | string[]>;
|
|
51
54
|
|
|
52
55
|
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
|
53
56
|
|
|
@@ -89,6 +92,8 @@ export class AxiosHeaders {
|
|
|
89
92
|
|
|
90
93
|
getSetCookie(): string[];
|
|
91
94
|
|
|
95
|
+
toString(): string;
|
|
96
|
+
|
|
92
97
|
[Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
|
93
98
|
}
|
|
94
99
|
|
|
@@ -231,6 +236,12 @@ export enum HttpStatusCode {
|
|
|
231
236
|
LoopDetected = 508,
|
|
232
237
|
NotExtended = 510,
|
|
233
238
|
NetworkAuthenticationRequired = 511,
|
|
239
|
+
WebServerIsDown = 521,
|
|
240
|
+
ConnectionTimedOut = 522,
|
|
241
|
+
OriginIsUnreachable = 523,
|
|
242
|
+
TimeoutOccurred = 524,
|
|
243
|
+
SslHandshakeFailed = 525,
|
|
244
|
+
InvalidSslCertificate = 526,
|
|
234
245
|
}
|
|
235
246
|
|
|
236
247
|
type UppercaseMethod =
|
|
@@ -281,6 +292,8 @@ export interface TransitionalOptions {
|
|
|
281
292
|
forcedJSONParsing?: boolean;
|
|
282
293
|
clarifyTimeoutError?: boolean;
|
|
283
294
|
legacyInterceptorReqResOrdering?: boolean;
|
|
295
|
+
advertiseZstdAcceptEncoding?: boolean;
|
|
296
|
+
validateStatusUndefinedResolves?: boolean;
|
|
284
297
|
}
|
|
285
298
|
|
|
286
299
|
export interface GenericAbortSignal {
|
|
@@ -311,6 +324,8 @@ export interface SerializerOptions {
|
|
|
311
324
|
dots?: boolean;
|
|
312
325
|
metaTokens?: boolean;
|
|
313
326
|
indexes?: boolean | null;
|
|
327
|
+
maxDepth?: number;
|
|
328
|
+
Blob?: { new (...args: any[]): any };
|
|
314
329
|
}
|
|
315
330
|
|
|
316
331
|
// tslint:disable-next-line
|
|
@@ -441,7 +456,7 @@ export interface AxiosRequestConfig<D = any> {
|
|
|
441
456
|
[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress
|
|
442
457
|
>);
|
|
443
458
|
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
|
444
|
-
parseReviver?: (this: any, key: string, value: any, context?: { source
|
|
459
|
+
parseReviver?: (this: any, key: string, value: any, context?: { source?: string }) => any;
|
|
445
460
|
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
|
|
446
461
|
httpVersion?: 1 | 2;
|
|
447
462
|
http2Options?: Record<string, any> & {
|
|
@@ -449,6 +464,7 @@ export interface AxiosRequestConfig<D = any> {
|
|
|
449
464
|
};
|
|
450
465
|
formDataHeaderPolicy?: 'legacy' | 'content-only';
|
|
451
466
|
redact?: string[];
|
|
467
|
+
sensitiveHeaders?: string[];
|
|
452
468
|
}
|
|
453
469
|
|
|
454
470
|
// Alias
|
|
@@ -533,7 +549,9 @@ export class AxiosError<T = unknown, D = any> extends Error {
|
|
|
533
549
|
}
|
|
534
550
|
|
|
535
551
|
export class CanceledError<T> extends AxiosError<T> {
|
|
552
|
+
constructor(message?: string, config?: InternalAxiosRequestConfig, request?: any);
|
|
536
553
|
readonly name: 'CanceledError';
|
|
554
|
+
__CANCEL__?: boolean;
|
|
537
555
|
}
|
|
538
556
|
|
|
539
557
|
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
|
@@ -559,6 +577,9 @@ export interface CancelToken {
|
|
|
559
577
|
promise: Promise<Cancel>;
|
|
560
578
|
reason?: Cancel;
|
|
561
579
|
throwIfRequested(): void;
|
|
580
|
+
subscribe(listener: (cancel: Cancel | any) => void): void;
|
|
581
|
+
unsubscribe(listener: (cancel: Cancel | any) => void): void;
|
|
582
|
+
toAbortSignal(): AbortSignal;
|
|
562
583
|
}
|
|
563
584
|
|
|
564
585
|
export interface CancelTokenSource {
|
|
@@ -711,7 +732,7 @@ export function mergeConfig<D = any>(
|
|
|
711
732
|
export function create(config?: CreateAxiosDefaults): AxiosInstance;
|
|
712
733
|
|
|
713
734
|
export interface AxiosStatic extends AxiosInstance {
|
|
714
|
-
Cancel:
|
|
735
|
+
Cancel: typeof CanceledError;
|
|
715
736
|
CancelToken: CancelTokenStatic;
|
|
716
737
|
Axios: typeof Axios;
|
|
717
738
|
AxiosError: typeof AxiosError;
|
|
@@ -13,11 +13,41 @@ import resolveConfig from '../helpers/resolveConfig.js';
|
|
|
13
13
|
import settle from '../core/settle.js';
|
|
14
14
|
import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';
|
|
15
15
|
import { VERSION } from '../env/data.js';
|
|
16
|
+
import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
|
|
16
17
|
|
|
17
18
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
18
19
|
|
|
19
20
|
const { isFunction } = utils;
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
24
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} str The string to encode
|
|
27
|
+
*
|
|
28
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
29
|
+
*/
|
|
30
|
+
const encodeUTF8 = (str) =>
|
|
31
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
32
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Node's WHATWG URL parser returns `username` and `password` percent-encoded.
|
|
36
|
+
// Decode before composing the `auth` option so credentials such as
|
|
37
|
+
// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
|
|
38
|
+
// original value for malformed input so a bad encoding never throws.
|
|
39
|
+
const decodeURIComponentSafe = (value) => {
|
|
40
|
+
if (!utils.isString(value)) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
return decodeURIComponent(value);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
21
51
|
const test = (fn, ...args) => {
|
|
22
52
|
try {
|
|
23
53
|
return !!fn(...args);
|
|
@@ -26,8 +56,20 @@ const test = (fn, ...args) => {
|
|
|
26
56
|
}
|
|
27
57
|
};
|
|
28
58
|
|
|
59
|
+
const maybeWithAuthCredentials = (url) => {
|
|
60
|
+
const protocolIndex = url.indexOf('://');
|
|
61
|
+
let urlToCheck = url;
|
|
62
|
+
if (protocolIndex !== -1) {
|
|
63
|
+
urlToCheck = urlToCheck.slice(protocolIndex + 3);
|
|
64
|
+
}
|
|
65
|
+
return urlToCheck.includes('@') || urlToCheck.includes(':');
|
|
66
|
+
};
|
|
67
|
+
|
|
29
68
|
const factory = (env) => {
|
|
30
|
-
const globalObject =
|
|
69
|
+
const globalObject =
|
|
70
|
+
utils.global !== undefined && utils.global !== null
|
|
71
|
+
? utils.global
|
|
72
|
+
: globalThis;
|
|
31
73
|
const { ReadableStream, TextEncoder } = globalObject;
|
|
32
74
|
|
|
33
75
|
env = utils.merge.call(
|
|
@@ -170,6 +212,7 @@ const factory = (env) => {
|
|
|
170
212
|
|
|
171
213
|
const hasMaxContentLength = utils.isNumber(maxContentLength) && maxContentLength > -1;
|
|
172
214
|
const hasMaxBodyLength = utils.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
215
|
+
const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);
|
|
173
216
|
|
|
174
217
|
let _fetch = envFetch || fetch;
|
|
175
218
|
|
|
@@ -191,7 +234,61 @@ const factory = (env) => {
|
|
|
191
234
|
|
|
192
235
|
let requestContentLength;
|
|
193
236
|
|
|
237
|
+
// AxiosError we raise while the request body is being streamed. Captured
|
|
238
|
+
// by identity so the catch block can surface it directly, regardless of
|
|
239
|
+
// how the runtime wraps the resulting fetch rejection (undici exposes it
|
|
240
|
+
// as `err.cause`; some browsers drop the original error entirely).
|
|
241
|
+
let pendingBodyError = null;
|
|
242
|
+
|
|
243
|
+
const maxBodyLengthError = () =>
|
|
244
|
+
new AxiosError(
|
|
245
|
+
'Request body larger than maxBodyLength limit',
|
|
246
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
247
|
+
config,
|
|
248
|
+
request
|
|
249
|
+
);
|
|
250
|
+
|
|
194
251
|
try {
|
|
252
|
+
// HTTP basic authentication
|
|
253
|
+
let auth = undefined;
|
|
254
|
+
const configAuth = own('auth');
|
|
255
|
+
|
|
256
|
+
if (configAuth) {
|
|
257
|
+
const username = utils.getSafeProp(configAuth, 'username') || '';
|
|
258
|
+
const password = utils.getSafeProp(configAuth, 'password') || '';
|
|
259
|
+
auth = {
|
|
260
|
+
username,
|
|
261
|
+
password
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (maybeWithAuthCredentials(url)) {
|
|
266
|
+
const parsedURL = new URL(url, platform.origin);
|
|
267
|
+
|
|
268
|
+
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
269
|
+
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
270
|
+
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
271
|
+
auth = {
|
|
272
|
+
username: urlUsername,
|
|
273
|
+
password: urlPassword
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (parsedURL.username || parsedURL.password) {
|
|
278
|
+
parsedURL.username = '';
|
|
279
|
+
parsedURL.password = '';
|
|
280
|
+
url = parsedURL.href;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (auth) {
|
|
285
|
+
headers.delete('authorization');
|
|
286
|
+
headers.set(
|
|
287
|
+
'Authorization',
|
|
288
|
+
'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
195
292
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
196
293
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
197
294
|
// "if (protocol === 'data:')" branch).
|
|
@@ -207,53 +304,96 @@ const factory = (env) => {
|
|
|
207
304
|
}
|
|
208
305
|
}
|
|
209
306
|
|
|
210
|
-
// Enforce maxBodyLength against
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
307
|
+
// Enforce maxBodyLength against known-size bodies before dispatch using
|
|
308
|
+
// the body's *actual* size — never a caller-declared Content-Length,
|
|
309
|
+
// which could under-report to slip an oversized body past the check.
|
|
310
|
+
// Unknown-size streams return undefined here and are counted per-chunk
|
|
311
|
+
// below as fetch consumes them.
|
|
214
312
|
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
215
|
-
const outboundLength = await
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
throw new AxiosError(
|
|
222
|
-
'Request body larger than maxBodyLength limit',
|
|
223
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
224
|
-
config,
|
|
225
|
-
request
|
|
226
|
-
);
|
|
313
|
+
const outboundLength = await getBodyLength(data);
|
|
314
|
+
if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
|
|
315
|
+
requestContentLength = outboundLength;
|
|
316
|
+
if (outboundLength > maxBodyLength) {
|
|
317
|
+
throw maxBodyLengthError();
|
|
318
|
+
}
|
|
227
319
|
}
|
|
228
320
|
}
|
|
229
321
|
|
|
322
|
+
// A streamed body under maxBodyLength must be counted as fetch consumes
|
|
323
|
+
// it; its size is never trusted from a caller-declared Content-Length.
|
|
324
|
+
const mustEnforceStreamBody =
|
|
325
|
+
hasMaxBodyLength && (utils.isReadableStream(data) || utils.isStream(data));
|
|
326
|
+
|
|
327
|
+
const trackRequestStream = (stream, onProgress, flush) =>
|
|
328
|
+
trackStream(
|
|
329
|
+
stream,
|
|
330
|
+
DEFAULT_CHUNK_SIZE,
|
|
331
|
+
(loadedBytes) => {
|
|
332
|
+
if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
|
|
333
|
+
throw (pendingBodyError = maxBodyLengthError());
|
|
334
|
+
}
|
|
335
|
+
onProgress && onProgress(loadedBytes);
|
|
336
|
+
},
|
|
337
|
+
flush
|
|
338
|
+
);
|
|
339
|
+
|
|
230
340
|
if (
|
|
231
|
-
onUploadProgress &&
|
|
232
341
|
supportsRequestStream &&
|
|
233
342
|
method !== 'get' &&
|
|
234
343
|
method !== 'head' &&
|
|
235
|
-
(
|
|
344
|
+
(onUploadProgress || mustEnforceStreamBody)
|
|
236
345
|
) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
346
|
+
requestContentLength =
|
|
347
|
+
requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
|
|
348
|
+
|
|
349
|
+
// A declared length of 0 is only trusted to skip the wrap when we are
|
|
350
|
+
// not enforcing a stream limit (which must not rely on that header).
|
|
351
|
+
if (requestContentLength !== 0 || mustEnforceStreamBody) {
|
|
352
|
+
let _request = new Request(url, {
|
|
353
|
+
method: 'POST',
|
|
354
|
+
body: data,
|
|
355
|
+
duplex: 'half',
|
|
356
|
+
});
|
|
242
357
|
|
|
243
|
-
|
|
358
|
+
let contentTypeHeader;
|
|
244
359
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
360
|
+
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
361
|
+
headers.setContentType(contentTypeHeader);
|
|
362
|
+
}
|
|
248
363
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
364
|
+
if (_request.body) {
|
|
365
|
+
const [onProgress, flush] =
|
|
366
|
+
(onUploadProgress &&
|
|
367
|
+
progressEventDecorator(
|
|
368
|
+
requestContentLength,
|
|
369
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
370
|
+
)) ||
|
|
371
|
+
[];
|
|
254
372
|
|
|
255
|
-
|
|
373
|
+
data = trackRequestStream(_request.body, onProgress, flush);
|
|
374
|
+
}
|
|
256
375
|
}
|
|
376
|
+
} else if (
|
|
377
|
+
mustEnforceStreamBody &&
|
|
378
|
+
!isRequestSupported &&
|
|
379
|
+
isReadableStreamSupported &&
|
|
380
|
+
method !== 'get' &&
|
|
381
|
+
method !== 'head'
|
|
382
|
+
) {
|
|
383
|
+
data = trackRequestStream(data);
|
|
384
|
+
} else if (
|
|
385
|
+
mustEnforceStreamBody &&
|
|
386
|
+
isRequestSupported &&
|
|
387
|
+
!supportsRequestStream &&
|
|
388
|
+
method !== 'get' &&
|
|
389
|
+
method !== 'head'
|
|
390
|
+
) {
|
|
391
|
+
throw new AxiosError(
|
|
392
|
+
'Stream request bodies are not supported by the current fetch implementation',
|
|
393
|
+
AxiosError.ERR_NOT_SUPPORT,
|
|
394
|
+
config,
|
|
395
|
+
request
|
|
396
|
+
);
|
|
257
397
|
}
|
|
258
398
|
|
|
259
399
|
if (!utils.isString(withCredentials)) {
|
|
@@ -284,7 +424,7 @@ const factory = (env) => {
|
|
|
284
424
|
...fetchOptions,
|
|
285
425
|
signal: composedSignal,
|
|
286
426
|
method: method.toUpperCase(),
|
|
287
|
-
headers: headers.normalize()
|
|
427
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
288
428
|
body: data,
|
|
289
429
|
duplex: 'half',
|
|
290
430
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
@@ -296,10 +436,12 @@ const factory = (env) => {
|
|
|
296
436
|
? _fetch(request, fetchOptions)
|
|
297
437
|
: _fetch(url, resolvedOptions));
|
|
298
438
|
|
|
439
|
+
const responseHeaders = AxiosHeaders.from(response.headers);
|
|
440
|
+
|
|
299
441
|
// Cheap pre-check: if the server honestly declares a content-length that
|
|
300
442
|
// already exceeds the cap, reject before we start streaming.
|
|
301
443
|
if (hasMaxContentLength) {
|
|
302
|
-
const declaredLength = utils.toFiniteNumber(
|
|
444
|
+
const declaredLength = utils.toFiniteNumber(responseHeaders.getContentLength());
|
|
303
445
|
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
304
446
|
throw new AxiosError(
|
|
305
447
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -324,7 +466,7 @@ const factory = (env) => {
|
|
|
324
466
|
options[prop] = response[prop];
|
|
325
467
|
});
|
|
326
468
|
|
|
327
|
-
const responseContentLength = utils.toFiniteNumber(
|
|
469
|
+
const responseContentLength = utils.toFiniteNumber(responseHeaders.getContentLength());
|
|
328
470
|
|
|
329
471
|
const [onProgress, flush] =
|
|
330
472
|
(onDownloadProgress &&
|
|
@@ -415,23 +557,55 @@ const factory = (env) => {
|
|
|
415
557
|
const canceledError = composedSignal.reason;
|
|
416
558
|
canceledError.config = config;
|
|
417
559
|
request && (canceledError.request = request);
|
|
418
|
-
err !== canceledError
|
|
560
|
+
if (err !== canceledError) {
|
|
561
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
562
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
563
|
+
Object.defineProperty(canceledError, 'cause', {
|
|
564
|
+
__proto__: null,
|
|
565
|
+
value: err,
|
|
566
|
+
writable: true,
|
|
567
|
+
enumerable: false,
|
|
568
|
+
configurable: true,
|
|
569
|
+
});
|
|
570
|
+
}
|
|
419
571
|
throw canceledError;
|
|
420
572
|
}
|
|
421
573
|
|
|
574
|
+
// Surface a maxBodyLength violation we raised while the request body was
|
|
575
|
+
// being streamed. Matching by identity (rather than reading
|
|
576
|
+
// `err.cause.isAxiosError`) keeps the error deterministic across runtimes
|
|
577
|
+
// and avoids both prototype-pollution reads and mis-attributing a foreign
|
|
578
|
+
// AxiosError that merely happened to land in `err.cause`.
|
|
579
|
+
if (pendingBodyError) {
|
|
580
|
+
request && !pendingBodyError.request && (pendingBodyError.request = request);
|
|
581
|
+
throw pendingBodyError;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Re-throw AxiosErrors we raised synchronously (data: URL / content-length
|
|
585
|
+
// pre-checks, response size enforcement) without re-wrapping them.
|
|
586
|
+
if (err instanceof AxiosError) {
|
|
587
|
+
request && !err.request && (err.request = request);
|
|
588
|
+
throw err;
|
|
589
|
+
}
|
|
590
|
+
|
|
422
591
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
err && err.response
|
|
430
|
-
),
|
|
431
|
-
{
|
|
432
|
-
cause: err.cause || err,
|
|
433
|
-
}
|
|
592
|
+
const networkError = new AxiosError(
|
|
593
|
+
'Network Error',
|
|
594
|
+
AxiosError.ERR_NETWORK,
|
|
595
|
+
config,
|
|
596
|
+
request,
|
|
597
|
+
err && err.response
|
|
434
598
|
);
|
|
599
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
600
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
601
|
+
Object.defineProperty(networkError, 'cause', {
|
|
602
|
+
__proto__: null,
|
|
603
|
+
value: err.cause || err,
|
|
604
|
+
writable: true,
|
|
605
|
+
enumerable: false,
|
|
606
|
+
configurable: true,
|
|
607
|
+
});
|
|
608
|
+
throw networkError;
|
|
435
609
|
}
|
|
436
610
|
|
|
437
611
|
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|