@squonk/account-server-client 1.0.2 → 1.0.3-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 (48) hide show
  1. package/asset/asset.cjs +34 -18
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.ts +16 -16
  4. package/asset/asset.js +35 -19
  5. package/asset/asset.js.map +1 -1
  6. package/{custom-instance-e2d92e5c.d.ts → custom-instance-93fb01eb.d.ts} +17 -17
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +1 -1
  9. package/index.js.map +1 -1
  10. package/merchant/merchant.cjs +15 -13
  11. package/merchant/merchant.cjs.map +1 -1
  12. package/merchant/merchant.d.ts +1 -1
  13. package/merchant/merchant.js +16 -14
  14. package/merchant/merchant.js.map +1 -1
  15. package/organisation/organisation.cjs +18 -6
  16. package/organisation/organisation.cjs.map +1 -1
  17. package/organisation/organisation.d.ts +7 -7
  18. package/organisation/organisation.js +19 -7
  19. package/organisation/organisation.js.map +1 -1
  20. package/package.json +1 -1
  21. package/product/product.cjs +47 -38
  22. package/product/product.cjs.map +1 -1
  23. package/product/product.d.ts +10 -10
  24. package/product/product.js +48 -39
  25. package/product/product.js.map +1 -1
  26. package/src/account-server-api.schemas.ts +68 -84
  27. package/src/asset/asset.ts +248 -345
  28. package/src/merchant/merchant.ts +62 -84
  29. package/src/organisation/organisation.ts +131 -184
  30. package/src/product/product.ts +279 -422
  31. package/src/state/state.ts +36 -42
  32. package/src/unit/unit.ts +218 -301
  33. package/src/user/user.ts +224 -327
  34. package/state/state.cjs +9 -9
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +1 -1
  37. package/state/state.js +10 -10
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +40 -25
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +10 -10
  42. package/unit/unit.js +41 -26
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +38 -20
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +10 -10
  47. package/user/user.js +39 -21
  48. package/user/user.js.map +1 -1
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,OACK;AA0BA,IAAM,aAAa,CAEzB,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAY,QAAQ;AAAA,MAAO;AAAA,IACnC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAM/C,IAAM,gBAAgB,CAC3B,YAE8D;AAE9D,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEnE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAIjE,QAAM,UAAiE,CAAC,EAAE,OAAO,MAAM,WAAW,gBAAgB,MAAM;AAExH,QAAM,QAAQ,SAAgE,UAAU,SAAS,YAAY;AAE7G,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 {\n useQuery\n} 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\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const getVersion = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n {url: `/version`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetVersionQueryKey = () => [`/version`];\n\n \nexport type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>\nexport type GetVersionQueryError = ErrorType<AsError | void>\n\nexport const useGetVersion = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n"]}
package/state/state.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
2
- import { ak as customInstance, ad as StateGetVersionResponse, al as ErrorType, ag as AsError } from '../custom-instance-e2d92e5c.js';
2
+ import { ak as customInstance, ad as StateGetVersionResponse, al as ErrorType, ag as AsError } from '../custom-instance-93fb01eb.js';
3
3
  import 'axios';
4
4
 
5
5
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
package/state/state.js CHANGED
@@ -3,10 +3,16 @@ import {
3
3
  } from "../chunk-3O5KIRV4.js";
4
4
 
5
5
  // src/state/state.ts
6
- import { useQuery } from "react-query";
6
+ import {
7
+ useQuery
8
+ } from "react-query";
7
9
  var getVersion = (options, signal) => {
8
10
  return customInstance(
9
- { url: `/version`, method: "get", signal },
11
+ {
12
+ url: `/version`,
13
+ method: "get",
14
+ signal
15
+ },
10
16
  options
11
17
  );
12
18
  };
@@ -14,14 +20,8 @@ var getGetVersionQueryKey = () => [`/version`];
14
20
  var useGetVersion = (options) => {
15
21
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
22
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetVersionQueryKey();
17
- const queryFn = ({
18
- signal
19
- }) => getVersion(requestOptions, signal);
20
- const query = useQuery(
21
- queryKey,
22
- queryFn,
23
- queryOptions
24
- );
23
+ const queryFn = ({ signal }) => getVersion(requestOptions, signal);
24
+ const query = useQuery(queryKey, queryFn, queryOptions);
25
25
  query.queryKey = queryKey;
26
26
  return query;
27
27
  };
@@ -1 +1 @@
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":[]}
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 {\n useQuery\n} 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\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const getVersion = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n {url: `/version`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetVersionQueryKey = () => [`/version`];\n\n \nexport type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>\nexport type GetVersionQueryError = ErrorType<AsError | void>\n\nexport const useGetVersion = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n"],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,OACK;AA0BA,IAAM,aAAa,CAEzB,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAY,QAAQ;AAAA,MAAO;AAAA,IACnC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAM/C,IAAM,gBAAgB,CAC3B,YAE8D;AAE9D,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEnE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAIjE,QAAM,UAAiE,CAAC,EAAE,OAAO,MAAM,WAAW,gBAAgB,MAAM;AAExH,QAAM,QAAQ,SAAgE,UAAU,SAAS,YAAY;AAE7G,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
package/unit/unit.cjs CHANGED
@@ -3,16 +3,21 @@
3
3
  var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
4
4
 
5
5
  // src/unit/unit.ts
6
+
7
+
8
+
6
9
  var _reactquery = require('react-query');
7
10
  var getOrganisationUnits = (orgId, options, signal) => {
8
11
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
9
- { url: `/organisation/${orgId}/unit`, method: "get", signal },
12
+ {
13
+ url: `/organisation/${orgId}/unit`,
14
+ method: "get",
15
+ signal
16
+ },
10
17
  options
11
18
  );
12
19
  };
13
- var getGetOrganisationUnitsQueryKey = (orgId) => [
14
- `/organisation/${orgId}/unit`
15
- ];
20
+ var getGetOrganisationUnitsQueryKey = (orgId) => [`/organisation/${orgId}/unit`];
16
21
  var useGetOrganisationUnits = (orgId, options) => {
17
22
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
18
23
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
@@ -42,7 +47,11 @@ var useCreateOrganisationUnit = (options) => {
42
47
  };
43
48
  var getUnit = (unitId, options, signal) => {
44
49
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
45
- { url: `/unit/${unitId}`, method: "get", signal },
50
+ {
51
+ url: `/unit/${unitId}`,
52
+ method: "get",
53
+ signal
54
+ },
46
55
  options
47
56
  );
48
57
  };
@@ -50,20 +59,17 @@ var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
50
59
  var useGetUnit = (unitId, options) => {
51
60
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
52
61
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitQueryKey(unitId)));
53
- const queryFn = ({
54
- signal
55
- }) => getUnit(unitId, requestOptions, signal);
56
- const query = _reactquery.useQuery.call(void 0,
57
- queryKey,
58
- queryFn,
59
- { enabled: !!unitId, ...queryOptions }
60
- );
62
+ const queryFn = ({ signal }) => getUnit(unitId, requestOptions, signal);
63
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
61
64
  query.queryKey = queryKey;
62
65
  return query;
63
66
  };
64
67
  var deleteOrganisationUnit = (unitId, options) => {
65
68
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
66
- { url: `/unit/${unitId}`, method: "delete" },
69
+ {
70
+ url: `/unit/${unitId}`,
71
+ method: "delete"
72
+ },
67
73
  options
68
74
  );
69
75
  };
@@ -77,7 +83,11 @@ var useDeleteOrganisationUnit = (options) => {
77
83
  };
78
84
  var getUnits = (options, signal) => {
79
85
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
80
- { url: `/unit`, method: "get", signal },
86
+ {
87
+ url: `/unit`,
88
+ method: "get",
89
+ signal
90
+ },
81
91
  options
82
92
  );
83
93
  };
@@ -85,36 +95,41 @@ var getGetUnitsQueryKey = () => [`/unit`];
85
95
  var useGetUnits = (options) => {
86
96
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
87
97
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitsQueryKey()));
88
- const queryFn = ({
89
- signal
90
- }) => getUnits(requestOptions, signal);
91
- const query = _reactquery.useQuery.call(void 0,
92
- queryKey,
93
- queryFn,
94
- queryOptions
95
- );
98
+ const queryFn = ({ signal }) => getUnits(requestOptions, signal);
99
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
96
100
  query.queryKey = queryKey;
97
101
  return query;
98
102
  };
99
103
  var createDefaultUnit = (options) => {
100
104
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
101
- { url: `/unit`, method: "put" },
105
+ {
106
+ url: `/unit`,
107
+ method: "put"
108
+ },
102
109
  options
103
110
  );
104
111
  };
105
112
  var useCreateDefaultUnit = (options) => {
106
113
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
107
114
  const mutationFn = () => {
115
+ ;
108
116
  return createDefaultUnit(requestOptions);
109
117
  };
110
118
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
111
119
  };
112
120
  var deleteDefaultUnit = (options) => {
113
- return _chunkIUEU2LYCcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
121
+ return _chunkIUEU2LYCcjs.customInstance.call(void 0,
122
+ {
123
+ url: `/unit`,
124
+ method: "delete"
125
+ },
126
+ options
127
+ );
114
128
  };
115
129
  var useDeleteDefaultUnit = (options) => {
116
130
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
117
131
  const mutationFn = () => {
132
+ ;
118
133
  return deleteDefaultUnit(requestOptions);
119
134
  };
120
135
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
package/unit/unit.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAkC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,KAAK,IAAI,SAAS,CAAC;AAElC,WAAO,uBAAuB,OAAO,MAAM,cAAc;AAAA,EAC3D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,UAAU,CACrB,QACA,SACA,WACG;AACH,SAAO;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AM,SAAS,gBAAgB,MAAM;AAErC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,QAAQ,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","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"]}
1
+ {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAmCA,IAAM,uBAAuB,CAChC,OACH,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,iBAAiB;AAAA,MAAc,QAAQ;AAAA,MAAO;AAAA,IACtD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AAA,EAAO;AACT;AAQO,IAAM,uBAAuB,CAEhB,YACnB;AACC,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKzE,QAAM,aAA0F,MAAM;AAClG;AAEA,WAAQ,kBAAkB,cAAc;AAAA,EAC1C;AAEF,SAAO,YAAyF,YAAY,eAAe;AAC7H;AAMG,IAAM,oBAAoB,CAEhC,YAAsD;AACjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAS,QAAQ;AAAA,IACzB;AAAA,IACE;AAAA,EAAO;AACT;AAQO,IAAM,uBAAuB,CAEhB,YACnB;AACC,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKzE,QAAM,aAA0F,MAAM;AAClG;AAEA,WAAQ,kBAAkB,cAAc;AAAA,EAC1C;AAEF,SAAO,YAAyF,YAAY,eAAe;AAC7H","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 {\n useQuery,\n useMutation\n} 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\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n/**\n * 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>,signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n {url: `/organisation/${orgId}/unit`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string,) => [`/organisation/${orgId}/unit`];\n\n \nexport type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>\n\nexport const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(\n orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>(queryKey, queryFn, {enabled: !!(orgId), ...queryOptions}) as UseQueryResult<TData, TError> & { 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 return customInstance<OrganisationUnitPostResponse>(\n {url: `/organisation/${orgId}/unit`, method: 'post',\n headers: {'Content-Type': 'application/json', },\n data: organisationUnitPostBodyBody\n },\n options);\n }\n \n\n\n export type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>\n export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody\n export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>\n\n export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisationUnit>>, {orgId: string;data: OrganisationUnitPostBodyBody}> = (props) => {\n const {orgId,data} = props ?? {};\n\n return createOrganisationUnit(orgId,data,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createOrganisationUnit>>, TError, {orgId: string;data: OrganisationUnitPostBodyBody}, TContext>(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>,signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n {url: `/unit/${unitId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetUnitQueryKey = (unitId: string,) => [`/unit/${unitId}`];\n\n \nexport type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>\nexport type GetUnitQueryError = ErrorType<void | AsError>\n\nexport const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(\n unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(queryKey, queryFn, {enabled: !!(unitId), ...queryOptions}) 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 return customInstance<void>(\n {url: `/unit/${unitId}`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>\n \n export type DeleteOrganisationUnitMutationError = ErrorType<AsError>\n\n export const useDeleteOrganisationUnit = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnit>>, {unitId: string}> = (props) => {\n const {unitId} = props ?? {};\n\n return deleteOrganisationUnit(unitId,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError, {unitId: string}, TContext>(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 \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n {url: `/unit`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\n \nexport type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>\nexport type GetUnitsQueryError = ErrorType<void | AsError>\n\nexport const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(queryKey, queryFn, queryOptions) 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 \n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<PersonalUnitPutResponse>(\n {url: `/unit`, method: 'put'\n },\n options);\n }\n \n\n\n export type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>\n \n export type CreateDefaultUnitMutationError = ErrorType<AsError | void>\n\n export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDefaultUnit>>, TVariables> = () => {\n ;\n\n return createDefaultUnit(requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createDefaultUnit>>, TError, TVariables, TContext>(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 \n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<void>(\n {url: `/unit`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>\n \n export type DeleteDefaultUnitMutationError = ErrorType<AsError>\n\n export const useDeleteDefaultUnit = <TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, TVariables> = () => {\n ;\n\n return deleteDefaultUnit(requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError, TVariables, TContext>(mutationFn, mutationOptions)\n }\n "]}
package/unit/unit.d.ts CHANGED
@@ -1,4 +1,4 @@
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-e2d92e5c.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-93fb01eb.js';
2
2
  import * as react_query from 'react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
4
4
  import 'axios';
@@ -39,10 +39,10 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
39
39
  data: OrganisationUnitPostBodyBody;
40
40
  }, TContext>;
41
41
  /**
42
- * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units
42
+ * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units
43
43
 
44
- * @summary Gets an Organisational Unit
45
- */
44
+ * @summary Gets an Organisational Unit
45
+ */
46
46
  declare const getUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UnitDetail>;
47
47
  declare const getGetUnitQueryKey: (unitId: string) => string[];
48
48
  declare type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
@@ -70,10 +70,10 @@ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext
70
70
  unitId: string;
71
71
  }, TContext>;
72
72
  /**
73
- * Gets all the Units that are public or you are a member of. Admin users can see all Units
73
+ * Gets all the Units that are public or you are a member of. Admin users can see all Units
74
74
 
75
- * @summary Gets Units
76
- */
75
+ * @summary Gets Units
76
+ */
77
77
  declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UnitsGetResponse>;
78
78
  declare const getGetUnitsQueryKey: () => string[];
79
79
  declare type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
@@ -97,10 +97,10 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariab
97
97
  request?: SecondParameter<typeof customInstance>;
98
98
  } | undefined) => react_query.UseMutationResult<PersonalUnitPutResponse, TError, TVariables, TContext>;
99
99
  /**
100
- * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
100
+ * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
101
101
 
102
- * @summary Deletes a Personal Unit
103
- */
102
+ * @summary Deletes a Personal Unit
103
+ */
104
104
  declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
105
105
  declare type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
106
106
  declare type DeleteDefaultUnitMutationError = ErrorType<AsError>;
package/unit/unit.js CHANGED
@@ -3,16 +3,21 @@ import {
3
3
  } from "../chunk-3O5KIRV4.js";
4
4
 
5
5
  // src/unit/unit.ts
6
- import { useQuery, useMutation } from "react-query";
6
+ import {
7
+ useQuery,
8
+ useMutation
9
+ } from "react-query";
7
10
  var getOrganisationUnits = (orgId, options, signal) => {
8
11
  return customInstance(
9
- { url: `/organisation/${orgId}/unit`, method: "get", signal },
12
+ {
13
+ url: `/organisation/${orgId}/unit`,
14
+ method: "get",
15
+ signal
16
+ },
10
17
  options
11
18
  );
12
19
  };
13
- var getGetOrganisationUnitsQueryKey = (orgId) => [
14
- `/organisation/${orgId}/unit`
15
- ];
20
+ var getGetOrganisationUnitsQueryKey = (orgId) => [`/organisation/${orgId}/unit`];
16
21
  var useGetOrganisationUnits = (orgId, options) => {
17
22
  const { query: queryOptions, request: requestOptions } = options ?? {};
18
23
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
@@ -42,7 +47,11 @@ var useCreateOrganisationUnit = (options) => {
42
47
  };
43
48
  var getUnit = (unitId, options, signal) => {
44
49
  return customInstance(
45
- { url: `/unit/${unitId}`, method: "get", signal },
50
+ {
51
+ url: `/unit/${unitId}`,
52
+ method: "get",
53
+ signal
54
+ },
46
55
  options
47
56
  );
48
57
  };
@@ -50,20 +59,17 @@ var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
50
59
  var useGetUnit = (unitId, options) => {
51
60
  const { query: queryOptions, request: requestOptions } = options ?? {};
52
61
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitQueryKey(unitId);
53
- const queryFn = ({
54
- signal
55
- }) => getUnit(unitId, requestOptions, signal);
56
- const query = useQuery(
57
- queryKey,
58
- queryFn,
59
- { enabled: !!unitId, ...queryOptions }
60
- );
62
+ const queryFn = ({ signal }) => getUnit(unitId, requestOptions, signal);
63
+ const query = useQuery(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
61
64
  query.queryKey = queryKey;
62
65
  return query;
63
66
  };
64
67
  var deleteOrganisationUnit = (unitId, options) => {
65
68
  return customInstance(
66
- { url: `/unit/${unitId}`, method: "delete" },
69
+ {
70
+ url: `/unit/${unitId}`,
71
+ method: "delete"
72
+ },
67
73
  options
68
74
  );
69
75
  };
@@ -77,7 +83,11 @@ var useDeleteOrganisationUnit = (options) => {
77
83
  };
78
84
  var getUnits = (options, signal) => {
79
85
  return customInstance(
80
- { url: `/unit`, method: "get", signal },
86
+ {
87
+ url: `/unit`,
88
+ method: "get",
89
+ signal
90
+ },
81
91
  options
82
92
  );
83
93
  };
@@ -85,36 +95,41 @@ var getGetUnitsQueryKey = () => [`/unit`];
85
95
  var useGetUnits = (options) => {
86
96
  const { query: queryOptions, request: requestOptions } = options ?? {};
87
97
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitsQueryKey();
88
- const queryFn = ({
89
- signal
90
- }) => getUnits(requestOptions, signal);
91
- const query = useQuery(
92
- queryKey,
93
- queryFn,
94
- queryOptions
95
- );
98
+ const queryFn = ({ signal }) => getUnits(requestOptions, signal);
99
+ const query = useQuery(queryKey, queryFn, queryOptions);
96
100
  query.queryKey = queryKey;
97
101
  return query;
98
102
  };
99
103
  var createDefaultUnit = (options) => {
100
104
  return customInstance(
101
- { url: `/unit`, method: "put" },
105
+ {
106
+ url: `/unit`,
107
+ method: "put"
108
+ },
102
109
  options
103
110
  );
104
111
  };
105
112
  var useCreateDefaultUnit = (options) => {
106
113
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
107
114
  const mutationFn = () => {
115
+ ;
108
116
  return createDefaultUnit(requestOptions);
109
117
  };
110
118
  return useMutation(mutationFn, mutationOptions);
111
119
  };
112
120
  var deleteDefaultUnit = (options) => {
113
- return customInstance({ url: `/unit`, method: "delete" }, options);
121
+ return customInstance(
122
+ {
123
+ url: `/unit`,
124
+ method: "delete"
125
+ },
126
+ options
127
+ );
114
128
  };
115
129
  var useDeleteDefaultUnit = (options) => {
116
130
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
117
131
  const mutationFn = () => {
132
+ ;
118
133
  return deleteDefaultUnit(requestOptions);
119
134
  };
120
135
  return useMutation(mutationFn, mutationOptions);
package/unit/unit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unit/unit.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, 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"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAkC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,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,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,QAAQ,OAAO,OAAO;AAAA,IACtC;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,MAAM,CAAC,OAAO;AAO1C,IAAM,cAAc,CAGzB,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB;AAE/D,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,gBAAgB,MAAM;AAErC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,QAAQ,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/unit/unit.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 {\n useQuery,\n useMutation\n} 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\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n/**\n * 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>,signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n {url: `/organisation/${orgId}/unit`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string,) => [`/organisation/${orgId}/unit`];\n\n \nexport type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>\n\nexport const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(\n orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>(queryKey, queryFn, {enabled: !!(orgId), ...queryOptions}) as UseQueryResult<TData, TError> & { 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 return customInstance<OrganisationUnitPostResponse>(\n {url: `/organisation/${orgId}/unit`, method: 'post',\n headers: {'Content-Type': 'application/json', },\n data: organisationUnitPostBodyBody\n },\n options);\n }\n \n\n\n export type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>\n export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody\n export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>\n\n export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisationUnit>>, {orgId: string;data: OrganisationUnitPostBodyBody}> = (props) => {\n const {orgId,data} = props ?? {};\n\n return createOrganisationUnit(orgId,data,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createOrganisationUnit>>, TError, {orgId: string;data: OrganisationUnitPostBodyBody}, TContext>(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>,signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n {url: `/unit/${unitId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetUnitQueryKey = (unitId: string,) => [`/unit/${unitId}`];\n\n \nexport type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>\nexport type GetUnitQueryError = ErrorType<void | AsError>\n\nexport const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(\n unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(queryKey, queryFn, {enabled: !!(unitId), ...queryOptions}) 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 return customInstance<void>(\n {url: `/unit/${unitId}`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>\n \n export type DeleteOrganisationUnitMutationError = ErrorType<AsError>\n\n export const useDeleteOrganisationUnit = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnit>>, {unitId: string}> = (props) => {\n const {unitId} = props ?? {};\n\n return deleteOrganisationUnit(unitId,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError, {unitId: string}, TContext>(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 \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n {url: `/unit`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\n \nexport type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>\nexport type GetUnitsQueryError = ErrorType<void | AsError>\n\nexport const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(queryKey, queryFn, queryOptions) 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 \n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<PersonalUnitPutResponse>(\n {url: `/unit`, method: 'put'\n },\n options);\n }\n \n\n\n export type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>\n \n export type CreateDefaultUnitMutationError = ErrorType<AsError | void>\n\n export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDefaultUnit>>, TVariables> = () => {\n ;\n\n return createDefaultUnit(requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createDefaultUnit>>, TError, TVariables, TContext>(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 \n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<void>(\n {url: `/unit`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>\n \n export type DeleteDefaultUnitMutationError = ErrorType<AsError>\n\n export const useDeleteDefaultUnit = <TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, TVariables> = () => {\n ;\n\n return deleteDefaultUnit(requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError, TVariables, TContext>(mutationFn, mutationOptions)\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAmCA,IAAM,uBAAuB,CAChC,OACH,SAAiD,WAC7C;AACC,SAAO;AAAA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