@kedaruma/revlm-client
v1.0.63
Published
TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.
Maintainers
Readme
@kedaruma/revlm-client
English documentation | 日本語ドキュメントはこちら
TypeScript/JavaScript SDK for apps migrating from MongoDB Realm to the self-hosted Revlm server. It exposes helpers to authenticate users, call /revlm-gate, and manage collections.
Installation
pnpm add @kedaruma/revlm-clientThe package ships both CJS and ESM bundles plus typings (types and exports are configured).
Usage
import { Revlm } from '@kedaruma/revlm-client';
const randomBytes = (length: number) => {
const out = new Uint8Array(length);
crypto.getRandomValues(out);
return out;
};
const revlm = new Revlm('https://your-server.example.com', { randomBytes });
const login = await revlm.login('user', 'secret');
const db = revlm.db('db_name');
const coll = db.collection<any>('collection_name');
const all = await coll.find({});React Native (Hermes) polyfills
Install RN-friendly crypto/text/Buffer polyfills and load the helper once at app startup (e.g. in index.js or App.tsx):
pnpm add react-native-webcrypto react-native-get-random-values fast-text-encoding bufferimport '@kedaruma/revlm-client/rn-setup';The helper makes a best-effort attempt to wire crypto, crypto.getRandomValues, crypto.subtle, TextEncoder/TextDecoder, and Buffer. It is safe to import on non-RN platforms.
Scripts
pnpm run build– bundle withtsuppnpm test– run Jest suites (server package must be running in test mode)pnpm run clean– remove build artifacts andnode_modules
