IF Commons GitHub

physical/hosts

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-githost-store FR-003, 0002-anyfs-githost-store FR-006, 0002-anyfs-githost-store FR-004

The two ways to open the store of a branch: openGithubStore for a place github://owner/repo@branch/prefix and openGitlabStore for gitlab://host/group/subgroup/project@branch/prefix. Each makes the request caller of its host (the token in the header the host reads it from, on the API of github.com or of the endpoint named, https://<host>/api/v4 for GitLab), the client of the host's API, and the store over it. The token comes from a source and is asked for again at each request, so a short-lived token is fresh and a person is asked once; it is in no place, URL, result or sentence. A branch left out of the place is the default branch of the repository.

import { openGithubStore, staticToken, parseIdentity } from "@intellectual-frontiers/anyfs-githost";
// const opened = await openGithubStore({ place, token, commit: { author } });
// opened.kind === "ok" && opened.value.mode; // "writable" where the token may push

Source: commons/anyfs-githost/src/physical/hosts.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.

GithubOptionstypeno test imports it
type GithubOptions = HostOptions & {
  readonly place: GithubPlace;
  /** The base of the API: `https://api.github.com` where left out, `https://<host>/api/v3` for GitHub Enterprise Server. */
  readonly endpoint?: string;
};

What a store on GitHub is made with.

GithubPlacetype
type GithubPlace = Extract<Place, { readonly kind: "github" }>;

The place of a store on GitHub.

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

GitlabOptionstypeno test imports it
type GitlabOptions = HostOptions & {
  readonly place: GitlabPlace;
  /** The address of the server without the API path: `https://<host of the place>` where left out. */
  readonly endpoint?: string;
  /** What the token is: a personal or project access token (the default) or the token of a CI job. */
  readonly tokenKind?: "access" | "job";
};

What a store on GitLab is made with.

GitlabPlacetype
type GitlabPlace = Extract<Place, { readonly kind: "gitlab" }>;

The place of a store on GitLab.

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

HostOptionstypeno test imports it
type HostOptions = { readonly token: TokenSource; readonly commit: CommitOptions; /** How requests are sent: the l… (660 characters)
type HostOptions = {
  readonly token: TokenSource;
  readonly commit: CommitOptions;
  /** How requests are sent: the live transport where left out; a test gives its own. */
  readonly transport?: Transport;
  /** The branch a branch that does not exist is started from. */
  readonly createFrom?: string;
  readonly maxObjectBytes?: number;
  readonly portable?: boolean;
  readonly attempts?: number;
  readonly listConcurrency?: number;
  /** How long a request may take, in seconds: 30 where left out. */
  readonly timeoutSeconds?: number;
  /** The clock in milliseconds, for the wait a host's reset time asks for. */
  readonly clock?: () => number;
};

What both hosts are opened with.

openGithubStorefunction
function openGithubStore(options: GithubOptions): Promise<Result<OpenedHost, string>>

The store of a branch of a repository on GitHub, or why there is none.

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

openGitlabStorefunction
function openGitlabStore(options: GitlabOptions): Promise<Result<OpenedHost, string>>

The store of a branch of a project on GitLab, or why there is none.

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

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