@attlaz/client 1.116.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 {};
@@ -19,6 +19,16 @@ export declare class McpAccess implements StateAware {
19
19
  * interrupted rotation leaves behind, which the UI has to be able to show rather than assume away.
20
20
  */
21
21
  url: string | null;
22
+ /**
23
+ * Build the `target` for a connection or a bundle.
24
+ *
25
+ * The API addresses a target by one type-prefixed id, while every other client model carries the
26
+ * bare one — so the prefix is added here rather than at each call site. Each literal is Core's
27
+ * `PREFIX` (`adc`, `cbl`) plus the `_` separator its `toPrefixedString()` uses, duplicated the way
28
+ * this package already duplicates enums; keep them in step.
29
+ */
30
+ static targetForConnection(connectionId: string): string;
31
+ static targetForBundle(bundleId: string): string;
22
32
  /** Paused is reversible and keeps its tokens; revoked is final and sweeps them. */
23
33
  isUsable(): boolean;
24
34
  static parse(raw: ApiRecord): McpAccess;
@@ -18,6 +18,20 @@ export class McpAccess {
18
18
  * interrupted rotation leaves behind, which the UI has to be able to show rather than assume away.
19
19
  */
20
20
  url = null;
21
+ /**
22
+ * Build the `target` for a connection or a bundle.
23
+ *
24
+ * The API addresses a target by one type-prefixed id, while every other client model carries the
25
+ * bare one — so the prefix is added here rather than at each call site. Each literal is Core's
26
+ * `PREFIX` (`adc`, `cbl`) plus the `_` separator its `toPrefixedString()` uses, duplicated the way
27
+ * this package already duplicates enums; keep them in step.
28
+ */
29
+ static targetForConnection(connectionId) {
30
+ return 'adc_' + connectionId;
31
+ }
32
+ static targetForBundle(bundleId) {
33
+ return 'cbl_' + bundleId;
34
+ }
21
35
  /** Paused is reversible and keeps its tokens; revoked is final and sweeps them. */
22
36
  isUsable() {
23
37
  return this.revokedAt === null && this.state === State.Active && this.url !== null;
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.115.3";
1
+ export declare const VERSION = "1.117.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.115.3";
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.116.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",