![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
nukak-browser
Advanced tools
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
nukak is the smartest ORM for TypeScript, it is designed to be fast, safe, and easy to integrate into any application.
nukak can run in Node.js, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, Electron, Bun and Deno.
nukak has a consistent API for distinct databases, including PostgreSQL, MySQL, MariaDB, and SQLite.
const companyUsers = await userRepository.findMany({
$select: { email: true, profile: ['picture'] },
$where: { email: { $endsWith: '@example.com' } },
$sort: { createdAt: -1 },
$limit: 100,
});
See this article in medium.com.
TypeScript
so it auto-completes and validates, the appropriate operators on any level of the queries, including the relations and their fields.100%
valid JSON
allowing the queries to be transported across platforms with ease.FP
(Functional Programming) and OOP
(Object Oriented Programming).transactions
for flexibility, and connection pooling
for scalability.ESM
is natively supported by Node.js 16 and later.json
, jsonb
and vector
fields.
Install the core package:
npm install nukak --save
Install one of the specific adapters for your database:
Database | Driver | Nukak Adapter |
---|---|---|
PostgreSQL | pg | nukak-postgres |
SQLite | sqlite sqlite3 | nukak-sqlite |
MariaDB | mariadb | nukak-maria |
MySQL | mysql2 | nukak-mysql |
For example, for Postgres
:
npm install pg nukak-postgres --save
Additionally, your tsconfig.json
may need the following flags:
"target": "es2022",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
Take any dump class (aka DTO) and annotate it with the decorators from nukak/entity
.
import { randomUUID } from 'node:crypto';
import { Id, Field, Entity } from 'nukak/entity';
/**
* any class can be annotated with this decorator to make it works as
* an entity.
*/
@Entity()
export class User {
/**
* an entity must specify an ID Field, its name and type are automatically detected.
* the `onInsert` property can be used to specify a custom mechanism for
* auto-generating the primary-key's value when inserting.
*/
@Id({ onInsert: () => randomUUID })
id?: string;
/**
* the properties of the class can be annotated with this decorator so they
* are interpreted as a column, its name and type are automatically detected.
*/
@Field()
name?: string;
/**
* fields are `updatable: true` by default but can also be marked as `updatable: false` so they can only be inserted and read after.
*/
@Field({ updatable: false })
email?: string;
/**
* by default, fields are `eager: true`, but they can also be marked as `eager: false` (aka lazy fields).
*/
@Field({ eager: false })
password?: string;
}
A querier-pool can be set in any of the bootstrap files of your app (e.g. in the server.ts
).
// file: ./shared/orm.ts
import { PgQuerierPool } from 'nukak-postgres';
export const querierPool = new PgQuerierPool(
{
host: 'localhost',
user: 'theUser',
password: 'thePassword',
database: 'theDatabase',
},
// optionally, a logger can be passed to log the generated SQL queries
{ logger: console.debug },
);
import { querierPool } from './shared/orm.js';
import { User } from './shared/models/index.js';
async function findLastUsers(limit = 100) {
const querier = await querierPool.getQuerier();
const users = await querier.findMany(User, {
$select: { id: true, name: true, email: true },
$sort: { createdAt: 'desc' },
$limit: limit,
});
return users;
}
async function createUser(data: User) {
const querier = await querierPool.getQuerier();
const id = await querier.insertOne(User, data);
return id;
}
Learn more about nukak
at its website https://nukak.org
FAQs
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
The npm package nukak-browser receives a total of 23 weekly downloads. As such, nukak-browser popularity was classified as not popular.
We found that nukak-browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.