Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tailor-platform/sdk/llms.txt

Use this file to discover all available pages before exploring further.

This function is deprecated. Use definePlugins() with generation hooks (onTypeLoaded, generate, etc.) instead.

Function Signature

function defineGenerators(...configs: GeneratorConfig[]): GeneratorConfig[]
Defines generators to be used with the Tailor SDK. This function is deprecated in favor of the more powerful plugin system.

Parameters

...configs
GeneratorConfig[]
required
Variable number of generator configurations. Each configuration is a tuple of [generatorName, options]
[0]
string
required
Generator package name. Built-in generators:
  • "@tailor-platform/kysely-type": Generate Kysely types for TailorDB
  • "@tailor-platform/seed": Generate seed data utilities
  • "@tailor-platform/enum-constants": Generate enum constants
  • "@tailor-platform/file-utils": Generate file utility functions
[1]
object
required
Generator-specific options
distPath
string
required
Output path for generated files (relative to project root)
machineUserName
string
Machine user name for seed generator (only for @tailor-platform/seed)

Returns

configs
GeneratorConfig[]
The same generator configurations array passed as input

Migration to Plugins

The defineGenerators() function has been deprecated in favor of definePlugins(), which provides more flexibility and power. Here’s how to migrate:
import { defineGenerators } from "@tailor-platform/sdk";

export const generators = defineGenerators(
  ["@tailor-platform/kysely-type", { distPath: "./generated/tailordb.ts" }],
  ["@tailor-platform/enum-constants", { distPath: "./generated/enums.ts" }],
  ["@tailor-platform/file-utils", { distPath: "./generated/files.ts" }],
  ["@tailor-platform/seed", { distPath: "./seed", machineUserName: "manager-machine-user" }],
);

Example (Deprecated)

import { defineGenerators } from "@tailor-platform/sdk";

export const generators = defineGenerators(
  ["@tailor-platform/kysely-type", { distPath: "./generated/tailordb.ts" }],
  ["@tailor-platform/enum-constants", { distPath: "./generated/enums.ts" }],
  ["@tailor-platform/file-utils", { distPath: "./generated/files.ts" }],
  ["@tailor-platform/seed", { distPath: "./seed", machineUserName: "manager-machine-user" }],
);

Built-in Generators

Kysely Type Generator

Generates TypeScript types for TailorDB schemas using Kysely.
["@tailor-platform/kysely-type", { distPath: "./generated/tailordb.ts" }]
Requirements:
  • Install @tailor-platform/kysely-type as a dependency
  • Required for using getDB() in resolvers, executors, and workflows

Seed Generator

Generates utilities for seeding data into TailorDB.
["@tailor-platform/seed", { 
  distPath: "./seed", 
  machineUserName: "manager-machine-user" 
}]
Requirements:
  • Install @tailor-platform/function-types as a devDependency

Enum Constants Generator

Generates TypeScript constants for enum values defined in TailorDB schemas.
["@tailor-platform/enum-constants", { distPath: "./generated/enums.ts" }]

File Utils Generator

Generates utility functions for file operations.
["@tailor-platform/file-utils", { distPath: "./generated/files.ts" }]

Notes

  • This function is deprecated and will be removed in a future version
  • Use definePlugins() instead for new projects
  • Generators are passed as tuples (rest arguments), not as an array
  • The generated files are created during the build process
  • Generators depend on your TailorDB schema definitions
  • See the definePlugins documentation for the recommended approach

Build docs developers (and LLMs) love