@workos-inc/node 12.0.0 → 12.1.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.
@@ -2021,12 +2021,19 @@ const deserializeResourceExportEvent = (data) => ({
2021
2021
  const deserializePipesConnectedAccount = (connectedAccount) => ({
2022
2022
  object: connectedAccount.object,
2023
2023
  id: connectedAccount.id,
2024
+ ...connectedAccount.connection_role !== void 0 && { connectionRole: connectedAccount.connection_role },
2025
+ ...connectedAccount.account_identifier !== void 0 && { accountIdentifier: connectedAccount.account_identifier },
2026
+ ...connectedAccount.account_display_name !== void 0 && { accountDisplayName: connectedAccount.account_display_name },
2024
2027
  dataIntegrationId: connectedAccount.data_integration_id,
2025
2028
  providerSlug: connectedAccount.provider_slug,
2026
2029
  userId: connectedAccount.user_id,
2027
2030
  organizationId: connectedAccount.organization_id,
2028
2031
  scopes: connectedAccount.scopes,
2032
+ ...connectedAccount.auth_method !== void 0 && { authMethod: connectedAccount.auth_method },
2033
+ ...connectedAccount.api_key_last_4 !== void 0 && { apiKeyLast4: connectedAccount.api_key_last_4 },
2029
2034
  state: connectedAccount.state,
2035
+ ...connectedAccount.established_by_user_id !== void 0 && { establishedByUserId: connectedAccount.established_by_user_id },
2036
+ ...connectedAccount.state_reason !== void 0 && { stateReason: connectedAccount.state_reason },
2030
2037
  createdAt: new Date(connectedAccount.created_at),
2031
2038
  updatedAt: new Date(connectedAccount.updated_at)
2032
2039
  });
@@ -4127,6 +4134,12 @@ const deserializeDataIntegration = (response) => ({
4127
4134
  updatedAt: new Date(response.updated_at)
4128
4135
  });
4129
4136
  //#endregion
4137
+ //#region src/pipes/serializers/connected-account-warning.serializer.ts
4138
+ const deserializeConnectedAccountWarning = (response) => ({
4139
+ code: response.code,
4140
+ message: response.message
4141
+ });
4142
+ //#endregion
4130
4143
  //#region src/pipes/serializers/connected-account.serializer.ts
4131
4144
  const deserializeConnectedAccount = (response) => ({
4132
4145
  object: response.object,
@@ -4143,12 +4156,21 @@ const deserializeConnectedAccount = (response) => ({
4143
4156
  clientSecretLast4: response.client_secret_last_4 ?? null,
4144
4157
  config: response.config,
4145
4158
  state: response.state,
4159
+ establishedByUserId: response.established_by_user_id ?? null,
4160
+ stateReason: response.state_reason ?? null,
4146
4161
  createdAt: new Date(response.created_at),
4147
- updatedAt: new Date(response.updated_at)
4162
+ updatedAt: new Date(response.updated_at),
4163
+ warnings: response.warnings != null ? response.warnings.map(deserializeConnectedAccountWarning) : void 0
4148
4164
  });
4149
4165
  //#endregion
4166
+ //#region src/pipes/serializers/data-integration-finish-connection-response.serializer.ts
4167
+ const deserializeDataIntegrationFinishConnectionResponse = (response) => ({ connectedAccount: deserializeConnectedAccount(response.connected_account) });
4168
+ //#endregion
4150
4169
  //#region src/pipes/serializers/data-integration-authorize-url-response.serializer.ts
4151
- const deserializeDataIntegrationAuthorizeUrlResponse = (response) => ({ url: response.url });
4170
+ const deserializeDataIntegrationAuthorizeUrlResponse = (response) => ({
4171
+ url: response.url,
4172
+ completion: response.completion
4173
+ });
4152
4174
  //#endregion
4153
4175
  //#region src/pipes/serializers/data-integration-vended-credential.serializer.ts
4154
4176
  const deserializeDataIntegrationVendedCredential = (response) => {
@@ -4160,6 +4182,7 @@ const deserializeDataIntegrationVendedCredential = (response) => {
4160
4182
  expiresAt: response.expires_at != null ? new Date(response.expires_at) : null,
4161
4183
  scopes: response.scopes,
4162
4184
  missingScopes: response.missing_scopes,
4185
+ metadata: response.metadata,
4163
4186
  config: response.config
4164
4187
  };
4165
4188
  case "api_key": return {
@@ -4217,7 +4240,7 @@ const deserializeDataIntegrationAccessTokenResponse = (response) => {
4217
4240
  active: false,
4218
4241
  error: response.error
4219
4242
  };
4220
- default: throw new Error(`Unknown active: ${String(response.active)}`);
4243
+ default: throw new Error("Unknown active: " + String(response.active));
4221
4244
  }
4222
4245
  };
4223
4246
  //#endregion
@@ -4237,8 +4260,11 @@ const deserializeDataIntegrationsListResponseDataConnectedAccount = (response) =
4237
4260
  clientSecretLast4: response.client_secret_last_4 ?? null,
4238
4261
  config: response.config,
4239
4262
  state: response.state,
4263
+ establishedByUserId: response.established_by_user_id ?? null,
4264
+ stateReason: response.state_reason ?? null,
4240
4265
  createdAt: new Date(response.created_at),
4241
4266
  updatedAt: new Date(response.updated_at),
4267
+ warnings: response.warnings != null ? response.warnings.map(deserializeConnectedAccountWarning) : void 0,
4242
4268
  userlandUserId: response.userland_user_id ?? null
4243
4269
  });
4244
4270
  //#endregion
@@ -4300,55 +4326,21 @@ const serializeCustomProviderDefinition = (model) => ({
4300
4326
  const serializeCreateDataIntegration = (model) => ({
4301
4327
  provider: model.provider,
4302
4328
  ownership: model.ownership,
4303
- auth_methods: model.authMethods,
4304
- config: model.config,
4305
- api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4306
4329
  description: model.description,
4307
4330
  enabled: model.enabled,
4308
4331
  scopes: model.scopes,
4332
+ auth_methods: model.authMethods,
4333
+ config: model.config,
4309
4334
  credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
4335
+ api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4310
4336
  custom_provider: model.customProvider != null ? serializeCustomProviderDefinition(model.customProvider) : void 0
4311
4337
  });
4312
4338
  //#endregion
4313
- //#region src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
4314
- const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
4315
- user_id: model.userId,
4316
- organization_id: model.organizationId,
4317
- connection_owner: model.connectionOwner,
4318
- secret: model.secret,
4319
- connection_intent: model.connectionIntent
4320
- });
4321
- //#endregion
4322
- //#region src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
4323
- const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model) => ({
4324
- user_id: model.userId,
4325
- organization_id: model.organizationId,
4326
- connection_owner: model.connectionOwner,
4327
- client_id: model.clientId,
4328
- client_secret: model.clientSecret,
4329
- config: model.config,
4330
- connection_intent: model.connectionIntent
4331
- });
4332
- //#endregion
4333
- //#region src/pipes/serializers/create-connected-account.serializer.ts
4334
- const serializeCreateConnectedAccount = (model) => ({
4335
- access_token: model.accessToken,
4336
- refresh_token: model.refreshToken,
4337
- expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
4338
- scopes: model.scopes,
4339
- state: model.state,
4340
- connection_intent: model.connectionIntent
4341
- });
4342
- //#endregion
4343
- //#region src/pipes/serializers/create-organization-connected-account.serializer.ts
4344
- const serializeCreateOrganizationConnectedAccount = (model) => ({
4345
- access_token: model.accessToken,
4346
- refresh_token: model.refreshToken,
4347
- expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
4348
- scopes: model.scopes,
4349
- state: model.state,
4350
- user_id: model.userId,
4351
- connection_intent: model.connectionIntent
4339
+ //#region src/pipes/serializers/data-integrations-finish-connection-request.serializer.ts
4340
+ const serializeDataIntegrationsFinishConnectionRequest = (model) => ({
4341
+ connect_code: model.connectCode,
4342
+ code_verifier: model.codeVerifier,
4343
+ state: model.state
4352
4344
  });
4353
4345
  //#endregion
4354
4346
  //#region src/pipes/serializers/update-custom-provider-definition.serializer.ts
@@ -4371,40 +4363,47 @@ const serializeUpdateDataIntegration = (model) => ({
4371
4363
  description: model.description,
4372
4364
  enabled: model.enabled,
4373
4365
  scopes: model.scopes,
4374
- api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4375
4366
  credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
4367
+ api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4376
4368
  custom_provider: model.customProvider != null ? serializeUpdateCustomProviderDefinition(model.customProvider) : void 0
4377
4369
  });
4378
4370
  //#endregion
4379
- //#region src/pipes/serializers/data-integrations-upsert-api-key-request.serializer.ts
4380
- const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
4371
+ //#region src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
4372
+ const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
4373
+ account_display_name: model.accountDisplayName,
4374
+ account_identifier: model.accountIdentifier,
4381
4375
  user_id: model.userId,
4382
4376
  organization_id: model.organizationId,
4383
- connected_account_id: model.connectedAccountId,
4384
- connection_intent: model.connectionIntent,
4385
4377
  connection_owner: model.connectionOwner,
4386
- secret: model.secret
4378
+ secret: model.secret,
4379
+ connection_intent: model.connectionIntent
4387
4380
  });
4388
4381
  //#endregion
4389
4382
  //#region src/pipes/serializers/data-integrations-get-data-integration-authorize-url-request.serializer.ts
4390
4383
  const serializeDataIntegrationsGetDataIntegrationAuthorizeUrlRequest = (model) => ({
4384
+ account_display_name: model.accountDisplayName,
4391
4385
  user_id: model.userId,
4392
4386
  organization_id: model.organizationId,
4393
4387
  connection_owner: model.connectionOwner,
4394
4388
  return_to: model.returnTo,
4395
- config: model.config
4389
+ code_challenge: model.codeChallenge,
4390
+ code_challenge_method: model.codeChallengeMethod,
4391
+ config: model.config,
4392
+ connection_intent: model.connectionIntent,
4393
+ connected_account_id: model.connectedAccountId
4396
4394
  });
4397
4395
  //#endregion
4398
- //#region src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
4399
- const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
4396
+ //#region src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
4397
+ const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model) => ({
4398
+ account_display_name: model.accountDisplayName,
4399
+ account_identifier: model.accountIdentifier,
4400
4400
  user_id: model.userId,
4401
4401
  organization_id: model.organizationId,
4402
- connected_account_id: model.connectedAccountId,
4403
- connection_intent: model.connectionIntent,
4404
4402
  connection_owner: model.connectionOwner,
4405
4403
  client_id: model.clientId,
4406
4404
  client_secret: model.clientSecret,
4407
- config: model.config
4405
+ config: model.config,
4406
+ connection_intent: model.connectionIntent
4408
4407
  });
4409
4408
  //#endregion
4410
4409
  //#region src/pipes/serializers/data-integrations-vend-credentials-request.serializer.ts
@@ -4425,8 +4424,23 @@ const serializeDataIntegrationsGetUserTokenRequest = (model) => ({
4425
4424
  supports_multiple_connections: model.supportsMultipleConnections
4426
4425
  });
4427
4426
  //#endregion
4427
+ //#region src/pipes/serializers/create-organization-connected-account.serializer.ts
4428
+ const serializeCreateOrganizationConnectedAccount = (model) => ({
4429
+ account_display_name: model.accountDisplayName,
4430
+ account_identifier: model.accountIdentifier,
4431
+ access_token: model.accessToken,
4432
+ refresh_token: model.refreshToken,
4433
+ expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
4434
+ scopes: model.scopes,
4435
+ state: model.state,
4436
+ user_id: model.userId,
4437
+ connection_intent: model.connectionIntent
4438
+ });
4439
+ //#endregion
4428
4440
  //#region src/pipes/serializers/organization-connected-account.serializer.ts
4429
4441
  const serializeOrganizationConnectedAccount = (model) => ({
4442
+ account_display_name: model.accountDisplayName,
4443
+ account_identifier: model.accountIdentifier,
4430
4444
  access_token: model.accessToken,
4431
4445
  refresh_token: model.refreshToken,
4432
4446
  expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
@@ -4435,8 +4449,22 @@ const serializeOrganizationConnectedAccount = (model) => ({
4435
4449
  user_id: model.userId
4436
4450
  });
4437
4451
  //#endregion
4452
+ //#region src/pipes/serializers/create-connected-account.serializer.ts
4453
+ const serializeCreateConnectedAccount = (model) => ({
4454
+ account_display_name: model.accountDisplayName,
4455
+ account_identifier: model.accountIdentifier,
4456
+ access_token: model.accessToken,
4457
+ refresh_token: model.refreshToken,
4458
+ expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
4459
+ scopes: model.scopes,
4460
+ state: model.state,
4461
+ connection_intent: model.connectionIntent
4462
+ });
4463
+ //#endregion
4438
4464
  //#region src/pipes/serializers/connected-account-input.serializer.ts
4439
4465
  const serializeConnectedAccountInput = (model) => ({
4466
+ account_display_name: model.accountDisplayName,
4467
+ account_identifier: model.accountIdentifier,
4440
4468
  access_token: model.accessToken,
4441
4469
  refresh_token: model.refreshToken,
4442
4470
  expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
@@ -4444,6 +4472,32 @@ const serializeConnectedAccountInput = (model) => ({
4444
4472
  state: model.state
4445
4473
  });
4446
4474
  //#endregion
4475
+ //#region src/pipes/serializers/data-integrations-upsert-api-key-request.serializer.ts
4476
+ const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
4477
+ account_display_name: model.accountDisplayName,
4478
+ account_identifier: model.accountIdentifier,
4479
+ user_id: model.userId,
4480
+ organization_id: model.organizationId,
4481
+ connected_account_id: model.connectedAccountId,
4482
+ connection_intent: model.connectionIntent,
4483
+ connection_owner: model.connectionOwner,
4484
+ secret: model.secret
4485
+ });
4486
+ //#endregion
4487
+ //#region src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
4488
+ const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
4489
+ account_display_name: model.accountDisplayName,
4490
+ account_identifier: model.accountIdentifier,
4491
+ user_id: model.userId,
4492
+ organization_id: model.organizationId,
4493
+ connected_account_id: model.connectedAccountId,
4494
+ connection_intent: model.connectionIntent,
4495
+ connection_owner: model.connectionOwner,
4496
+ client_id: model.clientId,
4497
+ client_secret: model.clientSecret,
4498
+ config: model.config
4499
+ });
4500
+ //#endregion
4447
4501
  //#region src/pipes/pipes.ts
4448
4502
  var Pipes = class {
4449
4503
  workos;
@@ -4451,6 +4505,111 @@ var Pipes = class {
4451
4505
  this.workos = workos;
4452
4506
  }
4453
4507
  /**
4508
+ * Upsert an API key for a connected account
4509
+ *
4510
+ * Creates or updates an API-key-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored API key is rotated to the new value.
4511
+ * @param options - Object containing userId, secret.
4512
+ * @param options.slug - The identifier of the integration.
4513
+ * @example "github"
4514
+ * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
4515
+ * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4516
+ * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
4517
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4518
+ * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to rotate a specific existing connection.
4519
+ * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4520
+ * @param options.connectionOwner - Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
4521
+ * @example "user"
4522
+ * @param options.secret - The API key secret to store for this integration.
4523
+ * @example "sk-1234567890abcdef"
4524
+ * @returns {Promise<ConnectedAccount>}
4525
+ * @throws {BadRequestException} 400
4526
+ * @throws {UnauthorizedException} 401
4527
+ * @throws {AuthorizationException} 403
4528
+ * @throws {NotFoundException} 404
4529
+ * @throws {ConflictException} 409
4530
+ * @throws {UnprocessableEntityException} 422
4531
+ */
4532
+ async updateDataIntegrationApiKey(options) {
4533
+ const { slug, ...payload } = options;
4534
+ const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsUpsertApiKeyRequest(payload));
4535
+ return deserializeConnectedAccount(data);
4536
+ }
4537
+ /**
4538
+ * Upsert client credentials for a connected account
4539
+ *
4540
+ * Creates or updates a client-credentials-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored client credentials are rotated to the new values.
4541
+ * @param options - The request options.
4542
+ * @param options.slug - The identifier of the integration.
4543
+ * @example "salesforce"
4544
+ * @returns {Promise<ConnectedAccount>}
4545
+ * @throws {BadRequestException} 400
4546
+ * @throws {UnauthorizedException} 401
4547
+ * @throws {AuthorizationException} 403
4548
+ * @throws {NotFoundException} 404
4549
+ * @throws {ConflictException} 409
4550
+ * @throws {UnprocessableEntityException} 422
4551
+ */
4552
+ async updateDataIntegrationClientCredentials(options) {
4553
+ const { slug, ...payload } = options;
4554
+ const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsUpsertClientCredentialsRequest(payload));
4555
+ return deserializeConnectedAccount(data);
4556
+ }
4557
+ /**
4558
+ * Delete an organization connected account
4559
+ *
4560
+ * Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side.
4561
+ * @param options - Additional query options.
4562
+ * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
4563
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4564
+ * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4565
+ * @example "github"
4566
+ * @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
4567
+ * @example true
4568
+ * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
4569
+ * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4570
+ * @returns {Promise<void>}
4571
+ * @throws {BadRequestException} 400
4572
+ * @throws {UnauthorizedException} 401
4573
+ * @throws {NotFoundException} 404
4574
+ * @throws {ConflictException} 409
4575
+ */
4576
+ async deleteOrganizationConnectedAccount(options) {
4577
+ const { organizationId, slug } = options;
4578
+ await this.workos.delete(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, {
4579
+ supports_multiple_connections: options.supportsMultipleConnections,
4580
+ connected_account_id: options.connectedAccountId
4581
+ });
4582
+ }
4583
+ /**
4584
+ * Delete a connected account
4585
+ *
4586
+ * Disconnects WorkOS's account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect. Access is not revoked on the provider side, except for the WorkOS OAuth provider, whose underlying AuthKit grant is revoked.
4587
+ * @param options - Additional query options.
4588
+ * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
4589
+ * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4590
+ * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4591
+ * @example "github"
4592
+ * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
4593
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4594
+ * @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
4595
+ * @example true
4596
+ * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
4597
+ * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4598
+ * @returns {Promise<void>}
4599
+ * @throws {BadRequestException} 400
4600
+ * @throws {UnauthorizedException} 401
4601
+ * @throws {NotFoundException} 404
4602
+ * @throws {ConflictException} 409
4603
+ */
4604
+ async deleteUserConnectedAccount(options) {
4605
+ const { userId, slug } = options;
4606
+ await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
4607
+ organization_id: options.organizationId,
4608
+ supports_multiple_connections: options.supportsMultipleConnections,
4609
+ connected_account_id: options.connectedAccountId
4610
+ });
4611
+ }
4612
+ /**
4454
4613
  * List data integrations
4455
4614
  *
4456
4615
  * Lists the environment's data integrations configured with `custom` or `organization` credentials, including custom providers and API key integrations. Both user-owned and organization-owned roots are returned, each as its own row with an `ownership`; filter with `ownership` to return only one kind.
@@ -4500,6 +4659,20 @@ var Pipes = class {
4500
4659
  return deserializeDataIntegration(data);
4501
4660
  }
4502
4661
  /**
4662
+ * Finish connection
4663
+ *
4664
+ * Saves a connection that was started with `code_challenge`. After the user authorizes, WorkOS redirects them to `return_to` with a `connect_code` and `state`. Call this endpoint from your server with that `connect_code` and the `code_verifier` behind the challenge to save the connected account.
4665
+ * @returns {Promise<DataIntegrationFinishConnectionResponse>}
4666
+ * @throws {BadRequestException} 400
4667
+ * @throws {UnauthorizedException} 401
4668
+ * @throws {AuthorizationException} 403
4669
+ */
4670
+ async finishConnection(options) {
4671
+ const payload = options;
4672
+ const { data } = await this.workos.post("/data-integrations/finish", serializeDataIntegrationsFinishConnectionRequest(payload));
4673
+ return deserializeDataIntegrationFinishConnectionResponse(data);
4674
+ }
4675
+ /**
4503
4676
  * Get a data integration
4504
4677
  *
4505
4678
  * Retrieves the user-owned data integration by its slug.
@@ -4562,45 +4735,34 @@ var Pipes = class {
4562
4735
  /**
4563
4736
  * Create another API key connected account
4564
4737
  *
4565
- * Requires `connectionIntent: 'add'` and does not accept an account selector.
4566
- * Until additional connections are available, this creates the first connection
4567
- * or returns 404 `multiple_connections_unavailable` if one already exists.
4568
- * Use `updateDataIntegrationApiKey` to rotate the compatibility connection or
4569
- * update an exact connection.
4570
- */
4571
- async createDataIntegrationApiKey(options) {
4572
- const { slug, ...payload } = options;
4573
- const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsCreateApiKeyConnectionRequest(payload));
4574
- return deserializeConnectedAccount(data);
4575
- }
4576
- /**
4577
- * Upsert an API key for a connected account
4578
- *
4579
- * Creates or updates an API-key-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored API key is rotated to the new value.
4580
- * @param options - Object containing userId, secret.
4738
+ * Creates another API key-based connected account for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. Requires `connection_intent: add` and does not accept `connected_account_id`; use PUT to create or rotate the compatibility connection or to update an exact connection.
4739
+ * @param options - Object containing userId, secret, connectionIntent.
4581
4740
  * @param options.slug - The identifier of the integration.
4582
4741
  * @example "github"
4742
+ * @param options.accountDisplayName - A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
4743
+ * @example "Acme production"
4744
+ * @param options.accountIdentifier - A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
4745
+ * @example "workspace_123"
4583
4746
  * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
4584
4747
  * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4585
4748
  * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
4586
4749
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4587
- * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to rotate a specific existing connection.
4588
- * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4589
4750
  * @param options.connectionOwner - Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
4590
4751
  * @example "user"
4591
4752
  * @param options.secret - The API key secret to store for this integration.
4592
4753
  * @example "sk-1234567890abcdef"
4754
+ * @param options.connectionIntent - Must be `add`: this endpoint only creates another connection. The first connection for an owner shape fills the compatibility slot; later connections are standard.
4755
+ * @example "add"
4593
4756
  * @returns {Promise<ConnectedAccount>}
4594
4757
  * @throws {BadRequestException} 400
4595
4758
  * @throws {UnauthorizedException} 401
4596
4759
  * @throws {AuthorizationException} 403
4597
4760
  * @throws {NotFoundException} 404
4598
4761
  * @throws {ConflictException} 409
4599
- * @throws {UnprocessableEntityException} 422
4600
4762
  */
4601
- async updateDataIntegrationApiKey(options) {
4763
+ async createDataIntegrationApiKey(options) {
4602
4764
  const { slug, ...payload } = options;
4603
- const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsUpsertApiKeyRequest(payload));
4765
+ const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsCreateApiKeyConnectionRequest(payload));
4604
4766
  return deserializeConnectedAccount(data);
4605
4767
  }
4606
4768
  /**
@@ -4610,21 +4772,33 @@ var Pipes = class {
4610
4772
  * @param options - Object containing userId.
4611
4773
  * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4612
4774
  * @example "github"
4775
+ * @param options.accountDisplayName - A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
4776
+ * @example "Acme production"
4613
4777
  * @param options.userId - The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account.
4614
4778
  * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4615
4779
  * @param options.organizationId - An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`.
4616
4780
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4617
4781
  * @param options.connectionOwner - Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`.
4618
4782
  * @example "user"
4619
- * @param options.returnTo - The URL to redirect the user to after authorization.
4783
+ * @param options.returnTo - The URL to redirect the user to after authorization. Required with `code_challenge`, and must then exactly match a redirect URI registered on one of the environment's applications. Loopback URLs match on any port; wildcard redirect URIs are not honored, and a `return_to` with a query string or fragment never matches.
4620
4784
  * @example "https://example.com/callback"
4785
+ * @param options.codeChallenge - A PKCE-style code challenge: the base64url-encoded SHA-256 of a `code_verifier` your app keeps. When set, the connection isn't saved when the user finishes authorizing. Instead, the user is redirected to `return_to` with a `connect_code` and `state`, and your app must call [Finish connection](https://workos.com/docs/reference/pipes/connected-account/finish-connection) with the `connect_code` and `code_verifier` within 90 seconds to save it.
4786
+ * @example "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
4787
+ * @param options.codeChallengeMethod - The method used to derive `code_challenge`. Only `S256` is supported, and it is the default. Requires `code_challenge`.
4788
+ * @example "S256"
4621
4789
  * @param options.config - Connect-time config values for the provider-declared `installation`-scope fields (e.g. a Zendesk `subdomain`), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration.
4622
4790
  * @example {"subdomain":"acme"}
4791
+ * @param options.connectionIntent - Which connection the request targets. Omit it to use the compatibility connection. Send `add` to create another connection: the first connection for an owner shape fills the compatibility slot, and later connections are standard. Send `reauthorize` with `connected_account_id` to reauthorize one exact connection.
4792
+ * @example "add"
4793
+ * @param options.connectedAccountId - The exact connected account to reauthorize. Required with `connection_intent: reauthorize` and not accepted otherwise.
4794
+ * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4623
4795
  * @returns {Promise<DataIntegrationAuthorizeUrlResponse>}
4624
4796
  * @throws {BadRequestException} 400
4625
4797
  * @throws {UnauthorizedException} 401
4626
4798
  * @throws {AuthorizationException} 403
4627
4799
  * @throws {NotFoundException} 404
4800
+ * @throws {ConflictException} 409
4801
+ * @throws {UnprocessableEntityException} 422
4628
4802
  */
4629
4803
  async authorizeDataIntegration(options) {
4630
4804
  const { slug, ...payload } = options;
@@ -4634,41 +4808,44 @@ var Pipes = class {
4634
4808
  /**
4635
4809
  * Create another client credentials connected account
4636
4810
  *
4637
- * Requires `connectionIntent: 'add'` and does not accept an account selector.
4638
- * Until additional connections are available, this creates the first connection
4639
- * or returns 404 `multiple_connections_unavailable` if one already exists.
4640
- * Use `updateDataIntegrationClientCredentials` to rotate the compatibility
4641
- * connection or update an exact connection.
4642
- */
4643
- async createDataIntegrationClientCredential(options) {
4644
- const { slug, ...payload } = options;
4645
- const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsCreateClientCredentialsConnectionRequest(payload));
4646
- return deserializeConnectedAccount(data);
4647
- }
4648
- /**
4649
- * Upsert client credentials for a connected account
4650
- *
4651
- * Creates or updates a client-credentials-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored client credentials are rotated to the new values.
4652
- * @param options - The request options.
4811
+ * Creates another client credentials-based connected account for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. Requires `connection_intent: add` and does not accept `connected_account_id`; use PUT to create or rotate the compatibility connection or to update an exact connection.
4812
+ * @param options - Object containing userId, clientId, clientSecret, connectionIntent.
4653
4813
  * @param options.slug - The identifier of the integration.
4654
4814
  * @example "salesforce"
4815
+ * @param options.accountDisplayName - A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
4816
+ * @example "Acme production"
4817
+ * @param options.accountIdentifier - A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
4818
+ * @example "workspace_123"
4819
+ * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
4820
+ * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4821
+ * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
4822
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4823
+ * @param options.connectionOwner - Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
4824
+ * @example "user"
4825
+ * @param options.clientId - The OAuth client ID to store for this integration.
4826
+ * @example "3MVG9..."
4827
+ * @param options.clientSecret - The OAuth client secret to store for this integration.
4828
+ * @example "shhh-secret"
4829
+ * @param options.config - Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
4830
+ * @example {"salesforce_host":"acme.my.salesforce.com"}
4831
+ * @param options.connectionIntent - Must be `add`: this endpoint only creates another connection. The first connection for an owner shape fills the compatibility slot; later connections are standard.
4832
+ * @example "add"
4655
4833
  * @returns {Promise<ConnectedAccount>}
4656
4834
  * @throws {BadRequestException} 400
4657
4835
  * @throws {UnauthorizedException} 401
4658
4836
  * @throws {AuthorizationException} 403
4659
4837
  * @throws {NotFoundException} 404
4660
4838
  * @throws {ConflictException} 409
4661
- * @throws {UnprocessableEntityException} 422
4662
4839
  */
4663
- async updateDataIntegrationClientCredentials(options) {
4840
+ async createDataIntegrationClientCredential(options) {
4664
4841
  const { slug, ...payload } = options;
4665
- const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsUpsertClientCredentialsRequest(payload));
4842
+ const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsCreateClientCredentialsConnectionRequest(payload));
4666
4843
  return deserializeConnectedAccount(data);
4667
4844
  }
4668
4845
  /**
4669
4846
  * Vend credentials for a connected account
4670
4847
  *
4671
- * Returns credentials for a user-owned or organization-owned connected account. OAuth and client-credentials installations return an access token; API-key installations return the stored secret. Every active credential includes provider-declared, non-secret `config` from the connection snapshot with current defaults. Client-credentials responses also include provider token `metadata`.
4848
+ * Returns credentials for a user's connected account. Branches on the installation's `auth_method`: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret. Every active credential includes `config`: provider-declared, non-secret values from the installation snapshot, with current provider defaults for unset fields. Editing integration or organization configuration does not change the snapshot; reconnect or explicitly rebind the connection to adopt those edits. Defaults remain live, so a changed default can appear in `config` before a cached token is refreshed or re-minted. Credentials that never refresh require a reconnect or rebind when a default changes their routing.
4672
4849
  * @param options - Object containing userId.
4673
4850
  * @param options.slug - The identifier of the integration.
4674
4851
  * @example "github"
@@ -4715,9 +4892,18 @@ var Pipes = class {
4715
4892
  * Update an organization-owned data integration
4716
4893
  *
4717
4894
  * Updates the description, enabled state, or custom credentials of the organization-owned data integration for a provider. For custom providers, `custom_provider` updates the OAuth definition, which is shared with the user-owned root. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
4718
- * @param options - The request options.
4895
+ * @param options - The request body.
4719
4896
  * @param options.slug - The slug identifier of the data integration.
4720
4897
  * @example "github"
4898
+ * @param options.description - An optional description of the Data Integration.
4899
+ * @example "Production GitHub app"
4900
+ * @param options.enabled - Whether the Data Integration is enabled.
4901
+ * @example true
4902
+ * @param options.scopes - The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes.
4903
+ * @example ["repo","read:org"]
4904
+ * @param options.credentials - New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with `api_key`.
4905
+ * @param options.apiKey - An API key to install or rotate for a tenant on an `api_key` integration. Upserts the tenant installation identified by `user_id` (and optional `organization_id`).
4906
+ * @param options.customProvider - Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.
4721
4907
  * @returns {Promise<DataIntegration>}
4722
4908
  * @throws {BadRequestException} 400
4723
4909
  * @throws {UnauthorizedException} 401
@@ -4806,12 +4992,30 @@ var Pipes = class {
4806
4992
  /**
4807
4993
  * Import an organization connected account
4808
4994
  *
4809
- * Imports an organization-owned [connected account](https://workos.com/docs/reference/pipes/connected-account) by providing OAuth tokens directly. Omit `connectionIntent` for compatibility behavior or set it to `add` to explicitly create a connection. Additional connection creation is subject to API availability.
4810
- * @param options - The request options.
4995
+ * Imports an organization-owned [connected account](https://workos.com/docs/reference/pipes/connected-account) by providing OAuth tokens directly. Omit `connection_intent` to create only the compatibility connection, or set it to `add` to explicitly create another connection. This creation-only endpoint does not accept `connected_account_id` or reauthorization intent.
4996
+ * @param options - Object containing userId.
4811
4997
  * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
4812
4998
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4813
4999
  * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4814
5000
  * @example "github"
5001
+ * @param options.accountDisplayName - A mutable, non-unique connection label; null clears it. Not an account identifier.
5002
+ * @example "Acme production"
5003
+ * @param options.accountIdentifier - A developer-attested account identifier; null clears it.
5004
+ * @example "workspace_123"
5005
+ * @param options.accessToken - The OAuth access token for the connected account.
5006
+ * @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
5007
+ * @param options.refreshToken - The OAuth refresh token for the connected account.
5008
+ * @example "ghr_xxxxxxxxxxxxxxxxxxxx"
5009
+ * @param options.expiresAt - The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
5010
+ * @example "2025-12-31T23:59:59.000Z"
5011
+ * @param options.scopes - The OAuth scopes granted for this connection.
5012
+ * @example ["repo","user:email"]
5013
+ * @param options.state - Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
5014
+ * @example "connected"
5015
+ * @param options.userId - The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization.
5016
+ * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
5017
+ * @param options.connectionIntent - Set to `add` to create another connected account. Omit this field for permanent compatibility behavior.
5018
+ * @example "add"
4815
5019
  * @returns {Promise<ConnectedAccount>}
4816
5020
  * @throws {UnauthorizedException} 401
4817
5021
  * @throws {AuthorizationException} 403
@@ -4828,15 +5032,33 @@ var Pipes = class {
4828
5032
  * Update an organization connected account
4829
5033
  *
4830
5034
  * Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider.
4831
- * @param options - Additional query options.
5035
+ * @param options - Object containing userId.
4832
5036
  * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
4833
5037
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4834
5038
  * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4835
5039
  * @example "github"
4836
- * @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
5040
+ * @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting. Omit intent and selector to update the compatibility connection, or supply `connected_account_id` to update an exact connection.
5041
+ * @example true
4837
5042
  * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
4838
5043
  * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4839
- * @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
5044
+ * @param options.connectionIntent - Set to `reauthorize` with `connected_account_id` to update one exact connection. The intent may be omitted when supplying an ID. Omit both for permanent compatibility behavior.
5045
+ * @example "reauthorize"
5046
+ * @param options.accountDisplayName - A mutable, non-unique connection label; null clears it. Not an account identifier.
5047
+ * @example "Acme production"
5048
+ * @param options.accountIdentifier - A developer-attested account identifier; null clears it.
5049
+ * @example "workspace_123"
5050
+ * @param options.accessToken - The OAuth access token for the connected account.
5051
+ * @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
5052
+ * @param options.refreshToken - The OAuth refresh token for the connected account.
5053
+ * @example "ghr_xxxxxxxxxxxxxxxxxxxx"
5054
+ * @param options.expiresAt - The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
5055
+ * @example "2025-12-31T23:59:59.000Z"
5056
+ * @param options.scopes - The OAuth scopes granted for this connection.
5057
+ * @example ["repo","user:email"]
5058
+ * @param options.state - Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
5059
+ * @example "connected"
5060
+ * @param options.userId - The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization.
5061
+ * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
4840
5062
  * @returns {Promise<ConnectedAccount>}
4841
5063
  * @throws {BadRequestException} 400
4842
5064
  * @throws {UnauthorizedException} 401
@@ -4848,39 +5070,13 @@ var Pipes = class {
4848
5070
  async updateOrganizationConnectedAccount(options) {
4849
5071
  const { organizationId, slug, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
4850
5072
  const { data } = await this.workos.put(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeOrganizationConnectedAccount(payload), { query: {
4851
- supports_multiple_connections: supportsMultipleConnections,
4852
- connected_account_id: connectedAccountId,
4853
- connection_intent: connectionIntent
5073
+ ...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
5074
+ ...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId },
5075
+ ...options.connectionIntent !== void 0 && { connection_intent: options.connectionIntent }
4854
5076
  } });
4855
5077
  return deserializeConnectedAccount(data);
4856
5078
  }
4857
5079
  /**
4858
- * Delete an organization connected account
4859
- *
4860
- * Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side.
4861
- * @param options - Additional query options.
4862
- * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
4863
- * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4864
- * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
4865
- * @example "github"
4866
- * @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
4867
- * @example true
4868
- * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
4869
- * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4870
- * @returns {Promise<void>}
4871
- * @throws {BadRequestException} 400
4872
- * @throws {UnauthorizedException} 401
4873
- * @throws {NotFoundException} 404
4874
- * @throws {ConflictException} 409
4875
- */
4876
- async deleteOrganizationConnectedAccount(options) {
4877
- const { organizationId, slug } = options;
4878
- await this.workos.delete(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, {
4879
- supports_multiple_connections: options.supportsMultipleConnections,
4880
- connected_account_id: options.connectedAccountId
4881
- });
4882
- }
4883
- /**
4884
5080
  * List providers for an organization
4885
5081
  *
4886
5082
  * Retrieves the organization-owned providers configured for your environment and the organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) information for each. Providers owned by individual users are not included.
@@ -4931,7 +5127,7 @@ var Pipes = class {
4931
5127
  /**
4932
5128
  * Import a connected account
4933
5129
  *
4934
- * Imports a [connected account](https://workos.com/docs/reference/pipes/connected-account) for a user by providing OAuth tokens directly. Omit `connectionIntent` for compatibility behavior or set it to `add` to explicitly create a connection. Additional connection creation is subject to API availability.
5130
+ * Imports a [connected account](https://workos.com/docs/reference/pipes/connected-account) for a user by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow.
4935
5131
  * @param options - The request body.
4936
5132
  * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
4937
5133
  * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
@@ -4939,6 +5135,10 @@ var Pipes = class {
4939
5135
  * @example "github"
4940
5136
  * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
4941
5137
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
5138
+ * @param options.accountDisplayName - A mutable, non-unique connection label; null clears it. Not an account identifier.
5139
+ * @example "Acme production"
5140
+ * @param options.accountIdentifier - A developer-attested account identifier; null clears it.
5141
+ * @example "workspace_123"
4942
5142
  * @param options.accessToken - The OAuth access token for the connected account.
4943
5143
  * @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
4944
5144
  * @param options.refreshToken - The OAuth refresh token for the connected account.
@@ -4949,6 +5149,8 @@ var Pipes = class {
4949
5149
  * @example ["repo","user:email"]
4950
5150
  * @param options.state - Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
4951
5151
  * @example "connected"
5152
+ * @param options.connectionIntent - Set to `add` to create another connected account. Omit this field for permanent compatibility behavior.
5153
+ * @example "add"
4952
5154
  * @returns {Promise<ConnectedAccount>}
4953
5155
  * @throws {UnauthorizedException} 401
4954
5156
  * @throws {NotFoundException} 404
@@ -4957,7 +5159,7 @@ var Pipes = class {
4957
5159
  */
4958
5160
  async createUserConnectedAccount(options) {
4959
5161
  const { userId, slug, organizationId, ...payload } = options;
4960
- const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateConnectedAccount(payload), { query: { organization_id: organizationId } });
5162
+ const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateConnectedAccount(payload), { query: { ...options.organizationId !== void 0 && { organization_id: options.organizationId } } });
4961
5163
  return deserializeConnectedAccount(data);
4962
5164
  }
4963
5165
  /**
@@ -4971,10 +5173,16 @@ var Pipes = class {
4971
5173
  * @example "github"
4972
5174
  * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
4973
5175
  * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4974
- * @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
5176
+ * @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting. Omit intent and selector to update the compatibility connection, or supply `connected_account_id` to update an exact connection.
5177
+ * @example true
4975
5178
  * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
4976
5179
  * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
4977
- * @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
5180
+ * @param options.connectionIntent - Set to `reauthorize` with `connected_account_id` to update one exact connection. The intent may be omitted when supplying an ID. Omit both for permanent compatibility behavior.
5181
+ * @example "reauthorize"
5182
+ * @param options.accountDisplayName - A mutable, non-unique connection label; null clears it. Not an account identifier.
5183
+ * @example "Acme production"
5184
+ * @param options.accountIdentifier - A developer-attested account identifier; null clears it.
5185
+ * @example "workspace_123"
4978
5186
  * @param options.accessToken - The OAuth access token for the connected account.
4979
5187
  * @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
4980
5188
  * @param options.refreshToken - The OAuth refresh token for the connected account.
@@ -4995,43 +5203,14 @@ var Pipes = class {
4995
5203
  async updateUserConnectedAccount(options) {
4996
5204
  const { userId, slug, organizationId, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
4997
5205
  const { data } = await this.workos.put(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeConnectedAccountInput(payload), { query: {
4998
- organization_id: organizationId,
4999
- supports_multiple_connections: supportsMultipleConnections,
5000
- connected_account_id: connectedAccountId,
5001
- connection_intent: connectionIntent
5206
+ ...options.organizationId !== void 0 && { organization_id: options.organizationId },
5207
+ ...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
5208
+ ...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId },
5209
+ ...options.connectionIntent !== void 0 && { connection_intent: options.connectionIntent }
5002
5210
  } });
5003
5211
  return deserializeConnectedAccount(data);
5004
5212
  }
5005
5213
  /**
5006
- * Delete a connected account
5007
- *
5008
- * Disconnects WorkOS's account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect. Access is not revoked on the provider side, except for the WorkOS OAuth provider, whose underlying AuthKit grant is revoked.
5009
- * @param options - Additional query options.
5010
- * @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
5011
- * @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
5012
- * @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
5013
- * @example "github"
5014
- * @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
5015
- * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
5016
- * @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
5017
- * @example true
5018
- * @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
5019
- * @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
5020
- * @returns {Promise<void>}
5021
- * @throws {BadRequestException} 400
5022
- * @throws {UnauthorizedException} 401
5023
- * @throws {NotFoundException} 404
5024
- * @throws {ConflictException} 409
5025
- */
5026
- async deleteUserConnectedAccount(options) {
5027
- const { userId, slug } = options;
5028
- await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
5029
- organization_id: options.organizationId,
5030
- supports_multiple_connections: options.supportsMultipleConnections,
5031
- connected_account_id: options.connectedAccountId
5032
- });
5033
- }
5034
- /**
5035
5214
  * List providers for a user
5036
5215
  *
5037
5216
  * Retrieves a list of available providers and the user's connection status for each. Returns all providers configured for your environment, along with the user's [connected account](https://workos.com/docs/reference/pipes/connected-account) information where applicable.
@@ -6088,10 +6267,10 @@ let detectedRuntime = null;
6088
6267
  function detectRuntime() {
6089
6268
  if (detectedRuntime) return detectedRuntime;
6090
6269
  const global = globalThis;
6091
- if (typeof process !== "undefined" && process.release?.name === "node") detectedRuntime = "node";
6092
- else if (typeof global.Deno !== "undefined") detectedRuntime = "deno";
6093
- else if (typeof navigator !== "undefined" && navigator.userAgent?.includes("Bun")) detectedRuntime = "bun";
6270
+ if (typeof global.Deno !== "undefined") detectedRuntime = "deno";
6271
+ else if (typeof global.Bun !== "undefined" || typeof process !== "undefined" && process.versions?.bun || typeof navigator !== "undefined" && navigator.userAgent?.includes("Bun")) detectedRuntime = "bun";
6094
6272
  else if (typeof navigator !== "undefined" && navigator.userAgent?.includes("Cloudflare")) detectedRuntime = "cloudflare";
6273
+ else if (typeof process !== "undefined" && process.release?.name === "node") detectedRuntime = "node";
6095
6274
  else if (typeof global !== "undefined" && "fastly" in global) detectedRuntime = "fastly";
6096
6275
  else if (typeof global !== "undefined" && "EdgeRuntime" in global) detectedRuntime = "edge-light";
6097
6276
  else detectedRuntime = "other";
@@ -6106,7 +6285,7 @@ function getEnvironmentVariable(key) {
6106
6285
  case "bun":
6107
6286
  case "edge-light": return process.env[key];
6108
6287
  case "deno": return global.Deno.env.get(key);
6109
- case "cloudflare": return global.env?.[key] ?? global[key];
6288
+ case "cloudflare": return global.env?.[key] ?? global[key] ?? (typeof process !== "undefined" ? process.env?.[key] : void 0);
6110
6289
  case "fastly": return global[key];
6111
6290
  default: return process?.env?.[key] ?? global.env?.[key] ?? global[key];
6112
6291
  }
@@ -9772,7 +9951,7 @@ var Vault = class {
9772
9951
  };
9773
9952
  //#endregion
9774
9953
  //#region package.json
9775
- var version = "12.0.0";
9954
+ var version = "12.1.0";
9776
9955
  //#endregion
9777
9956
  //#region src/workos.ts
9778
9957
  const DEFAULT_HOSTNAME = "api.workos.com";
@@ -10185,4 +10364,4 @@ function createWorkOS(options) {
10185
10364
  //#endregion
10186
10365
  export { isAuthenticationErrorData as A, RateLimitExceededException as C, ConflictException as D, NoApiKeyProvidedException as E, ApiKeyRequiredException as M, FetchHttpClient as N, BadRequestException as O, SubtleCryptoProvider as P, SignatureVerificationException as S, NotFoundException as T, Webhooks as _, ItContactIntent as a, UnprocessableEntityException as b, GenerateLinkIntent as c, FeatureFlagsRuntimeClient as d, CookieSession as f, PKCE as g, AuthenticateWithSessionCookieFailureReason as h, OrganizationDomainVerificationStrategy as i, GenericServerException as j, AuthenticationException as k, UpdateAuditLogsRetentionRetentionPeriod as l, serializeRevokeSessionOptions as m, ConnectionType as n, DomainDataState as o, RefreshSessionFailureReason as p, OrganizationDomainState as r, DirectoryUserWithGroupsState as s, createWorkOS as t, WorkOS as u, AutoPaginatable as v, OauthException as w, UnauthorizedException as x, Actions as y };
10187
10366
 
10188
- //# sourceMappingURL=factory-D2Ig6M1S.mjs.map
10367
+ //# sourceMappingURL=factory-99SwwalC.mjs.map