Skip to content
Français

RecipeComponentDefinition

import type { RecipeComponentDefinition } from "@elie-laloum/outpost/recipes";
  • nameRequired
    string
    Unique factory identifier in category.name form, such as sink.console.
  • kindRequired
    string
    Category of the produced object; references must request this exact category.
  • schemaRequired
    Readonly<Record<string, unknown>>
    Static JSON Schema for options; component annotations identify nested typed references.
  • experimentalOptional
    boolean | undefined
    Require experimental: true in local YAML before accepting this factory.
  • createRequired
    (options: Readonly<Record<string, unknown>>, context: RecipeComponentContext) => unknown | Promise<unknown>
    Construct the component after static validation; dependencies resolve through the context.
  • acceptsRequired
    (value: unknown) => boolean
    Validate the runtime object returned by this factory or a local extension in the same category.
  • disposeOptional
    ((value: unknown) => void | Promise<void>) | undefined
    Release objects created by this factory after dependents; omitted for objects without owned resources.
export interface RecipeComponentDefinition {
  readonly name: string;
  readonly kind: string;
  readonly schema: JsonSchema;
  readonly experimental?: boolean;
  create(
    options: Readonly<Record<string, unknown>>,
    context: RecipeComponentContext,
  ): unknown | Promise<unknown>;
  accepts(value: unknown): boolean;
  dispose?(value: unknown): void | Promise<void>;
}