Registry / database / kirito.db.remote

kirito.db.remote

JSON →
library1.0.36jsnpmunverified

KiritoDB Remote is a simple, key-value remote database designed for Node.js environments, including bots and APIs. It allows developers to store and retrieve data using dot-notation paths, similar to object property access (e.g., `"users.1234.points"`). As of version 1.0.36, it provides a straightforward API for common database operations such as `get`, `set`, `add`, `sub`, and `delete`. A key characteristic of this library is that all its documentation and examples are provided exclusively in Portuguese, catering specifically to the Brazilian Portuguese-speaking developer community. While explicit release cadence information is not available, its consistent versioning suggests ongoing maintenance. Its primary differentiator is its focus on simplicity and accessibility for Portuguese-speaking developers, offering a remote storage solution without the overhead of more complex database systems.

npm install kirito.db.remote
INSTALL
IMPORT
SIG · KIRITO.DB.REMOTE
K
kirito.db.remote
databasejavascriptv1.0.36
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KiritoDB
✓ const { KiritoDB } = require("kirito.db.remote")
KiritoDB is the main class exported by the library, used for all database interactions. The official documentation exclusively uses CommonJS `require` syntax for importing.

Demonstrates initializing KiritoDB, setting and getting data for various keys, performing numeric addition and subtraction, retrieving all stored data, and deleting specific keys. Requires setting `KIRITO_DB_SECRET_KEY` environment variable.

const { KiritoDB } = require("kirito.db.remote"); async function run() { const secretKey = process.env.KIRITO_DB_SECRET_KEY ?? ''; if (!secretKey) { console.error("Environment variable KIRITO_DB_SECRET_KEY is required for authentication."); process.exit(1); } const db = new KiritoDB(secretKey); console.log("KiritoDB initialized successfully."); // Set a user's name await db.set("users.1234.name", "João"); console.log("Set users.1234.name to João."); // Retrieve the user's name const userName = await db.get("users.1234.name"); console.log(`Retrieved users.1234.name: ${userName}`); // Add points to a user's score await db.add("users.1234.score", 50); console.log("Added 50 points to users.1234.score."); let userScore = await db.get("users.1234.score"); console.log(`Current users.1234.score: ${userScore}`); // Subtract points await db.sub("users.1234.score", 15); console.log("Subtracted 15 points from users.1234.score."); userScore = await db.get("users.1234.score"); console.log(`Current users.1234.score: ${userScore}`); // Retrieve all data from the database const allData = await db.all(); console.log("All data currently in database:\n", JSON.stringify(allData, null, 2)); // Delete a specific key await db.delete("users.1234.name"); console.log("Deleted users.1234.name."); const deletedUserName = await db.get("users.1234.name"); console.log(`users.1234.name after deletion: ${deletedUserName}`); // Should be null/undefined } run().catch(console.error);
Debug
Known issues
breakingThe `add` and `sub` methods are strictly designed for numeric values. Attempting to use them on keys where the stored value is a non-numeric data type (such as strings, objects, or arrays) will result in a runtime error and the operation will fail.
fix
Before using `add` or `sub`, ensure that the target key's value is, and remains, a number. Initialize numeric keys with a default number (e.g., 0) if they might not exist to prevent type errors.
affects: >=1.0.0
gotchaThe `get` and `all` methods return Promises, indicating asynchronous operations. It is crucial to use the `await` keyword with these calls to correctly retrieve the resolved data. Failing to `await` will result in working with a pending Promise object instead of the actual value from the database.
fix
Always prepend `await` when invoking `db.get('key')` or `db.all()` within an `async` function to ensure the operation completes and returns the expected data.
affects: >=1.0.0
breakingA secret API key is a mandatory requirement for initializing `KiritoDB`. The library will not function correctly, and database operations will fail, if a valid key is not provided to the `KiritoDB` constructor.
fix
Obtain a valid secret API key from the KiritoDB service and pass it as the first argument to `new KiritoDB('your_secret_key')`. Ensure this key is kept secure and not exposed publicly.
affects: >=1.0.0
gotchaThe documentation for the `set` method contains contradictory information regarding its support for complex data types. While one statement claims it 'accepts any type of value' (string, number), a direct warning immediately follows, stating 'If the value is an array or object, it will cause an error.' Developers should proceed with caution and assume that directly setting arrays or objects might lead to issues.
fix
For maximum compatibility and reliability, prefer setting primitive types (strings, numbers, booleans) directly. If complex data structures like arrays or objects must be stored, consider serializing them into JSON strings (e.g., `JSON.stringify(value)`) before storing and deserializing upon retrieval (e.g., `JSON.parse(retrievedValue)`).
affects: >=1.0.0
Errors
Common errors & fixes
Error: Sua chave secreta está faltando ou é inválida.
The `KiritoDB` constructor was called without providing a valid secret API key, or the provided key was empty/invalid.
fix
Ensure you provide your secret key as a non-empty string when initializing: `new KiritoDB('your_secret_key')`. Validate the key's correctness.
TypeError: Cannot read properties of undefined (reading 'someProperty')
Attempting to access a property on an `undefined` value, commonly occurring when `await` is omitted for an asynchronous operation like `db.get()` or `db.all()`, causing the code to operate on a pending Promise instead of the resolved data.
fix
Always use `await` before calls to `db.get()` and `db.all()` to ensure the Promise resolves and returns the actual data before further processing.
Error: O valor atual da chave 'users.1234.score' não é um número.
The `add` or `sub` method was invoked on a key (`users.1234.score` in this example) whose currently stored value is not a number, such as a string, object, or array.
fix
Confirm that the target key exclusively stores numeric values before using `db.add()` or `db.sub()`. Consider initializing keys with a numeric default if they might be empty, or validating the type before performing arithmetic operations.
Upgrade
Version history
1.0.36latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources