@squonk/account-server-client 4.3.1 → 4.4.0-4-4.2174798239
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/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/api/actions/actions.cjs +85 -0
- package/dist/api/actions/actions.cjs.map +1 -0
- package/dist/api/actions/actions.d.cts +74 -0
- package/dist/api/actions/actions.d.cts.map +1 -0
- package/dist/api/actions/actions.d.ts +74 -0
- package/dist/api/actions/actions.d.ts.map +1 -0
- package/dist/api/actions/actions.js +79 -0
- package/dist/api/actions/actions.js.map +1 -0
- package/dist/api/api.schemas.cjs +142 -0
- package/dist/api/api.schemas.cjs.map +1 -0
- package/dist/api/api.schemas.d.cts +1032 -0
- package/dist/api/api.schemas.d.cts.map +1 -0
- package/dist/api/api.schemas.d.ts +1032 -0
- package/dist/api/api.schemas.d.ts.map +1 -0
- package/dist/api/api.schemas.js +118 -0
- package/dist/api/api.schemas.js.map +1 -0
- package/dist/api/asset/asset.cjs +464 -0
- package/dist/api/asset/asset.cjs.map +1 -0
- package/{asset → dist/api/asset}/asset.d.cts +132 -130
- package/dist/api/asset/asset.d.cts.map +1 -0
- package/{asset → dist/api/asset}/asset.d.ts +132 -130
- package/dist/api/asset/asset.d.ts.map +1 -0
- package/dist/api/asset/asset.js +431 -0
- package/dist/api/asset/asset.js.map +1 -0
- package/dist/api/charges/charges.cjs +272 -0
- package/dist/api/charges/charges.cjs.map +1 -0
- package/{charges → dist/api/charges}/charges.d.cts +106 -104
- package/dist/api/charges/charges.d.cts.map +1 -0
- package/{charges → dist/api/charges}/charges.d.ts +106 -104
- package/dist/api/charges/charges.d.ts.map +1 -0
- package/dist/api/charges/charges.js +248 -0
- package/dist/api/charges/charges.js.map +1 -0
- package/dist/api/event-stream/event-stream.cjs +230 -0
- package/dist/api/event-stream/event-stream.cjs.map +1 -0
- package/{event-stream → dist/api/event-stream}/event-stream.d.cts +75 -73
- package/dist/api/event-stream/event-stream.d.cts.map +1 -0
- package/{event-stream → dist/api/event-stream}/event-stream.d.ts +75 -73
- package/dist/api/event-stream/event-stream.d.ts.map +1 -0
- package/dist/api/event-stream/event-stream.js +212 -0
- package/dist/api/event-stream/event-stream.js.map +1 -0
- package/dist/api/merchant/merchant.cjs +139 -0
- package/dist/api/merchant/merchant.cjs.map +1 -0
- package/{merchant → dist/api/merchant}/merchant.d.cts +56 -54
- package/dist/api/merchant/merchant.d.cts.map +1 -0
- package/{merchant → dist/api/merchant}/merchant.d.ts +56 -54
- package/dist/api/merchant/merchant.d.ts.map +1 -0
- package/dist/api/merchant/merchant.js +127 -0
- package/dist/api/merchant/merchant.js.map +1 -0
- package/dist/api/organisation/organisation.cjs +341 -0
- package/dist/api/organisation/organisation.cjs.map +1 -0
- package/{organisation → dist/api/organisation}/organisation.d.cts +112 -110
- package/dist/api/organisation/organisation.d.cts.map +1 -0
- package/{organisation → dist/api/organisation}/organisation.d.ts +112 -110
- package/dist/api/organisation/organisation.d.ts.map +1 -0
- package/dist/api/organisation/organisation.js +314 -0
- package/dist/api/organisation/organisation.js.map +1 -0
- package/dist/api/product/product.cjs +513 -0
- package/dist/api/product/product.cjs.map +1 -0
- package/{product → dist/api/product}/product.d.cts +188 -186
- package/dist/api/product/product.d.cts.map +1 -0
- package/{product → dist/api/product}/product.d.ts +188 -186
- package/dist/api/product/product.d.ts.map +1 -0
- package/dist/api/product/product.js +468 -0
- package/dist/api/product/product.js.map +1 -0
- package/dist/api/state/state.cjs +76 -0
- package/dist/api/state/state.cjs.map +1 -0
- package/dist/api/state/state.d.cts +66 -0
- package/dist/api/state/state.d.cts.map +1 -0
- package/dist/api/state/state.d.ts +66 -0
- package/dist/api/state/state.d.ts.map +1 -0
- package/dist/api/state/state.js +70 -0
- package/dist/api/state/state.js.map +1 -0
- package/dist/api/unit/unit.cjs +568 -0
- package/dist/api/unit/unit.cjs.map +1 -0
- package/{unit → dist/api/unit}/unit.d.cts +167 -165
- package/dist/api/unit/unit.d.cts.map +1 -0
- package/{unit → dist/api/unit}/unit.d.ts +167 -165
- package/dist/api/unit/unit.d.ts.map +1 -0
- package/dist/api/unit/unit.js +523 -0
- package/dist/api/unit/unit.js.map +1 -0
- package/dist/api/user/user.cjs +380 -0
- package/dist/api/user/user.cjs.map +1 -0
- package/{user → dist/api/user}/user.d.cts +129 -127
- package/dist/api/user/user.d.cts.map +1 -0
- package/{user → dist/api/user}/user.d.ts +129 -127
- package/dist/api/user/user.d.ts.map +1 -0
- package/dist/api/user/user.js +350 -0
- package/dist/api/user/user.js.map +1 -0
- package/dist/custom-instance.cjs +49 -0
- package/dist/custom-instance.cjs.map +1 -0
- package/dist/custom-instance.d.cts +22 -0
- package/dist/custom-instance.d.cts.map +1 -0
- package/dist/custom-instance.d.ts +22 -0
- package/dist/custom-instance.d.ts.map +1 -0
- package/dist/custom-instance.js +44 -0
- package/dist/custom-instance.js.map +1 -0
- package/dist/index.cjs +31 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/options-mutator.cjs +24 -0
- package/dist/options-mutator.cjs.map +1 -0
- package/dist/options-mutator.js +23 -0
- package/dist/options-mutator.js.map +1 -0
- package/orval.config.ts +24 -0
- package/package.json +163 -16
- package/pnpm-workspace.yaml +3 -0
- package/src/api/actions/actions.ts +249 -0
- package/src/{account-server-api.schemas.ts → api/api.schemas.ts} +82 -2
- package/src/{asset → api/asset}/asset.ts +8 -8
- package/src/{charges → api/charges}/charges.ts +9 -9
- package/src/{event-stream → api/event-stream}/event-stream.ts +7 -7
- package/src/{merchant → api/merchant}/merchant.ts +7 -7
- package/src/{organisation → api/organisation}/organisation.ts +8 -8
- package/src/{product → api/product}/product.ts +10 -10
- package/src/{state → api/state}/state.ts +6 -6
- package/src/{unit → api/unit}/unit.ts +9 -9
- package/src/{user → api/user}/user.ts +9 -9
- package/src/index.ts +2 -2
- package/src/options-mutator.ts +2 -2
- package/tsconfig.json +29 -0
- package/tsdown.config.ts +52 -0
- package/asset/asset.cjs +0 -281
- package/asset/asset.cjs.map +0 -1
- package/asset/asset.js +0 -281
- package/asset/asset.js.map +0 -1
- package/asset/package.json +0 -7
- package/charges/charges.cjs +0 -176
- package/charges/charges.cjs.map +0 -1
- package/charges/charges.js +0 -176
- package/charges/charges.js.map +0 -1
- package/charges/package.json +0 -7
- package/chunk-3WKSNKHE.js +0 -25
- package/chunk-3WKSNKHE.js.map +0 -1
- package/chunk-NY2VJJG7.cjs +0 -25
- package/chunk-NY2VJJG7.cjs.map +0 -1
- package/chunk-RB2KVIEK.cjs +0 -27
- package/chunk-RB2KVIEK.cjs.map +0 -1
- package/chunk-XYDLYMQ2.js +0 -27
- package/chunk-XYDLYMQ2.js.map +0 -1
- package/event-stream/event-stream.cjs +0 -144
- package/event-stream/event-stream.cjs.map +0 -1
- package/event-stream/event-stream.js +0 -144
- package/event-stream/event-stream.js.map +0 -1
- package/event-stream/package.json +0 -7
- package/index.cjs +0 -142
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -979
- package/index.d.ts +0 -979
- package/index.js +0 -142
- package/index.js.map +0 -1
- package/merchant/merchant.cjs +0 -91
- package/merchant/merchant.cjs.map +0 -1
- package/merchant/merchant.js +0 -91
- package/merchant/merchant.js.map +0 -1
- package/merchant/package.json +0 -7
- package/organisation/organisation.cjs +0 -213
- package/organisation/organisation.cjs.map +0 -1
- package/organisation/organisation.js +0 -213
- package/organisation/organisation.js.map +0 -1
- package/organisation/package.json +0 -7
- package/product/package.json +0 -7
- package/product/product.cjs +0 -341
- package/product/product.cjs.map +0 -1
- package/product/product.js +0 -341
- package/product/product.js.map +0 -1
- package/state/package.json +0 -7
- package/state/state.cjs +0 -53
- package/state/state.cjs.map +0 -1
- package/state/state.d.cts +0 -64
- package/state/state.d.ts +0 -64
- package/state/state.js +0 -53
- package/state/state.js.map +0 -1
- package/unit/package.json +0 -7
- package/unit/unit.cjs +0 -339
- package/unit/unit.cjs.map +0 -1
- package/unit/unit.js +0 -339
- package/unit/unit.js.map +0 -1
- package/user/package.json +0 -7
- package/user/user.cjs +0 -226
- package/user/user.cjs.map +0 -1
- package/user/user.js +0 -226
- package/user/user.js.map +0 -1
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
export interface AsError {
|
|
12
12
|
/** Brief error text that can be presented to the user */
|
|
13
13
|
error: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface ActionGetResponse {
|
|
17
|
+
/** A list of Actions
|
|
18
|
+
*/
|
|
19
|
+
actions: ActionDetail[];
|
|
20
|
+
/** The number of Actions returned
|
|
21
|
+
*/
|
|
22
|
+
count: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ActionDetail {
|
|
26
|
+
id: number;
|
|
27
|
+
action: string;
|
|
28
|
+
content: string;
|
|
29
|
+
timestamp: string;
|
|
30
|
+
merchant?: MerchantSummary;
|
|
31
|
+
product_id?: string;
|
|
32
|
+
unit_id?: string;
|
|
33
|
+
org_id?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
16
36
|
export type AssetGetByIdResponse = AssetDetail;
|
|
17
37
|
|
|
18
38
|
export interface AssetGetResponse {
|
|
@@ -630,6 +650,23 @@ export interface MerchantDetail {
|
|
|
630
650
|
api_hostname: string;
|
|
631
651
|
}
|
|
632
652
|
|
|
653
|
+
/**
|
|
654
|
+
* The kind of Service
|
|
655
|
+
*/
|
|
656
|
+
export type MerchantSummaryKind = (typeof MerchantSummaryKind)[keyof typeof MerchantSummaryKind];
|
|
657
|
+
|
|
658
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
659
|
+
export const MerchantSummaryKind = { DATA_MANAGER: "DATA_MANAGER" } as const;
|
|
660
|
+
|
|
661
|
+
export interface MerchantSummary {
|
|
662
|
+
/** The unique ID of the Merchant */
|
|
663
|
+
id: number;
|
|
664
|
+
/** The kind of Service */
|
|
665
|
+
kind: MerchantSummaryKind;
|
|
666
|
+
/** The name assigned to the Service */
|
|
667
|
+
name: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
633
670
|
/**
|
|
634
671
|
* The Unit's default product privacy setting
|
|
635
672
|
*/
|
|
@@ -985,6 +1022,14 @@ export type QProductIdParameter = string;
|
|
|
985
1022
|
*/
|
|
986
1023
|
export type QUserIdParameter = string;
|
|
987
1024
|
|
|
1025
|
+
export type QFormatParameter = (typeof QFormatParameter)[keyof typeof QFormatParameter];
|
|
1026
|
+
|
|
1027
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1028
|
+
export const QFormatParameter = {
|
|
1029
|
+
PROTOCOL_STRING: "PROTOCOL_STRING",
|
|
1030
|
+
JSON_STRING: "JSON_STRING",
|
|
1031
|
+
} as const;
|
|
1032
|
+
|
|
988
1033
|
/**
|
|
989
1034
|
* A date from which to retrieve assets. Any asset that occurs on ar after this date will be returned. UTC is assumed if no timezone is provided
|
|
990
1035
|
*/
|
|
@@ -1117,3 +1162,38 @@ export type DetachAssetParams = {
|
|
|
1117
1162
|
*/
|
|
1118
1163
|
m_id?: QMIdParameter;
|
|
1119
1164
|
};
|
|
1165
|
+
|
|
1166
|
+
export type GetActionsParams = {
|
|
1167
|
+
/**
|
|
1168
|
+
* The required format for delivered content.
|
|
1169
|
+
*/
|
|
1170
|
+
format?: QFormatParameter;
|
|
1171
|
+
/**
|
|
1172
|
+
* A date from which to retrieve assets. Any asset that occurs on ar after this date will be returned. UTC is assumed if no timezone is provided
|
|
1173
|
+
*/
|
|
1174
|
+
from?: QFromParameter;
|
|
1175
|
+
/**
|
|
1176
|
+
* A Merchant Identity
|
|
1177
|
+
* @minimum 1
|
|
1178
|
+
*/
|
|
1179
|
+
m_id?: QMIdParameter;
|
|
1180
|
+
/**
|
|
1181
|
+
* An Organisation Identity
|
|
1182
|
+
* @pattern ^org-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
|
|
1183
|
+
*/
|
|
1184
|
+
org_id?: QOrgIdParameter;
|
|
1185
|
+
/**
|
|
1186
|
+
* A Product Identity
|
|
1187
|
+
* @pattern ^product-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
|
|
1188
|
+
*/
|
|
1189
|
+
product_id?: QProductIdParameter;
|
|
1190
|
+
/**
|
|
1191
|
+
* A date where assets prior to this will be returned. Any asset that occurs prior this date will be returned. UTC is assumed if no timezone is provided
|
|
1192
|
+
*/
|
|
1193
|
+
until?: QUntilParameter;
|
|
1194
|
+
/**
|
|
1195
|
+
* A Unit Identity
|
|
1196
|
+
* @pattern ^unit-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
|
|
1197
|
+
*/
|
|
1198
|
+
unit_id?: QUnitIdParameter;
|
|
1199
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -36,12 +36,12 @@ import type {
|
|
|
36
36
|
AttachAssetParams,
|
|
37
37
|
DetachAssetParams,
|
|
38
38
|
GetAssetParams,
|
|
39
|
-
} from "../
|
|
39
|
+
} from "../api.schemas";
|
|
40
40
|
|
|
41
|
-
import { customInstance } from "
|
|
42
|
-
import type { ErrorType } from "
|
|
43
|
-
import { queryMutator } from "
|
|
44
|
-
import { mutationMutator } from "
|
|
41
|
+
import { customInstance } from "../../custom-instance";
|
|
42
|
+
import type { ErrorType } from "../../custom-instance";
|
|
43
|
+
import { queryMutator } from "../../options-mutator";
|
|
44
|
+
import { mutationMutator } from "../../options-mutator";
|
|
45
45
|
|
|
46
46
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
47
47
|
|
|
@@ -380,7 +380,7 @@ export const getSpecificAsset = (
|
|
|
380
380
|
return customInstance<AssetDetail>({ url: `/asset/${assetId}`, method: "GET", signal }, options);
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
-
export const getGetSpecificAssetQueryKey = (assetId
|
|
383
|
+
export const getGetSpecificAssetQueryKey = (assetId?: string) => {
|
|
384
384
|
return [`/asset/${assetId}`] as const;
|
|
385
385
|
};
|
|
386
386
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -33,11 +33,11 @@ import type {
|
|
|
33
33
|
OrganisationChargesGetResponse,
|
|
34
34
|
ProductChargesGetResponse,
|
|
35
35
|
UnitChargesGetResponse,
|
|
36
|
-
} from "../
|
|
36
|
+
} from "../api.schemas";
|
|
37
37
|
|
|
38
|
-
import { customInstance } from "
|
|
39
|
-
import type { ErrorType } from "
|
|
40
|
-
import { queryMutator } from "
|
|
38
|
+
import { customInstance } from "../../custom-instance";
|
|
39
|
+
import type { ErrorType } from "../../custom-instance";
|
|
40
|
+
import { queryMutator } from "../../options-mutator";
|
|
41
41
|
|
|
42
42
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
43
43
|
|
|
@@ -274,7 +274,7 @@ export const getOrganisationCharges = (
|
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
export const getGetOrganisationChargesQueryKey = (
|
|
277
|
-
orgId
|
|
277
|
+
orgId?: string,
|
|
278
278
|
params?: GetOrganisationChargesParams,
|
|
279
279
|
) => {
|
|
280
280
|
return [`/charges/organisation/${orgId}`, ...(params ? [params] : [])] as const;
|
|
@@ -530,7 +530,7 @@ export const getProductCharges = (
|
|
|
530
530
|
};
|
|
531
531
|
|
|
532
532
|
export const getGetProductChargesQueryKey = (
|
|
533
|
-
productId
|
|
533
|
+
productId?: string,
|
|
534
534
|
params?: GetProductChargesParams,
|
|
535
535
|
) => {
|
|
536
536
|
return [`/charges/product/${productId}`, ...(params ? [params] : [])] as const;
|
|
@@ -774,7 +774,7 @@ export const getUnitCharges = (
|
|
|
774
774
|
);
|
|
775
775
|
};
|
|
776
776
|
|
|
777
|
-
export const getGetUnitChargesQueryKey = (unitId
|
|
777
|
+
export const getGetUnitChargesQueryKey = (unitId?: string, params?: GetUnitChargesParams) => {
|
|
778
778
|
return [`/charges/unit/${unitId}`, ...(params ? [params] : [])] as const;
|
|
779
779
|
};
|
|
780
780
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -31,12 +31,12 @@ import type {
|
|
|
31
31
|
EventStreamGetPostResponse,
|
|
32
32
|
EventStreamPostBodyBody,
|
|
33
33
|
EventStreamVersionGetResponse,
|
|
34
|
-
} from "../
|
|
34
|
+
} from "../api.schemas";
|
|
35
35
|
|
|
36
|
-
import { customInstance } from "
|
|
37
|
-
import type { ErrorType } from "
|
|
38
|
-
import { queryMutator } from "
|
|
39
|
-
import { mutationMutator } from "
|
|
36
|
+
import { customInstance } from "../../custom-instance";
|
|
37
|
+
import type { ErrorType } from "../../custom-instance";
|
|
38
|
+
import { queryMutator } from "../../options-mutator";
|
|
39
|
+
import { mutationMutator } from "../../options-mutator";
|
|
40
40
|
|
|
41
41
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
42
42
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -23,11 +23,11 @@ import type {
|
|
|
23
23
|
UseSuspenseQueryResult,
|
|
24
24
|
} from "@tanstack/react-query";
|
|
25
25
|
|
|
26
|
-
import type { AsError, MerchantDetail, MerchantsGetResponse } from "../
|
|
26
|
+
import type { AsError, MerchantDetail, MerchantsGetResponse } from "../api.schemas";
|
|
27
27
|
|
|
28
|
-
import { customInstance } from "
|
|
29
|
-
import type { ErrorType } from "
|
|
30
|
-
import { queryMutator } from "
|
|
28
|
+
import { customInstance } from "../../custom-instance";
|
|
29
|
+
import type { ErrorType } from "../../custom-instance";
|
|
30
|
+
import { queryMutator } from "../../options-mutator";
|
|
31
31
|
|
|
32
32
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
33
33
|
|
|
@@ -252,7 +252,7 @@ export const getService = (
|
|
|
252
252
|
);
|
|
253
253
|
};
|
|
254
254
|
|
|
255
|
-
export const getGetServiceQueryKey = (mId
|
|
255
|
+
export const getGetServiceQueryKey = (mId?: number) => {
|
|
256
256
|
return [`/merchant/${mId}`] as const;
|
|
257
257
|
};
|
|
258
258
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -35,12 +35,12 @@ import type {
|
|
|
35
35
|
OrganisationPostBodyBody,
|
|
36
36
|
OrganisationPostResponse,
|
|
37
37
|
OrganisationsGetResponse,
|
|
38
|
-
} from "../
|
|
38
|
+
} from "../api.schemas";
|
|
39
39
|
|
|
40
|
-
import { customInstance } from "
|
|
41
|
-
import type { ErrorType } from "
|
|
42
|
-
import { queryMutator } from "
|
|
43
|
-
import { mutationMutator } from "
|
|
40
|
+
import { customInstance } from "../../custom-instance";
|
|
41
|
+
import type { ErrorType } from "../../custom-instance";
|
|
42
|
+
import { queryMutator } from "../../options-mutator";
|
|
43
|
+
import { mutationMutator } from "../../options-mutator";
|
|
44
44
|
|
|
45
45
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
46
46
|
|
|
@@ -383,7 +383,7 @@ export const getOrganisation = (
|
|
|
383
383
|
);
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
-
export const getGetOrganisationQueryKey = (orgId
|
|
386
|
+
export const getGetOrganisationQueryKey = (orgId?: string) => {
|
|
387
387
|
return [`/organisation/${orgId}`] as const;
|
|
388
388
|
};
|
|
389
389
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -35,12 +35,12 @@ import type {
|
|
|
35
35
|
ProductsGetTypesResponse,
|
|
36
36
|
UnitProductPostBodyBody,
|
|
37
37
|
UnitProductPostResponse,
|
|
38
|
-
} from "../
|
|
38
|
+
} from "../api.schemas";
|
|
39
39
|
|
|
40
|
-
import { customInstance } from "
|
|
41
|
-
import type { ErrorType } from "
|
|
42
|
-
import { queryMutator } from "
|
|
43
|
-
import { mutationMutator } from "
|
|
40
|
+
import { customInstance } from "../../custom-instance";
|
|
41
|
+
import type { ErrorType } from "../../custom-instance";
|
|
42
|
+
import { queryMutator } from "../../options-mutator";
|
|
43
|
+
import { mutationMutator } from "../../options-mutator";
|
|
44
44
|
|
|
45
45
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
46
46
|
|
|
@@ -711,7 +711,7 @@ export const getProductsForOrganisation = (
|
|
|
711
711
|
);
|
|
712
712
|
};
|
|
713
713
|
|
|
714
|
-
export const getGetProductsForOrganisationQueryKey = (orgId
|
|
714
|
+
export const getGetProductsForOrganisationQueryKey = (orgId?: string) => {
|
|
715
715
|
return [`/product/organisation/${orgId}`] as const;
|
|
716
716
|
};
|
|
717
717
|
|
|
@@ -1049,7 +1049,7 @@ export const getProductsForUnit = (
|
|
|
1049
1049
|
);
|
|
1050
1050
|
};
|
|
1051
1051
|
|
|
1052
|
-
export const getGetProductsForUnitQueryKey = (unitId
|
|
1052
|
+
export const getGetProductsForUnitQueryKey = (unitId?: string) => {
|
|
1053
1053
|
return [`/product/unit/${unitId}`] as const;
|
|
1054
1054
|
};
|
|
1055
1055
|
|
|
@@ -1278,7 +1278,7 @@ export const getProduct = (
|
|
|
1278
1278
|
);
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
|
-
export const getGetProductQueryKey = (productId
|
|
1281
|
+
export const getGetProductQueryKey = (productId?: string) => {
|
|
1282
1282
|
return [`/product/${productId}`] as const;
|
|
1283
1283
|
};
|
|
1284
1284
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -23,11 +23,11 @@ import type {
|
|
|
23
23
|
UseSuspenseQueryResult,
|
|
24
24
|
} from "@tanstack/react-query";
|
|
25
25
|
|
|
26
|
-
import type { AsError, StateGetVersionResponse } from "../
|
|
26
|
+
import type { AsError, StateGetVersionResponse } from "../api.schemas";
|
|
27
27
|
|
|
28
|
-
import { customInstance } from "
|
|
29
|
-
import type { ErrorType } from "
|
|
30
|
-
import { queryMutator } from "
|
|
28
|
+
import { customInstance } from "../../custom-instance";
|
|
29
|
+
import type { ErrorType } from "../../custom-instance";
|
|
30
|
+
import { queryMutator } from "../../options-mutator";
|
|
31
31
|
|
|
32
32
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
33
33
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -37,12 +37,12 @@ import type {
|
|
|
37
37
|
UnitAllDetail,
|
|
38
38
|
UnitPatchBodyBody,
|
|
39
39
|
UnitsGetResponse,
|
|
40
|
-
} from "../
|
|
40
|
+
} from "../api.schemas";
|
|
41
41
|
|
|
42
|
-
import { customInstance } from "
|
|
43
|
-
import type { ErrorType } from "
|
|
44
|
-
import { queryMutator } from "
|
|
45
|
-
import { mutationMutator } from "
|
|
42
|
+
import { customInstance } from "../../custom-instance";
|
|
43
|
+
import type { ErrorType } from "../../custom-instance";
|
|
44
|
+
import { queryMutator } from "../../options-mutator";
|
|
45
|
+
import { mutationMutator } from "../../options-mutator";
|
|
46
46
|
|
|
47
47
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
48
48
|
|
|
@@ -62,7 +62,7 @@ export const getOrganisationUnits = (
|
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
export const getGetOrganisationUnitsQueryKey = (orgId
|
|
65
|
+
export const getGetOrganisationUnitsQueryKey = (orgId?: string) => {
|
|
66
66
|
return [`/organisation/${orgId}/unit`] as const;
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -391,7 +391,7 @@ export const getUnit = (
|
|
|
391
391
|
return customInstance<UnitAllDetail>({ url: `/unit/${unitId}`, method: "GET", signal }, options);
|
|
392
392
|
};
|
|
393
393
|
|
|
394
|
-
export const getGetUnitQueryKey = (unitId
|
|
394
|
+
export const getGetUnitQueryKey = (unitId?: string) => {
|
|
395
395
|
return [`/unit/${unitId}`] as const;
|
|
396
396
|
};
|
|
397
397
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.16.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -26,12 +26,12 @@ import type {
|
|
|
26
26
|
UseSuspenseQueryResult,
|
|
27
27
|
} from "@tanstack/react-query";
|
|
28
28
|
|
|
29
|
-
import type { AsError, UserAccountDetail, UsersGetResponse } from "../
|
|
29
|
+
import type { AsError, UserAccountDetail, UsersGetResponse } from "../api.schemas";
|
|
30
30
|
|
|
31
|
-
import { customInstance } from "
|
|
32
|
-
import type { ErrorType } from "
|
|
33
|
-
import { queryMutator } from "
|
|
34
|
-
import { mutationMutator } from "
|
|
31
|
+
import { customInstance } from "../../custom-instance";
|
|
32
|
+
import type { ErrorType } from "../../custom-instance";
|
|
33
|
+
import { queryMutator } from "../../options-mutator";
|
|
34
|
+
import { mutationMutator } from "../../options-mutator";
|
|
35
35
|
|
|
36
36
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
37
37
|
|
|
@@ -265,7 +265,7 @@ export const getOrganisationUsers = (
|
|
|
265
265
|
);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
export const getGetOrganisationUsersQueryKey = (orgId
|
|
268
|
+
export const getGetOrganisationUsersQueryKey = (orgId?: string) => {
|
|
269
269
|
return [`/organisation/${orgId}/user`] as const;
|
|
270
270
|
};
|
|
271
271
|
|
|
@@ -678,7 +678,7 @@ export const getOrganisationUnitUsers = (
|
|
|
678
678
|
);
|
|
679
679
|
};
|
|
680
680
|
|
|
681
|
-
export const getGetOrganisationUnitUsersQueryKey = (unitId
|
|
681
|
+
export const getGetOrganisationUnitUsersQueryKey = (unitId?: string) => {
|
|
682
682
|
return [`/unit/${unitId}/user`] as const;
|
|
683
683
|
};
|
|
684
684
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by orval
|
|
2
|
-
//
|
|
3
|
-
export * from "./
|
|
2
|
+
// API_TARGET_NAME Is replaced with the api name
|
|
3
|
+
export * from "./api/api.schemas";
|
|
4
4
|
|
|
5
5
|
// Request instance and methods to change the baseUrl and auth token
|
|
6
6
|
export * from "./custom-instance";
|
package/src/options-mutator.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const queryMutator = <TQueryFnData, TError, TData>({
|
|
|
4
4
|
queryKey,
|
|
5
5
|
...queryOptions
|
|
6
6
|
}: UseQueryOptions<TQueryFnData, TError, TData>): UseQueryOptions<TQueryFnData, TError, TData> => {
|
|
7
|
-
const newQueryKey = ["
|
|
7
|
+
const newQueryKey = ["API_TARGET_NAME", ...queryKey];
|
|
8
8
|
return { queryKey: newQueryKey, ...queryOptions };
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ export const mutationMutator = <TData, TError, TVariables, TContext>({
|
|
|
18
18
|
TContext
|
|
19
19
|
> => {
|
|
20
20
|
if (Array.isArray(mutationKey)) {
|
|
21
|
-
const newMutationKey = ["
|
|
21
|
+
const newMutationKey = ["API_TARGET_NAME", ...mutationKey];
|
|
22
22
|
return { mutationKey: newMutationKey, ...mutationOptions };
|
|
23
23
|
}
|
|
24
24
|
return { mutationKey: undefined, ...mutationOptions };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
|
|
13
|
+
/* Strictness */
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"noImplicitOverride": true,
|
|
17
|
+
|
|
18
|
+
/* AND if you're building for a library: */
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"declarationMap": true,
|
|
21
|
+
|
|
22
|
+
/* If NOT transpiling with TypeScript: */
|
|
23
|
+
"module": "preserve",
|
|
24
|
+
"noEmit": true,
|
|
25
|
+
|
|
26
|
+
/* If your code runs in the DOM: */
|
|
27
|
+
"lib": ["es2022", "dom", "dom.iterable"]
|
|
28
|
+
}
|
|
29
|
+
}
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineConfig } from "tsdown";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ["src/index.ts", "src/api/*/*.ts"],
|
|
5
|
+
dts: true,
|
|
6
|
+
format: ["cjs", "esm"],
|
|
7
|
+
target: "es2022",
|
|
8
|
+
platform: "neutral",
|
|
9
|
+
sourcemap: true,
|
|
10
|
+
unbundle: true,
|
|
11
|
+
exports: {
|
|
12
|
+
customExports(pkg, context) {
|
|
13
|
+
// Create simplified export paths for API modules (e.g., "./accounting" instead of "./api/accounting/accounting")
|
|
14
|
+
// Dynamically discovers modules from build output and includes proper type definitions for both ESM and CJS
|
|
15
|
+
|
|
16
|
+
// Extract module names from the build chunks
|
|
17
|
+
const modules = new Set<string>();
|
|
18
|
+
|
|
19
|
+
// Get chunks from all formats and extract module names
|
|
20
|
+
for (const format in context.chunks) {
|
|
21
|
+
const chunks = context.chunks[format as keyof typeof context.chunks];
|
|
22
|
+
if (chunks) {
|
|
23
|
+
for (const chunk of chunks) {
|
|
24
|
+
if (chunk.type === "chunk" && chunk.fileName) {
|
|
25
|
+
// Match pattern: api/{moduleName}/{moduleName}.js (or .cjs)
|
|
26
|
+
const match = chunk.fileName.match(/^api\/([^/]+)\/\1\.(js|cjs)$/);
|
|
27
|
+
if (match && match[1]) {
|
|
28
|
+
modules.add(match[1]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// For each module, create a simplified export path
|
|
36
|
+
for (const moduleName of modules) {
|
|
37
|
+
pkg[`./${moduleName}`] = {
|
|
38
|
+
import: {
|
|
39
|
+
types: `./dist/api/${moduleName}/${moduleName}.d.ts`,
|
|
40
|
+
default: `./dist/api/${moduleName}/${moduleName}.js`,
|
|
41
|
+
},
|
|
42
|
+
require: {
|
|
43
|
+
types: `./dist/api/${moduleName}/${moduleName}.d.cts`,
|
|
44
|
+
default: `./dist/api/${moduleName}/${moduleName}.cjs`,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return pkg;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|