@openapi-qraft/tanstack-query-react-plugin 1.8.0 → 1.10.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/generateCode.d.ts +2 -1
  3. package/dist/generateCode.d.ts.map +1 -0
  4. package/dist/generateCode.js +10 -9
  5. package/dist/generateCode.js.map +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/plugin.d.ts +1 -0
  9. package/dist/plugin.d.ts.map +1 -0
  10. package/dist/plugin.js +8 -6
  11. package/dist/plugin.js.map +1 -1
  12. package/dist/ts-factory/astToString.d.ts +1 -0
  13. package/dist/ts-factory/astToString.d.ts.map +1 -0
  14. package/dist/ts-factory/getClientFactory.d.ts +1 -0
  15. package/dist/ts-factory/getClientFactory.d.ts.map +1 -0
  16. package/dist/ts-factory/getIndexFactory.d.ts +12 -2
  17. package/dist/ts-factory/getIndexFactory.d.ts.map +1 -0
  18. package/dist/ts-factory/getIndexFactory.js +19 -1
  19. package/dist/ts-factory/getIndexFactory.js.map +1 -1
  20. package/dist/ts-factory/getServiceFactory.d.ts +1 -0
  21. package/dist/ts-factory/getServiceFactory.d.ts.map +1 -0
  22. package/dist/ts-factory/getServiceFactory.js +7 -0
  23. package/dist/ts-factory/getServiceFactory.js.map +1 -1
  24. package/dist/ts-factory/getServiceIndexFactory.d.ts +1 -0
  25. package/dist/ts-factory/getServiceIndexFactory.d.ts.map +1 -0
  26. package/package.json +8 -8
  27. package/src/__snapshots__/create-api-client.ts.snapshot.ts +80 -86
  28. package/src/__snapshots__/index.ts.snapshot.ts +8 -12
  29. package/src/__snapshots__/services/ApprovalPoliciesService.ts.snapshot.ts +67 -62
  30. package/src/__snapshots__/services/FilesService.ts.snapshot.ts +57 -55
  31. package/src/__snapshots__/services/index.ts.snapshot.ts +17 -23
  32. package/src/generateCode.ts +15 -12
  33. package/src/plugin.ts +13 -9
  34. package/src/ts-factory/getIndexFactory.ts +37 -1
  35. package/src/ts-factory/getServiceFactory.ts +35 -0
  36. package/dist/__snapshots__/create-api-client.ts.snapshot.d.ts +0 -1
  37. package/dist/__snapshots__/create-api-client.ts.snapshot.js +0 -88
  38. package/dist/__snapshots__/create-api-client.ts.snapshot.js.map +0 -1
  39. package/dist/__snapshots__/index.ts.snapshot.d.ts +0 -1
  40. package/dist/__snapshots__/index.ts.snapshot.js +0 -13
  41. package/dist/__snapshots__/index.ts.snapshot.js.map +0 -1
  42. package/dist/__snapshots__/services/ApprovalPoliciesService.ts.snapshot.d.ts +0 -1
  43. package/dist/__snapshots__/services/ApprovalPoliciesService.ts.snapshot.js +0 -62
  44. package/dist/__snapshots__/services/ApprovalPoliciesService.ts.snapshot.js.map +0 -1
  45. package/dist/__snapshots__/services/FilesService.ts.snapshot.d.ts +0 -1
  46. package/dist/__snapshots__/services/FilesService.ts.snapshot.js +0 -57
  47. package/dist/__snapshots__/services/FilesService.ts.snapshot.js.map +0 -1
  48. package/dist/__snapshots__/services/index.ts.snapshot.d.ts +0 -1
  49. package/dist/__snapshots__/services/index.ts.snapshot.js +0 -24
  50. package/dist/__snapshots__/services/index.ts.snapshot.js.map +0 -1
@@ -1,88 +0,0 @@
1
- import fs from 'node:fs';
2
- import { expect } from 'vitest';
3
- export default function () {
4
- expect(fs.readFileSync('/mock-fs/create-api-client.ts', 'utf-8'))
5
- .toMatchInlineSnapshot(`
6
- "/* generated using @openapi-qraft/cli -- do no edit */
7
- /* istanbul ignore file */
8
- import { qraftAPIClient, QraftClientOptions } from "@openapi-qraft/react";
9
- import { getInfiniteQueryData } from "@openapi-qraft/react/callbacks/getInfiniteQueryData";
10
- import { getInfiniteQueryKey } from "@openapi-qraft/react/callbacks/getInfiniteQueryKey";
11
- import { getMutationKey } from "@openapi-qraft/react/callbacks/getMutationKey";
12
- import { getQueryData } from "@openapi-qraft/react/callbacks/getQueryData";
13
- import { getQueriesData } from "@openapi-qraft/react/callbacks/getQueriesData";
14
- import { getQueryKey } from "@openapi-qraft/react/callbacks/getQueryKey";
15
- import { mutationFn } from "@openapi-qraft/react/callbacks/mutationFn";
16
- import { queryFn } from "@openapi-qraft/react/callbacks/queryFn";
17
- import { setInfiniteQueryData } from "@openapi-qraft/react/callbacks/setInfiniteQueryData";
18
- import { setQueryData } from "@openapi-qraft/react/callbacks/setQueryData";
19
- import { setQueriesData } from "@openapi-qraft/react/callbacks/setQueriesData";
20
- import { useInfiniteQuery } from "@openapi-qraft/react/callbacks/useInfiniteQuery";
21
- import { useMutation } from "@openapi-qraft/react/callbacks/useMutation";
22
- import { useQuery } from "@openapi-qraft/react/callbacks/useQuery";
23
- import { useSuspenseQuery } from "@openapi-qraft/react/callbacks/useSuspenseQuery";
24
- import { useSuspenseInfiniteQuery } from "@openapi-qraft/react/callbacks/useSuspenseInfiniteQuery";
25
- import { useMutationState } from "@openapi-qraft/react/callbacks/useMutationState";
26
- import { useIsMutating } from "@openapi-qraft/react/callbacks/useIsMutating";
27
- import { useQueries } from "@openapi-qraft/react/callbacks/useQueries";
28
- import { useSuspenseQueries } from "@openapi-qraft/react/callbacks/useSuspenseQueries";
29
- import { invalidateQueries } from "@openapi-qraft/react/callbacks/invalidateQueries";
30
- import { cancelQueries } from "@openapi-qraft/react/callbacks/cancelQueries";
31
- import { resetQueries } from "@openapi-qraft/react/callbacks/resetQueries";
32
- import { removeQueries } from "@openapi-qraft/react/callbacks/removeQueries";
33
- import { refetchQueries } from "@openapi-qraft/react/callbacks/refetchQueries";
34
- import { isFetching } from "@openapi-qraft/react/callbacks/isFetching";
35
- import { isMutating } from "@openapi-qraft/react/callbacks/isMutating";
36
- import { useIsFetching } from "@openapi-qraft/react/callbacks/useIsFetching";
37
- import { fetchQuery } from "@openapi-qraft/react/callbacks/fetchQuery";
38
- import { prefetchQuery } from "@openapi-qraft/react/callbacks/prefetchQuery";
39
- import { fetchInfiniteQuery } from "@openapi-qraft/react/callbacks/fetchInfiniteQuery";
40
- import { prefetchInfiniteQuery } from "@openapi-qraft/react/callbacks/prefetchInfiniteQuery";
41
- import { getQueryState } from "@openapi-qraft/react/callbacks/getQueryState";
42
- import { getInfiniteQueryState } from "@openapi-qraft/react/callbacks/getInfiniteQueryState";
43
- import { operationInvokeFn } from "@openapi-qraft/react/callbacks/operationInvokeFn";
44
- import { services, Services } from "./services/index.js";
45
- const callbacks = {
46
- getInfiniteQueryData,
47
- getInfiniteQueryKey,
48
- getMutationKey,
49
- getQueryData,
50
- getQueriesData,
51
- getQueryKey,
52
- mutationFn,
53
- queryFn,
54
- setInfiniteQueryData,
55
- setQueryData,
56
- setQueriesData,
57
- useInfiniteQuery,
58
- useMutation,
59
- useQuery,
60
- useSuspenseQuery,
61
- useSuspenseInfiniteQuery,
62
- useMutationState,
63
- useIsMutating,
64
- useQueries,
65
- useSuspenseQueries,
66
- invalidateQueries,
67
- cancelQueries,
68
- resetQueries,
69
- removeQueries,
70
- refetchQueries,
71
- isFetching,
72
- isMutating,
73
- useIsFetching,
74
- fetchQuery,
75
- prefetchQuery,
76
- fetchInfiniteQuery,
77
- prefetchInfiniteQuery,
78
- getQueryState,
79
- getInfiniteQueryState,
80
- operationInvokeFn
81
- };
82
- export function createAPIClient(options?: QraftClientOptions): Services {
83
- return qraftAPIClient<Services, typeof callbacks>(services, callbacks, options);
84
- }
85
- "
86
- `);
87
- }
88
- //# sourceMappingURL=create-api-client.ts.snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-api-client.ts.snapshot.js","sourceRoot":"","sources":["../../src/__snapshots__/create-api-client.ts.snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO;IACZ,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;SAC9D,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFtB,CAAC,CAAC;AACP,CAAC"}
@@ -1 +0,0 @@
1
- export default function (): void;
@@ -1,13 +0,0 @@
1
- import fs from 'node:fs';
2
- import { expect } from 'vitest';
3
- export default function () {
4
- expect(fs.readFileSync('/mock-fs/index.ts', 'utf-8')).toMatchInlineSnapshot(`
5
- "/* generated using @openapi-qraft/cli -- do no edit */
6
- /* istanbul ignore file */
7
- export { services } from "./services/index.js";
8
- export type { Services } from "./services/index.js";
9
- export { createAPIClient } from "./create-api-client.js";
10
- "
11
- `);
12
- }
13
- //# sourceMappingURL=index.ts.snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.ts.snapshot.js","sourceRoot":"","sources":["../../src/__snapshots__/index.ts.snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO;IACZ,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;GAO3E,CAAC,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- export default function (): void;
@@ -1,62 +0,0 @@
1
- import fs from 'node:fs';
2
- import { expect } from 'vitest';
3
- export default function () {
4
- expect(fs.readFileSync('/mock-fs/services/ApprovalPoliciesService.ts', 'utf-8')).toMatchInlineSnapshot(`
5
- "/* generated using @openapi-qraft/cli -- do no edit */
6
- /* istanbul ignore file */
7
- import type { paths } from "../../openapi.js";
8
- import type { ServiceOperationQuery, ServiceOperationMutation } from "@openapi-qraft/react";
9
- export interface ApprovalPoliciesService {
10
- /**
11
- * @summary Get an approval policy by ID
12
- * @description Retrieve a specific approval policy.
13
- */
14
- getApprovalPoliciesId: ServiceOperationQuery<{
15
- method: "get";
16
- url: "/approval_policies/{approval_policy_id}";
17
- }, paths["/approval_policies/{approval_policy_id}"]["get"]["responses"]["200"]["content"]["application/json"], paths["/approval_policies/{approval_policy_id}"]["get"]["parameters"], paths["/approval_policies/{approval_policy_id}"]["get"]["responses"]["401"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["get"]["responses"]["422"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["get"]["responses"]["default"]["content"]["application/json"]>;
18
- /**
19
- * @summary Delete an approval policy
20
- * @description Delete an existing approval policy.
21
- */
22
- deleteApprovalPoliciesId: ServiceOperationMutation<{
23
- method: "delete";
24
- url: "/approval_policies/{approval_policy_id}";
25
- }, undefined, paths["/approval_policies/{approval_policy_id}"]["delete"]["responses"]["200"]["content"]["application/json"], paths["/approval_policies/{approval_policy_id}"]["delete"]["parameters"], paths["/approval_policies/{approval_policy_id}"]["delete"]["responses"]["401"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["delete"]["responses"]["422"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["delete"]["responses"]["default"]["content"]["application/json"]>;
26
- /**
27
- * @summary Update an approval policy
28
- * @description Update an existing approval policy.
29
- */
30
- patchApprovalPoliciesId: ServiceOperationMutation<{
31
- method: "patch";
32
- url: "/approval_policies/{approval_policy_id}";
33
- mediaType: "application/json";
34
- }, NonNullable<paths["/approval_policies/{approval_policy_id}"]["patch"]["requestBody"]>["content"]["application/json"], paths["/approval_policies/{approval_policy_id}"]["patch"]["responses"]["200"]["content"]["application/json"], paths["/approval_policies/{approval_policy_id}"]["patch"]["parameters"], paths["/approval_policies/{approval_policy_id}"]["patch"]["responses"]["401"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["patch"]["responses"]["422"]["content"]["application/json"] | paths["/approval_policies/{approval_policy_id}"]["patch"]["responses"]["default"]["content"]["application/json"]>;
35
- }
36
- export const approvalPoliciesService: {
37
- [key in keyof ApprovalPoliciesService]: Pick<ApprovalPoliciesService[key], "schema">;
38
- } = {
39
- getApprovalPoliciesId: {
40
- schema: {
41
- method: "get",
42
- url: "/approval_policies/{approval_policy_id}"
43
- }
44
- },
45
- deleteApprovalPoliciesId: {
46
- schema: {
47
- method: "delete",
48
- url: "/approval_policies/{approval_policy_id}"
49
- }
50
- },
51
- patchApprovalPoliciesId: {
52
- schema: {
53
- method: "patch",
54
- url: "/approval_policies/{approval_policy_id}",
55
- mediaType: "application/json"
56
- }
57
- }
58
- } as const;
59
- "
60
- `);
61
- }
62
- //# sourceMappingURL=ApprovalPoliciesService.ts.snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApprovalPoliciesService.ts.snapshot.js","sourceRoot":"","sources":["../../../src/__snapshots__/services/ApprovalPoliciesService.ts.snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO;IACZ,MAAM,CACJ,EAAE,CAAC,YAAY,CAAC,8CAA8C,EAAE,OAAO,CAAC,CACzE,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDvB,CAAC,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- export default function (): void;
@@ -1,57 +0,0 @@
1
- import fs from 'node:fs';
2
- import { expect } from 'vitest';
3
- export default function () {
4
- expect(fs.readFileSync('/mock-fs/services/FilesService.ts', 'utf-8'))
5
- .toMatchInlineSnapshot(`
6
- "/* generated using @openapi-qraft/cli -- do no edit */
7
- /* istanbul ignore file */
8
- import type { paths } from "../../openapi.js";
9
- import type { ServiceOperationQuery, ServiceOperationMutation } from "@openapi-qraft/react";
10
- export interface FilesService {
11
- /** @summary Get a files by ID */
12
- getFiles: ServiceOperationQuery<{
13
- method: "get";
14
- url: "/files";
15
- }, paths["/files"]["get"]["responses"]["200"]["content"]["application/json"], paths["/files"]["get"]["parameters"], paths["/files"]["get"]["responses"]["405"]["content"]["application/json"] | paths["/files"]["get"]["responses"]["422"]["content"]["application/json"] | paths["/files"]["get"]["responses"]["default"]["content"]["application/json"]>;
16
- /** @summary Upload a files by ID */
17
- postFiles: ServiceOperationMutation<{
18
- method: "post";
19
- url: "/files";
20
- mediaType: "multipart/form-data";
21
- }, NonNullable<paths["/files"]["post"]["requestBody"]>["content"]["multipart/form-data"], paths["/files"]["post"]["responses"]["200"]["content"]["application/json"], undefined, paths["/files"]["post"]["responses"]["default"]["content"]["application/json"]>;
22
- /**
23
- * @deprecated
24
- * @summary Get a file list
25
- */
26
- getFileList: ServiceOperationQuery<{
27
- method: "get";
28
- url: "/files/list";
29
- }, paths["/files/list"]["get"]["responses"]["200"]["content"]["application/json"], paths["/files/list"]["get"]["parameters"], paths["/files/list"]["get"]["responses"]["default"]["content"]["application/json"]>;
30
- }
31
- export const filesService: {
32
- [key in keyof FilesService]: Pick<FilesService[key], "schema">;
33
- } = {
34
- getFiles: {
35
- schema: {
36
- method: "get",
37
- url: "/files"
38
- }
39
- },
40
- postFiles: {
41
- schema: {
42
- method: "post",
43
- url: "/files",
44
- mediaType: "multipart/form-data"
45
- }
46
- },
47
- getFileList: {
48
- schema: {
49
- method: "get",
50
- url: "/files/list"
51
- }
52
- }
53
- } as const;
54
- "
55
- `);
56
- }
57
- //# sourceMappingURL=FilesService.ts.snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FilesService.ts.snapshot.js","sourceRoot":"","sources":["../../../src/__snapshots__/services/FilesService.ts.snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO;IACZ,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;SAClE,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDtB,CAAC,CAAC;AACP,CAAC"}
@@ -1 +0,0 @@
1
- export default function (): void;
@@ -1,24 +0,0 @@
1
- import fs from 'node:fs';
2
- import { expect } from 'vitest';
3
- export default function () {
4
- expect(fs.readFileSync('/mock-fs/services/index.ts', 'utf-8'))
5
- .toMatchInlineSnapshot(`
6
- "/* generated using @openapi-qraft/cli -- do no edit */
7
- /* istanbul ignore file */
8
- import { EntitiesService, entitiesService } from "./EntitiesService.js";
9
- import { ApprovalPoliciesService, approvalPoliciesService } from "./ApprovalPoliciesService.js";
10
- import { FilesService, filesService } from "./FilesService.js";
11
- export type Services = {
12
- entities: EntitiesService;
13
- approvalPolicies: ApprovalPoliciesService;
14
- files: FilesService;
15
- };
16
- export const services = {
17
- entities: entitiesService,
18
- approvalPolicies: approvalPoliciesService,
19
- files: filesService
20
- } as const;
21
- "
22
- `);
23
- }
24
- //# sourceMappingURL=index.ts.snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.ts.snapshot.js","sourceRoot":"","sources":["../../../src/__snapshots__/services/index.ts.snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO;IACZ,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;SAC3D,qBAAqB,CAAC;;;;;;;;;;;;;;;;;KAiBtB,CAAC,CAAC;AACP,CAAC"}