Background Task List Abstractions (listTasks/abstractions.ts)

webiny-js · packages/background-tasks/src/admin/features/listTasks/abstractions.ts · typescript · MIT
automation, dev-tools, infra, lang:typescript, tag:abstraction-layer, tag:gateway-pattern, tag:webiny

Defines gateway and use case interfaces for paginated listing of background tasks with filtering and sorting in Webiny CMS.

// Source: https://github.com/webiny/webiny-js | License: MIT | Copyright Webiny Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { createAbstraction } from "@webiny/feature/admin";
import type { Task } from "~/admin/shared/types.js";

export interface IListTasksInput {
    where?: Record<string, unknown>;
    sort?: string[];
    limit?: number;
    after?: string;
    search?: string;
}

export interface IListTasksMeta {
    cursor: string | null;
    hasMoreItems: boolean;
    totalCount: number;
}

export interface IListTasksOutput {
    items: Task[];
    meta: IListTasksMeta;
}

export interface IListTasksGateway {
    execute(input: IListTasksInput): Promise<IListTasksOutput>;
}

export const ListTasksGateway = createAbstraction<IListTasksGateway>("ListTas

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key