Class/collection (class)

Description

User class metadata.
Allows defining the structure for data and its servicing rules. For each class, the endpoint /rest/v1/model/CLASSPATH appears in the REST API, and operations can be performed through the WebSocket API with capability=rest.

Can place data in memory, in a distributed object DB, in a PostgreSQL relational DB (with partitions for historical data or without), in a Kafka broker, and also save data in the ClickHouse analytical columnar DB.

Each collection publishes changes delivered to subscribers (subscriptions via WebSocket API, authorized based on roles).

Supports several operation modes: fast read, fast notify, asynchronous mode, synchronous mode.
Each of them ensures internal integrity, preventing changes to the original request sequence during processing and notification dispatch. The exception is the processing of different entities in modes using parallel processing. +

Supports property inheritance.
Supports restricting data access for different users to methods and collections by roles (role.routes and iam_all.json), as well as based on complex filters to specific data for reading, modification, field visibility, and the ability to modify them (class.opts.security_filter_read, class.opts.security_filter_write, class.properties..security_filter_read, class.properties..security_filter_write).
Classes in the distributed object DB support automatic deletion by lifetime with automatic extension on save; however, the maximum possible number of records in the collection is limited because applying a filter to a selection requires iterating over the entire collection element by element.

Limitations

  • The collection is unavailable in the master domain.

Fields

Entity structure
{
  "id": uuid,
  "classname": str,
  "name": str,
  "description": str,
  "parent_id": uuid,
  "properties": [
    {
      "name": str,
      "data_type": str,
      "multi": bool,
      "required": bool,
      "default": any,
      "idclass": uuid,
      "items": array<str>,
      "security_filter_read": array,
      "security_filter_write": array
    }
  ]: array<obj>,
  "storage_mode": str,
  "integrity_mode": str,
  "cache_mode": str,
  "opts": {
    "title": str,
    "comment": str,
    "dms_group": object,
    "check_required_fill_defaults": bool,
    "max_limit": int,
    "max_mask": array<str>,
    "max_size": int,
    "store_changehistory_mode": str,
    "caption_property": str,
    "expires_mode": str,
    "expires_ttl_property": str,
    "expires_ts_property": str,
    "storage_instance": str,
    "filestorage_instance": str,
    "lookup_properties": array<str>,
    "partition_property": str,
    "partition_interval": str,
    "partition_count": int,
    "replication_factor": str,
    "notify_transactions": bool,
    "cache_sec": int,
    "cache_limit": int,
    "security_filter_read": array,
    "security_filter_write": array
  },
  "ext": {
    "ct": date,
    "lwt": date
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: classname
Mode: in
Type: str
Default: required

Class collection name. May contain a path separated by '/'. Usually plural.

Field: name
Mode: in
Type: str
Default: empty

Display name of the class

Field: description
Mode: in
Type: str
Default: empty

Class description

Field: parent_id
Mode: in
Type: uuid
Default: empty

Parent class identifier. Inherits all its fields.

Field: properties
Mode: in
Type: array<object>
Default: empty

List of class instance properties.
Each property contains:

  • name — Required field. English property name used in the API and when creating the DB.

  • data_type — Required field. Value type. Variants:

    • string - string;

    • boolean - switch;

    • integer - 32-bit integer;

    • long - 64-bit integer;

    • float - float;

    • increment - 64-bit integer. Allowed only for storage_mode = category, history, transactionlog. Only one increment field per class is allowed, including all inherited fields. Each create and replace operation increments the class counter, even if the operation fails, so gaps in the sequence are possible. The last increment value is saved in object storage, so it is discovered when the class is loaded. Nevertheless, a situation can occur where the last increment value for the class is not read on load, and a conflict of identical values may arise.

    • date - date;

    • time - time;

    • datetime - date and time;

    • uuid - 128-bit unique identifier;

    • enum - enumeration, requires an additional items field;

    • any - arbitrary object stored in JSON format;

    • entity - reference to another data model entity, requires an additional idclass field;

    • attachment - file attachment. The value is filled automatically when an attachment is uploaded via the REST API; when reading the entity it returns file metadata as a JSON object. Access to attachments in the REST API is via concatenation of the entity path and property name.

    • filelink - file link to internal storage. Example value: "sk:s3_records:2025-03-27/09:03/mg12_516647497-1743066216998.mp3". An additional REST endpoint for working with the file is created for the field. An existing link (for example to a call recording file) can be placed directly in the field’s string value during entity creation or modification. Alternatively, a file can be uploaded similarly to an attachment via the REST endpoint for this field; then the file is placed in the same storage where attachments of the current class are configured. The REST endpoint for the field has an additional HTTP method METADATA that returns file information. Deleting a file from storage via the field’s REST endpoint is possible only if it was placed by upload to the field (placed at this target path in the storage attached to the class).

  • caption — Default empty string. Human-readable property name (short, up to 500 bytes).

  • description — Absent by default. Description of the property meaning: units, format, source (up to 2000 bytes).

  • multi — Default false. Switches the field to list mode. Instead of a number, an array of numbers; instead of an attachment, a list of attachments, etc. For attachments, REST API access is to a specific file by name via the property name as part of the path.

  • required — Default false. Flag indicating the property is mandatory.

  • default — Default null. Default value for filling the property.

  • idclass — Only for data_type='entity'.

  • items — Only for data_type='enum'.

  • items_captions — Only for data_type='enum'. Value captions: object "value → caption", keys only from items.

  • secret — Default false. Secret property: the value is stored encrypted with the installation key (more). Secret: when read, ciphertext; the plaintext value is not returned via API and is decrypted by the service when used (Encryption and keys). For string (not multi): true or {"bound": [<field path>]}; for any (not multi): list of paths inside the value — "<path>" or {"path": "<path>", "bound": [<field path>]}, keys separated by ., * — any object key or list element. bound — entity fields (path from root, e.g. options.proxyUrl) whose change requires a user without the admin role to set the secret again. A secret property cannot be specified in caption_property, lookup_properties, unique_properties, partition_property, expires_ttl_property, expires_ts_property; filtering by it does not work. Not applied to classes with storage_mode ets, ram, and runtime or their parent classes.

  • security_filter_read — Default []. Filter for access to viewing the field value for the specific user on whose behalf the read request is executed. Format and application conditions are similar to class.opts.security_filter_read. If it uses a dependency on field values of a specific entity, the field is excluded when reading from the collection. Works similarly to the 'mask' parameter when reading from a collection.

  • security_filter_write — Default []. Filter for access to modifying the field value for the specific user on whose behalf the request is executed. Multiplied by the filter in the 'class.properties.security_filter_read' field. Format and application conditions are similar to class.opts.security_filter_write.

  • security_filter_get — Default [] (the filter from the class.properties.security_filter_read field is used). Optional filter for access to viewing the field value when records are obtained by direct identifier, provided these records are not explicitly allowed by the general read filter clas.opts.security_filter_read. If the record is among the allowed ones, this filter is not applied. This filter is not weaker than the one specified by class.properties.security_filter_read, since it is combined with it by AND. Example case: when it is necessary to provide only names/titles for such records [available only by identifier] (in this case ["const",false] can be set for other fields). Conversely, providing more fields for such records than allowed for the read operation has no practical meaning.

Field: storage_mode
Mode: in
Type: string
Default: category

Storage mode:

  • abstract - abstract collection used only for inheritance and supplying fields to other collections, including abstract ones.

  • ets - storage in the instance RAM. Test or non-critical to data loss mode. Speed ~15000 operations per second.

  • ram - storage in a distributed object DB (mnesia on ram only). Does not persist data to disk. Integrity and safety are ensured while at least one instance of the microservice group responsible for the class is available. Key access and write performance ~10000 per second per free handler thread.

  • runtime - storage in a distributed object DB (mnesia on disc+ram). Persists data to disk and under load significantly loads the disk subsystem for writes. Key access and write performance ~10000 per second per free handler thread.

  • category - storage in a PostgreSQL relational DB without partitioning. Speed up to 10000 operations per second in parallel processing mode, ~3000 operations per second in synchronous mode. Optionally can use an intermediate broker for batch sending data to PostgreSQL.

  • history - storage in a PostgreSQL relational DB with date partitioning. Requires specifying the partition dimension (year, month, day) and the field with the value for partitioning. Optionally can use an intermediate broker for batch sending data to PostgreSQL.

  • transactionlog - sending data to a Kafka cluster. When a storage with type=clickhouse and the same instance value is detected, automatically generates a receiver table from Kafka to ClickHouse (ReplicatedReplacingMergeTree) and makes read operations available.

Field: integrity_mode
Mode: in
Type: string
Default: sync_fast_read

Servicing mode:

  • async - N(=10) read queues distributed by identifier hashes; the read queue is not used.

  • sync - one write queue, one read queue.

  • sync_fast_read - N(=10) read queues distributed by identifier hashes, M(=10) read queues. Notification is sent after saving to the DB. Readers wait for earlier write operations to complete.

  • sync_fast_notify - N(=10) read queues distributed by identifier hashes, M(=10) read queues. The change notification is sent before saving to the DB. Readers do not wait for earlier write operations to complete.

Field: cache_mode
Mode: in
Type: string
Default: temp

In-memory caching mode. Makes sense only for category, history, transactionlog types.

  • full - the entire data volume is cached. Applicable only for type=category. Reads are performed from the cache - lookup by identifier in the cache is fast, but selection with a large volume may be slower than in the original DB engine. Not applied for storage_mode = 'transactionlog'

  • temp - the most recently used data is cached in a limited volume. Removed automatically when the cache overflows. Lookup by identifier in the cache is fast; selection is always performed in the original DB storage.

  • none - cache is not used.

In 'transactionlog' storage mode without a clickhouse storage, 'none' mode is applied automatically.
In 'transactionlog' storage mode with a clickhouse storage, 'full' mode is automatically reset to 'temp'. And 'none' mode assumes no read, replace, and update accesses for at least some time after the last modification operation, since data reaches ClickHouse asynchronously and with some delay.

Field: opts
Mode: in
Type: object
Compound field

Field: opts.title
Mode: in
Type: str
Default: empty

Arbitrary title

Field: opts.comment
Mode: in
Type: str
Default: empty

Arbitrary comment

Field: opts.section
Mode: in
Type: str
Default: empty

Section name to select the responsible dms group (by the sections configuration option).
Section of dms role instances allowed to service this class.
If no section is specified, the filter is not applied, and the class is serviced on dms instances with the minimum numeric group number value.

For each dms instance, several sections can be specified in the configuration, or none at all (which makes sense only for instances with the minimum group number).

If there is no dms instance on the current site servicing the section specified in the class, the class is not serviced (this behavior differs from mservice.opts.section).

Field: opts.dms_group
Mode: in
Type: object
Default: empty

Site → role group index. Default - unique (lowest number) dms group for the domain.
Not implemented

Field: opts.check_required_fill_defaults
Mode: in
Type: bool
Default: true

If entities should be checked for required fields and filled with defaults by the server. The model can save resources.

Field: opts.max_limit
Mode: in
Type: int
Default: 100

How many items can be requested on read at most.

Field: opts.max_mask
Mode: in
Type: array<string>
Default: empty

Max mask of properties that can be returned on collection read.

Field: opts.max_size
Mode: in
Type: int
Default: 10000

Max storage size (only for 'ram' and 'runtime').
Max 1000000.
For storage_mode = 'ram', 'runtime'.

Field: opts.store_changehistory_mode
Mode: in
Type: str
Default: none

Transaction log saving mode for all entity changes of the class.
Possible variants:

  • none - transaction log saving disabled.

  • sync - transaction log saving is synchronous. Work with the class is blocked until the information is placed in the transaction log.

  • async - transaction log saving is asynchronous with sequence preservation. Under high load, queues are built for placing information in the transaction log.

The data model class 'platform/log/HistoryChanges' is used as the log.
It is the single and only receiver of the entire change stream for domain classes configured for transaction logging.

The change history class is created by default from a fixture descriptor with storage_mode='history' and placement in storage_instance='auto'.
The descriptor is applied on every domain restart if the 'ext.fixture_version' value of the discovered entity is lower.

If necessary, the class can be adjusted by placing it in another storage or at another address. The main things are the values 'ext.fixture_version', 'opts.store_changehistory_mode', the field structure, and keeping type 'history' or 'transactionlog'.
Subsequently, fixture changes during system updates must be monitored.

Field: opts.caption_property
Mode: in
Type: str
Default: empty

Name of the property whose value should be displayed for the entity, in particular in the change history.

Field: opts.stat_mode
Mode: in
Type: str
Default: "default"

Per-minute class statistics logging mode.
Possible variants:

  • disabled - class statistics logging forcibly disabled.

  • default - class statistics logging at the medium level is controlled by the dms microservice configuration setting

  • low - Low per-minute statistics logging level. A record appears only if the class has qualitative deviations from the norm.

  • medium - Medium per-minute statistics logging level. In addition to 'low', a metrics line appears if the class processed requests. Two lines with an estimate of handler and notification thread performance over the last minute also appear: count, minimum execution time per request, maximum execution time per request, average execution time per request.

  • high - High per-minute statistics logging level. Information on handler threads is output on multiple lines per operation (collection read, entity read, key lookup, modification, replace, delete, clear)

Field: opts.worker_r_count
Mode: in
Type: str
Default: 0

Number of parallel read operation processing threads.
Value 0 applies the configured default settings (dms' class_readers_count).
Makes sense only for classes operating in modes with parallel processing (all except 'sync').
Values from 0 to 64 are allowed.

Field: opts.worker_w_count
Mode: in
Type: str
Default: 0

Number of parallel write operation processing threads.
Value 0 applies the configured default settings (dms' class_writers_count).
Makes sense only for classes operating in modes with parallel processing (all except 'sync').
Values from 0 to 64 are allowed.

Field: opts.log_read_details_ms
Mode: in
Type: int
Default: 0

Limit execution time of collection read requests in milliseconds; exceeding it leads to logging of request parameters.
Value 0 or lower disables request parameter logging.
Applied only when execution time excess is logged (100 ms - INFO, 1000 ms - WARNING).

Field: opts.expires_mode
Mode: in
Type: str
Default: "none"

When to auto set (reset) the timestamp in the ts property.
Only for storage_mode = runtime.
Values:

  • none - auto-deletion mode is not used.

  • modify - the timestamp is set automatically at any entity modification.

  • create - the timestamp is set automatically only when the entity is created.

  • custom - the timestamp is set only manually via REST.

Field: opts.expires_ttl_property
Mode: in
Type: str
Default: empty

Property of int to set up auto TTL (time-to-live) in seconds.
Only for storage_mode = runtime when opts.expires_mode != none.

Field: opts.expires_ts_property
Mode: in
Type: str
Default: empty

Property of long to set up ts in milliseconds from 1970 (unix time * 1000).
Only for storage_mode = runtime when opts.expires_mode != none.

Field: opts.aggr_cache_ttl_ms
Mode: in
Type: int
Default: 1000

Cache retention time for results of aggregated data read queries.
Applied for storage_mode = runtime, ram, ets.

Data aggregation queries in the listed storages are performed by full scan, so they consume resources in large collections.
If regular simultaneous polling of the same aggregated data is possible, for example obtaining the count of items with a filter from user application dashboards, it makes sense to use a cache of data aggregation calculation results.
Value 0 disables the cache.

When the cache is used, calculation is performed asynchronously without using the handler thread pool.

Field: opts.dirty_write_enabled
Mode: in
Type: bool
Default: false

Switch for debug mode to speed up the class with types 'ram' and 'runtime' without transactions on write operations.
This sharply increases class performance in configurations where Active-Passive DMS instances are separated by a network with long or unstable ping.

Field: opts.storage_instance
Mode: in
Type: str or object
Default: auto

Pointer to the connected storage.

InstanceKey or #{Site ⇒ InstanceKey}.
Only for storage_mode = category, history, transactionlog.

If no configured storage with code 'auto' exists, the class is automatically bound to the model database ('era_model_DOMAIN') created through the main PostgreSQL connection of the domain.

Allowed storage types:

  • for storage_mode = category | history - PostgreSQL storages.

  • for storage_mode = transactionlog - kafka storages and optionally clickhouse.

Field: opts.filestorage_instance
Mode: in
Type: str or object
Default: "auto"

Pointer to the connected file storage for attachments.

InstanceKey or #{Site ⇒ InstanceKey} (for attachments), where InstanceKey defines a storage of type s3, fs, nfs, fsync.
Used only when properties of data_type = attachment are found.
The real attachment path is formed identically regardless of storage type:

  • Category classes, single attachment — …​/Domain/ClassName/Id12/Id34/Id56/IdRest/PropertyName

  • Category classes, multiple attachment — …​/Domain/ClassName/Id12/Id34/Id56/IdRest/PropertyName/FileName

  • History classes, single attachment — …​/Domain/ClassName/PartDate/Id12/Id34/Id56/IdRest/PropertyName

  • History classes, multiple attachment — …​/Domain/ClassName/PartDate/Id12/Id34/Id56/IdRest/PropertyName/FileName

If no configured storage with code 'auto' exists, the class is automatically bound to placement on system file servers.

Field: opts.lookup_properties
Mode: in
Type: array<str>
Default: empty

List of class lookup properties to speed up key (or index) search.

Application principle:
* For runtime, ram, and ets collections, additional hash tables are built from lookup fields to speed up lookup.
* For category and history collections, indexes are built in the PostgreSQL DB from lookup fields and field sets. Only for these class types can the lookup_properties list contain not only individual fields but also field sets (as a nested list of class fields) to create multi-field indexes. For history classes, the partition_property field always forms an index, even if not listed in lookup_properties.
* For transactionlog collections, lookup fields are not applied.

Field: opts.unique_properties
Mode: in
Type: array<str>
Default: empty

List of unique class properties. A subset of lookup_properties (the part listing single class fields).

If a non-unique value is detected during entity creation or modification, the operation is rejected.

Applied for class types 'runtime', 'ram', 'category', 'history'.
For runtime and ram, the uniqueness check takes negligible time; for category and especially history, it is performed by a query with an index filter.

Field: opts.partition_property
Mode: in
Type: str
Default: empty

Property of type=datetime to make partitioned history storage.
Optional for storage_mode = history (pg+partition) - uses date to build a new partition table in the PostgreSQL database.
Required for storage_mode = transactionlog (kafka+clickhouse) - uses date as the ClickHouse primary key prefix.

Field: opts.partition_interval
Mode: in
Type: str
Default: month

Size of partition in partitioned history storage.
For storage_mode = history (pg+partition) - determines the size of one partition and, equally, the conditions for creating a new partition when placing data.
For storage_mode = transactionlog (kafka+clickhouse) - uses the date as the primary sort key when placing data in ClickHouse.
Possible values:

  • year - yearly partition

  • month - monthly partition

  • day - daily partition

Field: opts.broker_mode
Mode: in
Type: str
Default: none

For storage_mode = category and history, optionally allows using a message broker for batch sending data to PostgreSQL.
Possible variants:

  • none - broker is not used; data is written directly to the PostgreSQL connection row by row.

  • internal - uses a broker based on the built-in distributed object DB. Data is written in batches of 1000 records at least once per second. Data accumulation limit is 5 million records. Supports delete operations. No additional serialization occurs; overhead is low.

  • kafka - uses the KAFKA broker whose connection is specified in the storage indicated in the broker_storage_instance option.
    Optionally can use an intermediate broker for batch sending data to PostgreSQL.

A broker makes sense to eliminate the dependency of the product layer writing archive data on DB availability.
The broker can also reduce overhead on connections and pings to the DB through multiple writes.
Bulk write is performed by the PostgreSQL DB server somewhat more optimally and faster.

However, using a broker adds some load due to serialization (kafka) and group clustering operations when preparing multiple queries and distributing them to service handlers.

Generally one executor thread is enough to process the entire stream from the broker.
When increasing the broker_worker_count parameter, the number of handlers can grow to the specified number provided the queue does not decrease over time.

  • The built-in broker (internal) manages intensive inserts more strictly, being able to track the amount of unprocessed data in the broker, but has a limit on stored messages. It also depends less on the size of one message and can sustain up to 30 thousand operations per second with CPU headroom.

  • The KAFKA-based broker (kafka) manages intensive inserts less strictly, relying only on the message stream from KAFKA. When the number of handlers is increased, it tends to distribute entire streams of different KAFKA topic partitions among them. It has no storage size limits and can store data for a long time, making migration to ClickHouse together with the data possible. The data delivery rate from KAFKA depends on the size of each record. Although the number of partitions in KAFKA can be increased arbitrarily, the consumer remains one, so the final rate is also limited by the current CPU.

When using a broker for categories, it is important to keep in mind that data may reach the DB with a delay - at best within a second. Therefore, for reading records by id it may make sense to use the cache. But reading a collection with filters or aggregations will in any case rely on values already in the DB.

Field: opts.broker_worker_count
Mode: in
Type: integer
Default: 1

For storage_mode = category and history with the enabled batch data placement through a broker.
Maximum allowed number of parallel handler processes for the broker message stream.
Usually one is enough, but if data delivery is more intensive than data parsing, additional processes may be involved without exceeding the total allowed number.

Field: opts.broker_storage_instance
Mode: in
Type: str
Default: ''

For storage_mode = category and history with the enabled batch data placement through the KAFKA broker.

Pointer to the used KAFKA broker storage. Allowed storage types: 'kafka'.

Field: opts.broker_format
Mode: in
Type: str
Default: ''

For storage_mode = category and history with the enabled batch data placement through the KAFKA broker.

Using KAFKA requires data serialization and deserialization.
If KAFKA is used for external data consumers, including ClickHouse (storage_mode = transactionlog), the json serialization format is used.
However, json serialization and deserialization are costly text operations that can become noticeable under high load.
To save computational resources, the internal format serialization mode can be used here. It is two orders of magnitude more efficient, but the broker contents cannot be unpacked by external consumers, including when switching history → transactionlog while preserving all data.

Possible values:

  • json - json serialization.

  • term - internal efficient serialization format.

  • '' - default value, 'term' is substituted.

Field: opts.pg_allow_recovery_mode
Mode: in
Type: str
Default: ''

For storage_mode = category and history.

When streaming replication is used for the PostgreSQL storages servicing the class, allows a standby load mode from the DB recovery instance if the master DB instance is unavailable.
In addition, a mode of preferential use of the recovery (readonly) instance can be set for read operations with filters and aggregations from the collection.

The mode combines well with connecting a broker for placing data in the PostgreSQL DB.

Reading data by identifier is traditionally performed only through the master DB instance if the cache is not used or does not contain the record.

Possible values:

  • ` or `default - use the default value from the dms configuration settings.

  • none - load and read only from the PostgreSQL master instance.

  • load_only - class loading on start and reload, cache loading, and maximum increment calculation can be performed from a connection to the DB recovery instance. Allows loading the class when restarting or migrating the DMS microservice when it is impossible to connect to the PostgreSQL master instance.

  • read_allow - class loading on start, cache loading, maximum increment calculation, key lookup, and collection reading with filters and aggregations can be performed from a connection to the DB recovery instance. Allows reading collection data during periods when it is impossible to connect to the PostgreSQL master instance, for example while the decision to convert the available recovery instance to master has not yet been made or implemented.

  • read_prefer - class loading on start, cache loading, maximum increment calculation, key lookup, and collection reading with filters and aggregations are primarily performed from a connection to the DB recovery instance if one is found. Allows offloading the master DB instance by redirecting read requests with filters and aggregations to a less loaded server with a PostgreSQL recovery instance.

The 'load_only' and 'read_allow' modes do not give preference specifically to the master instance, effectively connecting to the first available PostgreSQL instance regardless of its status.

Field: opts.partition_count
Mode: in
Type: int
Default: 1

How many partitions the KAFKA topic has (1-10), used as a default value only.
The explicit value should mainly be defined in the selected storage instance of type 'kafka': optional parameter params.partition_count.

Only for storage_mode = transactionlog (kafka).

Field: opts.replication_factor
Mode: in
Type: int
Default: 2

How many replicas the KAFKA topic has (1-4), used as a default value only.
The explicit value should mainly be defined in the selected storage instance of type 'kafka': optional parameter params.replication_factor.

Only for storage_mode = transactionlog (kafka).

Field: opts.notify_transactions
Mode: in
Type: bool
Default: false

If notifications should be forced. Note that storage_mode = transactionlog is not notified by default.
Only for storage_mode = transactionlog.

Field: opts.custom_topic
Mode: in
Type: str
Default: empty

If a custom topic name should be used directly in KAFKA.
Only for storage_mode = transactionlog.

An empty string means the default use of a generated topic name.
A non-empty string is mainly used for producing events to an existing external topic and assumes no join to ClickHouse by the class itself.

Field: opts.replace_without_read
Mode: in
Type: bool
Default: false

Cancels the entity read operation before replacement. That operation is performed for a) checking replace permissions, b) generating a notification with update or create operation depending on whether the entity existed before replacement.

In 'transactionlog' storage mode without a clickhouse storage it is not used, since the replace operation is unavailable.

Field: opts.cache_sec
Mode: in
Type: int
Default: 600

How long the temporary cache holds modified items.
Only for cache_mode = temp.
Values from 5 to 1800 are allowed.
The interval is used both to detect stale values and to determine check frequency.

The more values in the cache, the more resource-intensive the stale record cleanup.
The cleanup period (also the cache retention time) should be chosen based on the expected class load profile so as to avoid cache overflow (a more expensive periodic cleanup operation) on the one hand.

Field: opts.cache_limit
Mode: in
Type: int
Default: 1000

How many modified items are held in the temporary cache.
Only for cache_mode = temp.
Values from 100 to 100000 are allowed.
If during a periodic check the cache still contains more current records than the set value, those accessed longest ago are forcibly removed from the cache.

The more values in the cache, the more resource-intensive the stale record cleanup.
replace, update, and read_entity operations primarily take the value from the cache.
The maximum cache size should be determined based on the expected class load profile.

Field: opts.security_filter_read
Mode: in
Type: array
Default: []

Filter for user requests to select data from the collection, read a specific collection element (if the class.opts.security_filter_get filter is not assigned), and search by key fields.

The value format matches the 'filter' parameter format when reading a collection (more).
Additionally, extended functions can be used in expressions.

Not applied to requests from users with the 'admin' role.
Not applied to requests from scripts.
Not applied to Token API requests if the integration channel has no user (opts.userid) on whose behalf requests and subscriptions are executed, or if that user or the channel itself has the 'admin' role.

Applied in HTTP REST API, WebSocket REST API, change subscriptions, and notifications.

Inherited using the AND logical function.

Field: opts.security_filter_write
Mode: in
Type: array
Default: []

Filter for user requests to create, replace, modify, or delete a collection element.
Multiplied by the read filter from the 'class.opts.security_filter_read' field.

The value format matches the 'filter' parameter format when reading a collection (more).
Additionally, the '$USER' function can be used, providing access to the authorized user’s data on whose behalf the read request is executed.
See examples in 'opts.security_filter_read'.

Not applied to read requests.
Not applied to requests from users with the 'admin' role.
Not applied to requests from scripts.
Not applied to Token API requests if the integration channel has no user (opts.userid) on whose behalf requests and subscriptions are executed, or if that user or the channel itself has the 'admin' role.

Applied in HTTP REST API, WebSocket REST API.

Inherited using the AND logical function.

Field: opts.security_filter_get
Mode: in
Type: array
Default: []

Filter for user requests to read a specific collection element by identifier. If the value is not set, the filter from the opts.security_filter_read field is used.

Allows implementing the case of obtaining data about an entity for which there is no open read permission, but the identifier may be known through links to other entities, and then part of the data can be obtained.
It is assumed that this filter is weaker than the 'opts.security_filter_read' filter. If set, it is used without combining with the read operation filter. Thus, to disable the filter entirely, that is, to provide any records by identifier without restriction, set the value ["const", true]`.
The set of fields for records obtained by direct identifier, allowed by opts.security_filter_get and prohibited by opts.security_filter_read, may differ from the standard set specified by 'properties.security_filter_read') if the 'properties.security_filter_get' filter is set for fields. For example, when only names/titles need to be provided for such records.

The value format matches the 'filter' parameter format when reading a collection (more).
Additionally, extended functions can be used in expressions.

Not applied to requests from users with the 'admin' role.
Not applied to requests from scripts.
Not applied to Token API requests if the integration channel has no user (opts.userid) on whose behalf requests and subscriptions are executed, or if that user or the channel itself has the 'admin' role.

Applied in HTTP REST API (GET operation by identifier), WebSocket REST API ('read' operation by identifier).

Inherited using the AND logical function.
NOTE: If the parent class has the 'security_filter_read' filter set and the 'security_filter_get' filter is not set, weakening the parent read filter in the child is not possible.

Field: ext
Mode: inout
Type: object
Compound field

Allows extending the compound with arbitrary keys and values

Field: ext.secrets_mark
Mode: out
Type: string

Mark of re-encryption of class secret properties (reencrypt_secrets command): <kid>:<fingerprint> — installation key and fingerprint of the class secret property composition with parents. A class with secret properties whose mark does not match the current installation key or secret property composition — secrets_reencrypt: true in the output and a warning in the domain center. A new class with secret properties, given an installation key, receives a mark if it has no entities (data of the previous class with the same name remains — then a warning; re-encrypt or mark with the reencrypt_secrets_mark command)

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object

Special filter functions

Table 2. Special filter functions
Function Description and examples

$USER

Provides access to the data of the authorized user on whose behalf the read request is made.

Examples:

  • ["$USER"] - user identifier.

  • ["$USER", "id"] - user identifier.

  • ["$USER", "login"] - user login.

  • ["$USER", "ext", "a", "b"] - value of the 'ext.a.b' field of the user account.

  • ["$USER", "security", "mandate"] - value of the 'security.mandate' field of the user account.

Allows accessing deep related user settings - the list of all their roles, including those built on group membership, groups through groups, etc.

  • ["$USER", "ROLES"] - user role list (elements are strings — role names). Replaced with ["list","role1","role2",…​].

  • ["$USER", "ROLES::array"] - user role list (elements are strings — role names). Replaced with ["array","role1","role2",…​]. Used for application in 'hasAny', 'hasAll' functions.

Allows accessing the user’s group list to full depth:

  • ["$USER", "GROUPS"] - user group list (elements are strings — group identifiers). Replaced with ["list","uuid1","uuid2",…​].

  • ["$USER", "GROUPS::array"] - user group list (elements are strings — group identifiers). Replaced with ["array","uuid1","uuid2",…​]. Used for application in 'hasAny', 'hasAll' functions.

Allows accessing the subordinate list. In the simplest full mutual access case, everyone is subordinate to everyone. This is reflected by the single element "all" instead of several identifiers in the list.

  • ["$USER", "SUBORDINATES"] - list of subordinate user identifiers (elements are strings — user identifiers). Replaced with ["list","uuid1","uuid2",…​] or ["list","all"].

  • ["$USER", "SUBORDINATES::array"] - list of subordinate user identifiers (elements are strings — user identifiers). Replaced with ["array","uuid1","uuid2",…​] or ["array","all"]. Used for application in 'hasAny', 'hasAll' functions.

Allows selecting an aggregated value from the set of all entities: the user, all their roles, and groups. The second-order function "DEEP" is used.
Third-order functions MAX, MIN, ANY are supported. By default ANY - the value is taken from the user account; if absent, from one of their roles; if absent, from one of their groups. If absent everywhere, then undefined.
The DEEP function makes sense for accessing ext and security fields, which exist in all three classes and are filled arbitrarily (ext is available for modification by the user through the API, security is not).
For example, to find the maximum available mandate.

Examples:

  • ["$USER", "DEEP", "MAX", "security", "mandate"] - maximum value of the 'security.mandate' field from the user account, all their groups and roles.

  • ["$USER", "DEEP", "MIN", "ext", "priority"] - minimum value of the 'ext.priority' field from the user account, all their groups and roles.

  • ["$USER", "DEEP", "ANY", "ext", "priority"] - value of the 'ext.a.b' field from the user account; if absent, from any role; if absent, from any group.

  • ["$USER", "DEEP", "ext", "a", "b"] - equivalent to the previous one - value of the 'ext.a.b' field from the user account; if absent, from any role; if absent, from any group.

The field path can be of arbitrary depth - a comma-separated list of nested keys.
When the next key is a string, the current value is treated as an object; when the key is a natural number, the current value is treated as an array.

If the specified field or path is not found, the value undefined is substituted, which can be processed by the 'isnull' and 'isnotnull' functions and is correctly converted to 'NULL' when querying specific DBMS types.

Depending on the type of the discovered value, conversion to the final result is performed: numbers remain numbers, strings remain strings, boolean values remain boolean values, arrays are replaced with ["list","elt1","elt2",…​], objects are replaced with undefined.

Complex expression example:

["or",
  ["in",
     "master",
     ["$USER","ROLES"]
  ],
  ["and",
    ["in",
      ["property","status"],
      ["list","in_work","in_review"]
    ],
    ["==",
      ["property","responsibleUserId"],
      ["$USER", "id"]
    ]
  ]
]