Skip to content

ReadItem

Presents a read-only Item below the Workspace Item, with its hierarchy, archive and refresh state.

WriteItem

readonly createdAt: Date

When the Item was created, taken from the execution time of the execution that created it.

BaseReadItem.createdAt


readonly definition: TemplateDefinition

The Template definition the Item was created from, with any extension Properties of its parent merged in.

BaseReadItem.definition


readonly id: string

The Item identifier, a UUID.

BaseReadItem.id


readonly isArchived: boolean

Whether the Item is archived; archived Items are left out of selections unless archived asks for them.

StandardItem.isArchived


readonly isRefreshOverdue: boolean

Whether a scheduled refresh time has passed without the Item being refreshed since.

StandardItem.isRefreshOverdue


readonly isRefreshPending: boolean

Whether a refresh is scheduled for a time still in the future.

StandardItem.isRefreshPending


readonly key: string | undefined

The Item’s key relative to its parent, or undefined when it has none.

StandardItem.key


readonly parentId: string | undefined

The identifier of the Item’s parent.

StandardItem.parentId


readonly properties: PropertyMap

Plain Property values keyed by Property key, ready for application logic.

Select values are reduced to option keys: a single-select reads as its option key or null, a multi-select as an array of option keys. instant and datetime values are Luxon DateTime objects. A Property that is unset, invalid or not granted to the principal reads as undefined.

PropertyMap

BaseReadItem.properties


readonly propertyValues: PropertyValueMap

Property values keyed by Property key, each tagged with its data type.

Use this form when the data type is significant, for example to tell an unset value from a stored value that has become invalid. Properties the principal is not granted are absent.

PropertyValue

BaseReadItem.propertyValues


readonly refreshBy: Date | undefined

When the next refresh is due, or undefined when none is scheduled.

StandardItem.refreshBy


readonly refreshedAt: Date | undefined

When the Item was last refreshed, or undefined when it never has been.

StandardItem.refreshedAt


readonly relations: Record<string, ReadRelationInstance>

Relations declared on the Item’s Template, keyed by Relation key and navigated from this Item’s side.

ReadRelationInstance

BaseReadItem.relations


readonly state: ReadStateInstance<string | null> | null

The Item’s current state, or null when its Template declares no states.

BaseReadItem.state


readonly templatePrn: string

The PRN of the Template the Item was created from.

BaseReadItem.templatePrn


readonly workspaceId: string

The identifier of the Workspace holding the Item.

BaseReadItem.workspaceId

assertRole(role): Promise<true>

Confirms that the active principal holds a Template Role on this Item.

TemplateRoleInstance

A Role from the Template’s roles.

Promise<true>

true when the Role is held.

AssertRoleFailedError when the active principal does not hold the Role on this Item.

BaseReadItem.assertRole


checkRole(role): Promise<boolean>

Reports whether the active principal holds a Template Role on this Item.

TemplateRoleInstance

A Role from the Template’s roles.

Promise<boolean>

BaseReadItem.checkRole


currentRoles(): Promise<BaseRoleInstance[]>

Lists the Template Roles the active principal holds on this Item.

Promise<BaseRoleInstance[]>

Sudo and system contexts hold every Role the Template declares.

Grant access

BaseReadItem.currentRoles


extensions<TReadTemplate>(template): Promise<ReadTemplateExtension>

Reads the Property extensions in force for children of this Item created from an extensible Template.

TReadTemplate extends BaseReadTemplate & object

TReadTemplate

The extensible Template.

Promise<ReadTemplateExtension>

when the Template is not extensible or this is the Workspace Item.


getAncestors(): Promise<ReadItem[]>

Loads the ancestors of this Item, nearest parent first, up to and including the Workspace Item.

Promise<ReadItem[]>

The ancestors the active principal can read, stopping at the first unreadable one; the Workspace Item has none.

BaseReadItem.getAncestors


getChildByKey(key): Promise<ReadItem | undefined>

Finds the child of this Item that carries a key.

string

The child’s key, relative to this Item.

Promise<ReadItem | undefined>

The child, or undefined when no child the active principal can read carries the key.

BaseReadItem.getChildByKey


getParent(): Promise<ReadItem | undefined>

Loads the parent of this Item.

Promise<ReadItem | undefined>

The parent, or undefined for the Workspace Item, which has no parent.

BaseReadItem.getParent


selectChildren(): ItemCursorSelector<ReadItem>

Starts a selection over the children of this Item.

ItemCursorSelector<ReadItem>

The selection leaves out archived children and returns children in creation order until narrowed, sorted or paginated.

ItemCursorSelector