api-farmer 0.0.14 → 0.0.16

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
@@ -51,7 +51,6 @@ npx af
51
51
 
52
52
  > [!TIP]
53
53
  > The generated content does not include the integration of the request client.
54
- > If you allow ts code output, you will see a custom type called `Res`. This type needs to be defined in `global.d.ts` for use.
55
54
 
56
55
  #### Some Examples
57
56
 
@@ -22761,6 +22761,7 @@ function transformEntity({ path: path13, method, base }) {
22761
22761
  if (word.includes("{")) {
22762
22762
  return entity;
22763
22763
  }
22764
+ word = word.replace(/\.([a-z])/g, (_, p) => p.toUpperCase());
22764
22765
  word = pluralize.singular(pascalCase(word));
22765
22766
  if (method === "get" && index === words.length - 1) {
22766
22767
  word = pluralize.plural(word);
package/dist/cli.cjs CHANGED
@@ -102045,6 +102045,7 @@ function transformEntity({ path: path13, method, base }) {
102045
102045
  if (word.includes("{")) {
102046
102046
  return entity;
102047
102047
  }
102048
+ word = word.replace(/\.([a-z])/g, (_8, p5) => p5.toUpperCase());
102048
102049
  word = import_pluralize.default.singular((0, import_rattail.pascalCase)(word));
102049
102050
  if (method === "get" && index === words.length - 1) {
102050
102051
  word = import_pluralize.default.plural(word);
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { Command } from "commander";
9
9
  var program = new Command();
10
10
  program.version(getCliVersion());
11
11
  program.action(async () => {
12
- const { generate } = await import("./generate-2D36YQRL.js");
12
+ const { generate } = await import("./generate-RJ23AKV7.js");
13
13
  return generate();
14
14
  });
15
15
  program.parse();
@@ -4,7 +4,7 @@ import {
4
4
  partitionApiModules,
5
5
  renderApiModules,
6
6
  transformPayloads
7
- } from "./chunk-7HSWACLR.js";
7
+ } from "./chunk-VAAFC73D.js";
8
8
  import "./chunk-LYOTF4II.js";
9
9
  import "./chunk-6OIOYGN7.js";
10
10
  export {
package/dist/index.cjs CHANGED
@@ -79285,6 +79285,7 @@ function transformEntity({ path: path13, method, base }) {
79285
79285
  if (word.includes("{")) {
79286
79286
  return entity;
79287
79287
  }
79288
+ word = word.replace(/\.([a-z])/g, (_8, p5) => p5.toUpperCase());
79288
79289
  word = import_pluralize.default.singular((0, import_rattail.pascalCase)(word));
79289
79290
  if (method === "get" && index === words.length - 1) {
79290
79291
  word = import_pluralize.default.plural(word);
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  transformTypeValue,
21
21
  transformUrl,
22
22
  transformVerb
23
- } from "./chunk-7HSWACLR.js";
23
+ } from "./chunk-VAAFC73D.js";
24
24
  import {
25
25
  createStatusCodesByStrategy,
26
26
  doStatusCodeStrategy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-farmer",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "API module generation tool based on Openapi3/Swagger2.",
5
5
  "keywords": [
6
6
  "cli",
@@ -4,7 +4,7 @@ import { request } from '@/request'
4
4
 
5
5
  <% apiModule.payloads.forEach(payload => { %> -%>
6
6
  export const <%- payload.fn %> = (config<% if (ts) { %>: AxiosRequestConfig<<%- payload.typeRequestBody %>> <% } %>)
7
- => request<% if (ts) { %><any, Res<<%- payload.typeResponseBody %>>><% } %>({
7
+ => request<% if (ts) { %><any, <%- payload.typeResponseBody %>><% } %>({
8
8
  url: '<%- payload.url %>',
9
9
  method: '<%- payload.method %>',
10
10
  ...config
@@ -4,7 +4,7 @@ import { api } from '@/request'
4
4
  <% apiModule.payloads.forEach(payload => { %> -%>
5
5
  export const <%- payload.fn %> = api
6
6
  <% if (ts) { %>
7
- <Res<<%- payload.typeResponseBody %>>,
7
+ <<%- payload.typeResponseBody %>,
8
8
  <% if (['get', 'delete', 'head', 'options'].includes(payload.method)) { %>
9
9
  <%- payload.typeQuery %>
10
10
  <% } else { %>