@membranehq/sdk 0.28.0 → 0.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/bundle.d.ts +60 -4
  2. package/dist/bundle.js +233 -126
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/actions-accessors.d.ts +1 -0
  5. package/dist/dts/accessors/connections-accessors.d.ts +3 -0
  6. package/dist/dts/accessors/integrations-accessors.d.ts +2 -0
  7. package/dist/dts/agent/index.d.ts +1 -0
  8. package/dist/dts/agent/session-cost.d.ts +1 -0
  9. package/dist/dts/agent/session.d.ts +10 -2
  10. package/dist/dts/ai-gateway/models.d.ts +43 -0
  11. package/dist/dts/ai-gateway/models.test.d.ts +1 -0
  12. package/dist/dts/alerts/types.d.ts +7 -0
  13. package/dist/dts/api-client.d.ts +22 -3
  14. package/dist/dts/api-version.generated.d.ts +1 -1
  15. package/dist/dts/index.browser.d.ts +1 -0
  16. package/dist/dts/membrane-instances/types.d.ts +19 -35
  17. package/dist/dts/membrane-instances/types.test.d.ts +1 -0
  18. package/dist/dts/oauth/types.d.ts +11 -5
  19. package/dist/dts/orgs/types.d.ts +154 -281
  20. package/dist/dts/webhooks/types.d.ts +4 -2
  21. package/dist/dts/workspace-elements/api/act-api.d.ts +33 -0
  22. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +4 -0
  23. package/dist/dts/workspace-elements/api/actions-api.d.ts +3 -0
  24. package/dist/dts/workspace-elements/api/connected-products-api.d.ts +6 -21
  25. package/dist/dts/workspace-elements/api/connection-attempt-logs-api.d.ts +53 -0
  26. package/dist/dts/workspace-elements/api/connections-api.d.ts +15 -0
  27. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +3 -0
  28. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +6 -0
  29. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +2 -0
  30. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +2 -0
  31. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +2 -0
  32. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +5 -1
  33. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +6 -0
  34. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +4 -0
  35. package/dist/dts/workspace-elements/api/flows-api.d.ts +5 -0
  36. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +2 -0
  37. package/dist/dts/workspace-elements/api/index.d.ts +2 -0
  38. package/dist/dts/workspace-elements/api/integrations-api.d.ts +113 -0
  39. package/dist/dts/workspace-elements/api/packages-api.d.ts +1 -0
  40. package/dist/dts/workspace-elements/base/connected-products/index.d.ts +9 -14
  41. package/dist/dts/workspace-elements/base/connection-attempt-logs/index.d.ts +21 -0
  42. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
  43. package/dist/dts/workspace-elements/base/connections/index.d.ts +3 -0
  44. package/dist/dts/workspace-elements/base/connectors/functions.d.ts +1 -1
  45. package/dist/dts/workspace-elements/base/connectors/index.d.ts +2 -0
  46. package/dist/dts/workspace-elements/base/connectors/rest-api.d.ts +1 -1
  47. package/dist/dts/workspace-elements/base/index.d.ts +1 -0
  48. package/dist/dts/workspace-elements/paths.d.ts +2 -2
  49. package/dist/dts/workspace-elements/types.d.ts +4 -1
  50. package/dist/dts/workspaces/api.d.ts +20 -0
  51. package/dist/dts/workspaces/compare.d.ts +1 -1
  52. package/dist/dts/workspaces/types.d.ts +29 -0
  53. package/dist/index.browser.d.mts +637 -373
  54. package/dist/index.browser.d.ts +637 -373
  55. package/dist/index.browser.js +307 -47
  56. package/dist/index.browser.js.map +1 -1
  57. package/dist/index.browser.mjs +287 -44
  58. package/dist/index.browser.mjs.map +1 -1
  59. package/dist/index.node.d.mts +637 -373
  60. package/dist/index.node.d.ts +637 -373
  61. package/dist/index.node.js +307 -47
  62. package/dist/index.node.js.map +1 -1
  63. package/dist/index.node.mjs +287 -44
  64. package/dist/index.node.mjs.map +1 -1
  65. package/package.json +2 -2
package/dist/bundle.js CHANGED
@@ -20675,6 +20675,7 @@
20675
20675
  ? {
20676
20676
  integrationKey: options.integrationKey,
20677
20677
  connectionId: options.connectionId,
20678
+ connectionKey: options.connectionKey,
20678
20679
  }
20679
20680
  : {};
20680
20681
  return this.options.client.post(this.getPath('run'), { input }, { params: queryParams });
@@ -22259,6 +22260,7 @@
22259
22260
  WorkspaceElementState["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
22260
22261
  WorkspaceElementState["SETUP_FAILED"] = "SETUP_FAILED";
22261
22262
  WorkspaceElementState["READY"] = "READY";
22263
+ WorkspaceElementState["DISCONNECTING"] = "DISCONNECTING";
22262
22264
  })(WorkspaceElementState || (WorkspaceElementState = {}));
22263
22265
  var WorkspaceElementDependencyType;
22264
22266
  (function (WorkspaceElementDependencyType) {
@@ -22377,6 +22379,11 @@
22377
22379
  filterTitle: 'Connection',
22378
22380
  referenceElementType: WorkspaceElementType.Connection,
22379
22381
  }),
22382
+ connectionKey: string$1()
22383
+ .optional()
22384
+ .meta({
22385
+ hidden: true,
22386
+ }),
22380
22387
  instanceKey: string$1()
22381
22388
  .optional()
22382
22389
  .meta({
@@ -22942,7 +22949,7 @@
22942
22949
  }
22943
22950
  }
22944
22951
  async function createOrUpdateConnection(options) {
22945
- const { client, connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? 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 : {};
22946
22953
  let connectionType = await detectConnectionType(options);
22947
22954
  if (redirectUri) {
22948
22955
  connectionType = ConnectionType.REDIRECT;
@@ -22960,6 +22967,7 @@
22960
22967
  connectorId,
22961
22968
  connectorVersion,
22962
22969
  connectionId,
22970
+ connectionKey,
22963
22971
  name,
22964
22972
  authOptionKey,
22965
22973
  allowMultipleConnections,
@@ -23525,7 +23533,7 @@
23525
23533
  }
23526
23534
  }
23527
23535
 
23528
- /*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */
23536
+ /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23529
23537
  /**
23530
23538
  * Create a bound version of a function with a specified `this` context
23531
23539
  *
@@ -24393,7 +24401,7 @@
24393
24401
 
24394
24402
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
24395
24403
 
24396
- const utils$1 = {
24404
+ var utils$1 = {
24397
24405
  isArray,
24398
24406
  isArrayBuffer,
24399
24407
  isBuffer,
@@ -24455,9 +24463,9 @@
24455
24463
  isIterable,
24456
24464
  };
24457
24465
 
24458
- class AxiosError$1 extends Error {
24466
+ let AxiosError$1 = class AxiosError extends Error {
24459
24467
  static from(error, code, config, request, response, customProps) {
24460
- const axiosError = new AxiosError$1(error.message, code || error.code, config, request, response);
24468
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
24461
24469
  axiosError.cause = error;
24462
24470
  axiosError.name = error.name;
24463
24471
 
@@ -24524,7 +24532,7 @@
24524
24532
  status: this.status,
24525
24533
  };
24526
24534
  }
24527
- }
24535
+ };
24528
24536
 
24529
24537
  // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
24530
24538
  AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
@@ -24540,10 +24548,8 @@
24540
24548
  AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
24541
24549
  AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
24542
24550
 
24543
- const AxiosError$2 = AxiosError$1;
24544
-
24545
24551
  // eslint-disable-next-line strict
24546
- const httpAdapter = null;
24552
+ var httpAdapter = null;
24547
24553
 
24548
24554
  /**
24549
24555
  * Determines if the given thing is a array or js object.
@@ -24673,7 +24679,7 @@
24673
24679
  }
24674
24680
 
24675
24681
  if (!useBlob && utils$1.isBlob(value)) {
24676
- throw new AxiosError$2('Blob is not supported. Use a Buffer instead.');
24682
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
24677
24683
  }
24678
24684
 
24679
24685
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
@@ -24836,8 +24842,8 @@
24836
24842
  };
24837
24843
 
24838
24844
  /**
24839
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
24840
- * URI encoded counterparts
24845
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
24846
+ * their plain counterparts (`:`, `$`, `,`, `+`).
24841
24847
  *
24842
24848
  * @param {string} val The value to be encoded.
24843
24849
  *
@@ -24964,22 +24970,20 @@
24964
24970
  }
24965
24971
  }
24966
24972
 
24967
- const InterceptorManager$1 = InterceptorManager;
24968
-
24969
- const transitionalDefaults = {
24973
+ var transitionalDefaults = {
24970
24974
  silentJSONParsing: true,
24971
24975
  forcedJSONParsing: true,
24972
24976
  clarifyTimeoutError: false,
24973
24977
  legacyInterceptorReqResOrdering: true,
24974
24978
  };
24975
24979
 
24976
- const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
24980
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
24977
24981
 
24978
- const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
24982
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
24979
24983
 
24980
- const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
24984
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
24981
24985
 
24982
- const platform$1 = {
24986
+ var platform$1 = {
24983
24987
  isBrowser: true,
24984
24988
  classes: {
24985
24989
  URLSearchParams: URLSearchParams$1,
@@ -25034,16 +25038,16 @@
25034
25038
 
25035
25039
  const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
25036
25040
 
25037
- const utils$2 = /*#__PURE__*/Object.freeze({
25041
+ var utils$2 = /*#__PURE__*/Object.freeze({
25038
25042
  __proto__: null,
25039
25043
  hasBrowserEnv: hasBrowserEnv,
25040
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25041
25044
  hasStandardBrowserEnv: hasStandardBrowserEnv,
25045
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25042
25046
  navigator: _navigator,
25043
25047
  origin: origin
25044
25048
  });
25045
25049
 
25046
- const platform = {
25050
+ var platform = {
25047
25051
  ...utils$2,
25048
25052
  ...platform$1,
25049
25053
  };
@@ -25269,7 +25273,7 @@
25269
25273
  } catch (e) {
25270
25274
  if (strictJSONParsing) {
25271
25275
  if (e.name === 'SyntaxError') {
25272
- throw AxiosError$2.from(e, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
25276
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
25273
25277
  }
25274
25278
  throw e;
25275
25279
  }
@@ -25313,8 +25317,6 @@
25313
25317
  defaults.headers[method] = {};
25314
25318
  });
25315
25319
 
25316
- const defaults$1 = defaults;
25317
-
25318
25320
  // RawAxiosHeaders whose duplicates are ignored by node
25319
25321
  // c.f. https://nodejs.org/api/http.html#http_message_headers
25320
25322
  const ignoreDuplicateOf = utils$1.toObjectSet([
@@ -25351,7 +25353,7 @@
25351
25353
  *
25352
25354
  * @returns {Object} Headers parsed into an object
25353
25355
  */
25354
- const parseHeaders = (rawHeaders) => {
25356
+ var parseHeaders = (rawHeaders) => {
25355
25357
  const parsed = {};
25356
25358
  let key;
25357
25359
  let val;
@@ -25383,16 +25385,49 @@
25383
25385
 
25384
25386
  const $internals = Symbol('internals');
25385
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
+ }
25399
+
25400
+ if (!isValidHeaderValue(String(value))) {
25401
+ throw new Error(`Invalid character in header content ["${header}"]`);
25402
+ }
25403
+ }
25404
+
25386
25405
  function normalizeHeader(header) {
25387
25406
  return header && String(header).trim().toLowerCase();
25388
25407
  }
25389
25408
 
25409
+ function stripTrailingCRLF(str) {
25410
+ let end = str.length;
25411
+
25412
+ while (end > 0) {
25413
+ const charCode = str.charCodeAt(end - 1);
25414
+
25415
+ if (charCode !== 10 && charCode !== 13) {
25416
+ break;
25417
+ }
25418
+
25419
+ end -= 1;
25420
+ }
25421
+
25422
+ return end === str.length ? str : str.slice(0, end);
25423
+ }
25424
+
25390
25425
  function normalizeValue(value) {
25391
25426
  if (value === false || value == null) {
25392
25427
  return value;
25393
25428
  }
25394
25429
 
25395
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
25430
+ return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
25396
25431
  }
25397
25432
 
25398
25433
  function parseTokens(str) {
@@ -25451,7 +25486,7 @@
25451
25486
  });
25452
25487
  }
25453
25488
 
25454
- class AxiosHeaders$1 {
25489
+ let AxiosHeaders$1 = class AxiosHeaders {
25455
25490
  constructor(headers) {
25456
25491
  headers && this.set(headers);
25457
25492
  }
@@ -25474,6 +25509,7 @@
25474
25509
  _rewrite === true ||
25475
25510
  (_rewrite === undefined && self[key] !== false)
25476
25511
  ) {
25512
+ assertValidHeaderValue(_value, _header);
25477
25513
  self[key || _header] = normalizeValue(_value);
25478
25514
  }
25479
25515
  }
@@ -25695,7 +25731,7 @@
25695
25731
 
25696
25732
  return this;
25697
25733
  }
25698
- }
25734
+ };
25699
25735
 
25700
25736
  AxiosHeaders$1.accessor([
25701
25737
  'Content-Type',
@@ -25719,8 +25755,6 @@
25719
25755
 
25720
25756
  utils$1.freezeMethods(AxiosHeaders$1);
25721
25757
 
25722
- const AxiosHeaders$2 = AxiosHeaders$1;
25723
-
25724
25758
  /**
25725
25759
  * Transform the data for a request or a response
25726
25760
  *
@@ -25730,9 +25764,9 @@
25730
25764
  * @returns {*} The resulting transformed data
25731
25765
  */
25732
25766
  function transformData(fns, response) {
25733
- const config = this || defaults$1;
25767
+ const config = this || defaults;
25734
25768
  const context = response || config;
25735
- const headers = AxiosHeaders$2.from(context.headers);
25769
+ const headers = AxiosHeaders$1.from(context.headers);
25736
25770
  let data = context.data;
25737
25771
 
25738
25772
  utils$1.forEach(fns, function transform(fn) {
@@ -25748,7 +25782,7 @@
25748
25782
  return !!(value && value.__CANCEL__);
25749
25783
  }
25750
25784
 
25751
- class CanceledError$1 extends AxiosError$2 {
25785
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
25752
25786
  /**
25753
25787
  * A `CanceledError` is an object that is thrown when an operation is canceled.
25754
25788
  *
@@ -25759,13 +25793,11 @@
25759
25793
  * @returns {CanceledError} The created error.
25760
25794
  */
25761
25795
  constructor(message, config, request) {
25762
- super(message == null ? 'canceled' : message, AxiosError$2.ERR_CANCELED, config, request);
25796
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
25763
25797
  this.name = 'CanceledError';
25764
25798
  this.__CANCEL__ = true;
25765
25799
  }
25766
- }
25767
-
25768
- const CanceledError$2 = CanceledError$1;
25800
+ };
25769
25801
 
25770
25802
  /**
25771
25803
  * Resolve or reject a Promise based on response status.
@@ -25782,9 +25814,9 @@
25782
25814
  resolve(response);
25783
25815
  } else {
25784
25816
  reject(
25785
- new AxiosError$2(
25817
+ new AxiosError$1(
25786
25818
  'Request failed with status code ' + response.status,
25787
- [AxiosError$2.ERR_BAD_REQUEST, AxiosError$2.ERR_BAD_RESPONSE][
25819
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
25788
25820
  Math.floor(response.status / 100) - 4
25789
25821
  ],
25790
25822
  response.config,
@@ -25943,7 +25975,7 @@
25943
25975
  (...args) =>
25944
25976
  utils$1.asap(() => fn(...args));
25945
25977
 
25946
- const isURLSameOrigin = platform.hasStandardBrowserEnv
25978
+ var isURLSameOrigin = platform.hasStandardBrowserEnv
25947
25979
  ? ((origin, isMSIE) => (url) => {
25948
25980
  url = new URL(url, platform.origin);
25949
25981
 
@@ -25958,7 +25990,7 @@
25958
25990
  )
25959
25991
  : () => true;
25960
25992
 
25961
- const cookies = platform.hasStandardBrowserEnv
25993
+ var cookies = platform.hasStandardBrowserEnv
25962
25994
  ? // Standard browser envs support document.cookie
25963
25995
  {
25964
25996
  write(name, value, expires, path, domain, secure, sameSite) {
@@ -26054,7 +26086,7 @@
26054
26086
  return requestedURL;
26055
26087
  }
26056
26088
 
26057
- const headersToObject = (thing) => (thing instanceof AxiosHeaders$2 ? { ...thing } : thing);
26089
+ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
26058
26090
 
26059
26091
  /**
26060
26092
  * Config-specific merge-function which creates a new config-object
@@ -26157,12 +26189,12 @@
26157
26189
  return config;
26158
26190
  }
26159
26191
 
26160
- const resolveConfig = (config) => {
26192
+ var resolveConfig = (config) => {
26161
26193
  const newConfig = mergeConfig$1({}, config);
26162
26194
 
26163
26195
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
26164
26196
 
26165
- newConfig.headers = headers = AxiosHeaders$2.from(headers);
26197
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
26166
26198
 
26167
26199
  newConfig.url = buildURL(
26168
26200
  buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
@@ -26221,12 +26253,12 @@
26221
26253
 
26222
26254
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
26223
26255
 
26224
- const xhrAdapter = isXHRAdapterSupported &&
26256
+ var xhrAdapter = isXHRAdapterSupported &&
26225
26257
  function (config) {
26226
26258
  return new Promise(function dispatchXhrRequest(resolve, reject) {
26227
26259
  const _config = resolveConfig(config);
26228
26260
  let requestData = _config.data;
26229
- const requestHeaders = AxiosHeaders$2.from(_config.headers).normalize();
26261
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
26230
26262
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
26231
26263
  let onCanceled;
26232
26264
  let uploadThrottled, downloadThrottled;
@@ -26253,7 +26285,7 @@
26253
26285
  return;
26254
26286
  }
26255
26287
  // Prepare the response
26256
- const responseHeaders = AxiosHeaders$2.from(
26288
+ const responseHeaders = AxiosHeaders$1.from(
26257
26289
  'getAllResponseHeaders' in request && request.getAllResponseHeaders()
26258
26290
  );
26259
26291
  const responseData =
@@ -26317,7 +26349,7 @@
26317
26349
  return;
26318
26350
  }
26319
26351
 
26320
- reject(new AxiosError$2('Request aborted', AxiosError$2.ECONNABORTED, config, request));
26352
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
26321
26353
 
26322
26354
  // Clean up request
26323
26355
  request = null;
@@ -26329,7 +26361,7 @@
26329
26361
  // (message may be empty; when present, surface it)
26330
26362
  // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
26331
26363
  const msg = event && event.message ? event.message : 'Network Error';
26332
- const err = new AxiosError$2(msg, AxiosError$2.ERR_NETWORK, config, request);
26364
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
26333
26365
  // attach the underlying event for consumers who want details
26334
26366
  err.event = event || null;
26335
26367
  reject(err);
@@ -26346,9 +26378,9 @@
26346
26378
  timeoutErrorMessage = _config.timeoutErrorMessage;
26347
26379
  }
26348
26380
  reject(
26349
- new AxiosError$2(
26381
+ new AxiosError$1(
26350
26382
  timeoutErrorMessage,
26351
- transitional.clarifyTimeoutError ? AxiosError$2.ETIMEDOUT : AxiosError$2.ECONNABORTED,
26383
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
26352
26384
  config,
26353
26385
  request
26354
26386
  )
@@ -26400,7 +26432,7 @@
26400
26432
  if (!request) {
26401
26433
  return;
26402
26434
  }
26403
- reject(!cancel || cancel.type ? new CanceledError$2(null, config, request) : cancel);
26435
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
26404
26436
  request.abort();
26405
26437
  request = null;
26406
26438
  };
@@ -26417,9 +26449,9 @@
26417
26449
 
26418
26450
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
26419
26451
  reject(
26420
- new AxiosError$2(
26452
+ new AxiosError$1(
26421
26453
  'Unsupported protocol ' + protocol + ':',
26422
- AxiosError$2.ERR_BAD_REQUEST,
26454
+ AxiosError$1.ERR_BAD_REQUEST,
26423
26455
  config
26424
26456
  )
26425
26457
  );
@@ -26445,9 +26477,9 @@
26445
26477
  unsubscribe();
26446
26478
  const err = reason instanceof Error ? reason : this.reason;
26447
26479
  controller.abort(
26448
- err instanceof AxiosError$2
26480
+ err instanceof AxiosError$1
26449
26481
  ? err
26450
- : new CanceledError$2(err instanceof Error ? err.message : err)
26482
+ : new CanceledError$1(err instanceof Error ? err.message : err)
26451
26483
  );
26452
26484
  }
26453
26485
  };
@@ -26456,7 +26488,7 @@
26456
26488
  timeout &&
26457
26489
  setTimeout(() => {
26458
26490
  timer = null;
26459
- onabort(new AxiosError$2(`timeout of ${timeout}ms exceeded`, AxiosError$2.ETIMEDOUT));
26491
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
26460
26492
  }, timeout);
26461
26493
 
26462
26494
  const unsubscribe = () => {
@@ -26482,8 +26514,6 @@
26482
26514
  }
26483
26515
  };
26484
26516
 
26485
- const composeSignals$1 = composeSignals;
26486
-
26487
26517
  const streamChunk = function* (chunk, chunkSize) {
26488
26518
  let len = chunk.byteLength;
26489
26519
 
@@ -26583,7 +26613,7 @@
26583
26613
  Response,
26584
26614
  }))(utils$1.global);
26585
26615
 
26586
- const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
26616
+ const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
26587
26617
 
26588
26618
  const test = (fn, ...args) => {
26589
26619
  try {
@@ -26615,11 +26645,11 @@
26615
26645
 
26616
26646
  const encodeText =
26617
26647
  isFetchSupported &&
26618
- (typeof TextEncoder === 'function'
26648
+ (typeof TextEncoder$1 === 'function'
26619
26649
  ? (
26620
26650
  (encoder) => (str) =>
26621
26651
  encoder.encode(str)
26622
- )(new TextEncoder())
26652
+ )(new TextEncoder$1())
26623
26653
  : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
26624
26654
 
26625
26655
  const supportsRequestStream =
@@ -26628,8 +26658,10 @@
26628
26658
  test(() => {
26629
26659
  let duplexAccessed = false;
26630
26660
 
26661
+ const body = new ReadableStream$1();
26662
+
26631
26663
  const hasContentType = new Request(platform.origin, {
26632
- body: new ReadableStream$1(),
26664
+ body,
26633
26665
  method: 'POST',
26634
26666
  get duplex() {
26635
26667
  duplexAccessed = true;
@@ -26637,6 +26669,8 @@
26637
26669
  },
26638
26670
  }).headers.has('Content-Type');
26639
26671
 
26672
+ body.cancel();
26673
+
26640
26674
  return duplexAccessed && !hasContentType;
26641
26675
  });
26642
26676
 
@@ -26660,9 +26694,9 @@
26660
26694
  return method.call(res);
26661
26695
  }
26662
26696
 
26663
- throw new AxiosError$2(
26697
+ throw new AxiosError$1(
26664
26698
  `Response type '${type}' is not supported`,
26665
- AxiosError$2.ERR_NOT_SUPPORT,
26699
+ AxiosError$1.ERR_NOT_SUPPORT,
26666
26700
  config
26667
26701
  );
26668
26702
  });
@@ -26725,7 +26759,7 @@
26725
26759
 
26726
26760
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
26727
26761
 
26728
- let composedSignal = composeSignals$1(
26762
+ let composedSignal = composeSignals(
26729
26763
  [signal, cancelToken && cancelToken.toAbortSignal()],
26730
26764
  timeout
26731
26765
  );
@@ -26836,7 +26870,7 @@
26836
26870
  return await new Promise((resolve, reject) => {
26837
26871
  settle(resolve, reject, {
26838
26872
  data: responseData,
26839
- headers: AxiosHeaders$2.from(response.headers),
26873
+ headers: AxiosHeaders$1.from(response.headers),
26840
26874
  status: response.status,
26841
26875
  statusText: response.statusText,
26842
26876
  config,
@@ -26848,9 +26882,9 @@
26848
26882
 
26849
26883
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
26850
26884
  throw Object.assign(
26851
- new AxiosError$2(
26885
+ new AxiosError$1(
26852
26886
  'Network Error',
26853
- AxiosError$2.ERR_NETWORK,
26887
+ AxiosError$1.ERR_NETWORK,
26854
26888
  config,
26855
26889
  request,
26856
26890
  err && err.response
@@ -26861,7 +26895,7 @@
26861
26895
  );
26862
26896
  }
26863
26897
 
26864
- throw AxiosError$2.from(err, err && err.code, config, request, err && err.response);
26898
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
26865
26899
  }
26866
26900
  };
26867
26901
  };
@@ -26968,7 +27002,7 @@
26968
27002
  adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
26969
27003
 
26970
27004
  if (adapter === undefined) {
26971
- throw new AxiosError$2(`Unknown adapter '${id}'`);
27005
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
26972
27006
  }
26973
27007
  }
26974
27008
 
@@ -26992,7 +27026,7 @@
26992
27026
  : ' ' + renderReason(reasons[0])
26993
27027
  : 'as no adapter specified';
26994
27028
 
26995
- throw new AxiosError$2(
27029
+ throw new AxiosError$1(
26996
27030
  `There is no suitable adapter to dispatch the request ` + s,
26997
27031
  'ERR_NOT_SUPPORT'
26998
27032
  );
@@ -27004,7 +27038,7 @@
27004
27038
  /**
27005
27039
  * Exports Axios adapters and utility to resolve an adapter
27006
27040
  */
27007
- const adapters = {
27041
+ var adapters = {
27008
27042
  /**
27009
27043
  * Resolve an adapter from a list of adapter names or functions.
27010
27044
  * @type {Function}
@@ -27031,7 +27065,7 @@
27031
27065
  }
27032
27066
 
27033
27067
  if (config.signal && config.signal.aborted) {
27034
- throw new CanceledError$2(null, config);
27068
+ throw new CanceledError$1(null, config);
27035
27069
  }
27036
27070
  }
27037
27071
 
@@ -27045,7 +27079,7 @@
27045
27079
  function dispatchRequest(config) {
27046
27080
  throwIfCancellationRequested(config);
27047
27081
 
27048
- config.headers = AxiosHeaders$2.from(config.headers);
27082
+ config.headers = AxiosHeaders$1.from(config.headers);
27049
27083
 
27050
27084
  // Transform request data
27051
27085
  config.data = transformData.call(config, config.transformRequest);
@@ -27054,7 +27088,7 @@
27054
27088
  config.headers.setContentType('application/x-www-form-urlencoded', false);
27055
27089
  }
27056
27090
 
27057
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
27091
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
27058
27092
 
27059
27093
  return adapter(config).then(
27060
27094
  function onAdapterResolution(response) {
@@ -27063,7 +27097,7 @@
27063
27097
  // Transform response data
27064
27098
  response.data = transformData.call(config, config.transformResponse, response);
27065
27099
 
27066
- response.headers = AxiosHeaders$2.from(response.headers);
27100
+ response.headers = AxiosHeaders$1.from(response.headers);
27067
27101
 
27068
27102
  return response;
27069
27103
  },
@@ -27078,7 +27112,7 @@
27078
27112
  config.transformResponse,
27079
27113
  reason.response
27080
27114
  );
27081
- reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
27115
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
27082
27116
  }
27083
27117
  }
27084
27118
 
@@ -27087,7 +27121,7 @@
27087
27121
  );
27088
27122
  }
27089
27123
 
27090
- const VERSION$1 = "1.13.6";
27124
+ const VERSION$1 = "1.15.0";
27091
27125
 
27092
27126
  const validators$1 = {};
27093
27127
 
@@ -27125,9 +27159,9 @@
27125
27159
  // eslint-disable-next-line func-names
27126
27160
  return (value, opt, opts) => {
27127
27161
  if (validator === false) {
27128
- throw new AxiosError$2(
27162
+ throw new AxiosError$1(
27129
27163
  formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
27130
- AxiosError$2.ERR_DEPRECATED
27164
+ AxiosError$1.ERR_DEPRECATED
27131
27165
  );
27132
27166
  }
27133
27167
 
@@ -27166,7 +27200,7 @@
27166
27200
 
27167
27201
  function assertOptions(options, schema, allowUnknown) {
27168
27202
  if (typeof options !== 'object') {
27169
- throw new AxiosError$2('options must be an object', AxiosError$2.ERR_BAD_OPTION_VALUE);
27203
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
27170
27204
  }
27171
27205
  const keys = Object.keys(options);
27172
27206
  let i = keys.length;
@@ -27177,20 +27211,20 @@
27177
27211
  const value = options[opt];
27178
27212
  const result = value === undefined || validator(value, opt, options);
27179
27213
  if (result !== true) {
27180
- throw new AxiosError$2(
27214
+ throw new AxiosError$1(
27181
27215
  'option ' + opt + ' must be ' + result,
27182
- AxiosError$2.ERR_BAD_OPTION_VALUE
27216
+ AxiosError$1.ERR_BAD_OPTION_VALUE
27183
27217
  );
27184
27218
  }
27185
27219
  continue;
27186
27220
  }
27187
27221
  if (allowUnknown !== true) {
27188
- throw new AxiosError$2('Unknown option ' + opt, AxiosError$2.ERR_BAD_OPTION);
27222
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
27189
27223
  }
27190
27224
  }
27191
27225
  }
27192
27226
 
27193
- const validator = {
27227
+ var validator = {
27194
27228
  assertOptions,
27195
27229
  validators: validators$1,
27196
27230
  };
@@ -27204,12 +27238,12 @@
27204
27238
  *
27205
27239
  * @return {Axios} A new instance of Axios
27206
27240
  */
27207
- class Axios$1 {
27241
+ let Axios$1 = class Axios {
27208
27242
  constructor(instanceConfig) {
27209
27243
  this.defaults = instanceConfig || {};
27210
27244
  this.interceptors = {
27211
- request: new InterceptorManager$1(),
27212
- response: new InterceptorManager$1(),
27245
+ request: new InterceptorManager(),
27246
+ response: new InterceptorManager(),
27213
27247
  };
27214
27248
  }
27215
27249
 
@@ -27231,13 +27265,29 @@
27231
27265
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
27232
27266
 
27233
27267
  // slice off the Error: ... line
27234
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
27268
+ const stack = (() => {
27269
+ if (!dummy.stack) {
27270
+ return '';
27271
+ }
27272
+
27273
+ const firstNewlineIndex = dummy.stack.indexOf('\n');
27274
+
27275
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
27276
+ })();
27235
27277
  try {
27236
27278
  if (!err.stack) {
27237
27279
  err.stack = stack;
27238
27280
  // match without the 2 top stack lines
27239
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
27240
- err.stack += '\n' + stack;
27281
+ } else if (stack) {
27282
+ const firstNewlineIndex = stack.indexOf('\n');
27283
+ const secondNewlineIndex =
27284
+ firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
27285
+ const stackWithoutTwoTopLines =
27286
+ secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
27287
+
27288
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
27289
+ err.stack += '\n' + stack;
27290
+ }
27241
27291
  }
27242
27292
  } catch (e) {
27243
27293
  // ignore the case where "stack" is an un-writable property
@@ -27319,7 +27369,7 @@
27319
27369
  delete headers[method];
27320
27370
  });
27321
27371
 
27322
- config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
27372
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
27323
27373
 
27324
27374
  // filter out skipped interceptors
27325
27375
  const requestInterceptorChain = [];
@@ -27402,7 +27452,7 @@
27402
27452
  const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
27403
27453
  return buildURL(fullPath, config.params, config.paramsSerializer);
27404
27454
  }
27405
- }
27455
+ };
27406
27456
 
27407
27457
  // Provide aliases for supported request methods
27408
27458
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
@@ -27419,8 +27469,6 @@
27419
27469
  });
27420
27470
 
27421
27471
  utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
27422
- /*eslint func-names:0*/
27423
-
27424
27472
  function generateHTTPMethod(isForm) {
27425
27473
  return function httpMethod(url, data, config) {
27426
27474
  return this.request(
@@ -27443,8 +27491,6 @@
27443
27491
  Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
27444
27492
  });
27445
27493
 
27446
- const Axios$2 = Axios$1;
27447
-
27448
27494
  /**
27449
27495
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
27450
27496
  *
@@ -27452,7 +27498,7 @@
27452
27498
  *
27453
27499
  * @returns {CancelToken}
27454
27500
  */
27455
- class CancelToken$1 {
27501
+ let CancelToken$1 = class CancelToken {
27456
27502
  constructor(executor) {
27457
27503
  if (typeof executor !== 'function') {
27458
27504
  throw new TypeError('executor must be a function.');
@@ -27500,7 +27546,7 @@
27500
27546
  return;
27501
27547
  }
27502
27548
 
27503
- token.reason = new CanceledError$2(message, config, request);
27549
+ token.reason = new CanceledError$1(message, config, request);
27504
27550
  resolvePromise(token.reason);
27505
27551
  });
27506
27552
  }
@@ -27565,7 +27611,7 @@
27565
27611
  */
27566
27612
  static source() {
27567
27613
  let cancel;
27568
- const token = new CancelToken$1(function executor(c) {
27614
+ const token = new CancelToken(function executor(c) {
27569
27615
  cancel = c;
27570
27616
  });
27571
27617
  return {
@@ -27573,9 +27619,7 @@
27573
27619
  cancel,
27574
27620
  };
27575
27621
  }
27576
- }
27577
-
27578
- const CancelToken$2 = CancelToken$1;
27622
+ };
27579
27623
 
27580
27624
  /**
27581
27625
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -27691,8 +27735,6 @@
27691
27735
  HttpStatusCode$1[value] = key;
27692
27736
  });
27693
27737
 
27694
- const HttpStatusCode$2 = HttpStatusCode$1;
27695
-
27696
27738
  /**
27697
27739
  * Create an instance of Axios
27698
27740
  *
@@ -27701,11 +27743,11 @@
27701
27743
  * @returns {Axios} A new instance of Axios
27702
27744
  */
27703
27745
  function createInstance(defaultConfig) {
27704
- const context = new Axios$2(defaultConfig);
27705
- const instance = bind(Axios$2.prototype.request, context);
27746
+ const context = new Axios$1(defaultConfig);
27747
+ const instance = bind(Axios$1.prototype.request, context);
27706
27748
 
27707
27749
  // Copy axios.prototype to instance
27708
- utils$1.extend(instance, Axios$2.prototype, context, { allOwnKeys: true });
27750
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
27709
27751
 
27710
27752
  // Copy context to instance
27711
27753
  utils$1.extend(instance, context, null, { allOwnKeys: true });
@@ -27719,20 +27761,20 @@
27719
27761
  }
27720
27762
 
27721
27763
  // Create the default instance to be exported
27722
- const axios$1 = createInstance(defaults$1);
27764
+ const axios$1 = createInstance(defaults);
27723
27765
 
27724
27766
  // Expose Axios class to allow class inheritance
27725
- axios$1.Axios = Axios$2;
27767
+ axios$1.Axios = Axios$1;
27726
27768
 
27727
27769
  // Expose Cancel & CancelToken
27728
- axios$1.CanceledError = CanceledError$2;
27729
- axios$1.CancelToken = CancelToken$2;
27770
+ axios$1.CanceledError = CanceledError$1;
27771
+ axios$1.CancelToken = CancelToken$1;
27730
27772
  axios$1.isCancel = isCancel$1;
27731
27773
  axios$1.VERSION = VERSION$1;
27732
27774
  axios$1.toFormData = toFormData$1;
27733
27775
 
27734
27776
  // Expose AxiosError class
27735
- axios$1.AxiosError = AxiosError$2;
27777
+ axios$1.AxiosError = AxiosError$1;
27736
27778
 
27737
27779
  // alias for CanceledError for backward compatibility
27738
27780
  axios$1.Cancel = axios$1.CanceledError;
@@ -27750,19 +27792,16 @@
27750
27792
  // Expose mergeConfig
27751
27793
  axios$1.mergeConfig = mergeConfig$1;
27752
27794
 
27753
- axios$1.AxiosHeaders = AxiosHeaders$2;
27795
+ axios$1.AxiosHeaders = AxiosHeaders$1;
27754
27796
 
27755
27797
  axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
27756
27798
 
27757
27799
  axios$1.getAdapter = adapters.getAdapter;
27758
27800
 
27759
- axios$1.HttpStatusCode = HttpStatusCode$2;
27801
+ axios$1.HttpStatusCode = HttpStatusCode$1;
27760
27802
 
27761
27803
  axios$1.default = axios$1;
27762
27804
 
27763
- // this module should only have a default export
27764
- const axios$1$1 = axios$1;
27765
-
27766
27805
  // This module is intended to unwrap Axios default export as named.
27767
27806
  // Keep top-level export same with static properties
27768
27807
  // so that it can keep same with es module or cjs
@@ -27783,7 +27822,7 @@
27783
27822
  formToJSON,
27784
27823
  getAdapter,
27785
27824
  mergeConfig,
27786
- } = axios$1$1;
27825
+ } = axios$1;
27787
27826
 
27788
27827
  // lib/v4/isZodErrorLike.ts
27789
27828
  function isZodErrorLike(err) {
@@ -28129,7 +28168,7 @@
28129
28168
  }
28130
28169
  }
28131
28170
 
28132
- const axiosGlobal = ((axios$1$1 === null || axios$1$1 === void 0 ? void 0 : axios$1$1.default) || axios$1$1);
28171
+ const axiosGlobal = ((axios$1 === null || axios$1 === void 0 ? void 0 : axios$1.default) || axios$1);
28133
28172
  const axios = axiosGlobal.create();
28134
28173
  const DEFAULT_API_URI = 'https://api.getmembrane.com';
28135
28174
  const DEFAULT_UI_URI = 'https://ui.getmembrane.com';
@@ -28141,6 +28180,9 @@
28141
28180
  apiUri: string$1().nullish(),
28142
28181
  uiUri: string$1().nullish(),
28143
28182
  accessToken: string$1().nullish(),
28183
+ workspaceKey: string$1().nullish(),
28184
+ workspaceSecret: string$1().nullish(),
28185
+ tenantKey: string$1().nullish(),
28144
28186
  })
28145
28187
  .strict();
28146
28188
  function validateClientOptions(options) {
@@ -28155,6 +28197,8 @@
28155
28197
  }
28156
28198
  }
28157
28199
  const REFETCH_EXPIRATION_THRESHOLD = 10 * 1000;
28200
+ const TOKEN_TTL_SECONDS = 3600;
28201
+ const TOKEN_MINT_THRESHOLD_SECONDS = 60;
28158
28202
  function decodeToken(token) {
28159
28203
  if (token.startsWith('pat-')) {
28160
28204
  return null;
@@ -28169,11 +28213,25 @@
28169
28213
  constructor(options = {}) {
28170
28214
  this.logs = [];
28171
28215
  validateClientOptions(options);
28172
- const { uiUri, apiUri, accessToken, token, fetchToken, fetchCredentials, credentials } = options;
28216
+ const { uiUri, apiUri, fetchCredentials, credentials } = options;
28173
28217
  this.apiUri = apiUri !== null && apiUri !== void 0 ? apiUri : DEFAULT_API_URI;
28174
28218
  this.uiUri = uiUri !== null && uiUri !== void 0 ? uiUri : DEFAULT_UI_URI;
28175
- this.token = token !== null && token !== void 0 ? token : accessToken;
28176
- this.fetchToken = fetchToken;
28219
+ if ('workspaceSecret' in options && options.workspaceSecret) {
28220
+ if (typeof window !== 'undefined') {
28221
+ throw new Error('MembraneClient: workspaceSecret must not be used in browser code. ' +
28222
+ 'The workspace secret is a server-side credential that would be exposed to end users if included in a browser bundle.');
28223
+ }
28224
+ this._workspaceKey = options.workspaceKey;
28225
+ this._workspaceSecret = options.workspaceSecret;
28226
+ this._tenantKey = options.tenantKey;
28227
+ }
28228
+ else {
28229
+ const token = 'token' in options ? options.token : undefined;
28230
+ const accessToken = 'accessToken' in options ? options.accessToken : undefined;
28231
+ const fetchToken = 'fetchToken' in options ? options.fetchToken : undefined;
28232
+ this.token = token !== null && token !== void 0 ? token : accessToken;
28233
+ this.fetchToken = fetchToken;
28234
+ }
28177
28235
  if (fetchCredentials) {
28178
28236
  void fetchCredentials().then((c) => this.setCredentials(c));
28179
28237
  }
@@ -28185,6 +28243,9 @@
28185
28243
  return this.patch('/self', { credentials });
28186
28244
  }
28187
28245
  async getToken() {
28246
+ if (this._workspaceSecret) {
28247
+ return this.mintToken();
28248
+ }
28188
28249
  if (this.fetchToken) {
28189
28250
  if (!this.token) {
28190
28251
  this.token = await this.fetchToken();
@@ -28205,6 +28266,38 @@
28205
28266
  decodeToken(this.token);
28206
28267
  return this.token;
28207
28268
  }
28269
+ async mintToken() {
28270
+ if (this.token) {
28271
+ const payload = decodeToken(this.token);
28272
+ if (payload === null || payload === void 0 ? void 0 : payload.exp) {
28273
+ const remainingSeconds = payload.exp - Math.floor(Date.now() / 1000);
28274
+ if (remainingSeconds > TOKEN_MINT_THRESHOLD_SECONDS) {
28275
+ return this.token;
28276
+ }
28277
+ }
28278
+ }
28279
+ const payload = {
28280
+ id: this._tenantKey,
28281
+ iss: this._workspaceKey,
28282
+ exp: Math.floor(Date.now() / 1000) + TOKEN_TTL_SECONDS,
28283
+ };
28284
+ const header = { alg: 'HS256', typ: 'JWT' };
28285
+ const encoder = new TextEncoder();
28286
+ const toB64Url = (bytes) => {
28287
+ let s = '';
28288
+ for (let i = 0; i < bytes.length; i++)
28289
+ s += String.fromCharCode(bytes[i]);
28290
+ return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
28291
+ };
28292
+ const headerB64 = toB64Url(encoder.encode(JSON.stringify(header)));
28293
+ const payloadB64 = toB64Url(encoder.encode(JSON.stringify(payload)));
28294
+ const input = `${headerB64}.${payloadB64}`;
28295
+ const key = await crypto.subtle.importKey('raw', encoder.encode(this._workspaceSecret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
28296
+ const signatureBuffer = await crypto.subtle.sign('HMAC', key, encoder.encode(input));
28297
+ const signature = toB64Url(new Uint8Array(signatureBuffer));
28298
+ this.token = `${input}.${signature}`;
28299
+ return this.token;
28300
+ }
28208
28301
  async get(uri, queryParams, options) {
28209
28302
  if (queryParams) {
28210
28303
  uri += `${uri.includes('?') ? '&' : '?'}${new URLSearchParams(omitBy(queryParams, isEmptyValue)).toString()}`;
@@ -28403,6 +28496,7 @@
28403
28496
  name: string$1().optional(),
28404
28497
  meta: record(string$1(), any()).optional(),
28405
28498
  authOptionKey: string$1().optional(),
28499
+ key: string$1().min(1).max(100).optional().nullable(),
28406
28500
  integrationId: string$1().optional(),
28407
28501
  integrationUuid: string$1().optional(),
28408
28502
  integrationKey: string$1().optional(),
@@ -28425,8 +28519,10 @@
28425
28519
  const BaseConnection = BaseWorkspaceElement.extend({
28426
28520
  ...TenantLayerElement.shape,
28427
28521
  name: string$1(),
28522
+ key: string$1().optional(),
28428
28523
  isTest: boolean$1().optional(),
28429
- disconnected: boolean$1().optional(),
28524
+ connected: boolean$1().optional(),
28525
+ disconnected: boolean$1().optional().describe('[DEPRECATED] Use `connected` instead.'),
28430
28526
  isDefunct: boolean$1().optional(),
28431
28527
  state: _enum(WorkspaceElementState).optional(),
28432
28528
  errors: array(ErrorDataSchema).optional(),
@@ -29488,11 +29584,19 @@
29488
29584
  filterTitle: 'External App',
29489
29585
  referenceElementType: WorkspaceElementType.App,
29490
29586
  }),
29587
+ connected: zodBooleanCoercion()
29588
+ .optional()
29589
+ .meta({
29590
+ filterTitle: 'Connected',
29591
+ isFlag: true,
29592
+ }),
29491
29593
  disconnected: zodBooleanCoercion()
29492
29594
  .optional()
29595
+ .describe('[DEPRECATED] Use `connected` instead.')
29493
29596
  .meta({
29494
29597
  filterTitle: 'Disconnected',
29495
29598
  isFlag: true,
29599
+ hidden: true,
29496
29600
  }),
29497
29601
  isTest: zodBooleanCoercion()
29498
29602
  .optional()
@@ -29573,6 +29677,7 @@
29573
29677
  integrationKey: string$1().optional(),
29574
29678
  integrationId: string$1().optional(),
29575
29679
  connectionId: string$1().optional(),
29680
+ connectionKey: string$1().optional(),
29576
29681
  });
29577
29682
  const ConnectionApiResponse = BaseConnection.extend({
29578
29683
  user: BaseCustomer.optional(),
@@ -29616,6 +29721,7 @@
29616
29721
  connectorKey: string$1().optional(),
29617
29722
  connectorVersion: string$1().optional(),
29618
29723
  connectionId: string$1().optional(),
29724
+ connectionKey: string$1().min(1).max(100).optional(),
29619
29725
  name: string$1().optional(),
29620
29726
  input: record(string$1(), unknown()).optional(),
29621
29727
  connectionParameters: any().optional().describe('[INTERNAL] Deprecated: Use input instead'),
@@ -29625,6 +29731,7 @@
29625
29731
  redirectUri: string$1().optional(),
29626
29732
  customState: string$1().optional(),
29627
29733
  connectionRequestId: string$1().optional(),
29734
+ intent: string$1().optional(),
29628
29735
  });
29629
29736
  ConnectPayload.omit({ input: true, redirectUri: true }).extend({
29630
29737
  theme: _enum(['light', 'dark', 'auto']).optional(),