diff --git a/.changeset/quick-pugs-tap.md b/.changeset/quick-pugs-tap.md new file mode 100644 index 00000000000..9c763b798b2 --- /dev/null +++ b/.changeset/quick-pugs-tap.md @@ -0,0 +1,8 @@ +--- +'@clerk/clerk-js': patch +'@clerk/shared': patch +--- + +Remove deprecated `createEnterpriseConnection`, `updateEnterpriseConnection`, `deleteEnterpriseConnection`, `createEnterpriseConnectionTestRun`, and `getEnterpriseConnectionTestRuns` methods from the `User` resource in favor of `Organization` scoped ones. Also removes the unused internal `__internal_useEnterpriseConnectionTestRuns` hook. + +`ConfigureSSO` was previously the only consumer but since it hasn't been released GA yet, these changes won't break existing production clients diff --git a/packages/clerk-js/src/core/resources/User.ts b/packages/clerk-js/src/core/resources/User.ts index a88775a87ca..76e2b01ef3c 100644 --- a/packages/clerk-js/src/core/resources/User.ts +++ b/packages/clerk-js/src/core/resources/User.ts @@ -2,10 +2,8 @@ import { getFullName } from '@clerk/shared/internal/clerk-js/user'; import type { BackupCodeJSON, BackupCodeResource, - ClerkPaginatedResponse, CreateEmailAddressParams, CreateExternalAccountParams, - CreateOrganizationEnterpriseConnectionParams, CreatePhoneNumberParams, CreateWeb3WalletParams, DeletedObjectJSON, @@ -14,15 +12,9 @@ import type { EnterpriseAccountResource, EnterpriseConnectionJSON, EnterpriseConnectionResource, - EnterpriseConnectionTestRunInitJSON, - EnterpriseConnectionTestRunInitResource, - EnterpriseConnectionTestRunJSON, - EnterpriseConnectionTestRunResource, - EnterpriseConnectionTestRunsPaginatedJSON, ExternalAccountJSON, ExternalAccountResource, GetEnterpriseConnectionsParams, - GetEnterpriseConnectionTestRunsParams, GetOrganizationMemberships, GetUserOrganizationInvitationsParams, GetUserOrganizationSuggestionsParams, @@ -34,7 +26,6 @@ import type { SetProfileImageParams, TOTPJSON, TOTPResource, - UpdateOrganizationEnterpriseConnectionParams, UpdateUserMetadataParams, UpdateUserParams, UpdateUserPasswordParams, @@ -45,9 +36,7 @@ import type { Web3WalletResource, } from '@clerk/shared/types'; -import { convertPageToOffsetSearchParams } from '../../utils/convertPageToOffsetSearchParams'; import { unixEpochToDate } from '../../utils/date'; -import { toEnterpriseConnectionBody } from '../../utils/enterpriseConnection'; import { normalizeUnsafeMetadata } from '../../utils/resourceParams'; import { eventBus, events } from '../events'; import { addPaymentMethod, getPaymentMethods, initializePaymentMethod } from '../modules/billing'; @@ -58,7 +47,6 @@ import { EmailAddress, EnterpriseAccount, EnterpriseConnection, - EnterpriseConnectionTestRun, ExternalAccount, Image, OrganizationMembership, @@ -336,85 +324,6 @@ export class User extends BaseResource implements UserResource { return (json || []).map(connection => new EnterpriseConnection(connection)); }; - createEnterpriseConnection = async ( - params: CreateOrganizationEnterpriseConnectionParams, - ): Promise => { - const json = ( - await BaseResource._fetch({ - path: `${this.path()}/enterprise_connections`, - method: 'POST', - body: toEnterpriseConnectionBody(params) as any, - }) - )?.response as unknown as EnterpriseConnectionJSON; - - return new EnterpriseConnection(json); - }; - - updateEnterpriseConnection = async ( - enterpriseConnectionId: string, - params: UpdateOrganizationEnterpriseConnectionParams, - ): Promise => { - const json = ( - await BaseResource._fetch({ - path: `${this.path()}/enterprise_connections/${enterpriseConnectionId}`, - method: 'PATCH', - body: toEnterpriseConnectionBody(params) as any, - }) - )?.response as unknown as EnterpriseConnectionJSON; - - return new EnterpriseConnection(json); - }; - - deleteEnterpriseConnection = async (enterpriseConnectionId: string): Promise => { - const json = ( - await BaseResource._fetch({ - path: `${this.path()}/enterprise_connections/${enterpriseConnectionId}`, - method: 'DELETE', - }) - )?.response as unknown as DeletedObjectJSON; - - return new DeletedObject(json); - }; - - createEnterpriseConnectionTestRun = async ( - enterpriseConnectionId: string, - ): Promise => { - const json = ( - await BaseResource._fetch({ - path: `${this.path()}/enterprise_connections/${enterpriseConnectionId}/test_runs`, - method: 'POST', - }) - )?.response as unknown as EnterpriseConnectionTestRunInitJSON; - - return { url: json.url }; - }; - - getEnterpriseConnectionTestRuns = async ( - enterpriseConnectionId: string, - params?: GetEnterpriseConnectionTestRunsParams, - ): Promise> => { - const { status, ...rest } = params || {}; - const search = convertPageToOffsetSearchParams(rest); - if (status?.length) { - for (const s of status) { - search.append('status', s); - } - } - - const res = await BaseResource._fetch({ - path: `${this.path()}/enterprise_connections/${enterpriseConnectionId}/test_runs`, - method: 'GET', - search, - }); - - const payload = res?.response as unknown as EnterpriseConnectionTestRunsPaginatedJSON | undefined; - - return { - total_count: payload?.total_count ?? 0, - data: (payload?.data ?? []).map((row: EnterpriseConnectionTestRunJSON) => new EnterpriseConnectionTestRun(row)), - }; - }; - initializePaymentMethod: typeof initializePaymentMethod = params => { return initializePaymentMethod(params); }; diff --git a/packages/clerk-js/src/core/resources/__tests__/User.test.ts b/packages/clerk-js/src/core/resources/__tests__/User.test.ts index 20e8074cf16..7dd237a3d5b 100644 --- a/packages/clerk-js/src/core/resources/__tests__/User.test.ts +++ b/packages/clerk-js/src/core/resources/__tests__/User.test.ts @@ -139,327 +139,6 @@ describe('User', () => { expect(connections[0].allowOrganizationAccountLinking).toBe(true); }); - it('creates an enterprise connection', async () => { - const enterpriseConnectionJSON = { - id: 'ec_new', - object: 'enterprise_connection' as const, - name: 'New SSO', - active: true, - provider: 'saml_okta', - logo_public_url: null, - domains: ['acme.com'], - organization_id: null, - sync_user_attributes: true, - disable_additional_identifications: false, - allow_organization_account_linking: false, - custom_attributes: [], - oauth_config: null, - saml_connection: null, - created_at: 1234567890, - updated_at: 1234567890, - }; - - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue(Promise.resolve({ response: enterpriseConnectionJSON })); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - const conn = await user.createEnterpriseConnection({ - provider: 'saml_okta', - name: 'New SSO', - organizationId: 'org_1', - saml: { idpEntityId: 'https://idp.example.com' }, - }); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'POST', - path: '/me/enterprise_connections', - body: { - provider: 'saml_okta', - name: 'New SSO', - organization_id: 'org_1', - saml_idp_entity_id: 'https://idp.example.com', - }, - }); - - expect(conn.id).toBe('ec_new'); - expect(conn.name).toBe('New SSO'); - }); - - it('updates an enterprise connection', async () => { - const enterpriseConnectionJSON = { - id: 'ec_123', - object: 'enterprise_connection' as const, - name: 'Updated', - active: false, - provider: 'saml_okta', - logo_public_url: null, - domains: ['acme.com'], - organization_id: null, - sync_user_attributes: true, - disable_additional_identifications: false, - allow_organization_account_linking: false, - custom_attributes: [], - oauth_config: null, - saml_connection: null, - created_at: 1234567890, - updated_at: 1234567900, - }; - - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue(Promise.resolve({ response: enterpriseConnectionJSON })); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - await user.updateEnterpriseConnection('ec_123', { - name: 'Updated', - active: false, - syncUserAttributes: true, - }); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'PATCH', - path: '/me/enterprise_connections/ec_123', - body: { - name: 'Updated', - active: false, - sync_user_attributes: true, - }, - }); - }); - - it('preserves `saml.attributeMapping` and `saml.customAttributes` keys when creating an enterprise connection', async () => { - BaseResource._fetch = vi.fn().mockReturnValue( - Promise.resolve({ - response: { - id: 'ec_new', - object: 'enterprise_connection' as const, - name: 'New SSO', - active: true, - provider: 'saml_okta', - logo_public_url: null, - domains: [], - organization_id: null, - sync_user_attributes: true, - disable_additional_identifications: false, - allow_organization_account_linking: false, - custom_attributes: [], - oauth_config: null, - saml_connection: null, - created_at: 1, - updated_at: 1, - }, - }), - ); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - await user.createEnterpriseConnection({ - provider: 'saml_okta', - name: 'New SSO', - saml: { - idpEntityId: 'https://idp.example.com', - attributeMapping: { - emailAddress: 'mail', - firstName: 'givenName', - 'custom:role': 'role', - }, - }, - }); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'POST', - path: '/me/enterprise_connections', - body: { - provider: 'saml_okta', - name: 'New SSO', - saml_idp_entity_id: 'https://idp.example.com', - saml_attribute_mapping: { - emailAddress: 'mail', - firstName: 'givenName', - 'custom:role': 'role', - }, - }, - }); - }); - - it('preserves `customAttributes` and `saml.attributeMapping` keys when updating an enterprise connection', async () => { - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue( - Promise.resolve({ - response: { - id: 'ec_123', - object: 'enterprise_connection' as const, - name: 'Updated', - active: true, - provider: 'saml_okta', - logo_public_url: null, - domains: [], - organization_id: null, - sync_user_attributes: true, - disable_additional_identifications: false, - allow_organization_account_linking: false, - custom_attributes: [], - oauth_config: null, - saml_connection: null, - created_at: 1, - updated_at: 2, - }, - }), - ); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - await user.updateEnterpriseConnection('ec_123', { - customAttributes: { - MyClaim: 'x', - CustomValue: 'y', - nestedCamelKey: { innerCamelKey: 'z' }, - }, - saml: { - attributeMapping: { - emailAddress: 'mail', - firstName: 'givenName', - }, - }, - }); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'PATCH', - path: '/me/enterprise_connections/ec_123', - body: { - custom_attributes: { - MyClaim: 'x', - CustomValue: 'y', - nestedCamelKey: { innerCamelKey: 'z' }, - }, - saml_attribute_mapping: { - emailAddress: 'mail', - firstName: 'givenName', - }, - }, - }); - }); - - it('deletes an enterprise connection', async () => { - const deletedJSON = { - object: 'enterprise_connection', - id: 'ec_123', - deleted: true, - }; - - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue(Promise.resolve({ response: deletedJSON })); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - const result = await user.deleteEnterpriseConnection('ec_123'); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'DELETE', - path: '/me/enterprise_connections/ec_123', - }); - - expect(result.id).toBe('ec_123'); - expect(result.deleted).toBe(true); - }); - - it('creates an enterprise connection test run', async () => { - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue(Promise.resolve({ response: { url: 'https://example.com/test' } })); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - const init = await user.createEnterpriseConnectionTestRun('ec_123'); - - // @ts-ignore - expect(BaseResource._fetch).toHaveBeenCalledWith({ - method: 'POST', - path: '/me/enterprise_connections/ec_123/test_runs', - }); - - expect(init.url).toBe('https://example.com/test'); - }); - - it('lists enterprise connection test runs', async () => { - const paginated = { - data: [ - { - object: 'enterprise_connection_test_run' as const, - id: 'run_1', - status: 'success', - connection_type: 'saml' as const, - created_at: 1700000000000, - }, - ], - total_count: 1, - }; - - // @ts-ignore - BaseResource._fetch = vi.fn().mockReturnValue(Promise.resolve({ response: paginated })); - - const user = new User({ - email_addresses: [], - phone_numbers: [], - web3_wallets: [], - external_accounts: [], - } as unknown as UserJSON); - - const result = await user.getEnterpriseConnectionTestRuns('ec_123', { - initialPage: 1, - pageSize: 10, - status: ['pending', 'success'], - }); - - // @ts-ignore - const call = BaseResource._fetch.mock.calls[0][0]; - expect(call.method).toBe('GET'); - expect(call.path).toBe('/me/enterprise_connections/ec_123/test_runs'); - expect(call.search.get('limit')).toBe('10'); - expect(call.search.get('offset')).toBe('0'); - expect(call.search.getAll('status')).toEqual(['pending', 'success']); - - expect(result.total_count).toBe(1); - expect(result.data).toHaveLength(1); - expect(result.data[0].id).toBe('run_1'); - expect(result.data[0].connectionType).toBe('saml'); - }); - it('creates a web3 wallet', async () => { const targetWeb3Wallet = '0x0000000000000000000000000000000000000000'; const web3WalletJSON = { diff --git a/packages/shared/src/react/hooks/index.ts b/packages/shared/src/react/hooks/index.ts index 020bad2f0b3..e4ab76177bb 100644 --- a/packages/shared/src/react/hooks/index.ts +++ b/packages/shared/src/react/hooks/index.ts @@ -38,11 +38,6 @@ export type { UseUserEnterpriseConnectionsParams, UseUserEnterpriseConnectionsReturn, } from './useUserEnterpriseConnections'; -export { __internal_useEnterpriseConnectionTestRuns } from './useEnterpriseConnectionTestRuns'; -export type { - UseEnterpriseConnectionTestRunsParams, - UseEnterpriseConnectionTestRunsReturn, -} from './useEnterpriseConnectionTestRuns'; export { __internal_useOrganizationEnterpriseConnections } from './useOrganizationEnterpriseConnections'; export type { UseOrganizationEnterpriseConnectionsParams, diff --git a/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.shared.ts b/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.shared.ts deleted file mode 100644 index 8cd18085106..00000000000 --- a/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.shared.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { useMemo } from 'react'; - -import type { GetEnterpriseConnectionTestRunsParams } from '../../types/enterpriseConnectionTestRun'; -import { INTERNAL_STABLE_KEYS } from '../stable-keys'; -import { createCacheKeys } from './createCacheKeys'; - -/** - * @internal - */ -export function useEnterpriseConnectionTestRunsCacheKeys(params: { - userId: string | null; - enterpriseConnectionId: string | null; - args: GetEnterpriseConnectionTestRunsParams; -}) { - const { userId, enterpriseConnectionId, args } = params; - return useMemo(() => { - return createCacheKeys({ - stablePrefix: INTERNAL_STABLE_KEYS.ENTERPRISE_CONNECTION_TEST_RUNS_KEY, - authenticated: Boolean(userId), - tracked: { - userId: userId ?? null, - enterpriseConnectionId: enterpriseConnectionId ?? null, - }, - untracked: { - args, - }, - }); - // The args object is intentionally serialized via the consumer to keep stability. - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [userId, enterpriseConnectionId, JSON.stringify(args)]); -} diff --git a/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.tsx b/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.tsx deleted file mode 100644 index 6787312e9fe..00000000000 --- a/packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import { useCallback, useEffect, useState } from 'react'; - -import type { - EnterpriseConnectionTestRunResource, - GetEnterpriseConnectionTestRunsParams, -} from '../../types/enterpriseConnectionTestRun'; -import { useClerkInstanceContext } from '../contexts'; -import { useClerkQueryClient } from '../query/use-clerk-query-client'; -import { useClerkQuery } from '../query/useQuery'; -import { useUserBase } from './base/useUserBase'; -import { useClearQueriesOnSignOut } from './useClearQueriesOnSignOut'; -import { useEnterpriseConnectionTestRunsCacheKeys } from './useEnterpriseConnectionTestRuns.shared'; - -const DEFAULT_POLL_INTERVAL_MS = 2_000; - -export type UseEnterpriseConnectionTestRunsParams = { - enterpriseConnectionId: string | null; - /** - * Pass-through fetch parameters (pagination, status filter). - * Defaults to `{ initialPage: 1, pageSize: 10 }`. - */ - params?: GetEnterpriseConnectionTestRunsParams; - /** - * Polling interval (ms) applied between `revalidate()` and the moment the - * first record arrives in the response. - * - * @default 2000 - */ - pollIntervalMs?: number; - /** - * If `false`, the hook is dormant — no fetch, no polling. - * - * @default true - */ - enabled?: boolean; -}; - -export type UseEnterpriseConnectionTestRunsReturn = { - data: EnterpriseConnectionTestRunResource[] | undefined; - totalCount: number | undefined; - error: Error | null; - isLoading: boolean; - isFetching: boolean; - /** - * `true` while the hook is actively polling for the first record to appear - */ - isPolling: boolean; - /** - * Force a refetch and (if the list is currently empty) arm polling - */ - revalidate: () => Promise; -}; - -/** - * Subscribes to the list of enterprise-connection test runs for the signed-in user - * - * @internal - */ -function useEnterpriseConnectionTestRuns( - params: UseEnterpriseConnectionTestRunsParams, -): UseEnterpriseConnectionTestRunsReturn { - const { - enterpriseConnectionId, - params: fetchParams = { initialPage: 1, pageSize: 10 }, - pollIntervalMs = DEFAULT_POLL_INTERVAL_MS, - enabled = true, - } = params; - - const clerk = useClerkInstanceContext(); - const user = useUserBase(); - const [queryClient] = useClerkQueryClient(); - - const { queryKey, invalidationKey, stableKey, authenticated } = useEnterpriseConnectionTestRunsCacheKeys({ - userId: user?.id ?? null, - enterpriseConnectionId, - args: fetchParams, - }); - - useClearQueriesOnSignOut({ - isSignedOut: user === null, - authenticated, - stableKeys: stableKey, - }); - - const queryEnabled = enabled && clerk.loaded && Boolean(user) && Boolean(enterpriseConnectionId); - - const [shouldPoll, setShouldPoll] = useState(false); - - const query = useClerkQuery({ - queryKey, - queryFn: () => { - if (!enterpriseConnectionId) { - throw new Error('enterpriseConnectionId is required to fetch test runs'); - } - return user?.getEnterpriseConnectionTestRuns(enterpriseConnectionId, fetchParams); - }, - refetchInterval: q => { - if (!shouldPoll) { - return false; - } - - const hasRows = (q.state.data?.data?.length ?? 0) > 0; - return hasRows ? false : pollIntervalMs; - }, - enabled: queryEnabled, - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - }); - - const hasRows = (query.data?.data?.length ?? 0) > 0; - - useEffect(() => { - if (shouldPoll && hasRows) { - setShouldPoll(false); - } - }, [shouldPoll, hasRows]); - - const revalidate = useCallback(async () => { - // Only arm polling when there is nothing in the list yet — once any record - // has been seen, this is a one-shot refetch. - if (!hasRows) { - setShouldPoll(true); - } - await queryClient.invalidateQueries({ queryKey: invalidationKey }); - }, [queryClient, invalidationKey, hasRows]); - - const isPolling = queryEnabled && shouldPoll && !hasRows; - - return { - data: query.data?.data, - totalCount: query.data?.total_count, - error: query.error ?? null, - isLoading: query.isLoading, - isFetching: query.isFetching, - isPolling, - revalidate, - }; -} - -export { useEnterpriseConnectionTestRuns as __internal_useEnterpriseConnectionTestRuns }; diff --git a/packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx b/packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx index a80e03213b1..681e33ea2e8 100644 --- a/packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx +++ b/packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx @@ -1,11 +1,6 @@ import { useCallback } from 'react'; -import type { DeletedObjectResource } from '../../types/deletedObject'; -import type { - CreateMeEnterpriseConnectionParams, - EnterpriseConnectionResource, - UpdateMeEnterpriseConnectionParams, -} from '../../types/enterpriseConnection'; +import type { EnterpriseConnectionResource } from '../../types/enterpriseConnection'; import { useClerkInstanceContext } from '../contexts'; import { defineKeepPreviousDataFn } from '../query/keep-previous-data'; import { useClerkQueryClient } from '../query/use-clerk-query-client'; @@ -25,14 +20,6 @@ export type UseUserEnterpriseConnectionsReturn = { error: Error | null; isLoading: boolean; isFetching: boolean; - createEnterpriseConnection: ( - params: CreateMeEnterpriseConnectionParams, - ) => Promise; - updateEnterpriseConnection: ( - enterpriseConnectionId: string, - params: UpdateMeEnterpriseConnectionParams, - ) => Promise; - deleteEnterpriseConnection: (enterpriseConnectionId: string) => Promise; revalidate: () => Promise; }; @@ -74,41 +61,11 @@ function useUserEnterpriseConnections( [queryClient, stableKey], ); - const createEnterpriseConnection = useCallback( - async (createParams: CreateMeEnterpriseConnectionParams) => { - const created = await user?.createEnterpriseConnection(createParams); - await revalidate(); - return created; - }, - [user, revalidate], - ); - - const updateEnterpriseConnection = useCallback( - async (enterpriseConnectionId: string, updateParams: UpdateMeEnterpriseConnectionParams) => { - const updated = await user?.updateEnterpriseConnection(enterpriseConnectionId, updateParams); - await revalidate(); - return updated; - }, - [user, revalidate], - ); - - const deleteEnterpriseConnection = useCallback( - async (enterpriseConnectionId: string) => { - const deleted = await user?.deleteEnterpriseConnection(enterpriseConnectionId); - await revalidate(); - return deleted; - }, - [user, revalidate], - ); - return { data: query.data, error: query.error ?? null, isLoading: query.isLoading, isFetching: query.isFetching, - createEnterpriseConnection, - updateEnterpriseConnection, - deleteEnterpriseConnection, revalidate, }; } diff --git a/packages/shared/src/types/user.ts b/packages/shared/src/types/user.ts index f3e8905be64..ed595f1738c 100644 --- a/packages/shared/src/types/user.ts +++ b/packages/shared/src/types/user.ts @@ -3,16 +3,7 @@ import type { BillingPayerMethods } from './billing'; import type { DeletedObjectResource } from './deletedObject'; import type { EmailAddressResource } from './emailAddress'; import type { EnterpriseAccountResource } from './enterpriseAccount'; -import type { - CreateOrganizationEnterpriseConnectionParams, - EnterpriseConnectionResource, - UpdateOrganizationEnterpriseConnectionParams, -} from './enterpriseConnection'; -import type { - EnterpriseConnectionTestRunInitResource, - EnterpriseConnectionTestRunResource, - GetEnterpriseConnectionTestRunsParams, -} from './enterpriseConnectionTestRun'; +import type { EnterpriseConnectionResource } from './enterpriseConnection'; import type { ExternalAccountResource } from './externalAccount'; import type { ImageResource } from './image'; import type { UserJSON } from './json'; @@ -306,22 +297,12 @@ export interface UserResource extends ClerkResource, BillingPayerMethods { * @returns A [`DeletedObjectResource`](https://clerk.com/docs/reference/types/deleted-object-resource) object. */ leaveOrganization: (organizationId: string) => Promise; + /** + * Get the enterprise connections for the current user. This method is not intended for public use. + * Currently some customers use this to get enterprise connections for account linking purposes. + * @hidden + */ getEnterpriseConnections: (params?: GetEnterpriseConnectionsParams) => Promise; - createEnterpriseConnection: ( - params: CreateOrganizationEnterpriseConnectionParams, - ) => Promise; - updateEnterpriseConnection: ( - enterpriseConnectionId: string, - params: UpdateOrganizationEnterpriseConnectionParams, - ) => Promise; - deleteEnterpriseConnection: (enterpriseConnectionId: string) => Promise; - createEnterpriseConnectionTestRun: ( - enterpriseConnectionId: string, - ) => Promise; - getEnterpriseConnectionTestRuns: ( - enterpriseConnectionId: string, - params?: GetEnterpriseConnectionTestRunsParams, - ) => Promise>; /** * Generates a TOTP secret for a user that can be used to register the application on the user's authenticator app of choice. If this method is called again (while still unverified), it replaces the previously generated secret. * @returns A [`TOTPResource`](https://clerk.com/docs/reference/types/totp-resource) object.