# @dialob/fill-api

> Dialob filling API

Latest version **1.4.10** (published 2026-03-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @dialob/fill-api
pnpm add @dialob/fill-api
yarn add @dialob/fill-api
bun add @dialob/fill-api
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.4.10 |
| Published | 2026-03-10 |
| First published | 2020-11-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 55.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Maintainers | tomi, villuv, jocelynmutso |

## Links

- npm: https://www.npmjs.com/package/@dialob/fill-api
- Repository: https://github.com/dialob/dialob-parent
- Homepage: https://github.com/dialob/dialob-parent#readme
- Issues: https://github.com/dialob/dialob-parent/issues
- npm.io page: https://npm.io/package/@dialob/fill-api

## Dependencies (1)

- [immer](https://npm.io/package/immer.md) ^10.1.1

## Recent versions

- 1.4.10 (latest) — 2026-03-10
- 1.4.9 — 2025-03-26
- 1.4.8 — 2024-06-11
- 1.4.7 — 2023-05-04
- 1.4.6 — 2021-03-23
- 1.4.5 — 2021-03-23
- 1.4.4 — 2021-01-18
- 1.4.3 — 2021-01-18
- 1.4.2 — 2021-01-18
- 1.4.1 — 2020-11-27

## README

# Dialob Fill API
## Install
```sh
npm install @dialob/fill-api
```

## Quick-start
```js
import DialobFill from '@dialob/fill-api';

// Replace `sessionId` and `endpoint` with appropriate values
const sessionId = '8bab410b7bfac6f64fbbb1024d52a96f';
const session = DialobFill.newSession(sessionId, {
  endpoint: 'https://instance.dialob.io/',
});

// Now you have a session object that holds the state of the session. You should first pull data
// from the server
session.pull();

// Update answer
session.setAnswer('itemId', 'newAnswer');

// Add row to row group
session.addRowToGroup('rowGroup1');

// Delete row from row group
session.deleteRow('rowGroup1.1');

// Next page
session.next();

// Previous page
session.previous();

// Go directly to a page
session.goToPage(pageId);

// Complete the session
session.complete();

// Get item
session.getItem(itemId);

// Get item errors
session.getItemErrors(itemId);

// Get valueSet
session.getValueSet(valueSetId);

// Get locale
session.getLocale();

// Set locale
session.setLocale(locale);

// Get context or expression variable value
session.getVariable(id);

// The session object batches updates and syncs them at appropriate times, however, it also updates
// its local cache instantly. The `update` event is emitted on any state change, local or remote.
session.on('update', () => {
  console.log('onUpdate');
});

// `sync` event is emitted when syncing starts or ends.
session.on('sync' (syncState) => {
  // `syncState` can be either `INPROGRESS` (syncing is ongoing) or `DONE` (syncing was successfully
  // completed)
  console.log('onSync', syncState);
});

// `error` event is emitted if some error happens that can't be handled by the library
session.on('error', (type, error) => {
  // `type` is either `SYNC` (sync error) or `SYNC-REPEATED` (repeated sync error, indication of systematic failure and should require user interaction)
  console.error(type, error);
});

// You can remove listeners with `removeListener()`
session.removeListener('update', updateFn);
```

## Session options
You can define session options as the third argument to the session constructor:
```js
const session = DialobFill.newSession(sessionId, transport, options);
```

The possible options are:
```ts
interface SessionOptions {
  // Defines how many milliseconds session should batch actions for before syncing them to server.
  // A value of -1 disables the batching logic and always immediately syncs each action. This can
  // be used if you want to do debouncing yourself, for example.
  syncWait?: number;
}
```

## Compatibility
This API does not follow the same versioning as Dialob backend. To ensure full compatibility, refer
to this table. Each row documents a compatibility change, any versions in between can be assumed to
be compatible with eachother.

| fill-api   | backend  |
| ---------- | -------- |
| 1.4.0      | 1.0.11   |
| 1.3.0      | 1.0.8    |
| 1.0.0      | 1.0.0    |

---
_Source: https://npm.io/package/@dialob/fill-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
