npm.io
3.0.2 • Published 2 months ago

@x12i/memorix-db-router

Licence
exellix-license
Version
3.0.2
Deps
0
Size
61 kB
Vulns
0
Weekly
0

@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/memorix-db-router@3.0.2
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-catalox

Data 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

Keywords