Task methods: escalate, next, return
The Task Verbs escalate, next, return as typed SDK methods, with inputs, result, refusals and an example.
Reference for Task, one group of Task methods.
Task.escalate
Escalate moves a Task to the Role its current Role escalates to, with the reason attached. Verb page.
interface TaskVerbs {
escalate(input: TaskEscalateInput, options?: SB.CallOptions): SB.Call<Task>
}Emits Task.escalated.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
task | Task | required | The Task to escalate. |
reason | text | required | Why the current Role cannot finish it. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
task | Task | required | The Task, assigned upward. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const task = await $.Task.escalate({ task: 'task_tVPKjporKn', reason: 'Example reason' })Task.next
Next returns the oldest open Task the calling Worker’s Roles may claim, without claiming it. Verb page.
interface TaskVerbs {
next(input?: TaskNextInput, options?: SB.CallOptions): SB.Call<Task>
}Emits Task.offered.
Inputs
None.
Returns
| Output | Type | Required | Description |
|---|---|---|---|
task | Task | The Task to claim next; empty when the queue is drained. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
import { $ } from 'startup-builder'
const task = await $.Task.next()Task.return
Return hands an offered Task back to its sender, unchanged, with the reason the receiver cannot take it. Verb page.
interface TaskVerbs {
return(input: TaskReturnInput, options?: SB.CallOptions): SB.Call<Task>
}Emits Task.returned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
task | Task | required | The Task to hand back. |
reason | text | required | What is missing, or why the Task is outside the receiver’s lane. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
task | Task | required | The Task, back with its sender. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
import { $ } from 'startup-builder'
const task = await $.Task.return({ task: 'task_tVPKjporKn', reason: 'Example reason' })