@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.
Files changed (51) hide show
  1. package/{custom-instance-4a108741.d.ts → account-server-api.schemas-e6c5f956.d.ts} +15 -20
  2. package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
  3. package/chunk-GWBPVOL2.js.map +1 -0
  4. package/chunk-N3RLW53G.cjs +25 -0
  5. package/chunk-N3RLW53G.cjs.map +1 -0
  6. package/index.cjs +21 -5
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +20 -2
  9. package/index.js +21 -5
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +31 -31
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +37 -28
  14. package/organisation/organisation.js +38 -38
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +14 -14
  17. package/product/product.cjs +64 -61
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +70 -40
  20. package/product/product.js +75 -72
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +23 -21
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +19 -15
  25. package/service/service.js +26 -24
  26. package/service/service.js.map +1 -1
  27. package/src/account-server-api.schemas.ts +14 -1
  28. package/src/organisation/organisation.ts +86 -83
  29. package/src/product/product.ts +210 -145
  30. package/src/service/service.ts +64 -56
  31. package/src/state/state.ts +31 -32
  32. package/src/unit/unit.ts +170 -149
  33. package/src/user/user.ts +171 -160
  34. package/state/state.cjs +12 -12
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +12 -10
  37. package/state/state.js +13 -13
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +54 -58
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +64 -49
  42. package/unit/unit.js +67 -71
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +56 -56
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +69 -55
  47. package/user/user.js +69 -69
  48. package/user/user.js.map +1 -1
  49. package/chunk-3DXYUDZH.cjs +0 -46
  50. package/chunk-3DXYUDZH.cjs.map +0 -1
  51. 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 { 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-4a108741';
4
- import 'axios';
3
+ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
4
+ import { B as ProductsGetTypesResponse, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../account-server-api.schemas-e6c5f956.js';
5
5
 
6
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
6
+ declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
7
7
  /**
8
8
  * Gets product types you can purchase
9
9
 
10
10
  * @summary Gets all Product Types
11
11
  */
12
- declare const getProductTypes: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetTypesResponse>;
13
- declare const getGetProductTypesQueryKey: () => string[];
14
- declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = ErrorType<void | AsError>>(options?: {
15
- query?: UseQueryOptions<ProductsGetTypesResponse, TError, TData, QueryKey> | undefined;
16
- request?: SecondParameter<typeof customInstance>;
12
+ declare const appApiProductGetTypes: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetTypesResponse>>;
13
+ declare const getAppApiProductGetTypesQueryKey: () => string[];
14
+ declare type AppApiProductGetTypesQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetTypes>>;
15
+ declare type AppApiProductGetTypesQueryError = AxiosError<AsError | void>;
16
+ declare const useAppApiProductGetTypes: <TData = AxiosResponse<ProductsGetTypesResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
17
+ query?: UseQueryOptions<AxiosResponse<ProductsGetTypesResponse, any>, TError, TData, QueryKey> | undefined;
18
+ axios?: AxiosRequestConfig<any> | undefined;
17
19
  } | undefined) => UseQueryResult<TData, TError> & {
18
20
  queryKey: QueryKey;
19
21
  };
@@ -22,26 +24,31 @@ declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = Er
22
24
 
23
25
  * @summary Gets all Products
24
26
  */
25
- declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
26
- declare const getGetProductsQueryKey: () => string[];
27
- declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(options?: {
28
- query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
29
- request?: SecondParameter<typeof customInstance>;
27
+ declare const appApiProductGet: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetResponse>>;
28
+ declare const getAppApiProductGetQueryKey: () => string[];
29
+ declare type AppApiProductGetQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGet>>;
30
+ declare type AppApiProductGetQueryError = AxiosError<AsError | void>;
31
+ declare const useAppApiProductGet: <TData = AxiosResponse<ProductsGetResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
32
+ query?: UseQueryOptions<AxiosResponse<ProductsGetResponse, any>, TError, TData, QueryKey> | undefined;
33
+ axios?: AxiosRequestConfig<any> | undefined;
30
34
  } | undefined) => UseQueryResult<TData, TError> & {
31
35
  queryKey: QueryKey;
32
36
  };
33
37
  /**
34
38
  * @summary Creates a Product for an Organisational Unit
35
39
  */
36
- declare const createUnitProduct: (unitid: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
37
- declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
38
- mutation?: UseMutationOptions<UnitProductPostResponse, TError, {
39
- unitid: string;
40
+ declare const appApiProductPost: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UnitProductPostResponse>>;
41
+ declare type AppApiProductPostMutationResult = NonNullable<AsyncReturnType<typeof appApiProductPost>>;
42
+ declare type AppApiProductPostMutationBody = UnitProductPostBodyBody;
43
+ declare type AppApiProductPostMutationError = AxiosError<AsError | void>;
44
+ declare const useAppApiProductPost: <TError = AxiosError<void | AsError, any>, TContext = unknown>(options?: {
45
+ mutation?: UseMutationOptions<AxiosResponse<UnitProductPostResponse, any>, TError, {
46
+ unitId: string;
40
47
  data: UnitProductPostBodyBody;
41
48
  }, TContext> | undefined;
42
- request?: SecondParameter<typeof customInstance>;
43
- } | undefined) => react_query.UseMutationResult<UnitProductPostResponse, TError, {
44
- unitid: string;
49
+ axios?: AxiosRequestConfig<any> | undefined;
50
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<UnitProductPostResponse, any>, TError, {
51
+ unitId: string;
45
52
  data: UnitProductPostBodyBody;
46
53
  }, TContext>;
47
54
  /**
@@ -49,11 +56,13 @@ declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContex
49
56
 
50
57
  * @summary Gets Products for an Organisational Unit
51
58
  */
52
- declare const getProductsForUnit: (unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
53
- declare const getGetProductsForUnitQueryKey: (unitid: string) => string[];
54
- declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(unitid: string, options?: {
55
- query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
56
- request?: SecondParameter<typeof customInstance>;
59
+ declare const appApiProductGetForUnit: (unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetResponse>>;
60
+ declare const getAppApiProductGetForUnitQueryKey: (unitId: string) => string[];
61
+ declare type AppApiProductGetForUnitQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetForUnit>>;
62
+ declare type AppApiProductGetForUnitQueryError = AxiosError<void | AsError>;
63
+ declare const useAppApiProductGetForUnit: <TData = AxiosResponse<ProductsGetResponse, any>, TError = AxiosError<void | AsError, any>>(unitId: string, options?: {
64
+ query?: UseQueryOptions<AxiosResponse<ProductsGetResponse, any>, TError, TData, QueryKey> | undefined;
65
+ axios?: AxiosRequestConfig<any> | undefined;
57
66
  } | undefined) => UseQueryResult<TData, TError> & {
58
67
  queryKey: QueryKey;
59
68
  };
@@ -62,31 +71,52 @@ declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = Erro
62
71
 
63
72
  * @summary Gets a Unit's Product
64
73
  */
65
- declare const getProduct: (unitid: string, productid: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
66
- declare const getGetProductQueryKey: (unitid: string, productid: string) => string[];
67
- declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitid: string, productid: string, options?: {
68
- query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
69
- request?: SecondParameter<typeof customInstance>;
74
+ declare const appApiProductGetUnitProduct: (unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductUnitGetResponse>>;
75
+ declare const getAppApiProductGetUnitProductQueryKey: (unitId: string, productId: string) => string[];
76
+ declare type AppApiProductGetUnitProductQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetUnitProduct>>;
77
+ declare type AppApiProductGetUnitProductQueryError = AxiosError<AsError | void>;
78
+ declare const useAppApiProductGetUnitProduct: <TData = AxiosResponse<ProductUnitGetResponse, any>, TError = AxiosError<void | AsError, any>>(unitId: string, productId: string, options?: {
79
+ query?: UseQueryOptions<AxiosResponse<ProductUnitGetResponse, any>, TError, TData, QueryKey> | undefined;
80
+ axios?: AxiosRequestConfig<any> | undefined;
70
81
  } | undefined) => UseQueryResult<TData, TError> & {
71
82
  queryKey: QueryKey;
72
83
  };
84
+ /**
85
+ * @summary Deletes an existing Product
86
+ */
87
+ declare const appApiProductDelete: (unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
88
+ declare type AppApiProductDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiProductDelete>>;
89
+ declare type AppApiProductDeleteMutationError = AxiosError<AsError>;
90
+ declare const useAppApiProductDelete: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
91
+ mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
92
+ unitId: string;
93
+ productId: string;
94
+ }, TContext> | undefined;
95
+ axios?: AxiosRequestConfig<any> | undefined;
96
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
97
+ unitId: string;
98
+ productId: string;
99
+ }, TContext>;
73
100
  /**
74
101
  * 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`
75
102
 
76
103
  * @summary Adjust an existing Product
77
104
  */
78
- declare const patchProduct: (unitid: string, productid: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
79
- declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
80
- mutation?: UseMutationOptions<void, TError, {
81
- unitid: string;
82
- productid: string;
105
+ declare const appApiProductPatch: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
106
+ declare type AppApiProductPatchMutationResult = NonNullable<AsyncReturnType<typeof appApiProductPatch>>;
107
+ declare type AppApiProductPatchMutationBody = ProductPatchBodyBody;
108
+ declare type AppApiProductPatchMutationError = AxiosError<AsError>;
109
+ declare const useAppApiProductPatch: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
110
+ mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
111
+ unitId: string;
112
+ productId: string;
83
113
  data: ProductPatchBodyBody;
84
114
  }, TContext> | undefined;
85
- request?: SecondParameter<typeof customInstance>;
86
- } | undefined) => react_query.UseMutationResult<void, TError, {
87
- unitid: string;
88
- productid: string;
115
+ axios?: AxiosRequestConfig<any> | undefined;
116
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
117
+ unitId: string;
118
+ productId: string;
89
119
  data: ProductPatchBodyBody;
90
120
  }, TContext>;
91
121
 
92
- export { createUnitProduct, getGetProductQueryKey, getGetProductTypesQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProductTypes, getProducts, getProductsForUnit, patchProduct, useCreateUnitProduct, useGetProduct, useGetProductTypes, useGetProducts, useGetProductsForUnit, usePatchProduct };
122
+ export { AppApiProductDeleteMutationError, AppApiProductDeleteMutationResult, AppApiProductGetForUnitQueryError, AppApiProductGetForUnitQueryResult, AppApiProductGetQueryError, AppApiProductGetQueryResult, AppApiProductGetTypesQueryError, AppApiProductGetTypesQueryResult, AppApiProductGetUnitProductQueryError, AppApiProductGetUnitProductQueryResult, AppApiProductPatchMutationBody, AppApiProductPatchMutationError, AppApiProductPatchMutationResult, AppApiProductPostMutationBody, AppApiProductPostMutationError, AppApiProductPostMutationResult, appApiProductDelete, appApiProductGet, appApiProductGetForUnit, appApiProductGetTypes, appApiProductGetUnitProduct, appApiProductPatch, appApiProductPost, getAppApiProductGetForUnitQueryKey, getAppApiProductGetQueryKey, getAppApiProductGetTypesQueryKey, getAppApiProductGetUnitProductQueryKey, useAppApiProductDelete, useAppApiProductGet, useAppApiProductGetForUnit, useAppApiProductGetTypes, useAppApiProductGetUnitProduct, useAppApiProductPatch, useAppApiProductPost };
@@ -1,115 +1,118 @@
1
1
  import {
2
- __spreadValues,
3
- customInstance
4
- } from "../chunk-JR7F532L.js";
2
+ __spreadValues
3
+ } from "../chunk-GWBPVOL2.js";
5
4
 
6
5
  // 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 getProductTypes = (options) => {
12
- return customInstance({ url: `/product-type`, method: "get" }, options);
11
+ var appApiProductGetTypes = (options) => {
12
+ return axios.get(`/product-type`, options);
13
13
  };
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);
14
+ var getAppApiProductGetTypesQueryKey = () => [`/product-type`];
15
+ var useAppApiProductGetTypes = (options) => {
16
+ const { query: queryOptions, axios: axiosOptions } = options || {};
17
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetTypesQueryKey();
18
+ const queryFn = () => appApiProductGetTypes(axiosOptions);
19
19
  const query = useQuery(queryKey, queryFn, queryOptions);
20
20
  return __spreadValues({
21
21
  queryKey
22
22
  }, query);
23
23
  };
24
- var getProducts = (options) => {
25
- return customInstance({ url: `/product`, method: "get" }, options);
24
+ var appApiProductGet = (options) => {
25
+ return axios.get(`/product`, options);
26
26
  };
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);
27
+ var getAppApiProductGetQueryKey = () => [`/product`];
28
+ var useAppApiProductGet = (options) => {
29
+ const { query: queryOptions, axios: axiosOptions } = options || {};
30
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetQueryKey();
31
+ const queryFn = () => appApiProductGet(axiosOptions);
32
32
  const query = useQuery(queryKey, queryFn, queryOptions);
33
33
  return __spreadValues({
34
34
  queryKey
35
35
  }, query);
36
36
  };
37
- var createUnitProduct = (unitid, unitProductPostBodyBody, options) => {
38
- return customInstance({
39
- url: `/product/unit/${unitid}`,
40
- method: "post",
41
- data: unitProductPostBodyBody
42
- }, options);
37
+ var appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
38
+ return axios.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
43
39
  };
44
- var useCreateUnitProduct = (options) => {
45
- const { mutation: mutationOptions, request: requestOptions } = options || {};
40
+ var useAppApiProductPost = (options) => {
41
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
46
42
  const mutationFn = (props) => {
47
- const { unitid, data } = props || {};
48
- return createUnitProduct(unitid, data, requestOptions);
43
+ const { unitId, data } = props || {};
44
+ return appApiProductPost(unitId, data, axiosOptions);
49
45
  };
50
46
  return useMutation(mutationFn, mutationOptions);
51
47
  };
52
- var getProductsForUnit = (unitid, options) => {
53
- return customInstance({ url: `/product/unit/${unitid}`, method: "get" }, options);
48
+ var appApiProductGetForUnit = (unitId, options) => {
49
+ return axios.get(`/product/unit/${unitId}`, options);
54
50
  };
55
- var getGetProductsForUnitQueryKey = (unitid) => [
56
- `/product/unit/${unitid}`
51
+ var getAppApiProductGetForUnitQueryKey = (unitId) => [
52
+ `/product/unit/${unitId}`
57
53
  ];
58
- var useGetProductsForUnit = (unitid, options) => {
59
- const { query: queryOptions, request: requestOptions } = options || {};
60
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitid);
61
- const queryFn = () => getProductsForUnit(unitid, requestOptions);
62
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitid }, queryOptions));
54
+ var useAppApiProductGetForUnit = (unitId, options) => {
55
+ const { query: queryOptions, axios: axiosOptions } = options || {};
56
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetForUnitQueryKey(unitId);
57
+ const queryFn = () => appApiProductGetForUnit(unitId, axiosOptions);
58
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
63
59
  return __spreadValues({
64
60
  queryKey
65
61
  }, query);
66
62
  };
67
- var getProduct = (unitid, productid, options) => {
68
- return customInstance({ url: `/product/unit/${unitid}/product/${productid}`, method: "get" }, options);
63
+ var appApiProductGetUnitProduct = (unitId, productId, options) => {
64
+ return axios.get(`/product/unit/${unitId}/product/${productId}`, options);
69
65
  };
70
- var getGetProductQueryKey = (unitid, productid) => [
71
- `/product/unit/${unitid}/product/${productid}`
72
- ];
73
- var useGetProduct = (unitid, productid, options) => {
74
- const { query: queryOptions, request: requestOptions } = options || {};
75
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductQueryKey(unitid, productid);
76
- const queryFn = () => getProduct(unitid, productid, requestOptions);
77
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitid && productid) }, queryOptions));
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 = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetUnitProductQueryKey(unitId, productId);
70
+ const queryFn = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);
71
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitId && productId) }, queryOptions));
78
72
  return __spreadValues({
79
73
  queryKey
80
74
  }, query);
81
75
  };
82
- var patchProduct = (unitid, productid, productPatchBodyBody, options) => {
83
- return customInstance({
84
- url: `/product/unit/${unitid}/product/${productid}`,
85
- method: "patch",
86
- data: productPatchBodyBody
87
- }, options);
76
+ var appApiProductDelete = (unitId, productId, options) => {
77
+ return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);
78
+ };
79
+ var useAppApiProductDelete = (options) => {
80
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
81
+ const mutationFn = (props) => {
82
+ const { unitId, productId } = props || {};
83
+ return appApiProductDelete(unitId, productId, axiosOptions);
84
+ };
85
+ return useMutation(mutationFn, mutationOptions);
86
+ };
87
+ var appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
88
+ return axios.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
88
89
  };
89
- var usePatchProduct = (options) => {
90
- const { mutation: mutationOptions, request: requestOptions } = options || {};
90
+ var useAppApiProductPatch = (options) => {
91
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
91
92
  const mutationFn = (props) => {
92
- const { unitid, productid, data } = props || {};
93
- return patchProduct(unitid, productid, data, requestOptions);
93
+ const { unitId, productId, data } = props || {};
94
+ return appApiProductPatch(unitId, productId, data, axiosOptions);
94
95
  };
95
96
  return useMutation(mutationFn, mutationOptions);
96
97
  };
97
98
  export {
98
- createUnitProduct,
99
- getGetProductQueryKey,
100
- getGetProductTypesQueryKey,
101
- getGetProductsForUnitQueryKey,
102
- getGetProductsQueryKey,
103
- getProduct,
104
- getProductTypes,
105
- getProducts,
106
- getProductsForUnit,
107
- patchProduct,
108
- useCreateUnitProduct,
109
- useGetProduct,
110
- useGetProductTypes,
111
- useGetProducts,
112
- useGetProductsForUnit,
113
- usePatchProduct
99
+ appApiProductDelete,
100
+ appApiProductGet,
101
+ appApiProductGetForUnit,
102
+ appApiProductGetTypes,
103
+ appApiProductGetUnitProduct,
104
+ appApiProductPatch,
105
+ appApiProductPost,
106
+ getAppApiProductGetForUnitQueryKey,
107
+ getAppApiProductGetQueryKey,
108
+ getAppApiProductGetTypesQueryKey,
109
+ getAppApiProductGetUnitProductQueryKey,
110
+ useAppApiProductDelete,
111
+ useAppApiProductGet,
112
+ useAppApiProductGetForUnit,
113
+ useAppApiProductGetTypes,
114
+ useAppApiProductGetUnitProduct,
115
+ useAppApiProductPatch,
116
+ useAppApiProductPost
114
117
  };
115
118
  //# sourceMappingURL=product.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\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"],"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 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,35 +1,37 @@
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/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 getServices = (options) => {
11
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service`, method: "get" }, options);
10
+ var appApiServiceGet = (options) => {
11
+ return _axios2.default.get(`/service`, options);
12
12
  };
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);
13
+ var getAppApiServiceGetQueryKey = () => [`/service`];
14
+ var useAppApiServiceGet = (options) => {
15
+ const { query: queryOptions, axios: axiosOptions } = options || {};
16
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiServiceGetQueryKey()));
17
+ const queryFn = () => appApiServiceGet(axiosOptions);
18
18
  const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
19
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
19
+ return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
20
20
  queryKey
21
21
  }, query);
22
22
  };
23
- var getService = (svcid, options) => {
24
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service/${svcid}`, method: "get" }, options);
23
+ var appApiServiceGetId = (svcId, options) => {
24
+ return _axios2.default.get(`/service/${svcId}`, options);
25
25
  };
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, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!svcid }, queryOptions));
32
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
26
+ var getAppApiServiceGetIdQueryKey = (svcId) => [
27
+ `/service/${svcId}`
28
+ ];
29
+ var useAppApiServiceGetId = (svcId, options) => {
30
+ const { query: queryOptions, axios: axiosOptions } = options || {};
31
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiServiceGetIdQueryKey(svcId)));
32
+ const queryFn = () => appApiServiceGetId(svcId, axiosOptions);
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, {
33
35
  queryKey
34
36
  }, query);
35
37
  };
@@ -40,5 +42,5 @@ var useGetService = (svcid, options) => {
40
42
 
41
43
 
42
44
 
43
- exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
45
+ exports.appApiServiceGet = appApiServiceGet; exports.appApiServiceGetId = appApiServiceGetId; exports.getAppApiServiceGetIdQueryKey = getAppApiServiceGetIdQueryKey; exports.getAppApiServiceGetQueryKey = getAppApiServiceGetQueryKey; exports.useAppApiServiceGet = useAppApiServiceGet; exports.useAppApiServiceGetId = useAppApiServiceGetId;
44
46
  //# sourceMappingURL=service.cjs.map
@@ -1 +1 @@
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,SAC3B;AAAA;AAIG,IAAM,yBAAyB,MAAM,CAAC;AAEtC,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA8D,MAClE,YAAY;AAEd,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,SACpC;AAAA;AAIG,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY;AAE9D,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,OAAO;AAEpB,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU;AAGzB,SAAO;AAAA,IACL;AAAA,KACG;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 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 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 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"]}
1
+ {"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAyBO,IAAM,mBAAmB,CAC9B,YACgD;AAChD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,8BAA8B,MAAM,CAAC,UAAU;AAOrD,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAAmE,MACvE,iBAAiB,YAAY;AAE/B,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,qBAAqB,CAChC,OACA,YAC+C;AAC/C,SAAO,MAAM,IAAI,YAAY,SAAS,OAAO;AAC/C;AAEO,IAAM,gCAAgC,CAAC,UAAkB;AAAA,EAC9D,YAAY;AACd;AAOO,IAAM,wBAAwB,CAInC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WACJ,8CAAc,aAAY,8BAA8B,KAAK;AAE/D,QAAM,UAEF,MAAM,mBAAmB,OAAO,YAAY;AAEhD,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n 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\";\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 services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const appApiServiceGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServicesGetResponse>> => {\n return axios.get(`/service`, options);\n};\n\nexport const getAppApiServiceGetQueryKey = () => [`/service`];\n\nexport type AppApiServiceGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGet>\n>;\nexport type AppApiServiceGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGet = <\n TData = AsyncReturnType<typeof appApiServiceGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGet>,\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 ?? getAppApiServiceGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiServiceGet>> = () =>\n appApiServiceGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\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 appApiServiceGetId = (\n svcId: number,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServiceGetResponse>> => {\n return axios.get(`/service/${svcId}`, options);\n};\n\nexport const getAppApiServiceGetIdQueryKey = (svcId: number) => [\n `/service/${svcId}`,\n];\n\nexport type AppApiServiceGetIdQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGetId>\n>;\nexport type AppApiServiceGetIdQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGetId = <\n TData = AsyncReturnType<typeof appApiServiceGetId>,\n TError = AxiosError<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGetId>,\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 ?? getAppApiServiceGetIdQueryKey(svcId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiServiceGetId>\n > = () => appApiServiceGetId(svcId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGetId>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!svcId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
@@ -1,9 +1,9 @@
1
+ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
1
2
  import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
2
- import { V as customInstance, h as ServicesGetResponse, W as ErrorType, N as AsError, g as ServiceGetResponse } from '../custom-instance-4a108741';
3
- import 'axios';
3
+ import { h as ServicesGetResponse, N as AsError, g as ServiceGetResponse } from '../account-server-api.schemas-e6c5f956.js';
4
4
 
5
5
  /**
6
- * Generated by orval v6.6.0 🍺
6
+ * Generated by orval v6.7.1 🍺
7
7
  * Do not edit manually.
8
8
  * Account Server API
9
9
  * The Informatics Matters Account Server API.
@@ -13,17 +13,19 @@ A service that provides access to the Account Server, which gives *registered* u
13
13
  * OpenAPI spec version: 0.1
14
14
  */
15
15
 
16
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
16
+ declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
17
17
  /**
18
18
  * Gets services known to the Account Server
19
19
 
20
20
  * @summary Gets all Services
21
21
  */
22
- declare const getServices: (options?: SecondParameter<typeof customInstance>) => Promise<ServicesGetResponse>;
23
- declare const getGetServicesQueryKey: () => string[];
24
- declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<void | AsError>>(options?: {
25
- query?: UseQueryOptions<ServicesGetResponse, TError, TData, QueryKey> | undefined;
26
- request?: SecondParameter<typeof customInstance>;
22
+ declare const appApiServiceGet: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ServicesGetResponse>>;
23
+ declare const getAppApiServiceGetQueryKey: () => string[];
24
+ declare type AppApiServiceGetQueryResult = NonNullable<AsyncReturnType<typeof appApiServiceGet>>;
25
+ declare type AppApiServiceGetQueryError = AxiosError<AsError | void>;
26
+ declare const useAppApiServiceGet: <TData = AxiosResponse<ServicesGetResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
27
+ query?: UseQueryOptions<AxiosResponse<ServicesGetResponse, any>, TError, TData, QueryKey> | undefined;
28
+ axios?: AxiosRequestConfig<any> | undefined;
27
29
  } | undefined) => UseQueryResult<TData, TError> & {
28
30
  queryKey: QueryKey;
29
31
  };
@@ -32,13 +34,15 @@ declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<v
32
34
 
33
35
  * @summary Gets a specific Service
34
36
  */
35
- declare const getService: (svcid: number, options?: SecondParameter<typeof customInstance>) => Promise<ServiceGetResponse>;
36
- declare const getGetServiceQueryKey: (svcid: number) => string[];
37
- declare const useGetService: <TData = ServiceGetResponse, TError = ErrorType<void | AsError>>(svcid: number, options?: {
38
- query?: UseQueryOptions<ServiceGetResponse, TError, TData, QueryKey> | undefined;
39
- request?: SecondParameter<typeof customInstance>;
37
+ declare const appApiServiceGetId: (svcId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ServiceGetResponse>>;
38
+ declare const getAppApiServiceGetIdQueryKey: (svcId: number) => string[];
39
+ declare type AppApiServiceGetIdQueryResult = NonNullable<AsyncReturnType<typeof appApiServiceGetId>>;
40
+ declare type AppApiServiceGetIdQueryError = AxiosError<AsError | void>;
41
+ declare const useAppApiServiceGetId: <TData = AxiosResponse<ServiceGetResponse, any>, TError = AxiosError<void | AsError, any>>(svcId: number, options?: {
42
+ query?: UseQueryOptions<AxiosResponse<ServiceGetResponse, any>, TError, TData, QueryKey> | undefined;
43
+ axios?: AxiosRequestConfig<any> | undefined;
40
44
  } | undefined) => UseQueryResult<TData, TError> & {
41
45
  queryKey: QueryKey;
42
46
  };
43
47
 
44
- export { getGetServiceQueryKey, getGetServicesQueryKey, getService, getServices, useGetService, useGetServices };
48
+ export { AppApiServiceGetIdQueryError, AppApiServiceGetIdQueryResult, AppApiServiceGetQueryError, AppApiServiceGetQueryResult, appApiServiceGet, appApiServiceGetId, getAppApiServiceGetIdQueryKey, getAppApiServiceGetQueryKey, useAppApiServiceGet, useAppApiServiceGetId };