Skip to content

core/charts/index-format.ts ​

Generated from the exports of core/charts/index-format.ts · npm run docs:gen

The index of a chart repository (alta.index/0.1, docs/standards/alta-index-0.1.md): every version of every chart, with its digest, archive, source, locality and audit status. Pure: no disk, no network. The CLI fetches and caches indexes (tools/cli/src/repos.ts), the machine's server lists them (server/lib/market.mjs).

Standards that cite this file: alta.index/0.1: the chart repository index

Exports ​

INDEX_SCHEMA const ​

ts
const INDEX_SCHEMA = "alta.index/0.1"

REPO_ID const ​

ts
const REPO_ID = /^[a-z][a-z0-9-]{1,31}$/

PUBLISHER_ID const ​

ts
const PUBLISHER_ID = /^[a-z0-9][a-z0-9-]{1,38}$/

Text type ​

ts
type Text = { en: string; fr: string };

Locality type ​

ts
type Locality = "local" | "local-first" | "cloud";

LOCALITIES const ​

ts
const LOCALITIES: readonly Locality[]

LOCALITY_CHECKS const ​

ts
const LOCALITY_CHECKS = ["declared", "linted", "tested"] as const

RISKS const ​

ts
const RISKS = ["low", "medium", "high"] as const

AUDIT_STATUSES const ​

ts
const AUDIT_STATUSES = ["pass", "review", "warn", "malicious", "pending", "error"] as const

AuditStatus type ​

ts
type AuditStatus = (typeof AUDIT_STATUSES)[number];

AUDIT_INSTALLABLE const ​

The statuses that let a version be installed; the others block it.

ts
const AUDIT_INSTALLABLE: readonly AuditStatus[]

TIERS const ​

ts
const TIERS = ["official", "verified", "community"] as const

Tier type ​

ts
type Tier = (typeof TIERS)[number];

SERVICE_PHASES const ​

ts
const SERVICE_PHASES = ["install", "run"] as const

SERVICE_ACCOUNTS const ​

ts
const SERVICE_ACCOUNTS = ["none", "free", "paid"] as const

ATTESTATION_TYPES const ​

ts
const ATTESTATION_TYPES = ["publish", "review", "provenance"] as const

IndexNeed interface ​

ts
interface IndexNeed { id: string; kind: "mind" | "channel"; providers: string[]; local: boolean; optional?: boolean }

IndexService interface ​

ts
interface IndexService { id: string; name: string; hosts: string[]; phase: ("install" | "run")[]; required: boolean; account: "none" | "free" | "paid" }

IndexVersion interface ​

ts
interface IndexVersion {
  version: string; created: string;
  digest: string;
  archive?: { url: string; sha256: string; size: number };
  source: { git: string; commit: string; ref?: string; path?: string };
  license: string; price: "free" | "paid";
  pricing?: { model: "one-time" | "subscription"; amount: number; currency: string; interval?: "month" | "year" };
  locality?: Locality;
  localityRange?: { best: Locality; worst: Locality };
  localityCheck: (typeof LOCALITY_CHECKS)[number];
  services: IndexService[];
  /** What it needs (a mind, a channel), each with the providers it may be bound to and whether one is local. */
  needs?: IndexNeed[];
  capabilities: string[];
  risk?: (typeof RISKS)[number];
  support: Support;
  resources?: unknown; requires?: unknown;
  audit: { status: AuditStatus; at?: string; by?: string };
  attestations?: { type: (typeof ATTESTATION_TYPES)[number]; url: string; keyid?: string }[];
  changes?: Text;
  withdrawn?: { at: string; reason: Text };
}

IndexChart interface ​

ts
interface IndexChart {
  publisher: string;
  kind: string; title: Text; summary: Text; categories?: string[]; keywords?: string[]; icon?: string; homepage?: string;
  deprecated?: boolean; replacedBy?: string; aliases?: string[];
  versions: IndexVersion[];
}

Publisher interface ​

ts
interface Publisher { name: string; url?: string; tier: Tier; keys?: { id: string; alg: "ed25519"; public: string; revoked?: string }[] }

Index interface ​

ts
interface Index {
  schema: typeof INDEX_SCHEMA;
  generatedAt: string;
  repo: { id: string; title: Text; url: string; tier: "official" | "community"; report: string };
  publishers: Record<string, Publisher>;
  charts: Record<string, IndexChart>;
}

UrlRules interface ​

ts
interface UrlRules { allowLoopbackHttp?: boolean }

urlProblem function ​

Problems of an address an index may name (empty = an https URL without credentials).

ts
function urlProblem(u: unknown, rules: UrlRules = {}): string | undefined

checkIndex function ​

Problems of an index (empty = valid).

ts
function checkIndex(x: unknown, rules: UrlRules = {}): string[]

Installable type ​

ts
type Installable = { ok: true; note?: string } | { ok: false; reason: "withdrawn" | "pending" | "error" | "malicious" | "deprecated"; why: string };

installable function ​

May this version be pulled and installed? If not, the sentence that says why (alta-index-0.1 §4).

ts
function installable(c: Pick<IndexChart, "deprecated" | "replacedBy">, v: Pick<IndexVersion, "withdrawn" | "audit">): Installable

newestInstallable function ​

The newest installable version of a chart, if any.

ts
function newestInstallable(c: IndexChart): IndexVersion | undefined

SearchQuery interface ​

ts
interface SearchQuery { words?: string[]; locality?: Locality; kind?: string; tier?: Tier; free?: boolean; fits?: Host }

SearchHit interface ​

ts
interface SearchHit {
  id: string; kind: string; title: Text; summary: Text; publisher: string; tier: Tier;
  /** The newest version listed, and the newest one that is installable. */
  version: string; installableVersion?: string;
  locality?: Locality; localityNote?: "local possible" | "local-first possible";
  price: "free" | "paid";
  installable: Installable;
  deprecated?: boolean; replacedBy?: string;
}

tierOf const ​

The tier a chart shows: its publisher's.

ts
const tierOf = (index: Index, c: IndexChart): Tier => …

searchIndex function ​

The charts of an index that match a query (alta-index-0.1 §5), sorted by id.

ts
function searchIndex(index: Index, q: SearchQuery = {}): SearchHit[]

catalogOf function ​

A catalog (alta.catalog/0.2) from an index: per chart the pinned version, else the newest installable one.

ts
function catalogOf(index: Index, pins: Record<string, string> = {}): Catalog

servicesOf function ​

The services of a chart's external block, as the index lists them. Read defensively: a chart written before the field existed has none, and a malformed entry is left out (the chart's own lint reports it).

ts
function servicesOf(chart: Json): IndexService[]

needsListOf function ​

The needs of a chart as the index lists them: the providers each may be bound to, and whether one is local.

ts
function needsListOf(chart: Json): IndexNeed[]

chartEntryOf function ​

The chart-level fields of an index entry, from a chart.json.

ts
function chartEntryOf(chart: Json, publisher: string): Omit<IndexChart, "versions">

versionOf function ​

One version of an index entry, from a chart.json and what the builder knows about it.

ts
function versionOf(chart: Json, o: { digest: string; created: string; source: IndexVersion["source"]; archive?: IndexVersion["archive"]; audit?: IndexVersion["audit"] }): IndexVersion

The standard, the SDK and the CLI are Apache-2.0; Alta System OS and Alta World are FSL-1.1-ALv2.