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
typeGithubOptions=HostOptions& {
readonlyplace:GithubPlace;
/** The base of the API: `https://api.github.com` where left out, `https://<host>/api/v3` for GitHub Enterprise Server. */readonlyendpoint?:string;
};
typeGitlabOptions=HostOptions& {
readonlyplace:GitlabPlace;
/** The address of the server without the API path: `https://<host of the place>` where left out. */readonlyendpoint?:string;
/** What the token is: a personal or project access token (the default) or the token of a CI job. */readonlytokenKind?:"access"|"job";
};
type HostOptions = {
readonly token: TokenSource;
readonly commit: CommitOptions;
/** How requests are sent: the l…(660 characters)
typeHostOptions= {
readonlytoken:TokenSource;
readonlycommit:CommitOptions;
/** How requests are sent: the live transport where left out; a test gives its own. */readonlytransport?:Transport;
/** The branch a branch that does not exist is started from. */readonlycreateFrom?:string;
readonlymaxObjectBytes?:number;
readonlyportable?:boolean;
readonlyattempts?:number;
readonlylistConcurrency?:number;
/** How long a request may take, in seconds: 30 where left out. */readonlytimeoutSeconds?:number;
/** The clock in milliseconds, for the wait a host's reset time asks for. */readonlyclock?: () =>number;
};