@squonk/account-server-client 2.0.4-rc.2 → 2.0.4-rc.4

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 (59) hide show
  1. package/admin/admin.cjs +10 -14
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.ts +9 -3
  4. package/admin/admin.js +9 -13
  5. package/admin/admin.js.map +1 -1
  6. package/asset/asset.cjs +59 -28
  7. package/asset/asset.cjs.map +1 -1
  8. package/asset/asset.d.ts +71 -3
  9. package/asset/asset.js +58 -27
  10. package/asset/asset.js.map +1 -1
  11. package/{custom-instance-85497958.d.ts → custom-instance-8a11f2d1.d.ts} +1 -1
  12. package/index.cjs.map +1 -1
  13. package/index.d.ts +1 -1
  14. package/index.js.map +1 -1
  15. package/merchant/merchant.cjs +19 -16
  16. package/merchant/merchant.cjs.map +1 -1
  17. package/merchant/merchant.d.ts +16 -4
  18. package/merchant/merchant.js +18 -15
  19. package/merchant/merchant.js.map +1 -1
  20. package/organisation/organisation.cjs +62 -34
  21. package/organisation/organisation.cjs.map +1 -1
  22. package/organisation/organisation.d.ts +56 -6
  23. package/organisation/organisation.js +61 -33
  24. package/organisation/organisation.js.map +1 -1
  25. package/package.json +10 -9
  26. package/product/product.cjs +92 -55
  27. package/product/product.cjs.map +1 -1
  28. package/product/product.d.ts +79 -9
  29. package/product/product.js +91 -54
  30. package/product/product.js.map +1 -1
  31. package/src/account-server-api.schemas.ts +1 -1
  32. package/src/admin/admin.ts +34 -18
  33. package/src/asset/asset.ts +223 -88
  34. package/src/merchant/merchant.ts +60 -27
  35. package/src/organisation/organisation.ts +213 -90
  36. package/src/product/product.ts +310 -134
  37. package/src/state/state.ts +30 -15
  38. package/src/unit/unit.ts +261 -110
  39. package/src/user/user.ts +207 -88
  40. package/state/state.cjs +10 -11
  41. package/state/state.cjs.map +1 -1
  42. package/state/state.d.ts +9 -3
  43. package/state/state.js +9 -10
  44. package/state/state.js.map +1 -1
  45. package/unit/unit.cjs +72 -40
  46. package/unit/unit.cjs.map +1 -1
  47. package/unit/unit.d.ts +70 -6
  48. package/unit/unit.js +71 -39
  49. package/unit/unit.js.map +1 -1
  50. package/user/user.cjs +56 -31
  51. package/user/user.cjs.map +1 -1
  52. package/user/user.d.ts +63 -5
  53. package/user/user.js +55 -30
  54. package/user/user.js.map +1 -1
  55. package/chunk-7XN3IQYV.cjs +0 -13
  56. package/chunk-7XN3IQYV.cjs.map +0 -1
  57. package/chunk-YEX2SGER.js +0 -13
  58. package/chunk-YEX2SGER.js.map +0 -1
  59. package/src/queryMutator.ts +0 -12
package/user/user.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
3
- import { aE as customInstance, v as UserAccountDetail, aF as ErrorType, aA as AsError, au as UsersGetResponse } from '../custom-instance-85497958.js';
3
+ import { aE as customInstance, v as UserAccountDetail, aF as ErrorType, aA as AsError, au as UsersGetResponse } from '../custom-instance-8a11f2d1.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;
@@ -10,7 +10,13 @@ type SecondParameter<T extends (...args: any) => any> = T extends (config: any,
10
10
  * @summary Get information about your account
11
11
  */
12
12
  declare const getUserAccount: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UserAccountDetail>;
13
- declare const getGetUserAccountQueryKey: () => string[];
13
+ declare const getGetUserAccountQueryKey: () => readonly ["account-server-api", "/user/account"];
14
+ declare const getGetUserAccountQueryOptions: <TData = UserAccountDetail, TError = ErrorType<void | AsError>>(options?: {
15
+ query?: UseQueryOptions<UserAccountDetail, TError, TData, QueryKey> | undefined;
16
+ request?: SecondParameter<typeof customInstance>;
17
+ } | undefined) => UseQueryOptions<UserAccountDetail, TError, TData, QueryKey> & {
18
+ queryKey: QueryKey;
19
+ };
14
20
  type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>;
15
21
  type GetUserAccountQueryError = ErrorType<void | AsError>;
16
22
  declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<void | AsError>>(options?: {
@@ -25,7 +31,13 @@ declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<
25
31
  * @summary Gets users in an organisation
26
32
  */
27
33
  declare const getOrganisationUsers: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UsersGetResponse>;
28
- declare const getGetOrganisationUsersQueryKey: (orgId: string) => string[];
34
+ declare const getGetOrganisationUsersQueryKey: (orgId: string) => readonly ["account-server-api", `/organisation/${string}/user`];
35
+ declare const getGetOrganisationUsersQueryOptions: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
36
+ query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
37
+ request?: SecondParameter<typeof customInstance>;
38
+ } | undefined) => UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> & {
39
+ queryKey: QueryKey;
40
+ };
29
41
  type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>;
30
42
  type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
31
43
  declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
@@ -40,6 +52,16 @@ declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = Error
40
52
  * @summary Adds a user to an organisation
41
53
  */
42
54
  declare const addOrganisationUser: (orgId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
55
+ declare const getAddOrganisationUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
56
+ mutation?: UseMutationOptions<void, TError, {
57
+ orgId: string;
58
+ userId: string;
59
+ }, TContext> | undefined;
60
+ request?: SecondParameter<typeof customInstance>;
61
+ } | undefined) => UseMutationOptions<void, TError, {
62
+ orgId: string;
63
+ userId: string;
64
+ }, TContext>;
43
65
  type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>;
44
66
  type AddOrganisationUserMutationError = ErrorType<AsError>;
45
67
  declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -58,6 +80,16 @@ declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = u
58
80
  * @summary Deletes a user from an organisation
59
81
  */
60
82
  declare const deleteOrganisationUser: (orgId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
83
+ declare const getDeleteOrganisationUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
84
+ mutation?: UseMutationOptions<void, TError, {
85
+ orgId: string;
86
+ userId: string;
87
+ }, TContext> | undefined;
88
+ request?: SecondParameter<typeof customInstance>;
89
+ } | undefined) => UseMutationOptions<void, TError, {
90
+ orgId: string;
91
+ userId: string;
92
+ }, TContext>;
61
93
  type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>;
62
94
  type DeleteOrganisationUserMutationError = ErrorType<AsError>;
63
95
  declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -76,7 +108,13 @@ declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext
76
108
  * @summary Gets users in an Organisational Unit
77
109
  */
78
110
  declare const getOrganisationUnitUsers: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UsersGetResponse>;
79
- declare const getGetOrganisationUnitUsersQueryKey: (unitId: string) => string[];
111
+ declare const getGetOrganisationUnitUsersQueryKey: (unitId: string) => readonly ["account-server-api", `/unit/${string}/user`];
112
+ declare const getGetOrganisationUnitUsersQueryOptions: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
113
+ query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
114
+ request?: SecondParameter<typeof customInstance>;
115
+ } | undefined) => UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> & {
116
+ queryKey: QueryKey;
117
+ };
80
118
  type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>;
81
119
  type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
82
120
  declare const useGetOrganisationUnitUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
@@ -95,6 +133,16 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
95
133
  * @summary Adds a user to an Organisational Unit
96
134
  */
97
135
  declare const addOrganisationUnitUser: (unitId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
136
+ declare const getAddOrganisationUnitUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
137
+ mutation?: UseMutationOptions<void, TError, {
138
+ unitId: string;
139
+ userId: string;
140
+ }, TContext> | undefined;
141
+ request?: SecondParameter<typeof customInstance>;
142
+ } | undefined) => UseMutationOptions<void, TError, {
143
+ unitId: string;
144
+ userId: string;
145
+ }, TContext>;
98
146
  type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>;
99
147
  type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
100
148
  declare const useAddOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -117,6 +165,16 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
117
165
  * @summary Deletes a user from an Organisational Unit
118
166
  */
119
167
  declare const deleteOrganisationUnitUser: (unitId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
168
+ declare const getDeleteOrganisationUnitUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
169
+ mutation?: UseMutationOptions<void, TError, {
170
+ unitId: string;
171
+ userId: string;
172
+ }, TContext> | undefined;
173
+ request?: SecondParameter<typeof customInstance>;
174
+ } | undefined) => UseMutationOptions<void, TError, {
175
+ unitId: string;
176
+ userId: string;
177
+ }, TContext>;
120
178
  type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>;
121
179
  type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
122
180
  declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -130,4 +188,4 @@ declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TCont
130
188
  userId: string;
131
189
  }, TContext>;
132
190
 
133
- export { AddOrganisationUnitUserMutationError, AddOrganisationUnitUserMutationResult, AddOrganisationUserMutationError, AddOrganisationUserMutationResult, DeleteOrganisationUnitUserMutationError, DeleteOrganisationUnitUserMutationResult, DeleteOrganisationUserMutationError, DeleteOrganisationUserMutationResult, GetOrganisationUnitUsersQueryError, GetOrganisationUnitUsersQueryResult, GetOrganisationUsersQueryError, GetOrganisationUsersQueryResult, GetUserAccountQueryError, GetUserAccountQueryResult, addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUsersQueryKey, getGetUserAccountQueryKey, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUser, useDeleteOrganisationUnitUser, useDeleteOrganisationUser, useGetOrganisationUnitUsers, useGetOrganisationUsers, useGetUserAccount };
191
+ export { AddOrganisationUnitUserMutationError, AddOrganisationUnitUserMutationResult, AddOrganisationUserMutationError, AddOrganisationUserMutationResult, DeleteOrganisationUnitUserMutationError, DeleteOrganisationUnitUserMutationResult, DeleteOrganisationUserMutationError, DeleteOrganisationUserMutationResult, GetOrganisationUnitUsersQueryError, GetOrganisationUnitUsersQueryResult, GetOrganisationUsersQueryError, GetOrganisationUsersQueryResult, GetUserAccountQueryError, GetUserAccountQueryResult, addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getAddOrganisationUnitUserMutationOptions, getAddOrganisationUserMutationOptions, getDeleteOrganisationUnitUserMutationOptions, getDeleteOrganisationUserMutationOptions, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUnitUsersQueryOptions, getGetOrganisationUsersQueryKey, getGetOrganisationUsersQueryOptions, getGetUserAccountQueryKey, getGetUserAccountQueryOptions, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUser, useDeleteOrganisationUnitUser, useDeleteOrganisationUser, useGetOrganisationUnitUsers, useGetOrganisationUsers, useGetUserAccount };
package/user/user.js CHANGED
@@ -1,6 +1,3 @@
1
- import {
2
- queryMutator
3
- } from "../chunk-YEX2SGER.js";
4
1
  import {
5
2
  customInstance
6
3
  } from "../chunk-3RNIDX7T.js";
@@ -13,16 +10,19 @@ var getUserAccount = (options, signal) => {
13
10
  options
14
11
  );
15
12
  };
16
- var getGetUserAccountQueryKey = () => [`/user/account`];
17
- var useGetUserAccount = (options) => {
13
+ var getGetUserAccountQueryKey = () => ["account-server-api", `/user/account`];
14
+ var getGetUserAccountQueryOptions = (options) => {
18
15
  const { query: queryOptions, request: requestOptions } = options ?? {};
19
16
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
20
17
  const queryFn = ({
21
18
  signal
22
19
  }) => getUserAccount(requestOptions, signal);
23
- const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
24
- const query = useQuery(customOptions);
25
- query.queryKey = customOptions.queryKey;
20
+ return { queryKey, queryFn, ...queryOptions };
21
+ };
22
+ var useGetUserAccount = (options) => {
23
+ const queryOptions = getGetUserAccountQueryOptions(options);
24
+ const query = useQuery(queryOptions);
25
+ query.queryKey = queryOptions.queryKey;
26
26
  return query;
27
27
  };
28
28
  var getOrganisationUsers = (orgId, options, signal) => {
@@ -31,16 +31,17 @@ var getOrganisationUsers = (orgId, options, signal) => {
31
31
  options
32
32
  );
33
33
  };
34
- var getGetOrganisationUsersQueryKey = (orgId) => [
35
- `/organisation/${orgId}/user`
36
- ];
37
- var useGetOrganisationUsers = (orgId, options) => {
34
+ var getGetOrganisationUsersQueryKey = (orgId) => ["account-server-api", `/organisation/${orgId}/user`];
35
+ var getGetOrganisationUsersQueryOptions = (orgId, options) => {
38
36
  const { query: queryOptions, request: requestOptions } = options ?? {};
39
37
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgId);
40
38
  const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
41
- const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
42
- const query = useQuery(customOptions);
43
- query.queryKey = customOptions.queryKey;
39
+ return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
40
+ };
41
+ var useGetOrganisationUsers = (orgId, options) => {
42
+ const queryOptions = getGetOrganisationUsersQueryOptions(orgId, options);
43
+ const query = useQuery(queryOptions);
44
+ query.queryKey = queryOptions.queryKey;
44
45
  return query;
45
46
  };
46
47
  var addOrganisationUser = (orgId, userId, options) => {
@@ -49,13 +50,17 @@ var addOrganisationUser = (orgId, userId, options) => {
49
50
  options
50
51
  );
51
52
  };
52
- var useAddOrganisationUser = (options) => {
53
+ var getAddOrganisationUserMutationOptions = (options) => {
53
54
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
54
55
  const mutationFn = (props) => {
55
56
  const { orgId, userId } = props ?? {};
56
57
  return addOrganisationUser(orgId, userId, requestOptions);
57
58
  };
58
- return useMutation(mutationFn, mutationOptions);
59
+ return { mutationFn, ...mutationOptions };
60
+ };
61
+ var useAddOrganisationUser = (options) => {
62
+ const mutationOptions = getAddOrganisationUserMutationOptions(options);
63
+ return useMutation(mutationOptions);
59
64
  };
60
65
  var deleteOrganisationUser = (orgId, userId, options) => {
61
66
  return customInstance(
@@ -63,13 +68,17 @@ var deleteOrganisationUser = (orgId, userId, options) => {
63
68
  options
64
69
  );
65
70
  };
66
- var useDeleteOrganisationUser = (options) => {
71
+ var getDeleteOrganisationUserMutationOptions = (options) => {
67
72
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
68
73
  const mutationFn = (props) => {
69
74
  const { orgId, userId } = props ?? {};
70
75
  return deleteOrganisationUser(orgId, userId, requestOptions);
71
76
  };
72
- return useMutation(mutationFn, mutationOptions);
77
+ return { mutationFn, ...mutationOptions };
78
+ };
79
+ var useDeleteOrganisationUser = (options) => {
80
+ const mutationOptions = getDeleteOrganisationUserMutationOptions(options);
81
+ return useMutation(mutationOptions);
73
82
  };
74
83
  var getOrganisationUnitUsers = (unitId, options, signal) => {
75
84
  return customInstance(
@@ -77,16 +86,17 @@ var getOrganisationUnitUsers = (unitId, options, signal) => {
77
86
  options
78
87
  );
79
88
  };
80
- var getGetOrganisationUnitUsersQueryKey = (unitId) => [
81
- `/unit/${unitId}/user`
82
- ];
83
- var useGetOrganisationUnitUsers = (unitId, options) => {
89
+ var getGetOrganisationUnitUsersQueryKey = (unitId) => ["account-server-api", `/unit/${unitId}/user`];
90
+ var getGetOrganisationUnitUsersQueryOptions = (unitId, options) => {
84
91
  const { query: queryOptions, request: requestOptions } = options ?? {};
85
92
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitId);
86
93
  const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
87
- const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
88
- const query = useQuery(customOptions);
89
- query.queryKey = customOptions.queryKey;
94
+ return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
95
+ };
96
+ var useGetOrganisationUnitUsers = (unitId, options) => {
97
+ const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, options);
98
+ const query = useQuery(queryOptions);
99
+ query.queryKey = queryOptions.queryKey;
90
100
  return query;
91
101
  };
92
102
  var addOrganisationUnitUser = (unitId, userId, options) => {
@@ -95,13 +105,17 @@ var addOrganisationUnitUser = (unitId, userId, options) => {
95
105
  options
96
106
  );
97
107
  };
98
- var useAddOrganisationUnitUser = (options) => {
108
+ var getAddOrganisationUnitUserMutationOptions = (options) => {
99
109
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
100
110
  const mutationFn = (props) => {
101
111
  const { unitId, userId } = props ?? {};
102
112
  return addOrganisationUnitUser(unitId, userId, requestOptions);
103
113
  };
104
- return useMutation(mutationFn, mutationOptions);
114
+ return { mutationFn, ...mutationOptions };
115
+ };
116
+ var useAddOrganisationUnitUser = (options) => {
117
+ const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);
118
+ return useMutation(mutationOptions);
105
119
  };
106
120
  var deleteOrganisationUnitUser = (unitId, userId, options) => {
107
121
  return customInstance(
@@ -109,22 +123,33 @@ var deleteOrganisationUnitUser = (unitId, userId, options) => {
109
123
  options
110
124
  );
111
125
  };
112
- var useDeleteOrganisationUnitUser = (options) => {
126
+ var getDeleteOrganisationUnitUserMutationOptions = (options) => {
113
127
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
114
128
  const mutationFn = (props) => {
115
129
  const { unitId, userId } = props ?? {};
116
130
  return deleteOrganisationUnitUser(unitId, userId, requestOptions);
117
131
  };
118
- return useMutation(mutationFn, mutationOptions);
132
+ return { mutationFn, ...mutationOptions };
133
+ };
134
+ var useDeleteOrganisationUnitUser = (options) => {
135
+ const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);
136
+ return useMutation(mutationOptions);
119
137
  };
120
138
  export {
121
139
  addOrganisationUnitUser,
122
140
  addOrganisationUser,
123
141
  deleteOrganisationUnitUser,
124
142
  deleteOrganisationUser,
143
+ getAddOrganisationUnitUserMutationOptions,
144
+ getAddOrganisationUserMutationOptions,
145
+ getDeleteOrganisationUnitUserMutationOptions,
146
+ getDeleteOrganisationUserMutationOptions,
125
147
  getGetOrganisationUnitUsersQueryKey,
148
+ getGetOrganisationUnitUsersQueryOptions,
126
149
  getGetOrganisationUsersQueryKey,
150
+ getGetOrganisationUsersQueryOptions,
127
151
  getGetUserAccountQueryKey,
152
+ getGetUserAccountQueryOptions,
128
153
  getOrganisationUnitUsers,
129
154
  getOrganisationUsers,
130
155
  getUserAccount,
package/user/user.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.12.1 🍺\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 **Products**, **Organisations**, **Units** and **Users**.\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 UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\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 * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport type GetUserAccountQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({\n signal,\n }) => getUserAccount(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId: string) => [\n `/organisation/${orgId}/user`,\n];\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [\n `/unit/${unitId}/user`,\n];\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AA+B/B,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,eAAe;AAOxD,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,gBAAgB,MAAM;AAE3C,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CA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KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS;AAAA,IAC1D;AAAA,EACF;AACF;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/user/user.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 **Products**, **Organisations**, **Units** and **Users**.\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 UserAccountGetResponse,\n AsError,\n UsersGetResponse,\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 * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [\"account-server-api\", `/user/account`] as const;\n\nexport const getGetUserAccountQueryOptions = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({\n signal,\n }) => getUserAccount(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetUserAccountQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUserAccountQueryOptions(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 * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId: string) =>\n [\"account-server-api\", `/organisation/${orgId}/user`] as const;\n\nexport const getGetOrganisationUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUsersQueryOptions(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 * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport const getAddOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string) =>\n [\"account-server-api\", `/unit/${unitId}/user`] as const;\n\nexport const getGetOrganisationUnitUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, 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 * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport const getAddOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AA8B/B,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,sBAAsB,eAAe;AAE9E,IAAM,gCAAgC,CAG3C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,gBAAgB,MAAM;AAE3C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,eAAe,8BAA8B,OAAO;AAE1D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAOO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAC9C,CAAC,sBAAsB,iBAAiB,YAAY;AAE/C,IAAM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,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,6BAA6B,CAGxC,YAQI;AACJ,QAAM,kBAAkB,0CAA0C,OAAO;AAEzE,SAAO,YAAY,eAAe;AACpC;AAUO,IAAM,6BAA6B,CACxC,QACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS;AAAA,IAC1D;AAAA,EACF;AACF;AAEO,IAAM,+CAA+C,CAG1D,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,kBAAkB,6CAA6C,OAAO;AAE5E,SAAO,YAAY,eAAe;AACpC;","names":[]}
@@ -1,13 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/queryMutator.ts
2
- var queryMutator = (args) => {
3
- if (args.queryKey) {
4
- args.queryKey.unshift('"account-server-api"');
5
- return args;
6
- }
7
- return args;
8
- };
9
-
10
-
11
-
12
- exports.queryMutator = queryMutator;
13
- //# sourceMappingURL=chunk-7XN3IQYV.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/queryMutator.ts"],"names":[],"mappings":";AAEO,IAAM,eAAe,CAAI,SAAe;AAC7C,MAAK,KAAyB,UAAU;AACtC,IAAC,KAAa,SAAS,QAAQ,sBAAsB;AACrD,WAAO;AAAA,EACT;AAEA,SAAO;AACT","sourcesContent":["import { UseQueryOptions } from '@tanstack/react-query';\n\nexport const queryMutator = <T>(args: T): T => {\n if ((args as UseQueryOptions).queryKey) {\n (args as any).queryKey.unshift('\"account-server-api\"');\n return args;\n }\n\n return args;\n};\n\nexport default queryMutator;\n"]}
package/chunk-YEX2SGER.js DELETED
@@ -1,13 +0,0 @@
1
- // src/queryMutator.ts
2
- var queryMutator = (args) => {
3
- if (args.queryKey) {
4
- args.queryKey.unshift('"account-server-api"');
5
- return args;
6
- }
7
- return args;
8
- };
9
-
10
- export {
11
- queryMutator
12
- };
13
- //# sourceMappingURL=chunk-YEX2SGER.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/queryMutator.ts"],"sourcesContent":["import { UseQueryOptions } from '@tanstack/react-query';\n\nexport const queryMutator = <T>(args: T): T => {\n if ((args as UseQueryOptions).queryKey) {\n (args as any).queryKey.unshift('\"account-server-api\"');\n return args;\n }\n\n return args;\n};\n\nexport default queryMutator;\n"],"mappings":";AAEO,IAAM,eAAe,CAAI,SAAe;AAC7C,MAAK,KAAyB,UAAU;AACtC,IAAC,KAAa,SAAS,QAAQ,sBAAsB;AACrD,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -1,12 +0,0 @@
1
- import { UseQueryOptions } from '@tanstack/react-query';
2
-
3
- export const queryMutator = <T>(args: T): T => {
4
- if ((args as UseQueryOptions).queryKey) {
5
- (args as any).queryKey.unshift('"account-server-api"');
6
- return args;
7
- }
8
-
9
- return args;
10
- };
11
-
12
- export default queryMutator;