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

@dforge-core/metadata

v0.0.7

Published

Canonical dForge authoring registries — field types, base datatypes, column types, traits, data-view kinds and chart types — with derivation helpers. Runtime-dependency-free; the single source of truth shared by editors, the web app and the CLI.

Readme

@dforge-core/metadata

Canonical dForge authoring registries, module-file types, and JSON schemas — the single source of truth shared by the web app, the SDK, the diagram library, the CLI, the MCP server, and the VS Code extension.

  • Runtime-dependency-free. Safe to import anywhere — editors, bundled web apps, Node CLIs, MCP servers.
  • One source of truth. The registries mirror the platform metadata seed (server/database/system-modules/metadata/seed-data/) and the structural types mirror the JSON schemas under docs/schemas/. Parity tests fail the build if either drifts.

Install

pnpm add @dforge-core/metadata

What's inside

| Surface | Exports | | --- | --- | | Field types | fieldTypes, fieldTypeCds, isFieldTypeCd, getFieldType, fieldTypesByColumnType | | Base datatypes | baseDatatypes, baseToDbDatatype | | Column types | columnTypes, getColumnType | | Traits | traits, getTrait, expandTrait, expandTraits | | Derivation | deriveDbDatatype, deriveBaseDatatype, defaultParams, NUMERIC_TOTAL | | Aggregation | AggType, AGG_TYPE_LIST | | Display flags | flagDefs (V Visible · I Identity · E Editable · M Mandatory · H Hidden) | | View / report kinds | dataViewKinds, vizTypes, chartTypes | | Scalar enums | FieldTypeCd, BaseDatatypeCd, ColumnTypeCd, FlagCd, AlignType | | Module-file types | ManifestDef, EntityDef, DataViewsFile, ReportsFile, MenusFile, FoldersFile, RolesFile, SettingsFile, JobsFile, TriggersFile, WebhooksFile, PrintTemplatesFile, SeedDataFile, ActionsFile, … | | Filter expression | Filter, FilterCondition, FilterGroup, SortClause | | JSON schemas | ./schemas/<name>.schema.json (see Schemas) |

Registries & derivation

An author picks a friendly fieldTypeCd; the helpers derive the physical metadata so no one types a raw SQL type by hand.

import {
  getFieldType,
  isFieldTypeCd,
  deriveDbDatatype,
  deriveBaseDatatype,
  defaultParams,
} from "@dforge-core/metadata";

isFieldTypeCd("currency");          // true
isFieldTypeCd("reference");         // false — not a real code (it's `lookup`)

getFieldType("currency");
// { cd: "currency", columnType: "D", baseDatatypeCd: "number", precision: 2, ... }

deriveDbDatatype("currency");       // "numeric(18,2)"
deriveDbDatatype("text");           // "varchar"
deriveDbDatatype("textarea");       // "text"
deriveDbDatatype("lookup");         // null — relationship-backed, no own column
deriveBaseDatatype("color");        // "string"
defaultParams("number");            // { min: 0, max: 10000 }

Traits

import { expandTrait, expandTraits } from "@dforge-core/metadata";

// Expand a trait into the FieldDef map it contributes to an entity.
expandTrait("audit", "invoice");
expandTraits(["identity", "audit"], "invoice");

Module-file types

The structural types describe the authoring shape of every file in a .dforge module package — the same shapes the JSON schemas validate.

import type { ManifestDef, EntityDef, DataViewsFile } from "@dforge-core/metadata";

const entity: EntityDef = {
  description: "Customer",
  dbObject: "customer",
  fields: {
    /* … */
  },
};

Note: these are the authoring shapes. The resolved runtime model returned by the API (metadata.getModel) is a different contract — see @dforge/sdk's Model* types, which reuse the scalar enums from this package.

JSON schemas

The 14 canonical schemas are shipped alongside the types and stay byte-identical to docs/schemas/ (a parity test enforces it; prepack re-syncs before publish). Import them directly or point a validator / editor at the files.

import entitySchema from "@dforge-core/metadata/schemas/entity.schema.json" with { type: "json" };
// VS Code settings.json — validate module files against the shipped schemas
"json.schemas": [
  {
    "fileMatch": ["entities/*.json"],
    "url": "./node_modules/@dforge-core/metadata/schemas/entity.schema.json"
  }
]

Available: manifest, entity, data_views, folders, menus, roles, settings, reports, jobs, triggers, webhooks, print_templates, traits, seed_data.

Source of truth & parity

This package never edits the canonical sources — it mirrors them and guards the mirror:

  • Registries mirror the platform metadata seed; test/registries.test.ts fails if a code drifts from field_types.json (and a compile-time coverage guard fails if the FieldTypeCd union and the fieldTypes array diverge).
  • Schemas are copied from docs/schemas/ by pnpm sync-schemas; test/schemas.test.ts fails if the shipped copy drifts. prepack re-syncs.

When consumed standalone (no monorepo around the package) the parity checks are skipped — the shipped data is authoritative on its own.

Scripts

pnpm build          # tsc → dist/
pnpm test           # vitest (registry + schema parity)
pnpm sync-schemas   # refresh schemas/ from docs/schemas/

License

MIT