Class Supaworker<Payload>
Constructors
constructor
- new Supaworker<Payload>(
client: SupabaseClient<
Database,
"supaworker",
{
CompositeTypes: {};
Enums: {};
Functions: {
dequeue: {
Args: { queue_name: string };
Returns: {
attempts: number;
created_at: string;
enabled: boolean;
id: number;
options: Json;
payload: Json;
queue: string;
}[];
};
};
Tables: {
jobs: {
Insert: {
attempts?: number;
created_at?: string;
enabled?: boolean;
id?: number;
options?: Json;
payload?: Json;
queue: string;
};
Relationships: [];
Row: {
attempts: number;
created_at: string;
enabled: boolean;
id: number;
options: Json;
payload: Json;
queue: string;
};
Update: {
attempts?: number;
created_at?: string;
enabled?: boolean;
id?: number;
options?: Json;
payload?: Json;
queue?: string;
};
};
logs: {
Insert: {
created_at?: string;
id?: string;
job: Json;
status: string;
};
Relationships: [];
Row: { created_at: string; id: string; job: Json; status: string };
Update: {
created_at?: string;
id?: string;
job?: Json;
status?: string;
};
};
};
Views: {};
},
>,
enqueue: EnqueueFunction<Payload>,
work: SupaworkerHandler<Payload>,
options: SupaworkerOptions,
): Supaworker<Payload> Parameters
- client: SupabaseClient<
Database,
"supaworker",
{
CompositeTypes: {};
Enums: {};
Functions: {
dequeue: {
Args: { queue_name: string };
Returns: {
attempts: number;
created_at: string;
enabled: boolean;
id: number;
options: Json;
payload: Json;
queue: string;
}[];
};
};
Tables: {
jobs: {
Insert: {
attempts?: number;
created_at?: string;
enabled?: boolean;
id?: number;
options?: Json;
payload?: Json;
queue: string;
};
Relationships: [];
Row: {
attempts: number;
created_at: string;
enabled: boolean;
id: number;
options: Json;
payload: Json;
queue: string;
};
Update: {
attempts?: number;
created_at?: string;
enabled?: boolean;
id?: number;
options?: Json;
payload?: Json;
queue?: string;
};
};
logs: {
Insert: {
created_at?: string;
id?: string;
job: Json;
status: string;
};
Relationships: [];
Row: { created_at: string; id: string; job: Json; status: string };
Update: {
created_at?: string;
id?: string;
job?: Json;
status?: string;
};
};
};
Views: {};
},
> - enqueue: EnqueueFunction<Payload>
- work: SupaworkerHandler<Payload>
- options: SupaworkerOptions
Methods
start
- start(): Promise<void>
Returns Promise<void>
stop
- stop(): Promise<void>
Returns Promise<void>
A worker that processes jobs from a queue. Use
createSupaworker
to create a new worker.