@x12i/xentra-store-mongo
v0.2.0
Published
MongoDB storage adapter for Xentra
Readme
@x12i/xentra-store-mongo
MongoDB storage adapter for Xentra. Provisions collection names and indexes; implements the same XentraStoreBundle contract as the in-memory store.
Install
npm install @x12i/xentra-store-mongo mongodbAlso requires @x12i/xentra-store.
Usage
import { MongoClient } from "mongodb";
import { createMongoStore, ensureMongoIndexes, COLLECTIONS } from "@x12i/xentra-store-mongo";
const client = new MongoClient(process.env.MONGODB_URI!);
await client.connect();
const store = await createMongoStore({ client, dbName: "xentra" });
// Or ensure indexes on an existing Db handle
await ensureMongoIndexes(client.db("xentra"));Collections
COLLECTIONS maps logical stores to MongoDB collection names (e.g. xentra_accounts, xentra_agents, xentra_token_grants). Index specs are applied on createMongoStore via ensureMongoIndexes.
Status
The MVP scaffold provisions indexes and collection names; full CRUD wiring may delegate to the memory store during early development. Check src/index.ts for the current behavior before relying on persistence in production.
Related packages
@x12i/xentra-store— interface definitions andcreateMemoryStore@x12i/xentra-api— can be configured to use Mongo instead of memory when wired
Development
npm run build -w @x12i/xentra-store-mongo
npm test -w @x12i/xentra-store-mongoLicense
MIT
