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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tailor-platform/function-typeorm-tailordb

v0.1.1

Published

TypeORM helpers for TailorDB

Readme

@tailor-platform/function-typeorm-tailordb

TypeORM integration helpers for TailorDB.

This package provides minimal components to execute SQL and manage transactions against TailorDB with a Postgres-like shape, intended to be used alongside TypeORM. It exposes a lightweight query runner and an experimental DataSource integration.

Important: Schema sync and migrations are not supported. TailorDB is the source of truth for schema. Generate code from the live schema using the companion codegen package.

Note: TypeORM does not offer a public, stable plugin API for custom drivers. The DataSource integration below is experimental and aims to support basic CRUD through Repository/QueryBuilder. Complex features are out of scope.

Install

# npm
npm install @tailor-platform/function-typeorm-tailordb
# pnpm
pnpm add @tailor-platform/function-typeorm-tailordb

We recommend installing @tailor-platform/function-types for TailorDB typings when working in the Function service.

Using @tailor-platform/function-types

@tailor-platform/function-types provides ambient type declarations for Tailor Platform globals such as tailordb, tailor.secretmanager, etc.

  1. Install as a dev dependency
# npm
npm install -D @tailor-platform/function-types
# pnpm
pnpm add -D @tailor-platform/function-types
  1. Add to your tsconfig.json so TypeScript picks up the globals (recommended config)
{
  "extends": "@tsconfig/recommended/tsconfig.json",
  "compilerOptions": {
    "target": "ESNext",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "types": ["@tailor-platform/function-types"]
  }
}

After this, you can use the global tailordb.Client with proper types without importing it:

const client = new tailordb.Client({ namespace: "<namespace>" });
await client.connect();
const result = await client.queryObject<{ now: string }>("select now() as now");

Minimal SQL usage

import { TailordbClientQueryRunner } from '@tailor-platform/function-typeorm-tailordb';

const client = new tailordb.Client({ namespace: '<tailordb namespace>' });
await client.connect();

const qr = new TailordbClientQueryRunner(client);

// Execute raw SQL
await qr.query('select 1');

// Transactions
await qr.startTransaction();
try {
  await qr.query('insert into foo(bar) values($1)', ['baz']);
  await qr.commitTransaction();
} catch (e) {
  await qr.rollbackTransaction();
  throw e;
}

await client.end();

This query runner is intentionally minimal and designed for raw queries or integration scenarios where you manage SQL directly.

Experimental: TypeORM DataSource integration (Tailor Platform Function)

This package includes an experimental integration intended for the Tailor Platform Function runtime (which does not provide Node built‑ins). It patches TypeORM’s browser DriverFactory at runtime and returns a DataSource configured for TailorDB. Advanced features are not supported.

Recommended usage:

import { createDatasource } from '@tailor-platform/function-typeorm-tailordb';
import { App_Users } from './entities'; // generated by codegen

const ds = createDatasource('<tailordb namespace>', [App_Users]);
await ds.initialize();

// Minimal query
const rows = await ds.query('select 1 as one');

// Transaction
const qr = ds.createQueryRunner();
await qr.startTransaction();
try {
  await qr.query('insert into app.sample(col) values($1)', ['val']);
  await qr.commitTransaction();
} catch (e) {
  await qr.rollbackTransaction();
  throw e;
} finally {
  await qr.release();
}

await ds.destroy();

Repository/QueryBuilder basic CRUD (limited)

Register generated entities in the DataSource to use simple CRUD. Complex queries or relations are not guaranteed.

import { createDatasource } from '@tailor-platform/function-typeorm-tailordb';
import { App_Users } from './entities';

const ds = createDatasource('<namespace>', [App_Users]);
await ds.initialize();

const repo = ds.getRepository(App_Users);

// Create
const created = await repo.save({ name: 'Alice', email: '[email protected]' });

// Read
const found = await repo.findOne({ where: { id: created.id } });

// Update
await repo.update({ id: created.id }, { name: 'Alice Updated' });

// Delete
await repo.delete({ id: created.id });

await ds.destroy();

Limitations (prototype)

  • No schema sync or migrations. Use the codegen package to keep entities in sync with TailorDB.
  • Focused on basic CRUD via Repository/QueryBuilder. Advanced relations, cascades, partial update return shapes, etc., are not guaranteed.
  • Parameters: Postgres-style positional parameters are supported. Named parameters like :name are minimally converted to $n.