/** * Noun Inference and Definition * * Provides inferNoun() for automatic noun inference from type names * and defineNoun() for explicit noun definition. * * @packageDocumentation */ import type { Noun, NounProperty, NounRelationship, TypeMeta } from './types.js'; /** * Infer a complete Noun from just a type name * * Automatically generates singular/plural forms, default CRUD actions, * and event types from a PascalCase type name. * * @example * ```ts * inferNoun('BlogPost') * // => { * // singular: 'blog post', * // plural: 'blog posts', * // actions: ['create', 'update', 'delete'], * // events: ['created', 'updated', 'deleted'], * // } * * inferNoun('Category') * // => { * // singular: 'category', * // plural: 'categories', * // actions: ['create', 'update', 'delete'], * // events: ['created', 'updated', 'deleted'], * // } * ``` */ export declare function inferNoun(typeName: string): Noun; /** * Options for defining a noun */ export interface DefineNounOptions { /** Singular form (required) */ singular: string; /** Plural form (auto-generated if not provided) */ plural?: string; /** Human-readable description */ description?: string; /** Property definitions */ properties?: Record; /** Relationship definitions */ relationships?: Record; /** Actions that can be performed */ actions?: string[]; /** Events that can occur */ events?: string[]; /** Additional metadata */ metadata?: Record; } /** * Define a complete Noun with all metadata * * @example * ```ts * const Person = defineNoun({ * singular: 'person', * plural: 'people', * description: 'A human individual', * properties: { * name: { type: 'string', description: 'Full name' }, * email: { type: 'email', description: 'Email address' }, * }, * relationships: { * manager: { type: 'Person', operator: '->', description: 'Direct manager' }, * }, * actions: ['create', 'update', 'delete', 'archive'], * events: ['created', 'updated', 'deleted', 'archived'], * }) * ``` */ export declare function defineNoun(options: DefineNounOptions): Noun; /** * Create TypeMeta from a type name - all linguistic forms auto-inferred * * @example * ```ts * const meta = createTypeMeta('BlogPost') * meta.singular // 'blog post' * meta.plural // 'blog posts' * meta.slug // 'blog-post' * meta.created // 'BlogPost.created' * meta.createdAt // 'createdAt' * meta.creator // 'creator' * ``` */ export declare function createTypeMeta(typeName: string): TypeMeta; /** * Get or create TypeMeta for a type name (cached) */ export declare function getTypeMeta(typeName: string): TypeMeta; /** * Type proxy - provides dynamic access to type metadata * * @example * ```ts * const Post = Type('Post') * Post.singular // 'post' * Post.plural // 'posts' * Post.created // 'Post.created' * * // In event handlers: * on.create(thing => { * console.log(thing.$type.plural) // 'posts' * }) * ``` */ export declare function Type(name: string): TypeMeta; /** * Clear the type metadata cache (useful for testing) */ export declare function clearTypeMetaCache(): void; //# sourceMappingURL=noun.d.ts.map