@squonk/account-server-client 4.9.0-beta.6 → 4.9.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api-schemas/allCapabilitiesGetResponse.d.cts +11 -0
- package/dist/api/api-schemas/allCapabilitiesGetResponse.d.cts.map +1 -0
- package/dist/api/api-schemas/allCapabilitiesGetResponse.d.ts +11 -0
- package/dist/api/api-schemas/allCapabilitiesGetResponse.d.ts.map +1 -0
- package/dist/api/api-schemas/organisationCapabilities.d.cts +11 -0
- package/dist/api/api-schemas/organisationCapabilities.d.cts.map +1 -0
- package/dist/api/api-schemas/organisationCapabilities.d.ts +11 -0
- package/dist/api/api-schemas/organisationCapabilities.d.ts.map +1 -0
- package/dist/api/capabilities/capabilities.cjs +64 -0
- package/dist/api/capabilities/capabilities.cjs.map +1 -1
- package/dist/api/capabilities/capabilities.d.cts +66 -1
- package/dist/api/capabilities/capabilities.d.cts.map +1 -1
- package/dist/api/capabilities/capabilities.d.ts +66 -1
- package/dist/api/capabilities/capabilities.d.ts.map +1 -1
- package/dist/api/capabilities/capabilities.fetch.cjs +73 -0
- package/dist/api/capabilities/capabilities.fetch.cjs.map +1 -1
- package/dist/api/capabilities/capabilities.fetch.d.cts +86 -1
- package/dist/api/capabilities/capabilities.fetch.d.cts.map +1 -1
- package/dist/api/capabilities/capabilities.fetch.d.ts +86 -1
- package/dist/api/capabilities/capabilities.fetch.d.ts.map +1 -1
- package/dist/api/capabilities/capabilities.fetch.js +66 -1
- package/dist/api/capabilities/capabilities.fetch.js.map +1 -1
- package/dist/api/capabilities/capabilities.js +58 -1
- package/dist/api/capabilities/capabilities.js.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/package.json +1 -1
- package/src/api/api-schemas/allCapabilitiesGetResponse.fetch.ts +17 -0
- package/src/api/api-schemas/allCapabilitiesGetResponse.ts +17 -0
- package/src/api/api-schemas/index.ts +2 -0
- package/src/api/api-schemas/organisationCapabilities.fetch.ts +17 -0
- package/src/api/api-schemas/organisationCapabilities.ts +17 -0
- package/src/api/capabilities/capabilities.fetch.ts +241 -0
- package/src/api/capabilities/capabilities.ts +220 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
export * from "./actionDetail";
|
|
13
13
|
export * from "./actionGetResponse";
|
|
14
|
+
export * from "./allCapabilitiesGetResponse";
|
|
14
15
|
export * from "./asError";
|
|
15
16
|
export * from "./assetDetail";
|
|
16
17
|
export * from "./assetDetailScope";
|
|
@@ -61,6 +62,7 @@ export * from "./notificationDetailState";
|
|
|
61
62
|
export * from "./notificationsGetResponse";
|
|
62
63
|
export * from "./organisationAllDetail";
|
|
63
64
|
export * from "./organisationAllDetailDefaultProductPrivacy";
|
|
65
|
+
export * from "./organisationCapabilities";
|
|
64
66
|
export * from "./organisationChargesGetResponse";
|
|
65
67
|
export * from "./organisationChargeSummary";
|
|
66
68
|
export * from "./organisationDetail";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.22.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Account Server API
|
|
5
|
+
* The Informatics Matters Account Server API.
|
|
6
|
+
*
|
|
7
|
+
* A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
|
+
*
|
|
9
|
+
* OpenAPI spec version: 4.9
|
|
10
|
+
*/
|
|
11
|
+
import type { CapabilityDetail } from "./capabilityDetail.fetch";
|
|
12
|
+
|
|
13
|
+
export interface OrganisationCapabilities {
|
|
14
|
+
organisation_id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
capabilities: CapabilityDetail[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.22.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Account Server API
|
|
5
|
+
* The Informatics Matters Account Server API.
|
|
6
|
+
*
|
|
7
|
+
* A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
|
+
*
|
|
9
|
+
* OpenAPI spec version: 4.9
|
|
10
|
+
*/
|
|
11
|
+
import type { CapabilityDetail } from "./capabilityDetail";
|
|
12
|
+
|
|
13
|
+
export interface OrganisationCapabilities {
|
|
14
|
+
organisation_id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
capabilities: CapabilityDetail[];
|
|
17
|
+
}
|
|
@@ -28,6 +28,7 @@ import type {
|
|
|
28
28
|
} from "@tanstack/react-query";
|
|
29
29
|
|
|
30
30
|
import type {
|
|
31
|
+
AllCapabilitiesGetResponse,
|
|
31
32
|
AsError,
|
|
32
33
|
CapabilitiesGetResponse,
|
|
33
34
|
CapabilityPostBodyBody,
|
|
@@ -54,6 +55,246 @@ const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKe
|
|
|
54
55
|
return result;
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
export type getAllCapabilitiesResponse200 = { data: AllCapabilitiesGetResponse; status: 200 };
|
|
59
|
+
|
|
60
|
+
export type getAllCapabilitiesResponse401 = { data: void; status: 401 };
|
|
61
|
+
|
|
62
|
+
export type getAllCapabilitiesResponse403 = { data: AsError; status: 403 };
|
|
63
|
+
|
|
64
|
+
export type getAllCapabilitiesResponseSuccess = getAllCapabilitiesResponse200 & {
|
|
65
|
+
headers: Headers;
|
|
66
|
+
};
|
|
67
|
+
export type getAllCapabilitiesResponseError = (
|
|
68
|
+
| getAllCapabilitiesResponse401
|
|
69
|
+
| getAllCapabilitiesResponse403
|
|
70
|
+
) & { headers: Headers };
|
|
71
|
+
|
|
72
|
+
export type getAllCapabilitiesResponse =
|
|
73
|
+
| getAllCapabilitiesResponseSuccess
|
|
74
|
+
| getAllCapabilitiesResponseError;
|
|
75
|
+
|
|
76
|
+
export const getGetAllCapabilitiesUrl = () => {
|
|
77
|
+
return `/capability`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Gets the Capabilities of all the Organisations, indexed by Organisation. Organisations without Capabilities are not included.
|
|
82
|
+
*
|
|
83
|
+
* You need admin rights to use this path.
|
|
84
|
+
* @summary Gets the Capabilities of all Organisations
|
|
85
|
+
*/
|
|
86
|
+
export const getAllCapabilities = async (
|
|
87
|
+
options?: RequestInit,
|
|
88
|
+
): Promise<getAllCapabilitiesResponse> => {
|
|
89
|
+
return customFetch<getAllCapabilitiesResponse>(getGetAllCapabilitiesUrl(), {
|
|
90
|
+
...options,
|
|
91
|
+
method: "GET",
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const getGetAllCapabilitiesQueryKey = () => {
|
|
96
|
+
return ["account-server", "capability"] as const;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const getGetAllCapabilitiesQueryOptions = <
|
|
100
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
101
|
+
TError = ErrorType<void | AsError>,
|
|
102
|
+
>(options?: {
|
|
103
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
104
|
+
request?: SecondParameter<typeof customFetch>;
|
|
105
|
+
}) => {
|
|
106
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
107
|
+
|
|
108
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllCapabilitiesQueryKey();
|
|
109
|
+
|
|
110
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllCapabilities>>> = ({ signal }) =>
|
|
111
|
+
getAllCapabilities({ signal, ...requestOptions });
|
|
112
|
+
|
|
113
|
+
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
|
114
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
115
|
+
TError,
|
|
116
|
+
TData
|
|
117
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type GetAllCapabilitiesQueryResult = NonNullable<
|
|
121
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
122
|
+
>;
|
|
123
|
+
export type GetAllCapabilitiesQueryError = ErrorType<void | AsError>;
|
|
124
|
+
|
|
125
|
+
export function useGetAllCapabilities<
|
|
126
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
127
|
+
TError = ErrorType<void | AsError>,
|
|
128
|
+
>(
|
|
129
|
+
options: {
|
|
130
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>> &
|
|
131
|
+
Pick<
|
|
132
|
+
DefinedInitialDataOptions<
|
|
133
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
134
|
+
TError,
|
|
135
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
136
|
+
>,
|
|
137
|
+
"initialData"
|
|
138
|
+
>;
|
|
139
|
+
request?: SecondParameter<typeof customFetch>;
|
|
140
|
+
},
|
|
141
|
+
queryClient?: QueryClient,
|
|
142
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
143
|
+
export function useGetAllCapabilities<
|
|
144
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
145
|
+
TError = ErrorType<void | AsError>,
|
|
146
|
+
>(
|
|
147
|
+
options?: {
|
|
148
|
+
query?: Partial<
|
|
149
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
150
|
+
> &
|
|
151
|
+
Pick<
|
|
152
|
+
UndefinedInitialDataOptions<
|
|
153
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
154
|
+
TError,
|
|
155
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
156
|
+
>,
|
|
157
|
+
"initialData"
|
|
158
|
+
>;
|
|
159
|
+
request?: SecondParameter<typeof customFetch>;
|
|
160
|
+
},
|
|
161
|
+
queryClient?: QueryClient,
|
|
162
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
163
|
+
export function useGetAllCapabilities<
|
|
164
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
165
|
+
TError = ErrorType<void | AsError>,
|
|
166
|
+
>(
|
|
167
|
+
options?: {
|
|
168
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
169
|
+
request?: SecondParameter<typeof customFetch>;
|
|
170
|
+
},
|
|
171
|
+
queryClient?: QueryClient,
|
|
172
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
173
|
+
/**
|
|
174
|
+
* @summary Gets the Capabilities of all Organisations
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
export function useGetAllCapabilities<
|
|
178
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
179
|
+
TError = ErrorType<void | AsError>,
|
|
180
|
+
>(
|
|
181
|
+
options?: {
|
|
182
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
183
|
+
request?: SecondParameter<typeof customFetch>;
|
|
184
|
+
},
|
|
185
|
+
queryClient?: QueryClient,
|
|
186
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
187
|
+
const queryOptions = getGetAllCapabilitiesQueryOptions(options);
|
|
188
|
+
|
|
189
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
190
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @summary Gets the Capabilities of all Organisations
|
|
198
|
+
*/
|
|
199
|
+
export const invalidateGetAllCapabilities = async (
|
|
200
|
+
queryClient: QueryClient,
|
|
201
|
+
options?: InvalidateOptions,
|
|
202
|
+
): Promise<QueryClient> => {
|
|
203
|
+
await queryClient.invalidateQueries({ queryKey: getGetAllCapabilitiesQueryKey() }, options);
|
|
204
|
+
|
|
205
|
+
return queryClient;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const getGetAllCapabilitiesSuspenseQueryOptions = <
|
|
209
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
210
|
+
TError = ErrorType<void | AsError>,
|
|
211
|
+
>(options?: {
|
|
212
|
+
query?: Partial<
|
|
213
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
214
|
+
>;
|
|
215
|
+
request?: SecondParameter<typeof customFetch>;
|
|
216
|
+
}) => {
|
|
217
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
218
|
+
|
|
219
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllCapabilitiesQueryKey();
|
|
220
|
+
|
|
221
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllCapabilities>>> = ({ signal }) =>
|
|
222
|
+
getAllCapabilities({ signal, ...requestOptions });
|
|
223
|
+
|
|
224
|
+
return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions<
|
|
225
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
226
|
+
TError,
|
|
227
|
+
TData
|
|
228
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export type GetAllCapabilitiesSuspenseQueryResult = NonNullable<
|
|
232
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
233
|
+
>;
|
|
234
|
+
export type GetAllCapabilitiesSuspenseQueryError = ErrorType<void | AsError>;
|
|
235
|
+
|
|
236
|
+
export function useGetAllCapabilitiesSuspense<
|
|
237
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
238
|
+
TError = ErrorType<void | AsError>,
|
|
239
|
+
>(
|
|
240
|
+
options: {
|
|
241
|
+
query: Partial<
|
|
242
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
243
|
+
>;
|
|
244
|
+
request?: SecondParameter<typeof customFetch>;
|
|
245
|
+
},
|
|
246
|
+
queryClient?: QueryClient,
|
|
247
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
248
|
+
export function useGetAllCapabilitiesSuspense<
|
|
249
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
250
|
+
TError = ErrorType<void | AsError>,
|
|
251
|
+
>(
|
|
252
|
+
options?: {
|
|
253
|
+
query?: Partial<
|
|
254
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
255
|
+
>;
|
|
256
|
+
request?: SecondParameter<typeof customFetch>;
|
|
257
|
+
},
|
|
258
|
+
queryClient?: QueryClient,
|
|
259
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
260
|
+
export function useGetAllCapabilitiesSuspense<
|
|
261
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
262
|
+
TError = ErrorType<void | AsError>,
|
|
263
|
+
>(
|
|
264
|
+
options?: {
|
|
265
|
+
query?: Partial<
|
|
266
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
267
|
+
>;
|
|
268
|
+
request?: SecondParameter<typeof customFetch>;
|
|
269
|
+
},
|
|
270
|
+
queryClient?: QueryClient,
|
|
271
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
272
|
+
/**
|
|
273
|
+
* @summary Gets the Capabilities of all Organisations
|
|
274
|
+
*/
|
|
275
|
+
|
|
276
|
+
export function useGetAllCapabilitiesSuspense<
|
|
277
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
278
|
+
TError = ErrorType<void | AsError>,
|
|
279
|
+
>(
|
|
280
|
+
options?: {
|
|
281
|
+
query?: Partial<
|
|
282
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
283
|
+
>;
|
|
284
|
+
request?: SecondParameter<typeof customFetch>;
|
|
285
|
+
},
|
|
286
|
+
queryClient?: QueryClient,
|
|
287
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
288
|
+
const queryOptions = getGetAllCapabilitiesSuspenseQueryOptions(options);
|
|
289
|
+
|
|
290
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
291
|
+
TData,
|
|
292
|
+
TError
|
|
293
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
294
|
+
|
|
295
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
296
|
+
}
|
|
297
|
+
|
|
57
298
|
export type loadCapabilitiesResponse201 = { data: CapabilityPostResponse; status: 201 };
|
|
58
299
|
|
|
59
300
|
export type loadCapabilitiesResponse400 = { data: AsError; status: 400 };
|
|
@@ -28,6 +28,7 @@ import type {
|
|
|
28
28
|
} from "@tanstack/react-query";
|
|
29
29
|
|
|
30
30
|
import type {
|
|
31
|
+
AllCapabilitiesGetResponse,
|
|
31
32
|
AsError,
|
|
32
33
|
CapabilitiesGetResponse,
|
|
33
34
|
CapabilityPostBodyBody,
|
|
@@ -54,6 +55,225 @@ const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKe
|
|
|
54
55
|
return result;
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Gets the Capabilities of all the Organisations, indexed by Organisation. Organisations without Capabilities are not included.
|
|
60
|
+
*
|
|
61
|
+
* You need admin rights to use this path.
|
|
62
|
+
* @summary Gets the Capabilities of all Organisations
|
|
63
|
+
*/
|
|
64
|
+
export const getAllCapabilities = (
|
|
65
|
+
options?: SecondParameter<typeof customInstance>,
|
|
66
|
+
signal?: AbortSignal,
|
|
67
|
+
) => {
|
|
68
|
+
return customInstance<AllCapabilitiesGetResponse>(
|
|
69
|
+
{ url: `/capability`, method: "GET", signal },
|
|
70
|
+
options,
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const getGetAllCapabilitiesQueryKey = () => {
|
|
75
|
+
return ["account-server", "capability"] as const;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const getGetAllCapabilitiesQueryOptions = <
|
|
79
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
80
|
+
TError = ErrorType<void | AsError>,
|
|
81
|
+
>(options?: {
|
|
82
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
83
|
+
request?: SecondParameter<typeof customInstance>;
|
|
84
|
+
}) => {
|
|
85
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
86
|
+
|
|
87
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllCapabilitiesQueryKey();
|
|
88
|
+
|
|
89
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllCapabilities>>> = ({ signal }) =>
|
|
90
|
+
getAllCapabilities(requestOptions, signal);
|
|
91
|
+
|
|
92
|
+
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
|
93
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
94
|
+
TError,
|
|
95
|
+
TData
|
|
96
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type GetAllCapabilitiesQueryResult = NonNullable<
|
|
100
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
101
|
+
>;
|
|
102
|
+
export type GetAllCapabilitiesQueryError = ErrorType<void | AsError>;
|
|
103
|
+
|
|
104
|
+
export function useGetAllCapabilities<
|
|
105
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
106
|
+
TError = ErrorType<void | AsError>,
|
|
107
|
+
>(
|
|
108
|
+
options: {
|
|
109
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>> &
|
|
110
|
+
Pick<
|
|
111
|
+
DefinedInitialDataOptions<
|
|
112
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
113
|
+
TError,
|
|
114
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
115
|
+
>,
|
|
116
|
+
"initialData"
|
|
117
|
+
>;
|
|
118
|
+
request?: SecondParameter<typeof customInstance>;
|
|
119
|
+
},
|
|
120
|
+
queryClient?: QueryClient,
|
|
121
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
122
|
+
export function useGetAllCapabilities<
|
|
123
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
124
|
+
TError = ErrorType<void | AsError>,
|
|
125
|
+
>(
|
|
126
|
+
options?: {
|
|
127
|
+
query?: Partial<
|
|
128
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
129
|
+
> &
|
|
130
|
+
Pick<
|
|
131
|
+
UndefinedInitialDataOptions<
|
|
132
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
133
|
+
TError,
|
|
134
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
135
|
+
>,
|
|
136
|
+
"initialData"
|
|
137
|
+
>;
|
|
138
|
+
request?: SecondParameter<typeof customInstance>;
|
|
139
|
+
},
|
|
140
|
+
queryClient?: QueryClient,
|
|
141
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
142
|
+
export function useGetAllCapabilities<
|
|
143
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
144
|
+
TError = ErrorType<void | AsError>,
|
|
145
|
+
>(
|
|
146
|
+
options?: {
|
|
147
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
148
|
+
request?: SecondParameter<typeof customInstance>;
|
|
149
|
+
},
|
|
150
|
+
queryClient?: QueryClient,
|
|
151
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
152
|
+
/**
|
|
153
|
+
* @summary Gets the Capabilities of all Organisations
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
export function useGetAllCapabilities<
|
|
157
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
158
|
+
TError = ErrorType<void | AsError>,
|
|
159
|
+
>(
|
|
160
|
+
options?: {
|
|
161
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>>;
|
|
162
|
+
request?: SecondParameter<typeof customInstance>;
|
|
163
|
+
},
|
|
164
|
+
queryClient?: QueryClient,
|
|
165
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
166
|
+
const queryOptions = getGetAllCapabilitiesQueryOptions(options);
|
|
167
|
+
|
|
168
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
169
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @summary Gets the Capabilities of all Organisations
|
|
177
|
+
*/
|
|
178
|
+
export const invalidateGetAllCapabilities = async (
|
|
179
|
+
queryClient: QueryClient,
|
|
180
|
+
options?: InvalidateOptions,
|
|
181
|
+
): Promise<QueryClient> => {
|
|
182
|
+
await queryClient.invalidateQueries({ queryKey: getGetAllCapabilitiesQueryKey() }, options);
|
|
183
|
+
|
|
184
|
+
return queryClient;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const getGetAllCapabilitiesSuspenseQueryOptions = <
|
|
188
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
189
|
+
TError = ErrorType<void | AsError>,
|
|
190
|
+
>(options?: {
|
|
191
|
+
query?: Partial<
|
|
192
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
193
|
+
>;
|
|
194
|
+
request?: SecondParameter<typeof customInstance>;
|
|
195
|
+
}) => {
|
|
196
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
197
|
+
|
|
198
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllCapabilitiesQueryKey();
|
|
199
|
+
|
|
200
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllCapabilities>>> = ({ signal }) =>
|
|
201
|
+
getAllCapabilities(requestOptions, signal);
|
|
202
|
+
|
|
203
|
+
return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions<
|
|
204
|
+
Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
205
|
+
TError,
|
|
206
|
+
TData
|
|
207
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export type GetAllCapabilitiesSuspenseQueryResult = NonNullable<
|
|
211
|
+
Awaited<ReturnType<typeof getAllCapabilities>>
|
|
212
|
+
>;
|
|
213
|
+
export type GetAllCapabilitiesSuspenseQueryError = ErrorType<void | AsError>;
|
|
214
|
+
|
|
215
|
+
export function useGetAllCapabilitiesSuspense<
|
|
216
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
217
|
+
TError = ErrorType<void | AsError>,
|
|
218
|
+
>(
|
|
219
|
+
options: {
|
|
220
|
+
query: Partial<
|
|
221
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
222
|
+
>;
|
|
223
|
+
request?: SecondParameter<typeof customInstance>;
|
|
224
|
+
},
|
|
225
|
+
queryClient?: QueryClient,
|
|
226
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
227
|
+
export function useGetAllCapabilitiesSuspense<
|
|
228
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
229
|
+
TError = ErrorType<void | AsError>,
|
|
230
|
+
>(
|
|
231
|
+
options?: {
|
|
232
|
+
query?: Partial<
|
|
233
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
234
|
+
>;
|
|
235
|
+
request?: SecondParameter<typeof customInstance>;
|
|
236
|
+
},
|
|
237
|
+
queryClient?: QueryClient,
|
|
238
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
239
|
+
export function useGetAllCapabilitiesSuspense<
|
|
240
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
241
|
+
TError = ErrorType<void | AsError>,
|
|
242
|
+
>(
|
|
243
|
+
options?: {
|
|
244
|
+
query?: Partial<
|
|
245
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
246
|
+
>;
|
|
247
|
+
request?: SecondParameter<typeof customInstance>;
|
|
248
|
+
},
|
|
249
|
+
queryClient?: QueryClient,
|
|
250
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
251
|
+
/**
|
|
252
|
+
* @summary Gets the Capabilities of all Organisations
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
export function useGetAllCapabilitiesSuspense<
|
|
256
|
+
TData = Awaited<ReturnType<typeof getAllCapabilities>>,
|
|
257
|
+
TError = ErrorType<void | AsError>,
|
|
258
|
+
>(
|
|
259
|
+
options?: {
|
|
260
|
+
query?: Partial<
|
|
261
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllCapabilities>>, TError, TData>
|
|
262
|
+
>;
|
|
263
|
+
request?: SecondParameter<typeof customInstance>;
|
|
264
|
+
},
|
|
265
|
+
queryClient?: QueryClient,
|
|
266
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
267
|
+
const queryOptions = getGetAllCapabilitiesSuspenseQueryOptions(options);
|
|
268
|
+
|
|
269
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
270
|
+
TData,
|
|
271
|
+
TError
|
|
272
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
273
|
+
|
|
274
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
275
|
+
}
|
|
276
|
+
|
|
57
277
|
/**
|
|
58
278
|
* Loads the Capabilities defined in a YAML file against an Organisation. Several Capabilities can be loaded at once by concatenating their definitions (as separate YAML documents). Either all the Capabilities in the file are loaded or none of them are.
|
|
59
279
|
*
|