durable-execution-storage-convex
Version:
Convex storage implementation for durable-execution
813 lines • 32.5 kB
TypeScript
import { type ApiFromModules, type Expand, type FunctionReference } from 'convex/server';
import type { GenericId } from 'convex/values';
import { type TaskExecutionCloseStatus, type TaskExecutionOnChildrenFinishedProcessingStatus, type TaskExecutionsStorage, type TaskExecutionStatus, type TaskExecutionStorageGetByIdFilters, type TaskExecutionStorageUpdate, type TaskExecutionStorageValue } from 'durable-execution';
import { Schema } from 'effect';
import { type TaskExecutionDBUpdateRequest } from '../common';
import type { Mounts } from '../component/_generated/api';
import type { TaskExecutionDBInsertValue } from '../component/schema';
/**
* A type that represents the opaque IDs of a Convex document.
*
* @internal
*/
export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends Array<infer U> ? Array<OpaqueIds<U>> : T extends object ? {
[K in keyof T]: OpaqueIds<T[K]>;
} : T;
/**
* A type that represents the internal API of a component.
*
* @internal
*/
export type ComponentInternalApi<API> = Expand<{
[mod in keyof API]: API[mod] extends FunctionReference<infer FType, 'public', infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, 'internal', OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : ComponentInternalApi<API[mod]>;
}>;
/**
* The type of the task executions storage component.
*/
export type TaskExecutionsStorageComponent = ComponentInternalApi<Mounts>;
/**
* Converts a task executions storage component to a public api implementation.
*
* @example
* ```ts
* import { convertDurableExecutionStorageComponentToPublicApiImpl } from 'durable-execution-storage-convex'
*
* import { components } from './_generated/api'
*
* export const {
* insertMany,
* getManyById,
* getManyBySleepingTaskUniqueId,
* updateManyById,
* updateManyByIdAndInsertChildrenIfUpdated,
* updateByStatusAndStartAtLessThanAndReturn,
* updateByStatusAndOCFPStatusAndACCZeroAndReturn,
* updateByCloseStatusAndReturn,
* updateByStatusAndIsSleepingTaskAndExpiresAtLessThan,
* updateByOCFPExpiresAt,
* updateByCloseExpiresAt,
* updateByExecutorIdAndNPCAndReturn,
* getManyByParentExecutionId,
* updateManyByParentExecutionIdAndIsFinished,
* updateAndDecrementParentACCByIsFinishedAndCloseStatus,
* deleteById,
* deleteAll
* } = convertDurableExecutionStorageComponentToPublicApiImpl(
* components.taskExecutionsStorage,
* 'SUPER_SECRET',
* )
* ```
*
* @param component - The task executions storage component.
* @param authSecret - The auth secret to use for the public API.
* @returns The public API implementation.
*/
export declare function convertDurableExecutionStorageComponentToPublicApiImpl(component: TaskExecutionsStorageComponent, authSecret: string): {
insertMany: import("convex/server").RegisteredMutation<"public", {
authSecret: string;
args: {
executions: ReadonlyArray<TaskExecutionDBInsertValue>;
};
}, Promise<void>>;
getManyById: import("convex/server").RegisteredQuery<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
}>;
};
}, Promise<({
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
} | null)[]>>;
getManyBySleepingTaskUniqueId: import("convex/server").RegisteredQuery<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
sleepingTaskUniqueId: string;
}>;
};
}, Promise<({
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
} | null)[]>>;
updateManyById: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
update: TaskExecutionDBUpdateRequest;
}>;
};
}, Promise<void>>;
updateManyByIdAndInsertChildrenIfUpdated: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
update: TaskExecutionDBUpdateRequest;
childrenTaskExecutionsToInsertIfAnyUpdated: Array<TaskExecutionDBInsertValue>;
}>;
};
}, Promise<void>>;
updateByStatusAndStartAtLessThanAndReturn: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
shard: number;
status: TaskExecutionStatus;
startAtLessThan: number;
update: TaskExecutionDBUpdateRequest;
updateExpiresAtWithStartedAt: number;
limit: number;
};
}, Promise<{
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
}[]>>;
updateByStatusAndOCFPStatusAndACCZeroAndReturn: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
shard: number;
status: TaskExecutionStatus;
ocfpStatus: TaskExecutionOnChildrenFinishedProcessingStatus;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<{
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
}[]>>;
updateByCloseStatusAndReturn: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
shard: number;
closeStatus: TaskExecutionCloseStatus;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<{
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
}[]>>;
updateByStatusAndIsSleepingTaskAndExpiresAtLessThan: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
status: TaskExecutionStatus;
isSleepingTask: boolean;
expiresAtLessThan: number;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<number>>;
updateByOCFPExpiresAt: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
ocfpExpiresAtLessThan: number;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<number>>;
updateByCloseExpiresAt: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
closeExpiresAtLessThan: number;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<number>>;
updateByExecutorIdAndNPCAndReturn: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
shard: number;
executorId: string;
npc: boolean;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<{
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
}[]>>;
getManyByParentExecutionId: import("convex/server").RegisteredQuery<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
parentExecutionId: string;
}>;
};
}, Promise<{
_id: GenericId<"taskExecutions">;
_creationTime: number;
rootTaskId?: string | undefined;
rootExecutionId?: string | undefined;
parentTaskId?: string | undefined;
parentExecutionId?: string | undefined;
parentExecutionDocId?: GenericId<"taskExecutions"> | undefined;
indexInParentChildren?: number | undefined;
isOnlyChildOfParent?: boolean | undefined;
isFinalizeOfParent?: boolean | undefined;
sleepingTaskUniqueId?: string | undefined;
executorId?: string | undefined;
runOutput?: string | undefined;
output?: string | undefined;
error?: {
errorType: "generic" | "not_found" | "timed_out" | "cancelled";
message: string;
isRetryable: boolean;
isInternal: boolean;
} | undefined;
startedAt?: number | undefined;
expiresAt?: number | undefined;
waitingForChildrenStartedAt?: number | undefined;
waitingForFinalizeStartedAt?: number | undefined;
finishedAt?: number | undefined;
children?: {
taskId: string;
executionId: string;
}[] | undefined;
ocfpExpiresAt?: number | undefined;
ocfpFinishedAt?: number | undefined;
finalize?: {
taskId: string;
executionId: string;
} | undefined;
closeExpiresAt?: number | undefined;
closedAt?: number | undefined;
shard: number;
taskId: string;
executionId: string;
isSleepingTask: boolean;
retryOptions: {
baseDelayMs?: number | undefined;
maxDelayMs?: number | undefined;
delayMultiplier?: number | undefined;
maxAttempts: number;
};
sleepMsBeforeRun: number;
timeoutMs: number;
areChildrenSequential: boolean;
input: string;
status: "timed_out" | "cancelled" | "ready" | "running" | "failed" | "waiting_for_children" | "waiting_for_finalize" | "finalize_failed" | "completed";
isFinished: boolean;
retryAttempts: number;
startAt: number;
acc: number;
ocfpStatus: "idle" | "processing" | "processed";
closeStatus: "ready" | "idle" | "closing" | "closed";
npc: boolean;
createdAt: number;
updatedAt: number;
}[][]>>;
updateManyByParentExecutionIdAndIsFinished: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
requests: ReadonlyArray<{
parentExecutionId: string;
isFinished: boolean;
update: TaskExecutionDBUpdateRequest;
}>;
};
}, Promise<void>>;
updateAndDecrementParentACCByIsFinishedAndCloseStatus: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: {
shard: number;
isFinished: boolean;
closeStatus: TaskExecutionCloseStatus;
update: TaskExecutionDBUpdateRequest;
limit: number;
};
}, Promise<number>>;
deleteById: import("convex/server").RegisteredMutation<"public", {
authSecret: string;
args: {
executionId: string;
};
}, Promise<void>>;
deleteAll: import("convex/server").RegisteredAction<"public", {
authSecret: string;
args: undefined;
}, Promise<void>>;
};
export type DurableExecutionStoragePublicApiImpl = ReturnType<typeof convertDurableExecutionStorageComponentToPublicApiImpl>;
export type DurableExecutionStoragePublicApi = ApiFromModules<{
lib: DurableExecutionStoragePublicApiImpl;
}>['lib'];
/**
* A type that can be used to interact with a Convex database.
*
* It can be a ConvexClient or ConvexHttpClient client or any object that implements the required
* methods.
*/
export type AnyConvexClient = {
/**
* Fetch a query result once.
*
* @param query - A `FunctionReference` for the public query to run.
* @param args - An arguments object for the query.
* @returns A promise of the query's result.
*/
query: <Query extends FunctionReference<'query'>>(query: Query, args: Query['_args']) => Promise<Awaited<Query['_returnType']>>;
/**
* Run a mutation.
*
* @param mutation - A `FunctionReference` for the public mutation to run.
* @param args - An arguments object for the mutation.
* @returns A promise of the mutation's result.
*/
mutation: <Mutation extends FunctionReference<'mutation'>>(mutation: Mutation, args: Mutation['_args']) => Promise<Awaited<Mutation['_returnType']>>;
/**
* Run an action.
*
* @param action - A `FunctionReference` for the public action to run.
* @param args - An arguments object for the action.
* @returns A promise of the action's result.
*/
action: <Action extends FunctionReference<'action'>>(action: Action, args: Action['_args']) => Promise<Awaited<Action['_returnType']>>;
};
/**
* A type that can be used to batch requests to a Convex database.
*/
export type BatchRequest<T, R> = {
data: T;
resolve: (value: R) => void;
reject: (reason?: unknown) => void;
};
/**
* Schema for the options for the Convex task executions storage.
*/
export declare const ConvexTaskExecutionsStorageOptionsSchema: Schema.transform<Schema.filter<Schema.Struct<{
totalShards: Schema.PropertySignature<":", number, never, "?:", number | null | undefined, false, never>;
shards: Schema.optionalWith<Schema.Array$<Schema.filter<typeof Schema.Int>>, {
nullable: true;
}>;
enableTestMode: Schema.PropertySignature<":", boolean, never, "?:", boolean | null | undefined, false, never>;
}>>, Schema.Struct<{
totalShards: typeof Schema.Int;
shards: Schema.Array$<typeof Schema.Int>;
enableTestMode: typeof Schema.Boolean;
}>>;
/**
* A task executions storage implementation that uses a Convex database.
*/
export declare class ConvexTaskExecutionsStorage implements TaskExecutionsStorage {
private readonly convexClient;
private readonly authSecret;
private readonly publicApi;
private readonly totalShards;
private readonly shards;
private readonly enableTestMode;
/**
* Creates a new task executions storage instance.
*
* @param convexClient - A Convex client that can be used to interact with the database.
* @param authSecret - The auth secret to use for the public API.
* @param publicApi - The public API to use. See
* {@link convertDurableExecutionStorageComponentToPublicApiImpl} for more details.
* @param options - An options object.
* @param options.totalShards - The total number of shards to use.
* @param options.shards - The shards to use. If not provided, all shards will be used.
* @param options.enableTestMode - Whether to enable test mode.
*/
constructor(convexClient: AnyConvexClient, authSecret: string, publicApi: DurableExecutionStoragePublicApi, options?: {
totalShards?: number;
shards?: Array<number>;
enableTestMode?: boolean;
});
insertMany(executions: ReadonlyArray<TaskExecutionStorageValue>): Promise<void>;
getManyById(requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
}>): Promise<Array<TaskExecutionStorageValue | undefined>>;
getManyBySleepingTaskUniqueId(requests: ReadonlyArray<{
sleepingTaskUniqueId: string;
}>): Promise<Array<TaskExecutionStorageValue | undefined>>;
updateManyById(requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
update: TaskExecutionStorageUpdate;
}>): Promise<void>;
updateManyByIdAndInsertChildrenIfUpdated(requests: ReadonlyArray<{
executionId: string;
filters?: TaskExecutionStorageGetByIdFilters;
update: TaskExecutionStorageUpdate;
childrenTaskExecutionsToInsertIfAnyUpdated: ReadonlyArray<TaskExecutionStorageValue>;
}>): Promise<void>;
updateByStatusAndStartAtLessThanAndReturn({ status, startAtLessThan, update, updateExpiresAtWithStartedAt, limit, }: {
status: TaskExecutionStatus;
startAtLessThan: number;
update: TaskExecutionStorageUpdate;
updateExpiresAtWithStartedAt: number;
limit: number;
}): Promise<Array<TaskExecutionStorageValue>>;
updateByStatusAndOnChildrenFinishedProcessingStatusAndActiveChildrenCountZeroAndReturn({ status, onChildrenFinishedProcessingStatus, update, limit, }: {
status: TaskExecutionStatus;
onChildrenFinishedProcessingStatus: TaskExecutionOnChildrenFinishedProcessingStatus;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<Array<TaskExecutionStorageValue>>;
updateByCloseStatusAndReturn({ closeStatus, update, limit, }: {
closeStatus: TaskExecutionCloseStatus;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<Array<TaskExecutionStorageValue>>;
updateByStatusAndIsSleepingTaskAndExpiresAtLessThan({ status, isSleepingTask, expiresAtLessThan, update, limit, }: {
status: TaskExecutionStatus;
isSleepingTask: boolean;
expiresAtLessThan: number;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<number>;
updateByOnChildrenFinishedProcessingExpiresAtLessThan({ onChildrenFinishedProcessingExpiresAtLessThan, update, limit, }: {
onChildrenFinishedProcessingExpiresAtLessThan: number;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<number>;
updateByCloseExpiresAtLessThan({ closeExpiresAtLessThan, update, limit, }: {
closeExpiresAtLessThan: number;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<number>;
updateByExecutorIdAndNeedsPromiseCancellationAndReturn({ executorId, needsPromiseCancellation, update, limit, }: {
executorId: string;
needsPromiseCancellation: boolean;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<Array<TaskExecutionStorageValue>>;
getManyByParentExecutionId(requests: ReadonlyArray<{
parentExecutionId: string;
}>): Promise<Array<Array<TaskExecutionStorageValue>>>;
updateManyByParentExecutionIdAndIsFinished(requests: ReadonlyArray<{
parentExecutionId: string;
isFinished: boolean;
update: TaskExecutionStorageUpdate;
}>): Promise<void>;
updateAndDecrementParentActiveChildrenCountByIsFinishedAndCloseStatus({ isFinished, closeStatus, update, limit, }: {
isFinished: boolean;
closeStatus: TaskExecutionCloseStatus;
update: TaskExecutionStorageUpdate;
limit: number;
}): Promise<number>;
deleteById({ executionId }: {
executionId: string;
}): Promise<void>;
deleteAll(): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map