@squonk/account-server-client 0.1.5-rc.2 → 0.1.6-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.
@@ -1,142 +1,33 @@
1
1
  import * as react_query from 'react-query';
2
- import { UseQueryOptions, UseMutationOptions } from 'react-query';
3
- import { z as customInstance, c as OrganisationsGetResponse, E as Error, v as OrganisationPostBodyBody, O as OrganisationPostResponse } from '../custom-instance-d8cc704b';
2
+ import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
3
+ import { G as customInstance, x as OrganisationsGetResponse, H as ErrorType, E as Error, c as OrganisationPostBodyBody, B as OrganisationPostResponse } from '../custom-instance-d52e4104';
4
4
  import 'axios';
5
5
 
6
6
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
7
  /**
8
- * Gets Organisation you have access to
8
+ * Gets all the Organisations
9
+
10
+ You need **admin** rights to use this method
9
11
 
10
12
  * @summary Gets Organisations
11
13
  */
12
14
  declare const getOrganisations: (options?: SecondParameter<typeof customInstance>) => Promise<OrganisationsGetResponse>;
13
15
  declare const getGetOrganisationsQueryKey: () => string[];
14
- declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = void | Error>(options?: {
15
- query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, react_query.QueryKey> | undefined;
16
+ declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = ErrorType<void | Error>>(options?: {
17
+ query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, QueryKey> | undefined;
16
18
  request?: SecondParameter<typeof customInstance>;
17
- } | undefined) => {
18
- data: undefined;
19
- error: null;
20
- isError: false;
21
- isIdle: true;
22
- isLoading: false;
23
- isLoadingError: false;
24
- isRefetchError: false;
25
- isSuccess: false;
26
- status: "idle";
27
- dataUpdatedAt: number;
28
- errorUpdatedAt: number;
29
- failureCount: number;
30
- isFetched: boolean;
31
- isFetchedAfterMount: boolean;
32
- isFetching: boolean;
33
- isPlaceholderData: boolean;
34
- isPreviousData: boolean;
35
- isRefetching: boolean;
36
- isStale: boolean;
37
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
38
- remove: () => void;
39
- queryKey: react_query.QueryKey;
40
- } | {
41
- data: undefined;
42
- error: TError;
43
- isError: true;
44
- isIdle: false;
45
- isLoading: false;
46
- isLoadingError: true;
47
- isRefetchError: false;
48
- isSuccess: false;
49
- status: "error";
50
- dataUpdatedAt: number;
51
- errorUpdatedAt: number;
52
- failureCount: number;
53
- isFetched: boolean;
54
- isFetchedAfterMount: boolean;
55
- isFetching: boolean;
56
- isPlaceholderData: boolean;
57
- isPreviousData: boolean;
58
- isRefetching: boolean;
59
- isStale: boolean;
60
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
61
- remove: () => void;
62
- queryKey: react_query.QueryKey;
63
- } | {
64
- data: undefined;
65
- error: null;
66
- isError: false;
67
- isIdle: false;
68
- isLoading: true;
69
- isLoadingError: false;
70
- isRefetchError: false;
71
- isSuccess: false;
72
- status: "loading";
73
- dataUpdatedAt: number;
74
- errorUpdatedAt: number;
75
- failureCount: number;
76
- isFetched: boolean;
77
- isFetchedAfterMount: boolean;
78
- isFetching: boolean;
79
- isPlaceholderData: boolean;
80
- isPreviousData: boolean;
81
- isRefetching: boolean;
82
- isStale: boolean;
83
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
84
- remove: () => void;
85
- queryKey: react_query.QueryKey;
86
- } | {
87
- data: TData;
88
- error: TError;
89
- isError: true;
90
- isIdle: false;
91
- isLoading: false;
92
- isLoadingError: false;
93
- isRefetchError: true;
94
- isSuccess: false;
95
- status: "error";
96
- dataUpdatedAt: number;
97
- errorUpdatedAt: number;
98
- failureCount: number;
99
- isFetched: boolean;
100
- isFetchedAfterMount: boolean;
101
- isFetching: boolean;
102
- isPlaceholderData: boolean;
103
- isPreviousData: boolean;
104
- isRefetching: boolean;
105
- isStale: boolean;
106
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
107
- remove: () => void;
108
- queryKey: react_query.QueryKey;
109
- } | {
110
- data: TData;
111
- error: null;
112
- isError: false;
113
- isIdle: false;
114
- isLoading: false;
115
- isLoadingError: false;
116
- isRefetchError: false;
117
- isSuccess: true;
118
- status: "success";
119
- dataUpdatedAt: number;
120
- errorUpdatedAt: number;
121
- failureCount: number;
122
- isFetched: boolean;
123
- isFetchedAfterMount: boolean;
124
- isFetching: boolean;
125
- isPlaceholderData: boolean;
126
- isPreviousData: boolean;
127
- isRefetching: boolean;
128
- isStale: boolean;
129
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
130
- remove: () => void;
131
- queryKey: react_query.QueryKey;
19
+ } | undefined) => UseQueryResult<TData, TError> & {
20
+ queryKey: QueryKey;
132
21
  };
133
22
  /**
134
- * Creates a new organisation
23
+ * Creates a new Organisation
24
+
25
+ You need **admin** rights to use this method
135
26
 
136
27
  * @summary Create a new organisation
137
28
  */
138
29
  declare const createOrganisation: (organisationPostBodyBody: OrganisationPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationPostResponse>;
139
- declare const useCreateOrganisation: <TError = void | Error, TContext = unknown>(options?: {
30
+ declare const useCreateOrganisation: <TError = ErrorType<void | Error>, TContext = unknown>(options?: {
140
31
  mutation?: UseMutationOptions<OrganisationPostResponse, TError, {
141
32
  data: OrganisationPostBodyBody;
142
33
  }, TContext> | undefined;
@@ -1,2 +1,2 @@
1
- import{a as y,e as s}from"../chunk-WMX3LCLR.js";import{useQuery as u,useMutation as c}from"react-query";var p=n=>s({url:"/organisation",method:"get"},n),g=()=>["/organisation"],q=n=>{var i;let{query:t,request:e}=n||{},o=(i=t==null?void 0:t.queryKey)!=null?i:g(),r=u(o,()=>p(e),t);return y({queryKey:o},r)},d=(n,t)=>s({url:"/organisation",method:"post",data:n},t),x=n=>{let{mutation:t,request:e}=n||{};return c(a=>{let{data:r}=a||{};return d(r,e)},t)};export{d as createOrganisation,g as getGetOrganisationsQueryKey,p as getOrganisations,x as useCreateOrganisation,q as useGetOrganisations};
1
+ import{a as y,e as s}from"../chunk-33VR3IML.js";import{useQuery as u,useMutation as c}from"react-query";var p=e=>s({url:"/organisation",method:"get"},e),g=()=>["/organisation"],B=e=>{var i;let{query:t,request:n}=e||{},r=(i=t==null?void 0:t.queryKey)!=null?i:g(),o=u(r,()=>p(n),t);return y({queryKey:r},o)},T=(e,t)=>s({url:"/organisation",method:"post",data:e},t),Q=e=>{let{mutation:t,request:n}=e||{};return c(a=>{let{data:o}=a||{};return T(o,n)},t)};export{T as createOrganisation,g as getGetOrganisationsQueryKey,p as getOrganisations,Q as useCreateOrganisation,B as useGetOrganisations};
2
2
  //# sourceMappingURL=organisation.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/organisation/organisation.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.3.0 \uD83C\uDF7A\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 **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} from \"react-query\";\nimport type {\n OrganisationsGetResponse,\n Error,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 Organisation you have access to\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport const useGetOrganisations = <\n TData = AsyncReturnType<typeof getOrganisations>,\n TError = void | Error\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>\n getOrganisations(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n { url: `/organisation`, method: \"post\", data: organisationPostBodyBody },\n options\n );\n};\n\nexport const useCreateOrganisation = <\n TError = Error | void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisation>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],
5
- "mappings": "gDAUA,wDAkCO,GAAM,GAAmB,AAC9B,GAEO,EACL,CAAE,IAAK,gBAAiB,OAAQ,OAChC,GAIS,EAA8B,IAAM,CAAC,iBAErC,EAAsB,AAGjC,GAOI,CAjEN,MAkEE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EAAW,oBAAc,WAAd,OAA0B,IAKrC,EAAQ,EAIZ,EAPuE,IACvE,EAAiB,GAME,GAErB,MAAO,IACL,YACG,IASM,EAAqB,CAChC,EACA,IAEO,EACL,CAAE,IAAK,gBAAiB,OAAQ,OAAQ,KAAM,GAC9C,GAIS,EAAwB,AAGnC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,QAAS,GAAS,GAE1B,MAAO,GAAmB,EAAM,IAQpB",
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\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 **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 OrganisationsGetResponse,\n Error,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 all the Organisations\n\nYou need **admin** rights to use this method\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport const useGetOrganisations = <\n TData = AsyncReturnType<typeof getOrganisations>,\n TError = ErrorType<void | Error>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisations>,\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 ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>\n getOrganisations(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n { url: `/organisation`, method: \"post\", data: organisationPostBodyBody },\n options\n );\n};\n\nexport const useCreateOrganisation = <\n TError = ErrorType<Error | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisation>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],
5
+ "mappings": "gDAUA,wDAsCO,GAAM,GAAmB,AAC9B,GAEO,EACL,CAAE,IAAK,gBAAiB,OAAQ,OAChC,GAIS,EAA8B,IAAM,CAAC,iBAErC,EAAsB,AAGjC,GAO4D,CArE9D,MAsEE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EAAW,oBAAc,WAAd,OAA0B,IAKrC,EAAQ,EAIZ,EAPuE,IACvE,EAAiB,GAME,GAErB,MAAO,IACL,YACG,IAWM,EAAqB,CAChC,EACA,IAEO,EACL,CAAE,IAAK,gBAAiB,OAAQ,OAAQ,KAAM,GAC9C,GAIS,EAAwB,AAGnC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,QAAS,GAAS,GAE1B,MAAO,GAAmB,EAAM,IAQpB",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.5-rc.2",
2
+ "version": "0.1.6-rc.1",
3
3
  "author": "Oliver Dudgeon",
4
4
  "name": "@squonk/account-server-client",
5
5
  "private": false,
@@ -15,17 +15,17 @@
15
15
  "orval": "orval --config ./orval.config.cjs"
16
16
  },
17
17
  "devDependencies": {
18
- "@typescript-eslint/eslint-plugin": "^5.3.1",
18
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
19
19
  "axios": "^0.24.0",
20
- "eslint": "^8.2.0",
20
+ "eslint": "^8.3.0",
21
21
  "eslint-plugin-prettier": "^4.0.0",
22
22
  "js-yaml": "^4.1.0",
23
- "orval": "^6.3.0",
24
- "prettier": "^2.4.1",
25
- "react-query": "^3.32.3",
23
+ "orval": "^6.4.0",
24
+ "prettier": "^2.5.0",
25
+ "react-query": "^3.33.7",
26
26
  "tslib": "^2.3.1",
27
- "tsup": "^5.7.0",
28
- "typescript": "^4.4.4"
27
+ "tsup": "^5.10.0",
28
+ "typescript": "^4.5.2"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "axios": ">=0.23",
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOULWOQLWcjs = require('../chunk-OULWOQLW.cjs');var _reactquery = require('react-query');var d=e=>_chunkOULWOQLWcjs.e.call(void 0, {url:"/product",method:"get"},e),i= exports.getGetProductsQueryKey =()=>["/product"],F= exports.useGetProducts =e=>{var n;let{query:t,request:r}=e||{},o=(n=t==null?void 0:t.queryKey)!=null?n:i(),y=_reactquery.useQuery.call(void 0, o,()=>d(r),t);return _chunkOULWOQLWcjs.a.call(void 0, {queryKey:o},y)},P= exports.getProductsForUnit =(e,t)=>_chunkOULWOQLWcjs.e.call(void 0, {url:`/product/unit/${e}`,method:"get"},t),T= exports.getGetProductsForUnitQueryKey =e=>[`/product/unit/${e}`],U= exports.useGetProductsForUnit =(e,t)=>{var a;let{query:r,request:o}=t||{},u=(a=r==null?void 0:r.queryKey)!=null?a:T(e),n=_reactquery.useQuery.call(void 0, u,()=>P(e,o),_chunkOULWOQLWcjs.a.call(void 0, {enabled:!!e},r));return _chunkOULWOQLWcjs.a.call(void 0, {queryKey:u},n)};exports.getGetProductsForUnitQueryKey = T; exports.getGetProductsQueryKey = i; exports.getProducts = d; exports.getProductsForUnit = P; exports.useGetProducts = F; exports.useGetProductsForUnit = U;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3KO3PKBXcjs = require('../chunk-3KO3PKBX.cjs');var _reactquery = require('react-query');var P=t=>_chunk3KO3PKBXcjs.e.call(void 0, {url:"/product",method:"get"},t),T= exports.getGetProductsQueryKey =()=>["/product"],G= exports.useGetProducts =t=>{var s;let{query:e,request:r}=t||{},o=(s=e==null?void 0:e.queryKey)!=null?s:T(),u=_reactquery.useQuery.call(void 0, o,()=>P(r),e);return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:o},u)},g= exports.createUnitProduct =(t,e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/product/unit/${t}`,method:"post",data:e},r),I= exports.useCreateUnitProduct =t=>{let{mutation:e,request:r}=t||{};return _reactquery.useMutation.call(void 0, n=>{let{unitid:u,data:s}=n||{};return g(u,s,r)},e)},m= exports.getProductsForUnit =(t,e)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/product/unit/${t}`,method:"get"},e),q= exports.getGetProductsForUnitQueryKey =t=>[`/product/unit/${t}`],O= exports.useGetProductsForUnit =(t,e)=>{var c;let{query:r,request:o}=e||{},n=(c=r==null?void 0:r.queryKey)!=null?c:q(t),s=_reactquery.useQuery.call(void 0, n,()=>m(t,o),_chunk3KO3PKBXcjs.a.call(void 0, {enabled:!!t},r));return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:n},s)},f= exports.getProduct =(t,e,r)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/product/unit/${t}/product/${e}`,method:"get"},r),R= exports.getGetProductQueryKey =(t,e)=>[`/product/unit/${t}/product/${e}`],S= exports.useGetProduct =(t,e,r)=>{var p;let{query:o,request:n}=r||{},u=(p=o==null?void 0:o.queryKey)!=null?p:R(t,e),c=_reactquery.useQuery.call(void 0, u,()=>f(t,e,n),_chunk3KO3PKBXcjs.a.call(void 0, {enabled:!!(t&&e)},o));return _chunk3KO3PKBXcjs.a.call(void 0, {queryKey:u},c)},U= exports.patchProduct =(t,e,r,o)=>_chunk3KO3PKBXcjs.e.call(void 0, {url:`/product/unit/${t}/product/${e}`,method:"patch",data:r},o),$= exports.usePatchProduct =t=>{let{mutation:e,request:r}=t||{};return _reactquery.useMutation.call(void 0, n=>{let{unitid:u,productid:s,data:c}=n||{};return U(u,s,c,r)},e)};exports.createUnitProduct = g; exports.getGetProductQueryKey = R; exports.getGetProductsForUnitQueryKey = q; exports.getGetProductsQueryKey = T; exports.getProduct = f; exports.getProducts = P; exports.getProductsForUnit = m; exports.patchProduct = U; exports.useCreateUnitProduct = I; exports.useGetProduct = S; exports.useGetProducts = G; exports.useGetProductsForUnit = O; exports.usePatchProduct = $;
2
2
  //# sourceMappingURL=product.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/product/product.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.3.0 \uD83C\uDF7A\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 **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport { useQuery, UseQueryOptions, QueryFunction } from \"react-query\";\nimport type {\n ProductGetResponse,\n Error,\n ProductUnitGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 products you have access to\n\n * @summary Gets products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductGetResponse>(\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 = Error | void\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}) => {\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 * 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<ProductUnitGetResponse>(\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 = void | Error\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) => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitid);\n\n const queryFn: QueryFunction<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"],
5
- "mappings": "iDAUA,uCA0BO,GAAM,GAAc,AACzB,GAEO,EACL,CAAE,IAAK,WAAY,OAAQ,OAC3B,GAIS,EAAyB,IAAM,CAAC,YAEhC,EAAiB,AAG5B,GAGI,CArDN,MAsDE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EAAW,oBAAc,WAAd,OAA0B,IAKrC,EAAQ,EACZ,EAJkE,IAClE,EAAY,GAKZ,GAGF,MAAO,IACL,YACG,IASM,EAAqB,CAChC,EACA,IAEO,EACL,CAAE,IAAK,iBAAiB,IAAU,OAAQ,OAC1C,GAIS,EAAgC,AAAC,GAAmB,CAC/D,iBAAiB,KAGN,EAAwB,CAInC,EACA,IAQG,CAzGL,MA0GE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAA8B,GAKpD,EAAQ,EAIZ,EANA,IAAM,EAAmB,EAAQ,GAMd,GAAE,QAAS,CAAC,CAAC,GAAW,IAE7C,MAAO,IACL,YACG",
4
+ "sourcesContent": ["/**\n * Generated by orval v6.4.0 \uD83C\uDF7A\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 **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 ProductsGetResponse,\n Error,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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 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<Error | 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<Error | 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 | Error>\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<Error | 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. Curently you can only patch storage Products\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<Error>,\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"],
5
+ "mappings": "iDAUA,wDAsCO,GAAM,GAAc,AACzB,GAEO,EACL,CAAE,IAAK,WAAY,OAAQ,OAC3B,GAIS,EAAyB,IAAM,CAAC,YAEhC,EAAiB,AAG5B,GAG4D,CAjE9D,MAkEE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EAAW,oBAAc,WAAd,OAA0B,IAKrC,EAAQ,EACZ,EAJkE,IAClE,EAAY,GAKZ,GAGF,MAAO,IACL,YACG,IAOM,EAAoB,CAC/B,EACA,EACA,IAEO,EACL,CACE,IAAK,iBAAiB,IACtB,OAAQ,OACR,KAAM,GAER,GAIS,EAAuB,AAGlC,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,SAAQ,QAAS,GAAS,GAElC,MAAO,GAAkB,EAAQ,EAAM,IAQ3B,IAOH,EAAqB,CAChC,EACA,IAEO,EACL,CAAE,IAAK,iBAAiB,IAAU,OAAQ,OAC1C,GAIS,EAAgC,AAAC,GAAmB,CAC/D,iBAAiB,KAGN,EAAwB,CAInC,EACA,IAQ2D,CArK7D,MAsKE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAA8B,GAMpD,EAAQ,EAIZ,EANE,IAAM,EAAmB,EAAQ,GAMhB,GAAE,QAAS,CAAC,CAAC,GAAW,IAE7C,MAAO,IACL,YACG,IASM,EAAa,CACxB,EACA,EACA,IAEO,EACL,CAAE,IAAK,iBAAiB,aAAkB,IAAa,OAAQ,OAC/D,GAIS,EAAwB,CAAC,EAAgB,IAAsB,CAC1E,iBAAiB,aAAkB,KAGxB,EAAgB,CAI3B,EACA,EACA,IAI2D,CAzN7D,MA0NE,GAAM,CAAE,MAAO,EAAc,QAAS,GAAmB,GAAW,GAE9D,EACJ,oBAAc,WAAd,OAA0B,EAAsB,EAAQ,GAKpD,EAAQ,EACZ,EAJiE,IACjE,EAAW,EAAQ,EAAW,GAK9B,GAAE,QAAS,CAAC,CAAE,IAAU,IAAe,IAGzC,MAAO,IACL,YACG,IASM,EAAe,CAC1B,EACA,EACA,EACA,IAEO,EACL,CACE,IAAK,iBAAiB,aAAkB,IACxC,OAAQ,QACR,KAAM,GAER,GAIS,EAAkB,AAG7B,GAQI,CACJ,GAAM,CAAE,SAAU,EAAiB,QAAS,GAAmB,GAAW,GAW1E,MAAO,GANH,AAAC,GAAU,CACb,GAAM,CAAE,SAAQ,YAAW,QAAS,GAAS,GAE7C,MAAO,GAAa,EAAQ,EAAW,EAAM,IAQjC",
6
6
  "names": []
7
7
  }
@@ -1,260 +1,79 @@
1
1
  import * as react_query from 'react-query';
2
- import { UseQueryOptions } from 'react-query';
3
- import { z as customInstance, d as ProductGetResponse, E as Error, f as ProductUnitGetResponse } from '../custom-instance-d8cc704b';
2
+ import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
3
+ import { G as customInstance, w as ProductsGetResponse, H as ErrorType, E as Error, b as UnitProductPostBodyBody, s as UnitProductPostResponse, u as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-d52e4104';
4
4
  import 'axios';
5
5
 
6
6
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
7
  /**
8
- * Gets products you have access to
8
+ * Gets products you have access to across all Units and Organisations
9
9
 
10
- * @summary Gets products
10
+ * @summary Gets all Products
11
11
  */
12
- declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductGetResponse>;
12
+ declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
13
13
  declare const getGetProductsQueryKey: () => string[];
14
- declare const useGetProducts: <TData = ProductGetResponse, TError = void | Error>(options?: {
15
- query?: UseQueryOptions<ProductGetResponse, TError, TData, react_query.QueryKey> | undefined;
14
+ declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | Error>>(options?: {
15
+ query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
16
16
  request?: SecondParameter<typeof customInstance>;
17
- } | undefined) => {
18
- data: undefined;
19
- error: null;
20
- isError: false;
21
- isIdle: true;
22
- isLoading: false;
23
- isLoadingError: false;
24
- isRefetchError: false;
25
- isSuccess: false;
26
- status: "idle";
27
- dataUpdatedAt: number;
28
- errorUpdatedAt: number;
29
- failureCount: number;
30
- isFetched: boolean;
31
- isFetchedAfterMount: boolean;
32
- isFetching: boolean;
33
- isPlaceholderData: boolean;
34
- isPreviousData: boolean;
35
- isRefetching: boolean;
36
- isStale: boolean;
37
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
38
- remove: () => void;
39
- queryKey: react_query.QueryKey;
40
- } | {
41
- data: undefined;
42
- error: TError;
43
- isError: true;
44
- isIdle: false;
45
- isLoading: false;
46
- isLoadingError: true;
47
- isRefetchError: false;
48
- isSuccess: false;
49
- status: "error";
50
- dataUpdatedAt: number;
51
- errorUpdatedAt: number;
52
- failureCount: number;
53
- isFetched: boolean;
54
- isFetchedAfterMount: boolean;
55
- isFetching: boolean;
56
- isPlaceholderData: boolean;
57
- isPreviousData: boolean;
58
- isRefetching: boolean;
59
- isStale: boolean;
60
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
61
- remove: () => void;
62
- queryKey: react_query.QueryKey;
63
- } | {
64
- data: undefined;
65
- error: null;
66
- isError: false;
67
- isIdle: false;
68
- isLoading: true;
69
- isLoadingError: false;
70
- isRefetchError: false;
71
- isSuccess: false;
72
- status: "loading";
73
- dataUpdatedAt: number;
74
- errorUpdatedAt: number;
75
- failureCount: number;
76
- isFetched: boolean;
77
- isFetchedAfterMount: boolean;
78
- isFetching: boolean;
79
- isPlaceholderData: boolean;
80
- isPreviousData: boolean;
81
- isRefetching: boolean;
82
- isStale: boolean;
83
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
84
- remove: () => void;
85
- queryKey: react_query.QueryKey;
86
- } | {
87
- data: TData;
88
- error: TError;
89
- isError: true;
90
- isIdle: false;
91
- isLoading: false;
92
- isLoadingError: false;
93
- isRefetchError: true;
94
- isSuccess: false;
95
- status: "error";
96
- dataUpdatedAt: number;
97
- errorUpdatedAt: number;
98
- failureCount: number;
99
- isFetched: boolean;
100
- isFetchedAfterMount: boolean;
101
- isFetching: boolean;
102
- isPlaceholderData: boolean;
103
- isPreviousData: boolean;
104
- isRefetching: boolean;
105
- isStale: boolean;
106
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
107
- remove: () => void;
108
- queryKey: react_query.QueryKey;
109
- } | {
110
- data: TData;
111
- error: null;
112
- isError: false;
113
- isIdle: false;
114
- isLoading: false;
115
- isLoadingError: false;
116
- isRefetchError: false;
117
- isSuccess: true;
118
- status: "success";
119
- dataUpdatedAt: number;
120
- errorUpdatedAt: number;
121
- failureCount: number;
122
- isFetched: boolean;
123
- isFetchedAfterMount: boolean;
124
- isFetching: boolean;
125
- isPlaceholderData: boolean;
126
- isPreviousData: boolean;
127
- isRefetching: boolean;
128
- isStale: boolean;
129
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
130
- remove: () => void;
131
- queryKey: react_query.QueryKey;
17
+ } | undefined) => UseQueryResult<TData, TError> & {
18
+ queryKey: QueryKey;
132
19
  };
20
+ /**
21
+ * @summary Creates a Product for an Organisational Unit
22
+ */
23
+ declare const createUnitProduct: (unitid: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
24
+ declare const useCreateUnitProduct: <TError = ErrorType<void | Error>, TContext = unknown>(options?: {
25
+ mutation?: UseMutationOptions<UnitProductPostResponse, TError, {
26
+ unitid: string;
27
+ data: UnitProductPostBodyBody;
28
+ }, TContext> | undefined;
29
+ request?: SecondParameter<typeof customInstance>;
30
+ } | undefined) => react_query.UseMutationResult<UnitProductPostResponse, TError, {
31
+ unitid: string;
32
+ data: UnitProductPostBodyBody;
33
+ }, TContext>;
133
34
  /**
134
35
  * Gets products you have access to based on an Organisational Unit
135
36
 
136
37
  * @summary Gets Products for an Organisational Unit
137
38
  */
138
- declare const getProductsForUnit: (unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
39
+ declare const getProductsForUnit: (unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
139
40
  declare const getGetProductsForUnitQueryKey: (unitid: string) => string[];
140
- declare const useGetProductsForUnit: <TData = ProductUnitGetResponse, TError = void | Error>(unitid: string, options?: {
141
- query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, react_query.QueryKey> | undefined;
41
+ declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | Error>>(unitid: string, options?: {
42
+ query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
43
+ request?: SecondParameter<typeof customInstance>;
44
+ } | undefined) => UseQueryResult<TData, TError> & {
45
+ queryKey: QueryKey;
46
+ };
47
+ /**
48
+ * Gets a Unit's Product
49
+
50
+ * @summary Gets a Unit's Product
51
+ */
52
+ declare const getProduct: (unitid: string, productid: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
53
+ declare const getGetProductQueryKey: (unitid: string, productid: string) => string[];
54
+ declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | Error>>(unitid: string, productid: string, options?: {
55
+ query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
142
56
  request?: SecondParameter<typeof customInstance>;
143
- } | undefined) => {
144
- data: undefined;
145
- error: null;
146
- isError: false;
147
- isIdle: true;
148
- isLoading: false;
149
- isLoadingError: false;
150
- isRefetchError: false;
151
- isSuccess: false;
152
- status: "idle";
153
- dataUpdatedAt: number;
154
- errorUpdatedAt: number;
155
- failureCount: number;
156
- isFetched: boolean;
157
- isFetchedAfterMount: boolean;
158
- isFetching: boolean;
159
- isPlaceholderData: boolean;
160
- isPreviousData: boolean;
161
- isRefetching: boolean;
162
- isStale: boolean;
163
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
164
- remove: () => void;
165
- queryKey: react_query.QueryKey;
166
- } | {
167
- data: undefined;
168
- error: TError;
169
- isError: true;
170
- isIdle: false;
171
- isLoading: false;
172
- isLoadingError: true;
173
- isRefetchError: false;
174
- isSuccess: false;
175
- status: "error";
176
- dataUpdatedAt: number;
177
- errorUpdatedAt: number;
178
- failureCount: number;
179
- isFetched: boolean;
180
- isFetchedAfterMount: boolean;
181
- isFetching: boolean;
182
- isPlaceholderData: boolean;
183
- isPreviousData: boolean;
184
- isRefetching: boolean;
185
- isStale: boolean;
186
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
187
- remove: () => void;
188
- queryKey: react_query.QueryKey;
189
- } | {
190
- data: undefined;
191
- error: null;
192
- isError: false;
193
- isIdle: false;
194
- isLoading: true;
195
- isLoadingError: false;
196
- isRefetchError: false;
197
- isSuccess: false;
198
- status: "loading";
199
- dataUpdatedAt: number;
200
- errorUpdatedAt: number;
201
- failureCount: number;
202
- isFetched: boolean;
203
- isFetchedAfterMount: boolean;
204
- isFetching: boolean;
205
- isPlaceholderData: boolean;
206
- isPreviousData: boolean;
207
- isRefetching: boolean;
208
- isStale: boolean;
209
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
210
- remove: () => void;
211
- queryKey: react_query.QueryKey;
212
- } | {
213
- data: TData;
214
- error: TError;
215
- isError: true;
216
- isIdle: false;
217
- isLoading: false;
218
- isLoadingError: false;
219
- isRefetchError: true;
220
- isSuccess: false;
221
- status: "error";
222
- dataUpdatedAt: number;
223
- errorUpdatedAt: number;
224
- failureCount: number;
225
- isFetched: boolean;
226
- isFetchedAfterMount: boolean;
227
- isFetching: boolean;
228
- isPlaceholderData: boolean;
229
- isPreviousData: boolean;
230
- isRefetching: boolean;
231
- isStale: boolean;
232
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
233
- remove: () => void;
234
- queryKey: react_query.QueryKey;
235
- } | {
236
- data: TData;
237
- error: null;
238
- isError: false;
239
- isIdle: false;
240
- isLoading: false;
241
- isLoadingError: false;
242
- isRefetchError: false;
243
- isSuccess: true;
244
- status: "success";
245
- dataUpdatedAt: number;
246
- errorUpdatedAt: number;
247
- failureCount: number;
248
- isFetched: boolean;
249
- isFetchedAfterMount: boolean;
250
- isFetching: boolean;
251
- isPlaceholderData: boolean;
252
- isPreviousData: boolean;
253
- isRefetching: boolean;
254
- isStale: boolean;
255
- refetch: <TPageData>(options?: (react_query.RefetchOptions & react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<react_query.QueryObserverResult<TData, TError>>;
256
- remove: () => void;
257
- queryKey: react_query.QueryKey;
57
+ } | undefined) => UseQueryResult<TData, TError> & {
58
+ queryKey: QueryKey;
258
59
  };
60
+ /**
61
+ * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. Curently you can only patch storage Products
62
+
63
+ * @summary Adjust an existing Product
64
+ */
65
+ declare const patchProduct: (unitid: string, productid: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
66
+ declare const usePatchProduct: <TError = ErrorType<Error>, TContext = unknown>(options?: {
67
+ mutation?: UseMutationOptions<void, TError, {
68
+ unitid: string;
69
+ productid: string;
70
+ data: ProductPatchBodyBody;
71
+ }, TContext> | undefined;
72
+ request?: SecondParameter<typeof customInstance>;
73
+ } | undefined) => react_query.UseMutationResult<void, TError, {
74
+ unitid: string;
75
+ productid: string;
76
+ data: ProductPatchBodyBody;
77
+ }, TContext>;
259
78
 
260
- export { getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProducts, getProductsForUnit, useGetProducts, useGetProductsForUnit };
79
+ export { createUnitProduct, getGetProductQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProducts, getProductsForUnit, patchProduct, useCreateUnitProduct, useGetProduct, useGetProducts, useGetProductsForUnit, usePatchProduct };
@@ -1,2 +1,2 @@
1
- import{a as s,e as c}from"../chunk-WMX3LCLR.js";import{useQuery as p}from"react-query";var d=e=>c({url:"/product",method:"get"},e),i=()=>["/product"],R=e=>{var n;let{query:t,request:r}=e||{},o=(n=t==null?void 0:t.queryKey)!=null?n:i(),y=p(o,()=>d(r),t);return s({queryKey:o},y)},P=(e,t)=>c({url:`/product/unit/${e}`,method:"get"},t),T=e=>[`/product/unit/${e}`],F=(e,t)=>{var a;let{query:r,request:o}=t||{},u=(a=r==null?void 0:r.queryKey)!=null?a:T(e),n=p(u,()=>P(e,o),s({enabled:!!e},r));return s({queryKey:u},n)};export{T as getGetProductsForUnitQueryKey,i as getGetProductsQueryKey,d as getProducts,P as getProductsForUnit,R as useGetProducts,F as useGetProductsForUnit};
1
+ import{a as y,e as a}from"../chunk-33VR3IML.js";import{useQuery as d,useMutation as i}from"react-query";var P=t=>a({url:"/product",method:"get"},t),T=()=>["/product"],l=t=>{var s;let{query:e,request:r}=t||{},o=(s=e==null?void 0:e.queryKey)!=null?s:T(),u=d(o,()=>P(r),e);return y({queryKey:o},u)},g=(t,e,r)=>a({url:`/product/unit/${t}`,method:"post",data:e},r),G=t=>{let{mutation:e,request:r}=t||{};return i(n=>{let{unitid:u,data:s}=n||{};return g(u,s,r)},e)},m=(t,e)=>a({url:`/product/unit/${t}`,method:"get"},e),q=t=>[`/product/unit/${t}`],I=(t,e)=>{var c;let{query:r,request:o}=e||{},n=(c=r==null?void 0:r.queryKey)!=null?c:q(t),s=d(n,()=>m(t,o),y({enabled:!!t},r));return y({queryKey:n},s)},f=(t,e,r)=>a({url:`/product/unit/${t}/product/${e}`,method:"get"},r),R=(t,e)=>[`/product/unit/${t}/product/${e}`],O=(t,e,r)=>{var p;let{query:o,request:n}=r||{},u=(p=o==null?void 0:o.queryKey)!=null?p:R(t,e),c=d(u,()=>f(t,e,n),y({enabled:!!(t&&e)},o));return y({queryKey:u},c)},U=(t,e,r,o)=>a({url:`/product/unit/${t}/product/${e}`,method:"patch",data:r},o),S=t=>{let{mutation:e,request:r}=t||{};return i(n=>{let{unitid:u,productid:s,data:c}=n||{};return U(u,s,c,r)},e)};export{g as createUnitProduct,R as getGetProductQueryKey,q as getGetProductsForUnitQueryKey,T as getGetProductsQueryKey,f as getProduct,P as getProducts,m as getProductsForUnit,U as patchProduct,G as useCreateUnitProduct,O as useGetProduct,l as useGetProducts,I as useGetProductsForUnit,S as usePatchProduct};
2
2
  //# sourceMappingURL=product.js.map