functional-models
    Preparing search index...

    Interface PropertyConfigOptions<TValue>

    Standard configuration options for properties.

    interface PropertyConfigOptions<TValue extends Arrayable<DataValue>> {
        autoNow?: boolean;
        choices?: readonly ChoiceTypes[];
        defaultValue?: TValue;
        fetcher?: ModelInstanceFetcher<object, object>;
        isDenormalized?: boolean;
        lazyLoadMethod?: <TData extends Readonly<{ [s: string]: any }>>(
            value: TValue,
            modelData: CreateParams<TData>,
        ) => TValue;
        lazyLoadMethodAtomic?: <TData extends Readonly<{ [s: string]: any }>>(
            value: TValue,
            modelData: CreateParams<TData>,
        ) => Promise<TValue>;
        maxLength?: number;
        maxValue?: number;
        minLength?: number;
        minValue?: number;
        typeOverride?: string;
        validators?: readonly PropertyValidatorComponent<any, object, object>[];
        value?: TValue;
        valueSelector?: (instanceValue: MaybePromise<TValue>) => TValue;
    }

    Type Parameters

    Index

    Properties

    autoNow?: boolean

    If the value should be created automatically. Used in date creation.

    choices?: readonly ChoiceTypes[]

    Possible limiting choices of what the property can be.

    defaultValue?: TValue

    A default value if one is never given.

    fetcher?: ModelInstanceFetcher<object, object>

    If you are using ModelReferences, this is required. A fetcher used for getting model references. This configuration item is used within the AdvancedModelReferenceProperty and any other property that is lazy loading (atomically) models.

    isDenormalized?: boolean

    Determines if this value needs to go through denormalization.

    lazyLoadMethod?: <TData extends Readonly<{ [s: string]: any }>>(
        value: TValue,
        modelData: CreateParams<TData>,
    ) => TValue

    A lazy loading method, which will only run when the value is actually retrieved. IMPORTANT: Do not include promises as part of this because they are not thread safe.

    Type declaration

      • <TData extends Readonly<{ [s: string]: any }>>(
            value: TValue,
            modelData: CreateParams<TData>,
        ): TValue
      • Type Parameters

        • TData extends Readonly<{ [s: string]: any }>

        Parameters

        Returns TValue

    lazyLoadMethodAtomic?: <TData extends Readonly<{ [s: string]: any }>>(
        value: TValue,
        modelData: CreateParams<TData>,
    ) => Promise<TValue>

    A thread safe (Atomic) version of lazyLoadMethod. Use this for all lazy loadings that requires Promises.

    Type declaration

      • <TData extends Readonly<{ [s: string]: any }>>(
            value: TValue,
            modelData: CreateParams<TData>,
        ): Promise<TValue>
      • Type Parameters

        • TData extends Readonly<{ [s: string]: any }>

        Parameters

        Returns Promise<TValue>

    maxLength?: number

    The maximum length of the value. (Drives validation)

    maxValue?: number

    The maximum size of the value. (Drives validation)

    minLength?: number

    The minimum length of the value. (Drives validation)

    minValue?: number

    The minimum size of the value. (Drives validation)

    typeOverride?: string

    A type override to override the property type of a property.

    validators?: readonly PropertyValidatorComponent<any, object, object>[]

    Additional validators for the property.

    value?: TValue

    The value of the property (if provided)

    valueSelector?: (instanceValue: MaybePromise<TValue>) => TValue

    An optional function that can select a "part" of the value to return.