agent-relay 4.0.29 → 4.0.31

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.
Files changed (142) hide show
  1. package/README.md +88 -48
  2. package/bin/agent-relay-broker-darwin-arm64 +0 -0
  3. package/bin/agent-relay-broker-darwin-x64 +0 -0
  4. package/bin/agent-relay-broker-linux-arm64 +0 -0
  5. package/bin/agent-relay-broker-linux-x64 +0 -0
  6. package/dist/index.cjs +99 -54
  7. package/dist/src/cli/bootstrap.d.ts +2 -1
  8. package/dist/src/cli/bootstrap.d.ts.map +1 -1
  9. package/dist/src/cli/bootstrap.js +223 -17
  10. package/dist/src/cli/bootstrap.js.map +1 -1
  11. package/dist/src/cli/commands/agent-management.d.ts.map +1 -1
  12. package/dist/src/cli/commands/agent-management.js +1 -3
  13. package/dist/src/cli/commands/agent-management.js.map +1 -1
  14. package/dist/src/cli/commands/auth.d.ts.map +1 -1
  15. package/dist/src/cli/commands/auth.js +32 -3
  16. package/dist/src/cli/commands/auth.js.map +1 -1
  17. package/dist/src/cli/commands/cloud.d.ts.map +1 -1
  18. package/dist/src/cli/commands/cloud.js +242 -144
  19. package/dist/src/cli/commands/cloud.js.map +1 -1
  20. package/dist/src/cli/commands/core.d.ts.map +1 -1
  21. package/dist/src/cli/commands/core.js +11 -6
  22. package/dist/src/cli/commands/core.js.map +1 -1
  23. package/dist/src/cli/commands/messaging.d.ts.map +1 -1
  24. package/dist/src/cli/commands/messaging.js +1 -3
  25. package/dist/src/cli/commands/messaging.js.map +1 -1
  26. package/dist/src/cli/commands/monitoring.d.ts.map +1 -1
  27. package/dist/src/cli/commands/monitoring.js +5 -4
  28. package/dist/src/cli/commands/monitoring.js.map +1 -1
  29. package/dist/src/cli/commands/on.d.ts.map +1 -1
  30. package/dist/src/cli/commands/on.js +1 -3
  31. package/dist/src/cli/commands/on.js.map +1 -1
  32. package/dist/src/cli/commands/setup.d.ts.map +1 -1
  33. package/dist/src/cli/commands/setup.js +62 -7
  34. package/dist/src/cli/commands/setup.js.map +1 -1
  35. package/dist/src/cli/commands/swarm.d.ts.map +1 -1
  36. package/dist/src/cli/commands/swarm.js +34 -4
  37. package/dist/src/cli/commands/swarm.js.map +1 -1
  38. package/dist/src/cli/index.js +9 -1
  39. package/dist/src/cli/index.js.map +1 -1
  40. package/dist/src/cli/lib/exit.d.ts +49 -0
  41. package/dist/src/cli/lib/exit.d.ts.map +1 -0
  42. package/dist/src/cli/lib/exit.js +73 -0
  43. package/dist/src/cli/lib/exit.js.map +1 -0
  44. package/dist/src/cli/lib/telemetry-helpers.d.ts +20 -0
  45. package/dist/src/cli/lib/telemetry-helpers.d.ts.map +1 -0
  46. package/dist/src/cli/lib/telemetry-helpers.js +31 -0
  47. package/dist/src/cli/lib/telemetry-helpers.js.map +1 -0
  48. package/node_modules/@agent-relay/cloud/package.json +2 -2
  49. package/node_modules/@agent-relay/config/package.json +1 -1
  50. package/node_modules/@agent-relay/hooks/package.json +4 -4
  51. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts +62 -12
  52. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts.map +1 -1
  53. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js +137 -47
  54. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js.map +1 -1
  55. package/node_modules/@agent-relay/sdk/package.json +22 -2
  56. package/node_modules/@agent-relay/telemetry/dist/client.d.ts +14 -2
  57. package/node_modules/@agent-relay/telemetry/dist/client.d.ts.map +1 -1
  58. package/node_modules/@agent-relay/telemetry/dist/client.js +22 -4
  59. package/node_modules/@agent-relay/telemetry/dist/client.js.map +1 -1
  60. package/node_modules/@agent-relay/telemetry/dist/events.d.ts +217 -10
  61. package/node_modules/@agent-relay/telemetry/dist/events.d.ts.map +1 -1
  62. package/node_modules/@agent-relay/telemetry/dist/events.js +11 -0
  63. package/node_modules/@agent-relay/telemetry/dist/events.js.map +1 -1
  64. package/node_modules/@agent-relay/telemetry/dist/index.d.ts +2 -2
  65. package/node_modules/@agent-relay/telemetry/dist/index.d.ts.map +1 -1
  66. package/node_modules/@agent-relay/telemetry/dist/index.js.map +1 -1
  67. package/node_modules/@agent-relay/telemetry/package.json +2 -2
  68. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  69. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  70. package/node_modules/@agent-relay/utils/package.json +2 -2
  71. package/node_modules/@relaycast/sdk/dist/version.d.ts +1 -1
  72. package/node_modules/@relaycast/sdk/dist/version.js +1 -1
  73. package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/package.json +1 -1
  74. package/node_modules/@relaycast/sdk/package.json +2 -2
  75. package/node_modules/axios/CHANGELOG.md +166 -0
  76. package/node_modules/axios/README.md +210 -204
  77. package/node_modules/axios/dist/axios.js +92 -63
  78. package/node_modules/axios/dist/axios.js.map +1 -1
  79. package/node_modules/axios/dist/axios.min.js +2 -2
  80. package/node_modules/axios/dist/axios.min.js.map +1 -1
  81. package/node_modules/axios/dist/browser/axios.cjs +140 -101
  82. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  83. package/node_modules/axios/dist/esm/axios.js +140 -101
  84. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  85. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  86. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  87. package/node_modules/axios/dist/node/axios.cjs +199 -75
  88. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  89. package/node_modules/axios/index.d.cts +14 -28
  90. package/node_modules/axios/index.d.ts +132 -226
  91. package/node_modules/axios/lib/adapters/fetch.js +21 -6
  92. package/node_modules/axios/lib/adapters/http.js +88 -6
  93. package/node_modules/axios/lib/core/AxiosError.js +34 -33
  94. package/node_modules/axios/lib/core/AxiosHeaders.js +24 -25
  95. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  96. package/node_modules/axios/lib/core/mergeConfig.js +5 -3
  97. package/node_modules/axios/lib/defaults/index.js +13 -8
  98. package/node_modules/axios/lib/env/data.js +1 -1
  99. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  100. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  101. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -1
  102. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  103. package/node_modules/axios/lib/helpers/resolveConfig.js +11 -3
  104. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +48 -1
  105. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  106. package/node_modules/axios/lib/utils.js +10 -10
  107. package/node_modules/axios/package.json +4 -4
  108. package/node_modules/hasown/CHANGELOG.md +11 -0
  109. package/node_modules/hasown/eslint.config.mjs +6 -0
  110. package/node_modules/hasown/index.d.ts +1 -0
  111. package/node_modules/hasown/package.json +14 -14
  112. package/package.json +9 -9
  113. package/packages/cloud/package.json +2 -2
  114. package/packages/config/package.json +1 -1
  115. package/packages/hooks/package.json +4 -4
  116. package/packages/sdk/dist/workflows/file-db.d.ts +62 -12
  117. package/packages/sdk/dist/workflows/file-db.d.ts.map +1 -1
  118. package/packages/sdk/dist/workflows/file-db.js +137 -47
  119. package/packages/sdk/dist/workflows/file-db.js.map +1 -1
  120. package/packages/sdk/package.json +22 -2
  121. package/packages/telemetry/dist/client.d.ts +14 -2
  122. package/packages/telemetry/dist/client.d.ts.map +1 -1
  123. package/packages/telemetry/dist/client.js +22 -4
  124. package/packages/telemetry/dist/client.js.map +1 -1
  125. package/packages/telemetry/dist/events.d.ts +217 -10
  126. package/packages/telemetry/dist/events.d.ts.map +1 -1
  127. package/packages/telemetry/dist/events.js +11 -0
  128. package/packages/telemetry/dist/events.js.map +1 -1
  129. package/packages/telemetry/dist/index.d.ts +2 -2
  130. package/packages/telemetry/dist/index.d.ts.map +1 -1
  131. package/packages/telemetry/dist/index.js.map +1 -1
  132. package/packages/telemetry/package.json +2 -2
  133. package/packages/trajectory/package.json +2 -2
  134. package/packages/user-directory/package.json +2 -2
  135. package/packages/utils/package.json +2 -2
  136. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.d.ts +0 -12
  137. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.js +0 -17
  138. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/license +0 -9
  139. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/package.json +0 -43
  140. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/readme.md +0 -35
  141. package/node_modules/color-convert/CHANGELOG.md +0 -54
  142. package/node_modules/hasown/.eslintrc +0 -5
@@ -1,13 +1,7 @@
1
1
  // TypeScript Version: 4.7
2
2
  type StringLiteralsOrString<Literals extends string> = Literals | (string & {});
3
3
 
4
- export type AxiosHeaderValue =
5
- | AxiosHeaders
6
- | string
7
- | string[]
8
- | number
9
- | boolean
10
- | null;
4
+ export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
11
5
 
12
6
  interface RawAxiosHeaders {
13
7
  [key: string]: AxiosHeaderValue;
@@ -24,11 +18,7 @@ type AxiosHeaderMatcher =
24
18
  | RegExp
25
19
  | ((this: AxiosHeaders, value: string, name: string) => boolean);
26
20
 
27
- type AxiosHeaderParser = (
28
- this: AxiosHeaders,
29
- value: AxiosHeaderValue,
30
- header: string,
31
- ) => any;
21
+ type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
32
22
 
33
23
  export class AxiosHeaders {
34
24
  constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
@@ -38,12 +28,9 @@ export class AxiosHeaders {
38
28
  set(
39
29
  headerName?: string,
40
30
  value?: AxiosHeaderValue,
41
- rewrite?: boolean | AxiosHeaderMatcher,
42
- ): AxiosHeaders;
43
- set(
44
- headers?: RawAxiosHeaders | AxiosHeaders | string,
45
- rewrite?: boolean,
31
+ rewrite?: boolean | AxiosHeaderMatcher
46
32
  ): AxiosHeaders;
33
+ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
47
34
 
48
35
  get(headerName: string, parser: RegExp): RegExpExecArray | null;
49
36
  get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
@@ -57,9 +44,7 @@ export class AxiosHeaders {
57
44
  normalize(format: boolean): AxiosHeaders;
58
45
 
59
46
  concat(
60
- ...targets: Array<
61
- AxiosHeaders | RawAxiosHeaders | string | undefined | null
62
- >
47
+ ...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
63
48
  ): AxiosHeaders;
64
49
 
65
50
  toJSON(asStrings?: boolean): RawAxiosHeaders;
@@ -69,55 +54,35 @@ export class AxiosHeaders {
69
54
  static accessor(header: string | string[]): AxiosHeaders;
70
55
 
71
56
  static concat(
72
- ...targets: Array<
73
- AxiosHeaders | RawAxiosHeaders | string | undefined | null
74
- >
57
+ ...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
75
58
  ): AxiosHeaders;
76
59
 
77
- setContentType(
78
- value: ContentType,
79
- rewrite?: boolean | AxiosHeaderMatcher,
80
- ): AxiosHeaders;
60
+ setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
81
61
  getContentType(parser?: RegExp): RegExpExecArray | null;
82
62
  getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
83
63
  hasContentType(matcher?: AxiosHeaderMatcher): boolean;
84
64
 
85
- setContentLength(
86
- value: AxiosHeaderValue,
87
- rewrite?: boolean | AxiosHeaderMatcher,
88
- ): AxiosHeaders;
65
+ setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
89
66
  getContentLength(parser?: RegExp): RegExpExecArray | null;
90
67
  getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
91
68
  hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
92
69
 
93
- setAccept(
94
- value: AxiosHeaderValue,
95
- rewrite?: boolean | AxiosHeaderMatcher,
96
- ): AxiosHeaders;
70
+ setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
97
71
  getAccept(parser?: RegExp): RegExpExecArray | null;
98
72
  getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
99
73
  hasAccept(matcher?: AxiosHeaderMatcher): boolean;
100
74
 
101
- setUserAgent(
102
- value: AxiosHeaderValue,
103
- rewrite?: boolean | AxiosHeaderMatcher,
104
- ): AxiosHeaders;
75
+ setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
105
76
  getUserAgent(parser?: RegExp): RegExpExecArray | null;
106
77
  getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
107
78
  hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
108
79
 
109
- setContentEncoding(
110
- value: AxiosHeaderValue,
111
- rewrite?: boolean | AxiosHeaderMatcher,
112
- ): AxiosHeaders;
80
+ setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
113
81
  getContentEncoding(parser?: RegExp): RegExpExecArray | null;
114
82
  getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
115
83
  hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
116
84
 
117
- setAuthorization(
118
- value: AxiosHeaderValue,
119
- rewrite?: boolean | AxiosHeaderMatcher,
120
- ): AxiosHeaders;
85
+ setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
121
86
  getAuthorization(parser?: RegExp): RegExpExecArray | null;
122
87
  getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
123
88
  hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
@@ -128,56 +93,53 @@ export class AxiosHeaders {
128
93
  }
129
94
 
130
95
  type CommonRequestHeadersList =
131
- | "Accept"
132
- | "Content-Length"
133
- | "User-Agent"
134
- | "Content-Encoding"
135
- | "Authorization";
96
+ | 'Accept'
97
+ | 'Content-Length'
98
+ | 'User-Agent'
99
+ | 'Content-Encoding'
100
+ | 'Authorization'
101
+ | 'Location';
136
102
 
137
103
  type ContentType =
138
104
  | AxiosHeaderValue
139
- | "text/html"
140
- | "text/plain"
141
- | "multipart/form-data"
142
- | "application/json"
143
- | "application/x-www-form-urlencoded"
144
- | "application/octet-stream";
105
+ | 'text/html'
106
+ | 'text/plain'
107
+ | 'multipart/form-data'
108
+ | 'application/json'
109
+ | 'application/x-www-form-urlencoded'
110
+ | 'application/octet-stream';
145
111
 
146
112
  export type RawAxiosRequestHeaders = Partial<
147
113
  RawAxiosHeaders & {
148
114
  [Key in CommonRequestHeadersList]: AxiosHeaderValue;
149
115
  } & {
150
- "Content-Type": ContentType;
116
+ 'Content-Type': ContentType;
151
117
  }
152
118
  >;
153
119
 
154
120
  export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
155
121
 
156
122
  type CommonResponseHeadersList =
157
- | "Server"
158
- | "Content-Type"
159
- | "Content-Length"
160
- | "Cache-Control"
161
- | "Content-Encoding";
123
+ | 'Server'
124
+ | 'Content-Type'
125
+ | 'Content-Length'
126
+ | 'Cache-Control'
127
+ | 'Content-Encoding';
128
+
129
+ type CommonResponseHeaderKey = CommonResponseHeadersList | Lowercase<CommonResponseHeadersList>;
162
130
 
163
131
  type RawCommonResponseHeaders = {
164
- [Key in CommonResponseHeadersList]: AxiosHeaderValue;
132
+ [Key in CommonResponseHeaderKey]: AxiosHeaderValue;
165
133
  } & {
166
- "set-cookie": string[];
134
+ 'set-cookie': string[];
167
135
  };
168
136
 
169
- export type RawAxiosResponseHeaders = Partial<
170
- RawAxiosHeaders & RawCommonResponseHeaders
171
- >;
137
+ export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
172
138
 
173
139
  export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
174
140
 
175
141
  export interface AxiosRequestTransformer {
176
- (
177
- this: InternalAxiosRequestConfig,
178
- data: any,
179
- headers: AxiosRequestHeaders,
180
- ): any;
142
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
181
143
  }
182
144
 
183
145
  export interface AxiosResponseTransformer {
@@ -185,7 +147,7 @@ export interface AxiosResponseTransformer {
185
147
  this: InternalAxiosRequestConfig,
186
148
  data: any,
187
149
  headers: AxiosResponseHeaders,
188
- status?: number,
150
+ status?: number
189
151
  ): any;
190
152
  }
191
153
 
@@ -271,62 +233,47 @@ export enum HttpStatusCode {
271
233
  NetworkAuthenticationRequired = 511,
272
234
  }
273
235
 
274
- export type Method =
275
- | "get"
276
- | "GET"
277
- | "delete"
278
- | "DELETE"
279
- | "head"
280
- | "HEAD"
281
- | "options"
282
- | "OPTIONS"
283
- | "post"
284
- | "POST"
285
- | "put"
286
- | "PUT"
287
- | "patch"
288
- | "PATCH"
289
- | "purge"
290
- | "PURGE"
291
- | "link"
292
- | "LINK"
293
- | "unlink"
294
- | "UNLINK";
236
+ type UppercaseMethod =
237
+ | 'GET'
238
+ | 'DELETE'
239
+ | 'HEAD'
240
+ | 'OPTIONS'
241
+ | 'POST'
242
+ | 'PUT'
243
+ | 'PATCH'
244
+ | 'PURGE'
245
+ | 'LINK'
246
+ | 'UNLINK';
247
+
248
+ export type Method = (UppercaseMethod | Lowercase<UppercaseMethod>) & {};
295
249
 
296
250
  export type ResponseType =
297
- | "arraybuffer"
298
- | "blob"
299
- | "document"
300
- | "json"
301
- | "text"
302
- | "stream"
303
- | "formdata";
304
-
305
- export type responseEncoding =
306
- | "ascii"
307
- | "ASCII"
308
- | "ansi"
309
- | "ANSI"
310
- | "binary"
311
- | "BINARY"
312
- | "base64"
313
- | "BASE64"
314
- | "base64url"
315
- | "BASE64URL"
316
- | "hex"
317
- | "HEX"
318
- | "latin1"
319
- | "LATIN1"
320
- | "ucs-2"
321
- | "UCS-2"
322
- | "ucs2"
323
- | "UCS2"
324
- | "utf-8"
325
- | "UTF-8"
326
- | "utf8"
327
- | "UTF8"
328
- | "utf16le"
329
- | "UTF16LE";
251
+ | 'arraybuffer'
252
+ | 'blob'
253
+ | 'document'
254
+ | 'json'
255
+ | 'text'
256
+ | 'stream'
257
+ | 'formdata';
258
+
259
+ type UppercaseResponseEncoding =
260
+ | 'ASCII'
261
+ | 'ANSI'
262
+ | 'BINARY'
263
+ | 'BASE64'
264
+ | 'BASE64URL'
265
+ | 'HEX'
266
+ | 'LATIN1'
267
+ | 'UCS-2'
268
+ | 'UCS2'
269
+ | 'UTF-8'
270
+ | 'UTF8'
271
+ | 'UTF16LE';
272
+
273
+ export type responseEncoding = (
274
+ | UppercaseResponseEncoding
275
+ | Lowercase<UppercaseResponseEncoding>
276
+ ) & {};
330
277
 
331
278
  export interface TransitionalOptions {
332
279
  silentJSONParsing?: boolean;
@@ -354,7 +301,7 @@ export interface SerializerVisitor {
354
301
  value: any,
355
302
  key: string | number,
356
303
  path: null | Array<string | number>,
357
- helpers: FormDataVisitorHelpers,
304
+ helpers: FormDataVisitorHelpers
358
305
  ): boolean;
359
306
  }
360
307
 
@@ -402,7 +349,7 @@ export interface AxiosProgressEvent {
402
349
 
403
350
  type Milliseconds = number;
404
351
 
405
- type AxiosAdapterName = StringLiteralsOrString<"xhr" | "http" | "fetch">;
352
+ type AxiosAdapterName = StringLiteralsOrString<'xhr' | 'http' | 'fetch'>;
406
353
 
407
354
  type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
408
355
 
@@ -447,7 +394,7 @@ export interface AxiosRequestConfig<D = any> {
447
394
  responseDetails: {
448
395
  headers: Record<string, string>;
449
396
  statusCode: HttpStatusCode;
450
- },
397
+ }
451
398
  ) => void;
452
399
  socketPath?: string | null;
453
400
  transport?: any;
@@ -461,24 +408,11 @@ export interface AxiosRequestConfig<D = any> {
461
408
  insecureHTTPParser?: boolean;
462
409
  env?: {
463
410
  FormData?: new (...args: any[]) => object;
464
- fetch?: (
465
- input: URL | Request | string,
466
- init?: RequestInit,
467
- ) => Promise<Response>;
468
- Request?: new (
469
- input: URL | Request | string,
470
- init?: RequestInit,
471
- ) => Request;
411
+ fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>;
412
+ Request?: new (input: URL | Request | string, init?: RequestInit) => Request;
472
413
  Response?: new (
473
- body?:
474
- | ArrayBuffer
475
- | ArrayBufferView
476
- | Blob
477
- | FormData
478
- | URLSearchParams
479
- | string
480
- | null,
481
- init?: ResponseInit,
414
+ body?: ArrayBuffer | ArrayBufferView | Blob | FormData | URLSearchParams | string | null,
415
+ init?: ResponseInit
482
416
  ) => Response;
483
417
  };
484
418
  formSerializer?: FormSerializerOptions;
@@ -490,26 +424,18 @@ export interface AxiosRequestConfig<D = any> {
490
424
  cb: (
491
425
  err: Error | null,
492
426
  address: LookupAddress | LookupAddress[],
493
- family?: AddressFamily,
494
- ) => void,
427
+ family?: AddressFamily
428
+ ) => void
495
429
  ) => void)
496
430
  | ((
497
431
  hostname: string,
498
- options: object,
432
+ options: object
499
433
  ) => Promise<
500
- | [
501
- address: LookupAddressEntry | LookupAddressEntry[],
502
- family?: AddressFamily,
503
- ]
504
- | LookupAddress
434
+ [address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress
505
435
  >);
506
- withXSRFToken?:
507
- | boolean
508
- | ((config: InternalAxiosRequestConfig) => boolean | undefined);
436
+ withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
509
437
  parseReviver?: (this: any, key: string, value: any) => any;
510
- fetchOptions?:
511
- | Omit<RequestInit, "body" | "headers" | "method" | "signal">
512
- | Record<string, any>;
438
+ fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
513
439
  httpVersion?: 1 | 2;
514
440
  http2Options?: Record<string, any> & {
515
441
  sessionTimeout?: number;
@@ -519,9 +445,7 @@ export interface AxiosRequestConfig<D = any> {
519
445
  // Alias
520
446
  export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
521
447
 
522
- export interface InternalAxiosRequestConfig<
523
- D = any,
524
- > extends AxiosRequestConfig<D> {
448
+ export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
525
449
  headers: AxiosRequestHeaders;
526
450
  }
527
451
 
@@ -539,17 +463,11 @@ export interface HeadersDefaults {
539
463
  unlink?: RawAxiosRequestHeaders;
540
464
  }
541
465
 
542
- export interface AxiosDefaults<D = any> extends Omit<
543
- AxiosRequestConfig<D>,
544
- "headers"
545
- > {
466
+ export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
546
467
  headers: HeadersDefaults;
547
468
  }
548
469
 
549
- export interface CreateAxiosDefaults<D = any> extends Omit<
550
- AxiosRequestConfig<D>,
551
- "headers"
552
- > {
470
+ export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
553
471
  headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
554
472
  }
555
473
 
@@ -568,7 +486,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
568
486
  code?: string,
569
487
  config?: InternalAxiosRequestConfig<D>,
570
488
  request?: any,
571
- response?: AxiosResponse<T, D>,
489
+ response?: AxiosResponse<T, D>
572
490
  );
573
491
 
574
492
  config?: InternalAxiosRequestConfig<D>;
@@ -586,24 +504,25 @@ export class AxiosError<T = unknown, D = any> extends Error {
586
504
  config?: InternalAxiosRequestConfig<D>,
587
505
  request?: any,
588
506
  response?: AxiosResponse<T, D>,
589
- customProps?: object,
507
+ customProps?: object
590
508
  ): AxiosError<T, D>;
591
- static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
592
- static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
593
- static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
594
- static readonly ERR_NETWORK = "ERR_NETWORK";
595
- static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
596
- static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
597
- static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
598
- static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
599
- static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
600
- static readonly ERR_CANCELED = "ERR_CANCELED";
601
- static readonly ECONNABORTED = "ECONNABORTED";
602
- static readonly ETIMEDOUT = "ETIMEDOUT";
509
+ static readonly ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
510
+ static readonly ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
511
+ static readonly ERR_BAD_OPTION = 'ERR_BAD_OPTION';
512
+ static readonly ERR_NETWORK = 'ERR_NETWORK';
513
+ static readonly ERR_DEPRECATED = 'ERR_DEPRECATED';
514
+ static readonly ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
515
+ static readonly ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
516
+ static readonly ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
517
+ static readonly ERR_INVALID_URL = 'ERR_INVALID_URL';
518
+ static readonly ERR_CANCELED = 'ERR_CANCELED';
519
+ static readonly ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
520
+ static readonly ECONNABORTED = 'ECONNABORTED';
521
+ static readonly ETIMEDOUT = 'ETIMEDOUT';
603
522
  }
604
523
 
605
524
  export class CanceledError<T> extends AxiosError<T> {
606
- readonly name: "CanceledError";
525
+ readonly name: 'CanceledError';
607
526
  }
608
527
 
609
528
  export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
@@ -638,7 +557,7 @@ export interface CancelTokenSource {
638
557
 
639
558
  export interface AxiosInterceptorOptions {
640
559
  synchronous?: boolean;
641
- runWhen?: (config: InternalAxiosRequestConfig) => boolean;
560
+ runWhen?: ((config: InternalAxiosRequestConfig) => boolean) | null;
642
561
  }
643
562
 
644
563
  type AxiosInterceptorFulfilled<T> = (value: T) => T | Promise<T>;
@@ -647,25 +566,23 @@ type AxiosInterceptorRejected = (error: any) => any;
647
566
  type AxiosRequestInterceptorUse<T> = (
648
567
  onFulfilled?: AxiosInterceptorFulfilled<T> | null,
649
568
  onRejected?: AxiosInterceptorRejected | null,
650
- options?: AxiosInterceptorOptions,
569
+ options?: AxiosInterceptorOptions
651
570
  ) => number;
652
571
 
653
572
  type AxiosResponseInterceptorUse<T> = (
654
573
  onFulfilled?: AxiosInterceptorFulfilled<T> | null,
655
- onRejected?: AxiosInterceptorRejected | null,
574
+ onRejected?: AxiosInterceptorRejected | null
656
575
  ) => number;
657
576
 
658
577
  interface AxiosInterceptorHandler<T> {
659
578
  fulfilled: AxiosInterceptorFulfilled<T>;
660
579
  rejected?: AxiosInterceptorRejected;
661
580
  synchronous: boolean;
662
- runWhen: (config: AxiosRequestConfig) => boolean | null;
581
+ runWhen?: ((config: InternalAxiosRequestConfig) => boolean) | null;
663
582
  }
664
583
 
665
584
  export interface AxiosInterceptorManager<V> {
666
- use: V extends AxiosResponse
667
- ? AxiosResponseInterceptorUse<V>
668
- : AxiosRequestInterceptorUse<V>;
585
+ use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
669
586
  eject(id: number): void;
670
587
  clear(): void;
671
588
  handlers?: Array<AxiosInterceptorHandler<V>>;
@@ -679,68 +596,61 @@ export class Axios {
679
596
  response: AxiosInterceptorManager<AxiosResponse>;
680
597
  };
681
598
  getUri(config?: AxiosRequestConfig): string;
682
- request<T = any, R = AxiosResponse<T>, D = any>(
683
- config: AxiosRequestConfig<D>,
684
- ): Promise<R>;
599
+ request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
685
600
  get<T = any, R = AxiosResponse<T>, D = any>(
686
601
  url: string,
687
- config?: AxiosRequestConfig<D>,
602
+ config?: AxiosRequestConfig<D>
688
603
  ): Promise<R>;
689
604
  delete<T = any, R = AxiosResponse<T>, D = any>(
690
605
  url: string,
691
- config?: AxiosRequestConfig<D>,
606
+ config?: AxiosRequestConfig<D>
692
607
  ): Promise<R>;
693
608
  head<T = any, R = AxiosResponse<T>, D = any>(
694
609
  url: string,
695
- config?: AxiosRequestConfig<D>,
610
+ config?: AxiosRequestConfig<D>
696
611
  ): Promise<R>;
697
612
  options<T = any, R = AxiosResponse<T>, D = any>(
698
613
  url: string,
699
- config?: AxiosRequestConfig<D>,
614
+ config?: AxiosRequestConfig<D>
700
615
  ): Promise<R>;
701
616
  post<T = any, R = AxiosResponse<T>, D = any>(
702
617
  url: string,
703
618
  data?: D,
704
- config?: AxiosRequestConfig<D>,
619
+ config?: AxiosRequestConfig<D>
705
620
  ): Promise<R>;
706
621
  put<T = any, R = AxiosResponse<T>, D = any>(
707
622
  url: string,
708
623
  data?: D,
709
- config?: AxiosRequestConfig<D>,
624
+ config?: AxiosRequestConfig<D>
710
625
  ): Promise<R>;
711
626
  patch<T = any, R = AxiosResponse<T>, D = any>(
712
627
  url: string,
713
628
  data?: D,
714
- config?: AxiosRequestConfig<D>,
629
+ config?: AxiosRequestConfig<D>
715
630
  ): Promise<R>;
716
631
  postForm<T = any, R = AxiosResponse<T>, D = any>(
717
632
  url: string,
718
633
  data?: D,
719
- config?: AxiosRequestConfig<D>,
634
+ config?: AxiosRequestConfig<D>
720
635
  ): Promise<R>;
721
636
  putForm<T = any, R = AxiosResponse<T>, D = any>(
722
637
  url: string,
723
638
  data?: D,
724
- config?: AxiosRequestConfig<D>,
639
+ config?: AxiosRequestConfig<D>
725
640
  ): Promise<R>;
726
641
  patchForm<T = any, R = AxiosResponse<T>, D = any>(
727
642
  url: string,
728
643
  data?: D,
729
- config?: AxiosRequestConfig<D>,
644
+ config?: AxiosRequestConfig<D>
730
645
  ): Promise<R>;
731
646
  }
732
647
 
733
648
  export interface AxiosInstance extends Axios {
734
- <T = any, R = AxiosResponse<T>, D = any>(
735
- config: AxiosRequestConfig<D>,
736
- ): Promise<R>;
737
- <T = any, R = AxiosResponse<T>, D = any>(
738
- url: string,
739
- config?: AxiosRequestConfig<D>,
740
- ): Promise<R>;
649
+ <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
650
+ <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
741
651
 
742
652
  create(config?: CreateAxiosDefaults): AxiosInstance;
743
- defaults: Omit<AxiosDefaults, "headers"> & {
653
+ defaults: Omit<AxiosDefaults, 'headers'> & {
744
654
  headers: HeadersDefaults & {
745
655
  [key: string]: AxiosHeaderValue;
746
656
  };
@@ -758,22 +668,18 @@ export interface GenericHTMLFormElement {
758
668
  }
759
669
 
760
670
  export function getAdapter(
761
- adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined,
671
+ adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined
762
672
  ): AxiosAdapter;
763
673
 
764
674
  export function toFormData(
765
675
  sourceObj: object,
766
676
  targetFormData?: GenericFormData,
767
- options?: FormSerializerOptions,
677
+ options?: FormSerializerOptions
768
678
  ): GenericFormData;
769
679
 
770
- export function formToJSON(
771
- form: GenericFormData | GenericHTMLFormElement,
772
- ): object;
680
+ export function formToJSON(form: GenericFormData | GenericHTMLFormElement): object;
773
681
 
774
- export function isAxiosError<T = any, D = any>(
775
- payload: any,
776
- ): payload is AxiosError<T, D>;
682
+ export function isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
777
683
 
778
684
  export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
779
685
 
@@ -783,7 +689,7 @@ export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
783
689
 
784
690
  export function mergeConfig<D = any>(
785
691
  config1: AxiosRequestConfig<D>,
786
- config2: AxiosRequestConfig<D>,
692
+ config2: AxiosRequestConfig<D>
787
693
  ): AxiosRequestConfig<D>;
788
694
 
789
695
  export interface AxiosStatic extends AxiosInstance {
@@ -66,18 +66,20 @@ const factory = (env) => {
66
66
  test(() => {
67
67
  let duplexAccessed = false;
68
68
 
69
- const body = new ReadableStream();
70
-
71
- const hasContentType = new Request(platform.origin, {
72
- body,
69
+ const request = new Request(platform.origin, {
70
+ body: new ReadableStream(),
73
71
  method: 'POST',
74
72
  get duplex() {
75
73
  duplexAccessed = true;
76
74
  return 'half';
77
75
  },
78
- }).headers.has('Content-Type');
76
+ });
77
+
78
+ const hasContentType = request.headers.has('Content-Type');
79
79
 
80
- body.cancel();
80
+ if (request.body != null) {
81
+ request.body.cancel();
82
+ }
81
83
 
82
84
  return duplexAccessed && !hasContentType;
83
85
  });
@@ -221,6 +223,19 @@ const factory = (env) => {
221
223
  // see https://github.com/cloudflare/workerd/issues/902
222
224
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
223
225
 
226
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
227
+ // delete it so fetch can set it correctly with the boundary
228
+ if (utils.isFormData(data)) {
229
+ const contentType = headers.getContentType();
230
+ if (
231
+ contentType &&
232
+ /^multipart\/form-data/i.test(contentType) &&
233
+ !/boundary=/i.test(contentType)
234
+ ) {
235
+ headers.delete('content-type');
236
+ }
237
+ }
238
+
224
239
  const resolvedOptions = {
225
240
  ...fetchOptions,
226
241
  signal: composedSignal,