@membranehq/sdk 0.28.3 → 0.29.0

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 (74) hide show
  1. package/dist/bundle.d.ts +43 -2
  2. package/dist/bundle.js +1891 -1380
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/connection-events-listener.d.ts +14 -0
  5. package/dist/dts/accessors/connection-events-listener.test.d.ts +1 -0
  6. package/dist/dts/accessors/connections-accessors.d.ts +4 -1
  7. package/dist/dts/accessors/integrations-accessors.d.ts +1 -0
  8. package/dist/dts/agent/session.d.ts +1 -0
  9. package/dist/dts/agent/worker-contracts.d.ts +2 -1
  10. package/dist/dts/ai-gateway/models.d.ts +4 -0
  11. package/dist/dts/async-requests/types.d.ts +50 -0
  12. package/dist/dts/deprecation.d.ts +1 -0
  13. package/dist/dts/errors/index.d.ts +5 -1
  14. package/dist/dts/index.browser.d.ts +2 -1
  15. package/dist/dts/oauth/types.d.ts +14 -5
  16. package/dist/dts/orgs/types.d.ts +682 -50
  17. package/dist/dts/orgs/types.test.d.ts +1 -0
  18. package/dist/dts/platform-user-tokens/types.d.ts +42 -0
  19. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +32 -72
  20. package/dist/dts/workspace-elements/api/checkpoints-api.d.ts +0 -1
  21. package/dist/dts/workspace-elements/api/connections-api.d.ts +24 -1
  22. package/dist/dts/workspace-elements/api/connectors-api.d.ts +10 -0
  23. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +1 -0
  24. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +2 -0
  25. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
  26. package/dist/dts/workspace-elements/api/external-apps-api.d.ts +28 -0
  27. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +5 -0
  28. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +3 -0
  29. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +13 -0
  30. package/dist/dts/workspace-elements/api/external-event-types-api.d.ts +331 -0
  31. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +2 -0
  32. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +2 -0
  33. package/dist/dts/workspace-elements/api/flows-api.d.ts +2 -0
  34. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +4 -0
  35. package/dist/dts/workspace-elements/api/index.d.ts +1 -0
  36. package/dist/dts/workspace-elements/api/integrations-api.d.ts +14 -7
  37. package/dist/dts/workspace-elements/base/action-run-log-records/index.d.ts +19 -0
  38. package/dist/dts/workspace-elements/base/actions/action-payload.d.ts +46 -0
  39. package/dist/dts/workspace-elements/base/actions/action-payload.test.d.ts +1 -0
  40. package/dist/dts/workspace-elements/base/actions/index.d.ts +3 -2
  41. package/dist/dts/workspace-elements/base/app-data-schemas/index.d.ts +2 -2
  42. package/dist/dts/workspace-elements/base/app-event-types/index.d.ts +2 -2
  43. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +4 -0
  44. package/dist/dts/workspace-elements/base/connections/index.d.ts +2 -0
  45. package/dist/dts/workspace-elements/base/connectors/index.d.ts +5 -5
  46. package/dist/dts/workspace-elements/base/data-link-tables/index.d.ts +2 -2
  47. package/dist/dts/workspace-elements/base/data-sources/index.d.ts +2 -2
  48. package/dist/dts/workspace-elements/base/external-event-log-records/index.d.ts +1 -0
  49. package/dist/dts/workspace-elements/base/external-event-subscriptions/index.d.ts +2 -0
  50. package/dist/dts/workspace-elements/base/external-event-types/index.d.ts +190 -0
  51. package/dist/dts/workspace-elements/base/field-mappings/index.d.ts +2 -2
  52. package/dist/dts/workspace-elements/base/flows/index.d.ts +2 -2
  53. package/dist/dts/workspace-elements/base/index.d.ts +1 -0
  54. package/dist/dts/workspace-elements/base/integrations/index.d.ts +2 -2
  55. package/dist/dts/workspace-elements/base/packages/index.d.ts +2 -2
  56. package/dist/dts/workspace-elements/types.d.ts +11 -2
  57. package/dist/dts/workspace-tokens/index.d.ts +1 -0
  58. package/dist/dts/{client-tokens → workspace-tokens}/types.d.ts +35 -22
  59. package/dist/dts/workspaces/api.d.ts +0 -6
  60. package/dist/dts/workspaces/compare.d.ts +4 -1
  61. package/dist/index.browser.d.mts +2275 -855
  62. package/dist/index.browser.d.ts +2275 -855
  63. package/dist/index.browser.js +686 -194
  64. package/dist/index.browser.js.map +1 -1
  65. package/dist/index.browser.mjs +647 -188
  66. package/dist/index.browser.mjs.map +1 -1
  67. package/dist/index.node.d.mts +2275 -855
  68. package/dist/index.node.d.ts +2275 -855
  69. package/dist/index.node.js +686 -194
  70. package/dist/index.node.js.map +1 -1
  71. package/dist/index.node.mjs +647 -188
  72. package/dist/index.node.mjs.map +1 -1
  73. package/package.json +2 -2
  74. /package/dist/dts/{client-tokens → platform-user-tokens}/index.d.ts +0 -0
package/dist/bundle.js CHANGED
@@ -3635,9 +3635,8 @@
3635
3635
  }
3636
3636
  },
3637
3637
  'delete': function (key) {
3638
- var root = $o && $o.next;
3639
3638
  var deletedNode = listDelete($o, key);
3640
- if (deletedNode && root && root === deletedNode) {
3639
+ if (deletedNode && $o && !$o.next) {
3641
3640
  $o = void undefined;
3642
3641
  }
3643
3642
  return !!deletedNode;
@@ -3659,7 +3658,6 @@
3659
3658
  listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
3660
3659
  }
3661
3660
  };
3662
- // @ts-expect-error TODO: figure out why this is erroring
3663
3661
  return channel;
3664
3662
  };
3665
3663
  return sideChannelList;
@@ -5734,10 +5732,10 @@
5734
5732
  var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
5735
5733
  var parts = cleanStr.split(
5736
5734
  options.delimiter,
5737
- options.throwOnLimitExceeded ? limit + 1 : limit
5735
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
5738
5736
  );
5739
5737
 
5740
- if (options.throwOnLimitExceeded && parts.length > limit) {
5738
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
5741
5739
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
5742
5740
  }
5743
5741
 
@@ -20563,6 +20561,14 @@
20563
20561
  }
20564
20562
  }
20565
20563
 
20564
+ const warned = new Set();
20565
+ function warnDeprecatedOnce(key, message) {
20566
+ if (warned.has(key))
20567
+ return;
20568
+ warned.add(key);
20569
+ console.warn(`[Membrane deprecation] ${message}`);
20570
+ }
20571
+
20566
20572
  class ConnectionLevelElementAccessor {
20567
20573
  constructor(client, connectionSelector, selector, elementKey, query) {
20568
20574
  this.client = client;
@@ -20671,6 +20677,7 @@
20671
20677
  return await this.options.client.post(this.getPath('reset'));
20672
20678
  }
20673
20679
  async run(input, options) {
20680
+ warnDeprecatedOnce('ActionAccessor.run', 'ActionAccessor.run() is deprecated. Use POST /act with { action: { id } } or { integrationKey, key } instead.');
20674
20681
  const queryParams = options
20675
20682
  ? {
20676
20683
  integrationKey: options.integrationKey,
@@ -20705,6 +20712,7 @@
20705
20712
  this.query = query;
20706
20713
  }
20707
20714
  async run(input) {
20715
+ warnDeprecatedOnce('ConnectionLevelActionAccessor.run', 'ConnectionLevelActionAccessor.run() is deprecated. Use POST /act with { action: { id } } or { integrationKey, key } instead.');
20708
20716
  return this.client.post(this.uri('/run'), input);
20709
20717
  }
20710
20718
  }
@@ -20847,159 +20855,6 @@
20847
20855
  .substring(0, 11);
20848
20856
  };
20849
20857
 
20850
- var ErrorType;
20851
- (function (ErrorType) {
20852
- ErrorType["BAD_REQUEST"] = "bad_request";
20853
- ErrorType["CONNECTION"] = "connection";
20854
- ErrorType["CONFIGURATION"] = "configuration";
20855
- ErrorType["DEPENDENCY_ERROR"] = "dependency_error";
20856
- ErrorType["FLOW_RUN"] = "flow_run";
20857
- ErrorType["FLOW_INSTANCE_SETUP"] = "flow_instance_setup";
20858
- ErrorType["CONCURRENCY"] = "concurrency";
20859
- ErrorType["INTERNAL"] = "internal";
20860
- ErrorType["ACTION_RUN"] = "action_run";
20861
- ErrorType["ACTION_INSTANCE_SETUP"] = "action_instance_setup";
20862
- ErrorType["UNIT_RUN"] = "unit_run";
20863
- ErrorType["CUSTOM_CODE"] = "custom_code";
20864
- ErrorType["INSUFFICIENT_CREDIT"] = "insufficient_credit";
20865
- ErrorType["OPENROUTER_NOT_CONFIGURED"] = "openrouter_not_configured";
20866
- })(ErrorType || (ErrorType = {}));
20867
- var BadRequestErrorKey;
20868
- (function (BadRequestErrorKey) {
20869
- BadRequestErrorKey["NOT_FOUND"] = "not_found";
20870
- BadRequestErrorKey["NOT_AUTHENTICATED"] = "not_authenticated";
20871
- BadRequestErrorKey["ACCESS_DENIED"] = "access_denied";
20872
- BadRequestErrorKey["ALREADY_EXISTS"] = "already_exists";
20873
- BadRequestErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
20874
- })(BadRequestErrorKey || (BadRequestErrorKey = {}));
20875
- var ConnectionErrorKey;
20876
- (function (ConnectionErrorKey) {
20877
- ConnectionErrorKey["CONNECTION_IS_DEFUNCT"] = "connection_is_defunct";
20878
- ConnectionErrorKey["ACCESS_TOKEN_EXPIRED"] = "access_token_expired";
20879
- ConnectionErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
20880
- })(ConnectionErrorKey || (ConnectionErrorKey = {}));
20881
- var ConcurrencyErrorKey;
20882
- (function (ConcurrencyErrorKey) {
20883
- ConcurrencyErrorKey["LOCK_TIMEOUT"] = "lock_timeout";
20884
- })(ConcurrencyErrorKey || (ConcurrencyErrorKey = {}));
20885
- const ErrorDataSchema = lazy(() => object({
20886
- type: _enum(ErrorType).optional(),
20887
- key: string$1().optional(),
20888
- message: string$1(),
20889
- data: any().optional(),
20890
- stack: any().optional(),
20891
- causedByError: lazy(() => ErrorDataSchema).optional(),
20892
- logs: array(any()).optional(),
20893
- }));
20894
- class ErrorData {
20895
- constructor(arg) {
20896
- if (arg instanceof Error) {
20897
- this.message = arg.message;
20898
- this.stack = arg.stack;
20899
- this.type = ErrorType.INTERNAL;
20900
- }
20901
- else if (typeof arg === 'string') {
20902
- this.message = arg;
20903
- this.type = ErrorType.INTERNAL;
20904
- }
20905
- else if (typeof arg === 'object' && arg !== null) {
20906
- Object.assign(this, arg);
20907
- }
20908
- else {
20909
- throw new Error('Invalid argument when creating BaseErrorData: ' + JSON.stringify(arg));
20910
- }
20911
- }
20912
- }
20913
- class MembraneError extends Error {
20914
- constructor(arg) {
20915
- const errorData = new ErrorData(arg);
20916
- super(errorData.message);
20917
- this.isMembraneError = true;
20918
- this.data = errorData;
20919
- if (!this.data.type) {
20920
- this.data.type = ErrorType.INTERNAL;
20921
- }
20922
- }
20923
- }
20924
- class InternalError extends MembraneError {
20925
- constructor(arg) {
20926
- super(arg);
20927
- this.data.type = ErrorType.INTERNAL;
20928
- }
20929
- }
20930
- class BadRequestError extends MembraneError {
20931
- constructor(arg) {
20932
- super(arg);
20933
- this.data.type = ErrorType.BAD_REQUEST;
20934
- }
20935
- }
20936
- class ConcurrencyError extends MembraneError {
20937
- constructor(arg) {
20938
- super(arg);
20939
- this.data.type = ErrorType.CONCURRENCY;
20940
- }
20941
- }
20942
- class ConfigurationError extends MembraneError {
20943
- constructor(arg) {
20944
- super(arg);
20945
- this.data.type = ErrorType.CONFIGURATION;
20946
- }
20947
- }
20948
- class FlowInstanceSetupError extends MembraneError {
20949
- constructor(arg) {
20950
- super(arg);
20951
- this.data.type = ErrorType.FLOW_INSTANCE_SETUP;
20952
- }
20953
- }
20954
- class FlowRunError extends MembraneError {
20955
- constructor(arg) {
20956
- super(arg);
20957
- this.data.type = ErrorType.FLOW_RUN;
20958
- }
20959
- }
20960
- class ActionRunError extends MembraneError {
20961
- constructor(arg) {
20962
- super(arg);
20963
- this.data.type = ErrorType.ACTION_RUN;
20964
- }
20965
- }
20966
- class ActionInstanceSetupError extends MembraneError {
20967
- constructor(arg) {
20968
- super(arg);
20969
- this.data.type = ErrorType.ACTION_INSTANCE_SETUP;
20970
- }
20971
- }
20972
- class UnitRunError extends MembraneError {
20973
- constructor(arg) {
20974
- super(arg);
20975
- this.data.type = ErrorType.UNIT_RUN;
20976
- }
20977
- }
20978
- class ConnectionError extends MembraneError {
20979
- constructor(arg) {
20980
- super(arg);
20981
- this.data.type = ErrorType.CONNECTION;
20982
- }
20983
- }
20984
- class CustomCodeError extends MembraneError {
20985
- constructor(arg) {
20986
- super(arg);
20987
- this.data.type = ErrorType.CUSTOM_CODE;
20988
- }
20989
- }
20990
- class InsufficientCreditsError extends MembraneError {
20991
- constructor(arg) {
20992
- super(arg);
20993
- this.data.type = ErrorType.INSUFFICIENT_CREDIT;
20994
- }
20995
- }
20996
- class OpenRouterNotConfiguredError extends MembraneError {
20997
- constructor(arg) {
20998
- super(arg);
20999
- this.data.type = ErrorType.OPENROUTER_NOT_CONFIGURED;
21000
- }
21001
- }
21002
-
21003
20858
  var MessageType;
21004
20859
  (function (MessageType) {
21005
20860
  MessageType["Call"] = "call";
@@ -21988,33 +21843,245 @@
21988
21843
  });
21989
21844
  }
21990
21845
 
21991
- class DataSourcesAccessor extends ElementListAccessor {
21992
- constructor(client) {
21993
- super(client, 'data-sources');
21846
+ var ErrorType;
21847
+ (function (ErrorType) {
21848
+ ErrorType["BAD_REQUEST"] = "bad_request";
21849
+ ErrorType["CONNECTION"] = "connection";
21850
+ ErrorType["CONFIGURATION"] = "configuration";
21851
+ ErrorType["DEPENDENCY_ERROR"] = "dependency_error";
21852
+ ErrorType["FLOW_RUN"] = "flow_run";
21853
+ ErrorType["FLOW_INSTANCE_SETUP"] = "flow_instance_setup";
21854
+ ErrorType["CONCURRENCY"] = "concurrency";
21855
+ ErrorType["INTERNAL"] = "internal";
21856
+ ErrorType["ACTION_RUN"] = "action_run";
21857
+ ErrorType["ACTION_INSTANCE_SETUP"] = "action_instance_setup";
21858
+ ErrorType["UNIT_RUN"] = "unit_run";
21859
+ ErrorType["CUSTOM_CODE"] = "custom_code";
21860
+ ErrorType["INSUFFICIENT_CREDIT"] = "insufficient_credit";
21861
+ ErrorType["OPENROUTER_NOT_CONFIGURED"] = "openrouter_not_configured";
21862
+ })(ErrorType || (ErrorType = {}));
21863
+ var BadRequestErrorKey;
21864
+ (function (BadRequestErrorKey) {
21865
+ BadRequestErrorKey["NOT_FOUND"] = "not_found";
21866
+ BadRequestErrorKey["NOT_AUTHENTICATED"] = "not_authenticated";
21867
+ BadRequestErrorKey["ACCESS_DENIED"] = "access_denied";
21868
+ BadRequestErrorKey["ALREADY_EXISTS"] = "already_exists";
21869
+ BadRequestErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
21870
+ BadRequestErrorKey["WORKSPACE_TIER_GATED"] = "workspace_tier_gated";
21871
+ })(BadRequestErrorKey || (BadRequestErrorKey = {}));
21872
+ var ConnectionErrorKey;
21873
+ (function (ConnectionErrorKey) {
21874
+ ConnectionErrorKey["CONNECTION_IS_DEFUNCT"] = "connection_is_defunct";
21875
+ ConnectionErrorKey["ACCESS_TOKEN_EXPIRED"] = "access_token_expired";
21876
+ ConnectionErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
21877
+ })(ConnectionErrorKey || (ConnectionErrorKey = {}));
21878
+ var ConcurrencyErrorKey;
21879
+ (function (ConcurrencyErrorKey) {
21880
+ ConcurrencyErrorKey["LOCK_TIMEOUT"] = "lock_timeout";
21881
+ })(ConcurrencyErrorKey || (ConcurrencyErrorKey = {}));
21882
+ const ErrorDataSchema = lazy(() => object({
21883
+ type: _enum(ErrorType).optional(),
21884
+ key: string$1().optional(),
21885
+ message: string$1(),
21886
+ data: any().optional(),
21887
+ stack: any().optional(),
21888
+ causedByError: lazy(() => ErrorDataSchema).optional(),
21889
+ logs: array(any()).optional(),
21890
+ }));
21891
+ class ErrorData {
21892
+ constructor(arg) {
21893
+ if (arg instanceof Error) {
21894
+ this.message = arg.message;
21895
+ this.stack = arg.stack;
21896
+ this.type = ErrorType.INTERNAL;
21897
+ }
21898
+ else if (typeof arg === 'string') {
21899
+ this.message = arg;
21900
+ this.type = ErrorType.INTERNAL;
21901
+ }
21902
+ else if (typeof arg === 'object' && arg !== null) {
21903
+ Object.assign(this, arg);
21904
+ }
21905
+ else {
21906
+ throw new Error('Invalid argument when creating BaseErrorData: ' + JSON.stringify(arg));
21907
+ }
21994
21908
  }
21995
21909
  }
21996
- class DataSourceAccessor extends ElementAccessor {
21997
- constructor(client, selector) {
21998
- super({
21999
- client,
22000
- selector,
22001
- path: 'data-source',
22002
- });
22003
- }
22004
- async setup() {
22005
- await this.options.client.post(this.getPath('setup'));
21910
+ class MembraneError extends Error {
21911
+ constructor(arg) {
21912
+ const errorData = new ErrorData(arg);
21913
+ super(errorData.message);
21914
+ this.isMembraneError = true;
21915
+ this.data = errorData;
21916
+ if (!this.data.type) {
21917
+ this.data.type = ErrorType.INTERNAL;
21918
+ }
22006
21919
  }
22007
- async reset() {
22008
- return await this.options.client.post(this.getPath('reset'));
21920
+ }
21921
+ class InternalError extends MembraneError {
21922
+ constructor(arg) {
21923
+ super(arg);
21924
+ this.data.type = ErrorType.INTERNAL;
22009
21925
  }
22010
21926
  }
22011
- class DataSourceInstancesAccessor extends ElementInstanceListAccessor {
22012
- constructor(client) {
22013
- super(client, 'data-source-instances');
21927
+ class BadRequestError extends MembraneError {
21928
+ constructor(arg) {
21929
+ super(arg);
21930
+ this.data.type = ErrorType.BAD_REQUEST;
22014
21931
  }
22015
21932
  }
22016
- class DataSourceInstanceAccessor extends ElementInstanceAccessor {
22017
- constructor(client, selector) {
21933
+ class ConcurrencyError extends MembraneError {
21934
+ constructor(arg) {
21935
+ super(arg);
21936
+ this.data.type = ErrorType.CONCURRENCY;
21937
+ }
21938
+ }
21939
+ class ConfigurationError extends MembraneError {
21940
+ constructor(arg) {
21941
+ super(arg);
21942
+ this.data.type = ErrorType.CONFIGURATION;
21943
+ }
21944
+ }
21945
+ class FlowInstanceSetupError extends MembraneError {
21946
+ constructor(arg) {
21947
+ super(arg);
21948
+ this.data.type = ErrorType.FLOW_INSTANCE_SETUP;
21949
+ }
21950
+ }
21951
+ class FlowRunError extends MembraneError {
21952
+ constructor(arg) {
21953
+ super(arg);
21954
+ this.data.type = ErrorType.FLOW_RUN;
21955
+ }
21956
+ }
21957
+ class ActionRunError extends MembraneError {
21958
+ constructor(arg) {
21959
+ super(arg);
21960
+ this.data.type = ErrorType.ACTION_RUN;
21961
+ }
21962
+ }
21963
+ class ActionInstanceSetupError extends MembraneError {
21964
+ constructor(arg) {
21965
+ super(arg);
21966
+ this.data.type = ErrorType.ACTION_INSTANCE_SETUP;
21967
+ }
21968
+ }
21969
+ class UnitRunError extends MembraneError {
21970
+ constructor(arg) {
21971
+ super(arg);
21972
+ this.data.type = ErrorType.UNIT_RUN;
21973
+ }
21974
+ }
21975
+ class ConnectionError extends MembraneError {
21976
+ constructor(arg) {
21977
+ super(arg);
21978
+ this.data.type = ErrorType.CONNECTION;
21979
+ }
21980
+ }
21981
+ class CustomCodeError extends MembraneError {
21982
+ constructor(arg) {
21983
+ super(arg);
21984
+ this.data.type = ErrorType.CUSTOM_CODE;
21985
+ }
21986
+ }
21987
+ class InsufficientCreditsError extends MembraneError {
21988
+ constructor(arg) {
21989
+ super(arg);
21990
+ this.data.type = ErrorType.INSUFFICIENT_CREDIT;
21991
+ }
21992
+ }
21993
+ class OpenRouterNotConfiguredError extends MembraneError {
21994
+ constructor(arg) {
21995
+ super(arg);
21996
+ this.data.type = ErrorType.OPENROUTER_NOT_CONFIGURED;
21997
+ }
21998
+ }
21999
+
22000
+ function routeConnectionEventMessage(message, requestId, handlers) {
22001
+ var _a, _b, _c, _d, _e;
22002
+ if (!isConnectionMessagePayload(message))
22003
+ return;
22004
+ if (message.requestId && message.requestId !== requestId)
22005
+ return;
22006
+ if (message.type === 'newConnectionCreated') {
22007
+ (_a = handlers.onSuccess) === null || _a === void 0 ? void 0 : _a.call(handlers, message.connection);
22008
+ (_b = handlers.onTerminal) === null || _b === void 0 ? void 0 : _b.call(handlers);
22009
+ return;
22010
+ }
22011
+ if (message.type === 'newConnectionFailure') {
22012
+ const error = new MembraneError((_c = message.errorData) !== null && _c !== void 0 ? _c : message.error);
22013
+ if (message.connectionId) {
22014
+ error.data.data = { ...error.data.data, connectionId: message.connectionId };
22015
+ }
22016
+ (_d = handlers.onFailure) === null || _d === void 0 ? void 0 : _d.call(handlers, error);
22017
+ (_e = handlers.onTerminal) === null || _e === void 0 ? void 0 : _e.call(handlers);
22018
+ }
22019
+ }
22020
+ function isConnectionMessagePayload(value) {
22021
+ if (!value || typeof value !== 'object')
22022
+ return false;
22023
+ const m = value;
22024
+ return m.source === 'integration.app' && typeof m.type === 'string';
22025
+ }
22026
+ function createConnectionEventsSubscription(options) {
22027
+ const { apiUri, getToken, requestId, handlers } = options;
22028
+ let eventSource = null;
22029
+ let cancelled = false;
22030
+ const close = () => {
22031
+ cancelled = true;
22032
+ eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
22033
+ eventSource = null;
22034
+ };
22035
+ Promise.resolve(getToken()).then((token) => {
22036
+ if (cancelled)
22037
+ return;
22038
+ const url = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
22039
+ try {
22040
+ eventSource = new EventSource(url);
22041
+ eventSource.onmessage = (event) => {
22042
+ let data;
22043
+ try {
22044
+ data = JSON.parse(event.data);
22045
+ }
22046
+ catch (_a) {
22047
+ return;
22048
+ }
22049
+ routeConnectionEventMessage(data, requestId, handlers);
22050
+ };
22051
+ eventSource.onerror = close;
22052
+ }
22053
+ catch (_a) { }
22054
+ });
22055
+ return close;
22056
+ }
22057
+
22058
+ class DataSourcesAccessor extends ElementListAccessor {
22059
+ constructor(client) {
22060
+ super(client, 'data-sources');
22061
+ }
22062
+ }
22063
+ class DataSourceAccessor extends ElementAccessor {
22064
+ constructor(client, selector) {
22065
+ super({
22066
+ client,
22067
+ selector,
22068
+ path: 'data-source',
22069
+ });
22070
+ }
22071
+ async setup() {
22072
+ await this.options.client.post(this.getPath('setup'));
22073
+ }
22074
+ async reset() {
22075
+ return await this.options.client.post(this.getPath('reset'));
22076
+ }
22077
+ }
22078
+ class DataSourceInstancesAccessor extends ElementInstanceListAccessor {
22079
+ constructor(client) {
22080
+ super(client, 'data-source-instances');
22081
+ }
22082
+ }
22083
+ class DataSourceInstanceAccessor extends ElementInstanceAccessor {
22084
+ constructor(client, selector) {
22018
22085
  super({
22019
22086
  client,
22020
22087
  instancePath: 'data-source-instance',
@@ -22234,6 +22301,7 @@
22234
22301
  WorkspaceElementType["ExternalEventSubscription"] = "external-event-subscription";
22235
22302
  WorkspaceElementType["ExternalEventLogRecord"] = "external-event-log-record";
22236
22303
  WorkspaceElementType["ExternalEventPull"] = "external-event-pull";
22304
+ WorkspaceElementType["ExternalEventType"] = "external-event-type";
22237
22305
  WorkspaceElementType["Screen"] = "screen";
22238
22306
  WorkspaceElementType["ActionRunLogRecord"] = "action-run-log-record";
22239
22307
  WorkspaceElementType["ExternalApiLogRecord"] = "external-api-log-record";
@@ -22350,7 +22418,8 @@
22350
22418
  const BaseIntegrationLevelMembraneInterfaceReadOnlyProperties = BaseMembraneInterfaceReadOnlyProperties.extend({
22351
22419
  isCustomized: boolean$1().optional(),
22352
22420
  });
22353
- BaseMembraneInterfaceEditableProperties.extend({
22421
+ const BaseExportProperties = BaseMembraneInterfaceEditableProperties.required({ uuid: true, key: true });
22422
+ BaseExportProperties.extend({
22354
22423
  integrationUuid: string$1().optional(),
22355
22424
  parentUuid: string$1().optional(),
22356
22425
  externalAppUuid: string$1().optional(),
@@ -22838,6 +22907,9 @@
22838
22907
  async archive() {
22839
22908
  return this.client.delete(`/connections/${this.connectionSelector}`);
22840
22909
  }
22910
+ async restore() {
22911
+ return this.client.post(`/connections/${this.connectionSelector}/restore`);
22912
+ }
22841
22913
  async request(path, data = null) {
22842
22914
  const pathWithoutSlash = path.startsWith('/') ? path.slice(1) : path;
22843
22915
  return this.client.post(`/connections/${this.connectionSelector}/api/${pathWithoutSlash}`, data);
@@ -22949,7 +23021,7 @@
22949
23021
  }
22950
23022
  }
22951
23023
  async function createOrUpdateConnection(options) {
22952
- const { client, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? 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 : {};
22953
23025
  let connectionType = await detectConnectionType(options);
22954
23026
  if (redirectUri) {
22955
23027
  connectionType = ConnectionType.REDIRECT;
@@ -22957,6 +23029,7 @@
22957
23029
  const freshToken = await client.getToken();
22958
23030
  const connectPath = 'connect';
22959
23031
  return new Promise((resolve, reject) => {
23032
+ var _a, _b;
22960
23033
  const requestId = simpleUniqueId() + simpleUniqueId();
22961
23034
  const payload = {
22962
23035
  token: freshToken,
@@ -22976,24 +23049,51 @@
22976
23049
  redirectUri,
22977
23050
  };
22978
23051
  let cancelCheckInterval;
22979
- const eventHandler = createConnectionEventHandler(requestId, (data) => {
22980
- resolve(data);
22981
- }, (error) => {
22982
- reject(error);
22983
- }, () => {
22984
- cleanup();
22985
- });
22986
- const { stopCrossWindow } = createCrossWindowListener({
22987
- handler: eventHandler,
22988
- });
22989
- const { stopSSE } = createSSEListener({
23052
+ let lateEventsTimeout;
23053
+ let promiseSettled = false;
23054
+ const handlers = {
23055
+ onSuccess: (data) => {
23056
+ var _a;
23057
+ if (promiseSettled) {
23058
+ (_a = lateEvents === null || lateEvents === void 0 ? void 0 : lateEvents.onConnection) === null || _a === void 0 ? void 0 : _a.call(lateEvents, data);
23059
+ }
23060
+ else {
23061
+ promiseSettled = true;
23062
+ resolve(data);
23063
+ }
23064
+ },
23065
+ onFailure: (error) => {
23066
+ var _a;
23067
+ if (promiseSettled) {
23068
+ (_a = lateEvents === null || lateEvents === void 0 ? void 0 : lateEvents.onFailure) === null || _a === void 0 ? void 0 : _a.call(lateEvents, error);
23069
+ }
23070
+ else {
23071
+ promiseSettled = true;
23072
+ reject(error);
23073
+ }
23074
+ },
23075
+ onTerminal: () => cleanup(),
23076
+ };
23077
+ const { stopCrossWindow } = createCrossWindowListener({ requestId, handlers });
23078
+ const stopSSE = createConnectionEventsSubscription({
22990
23079
  apiUri: apiUri,
23080
+ getToken: () => freshToken,
22991
23081
  requestId,
22992
- token: freshToken,
22993
- handler: eventHandler,
23082
+ handlers,
22994
23083
  });
23084
+ if (lateEvents) {
23085
+ lateEventsTimeout = setTimeout(stopSSE, 30 * 60 * 1000);
23086
+ if ((_a = lateEvents.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
23087
+ stopSSE();
23088
+ }
23089
+ else {
23090
+ (_b = lateEvents.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', stopSSE, { once: true });
23091
+ }
23092
+ }
22995
23093
  function cleanup() {
22996
23094
  clearInterval(cancelCheckInterval);
23095
+ if (lateEventsTimeout)
23096
+ clearTimeout(lateEventsTimeout);
22997
23097
  stopCrossWindow();
22998
23098
  stopSSE();
22999
23099
  }
@@ -23051,9 +23151,15 @@
23051
23151
  }, 1000);
23052
23152
  cancelCheckInterval = setInterval(() => {
23053
23153
  if (popup === null || popup === void 0 ? void 0 : popup.closed) {
23054
- cleanup();
23055
- onPopupClosed === null || onPopupClosed === void 0 ? void 0 : onPopupClosed();
23056
- resolve(null);
23154
+ clearInterval(cancelCheckInterval);
23155
+ stopCrossWindow();
23156
+ if (!lateEvents)
23157
+ stopSSE();
23158
+ if (!promiseSettled) {
23159
+ promiseSettled = true;
23160
+ onPopupClosed === null || onPopupClosed === void 0 ? void 0 : onPopupClosed();
23161
+ resolve(null);
23162
+ }
23057
23163
  }
23058
23164
  }, 1000);
23059
23165
  }
@@ -23077,60 +23183,17 @@
23077
23183
  }
23078
23184
  return ConnectionType.POPUP;
23079
23185
  }
23080
- const createConnectionEventHandler = (requestId, onResolve, onReject, onFinally) => {
23081
- return (event) => {
23082
- var _a;
23083
- const message = event.data || {};
23084
- if (message.source == 'integration.app' && (message.requestId == requestId || !message.requestId)) {
23085
- if (message.type == 'newConnectionCreated') {
23086
- onResolve(message.connection);
23087
- }
23088
- if (message.type == 'newConnectionFailure') {
23089
- const error = new MembraneError((_a = message.errorData) !== null && _a !== void 0 ? _a : message.error);
23090
- if (message.connectionId) {
23091
- error.data.data = { ...error.data.data, connectionId: message.connectionId };
23092
- }
23093
- onReject(error);
23094
- }
23095
- onFinally();
23096
- }
23186
+ const createCrossWindowListener = ({ requestId, handlers, }) => {
23187
+ const listener = (event) => {
23188
+ routeConnectionEventMessage(event.data, requestId, handlers);
23097
23189
  };
23098
- };
23099
- const createCrossWindowListener = ({ handler }) => {
23100
- window.addEventListener('message', handler);
23190
+ window.addEventListener('message', listener);
23101
23191
  return {
23102
23192
  stopCrossWindow: () => {
23103
- window.removeEventListener('message', handler);
23193
+ window.removeEventListener('message', listener);
23104
23194
  },
23105
23195
  };
23106
23196
  };
23107
- const createSSEListener = ({ apiUri, requestId, token, handler, }) => {
23108
- const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
23109
- let eventSource = null;
23110
- const closeSseConnection = () => {
23111
- eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
23112
- eventSource = null;
23113
- };
23114
- try {
23115
- eventSource = new EventSource(sseUrl);
23116
- eventSource.onmessage = (event) => {
23117
- const eventCopy = {
23118
- ...event,
23119
- data: JSON.parse(event.data),
23120
- };
23121
- handler(eventCopy);
23122
- };
23123
- eventSource.onerror = () => {
23124
- closeSseConnection();
23125
- };
23126
- }
23127
- catch (err) {
23128
- console.error('Error setting up SSE connection:', err);
23129
- }
23130
- return {
23131
- stopSSE: closeSseConnection,
23132
- };
23133
- };
23134
23197
 
23135
23198
  class FlowsAccessor extends ElementListAccessor {
23136
23199
  constructor(client) {
@@ -23533,7 +23596,7 @@
23533
23596
  }
23534
23597
  }
23535
23598
 
23536
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23599
+ /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23537
23600
  /**
23538
23601
  * Create a bound version of a function with a specified `this` context
23539
23602
  *
@@ -23737,9 +23800,9 @@
23737
23800
  * also have a `name` and `type` attribute to specify filename and content type
23738
23801
  *
23739
23802
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
23740
- *
23803
+ *
23741
23804
  * @param {*} value The value to test
23742
- *
23805
+ *
23743
23806
  * @returns {boolean} True if value is a React Native Blob, otherwise false
23744
23807
  */
23745
23808
  const isReactNativeBlob = (value) => {
@@ -23749,9 +23812,9 @@
23749
23812
  /**
23750
23813
  * Determine if environment is React Native
23751
23814
  * ReactNative `FormData` has a non-standard `getParts()` method
23752
- *
23815
+ *
23753
23816
  * @param {*} formData The formData to test
23754
- *
23817
+ *
23755
23818
  * @returns {boolean} True if environment is React Native, otherwise false
23756
23819
  */
23757
23820
  const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
@@ -23770,7 +23833,7 @@
23770
23833
  *
23771
23834
  * @param {*} val The value to test
23772
23835
  *
23773
- * @returns {boolean} True if value is a File, otherwise false
23836
+ * @returns {boolean} True if value is a FileList, otherwise false
23774
23837
  */
23775
23838
  const isFileList = kindOfTest('FileList');
23776
23839
 
@@ -23802,15 +23865,17 @@
23802
23865
  const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
23803
23866
 
23804
23867
  const isFormData = (thing) => {
23805
- let kind;
23806
- return thing && (
23807
- (FormDataCtor && thing instanceof FormDataCtor) || (
23808
- isFunction$1(thing.append) && (
23809
- (kind = kindOf(thing)) === 'formdata' ||
23810
- // detect form-data instance
23811
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
23812
- )
23813
- )
23868
+ if (!thing) return false;
23869
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
23870
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
23871
+ const proto = getPrototypeOf(thing);
23872
+ if (!proto || proto === Object.prototype) return false;
23873
+ if (!isFunction$1(thing.append)) return false;
23874
+ const kind = kindOf(thing);
23875
+ return (
23876
+ kind === 'formdata' ||
23877
+ // detect form-data instance
23878
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
23814
23879
  );
23815
23880
  };
23816
23881
 
@@ -23946,7 +24011,7 @@
23946
24011
  *
23947
24012
  * @returns {Object} Result of all merge properties
23948
24013
  */
23949
- function merge(/* obj1, obj2, obj3, ... */) {
24014
+ function merge(...objs) {
23950
24015
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
23951
24016
  const result = {};
23952
24017
  const assignValue = (val, key) => {
@@ -23956,8 +24021,12 @@
23956
24021
  }
23957
24022
 
23958
24023
  const targetKey = (caseless && findKey(result, key)) || key;
23959
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
23960
- result[targetKey] = merge(result[targetKey], val);
24024
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
24025
+ // chain, so a polluted Object.prototype value could surface here and get
24026
+ // copied into the merged result.
24027
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
24028
+ if (isPlainObject(existing) && isPlainObject(val)) {
24029
+ result[targetKey] = merge(existing, val);
23961
24030
  } else if (isPlainObject(val)) {
23962
24031
  result[targetKey] = merge({}, val);
23963
24032
  } else if (isArray(val)) {
@@ -23967,8 +24036,8 @@
23967
24036
  }
23968
24037
  };
23969
24038
 
23970
- for (let i = 0, l = arguments.length; i < l; i++) {
23971
- arguments[i] && forEach(arguments[i], assignValue);
24039
+ for (let i = 0, l = objs.length; i < l; i++) {
24040
+ objs[i] && forEach(objs[i], assignValue);
23972
24041
  }
23973
24042
  return result;
23974
24043
  }
@@ -23990,6 +24059,9 @@
23990
24059
  (val, key) => {
23991
24060
  if (thisArg && isFunction$1(val)) {
23992
24061
  Object.defineProperty(a, key, {
24062
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
24063
+ // hijack defineProperty's accessor-vs-data resolution.
24064
+ __proto__: null,
23993
24065
  value: bind(val, thisArg),
23994
24066
  writable: true,
23995
24067
  enumerable: true,
@@ -23997,6 +24069,7 @@
23997
24069
  });
23998
24070
  } else {
23999
24071
  Object.defineProperty(a, key, {
24072
+ __proto__: null,
24000
24073
  value: val,
24001
24074
  writable: true,
24002
24075
  enumerable: true,
@@ -24035,12 +24108,14 @@
24035
24108
  const inherits = (constructor, superConstructor, props, descriptors) => {
24036
24109
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
24037
24110
  Object.defineProperty(constructor.prototype, 'constructor', {
24111
+ __proto__: null,
24038
24112
  value: constructor,
24039
24113
  writable: true,
24040
24114
  enumerable: false,
24041
24115
  configurable: true,
24042
24116
  });
24043
24117
  Object.defineProperty(constructor, 'super', {
24118
+ __proto__: null,
24044
24119
  value: superConstructor.prototype,
24045
24120
  });
24046
24121
  props && Object.assign(constructor.prototype, props);
@@ -24222,7 +24297,7 @@
24222
24297
  const freezeMethods = (obj) => {
24223
24298
  reduceDescriptors(obj, (descriptor, name) => {
24224
24299
  // skip restricted props in strict mode
24225
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
24300
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
24226
24301
  return false;
24227
24302
  }
24228
24303
 
@@ -24463,1297 +24538,1398 @@
24463
24538
  isIterable,
24464
24539
  };
24465
24540
 
24466
- let AxiosError$1 = class AxiosError extends Error {
24467
- static from(error, code, config, request, response, customProps) {
24468
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
24469
- axiosError.cause = error;
24470
- axiosError.name = error.name;
24541
+ // RawAxiosHeaders whose duplicates are ignored by node
24542
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
24543
+ const ignoreDuplicateOf = utils$1.toObjectSet([
24544
+ 'age',
24545
+ 'authorization',
24546
+ 'content-length',
24547
+ 'content-type',
24548
+ 'etag',
24549
+ 'expires',
24550
+ 'from',
24551
+ 'host',
24552
+ 'if-modified-since',
24553
+ 'if-unmodified-since',
24554
+ 'last-modified',
24555
+ 'location',
24556
+ 'max-forwards',
24557
+ 'proxy-authorization',
24558
+ 'referer',
24559
+ 'retry-after',
24560
+ 'user-agent',
24561
+ ]);
24471
24562
 
24472
- // Preserve status from the original error if not already set from response
24473
- if (error.status != null && axiosError.status == null) {
24474
- axiosError.status = error.status;
24475
- }
24563
+ /**
24564
+ * Parse headers into an object
24565
+ *
24566
+ * ```
24567
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
24568
+ * Content-Type: application/json
24569
+ * Connection: keep-alive
24570
+ * Transfer-Encoding: chunked
24571
+ * ```
24572
+ *
24573
+ * @param {String} rawHeaders Headers needing to be parsed
24574
+ *
24575
+ * @returns {Object} Headers parsed into an object
24576
+ */
24577
+ var parseHeaders = (rawHeaders) => {
24578
+ const parsed = {};
24579
+ let key;
24580
+ let val;
24581
+ let i;
24476
24582
 
24477
- customProps && Object.assign(axiosError, customProps);
24478
- return axiosError;
24479
- }
24583
+ rawHeaders &&
24584
+ rawHeaders.split('\n').forEach(function parser(line) {
24585
+ i = line.indexOf(':');
24586
+ key = line.substring(0, i).trim().toLowerCase();
24587
+ val = line.substring(i + 1).trim();
24480
24588
 
24481
- /**
24482
- * Create an Error with the specified message, config, error code, request and response.
24483
- *
24484
- * @param {string} message The error message.
24485
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
24486
- * @param {Object} [config] The config.
24487
- * @param {Object} [request] The request.
24488
- * @param {Object} [response] The response.
24489
- *
24490
- * @returns {Error} The created error.
24491
- */
24492
- constructor(message, code, config, request, response) {
24493
- super(message);
24494
-
24495
- // Make message enumerable to maintain backward compatibility
24496
- // The native Error constructor sets message as non-enumerable,
24497
- // but axios < v1.13.3 had it as enumerable
24498
- Object.defineProperty(this, 'message', {
24499
- value: message,
24500
- enumerable: true,
24501
- writable: true,
24502
- configurable: true
24503
- });
24504
-
24505
- this.name = 'AxiosError';
24506
- this.isAxiosError = true;
24507
- code && (this.code = code);
24508
- config && (this.config = config);
24509
- request && (this.request = request);
24510
- if (response) {
24511
- this.response = response;
24512
- this.status = response.status;
24589
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
24590
+ return;
24591
+ }
24592
+
24593
+ if (key === 'set-cookie') {
24594
+ if (parsed[key]) {
24595
+ parsed[key].push(val);
24596
+ } else {
24597
+ parsed[key] = [val];
24598
+ }
24599
+ } else {
24600
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
24513
24601
  }
24602
+ });
24603
+
24604
+ return parsed;
24605
+ };
24606
+
24607
+ const $internals = Symbol('internals');
24608
+
24609
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
24610
+
24611
+ function trimSPorHTAB(str) {
24612
+ let start = 0;
24613
+ let end = str.length;
24614
+
24615
+ while (start < end) {
24616
+ const code = str.charCodeAt(start);
24617
+
24618
+ if (code !== 0x09 && code !== 0x20) {
24619
+ break;
24514
24620
  }
24515
24621
 
24516
- toJSON() {
24517
- return {
24518
- // Standard
24519
- message: this.message,
24520
- name: this.name,
24521
- // Microsoft
24522
- description: this.description,
24523
- number: this.number,
24524
- // Mozilla
24525
- fileName: this.fileName,
24526
- lineNumber: this.lineNumber,
24527
- columnNumber: this.columnNumber,
24528
- stack: this.stack,
24529
- // Axios
24530
- config: utils$1.toJSONObject(this.config),
24531
- code: this.code,
24532
- status: this.status,
24533
- };
24622
+ start += 1;
24534
24623
  }
24535
- };
24536
24624
 
24537
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
24538
- AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
24539
- AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
24540
- AxiosError$1.ECONNABORTED = 'ECONNABORTED';
24541
- AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
24542
- AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
24543
- AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
24544
- AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
24545
- AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
24546
- AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
24547
- AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
24548
- AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
24549
- AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
24625
+ while (end > start) {
24626
+ const code = str.charCodeAt(end - 1);
24550
24627
 
24551
- // eslint-disable-next-line strict
24552
- var httpAdapter = null;
24628
+ if (code !== 0x09 && code !== 0x20) {
24629
+ break;
24630
+ }
24553
24631
 
24554
- /**
24555
- * Determines if the given thing is a array or js object.
24556
- *
24557
- * @param {string} thing - The object or array to be visited.
24558
- *
24559
- * @returns {boolean}
24560
- */
24561
- function isVisitable(thing) {
24562
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
24632
+ end -= 1;
24633
+ }
24634
+
24635
+ return start === 0 && end === str.length ? str : str.slice(start, end);
24563
24636
  }
24564
24637
 
24565
- /**
24566
- * It removes the brackets from the end of a string
24567
- *
24568
- * @param {string} key - The key of the parameter.
24569
- *
24570
- * @returns {string} the key without the brackets.
24571
- */
24572
- function removeBrackets(key) {
24573
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
24638
+ function normalizeHeader(header) {
24639
+ return header && String(header).trim().toLowerCase();
24574
24640
  }
24575
24641
 
24576
- /**
24577
- * It takes a path, a key, and a boolean, and returns a string
24578
- *
24579
- * @param {string} path - The path to the current key.
24580
- * @param {string} key - The key of the current object being iterated over.
24581
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
24582
- *
24583
- * @returns {string} The path to the current key.
24584
- */
24585
- function renderKey(path, key, dots) {
24586
- if (!path) return key;
24587
- return path
24588
- .concat(key)
24589
- .map(function each(token, i) {
24590
- // eslint-disable-next-line no-param-reassign
24591
- token = removeBrackets(token);
24592
- return !dots && i ? '[' + token + ']' : token;
24593
- })
24594
- .join(dots ? '.' : '');
24642
+ function sanitizeHeaderValue(str) {
24643
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
24595
24644
  }
24596
24645
 
24597
- /**
24598
- * If the array is an array and none of its elements are visitable, then it's a flat array.
24599
- *
24600
- * @param {Array<any>} arr - The array to check
24601
- *
24602
- * @returns {boolean}
24603
- */
24604
- function isFlatArray(arr) {
24605
- return utils$1.isArray(arr) && !arr.some(isVisitable);
24646
+ function normalizeValue(value) {
24647
+ if (value === false || value == null) {
24648
+ return value;
24649
+ }
24650
+
24651
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
24606
24652
  }
24607
24653
 
24608
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
24609
- return /^is[A-Z]/.test(prop);
24610
- });
24654
+ function parseTokens(str) {
24655
+ const tokens = Object.create(null);
24656
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
24657
+ let match;
24611
24658
 
24612
- /**
24613
- * Convert a data object to FormData
24614
- *
24615
- * @param {Object} obj
24616
- * @param {?Object} [formData]
24617
- * @param {?Object} [options]
24618
- * @param {Function} [options.visitor]
24619
- * @param {Boolean} [options.metaTokens = true]
24620
- * @param {Boolean} [options.dots = false]
24621
- * @param {?Boolean} [options.indexes = false]
24622
- *
24623
- * @returns {Object}
24624
- **/
24659
+ while ((match = tokensRE.exec(str))) {
24660
+ tokens[match[1]] = match[2];
24661
+ }
24625
24662
 
24626
- /**
24627
- * It converts an object into a FormData object
24628
- *
24629
- * @param {Object<any, any>} obj - The object to convert to form data.
24630
- * @param {string} formData - The FormData object to append to.
24631
- * @param {Object<string, any>} options
24632
- *
24633
- * @returns
24634
- */
24635
- function toFormData$1(obj, formData, options) {
24636
- if (!utils$1.isObject(obj)) {
24637
- throw new TypeError('target must be an object');
24663
+ return tokens;
24664
+ }
24665
+
24666
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
24667
+
24668
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
24669
+ if (utils$1.isFunction(filter)) {
24670
+ return filter.call(this, value, header);
24638
24671
  }
24639
24672
 
24640
- // eslint-disable-next-line no-param-reassign
24641
- formData = formData || new (FormData)();
24673
+ if (isHeaderNameFilter) {
24674
+ value = header;
24675
+ }
24642
24676
 
24643
- // eslint-disable-next-line no-param-reassign
24644
- options = utils$1.toFlatObject(
24645
- options,
24646
- {
24647
- metaTokens: true,
24648
- dots: false,
24649
- indexes: false,
24650
- },
24651
- false,
24652
- function defined(option, source) {
24653
- // eslint-disable-next-line no-eq-null,eqeqeq
24654
- return !utils$1.isUndefined(source[option]);
24655
- }
24656
- );
24677
+ if (!utils$1.isString(value)) return;
24657
24678
 
24658
- const metaTokens = options.metaTokens;
24659
- // eslint-disable-next-line no-use-before-define
24660
- const visitor = options.visitor || defaultVisitor;
24661
- const dots = options.dots;
24662
- const indexes = options.indexes;
24663
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
24664
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
24679
+ if (utils$1.isString(filter)) {
24680
+ return value.indexOf(filter) !== -1;
24681
+ }
24665
24682
 
24666
- if (!utils$1.isFunction(visitor)) {
24667
- throw new TypeError('visitor must be a function');
24683
+ if (utils$1.isRegExp(filter)) {
24684
+ return filter.test(value);
24668
24685
  }
24686
+ }
24669
24687
 
24670
- function convertValue(value) {
24671
- if (value === null) return '';
24688
+ function formatHeader(header) {
24689
+ return header
24690
+ .trim()
24691
+ .toLowerCase()
24692
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
24693
+ return char.toUpperCase() + str;
24694
+ });
24695
+ }
24672
24696
 
24673
- if (utils$1.isDate(value)) {
24674
- return value.toISOString();
24675
- }
24697
+ function buildAccessors(obj, header) {
24698
+ const accessorName = utils$1.toCamelCase(' ' + header);
24676
24699
 
24677
- if (utils$1.isBoolean(value)) {
24678
- return value.toString();
24679
- }
24700
+ ['get', 'set', 'has'].forEach((methodName) => {
24701
+ Object.defineProperty(obj, methodName + accessorName, {
24702
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
24703
+ // this data descriptor into an accessor descriptor on the way in.
24704
+ __proto__: null,
24705
+ value: function (arg1, arg2, arg3) {
24706
+ return this[methodName].call(this, header, arg1, arg2, arg3);
24707
+ },
24708
+ configurable: true,
24709
+ });
24710
+ });
24711
+ }
24680
24712
 
24681
- if (!useBlob && utils$1.isBlob(value)) {
24682
- throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
24713
+ let AxiosHeaders$1 = class AxiosHeaders {
24714
+ constructor(headers) {
24715
+ headers && this.set(headers);
24716
+ }
24717
+
24718
+ set(header, valueOrRewrite, rewrite) {
24719
+ const self = this;
24720
+
24721
+ function setHeader(_value, _header, _rewrite) {
24722
+ const lHeader = normalizeHeader(_header);
24723
+
24724
+ if (!lHeader) {
24725
+ throw new Error('header name must be a non-empty string');
24726
+ }
24727
+
24728
+ const key = utils$1.findKey(self, lHeader);
24729
+
24730
+ if (
24731
+ !key ||
24732
+ self[key] === undefined ||
24733
+ _rewrite === true ||
24734
+ (_rewrite === undefined && self[key] !== false)
24735
+ ) {
24736
+ self[key || _header] = normalizeValue(_value);
24737
+ }
24683
24738
  }
24684
24739
 
24685
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
24686
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
24740
+ const setHeaders = (headers, _rewrite) =>
24741
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
24742
+
24743
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
24744
+ setHeaders(header, valueOrRewrite);
24745
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
24746
+ setHeaders(parseHeaders(header), valueOrRewrite);
24747
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
24748
+ let obj = {},
24749
+ dest,
24750
+ key;
24751
+ for (const entry of header) {
24752
+ if (!utils$1.isArray(entry)) {
24753
+ throw TypeError('Object iterator must return a key-value pair');
24754
+ }
24755
+
24756
+ obj[(key = entry[0])] = (dest = obj[key])
24757
+ ? utils$1.isArray(dest)
24758
+ ? [...dest, entry[1]]
24759
+ : [dest, entry[1]]
24760
+ : entry[1];
24761
+ }
24762
+
24763
+ setHeaders(obj, valueOrRewrite);
24764
+ } else {
24765
+ header != null && setHeader(valueOrRewrite, header, rewrite);
24687
24766
  }
24688
24767
 
24689
- return value;
24768
+ return this;
24690
24769
  }
24691
24770
 
24692
- /**
24693
- * Default visitor.
24694
- *
24695
- * @param {*} value
24696
- * @param {String|Number} key
24697
- * @param {Array<String|Number>} path
24698
- * @this {FormData}
24699
- *
24700
- * @returns {boolean} return true to visit the each prop of the value recursively
24701
- */
24702
- function defaultVisitor(value, key, path) {
24703
- let arr = value;
24771
+ get(header, parser) {
24772
+ header = normalizeHeader(header);
24704
24773
 
24705
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
24706
- formData.append(renderKey(path, key, dots), convertValue(value));
24707
- return false;
24708
- }
24774
+ if (header) {
24775
+ const key = utils$1.findKey(this, header);
24709
24776
 
24710
- if (value && !path && typeof value === 'object') {
24711
- if (utils$1.endsWith(key, '{}')) {
24712
- // eslint-disable-next-line no-param-reassign
24713
- key = metaTokens ? key : key.slice(0, -2);
24714
- // eslint-disable-next-line no-param-reassign
24715
- value = JSON.stringify(value);
24716
- } else if (
24717
- (utils$1.isArray(value) && isFlatArray(value)) ||
24718
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
24719
- ) {
24720
- // eslint-disable-next-line no-param-reassign
24721
- key = removeBrackets(key);
24777
+ if (key) {
24778
+ const value = this[key];
24722
24779
 
24723
- arr.forEach(function each(el, index) {
24724
- !(utils$1.isUndefined(el) || el === null) &&
24725
- formData.append(
24726
- // eslint-disable-next-line no-nested-ternary
24727
- indexes === true
24728
- ? renderKey([key], index, dots)
24729
- : indexes === null
24730
- ? key
24731
- : key + '[]',
24732
- convertValue(el)
24733
- );
24734
- });
24735
- return false;
24780
+ if (!parser) {
24781
+ return value;
24782
+ }
24783
+
24784
+ if (parser === true) {
24785
+ return parseTokens(value);
24786
+ }
24787
+
24788
+ if (utils$1.isFunction(parser)) {
24789
+ return parser.call(this, value, key);
24790
+ }
24791
+
24792
+ if (utils$1.isRegExp(parser)) {
24793
+ return parser.exec(value);
24794
+ }
24795
+
24796
+ throw new TypeError('parser must be boolean|regexp|function');
24736
24797
  }
24737
24798
  }
24799
+ }
24738
24800
 
24739
- if (isVisitable(value)) {
24740
- return true;
24741
- }
24801
+ has(header, matcher) {
24802
+ header = normalizeHeader(header);
24742
24803
 
24743
- formData.append(renderKey(path, key, dots), convertValue(value));
24804
+ if (header) {
24805
+ const key = utils$1.findKey(this, header);
24806
+
24807
+ return !!(
24808
+ key &&
24809
+ this[key] !== undefined &&
24810
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
24811
+ );
24812
+ }
24744
24813
 
24745
24814
  return false;
24746
24815
  }
24747
24816
 
24748
- const stack = [];
24817
+ delete(header, matcher) {
24818
+ const self = this;
24819
+ let deleted = false;
24749
24820
 
24750
- const exposedHelpers = Object.assign(predicates, {
24751
- defaultVisitor,
24752
- convertValue,
24753
- isVisitable,
24754
- });
24821
+ function deleteHeader(_header) {
24822
+ _header = normalizeHeader(_header);
24755
24823
 
24756
- function build(value, path) {
24757
- if (utils$1.isUndefined(value)) return;
24824
+ if (_header) {
24825
+ const key = utils$1.findKey(self, _header);
24758
24826
 
24759
- if (stack.indexOf(value) !== -1) {
24760
- throw Error('Circular reference detected in ' + path.join('.'));
24827
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
24828
+ delete self[key];
24829
+
24830
+ deleted = true;
24831
+ }
24832
+ }
24761
24833
  }
24762
24834
 
24763
- stack.push(value);
24835
+ if (utils$1.isArray(header)) {
24836
+ header.forEach(deleteHeader);
24837
+ } else {
24838
+ deleteHeader(header);
24839
+ }
24764
24840
 
24765
- utils$1.forEach(value, function each(el, key) {
24766
- const result =
24767
- !(utils$1.isUndefined(el) || el === null) &&
24768
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
24841
+ return deleted;
24842
+ }
24769
24843
 
24770
- if (result === true) {
24771
- build(el, path ? path.concat(key) : [key]);
24844
+ clear(matcher) {
24845
+ const keys = Object.keys(this);
24846
+ let i = keys.length;
24847
+ let deleted = false;
24848
+
24849
+ while (i--) {
24850
+ const key = keys[i];
24851
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
24852
+ delete this[key];
24853
+ deleted = true;
24772
24854
  }
24773
- });
24855
+ }
24774
24856
 
24775
- stack.pop();
24857
+ return deleted;
24776
24858
  }
24777
24859
 
24778
- if (!utils$1.isObject(obj)) {
24779
- throw new TypeError('data must be an object');
24780
- }
24860
+ normalize(format) {
24861
+ const self = this;
24862
+ const headers = {};
24781
24863
 
24782
- build(obj);
24864
+ utils$1.forEach(this, (value, header) => {
24865
+ const key = utils$1.findKey(headers, header);
24783
24866
 
24784
- return formData;
24785
- }
24867
+ if (key) {
24868
+ self[key] = normalizeValue(value);
24869
+ delete self[header];
24870
+ return;
24871
+ }
24786
24872
 
24787
- /**
24788
- * It encodes a string by replacing all characters that are not in the unreserved set with
24789
- * their percent-encoded equivalents
24790
- *
24791
- * @param {string} str - The string to encode.
24792
- *
24793
- * @returns {string} The encoded string.
24794
- */
24795
- function encode$1(str) {
24796
- const charMap = {
24797
- '!': '%21',
24798
- "'": '%27',
24799
- '(': '%28',
24800
- ')': '%29',
24801
- '~': '%7E',
24802
- '%20': '+',
24803
- '%00': '\x00',
24804
- };
24805
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
24806
- return charMap[match];
24807
- });
24808
- }
24873
+ const normalized = format ? formatHeader(header) : String(header).trim();
24809
24874
 
24810
- /**
24811
- * It takes a params object and converts it to a FormData object
24812
- *
24813
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
24814
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
24815
- *
24816
- * @returns {void}
24817
- */
24818
- function AxiosURLSearchParams(params, options) {
24819
- this._pairs = [];
24875
+ if (normalized !== header) {
24876
+ delete self[header];
24877
+ }
24820
24878
 
24821
- params && toFormData$1(params, this, options);
24822
- }
24879
+ self[normalized] = normalizeValue(value);
24823
24880
 
24824
- const prototype = AxiosURLSearchParams.prototype;
24881
+ headers[normalized] = true;
24882
+ });
24825
24883
 
24826
- prototype.append = function append(name, value) {
24827
- this._pairs.push([name, value]);
24828
- };
24884
+ return this;
24885
+ }
24829
24886
 
24830
- prototype.toString = function toString(encoder) {
24831
- const _encode = encoder
24832
- ? function (value) {
24833
- return encoder.call(this, value, encode$1);
24834
- }
24835
- : encode$1;
24887
+ concat(...targets) {
24888
+ return this.constructor.concat(this, ...targets);
24889
+ }
24836
24890
 
24837
- return this._pairs
24838
- .map(function each(pair) {
24839
- return _encode(pair[0]) + '=' + _encode(pair[1]);
24840
- }, '')
24841
- .join('&');
24842
- };
24891
+ toJSON(asStrings) {
24892
+ const obj = Object.create(null);
24843
24893
 
24844
- /**
24845
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
24846
- * their plain counterparts (`:`, `$`, `,`, `+`).
24847
- *
24848
- * @param {string} val The value to be encoded.
24849
- *
24850
- * @returns {string} The encoded value.
24851
- */
24852
- function encode(val) {
24853
- return encodeURIComponent(val)
24854
- .replace(/%3A/gi, ':')
24855
- .replace(/%24/g, '$')
24856
- .replace(/%2C/gi, ',')
24857
- .replace(/%20/g, '+');
24858
- }
24894
+ utils$1.forEach(this, (value, header) => {
24895
+ value != null &&
24896
+ value !== false &&
24897
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
24898
+ });
24859
24899
 
24860
- /**
24861
- * Build a URL by appending params to the end
24862
- *
24863
- * @param {string} url The base of the url (e.g., http://www.google.com)
24864
- * @param {object} [params] The params to be appended
24865
- * @param {?(object|Function)} options
24866
- *
24867
- * @returns {string} The formatted url
24868
- */
24869
- function buildURL(url, params, options) {
24870
- if (!params) {
24871
- return url;
24900
+ return obj;
24901
+ }
24902
+
24903
+ [Symbol.iterator]() {
24904
+ return Object.entries(this.toJSON())[Symbol.iterator]();
24905
+ }
24906
+
24907
+ toString() {
24908
+ return Object.entries(this.toJSON())
24909
+ .map(([header, value]) => header + ': ' + value)
24910
+ .join('\n');
24911
+ }
24912
+
24913
+ getSetCookie() {
24914
+ return this.get('set-cookie') || [];
24915
+ }
24916
+
24917
+ get [Symbol.toStringTag]() {
24918
+ return 'AxiosHeaders';
24919
+ }
24920
+
24921
+ static from(thing) {
24922
+ return thing instanceof this ? thing : new this(thing);
24872
24923
  }
24873
24924
 
24874
- const _encode = (options && options.encode) || encode;
24925
+ static concat(first, ...targets) {
24926
+ const computed = new this(first);
24875
24927
 
24876
- const _options = utils$1.isFunction(options)
24877
- ? {
24878
- serialize: options,
24879
- }
24880
- : options;
24928
+ targets.forEach((target) => computed.set(target));
24881
24929
 
24882
- const serializeFn = _options && _options.serialize;
24930
+ return computed;
24931
+ }
24883
24932
 
24884
- let serializedParams;
24933
+ static accessor(header) {
24934
+ const internals =
24935
+ (this[$internals] =
24936
+ this[$internals] =
24937
+ {
24938
+ accessors: {},
24939
+ });
24885
24940
 
24886
- if (serializeFn) {
24887
- serializedParams = serializeFn(params, _options);
24888
- } else {
24889
- serializedParams = utils$1.isURLSearchParams(params)
24890
- ? params.toString()
24891
- : new AxiosURLSearchParams(params, _options).toString(_encode);
24892
- }
24941
+ const accessors = internals.accessors;
24942
+ const prototype = this.prototype;
24893
24943
 
24894
- if (serializedParams) {
24895
- const hashmarkIndex = url.indexOf('#');
24944
+ function defineAccessor(_header) {
24945
+ const lHeader = normalizeHeader(_header);
24896
24946
 
24897
- if (hashmarkIndex !== -1) {
24898
- url = url.slice(0, hashmarkIndex);
24947
+ if (!accessors[lHeader]) {
24948
+ buildAccessors(prototype, _header);
24949
+ accessors[lHeader] = true;
24950
+ }
24899
24951
  }
24900
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
24901
- }
24902
24952
 
24903
- return url;
24904
- }
24953
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
24905
24954
 
24906
- class InterceptorManager {
24907
- constructor() {
24908
- this.handlers = [];
24955
+ return this;
24909
24956
  }
24957
+ };
24910
24958
 
24911
- /**
24912
- * Add a new interceptor to the stack
24913
- *
24914
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
24915
- * @param {Function} rejected The function to handle `reject` for a `Promise`
24916
- * @param {Object} options The options for the interceptor, synchronous and runWhen
24917
- *
24918
- * @return {Number} An ID used to remove interceptor later
24919
- */
24920
- use(fulfilled, rejected, options) {
24921
- this.handlers.push({
24922
- fulfilled,
24923
- rejected,
24924
- synchronous: options ? options.synchronous : false,
24925
- runWhen: options ? options.runWhen : null,
24926
- });
24927
- return this.handlers.length - 1;
24928
- }
24959
+ AxiosHeaders$1.accessor([
24960
+ 'Content-Type',
24961
+ 'Content-Length',
24962
+ 'Accept',
24963
+ 'Accept-Encoding',
24964
+ 'User-Agent',
24965
+ 'Authorization',
24966
+ ]);
24929
24967
 
24930
- /**
24931
- * Remove an interceptor from the stack
24932
- *
24933
- * @param {Number} id The ID that was returned by `use`
24934
- *
24935
- * @returns {void}
24936
- */
24937
- eject(id) {
24938
- if (this.handlers[id]) {
24939
- this.handlers[id] = null;
24940
- }
24968
+ // reserved names hotfix
24969
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
24970
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
24971
+ return {
24972
+ get: () => value,
24973
+ set(headerValue) {
24974
+ this[mapped] = headerValue;
24975
+ },
24976
+ };
24977
+ });
24978
+
24979
+ utils$1.freezeMethods(AxiosHeaders$1);
24980
+
24981
+ const REDACTED = '[REDACTED ****]';
24982
+
24983
+ function hasOwnOrPrototypeToJSON(source) {
24984
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
24985
+ return true;
24941
24986
  }
24942
24987
 
24943
- /**
24944
- * Clear all interceptors from the stack
24945
- *
24946
- * @returns {void}
24947
- */
24948
- clear() {
24949
- if (this.handlers) {
24950
- this.handlers = [];
24988
+ let prototype = Object.getPrototypeOf(source);
24989
+
24990
+ while (prototype && prototype !== Object.prototype) {
24991
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
24992
+ return true;
24951
24993
  }
24952
- }
24953
24994
 
24954
- /**
24955
- * Iterate over all the registered interceptors
24956
- *
24957
- * This method is particularly useful for skipping over any
24958
- * interceptors that may have become `null` calling `eject`.
24959
- *
24960
- * @param {Function} fn The function to call for each interceptor
24961
- *
24962
- * @returns {void}
24963
- */
24964
- forEach(fn) {
24965
- utils$1.forEach(this.handlers, function forEachHandler(h) {
24966
- if (h !== null) {
24967
- fn(h);
24968
- }
24969
- });
24995
+ prototype = Object.getPrototypeOf(prototype);
24970
24996
  }
24997
+
24998
+ return false;
24971
24999
  }
24972
25000
 
24973
- var transitionalDefaults = {
24974
- silentJSONParsing: true,
24975
- forcedJSONParsing: true,
24976
- clarifyTimeoutError: false,
24977
- legacyInterceptorReqResOrdering: true,
24978
- };
25001
+ // Build a plain-object snapshot of `config` and replace the value of any key
25002
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
25003
+ // and AxiosHeaders, and short-circuits on circular references.
25004
+ function redactConfig(config, redactKeys) {
25005
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
25006
+ const seen = [];
24979
25007
 
24980
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
25008
+ const visit = (source) => {
25009
+ if (source === null || typeof source !== 'object') return source;
25010
+ if (utils$1.isBuffer(source)) return source;
25011
+ if (seen.indexOf(source) !== -1) return undefined;
24981
25012
 
24982
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
25013
+ if (source instanceof AxiosHeaders$1) {
25014
+ source = source.toJSON();
25015
+ }
24983
25016
 
24984
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
25017
+ seen.push(source);
24985
25018
 
24986
- var platform$1 = {
24987
- isBrowser: true,
24988
- classes: {
24989
- URLSearchParams: URLSearchParams$1,
24990
- FormData: FormData$1,
24991
- Blob: Blob$1,
24992
- },
24993
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
24994
- };
25019
+ let result;
25020
+ if (utils$1.isArray(source)) {
25021
+ result = [];
25022
+ source.forEach((v, i) => {
25023
+ const reducedValue = visit(v);
25024
+ if (!utils$1.isUndefined(reducedValue)) {
25025
+ result[i] = reducedValue;
25026
+ }
25027
+ });
25028
+ } else {
25029
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
25030
+ seen.pop();
25031
+ return source;
25032
+ }
24995
25033
 
24996
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
25034
+ result = Object.create(null);
25035
+ for (const [key, value] of Object.entries(source)) {
25036
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
25037
+ if (!utils$1.isUndefined(reducedValue)) {
25038
+ result[key] = reducedValue;
25039
+ }
25040
+ }
25041
+ }
24997
25042
 
24998
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
25043
+ seen.pop();
25044
+ return result;
25045
+ };
24999
25046
 
25000
- /**
25001
- * Determine if we're running in a standard browser environment
25002
- *
25003
- * This allows axios to run in a web worker, and react-native.
25004
- * Both environments support XMLHttpRequest, but not fully standard globals.
25005
- *
25006
- * web workers:
25007
- * typeof window -> undefined
25008
- * typeof document -> undefined
25009
- *
25010
- * react-native:
25011
- * navigator.product -> 'ReactNative'
25012
- * nativescript
25013
- * navigator.product -> 'NativeScript' or 'NS'
25014
- *
25015
- * @returns {boolean}
25016
- */
25017
- const hasStandardBrowserEnv =
25018
- hasBrowserEnv &&
25019
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
25047
+ return visit(config);
25048
+ }
25020
25049
 
25021
- /**
25022
- * Determine if we're running in a standard browser webWorker environment
25023
- *
25024
- * Although the `isStandardBrowserEnv` method indicates that
25025
- * `allows axios to run in a web worker`, the WebWorker will still be
25026
- * filtered out due to its judgment standard
25027
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
25028
- * This leads to a problem when axios post `FormData` in webWorker
25029
- */
25030
- const hasStandardBrowserWebWorkerEnv = (() => {
25031
- return (
25032
- typeof WorkerGlobalScope !== 'undefined' &&
25033
- // eslint-disable-next-line no-undef
25034
- self instanceof WorkerGlobalScope &&
25035
- typeof self.importScripts === 'function'
25036
- );
25037
- })();
25050
+ let AxiosError$1 = class AxiosError extends Error {
25051
+ 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;
25054
+ axiosError.name = error.name;
25038
25055
 
25039
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
25056
+ // Preserve status from the original error if not already set from response
25057
+ if (error.status != null && axiosError.status == null) {
25058
+ axiosError.status = error.status;
25059
+ }
25040
25060
 
25041
- var utils$2 = /*#__PURE__*/Object.freeze({
25042
- __proto__: null,
25043
- hasBrowserEnv: hasBrowserEnv,
25044
- hasStandardBrowserEnv: hasStandardBrowserEnv,
25045
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25046
- navigator: _navigator,
25047
- origin: origin
25048
- });
25061
+ customProps && Object.assign(axiosError, customProps);
25062
+ return axiosError;
25063
+ }
25049
25064
 
25050
- var platform = {
25051
- ...utils$2,
25052
- ...platform$1,
25065
+ /**
25066
+ * Create an Error with the specified message, config, error code, request and response.
25067
+ *
25068
+ * @param {string} message The error message.
25069
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
25070
+ * @param {Object} [config] The config.
25071
+ * @param {Object} [request] The request.
25072
+ * @param {Object} [response] The response.
25073
+ *
25074
+ * @returns {Error} The created error.
25075
+ */
25076
+ constructor(message, code, config, request, response) {
25077
+ super(message);
25078
+
25079
+ // Make message enumerable to maintain backward compatibility
25080
+ // The native Error constructor sets message as non-enumerable,
25081
+ // but axios < v1.13.3 had it as enumerable
25082
+ Object.defineProperty(this, 'message', {
25083
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
25084
+ // this data descriptor into an accessor descriptor on the way in.
25085
+ __proto__: null,
25086
+ value: message,
25087
+ enumerable: true,
25088
+ writable: true,
25089
+ configurable: true,
25090
+ });
25091
+
25092
+ this.name = 'AxiosError';
25093
+ this.isAxiosError = true;
25094
+ code && (this.code = code);
25095
+ config && (this.config = config);
25096
+ request && (this.request = request);
25097
+ if (response) {
25098
+ this.response = response;
25099
+ this.status = response.status;
25100
+ }
25101
+ }
25102
+
25103
+ toJSON() {
25104
+ // Opt-in redaction: when the request config carries a `redact` array, the
25105
+ // value of any matching key (case-insensitive, at any depth) is replaced
25106
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
25107
+ // existing serialization behavior unchanged.
25108
+ const config = this.config;
25109
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
25110
+ const serializedConfig =
25111
+ utils$1.isArray(redactKeys) && redactKeys.length > 0
25112
+ ? redactConfig(config, redactKeys)
25113
+ : utils$1.toJSONObject(config);
25114
+
25115
+ return {
25116
+ // Standard
25117
+ message: this.message,
25118
+ name: this.name,
25119
+ // Microsoft
25120
+ description: this.description,
25121
+ number: this.number,
25122
+ // Mozilla
25123
+ fileName: this.fileName,
25124
+ lineNumber: this.lineNumber,
25125
+ columnNumber: this.columnNumber,
25126
+ stack: this.stack,
25127
+ // Axios
25128
+ config: serializedConfig,
25129
+ code: this.code,
25130
+ status: this.status,
25131
+ };
25132
+ }
25053
25133
  };
25054
25134
 
25055
- function toURLEncodedForm(data, options) {
25056
- return toFormData$1(data, new platform.classes.URLSearchParams(), {
25057
- visitor: function (value, key, path, helpers) {
25058
- if (platform.isNode && utils$1.isBuffer(value)) {
25059
- this.append(key, value.toString('base64'));
25060
- return false;
25061
- }
25135
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
25136
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
25137
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
25138
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
25139
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
25140
+ AxiosError$1.ECONNREFUSED = 'ECONNREFUSED';
25141
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
25142
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
25143
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
25144
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
25145
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
25146
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
25147
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
25148
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
25149
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
25150
+
25151
+ // eslint-disable-next-line strict
25152
+ var httpAdapter = null;
25062
25153
 
25063
- return helpers.defaultVisitor.apply(this, arguments);
25064
- },
25065
- ...options,
25066
- });
25154
+ /**
25155
+ * Determines if the given thing is a array or js object.
25156
+ *
25157
+ * @param {string} thing - The object or array to be visited.
25158
+ *
25159
+ * @returns {boolean}
25160
+ */
25161
+ function isVisitable(thing) {
25162
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
25067
25163
  }
25068
25164
 
25069
25165
  /**
25070
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25166
+ * It removes the brackets from the end of a string
25071
25167
  *
25072
- * @param {string} name - The name of the property to get.
25168
+ * @param {string} key - The key of the parameter.
25073
25169
  *
25074
- * @returns An array of strings.
25170
+ * @returns {string} the key without the brackets.
25075
25171
  */
25076
- function parsePropPath(name) {
25077
- // foo[x][y][z]
25078
- // foo.x.y.z
25079
- // foo-x-y-z
25080
- // foo x y z
25081
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
25082
- return match[0] === '[]' ? '' : match[1] || match[0];
25083
- });
25172
+ function removeBrackets(key) {
25173
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
25084
25174
  }
25085
25175
 
25086
25176
  /**
25087
- * Convert an array to an object.
25177
+ * It takes a path, a key, and a boolean, and returns a string
25088
25178
  *
25089
- * @param {Array<any>} arr - The array to convert to an object.
25179
+ * @param {string} path - The path to the current key.
25180
+ * @param {string} key - The key of the current object being iterated over.
25181
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
25090
25182
  *
25091
- * @returns An object with the same keys and values as the array.
25183
+ * @returns {string} The path to the current key.
25092
25184
  */
25093
- function arrayToObject(arr) {
25094
- const obj = {};
25095
- const keys = Object.keys(arr);
25096
- let i;
25097
- const len = keys.length;
25098
- let key;
25099
- for (i = 0; i < len; i++) {
25100
- key = keys[i];
25101
- obj[key] = arr[key];
25102
- }
25103
- return obj;
25185
+ function renderKey(path, key, dots) {
25186
+ if (!path) return key;
25187
+ return path
25188
+ .concat(key)
25189
+ .map(function each(token, i) {
25190
+ // eslint-disable-next-line no-param-reassign
25191
+ token = removeBrackets(token);
25192
+ return !dots && i ? '[' + token + ']' : token;
25193
+ })
25194
+ .join(dots ? '.' : '');
25104
25195
  }
25105
25196
 
25106
25197
  /**
25107
- * It takes a FormData object and returns a JavaScript object
25198
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
25108
25199
  *
25109
- * @param {string} formData The FormData object to convert to JSON.
25200
+ * @param {Array<any>} arr - The array to check
25110
25201
  *
25111
- * @returns {Object<string, any> | null} The converted object.
25202
+ * @returns {boolean}
25112
25203
  */
25113
- function formDataToJSON(formData) {
25114
- function buildPath(path, value, target, index) {
25115
- let name = path[index++];
25116
-
25117
- if (name === '__proto__') return true;
25118
-
25119
- const isNumericKey = Number.isFinite(+name);
25120
- const isLast = index >= path.length;
25121
- name = !name && utils$1.isArray(target) ? target.length : name;
25122
-
25123
- if (isLast) {
25124
- if (utils$1.hasOwnProp(target, name)) {
25125
- target[name] = [target[name], value];
25126
- } else {
25127
- target[name] = value;
25128
- }
25129
-
25130
- return !isNumericKey;
25131
- }
25132
-
25133
- if (!target[name] || !utils$1.isObject(target[name])) {
25134
- target[name] = [];
25135
- }
25136
-
25137
- const result = buildPath(path, value, target[name], index);
25138
-
25139
- if (result && utils$1.isArray(target[name])) {
25140
- target[name] = arrayToObject(target[name]);
25141
- }
25142
-
25143
- return !isNumericKey;
25144
- }
25145
-
25146
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
25147
- const obj = {};
25148
-
25149
- utils$1.forEachEntry(formData, (name, value) => {
25150
- buildPath(parsePropPath(name), value, obj, 0);
25151
- });
25204
+ function isFlatArray(arr) {
25205
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
25206
+ }
25152
25207
 
25153
- return obj;
25154
- }
25208
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
25209
+ return /^is[A-Z]/.test(prop);
25210
+ });
25155
25211
 
25156
- return null;
25157
- }
25212
+ /**
25213
+ * Convert a data object to FormData
25214
+ *
25215
+ * @param {Object} obj
25216
+ * @param {?Object} [formData]
25217
+ * @param {?Object} [options]
25218
+ * @param {Function} [options.visitor]
25219
+ * @param {Boolean} [options.metaTokens = true]
25220
+ * @param {Boolean} [options.dots = false]
25221
+ * @param {?Boolean} [options.indexes = false]
25222
+ *
25223
+ * @returns {Object}
25224
+ **/
25158
25225
 
25159
25226
  /**
25160
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
25161
- * of the input
25227
+ * It converts an object into a FormData object
25162
25228
  *
25163
- * @param {any} rawValue - The value to be stringified.
25164
- * @param {Function} parser - A function that parses a string into a JavaScript object.
25165
- * @param {Function} encoder - A function that takes a value and returns a string.
25229
+ * @param {Object<any, any>} obj - The object to convert to form data.
25230
+ * @param {string} formData - The FormData object to append to.
25231
+ * @param {Object<string, any>} options
25166
25232
  *
25167
- * @returns {string} A stringified version of the rawValue.
25233
+ * @returns
25168
25234
  */
25169
- function stringifySafely(rawValue, parser, encoder) {
25170
- if (utils$1.isString(rawValue)) {
25171
- try {
25172
- (parser || JSON.parse)(rawValue);
25173
- return utils$1.trim(rawValue);
25174
- } catch (e) {
25175
- if (e.name !== 'SyntaxError') {
25176
- throw e;
25177
- }
25178
- }
25235
+ function toFormData$1(obj, formData, options) {
25236
+ if (!utils$1.isObject(obj)) {
25237
+ throw new TypeError('target must be an object');
25179
25238
  }
25180
25239
 
25181
- return (encoder || JSON.stringify)(rawValue);
25182
- }
25240
+ // eslint-disable-next-line no-param-reassign
25241
+ formData = formData || new (FormData)();
25183
25242
 
25184
- const defaults = {
25185
- transitional: transitionalDefaults,
25243
+ // eslint-disable-next-line no-param-reassign
25244
+ options = utils$1.toFlatObject(
25245
+ options,
25246
+ {
25247
+ metaTokens: true,
25248
+ dots: false,
25249
+ indexes: false,
25250
+ },
25251
+ false,
25252
+ function defined(option, source) {
25253
+ // eslint-disable-next-line no-eq-null,eqeqeq
25254
+ return !utils$1.isUndefined(source[option]);
25255
+ }
25256
+ );
25186
25257
 
25187
- adapter: ['xhr', 'http', 'fetch'],
25258
+ const metaTokens = options.metaTokens;
25259
+ // eslint-disable-next-line no-use-before-define
25260
+ const visitor = options.visitor || defaultVisitor;
25261
+ const dots = options.dots;
25262
+ const indexes = options.indexes;
25263
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
25264
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
25265
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
25188
25266
 
25189
- transformRequest: [
25190
- function transformRequest(data, headers) {
25191
- const contentType = headers.getContentType() || '';
25192
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
25193
- const isObjectPayload = utils$1.isObject(data);
25267
+ if (!utils$1.isFunction(visitor)) {
25268
+ throw new TypeError('visitor must be a function');
25269
+ }
25194
25270
 
25195
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
25196
- data = new FormData(data);
25197
- }
25271
+ function convertValue(value) {
25272
+ if (value === null) return '';
25198
25273
 
25199
- const isFormData = utils$1.isFormData(data);
25274
+ if (utils$1.isDate(value)) {
25275
+ return value.toISOString();
25276
+ }
25200
25277
 
25201
- if (isFormData) {
25202
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
25203
- }
25278
+ if (utils$1.isBoolean(value)) {
25279
+ return value.toString();
25280
+ }
25204
25281
 
25205
- if (
25206
- utils$1.isArrayBuffer(data) ||
25207
- utils$1.isBuffer(data) ||
25208
- utils$1.isStream(data) ||
25209
- utils$1.isFile(data) ||
25210
- utils$1.isBlob(data) ||
25211
- utils$1.isReadableStream(data)
25212
- ) {
25213
- return data;
25214
- }
25215
- if (utils$1.isArrayBufferView(data)) {
25216
- return data.buffer;
25217
- }
25218
- if (utils$1.isURLSearchParams(data)) {
25219
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
25220
- return data.toString();
25221
- }
25282
+ if (!useBlob && utils$1.isBlob(value)) {
25283
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
25284
+ }
25222
25285
 
25223
- let isFileList;
25286
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
25287
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
25288
+ }
25289
+
25290
+ return value;
25291
+ }
25292
+
25293
+ /**
25294
+ * Default visitor.
25295
+ *
25296
+ * @param {*} value
25297
+ * @param {String|Number} key
25298
+ * @param {Array<String|Number>} path
25299
+ * @this {FormData}
25300
+ *
25301
+ * @returns {boolean} return true to visit the each prop of the value recursively
25302
+ */
25303
+ function defaultVisitor(value, key, path) {
25304
+ let arr = value;
25224
25305
 
25225
- if (isObjectPayload) {
25226
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
25227
- return toURLEncodedForm(data, this.formSerializer).toString();
25228
- }
25306
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
25307
+ formData.append(renderKey(path, key, dots), convertValue(value));
25308
+ return false;
25309
+ }
25229
25310
 
25230
- if (
25231
- (isFileList = utils$1.isFileList(data)) ||
25232
- contentType.indexOf('multipart/form-data') > -1
25233
- ) {
25234
- const _FormData = this.env && this.env.FormData;
25311
+ if (value && !path && typeof value === 'object') {
25312
+ if (utils$1.endsWith(key, '{}')) {
25313
+ // eslint-disable-next-line no-param-reassign
25314
+ key = metaTokens ? key : key.slice(0, -2);
25315
+ // eslint-disable-next-line no-param-reassign
25316
+ value = JSON.stringify(value);
25317
+ } else if (
25318
+ (utils$1.isArray(value) && isFlatArray(value)) ||
25319
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
25320
+ ) {
25321
+ // eslint-disable-next-line no-param-reassign
25322
+ key = removeBrackets(key);
25235
25323
 
25236
- return toFormData$1(
25237
- isFileList ? { 'files[]': data } : data,
25238
- _FormData && new _FormData(),
25239
- this.formSerializer
25240
- );
25241
- }
25324
+ arr.forEach(function each(el, index) {
25325
+ !(utils$1.isUndefined(el) || el === null) &&
25326
+ formData.append(
25327
+ // eslint-disable-next-line no-nested-ternary
25328
+ indexes === true
25329
+ ? renderKey([key], index, dots)
25330
+ : indexes === null
25331
+ ? key
25332
+ : key + '[]',
25333
+ convertValue(el)
25334
+ );
25335
+ });
25336
+ return false;
25242
25337
  }
25338
+ }
25243
25339
 
25244
- if (isObjectPayload || hasJSONContentType) {
25245
- headers.setContentType('application/json', false);
25246
- return stringifySafely(data);
25247
- }
25340
+ if (isVisitable(value)) {
25341
+ return true;
25342
+ }
25248
25343
 
25249
- return data;
25250
- },
25251
- ],
25344
+ formData.append(renderKey(path, key, dots), convertValue(value));
25252
25345
 
25253
- transformResponse: [
25254
- function transformResponse(data) {
25255
- const transitional = this.transitional || defaults.transitional;
25256
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
25257
- const JSONRequested = this.responseType === 'json';
25346
+ return false;
25347
+ }
25258
25348
 
25259
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
25260
- return data;
25261
- }
25349
+ const stack = [];
25262
25350
 
25263
- if (
25264
- data &&
25265
- utils$1.isString(data) &&
25266
- ((forcedJSONParsing && !this.responseType) || JSONRequested)
25267
- ) {
25268
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
25269
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
25351
+ const exposedHelpers = Object.assign(predicates, {
25352
+ defaultVisitor,
25353
+ convertValue,
25354
+ isVisitable,
25355
+ });
25270
25356
 
25271
- try {
25272
- return JSON.parse(data, this.parseReviver);
25273
- } catch (e) {
25274
- if (strictJSONParsing) {
25275
- if (e.name === 'SyntaxError') {
25276
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
25277
- }
25278
- throw e;
25279
- }
25280
- }
25281
- }
25357
+ function build(value, path, depth = 0) {
25358
+ if (utils$1.isUndefined(value)) return;
25282
25359
 
25283
- return data;
25284
- },
25285
- ],
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
+ }
25286
25366
 
25287
- /**
25288
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
25289
- * timeout is not created.
25290
- */
25291
- timeout: 0,
25367
+ if (stack.indexOf(value) !== -1) {
25368
+ throw Error('Circular reference detected in ' + path.join('.'));
25369
+ }
25292
25370
 
25293
- xsrfCookieName: 'XSRF-TOKEN',
25294
- xsrfHeaderName: 'X-XSRF-TOKEN',
25371
+ stack.push(value);
25295
25372
 
25296
- maxContentLength: -1,
25297
- maxBodyLength: -1,
25373
+ utils$1.forEach(value, function each(el, key) {
25374
+ const result =
25375
+ !(utils$1.isUndefined(el) || el === null) &&
25376
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
25298
25377
 
25299
- env: {
25300
- FormData: platform.classes.FormData,
25301
- Blob: platform.classes.Blob,
25302
- },
25378
+ if (result === true) {
25379
+ build(el, path ? path.concat(key) : [key], depth + 1);
25380
+ }
25381
+ });
25303
25382
 
25304
- validateStatus: function validateStatus(status) {
25305
- return status >= 200 && status < 300;
25306
- },
25383
+ stack.pop();
25384
+ }
25307
25385
 
25308
- headers: {
25309
- common: {
25310
- Accept: 'application/json, text/plain, */*',
25311
- 'Content-Type': undefined,
25312
- },
25313
- },
25314
- };
25386
+ if (!utils$1.isObject(obj)) {
25387
+ throw new TypeError('data must be an object');
25388
+ }
25315
25389
 
25316
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
25317
- defaults.headers[method] = {};
25318
- });
25390
+ build(obj);
25319
25391
 
25320
- // RawAxiosHeaders whose duplicates are ignored by node
25321
- // c.f. https://nodejs.org/api/http.html#http_message_headers
25322
- const ignoreDuplicateOf = utils$1.toObjectSet([
25323
- 'age',
25324
- 'authorization',
25325
- 'content-length',
25326
- 'content-type',
25327
- 'etag',
25328
- 'expires',
25329
- 'from',
25330
- 'host',
25331
- 'if-modified-since',
25332
- 'if-unmodified-since',
25333
- 'last-modified',
25334
- 'location',
25335
- 'max-forwards',
25336
- 'proxy-authorization',
25337
- 'referer',
25338
- 'retry-after',
25339
- 'user-agent',
25340
- ]);
25392
+ return formData;
25393
+ }
25341
25394
 
25342
25395
  /**
25343
- * Parse headers into an object
25344
- *
25345
- * ```
25346
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
25347
- * Content-Type: application/json
25348
- * Connection: keep-alive
25349
- * Transfer-Encoding: chunked
25350
- * ```
25396
+ * It encodes a string by replacing all characters that are not in the unreserved set with
25397
+ * their percent-encoded equivalents
25351
25398
  *
25352
- * @param {String} rawHeaders Headers needing to be parsed
25399
+ * @param {string} str - The string to encode.
25353
25400
  *
25354
- * @returns {Object} Headers parsed into an object
25401
+ * @returns {string} The encoded string.
25355
25402
  */
25356
- var parseHeaders = (rawHeaders) => {
25357
- const parsed = {};
25358
- let key;
25359
- let val;
25360
- let i;
25403
+ function encode$1(str) {
25404
+ const charMap = {
25405
+ '!': '%21',
25406
+ "'": '%27',
25407
+ '(': '%28',
25408
+ ')': '%29',
25409
+ '~': '%7E',
25410
+ '%20': '+',
25411
+ };
25412
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
25413
+ return charMap[match];
25414
+ });
25415
+ }
25361
25416
 
25362
- rawHeaders &&
25363
- rawHeaders.split('\n').forEach(function parser(line) {
25364
- i = line.indexOf(':');
25365
- key = line.substring(0, i).trim().toLowerCase();
25366
- val = line.substring(i + 1).trim();
25417
+ /**
25418
+ * It takes a params object and converts it to a FormData object
25419
+ *
25420
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
25421
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
25422
+ *
25423
+ * @returns {void}
25424
+ */
25425
+ function AxiosURLSearchParams(params, options) {
25426
+ this._pairs = [];
25367
25427
 
25368
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
25369
- return;
25370
- }
25428
+ params && toFormData$1(params, this, options);
25429
+ }
25371
25430
 
25372
- if (key === 'set-cookie') {
25373
- if (parsed[key]) {
25374
- parsed[key].push(val);
25375
- } else {
25376
- parsed[key] = [val];
25377
- }
25378
- } else {
25379
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
25380
- }
25381
- });
25431
+ const prototype = AxiosURLSearchParams.prototype;
25382
25432
 
25383
- return parsed;
25433
+ prototype.append = function append(name, value) {
25434
+ this._pairs.push([name, value]);
25384
25435
  };
25385
25436
 
25386
- const $internals = Symbol('internals');
25387
-
25388
- const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
25389
-
25390
- function assertValidHeaderValue(value, header) {
25391
- if (value === false || value == null) {
25392
- return;
25393
- }
25394
-
25395
- if (utils$1.isArray(value)) {
25396
- value.forEach((v) => assertValidHeaderValue(v, header));
25397
- return;
25398
- }
25437
+ prototype.toString = function toString(encoder) {
25438
+ const _encode = encoder
25439
+ ? function (value) {
25440
+ return encoder.call(this, value, encode$1);
25441
+ }
25442
+ : encode$1;
25399
25443
 
25400
- if (!isValidHeaderValue(String(value))) {
25401
- throw new Error(`Invalid character in header content ["${header}"]`);
25402
- }
25403
- }
25444
+ return this._pairs
25445
+ .map(function each(pair) {
25446
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
25447
+ }, '')
25448
+ .join('&');
25449
+ };
25404
25450
 
25405
- function normalizeHeader(header) {
25406
- return header && String(header).trim().toLowerCase();
25451
+ /**
25452
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
25453
+ * their plain counterparts (`:`, `$`, `,`, `+`).
25454
+ *
25455
+ * @param {string} val The value to be encoded.
25456
+ *
25457
+ * @returns {string} The encoded value.
25458
+ */
25459
+ function encode(val) {
25460
+ return encodeURIComponent(val)
25461
+ .replace(/%3A/gi, ':')
25462
+ .replace(/%24/g, '$')
25463
+ .replace(/%2C/gi, ',')
25464
+ .replace(/%20/g, '+');
25407
25465
  }
25408
25466
 
25409
- function stripTrailingCRLF(str) {
25410
- let end = str.length;
25467
+ /**
25468
+ * Build a URL by appending params to the end
25469
+ *
25470
+ * @param {string} url The base of the url (e.g., http://www.google.com)
25471
+ * @param {object} [params] The params to be appended
25472
+ * @param {?(object|Function)} options
25473
+ *
25474
+ * @returns {string} The formatted url
25475
+ */
25476
+ function buildURL(url, params, options) {
25477
+ if (!params) {
25478
+ return url;
25479
+ }
25411
25480
 
25412
- while (end > 0) {
25413
- const charCode = str.charCodeAt(end - 1);
25481
+ const _encode = (options && options.encode) || encode;
25414
25482
 
25415
- if (charCode !== 10 && charCode !== 13) {
25416
- break;
25417
- }
25483
+ const _options = utils$1.isFunction(options)
25484
+ ? {
25485
+ serialize: options,
25486
+ }
25487
+ : options;
25418
25488
 
25419
- end -= 1;
25420
- }
25489
+ const serializeFn = _options && _options.serialize;
25421
25490
 
25422
- return end === str.length ? str : str.slice(0, end);
25423
- }
25491
+ let serializedParams;
25424
25492
 
25425
- function normalizeValue(value) {
25426
- if (value === false || value == null) {
25427
- return value;
25493
+ if (serializeFn) {
25494
+ serializedParams = serializeFn(params, _options);
25495
+ } else {
25496
+ serializedParams = utils$1.isURLSearchParams(params)
25497
+ ? params.toString()
25498
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
25428
25499
  }
25429
25500
 
25430
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
25431
- }
25432
-
25433
- function parseTokens(str) {
25434
- const tokens = Object.create(null);
25435
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
25436
- let match;
25501
+ if (serializedParams) {
25502
+ const hashmarkIndex = url.indexOf('#');
25437
25503
 
25438
- while ((match = tokensRE.exec(str))) {
25439
- tokens[match[1]] = match[2];
25504
+ if (hashmarkIndex !== -1) {
25505
+ url = url.slice(0, hashmarkIndex);
25506
+ }
25507
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
25440
25508
  }
25441
25509
 
25442
- return tokens;
25510
+ return url;
25443
25511
  }
25444
25512
 
25445
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
25446
-
25447
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
25448
- if (utils$1.isFunction(filter)) {
25449
- return filter.call(this, value, header);
25513
+ class InterceptorManager {
25514
+ constructor() {
25515
+ this.handlers = [];
25450
25516
  }
25451
25517
 
25452
- if (isHeaderNameFilter) {
25453
- value = header;
25518
+ /**
25519
+ * Add a new interceptor to the stack
25520
+ *
25521
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
25522
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
25523
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
25524
+ *
25525
+ * @return {Number} An ID used to remove interceptor later
25526
+ */
25527
+ use(fulfilled, rejected, options) {
25528
+ this.handlers.push({
25529
+ fulfilled,
25530
+ rejected,
25531
+ synchronous: options ? options.synchronous : false,
25532
+ runWhen: options ? options.runWhen : null,
25533
+ });
25534
+ return this.handlers.length - 1;
25454
25535
  }
25455
25536
 
25456
- if (!utils$1.isString(value)) return;
25457
-
25458
- if (utils$1.isString(filter)) {
25459
- return value.indexOf(filter) !== -1;
25537
+ /**
25538
+ * Remove an interceptor from the stack
25539
+ *
25540
+ * @param {Number} id The ID that was returned by `use`
25541
+ *
25542
+ * @returns {void}
25543
+ */
25544
+ eject(id) {
25545
+ if (this.handlers[id]) {
25546
+ this.handlers[id] = null;
25547
+ }
25460
25548
  }
25461
25549
 
25462
- if (utils$1.isRegExp(filter)) {
25463
- return filter.test(value);
25550
+ /**
25551
+ * Clear all interceptors from the stack
25552
+ *
25553
+ * @returns {void}
25554
+ */
25555
+ clear() {
25556
+ if (this.handlers) {
25557
+ this.handlers = [];
25558
+ }
25464
25559
  }
25465
- }
25466
-
25467
- function formatHeader(header) {
25468
- return header
25469
- .trim()
25470
- .toLowerCase()
25471
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
25472
- return char.toUpperCase() + str;
25473
- });
25474
- }
25475
-
25476
- function buildAccessors(obj, header) {
25477
- const accessorName = utils$1.toCamelCase(' ' + header);
25478
25560
 
25479
- ['get', 'set', 'has'].forEach((methodName) => {
25480
- Object.defineProperty(obj, methodName + accessorName, {
25481
- value: function (arg1, arg2, arg3) {
25482
- return this[methodName].call(this, header, arg1, arg2, arg3);
25483
- },
25484
- configurable: true,
25561
+ /**
25562
+ * Iterate over all the registered interceptors
25563
+ *
25564
+ * This method is particularly useful for skipping over any
25565
+ * interceptors that may have become `null` calling `eject`.
25566
+ *
25567
+ * @param {Function} fn The function to call for each interceptor
25568
+ *
25569
+ * @returns {void}
25570
+ */
25571
+ forEach(fn) {
25572
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
25573
+ if (h !== null) {
25574
+ fn(h);
25575
+ }
25485
25576
  });
25486
- });
25487
- }
25488
-
25489
- let AxiosHeaders$1 = class AxiosHeaders {
25490
- constructor(headers) {
25491
- headers && this.set(headers);
25492
25577
  }
25578
+ }
25493
25579
 
25494
- set(header, valueOrRewrite, rewrite) {
25495
- const self = this;
25496
-
25497
- function setHeader(_value, _header, _rewrite) {
25498
- const lHeader = normalizeHeader(_header);
25499
-
25500
- if (!lHeader) {
25501
- throw new Error('header name must be a non-empty string');
25502
- }
25503
-
25504
- const key = utils$1.findKey(self, lHeader);
25505
-
25506
- if (
25507
- !key ||
25508
- self[key] === undefined ||
25509
- _rewrite === true ||
25510
- (_rewrite === undefined && self[key] !== false)
25511
- ) {
25512
- assertValidHeaderValue(_value, _header);
25513
- self[key || _header] = normalizeValue(_value);
25514
- }
25515
- }
25516
-
25517
- const setHeaders = (headers, _rewrite) =>
25518
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
25580
+ var transitionalDefaults = {
25581
+ silentJSONParsing: true,
25582
+ forcedJSONParsing: true,
25583
+ clarifyTimeoutError: false,
25584
+ legacyInterceptorReqResOrdering: true,
25585
+ };
25519
25586
 
25520
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
25521
- setHeaders(header, valueOrRewrite);
25522
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
25523
- setHeaders(parseHeaders(header), valueOrRewrite);
25524
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
25525
- let obj = {},
25526
- dest,
25527
- key;
25528
- for (const entry of header) {
25529
- if (!utils$1.isArray(entry)) {
25530
- throw TypeError('Object iterator must return a key-value pair');
25531
- }
25587
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
25532
25588
 
25533
- obj[(key = entry[0])] = (dest = obj[key])
25534
- ? utils$1.isArray(dest)
25535
- ? [...dest, entry[1]]
25536
- : [dest, entry[1]]
25537
- : entry[1];
25538
- }
25589
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
25539
25590
 
25540
- setHeaders(obj, valueOrRewrite);
25541
- } else {
25542
- header != null && setHeader(valueOrRewrite, header, rewrite);
25543
- }
25591
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
25544
25592
 
25545
- return this;
25546
- }
25593
+ var platform$1 = {
25594
+ isBrowser: true,
25595
+ classes: {
25596
+ URLSearchParams: URLSearchParams$1,
25597
+ FormData: FormData$1,
25598
+ Blob: Blob$1,
25599
+ },
25600
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
25601
+ };
25547
25602
 
25548
- get(header, parser) {
25549
- header = normalizeHeader(header);
25603
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
25550
25604
 
25551
- if (header) {
25552
- const key = utils$1.findKey(this, header);
25605
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
25553
25606
 
25554
- if (key) {
25555
- const value = this[key];
25607
+ /**
25608
+ * Determine if we're running in a standard browser environment
25609
+ *
25610
+ * This allows axios to run in a web worker, and react-native.
25611
+ * Both environments support XMLHttpRequest, but not fully standard globals.
25612
+ *
25613
+ * web workers:
25614
+ * typeof window -> undefined
25615
+ * typeof document -> undefined
25616
+ *
25617
+ * react-native:
25618
+ * navigator.product -> 'ReactNative'
25619
+ * nativescript
25620
+ * navigator.product -> 'NativeScript' or 'NS'
25621
+ *
25622
+ * @returns {boolean}
25623
+ */
25624
+ const hasStandardBrowserEnv =
25625
+ hasBrowserEnv &&
25626
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
25556
25627
 
25557
- if (!parser) {
25558
- return value;
25559
- }
25628
+ /**
25629
+ * Determine if we're running in a standard browser webWorker environment
25630
+ *
25631
+ * Although the `isStandardBrowserEnv` method indicates that
25632
+ * `allows axios to run in a web worker`, the WebWorker will still be
25633
+ * filtered out due to its judgment standard
25634
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
25635
+ * This leads to a problem when axios post `FormData` in webWorker
25636
+ */
25637
+ const hasStandardBrowserWebWorkerEnv = (() => {
25638
+ return (
25639
+ typeof WorkerGlobalScope !== 'undefined' &&
25640
+ // eslint-disable-next-line no-undef
25641
+ self instanceof WorkerGlobalScope &&
25642
+ typeof self.importScripts === 'function'
25643
+ );
25644
+ })();
25560
25645
 
25561
- if (parser === true) {
25562
- return parseTokens(value);
25563
- }
25646
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
25564
25647
 
25565
- if (utils$1.isFunction(parser)) {
25566
- return parser.call(this, value, key);
25567
- }
25648
+ var utils$2 = /*#__PURE__*/Object.freeze({
25649
+ __proto__: null,
25650
+ hasBrowserEnv: hasBrowserEnv,
25651
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
25652
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25653
+ navigator: _navigator,
25654
+ origin: origin
25655
+ });
25568
25656
 
25569
- if (utils$1.isRegExp(parser)) {
25570
- return parser.exec(value);
25571
- }
25657
+ var platform = {
25658
+ ...utils$2,
25659
+ ...platform$1,
25660
+ };
25572
25661
 
25573
- throw new TypeError('parser must be boolean|regexp|function');
25662
+ function toURLEncodedForm(data, options) {
25663
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
25664
+ visitor: function (value, key, path, helpers) {
25665
+ if (platform.isNode && utils$1.isBuffer(value)) {
25666
+ this.append(key, value.toString('base64'));
25667
+ return false;
25574
25668
  }
25575
- }
25576
- }
25577
-
25578
- has(header, matcher) {
25579
- header = normalizeHeader(header);
25580
25669
 
25581
- if (header) {
25582
- const key = utils$1.findKey(this, header);
25670
+ return helpers.defaultVisitor.apply(this, arguments);
25671
+ },
25672
+ ...options,
25673
+ });
25674
+ }
25583
25675
 
25584
- return !!(
25585
- key &&
25586
- this[key] !== undefined &&
25587
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
25588
- );
25589
- }
25676
+ /**
25677
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25678
+ *
25679
+ * @param {string} name - The name of the property to get.
25680
+ *
25681
+ * @returns An array of strings.
25682
+ */
25683
+ 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
+ });
25691
+ }
25590
25692
 
25591
- return false;
25693
+ /**
25694
+ * Convert an array to an object.
25695
+ *
25696
+ * @param {Array<any>} arr - The array to convert to an object.
25697
+ *
25698
+ * @returns An object with the same keys and values as the array.
25699
+ */
25700
+ function arrayToObject(arr) {
25701
+ const obj = {};
25702
+ const keys = Object.keys(arr);
25703
+ let i;
25704
+ const len = keys.length;
25705
+ let key;
25706
+ for (i = 0; i < len; i++) {
25707
+ key = keys[i];
25708
+ obj[key] = arr[key];
25592
25709
  }
25710
+ return obj;
25711
+ }
25593
25712
 
25594
- delete(header, matcher) {
25595
- const self = this;
25596
- let deleted = false;
25597
-
25598
- function deleteHeader(_header) {
25599
- _header = normalizeHeader(_header);
25713
+ /**
25714
+ * It takes a FormData object and returns a JavaScript object
25715
+ *
25716
+ * @param {string} formData The FormData object to convert to JSON.
25717
+ *
25718
+ * @returns {Object<string, any> | null} The converted object.
25719
+ */
25720
+ function formDataToJSON(formData) {
25721
+ function buildPath(path, value, target, index) {
25722
+ let name = path[index++];
25600
25723
 
25601
- if (_header) {
25602
- const key = utils$1.findKey(self, _header);
25724
+ if (name === '__proto__') return true;
25603
25725
 
25604
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
25605
- delete self[key];
25726
+ const isNumericKey = Number.isFinite(+name);
25727
+ const isLast = index >= path.length;
25728
+ name = !name && utils$1.isArray(target) ? target.length : name;
25606
25729
 
25607
- deleted = true;
25608
- }
25730
+ if (isLast) {
25731
+ if (utils$1.hasOwnProp(target, name)) {
25732
+ target[name] = utils$1.isArray(target[name])
25733
+ ? target[name].concat(value)
25734
+ : [target[name], value];
25735
+ } else {
25736
+ target[name] = value;
25609
25737
  }
25738
+
25739
+ return !isNumericKey;
25610
25740
  }
25611
25741
 
25612
- if (utils$1.isArray(header)) {
25613
- header.forEach(deleteHeader);
25614
- } else {
25615
- deleteHeader(header);
25742
+ if (!target[name] || !utils$1.isObject(target[name])) {
25743
+ target[name] = [];
25616
25744
  }
25617
25745
 
25618
- return deleted;
25746
+ const result = buildPath(path, value, target[name], index);
25747
+
25748
+ if (result && utils$1.isArray(target[name])) {
25749
+ target[name] = arrayToObject(target[name]);
25750
+ }
25751
+
25752
+ return !isNumericKey;
25619
25753
  }
25620
25754
 
25621
- clear(matcher) {
25622
- const keys = Object.keys(this);
25623
- let i = keys.length;
25624
- let deleted = false;
25755
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
25756
+ const obj = {};
25625
25757
 
25626
- while (i--) {
25627
- const key = keys[i];
25628
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
25629
- delete this[key];
25630
- deleted = true;
25631
- }
25632
- }
25758
+ utils$1.forEachEntry(formData, (name, value) => {
25759
+ buildPath(parsePropPath(name), value, obj, 0);
25760
+ });
25633
25761
 
25634
- return deleted;
25762
+ return obj;
25635
25763
  }
25636
25764
 
25637
- normalize(format) {
25638
- const self = this;
25639
- const headers = {};
25765
+ return null;
25766
+ }
25640
25767
 
25641
- utils$1.forEach(this, (value, header) => {
25642
- const key = utils$1.findKey(headers, header);
25768
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
25643
25769
 
25644
- if (key) {
25645
- self[key] = normalizeValue(value);
25646
- delete self[header];
25647
- return;
25770
+ /**
25771
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
25772
+ * of the input
25773
+ *
25774
+ * @param {any} rawValue - The value to be stringified.
25775
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
25776
+ * @param {Function} encoder - A function that takes a value and returns a string.
25777
+ *
25778
+ * @returns {string} A stringified version of the rawValue.
25779
+ */
25780
+ function stringifySafely(rawValue, parser, encoder) {
25781
+ if (utils$1.isString(rawValue)) {
25782
+ try {
25783
+ (parser || JSON.parse)(rawValue);
25784
+ return utils$1.trim(rawValue);
25785
+ } catch (e) {
25786
+ if (e.name !== 'SyntaxError') {
25787
+ throw e;
25648
25788
  }
25789
+ }
25790
+ }
25649
25791
 
25650
- const normalized = format ? formatHeader(header) : String(header).trim();
25792
+ return (encoder || JSON.stringify)(rawValue);
25793
+ }
25651
25794
 
25652
- if (normalized !== header) {
25653
- delete self[header];
25654
- }
25795
+ const defaults = {
25796
+ transitional: transitionalDefaults,
25655
25797
 
25656
- self[normalized] = normalizeValue(value);
25798
+ adapter: ['xhr', 'http', 'fetch'],
25657
25799
 
25658
- headers[normalized] = true;
25659
- });
25800
+ transformRequest: [
25801
+ function transformRequest(data, headers) {
25802
+ const contentType = headers.getContentType() || '';
25803
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
25804
+ const isObjectPayload = utils$1.isObject(data);
25660
25805
 
25661
- return this;
25662
- }
25806
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
25807
+ data = new FormData(data);
25808
+ }
25663
25809
 
25664
- concat(...targets) {
25665
- return this.constructor.concat(this, ...targets);
25666
- }
25810
+ const isFormData = utils$1.isFormData(data);
25667
25811
 
25668
- toJSON(asStrings) {
25669
- const obj = Object.create(null);
25812
+ if (isFormData) {
25813
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
25814
+ }
25670
25815
 
25671
- utils$1.forEach(this, (value, header) => {
25672
- value != null &&
25673
- value !== false &&
25674
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
25675
- });
25816
+ if (
25817
+ utils$1.isArrayBuffer(data) ||
25818
+ utils$1.isBuffer(data) ||
25819
+ utils$1.isStream(data) ||
25820
+ utils$1.isFile(data) ||
25821
+ utils$1.isBlob(data) ||
25822
+ utils$1.isReadableStream(data)
25823
+ ) {
25824
+ return data;
25825
+ }
25826
+ if (utils$1.isArrayBufferView(data)) {
25827
+ return data.buffer;
25828
+ }
25829
+ if (utils$1.isURLSearchParams(data)) {
25830
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
25831
+ return data.toString();
25832
+ }
25676
25833
 
25677
- return obj;
25678
- }
25834
+ let isFileList;
25679
25835
 
25680
- [Symbol.iterator]() {
25681
- return Object.entries(this.toJSON())[Symbol.iterator]();
25682
- }
25836
+ if (isObjectPayload) {
25837
+ const formSerializer = own(this, 'formSerializer');
25838
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
25839
+ return toURLEncodedForm(data, formSerializer).toString();
25840
+ }
25683
25841
 
25684
- toString() {
25685
- return Object.entries(this.toJSON())
25686
- .map(([header, value]) => header + ': ' + value)
25687
- .join('\n');
25688
- }
25842
+ if (
25843
+ (isFileList = utils$1.isFileList(data)) ||
25844
+ contentType.indexOf('multipart/form-data') > -1
25845
+ ) {
25846
+ const env = own(this, 'env');
25847
+ const _FormData = env && env.FormData;
25689
25848
 
25690
- getSetCookie() {
25691
- return this.get('set-cookie') || [];
25692
- }
25849
+ return toFormData$1(
25850
+ isFileList ? { 'files[]': data } : data,
25851
+ _FormData && new _FormData(),
25852
+ formSerializer
25853
+ );
25854
+ }
25855
+ }
25693
25856
 
25694
- get [Symbol.toStringTag]() {
25695
- return 'AxiosHeaders';
25696
- }
25857
+ if (isObjectPayload || hasJSONContentType) {
25858
+ headers.setContentType('application/json', false);
25859
+ return stringifySafely(data);
25860
+ }
25697
25861
 
25698
- static from(thing) {
25699
- return thing instanceof this ? thing : new this(thing);
25700
- }
25862
+ return data;
25863
+ },
25864
+ ],
25701
25865
 
25702
- static concat(first, ...targets) {
25703
- const computed = new this(first);
25866
+ transformResponse: [
25867
+ function transformResponse(data) {
25868
+ const transitional = own(this, 'transitional') || defaults.transitional;
25869
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
25870
+ const responseType = own(this, 'responseType');
25871
+ const JSONRequested = responseType === 'json';
25704
25872
 
25705
- targets.forEach((target) => computed.set(target));
25873
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
25874
+ return data;
25875
+ }
25706
25876
 
25707
- return computed;
25708
- }
25877
+ if (
25878
+ data &&
25879
+ utils$1.isString(data) &&
25880
+ ((forcedJSONParsing && !responseType) || JSONRequested)
25881
+ ) {
25882
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
25883
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
25709
25884
 
25710
- static accessor(header) {
25711
- const internals =
25712
- (this[$internals] =
25713
- this[$internals] =
25714
- {
25715
- accessors: {},
25716
- });
25885
+ try {
25886
+ return JSON.parse(data, own(this, 'parseReviver'));
25887
+ } catch (e) {
25888
+ if (strictJSONParsing) {
25889
+ if (e.name === 'SyntaxError') {
25890
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
25891
+ }
25892
+ throw e;
25893
+ }
25894
+ }
25895
+ }
25717
25896
 
25718
- const accessors = internals.accessors;
25719
- const prototype = this.prototype;
25897
+ return data;
25898
+ },
25899
+ ],
25720
25900
 
25721
- function defineAccessor(_header) {
25722
- const lHeader = normalizeHeader(_header);
25901
+ /**
25902
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
25903
+ * timeout is not created.
25904
+ */
25905
+ timeout: 0,
25723
25906
 
25724
- if (!accessors[lHeader]) {
25725
- buildAccessors(prototype, _header);
25726
- accessors[lHeader] = true;
25727
- }
25728
- }
25907
+ xsrfCookieName: 'XSRF-TOKEN',
25908
+ xsrfHeaderName: 'X-XSRF-TOKEN',
25729
25909
 
25730
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
25910
+ maxContentLength: -1,
25911
+ maxBodyLength: -1,
25731
25912
 
25732
- return this;
25733
- }
25734
- };
25913
+ env: {
25914
+ FormData: platform.classes.FormData,
25915
+ Blob: platform.classes.Blob,
25916
+ },
25735
25917
 
25736
- AxiosHeaders$1.accessor([
25737
- 'Content-Type',
25738
- 'Content-Length',
25739
- 'Accept',
25740
- 'Accept-Encoding',
25741
- 'User-Agent',
25742
- 'Authorization',
25743
- ]);
25918
+ validateStatus: function validateStatus(status) {
25919
+ return status >= 200 && status < 300;
25920
+ },
25744
25921
 
25745
- // reserved names hotfix
25746
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
25747
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
25748
- return {
25749
- get: () => value,
25750
- set(headerValue) {
25751
- this[mapped] = headerValue;
25922
+ headers: {
25923
+ common: {
25924
+ Accept: 'application/json, text/plain, */*',
25925
+ 'Content-Type': undefined,
25752
25926
  },
25753
- };
25754
- });
25927
+ },
25928
+ };
25755
25929
 
25756
- utils$1.freezeMethods(AxiosHeaders$1);
25930
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
25931
+ defaults.headers[method] = {};
25932
+ });
25757
25933
 
25758
25934
  /**
25759
25935
  * Transform the data for a request or a response
@@ -25813,22 +25989,18 @@
25813
25989
  if (!response.status || !validateStatus || validateStatus(response.status)) {
25814
25990
  resolve(response);
25815
25991
  } else {
25816
- reject(
25817
- new AxiosError$1(
25818
- 'Request failed with status code ' + response.status,
25819
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
25820
- Math.floor(response.status / 100) - 4
25821
- ],
25822
- response.config,
25823
- response.request,
25824
- response
25825
- )
25826
- );
25992
+ reject(new AxiosError$1(
25993
+ 'Request failed with status code ' + response.status,
25994
+ response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
25995
+ response.config,
25996
+ response.request,
25997
+ response
25998
+ ));
25827
25999
  }
25828
26000
  }
25829
26001
 
25830
26002
  function parseProtocol(url) {
25831
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
26003
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
25832
26004
  return (match && match[1]) || '';
25833
26005
  }
25834
26006
 
@@ -25932,13 +26104,13 @@
25932
26104
  const _speedometer = speedometer(50, 250);
25933
26105
 
25934
26106
  return throttle((e) => {
25935
- const loaded = e.loaded;
26107
+ const rawLoaded = e.loaded;
25936
26108
  const total = e.lengthComputable ? e.total : undefined;
25937
- const progressBytes = loaded - bytesNotified;
26109
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
26110
+ const progressBytes = Math.max(0, loaded - bytesNotified);
25938
26111
  const rate = _speedometer(progressBytes);
25939
- const inRange = loaded <= total;
25940
26112
 
25941
- bytesNotified = loaded;
26113
+ bytesNotified = Math.max(bytesNotified, loaded);
25942
26114
 
25943
26115
  const data = {
25944
26116
  loaded,
@@ -25946,7 +26118,7 @@
25946
26118
  progress: total ? loaded / total : undefined,
25947
26119
  bytes: progressBytes,
25948
26120
  rate: rate ? rate : undefined,
25949
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
26121
+ estimated: rate && total ? (total - loaded) / rate : undefined,
25950
26122
  event: e,
25951
26123
  lengthComputable: total != null,
25952
26124
  [isDownloadStream ? 'download' : 'upload']: true,
@@ -26019,8 +26191,20 @@
26019
26191
 
26020
26192
  read(name) {
26021
26193
  if (typeof document === 'undefined') return null;
26022
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
26023
- return match ? decodeURIComponent(match[1]) : null;
26194
+ // Match name=value by splitting on the semicolon separator instead of building a
26195
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
26196
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
26197
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
26198
+ // "; ", so ignore optional whitespace before each cookie name.
26199
+ const cookies = document.cookie.split(';');
26200
+ for (let i = 0; i < cookies.length; i++) {
26201
+ const cookie = cookies[i].replace(/^\s+/, '');
26202
+ const eq = cookie.indexOf('=');
26203
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
26204
+ return decodeURIComponent(cookie.slice(eq + 1));
26205
+ }
26206
+ }
26207
+ return null;
26024
26208
  },
26025
26209
 
26026
26210
  remove(name) {
@@ -26080,7 +26264,7 @@
26080
26264
  */
26081
26265
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
26082
26266
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
26083
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
26267
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
26084
26268
  return combineURLs(baseURL, requestedURL);
26085
26269
  }
26086
26270
  return requestedURL;
@@ -26100,7 +26284,21 @@
26100
26284
  function mergeConfig$1(config1, config2) {
26101
26285
  // eslint-disable-next-line no-param-reassign
26102
26286
  config2 = config2 || {};
26103
- const config = {};
26287
+
26288
+ // Use a null-prototype object so that downstream reads such as `config.auth`
26289
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
26290
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
26291
+ // ergonomics for user code that relies on it.
26292
+ const config = Object.create(null);
26293
+ Object.defineProperty(config, 'hasOwnProperty', {
26294
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
26295
+ // this data descriptor into an accessor descriptor on the way in.
26296
+ __proto__: null,
26297
+ value: Object.prototype.hasOwnProperty,
26298
+ enumerable: false,
26299
+ writable: true,
26300
+ configurable: true,
26301
+ });
26104
26302
 
26105
26303
  function getMergedValue(target, source, prop, caseless) {
26106
26304
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
@@ -26139,9 +26337,9 @@
26139
26337
 
26140
26338
  // eslint-disable-next-line consistent-return
26141
26339
  function mergeDirectKeys(a, b, prop) {
26142
- if (prop in config2) {
26340
+ if (utils$1.hasOwnProp(config2, prop)) {
26143
26341
  return getMergedValue(a, b);
26144
- } else if (prop in config1) {
26342
+ } else if (utils$1.hasOwnProp(config1, prop)) {
26145
26343
  return getMergedValue(undefined, a);
26146
26344
  }
26147
26345
  }
@@ -26173,6 +26371,7 @@
26173
26371
  httpsAgent: defaultToConfig2,
26174
26372
  cancelToken: defaultToConfig2,
26175
26373
  socketPath: defaultToConfig2,
26374
+ allowedSocketPaths: defaultToConfig2,
26176
26375
  responseEncoding: defaultToConfig2,
26177
26376
  validateStatus: mergeDirectKeys,
26178
26377
  headers: (a, b, prop) =>
@@ -26182,22 +26381,64 @@
26182
26381
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26183
26382
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
26184
26383
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
26185
- const configValue = merge(config1[prop], config2[prop], prop);
26384
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
26385
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
26386
+ const configValue = merge(a, b, prop);
26186
26387
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
26187
26388
  });
26188
26389
 
26189
26390
  return config;
26190
26391
  }
26191
26392
 
26393
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
26394
+
26395
+ function setFormDataHeaders(headers, formHeaders, policy) {
26396
+ if (policy !== 'content-only') {
26397
+ headers.set(formHeaders);
26398
+ return;
26399
+ }
26400
+
26401
+ Object.entries(formHeaders).forEach(([key, val]) => {
26402
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
26403
+ headers.set(key, val);
26404
+ }
26405
+ });
26406
+ }
26407
+
26408
+ /**
26409
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
26410
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
26411
+ *
26412
+ * @param {string} str The string to encode
26413
+ *
26414
+ * @returns {string} UTF-8 bytes as a Latin-1 string
26415
+ */
26416
+ const encodeUTF8 = (str) =>
26417
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
26418
+ String.fromCharCode(parseInt(hex, 16))
26419
+ );
26420
+
26192
26421
  var resolveConfig = (config) => {
26193
26422
  const newConfig = mergeConfig$1({}, config);
26194
26423
 
26195
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
26424
+ // Read only own properties to prevent prototype pollution gadgets
26425
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
26426
+ const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
26427
+
26428
+ const data = own('data');
26429
+ let withXSRFToken = own('withXSRFToken');
26430
+ const xsrfHeaderName = own('xsrfHeaderName');
26431
+ const xsrfCookieName = own('xsrfCookieName');
26432
+ let headers = own('headers');
26433
+ const auth = own('auth');
26434
+ const baseURL = own('baseURL');
26435
+ const allowAbsoluteUrls = own('allowAbsoluteUrls');
26436
+ const url = own('url');
26196
26437
 
26197
26438
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
26198
26439
 
26199
26440
  newConfig.url = buildURL(
26200
- buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
26441
+ buildFullPath(baseURL, url, allowAbsoluteUrls),
26201
26442
  config.params,
26202
26443
  config.paramsSerializer
26203
26444
  );
@@ -26207,11 +26448,7 @@
26207
26448
  headers.set(
26208
26449
  'Authorization',
26209
26450
  'Basic ' +
26210
- btoa(
26211
- (auth.username || '') +
26212
- ':' +
26213
- (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
26214
- )
26451
+ btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
26215
26452
  );
26216
26453
  }
26217
26454
 
@@ -26220,14 +26457,7 @@
26220
26457
  headers.setContentType(undefined); // browser handles it
26221
26458
  } else if (utils$1.isFunction(data.getHeaders)) {
26222
26459
  // Node.js FormData (like form-data package)
26223
- const formHeaders = data.getHeaders();
26224
- // Only set safe headers to avoid overwriting security headers
26225
- const allowedHeaders = ['content-type', 'content-length'];
26226
- Object.entries(formHeaders).forEach(([key, val]) => {
26227
- if (allowedHeaders.includes(key.toLowerCase())) {
26228
- headers.set(key, val);
26229
- }
26230
- });
26460
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
26231
26461
  }
26232
26462
  }
26233
26463
 
@@ -26236,10 +26466,17 @@
26236
26466
  // Specifically not if we're in a web worker, or react-native.
26237
26467
 
26238
26468
  if (platform.hasStandardBrowserEnv) {
26239
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
26469
+ if (utils$1.isFunction(withXSRFToken)) {
26470
+ withXSRFToken = withXSRFToken(newConfig);
26471
+ }
26240
26472
 
26241
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
26242
- // Add xsrf header
26473
+ // Strict boolean check prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
26474
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
26475
+ // the XSRF token cross-origin.
26476
+ const shouldSendXSRF =
26477
+ withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
26478
+
26479
+ if (shouldSendXSRF) {
26243
26480
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
26244
26481
 
26245
26482
  if (xsrfValue) {
@@ -26333,7 +26570,7 @@
26333
26570
  // will return status as 0 even though it's a successful request
26334
26571
  if (
26335
26572
  request.status === 0 &&
26336
- !(request.responseURL && request.responseURL.indexOf('file:') === 0)
26573
+ !(request.responseURL && request.responseURL.startsWith('file:'))
26337
26574
  ) {
26338
26575
  return;
26339
26576
  }
@@ -26350,6 +26587,7 @@
26350
26587
  }
26351
26588
 
26352
26589
  reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
26590
+ done();
26353
26591
 
26354
26592
  // Clean up request
26355
26593
  request = null;
@@ -26365,6 +26603,7 @@
26365
26603
  // attach the underlying event for consumers who want details
26366
26604
  err.event = event || null;
26367
26605
  reject(err);
26606
+ done();
26368
26607
  request = null;
26369
26608
  };
26370
26609
 
@@ -26385,6 +26624,7 @@
26385
26624
  request
26386
26625
  )
26387
26626
  );
26627
+ done();
26388
26628
 
26389
26629
  // Clean up request
26390
26630
  request = null;
@@ -26434,6 +26674,7 @@
26434
26674
  }
26435
26675
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
26436
26676
  request.abort();
26677
+ done();
26437
26678
  request = null;
26438
26679
  };
26439
26680
 
@@ -26447,7 +26688,7 @@
26447
26688
 
26448
26689
  const protocol = parseProtocol(_config.url);
26449
26690
 
26450
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
26691
+ if (protocol && !platform.protocols.includes(protocol)) {
26451
26692
  reject(
26452
26693
  new AxiosError$1(
26453
26694
  'Unsupported protocol ' + protocol + ':',
@@ -26604,16 +26845,112 @@
26604
26845
  );
26605
26846
  };
26606
26847
 
26607
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
26848
+ /**
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}
26856
+ */
26857
+ function estimateDataURLDecodedBytes(url) {
26858
+ if (!url || typeof url !== 'string') return 0;
26859
+ if (!url.startsWith('data:')) return 0;
26608
26860
 
26609
- const { isFunction } = utils$1;
26861
+ const comma = url.indexOf(',');
26862
+ if (comma < 0) return 0;
26863
+
26864
+ const meta = url.slice(5, comma);
26865
+ const body = url.slice(comma + 1);
26866
+ const isBase64 = /;base64/i.test(meta);
26867
+
26868
+ if (isBase64) {
26869
+ let effectiveLen = body.length;
26870
+ const len = body.length; // cache length
26871
+
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));
26879
+
26880
+ if (isHex) {
26881
+ effectiveLen -= 2;
26882
+ i += 2;
26883
+ }
26884
+ }
26885
+ }
26886
+
26887
+ let pad = 0;
26888
+ let idx = len - 1;
26610
26889
 
26611
- const globalFetchAPI = (({ Request, Response }) => ({
26612
- Request,
26613
- Response,
26614
- }))(utils$1.global);
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'
26615
26895
 
26616
- const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
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
+ }
26904
+ }
26905
+
26906
+ if (pad === 1 && idx >= 0) {
26907
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
26908
+ pad++;
26909
+ } else if (tailIsPct3D(idx)) {
26910
+ pad++;
26911
+ }
26912
+ }
26913
+
26914
+ const groups = Math.floor(effectiveLen / 4);
26915
+ const bytes = groups * 3 - (pad || 0);
26916
+ return bytes > 0 ? bytes : 0;
26917
+ }
26918
+
26919
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
26920
+ return Buffer.byteLength(body, 'utf8');
26921
+ }
26922
+
26923
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
26924
+ // 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).
26927
+ let bytes = 0;
26928
+ for (let i = 0, len = body.length; i < len; i++) {
26929
+ const c = body.charCodeAt(i);
26930
+ if (c < 0x80) {
26931
+ bytes += 1;
26932
+ } else if (c < 0x800) {
26933
+ bytes += 2;
26934
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
26935
+ const next = body.charCodeAt(i + 1);
26936
+ if (next >= 0xdc00 && next <= 0xdfff) {
26937
+ bytes += 4;
26938
+ i++;
26939
+ } else {
26940
+ bytes += 3;
26941
+ }
26942
+ } else {
26943
+ bytes += 3;
26944
+ }
26945
+ }
26946
+ return bytes;
26947
+ }
26948
+
26949
+ const VERSION$1 = "1.16.0";
26950
+
26951
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
26952
+
26953
+ const { isFunction } = utils$1;
26617
26954
 
26618
26955
  const test = (fn, ...args) => {
26619
26956
  try {
@@ -26624,11 +26961,17 @@
26624
26961
  };
26625
26962
 
26626
26963
  const factory = (env) => {
26964
+ const globalObject = utils$1.global ?? globalThis;
26965
+ const { ReadableStream, TextEncoder } = globalObject;
26966
+
26627
26967
  env = utils$1.merge.call(
26628
26968
  {
26629
26969
  skipUndefined: true,
26630
26970
  },
26631
- globalFetchAPI,
26971
+ {
26972
+ Request: globalObject.Request,
26973
+ Response: globalObject.Response,
26974
+ },
26632
26975
  env
26633
26976
  );
26634
26977
 
@@ -26641,15 +26984,15 @@
26641
26984
  return false;
26642
26985
  }
26643
26986
 
26644
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
26987
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
26645
26988
 
26646
26989
  const encodeText =
26647
26990
  isFetchSupported &&
26648
- (typeof TextEncoder$1 === 'function'
26991
+ (typeof TextEncoder === 'function'
26649
26992
  ? (
26650
26993
  (encoder) => (str) =>
26651
26994
  encoder.encode(str)
26652
- )(new TextEncoder$1())
26995
+ )(new TextEncoder())
26653
26996
  : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
26654
26997
 
26655
26998
  const supportsRequestStream =
@@ -26658,18 +27001,20 @@
26658
27001
  test(() => {
26659
27002
  let duplexAccessed = false;
26660
27003
 
26661
- const body = new ReadableStream$1();
26662
-
26663
- const hasContentType = new Request(platform.origin, {
26664
- body,
27004
+ const request = new Request(platform.origin, {
27005
+ body: new ReadableStream(),
26665
27006
  method: 'POST',
26666
27007
  get duplex() {
26667
27008
  duplexAccessed = true;
26668
27009
  return 'half';
26669
27010
  },
26670
- }).headers.has('Content-Type');
27011
+ });
26671
27012
 
26672
- body.cancel();
27013
+ const hasContentType = request.headers.has('Content-Type');
27014
+
27015
+ if (request.body != null) {
27016
+ request.body.cancel();
27017
+ }
26673
27018
 
26674
27019
  return duplexAccessed && !hasContentType;
26675
27020
  });
@@ -26753,8 +27098,13 @@
26753
27098
  headers,
26754
27099
  withCredentials = 'same-origin',
26755
27100
  fetchOptions,
27101
+ maxContentLength,
27102
+ maxBodyLength,
26756
27103
  } = resolveConfig(config);
26757
27104
 
27105
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
27106
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
27107
+
26758
27108
  let _fetch = envFetch || fetch;
26759
27109
 
26760
27110
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
@@ -26776,6 +27126,41 @@
26776
27126
  let requestContentLength;
26777
27127
 
26778
27128
  try {
27129
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
27130
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
27131
+ // "if (protocol === 'data:')" branch).
27132
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
27133
+ const estimated = estimateDataURLDecodedBytes(url);
27134
+ if (estimated > maxContentLength) {
27135
+ throw new AxiosError$1(
27136
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27137
+ AxiosError$1.ERR_BAD_RESPONSE,
27138
+ config,
27139
+ request
27140
+ );
27141
+ }
27142
+ }
27143
+
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).
27148
+ 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
+ );
27161
+ }
27162
+ }
27163
+
26779
27164
  if (
26780
27165
  onUploadProgress &&
26781
27166
  supportsRequestStream &&
@@ -26813,6 +27198,22 @@
26813
27198
  // see https://github.com/cloudflare/workerd/issues/902
26814
27199
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
26815
27200
 
27201
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
27202
+ // delete it so fetch can set it correctly with the boundary
27203
+ if (utils$1.isFormData(data)) {
27204
+ const contentType = headers.getContentType();
27205
+ if (
27206
+ contentType &&
27207
+ /^multipart\/form-data/i.test(contentType) &&
27208
+ !/boundary=/i.test(contentType)
27209
+ ) {
27210
+ headers.delete('content-type');
27211
+ }
27212
+ }
27213
+
27214
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
27215
+ headers.set('User-Agent', 'axios/' + VERSION$1, false);
27216
+
26816
27217
  const resolvedOptions = {
26817
27218
  ...fetchOptions,
26818
27219
  signal: composedSignal,
@@ -26829,10 +27230,28 @@
26829
27230
  ? _fetch(request, fetchOptions)
26830
27231
  : _fetch(url, resolvedOptions));
26831
27232
 
27233
+ // Cheap pre-check: if the server honestly declares a content-length that
27234
+ // already exceeds the cap, reject before we start streaming.
27235
+ if (hasMaxContentLength) {
27236
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27237
+ if (declaredLength != null && declaredLength > maxContentLength) {
27238
+ throw new AxiosError$1(
27239
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27240
+ AxiosError$1.ERR_BAD_RESPONSE,
27241
+ config,
27242
+ request
27243
+ );
27244
+ }
27245
+ }
27246
+
26832
27247
  const isStreamResponse =
26833
27248
  supportsResponseStream && (responseType === 'stream' || responseType === 'response');
26834
27249
 
26835
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
27250
+ if (
27251
+ supportsResponseStream &&
27252
+ response.body &&
27253
+ (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
27254
+ ) {
26836
27255
  const options = {};
26837
27256
 
26838
27257
  ['status', 'statusText', 'headers'].forEach((prop) => {
@@ -26849,8 +27268,24 @@
26849
27268
  )) ||
26850
27269
  [];
26851
27270
 
27271
+ let bytesRead = 0;
27272
+ const onChunkProgress = (loadedBytes) => {
27273
+ if (hasMaxContentLength) {
27274
+ bytesRead = loadedBytes;
27275
+ if (bytesRead > maxContentLength) {
27276
+ throw new AxiosError$1(
27277
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27278
+ AxiosError$1.ERR_BAD_RESPONSE,
27279
+ config,
27280
+ request
27281
+ );
27282
+ }
27283
+ }
27284
+ onProgress && onProgress(loadedBytes);
27285
+ };
27286
+
26852
27287
  response = new Response(
26853
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
27288
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
26854
27289
  flush && flush();
26855
27290
  unsubscribe && unsubscribe();
26856
27291
  }),
@@ -26865,6 +27300,33 @@
26865
27300
  config
26866
27301
  );
26867
27302
 
27303
+ // Fallback enforcement for environments without ReadableStream support
27304
+ // (legacy runtimes). Detect materialized size from typed output; skip
27305
+ // streams/Response passthrough since the user will read those themselves.
27306
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
27307
+ let materializedSize;
27308
+ if (responseData != null) {
27309
+ if (typeof responseData.byteLength === 'number') {
27310
+ materializedSize = responseData.byteLength;
27311
+ } else if (typeof responseData.size === 'number') {
27312
+ materializedSize = responseData.size;
27313
+ } else if (typeof responseData === 'string') {
27314
+ materializedSize =
27315
+ typeof TextEncoder === 'function'
27316
+ ? new TextEncoder().encode(responseData).byteLength
27317
+ : responseData.length;
27318
+ }
27319
+ }
27320
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
27321
+ throw new AxiosError$1(
27322
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27323
+ AxiosError$1.ERR_BAD_RESPONSE,
27324
+ config,
27325
+ request
27326
+ );
27327
+ }
27328
+ }
27329
+
26868
27330
  !isStreamResponse && unsubscribe && unsubscribe();
26869
27331
 
26870
27332
  return await new Promise((resolve, reject) => {
@@ -26880,6 +27342,17 @@
26880
27342
  } catch (err) {
26881
27343
  unsubscribe && unsubscribe();
26882
27344
 
27345
+ // Safari can surface fetch aborts as a DOMException-like object whose
27346
+ // branded getters throw. Prefer our composed signal reason before reading
27347
+ // the caught error, preserving timeout vs cancellation semantics.
27348
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
27349
+ const canceledError = composedSignal.reason;
27350
+ canceledError.config = config;
27351
+ request && (canceledError.request = request);
27352
+ err !== canceledError && (canceledError.cause = err);
27353
+ throw canceledError;
27354
+ }
27355
+
26883
27356
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
26884
27357
  throw Object.assign(
26885
27358
  new AxiosError$1(
@@ -26948,11 +27421,13 @@
26948
27421
  utils$1.forEach(knownAdapters, (fn, value) => {
26949
27422
  if (fn) {
26950
27423
  try {
26951
- Object.defineProperty(fn, 'name', { value });
27424
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
27425
+ // these data descriptors into accessor descriptors on the way in.
27426
+ Object.defineProperty(fn, 'name', { __proto__: null, value });
26952
27427
  } catch (e) {
26953
27428
  // eslint-disable-next-line no-empty
26954
27429
  }
26955
- Object.defineProperty(fn, 'adapterName', { value });
27430
+ Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
26956
27431
  }
26957
27432
  });
26958
27433
 
@@ -27094,8 +27569,15 @@
27094
27569
  function onAdapterResolution(response) {
27095
27570
  throwIfCancellationRequested(config);
27096
27571
 
27097
- // Transform response data
27098
- response.data = transformData.call(config, config.transformResponse, response);
27572
+ // Expose the current response on config so that transformResponse can
27573
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
27574
+ // We clean it up afterwards to avoid polluting the config object.
27575
+ config.response = response;
27576
+ try {
27577
+ response.data = transformData.call(config, config.transformResponse, response);
27578
+ } finally {
27579
+ delete config.response;
27580
+ }
27099
27581
 
27100
27582
  response.headers = AxiosHeaders$1.from(response.headers);
27101
27583
 
@@ -27107,11 +27589,16 @@
27107
27589
 
27108
27590
  // Transform response data
27109
27591
  if (reason && reason.response) {
27110
- reason.response.data = transformData.call(
27111
- config,
27112
- config.transformResponse,
27113
- reason.response
27114
- );
27592
+ config.response = reason.response;
27593
+ try {
27594
+ reason.response.data = transformData.call(
27595
+ config,
27596
+ config.transformResponse,
27597
+ reason.response
27598
+ );
27599
+ } finally {
27600
+ delete config.response;
27601
+ }
27115
27602
  reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
27116
27603
  }
27117
27604
  }
@@ -27121,8 +27608,6 @@
27121
27608
  );
27122
27609
  }
27123
27610
 
27124
- const VERSION$1 = "1.15.0";
27125
-
27126
27611
  const validators$1 = {};
27127
27612
 
27128
27613
  // eslint-disable-next-line func-names
@@ -27206,7 +27691,9 @@
27206
27691
  let i = keys.length;
27207
27692
  while (i-- > 0) {
27208
27693
  const opt = keys[i];
27209
- const validator = schema[opt];
27694
+ // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
27695
+ // a non-function validator and cause a TypeError.
27696
+ const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
27210
27697
  if (validator) {
27211
27698
  const value = options[opt];
27212
27699
  const result = value === undefined || validator(value, opt, options);
@@ -27365,7 +27852,7 @@
27365
27852
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
27366
27853
 
27367
27854
  headers &&
27368
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
27855
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
27369
27856
  delete headers[method];
27370
27857
  });
27371
27858
 
@@ -27468,7 +27955,7 @@
27468
27955
  };
27469
27956
  });
27470
27957
 
27471
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
27958
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
27472
27959
  function generateHTTPMethod(isForm) {
27473
27960
  return function httpMethod(url, data, config) {
27474
27961
  return this.request(
@@ -27488,7 +27975,11 @@
27488
27975
 
27489
27976
  Axios$1.prototype[method] = generateHTTPMethod();
27490
27977
 
27491
- Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
27978
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
27979
+ // its semantics, so no queryForm shorthand is generated.
27980
+ if (method !== 'query') {
27981
+ Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
27982
+ }
27492
27983
  });
27493
27984
 
27494
27985
  /**
@@ -27822,6 +28313,7 @@
27822
28313
  formToJSON,
27823
28314
  getAdapter,
27824
28315
  mergeConfig,
28316
+ create,
27825
28317
  } = axios$1;
27826
28318
 
27827
28319
  // lib/v4/isZodErrorLike.ts
@@ -28515,6 +29007,7 @@
28515
29007
  description: string$1(),
28516
29008
  uiUrl: string$1().optional(),
28517
29009
  agentInstructions: string$1().optional(),
29010
+ handoffAgentInstructions: string$1().optional(),
28518
29011
  });
28519
29012
  const BaseConnection = BaseWorkspaceElement.extend({
28520
29013
  ...TenantLayerElement.shape,
@@ -29536,25 +30029,29 @@
29536
30029
  });
29537
30030
  const IntegrationEditableProperties = BaseMembraneInterfaceEditableProperties.extend({
29538
30031
  logoUri: string$1().optional(),
29539
- externalAppId: string$1().optional(),
30032
+ externalAppId: string$1()
30033
+ .optional()
30034
+ .describe("External app id; alternative to connectorId — resolves to the app's default connector."),
29540
30035
  externalAppUuid: string$1().optional(),
29541
30036
  appUuid: string$1().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
29542
30037
  oAuthCallbackUri: url().or(literal('')).optional(),
29543
30038
  logoBase64: string$1().optional(),
29544
30039
  connectorVersion: string$1().optional(),
29545
- connectorId: string$1().optional(),
30040
+ connectorId: string$1().optional().describe('ID of the connector this integration uses.'),
29546
30041
  connectorUuid: string$1().optional(),
29547
30042
  connectorKey: string$1()
29548
30043
  .optional()
29549
30044
  .describe('Key of the connector; alternative to connectorId. Resolved to connectorId by the API.'),
29550
- parameters: record(string$1(), any()).optional(),
30045
+ parameters: record(string$1(), any())
30046
+ .optional()
30047
+ .describe('Connector-specific parameters (e.g. OAuth { clientId, clientSecret, scopes }).'),
29551
30048
  optionsConfig: IntegrationOptions.optional(),
29552
30049
  });
29553
30050
  IntegrationEditableProperties.omit({
29554
30051
  connectorId: true,
29555
30052
  externalAppId: true,
29556
30053
  parameters: true,
29557
- });
30054
+ }).required({ uuid: true, key: true });
29558
30055
 
29559
30056
  PaginationQuery.merge(SearchQuery)
29560
30057
  .merge(IncludeArchivedQuery)
@@ -29704,6 +30201,18 @@
29704
30201
  connectionId: string$1().optional(),
29705
30202
  }),
29706
30203
  ]);
30204
+ discriminatedUnion('type', [
30205
+ object({
30206
+ type: literal('connected'),
30207
+ connectionId: string$1(),
30208
+ timestamp: string$1(),
30209
+ message: string$1().optional(),
30210
+ }),
30211
+ object({
30212
+ type: literal('connectionPatched'),
30213
+ connectionId: string$1(),
30214
+ }),
30215
+ ]);
29707
30216
  object({
29708
30217
  integrationId: string$1().optional(),
29709
30218
  integrationKey: string$1().optional(),
@@ -29720,6 +30229,8 @@
29720
30229
  connectorId: string$1().optional(),
29721
30230
  connectorKey: string$1().optional(),
29722
30231
  connectorVersion: string$1().optional(),
30232
+ externalAppId: string$1().optional(),
30233
+ externalAppKey: string$1().optional(),
29723
30234
  connectionId: string$1().optional(),
29724
30235
  connectionKey: string$1().min(1).max(100).optional(),
29725
30236
  name: string$1().optional(),