@squonk/account-server-client 0.1.23-rc.2 → 0.1.26-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{custom-instance-86dd5ce6.d.ts → account-server-api.schemas-078442c3.d.ts} +4 -22
- package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
- package/chunk-GWBPVOL2.js.map +1 -0
- package/chunk-N3RLW53G.cjs +25 -0
- package/chunk-N3RLW53G.cjs.map +1 -0
- package/index.cjs +21 -5
- package/index.cjs.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +21 -5
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +20 -65
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +18 -58
- package/organisation/organisation.js +20 -65
- package/organisation/organisation.js.map +1 -1
- package/package.json +14 -14
- package/product/product.cjs +32 -107
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +24 -84
- package/product/product.js +32 -107
- package/product/product.js.map +1 -1
- package/service/service.cjs +11 -38
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +9 -31
- package/service/service.js +11 -38
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +3 -3
- package/src/organisation/organisation.ts +43 -191
- package/src/product/product.ts +87 -294
- package/src/service/service.ts +17 -101
- package/src/state/state.ts +17 -66
- package/src/unit/unit.ts +71 -315
- package/src/user/user.ts +68 -330
- package/state/state.cjs +8 -22
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -16
- package/state/state.js +8 -22
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +30 -109
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +25 -92
- package/unit/unit.js +30 -109
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +30 -107
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +20 -118
- package/user/user.js +30 -107
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs +0 -46
- package/chunk-3DXYUDZH.cjs.map +0 -1
- package/chunk-JR7F532L.js.map +0 -1
|
@@ -1,73 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
__spreadValues,
|
|
3
|
-
customInstance
|
|
4
|
-
} from "../chunk-JR7F532L.js";
|
|
1
|
+
import "../chunk-GWBPVOL2.js";
|
|
5
2
|
|
|
6
3
|
// src/organisation/organisation.ts
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getOrganisations = (options) => {
|
|
12
|
-
return customInstance({ url: `/organisation`, method: "get" }, options);
|
|
13
|
-
};
|
|
14
|
-
var getGetOrganisationsQueryKey = () => [`/organisation`];
|
|
15
|
-
var useGetOrganisations = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationsQueryKey();
|
|
18
|
-
const queryFn = () => getOrganisations(requestOptions);
|
|
19
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
|
-
return __spreadValues({
|
|
21
|
-
queryKey
|
|
22
|
-
}, query);
|
|
23
|
-
};
|
|
24
|
-
var createOrganisation = (organisationPostBodyBody, options) => {
|
|
25
|
-
return customInstance({ url: `/organisation`, method: "post", data: organisationPostBodyBody }, options);
|
|
26
|
-
};
|
|
27
|
-
var useCreateOrganisation = (options) => {
|
|
28
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
29
|
-
const mutationFn = (props) => {
|
|
30
|
-
const { data } = props || {};
|
|
31
|
-
return createOrganisation(data, requestOptions);
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
var getOrganisation = () => {
|
|
6
|
+
const appApiOrganisationGet = (options) => {
|
|
7
|
+
return axios.get(`/organisation`, options);
|
|
32
8
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
9
|
+
const appApiOrganisationPost = (organisationPostBodyBody, options) => {
|
|
10
|
+
return axios.post(`/organisation`, organisationPostBodyBody, options);
|
|
11
|
+
};
|
|
12
|
+
const appApiOrganisationDelete = (orgId, options) => {
|
|
13
|
+
return axios.delete(`/organisation/${orgId}`, options);
|
|
14
|
+
};
|
|
15
|
+
const appApiOrganisationGetDefault = (options) => {
|
|
16
|
+
return axios.get(`/organisation/default`, options);
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
appApiOrganisationGet,
|
|
20
|
+
appApiOrganisationPost,
|
|
21
|
+
appApiOrganisationDelete,
|
|
22
|
+
appApiOrganisationGetDefault
|
|
43
23
|
};
|
|
44
|
-
return useMutation(mutationFn, mutationOptions);
|
|
45
|
-
};
|
|
46
|
-
var getDefaultOrganisation = (options) => {
|
|
47
|
-
return customInstance({ url: `/organisation/default`, method: "get" }, options);
|
|
48
|
-
};
|
|
49
|
-
var getGetDefaultOrganisationQueryKey = () => [
|
|
50
|
-
`/organisation/default`
|
|
51
|
-
];
|
|
52
|
-
var useGetDefaultOrganisation = (options) => {
|
|
53
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
54
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetDefaultOrganisationQueryKey();
|
|
55
|
-
const queryFn = () => getDefaultOrganisation(requestOptions);
|
|
56
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
57
|
-
return __spreadValues({
|
|
58
|
-
queryKey
|
|
59
|
-
}, query);
|
|
60
24
|
};
|
|
61
25
|
export {
|
|
62
|
-
|
|
63
|
-
deleteOrganisation,
|
|
64
|
-
getDefaultOrganisation,
|
|
65
|
-
getGetDefaultOrganisationQueryKey,
|
|
66
|
-
getGetOrganisationsQueryKey,
|
|
67
|
-
getOrganisations,
|
|
68
|
-
useCreateOrganisation,
|
|
69
|
-
useDeleteOrganisation,
|
|
70
|
-
useGetDefaultOrganisation,
|
|
71
|
-
useGetOrganisations
|
|
26
|
+
getOrganisation
|
|
72
27
|
};
|
|
73
28
|
//# sourceMappingURL=organisation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.
|
|
1
|
+
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n OrganisationsGetResponse,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getOrganisation = () => {\n /**\n * Gets all the Organisations you are a member of. Admin users can see all Organisations\n\n * @summary Gets Organisations\n */\n const appApiOrganisationGet = <\n TData = AxiosResponse<OrganisationsGetResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation`, options);\n };\n /**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\n const appApiOrganisationPost = <\n TData = AxiosResponse<OrganisationPostResponse>\n >(\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(`/organisation`, organisationPostBodyBody, options);\n };\n /**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\n const appApiOrganisationDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}`, options);\n };\n /**\n * Gets the built-in Default Organisation, used exclusively for Independent Units\n\n * @summary Gets the (built-in) Default Organisation\n */\n const appApiOrganisationGetDefault = <\n TData = AxiosResponse<OrganisationGetDefaultResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/default`, options);\n };\n return {\n appApiOrganisationGet,\n appApiOrganisationPost,\n appApiOrganisationDelete,\n appApiOrganisationGetDefault,\n };\n};\nexport type AppApiOrganisationGetResult =\n AxiosResponse<OrganisationsGetResponse>;\nexport type AppApiOrganisationPostResult =\n AxiosResponse<OrganisationPostResponse>;\nexport type AppApiOrganisationDeleteResult = AxiosResponse<void>;\nexport type AppApiOrganisationGetDefaultResult =\n AxiosResponse<OrganisationGetDefaultResponse>;\n"],"mappings":";;;AAUA;AAQO,IAAM,kBAAkB,MAAM;AAMnC,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAQA,QAAM,yBAAyB,CAG7B,0BACA,YACmB;AACnB,WAAO,MAAM,KAAK,iBAAiB,0BAA0B,OAAO;AAAA,EACtE;AAQA,QAAM,2BAA2B,CAC/B,OACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,SAAS,OAAO;AAAA,EACvD;AAMA,QAAM,+BAA+B,CAGnC,YACmB;AACnB,WAAO,MAAM,IAAI,yBAAyB,OAAO;AAAA,EACnD;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.26-rc.1",
|
|
3
3
|
"author": "Oliver Dudgeon",
|
|
4
4
|
"name": "@squonk/account-server-client",
|
|
5
5
|
"private": false,
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "orval
|
|
15
|
-
"orval": "orval
|
|
14
|
+
"build": "orval && tsup && node setup-entrypoints.js",
|
|
15
|
+
"orval": "orval"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "
|
|
19
|
-
"axios": "0.
|
|
20
|
-
"eslint": "
|
|
21
|
-
"eslint-plugin-prettier": "
|
|
22
|
-
"js-yaml": "
|
|
23
|
-
"orval": "6.
|
|
24
|
-
"prettier": "
|
|
25
|
-
"react-query": "3.34.
|
|
26
|
-
"tslib": "
|
|
27
|
-
"tsup": "5.
|
|
28
|
-
"typescript": "
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "5.19.0",
|
|
19
|
+
"axios": "0.26.1",
|
|
20
|
+
"eslint": "8.13.0",
|
|
21
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
22
|
+
"js-yaml": "4.1.0",
|
|
23
|
+
"orval": "6.7.1",
|
|
24
|
+
"prettier": "2.6.2",
|
|
25
|
+
"react-query": "3.34.19",
|
|
26
|
+
"tslib": "2.3.1",
|
|
27
|
+
"tsup": "5.12.5",
|
|
28
|
+
"typescript": "4.6.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"axios": ">=0.23",
|
package/product/product.cjs
CHANGED
|
@@ -1,115 +1,40 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-N3RLW53G.cjs');
|
|
5
2
|
|
|
6
3
|
// src/product/product.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getProductTypes = (options) => {
|
|
12
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/product-type`, method: "get" }, options);
|
|
13
|
-
};
|
|
14
|
-
var getGetProductTypesQueryKey = () => [`/product-type`];
|
|
15
|
-
var useGetProductTypes = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductTypesQueryKey()));
|
|
18
|
-
const queryFn = () => getProductTypes(requestOptions);
|
|
19
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
21
|
-
queryKey
|
|
22
|
-
}, query);
|
|
23
|
-
};
|
|
24
|
-
var getProducts = (options) => {
|
|
25
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/product`, method: "get" }, options);
|
|
26
|
-
};
|
|
27
|
-
var getGetProductsQueryKey = () => [`/product`];
|
|
28
|
-
var useGetProducts = (options) => {
|
|
29
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
30
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsQueryKey()));
|
|
31
|
-
const queryFn = () => getProducts(requestOptions);
|
|
32
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
33
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
34
|
-
queryKey
|
|
35
|
-
}, query);
|
|
36
|
-
};
|
|
37
|
-
var createUnitProduct = (unitid, unitProductPostBodyBody, options) => {
|
|
38
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, {
|
|
39
|
-
url: `/product/unit/${unitid}`,
|
|
40
|
-
method: "post",
|
|
41
|
-
data: unitProductPostBodyBody
|
|
42
|
-
}, options);
|
|
43
|
-
};
|
|
44
|
-
var useCreateUnitProduct = (options) => {
|
|
45
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
46
|
-
const mutationFn = (props) => {
|
|
47
|
-
const { unitid, data } = props || {};
|
|
48
|
-
return createUnitProduct(unitid, data, requestOptions);
|
|
4
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
5
|
+
var getProduct = () => {
|
|
6
|
+
const appApiProductGetTypes = (options) => {
|
|
7
|
+
return _axios2.default.get(`/product-type`, options);
|
|
49
8
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const queryFn = () => getProduct(unitid, productid, requestOptions);
|
|
77
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!(unitid && productid) }, queryOptions));
|
|
78
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
79
|
-
queryKey
|
|
80
|
-
}, query);
|
|
81
|
-
};
|
|
82
|
-
var patchProduct = (unitid, productid, productPatchBodyBody, options) => {
|
|
83
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, {
|
|
84
|
-
url: `/product/unit/${unitid}/product/${productid}`,
|
|
85
|
-
method: "patch",
|
|
86
|
-
data: productPatchBodyBody
|
|
87
|
-
}, options);
|
|
88
|
-
};
|
|
89
|
-
var usePatchProduct = (options) => {
|
|
90
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
91
|
-
const mutationFn = (props) => {
|
|
92
|
-
const { unitid, productid, data } = props || {};
|
|
93
|
-
return patchProduct(unitid, productid, data, requestOptions);
|
|
9
|
+
const appApiProductGet = (options) => {
|
|
10
|
+
return _axios2.default.get(`/product`, options);
|
|
11
|
+
};
|
|
12
|
+
const appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
|
|
13
|
+
return _axios2.default.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
|
|
14
|
+
};
|
|
15
|
+
const appApiProductGetForUnit = (unitId, options) => {
|
|
16
|
+
return _axios2.default.get(`/product/unit/${unitId}`, options);
|
|
17
|
+
};
|
|
18
|
+
const appApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
19
|
+
return _axios2.default.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
20
|
+
};
|
|
21
|
+
const appApiProductDelete = (unitId, productId, options) => {
|
|
22
|
+
return _axios2.default.delete(`/product/unit/${unitId}/product/${productId}`, options);
|
|
23
|
+
};
|
|
24
|
+
const appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
|
|
25
|
+
return _axios2.default.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
appApiProductGetTypes,
|
|
29
|
+
appApiProductGet,
|
|
30
|
+
appApiProductPost,
|
|
31
|
+
appApiProductGetForUnit,
|
|
32
|
+
appApiProductGetUnitProduct,
|
|
33
|
+
appApiProductDelete,
|
|
34
|
+
appApiProductPatch
|
|
94
35
|
};
|
|
95
|
-
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
96
36
|
};
|
|
97
37
|
|
|
98
38
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
exports.createUnitProduct = createUnitProduct; exports.getGetProductQueryKey = getGetProductQueryKey; exports.getGetProductTypesQueryKey = getGetProductTypesQueryKey; exports.getGetProductsForUnitQueryKey = getGetProductsForUnitQueryKey; exports.getGetProductsQueryKey = getGetProductsQueryKey; exports.getProduct = getProduct; exports.getProductTypes = getProductTypes; exports.getProducts = getProducts; exports.getProductsForUnit = getProductsForUnit; exports.patchProduct = patchProduct; exports.useCreateUnitProduct = useCreateUnitProduct; exports.useGetProduct = useGetProduct; exports.useGetProductTypes = useGetProductTypes; exports.useGetProducts = useGetProducts; exports.useGetProductsForUnit = useGetProductsForUnit; exports.usePatchProduct = usePatchProduct;
|
|
39
|
+
exports.getProduct = getProduct;
|
|
115
40
|
//# sourceMappingURL=product.cjs.map
|
package/product/product.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAyCO,IAAM,kBAAkB,CAC7B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,SAChC;AAAA;AAIG,IAAM,6BAA6B,MAAM,CAAC;AAE1C,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAAkE,MACtE,gBAAgB;AAElB,QAAM,QAAQ,SAIZ,UAAU,SAAS;AAErB,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,SAC3B;AAAA;AAIG,IAAM,yBAAyB,MAAM,CAAC;AAEtC,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA8D,MAClE,YAAY;AAEd,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AAOA,IAAM,oBAAoB,CAC/B,QACA,yBACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB;AAAA,IACtB,QAAQ;AAAA,IACR,MAAM;AAAA,KAER;AAAA;AAIG,IAAM,uBAAuB,CAGlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,SAAS,SAAS;AAElC,WAAO,kBAAkB,QAAQ,MAAM;AAAA;AAGzC,SAAO,YAKL,YAAY;AAAA;AAOT,IAAM,qBAAqB,CAChC,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,UAAU,QAAQ,SAC1C;AAAA;AAIG,IAAM,gCAAgC,CAAC,WAAmB;AAAA,EAC/D,iBAAiB;AAAA;AAGZ,IAAM,wBAAwB,CAInC,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WACJ,8CAAc,aAAY,8BAA8B;AAE1D,QAAM,UAEF,MAAM,mBAAmB,QAAQ;AAErC,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,UAAW;AAE7C,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,aAAa,CACxB,QACA,WACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,kBAAkB,aAAa,QAAQ,SAC/D;AAAA;AAIG,IAAM,wBAAwB,CAAC,QAAgB,cAAsB;AAAA,EAC1E,iBAAiB,kBAAkB;AAAA;AAG9B,IAAM,gBAAgB,CAI3B,QACA,WACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WACJ,8CAAc,aAAY,sBAAsB,QAAQ;AAE1D,QAAM,UAA6D,MACjE,WAAW,QAAQ,WAAW;AAEhC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAE,WAAU,cAAe;AAGzC,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,eAAe,CAC1B,QACA,WACA,sBACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB,kBAAkB;AAAA,IACxC,QAAQ;AAAA,IACR,MAAM;AAAA,KAER;AAAA;AAIG,IAAM,kBAAkB,CAG7B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,SAAS;AAE7C,WAAO,aAAa,QAAQ,WAAW,MAAM;AAAA;AAG/C,SAAO,YAKL,YAAY;AAAA","sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport const useGetProductTypes = <\n TData = AsyncReturnType<typeof getProductTypes>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>\n getProductTypes(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport const useGetProducts = <\n TData = AsyncReturnType<typeof getProducts>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>\n getProducts(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitid: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitid}`,\n method: \"post\",\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createUnitProduct>,\n { unitid: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitid, data } = props || {};\n\n return createUnitProduct(unitid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitid: string) => [\n `/product/unit/${unitid}`,\n];\n\nexport const useGetProductsForUnit = <\n TData = AsyncReturnType<typeof getProductsForUnit>,\n TError = ErrorType<void | AsError>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForUnit>\n > = () => getProductsForUnit(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitid: string,\n productid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/unit/${unitid}/product/${productid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitid: string, productid: string) => [\n `/product/unit/${unitid}/product/${productid}`,\n];\n\nexport const useGetProduct = <\n TData = AsyncReturnType<typeof getProduct>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n productid: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitid, productid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>\n getProduct(unitid, productid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitid && productid), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. Curerntly 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<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchProduct>,\n { unitid: string; productid: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitid, productid, data } = props || {};\n\n return patchProduct(unitid, productid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;AAUA;AAUO,IAAM,aAAa,MAAM;AAM9B,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAIA,QAAM,oBAAoB,CACxB,QACA,yBACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,UACjB,yBACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,UAAU,OAAO;AAAA,EACrD;AAMA,QAAM,8BAA8B,CAGlC,QACA,WACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,kBAAkB,aAAa,OAAO;AAAA,EAC1E;AAIA,QAAM,sBAAsB,CAC1B,QACA,WACA,YACmB;AACnB,WAAO,MAAM,OACX,iBAAiB,kBAAkB,aACnC,OACF;AAAA,EACF;AAMA,QAAM,qBAAqB,CACzB,QACA,WACA,sBACA,YACmB;AACnB,WAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ProductsGetTypesResponse,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\nexport const getProduct = () => {\n /**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\n const appApiProductGetTypes = <\n TData = AxiosResponse<ProductsGetTypesResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product-type`, options);\n };\n /**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\n const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product`, options);\n };\n /**\n * @summary Creates a Product for an Organisational Unit\n */\n const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\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 */\n const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}`, options);\n };\n /**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\n const appApiProductGetUnitProduct = <\n TData = AxiosResponse<ProductUnitGetResponse>\n >(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n };\n /**\n * @summary Deletes an existing Product\n */\n const appApiProductDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(\n `/product/unit/${unitId}/product/${productId}`,\n options\n );\n };\n /**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\n const appApiProductPatch = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n };\n return {\n appApiProductGetTypes,\n appApiProductGet,\n appApiProductPost,\n appApiProductGetForUnit,\n appApiProductGetUnitProduct,\n appApiProductDelete,\n appApiProductPatch,\n };\n};\nexport type AppApiProductGetTypesResult =\n AxiosResponse<ProductsGetTypesResponse>;\nexport type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;\nexport type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductGetUnitProductResult =\n AxiosResponse<ProductUnitGetResponse>;\nexport type AppApiProductDeleteResult = AxiosResponse<void>;\nexport type AppApiProductPatchResult = AxiosResponse<void>;\n"]}
|
package/product/product.d.ts
CHANGED
|
@@ -1,92 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { V as customInstance, B as ProductsGetTypesResponse, W as ErrorType, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-86dd5ce6';
|
|
4
|
-
import 'axios';
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { B as ProductsGetTypesResponse, D as ProductsGetResponse, y as UnitProductPostResponse, b as UnitProductPostBodyBody, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../account-server-api.schemas-078442c3.js';
|
|
5
3
|
|
|
6
|
-
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
4
|
/**
|
|
8
|
-
*
|
|
5
|
+
* Generated by orval v6.7.1 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Account Server API
|
|
8
|
+
* The Informatics Matters Account Server API.
|
|
9
9
|
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
declare const getProductTypes: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetTypesResponse>;
|
|
13
|
-
declare const getGetProductTypesQueryKey: () => string[];
|
|
14
|
-
declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
15
|
-
query?: UseQueryOptions<ProductsGetTypesResponse, TError, TData, QueryKey> | undefined;
|
|
16
|
-
request?: SecondParameter<typeof customInstance>;
|
|
17
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
18
|
-
queryKey: QueryKey;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Gets products you have access to, across all Units and Organisations
|
|
10
|
+
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
22
11
|
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
|
|
26
|
-
declare const getGetProductsQueryKey: () => string[];
|
|
27
|
-
declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
28
|
-
query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
|
|
29
|
-
request?: SecondParameter<typeof customInstance>;
|
|
30
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
31
|
-
queryKey: QueryKey;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* @summary Creates a Product for an Organisational Unit
|
|
12
|
+
* OpenAPI spec version: 0.1
|
|
35
13
|
*/
|
|
36
|
-
declare const createUnitProduct: (unitid: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
|
|
37
|
-
declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
38
|
-
mutation?: UseMutationOptions<UnitProductPostResponse, TError, {
|
|
39
|
-
unitid: string;
|
|
40
|
-
data: UnitProductPostBodyBody;
|
|
41
|
-
}, TContext> | undefined;
|
|
42
|
-
request?: SecondParameter<typeof customInstance>;
|
|
43
|
-
} | undefined) => react_query.UseMutationResult<UnitProductPostResponse, TError, {
|
|
44
|
-
unitid: string;
|
|
45
|
-
data: UnitProductPostBodyBody;
|
|
46
|
-
}, TContext>;
|
|
47
|
-
/**
|
|
48
|
-
* Gets products you have access to based on an Organisational Unit
|
|
49
14
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
queryKey: QueryKey;
|
|
15
|
+
declare const getProduct: () => {
|
|
16
|
+
appApiProductGetTypes: <TData = AxiosResponse<ProductsGetTypesResponse, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData>;
|
|
17
|
+
appApiProductGet: <TData_1 = AxiosResponse<ProductsGetResponse, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData_1>;
|
|
18
|
+
appApiProductPost: <TData_2 = AxiosResponse<UnitProductPostResponse, any>>(unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_2>;
|
|
19
|
+
appApiProductGetForUnit: <TData_3 = AxiosResponse<ProductsGetResponse, any>>(unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_3>;
|
|
20
|
+
appApiProductGetUnitProduct: <TData_4 = AxiosResponse<ProductUnitGetResponse, any>>(unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_4>;
|
|
21
|
+
appApiProductDelete: <TData_5 = AxiosResponse<void, any>>(unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_5>;
|
|
22
|
+
appApiProductPatch: <TData_6 = AxiosResponse<void, any>>(unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_6>;
|
|
59
23
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
declare
|
|
66
|
-
declare
|
|
67
|
-
declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitid: string, productid: string, options?: {
|
|
68
|
-
query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
|
|
69
|
-
request?: SecondParameter<typeof customInstance>;
|
|
70
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
71
|
-
queryKey: QueryKey;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. Curerntly you can only patch storage Products
|
|
75
|
-
|
|
76
|
-
* @summary Adjust an existing Product
|
|
77
|
-
*/
|
|
78
|
-
declare const patchProduct: (unitid: string, productid: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
79
|
-
declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
80
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
81
|
-
unitid: string;
|
|
82
|
-
productid: string;
|
|
83
|
-
data: ProductPatchBodyBody;
|
|
84
|
-
}, TContext> | undefined;
|
|
85
|
-
request?: SecondParameter<typeof customInstance>;
|
|
86
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
87
|
-
unitid: string;
|
|
88
|
-
productid: string;
|
|
89
|
-
data: ProductPatchBodyBody;
|
|
90
|
-
}, TContext>;
|
|
24
|
+
declare type AppApiProductGetTypesResult = AxiosResponse<ProductsGetTypesResponse>;
|
|
25
|
+
declare type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;
|
|
26
|
+
declare type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;
|
|
27
|
+
declare type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;
|
|
28
|
+
declare type AppApiProductGetUnitProductResult = AxiosResponse<ProductUnitGetResponse>;
|
|
29
|
+
declare type AppApiProductDeleteResult = AxiosResponse<void>;
|
|
30
|
+
declare type AppApiProductPatchResult = AxiosResponse<void>;
|
|
91
31
|
|
|
92
|
-
export {
|
|
32
|
+
export { AppApiProductDeleteResult, AppApiProductGetForUnitResult, AppApiProductGetResult, AppApiProductGetTypesResult, AppApiProductGetUnitProductResult, AppApiProductPatchResult, AppApiProductPostResult, getProduct };
|
package/product/product.js
CHANGED
|
@@ -1,115 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
__spreadValues,
|
|
3
|
-
customInstance
|
|
4
|
-
} from "../chunk-JR7F532L.js";
|
|
1
|
+
import "../chunk-GWBPVOL2.js";
|
|
5
2
|
|
|
6
3
|
// src/product/product.ts
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getProductTypes = (options) => {
|
|
12
|
-
return customInstance({ url: `/product-type`, method: "get" }, options);
|
|
13
|
-
};
|
|
14
|
-
var getGetProductTypesQueryKey = () => [`/product-type`];
|
|
15
|
-
var useGetProductTypes = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductTypesQueryKey();
|
|
18
|
-
const queryFn = () => getProductTypes(requestOptions);
|
|
19
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
|
-
return __spreadValues({
|
|
21
|
-
queryKey
|
|
22
|
-
}, query);
|
|
23
|
-
};
|
|
24
|
-
var getProducts = (options) => {
|
|
25
|
-
return customInstance({ url: `/product`, method: "get" }, options);
|
|
26
|
-
};
|
|
27
|
-
var getGetProductsQueryKey = () => [`/product`];
|
|
28
|
-
var useGetProducts = (options) => {
|
|
29
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
30
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsQueryKey();
|
|
31
|
-
const queryFn = () => getProducts(requestOptions);
|
|
32
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
33
|
-
return __spreadValues({
|
|
34
|
-
queryKey
|
|
35
|
-
}, query);
|
|
36
|
-
};
|
|
37
|
-
var createUnitProduct = (unitid, unitProductPostBodyBody, options) => {
|
|
38
|
-
return customInstance({
|
|
39
|
-
url: `/product/unit/${unitid}`,
|
|
40
|
-
method: "post",
|
|
41
|
-
data: unitProductPostBodyBody
|
|
42
|
-
}, options);
|
|
43
|
-
};
|
|
44
|
-
var useCreateUnitProduct = (options) => {
|
|
45
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
46
|
-
const mutationFn = (props) => {
|
|
47
|
-
const { unitid, data } = props || {};
|
|
48
|
-
return createUnitProduct(unitid, data, requestOptions);
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
var getProduct = () => {
|
|
6
|
+
const appApiProductGetTypes = (options) => {
|
|
7
|
+
return axios.get(`/product-type`, options);
|
|
49
8
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const queryFn = () => getProduct(unitid, productid, requestOptions);
|
|
77
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitid && productid) }, queryOptions));
|
|
78
|
-
return __spreadValues({
|
|
79
|
-
queryKey
|
|
80
|
-
}, query);
|
|
81
|
-
};
|
|
82
|
-
var patchProduct = (unitid, productid, productPatchBodyBody, options) => {
|
|
83
|
-
return customInstance({
|
|
84
|
-
url: `/product/unit/${unitid}/product/${productid}`,
|
|
85
|
-
method: "patch",
|
|
86
|
-
data: productPatchBodyBody
|
|
87
|
-
}, options);
|
|
88
|
-
};
|
|
89
|
-
var usePatchProduct = (options) => {
|
|
90
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
91
|
-
const mutationFn = (props) => {
|
|
92
|
-
const { unitid, productid, data } = props || {};
|
|
93
|
-
return patchProduct(unitid, productid, data, requestOptions);
|
|
9
|
+
const appApiProductGet = (options) => {
|
|
10
|
+
return axios.get(`/product`, options);
|
|
11
|
+
};
|
|
12
|
+
const appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
|
|
13
|
+
return axios.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
|
|
14
|
+
};
|
|
15
|
+
const appApiProductGetForUnit = (unitId, options) => {
|
|
16
|
+
return axios.get(`/product/unit/${unitId}`, options);
|
|
17
|
+
};
|
|
18
|
+
const appApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
19
|
+
return axios.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
20
|
+
};
|
|
21
|
+
const appApiProductDelete = (unitId, productId, options) => {
|
|
22
|
+
return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);
|
|
23
|
+
};
|
|
24
|
+
const appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
|
|
25
|
+
return axios.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
appApiProductGetTypes,
|
|
29
|
+
appApiProductGet,
|
|
30
|
+
appApiProductPost,
|
|
31
|
+
appApiProductGetForUnit,
|
|
32
|
+
appApiProductGetUnitProduct,
|
|
33
|
+
appApiProductDelete,
|
|
34
|
+
appApiProductPatch
|
|
94
35
|
};
|
|
95
|
-
return useMutation(mutationFn, mutationOptions);
|
|
96
36
|
};
|
|
97
37
|
export {
|
|
98
|
-
|
|
99
|
-
getGetProductQueryKey,
|
|
100
|
-
getGetProductTypesQueryKey,
|
|
101
|
-
getGetProductsForUnitQueryKey,
|
|
102
|
-
getGetProductsQueryKey,
|
|
103
|
-
getProduct,
|
|
104
|
-
getProductTypes,
|
|
105
|
-
getProducts,
|
|
106
|
-
getProductsForUnit,
|
|
107
|
-
patchProduct,
|
|
108
|
-
useCreateUnitProduct,
|
|
109
|
-
useGetProduct,
|
|
110
|
-
useGetProductTypes,
|
|
111
|
-
useGetProducts,
|
|
112
|
-
useGetProductsForUnit,
|
|
113
|
-
usePatchProduct
|
|
38
|
+
getProduct
|
|
114
39
|
};
|
|
115
40
|
//# sourceMappingURL=product.js.map
|