@squonk/account-server-client 0.1.35-rc.2 → 0.1.37

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 (54) hide show
  1. package/asset/asset.cjs +10 -15
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.ts +2 -4
  4. package/asset/asset.js +5 -10
  5. package/asset/asset.js.map +1 -1
  6. package/{chunk-6EEIAH4R.js → chunk-3TENYKS7.js} +1 -1
  7. package/{chunk-6EEIAH4R.js.map → chunk-3TENYKS7.js.map} +0 -0
  8. package/{chunk-NGBTCJWS.cjs → chunk-RHHRF25R.cjs} +1 -1
  9. package/{chunk-NGBTCJWS.cjs.map → chunk-RHHRF25R.cjs.map} +0 -0
  10. package/{custom-instance-aeeba2ba.d.ts → custom-instance-323ee59a.d.ts} +1 -1
  11. package/index.cjs +2 -2
  12. package/index.cjs.map +1 -1
  13. package/index.d.ts +1 -1
  14. package/index.js +1 -1
  15. package/index.js.map +1 -1
  16. package/merchant/merchant.cjs +8 -12
  17. package/merchant/merchant.cjs.map +1 -1
  18. package/merchant/merchant.d.ts +2 -4
  19. package/merchant/merchant.js +6 -10
  20. package/merchant/merchant.js.map +1 -1
  21. package/organisation/organisation.cjs +9 -15
  22. package/organisation/organisation.cjs.map +1 -1
  23. package/organisation/organisation.d.ts +2 -4
  24. package/organisation/organisation.js +6 -12
  25. package/organisation/organisation.js.map +1 -1
  26. package/package.json +9 -10
  27. package/product/product.cjs +24 -30
  28. package/product/product.cjs.map +1 -1
  29. package/product/product.d.ts +2 -4
  30. package/product/product.js +15 -21
  31. package/product/product.js.map +1 -1
  32. package/src/account-server-api.schemas.ts +1 -1
  33. package/src/asset/asset.ts +11 -16
  34. package/src/merchant/merchant.ts +16 -19
  35. package/src/organisation/organisation.ts +18 -20
  36. package/src/product/product.ts +36 -35
  37. package/src/state/state.ts +10 -14
  38. package/src/unit/unit.ts +21 -25
  39. package/src/user/user.ts +26 -25
  40. package/state/state.cjs +4 -8
  41. package/state/state.cjs.map +1 -1
  42. package/state/state.d.ts +2 -15
  43. package/state/state.js +4 -8
  44. package/state/state.js.map +1 -1
  45. package/unit/unit.cjs +16 -22
  46. package/unit/unit.cjs.map +1 -1
  47. package/unit/unit.d.ts +2 -4
  48. package/unit/unit.js +8 -14
  49. package/unit/unit.js.map +1 -1
  50. package/user/user.cjs +18 -22
  51. package/user/user.cjs.map +1 -1
  52. package/user/user.d.ts +2 -4
  53. package/user/user.js +11 -15
  54. package/user/user.js.map +1 -1
@@ -1,13 +1,10 @@
1
1
  import {
2
2
  __spreadValues,
3
3
  customInstance
4
- } from "../chunk-6EEIAH4R.js";
4
+ } from "../chunk-3TENYKS7.js";
5
5
 
6
6
  // src/product/product.ts
7
- import {
8
- useQuery,
9
- useMutation
10
- } from "react-query";
7
+ import { useQuery, useMutation } from "react-query";
11
8
  var getProductTypes = (options, signal) => {
12
9
  return customInstance({ url: `/product-type`, method: "get", signal }, options);
13
10
  };
@@ -19,9 +16,8 @@ var useGetProductTypes = (options) => {
19
16
  signal
20
17
  }) => getProductTypes(requestOptions, signal);
21
18
  const query = useQuery(queryKey, queryFn, queryOptions);
22
- return __spreadValues({
23
- queryKey
24
- }, query);
19
+ query.queryKey = queryKey;
20
+ return query;
25
21
  };
26
22
  var getProducts = (options, signal) => {
27
23
  return customInstance({ url: `/product`, method: "get", signal }, options);
@@ -34,9 +30,8 @@ var useGetProducts = (options) => {
34
30
  signal
35
31
  }) => getProducts(requestOptions, signal);
36
32
  const query = useQuery(queryKey, queryFn, queryOptions);
37
- return __spreadValues({
38
- queryKey
39
- }, query);
33
+ query.queryKey = queryKey;
34
+ return query;
40
35
  };
41
36
  var getProductsForOrganisation = (orgId, options, signal) => {
42
37
  return customInstance({ url: `/product/organisation/${orgId}`, method: "get", signal }, options);
@@ -49,9 +44,8 @@ var useGetProductsForOrganisation = (orgId, options) => {
49
44
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForOrganisationQueryKey(orgId);
50
45
  const queryFn = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
51
46
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
52
- return __spreadValues({
53
- queryKey
54
- }, query);
47
+ query.queryKey = queryKey;
48
+ return query;
55
49
  };
56
50
  var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
57
51
  return customInstance({
@@ -79,10 +73,11 @@ var useGetProductsForUnit = (unitId, options) => {
79
73
  const { query: queryOptions, request: requestOptions } = options ?? {};
80
74
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
81
75
  const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
82
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
83
- return __spreadValues({
84
- queryKey
85
- }, query);
76
+ const query = useQuery(queryKey, queryFn, __spreadValues({
77
+ enabled: !!unitId
78
+ }, queryOptions));
79
+ query.queryKey = queryKey;
80
+ return query;
86
81
  };
87
82
  var getProduct = (productId, options, signal) => {
88
83
  return customInstance({ url: `/product/${productId}`, method: "get", signal }, options);
@@ -97,9 +92,8 @@ var useGetProduct = (productId, options) => {
97
92
  signal
98
93
  }) => getProduct(productId, requestOptions, signal);
99
94
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!productId }, queryOptions));
100
- return __spreadValues({
101
- queryKey
102
- }, query);
95
+ query.queryKey = queryKey;
96
+ return query;
103
97
  };
104
98
  var deleteProduct = (productId, options) => {
105
99
  return customInstance({ url: `/product/${productId}`, method: "delete" }, options);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.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\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\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 ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProducts>>,\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 based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) => [\n `/product/organisation/${orgId}`,\n];\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\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 ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\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 Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<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 Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) => [\n `/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\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 = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!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 productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { 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 productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/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 Awaited<ReturnType<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 Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { 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 Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;A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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 { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\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 ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) => [\n `/product/organisation/${orgId}`,\n];\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\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 ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\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 Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!unitId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) => [\n `/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\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 = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!productId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { 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 productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/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 Awaited<ReturnType<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 Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { 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 Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAkCO,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO,GAC9C,OACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,eAAe;AAOzD,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,QACI,gBAAgB,gBAAgB,MAAM;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAAkE,CAAC;AAAA,IACvE;AAAA,QACI,YAAY,gBAAgB,MAAM;AAExC,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,6BAA6B,CACxC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,yBAAyB,SAAS,QAAQ,OAAO,OAAO,GAC/D,OACF;AACF;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E3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,WAAW,SAAS,SAAS,CAAC;AAEtC,WAAO,aAAa,WAAW,MAAM,cAAc;AAAA,EACrD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,9 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
13
- useMutation,
11
+ import { useQuery, useMutation } from "react-query";
12
+ import type {
14
13
  UseQueryOptions,
15
14
  UseMutationOptions,
16
15
  QueryFunction,
@@ -27,13 +26,10 @@ import type {
27
26
  AttachAssetParams,
28
27
  DetachAssetParams,
29
28
  } from "../account-server-api.schemas";
30
- import { customInstance, ErrorType } from ".././custom-instance";
31
-
32
- export type AwaitedInput<T> = PromiseLike<T> | T;
29
+ import { customInstance } from ".././custom-instance";
30
+ import type { ErrorType } from ".././custom-instance";
33
31
 
34
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ // eslint-disable-next-line
37
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
34
  config: any,
39
35
  args: infer P
@@ -52,7 +48,7 @@ export const getAsset = (
52
48
  signal?: AbortSignal
53
49
  ) => {
54
50
  return customInstance<AssetGetResponse>(
55
- { url: `/asset`, method: "get", signal, params },
51
+ { url: `/asset`, method: "get", params, signal },
56
52
  options
57
53
  );
58
54
  };
@@ -93,12 +89,11 @@ export const useGetAsset = <
93
89
  queryKey,
94
90
  queryFn,
95
91
  queryOptions
96
- );
92
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
97
93
 
98
- return {
99
- queryKey,
100
- ...query,
101
- };
94
+ query.queryKey = queryKey;
95
+
96
+ return query;
102
97
  };
103
98
 
104
99
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,8 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
11
+ import { useQuery } from "react-query";
12
+ import type {
13
13
  UseQueryOptions,
14
14
  QueryFunction,
15
15
  UseQueryResult,
@@ -20,13 +20,10 @@ import type {
20
20
  AsError,
21
21
  MerchantGetResponse,
22
22
  } from "../account-server-api.schemas";
23
- import { customInstance, ErrorType } from ".././custom-instance";
24
-
25
- export type AwaitedInput<T> = PromiseLike<T> | T;
26
-
27
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
23
+ import { customInstance } from ".././custom-instance";
24
+ import type { ErrorType } from ".././custom-instance";
28
25
 
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ // eslint-disable-next-line
30
27
  type SecondParameter<T extends (...args: any) => any> = T extends (
31
28
  config: any,
32
29
  args: infer P
@@ -79,12 +76,13 @@ export const useGetMerchants = <
79
76
  Awaited<ReturnType<typeof getMerchants>>,
80
77
  TError,
81
78
  TData
82
- >(queryKey, queryFn, queryOptions);
83
-
84
- return {
85
- queryKey,
86
- ...query,
79
+ >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
80
+ queryKey: QueryKey;
87
81
  };
82
+
83
+ query.queryKey = queryKey;
84
+
85
+ return query;
88
86
  };
89
87
 
90
88
  /**
@@ -136,10 +134,9 @@ export const useGetService = <
136
134
  queryKey,
137
135
  queryFn,
138
136
  { enabled: !!mId, ...queryOptions }
139
- );
137
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
140
138
 
141
- return {
142
- queryKey,
143
- ...query,
144
- };
139
+ query.queryKey = queryKey;
140
+
141
+ return query;
145
142
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,9 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
13
- useMutation,
11
+ import { useQuery, useMutation } from "react-query";
12
+ import type {
14
13
  UseQueryOptions,
15
14
  UseMutationOptions,
16
15
  QueryFunction,
@@ -25,13 +24,10 @@ import type {
25
24
  OrganisationPostBodyBody,
26
25
  OrganisationGetDefaultResponse,
27
26
  } from "../account-server-api.schemas";
28
- import { customInstance, ErrorType } from ".././custom-instance";
29
-
30
- export type AwaitedInput<T> = PromiseLike<T> | T;
31
-
32
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
27
+ import { customInstance } from ".././custom-instance";
28
+ import type { ErrorType } from ".././custom-instance";
33
29
 
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ // eslint-disable-next-line
35
31
  type SecondParameter<T extends (...args: any) => any> = T extends (
36
32
  config: any,
37
33
  args: infer P
@@ -84,12 +80,13 @@ export const useGetOrganisations = <
84
80
  Awaited<ReturnType<typeof getOrganisations>>,
85
81
  TError,
86
82
  TData
87
- >(queryKey, queryFn, queryOptions);
88
-
89
- return {
90
- queryKey,
91
- ...query,
83
+ >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
84
+ queryKey: QueryKey;
92
85
  };
86
+
87
+ query.queryKey = queryKey;
88
+
89
+ return query;
93
90
  };
94
91
 
95
92
  /**
@@ -251,10 +248,11 @@ export const useGetDefaultOrganisation = <
251
248
  Awaited<ReturnType<typeof getDefaultOrganisation>>,
252
249
  TError,
253
250
  TData
254
- >(queryKey, queryFn, queryOptions);
255
-
256
- return {
257
- queryKey,
258
- ...query,
251
+ >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
252
+ queryKey: QueryKey;
259
253
  };
254
+
255
+ query.queryKey = queryKey;
256
+
257
+ return query;
260
258
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,9 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
13
- useMutation,
11
+ import { useQuery, useMutation } from "react-query";
12
+ import type {
14
13
  UseQueryOptions,
15
14
  UseMutationOptions,
16
15
  QueryFunction,
@@ -27,13 +26,10 @@ import type {
27
26
  ProductUnitGetResponse,
28
27
  ProductPatchBodyBody,
29
28
  } from "../account-server-api.schemas";
30
- import { customInstance, ErrorType } from ".././custom-instance";
31
-
32
- export type AwaitedInput<T> = PromiseLike<T> | T;
33
-
34
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
29
+ import { customInstance } from ".././custom-instance";
30
+ import type { ErrorType } from ".././custom-instance";
35
31
 
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ // eslint-disable-next-line
37
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
34
  config: any,
39
35
  args: infer P
@@ -86,12 +82,13 @@ export const useGetProductTypes = <
86
82
  Awaited<ReturnType<typeof getProductTypes>>,
87
83
  TError,
88
84
  TData
89
- >(queryKey, queryFn, queryOptions);
90
-
91
- return {
92
- queryKey,
93
- ...query,
85
+ >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
86
+ queryKey: QueryKey;
94
87
  };
88
+
89
+ query.queryKey = queryKey;
90
+
91
+ return query;
95
92
  };
96
93
 
97
94
  /**
@@ -139,12 +136,13 @@ export const useGetProducts = <
139
136
  Awaited<ReturnType<typeof getProducts>>,
140
137
  TError,
141
138
  TData
142
- >(queryKey, queryFn, queryOptions);
143
-
144
- return {
145
- queryKey,
146
- ...query,
139
+ >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
140
+ queryKey: QueryKey;
147
141
  };
142
+
143
+ query.queryKey = queryKey;
144
+
145
+ return query;
148
146
  };
149
147
 
150
148
  /**
@@ -199,12 +197,14 @@ export const useGetProductsForOrganisation = <
199
197
  Awaited<ReturnType<typeof getProductsForOrganisation>>,
200
198
  TError,
201
199
  TData
202
- >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
200
+ >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<
201
+ TData,
202
+ TError
203
+ > & { queryKey: QueryKey };
203
204
 
204
- return {
205
- queryKey,
206
- ...query,
207
- };
205
+ query.queryKey = queryKey;
206
+
207
+ return query;
208
208
  };
209
209
 
210
210
  /**
@@ -320,12 +320,14 @@ export const useGetProductsForUnit = <
320
320
  Awaited<ReturnType<typeof getProductsForUnit>>,
321
321
  TError,
322
322
  TData
323
- >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
323
+ >(queryKey, queryFn, {
324
+ enabled: !!unitId,
325
+ ...queryOptions,
326
+ }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
324
327
 
325
- return {
326
- queryKey,
327
- ...query,
328
- };
328
+ query.queryKey = queryKey;
329
+
330
+ return query;
329
331
  };
330
332
 
331
333
  /**
@@ -379,12 +381,11 @@ export const useGetProduct = <
379
381
  queryKey,
380
382
  queryFn,
381
383
  { enabled: !!productId, ...queryOptions }
382
- );
384
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
383
385
 
384
- return {
385
- queryKey,
386
- ...query,
387
- };
386
+ query.queryKey = queryKey;
387
+
388
+ return query;
388
389
  };
389
390
 
390
391
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,8 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
11
+ import { useQuery } from "react-query";
12
+ import type {
13
13
  UseQueryOptions,
14
14
  QueryFunction,
15
15
  UseQueryResult,
@@ -19,13 +19,10 @@ import type {
19
19
  StateGetVersionResponse,
20
20
  AsError,
21
21
  } from "../account-server-api.schemas";
22
- import { customInstance, ErrorType } from ".././custom-instance";
23
-
24
- export type AwaitedInput<T> = PromiseLike<T> | T;
25
-
26
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
22
+ import { customInstance } from ".././custom-instance";
23
+ import type { ErrorType } from ".././custom-instance";
27
24
 
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ // eslint-disable-next-line
29
26
  type SecondParameter<T extends (...args: any) => any> = T extends (
30
27
  config: any,
31
28
  args: infer P
@@ -76,10 +73,9 @@ export const useGetVersion = <
76
73
  queryKey,
77
74
  queryFn,
78
75
  queryOptions
79
- );
76
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
80
77
 
81
- return {
82
- queryKey,
83
- ...query,
84
- };
78
+ query.queryKey = queryKey;
79
+
80
+ return query;
85
81
  };
package/src/unit/unit.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.8.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,9 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
13
- useMutation,
11
+ import { useQuery, useMutation } from "react-query";
12
+ import type {
14
13
  UseQueryOptions,
15
14
  UseMutationOptions,
16
15
  QueryFunction,
@@ -27,13 +26,10 @@ import type {
27
26
  UnitsGetResponse,
28
27
  PersonalUnitPutResponse,
29
28
  } from "../account-server-api.schemas";
30
- import { customInstance, ErrorType } from ".././custom-instance";
31
-
32
- export type AwaitedInput<T> = PromiseLike<T> | T;
29
+ import { customInstance } from ".././custom-instance";
30
+ import type { ErrorType } from ".././custom-instance";
33
31
 
34
- export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ // eslint-disable-next-line
37
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
34
  config: any,
39
35
  args: infer P
@@ -93,12 +89,14 @@ export const useGetOrganisationUnits = <
93
89
  Awaited<ReturnType<typeof getOrganisationUnits>>,
94
90
  TError,
95
91
  TData
96
- >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
92
+ >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<
93
+ TData,
94
+ TError
95
+ > & { queryKey: QueryKey };
97
96
 
98
- return {
99
- queryKey,
100
- ...query,
101
- };
97
+ query.queryKey = queryKey;
98
+
99
+ return query;
102
100
  };
103
101
 
104
102
  /**
@@ -203,12 +201,11 @@ export const useGetUnit = <
203
201
  queryKey,
204
202
  queryFn,
205
203
  { enabled: !!unitId, ...queryOptions }
206
- );
204
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
207
205
 
208
- return {
209
- queryKey,
210
- ...query,
211
- };
206
+ query.queryKey = queryKey;
207
+
208
+ return query;
212
209
  };
213
210
 
214
211
  /**
@@ -303,12 +300,11 @@ export const useGetUnits = <
303
300
  queryKey,
304
301
  queryFn,
305
302
  queryOptions
306
- );
303
+ ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
307
304
 
308
- return {
309
- queryKey,
310
- ...query,
311
- };
305
+ query.queryKey = queryKey;
306
+
307
+ return query;
312
308
  };
313
309
 
314
310
  /**