@vertesia/client 1.0.0 → 1.1.0-dev.20260427.060440Z
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/lib/cjs/AnalyticsApi.js +3 -1
- package/lib/cjs/AnalyticsApi.js.map +1 -1
- package/lib/cjs/AppsApi.js +18 -2
- package/lib/cjs/AppsApi.js.map +1 -1
- package/lib/cjs/AuditTrailApi.js +6 -2
- package/lib/cjs/AuditTrailApi.js.map +1 -1
- package/lib/cjs/GroupsApi.js +8 -0
- package/lib/cjs/GroupsApi.js.map +1 -1
- package/lib/cjs/InteractionsApi.js.map +1 -1
- package/lib/cjs/OAuthClientsApi.js +25 -0
- package/lib/cjs/OAuthClientsApi.js.map +1 -0
- package/lib/cjs/OAuthGrantsApi.js +30 -0
- package/lib/cjs/OAuthGrantsApi.js.map +1 -0
- package/lib/cjs/OAuthProvidersApi.js +43 -0
- package/lib/cjs/OAuthProvidersApi.js.map +1 -0
- package/lib/cjs/OAuthServerApi.js +22 -0
- package/lib/cjs/OAuthServerApi.js.map +1 -0
- package/lib/cjs/RemoteMcpConnectionsApi.js +38 -0
- package/lib/cjs/RemoteMcpConnectionsApi.js.map +1 -0
- package/lib/cjs/RunsApi.js +4 -12
- package/lib/cjs/RunsApi.js.map +1 -1
- package/lib/cjs/client.js +48 -45
- package/lib/cjs/client.js.map +1 -1
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/store/AgentsApi.js +30 -6
- package/lib/cjs/store/AgentsApi.js.map +1 -1
- package/lib/cjs/store/CostApi.js +56 -0
- package/lib/cjs/store/CostApi.js.map +1 -0
- package/lib/cjs/store/IndexingApi.js +94 -30
- package/lib/cjs/store/IndexingApi.js.map +1 -1
- package/lib/cjs/store/ObjectsApi.js +3 -2
- package/lib/cjs/store/ObjectsApi.js.map +1 -1
- package/lib/cjs/store/WorkflowsApi.js +258 -236
- package/lib/cjs/store/WorkflowsApi.js.map +1 -1
- package/lib/cjs/store/client.js +2 -0
- package/lib/cjs/store/client.js.map +1 -1
- package/lib/esm/AnalyticsApi.js +3 -1
- package/lib/esm/AnalyticsApi.js.map +1 -1
- package/lib/esm/AppsApi.js +18 -2
- package/lib/esm/AppsApi.js.map +1 -1
- package/lib/esm/AuditTrailApi.js +6 -2
- package/lib/esm/AuditTrailApi.js.map +1 -1
- package/lib/esm/GroupsApi.js +8 -0
- package/lib/esm/GroupsApi.js.map +1 -1
- package/lib/esm/InteractionsApi.js.map +1 -1
- package/lib/esm/OAuthClientsApi.js +22 -0
- package/lib/esm/OAuthClientsApi.js.map +1 -0
- package/lib/esm/OAuthGrantsApi.js +27 -0
- package/lib/esm/OAuthGrantsApi.js.map +1 -0
- package/lib/esm/OAuthProvidersApi.js +40 -0
- package/lib/esm/OAuthProvidersApi.js.map +1 -0
- package/lib/esm/OAuthServerApi.js +19 -0
- package/lib/esm/OAuthServerApi.js.map +1 -0
- package/lib/esm/RemoteMcpConnectionsApi.js +35 -0
- package/lib/esm/RemoteMcpConnectionsApi.js.map +1 -0
- package/lib/esm/RunsApi.js +4 -12
- package/lib/esm/RunsApi.js.map +1 -1
- package/lib/esm/client.js +48 -45
- package/lib/esm/client.js.map +1 -1
- package/lib/esm/index.js +5 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/store/AgentsApi.js +30 -6
- package/lib/esm/store/AgentsApi.js.map +1 -1
- package/lib/esm/store/CostApi.js +52 -0
- package/lib/esm/store/CostApi.js.map +1 -0
- package/lib/esm/store/IndexingApi.js +94 -30
- package/lib/esm/store/IndexingApi.js.map +1 -1
- package/lib/esm/store/ObjectsApi.js +3 -2
- package/lib/esm/store/ObjectsApi.js.map +1 -1
- package/lib/esm/store/WorkflowsApi.js +258 -236
- package/lib/esm/store/WorkflowsApi.js.map +1 -1
- package/lib/esm/store/client.js +2 -0
- package/lib/esm/store/client.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/AnalyticsApi.d.ts +1 -1
- package/lib/types/AnalyticsApi.d.ts.map +1 -1
- package/lib/types/AppsApi.d.ts +20 -2
- package/lib/types/AppsApi.d.ts.map +1 -1
- package/lib/types/AuditTrailApi.d.ts.map +1 -1
- package/lib/types/GroupsApi.d.ts +6 -0
- package/lib/types/GroupsApi.d.ts.map +1 -1
- package/lib/types/InteractionsApi.d.ts +2 -0
- package/lib/types/InteractionsApi.d.ts.map +1 -1
- package/lib/types/OAuthClientsApi.d.ts +12 -0
- package/lib/types/OAuthClientsApi.d.ts.map +1 -0
- package/lib/types/OAuthGrantsApi.d.ts +11 -0
- package/lib/types/OAuthGrantsApi.d.ts.map +1 -0
- package/lib/types/OAuthProvidersApi.d.ts +22 -0
- package/lib/types/OAuthProvidersApi.d.ts.map +1 -0
- package/lib/types/OAuthServerApi.d.ts +10 -0
- package/lib/types/OAuthServerApi.d.ts.map +1 -0
- package/lib/types/RemoteMcpConnectionsApi.d.ts +13 -0
- package/lib/types/RemoteMcpConnectionsApi.d.ts.map +1 -0
- package/lib/types/RunsApi.d.ts +4 -16
- package/lib/types/RunsApi.d.ts.map +1 -1
- package/lib/types/client.d.ts +15 -9
- package/lib/types/client.d.ts.map +1 -1
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/store/AgentsApi.d.ts +27 -47
- package/lib/types/store/AgentsApi.d.ts.map +1 -1
- package/lib/types/store/CostApi.d.ts +35 -0
- package/lib/types/store/CostApi.d.ts.map +1 -0
- package/lib/types/store/IndexingApi.d.ts +48 -23
- package/lib/types/store/IndexingApi.d.ts.map +1 -1
- package/lib/types/store/ObjectsApi.d.ts +7 -2
- package/lib/types/store/ObjectsApi.d.ts.map +1 -1
- package/lib/types/store/WorkflowsApi.d.ts +84 -34
- package/lib/types/store/WorkflowsApi.d.ts.map +1 -1
- package/lib/types/store/client.d.ts +2 -0
- package/lib/types/store/client.d.ts.map +1 -1
- package/lib/vertesia-client.js +1 -1
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +8 -8
- package/src/AnalyticsApi.ts +2 -1
- package/src/AppsApi.ts +26 -3
- package/src/AuditTrailApi.ts +3 -1
- package/src/GroupsApi.ts +9 -0
- package/src/InteractionsApi.ts +6 -1
- package/src/OAuthClientsApi.ts +33 -0
- package/src/OAuthGrantsApi.ts +42 -0
- package/src/OAuthProvidersApi.ts +59 -0
- package/src/OAuthServerApi.ts +30 -0
- package/src/RemoteMcpConnectionsApi.ts +53 -0
- package/src/RunsApi.ts +6 -13
- package/src/client.test.ts +9 -11
- package/src/client.ts +83 -55
- package/src/index.ts +5 -0
- package/src/store/AgentsApi.ts +62 -43
- package/src/store/CostApi.ts +67 -0
- package/src/store/IndexingApi.ts +124 -35
- package/src/store/ObjectsApi.ts +7 -3
- package/src/store/WorkflowsApi.ts +327 -252
- package/src/store/client.ts +2 -0
- package/lib/cjs/MCPOAuthApi.js +0 -69
- package/lib/cjs/MCPOAuthApi.js.map +0 -1
- package/lib/cjs/OAuthAppsApi.js +0 -72
- package/lib/cjs/OAuthAppsApi.js.map +0 -1
- package/lib/esm/MCPOAuthApi.js +0 -66
- package/lib/esm/MCPOAuthApi.js.map +0 -1
- package/lib/esm/OAuthAppsApi.js +0 -69
- package/lib/esm/OAuthAppsApi.js.map +0 -1
- package/lib/types/MCPOAuthApi.d.ts +0 -50
- package/lib/types/MCPOAuthApi.d.ts.map +0 -1
- package/lib/types/OAuthAppsApi.d.ts +0 -51
- package/lib/types/OAuthAppsApi.d.ts.map +0 -1
- package/src/MCPOAuthApi.ts +0 -74
- package/src/OAuthAppsApi.ts +0 -87
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-dev.20260427.060440Z",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./lib/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
"@eslint/js": "^10.0.1",
|
|
14
14
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
15
15
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
16
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
16
17
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
17
|
-
"@types/node": "^
|
|
18
|
+
"@types/node": "^25.6.0",
|
|
18
19
|
"eslint": "^10.0.2",
|
|
19
20
|
"rollup": "^4.59.0",
|
|
20
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
21
21
|
"ts-dual-module": "^0.6.3",
|
|
22
|
-
"typescript": "^
|
|
23
|
-
"typescript-eslint": "^8.
|
|
22
|
+
"typescript": "^6.0.2",
|
|
23
|
+
"typescript-eslint": "^8.58.1",
|
|
24
24
|
"vitest": "^4.0.16"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"eventsource": "^3.0.6",
|
|
28
|
-
"@llumiverse/common": "1.0.
|
|
29
|
-
"@vertesia/
|
|
30
|
-
"@vertesia/
|
|
28
|
+
"@llumiverse/common": "1.1.0-dev.20260427.054520Z",
|
|
29
|
+
"@vertesia/common": "1.1.0-dev.20260427.060440Z",
|
|
30
|
+
"@vertesia/api-fetch-client": "1.1.0-dev.20260427.060440Z"
|
|
31
31
|
},
|
|
32
32
|
"ts_dual_module": {
|
|
33
33
|
"outDir": "lib"
|
package/src/AnalyticsApi.ts
CHANGED
|
@@ -25,10 +25,11 @@ export default class AnalyticsApi extends ApiTopic {
|
|
|
25
25
|
return this.get('/runs/time-series' + (qs ? '?' + qs : ''));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
runsTokenUsage(query?: DateRangeQuery): Promise<TokenUsageSummary> {
|
|
28
|
+
runsTokenUsage(query?: DateRangeQuery, environmentId?: string): Promise<TokenUsageSummary> {
|
|
29
29
|
const params = new URLSearchParams();
|
|
30
30
|
if (query?.start) params.set('start', query.start);
|
|
31
31
|
if (query?.end) params.set('end', query.end);
|
|
32
|
+
if (environmentId) params.set('environment', environmentId);
|
|
32
33
|
const qs = params.toString();
|
|
33
34
|
return this.get('/runs/token-usage' + (qs ? '?' + qs : ''));
|
|
34
35
|
}
|
package/src/AppsApi.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiTopic, ClientBase, ServerError } from "@vertesia/api-fetch-client";
|
|
2
|
-
import type { AppInstallation, AppInstallationKind, AppInstallationPayload, AppInstallationWithManifest, AppManifest, AppManifestData, AppToolCollection, ProjectRef, RequireAtLeastOne } from "@vertesia/common";
|
|
2
|
+
import type { AppInstallation, AppInstallationKind, AppInstallationPayload, AppInstallationWithManifest, AppManifest, AppManifestData, AppToolCollection, ProjectRef, RequireAtLeastOne, ValidateUrlRequest, ValidateUrlResponse } from "@vertesia/common";
|
|
3
3
|
|
|
4
4
|
export interface OrphanedAppInstallation extends Omit<AppInstallation, 'manifest'> {
|
|
5
5
|
manifest: null,
|
|
@@ -40,11 +40,18 @@ export default class AppsApi extends ApiTopic {
|
|
|
40
40
|
* Install the app with the given id in the current project.
|
|
41
41
|
* @param appId - the id of the app to install
|
|
42
42
|
*/
|
|
43
|
-
install(
|
|
43
|
+
install(
|
|
44
|
+
appId: string,
|
|
45
|
+
settings?: Record<string, unknown>,
|
|
46
|
+
oauthParams?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>,
|
|
47
|
+
oauthProviderParams?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>,
|
|
48
|
+
): Promise<AppInstallation> {
|
|
44
49
|
return this.post(`/install`, {
|
|
45
50
|
payload: {
|
|
46
51
|
app_id: appId,
|
|
47
|
-
settings
|
|
52
|
+
settings,
|
|
53
|
+
oauth_params: oauthParams,
|
|
54
|
+
oauth_provider_params: oauthProviderParams,
|
|
48
55
|
} satisfies AppInstallationPayload
|
|
49
56
|
});
|
|
50
57
|
}
|
|
@@ -131,4 +138,20 @@ export default class AppsApi extends ApiTopic {
|
|
|
131
138
|
});
|
|
132
139
|
}
|
|
133
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Update the tool allowlist for an app installation.
|
|
143
|
+
* Pass null to remove all restrictions (all tools permitted).
|
|
144
|
+
*/
|
|
145
|
+
updateToolAllowlist(installId: string, tool_allowlist: string[] | null): Promise<AppInstallationWithManifest> {
|
|
146
|
+
return this.put(`/installations/${installId}/tool-allowlist`, { payload: { tool_allowlist } });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Validate that a URL is safe to use as a remote tool/activity endpoint.
|
|
151
|
+
* Throws a ServerError(400) if the URL is blocked (SSRF protection).
|
|
152
|
+
*/
|
|
153
|
+
validateUrl(url: string): Promise<ValidateUrlResponse> {
|
|
154
|
+
return this.post('/validate-url', { payload: { url } satisfies ValidateUrlRequest });
|
|
155
|
+
}
|
|
156
|
+
|
|
134
157
|
}
|
package/src/AuditTrailApi.ts
CHANGED
|
@@ -13,7 +13,9 @@ export default class AuditTrailApi extends ApiTopic {
|
|
|
13
13
|
if (query?.resourceTypes?.length) params.set('resourceTypes', query.resourceTypes.join(','));
|
|
14
14
|
if (query?.resourceId) params.set('resourceId', query.resourceId);
|
|
15
15
|
if (query?.principalId) params.set('principalId', query.principalId);
|
|
16
|
-
if (query?.
|
|
16
|
+
if (query?.principalType) params.set('principalType', query.principalType);
|
|
17
|
+
if (query?.effectivePrincipalId) params.set('effectivePrincipalId', query.effectivePrincipalId);
|
|
18
|
+
if (query?.hasEffectivePrincipal !== undefined) params.set('hasEffectivePrincipal', String(query.hasEffectivePrincipal));
|
|
17
19
|
if (query?.projectId) params.set('projectId', query.projectId);
|
|
18
20
|
if (query?.from) params.set('from', query.from);
|
|
19
21
|
if (query?.to) params.set('to', query.to);
|
package/src/GroupsApi.ts
CHANGED
|
@@ -89,4 +89,13 @@ export class GroupsApi extends ApiTopic {
|
|
|
89
89
|
removeMember(groupId: string, userId: string): Promise<UserGroup> {
|
|
90
90
|
return this.del('/' + groupId + '/members/' + userId);
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sync the account's members group with current organization members.
|
|
95
|
+
* Creates the group if it doesn't exist.
|
|
96
|
+
* @returns The synced UserGroup object
|
|
97
|
+
*/
|
|
98
|
+
syncMembers(): Promise<UserGroup> {
|
|
99
|
+
return this.post('/sync-members');
|
|
100
|
+
}
|
|
92
101
|
}
|
package/src/InteractionsApi.ts
CHANGED
|
@@ -301,7 +301,12 @@ export default class InteractionsApi extends ApiTopic {
|
|
|
301
301
|
* @param options Optional environment and/or model to resolve with
|
|
302
302
|
* @returns ResolvedInteractionExecutionInfo with the resolved environment and model
|
|
303
303
|
*/
|
|
304
|
-
resolve(nameOrId: string, options?: {
|
|
304
|
+
resolve(nameOrId: string, options?: {
|
|
305
|
+
environment?: string;
|
|
306
|
+
model?: string;
|
|
307
|
+
hasImage?: boolean;
|
|
308
|
+
hasVideo?: boolean;
|
|
309
|
+
}): Promise<ResolvedInteractionExecutionInfo> {
|
|
305
310
|
return this.get(`/resolve/${encodeURIComponent(nameOrId)}`, {
|
|
306
311
|
query: options
|
|
307
312
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
CreateOAuthClientPayload,
|
|
4
|
+
OAuthClient,
|
|
5
|
+
OAuthClientCreateResponse,
|
|
6
|
+
UpdateOAuthClientPayload,
|
|
7
|
+
} from '@vertesia/common';
|
|
8
|
+
|
|
9
|
+
export default class OAuthClientsApi extends ApiTopic {
|
|
10
|
+
constructor(parent: ClientBase) {
|
|
11
|
+
super(parent, '/api/v1/oauth-clients');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
list(): Promise<OAuthClient[]> {
|
|
15
|
+
return this.get('/');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
retrieve(clientId: string): Promise<OAuthClient> {
|
|
19
|
+
return this.get(`/${clientId}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
create(payload: CreateOAuthClientPayload): Promise<OAuthClientCreateResponse> {
|
|
23
|
+
return this.post('/', { payload });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
update(clientId: string, payload: UpdateOAuthClientPayload): Promise<OAuthClient> {
|
|
27
|
+
return this.put(`/${clientId}`, { payload });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
remove(clientId: string): Promise<{ success: true }> {
|
|
31
|
+
return this.del(`/${clientId}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
BulkRevokeOAuthGrantsPayload,
|
|
4
|
+
ListOAuthGrantsQuery,
|
|
5
|
+
OAuthGrant,
|
|
6
|
+
OAuthGrantListResponse,
|
|
7
|
+
OAuthGrantRevokeResponse,
|
|
8
|
+
} from '@vertesia/common';
|
|
9
|
+
|
|
10
|
+
function toQueryRecord(query?: ListOAuthGrantsQuery): Record<string, string> | undefined {
|
|
11
|
+
if (!query) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return Object.fromEntries(
|
|
16
|
+
Object.entries(query)
|
|
17
|
+
.filter(([, value]) => value !== undefined)
|
|
18
|
+
.map(([key, value]) => [key, String(value)]),
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class OAuthGrantsApi extends ApiTopic {
|
|
23
|
+
constructor(parent: ClientBase) {
|
|
24
|
+
super(parent, '/api/v1/oauth-grants');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
list(query?: ListOAuthGrantsQuery): Promise<OAuthGrantListResponse> {
|
|
28
|
+
return this.get('/', { query: toQueryRecord(query) });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
retrieve(grantId: string): Promise<OAuthGrant> {
|
|
32
|
+
return this.get(`/${grantId}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
revoke(grantId: string, query?: { include_consent?: boolean }): Promise<OAuthGrantRevokeResponse> {
|
|
36
|
+
return this.del(`/${grantId}`, { query });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
revokeBulk(payload: BulkRevokeOAuthGrantsPayload): Promise<OAuthGrantRevokeResponse> {
|
|
40
|
+
return this.post('/revoke', { payload });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
CreateOAuthProviderPayload,
|
|
4
|
+
OAuthProvider,
|
|
5
|
+
OAuthProviderAuthStatus,
|
|
6
|
+
OAuthProviderAuthorizeResponse,
|
|
7
|
+
UpdateOAuthProviderPayload,
|
|
8
|
+
} from '@vertesia/common';
|
|
9
|
+
|
|
10
|
+
export default class OAuthProvidersApi extends ApiTopic {
|
|
11
|
+
|
|
12
|
+
constructor(parent: ClientBase) {
|
|
13
|
+
super(parent, '/api/v1/oauth-providers');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
list(): Promise<OAuthProvider[]> {
|
|
17
|
+
return this.get('/');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
retrieve(id: string): Promise<OAuthProvider> {
|
|
21
|
+
return this.get(`/${id}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
create(payload: CreateOAuthProviderPayload): Promise<OAuthProvider> {
|
|
25
|
+
return this.post('/', { payload });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
update(id: string, payload: UpdateOAuthProviderPayload): Promise<OAuthProvider> {
|
|
29
|
+
return this.put(`/${id}`, { payload });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
remove(id: string): Promise<void> {
|
|
33
|
+
return this.del(`/${id}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
authorize(id: string): Promise<OAuthProviderAuthorizeResponse> {
|
|
37
|
+
return this.get(`/${id}/authorize`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exchange(code: string, state: string): Promise<{ success: boolean }> {
|
|
41
|
+
return this.post('/exchange', { payload: { code, state } });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getStatus(id: string): Promise<OAuthProviderAuthStatus> {
|
|
45
|
+
return this.get(`/${id}/status`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connect(id: string): Promise<{ success: boolean }> {
|
|
49
|
+
return this.post(`/${id}/connect`, { payload: {} });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getToken(id: string): Promise<{ access_token: string }> {
|
|
53
|
+
return this.post(`/${id}/token`, { payload: {} });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
disconnect(id: string): Promise<void> {
|
|
57
|
+
return this.del(`/${id}/disconnect`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiTopic } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
ApproveOAuthAuthorizationRequestPayload,
|
|
4
|
+
CreateOAuthAuthorizationRequestPayload,
|
|
5
|
+
OAuthAuthorizationDecisionResponse,
|
|
6
|
+
OAuthAuthorizationRequest,
|
|
7
|
+
} from '@vertesia/common';
|
|
8
|
+
import type { ClientBase } from '@vertesia/api-fetch-client';
|
|
9
|
+
|
|
10
|
+
export default class OAuthServerApi extends ApiTopic {
|
|
11
|
+
constructor(parent: ClientBase) {
|
|
12
|
+
super(parent, '/oauth');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
createAuthorizationRequest(payload: CreateOAuthAuthorizationRequestPayload): Promise<OAuthAuthorizationRequest> {
|
|
16
|
+
return this.post('/requests', { payload });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
retrieveRequest(requestId: string): Promise<OAuthAuthorizationRequest> {
|
|
20
|
+
return this.get(`/requests/${requestId}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
approveRequest(requestId: string, payload: ApproveOAuthAuthorizationRequestPayload): Promise<OAuthAuthorizationDecisionResponse> {
|
|
24
|
+
return this.post(`/requests/${requestId}/approve`, { payload });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
denyRequest(requestId: string): Promise<OAuthAuthorizationDecisionResponse> {
|
|
28
|
+
return this.post(`/requests/${requestId}/deny`, { payload: {} });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
|
|
2
|
+
import type {
|
|
3
|
+
McpOAuthConnectResponse,
|
|
4
|
+
McpOAuthDisconnectResponse,
|
|
5
|
+
McpOAuthTokenRequest,
|
|
6
|
+
McpOAuthTokenResponse,
|
|
7
|
+
OAuthAuthStatus,
|
|
8
|
+
OAuthAuthorizeResponse,
|
|
9
|
+
OAuthMetadataResponse
|
|
10
|
+
} from "@vertesia/common";
|
|
11
|
+
|
|
12
|
+
export default class RemoteMcpConnectionsApi extends ApiTopic {
|
|
13
|
+
|
|
14
|
+
constructor(parent: ClientBase) {
|
|
15
|
+
super(parent, "/api/v1/remote-mcp-connections");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getStatus(appInstallId: string): Promise<OAuthAuthStatus[]> {
|
|
19
|
+
return this.get(`/status/${appInstallId}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getCollectionStatus(appInstallId: string, collectionId: string): Promise<OAuthAuthStatus> {
|
|
23
|
+
return this.get(`/status/${appInstallId}/${collectionId}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getMetadata(appInstallId: string, collectionId: string): Promise<OAuthMetadataResponse> {
|
|
27
|
+
return this.get(`/metadata/${appInstallId}/${collectionId}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
authorize(appInstallId: string, collectionId: string): Promise<OAuthAuthorizeResponse> {
|
|
31
|
+
return this.get(`/authorize/${appInstallId}/${collectionId}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
connect(appInstallId: string, collectionId: string): Promise<McpOAuthConnectResponse> {
|
|
35
|
+
return this.post(`/connect/${appInstallId}/${collectionId}`, {});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
disconnect(appInstallId: string, collectionId: string): Promise<McpOAuthDisconnectResponse> {
|
|
39
|
+
return this.del(`/disconnect/${appInstallId}/${collectionId}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getCollectionToken(appInstallId: string, collectionId: string): Promise<McpOAuthTokenResponse> {
|
|
43
|
+
return this.post('/token', {
|
|
44
|
+
payload: { app_install_id: appInstallId, collection_id: collectionId } satisfies McpOAuthTokenRequest,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getToken(mcpServerUrl: string): Promise<McpOAuthTokenResponse> {
|
|
49
|
+
return this.post('/token', {
|
|
50
|
+
payload: { mcp_server_url: mcpServerUrl } satisfies McpOAuthTokenRequest
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/RunsApi.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
FindPayload,
|
|
8
8
|
PopulatedExecutionRun,
|
|
9
9
|
RunCreatePayload,
|
|
10
|
+
ExecutionRunDocRef,
|
|
11
|
+
RunClonePayload,
|
|
10
12
|
RunListingFilters,
|
|
11
13
|
RunListingQueryOptions,
|
|
12
14
|
RunSearchPayload,
|
|
@@ -143,19 +145,10 @@ export class RunsApi extends ApiTopic {
|
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* running the latest code.
|
|
148
|
+
* Clone an existing ExecutionRun for fork workflows.
|
|
149
|
+
* Creates a new run with the same interaction/config but fresh status.
|
|
149
150
|
*/
|
|
150
|
-
|
|
151
|
-
return this.post(
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Fork a conversation workflow — works even if the original is still running.
|
|
156
|
-
* Creates a new workflow with the conversation history from the source run.
|
|
157
|
-
*/
|
|
158
|
-
fork(runId: string): Promise<{ runId: string; workflowId: string }> {
|
|
159
|
-
return this.post(`/${runId}/fork`, {});
|
|
151
|
+
clone(payload: RunClonePayload): Promise<ExecutionRunDocRef> {
|
|
152
|
+
return this.post('/clone', { payload });
|
|
160
153
|
}
|
|
161
154
|
}
|
package/src/client.test.ts
CHANGED
|
@@ -62,15 +62,15 @@ describe('Test Vertesia Client', () => {
|
|
|
62
62
|
expect(client.tokenServerUrl).toBe('https://sts.vertesia.io');
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
test('Initialization with site api
|
|
65
|
+
test('Initialization with site api.dev1.vertesia.io', () => {
|
|
66
66
|
const client = new VertesiaClient({
|
|
67
|
-
site: 'api
|
|
67
|
+
site: 'api.dev1.vertesia.io',
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
expect(client).toBeDefined();
|
|
71
|
-
expect(client.baseUrl).toBe('https://api
|
|
72
|
-
expect(client.storeUrl).toBe('https://api
|
|
73
|
-
expect(client.tokenServerUrl).toBe('https://sts
|
|
71
|
+
expect(client.baseUrl).toBe('https://api.dev1.vertesia.io');
|
|
72
|
+
expect(client.storeUrl).toBe('https://api.dev1.vertesia.io');
|
|
73
|
+
expect(client.tokenServerUrl).toBe('https://sts.dev1.vertesia.io');
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test('Initialization with regional serverUrl (api.us1)', () => {
|
|
@@ -82,9 +82,7 @@ describe('Test Vertesia Client', () => {
|
|
|
82
82
|
expect(client).toBeDefined();
|
|
83
83
|
expect(client.baseUrl).toBe('https://api.us1.vertesia.io');
|
|
84
84
|
expect(client.storeUrl).toBe('https://api.us1.vertesia.io');
|
|
85
|
-
|
|
86
|
-
// URL.toString() adds trailing /
|
|
87
|
-
expect(client.tokenServerUrl).toBe('https://sts.us1.vertesia.io/');
|
|
85
|
+
expect(client.tokenServerUrl).toBe('https://sts.us1.vertesia.io');
|
|
88
86
|
});
|
|
89
87
|
|
|
90
88
|
test('Initialization with regional serverUrl (api.eu1)', () => {
|
|
@@ -96,7 +94,7 @@ describe('Test Vertesia Client', () => {
|
|
|
96
94
|
expect(client).toBeDefined();
|
|
97
95
|
expect(client.baseUrl).toBe('https://api.eu1.vertesia.io');
|
|
98
96
|
expect(client.storeUrl).toBe('https://api.eu1.vertesia.io');
|
|
99
|
-
expect(client.tokenServerUrl).toBe('https://sts.eu1.vertesia.io
|
|
97
|
+
expect(client.tokenServerUrl).toBe('https://sts.eu1.vertesia.io');
|
|
100
98
|
});
|
|
101
99
|
|
|
102
100
|
test('Initialization with regional preview serverUrl (api-preview.us1)', () => {
|
|
@@ -107,8 +105,8 @@ describe('Test Vertesia Client', () => {
|
|
|
107
105
|
|
|
108
106
|
expect(client).toBeDefined();
|
|
109
107
|
expect(client.baseUrl).toBe('https://api-preview.us1.vertesia.io');
|
|
110
|
-
//
|
|
111
|
-
expect(client.tokenServerUrl).toBe('https://sts.vertesia.io');
|
|
108
|
+
// preview strips -preview., then api → sts: sts.us1.vertesia.io
|
|
109
|
+
expect(client.tokenServerUrl).toBe('https://sts.us1.vertesia.io');
|
|
112
110
|
});
|
|
113
111
|
|
|
114
112
|
test('Initialization with site localhost', () => {
|