export type UserSourceDynamicTenantConfig = {tenantIdFieldName: string, tenantResolverType: 'dynamic'}; export type UserSourceStaticTenantConfig = {tenantId: string, tenantResolverType: 'static'}; export type UserSourceNewTenantConfig = {tenantResolverType: 'new'}; export type ExternalAuth0UserSourceConfig = {syncOnLogin: boolean, isMigrated: boolean, domain: string, clientId: string, secret: string, tenantConfig: UserSourceDynamicTenantConfig | UserSourceStaticTenantConfig | UserSourceNewTenantConfig}; export type UpdateExternalAuth0UserSourceRequestDTO = {name?: string | undefined, configuration?: ExternalAuth0UserSourceConfig | undefined, index?: number | undefined, description?: string | undefined}; export type UpdateApiResourcesUserSourcesV1ExternalAuth0IdArgs = {id: string, body: UpdateExternalAuth0UserSourceRequestDTO}; export type UpdateApiResourcesUserSourcesV1ExternalAuth0IdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Auth0 external user source * * PUT /resources/user-sources/v1/external/auth0/{id} */ export const updateApiResourcesUserSourcesV1ExternalAuth0Id = async (args: UpdateApiResourcesUserSourcesV1ExternalAuth0IdArgs, options?: UpdateApiResourcesUserSourcesV1ExternalAuth0IdOptions) => { const {baseUrl = "http://localhost:8181", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/resources/user-sources/v1/external/auth0/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };