@@ -27,27 +27,7 @@ export type RunOptions = {
2727 * replay successfully despite argument changes.
2828 */
2929 unstableArgs ?: boolean ;
30- } & (
31- | {
32- /**
33- * Run the query or mutation inline within the workflow's transaction,
34- * instead of dispatching it through the work pool.
35- *
36- * This avoids the round-trip overhead of scheduling through the work
37- * pool, but means the function shares the workflow's transaction —
38- * reads and writes are part of the same commit. Avoid using this for
39- * functions that read or write large amounts of data, since they will
40- * count toward the workflow transaction's limits.
41- *
42- * Only applies to queries and mutations. Actions always run via the
43- * work pool. Cannot be combined with `runAfter` or `runAt`.
44- */
45- inline ?: boolean ;
46- runAt ?: never ;
47- runAfter ?: never ;
48- }
49- | ( SchedulerOptions & { inline ?: never } )
50- ) ;
30+ } & SchedulerOptions ;
5131
5232export type WorkflowCtx = {
5333 /**
@@ -63,7 +43,7 @@ export type WorkflowCtx = {
6343 */
6444 runQuery < Query extends FunctionReference < "query" , FunctionVisibility > > (
6545 query : Query ,
66- ...args : OptionalRestArgs < RunOptions , Query >
46+ ...args : OptionalRestArgs < RunOptions & { inline ?: boolean } , Query >
6747 ) : Promise < FunctionReturnType < Query > > ;
6848
6949 /**
@@ -77,7 +57,7 @@ export type WorkflowCtx = {
7757 Mutation extends FunctionReference < "mutation" , FunctionVisibility > ,
7858 > (
7959 mutation : Mutation ,
80- ...args : OptionalRestArgs < RunOptions , Mutation >
60+ ...args : OptionalRestArgs < RunOptions & { inline ?: boolean } , Mutation >
8161 ) : Promise < FunctionReturnType < Mutation > > ;
8262
8363 /**
@@ -217,7 +197,7 @@ async function runFunction<
217197 functionType : FunctionType ,
218198 f : F ,
219199 args : Record < string , unknown > | undefined ,
220- opts ?: RunOptions & RetryOption ,
200+ opts ?: RunOptions & { inline ?: boolean } & RetryOption ,
221201) : Promise < unknown > {
222202 const { name, retry, inline, unstableArgs, ...schedulerOptions } = opts ?? { } ;
223203 if (
@@ -226,6 +206,9 @@ async function runFunction<
226206 ) {
227207 throw new Error ( "Cannot combine `inline` with `runAt` or `runAfter`." ) ;
228208 }
209+ if ( inline && functionType === "action" ) {
210+ throw new Error ( "Cannot run an action inline." ) ;
211+ }
229212 return run ( sender , {
230213 name : name ?? safeFunctionName ( f ) ,
231214 target : {
0 commit comments