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 {
        collections?: Record<
            string,
            { maxImpliedDeletePercent?: number; mode?: "upsert"
            | "authoritative" },
        >;
        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;
        };
        push?: { skipGeoCoding?: boolean; writeSyncMetadata?: boolean };
    }
    Index

    Properties

    collections?: Record<
        string,
        { maxImpliedDeletePercent?: number; mode?: "upsert"
        | "authoritative" },
    >

    Declarative collection configuration for composition axes. Key is collection property name (e.g. "Lines", "Payments").

    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

    push?: { skipGeoCoding?: boolean; writeSyncMetadata?: boolean }

    Push-specific options for this entity directory. Applied only on mj sync push (not pull). Add new per-save / per-entity push knobs here rather than as global CLI flags so each entity can opt in independently.

    Type Declaration

    • OptionalskipGeoCoding?: boolean

      Maps to EntitySaveOptions.SkipGeoCoding so sample data with pre-filled lat/lng (or display-only geo entities) does not call the geocoding provider. Per-entity, not a global CLI kill switch.

    • OptionalwriteSyncMetadata?: boolean

      When false, skips creating or updating sync metadata blocks (record.sync) on records pushed from this directory. Used by decision metadata directories so decision files never carry sync blocks. Defaults to true.