InternalSetting

InternalSetting

InternalSetting differs from AppSetting in two ways. First, InternalSettings cannot be edited, or even seen, by users. Second, while the value attribute of AppSettings are strings, the value of InternalSettings can be any JavaScript object. It's up to the developer to manage values.

InternalSettings are used to track values that users don't have to manage. For example, a setting called 'migrations' may contain an array that lists which data migrations have already run.

Constructor

new InternalSetting(opts, value)

Creates a new InternalSetting

Parameters:
Name Type Description
opts object

Object containing properties to set.

Properties
Name Type Description
id string

A UUID in hex-string format. This is the object's unique identifier.

userCanDelete boolean

Indicates whether user is allowed to delete this record.

name string

The name of the setting. This should be unique, to prevent confusion.

value Object

The value of the setting. Any object type is OK, but keep in mind that it will be serialized to JSON when saved to the DB.

Source:

Members

name :string

Name is the name of the setting. Setting names should be unique, to prevent confusion.

Source:

value :Object

Value is the value of the setting, which can be any valid JavaScript object. Keep in mind that this object will be serialized to JSON for storage, and will be restored as a JSON data structure instead of as the original object. (That is, it won't have any functions.) It's up to the developer to manage the values of InternalSetting objects.

Source:

Methods

(static) inflateFrom(data) → {InternalSetting}

This converts a generic hash/object into an InternalSetting object. this is useful when loading objects from JSON.

Parameters:
Name Type Description
data object

An object you want to convert to an InternalSetting. This object should have the properties 'name' and 'value'.

Source:
Example
let data = { name: 'Homer', value: 'Simpson' };
let setting = InternalSetting.inflateFrom(data);

validate() → {boolean}

validate returns true or false, indicating whether this object contains complete and valid data. If it returns false, check the errors property for specific errors.

Source: