Member Junction
    Preparing search index...

    List of all fields within each entity with metadata about each field. Includes data types, relationships, defaults, and UI display preferences.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    __mj_CreatedAt __mj_UpdatedAt _EntityFieldValues _RelatedEntityJoinFieldMappings _RelatedEntityNameFieldIsComputed _RelatedEntityNameFieldIsVirtual _RelatedEntityNameFieldMap _RelatedEntityTableAlias AllowDecryptInAPI AllowsNull AllowUpdateAPI AllowUpdateInView AutoIncrement AutoUpdateCategory AutoUpdateDefaultInView AutoUpdateDisplayName AutoUpdateExtendedType AutoUpdateIncludeInUserSearchAPI AutoUpdateIsNameField AutoUpdateRelatedEntityInfo BaseTable BaseView Category CodeType DefaultColumnWidth DefaultInView DefaultValue Description DisplayName Encrypt EncryptionKeyID Entity EntityClassName EntityCodeName EntityID EntityIDFieldName ExtendedType FieldCodeName FullTextSearchEnabled GeneratedFormSection GeneratedValidationFunctionCheckConstraint GeneratedValidationFunctionCode GeneratedValidationFunctionDescription GeneratedValidationFunctionName ID IncludeInGeneratedForm IncludeInUserSearchAPI IncludeRelatedEntityNameFieldInBaseView IsComputed IsFloat IsNameField IsPrimaryKey IsSoftForeignKey IsSoftPrimaryKey IsUnique IsVirtual JSONType JSONTypeDefinition JSONTypeIsArray Length Name Precision RelatedEntity RelatedEntityBaseTable RelatedEntityBaseView RelatedEntityClassName RelatedEntityCodeName RelatedEntityDisplayType RelatedEntityFieldName RelatedEntityID RelatedEntityJoinFields RelatedEntityNameFieldMap RelatedEntitySchemaName Scale SchemaName ScopeDefault SendEncryptedValue Sequence Status Type UserSearchParamFormatAPI UserSearchPredicateAPI ValueListType ValuesToPackWithSchema ViewCellTemplate

    Accessors

    Methods

    Constructors

    Properties

    __mj_CreatedAt: Date = null
    __mj_UpdatedAt: Date = null
    _EntityFieldValues: EntityFieldValueInfo[]
    _RelatedEntityJoinFieldMappings: {
        alias: string;
        isComputed: boolean;
        isVirtual: boolean;
        sourceField: string;
    }[]

    Collection of all joined field mappings from the related entity.

    _RelatedEntityNameFieldIsComputed: boolean

    Mirror of IsComputed on the related entity's Name Field. Tracked alongside _RelatedEntityNameFieldIsVirtual so that base-view JOIN-target selection can prefer the related entity's base table when the Name Field is a SQL computed/ generated column (physically present in the base table even though IsVirtual=1).

    _RelatedEntityNameFieldIsVirtual: boolean
    _RelatedEntityNameFieldMap: string
    _RelatedEntityTableAlias: string
    AllowDecryptInAPI: boolean = false

    Controls whether encrypted fields are decrypted when returned via API.

    When true:

    • Field value is decrypted before returning to client
    • Use for PII that authorized users should see

    When false:

    • Behavior depends on SendEncryptedValue
    • Use for secrets like API keys that should never leave the server
    false (secure by default)
    
    AllowsNull: boolean = null
    AllowUpdateAPI: boolean = null
    AllowUpdateInView: boolean = null
    AutoIncrement: boolean = null
    AutoUpdateCategory: boolean = true
    • Field Name: AutoUpdateCategory
    • Display Name: Auto Update Category
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows system/LLM to auto-update Category; when 0, user has locked this field
    AutoUpdateDefaultInView: boolean = true
    • Field Name: AutoUpdateDefaultInView
    • Display Name: Auto Update Default In View
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows system/LLM to auto-update DefaultInView; when 0, user has locked this field
    AutoUpdateDisplayName: boolean = true
    • Field Name: AutoUpdateDisplayName
    • Display Name: Auto Update Display Name
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows system/LLM to auto-update DisplayName during CodeGen; when 0, user has locked this field
    AutoUpdateExtendedType: boolean = true
    • Field Name: AutoUpdateExtendedType
    • Display Name: Auto Update Extended Type
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows CodeGen to auto-suggest and apply ExtendedType values (GeoLatitude, GeoLongitude, etc.); when 0, user has locked this field
    AutoUpdateIncludeInUserSearchAPI: boolean = true
    • Field Name: AutoUpdateIncludeInUserSearchAPI
    • Display Name: Auto Update Include In User Search API
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows system/LLM to auto-update IncludeInUserSearchAPI during CodeGen; when 0, user has locked this field
    AutoUpdateIsNameField: boolean = true
    • Field Name: AutoUpdateIsNameField
    • Display Name: Auto Update Is Name Field
    • SQL Data Type: bit
    • Default Value: 1
    • Description: When 1, allows system/LLM to auto-update IsNameField; when 0, user has locked this field
    AutoUpdateRelatedEntityInfo: boolean = true
    • Field Name: AutoUpdateRelatedEntityInfo
    • Display Name: Auto Update Related Entity Info
    • SQL Data Type: bit
    • Default Value: 1
    • Description: Indicates whether the related entity information should be automatically updated from the database schema. When set to 0, relationships not part of the database schema can be manually defined at the application and AI agent level. Defaults to 1.
    BaseTable: string = null
    BaseView: string = null
    Category: string = null
    CodeType: "SQL" | "Other" | "HTML" | "CSS" | "JavaScript" | "TypeScript" = null
    • Field Name: CodeType
    • Display Name: Code Type
    • SQL Data Type: nvarchar(50)
    • Default Value: null
    • Value List Type: List
    • Possible Values: CSS, HTML, JavaScript, Other, SQL, TypeScript
    • Description: The type of code associated with this field. Only used when the ExtendedType field is set to 'Code'
    DefaultColumnWidth: number = null
    DefaultInView: boolean = null
    DefaultValue: string = null
    Description: string = null
    DisplayName: string = null

    Optional property that provides the display name for the field, if null, use the Name property. The DisplayNameOrName() method is a helper function that does this for you with a single method call.

    Encrypt: boolean = false

    When true, this field will be encrypted at rest using the specified EncryptionKeyID. Encrypted fields:

    • Cannot be indexed or searched effectively
    • Are automatically encrypted on save and decrypted on load
    • Store data in the format: $ENC$$$$[$]
    false
    
    EncryptionKeyID: string = null

    References the encryption key to use when Encrypt is true. Must point to an active record in the "MJ: Encryption Keys" entity. Required if Encrypt is true.

    Entity: string = null
    EntityClassName: string = null
    EntityCodeName: string = null
    EntityID: string = null

    Foreign key to the Entities entity.

    EntityIDFieldName: string = null
    ExtendedType: EntityFieldExtendedType = null
    FieldCodeName: string = null
    FullTextSearchEnabled: boolean = false
    GeneratedFormSection: string = null
    GeneratedValidationFunctionCheckConstraint: string = null
    • Field Name: GeneratedValidationFunctionCheckConstraint
    • Display Name: Generated Validation Function Check Constraint
    • SQL Data Type: nvarchar(max)
    • Default Value: null
    • Description: If a generated validation function was generated previously, this stores the text from the source CHECK constraint in the database. This is stored so that regeneration of the validation function will only occur when the source CHECK constraint changes.
    GeneratedValidationFunctionCode: string = null
    • Field Name: GeneratedValidationFunctionCode
    • Display Name: Generated Validation Function Code
    • SQL Data Type: nvarchar(max)
    • Default Value: null
    • Description: Contains the generated code for the field validation function, if it exists, null otherwise.
    GeneratedValidationFunctionDescription: string = null
    • Field Name: GeneratedValidationFunctionDescription
    • Display Name: Generated Validation Function Description
    • SQL Data Type: nvarchar(max)
    • Default Value: null
    • Description: Contains a description for business users of what the validation function for this field does, if it exists.
    GeneratedValidationFunctionName: string = null
    • Field Name: GeneratedValidationFunctionName
    • Display Name: Generated Validation Function Name
    • SQL Data Type: nvarchar(255)
    • Default Value: null
    • Description: Contains the name of the generated field validation function, if it exists, null otherwise.
    ID: string = null

    Primary Key

    IncludeInGeneratedForm: boolean = null
    IncludeInUserSearchAPI: boolean = null
    IncludeRelatedEntityNameFieldInBaseView: boolean = null
    IsComputed: boolean = null

    When true, this field is a SQL Server computed column or PostgreSQL generated column — physically present in the base table but read-only at the SQL layer. Distinct from IsVirtual, which is also set to 1 for these fields (because they are read-only at the API layer) but is additionally set for view-only columns that don't exist in the base table at all (e.g., joined name lookups in the base view). Use the combination to disambiguate: IsVirtual=0, IsComputed=0 → regular base-table column (writable) IsVirtual=1, IsComputed=0 → view-only column (no physical storage) IsVirtual=1, IsComputed=1 → computed/generated column (physical, read-only in SQL) Only relevant downstream consumer that branches on this is base-view JOIN target selection in CodeGen — when an FK's related Name Field is IsComputed=1, the join targets the related entity's base table (not its view).

    IsFloat: boolean
    IsNameField: boolean = null
    IsPrimaryKey: boolean = null

    If true, the field is the primary key for the entity. There must be one primary key field per entity.

    IsSoftForeignKey: boolean = null

    Indicates this field is a soft foreign key (metadata-defined, not a database constraint). When set to 1, RelatedEntityID and RelatedEntityFieldName are preserved and not overwritten by CodeGen schema sync.

    IsSoftPrimaryKey: boolean = null

    Indicates this field is a soft primary key (metadata-defined, not a database constraint). The view ORs this with IsPrimaryKey, so existing code checking IsPrimaryKey works automatically.

    IsUnique: boolean = null

    If true, the field is a unique key for the entity. There can be zero to many unique key fields per entity.

    IsVirtual: boolean = null
    JSONType: string = null

    The name of the TypeScript interface/type for this JSON field. When set, CodeGen will emit a strongly-typed getter/setter using this type instead of the default string getter/setter.

    JSONTypeDefinition: string = null

    Raw TypeScript code emitted by CodeGen above the entity class definition. Typically contains the interface/type definition referenced by JSONType. Can include imports, multiple types, or any valid TypeScript.

    JSONTypeIsArray: boolean = false

    If true, the field holds a JSON array of JSONType items. The getter returns JSONType[] | null and the setter accepts JSONType[] | null.

    Length: number = null
    Name: string = null
    Precision: number = null
    RelatedEntity: string = null
    RelatedEntityBaseTable: string = null
    RelatedEntityBaseView: string = null
    RelatedEntityClassName: string = null
    RelatedEntityCodeName: string = null
    RelatedEntityDisplayType: "Search" | "Dropdown" = null
    RelatedEntityFieldName: string = null
    RelatedEntityID: string = null
    RelatedEntityJoinFields: string = null

    JSON configuration for additional fields to join from the related entity. Parsed from the RelatedEntityJoinFields column.

    RelatedEntityNameFieldMap: string = null
    RelatedEntitySchemaName: string = null
    Scale: number = null
    SchemaName: string = null
    ScopeDefault: string = null
    • Field Name: ScopeDefault
    • Display Name: Scope Default
    • SQL Data Type: nvarchar(100)
    • Description: A comma-delimited string indicating the default scope for field visibility. Options include Users, Admins, AI, and All. Defaults to All when NULL. This is used for a simple method of filtering field defaults for visibility, not security enforcement.
    SendEncryptedValue: boolean = false

    When AllowDecryptInAPI is false, controls what value is returned to clients.

    When true:

    • Send the encrypted ciphertext ($ENC$...)
    • Client knows field is encrypted but can't decrypt

    When false:

    • Send NULL instead of the encrypted value
    • Most secure option - client doesn't even see encrypted data
    false (most secure)
    
    Sequence: number = null

    The sequence of the field within the entity, typically the intended display order

    Status: "Active" | "Disabled" | "Deprecated" = 'Active'
    • Field Name: Status
    • Display Name: Status
    • SQL Data Type: nvarchar(25)
    • Default Value: Active
    • Value List Type: List
    • Possible Values
      • Active
      • Deprecated
      • Disabled
    • Description: Current status of the entity field - Active fields are available for use, Deprecated fields are discouraged but still functional, Disabled fields are not available for use
    Type: string = null
    UserSearchParamFormatAPI: string = null
    UserSearchPredicateAPI: string = null

    Search predicate controlling how user-search queries match against this field in the LIKE-based search path used when the entity does not have FullTextSearchEnabled. Valid values: 'BeginsWith' | 'Contains' | 'EndsWith' | 'Exact'. Default 'Contains'. Honored by GenericDatabaseProvider.createViewUserSearchSQL.

    ValueListType: string = null
    ValuesToPackWithSchema: "Auto" | "None" | "All" = 'Auto'
    • Field Name: ValuesToPackWithSchema
    • Display Name: Values To Pack With Schema
    • SQL Data Type: nvarchar(10)
    • Default Value: Auto
    • Value List Type: List
    • Possible Values
      • Auto
      • None
      • All
    • Description: Determines whether values for the field should be included when the schema is packed. Options: Auto (include manually set or auto-derived values), None (exclude all values), All (include all distinct values from the table). Defaults to Auto.
    ViewCellTemplate: string = null

    Accessors

    • get FixedWidthColumn(): boolean

      Returns true if the field's SQL type is fixed-width / space-padded (SQL Server char/nchar, PostgreSQL char/character/bpchar).

      Authoritative source is @memberjunction/sql-dialect so the list of fixed-width types stays in one place per dialect. BaseEntity reads this on value-set to rtrim padding the DB returned, preventing spurious dirty-flagging when application code stores the logical (un-padded) form of the value.

      Returns boolean

    • get IsCreatedAtField(): boolean

      Returns true if the field is the CreatedAt field, a special field that is used to track the creation date of a record. This is only used when the entity has TrackRecordChanges=1

      Returns boolean

    • get IsDeletedAtField(): boolean

      Returns true if the field is the DeletedAt field, a special field that is used to track the deletion date of a record. This is only used when the entity has DeleteType=Soft

      Returns boolean

    • get IsSpecialDateField(): boolean

      Helper method that returns true if the field is one of the special reserved MJ date fields for tracking CreatedAt and UpdatedAt timestamps as well as the DeletedAt timestamp used for entities that have DeleteType=Soft. This is only used when the entity has TrackRecordChanges=1 or for entities where DeleteType=Soft

      Returns boolean

    • get IsUniqueIdentifier(): boolean

      Returns true if the field is a GUID/UUID column in the database. Accepts both the SQL Server type name (uniqueidentifier) and the PostgreSQL type name (uuid) — on PG the metadata Type is reported as uuid, so a uniqueidentifier-only check would miss every UUID column.

      Returns boolean

    • get IsUpdatedAtField(): boolean

      Returns true if the field is the UpdatedAt field, a special field that is used to track the last update date of a record. This is only used when the entity has TrackRecordChanges=1

      Returns boolean

    • get NeedsClearCompanion(): boolean

      Returns true when the field's spUpdate / spCreate procedure exposes a <Param>_Clear companion parameter — i.e. the field is nullable and has a non-NULL database default.

      Codegen emits the companion so a caller can disambiguate "leave unchanged / apply default" (omit the parameter) from "explicitly set this column to NULL" (<Param>_Clear = 1). Without it, the SP body's ISNULL(@Param, [Col]) merge silently substitutes the existing value or default, and a literal NULL could never be persisted.

      Save-time callers in the data providers use this to decide whether to also emit the _Clear companion parameter when the entity intentionally sets such a field to NULL. Stays in sync with CodeGenLib's needsClearCompanion.

      Note: relies on DefaultValue already being normalized by ExtractActualDefaultValue at populate time — that helper strips the DB's wrapping parens and converts a literal NULL default to JS null. So if HasDefaultValue is true, the default is guaranteed to be non-NULL.

      Returns boolean

    • get SkipValidation(): boolean

      Returns true if the field is a "special" field (see list below) and is handled inside the DB layer and should be ignored in validation by the BaseEntity architecture Also, we skip validation if we have a field that is:

      • the primary key
      • an autoincrement field
      • the field is virtual
      • the field is readonly
      • the field is a special date field

      Returns boolean

    • get SQLFullType(): string

      Returns a string with the full SQL data type that combines, as appropriate, Type, Length, Precision and Scale where these attributes are relevant to the Type

      Returns string

    • get TSType(): EntityFieldTSType

      Provides the TypeScript type for a given Entity Field. This is useful to map a wide array of database types to a narrower set of TypeScript types.

      Memoized: this getter is read per-field on extremely hot paths (the EntityField value getter/setter, BaseEntity.Set/SetMany, dirty-tracking, hydration, and the raw-mode Get() date check). Recomputing the SQL→TS classification (which runs several string-matching helpers + toLowerCase) on every access is wasteful since Type never changes after load.

      Returns EntityFieldTSType

    Methods

    • Copies initialization data from a plain object to the class instance. Only copies properties that already exist on the class to prevent creating new fields. Special handling for DefaultValue fields to extract actual values from SQL Server syntax.

      Parameters

      • initData: any

        The initialization data object

      Returns void

    • Formats a value based on the parameters passed in. This is a wrapper utility method that already know the SQL type from the entity field definition and simply calls the generic FormatValue() function that is also exported by @memberjunction/core

      Parameters

      • value: any

        Value to format

      • decimals: number = 2

        Number of decimals to show, defaults to 2

      • currency: string = 'USD'

        Currency to use when formatting, defaults to USD

      • maxLength: number = 0

        Maximum length of the string to return, if the formatted value is longer than this length then the string will be truncated and the trailingChars will be appended to the end of the string

      • trailingChars: string = "..."

        Only used if maxLength is > 0 and the string being formatted is > maxLength, this is the string that will be appended to the end of the string to indicate that it was truncated, defaults to "..."

      Returns string

      either the original string value or a formatted version. If the format cannot be applied an an exception occurs it is captured and the error is put to the log, and the original value is returned

    • Returns true when this field appears as a parameter in the entity's spCreate (when isUpdate=false) or spUpdate (when isUpdate=true) stored procedure.

      This is the single source of truth for the SP parameter contract, consumed by both:

      CodeGen, when emitting the SP body (which @params to declare and which columns to INSERT/UPDATE), and • Runtime data providers, via the RenderSaveCallBinding hook implemented by SQLServerDataProvider and PostgreSQLDataProvider (orchestrated by GenericDatabaseProvider.GenerateSaveSQL), when building the EXEC / parameter list passed to the SP.

      Keeping both sides on the same predicate guarantees the SP signature and the call-site argument list always agree. Drift between them surfaces as a SQL Server "Procedure or function ... has too many arguments specified" error at save time (or its PG equivalent).

      Exclusion rules (in order):

      IsVirtual — view-only / joined columns. Not present in the base table; the SP body never references them. Also covers IS-A parent fields on child entities — those are saved via the parent's SP, not the child's, so they must not appear in the child's SP params. • IsComputed — SQL Server computed columns and PG generated columns. Physically present in the base table but read-only at the SQL layer (INSERT/UPDATE cannot target them). Today IsComputed=1 implies IsVirtual=1, but checking both is defensive against future decoupling of the flags. • IsSpecialDateField__mj_CreatedAt, __mj_UpdatedAt, __mj_DeletedAt. Set inside the SP body / trigger from GETUTCDATE() rather than by the caller. • Non-PK fields without AllowUpdateAPI — by definition not callable via the SP signature.

      PK handling:

      • On update, the PK is always a parameter (required to identify the row). • On create, the PK is a parameter only when it's NOT auto-increment — the SP body declares it with a default so the caller can either supply a value or let the database default fire (e.g. NEWSEQUENTIALID()). For auto-increment PKs, the SP intentionally doesn't expose the PK as a parameter.

      Parameters

      • isUpdate: boolean

        true for spUpdate, false for spCreate.

      Returns boolean

    • Default JSON serialization for BaseInfo subclasses.

      Emits all non-underscored direct field declarations. For _-prefixed private backing fields (the MJ pattern for collection storage — e.g. _Fields, _RelatedEntities, _OrganicKeys), emits the value of the corresponding same-named public getter instead. Purely computed getters without a backing field (display-name formatters, derived flags) are intentionally skipped — they can throw when source fields are null and don't belong on the wire anyway.

      Nested BaseInfo instances and arrays of them unwrap automatically via JSON.stringify's native toJSON() protocol.

      Subclasses may override to emit a filtered subset or custom shape (see EntityFieldValueInfo).

      Returns Record<string, unknown>

    • This static factory method is used to check to see if the entity field in question is active or not If it is not active, it will throw an exception or log a warning depending on the status of the entity field being either Deprecated or Disabled.

      Parameters

      • entityField: EntityFieldInfo

        the EntityFieldInfo object to check the status of

      • callerName: string

        the name of the caller that is calling this method, used for logging purposes such as EntityField::constructor as an example.

      Returns void

    • Checks if a default value is a SQL Server function that returns the current date/time

      Parameters

      • defaultValue: string

        The default value to check

      Returns boolean

      true if the default value is a SQL current date/time function, false otherwise