@squonk/account-server-client 0.1.27-rc.1 → 0.1.28-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
- package/chunk-6EEIAH4R.js.map +1 -0
- package/chunk-NGBTCJWS.cjs +46 -0
- package/chunk-NGBTCJWS.cjs.map +1 -0
- package/{account-server-api.schemas-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -1
- package/index.cjs +5 -21
- package/index.cjs.map +1 -1
- package/index.d.ts +2 -20
- package/index.js +5 -21
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +35 -30
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +33 -32
- package/organisation/organisation.js +42 -37
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +65 -53
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +55 -54
- package/product/product.js +76 -64
- package/product/product.js.map +1 -1
- package/service/service.cjs +21 -23
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +18 -17
- package/service/service.js +23 -25
- package/service/service.js.map +1 -1
- package/src/organisation/organisation.ts +93 -69
- package/src/product/product.ts +165 -146
- package/src/service/service.ts +59 -57
- package/src/state/state.ts +34 -28
- package/src/unit/unit.ts +145 -130
- package/src/user/user.ts +148 -120
- package/state/state.cjs +12 -12
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +11 -10
- package/state/state.js +13 -13
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +55 -50
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +54 -53
- package/unit/unit.js +66 -61
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +50 -50
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +53 -52
- package/user/user.js +61 -61
- package/user/user.js.map +1 -1
- package/chunk-GWBPVOL2.js.map +0 -1
- package/chunk-N3RLW53G.cjs +0 -25
- package/chunk-N3RLW53G.cjs.map +0 -1
package/product/product.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
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 { V as customInstance, B as ProductsGetTypesResponse, W as ErrorType, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-13412a15.js';
|
|
4
|
+
import 'axios';
|
|
5
5
|
|
|
6
6
|
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
7
|
+
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
8
|
/**
|
|
8
9
|
* Gets product types you can purchase
|
|
9
10
|
|
|
10
11
|
* @summary Gets all Product Types
|
|
11
12
|
*/
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
declare type
|
|
15
|
-
declare type
|
|
16
|
-
declare const
|
|
17
|
-
query?: UseQueryOptions<
|
|
18
|
-
|
|
13
|
+
declare const getProductTypes: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetTypesResponse>;
|
|
14
|
+
declare const getGetProductTypesQueryKey: () => string[];
|
|
15
|
+
declare type GetProductTypesQueryResult = NonNullable<AsyncReturnType<typeof getProductTypes>>;
|
|
16
|
+
declare type GetProductTypesQueryError = ErrorType<AsError | void>;
|
|
17
|
+
declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
18
|
+
query?: UseQueryOptions<ProductsGetTypesResponse, TError, TData, QueryKey> | undefined;
|
|
19
|
+
request?: SecondParameter<typeof customInstance>;
|
|
19
20
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
20
21
|
queryKey: QueryKey;
|
|
21
22
|
};
|
|
@@ -24,30 +25,30 @@ declare const useAppApiProductGetTypes: <TData = AxiosResponse<ProductsGetTypesR
|
|
|
24
25
|
|
|
25
26
|
* @summary Gets all Products
|
|
26
27
|
*/
|
|
27
|
-
declare const
|
|
28
|
-
declare const
|
|
29
|
-
declare type
|
|
30
|
-
declare type
|
|
31
|
-
declare const
|
|
32
|
-
query?: UseQueryOptions<
|
|
33
|
-
|
|
28
|
+
declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
|
|
29
|
+
declare const getGetProductsQueryKey: () => string[];
|
|
30
|
+
declare type GetProductsQueryResult = NonNullable<AsyncReturnType<typeof getProducts>>;
|
|
31
|
+
declare type GetProductsQueryError = ErrorType<AsError | void>;
|
|
32
|
+
declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
33
|
+
query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
|
|
34
|
+
request?: SecondParameter<typeof customInstance>;
|
|
34
35
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
35
36
|
queryKey: QueryKey;
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
38
39
|
* @summary Creates a Product for an Organisational Unit
|
|
39
40
|
*/
|
|
40
|
-
declare const
|
|
41
|
-
declare type
|
|
42
|
-
declare type
|
|
43
|
-
declare type
|
|
44
|
-
declare const
|
|
45
|
-
mutation?: UseMutationOptions<
|
|
41
|
+
declare const createUnitProduct: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
|
|
42
|
+
declare type CreateUnitProductMutationResult = NonNullable<AsyncReturnType<typeof createUnitProduct>>;
|
|
43
|
+
declare type CreateUnitProductMutationBody = UnitProductPostBodyBody;
|
|
44
|
+
declare type CreateUnitProductMutationError = ErrorType<AsError | void>;
|
|
45
|
+
declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
46
|
+
mutation?: UseMutationOptions<UnitProductPostResponse, TError, {
|
|
46
47
|
unitId: string;
|
|
47
48
|
data: UnitProductPostBodyBody;
|
|
48
49
|
}, TContext> | undefined;
|
|
49
|
-
|
|
50
|
-
} | undefined) => react_query.UseMutationResult<
|
|
50
|
+
request?: SecondParameter<typeof customInstance>;
|
|
51
|
+
} | undefined) => react_query.UseMutationResult<UnitProductPostResponse, TError, {
|
|
51
52
|
unitId: string;
|
|
52
53
|
data: UnitProductPostBodyBody;
|
|
53
54
|
}, TContext>;
|
|
@@ -56,13 +57,13 @@ declare const useAppApiProductPost: <TError = AxiosError<void | AsError, any>, T
|
|
|
56
57
|
|
|
57
58
|
* @summary Gets Products for an Organisational Unit
|
|
58
59
|
*/
|
|
59
|
-
declare const
|
|
60
|
-
declare const
|
|
61
|
-
declare type
|
|
62
|
-
declare type
|
|
63
|
-
declare const
|
|
64
|
-
query?: UseQueryOptions<
|
|
65
|
-
|
|
60
|
+
declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
|
|
61
|
+
declare const getGetProductsForUnitQueryKey: (unitId: string) => string[];
|
|
62
|
+
declare type GetProductsForUnitQueryResult = NonNullable<AsyncReturnType<typeof getProductsForUnit>>;
|
|
63
|
+
declare type GetProductsForUnitQueryError = ErrorType<void | AsError>;
|
|
64
|
+
declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
65
|
+
query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
|
|
66
|
+
request?: SecondParameter<typeof customInstance>;
|
|
66
67
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
67
68
|
queryKey: QueryKey;
|
|
68
69
|
};
|
|
@@ -71,29 +72,29 @@ declare const useAppApiProductGetForUnit: <TData = AxiosResponse<ProductsGetResp
|
|
|
71
72
|
|
|
72
73
|
* @summary Gets a Unit's Product
|
|
73
74
|
*/
|
|
74
|
-
declare const
|
|
75
|
-
declare const
|
|
76
|
-
declare type
|
|
77
|
-
declare type
|
|
78
|
-
declare const
|
|
79
|
-
query?: UseQueryOptions<
|
|
80
|
-
|
|
75
|
+
declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
|
|
76
|
+
declare const getGetProductQueryKey: (unitId: string, productId: string) => string[];
|
|
77
|
+
declare type GetProductQueryResult = NonNullable<AsyncReturnType<typeof getProduct>>;
|
|
78
|
+
declare type GetProductQueryError = ErrorType<AsError | void>;
|
|
79
|
+
declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitId: string, productId: string, options?: {
|
|
80
|
+
query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
|
|
81
|
+
request?: SecondParameter<typeof customInstance>;
|
|
81
82
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
82
83
|
queryKey: QueryKey;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
85
86
|
* @summary Deletes an existing Product
|
|
86
87
|
*/
|
|
87
|
-
declare const
|
|
88
|
-
declare type
|
|
89
|
-
declare type
|
|
90
|
-
declare const
|
|
91
|
-
mutation?: UseMutationOptions<
|
|
88
|
+
declare const deleteProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
89
|
+
declare type DeleteProductMutationResult = NonNullable<AsyncReturnType<typeof deleteProduct>>;
|
|
90
|
+
declare type DeleteProductMutationError = ErrorType<AsError>;
|
|
91
|
+
declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
92
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
92
93
|
unitId: string;
|
|
93
94
|
productId: string;
|
|
94
95
|
}, TContext> | undefined;
|
|
95
|
-
|
|
96
|
-
} | undefined) => react_query.UseMutationResult<
|
|
96
|
+
request?: SecondParameter<typeof customInstance>;
|
|
97
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
97
98
|
unitId: string;
|
|
98
99
|
productId: string;
|
|
99
100
|
}, TContext>;
|
|
@@ -102,21 +103,21 @@ declare const useAppApiProductDelete: <TError = AxiosError<AsError, any>, TConte
|
|
|
102
103
|
|
|
103
104
|
* @summary Adjust an existing Product
|
|
104
105
|
*/
|
|
105
|
-
declare const
|
|
106
|
-
declare type
|
|
107
|
-
declare type
|
|
108
|
-
declare type
|
|
109
|
-
declare const
|
|
110
|
-
mutation?: UseMutationOptions<
|
|
106
|
+
declare const patchProduct: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
107
|
+
declare type PatchProductMutationResult = NonNullable<AsyncReturnType<typeof patchProduct>>;
|
|
108
|
+
declare type PatchProductMutationBody = ProductPatchBodyBody;
|
|
109
|
+
declare type PatchProductMutationError = ErrorType<AsError>;
|
|
110
|
+
declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
111
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
111
112
|
unitId: string;
|
|
112
113
|
productId: string;
|
|
113
114
|
data: ProductPatchBodyBody;
|
|
114
115
|
}, TContext> | undefined;
|
|
115
|
-
|
|
116
|
-
} | undefined) => react_query.UseMutationResult<
|
|
116
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
117
118
|
unitId: string;
|
|
118
119
|
productId: string;
|
|
119
120
|
data: ProductPatchBodyBody;
|
|
120
121
|
}, TContext>;
|
|
121
122
|
|
|
122
|
-
export {
|
|
123
|
+
export { CreateUnitProductMutationBody, CreateUnitProductMutationError, CreateUnitProductMutationResult, DeleteProductMutationError, DeleteProductMutationResult, GetProductQueryError, GetProductQueryResult, GetProductTypesQueryError, GetProductTypesQueryResult, GetProductsForUnitQueryError, GetProductsForUnitQueryResult, GetProductsQueryError, GetProductsQueryResult, PatchProductMutationBody, PatchProductMutationError, PatchProductMutationResult, createUnitProduct, deleteProduct, getGetProductQueryKey, getGetProductTypesQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProductTypes, getProducts, getProductsForUnit, patchProduct, useCreateUnitProduct, useDeleteProduct, useGetProduct, useGetProductTypes, useGetProducts, useGetProductsForUnit, usePatchProduct };
|
package/product/product.js
CHANGED
|
@@ -1,118 +1,130 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
|
|
2
|
+
__spreadValues,
|
|
3
|
+
customInstance
|
|
4
|
+
} from "../chunk-6EEIAH4R.js";
|
|
4
5
|
|
|
5
6
|
// src/product/product.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 getProductTypes = (options) => {
|
|
12
|
+
return customInstance({ url: `/product-type`, method: "get" }, 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 getGetProductTypesQueryKey = () => [`/product-type`];
|
|
15
|
+
var useGetProductTypes = (options) => {
|
|
16
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductTypesQueryKey();
|
|
18
|
+
const queryFn = () => getProductTypes(requestOptions);
|
|
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 getProducts = (options) => {
|
|
25
|
+
return customInstance({ url: `/product`, method: "get" }, options);
|
|
26
26
|
};
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
const { query: queryOptions,
|
|
30
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
31
|
-
const queryFn = () =>
|
|
27
|
+
var getGetProductsQueryKey = () => [`/product`];
|
|
28
|
+
var useGetProducts = (options) => {
|
|
29
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
30
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsQueryKey();
|
|
31
|
+
const queryFn = () => getProducts(requestOptions);
|
|
32
32
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
33
33
|
return __spreadValues({
|
|
34
34
|
queryKey
|
|
35
35
|
}, query);
|
|
36
36
|
};
|
|
37
|
-
var
|
|
38
|
-
return
|
|
37
|
+
var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
|
|
38
|
+
return customInstance({
|
|
39
|
+
url: `/product/unit/${unitId}`,
|
|
40
|
+
method: "post",
|
|
41
|
+
headers: { "Content-Type": "application/json" },
|
|
42
|
+
data: unitProductPostBodyBody
|
|
43
|
+
}, options);
|
|
39
44
|
};
|
|
40
|
-
var
|
|
41
|
-
const { mutation: mutationOptions,
|
|
45
|
+
var useCreateUnitProduct = (options) => {
|
|
46
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
42
47
|
const mutationFn = (props) => {
|
|
43
48
|
const { unitId, data } = props || {};
|
|
44
|
-
return
|
|
49
|
+
return createUnitProduct(unitId, data, requestOptions);
|
|
45
50
|
};
|
|
46
51
|
return useMutation(mutationFn, mutationOptions);
|
|
47
52
|
};
|
|
48
|
-
var
|
|
49
|
-
return
|
|
53
|
+
var getProductsForUnit = (unitId, options) => {
|
|
54
|
+
return customInstance({ url: `/product/unit/${unitId}`, method: "get" }, options);
|
|
50
55
|
};
|
|
51
|
-
var
|
|
56
|
+
var getGetProductsForUnitQueryKey = (unitId) => [
|
|
52
57
|
`/product/unit/${unitId}`
|
|
53
58
|
];
|
|
54
|
-
var
|
|
55
|
-
const { query: queryOptions,
|
|
56
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
57
|
-
const queryFn = () =>
|
|
59
|
+
var useGetProductsForUnit = (unitId, options) => {
|
|
60
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
61
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
|
|
62
|
+
const queryFn = () => getProductsForUnit(unitId, requestOptions);
|
|
58
63
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
|
|
59
64
|
return __spreadValues({
|
|
60
65
|
queryKey
|
|
61
66
|
}, query);
|
|
62
67
|
};
|
|
63
|
-
var
|
|
64
|
-
return
|
|
68
|
+
var getProduct = (unitId, productId, options) => {
|
|
69
|
+
return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "get" }, options);
|
|
65
70
|
};
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
+
var getGetProductQueryKey = (unitId, productId) => [
|
|
72
|
+
`/product/unit/${unitId}/product/${productId}`
|
|
73
|
+
];
|
|
74
|
+
var useGetProduct = (unitId, productId, options) => {
|
|
75
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
76
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductQueryKey(unitId, productId);
|
|
77
|
+
const queryFn = () => getProduct(unitId, productId, requestOptions);
|
|
71
78
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitId && productId) }, queryOptions));
|
|
72
79
|
return __spreadValues({
|
|
73
80
|
queryKey
|
|
74
81
|
}, query);
|
|
75
82
|
};
|
|
76
|
-
var
|
|
77
|
-
return
|
|
83
|
+
var deleteProduct = (unitId, productId, options) => {
|
|
84
|
+
return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "delete" }, options);
|
|
78
85
|
};
|
|
79
|
-
var
|
|
80
|
-
const { mutation: mutationOptions,
|
|
86
|
+
var useDeleteProduct = (options) => {
|
|
87
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
81
88
|
const mutationFn = (props) => {
|
|
82
89
|
const { unitId, productId } = props || {};
|
|
83
|
-
return
|
|
90
|
+
return deleteProduct(unitId, productId, requestOptions);
|
|
84
91
|
};
|
|
85
92
|
return useMutation(mutationFn, mutationOptions);
|
|
86
93
|
};
|
|
87
|
-
var
|
|
88
|
-
return
|
|
94
|
+
var patchProduct = (unitId, productId, productPatchBodyBody, options) => {
|
|
95
|
+
return customInstance({
|
|
96
|
+
url: `/product/unit/${unitId}/product/${productId}`,
|
|
97
|
+
method: "patch",
|
|
98
|
+
headers: { "Content-Type": "application/json" },
|
|
99
|
+
data: productPatchBodyBody
|
|
100
|
+
}, options);
|
|
89
101
|
};
|
|
90
|
-
var
|
|
91
|
-
const { mutation: mutationOptions,
|
|
102
|
+
var usePatchProduct = (options) => {
|
|
103
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
92
104
|
const mutationFn = (props) => {
|
|
93
105
|
const { unitId, productId, data } = props || {};
|
|
94
|
-
return
|
|
106
|
+
return patchProduct(unitId, productId, data, requestOptions);
|
|
95
107
|
};
|
|
96
108
|
return useMutation(mutationFn, mutationOptions);
|
|
97
109
|
};
|
|
98
110
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
createUnitProduct,
|
|
112
|
+
deleteProduct,
|
|
113
|
+
getGetProductQueryKey,
|
|
114
|
+
getGetProductTypesQueryKey,
|
|
115
|
+
getGetProductsForUnitQueryKey,
|
|
116
|
+
getGetProductsQueryKey,
|
|
117
|
+
getProduct,
|
|
118
|
+
getProductTypes,
|
|
119
|
+
getProducts,
|
|
120
|
+
getProductsForUnit,
|
|
121
|
+
patchProduct,
|
|
122
|
+
useCreateUnitProduct,
|
|
123
|
+
useDeleteProduct,
|
|
124
|
+
useGetProduct,
|
|
125
|
+
useGetProductTypes,
|
|
126
|
+
useGetProducts,
|
|
127
|
+
useGetProductsForUnit,
|
|
128
|
+
usePatchProduct
|
|
117
129
|
};
|
|
118
130
|
//# sourceMappingURL=product.js.map
|
package/product/product.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.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 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"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.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 {\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 type GetProductTypesQueryResult = NonNullable<\n AsyncReturnType<typeof getProductTypes>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\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 type GetProductsQueryResult = NonNullable<\n AsyncReturnType<typeof getProducts>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\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 headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n AsyncReturnType<typeof createUnitProduct>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\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 type GetProductsForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof getProductsForUnit>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\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 type GetProductQueryResult = NonNullable<\n AsyncReturnType<typeof getProduct>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\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 * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n AsyncReturnType<typeof deleteProduct>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteProduct>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return deleteProduct(unitId, productId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteProduct>,\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 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 headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n AsyncReturnType<typeof patchProduct>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\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"],"mappings":"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","names":[]}
|
package/service/service.cjs
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
4
5
|
|
|
5
6
|
// src/service/service.ts
|
|
6
|
-
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _reactquery = require('react-query');
|
|
10
|
-
var
|
|
11
|
-
return
|
|
10
|
+
var getServices = (options) => {
|
|
11
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/service`, method: "get" }, options);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
const { query: queryOptions,
|
|
16
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => (
|
|
17
|
-
const queryFn = () =>
|
|
13
|
+
var getGetServicesQueryKey = () => [`/service`];
|
|
14
|
+
var useGetServices = (options) => {
|
|
15
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
16
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServicesQueryKey()));
|
|
17
|
+
const queryFn = () => getServices(requestOptions);
|
|
18
18
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
19
|
-
return
|
|
19
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
20
20
|
queryKey
|
|
21
21
|
}, query);
|
|
22
22
|
};
|
|
23
|
-
var
|
|
24
|
-
return
|
|
23
|
+
var getService = (svcId, options) => {
|
|
24
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/service/${svcId}`, method: "get" }, options);
|
|
25
25
|
};
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!svcId }, queryOptions));
|
|
34
|
-
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
26
|
+
var getGetServiceQueryKey = (svcId) => [`/service/${svcId}`];
|
|
27
|
+
var useGetService = (svcId, options) => {
|
|
28
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
29
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServiceQueryKey(svcId)));
|
|
30
|
+
const queryFn = () => getService(svcId, requestOptions);
|
|
31
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!svcId }, queryOptions));
|
|
32
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
35
33
|
queryKey
|
|
36
34
|
}, query);
|
|
37
35
|
};
|
|
@@ -42,5 +40,5 @@ var useAppApiServiceGetId = (svcId, options) => {
|
|
|
42
40
|
|
|
43
41
|
|
|
44
42
|
|
|
45
|
-
exports.
|
|
43
|
+
exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
|
|
46
44
|
//# sourceMappingURL=service.cjs.map
|
package/service/service.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\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 services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, 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 ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcId: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcId: number) => [`/service/${svcId}`];\n\nexport type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, 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 = queryOptions?.queryKey ?? getGetServiceQueryKey(svcId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
|
package/service/service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
2
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
3
|
-
import { h as ServicesGetResponse, N as AsError, g as ServiceGetResponse } from '../
|
|
2
|
+
import { V as customInstance, h as ServicesGetResponse, W as ErrorType, N as AsError, g as ServiceGetResponse } from '../custom-instance-13412a15.js';
|
|
3
|
+
import 'axios';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generated by orval v6.7.1 🍺
|
|
@@ -14,18 +14,19 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
17
|
+
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
17
18
|
/**
|
|
18
19
|
* Gets services known to the Account Server
|
|
19
20
|
|
|
20
21
|
* @summary Gets all Services
|
|
21
22
|
*/
|
|
22
|
-
declare const
|
|
23
|
-
declare const
|
|
24
|
-
declare type
|
|
25
|
-
declare type
|
|
26
|
-
declare const
|
|
27
|
-
query?: UseQueryOptions<
|
|
28
|
-
|
|
23
|
+
declare const getServices: (options?: SecondParameter<typeof customInstance>) => Promise<ServicesGetResponse>;
|
|
24
|
+
declare const getGetServicesQueryKey: () => string[];
|
|
25
|
+
declare type GetServicesQueryResult = NonNullable<AsyncReturnType<typeof getServices>>;
|
|
26
|
+
declare type GetServicesQueryError = ErrorType<AsError | void>;
|
|
27
|
+
declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
28
|
+
query?: UseQueryOptions<ServicesGetResponse, TError, TData, QueryKey> | undefined;
|
|
29
|
+
request?: SecondParameter<typeof customInstance>;
|
|
29
30
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
30
31
|
queryKey: QueryKey;
|
|
31
32
|
};
|
|
@@ -34,15 +35,15 @@ declare const useAppApiServiceGet: <TData = AxiosResponse<ServicesGetResponse, a
|
|
|
34
35
|
|
|
35
36
|
* @summary Gets a specific Service
|
|
36
37
|
*/
|
|
37
|
-
declare const
|
|
38
|
-
declare const
|
|
39
|
-
declare type
|
|
40
|
-
declare type
|
|
41
|
-
declare const
|
|
42
|
-
query?: UseQueryOptions<
|
|
43
|
-
|
|
38
|
+
declare const getService: (svcId: number, options?: SecondParameter<typeof customInstance>) => Promise<ServiceGetResponse>;
|
|
39
|
+
declare const getGetServiceQueryKey: (svcId: number) => string[];
|
|
40
|
+
declare type GetServiceQueryResult = NonNullable<AsyncReturnType<typeof getService>>;
|
|
41
|
+
declare type GetServiceQueryError = ErrorType<AsError | void>;
|
|
42
|
+
declare const useGetService: <TData = ServiceGetResponse, TError = ErrorType<void | AsError>>(svcId: number, options?: {
|
|
43
|
+
query?: UseQueryOptions<ServiceGetResponse, TError, TData, QueryKey> | undefined;
|
|
44
|
+
request?: SecondParameter<typeof customInstance>;
|
|
44
45
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
45
46
|
queryKey: QueryKey;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export {
|
|
49
|
+
export { GetServiceQueryError, GetServiceQueryResult, GetServicesQueryError, GetServicesQueryResult, getGetServiceQueryKey, getGetServicesQueryKey, getService, getServices, useGetService, useGetServices };
|