@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
|
@@ -1,26 +1,76 @@
|
|
|
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, E as OrganisationsGetResponse, W as ErrorType, N as AsError, c as OrganisationPostBodyBody, L as OrganisationPostResponse, J as OrganisationGetDefaultResponse } 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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
* @summary Gets Organisations
|
|
12
|
+
*/
|
|
13
|
+
declare const getOrganisations: (options?: SecondParameter<typeof customInstance>) => Promise<OrganisationsGetResponse>;
|
|
14
|
+
declare const getGetOrganisationsQueryKey: () => string[];
|
|
15
|
+
declare type GetOrganisationsQueryResult = NonNullable<AsyncReturnType<typeof getOrganisations>>;
|
|
16
|
+
declare type GetOrganisationsQueryError = ErrorType<void | AsError>;
|
|
17
|
+
declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
18
|
+
query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, QueryKey> | undefined;
|
|
19
|
+
request?: SecondParameter<typeof customInstance>;
|
|
20
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
21
|
+
queryKey: QueryKey;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new Organisation
|
|
25
|
+
|
|
26
|
+
You need **admin** rights to use this method
|
|
27
|
+
|
|
28
|
+
* @summary Create a new organisation
|
|
29
|
+
*/
|
|
30
|
+
declare const createOrganisation: (organisationPostBodyBody: OrganisationPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationPostResponse>;
|
|
31
|
+
declare type CreateOrganisationMutationResult = NonNullable<AsyncReturnType<typeof createOrganisation>>;
|
|
32
|
+
declare type CreateOrganisationMutationBody = OrganisationPostBodyBody;
|
|
33
|
+
declare type CreateOrganisationMutationError = ErrorType<AsError | void>;
|
|
34
|
+
declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
35
|
+
mutation?: UseMutationOptions<OrganisationPostResponse, TError, {
|
|
36
|
+
data: OrganisationPostBodyBody;
|
|
37
|
+
}, TContext> | undefined;
|
|
38
|
+
request?: SecondParameter<typeof customInstance>;
|
|
39
|
+
} | undefined) => react_query.UseMutationResult<OrganisationPostResponse, TError, {
|
|
40
|
+
data: OrganisationPostBodyBody;
|
|
41
|
+
}, TContext>;
|
|
42
|
+
/**
|
|
43
|
+
* Units must first be deleted before an Organisation can be deleted
|
|
44
|
+
|
|
45
|
+
You need **admin** rights to use this method
|
|
11
46
|
|
|
12
|
-
*
|
|
47
|
+
* @summary Deletes an Organisation
|
|
13
48
|
*/
|
|
49
|
+
declare const deleteOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
50
|
+
declare type DeleteOrganisationMutationResult = NonNullable<AsyncReturnType<typeof deleteOrganisation>>;
|
|
51
|
+
declare type DeleteOrganisationMutationError = ErrorType<AsError>;
|
|
52
|
+
declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
53
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
54
|
+
orgId: string;
|
|
55
|
+
}, TContext> | undefined;
|
|
56
|
+
request?: SecondParameter<typeof customInstance>;
|
|
57
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
58
|
+
orgId: string;
|
|
59
|
+
}, TContext>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the built-in Default Organisation, used exclusively for Personal Units
|
|
14
62
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
63
|
+
* @summary Gets the (built-in) Default Organisation
|
|
64
|
+
*/
|
|
65
|
+
declare const getDefaultOrganisation: (options?: SecondParameter<typeof customInstance>) => Promise<OrganisationGetDefaultResponse>;
|
|
66
|
+
declare const getGetDefaultOrganisationQueryKey: () => string[];
|
|
67
|
+
declare type GetDefaultOrganisationQueryResult = NonNullable<AsyncReturnType<typeof getDefaultOrganisation>>;
|
|
68
|
+
declare type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
|
|
69
|
+
declare const useGetDefaultOrganisation: <TData = OrganisationGetDefaultResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
70
|
+
query?: UseQueryOptions<OrganisationGetDefaultResponse, TError, TData, QueryKey> | undefined;
|
|
71
|
+
request?: SecondParameter<typeof customInstance>;
|
|
72
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
73
|
+
queryKey: QueryKey;
|
|
20
74
|
};
|
|
21
|
-
declare type AppApiOrganisationGetResult = AxiosResponse<OrganisationsGetResponse>;
|
|
22
|
-
declare type AppApiOrganisationPostResult = AxiosResponse<OrganisationPostResponse>;
|
|
23
|
-
declare type AppApiOrganisationDeleteResult = AxiosResponse<void>;
|
|
24
|
-
declare type AppApiOrganisationGetDefaultResult = AxiosResponse<OrganisationGetDefaultResponse>;
|
|
25
75
|
|
|
26
|
-
export {
|
|
76
|
+
export { CreateOrganisationMutationBody, CreateOrganisationMutationError, CreateOrganisationMutationResult, DeleteOrganisationMutationError, DeleteOrganisationMutationResult, GetDefaultOrganisationQueryError, GetDefaultOrganisationQueryResult, GetOrganisationsQueryError, GetOrganisationsQueryResult, createOrganisation, deleteOrganisation, getDefaultOrganisation, getGetDefaultOrganisationQueryKey, getGetOrganisationsQueryKey, getOrganisations, useCreateOrganisation, useDeleteOrganisation, useGetDefaultOrganisation, useGetOrganisations };
|
|
@@ -1,28 +1,78 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues,
|
|
3
|
+
customInstance
|
|
4
|
+
} from "../chunk-6EEIAH4R.js";
|
|
2
5
|
|
|
3
6
|
// src/organisation/organisation.ts
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
7
|
+
import {
|
|
8
|
+
useQuery,
|
|
9
|
+
useMutation
|
|
10
|
+
} from "react-query";
|
|
11
|
+
var getOrganisations = (options) => {
|
|
12
|
+
return customInstance({ url: `/organisation`, method: "get" }, options);
|
|
13
|
+
};
|
|
14
|
+
var getGetOrganisationsQueryKey = () => [`/organisation`];
|
|
15
|
+
var useGetOrganisations = (options) => {
|
|
16
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationsQueryKey();
|
|
18
|
+
const queryFn = () => getOrganisations(requestOptions);
|
|
19
|
+
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
|
+
return __spreadValues({
|
|
21
|
+
queryKey
|
|
22
|
+
}, query);
|
|
23
|
+
};
|
|
24
|
+
var createOrganisation = (organisationPostBodyBody, options) => {
|
|
25
|
+
return customInstance({
|
|
26
|
+
url: `/organisation`,
|
|
27
|
+
method: "post",
|
|
28
|
+
headers: { "Content-Type": "application/json" },
|
|
29
|
+
data: organisationPostBodyBody
|
|
30
|
+
}, options);
|
|
31
|
+
};
|
|
32
|
+
var useCreateOrganisation = (options) => {
|
|
33
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
34
|
+
const mutationFn = (props) => {
|
|
35
|
+
const { data } = props || {};
|
|
36
|
+
return createOrganisation(data, requestOptions);
|
|
17
37
|
};
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
return useMutation(mutationFn, mutationOptions);
|
|
39
|
+
};
|
|
40
|
+
var deleteOrganisation = (orgId, options) => {
|
|
41
|
+
return customInstance({ url: `/organisation/${orgId}`, method: "delete" }, options);
|
|
42
|
+
};
|
|
43
|
+
var useDeleteOrganisation = (options) => {
|
|
44
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
45
|
+
const mutationFn = (props) => {
|
|
46
|
+
const { orgId } = props || {};
|
|
47
|
+
return deleteOrganisation(orgId, requestOptions);
|
|
23
48
|
};
|
|
49
|
+
return useMutation(mutationFn, mutationOptions);
|
|
50
|
+
};
|
|
51
|
+
var getDefaultOrganisation = (options) => {
|
|
52
|
+
return customInstance({ url: `/organisation/default`, method: "get" }, options);
|
|
53
|
+
};
|
|
54
|
+
var getGetDefaultOrganisationQueryKey = () => [
|
|
55
|
+
`/organisation/default`
|
|
56
|
+
];
|
|
57
|
+
var useGetDefaultOrganisation = (options) => {
|
|
58
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
59
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetDefaultOrganisationQueryKey();
|
|
60
|
+
const queryFn = () => getDefaultOrganisation(requestOptions);
|
|
61
|
+
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
62
|
+
return __spreadValues({
|
|
63
|
+
queryKey
|
|
64
|
+
}, query);
|
|
24
65
|
};
|
|
25
66
|
export {
|
|
26
|
-
|
|
67
|
+
createOrganisation,
|
|
68
|
+
deleteOrganisation,
|
|
69
|
+
getDefaultOrganisation,
|
|
70
|
+
getGetDefaultOrganisationQueryKey,
|
|
71
|
+
getGetOrganisationsQueryKey,
|
|
72
|
+
getOrganisations,
|
|
73
|
+
useCreateOrganisation,
|
|
74
|
+
useDeleteOrganisation,
|
|
75
|
+
useGetDefaultOrganisation,
|
|
76
|
+
useGetOrganisations
|
|
27
77
|
};
|
|
28
78
|
//# sourceMappingURL=organisation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse,\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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport type GetOrganisationsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisations>\n>;\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisations = <\n TData = AsyncReturnType<typeof getOrganisations>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>\n getOrganisations(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisations>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n {\n url: `/organisation`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisation>\n>;\nexport type CreateOrganisationMutationBody = OrganisationPostBodyBody;\nexport type CreateOrganisationMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisation = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisation>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisation>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisation>\n>;\n\nexport type DeleteOrganisationMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisation>,\n TError,\n { orgId: 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 deleteOrganisation>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props || {};\n\n return deleteOrganisation(orgId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisation>,\n TError,\n { orgId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const getDefaultOrganisation = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n { url: `/organisation/default`, method: \"get\" },\n options\n );\n};\n\nexport const getGetDefaultOrganisationQueryKey = () => [\n `/organisation/default`,\n];\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<\n AsyncReturnType<typeof getDefaultOrganisation>\n>;\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetDefaultOrganisation = <\n TData = AsyncReturnType<typeof getDefaultOrganisation>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getDefaultOrganisation>,\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 =\n queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getDefaultOrganisation>\n > = () => getDefaultOrganisation(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getDefaultOrganisation>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAuCO,IAAM,mBAAmB,CAC9B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,MAAM,GACtC,OACF;AACF;AAEO,IAAM,8BAA8B,MAAM,CAAC,eAAe;AAO1D,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAAmE,MACvE,iBAAiB,cAAc;AAEjC,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AASO,IAAM,qBAAqB,CAChC,0BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM;AAAA,EACR,GACA,OACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,SAAS,CAAC;AAE3B,WAAO,mBAAmB,MAAM,cAAc;AAAA,EAChD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAQO,IAAM,qBAAqB,CAChC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,SAAS,QAAQ,SAAS,GAClD,OACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,UAAU,SAAS,CAAC;AAE5B,WAAO,mBAAmB,OAAO,cAAc;AAAA,EACjD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,yBAAyB,CACpC,YACG;AACH,SAAO,eACL,EAAE,KAAK,yBAAyB,QAAQ,MAAM,GAC9C,OACF;AACF;AAEO,IAAM,oCAAoC,MAAM;AAAA,EACrD;AACF;AAOO,IAAM,4BAA4B,CAGvC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,kCAAkC;AAE9D,QAAM,UAEF,MAAM,uBAAuB,cAAc;AAE/C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
|
package/package.json
CHANGED
package/product/product.cjs
CHANGED
|
@@ -1,40 +1,130 @@
|
|
|
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/product/product.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _reactquery = require('react-query');
|
|
11
|
+
var getProductTypes = (options) => {
|
|
12
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/product-type`, method: "get" }, options);
|
|
13
|
+
};
|
|
14
|
+
var getGetProductTypesQueryKey = () => [`/product-type`];
|
|
15
|
+
var useGetProductTypes = (options) => {
|
|
16
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
17
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductTypesQueryKey()));
|
|
18
|
+
const queryFn = () => getProductTypes(requestOptions);
|
|
19
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
21
|
+
queryKey
|
|
22
|
+
}, query);
|
|
23
|
+
};
|
|
24
|
+
var getProducts = (options) => {
|
|
25
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/product`, method: "get" }, options);
|
|
26
|
+
};
|
|
27
|
+
var getGetProductsQueryKey = () => [`/product`];
|
|
28
|
+
var useGetProducts = (options) => {
|
|
29
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
30
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsQueryKey()));
|
|
31
|
+
const queryFn = () => getProducts(requestOptions);
|
|
32
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
33
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
34
|
+
queryKey
|
|
35
|
+
}, query);
|
|
36
|
+
};
|
|
37
|
+
var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
|
|
38
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, {
|
|
39
|
+
url: `/product/unit/${unitId}`,
|
|
40
|
+
method: "post",
|
|
41
|
+
headers: { "Content-Type": "application/json" },
|
|
42
|
+
data: unitProductPostBodyBody
|
|
43
|
+
}, options);
|
|
44
|
+
};
|
|
45
|
+
var useCreateUnitProduct = (options) => {
|
|
46
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
47
|
+
const mutationFn = (props) => {
|
|
48
|
+
const { unitId, data } = props || {};
|
|
49
|
+
return createUnitProduct(unitId, data, requestOptions);
|
|
23
50
|
};
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
52
|
+
};
|
|
53
|
+
var getProductsForUnit = (unitId, options) => {
|
|
54
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/product/unit/${unitId}`, method: "get" }, options);
|
|
55
|
+
};
|
|
56
|
+
var getGetProductsForUnitQueryKey = (unitId) => [
|
|
57
|
+
`/product/unit/${unitId}`
|
|
58
|
+
];
|
|
59
|
+
var useGetProductsForUnit = (unitId, options) => {
|
|
60
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
61
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForUnitQueryKey(unitId)));
|
|
62
|
+
const queryFn = () => getProductsForUnit(unitId, requestOptions);
|
|
63
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
|
|
64
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
65
|
+
queryKey
|
|
66
|
+
}, query);
|
|
67
|
+
};
|
|
68
|
+
var getProduct = (unitId, productId, options) => {
|
|
69
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/product/unit/${unitId}/product/${productId}`, method: "get" }, options);
|
|
70
|
+
};
|
|
71
|
+
var getGetProductQueryKey = (unitId, productId) => [
|
|
72
|
+
`/product/unit/${unitId}/product/${productId}`
|
|
73
|
+
];
|
|
74
|
+
var useGetProduct = (unitId, productId, options) => {
|
|
75
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
76
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductQueryKey(unitId, productId)));
|
|
77
|
+
const queryFn = () => getProduct(unitId, productId, requestOptions);
|
|
78
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!(unitId && productId) }, queryOptions));
|
|
79
|
+
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
80
|
+
queryKey
|
|
81
|
+
}, query);
|
|
82
|
+
};
|
|
83
|
+
var deleteProduct = (unitId, productId, options) => {
|
|
84
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/product/unit/${unitId}/product/${productId}`, method: "delete" }, options);
|
|
85
|
+
};
|
|
86
|
+
var useDeleteProduct = (options) => {
|
|
87
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
88
|
+
const mutationFn = (props) => {
|
|
89
|
+
const { unitId, productId } = props || {};
|
|
90
|
+
return deleteProduct(unitId, productId, requestOptions);
|
|
26
91
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
92
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
93
|
+
};
|
|
94
|
+
var patchProduct = (unitId, productId, productPatchBodyBody, options) => {
|
|
95
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, {
|
|
96
|
+
url: `/product/unit/${unitId}/product/${productId}`,
|
|
97
|
+
method: "patch",
|
|
98
|
+
headers: { "Content-Type": "application/json" },
|
|
99
|
+
data: productPatchBodyBody
|
|
100
|
+
}, options);
|
|
101
|
+
};
|
|
102
|
+
var usePatchProduct = (options) => {
|
|
103
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
104
|
+
const mutationFn = (props) => {
|
|
105
|
+
const { unitId, productId, data } = props || {};
|
|
106
|
+
return patchProduct(unitId, productId, data, requestOptions);
|
|
35
107
|
};
|
|
108
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
36
109
|
};
|
|
37
110
|
|
|
38
111
|
|
|
39
|
-
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
exports.createUnitProduct = createUnitProduct; exports.deleteProduct = deleteProduct; exports.getGetProductQueryKey = getGetProductQueryKey; exports.getGetProductTypesQueryKey = getGetProductTypesQueryKey; exports.getGetProductsForUnitQueryKey = getGetProductsForUnitQueryKey; exports.getGetProductsQueryKey = getGetProductsQueryKey; exports.getProduct = getProduct; exports.getProductTypes = getProductTypes; exports.getProducts = getProducts; exports.getProductsForUnit = getProductsForUnit; exports.patchProduct = patchProduct; exports.useCreateUnitProduct = useCreateUnitProduct; exports.useDeleteProduct = useDeleteProduct; exports.useGetProduct = useGetProduct; exports.useGetProductTypes = useGetProductTypes; exports.useGetProducts = useGetProducts; exports.useGetProductsForUnit = useGetProductsForUnit; exports.usePatchProduct = usePatchProduct;
|
|
40
130
|
//# sourceMappingURL=product.cjs.map
|
package/product/product.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;AAUA;AAUO,IAAM,aAAa,MAAM;AAM9B,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAIA,QAAM,oBAAoB,CACxB,QACA,yBACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,UACjB,yBACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,UAAU,OAAO;AAAA,EACrD;AAMA,QAAM,8BAA8B,CAGlC,QACA,WACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,kBAAkB,aAAa,OAAO;AAAA,EAC1E;AAIA,QAAM,sBAAsB,CAC1B,QACA,WACA,YACmB;AACnB,WAAO,MAAM,OACX,iBAAiB,kBAAkB,aACnC,OACF;AAAA,EACF;AAMA,QAAM,qBAAqB,CACzB,QACA,WACA,sBACA,YACmB;AACnB,WAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ProductsGetTypesResponse,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\nexport const getProduct = () => {\n /**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\n const appApiProductGetTypes = <\n TData = AxiosResponse<ProductsGetTypesResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product-type`, options);\n };\n /**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\n const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product`, options);\n };\n /**\n * @summary Creates a Product for an Organisational Unit\n */\n const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n };\n /**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\n const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}`, options);\n };\n /**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\n const appApiProductGetUnitProduct = <\n TData = AxiosResponse<ProductUnitGetResponse>\n >(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n };\n /**\n * @summary Deletes an existing Product\n */\n const appApiProductDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(\n `/product/unit/${unitId}/product/${productId}`,\n options\n );\n };\n /**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\n const appApiProductPatch = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n };\n return {\n appApiProductGetTypes,\n appApiProductGet,\n appApiProductPost,\n appApiProductGetForUnit,\n appApiProductGetUnitProduct,\n appApiProductDelete,\n appApiProductPatch,\n };\n};\nexport type AppApiProductGetTypesResult =\n AxiosResponse<ProductsGetTypesResponse>;\nexport type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;\nexport type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductGetUnitProductResult =\n AxiosResponse<ProductUnitGetResponse>;\nexport type AppApiProductDeleteResult = AxiosResponse<void>;\nexport type AppApiProductPatchResult = AxiosResponse<void>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.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 ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n AsyncReturnType<typeof getProductTypes>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = AsyncReturnType<typeof getProductTypes>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>\n getProductTypes(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n AsyncReturnType<typeof getProducts>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = AsyncReturnType<typeof getProducts>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>\n getProducts(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n AsyncReturnType<typeof createUnitProduct>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createUnitProduct>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props || {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof getProductsForUnit>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = AsyncReturnType<typeof getProductsForUnit>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForUnit>\n > = () => getProductsForUnit(unitId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitId: string, productId: string) => [\n `/product/unit/${unitId}/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n AsyncReturnType<typeof getProduct>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = AsyncReturnType<typeof getProduct>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>\n getProduct(unitId, productId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitId && productId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n AsyncReturnType<typeof deleteProduct>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: 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 deleteProduct>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return deleteProduct(unitId, productId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/unit/${unitId}/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n AsyncReturnType<typeof patchProduct>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchProduct>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props || {};\n\n return patchProduct(unitId, productId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/product/product.d.ts
CHANGED
|
@@ -1,32 +1,123 @@
|
|
|
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, B as ProductsGetTypesResponse, W as ErrorType, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-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 product types you can purchase
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
* @summary Gets all Product Types
|
|
12
|
+
*/
|
|
13
|
+
declare const getProductTypes: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetTypesResponse>;
|
|
14
|
+
declare const getGetProductTypesQueryKey: () => string[];
|
|
15
|
+
declare type GetProductTypesQueryResult = NonNullable<AsyncReturnType<typeof getProductTypes>>;
|
|
16
|
+
declare type GetProductTypesQueryError = ErrorType<AsError | void>;
|
|
17
|
+
declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
18
|
+
query?: UseQueryOptions<ProductsGetTypesResponse, TError, TData, QueryKey> | undefined;
|
|
19
|
+
request?: SecondParameter<typeof customInstance>;
|
|
20
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
21
|
+
queryKey: QueryKey;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Gets products you have access to, across all Units and Organisations
|
|
11
25
|
|
|
12
|
-
*
|
|
26
|
+
* @summary Gets all Products
|
|
13
27
|
*/
|
|
28
|
+
declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
|
|
29
|
+
declare const getGetProductsQueryKey: () => string[];
|
|
30
|
+
declare type GetProductsQueryResult = NonNullable<AsyncReturnType<typeof getProducts>>;
|
|
31
|
+
declare type GetProductsQueryError = ErrorType<AsError | void>;
|
|
32
|
+
declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
33
|
+
query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
|
|
34
|
+
request?: SecondParameter<typeof customInstance>;
|
|
35
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
36
|
+
queryKey: QueryKey;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @summary Creates a Product for an Organisational Unit
|
|
40
|
+
*/
|
|
41
|
+
declare const createUnitProduct: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
|
|
42
|
+
declare type CreateUnitProductMutationResult = NonNullable<AsyncReturnType<typeof createUnitProduct>>;
|
|
43
|
+
declare type CreateUnitProductMutationBody = UnitProductPostBodyBody;
|
|
44
|
+
declare type CreateUnitProductMutationError = ErrorType<AsError | void>;
|
|
45
|
+
declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
46
|
+
mutation?: UseMutationOptions<UnitProductPostResponse, TError, {
|
|
47
|
+
unitId: string;
|
|
48
|
+
data: UnitProductPostBodyBody;
|
|
49
|
+
}, TContext> | undefined;
|
|
50
|
+
request?: SecondParameter<typeof customInstance>;
|
|
51
|
+
} | undefined) => react_query.UseMutationResult<UnitProductPostResponse, TError, {
|
|
52
|
+
unitId: string;
|
|
53
|
+
data: UnitProductPostBodyBody;
|
|
54
|
+
}, TContext>;
|
|
55
|
+
/**
|
|
56
|
+
* Gets products you have access to based on an Organisational Unit
|
|
14
57
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
58
|
+
* @summary Gets Products for an Organisational Unit
|
|
59
|
+
*/
|
|
60
|
+
declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
|
|
61
|
+
declare const getGetProductsForUnitQueryKey: (unitId: string) => string[];
|
|
62
|
+
declare type GetProductsForUnitQueryResult = NonNullable<AsyncReturnType<typeof getProductsForUnit>>;
|
|
63
|
+
declare type GetProductsForUnitQueryError = ErrorType<void | AsError>;
|
|
64
|
+
declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
65
|
+
query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
|
|
66
|
+
request?: SecondParameter<typeof customInstance>;
|
|
67
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
68
|
+
queryKey: QueryKey;
|
|
23
69
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
declare
|
|
30
|
-
declare
|
|
70
|
+
/**
|
|
71
|
+
* Gets a Unit's Product
|
|
72
|
+
|
|
73
|
+
* @summary Gets a Unit's Product
|
|
74
|
+
*/
|
|
75
|
+
declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
|
|
76
|
+
declare const getGetProductQueryKey: (unitId: string, productId: string) => string[];
|
|
77
|
+
declare type GetProductQueryResult = NonNullable<AsyncReturnType<typeof getProduct>>;
|
|
78
|
+
declare type GetProductQueryError = ErrorType<AsError | void>;
|
|
79
|
+
declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitId: string, productId: string, options?: {
|
|
80
|
+
query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
|
|
81
|
+
request?: SecondParameter<typeof customInstance>;
|
|
82
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
83
|
+
queryKey: QueryKey;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @summary Deletes an existing Product
|
|
87
|
+
*/
|
|
88
|
+
declare const deleteProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
89
|
+
declare type DeleteProductMutationResult = NonNullable<AsyncReturnType<typeof deleteProduct>>;
|
|
90
|
+
declare type DeleteProductMutationError = ErrorType<AsError>;
|
|
91
|
+
declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
92
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
93
|
+
unitId: string;
|
|
94
|
+
productId: string;
|
|
95
|
+
}, TContext> | undefined;
|
|
96
|
+
request?: SecondParameter<typeof customInstance>;
|
|
97
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
98
|
+
unitId: string;
|
|
99
|
+
productId: string;
|
|
100
|
+
}, TContext>;
|
|
101
|
+
/**
|
|
102
|
+
* Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`
|
|
103
|
+
|
|
104
|
+
* @summary Adjust an existing Product
|
|
105
|
+
*/
|
|
106
|
+
declare const patchProduct: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
107
|
+
declare type PatchProductMutationResult = NonNullable<AsyncReturnType<typeof patchProduct>>;
|
|
108
|
+
declare type PatchProductMutationBody = ProductPatchBodyBody;
|
|
109
|
+
declare type PatchProductMutationError = ErrorType<AsError>;
|
|
110
|
+
declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
111
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
112
|
+
unitId: string;
|
|
113
|
+
productId: string;
|
|
114
|
+
data: ProductPatchBodyBody;
|
|
115
|
+
}, TContext> | undefined;
|
|
116
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
118
|
+
unitId: string;
|
|
119
|
+
productId: string;
|
|
120
|
+
data: ProductPatchBodyBody;
|
|
121
|
+
}, TContext>;
|
|
31
122
|
|
|
32
|
-
export {
|
|
123
|
+
export { CreateUnitProductMutationBody, CreateUnitProductMutationError, CreateUnitProductMutationResult, DeleteProductMutationError, DeleteProductMutationResult, GetProductQueryError, GetProductQueryResult, GetProductTypesQueryError, GetProductTypesQueryResult, GetProductsForUnitQueryError, GetProductsForUnitQueryResult, GetProductsQueryError, GetProductsQueryResult, PatchProductMutationBody, PatchProductMutationError, PatchProductMutationResult, createUnitProduct, deleteProduct, getGetProductQueryKey, getGetProductTypesQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProductTypes, getProducts, getProductsForUnit, patchProduct, useCreateUnitProduct, useDeleteProduct, useGetProduct, useGetProductTypes, useGetProducts, useGetProductsForUnit, usePatchProduct };
|