export type Auth0Configuration = {domain: string, clientId: string, secret: string, tenantIdFieldName: string, isTenantIdOnUserMetadata?: boolean | undefined}; export type CreateApiResourcesMigrationsV1Auth0Args = {body: Auth0Configuration}; export type CreateApiResourcesMigrationsV1Auth0Options = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Migrate from Auth0 * * POST /resources/migrations/v1/auth0 */ export const createApiResourcesMigrationsV1Auth0 = async (args: CreateApiResourcesMigrationsV1Auth0Args, options?: CreateApiResourcesMigrationsV1Auth0Options) => { 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/migrations/v1/auth0${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };