@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
101 lines (100 loc) • 7.39 kB
TypeScript
type Mock = (...args: any[]) => any;
type MockParams<T extends Mock> = Parameters<T>;
type MockReturns<T extends Mock> = ReturnType<T>;
type OnlyRequired<T extends any[], U extends any[] = []> = Partial<T> extends T ? U : T extends [infer F, ...infer R] ? OnlyRequired<R, [...U, F]> : U;
type MockParamsRequired<T extends Mock> = OnlyRequired<MockParams<T>>;
type CreateArguments<T extends Record<string, Mock>, K extends keyof T> = MockParamsRequired<T[K]> extends never[] ? [key: K, args?: MockParams<T[K]>] : [key: K, args: MockParams<T[K]>];
type CreateManyArguments<T extends Record<string, Mock>, K extends keyof T> = MockParamsRequired<T[K]> extends never[] ? [key: K, count: number, args?: MockParams<T[K]>] : [key: K, count: number, args: MockParams<T[K]>];
export declare class Mocker<T extends Record<string, Mock>> {
private readonly mockerFunctions;
constructor(mockerFunctions: T);
create<K extends keyof T>(...[key, args]: CreateArguments<T, K>): MockReturns<T[K]>;
createMany<K extends keyof T>(...[key, count, args]: CreateManyArguments<T, K>): MockReturns<T[K]>[];
}
export declare const mocker: Mocker<{
adjective: MockFunction<string, []>;
any: MockFunction<any, []>;
artifact: MockFunction<import("..").Artifact, [(Partial<import("..").Artifact> | undefined)?]>;
blockDocument: MockFunction<import("..").BlockDocument, [(Partial<import("..").BlockDocument> | undefined)?]>;
blockDocumentData: MockFunction<Record<string, unknown>, [("url" | "email_addresses" | undefined)?]>;
blockSchema: MockFunction<import("..").BlockSchema, [(Partial<import("..").BlockSchema> | undefined)?]>;
blockSchemaCapabilities: MockFunction<string[], []>;
blockSchemaCapability: MockFunction<string, []>;
blockType: MockFunction<import("..").BlockType, [(Partial<import("..").BlockType> | undefined)?]>;
blockTypeSnippet: MockFunction<string, []>;
boolean: MockFunction<boolean, []>;
char: MockFunction<"e" | "h" | "d" | "w" | "m" | "y" | "s" | "a" | "b" | "i" | "p" | "q" | "u" | "g" | "o" | "c" | "f" | "j" | "k" | "l" | "n" | "r" | "t" | "v" | "x" | "z", []>;
collectionItem: MockFunction<import("..").CollectionItem, [(Partial<import("..").CollectionItem> | undefined)?]>;
concurrencyLimit: MockFunction<import("..").ConcurrencyLimit, [(Partial<import("..").ConcurrencyLimit> | undefined)?]>;
concurrencyV2Limit: MockFunction<import("..").ConcurrencyV2Limit, [(Partial<import("..").ConcurrencyV2Limit> | undefined)?]>;
createdOrUpdatedBy: MockFunction<import("..").CreatedOrUpdatedBy, [(Partial<import("..").CreatedOrUpdatedBy> | undefined)?]>;
date: MockFunction<Date, [(Date | undefined)?, (Date | undefined)?]>;
dateString: MockFunction<string, [(Date | undefined)?, (Date | undefined)?]>;
deployment: MockFunction<import("..").Deployment, [(Partial<import("..").Deployment> | undefined)?]>;
deploymentSchedules: MockFunction<import("..").DeploymentSchedule[], [(Partial<import("..").DeploymentSchedule> | undefined)?]>;
deploymentStatus: MockFunction<"ready" | "not_ready" | "disabled", []>;
deploymentVersion: MockFunction<import("..").DeploymentVersion, [(Partial<import("..").DeploymentVersion> | undefined)?]>;
email: MockFunction<string, []>;
flow: MockFunction<import("..").Flow, [(Partial<import("..").Flow> | undefined)?]>;
flowResponse: MockFunction<import("..").FlowResponse, [(Partial<import("..").FlowResponse> | undefined)?]>;
flowRun: MockFunction<import("..").FlowRun, [(Partial<import("..").FlowRun> | undefined)?]>;
flowRunGraph: MockFunction<import("..").GraphNode[], [(Partial<import("../mocks/flowRunGraph").GraphOptions> | undefined)?]>;
flowRunHistory: MockFunction<import("..").RunHistory, [(Partial<import("..").RunHistory> | undefined)?]>;
flowRunStateHistory: MockFunction<import("..").StateHistory, [(Partial<import("..").StateHistory> | undefined)?]>;
graphNode: MockFunction<import("..").GraphNode, [(Partial<import("..").GraphNode> | undefined)?]>;
id: MockFunction<string, []>;
image: MockFunction<string, [((number | {
width: number;
height: number;
}) | undefined)?]>;
log: MockFunction<import("..").Log, [(Partial<import("..").Log> | undefined)?]>;
logLevel: MockFunction<0 | 50 | 10 | 20 | 30 | 40, []>;
markdownCodeBlockString: MockFunction<string, [({
lines?: number;
} | undefined)?]>;
markdownCodeSpanString: MockFunction<string, []>;
markdownContentString: MockFunction<string, [({
lines?: number;
} | undefined)?]>;
markdownHeaderString: MockFunction<string, [({
level?: number;
} | undefined)?]>;
markdownQuoteString: MockFunction<string, [({
lines?: number;
} | undefined)?]>;
markdownString: MockFunction<string, [({
sections?: number;
} | undefined)?]>;
markdownTableString: MockFunction<string, [({
rows?: number;
columns?: number;
} | undefined)?]>;
notification: MockFunction<import("..").Notification, [(Partial<import("..").Notification> | undefined)?]>;
notificationCreate: MockFunction<import("..").NotificationCreate, [(Partial<import("..").NotificationCreate> | undefined)?]>;
noun: MockFunction<string, []>;
number: MockFunction<number, [(number | undefined)?, (number | undefined)?]>;
paragraph: MockFunction<string, [(number | undefined)?]>;
parameters: MockFunction<Record<string, unknown>, [(Record<string, unknown> | undefined)?, (import("..").Schema | undefined)?]>;
runName: MockFunction<string, []>;
schedule: MockFunction<import("..").Schedule, [({
type?: "interval" | "cron" | "rrule";
} | undefined)?, (Partial<import("..").Schedule> | undefined)?]>;
schema: MockFunction<import("..").Schema, [(import("..").Schema | undefined)?]>;
schemaProperties: MockFunction<import("..").SchemaProperties, [(import("..").SchemaProperties | undefined)?]>;
schemaProperty: MockFunction<import("..").SchemaProperty, [(import("..").SchemaProperty | undefined)?]>;
sentence: MockFunction<string, []>;
state: MockFunction<import("..").State, [(Partial<import("..").State> | undefined)?]>;
stateType: MockFunction<"completed" | "failed" | "running" | "pending" | "scheduled" | "cancelled" | "cancelling" | "crashed" | "paused", []>;
string: MockFunction<string, [(number | undefined)?]>;
table: MockFunction<import("@prefecthq/prefect-design").TableData[], [(Partial<import("../mocks/table").MockTableOverrides> | undefined)?]>;
taskRun: MockFunction<import("..").TaskRun, [(Partial<import("..").TaskRun> | undefined)?]>;
uiFlowRunHistory: MockFunction<import("..").UiFlowRunHistory, [(Partial<import("..").UiFlowRunHistory> | undefined)?]>;
url: MockFunction<string, [(boolean | undefined)?]>;
worker: MockFunction<import("..").WorkPoolWorker, [(Partial<import("..").WorkPoolWorker> | undefined)?]>;
workerStatus: MockFunction<"online" | "offline", []>;
workPool: MockFunction<import("..").WorkPool, [(Partial<import("..").WorkPool> | undefined)?]>;
workPoolQueue: MockFunction<import("..").WorkPoolQueue, [(Partial<import("..").WorkPoolQueue> | undefined)?]>;
workPoolStatus: MockFunction<"paused" | "ready" | "not_ready" | null, []>;
}>;
export type MockFunction<T, Args extends any[]> = (this: typeof mocker, ...args: Args) => T;
export {};