{"version":3,"file":"workflow-stream-vnext.mjs","names":[],"sources":["../../../src/codemods/v1/workflow-stream-vnext.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\n\n/**\n * Transforms workflow run VNext methods to their standard names:\n * - run.streamVNext() → run.stream()\n * - run.resumeStreamVNext() → run.resumeStream()\n * - run.observeStreamVNext() → run.observeStream()\n *\n * These methods are called on the result of workflow.createRun().\n */\nexport default createTransformer((fileInfo, api, options, context) => {\n  const { j, root } = context;\n\n  // Map of old method names to new method names\n  const methodRenames: Record<string, string> = {\n    streamVNext: 'stream',\n    resumeStreamVNext: 'resumeStream',\n    observeStreamVNext: 'observeStream',\n  };\n\n  let count = 0;\n\n  // Find all call expressions and rename VNext methods\n  // These method names are unique enough to Mastra workflow runs\n  // that we can safely rename them globally\n  root.find(j.CallExpression).forEach(path => {\n    const { callee } = path.value;\n    if (callee.type !== 'MemberExpression') return;\n    if (callee.property.type !== 'Identifier') return;\n\n    const oldName = callee.property.name;\n    if (!Object.hasOwn(methodRenames, oldName)) return;\n\n    const newName = methodRenames[oldName];\n    if (newName) {\n      callee.property.name = newName;\n      count++;\n    }\n  });\n\n  if (count > 0) {\n    context.hasChanges = true;\n    context.messages.push(\n      `Renamed workflow run VNext methods: streamVNext/resumeStreamVNext/observeStreamVNext → stream/resumeStream/observeStream`,\n    );\n  }\n});\n"],"mappings":";;;;;;;;;;AAUA,IAAA,gCAAe,mBAAmB,UAAU,KAAK,SAAS,YAAY;CACpE,MAAM,EAAE,GAAG,SAAS;CAGpB,MAAM,gBAAwC;EAC5C,aAAa;EACb,mBAAmB;EACnB,oBAAoB;CACtB;CAEA,IAAI,QAAQ;CAKZ,KAAK,KAAK,EAAE,cAAc,CAAC,CAAC,SAAQ,SAAQ;EAC1C,MAAM,EAAE,WAAW,KAAK;EACxB,IAAI,OAAO,SAAS,oBAAoB;EACxC,IAAI,OAAO,SAAS,SAAS,cAAc;EAE3C,MAAM,UAAU,OAAO,SAAS;EAChC,IAAI,CAAC,OAAO,OAAO,eAAe,OAAO,GAAG;EAE5C,MAAM,UAAU,cAAc;EAC9B,IAAI,SAAS;GACX,OAAO,SAAS,OAAO;GACvB;EACF;CACF,CAAC;CAED,IAAI,QAAQ,GAAG;EACb,QAAQ,aAAa;EACrB,QAAQ,SAAS,KACf,0HACF;CACF;AACF,CAAC"}