@membranehq/sdk 0.28.1 → 0.28.3

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 (53) hide show
  1. package/dist/bundle.d.ts +53 -4
  2. package/dist/bundle.js +75 -9
  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 +4 -0
  6. package/dist/dts/accessors/integrations-accessors.d.ts +3 -0
  7. package/dist/dts/agent/session.d.ts +10 -1
  8. package/dist/dts/ai-gateway/models.d.ts +43 -0
  9. package/dist/dts/ai-gateway/models.test.d.ts +1 -0
  10. package/dist/dts/alerts/types.d.ts +7 -0
  11. package/dist/dts/api-client.d.ts +22 -3
  12. package/dist/dts/api-version.generated.d.ts +1 -1
  13. package/dist/dts/index.browser.d.ts +1 -0
  14. package/dist/dts/membrane-instances/types.d.ts +23 -35
  15. package/dist/dts/membrane-instances/types.test.d.ts +1 -0
  16. package/dist/dts/orgs/types.d.ts +55 -11
  17. package/dist/dts/webhooks/types.d.ts +3 -2
  18. package/dist/dts/workspace-elements/api/act-api.d.ts +33 -0
  19. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +2 -0
  20. package/dist/dts/workspace-elements/api/actions-api.d.ts +3 -0
  21. package/dist/dts/workspace-elements/api/connections-api.d.ts +15 -2
  22. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +2 -0
  23. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +4 -0
  24. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
  25. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +1 -0
  26. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +1 -0
  27. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +4 -1
  28. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +4 -0
  29. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +2 -0
  30. package/dist/dts/workspace-elements/api/flows-api.d.ts +3 -0
  31. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +1 -0
  32. package/dist/dts/workspace-elements/api/index.d.ts +1 -0
  33. package/dist/dts/workspace-elements/api/integrations-api.d.ts +112 -0
  34. package/dist/dts/workspace-elements/api/packages-api.d.ts +1 -0
  35. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
  36. package/dist/dts/workspace-elements/base/connections/index.d.ts +2 -0
  37. package/dist/dts/workspace-elements/types.d.ts +4 -1
  38. package/dist/dts/workspaces/api.d.ts +20 -0
  39. package/dist/dts/workspaces/compare.d.ts +2 -0
  40. package/dist/dts/workspaces/types.d.ts +29 -0
  41. package/dist/index.browser.d.mts +417 -57
  42. package/dist/index.browser.d.ts +417 -57
  43. package/dist/index.browser.js +236 -27
  44. package/dist/index.browser.js.map +1 -1
  45. package/dist/index.browser.mjs +226 -28
  46. package/dist/index.browser.mjs.map +1 -1
  47. package/dist/index.node.d.mts +417 -57
  48. package/dist/index.node.d.ts +417 -57
  49. package/dist/index.node.js +236 -27
  50. package/dist/index.node.js.map +1 -1
  51. package/dist/index.node.mjs +226 -28
  52. package/dist/index.node.mjs.map +1 -1
  53. package/package.json +1 -1
@@ -3523,6 +3523,7 @@ exports.WorkspaceElementState = void 0;
3523
3523
  WorkspaceElementState["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
3524
3524
  WorkspaceElementState["SETUP_FAILED"] = "SETUP_FAILED";
3525
3525
  WorkspaceElementState["READY"] = "READY";
3526
+ WorkspaceElementState["DISCONNECTING"] = "DISCONNECTING";
3526
3527
  })(exports.WorkspaceElementState || (exports.WorkspaceElementState = {}));
3527
3528
  exports.WorkspaceElementDependencyType = void 0;
3528
3529
  (function (WorkspaceElementDependencyType) {
@@ -3664,6 +3665,12 @@ const IntegrationLevelMembraneInterfaceSelectorQuery = z.z.object({
3664
3665
  filterTitle: 'Connection',
3665
3666
  referenceElementType: exports.WorkspaceElementType.Connection,
3666
3667
  }),
3668
+ connectionKey: z.z
3669
+ .string()
3670
+ .optional()
3671
+ .meta({
3672
+ hidden: true,
3673
+ }),
3667
3674
  instanceKey: z.z
3668
3675
  .string()
3669
3676
  .optional()
@@ -3997,6 +4004,7 @@ const CreateConnectionRequestPayload = z.z.object({
3997
4004
  connectorKey: z.z.string().optional(),
3998
4005
  connectorVersion: z.z.string().optional(),
3999
4006
  connectionId: z.z.string().optional(),
4007
+ connectionKey: z.z.string().min(1).max(100).optional(),
4000
4008
  name: z.z.string().optional(),
4001
4009
  allowMultipleConnections: z.z.boolean().optional(),
4002
4010
  connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
@@ -4013,6 +4021,7 @@ const ConnectionRequest = z.z.object({
4013
4021
  connectorKey: z.z.string().optional(),
4014
4022
  connectorVersion: z.z.string().optional(),
4015
4023
  connectionId: z.z.string().optional(),
4024
+ connectionKey: z.z.string().optional(),
4016
4025
  name: z.z.string().optional(),
4017
4026
  allowMultipleConnections: z.z.boolean().optional(),
4018
4027
  connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
@@ -4029,6 +4038,7 @@ const ConnectionEditableProperties = z.z.object({
4029
4038
  name: z.z.string().optional(),
4030
4039
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
4031
4040
  authOptionKey: z.z.string().optional(),
4041
+ key: z.z.string().min(1).max(100).optional().nullable(),
4032
4042
  integrationId: z.z.string().optional(),
4033
4043
  integrationUuid: z.z.string().optional(),
4034
4044
  integrationKey: z.z.string().optional(),
@@ -4051,6 +4061,7 @@ const ConnectionClientAction = z.z.object({
4051
4061
  const BaseConnection = BaseWorkspaceElement.extend({
4052
4062
  ...TenantLayerElement.shape,
4053
4063
  name: z.z.string(),
4064
+ key: z.z.string().optional(),
4054
4065
  isTest: z.z.boolean().optional(),
4055
4066
  connected: z.z.boolean().optional(),
4056
4067
  disconnected: z.z.boolean().optional().describe('[DEPRECATED] Use `connected` instead.'),
@@ -10321,6 +10332,51 @@ const BaseConnectionAttemptLog = ActivityLogRecord.extend({
10321
10332
  createdAt: z.z.string(),
10322
10333
  });
10323
10334
 
10335
+ const ActApiDispatch = z.z.object({
10336
+ method: z.z.enum(exports.HttpRequestMethod).describe('HTTP method to use.'),
10337
+ path: z.z.string().optional().describe("Path appended to the connection's base URL, e.g. `/v2/users/me`. Required."),
10338
+ body: z.z.any().optional().describe('Request body. For JSON APIs, pass a plain object.'),
10339
+ headers: z.z.record(z.z.string(), z.z.string()).optional().describe('Additional HTTP headers.'),
10340
+ query: z.z
10341
+ .record(z.z.string(), z.z.union([z.z.string(), z.z.number(), z.z.boolean()]))
10342
+ .optional()
10343
+ .describe('Query-string parameters.'),
10344
+ url: z.z.string().optional().describe('[INTERNAL] Alias for `path`. Normalized to `path` on the server.'),
10345
+ data: z.z.any().optional().describe('[INTERNAL] Alias for `body`. Normalized to `body` on the server.'),
10346
+ });
10347
+ const ActRequest = z.z
10348
+ .object({
10349
+ id: z.z.string().optional().describe('ID of the action to run.'),
10350
+ key: z.z
10351
+ .string()
10352
+ .optional()
10353
+ .describe('Key of the action to run. If the same key exists across multiple integrations, also pass `integrationId`, `integrationKey`, or `connectionId` so we know which one you mean.'),
10354
+ api: ActApiDispatch.optional().describe("Inline HTTP request spec, sent through the resolved connection's auth layer and base URL. Pair with `connectionId`, `connectionKey`, `integrationId`, or `integrationKey` to pick the connection."),
10355
+ code: z.z
10356
+ .string()
10357
+ .optional()
10358
+ .describe('Inline JavaScript executed in a sandbox. The module must export a function that receives `{ input, membrane, ... }`. Its return value becomes the action output.'),
10359
+ integrationId: z.z
10360
+ .string()
10361
+ .optional()
10362
+ .describe("ID of the integration to run the action on. When `key` is provided, looks up the action within this integration. When no connection is specified, runs against this integration's default connection."),
10363
+ integrationKey: z.z
10364
+ .string()
10365
+ .optional()
10366
+ .describe("Key of the integration to run the action on. When `key` is provided, looks up the action within this integration. When no connection is specified, runs against this integration's default connection."),
10367
+ connectionId: z.z
10368
+ .string()
10369
+ .optional()
10370
+ .describe('ID of the connection to run the action against. If a connection-level version of the action exists on this connection, that version is used; otherwise the integration-level or universal action is used.'),
10371
+ connectionKey: z.z
10372
+ .string()
10373
+ .optional()
10374
+ .describe('Key of the connection to run the action against. Use when you have a stable key for the connection instead of an ID.'),
10375
+ input: z.z.any().optional().describe('Input passed to the action, matching its input schema.'),
10376
+ meta: z.z.record(z.z.string(), z.z.any()).optional().describe('Arbitrary metadata stored on the action run log.'),
10377
+ })
10378
+ .strict();
10379
+
10324
10380
  const ActionApiResponse = BaseAction.extend({
10325
10381
  integration: BaseIntegration.optional(),
10326
10382
  user: BaseCustomer.optional(),
@@ -10577,15 +10633,16 @@ const ConnectionSelector = z.z.object({
10577
10633
  integrationKey: z.z.string().optional(),
10578
10634
  integrationId: z.z.string().optional(),
10579
10635
  connectionId: z.z.string().optional(),
10636
+ connectionKey: z.z.string().optional(),
10580
10637
  });
10581
10638
  const ConnectionApiResponse = BaseConnection.extend({
10582
10639
  user: BaseCustomer.optional(),
10583
10640
  integration: BaseIntegration.optional(),
10641
+ connectorParameters: z.z.unknown().optional(),
10642
+ input: z.z.unknown().optional(),
10584
10643
  });
10585
10644
  const ConnectionApiResponseWithSecrets = ConnectionApiResponse.extend({
10586
10645
  credentials: z.z.unknown().optional(),
10587
- input: z.z.unknown().optional(),
10588
- connectorParameters: z.z.unknown().optional(),
10589
10646
  });
10590
10647
  const ConnectionMessagePayload = z.z.discriminatedUnion('type', [
10591
10648
  z.z.object({
@@ -10620,6 +10677,7 @@ const ConnectPayload = z.z.object({
10620
10677
  connectorKey: z.z.string().optional(),
10621
10678
  connectorVersion: z.z.string().optional(),
10622
10679
  connectionId: z.z.string().optional(),
10680
+ connectionKey: z.z.string().min(1).max(100).optional(),
10623
10681
  name: z.z.string().optional(),
10624
10682
  input: z.z.record(z.z.string(), z.z.unknown()).optional(),
10625
10683
  connectionParameters: z.z.any().optional().describe('[INTERNAL] Deprecated: Use input instead'),
@@ -10864,6 +10922,18 @@ const UpdateIntegrationRequest = IntegrationEditableProperties.partial();
10864
10922
  const FindIntegrationsQuery = z.z
10865
10923
  .object({
10866
10924
  appUuid: z.z.string().optional(),
10925
+ connectors: z.z.coerce
10926
+ .number()
10927
+ .optional()
10928
+ .describe('Override auto-generate integrations from connectors: 1 to enable, 0 to disable'),
10929
+ externalApps: z.z.coerce
10930
+ .number()
10931
+ .optional()
10932
+ .describe('Override auto-generate integrations from external apps: 1 to enable, 0 to disable'),
10933
+ websearch: z.z.coerce
10934
+ .number()
10935
+ .optional()
10936
+ .describe('Override auto-generate integrations from web search: 1 to enable, 0 to disable'),
10867
10937
  })
10868
10938
  .merge(PaginationQuery)
10869
10939
  .merge(SearchQuery)
@@ -10888,6 +10958,11 @@ const IntegrationApiResponse = BaseIntegration.extend({
10888
10958
  .optional()
10889
10959
  .describe('[INTERNAL] Deprecated: Use POST /connectors/:id/generate-options instead'),
10890
10960
  });
10961
+ const IntegrationListItem = IntegrationApiResponse.extend({
10962
+ id: z.z.string().optional(),
10963
+ logoUri: z.z.string().optional(),
10964
+ appUri: z.z.string().optional(),
10965
+ });
10891
10966
 
10892
10967
  const PackageElementApi = z.z.object({
10893
10968
  id: z.z.string(),
@@ -11418,6 +11493,12 @@ const ListExternalEventSubscriptionsQuery = PaginationQuery.merge(IncludeArchive
11418
11493
  externalAppId: z.z.string().optional().meta({
11419
11494
  hidden: true,
11420
11495
  }),
11496
+ status: z.z
11497
+ .enum(exports.ExternalEventSubscriptionStatus)
11498
+ .optional()
11499
+ .meta({
11500
+ filterTitle: 'Status',
11501
+ }),
11421
11502
  });
11422
11503
  const ExternalEventSubscriptionApiResponse = BaseExternalEventSubscription.extend({
11423
11504
  user: BaseCustomer.optional(),
@@ -11885,6 +11966,28 @@ function getFilterFieldMeta(meta) {
11885
11966
  return undefined;
11886
11967
  }
11887
11968
 
11969
+ const AI_GATEWAY_SUPPORTED_MODELS = [
11970
+ { id: 'anthropic/claude-sonnet-4.6', name: 'Claude Sonnet 4.6' },
11971
+ { id: 'anthropic/claude-opus-4.6', name: 'Claude Opus 4.6' },
11972
+ { id: 'anthropic/claude-sonnet-4.5', name: 'Claude Sonnet 4.5' },
11973
+ { id: 'anthropic/claude-opus-4.5', name: 'Claude Opus 4.5' },
11974
+ { id: 'openai/gpt-5.2', name: 'GPT-5.2' },
11975
+ { id: 'openai/gpt-5-nano', name: 'GPT-5 Nano' },
11976
+ { id: 'google/gemini-3-pro-preview', name: 'Gemini 3 Pro' },
11977
+ { id: 'moonshotai/kimi-k2.5', name: 'Kimi K2.5' },
11978
+ ];
11979
+ const AI_GATEWAY_SUPPORTED_MODEL_IDS = AI_GATEWAY_SUPPORTED_MODELS.map((model) => model.id);
11980
+ if (AI_GATEWAY_SUPPORTED_MODEL_IDS.length === 0) {
11981
+ throw new Error('AI_GATEWAY_SUPPORTED_MODEL_IDS must not be empty');
11982
+ }
11983
+ const AIGatewaySupportedModelIdSchema = z.z.enum(AI_GATEWAY_SUPPORTED_MODEL_IDS);
11984
+ const DEFAULT_AI_GATEWAY_MODEL_ID = 'anthropic/claude-sonnet-4.6';
11985
+ const AI_GATEWAY_PROVIDER_MODELS = Object.fromEntries(AI_GATEWAY_SUPPORTED_MODELS.map((model) => [model.id, { name: model.name }]));
11986
+ const aiGatewaySupportedModelIdSet = new Set(AI_GATEWAY_SUPPORTED_MODEL_IDS);
11987
+ function isAIGatewaySupportedModelId(modelId) {
11988
+ return aiGatewaySupportedModelIdSet.has(modelId);
11989
+ }
11990
+
11888
11991
  exports.AgentSessionStatus = void 0;
11889
11992
  (function (AgentSessionStatus) {
11890
11993
  AgentSessionStatus["QUEUED"] = "queued";
@@ -11944,7 +12047,7 @@ const CreateAgentSession = z.z.object({
11944
12047
  prompt: z.z.string().min(1),
11945
12048
  testCustomerId: z.z.string().optional(),
11946
12049
  isExternal: z.z.boolean().optional(),
11947
- modelId: z.z.string().optional(),
12050
+ modelId: AIGatewaySupportedModelIdSchema.optional(),
11948
12051
  agentName: z.z.enum(exports.AgentName).optional(),
11949
12052
  promptAttachments: z.z.array(AgentSessionAttachment).optional(),
11950
12053
  });
@@ -13065,6 +13168,7 @@ exports.AlertType = void 0;
13065
13168
  AlertType["parallelApiRequestsPerCustomer"] = "parallelApiRequestsPerCustomer";
13066
13169
  AlertType["engineCreditsExhaustionProjected"] = "engineCreditsExhaustionProjected";
13067
13170
  AlertType["engineCreditsExhaustionActual"] = "engineCreditsExhaustionActual";
13171
+ AlertType["aiCreditsDebtAccumulated"] = "aiCreditsDebtAccumulated";
13068
13172
  AlertType["totalNumberOfDatabaseEntitiesPerCustomer"] = "totalNumberOfDatabaseEntitiesPerCustomer";
13069
13173
  AlertType["totalNumberOfCustomers"] = "totalNumberOfCustomers";
13070
13174
  AlertType["totalNumberOfConnections"] = "totalNumberOfConnections";
@@ -13102,6 +13206,7 @@ const ALERT_TYPE_CATEGORIES = {
13102
13206
  [exports.AlertType.parallelApiRequestsPerCustomer]: exports.AlertCategory.CUSTOMER_RATE_LIMIT,
13103
13207
  [exports.AlertType.engineCreditsExhaustionProjected]: exports.AlertCategory.USAGE,
13104
13208
  [exports.AlertType.engineCreditsExhaustionActual]: exports.AlertCategory.USAGE,
13209
+ [exports.AlertType.aiCreditsDebtAccumulated]: exports.AlertCategory.USAGE,
13105
13210
  [exports.AlertType.totalNumberOfDatabaseEntitiesPerCustomer]: exports.AlertCategory.WORKSPACE_SIZE,
13106
13211
  [exports.AlertType.testAlert]: exports.AlertCategory.TEST,
13107
13212
  [exports.AlertType.totalNumberOfCustomers]: exports.AlertCategory.WORKSPACE_SIZE,
@@ -13202,6 +13307,7 @@ function getAlertTypeDisplayName(alertType) {
13202
13307
  [exports.AlertType.parallelApiRequestsPerCustomer]: 'Parallel API Requests Per Customer',
13203
13308
  [exports.AlertType.engineCreditsExhaustionProjected]: 'Engine Credits Exhaustion Projected',
13204
13309
  [exports.AlertType.engineCreditsExhaustionActual]: 'Engine Credits Exhaustion Actual',
13310
+ [exports.AlertType.aiCreditsDebtAccumulated]: 'AI Credits Debt Accumulated',
13205
13311
  [exports.AlertType.totalNumberOfDatabaseEntitiesPerCustomer]: 'Database Entities Per Customer',
13206
13312
  [exports.AlertType.testAlert]: 'Test Alert',
13207
13313
  [exports.AlertType.totalNumberOfCustomers]: 'Total Number of Customers',
@@ -13358,6 +13464,7 @@ const WorkspaceLimitsSchema = z.object({
13358
13464
  totalNumberOfConnections: WorkspaceLimit.optional(),
13359
13465
  totalNumberOfWorkspaceElements: WorkspaceLimit.optional(),
13360
13466
  totalNumberOfWorkspaceDatabaseRecords: WorkspaceLimit.optional(),
13467
+ flowRunsQueueSizePerConnection: WorkspaceLimit.optional(),
13361
13468
  instantTasksQueueSize: WorkspaceLimit.optional(),
13362
13469
  QueuedTasksQueueSize: WorkspaceLimit.optional(),
13363
13470
  parallelApiRequestsPerCustomer: WorkspaceLimit.optional(),
@@ -13378,6 +13485,9 @@ const WorkspaceSettingsSchema = z.object({
13378
13485
  disableSecretKeyAuth: z.boolean().optional(),
13379
13486
  useMembraneUniverse: z.boolean().optional(),
13380
13487
  useRemoteRepository: z.boolean().optional(),
13488
+ autoGenerateIntegrationsFromConnectors: z.boolean().optional(),
13489
+ autoGenerateIntegrationsFromExternalApps: z.boolean().optional(),
13490
+ autoGenerateIntegrationsFromWebSearch: z.boolean().optional(),
13381
13491
  });
13382
13492
  const EngineWorkspaceSettingsSchema = WorkspaceSettingsSchema;
13383
13493
  const WorkspacePublicKey = z.object({
@@ -13464,6 +13574,13 @@ const ListWorkspacesQuery = z.z
13464
13574
  })
13465
13575
  .merge(IncludeArchivedQuery);
13466
13576
  const GetWorkspaceQuery = IncludeArchivedQuery;
13577
+ const MembraneCredentials = z.z.object({
13578
+ apiUri: z.z.string().describe('Uri for Membrane API'),
13579
+ workspaceKey: z.z.string().describe('Workspace key'),
13580
+ workspaceSecret: z.z.string().optional().describe('Workspace secret for signing tokens (never expose in browser code)'),
13581
+ tenantKey: z.z.string().optional().describe('Tenant key for the current test tenant'),
13582
+ notes: z.z.string().optional().describe('Usage notes'),
13583
+ });
13467
13584
 
13468
13585
  const PARALLEL_EXECUTION_LIMITS = [
13469
13586
  'parallelEventPulls',
@@ -13492,6 +13609,7 @@ const WORKSPACE_SIZE_LIMITS = [
13492
13609
  'totalNumberOfConnections',
13493
13610
  'totalNumberOfWorkspaceElements',
13494
13611
  'totalNumberOfWorkspaceDatabaseRecords',
13612
+ 'flowRunsQueueSizePerConnection',
13495
13613
  ];
13496
13614
  const EDITABLE_LIMITS = [
13497
13615
  'parallelApiRequestsPerCustomer',
@@ -13519,27 +13637,39 @@ function compareWorkspaceExports(baseExport, targetExport, options = { includeDe
13519
13637
  [exports.WorkspaceElementChangeType.UPDATE]: new Set(),
13520
13638
  [exports.WorkspaceElementChangeType.DELETE]: new Set(),
13521
13639
  };
13640
+ const baseUuidByTargetUuid = new Map();
13522
13641
  const diffs = [];
13523
13642
  const integrationMap = buildIntegrationsMap([
13524
13643
  ...(baseExport[exports.WorkspaceElementType.Integration] || []),
13525
13644
  ...(targetExport[exports.WorkspaceElementType.Integration] || []),
13526
13645
  ]);
13527
- const baseByUuid = new Map();
13528
- const targetByUuid = new Map();
13646
+ const baseMap = new Map();
13647
+ const targetMap = new Map();
13648
+ const allSelectors = new Set();
13529
13649
  const allElementTypes = new Set([...Object.keys(baseExport), ...Object.keys(targetExport)]);
13530
13650
  for (const elementType of allElementTypes) {
13531
13651
  const type = elementType;
13532
- for (const element of baseExport[type] || []) {
13533
- baseByUuid.set(element.uuid, { type, element });
13534
- }
13535
- for (const element of targetExport[type] || []) {
13536
- targetByUuid.set(element.uuid, { type, element });
13652
+ const baseElements = baseExport[type] || [];
13653
+ for (const element of baseElements) {
13654
+ const intIdentifier = getIntegrationIdentifier(element, integrationMap);
13655
+ const selector = getElementSelector(type, element.key, intIdentifier);
13656
+ baseMap.set(selector, { type, element });
13657
+ allSelectors.add(selector);
13658
+ }
13659
+ const targetElements = targetExport[type] || [];
13660
+ for (const element of targetElements) {
13661
+ const intIdentifier = getIntegrationIdentifier(element, integrationMap);
13662
+ const selector = getElementSelector(type, element.key, intIdentifier);
13663
+ targetMap.set(selector, { type, element });
13664
+ allSelectors.add(selector);
13665
+ }
13666
+ }
13667
+ for (const selector of allSelectors) {
13668
+ const base = baseMap.get(selector);
13669
+ const target = targetMap.get(selector);
13670
+ if (base && target && base.element.uuid !== target.element.uuid) {
13671
+ baseUuidByTargetUuid.set(target.element.uuid, base.element.uuid);
13537
13672
  }
13538
- }
13539
- const allUuids = new Set([...baseByUuid.keys(), ...targetByUuid.keys()]);
13540
- for (const uuid of allUuids) {
13541
- const base = baseByUuid.get(uuid);
13542
- const target = targetByUuid.get(uuid);
13543
13673
  const change = compareElementExports(base === null || base === void 0 ? void 0 : base.element, target === null || target === void 0 ? void 0 : target.element);
13544
13674
  if (options.includeDeletions === false && (change === null || change === void 0 ? void 0 : change.type) === exports.WorkspaceElementChangeType.DELETE) {
13545
13675
  continue;
@@ -13558,7 +13688,7 @@ function compareWorkspaceExports(baseExport, targetExport, options = { includeDe
13558
13688
  diffs.push(diff.createTwoFilesPatch(`a/${path}`, `b/${path}`, baseYaml, targetYaml));
13559
13689
  }
13560
13690
  }
13561
- const result = { comparison, changes };
13691
+ const result = { comparison, changes, baseUuidByTargetUuid };
13562
13692
  if (options.includeDiff) {
13563
13693
  result.diff = diffs.join('\n').trim();
13564
13694
  }
@@ -13595,6 +13725,12 @@ function getIntegrationIdentifier(element, integrationMap) {
13595
13725
  }
13596
13726
  return integrationIdentifier || element.integrationUuid || element.integrationId;
13597
13727
  }
13728
+ function getElementSelector(type, key, integrationIdentifier) {
13729
+ if (integrationIdentifier) {
13730
+ return `${type}:${key}:${integrationIdentifier}`;
13731
+ }
13732
+ return `${type}:${key}`;
13733
+ }
13598
13734
  function buildIntegrationsMap(integrations) {
13599
13735
  const map = new Map();
13600
13736
  for (const integration of integrations) {
@@ -13804,9 +13940,7 @@ const CreateOrgRequest = z.z.object({
13804
13940
  referralSource: z.z.string().optional(),
13805
13941
  builder: z.z.array(z.z.enum(['me', 'team'])).optional(),
13806
13942
  stripeCustomerId: z.z.string().optional(),
13807
- signupSource: z.z
13808
- .enum(['web', 'membrane-cli', 'claude', 'cursor', 'chatgpt', 'warp', 'lovable', 'openclaw', 'other'])
13809
- .optional(),
13943
+ signupSource: z.z.string().optional(),
13810
13944
  });
13811
13945
  const UpdateOrgRequest = z.z.object({
13812
13946
  name: z.z.string().min(1).optional(),
@@ -13906,6 +14040,7 @@ exports.WebhookTypeEnum = void 0;
13906
14040
  WebhookTypeEnum["SEND_ALERT_EMAIL"] = "send-alert-email";
13907
14041
  WebhookTypeEnum["PUBLIC_PACKAGE_ACTION_RUN_FAILED"] = "public-package-action-run-failed";
13908
14042
  WebhookTypeEnum["BETTER_AUTH_SIGNUP_VERIFY"] = "better-auth-signup-verify";
14043
+ WebhookTypeEnum["BETTER_AUTH_RESET_PASSWORD"] = "better-auth-reset-password";
13909
14044
  })(exports.WebhookTypeEnum || (exports.WebhookTypeEnum = {}));
13910
14045
 
13911
14046
  const IntegrationSpecificElementSelector = z.object({
@@ -14157,6 +14292,7 @@ class ActionAccessor extends ElementAccessor {
14157
14292
  ? {
14158
14293
  integrationKey: options.integrationKey,
14159
14294
  connectionId: options.connectionId,
14295
+ connectionKey: options.connectionKey,
14160
14296
  }
14161
14297
  : {};
14162
14298
  return this.options.client.post(this.getPath('run'), { input }, { params: queryParams });
@@ -15226,7 +15362,7 @@ class ConnectionProxy {
15226
15362
  }
15227
15363
  }
15228
15364
  async function createOrUpdateConnection(options) {
15229
- const { client, connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
15365
+ const { client, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
15230
15366
  let connectionType = await detectConnectionType(options);
15231
15367
  if (redirectUri) {
15232
15368
  connectionType = ConnectionType.REDIRECT;
@@ -15244,6 +15380,7 @@ async function createOrUpdateConnection(options) {
15244
15380
  connectorId,
15245
15381
  connectorVersion,
15246
15382
  connectionId,
15383
+ connectionKey,
15247
15384
  name,
15248
15385
  authOptionKey,
15249
15386
  allowMultipleConnections,
@@ -16038,6 +16175,8 @@ const MembraneInstance = z.z.object({
16038
16175
  lastReportedAt: z.z.coerce.date().optional(),
16039
16176
  activeTenants: z.z.number().optional(),
16040
16177
  billableTenants: z.z.number().optional(),
16178
+ });
16179
+ const membraneInstanceInfraFields = {
16041
16180
  clusterName: z.z.string().optional(),
16042
16181
  argoCdUrl: z.z.url().optional(),
16043
16182
  grafanaUrl: z.z.url().optional(),
@@ -16046,6 +16185,13 @@ const MembraneInstance = z.z.object({
16046
16185
  helmValuesPath: z.z.url().optional(),
16047
16186
  awsAccountName: z.z.string().optional(),
16048
16187
  awsSsoUrl: z.z.url().optional(),
16188
+ sentryConsoleProjectId: z.z.string().optional(),
16189
+ sentryApiProjectId: z.z.string().optional(),
16190
+ };
16191
+ const MembraneInstanceAdmin = MembraneInstance.extend({
16192
+ ...membraneInstanceInfraFields,
16193
+ orgName: z.z.string().optional(),
16194
+ workspaceCount: z.z.number().optional(),
16049
16195
  });
16050
16196
  const CreateMembraneInstanceRequest = z.z.object({
16051
16197
  name: z.z.string().min(1),
@@ -16067,16 +16213,14 @@ const UpdateMembraneInstanceRequest = z.z
16067
16213
  helmValuesPath: z.z.url().nullable().optional(),
16068
16214
  awsAccountName: z.z.string().nullable().optional(),
16069
16215
  awsSsoUrl: z.z.url().nullable().optional(),
16216
+ sentryConsoleProjectId: z.z.string().nullable().optional(),
16217
+ sentryApiProjectId: z.z.string().nullable().optional(),
16070
16218
  })
16071
16219
  .strict();
16072
16220
  const ListMembraneInstancesQuery = PaginationQuery.extend({
16073
16221
  orgId: z.z.string().optional(),
16074
16222
  });
16075
16223
  const ListMembraneInstancesResponse = createPaginationResponseSchema(MembraneInstance);
16076
- const MembraneInstanceAdmin = MembraneInstance.extend({
16077
- orgName: z.z.string().optional(),
16078
- workspaceCount: z.z.number().optional(),
16079
- });
16080
16224
 
16081
16225
  const OrgInstanceType = z.z.enum(['membrane-hosted', 'self-hosted']);
16082
16226
  const OrgInstanceWorkspace = z.z.object({
@@ -16152,6 +16296,9 @@ const membraneClientOptionsSchema = z.z
16152
16296
  apiUri: z.z.string().nullish(),
16153
16297
  uiUri: z.z.string().nullish(),
16154
16298
  accessToken: z.z.string().nullish(),
16299
+ workspaceKey: z.z.string().nullish(),
16300
+ workspaceSecret: z.z.string().nullish(),
16301
+ tenantKey: z.z.string().nullish(),
16155
16302
  })
16156
16303
  .strict();
16157
16304
  function validateClientOptions(options) {
@@ -16166,6 +16313,8 @@ function validateClientOptions(options) {
16166
16313
  }
16167
16314
  }
16168
16315
  const REFETCH_EXPIRATION_THRESHOLD = 10 * 1000;
16316
+ const TOKEN_TTL_SECONDS = 3600;
16317
+ const TOKEN_MINT_THRESHOLD_SECONDS = 60;
16169
16318
  function decodeToken(token) {
16170
16319
  if (token.startsWith('pat-')) {
16171
16320
  return null;
@@ -16180,11 +16329,25 @@ class MembraneApiClient {
16180
16329
  constructor(options = {}) {
16181
16330
  this.logs = [];
16182
16331
  validateClientOptions(options);
16183
- const { uiUri, apiUri, accessToken, token, fetchToken, fetchCredentials, credentials } = options;
16332
+ const { uiUri, apiUri, fetchCredentials, credentials } = options;
16184
16333
  this.apiUri = apiUri !== null && apiUri !== void 0 ? apiUri : DEFAULT_API_URI;
16185
16334
  this.uiUri = uiUri !== null && uiUri !== void 0 ? uiUri : DEFAULT_UI_URI;
16186
- this.token = token !== null && token !== void 0 ? token : accessToken;
16187
- this.fetchToken = fetchToken;
16335
+ if ('workspaceSecret' in options && options.workspaceSecret) {
16336
+ if (typeof window !== 'undefined') {
16337
+ throw new Error('MembraneClient: workspaceSecret must not be used in browser code. ' +
16338
+ 'The workspace secret is a server-side credential that would be exposed to end users if included in a browser bundle.');
16339
+ }
16340
+ this._workspaceKey = options.workspaceKey;
16341
+ this._workspaceSecret = options.workspaceSecret;
16342
+ this._tenantKey = options.tenantKey;
16343
+ }
16344
+ else {
16345
+ const token = 'token' in options ? options.token : undefined;
16346
+ const accessToken = 'accessToken' in options ? options.accessToken : undefined;
16347
+ const fetchToken = 'fetchToken' in options ? options.fetchToken : undefined;
16348
+ this.token = token !== null && token !== void 0 ? token : accessToken;
16349
+ this.fetchToken = fetchToken;
16350
+ }
16188
16351
  if (fetchCredentials) {
16189
16352
  void fetchCredentials().then((c) => this.setCredentials(c));
16190
16353
  }
@@ -16196,6 +16359,9 @@ class MembraneApiClient {
16196
16359
  return this.patch('/self', { credentials });
16197
16360
  }
16198
16361
  async getToken() {
16362
+ if (this._workspaceSecret) {
16363
+ return this.mintToken();
16364
+ }
16199
16365
  if (this.fetchToken) {
16200
16366
  if (!this.token) {
16201
16367
  this.token = await this.fetchToken();
@@ -16216,6 +16382,38 @@ class MembraneApiClient {
16216
16382
  decodeToken(this.token);
16217
16383
  return this.token;
16218
16384
  }
16385
+ async mintToken() {
16386
+ if (this.token) {
16387
+ const payload = decodeToken(this.token);
16388
+ if (payload === null || payload === void 0 ? void 0 : payload.exp) {
16389
+ const remainingSeconds = payload.exp - Math.floor(Date.now() / 1000);
16390
+ if (remainingSeconds > TOKEN_MINT_THRESHOLD_SECONDS) {
16391
+ return this.token;
16392
+ }
16393
+ }
16394
+ }
16395
+ const payload = {
16396
+ id: this._tenantKey,
16397
+ iss: this._workspaceKey,
16398
+ exp: Math.floor(Date.now() / 1000) + TOKEN_TTL_SECONDS,
16399
+ };
16400
+ const header = { alg: 'HS256', typ: 'JWT' };
16401
+ const encoder = new TextEncoder();
16402
+ const toB64Url = (bytes) => {
16403
+ let s = '';
16404
+ for (let i = 0; i < bytes.length; i++)
16405
+ s += String.fromCharCode(bytes[i]);
16406
+ return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
16407
+ };
16408
+ const headerB64 = toB64Url(encoder.encode(JSON.stringify(header)));
16409
+ const payloadB64 = toB64Url(encoder.encode(JSON.stringify(payload)));
16410
+ const input = `${headerB64}.${payloadB64}`;
16411
+ const key = await crypto.subtle.importKey('raw', encoder.encode(this._workspaceSecret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
16412
+ const signatureBuffer = await crypto.subtle.sign('HMAC', key, encoder.encode(input));
16413
+ const signature = toB64Url(new Uint8Array(signatureBuffer));
16414
+ this.token = `${input}.${signature}`;
16415
+ return this.token;
16416
+ }
16219
16417
  async get(uri, queryParams, options) {
16220
16418
  if (queryParams) {
16221
16419
  uri += `${uri.includes('?') ? '&' : '?'}${new URLSearchParams(omitBy(queryParams, isEmptyValue)).toString()}`;
@@ -16559,10 +16757,16 @@ injectFormulaCatalog(getFormula, isFormula, hasFormulas);
16559
16757
 
16560
16758
  exports.ACTIONS = ACTIONS;
16561
16759
  exports.AGENTIC_CONNECTION_REQUEST_SCREEN_PATH = AGENTIC_CONNECTION_REQUEST_SCREEN_PATH;
16760
+ exports.AIGatewaySupportedModelIdSchema = AIGatewaySupportedModelIdSchema;
16761
+ exports.AI_GATEWAY_PROVIDER_MODELS = AI_GATEWAY_PROVIDER_MODELS;
16762
+ exports.AI_GATEWAY_SUPPORTED_MODELS = AI_GATEWAY_SUPPORTED_MODELS;
16763
+ exports.AI_GATEWAY_SUPPORTED_MODEL_IDS = AI_GATEWAY_SUPPORTED_MODEL_IDS;
16562
16764
  exports.ALERT_DELIVERY_METHODS = ALERT_DELIVERY_METHODS;
16563
16765
  exports.ALERT_TYPE_CATEGORIES = ALERT_TYPE_CATEGORIES;
16564
16766
  exports.AccessDeniedError = AccessDeniedError;
16565
16767
  exports.AccountResponse = AccountResponse;
16768
+ exports.ActApiDispatch = ActApiDispatch;
16769
+ exports.ActRequest = ActRequest;
16566
16770
  exports.ActionAccessor = ActionAccessor;
16567
16771
  exports.ActionApiResponse = ActionApiResponse;
16568
16772
  exports.ActionDependency = ActionDependency;
@@ -16786,6 +16990,7 @@ exports.CustomerApiResponse = CustomerApiResponse;
16786
16990
  exports.CustomerSelector = CustomerSelector;
16787
16991
  exports.CustomersAccessor = CustomersAccessor;
16788
16992
  exports.DATA_RECORD_SCHEMA = DATA_RECORD_SCHEMA;
16993
+ exports.DEFAULT_AI_GATEWAY_MODEL_ID = DEFAULT_AI_GATEWAY_MODEL_ID;
16789
16994
  exports.DEFAULT_ALERT_DELIVERY_SETTINGS = DEFAULT_ALERT_DELIVERY_SETTINGS;
16790
16995
  exports.DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS = DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS;
16791
16996
  exports.DEFAULT_FULL_SYNC_INTERVAL_SECONDS = DEFAULT_FULL_SYNC_INTERVAL_SECONDS;
@@ -17012,6 +17217,7 @@ exports.IntegrationLevelFieldMappingsListAccessor = IntegrationLevelFieldMapping
17012
17217
  exports.IntegrationLevelFlowAccessor = IntegrationLevelFlowAccessor;
17013
17218
  exports.IntegrationLevelFlowsListAccessor = IntegrationLevelFlowsListAccessor;
17014
17219
  exports.IntegrationLevelMembraneInterfaceSelectorQuery = IntegrationLevelMembraneInterfaceSelectorQuery;
17220
+ exports.IntegrationListItem = IntegrationListItem;
17015
17221
  exports.IntegrationOptionConfig = IntegrationOptionConfig;
17016
17222
  exports.IntegrationOptions = IntegrationOptions;
17017
17223
  exports.IntegrationSpecificElementSelector = IntegrationSpecificElementSelector;
@@ -17048,6 +17254,7 @@ exports.MappingSchema = MappingSchema;
17048
17254
  exports.MembraneAgentKey = MembraneAgentKey;
17049
17255
  exports.MembraneAxiosInstance = axios;
17050
17256
  exports.MembraneClient = MembraneClient;
17257
+ exports.MembraneCredentials = MembraneCredentials;
17051
17258
  exports.MembraneElementLayer = MembraneElementLayer;
17052
17259
  exports.MembraneError = MembraneError;
17053
17260
  exports.MembraneInstance = MembraneInstance;
@@ -17227,6 +17434,7 @@ exports.getDownstreamNodeKeys = getDownstreamNodeKeys;
17227
17434
  exports.getEditablePathsForElementType = getEditablePathsForElementType;
17228
17435
  exports.getEditablePathsFromSchema = getEditablePathsFromSchema;
17229
17436
  exports.getEffectiveConnectorOption = getEffectiveConnectorOption;
17437
+ exports.getElementSelector = getElementSelector;
17230
17438
  exports.getErrorFromData = getErrorFromData;
17231
17439
  exports.getEventMethodFileKey = getEventMethodFileKey;
17232
17440
  exports.getFilterFieldMeta = getFilterFieldMeta;
@@ -17267,6 +17475,7 @@ exports.getWritableFieldsSchema = getWritableFieldsSchema;
17267
17475
  exports.hasCycles = hasCycles;
17268
17476
  exports.hasFormulas_internalDoNotUse = hasFormulas;
17269
17477
  exports.injectFormulaCatalog = injectFormulaCatalog;
17478
+ exports.isAIGatewaySupportedModelId = isAIGatewaySupportedModelId;
17270
17479
  exports.isBlob = isBlob;
17271
17480
  exports.isBusinessDay = isBusinessDay;
17272
17481
  exports.isDataActionType = isDataActionType;