@takaro/apiclient 0.0.0-dev.99783ba → 0.0.0-dev.99b576a
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/README.md +27 -0
- package/dist/generated/api.d.ts +16842 -8423
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/generated/api.js +12097 -6174
- package/dist/generated/api.js.map +1 -1
- package/dist/generated/configuration.js +1 -1
- package/dist/generated/configuration.js.map +1 -1
- package/dist/generated-management/api.d.ts +16126 -0
- package/dist/generated-management/api.d.ts.map +1 -0
- package/dist/generated-management/api.js +4090 -0
- package/dist/generated-management/api.js.map +1 -0
- package/dist/generated-management/base.d.ts +67 -0
- package/dist/generated-management/base.d.ts.map +1 -0
- package/dist/generated-management/base.js +59 -0
- package/dist/generated-management/base.js.map +1 -0
- package/dist/generated-management/common.d.ts +66 -0
- package/dist/generated-management/common.d.ts.map +1 -0
- package/dist/generated-management/common.js +135 -0
- package/dist/generated-management/common.js.map +1 -0
- package/dist/generated-management/configuration.d.ts +92 -0
- package/dist/generated-management/configuration.d.ts.map +1 -0
- package/dist/generated-management/configuration.js +46 -0
- package/dist/generated-management/configuration.js.map +1 -0
- package/dist/generated-management/index.d.ts +14 -0
- package/dist/generated-management/index.d.ts.map +1 -0
- package/{src/generated/index.ts → dist/generated-management/index.js} +1 -1
- package/dist/generated-management/index.js.map +1 -0
- package/dist/lib/adminClient.d.ts +3 -2
- package/dist/lib/adminClient.d.ts.map +1 -1
- package/dist/lib/adminClient.js +8 -2
- package/dist/lib/adminClient.js.map +1 -1
- package/dist/lib/apiKey.d.ts +18 -0
- package/dist/lib/apiKey.d.ts.map +1 -0
- package/dist/lib/apiKey.js +71 -0
- package/dist/lib/apiKey.js.map +1 -0
- package/dist/lib/baseClient.d.ts +15 -1
- package/dist/lib/baseClient.d.ts.map +1 -1
- package/dist/lib/baseClient.js +21 -2
- package/dist/lib/baseClient.js.map +1 -1
- package/dist/lib/client.d.ts +34 -3
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +66 -10
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/distributorClient.d.ts +18 -0
- package/dist/lib/distributorClient.d.ts.map +1 -0
- package/dist/lib/distributorClient.js +21 -0
- package/dist/lib/distributorClient.js.map +1 -0
- package/dist/lib/staffClient.d.ts +21 -0
- package/dist/lib/staffClient.d.ts.map +1 -0
- package/dist/lib/staffClient.js +31 -0
- package/dist/lib/staffClient.js.map +1 -0
- package/dist/main.d.ts +8 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -0
- package/dist/main.js.map +1 -1
- package/package.json +14 -6
- package/src/__tests__/main.integration.test.ts +0 -39
- package/src/generated/.openapi-generator-ignore +0 -23
- package/src/generated/api.ts +0 -33827
- package/src/generated/base.ts +0 -91
- package/src/generated/common.ts +0 -164
- package/src/generated/configuration.ts +0 -123
- package/src/generated/git_push.sh +0 -57
- package/src/lib/adminClient.ts +0 -37
- package/src/lib/baseClient.ts +0 -153
- package/src/lib/client.ts +0 -319
- package/src/main.ts +0 -9
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -8
- package/typedoc.json +0 -3
package/dist/lib/client.js
CHANGED
|
@@ -1,18 +1,57 @@
|
|
|
1
|
-
import { CronJobApi, FunctionApi, GameServerApi, RoleApi, UserApi, ModuleApi, HookApi, PlayerApi, SettingsApi, CommandApi, VariableApi, DiscordApi, EventApi, PlayerOnGameServerApi, ItemApi,
|
|
1
|
+
import { CronJobApi, FunctionApi, GameServerApi, RoleApi, UserApi, ModuleApi, HookApi, PlayerApi, SettingsApi, CommandApi, VariableApi, DiscordApi, EventApi, PlayerOnGameServerApi, ItemApi, ShopOrderApi, ShopListingApi, ShopCategoryApi, ShopActionApi, StorefrontConfigApi, StorefrontDomainApi, TrackingApi, EntityApi, AnalyticsApi, InviteLinkApi, ApiKeyApi, } from '../generated/api.js';
|
|
2
2
|
import { BaseApiClient } from './baseClient.js';
|
|
3
|
+
import { assertValidApiKey } from './apiKey.js';
|
|
3
4
|
export class Client extends BaseApiClient {
|
|
4
5
|
constructor(config) {
|
|
5
6
|
super(config);
|
|
7
|
+
// `token` and `apiKey` are mutually exclusive — both write the same Authorization header, so
|
|
8
|
+
// setting both means `apiKey` wins. Nothing passes both, and a caller that did would see an
|
|
9
|
+
// obvious 401 on its first call. `distributorKey` writes the same header again, but it is
|
|
10
|
+
// rejected outright rather than allowed to win silently: it is the newest of the three, so a
|
|
11
|
+
// caller combining them has a bug, and the symptom would otherwise be an opaque 401 much later.
|
|
6
12
|
if (this.config.auth.token) {
|
|
7
|
-
this.axios.defaults.headers.common
|
|
13
|
+
this.axios.defaults.headers.common.Authorization = `Bearer ${this.config.auth.token}`;
|
|
14
|
+
}
|
|
15
|
+
// Validated here rather than on first use: a mistyped key should fail where it was typed,
|
|
16
|
+
// not as an opaque 401 from some later call. The test is `!== undefined`, not truthiness: the
|
|
17
|
+
// commonest mistake of all is an unset `process.env.TAKARO_API_KEY`, and `''` or `null` must
|
|
18
|
+
// throw here rather than construct a client that quietly attaches no credential.
|
|
19
|
+
if (this.config.auth.apiKey !== undefined) {
|
|
20
|
+
assertValidApiKey(this.config.auth.apiKey);
|
|
21
|
+
this.axios.defaults.headers.common.Authorization = `Bearer ${this.config.auth.apiKey}`;
|
|
22
|
+
}
|
|
23
|
+
// White-label (GH #3839). `!== undefined` for the same reason the `apiKey` block gives: an unset
|
|
24
|
+
// env var must throw where it was typed, not construct a credential-less client.
|
|
25
|
+
if (this.config.auth.distributorKey !== undefined) {
|
|
26
|
+
if (this.config.auth.token !== undefined || this.config.auth.apiKey !== undefined) {
|
|
27
|
+
throw new Error('auth.distributorKey cannot be combined with auth.token or auth.apiKey');
|
|
28
|
+
}
|
|
29
|
+
if (!this.config.auth.domainId) {
|
|
30
|
+
throw new Error('auth.distributorKey requires auth.domainId: a Distributor key names the Domain it acts in');
|
|
31
|
+
}
|
|
32
|
+
// isValidApiKeyFormat matches the bare `takaro_` prefix plus the checksum, so a Distributor Key
|
|
33
|
+
// passes unchanged.
|
|
34
|
+
assertValidApiKey(this.config.auth.distributorKey);
|
|
35
|
+
this.axios.defaults.headers.common.Authorization = `Bearer ${this.config.auth.distributorKey}`;
|
|
36
|
+
this.setDomain(this.config.auth.domainId);
|
|
8
37
|
}
|
|
9
38
|
}
|
|
39
|
+
// The setters and login() below ARE the deprecated password mode's implementation, so they read
|
|
40
|
+
// the deprecated fields by construction; the rule would otherwise flag the feature for existing.
|
|
41
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
10
42
|
set username(username) {
|
|
11
43
|
this.config.auth.username = username;
|
|
12
44
|
}
|
|
13
45
|
set password(password) {
|
|
14
46
|
this.config.auth.password = password;
|
|
15
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Exchanges `auth.username` / `auth.password` for a token through Keycloak's
|
|
50
|
+
* resource-owner password grant, which exists for the hosted browser login page. Scripted
|
|
51
|
+
* callers should pass `auth.apiKey` (a Takaro API Key) to the constructor instead — no `login()`
|
|
52
|
+
* round trip, no user credential to store. See `docs/api/authentication.md`. This method is not
|
|
53
|
+
* being removed and existing callers keep working unchanged.
|
|
54
|
+
*/
|
|
16
55
|
async login() {
|
|
17
56
|
if (!this.config.auth.username || !this.config.auth.password) {
|
|
18
57
|
throw new Error('No username or password provided');
|
|
@@ -23,11 +62,12 @@ export class Client extends BaseApiClient {
|
|
|
23
62
|
});
|
|
24
63
|
this.config.auth.token = loginRes.data.data.token;
|
|
25
64
|
this.token = loginRes.data.data.token;
|
|
26
|
-
this.axios.defaults.headers.common
|
|
65
|
+
this.axios.defaults.headers.common.Authorization = `Bearer ${loginRes.data.data.token}`;
|
|
27
66
|
return loginRes.data.data.token;
|
|
28
67
|
}
|
|
68
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
29
69
|
logout() {
|
|
30
|
-
delete this.axios.defaults.headers.common
|
|
70
|
+
delete this.axios.defaults.headers.common.Authorization;
|
|
31
71
|
}
|
|
32
72
|
async permissionCodesToInputs(permissions) {
|
|
33
73
|
const permissionsRes = await this.role.roleControllerGetPermissions();
|
|
@@ -36,8 +76,9 @@ export class Client extends BaseApiClient {
|
|
|
36
76
|
.map((p) => ({
|
|
37
77
|
permissionId: p.id,
|
|
38
78
|
}));
|
|
39
|
-
if (records.length !== permissions.length)
|
|
79
|
+
if (records.length !== permissions.length) {
|
|
40
80
|
throw new Error(`Not all permissions were found: ${permissions.join(', ')}`);
|
|
81
|
+
}
|
|
41
82
|
return records;
|
|
42
83
|
}
|
|
43
84
|
get item() {
|
|
@@ -115,11 +156,6 @@ export class Client extends BaseApiClient {
|
|
|
115
156
|
isJsonMime: this.isJsonMime,
|
|
116
157
|
}, '', this.axios);
|
|
117
158
|
}
|
|
118
|
-
get stats() {
|
|
119
|
-
return new StatsApi({
|
|
120
|
-
isJsonMime: this.isJsonMime,
|
|
121
|
-
}, '', this.axios);
|
|
122
|
-
}
|
|
123
159
|
get shopListing() {
|
|
124
160
|
return new ShopListingApi({
|
|
125
161
|
isJsonMime: this.isJsonMime,
|
|
@@ -140,6 +176,16 @@ export class Client extends BaseApiClient {
|
|
|
140
176
|
isJsonMime: this.isJsonMime,
|
|
141
177
|
}, '', this.axios);
|
|
142
178
|
}
|
|
179
|
+
get storefrontConfig() {
|
|
180
|
+
return new StorefrontConfigApi({
|
|
181
|
+
isJsonMime: this.isJsonMime,
|
|
182
|
+
}, '', this.axios);
|
|
183
|
+
}
|
|
184
|
+
get storefrontDomain() {
|
|
185
|
+
return new StorefrontDomainApi({
|
|
186
|
+
isJsonMime: this.isJsonMime,
|
|
187
|
+
}, '', this.axios);
|
|
188
|
+
}
|
|
143
189
|
get tracking() {
|
|
144
190
|
return new TrackingApi({
|
|
145
191
|
isJsonMime: this.isJsonMime,
|
|
@@ -155,5 +201,15 @@ export class Client extends BaseApiClient {
|
|
|
155
201
|
isJsonMime: this.isJsonMime,
|
|
156
202
|
}, '', this.axios);
|
|
157
203
|
}
|
|
204
|
+
get inviteLink() {
|
|
205
|
+
return new InviteLinkApi({
|
|
206
|
+
isJsonMime: this.isJsonMime,
|
|
207
|
+
}, '', this.axios);
|
|
208
|
+
}
|
|
209
|
+
get apiKey() {
|
|
210
|
+
return new ApiKeyApi({
|
|
211
|
+
isJsonMime: this.isJsonMime,
|
|
212
|
+
}, '', this.axios);
|
|
213
|
+
}
|
|
158
214
|
}
|
|
159
215
|
//# sourceMappingURL=client.js.map
|
package/dist/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA+BhD,MAAM,OAAO,MAAO,SAAQ,aAA+B;IAEzD,YAAY,MAAwB;QAClC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,6FAA6F;QAC7F,4FAA4F;QAC5F,0FAA0F;QAC1F,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BAAgB;QAClB,OAAO,IAAI,mBAAmB,CAC5B;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,WAAW,CACpB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,SAAS,CAClB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,YAAY,CACrB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,aAAa,CACtB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,SAAS,CAClB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DistributorSelfServiceApi } from '../generated-management/api.js';
|
|
2
|
+
import { BaseApiClient, type IBaseApiClientConfig } from './baseClient.js';
|
|
3
|
+
export interface IDistributorApiClientConfig extends IBaseApiClientConfig {
|
|
4
|
+
auth: {
|
|
5
|
+
/** A Distributor Key secret (`takaro_dist_…`), sent as `Authorization: Bearer <key>`. */
|
|
6
|
+
distributorKey: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The client an integrating Distributor uses against the Management API (ADR 0023). Authenticated
|
|
11
|
+
* by a Distributor Key, never by the admin secret — those are two separate doors.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DistributorClient extends BaseApiClient<IDistributorApiClientConfig> {
|
|
14
|
+
constructor(config: IDistributorApiClientConfig);
|
|
15
|
+
/** The Distributor's own self-service routes: who am I, and its key lifecycle. */
|
|
16
|
+
get self(): DistributorSelfServiceApi;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=distributorClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributorClient.d.ts","sourceRoot":"","sources":["../../src/lib/distributorClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACvE,IAAI,EAAE;QACJ,yFAAyF;QACzF,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,2BAA2B,CAAC;gBACnE,MAAM,EAAE,2BAA2B;IAS/C,kFAAkF;IAClF,IAAI,IAAI,8BAEP;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DistributorSelfServiceApi } from '../generated-management/api.js';
|
|
2
|
+
import { BaseApiClient } from './baseClient.js';
|
|
3
|
+
import { assertValidApiKey } from './apiKey.js';
|
|
4
|
+
/**
|
|
5
|
+
* The client an integrating Distributor uses against the Management API (ADR 0023). Authenticated
|
|
6
|
+
* by a Distributor Key, never by the admin secret — those are two separate doors.
|
|
7
|
+
*/
|
|
8
|
+
export class DistributorClient extends BaseApiClient {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
// Validated where it was typed, not as an opaque 401 later. isValidApiKeyFormat matches the
|
|
12
|
+
// bare `takaro_` prefix plus the checksum, so a Distributor Key passes unchanged.
|
|
13
|
+
assertValidApiKey(config.auth.distributorKey);
|
|
14
|
+
this.axios.defaults.headers.common.Authorization = `Bearer ${config.auth.distributorKey}`;
|
|
15
|
+
}
|
|
16
|
+
/** The Distributor's own self-service routes: who am I, and its key lifecycle. */
|
|
17
|
+
get self() {
|
|
18
|
+
return new DistributorSelfServiceApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=distributorClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributorClient.js","sourceRoot":"","sources":["../../src/lib/distributorClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAShD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAA0C;IAC/E,YAAY,MAAmC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,4FAA4F;QAC5F,kFAAkF;QAClF,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,UAAU,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5F,CAAC;IAED,kFAAkF;IAClF,IAAI,IAAI;QACN,OAAO,IAAI,yBAAyB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DistributorApi, DomainApi, PlatformStatsApi, StaffMeApi, StaffPlanApi } from '../generated-management/api.js';
|
|
2
|
+
import { BaseApiClient, type IBaseApiClientConfig } from './baseClient.js';
|
|
3
|
+
/**
|
|
4
|
+
* The client the Staff admin dashboard uses against the Management API (ADR 0023, ADR 0026).
|
|
5
|
+
*
|
|
6
|
+
* Authenticated by the Staff session cookie and nothing else — no Authorization header, no
|
|
7
|
+
* admin secret, no Distributor Key. `withCredentials` is already on in BaseApiClient, so the
|
|
8
|
+
* cookie rides along on same-origin requests; the dashboard and the API share one origin
|
|
9
|
+
* (ADR 0026 decision 1), which is what makes a cookie enough.
|
|
10
|
+
*/
|
|
11
|
+
export declare class StaffClient extends BaseApiClient<IBaseApiClientConfig> {
|
|
12
|
+
/** Who this Staff session belongs to, and at which tier. */
|
|
13
|
+
get staff(): StaffMeApi;
|
|
14
|
+
/** Platform-wide counts: Domains by state, by backing, per Distributor, created per week. */
|
|
15
|
+
get stats(): PlatformStatsApi;
|
|
16
|
+
get domains(): DomainApi;
|
|
17
|
+
get distributors(): DistributorApi;
|
|
18
|
+
/** The Plan catalogue, so a Domain's `planId` can be shown as the Plan's name. */
|
|
19
|
+
get plans(): StaffPlanApi;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=staffClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staffClient.d.ts","sourceRoot":"","sources":["../../src/lib/staffClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACvH,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;GAOG;AACH,qBAAa,WAAY,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAClE,4DAA4D;IAC5D,IAAI,KAAK,eAER;IAED,6FAA6F;IAC7F,IAAI,KAAK,qBAER;IAED,IAAI,OAAO,cAEV;IAED,IAAI,YAAY,mBAEf;IAED,kFAAkF;IAClF,IAAI,KAAK,iBAER;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DistributorApi, DomainApi, PlatformStatsApi, StaffMeApi, StaffPlanApi } from '../generated-management/api.js';
|
|
2
|
+
import { BaseApiClient } from './baseClient.js';
|
|
3
|
+
/**
|
|
4
|
+
* The client the Staff admin dashboard uses against the Management API (ADR 0023, ADR 0026).
|
|
5
|
+
*
|
|
6
|
+
* Authenticated by the Staff session cookie and nothing else — no Authorization header, no
|
|
7
|
+
* admin secret, no Distributor Key. `withCredentials` is already on in BaseApiClient, so the
|
|
8
|
+
* cookie rides along on same-origin requests; the dashboard and the API share one origin
|
|
9
|
+
* (ADR 0026 decision 1), which is what makes a cookie enough.
|
|
10
|
+
*/
|
|
11
|
+
export class StaffClient extends BaseApiClient {
|
|
12
|
+
/** Who this Staff session belongs to, and at which tier. */
|
|
13
|
+
get staff() {
|
|
14
|
+
return new StaffMeApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
15
|
+
}
|
|
16
|
+
/** Platform-wide counts: Domains by state, by backing, per Distributor, created per week. */
|
|
17
|
+
get stats() {
|
|
18
|
+
return new PlatformStatsApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
19
|
+
}
|
|
20
|
+
get domains() {
|
|
21
|
+
return new DomainApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
22
|
+
}
|
|
23
|
+
get distributors() {
|
|
24
|
+
return new DistributorApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
25
|
+
}
|
|
26
|
+
/** The Plan catalogue, so a Domain's `planId` can be shown as the Plan's name. */
|
|
27
|
+
get plans() {
|
|
28
|
+
return new StaffPlanApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=staffClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staffClient.js","sourceRoot":"","sources":["../../src/lib/staffClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACvH,OAAO,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,OAAO,WAAY,SAAQ,aAAmC;IAClE,4DAA4D;IAC5D,IAAI,KAAK;QACP,OAAO,IAAI,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACzE,CAAC;IAED,6FAA6F;IAC7F,IAAI,KAAK;QACP,OAAO,IAAI,gBAAgB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,SAAS,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;IAED,kFAAkF;IAClF,IAAI,KAAK;QACP,OAAO,IAAI,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { AxiosResponse } from 'axios';
|
|
1
|
+
import { type AxiosResponse } from 'axios';
|
|
2
2
|
export { AxiosResponse } from 'axios';
|
|
3
3
|
export { isAxiosError } from 'axios';
|
|
4
4
|
export { AdminClient } from './lib/adminClient.js';
|
|
5
5
|
export { Client } from './lib/client.js';
|
|
6
|
+
export { DistributorClient } from './lib/distributorClient.js';
|
|
7
|
+
export type { IDistributorApiClientConfig } from './lib/distributorClient.js';
|
|
8
|
+
export { StaffClient } from './lib/staffClient.js';
|
|
9
|
+
export { isValidApiKeyFormat, assertValidApiKey } from './lib/apiKey.js';
|
|
6
10
|
export type ITakaroAPIAxiosResponse<T> = AxiosResponse<T>;
|
|
7
11
|
export * from './generated/api.js';
|
|
12
|
+
export { DistributorApi, DistributorSelfServiceApi, DomainApi, PlatformStatsApi, StaffAuthApi, StaffMeApi, StaffMeOutputDTOTierEnum, StaffPlanApi, DomainStateCountDTOStateEnum, DomainSearchInputAllowedFiltersStateEnum, DistributorKeyOutputDTOStatusEnum, } from './generated-management/api.js';
|
|
13
|
+
export type { DomainBackingCountsDTO, DomainStateCountDTO, DomainsPerDistributorDTO, DomainsPerWeekDTO, PlatformStatsOutputDTO, StaffMeOutputDTO, DomainSearchInputDTO, DomainSearchInputAllowedFilters, DomainSearchInputAllowedSearch, ManagementDomainOutputArrayDTOAPI, DomainApiKeyCreateInputDTO, DomainAttachResultDTO, DistributorSearchInputDTO, DistributorOutputArrayDTOAPI, DistributorOutputDTOAPI, DistributorKeyOutputDTO, DistributorKeyOutputArrayDTOAPI, DistributorKeyCreateInputDTO, DistributorKeyCreateResultDTO, DistributorKeySearchInputDTO, PlanOutputDTO, PlanOutputArrayDTOAPI, PlanLimitsDTO, PlanPriceDTO, StaffRoleOutputDTO, StaffRoleOutputArrayDTOAPI, } from './generated-management/api.js';
|
|
14
|
+
export type { DistributorOutputDTO as StaffDistributorOutputDTO, DistributorCreateInputDTO as StaffDistributorCreateInputDTO, DistributorUpdateInputDTO as StaffDistributorUpdateInputDTO, } from './generated-management/api.js';
|
|
8
15
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"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AqB,EACrB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAavC,YAAY,EACV,oBAAoB,IAAI,yBAAyB,EACjD,yBAAyB,IAAI,8BAA8B,EAC3D,yBAAyB,IAAI,8BAA8B,GAC5D,MAAM,+BAA+B,CAAC"}
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export { isAxiosError } from 'axios';
|
|
2
2
|
export { AdminClient } from './lib/adminClient.js';
|
|
3
3
|
export { Client } from './lib/client.js';
|
|
4
|
+
export { DistributorClient } from './lib/distributorClient.js';
|
|
5
|
+
export { StaffClient } from './lib/staffClient.js';
|
|
6
|
+
export { isValidApiKeyFormat, assertValidApiKey } from './lib/apiKey.js';
|
|
4
7
|
export * from './generated/api.js';
|
|
8
|
+
// The Domain lifecycle routes live on the Management API and so on its own generated tree
|
|
9
|
+
// (ADR 0023). Re-exported by name rather than `export *`: both trees carry every shared DTO,
|
|
10
|
+
// so a star-export would be silently ambiguous — and a name that ever exists in both makes
|
|
11
|
+
// TypeScript fail the build, which is the drift gate we want.
|
|
12
|
+
export { DistributorApi, DistributorSelfServiceApi, DomainApi, PlatformStatsApi, StaffAuthApi, StaffMeApi, StaffMeOutputDTOTierEnum, StaffPlanApi, DomainStateCountDTOStateEnum, DomainSearchInputAllowedFiltersStateEnum, DistributorKeyOutputDTOStatusEnum, } from './generated-management/api.js';
|
|
5
13
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzE,cAAc,oBAAoB,CAAC;AAEnC,0FAA0F;AAC1F,6FAA6F;AAC7F,2FAA2F;AAC3F,8DAA8D;AAC9D,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,YAAY,EACZ,4BAA4B,EAC5B,wCAAwC,EACxC,iCAAiC,GAClC,MAAM,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takaro/apiclient",
|
|
3
3
|
"description": "API client for Takaro",
|
|
4
|
-
"version": "0.0.0-dev.
|
|
4
|
+
"version": "0.0.0-dev.99b576a",
|
|
5
5
|
"author": "",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"axios": "1.7.7"
|
|
@@ -13,11 +13,19 @@
|
|
|
13
13
|
"registry": "https://registry.npmjs.org",
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"types": "dist/main.d.ts",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@takaro/test": "0.7.2",
|
|
20
|
+
"@types/node": "24.13.3",
|
|
21
|
+
"typescript": "5.5.4"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
16
26
|
"scripts": {
|
|
17
27
|
"build": "tsc -p ./tsconfig.build.json",
|
|
18
|
-
"generate": "../../scripts/generate-api-client
|
|
28
|
+
"generate": "node ../../scripts/dev/index.mjs generate-api-client",
|
|
19
29
|
"start:dev": ":"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
"types": "dist/main.d.ts"
|
|
23
|
-
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AdminClient } from '../main.js';
|
|
2
|
-
import { expect, integrationConfig } from '@takaro/test';
|
|
3
|
-
import { describe, it } from 'node:test';
|
|
4
|
-
|
|
5
|
-
const TEST_DOMAIN_NAME = 'apiClient-test';
|
|
6
|
-
|
|
7
|
-
describe('API client', () => {
|
|
8
|
-
const adminClient = new AdminClient({
|
|
9
|
-
url: integrationConfig.get('host'),
|
|
10
|
-
auth: {
|
|
11
|
-
clientSecret: integrationConfig.get('auth.adminClientSecret'),
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('Meta controller', () => {
|
|
16
|
-
it('should get health', async () => {
|
|
17
|
-
const health = await adminClient.meta.metaGetHealth();
|
|
18
|
-
expect(health.data.healthy).to.be.true;
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('Domain controller', () => {
|
|
23
|
-
it('Can create and delete a domain', async () => {
|
|
24
|
-
const domain = await adminClient.domain.domainControllerCreate({
|
|
25
|
-
name: TEST_DOMAIN_NAME,
|
|
26
|
-
});
|
|
27
|
-
expect(domain.data.data.createdDomain.name).to.equal(TEST_DOMAIN_NAME);
|
|
28
|
-
|
|
29
|
-
const domainsRes = await adminClient.domain.domainControllerSearch({
|
|
30
|
-
filters: { name: [TEST_DOMAIN_NAME] },
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
expect(domainsRes.data.data).to.have.lengthOf(1);
|
|
34
|
-
expect(domainsRes.data.data[0].name).to.equal(TEST_DOMAIN_NAME);
|
|
35
|
-
|
|
36
|
-
await adminClient.domain.domainControllerRemove(domain.data.data.createdDomain.id);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# OpenAPI Generator Ignore
|
|
2
|
-
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
-
|
|
4
|
-
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
-
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
-
|
|
7
|
-
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
-
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
-
#ApiClient.cs
|
|
10
|
-
|
|
11
|
-
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
-
#foo/*/qux
|
|
13
|
-
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
-
|
|
15
|
-
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
-
#foo/**/qux
|
|
17
|
-
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
-
|
|
19
|
-
# You can also negate patterns with an exclamation (!).
|
|
20
|
-
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
-
#docs/*.md
|
|
22
|
-
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
-
#!docs/README.md
|