@attlaz/client 1.117.0 → 1.118.0

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/Client.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { OAuthClientToken } from './Http/OAuthClientToken.js';
2
2
  import { ITransport, ParseErrorHandler } from './Http/Transport/ITransport.js';
3
3
  import { OAuthClient, TokenChangeHandler } from './Http/Transport/OAuthClient.js';
4
+ import { ApiInformation } from './Model/ApiInformation.js';
4
5
  import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
5
6
  import { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
6
7
  import { ConnectionBundleEndpoint } from './Service/ConnectionBundleEndpoint.js';
@@ -111,9 +112,7 @@ export declare class Client {
111
112
  * rejected. Pass null to stop observing. OAuth-only; a custom transport has no token.
112
113
  */
113
114
  setTokenChangeHandler(handler: TokenChangeHandler | null): void;
114
- getApiInformation(): Promise<{
115
- version: string;
116
- }>;
115
+ getApiInformation(): Promise<ApiInformation>;
117
116
  getAdapterEndpoint(): AdapterEndpoint;
118
117
  getAdapterConnectionEndpoint(): AdapterConnectionEndpoint;
119
118
  getConnectionBundleEndpoint(): ConnectionBundleEndpoint;
package/dist/Client.js CHANGED
@@ -213,10 +213,12 @@ export class Client {
213
213
  }
214
214
  async getApiInformation() {
215
215
  const result = await this.httpClient.request('/system/info', null, 'GET', true);
216
- if (result.version === undefined) {
216
+ // The gateway is the first entry, and the only one a non-administrator is shown.
217
+ const gateway = result.apis?.[0];
218
+ if (gateway === undefined || gateway.version === null) {
217
219
  throw new Error('Unable to get API information: invalid response');
218
220
  }
219
- return { version: result.version };
221
+ return { version: gateway.version, apis: result.apis ?? [] };
220
222
  }
221
223
  /* Endpoints */
222
224
  getAdapterEndpoint() {
@@ -0,0 +1,29 @@
1
+ /** One API behind the endpoint, as `GET /system/info` reports it. */
2
+ export type ApiInfo = {
3
+ name: string;
4
+ /** Null for the gateway; null for every API unless the caller is an administrator. */
5
+ endpoint: string | null;
6
+ routes: {
7
+ id: string;
8
+ prefix: string;
9
+ apiVersion: string;
10
+ }[];
11
+ online: boolean;
12
+ version: string | null;
13
+ libraries: {
14
+ name: string;
15
+ version: string;
16
+ }[];
17
+ error: string | null;
18
+ };
19
+ /**
20
+ * What the endpoint is running.
21
+ *
22
+ * `apis` lists the gateway first, then every API it routes to — but only an administrator is shown
23
+ * more than the gateway, so a normal caller gets a single entry.
24
+ */
25
+ export type ApiInformation = {
26
+ /** The gateway's version — what `version` meant before `apis` existed. */
27
+ version: string;
28
+ apis: ApiInfo[];
29
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export type { TokenChangeHandler } from './Http/Transport/OAuthClient.js';
15
15
  export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
16
16
  export { OAuthClientToken } from './Http/OAuthClientToken.js';
17
17
  export { ClientError } from './Http/ClientError.js';
18
+ export { ApiInfo, ApiInformation } from './Model/ApiInformation.js';
18
19
  export { ApiError } from './Model/Error/ApiError.js';
19
20
  export type { ParseErrorHandler } from './Http/Transport/ITransport.js';
20
21
  export { HttpStatus } from './Http/HttpStatus.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.116.0";
1
+ export declare const VERSION = "1.117.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.116.0";
1
+ export const VERSION = "1.117.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.117.0",
3
+ "version": "1.118.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",