Member Junction
    Preparing search index...

    Entity-specific configuration

    Defines settings for a specific entity type within a directory. Stored in .mj-sync.json files that contain an "entity" field. Supports defaults, file patterns, and related entity configuration.

    interface EntityConfig {
        defaults?: Record<string, any>;
        emitSyncNotes?: boolean;
        entity: string;
        filePattern?: string;
        ignoreDirectories?: string[];
        pull?: {
            appendRecordsToExistingFile?: boolean;
            backupBeforeUpdate?: boolean;
            backupDirectory?: string;
            createNewFileIfNotFound?: boolean;
            excludeFields?: string[];
            externalizeFields?:
                | string[]
                | { [fieldName: string]: { extension?: string } }
                | { field: string; pattern: string }[];
            filePattern?: string;
            filter?: string;
            ignoreNullFields?: boolean;
            ignoreVirtualFields?: boolean;
            lookupFields?: { [fieldName: string]: { entity: string; field: string } };
            mergeStrategy?: "overwrite" | "merge" | "skip";
            newFileName?: string;
            preserveFields?: string[];
            relatedEntities?: Record<string, RelatedEntityConfig>;
            updateExistingRecords?: boolean;
        };
    }
    Index

    Properties

    defaults?: Record<string, any>

    Default field values applied to all records in this directory

    emitSyncNotes?: boolean

    Whether to emit __mj_sync_notes in record files during push operations. When enabled, resolution information for

    and

    references is written to files. If not specified, inherits from root .mj-sync.json. Defaults to false if not set anywhere.

    entity: string

    Name of the entity this directory contains

    filePattern?: string

    Glob pattern for finding data files (defaults to "*.json")

    ignoreDirectories?: string[]

    Directories to ignore during processing Can be directory names or glob patterns relative to the location of the .mj-sync.json file Cumulative: subdirectories inherit and add to parent ignoreDirectories Examples: ["output", "examples", "temp"]

    pull?: {
        appendRecordsToExistingFile?: boolean;
        backupBeforeUpdate?: boolean;
        backupDirectory?: string;
        createNewFileIfNotFound?: boolean;
        excludeFields?: string[];
        externalizeFields?:
            | string[]
            | { [fieldName: string]: { extension?: string } }
            | { field: string; pattern: string }[];
        filePattern?: string;
        filter?: string;
        ignoreNullFields?: boolean;
        ignoreVirtualFields?: boolean;
        lookupFields?: { [fieldName: string]: { entity: string; field: string } };
        mergeStrategy?: "overwrite" | "merge" | "skip";
        newFileName?: string;
        preserveFields?: string[];
        relatedEntities?: Record<string, RelatedEntityConfig>;
        updateExistingRecords?: boolean;
    }

    Pull command specific configuration

    Type Declaration

    • OptionalappendRecordsToExistingFile?: boolean

      Whether to append multiple new records to a single file

    • OptionalbackupBeforeUpdate?: boolean

      Create backup files before updating existing files

    • OptionalbackupDirectory?: string

      Directory name for backup files (defaults to ".backups")

    • OptionalcreateNewFileIfNotFound?: boolean

      Whether to create new files for records not found locally

    • OptionalexcludeFields?: string[]

      Fields to exclude from the pulled data (e.g., ["TemplateID"])

    • OptionalexternalizeFields?:
          | string[]
          | { [fieldName: string]: { extension?: string } }
          | { field: string; pattern: string }[]

      Fields to externalize to separate files with optional configuration

    • OptionalfilePattern?: string

      Glob pattern for finding existing files to update (defaults to filePattern)

    • Optionalfilter?: string

      SQL filter to apply when pulling records from database

    • OptionalignoreNullFields?: boolean

      Whether to ignore null field values during pull (defaults to false)

    • OptionalignoreVirtualFields?: boolean

      Whether to ignore virtual fields during pull (defaults to false)

    • OptionallookupFields?: { [fieldName: string]: { entity: string; field: string } }

      Foreign key fields to convert to

      references

    • OptionalmergeStrategy?: "overwrite" | "merge" | "skip"

      Strategy for merging updates: "overwrite" | "merge" | "skip"

    • OptionalnewFileName?: string

      Filename for new records when createNewFileIfNotFound is true

    • OptionalpreserveFields?: string[]

      Fields to preserve during updates (never overwrite these)

    • OptionalrelatedEntities?: Record<string, RelatedEntityConfig>

      Configuration for pulling related entities

    • OptionalupdateExistingRecords?: boolean

      Whether to update existing records found in local files