# fluid-ledger-dds

> Fluid Framework append-only list distributed data structure

Latest version **0.1.3** (published 2022-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install fluid-ledger-dds
pnpm add fluid-ledger-dds
yarn add fluid-ledger-dds
bun add fluid-ledger-dds
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2022-12-13 |
| First published | 2022-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 36.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Vlad Riscutia |
| Maintainers | vladris |

## Links

- npm: https://www.npmjs.com/package/fluid-ledger-dds
- Repository: https://github.com/vladris/fluid-ledger
- Homepage: https://github.com/vladris/fluid-ledger#readme
- Issues: https://github.com/vladris/fluid-ledger/issues
- npm.io page: https://npm.io/package/fluid-ledger-dds

## Dependencies (1)

- [fluid-framework](https://npm.io/package/fluid-framework.md) ^1.2.7

## Recent versions

- 0.1.3 (latest) — 2022-12-13
- 0.1.2 — 2022-12-13
- 0.1.1 — 2022-12-13
- 0.1.0 — 2022-12-12
- 0.0.3 — 2022-10-23

## README

# Fluid Ledger DDS

`Ledger` is a simple append-only list distributed data structure (DDS) for
[Fluid Framework](https://fluidframework.com).

Clients submit appends to the DDS but the underlying list gets update only
after the op has been sequenced by the service. This ensures all clients end up
with the same ordering of objects in the list.

The DDS provides an `append` event which fires whenever a new item is appended
to the list and a `clear` event with fires whenever a client calls `clear()`.
`append` will include the value appended, `clear` will have a copy of the
ledger values that were cleared. Listeners can use these to react to changes.

The DDS provides a `get()` method which returns an iterable iterator over the
underlying list, an `append()` method which submits a new item to be appended to
the list, and a `clear()` method which clears the list. Client shouldn't assume
the data is immediately appended (or cleared), rather wait for the events (other
append or clear operations incoming from other clients might be interleaved).

## Getting started

Install:

`npm install fluid-ledger-dds`

Set up and use a `Ledger`:

```typescript
import { Ledger } from "fluid-ledger-dds";

let ledger: Ledger<number> = ...

ledger.on("append", (value) => {
  console.log(`New value appended to ledger: ${value}`);
});

ledger.on("clear", (values) => {
  console.log(`Ledger was cleared. It contained: ${values}`);
});

// Append a value to the ledger
ledger.append(42);

for (const value of ledger.get()) {
  // Iterate over existing values
}

// Clear ledger
ledger.clear();
```

---
_Source: https://npm.io/package/fluid-ledger-dds · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
