npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

zormz

v1.3.1

Published

Un ORM que busca ser ligero y facil de usar

Readme

ZORMZ

Un ORM ligero escrito en TypeScript para MySQL y PostgreSQL, diseñado para ser simple, rápido y extensible.
Permite conectarse a una base de datos, definir tablas desde TypeScript con autocompletado y tipado, y generar tablas automáticamente.


Características

  • Compatible con ESM y CommonJS
  • Tipado completo en TypeScript
  • Builder con sintaxis encadenada: select().from().where().execute()
  • Insert múltiple con arrays
  • Update y Delete con condiciones
  • Definición de columnas con encadenamiento:
    • int().Pk().$()
    • varchar(200).Default("hola").$()
  • Generación automática de tablas en MySQL y PostgreSQL
  • Sin dependencias pesadas
  • Fácil de extender

Instalación

npm install zormz

Uso basico

importacion ESM


import { connecionLocal, getConexion, defineTable, generateTable, int, varchar, DB, eq, ORQ } from "zormz";

importacion COMMONJS

const { connecionLocal, getConexion, defineTable, generateTable, int, varchar, DB, eq, ORQ } = require("zormz");

Conexion a la base de datos

MYSQL

const conexionMysql: connecionLocal = {
  database: "pruebas",
  host: "localhost",
  password: "",
  port: 3306,
  user: "root",
};

getConexion("mysql", conexionMysql);

PG

//Conexion por red , aqui solo se pone la ruta que por defecto te arroja la base de datos de la nube
const conexion2:connecionRed = {
    connectionString:"direccion"
}

const conexion: connecionLocal = {
  database: "pruebamaster",
  host: "localhost",
  password: "zainmaster123",
  port: 5432,
  user: "postgres",
};

getConexion("pg", conexion);

Definicion de Tablas

export const prueba1 = defineTable("prueba1", {
  id: int().Pk().$(),
  valor: varchar(200).Default("hola").$(),
  resultado: int().Default(0).$(),
  fechaRegistro: timestamp().required().now().$(),
  fechaUpdate: timestamp().required().now().onUpdate().$()

});

Notas importantes

  • .pk() define la columna como clave primaria
  • .Default() entrega un valor por defecto
  • .$() finaliza la definicion y entrega un valor compatible con $columns
  • .required() Indica que los valores de la fila no podran ser null, si o si un valor obligatorio
  • .now() Solo esta disponible para timestamp , indica fecha automatica de registra
  • .onUpdate() Tomara la fecha actual cada ves que se haga un update

Generacion de tablas

generateTable(prueba1(), prueba1.$columns);

Esto crea la tabla en la base de datos respetando tipos, claves primarias y valores por defecto.


Eliminar tablas

await dropTable(prueba4());

Insertar Datos

await DB.Insert(prueba1(), [prueba1.valor, prueba1.resultado])
  .Values([["hola mundo", 1], ["prueba", 0]])
  .execute();

Select de Datos

const datos = await DB.select()
  .from(prueba1())
  .where(eq(prueba1.id, 1))
  .execute();

Update de Datos

await DB.Update(prueba1())
  .set({ valor: "nuevo valor", resultado: 2 })
  .where(eq(prueba1.id, 1))
  .execute();

Delete de Datos

await DB.Delete(prueba1())
  .where(ORQ(prueba1.id, 2, 3))
  .execute();

Ejemplo de Uso

import { connecionLocal, getConexion, defineTable, generateTable, int, varchar, DB, eq, ORQ } from "zormz";

const conexion: connecionLocal = {
  database: "pruebamaster",
  host: "localhost",
  password: "pgZORMZ",
  port: 5432,
  user: "postgres",
};

getConexion("pg", conexion);
//MYSQL
//getConexion("mysql", conexion);

const prueba1 = defineTable("prueba1", {
  id: int().Pk().$(),
  valor: varchar(200).Default("hola").$(),
  resultado: int().Default(0).$()
});

generateTable(prueba1(), prueba1.$columns);

async function pruebaData() {
  await DB.Insert(prueba1(), [prueba1.valor, prueba1.resultado])
    .Values([["hola mundo", 1], ["prueba", 0]])
    .execute();

  const datos = await DB.select().from(prueba1()).execute();
  console.log(datos);

  await DB.Update(prueba1())
    .set({ valor: "actualizado", resultado: 2 })
    .where(eq(prueba1.id, 1))
    .execute();

  await DB.Delete(prueba1())
    .where(ORQ(prueba1.id, 2, 3))
    .execute();
}

pruebaData().catch(console.error);

Notas

  • ORM en version inicial con enfoque de tipado y autompletado
  • Compatible con MYSQL y PG
  • Preparado para extenderse
  • Las versiones +1.3.0 son mas estables , las anteriores estaban en desarrollo y presentan multiples errores
  • verion mas estable 1.3.1

Licencia

ISC © Yukio-kayaba

GitHub