Skip to content

Instantly share code, notes, and snippets.

Created Feb 20, 2020
What would you like to do?
Attempt to revist hypermerge interface
type DocID<a> = string
type Doc<a> = a
interface RepoService {
keys: KeyService
create<a>(doc: Doc<a>): Promise<DocID<a>>
read<a>(id: DocID<a>): Promise<a>
change<a>(id: DocID<a>, change: (doc: a) => void): Promise<void>
watch<a>(id: DocID<a>): AsyncIterator<a>
interface RepoServiceBuilder {
service(options: {
keyService?: KeyService
ledgerServiceBuilder: LedgerServiceBuilder
}): RepoService
export interface LedgerData {
docId: string
actorIds: string[]
type LedgerID = DocID<LedgerData[]>
interface Ledger {
id: LedgerID
append(block: Uint8Array): Promise<void>
interface LedgerService {
create(): Ledger
open(id: LedgerID): Ledger
fork(id: LedgerID): Ledger
subscribe(id:LedgerID): AsyncIterableIterator<LedgerData>
interface LedgerServiceBuilder {
service(options: { keyService: KeyService }): LedgerService
interface KeyService {
get(keyID: string): Uint8Array
set(keyID: string, key: Uint8Array): void
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment