Property configuration for the BaseEngine class to automatically load/set properties on the class.

Hierarchy (view full)

Constructors

Properties

AddToObject?: boolean

Optional, whether to add the result to the object, defaults to true if not specified

AutoRefresh?: boolean = true

Optional, defaults to true. If set to false, AutoRefresh for this item will be disabled. By default, whenever a BaseEntity event is emitted for a save/delete, if the entity name for this config matches the BaseEntity's entity name, the config will be refreshed. If this is set to false, that will not happen. NOTE: This is not a network notification mechanism, it only works within the local tier, so for example within a browser application, that brower's engine sub-classes will be updated when changes are made to entities in that application environment, and the same is true for MJAPI/Server based environments. If you need network based notification, additional infrastructure will be needed to implement that.

CacheLocal?: boolean

When set to true, the engine will use the LocalCacheManager to cache results locally. On subsequent loads (unless forceRefresh is true), cached results will be returned immediately without hitting the server if they are still valid.

This is useful for frequently-accessed, relatively-static data that doesn't need real-time freshness. The cache is automatically invalidated when entity data changes.

Default

false
CacheLocalTTL?: number

Optional TTL (time-to-live) in milliseconds for locally cached results when CacheLocal is true. After this time, cached results will be considered stale and fresh data will be fetched. If not specified, the LocalCacheManager's default TTL will be used (typically 5 minutes).

DatasetItemFilters?: DatasetItemFilterType[]

Optional, filters to apply to each item in a dataset, only applies when type is 'dataset' and is optional in those cases.

DatasetName?: string

The dataset name to load from the database, required if Type is 'dataset'

DatasetResultHandling?: "single_property" | "individual_properties" = 'single_property'

Optional, only used if Type is 'dataset', specifies how to handle the results of the dataset load. Defaults to 'single_property' if not specified. When set to 'single_property', the entire dataset is set to the property specified by PropertyName. When set to 'individual_properties', each item in the dataset is set to a property on the object with the name of the item's key plus the item's Code name. For example, if the item's key is 'Demo' and the item's Code name is 'FirstItem', the property set on the object would be 'Demo_FirstItem'.

DebounceTime?: number

Optional debounce time in milliseconds for this specific config. If not specified, uses the engine's default EntityEventDebounceTime (5000ms). This allows different entities to have different debounce delays.

EntityName?: string

The entity name to load from the database, required if Type is 'entity'

Expiration?: number

Optional, expiration time in milliseconds

Filter?: string

Optional, filters to apply to the data load, applies only when type is 'entity'. Use DatasetItemFilters for dataset filters.

ID: any = null

Primary Key

OrderBy?: string

Optional, order by clause to apply to the data load, only applies when type is 'entity'

PropertyName: string

The name of the property in the class instance

Type: "entity" | "dataset" = 'entity'

The type of item to load, either 'entity' or 'dataset', defaults to 'entity'

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