axigen 1.2.2 → 1.2.3

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.
package/README.md CHANGED
@@ -53,6 +53,7 @@ module.exports = {
53
53
 
54
54
  // Import path to your Axios instance inside your project
55
55
  axiosInstancePath: "../lib/axios",
56
+ axiosInstanceExport: "axiosInstance",
56
57
 
57
58
  language: "ts",
58
59
  jsdoc: true,
@@ -132,7 +133,7 @@ axigen generates:
132
133
 
133
134
  ```ts
134
135
  // This file is auto-generated by axigen. DO NOT EDIT.
135
- // Generated at: 2026-06-25T18:37:24.080Z
136
+ // Generated at: 2026-06-26T11:56:19.002Z
136
137
 
137
138
  import type { AxiosRequestConfig, AxiosResponse } from "axios";
138
139
  import { axiosInstance } from "../lib/axios";
@@ -143,7 +144,7 @@ import type { GetUserByIdPathParams, GetUserByIdResponse, GetUsersQueryParams, G
143
144
  * `GET /users`
144
145
  * @tags users
145
146
  */
146
- export async function getUsersGet(
147
+ export async function getGetUsers(
147
148
  params?: GetUsersQueryParams,
148
149
  config?: AxiosRequestConfig,
149
150
  options?: AxiosRequestConfig,
@@ -157,7 +158,7 @@ export async function getUsersGet(
157
158
  * `GET /users/{userId}`
158
159
  * @tags users
159
160
  */
160
- export async function getUserByIdGet(
161
+ export async function getGetUserById(
161
162
  userId: GetUserByIdPathParams["userId"],
162
163
  config?: AxiosRequestConfig,
163
164
  options?: AxiosRequestConfig,
@@ -208,14 +208,17 @@ function normalizeParam(p) {
208
208
  };
209
209
  }
210
210
  function buildOperationId(method, urlPath) {
211
- const parts = urlPath.split("/").filter(Boolean).map((segment) => {
211
+ const parts = urlPath.split("/").filter(Boolean).flatMap((segment) => {
212
212
  if (segment.startsWith("{") && segment.endsWith("}")) {
213
213
  const name = segment.slice(1, -1);
214
- return "By" + capitalize(name);
214
+ return ["By", ...splitSegment(name)];
215
215
  }
216
- return capitalize(segment);
216
+ return splitSegment(segment);
217
217
  });
218
- return method.toLowerCase() + parts.join("");
218
+ return parts.map(capitalize).join("");
219
+ }
220
+ function splitSegment(segment) {
221
+ return segment.split(/[-_]/);
219
222
  }
220
223
  function capitalize(s) {
221
224
  return s.charAt(0).toUpperCase() + s.slice(1);
@@ -374,8 +377,9 @@ function resolveFunctionName(operationId, method, config) {
374
377
  }
375
378
  }
376
379
  if (shouldAppendMethod(method, config.appendMethod)) {
377
- const suffix = method.charAt(0).toUpperCase() + method.slice(1).toLowerCase();
378
- name = name + suffix;
380
+ name = method.toLowerCase() + name.charAt(0).toUpperCase() + name.slice(1);
381
+ } else {
382
+ name = name.charAt(0).toLowerCase() + name.slice(1);
379
383
  }
380
384
  return name;
381
385
  }
package/dist/index.js CHANGED
@@ -134,14 +134,17 @@ function normalizeParam(p) {
134
134
  };
135
135
  }
136
136
  function buildOperationId(method, urlPath) {
137
- const parts = urlPath.split("/").filter(Boolean).map((segment) => {
137
+ const parts = urlPath.split("/").filter(Boolean).flatMap((segment) => {
138
138
  if (segment.startsWith("{") && segment.endsWith("}")) {
139
139
  const name = segment.slice(1, -1);
140
- return "By" + capitalize(name);
140
+ return ["By", ...splitSegment(name)];
141
141
  }
142
- return capitalize(segment);
142
+ return splitSegment(segment);
143
143
  });
144
- return method.toLowerCase() + parts.join("");
144
+ return parts.map(capitalize).join("");
145
+ }
146
+ function splitSegment(segment) {
147
+ return segment.split(/[-_]/);
145
148
  }
146
149
  function capitalize(s) {
147
150
  return s.charAt(0).toUpperCase() + s.slice(1);
@@ -300,8 +303,9 @@ function resolveFunctionName(operationId, method, config) {
300
303
  }
301
304
  }
302
305
  if (shouldAppendMethod(method, config.appendMethod)) {
303
- const suffix = method.charAt(0).toUpperCase() + method.slice(1).toLowerCase();
304
- name = name + suffix;
306
+ name = method.toLowerCase() + name.charAt(0).toUpperCase() + name.slice(1);
307
+ } else {
308
+ name = name.charAt(0).toLowerCase() + name.slice(1);
305
309
  }
306
310
  return name;
307
311
  }
package/dist/index.mjs CHANGED
@@ -93,14 +93,17 @@ function normalizeParam(p) {
93
93
  };
94
94
  }
95
95
  function buildOperationId(method, urlPath) {
96
- const parts = urlPath.split("/").filter(Boolean).map((segment) => {
96
+ const parts = urlPath.split("/").filter(Boolean).flatMap((segment) => {
97
97
  if (segment.startsWith("{") && segment.endsWith("}")) {
98
98
  const name = segment.slice(1, -1);
99
- return "By" + capitalize(name);
99
+ return ["By", ...splitSegment(name)];
100
100
  }
101
- return capitalize(segment);
101
+ return splitSegment(segment);
102
102
  });
103
- return method.toLowerCase() + parts.join("");
103
+ return parts.map(capitalize).join("");
104
+ }
105
+ function splitSegment(segment) {
106
+ return segment.split(/[-_]/);
104
107
  }
105
108
  function capitalize(s) {
106
109
  return s.charAt(0).toUpperCase() + s.slice(1);
@@ -259,8 +262,9 @@ function resolveFunctionName(operationId, method, config) {
259
262
  }
260
263
  }
261
264
  if (shouldAppendMethod(method, config.appendMethod)) {
262
- const suffix = method.charAt(0).toUpperCase() + method.slice(1).toLowerCase();
263
- name = name + suffix;
265
+ name = method.toLowerCase() + name.charAt(0).toUpperCase() + name.slice(1);
266
+ } else {
267
+ name = name.charAt(0).toLowerCase() + name.slice(1);
264
268
  }
265
269
  return name;
266
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axigen",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Generate typed Axios client functions from OpenAPI / Swagger specs",
5
5
  "keywords": [
6
6
  "openapi",