@@ -79,6 +79,47 @@ type ExportedDeclarationResolution = {
7979 importBindings : Map < string , { imported : string ; resolvedId : string | null } > ;
8080} ;
8181
82+ /**
83+ * Parse the source, resolve the configured clients, and collect everything the
84+ * mutation phase needs without changing the AST.
85+ *
86+ * The returned plan separates the discovered work into concrete buckets:
87+ * - `clients`: bindings for discovered client variables
88+ * - `namedUsages`: matched client method calls that already have a local client
89+ * - `inlineUsages`: inline `createAPIClient(...)` call sites that need rewrite
90+ *
91+ * The plan also carries the bookkeeping needed by the mutator to insert
92+ * imports, generate optimized clients, and clean up dead declarations.
93+ *
94+ * @example
95+ * ```ts
96+ * const plan = await createTransformPlan(source, id, options);
97+ *
98+ * plan.clients[0]
99+ * // {
100+ * // name: 'api',
101+ * // mode: { type: 'context' },
102+ * // ...
103+ * // }
104+ *
105+ * plan.namedUsages[0]
106+ * // {
107+ * // client: { name: 'api' },
108+ * // serviceName: 'pets',
109+ * // operationName: 'getPets',
110+ * // callbackName: 'useQuery',
111+ * // ...
112+ * // }
113+ *
114+ * plan.inlineUsages[0]
115+ * // {
116+ * // callbackName: 'invalidateQueries',
117+ * // callbackLocalName: 'invalidateQueries',
118+ * // operationImport: { importPath: './api/services/PetsService' },
119+ * // ...
120+ * // }
121+ * ```
122+ */
82123export async function createTransformPlan (
83124 code : string ,
84125 id : string ,
0 commit comments