IF Commons GitHub

governance/place

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-governance FR-007

The address of a store: a place, one of ten kinds, written as a URI and made only by parsePlace. A place names the root of a store (a folder, a repository at a ref, a host and a folder, a bucket and a prefix, a drive, a database) and never a file in it: the files are the paths of the store. memory and file are the places the library has stores for; the others parse, format and say that they are planned, so that a mount can be written before the backend exists. Credentials are never part of a place.

import { availability, formatPlace, parsePlace } from "./place.ts";
const p = parsePlace("github://intellectual-frontiers/fleet@main/hosts");
p.kind === "ok" && formatPlace(p.value); // "github://intellectual-frontiers/fleet@main/hosts"
p.kind === "ok" && availability(p.value.kind); // "planned"

Source: commons/anyfs/src/governance/place.ts

4 of 7 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

PLACE_KINDSconst
const PLACE_KINDS: readonly ["memory", "file", "ssh", "git", "github", "gitlab", "s3", "onedrive", "gdrive", "sql"]

The kinds of place.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

PlaceKindtypeno test imports it
type PlaceKind = (typeof PLACE_KINDS)[number];

One kind of place.

Placetypeno test imports it
type Place = | { readonly kind: "memory"; readonly name: string } | { readonly kind: "file"; readonly path: string }… (873 characters)
type Place =
  | { readonly kind: "memory"; readonly name: string }
  | { readonly kind: "file"; readonly path: string }
  | { readonly kind: "ssh"; readonly host: string; readonly port?: number; readonly user?: string; readonly path: string }
  | { readonly kind: "git"; readonly repo: string; readonly ref?: string }
  | { readonly kind: "github"; readonly owner: string; readonly repo: string; readonly ref?: string; readonly prefix: Prefix }
  | { readonly kind: "gitlab"; readonly host: string; readonly project: string; readonly ref?: string; readonly prefix: Prefix }
  | { readonly kind: "s3"; readonly bucket: string; readonly prefix: Prefix }
  | { readonly kind: "onedrive"; readonly drive: string; readonly prefix: Prefix }
  | { readonly kind: "gdrive"; readonly folder: string }
  | { readonly kind: "sql"; readonly dialect: string; readonly target: string };

The address of a store.

AVAILABILITYconstno test imports it
const AVAILABILITY: Readonly<Record<"file" | "gdrive" | "git" | "github" | "gitlab" | "memory" | "onedrive" | "s3" | "sql" | "ssh", "implemented" | "planned">>

Whether the library has a store for a kind of place. A registry with one entry for each kind, which the compiler holds.

availabilityconst
const availability: (kind: "file" | "gdrive" | "git" | "github" | "gitlab" | "memory" | "onedrive" | "s3" | "sql" | "ssh") => "implemented" | "planned"

Whether the library has a store for a kind of place.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

parsePlacefunction
function parsePlace(text: string): Result<Place, string>

A place from text, or the part that is wrong with it.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

formatPlacefunction
function formatPlace(place: Place): string

A place as text: what parsePlace reads back as the same place.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.