{"version":3,"file":"mastra-plural-apis.mjs","names":[],"sources":["../../../src/codemods/v1/mastra-plural-apis.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\nimport { trackClassInstances, renameMethods } from '../lib/utils';\n\n/**\n * Renames Mastra plural API methods from get* to list*.\n * This provides a consistent naming convention across all plural APIs.\n *\n * Before:\n * const agents = mastra.getAgents();\n * const workflows = mastra.getWorkflows();\n * const logs = await mastra.getLogs('transportId');\n *\n * After:\n * const agents = mastra.listAgents();\n * const workflows = mastra.listWorkflows();\n * const logs = await mastra.listLogs('transportId');\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    getAgents: 'listAgents',\n    getVectors: 'listVectors',\n    getWorkflows: 'listWorkflows',\n    getScorers: 'listScorers',\n    getMCPServers: 'listMCPServers',\n    getLogsByRunId: 'listLogsByRunId',\n    getLogs: 'listLogs',\n  };\n\n  // Track Mastra instances and rename all methods in a single optimized pass\n  const mastraInstances = trackClassInstances(j, root, 'Mastra');\n  const count = renameMethods(j, root, mastraInstances, methodRenames);\n\n  if (count > 0) {\n    context.hasChanges = true;\n    context.messages.push('Renamed Mastra plural API methods from get* to list*');\n  }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAA,6BAAe,mBAAmB,WAAW,MAAM,UAAU,YAAY;CACvE,MAAM,EAAE,GAAG,SAAS;CAiBpB,IAFc,cAAc,GAAG,MADP,oBAAoB,GAAG,MAAM,QACF,GAAG;EAXpD,WAAW;EACX,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,eAAe;EACf,gBAAgB;EAChB,SAAS;CAKuD,CAE1D,IAAI,GAAG;EACb,QAAQ,aAAa;EACrB,QAAQ,SAAS,KAAK,sDAAsD;CAC9E;AACF,CAAC"}