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