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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/{custom-instance-d8cc704b.d.ts → custom-instance-cc5da68e.d.ts} +169 -120
  2. package/index.cjs +103 -2
  3. package/index.cjs.map +3 -3
  4. package/index.d.ts +1 -1
  5. package/index.js +69 -2
  6. package/index.js.map +3 -3
  7. package/organisation/organisation.cjs +111 -2
  8. package/organisation/organisation.cjs.map +3 -3
  9. package/organisation/organisation.d.ts +28 -123
  10. package/organisation/organisation.js +83 -2
  11. package/organisation/organisation.js.map +3 -3
  12. package/organisation/package.json +2 -1
  13. package/package.json +8 -8
  14. package/product/package.json +2 -1
  15. package/product/product.cjs +161 -2
  16. package/product/product.cjs.map +3 -3
  17. package/product/product.d.ts +60 -241
  18. package/product/product.js +127 -2
  19. package/product/product.js.map +3 -3
  20. package/src/account-server-api.schemas.ts +278 -0
  21. package/src/custom-instance.ts +52 -0
  22. package/src/index.ts +6 -0
  23. package/src/organisation/organisation.ts +181 -0
  24. package/src/product/product.ts +289 -0
  25. package/src/unit/unit.ts +322 -0
  26. package/src/user/user.ts +340 -0
  27. package/unit/package.json +2 -1
  28. package/unit/unit.cjs +168 -2
  29. package/unit/unit.cjs.map +3 -3
  30. package/unit/unit.d.ts +58 -122
  31. package/unit/unit.js +133 -2
  32. package/unit/unit.js.map +3 -3
  33. package/user/package.json +2 -1
  34. package/user/user.cjs +176 -2
  35. package/user/user.cjs.map +3 -3
  36. package/user/user.d.ts +20 -246
  37. package/user/user.js +141 -2
  38. package/user/user.js.map +3 -3
  39. package/chunk-OULWOQLW.cjs +0 -2
  40. package/chunk-OULWOQLW.cjs.map +0 -7
  41. package/chunk-WMX3LCLR.js +0 -2
  42. package/chunk-WMX3LCLR.js.map +0 -7
@@ -1,103 +1,108 @@
1
1
  import * as axios from 'axios';
2
- import { AxiosRequestConfig } from 'axios';
2
+ import { AxiosRequestConfig, AxiosError } from 'axios';
3
3
 
4
4
  /**
5
- * Generated by orval v6.3.0 🍺
5
+ * Generated by orval v6.4.2 🍺
6
6
  * Do not edit manually.
7
7
  * Account Server API
8
8
  * The Informatics Matters Account Server API.
9
9
 
10
- A service that provides access to the Account Server, which gives *registered* users access to **Products**, **Organisations**, **Units** and **Users**.
10
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
11
11
 
12
12
  * OpenAPI spec version: 0.1
13
13
  */
14
- interface Error {
15
- /** Brief error text that can be presented to the user
16
- */
17
- error: string;
18
- }
19
- interface OrganisationPostResponse {
20
- /** The organisation's unique ID
21
- */
14
+ /**
15
+ * A dummy
16
+
17
+ */
18
+ declare type QDummyParameter = boolean;
19
+ declare type ProductPatchBodyBody = {
20
+ /** The name you want to give the Product */
21
+ name?: string;
22
+ /** The Product's built-in coin alloance. */
23
+ allowance?: number;
24
+ /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used */
25
+ limit?: number;
26
+ };
27
+ /**
28
+ * The Flavour of the Product. Used only for Project Tier Products. Do nto set this for Storage products
29
+ */
30
+ declare type UnitProductPostBodyBodyFlavour = "EVALUATION" | "BRONZE" | "SILVER" | "GOLD";
31
+ declare const UnitProductPostBodyBodyFlavour: {
32
+ EVALUATION: UnitProductPostBodyBodyFlavour;
33
+ BRONZE: UnitProductPostBodyBodyFlavour;
34
+ SILVER: UnitProductPostBodyBodyFlavour;
35
+ GOLD: UnitProductPostBodyBodyFlavour;
36
+ };
37
+ /**
38
+ * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be providec. Project Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products
39
+ */
40
+ declare type UnitProductPostBodyBodyType = "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION" | "DATA_MANAGER_STORAGE_SUBSCRIPTION";
41
+ declare const UnitProductPostBodyBodyType: {
42
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: UnitProductPostBodyBodyType;
43
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: UnitProductPostBodyBodyType;
44
+ };
45
+ declare type UnitProductPostBodyBody = {
46
+ /** The name you want to give the Product */
47
+ name: string;
48
+ /** The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be providec. Project Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products */
49
+ type: UnitProductPostBodyBodyType;
50
+ /** The Flavour of the Product. Used only for Project Tier Products. Do nto set this for Storage products */
51
+ flavour?: UnitProductPostBodyBodyFlavour;
52
+ /** The Product's coin alloance. You must provide this for Storage products but you must not provide a value for Project Tier Products */
53
+ allowance?: number;
54
+ /** 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 */
55
+ limit?: number;
56
+ /** The day you would like to be billed for the Product's subscription (a value from 1 and 28) */
57
+ billing_day: number;
58
+ };
59
+ declare type OrganisationUnitPostBodyBody = {
60
+ /** The name of the unit */
61
+ name: string;
62
+ };
63
+ declare type OrganisationPostBodyBody = {
64
+ /** The name of the organisaion */
65
+ name: string;
66
+ /** The name of the organisation owner. A user ID */
67
+ owner: string;
68
+ };
69
+ interface UserDetail {
22
70
  id: string;
23
71
  }
24
- interface UsersGetResponse {
25
- organisation?: OrganisationDetail;
26
- unit?: UnitDetail;
27
- /** The list of Organisation Users
28
- */
29
- users: UserDetail[];
30
- }
31
- interface OrganisationUnitPostResponse {
32
- /** The unit's unique ID
33
- */
72
+ interface UnitDetail {
34
73
  id: string;
74
+ name: string;
75
+ owner_id?: string;
35
76
  }
36
- interface OrganisationUnitsGetResponse {
37
- organisation: OrganisationDetail;
38
- /** A list of Units
39
- */
40
- units: UnitDetail[];
41
- }
42
- interface OrganisationsGetResponse {
43
- /** A list of Organisaions
44
- */
45
- organisations: OrganisationDetail[];
46
- }
47
- declare type ProductGetResponseProductsItem = ProductDmStorage | ProductDmProjectTier;
48
- interface ProductGetResponse {
49
- /** All the Products you have access to
50
- */
51
- products: ProductGetResponseProductsItem[];
52
- }
53
- declare type ProductUnitGetResponseProductsItem = ProductDmStorage | ProductDmProjectTier;
54
- interface ProductUnitGetResponse {
55
- /** The Unit's Products you have access to
56
- */
57
- products: ProductUnitGetResponseProductsItem[];
58
- }
59
- interface ProductDmStorage {
60
- product: ProductDetail;
61
- organisation: OrganisationDetail;
62
- unit: UnitDetail;
63
- storage: ProductDmStorageDetail;
64
- coins: ProductCoinsDetail;
65
- }
66
- interface ProductDmProjectTier {
67
- product: ProductDetail;
68
- organisation: OrganisationDetail;
69
- unit: UnitDetail;
70
- storage: ProductDmStorageDetail;
71
- coins: ProductCoinsDetail;
72
- instance: ProductInstanceDetail;
73
- claim?: ProductClaimDetail;
77
+ interface OrganisationDetail {
78
+ id: string;
79
+ name: string;
80
+ owner_id?: string;
74
81
  }
75
- declare type ProductDmStorageDetailSize = {
76
- /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */
77
- peak: string;
78
- /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */
79
- current: string;
80
- /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */
81
- unit_size: string;
82
- /** The peak number of storage units used today */
83
- units_used: number;
84
- };
85
- declare type ProductDmStorageDetailCoins = {
86
- /** The number of coins currently committed for the current day. This is added to the acumulated coins at the start of each day */
82
+ declare type ProductInstanceDetailCoins = {
87
83
  used: number;
88
- /** The coin cost of a 'unit' of strage or part thereof. The unit size is defined in the storage section of the response */
89
- unit_cost: number;
90
84
  };
91
- interface ProductDmStorageDetail {
92
- size: ProductDmStorageDetailSize;
93
- coins: ProductDmStorageDetailCoins;
85
+ interface ProductInstanceDetail {
86
+ coins: ProductInstanceDetailCoins;
94
87
  }
95
- interface ProductClaimDetail {
96
- /** The service ID using this Subscription.
88
+ declare type ProductDetailFlavour = "EVALUATION" | "BRONZE" | "SILVER" | "GOLD";
89
+ declare const ProductDetailFlavour: {
90
+ EVALUATION: ProductDetailFlavour;
91
+ BRONZE: ProductDetailFlavour;
92
+ SILVER: ProductDetailFlavour;
93
+ GOLD: ProductDetailFlavour;
94
+ };
95
+ declare type ProductDetailType = "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION" | "DATA_MANAGER_STORAGE_SUBSCRIPTION";
96
+ declare const ProductDetailType: {
97
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: ProductDetailType;
98
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: ProductDetailType;
99
+ };
100
+ interface ProductDetail {
101
+ /** The Product ID
97
102
  */
98
103
  id: string;
99
- /** A name for the service
100
- */
104
+ type: ProductDetailType;
105
+ flavour?: ProductDetailFlavour;
101
106
  name?: string;
102
107
  }
103
108
  interface ProductCoinsDetail {
@@ -122,58 +127,101 @@ interface ProductCoinsDetail {
122
127
  /** The number of days remaining, in the current billing period */
123
128
  remaining_days: number;
124
129
  }
125
- declare type ProductDetailType = "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION" | "DATA_MANAGER_STORAGE_SUBSCRIPTION";
126
- declare const ProductDetailType: {
127
- DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: ProductDetailType;
128
- DATA_MANAGER_STORAGE_SUBSCRIPTION: ProductDetailType;
129
- };
130
- declare type ProductDetailFlavour = "EVALUATION" | "BRONZE" | "SILVER" | "GOLD";
131
- declare const ProductDetailFlavour: {
132
- EVALUATION: ProductDetailFlavour;
133
- BRONZE: ProductDetailFlavour;
134
- SILVER: ProductDetailFlavour;
135
- GOLD: ProductDetailFlavour;
136
- };
137
- interface ProductDetail {
138
- /** The Product ID
130
+ interface ProductClaimDetail {
131
+ /** The service ID using this Subscription.
139
132
  */
140
133
  id: string;
141
- type: ProductDetailType;
142
- flavour?: ProductDetailFlavour;
134
+ /** A name for the service
135
+ */
143
136
  name?: string;
144
137
  }
145
- declare type ProductInstanceDetailCoins = {
138
+ declare type ProductDmStorageDetailCoins = {
139
+ /** The number of coins currently committed for the current day. This is added to the acumulated coins at the start of each day */
146
140
  used: number;
141
+ /** The coin cost of a 'unit' of strage or part thereof. The unit size is defined in the storage section of the response */
142
+ unit_cost: number;
147
143
  };
148
- interface ProductInstanceDetail {
149
- coins: ProductInstanceDetailCoins;
144
+ declare type ProductDmStorageDetailSize = {
145
+ /** The humanised size of the peak storage used for the current day. The value is reset at the start of each day */
146
+ peak: string;
147
+ /** The humanised size of the current storage used for the current day and used to calculate the 'burn rate' */
148
+ current: string;
149
+ /** The humanised storage unit. The cost of storage is based on the daily peak of the number of units (or part thereof) used */
150
+ unit_size: string;
151
+ /** The peak number of storage units used today */
152
+ units_used: number;
153
+ };
154
+ interface ProductDmStorageDetail {
155
+ size: ProductDmStorageDetailSize;
156
+ coins: ProductDmStorageDetailCoins;
150
157
  }
151
- interface OrganisationDetail {
152
- id: string;
153
- name: string;
158
+ interface ProductDmProjectTier {
159
+ product: ProductDetail;
160
+ organisation: OrganisationDetail;
161
+ unit: UnitDetail;
162
+ storage: ProductDmStorageDetail;
163
+ coins: ProductCoinsDetail;
164
+ instance: ProductInstanceDetail;
165
+ claim?: ProductClaimDetail;
154
166
  }
155
- interface UnitDetail {
156
- id: string;
157
- name: string;
167
+ interface ProductDmStorage {
168
+ product: ProductDetail;
169
+ organisation: OrganisationDetail;
170
+ unit: UnitDetail;
171
+ storage: ProductDmStorageDetail;
172
+ coins: ProductCoinsDetail;
158
173
  }
159
- interface UserDetail {
174
+ interface UnitsGetResponse {
175
+ /** A list of Units
176
+ */
177
+ units: OrganisationUnitsGetResponse[];
178
+ }
179
+ interface UnitProductPostResponse {
180
+ /** The products's unique ID */
160
181
  id: string;
161
182
  }
162
- declare type OrganisationPostBodyBody = {
163
- /** The name of the organisaion
164
- */
165
- name: string;
166
- };
167
- declare type OrganisationUnitPostBodyBody = {
168
- /** The name of the unit
169
- */
170
- name: string;
171
- };
172
183
  /**
173
- * A dummy
174
-
184
+ * The Unit's Product
175
185
  */
176
- declare type QDummyParameter = boolean;
186
+ declare type ProductUnitGetResponseProduct = ProductDmStorage | ProductDmProjectTier;
187
+ interface ProductUnitGetResponse {
188
+ /** The Unit's Product */
189
+ product: ProductUnitGetResponseProduct;
190
+ }
191
+ declare type ProductsGetResponseProductsItem = ProductDmStorage | ProductDmProjectTier;
192
+ interface ProductsGetResponse {
193
+ /** All the Products you have access to */
194
+ products: ProductsGetResponseProductsItem[];
195
+ }
196
+ interface OrganisationsGetResponse {
197
+ /** A list of Organisaions */
198
+ organisations: OrganisationDetail[];
199
+ }
200
+ interface OrganisationUnitsGetResponse {
201
+ organisation: OrganisationDetail;
202
+ /** A list of Units
203
+ */
204
+ units: UnitDetail[];
205
+ }
206
+ interface OrganisationUnitPostResponse {
207
+ /** The unit's unique ID */
208
+ id: string;
209
+ }
210
+ interface UsersGetResponse {
211
+ organisation?: OrganisationDetail;
212
+ unit?: UnitDetail;
213
+ /** The list of Organisation Users
214
+ */
215
+ users: UserDetail[];
216
+ }
217
+ interface OrganisationPostResponse {
218
+ /** The organisation's unique ID */
219
+ id: string;
220
+ }
221
+ interface AsError {
222
+ /** Brief error text that can be presented to the user */
223
+ error: string;
224
+ }
177
225
 
178
226
  declare const AXIOS_INSTANCE: axios.AxiosInstance;
179
227
  /**
@@ -188,5 +236,6 @@ declare const setAuthToken: (token: string) => void;
188
236
  */
189
237
  declare const setBaseUrl: (baseUrl: string) => void;
190
238
  declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig<any> | undefined) => Promise<TReturn>;
239
+ declare type ErrorType<TError> = AxiosError<TError>;
191
240
 
192
- export { AXIOS_INSTANCE as A, Error as E, OrganisationPostResponse as O, ProductGetResponseProductsItem as P, QDummyParameter as Q, UsersGetResponse as U, OrganisationUnitPostResponse as a, OrganisationUnitsGetResponse as b, OrganisationsGetResponse as c, ProductGetResponse as d, ProductUnitGetResponseProductsItem as e, ProductUnitGetResponse as f, ProductDmStorage as g, ProductDmProjectTier as h, ProductDmStorageDetailSize as i, ProductDmStorageDetailCoins as j, ProductDmStorageDetail as k, ProductClaimDetail as l, ProductCoinsDetail as m, ProductDetailType as n, ProductDetailFlavour as o, ProductDetail as p, ProductInstanceDetailCoins as q, ProductInstanceDetail as r, OrganisationDetail as s, UnitDetail as t, UserDetail as u, OrganisationPostBodyBody as v, OrganisationUnitPostBodyBody as w, setAuthToken as x, setBaseUrl as y, customInstance as z };
241
+ export { OrganisationUnitPostResponse as A, UsersGetResponse as B, OrganisationPostResponse as C, AsError as D, AXIOS_INSTANCE as E, setAuthToken as F, setBaseUrl as G, customInstance as H, ErrorType as I, OrganisationUnitPostBodyBody as O, ProductPatchBodyBody as P, QDummyParameter as Q, UnitProductPostBodyBodyFlavour as U, UnitProductPostBodyBodyType as a, UnitProductPostBodyBody as b, OrganisationPostBodyBody as c, UserDetail as d, UnitDetail as e, OrganisationDetail as f, ProductInstanceDetailCoins as g, ProductInstanceDetail as h, ProductDetailFlavour as i, ProductDetailType as j, ProductDetail as k, ProductCoinsDetail as l, ProductClaimDetail as m, ProductDmStorageDetailCoins as n, ProductDmStorageDetailSize as o, ProductDmStorageDetail as p, ProductDmProjectTier as q, ProductDmStorage as r, UnitsGetResponse as s, UnitProductPostResponse as t, ProductUnitGetResponseProduct as u, ProductUnitGetResponse as v, ProductsGetResponseProductsItem as w, ProductsGetResponse as x, OrganisationsGetResponse as y, OrganisationUnitsGetResponse as z };
package/index.cjs CHANGED
@@ -1,2 +1,103 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOULWOQLWcjs = require('./chunk-OULWOQLW.cjs');var n={DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",DATA_MANAGER_STORAGE_SUBSCRIPTION:"DATA_MANAGER_STORAGE_SUBSCRIPTION"},a= exports.ProductDetailFlavour ={EVALUATION:"EVALUATION",BRONZE:"BRONZE",SILVER:"SILVER",GOLD:"GOLD"};exports.AXIOS_INSTANCE = _chunkOULWOQLWcjs.b; exports.ProductDetailFlavour = a; exports.ProductDetailType = n; exports.customInstance = _chunkOULWOQLWcjs.e; exports.setAuthToken = _chunkOULWOQLWcjs.c; exports.setBaseUrl = _chunkOULWOQLWcjs.d;
2
- //# sourceMappingURL=index.cjs.map
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ __markAsModule(target);
27
+ for (var name in all)
28
+ __defProp(target, name, { get: all[name], enumerable: true });
29
+ };
30
+ var __reExport = (target, module2, desc) => {
31
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
+ for (let key of __getOwnPropNames(module2))
33
+ if (!__hasOwnProp.call(target, key) && key !== "default")
34
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
+ }
36
+ return target;
37
+ };
38
+ var __toModule = (module2) => {
39
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
+ };
41
+
42
+ // src/index.ts
43
+ __export(exports, {
44
+ AXIOS_INSTANCE: () => AXIOS_INSTANCE,
45
+ ProductDetailFlavour: () => ProductDetailFlavour,
46
+ ProductDetailType: () => ProductDetailType,
47
+ UnitProductPostBodyBodyFlavour: () => UnitProductPostBodyBodyFlavour,
48
+ UnitProductPostBodyBodyType: () => UnitProductPostBodyBodyType,
49
+ customInstance: () => customInstance,
50
+ setAuthToken: () => setAuthToken,
51
+ setBaseUrl: () => setBaseUrl
52
+ });
53
+
54
+ // src/account-server-api.schemas.ts
55
+ var UnitProductPostBodyBodyFlavour = {
56
+ EVALUATION: "EVALUATION",
57
+ BRONZE: "BRONZE",
58
+ SILVER: "SILVER",
59
+ GOLD: "GOLD"
60
+ };
61
+ var UnitProductPostBodyBodyType = {
62
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
63
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
64
+ };
65
+ var ProductDetailFlavour = {
66
+ EVALUATION: "EVALUATION",
67
+ BRONZE: "BRONZE",
68
+ SILVER: "SILVER",
69
+ GOLD: "GOLD"
70
+ };
71
+ var ProductDetailType = {
72
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
73
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
74
+ };
75
+
76
+ // src/custom-instance.ts
77
+ var import_axios = __toModule(require("axios"));
78
+ var AXIOS_INSTANCE = import_axios.default.create({ baseURL: "" });
79
+ var setAuthToken = (token) => {
80
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
81
+ };
82
+ var setBaseUrl = (baseUrl) => {
83
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
84
+ };
85
+ var customInstance = (config, options) => {
86
+ const source = import_axios.default.CancelToken.source();
87
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
88
+ promise.cancel = () => {
89
+ source.cancel("Query was cancelled by React Query");
90
+ };
91
+ return promise;
92
+ };
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ AXIOS_INSTANCE,
96
+ ProductDetailFlavour,
97
+ ProductDetailType,
98
+ UnitProductPostBodyBodyFlavour,
99
+ UnitProductPostBodyBodyType,
100
+ customInstance,
101
+ setAuthToken,
102
+ setBaseUrl
103
+ });
package/index.cjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/account-server-api.schemas.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.3.0 \uD83C\uDF7A\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nexport interface Error {\n /** Brief error text that can be presented to the user\n */\n error: string;\n}\n\nexport interface OrganisationPostResponse {\n /** The organisation's unique ID\n */\n id: 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 OrganisationUnitPostResponse {\n /** The unit's unique ID\n */\n id: string;\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisaions\n */\n organisations: OrganisationDetail[];\n}\n\nexport type ProductGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductGetResponse {\n /** All the Products you have access to\n */\n products: ProductGetResponseProductsItem[];\n}\n\nexport type ProductUnitGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Products you have access to\n */\n products: ProductUnitGetResponseProductsItem[];\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\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 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 type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the acumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of strage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductClaimDetail {\n /** The service ID using this Subscription.\n */\n id: string;\n /** A name for the service\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billign period the *cost multipler* 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), exclding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is oeprating at or beyond its coin limit. When it is authority to perform actions using the product are severly 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 billign period */\n billing_day: number;\n /** A multipler applied to your coin usage within yoru allowance */\n allowance_multiplier: number;\n /** A multipler 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 type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\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 type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\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\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n type: ProductDetailType;\n flavour?: ProductDetailFlavour;\n name?: string;\n}\n\nexport type ProductInstanceDetailCoins = {\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\nexport interface OrganisationDetail {\n id: string;\n name: string;\n}\n\nexport interface UnitDetail {\n id: string;\n name: string;\n}\n\nexport interface UserDetail {\n id: string;\n}\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisaion\n */\n name: string;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit\n */\n name: string;\n};\n\n/**\n * A dummy\n\n */\nexport type QDummyParameter = boolean;\n"],
5
- "mappings": "8DAkJO,GAAM,GAAoB,CAC/B,uCACE,yCACF,kCACE,qCAKS,EAAuB,CAClC,WAAY,aACZ,OAAQ,SACR,OAAQ,SACR,KAAM",
3
+ "sources": ["../src/index.ts", "../src/account-server-api.schemas.ts", "../src/custom-instance.ts"],
4
+ "sourcesContent": ["// Generated by orval\n// account-server-api Is replaced with the api name\nexport * from './account-server-api.schemas';\n\n// Request instance and methods to change the baseUrl and auth token\nexport * from './custom-instance';\n", "/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\n/**\n * A dummy\n\n */\nexport type QDummyParameter = boolean;\n\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin alloance. */\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 nto 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 providec. Project 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 Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be providec. Project 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 nto set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin alloance. 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 organisaion */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n id: string;\n}\n\nexport interface UnitDetail {\n id: string;\n name: string;\n owner_id?: string;\n}\n\nexport interface OrganisationDetail {\n id: string;\n name: string;\n owner_id?: string;\n}\n\nexport type ProductInstanceDetailCoins = {\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\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\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 type: ProductDetailType;\n flavour?: ProductDetailFlavour;\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billign period the *cost multipler* 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), exclding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is oeprating at or beyond its coin limit. When it is authority to perform actions using the product are severly 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 billign period */\n billing_day: number;\n /** A multipler applied to your coin usage within yoru allowance */\n allowance_multiplier: number;\n /** A multipler 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 ID using this Subscription.\n */\n id: string;\n /** A name for the service\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 acumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of strage 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 interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\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 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 Organisaions */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: 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 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\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmCO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAWD,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AAAA;AAyDG,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAQD,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AAAA;;;ACrHJ,mBAAsD;AAG/C,IAAM,iBAAiB,qBAAM,OAAO,EAAE,SAAS;AAO/C,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,qBAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;",
6
6
  "names": []
7
7
  }
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AXIOS_INSTANCE, E as Error, s as OrganisationDetail, v as OrganisationPostBodyBody, O as OrganisationPostResponse, w as OrganisationUnitPostBodyBody, a as OrganisationUnitPostResponse, b as OrganisationUnitsGetResponse, c as OrganisationsGetResponse, l as ProductClaimDetail, m as ProductCoinsDetail, p as ProductDetail, o as ProductDetailFlavour, n as ProductDetailType, h as ProductDmProjectTier, g as ProductDmStorage, k as ProductDmStorageDetail, j as ProductDmStorageDetailCoins, i as ProductDmStorageDetailSize, d as ProductGetResponse, P as ProductGetResponseProductsItem, r as ProductInstanceDetail, q as ProductInstanceDetailCoins, f as ProductUnitGetResponse, e as ProductUnitGetResponseProductsItem, Q as QDummyParameter, t as UnitDetail, u as UserDetail, U as UsersGetResponse, z as customInstance, x as setAuthToken, y as setBaseUrl } from './custom-instance-d8cc704b';
1
+ export { E as AXIOS_INSTANCE, D as AsError, I as ErrorType, f as OrganisationDetail, c as OrganisationPostBodyBody, C as OrganisationPostResponse, O as OrganisationUnitPostBodyBody, A as OrganisationUnitPostResponse, z as OrganisationUnitsGetResponse, y as OrganisationsGetResponse, m as ProductClaimDetail, l as ProductCoinsDetail, k as ProductDetail, i as ProductDetailFlavour, j as ProductDetailType, q as ProductDmProjectTier, r as ProductDmStorage, p as ProductDmStorageDetail, n as ProductDmStorageDetailCoins, o as ProductDmStorageDetailSize, h as ProductInstanceDetail, g as ProductInstanceDetailCoins, P as ProductPatchBodyBody, v as ProductUnitGetResponse, u as ProductUnitGetResponseProduct, x as ProductsGetResponse, w as ProductsGetResponseProductsItem, Q as QDummyParameter, e as UnitDetail, b as UnitProductPostBodyBody, U as UnitProductPostBodyBodyFlavour, a as UnitProductPostBodyBodyType, t as UnitProductPostResponse, s as UnitsGetResponse, d as UserDetail, B as UsersGetResponse, H as customInstance, F as setAuthToken, G as setBaseUrl } from './custom-instance-cc5da68e';
2
2
  import 'axios';
package/index.js CHANGED
@@ -1,2 +1,69 @@
1
- import{b as t,c as e,d as r,e as i}from"./chunk-WMX3LCLR.js";var o={DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",DATA_MANAGER_STORAGE_SUBSCRIPTION:"DATA_MANAGER_STORAGE_SUBSCRIPTION"},n={EVALUATION:"EVALUATION",BRONZE:"BRONZE",SILVER:"SILVER",GOLD:"GOLD"};export{t as AXIOS_INSTANCE,n as ProductDetailFlavour,o as ProductDetailType,i as customInstance,e as setAuthToken,r as setBaseUrl};
2
- //# sourceMappingURL=index.js.map
1
+ 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/account-server-api.schemas.ts
22
+ var UnitProductPostBodyBodyFlavour = {
23
+ EVALUATION: "EVALUATION",
24
+ BRONZE: "BRONZE",
25
+ SILVER: "SILVER",
26
+ GOLD: "GOLD"
27
+ };
28
+ var UnitProductPostBodyBodyType = {
29
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
30
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
31
+ };
32
+ var ProductDetailFlavour = {
33
+ EVALUATION: "EVALUATION",
34
+ BRONZE: "BRONZE",
35
+ SILVER: "SILVER",
36
+ GOLD: "GOLD"
37
+ };
38
+ var ProductDetailType = {
39
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION: "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
40
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION"
41
+ };
42
+
43
+ // src/custom-instance.ts
44
+ import Axios from "axios";
45
+ var AXIOS_INSTANCE = Axios.create({ baseURL: "" });
46
+ var setAuthToken = (token) => {
47
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
48
+ };
49
+ var setBaseUrl = (baseUrl) => {
50
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
51
+ };
52
+ var customInstance = (config, options) => {
53
+ const source = Axios.CancelToken.source();
54
+ const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
55
+ promise.cancel = () => {
56
+ source.cancel("Query was cancelled by React Query");
57
+ };
58
+ return promise;
59
+ };
60
+ export {
61
+ AXIOS_INSTANCE,
62
+ ProductDetailFlavour,
63
+ ProductDetailType,
64
+ UnitProductPostBodyBodyFlavour,
65
+ UnitProductPostBodyBodyType,
66
+ customInstance,
67
+ setAuthToken,
68
+ setBaseUrl
69
+ };
package/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/account-server-api.schemas.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.3.0 \uD83C\uDF7A\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nexport interface Error {\n /** Brief error text that can be presented to the user\n */\n error: string;\n}\n\nexport interface OrganisationPostResponse {\n /** The organisation's unique ID\n */\n id: 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 OrganisationUnitPostResponse {\n /** The unit's unique ID\n */\n id: string;\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface OrganisationsGetResponse {\n /** A list of Organisaions\n */\n organisations: OrganisationDetail[];\n}\n\nexport type ProductGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductGetResponse {\n /** All the Products you have access to\n */\n products: ProductGetResponseProductsItem[];\n}\n\nexport type ProductUnitGetResponseProductsItem =\n | ProductDmStorage\n | ProductDmProjectTier;\n\nexport interface ProductUnitGetResponse {\n /** The Unit's Products you have access to\n */\n products: ProductUnitGetResponseProductsItem[];\n}\n\nexport interface ProductDmStorage {\n product: ProductDetail;\n organisation: OrganisationDetail;\n unit: UnitDetail;\n storage: ProductDmStorageDetail;\n coins: ProductCoinsDetail;\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 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 type ProductDmStorageDetailCoins = {\n /** The number of coins currently committed for the current day. This is added to the acumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of strage or part thereof. The unit size is defined in the storage section of the response */\n unit_cost: number;\n};\n\nexport interface ProductDmStorageDetail {\n size: ProductDmStorageDetailSize;\n coins: ProductDmStorageDetailCoins;\n}\n\nexport interface ProductClaimDetail {\n /** The service ID using this Subscription.\n */\n id: string;\n /** A name for the service\n */\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billign period the *cost multipler* 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), exclding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is oeprating at or beyond its coin limit. When it is authority to perform actions using the product are severly 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 billign period */\n billing_day: number;\n /** A multipler applied to your coin usage within yoru allowance */\n allowance_multiplier: number;\n /** A multipler 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 type ProductDetailType =\n | \"DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION\"\n | \"DATA_MANAGER_STORAGE_SUBSCRIPTION\";\n\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 type ProductDetailFlavour = \"EVALUATION\" | \"BRONZE\" | \"SILVER\" | \"GOLD\";\n\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\nexport interface ProductDetail {\n /** The Product ID\n */\n id: string;\n type: ProductDetailType;\n flavour?: ProductDetailFlavour;\n name?: string;\n}\n\nexport type ProductInstanceDetailCoins = {\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\n}\n\nexport interface OrganisationDetail {\n id: string;\n name: string;\n}\n\nexport interface UnitDetail {\n id: string;\n name: string;\n}\n\nexport interface UserDetail {\n id: string;\n}\n\nexport type OrganisationPostBodyBody = {\n /** The name of the organisaion\n */\n name: string;\n};\n\nexport type OrganisationUnitPostBodyBody = {\n /** The name of the unit\n */\n name: string;\n};\n\n/**\n * A dummy\n\n */\nexport type QDummyParameter = boolean;\n"],
5
- "mappings": "6DAkJO,GAAM,GAAoB,CAC/B,uCACE,yCACF,kCACE,qCAKS,EAAuB,CAClC,WAAY,aACZ,OAAQ,SACR,OAAQ,SACR,KAAM",
3
+ "sources": ["../src/account-server-api.schemas.ts", "../src/custom-instance.ts"],
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\n/**\n * A dummy\n\n */\nexport type QDummyParameter = boolean;\n\nexport type ProductPatchBodyBody = {\n /** The name you want to give the Product */\n name?: string;\n /** The Product's built-in coin alloance. */\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 nto 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 providec. Project 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 Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be providec. Project 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 nto set this for Storage products */\n flavour?: UnitProductPostBodyBodyFlavour;\n /** The Product's coin alloance. 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 organisaion */\n name: string;\n /** The name of the organisation owner. A user ID */\n owner: string;\n};\n\nexport interface UserDetail {\n id: string;\n}\n\nexport interface UnitDetail {\n id: string;\n name: string;\n owner_id?: string;\n}\n\nexport interface OrganisationDetail {\n id: string;\n name: string;\n owner_id?: string;\n}\n\nexport type ProductInstanceDetailCoins = {\n used: number;\n};\n\nexport interface ProductInstanceDetail {\n coins: ProductInstanceDetailCoins;\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\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 type: ProductDetailType;\n flavour?: ProductDetailFlavour;\n name?: string;\n}\n\nexport interface ProductCoinsDetail {\n /** The billing allowance. When you exceed this during the current billign period the *cost multipler* 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), exclding the coins that have been consumed for the current day */\n used: number;\n /** True if the product is oeprating at or beyond its coin limit. When it is authority to perform actions using the product are severly 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 billign period */\n billing_day: number;\n /** A multipler applied to your coin usage within yoru allowance */\n allowance_multiplier: number;\n /** A multipler 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 ID using this Subscription.\n */\n id: string;\n /** A name for the service\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 acumulated coins at the start of each day */\n used: number;\n /** The coin cost of a 'unit' of strage 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 interface UnitsGetResponse {\n /** A list of Units\n */\n units: OrganisationUnitsGetResponse[];\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 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 Organisaions */\n organisations: OrganisationDetail[];\n}\n\nexport interface OrganisationUnitsGetResponse {\n organisation: OrganisationDetail;\n /** A list of Units\n */\n units: UnitDetail[];\n}\n\nexport interface OrganisationUnitPostResponse {\n /** The unit's unique ID */\n id: 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 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\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAmCO,IAAM,iCAAiC;AAAA,EAC5C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAWD,IAAM,8BAA8B;AAAA,EACzC,wCACE;AAAA,EACF,mCACE;AAAA;AAyDG,IAAM,uBAAuB;AAAA,EAClC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA;AAQD,IAAM,oBAAoB;AAAA,EAC/B,wCACE;AAAA,EACF,mCACE;AAAA;;;ACrHJ;AAGO,IAAM,iBAAiB,MAAM,OAAO,EAAE,SAAS;AAO/C,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;",
6
6
  "names": []
7
7
  }