Skip to content

Commit 34bec67

Browse files
committed
refactor: clean up plugin node methods
1 parent e552086 commit 34bec67

File tree

29 files changed

+80
-77
lines changed

29 files changed

+80
-77
lines changed

packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const generateAngularClassRequests = ({
156156
),
157157
)
158158
.do(...currentClass.nodes);
159-
plugin.addNode(node);
159+
plugin.node(node);
160160

161161
generatedClasses.add(currentClass.className);
162162
};
@@ -195,7 +195,7 @@ const generateAngularFunctionRequests = ({
195195
plugin,
196196
symbol,
197197
});
198-
plugin.addNode(node);
198+
plugin.node(node);
199199
},
200200
{
201201
order: 'declarations',

packages/openapi-ts/src/plugins/@angular/common/httpResources.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const generateAngularClassServices = ({
153153
),
154154
)
155155
.do(...currentClass.nodes);
156-
plugin.addNode(node);
156+
plugin.node(node);
157157

158158
generatedClasses.add(currentClass.className);
159159
};
@@ -185,7 +185,7 @@ const generateAngularFunctionServices = ({
185185
plugin,
186186
symbol,
187187
});
188-
plugin.addNode(node);
188+
plugin.node(node);
189189
},
190190
{
191191
order: 'declarations',

packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,5 @@ export const createClient: PluginHandler = ({ plugin }) => {
9999
(c) => c.call(...createConfigParameters),
100100
),
101101
);
102-
plugin.addNode(statement);
102+
plugin.node(statement);
103103
};

packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ export const createClientConfigType = ({
6161
),
6262
),
6363
);
64-
plugin.addNode(typeCreateClientConfig);
64+
plugin.node(typeCreateClientConfig);
6565
};

packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ const schemasV2_0_X = ({
390390
}),
391391
).as('const'),
392392
);
393-
plugin.addNode(statement);
393+
plugin.node(statement);
394394
}
395395
};
396396

@@ -430,7 +430,7 @@ const schemasV3_0_X = ({
430430
}),
431431
).as('const'),
432432
);
433-
plugin.addNode(statement);
433+
plugin.node(statement);
434434
}
435435
};
436436

@@ -470,7 +470,7 @@ const schemasV3_1_X = ({
470470
}),
471471
).as('const'),
472472
);
473-
plugin.addNode(statement);
473+
plugin.node(statement);
474474
}
475475
};
476476

packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export const generateClassSdk = ({
306306
);
307307

308308
const heyApiClientIndex = plugin.config.instance
309-
? plugin.addNode(null)
309+
? plugin.node(null)
310310
: undefined;
311311
const symbolHeyApiClient =
312312
heyApiClientIndex !== undefined
@@ -320,7 +320,7 @@ export const generateClassSdk = ({
320320
})
321321
: undefined;
322322
const heyApiRegistryIndex = plugin.config.instance
323-
? plugin.addNode(null)
323+
? plugin.node(null)
324324
: undefined;
325325

326326
const generateClass = (currentClass: SdkClassEntry) => {
@@ -404,7 +404,7 @@ export const generateClassSdk = ({
404404
plugin,
405405
symbol: symbolHeyApiClient,
406406
});
407-
plugin.updateNode(heyApiClientIndex, node);
407+
plugin.node(node, heyApiClientIndex);
408408
}
409409

410410
const symbol = plugin.symbol(resourceId, {
@@ -465,7 +465,7 @@ export const generateClassSdk = ({
465465
sdkSymbol: symbol,
466466
symbol: symbolRegistry,
467467
});
468-
plugin.updateNode(heyApiRegistryIndex, node);
468+
plugin.node(node, heyApiRegistryIndex);
469469
const registryNode = $.field(registryName, (f) =>
470470
f
471471
.public()
@@ -489,7 +489,7 @@ export const generateClassSdk = ({
489489
),
490490
)
491491
.do(...currentClass.nodes);
492-
plugin.addNode(node);
492+
plugin.node(node);
493493
};
494494

495495
for (const sdkClass of sdkClasses.values()) {

packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const generateFlatSdk = ({
121121
)
122122
.do(...statements),
123123
);
124-
plugin.addNode(node);
124+
plugin.node(node);
125125
},
126126
{
127127
order: 'declarations',

packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@ export const createTypeOptions = ({
109109
),
110110
),
111111
);
112-
plugin.addNode(typeOptions);
112+
plugin.node(typeOptions);
113113
};

packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const processSchemaType = ({
9696
.param(dataVariableName, (p) => p.type('any'))
9797
.do(...nodes),
9898
);
99-
plugin.addNode(node);
99+
plugin.node(node);
100100
}
101101
} finally {
102102
buildingSymbols.delete(symbol.id);
@@ -336,7 +336,7 @@ export const handler: HeyApiTransformersPlugin['Handler'] = ({ plugin }) => {
336336
.returns($.type('Promise').generic(symbolResponse))
337337
.do(...nodes),
338338
);
339-
plugin.addNode(value);
339+
plugin.node(value);
340340
},
341341
{
342342
order: 'declarations',

packages/openapi-ts/src/plugins/@hey-api/typescript/shared/clientOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ export const createClientOptions = ({
7676
p.type($.type.or(...types)),
7777
),
7878
);
79-
plugin.updateNode(nodeIndex, node);
79+
plugin.node(node, nodeIndex);
8080
};

0 commit comments

Comments
 (0)