@mastra/temporal 0.0.0 → 0.1.0-alpha.1

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE.md +30 -0
  3. package/README.md +104 -2
  4. package/dist/chunk-BF6TR7JX.js +9 -0
  5. package/dist/chunk-BF6TR7JX.js.map +1 -0
  6. package/dist/chunk-DYBSPLCJ.cjs +11 -0
  7. package/dist/chunk-DYBSPLCJ.cjs.map +1 -0
  8. package/dist/index.cjs +3 -946
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -920
  13. package/dist/index.js.map +1 -1
  14. package/dist/mastra-deployer-UCBGECM5.js +39 -0
  15. package/dist/mastra-deployer-UCBGECM5.js.map +1 -0
  16. package/dist/mastra-deployer-YVT5GB5G.cjs +41 -0
  17. package/dist/mastra-deployer-YVT5GB5G.cjs.map +1 -0
  18. package/dist/mastra-deployer.d.ts +16 -0
  19. package/dist/mastra-deployer.d.ts.map +1 -0
  20. package/dist/plugin.d.ts +13 -15
  21. package/dist/plugin.d.ts.map +1 -1
  22. package/dist/temporal-workflow-runtime.mjs +295 -0
  23. package/dist/transforms/activities.d.ts +4 -3
  24. package/dist/transforms/activities.d.ts.map +1 -1
  25. package/dist/transforms/shared.d.ts +2 -7
  26. package/dist/transforms/shared.d.ts.map +1 -1
  27. package/dist/transforms/temporal-workflow-runtime.d.mts +7 -0
  28. package/dist/transforms/temporal-workflow-runtime.d.mts.map +1 -1
  29. package/dist/transforms/workflows.d.ts +3 -11
  30. package/dist/transforms/workflows.d.ts.map +1 -1
  31. package/dist/worker.cjs +1336 -0
  32. package/dist/worker.cjs.map +1 -0
  33. package/dist/worker.d.ts +2 -0
  34. package/dist/worker.d.ts.map +1 -0
  35. package/dist/worker.js +1310 -0
  36. package/dist/worker.js.map +1 -0
  37. package/package.json +30 -24
  38. package/dist/__tests__/__fixtures__/before/index.d.ts +0 -11
  39. package/dist/__tests__/__fixtures__/before/index.d.ts.map +0 -1
  40. package/dist/__tests__/__fixtures__/before/weather-workflow.d.ts +0 -8
  41. package/dist/__tests__/__fixtures__/before/weather-workflow.d.ts.map +0 -1
  42. package/dist/transforms/__fixtures__/activities/weather-workflow/input.d.ts +0 -8
  43. package/dist/transforms/__fixtures__/activities/weather-workflow/input.d.ts.map +0 -1
  44. package/dist/transforms/__fixtures__/activities/weather-workflow/output.d.ts +0 -3
  45. package/dist/transforms/__fixtures__/activities/weather-workflow/output.d.ts.map +0 -1
  46. package/dist/transforms/__fixtures__/workflow/weather-workflow/input.d.ts +0 -8
  47. package/dist/transforms/__fixtures__/workflow/weather-workflow/input.d.ts.map +0 -1
  48. package/dist/transforms/__fixtures__/workflow/weather-workflow/output.d.ts +0 -2
  49. package/dist/transforms/__fixtures__/workflow/weather-workflow/output.d.ts.map +0 -1
  50. package/dist/webpack-loader.cjs +0 -856
  51. package/dist/webpack-loader.cjs.map +0 -1
  52. package/dist/webpack-loader.d.ts +0 -8
  53. package/dist/webpack-loader.d.ts.map +0 -1
  54. package/dist/webpack-plugin.d.ts +0 -18
  55. package/dist/webpack-plugin.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/webpack-loader.ts","../src/transforms/workflows.ts","../src/utils.ts","../src/transforms/shared.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { buildTemporalWorkflowModule } from './transforms/workflows';\nimport type { WorkflowExportRegistry } from './webpack-plugin';\n\nexport interface MastraTemporalLoaderOptions {\n entryFile?: string;\n debugOutputDir?: string | null;\n registry?: WorkflowExportRegistry;\n}\n\nasync function writeDebugModule(\n resourcePath: string,\n code: string,\n options: MastraTemporalLoaderOptions,\n): Promise<void> {\n if (!options.debugOutputDir) {\n return;\n }\n\n const baseDir = options.entryFile ? path.dirname(options.entryFile) : process.cwd();\n const relativePath = path.relative(baseDir, resourcePath);\n const safeRelativePath = relativePath.startsWith('..') ? path.basename(resourcePath) : relativePath;\n const outputPath = path.join(options.debugOutputDir, 'modules', safeRelativePath);\n\n await mkdir(path.dirname(outputPath), { recursive: true });\n await writeFile(outputPath, code, 'utf-8');\n}\n\nexport default function mastraTemporalWorkflowLoader(this: any, source: string): void {\n const callback = this.async();\n if (!callback) {\n throw new Error('mastra-temporal-webpack-loader requires async mode');\n }\n\n const options: MastraTemporalLoaderOptions = this.getOptions?.() ?? {};\n\n if (!source.includes('createWorkflow')) {\n return callback(null, source);\n }\n\n const transform = async (): Promise<string> => {\n const result = await buildTemporalWorkflowModule(source, this.resourcePath, options);\n options.registry?.register(\n this.resourcePath,\n result.workflows.map(workflow => workflow.exportName),\n );\n return result.code;\n };\n\n transform()\n .then(async code => {\n await writeDebugModule(this.resourcePath, code, options);\n callback(null, code);\n })\n .catch((err: unknown) => callback(err));\n}\n","import { readFileSync, statSync } from 'node:fs';\nimport path from 'node:path';\nimport { generate } from '@babel/generator';\nimport { parse } from '@babel/parser';\nimport * as t from '@babel/types';\nimport { toWorkflowType } from '../utils';\nimport type { WorkflowImportBinding } from './shared';\nimport {\n collectImportedNames,\n getCreateStepId,\n getObjectPropertyName,\n isCreateWorkflowCall,\n isIdentifierNamed,\n isStrippedExternalModule,\n isTemporalHelperModule,\n isWorkflowHelperDestructure,\n nodeReferencesName,\n parserPlugins,\n pruneUnusedTopLevelBindings,\n transpileModule,\n walk,\n} from './shared';\n\n/**\n * Builds a lookup table for imports in the entry module so we can connect a workflow\n * identifier used inside `new Mastra({ workflows })` back to its import source.\n */\nfunction getWorkflowImportBindings(program: t.Program): Map<string, WorkflowImportBinding> {\n const bindings = new Map<string, WorkflowImportBinding>();\n\n for (const statement of program.body) {\n if (!t.isImportDeclaration(statement)) {\n continue;\n }\n\n for (const specifier of statement.specifiers) {\n if (t.isImportSpecifier(specifier)) {\n bindings.set(specifier.local.name, {\n exportName: specifier.local.name,\n importedName: t.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value,\n source: statement.source.value,\n });\n continue;\n }\n\n if (t.isImportDefaultSpecifier(specifier)) {\n bindings.set(specifier.local.name, {\n exportName: specifier.local.name,\n importedName: 'default',\n source: statement.source.value,\n });\n }\n }\n }\n\n return bindings;\n}\n\n/**\n * Finds the workflow bindings referenced from `new Mastra({ workflows })`.\n *\n * We only care about the local identifiers here. The actual exported workflow names\n * are resolved later from the transformed workflow modules via the shared registry.\n */\nfunction getWorkflowEntryBindings(program: t.Program): Set<string> {\n const workflowBindings = new Set<string>();\n\n walk(program, node => {\n if (!t.isNewExpression(node) || !isIdentifierNamed(node.callee, 'Mastra')) {\n return;\n }\n\n const [config] = node.arguments;\n if (!t.isObjectExpression(config)) {\n return;\n }\n\n const workflowsProperty = config.properties.find(\n (property): property is t.ObjectProperty =>\n t.isObjectProperty(property) && getObjectPropertyName(property) === 'workflows',\n );\n\n if (!workflowsProperty || !t.isObjectExpression(workflowsProperty.value)) {\n return;\n }\n\n for (const property of workflowsProperty.value.properties) {\n if (!t.isObjectProperty(property)) {\n continue;\n }\n\n if (property.shorthand && t.isIdentifier(property.key)) {\n workflowBindings.add(property.key.name);\n continue;\n }\n\n if (t.isIdentifier(property.value)) {\n workflowBindings.add(property.value.name);\n }\n }\n });\n\n return workflowBindings;\n}\n\n/**\n * Temporal workflow types must be static so the loader can deterministically map\n * a source workflow to the runtime export name used by the worker.\n */\nfunction getWorkflowIdMetadata(\n workflowConfig: t.ObjectExpression,\n workflowName: string,\n filePath: string,\n): { expression: t.Expression; workflowId: string } {\n for (const property of workflowConfig.properties) {\n if (!t.isObjectProperty(property) || getObjectPropertyName(property) !== 'id') {\n continue;\n }\n\n if (!t.isExpression(property.value)) {\n break;\n }\n\n if (t.isStringLiteral(property.value)) {\n return {\n expression: t.cloneNode(property.value, true),\n workflowId: property.value.value,\n };\n }\n\n if (t.isTemplateLiteral(property.value) && property.value.expressions.length === 0) {\n return {\n expression: t.cloneNode(property.value, true),\n workflowId: property.value.quasis[0]?.value.cooked ?? '',\n };\n }\n\n throw new Error(`Workflow id must be a static string for ${workflowName} in ${filePath}`);\n }\n\n throw new Error(`Unable to determine workflow id for ${workflowName} in ${filePath}`);\n}\n\nconst temporalWorkflowRuntimeSource = readFileSync(new URL('./temporal-workflow-runtime.mjs', import.meta.url), 'utf8');\n\n/**\n * The helper runtime lives in its own `.mjs` module so it can be linted and unit-tested\n * like normal code. We parse that file directly here instead of using `Function#toString()`,\n * which keeps fixture output stable under Vitest/Vite instrumentation.\n */\nfunction createTemporalWorkflowHelperStatements(): t.Statement[] {\n const helperProgram = parse(temporalWorkflowRuntimeSource, {\n sourceType: 'module',\n plugins: parserPlugins as any,\n }).program.body;\n\n return helperProgram.flatMap(statement => {\n if (t.isExportNamedDeclaration(statement) && statement.declaration) {\n return [statement.declaration];\n }\n\n return [statement];\n });\n}\n\n/**\n * Walks a chained workflow expression like `createWorkflow(...).then(...).commit()`\n * back to its root `createWorkflow(...)` call while preserving method order.\n */\nfunction parseWorkflowChain(\n node: t.Node,\n): { createWorkflowCall: t.CallExpression; methods: { name: string; args: t.Node[] }[] } | null {\n const methods: { name: string; args: t.Node[] }[] = [];\n let current: t.Node = node;\n\n // Example:\n // createWorkflow(...).then(stepA).sleep(1000).commit()\n // is peeled from the outside in, producing:\n // [then(stepA), sleep(1000), commit()]\n while (t.isCallExpression(current) && t.isMemberExpression(current.callee) && !current.callee.computed) {\n if (!t.isIdentifier(current.callee.property)) {\n return null;\n }\n\n methods.unshift({\n name: current.callee.property.name,\n args: current.arguments as t.Node[],\n });\n current = current.callee.object;\n }\n\n if (!isCreateWorkflowCall(current)) {\n return null;\n }\n\n return {\n createWorkflowCall: current,\n methods,\n };\n}\n\n/**\n * Maps local `const someStep = createStep({ id: 'some-step' })` bindings to their\n * runtime ids so later chain rewriting can replace identifier references with ids.\n */\nfunction collectStepBindings(program: t.Program): Map<string, string> {\n const stepBindings = new Map<string, string>();\n\n for (const statement of program.body) {\n if (\n !t.isVariableDeclaration(statement) &&\n !(t.isExportNamedDeclaration(statement) && t.isVariableDeclaration(statement.declaration))\n ) {\n continue;\n }\n\n const declarationStatement = t.isVariableDeclaration(statement)\n ? statement\n : (statement.declaration as t.VariableDeclaration);\n\n for (const declaration of declarationStatement.declarations) {\n if (!t.isIdentifier(declaration.id) || !declaration.init) {\n continue;\n }\n\n const stepId = getCreateStepId(declaration.init);\n if (stepId) {\n stepBindings.set(declaration.id.name, stepId);\n }\n }\n }\n\n return stepBindings;\n}\n\n/**\n * Accepts the few AST node shapes we allow as \"step references\" in workflow chains\n * and normalizes them to a single step id string.\n */\nfunction getWorkflowStepName(node: t.Node | null | undefined, stepBindings: Map<string, string>): string | null {\n if (!node) {\n return null;\n }\n\n if (t.isIdentifier(node)) {\n return stepBindings.get(node.name) ?? node.name;\n }\n\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n\n return getCreateStepId(node);\n}\n\n/**\n * Normalizes fluent workflow builder calls into the simpler Temporal runtime shape.\n *\n * Most step references collapse down to step ids so the generated workflow can call\n * activities by id instead of keeping the original `createStep` definitions around.\n */\nfunction rewriteChainMethod(\n method: { name: string; args: t.Node[] },\n filePath: string,\n workflowName: string,\n stepBindings: Map<string, string>,\n): t.Expression[] {\n const argNode = (index: number): t.Node | undefined => method.args[index];\n\n // Each case translates an AST representation of a builder call into the exact\n // argument list expected by our lightweight runtime helper.\n switch (method.name) {\n case 'then': {\n const name = getWorkflowStepName(argNode(0), stepBindings);\n if (!name) {\n throw new Error(\n `.then() in ${workflowName} (${filePath}) must take a step identifier (inline createStep calls are not supported)`,\n );\n }\n return [t.stringLiteral(name)];\n }\n\n case 'sleep': {\n const arg = argNode(0);\n if (t.isNumericLiteral(arg)) {\n return [t.cloneNode(arg, true)];\n }\n const name = getWorkflowStepName(arg, stepBindings);\n if (!name) {\n throw new Error(`.sleep() in ${workflowName} (${filePath}) must be a numeric literal or an identifier`);\n }\n return [t.stringLiteral(name)];\n }\n\n case 'sleepUntil': {\n const arg = argNode(0);\n if (t.isNewExpression(arg) && t.isIdentifier(arg.callee) && arg.callee.name === 'Date') {\n return [t.cloneNode(arg, true)];\n }\n if (t.isStringLiteral(arg) || t.isNumericLiteral(arg)) {\n return [t.cloneNode(arg, true)];\n }\n const name = getWorkflowStepName(arg, stepBindings);\n if (!name) {\n throw new Error(\n `.sleepUntil() in ${workflowName} (${filePath}) must be a Date, string/number literal, or an identifier`,\n );\n }\n return [t.stringLiteral(name)];\n }\n\n case 'parallel': {\n const arg = argNode(0);\n if (!t.isArrayExpression(arg)) {\n throw new Error(`.parallel() in ${workflowName} (${filePath}) requires an array literal argument`);\n }\n const names = arg.elements.map(el => getWorkflowStepName(el, stepBindings));\n if (names.some(n => !n)) {\n throw new Error(`Unable to determine step names inside .parallel() in ${workflowName} (${filePath})`);\n }\n return [t.arrayExpression(names.map(n => t.stringLiteral(n!)))];\n }\n\n case 'branch': {\n const arg = argNode(0);\n if (!t.isArrayExpression(arg)) {\n throw new Error(\n `.branch() in ${workflowName} (${filePath}) requires an array literal of [condition, step] pairs`,\n );\n }\n const pairs = arg.elements.map(pair => {\n if (!t.isArrayExpression(pair) || pair.elements.length !== 2) {\n throw new Error(\n `.branch() pair in ${workflowName} (${filePath}) must be a 2-element array [condition, step]`,\n );\n }\n const condName = getWorkflowStepName(pair.elements[0], stepBindings);\n const stepName = getWorkflowStepName(pair.elements[1], stepBindings);\n if (!condName || !stepName) {\n throw new Error(`.branch() condition and step in ${workflowName} (${filePath}) must be identifiers`);\n }\n return t.arrayExpression([t.stringLiteral(condName), t.stringLiteral(stepName)]);\n });\n return [t.arrayExpression(pairs)];\n }\n\n case 'dowhile':\n case 'dountil': {\n const stepName = getWorkflowStepName(argNode(0), stepBindings);\n const condName = getWorkflowStepName(argNode(1), stepBindings);\n if (!stepName || !condName) {\n throw new Error(`.${method.name}() in ${workflowName} (${filePath}) must take (step, condition) identifiers`);\n }\n return [t.stringLiteral(stepName), t.stringLiteral(condName)];\n }\n\n case 'foreach': {\n const stepName = getWorkflowStepName(argNode(0), stepBindings);\n if (!stepName) {\n throw new Error(`.foreach() in ${workflowName} (${filePath}) must take a step identifier`);\n }\n const args: t.Expression[] = [t.stringLiteral(stepName)];\n const optsArg = method.args[1];\n if (optsArg && t.isExpression(optsArg)) {\n args.push(t.cloneNode(optsArg, true));\n }\n return args;\n }\n\n case 'commit':\n return [];\n\n default:\n throw new Error(`Unsupported workflow chain method .${method.name}() in ${workflowName} (${filePath})`);\n }\n}\n\nfunction getExportedName(node: t.Identifier | t.StringLiteral): string {\n return t.isIdentifier(node) ? node.name : node.value;\n}\n\n/**\n * Materializes one transformed workflow export.\n *\n * Instead of preserving the original `const workflow = createWorkflow(...)` shape,\n * we emit a deterministic exported function whose name matches Temporal's runtime\n * lookup and whose body delegates into the injected helper runtime.\n */\nfunction createTemporalWorkflowStatements(\n exportName: string,\n workflowId: t.Expression,\n methods: { name: string; args: t.Node[] }[],\n filePath: string,\n includeCommit: boolean,\n exportInline: boolean,\n stepBindings: Map<string, string>,\n): t.Statement[] {\n // Start from `createWorkflow(<static id>)` and rebuild the chain one call at a time\n // using normalized arguments from `rewriteChainMethod`.\n let expression: t.Expression = t.callExpression(t.identifier('createWorkflow'), [t.cloneNode(workflowId, true)]);\n\n for (const method of methods) {\n const newArgs = rewriteChainMethod(method, filePath, exportName, stepBindings);\n expression = t.callExpression(t.memberExpression(expression, t.identifier(method.name)), newArgs);\n }\n\n if (includeCommit && !methods.some(m => m.name === 'commit')) {\n expression = t.callExpression(t.memberExpression(expression, t.identifier('commit')), []);\n }\n\n const argsParam = t.identifier('args');\n // Temporal loads workflows by exported symbol name, so we wrap the rebuilt graph\n // in a named exported function instead of leaving the original builder object.\n const lambda = t.arrowFunctionExpression(\n [argsParam],\n t.blockStatement([t.returnStatement(t.callExpression(expression, [t.identifier('args')]))]),\n );\n\n const declaration = t.variableDeclaration('const', [t.variableDeclarator(t.identifier(exportName), lambda)]);\n\n return [exportInline ? t.exportNamedDeclaration(declaration) : declaration];\n}\n\nexport interface BuildTemporalWorkflowOptions {\n /** Reserved for future loader options. */\n}\n\nexport interface TemporalWorkflowExport {\n exportName: string;\n workflowId: string;\n}\n\nexport interface BuildTemporalWorkflowModuleResult {\n code: string;\n workflows: TemporalWorkflowExport[];\n}\n\n/**\n * Rewrites the Mastra entry file into pure re-exports after every workflow module has\n * been transformed and registered. This is why the entry rewrite lives outside the\n * loader's per-file transform path.\n */\nexport async function buildWorkflowEntryModuleFromRegistry(\n sourceText: string,\n filePath: string,\n registry: Map<string, string[]>,\n): Promise<string> {\n const ast = parse(sourceText, {\n sourceType: 'module',\n plugins: parserPlugins as any,\n sourceFilename: filePath,\n });\n\n const workflowBindings = getWorkflowEntryBindings(ast.program);\n const importBindings = getWorkflowImportBindings(ast.program);\n const exportStatements: t.ExportNamedDeclaration[] = [];\n const seenExports = new Set<string>();\n\n for (const workflowBinding of workflowBindings) {\n const importedBinding = importBindings.get(workflowBinding);\n if (!importedBinding) {\n throw new Error(`Unable to find an import for workflow '${workflowBinding}' in ${filePath}`);\n }\n\n const workflowPath = resolveWorkflowPathSync(importedBinding.source, filePath);\n const exportNames = registry.get(workflowPath);\n if (!exportNames || exportNames.length === 0) {\n throw new Error(`Unable to find registered workflow exports for ${workflowPath}`);\n }\n\n for (const exportName of exportNames) {\n const exportKey = `${importedBinding.source}:${exportName}`;\n if (seenExports.has(exportKey)) {\n continue;\n }\n\n seenExports.add(exportKey);\n exportStatements.push(\n t.exportNamedDeclaration(\n null,\n [t.exportSpecifier(t.identifier(exportName), t.identifier(exportName))],\n t.stringLiteral(importedBinding.source),\n ),\n );\n }\n }\n\n return generate(t.file(t.program(exportStatements, [], 'module')), {\n sourceMaps: false,\n }).code;\n}\n\nfunction parseWorkflowModuleAst(sourceText: string, filePath: string): t.File {\n return parse(sourceText, {\n sourceType: 'module',\n plugins: parserPlugins as any,\n sourceFilename: filePath,\n });\n}\n\nfunction getVariableDeclarationFromStatement(statement: t.Statement): t.VariableDeclaration | null {\n if (t.isVariableDeclaration(statement)) {\n return statement;\n }\n\n if (t.isExportNamedDeclaration(statement) && t.isVariableDeclaration(statement.declaration)) {\n return statement.declaration;\n }\n\n return null;\n}\n\nfunction getCommittedWorkflowName(statement: t.Statement): string | null {\n if (!t.isExpressionStatement(statement)) {\n return null;\n }\n\n const { expression } = statement;\n if (\n !t.isCallExpression(expression) ||\n !t.isMemberExpression(expression.callee) ||\n expression.callee.computed ||\n !isIdentifierNamed(expression.callee.property, 'commit') ||\n !t.isIdentifier(expression.callee.object)\n ) {\n return null;\n }\n\n return expression.callee.object.name;\n}\n\ninterface WorkflowTransformState {\n statements: t.Statement[];\n workflowNames: Set<string>;\n generatedWorkflowNames: Set<string>;\n committedWorkflowNames: Set<string>;\n committedGeneratedWorkflowNames: Set<string>;\n inlineExportedWorkflowNames: Set<string>;\n strippedNames: Set<string>;\n stepBindings: Map<string, string>;\n workflowExports: TemporalWorkflowExport[];\n}\n\nfunction createWorkflowTransformState(program: t.Program): WorkflowTransformState {\n return {\n statements: [...createTemporalWorkflowHelperStatements()],\n workflowNames: new Set<string>(),\n generatedWorkflowNames: new Set<string>(),\n committedWorkflowNames: new Set<string>(),\n committedGeneratedWorkflowNames: new Set<string>(),\n inlineExportedWorkflowNames: new Set<string>(),\n strippedNames: new Set<string>(),\n stepBindings: collectStepBindings(program),\n workflowExports: [],\n };\n}\n\nfunction collectWorkflowDeclarationMetadata(statement: t.Statement, state: WorkflowTransformState): void {\n const declarationStatement = getVariableDeclarationFromStatement(statement);\n if (!declarationStatement) {\n return;\n }\n\n for (const declaration of declarationStatement.declarations) {\n if (!t.isIdentifier(declaration.id) || !declaration.init) {\n continue;\n }\n\n if (!parseWorkflowChain(declaration.init)) {\n continue;\n }\n\n state.workflowNames.add(declaration.id.name);\n if (t.isExportNamedDeclaration(statement)) {\n state.inlineExportedWorkflowNames.add(declaration.id.name);\n }\n }\n}\n\nfunction collectWorkflowExportMetadata(statement: t.Statement, state: WorkflowTransformState): void {\n if (t.isExportNamedDeclaration(statement) && statement.declaration == null && statement.source == null) {\n for (const specifier of statement.specifiers) {\n if (!t.isExportSpecifier(specifier) || !t.isIdentifier(specifier.local)) {\n continue;\n }\n\n if (!state.workflowNames.has(specifier.local.name)) {\n continue;\n }\n\n if (getExportedName(specifier.exported) === specifier.local.name) {\n state.inlineExportedWorkflowNames.add(specifier.local.name);\n }\n }\n }\n}\n\nfunction collectWorkflowTransformMetadata(program: t.Program, state: WorkflowTransformState): void {\n for (const statement of program.body) {\n collectWorkflowDeclarationMetadata(statement, state);\n\n const committedWorkflowName = getCommittedWorkflowName(statement);\n if (committedWorkflowName) {\n state.committedWorkflowNames.add(committedWorkflowName);\n }\n\n collectWorkflowExportMetadata(statement, state);\n }\n}\n\nfunction rewriteWorkflowImportDeclaration(statement: t.ImportDeclaration, state: WorkflowTransformState): void {\n if (statement.source.value === '@mastra/core/workflows') {\n const retainedSpecifiers = statement.specifiers.filter(\n specifier =>\n !(\n t.isImportSpecifier(specifier) &&\n t.isIdentifier(specifier.imported) &&\n (specifier.imported.name === 'createWorkflow' || specifier.imported.name === 'createStep')\n ),\n );\n\n if (retainedSpecifiers.length > 0) {\n state.statements.push(t.importDeclaration(retainedSpecifiers, t.stringLiteral(statement.source.value)));\n }\n return;\n }\n\n if (isTemporalHelperModule(statement.source.value) || isStrippedExternalModule(statement.source.value)) {\n for (const name of collectImportedNames(statement)) {\n state.strippedNames.add(name);\n }\n return;\n }\n\n state.statements.push(statement);\n}\n\nfunction rewriteWorkflowNamedExport(statement: t.ExportNamedDeclaration, state: WorkflowTransformState): void {\n if (statement.source != null) {\n state.statements.push(statement);\n return;\n }\n\n const retainedSpecifiers = statement.specifiers.filter(specifier => {\n if (!t.isExportSpecifier(specifier) || !t.isIdentifier(specifier.local)) {\n return true;\n }\n\n if (!state.workflowNames.has(specifier.local.name)) {\n return true;\n }\n\n return getExportedName(specifier.exported) !== specifier.local.name;\n });\n\n if (retainedSpecifiers.length > 0) {\n state.statements.push(t.exportNamedDeclaration(null, retainedSpecifiers));\n }\n}\n\nfunction rewriteWorkflowVariableDeclaration(\n statement: t.Statement,\n filePath: string,\n state: WorkflowTransformState,\n): void {\n const declarationStatement = getVariableDeclarationFromStatement(statement);\n if (!declarationStatement) {\n return;\n }\n\n const declarations: t.VariableDeclarator[] = [];\n\n for (const declaration of declarationStatement.declarations) {\n if (isWorkflowHelperDestructure(declaration)) {\n continue;\n }\n\n if (t.isIdentifier(declaration.id) && state.stepBindings.has(declaration.id.name)) {\n state.strippedNames.add(declaration.id.name);\n continue;\n }\n\n if (!t.isIdentifier(declaration.id) || !declaration.init) {\n declarations.push(declaration);\n continue;\n }\n\n // If this initializer is a workflow builder chain, convert it into a new\n // exported runtime function. Otherwise keep it as-is unless it only exists\n // to support stripped `createStep` code.\n const workflowChain = parseWorkflowChain(declaration.init);\n if (!workflowChain && nodeReferencesName(declaration.init, state.strippedNames)) {\n state.strippedNames.add(declaration.id.name);\n continue;\n }\n\n if (!workflowChain) {\n declarations.push(declaration);\n continue;\n }\n\n const [workflowConfig] = workflowChain.createWorkflowCall.arguments;\n if (!workflowConfig || !t.isObjectExpression(workflowConfig)) {\n throw new Error(`Unable to determine workflow config for ${declaration.id.name} in ${filePath}`);\n }\n\n const { expression: workflowId, workflowId: workflowIdValue } = getWorkflowIdMetadata(\n workflowConfig,\n declaration.id.name,\n filePath,\n );\n // The source binding name is irrelevant at runtime. Temporal looks up the\n // workflow by type, so we derive the exported symbol from the static id.\n const exportName = toWorkflowType(workflowIdValue);\n\n state.generatedWorkflowNames.add(exportName);\n if (state.committedWorkflowNames.has(declaration.id.name)) {\n state.committedGeneratedWorkflowNames.add(exportName);\n }\n state.workflowExports.push({\n exportName,\n workflowId: workflowIdValue,\n });\n state.statements.push(\n ...createTemporalWorkflowStatements(\n exportName,\n workflowId,\n workflowChain.methods,\n filePath,\n state.committedWorkflowNames.has(declaration.id.name),\n t.isExportNamedDeclaration(statement) || state.inlineExportedWorkflowNames.has(declaration.id.name),\n state.stepBindings,\n ),\n );\n }\n\n if (declarations.length > 0) {\n const cloned = declarations.map(declaration => t.cloneNode(declaration, true));\n state.statements.push(\n t.isVariableDeclaration(statement)\n ? t.variableDeclaration(statement.kind, cloned)\n : t.exportNamedDeclaration(t.variableDeclaration(declarationStatement.kind, cloned)),\n );\n }\n}\n\nfunction rewriteWorkflowStatement(statement: t.Statement, filePath: string, state: WorkflowTransformState): void {\n if (t.isImportDeclaration(statement)) {\n rewriteWorkflowImportDeclaration(statement, state);\n return;\n }\n\n if (getCommittedWorkflowName(statement)) {\n return;\n }\n\n if (t.isExportNamedDeclaration(statement) && statement.declaration == null) {\n rewriteWorkflowNamedExport(statement, state);\n return;\n }\n\n if (t.isExportDefaultDeclaration(statement) && t.isIdentifier(statement.declaration)) {\n if (state.workflowNames.has(statement.declaration.name)) {\n state.statements.push(statement);\n }\n return;\n }\n\n if (getVariableDeclarationFromStatement(statement)) {\n rewriteWorkflowVariableDeclaration(statement, filePath, state);\n return;\n }\n\n state.statements.push(statement);\n}\n\nfunction appendMissingWorkflowCommits(state: WorkflowTransformState): void {\n for (const workflowName of state.generatedWorkflowNames) {\n if (state.committedGeneratedWorkflowNames.has(workflowName)) {\n continue;\n }\n\n state.statements.push(\n t.expressionStatement(\n t.callExpression(t.memberExpression(t.identifier(workflowName), t.identifier('commit')), []),\n ),\n );\n }\n}\n\nasync function finalizeWorkflowModule(\n filePath: string,\n state: WorkflowTransformState,\n): Promise<BuildTemporalWorkflowModuleResult> {\n const transformedSource = generate(t.file(t.program(pruneUnusedTopLevelBindings(state.statements), [], 'module')), {\n sourceMaps: false,\n }).code;\n\n return {\n code: await transpileModule(transformedSource, filePath),\n workflows: state.workflowExports,\n };\n}\n\n/**\n * Transforms a user-authored workflow module into a Temporal-friendly module:\n * - strips Mastra/Temporal setup that cannot run in the workflow sandbox\n * - rewrites fluent workflow chains into deterministic exported functions\n * - returns registry metadata so the entry module can re-export the right names\n */\nexport async function buildTemporalWorkflowModule(\n sourceText: string,\n filePath: string,\n _options: BuildTemporalWorkflowOptions = {},\n): Promise<BuildTemporalWorkflowModuleResult> {\n const ast = parseWorkflowModuleAst(sourceText, filePath);\n const state = createWorkflowTransformState(ast.program);\n\n collectWorkflowTransformMetadata(ast.program, state);\n\n for (const statement of ast.program.body) {\n // We rewrite only the top-level workflow declarations/exports and keep unrelated\n // module code intact unless it becomes dead after step/workflow stripping.\n rewriteWorkflowStatement(statement, filePath, state);\n }\n\n appendMissingWorkflowCommits(state);\n return finalizeWorkflowModule(filePath, state);\n}\n\n/**\n * Reads only the workflow imports that are referenced from the Mastra entry's\n * `workflows` config. Plain imports in the file are not enough on their own.\n */\nfunction getWorkflowImportSpecifiers(sourceText: string, filePath: string): string[] {\n const ast = parse(sourceText, {\n sourceType: 'module',\n plugins: parserPlugins as any,\n sourceFilename: filePath,\n });\n\n // First find which local bindings the Mastra config actually registers as workflows,\n // then resolve those bindings back to their import sources.\n const workflowBindings = getWorkflowEntryBindings(ast.program);\n const importBindings = getWorkflowImportBindings(ast.program);\n const workflowSpecifiers: string[] = [];\n\n for (const workflowBinding of workflowBindings) {\n const importedBinding = importBindings.get(workflowBinding);\n if (!importedBinding) {\n throw new Error(`Unable to find an import for workflow '${workflowBinding}' in ${filePath}`);\n }\n\n workflowSpecifiers.push(importedBinding.source);\n }\n\n return [...new Set(workflowSpecifiers)];\n}\n\nfunction getWorkflowPathCandidates(specifier: string, importerPath: string): string[] {\n const basePath = path.resolve(path.dirname(importerPath), specifier);\n\n return [\n basePath,\n `${basePath}.ts`,\n `${basePath}.tsx`,\n `${basePath}.js`,\n `${basePath}.jsx`,\n `${basePath}.mts`,\n `${basePath}.mjs`,\n path.join(basePath, 'index.ts'),\n path.join(basePath, 'index.tsx'),\n path.join(basePath, 'index.js'),\n path.join(basePath, 'index.jsx'),\n path.join(basePath, 'index.mts'),\n path.join(basePath, 'index.mjs'),\n ];\n}\n\nexport function resolveWorkflowPathSync(specifier: string, importerPath: string): string {\n for (const candidate of getWorkflowPathCandidates(specifier, importerPath)) {\n try {\n if (statSync(candidate).isFile()) {\n return candidate;\n }\n } catch {\n // try next candidate\n }\n }\n\n throw new Error(`Unable to resolve workflow import '${specifier}' from ${importerPath}`);\n}\n\nexport async function resolveWorkflowPath(specifier: string, importerPath: string): Promise<string> {\n const { stat } = await import('node:fs/promises');\n\n for (const candidate of getWorkflowPathCandidates(specifier, importerPath)) {\n try {\n const stats = await stat(candidate);\n if (stats.isFile()) {\n return candidate;\n }\n } catch {\n // try next candidate\n }\n }\n\n throw new Error(`Unable to resolve workflow import '${specifier}' from ${importerPath}`);\n}\n\nexport function resolveWorkflowEntriesSync(sourceText: string, filePath: string): string[] {\n return getWorkflowImportSpecifiers(sourceText, filePath).map(specifier =>\n resolveWorkflowPathSync(specifier, filePath),\n );\n}\n\nexport async function resolveWorkflowEntries(sourceText: string, filePath: string): Promise<string[]> {\n return Promise.all(\n getWorkflowImportSpecifiers(sourceText, filePath).map(specifier => resolveWorkflowPath(specifier, filePath)),\n );\n}\n","export function toWorkflowType(id: string) {\n const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char: string) => char.toUpperCase());\n return camelCased.endsWith('Workflow') ? camelCased : `${camelCased}Workflow`;\n}\n","import path from 'node:path';\nimport * as t from '@babel/types';\nimport { transform as esbuildTransform } from 'esbuild';\n\nexport const parserPlugins = [\n 'typescript',\n 'jsx',\n 'classProperties',\n 'classPrivateProperties',\n 'classPrivateMethods',\n 'topLevelAwait',\n 'importAttributes',\n 'decorators-legacy',\n] as const;\n\nexport interface WorkflowImportBinding {\n exportName: string;\n importedName: string | 'default';\n source: string;\n}\n\nexport function isIdentifierNamed(node: t.Node, name: string): boolean {\n return t.isIdentifier(node) && node.name === name;\n}\n\nexport function isTemporalHelperModule(source: string): boolean {\n return typeof source === 'string' && /(^|\\/)temporal\\.(ts|tsx|js|jsx|mts|mjs)?$/.test(source);\n}\n\nexport const strippedExternalModules = new Set(['@temporalio/client', '@temporalio/envconfig']);\n\nexport function isStrippedExternalModule(source: string): boolean {\n return typeof source === 'string' && strippedExternalModules.has(source);\n}\n\nexport function collectImportedNames(statement: t.ImportDeclaration): Set<string> {\n const names = new Set<string>();\n\n for (const specifier of statement.specifiers) {\n if (\n t.isImportDefaultSpecifier(specifier) ||\n t.isImportNamespaceSpecifier(specifier) ||\n t.isImportSpecifier(specifier)\n ) {\n if (t.isIdentifier(specifier.local)) {\n names.add(specifier.local.name);\n }\n }\n }\n\n return names;\n}\n\nexport function nodeReferencesName(node: t.Node, names: Set<string>): boolean {\n let found = false;\n\n walk(node, current => {\n if (t.isIdentifier(current) && names.has(current.name)) {\n found = true;\n return false;\n }\n });\n\n return found;\n}\n\nexport function isWorkflowHelperDestructure(declaration: t.VariableDeclarator): boolean {\n if (!t.isObjectPattern(declaration.id)) {\n return false;\n }\n\n return declaration.id.properties.some(\n property =>\n t.isObjectProperty(property) &&\n !property.computed &&\n t.isIdentifier(property.value) &&\n (property.value.name === 'createStep' || property.value.name === 'createWorkflow'),\n );\n}\n\nexport function isCreateWorkflowCall(node: t.Node): node is t.CallExpression {\n return t.isCallExpression(node) && isIdentifierNamed(node.callee, 'createWorkflow');\n}\n\nexport function isCreateStepCall(node: t.Node): node is t.CallExpression {\n return t.isCallExpression(node) && isIdentifierNamed(node.callee, 'createStep');\n}\n\nexport function getObjectPropertyName(property: t.ObjectProperty | t.ObjectMethod): string | null {\n if (property.computed) {\n return null;\n }\n\n if (t.isIdentifier(property.key)) {\n return property.key.name;\n }\n\n if (t.isStringLiteral(property.key)) {\n return property.key.value;\n }\n\n return null;\n}\n\nexport function walk(node: t.Node | null | undefined, visitor: (node: t.Node) => false | void): void {\n if (!node) {\n return;\n }\n\n const result = visitor(node);\n if (result === false) {\n return;\n }\n\n const keys = (t.VISITOR_KEYS as Record<string, string[]>)[node.type] ?? [];\n for (const key of keys) {\n const value = (node as unknown as Record<string, unknown>)[key];\n\n if (Array.isArray(value)) {\n for (const child of value) {\n if (child && typeof (child as t.Node).type === 'string') {\n walk(child as t.Node, visitor);\n }\n }\n continue;\n }\n\n if (value && typeof (value as t.Node).type === 'string') {\n walk(value as t.Node, visitor);\n }\n }\n}\n\nexport function hasCreateWorkflowCall(node: t.Node): boolean {\n let found = false;\n\n walk(node, current => {\n if (isCreateWorkflowCall(current)) {\n found = true;\n return false;\n }\n });\n\n return found;\n}\n\nexport function getStepNameFromCall(node: t.CallExpression): string | null {\n const stepId = getCreateStepId(node);\n if (!stepId) {\n return null;\n }\n\n return stepId\n .replace(/[^a-zA-Z0-9]+(.)/g, (_match, char: string) => char.toUpperCase())\n .replace(/^[^a-zA-Z_$]+/, '')\n .replace(/^(.)/, (char: string) => char.toLowerCase());\n}\n\nexport function createExportedStepStatement(name: string, initializer: t.Expression): t.ExportNamedDeclaration {\n return t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(name), t.cloneNode(initializer, true))]),\n );\n}\n\nexport function collectInlineCreateSteps(node: t.Node, seenNames: Set<string>, statements: t.Statement[]): void {\n walk(node, current => {\n if (!isCreateStepCall(current)) {\n return;\n }\n\n const stepName = getStepNameFromCall(current);\n if (!stepName || seenNames.has(stepName)) {\n return false;\n }\n\n seenNames.add(stepName);\n statements.push(createExportedStepStatement(stepName, current));\n return false;\n });\n}\n\nexport async function transpileModule(sourceText: string, filePath: string): Promise<string> {\n const loader = path.extname(filePath).slice(1) || 'js';\n const { code } = await esbuildTransform(sourceText, {\n loader: loader as any,\n format: 'esm',\n platform: 'node',\n target: 'node22',\n sourcemap: false,\n sourcefile: filePath,\n });\n\n return code ?? '';\n}\n\nexport function getCreateStepId(node: t.Node | null | undefined): string | null {\n if (!node || !isCreateStepCall(node)) {\n return null;\n }\n\n const [config] = node.arguments;\n if (!t.isObjectExpression(config)) {\n return null;\n }\n\n for (const property of config.properties) {\n if (!t.isObjectProperty(property) && !t.isObjectMethod(property)) {\n continue;\n }\n\n if (getObjectPropertyName(property) !== 'id') {\n continue;\n }\n\n const value = t.isObjectMethod(property) ? null : property.value;\n return t.isStringLiteral(value) ? value.value : null;\n }\n\n return null;\n}\n\nexport function shouldCountIdentifierAsReference(parent: t.Node | null, key: string | null): boolean {\n if (!parent) {\n return true;\n }\n\n if ((t.isObjectProperty(parent) || t.isObjectMethod(parent)) && key === 'key' && !parent.computed) {\n return false;\n }\n\n if (t.isMemberExpression(parent) && key === 'property' && !parent.computed) {\n return false;\n }\n\n if (t.isVariableDeclarator(parent) && key === 'id') {\n return false;\n }\n\n if (\n (t.isFunctionDeclaration(parent) || t.isFunctionExpression(parent) || t.isArrowFunctionExpression(parent)) &&\n key === 'params'\n ) {\n return false;\n }\n\n if (\n (t.isFunctionDeclaration(parent) || t.isFunctionExpression(parent) || t.isClassDeclaration(parent)) &&\n key === 'id'\n ) {\n return false;\n }\n\n if (\n (t.isImportSpecifier(parent) || t.isImportDefaultSpecifier(parent) || t.isImportNamespaceSpecifier(parent)) &&\n (key === 'local' || key === 'imported')\n ) {\n return false;\n }\n\n if (t.isExportSpecifier(parent) && key === 'exported') {\n return false;\n }\n\n if (t.isLabeledStatement(parent) && key === 'label') {\n return false;\n }\n\n if (t.isCatchClause(parent) && key === 'param') {\n return false;\n }\n\n if (t.isRestElement(parent) && key === 'argument') {\n return false;\n }\n\n if (t.isAssignmentPattern(parent) && key === 'left') {\n return false;\n }\n\n if (t.isTSPropertySignature(parent) || t.isTSMethodSignature(parent) || t.isTSExpressionWithTypeArguments(parent)) {\n return false;\n }\n\n return true;\n}\n\nexport function collectRuntimeReferencedIdentifiers(node: t.Node): Set<string> {\n const refs = new Set<string>();\n\n const visit = (current: t.Node | null | undefined, parent: t.Node | null, key: string | null) => {\n if (!current) {\n return;\n }\n\n if (current.type.startsWith('TS')) {\n return;\n }\n\n if (t.isIdentifier(current)) {\n if (shouldCountIdentifierAsReference(parent, key)) {\n refs.add(current.name);\n }\n return;\n }\n\n for (const visitorKey of t.VISITOR_KEYS[current.type] ?? []) {\n const value = (current as unknown as Record<string, unknown>)[visitorKey];\n if (Array.isArray(value)) {\n value.forEach(child => {\n if (t.isNode(child)) {\n visit(child, current, visitorKey);\n }\n });\n continue;\n }\n\n if (t.isNode(value)) {\n visit(value, current, visitorKey);\n }\n }\n };\n\n visit(node, null, null);\n return refs;\n}\n\nexport function pruneUnusedTopLevelBindings(statements: t.Statement[]): t.Statement[] {\n const bindings = new Map<string, { refs: Set<string>; statementIndex: number }>();\n const liveStatements = new Set<number>();\n const queue: number[] = [];\n\n const markLive = (statementIndex: number) => {\n if (liveStatements.has(statementIndex)) {\n return;\n }\n\n liveStatements.add(statementIndex);\n queue.push(statementIndex);\n };\n\n statements.forEach((statement, statementIndex) => {\n if (t.isImportDeclaration(statement)) {\n for (const specifier of statement.specifiers) {\n bindings.set(specifier.local.name, { refs: new Set(), statementIndex });\n }\n return;\n }\n\n if (t.isVariableDeclaration(statement)) {\n for (const declaration of statement.declarations) {\n if (t.isIdentifier(declaration.id)) {\n bindings.set(declaration.id.name, {\n refs: declaration.init ? collectRuntimeReferencedIdentifiers(declaration.init) : new Set(),\n statementIndex,\n });\n }\n }\n return;\n }\n\n if (t.isExportNamedDeclaration(statement) && t.isVariableDeclaration(statement.declaration)) {\n for (const declaration of statement.declaration.declarations) {\n if (t.isIdentifier(declaration.id)) {\n bindings.set(declaration.id.name, {\n refs: declaration.init ? collectRuntimeReferencedIdentifiers(declaration.init) : new Set(),\n statementIndex,\n });\n }\n }\n markLive(statementIndex);\n return;\n }\n\n markLive(statementIndex);\n });\n\n while (queue.length > 0) {\n const statementIndex = queue.pop()!;\n const statement = statements[statementIndex];\n if (!statement) {\n continue;\n }\n\n const refs = new Set<string>();\n\n if (t.isImportDeclaration(statement)) {\n continue;\n }\n\n if (t.isVariableDeclaration(statement)) {\n for (const declaration of statement.declarations) {\n if (declaration.init) {\n for (const ref of collectRuntimeReferencedIdentifiers(declaration.init)) {\n refs.add(ref);\n }\n }\n }\n } else if (t.isExportNamedDeclaration(statement) && t.isVariableDeclaration(statement.declaration)) {\n for (const declaration of statement.declaration.declarations) {\n if (declaration.init) {\n for (const ref of collectRuntimeReferencedIdentifiers(declaration.init)) {\n refs.add(ref);\n }\n }\n }\n } else {\n for (const ref of collectRuntimeReferencedIdentifiers(statement)) {\n refs.add(ref);\n }\n }\n\n for (const ref of refs) {\n const binding = bindings.get(ref);\n if (binding) {\n markLive(binding.statementIndex);\n }\n }\n }\n\n const prunedStatements: t.Statement[] = [];\n\n statements.forEach((statement, statementIndex) => {\n if (!liveStatements.has(statementIndex)) {\n return;\n }\n\n if (t.isImportDeclaration(statement)) {\n const specifiers = statement.specifiers.filter(specifier =>\n liveStatements.has(bindings.get(specifier.local.name)?.statementIndex ?? -1),\n );\n if (specifiers.length > 0) {\n prunedStatements.push(t.importDeclaration(specifiers, statement.source));\n }\n return;\n }\n\n if (t.isVariableDeclaration(statement)) {\n const declarations = statement.declarations.filter(\n declaration =>\n !t.isIdentifier(declaration.id) ||\n liveStatements.has(bindings.get(declaration.id.name)?.statementIndex ?? -1),\n );\n if (declarations.length > 0) {\n prunedStatements.push(t.variableDeclaration(statement.kind, declarations));\n }\n return;\n }\n\n if (t.isExportNamedDeclaration(statement) && t.isVariableDeclaration(statement.declaration)) {\n const declarations = statement.declaration.declarations.filter(\n declaration =>\n !t.isIdentifier(declaration.id) ||\n liveStatements.has(bindings.get(declaration.id.name)?.statementIndex ?? -1),\n );\n if (declarations.length > 0) {\n prunedStatements.push(\n t.exportNamedDeclaration(t.variableDeclaration(statement.declaration.kind, declarations)),\n );\n }\n return;\n }\n\n prunedStatements.push(statement);\n });\n\n return prunedStatements;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAiC;AACjC,IAAAA,oBAAiB;;;ACDjB,qBAAuC;AACvC,IAAAC,oBAAiB;AACjB,uBAAyB;AACzB,oBAAsB;AACtB,IAAAC,KAAmB;;;ACJZ,SAAS,eAAe,IAAY;AACzC,QAAM,aAAa,GAAG,QAAQ,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EACF;AAEA,QAAM,UAAU,QAAQ,YAAY,kBAAAC,QAAK,QAAQ,QAAQ,SAAS,IAAI,QAAQ,IAAI;AAClF,QAAM,eAAe,kBAAAA,QAAK,SAAS,SAAS,YAAY;AACxD,QAAM,mBAAmB,aAAa,WAAW,IAAI,IAAI,kBAAAA,QAAK,SAAS,YAAY,IAAI;AACvF,QAAM,aAAa,kBAAAA,QAAK,KAAK,QAAQ,gBAAgB,WAAW,gBAAgB;AAEhF,YAAM,uBAAM,kBAAAA,QAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AACzD,YAAM,2BAAU,YAAY,MAAM,OAAO;AAC3C;AAEe,SAAR,6BAAyD,QAAsB;AACpF,QAAM,WAAW,KAAK,MAAM;AAC5B,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AAEA,QAAM,UAAuC,KAAK,aAAa,KAAK,CAAC;AAErE,MAAI,CAAC,OAAO,SAAS,gBAAgB,GAAG;AACtC,WAAO,SAAS,MAAM,MAAM;AAAA,EAC9B;AAEA,QAAM,YAAY,YAA6B;AAC7C,UAAM,SAAS,MAAM,4BAA4B,QAAQ,KAAK,cAAc,OAAO;AACnF,YAAQ,UAAU;AAAA,MAChB,KAAK;AAAA,MACL,OAAO,UAAU,IAAI,cAAY,SAAS,UAAU;AAAA,IACtD;AACA,WAAO,OAAO;AAAA,EAChB;AAEA,YAAU,EACP,KAAK,OAAM,SAAQ;AAClB,UAAM,iBAAiB,KAAK,cAAc,MAAM,OAAO;AACvD,aAAS,MAAM,IAAI;AAAA,EACrB,CAAC,EACA,MAAM,CAAC,QAAiB,SAAS,GAAG,CAAC;AAC1C;","names":["import_node_path","import_node_path","t","path","esbuildTransform","program","program","path"]}
@@ -1,8 +0,0 @@
1
- import type { WorkflowExportRegistry } from './webpack-plugin.js';
2
- export interface MastraTemporalLoaderOptions {
3
- entryFile?: string;
4
- debugOutputDir?: string | null;
5
- registry?: WorkflowExportRegistry;
6
- }
7
- export default function mastraTemporalWorkflowLoader(this: any, source: string): void;
8
- //# sourceMappingURL=webpack-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-loader.d.ts","sourceRoot":"","sources":["../src/webpack-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACnC;AAoBD,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA2BpF"}
@@ -1,18 +0,0 @@
1
- import type { Compiler } from 'webpack';
2
- export declare class WorkflowExportRegistry {
3
- private readonly exportsByFile;
4
- register(filePath: string, exportNames: string[]): void;
5
- get(filePath: string): string[] | undefined;
6
- asMap(): Map<string, string[]>;
7
- }
8
- export interface MastraWorkflowEntryPluginOptions {
9
- entryFile: string;
10
- registry: WorkflowExportRegistry;
11
- debugOutputDir?: string | null;
12
- }
13
- export declare class MastraWorkflowEntryPlugin {
14
- private readonly options;
15
- constructor(options: MastraWorkflowEntryPluginOptions);
16
- apply(compiler: Compiler): void;
17
- }
18
- //# sourceMappingURL=webpack-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-plugin.d.ts","sourceRoot":"","sources":["../src/webpack-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAU,MAAM,SAAS,CAAC;AAmChD,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+B;IAE7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI;IAQvD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAI3C,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAG/B;AAED,MAAM,WAAW,gCAAgC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,qBAAa,yBAAyB;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,gCAAgC;IAEtE,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAsChC"}