@squonk/account-server-client 0.1.26 → 0.1.28
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/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
- package/chunk-6EEIAH4R.js.map +1 -0
- package/chunk-NGBTCJWS.cjs +46 -0
- package/chunk-NGBTCJWS.cjs.map +1 -0
- package/{account-server-api.schemas-078442c3.d.ts → custom-instance-13412a15.d.ts} +32 -1
- package/index.cjs +5 -21
- package/index.cjs.map +1 -1
- package/index.d.ts +2 -20
- package/index.js +5 -21
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +70 -20
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +68 -18
- package/organisation/organisation.js +70 -20
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +121 -31
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +115 -24
- package/product/product.js +121 -31
- package/product/product.js.map +1 -1
- package/service/service.cjs +38 -11
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +35 -8
- package/service/service.js +38 -11
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +13 -0
- package/src/organisation/organisation.ts +219 -44
- package/src/product/product.ts +375 -84
- package/src/service/service.ts +110 -16
- package/src/state/state.ts +70 -16
- package/src/unit/unit.ts +354 -74
- package/src/user/user.ts +368 -67
- package/state/state.cjs +22 -8
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +18 -6
- package/state/state.js +22 -8
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +110 -30
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +108 -25
- package/unit/unit.js +110 -30
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +107 -30
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +133 -20
- package/user/user.js +107 -30
- package/user/user.js.map +1 -1
- package/chunk-GWBPVOL2.js.map +0 -1
- package/chunk-N3RLW53G.cjs +0 -25
- package/chunk-N3RLW53G.cjs.map +0 -1
package/unit/unit.cjs
CHANGED
|
@@ -1,40 +1,120 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
2
5
|
|
|
3
6
|
// src/unit/unit.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _reactquery = require('react-query');
|
|
11
|
+
var getOrganisationUnits = (orgId, options) => {
|
|
12
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit`, method: "get" }, options);
|
|
13
|
+
};
|
|
14
|
+
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
15
|
+
`/organisation/${orgId}/unit`
|
|
16
|
+
];
|
|
17
|
+
var useGetOrganisationUnits = (orgId, options) => {
|
|
18
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
19
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
|
|
20
|
+
const queryFn = () => getOrganisationUnits(orgId, requestOptions);
|
|
21
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
|
|
22
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
23
|
+
queryKey
|
|
24
|
+
}, query);
|
|
25
|
+
};
|
|
26
|
+
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
27
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, {
|
|
28
|
+
url: `/organisation/${orgId}/unit`,
|
|
29
|
+
method: "post",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
data: organisationUnitPostBodyBody
|
|
32
|
+
}, options);
|
|
33
|
+
};
|
|
34
|
+
var useCreateOrganisationUnit = (options) => {
|
|
35
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
36
|
+
const mutationFn = (props) => {
|
|
37
|
+
const { orgId, data } = props || {};
|
|
38
|
+
return createOrganisationUnit(orgId, data, requestOptions);
|
|
20
39
|
};
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
41
|
+
};
|
|
42
|
+
var getUnit = (orgId, unitId, options) => {
|
|
43
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit/${unitId}`, method: "get" }, options);
|
|
44
|
+
};
|
|
45
|
+
var getGetUnitQueryKey = (orgId, unitId) => [
|
|
46
|
+
`/organisation/${orgId}/unit/${unitId}`
|
|
47
|
+
];
|
|
48
|
+
var useGetUnit = (orgId, unitId, options) => {
|
|
49
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
50
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitQueryKey(orgId, unitId)));
|
|
51
|
+
const queryFn = () => getUnit(orgId, unitId, requestOptions);
|
|
52
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!(orgId && unitId) }, queryOptions));
|
|
53
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
54
|
+
queryKey
|
|
55
|
+
}, query);
|
|
56
|
+
};
|
|
57
|
+
var deleteOrganisationUnit = (orgId, unitId, options) => {
|
|
58
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit/${unitId}`, method: "delete" }, options);
|
|
59
|
+
};
|
|
60
|
+
var useDeleteOrganisationUnit = (options) => {
|
|
61
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
62
|
+
const mutationFn = (props) => {
|
|
63
|
+
const { orgId, unitId } = props || {};
|
|
64
|
+
return deleteOrganisationUnit(orgId, unitId, requestOptions);
|
|
23
65
|
};
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
67
|
+
};
|
|
68
|
+
var getUnits = (options) => {
|
|
69
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "get" }, options);
|
|
70
|
+
};
|
|
71
|
+
var getGetUnitsQueryKey = () => [`/unit`];
|
|
72
|
+
var useGetUnits = (options) => {
|
|
73
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
74
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitsQueryKey()));
|
|
75
|
+
const queryFn = () => getUnits(requestOptions);
|
|
76
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
77
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
78
|
+
queryKey
|
|
79
|
+
}, query);
|
|
80
|
+
};
|
|
81
|
+
var createDefaultUnit = (options) => {
|
|
82
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "put" }, options);
|
|
83
|
+
};
|
|
84
|
+
var useCreateDefaultUnit = (options) => {
|
|
85
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
86
|
+
const mutationFn = () => {
|
|
87
|
+
return createDefaultUnit(requestOptions);
|
|
26
88
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
89
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
90
|
+
};
|
|
91
|
+
var deleteDefaultUnit = (options) => {
|
|
92
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
|
|
93
|
+
};
|
|
94
|
+
var useDeleteDefaultUnit = (options) => {
|
|
95
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
96
|
+
const mutationFn = () => {
|
|
97
|
+
return deleteDefaultUnit(requestOptions);
|
|
35
98
|
};
|
|
99
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
36
100
|
};
|
|
37
101
|
|
|
38
102
|
|
|
39
|
-
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
exports.createDefaultUnit = createDefaultUnit; exports.createOrganisationUnit = createOrganisationUnit; exports.deleteDefaultUnit = deleteDefaultUnit; exports.deleteOrganisationUnit = deleteOrganisationUnit; exports.getGetOrganisationUnitsQueryKey = getGetOrganisationUnitsQueryKey; exports.getGetUnitQueryKey = getGetUnitQueryKey; exports.getGetUnitsQueryKey = getGetUnitsQueryKey; exports.getOrganisationUnits = getOrganisationUnits; exports.getUnit = getUnit; exports.getUnits = getUnits; exports.useCreateDefaultUnit = useCreateDefaultUnit; exports.useCreateOrganisationUnit = useCreateOrganisationUnit; exports.useDeleteDefaultUnit = useDeleteDefaultUnit; exports.useDeleteOrganisationUnit = useDeleteOrganisationUnit; exports.useGetOrganisationUnits = useGetOrganisationUnits; exports.useGetUnit = useGetUnit; exports.useGetUnits = useGetUnits;
|
|
40
120
|
//# sourceMappingURL=unit.cjs.map
|
package/unit/unit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;AAUA;AAUO,IAAM,UAAU,MAAM;AAM3B,QAAM,wBAAwB,CAG5B,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,OAAO;AAAA,EACzD;AAMA,QAAM,iBAAiB,CACrB,OACA,8BACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,cACjB,8BACA,OACF;AAAA,EACF;AAMA,QAAM,oBAAoB,CACxB,OACA,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACnE;AAMA,QAAM,mBAAmB,CACvB,OACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACtE;AAMA,QAAM,gBAAgB,CACpB,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,OAAO;AAAA,EACnC;AAMA,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,QAAW,OAAO;AAAA,EAC9C;AAMA,QAAM,2BAA2B,CAC/B,YACmB;AACnB,WAAO,MAAM,OAAO,SAAS,OAAO;AAAA,EACtC;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 OrganisationUnitsGetResponse,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getUnit = () => {\n /**\n * Gets Organisational Units you have access to\n\n * @summary Gets Organisational Units\n */\n const appApiUnitGetOrgUnits = <\n TData = AxiosResponse<OrganisationUnitsGetResponse>\n >(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/unit`, options);\n };\n /**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\n const appApiUnitPost = <TData = AxiosResponse<OrganisationUnitPostResponse>>(\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/organisation/${orgId}/unit`,\n organisationUnitPostBodyBody,\n options\n );\n };\n /**\n * Gets the Unit, assuming you are a member of it. Admin users can see all Units\n\n * @summary Gets a Unit\n */\n const appApiUnitGetUnit = <TData = AxiosResponse<UnitGetResponse>>(\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/unit/${unitId}`, options);\n };\n /**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\n const appApiUnitDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}/unit/${unitId}`, options);\n };\n /**\n * Gets all the Units you are a member of. Admin users can see all Units\n\n * @summary Gets Units a User has access to\n */\n const appApiUnitGet = <TData = AxiosResponse<UnitsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/unit`, options);\n };\n /**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\n const appApiUnitPersonalPut = <\n TData = AxiosResponse<PersonalUnitPutResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(`/unit`, undefined, options);\n };\n /**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\n const appApiUnitPersonalDelete = <TData = AxiosResponse<void>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/unit`, options);\n };\n return {\n appApiUnitGetOrgUnits,\n appApiUnitPost,\n appApiUnitGetUnit,\n appApiUnitDelete,\n appApiUnitGet,\n appApiUnitPersonalPut,\n appApiUnitPersonalDelete,\n };\n};\nexport type AppApiUnitGetOrgUnitsResult =\n AxiosResponse<OrganisationUnitsGetResponse>;\nexport type AppApiUnitPostResult = AxiosResponse<OrganisationUnitPostResponse>;\nexport type AppApiUnitGetUnitResult = AxiosResponse<UnitGetResponse>;\nexport type AppApiUnitDeleteResult = AxiosResponse<void>;\nexport type AppApiUnitGetResult = AxiosResponse<UnitsGetResponse>;\nexport type AppApiUnitPersonalPutResult =\n AxiosResponse<PersonalUnitPutResponse>;\nexport type AppApiUnitPersonalDeleteResult = AxiosResponse<void>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":"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","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 {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\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 Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnits>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\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 ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisationUnit>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props || {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = AsyncReturnType<typeof getUnit>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>\n getUnit(orgId, unitId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUnit>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: 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 deleteOrganisationUnit>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props || {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, 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 ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createDefaultUnit>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteDefaultUnit>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,32 +1,115 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as react_query from 'react-query';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
+
import { V as customInstance, F as OrganisationUnitsGetResponse, W as ErrorType, N as AsError, O as OrganisationUnitPostBodyBody, I as OrganisationUnitPostResponse, x as UnitGetResponse, G as UnitsGetResponse, H as PersonalUnitPutResponse } from '../custom-instance-13412a15.js';
|
|
4
|
+
import 'axios';
|
|
3
5
|
|
|
6
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
7
|
+
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
4
8
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Do not edit manually.
|
|
7
|
-
* Account Server API
|
|
8
|
-
* The Informatics Matters Account Server API.
|
|
9
|
+
* Gets Organisational Units you have access to or that are public
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
* @summary Gets Organisational Units
|
|
12
|
+
*/
|
|
13
|
+
declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitsGetResponse>;
|
|
14
|
+
declare const getGetOrganisationUnitsQueryKey: (orgId: string) => string[];
|
|
15
|
+
declare type GetOrganisationUnitsQueryResult = NonNullable<AsyncReturnType<typeof getOrganisationUnits>>;
|
|
16
|
+
declare type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
17
|
+
declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
18
|
+
query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
19
|
+
request?: SecondParameter<typeof customInstance>;
|
|
20
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
21
|
+
queryKey: QueryKey;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint
|
|
11
25
|
|
|
12
|
-
*
|
|
26
|
+
* @summary Create a new Organisational Unit
|
|
13
27
|
*/
|
|
28
|
+
declare const createOrganisationUnit: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
|
|
29
|
+
declare type CreateOrganisationUnitMutationResult = NonNullable<AsyncReturnType<typeof createOrganisationUnit>>;
|
|
30
|
+
declare type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
31
|
+
declare type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
32
|
+
declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
33
|
+
mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
34
|
+
orgId: string;
|
|
35
|
+
data: OrganisationUnitPostBodyBody;
|
|
36
|
+
}, TContext> | undefined;
|
|
37
|
+
request?: SecondParameter<typeof customInstance>;
|
|
38
|
+
} | undefined) => react_query.UseMutationResult<OrganisationUnitPostResponse, TError, {
|
|
39
|
+
orgId: string;
|
|
40
|
+
data: OrganisationUnitPostBodyBody;
|
|
41
|
+
}, TContext>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units
|
|
14
44
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
45
|
+
* @summary Gets a Unit
|
|
46
|
+
*/
|
|
47
|
+
declare const getUnit: (orgId: string, unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<UnitGetResponse>;
|
|
48
|
+
declare const getGetUnitQueryKey: (orgId: string, unitId: string) => string[];
|
|
49
|
+
declare type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;
|
|
50
|
+
declare type GetUnitQueryError = ErrorType<void | AsError>;
|
|
51
|
+
declare const useGetUnit: <TData = UnitGetResponse, TError = ErrorType<void | AsError>>(orgId: string, unitId: string, options?: {
|
|
52
|
+
query?: UseQueryOptions<UnitGetResponse, TError, TData, QueryKey> | undefined;
|
|
53
|
+
request?: SecondParameter<typeof customInstance>;
|
|
54
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
55
|
+
queryKey: QueryKey;
|
|
23
56
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
declare
|
|
30
|
-
declare type
|
|
31
|
-
|
|
32
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products
|
|
59
|
+
|
|
60
|
+
* @summary Deletes an Organisational Unit
|
|
61
|
+
*/
|
|
62
|
+
declare const deleteOrganisationUnit: (orgId: string, unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
63
|
+
declare type DeleteOrganisationUnitMutationResult = NonNullable<AsyncReturnType<typeof deleteOrganisationUnit>>;
|
|
64
|
+
declare type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
65
|
+
declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
66
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
67
|
+
orgId: string;
|
|
68
|
+
unitId: string;
|
|
69
|
+
}, TContext> | undefined;
|
|
70
|
+
request?: SecondParameter<typeof customInstance>;
|
|
71
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
72
|
+
orgId: string;
|
|
73
|
+
unitId: string;
|
|
74
|
+
}, TContext>;
|
|
75
|
+
/**
|
|
76
|
+
* Gets all the Units that are public or you are a member of. Admin users can see all Units
|
|
77
|
+
|
|
78
|
+
* @summary Gets Units
|
|
79
|
+
*/
|
|
80
|
+
declare const getUnits: (options?: SecondParameter<typeof customInstance>) => Promise<UnitsGetResponse>;
|
|
81
|
+
declare const getGetUnitsQueryKey: () => string[];
|
|
82
|
+
declare type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;
|
|
83
|
+
declare type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
84
|
+
declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
85
|
+
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
86
|
+
request?: SecondParameter<typeof customInstance>;
|
|
87
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
88
|
+
queryKey: QueryKey;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users
|
|
92
|
+
|
|
93
|
+
* @summary Create a new Independent User Unit
|
|
94
|
+
*/
|
|
95
|
+
declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
|
|
96
|
+
declare type CreateDefaultUnitMutationResult = NonNullable<AsyncReturnType<typeof createDefaultUnit>>;
|
|
97
|
+
declare type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
98
|
+
declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
99
|
+
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, TVariables, TContext> | undefined;
|
|
100
|
+
request?: SecondParameter<typeof customInstance>;
|
|
101
|
+
} | undefined) => react_query.UseMutationResult<PersonalUnitPutResponse, TError, TVariables, TContext>;
|
|
102
|
+
/**
|
|
103
|
+
* Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
|
|
104
|
+
|
|
105
|
+
* @summary Deletes an Independent Unit
|
|
106
|
+
*/
|
|
107
|
+
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
108
|
+
declare type DeleteDefaultUnitMutationResult = NonNullable<AsyncReturnType<typeof deleteDefaultUnit>>;
|
|
109
|
+
declare type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
110
|
+
declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
111
|
+
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
112
|
+
request?: SecondParameter<typeof customInstance>;
|
|
113
|
+
} | undefined) => react_query.UseMutationResult<void, TError, TVariables, TContext>;
|
|
114
|
+
|
|
115
|
+
export { CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnits };
|
package/unit/unit.js
CHANGED
|
@@ -1,40 +1,120 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues,
|
|
3
|
+
customInstance
|
|
4
|
+
} from "../chunk-6EEIAH4R.js";
|
|
2
5
|
|
|
3
6
|
// src/unit/unit.ts
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
7
|
+
import {
|
|
8
|
+
useQuery,
|
|
9
|
+
useMutation
|
|
10
|
+
} from "react-query";
|
|
11
|
+
var getOrganisationUnits = (orgId, options) => {
|
|
12
|
+
return customInstance({ url: `/organisation/${orgId}/unit`, method: "get" }, options);
|
|
13
|
+
};
|
|
14
|
+
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
15
|
+
`/organisation/${orgId}/unit`
|
|
16
|
+
];
|
|
17
|
+
var useGetOrganisationUnits = (orgId, options) => {
|
|
18
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
19
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
20
|
+
const queryFn = () => getOrganisationUnits(orgId, requestOptions);
|
|
21
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
|
|
22
|
+
return __spreadValues({
|
|
23
|
+
queryKey
|
|
24
|
+
}, query);
|
|
25
|
+
};
|
|
26
|
+
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
27
|
+
return customInstance({
|
|
28
|
+
url: `/organisation/${orgId}/unit`,
|
|
29
|
+
method: "post",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
data: organisationUnitPostBodyBody
|
|
32
|
+
}, options);
|
|
33
|
+
};
|
|
34
|
+
var useCreateOrganisationUnit = (options) => {
|
|
35
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
36
|
+
const mutationFn = (props) => {
|
|
37
|
+
const { orgId, data } = props || {};
|
|
38
|
+
return createOrganisationUnit(orgId, data, requestOptions);
|
|
20
39
|
};
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
return useMutation(mutationFn, mutationOptions);
|
|
41
|
+
};
|
|
42
|
+
var getUnit = (orgId, unitId, options) => {
|
|
43
|
+
return customInstance({ url: `/organisation/${orgId}/unit/${unitId}`, method: "get" }, options);
|
|
44
|
+
};
|
|
45
|
+
var getGetUnitQueryKey = (orgId, unitId) => [
|
|
46
|
+
`/organisation/${orgId}/unit/${unitId}`
|
|
47
|
+
];
|
|
48
|
+
var useGetUnit = (orgId, unitId, options) => {
|
|
49
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
50
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitQueryKey(orgId, unitId);
|
|
51
|
+
const queryFn = () => getUnit(orgId, unitId, requestOptions);
|
|
52
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(orgId && unitId) }, queryOptions));
|
|
53
|
+
return __spreadValues({
|
|
54
|
+
queryKey
|
|
55
|
+
}, query);
|
|
56
|
+
};
|
|
57
|
+
var deleteOrganisationUnit = (orgId, unitId, options) => {
|
|
58
|
+
return customInstance({ url: `/organisation/${orgId}/unit/${unitId}`, method: "delete" }, options);
|
|
59
|
+
};
|
|
60
|
+
var useDeleteOrganisationUnit = (options) => {
|
|
61
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
62
|
+
const mutationFn = (props) => {
|
|
63
|
+
const { orgId, unitId } = props || {};
|
|
64
|
+
return deleteOrganisationUnit(orgId, unitId, requestOptions);
|
|
23
65
|
};
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
return useMutation(mutationFn, mutationOptions);
|
|
67
|
+
};
|
|
68
|
+
var getUnits = (options) => {
|
|
69
|
+
return customInstance({ url: `/unit`, method: "get" }, options);
|
|
70
|
+
};
|
|
71
|
+
var getGetUnitsQueryKey = () => [`/unit`];
|
|
72
|
+
var useGetUnits = (options) => {
|
|
73
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
74
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitsQueryKey();
|
|
75
|
+
const queryFn = () => getUnits(requestOptions);
|
|
76
|
+
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
77
|
+
return __spreadValues({
|
|
78
|
+
queryKey
|
|
79
|
+
}, query);
|
|
80
|
+
};
|
|
81
|
+
var createDefaultUnit = (options) => {
|
|
82
|
+
return customInstance({ url: `/unit`, method: "put" }, options);
|
|
83
|
+
};
|
|
84
|
+
var useCreateDefaultUnit = (options) => {
|
|
85
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
86
|
+
const mutationFn = () => {
|
|
87
|
+
return createDefaultUnit(requestOptions);
|
|
26
88
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
89
|
+
return useMutation(mutationFn, mutationOptions);
|
|
90
|
+
};
|
|
91
|
+
var deleteDefaultUnit = (options) => {
|
|
92
|
+
return customInstance({ url: `/unit`, method: "delete" }, options);
|
|
93
|
+
};
|
|
94
|
+
var useDeleteDefaultUnit = (options) => {
|
|
95
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
96
|
+
const mutationFn = () => {
|
|
97
|
+
return deleteDefaultUnit(requestOptions);
|
|
35
98
|
};
|
|
99
|
+
return useMutation(mutationFn, mutationOptions);
|
|
36
100
|
};
|
|
37
101
|
export {
|
|
38
|
-
|
|
102
|
+
createDefaultUnit,
|
|
103
|
+
createOrganisationUnit,
|
|
104
|
+
deleteDefaultUnit,
|
|
105
|
+
deleteOrganisationUnit,
|
|
106
|
+
getGetOrganisationUnitsQueryKey,
|
|
107
|
+
getGetUnitQueryKey,
|
|
108
|
+
getGetUnitsQueryKey,
|
|
109
|
+
getOrganisationUnits,
|
|
110
|
+
getUnit,
|
|
111
|
+
getUnits,
|
|
112
|
+
useCreateDefaultUnit,
|
|
113
|
+
useCreateOrganisationUnit,
|
|
114
|
+
useDeleteDefaultUnit,
|
|
115
|
+
useDeleteOrganisationUnit,
|
|
116
|
+
useGetOrganisationUnits,
|
|
117
|
+
useGetUnit,
|
|
118
|
+
useGetUnits
|
|
39
119
|
};
|
|
40
120
|
//# sourceMappingURL=unit.js.map
|
package/unit/unit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.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 OrganisationUnitsGetResponse,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getUnit = () => {\n /**\n * Gets Organisational Units you have access to\n\n * @summary Gets Organisational Units\n */\n const appApiUnitGetOrgUnits = <\n TData = AxiosResponse<OrganisationUnitsGetResponse>\n >(\n orgId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/unit`, options);\n };\n /**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\n const appApiUnitPost = <TData = AxiosResponse<OrganisationUnitPostResponse>>(\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/organisation/${orgId}/unit`,\n organisationUnitPostBodyBody,\n options\n );\n };\n /**\n * Gets the Unit, assuming you are a member of it. Admin users can see all Units\n\n * @summary Gets a Unit\n */\n const appApiUnitGetUnit = <TData = AxiosResponse<UnitGetResponse>>(\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/organisation/${orgId}/unit/${unitId}`, options);\n };\n /**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\n const appApiUnitDelete = <TData = AxiosResponse<void>>(\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/organisation/${orgId}/unit/${unitId}`, options);\n };\n /**\n * Gets all the Units you are a member of. Admin users can see all Units\n\n * @summary Gets Units a User has access to\n */\n const appApiUnitGet = <TData = AxiosResponse<UnitsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/unit`, options);\n };\n /**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\n const appApiUnitPersonalPut = <\n TData = AxiosResponse<PersonalUnitPutResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.put(`/unit`, undefined, options);\n };\n /**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\n const appApiUnitPersonalDelete = <TData = AxiosResponse<void>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(`/unit`, options);\n };\n return {\n appApiUnitGetOrgUnits,\n appApiUnitPost,\n appApiUnitGetUnit,\n appApiUnitDelete,\n appApiUnitGet,\n appApiUnitPersonalPut,\n appApiUnitPersonalDelete,\n };\n};\nexport type AppApiUnitGetOrgUnitsResult =\n AxiosResponse<OrganisationUnitsGetResponse>;\nexport type AppApiUnitPostResult = AxiosResponse<OrganisationUnitPostResponse>;\nexport type AppApiUnitGetUnitResult = AxiosResponse<UnitGetResponse>;\nexport type AppApiUnitDeleteResult = AxiosResponse<void>;\nexport type AppApiUnitGetResult = AxiosResponse<UnitsGetResponse>;\nexport type AppApiUnitPersonalPutResult =\n AxiosResponse<PersonalUnitPutResponse>;\nexport type AppApiUnitPersonalDeleteResult = AxiosResponse<void>;\n"],"mappings":";;;AAUA;AAUO,IAAM,UAAU,MAAM;AAM3B,QAAM,wBAAwB,CAG5B,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,OAAO;AAAA,EACzD;AAMA,QAAM,iBAAiB,CACrB,OACA,8BACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,cACjB,8BACA,OACF;AAAA,EACF;AAMA,QAAM,oBAAoB,CACxB,OACA,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACnE;AAMA,QAAM,mBAAmB,CACvB,OACA,QACA,YACmB;AACnB,WAAO,MAAM,OAAO,iBAAiB,cAAc,UAAU,OAAO;AAAA,EACtE;AAMA,QAAM,gBAAgB,CACpB,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,OAAO;AAAA,EACnC;AAMA,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,SAAS,QAAW,OAAO;AAAA,EAC9C;AAMA,QAAM,2BAA2B,CAC/B,YACmB;AACnB,WAAO,MAAM,OAAO,SAAS,OAAO;AAAA,EACtC;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.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 {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\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 Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnits>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\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 ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisationUnit>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props || {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = AsyncReturnType<typeof getUnit>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>\n getUnit(orgId, unitId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUnit>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: 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 deleteOrganisationUnit>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props || {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, 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 ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createDefaultUnit>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteDefaultUnit>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":"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","names":[]}
|