@squonk/account-server-client 0.1.24-rc.1 → 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/{custom-instance-4a108741.d.ts → account-server-api.schemas-e6c5f956.d.ts} +15 -20
- package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
- package/chunk-GWBPVOL2.js.map +1 -0
- package/chunk-N3RLW53G.cjs +25 -0
- package/chunk-N3RLW53G.cjs.map +1 -0
- package/index.cjs +21 -5
- package/index.cjs.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +21 -5
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +31 -31
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +37 -28
- package/organisation/organisation.js +38 -38
- package/organisation/organisation.js.map +1 -1
- package/package.json +14 -14
- package/product/product.cjs +64 -61
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +70 -40
- package/product/product.js +75 -72
- package/product/product.js.map +1 -1
- package/service/service.cjs +23 -21
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +19 -15
- package/service/service.js +26 -24
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +14 -1
- package/src/organisation/organisation.ts +86 -83
- package/src/product/product.ts +210 -145
- package/src/service/service.ts +64 -56
- package/src/state/state.ts +31 -32
- package/src/unit/unit.ts +170 -149
- package/src/user/user.ts +171 -160
- package/state/state.cjs +12 -12
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +12 -10
- package/state/state.js +13 -13
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +54 -58
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +64 -49
- package/unit/unit.js +67 -71
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -56
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +69 -55
- package/user/user.js +69 -69
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs +0 -46
- package/chunk-3DXYUDZH.cjs.map +0 -1
- package/chunk-JR7F532L.js.map +0 -1
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as react_query from 'react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
-
import {
|
|
4
|
-
import '
|
|
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';
|
|
5
5
|
|
|
6
|
-
declare type
|
|
6
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
7
7
|
/**
|
|
8
|
-
* Gets all the Organisations you are a member of. Admin users can see all Organisations
|
|
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
11
|
*/
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
17
19
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
18
20
|
queryKey: QueryKey;
|
|
19
21
|
};
|
|
@@ -24,13 +26,16 @@ You need **admin** rights to use this method
|
|
|
24
26
|
|
|
25
27
|
* @summary Create a new organisation
|
|
26
28
|
*/
|
|
27
|
-
declare const
|
|
28
|
-
declare
|
|
29
|
-
|
|
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, {
|
|
30
35
|
data: OrganisationPostBodyBody;
|
|
31
36
|
}, TContext> | undefined;
|
|
32
|
-
|
|
33
|
-
} | undefined) => react_query.UseMutationResult<OrganisationPostResponse, TError, {
|
|
37
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
38
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<OrganisationPostResponse, any>, TError, {
|
|
34
39
|
data: OrganisationPostBodyBody;
|
|
35
40
|
}, TContext>;
|
|
36
41
|
/**
|
|
@@ -40,27 +45,31 @@ You need **admin** rights to use this method
|
|
|
40
45
|
|
|
41
46
|
* @summary Deletes an Organisation
|
|
42
47
|
*/
|
|
43
|
-
declare const
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
|
|
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;
|
|
47
54
|
}, TContext> | undefined;
|
|
48
|
-
|
|
49
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
50
|
-
|
|
55
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
56
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
57
|
+
orgId: string;
|
|
51
58
|
}, TContext>;
|
|
52
59
|
/**
|
|
53
|
-
* Gets the built-in Default Organisation, used exclusively for
|
|
60
|
+
* Gets the built-in Default Organisation, used exclusively for Personal Units
|
|
54
61
|
|
|
55
62
|
* @summary Gets the (built-in) Default Organisation
|
|
56
63
|
*/
|
|
57
|
-
declare const
|
|
58
|
-
declare const
|
|
59
|
-
declare
|
|
60
|
-
|
|
61
|
-
|
|
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;
|
|
62
71
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
63
72
|
queryKey: QueryKey;
|
|
64
73
|
};
|
|
65
74
|
|
|
66
|
-
export {
|
|
75
|
+
export { AppApiOrganisationDeleteMutationError, AppApiOrganisationDeleteMutationResult, AppApiOrganisationGetDefaultQueryError, AppApiOrganisationGetDefaultQueryResult, AppApiOrganisationGetQueryError, AppApiOrganisationGetQueryResult, AppApiOrganisationPostMutationBody, AppApiOrganisationPostMutationError, AppApiOrganisationPostMutationResult, appApiOrganisationDelete, appApiOrganisationGet, appApiOrganisationGetDefault, appApiOrganisationPost, getAppApiOrganisationGetDefaultQueryKey, getAppApiOrganisationGetQueryKey, useAppApiOrganisationDelete, useAppApiOrganisationGet, useAppApiOrganisationGetDefault, useAppApiOrganisationPost };
|
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
|
|
4
|
-
} from "../chunk-JR7F532L.js";
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../chunk-GWBPVOL2.js";
|
|
5
4
|
|
|
6
5
|
// src/organisation/organisation.ts
|
|
6
|
+
import axios from "axios";
|
|
7
7
|
import {
|
|
8
8
|
useQuery,
|
|
9
9
|
useMutation
|
|
10
10
|
} from "react-query";
|
|
11
|
-
var
|
|
12
|
-
return
|
|
11
|
+
var appApiOrganisationGet = (options) => {
|
|
12
|
+
return axios.get(`/organisation`, options);
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
const { query: queryOptions,
|
|
17
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
18
|
-
const queryFn = () =>
|
|
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
19
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
20
|
return __spreadValues({
|
|
21
21
|
queryKey
|
|
22
22
|
}, query);
|
|
23
23
|
};
|
|
24
|
-
var
|
|
25
|
-
return
|
|
24
|
+
var appApiOrganisationPost = (organisationPostBodyBody, options) => {
|
|
25
|
+
return axios.post(`/organisation`, organisationPostBodyBody, options);
|
|
26
26
|
};
|
|
27
|
-
var
|
|
28
|
-
const { mutation: mutationOptions,
|
|
27
|
+
var useAppApiOrganisationPost = (options) => {
|
|
28
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
29
29
|
const mutationFn = (props) => {
|
|
30
30
|
const { data } = props || {};
|
|
31
|
-
return
|
|
31
|
+
return appApiOrganisationPost(data, axiosOptions);
|
|
32
32
|
};
|
|
33
33
|
return useMutation(mutationFn, mutationOptions);
|
|
34
34
|
};
|
|
35
|
-
var
|
|
36
|
-
return
|
|
35
|
+
var appApiOrganisationDelete = (orgId, options) => {
|
|
36
|
+
return axios.delete(`/organisation/${orgId}`, options);
|
|
37
37
|
};
|
|
38
|
-
var
|
|
39
|
-
const { mutation: mutationOptions,
|
|
38
|
+
var useAppApiOrganisationDelete = (options) => {
|
|
39
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
40
40
|
const mutationFn = (props) => {
|
|
41
|
-
const {
|
|
42
|
-
return
|
|
41
|
+
const { orgId } = props || {};
|
|
42
|
+
return appApiOrganisationDelete(orgId, axiosOptions);
|
|
43
43
|
};
|
|
44
44
|
return useMutation(mutationFn, mutationOptions);
|
|
45
45
|
};
|
|
46
|
-
var
|
|
47
|
-
return
|
|
46
|
+
var appApiOrganisationGetDefault = (options) => {
|
|
47
|
+
return axios.get(`/organisation/default`, options);
|
|
48
48
|
};
|
|
49
|
-
var
|
|
49
|
+
var getAppApiOrganisationGetDefaultQueryKey = () => [
|
|
50
50
|
`/organisation/default`
|
|
51
51
|
];
|
|
52
|
-
var
|
|
53
|
-
const { query: queryOptions,
|
|
54
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
55
|
-
const queryFn = () =>
|
|
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
56
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
57
57
|
return __spreadValues({
|
|
58
58
|
queryKey
|
|
59
59
|
}, query);
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
appApiOrganisationDelete,
|
|
63
|
+
appApiOrganisationGet,
|
|
64
|
+
appApiOrganisationGetDefault,
|
|
65
|
+
appApiOrganisationPost,
|
|
66
|
+
getAppApiOrganisationGetDefaultQueryKey,
|
|
67
|
+
getAppApiOrganisationGetQueryKey,
|
|
68
|
+
useAppApiOrganisationDelete,
|
|
69
|
+
useAppApiOrganisationGet,
|
|
70
|
+
useAppApiOrganisationGetDefault,
|
|
71
|
+
useAppApiOrganisationPost
|
|
72
72
|
};
|
|
73
73
|
//# sourceMappingURL=organisation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.
|
|
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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pE,QAAM,UAEF,MAAM,6BAA6B,YAAY;AAEnD,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.27-rc.1",
|
|
3
3
|
"author": "Oliver Dudgeon",
|
|
4
4
|
"name": "@squonk/account-server-client",
|
|
5
5
|
"private": false,
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "orval
|
|
15
|
-
"orval": "orval
|
|
14
|
+
"build": "orval && tsup && node setup-entrypoints.js",
|
|
15
|
+
"orval": "orval"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "
|
|
19
|
-
"axios": "0.
|
|
20
|
-
"eslint": "
|
|
21
|
-
"eslint-plugin-prettier": "
|
|
22
|
-
"js-yaml": "
|
|
23
|
-
"orval": "6.
|
|
24
|
-
"prettier": "
|
|
25
|
-
"react-query": "3.34.
|
|
26
|
-
"tslib": "
|
|
27
|
-
"tsup": "5.
|
|
28
|
-
"typescript": "
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "5.19.0",
|
|
19
|
+
"axios": "0.26.1",
|
|
20
|
+
"eslint": "8.13.0",
|
|
21
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
22
|
+
"js-yaml": "4.1.0",
|
|
23
|
+
"orval": "6.7.1",
|
|
24
|
+
"prettier": "2.6.2",
|
|
25
|
+
"react-query": "3.34.19",
|
|
26
|
+
"tslib": "2.3.1",
|
|
27
|
+
"tsup": "5.12.5",
|
|
28
|
+
"typescript": "4.6.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"axios": ">=0.23",
|
package/product/product.cjs
CHANGED
|
@@ -1,99 +1,102 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
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
2
|
|
|
3
|
-
|
|
4
|
-
var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
|
|
3
|
+
var _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
|
|
5
4
|
|
|
6
5
|
// src/product/product.ts
|
|
6
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _reactquery = require('react-query');
|
|
11
|
-
var
|
|
12
|
-
return
|
|
11
|
+
var appApiProductGetTypes = (options) => {
|
|
12
|
+
return _axios2.default.get(`/product-type`, options);
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
const { query: queryOptions,
|
|
17
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => (
|
|
18
|
-
const queryFn = () =>
|
|
14
|
+
var getAppApiProductGetTypesQueryKey = () => [`/product-type`];
|
|
15
|
+
var useAppApiProductGetTypes = (options) => {
|
|
16
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
17
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetTypesQueryKey()));
|
|
18
|
+
const queryFn = () => appApiProductGetTypes(axiosOptions);
|
|
19
19
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
|
-
return
|
|
20
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
21
21
|
queryKey
|
|
22
22
|
}, query);
|
|
23
23
|
};
|
|
24
|
-
var
|
|
25
|
-
return
|
|
24
|
+
var appApiProductGet = (options) => {
|
|
25
|
+
return _axios2.default.get(`/product`, options);
|
|
26
26
|
};
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
const { query: queryOptions,
|
|
30
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => (
|
|
31
|
-
const queryFn = () =>
|
|
27
|
+
var getAppApiProductGetQueryKey = () => [`/product`];
|
|
28
|
+
var useAppApiProductGet = (options) => {
|
|
29
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
30
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetQueryKey()));
|
|
31
|
+
const queryFn = () => appApiProductGet(axiosOptions);
|
|
32
32
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
33
|
-
return
|
|
33
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
34
34
|
queryKey
|
|
35
35
|
}, query);
|
|
36
36
|
};
|
|
37
|
-
var
|
|
38
|
-
return
|
|
39
|
-
url: `/product/unit/${unitid}`,
|
|
40
|
-
method: "post",
|
|
41
|
-
data: unitProductPostBodyBody
|
|
42
|
-
}, options);
|
|
37
|
+
var appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
|
|
38
|
+
return _axios2.default.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
|
|
43
39
|
};
|
|
44
|
-
var
|
|
45
|
-
const { mutation: mutationOptions,
|
|
40
|
+
var useAppApiProductPost = (options) => {
|
|
41
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
46
42
|
const mutationFn = (props) => {
|
|
47
|
-
const {
|
|
48
|
-
return
|
|
43
|
+
const { unitId, data } = props || {};
|
|
44
|
+
return appApiProductPost(unitId, data, axiosOptions);
|
|
49
45
|
};
|
|
50
46
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
51
47
|
};
|
|
52
|
-
var
|
|
53
|
-
return
|
|
48
|
+
var appApiProductGetForUnit = (unitId, options) => {
|
|
49
|
+
return _axios2.default.get(`/product/unit/${unitId}`, options);
|
|
54
50
|
};
|
|
55
|
-
var
|
|
56
|
-
`/product/unit/${
|
|
51
|
+
var getAppApiProductGetForUnitQueryKey = (unitId) => [
|
|
52
|
+
`/product/unit/${unitId}`
|
|
57
53
|
];
|
|
58
|
-
var
|
|
59
|
-
const { query: queryOptions,
|
|
60
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => (
|
|
61
|
-
const queryFn = () =>
|
|
62
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
63
|
-
return
|
|
54
|
+
var useAppApiProductGetForUnit = (unitId, options) => {
|
|
55
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
56
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetForUnitQueryKey(unitId)));
|
|
57
|
+
const queryFn = () => appApiProductGetForUnit(unitId, axiosOptions);
|
|
58
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
|
|
59
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
64
60
|
queryKey
|
|
65
61
|
}, query);
|
|
66
62
|
};
|
|
67
|
-
var
|
|
68
|
-
return
|
|
63
|
+
var appApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
64
|
+
return _axios2.default.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
69
65
|
};
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!(unitid && productid) }, queryOptions));
|
|
78
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
66
|
+
var getAppApiProductGetUnitProductQueryKey = (unitId, productId) => [`/product/unit/${unitId}/product/${productId}`];
|
|
67
|
+
var useAppApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
68
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
69
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetUnitProductQueryKey(unitId, productId)));
|
|
70
|
+
const queryFn = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);
|
|
71
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!(unitId && productId) }, queryOptions));
|
|
72
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
79
73
|
queryKey
|
|
80
74
|
}, query);
|
|
81
75
|
};
|
|
82
|
-
var
|
|
83
|
-
return
|
|
84
|
-
url: `/product/unit/${unitid}/product/${productid}`,
|
|
85
|
-
method: "patch",
|
|
86
|
-
data: productPatchBodyBody
|
|
87
|
-
}, options);
|
|
76
|
+
var appApiProductDelete = (unitId, productId, options) => {
|
|
77
|
+
return _axios2.default.delete(`/product/unit/${unitId}/product/${productId}`, options);
|
|
88
78
|
};
|
|
89
|
-
var
|
|
90
|
-
const { mutation: mutationOptions,
|
|
79
|
+
var useAppApiProductDelete = (options) => {
|
|
80
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
91
81
|
const mutationFn = (props) => {
|
|
92
|
-
const {
|
|
93
|
-
return
|
|
82
|
+
const { unitId, productId } = props || {};
|
|
83
|
+
return appApiProductDelete(unitId, productId, axiosOptions);
|
|
94
84
|
};
|
|
95
85
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
96
86
|
};
|
|
87
|
+
var appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
|
|
88
|
+
return _axios2.default.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
|
|
89
|
+
};
|
|
90
|
+
var useAppApiProductPatch = (options) => {
|
|
91
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
92
|
+
const mutationFn = (props) => {
|
|
93
|
+
const { unitId, productId, data } = props || {};
|
|
94
|
+
return appApiProductPatch(unitId, productId, data, axiosOptions);
|
|
95
|
+
};
|
|
96
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
|
|
97
100
|
|
|
98
101
|
|
|
99
102
|
|
|
@@ -111,5 +114,5 @@ var usePatchProduct = (options) => {
|
|
|
111
114
|
|
|
112
115
|
|
|
113
116
|
|
|
114
|
-
exports.
|
|
117
|
+
exports.appApiProductDelete = appApiProductDelete; exports.appApiProductGet = appApiProductGet; exports.appApiProductGetForUnit = appApiProductGetForUnit; exports.appApiProductGetTypes = appApiProductGetTypes; exports.appApiProductGetUnitProduct = appApiProductGetUnitProduct; exports.appApiProductPatch = appApiProductPatch; exports.appApiProductPost = appApiProductPost; exports.getAppApiProductGetForUnitQueryKey = getAppApiProductGetForUnitQueryKey; exports.getAppApiProductGetQueryKey = getAppApiProductGetQueryKey; exports.getAppApiProductGetTypesQueryKey = getAppApiProductGetTypesQueryKey; exports.getAppApiProductGetUnitProductQueryKey = getAppApiProductGetUnitProductQueryKey; exports.useAppApiProductDelete = useAppApiProductDelete; exports.useAppApiProductGet = useAppApiProductGet; exports.useAppApiProductGetForUnit = useAppApiProductGetForUnit; exports.useAppApiProductGetTypes = useAppApiProductGetTypes; exports.useAppApiProductGetUnitProduct = useAppApiProductGetUnitProduct; exports.useAppApiProductPatch = useAppApiProductPatch; exports.useAppApiProductPost = useAppApiProductPost;
|
|
115
118
|
//# sourceMappingURL=product.cjs.map
|
package/product/product.cjs.map
CHANGED
|
@@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AAY;AAAA","sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport const useGetProductTypes = <\n TData = AsyncReturnType<typeof getProductTypes>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>\n getProductTypes(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport const useGetProducts = <\n TData = AsyncReturnType<typeof getProducts>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>\n getProducts(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitid: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitid}`,\n method: \"post\",\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createUnitProduct>,\n { unitid: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitid, data } = props || {};\n\n return createUnitProduct(unitid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitid: string) => [\n `/product/unit/${unitid}`,\n];\n\nexport const useGetProductsForUnit = <\n TData = AsyncReturnType<typeof getProductsForUnit>,\n TError = ErrorType<void | AsError>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForUnit>\n > = () => getProductsForUnit(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitid: string,\n productid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/unit/${unitid}/product/${productid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitid: string, productid: string) => [\n `/product/unit/${unitid}/product/${productid}`,\n];\n\nexport const useGetProduct = <\n TData = AsyncReturnType<typeof getProduct>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n productid: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitid, productid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>\n getProduct(unitid, productid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitid && productid), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n unitid: string,\n productid: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/unit/${unitid}/product/${productid}`,\n method: \"patch\",\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchProduct>,\n { unitid: string; productid: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitid, productid, data } = props || {};\n\n return patchProduct(unitid, productid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["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KL,YAAY,eAAe;AAC/B;AAMO,IAAM,qBAAqB,CAChC,QACA,WACA,sBACA,YACiC;AACjC,SAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,OAAO,iBAAiB,WAAW,CAAC;AAEvE,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,SAAS,CAAC;AAE9C,WAAO,mBAAmB,QAAQ,WAAW,MAAM,YAAY;AAAA,EACjE;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","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 ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\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 product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const appApiProductGetTypes = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetTypesResponse>> => {\n return axios.get(`/product-type`, options);\n};\n\nexport const getAppApiProductGetTypesQueryKey = () => [`/product-type`];\n\nexport type AppApiProductGetTypesQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetTypes>\n>;\nexport type AppApiProductGetTypesQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetTypes = <\n TData = AsyncReturnType<typeof appApiProductGetTypes>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetTypes>,\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 ?? getAppApiProductGetTypesQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetTypes>\n > = () => appApiProductGetTypes(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const appApiProductGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product`, options);\n};\n\nexport const getAppApiProductGetQueryKey = () => [`/product`];\n\nexport type AppApiProductGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGet>\n>;\nexport type AppApiProductGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGet = <\n TData = AsyncReturnType<typeof appApiProductGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGet>,\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 ?? getAppApiProductGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiProductGet>> = () =>\n appApiProductGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const appApiProductPost = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UnitProductPostResponse>> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n};\n\nexport type AppApiProductPostMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPost>\n>;\nexport type AppApiProductPostMutationBody = UnitProductPostBodyBody;\nexport type AppApiProductPostMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiProductPost = <\n TError = AxiosError<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPost>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props || {};\n\n return appApiProductPost(unitId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const appApiProductGetForUnit = (\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product/unit/${unitId}`, options);\n};\n\nexport const getAppApiProductGetForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type AppApiProductGetForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetForUnit>\n>;\nexport type AppApiProductGetForUnitQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiProductGetForUnit = <\n TData = AsyncReturnType<typeof appApiProductGetForUnit>,\n TError = AxiosError<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiProductGetForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetForUnit>\n > = () => appApiProductGetForUnit(unitId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const appApiProductGetUnitProduct = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductUnitGetResponse>> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport const getAppApiProductGetUnitProductQueryKey = (\n unitId: string,\n productId: string\n) => [`/product/unit/${unitId}/product/${productId}`];\n\nexport type AppApiProductGetUnitProductQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n>;\nexport type AppApiProductGetUnitProductQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetUnitProduct = <\n TData = AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError = AxiosError<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ??\n getAppApiProductGetUnitProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n > = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!(unitId && productId), ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const appApiProductDelete = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport type AppApiProductDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductDelete>\n>;\n\nexport type AppApiProductDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductDelete>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return appApiProductDelete(unitId, productId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const appApiProductPatch = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n};\n\nexport type AppApiProductPatchMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPatch>\n>;\nexport type AppApiProductPatchMutationBody = ProductPatchBodyBody;\nexport type AppApiProductPatchMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductPatch = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPatch>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props || {};\n\n return appApiProductPatch(unitId, productId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|