Member Junction
    Preparing search index...

    Definition of a single extraction rule that defines how to extract an attribute from artifact content.

    Extract rules are stored as JSON in the ArtifactType.ExtractRules column and support hierarchical inheritance where child types can override parent rules.

    const emailSubjectRule: ArtifactExtractRule = {
    name: 'subject',
    description: 'Email subject line',
    type: 'string',
    standardProperty: 'name',
    extractor: `
    // content is the artifact content (JSON, text, etc.)
    const parsed = JSON.parse(content);
    return parsed.subject;
    `
    };
    interface ArtifactExtractRule {
        description: string;
        extractor: string;
        name: string;
        standardProperty?: ArtifactStandardProperty;
        type: string;
    }
    Index

    Properties

    description: string

    Human-readable description of what this rule extracts.

    extractor: string

    JavaScript code that performs the extraction.

    The extractor function receives the artifact content as input and returns the extracted value. The function body should be valid JavaScript that:

    1. Receives a 'content' variable (string) containing the artifact content
    2. Performs necessary parsing/extraction logic
    3. Returns a value matching the declared 'type'

    Security Note: This code is executed in a sandboxed environment. You may not access external resources or do anything that would result in side effects.

    // Extract subject from JSON email
    const parsed = JSON.parse(content);
    return parsed.subject || 'Untitled';
    // Extract first heading from Markdown
    const match = content.match(/^#\s+(.+)$/m);
    return match ? match[1] : null;
    name: string

    Unique name for this extraction rule within the artifact type hierarchy. Used as the key for overriding parent rules and for storing extracted values.

    standardProperty?: ArtifactStandardProperty

    Optional mapping to a standard property for UI rendering.

    When set, this extracted value can be used by the UI for specific purposes:

    • 'name': Display name of the artifact
    • 'description': Description/summary of the artifact
    • 'displayMarkdown': Markdown-formatted display content
    • 'displayHtml': HTML-formatted display content

    If undefined, this is a custom attribute specific to the artifact type.

    type: string

    TypeScript type definition for the extracted value.

    Can be:

    • Primitive types: 'string', 'number', 'boolean', 'Date'
    • Complex types: 'Array', 'Record<string, any>'
    • Custom interfaces: 'Array<{x: number, y: string}>'
    'string'
    
    'number'
    
    'Array<{id: string, name: string}>'