Skip to content

UnionBuilder

Groups Templates so that Events, Relations and operation outputs can target any member.

A Union is a membership list, not an inheritance mechanism: members keep their own Properties and Grants. Events declared on a Union are available on every member Item alongside the member’s own Events. Membership is resolved when the Definition is built, so Templates added further on in the spec are included.

readonly prn: string

Platform Resource Name of the Union, derived from the App key and Union key.

BaseBuilder.prn

addEvent(key): EventBuilder

Declares an Event that can be published against any member Item of this Union.

string

Event key within the Union.

EventBuilder

The Event builder.


addRelation(key, cardinality, to, options?): RelationBuilder

Declares a Relation of the given cardinality from member Items of this Union to Items of to.

string

Relation key on the Union.

RelationCardinality

Cardinality read from the members to to.

TemplateBuilder | UnionBuilder

Target Template or Union.

RelationOptions

Naming of the reverse side; toKey defaults to key.

RelationBuilder

The Relation builder.

The Relation is registered on every member Template when the Definition is built, and the build fails if toKey collides with a Relation key already declared on a target.

RelationBuilder


addTemplate(template): this

Adds one or more Templates to the Union membership. Adding a member twice adds it once.

TemplateBuilder | TemplateBuilder[]

Template or Templates to add.

this

This builder for chaining.


setDescription(description): this

Sets the description emitted into the definition and rendered in generated reference and application assets.

string

Human-readable description of the resource.

this

This builder for chaining.

BaseBuilder.setDescription


toDefinition(): UnionDefinition

Emits the Definition of this Union, including the PRNs of its current members.

UnionDefinition