Skip to main content

Class: SupabaseTicketStore

Defined in: packages/orchestration/src/ticket/ticket-store.ts:4

Where tickets live. Every implementation passes the shared contract suite (ticketStoreContract from @baleybots/orchestration/testing).

Implements​

Constructors​

Constructor​

new SupabaseTicketStore(supabase, userId): SupabaseTicketStore

Defined in: packages/orchestration/src/ticket/ticket-store.ts:5

Parameters​

supabase​

SupabaseClient

userId​

string

Returns​

SupabaseTicketStore

Methods​

claim()​

claim(id, expected, changes): Promise<Ticket | null>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:23

Apply changes only while the ticket is still in expected (its status and active run), atomically, and return the updated ticket, or null when it moved. Every run starts and settles through it, so two instances that both saw a ticket queued cannot both run it.

Parameters​

id​

string

expected​

Pick<Ticket, "status" | "activeRunId">

changes​

Partial<Ticket>

Returns​

Promise<Ticket | null>

Implementation of​

TicketStore.claim


compareAndSwapQuestions()​

compareAndSwapQuestions(id, expected, questions, changes?, expectedState?): Promise<Ticket | null>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:10

Compare the persisted questions with expected (and, when given, the ticket's status and active run with expectedState) and, in one atomic write, replace them with questions plus changes. Null on a mismatch.

Parameters​

id​

string

expected​

HumanQuestion[]

questions​

HumanQuestion[]

changes?​

Partial<Ticket> = {}

expectedState?​

Pick<Ticket, "status" | "activeRunId">

Returns​

Promise<Ticket | null>

Implementation of​

TicketStore.compareAndSwapQuestions


create()​

create(config): Promise<Ticket>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:32

Parameters​

config​

TicketConfig

Returns​

Promise<Ticket>

Implementation of​

TicketStore.create


delete()​

delete(id): Promise<void>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:109

Parameters​

id​

string

Returns​

Promise<void>

Implementation of​

TicketStore.delete


get()​

get(id): Promise<Ticket | null>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:63

Parameters​

id​

string

Returns​

Promise<Ticket | null>

Implementation of​

TicketStore.get


list()​

list(filter?): Promise<Ticket[]>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:90

Parameters​

filter?​
assignee?​

string

status?​

("needs_input" | "backlog" | "queued" | "in_progress" | "review" | "done" | "failed" | "cancelled")[]

tags?​

string[]

Returns​

Promise<Ticket[]>

Implementation of​

TicketStore.list


update()​

update(id, changes): Promise<Ticket>

Defined in: packages/orchestration/src/ticket/ticket-store.ts:75

Parameters​

id​

string

changes​

Partial<Ticket>

Returns​

Promise<Ticket>

Implementation of​

TicketStore.update