@vertesia/client 0.71.0 → 0.73.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/lib/cjs/AccountApi.js +2 -3
- package/lib/cjs/AccountApi.js.map +1 -1
- package/lib/cjs/AppsApi.js +41 -10
- package/lib/cjs/AppsApi.js.map +1 -1
- package/lib/esm/AccountApi.js +2 -3
- package/lib/esm/AccountApi.js.map +1 -1
- package/lib/esm/AppsApi.js +41 -10
- package/lib/esm/AppsApi.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/AccountApi.d.ts +1 -2
- package/lib/types/AccountApi.d.ts.map +1 -1
- package/lib/types/AppsApi.d.ts +25 -5
- package/lib/types/AppsApi.d.ts.map +1 -1
- package/lib/vertesia-client.js +1 -1
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +3 -3
- package/src/AccountApi.ts +2 -3
- package/src/AppsApi.ts +48 -13
package/src/AccountApi.ts
CHANGED
|
@@ -51,11 +51,10 @@ export default class AccountApi extends ApiTopic {
|
|
|
51
51
|
/**
|
|
52
52
|
* Fetch Invites for specific account or project
|
|
53
53
|
* @param type Filter for the type of invitation, either "project" or "account"
|
|
54
|
-
* @param id ID of the project or organization to fetch invitations for
|
|
55
54
|
* @returns UserInviteTokenData[]
|
|
56
55
|
* */
|
|
57
|
-
listInvitation(
|
|
58
|
-
return this.get(`/invites/${type}
|
|
56
|
+
listInvitation(type: "project" | "account" = "project"): Promise<TransientToken<UserInviteTokenData>[]> {
|
|
57
|
+
return this.get(`/invites/${type}`);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
/**
|
package/src/AppsApi.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
|
|
2
|
-
import type { AppInstallation, AppInstallationKind, AppInstallationPayload, AppInstallationWithManifest, AppManifest, AppManifestData } from "@vertesia/common";
|
|
1
|
+
import { ApiTopic, ClientBase, ServerError } from "@vertesia/api-fetch-client";
|
|
2
|
+
import type { AppInstallation, AppInstallationKind, AppInstallationPayload, AppInstallationWithManifest, AppManifest, AppManifestData, ProjectRef, RequireAtLeastOne } from "@vertesia/common";
|
|
3
|
+
|
|
4
|
+
export interface OrphanedAppInstallation extends Omit<AppInstallation, 'manifest'> {
|
|
5
|
+
manifest: null,
|
|
6
|
+
}
|
|
3
7
|
|
|
4
8
|
export default class AppsApi extends ApiTopic {
|
|
5
9
|
|
|
@@ -45,6 +49,40 @@ export default class AppsApi extends ApiTopic {
|
|
|
45
49
|
return this.del(`/install/${installationId}`);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
/**
|
|
53
|
+
* get an app unstallation given its name or null if the app is not installed
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
getAppInstallationByName(appName: string): Promise<AppInstallationWithManifest | null> {
|
|
57
|
+
return this.get(`/installations/name/${appName}`).catch((err: ServerError) => {
|
|
58
|
+
if (err.status === 404) {
|
|
59
|
+
return null;
|
|
60
|
+
} else {
|
|
61
|
+
throw err;
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get the project refs where the application is visible by the current user.
|
|
68
|
+
* The application is specified either by id or by name.
|
|
69
|
+
* @param param0
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
getAppInstallationProjects(app: RequireAtLeastOne<{ id?: string, name?: string }, 'id' | 'name'>): Promise<ProjectRef[]> {
|
|
73
|
+
if (!app.id && !app.name) {
|
|
74
|
+
throw new Error("Invalid arguments: appId or appName must be specified");
|
|
75
|
+
}
|
|
76
|
+
const query = app.id ? {
|
|
77
|
+
id: app.id
|
|
78
|
+
} : {
|
|
79
|
+
name: app.name
|
|
80
|
+
}
|
|
81
|
+
return this.get("/installations/projects", {
|
|
82
|
+
query
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
48
86
|
/**
|
|
49
87
|
* Get the apps installed for the current authenticated project
|
|
50
88
|
* @param kind - the kind of app installations to filter by (e.g., 'agent', 'tool', etc.)
|
|
@@ -57,25 +95,22 @@ export default class AppsApi extends ApiTopic {
|
|
|
57
95
|
});
|
|
58
96
|
}
|
|
59
97
|
|
|
60
|
-
|
|
61
98
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
99
|
+
* This operation will return an array of all the found AppInstallations in the current project
|
|
100
|
+
* including orphaned installations
|
|
101
|
+
* This requires project admin since access is not checked on the insytallations.
|
|
102
|
+
* For a user level list of available installations (with user permission check) use getInstalledApps
|
|
103
|
+
* @returns
|
|
65
104
|
*/
|
|
66
|
-
|
|
67
|
-
return this.get(
|
|
68
|
-
query: {
|
|
69
|
-
kind,
|
|
70
|
-
}
|
|
71
|
-
});
|
|
105
|
+
getAllAppInstallations(): Promise<(AppInstallationWithManifest | OrphanedAppInstallation)[]> {
|
|
106
|
+
return this.get('/installations/all');
|
|
72
107
|
}
|
|
73
108
|
|
|
74
109
|
/**
|
|
75
110
|
* List the app installations of the current project.
|
|
76
111
|
*/
|
|
77
112
|
listInstallations(): Promise<AppInstallation[]> {
|
|
78
|
-
return this.get('/
|
|
113
|
+
return this.get('/installations/refs');
|
|
79
114
|
}
|
|
80
115
|
|
|
81
116
|
|