File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/workflows-shared/src Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ type UserEvent = {
1313 payload : unknown ;
1414} ;
1515
16+ export class WorkflowIntrospectorError extends Error {
17+ name = "WorkflowIntrospectorError" ;
18+ }
19+
1620export class InstanceModifier extends RpcTarget {
1721 #engine: Engine ;
1822 #state: DurableObjectState ;
@@ -80,6 +84,13 @@ export class InstanceModifier extends RpcTarget {
8084 step . name
8185 ) ;
8286 const valueKey = await this . #getStepCacheKey( step ) ;
87+
88+ if ( await this . #state. storage . get ( `replace-result-${ valueKey } ` ) ) {
89+ throw new WorkflowIntrospectorError (
90+ "You're trying to mock the same step multiple times!"
91+ ) ;
92+ }
93+
8394 await this . #state. storage . put ( `replace-result-${ valueKey } ` , stepResult ) ;
8495 }
8596
@@ -137,7 +148,6 @@ export class InstanceModifier extends RpcTarget {
137148 } ;
138149
139150 await this . #state. storage . put ( `mockEvent-${ event . type } ` , true ) ;
140-
141151 await this . #engine. receiveEvent ( myEvent ) ;
142152 }
143153
You can’t perform that action at this time.
0 commit comments