@squonk/account-server-client 0.1.7-rc.1 → 0.1.8-rc.1

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 (42) hide show
  1. package/{custom-instance-0d593da2.d.ts → custom-instance-cc5da68e.d.ts} +12 -5
  2. package/index.cjs +103 -2
  3. package/index.cjs.map +3 -3
  4. package/index.d.ts +1 -1
  5. package/index.js +69 -2
  6. package/index.js.map +3 -3
  7. package/organisation/organisation.cjs +111 -2
  8. package/organisation/organisation.cjs.map +3 -3
  9. package/organisation/organisation.d.ts +19 -5
  10. package/organisation/organisation.js +83 -2
  11. package/organisation/organisation.js.map +3 -3
  12. package/organisation/package.json +2 -1
  13. package/package.json +7 -7
  14. package/product/package.json +2 -1
  15. package/product/product.cjs +161 -2
  16. package/product/product.cjs.map +3 -3
  17. package/product/product.d.ts +2 -2
  18. package/product/product.js +127 -2
  19. package/product/product.js.map +3 -3
  20. package/src/account-server-api.schemas.ts +278 -0
  21. package/src/custom-instance.ts +52 -0
  22. package/src/index.ts +6 -0
  23. package/src/organisation/organisation.ts +181 -0
  24. package/src/product/product.ts +289 -0
  25. package/src/unit/unit.ts +322 -0
  26. package/src/user/user.ts +340 -0
  27. package/unit/package.json +2 -1
  28. package/unit/unit.cjs +168 -2
  29. package/unit/unit.cjs.map +3 -3
  30. package/unit/unit.d.ts +52 -3
  31. package/unit/unit.js +133 -2
  32. package/unit/unit.js.map +3 -3
  33. package/user/package.json +2 -1
  34. package/user/user.cjs +176 -2
  35. package/user/user.cjs.map +3 -3
  36. package/user/user.d.ts +7 -7
  37. package/user/user.js +141 -2
  38. package/user/user.js.map +3 -3
  39. package/chunk-33VR3IML.js +0 -2
  40. package/chunk-33VR3IML.js.map +0 -7
  41. package/chunk-3KO3PKBX.cjs +0 -2
  42. package/chunk-3KO3PKBX.cjs.map +0 -7
@@ -0,0 +1,340 @@
1
+ /**
2
+ * Generated by orval v6.4.2 🍺
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 **Products**, **Organisations**, **Units** and **Users**.
8
+
9
+ * OpenAPI spec version: 0.1
10
+ */
11
+ import {
12
+ useQuery,
13
+ useMutation,
14
+ UseQueryOptions,
15
+ UseMutationOptions,
16
+ QueryFunction,
17
+ MutationFunction,
18
+ UseQueryResult,
19
+ QueryKey,
20
+ } from "react-query";
21
+ import type { UsersGetResponse, AsError } from "../account-server-api.schemas";
22
+ import { customInstance, ErrorType } from ".././custom-instance";
23
+
24
+ type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
25
+ ...args: any
26
+ ) => Promise<infer R>
27
+ ? R
28
+ : any;
29
+
30
+ type SecondParameter<T extends (...args: any) => any> = T extends (
31
+ config: any,
32
+ args: infer P
33
+ ) => any
34
+ ? P
35
+ : never;
36
+
37
+ /**
38
+ * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint
39
+
40
+ * @summary Gets users in an organisation
41
+ */
42
+ export const getOrganisationUsers = (
43
+ orgid: string,
44
+ options?: SecondParameter<typeof customInstance>
45
+ ) => {
46
+ return customInstance<UsersGetResponse>(
47
+ { url: `/organisation/${orgid}/user`, method: "get" },
48
+ options
49
+ );
50
+ };
51
+
52
+ export const getGetOrganisationUsersQueryKey = (orgid: string) => [
53
+ `/organisation/${orgid}/user`,
54
+ ];
55
+
56
+ export const useGetOrganisationUsers = <
57
+ TData = AsyncReturnType<typeof getOrganisationUsers>,
58
+ TError = ErrorType<AsError | void>
59
+ >(
60
+ orgid: string,
61
+ options?: {
62
+ query?: UseQueryOptions<
63
+ AsyncReturnType<typeof getOrganisationUsers>,
64
+ TError,
65
+ TData
66
+ >;
67
+ request?: SecondParameter<typeof customInstance>;
68
+ }
69
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
70
+ const { query: queryOptions, request: requestOptions } = options || {};
71
+
72
+ const queryKey =
73
+ queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgid);
74
+
75
+ const queryFn: QueryFunction<
76
+ AsyncReturnType<typeof getOrganisationUsers>
77
+ > = () => getOrganisationUsers(orgid, requestOptions);
78
+
79
+ const query = useQuery<
80
+ AsyncReturnType<typeof getOrganisationUsers>,
81
+ TError,
82
+ TData
83
+ >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });
84
+
85
+ return {
86
+ queryKey,
87
+ ...query,
88
+ };
89
+ };
90
+
91
+ /**
92
+ * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint
93
+
94
+ * @summary Adds a user to an organisation
95
+ */
96
+ export const addOrganisationUser = (
97
+ orgid: string,
98
+ userid: string,
99
+ options?: SecondParameter<typeof customInstance>
100
+ ) => {
101
+ return customInstance<void>(
102
+ {
103
+ url: `/organisation/${orgid}/user/${userid}`,
104
+ method: "put",
105
+ data: undefined,
106
+ },
107
+ options
108
+ );
109
+ };
110
+
111
+ export const useAddOrganisationUser = <
112
+ TError = ErrorType<AsError>,
113
+ TContext = unknown
114
+ >(options?: {
115
+ mutation?: UseMutationOptions<
116
+ AsyncReturnType<typeof addOrganisationUser>,
117
+ TError,
118
+ { orgid: string; userid: string },
119
+ TContext
120
+ >;
121
+ request?: SecondParameter<typeof customInstance>;
122
+ }) => {
123
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
124
+
125
+ const mutationFn: MutationFunction<
126
+ AsyncReturnType<typeof addOrganisationUser>,
127
+ { orgid: string; userid: string }
128
+ > = (props) => {
129
+ const { orgid, userid } = props || {};
130
+
131
+ return addOrganisationUser(orgid, userid, requestOptions);
132
+ };
133
+
134
+ return useMutation<
135
+ AsyncReturnType<typeof addOrganisationUser>,
136
+ TError,
137
+ { orgid: string; userid: string },
138
+ TContext
139
+ >(mutationFn, mutationOptions);
140
+ };
141
+ /**
142
+ * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint
143
+
144
+ * @summary Deletes a user from an organisation
145
+ */
146
+ export const deleteOrganisationUser = (
147
+ orgid: string,
148
+ userid: string,
149
+ options?: SecondParameter<typeof customInstance>
150
+ ) => {
151
+ return customInstance<void>(
152
+ {
153
+ url: `/organisation/${orgid}/user/${userid}`,
154
+ method: "delete",
155
+ data: undefined,
156
+ },
157
+ options
158
+ );
159
+ };
160
+
161
+ export const useDeleteOrganisationUser = <
162
+ TError = ErrorType<AsError>,
163
+ TContext = unknown
164
+ >(options?: {
165
+ mutation?: UseMutationOptions<
166
+ AsyncReturnType<typeof deleteOrganisationUser>,
167
+ TError,
168
+ { orgid: string; userid: string },
169
+ TContext
170
+ >;
171
+ request?: SecondParameter<typeof customInstance>;
172
+ }) => {
173
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
174
+
175
+ const mutationFn: MutationFunction<
176
+ AsyncReturnType<typeof deleteOrganisationUser>,
177
+ { orgid: string; userid: string }
178
+ > = (props) => {
179
+ const { orgid, userid } = props || {};
180
+
181
+ return deleteOrganisationUser(orgid, userid, requestOptions);
182
+ };
183
+
184
+ return useMutation<
185
+ AsyncReturnType<typeof deleteOrganisationUser>,
186
+ TError,
187
+ { orgid: string; userid: string },
188
+ TContext
189
+ >(mutationFn, mutationOptions);
190
+ };
191
+ /**
192
+ * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
193
+
194
+ * @summary Gets users in an Organisational Unit
195
+ */
196
+ export const getOrganisationUnitUsers = (
197
+ unitid: string,
198
+ options?: SecondParameter<typeof customInstance>
199
+ ) => {
200
+ return customInstance<UsersGetResponse>(
201
+ { url: `/unit/${unitid}/user`, method: "get" },
202
+ options
203
+ );
204
+ };
205
+
206
+ export const getGetOrganisationUnitUsersQueryKey = (unitid: string) => [
207
+ `/unit/${unitid}/user`,
208
+ ];
209
+
210
+ export const useGetOrganisationUnitUsers = <
211
+ TData = AsyncReturnType<typeof getOrganisationUnitUsers>,
212
+ TError = ErrorType<AsError | void>
213
+ >(
214
+ unitid: string,
215
+ options?: {
216
+ query?: UseQueryOptions<
217
+ AsyncReturnType<typeof getOrganisationUnitUsers>,
218
+ TError,
219
+ TData
220
+ >;
221
+ request?: SecondParameter<typeof customInstance>;
222
+ }
223
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
224
+ const { query: queryOptions, request: requestOptions } = options || {};
225
+
226
+ const queryKey =
227
+ queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitid);
228
+
229
+ const queryFn: QueryFunction<
230
+ AsyncReturnType<typeof getOrganisationUnitUsers>
231
+ > = () => getOrganisationUnitUsers(unitid, requestOptions);
232
+
233
+ const query = useQuery<
234
+ AsyncReturnType<typeof getOrganisationUnitUsers>,
235
+ TError,
236
+ TData
237
+ >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });
238
+
239
+ return {
240
+ queryKey,
241
+ ...query,
242
+ };
243
+ };
244
+
245
+ /**
246
+ * Adds a user to an Organisationall Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
247
+
248
+ * @summary Adds a user to an Organisational Unit
249
+ */
250
+ export const addOrganisationUnitUser = (
251
+ unitid: string,
252
+ userid: string,
253
+ options?: SecondParameter<typeof customInstance>
254
+ ) => {
255
+ return customInstance<void>(
256
+ { url: `/unit/${unitid}/user/${userid}`, method: "put", data: undefined },
257
+ options
258
+ );
259
+ };
260
+
261
+ export const useAddOrganisationUnitUser = <
262
+ TError = ErrorType<AsError>,
263
+ TContext = unknown
264
+ >(options?: {
265
+ mutation?: UseMutationOptions<
266
+ AsyncReturnType<typeof addOrganisationUnitUser>,
267
+ TError,
268
+ { unitid: string; userid: string },
269
+ TContext
270
+ >;
271
+ request?: SecondParameter<typeof customInstance>;
272
+ }) => {
273
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
274
+
275
+ const mutationFn: MutationFunction<
276
+ AsyncReturnType<typeof addOrganisationUnitUser>,
277
+ { unitid: string; userid: string }
278
+ > = (props) => {
279
+ const { unitid, userid } = props || {};
280
+
281
+ return addOrganisationUnitUser(unitid, userid, requestOptions);
282
+ };
283
+
284
+ return useMutation<
285
+ AsyncReturnType<typeof addOrganisationUnitUser>,
286
+ TError,
287
+ { unitid: string; userid: string },
288
+ TContext
289
+ >(mutationFn, mutationOptions);
290
+ };
291
+ /**
292
+ * Removes a user from an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
293
+
294
+ * @summary Deletes a user from an Organisational Unit
295
+ */
296
+ export const deleteOrganisationUnitUser = (
297
+ unitid: string,
298
+ userid: string,
299
+ options?: SecondParameter<typeof customInstance>
300
+ ) => {
301
+ return customInstance<void>(
302
+ {
303
+ url: `/unit/${unitid}/user/${userid}`,
304
+ method: "delete",
305
+ data: undefined,
306
+ },
307
+ options
308
+ );
309
+ };
310
+
311
+ export const useDeleteOrganisationUnitUser = <
312
+ TError = ErrorType<AsError>,
313
+ TContext = unknown
314
+ >(options?: {
315
+ mutation?: UseMutationOptions<
316
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
317
+ TError,
318
+ { unitid: string; userid: string },
319
+ TContext
320
+ >;
321
+ request?: SecondParameter<typeof customInstance>;
322
+ }) => {
323
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
324
+
325
+ const mutationFn: MutationFunction<
326
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
327
+ { unitid: string; userid: string }
328
+ > = (props) => {
329
+ const { unitid, userid } = props || {};
330
+
331
+ return deleteOrganisationUnitUser(unitid, userid, requestOptions);
332
+ };
333
+
334
+ return useMutation<
335
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
336
+ TError,
337
+ { unitid: string; userid: string },
338
+ TContext
339
+ >(mutationFn, mutationOptions);
340
+ };
package/unit/package.json CHANGED
@@ -2,5 +2,6 @@
2
2
  "module": "./unit.js",
3
3
  "main": "./unit.cjs",
4
4
  "types": "./unit.d.ts",
5
- "sideEffects": false
5
+ "sideEffects": false,
6
+ "type": "module"
6
7
  }
package/unit/unit.cjs CHANGED
@@ -1,2 +1,168 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3KO3PKBXcjs = require('../chunk-3KO3PKBX.cjs');var _reactquery = require('react-query');var p=(t,e)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/organisation/${t}/unit`,method:"get"},e),d= exports.getGetOrganisationUnitsQueryKey =t=>[`/organisation/${t}/unit`],B= exports.useGetOrganisationUnits =(t,e)=>{var u;let{query:n,request:i}=e||{},r=(u=n==null?void 0:n.queryKey)!=null?u:d(t),o=_reactquery.useQuery.call(void 0, r,()=>p(t,i),_chunk3KO3PKBXcjs.a.call(void 0, {enabled:!!t},n));return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:r},o)},T= exports.createOrganisationUnit =(t,e,n)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/organisation/${t}/unit`,method:"post",data:e},n),Q= exports.useCreateOrganisationUnit =t=>{let{mutation:e,request:n}=t||{};return _reactquery.useMutation.call(void 0, r=>{let{orgid:y,data:o}=r||{};return T(y,o,n)},e)};exports.createOrganisationUnit = T; exports.getGetOrganisationUnitsQueryKey = d; exports.getOrganisationUnits = p; exports.useCreateOrganisationUnit = Q; exports.useGetOrganisationUnits = B;
2
- //# sourceMappingURL=unit.cjs.map
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ __markAsModule(target);
27
+ for (var name in all)
28
+ __defProp(target, name, { get: all[name], enumerable: true });
29
+ };
30
+ var __reExport = (target, module2, desc) => {
31
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
+ for (let key of __getOwnPropNames(module2))
33
+ if (!__hasOwnProp.call(target, key) && key !== "default")
34
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
+ }
36
+ return target;
37
+ };
38
+ var __toModule = (module2) => {
39
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
+ };
41
+
42
+ // src/unit/unit.ts
43
+ __export(exports, {
44
+ createDefaultUnit: () => createDefaultUnit,
45
+ createOrganisationUnit: () => createOrganisationUnit,
46
+ deleteDefaultUnit: () => deleteDefaultUnit,
47
+ deleteOrganisationUnit: () => deleteOrganisationUnit,
48
+ getGetOrganisationUnitsQueryKey: () => getGetOrganisationUnitsQueryKey,
49
+ getGetUnitsQueryKey: () => getGetUnitsQueryKey,
50
+ getOrganisationUnits: () => getOrganisationUnits,
51
+ getUnits: () => getUnits,
52
+ useCreateDefaultUnit: () => useCreateDefaultUnit,
53
+ useCreateOrganisationUnit: () => useCreateOrganisationUnit,
54
+ useDeleteDefaultUnit: () => useDeleteDefaultUnit,
55
+ useDeleteOrganisationUnit: () => useDeleteOrganisationUnit,
56
+ useGetOrganisationUnits: () => useGetOrganisationUnits,
57
+ useGetUnits: () => useGetUnits
58
+ });
59
+ var import_react_query = __toModule(require("react-query"));
60
+
61
+ // src/custom-instance.ts
62
+ var import_axios = __toModule(require("axios"));
63
+ var AXIOS_INSTANCE = import_axios.default.create({ baseURL: "" });
64
+ var customInstance = (config, options) => {
65
+ const source = import_axios.default.CancelToken.source();
66
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
67
+ promise.cancel = () => {
68
+ source.cancel("Query was cancelled by React Query");
69
+ };
70
+ return promise;
71
+ };
72
+
73
+ // src/unit/unit.ts
74
+ var getOrganisationUnits = (orgid, options) => {
75
+ return customInstance({ url: `/organisation/${orgid}/unit`, method: "get" }, options);
76
+ };
77
+ var getGetOrganisationUnitsQueryKey = (orgid) => [
78
+ `/organisation/${orgid}/unit`
79
+ ];
80
+ var useGetOrganisationUnits = (orgid, options) => {
81
+ const { query: queryOptions, request: requestOptions } = options || {};
82
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgid);
83
+ const queryFn = () => getOrganisationUnits(orgid, requestOptions);
84
+ const query = (0, import_react_query.useQuery)(queryKey, queryFn, __spreadValues({ enabled: !!orgid }, queryOptions));
85
+ return __spreadValues({
86
+ queryKey
87
+ }, query);
88
+ };
89
+ var createOrganisationUnit = (orgid, organisationUnitPostBodyBody, options) => {
90
+ return customInstance({
91
+ url: `/organisation/${orgid}/unit`,
92
+ method: "post",
93
+ data: organisationUnitPostBodyBody
94
+ }, options);
95
+ };
96
+ var useCreateOrganisationUnit = (options) => {
97
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
98
+ const mutationFn = (props) => {
99
+ const { orgid, data } = props || {};
100
+ return createOrganisationUnit(orgid, data, requestOptions);
101
+ };
102
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
103
+ };
104
+ var deleteOrganisationUnit = (orgid, unitid, options) => {
105
+ return customInstance({
106
+ url: `/organisation/${orgid}/unit/${unitid}`,
107
+ method: "delete",
108
+ data: void 0
109
+ }, options);
110
+ };
111
+ var useDeleteOrganisationUnit = (options) => {
112
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
113
+ const mutationFn = (props) => {
114
+ const { orgid, unitid } = props || {};
115
+ return deleteOrganisationUnit(orgid, unitid, requestOptions);
116
+ };
117
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
118
+ };
119
+ var getUnits = (options) => {
120
+ return customInstance({ url: `/unit`, method: "get" }, options);
121
+ };
122
+ var getGetUnitsQueryKey = () => [`/unit`];
123
+ var useGetUnits = (options) => {
124
+ const { query: queryOptions, request: requestOptions } = options || {};
125
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitsQueryKey();
126
+ const queryFn = () => getUnits(requestOptions);
127
+ const query = (0, import_react_query.useQuery)(queryKey, queryFn, queryOptions);
128
+ return __spreadValues({
129
+ queryKey
130
+ }, query);
131
+ };
132
+ var createDefaultUnit = (options) => {
133
+ return customInstance({ url: `/unit`, method: "put", data: void 0 }, options);
134
+ };
135
+ var useCreateDefaultUnit = (options) => {
136
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
137
+ const mutationFn = () => {
138
+ return createDefaultUnit(requestOptions);
139
+ };
140
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
141
+ };
142
+ var deleteDefaultUnit = (options) => {
143
+ return customInstance({ url: `/unit`, method: "delete", data: void 0 }, options);
144
+ };
145
+ var useDeleteDefaultUnit = (options) => {
146
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
147
+ const mutationFn = () => {
148
+ return deleteDefaultUnit(requestOptions);
149
+ };
150
+ return (0, import_react_query.useMutation)(mutationFn, mutationOptions);
151
+ };
152
+ // Annotate the CommonJS export names for ESM import in node:
153
+ 0 && (module.exports = {
154
+ createDefaultUnit,
155
+ createOrganisationUnit,
156
+ deleteDefaultUnit,
157
+ deleteOrganisationUnit,
158
+ getGetOrganisationUnitsQueryKey,
159
+ getGetUnitsQueryKey,
160
+ getOrganisationUnits,
161
+ getUnits,
162
+ useCreateDefaultUnit,
163
+ useCreateOrganisationUnit,
164
+ useDeleteDefaultUnit,
165
+ useDeleteOrganisationUnit,
166
+ useGetOrganisationUnits,
167
+ useGetUnits
168
+ });
package/unit/unit.cjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/unit/unit.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\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 **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 Organisational Units you have access to\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgid}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgid: string) => [\n `/organisation/${orgid}/unit`,\n];\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\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 ?? getGetOrganisationUnitsQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgid: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgid}/unit`,\n method: \"post\",\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgid: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgid, data } = props || {};\n\n return createOrganisationUnit(orgid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],
5
- "mappings": "iDAUA,wDAoCO,GAAM,GAAuB,CAClC,EACA,IAEO,EACL,CAAE,IAAK,iBAAiB,SAAc,OAAQ,OAC9C,GAIS,EAAkC,AAAC,GAAkB,CAChE,iBAAiB,UAGN,EAA0B,CAIrC,EACA,IAQ2D,CAzE7D,MA0EE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAAgC,GAMtD,EAAQ,EAIZ,EANE,IAAM,EAAqB,EAAO,GAMjB,GAAE,QAAS,CAAC,CAAC,GAAU,IAE5C,MAAO,IACL,YACG,IASM,EAAyB,CACpC,EACA,EACA,IAEO,EACL,CACE,IAAK,iBAAiB,SACtB,OAAQ,OACR,KAAM,GAER,GAIS,EAA4B,AAGvC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,QAAO,QAAS,GAAS,GAEjC,MAAO,GAAuB,EAAO,EAAM,IAQ/B",
3
+ "sources": ["../../src/unit/unit.ts", "../../src/custom-instance.ts"],
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\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: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitsGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 Organisational Units you have access to\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgid}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgid: string) => [\n `/organisation/${orgid}/unit`,\n];\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\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 ?? getGetOrganisationUnitsQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be inthe Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgid: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgid}/unit`,\n method: \"post\",\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgid: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgid, data } = props || {};\n\n return createOrganisationUnit(orgid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgid: string,\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/organisation/${orgid}/unit/${unitid}`,\n method: \"delete\",\n data: undefined,\n },\n options\n );\n};\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgid: string; unitid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n { orgid: string; unitid: string }\n > = (props) => {\n const { orgid, unitid } = props || {};\n\n return deleteOrganisationUnit(orgid, unitid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgid: string; unitid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units you are a member of. Admin users can see all Units\n\n * @summary Gets Units a User has access to\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a Unit for an independent User. The unit will belong to the built-in **Default** Organisation. Users can only have one Independent Unit and Independent Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n { url: `/unit`, method: \"put\", data: undefined },\n options\n );\n};\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an Independent Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit`, method: \"delete\", data: undefined },\n options\n );\n};\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
package/unit/unit.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_query from 'react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
3
- import { G as customInstance, y as OrganisationUnitsGetResponse, H as ErrorType, C as AsError, O as OrganisationUnitPostBodyBody, z as OrganisationUnitPostResponse } from '../custom-instance-0d593da2';
3
+ import { H as customInstance, z as OrganisationUnitsGetResponse, I as ErrorType, D as AsError, O as OrganisationUnitPostBodyBody, A as OrganisationUnitPostResponse, s as UnitsGetResponse } from '../custom-instance-cc5da68e';
4
4
  import 'axios';
5
5
 
6
6
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
@@ -18,7 +18,7 @@ declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TE
18
18
  queryKey: QueryKey;
19
19
  };
20
20
  /**
21
- * Creates a new organisation unit
21
+ * Creates a new organisation unit. You need to be inthe Organisation or an Admin user to use this endpoint
22
22
 
23
23
  * @summary Create a new Organisational Unit
24
24
  */
@@ -33,5 +33,54 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
33
33
  orgid: string;
34
34
  data: OrganisationUnitPostBodyBody;
35
35
  }, TContext>;
36
+ /**
37
+ * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products
38
+
39
+ * @summary Deletes an Organisational Unit
40
+ */
41
+ declare const deleteOrganisationUnit: (orgid: string, unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
42
+ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
43
+ mutation?: UseMutationOptions<void, TError, {
44
+ orgid: string;
45
+ unitid: string;
46
+ }, TContext> | undefined;
47
+ request?: SecondParameter<typeof customInstance>;
48
+ } | undefined) => react_query.UseMutationResult<void, TError, {
49
+ orgid: string;
50
+ unitid: string;
51
+ }, TContext>;
52
+ /**
53
+ * Gets all the Units you are a member of. Admin users can see all Units
54
+
55
+ * @summary Gets Units a User has access to
56
+ */
57
+ declare const getUnits: (options?: SecondParameter<typeof customInstance>) => Promise<UnitsGetResponse>;
58
+ declare const getGetUnitsQueryKey: () => string[];
59
+ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
60
+ query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
61
+ request?: SecondParameter<typeof customInstance>;
62
+ } | undefined) => UseQueryResult<TData, TError> & {
63
+ queryKey: QueryKey;
64
+ };
65
+ /**
66
+ * Creates a Unit for an independent User. The unit will belong to the built-in **Default** Organisation. Users can only have one Independent Unit and Independent Units cannot have other Users
67
+
68
+ * @summary Create a new Independent User Unit
69
+ */
70
+ declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
71
+ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariables = void, TContext = unknown>(options?: {
72
+ mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, TVariables, TContext> | undefined;
73
+ request?: SecondParameter<typeof customInstance>;
74
+ } | undefined) => react_query.UseMutationResult<OrganisationUnitPostResponse, TError, TVariables, TContext>;
75
+ /**
76
+ * Deletes an Independent Unit. It must be your Unit, which belongs to the Default Organisation
77
+
78
+ * @summary Deletes an Independent Unit
79
+ */
80
+ declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
81
+ declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
82
+ mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
83
+ request?: SecondParameter<typeof customInstance>;
84
+ } | undefined) => react_query.UseMutationResult<void, TError, TVariables, TContext>;
36
85
 
37
- export { createOrganisationUnit, getGetOrganisationUnitsQueryKey, getOrganisationUnits, useCreateOrganisationUnit, useGetOrganisationUnits };
86
+ export { createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnits };