@x12i/memorix-db-router
v3.0.2
Published
Canonical database-name routing for Memorix data and metadata databases.
Readme
@x12i/memorix-db-router
Canonical database name routing for Memorix data and metadata databases.
Given orgId (+ optional agent for metadata), produces the physical Mongo database names the platform must use. Prevents ad-hoc connection string / DB naming drift.
Install
npm install @x12i/[email protected]| Audience | Use this package? | |----------|-------------------| | Remote app | No | | Platform / low-level tooling | Yes when constructing DB names |
Core API
import {
getMemorixDataDatabaseName,
getMemorixMetadataDatabaseName,
physicalDataDatabaseName,
physicalMetadataDatabaseName,
parseMemorixDatabaseName,
validateMemorixDatabaseRoute,
discoverMemorixScopes,
} from "@x12i/memorix-db-router";Examples:
orgId=g12ops, dataType=knowledge → g12ops-memorix-knowledge
orgId=g12ops, dataType=entities → g12ops-memorix-entities
orgId=g12ops, dataType=events → g12ops-memorix-events
agentId=ops, metadata (catalox) → ops-memorix-cataloxData plane is orgId-scoped (entities | events | knowledge). Metadata (Catalox) is agentId-scoped. Empty ids use unprefixed defaults (memorix-entities, memorix-catalox, …).
Validation / discovery
| Helper | Role |
|--------|------|
| validateMemorixDatabaseRoute / checkMemorixDatabaseRoute | Reject unsafe / non-canonical names |
| parseMemorixDatabaseName | Split physical name → scope parts |
| discoverMemorixScopes | Infer org/agent scopes from a list of DB names |
Docs
npm test