Licence
exellix-license
Version
3.0.2
Deps
0
Size
114 kB
Vulns
0
Weekly
0
@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
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
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
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
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.