@membranehq/sdk 0.15.6 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3497,36 +3497,78 @@ exports.WorkspaceElementDependencyType = void 0;
3497
3497
  WorkspaceElementDependencyType["Parent"] = "PARENT";
3498
3498
  })(exports.WorkspaceElementDependencyType || (exports.WorkspaceElementDependencyType = {}));
3499
3499
  const BaseWorkspaceElement = z.z.object({
3500
- id: z.z.string(),
3501
- name: z.z.string(),
3500
+ id: z.z.string().describe('Internal database ID of the element. Assigned by the API; unique per element.'),
3501
+ name: z.z.string().describe('Display name of the workspace element.'),
3502
3502
  });
3503
3503
  const BaseMembraneInterfaceEditableProperties = z.z.object({
3504
- uuid: z.z.string().optional(),
3505
- key: z.z.string().optional(),
3506
- name: z.z.string().optional(),
3507
- description: z.z.string().optional(),
3508
- meta: z.z.record(z.z.string(), z.z.any()).optional(),
3504
+ uuid: z.z
3505
+ .string()
3506
+ .optional()
3507
+ .describe('Stable unique identifier (UUID). Can be provided on create; otherwise generated. Must be unique across elements of this type.'),
3508
+ key: z.z
3509
+ .string()
3510
+ .optional()
3511
+ .describe('Stable key for referencing the element (e.g. in selectors). Unique per (parent, integration) scope. Generated from name if not provided on create.'),
3512
+ name: z.z.string().optional().describe('Display name. Optional on create; used to generate key when key is omitted.'),
3513
+ description: z.z.string().optional().describe('Optional human-readable description.'),
3514
+ meta: z.z.record(z.z.string(), z.z.any()).optional().describe('Optional key-value metadata.'),
3509
3515
  });
3510
3516
  const BaseMembraneInterfaceReadOnlyProperties = z.z.object({
3511
- name: z.z.string(),
3512
- state: z.z.enum(exports.WorkspaceElementState).optional(),
3513
- errors: z.z.array(ErrorDataSchema).optional(),
3514
- revision: z.z.string().optional(),
3515
- createdAt: z.z.string().optional(),
3516
- updatedAt: z.z.string().optional(),
3517
- archivedAt: z.z.string().optional(),
3518
- isDeactivated: z.z.boolean().optional(),
3519
- isReadOnly: z.z.boolean().optional(),
3517
+ name: z.z.string().describe('Display name. Always present in API responses (filled by API if not set on create).'),
3518
+ state: z.z
3519
+ .enum(exports.WorkspaceElementState)
3520
+ .optional()
3521
+ .describe('Current lifecycle or health state (e.g. READY, SETUP_FAILED, CONFIGURATION_ERROR). Set by the engine during setup and validation.'),
3522
+ errors: z.z.array(ErrorDataSchema).optional().describe('Validation or setup errors when state is not READY.'),
3523
+ revision: z.z
3524
+ .string()
3525
+ .optional()
3526
+ .describe('Opaque revision token; changes on each update. Used for optimistic concurrency.'),
3527
+ createdAt: z.z.string().optional().describe('ISO date when the element was created.'),
3528
+ updatedAt: z.z.string().optional().describe('ISO date when the element was last updated.'),
3529
+ archivedAt: z.z
3530
+ .string()
3531
+ .optional()
3532
+ .describe('When set, the element is archived (soft-deleted). Archived elements cannot be patched.'),
3533
+ isDeactivated: z.z
3534
+ .boolean()
3535
+ .optional()
3536
+ .describe('When true, setup is skipped and the element is treated as inactive (e.g. when dependencies are deactivated or the element is archived).'),
3537
+ isReadOnly: z.z
3538
+ .boolean()
3539
+ .optional()
3540
+ .describe('When true, the element cannot be modified (e.g. published package elements or elements from another workspace).'),
3520
3541
  });
3521
3542
  const BaseMembraneInterface = BaseWorkspaceElement.merge(BaseMembraneInterfaceEditableProperties).merge(BaseMembraneInterfaceReadOnlyProperties);
3522
3543
  const BaseIntegrationLevelMembraneInterfaceEditableProperties = BaseMembraneInterfaceEditableProperties.extend({
3523
- integrationId: z.z.string().optional(),
3524
- integrationUuid: z.z.string().optional(),
3525
- parentId: z.z.string().optional(),
3526
- parentUuid: z.z.string().optional(),
3527
- connectionId: z.z.string().optional(),
3528
- instanceKey: z.z.string().optional(),
3529
- isUniversal: z.z.boolean().optional(),
3544
+ integrationId: z.z
3545
+ .string()
3546
+ .optional()
3547
+ .describe('Internal ID of the integration this element belongs to. Omit for universal elements; set for integration-specific elements. Uniqueness of key is scoped per integration.'),
3548
+ integrationUuid: z.z
3549
+ .string()
3550
+ .optional()
3551
+ .describe('UUID of the integration; alternative to integrationId when creating from export. Resolved to integrationId by the API.'),
3552
+ parentId: z.z
3553
+ .string()
3554
+ .optional()
3555
+ .describe('Internal ID of the parent workspace element. Used for hierarchy (e.g. integration-level under universal). Child key uniqueness is scoped by parent and integration.'),
3556
+ parentUuid: z.z
3557
+ .string()
3558
+ .optional()
3559
+ .describe('UUID of the parent element; alternative to parentId when creating (e.g. from export). Resolved to parentId by the API.'),
3560
+ connectionId: z.z
3561
+ .string()
3562
+ .optional()
3563
+ .describe('Connection ID. Used when filtering by connection in list/selector queries, or when creating or identifying connection-level instances.'),
3564
+ instanceKey: z.z
3565
+ .string()
3566
+ .optional()
3567
+ .describe('Key identifying a specific connection-level instance when multiple instances exist per (element, connection). Used in selector queries and when creating instances.'),
3568
+ isUniversal: z.z
3569
+ .boolean()
3570
+ .optional()
3571
+ .describe('When true, the element is universal (shared across all integrations). Requires universal-element access. Omit or false for integration-specific elements.'),
3530
3572
  });
3531
3573
  const BaseIntegrationLevelMembraneInterfaceReadOnlyProperties = BaseMembraneInterfaceReadOnlyProperties.extend({
3532
3574
  isCustomized: z.z.boolean().optional(),
@@ -3822,24 +3864,52 @@ const ActionDependency = z.z.object({
3822
3864
  element: z.z.any().optional(),
3823
3865
  });
3824
3866
  const ActionSpecificProperties = z.z.object({
3825
- connectionId: z.z.string().optional(),
3826
- instanceKey: z.z.string().optional(),
3827
- inputSchema: DataSchema.optional(),
3828
- type: z.z.enum(exports.ActionType).optional(),
3829
- config: z.z.object({}).loose().optional(),
3830
- outputMapping: z.z.any().optional(),
3831
- customOutputSchema: DataSchema.optional(),
3867
+ connectionId: z.z
3868
+ .string()
3869
+ .optional()
3870
+ .describe('Connection ID for filtering or for connection-level instances. Same semantics as base integration-level property.'),
3871
+ instanceKey: z.z
3872
+ .string()
3873
+ .optional()
3874
+ .describe('Key for the connection-level instance when multiple exist per connection. Same semantics as base integration-level property.'),
3875
+ inputSchema: DataSchema.optional().describe('JSON Schema for the action input. Used by the action engine for template output schema, run-time variables, and output mapping.'),
3876
+ type: z.z
3877
+ .enum(exports.ActionType)
3878
+ .optional()
3879
+ .describe('Action type (e.g. ConnectorOperation, RunJavascript). Determines which handler runs and which config schema is used for validation.'),
3880
+ config: z.z
3881
+ .object({})
3882
+ .loose()
3883
+ .optional()
3884
+ .describe("Type-specific configuration object. Validated by the handler's config schema; passed to handler setup/run and getTemplateOutputSchema."),
3885
+ outputMapping: z.z
3886
+ .any()
3887
+ .optional()
3888
+ .describe("Mapping expression to transform the action's raw output. Evaluated with access to input, output, and user; used to compute transformed output schema and at run time."),
3889
+ customOutputSchema: DataSchema.optional().describe('Explicit output schema for the action. Takes precedence over the transformed or default output schema when resolving outputSchema.'),
3832
3890
  });
3833
- const ActionEditableProperties = BaseIntegrationLevelMembraneInterfaceEditableProperties.extend(ActionSpecificProperties.shape);
3891
+ const ActionEditableProperties = BaseIntegrationLevelMembraneInterfaceEditableProperties.extend(ActionSpecificProperties.shape).describe('Action editable properties: key, name, type, config, inputSchema, outputMapping, optional connectionId and instanceKey for connection-level instances.');
3834
3892
  const ActionExportProperties = BaseIntegrationLevelMembraneInterfaceExportProperties.extend(ActionSpecificProperties.shape).omit({
3835
3893
  connectionId: true,
3836
3894
  });
3837
3895
  const ActionReadOnlyProperties = BaseIntegrationLevelMembraneInterfaceReadOnlyProperties.extend({
3838
3896
  ...TenantLayerElement.partial().shape,
3839
- universalParentId: z.z.string().optional(),
3840
- outputSchema: z.z.any().optional(),
3841
- isPublic: z.z.boolean().optional(),
3842
- externalAppUuid: z.z.string().optional(),
3897
+ universalParentId: z.z
3898
+ .string()
3899
+ .optional()
3900
+ .describe('For connection-level instances: ID of the universal (root) action in the hierarchy. Set automatically when creating an instance; used in list/selector queries to filter by universal parent.'),
3901
+ outputSchema: z.z
3902
+ .any()
3903
+ .optional()
3904
+ .describe('Resolved output schema (cached after setup). Derived from customOutputSchema, transformed schema from outputMapping, default output schema, or parent custom output schema. Read-only.'),
3905
+ isPublic: z.z
3906
+ .boolean()
3907
+ .optional()
3908
+ .describe('When true, the element is publicly listed (e.g. in universe). Used for published packages; publish/unpublish updates this on published elements.'),
3909
+ externalAppUuid: z.z
3910
+ .string()
3911
+ .optional()
3912
+ .describe('UUID of the external app when this action is published in a package that has an external app. Populated in API responses for published actions.'),
3843
3913
  });
3844
3914
  const BaseAction = BaseMembraneInterface.merge(ActionEditableProperties).merge(ActionReadOnlyProperties);
3845
3915
  const BaseActionInstance = BaseAction;
@@ -10164,7 +10234,7 @@ const CreateConnectionRequest = ConnectionEditableProperties.extend({
10164
10234
  externalAppId: z.z.string().optional(),
10165
10235
  });
10166
10236
  const UpdateConnectionRequest = ConnectionEditableProperties;
10167
- const ConnectionExport = ConnectionEditableProperties.omit({
10237
+ const ConnectionExportProperties = ConnectionEditableProperties.omit({
10168
10238
  credentials: true,
10169
10239
  connectorParameters: true,
10170
10240
  input: true,
@@ -10244,7 +10314,9 @@ const ConnectPayload = z.z.object({
10244
10314
  redirectUri: z.z.string().optional(),
10245
10315
  customState: z.z.string().optional(),
10246
10316
  });
10247
- const ConnectUIOptions = ConnectPayload.omit({ input: true, redirectUri: true });
10317
+ const ConnectUIOptions = ConnectPayload.omit({ input: true, redirectUri: true }).extend({
10318
+ theme: z.z.enum(['light', 'dark', 'auto']).optional(),
10319
+ });
10248
10320
 
10249
10321
  const ListPublicConnectorsQuery = PaginationQuery.extend({
10250
10322
  search: z.z.string().optional(),
@@ -11249,6 +11321,11 @@ function hasCycles(nodes) {
11249
11321
  return hasCycles;
11250
11322
  }
11251
11323
 
11324
+ function getSchemaDescription(schema) {
11325
+ const json = z.z.toJSONSchema(schema);
11326
+ return json.description;
11327
+ }
11328
+
11252
11329
  function addUndefinedWriteableProperties(value, schema) {
11253
11330
  if (!(schema instanceof z.z.ZodObject)) {
11254
11331
  return value;
@@ -11457,6 +11534,7 @@ const WorkspaceElementSpecs = {
11457
11534
  apiPath: 'connections',
11458
11535
  name: 'Connection',
11459
11536
  namePlural: 'Connections',
11537
+ exportPropertiesSchema: ConnectionExportProperties,
11460
11538
  hasKey: false,
11461
11539
  hasUuid: false,
11462
11540
  },
@@ -11532,6 +11610,7 @@ const WorkspaceElementSpecs = {
11532
11610
  namePlural: 'Flows',
11533
11611
  parentFieldKey: 'flowId',
11534
11612
  universalParentFieldKey: 'universalFlowId',
11613
+ exportPropertiesSchema: FlowExportProperties,
11535
11614
  isMembraneInterface: true,
11536
11615
  isProOnly: true,
11537
11616
  },
@@ -14902,6 +14981,9 @@ class ExternalEventSubscriptionAccessor {
14902
14981
  async resubscribe() {
14903
14982
  await this.client.post(this.getPath('resubscribe'));
14904
14983
  }
14984
+ async refreshWebhook() {
14985
+ await this.client.post(this.getPath('refresh-webhook'));
14986
+ }
14905
14987
  async pullEvents() {
14906
14988
  await this.client.post(this.getPath('pull-events'));
14907
14989
  }
@@ -15051,6 +15133,31 @@ const AsyncRequestTriggerResponse = z.z.object({
15051
15133
  accessKey: z.z.string(),
15052
15134
  });
15053
15135
 
15136
+ const SelfHostingToken = z.z.object({
15137
+ id: z.z.string(),
15138
+ name: z.z.string(),
15139
+ orgId: z.z.string(),
15140
+ tokenPrefix: z.z.string(),
15141
+ createdAt: z.z.coerce.date(),
15142
+ updatedAt: z.z.coerce.date(),
15143
+ lastUsedAt: z.z.coerce.date().optional(),
15144
+ });
15145
+ const CreateSelfHostingTokenRequest = z.z.object({
15146
+ name: z.z.string().min(1).max(100),
15147
+ });
15148
+ const CreateSelfHostingTokenResponse = SelfHostingToken.extend({
15149
+ token: z.z.string(),
15150
+ });
15151
+ const UpdateSelfHostingTokenRequest = z.z.object({
15152
+ name: z.z.string().min(1).max(100),
15153
+ });
15154
+ const ValidateSelfHostingTokenRequest = z.z.object({});
15155
+ const ValidateSelfHostingTokenResponse = z.z.object({
15156
+ valid: z.z.boolean(),
15157
+ orgId: z.z.string().optional(),
15158
+ orgName: z.z.string().optional(),
15159
+ });
15160
+
15054
15161
  const CONSOLE_ACCOUNT_API_TOKEN_PATH = 'settings/account/api-token';
15055
15162
 
15056
15163
  class UI {
@@ -15113,7 +15220,7 @@ function decodeJWT(token) {
15113
15220
  const axiosGlobal = ((axiosOriginal === null || axiosOriginal === void 0 ? void 0 : axiosOriginal.default) || axiosOriginal);
15114
15221
  const axios = axiosGlobal.create();
15115
15222
  const DEFAULT_API_URI = 'https://api.getmembrane.com';
15116
- const DEFAULT_UI_URI = 'https://console.getmembrane.com';
15223
+ const DEFAULT_UI_URI = 'https://ui.getmembrane.com';
15117
15224
  const membraneClientOptionsSchema = z.z
15118
15225
  .object({
15119
15226
  token: z.z.string().nullish(),
@@ -15603,7 +15710,7 @@ exports.ConnectionApiResponseWithSecrets = ConnectionApiResponseWithSecrets;
15603
15710
  exports.ConnectionDataCollectionAccessor = ConnectionDataCollectionAccessor;
15604
15711
  exports.ConnectionEditableProperties = ConnectionEditableProperties;
15605
15712
  exports.ConnectionError = ConnectionError;
15606
- exports.ConnectionExport = ConnectionExport;
15713
+ exports.ConnectionExportProperties = ConnectionExportProperties;
15607
15714
  exports.ConnectionLevelActionAccessor = ConnectionLevelActionAccessor;
15608
15715
  exports.ConnectionLevelActionsAccessor = ConnectionLevelActionsAccessor;
15609
15716
  exports.ConnectionLevelDataSourceAccessor = ConnectionLevelDataSourceAccessor;
@@ -15681,6 +15788,8 @@ exports.CreateOrgRequest = CreateOrgRequest;
15681
15788
  exports.CreateOrgUserRequest = CreateOrgUserRequest;
15682
15789
  exports.CreatePackageRequest = CreatePackageRequest;
15683
15790
  exports.CreateScreenRequest = CreateScreenRequest;
15791
+ exports.CreateSelfHostingTokenRequest = CreateSelfHostingTokenRequest;
15792
+ exports.CreateSelfHostingTokenResponse = CreateSelfHostingTokenResponse;
15684
15793
  exports.CustomCodeError = CustomCodeError;
15685
15794
  exports.CustomerAccessor = CustomerAccessor;
15686
15795
  exports.CustomerApiResponse = CustomerApiResponse;
@@ -15966,6 +16075,7 @@ exports.ScreenSelector = ScreenSelector;
15966
16075
  exports.ScreensAccessor = ScreensAccessor;
15967
16076
  exports.SearchQuery = SearchQuery;
15968
16077
  exports.SelfAccessor = SelfAccessor;
16078
+ exports.SelfHostingToken = SelfHostingToken;
15969
16079
  exports.StatsFilterQuery = StatsFilterQuery;
15970
16080
  exports.TenantLayerElement = TenantLayerElement;
15971
16081
  exports.UNIFIED_DATA_MODELS = UNIFIED_DATA_MODELS;
@@ -15987,9 +16097,12 @@ exports.UpdateOrgRequest = UpdateOrgRequest;
15987
16097
  exports.UpdateOrgUserRequest = UpdateOrgUserRequest;
15988
16098
  exports.UpdatePackageRequest = UpdatePackageRequest;
15989
16099
  exports.UpdateScreenRequest = UpdateScreenRequest;
16100
+ exports.UpdateSelfHostingTokenRequest = UpdateSelfHostingTokenRequest;
15990
16101
  exports.UpstreamFlowNodeRunSchema = UpstreamFlowNodeRunSchema;
15991
16102
  exports.UserAccessor = UserAccessor;
15992
16103
  exports.UsersAccessor = UsersAccessor;
16104
+ exports.ValidateSelfHostingTokenRequest = ValidateSelfHostingTokenRequest;
16105
+ exports.ValidateSelfHostingTokenResponse = ValidateSelfHostingTokenResponse;
15993
16106
  exports.WORKSPACE_ELEMENTS_STATS_COLLECTIONS = WORKSPACE_ELEMENTS_STATS_COLLECTIONS;
15994
16107
  exports.WORKSPACE_SIZE_LIMITS = WORKSPACE_SIZE_LIMITS;
15995
16108
  exports.Workspace = Workspace;
@@ -16084,6 +16197,7 @@ exports.getReferenceCollectionPointerForSchema = getReferenceCollectionPointerFo
16084
16197
  exports.getRequiredFieldsFromSchema = getRequiredFieldsFromSchema;
16085
16198
  exports.getRootNodeKeys = getRootNodeKeys;
16086
16199
  exports.getSchemaByLocator = getSchemaByLocator;
16200
+ exports.getSchemaDescription = getSchemaDescription;
16087
16201
  exports.getSchemaFromValue = getSchemaFromValue;
16088
16202
  exports.getUpstreamNodeKeys = getUpstreamNodeKeys;
16089
16203
  exports.getValueAtLocator = getValueAtLocator;