@squonk/account-server-client 0.1.23 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{custom-instance-86dd5ce6.d.ts → account-server-api.schemas-078442c3.d.ts} +4 -22
- package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
- package/chunk-GWBPVOL2.js.map +1 -0
- package/chunk-N3RLW53G.cjs +25 -0
- package/chunk-N3RLW53G.cjs.map +1 -0
- package/index.cjs +21 -5
- package/index.cjs.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +21 -5
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +20 -65
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +18 -58
- package/organisation/organisation.js +20 -65
- package/organisation/organisation.js.map +1 -1
- package/package.json +14 -14
- package/product/product.cjs +32 -107
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +24 -84
- package/product/product.js +32 -107
- package/product/product.js.map +1 -1
- package/service/service.cjs +11 -38
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +9 -31
- package/service/service.js +11 -38
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +3 -3
- package/src/organisation/organisation.ts +43 -191
- package/src/product/product.ts +87 -294
- package/src/service/service.ts +17 -101
- package/src/state/state.ts +17 -66
- package/src/unit/unit.ts +71 -315
- package/src/user/user.ts +68 -330
- package/state/state.cjs +8 -22
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -16
- package/state/state.js +8 -22
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +30 -109
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +25 -92
- package/unit/unit.js +30 -109
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +30 -107
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +20 -118
- package/user/user.js +30 -107
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs +0 -46
- package/chunk-3DXYUDZH.cjs.map +0 -1
- package/chunk-JR7F532L.js.map +0 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as axios from 'axios';
|
|
2
|
-
import { AxiosRequestConfig, AxiosError } from 'axios';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
6
3
|
* Do not edit manually.
|
|
7
4
|
* Account Server API
|
|
8
5
|
* The Informatics Matters Account Server API.
|
|
@@ -14,9 +11,9 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
14
11
|
declare type ProductPatchBodyBody = {
|
|
15
12
|
/** The name you want to give the Product */
|
|
16
13
|
name?: string;
|
|
17
|
-
/** The Product's built-in coin allowance. */
|
|
14
|
+
/** The Product's built-in coin allowance. Product allowances cannot be reduced */
|
|
18
15
|
allowance?: number;
|
|
19
|
-
/** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used */
|
|
16
|
+
/** 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 */
|
|
20
17
|
limit?: number;
|
|
21
18
|
};
|
|
22
19
|
/**
|
|
@@ -315,19 +312,4 @@ interface AsError {
|
|
|
315
312
|
error: string;
|
|
316
313
|
}
|
|
317
314
|
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Set the access token to be added as the `Authorization: Bearer 'token'` header
|
|
321
|
-
* Useful for client only apps where a proxy API route isn't involved to securely add the access token
|
|
322
|
-
* @param token access token
|
|
323
|
-
*/
|
|
324
|
-
declare const setAuthToken: (token: string) => void;
|
|
325
|
-
/**
|
|
326
|
-
* Set the url to which request paths are added to.
|
|
327
|
-
* @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
|
|
328
|
-
*/
|
|
329
|
-
declare const setBaseUrl: (baseUrl: string) => void;
|
|
330
|
-
declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig<any> | undefined) => Promise<TReturn>;
|
|
331
|
-
declare type ErrorType<TError> = AxiosError<TError>;
|
|
332
|
-
|
|
333
|
-
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 };
|
|
315
|
+
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 };
|
|
@@ -18,29 +18,8 @@ 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
|
-
|
|
39
21
|
export {
|
|
40
22
|
__spreadValues,
|
|
41
|
-
|
|
42
|
-
setAuthToken,
|
|
43
|
-
setBaseUrl,
|
|
44
|
-
customInstance
|
|
23
|
+
__spreadProps
|
|
45
24
|
};
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-GWBPVOL2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});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
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps;
|
|
25
|
+
//# sourceMappingURL=chunk-N3RLW53G.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk3DXYUDZHcjs = require('./chunk-3DXYUDZH.cjs');
|
|
4
|
+
var _chunkN3RLW53Gcjs = require('./chunk-N3RLW53G.cjs');
|
|
7
5
|
|
|
8
6
|
// src/account-server-api.schemas.ts
|
|
9
7
|
var UnitProductPostBodyBodyFlavour = {
|
|
@@ -30,6 +28,24 @@ var ProductDetailType = {
|
|
|
30
28
|
DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
|
|
31
29
|
};
|
|
32
30
|
|
|
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
|
+
|
|
33
49
|
|
|
34
50
|
|
|
35
51
|
|
|
@@ -39,5 +55,5 @@ var ProductDetailType = {
|
|
|
39
55
|
|
|
40
56
|
|
|
41
57
|
|
|
42
|
-
exports.AXIOS_INSTANCE =
|
|
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;
|
|
43
59
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;AAAA;AAaD,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AAAA;AA4DG,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAAA;AAqDT,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAYD,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AAAA","sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. */\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 */\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 /** 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}\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 /** 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}\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 /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\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"]}
|
|
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;AA2DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAoDO,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;;;AC/KA;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 /** 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}\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 /** 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}\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 /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\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"]}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import 'axios';
|
|
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-078442c3.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 };
|
package/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
setBaseUrl
|
|
6
|
-
} from "./chunk-JR7F532L.js";
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-GWBPVOL2.js";
|
|
7
5
|
|
|
8
6
|
// src/account-server-api.schemas.ts
|
|
9
7
|
var UnitProductPostBodyBodyFlavour = {
|
|
@@ -29,6 +27,24 @@ var ProductDetailType = {
|
|
|
29
27
|
DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
|
|
30
28
|
DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
|
|
31
29
|
};
|
|
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
|
+
};
|
|
32
48
|
export {
|
|
33
49
|
AXIOS_INSTANCE,
|
|
34
50
|
ProductDetailFlavour,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/account-server-api.schemas.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin allowance. */\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 */\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 /** 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}\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 /** 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}\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 /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\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;AAAA;AAaD,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AAAA;AA4DG,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAAA;AAqDT,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAYD,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AAAA;","names":[]}
|
|
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 /** 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}\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 /** 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}\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 /** The Default Organisation ID\n */\n id: string;\n /** The Default Organisation Name\n */\n name: string;\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;AA2DO,IAAM,yBAAyB;AAAA,EACpC,cAAc;AAChB;AAoDO,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;;;AC/KA;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,73 +1,28 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-N3RLW53G.cjs');
|
|
5
2
|
|
|
6
3
|
// src/organisation/organisation.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getOrganisations = (options) => {
|
|
12
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation`, method: "get" }, options);
|
|
13
|
-
};
|
|
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
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
21
|
-
queryKey
|
|
22
|
-
}, query);
|
|
23
|
-
};
|
|
24
|
-
var createOrganisation = (organisationPostBodyBody, options) => {
|
|
25
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation`, method: "post", data: organisationPostBodyBody }, options);
|
|
26
|
-
};
|
|
27
|
-
var useCreateOrganisation = (options) => {
|
|
28
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
29
|
-
const mutationFn = (props) => {
|
|
30
|
-
const { data } = props || {};
|
|
31
|
-
return createOrganisation(data, requestOptions);
|
|
4
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
5
|
+
var getOrganisation = () => {
|
|
6
|
+
const appApiOrganisationGet = (options) => {
|
|
7
|
+
return _axios2.default.get(`/organisation`, options);
|
|
32
8
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
9
|
+
const appApiOrganisationPost = (organisationPostBodyBody, options) => {
|
|
10
|
+
return _axios2.default.post(`/organisation`, organisationPostBodyBody, options);
|
|
11
|
+
};
|
|
12
|
+
const appApiOrganisationDelete = (orgId, options) => {
|
|
13
|
+
return _axios2.default.delete(`/organisation/${orgId}`, options);
|
|
14
|
+
};
|
|
15
|
+
const appApiOrganisationGetDefault = (options) => {
|
|
16
|
+
return _axios2.default.get(`/organisation/default`, options);
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
appApiOrganisationGet,
|
|
20
|
+
appApiOrganisationPost,
|
|
21
|
+
appApiOrganisationDelete,
|
|
22
|
+
appApiOrganisationGetDefault
|
|
43
23
|
};
|
|
44
|
-
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
45
|
-
};
|
|
46
|
-
var getDefaultOrganisation = (options) => {
|
|
47
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/default`, method: "get" }, options);
|
|
48
|
-
};
|
|
49
|
-
var getGetDefaultOrganisationQueryKey = () => [
|
|
50
|
-
`/organisation/default`
|
|
51
|
-
];
|
|
52
|
-
var useGetDefaultOrganisation = (options) => {
|
|
53
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
54
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetDefaultOrganisationQueryKey()));
|
|
55
|
-
const queryFn = () => getDefaultOrganisation(requestOptions);
|
|
56
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
57
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
58
|
-
queryKey
|
|
59
|
-
}, query);
|
|
60
24
|
};
|
|
61
25
|
|
|
62
26
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
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;
|
|
27
|
+
exports.getOrganisation = getOrganisation;
|
|
73
28
|
//# sourceMappingURL=organisation.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/organisation/organisation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/organisation/organisation.ts"],"names":[],"mappings":";;;AAUA;AAQO,IAAM,kBAAkB,MAAM;AAMnC,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAQA,QAAM,yBAAyB,CAG7B,0BACA,YACmB;AACnB,WAAO,MAAM,KAAK,iBAAiB,0BAA0B,OAAO;AAAA,EACtE;AAQA,QAAM,2BAA2B,CAC/B,OACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,SAAS,OAAO;AAAA,EACvD;AAMA,QAAM,+BAA+B,CAGnC,YACmB;AACnB,WAAO,MAAM,IAAI,yBAAyB,OAAO;AAAA,EACnD;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","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 } from \"axios\";\nimport type {\n OrganisationsGetResponse,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getOrganisation = () => {\n /**\n * Gets all the Organisations you are a member of. Admin users can see all Organisations\n\n * @summary Gets Organisations\n */\n const appApiOrganisationGet = <\n TData = AxiosResponse<OrganisationsGetResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation`, options);\n };\n /**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\n const appApiOrganisationPost = <\n TData = AxiosResponse<OrganisationPostResponse>\n >(\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(`/organisation`, organisationPostBodyBody, options);\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 */\n const appApiOrganisationDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}`, options);\n };\n /**\n * Gets the built-in Default Organisation, used exclusively for Independent Units\n\n * @summary Gets the (built-in) Default Organisation\n */\n const appApiOrganisationGetDefault = <\n TData = AxiosResponse<OrganisationGetDefaultResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/default`, options);\n };\n return {\n appApiOrganisationGet,\n appApiOrganisationPost,\n appApiOrganisationDelete,\n appApiOrganisationGetDefault,\n };\n};\nexport type AppApiOrganisationGetResult =\n AxiosResponse<OrganisationsGetResponse>;\nexport type AppApiOrganisationPostResult =\n AxiosResponse<OrganisationPostResponse>;\nexport type AppApiOrganisationDeleteResult = AxiosResponse<void>;\nexport type AppApiOrganisationGetDefaultResult =\n AxiosResponse<OrganisationGetDefaultResponse>;\n"]}
|
|
@@ -1,66 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { V as customInstance, E as OrganisationsGetResponse, W as ErrorType, N as AsError, c as OrganisationPostBodyBody, L as OrganisationPostResponse, J as OrganisationGetDefaultResponse } from '../custom-instance-86dd5ce6';
|
|
4
|
-
import 'axios';
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { E as OrganisationsGetResponse, L as OrganisationPostResponse, c as OrganisationPostBodyBody, J as OrganisationGetDefaultResponse } from '../account-server-api.schemas-078442c3.js';
|
|
5
3
|
|
|
6
|
-
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
4
|
/**
|
|
8
|
-
*
|
|
5
|
+
* Generated by orval v6.7.1 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Account Server API
|
|
8
|
+
* The Informatics Matters Account Server API.
|
|
9
9
|
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
declare const getOrganisations: (options?: SecondParameter<typeof customInstance>) => Promise<OrganisationsGetResponse>;
|
|
13
|
-
declare const getGetOrganisationsQueryKey: () => string[];
|
|
14
|
-
declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
15
|
-
query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, QueryKey> | undefined;
|
|
16
|
-
request?: SecondParameter<typeof customInstance>;
|
|
17
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
18
|
-
queryKey: QueryKey;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new Organisation
|
|
22
|
-
|
|
23
|
-
You need **admin** rights to use this method
|
|
24
|
-
|
|
25
|
-
* @summary Create a new organisation
|
|
26
|
-
*/
|
|
27
|
-
declare const createOrganisation: (organisationPostBodyBody: OrganisationPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationPostResponse>;
|
|
28
|
-
declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
29
|
-
mutation?: UseMutationOptions<OrganisationPostResponse, TError, {
|
|
30
|
-
data: OrganisationPostBodyBody;
|
|
31
|
-
}, TContext> | undefined;
|
|
32
|
-
request?: SecondParameter<typeof customInstance>;
|
|
33
|
-
} | undefined) => react_query.UseMutationResult<OrganisationPostResponse, TError, {
|
|
34
|
-
data: OrganisationPostBodyBody;
|
|
35
|
-
}, TContext>;
|
|
36
|
-
/**
|
|
37
|
-
* Units must first be deleted before an Organisation can be deleted
|
|
38
|
-
|
|
39
|
-
You need **admin** rights to use this method
|
|
10
|
+
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
40
11
|
|
|
41
|
-
*
|
|
12
|
+
* OpenAPI spec version: 0.1
|
|
42
13
|
*/
|
|
43
|
-
declare const deleteOrganisation: (orgid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
44
|
-
declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
45
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
46
|
-
orgid: string;
|
|
47
|
-
}, TContext> | undefined;
|
|
48
|
-
request?: SecondParameter<typeof customInstance>;
|
|
49
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
50
|
-
orgid: string;
|
|
51
|
-
}, TContext>;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the built-in Default Organisation, used exclusively for Independent Units
|
|
54
14
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
query?: UseQueryOptions<OrganisationGetDefaultResponse, TError, TData, QueryKey> | undefined;
|
|
61
|
-
request?: SecondParameter<typeof customInstance>;
|
|
62
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
63
|
-
queryKey: QueryKey;
|
|
15
|
+
declare const getOrganisation: () => {
|
|
16
|
+
appApiOrganisationGet: <TData = AxiosResponse<OrganisationsGetResponse, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData>;
|
|
17
|
+
appApiOrganisationPost: <TData_1 = AxiosResponse<OrganisationPostResponse, any>>(organisationPostBodyBody: OrganisationPostBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_1>;
|
|
18
|
+
appApiOrganisationDelete: <TData_2 = AxiosResponse<void, any>>(orgId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_2>;
|
|
19
|
+
appApiOrganisationGetDefault: <TData_3 = AxiosResponse<OrganisationGetDefaultResponse, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData_3>;
|
|
64
20
|
};
|
|
21
|
+
declare type AppApiOrganisationGetResult = AxiosResponse<OrganisationsGetResponse>;
|
|
22
|
+
declare type AppApiOrganisationPostResult = AxiosResponse<OrganisationPostResponse>;
|
|
23
|
+
declare type AppApiOrganisationDeleteResult = AxiosResponse<void>;
|
|
24
|
+
declare type AppApiOrganisationGetDefaultResult = AxiosResponse<OrganisationGetDefaultResponse>;
|
|
65
25
|
|
|
66
|
-
export {
|
|
26
|
+
export { AppApiOrganisationDeleteResult, AppApiOrganisationGetDefaultResult, AppApiOrganisationGetResult, AppApiOrganisationPostResult, getOrganisation };
|