Ionnet ORM is a TypeScript ORM for NodeJS. It is designed to be simple and easy to use, using decorators to define models and relationships, and a simple API to query the database.
Disclaimer
This is a work in progress, and is not ready for production use. Not all features are implemented, and the API is subject to change.
Installation
npm install @ionnet/orm
Decorators need to be enabled in your tsconfig.json file.
Easy user authentication
This will be done using a decorator on the model, and a simple API to create users, register, login, and logout, and handle tokens, sessions, and cookies.
// Example of what this might look likeimport { DBModel, Field, Authenticator } from"@ionnet/orm";
classUserextendsAuthenticator.Model { // Use the Authenticator.Model class instead of DBMModel to enable authentication.@Field.PrimaryKey({ auto: true })
@Field.INT()
id: number;
@Authenticator.Username()
@Field.INT()
username: string;
@Authenticator.Password() // This will automatically be varchar(255) and will be stored hashed.password: string;
@Authenticator.Email()
@Field.VARCHAR(255)
email: string;
@Field.VARCHAR(255)
firstName: string;
@Field.VARCHAR(255)
lastName: string;
@Field.INT()
age: number;
@Field.DATE()
birthday: Date;
}
// Create a new userconst user = awaitUser.register(
"username", // This will be assigned to be what the @Authenticator.Username() decorator is on."plaintext_password", // This will be assigned to be what the @Authenticator.Password() decorator is on.
); // Returns a new User object.// Loginconst user = awaitUser.login(
"username",
"plaintext_password",
); // Returns a new User object. If the username or password is incorrect, it will throw an error.
FAQs
A simple TypeScript ORM for SQLite (and other databases in the future)
We found that @ionnet/orm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Last updated on 12 Jan 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
CISA launched a new project called Vulnrichment to enrich CVEs with details that help prioritize patching and mitigation efforts, as the NVD backlog of unenriched CVEs awaiting analysis surpasses 10,000.
Socket is joining forces with CISA and other industry leaders at the RSA Conference to sign the Secure by Design pledge, committing to uphold the highest security standards in our products.
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.