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

@pylonts/schema-core

v1.0.1

Published

Standard abstraction layer for schema definition: `FieldType`, `BaseFieldDef`, `Semantics`, `defineEnum`.

Readme

@pylon/schema-core

Standard abstraction layer for schema definition: FieldType, BaseFieldDef, Semantics, defineEnum.

Consumed by:

  • @pylon/mysql-schema — column/table DSL (col(), defineTable()), DDL & enum generation
  • @pylon/dsl-dto — DTO field definitions

FieldType

| FieldType | MySQL type (via @pylon/mysql-schema) | Notes | |-----------|---------------------------------------|-------| | INT | INT | integer columns | | REAL | DECIMAL(precision, scale) | money/rate columns | | STRING | VARCHAR(max) | text columns | | ENUM | VARCHAR(20) | stored as string, never MySQL ENUM; enum: references a defineEnum | | BOOLEAN | — | | | DATE | DATE | date only | | DATETIME | DATETIME | date + time | | ARRAY | — | |

Column rules

Empty-string default rule

default: '' is not allowed. A column default is either:

  1. a real business value — e.g. 'enabled', '0', '#FF6B35', 'CURRENT_TIMESTAMP'; or
  2. nullable: true — the column allows NULL, meaning "no value yet" (optional data).

An empty-string default has no distinguishable business meaning: it cannot be told apart from "not provided" once written, and it hides whether the data is optional or required-but-unset.

Mapping guidance:

| Intent | Declare as | |--------|-----------| | Optional data, value may be absent | nullable: true | | Required data with a sensible default | default: '<real value>' | | Auto-generated timestamp | default: 'CURRENT_TIMESTAMP' |

If a genuinely special case requires an empty-string default, document the business reason in the column description — but the col() factory rejects it by default (see @pylon/mysql-schema col()).

nullable vs default

  • nullable: true → column allows NULL; omitting the column on INSERT stores NULL.
  • default: '<value>' → column is NOT NULL; omitting the column on INSERT stores the default.

They are not interchangeable in the database model: NULL means "no value", '' means "an empty string value". Prefer NULL for absent data.

Enum definitions

import { defineEnum } from '@pylon/schema-core';

export const OrderStatus = defineEnum('OrderStatus', {
  PENDING: { value: 'pending', label: '待处理' },
  DONE:    { value: 'done', label: '已完成' },
});

Enums are referenced by col({ type: FieldType.ENUM, enum: OrderStatus }) — stored as VARCHAR, generated into TS enum products by @pylon/mysql-schema generate-enums.

Semantics

Semantic codes annotate a column's business meaning (see semantics.ts). Project-specific semantics are defined in schema/semantics.ts and layered over the standard set.