Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/cloneApi

slice A -- REST surface for cloning a public repository into the workspace, and for connecting a local project to a remote ("origin").

Cockpit server, next. Source: ui/server/src/cloneApi.mjs.

Functions#

createCloneRouter()#

createCloneRouter(deps): any

Defined in: ui/server/src/cloneApi.mjs:28

Parameters#

deps
clientOrigin?

string

jobs

{ gitStatus: () => { cloneEnabled: boolean; code: string; minimum: string; ok: boolean; reason: any; version: any; } | { cloneEnabled: boolean; code: string; minimum: string; ok: boolean; reason: string; version: any; } | { cloneEnabled: boolean; code?: undefined; minimum: string; ok: boolean; reason?: undefined; version: any; }; list: () => object[]; live: () => number; cancel: { body: { error: string; job?: undefined; ok: boolean; }; status: number; } | { body: { error: string; job: { branch?: any; bytes: any; code?: any; dir?: any; error?: any; finishedAt: any; id: any; kind: string; log: any; name: any; private: boolean; progress: any; startedAt: any; state: any; title: string; url: any; via?: string; }; ok: boolean; }; status: number; } | { body: { error?: undefined; job: { branch?: any; bytes: any; code?: any; dir?: any; error?: any; finishedAt: any; id: any; kind: string; log: any; name: any; private: boolean; progress: any; startedAt: any; state: any; title: string; url: any; via?: string; }; ok: boolean; }; status: number; }; get: { branch?: any; bytes: any; code?: any; dir?: any; error?: any; finishedAt: any; id: any; kind: string; log: any; name: any; private: boolean; progress: any; startedAt: any; state: any; title: string; url: any; via?: string; }; pull: Promise<any>; recoverInterrupted: { badMarkers: any[]; kept: any[]; killed: any[]; removed: any[]; }; start: Promise<{ code: string; error: string; ok: boolean; status: number; } | { code?: undefined; done: Promise<any>; error?: undefined; job: { branch?: any; bytes: any; code?: any; dir?: any; error?: any; finishedAt: any; id: any; kind: string; log: any; name: any; private: boolean; progress: any; startedAt: any; state: any; title: string; url: any; via?: string; }; ok: boolean; status?: undefined; }>; }

jobs.gitStatus

() => { cloneEnabled: boolean; code: string; minimum: string; ok: boolean; reason: any; version: any; } | { cloneEnabled: boolean; code: string; minimum: string; ok: boolean; reason: string; version: any; } | { cloneEnabled: boolean; code?: undefined; minimum: string; ok: boolean; reason?: undefined; version: any; }

jobs.list

() => object[] = ...

jobs.live

() => number = ...

Test seam: resolves when the given job has finished.

jobs.cancel
jobs.get
jobs.pull
jobs.recoverInterrupted
jobs.start

Returns#

any


createRemoteRouter()#

createRemoteRouter(deps): any

Defined in: ui/server/src/cloneApi.mjs:99

Parameters#

deps

getRoot is the current project's contained root (index.mjs passes the same closure Review/Tests use).

clientOrigin?

string

getRoot

() => { ok: true; root: string; } | { error: string; ok: false; }

hosts?

readonly string[]

Returns#

any


guard()#

guard(clientOrigin, mutating): (req, res, next) => any

Defined in: ui/server/src/cloneApi.mjs:16

Parameters#

clientOrigin

any

mutating

any

Returns#

(req, res, next) => any


remoteStatus()#

remoteStatus(root): object

Defined in: ui/server/src/cloneApi.mjs:84

What "connected" means for the open project: a git repo that has an origin.

Parameters#

root

any

Returns#

object

connected

connected: boolean = url.ok

repo

repo: boolean = true

url

url: any