@7nohe/openapi-react-query-codegen 1.0.7 → 1.1.0

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.
@@ -3,10 +3,23 @@ import { createUseMutation } from "./createUseMutation.mjs";
3
3
  export const createExports = (service) => {
4
4
  const { klasses } = service;
5
5
  const methods = klasses.map((k) => k.methods).flat();
6
- const allGet = methods.filter((m) => m.httpMethodName === "'GET'");
7
- const allPost = methods.filter((m) => m.httpMethodName === "'POST'");
8
- const allQueries = allGet.map((m) => createUseQuery(m));
9
- const allMutations = allPost.map((m) => createUseMutation(m));
6
+ const allGet = methods.filter((m) => m.httpMethodName.toUpperCase().includes("GET"));
7
+ const allPost = methods.filter((m) => m.httpMethodName.toUpperCase().includes("POST"));
8
+ const allPut = methods.filter((m) => m.httpMethodName.toUpperCase().includes("PUT"));
9
+ const allPatch = methods.filter((m) => m.httpMethodName.toUpperCase().includes("PATCH"));
10
+ const allDelete = methods.filter((m) => m.httpMethodName.toUpperCase().includes("DELETE"));
11
+ const allGetQueries = allGet.map((m) => createUseQuery(m));
12
+ const allPostMutations = allPost.map((m) => createUseMutation(m));
13
+ const allPutMutations = allPut.map((m) => createUseMutation(m));
14
+ const allPatchMutations = allPatch.map((m) => createUseMutation(m));
15
+ const allDeleteMutations = allDelete.map((m) => createUseMutation(m));
16
+ const allQueries = [...allGetQueries];
17
+ const allMutations = [
18
+ ...allPostMutations,
19
+ ...allPutMutations,
20
+ ...allPatchMutations,
21
+ ...allDeleteMutations,
22
+ ];
10
23
  const commonInQueries = allQueries
11
24
  .map(({ apiResponse, returnType, key }) => [apiResponse, returnType, key])
12
25
  .flat();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7nohe/openapi-react-query-codegen",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "OpenAPI React Query Codegen",
5
5
  "bin": {
6
6
  "openapi-rq": "dist/cli.mjs"