@squonk/account-server-client 0.1.24-rc.1 → 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-4a108741.d.ts → account-server-api.schemas-078442c3.d.ts} +2 -20
- 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 +1 -1
- package/src/organisation/organisation.ts +43 -191
- package/src/product/product.ts +86 -293
- 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
package/user/user.cjs
CHANGED
|
@@ -1,117 +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/user/user.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getUserAccount = (options) => {
|
|
12
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/user/account`, method: "get" }, options);
|
|
13
|
-
};
|
|
14
|
-
var getGetUserAccountQueryKey = () => [`/user/account`];
|
|
15
|
-
var useGetUserAccount = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUserAccountQueryKey()));
|
|
18
|
-
const queryFn = () => getUserAccount(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 getOrganisationUsers = (orgid, options) => {
|
|
25
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/user`, method: "get" }, options);
|
|
26
|
-
};
|
|
27
|
-
var getGetOrganisationUsersQueryKey = (orgid) => [
|
|
28
|
-
`/organisation/${orgid}/user`
|
|
29
|
-
];
|
|
30
|
-
var useGetOrganisationUsers = (orgid, options) => {
|
|
31
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
32
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUsersQueryKey(orgid)));
|
|
33
|
-
const queryFn = () => getOrganisationUsers(orgid, requestOptions);
|
|
34
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!orgid }, queryOptions));
|
|
35
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
36
|
-
queryKey
|
|
37
|
-
}, query);
|
|
38
|
-
};
|
|
39
|
-
var addOrganisationUser = (orgid, userid, options) => {
|
|
40
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/user/${userid}`, method: "put" }, options);
|
|
41
|
-
};
|
|
42
|
-
var useAddOrganisationUser = (options) => {
|
|
43
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
44
|
-
const mutationFn = (props) => {
|
|
45
|
-
const { orgid, userid } = props || {};
|
|
46
|
-
return addOrganisationUser(orgid, userid, requestOptions);
|
|
4
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
5
|
+
var getUser = () => {
|
|
6
|
+
const appApiUserGetAccount = (options) => {
|
|
7
|
+
return _axios2.default.get(`/user/account`, options);
|
|
47
8
|
};
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
var deleteOrganisationUser = (orgid, userid, options) => {
|
|
51
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/user/${userid}`, method: "delete" }, options);
|
|
52
|
-
};
|
|
53
|
-
var useDeleteOrganisationUser = (options) => {
|
|
54
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
55
|
-
const mutationFn = (props) => {
|
|
56
|
-
const { orgid, userid } = props || {};
|
|
57
|
-
return deleteOrganisationUser(orgid, userid, requestOptions);
|
|
9
|
+
const appApiUserOrgGetUsers = (orgId, options) => {
|
|
10
|
+
return _axios2.default.get(`/organisation/${orgId}/user`, options);
|
|
58
11
|
};
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
var getOrganisationUnitUsers = (unitid, options) => {
|
|
62
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/unit/${unitid}/user`, method: "get" }, options);
|
|
63
|
-
};
|
|
64
|
-
var getGetOrganisationUnitUsersQueryKey = (unitid) => [
|
|
65
|
-
`/unit/${unitid}/user`
|
|
66
|
-
];
|
|
67
|
-
var useGetOrganisationUnitUsers = (unitid, options) => {
|
|
68
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
69
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitUsersQueryKey(unitid)));
|
|
70
|
-
const queryFn = () => getOrganisationUnitUsers(unitid, requestOptions);
|
|
71
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!unitid }, queryOptions));
|
|
72
|
-
return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
|
|
73
|
-
queryKey
|
|
74
|
-
}, query);
|
|
75
|
-
};
|
|
76
|
-
var addOrganisationUnitUser = (unitid, userid, options) => {
|
|
77
|
-
return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/unit/${unitid}/user/${userid}`, method: "put" }, options);
|
|
78
|
-
};
|
|
79
|
-
var useAddOrganisationUnitUser = (options) => {
|
|
80
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
81
|
-
const mutationFn = (props) => {
|
|
82
|
-
const { unitid, userid } = props || {};
|
|
83
|
-
return addOrganisationUnitUser(unitid, userid, requestOptions);
|
|
12
|
+
const appApiUserOrgUserPut = (orgId, userId, options) => {
|
|
13
|
+
return _axios2.default.put(`/organisation/${orgId}/user/${userId}`, void 0, options);
|
|
84
14
|
};
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
15
|
+
const appApiUserOrgUserDelete = (orgId, userId, options) => {
|
|
16
|
+
return _axios2.default.delete(`/organisation/${orgId}/user/${userId}`, options);
|
|
17
|
+
};
|
|
18
|
+
const appApiUserGetUnitUsers = (unitId, options) => {
|
|
19
|
+
return _axios2.default.get(`/unit/${unitId}/user`, options);
|
|
20
|
+
};
|
|
21
|
+
const appApiUserUnitUserPut = (unitId, userId, options) => {
|
|
22
|
+
return _axios2.default.put(`/unit/${unitId}/user/${userId}`, void 0, options);
|
|
23
|
+
};
|
|
24
|
+
const appApiUserUnitUserDelete = (unitId, userId, options) => {
|
|
25
|
+
return _axios2.default.delete(`/unit/${unitId}/user/${userId}`, options);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
appApiUserGetAccount,
|
|
29
|
+
appApiUserOrgGetUsers,
|
|
30
|
+
appApiUserOrgUserPut,
|
|
31
|
+
appApiUserOrgUserDelete,
|
|
32
|
+
appApiUserGetUnitUsers,
|
|
33
|
+
appApiUserUnitUserPut,
|
|
34
|
+
appApiUserUnitUserDelete
|
|
95
35
|
};
|
|
96
|
-
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
97
36
|
};
|
|
98
37
|
|
|
99
38
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
exports.addOrganisationUnitUser = addOrganisationUnitUser; exports.addOrganisationUser = addOrganisationUser; exports.deleteOrganisationUnitUser = deleteOrganisationUnitUser; exports.deleteOrganisationUser = deleteOrganisationUser; exports.getGetOrganisationUnitUsersQueryKey = getGetOrganisationUnitUsersQueryKey; exports.getGetOrganisationUsersQueryKey = getGetOrganisationUsersQueryKey; exports.getGetUserAccountQueryKey = getGetUserAccountQueryKey; exports.getOrganisationUnitUsers = getOrganisationUnitUsers; exports.getOrganisationUsers = getOrganisationUsers; exports.getUserAccount = getUserAccount; exports.useAddOrganisationUnitUser = useAddOrganisationUnitUser; exports.useAddOrganisationUser = useAddOrganisationUser; exports.useDeleteOrganisationUnitUser = useDeleteOrganisationUnitUser; exports.useDeleteOrganisationUser = useDeleteOrganisationUser; exports.useGetOrganisationUnitUsers = useGetOrganisationUnitUsers; exports.useGetOrganisationUsers = useGetOrganisationUsers; exports.useGetUserAccount = useGetUserAccount;
|
|
39
|
+
exports.getUser = getUser;
|
|
117
40
|
//# sourceMappingURL=user.cjs.map
|
package/user/user.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/user/user.ts"],"names":[],"mappings":"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","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 UserAccountGetResponse,\n AsError,\n UsersGetResponse,\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 * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport const useGetUserAccount = <\n TData = AsyncReturnType<typeof getUserAccount>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getUserAccount>,\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 ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>\n getUserAccount(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUserAccount>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgid: string) => [\n `/organisation/${orgid}/user`,\n];\n\nexport const useGetOrganisationUsers = <\n TData = AsyncReturnType<typeof getOrganisationUsers>,\n TError = ErrorType<AsError | void>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUsers>,\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 ?? getGetOrganisationUsersQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUsers>\n > = () => getOrganisationUsers(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgid}/user/${userid}`, method: \"put\" },\n options\n );\n};\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return addOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgid}/user/${userid}`, method: \"delete\" },\n options\n );\n};\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return deleteOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitid: string) => [\n `/unit/${unitid}/user`,\n];\n\nexport const useGetOrganisationUnitUsers = <\n TData = AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\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 ?? getGetOrganisationUnitUsersQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n > = () => getOrganisationUnitUsers(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitid}/user/${userid}`, method: \"put\" },\n options\n );\n};\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return addOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitid}/user/${userid}`, method: \"delete\" },\n options\n );\n};\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return deleteOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.ts"],"names":[],"mappings":";;;AAUA;AAMO,IAAM,UAAU,MAAM;AAM3B,QAAM,uBAAuB,CAC3B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,wBAAwB,CAC5B,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,OAAO;AAAA,EACzD;AAMA,QAAM,uBAAuB,CAC3B,OACA,QACA,YACmB;AACnB,WAAO,MAAM,IACX,iBAAiB,cAAc,UAC/B,QACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,OACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACtE;AAMA,QAAM,yBAAyB,CAC7B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,eAAe,OAAO;AAAA,EAClD;AAUA,QAAM,wBAAwB,CAC5B,QACA,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,eAAe,UAAU,QAAW,OAAO;AAAA,EACvE;AAUA,QAAM,2BAA2B,CAC/B,QACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,SAAS,eAAe,UAAU,OAAO;AAAA,EAC/D;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 UserAccountGetResponse,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getUser = () => {\n /**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\n const appApiUserGetAccount = <TData = AxiosResponse<UserAccountGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/user/account`, options);\n };\n /**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\n const appApiUserOrgGetUsers = <TData = AxiosResponse<UsersGetResponse>>(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/user`, options);\n };\n /**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\n const appApiUserOrgUserPut = <TData = AxiosResponse<void>>(\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(\n `/organisation/${orgId}/user/${userId}`,\n undefined,\n options\n );\n };\n /**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\n const appApiUserOrgUserDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}/user/${userId}`, options);\n };\n /**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\n const appApiUserGetUnitUsers = <TData = AxiosResponse<UsersGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/unit/${unitId}/user`, options);\n };\n /**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\n const appApiUserUnitUserPut = <TData = AxiosResponse<void>>(\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(`/unit/${unitId}/user/${userId}`, undefined, options);\n };\n /**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\n const appApiUserUnitUserDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/unit/${unitId}/user/${userId}`, options);\n };\n return {\n appApiUserGetAccount,\n appApiUserOrgGetUsers,\n appApiUserOrgUserPut,\n appApiUserOrgUserDelete,\n appApiUserGetUnitUsers,\n appApiUserUnitUserPut,\n appApiUserUnitUserDelete,\n };\n};\nexport type AppApiUserGetAccountResult = AxiosResponse<UserAccountGetResponse>;\nexport type AppApiUserOrgGetUsersResult = AxiosResponse<UsersGetResponse>;\nexport type AppApiUserOrgUserPutResult = AxiosResponse<void>;\nexport type AppApiUserOrgUserDeleteResult = AxiosResponse<void>;\nexport type AppApiUserGetUnitUsersResult = AxiosResponse<UsersGetResponse>;\nexport type AppApiUserUnitUserPutResult = AxiosResponse<void>;\nexport type AppApiUserUnitUserDeleteResult = AxiosResponse<void>;\n"]}
|
package/user/user.d.ts
CHANGED
|
@@ -1,119 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare const getUserAccount: (options?: SecondParameter<typeof customInstance>) => Promise<UserAccountDetail>;
|
|
13
|
-
declare const getGetUserAccountQueryKey: () => string[];
|
|
14
|
-
declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<void | AsError>>(options?: {
|
|
15
|
-
query?: UseQueryOptions<UserAccountDetail, TError, TData, QueryKey> | undefined;
|
|
16
|
-
request?: SecondParameter<typeof customInstance>;
|
|
17
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
18
|
-
queryKey: QueryKey;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint
|
|
22
|
-
|
|
23
|
-
* @summary Gets users in an organisation
|
|
24
|
-
*/
|
|
25
|
-
declare const getOrganisationUsers: (orgid: string, options?: SecondParameter<typeof customInstance>) => Promise<UsersGetResponse>;
|
|
26
|
-
declare const getGetOrganisationUsersQueryKey: (orgid: string) => string[];
|
|
27
|
-
declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(orgid: string, options?: {
|
|
28
|
-
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
29
|
-
request?: SecondParameter<typeof customInstance>;
|
|
30
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
31
|
-
queryKey: QueryKey;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint
|
|
35
|
-
|
|
36
|
-
* @summary Adds a user to an organisation
|
|
37
|
-
*/
|
|
38
|
-
declare const addOrganisationUser: (orgid: string, userid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
39
|
-
declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
40
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
41
|
-
orgid: string;
|
|
42
|
-
userid: string;
|
|
43
|
-
}, TContext> | undefined;
|
|
44
|
-
request?: SecondParameter<typeof customInstance>;
|
|
45
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
46
|
-
orgid: string;
|
|
47
|
-
userid: string;
|
|
48
|
-
}, TContext>;
|
|
49
|
-
/**
|
|
50
|
-
* Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint
|
|
51
|
-
|
|
52
|
-
* @summary Deletes a user from an organisation
|
|
53
|
-
*/
|
|
54
|
-
declare const deleteOrganisationUser: (orgid: string, userid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
55
|
-
declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
56
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
57
|
-
orgid: string;
|
|
58
|
-
userid: string;
|
|
59
|
-
}, TContext> | undefined;
|
|
60
|
-
request?: SecondParameter<typeof customInstance>;
|
|
61
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
62
|
-
orgid: string;
|
|
63
|
-
userid: string;
|
|
64
|
-
}, TContext>;
|
|
65
|
-
/**
|
|
66
|
-
* Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
67
|
-
|
|
68
|
-
* @summary Gets users in an Organisational Unit
|
|
69
|
-
*/
|
|
70
|
-
declare const getOrganisationUnitUsers: (unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<UsersGetResponse>;
|
|
71
|
-
declare const getGetOrganisationUnitUsersQueryKey: (unitid: string) => string[];
|
|
72
|
-
declare const useGetOrganisationUnitUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitid: string, options?: {
|
|
73
|
-
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
74
|
-
request?: SecondParameter<typeof customInstance>;
|
|
75
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
76
|
-
queryKey: QueryKey;
|
|
1
|
+
import { e as UserAccountDetail, K as UsersGetResponse, w as UserAccountGetResponse } from '../account-server-api.schemas-078442c3.js';
|
|
2
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
3
|
+
|
|
4
|
+
declare const getUser: () => {
|
|
5
|
+
appApiUserGetAccount: <TData = AxiosResponse<UserAccountDetail, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData>;
|
|
6
|
+
appApiUserOrgGetUsers: <TData_1 = AxiosResponse<UsersGetResponse, any>>(orgId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_1>;
|
|
7
|
+
appApiUserOrgUserPut: <TData_2 = AxiosResponse<void, any>>(orgId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_2>;
|
|
8
|
+
appApiUserOrgUserDelete: <TData_3 = AxiosResponse<void, any>>(orgId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_3>;
|
|
9
|
+
appApiUserGetUnitUsers: <TData_4 = AxiosResponse<UsersGetResponse, any>>(unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_4>;
|
|
10
|
+
appApiUserUnitUserPut: <TData_5 = AxiosResponse<void, any>>(unitId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_5>;
|
|
11
|
+
appApiUserUnitUserDelete: <TData_6 = AxiosResponse<void, any>>(unitId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_6>;
|
|
77
12
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
declare const addOrganisationUnitUser: (unitid: string, userid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
88
|
-
declare const useAddOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
89
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
90
|
-
unitid: string;
|
|
91
|
-
userid: string;
|
|
92
|
-
}, TContext> | undefined;
|
|
93
|
-
request?: SecondParameter<typeof customInstance>;
|
|
94
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
95
|
-
unitid: string;
|
|
96
|
-
userid: string;
|
|
97
|
-
}, TContext>;
|
|
98
|
-
/**
|
|
99
|
-
* Removes a user from an Organisational Unit.
|
|
100
|
-
|
|
101
|
-
Users cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).
|
|
102
|
-
|
|
103
|
-
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
104
|
-
|
|
105
|
-
* @summary Deletes a user from an Organisational Unit
|
|
106
|
-
*/
|
|
107
|
-
declare const deleteOrganisationUnitUser: (unitid: string, userid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
108
|
-
declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
109
|
-
mutation?: UseMutationOptions<void, TError, {
|
|
110
|
-
unitid: string;
|
|
111
|
-
userid: string;
|
|
112
|
-
}, TContext> | undefined;
|
|
113
|
-
request?: SecondParameter<typeof customInstance>;
|
|
114
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
115
|
-
unitid: string;
|
|
116
|
-
userid: string;
|
|
117
|
-
}, TContext>;
|
|
118
|
-
|
|
119
|
-
export { addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUsersQueryKey, getGetUserAccountQueryKey, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUser, useDeleteOrganisationUnitUser, useDeleteOrganisationUser, useGetOrganisationUnitUsers, useGetOrganisationUsers, useGetUserAccount };
|
|
13
|
+
declare type AppApiUserGetAccountResult = AxiosResponse<UserAccountGetResponse>;
|
|
14
|
+
declare type AppApiUserOrgGetUsersResult = AxiosResponse<UsersGetResponse>;
|
|
15
|
+
declare type AppApiUserOrgUserPutResult = AxiosResponse<void>;
|
|
16
|
+
declare type AppApiUserOrgUserDeleteResult = AxiosResponse<void>;
|
|
17
|
+
declare type AppApiUserGetUnitUsersResult = AxiosResponse<UsersGetResponse>;
|
|
18
|
+
declare type AppApiUserUnitUserPutResult = AxiosResponse<void>;
|
|
19
|
+
declare type AppApiUserUnitUserDeleteResult = AxiosResponse<void>;
|
|
20
|
+
|
|
21
|
+
export { AppApiUserGetAccountResult, AppApiUserGetUnitUsersResult, AppApiUserOrgGetUsersResult, AppApiUserOrgUserDeleteResult, AppApiUserOrgUserPutResult, AppApiUserUnitUserDeleteResult, AppApiUserUnitUserPutResult, getUser };
|
package/user/user.js
CHANGED
|
@@ -1,117 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
__spreadValues,
|
|
3
|
-
customInstance
|
|
4
|
-
} from "../chunk-JR7F532L.js";
|
|
1
|
+
import "../chunk-GWBPVOL2.js";
|
|
5
2
|
|
|
6
3
|
// src/user/user.ts
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getUserAccount = (options) => {
|
|
12
|
-
return customInstance({ url: `/user/account`, method: "get" }, options);
|
|
13
|
-
};
|
|
14
|
-
var getGetUserAccountQueryKey = () => [`/user/account`];
|
|
15
|
-
var useGetUserAccount = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
|
|
18
|
-
const queryFn = () => getUserAccount(requestOptions);
|
|
19
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
|
-
return __spreadValues({
|
|
21
|
-
queryKey
|
|
22
|
-
}, query);
|
|
23
|
-
};
|
|
24
|
-
var getOrganisationUsers = (orgid, options) => {
|
|
25
|
-
return customInstance({ url: `/organisation/${orgid}/user`, method: "get" }, options);
|
|
26
|
-
};
|
|
27
|
-
var getGetOrganisationUsersQueryKey = (orgid) => [
|
|
28
|
-
`/organisation/${orgid}/user`
|
|
29
|
-
];
|
|
30
|
-
var useGetOrganisationUsers = (orgid, options) => {
|
|
31
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
32
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgid);
|
|
33
|
-
const queryFn = () => getOrganisationUsers(orgid, requestOptions);
|
|
34
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgid }, queryOptions));
|
|
35
|
-
return __spreadValues({
|
|
36
|
-
queryKey
|
|
37
|
-
}, query);
|
|
38
|
-
};
|
|
39
|
-
var addOrganisationUser = (orgid, userid, options) => {
|
|
40
|
-
return customInstance({ url: `/organisation/${orgid}/user/${userid}`, method: "put" }, options);
|
|
41
|
-
};
|
|
42
|
-
var useAddOrganisationUser = (options) => {
|
|
43
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
44
|
-
const mutationFn = (props) => {
|
|
45
|
-
const { orgid, userid } = props || {};
|
|
46
|
-
return addOrganisationUser(orgid, userid, requestOptions);
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
var getUser = () => {
|
|
6
|
+
const appApiUserGetAccount = (options) => {
|
|
7
|
+
return axios.get(`/user/account`, options);
|
|
47
8
|
};
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
var deleteOrganisationUser = (orgid, userid, options) => {
|
|
51
|
-
return customInstance({ url: `/organisation/${orgid}/user/${userid}`, method: "delete" }, options);
|
|
52
|
-
};
|
|
53
|
-
var useDeleteOrganisationUser = (options) => {
|
|
54
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
55
|
-
const mutationFn = (props) => {
|
|
56
|
-
const { orgid, userid } = props || {};
|
|
57
|
-
return deleteOrganisationUser(orgid, userid, requestOptions);
|
|
9
|
+
const appApiUserOrgGetUsers = (orgId, options) => {
|
|
10
|
+
return axios.get(`/organisation/${orgId}/user`, options);
|
|
58
11
|
};
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
var getOrganisationUnitUsers = (unitid, options) => {
|
|
62
|
-
return customInstance({ url: `/unit/${unitid}/user`, method: "get" }, options);
|
|
63
|
-
};
|
|
64
|
-
var getGetOrganisationUnitUsersQueryKey = (unitid) => [
|
|
65
|
-
`/unit/${unitid}/user`
|
|
66
|
-
];
|
|
67
|
-
var useGetOrganisationUnitUsers = (unitid, options) => {
|
|
68
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
69
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitid);
|
|
70
|
-
const queryFn = () => getOrganisationUnitUsers(unitid, requestOptions);
|
|
71
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitid }, queryOptions));
|
|
72
|
-
return __spreadValues({
|
|
73
|
-
queryKey
|
|
74
|
-
}, query);
|
|
75
|
-
};
|
|
76
|
-
var addOrganisationUnitUser = (unitid, userid, options) => {
|
|
77
|
-
return customInstance({ url: `/unit/${unitid}/user/${userid}`, method: "put" }, options);
|
|
78
|
-
};
|
|
79
|
-
var useAddOrganisationUnitUser = (options) => {
|
|
80
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
81
|
-
const mutationFn = (props) => {
|
|
82
|
-
const { unitid, userid } = props || {};
|
|
83
|
-
return addOrganisationUnitUser(unitid, userid, requestOptions);
|
|
12
|
+
const appApiUserOrgUserPut = (orgId, userId, options) => {
|
|
13
|
+
return axios.put(`/organisation/${orgId}/user/${userId}`, void 0, options);
|
|
84
14
|
};
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
15
|
+
const appApiUserOrgUserDelete = (orgId, userId, options) => {
|
|
16
|
+
return axios.delete(`/organisation/${orgId}/user/${userId}`, options);
|
|
17
|
+
};
|
|
18
|
+
const appApiUserGetUnitUsers = (unitId, options) => {
|
|
19
|
+
return axios.get(`/unit/${unitId}/user`, options);
|
|
20
|
+
};
|
|
21
|
+
const appApiUserUnitUserPut = (unitId, userId, options) => {
|
|
22
|
+
return axios.put(`/unit/${unitId}/user/${userId}`, void 0, options);
|
|
23
|
+
};
|
|
24
|
+
const appApiUserUnitUserDelete = (unitId, userId, options) => {
|
|
25
|
+
return axios.delete(`/unit/${unitId}/user/${userId}`, options);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
appApiUserGetAccount,
|
|
29
|
+
appApiUserOrgGetUsers,
|
|
30
|
+
appApiUserOrgUserPut,
|
|
31
|
+
appApiUserOrgUserDelete,
|
|
32
|
+
appApiUserGetUnitUsers,
|
|
33
|
+
appApiUserUnitUserPut,
|
|
34
|
+
appApiUserUnitUserDelete
|
|
95
35
|
};
|
|
96
|
-
return useMutation(mutationFn, mutationOptions);
|
|
97
36
|
};
|
|
98
37
|
export {
|
|
99
|
-
|
|
100
|
-
addOrganisationUser,
|
|
101
|
-
deleteOrganisationUnitUser,
|
|
102
|
-
deleteOrganisationUser,
|
|
103
|
-
getGetOrganisationUnitUsersQueryKey,
|
|
104
|
-
getGetOrganisationUsersQueryKey,
|
|
105
|
-
getGetUserAccountQueryKey,
|
|
106
|
-
getOrganisationUnitUsers,
|
|
107
|
-
getOrganisationUsers,
|
|
108
|
-
getUserAccount,
|
|
109
|
-
useAddOrganisationUnitUser,
|
|
110
|
-
useAddOrganisationUser,
|
|
111
|
-
useDeleteOrganisationUnitUser,
|
|
112
|
-
useDeleteOrganisationUser,
|
|
113
|
-
useGetOrganisationUnitUsers,
|
|
114
|
-
useGetOrganisationUsers,
|
|
115
|
-
useGetUserAccount
|
|
38
|
+
getUser
|
|
116
39
|
};
|
|
117
40
|
//# sourceMappingURL=user.js.map
|
package/user/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\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 * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport const useGetUserAccount = <\n TData = AsyncReturnType<typeof getUserAccount>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getUserAccount>,\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 ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>\n getUserAccount(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUserAccount>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgid: string) => [\n `/organisation/${orgid}/user`,\n];\n\nexport const useGetOrganisationUsers = <\n TData = AsyncReturnType<typeof getOrganisationUsers>,\n TError = ErrorType<AsError | void>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUsers>,\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 ?? getGetOrganisationUsersQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUsers>\n > = () => getOrganisationUsers(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgid}/user/${userid}`, method: \"put\" },\n options\n );\n};\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return addOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgid}/user/${userid}`, method: \"delete\" },\n options\n );\n};\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return deleteOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitid: string) => [\n `/unit/${unitid}/user`,\n];\n\nexport const useGetOrganisationUnitUsers = <\n TData = AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\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 ?? getGetOrganisationUnitUsersQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n > = () => getOrganisationUnitUsers(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitid}/user/${userid}`, method: \"put\" },\n options\n );\n};\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return addOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitid: string,\n userid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitid}/user/${userid}`, method: \"delete\" },\n options\n );\n};\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return deleteOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.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 UserAccountGetResponse,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getUser = () => {\n /**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\n const appApiUserGetAccount = <TData = AxiosResponse<UserAccountGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/user/account`, options);\n };\n /**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\n const appApiUserOrgGetUsers = <TData = AxiosResponse<UsersGetResponse>>(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/user`, options);\n };\n /**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\n const appApiUserOrgUserPut = <TData = AxiosResponse<void>>(\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(\n `/organisation/${orgId}/user/${userId}`,\n undefined,\n options\n );\n };\n /**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\n const appApiUserOrgUserDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}/user/${userId}`, options);\n };\n /**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\n const appApiUserGetUnitUsers = <TData = AxiosResponse<UsersGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/unit/${unitId}/user`, options);\n };\n /**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\n const appApiUserUnitUserPut = <TData = AxiosResponse<void>>(\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(`/unit/${unitId}/user/${userId}`, undefined, options);\n };\n /**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\n const appApiUserUnitUserDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/unit/${unitId}/user/${userId}`, options);\n };\n return {\n appApiUserGetAccount,\n appApiUserOrgGetUsers,\n appApiUserOrgUserPut,\n appApiUserOrgUserDelete,\n appApiUserGetUnitUsers,\n appApiUserUnitUserPut,\n appApiUserUnitUserDelete,\n };\n};\nexport type AppApiUserGetAccountResult = AxiosResponse<UserAccountGetResponse>;\nexport type AppApiUserOrgGetUsersResult = AxiosResponse<UsersGetResponse>;\nexport type AppApiUserOrgUserPutResult = AxiosResponse<void>;\nexport type AppApiUserOrgUserDeleteResult = AxiosResponse<void>;\nexport type AppApiUserGetUnitUsersResult = AxiosResponse<UsersGetResponse>;\nexport type AppApiUserUnitUserPutResult = AxiosResponse<void>;\nexport type AppApiUserUnitUserDeleteResult = AxiosResponse<void>;\n"],"mappings":";;;AAUA;AAMO,IAAM,UAAU,MAAM;AAM3B,QAAM,uBAAuB,CAC3B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,wBAAwB,CAC5B,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,OAAO;AAAA,EACzD;AAMA,QAAM,uBAAuB,CAC3B,OACA,QACA,YACmB;AACnB,WAAO,MAAM,IACX,iBAAiB,cAAc,UAC/B,QACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,OACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACtE;AAMA,QAAM,yBAAyB,CAC7B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,eAAe,OAAO;AAAA,EAClD;AAUA,QAAM,wBAAwB,CAC5B,QACA,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,eAAe,UAAU,QAAW,OAAO;AAAA,EACvE;AAUA,QAAM,2BAA2B,CAC/B,QACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,SAAS,eAAe,UAAU,OAAO;AAAA,EAC/D;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/chunk-3DXYUDZH.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
|
-
// src/custom-instance.ts
|
|
22
|
-
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
23
|
-
var AXIOS_INSTANCE = _axios2.default.create();
|
|
24
|
-
var setAuthToken = (token) => {
|
|
25
|
-
AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
26
|
-
};
|
|
27
|
-
var setBaseUrl = (baseUrl) => {
|
|
28
|
-
AXIOS_INSTANCE.defaults.baseURL = baseUrl;
|
|
29
|
-
};
|
|
30
|
-
var customInstance = (config, options) => {
|
|
31
|
-
const source = _axios2.default.CancelToken.source();
|
|
32
|
-
const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
|
|
33
|
-
promise.cancel = () => {
|
|
34
|
-
source.cancel("Query was cancelled by React Query");
|
|
35
|
-
};
|
|
36
|
-
return promise;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.__spreadValues = __spreadValues; exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
46
|
-
//# sourceMappingURL=chunk-3DXYUDZH.cjs.map
|
package/chunk-3DXYUDZH.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM;AAO7B,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|
package/chunk-JR7F532L.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM;AAO7B,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;","names":[]}
|