@membranehq/sdk 0.8.0 → 0.8.1

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 (31) hide show
  1. package/dist/bundle.d.ts +314 -104
  2. package/dist/bundle.js +344 -229
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/action-instances-accessors.d.ts +1 -2
  5. package/dist/dts/accessors/scenarios-accessors.d.ts +6 -4
  6. package/dist/dts/alerts/types.d.ts +3 -1
  7. package/dist/dts/client.d.ts +3 -3
  8. package/dist/dts/webhooks/types.d.ts +5 -2
  9. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +5 -0
  10. package/dist/dts/workspace-elements/api/actions-api.d.ts +309 -1
  11. package/dist/dts/workspace-elements/api/index.d.ts +1 -2
  12. package/dist/dts/workspace-elements/api/{scenarios-api.d.ts → packages-api.d.ts} +8 -7
  13. package/dist/dts/workspace-elements/base/action-instances/types.d.ts +14 -9
  14. package/dist/dts/workspace-elements/base/actions/index.d.ts +46 -0
  15. package/dist/dts/workspace-elements/base/index.d.ts +1 -2
  16. package/dist/dts/workspace-elements/base/{scenarios → packages}/index.d.ts +8 -8
  17. package/dist/dts/workspace-elements/types.d.ts +7 -1
  18. package/dist/index.browser.d.mts +889 -644
  19. package/dist/index.browser.d.ts +889 -644
  20. package/dist/index.browser.js +85 -80
  21. package/dist/index.browser.js.map +1 -1
  22. package/dist/index.browser.mjs +75 -74
  23. package/dist/index.browser.mjs.map +1 -1
  24. package/dist/index.node.d.mts +889 -644
  25. package/dist/index.node.d.ts +889 -644
  26. package/dist/index.node.js +85 -80
  27. package/dist/index.node.js.map +1 -1
  28. package/dist/index.node.mjs +75 -74
  29. package/dist/index.node.mjs.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/dts/workspace-elements/api/action-instances-api.d.ts +0 -94
package/dist/bundle.js CHANGED
@@ -2477,7 +2477,7 @@
2477
2477
  // Check that value is an object with an inspect function on it
2478
2478
  if (ctx.customInspect &&
2479
2479
  value &&
2480
- isFunction$1(value.inspect) &&
2480
+ isFunction$2(value.inspect) &&
2481
2481
  // Filter out the util module, it's inspect function is special
2482
2482
  value.inspect !== inspect &&
2483
2483
  // Also filter out any prototype objects using the circular check.
@@ -2512,7 +2512,7 @@
2512
2512
 
2513
2513
  // Some type of object without properties can be shortcutted.
2514
2514
  if (keys.length === 0) {
2515
- if (isFunction$1(value)) {
2515
+ if (isFunction$2(value)) {
2516
2516
  var name = value.name ? ': ' + value.name : '';
2517
2517
  return ctx.stylize('[Function' + name + ']', 'special');
2518
2518
  }
@@ -2536,7 +2536,7 @@
2536
2536
  }
2537
2537
 
2538
2538
  // Make functions say that they are functions
2539
- if (isFunction$1(value)) {
2539
+ if (isFunction$2(value)) {
2540
2540
  var n = value.name ? ': ' + value.name : '';
2541
2541
  base = ' [Function' + n + ']';
2542
2542
  }
@@ -2758,7 +2758,7 @@
2758
2758
  (objectToString(e) === '[object Error]' || e instanceof Error);
2759
2759
  }
2760
2760
 
2761
- function isFunction$1(arg) {
2761
+ function isFunction$2(arg) {
2762
2762
  return typeof arg === 'function';
2763
2763
  }
2764
2764
 
@@ -2929,7 +2929,7 @@
2929
2929
  log: log,
2930
2930
  isBuffer: isBuffer$1,
2931
2931
  isPrimitive: isPrimitive,
2932
- isFunction: isFunction$1,
2932
+ isFunction: isFunction$2,
2933
2933
  isError: isError,
2934
2934
  isDate: isDate$1,
2935
2935
  isObject: isObject$2,
@@ -2965,7 +2965,7 @@
2965
2965
  isBuffer: isBuffer$1,
2966
2966
  isDate: isDate$1,
2967
2967
  isError: isError,
2968
- isFunction: isFunction$1,
2968
+ isFunction: isFunction$2,
2969
2969
  isNull: isNull,
2970
2970
  isNullOrUndefined: isNullOrUndefined,
2971
2971
  isNumber: isNumber$1,
@@ -11233,7 +11233,7 @@
11233
11233
  WorkspaceElementType["FlowInstance"] = "flow-instance";
11234
11234
  WorkspaceElementType["FlowRun"] = "flow-run";
11235
11235
  WorkspaceElementType["Action"] = "action";
11236
- WorkspaceElementType["Scenario"] = "scenario";
11236
+ WorkspaceElementType["Package"] = "package";
11237
11237
  WorkspaceElementType["ActionInstance"] = "action-instance";
11238
11238
  WorkspaceElementType["Connection"] = "connection";
11239
11239
  WorkspaceElementType["FieldMapping"] = "field-mapping";
@@ -11306,6 +11306,11 @@
11306
11306
  const BaseIntegrationLevelMembraneInterfaceReadOnlyProperties = BaseMembraneInterfaceReadOnlyProperties.extend({
11307
11307
  isCustomized: boolean().optional(),
11308
11308
  });
11309
+ object({
11310
+ integrationKey: string().optional(),
11311
+ connectionId: string().optional(),
11312
+ instanceKey: string().optional(),
11313
+ });
11309
11314
  BaseMembraneInterface.merge(BaseIntegrationLevelMembraneInterfaceEditableProperties).merge(BaseIntegrationLevelMembraneInterfaceReadOnlyProperties);
11310
11315
 
11311
11316
  const MAX_POLLING_ERRORS = 10;
@@ -12017,17 +12022,17 @@
12017
12022
  }
12018
12023
  }
12019
12024
 
12020
- class ScenariosAccessor extends ElementListAccessor {
12025
+ class PackagesAccessor extends ElementListAccessor {
12021
12026
  constructor(client) {
12022
- super(client, 'scenarios');
12027
+ super(client, 'packages');
12023
12028
  }
12024
12029
  }
12025
- class ScenarioAccessor extends ElementAccessor {
12030
+ class PackageAccessor extends ElementAccessor {
12026
12031
  constructor(client, selector) {
12027
12032
  super({
12028
12033
  client,
12029
12034
  selector,
12030
- path: 'scenario',
12035
+ path: 'package',
12031
12036
  });
12032
12037
  }
12033
12038
  }
@@ -12203,7 +12208,7 @@
12203
12208
  }
12204
12209
  }
12205
12210
 
12206
- /*! Axios v1.10.0 Copyright (c) 2025 Matt Zabriskie and contributors */
12211
+ /*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */
12207
12212
  function bind(fn, thisArg) {
12208
12213
  return function wrap() {
12209
12214
  return fn.apply(thisArg, arguments);
@@ -12255,7 +12260,7 @@
12255
12260
  */
12256
12261
  function isBuffer(val) {
12257
12262
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
12258
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
12263
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
12259
12264
  }
12260
12265
 
12261
12266
  /**
@@ -12300,7 +12305,7 @@
12300
12305
  * @param {*} val The value to test
12301
12306
  * @returns {boolean} True if value is a Function, otherwise false
12302
12307
  */
12303
- const isFunction = typeOfTest('function');
12308
+ const isFunction$1 = typeOfTest('function');
12304
12309
 
12305
12310
  /**
12306
12311
  * Determine if a value is a Number
@@ -12344,6 +12349,27 @@
12344
12349
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
12345
12350
  };
12346
12351
 
12352
+ /**
12353
+ * Determine if a value is an empty object (safely handles Buffers)
12354
+ *
12355
+ * @param {*} val The value to test
12356
+ *
12357
+ * @returns {boolean} True if value is an empty object, otherwise false
12358
+ */
12359
+ const isEmptyObject = (val) => {
12360
+ // Early return for non-objects or Buffers to prevent RangeError
12361
+ if (!isObject(val) || isBuffer(val)) {
12362
+ return false;
12363
+ }
12364
+
12365
+ try {
12366
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
12367
+ } catch (e) {
12368
+ // Fallback for any other objects that might cause RangeError with Object.keys()
12369
+ return false;
12370
+ }
12371
+ };
12372
+
12347
12373
  /**
12348
12374
  * Determine if a value is a Date
12349
12375
  *
@@ -12387,7 +12413,7 @@
12387
12413
  *
12388
12414
  * @returns {boolean} True if value is a Stream, otherwise false
12389
12415
  */
12390
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
12416
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
12391
12417
 
12392
12418
  /**
12393
12419
  * Determine if a value is a FormData
@@ -12400,10 +12426,10 @@
12400
12426
  let kind;
12401
12427
  return thing && (
12402
12428
  (typeof FormData === 'function' && thing instanceof FormData) || (
12403
- isFunction(thing.append) && (
12429
+ isFunction$1(thing.append) && (
12404
12430
  (kind = kindOf(thing)) === 'formdata' ||
12405
12431
  // detect form-data instance
12406
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
12432
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
12407
12433
  )
12408
12434
  )
12409
12435
  )
@@ -12466,6 +12492,11 @@
12466
12492
  fn.call(null, obj[i], i, obj);
12467
12493
  }
12468
12494
  } else {
12495
+ // Buffer check
12496
+ if (isBuffer(obj)) {
12497
+ return;
12498
+ }
12499
+
12469
12500
  // Iterate over object keys
12470
12501
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
12471
12502
  const len = keys.length;
@@ -12479,6 +12510,10 @@
12479
12510
  }
12480
12511
 
12481
12512
  function findKey(obj, key) {
12513
+ if (isBuffer(obj)){
12514
+ return null;
12515
+ }
12516
+
12482
12517
  key = key.toLowerCase();
12483
12518
  const keys = Object.keys(obj);
12484
12519
  let i = keys.length;
@@ -12519,7 +12554,7 @@
12519
12554
  * @returns {Object} Result of all merge properties
12520
12555
  */
12521
12556
  function merge(/* obj1, obj2, obj3, ... */) {
12522
- const {caseless} = isContextDefined(this) && this || {};
12557
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
12523
12558
  const result = {};
12524
12559
  const assignValue = (val, key) => {
12525
12560
  const targetKey = caseless && findKey(result, key) || key;
@@ -12529,7 +12564,7 @@
12529
12564
  result[targetKey] = merge({}, val);
12530
12565
  } else if (isArray(val)) {
12531
12566
  result[targetKey] = val.slice();
12532
- } else {
12567
+ } else if (!skipUndefined || !isUndefined(val)) {
12533
12568
  result[targetKey] = val;
12534
12569
  }
12535
12570
  };
@@ -12552,7 +12587,7 @@
12552
12587
  */
12553
12588
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
12554
12589
  forEach(b, (val, key) => {
12555
- if (thisArg && isFunction(val)) {
12590
+ if (thisArg && isFunction$1(val)) {
12556
12591
  a[key] = bind(val, thisArg);
12557
12592
  } else {
12558
12593
  a[key] = val;
@@ -12768,13 +12803,13 @@
12768
12803
  const freezeMethods = (obj) => {
12769
12804
  reduceDescriptors(obj, (descriptor, name) => {
12770
12805
  // skip restricted props in strict mode
12771
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
12806
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
12772
12807
  return false;
12773
12808
  }
12774
12809
 
12775
12810
  const value = obj[name];
12776
12811
 
12777
- if (!isFunction(value)) return;
12812
+ if (!isFunction$1(value)) return;
12778
12813
 
12779
12814
  descriptor.enumerable = false;
12780
12815
 
@@ -12811,6 +12846,8 @@
12811
12846
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
12812
12847
  };
12813
12848
 
12849
+
12850
+
12814
12851
  /**
12815
12852
  * If the thing is a FormData object, return true, otherwise return false.
12816
12853
  *
@@ -12819,7 +12856,7 @@
12819
12856
  * @returns {boolean}
12820
12857
  */
12821
12858
  function isSpecCompliantForm(thing) {
12822
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
12859
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
12823
12860
  }
12824
12861
 
12825
12862
  const toJSONObject = (obj) => {
@@ -12832,6 +12869,11 @@
12832
12869
  return;
12833
12870
  }
12834
12871
 
12872
+ //Buffer check
12873
+ if (isBuffer(source)) {
12874
+ return source;
12875
+ }
12876
+
12835
12877
  if(!('toJSON' in source)) {
12836
12878
  stack[i] = source;
12837
12879
  const target = isArray(source) ? [] : {};
@@ -12856,7 +12898,7 @@
12856
12898
  const isAsyncFn = kindOfTest('AsyncFunction');
12857
12899
 
12858
12900
  const isThenable = (thing) =>
12859
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
12901
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
12860
12902
 
12861
12903
  // original code
12862
12904
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -12880,7 +12922,7 @@
12880
12922
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
12881
12923
  })(
12882
12924
  typeof setImmediate === 'function',
12883
- isFunction(_global.postMessage)
12925
+ isFunction$1(_global.postMessage)
12884
12926
  );
12885
12927
 
12886
12928
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -12889,7 +12931,7 @@
12889
12931
  // *********************
12890
12932
 
12891
12933
 
12892
- const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
12934
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
12893
12935
 
12894
12936
 
12895
12937
  const utils$1 = {
@@ -12903,6 +12945,7 @@
12903
12945
  isBoolean,
12904
12946
  isObject,
12905
12947
  isPlainObject,
12948
+ isEmptyObject,
12906
12949
  isReadableStream,
12907
12950
  isRequest,
12908
12951
  isResponse,
@@ -12912,7 +12955,7 @@
12912
12955
  isFile,
12913
12956
  isBlob,
12914
12957
  isRegExp,
12915
- isFunction,
12958
+ isFunction: isFunction$1,
12916
12959
  isStream,
12917
12960
  isURLSearchParams,
12918
12961
  isTypedArray,
@@ -13038,11 +13081,18 @@
13038
13081
  return prop !== 'isAxiosError';
13039
13082
  });
13040
13083
 
13041
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
13084
+ const msg = error && error.message ? error.message : 'Error';
13042
13085
 
13043
- axiosError.cause = error;
13086
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
13087
+ const errCode = code == null && error ? error.code : code;
13088
+ AxiosError$1.call(axiosError, msg, errCode, config, request, response);
13044
13089
 
13045
- axiosError.name = error.name;
13090
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
13091
+ if (error && axiosError.cause == null) {
13092
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
13093
+ }
13094
+
13095
+ axiosError.name = (error && error.name) || 'Error';
13046
13096
 
13047
13097
  customProps && Object.assign(axiosError, customProps);
13048
13098
 
@@ -13333,9 +13383,7 @@
13333
13383
  replace(/%3A/gi, ':').
13334
13384
  replace(/%24/g, '$').
13335
13385
  replace(/%2C/gi, ',').
13336
- replace(/%20/g, '+').
13337
- replace(/%5B/gi, '[').
13338
- replace(/%5D/gi, ']');
13386
+ replace(/%20/g, '+');
13339
13387
  }
13340
13388
 
13341
13389
  /**
@@ -13534,7 +13582,7 @@
13534
13582
  };
13535
13583
 
13536
13584
  function toURLEncodedForm(data, options) {
13537
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
13585
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
13538
13586
  visitor: function(value, key, path, helpers) {
13539
13587
  if (platform.isNode && utils$1.isBuffer(value)) {
13540
13588
  this.append(key, value.toString('base64'));
@@ -13542,8 +13590,9 @@
13542
13590
  }
13543
13591
 
13544
13592
  return helpers.defaultVisitor.apply(this, arguments);
13545
- }
13546
- }, options));
13593
+ },
13594
+ ...options
13595
+ });
13547
13596
  }
13548
13597
 
13549
13598
  /**
@@ -13739,7 +13788,7 @@
13739
13788
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
13740
13789
 
13741
13790
  try {
13742
- return JSON.parse(data);
13791
+ return JSON.parse(data, this.parseReviver);
13743
13792
  } catch (e) {
13744
13793
  if (strictJSONParsing) {
13745
13794
  if (e.name === 'SyntaxError') {
@@ -14296,7 +14345,7 @@
14296
14345
  clearTimeout(timer);
14297
14346
  timer = null;
14298
14347
  }
14299
- fn.apply(null, args);
14348
+ fn(...args);
14300
14349
  };
14301
14350
 
14302
14351
  const throttled = (...args) => {
@@ -14552,7 +14601,7 @@
14552
14601
  headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
14553
14602
  };
14554
14603
 
14555
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
14604
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
14556
14605
  const merge = mergeMap[prop] || mergeDeepProperties;
14557
14606
  const configValue = merge(config1[prop], config2[prop], prop);
14558
14607
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -14564,7 +14613,7 @@
14564
14613
  const resolveConfig = (config) => {
14565
14614
  const newConfig = mergeConfig$1({}, config);
14566
14615
 
14567
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
14616
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
14568
14617
 
14569
14618
  newConfig.headers = headers = AxiosHeaders$2.from(headers);
14570
14619
 
@@ -14577,17 +14626,21 @@
14577
14626
  );
14578
14627
  }
14579
14628
 
14580
- let contentType;
14581
-
14582
14629
  if (utils$1.isFormData(data)) {
14583
14630
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
14584
- headers.setContentType(undefined); // Let the browser set it
14585
- } else if ((contentType = headers.getContentType()) !== false) {
14586
- // fix semicolon duplication issue for ReactNative FormData implementation
14587
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
14588
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
14631
+ headers.setContentType(undefined); // browser handles it
14632
+ } else if (utils$1.isFunction(data.getHeaders)) {
14633
+ // Node.js FormData (like form-data package)
14634
+ const formHeaders = data.getHeaders();
14635
+ // Only set safe headers to avoid overwriting security headers
14636
+ const allowedHeaders = ['content-type', 'content-length'];
14637
+ Object.entries(formHeaders).forEach(([key, val]) => {
14638
+ if (allowedHeaders.includes(key.toLowerCase())) {
14639
+ headers.set(key, val);
14640
+ }
14641
+ });
14589
14642
  }
14590
- }
14643
+ }
14591
14644
 
14592
14645
  // Add xsrf header
14593
14646
  // This is only done if running in a standard browser environment.
@@ -14704,15 +14757,18 @@
14704
14757
  };
14705
14758
 
14706
14759
  // Handle low level network errors
14707
- request.onerror = function handleError() {
14708
- // Real errors are hidden from us by the browser
14709
- // onerror should only fire if it's a network error
14710
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
14711
-
14712
- // Clean up request
14713
- request = null;
14760
+ request.onerror = function handleError(event) {
14761
+ // Browsers deliver a ProgressEvent in XHR onerror
14762
+ // (message may be empty; when present, surface it)
14763
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
14764
+ const msg = event && event.message ? event.message : 'Network Error';
14765
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
14766
+ // attach the underlying event for consumers who want details
14767
+ err.event = event || null;
14768
+ reject(err);
14769
+ request = null;
14714
14770
  };
14715
-
14771
+
14716
14772
  // Handle timeout
14717
14773
  request.ontimeout = function handleTimeout() {
14718
14774
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -14928,14 +14984,18 @@
14928
14984
  })
14929
14985
  };
14930
14986
 
14931
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
14932
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
14987
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
14988
+
14989
+ const {isFunction} = utils$1;
14990
+
14991
+ const globalFetchAPI = (({Request, Response}) => ({
14992
+ Request, Response
14993
+ }))(utils$1.global);
14994
+
14995
+ const {
14996
+ ReadableStream: ReadableStream$1, TextEncoder
14997
+ } = utils$1.global;
14933
14998
 
14934
- // used only inside the fetch adapter
14935
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
14936
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
14937
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
14938
- );
14939
14999
 
14940
15000
  const test = (fn, ...args) => {
14941
15001
  try {
@@ -14945,211 +15005,268 @@
14945
15005
  }
14946
15006
  };
14947
15007
 
14948
- const supportsRequestStream = isReadableStreamSupported && test(() => {
14949
- let duplexAccessed = false;
15008
+ const factory = (env) => {
15009
+ env = utils$1.merge.call({
15010
+ skipUndefined: true
15011
+ }, globalFetchAPI, env);
14950
15012
 
14951
- const hasContentType = new Request(platform.origin, {
14952
- body: new ReadableStream(),
14953
- method: 'POST',
14954
- get duplex() {
14955
- duplexAccessed = true;
14956
- return 'half';
14957
- },
14958
- }).headers.has('Content-Type');
15013
+ const {fetch: envFetch, Request, Response} = env;
15014
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
15015
+ const isRequestSupported = isFunction(Request);
15016
+ const isResponseSupported = isFunction(Response);
14959
15017
 
14960
- return duplexAccessed && !hasContentType;
14961
- });
15018
+ if (!isFetchSupported) {
15019
+ return false;
15020
+ }
14962
15021
 
14963
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
15022
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
14964
15023
 
14965
- const supportsResponseStream = isReadableStreamSupported &&
14966
- test(() => utils$1.isReadableStream(new Response('').body));
15024
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
15025
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
15026
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
15027
+ );
14967
15028
 
15029
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
15030
+ let duplexAccessed = false;
14968
15031
 
14969
- const resolvers = {
14970
- stream: supportsResponseStream && ((res) => res.body)
14971
- };
15032
+ const hasContentType = new Request(platform.origin, {
15033
+ body: new ReadableStream$1(),
15034
+ method: 'POST',
15035
+ get duplex() {
15036
+ duplexAccessed = true;
15037
+ return 'half';
15038
+ },
15039
+ }).headers.has('Content-Type');
14972
15040
 
14973
- isFetchSupported && (((res) => {
14974
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
14975
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
14976
- (_, config) => {
14977
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
14978
- });
15041
+ return duplexAccessed && !hasContentType;
14979
15042
  });
14980
- })(new Response));
14981
15043
 
14982
- const getBodyLength = async (body) => {
14983
- if (body == null) {
14984
- return 0;
14985
- }
15044
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
15045
+ test(() => utils$1.isReadableStream(new Response('').body));
14986
15046
 
14987
- if(utils$1.isBlob(body)) {
14988
- return body.size;
14989
- }
15047
+ const resolvers = {
15048
+ stream: supportsResponseStream && ((res) => res.body)
15049
+ };
14990
15050
 
14991
- if(utils$1.isSpecCompliantForm(body)) {
14992
- const _request = new Request(platform.origin, {
14993
- method: 'POST',
14994
- body,
15051
+ isFetchSupported && ((() => {
15052
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
15053
+ !resolvers[type] && (resolvers[type] = (res, config) => {
15054
+ let method = res && res[type];
15055
+
15056
+ if (method) {
15057
+ return method.call(res);
15058
+ }
15059
+
15060
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
15061
+ });
14995
15062
  });
14996
- return (await _request.arrayBuffer()).byteLength;
14997
- }
15063
+ })());
14998
15064
 
14999
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
15000
- return body.byteLength;
15001
- }
15065
+ const getBodyLength = async (body) => {
15066
+ if (body == null) {
15067
+ return 0;
15068
+ }
15002
15069
 
15003
- if(utils$1.isURLSearchParams(body)) {
15004
- body = body + '';
15005
- }
15070
+ if (utils$1.isBlob(body)) {
15071
+ return body.size;
15072
+ }
15006
15073
 
15007
- if(utils$1.isString(body)) {
15008
- return (await encodeText(body)).byteLength;
15009
- }
15010
- };
15074
+ if (utils$1.isSpecCompliantForm(body)) {
15075
+ const _request = new Request(platform.origin, {
15076
+ method: 'POST',
15077
+ body,
15078
+ });
15079
+ return (await _request.arrayBuffer()).byteLength;
15080
+ }
15011
15081
 
15012
- const resolveBodyLength = async (headers, body) => {
15013
- const length = utils$1.toFiniteNumber(headers.getContentLength());
15082
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
15083
+ return body.byteLength;
15084
+ }
15014
15085
 
15015
- return length == null ? getBodyLength(body) : length;
15016
- };
15086
+ if (utils$1.isURLSearchParams(body)) {
15087
+ body = body + '';
15088
+ }
15017
15089
 
15018
- const fetchAdapter = isFetchSupported && (async (config) => {
15019
- let {
15020
- url,
15021
- method,
15022
- data,
15023
- signal,
15024
- cancelToken,
15025
- timeout,
15026
- onDownloadProgress,
15027
- onUploadProgress,
15028
- responseType,
15029
- headers,
15030
- withCredentials = 'same-origin',
15031
- fetchOptions
15032
- } = resolveConfig(config);
15090
+ if (utils$1.isString(body)) {
15091
+ return (await encodeText(body)).byteLength;
15092
+ }
15093
+ };
15033
15094
 
15034
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
15095
+ const resolveBodyLength = async (headers, body) => {
15096
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
15035
15097
 
15036
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
15098
+ return length == null ? getBodyLength(body) : length;
15099
+ };
15100
+
15101
+ return async (config) => {
15102
+ let {
15103
+ url,
15104
+ method,
15105
+ data,
15106
+ signal,
15107
+ cancelToken,
15108
+ timeout,
15109
+ onDownloadProgress,
15110
+ onUploadProgress,
15111
+ responseType,
15112
+ headers,
15113
+ withCredentials = 'same-origin',
15114
+ fetchOptions
15115
+ } = resolveConfig(config);
15116
+
15117
+ let _fetch = envFetch || fetch;
15037
15118
 
15038
- let request;
15119
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
15039
15120
 
15040
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
15121
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
15122
+
15123
+ let request = null;
15124
+
15125
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
15041
15126
  composedSignal.unsubscribe();
15042
- });
15127
+ });
15043
15128
 
15044
- let requestContentLength;
15129
+ let requestContentLength;
15045
15130
 
15046
- try {
15047
- if (
15048
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
15049
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
15050
- ) {
15051
- let _request = new Request(url, {
15052
- method: 'POST',
15053
- body: data,
15054
- duplex: "half"
15055
- });
15131
+ try {
15132
+ if (
15133
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
15134
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
15135
+ ) {
15136
+ let _request = new Request(url, {
15137
+ method: 'POST',
15138
+ body: data,
15139
+ duplex: "half"
15140
+ });
15056
15141
 
15057
- let contentTypeHeader;
15142
+ let contentTypeHeader;
15058
15143
 
15059
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
15060
- headers.setContentType(contentTypeHeader);
15061
- }
15144
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
15145
+ headers.setContentType(contentTypeHeader);
15146
+ }
15062
15147
 
15063
- if (_request.body) {
15064
- const [onProgress, flush] = progressEventDecorator(
15065
- requestContentLength,
15066
- progressEventReducer(asyncDecorator(onUploadProgress))
15067
- );
15148
+ if (_request.body) {
15149
+ const [onProgress, flush] = progressEventDecorator(
15150
+ requestContentLength,
15151
+ progressEventReducer(asyncDecorator(onUploadProgress))
15152
+ );
15068
15153
 
15069
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
15154
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
15155
+ }
15070
15156
  }
15071
- }
15072
15157
 
15073
- if (!utils$1.isString(withCredentials)) {
15074
- withCredentials = withCredentials ? 'include' : 'omit';
15075
- }
15158
+ if (!utils$1.isString(withCredentials)) {
15159
+ withCredentials = withCredentials ? 'include' : 'omit';
15160
+ }
15076
15161
 
15077
- // Cloudflare Workers throws when credentials are defined
15078
- // see https://github.com/cloudflare/workerd/issues/902
15079
- const isCredentialsSupported = "credentials" in Request.prototype;
15080
- request = new Request(url, {
15081
- ...fetchOptions,
15082
- signal: composedSignal,
15083
- method: method.toUpperCase(),
15084
- headers: headers.normalize().toJSON(),
15085
- body: data,
15086
- duplex: "half",
15087
- credentials: isCredentialsSupported ? withCredentials : undefined
15088
- });
15162
+ // Cloudflare Workers throws when credentials are defined
15163
+ // see https://github.com/cloudflare/workerd/issues/902
15164
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
15089
15165
 
15090
- let response = await fetch(request, fetchOptions);
15166
+ const resolvedOptions = {
15167
+ ...fetchOptions,
15168
+ signal: composedSignal,
15169
+ method: method.toUpperCase(),
15170
+ headers: headers.normalize().toJSON(),
15171
+ body: data,
15172
+ duplex: "half",
15173
+ credentials: isCredentialsSupported ? withCredentials : undefined
15174
+ };
15091
15175
 
15092
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
15176
+ request = isRequestSupported && new Request(url, resolvedOptions);
15093
15177
 
15094
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
15095
- const options = {};
15178
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
15096
15179
 
15097
- ['status', 'statusText', 'headers'].forEach(prop => {
15098
- options[prop] = response[prop];
15099
- });
15180
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
15100
15181
 
15101
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
15182
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
15183
+ const options = {};
15102
15184
 
15103
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
15104
- responseContentLength,
15105
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
15106
- ) || [];
15185
+ ['status', 'statusText', 'headers'].forEach(prop => {
15186
+ options[prop] = response[prop];
15187
+ });
15107
15188
 
15108
- response = new Response(
15109
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
15110
- flush && flush();
15111
- unsubscribe && unsubscribe();
15112
- }),
15113
- options
15114
- );
15115
- }
15189
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
15116
15190
 
15117
- responseType = responseType || 'text';
15191
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
15192
+ responseContentLength,
15193
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
15194
+ ) || [];
15118
15195
 
15119
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
15196
+ response = new Response(
15197
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
15198
+ flush && flush();
15199
+ unsubscribe && unsubscribe();
15200
+ }),
15201
+ options
15202
+ );
15203
+ }
15120
15204
 
15121
- !isStreamResponse && unsubscribe && unsubscribe();
15205
+ responseType = responseType || 'text';
15122
15206
 
15123
- return await new Promise((resolve, reject) => {
15124
- settle(resolve, reject, {
15125
- data: responseData,
15126
- headers: AxiosHeaders$2.from(response.headers),
15127
- status: response.status,
15128
- statusText: response.statusText,
15129
- config,
15130
- request
15131
- });
15132
- })
15133
- } catch (err) {
15134
- unsubscribe && unsubscribe();
15207
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
15135
15208
 
15136
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
15137
- throw Object.assign(
15138
- new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
15139
- {
15140
- cause: err.cause || err
15141
- }
15142
- )
15209
+ !isStreamResponse && unsubscribe && unsubscribe();
15210
+
15211
+ return await new Promise((resolve, reject) => {
15212
+ settle(resolve, reject, {
15213
+ data: responseData,
15214
+ headers: AxiosHeaders$2.from(response.headers),
15215
+ status: response.status,
15216
+ statusText: response.statusText,
15217
+ config,
15218
+ request
15219
+ });
15220
+ })
15221
+ } catch (err) {
15222
+ unsubscribe && unsubscribe();
15223
+
15224
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
15225
+ throw Object.assign(
15226
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
15227
+ {
15228
+ cause: err.cause || err
15229
+ }
15230
+ )
15231
+ }
15232
+
15233
+ throw AxiosError$1.from(err, err && err.code, config, request);
15143
15234
  }
15235
+ }
15236
+ };
15237
+
15238
+ const seedCache = new Map();
15239
+
15240
+ const getFetch = (config) => {
15241
+ let env = config ? config.env : {};
15242
+ const {fetch, Request, Response} = env;
15243
+ const seeds = [
15244
+ Request, Response, fetch
15245
+ ];
15246
+
15247
+ let len = seeds.length, i = len,
15248
+ seed, target, map = seedCache;
15249
+
15250
+ while (i--) {
15251
+ seed = seeds[i];
15252
+ target = map.get(seed);
15253
+
15254
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
15144
15255
 
15145
- throw AxiosError$1.from(err, err && err.code, config, request);
15256
+ map = target;
15146
15257
  }
15147
- });
15258
+
15259
+ return target;
15260
+ };
15261
+
15262
+ getFetch();
15148
15263
 
15149
15264
  const knownAdapters = {
15150
15265
  http: httpAdapter,
15151
15266
  xhr: xhrAdapter,
15152
- fetch: fetchAdapter
15267
+ fetch: {
15268
+ get: getFetch,
15269
+ }
15153
15270
  };
15154
15271
 
15155
15272
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -15168,7 +15285,7 @@
15168
15285
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
15169
15286
 
15170
15287
  const adapters = {
15171
- getAdapter: (adapters) => {
15288
+ getAdapter: (adapters, config) => {
15172
15289
  adapters = utils$1.isArray(adapters) ? adapters : [adapters];
15173
15290
 
15174
15291
  const {length} = adapters;
@@ -15191,7 +15308,7 @@
15191
15308
  }
15192
15309
  }
15193
15310
 
15194
- if (adapter) {
15311
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
15195
15312
  break;
15196
15313
  }
15197
15314
 
@@ -15259,7 +15376,7 @@
15259
15376
  config.headers.setContentType('application/x-www-form-urlencoded', false);
15260
15377
  }
15261
15378
 
15262
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
15379
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
15263
15380
 
15264
15381
  return adapter(config).then(function onAdapterResolution(response) {
15265
15382
  throwIfCancellationRequested(config);
@@ -15293,7 +15410,7 @@
15293
15410
  });
15294
15411
  }
15295
15412
 
15296
- const VERSION$1 = "1.10.0";
15413
+ const VERSION$1 = "1.12.2";
15297
15414
 
15298
15415
  const validators$1 = {};
15299
15416
 
@@ -15532,8 +15649,8 @@
15532
15649
 
15533
15650
  if (!synchronousRequestInterceptors) {
15534
15651
  const chain = [dispatchRequest.bind(this), undefined];
15535
- chain.unshift.apply(chain, requestInterceptorChain);
15536
- chain.push.apply(chain, responseInterceptorChain);
15652
+ chain.unshift(...requestInterceptorChain);
15653
+ chain.push(...responseInterceptorChain);
15537
15654
  len = chain.length;
15538
15655
 
15539
15656
  promise = Promise.resolve(config);
@@ -15549,8 +15666,6 @@
15549
15666
 
15550
15667
  let newConfig = config;
15551
15668
 
15552
- i = 0;
15553
-
15554
15669
  while (i < len) {
15555
15670
  const onFulfilled = requestInterceptorChain[i++];
15556
15671
  const onRejected = requestInterceptorChain[i++];
@@ -16282,11 +16397,11 @@
16282
16397
  get customers() {
16283
16398
  return new CustomersAccessor(this);
16284
16399
  }
16285
- scenario(selector) {
16286
- return new ScenarioAccessor(this, selector);
16400
+ package(selector) {
16401
+ return new PackageAccessor(this, selector);
16287
16402
  }
16288
- get scenarios() {
16289
- return new ScenariosAccessor(this);
16403
+ get packages() {
16404
+ return new PackagesAccessor(this);
16290
16405
  }
16291
16406
  async createEventSource(uri, queryParams) {
16292
16407
  return super.createEventSource(uri, queryParams);