# @x12i/memorix-data

> Memorix data plane: scope/routing (5A), V2 writer (5B), reader (5C), abstract reverse-write (5D), relationship store/read (5E).

Latest version **3.0.2** (published 2026-07-23) · exellix-license license · 0 weekly downloads

## Install

```sh
npm install @x12i/memorix-data
pnpm add @x12i/memorix-data
yarn add @x12i/memorix-data
bun add @x12i/memorix-data
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2026-07-23 |
| First published | 2026-07-21 |
| Weekly downloads | 0 |
| License | exellix-license |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | x12i |

## Links

- npm: https://www.npmjs.com/package/@x12i/memorix-data
- Repository: https://github.com/x12i/memorix-mono-repo
- Homepage: https://github.com/x12i/memorix-mono-repo#readme
- Issues: https://github.com/x12i/memorix-mono-repo/issues
- npm.io page: https://npm.io/package/@x12i/memorix-data

## Recent versions

- 3.0.2 (latest) — 2026-07-23
- 3.0.0 (next) — 2026-07-23
- 3.0.1 — 2026-07-23
- 0.2.0 — 2026-07-23
- 0.1.0 — 2026-07-21

## README

# `@x12i/memorix-data`

Memorix **data plane**: scoped routing, record directory, V2 content **writer** / **reader**, sibling **compose**, abstract **reverse-write**, and relationship **reads** (expansion).

All subject mutations go through this plane (or Memory / relationship engines that call it). Never write domain documents with raw Mongo drivers.

## Install

```bash
npm install @x12i/memorix-data@3.0.2
```

| Audience | Use this package? |
|----------|-------------------|
| Remote app | **No** — call `memorix-service` `/api/data` |
| Platform / service composition | **Yes** |

## Write ops

`add` · `upsert` · `patch` · `replace` · `remove`

Each requires `MemorixScope` (`orgId` + `agentIds[]`) and a precondition (`absent` or exact `revision`). Stale revision → conflict.

## Read ops

`getContent` · `listContent` · `composeSubject` · `getAbstract` · `listAbstract`

Default reads return one logical V2 record (`_id` stripped). Pass relationship include options for virtual `{ source, relationships }` expansion. **Link mutation is not here** — use `@x12i/memorix-relationships`.

## Abstract reverse-write

`patchAbstract` → reverse mappings → one concrete writer patch. No abstract collections / abstract `recordId`.

## Quick example

```ts
import { createMongoContentWriter, createMongoContentReader } from "@x12i/memorix-data";

const writer = createMongoContentWriter({ client, /* routing */ });
const reader = createMongoContentReader({ client, /* routing */ });

await writer.add(scope, {
  draft: { /* MemorixRecordDraft V2 */ },
  precondition: { kind: "absent" },
});

const record = await reader.getContent(scope, {
  objectType: "work-items",
  contentType: "snapshots",
  recordId: "WI-100",
});

const composed = await reader.composeSubject(scope, { recordId: "WI-100" });
// composed.contents → { raw: [...], snapshots: [...], ... }
```

## Related

| Need | Package / API |
|------|----------------|
| Envelope validate | `@x12i/memorix-format` |
| Four-field links | `@x12i/memorix-relationships` |
| HTTP | `/api/data`, `/api/data/compose`, `/api/data/abstract` |

## Docs

- [`documentation/data-model.md`](../documentation/data-model.md) · [`documentation/http-api.md`](../documentation/http-api.md)
- Ebooks: [Runtime Data Client](../new-ebooks/02-runtime-data-client/) · [Access Patterns](../new-ebooks/04-data-access-patterns/)
- Hub: [https://ebooks.memorix.x12i.com](https://ebooks.memorix.x12i.com)

```bash
npm test
```

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