
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
@ttoss/postgresdb
Advanced tools
This package uses Sequelize to provide a simple framework for working with PostgreSQL databases.
pnpm add @ttoss/postgresdb
pnpm add -D @ttoss/postgresdb-cli
If you already have a database, you can skip this step. If you don't, you can use the following Docker command to create a new PostgreSQL database on port 5432 using Docker:
docker run --name postgres-test -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
Create a folder called models and add a new file called User.ts with the following content:
import { Table, Column, Model } from '@ttoss/postgresdb';
@Table
export class User extends Model<User> {
@Column
declare name: string;
@Column
declare email: string;
}
_This packages exports all decorators from [sequelize-typescript](https://github.com/sequelize/sequelize-typescript), so you can use them to define your models._
Export the model in the models/index.ts file:
export { User } from './User';
Create a new file called src/db.ts with the following content:
import { initialize } from '@ttoss/postgresdb';
import * as models from './models';
export const db = initialize({ models });
You can set the database connection parameters in two ways:
Defining them in the src/db.ts file using the initialize function.
export const db = initialize({
database: '', // database name
username: '', // database username
password: '', // database password
host: '', // database host
port: 5432, // database port. Default: 5432
models,
});
Using environment variables:
DB_NAME: database nameDB_USERNAME: database usernameDB_PASSWORD: database passwordDB_HOST: database hostDB_PORT: database port. Default: 5432@ttoss/postgresdb will use them automatically if they are defined.
To sync the database schema with the models, use the sync command:
pnpm dlx @ttoss/postgresdb-cli sync
By now, you should have a working database with a User table.
You can now use the db object to interact with the database. Check the Sequelize documentation for more information.
import { db } from './db';
const user = await db.User.create({
name: 'John Doe',
email: 'johndoe@email.com',
});
All models are available in the db object.
initialize(options: InitializeOptions): dbInitialize the database connection and load the models.
All Sequelize options are available, expect models.
models: An object with all models to be loaded. The keys are the model names, and the values are the model classes. This way, you can access the models using the db object.This package exports all decorators from sequelize-typescript, i.e., @Table, @Column, @ForeignKey, etc.
ModelColumns<T>A type that represents the columns of a model.
import { Column, Model, type ModelColumns, Table } from '@ttoss/postgresdb';
@Table
class User extends Model<User> {
@Column
declare name?: string;
@Column
declare email: string;
}
/**
* UserColumns = {
* name?: string;
* email: string;
* }
*/
type UserColumns = ModelColumns<User>;
FAQs
A library to handle PostgreSQL database connections and queries
The npm package @ttoss/postgresdb receives a total of 368 weekly downloads. As such, @ttoss/postgresdb popularity was classified as not popular.
We found that @ttoss/postgresdb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.