@mastra/temporal 0.4.18-alpha.4 → 0.4.18-alpha.6
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.
- package/dist/index.cjs +27 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -15
- package/dist/index.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/temporal-workflow-runtime.mjs +54 -33
- package/dist/transforms/temporal-workflow-runtime.d.mts +16 -1
- package/dist/transforms/temporal-workflow-runtime.d.mts.map +1 -1
- package/dist/transforms/workflows.d.ts.map +1 -1
- package/dist/worker.cjs +13 -6
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +13 -6
- package/dist/worker.js.map +1 -1
- package/package.json +6 -6
package/dist/worker.js
CHANGED
|
@@ -764,7 +764,10 @@ function collectWorkflowBindings(program, filePath) {
|
|
|
764
764
|
const [workflowConfig] = workflowChain?.createWorkflowCall.arguments ?? [];
|
|
765
765
|
if (!workflowChain || !workflowConfig || !t.isObjectExpression(workflowConfig)) continue;
|
|
766
766
|
const { workflowId } = getWorkflowIdMetadata(workflowConfig, declaration.id.name, filePath);
|
|
767
|
-
workflowBindings.set(declaration.id.name,
|
|
767
|
+
workflowBindings.set(declaration.id.name, {
|
|
768
|
+
workflowType: toWorkflowType(workflowId),
|
|
769
|
+
workflowId
|
|
770
|
+
});
|
|
768
771
|
}
|
|
769
772
|
}
|
|
770
773
|
return workflowBindings;
|
|
@@ -796,8 +799,8 @@ function rewriteChainMethod(method, filePath, workflowName, workflowId, mappingO
|
|
|
796
799
|
case "then": {
|
|
797
800
|
const arg = argNode(0);
|
|
798
801
|
if (t.isIdentifier(arg)) {
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
802
|
+
const binding = workflowBindings.get(arg.name);
|
|
803
|
+
if (binding) return rewritten([t.stringLiteral(binding.workflowType), t.stringLiteral(binding.workflowId)], "thenWorkflow");
|
|
801
804
|
}
|
|
802
805
|
const name = getWorkflowStepName(arg, stepBindings);
|
|
803
806
|
if (!name) throw new Error(`.then() in ${workflowName} (${filePath}) must take a step or workflow identifier (inline createStep calls are not supported)`);
|
|
@@ -823,8 +826,12 @@ function rewriteChainMethod(method, filePath, workflowName, workflowId, mappingO
|
|
|
823
826
|
if (!t.isArrayExpression(arg)) throw new Error(`.parallel() in ${workflowName} (${filePath}) requires an array literal argument`);
|
|
824
827
|
const entries = arg.elements.map((element) => {
|
|
825
828
|
if (t.isIdentifier(element)) {
|
|
826
|
-
const
|
|
827
|
-
if (
|
|
829
|
+
const binding = workflowBindings.get(element.name);
|
|
830
|
+
if (binding) return t.objectExpression([
|
|
831
|
+
t.objectProperty(t.identifier("type"), t.stringLiteral("childWorkflow")),
|
|
832
|
+
t.objectProperty(t.identifier("workflowType"), t.stringLiteral(binding.workflowType)),
|
|
833
|
+
t.objectProperty(t.identifier("id"), t.stringLiteral(binding.workflowId))
|
|
834
|
+
]);
|
|
828
835
|
}
|
|
829
836
|
const stepId = getWorkflowStepName(element, stepBindings);
|
|
830
837
|
if (!stepId) throw new Error(`Unable to determine step names inside .parallel() in ${workflowName} (${filePath})`);
|
|
@@ -977,7 +984,7 @@ function rewriteWorkflowImportDeclaration(statement, state) {
|
|
|
977
984
|
}
|
|
978
985
|
function getNormalizedWorkflowBindingName(name, state) {
|
|
979
986
|
if (!state.workflowNames.has(name)) return null;
|
|
980
|
-
return state.workflowBindings.get(name) ?? name;
|
|
987
|
+
return state.workflowBindings.get(name)?.workflowType ?? name;
|
|
981
988
|
}
|
|
982
989
|
function rewriteWorkflowNamedExport(statement, state) {
|
|
983
990
|
if (statement.source != null) return;
|