import { type NetworkOptions, type Session } from './atproto.ts'; import type { Minimum } from './review.ts'; import { type Value } from './repo.ts'; /** The record type, and the collection suites live in. */ export declare const SUITE = "com.pipobscure.bundle.suite"; /** The `subject` of every suite: the sha256 of the NSID, for a backlink index to enumerate them by. */ export declare const SUITE_SUBJECT: string; /** How many listings a suite may name. */ export declare const MAX_MEMBERS = 64; /** One listing in a suite. */ export interface SuiteMember { /** The `at://` address of the listing. */ listing: string; /** * Install it as a plugin: for the app installed from the listing at this * `at://` address, or into this scope (a package name). Without it, an * app installs onto the PATH, and a plugin for the app its listing names. */ for?: string | undefined; /** What it must carry to be installed at all. */ require?: SuiteRequire | undefined; } /** A suite's minimum for one member. Meeting it vouches for nothing. */ export interface SuiteRequire { identity?: string | undefined; issuer?: string | undefined; /** `[kind@]`. */ attesters?: string[] | undefined; quorum?: number | undefined; } /** The record as it is written. */ export interface SuiteRecord { $type: typeof SUITE; subject: string; members: SuiteMember[]; title?: string | undefined; description?: string | undefined; createdAt: string; } /** What a suite says, wherever it was published. */ export type SuiteContent = Pick; /** A suite as found: fetched from its publisher's PDS and verified, or served where a domain's `nsuite:` record says. */ export interface FoundSuite { name: string; /** How it is found again: its `at://` address, or the domain. */ uri: string; /** The publisher, for a suite in an atproto repository. */ did?: string | undefined; /** Where it was served from, for a suite published by DNS. */ url?: string | undefined; record: SuiteContent; } /** The `at://` address of `did`'s suite called `name`. */ export declare function suiteUri(did: string, name: string): string; /** The DID and name in a suite's `at://` address, or null when it is not one. */ export declare function parseSuiteUri(uri: string): { did: string; name: string; } | null; /** What a record says, or why it is not a suite this tool will use. */ export declare function readSuite(value: Value, name: string): { ok: true; record: SuiteRecord; } | { ok: false; reason: string; }; /** What is wrong with a suite's members, or undefined when nothing is. */ export declare function membersProblem(members: unknown): string | undefined; /** What is wrong with a member's `require`, or undefined when nothing is. */ export declare function requireProblem(require: unknown): string | undefined; /** A member as it is written: what this tool reads of it, and nothing else. */ export declare function cleanMember({ listing, for: scope, require }: SuiteMember): SuiteMember; /** A member's `require` as the review takes it: a floor, from `source`. */ export declare function minimumOf(require: SuiteRequire | undefined, source: string): Minimum | undefined; /** * What a suite is, as a hash: the sha256 of the DAG-CBOR encoding of * `{ members }`, each member as it is published — the listings, where each * goes, and what each must carry. Its title and description are left out: * they say nothing about what is installed. The same suite has the same hash * wherever it is published, and any change to it makes another. * * It is what an attestation of a suite names, in the same collection, at the * same kind of key, as an attestation of an archive — so `bundle suite * attest` is `bundle attest` for a suite, and such an attestation counts for * each member installed from that suite. */ export declare function suiteHash(content: Pick): { hashAlg: 'sha256'; hex: string; }; /** `did`'s suite called `name`, fetched with its proof and verified — or null when there is none. */ export declare function fetchSuite(did: string, name: string, options?: NetworkOptions): Promise; /** The suite at an `at://` address, as it is now — what an installed suite is remembered by. */ export declare function followSuite(uri: string, options?: NetworkOptions): Promise; /** * The suite a domain publishes: its `nsuite:` TXT record names where the * spec is served — an absolute `https:` URL, or a reference resolved against * `https:///` — and the spec is fetched and checked. A domain that * publishes an `nzip:` record too is refused: it would not be clear which * `bundle install ` means. */ export declare function resolveSuiteDomain(domain: string, { resolveTxt, answers }?: { resolveTxt?: ((domain: string) => Promise) | undefined; /** The domain's TXT records, when they have been looked up already. */ answers?: string[][] | undefined; }): Promise; /** * The suite served at an `https:` URL, as a spec — what a domain's `nsuite:` * record names, or a URL given to `bundle install` directly. `bytes`, when * the URL has been fetched already. */ export declare function fetchSuiteUrl(url: string, bytes?: Buffer | undefined): Promise; /** * Whether fetched bytes are a suite rather than an archive: JSON, which * starts with `{`, where an archive starts with a zip header or a launcher's * `#!`. */ export declare function looksLikeSuite(bytes: Buffer): boolean; /** * Write a suite from a spec to the session's account. Publishing it again * replaces it, keeping when it was first published. One read of the account's * suites, one write, and nothing read back. */ export declare function publishSuite(session: Session, spec: SuiteSpec, options?: NetworkOptions): Promise<{ uri: string; replaced: boolean; record: SuiteRecord; }>; /** Take a suite down. False when there was none. Installs of it keep what they have. */ export declare function unpublishSuite(session: Session, name: string, options?: NetworkOptions): Promise; /** A suite as its publisher keeps it: the record to publish, and its name. */ export interface SuiteSpec { $schema?: string | undefined; /** The record key it is published under, and what it installs as. */ name: string; title?: string | undefined; description?: string | undefined; members: SpecMember[]; } /** A member as its spec keeps it: as published, and as it was typed. */ export interface SpecMember extends SuiteMember { /** What it was added as, as typed (`@pipobscure.com/bled`): for whoever reads the file. Not published. */ label?: string | undefined; /** The same for `for`. Not published. */ forLabel?: string | undefined; } /** Where the JSON Schema for suite specs is served: a release's, or the latest. */ export declare function suiteSchemaUrl(version?: string | undefined): string; /** What is wrong with a spec: nothing, or why it could not be published. */ export declare function checkSpec(spec: unknown): string[]; /** A spec file, read and checked; or, when `create` and there is none, a new one named after the file. */ export declare function readSpec(path: string, { create }?: { create?: boolean; }): SuiteSpec; /** Write a spec, `$schema` first, so an editor can help with it. */ export declare function writeSpec(path: string, spec: SuiteSpec, version?: string | undefined): void; //# sourceMappingURL=suite.d.ts.map