@lightdash-tools/client 0.13.2 → 0.14.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.
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Projects API client. Endpoints for project and project-scoped resources.
|
|
3
3
|
*/
|
|
4
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
-
import type { Project, OrganizationProject, SpaceQuery } from '@lightdash-tools/common';
|
|
5
|
+
import type { Project, OrganizationProject, SpaceQuery, components } from '@lightdash-tools/common';
|
|
6
|
+
export type VerifiedContentListItem = components['schemas']['VerifiedContentListItem'];
|
|
6
7
|
export declare class ProjectsClient extends BaseApiClient {
|
|
7
8
|
/** Get a project by UUID. */
|
|
8
9
|
getProject(projectUuid: string): Promise<Project>;
|
|
@@ -10,4 +11,6 @@ export declare class ProjectsClient extends BaseApiClient {
|
|
|
10
11
|
listProjects(): Promise<OrganizationProject[]>;
|
|
11
12
|
/** List charts in a project. */
|
|
12
13
|
listChartsInProject(projectUuid: string): Promise<SpaceQuery[]>;
|
|
14
|
+
/** List admin-verified charts and dashboards in a project. */
|
|
15
|
+
listVerifiedContent(projectUuid: string): Promise<VerifiedContentListItem[]>;
|
|
13
16
|
}
|
package/dist/api/v1/projects.js
CHANGED
|
@@ -18,5 +18,9 @@ class ProjectsClient extends base_client_1.BaseApiClient {
|
|
|
18
18
|
async listChartsInProject(projectUuid) {
|
|
19
19
|
return this.http.get(`/projects/${projectUuid}/charts`);
|
|
20
20
|
}
|
|
21
|
+
/** List admin-verified charts and dashboards in a project. */
|
|
22
|
+
async listVerifiedContent(projectUuid) {
|
|
23
|
+
return this.http.get(`/projects/${projectUuid}/content-verification`);
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
exports.ProjectsClient = ProjectsClient;
|
|
@@ -37,4 +37,28 @@ const projects_1 = require("./projects");
|
|
|
37
37
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/charts');
|
|
38
38
|
(0, vitest_1.expect)(result).toEqual(charts);
|
|
39
39
|
});
|
|
40
|
+
(0, vitest_1.it)('listVerifiedContent should call GET /projects/{projectUuid}/content-verification', async () => {
|
|
41
|
+
const client = new projects_1.ProjectsClient(mockHttp);
|
|
42
|
+
const items = [
|
|
43
|
+
{
|
|
44
|
+
contentType: 'chart',
|
|
45
|
+
uuid: 'c1',
|
|
46
|
+
contentUuid: 'c1',
|
|
47
|
+
name: 'Verified chart',
|
|
48
|
+
description: null,
|
|
49
|
+
spaceUuid: 's1',
|
|
50
|
+
spaceName: 'Space',
|
|
51
|
+
views: 10,
|
|
52
|
+
lastUpdatedAt: null,
|
|
53
|
+
verifiedAt: '2026-01-01T00:00:00.000Z',
|
|
54
|
+
verifiedBy: { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' },
|
|
55
|
+
chartKind: 'vertical_bar',
|
|
56
|
+
exploreName: 'orders',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(items);
|
|
60
|
+
const result = await client.listVerifiedContent('p1');
|
|
61
|
+
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/content-verification');
|
|
62
|
+
(0, vitest_1.expect)(result).toEqual(items);
|
|
63
|
+
});
|
|
40
64
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash-tools/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Client library for Lightdash AI.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"axios": "^1.19.0",
|
|
17
17
|
"bottleneck": "^2.19.5",
|
|
18
|
-
"@lightdash-tools/common": "0.
|
|
18
|
+
"@lightdash-tools/common": "0.14.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^25.9.3"
|
|
@@ -43,4 +43,29 @@ describe('ProjectsClient', () => {
|
|
|
43
43
|
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/charts');
|
|
44
44
|
expect(result).toEqual(charts);
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
it('listVerifiedContent should call GET /projects/{projectUuid}/content-verification', async () => {
|
|
48
|
+
const client = new ProjectsClient(mockHttp);
|
|
49
|
+
const items = [
|
|
50
|
+
{
|
|
51
|
+
contentType: 'chart' as const,
|
|
52
|
+
uuid: 'c1',
|
|
53
|
+
contentUuid: 'c1',
|
|
54
|
+
name: 'Verified chart',
|
|
55
|
+
description: null,
|
|
56
|
+
spaceUuid: 's1',
|
|
57
|
+
spaceName: 'Space',
|
|
58
|
+
views: 10,
|
|
59
|
+
lastUpdatedAt: null,
|
|
60
|
+
verifiedAt: '2026-01-01T00:00:00.000Z',
|
|
61
|
+
verifiedBy: { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' },
|
|
62
|
+
chartKind: 'vertical_bar' as const,
|
|
63
|
+
exploreName: 'orders',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
vi.mocked(mockHttp.get).mockResolvedValue(items);
|
|
67
|
+
const result = await client.listVerifiedContent('p1');
|
|
68
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/content-verification');
|
|
69
|
+
expect(result).toEqual(items);
|
|
70
|
+
});
|
|
46
71
|
});
|
package/src/api/v1/projects.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { BaseApiClient } from '../base-client';
|
|
6
6
|
|
|
7
|
-
import type { Project, OrganizationProject, SpaceQuery } from '@lightdash-tools/common';
|
|
7
|
+
import type { Project, OrganizationProject, SpaceQuery, components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
9
|
+
export type VerifiedContentListItem = components['schemas']['VerifiedContentListItem'];
|
|
8
10
|
|
|
9
11
|
export class ProjectsClient extends BaseApiClient {
|
|
10
12
|
/** Get a project by UUID. */
|
|
@@ -21,4 +23,11 @@ export class ProjectsClient extends BaseApiClient {
|
|
|
21
23
|
async listChartsInProject(projectUuid: string): Promise<SpaceQuery[]> {
|
|
22
24
|
return this.http.get<SpaceQuery[]>(`/projects/${projectUuid}/charts`);
|
|
23
25
|
}
|
|
26
|
+
|
|
27
|
+
/** List admin-verified charts and dashboards in a project. */
|
|
28
|
+
async listVerifiedContent(projectUuid: string): Promise<VerifiedContentListItem[]> {
|
|
29
|
+
return this.http.get<VerifiedContentListItem[]>(
|
|
30
|
+
`/projects/${projectUuid}/content-verification`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
24
33
|
}
|