Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
12345678910111213141516171819202122232425import type { Did } from "@atcute/lexicons/syntax";import { createBobbinClient } from "$lib/api/client";import { stream } from "$lib/api/load";import { availableKnots, availableSpindles } from "$lib/api/repoCreationTargets";
interface RepoCreationParent { auth?: { did: string } | null; publicConfig: { bobbinUrl: string };}
export const repoCreationOptions = ( parent: RepoCreationParent, fetch: typeof globalThis.fetch): { knots: Promise<string[]>; spindles: Promise<string[]> } => { if (!parent.auth?.did) { return { knots: Promise.resolve([]), spindles: Promise.resolve([]) }; } const ctx = createBobbinClient({ serviceUrl: parent.publicConfig.bobbinUrl, fetch }); const did = parent.auth.did as Did; return { knots: stream(availableKnots(ctx, did).catch(() => [])), spindles: stream(availableSpindles(ctx, did).catch(() => [])) };};