convex-effect-workflows 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +107 -0
  2. package/dist/client/ConvexCtx.d.ts +12 -0
  3. package/dist/client/ConvexCtx.d.ts.map +1 -0
  4. package/dist/client/ConvexCtx.js +6 -0
  5. package/dist/client/ConvexCtx.js.map +1 -0
  6. package/dist/client/ConvexLogger.d.ts +7 -0
  7. package/dist/client/ConvexLogger.d.ts.map +1 -0
  8. package/dist/client/ConvexLogger.js +39 -0
  9. package/dist/client/ConvexLogger.js.map +1 -0
  10. package/dist/client/ConvexTracer.d.ts +7 -0
  11. package/dist/client/ConvexTracer.d.ts.map +1 -0
  12. package/dist/client/ConvexTracer.js +60 -0
  13. package/dist/client/ConvexTracer.js.map +1 -0
  14. package/dist/client/ConvexWorkflowEngine.d.ts +308 -0
  15. package/dist/client/ConvexWorkflowEngine.d.ts.map +1 -0
  16. package/dist/client/ConvexWorkflowEngine.js +88 -0
  17. package/dist/client/ConvexWorkflowEngine.js.map +1 -0
  18. package/dist/client/activityWorker.d.ts +23 -0
  19. package/dist/client/activityWorker.d.ts.map +1 -0
  20. package/dist/client/activityWorker.js +41 -0
  21. package/dist/client/activityWorker.js.map +1 -0
  22. package/dist/client/boundaries.d.ts +27 -0
  23. package/dist/client/boundaries.d.ts.map +1 -0
  24. package/dist/client/boundaries.js +17 -0
  25. package/dist/client/boundaries.js.map +1 -0
  26. package/dist/client/encoded.d.ts +22 -0
  27. package/dist/client/encoded.d.ts.map +1 -0
  28. package/dist/client/encoded.js +276 -0
  29. package/dist/client/encoded.js.map +1 -0
  30. package/dist/client/index.d.ts +13 -0
  31. package/dist/client/index.d.ts.map +1 -0
  32. package/dist/client/index.js +11 -0
  33. package/dist/client/index.js.map +1 -0
  34. package/dist/client/registry.d.ts +17 -0
  35. package/dist/client/registry.d.ts.map +1 -0
  36. package/dist/client/registry.js +21 -0
  37. package/dist/client/registry.js.map +1 -0
  38. package/dist/client/runner.d.ts +27 -0
  39. package/dist/client/runner.d.ts.map +1 -0
  40. package/dist/client/runner.js +90 -0
  41. package/dist/client/runner.js.map +1 -0
  42. package/dist/client/runtime.d.ts +10 -0
  43. package/dist/client/runtime.d.ts.map +1 -0
  44. package/dist/client/runtime.js +15 -0
  45. package/dist/client/runtime.js.map +1 -0
  46. package/dist/component/_generated/api.d.ts +148 -0
  47. package/dist/component/_generated/api.d.ts.map +1 -0
  48. package/dist/component/_generated/api.js +31 -0
  49. package/dist/component/_generated/api.js.map +1 -0
  50. package/dist/component/_generated/component.d.ts +921 -0
  51. package/dist/component/_generated/component.d.ts.map +1 -0
  52. package/dist/component/_generated/component.js +11 -0
  53. package/dist/component/_generated/component.js.map +1 -0
  54. package/dist/component/_generated/dataModel.d.ts +46 -0
  55. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  56. package/dist/component/_generated/dataModel.js +11 -0
  57. package/dist/component/_generated/dataModel.js.map +1 -0
  58. package/dist/component/_generated/server.d.ts +121 -0
  59. package/dist/component/_generated/server.d.ts.map +1 -0
  60. package/dist/component/_generated/server.js +78 -0
  61. package/dist/component/_generated/server.js.map +1 -0
  62. package/dist/component/activityCompletions.d.ts +27 -0
  63. package/dist/component/activityCompletions.d.ts.map +1 -0
  64. package/dist/component/activityCompletions.js +70 -0
  65. package/dist/component/activityCompletions.js.map +1 -0
  66. package/dist/component/boundaries.d.ts +20 -0
  67. package/dist/component/boundaries.d.ts.map +1 -0
  68. package/dist/component/boundaries.js +17 -0
  69. package/dist/component/boundaries.js.map +1 -0
  70. package/dist/component/cleanup.d.ts +11 -0
  71. package/dist/component/cleanup.d.ts.map +1 -0
  72. package/dist/component/cleanup.js +163 -0
  73. package/dist/component/cleanup.js.map +1 -0
  74. package/dist/component/clocks.d.ts +12 -0
  75. package/dist/component/clocks.d.ts.map +1 -0
  76. package/dist/component/clocks.js +26 -0
  77. package/dist/component/clocks.js.map +1 -0
  78. package/dist/component/config.d.ts +25 -0
  79. package/dist/component/config.d.ts.map +1 -0
  80. package/dist/component/config.js +110 -0
  81. package/dist/component/config.js.map +1 -0
  82. package/dist/component/convex.config.d.ts +3 -0
  83. package/dist/component/convex.config.d.ts.map +1 -0
  84. package/dist/component/convex.config.js +6 -0
  85. package/dist/component/convex.config.js.map +1 -0
  86. package/dist/component/dashboard.d.ts +268 -0
  87. package/dist/component/dashboard.d.ts.map +1 -0
  88. package/dist/component/dashboard.js +622 -0
  89. package/dist/component/dashboard.js.map +1 -0
  90. package/dist/component/deferreds.d.ts +31 -0
  91. package/dist/component/deferreds.d.ts.map +1 -0
  92. package/dist/component/deferreds.js +138 -0
  93. package/dist/component/deferreds.js.map +1 -0
  94. package/dist/component/executions.d.ts +77 -0
  95. package/dist/component/executions.d.ts.map +1 -0
  96. package/dist/component/executions.js +186 -0
  97. package/dist/component/executions.js.map +1 -0
  98. package/dist/component/journalSteps.d.ts +261 -0
  99. package/dist/component/journalSteps.d.ts.map +1 -0
  100. package/dist/component/journalSteps.js +203 -0
  101. package/dist/component/journalSteps.js.map +1 -0
  102. package/dist/component/logs.d.ts +68 -0
  103. package/dist/component/logs.d.ts.map +1 -0
  104. package/dist/component/logs.js +123 -0
  105. package/dist/component/logs.js.map +1 -0
  106. package/dist/component/onComplete.d.ts +31 -0
  107. package/dist/component/onComplete.d.ts.map +1 -0
  108. package/dist/component/onComplete.js +146 -0
  109. package/dist/component/onComplete.js.map +1 -0
  110. package/dist/component/payloads.d.ts +26 -0
  111. package/dist/component/payloads.d.ts.map +1 -0
  112. package/dist/component/payloads.js +57 -0
  113. package/dist/component/payloads.js.map +1 -0
  114. package/dist/component/queries.d.ts +2 -0
  115. package/dist/component/queries.d.ts.map +1 -0
  116. package/dist/component/queries.js +2 -0
  117. package/dist/component/queries.js.map +1 -0
  118. package/dist/component/runner.d.ts +31 -0
  119. package/dist/component/runner.d.ts.map +1 -0
  120. package/dist/component/runner.js +87 -0
  121. package/dist/component/runner.js.map +1 -0
  122. package/dist/component/schema.d.ts +282 -0
  123. package/dist/component/schema.d.ts.map +1 -0
  124. package/dist/component/schema.js +119 -0
  125. package/dist/component/schema.js.map +1 -0
  126. package/dist/component/spans.d.ts +105 -0
  127. package/dist/component/spans.d.ts.map +1 -0
  128. package/dist/component/spans.js +190 -0
  129. package/dist/component/spans.js.map +1 -0
  130. package/dist/component/utils.d.ts +15 -0
  131. package/dist/component/utils.d.ts.map +1 -0
  132. package/dist/component/utils.js +53 -0
  133. package/dist/component/utils.js.map +1 -0
  134. package/dist/shared/constants.d.ts +12 -0
  135. package/dist/shared/constants.d.ts.map +1 -0
  136. package/dist/shared/constants.js +12 -0
  137. package/dist/shared/constants.js.map +1 -0
  138. package/dist/shared/validators.d.ts +69 -0
  139. package/dist/shared/validators.d.ts.map +1 -0
  140. package/dist/shared/validators.js +30 -0
  141. package/dist/shared/validators.js.map +1 -0
  142. package/package.json +74 -0
  143. package/src/client/ConvexCtx.ts +21 -0
  144. package/src/client/ConvexLogger.ts +52 -0
  145. package/src/client/ConvexTracer.ts +75 -0
  146. package/src/client/ConvexWorkflowEngine.test.ts +124 -0
  147. package/src/client/ConvexWorkflowEngine.ts +209 -0
  148. package/src/client/activityWorker.ts +62 -0
  149. package/src/client/boundaries.test.ts +83 -0
  150. package/src/client/boundaries.ts +79 -0
  151. package/src/client/encoded.lifecycle.test.ts +336 -0
  152. package/src/client/encoded.test.ts +153 -0
  153. package/src/client/encoded.ts +484 -0
  154. package/src/client/index.ts +47 -0
  155. package/src/client/registry.ts +35 -0
  156. package/src/client/runner.ts +165 -0
  157. package/src/client/runtime.ts +30 -0
  158. package/src/component/_generated/api.ts +179 -0
  159. package/src/component/_generated/component.ts +1216 -0
  160. package/src/component/_generated/dataModel.ts +60 -0
  161. package/src/component/_generated/server.ts +156 -0
  162. package/src/component/activityCompletions.ts +73 -0
  163. package/src/component/boundaries.ts +55 -0
  164. package/src/component/cleanup.test.ts +219 -0
  165. package/src/component/cleanup.ts +218 -0
  166. package/src/component/clocks.ts +26 -0
  167. package/src/component/config.test.ts +159 -0
  168. package/src/component/config.ts +145 -0
  169. package/src/component/convex.config.ts +7 -0
  170. package/src/component/core.test.ts +829 -0
  171. package/src/component/dashboard.scaling.test.ts +268 -0
  172. package/src/component/dashboard.ts +743 -0
  173. package/src/component/deferreds.ts +162 -0
  174. package/src/component/executions.ts +225 -0
  175. package/src/component/journalSteps.ts +252 -0
  176. package/src/component/logs.ts +152 -0
  177. package/src/component/onComplete.ts +170 -0
  178. package/src/component/payloads.ts +83 -0
  179. package/src/component/queries.ts +8 -0
  180. package/src/component/runner.ts +122 -0
  181. package/src/component/schema.ts +155 -0
  182. package/src/component/setup.test.ts +15 -0
  183. package/src/component/spans.ts +241 -0
  184. package/src/component/utils.test.ts +32 -0
  185. package/src/component/utils.ts +73 -0
  186. package/src/shared/constants.test.ts +14 -0
  187. package/src/shared/constants.ts +15 -0
  188. package/src/shared/validators.ts +98 -0
  189. package/src/test.d.ts +8 -0
  190. package/src/test.ts +17 -0
@@ -0,0 +1,165 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Exit from "effect/Exit";
3
+ import * as Workflow from "@effect/workflow/Workflow";
4
+ import {
5
+ makeUnsafe as makeUnsafeWorkflowEngine,
6
+ WorkflowEngine,
7
+ type WorkflowInstance,
8
+ } from "@effect/workflow/WorkflowEngine";
9
+ import {
10
+ createFunctionHandle,
11
+ internalMutationGeneric,
12
+ makeFunctionReference,
13
+ type FunctionReference,
14
+ } from "convex/server";
15
+ import { v } from "convex/values";
16
+ import type { WorkpoolOptions } from "@convex-dev/workpool";
17
+ import type { ComponentApi } from "../component/_generated/component.js";
18
+ import { provideConvexCtx } from "./runtime.js";
19
+ import type { ConvexWorkflowCtx } from "./ConvexCtx.js";
20
+ import {
21
+ makeConvexEncoded,
22
+ type ActivityEnqueueArgs,
23
+ type RunnerEnqueueArgs,
24
+ } from "./encoded.js";
25
+ import { registerWorkflow } from "./registry.js";
26
+ import type { RunnerArgs, RunnerHandle } from "./ConvexWorkflowEngine.js";
27
+ import {
28
+ enqueueActivity,
29
+ scheduleRunnerFanIn,
30
+ } from "./boundaries.js";
31
+
32
+ export type RunnerMutationArgs = RunnerArgs;
33
+
34
+ type MutationReference =
35
+ | FunctionReference<"mutation", "public">
36
+ | FunctionReference<"mutation", "internal">;
37
+
38
+ type ActionReference =
39
+ | FunctionReference<"action", "public">
40
+ | FunctionReference<"action", "internal">;
41
+
42
+ export type RunnerReference = MutationReference | string;
43
+
44
+ function asMutationReference(reference: unknown): MutationReference {
45
+ return reference as MutationReference;
46
+ }
47
+
48
+ function asRunnerMutationReference(reference: RunnerReference): MutationReference {
49
+ if (typeof reference === "string") {
50
+ return makeFunctionReference<"mutation", RunnerMutationArgs, void>(reference);
51
+ }
52
+ return reference;
53
+ }
54
+
55
+ export type ActivityWorkerTarget = ActionReference | string;
56
+
57
+ async function activityWorkerHandle(
58
+ reference: ActivityWorkerTarget,
59
+ ): Promise<string> {
60
+ if (typeof reference === "string") {
61
+ const fnRef = makeFunctionReference<"action">(reference);
62
+ return await createFunctionHandle(fnRef);
63
+ }
64
+ return await createFunctionHandle(reference);
65
+ }
66
+
67
+ export type RunnerOptions = {
68
+ // Prefer a module path string like "orderWorkflow:activityWorker".
69
+ // Registered function objects from internalActionGeneric are not valid
70
+ // FunctionReferences for createFunctionHandle at runtime.
71
+ activityWorker: ActivityWorkerTarget;
72
+ workpoolOptions?: WorkpoolOptions;
73
+ };
74
+
75
+ /**
76
+ * Define a workflow runner mutation for one workflow.
77
+ *
78
+ * The runner executes one deterministic tick by calling the encoded engine
79
+ * directly (not `WorkflowEngine.execute`), avoiding in-mutation suspended loops.
80
+ * Suspension/resume is handled via component.onComplete.
81
+ */
82
+ export function defineWorkflowRunner(
83
+ component: ComponentApi,
84
+ workflow: Workflow.Any,
85
+ execute: (
86
+ payload: object,
87
+ executionId: string,
88
+ ) => Effect.Effect<unknown, unknown, WorkflowInstance | WorkflowEngine>,
89
+ options: RunnerOptions,
90
+ ) {
91
+ registerWorkflow(workflow, execute);
92
+
93
+ return internalMutationGeneric({
94
+ args: {
95
+ executionId: v.string(),
96
+ generation: v.number(),
97
+ },
98
+ handler: async (ctx, args: RunnerMutationArgs) => {
99
+ const workerHandle = await activityWorkerHandle(options.activityWorker);
100
+
101
+ const hooks = {
102
+ enqueueRunner: async (
103
+ convexCtx: ConvexWorkflowCtx,
104
+ hookArgs: RunnerEnqueueArgs,
105
+ ) => {
106
+ await scheduleRunnerFanIn(convexCtx.scheduler, component, {
107
+ executionId: hookArgs.executionId,
108
+ generation: hookArgs.generation,
109
+ });
110
+ },
111
+ enqueueActivity: async (
112
+ convexCtx: ConvexWorkflowCtx,
113
+ hookArgs: ActivityEnqueueArgs,
114
+ ) => {
115
+ return await enqueueActivity(convexCtx.runMutation, component, {
116
+ executionId: hookArgs.executionId,
117
+ generation: hookArgs.generation,
118
+ workflowName: workflow.name,
119
+ activityName: hookArgs.activity.name,
120
+ attempt: hookArgs.attempt,
121
+ stepNumber: hookArgs.stepNumber,
122
+ spanId: hookArgs.spanId,
123
+ activityWorkerHandle: workerHandle,
124
+ workpoolOptions: options.workpoolOptions,
125
+ });
126
+ },
127
+ };
128
+
129
+ const encoded = makeConvexEncoded(component, hooks);
130
+ const engine = makeUnsafeWorkflowEngine(encoded);
131
+
132
+ const program = Effect.gen(function*() {
133
+ yield* encoded.register(workflow, execute);
134
+ return yield* encoded.execute(workflow, {
135
+ executionId: args.executionId,
136
+ payload: {},
137
+ discard: false,
138
+ parent: undefined,
139
+ });
140
+ });
141
+
142
+ const exit = await Effect.runPromiseExit(
143
+ provideConvexCtx(
144
+ Effect.provideService(program, WorkflowEngine, engine),
145
+ ctx,
146
+ ) as Effect.Effect<unknown, never, never>,
147
+ );
148
+
149
+ if (Exit.isFailure(exit)) {
150
+ await ctx.runMutation(asMutationReference(component.executions.completeExecution), {
151
+ executionId: args.executionId,
152
+ generation: args.generation,
153
+ kind: "failure",
154
+ error: `Runner failure: ${String(exit.cause)}`,
155
+ });
156
+ }
157
+ },
158
+ });
159
+ }
160
+
161
+ export async function functionHandleForRunner(
162
+ runner: RunnerReference,
163
+ ): Promise<RunnerHandle> {
164
+ return (await createFunctionHandle(asRunnerMutationReference(runner))) as RunnerHandle;
165
+ }
@@ -0,0 +1,30 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import {
4
+ makeUnsafe as makeUnsafeWorkflowEngine,
5
+ WorkflowEngine,
6
+ } from "@effect/workflow/WorkflowEngine";
7
+ import type { ComponentApi } from "../component/_generated/component.js";
8
+ import { ConvexCtx, type ConvexWorkflowCtx } from "./ConvexCtx.js";
9
+ import { makeConvexEncoded, type ConvexEncodedHooks } from "./encoded.js";
10
+
11
+ export function makeWorkflowEngine(
12
+ component: ComponentApi,
13
+ hooks: ConvexEncodedHooks,
14
+ ): WorkflowEngine["Type"] {
15
+ return makeUnsafeWorkflowEngine(makeConvexEncoded(component, hooks));
16
+ }
17
+
18
+ export function provideConvexCtx<A, E, R>(
19
+ effect: Effect.Effect<A, E, R>,
20
+ ctx: ConvexWorkflowCtx,
21
+ ) {
22
+ return Effect.provideService(effect, ConvexCtx, ctx);
23
+ }
24
+
25
+ export function layerConvexWorkflowEngine(
26
+ component: ComponentApi,
27
+ hooks: ConvexEncodedHooks,
28
+ ): Layer.Layer<WorkflowEngine> {
29
+ return Layer.succeed(WorkflowEngine, makeWorkflowEngine(component, hooks));
30
+ }
@@ -0,0 +1,179 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type * as activityCompletions from "../activityCompletions.js";
12
+ import type * as boundaries from "../boundaries.js";
13
+ import type * as cleanup from "../cleanup.js";
14
+ import type * as clocks from "../clocks.js";
15
+ import type * as config from "../config.js";
16
+ import type * as dashboard from "../dashboard.js";
17
+ import type * as deferreds from "../deferreds.js";
18
+ import type * as executions from "../executions.js";
19
+ import type * as journalSteps from "../journalSteps.js";
20
+ import type * as logs from "../logs.js";
21
+ import type * as onComplete from "../onComplete.js";
22
+ import type * as payloads from "../payloads.js";
23
+ import type * as queries from "../queries.js";
24
+ import type * as runner from "../runner.js";
25
+ import type * as spans from "../spans.js";
26
+ import type * as utils from "../utils.js";
27
+
28
+ import type {
29
+ ApiFromModules,
30
+ FilterApi,
31
+ FunctionReference,
32
+ } from "convex/server";
33
+ import { anyApi, componentsGeneric } from "convex/server";
34
+
35
+ const fullApi: ApiFromModules<{
36
+ activityCompletions: typeof activityCompletions;
37
+ boundaries: typeof boundaries;
38
+ cleanup: typeof cleanup;
39
+ clocks: typeof clocks;
40
+ config: typeof config;
41
+ dashboard: typeof dashboard;
42
+ deferreds: typeof deferreds;
43
+ executions: typeof executions;
44
+ journalSteps: typeof journalSteps;
45
+ logs: typeof logs;
46
+ onComplete: typeof onComplete;
47
+ payloads: typeof payloads;
48
+ queries: typeof queries;
49
+ runner: typeof runner;
50
+ spans: typeof spans;
51
+ utils: typeof utils;
52
+ }> = anyApi as any;
53
+
54
+ /**
55
+ * A utility for referencing Convex functions in your app's public API.
56
+ *
57
+ * Usage:
58
+ * ```js
59
+ * const myFunctionReference = api.myModule.myFunction;
60
+ * ```
61
+ */
62
+ export const api: FilterApi<
63
+ typeof fullApi,
64
+ FunctionReference<any, "public">
65
+ > = anyApi as any;
66
+
67
+ /**
68
+ * A utility for referencing Convex functions in your app's internal API.
69
+ *
70
+ * Usage:
71
+ * ```js
72
+ * const myFunctionReference = internal.myModule.myFunction;
73
+ * ```
74
+ */
75
+ export const internal: FilterApi<
76
+ typeof fullApi,
77
+ FunctionReference<any, "internal">
78
+ > = anyApi as any;
79
+
80
+ export const components = componentsGeneric() as unknown as {
81
+ workpool: {
82
+ config: {
83
+ update: FunctionReference<
84
+ "mutation",
85
+ "internal",
86
+ {
87
+ logLevel?: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
88
+ maxParallelism?: number;
89
+ },
90
+ any
91
+ >;
92
+ };
93
+ lib: {
94
+ cancel: FunctionReference<
95
+ "mutation",
96
+ "internal",
97
+ {
98
+ id: string;
99
+ logLevel?: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
100
+ },
101
+ any
102
+ >;
103
+ cancelAll: FunctionReference<
104
+ "mutation",
105
+ "internal",
106
+ {
107
+ before?: number;
108
+ limit?: number;
109
+ logLevel?: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
110
+ },
111
+ any
112
+ >;
113
+ enqueue: FunctionReference<
114
+ "mutation",
115
+ "internal",
116
+ {
117
+ config: {
118
+ logLevel?: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
119
+ maxParallelism?: number;
120
+ };
121
+ fnArgs: any;
122
+ fnHandle: string;
123
+ fnName: string;
124
+ fnType: "action" | "mutation" | "query";
125
+ onComplete?: { context?: any; fnHandle: string };
126
+ retryBehavior?: {
127
+ base: number;
128
+ initialBackoffMs: number;
129
+ maxAttempts: number;
130
+ };
131
+ runAt: number;
132
+ },
133
+ string
134
+ >;
135
+ enqueueBatch: FunctionReference<
136
+ "mutation",
137
+ "internal",
138
+ {
139
+ config: {
140
+ logLevel?: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
141
+ maxParallelism?: number;
142
+ };
143
+ items: Array<{
144
+ fnArgs: any;
145
+ fnHandle: string;
146
+ fnName: string;
147
+ fnType: "action" | "mutation" | "query";
148
+ onComplete?: { context?: any; fnHandle: string };
149
+ retryBehavior?: {
150
+ base: number;
151
+ initialBackoffMs: number;
152
+ maxAttempts: number;
153
+ };
154
+ runAt: number;
155
+ }>;
156
+ },
157
+ Array<string>
158
+ >;
159
+ status: FunctionReference<
160
+ "query",
161
+ "internal",
162
+ { id: string },
163
+ | { previousAttempts: number; state: "pending" }
164
+ | { previousAttempts: number; state: "running" }
165
+ | { state: "finished" }
166
+ >;
167
+ statusBatch: FunctionReference<
168
+ "query",
169
+ "internal",
170
+ { ids: Array<string> },
171
+ Array<
172
+ | { previousAttempts: number; state: "pending" }
173
+ | { previousAttempts: number; state: "running" }
174
+ | { state: "finished" }
175
+ >
176
+ >;
177
+ };
178
+ };
179
+ };