@squonk/account-server-client 2.0.6-rc.1 → 2.0.7

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 (70) hide show
  1. package/admin/admin.cjs +14 -7
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.cts +33 -0
  4. package/admin/admin.d.ts +4 -1
  5. package/admin/admin.js +14 -7
  6. package/admin/admin.js.map +1 -1
  7. package/asset/asset.cjs +44 -19
  8. package/asset/asset.cjs.map +1 -1
  9. package/asset/asset.d.cts +241 -0
  10. package/asset/asset.d.ts +43 -19
  11. package/asset/asset.js +37 -12
  12. package/asset/asset.js.map +1 -1
  13. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  14. package/chunk-J22A7LHX.cjs.map +1 -0
  15. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  16. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  17. package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
  18. package/index.cjs +10 -10
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +2 -0
  21. package/index.d.ts +1 -1
  22. package/index.js +9 -9
  23. package/index.js.map +1 -1
  24. package/merchant/merchant.cjs +23 -13
  25. package/merchant/merchant.cjs.map +1 -1
  26. package/merchant/merchant.d.cts +57 -0
  27. package/merchant/merchant.d.ts +7 -1
  28. package/merchant/merchant.js +22 -12
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +50 -25
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.cts +203 -0
  33. package/organisation/organisation.d.ts +31 -10
  34. package/organisation/organisation.js +44 -19
  35. package/organisation/organisation.js.map +1 -1
  36. package/package.json +12 -12
  37. package/product/product.cjs +80 -44
  38. package/product/product.cjs.map +1 -1
  39. package/product/product.d.cts +280 -0
  40. package/product/product.d.ts +40 -10
  41. package/product/product.js +71 -35
  42. package/product/product.js.map +1 -1
  43. package/src/account-server-api.schemas.ts +268 -276
  44. package/src/admin/admin.ts +72 -78
  45. package/src/asset/asset.ts +447 -556
  46. package/src/merchant/merchant.ts +125 -136
  47. package/src/organisation/organisation.ts +394 -484
  48. package/src/product/product.ts +557 -682
  49. package/src/state/state.ts +70 -69
  50. package/src/unit/unit.ts +494 -593
  51. package/src/user/user.ts +377 -463
  52. package/state/state.cjs +13 -7
  53. package/state/state.cjs.map +1 -1
  54. package/state/state.d.cts +29 -0
  55. package/state/state.d.ts +4 -1
  56. package/state/state.js +13 -7
  57. package/state/state.js.map +1 -1
  58. package/unit/unit.cjs +59 -28
  59. package/unit/unit.cjs.map +1 -1
  60. package/unit/unit.d.cts +254 -0
  61. package/unit/unit.d.ts +43 -16
  62. package/unit/unit.js +52 -21
  63. package/unit/unit.js.map +1 -1
  64. package/user/user.cjs +52 -21
  65. package/user/user.cjs.map +1 -1
  66. package/user/user.d.cts +220 -0
  67. package/user/user.d.ts +31 -10
  68. package/user/user.js +46 -15
  69. package/user/user.js.map +1 -1
  70. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { aE as customInstance, am as OrganisationsGetResponse, aF as ErrorType, aA as AsError, q as OrganisationPostBodyBody, av as OrganisationPostResponse, B as OrganisationDetail, O as OrganisationPatchBodyBody, G as GetOrganisationChargesParams, ao as OrganisationChargesGetResponse, at as OrganisationGetDefaultResponse } from '../custom-instance-f32f6506.js';
2
1
  import * as _tanstack_react_query from '@tanstack/react-query';
3
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
3
+ import { aE as customInstance, am as OrganisationsGetResponse, aF as ErrorType, aA as AsError, q as OrganisationPostBodyBody, av as OrganisationPostResponse, B as OrganisationDetail, O as OrganisationPatchBodyBody, G as GetOrganisationChargesParams, ao as OrganisationChargesGetResponse, at as OrganisationGetDefaultResponse } from '../custom-instance-13ade7a9.js';
4
4
  import 'axios';
5
5
 
6
6
  type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
@@ -19,6 +19,9 @@ declare const getGetOrganisationsQueryOptions: <TData = OrganisationsGetResponse
19
19
  };
20
20
  type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>;
21
21
  type GetOrganisationsQueryError = ErrorType<void | AsError>;
22
+ /**
23
+ * @summary Gets Organisations
24
+ */
22
25
  declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = ErrorType<void | AsError>>(options?: {
23
26
  query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, QueryKey> | undefined;
24
27
  request?: SecondParameter<typeof customInstance>;
@@ -44,6 +47,9 @@ declare const getCreateOrganisationMutationOptions: <TError = ErrorType<void | A
44
47
  type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>;
45
48
  type CreateOrganisationMutationBody = OrganisationPostBodyBody;
46
49
  type CreateOrganisationMutationError = ErrorType<AsError | void>;
50
+ /**
51
+ * @summary Create a new organisation
52
+ */
47
53
  declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
48
54
  mutation?: UseMutationOptions<OrganisationPostResponse, TError, {
49
55
  data: OrganisationPostBodyBody;
@@ -53,12 +59,12 @@ declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TConte
53
59
  data: OrganisationPostBodyBody;
54
60
  }, TContext>;
55
61
  /**
56
- * Gets a specific Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation.
62
+ * Gets a specific Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation.
57
63
 
58
64
  Members of an Organisation's **Unit** do not necessarily have access to the Organisation.
59
65
 
60
- * @summary Gets an Organisation
61
- */
66
+ * @summary Gets an Organisation
67
+ */
62
68
  declare const getOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationDetail>;
63
69
  declare const getGetOrganisationQueryKey: (orgId: string) => readonly ["account-server-api", `/organisation/${string}`];
64
70
  declare const getGetOrganisationQueryOptions: <TData = OrganisationDetail, TError = ErrorType<void | AsError>>(orgId: string, options?: {
@@ -69,6 +75,9 @@ declare const getGetOrganisationQueryOptions: <TData = OrganisationDetail, TErro
69
75
  };
70
76
  type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>;
71
77
  type GetOrganisationQueryError = ErrorType<void | AsError>;
78
+ /**
79
+ * @summary Gets an Organisation
80
+ */
72
81
  declare const useGetOrganisation: <TData = OrganisationDetail, TError = ErrorType<void | AsError>>(orgId: string, options?: {
73
82
  query?: UseQueryOptions<OrganisationDetail, TError, TData, QueryKey> | undefined;
74
83
  request?: SecondParameter<typeof customInstance>;
@@ -96,6 +105,9 @@ declare const getPatchOrganisationMutationOptions: <TError = ErrorType<AsError>,
96
105
  type PatchOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof patchOrganisation>>>;
97
106
  type PatchOrganisationMutationBody = OrganisationPatchBodyBody;
98
107
  type PatchOrganisationMutationError = ErrorType<AsError>;
108
+ /**
109
+ * @summary Adjust an existing Organisation
110
+ */
99
111
  declare const usePatchOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
100
112
  mutation?: UseMutationOptions<void, TError, {
101
113
  orgId: string;
@@ -107,12 +119,12 @@ declare const usePatchOrganisation: <TError = ErrorType<AsError>, TContext = unk
107
119
  data: OrganisationPatchBodyBody;
108
120
  }, TContext>;
109
121
  /**
110
- * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.
122
+ * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.
111
123
 
112
124
  You need admin rights to use this method
113
125
 
114
- * @summary Deletes an Organisation
115
- */
126
+ * @summary Deletes an Organisation
127
+ */
116
128
  declare const deleteOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
117
129
  declare const getDeleteOrganisationMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
118
130
  mutation?: UseMutationOptions<void, TError, {
@@ -124,6 +136,9 @@ declare const getDeleteOrganisationMutationOptions: <TError = ErrorType<AsError>
124
136
  }, TContext>;
125
137
  type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>;
126
138
  type DeleteOrganisationMutationError = ErrorType<AsError>;
139
+ /**
140
+ * @summary Deletes an Organisation
141
+ */
127
142
  declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
128
143
  mutation?: UseMutationOptions<void, TError, {
129
144
  orgId: string;
@@ -133,12 +148,12 @@ declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = un
133
148
  orgId: string;
134
149
  }, TContext>;
135
150
  /**
136
- * Gets a Organisation charges.
151
+ * Gets a Organisation charges.
137
152
 
138
153
  The Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint
139
154
 
140
- * @summary Gets charges for all Units in an Organisation
141
- */
155
+ * @summary Gets charges for all Units in an Organisation
156
+ */
142
157
  declare const getOrganisationCharges: (orgId: string, params?: GetOrganisationChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationChargesGetResponse>;
143
158
  declare const getGetOrganisationChargesQueryKey: (orgId: string, params?: GetOrganisationChargesParams) => readonly ["account-server-api", `/organisation/${string}/charges`, ...GetOrganisationChargesParams[]];
144
159
  declare const getGetOrganisationChargesQueryOptions: <TData = OrganisationChargesGetResponse, TError = ErrorType<void | AsError>>(orgId: string, params?: GetOrganisationChargesParams, options?: {
@@ -149,6 +164,9 @@ declare const getGetOrganisationChargesQueryOptions: <TData = OrganisationCharge
149
164
  };
150
165
  type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>;
151
166
  type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
167
+ /**
168
+ * @summary Gets charges for all Units in an Organisation
169
+ */
152
170
  declare const useGetOrganisationCharges: <TData = OrganisationChargesGetResponse, TError = ErrorType<void | AsError>>(orgId: string, params?: GetOrganisationChargesParams, options?: {
153
171
  query?: UseQueryOptions<OrganisationChargesGetResponse, TError, TData, QueryKey> | undefined;
154
172
  request?: SecondParameter<typeof customInstance>;
@@ -172,6 +190,9 @@ declare const getGetDefaultOrganisationQueryOptions: <TData = OrganisationGetDef
172
190
  };
173
191
  type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>;
174
192
  type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
193
+ /**
194
+ * @summary Gets the Default Organisation
195
+ */
175
196
  declare const useGetDefaultOrganisation: <TData = OrganisationGetDefaultResponse, TError = ErrorType<void | AsError>>(options?: {
176
197
  query?: UseQueryOptions<OrganisationGetDefaultResponse, TError, TData, QueryKey> | undefined;
177
198
  request?: SecondParameter<typeof customInstance>;
@@ -1,16 +1,25 @@
1
1
  import {
2
2
  customInstance
3
- } from "../chunk-3RNIDX7T.js";
3
+ } from "../chunk-UKA7G3OB.js";
4
4
 
5
5
  // src/organisation/organisation.ts
6
- import { useQuery, useMutation } from "@tanstack/react-query";
6
+ import {
7
+ useMutation,
8
+ useQuery
9
+ } from "@tanstack/react-query";
7
10
  var getOrganisations = (options, signal) => {
8
11
  return customInstance(
9
- { url: `/organisation`, method: "get", signal },
12
+ {
13
+ url: `/organisation`,
14
+ method: "get",
15
+ signal
16
+ },
10
17
  options
11
18
  );
12
19
  };
13
- var getGetOrganisationsQueryKey = () => ["account-server-api", `/organisation`];
20
+ var getGetOrganisationsQueryKey = () => {
21
+ return ["account-server-api", `/organisation`];
22
+ };
14
23
  var getGetOrganisationsQueryOptions = (options) => {
15
24
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
25
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationsQueryKey();
@@ -48,17 +57,21 @@ var useCreateOrganisation = (options) => {
48
57
  };
49
58
  var getOrganisation = (orgId, options, signal) => {
50
59
  return customInstance(
51
- { url: `/organisation/${orgId}`, method: "get", signal },
60
+ {
61
+ url: `/organisation/${orgId}`,
62
+ method: "get",
63
+ signal
64
+ },
52
65
  options
53
66
  );
54
67
  };
55
- var getGetOrganisationQueryKey = (orgId) => ["account-server-api", `/organisation/${orgId}`];
68
+ var getGetOrganisationQueryKey = (orgId) => {
69
+ return ["account-server-api", `/organisation/${orgId}`];
70
+ };
56
71
  var getGetOrganisationQueryOptions = (orgId, options) => {
57
72
  const { query: queryOptions, request: requestOptions } = options ?? {};
58
73
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationQueryKey(orgId);
59
- const queryFn = ({
60
- signal
61
- }) => getOrganisation(orgId, requestOptions, signal);
74
+ const queryFn = ({ signal }) => getOrganisation(orgId, requestOptions, signal);
62
75
  return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
63
76
  };
64
77
  var useGetOrganisation = (orgId, options) => {
@@ -92,7 +105,10 @@ var usePatchOrganisation = (options) => {
92
105
  };
93
106
  var deleteOrganisation = (orgId, options) => {
94
107
  return customInstance(
95
- { url: `/organisation/${orgId}`, method: "delete" },
108
+ {
109
+ url: `/organisation/${orgId}`,
110
+ method: "delete"
111
+ },
96
112
  options
97
113
  );
98
114
  };
@@ -110,11 +126,18 @@ var useDeleteOrganisation = (options) => {
110
126
  };
111
127
  var getOrganisationCharges = (orgId, params, options, signal) => {
112
128
  return customInstance(
113
- { url: `/organisation/${orgId}/charges`, method: "get", params, signal },
129
+ {
130
+ url: `/organisation/${orgId}/charges`,
131
+ method: "get",
132
+ params,
133
+ signal
134
+ },
114
135
  options
115
136
  );
116
137
  };
117
- var getGetOrganisationChargesQueryKey = (orgId, params) => ["account-server-api", `/organisation/${orgId}/charges`, ...params ? [params] : []];
138
+ var getGetOrganisationChargesQueryKey = (orgId, params) => {
139
+ return ["account-server-api", `/organisation/${orgId}/charges`, ...params ? [params] : []];
140
+ };
118
141
  var getGetOrganisationChargesQueryOptions = (orgId, params, options) => {
119
142
  const { query: queryOptions, request: requestOptions } = options ?? {};
120
143
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationChargesQueryKey(orgId, params);
@@ -122,22 +145,24 @@ var getGetOrganisationChargesQueryOptions = (orgId, params, options) => {
122
145
  return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
123
146
  };
124
147
  var useGetOrganisationCharges = (orgId, params, options) => {
125
- const queryOptions = getGetOrganisationChargesQueryOptions(
126
- orgId,
127
- params,
128
- options
129
- );
148
+ const queryOptions = getGetOrganisationChargesQueryOptions(orgId, params, options);
130
149
  const query = useQuery(queryOptions);
131
150
  query.queryKey = queryOptions.queryKey;
132
151
  return query;
133
152
  };
134
153
  var getDefaultOrganisation = (options, signal) => {
135
154
  return customInstance(
136
- { url: `/organisation/default`, method: "get", signal },
155
+ {
156
+ url: `/organisation/default`,
157
+ method: "get",
158
+ signal
159
+ },
137
160
  options
138
161
  );
139
162
  };
140
- var getGetDefaultOrganisationQueryKey = () => ["account-server-api", `/organisation/default`];
163
+ var getGetDefaultOrganisationQueryKey = () => {
164
+ return ["account-server-api", `/organisation/default`];
165
+ };
141
166
  var getGetDefaultOrganisationQueryOptions = (options) => {
142
167
  const { query: queryOptions, request: requestOptions } = options ?? {};
143
168
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetDefaultOrganisationQueryKey();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetResponse,\n OrganisationPatchBodyBody,\n OrganisationChargesGetResponse,\n GetOrganisationChargesParams,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets all the Organisations that you are a member of or are public. Admin users are members of all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [\"account-server-api\", `/organisation`] as const;\n\nexport const getGetOrganisationsQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisations>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisations>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisations>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisations>>\n > = ({ signal }) => getOrganisations(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetOrganisationsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisations>>\n>;\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisations = <\n TData = Awaited<ReturnType<typeof getOrganisations>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisations>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new Organisation\n\nYou need admin rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n {\n url: `/organisation`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateOrganisationMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisation>>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisation>>\n>;\nexport type CreateOrganisationMutationBody = OrganisationPostBodyBody;\nexport type CreateOrganisationMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisation = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets a specific Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation.\n\nMembers of an Organisation's **Unit** do not necessarily have access to the Organisation.\n\n * @summary Gets an Organisation\n */\nexport const getOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetResponse>(\n { url: `/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationQueryKey = (orgId: string) =>\n [\"account-server-api\", `/organisation/${orgId}`] as const;\n\nexport const getGetOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({\n signal,\n }) => getOrganisation(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisation>>\n>;\nexport type GetOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisation = <\n TData = Awaited<ReturnType<typeof getOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationQueryOptions(orgId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Used to update existing Organisation.\n\nYou have to be the Organisation owner (or an administrator) to patch an Organisation.\n\n * @summary Adjust an existing Organisation\n */\nexport const patchOrganisation = (\n orgId: string,\n organisationPatchBodyBody: OrganisationPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/organisation/${orgId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchOrganisationMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchOrganisation>>,\n TError,\n { orgId: string; data: OrganisationPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchOrganisation>>,\n TError,\n { orgId: string; data: OrganisationPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchOrganisation>>,\n { orgId: string; data: OrganisationPatchBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return patchOrganisation(orgId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchOrganisation>>\n>;\nexport type PatchOrganisationMutationBody = OrganisationPatchBodyBody;\nexport type PatchOrganisationMutationError = ErrorType<AsError>;\n\nexport const usePatchOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchOrganisation>>,\n TError,\n { orgId: string; data: OrganisationPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.\n\nYou need admin rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props ?? {};\n\n return deleteOrganisation(orgId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisation>>\n>;\n\nexport type DeleteOrganisationMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets a Organisation charges.\n\nThe Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint\n\n * @summary Gets charges for all Units in an Organisation\n */\nexport const getOrganisationCharges = (\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationChargesGetResponse>(\n { url: `/organisation/${orgId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetOrganisationChargesQueryKey = (\n orgId: string,\n params?: GetOrganisationChargesParams\n) => [\"account-server-api\", `/organisation/${orgId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetOrganisationChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n > = ({ signal }) =>\n getOrganisationCharges(orgId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n>;\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationCharges = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationChargesQueryOptions(\n orgId,\n params,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets the Default Organisation, a built-in Organisation used exclusively for **Personal Units**.\n\nAny authorised user can see the Default Organisation.\n\n * @summary Gets the Default Organisation\n */\nexport const getDefaultOrganisation = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n { url: `/organisation/default`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetDefaultOrganisationQueryKey = () =>\n [\"account-server-api\", `/organisation/default`] as const;\n\nexport const getGetDefaultOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n > = ({ signal }) => getDefaultOrganisation(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n>;\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetDefaultOrganisation = <\n TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetDefaultOrganisationQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAoC/B,IAAM,mBAAmB,CAC9B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,8BAA8B,MAAM,CAAC,sBAAsB,eAAe;AAEhF,IAAM,kCAAkC,CAG7C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,iBAAiB,gBAAgB,MAAM;AAE3D,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,eAAe,gCAAgC,OAAO;AAE5D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AASO,IAAM,qBAAqB,CAChC,0BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,uCAAuC,CAGlD,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,KAAK,IAAI,SAAS,CAAC;AAE3B,WAAO,mBAAmB,MAAM,cAAc;AAAA,EAChD;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM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AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AASO,IAAM,yBAAyB,CACpC,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,yBAAyB,QAAQ,OAAO,OAAO;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,oCAAoC,MAC/C,CAAC,sBAAsB,uBAAuB;AAEzC,IAAM,wCAAwC,CAGnD,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,kCAAkC;AAE9D,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,uBAAuB,gBAAgB,MAAM;AAEjE,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,4BAA4B,CAGvC,YAO4D;AAC5D,QAAM,eAAe,sCAAsC,OAAO;AAElE,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.20.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n GetOrganisationChargesParams,\n OrganisationChargesGetResponse,\n OrganisationDetail,\n OrganisationGetDefaultResponse,\n OrganisationPatchBodyBody,\n OrganisationPostBodyBody,\n OrganisationPostResponse,\n OrganisationsGetResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n\n/**\n * Gets all the Organisations that you are a member of or are public. Admin users are members of all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<OrganisationsGetResponse>(\n {url: `/organisation`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationsQueryKey = () => {\n \n return [\"account-server-api\", `/organisation`] as const;\n }\n\n \nexport const getGetOrganisationsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisations>>> = ({ signal }) => getOrganisations(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets Organisations\n */\nexport const useGetOrganisations = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationsQueryOptions(options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Creates a new Organisation\n\nYou need admin rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<OrganisationPostResponse>(\n {url: `/organisation`, method: 'post',\n headers: {'Content-Type': 'application/json', },\n data: organisationPostBodyBody\n },\n options);\n }\n \n\n\nexport const getCreateOrganisationMutationOptions = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisation>>, {data: OrganisationPostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return createOrganisation(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>\n export type CreateOrganisationMutationBody = OrganisationPostBodyBody\n export type CreateOrganisationMutationError = ErrorType<AsError | void>\n\n /**\n * @summary Create a new organisation\n */\nexport const useCreateOrganisation = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getCreateOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Gets a specific Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation.\n\nMembers of an Organisation's **Unit** do not necessarily have access to the Organisation.\n\n * @summary Gets an Organisation\n */\nexport const getOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<OrganisationDetail>(\n {url: `/organisation/${orgId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationQueryKey = (orgId: string,) => {\n \n return [\"account-server-api\", `/organisation/${orgId}`] as const;\n }\n\n \nexport const getGetOrganisationQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({ signal }) => getOrganisation(orgId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>\nexport type GetOrganisationQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets an Organisation\n */\nexport const useGetOrganisation = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(\n orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationQueryOptions(orgId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Used to update existing Organisation.\n\nYou have to be the Organisation owner (or an administrator) to patch an Organisation.\n\n * @summary Adjust an existing Organisation\n */\nexport const patchOrganisation = (\n orgId: string,\n organisationPatchBodyBody: OrganisationPatchBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/organisation/${orgId}`, method: 'patch',\n headers: {'Content-Type': 'application/json', },\n data: organisationPatchBodyBody\n },\n options);\n }\n \n\n\nexport const getPatchOrganisationMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchOrganisation>>, {orgId: string;data: OrganisationPatchBodyBody}> = (props) => {\n const {orgId,data} = props ?? {};\n\n return patchOrganisation(orgId,data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PatchOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof patchOrganisation>>>\n export type PatchOrganisationMutationBody = OrganisationPatchBodyBody\n export type PatchOrganisationMutationError = ErrorType<AsError>\n\n /**\n * @summary Adjust an existing Organisation\n */\nexport const usePatchOrganisation = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getPatchOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.\n\nYou need admin rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/organisation/${orgId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteOrganisationMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisation>>, {orgId: string}> = (props) => {\n const {orgId} = props ?? {};\n\n return deleteOrganisation(orgId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>\n \n export type DeleteOrganisationMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes an Organisation\n */\nexport const useDeleteOrganisation = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteOrganisationMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Gets a Organisation charges.\n\nThe Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint\n\n * @summary Gets charges for all Units in an Organisation\n */\nexport const getOrganisationCharges = (\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<OrganisationChargesGetResponse>(\n {url: `/organisation/${orgId}/charges`, method: 'get',\n params, signal\n },\n options);\n }\n \n\nexport const getGetOrganisationChargesQueryKey = (orgId: string,\n params?: GetOrganisationChargesParams,) => {\n \n return [\"account-server-api\", `/organisation/${orgId}/charges`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetOrganisationChargesQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) => getOrganisationCharges(orgId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets charges for all Units in an Organisation\n */\nexport const useGetOrganisationCharges = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationChargesQueryOptions(orgId,params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Gets the Default Organisation, a built-in Organisation used exclusively for **Personal Units**.\n\nAny authorised user can see the Default Organisation.\n\n * @summary Gets the Default Organisation\n */\nexport const getDefaultOrganisation = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<OrganisationGetDefaultResponse>(\n {url: `/organisation/default`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetDefaultOrganisationQueryKey = () => {\n \n return [\"account-server-api\", `/organisation/default`] as const;\n }\n\n \nexport const getGetDefaultOrganisationQueryOptions = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getDefaultOrganisation>>> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets the Default Organisation\n */\nexport const useGetDefaultOrganisation = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetDefaultOrganisationQueryOptions(options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n"],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAsCA,IAAM,mBAAmB,CAE/B,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAAO;AAAA,IACxC;AAAA,IAC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AAWO,IAAM,yBAAyB,CAErC,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAyB,QAAQ;AAAA,MAAO;AAAA,IAChD;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,oCAAoC,MAAM;AAEnD,SAAO,CAAC,sBAAsB,uBAAuB;AACrD;AAGG,IAAM,wCAAwC,CAAkG,YAClJ;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,kCAAkC;AAI5E,QAAM,UAA6E,CAAC,EAAE,OAAO,MAAM,uBAAuB,gBAAgB,MAAM;AAMjJ,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,4BAA4B,CACvC,YAE8D;AAE9D,QAAM,eAAe,sCAAsC,OAAO;AAElE,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.6-rc.1",
2
+ "version": "2.0.7",
3
3
  "author": "Oliver Dudgeon",
4
4
  "name": "@squonk/account-server-client",
5
5
  "private": false,
@@ -15,18 +15,18 @@
15
15
  "build": "tsup && node setup-entrypoints.js"
16
16
  },
17
17
  "devDependencies": {
18
- "@tanstack/react-query": "4.29.5",
19
- "@typescript-eslint/eslint-plugin": "5.59.2",
20
- "axios": "1.4.0",
21
- "eslint": "8.39.0",
22
- "eslint-plugin-prettier": "4.2.1",
18
+ "@tanstack/react-query": "4.35.3",
19
+ "@typescript-eslint/eslint-plugin": "6.11.0",
20
+ "axios": "1.6.2",
21
+ "eslint": "8.53.0",
22
+ "eslint-plugin-prettier": "5.0.1",
23
23
  "js-yaml": "4.1.0",
24
- "orval": "6.15.0",
25
- "prettier": "2.8.8",
26
- "ts-morph": "18.0.0",
27
- "tslib": "2.5.0",
28
- "tsup": "6.7.0",
29
- "typescript": "5.0.4"
24
+ "orval": "6.20.0",
25
+ "prettier": "3.1.0",
26
+ "ts-morph": "20.0.0",
27
+ "tslib": "2.6.2",
28
+ "tsup": "7.2.0",
29
+ "typescript": "5.2.2"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@tanstack/react-query": ">=4",
@@ -1,22 +1,29 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
3
+ var _chunkJ22A7LHXcjs = require('../chunk-J22A7LHX.cjs');
4
4
 
5
5
  // src/product/product.ts
6
+
7
+
8
+
6
9
  var _reactquery = require('@tanstack/react-query');
7
10
  var getProductTypes = (options, signal) => {
8
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
9
- { url: `/product-type`, method: "get", signal },
11
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
12
+ {
13
+ url: `/product-type`,
14
+ method: "get",
15
+ signal
16
+ },
10
17
  options
11
18
  );
12
19
  };
13
- var getGetProductTypesQueryKey = () => ["account-server-api", `/product-type`];
20
+ var getGetProductTypesQueryKey = () => {
21
+ return ["account-server-api", `/product-type`];
22
+ };
14
23
  var getGetProductTypesQueryOptions = (options) => {
15
24
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
16
25
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductTypesQueryKey()));
17
- const queryFn = ({
18
- signal
19
- }) => getProductTypes(requestOptions, signal);
26
+ const queryFn = ({ signal }) => getProductTypes(requestOptions, signal);
20
27
  return { queryKey, queryFn, ...queryOptions };
21
28
  };
22
29
  var useGetProductTypes = (options) => {
@@ -26,12 +33,18 @@ var useGetProductTypes = (options) => {
26
33
  return query;
27
34
  };
28
35
  var getProductDefaultStorageCost = (options, signal) => {
29
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
30
- { url: `/product-default-storage-cost`, method: "get", signal },
36
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
37
+ {
38
+ url: `/product-default-storage-cost`,
39
+ method: "get",
40
+ signal
41
+ },
31
42
  options
32
43
  );
33
44
  };
34
- var getGetProductDefaultStorageCostQueryKey = () => ["account-server-api", `/product-default-storage-cost`];
45
+ var getGetProductDefaultStorageCostQueryKey = () => {
46
+ return ["account-server-api", `/product-default-storage-cost`];
47
+ };
35
48
  var getGetProductDefaultStorageCostQueryOptions = (options) => {
36
49
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
37
50
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductDefaultStorageCostQueryKey()));
@@ -45,18 +58,22 @@ var useGetProductDefaultStorageCost = (options) => {
45
58
  return query;
46
59
  };
47
60
  var getProducts = (options, signal) => {
48
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
49
- { url: `/product`, method: "get", signal },
61
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
62
+ {
63
+ url: `/product`,
64
+ method: "get",
65
+ signal
66
+ },
50
67
  options
51
68
  );
52
69
  };
53
- var getGetProductsQueryKey = () => ["account-server-api", `/product`];
70
+ var getGetProductsQueryKey = () => {
71
+ return ["account-server-api", `/product`];
72
+ };
54
73
  var getGetProductsQueryOptions = (options) => {
55
74
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
56
75
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsQueryKey()));
57
- const queryFn = ({
58
- signal
59
- }) => getProducts(requestOptions, signal);
76
+ const queryFn = ({ signal }) => getProducts(requestOptions, signal);
60
77
  return { queryKey, queryFn, ...queryOptions };
61
78
  };
62
79
  var useGetProducts = (options) => {
@@ -66,12 +83,18 @@ var useGetProducts = (options) => {
66
83
  return query;
67
84
  };
68
85
  var getProductsForOrganisation = (orgId, options, signal) => {
69
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
70
- { url: `/product/organisation/${orgId}`, method: "get", signal },
86
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
87
+ {
88
+ url: `/product/organisation/${orgId}`,
89
+ method: "get",
90
+ signal
91
+ },
71
92
  options
72
93
  );
73
94
  };
74
- var getGetProductsForOrganisationQueryKey = (orgId) => ["account-server-api", `/product/organisation/${orgId}`];
95
+ var getGetProductsForOrganisationQueryKey = (orgId) => {
96
+ return ["account-server-api", `/product/organisation/${orgId}`];
97
+ };
75
98
  var getGetProductsForOrganisationQueryOptions = (orgId, options) => {
76
99
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
77
100
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForOrganisationQueryKey(orgId)));
@@ -79,16 +102,13 @@ var getGetProductsForOrganisationQueryOptions = (orgId, options) => {
79
102
  return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
80
103
  };
81
104
  var useGetProductsForOrganisation = (orgId, options) => {
82
- const queryOptions = getGetProductsForOrganisationQueryOptions(
83
- orgId,
84
- options
85
- );
105
+ const queryOptions = getGetProductsForOrganisationQueryOptions(orgId, options);
86
106
  const query = _reactquery.useQuery.call(void 0, queryOptions);
87
107
  query.queryKey = queryOptions.queryKey;
88
108
  return query;
89
109
  };
90
110
  var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
91
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
111
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
92
112
  {
93
113
  url: `/product/unit/${unitId}`,
94
114
  method: "post",
@@ -111,12 +131,18 @@ var useCreateUnitProduct = (options) => {
111
131
  return _reactquery.useMutation.call(void 0, mutationOptions);
112
132
  };
113
133
  var getProductsForUnit = (unitId, options, signal) => {
114
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
115
- { url: `/product/unit/${unitId}`, method: "get", signal },
134
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
135
+ {
136
+ url: `/product/unit/${unitId}`,
137
+ method: "get",
138
+ signal
139
+ },
116
140
  options
117
141
  );
118
142
  };
119
- var getGetProductsForUnitQueryKey = (unitId) => ["account-server-api", `/product/unit/${unitId}`];
143
+ var getGetProductsForUnitQueryKey = (unitId) => {
144
+ return ["account-server-api", `/product/unit/${unitId}`];
145
+ };
120
146
  var getGetProductsForUnitQueryOptions = (unitId, options) => {
121
147
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
122
148
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForUnitQueryKey(unitId)));
@@ -130,18 +156,22 @@ var useGetProductsForUnit = (unitId, options) => {
130
156
  return query;
131
157
  };
132
158
  var getProduct = (productId, options, signal) => {
133
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
134
- { url: `/product/${productId}`, method: "get", signal },
159
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
160
+ {
161
+ url: `/product/${productId}`,
162
+ method: "get",
163
+ signal
164
+ },
135
165
  options
136
166
  );
137
167
  };
138
- var getGetProductQueryKey = (productId) => ["account-server-api", `/product/${productId}`];
168
+ var getGetProductQueryKey = (productId) => {
169
+ return ["account-server-api", `/product/${productId}`];
170
+ };
139
171
  var getGetProductQueryOptions = (productId, options) => {
140
172
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
141
173
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductQueryKey(productId)));
142
- const queryFn = ({
143
- signal
144
- }) => getProduct(productId, requestOptions, signal);
174
+ const queryFn = ({ signal }) => getProduct(productId, requestOptions, signal);
145
175
  return { queryKey, queryFn, enabled: !!productId, ...queryOptions };
146
176
  };
147
177
  var useGetProduct = (productId, options) => {
@@ -151,8 +181,11 @@ var useGetProduct = (productId, options) => {
151
181
  return query;
152
182
  };
153
183
  var deleteProduct = (productId, options) => {
154
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
155
- { url: `/product/${productId}`, method: "delete" },
184
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
185
+ {
186
+ url: `/product/${productId}`,
187
+ method: "delete"
188
+ },
156
189
  options
157
190
  );
158
191
  };
@@ -169,7 +202,7 @@ var useDeleteProduct = (options) => {
169
202
  return _reactquery.useMutation.call(void 0, mutationOptions);
170
203
  };
171
204
  var patchProduct = (productId, productPatchBodyBody, options) => {
172
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
205
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
173
206
  {
174
207
  url: `/product/${productId}`,
175
208
  method: "patch",
@@ -192,12 +225,19 @@ var usePatchProduct = (options) => {
192
225
  return _reactquery.useMutation.call(void 0, mutationOptions);
193
226
  };
194
227
  var getProductCharges = (productId, params, options, signal) => {
195
- return _chunkUZTHSGDTcjs.customInstance.call(void 0,
196
- { url: `/product/${productId}/charges`, method: "get", params, signal },
228
+ return _chunkJ22A7LHXcjs.customInstance.call(void 0,
229
+ {
230
+ url: `/product/${productId}/charges`,
231
+ method: "get",
232
+ params,
233
+ signal
234
+ },
197
235
  options
198
236
  );
199
237
  };
200
- var getGetProductChargesQueryKey = (productId, params) => ["account-server-api", `/product/${productId}/charges`, ...params ? [params] : []];
238
+ var getGetProductChargesQueryKey = (productId, params) => {
239
+ return ["account-server-api", `/product/${productId}/charges`, ...params ? [params] : []];
240
+ };
201
241
  var getGetProductChargesQueryOptions = (productId, params, options) => {
202
242
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
203
243
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductChargesQueryKey(productId, params)));
@@ -205,11 +245,7 @@ var getGetProductChargesQueryOptions = (productId, params, options) => {
205
245
  return { queryKey, queryFn, enabled: !!productId, ...queryOptions };
206
246
  };
207
247
  var useGetProductCharges = (productId, params, options) => {
208
- const queryOptions = getGetProductChargesQueryOptions(
209
- productId,
210
- params,
211
- options
212
- );
248
+ const queryOptions = getGetProductChargesQueryOptions(productId, params, options);
213
249
  const query = _reactquery.useQuery.call(void 0, queryOptions);
214
250
  query.queryKey = queryOptions.queryKey;
215
251
  return query;