Skip to main content
This release is 1 version behind 0.1.1 — the latest version of @tkancharla/tandem. Jump to latest

A sync engine and database for building collaborative apps

It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
52%
Published
4 days ago (0.1.0)
class Database

Constructors

new
Database(storage?: AsyncTupleStorageApi)

Type Parameters

Schema extends AnySchema

Properties

private
readonly
abstract
mutationStream: MutationStream
readonly
ready: Promise<void>

Resolves when initial load from storage completes

private
rollback: (mutationsToRollback: readonly Mutation[]) => unknown
private
readonly
tupleDb: TupleDatabaseClient

Methods

commit(mutation: Mutation): void
get<Collection extends CollectionName<Schema>>(
collection: Collection,
id: Schema[Collection]["id"],
): Schema[Collection] | undefined
list<Collection extends CollectionName<Schema>>(collection: Collection): Schema[Collection][]
private
loadFromStorage(storage: AsyncTupleStorageApi): Promise<void>
subscribe<O>(
query: (db: LocalReadonlyDatabase<Schema>) => O,
callback: (result: O) => void,
): { result: O; destroy: () => void; }

Add Package

deno add jsr:@tkancharla/tandem

Import symbol

import { Database } from "@tkancharla/tandem";

---- OR ----

Import directly with a jsr specifier

import { Database } from "jsr:@tkancharla/tandem";

Add Package

npx jsr add @tkancharla/tandem

Import symbol

import { Database } from "@tkancharla/tandem";

Add Package

yarn dlx jsr add @tkancharla/tandem

Import symbol

import { Database } from "@tkancharla/tandem";

Add Package

pnpm dlx jsr add @tkancharla/tandem

Import symbol

import { Database } from "@tkancharla/tandem";

Add Package

bunx jsr add @tkancharla/tandem

Import symbol

import { Database } from "@tkancharla/tandem";