Gitapp

← Back to module

JSDoc

Classes

SerialQueue

class

Serial command queue — guarantees no two `run()` calls overlap. Framework-agnostic: no MobX. Observers subscribe via callback on construction.

class SerialQueue
Members

constructor

constructor
constructor(observers?: QueueObserver[]): SerialQueue

enqueue

method

Add work to the end of the queue. Returns a promise that resolves (or rejects) with the result once it's this item's turn to execute.

<T>(id: string, label: string, run: () => Promise<T>): Promise<T>

whenIdle

method

Returns a promise that resolves when the queue is idle (no pending or in-flight commands). Safe to call when already idle.

whenIdle(): Promise<void>

pause

method
pause(): void

resume

method
resume(): void

WatchRegistry

class
class WatchRegistry
Members

subscribe

method

Subscribe to events for paths matching `prefix`. Returns an unsubscribe function.

subscribe(prefix: string, cb: (event: WatchEvent) => void): () => void

emit

method

Emit a watch event to all subscribers whose prefix matches at least one of the changed paths.

emit(event: WatchEvent): void

Functions

runTransaction

function

Execute one transaction: resolve mutations → commit → push → handle conflicts. Called from within the serial queue; guaranteed exclusive access to gitFs.

runTransaction(tx: Transaction, config: RunnerConfig): Promise<TransactionResult>

runSyncIn

function

Pull from remote, fire watch events for changed paths, return SyncInResult. Called from within the serial queue.

runSyncIn(config: RunnerConfig): Promise<SyncInResult>

createGitAppDocStore

function
createGitAppDocStore(_config: GitAppDocStoreConfig): DocStore

Interfaces

GitAppDocStoreConfig

interface
interface GitAppDocStoreConfig
Members

gitFs

property
gitFs: GitFs

mgmt

property
mgmt: RepoManagement

repoRef

property
repoRef: { provider: "github" | "gitea" | "gitlab"; owner: string; name: string; branch: string; proxyBase: string; }

getToken

property

Token lookup is a function (not a value) so the docstore picks up fresh tokens when the user re-auths without needing reconstruction.

getToken: () => TokenLookup

author

property

Author identity for commits. `timestampISO` is a function so each commit gets the current time — pass `() => new Date().toISOString()` in prod, fix it in tests.

author: Omit<{ name: string; email: string; timestampISO: string; }, "timestampISO"> & { readonly timestampISO: () => string; }

RunnerConfig

interface
interface RunnerConfig
Members

gitFs

property
gitFs: GitFs

repoRef

property
repoRef: { provider: "github" | "gitea" | "gitlab"; owner: string; name: string; branch: string; proxyBase: string; }

getToken

property
getToken: () => TokenLookup

author

property
author: Omit<{ name: string; email: string; timestampISO: string; }, "timestampISO"> & { readonly timestampISO: () => string; }

watchRegistry

property
watchRegistry: WatchRegistry