@workos-inc/node 10.14.0 → 11.0.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.
- package/lib/{factory-Dqju-gCl.mjs → factory-BbGPjwhL.mjs} +495 -52
- package/lib/factory-BbGPjwhL.mjs.map +1 -0
- package/lib/{factory-CW0E3JEC.d.mts → factory-C86kGSc7.d.cts} +912 -108
- package/lib/{factory-BkKapXtb.cjs → factory-DJd6WXWm.cjs} +495 -52
- package/lib/factory-DJd6WXWm.cjs.map +1 -0
- package/lib/{factory-zrNVaAD9.d.cts → factory-G1JU2hJz.d.mts} +911 -109
- package/lib/index.cjs +157 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +156 -78
- package/lib/index.d.mts +156 -78
- package/lib/index.mjs +137 -5
- package/lib/index.mjs.map +1 -1
- package/lib/index.worker.cjs +1 -1
- package/lib/index.worker.d.cts +1 -1
- package/lib/index.worker.d.mts +1 -1
- package/lib/index.worker.mjs +1 -1
- package/package.json +1 -1
- package/lib/factory-BkKapXtb.cjs.map +0 -1
- package/lib/factory-Dqju-gCl.mjs.map +0 -1
|
@@ -3709,6 +3709,17 @@ const deserializeDataIntegrationCredential = (response) => ({
|
|
|
3709
3709
|
redactedClientSecret: response.redacted_client_secret ?? null
|
|
3710
3710
|
});
|
|
3711
3711
|
//#endregion
|
|
3712
|
+
//#region src/pipes/serializers/data-integration-installation.serializer.ts
|
|
3713
|
+
const deserializeDataIntegrationInstallation = (response) => ({
|
|
3714
|
+
id: response.id,
|
|
3715
|
+
connectionRole: response.connection_role,
|
|
3716
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
3717
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
3718
|
+
userId: response.user_id ?? null,
|
|
3719
|
+
organizationId: response.organization_id ?? null,
|
|
3720
|
+
apiKeyLast4: response.api_key_last_4 ?? null
|
|
3721
|
+
});
|
|
3722
|
+
//#endregion
|
|
3712
3723
|
//#region src/pipes/serializers/data-integration-custom-provider.serializer.ts
|
|
3713
3724
|
const deserializeDataIntegrationCustomProvider = (response) => ({
|
|
3714
3725
|
name: response.name,
|
|
@@ -3730,12 +3741,16 @@ const deserializeDataIntegration = (response) => ({
|
|
|
3730
3741
|
id: response.id,
|
|
3731
3742
|
slug: response.slug,
|
|
3732
3743
|
integrationType: response.integration_type,
|
|
3744
|
+
ownership: response.ownership,
|
|
3733
3745
|
description: response.description ?? null,
|
|
3734
3746
|
enabled: response.enabled,
|
|
3735
3747
|
state: response.state,
|
|
3736
3748
|
scopes: response.scopes ?? null,
|
|
3737
3749
|
redirectUri: response.redirect_uri,
|
|
3738
|
-
|
|
3750
|
+
authMethods: response.auth_methods,
|
|
3751
|
+
credentials: response.credentials != null ? deserializeDataIntegrationCredential(response.credentials) : null,
|
|
3752
|
+
installation: response.installation != null ? deserializeDataIntegrationInstallation(response.installation) : null,
|
|
3753
|
+
config: response.config,
|
|
3739
3754
|
customProvider: response.custom_provider != null ? deserializeDataIntegrationCustomProvider(response.custom_provider) : null,
|
|
3740
3755
|
createdAt: new Date(response.created_at),
|
|
3741
3756
|
updatedAt: new Date(response.updated_at)
|
|
@@ -3745,11 +3760,17 @@ const deserializeDataIntegration = (response) => ({
|
|
|
3745
3760
|
const deserializeConnectedAccount = (response) => ({
|
|
3746
3761
|
object: response.object,
|
|
3747
3762
|
id: response.id,
|
|
3763
|
+
connectionRole: response.connection_role,
|
|
3764
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
3765
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
3748
3766
|
userId: response.user_id ?? null,
|
|
3749
3767
|
organizationId: response.organization_id ?? null,
|
|
3750
3768
|
scopes: response.scopes,
|
|
3751
3769
|
authMethod: response.auth_method,
|
|
3752
3770
|
apiKeyLast4: response.api_key_last_4 ?? null,
|
|
3771
|
+
clientId: response.client_id ?? null,
|
|
3772
|
+
clientSecretLast4: response.client_secret_last_4 ?? null,
|
|
3773
|
+
config: response.config,
|
|
3753
3774
|
state: response.state,
|
|
3754
3775
|
createdAt: response.created_at,
|
|
3755
3776
|
updatedAt: response.updated_at
|
|
@@ -3758,22 +3779,52 @@ const deserializeConnectedAccount = (response) => ({
|
|
|
3758
3779
|
//#region src/pipes/serializers/data-integration-authorize-url-response.serializer.ts
|
|
3759
3780
|
const deserializeDataIntegrationAuthorizeUrlResponse = (response) => ({ url: response.url });
|
|
3760
3781
|
//#endregion
|
|
3761
|
-
//#region src/pipes/serializers/data-integration-
|
|
3762
|
-
const
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3782
|
+
//#region src/pipes/serializers/data-integration-vended-credential.serializer.ts
|
|
3783
|
+
const deserializeDataIntegrationVendedCredential = (response) => {
|
|
3784
|
+
switch (response.auth_method) {
|
|
3785
|
+
case "oauth": return {
|
|
3786
|
+
authMethod: "oauth",
|
|
3787
|
+
object: response.object,
|
|
3788
|
+
value: response.value,
|
|
3789
|
+
expiresAt: response.expires_at,
|
|
3790
|
+
scopes: response.scopes,
|
|
3791
|
+
missingScopes: response.missing_scopes,
|
|
3792
|
+
config: response.config
|
|
3793
|
+
};
|
|
3794
|
+
case "api_key": return {
|
|
3795
|
+
authMethod: "api_key",
|
|
3796
|
+
object: response.object,
|
|
3797
|
+
value: response.value,
|
|
3798
|
+
config: response.config
|
|
3799
|
+
};
|
|
3800
|
+
case "client_credentials": return {
|
|
3801
|
+
authMethod: "client_credentials",
|
|
3802
|
+
object: response.object,
|
|
3803
|
+
value: response.value,
|
|
3804
|
+
expiresAt: response.expires_at,
|
|
3805
|
+
scopes: response.scopes,
|
|
3806
|
+
missingScopes: response.missing_scopes,
|
|
3807
|
+
metadata: response.metadata,
|
|
3808
|
+
config: response.config
|
|
3809
|
+
};
|
|
3810
|
+
default: throw new Error("Unknown auth_method: " + String(response.auth_method));
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3770
3813
|
//#endregion
|
|
3771
3814
|
//#region src/pipes/serializers/data-integration-credentials-response.serializer.ts
|
|
3772
|
-
const deserializeDataIntegrationCredentialsResponse = (response) =>
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3815
|
+
const deserializeDataIntegrationCredentialsResponse = (response) => {
|
|
3816
|
+
switch (response.active) {
|
|
3817
|
+
case true: return {
|
|
3818
|
+
active: true,
|
|
3819
|
+
credential: deserializeDataIntegrationVendedCredential(response.credential)
|
|
3820
|
+
};
|
|
3821
|
+
case false: return {
|
|
3822
|
+
active: false,
|
|
3823
|
+
error: response.error
|
|
3824
|
+
};
|
|
3825
|
+
default: throw new Error("Unknown active: " + String(response.active));
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3777
3828
|
//#endregion
|
|
3778
3829
|
//#region src/pipes/serializers/data-integration-access-token-response-access-token.serializer.ts
|
|
3779
3830
|
const deserializeDataIntegrationAccessTokenResponseAccessToken = (response) => ({
|
|
@@ -3803,11 +3854,17 @@ const deserializeDataIntegrationAccessTokenResponse = (response) => {
|
|
|
3803
3854
|
const deserializeDataIntegrationsListResponseDataConnectedAccount = (response) => ({
|
|
3804
3855
|
object: response.object,
|
|
3805
3856
|
id: response.id,
|
|
3857
|
+
connectionRole: response.connection_role,
|
|
3858
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
3859
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
3806
3860
|
userId: response.user_id ?? null,
|
|
3807
3861
|
organizationId: response.organization_id ?? null,
|
|
3808
3862
|
scopes: response.scopes,
|
|
3809
3863
|
authMethod: response.auth_method,
|
|
3810
3864
|
apiKeyLast4: response.api_key_last_4 ?? null,
|
|
3865
|
+
clientId: response.client_id ?? null,
|
|
3866
|
+
clientSecretLast4: response.client_secret_last_4 ?? null,
|
|
3867
|
+
config: response.config,
|
|
3811
3868
|
state: response.state,
|
|
3812
3869
|
createdAt: response.created_at,
|
|
3813
3870
|
updatedAt: response.updated_at,
|
|
@@ -3825,10 +3882,12 @@ const deserializeDataIntegrationsListResponseData = (response) => ({
|
|
|
3825
3882
|
credentialsType: response.credentials_type,
|
|
3826
3883
|
scopes: response.scopes ?? null,
|
|
3827
3884
|
authMethods: response.auth_methods,
|
|
3885
|
+
connectionOwner: response.connection_owner,
|
|
3828
3886
|
ownership: response.ownership,
|
|
3829
3887
|
createdAt: response.created_at,
|
|
3830
3888
|
updatedAt: response.updated_at,
|
|
3831
|
-
connectedAccount: response.connected_account != null ? deserializeDataIntegrationsListResponseDataConnectedAccount(response.connected_account) : null
|
|
3889
|
+
connectedAccount: response.connected_account != null ? deserializeDataIntegrationsListResponseDataConnectedAccount(response.connected_account) : null,
|
|
3890
|
+
connectedAccounts: response.connected_accounts != null ? response.connected_accounts.map(deserializeDataIntegrationsListResponseDataConnectedAccount) : void 0
|
|
3832
3891
|
});
|
|
3833
3892
|
//#endregion
|
|
3834
3893
|
//#region src/pipes/serializers/data-integrations-list-response.serializer.ts
|
|
@@ -3837,13 +3896,20 @@ const deserializeDataIntegrationsListResponse = (response) => ({
|
|
|
3837
3896
|
data: response.data.map(deserializeDataIntegrationsListResponseData)
|
|
3838
3897
|
});
|
|
3839
3898
|
//#endregion
|
|
3840
|
-
//#region src/pipes/serializers/data-integration-credentials-
|
|
3841
|
-
const
|
|
3899
|
+
//#region src/pipes/serializers/data-integration-credentials-input.serializer.ts
|
|
3900
|
+
const serializeDataIntegrationCredentialsInput = (model) => ({
|
|
3842
3901
|
type: model.type,
|
|
3843
3902
|
client_id: model.clientId,
|
|
3844
3903
|
client_secret: model.clientSecret
|
|
3845
3904
|
});
|
|
3846
3905
|
//#endregion
|
|
3906
|
+
//#region src/pipes/serializers/api-key-installation.serializer.ts
|
|
3907
|
+
const serializeApiKeyInstallation = (model) => ({
|
|
3908
|
+
secret: model.secret,
|
|
3909
|
+
user_id: model.userId,
|
|
3910
|
+
organization_id: model.organizationId
|
|
3911
|
+
});
|
|
3912
|
+
//#endregion
|
|
3847
3913
|
//#region src/pipes/serializers/custom-provider-definition.serializer.ts
|
|
3848
3914
|
const serializeCustomProviderDefinition = (model) => ({
|
|
3849
3915
|
name: model.name,
|
|
@@ -3862,13 +3928,58 @@ const serializeCustomProviderDefinition = (model) => ({
|
|
|
3862
3928
|
//#region src/pipes/serializers/create-data-integration.serializer.ts
|
|
3863
3929
|
const serializeCreateDataIntegration = (model) => ({
|
|
3864
3930
|
provider: model.provider,
|
|
3931
|
+
ownership: model.ownership,
|
|
3932
|
+
auth_methods: model.authMethods,
|
|
3933
|
+
config: model.config,
|
|
3934
|
+
api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
|
|
3865
3935
|
description: model.description,
|
|
3866
3936
|
enabled: model.enabled,
|
|
3867
3937
|
scopes: model.scopes,
|
|
3868
|
-
credentials: model.credentials != null ?
|
|
3938
|
+
credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
|
|
3869
3939
|
custom_provider: model.customProvider != null ? serializeCustomProviderDefinition(model.customProvider) : void 0
|
|
3870
3940
|
});
|
|
3871
3941
|
//#endregion
|
|
3942
|
+
//#region src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
|
|
3943
|
+
const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
|
|
3944
|
+
user_id: model.userId,
|
|
3945
|
+
organization_id: model.organizationId,
|
|
3946
|
+
connection_owner: model.connectionOwner,
|
|
3947
|
+
secret: model.secret,
|
|
3948
|
+
connection_intent: model.connectionIntent
|
|
3949
|
+
});
|
|
3950
|
+
//#endregion
|
|
3951
|
+
//#region src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
|
|
3952
|
+
const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model) => ({
|
|
3953
|
+
user_id: model.userId,
|
|
3954
|
+
organization_id: model.organizationId,
|
|
3955
|
+
connection_owner: model.connectionOwner,
|
|
3956
|
+
client_id: model.clientId,
|
|
3957
|
+
client_secret: model.clientSecret,
|
|
3958
|
+
config: model.config,
|
|
3959
|
+
connection_intent: model.connectionIntent
|
|
3960
|
+
});
|
|
3961
|
+
//#endregion
|
|
3962
|
+
//#region src/pipes/serializers/create-connected-account.serializer.ts
|
|
3963
|
+
const serializeCreateConnectedAccount = (model) => ({
|
|
3964
|
+
access_token: model.accessToken,
|
|
3965
|
+
refresh_token: model.refreshToken,
|
|
3966
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
3967
|
+
scopes: model.scopes,
|
|
3968
|
+
state: model.state,
|
|
3969
|
+
connection_intent: model.connectionIntent
|
|
3970
|
+
});
|
|
3971
|
+
//#endregion
|
|
3972
|
+
//#region src/pipes/serializers/create-organization-connected-account.serializer.ts
|
|
3973
|
+
const serializeCreateOrganizationConnectedAccount = (model) => ({
|
|
3974
|
+
access_token: model.accessToken,
|
|
3975
|
+
refresh_token: model.refreshToken,
|
|
3976
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
3977
|
+
scopes: model.scopes,
|
|
3978
|
+
state: model.state,
|
|
3979
|
+
user_id: model.userId,
|
|
3980
|
+
connection_intent: model.connectionIntent
|
|
3981
|
+
});
|
|
3982
|
+
//#endregion
|
|
3872
3983
|
//#region src/pipes/serializers/update-custom-provider-definition.serializer.ts
|
|
3873
3984
|
const serializeUpdateCustomProviderDefinition = (model) => ({
|
|
3874
3985
|
name: model.name,
|
|
@@ -3889,7 +4000,8 @@ const serializeUpdateDataIntegration = (model) => ({
|
|
|
3889
4000
|
description: model.description,
|
|
3890
4001
|
enabled: model.enabled,
|
|
3891
4002
|
scopes: model.scopes,
|
|
3892
|
-
|
|
4003
|
+
api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
|
|
4004
|
+
credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
|
|
3893
4005
|
custom_provider: model.customProvider != null ? serializeUpdateCustomProviderDefinition(model.customProvider) : void 0
|
|
3894
4006
|
});
|
|
3895
4007
|
//#endregion
|
|
@@ -3897,6 +4009,9 @@ const serializeUpdateDataIntegration = (model) => ({
|
|
|
3897
4009
|
const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
|
|
3898
4010
|
user_id: model.userId,
|
|
3899
4011
|
organization_id: model.organizationId,
|
|
4012
|
+
connected_account_id: model.connectedAccountId,
|
|
4013
|
+
connection_intent: model.connectionIntent,
|
|
4014
|
+
connection_owner: model.connectionOwner,
|
|
3900
4015
|
secret: model.secret
|
|
3901
4016
|
});
|
|
3902
4017
|
//#endregion
|
|
@@ -3904,23 +4019,53 @@ const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
|
|
|
3904
4019
|
const serializeDataIntegrationsGetDataIntegrationAuthorizeUrlRequest = (model) => ({
|
|
3905
4020
|
user_id: model.userId,
|
|
3906
4021
|
organization_id: model.organizationId,
|
|
3907
|
-
|
|
4022
|
+
connection_owner: model.connectionOwner,
|
|
4023
|
+
return_to: model.returnTo,
|
|
4024
|
+
config: model.config
|
|
4025
|
+
});
|
|
4026
|
+
//#endregion
|
|
4027
|
+
//#region src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
|
|
4028
|
+
const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
|
|
4029
|
+
user_id: model.userId,
|
|
4030
|
+
organization_id: model.organizationId,
|
|
4031
|
+
connected_account_id: model.connectedAccountId,
|
|
4032
|
+
connection_intent: model.connectionIntent,
|
|
4033
|
+
connection_owner: model.connectionOwner,
|
|
4034
|
+
client_id: model.clientId,
|
|
4035
|
+
client_secret: model.clientSecret,
|
|
4036
|
+
config: model.config
|
|
3908
4037
|
});
|
|
3909
4038
|
//#endregion
|
|
3910
4039
|
//#region src/pipes/serializers/data-integrations-vend-credentials-request.serializer.ts
|
|
3911
4040
|
const serializeDataIntegrationsVendCredentialsRequest = (model) => ({
|
|
3912
4041
|
user_id: model.userId,
|
|
3913
|
-
organization_id: model.organizationId
|
|
4042
|
+
organization_id: model.organizationId,
|
|
4043
|
+
connected_account_id: model.connectedAccountId,
|
|
4044
|
+
connection_owner: model.connectionOwner,
|
|
4045
|
+
supports_multiple_connections: model.supportsMultipleConnections
|
|
3914
4046
|
});
|
|
3915
4047
|
//#endregion
|
|
3916
4048
|
//#region src/pipes/serializers/data-integrations-get-user-token-request.serializer.ts
|
|
3917
4049
|
const serializeDataIntegrationsGetUserTokenRequest = (model) => ({
|
|
3918
4050
|
user_id: model.userId,
|
|
3919
|
-
organization_id: model.organizationId
|
|
4051
|
+
organization_id: model.organizationId,
|
|
4052
|
+
connected_account_id: model.connectedAccountId,
|
|
4053
|
+
connection_owner: model.connectionOwner,
|
|
4054
|
+
supports_multiple_connections: model.supportsMultipleConnections
|
|
4055
|
+
});
|
|
4056
|
+
//#endregion
|
|
4057
|
+
//#region src/pipes/serializers/organization-connected-account.serializer.ts
|
|
4058
|
+
const serializeOrganizationConnectedAccount = (model) => ({
|
|
4059
|
+
access_token: model.accessToken,
|
|
4060
|
+
refresh_token: model.refreshToken,
|
|
4061
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
4062
|
+
scopes: model.scopes,
|
|
4063
|
+
state: model.state,
|
|
4064
|
+
user_id: model.userId
|
|
3920
4065
|
});
|
|
3921
4066
|
//#endregion
|
|
3922
|
-
//#region src/pipes/serializers/connected-account-
|
|
3923
|
-
const
|
|
4067
|
+
//#region src/pipes/serializers/connected-account-input.serializer.ts
|
|
4068
|
+
const serializeConnectedAccountInput = (model) => ({
|
|
3924
4069
|
access_token: model.accessToken,
|
|
3925
4070
|
refresh_token: model.refreshToken,
|
|
3926
4071
|
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
@@ -3937,10 +4082,12 @@ var Pipes = class {
|
|
|
3937
4082
|
/**
|
|
3938
4083
|
* List data integrations
|
|
3939
4084
|
*
|
|
3940
|
-
* Lists the environment's data integrations configured with `custom` or `organization` credentials, including custom providers.
|
|
4085
|
+
* 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.
|
|
3941
4086
|
* @param options - Pagination and filter options.
|
|
3942
|
-
* @returns {Promise<AutoPaginatable<DataIntegration,
|
|
4087
|
+
* @returns {Promise<AutoPaginatable<DataIntegration, ListDataIntegrationsOptions>>}
|
|
3943
4088
|
* @throws {UnauthorizedException} 401
|
|
4089
|
+
* @throws {NotFoundException} 404
|
|
4090
|
+
* @throws {UnprocessableEntityException} 422
|
|
3944
4091
|
*/
|
|
3945
4092
|
async listDataIntegrations(options) {
|
|
3946
4093
|
const paginationOptions = options;
|
|
@@ -3949,22 +4096,31 @@ var Pipes = class {
|
|
|
3949
4096
|
/**
|
|
3950
4097
|
* Create a data integration
|
|
3951
4098
|
*
|
|
3952
|
-
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials
|
|
4099
|
+
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership.
|
|
3953
4100
|
* @param options - Object containing provider.
|
|
3954
4101
|
* @param options.provider - The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
|
3955
4102
|
* @example "github"
|
|
4103
|
+
* @param options.ownership - Who owns the Data Integration. `user` (the default) creates the integration users connect their own accounts to; `organization` creates the root organizations connect to. Ownership is fixed at creation, and one integration of each ownership may exist per provider. Independent of `credentials.type`.
|
|
4104
|
+
* @example "user"
|
|
3956
4105
|
* @param options.description - An optional description of the Data Integration.
|
|
3957
4106
|
* @example "Production GitHub app"
|
|
3958
4107
|
* @param options.enabled - Whether the Data Integration is enabled. Defaults to `false`.
|
|
3959
4108
|
* @example true
|
|
3960
4109
|
* @param options.scopes - The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
|
3961
4110
|
* @example ["repo","read:org"]
|
|
3962
|
-
* @param options.
|
|
4111
|
+
* @param options.authMethods - How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
|
4112
|
+
* @example ["oauth"]
|
|
4113
|
+
* @param options.config - Provider-specific config values (e.g. a Snowflake `account`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
|
4114
|
+
* @example {"account":"myorg-myaccount"}
|
|
4115
|
+
* @param options.credentials - The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
|
4116
|
+
* @param options.apiKey - An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
3963
4117
|
* @param options.customProvider - The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider.
|
|
3964
4118
|
* @returns {Promise<DataIntegration>}
|
|
3965
4119
|
* @throws {BadRequestException} 400
|
|
3966
4120
|
* @throws {UnauthorizedException} 401
|
|
4121
|
+
* @throws {AuthorizationException} 403
|
|
3967
4122
|
* @throws {NotFoundException} 404
|
|
4123
|
+
* @throws {ConflictException} 409
|
|
3968
4124
|
* @throws {UnprocessableEntityException} 422
|
|
3969
4125
|
*/
|
|
3970
4126
|
async createDataIntegration(options) {
|
|
@@ -3975,7 +4131,7 @@ var Pipes = class {
|
|
|
3975
4131
|
/**
|
|
3976
4132
|
* Get a data integration
|
|
3977
4133
|
*
|
|
3978
|
-
* Retrieves
|
|
4134
|
+
* Retrieves the user-owned data integration by its slug.
|
|
3979
4135
|
* @param options - The request options.
|
|
3980
4136
|
* @param options.slug - The slug identifier of the data integration.
|
|
3981
4137
|
* @example "github"
|
|
@@ -3991,7 +4147,7 @@ var Pipes = class {
|
|
|
3991
4147
|
/**
|
|
3992
4148
|
* Update a data integration
|
|
3993
4149
|
*
|
|
3994
|
-
* Updates the description, enabled state, or custom credentials of
|
|
4150
|
+
* Updates the description, enabled state, or custom credentials of the user-owned data integration. For custom providers, `custom_provider` updates the OAuth definition.
|
|
3995
4151
|
* @param options - The request body.
|
|
3996
4152
|
* @param options.slug - The slug identifier of the data integration.
|
|
3997
4153
|
* @example "github"
|
|
@@ -4001,12 +4157,15 @@ var Pipes = class {
|
|
|
4001
4157
|
* @example true
|
|
4002
4158
|
* @param options.scopes - The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes.
|
|
4003
4159
|
* @example ["repo","read:org"]
|
|
4004
|
-
* @param options.credentials - New credentials for the Data Integration. When provided, rotates the stored client secret.
|
|
4160
|
+
* @param options.credentials - New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with `api_key`.
|
|
4161
|
+
* @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`).
|
|
4005
4162
|
* @param options.customProvider - Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.
|
|
4006
4163
|
* @returns {Promise<DataIntegration>}
|
|
4007
4164
|
* @throws {BadRequestException} 400
|
|
4008
4165
|
* @throws {UnauthorizedException} 401
|
|
4166
|
+
* @throws {AuthorizationException} 403
|
|
4009
4167
|
* @throws {NotFoundException} 404
|
|
4168
|
+
* @throws {ConflictException} 409
|
|
4010
4169
|
* @throws {UnprocessableEntityException} 422
|
|
4011
4170
|
*/
|
|
4012
4171
|
async updateDataIntegration(options) {
|
|
@@ -4017,7 +4176,7 @@ var Pipes = class {
|
|
|
4017
4176
|
/**
|
|
4018
4177
|
* Delete a data integration
|
|
4019
4178
|
*
|
|
4020
|
-
* Deletes
|
|
4179
|
+
* Deletes the user-owned data integration and all of its connected installations. For a custom provider, the provider definition is deleted once no organization-owned root references it either.
|
|
4021
4180
|
* @param options - The request options.
|
|
4022
4181
|
* @param options.slug - The slug identifier of the data integration.
|
|
4023
4182
|
* @example "github"
|
|
@@ -4030,16 +4189,34 @@ var Pipes = class {
|
|
|
4030
4189
|
await this.workos.delete(`/data-integrations/${encodeURIComponent(slug)}`);
|
|
4031
4190
|
}
|
|
4032
4191
|
/**
|
|
4192
|
+
* Create another API key connected account
|
|
4193
|
+
*
|
|
4194
|
+
* Requires `connectionIntent: 'add'` and does not accept an account selector.
|
|
4195
|
+
* Until additional connections are available, this creates the first connection
|
|
4196
|
+
* or returns 404 `multiple_connections_unavailable` if one already exists.
|
|
4197
|
+
* Use `updateDataIntegrationApiKey` to rotate the compatibility connection or
|
|
4198
|
+
* update an exact connection.
|
|
4199
|
+
*/
|
|
4200
|
+
async createDataIntegrationApiKey(options) {
|
|
4201
|
+
const { slug, ...payload } = options;
|
|
4202
|
+
const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsCreateApiKeyConnectionRequest(payload));
|
|
4203
|
+
return deserializeConnectedAccount(data);
|
|
4204
|
+
}
|
|
4205
|
+
/**
|
|
4033
4206
|
* Upsert an API key for a connected account
|
|
4034
4207
|
*
|
|
4035
|
-
* Creates or updates an API-key-based installation for the specified integration
|
|
4208
|
+
* 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.
|
|
4036
4209
|
* @param options - Object containing userId, secret.
|
|
4037
4210
|
* @param options.slug - The identifier of the integration.
|
|
4038
4211
|
* @example "github"
|
|
4039
4212
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4040
4213
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4041
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4214
|
+
* @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`.
|
|
4042
4215
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4216
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to rotate a specific existing connection.
|
|
4217
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4218
|
+
* @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.
|
|
4219
|
+
* @example "user"
|
|
4043
4220
|
* @param options.secret - The API key secret to store for this integration.
|
|
4044
4221
|
* @example "sk-1234567890abcdef"
|
|
4045
4222
|
* @returns {Promise<ConnectedAccount>}
|
|
@@ -4047,6 +4224,7 @@ var Pipes = class {
|
|
|
4047
4224
|
* @throws {UnauthorizedException} 401
|
|
4048
4225
|
* @throws {AuthorizationException} 403
|
|
4049
4226
|
* @throws {NotFoundException} 404
|
|
4227
|
+
* @throws {ConflictException} 409
|
|
4050
4228
|
* @throws {UnprocessableEntityException} 422
|
|
4051
4229
|
*/
|
|
4052
4230
|
async updateDataIntegrationApiKey(options) {
|
|
@@ -4061,12 +4239,16 @@ var Pipes = class {
|
|
|
4061
4239
|
* @param options - Object containing userId.
|
|
4062
4240
|
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4063
4241
|
* @example "github"
|
|
4064
|
-
* @param options.userId - The ID of the user to authorize.
|
|
4242
|
+
* @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.
|
|
4065
4243
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4066
|
-
* @param options.organizationId - An organization ID to scope the authorization to a specific organization.
|
|
4244
|
+
* @param options.organizationId - An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`.
|
|
4067
4245
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4246
|
+
* @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`.
|
|
4247
|
+
* @example "user"
|
|
4068
4248
|
* @param options.returnTo - The URL to redirect the user to after authorization.
|
|
4069
4249
|
* @example "https://example.com/callback"
|
|
4250
|
+
* @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.
|
|
4251
|
+
* @example {"subdomain":"acme"}
|
|
4070
4252
|
* @returns {Promise<DataIntegrationAuthorizeUrlResponse>}
|
|
4071
4253
|
* @throws {BadRequestException} 400
|
|
4072
4254
|
* @throws {UnauthorizedException} 401
|
|
@@ -4079,20 +4261,63 @@ var Pipes = class {
|
|
|
4079
4261
|
return deserializeDataIntegrationAuthorizeUrlResponse(data);
|
|
4080
4262
|
}
|
|
4081
4263
|
/**
|
|
4264
|
+
* Create another client credentials connected account
|
|
4265
|
+
*
|
|
4266
|
+
* Requires `connectionIntent: 'add'` and does not accept an account selector.
|
|
4267
|
+
* Until additional connections are available, this creates the first connection
|
|
4268
|
+
* or returns 404 `multiple_connections_unavailable` if one already exists.
|
|
4269
|
+
* Use `updateDataIntegrationClientCredentials` to rotate the compatibility
|
|
4270
|
+
* connection or update an exact connection.
|
|
4271
|
+
*/
|
|
4272
|
+
async createDataIntegrationClientCredential(options) {
|
|
4273
|
+
const { slug, ...payload } = options;
|
|
4274
|
+
const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsCreateClientCredentialsConnectionRequest(payload));
|
|
4275
|
+
return deserializeConnectedAccount(data);
|
|
4276
|
+
}
|
|
4277
|
+
/**
|
|
4278
|
+
* Upsert client credentials for a connected account
|
|
4279
|
+
*
|
|
4280
|
+
* 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.
|
|
4281
|
+
* @param options - The request options.
|
|
4282
|
+
* @param options.slug - The identifier of the integration.
|
|
4283
|
+
* @example "salesforce"
|
|
4284
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4285
|
+
* @throws {BadRequestException} 400
|
|
4286
|
+
* @throws {UnauthorizedException} 401
|
|
4287
|
+
* @throws {AuthorizationException} 403
|
|
4288
|
+
* @throws {NotFoundException} 404
|
|
4289
|
+
* @throws {ConflictException} 409
|
|
4290
|
+
* @throws {UnprocessableEntityException} 422
|
|
4291
|
+
*/
|
|
4292
|
+
async updateDataIntegrationClientCredentials(options) {
|
|
4293
|
+
const { slug, ...payload } = options;
|
|
4294
|
+
const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsUpsertClientCredentialsRequest(payload));
|
|
4295
|
+
return deserializeConnectedAccount(data);
|
|
4296
|
+
}
|
|
4297
|
+
/**
|
|
4082
4298
|
* Vend credentials for a connected account
|
|
4083
4299
|
*
|
|
4084
|
-
* Returns credentials for a user
|
|
4300
|
+
* 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`.
|
|
4085
4301
|
* @param options - Object containing userId.
|
|
4086
4302
|
* @param options.slug - The identifier of the integration.
|
|
4087
4303
|
* @example "github"
|
|
4088
|
-
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4304
|
+
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
|
|
4089
4305
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4090
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4306
|
+
* @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`.
|
|
4091
4307
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4308
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4309
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4310
|
+
* @param options.connectionOwner - Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
|
|
4311
|
+
* @example "user"
|
|
4312
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
|
|
4313
|
+
* @example true
|
|
4092
4314
|
* @returns {Promise<DataIntegrationCredentialsResponse>}
|
|
4093
4315
|
* @throws {BadRequestException} 400
|
|
4094
4316
|
* @throws {UnauthorizedException} 401
|
|
4317
|
+
* @throws {AuthorizationException} 403
|
|
4095
4318
|
* @throws {NotFoundException} 404
|
|
4319
|
+
* @throws {ConflictException} 409
|
|
4320
|
+
* @throws {UnprocessableEntityException} 422
|
|
4096
4321
|
*/
|
|
4097
4322
|
async createDataIntegrationCredential(options) {
|
|
4098
4323
|
const { slug, ...payload } = options;
|
|
@@ -4100,20 +4325,79 @@ var Pipes = class {
|
|
|
4100
4325
|
return deserializeDataIntegrationCredentialsResponse(data);
|
|
4101
4326
|
}
|
|
4102
4327
|
/**
|
|
4328
|
+
* Get an organization-owned data integration
|
|
4329
|
+
*
|
|
4330
|
+
* Retrieves the organization-owned data integration for a provider by its slug. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
|
|
4331
|
+
* @param options - The request options.
|
|
4332
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4333
|
+
* @example "github"
|
|
4334
|
+
* @returns {Promise<DataIntegration>}
|
|
4335
|
+
* @throws {UnauthorizedException} 401
|
|
4336
|
+
* @throws {NotFoundException} 404
|
|
4337
|
+
*/
|
|
4338
|
+
async getOrganizationDataIntegration(options) {
|
|
4339
|
+
const { slug } = options;
|
|
4340
|
+
const { data } = await this.workos.get(`/data-integrations/${encodeURIComponent(slug)}/organization`);
|
|
4341
|
+
return deserializeDataIntegration(data);
|
|
4342
|
+
}
|
|
4343
|
+
/**
|
|
4344
|
+
* Update an organization-owned data integration
|
|
4345
|
+
*
|
|
4346
|
+
* 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.
|
|
4347
|
+
* @param options - The request options.
|
|
4348
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4349
|
+
* @example "github"
|
|
4350
|
+
* @returns {Promise<DataIntegration>}
|
|
4351
|
+
* @throws {BadRequestException} 400
|
|
4352
|
+
* @throws {UnauthorizedException} 401
|
|
4353
|
+
* @throws {AuthorizationException} 403
|
|
4354
|
+
* @throws {NotFoundException} 404
|
|
4355
|
+
* @throws {ConflictException} 409
|
|
4356
|
+
* @throws {UnprocessableEntityException} 422
|
|
4357
|
+
*/
|
|
4358
|
+
async updateOrganizationDataIntegration(options) {
|
|
4359
|
+
const { slug, ...payload } = options;
|
|
4360
|
+
const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/organization`, serializeUpdateDataIntegration(payload));
|
|
4361
|
+
return deserializeDataIntegration(data);
|
|
4362
|
+
}
|
|
4363
|
+
/**
|
|
4364
|
+
* Delete an organization-owned data integration
|
|
4365
|
+
*
|
|
4366
|
+
* Deletes the organization-owned data integration for a provider and all of its connected installations. For a custom provider, the provider definition is deleted once no user-owned root references it either. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
|
|
4367
|
+
* @param options - The request options.
|
|
4368
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4369
|
+
* @example "github"
|
|
4370
|
+
* @returns {Promise<void>}
|
|
4371
|
+
* @throws {UnauthorizedException} 401
|
|
4372
|
+
* @throws {NotFoundException} 404
|
|
4373
|
+
*/
|
|
4374
|
+
async deleteOrganizationDataIntegration(options) {
|
|
4375
|
+
const { slug } = options;
|
|
4376
|
+
await this.workos.delete(`/data-integrations/${encodeURIComponent(slug)}/organization`);
|
|
4377
|
+
}
|
|
4378
|
+
/**
|
|
4103
4379
|
* Get an access token for a connected account
|
|
4104
4380
|
*
|
|
4105
4381
|
* Fetches a valid OAuth access token for a user's connected account. WorkOS automatically handles token refresh, ensuring you always receive a valid, non-expired token.
|
|
4106
4382
|
* @param options - Object containing userId.
|
|
4107
4383
|
* @param options.provider - The identifier of the integration.
|
|
4108
4384
|
* @example "github"
|
|
4109
|
-
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4385
|
+
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
|
|
4110
4386
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4111
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4387
|
+
* @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`.
|
|
4112
4388
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4389
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4390
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4391
|
+
* @param options.connectionOwner - Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
|
|
4392
|
+
* @example "user"
|
|
4393
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
|
|
4394
|
+
* @example true
|
|
4113
4395
|
* @returns {Promise<DataIntegrationAccessTokenResponse>}
|
|
4114
4396
|
* @throws {BadRequestException} 400
|
|
4115
4397
|
* @throws {UnauthorizedException} 401
|
|
4398
|
+
* @throws {AuthorizationException} 403
|
|
4116
4399
|
* @throws {NotFoundException} 404
|
|
4400
|
+
* @throws {ConflictException} 409
|
|
4117
4401
|
* @throws {UnprocessableEntityException} 422
|
|
4118
4402
|
*/
|
|
4119
4403
|
async getAccessToken(options) {
|
|
@@ -4122,6 +4406,128 @@ var Pipes = class {
|
|
|
4122
4406
|
return deserializeDataIntegrationAccessTokenResponse(data);
|
|
4123
4407
|
}
|
|
4124
4408
|
/**
|
|
4409
|
+
* Get an organization connected account
|
|
4410
|
+
*
|
|
4411
|
+
* Retrieves an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) for a specific provider.
|
|
4412
|
+
* @param options - Additional query options.
|
|
4413
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4414
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4415
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4416
|
+
* @example "github"
|
|
4417
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4418
|
+
* @example true
|
|
4419
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the organization has several for this provider.
|
|
4420
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4421
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4422
|
+
* @throws {BadRequestException} 400
|
|
4423
|
+
* @throws {UnauthorizedException} 401
|
|
4424
|
+
* @throws {NotFoundException} 404
|
|
4425
|
+
* @throws {ConflictException} 409
|
|
4426
|
+
*/
|
|
4427
|
+
async getOrganizationConnectedAccount(options) {
|
|
4428
|
+
const { organizationId, slug } = options;
|
|
4429
|
+
const { data } = await this.workos.get(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4430
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
|
|
4431
|
+
...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId }
|
|
4432
|
+
} });
|
|
4433
|
+
return deserializeConnectedAccount(data);
|
|
4434
|
+
}
|
|
4435
|
+
/**
|
|
4436
|
+
* Import an organization connected account
|
|
4437
|
+
*
|
|
4438
|
+
* 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.
|
|
4439
|
+
* @param options - The request options.
|
|
4440
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4441
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4442
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4443
|
+
* @example "github"
|
|
4444
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4445
|
+
* @throws {UnauthorizedException} 401
|
|
4446
|
+
* @throws {AuthorizationException} 403
|
|
4447
|
+
* @throws {NotFoundException} 404
|
|
4448
|
+
* @throws {ConflictException} 409
|
|
4449
|
+
* @throws {UnprocessableEntityException} 422
|
|
4450
|
+
*/
|
|
4451
|
+
async createOrganizationConnectedAccount(options) {
|
|
4452
|
+
const { organizationId, slug, ...payload } = options;
|
|
4453
|
+
const { data } = await this.workos.post(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateOrganizationConnectedAccount(payload));
|
|
4454
|
+
return deserializeConnectedAccount(data);
|
|
4455
|
+
}
|
|
4456
|
+
/**
|
|
4457
|
+
* Update an organization connected account
|
|
4458
|
+
*
|
|
4459
|
+
* Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider.
|
|
4460
|
+
* @param options - Additional query options.
|
|
4461
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4462
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4463
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4464
|
+
* @example "github"
|
|
4465
|
+
* @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
|
|
4466
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
|
|
4467
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4468
|
+
* @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
|
|
4469
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4470
|
+
* @throws {BadRequestException} 400
|
|
4471
|
+
* @throws {UnauthorizedException} 401
|
|
4472
|
+
* @throws {AuthorizationException} 403
|
|
4473
|
+
* @throws {NotFoundException} 404
|
|
4474
|
+
* @throws {ConflictException} 409
|
|
4475
|
+
* @throws {UnprocessableEntityException} 422
|
|
4476
|
+
*/
|
|
4477
|
+
async updateOrganizationConnectedAccount(options) {
|
|
4478
|
+
const { organizationId, slug, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
|
|
4479
|
+
const { data } = await this.workos.put(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeOrganizationConnectedAccount(payload), { query: {
|
|
4480
|
+
supports_multiple_connections: supportsMultipleConnections,
|
|
4481
|
+
connected_account_id: connectedAccountId,
|
|
4482
|
+
connection_intent: connectionIntent
|
|
4483
|
+
} });
|
|
4484
|
+
return deserializeConnectedAccount(data);
|
|
4485
|
+
}
|
|
4486
|
+
/**
|
|
4487
|
+
* Delete an organization connected account
|
|
4488
|
+
*
|
|
4489
|
+
* 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.
|
|
4490
|
+
* @param options - Additional query options.
|
|
4491
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4492
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4493
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4494
|
+
* @example "github"
|
|
4495
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4496
|
+
* @example true
|
|
4497
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
|
|
4498
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4499
|
+
* @returns {Promise<void>}
|
|
4500
|
+
* @throws {BadRequestException} 400
|
|
4501
|
+
* @throws {UnauthorizedException} 401
|
|
4502
|
+
* @throws {NotFoundException} 404
|
|
4503
|
+
* @throws {ConflictException} 409
|
|
4504
|
+
*/
|
|
4505
|
+
async deleteOrganizationConnectedAccount(options) {
|
|
4506
|
+
const { organizationId, slug } = options;
|
|
4507
|
+
await this.workos.delete(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
4508
|
+
supports_multiple_connections: options.supportsMultipleConnections,
|
|
4509
|
+
connected_account_id: options.connectedAccountId
|
|
4510
|
+
});
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* List providers for an organization
|
|
4514
|
+
*
|
|
4515
|
+
* 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.
|
|
4516
|
+
* @param options - Additional query options.
|
|
4517
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for.
|
|
4518
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4519
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4520
|
+
* @example true
|
|
4521
|
+
* @returns {Promise<DataIntegrationsListResponse>}
|
|
4522
|
+
* @throws {UnauthorizedException} 401
|
|
4523
|
+
* @throws {NotFoundException} 404
|
|
4524
|
+
*/
|
|
4525
|
+
async listOrganizationDataProviders(options) {
|
|
4526
|
+
const { organizationId } = options;
|
|
4527
|
+
const { data } = await this.workos.get(`/organizations/${encodeURIComponent(organizationId)}/data_providers`, { query: { ...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections } } });
|
|
4528
|
+
return deserializeDataIntegrationsListResponse(data);
|
|
4529
|
+
}
|
|
4530
|
+
/**
|
|
4125
4531
|
* Get a connected account
|
|
4126
4532
|
*
|
|
4127
4533
|
* Retrieves a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) for a specific provider.
|
|
@@ -4132,19 +4538,29 @@ var Pipes = class {
|
|
|
4132
4538
|
* @example "github"
|
|
4133
4539
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4134
4540
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4541
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4542
|
+
* @example true
|
|
4543
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4544
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4135
4545
|
* @returns {Promise<ConnectedAccount>}
|
|
4546
|
+
* @throws {BadRequestException} 400
|
|
4136
4547
|
* @throws {UnauthorizedException} 401
|
|
4137
4548
|
* @throws {NotFoundException} 404
|
|
4549
|
+
* @throws {ConflictException} 409
|
|
4138
4550
|
*/
|
|
4139
4551
|
async getUserConnectedAccount(options) {
|
|
4140
4552
|
const { userId, slug } = options;
|
|
4141
|
-
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4553
|
+
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4554
|
+
...options.organizationId !== void 0 && { organization_id: options.organizationId },
|
|
4555
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
|
|
4556
|
+
...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId }
|
|
4557
|
+
} });
|
|
4142
4558
|
return deserializeConnectedAccount(data);
|
|
4143
4559
|
}
|
|
4144
4560
|
/**
|
|
4145
4561
|
* Import a connected account
|
|
4146
4562
|
*
|
|
4147
|
-
* Imports a [connected account](https://workos.com/docs/reference/pipes/connected-account) for a user by providing OAuth tokens directly.
|
|
4563
|
+
* 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.
|
|
4148
4564
|
* @param options - The request body.
|
|
4149
4565
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4150
4566
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
@@ -4170,7 +4586,7 @@ var Pipes = class {
|
|
|
4170
4586
|
*/
|
|
4171
4587
|
async createUserConnectedAccount(options) {
|
|
4172
4588
|
const { userId, slug, organizationId, ...payload } = options;
|
|
4173
|
-
const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`,
|
|
4589
|
+
const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateConnectedAccount(payload), { query: { organization_id: organizationId } });
|
|
4174
4590
|
return deserializeConnectedAccount(data);
|
|
4175
4591
|
}
|
|
4176
4592
|
/**
|
|
@@ -4184,6 +4600,10 @@ var Pipes = class {
|
|
|
4184
4600
|
* @example "github"
|
|
4185
4601
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4186
4602
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4603
|
+
* @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
|
|
4604
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
|
|
4605
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4606
|
+
* @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
|
|
4187
4607
|
* @param options.accessToken - The OAuth access token for the connected account.
|
|
4188
4608
|
* @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
|
|
4189
4609
|
* @param options.refreshToken - The OAuth refresh token for the connected account.
|
|
@@ -4195,18 +4615,26 @@ var Pipes = class {
|
|
|
4195
4615
|
* @param options.state - Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
|
|
4196
4616
|
* @example "connected"
|
|
4197
4617
|
* @returns {Promise<ConnectedAccount>}
|
|
4618
|
+
* @throws {BadRequestException} 400
|
|
4198
4619
|
* @throws {UnauthorizedException} 401
|
|
4199
4620
|
* @throws {NotFoundException} 404
|
|
4621
|
+
* @throws {ConflictException} 409
|
|
4622
|
+
* @throws {UnprocessableEntityException} 422
|
|
4200
4623
|
*/
|
|
4201
4624
|
async updateUserConnectedAccount(options) {
|
|
4202
|
-
const { userId, slug, organizationId, ...payload } = options;
|
|
4203
|
-
const { data } = await this.workos.put(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`,
|
|
4625
|
+
const { userId, slug, organizationId, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
|
|
4626
|
+
const { data } = await this.workos.put(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeConnectedAccountInput(payload), { query: {
|
|
4627
|
+
organization_id: organizationId,
|
|
4628
|
+
supports_multiple_connections: supportsMultipleConnections,
|
|
4629
|
+
connected_account_id: connectedAccountId,
|
|
4630
|
+
connection_intent: connectionIntent
|
|
4631
|
+
} });
|
|
4204
4632
|
return deserializeConnectedAccount(data);
|
|
4205
4633
|
}
|
|
4206
4634
|
/**
|
|
4207
4635
|
* Delete a connected account
|
|
4208
4636
|
*
|
|
4209
|
-
* 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.
|
|
4637
|
+
* 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.
|
|
4210
4638
|
* @param options - Additional query options.
|
|
4211
4639
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4212
4640
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
@@ -4214,13 +4642,23 @@ var Pipes = class {
|
|
|
4214
4642
|
* @example "github"
|
|
4215
4643
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4216
4644
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4645
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4646
|
+
* @example true
|
|
4647
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
|
|
4648
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4217
4649
|
* @returns {Promise<void>}
|
|
4650
|
+
* @throws {BadRequestException} 400
|
|
4218
4651
|
* @throws {UnauthorizedException} 401
|
|
4219
4652
|
* @throws {NotFoundException} 404
|
|
4653
|
+
* @throws {ConflictException} 409
|
|
4220
4654
|
*/
|
|
4221
4655
|
async deleteUserConnectedAccount(options) {
|
|
4222
4656
|
const { userId, slug } = options;
|
|
4223
|
-
await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
4657
|
+
await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
4658
|
+
organization_id: options.organizationId,
|
|
4659
|
+
supports_multiple_connections: options.supportsMultipleConnections,
|
|
4660
|
+
connected_account_id: options.connectedAccountId
|
|
4661
|
+
});
|
|
4224
4662
|
}
|
|
4225
4663
|
/**
|
|
4226
4664
|
* List providers for a user
|
|
@@ -4231,13 +4669,18 @@ var Pipes = class {
|
|
|
4231
4669
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4232
4670
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization.
|
|
4233
4671
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4672
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4673
|
+
* @example true
|
|
4234
4674
|
* @returns {Promise<DataIntegrationsListResponse>}
|
|
4235
4675
|
* @throws {UnauthorizedException} 401
|
|
4236
4676
|
* @throws {NotFoundException} 404
|
|
4237
4677
|
*/
|
|
4238
4678
|
async listUserDataProviders(options) {
|
|
4239
4679
|
const { userId } = options;
|
|
4240
|
-
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/data_providers`, { query: {
|
|
4680
|
+
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/data_providers`, { query: {
|
|
4681
|
+
...options.organizationId !== void 0 && { organization_id: options.organizationId },
|
|
4682
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections }
|
|
4683
|
+
} });
|
|
4241
4684
|
return deserializeDataIntegrationsListResponse(data);
|
|
4242
4685
|
}
|
|
4243
4686
|
};
|
|
@@ -8840,7 +9283,7 @@ var Vault = class {
|
|
|
8840
9283
|
};
|
|
8841
9284
|
//#endregion
|
|
8842
9285
|
//#region package.json
|
|
8843
|
-
var version = "
|
|
9286
|
+
var version = "11.0.0";
|
|
8844
9287
|
//#endregion
|
|
8845
9288
|
//#region src/workos.ts
|
|
8846
9289
|
const DEFAULT_HOSTNAME = "api.workos.com";
|
|
@@ -9442,4 +9885,4 @@ Object.defineProperty(exports, "serializeRevokeSessionOptions", {
|
|
|
9442
9885
|
}
|
|
9443
9886
|
});
|
|
9444
9887
|
|
|
9445
|
-
//# sourceMappingURL=factory-
|
|
9888
|
+
//# sourceMappingURL=factory-DJd6WXWm.cjs.map
|