UNPKG

durable-execution-storage-convex

Version:

Convex storage implementation for durable-execution

160 lines 11.6 kB
import { type Infer } from 'convex/values'; import { type DurableExecutionErrorStorageValue, type TaskExecutionCloseStatus, type TaskExecutionOnChildrenFinishedProcessingStatus, type TaskExecutionStatus, type TaskExecutionStorageGetByIdFilters, type TaskExecutionStorageUpdate, type TaskExecutionStorageValue, type TaskExecutionSummary } from 'durable-execution'; import type { Doc } from './component/_generated/dataModel'; import { type TaskExecutionDBInsertValue } from './component/schema'; export type TaskExecutionDBValue = Doc<'taskExecutions'>; export declare const vTaskExecutionDBUpdateRequest: import("convex/values").VObject<{ executorId?: string | undefined; status?: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed" | undefined; isFinished?: boolean | undefined; runOutput?: string | undefined; output?: string | undefined; error?: { errorType: "generic" | "not_found" | "timed_out" | "cancelled"; message: string; isRetryable: boolean; isInternal: boolean; } | undefined; retryAttempts?: number | undefined; startAt?: number | undefined; startedAt?: number | undefined; expiresAt?: number | undefined; waitingForChildrenStartedAt?: number | undefined; waitingForFinalizeStartedAt?: number | undefined; finishedAt?: number | undefined; children?: { taskId: string; executionId: string; }[] | undefined; acc?: number | undefined; ocfpStatus?: "idle" | "processing" | "processed" | undefined; ocfpExpiresAt?: number | undefined; ocfpFinishedAt?: number | undefined; finalize?: { taskId: string; executionId: string; } | undefined; closeStatus?: "ready" | "idle" | "closing" | "closed" | undefined; closeExpiresAt?: number | undefined; closedAt?: number | undefined; npc?: boolean | undefined; unset?: { executorId?: boolean | undefined; runOutput?: boolean | undefined; error?: boolean | undefined; startedAt?: boolean | undefined; expiresAt?: boolean | undefined; ocfpExpiresAt?: boolean | undefined; closeExpiresAt?: boolean | undefined; } | undefined; updatedAt: number; }, { executorId: import("convex/values").VString<string | undefined, "optional">; status: import("convex/values").VUnion<"timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed" | undefined, [import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"timed_out", "required">, import("convex/values").VLiteral<"waiting_for_children", "required">, import("convex/values").VLiteral<"waiting_for_finalize", "required">, import("convex/values").VLiteral<"finalize_failed", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "optional", never>; isFinished: import("convex/values").VBoolean<boolean | undefined, "optional">; runOutput: import("convex/values").VString<string | undefined, "optional">; output: import("convex/values").VString<string | undefined, "optional">; error: import("convex/values").VObject<{ errorType: "generic" | "not_found" | "timed_out" | "cancelled"; message: string; isRetryable: boolean; isInternal: boolean; } | undefined, { errorType: import("convex/values").VUnion<"generic" | "not_found" | "timed_out" | "cancelled", [import("convex/values").VLiteral<"generic", "required">, import("convex/values").VLiteral<"not_found", "required">, import("convex/values").VLiteral<"timed_out", "required">, import("convex/values").VLiteral<"cancelled", "required">], "required", never>; message: import("convex/values").VString<string, "required">; isRetryable: import("convex/values").VBoolean<boolean, "required">; isInternal: import("convex/values").VBoolean<boolean, "required">; }, "optional", "errorType" | "message" | "isRetryable" | "isInternal">; retryAttempts: import("convex/values").VFloat64<number | undefined, "optional">; startAt: import("convex/values").VFloat64<number | undefined, "optional">; startedAt: import("convex/values").VFloat64<number | undefined, "optional">; expiresAt: import("convex/values").VFloat64<number | undefined, "optional">; waitingForChildrenStartedAt: import("convex/values").VFloat64<number | undefined, "optional">; waitingForFinalizeStartedAt: import("convex/values").VFloat64<number | undefined, "optional">; finishedAt: import("convex/values").VFloat64<number | undefined, "optional">; children: import("convex/values").VArray<{ taskId: string; executionId: string; }[] | undefined, import("convex/values").VObject<{ taskId: string; executionId: string; }, { taskId: import("convex/values").VString<string, "required">; executionId: import("convex/values").VString<string, "required">; }, "required", "taskId" | "executionId">, "optional">; acc: import("convex/values").VFloat64<number | undefined, "optional">; ocfpStatus: import("convex/values").VUnion<"idle" | "processing" | "processed" | undefined, [import("convex/values").VLiteral<"idle", "required">, import("convex/values").VLiteral<"processing", "required">, import("convex/values").VLiteral<"processed", "required">], "optional", never>; ocfpExpiresAt: import("convex/values").VFloat64<number | undefined, "optional">; ocfpFinishedAt: import("convex/values").VFloat64<number | undefined, "optional">; finalize: import("convex/values").VObject<{ taskId: string; executionId: string; } | undefined, { taskId: import("convex/values").VString<string, "required">; executionId: import("convex/values").VString<string, "required">; }, "optional", "taskId" | "executionId">; closeStatus: import("convex/values").VUnion<"ready" | "idle" | "closing" | "closed" | undefined, [import("convex/values").VLiteral<"idle", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"closing", "required">, import("convex/values").VLiteral<"closed", "required">], "optional", never>; closeExpiresAt: import("convex/values").VFloat64<number | undefined, "optional">; closedAt: import("convex/values").VFloat64<number | undefined, "optional">; npc: import("convex/values").VBoolean<boolean | undefined, "optional">; updatedAt: import("convex/values").VFloat64<number, "required">; unset: import("convex/values").VObject<{ executorId?: boolean | undefined; runOutput?: boolean | undefined; error?: boolean | undefined; startedAt?: boolean | undefined; expiresAt?: boolean | undefined; ocfpExpiresAt?: boolean | undefined; closeExpiresAt?: boolean | undefined; } | undefined, { executorId: import("convex/values").VBoolean<boolean | undefined, "optional">; runOutput: import("convex/values").VBoolean<boolean | undefined, "optional">; error: import("convex/values").VBoolean<boolean | undefined, "optional">; startedAt: import("convex/values").VBoolean<boolean | undefined, "optional">; expiresAt: import("convex/values").VBoolean<boolean | undefined, "optional">; ocfpExpiresAt: import("convex/values").VBoolean<boolean | undefined, "optional">; closeExpiresAt: import("convex/values").VBoolean<boolean | undefined, "optional">; }, "optional", "executorId" | "runOutput" | "error" | "startedAt" | "expiresAt" | "ocfpExpiresAt" | "closeExpiresAt">; }, "required", "executorId" | "status" | "isFinished" | "runOutput" | "output" | "error" | "retryAttempts" | "startAt" | "startedAt" | "expiresAt" | "waitingForChildrenStartedAt" | "waitingForFinalizeStartedAt" | "finishedAt" | "children" | "acc" | "ocfpStatus" | "ocfpExpiresAt" | "ocfpFinishedAt" | "finalize" | "closeStatus" | "closeExpiresAt" | "closedAt" | "npc" | "updatedAt" | "error.errorType" | "error.message" | "error.isRetryable" | "error.isInternal" | "finalize.taskId" | "finalize.executionId" | "unset" | "unset.executorId" | "unset.runOutput" | "unset.error" | "unset.startedAt" | "unset.expiresAt" | "unset.ocfpExpiresAt" | "unset.closeExpiresAt">; export type TaskExecutionDBUpdateRequest = Infer<typeof vTaskExecutionDBUpdateRequest>; export type TaskExecutionDBUpdate = { executorId?: string; status?: TaskExecutionStatus; isFinished?: boolean; runOutput?: string; output?: string; error?: DurableExecutionErrorStorageValue; retryAttempts?: number; startAt?: number; startedAt?: number; expiresAt?: number; waitingForChildrenStartedAt?: number; waitingForFinalizeStartedAt?: number; finishedAt?: number; children?: Array<TaskExecutionSummary>; acc?: number; ocfpStatus?: TaskExecutionOnChildrenFinishedProcessingStatus; ocfpExpiresAt?: number; ocfpFinishedAt?: number; finalize?: TaskExecutionSummary; closeStatus?: TaskExecutionCloseStatus; closeExpiresAt?: number; closedAt?: number; npc?: boolean; updatedAt: number; }; export declare function taskExecutionStorageValueToDBInsertValue(value: TaskExecutionStorageValue, shard: number): TaskExecutionDBInsertValue; export declare function taskExecutionDBValueToStorageValue(dbValue: TaskExecutionDBValue, update?: TaskExecutionStorageUpdate, updateExpiresAtWithStartedAt?: number): TaskExecutionStorageValue; export declare function taskExecutionStorageUpdateToDBUpdateRequest(update: TaskExecutionStorageUpdate): TaskExecutionDBUpdateRequest; export declare function taskExecutionStorageUpdateRequestToDBUpdate(update: Infer<typeof vTaskExecutionDBUpdateRequest>): TaskExecutionDBUpdate; export declare const vTaskExecutionStorageGetByIdFilters: import("convex/values").VObject<{ isSleepingTask?: boolean | undefined; status?: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed" | undefined; isFinished?: boolean | undefined; }, { isSleepingTask: import("convex/values").VBoolean<boolean | undefined, "optional">; status: import("convex/values").VUnion<"timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed" | undefined, [import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"timed_out", "required">, import("convex/values").VLiteral<"waiting_for_children", "required">, import("convex/values").VLiteral<"waiting_for_finalize", "required">, import("convex/values").VLiteral<"finalize_failed", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "optional", never>; isFinished: import("convex/values").VBoolean<boolean | undefined, "optional">; }, "required", "isSleepingTask" | "status" | "isFinished">; export declare function applyTaskExecutionIdFilters(execution: TaskExecutionDBInsertValue, filters?: TaskExecutionStorageGetByIdFilters | null): boolean; //# sourceMappingURL=common.d.ts.map