Skip to content

SystemWriteRuntimeInstance

Defined in: runtime/runtime.ts:105

This interface is only availabe in specific “system” access contexts. Specifically, this instance is available in App Hooks like onCreate/onSeed. Methods in this interface MUST NOT be available to a regular principal accessing the system.

readonly apps: Record<string, WriteAppInstance>

Defined in: runtime/runtime.ts:74

WriteRuntimeInstance.apps


readonly now: DateTime

Defined in: runtime/runtime.ts:39

WriteRuntimeInstance.now


readonly principalId: string

Defined in: runtime/runtime.ts:40

WriteRuntimeInstance.principalId


readonly root: WriteAppInstance

Defined in: runtime/runtime.ts:75

WriteRuntimeInstance.root


readonly workspaceId: string

Defined in: runtime/index.ts:39

WriteRuntimeInstance.workspaceId

getItem(id): Promise<WriteItem<ItemInstanceTypes> | undefined>

Defined in: runtime/runtime.ts:76

string

Promise<WriteItem<ItemInstanceTypes> | undefined>

WriteRuntimeInstance.getItem


getItemByKeyPath(…parts): Promise<WriteItem<ItemInstanceTypes> | undefined>

Defined in: runtime/runtime.ts:77

…[string, ...string[]]

Promise<WriteItem<ItemInstanceTypes> | undefined>

WriteRuntimeInstance.getItemByKeyPath


getWorkspaceItem(): Promise<WriteWorkspaceItem>

Defined in: runtime/runtime.ts:78

Promise<WriteWorkspaceItem>

WriteRuntimeInstance.getWorkspaceItem


getWorkspaceTemplate(): ReadTemplate

Defined in: runtime/runtime.ts:45

ReadTemplate

WriteRuntimeInstance.getWorkspaceTemplate


hashKey(source): Promise<string>

Defined in: runtime/runtime.ts:52

Creates a key by hashing the provided value. The source can be up to 1,024 characters.

string

Promise<string>

WriteRuntimeInstance.hashKey


log(message, …optional): void

Defined in: runtime/runtime.ts:46

any

any[]

void

WriteRuntimeInstance.log


seed(options): Promise<void>

Defined in: runtime/runtime.ts:116

Performs a batch seed operation. This is a managed upsert of the value provided in the options.

SeedOptions

Promise<void>


seedId(key): string

Defined in: runtime/runtime.ts:126

Returns a stable identifier based upon the provided key. This is generated from the Workspace Id and the provided value. Supplying the same value will generate the same identifier. This method is mostly useful for using the seed function.

string

string

SystemWriteRuntimeInstance#seed


selectEvents(): EventCursorSelector<EventInstance>

Defined in: runtime/runtime.ts:110

Returns an event selection builder that allows querying events in this workspace.

EventCursorSelector<EventInstance>


selectItems(): ItemCursorSelector<WriteItem<ItemInstanceTypes>>

Defined in: runtime/runtime.ts:84

Returns an item selection builder that allows retrieving items that are in this workspace

ItemCursorSelector<WriteItem<ItemInstanceTypes>>

WriteRuntimeInstance.selectItems


sudo<TResult>(fn): Promise<TResult>

Defined in: runtime/runtime.ts:91

Moves into a readwrite sudo role: This is effectively system, but tracked against the existing principal (if any). Calling this from system does nothing. If you are already sudo, the existing sudo is retained.

TResult

(ctx) => Promise<TResult>

Promise<TResult>

WriteRuntimeInstance.sudo


template(prn): Promise<WriteTemplate<WriteItem<ItemInstanceTypes>> | undefined>

Defined in: runtime/runtime.ts:96

Return the template matching the supplied prn.

string

Promise<WriteTemplate<WriteItem<ItemInstanceTypes>> | undefined>

WriteRuntimeInstance.template


workspaceSeedId(key): string

Defined in: runtime/runtime.ts:135

Returns a workspace-scoped stable identifier based on the provided key. This is for use inside the seed function when the runtime id is needed outside of the id, parent_id, and relationships: like inside content.

string

string

SystemWriteRuntimeInstance#seed