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

@flinkk/tenant-form

v1.0.4

Published

Tenant lifecycle data operations (create/read/update/delete, license-aware onboarding) for Flinkk CRM

Readme

@flinkk/tenant-form

Data/service-layer functions for creating, reading, updating, and deleting Tenant rows and their initial seed data — the one place tenant provisioning logic lives, so callers (a signup flow, an admin "add organization" screen, or a CLI script) don't each reimplement it slightly differently.

Exports

All from the package root (import { ... } from "@flinkk/tenant-form"):

| Export | What it does | | --- | --- | | createTenant(input: CreateTenantInput) | Creates a Tenant row and seeds its default data in one call: system roles, the creator's Owner membership (if createdById is given), status options, standard fields, lead-conversion mapping, and currency configurations. Runs inside the new tenant's own request context so every seed step is properly scoped under a saas-standalone license. | | getTenantById(id) / getTenantByDomainOrSlug(domainOrSlug) / listTenants(filter?) | Read helpers. | | updateTenant(id, input: UpdateTenantInput) | Partial update of tenant settings (name, branding, address, tax config, etc). | | deleteTenant(id) | Deletes a tenant. |

License-aware tenant ids

Under a "standalone" or "saas-standalone" license, a new tenant's id cannot be arbitrary — extensions/tenant-filter.ts in @flinkk/database forces every query to the license's fixed tenant (standalone) or rejects any tenant not in the license's allowed list (saas-standalone). createTenant calls resolveLicensedTenantId() internally to enforce this: under standalone it ignores input.id and uses the license's one fixed tenant (erroring if that tenant already exists — only one is ever permitted); under saas-standalone it requires input.id to be one of the license's allowed tenant ids and errors if that id is already provisioned. Getting this wrong doesn't fail loudly at the database level — the tenant would be created successfully but be permanently unreachable through every tenant-scoped query in the app, so input.id must match the license exactly for those two license types.

Under "saas" (unrestricted), input.id is used as given, or Prisma auto-generates one if omitted.

Usage

import { createTenant } from "@flinkk/tenant-form";

const tenant = await createTenant({
  name: "Acme Inc",
  id: "cmo8mley900018gtikrcaokt0", // required under standalone/saas-standalone; must match the license
  domain: "acme.example.com",
  currency: "USD",
  country: "US",
  createdById: userId, // omit for unattended/seed creation - no Owner membership is created
});

There's also a CLI entry point for provisioning a tenant outside the app itself:

ts-node --transpile-only scripts/create-tenant-cli.ts \
  --name "Acme Inc" --id acme --domain acme.example.com \
  --currency USD --country US --created-by <userId>

Not yet wired here

help-portal defaults, default reports, notification-email config, quote templates, and email templates are currently only reachable as HTTP routes under the consuming app's app/api/setup/* (not as importable functions from this package) — callers that need those still call those routes directly.

License

ISC License - Internal Flinkk library