@attlaz/client 1.117.0 → 1.119.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 +2 -3
- package/dist/Client.js +4 -2
- package/dist/Model/ApiInformation.d.ts +29 -0
- package/dist/Model/ApiInformation.js +1 -0
- package/dist/Model/Mcp/McpAccess.d.ts +7 -0
- package/dist/Model/Mcp/McpAccess.js +8 -0
- package/dist/Model/Pagination/CursorPagination.d.ts +11 -0
- package/dist/Model/Pagination/CursorPagination.js +24 -0
- package/dist/Service/McpAccessEndpoint.d.ts +2 -0
- package/dist/Service/McpAccessEndpoint.js +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
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
|
-
|
|
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:
|
|
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 {};
|
|
@@ -14,6 +14,13 @@ export declare class McpAccess implements StateAware {
|
|
|
14
14
|
state: State;
|
|
15
15
|
revokedAt: Date | null;
|
|
16
16
|
createdAt: Date;
|
|
17
|
+
/**
|
|
18
|
+
* When a client last called this access's URL, or null if it never has.
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ Nothing writes this yet — the column and the plumbing exist so the recording can be added
|
|
21
|
+
* in one place later. Until then it is always null, which reads as "Never".
|
|
22
|
+
*/
|
|
23
|
+
lastUsedAt: Date | null;
|
|
17
24
|
/**
|
|
18
25
|
* The full URL to hand to a client, or null when the access has no live key — the state an
|
|
19
26
|
* interrupted rotation leaves behind, which the UI has to be able to show rather than assume away.
|
|
@@ -13,6 +13,13 @@ export class McpAccess {
|
|
|
13
13
|
state = State.Active;
|
|
14
14
|
revokedAt = null;
|
|
15
15
|
createdAt;
|
|
16
|
+
/**
|
|
17
|
+
* When a client last called this access's URL, or null if it never has.
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ Nothing writes this yet — the column and the plumbing exist so the recording can be added
|
|
20
|
+
* in one place later. Until then it is always null, which reads as "Never".
|
|
21
|
+
*/
|
|
22
|
+
lastUsedAt = null;
|
|
16
23
|
/**
|
|
17
24
|
* The full URL to hand to a client, or null when the access has no live key — the state an
|
|
18
25
|
* interrupted rotation leaves behind, which the UI has to be able to show rather than assume away.
|
|
@@ -45,6 +52,7 @@ export class McpAccess {
|
|
|
45
52
|
access.revokedAt = (raw.revoked_at === null || raw.revoked_at === undefined) ? null : Utils.parseRawDate(raw.revoked_at);
|
|
46
53
|
access.createdAt = Utils.parseRawDate(raw.created_at);
|
|
47
54
|
access.url = (raw.url === null || raw.url === undefined) ? null : raw.url;
|
|
55
|
+
access.lastUsedAt = (raw.last_used_at === null || raw.last_used_at === undefined) ? null : Utils.parseRawDate(raw.last_used_at);
|
|
48
56
|
return access;
|
|
49
57
|
}
|
|
50
58
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export declare class CursorPagination {
|
|
2
|
+
/** Guards against a limit no server would honour; mirrors the bound Core validates against. */
|
|
3
|
+
private static readonly MAX_LIMIT;
|
|
2
4
|
limit: number | null;
|
|
3
5
|
startingAfter: string | null;
|
|
4
6
|
endingBefore: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* `limit` stays optional, and null keeps meaning "let the server decide" — that is a real
|
|
9
|
+
* intent, and what every existing caller wants. What the constructor adds is validation and a
|
|
10
|
+
* way to state a limit in one expression instead of constructing and then assigning.
|
|
11
|
+
*
|
|
12
|
+
* Core's equivalent defaults to 10 because a repository always needs a number. This one must
|
|
13
|
+
* not: defaulting here would silently start sending `limit=10` on every call that omits it.
|
|
14
|
+
*/
|
|
15
|
+
constructor(limit?: number | null);
|
|
5
16
|
}
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
export class CursorPagination {
|
|
2
|
+
/** Guards against a limit no server would honour; mirrors the bound Core validates against. */
|
|
3
|
+
static MAX_LIMIT = 1000000;
|
|
2
4
|
limit = null;
|
|
3
5
|
startingAfter = null;
|
|
4
6
|
endingBefore = null;
|
|
7
|
+
/**
|
|
8
|
+
* `limit` stays optional, and null keeps meaning "let the server decide" — that is a real
|
|
9
|
+
* intent, and what every existing caller wants. What the constructor adds is validation and a
|
|
10
|
+
* way to state a limit in one expression instead of constructing and then assigning.
|
|
11
|
+
*
|
|
12
|
+
* Core's equivalent defaults to 10 because a repository always needs a number. This one must
|
|
13
|
+
* not: defaulting here would silently start sending `limit=10` on every call that omits it.
|
|
14
|
+
*/
|
|
15
|
+
constructor(limit = null) {
|
|
16
|
+
if (limit !== null) {
|
|
17
|
+
if (!Number.isInteger(limit)) {
|
|
18
|
+
throw new Error('Limit should be a whole number');
|
|
19
|
+
}
|
|
20
|
+
if (limit < 1) {
|
|
21
|
+
throw new Error('Limit should be at least 1');
|
|
22
|
+
}
|
|
23
|
+
if (limit > CursorPagination.MAX_LIMIT) {
|
|
24
|
+
throw new Error('Limit should not exceed ' + CursorPagination.MAX_LIMIT);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
this.limit = limit;
|
|
28
|
+
}
|
|
5
29
|
}
|
|
@@ -12,6 +12,8 @@ export declare class McpAccessEndpoint extends Endpoint {
|
|
|
12
12
|
getAccessById(accessId: string): Promise<McpAccess | null>;
|
|
13
13
|
/** Creates the access and its first URL together — an access with no URL cannot be reached. */
|
|
14
14
|
createAccess(name: string, target: string): Promise<McpAccess>;
|
|
15
|
+
/** Renames only. The target is write-once and the URL is changed by rotating, not here. */
|
|
16
|
+
renameAccess(accessId: string, name: string): Promise<McpAccess>;
|
|
15
17
|
/** New URL, old one dead, and every token bound to the old one revoked. */
|
|
16
18
|
rotateKey(accessId: string): Promise<McpAccess>;
|
|
17
19
|
/** Reversible, and keeps its tokens, so resuming needs no re-authentication. */
|
|
@@ -52,6 +52,24 @@ export class McpAccessEndpoint extends Endpoint {
|
|
|
52
52
|
throw error;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
/** Renames only. The target is write-once and the URL is changed by rotating, not here. */
|
|
56
|
+
async renameAccess(accessId, name) {
|
|
57
|
+
try {
|
|
58
|
+
const url = path('/mcp-accesses/:accessId', { accessId });
|
|
59
|
+
const result = await this.requestObject(url, { name }, McpAccess.parse, 'PATCH');
|
|
60
|
+
const access = result.getData();
|
|
61
|
+
if (access === null) {
|
|
62
|
+
throw new Error('MCP access not found: ' + accessId);
|
|
63
|
+
}
|
|
64
|
+
return access;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
68
|
+
console.error('Failed to rename the MCP access: ', error);
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
55
73
|
/** New URL, old one dead, and every token bound to the old one revoked. */
|
|
56
74
|
async rotateKey(accessId) {
|
|
57
75
|
return await this.lifecycle(accessId, path('/mcp-accesses/:accessId/rotate-key', { accessId }), 'POST', 'rotate the MCP URL');
|
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.
|
|
1
|
+
export declare const VERSION = "1.118.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.118.0";
|