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

@famgia/omnify-types

v0.0.155

Published

Shared TypeScript types for omnify-schema

Downloads

23,375

Readme

@famgia/omnify-types

Shared TypeScript type definitions for the Omnify schema system.

Installation

npm install @famgia/omnify-types

Usage

import type {
  // Schema types
  SchemaDefinition,
  LoadedSchema,
  SchemaCollection,
  PropertyDefinition,
  AssociationDefinition,

  // Plugin types
  OmnifyPlugin,
  PluginContext,
  PluginLogger,
  CustomTypeDefinition,

  // Generator types
  GeneratorDefinition,
  GeneratorContext,
  GeneratorOutput,
  GeneratorOutputType,

  // Config types
  OmnifyConfig,
  ResolvedOmnifyConfig,
} from '@famgia/omnify-types';

Type Reference

Schema Types

SchemaDefinition

Raw schema definition as loaded from YAML/JSON.

interface SchemaDefinition {
  name: string;
  kind: 'object' | 'enum';
  displayName?: string;
  properties?: Record<string, PropertyDefinition>;
  associations?: Record<string, AssociationDefinition>;
  options?: SchemaOptions;
  values?: string[]; // For enums
}

LoadedSchema

Parsed and validated schema with file path.

interface LoadedSchema extends SchemaDefinition {
  filePath: string;
}

SchemaCollection

Map of schema name to loaded schema.

type SchemaCollection = Record<string, LoadedSchema>;

PropertyDefinition

Field/property definition.

interface PropertyDefinition {
  type: string;
  nullable?: boolean;
  unique?: boolean;
  default?: unknown;
  displayName?: string;
}

AssociationDefinition

Relationship definition.

interface AssociationDefinition {
  type: 'belongsTo' | 'hasMany' | 'hasOne' | 'belongsToMany';
  model: string;
  foreignKey?: string;
  pivotTable?: string;
}

Plugin Types

OmnifyPlugin

Plugin interface for extending Omnify.

interface OmnifyPlugin {
  name: string;
  version: string;

  // Lifecycle hooks
  setup?: (context: PluginContext) => Promise<void>;
  teardown?: () => Promise<void>;

  // Custom types
  types?: CustomTypeDefinition[];

  // Generators
  generators?: GeneratorDefinition[];
}

CustomTypeDefinition

Custom type for extending schema types.

interface CustomTypeDefinition {
  name: string;
  typescript: string;
  laravel: string;
  laravelParams?: unknown[];
}

Generator Types

GeneratorDefinition

Generator definition for creating output files.

interface GeneratorDefinition {
  name: string;
  description?: string;
  dependsOn?: string[];
  generate: (ctx: GeneratorContext) => Promise<GeneratorOutput[]>;
}

GeneratorContext

Context passed to generator functions.

interface GeneratorContext {
  schemas: SchemaCollection;
  pluginConfig: Record<string, unknown>;
  cwd: string;
  logger: PluginLogger;
  previousOutputs: ReadonlyMap<string, readonly GeneratorOutput[]>;
}

GeneratorOutput

Output file from a generator.

interface GeneratorOutput {
  path: string;
  content: string;
  type: GeneratorOutputType;
  metadata?: Record<string, unknown>;
}

type GeneratorOutputType = 'migration' | 'type' | 'model' | 'schema' | 'other';

Config Types

OmnifyConfig

Configuration options.

interface OmnifyConfig {
  schemasDir: string;
  lockFilePath?: string;
  database?: DatabaseConfig;
  output?: OutputConfig;
  plugins?: OmnifyPlugin[];
}

Creating a Plugin

import type { OmnifyPlugin } from '@famgia/omnify-types';

const myPlugin: OmnifyPlugin = {
  name: 'my-plugin',
  version: '1.0.0',

  types: [
    {
      name: 'Money',
      typescript: 'number',
      laravel: 'decimal',
      laravelParams: [10, 2],
    },
  ],

  generators: [
    {
      name: 'my-generator',
      dependsOn: ['other-generator'],

      generate: async (ctx) => {
        return [{
          path: 'output/file.ts',
          content: '// Generated',
          type: 'other',
        }];
      },
    },
  ],
};

export default myPlugin;

Built-in Property Types

type BuiltInPropertyType =
  // Primitive types
  | 'String'      // VARCHAR(255) / TEXT
  | 'Int'         // INT / INTEGER
  | 'BigInt'      // BIGINT / INTEGER
  | 'Float'       // DOUBLE / REAL
  | 'Decimal'     // DECIMAL(p,s)
  | 'Boolean'     // TINYINT(1) / BOOLEAN / INTEGER

  // Text types
  | 'Text'        // TEXT
  | 'LongText'    // LONGTEXT / TEXT

  // Date/Time types
  | 'Date'        // DATE
  | 'Time'        // TIME
  | 'Timestamp'   // TIMESTAMP

  // Special types
  | 'Json'        // JSON / JSONB / TEXT
  | 'Email'       // VARCHAR(255)
  | 'Password'    // VARCHAR(255)

  // File types
  | 'File'        // VARCHAR(255)
  | 'MultiFile'   // JSON

  // Spatial/Geographic types
  | 'Point'       // POINT / geometry(Point, 4326) - native spatial
  | 'Coordinates' // Two DECIMAL columns (latitude, longitude) - cross-DB

  // Enum type
  | 'Enum'        // ENUM / CREATE TYPE / TEXT

  // Selection types
  | 'Select'      // VARCHAR(255)
  | 'Lookup'      // BIGINT (FK reference)

  // Relationship
  | 'Association' // Foreign key / pivot table

Index Types

type IndexType =
  | 'btree'    // Default B-tree index (all dialects)
  | 'hash'     // Hash index (MySQL, PostgreSQL)
  | 'fulltext' // Full-text search (MySQL, PostgreSQL)
  | 'spatial'  // Spatial index (MySQL, PostgreSQL)
  | 'gin'      // GIN index (PostgreSQL only)
  | 'gist'     // GiST index (PostgreSQL only)

Related Packages

License

MIT