@squonk/account-server-client 0.1.38-rc.1 → 1.0.0-rc.3

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 (57) hide show
  1. package/asset/asset.cjs +39 -14
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.ts +1 -3
  4. package/asset/asset.js +39 -14
  5. package/asset/asset.js.map +1 -1
  6. package/chunk-3O5KIRV4.js +27 -0
  7. package/{chunk-3TENYKS7.js.map → chunk-3O5KIRV4.js.map} +1 -1
  8. package/chunk-IUEU2LYC.cjs +27 -0
  9. package/chunk-IUEU2LYC.cjs.map +1 -0
  10. package/{custom-instance-00382740.d.ts → custom-instance-b8075093.d.ts} +92 -15
  11. package/index.cjs +11 -2
  12. package/index.cjs.map +1 -1
  13. package/index.d.ts +1 -1
  14. package/index.js +10 -1
  15. package/index.js.map +1 -1
  16. package/merchant/merchant.cjs +14 -5
  17. package/merchant/merchant.cjs.map +1 -1
  18. package/merchant/merchant.d.ts +1 -3
  19. package/merchant/merchant.js +14 -5
  20. package/merchant/merchant.js.map +1 -1
  21. package/organisation/organisation.cjs +22 -10
  22. package/organisation/organisation.cjs.map +1 -1
  23. package/organisation/organisation.d.ts +1 -3
  24. package/organisation/organisation.js +22 -10
  25. package/organisation/organisation.js.map +1 -1
  26. package/package.json +3 -4
  27. package/product/product.cjs +75 -26
  28. package/product/product.cjs.map +1 -1
  29. package/product/product.d.ts +22 -4
  30. package/product/product.js +74 -25
  31. package/product/product.js.map +1 -1
  32. package/src/account-server-api.schemas.ts +109 -14
  33. package/src/asset/asset.ts +2 -6
  34. package/src/merchant/merchant.ts +2 -6
  35. package/src/organisation/organisation.ts +2 -6
  36. package/src/product/product.ts +74 -6
  37. package/src/state/state.ts +2 -6
  38. package/src/unit/unit.ts +4 -8
  39. package/src/user/user.ts +4 -8
  40. package/state/state.cjs +10 -3
  41. package/state/state.cjs.map +1 -1
  42. package/state/state.d.ts +1 -3
  43. package/state/state.js +10 -3
  44. package/state/state.js.map +1 -1
  45. package/unit/unit.cjs +42 -17
  46. package/unit/unit.cjs.map +1 -1
  47. package/unit/unit.d.ts +3 -5
  48. package/unit/unit.js +41 -16
  49. package/unit/unit.js.map +1 -1
  50. package/user/user.cjs +34 -13
  51. package/user/user.cjs.map +1 -1
  52. package/user/user.d.ts +3 -5
  53. package/user/user.js +34 -13
  54. package/user/user.js.map +1 -1
  55. package/chunk-3TENYKS7.js +0 -46
  56. package/chunk-RHHRF25R.cjs +0 -46
  57. package/chunk-RHHRF25R.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
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
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery, useMutation } from "react-query";
12
12
  import type {
@@ -25,14 +25,12 @@ import type {
25
25
  UnitProductPostBodyBody,
26
26
  ProductUnitGetResponse,
27
27
  ProductPatchBodyBody,
28
+ ProductChargesGetResponse,
29
+ GetProductChargesParams,
28
30
  } from "../account-server-api.schemas";
29
31
  import { customInstance } from ".././custom-instance";
30
32
  import type { ErrorType } from ".././custom-instance";
31
33
 
32
- type AwaitedInput<T> = PromiseLike<T> | T;
33
-
34
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
34
  // eslint-disable-next-line
37
35
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
36
  config: any,
@@ -498,3 +496,73 @@ export const usePatchProduct = <
498
496
  TContext
499
497
  >(mutationFn, mutationOptions);
500
498
  };
499
+ /**
500
+ * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
501
+
502
+ Dates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.
503
+
504
+ **from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`.
505
+
506
+ You need **admin** rights to use this method
507
+ * @summary Get charges made against a Product
508
+ */
509
+ export const getProductCharges = (
510
+ productId: string,
511
+ params?: GetProductChargesParams,
512
+ options?: SecondParameter<typeof customInstance>,
513
+ signal?: AbortSignal
514
+ ) => {
515
+ return customInstance<ProductChargesGetResponse>(
516
+ { url: `/product/${productId}/charges`, method: "get", params, signal },
517
+ options
518
+ );
519
+ };
520
+
521
+ export const getGetProductChargesQueryKey = (
522
+ productId: string,
523
+ params?: GetProductChargesParams
524
+ ) => [`/product/${productId}/charges`, ...(params ? [params] : [])];
525
+
526
+ export type GetProductChargesQueryResult = NonNullable<
527
+ Awaited<ReturnType<typeof getProductCharges>>
528
+ >;
529
+ export type GetProductChargesQueryError = ErrorType<AsError | void>;
530
+
531
+ export const useGetProductCharges = <
532
+ TData = Awaited<ReturnType<typeof getProductCharges>>,
533
+ TError = ErrorType<AsError | void>
534
+ >(
535
+ productId: string,
536
+ params?: GetProductChargesParams,
537
+ options?: {
538
+ query?: UseQueryOptions<
539
+ Awaited<ReturnType<typeof getProductCharges>>,
540
+ TError,
541
+ TData
542
+ >;
543
+ request?: SecondParameter<typeof customInstance>;
544
+ }
545
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
546
+ const { query: queryOptions, request: requestOptions } = options ?? {};
547
+
548
+ const queryKey =
549
+ queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);
550
+
551
+ const queryFn: QueryFunction<
552
+ Awaited<ReturnType<typeof getProductCharges>>
553
+ > = ({ signal }) =>
554
+ getProductCharges(productId, params, requestOptions, signal);
555
+
556
+ const query = useQuery<
557
+ Awaited<ReturnType<typeof getProductCharges>>,
558
+ TError,
559
+ TData
560
+ >(queryKey, queryFn, {
561
+ enabled: !!productId,
562
+ ...queryOptions,
563
+ }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
564
+
565
+ query.queryKey = queryKey;
566
+
567
+ return query;
568
+ };
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
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
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery } from "react-query";
12
12
  import type {
@@ -22,10 +22,6 @@ import type {
22
22
  import { customInstance } from ".././custom-instance";
23
23
  import type { ErrorType } from ".././custom-instance";
24
24
 
25
- type AwaitedInput<T> = PromiseLike<T> | T;
26
-
27
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
28
-
29
25
  // eslint-disable-next-line
30
26
  type SecondParameter<T extends (...args: any) => any> = T extends (
31
27
  config: any,
package/src/unit/unit.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
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
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery, useMutation } from "react-query";
12
12
  import type {
@@ -29,10 +29,6 @@ import type {
29
29
  import { customInstance } from ".././custom-instance";
30
30
  import type { ErrorType } from ".././custom-instance";
31
31
 
32
- type AwaitedInput<T> = PromiseLike<T> | T;
33
-
34
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
32
  // eslint-disable-next-line
37
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
34
  config: any,
@@ -314,7 +310,7 @@ export const useGetUnits = <
314
310
  /**
315
311
  * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users
316
312
 
317
- * @summary Create a new Independent User Unit
313
+ * @summary Create a new Personal Unit
318
314
  */
319
315
  export const createDefaultUnit = (
320
316
  options?: SecondParameter<typeof customInstance>
@@ -363,7 +359,7 @@ export const useCreateDefaultUnit = <
363
359
  /**
364
360
  * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
365
361
 
366
- * @summary Deletes an Independent Unit
362
+ * @summary Deletes a Personal Unit
367
363
  */
368
364
  export const deleteDefaultUnit = (
369
365
  options?: SecondParameter<typeof customInstance>
package/src/user/user.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
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
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery, useMutation } from "react-query";
12
12
  import type {
@@ -25,10 +25,6 @@ import type {
25
25
  import { customInstance } from ".././custom-instance";
26
26
  import type { ErrorType } from ".././custom-instance";
27
27
 
28
- type AwaitedInput<T> = PromiseLike<T> | T;
29
-
30
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
31
-
32
28
  // eslint-disable-next-line
33
29
  type SecondParameter<T extends (...args: any) => any> = T extends (
34
30
  config: any,
@@ -322,7 +318,7 @@ export const useGetOrganisationUnitUsers = <
322
318
  /**
323
319
  * Adds a user to an Organisational Unit.
324
320
 
325
- Users cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).
321
+ Users cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).
326
322
 
327
323
  You have to be in the Organisation or Unit or an Admin user to use this endpoint
328
324
 
@@ -378,7 +374,7 @@ export const useAddOrganisationUnitUser = <
378
374
  /**
379
375
  * Removes a user from an Organisational Unit.
380
376
 
381
- Users cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).
377
+ Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
382
378
 
383
379
  You have to be in the Organisation or Unit or an Admin user to use this endpoint
384
380
 
package/state/state.cjs CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
3
+ var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
4
4
 
5
5
  // src/state/state.ts
6
6
  var _reactquery = require('react-query');
7
7
  var getVersion = (options, signal) => {
8
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/version`, method: "get", signal }, options);
8
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
9
+ { url: `/version`, method: "get", signal },
10
+ options
11
+ );
9
12
  };
10
13
  var getGetVersionQueryKey = () => [`/version`];
11
14
  var useGetVersion = (options) => {
@@ -14,7 +17,11 @@ var useGetVersion = (options) => {
14
17
  const queryFn = ({
15
18
  signal
16
19
  }) => getVersion(requestOptions, signal);
17
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
20
+ const query = _reactquery.useQuery.call(void 0,
21
+ queryKey,
22
+ queryFn,
23
+ queryOptions
24
+ );
18
25
  query.queryKey = queryKey;
19
26
  return query;
20
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA;AA6BO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.9.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: 0.1\n */\nimport { useQuery } from \"react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\ntype AwaitedInput<T> = PromiseLike<T> | T;\n\ntype Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\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 ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery } from \"react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\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 ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
package/state/state.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
2
- import { a9 as customInstance, a2 as StateGetVersionResponse, aa as ErrorType, a5 as AsError } from '../custom-instance-00382740.js';
2
+ import { ak as customInstance, ad as StateGetVersionResponse, al as ErrorType, ag as AsError } from '../custom-instance-b8075093.js';
3
3
  import 'axios';
4
4
 
5
- declare type AwaitedInput<T> = PromiseLike<T> | T;
6
- declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
7
5
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
8
6
  /**
9
7
  * @summary Gets the Account Server version
package/state/state.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import {
2
2
  customInstance
3
- } from "../chunk-3TENYKS7.js";
3
+ } from "../chunk-3O5KIRV4.js";
4
4
 
5
5
  // src/state/state.ts
6
6
  import { useQuery } from "react-query";
7
7
  var getVersion = (options, signal) => {
8
- return customInstance({ url: `/version`, method: "get", signal }, options);
8
+ return customInstance(
9
+ { url: `/version`, method: "get", signal },
10
+ options
11
+ );
9
12
  };
10
13
  var getGetVersionQueryKey = () => [`/version`];
11
14
  var useGetVersion = (options) => {
@@ -14,7 +17,11 @@ var useGetVersion = (options) => {
14
17
  const queryFn = ({
15
18
  signal
16
19
  }) => getVersion(requestOptions, signal);
17
- const query = useQuery(queryKey, queryFn, queryOptions);
20
+ const query = useQuery(
21
+ queryKey,
22
+ queryFn,
23
+ queryOptions
24
+ );
18
25
  query.queryKey = queryKey;
19
26
  return query;
20
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 0.1\n */\nimport { useQuery } from \"react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\ntype AwaitedInput<T> = PromiseLike<T> | T;\n\ntype Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\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 ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA;AA6BO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery } from \"react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\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 ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
package/unit/unit.cjs CHANGED
@@ -1,12 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
-
4
- var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
3
+ var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
5
4
 
6
5
  // src/unit/unit.ts
7
6
  var _reactquery = require('react-query');
8
7
  var getOrganisationUnits = (orgId, options, signal) => {
9
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit`, method: "get", signal }, options);
8
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
9
+ { url: `/organisation/${orgId}/unit`, method: "get", signal },
10
+ options
11
+ );
10
12
  };
11
13
  var getGetOrganisationUnitsQueryKey = (orgId) => [
12
14
  `/organisation/${orgId}/unit`
@@ -15,17 +17,20 @@ var useGetOrganisationUnits = (orgId, options) => {
15
17
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
16
18
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
17
19
  const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
18
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
20
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
19
21
  query.queryKey = queryKey;
20
22
  return query;
21
23
  };
22
24
  var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
23
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, {
24
- url: `/organisation/${orgId}/unit`,
25
- method: "post",
26
- headers: { "Content-Type": "application/json" },
27
- data: organisationUnitPostBodyBody
28
- }, options);
25
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
26
+ {
27
+ url: `/organisation/${orgId}/unit`,
28
+ method: "post",
29
+ headers: { "Content-Type": "application/json" },
30
+ data: organisationUnitPostBodyBody
31
+ },
32
+ options
33
+ );
29
34
  };
30
35
  var useCreateOrganisationUnit = (options) => {
31
36
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
@@ -36,7 +41,10 @@ var useCreateOrganisationUnit = (options) => {
36
41
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
37
42
  };
38
43
  var getUnit = (unitId, options, signal) => {
39
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}`, method: "get", signal }, options);
44
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
45
+ { url: `/unit/${unitId}`, method: "get", signal },
46
+ options
47
+ );
40
48
  };
41
49
  var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
42
50
  var useGetUnit = (unitId, options) => {
@@ -45,12 +53,19 @@ var useGetUnit = (unitId, options) => {
45
53
  const queryFn = ({
46
54
  signal
47
55
  }) => getUnit(unitId, requestOptions, signal);
48
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
56
+ const query = _reactquery.useQuery.call(void 0,
57
+ queryKey,
58
+ queryFn,
59
+ { enabled: !!unitId, ...queryOptions }
60
+ );
49
61
  query.queryKey = queryKey;
50
62
  return query;
51
63
  };
52
64
  var deleteOrganisationUnit = (unitId, options) => {
53
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}`, method: "delete" }, options);
65
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
66
+ { url: `/unit/${unitId}`, method: "delete" },
67
+ options
68
+ );
54
69
  };
55
70
  var useDeleteOrganisationUnit = (options) => {
56
71
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
@@ -61,7 +76,10 @@ var useDeleteOrganisationUnit = (options) => {
61
76
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
62
77
  };
63
78
  var getUnits = (options, signal) => {
64
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "get", signal }, options);
79
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
80
+ { url: `/unit`, method: "get", signal },
81
+ options
82
+ );
65
83
  };
66
84
  var getGetUnitsQueryKey = () => [`/unit`];
67
85
  var useGetUnits = (options) => {
@@ -70,12 +88,19 @@ var useGetUnits = (options) => {
70
88
  const queryFn = ({
71
89
  signal
72
90
  }) => getUnits(requestOptions, signal);
73
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
91
+ const query = _reactquery.useQuery.call(void 0,
92
+ queryKey,
93
+ queryFn,
94
+ queryOptions
95
+ );
74
96
  query.queryKey = queryKey;
75
97
  return query;
76
98
  };
77
99
  var createDefaultUnit = (options) => {
78
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "put" }, options);
100
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
101
+ { url: `/unit`, method: "put" },
102
+ options
103
+ );
79
104
  };
80
105
  var useCreateDefaultUnit = (options) => {
81
106
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
@@ -85,7 +110,7 @@ var useCreateDefaultUnit = (options) => {
85
110
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
86
111
  };
87
112
  var deleteDefaultUnit = (options) => {
88
- return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
113
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
89
114
  };
90
115
  var useDeleteDefaultUnit = (options) => {
91
116
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
package/unit/unit.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Generated by orval v6.9.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: 0.1\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\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 UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\ntype AwaitedInput<T> = PromiseLike<T> | T;\n\ntype Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the 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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: 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 deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal 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<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' 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>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
1
+ {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\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 UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the 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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: 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 deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Personal Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
package/unit/unit.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import { a9 as customInstance, Y as OrganisationUnitsGetResponse, aa as ErrorType, a5 as AsError, O as OrganisationUnitPostBodyBody, _ as OrganisationUnitPostResponse, l as UnitDetail, K as UnitsGetResponse, Z as PersonalUnitPutResponse } from '../custom-instance-00382740.js';
1
+ import { ak as customInstance, a6 as OrganisationUnitsGetResponse, al as ErrorType, ag as AsError, O as OrganisationUnitPostBodyBody, a9 as OrganisationUnitPostResponse, o as UnitDetail, a7 as UnitsGetResponse, a8 as PersonalUnitPutResponse } from '../custom-instance-b8075093.js';
2
2
  import * as react_query from 'react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
4
4
  import 'axios';
5
5
 
6
- declare type AwaitedInput<T> = PromiseLike<T> | T;
7
- declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
8
6
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
9
7
  /**
10
8
  * Gets Organisational Units you have access to or that are public
@@ -89,7 +87,7 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
89
87
  /**
90
88
  * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users
91
89
 
92
- * @summary Create a new Independent User Unit
90
+ * @summary Create a new Personal Unit
93
91
  */
94
92
  declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
95
93
  declare type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
@@ -101,7 +99,7 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariab
101
99
  /**
102
100
  * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
103
101
 
104
- * @summary Deletes an Independent Unit
102
+ * @summary Deletes a Personal Unit
105
103
  */
106
104
  declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
107
105
  declare type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;