@mastra/temporal 0.2.7-alpha.5 → 0.2.7-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.
- package/CHANGELOG.md +28 -0
- package/dist/temporal-workflow-runtime.mjs +10 -8
- package/dist/transforms/temporal-workflow-runtime.d.mts +2 -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 +34 -4
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +34 -4
- package/dist/worker.js.map +1 -1
- package/package.json +5 -5
package/dist/worker.js
CHANGED
|
@@ -816,6 +816,30 @@ function createTemporalWorkflowHelperStatements() {
|
|
|
816
816
|
return [statement];
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
|
+
function getTemporalWorkflowRuntimeOptions(program3) {
|
|
820
|
+
for (const statement of program3.body) {
|
|
821
|
+
const declarationStatement = t3.isVariableDeclaration(statement) ? statement : t3.isExportNamedDeclaration(statement) && t3.isVariableDeclaration(statement.declaration) ? statement.declaration : null;
|
|
822
|
+
if (!declarationStatement) {
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
for (const declaration of declarationStatement.declarations) {
|
|
826
|
+
if (!isWorkflowHelperDestructure(declaration) || !t3.isCallExpression(declaration.init)) {
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
const [temporalParams] = declaration.init.arguments;
|
|
830
|
+
if (!temporalParams || !t3.isObjectExpression(temporalParams)) {
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
for (const property of temporalParams.properties) {
|
|
834
|
+
if (t3.isObjectProperty(property) && getObjectPropertyName(property) === "startToCloseTimeout" && t3.isExpression(property.value)) {
|
|
835
|
+
return t3.objectExpression([
|
|
836
|
+
t3.objectProperty(t3.identifier("startToCloseTimeout"), t3.cloneNode(property.value, true))
|
|
837
|
+
]);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
819
843
|
function parseWorkflowChain(node) {
|
|
820
844
|
const methods = [];
|
|
821
845
|
let current = node;
|
|
@@ -1011,8 +1035,12 @@ function rewriteChainMethod(method, filePath, workflowName, stepBindings, workfl
|
|
|
1011
1035
|
function getExportedName(node) {
|
|
1012
1036
|
return t3.isIdentifier(node) ? node.name : node.value;
|
|
1013
1037
|
}
|
|
1014
|
-
function createTemporalWorkflowStatements(exportName, workflowId, methods, filePath, includeCommit, stepBindings, workflowBindings) {
|
|
1015
|
-
|
|
1038
|
+
function createTemporalWorkflowStatements(exportName, workflowId, methods, filePath, includeCommit, stepBindings, workflowBindings, runtimeOptions) {
|
|
1039
|
+
const createWorkflowArgs = [t3.cloneNode(workflowId, true)];
|
|
1040
|
+
if (runtimeOptions) {
|
|
1041
|
+
createWorkflowArgs.push(t3.cloneNode(runtimeOptions, true));
|
|
1042
|
+
}
|
|
1043
|
+
let expression = t3.callExpression(t3.identifier("createWorkflow"), createWorkflowArgs);
|
|
1016
1044
|
for (const method of methods) {
|
|
1017
1045
|
const rewrittenMethod = rewriteChainMethod(method, filePath, exportName, stepBindings, workflowBindings);
|
|
1018
1046
|
expression = t3.callExpression(
|
|
@@ -1077,7 +1105,8 @@ function createWorkflowTransformState(program3, filePath) {
|
|
|
1077
1105
|
strippedNames: /* @__PURE__ */ new Set(),
|
|
1078
1106
|
stepBindings: collectStepBindings(program3),
|
|
1079
1107
|
workflowBindings: collectWorkflowBindings(program3, filePath),
|
|
1080
|
-
workflowExports: []
|
|
1108
|
+
workflowExports: [],
|
|
1109
|
+
runtimeOptions: getTemporalWorkflowRuntimeOptions(program3)
|
|
1081
1110
|
};
|
|
1082
1111
|
}
|
|
1083
1112
|
function collectWorkflowDeclarationMetadata(statement, state) {
|
|
@@ -1211,7 +1240,8 @@ function rewriteWorkflowVariableDeclaration(statement, filePath, state) {
|
|
|
1211
1240
|
filePath,
|
|
1212
1241
|
state.committedWorkflowNames.has(declaration.id.name),
|
|
1213
1242
|
state.stepBindings,
|
|
1214
|
-
state.workflowBindings
|
|
1243
|
+
state.workflowBindings,
|
|
1244
|
+
state.runtimeOptions
|
|
1215
1245
|
)
|
|
1216
1246
|
);
|
|
1217
1247
|
}
|