@mastra/temporal 0.4.6-alpha.5 → 0.4.6-alpha.7

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.
@@ -44,6 +44,13 @@ export class TemporalExecutionEngine {
44
44
  return out;
45
45
  }
46
46
 
47
+ case 'mapping': {
48
+ log.info('mapping', { mappingId: entry.id });
49
+ const out = await this.activityHandle[entry.id]({ inputData, initData: this.initData });
50
+ stepResults[entry.id] = out;
51
+ return out;
52
+ }
53
+
47
54
  case 'sleep': {
48
55
  const duration = entry.duration ?? (entry.fn ? await this.activityHandle[entry.fn]({ inputData }) : 0);
49
56
  log.info('sleep', { id: entry.id, duration });
@@ -65,13 +72,14 @@ export class TemporalExecutionEngine {
65
72
  }
66
73
 
67
74
  case 'parallel': {
68
- log.info('parallel', { steps: entry.steps.map(s => s.step.id) });
69
- const results = await Promise.all(entry.steps.map(s => this.activityHandle[s.step.id]({ inputData })));
75
+ const entryId = parallelEntry =>
76
+ parallelEntry.type === 'childWorkflow' ? parallelEntry.workflowType : parallelEntry.step.id;
77
+ log.info('parallel', { steps: entry.steps.map(entryId) });
78
+ const results = await Promise.all(entry.steps.map(step => this.executeEntry(step, inputData, stepResults)));
70
79
  const out = {};
71
80
 
72
- entry.steps.forEach((s, i) => {
73
- out[s.step.id] = results[i];
74
- stepResults[s.step.id] = results[i];
81
+ entry.steps.forEach((step, i) => {
82
+ out[entryId(step)] = results[i];
75
83
  });
76
84
 
77
85
  return out;
@@ -187,6 +195,13 @@ export function createWorkflow(workflowId, options) {
187
195
  });
188
196
  return workflow;
189
197
  },
198
+ map(mappingId) {
199
+ stepFlow.push({
200
+ type: 'mapping',
201
+ id: mappingId,
202
+ });
203
+ return workflow;
204
+ },
190
205
  sleep(durationOrFnId) {
191
206
  if (typeof durationOrFnId === 'number') {
192
207
  stepFlow.push({
@@ -225,15 +240,10 @@ export function createWorkflow(workflowId, options) {
225
240
  }
226
241
  return workflow;
227
242
  },
228
- parallel(stepIds) {
243
+ parallel(entries) {
229
244
  stepFlow.push({
230
245
  type: 'parallel',
231
- steps: stepIds.map(id => ({
232
- type: 'step',
233
- step: {
234
- id,
235
- },
236
- })),
246
+ steps: entries,
237
247
  });
238
248
  return workflow;
239
249
  },
@@ -1 +1 @@
1
- {"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../src/transforms/activities.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCAAmC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;CAC7C;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAmE/G;AA6HD,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mCAAmC,CAAC,CA4W9C"}
1
+ {"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../src/transforms/activities.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCAAmC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;CAC7C;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAmE/G;AAmRD,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mCAAmC,CAAC,CAoY9C"}
@@ -33,6 +33,13 @@ export declare function createWorkflow(workflowId: any, options: any): ((startAr
33
33
  state: any;
34
34
  steps: {};
35
35
  }>;
36
+ map(mappingId: any): (startArgs: any) => Promise<{
37
+ status: string;
38
+ input: any;
39
+ result: any;
40
+ state: any;
41
+ steps: {};
42
+ }>;
36
43
  sleep(durationOrFnId: any): (startArgs: any) => Promise<{
37
44
  status: string;
38
45
  input: any;
@@ -47,7 +54,7 @@ export declare function createWorkflow(workflowId: any, options: any): ((startAr
47
54
  state: any;
48
55
  steps: {};
49
56
  }>;
50
- parallel(stepIds: any): (startArgs: any) => Promise<{
57
+ parallel(entries: any): (startArgs: any) => Promise<{
51
58
  status: string;
52
59
  input: any;
53
60
  result: any;
@@ -1 +1 @@
1
- {"version":3,"file":"temporal-workflow-runtime.d.mts","sourceRoot":"","sources":["../../src/transforms/temporal-workflow-runtime.mjs"],"names":[],"mappings":"AAEA,qBAAa,uBAAuB;IAU3B,QAAQ;IATf,mBAAmB,MAAC;IACpB,cAAc,wGAAC;IAEf,YAAY,MAAM,KAAA,EAGjB;IAEK,OAAO,CAAC,MAAM,KAAA;;;;;;OAgBnB;IAEK,YAAY,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,WAAW,KAAA,gBAuH/C;CACF;AAED,wBAAgB,cAAc,CAAC,UAAU,KAAA,EAAE,OAAO,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJjD"}
1
+ {"version":3,"file":"temporal-workflow-runtime.d.mts","sourceRoot":"","sources":["../../src/transforms/temporal-workflow-runtime.mjs"],"names":[],"mappings":"AAEA,qBAAa,uBAAuB;IAU3B,QAAQ;IATf,mBAAmB,MAAC;IACpB,cAAc,wGAAC;IAEf,YAAY,MAAM,KAAA,EAGjB;IAEK,OAAO,CAAC,MAAM,KAAA;;;;;;OAgBnB;IAEK,YAAY,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,WAAW,KAAA,gBA+H/C;CACF;AAED,wBAAgB,cAAc,CAAC,UAAU,KAAA,EAAE,OAAO,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmJjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/transforms/workflows.ts"],"names":[],"mappings":"AAgcA,MAAM,WAAW,4BAA4B;CAE5C;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAoUD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCjC"}
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/transforms/workflows.ts"],"names":[],"mappings":"AAufA,MAAM,WAAW,4BAA4B;CAE5C;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAyUD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCjC"}
package/dist/worker.cjs CHANGED
@@ -301,6 +301,80 @@ function rebaseModulePath(modulePath, sourceFilePath, outputFilePath) {
301
301
  const resolvedPath = path.default.resolve(path.default.dirname(sourceFilePath), modulePath);
302
302
  return normalizeImportPath(path.default.relative(path.default.dirname(outputFilePath), resolvedPath), path.default.extname(resolvedPath));
303
303
  }
304
+ function parseWorkflowChain$1(node) {
305
+ const methods = [];
306
+ let current = node;
307
+ while (_babel_types.isCallExpression(current) && _babel_types.isMemberExpression(current.callee) && !current.callee.computed) {
308
+ if (!_babel_types.isIdentifier(current.callee.property)) return null;
309
+ methods.unshift({
310
+ name: current.callee.property.name,
311
+ args: current.arguments
312
+ });
313
+ current = current.callee.object;
314
+ }
315
+ if (!_babel_types.isCallExpression(current) || !_babel_types.isIdentifier(current.callee, { name: "createWorkflow" })) return null;
316
+ return {
317
+ createWorkflowCall: current,
318
+ methods
319
+ };
320
+ }
321
+ function getStaticWorkflowId(call, filePath) {
322
+ const [config] = call.arguments;
323
+ if (!_babel_types.isObjectExpression(config)) throw new Error(`Unable to determine workflow config in ${filePath}`);
324
+ for (const property of config.properties) {
325
+ if (!_babel_types.isObjectProperty(property) || getObjectPropertyName(property) !== "id") continue;
326
+ if (_babel_types.isStringLiteral(property.value)) return property.value.value;
327
+ if (_babel_types.isTemplateLiteral(property.value) && property.value.expressions.length === 0) return property.value.quasis[0]?.value.cooked ?? "";
328
+ }
329
+ throw new Error(`Workflow id must be a static string in ${filePath}`);
330
+ }
331
+ function toExportName(id) {
332
+ return id.replace(/[^a-zA-Z0-9]+(.)/g, (_match, char) => char.toUpperCase()).replace(/^[^a-zA-Z_$]+/, "").replace(/^(.)/, (char) => char.toLowerCase());
333
+ }
334
+ function collectStaticFunctionBindings(program) {
335
+ const bindings = /* @__PURE__ */ new Set();
336
+ for (const statement of program.body) {
337
+ const declaration = _babel_types.isExportNamedDeclaration(statement) ? statement.declaration : statement;
338
+ if (_babel_types.isFunctionDeclaration(declaration) && declaration.id) {
339
+ bindings.add(declaration.id.name);
340
+ continue;
341
+ }
342
+ if (!_babel_types.isVariableDeclaration(declaration) || declaration.kind !== "const") continue;
343
+ for (const declarator of declaration.declarations) if (_babel_types.isIdentifier(declarator.id) && (_babel_types.isArrowFunctionExpression(declarator.init) || _babel_types.isFunctionExpression(declarator.init))) bindings.add(declarator.id.name);
344
+ }
345
+ return bindings;
346
+ }
347
+ function collectTopLevelBindingNames(program) {
348
+ const bindings = /* @__PURE__ */ new Set();
349
+ for (const statement of program.body) for (const name of Object.keys(_babel_types.getBindingIdentifiers(statement))) bindings.add(name);
350
+ return bindings;
351
+ }
352
+ function createMappingActivityStatements(workflowExpression, filePath, staticFunctionBindings, usedExportNames, addBinding) {
353
+ const chain = parseWorkflowChain$1(workflowExpression);
354
+ if (!chain) return [];
355
+ const workflowId = getStaticWorkflowId(chain.createWorkflowCall, filePath);
356
+ const statements = [];
357
+ let mappingOrdinal = 0;
358
+ for (const method of chain.methods) {
359
+ if (method.name !== "map") continue;
360
+ const [callback] = method.args;
361
+ if (_babel_types.isObjectExpression(callback)) throw new Error(`.map() in workflow ${workflowId} (${filePath}) does not yet support declarative object mappings`);
362
+ if (!_babel_types.isArrowFunctionExpression(callback) && !_babel_types.isFunctionExpression(callback) && !(_babel_types.isIdentifier(callback) && staticFunctionBindings.has(callback.name))) throw new Error(`.map() in workflow ${workflowId} (${filePath}) requires an inline function or a statically declared function identifier`);
363
+ const mappingId = `mapping_${workflowId}_${mappingOrdinal++}`;
364
+ const baseExportName = toExportName(mappingId);
365
+ let exportName = baseExportName;
366
+ let exportSuffix = 1;
367
+ while (usedExportNames.has(exportName)) exportName = `${baseExportName}${exportSuffix++}`;
368
+ usedExportNames.add(exportName);
369
+ const params = _babel_types.objectPattern([_babel_types.objectProperty(_babel_types.identifier("inputData"), _babel_types.identifier("inputData"), false, true), _babel_types.objectProperty(_babel_types.identifier("initData"), _babel_types.identifier("initData"), false, true)]);
370
+ const callbackContext = _babel_types.objectExpression([_babel_types.objectProperty(_babel_types.identifier("inputData"), _babel_types.identifier("inputData"), false, true), _babel_types.objectProperty(_babel_types.identifier("getInitData"), _babel_types.arrowFunctionExpression([], _babel_types.identifier("initData")))]);
371
+ const callbackExpression = _babel_types.cloneNode(callback, true);
372
+ const body = _babel_types.callExpression(callbackExpression, [callbackContext]);
373
+ statements.push(_babel_types.exportNamedDeclaration(_babel_types.variableDeclaration("const", [_babel_types.variableDeclarator(_babel_types.identifier(exportName), _babel_types.arrowFunctionExpression([params], body, true))])));
374
+ addBinding(exportName, mappingId);
375
+ }
376
+ return statements;
377
+ }
304
378
  function collectWorkflowBindingNames(ast) {
305
379
  const workflowNames = /* @__PURE__ */ new Set();
306
380
  for (const statement of ast.program.body) {
@@ -360,15 +434,18 @@ function createTemporalActivitiesHelperStatements(mastraImportPath, hasMastraBin
360
434
  async function buildTemporalActivitiesModule(entryFile, outputDirectory, outputFileName) {
361
435
  const activityBindings = [];
362
436
  const seenActivityBindingNames = /* @__PURE__ */ new Set();
363
- const addActivityBinding = (exportName, call) => {
364
- const stepId = getCreateStepId(call);
365
- if (!stepId || seenActivityBindingNames.has(exportName)) return;
437
+ const addGeneratedActivityBinding = (exportName, stepId) => {
438
+ if (seenActivityBindingNames.has(exportName)) return;
366
439
  seenActivityBindingNames.add(exportName);
367
440
  activityBindings.push({
368
441
  exportName,
369
442
  stepId
370
443
  });
371
444
  };
445
+ const addActivityBinding = (exportName, call) => {
446
+ const stepId = getCreateStepId(call);
447
+ if (stepId) addGeneratedActivityBinding(exportName, stepId);
448
+ };
372
449
  const bundle = await (0, rollup.rollup)({
373
450
  input: entryFile,
374
451
  treeshake: "smallest",
@@ -386,6 +463,8 @@ async function buildTemporalActivitiesModule(entryFile, outputDirectory, outputF
386
463
  const strippedNames = /* @__PURE__ */ new Set();
387
464
  const workflowBindingNames = collectWorkflowBindingNames(ast);
388
465
  const stepFactoryBindings = collectCreateStepFactoryBindings(ast.program);
466
+ const staticFunctionBindings = collectStaticFunctionBindings(ast.program);
467
+ const usedExportNames = collectTopLevelBindingNames(ast.program);
389
468
  const sourceFilePath = id;
390
469
  const hasMastraBinding = hasLocalMastraBinding(ast);
391
470
  let helperInserted = false;
@@ -447,6 +526,7 @@ async function buildTemporalActivitiesModule(entryFile, outputDirectory, outputF
447
526
  if (hasCreateWorkflowCall(declaration.init)) {
448
527
  workflowBindingNames.add(declaration.id.name);
449
528
  strippedNames.add(declaration.id.name);
529
+ statements.push(...createMappingActivityStatements(declaration.init, sourceFilePath, staticFunctionBindings, usedExportNames, addGeneratedActivityBinding));
450
530
  collectInlineCreateSteps(declaration.init, seenNames, statements, addActivityBinding);
451
531
  continue;
452
532
  }
@@ -486,6 +566,7 @@ async function buildTemporalActivitiesModule(entryFile, outputDirectory, outputF
486
566
  if (hasCreateWorkflowCall(declaration.init)) {
487
567
  workflowBindingNames.add(declaration.id.name);
488
568
  strippedNames.add(declaration.id.name);
569
+ statements.push(...createMappingActivityStatements(declaration.init, sourceFilePath, staticFunctionBindings, usedExportNames, addGeneratedActivityBinding));
489
570
  collectInlineCreateSteps(declaration.init, seenNames, statements, addActivityBinding);
490
571
  continue;
491
572
  }
@@ -685,7 +766,7 @@ function getWorkflowStepName(node, stepBindings) {
685
766
  * Most step references collapse down to step ids so the generated workflow can call
686
767
  * activities by id instead of keeping the original `createStep` definitions around.
687
768
  */
688
- function rewriteChainMethod(method, filePath, workflowName, stepBindings, workflowBindings) {
769
+ function rewriteChainMethod(method, filePath, workflowName, workflowId, mappingOrdinal, stepBindings, workflowBindings) {
689
770
  const argNode = (index) => method.args[index];
690
771
  const rewritten = (args, name = method.name) => ({
691
772
  name,
@@ -720,9 +801,16 @@ function rewriteChainMethod(method, filePath, workflowName, stepBindings, workfl
720
801
  case "parallel": {
721
802
  const arg = argNode(0);
722
803
  if (!_babel_types.isArrayExpression(arg)) throw new Error(`.parallel() in ${workflowName} (${filePath}) requires an array literal argument`);
723
- const names = arg.elements.map((el) => getWorkflowStepName(el, stepBindings));
724
- if (names.some((n) => !n)) throw new Error(`Unable to determine step names inside .parallel() in ${workflowName} (${filePath})`);
725
- return rewritten([_babel_types.arrayExpression(names.map((n) => _babel_types.stringLiteral(n)))]);
804
+ const entries = arg.elements.map((element) => {
805
+ if (_babel_types.isIdentifier(element)) {
806
+ const workflowType = workflowBindings.get(element.name);
807
+ if (workflowType) return _babel_types.objectExpression([_babel_types.objectProperty(_babel_types.identifier("type"), _babel_types.stringLiteral("childWorkflow")), _babel_types.objectProperty(_babel_types.identifier("workflowType"), _babel_types.stringLiteral(workflowType))]);
808
+ }
809
+ const stepId = getWorkflowStepName(element, stepBindings);
810
+ if (!stepId) throw new Error(`Unable to determine step names inside .parallel() in ${workflowName} (${filePath})`);
811
+ return _babel_types.objectExpression([_babel_types.objectProperty(_babel_types.identifier("type"), _babel_types.stringLiteral("step")), _babel_types.objectProperty(_babel_types.identifier("step"), _babel_types.objectExpression([_babel_types.objectProperty(_babel_types.identifier("id"), _babel_types.stringLiteral(stepId))]))]);
812
+ });
813
+ return rewritten([_babel_types.arrayExpression(entries)]);
726
814
  }
727
815
  case "branch": {
728
816
  const arg = argNode(0);
@@ -751,6 +839,15 @@ function rewriteChainMethod(method, filePath, workflowName, stepBindings, workfl
751
839
  if (optsArg && _babel_types.isExpression(optsArg)) args.push(_babel_types.cloneNode(optsArg, true));
752
840
  return rewritten(args);
753
841
  }
842
+ case "map": {
843
+ const callback = argNode(0);
844
+ if (_babel_types.isObjectExpression(callback)) throw new Error(`.map() in ${workflowName} (${filePath}) does not yet support declarative object mappings; use a callback mapping`);
845
+ if (!_babel_types.isArrowFunctionExpression(callback) && !_babel_types.isFunctionExpression(callback) && !_babel_types.isIdentifier(callback)) throw new Error(`.map() in ${workflowName} (${filePath}) requires an inline function or a statically declared function identifier`);
846
+ const args = [_babel_types.stringLiteral(`mapping_${workflowId}_${mappingOrdinal}`)];
847
+ const optsArg = method.args[1];
848
+ if (optsArg && _babel_types.isExpression(optsArg)) args.push(_babel_types.cloneNode(optsArg, true));
849
+ return rewritten(args);
850
+ }
754
851
  case "commit": return rewritten([]);
755
852
  default: throw new Error(`Unsupported workflow chain method .${method.name}() in ${workflowName} (${filePath})`);
756
853
  }
@@ -765,12 +862,14 @@ function getExportedName(node) {
765
862
  * we emit a deterministic exported function whose name matches Temporal's runtime
766
863
  * lookup and whose body delegates into the injected helper runtime.
767
864
  */
768
- function createTemporalWorkflowStatements(exportName, workflowId, methods, filePath, includeCommit, stepBindings, workflowBindings, runtimeOptions) {
865
+ function createTemporalWorkflowStatements(exportName, workflowId, workflowIdValue, methods, filePath, includeCommit, stepBindings, workflowBindings, runtimeOptions) {
769
866
  const createWorkflowArgs = [_babel_types.cloneNode(workflowId, true)];
770
867
  if (runtimeOptions) createWorkflowArgs.push(_babel_types.cloneNode(runtimeOptions, true));
771
868
  let expression = _babel_types.callExpression(_babel_types.identifier("createWorkflow"), createWorkflowArgs);
869
+ let mappingOrdinal = 0;
772
870
  for (const method of methods) {
773
- const rewrittenMethod = rewriteChainMethod(method, filePath, exportName, stepBindings, workflowBindings);
871
+ const rewrittenMethod = rewriteChainMethod(method, filePath, exportName, workflowIdValue, mappingOrdinal, stepBindings, workflowBindings);
872
+ if (method.name === "map") mappingOrdinal += 1;
774
873
  expression = _babel_types.callExpression(_babel_types.memberExpression(expression, _babel_types.identifier(rewrittenMethod.name)), rewrittenMethod.args);
775
874
  }
776
875
  if (includeCommit && !methods.some((m) => m.name === "commit")) expression = _babel_types.callExpression(_babel_types.memberExpression(expression, _babel_types.identifier("commit")), []);
@@ -891,12 +990,12 @@ function rewriteWorkflowVariableDeclaration(statement, filePath, state) {
891
990
  }
892
991
  const [workflowConfig] = workflowChain.createWorkflowCall.arguments;
893
992
  if (!workflowConfig || !_babel_types.isObjectExpression(workflowConfig)) throw new Error(`Unable to determine workflow config for ${declaration.id.name} in ${filePath}`);
894
- const { expression: workflowId } = getWorkflowIdMetadata(workflowConfig, declaration.id.name, filePath);
993
+ const { expression: workflowId, workflowId: workflowIdValue } = getWorkflowIdMetadata(workflowConfig, declaration.id.name, filePath);
895
994
  const workflowExport = getTemporalWorkflowExportFromDeclaration(declaration, filePath);
896
995
  if (!workflowExport) throw new Error(`Unable to determine workflow export for ${declaration.id.name} in ${filePath}`);
897
996
  const { exportName } = workflowExport;
898
997
  state.workflowExports.push(workflowExport);
899
- state.statements.push(...createTemporalWorkflowStatements(exportName, workflowId, workflowChain.methods, filePath, state.committedWorkflowNames.has(declaration.id.name), state.stepBindings, state.workflowBindings, state.runtimeOptions));
998
+ state.statements.push(...createTemporalWorkflowStatements(exportName, workflowId, workflowIdValue, workflowChain.methods, filePath, state.committedWorkflowNames.has(declaration.id.name), state.stepBindings, state.workflowBindings, state.runtimeOptions));
900
999
  }
901
1000
  if (declarations.length > 0) {
902
1001
  const cloned = declarations.map((declaration) => _babel_types.cloneNode(declaration, true));