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.
Function Signature
Parameters
Variable number of plugin instances. Each plugin must implement the
Plugin<TypeConfig, PluginConfig> interfaceReturns
The same plugin configurations array passed as input
Plugin Interface
Plugins implement the following interface:Plugin Lifecycle Hooks
Called for each TailorDB type that has the plugin attached via
.plugin(). Generates types, resolvers, and executors based on the source type.Context:type: The TailorDB type being processedtypeConfig: Per-type configuration from.plugin()pluginConfig: Plugin-level configuration fromdefinePlugins()namespace: TailorDB namespace
TypePluginOutput with optional types, resolvers, executors, and extendsCalled once per namespace for plugins configured via
definePlugins(). Generates types independently of user-defined types.Context:pluginConfig: Plugin-level configurationnamespace: Target namespace
NamespacePluginOutput with optional types, resolvers, and executorsCalled after all TailorDB types are loaded and finalized. Processes finalized artifacts and produces output files.Returns:
GeneratorResult with generated files and optional errorsCalled after all resolvers are loaded and finalized.Returns:
GeneratorResult with generated files and optional errorsCalled after all executors are loaded and finalized.Returns:
GeneratorResult with generated files and optional errorsExample
Using Built-in Plugins
Attaching Plugins to Types
Creating a Custom Plugin
Built-in Plugins
Kysely Type Plugin
Generates TypeScript types for TailorDB schemas using Kysely.- Required for using
getDB()in resolvers, executors, and workflows
Enum Constants Plugin
Generates TypeScript constants for enum values.File Utils Plugin
Generates utility functions for file operations.Seed Plugin
Generates utilities for seeding data into TailorDB.- Install
@tailor-platform/function-typesas a devDependency
Plugin Output Types
Generated Types
kind key is used to generate distinct TypeScript type files.
Generated Resolvers
Generated Executors
Notes
- Plugins can hook into two lifecycle phases:
- Definition-time hooks: Generate TailorDB types, resolvers, and executors (
onTypeLoaded,onNamespaceLoaded) - Generation-time hooks: Process finalized artifacts and produce output files (
onTailorDBReady,onResolverReady,onExecutorReady)
- Definition-time hooks: Generate TailorDB types, resolvers, and executors (
- The
importPathis required when a plugin has definition-time hooks for proper import statement generation - Per-type configuration is passed via the
.plugin()method on TailorDB types - Plugin-level configuration is passed via the plugin factory function and available in all hooks
- Plugins are more powerful than the deprecated
defineGenerators()function - See the example/ directory for working implementations