HeapObject - Record (String) of the Heap Table
A record in the heap table consists of a combination of:
- user-defined fields specified by the developer when declaring the table using Heap.Table,
- and system fields.
When reading records using methods from HeapTableRepo, user-defined and system fields are combined into a single object, which is referred to in this documentation as a heap object or HeapObject.
System Fields
Below are the system fields that all heap objects possess. The names of these fields are reserved and cannot be used for top-level table fields declared by the developer.
-
<b id="id">id</b>:
string
A globally unique identifier for the record. In most cases, it is automatically generated using an internal algorithm based on the nanoid library. It is globally unique across all records in all tables. -
<b id="createdAt">createdAt</b>: Date
The time the record was created. It is automatically set during the create or createOrUpdateBy operation and is never changed. -
<b id="updatedAt">updatedAt</b>: Date
The time of the last modification of the record. Initially equal to the value of createdAt and is automatically updated with each update, updateMaybe, or createOrUpdateBy operation. -
<b id="createdBy">createdBy</b>: RefLink
<
User> | null
A reference to the user in the context of whose authorized request the record was created. If there was no user in the context, the value is null. -
<b id="updatedBy">updatedBy</b>: RefLink
<
User> | null
A reference to the user in the context of whose authorized request the last modification of the record occurred. If there was no user in the context, the value is null. -
<b id="heapType">heapType</b>:
string
Corresponds to the type property of the table to which the heap object belongs.For advanced users. This field should not be used without a compelling reason.
The remaining keys of the heap object are fields declared by the developer of the heap table, the values of which are the deserialized runtime representation corresponding to each field type.
Helper Types for Heap Object Fields
Fields of some complex types are represented in the heap object not as raw simple JavaScript types (like string
or number
), but as objects with methods (instances of classes) for convenient manipulation of these fields. In this section, you will find detailed descriptions of such classes:
- RefLink - for reference fields pointing to records in other tables, declared using Heap.RefLink and Heap.UserRefLink.
- GenericLink - for reference fields pointing to records in other tables, declared using Heap.GenericLink.
- Money - for fields storing monetary amounts, declared using Heap.Money.
- StorageFile - for fields storing a hash link to a file in Chatium's built-in storage, declared using Heap.StorageFile.
- StorageImageFile - for fields storing a hash link to image files in Chatium's built-in storage, declared using Heap.StorageImageFile.
- StorageVideoFile - for fields storing a hash link to video files in Chatium's built-in storage, declared using Heap.StorageVideoFile.
- StorageAudioFile - for fields storing a hash link to audio files in Chatium's built-in storage, declared using Heap.StorageAudioFile.
All listed classes, except for
RefLink
andGenericLink
, can also be used independently of the heap table for working with the corresponding data types.