Skip to main content

TaskBuilder

@gravity-rail/sdk


@gravity-rail/sdk / TaskBuilder

Class: TaskBuilder

Extends​

Constructors​

Constructor​

new TaskBuilder(name, workflow, prompt?, start?, description?): TaskBuilder

Parameters​

name​

string

workflow​

WorkflowBuilder

prompt?​

string = ''

start?​

boolean = false

description?​

string = ''

Returns​

TaskBuilder

Overrides​

WorkspaceBuilderResource.constructor

Properties​

_created​

_created: boolean = false

Inherited from​

WorkspaceBuilderResource._created


_existed​

_existed: boolean = false

Inherited from​

WorkspaceBuilderResource._existed


_id?​

optional _id: number

Inherited from​

WorkspaceBuilderResource._id


_uuid?​

optional _uuid: string

Inherited from​

WorkspaceBuilderResource._uuid


description​

readonly description: string = ''


eventRules​

readonly eventRules: WorkspaceBuilderEventRule[] = []


existingChildIds​

readonly existingChildIds: Set<number>

Child task ids the server already has, recorded when this task is adopted.


name​

readonly name: string


prompt​

readonly prompt: string = ''


start​

readonly start: boolean = false


transitions​

readonly transitions: TaskTransition[] = []


workflow​

readonly workflow: WorkflowBuilder

Accessors​

appliesWhenExisting​

Get Signature​

get appliesWhenExisting(): boolean

True when apply() is safe — and required — to run against a resource that was ADOPTED rather than created.

False by default because most builders create only: re-running their apply() on an existing resource would make a duplicate. Override it when apply() is an idempotent full write keyed on stable identities, which is the only way a re-run can express an EDIT (a removed goal, a reordered timeline) rather than just an addition.

Returns​

boolean

Inherited from​

WorkspaceBuilderResource.appliesWhenExisting


id​

Get Signature​

get id(): number

Server-assigned numeric id — available after apply() or adopt().

Returns​

number

Inherited from​

WorkspaceBuilderResource.id


isImplicit​

Get Signature​

get isImplicit(): boolean

True for resources the server creates on our behalf (currently a journey's Start step). They are kept in the resource list so edges can reference them, but they are never created, printed, or counted.

Returns​

boolean

Inherited from​

WorkspaceBuilderResource.isImplicit


uuid​

Get Signature​

get uuid(): string

Server-assigned uuid — available after apply() or adopt().

Returns​

string

Inherited from​

WorkspaceBuilderResource.uuid

Methods​

adopt()​

adopt(existing): void

Record the edges an adopted task already carries, so a re-run adds only what is missing.

Parameters​

existing​

AnyRecord

Returns​

void

Overrides​

WorkspaceBuilderResource.adopt


apply()​

apply(client): Promise<void>

Parameters​

client​

GravityRailWorkspaceClient

Returns​

Promise<void>

Overrides​

WorkspaceBuilderResource.apply


initialMessage()​

initialMessage(message, suggestions?): TaskBuilder

Parameters​

message​

string

suggestions?​

string[]

Returns​

TaskBuilder


matchKey()​

matchKey(): string | undefined

Returns​

string | undefined

Inherited from​

WorkspaceBuilderResource.matchKey


onEnter()​

onEnter(action, params?, name?): TaskBuilder

Parameters​

action​

string

params?​

AnyRecord = {}

name?​

string

Returns​

TaskBuilder


planLine()​

planLine(): string

Returns​

string

Overrides​

WorkspaceBuilderResource.planLine


transitionsTo()​

transitionsTo(child, when, autoNext?, required?, celCondition?): TaskBuilder

Parameters​

child​

TaskBuilder

when​

string

autoNext?​

boolean = false

required?​

boolean = false

celCondition?​

string

Returns​

TaskBuilder