@membranehq/sdk 0.29.0 → 0.29.2

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 (56) hide show
  1. package/dist/bundle.d.ts +97 -2
  2. package/dist/bundle.js +1055 -274
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/connections-accessors.d.ts +5 -0
  5. package/dist/dts/accessors/integrations-accessors.d.ts +2 -0
  6. package/dist/dts/agent/harness-snapshot.d.ts +65 -0
  7. package/dist/dts/agent/harness.d.ts +107 -0
  8. package/dist/dts/agent/index.d.ts +6 -0
  9. package/dist/dts/agent/instruction.d.ts +32 -0
  10. package/dist/dts/agent/session.d.ts +5 -2
  11. package/dist/dts/agent/skill.d.ts +50 -0
  12. package/dist/dts/agent/tool.d.ts +8 -0
  13. package/dist/dts/agent/worker-contracts.d.ts +2 -0
  14. package/dist/dts/agent/workspace-element-context.d.ts +3 -0
  15. package/dist/dts/data-schema/types.d.ts +1 -1
  16. package/dist/dts/index.browser.d.ts +1 -0
  17. package/dist/dts/mcp-client/index.d.ts +76 -0
  18. package/dist/dts/orgs/types.d.ts +528 -1
  19. package/dist/dts/scenario-templates/index.d.ts +1 -0
  20. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +18 -0
  21. package/dist/dts/workspace-elements/api/checkpoints-api.d.ts +1 -0
  22. package/dist/dts/workspace-elements/api/connections-api.d.ts +47 -0
  23. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +9 -0
  24. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +18 -0
  25. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +9 -0
  26. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +14 -0
  27. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +10 -0
  28. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +9 -0
  29. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +18 -0
  30. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +18 -0
  31. package/dist/dts/workspace-elements/api/flows-api.d.ts +18 -0
  32. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +9 -0
  33. package/dist/dts/workspace-elements/api/integrations-api.d.ts +18 -0
  34. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
  35. package/dist/dts/workspace-elements/base/connections/index.d.ts +23 -0
  36. package/dist/dts/workspace-elements/base/connectors/auth.d.ts +6 -0
  37. package/dist/dts/workspace-elements/base/connectors/index.d.ts +208 -0
  38. package/dist/dts/workspace-elements/base/connectors/rest-api.d.ts +1 -0
  39. package/dist/dts/workspace-elements/base/external-event-log-records/index.d.ts +14 -0
  40. package/dist/dts/workspace-elements/base/external-event-pulls/index.d.ts +50 -0
  41. package/dist/dts/workspace-elements/paths.d.ts +1 -0
  42. package/dist/dts/workspace-elements/types.d.ts +4 -1
  43. package/dist/dts/workspaces/api.d.ts +1 -0
  44. package/dist/index.browser.d.mts +1555 -150
  45. package/dist/index.browser.d.ts +1555 -150
  46. package/dist/index.browser.js +452 -19
  47. package/dist/index.browser.js.map +1 -1
  48. package/dist/index.browser.mjs +416 -20
  49. package/dist/index.browser.mjs.map +1 -1
  50. package/dist/index.node.d.mts +1555 -150
  51. package/dist/index.node.d.ts +1555 -150
  52. package/dist/index.node.js +452 -19
  53. package/dist/index.node.js.map +1 -1
  54. package/dist/index.node.mjs +416 -20
  55. package/dist/index.node.mjs.map +1 -1
  56. package/package.json +2 -2
package/dist/bundle.js CHANGED
@@ -22307,6 +22307,9 @@
22307
22307
  WorkspaceElementType["ExternalApiLogRecord"] = "external-api-log-record";
22308
22308
  WorkspaceElementType["IncomingWebhookLogRecord"] = "incoming-webhook-log-record";
22309
22309
  WorkspaceElementType["ConnectedProduct"] = "connected-product";
22310
+ WorkspaceElementType["AgentHarness"] = "agent-harness";
22311
+ WorkspaceElementType["AgentSkill"] = "agent-skill";
22312
+ WorkspaceElementType["AgentInstruction"] = "agent-instruction";
22310
22313
  })(WorkspaceElementType || (WorkspaceElementType = {}));
22311
22314
  var WorkspaceEventType;
22312
22315
  (function (WorkspaceEventType) {
@@ -22852,12 +22855,12 @@
22852
22855
  }
22853
22856
  }
22854
22857
 
22855
- var ConnectionType;
22856
- (function (ConnectionType) {
22857
- ConnectionType["IFRAME"] = "iframe";
22858
- ConnectionType["POPUP"] = "popup";
22859
- ConnectionType["REDIRECT"] = "redirect";
22860
- })(ConnectionType || (ConnectionType = {}));
22858
+ var ConnectionDisplayMode;
22859
+ (function (ConnectionDisplayMode) {
22860
+ ConnectionDisplayMode["IFRAME"] = "iframe";
22861
+ ConnectionDisplayMode["POPUP"] = "popup";
22862
+ ConnectionDisplayMode["REDIRECT"] = "redirect";
22863
+ })(ConnectionDisplayMode || (ConnectionDisplayMode = {}));
22861
22864
  class ConnectionsAccessor extends ElementInstanceListAccessor {
22862
22865
  constructor(client) {
22863
22866
  super(client, 'connections');
@@ -23021,10 +23024,10 @@
23021
23024
  }
23022
23025
  }
23023
23026
  async function createOrUpdateConnection(options) {
23024
- const { client, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, lateEvents, } = options !== null && options !== void 0 ? options : {};
23025
- let connectionType = await detectConnectionType(options);
23027
+ const { client, type, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, customState, onPopupClosed, lateEvents, } = options !== null && options !== void 0 ? options : {};
23028
+ let connectionType = type === 'mcp' ? ConnectionDisplayMode.POPUP : await detectConnectionType(options);
23026
23029
  if (redirectUri) {
23027
- connectionType = ConnectionType.REDIRECT;
23030
+ connectionType = ConnectionDisplayMode.REDIRECT;
23028
23031
  }
23029
23032
  const freshToken = await client.getToken();
23030
23033
  const connectPath = 'connect';
@@ -23033,6 +23036,7 @@
23033
23036
  const requestId = simpleUniqueId() + simpleUniqueId();
23034
23037
  const payload = {
23035
23038
  token: freshToken,
23039
+ type,
23036
23040
  input,
23037
23041
  connectorParameters,
23038
23042
  integrationKey,
@@ -23047,6 +23051,7 @@
23047
23051
  connectionRequestId,
23048
23052
  requestId,
23049
23053
  redirectUri,
23054
+ customState,
23050
23055
  };
23051
23056
  let cancelCheckInterval;
23052
23057
  let lateEventsTimeout;
@@ -23110,7 +23115,7 @@
23110
23115
  input.value = JSON.stringify(payload);
23111
23116
  form.appendChild(input);
23112
23117
  document.body.appendChild(form);
23113
- if (connectionType === ConnectionType.IFRAME) {
23118
+ if (connectionType === ConnectionDisplayMode.IFRAME) {
23114
23119
  const iframeElement = document.createElement('iframe');
23115
23120
  iframeElement.id = targetElementId;
23116
23121
  iframeElement.name = targetElementId;
@@ -23125,12 +23130,12 @@
23125
23130
  form.submit();
23126
23131
  document.body.removeChild(form);
23127
23132
  }
23128
- if (connectionType === ConnectionType.REDIRECT) {
23133
+ if (connectionType === ConnectionDisplayMode.REDIRECT) {
23129
23134
  form.target = '_self';
23130
23135
  form.submit();
23131
23136
  document.body.removeChild(form);
23132
23137
  }
23133
- if (connectionType === ConnectionType.POPUP) {
23138
+ if (connectionType === ConnectionDisplayMode.POPUP) {
23134
23139
  const width = Math.min(Math.round(screen.width * 0.7), 1000);
23135
23140
  const height = Math.min(Math.round(screen.height * 0.6), 800);
23136
23141
  const left = Math.round((screen.width - width) / 2);
@@ -23179,9 +23184,9 @@
23179
23184
  });
23180
23185
  const option = connectionOptions.find((option) => option.key == authOptionKey);
23181
23186
  if ((option === null || option === void 0 ? void 0 : option.type) === 'client-credentials') {
23182
- return ConnectionType.IFRAME;
23187
+ return ConnectionDisplayMode.IFRAME;
23183
23188
  }
23184
- return ConnectionType.POPUP;
23189
+ return ConnectionDisplayMode.POPUP;
23185
23190
  }
23186
23191
  const createCrossWindowListener = ({ requestId, handlers, }) => {
23187
23192
  const listener = (event) => {
@@ -23596,7 +23601,7 @@
23596
23601
  }
23597
23602
  }
23598
23603
 
23599
- /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23604
+ /*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23600
23605
  /**
23601
23606
  * Create a bound version of a function with a specified `this` context
23602
23607
  *
@@ -23616,6 +23621,57 @@
23616
23621
  const { getPrototypeOf } = Object;
23617
23622
  const { iterator, toStringTag } = Symbol;
23618
23623
 
23624
+ /* Creating a function that will check if an object has a property. */
23625
+ const hasOwnProperty = (
23626
+ ({ hasOwnProperty }) =>
23627
+ (obj, prop) =>
23628
+ hasOwnProperty.call(obj, prop)
23629
+ )(Object.prototype);
23630
+
23631
+ /**
23632
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
23633
+ * an own `prop`. This distinguishes genuine own/inherited members — including
23634
+ * class accessors and template prototypes — from members injected via
23635
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
23636
+ * live on Object.prototype itself and are therefore never matched.
23637
+ *
23638
+ * @param {*} thing The value whose chain to inspect
23639
+ * @param {string|symbol} prop The property key to look for
23640
+ *
23641
+ * @returns {boolean} True when `prop` is owned below Object.prototype
23642
+ */
23643
+ const hasOwnInPrototypeChain = (thing, prop) => {
23644
+ let obj = thing;
23645
+ const seen = [];
23646
+
23647
+ while (obj != null && obj !== Object.prototype) {
23648
+ if (seen.indexOf(obj) !== -1) {
23649
+ return false;
23650
+ }
23651
+ seen.push(obj);
23652
+
23653
+ if (hasOwnProperty(obj, prop)) {
23654
+ return true;
23655
+ }
23656
+ obj = getPrototypeOf(obj);
23657
+ }
23658
+ return false;
23659
+ };
23660
+
23661
+ /**
23662
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
23663
+ * properties and members inherited from a non-Object.prototype source (a class
23664
+ * instance or template object) are honored; a value reachable only through a
23665
+ * polluted Object.prototype is ignored and `undefined` is returned.
23666
+ *
23667
+ * @param {*} obj The source object
23668
+ * @param {string|symbol} prop The property key to read
23669
+ *
23670
+ * @returns {*} The resolved value, or undefined when unsafe/absent
23671
+ */
23672
+ const getSafeProp = (obj, prop) =>
23673
+ obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
23674
+
23619
23675
  const kindOf = ((cache) => (thing) => {
23620
23676
  const str = toString.call(thing);
23621
23677
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -23741,7 +23797,7 @@
23741
23797
  * @returns {boolean} True if value is a plain Object, otherwise false
23742
23798
  */
23743
23799
  const isPlainObject = (val) => {
23744
- if (kindOf(val) !== 'object') {
23800
+ if (!isObject(val)) {
23745
23801
  return false;
23746
23802
  }
23747
23803
 
@@ -23749,9 +23805,12 @@
23749
23805
  return (
23750
23806
  (prototype === null ||
23751
23807
  prototype === Object.prototype ||
23752
- Object.getPrototypeOf(prototype) === null) &&
23753
- !(toStringTag in val) &&
23754
- !(iterator in val)
23808
+ getPrototypeOf(prototype) === null) &&
23809
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
23810
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
23811
+ // than a plain object, while ignoring keys injected onto Object.prototype.
23812
+ !hasOwnInPrototypeChain(val, toStringTag) &&
23813
+ !hasOwnInPrototypeChain(val, iterator)
23755
23814
  );
23756
23815
  };
23757
23816
 
@@ -23836,6 +23895,7 @@
23836
23895
  * @returns {boolean} True if value is a FileList, otherwise false
23837
23896
  */
23838
23897
  const isFileList = kindOfTest('FileList');
23898
+ const isSet = kindOfTest('Set');
23839
23899
 
23840
23900
  /**
23841
23901
  * Determine if a value is a Stream
@@ -24020,7 +24080,9 @@
24020
24080
  return;
24021
24081
  }
24022
24082
 
24023
- const targetKey = (caseless && findKey(result, key)) || key;
24083
+ // findKey lowercases the key, so caseless lookup only applies to strings —
24084
+ // symbol keys are identity-matched.
24085
+ const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
24024
24086
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
24025
24087
  // chain, so a polluted Object.prototype value could surface here and get
24026
24088
  // copied into the merged result.
@@ -24037,7 +24099,24 @@
24037
24099
  };
24038
24100
 
24039
24101
  for (let i = 0, l = objs.length; i < l; i++) {
24040
- objs[i] && forEach(objs[i], assignValue);
24102
+ const source = objs[i];
24103
+ if (!source || isBuffer(source)) {
24104
+ continue;
24105
+ }
24106
+
24107
+ forEach(source, assignValue);
24108
+
24109
+ if (typeof source !== 'object' || isArray(source)) {
24110
+ continue;
24111
+ }
24112
+
24113
+ const symbols = Object.getOwnPropertySymbols(source);
24114
+ for (let j = 0; j < symbols.length; j++) {
24115
+ const symbol = symbols[j];
24116
+ if (propertyIsEnumerable.call(source, symbol)) {
24117
+ assignValue(source[symbol], symbol);
24118
+ }
24119
+ }
24041
24120
  }
24042
24121
  return result;
24043
24122
  }
@@ -24259,12 +24338,7 @@
24259
24338
  });
24260
24339
  };
24261
24340
 
24262
- /* Creating a function that will check if an object has a property. */
24263
- const hasOwnProperty = (
24264
- ({ hasOwnProperty }) =>
24265
- (obj, prop) =>
24266
- hasOwnProperty.call(obj, prop)
24267
- )(Object.prototype);
24341
+ const { propertyIsEnumerable } = Object.prototype;
24268
24342
 
24269
24343
  /**
24270
24344
  * Determine if a value is a RegExp object
@@ -24371,11 +24445,11 @@
24371
24445
  * @returns {Object} The JSON-compatible object.
24372
24446
  */
24373
24447
  const toJSONObject = (obj) => {
24374
- const stack = new Array(10);
24448
+ const visited = new WeakSet();
24375
24449
 
24376
- const visit = (source, i) => {
24450
+ const visit = (source) => {
24377
24451
  if (isObject(source)) {
24378
- if (stack.indexOf(source) >= 0) {
24452
+ if (visited.has(source)) {
24379
24453
  return;
24380
24454
  }
24381
24455
 
@@ -24385,15 +24459,27 @@
24385
24459
  }
24386
24460
 
24387
24461
  if (!('toJSON' in source)) {
24388
- stack[i] = source;
24389
- const target = isArray(source) ? [] : {};
24462
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
24463
+ visited.add(source);
24390
24464
 
24391
- forEach(source, (value, key) => {
24392
- const reducedValue = visit(value, i + 1);
24393
- !isUndefined(reducedValue) && (target[key] = reducedValue);
24394
- });
24465
+ let target;
24466
+
24467
+ if (isSet(source)) {
24468
+ target = [];
24469
+ for (const value of source) {
24470
+ const reducedValue = visit(value);
24471
+ !isUndefined(reducedValue) && target.push(reducedValue);
24472
+ }
24473
+ } else {
24474
+ target = isArray(source) ? [] : {};
24475
+
24476
+ forEach(source, (value, key) => {
24477
+ const reducedValue = visit(value);
24478
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
24479
+ });
24480
+ }
24395
24481
 
24396
- stack[i] = undefined;
24482
+ visited.delete(source);
24397
24483
 
24398
24484
  return target;
24399
24485
  }
@@ -24402,7 +24488,7 @@
24402
24488
  return source;
24403
24489
  };
24404
24490
 
24405
- return visit(obj, 0);
24491
+ return visit(obj);
24406
24492
  };
24407
24493
 
24408
24494
  /**
@@ -24476,6 +24562,20 @@
24476
24562
 
24477
24563
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
24478
24564
 
24565
+ /**
24566
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
24567
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
24568
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
24569
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
24570
+ * into an attacker-controlled entries iterator.
24571
+ *
24572
+ * @param {*} thing The value to test
24573
+ *
24574
+ * @returns {boolean} True if value has a non-polluted iterator
24575
+ */
24576
+ const isSafeIterable = (thing) =>
24577
+ thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
24578
+
24479
24579
  var utils$1 = {
24480
24580
  isArray,
24481
24581
  isArrayBuffer,
@@ -24520,6 +24620,8 @@
24520
24620
  isHTMLForm,
24521
24621
  hasOwnProperty,
24522
24622
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
24623
+ hasOwnInPrototypeChain,
24624
+ getSafeProp,
24523
24625
  reduceDescriptors,
24524
24626
  freezeMethods,
24525
24627
  toObjectSet,
@@ -24536,6 +24638,7 @@
24536
24638
  setImmediate: _setImmediate,
24537
24639
  asap,
24538
24640
  isIterable,
24641
+ isSafeIterable,
24539
24642
  };
24540
24643
 
24541
24644
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -24586,28 +24689,26 @@
24586
24689
  key = line.substring(0, i).trim().toLowerCase();
24587
24690
  val = line.substring(i + 1).trim();
24588
24691
 
24589
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
24692
+ const hasKey = utils$1.hasOwnProp(parsed, key);
24693
+
24694
+ if (!key || (hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key))) {
24590
24695
  return;
24591
24696
  }
24592
24697
 
24593
24698
  if (key === 'set-cookie') {
24594
- if (parsed[key]) {
24699
+ if (hasKey) {
24595
24700
  parsed[key].push(val);
24596
24701
  } else {
24597
24702
  parsed[key] = [val];
24598
24703
  }
24599
24704
  } else {
24600
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
24705
+ parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
24601
24706
  }
24602
24707
  });
24603
24708
 
24604
24709
  return parsed;
24605
24710
  };
24606
24711
 
24607
- const $internals = Symbol('internals');
24608
-
24609
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
24610
-
24611
24712
  function trimSPorHTAB(str) {
24612
24713
  let start = 0;
24613
24714
  let end = str.length;
@@ -24635,12 +24736,40 @@
24635
24736
  return start === 0 && end === str.length ? str : str.slice(start, end);
24636
24737
  }
24637
24738
 
24638
- function normalizeHeader(header) {
24639
- return header && String(header).trim().toLowerCase();
24739
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
24740
+ // eslint-disable-next-line no-control-regex
24741
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
24742
+ // eslint-disable-next-line no-control-regex
24743
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
24744
+
24745
+ function sanitizeValue(value, invalidChars) {
24746
+ if (utils$1.isArray(value)) {
24747
+ return value.map((item) => sanitizeValue(item, invalidChars));
24748
+ }
24749
+
24750
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
24751
+ }
24752
+
24753
+ const sanitizeHeaderValue = (value) =>
24754
+ sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
24755
+
24756
+ const sanitizeByteStringHeaderValue = (value) =>
24757
+ sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
24758
+
24759
+ function toByteStringHeaderObject(headers) {
24760
+ const byteStringHeaders = Object.create(null);
24761
+
24762
+ utils$1.forEach(headers.toJSON(), (value, header) => {
24763
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
24764
+ });
24765
+
24766
+ return byteStringHeaders;
24640
24767
  }
24641
24768
 
24642
- function sanitizeHeaderValue(str) {
24643
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
24769
+ const $internals = Symbol('internals');
24770
+
24771
+ function normalizeHeader(header) {
24772
+ return header && String(header).trim().toLowerCase();
24644
24773
  }
24645
24774
 
24646
24775
  function normalizeValue(value) {
@@ -24663,6 +24792,124 @@
24663
24792
  return tokens;
24664
24793
  }
24665
24794
 
24795
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
24796
+
24797
+ function trimOWS(value) {
24798
+ let start = 0;
24799
+ let end = value.length;
24800
+
24801
+ while (start < end) {
24802
+ const code = value.charCodeAt(start);
24803
+
24804
+ if (code !== 0x09 && code !== 0x20) {
24805
+ break;
24806
+ }
24807
+
24808
+ start += 1;
24809
+ }
24810
+
24811
+ while (end > start) {
24812
+ const code = value.charCodeAt(end - 1);
24813
+
24814
+ if (code !== 0x09 && code !== 0x20) {
24815
+ break;
24816
+ }
24817
+
24818
+ end -= 1;
24819
+ }
24820
+
24821
+ return start === 0 && end === value.length ? value : value.slice(start, end);
24822
+ }
24823
+
24824
+ function decodeQuotedString(value) {
24825
+ const last = value.length - 1;
24826
+
24827
+ if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
24828
+ return value;
24829
+ }
24830
+
24831
+ let decoded = '';
24832
+
24833
+ for (let i = 1; i < last; i++) {
24834
+ const code = value.charCodeAt(i);
24835
+
24836
+ if (code === 0x22) {
24837
+ return value;
24838
+ }
24839
+
24840
+ if (code === 0x5c) {
24841
+ i += 1;
24842
+
24843
+ if (i >= last) {
24844
+ return value;
24845
+ }
24846
+ }
24847
+
24848
+ decoded += value[i];
24849
+ }
24850
+
24851
+ return decoded;
24852
+ }
24853
+
24854
+ function parseParameters(value) {
24855
+ const parameters = Object.create(null);
24856
+ const str = String(value);
24857
+ let start = 0;
24858
+ let quoted = false;
24859
+ let escaped = false;
24860
+
24861
+ function parseParameter(end) {
24862
+ const part = trimOWS(str.slice(start, end));
24863
+ const equals = part.indexOf('=');
24864
+
24865
+ if (equals < 1) {
24866
+ return;
24867
+ }
24868
+
24869
+ const name = trimOWS(part.slice(0, equals));
24870
+
24871
+ if (!parameterNameRE.test(name)) {
24872
+ return;
24873
+ }
24874
+
24875
+ const normalizedName = name.toLowerCase();
24876
+
24877
+ if (
24878
+ normalizedName === '__proto__' ||
24879
+ normalizedName === 'constructor' ||
24880
+ normalizedName === 'prototype'
24881
+ ) {
24882
+ return;
24883
+ }
24884
+
24885
+ const parameterValue = trimOWS(part.slice(equals + 1));
24886
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
24887
+ }
24888
+
24889
+ for (let i = 0; i < str.length; i++) {
24890
+ const code = str.charCodeAt(i);
24891
+
24892
+ if (quoted) {
24893
+ if (escaped) {
24894
+ escaped = false;
24895
+ } else if (code === 0x5c) {
24896
+ escaped = true;
24897
+ } else if (code === 0x22) {
24898
+ quoted = false;
24899
+ }
24900
+ } else if (code === 0x22) {
24901
+ quoted = true;
24902
+ } else if (code === 0x2c || code === 0x3b) {
24903
+ parseParameter(i);
24904
+ start = i + 1;
24905
+ }
24906
+ }
24907
+
24908
+ parseParameter(str.length);
24909
+
24910
+ return parameters;
24911
+ }
24912
+
24666
24913
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
24667
24914
 
24668
24915
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
@@ -24722,7 +24969,7 @@
24722
24969
  const lHeader = normalizeHeader(_header);
24723
24970
 
24724
24971
  if (!lHeader) {
24725
- throw new Error('header name must be a non-empty string');
24972
+ return;
24726
24973
  }
24727
24974
 
24728
24975
  const key = utils$1.findKey(self, lHeader);
@@ -24744,20 +24991,23 @@
24744
24991
  setHeaders(header, valueOrRewrite);
24745
24992
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
24746
24993
  setHeaders(parseHeaders(header), valueOrRewrite);
24747
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
24748
- let obj = {},
24994
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
24995
+ let obj = Object.create(null),
24749
24996
  dest,
24750
24997
  key;
24751
24998
  for (const entry of header) {
24752
24999
  if (!utils$1.isArray(entry)) {
24753
- throw TypeError('Object iterator must return a key-value pair');
25000
+ throw new TypeError('Object iterator must return a key-value pair');
24754
25001
  }
24755
25002
 
24756
- obj[(key = entry[0])] = (dest = obj[key])
24757
- ? utils$1.isArray(dest)
24758
- ? [...dest, entry[1]]
24759
- : [dest, entry[1]]
24760
- : entry[1];
25003
+ key = entry[0];
25004
+
25005
+ if (utils$1.hasOwnProp(obj, key)) {
25006
+ dest = obj[key];
25007
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
25008
+ } else {
25009
+ obj[key] = entry[1];
25010
+ }
24761
25011
  }
24762
25012
 
24763
25013
  setHeaders(obj, valueOrRewrite);
@@ -24911,7 +25161,8 @@
24911
25161
  }
24912
25162
 
24913
25163
  getSetCookie() {
24914
- return this.get('set-cookie') || [];
25164
+ const value = this.get('set-cookie');
25165
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
24915
25166
  }
24916
25167
 
24917
25168
  get [Symbol.toStringTag]() {
@@ -24922,6 +25173,10 @@
24922
25173
  return thing instanceof this ? thing : new this(thing);
24923
25174
  }
24924
25175
 
25176
+ static parseParameters(value) {
25177
+ return parseParameters(value);
25178
+ }
25179
+
24925
25180
  static concat(first, ...targets) {
24926
25181
  const computed = new this(first);
24927
25182
 
@@ -25047,10 +25302,53 @@
25047
25302
  return visit(config);
25048
25303
  }
25049
25304
 
25305
+ function stringifySafely$1(value) {
25306
+ try {
25307
+ return String(value);
25308
+ } catch (err) {
25309
+ return '';
25310
+ }
25311
+ }
25312
+
25313
+ function aggregateErrorMessage(error) {
25314
+ const message = error.errors
25315
+ .map((entry) => {
25316
+ try {
25317
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
25318
+ } catch (err) {
25319
+ return '';
25320
+ }
25321
+ })
25322
+ .filter(Boolean)
25323
+ .join('; ');
25324
+
25325
+ return message || error.name || 'AggregateError';
25326
+ }
25327
+
25050
25328
  let AxiosError$1 = class AxiosError extends Error {
25051
25329
  static from(error, code, config, request, response, customProps) {
25052
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
25053
- axiosError.cause = error;
25330
+ // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
25331
+ // failures) has an empty `message`; its detail lives in `errors[]`. Without
25332
+ // this, the wrapped error surfaces with a blank message (see #6721).
25333
+ let message = error.message;
25334
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
25335
+ message = aggregateErrorMessage(error);
25336
+ }
25337
+
25338
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
25339
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
25340
+ // error often carries circular internals (sockets, requests, agents), so
25341
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
25342
+ // own-property walk throw "Converting circular structure to JSON".
25343
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
25344
+ // `message` descriptor below (prototype-pollution-safe descriptor).
25345
+ Object.defineProperty(axiosError, 'cause', {
25346
+ __proto__: null,
25347
+ value: error,
25348
+ writable: true,
25349
+ enumerable: false,
25350
+ configurable: true,
25351
+ });
25054
25352
  axiosError.name = error.name;
25055
25353
 
25056
25354
  // Preserve status from the original error if not already set from response
@@ -25151,6 +25449,10 @@
25151
25449
  // eslint-disable-next-line strict
25152
25450
  var httpAdapter = null;
25153
25451
 
25452
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
25453
+ // the FormData <-> JSON round-trip stays symmetric.
25454
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
25455
+
25154
25456
  /**
25155
25457
  * Determines if the given thing is a array or js object.
25156
25458
  *
@@ -25261,8 +25563,9 @@
25261
25563
  const dots = options.dots;
25262
25564
  const indexes = options.indexes;
25263
25565
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
25264
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
25566
+ const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
25265
25567
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
25568
+ const stack = [];
25266
25569
 
25267
25570
  if (!utils$1.isFunction(visitor)) {
25268
25571
  throw new TypeError('visitor must be a function');
@@ -25284,12 +25587,47 @@
25284
25587
  }
25285
25588
 
25286
25589
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
25287
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
25590
+ if (useBlob && typeof _Blob === 'function') {
25591
+ return new _Blob([value]);
25592
+ }
25593
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.', AxiosError$1.ERR_NOT_SUPPORT);
25288
25594
  }
25289
25595
 
25290
25596
  return value;
25291
25597
  }
25292
25598
 
25599
+ function throwIfMaxDepthExceeded(depth) {
25600
+ if (depth > maxDepth) {
25601
+ throw new AxiosError$1(
25602
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
25603
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
25604
+ );
25605
+ }
25606
+ }
25607
+
25608
+ function stringifyWithDepthLimit(value, depth) {
25609
+ if (maxDepth === Infinity) {
25610
+ return JSON.stringify(value);
25611
+ }
25612
+
25613
+ const ancestors = [];
25614
+
25615
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
25616
+ if (!utils$1.isObject(currentValue)) {
25617
+ return currentValue;
25618
+ }
25619
+
25620
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
25621
+ ancestors.pop();
25622
+ }
25623
+
25624
+ ancestors.push(currentValue);
25625
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
25626
+
25627
+ return currentValue;
25628
+ });
25629
+ }
25630
+
25293
25631
  /**
25294
25632
  * Default visitor.
25295
25633
  *
@@ -25313,7 +25651,7 @@
25313
25651
  // eslint-disable-next-line no-param-reassign
25314
25652
  key = metaTokens ? key : key.slice(0, -2);
25315
25653
  // eslint-disable-next-line no-param-reassign
25316
- value = JSON.stringify(value);
25654
+ value = stringifyWithDepthLimit(value, 1);
25317
25655
  } else if (
25318
25656
  (utils$1.isArray(value) && isFlatArray(value)) ||
25319
25657
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -25346,8 +25684,6 @@
25346
25684
  return false;
25347
25685
  }
25348
25686
 
25349
- const stack = [];
25350
-
25351
25687
  const exposedHelpers = Object.assign(predicates, {
25352
25688
  defaultVisitor,
25353
25689
  convertValue,
@@ -25357,15 +25693,10 @@
25357
25693
  function build(value, path, depth = 0) {
25358
25694
  if (utils$1.isUndefined(value)) return;
25359
25695
 
25360
- if (depth > maxDepth) {
25361
- throw new AxiosError$1(
25362
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
25363
- AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
25364
- );
25365
- }
25696
+ throwIfMaxDepthExceeded(depth);
25366
25697
 
25367
25698
  if (stack.indexOf(value) !== -1) {
25368
- throw Error('Circular reference detected in ' + path.join('.'));
25699
+ throw new Error('Circular reference detected in ' + path.join('.'));
25369
25700
  }
25370
25701
 
25371
25702
  stack.push(value);
@@ -25436,9 +25767,7 @@
25436
25767
 
25437
25768
  prototype.toString = function toString(encoder) {
25438
25769
  const _encode = encoder
25439
- ? function (value) {
25440
- return encoder.call(this, value, encode$1);
25441
- }
25770
+ ? (value) => encoder.call(this, value, encode$1)
25442
25771
  : encode$1;
25443
25772
 
25444
25773
  return this._pairs
@@ -25477,8 +25806,7 @@
25477
25806
  if (!params) {
25478
25807
  return url;
25479
25808
  }
25480
-
25481
- const _encode = (options && options.encode) || encode;
25809
+ url = url || '';
25482
25810
 
25483
25811
  const _options = utils$1.isFunction(options)
25484
25812
  ? {
@@ -25486,7 +25814,11 @@
25486
25814
  }
25487
25815
  : options;
25488
25816
 
25489
- const serializeFn = _options && _options.serialize;
25817
+ // Read serializer options pollution-safely: own properties and methods on a
25818
+ // class/template prototype are honored, but values injected onto a polluted
25819
+ // Object.prototype are ignored.
25820
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
25821
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
25490
25822
 
25491
25823
  let serializedParams;
25492
25824
 
@@ -25582,6 +25914,8 @@
25582
25914
  forcedJSONParsing: true,
25583
25915
  clarifyTimeoutError: false,
25584
25916
  legacyInterceptorReqResOrdering: true,
25917
+ advertiseZstdAcceptEncoding: false,
25918
+ validateStatusUndefinedResolves: true,
25585
25919
  };
25586
25920
 
25587
25921
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -25673,6 +26007,17 @@
25673
26007
  });
25674
26008
  }
25675
26009
 
26010
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
26011
+
26012
+ function throwIfDepthExceeded(index) {
26013
+ if (index > MAX_DEPTH) {
26014
+ throw new AxiosError$1(
26015
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
26016
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
26017
+ );
26018
+ }
26019
+ }
26020
+
25676
26021
  /**
25677
26022
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25678
26023
  *
@@ -25681,13 +26026,26 @@
25681
26026
  * @returns An array of strings.
25682
26027
  */
25683
26028
  function parsePropPath(name) {
25684
- // foo[x][y][z]
25685
- // foo.x.y.z
25686
- // foo-x-y-z
25687
- // foo x y z
25688
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
25689
- return match[0] === '[]' ? '' : match[1] || match[0];
25690
- });
26029
+ // foo[x][y][z] -> ['foo', 'x', 'y', 'z']
26030
+ // foo.x.y.z -> ['foo', 'x', 'y', 'z']
26031
+ // A path is split on `.` and on `[...]` groups. A segment — whether written
26032
+ // in dot notation or captured inside brackets — may contain any character
26033
+ // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
26034
+ // literal instead of being split (#5402). `.`, `[` and `]` keep their existing
26035
+ // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
26036
+ // Excluding `[` from the bracket group also makes the match fail fast at the
26037
+ // next `[`, so a malformed name cannot rescan to the end of the string from
26038
+ // every unmatched `[` — parsing stays linear in the length of the name.
26039
+ const path = [];
26040
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
26041
+ let match;
26042
+
26043
+ while ((match = pattern.exec(name)) !== null) {
26044
+ throwIfDepthExceeded(path.length);
26045
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
26046
+ }
26047
+
26048
+ return path;
25691
26049
  }
25692
26050
 
25693
26051
  /**
@@ -25719,6 +26077,8 @@
25719
26077
  */
25720
26078
  function formDataToJSON(formData) {
25721
26079
  function buildPath(path, value, target, index) {
26080
+ throwIfDepthExceeded(index);
26081
+
25722
26082
  let name = path[index++];
25723
26083
 
25724
26084
  if (name === '__proto__') return true;
@@ -25739,7 +26099,7 @@
25739
26099
  return !isNumericKey;
25740
26100
  }
25741
26101
 
25742
- if (!target[name] || !utils$1.isObject(target[name])) {
26102
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
25743
26103
  target[name] = [];
25744
26104
  }
25745
26105
 
@@ -26104,9 +26464,12 @@
26104
26464
  const _speedometer = speedometer(50, 250);
26105
26465
 
26106
26466
  return throttle((e) => {
26467
+ if (!e || typeof e.loaded !== 'number') {
26468
+ return;
26469
+ }
26107
26470
  const rawLoaded = e.loaded;
26108
26471
  const total = e.lengthComputable ? e.total : undefined;
26109
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
26472
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
26110
26473
  const progressBytes = Math.max(0, loaded - bytesNotified);
26111
26474
  const rate = _speedometer(progressBytes);
26112
26475
 
@@ -26143,9 +26506,9 @@
26143
26506
  };
26144
26507
 
26145
26508
  const asyncDecorator =
26146
- (fn) =>
26509
+ (fn, scheduler = utils$1.asap) =>
26147
26510
  (...args) =>
26148
- utils$1.asap(() => fn(...args));
26511
+ scheduler(() => fn(...args));
26149
26512
 
26150
26513
  var isURLSameOrigin = platform.hasStandardBrowserEnv
26151
26514
  ? ((origin, isMSIE) => (url) => {
@@ -26201,7 +26564,11 @@
26201
26564
  const cookie = cookies[i].replace(/^\s+/, '');
26202
26565
  const eq = cookie.indexOf('=');
26203
26566
  if (eq !== -1 && cookie.slice(0, eq) === name) {
26204
- return decodeURIComponent(cookie.slice(eq + 1));
26567
+ try {
26568
+ return decodeURIComponent(cookie.slice(eq + 1));
26569
+ } catch (e) {
26570
+ return cookie.slice(eq + 1);
26571
+ }
26205
26572
  }
26206
26573
  }
26207
26574
  return null;
@@ -26247,9 +26614,80 @@
26247
26614
  * @returns {string} The combined URL
26248
26615
  */
26249
26616
  function combineURLs(baseURL, relativeURL) {
26250
- return relativeURL
26251
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
26252
- : baseURL;
26617
+ if (!relativeURL) {
26618
+ return baseURL;
26619
+ }
26620
+
26621
+ let end = baseURL.length;
26622
+
26623
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
26624
+ end--;
26625
+ }
26626
+
26627
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
26628
+ }
26629
+
26630
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
26631
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
26632
+
26633
+ function stripLeadingC0ControlOrSpace(url) {
26634
+ let i = 0;
26635
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
26636
+ i++;
26637
+ }
26638
+ return url.slice(i);
26639
+ }
26640
+
26641
+ function normalizeURLForProtocolCheck(url) {
26642
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
26643
+ }
26644
+
26645
+ // Redact the parts of a URL that can carry secrets before it is embedded in an
26646
+ // error message. AxiosError.toJSON() serializes `message` verbatim and errors
26647
+ // are commonly logged, while the opt-in `config.redact` model only cleans
26648
+ // config keys — it cannot reach the message. Redact only the genuinely
26649
+ // sensitive substrings — userinfo (credentials), query parameter values and
26650
+ // fragment contents — with the same REDACTED marker the config redaction uses,
26651
+ // while keeping the scheme, host, path and parameter names so the offending
26652
+ // request stays accurately identifiable.
26653
+ function redactFragment(fragment) {
26654
+ if (!fragment) {
26655
+ return fragment;
26656
+ }
26657
+
26658
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
26659
+ return `${separator}${parameterName}${REDACTED}`;
26660
+ });
26661
+ }
26662
+
26663
+ function redactSensitiveURLParts(url) {
26664
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
26665
+ const fragmentIndex = redactedURL.indexOf('#');
26666
+ const urlWithoutFragment =
26667
+ fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
26668
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
26669
+ /([?&][^=&#]*=)[^&#]*/g,
26670
+ `$1${REDACTED}`
26671
+ );
26672
+
26673
+ if (fragmentIndex === -1) {
26674
+ return redactedURLWithoutFragment;
26675
+ }
26676
+
26677
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
26678
+ }
26679
+
26680
+ function assertValidHttpProtocolURL(url, config) {
26681
+ if (typeof url === 'string') {
26682
+ const normalizedURL = normalizeURLForProtocolCheck(url);
26683
+ if (malformedHttpProtocol.test(normalizedURL)) {
26684
+ throw new AxiosError$1(
26685
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
26686
+ AxiosError$1.ERR_INVALID_URL,
26687
+ config
26688
+ );
26689
+ }
26690
+ }
26253
26691
  }
26254
26692
 
26255
26693
  /**
@@ -26262,9 +26700,11 @@
26262
26700
  *
26263
26701
  * @returns {string} The combined full path
26264
26702
  */
26265
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
26703
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
26704
+ assertValidHttpProtocolURL(requestedURL, config);
26266
26705
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
26267
26706
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
26707
+ assertValidHttpProtocolURL(baseURL, config);
26268
26708
  return combineURLs(baseURL, requestedURL);
26269
26709
  }
26270
26710
  return requestedURL;
@@ -26272,6 +26712,17 @@
26272
26712
 
26273
26713
  const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
26274
26714
 
26715
+ const ownEnumerableKeys = (thing) => {
26716
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
26717
+ return Object.keys(thing).concat(
26718
+ Object.getOwnPropertySymbols(thing).filter(
26719
+ (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
26720
+ )
26721
+ );
26722
+ }
26723
+ return Object.keys(thing);
26724
+ };
26725
+
26275
26726
  /**
26276
26727
  * Config-specific merge-function which creates a new config-object
26277
26728
  * by merging two configuration objects together.
@@ -26283,6 +26734,7 @@
26283
26734
  */
26284
26735
  function mergeConfig$1(config1, config2) {
26285
26736
  // eslint-disable-next-line no-param-reassign
26737
+ config1 = config1 || {};
26286
26738
  config2 = config2 || {};
26287
26739
 
26288
26740
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -26335,6 +26787,32 @@
26335
26787
  }
26336
26788
  }
26337
26789
 
26790
+ function getMergedTransitionalOption(prop) {
26791
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional')
26792
+ ? config2.transitional
26793
+ : undefined;
26794
+
26795
+ if (!utils$1.isUndefined(transitional2)) {
26796
+ if (utils$1.isPlainObject(transitional2)) {
26797
+ if (utils$1.hasOwnProp(transitional2, prop)) {
26798
+ return transitional2[prop];
26799
+ }
26800
+ } else {
26801
+ return undefined;
26802
+ }
26803
+ }
26804
+
26805
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional')
26806
+ ? config1.transitional
26807
+ : undefined;
26808
+
26809
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
26810
+ return transitional1[prop];
26811
+ }
26812
+
26813
+ return undefined;
26814
+ }
26815
+
26338
26816
  // eslint-disable-next-line consistent-return
26339
26817
  function mergeDirectKeys(a, b, prop) {
26340
26818
  if (utils$1.hasOwnProp(config2, prop)) {
@@ -26378,7 +26856,7 @@
26378
26856
  mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
26379
26857
  };
26380
26858
 
26381
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26859
+ utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26382
26860
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
26383
26861
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
26384
26862
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
@@ -26387,18 +26865,41 @@
26387
26865
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
26388
26866
  });
26389
26867
 
26868
+ if (
26869
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
26870
+ utils$1.isUndefined(config2.validateStatus) &&
26871
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
26872
+ ) {
26873
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
26874
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
26875
+ } else {
26876
+ delete config.validateStatus;
26877
+ }
26878
+ }
26879
+
26390
26880
  return config;
26391
26881
  }
26392
26882
 
26393
26883
  const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
26394
26884
 
26885
+ /**
26886
+ * Apply the headers generated by a FormData implementation to the request headers,
26887
+ * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
26888
+ * content-* headers; otherwise merge all of them.
26889
+ *
26890
+ * @param {AxiosHeaders} headers - the request headers to mutate
26891
+ * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
26892
+ * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
26893
+ *
26894
+ * @returns {void}
26895
+ */
26395
26896
  function setFormDataHeaders(headers, formHeaders, policy) {
26396
26897
  if (policy !== 'content-only') {
26397
26898
  headers.set(formHeaders);
26398
26899
  return;
26399
26900
  }
26400
26901
 
26401
- Object.entries(formHeaders).forEach(([key, val]) => {
26902
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
26402
26903
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
26403
26904
  headers.set(key, val);
26404
26905
  }
@@ -26413,12 +26914,12 @@
26413
26914
  *
26414
26915
  * @returns {string} UTF-8 bytes as a Latin-1 string
26415
26916
  */
26416
- const encodeUTF8 = (str) =>
26917
+ const encodeUTF8$1 = (str) =>
26417
26918
  encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
26418
26919
  String.fromCharCode(parseInt(hex, 16))
26419
26920
  );
26420
26921
 
26421
- var resolveConfig = (config) => {
26922
+ function resolveConfig(config) {
26422
26923
  const newConfig = mergeConfig$1({}, config);
26423
26924
 
26424
26925
  // Read only own properties to prevent prototype pollution gadgets
@@ -26438,23 +26939,33 @@
26438
26939
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
26439
26940
 
26440
26941
  newConfig.url = buildURL(
26441
- buildFullPath(baseURL, url, allowAbsoluteUrls),
26442
- config.params,
26443
- config.paramsSerializer
26942
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
26943
+ own('params'),
26944
+ own('paramsSerializer')
26444
26945
  );
26445
26946
 
26446
26947
  // HTTP basic authentication
26447
26948
  if (auth) {
26448
- headers.set(
26449
- 'Authorization',
26450
- 'Basic ' +
26451
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
26452
- );
26949
+ const username = utils$1.getSafeProp(auth, 'username') || '';
26950
+ const password = utils$1.getSafeProp(auth, 'password') || '';
26951
+
26952
+ try {
26953
+ headers.set(
26954
+ 'Authorization',
26955
+ 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
26956
+ );
26957
+ } catch (e) {
26958
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
26959
+ }
26453
26960
  }
26454
26961
 
26455
26962
  if (utils$1.isFormData(data)) {
26456
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
26457
- headers.setContentType(undefined); // browser handles it
26963
+ if (
26964
+ platform.hasStandardBrowserEnv ||
26965
+ platform.hasStandardBrowserWebWorkerEnv ||
26966
+ utils$1.isReactNative(data)
26967
+ ) {
26968
+ headers.setContentType(undefined); // browser/web worker/RN handles it
26458
26969
  } else if (utils$1.isFunction(data.getHeaders)) {
26459
26970
  // Node.js FormData (like form-data package)
26460
26971
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -26486,7 +26997,7 @@
26486
26997
  }
26487
26998
 
26488
26999
  return newConfig;
26489
- };
27000
+ }
26490
27001
 
26491
27002
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
26492
27003
 
@@ -26635,7 +27146,7 @@
26635
27146
 
26636
27147
  // Add headers to the request
26637
27148
  if ('setRequestHeader' in request) {
26638
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
27149
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
26639
27150
  request.setRequestHeader(key, val);
26640
27151
  });
26641
27152
  }
@@ -26696,6 +27207,7 @@
26696
27207
  config
26697
27208
  )
26698
27209
  );
27210
+ done();
26699
27211
  return;
26700
27212
  }
26701
27213
 
@@ -26705,54 +27217,66 @@
26705
27217
  };
26706
27218
 
26707
27219
  const composeSignals = (signals, timeout) => {
26708
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
26709
-
26710
- if (timeout || length) {
26711
- let controller = new AbortController();
26712
-
26713
- let aborted;
26714
-
26715
- const onabort = function (reason) {
26716
- if (!aborted) {
26717
- aborted = true;
26718
- unsubscribe();
26719
- const err = reason instanceof Error ? reason : this.reason;
26720
- controller.abort(
26721
- err instanceof AxiosError$1
26722
- ? err
26723
- : new CanceledError$1(err instanceof Error ? err.message : err)
26724
- );
26725
- }
26726
- };
27220
+ signals = signals ? signals.filter(Boolean) : [];
26727
27221
 
26728
- let timer =
26729
- timeout &&
26730
- setTimeout(() => {
26731
- timer = null;
26732
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
26733
- }, timeout);
26734
-
26735
- const unsubscribe = () => {
26736
- if (signals) {
26737
- timer && clearTimeout(timer);
26738
- timer = null;
26739
- signals.forEach((signal) => {
26740
- signal.unsubscribe
26741
- ? signal.unsubscribe(onabort)
26742
- : signal.removeEventListener('abort', onabort);
26743
- });
26744
- signals = null;
26745
- }
26746
- };
27222
+ if (!timeout && !signals.length) {
27223
+ return;
27224
+ }
26747
27225
 
26748
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
27226
+ const controller = new AbortController();
26749
27227
 
26750
- const { signal } = controller;
27228
+ let aborted = false;
26751
27229
 
26752
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
27230
+ const onabort = function (reason) {
27231
+ if (!aborted) {
27232
+ aborted = true;
27233
+ unsubscribe();
27234
+ const err = reason instanceof Error ? reason : this.reason;
27235
+ controller.abort(
27236
+ err instanceof AxiosError$1
27237
+ ? err
27238
+ : new CanceledError$1(err instanceof Error ? err.message : err)
27239
+ );
27240
+ }
27241
+ };
26753
27242
 
26754
- return signal;
26755
- }
27243
+ let timer =
27244
+ timeout &&
27245
+ setTimeout(() => {
27246
+ timer = null;
27247
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
27248
+ }, timeout);
27249
+
27250
+ const unsubscribe = () => {
27251
+ if (!signals) { return; }
27252
+ timer && clearTimeout(timer);
27253
+ timer = null;
27254
+ signals.forEach((signal) => {
27255
+ signal.unsubscribe
27256
+ ? signal.unsubscribe(onabort)
27257
+ : signal.removeEventListener('abort', onabort);
27258
+ });
27259
+ signals = null;
27260
+ };
27261
+
27262
+ signals.forEach((signal) => {
27263
+ if (aborted) {
27264
+ return;
27265
+ }
27266
+
27267
+ if (signal.aborted) {
27268
+ onabort.call(signal);
27269
+ return;
27270
+ }
27271
+
27272
+ signal.addEventListener('abort', onabort, { once: true });
27273
+ });
27274
+
27275
+ const { signal } = controller;
27276
+
27277
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
27278
+
27279
+ return signal;
26756
27280
  };
26757
27281
 
26758
27282
  const streamChunk = function* (chunk, chunkSize) {
@@ -26846,88 +27370,128 @@
26846
27370
  };
26847
27371
 
26848
27372
  /**
26849
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
26850
- * - For base64: compute exact decoded size using length and padding;
26851
- * handle %XX at the character-count level (no string allocation).
26852
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
26853
- *
26854
- * @param {string} url
26855
- * @returns {number}
27373
+ * Estimate data: URL byte lengths *without* allocating large buffers.
27374
+ * - Fetch percent-decodes a base64 body before decoding it.
27375
+ * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
27376
+ * raw body, including ignored characters and content after padding.
27377
+ * - Non-base64 data is percent-decoded and then encoded as UTF-8.
26856
27378
  */
26857
- function estimateDataURLDecodedBytes(url) {
26858
- if (!url || typeof url !== 'string') return 0;
26859
- if (!url.startsWith('data:')) return 0;
27379
+ const isHexDigit = (charCode) =>
27380
+ (charCode >= 48 && charCode <= 57) ||
27381
+ (charCode >= 65 && charCode <= 70) ||
27382
+ (charCode >= 97 && charCode <= 102);
26860
27383
 
26861
- const comma = url.indexOf(',');
26862
- if (comma < 0) return 0;
27384
+ const isPercentEncodedByte = (str, i, len) =>
27385
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
26863
27386
 
26864
- const meta = url.slice(5, comma);
26865
- const body = url.slice(comma + 1);
26866
- const isBase64 = /;base64/i.test(meta);
27387
+ const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
26867
27388
 
26868
- if (isBase64) {
26869
- let effectiveLen = body.length;
26870
- const len = body.length; // cache length
27389
+ const isBase64Char = (charCode) =>
27390
+ (charCode >= 65 && charCode <= 90) || // A-Z
27391
+ (charCode >= 97 && charCode <= 122) || // a-z
27392
+ (charCode >= 48 && charCode <= 57) || // 0-9
27393
+ charCode === 43 || // +
27394
+ charCode === 47 || // /
27395
+ charCode === 45 || // - (base64url)
27396
+ charCode === 95; // _ (base64url)
26871
27397
 
26872
- for (let i = 0; i < len; i++) {
26873
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
26874
- const a = body.charCodeAt(i + 1);
26875
- const b = body.charCodeAt(i + 2);
26876
- const isHex =
26877
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
26878
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
27398
+ const isBase64Whitespace = (charCode) =>
27399
+ charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
26879
27400
 
26880
- if (isHex) {
26881
- effectiveLen -= 2;
26882
- i += 2;
26883
- }
26884
- }
27401
+ const base64Bytes = (significant) => {
27402
+ const groups = Math.floor(significant / 4);
27403
+ const remainder = significant % 4;
27404
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
27405
+ };
27406
+
27407
+ // Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
27408
+ // upper bound even when Buffer.from later ignores characters or stops at '='.
27409
+ const estimateBase64BufferAllocation = (body) => {
27410
+ const len = body.length;
27411
+ let padding = 0;
27412
+
27413
+ if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
27414
+ padding++;
27415
+
27416
+ if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
27417
+ padding++;
26885
27418
  }
27419
+ }
27420
+
27421
+ return Math.floor(((len - padding) * 3) / 4);
27422
+ };
26886
27423
 
26887
- let pad = 0;
26888
- let idx = len - 1;
27424
+ const estimatePercentDecodedBase64Bytes = (body) => {
27425
+ const len = body.length;
27426
+ let significant = 0;
27427
+ let padding = 0;
27428
+ let invalid = false;
26889
27429
 
26890
- const tailIsPct3D = (j) =>
26891
- j >= 2 &&
26892
- body.charCodeAt(j - 2) === 37 && // '%'
26893
- body.charCodeAt(j - 1) === 51 && // '3'
26894
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
27430
+ for (let i = 0; i < len; i++) {
27431
+ let code = body.charCodeAt(i);
26895
27432
 
26896
- if (idx >= 0) {
26897
- if (body.charCodeAt(idx) === 61 /* '=' */) {
26898
- pad++;
26899
- idx--;
26900
- } else if (tailIsPct3D(idx)) {
26901
- pad++;
26902
- idx -= 3;
26903
- }
27433
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
27434
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
27435
+ i += 2;
26904
27436
  }
26905
27437
 
26906
- if (pad === 1 && idx >= 0) {
26907
- if (body.charCodeAt(idx) === 61 /* '=' */) {
26908
- pad++;
26909
- } else if (tailIsPct3D(idx)) {
26910
- pad++;
26911
- }
27438
+ if (isBase64Whitespace(code)) {
27439
+ continue;
27440
+ }
27441
+
27442
+ if (code === 61 /* '=' */) {
27443
+ padding++;
27444
+ continue;
26912
27445
  }
26913
27446
 
26914
- const groups = Math.floor(effectiveLen / 4);
26915
- const bytes = groups * 3 - (pad || 0);
26916
- return bytes > 0 ? bytes : 0;
27447
+ if (!isBase64Char(code) || padding > 0) {
27448
+ invalid = true;
27449
+ continue;
27450
+ }
27451
+
27452
+ significant++;
26917
27453
  }
26918
27454
 
26919
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
26920
- return Buffer.byteLength(body, 'utf8');
27455
+ // Fetch rejects malformed forgiving-base64 input. Returning the raw-size
27456
+ // allocation bound keeps that invalid input from becoming a pre-check bypass.
27457
+ if (
27458
+ invalid ||
27459
+ padding > 2 ||
27460
+ (padding > 0 && (significant + padding) % 4 !== 0) ||
27461
+ significant % 4 === 1
27462
+ ) {
27463
+ return estimateBase64BufferAllocation(body);
27464
+ }
27465
+
27466
+ return base64Bytes(significant);
27467
+ };
27468
+
27469
+ const estimateDataURLBytes = (url, estimateBase64) => {
27470
+ if (!url || typeof url !== 'string') return 0;
27471
+ if (!url.startsWith('data:')) return 0;
27472
+
27473
+ const comma = url.indexOf(',');
27474
+ if (comma < 0) return 0;
27475
+
27476
+ const meta = url.slice(5, comma);
27477
+ const body = url.slice(comma + 1);
27478
+ const isBase64 = /;base64/i.test(meta);
27479
+
27480
+ if (isBase64) {
27481
+ return estimateBase64(body);
26921
27482
  }
26922
27483
 
26923
27484
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
26924
27485
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
26925
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
26926
- // but 3 UTF-8 bytes).
27486
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
27487
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
26927
27488
  let bytes = 0;
26928
27489
  for (let i = 0, len = body.length; i < len; i++) {
26929
27490
  const c = body.charCodeAt(i);
26930
- if (c < 0x80) {
27491
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
27492
+ bytes += 1;
27493
+ i += 2;
27494
+ } else if (c < 0x80) {
26931
27495
  bytes += 1;
26932
27496
  } else if (c < 0x800) {
26933
27497
  bytes += 2;
@@ -26944,14 +27508,59 @@
26944
27508
  }
26945
27509
  }
26946
27510
  return bytes;
27511
+ };
27512
+
27513
+ /**
27514
+ * Estimate the percent-decoded payload size used by Fetch data: URLs.
27515
+ *
27516
+ * @param {string} url
27517
+ * @returns {number}
27518
+ */
27519
+ function estimateDataURLDecodedBytes(url) {
27520
+ // Fetch removes URL fragments before processing a data: URL.
27521
+ const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
27522
+
27523
+ return estimateDataURLBytes(
27524
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
27525
+ estimatePercentDecodedBase64Bytes
27526
+ );
26947
27527
  }
26948
27528
 
26949
- const VERSION$1 = "1.16.0";
27529
+ const VERSION$1 = "1.19.0";
26950
27530
 
26951
27531
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
26952
27532
 
26953
27533
  const { isFunction } = utils$1;
26954
27534
 
27535
+ /**
27536
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
27537
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
27538
+ *
27539
+ * @param {string} str The string to encode
27540
+ *
27541
+ * @returns {string} UTF-8 bytes as a Latin-1 string
27542
+ */
27543
+ const encodeUTF8 = (str) =>
27544
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
27545
+ String.fromCharCode(parseInt(hex, 16))
27546
+ );
27547
+
27548
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
27549
+ // Decode before composing the `auth` option so credentials such as
27550
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
27551
+ // original value for malformed input so a bad encoding never throws.
27552
+ const decodeURIComponentSafe = (value) => {
27553
+ if (!utils$1.isString(value)) {
27554
+ return value;
27555
+ }
27556
+
27557
+ try {
27558
+ return decodeURIComponent(value);
27559
+ } catch (error) {
27560
+ return value;
27561
+ }
27562
+ };
27563
+
26955
27564
  const test = (fn, ...args) => {
26956
27565
  try {
26957
27566
  return !!fn(...args);
@@ -26960,8 +27569,20 @@
26960
27569
  }
26961
27570
  };
26962
27571
 
27572
+ const maybeWithAuthCredentials = (url) => {
27573
+ const protocolIndex = url.indexOf('://');
27574
+ let urlToCheck = url;
27575
+ if (protocolIndex !== -1) {
27576
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
27577
+ }
27578
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
27579
+ };
27580
+
26963
27581
  const factory = (env) => {
26964
- const globalObject = utils$1.global ?? globalThis;
27582
+ const globalObject =
27583
+ utils$1.global !== undefined && utils$1.global !== null
27584
+ ? utils$1.global
27585
+ : globalThis;
26965
27586
  const { ReadableStream, TextEncoder } = globalObject;
26966
27587
 
26967
27588
  env = utils$1.merge.call(
@@ -27104,6 +27725,7 @@
27104
27725
 
27105
27726
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
27106
27727
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
27728
+ const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
27107
27729
 
27108
27730
  let _fetch = envFetch || fetch;
27109
27731
 
@@ -27125,7 +27747,61 @@
27125
27747
 
27126
27748
  let requestContentLength;
27127
27749
 
27750
+ // AxiosError we raise while the request body is being streamed. Captured
27751
+ // by identity so the catch block can surface it directly, regardless of
27752
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
27753
+ // as `err.cause`; some browsers drop the original error entirely).
27754
+ let pendingBodyError = null;
27755
+
27756
+ const maxBodyLengthError = () =>
27757
+ new AxiosError$1(
27758
+ 'Request body larger than maxBodyLength limit',
27759
+ AxiosError$1.ERR_BAD_REQUEST,
27760
+ config,
27761
+ request
27762
+ );
27763
+
27128
27764
  try {
27765
+ // HTTP basic authentication
27766
+ let auth = undefined;
27767
+ const configAuth = own('auth');
27768
+
27769
+ if (configAuth) {
27770
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
27771
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
27772
+ auth = {
27773
+ username,
27774
+ password
27775
+ };
27776
+ }
27777
+
27778
+ if (maybeWithAuthCredentials(url)) {
27779
+ const parsedURL = new URL(url, platform.origin);
27780
+
27781
+ if (!auth && (parsedURL.username || parsedURL.password)) {
27782
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
27783
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
27784
+ auth = {
27785
+ username: urlUsername,
27786
+ password: urlPassword
27787
+ };
27788
+ }
27789
+
27790
+ if (parsedURL.username || parsedURL.password) {
27791
+ parsedURL.username = '';
27792
+ parsedURL.password = '';
27793
+ url = parsedURL.href;
27794
+ }
27795
+ }
27796
+
27797
+ if (auth) {
27798
+ headers.delete('authorization');
27799
+ headers.set(
27800
+ 'Authorization',
27801
+ 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
27802
+ );
27803
+ }
27804
+
27129
27805
  // Enforce maxContentLength for data: URLs up-front so we never materialize
27130
27806
  // an oversized payload. The HTTP adapter applies the same check (see http.js
27131
27807
  // "if (protocol === 'data:')" branch).
@@ -27141,53 +27817,96 @@
27141
27817
  }
27142
27818
  }
27143
27819
 
27144
- // Enforce maxBodyLength against the outbound request body before dispatch.
27145
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
27146
- // maxBodyLength limit'). Skip when the body length cannot be determined
27147
- // (e.g. a live ReadableStream supplied by the caller).
27820
+ // Enforce maxBodyLength against known-size bodies before dispatch using
27821
+ // the body's *actual* size never a caller-declared Content-Length,
27822
+ // which could under-report to slip an oversized body past the check.
27823
+ // Unknown-size streams return undefined here and are counted per-chunk
27824
+ // below as fetch consumes them.
27148
27825
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
27149
- const outboundLength = await resolveBodyLength(headers, data);
27150
- if (
27151
- typeof outboundLength === 'number' &&
27152
- isFinite(outboundLength) &&
27153
- outboundLength > maxBodyLength
27154
- ) {
27155
- throw new AxiosError$1(
27156
- 'Request body larger than maxBodyLength limit',
27157
- AxiosError$1.ERR_BAD_REQUEST,
27158
- config,
27159
- request
27160
- );
27826
+ const outboundLength = await getBodyLength(data);
27827
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
27828
+ requestContentLength = outboundLength;
27829
+ if (outboundLength > maxBodyLength) {
27830
+ throw maxBodyLengthError();
27831
+ }
27161
27832
  }
27162
27833
  }
27163
27834
 
27835
+ // A streamed body under maxBodyLength must be counted as fetch consumes
27836
+ // it; its size is never trusted from a caller-declared Content-Length.
27837
+ const mustEnforceStreamBody =
27838
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
27839
+
27840
+ const trackRequestStream = (stream, onProgress, flush) =>
27841
+ trackStream(
27842
+ stream,
27843
+ DEFAULT_CHUNK_SIZE,
27844
+ (loadedBytes) => {
27845
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
27846
+ throw (pendingBodyError = maxBodyLengthError());
27847
+ }
27848
+ onProgress && onProgress(loadedBytes);
27849
+ },
27850
+ flush
27851
+ );
27852
+
27164
27853
  if (
27165
- onUploadProgress &&
27166
27854
  supportsRequestStream &&
27167
27855
  method !== 'get' &&
27168
27856
  method !== 'head' &&
27169
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
27857
+ (onUploadProgress || mustEnforceStreamBody)
27170
27858
  ) {
27171
- let _request = new Request(url, {
27172
- method: 'POST',
27173
- body: data,
27174
- duplex: 'half',
27175
- });
27859
+ requestContentLength =
27860
+ requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
27861
+
27862
+ // A declared length of 0 is only trusted to skip the wrap when we are
27863
+ // not enforcing a stream limit (which must not rely on that header).
27864
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
27865
+ let _request = new Request(url, {
27866
+ method: 'POST',
27867
+ body: data,
27868
+ duplex: 'half',
27869
+ });
27176
27870
 
27177
- let contentTypeHeader;
27871
+ let contentTypeHeader;
27178
27872
 
27179
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
27180
- headers.setContentType(contentTypeHeader);
27181
- }
27873
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
27874
+ headers.setContentType(contentTypeHeader);
27875
+ }
27182
27876
 
27183
- if (_request.body) {
27184
- const [onProgress, flush] = progressEventDecorator(
27185
- requestContentLength,
27186
- progressEventReducer(asyncDecorator(onUploadProgress))
27187
- );
27877
+ if (_request.body) {
27878
+ const [onProgress, flush] =
27879
+ (onUploadProgress &&
27880
+ progressEventDecorator(
27881
+ requestContentLength,
27882
+ progressEventReducer(asyncDecorator(onUploadProgress))
27883
+ )) ||
27884
+ [];
27188
27885
 
27189
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
27886
+ data = trackRequestStream(_request.body, onProgress, flush);
27887
+ }
27190
27888
  }
27889
+ } else if (
27890
+ mustEnforceStreamBody &&
27891
+ !isRequestSupported &&
27892
+ isReadableStreamSupported &&
27893
+ method !== 'get' &&
27894
+ method !== 'head'
27895
+ ) {
27896
+ data = trackRequestStream(data);
27897
+ } else if (
27898
+ mustEnforceStreamBody &&
27899
+ isRequestSupported &&
27900
+ !supportsRequestStream &&
27901
+ method !== 'get' &&
27902
+ method !== 'head'
27903
+ ) {
27904
+ throw new AxiosError$1(
27905
+ 'Stream request bodies are not supported by the current fetch implementation',
27906
+ AxiosError$1.ERR_NOT_SUPPORT,
27907
+ config,
27908
+ request
27909
+ );
27191
27910
  }
27192
27911
 
27193
27912
  if (!utils$1.isString(withCredentials)) {
@@ -27218,7 +27937,7 @@
27218
27937
  ...fetchOptions,
27219
27938
  signal: composedSignal,
27220
27939
  method: method.toUpperCase(),
27221
- headers: headers.normalize().toJSON(),
27940
+ headers: toByteStringHeaderObject(headers.normalize()),
27222
27941
  body: data,
27223
27942
  duplex: 'half',
27224
27943
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -27230,10 +27949,12 @@
27230
27949
  ? _fetch(request, fetchOptions)
27231
27950
  : _fetch(url, resolvedOptions));
27232
27951
 
27952
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
27953
+
27233
27954
  // Cheap pre-check: if the server honestly declares a content-length that
27234
27955
  // already exceeds the cap, reject before we start streaming.
27235
27956
  if (hasMaxContentLength) {
27236
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27957
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
27237
27958
  if (declaredLength != null && declaredLength > maxContentLength) {
27238
27959
  throw new AxiosError$1(
27239
27960
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -27258,7 +27979,7 @@
27258
27979
  options[prop] = response[prop];
27259
27980
  });
27260
27981
 
27261
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27982
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
27262
27983
 
27263
27984
  const [onProgress, flush] =
27264
27985
  (onDownloadProgress &&
@@ -27349,23 +28070,55 @@
27349
28070
  const canceledError = composedSignal.reason;
27350
28071
  canceledError.config = config;
27351
28072
  request && (canceledError.request = request);
27352
- err !== canceledError && (canceledError.cause = err);
28073
+ if (err !== canceledError) {
28074
+ // Non-enumerable to match native Error `cause` semantics so loggers
28075
+ // don't recurse into circular fetch internals (see #7205).
28076
+ Object.defineProperty(canceledError, 'cause', {
28077
+ __proto__: null,
28078
+ value: err,
28079
+ writable: true,
28080
+ enumerable: false,
28081
+ configurable: true,
28082
+ });
28083
+ }
27353
28084
  throw canceledError;
27354
28085
  }
27355
28086
 
28087
+ // Surface a maxBodyLength violation we raised while the request body was
28088
+ // being streamed. Matching by identity (rather than reading
28089
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
28090
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
28091
+ // AxiosError that merely happened to land in `err.cause`.
28092
+ if (pendingBodyError) {
28093
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
28094
+ throw pendingBodyError;
28095
+ }
28096
+
28097
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
28098
+ // pre-checks, response size enforcement) without re-wrapping them.
28099
+ if (err instanceof AxiosError$1) {
28100
+ request && !err.request && (err.request = request);
28101
+ throw err;
28102
+ }
28103
+
27356
28104
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
27357
- throw Object.assign(
27358
- new AxiosError$1(
27359
- 'Network Error',
27360
- AxiosError$1.ERR_NETWORK,
27361
- config,
27362
- request,
27363
- err && err.response
27364
- ),
27365
- {
27366
- cause: err.cause || err,
27367
- }
28105
+ const networkError = new AxiosError$1(
28106
+ 'Network Error',
28107
+ AxiosError$1.ERR_NETWORK,
28108
+ config,
28109
+ request,
28110
+ err && err.response
27368
28111
  );
28112
+ // Non-enumerable to match native Error `cause` semantics so loggers
28113
+ // don't recurse into circular fetch internals (see #7205).
28114
+ Object.defineProperty(networkError, 'cause', {
28115
+ __proto__: null,
28116
+ value: err.cause || err,
28117
+ writable: true,
28118
+ enumerable: false,
28119
+ configurable: true,
28120
+ });
28121
+ throw networkError;
27369
28122
  }
27370
28123
 
27371
28124
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
@@ -27503,7 +28256,7 @@
27503
28256
 
27504
28257
  throw new AxiosError$1(
27505
28258
  `There is no suitable adapter to dispatch the request ` + s,
27506
- 'ERR_NOT_SUPPORT'
28259
+ AxiosError$1.ERR_NOT_SUPPORT
27507
28260
  );
27508
28261
  }
27509
28262
 
@@ -27684,7 +28437,7 @@
27684
28437
  */
27685
28438
 
27686
28439
  function assertOptions(options, schema, allowUnknown) {
27687
- if (typeof options !== 'object') {
28440
+ if (typeof options !== 'object' || options === null) {
27688
28441
  throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
27689
28442
  }
27690
28443
  const keys = Object.keys(options);
@@ -27807,6 +28560,8 @@
27807
28560
  forcedJSONParsing: validators.transitional(validators.boolean),
27808
28561
  clarifyTimeoutError: validators.transitional(validators.boolean),
27809
28562
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
28563
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
28564
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
27810
28565
  },
27811
28566
  false
27812
28567
  );
@@ -27911,17 +28666,35 @@
27911
28666
  const onFulfilled = requestInterceptorChain[i++];
27912
28667
  const onRejected = requestInterceptorChain[i++];
27913
28668
  try {
27914
- newConfig = onFulfilled(newConfig);
28669
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
27915
28670
  } catch (error) {
27916
- onRejected.call(this, error);
28671
+ if (!onRejected) {
28672
+ promise = Promise.reject(error);
28673
+ break;
28674
+ }
28675
+
28676
+ try {
28677
+ const rejectedResult = onRejected.call(this, error);
28678
+
28679
+ if (utils$1.isThenable(rejectedResult)) {
28680
+ promise = Promise.resolve(rejectedResult).then(() =>
28681
+ dispatchRequest.call(this, newConfig)
28682
+ );
28683
+ }
28684
+ } catch (rejectedError) {
28685
+ promise = Promise.reject(rejectedError);
28686
+ }
28687
+
27917
28688
  break;
27918
28689
  }
27919
28690
  }
27920
28691
 
27921
- try {
27922
- promise = dispatchRequest.call(this, newConfig);
27923
- } catch (error) {
27924
- return Promise.reject(error);
28692
+ if (!promise) {
28693
+ try {
28694
+ promise = dispatchRequest.call(this, newConfig);
28695
+ } catch (error) {
28696
+ promise = Promise.reject(error);
28697
+ }
27925
28698
  }
27926
28699
 
27927
28700
  i = 0;
@@ -27936,7 +28709,7 @@
27936
28709
 
27937
28710
  getUri(config) {
27938
28711
  config = mergeConfig$1(this.defaults, config);
27939
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
28712
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
27940
28713
  return buildURL(fullPath, config.params, config.paramsSerializer);
27941
28714
  }
27942
28715
  };
@@ -27949,7 +28722,7 @@
27949
28722
  mergeConfig$1(config || {}, {
27950
28723
  method,
27951
28724
  url,
27952
- data: (config || {}).data,
28725
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
27953
28726
  })
27954
28727
  );
27955
28728
  };
@@ -28214,6 +28987,7 @@
28214
28987
  LoopDetected: 508,
28215
28988
  NotExtended: 510,
28216
28989
  NetworkAuthenticationRequired: 511,
28990
+ WebServerReturnsAnUnknownError: 520,
28217
28991
  WebServerIsDown: 521,
28218
28992
  ConnectionTimedOut: 522,
28219
28993
  OriginIsUnreachable: 523,
@@ -28984,7 +29758,9 @@
28984
29758
  body: any().optional(),
28985
29759
  });
28986
29760
 
29761
+ const ConnectionType = _enum(['connector', 'mcp']);
28987
29762
  const ConnectionEditableProperties = object({
29763
+ type: ConnectionType.optional(),
28988
29764
  name: string$1().optional(),
28989
29765
  meta: record(string$1(), any()).optional(),
28990
29766
  authOptionKey: string$1().optional(),
@@ -29008,9 +29784,13 @@
29008
29784
  uiUrl: string$1().optional(),
29009
29785
  agentInstructions: string$1().optional(),
29010
29786
  handoffAgentInstructions: string$1().optional(),
29787
+ reason: _enum(['authenticate', 'reauthenticate', 'provide-input'])
29788
+ .optional()
29789
+ .describe('[INTERNAL] Cause that triggered this client action; persisted so prompts can be re-rendered on read.'),
29011
29790
  });
29012
29791
  const BaseConnection = BaseWorkspaceElement.extend({
29013
29792
  ...TenantLayerElement.shape,
29793
+ type: ConnectionType.optional(),
29014
29794
  name: string$1(),
29015
29795
  key: string$1().optional(),
29016
29796
  isTest: boolean$1().optional(),
@@ -29775,7 +30555,7 @@
29775
30555
  properties: record(string$1(), DataSchema).optional(),
29776
30556
  items: DataSchema.optional(),
29777
30557
  additionalProperties: union([boolean$1(), DataSchema]).optional(),
29778
- enum: array(string$1()).optional(),
30558
+ enum: array(union([string$1(), number$1()])).optional(),
29779
30559
  referenceRecords: array(any()).optional(),
29780
30560
  referenceCollection: object({
29781
30561
  key: any().optional(),
@@ -30223,6 +31003,7 @@
30223
31003
  connectorVersion: string$1().optional(),
30224
31004
  });
30225
31005
  const ConnectPayload = object({
31006
+ type: ConnectionType.optional(),
30226
31007
  requestId: string$1().optional(),
30227
31008
  integrationKey: string$1().optional(),
30228
31009
  integrationId: string$1().optional(),