/** * Resolve the human-readable Builder *space* a private key is scoped to. * * There is no public-key path to a space's display name; it comes from the * Builder Admin GraphQL API (`https://builder.io/api/v2/admin`) authenticated * with the private `bpk-…` key we already hold at user scope. A `bpk-` key is * space-scoped, so today this resolves the single connected space — but the * function returns a *list* so the multi-space drill-down can grow additively * (multiple credentials → multiple spaces) without a restructure. * * The exact `settings` field holding the display name is undocumented, so the * parser is deliberately defensive: it requests the whole `settings` JSON blob * and pulls the first plausible name/id field. Callers fall back to the generic * `orgName` when this returns nothing. */ export interface BuilderSpaceSummary { id: string; name: string; } interface BuilderAdminGraphQlResponse { data?: { settings?: unknown; } | null; errors?: Array<{ message?: string; }> | null; } export declare function parseSpacesFromSettings(json: BuilderAdminGraphQlResponse): BuilderSpaceSummary[]; /** * Synchronously read the cached space list for a key, or null if there's no * fresh entry. The status route uses this to stay non-blocking — it returns * whatever is cached now and kicks `listBuilderSpaces` in the background to * populate the cache for the next poll. */ export declare function getCachedBuilderSpaces(privateKey: string): BuilderSpaceSummary[] | null; /** * List the Builder spaces reachable with this private key. Best-effort: returns * `[]` on any network/auth/parse failure (caller should fall back to orgName). */ export declare function listBuilderSpaces(privateKey: string, options?: { fetchImpl?: typeof fetch; signal?: AbortSignal; }): Promise; /** Test/maintenance hook — drop cached space lookups. */ export declare function clearBuilderSpaceCache(): void; export {}; //# sourceMappingURL=builder-space.d.ts.map