@squonk/account-server-client 0.1.27-rc.1 → 0.1.28-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 (50) hide show
  1. package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
  2. package/chunk-6EEIAH4R.js.map +1 -0
  3. package/chunk-NGBTCJWS.cjs +46 -0
  4. package/chunk-NGBTCJWS.cjs.map +1 -0
  5. package/{account-server-api.schemas-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -1
  6. package/index.cjs +5 -21
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +2 -20
  9. package/index.js +5 -21
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +35 -30
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +33 -32
  14. package/organisation/organisation.js +42 -37
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +1 -1
  17. package/product/product.cjs +65 -53
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +55 -54
  20. package/product/product.js +76 -64
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +21 -23
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +18 -17
  25. package/service/service.js +23 -25
  26. package/service/service.js.map +1 -1
  27. package/src/organisation/organisation.ts +93 -69
  28. package/src/product/product.ts +165 -146
  29. package/src/service/service.ts +59 -57
  30. package/src/state/state.ts +34 -28
  31. package/src/unit/unit.ts +145 -130
  32. package/src/user/user.ts +148 -120
  33. package/state/state.cjs +12 -12
  34. package/state/state.cjs.map +1 -1
  35. package/state/state.d.ts +11 -10
  36. package/state/state.js +13 -13
  37. package/state/state.js.map +1 -1
  38. package/unit/unit.cjs +55 -50
  39. package/unit/unit.cjs.map +1 -1
  40. package/unit/unit.d.ts +54 -53
  41. package/unit/unit.js +66 -61
  42. package/unit/unit.js.map +1 -1
  43. package/user/user.cjs +50 -50
  44. package/user/user.cjs.map +1 -1
  45. package/user/user.d.ts +53 -52
  46. package/user/user.js +61 -61
  47. package/user/user.js.map +1 -1
  48. package/chunk-GWBPVOL2.js.map +0 -1
  49. package/chunk-N3RLW53G.cjs +0 -25
  50. package/chunk-N3RLW53G.cjs.map +0 -1
@@ -18,8 +18,29 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
+ // src/custom-instance.ts
22
+ import Axios from "axios";
23
+ var AXIOS_INSTANCE = Axios.create();
24
+ var setAuthToken = (token) => {
25
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
26
+ };
27
+ var setBaseUrl = (baseUrl) => {
28
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
29
+ };
30
+ var customInstance = (config, options) => {
31
+ const source = Axios.CancelToken.source();
32
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
33
+ promise.cancel = () => {
34
+ source.cancel("Query was cancelled by React Query");
35
+ };
36
+ return promise;
37
+ };
38
+
21
39
  export {
22
40
  __spreadValues,
23
- __spreadProps
41
+ AXIOS_INSTANCE,
42
+ setAuthToken,
43
+ setBaseUrl,
44
+ customInstance
24
45
  };
25
- //# sourceMappingURL=chunk-GWBPVOL2.js.map
46
+ //# sourceMappingURL=chunk-6EEIAH4R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,MAAM,EAAC,EAAE,KACnF,CAAC,EAAE,WAAW,IAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/custom-instance.ts
22
+ var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
23
+ var AXIOS_INSTANCE = _axios2.default.create();
24
+ var setAuthToken = (token) => {
25
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
26
+ };
27
+ var setBaseUrl = (baseUrl) => {
28
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
29
+ };
30
+ var customInstance = (config, options) => {
31
+ const source = _axios2.default.CancelToken.source();
32
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
33
+ promise.cancel = () => {
34
+ source.cancel("Query was cancelled by React Query");
35
+ };
36
+ return promise;
37
+ };
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+ exports.__spreadValues = __spreadValues; exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
46
+ //# sourceMappingURL=chunk-NGBTCJWS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,MAAM,EAAC,EAAE,KACnF,CAAC,EAAE,WAAW,IAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
@@ -1,3 +1,6 @@
1
+ import * as axios from 'axios';
2
+ import { AxiosRequestConfig, AxiosError } from 'axios';
3
+
1
4
  /**
2
5
  * Generated by orval v6.7.1 🍺
3
6
  * Do not edit manually.
@@ -325,4 +328,19 @@ interface AsError {
325
328
  error: string;
326
329
  }
327
330
 
328
- export { ProductUnitGetResponse as A, ProductsGetTypesResponse as B, ProductsGetResponseProductsItem as C, ProductsGetResponse as D, OrganisationsGetResponse as E, OrganisationUnitsGetResponse as F, UnitsGetResponse as G, PersonalUnitPutResponse as H, OrganisationUnitPostResponse as I, OrganisationGetDefaultResponse as J, UsersGetResponse as K, OrganisationPostResponse as L, StateGetVersionResponse as M, AsError as N, OrganisationUnitPostBodyBody as O, ProductPatchBodyBody as P, ServiceGetResponseKind as S, UnitProductPostBodyBodyFlavour as U, UnitProductPostBodyBodyType as a, UnitProductPostBodyBody as b, OrganisationPostBodyBody as c, UserDetail as d, UserAccountDetail as e, UnitDetail as f, ServiceGetResponse as g, ServicesGetResponse as h, OrganisationDetail as i, ProductType as j, ProductInstanceDetailCoins as k, ProductInstanceDetail as l, ProductDetailFlavour as m, ProductDetailType as n, ProductDetail as o, ProductCoinsDetail as p, ProductClaimDetail as q, ProductDmStorageDetailCoins as r, ProductDmStorageDetailSize as s, ProductDmStorageDetail as t, ProductDmProjectTier as u, ProductDmStorage as v, UserAccountGetResponse as w, UnitGetResponse as x, UnitProductPostResponse as y, ProductUnitGetResponseProduct as z };
331
+ declare const AXIOS_INSTANCE: axios.AxiosInstance;
332
+ /**
333
+ * Set the access token to be added as the `Authorization: Bearer 'token'` header
334
+ * Useful for client only apps where a proxy API route isn't involved to securely add the access token
335
+ * @param token access token
336
+ */
337
+ declare const setAuthToken: (token: string) => void;
338
+ /**
339
+ * Set the url to which request paths are added to.
340
+ * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
341
+ */
342
+ declare const setBaseUrl: (baseUrl: string) => void;
343
+ declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig<any> | undefined) => Promise<TReturn>;
344
+ declare type ErrorType<TError> = AxiosError<TError>;
345
+
346
+ export { ProductUnitGetResponse as A, ProductsGetTypesResponse as B, ProductsGetResponseProductsItem as C, ProductsGetResponse as D, OrganisationsGetResponse as E, OrganisationUnitsGetResponse as F, UnitsGetResponse as G, PersonalUnitPutResponse as H, OrganisationUnitPostResponse as I, OrganisationGetDefaultResponse as J, UsersGetResponse as K, OrganisationPostResponse as L, StateGetVersionResponse as M, AsError as N, OrganisationUnitPostBodyBody as O, ProductPatchBodyBody as P, AXIOS_INSTANCE as Q, setAuthToken as R, ServiceGetResponseKind as S, setBaseUrl as T, UnitProductPostBodyBodyFlavour as U, customInstance as V, ErrorType as W, UnitProductPostBodyBodyType as a, UnitProductPostBodyBody as b, OrganisationPostBodyBody as c, UserDetail as d, UserAccountDetail as e, UnitDetail as f, ServiceGetResponse as g, ServicesGetResponse as h, OrganisationDetail as i, ProductType as j, ProductInstanceDetailCoins as k, ProductInstanceDetail as l, ProductDetailFlavour as m, ProductDetailType as n, ProductDetail as o, ProductCoinsDetail as p, ProductClaimDetail as q, ProductDmStorageDetailCoins as r, ProductDmStorageDetailSize as s, ProductDmStorageDetail as t, ProductDmProjectTier as u, ProductDmStorage as v, UserAccountGetResponse as w, UnitGetResponse as x, UnitProductPostResponse as y, ProductUnitGetResponseProduct as z };
package/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkN3RLW53Gcjs = require('./chunk-N3RLW53G.cjs');
4
+
5
+
6
+ var _chunkNGBTCJWScjs = require('./chunk-NGBTCJWS.cjs');
5
7
 
6
8
  // src/account-server-api.schemas.ts
7
9
  var UnitProductPostBodyBodyFlavour = {
@@ -28,24 +30,6 @@ var ProductDetailType = {
28
30
  DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
29
31
  };
30
32
 
31
- // src/custom-instance.ts
32
- var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
33
- var AXIOS_INSTANCE = _axios2.default.create();
34
- var setAuthToken = (token) => {
35
- AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
36
- };
37
- var setBaseUrl = (baseUrl) => {
38
- AXIOS_INSTANCE.defaults.baseURL = baseUrl;
39
- };
40
- var customInstance = (config, options) => {
41
- const source = _axios2.default.CancelToken.source();
42
- const promise = AXIOS_INSTANCE(_chunkN3RLW53Gcjs.__spreadProps.call(void 0, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {}, config), options), { cancelToken: source.token })).then(({ data }) => data);
43
- promise.cancel = () => {
44
- source.cancel("Query was cancelled by React Query");
45
- };
46
- return promise;
47
- };
48
-
49
33
 
50
34
 
51
35
 
@@ -55,5 +39,5 @@ var customInstance = (config, options) => {
55
39
 
56
40
 
57
41
 
58
- exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.ProductDetailFlavour = ProductDetailFlavour; exports.ProductDetailType = ProductDetailType; exports.ServiceGetResponseKind = ServiceGetResponseKind; exports.UnitProductPostBodyBodyFlavour = UnitProductPostBodyBodyFlavour; exports.UnitProductPostBodyBodyType = UnitProductPostBodyBodyType; exports.customInstance = customInstance; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl;
42
+ exports.AXIOS_INSTANCE = _chunkNGBTCJWScjs.AXIOS_INSTANCE; exports.ProductDetailFlavour = ProductDetailFlavour; exports.ProductDetailType = ProductDetailType; exports.ServiceGetResponseKind = ServiceGetResponseKind; exports.UnitProductPostBodyBodyFlavour = UnitProductPostBodyBodyFlavour; exports.UnitProductPostBodyBodyType = UnitProductPostBodyBodyType; exports.customInstance = _chunkNGBTCJWScjs.customInstance; exports.setAuthToken = _chunkNGBTCJWScjs.setAuthToken; exports.setBaseUrl = _chunkNGBTCJWScjs.setBaseUrl;
59
43
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account-server-api.schemas.ts","../src/custom-instance.ts"],"names":[],"mappings":";;;;;;AA6BO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAYO,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AACJ;AA+DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAwDO,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAWO,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AACJ;;;ACvLA;AAEO,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,MAAM,EAAC,EAAE,KACnF,CAAC,EAAE,WAAW,IAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. Product allowances cannot be reduced */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. The existing product limit cannot be reduced */\n limit?: number;\n};\n\n/**\n * The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products\n */\nexport type UnitProductPostBodyBodyFlavour =\n | \"EVALUATION\"\n | \"BRONZE\"\n | \"SILVER\"\n | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyFlavour = {\n EVALUATION: \"EVALUATION\" as UnitProductPostBodyBodyFlavour,\n BRONZE: \"BRONZE\" as UnitProductPostBodyBodyFlavour,\n SILVER: \"SILVER\" as UnitProductPostBodyBodyFlavour,\n GOLD: \"GOLD\" as UnitProductPostBodyBodyFlavour,\n};\n\n/**\n * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products\n */\nexport type UnitProductPostBodyBodyType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n};\n\nexport type UnitProductPostBodyBody = {\n /** The name you want to give the Product */\n name: string;\n /** The service identity for the Product. Products are created for use on a specific service, like a Data Manager instance */\n service_id: number;\n /** The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products */\n type: UnitProductPostBodyBodyType;\n /** The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin allowance. You must provide this for Storage products but you must not provide a value for Project Tier Products */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. You can provide this for Storage products but you must not provide a value for Project Tier Products */\n limit?: number;\n /** The day you would like to be billed for the Product's subscription (a value from 1 and 28) */\n billing_day: number;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit */\n name: string;\n};\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisation */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n /** The user identity (username) */\n id: string;\n}\n\nexport interface UserAccountDetail {\n user: UserDetail;\n /** Whether the caller has admin privilege */\n caller_has_admin_privilege: boolean;\n}\n\nexport interface UnitDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Unit's unique identity */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's owner (a username) */\n owner_id: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\n/**\n * The kind of Service\n */\nexport type ServiceGetResponseKind = \"DATA_MANAGER\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ServiceGetResponseKind = {\n DATA_MANAGER: \"DATA_MANAGER\" as ServiceGetResponseKind,\n};\n\nexport interface ServiceGetResponse {\n /** The unique ID of the Service */\n id: number;\n /** The kind of Service */\n kind: ServiceGetResponseKind;\n /** The name assigned to the Service */\n name?: string;\n}\n\nexport interface ServicesGetResponse {\n /** The list of known Services\n */\n services: ServiceGetResponse[];\n}\n\nexport interface OrganisationDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Organisation's unique ID */\n id: string;\n /** The Organisation's name */\n name: string;\n /** The username of the Organisation's owner. Not all Organisations have an owner. The Default Organisation has no owner. */\n owner_id?: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\nexport interface ProductType {\n /** A product type, this is a unique string amongst all types known to the Account Server */\n type: string;\n /** A product flavour. Not all types have a flavour, those that do have a type-specific flavour string */\n flavour?: string;\n /** For a product that belongs to a specific service, the service that owns it is provided */\n service?: ServiceGetResponse;\n}\n\nexport type ProductInstanceDetailCoins = {\n /** The number of coins used\n */\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\n/**\n * The Product Type falvour. Not all products have flavours\n\n */\nexport type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailFlavour = {\n EVALUATION: \"EVALUATION\" as ProductDetailFlavour,\n BRONZE: \"BRONZE\" as ProductDetailFlavour,\n SILVER: \"SILVER\" as ProductDetailFlavour,\n GOLD: \"GOLD\" as ProductDetailFlavour,\n};\n\n/**\n * The Product Type\n\n */\nexport type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as ProductDetailType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as ProductDetailType,\n};\n\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n /** The Product Service ID\n */\n service_id?: number;\n /** The Product Type\n */\n type: ProductDetailType;\n /** The Product Type falvour. Not all products have flavours\n */\n flavour?: ProductDetailFlavour;\n /** The name of the Product\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billing period the *cost multiplier* will increase */\n allowance: number;\n /** The limit on your billing period spend. You can exceed the allowance but you cannot exceed the spend limit. Once reached the dependent may be restricted */\n limit: number;\n /** The total number of coins consumed (in this billing period), excluding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is operating at or beyond its coin limit. When it is authority to perform actions using the product are severely limited. */\n at_limit: boolean;\n /** The current burn rate, the approximate amount of coins you are currently consuming each day */\n current_burn_rate: number;\n /** The predicted billing period amount, if costs continue at the current burn rate until the end of the billing period */\n billing_prediction: number;\n /** The day of the month when the bill is due, and the end of the current billing period */\n billing_day: number;\n /** A multiplier applied to your coin usage within your allowance */\n allowance_multiplier: number;\n /** A multiplier that will be applied to coin used beyond your allowance */\n overspend_multiplier: number;\n /** The number of days remaining, in the current billing period */\n remaining_days: number;\n}\n\nexport interface ProductClaimDetail {\n /** The service-specific ID that is using this Subscription\n */\n id: string;\n /** A name for the service-specific ID\n */\n name?: string;\n}\n\nexport type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the accumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of storage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport type ProductDmStorageDetailSize = {\n /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */\n peak: string;\n /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */\n current: string;\n /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */\n unit_size: string;\n /** The peak number of storage units used today */\n units_used: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductDmProjectTier {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n instance: ProductInstanceDetail;\n claim?: ProductClaimDetail;\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n}\n\nexport type UserAccountGetResponse = UserAccountDetail;\n\nexport interface UnitGetResponse {\n /** The Unit's unique ID */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's oener (username) */\n owner_id: string;\n}\n\nexport interface UnitProductPostResponse {\n /** The Products's unique ID */\n id: string;\n}\n\n/**\n * The Unit's Product\n */\nexport type ProductUnitGetResponseProduct =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Product */\n product: ProductUnitGetResponseProduct;\n}\n\nexport interface ProductsGetTypesResponse {\n /** All the Product Types you have access to */\n product_types: ProductType[];\n}\n\nexport type ProductsGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductsGetResponse {\n /** All the Products you have access to */\n products: ProductsGetResponseProductsItem[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisations */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\n}\n\nexport interface PersonalUnitPutResponse {\n /** The unit's Organisation. Used to identify the Default organisation */\n organisation_id: string;\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationGetDefaultResponse {\n /** Whether the user making the API call is a member of the Default Organisation. Only admin users are members of the Default organisation */\n caller_is_member: boolean;\n /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\n /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units\n */\n private: boolean;\n}\n\nexport interface UsersGetResponse {\n organisation?: OrganisationDetail;\n unit?: UnitDetail;\n /** The list of Organisation Users\n */\n users: UserDetail[];\n}\n\nexport interface OrganisationPostResponse {\n /** The Organisation's unique ID */\n id: string;\n}\n\nexport interface StateGetVersionResponse {\n /** The Account Server version. This is guaranteed to be a valid semantic version for official (tagged) images. The version value format for unofficial images is a string but otherwise undefined\n */\n version: string;\n}\n\nexport interface AsError {\n /** Brief error text that can be presented to the user */\n error: string;\n}\n","/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
1
+ {"version":3,"sources":["../src/account-server-api.schemas.ts"],"names":[],"mappings":";;;;;;;;AA6BO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAYO,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AACJ;AA+DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAwDO,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAWO,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AACJ","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. Product allowances cannot be reduced */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. The existing product limit cannot be reduced */\n limit?: number;\n};\n\n/**\n * The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products\n */\nexport type UnitProductPostBodyBodyFlavour =\n | \"EVALUATION\"\n | \"BRONZE\"\n | \"SILVER\"\n | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyFlavour = {\n EVALUATION: \"EVALUATION\" as UnitProductPostBodyBodyFlavour,\n BRONZE: \"BRONZE\" as UnitProductPostBodyBodyFlavour,\n SILVER: \"SILVER\" as UnitProductPostBodyBodyFlavour,\n GOLD: \"GOLD\" as UnitProductPostBodyBodyFlavour,\n};\n\n/**\n * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products\n */\nexport type UnitProductPostBodyBodyType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n};\n\nexport type UnitProductPostBodyBody = {\n /** The name you want to give the Product */\n name: string;\n /** The service identity for the Product. Products are created for use on a specific service, like a Data Manager instance */\n service_id: number;\n /** The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products */\n type: UnitProductPostBodyBodyType;\n /** The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin allowance. You must provide this for Storage products but you must not provide a value for Project Tier Products */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. You can provide this for Storage products but you must not provide a value for Project Tier Products */\n limit?: number;\n /** The day you would like to be billed for the Product's subscription (a value from 1 and 28) */\n billing_day: number;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit */\n name: string;\n};\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisation */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n /** The user identity (username) */\n id: string;\n}\n\nexport interface UserAccountDetail {\n user: UserDetail;\n /** Whether the caller has admin privilege */\n caller_has_admin_privilege: boolean;\n}\n\nexport interface UnitDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Unit's unique identity */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's owner (a username) */\n owner_id: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\n/**\n * The kind of Service\n */\nexport type ServiceGetResponseKind = \"DATA_MANAGER\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ServiceGetResponseKind = {\n DATA_MANAGER: \"DATA_MANAGER\" as ServiceGetResponseKind,\n};\n\nexport interface ServiceGetResponse {\n /** The unique ID of the Service */\n id: number;\n /** The kind of Service */\n kind: ServiceGetResponseKind;\n /** The name assigned to the Service */\n name?: string;\n}\n\nexport interface ServicesGetResponse {\n /** The list of known Services\n */\n services: ServiceGetResponse[];\n}\n\nexport interface OrganisationDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Organisation's unique ID */\n id: string;\n /** The Organisation's name */\n name: string;\n /** The username of the Organisation's owner. Not all Organisations have an owner. The Default Organisation has no owner. */\n owner_id?: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\nexport interface ProductType {\n /** A product type, this is a unique string amongst all types known to the Account Server */\n type: string;\n /** A product flavour. Not all types have a flavour, those that do have a type-specific flavour string */\n flavour?: string;\n /** For a product that belongs to a specific service, the service that owns it is provided */\n service?: ServiceGetResponse;\n}\n\nexport type ProductInstanceDetailCoins = {\n /** The number of coins used\n */\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\n/**\n * The Product Type falvour. Not all products have flavours\n\n */\nexport type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailFlavour = {\n EVALUATION: \"EVALUATION\" as ProductDetailFlavour,\n BRONZE: \"BRONZE\" as ProductDetailFlavour,\n SILVER: \"SILVER\" as ProductDetailFlavour,\n GOLD: \"GOLD\" as ProductDetailFlavour,\n};\n\n/**\n * The Product Type\n\n */\nexport type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as ProductDetailType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as ProductDetailType,\n};\n\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n /** The Product Service ID\n */\n service_id?: number;\n /** The Product Type\n */\n type: ProductDetailType;\n /** The Product Type falvour. Not all products have flavours\n */\n flavour?: ProductDetailFlavour;\n /** The name of the Product\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billing period the *cost multiplier* will increase */\n allowance: number;\n /** The limit on your billing period spend. You can exceed the allowance but you cannot exceed the spend limit. Once reached the dependent may be restricted */\n limit: number;\n /** The total number of coins consumed (in this billing period), excluding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is operating at or beyond its coin limit. When it is authority to perform actions using the product are severely limited. */\n at_limit: boolean;\n /** The current burn rate, the approximate amount of coins you are currently consuming each day */\n current_burn_rate: number;\n /** The predicted billing period amount, if costs continue at the current burn rate until the end of the billing period */\n billing_prediction: number;\n /** The day of the month when the bill is due, and the end of the current billing period */\n billing_day: number;\n /** A multiplier applied to your coin usage within your allowance */\n allowance_multiplier: number;\n /** A multiplier that will be applied to coin used beyond your allowance */\n overspend_multiplier: number;\n /** The number of days remaining, in the current billing period */\n remaining_days: number;\n}\n\nexport interface ProductClaimDetail {\n /** The service-specific ID that is using this Subscription\n */\n id: string;\n /** A name for the service-specific ID\n */\n name?: string;\n}\n\nexport type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the accumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of storage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport type ProductDmStorageDetailSize = {\n /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */\n peak: string;\n /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */\n current: string;\n /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */\n unit_size: string;\n /** The peak number of storage units used today */\n units_used: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductDmProjectTier {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n instance: ProductInstanceDetail;\n claim?: ProductClaimDetail;\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n}\n\nexport type UserAccountGetResponse = UserAccountDetail;\n\nexport interface UnitGetResponse {\n /** The Unit's unique ID */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's oener (username) */\n owner_id: string;\n}\n\nexport interface UnitProductPostResponse {\n /** The Products's unique ID */\n id: string;\n}\n\n/**\n * The Unit's Product\n */\nexport type ProductUnitGetResponseProduct =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Product */\n product: ProductUnitGetResponseProduct;\n}\n\nexport interface ProductsGetTypesResponse {\n /** All the Product Types you have access to */\n product_types: ProductType[];\n}\n\nexport type ProductsGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductsGetResponse {\n /** All the Products you have access to */\n products: ProductsGetResponseProductsItem[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisations */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\n}\n\nexport interface PersonalUnitPutResponse {\n /** The unit's Organisation. Used to identify the Default organisation */\n organisation_id: string;\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationGetDefaultResponse {\n /** Whether the user making the API call is a member of the Default Organisation. Only admin users are members of the Default organisation */\n caller_is_member: boolean;\n /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\n /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units\n */\n private: boolean;\n}\n\nexport interface UsersGetResponse {\n organisation?: OrganisationDetail;\n unit?: UnitDetail;\n /** The list of Organisation Users\n */\n users: UserDetail[];\n}\n\nexport interface OrganisationPostResponse {\n /** The Organisation's unique ID */\n id: string;\n}\n\nexport interface StateGetVersionResponse {\n /** The Account Server version. This is guaranteed to be a valid semantic version for official (tagged) images. The version value format for unofficial images is a string but otherwise undefined\n */\n version: string;\n}\n\nexport interface AsError {\n /** Brief error text that can be presented to the user */\n error: string;\n}\n"]}
package/index.d.ts CHANGED
@@ -1,20 +1,2 @@
1
- export { N as AsError, i as OrganisationDetail, J as OrganisationGetDefaultResponse, c as OrganisationPostBodyBody, L as OrganisationPostResponse, O as OrganisationUnitPostBodyBody, I as OrganisationUnitPostResponse, F as OrganisationUnitsGetResponse, E as OrganisationsGetResponse, H as PersonalUnitPutResponse, q as ProductClaimDetail, p as ProductCoinsDetail, o as ProductDetail, m as ProductDetailFlavour, n as ProductDetailType, u as ProductDmProjectTier, v as ProductDmStorage, t as ProductDmStorageDetail, r as ProductDmStorageDetailCoins, s as ProductDmStorageDetailSize, l as ProductInstanceDetail, k as ProductInstanceDetailCoins, P as ProductPatchBodyBody, j as ProductType, A as ProductUnitGetResponse, z as ProductUnitGetResponseProduct, D as ProductsGetResponse, C as ProductsGetResponseProductsItem, B as ProductsGetTypesResponse, g as ServiceGetResponse, S as ServiceGetResponseKind, h as ServicesGetResponse, M as StateGetVersionResponse, f as UnitDetail, x as UnitGetResponse, b as UnitProductPostBodyBody, U as UnitProductPostBodyBodyFlavour, a as UnitProductPostBodyBodyType, y as UnitProductPostResponse, G as UnitsGetResponse, e as UserAccountDetail, w as UserAccountGetResponse, d as UserDetail, K as UsersGetResponse } from './account-server-api.schemas-e6c5f956.js';
2
- import * as axios from 'axios';
3
- import { AxiosRequestConfig, AxiosError } from 'axios';
4
-
5
- declare const AXIOS_INSTANCE: axios.AxiosInstance;
6
- /**
7
- * Set the access token to be added as the `Authorization: Bearer 'token'` header
8
- * Useful for client only apps where a proxy API route isn't involved to securely add the access token
9
- * @param token access token
10
- */
11
- declare const setAuthToken: (token: string) => void;
12
- /**
13
- * Set the url to which request paths are added to.
14
- * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
15
- */
16
- declare const setBaseUrl: (baseUrl: string) => void;
17
- declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig<any> | undefined) => Promise<TReturn>;
18
- declare type ErrorType<TError> = AxiosError<TError>;
19
-
20
- export { AXIOS_INSTANCE, ErrorType, customInstance, setAuthToken, setBaseUrl };
1
+ export { Q as AXIOS_INSTANCE, N as AsError, W as ErrorType, i as OrganisationDetail, J as OrganisationGetDefaultResponse, c as OrganisationPostBodyBody, L as OrganisationPostResponse, O as OrganisationUnitPostBodyBody, I as OrganisationUnitPostResponse, F as OrganisationUnitsGetResponse, E as OrganisationsGetResponse, H as PersonalUnitPutResponse, q as ProductClaimDetail, p as ProductCoinsDetail, o as ProductDetail, m as ProductDetailFlavour, n as ProductDetailType, u as ProductDmProjectTier, v as ProductDmStorage, t as ProductDmStorageDetail, r as ProductDmStorageDetailCoins, s as ProductDmStorageDetailSize, l as ProductInstanceDetail, k as ProductInstanceDetailCoins, P as ProductPatchBodyBody, j as ProductType, A as ProductUnitGetResponse, z as ProductUnitGetResponseProduct, D as ProductsGetResponse, C as ProductsGetResponseProductsItem, B as ProductsGetTypesResponse, g as ServiceGetResponse, S as ServiceGetResponseKind, h as ServicesGetResponse, M as StateGetVersionResponse, f as UnitDetail, x as UnitGetResponse, b as UnitProductPostBodyBody, U as UnitProductPostBodyBodyFlavour, a as UnitProductPostBodyBodyType, y as UnitProductPostResponse, G as UnitsGetResponse, e as UserAccountDetail, w as UserAccountGetResponse, d as UserDetail, K as UsersGetResponse, V as customInstance, R as setAuthToken, T as setBaseUrl } from './custom-instance-13412a15.js';
2
+ import 'axios';
package/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "./chunk-GWBPVOL2.js";
2
+ AXIOS_INSTANCE,
3
+ customInstance,
4
+ setAuthToken,
5
+ setBaseUrl
6
+ } from "./chunk-6EEIAH4R.js";
5
7
 
6
8
  // src/account-server-api.schemas.ts
7
9
  var UnitProductPostBodyBodyFlavour = {
@@ -27,24 +29,6 @@ var ProductDetailType = {
27
29
  DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
28
30
  DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
29
31
  };
30
-
31
- // src/custom-instance.ts
32
- import Axios from "axios";
33
- var AXIOS_INSTANCE = Axios.create();
34
- var setAuthToken = (token) => {
35
- AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
36
- };
37
- var setBaseUrl = (baseUrl) => {
38
- AXIOS_INSTANCE.defaults.baseURL = baseUrl;
39
- };
40
- var customInstance = (config, options) => {
41
- const source = Axios.CancelToken.source();
42
- const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
43
- promise.cancel = () => {
44
- source.cancel("Query was cancelled by React Query");
45
- };
46
- return promise;
47
- };
48
32
  export {
49
33
  AXIOS_INSTANCE,
50
34
  ProductDetailFlavour,
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account-server-api.schemas.ts","../src/custom-instance.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. Product allowances cannot be reduced */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. The existing product limit cannot be reduced */\n limit?: number;\n};\n\n/**\n * The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products\n */\nexport type UnitProductPostBodyBodyFlavour =\n | \"EVALUATION\"\n | \"BRONZE\"\n | \"SILVER\"\n | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyFlavour = {\n EVALUATION: \"EVALUATION\" as UnitProductPostBodyBodyFlavour,\n BRONZE: \"BRONZE\" as UnitProductPostBodyBodyFlavour,\n SILVER: \"SILVER\" as UnitProductPostBodyBodyFlavour,\n GOLD: \"GOLD\" as UnitProductPostBodyBodyFlavour,\n};\n\n/**\n * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products\n */\nexport type UnitProductPostBodyBodyType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n};\n\nexport type UnitProductPostBodyBody = {\n /** The name you want to give the Product */\n name: string;\n /** The service identity for the Product. Products are created for use on a specific service, like a Data Manager instance */\n service_id: number;\n /** The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products */\n type: UnitProductPostBodyBodyType;\n /** The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin allowance. You must provide this for Storage products but you must not provide a value for Project Tier Products */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. You can provide this for Storage products but you must not provide a value for Project Tier Products */\n limit?: number;\n /** The day you would like to be billed for the Product's subscription (a value from 1 and 28) */\n billing_day: number;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit */\n name: string;\n};\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisation */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n /** The user identity (username) */\n id: string;\n}\n\nexport interface UserAccountDetail {\n user: UserDetail;\n /** Whether the caller has admin privilege */\n caller_has_admin_privilege: boolean;\n}\n\nexport interface UnitDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Unit's unique identity */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's owner (a username) */\n owner_id: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\n/**\n * The kind of Service\n */\nexport type ServiceGetResponseKind = \"DATA_MANAGER\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ServiceGetResponseKind = {\n DATA_MANAGER: \"DATA_MANAGER\" as ServiceGetResponseKind,\n};\n\nexport interface ServiceGetResponse {\n /** The unique ID of the Service */\n id: number;\n /** The kind of Service */\n kind: ServiceGetResponseKind;\n /** The name assigned to the Service */\n name?: string;\n}\n\nexport interface ServicesGetResponse {\n /** The list of known Services\n */\n services: ServiceGetResponse[];\n}\n\nexport interface OrganisationDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Organisation's unique ID */\n id: string;\n /** The Organisation's name */\n name: string;\n /** The username of the Organisation's owner. Not all Organisations have an owner. The Default Organisation has no owner. */\n owner_id?: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\nexport interface ProductType {\n /** A product type, this is a unique string amongst all types known to the Account Server */\n type: string;\n /** A product flavour. Not all types have a flavour, those that do have a type-specific flavour string */\n flavour?: string;\n /** For a product that belongs to a specific service, the service that owns it is provided */\n service?: ServiceGetResponse;\n}\n\nexport type ProductInstanceDetailCoins = {\n /** The number of coins used\n */\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\n/**\n * The Product Type falvour. Not all products have flavours\n\n */\nexport type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailFlavour = {\n EVALUATION: \"EVALUATION\" as ProductDetailFlavour,\n BRONZE: \"BRONZE\" as ProductDetailFlavour,\n SILVER: \"SILVER\" as ProductDetailFlavour,\n GOLD: \"GOLD\" as ProductDetailFlavour,\n};\n\n/**\n * The Product Type\n\n */\nexport type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as ProductDetailType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as ProductDetailType,\n};\n\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n /** The Product Service ID\n */\n service_id?: number;\n /** The Product Type\n */\n type: ProductDetailType;\n /** The Product Type falvour. Not all products have flavours\n */\n flavour?: ProductDetailFlavour;\n /** The name of the Product\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billing period the *cost multiplier* will increase */\n allowance: number;\n /** The limit on your billing period spend. You can exceed the allowance but you cannot exceed the spend limit. Once reached the dependent may be restricted */\n limit: number;\n /** The total number of coins consumed (in this billing period), excluding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is operating at or beyond its coin limit. When it is authority to perform actions using the product are severely limited. */\n at_limit: boolean;\n /** The current burn rate, the approximate amount of coins you are currently consuming each day */\n current_burn_rate: number;\n /** The predicted billing period amount, if costs continue at the current burn rate until the end of the billing period */\n billing_prediction: number;\n /** The day of the month when the bill is due, and the end of the current billing period */\n billing_day: number;\n /** A multiplier applied to your coin usage within your allowance */\n allowance_multiplier: number;\n /** A multiplier that will be applied to coin used beyond your allowance */\n overspend_multiplier: number;\n /** The number of days remaining, in the current billing period */\n remaining_days: number;\n}\n\nexport interface ProductClaimDetail {\n /** The service-specific ID that is using this Subscription\n */\n id: string;\n /** A name for the service-specific ID\n */\n name?: string;\n}\n\nexport type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the accumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of storage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport type ProductDmStorageDetailSize = {\n /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */\n peak: string;\n /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */\n current: string;\n /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */\n unit_size: string;\n /** The peak number of storage units used today */\n units_used: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductDmProjectTier {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n instance: ProductInstanceDetail;\n claim?: ProductClaimDetail;\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n}\n\nexport type UserAccountGetResponse = UserAccountDetail;\n\nexport interface UnitGetResponse {\n /** The Unit's unique ID */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's oener (username) */\n owner_id: string;\n}\n\nexport interface UnitProductPostResponse {\n /** The Products's unique ID */\n id: string;\n}\n\n/**\n * The Unit's Product\n */\nexport type ProductUnitGetResponseProduct =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Product */\n product: ProductUnitGetResponseProduct;\n}\n\nexport interface ProductsGetTypesResponse {\n /** All the Product Types you have access to */\n product_types: ProductType[];\n}\n\nexport type ProductsGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductsGetResponse {\n /** All the Products you have access to */\n products: ProductsGetResponseProductsItem[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisations */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\n}\n\nexport interface PersonalUnitPutResponse {\n /** The unit's Organisation. Used to identify the Default organisation */\n organisation_id: string;\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationGetDefaultResponse {\n /** Whether the user making the API call is a member of the Default Organisation. Only admin users are members of the Default organisation */\n caller_is_member: boolean;\n /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\n /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units\n */\n private: boolean;\n}\n\nexport interface UsersGetResponse {\n organisation?: OrganisationDetail;\n unit?: UnitDetail;\n /** The list of Organisation Users\n */\n users: UserDetail[];\n}\n\nexport interface OrganisationPostResponse {\n /** The Organisation's unique ID */\n id: string;\n}\n\nexport interface StateGetVersionResponse {\n /** The Account Server version. This is guaranteed to be a valid semantic version for official (tagged) images. The version value format for unofficial images is a string but otherwise undefined\n */\n version: string;\n}\n\nexport interface AsError {\n /** Brief error text that can be presented to the user */\n error: string;\n}\n","/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";;;;;;AA6BO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAYO,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AACJ;AA+DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAwDO,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAWO,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AACJ;;;ACvLA;AAEO,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,MAAM,EAAC,EAAE,KACnF,CAAC,EAAE,WAAW,IAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/account-server-api.schemas.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. Product allowances cannot be reduced */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. The existing product limit cannot be reduced */\n limit?: number;\n};\n\n/**\n * The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products\n */\nexport type UnitProductPostBodyBodyFlavour =\n | \"EVALUATION\"\n | \"BRONZE\"\n | \"SILVER\"\n | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyFlavour = {\n EVALUATION: \"EVALUATION\" as UnitProductPostBodyBodyFlavour,\n BRONZE: \"BRONZE\" as UnitProductPostBodyBodyFlavour,\n SILVER: \"SILVER\" as UnitProductPostBodyBodyFlavour,\n GOLD: \"GOLD\" as UnitProductPostBodyBodyFlavour,\n};\n\n/**\n * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products\n */\nexport type UnitProductPostBodyBodyType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UnitProductPostBodyBodyType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as UnitProductPostBodyBodyType,\n};\n\nexport type UnitProductPostBodyBody = {\n /** The name you want to give the Product */\n name: string;\n /** The service identity for the Product. Products are created for use on a specific service, like a Data Manager instance */\n service_id: number;\n /** The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.\n\nProject Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products */\n type: UnitProductPostBodyBodyType;\n /** The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin allowance. You must provide this for Storage products but you must not provide a value for Project Tier Products */\n allowance?: number;\n /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. You can provide this for Storage products but you must not provide a value for Project Tier Products */\n limit?: number;\n /** The day you would like to be billed for the Product's subscription (a value from 1 and 28) */\n billing_day: number;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit */\n name: string;\n};\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisation */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n /** The user identity (username) */\n id: string;\n}\n\nexport interface UserAccountDetail {\n user: UserDetail;\n /** Whether the caller has admin privilege */\n caller_has_admin_privilege: boolean;\n}\n\nexport interface UnitDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Unit's unique identity */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's owner (a username) */\n owner_id: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\n/**\n * The kind of Service\n */\nexport type ServiceGetResponseKind = \"DATA_MANAGER\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ServiceGetResponseKind = {\n DATA_MANAGER: \"DATA_MANAGER\" as ServiceGetResponseKind,\n};\n\nexport interface ServiceGetResponse {\n /** The unique ID of the Service */\n id: number;\n /** The kind of Service */\n kind: ServiceGetResponseKind;\n /** The name assigned to the Service */\n name?: string;\n}\n\nexport interface ServicesGetResponse {\n /** The list of known Services\n */\n services: ServiceGetResponse[];\n}\n\nexport interface OrganisationDetail {\n /** Whether the user making the API call is a member of the Unit */\n caller_is_member: boolean;\n /** The Organisation's unique ID */\n id: string;\n /** The Organisation's name */\n name: string;\n /** The username of the Organisation's owner. Not all Organisations have an owner. The Default Organisation has no owner. */\n owner_id?: string;\n /** True if the Unit is private */\n private: boolean;\n}\n\nexport interface ProductType {\n /** A product type, this is a unique string amongst all types known to the Account Server */\n type: string;\n /** A product flavour. Not all types have a flavour, those that do have a type-specific flavour string */\n flavour?: string;\n /** For a product that belongs to a specific service, the service that owns it is provided */\n service?: ServiceGetResponse;\n}\n\nexport type ProductInstanceDetailCoins = {\n /** The number of coins used\n */\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\n/**\n * The Product Type falvour. Not all products have flavours\n\n */\nexport type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailFlavour = {\n EVALUATION: \"EVALUATION\" as ProductDetailFlavour,\n BRONZE: \"BRONZE\" as ProductDetailFlavour,\n SILVER: \"SILVER\" as ProductDetailFlavour,\n GOLD: \"GOLD\" as ProductDetailFlavour,\n};\n\n/**\n * The Product Type\n\n */\nexport type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ProductDetailType = {\n DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:\n \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\" as ProductDetailType,\n DATA_MANAGER_STORAGE_SUBSCRIPTION:\n \"DATA_MANAGER_STORAGE_SUBSCRIPTION\" as ProductDetailType,\n};\n\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n /** The Product Service ID\n */\n service_id?: number;\n /** The Product Type\n */\n type: ProductDetailType;\n /** The Product Type falvour. Not all products have flavours\n */\n flavour?: ProductDetailFlavour;\n /** The name of the Product\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billing period the *cost multiplier* will increase */\n allowance: number;\n /** The limit on your billing period spend. You can exceed the allowance but you cannot exceed the spend limit. Once reached the dependent may be restricted */\n limit: number;\n /** The total number of coins consumed (in this billing period), excluding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is operating at or beyond its coin limit. When it is authority to perform actions using the product are severely limited. */\n at_limit: boolean;\n /** The current burn rate, the approximate amount of coins you are currently consuming each day */\n current_burn_rate: number;\n /** The predicted billing period amount, if costs continue at the current burn rate until the end of the billing period */\n billing_prediction: number;\n /** The day of the month when the bill is due, and the end of the current billing period */\n billing_day: number;\n /** A multiplier applied to your coin usage within your allowance */\n allowance_multiplier: number;\n /** A multiplier that will be applied to coin used beyond your allowance */\n overspend_multiplier: number;\n /** The number of days remaining, in the current billing period */\n remaining_days: number;\n}\n\nexport interface ProductClaimDetail {\n /** The service-specific ID that is using this Subscription\n */\n id: string;\n /** A name for the service-specific ID\n */\n name?: string;\n}\n\nexport type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the accumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of storage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport type ProductDmStorageDetailSize = {\n /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */\n peak: string;\n /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */\n current: string;\n /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */\n unit_size: string;\n /** The peak number of storage units used today */\n units_used: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductDmProjectTier {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n instance: ProductInstanceDetail;\n claim?: ProductClaimDetail;\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\n}\n\nexport type UserAccountGetResponse = UserAccountDetail;\n\nexport interface UnitGetResponse {\n /** The Unit's unique ID */\n id: string;\n /** The Unit's name */\n name: string;\n /** The Unit's oener (username) */\n owner_id: string;\n}\n\nexport interface UnitProductPostResponse {\n /** The Products's unique ID */\n id: string;\n}\n\n/**\n * The Unit's Product\n */\nexport type ProductUnitGetResponseProduct =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Product */\n product: ProductUnitGetResponseProduct;\n}\n\nexport interface ProductsGetTypesResponse {\n /** All the Product Types you have access to */\n product_types: ProductType[];\n}\n\nexport type ProductsGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductsGetResponse {\n /** All the Products you have access to */\n products: ProductsGetResponseProductsItem[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisations */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\n}\n\nexport interface PersonalUnitPutResponse {\n /** The unit's Organisation. Used to identify the Default organisation */\n organisation_id: string;\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: string;\n}\n\nexport interface OrganisationGetDefaultResponse {\n /** Whether the user making the API call is a member of the Default Organisation. Only admin users are members of the Default organisation */\n caller_is_member: boolean;\n /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\n /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units\n */\n private: boolean;\n}\n\nexport interface UsersGetResponse {\n organisation?: OrganisationDetail;\n unit?: UnitDetail;\n /** The list of Organisation Users\n */\n users: UserDetail[];\n}\n\nexport interface OrganisationPostResponse {\n /** The Organisation's unique ID */\n id: string;\n}\n\nexport interface StateGetVersionResponse {\n /** The Account Server version. This is guaranteed to be a valid semantic version for official (tagged) images. The version value format for unofficial images is a string but otherwise undefined\n */\n version: string;\n}\n\nexport interface AsError {\n /** Brief error text that can be presented to the user */\n error: string;\n}\n"],"mappings":";;;;;;;;AA6BO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAYO,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AACJ;AA+DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAwDO,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;AAWO,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AACJ;","names":[]}
@@ -1,60 +1,65 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
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 _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
3
+
4
+ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
4
5
 
5
6
  // src/organisation/organisation.ts
6
- var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
7
7
 
8
8
 
9
9
 
10
10
  var _reactquery = require('react-query');
11
- var appApiOrganisationGet = (options) => {
12
- return _axios2.default.get(`/organisation`, options);
11
+ var getOrganisations = (options) => {
12
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation`, method: "get" }, options);
13
13
  };
14
- var getAppApiOrganisationGetQueryKey = () => [`/organisation`];
15
- var useAppApiOrganisationGet = (options) => {
16
- const { query: queryOptions, axios: axiosOptions } = options || {};
17
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiOrganisationGetQueryKey()));
18
- const queryFn = () => appApiOrganisationGet(axiosOptions);
14
+ var getGetOrganisationsQueryKey = () => [`/organisation`];
15
+ var useGetOrganisations = (options) => {
16
+ const { query: queryOptions, request: requestOptions } = options || {};
17
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationsQueryKey()));
18
+ const queryFn = () => getOrganisations(requestOptions);
19
19
  const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
20
- return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
20
+ return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
21
21
  queryKey
22
22
  }, query);
23
23
  };
24
- var appApiOrganisationPost = (organisationPostBodyBody, options) => {
25
- return _axios2.default.post(`/organisation`, organisationPostBodyBody, options);
24
+ var createOrganisation = (organisationPostBodyBody, options) => {
25
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, {
26
+ url: `/organisation`,
27
+ method: "post",
28
+ headers: { "Content-Type": "application/json" },
29
+ data: organisationPostBodyBody
30
+ }, options);
26
31
  };
27
- var useAppApiOrganisationPost = (options) => {
28
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
32
+ var useCreateOrganisation = (options) => {
33
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
29
34
  const mutationFn = (props) => {
30
35
  const { data } = props || {};
31
- return appApiOrganisationPost(data, axiosOptions);
36
+ return createOrganisation(data, requestOptions);
32
37
  };
33
38
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
34
39
  };
35
- var appApiOrganisationDelete = (orgId, options) => {
36
- return _axios2.default.delete(`/organisation/${orgId}`, options);
40
+ var deleteOrganisation = (orgId, options) => {
41
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}`, method: "delete" }, options);
37
42
  };
38
- var useAppApiOrganisationDelete = (options) => {
39
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
43
+ var useDeleteOrganisation = (options) => {
44
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
40
45
  const mutationFn = (props) => {
41
46
  const { orgId } = props || {};
42
- return appApiOrganisationDelete(orgId, axiosOptions);
47
+ return deleteOrganisation(orgId, requestOptions);
43
48
  };
44
49
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
45
50
  };
46
- var appApiOrganisationGetDefault = (options) => {
47
- return _axios2.default.get(`/organisation/default`, options);
51
+ var getDefaultOrganisation = (options) => {
52
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/default`, method: "get" }, options);
48
53
  };
49
- var getAppApiOrganisationGetDefaultQueryKey = () => [
54
+ var getGetDefaultOrganisationQueryKey = () => [
50
55
  `/organisation/default`
51
56
  ];
52
- var useAppApiOrganisationGetDefault = (options) => {
53
- const { query: queryOptions, axios: axiosOptions } = options || {};
54
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiOrganisationGetDefaultQueryKey()));
55
- const queryFn = () => appApiOrganisationGetDefault(axiosOptions);
57
+ var useGetDefaultOrganisation = (options) => {
58
+ const { query: queryOptions, request: requestOptions } = options || {};
59
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetDefaultOrganisationQueryKey()));
60
+ const queryFn = () => getDefaultOrganisation(requestOptions);
56
61
  const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
57
- return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
62
+ return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
58
63
  queryKey
59
64
  }, query);
60
65
  };
@@ -69,5 +74,5 @@ var useAppApiOrganisationGetDefault = (options) => {
69
74
 
70
75
 
71
76
 
72
- exports.appApiOrganisationDelete = appApiOrganisationDelete; exports.appApiOrganisationGet = appApiOrganisationGet; exports.appApiOrganisationGetDefault = appApiOrganisationGetDefault; exports.appApiOrganisationPost = appApiOrganisationPost; exports.getAppApiOrganisationGetDefaultQueryKey = getAppApiOrganisationGetDefaultQueryKey; exports.getAppApiOrganisationGetQueryKey = getAppApiOrganisationGetQueryKey; exports.useAppApiOrganisationDelete = useAppApiOrganisationDelete; exports.useAppApiOrganisationGet = useAppApiOrganisationGet; exports.useAppApiOrganisationGetDefault = useAppApiOrganisationGetDefault; exports.useAppApiOrganisationPost = useAppApiOrganisationPost;
77
+ exports.createOrganisation = createOrganisation; exports.deleteOrganisation = deleteOrganisation; exports.getDefaultOrganisation = getDefaultOrganisation; exports.getGetDefaultOrganisationQueryKey = getGetDefaultOrganisationQueryKey; exports.getGetOrganisationsQueryKey = getGetOrganisationsQueryKey; exports.getOrganisations = getOrganisations; exports.useCreateOrganisation = useCreateOrganisation; exports.useDeleteOrganisation = useDeleteOrganisation; exports.useGetDefaultOrganisation = useGetDefaultOrganisation; exports.useGetOrganisations = useGetOrganisations;
73
78
  //# sourceMappingURL=organisation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/organisation/organisation.ts"],"names":[],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAAA;AA8BO,IAAM,wBAAwB,CACnC,YACqD;AACrD,SAAO,MAAM,IAAI,iBAAiB,OAAO;AAC3C;AAEO,IAAM,mCAAmC,MAAM,CAAC,eAAe;AAO/D,IAAM,2BAA2B,CAGtC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,iCAAiC;AAE5E,QAAM,UAEF,MAAM,sBAAsB,YAAY;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AASO,IAAM,yBAAyB,CACpC,0BACA,YACqD;AACrD,SAAO,MAAM,KAAK,iBAAiB,0BAA0B,OAAO;AACtE;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,OAAO,iBAAiB,WAAW,CAAC;AAEvE,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,SAAS,CAAC;AAE3B,WAAO,uBAAuB,MAAM,YAAY;AAAA,EAClD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAQO,IAAM,2BAA2B,CACtC,OACA,YACiC;AACjC,SAAO,MAAM,OAAO,iBAAiB,SAAS,OAAO;AACvD;AAQO,IAAM,8BAA8B,CAGzC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,OAAO,iBAAiB,WAAW,CAAC;AAEvE,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,UAAU,SAAS,CAAC;AAE5B,WAAO,yBAAyB,OAAO,YAAY;AAAA,EACrD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,+BAA+B,CAC1C,YAC2D;AAC3D,SAAO,MAAM,IAAI,yBAAyB,OAAO;AACnD;AAEO,IAAM,0CAA0C,MAAM;AAAA,EAC3D;AACF;AAOO,IAAM,kCAAkC,CAG7C,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WACJ,8CAAc,aAAY,wCAAwC;AAEpE,QAAM,UAEF,MAAM,6BAA6B,YAAY;AAEnD,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * Gets all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const appApiOrganisationGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<OrganisationsGetResponse>> => {\n return axios.get(`/organisation`, options);\n};\n\nexport const getAppApiOrganisationGetQueryKey = () => [`/organisation`];\n\nexport type AppApiOrganisationGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiOrganisationGet>\n>;\nexport type AppApiOrganisationGetQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiOrganisationGet = <\n TData = AsyncReturnType<typeof appApiOrganisationGet>,\n TError = AxiosError<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiOrganisationGet>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiOrganisationGetQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiOrganisationGet>\n > = () => appApiOrganisationGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiOrganisationGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const appApiOrganisationPost = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<OrganisationPostResponse>> => {\n return axios.post(`/organisation`, organisationPostBodyBody, options);\n};\n\nexport type AppApiOrganisationPostMutationResult = NonNullable<\n AsyncReturnType<typeof appApiOrganisationPost>\n>;\nexport type AppApiOrganisationPostMutationBody = OrganisationPostBodyBody;\nexport type AppApiOrganisationPostMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiOrganisationPost = <\n TError = AxiosError<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiOrganisationPost>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiOrganisationPost>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return appApiOrganisationPost(data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiOrganisationPost>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const appApiOrganisationDelete = (\n orgId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/organisation/${orgId}`, options);\n};\n\nexport type AppApiOrganisationDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiOrganisationDelete>\n>;\n\nexport type AppApiOrganisationDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiOrganisationDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiOrganisationDelete>,\n TError,\n { orgId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiOrganisationDelete>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props || {};\n\n return appApiOrganisationDelete(orgId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiOrganisationDelete>,\n TError,\n { orgId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const appApiOrganisationGetDefault = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<OrganisationGetDefaultResponse>> => {\n return axios.get(`/organisation/default`, options);\n};\n\nexport const getAppApiOrganisationGetDefaultQueryKey = () => [\n `/organisation/default`,\n];\n\nexport type AppApiOrganisationGetDefaultQueryResult = NonNullable<\n AsyncReturnType<typeof appApiOrganisationGetDefault>\n>;\nexport type AppApiOrganisationGetDefaultQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiOrganisationGetDefault = <\n TData = AsyncReturnType<typeof appApiOrganisationGetDefault>,\n TError = AxiosError<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiOrganisationGetDefault>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiOrganisationGetDefaultQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiOrganisationGetDefault>\n > = () => appApiOrganisationGetDefault(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiOrganisationGetDefault>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/organisation/organisation.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAuCO,IAAM,mBAAmB,CAC9B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,MAAM,GACtC,OACF;AACF;AAEO,IAAM,8BAA8B,MAAM,CAAC,eAAe;AAO1D,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAAmE,MACvE,iBAAiB,cAAc;AAEjC,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AASO,IAAM,qBAAqB,CAChC,0BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM;AAAA,EACR,GACA,OACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,SAAS,CAAC;AAE3B,WAAO,mBAAmB,MAAM,cAAc;AAAA,EAChD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAQO,IAAM,qBAAqB,CAChC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,SAAS,QAAQ,SAAS,GAClD,OACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,UAAU,SAAS,CAAC;AAE5B,WAAO,mBAAmB,OAAO,cAAc;AAAA,EACjD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,yBAAyB,CACpC,YACG;AACH,SAAO,eACL,EAAE,KAAK,yBAAyB,QAAQ,MAAM,GAC9C,OACF;AACF;AAEO,IAAM,oCAAoC,MAAM;AAAA,EACrD;AACF;AAOO,IAAM,4BAA4B,CAGvC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,kCAAkC;AAE9D,QAAM,UAEF,MAAM,uBAAuB,cAAc;AAE/C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport type GetOrganisationsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisations>\n>;\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisations = <\n TData = AsyncReturnType<typeof getOrganisations>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisations>,\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 ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>\n getOrganisations(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n {\n url: `/organisation`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisation>\n>;\nexport type CreateOrganisationMutationBody = OrganisationPostBodyBody;\nexport type CreateOrganisationMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisation = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisation>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisation>\n>;\n\nexport type DeleteOrganisationMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisation>,\n TError,\n { orgId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisation>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props || {};\n\n return deleteOrganisation(orgId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisation>,\n TError,\n { orgId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const getDefaultOrganisation = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n { url: `/organisation/default`, method: \"get\" },\n options\n );\n};\n\nexport const getGetDefaultOrganisationQueryKey = () => [\n `/organisation/default`,\n];\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<\n AsyncReturnType<typeof getDefaultOrganisation>\n>;\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetDefaultOrganisation = <\n TData = AsyncReturnType<typeof getDefaultOrganisation>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getDefaultOrganisation>,\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 =\n queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getDefaultOrganisation>\n > = () => getDefaultOrganisation(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getDefaultOrganisation>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}