For the application to utilize the attributes selected by content editors, the Scrivito SDK now includes a (beta) API for representing data attributes, DataItemAttribute. A data item attribute can be accessed from a data item via DataScope#dataItemAttribute. It can be used to get or update the attribute value, as well as inspect the item and class it originates from. A DataScope now also provides direct access to its attribute name via DataScope#attributeName.
Scrivito JS SDK 1.43.0 Released
Interface builder improvements
Data attributes
Schema for external data
It is now possible to configure a schema when providing a data class or a data item. Whenever an attribute is read, written or filtered, and there is a schema entry for this attribute, the value is matched against its attribute definition. If the value does not match the attribute definition from the schema, an error is logged and a default value is returned.
Schema reflections
When writing DataWidgets, it can be useful to access schema information. For example, when rendering a pulldown form element for an enum attribute, one needs to know which values exist. They can now be determined using the useAttributeDefinition hook, which returns the definition of the current attribute. Additionally, it is possible to access the full schema details of a DataItem or a DataClass directly via DataItem#attributeDefinitions and DataClass#attributeDefinitions, correspondingly.
Extended filtering options
DataScope#transform now features further operators, isGreaterThan, isGreaterThanOrEquals, isLessThan, and isLessThanOrEquals. Additionally, you can now apply multiple filter operators to the same attribute or via the “and” filter specification.
Improved error handling
DataScope#take and DataScope#count now throw a Scrivito.DataScopeError whenever a ClientError or DataConnectionError occurs while the index callback is being executed.
Improved behavior of the useDataItem hook
With the latest Scrivito SDK, the behavior of the useDataItem React hook has changed. Previously, if the closest current data was a DataScope, and the second closest was a DataItem, the hook still returned undefined. Now, the hook returns the closest DataItem even if the current data contains DataScopes that are closer.
Support for further data types
The connection callbacks for provideDataClass now also support external data values of the number, boolean and object or array type, in addition to string and null.
Thank you again for using Scrivito!