Skip to content

WriteAppInstance

Presents one App inside a read-write execution, adding Event publishers and Mutations and handing out writable Templates, Roles, searches and Unions.

Application model

  • BaseAppInstance

readonly events: Record<string, WriteEventPublishInstance>

Publishers for the App-level Events declared by this App, keyed by Event key.


readonly metrics: Record<string, MetricInstance>

Metrics declared by this App, keyed by Metric key.

BaseAppInstance.metrics


readonly mutations: Record<string, MutationHandlerInstance>

Mutation handlers declared by this App, keyed by Mutation key.


readonly prn: string

The PRN identifying this App, for example prn::identity.

BaseAppInstance.prn


readonly queries: Record<string, QueryHandlerInstance>

Query handlers declared by this App, keyed by Query key.

BaseAppInstance.queries


readonly roles: Record<string, WriteAppRoleInstance>

App Roles declared by this App, keyed by Role key, with assignment and revocation.


readonly searches: Record<string, WriteSearchIndexInstance>

Search indexes declared by this App, keyed by search index key, returning writable Items.


readonly templates: Record<string, WriteTemplate>

Templates declared by this App, keyed by Template key, with Item creation.


readonly unions: Record<string, WriteUnionInstance>

Unions declared by this App, keyed by Union key, returning writable Items.


readonly workspaceId: string

The identifier of the Workspace.

BaseAppInstance.workspaceId

assertRole(role): true

Confirms that the active principal holds an App Role.

ReadAppRoleInstance

The Role to check, normally taken from roles.

true

true when the Role is held.

AssertRoleFailedError when the active principal does not hold the Role.

BaseAppInstance.assertRole


checkRole(role): boolean

Reports whether the active principal holds an App Role.

ReadAppRoleInstance

The Role to check, normally taken from roles.

boolean

BaseAppInstance.checkRole


report(request): Promise<Readonly<{ report: MetricReportEntry; }>>

Runs a report over this App’s Metrics.

MetricReportRequest

The Metrics, Dimensions, period and date range to report on.

Promise<Readonly<{ report: MetricReportEntry; }>>

Measure with metrics

BaseAppInstance.report