@squonk/account-server-client 2.0.3 → 2.0.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/admin.cjs +8 -6
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +4 -4
- package/admin/admin.js +7 -5
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +15 -13
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +20 -20
- package/asset/asset.js +7 -5
- package/asset/asset.js.map +1 -1
- package/{chunk-3O5KIRV4.js → chunk-3RNIDX7T.js} +1 -1
- package/{chunk-3O5KIRV4.js.map → chunk-3RNIDX7T.js.map} +1 -1
- package/chunk-7XN3IQYV.cjs +13 -0
- package/chunk-7XN3IQYV.cjs.map +1 -0
- package/{chunk-IUEU2LYC.cjs → chunk-UZTHSGDT.cjs} +1 -1
- package/chunk-UZTHSGDT.cjs.map +1 -0
- package/chunk-YEX2SGER.js +13 -0
- package/chunk-YEX2SGER.js.map +1 -0
- package/{custom-instance-dad9d28e.d.ts → custom-instance-85497958.d.ts} +110 -48
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +12 -9
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +6 -6
- package/merchant/merchant.js +10 -7
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +48 -16
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +37 -16
- package/organisation/organisation.js +42 -10
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +35 -33
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +24 -24
- package/product/product.js +25 -23
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +85 -17
- package/src/admin/admin.ts +6 -5
- package/src/asset/asset.ts +6 -5
- package/src/merchant/merchant.ts +10 -9
- package/src/organisation/organisation.ts +83 -19
- package/src/product/product.ts +30 -32
- package/src/queryMutator.ts +12 -0
- package/src/state/state.ts +6 -5
- package/src/unit/unit.ts +83 -19
- package/src/user/user.ts +14 -15
- package/state/state.cjs +8 -6
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +4 -4
- package/state/state.js +7 -5
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +50 -25
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +42 -21
- package/unit/unit.js +42 -17
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +20 -17
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +16 -16
- package/user/user.js +13 -10
- package/user/user.js.map +1 -1
- package/chunk-IUEU2LYC.cjs.map +0 -1
package/admin/admin.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
|
|
4
7
|
|
|
5
8
|
// src/admin/admin.ts
|
|
6
9
|
var _reactquery = require('@tanstack/react-query');
|
|
7
10
|
var getCharges = (params, options, signal) => {
|
|
8
|
-
return
|
|
11
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
9
12
|
{ url: `/charges`, method: "get", params, signal },
|
|
10
13
|
options
|
|
11
14
|
);
|
|
@@ -20,12 +23,11 @@ var useGetCharges = (params, options) => {
|
|
|
20
23
|
const queryFn = ({
|
|
21
24
|
signal
|
|
22
25
|
}) => getCharges(params, requestOptions, signal);
|
|
26
|
+
const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
|
|
23
27
|
const query = _reactquery.useQuery.call(void 0,
|
|
24
|
-
|
|
25
|
-
queryFn,
|
|
26
|
-
queryOptions
|
|
28
|
+
customOptions
|
|
27
29
|
);
|
|
28
|
-
query.queryKey = queryKey;
|
|
30
|
+
query.queryKey = customOptions.queryKey;
|
|
29
31
|
return query;
|
|
30
32
|
};
|
|
31
33
|
|
package/admin/admin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/admin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/admin/admin.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,gBAAgB;AA+BlB,IAAM,aAAa,CACxB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,QAAQ,OAAO;AAAA,IACjD;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,CAAC,WAA8B;AAAA,EAClE;AAAA,EACA,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC;AAC3B;AAOO,IAAM,gBAAgB,CAI3B,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB,MAAM;AAEvE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,QAAQ,gBAAgB,MAAM;AAE/C,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ;AAAA,IACZ;AAAA,EACF;AAEA,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ChargesGetResponse,\n AsError,\n GetChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\n\n// eslint-disable-next-line\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 global charges.\n\nYou need **admin** rights to use this path.\n\n * @summary Gets charges for all Organisations\n */\nexport const getCharges = (\n params?: GetChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ChargesGetResponse>(\n { url: `/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetChargesQueryKey = (params?: GetChargesParams) => [\n `/charges`,\n ...(params ? [params] : []),\n];\n\nexport type GetChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getCharges>>\n>;\nexport type GetChargesQueryError = ErrorType<void | AsError>;\n\nexport const useGetCharges = <\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>\n>(\n params?: GetChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getCharges>>,\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 = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({\n signal,\n }) => getCharges(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getCharges>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"]}
|
package/admin/admin.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { c as GetChargesParams,
|
|
2
|
+
import { c as GetChargesParams, aE as customInstance, ax as ChargesGetResponse, aF as ErrorType, aA as AsError } from '../custom-instance-85497958.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
6
6
|
/**
|
|
7
7
|
* Gets global charges.
|
|
8
8
|
|
|
@@ -12,8 +12,8 @@ You need **admin** rights to use this path.
|
|
|
12
12
|
*/
|
|
13
13
|
declare const getCharges: (params?: GetChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<ChargesGetResponse>;
|
|
14
14
|
declare const getGetChargesQueryKey: (params?: GetChargesParams) => (string | GetChargesParams)[];
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type GetChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getCharges>>>;
|
|
16
|
+
type GetChargesQueryError = ErrorType<void | AsError>;
|
|
17
17
|
declare const useGetCharges: <TData = ChargesGetResponse, TError = ErrorType<void | AsError>>(params?: GetChargesParams, options?: {
|
|
18
18
|
query?: UseQueryOptions<ChargesGetResponse, TError, TData, QueryKey> | undefined;
|
|
19
19
|
request?: SecondParameter<typeof customInstance>;
|
package/admin/admin.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryMutator
|
|
3
|
+
} from "../chunk-YEX2SGER.js";
|
|
1
4
|
import {
|
|
2
5
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3RNIDX7T.js";
|
|
4
7
|
|
|
5
8
|
// src/admin/admin.ts
|
|
6
9
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -20,12 +23,11 @@ var useGetCharges = (params, options) => {
|
|
|
20
23
|
const queryFn = ({
|
|
21
24
|
signal
|
|
22
25
|
}) => getCharges(params, requestOptions, signal);
|
|
26
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
23
27
|
const query = useQuery(
|
|
24
|
-
|
|
25
|
-
queryFn,
|
|
26
|
-
queryOptions
|
|
28
|
+
customOptions
|
|
27
29
|
);
|
|
28
|
-
query.queryKey = queryKey;
|
|
30
|
+
query.queryKey = customOptions.queryKey;
|
|
29
31
|
return query;
|
|
30
32
|
};
|
|
31
33
|
export {
|
package/admin/admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/admin.ts"],"sourcesContent":["/**\n * Generated by orval v6.
|
|
1
|
+
{"version":3,"sources":["../../src/admin/admin.ts"],"sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ChargesGetResponse,\n AsError,\n GetChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\n\n// eslint-disable-next-line\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 global charges.\n\nYou need **admin** rights to use this path.\n\n * @summary Gets charges for all Organisations\n */\nexport const getCharges = (\n params?: GetChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ChargesGetResponse>(\n { url: `/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetChargesQueryKey = (params?: GetChargesParams) => [\n `/charges`,\n ...(params ? [params] : []),\n];\n\nexport type GetChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getCharges>>\n>;\nexport type GetChargesQueryError = ErrorType<void | AsError>;\n\nexport const useGetCharges = <\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>\n>(\n params?: GetChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getCharges>>,\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 = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({\n signal,\n }) => getCharges(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getCharges>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;;;;AAUA,SAAS,gBAAgB;AA+BlB,IAAM,aAAa,CACxB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,QAAQ,OAAO;AAAA,IACjD;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,CAAC,WAA8B;AAAA,EAClE;AAAA,EACA,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC;AAC3B;AAOO,IAAM,gBAAgB,CAI3B,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB,MAAM;AAEvE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,QAAQ,gBAAgB,MAAM;AAE/C,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ;AAAA,IACZ;AAAA,EACF;AAEA,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT;","names":[]}
|
package/asset/asset.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
|
|
4
7
|
|
|
5
8
|
// src/asset/asset.ts
|
|
6
9
|
var _reactquery = require('@tanstack/react-query');
|
|
7
10
|
var getAsset = (params, options, signal) => {
|
|
8
|
-
return
|
|
11
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
9
12
|
{ url: `/asset`, method: "get", params, signal },
|
|
10
13
|
options
|
|
11
14
|
);
|
|
@@ -20,12 +23,11 @@ var useGetAsset = (params, options) => {
|
|
|
20
23
|
const queryFn = ({
|
|
21
24
|
signal
|
|
22
25
|
}) => getAsset(params, requestOptions, signal);
|
|
26
|
+
const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
|
|
23
27
|
const query = _reactquery.useQuery.call(void 0,
|
|
24
|
-
|
|
25
|
-
queryFn,
|
|
26
|
-
queryOptions
|
|
28
|
+
customOptions
|
|
27
29
|
);
|
|
28
|
-
query.queryKey = queryKey;
|
|
30
|
+
query.queryKey = customOptions.queryKey;
|
|
29
31
|
return query;
|
|
30
32
|
};
|
|
31
33
|
var createAsset = (assetPostBodyBody, options) => {
|
|
@@ -45,7 +47,7 @@ var createAsset = (assetPostBodyBody, options) => {
|
|
|
45
47
|
if (assetPostBodyBody.description !== void 0) {
|
|
46
48
|
formData.append("description", assetPostBodyBody.description);
|
|
47
49
|
}
|
|
48
|
-
return
|
|
50
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
49
51
|
{
|
|
50
52
|
url: `/asset`,
|
|
51
53
|
method: "post",
|
|
@@ -74,7 +76,7 @@ var patchAsset = (assetId, assetPatchBodyBody, options) => {
|
|
|
74
76
|
if (assetPatchBodyBody.description !== void 0) {
|
|
75
77
|
formData.append("description", assetPatchBodyBody.description);
|
|
76
78
|
}
|
|
77
|
-
return
|
|
79
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
78
80
|
{
|
|
79
81
|
url: `/asset/${assetId}`,
|
|
80
82
|
method: "patch",
|
|
@@ -93,7 +95,7 @@ var usePatchAsset = (options) => {
|
|
|
93
95
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
94
96
|
};
|
|
95
97
|
var deleteAsset = (assetId, options) => {
|
|
96
|
-
return
|
|
98
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
97
99
|
{ url: `/asset/${assetId}`, method: "delete" },
|
|
98
100
|
options
|
|
99
101
|
);
|
|
@@ -107,7 +109,7 @@ var useDeleteAsset = (options) => {
|
|
|
107
109
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
108
110
|
};
|
|
109
111
|
var disableAsset = (assetId, options) => {
|
|
110
|
-
return
|
|
112
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
111
113
|
{ url: `/asset/${assetId}/disable`, method: "patch" },
|
|
112
114
|
options
|
|
113
115
|
);
|
|
@@ -121,7 +123,7 @@ var useDisableAsset = (options) => {
|
|
|
121
123
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
122
124
|
};
|
|
123
125
|
var enableAsset = (assetId, options) => {
|
|
124
|
-
return
|
|
126
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
125
127
|
{ url: `/asset/${assetId}/enable`, method: "patch" },
|
|
126
128
|
options
|
|
127
129
|
);
|
|
@@ -135,7 +137,7 @@ var useEnableAsset = (options) => {
|
|
|
135
137
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
136
138
|
};
|
|
137
139
|
var attachAsset = (assetId, params, options) => {
|
|
138
|
-
return
|
|
140
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
139
141
|
{ url: `/asset/${assetId}/attach`, method: "patch", params },
|
|
140
142
|
options
|
|
141
143
|
);
|
|
@@ -149,7 +151,7 @@ var useAttachAsset = (options) => {
|
|
|
149
151
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
150
152
|
};
|
|
151
153
|
var detachAsset = (assetId, params, options) => {
|
|
152
|
-
return
|
|
154
|
+
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
153
155
|
{ url: `/asset/${assetId}/detach`, method: "patch", params },
|
|
154
156
|
options
|
|
155
157
|
);
|
package/asset/asset.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/asset/asset.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAmC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CAAC,WAA4B;AAAA,EAC9D;AAAA,EACA,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC;AAC3B;AAOO,IAAM,cAAc,CAIzB,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB,MAAM;AAErE,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAE7C,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA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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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 Assets\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) => [\n `/asset`,\n ...(params ? [params] : []),\n];\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\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 = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getAsset>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a known Asset. Assets that are attached to merchants cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Attaches an Asset to a merchant\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Detaches an Asset from a merchant\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/asset/asset.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AAoC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QA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AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,cAAc,CACzB,SACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,kBAAkB,QAAQ,SAAS,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\n\n// eslint-disable-next-line\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 Assets\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) => [\n `/asset`,\n ...(params ? [params] : []),\n];\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\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 = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getAsset>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a known Asset. Assets that are attached to merchants cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Attaches an Asset to a merchant\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Detaches an Asset from a merchant\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/asset/asset.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
-
import { g as GetAssetParams,
|
|
3
|
+
import { g as GetAssetParams, aE as customInstance, az as AssetGetResponse, aF as ErrorType, aA as AsError, s as AssetPostBodyBody, ay as AssetPostResponse, t as AssetPatchBodyBody, A as AttachAssetParams, D as DetachAssetParams } from '../custom-instance-85497958.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
7
|
/**
|
|
8
8
|
* Gets Assets
|
|
9
9
|
|
|
@@ -11,8 +11,8 @@ declare type SecondParameter<T extends (...args: any) => any> = T extends (confi
|
|
|
11
11
|
*/
|
|
12
12
|
declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
|
|
13
13
|
declare const getGetAssetQueryKey: (params?: GetAssetParams) => (string | GetAssetParams)[];
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
|
|
15
|
+
type GetAssetQueryError = ErrorType<AsError | void>;
|
|
16
16
|
declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
17
17
|
query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
|
|
18
18
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -25,9 +25,9 @@ declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void |
|
|
|
25
25
|
* @summary Create an Asset
|
|
26
26
|
*/
|
|
27
27
|
declare const createAsset: (assetPostBodyBody: AssetPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<AssetPostResponse>;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>;
|
|
29
|
+
type CreateAssetMutationBody = AssetPostBodyBody;
|
|
30
|
+
type CreateAssetMutationError = ErrorType<AsError | void>;
|
|
31
31
|
declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
32
32
|
mutation?: UseMutationOptions<AssetPostResponse, TError, {
|
|
33
33
|
data: AssetPostBodyBody;
|
|
@@ -42,9 +42,9 @@ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = un
|
|
|
42
42
|
* @summary Adjust an existing Asset
|
|
43
43
|
*/
|
|
44
44
|
declare const patchAsset: (assetId: string, assetPatchBodyBody: AssetPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>;
|
|
46
|
+
type PatchAssetMutationBody = AssetPatchBodyBody;
|
|
47
|
+
type PatchAssetMutationError = ErrorType<AsError>;
|
|
48
48
|
declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
49
49
|
mutation?: UseMutationOptions<void, TError, {
|
|
50
50
|
assetId: string;
|
|
@@ -61,8 +61,8 @@ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(o
|
|
|
61
61
|
* @summary Deletes an Asset
|
|
62
62
|
*/
|
|
63
63
|
declare const deleteAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>;
|
|
65
|
+
type DeleteAssetMutationError = ErrorType<AsError>;
|
|
66
66
|
declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
67
67
|
mutation?: UseMutationOptions<void, TError, {
|
|
68
68
|
assetId: string;
|
|
@@ -77,8 +77,8 @@ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
77
77
|
* @summary Disables an Asset
|
|
78
78
|
*/
|
|
79
79
|
declare const disableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>;
|
|
81
|
+
type DisableAssetMutationError = ErrorType<AsError>;
|
|
82
82
|
declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
83
83
|
mutation?: UseMutationOptions<void, TError, {
|
|
84
84
|
assetId: string;
|
|
@@ -93,8 +93,8 @@ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>
|
|
|
93
93
|
* @summary Enables an Asset
|
|
94
94
|
*/
|
|
95
95
|
declare const enableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>;
|
|
97
|
+
type EnableAssetMutationError = ErrorType<AsError>;
|
|
98
98
|
declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
99
99
|
mutation?: UseMutationOptions<void, TError, {
|
|
100
100
|
assetId: string;
|
|
@@ -109,8 +109,8 @@ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
109
109
|
* @summary Attaches an Asset to a Merchant
|
|
110
110
|
*/
|
|
111
111
|
declare const attachAsset: (assetId: string, params?: AttachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>;
|
|
113
|
+
type AttachAssetMutationError = ErrorType<AsError>;
|
|
114
114
|
declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
115
115
|
mutation?: UseMutationOptions<void, TError, {
|
|
116
116
|
assetId: string;
|
|
@@ -127,8 +127,8 @@ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
127
127
|
* @summary Detaches an Asset from a Merchant
|
|
128
128
|
*/
|
|
129
129
|
declare const detachAsset: (assetId: string, params?: DetachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>;
|
|
131
|
+
type DetachAssetMutationError = ErrorType<AsError>;
|
|
132
132
|
declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
133
133
|
mutation?: UseMutationOptions<void, TError, {
|
|
134
134
|
assetId: string;
|
package/asset/asset.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryMutator
|
|
3
|
+
} from "../chunk-YEX2SGER.js";
|
|
1
4
|
import {
|
|
2
5
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3RNIDX7T.js";
|
|
4
7
|
|
|
5
8
|
// src/asset/asset.ts
|
|
6
9
|
import { useQuery, useMutation } from "@tanstack/react-query";
|
|
@@ -20,12 +23,11 @@ var useGetAsset = (params, options) => {
|
|
|
20
23
|
const queryFn = ({
|
|
21
24
|
signal
|
|
22
25
|
}) => getAsset(params, requestOptions, signal);
|
|
26
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
23
27
|
const query = useQuery(
|
|
24
|
-
|
|
25
|
-
queryFn,
|
|
26
|
-
queryOptions
|
|
28
|
+
customOptions
|
|
27
29
|
);
|
|
28
|
-
query.queryKey = queryKey;
|
|
30
|
+
query.queryKey = customOptions.queryKey;
|
|
29
31
|
return query;
|
|
30
32
|
};
|
|
31
33
|
var createAsset = (assetPostBodyBody, options) => {
|
package/asset/asset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.10.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 Assets\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) => [\n `/asset`,\n ...(params ? [params] : []),\n];\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\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 = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getAsset>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a known Asset. Assets that are attached to merchants cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Attaches an Asset to a merchant\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Detaches an Asset from a merchant\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAmC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CAAC,WAA4B;AAAA,EAC9D;AAAA,EACA,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC;AAC3B;AAOO,IAAM,cAAc,CAIzB,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB,MAAM;AAErE,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAE7C,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,mBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9B,WAAS,OAAO,QAAQ,kBAAkB,IAAI;AAC9C,MAAI,kBAAkB,iBAAiB,QAAW;AAChD,aAAS,OAAO,gBAAgB,kBAAkB,YAAY;AAAA,EAChE;AACA,MAAI,kBAAkB,mBAAmB,QAAW;AAClD,aAAS,OAAO,kBAAkB,kBAAkB,cAAc;AAAA,EACpE;AACA,WAAS,OAAO,SAAS,kBAAk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EAC5C;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,cAAc,CACzB,SACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,kBAAkB,QAAQ,SAAS,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,cAAc,CACzB,SACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,kBAAkB,QAAQ,SAAS,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\n\n// eslint-disable-next-line\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 Assets\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) => [\n `/asset`,\n ...(params ? [params] : []),\n];\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\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 = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getAsset>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a known Asset. Assets that are attached to merchants cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Attaches an Asset to a merchant\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Detaches an Asset from a merchant\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AAoC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CAAC,WAA4B;AAAA,EAC9D;AAAA,EACA,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC;AAC3B;AAOO,IAAM,cAAc,CAIzB,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB,MA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AGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/queryMutator.ts
|
|
2
|
+
var queryMutator = (args) => {
|
|
3
|
+
if (args.queryKey) {
|
|
4
|
+
args.queryKey.unshift('"account-server-api"');
|
|
5
|
+
return args;
|
|
6
|
+
}
|
|
7
|
+
return args;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.queryMutator = queryMutator;
|
|
13
|
+
//# sourceMappingURL=chunk-7XN3IQYV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/queryMutator.ts"],"names":[],"mappings":";AAEO,IAAM,eAAe,CAAI,SAAe;AAC7C,MAAK,KAAyB,UAAU;AACtC,IAAC,KAAa,SAAS,QAAQ,sBAAsB;AACrD,WAAO;AAAA,EACT;AAEA,SAAO;AACT","sourcesContent":["import { UseQueryOptions } from '@tanstack/react-query';\n\nexport const queryMutator = <T>(args: T): T => {\n if ((args as UseQueryOptions).queryKey) {\n (args as any).queryKey.unshift('\"account-server-api\"');\n return args;\n }\n\n return args;\n};\n\nexport default queryMutator;\n"]}
|
|
@@ -24,4 +24,4 @@ var customInstance = (config, options) => {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-UZTHSGDT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/queryMutator.ts"],"sourcesContent":["import { UseQueryOptions } from '@tanstack/react-query';\n\nexport const queryMutator = <T>(args: T): T => {\n if ((args as UseQueryOptions).queryKey) {\n (args as any).queryKey.unshift('\"account-server-api\"');\n return args;\n }\n\n return args;\n};\n\nexport default queryMutator;\n"],"mappings":";AAEO,IAAM,eAAe,CAAI,SAAe;AAC7C,MAAK,KAAyB,UAAU;AACtC,IAAC,KAAa,SAAS,QAAQ,sBAAsB;AACrD,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|