# @x12i/memorix-mapping

> Shared deterministic Memorix mapping AST and execution core (source, abstract, completion).

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

## Install

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

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2026-07-23 |
| First published | 2026-07-21 |
| Weekly downloads | 0 |
| License | exellix-license |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 0 |
| Unpacked size | 113.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | x12i |

## Links

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

## Recent versions

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

## README

# `@x12i/memorix-mapping`

Shared **deterministic mapping AST** and execution core for Memorix (source maps, abstract reverse maps, completion-style transforms).

Mappings are declared in metadata; this package **validates and executes** them. No network I/O and no Mongo.

## Install

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

| Audience | Use this package? |
|----------|-------------------|
| Remote app | Prefer pipelines / HTTP — maps run inside the platform |
| Pipeline / transform authors | **Yes** — validate, execute, simulate |
| Pack-only authors | Keep maps in metadata; runtime uses this under the hood |

## Core API

```ts
import {
  validateMappingDocument,
  executeMapping,
  executeReverseMapping,
  simulateMapping,
  createDefaultRegistry,
} from "@x12i/memorix-mapping";
```

| Function | Role |
|----------|------|
| `validateMappingDocument` | Structural AST validation |
| `executeMapping` | Forward map: input → output object |
| `executeReverseMapping` | Reverse path for abstract write / completion |
| `simulateMapping` | Dry-run with diagnostics |
| `createDefaultRegistry` | Built-in transform registry |

## Quick example

```ts
import { executeMapping, validateMappingDocument } from "@x12i/memorix-mapping";

const doc = /* MappingDocument from metadata */;
const v = validateMappingDocument(doc);
if (!v.ok) throw new Error(v.errors.map((e) => e.message).join("; "));

const result = executeMapping(doc, sourcePayload);
if (!result.ok) throw new Error(result.errors.map((e) => e.message).join("; "));
// result.value → mapped object
```

## How it fits

```text
metadata (mappings kind) → pipeline map-normalize / abstract reverse-write → this package
```

HTTP surface: maps are invoked via `memorix-service` pipelines and data APIs, not as a standalone public map endpoint.

## Docs

- [`documentation/packages/memorix-mapping.md`](../documentation/packages/memorix-mapping.md)
- Ebook: [Platform overview](../new-ebooks/00-platform-overview/) · [Data access patterns](../new-ebooks/04-data-access-patterns/)
- Hub: [https://ebooks.memorix.x12i.com](https://ebooks.memorix.x12i.com)

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