diff --git a/ts/src/index.ts b/ts/src/index.ts index 5805c05..bfb2961 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -1,7 +1,8 @@ /** * @packageDocumentation * - * RIDB is a storage agnostic secure database wrapper for the web, written in rust. + * ## Package Description + * RIDB secure database wrapper for the web with multiple storage engines, written in rust. * The project started after years of experience working with web projects in both browser and nodejs platforms, the project was born with some rules / objectives: * 1. Strong types + proper validation * 2. Declarative schemas & documents @@ -9,7 +10,7 @@ * 4. Secure encryption * 5. Work seamlessly in browsers or nodejs applications. * - * ## Supported features for InMemory Storage + * ### Supported features for InMemory Storage * The inMemory storage is used by default and is currently supporting the following features: * 1. Schemas: Creation of declararive schemas with required fields * 2. Schemas: Implement validation across all the flows extracting properties and required fields when needed @@ -17,9 +18,13 @@ * 4. Internal Storage: write operation, create, update, fetch one, remove, find and count * 5. Internal Storage: Rust inMemory implementation * 6. Database default InMemory plugged in + * 7. Plugin engine + * 8. Encryption * - * ## Install - * + * ## Documentation + * + * ### Install + * In order to install simply run the following command * npm: * ``` * npm i @elribonazo/ridb --save @@ -31,40 +36,9 @@ * yarn add @elribonazo/ridb * ``` * - * ## Usage - * - * ### Database - * - * In CommonJS Modules: - * - * ```javascript - * const { - * RIDB, - * SchemaFieldType - * } = require('@elribonazo/ridb'); - * - * (async () => { - * const db = new RIDB({ - * demo: { - * version: 0, - * primaryKey: 'id', - * type: SchemaFieldType.object, - * properties: { - * id: { - * type: SchemaFieldType.string, - * maxLength: 60 - * } - * } - * } - * }); - * console.log("Starting the database"); - * await db.start(); - * console.log("Ok :)"); - * })() - * ``` - * - * In ES Modules, TypeScript, etc: - * + * ### Usage + * Creating your own database is pretty straight forward. + * * ```javascript * import { * RIDB, @@ -90,38 +64,10 @@ * console.log("Ok :)"); * })() * ``` - * - * ## How to run tests - * - * ```bash - * cd ts - * npm i - * npm run test - * ``` - * - * ## How to build this project - * Build requirements: - * * Bash - * * Have Rust ([cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)) and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)) installed. - * * Node JS Version (20/LTS Recommended) - * - * ```bash - * cd ts - * npm i - * npm run build - * ``` - * - * ## How to test the project - * For now, we have enabled the implementation of the whole wasm + javascript integration. - * In order to run it, write the following: - * - * ```bash - * cd ts - * npm i - * npm run test - * ``` * - * ## Create your own storage + * ### Specification + * + * #### Storage * A valid storage must extend [BaseStorage class](https://github.com/atala-community-projects/RIDB/blob/main/namespaces/RIDBTypes/classes/BaseStorage.md) * here's some example: * @@ -154,6 +100,38 @@ * ``` * * + * ## Build & Testing + * ### How to run tests + * + * ```bash + * cd ts + * npm i + * npm run test + * ``` + * + * ## How to build this project + * Build requirements: + * * Bash + * * Have Rust ([cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)) and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)) installed. + * * Node JS Version (20/LTS Recommended) + * + * ```bash + * cd ts + * npm i + * npm run build + * ``` + * + * ## How to test the project + * For now, we have enabled the implementation of the whole wasm + javascript integration. + * In order to run it, write the following: + * + * ```bash + * cd ts + * npm i + * npm run test + * ``` + * + * */ import wasmBuffer from "../../pkg/ridb_rust_bg.wasm";