@lightdash-tools/client 0.6.0 → 0.8.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/README.md +2 -2
- package/dist/agentops/apply-agent-change.d.ts +3 -0
- package/dist/agentops/apply-agent-change.js +63 -0
- package/dist/agentops/apply-bundle-diff.d.ts +13 -0
- package/dist/agentops/apply-bundle-diff.js +44 -0
- package/dist/agentops/apply-bundle-diff.test.d.ts +1 -0
- package/dist/agentops/apply-bundle-diff.test.js +397 -0
- package/dist/agentops/apply-context.d.ts +14 -0
- package/dist/agentops/apply-context.js +6 -0
- package/dist/agentops/apply-evaluation-change.d.ts +3 -0
- package/dist/agentops/apply-evaluation-change.js +78 -0
- package/dist/agentops/fetch-bundle-state.d.ts +6 -0
- package/dist/agentops/fetch-bundle-state.js +20 -0
- package/dist/agentops/fetch-bundle-state.test.d.ts +1 -0
- package/dist/agentops/fetch-bundle-state.test.js +44 -0
- package/dist/agentops/index.d.ts +3 -0
- package/dist/agentops/index.js +9 -0
- package/dist/agentops/resolve-evaluation-run.d.ts +15 -0
- package/dist/agentops/resolve-evaluation-run.js +48 -0
- package/dist/api/v1/ai-agents/admin.d.ts +16 -0
- package/dist/api/v1/ai-agents/admin.js +29 -0
- package/dist/api/v1/ai-agents/agents.d.ts +18 -0
- package/dist/api/v1/ai-agents/agents.js +31 -0
- package/dist/api/v1/ai-agents/artifacts.d.ts +26 -0
- package/dist/api/v1/ai-agents/artifacts.js +41 -0
- package/dist/api/v1/ai-agents/artifacts.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/artifacts.test.js +69 -0
- package/dist/api/v1/ai-agents/discovery.d.ts +28 -0
- package/dist/api/v1/ai-agents/discovery.js +46 -0
- package/dist/api/v1/ai-agents/discovery.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/discovery.test.js +90 -0
- package/dist/api/v1/ai-agents/evaluations.d.ts +39 -0
- package/dist/api/v1/ai-agents/evaluations.js +70 -0
- package/dist/api/v1/ai-agents/facade.d.ts +79 -0
- package/dist/api/v1/ai-agents/facade.js +193 -0
- package/dist/api/v1/ai-agents/feedback.d.ts +10 -0
- package/dist/api/v1/ai-agents/feedback.js +15 -0
- package/dist/api/v1/ai-agents/feedback.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/feedback.test.js +23 -0
- package/dist/api/v1/ai-agents/index.d.ts +1 -0
- package/dist/api/v1/ai-agents/index.js +5 -0
- package/dist/api/v1/ai-agents/mcp-servers.d.ts +20 -0
- package/dist/api/v1/ai-agents/mcp-servers.js +35 -0
- package/dist/api/v1/ai-agents/mcp-servers.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/mcp-servers.test.js +66 -0
- package/dist/api/v1/ai-agents/request-options.d.ts +12 -0
- package/dist/api/v1/ai-agents/request-options.js +20 -0
- package/dist/api/v1/ai-agents/sql-approval.d.ts +10 -0
- package/dist/api/v1/ai-agents/sql-approval.js +15 -0
- package/dist/api/v1/ai-agents/sql-approval.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/sql-approval.test.js +25 -0
- package/dist/api/v1/ai-agents/threads.d.ts +56 -0
- package/dist/api/v1/ai-agents/threads.js +97 -0
- package/dist/api/v1/ai-agents/threads.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/threads.test.js +39 -0
- package/dist/api/v1/ai-agents.test.js +172 -89
- package/dist/api/v1/analytics.d.ts +10 -0
- package/dist/api/v1/analytics.js +14 -0
- package/dist/api/v1/analytics.test.d.ts +4 -0
- package/dist/api/v1/analytics.test.js +27 -0
- package/dist/api/v1/charts.d.ts +13 -2
- package/dist/api/v1/charts.js +26 -30
- package/dist/api/v1/charts.test.js +35 -28
- package/dist/api/v1/dashboards.d.ts +42 -2
- package/dist/api/v1/dashboards.js +39 -14
- package/dist/api/v1/dashboards.test.js +126 -12
- package/dist/api/v1/explores.d.ts +4 -2
- package/dist/api/v1/explores.js +20 -29
- package/dist/api/v1/explores.test.js +31 -21
- package/dist/api/v1/groups.d.ts +1 -1
- package/dist/api/v1/groups.js +25 -51
- package/dist/api/v1/groups.test.js +15 -24
- package/dist/api/v1/metrics.d.ts +2 -2
- package/dist/api/v1/metrics.js +4 -17
- package/dist/api/v1/metrics.test.js +6 -15
- package/dist/api/v1/organizations.d.ts +1 -1
- package/dist/api/v1/organizations.js +2 -13
- package/dist/api/v1/organizations.test.js +3 -12
- package/dist/api/v1/project-access.d.ts +1 -1
- package/dist/api/v1/project-access.js +18 -45
- package/dist/api/v1/project-access.test.js +27 -36
- package/dist/api/v1/projects.d.ts +1 -1
- package/dist/api/v1/projects.js +6 -21
- package/dist/api/v1/projects.test.js +9 -18
- package/dist/api/v1/query.d.ts +5 -2
- package/dist/api/v1/query.js +8 -18
- package/dist/api/v1/query.test.js +6 -15
- package/dist/api/v1/schedulers.d.ts +2 -2
- package/dist/api/v1/schedulers.js +4 -17
- package/dist/api/v1/schedulers.test.js +6 -15
- package/dist/api/v1/spaces.d.ts +1 -1
- package/dist/api/v1/spaces.js +18 -45
- package/dist/api/v1/spaces.test.js +27 -36
- package/dist/api/v1/tags.d.ts +1 -1
- package/dist/api/v1/tags.js +4 -17
- package/dist/api/v1/tags.test.js +6 -15
- package/dist/api/v1/users.d.ts +3 -1
- package/dist/api/v1/users.js +22 -39
- package/dist/api/v1/users.test.js +44 -30
- package/dist/api/v1/validation.d.ts +9 -2
- package/dist/api/v1/validation.js +16 -18
- package/dist/api/v1/validation.test.js +22 -15
- package/dist/api/v2/charts.d.ts +12 -0
- package/dist/api/v2/charts.js +18 -0
- package/dist/api/v2/charts.test.d.ts +4 -0
- package/dist/api/v2/charts.test.js +45 -0
- package/dist/api/v2/content.d.ts +20 -3
- package/dist/api/v2/content.js +18 -14
- package/dist/api/v2/content.test.js +44 -12
- package/dist/api/v2/dashboards.d.ts +16 -0
- package/dist/api/v2/dashboards.js +22 -0
- package/dist/api/v2/dashboards.test.d.ts +4 -0
- package/dist/api/v2/dashboards.test.js +61 -0
- package/dist/api/v2/organization-roles.d.ts +1 -1
- package/dist/api/v2/organization-roles.js +21 -50
- package/dist/api/v2/organization-roles.test.js +33 -42
- package/dist/api/v2/parameters.d.ts +20 -0
- package/dist/api/v2/parameters.js +22 -0
- package/dist/api/v2/parameters.test.d.ts +4 -0
- package/dist/api/v2/parameters.test.js +39 -0
- package/dist/api/v2/project-role-assignments.d.ts +1 -1
- package/dist/api/v2/project-role-assignments.js +12 -33
- package/dist/api/v2/project-role-assignments.test.js +18 -27
- package/dist/api/v2/query.d.ts +16 -1
- package/dist/api/v2/query.js +26 -29
- package/dist/api/v2/query.test.js +31 -24
- package/dist/api/v2/validation.d.ts +28 -0
- package/dist/api/v2/validation.js +23 -0
- package/dist/client.d.ts +24 -14
- package/dist/client.js +26 -16
- package/dist/client.test.js +2 -0
- package/dist/config.d.ts +35 -10
- package/dist/http/axios-client.d.ts +4 -4
- package/dist/http/http-client.d.ts +3 -14
- package/dist/http/http-client.js +20 -43
- package/dist/http/interceptors.d.ts +3 -3
- package/dist/http/interceptors.js +16 -3
- package/dist/http/rate-limiter.js +2 -13
- package/dist/http/rate-limiter.test.js +15 -24
- package/dist/http/unwrap-api-success.d.ts +26 -0
- package/dist/http/unwrap-api-success.js +25 -0
- package/dist/http/unwrap-api-success.test.d.ts +1 -0
- package/dist/http/unwrap-api-success.test.js +19 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +17 -1
- package/dist/index.test.js +13 -5
- package/dist/pagination/fetch-all-pages.js +18 -29
- package/dist/pagination/fetch-all-pages.test.js +15 -24
- package/dist/types/api.d.ts +1 -1
- package/dist/utils/env.d.ts +11 -2
- package/dist/utils/env.js +41 -8
- package/dist/utils/env.test.js +14 -4
- package/dist/utils/logger.js +5 -4
- package/dist/utils/retry.js +17 -28
- package/dist/utils/retry.test.js +9 -18
- package/dist/utils/secret-string.test.d.ts +1 -0
- package/dist/utils/secret-string.test.js +25 -0
- package/package.json +12 -4
- package/src/agentops/apply-agent-change.ts +82 -0
- package/src/agentops/apply-bundle-diff.test.ts +453 -0
- package/src/agentops/apply-bundle-diff.ts +63 -0
- package/src/agentops/apply-context.ts +23 -0
- package/src/agentops/apply-evaluation-change.ts +125 -0
- package/src/agentops/fetch-bundle-state.test.ts +51 -0
- package/src/agentops/fetch-bundle-state.ts +33 -0
- package/src/agentops/index.ts +11 -0
- package/src/agentops/resolve-evaluation-run.ts +94 -0
- package/src/api/v1/ai-agents/admin.ts +41 -0
- package/src/api/v1/ai-agents/agents.ts +40 -0
- package/src/api/v1/ai-agents/artifacts.test.ts +84 -0
- package/src/api/v1/ai-agents/artifacts.ts +92 -0
- package/src/api/v1/ai-agents/discovery.test.ts +102 -0
- package/src/api/v1/ai-agents/discovery.ts +79 -0
- package/src/api/v1/ai-agents/evaluations.ts +152 -0
- package/src/api/v1/ai-agents/facade.ts +489 -0
- package/src/api/v1/ai-agents/feedback.test.ts +30 -0
- package/src/api/v1/ai-agents/feedback.ts +24 -0
- package/src/api/v1/ai-agents/index.ts +1 -0
- package/src/api/v1/ai-agents/mcp-servers.test.ts +81 -0
- package/src/api/v1/ai-agents/mcp-servers.ts +67 -0
- package/src/api/v1/ai-agents/request-options.ts +32 -0
- package/src/api/v1/ai-agents/sql-approval.test.ts +32 -0
- package/src/api/v1/ai-agents/sql-approval.ts +24 -0
- package/src/api/v1/ai-agents/threads.test.ts +55 -0
- package/src/api/v1/ai-agents/threads.ts +216 -0
- package/src/api/v1/ai-agents.test.ts +189 -13
- package/src/api/v1/analytics.test.ts +32 -0
- package/src/api/v1/analytics.ts +16 -0
- package/src/api/v1/charts.test.ts +26 -6
- package/src/api/v1/charts.ts +25 -4
- package/src/api/v1/dashboards.test.ts +142 -0
- package/src/api/v1/dashboards.ts +127 -2
- package/src/api/v1/explores.test.ts +22 -0
- package/src/api/v1/explores.ts +13 -2
- package/src/api/v1/groups.test.ts +2 -0
- package/src/api/v1/groups.ts +9 -7
- package/src/api/v1/metrics.test.ts +2 -0
- package/src/api/v1/metrics.ts +3 -2
- package/src/api/v1/organizations.test.ts +2 -0
- package/src/api/v1/organizations.ts +2 -1
- package/src/api/v1/project-access.test.ts +3 -1
- package/src/api/v1/project-access.ts +2 -1
- package/src/api/v1/projects.test.ts +2 -0
- package/src/api/v1/projects.ts +2 -1
- package/src/api/v1/query.test.ts +2 -0
- package/src/api/v1/query.ts +6 -2
- package/src/api/v1/schedulers.test.ts +2 -0
- package/src/api/v1/schedulers.ts +3 -2
- package/src/api/v1/spaces.test.ts +2 -0
- package/src/api/v1/spaces.ts +2 -1
- package/src/api/v1/tags.test.ts +2 -0
- package/src/api/v1/tags.ts +2 -1
- package/src/api/v1/users.test.ts +26 -0
- package/src/api/v1/users.ts +8 -2
- package/src/api/v1/validation.test.ts +20 -0
- package/src/api/v1/validation.ts +26 -2
- package/src/api/v2/charts.test.ts +53 -0
- package/src/api/v2/charts.ts +23 -0
- package/src/api/v2/content.test.ts +47 -0
- package/src/api/v2/content.ts +37 -3
- package/src/api/v2/dashboards.test.ts +71 -0
- package/src/api/v2/dashboards.ts +40 -0
- package/src/api/v2/organization-roles.test.ts +2 -0
- package/src/api/v2/organization-roles.ts +2 -1
- package/src/api/v2/parameters.test.ts +45 -0
- package/src/api/v2/parameters.ts +38 -0
- package/src/api/v2/project-role-assignments.test.ts +2 -0
- package/src/api/v2/project-role-assignments.ts +2 -1
- package/src/api/v2/query.test.ts +20 -0
- package/src/api/v2/query.ts +55 -1
- package/src/api/v2/validation.ts +48 -0
- package/src/client.test.ts +3 -0
- package/src/client.ts +33 -17
- package/src/config.ts +38 -10
- package/src/errors.test.ts +1 -0
- package/src/http/axios-client.ts +8 -5
- package/src/http/http-client.ts +8 -21
- package/src/http/interceptors.ts +23 -10
- package/src/http/rate-limiter.test.ts +1 -0
- package/src/http/rate-limiter.ts +3 -1
- package/src/http/unwrap-api-success.test.ts +23 -0
- package/src/http/unwrap-api-success.ts +40 -0
- package/src/index.test.ts +16 -7
- package/src/index.ts +37 -2
- package/src/pagination/fetch-all-pages.test.ts +2 -0
- package/src/types/api.ts +1 -1
- package/src/utils/env.test.ts +16 -4
- package/src/utils/env.ts +61 -10
- package/src/utils/logger.ts +6 -4
- package/src/utils/retry.test.ts +1 -0
- package/src/utils/retry.ts +2 -1
- package/src/utils/secret-string.test.ts +27 -0
- package/tsconfig.json +4 -2
- package/dist/api/v1/ai-agents.d.ts +0 -63
- package/dist/api/v1/ai-agents.js +0 -173
- package/src/api/v1/ai-agents.ts +0 -252
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V2 charts client unit tests.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ChartsClientV2 } from './charts';
|
|
8
|
+
|
|
9
|
+
import type { HttpClient } from '../../http/http-client';
|
|
10
|
+
|
|
11
|
+
describe('ChartsClientV2', () => {
|
|
12
|
+
let mockHttp: HttpClient;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockHttp = {
|
|
16
|
+
get: vi.fn(),
|
|
17
|
+
post: vi.fn(),
|
|
18
|
+
put: vi.fn(),
|
|
19
|
+
patch: vi.fn(),
|
|
20
|
+
delete: vi.fn(),
|
|
21
|
+
} as unknown as HttpClient;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('getSavedChart calls GET /projects/{projectUuid}/saved/{id}', async () => {
|
|
25
|
+
const client = new ChartsClientV2(mockHttp);
|
|
26
|
+
const mockResponse = { uuid: 'c1', name: 'Revenue' };
|
|
27
|
+
vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
28
|
+
const result = await client.getSavedChart('p1', 'c1');
|
|
29
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/saved/c1');
|
|
30
|
+
expect(result).toEqual(mockResponse);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('getSavedChart encodes slug path segments', async () => {
|
|
34
|
+
const client = new ChartsClientV2(mockHttp);
|
|
35
|
+
vi.mocked(mockHttp.get).mockResolvedValue({ uuid: 'c1' });
|
|
36
|
+
await client.getSavedChart('p1', 'my/chart');
|
|
37
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/saved/my%2Fchart');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('deleteSavedChart calls DELETE /projects/{projectUuid}/saved/{id}', async () => {
|
|
41
|
+
const client = new ChartsClientV2(mockHttp);
|
|
42
|
+
vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
43
|
+
await client.deleteSavedChart('p1', 'c1');
|
|
44
|
+
expect(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/saved/c1');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('deleteSavedChart encodes slug path segments', async () => {
|
|
48
|
+
const client = new ChartsClientV2(mockHttp);
|
|
49
|
+
vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
50
|
+
await client.deleteSavedChart('p1', 'my/chart');
|
|
51
|
+
expect(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/saved/my%2Fchart');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charts API client (v2). Metadata reads and soft-delete (no query execution).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BaseApiClient } from '../base-client';
|
|
6
|
+
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
9
|
+
export type SavedChart = components['schemas']['SavedChart'];
|
|
10
|
+
|
|
11
|
+
export class ChartsClientV2 extends BaseApiClient {
|
|
12
|
+
/** Get saved chart metadata by UUID or slug within a project. Does not run queries. */
|
|
13
|
+
async getSavedChart(projectUuid: string, chartUuidOrSlug: string): Promise<SavedChart> {
|
|
14
|
+
return this.http.get<SavedChart>(
|
|
15
|
+
`/projects/${projectUuid}/saved/${encodeURIComponent(chartUuidOrSlug)}`,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Soft-delete a saved chart by UUID or slug within a project. */
|
|
20
|
+
async deleteSavedChart(projectUuid: string, chartUuidOrSlug: string): Promise<void> {
|
|
21
|
+
await this.http.delete(`/projects/${projectUuid}/saved/${encodeURIComponent(chartUuidOrSlug)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
2
3
|
import { ContentClient } from './content';
|
|
4
|
+
|
|
3
5
|
import type { HttpClient } from '../../http/http-client';
|
|
4
6
|
|
|
5
7
|
describe('ContentClient', () => {
|
|
@@ -25,4 +27,49 @@ describe('ContentClient', () => {
|
|
|
25
27
|
});
|
|
26
28
|
expect(result).toEqual(mockResponse);
|
|
27
29
|
});
|
|
30
|
+
|
|
31
|
+
it('searchContent passes exact uuids filter', async () => {
|
|
32
|
+
const client = new ContentClient(mockHttp);
|
|
33
|
+
vi.mocked(mockHttp.get).mockResolvedValue({ status: 'ok', results: [] });
|
|
34
|
+
await client.searchContent({
|
|
35
|
+
projectUuids: ['p1'],
|
|
36
|
+
uuids: ['c1'],
|
|
37
|
+
pageSize: 50,
|
|
38
|
+
});
|
|
39
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/content', {
|
|
40
|
+
params: { projectUuids: ['p1'], uuids: ['c1'], pageSize: 50 },
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('moveContent should call POST /content/{projectUuid}/move with body', async () => {
|
|
45
|
+
const client = new ContentClient(mockHttp);
|
|
46
|
+
const body = {
|
|
47
|
+
action: { type: 'move' as const, targetSpaceUuid: 's2' },
|
|
48
|
+
item: { source: 'dbt_explore' as const, contentType: 'chart' as const, uuid: 'c1' },
|
|
49
|
+
} as Parameters<ContentClient['moveContent']>[1];
|
|
50
|
+
vi.mocked(mockHttp.post).mockResolvedValue({ status: 'ok' });
|
|
51
|
+
await client.moveContent('p1', body);
|
|
52
|
+
expect(mockHttp.post).toHaveBeenCalledWith('/content/p1/move', body);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('bulkMoveContent should call POST /content/bulk-action/{projectUuid}/move with body', async () => {
|
|
56
|
+
const client = new ContentClient(mockHttp);
|
|
57
|
+
const body = {
|
|
58
|
+
action: { type: 'move' as const, targetSpaceUuid: 's2' },
|
|
59
|
+
content: [{ source: 'dbt_explore' as const, contentType: 'chart' as const, uuid: 'c1' }],
|
|
60
|
+
} as Parameters<ContentClient['bulkMoveContent']>[1];
|
|
61
|
+
vi.mocked(mockHttp.post).mockResolvedValue({ status: 'ok' });
|
|
62
|
+
await client.bulkMoveContent('p1', body);
|
|
63
|
+
expect(mockHttp.post).toHaveBeenCalledWith('/content/bulk-action/p1/move', body);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('permanentlyDeleteContent should call DELETE /content/{projectUuid}/permanent with body', async () => {
|
|
67
|
+
const client = new ContentClient(mockHttp);
|
|
68
|
+
const body = {
|
|
69
|
+
item: { contentType: 'chart' as const, uuid: 'c1', source: 'dbt_explore' as const },
|
|
70
|
+
} as Parameters<ContentClient['permanentlyDeleteContent']>[1];
|
|
71
|
+
vi.mocked(mockHttp.delete).mockResolvedValue({ status: 'ok' });
|
|
72
|
+
await client.permanentlyDeleteContent('p1', body);
|
|
73
|
+
expect(mockHttp.delete).toHaveBeenCalledWith('/content/p1/permanent', { data: body });
|
|
74
|
+
});
|
|
28
75
|
});
|
package/src/api/v2/content.ts
CHANGED
|
@@ -2,22 +2,35 @@
|
|
|
2
2
|
* Content API client (v2).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { LightdashApi } from '@lightdash-tools/common';
|
|
6
5
|
import { BaseApiClient } from '../base-client';
|
|
7
6
|
|
|
7
|
+
import type { components, LightdashApi } from '@lightdash-tools/common';
|
|
8
|
+
|
|
8
9
|
/** Query params for searching content. */
|
|
9
10
|
export interface SearchContentParams {
|
|
10
11
|
projectUuids?: string[];
|
|
11
12
|
spaceUuids?: string[];
|
|
13
|
+
/** Exact content UUID filter (OpenAPI List content `uuids`). */
|
|
14
|
+
uuids?: string[];
|
|
12
15
|
parentSpaceUuid?: string;
|
|
13
|
-
contentTypes?: ('chart' | 'dashboard' | 'space')[];
|
|
16
|
+
contentTypes?: ('chart' | 'dashboard' | 'data_app' | 'space')[];
|
|
14
17
|
pageSize?: number;
|
|
15
18
|
page?: number;
|
|
16
19
|
search?: string;
|
|
17
|
-
sortBy?:
|
|
20
|
+
sortBy?: LightdashApi.Content.ContentSortByColumns;
|
|
18
21
|
sortDirection?: 'asc' | 'desc';
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
/** Body for moving a single content item (chart, dashboard, or space) to another space. */
|
|
25
|
+
export type MoveContentBody = components['schemas']['ApiContentActionBody_ContentActionMove_'];
|
|
26
|
+
|
|
27
|
+
/** Body for moving multiple content items (charts, dashboards, spaces) to another space. */
|
|
28
|
+
export type BulkMoveContentBody =
|
|
29
|
+
components['schemas']['ApiContentBulkActionBody_ContentActionMove_'];
|
|
30
|
+
|
|
31
|
+
/** Body for permanently deleting soft-deleted content (irrecoverable). */
|
|
32
|
+
export type PermanentlyDeleteContentBody = components['schemas']['ApiPermanentlyDeleteContentBody'];
|
|
33
|
+
|
|
21
34
|
export class ContentClient extends BaseApiClient {
|
|
22
35
|
/** Search project content (charts, dashboards, spaces). */
|
|
23
36
|
async searchContent(
|
|
@@ -27,4 +40,25 @@ export class ContentClient extends BaseApiClient {
|
|
|
27
40
|
params,
|
|
28
41
|
});
|
|
29
42
|
}
|
|
43
|
+
|
|
44
|
+
/** Move a single content item (chart, dashboard, or space) to another space. */
|
|
45
|
+
async moveContent(projectUuid: string, body: MoveContentBody): Promise<void> {
|
|
46
|
+
await this.http.post(`/content/${projectUuid}/move`, body);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Move multiple content items (charts, dashboards, spaces) to another space in one call. */
|
|
50
|
+
async bulkMoveContent(projectUuid: string, body: BulkMoveContentBody): Promise<void> {
|
|
51
|
+
await this.http.post(`/content/bulk-action/${projectUuid}/move`, body);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Permanently delete soft-deleted content (irrecoverable).
|
|
56
|
+
* Not exposed on MCP — use typed client only (ADR-0015).
|
|
57
|
+
*/
|
|
58
|
+
async permanentlyDeleteContent(
|
|
59
|
+
projectUuid: string,
|
|
60
|
+
body: PermanentlyDeleteContentBody,
|
|
61
|
+
): Promise<void> {
|
|
62
|
+
await this.http.delete(`/content/${projectUuid}/permanent`, { data: body });
|
|
63
|
+
}
|
|
30
64
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V2 dashboards client unit tests.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { DashboardsClientV2 } from './dashboards';
|
|
8
|
+
|
|
9
|
+
import type { HttpClient } from '../../http/http-client';
|
|
10
|
+
|
|
11
|
+
describe('DashboardsClientV2', () => {
|
|
12
|
+
let mockHttp: HttpClient;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockHttp = {
|
|
16
|
+
get: vi.fn(),
|
|
17
|
+
post: vi.fn(),
|
|
18
|
+
put: vi.fn(),
|
|
19
|
+
patch: vi.fn(),
|
|
20
|
+
delete: vi.fn(),
|
|
21
|
+
} as unknown as HttpClient;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('getDashboard calls GET /projects/{projectUuid}/dashboards/{id}', async () => {
|
|
25
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
26
|
+
const mockResponse = { uuid: 'd1', name: 'Sales' };
|
|
27
|
+
vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
28
|
+
const result = await client.getDashboard('p1', 'd1');
|
|
29
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/dashboards/d1');
|
|
30
|
+
expect(result).toEqual(mockResponse);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('getDashboard encodes slug in path', async () => {
|
|
34
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
35
|
+
vi.mocked(mockHttp.get).mockResolvedValue({});
|
|
36
|
+
await client.getDashboard('p1', 'dash/slug');
|
|
37
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/dashboards/dash%2Fslug');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('updateDashboard calls PATCH /projects/{projectUuid}/dashboards/{id} with body', async () => {
|
|
41
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
42
|
+
const body = { name: 'Renamed' } as Parameters<DashboardsClientV2['updateDashboard']>[2];
|
|
43
|
+
const updated = { uuid: 'd1', name: 'Renamed' };
|
|
44
|
+
vi.mocked(mockHttp.patch).mockResolvedValue(updated);
|
|
45
|
+
const result = await client.updateDashboard('p1', 'd1', body);
|
|
46
|
+
expect(mockHttp.patch).toHaveBeenCalledWith('/projects/p1/dashboards/d1', body);
|
|
47
|
+
expect(result).toEqual(updated);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('updateDashboard encodes slug in path', async () => {
|
|
51
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
52
|
+
const body = { name: 'Renamed' } as Parameters<DashboardsClientV2['updateDashboard']>[2];
|
|
53
|
+
vi.mocked(mockHttp.patch).mockResolvedValue({});
|
|
54
|
+
await client.updateDashboard('p1', 'dash/slug', body);
|
|
55
|
+
expect(mockHttp.patch).toHaveBeenCalledWith('/projects/p1/dashboards/dash%2Fslug', body);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('deleteDashboard calls DELETE /projects/{projectUuid}/dashboards/{id}', async () => {
|
|
59
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
60
|
+
vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
61
|
+
await client.deleteDashboard('p1', 'd1');
|
|
62
|
+
expect(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/dashboards/d1');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('deleteDashboard encodes slug in path', async () => {
|
|
66
|
+
const client = new DashboardsClientV2(mockHttp);
|
|
67
|
+
vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
68
|
+
await client.deleteDashboard('p1', 'dash/slug');
|
|
69
|
+
expect(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/dashboards/dash%2Fslug');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboards API client (v2). Metadata reads, updates, and soft-delete (no query execution).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BaseApiClient } from '../base-client';
|
|
6
|
+
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
9
|
+
export type Dashboard = components['schemas']['Dashboard'];
|
|
10
|
+
|
|
11
|
+
/** Request body for PATCH projects/{projectUuid}/dashboards/{dashboardUuidOrSlug}. */
|
|
12
|
+
export type UpdateDashboardBody = components['schemas']['UpdateDashboard'];
|
|
13
|
+
|
|
14
|
+
export class DashboardsClientV2 extends BaseApiClient {
|
|
15
|
+
/** Get dashboard metadata by UUID or slug within a project. Does not run queries. */
|
|
16
|
+
async getDashboard(projectUuid: string, dashboardUuidOrSlug: string): Promise<Dashboard> {
|
|
17
|
+
return this.http.get<Dashboard>(
|
|
18
|
+
`/projects/${projectUuid}/dashboards/${encodeURIComponent(dashboardUuidOrSlug)}`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Update a dashboard by UUID or slug within a project. */
|
|
23
|
+
async updateDashboard(
|
|
24
|
+
projectUuid: string,
|
|
25
|
+
dashboardUuidOrSlug: string,
|
|
26
|
+
body: UpdateDashboardBody,
|
|
27
|
+
): Promise<Dashboard> {
|
|
28
|
+
return this.http.patch<Dashboard>(
|
|
29
|
+
`/projects/${projectUuid}/dashboards/${encodeURIComponent(dashboardUuidOrSlug)}`,
|
|
30
|
+
body,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Soft-delete a dashboard by UUID or slug within a project. */
|
|
35
|
+
async deleteDashboard(projectUuid: string, dashboardUuidOrSlug: string): Promise<void> {
|
|
36
|
+
await this.http.delete(
|
|
37
|
+
`/projects/${projectUuid}/dashboards/${encodeURIComponent(dashboardUuidOrSlug)}`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Organization roles API client (v2). Manage org-level roles and role assignments.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { components } from '@lightdash-tools/common';
|
|
6
5
|
import { BaseApiClient } from '../base-client';
|
|
7
6
|
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
8
9
|
type CreateRole = components['schemas']['CreateRole'];
|
|
9
10
|
type UpdateRole = components['schemas']['UpdateRole'];
|
|
10
11
|
type AddScopesToRole = components['schemas']['AddScopesToRole'];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V2 parameters client unit tests.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ParametersClientV2 } from './parameters';
|
|
8
|
+
|
|
9
|
+
import type { HttpClient } from '../../http/http-client';
|
|
10
|
+
|
|
11
|
+
describe('ParametersClientV2', () => {
|
|
12
|
+
let mockHttp: HttpClient;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockHttp = {
|
|
16
|
+
get: vi.fn(),
|
|
17
|
+
post: vi.fn(),
|
|
18
|
+
put: vi.fn(),
|
|
19
|
+
patch: vi.fn(),
|
|
20
|
+
delete: vi.fn(),
|
|
21
|
+
} as unknown as HttpClient;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('listParameters calls GET /projects/{projectUuid}/parameters/list', async () => {
|
|
25
|
+
const client = new ParametersClientV2(mockHttp);
|
|
26
|
+
const mockResponse = { data: [], pagination: {} };
|
|
27
|
+
vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
28
|
+
const result = await client.listParameters('p1', { search: 'region', page: 1 });
|
|
29
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/parameters/list', {
|
|
30
|
+
params: { search: 'region', page: 1 },
|
|
31
|
+
});
|
|
32
|
+
expect(result).toEqual(mockResponse);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('getParameters calls GET /projects/{projectUuid}/parameters', async () => {
|
|
36
|
+
const client = new ParametersClientV2(mockHttp);
|
|
37
|
+
const mockResponse = { region: { type: 'string' } };
|
|
38
|
+
vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
39
|
+
const result = await client.getParameters('p1', ['region']);
|
|
40
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/parameters', {
|
|
41
|
+
params: { names: ['region'] },
|
|
42
|
+
});
|
|
43
|
+
expect(result).toEqual(mockResponse);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project parameters API client (v2). Read-only.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BaseApiClient } from '../base-client';
|
|
6
|
+
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
9
|
+
export type ProjectParametersListResults =
|
|
10
|
+
components['schemas']['ApiGetProjectParametersListResults'];
|
|
11
|
+
export type ProjectParameterDefinitions = components['schemas']['ApiGetProjectParametersResults'];
|
|
12
|
+
|
|
13
|
+
export type ListProjectParametersParams = {
|
|
14
|
+
search?: string;
|
|
15
|
+
sortBy?: 'name';
|
|
16
|
+
sortOrder?: 'asc' | 'desc';
|
|
17
|
+
page?: number;
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export class ParametersClientV2 extends BaseApiClient {
|
|
22
|
+
/** List project parameter definitions (paginated). */
|
|
23
|
+
async listParameters(
|
|
24
|
+
projectUuid: string,
|
|
25
|
+
params?: ListProjectParametersParams,
|
|
26
|
+
): Promise<ProjectParametersListResults> {
|
|
27
|
+
return this.http.get<ProjectParametersListResults>(`/projects/${projectUuid}/parameters/list`, {
|
|
28
|
+
params,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Get project parameter definitions by name. */
|
|
33
|
+
async getParameters(projectUuid: string, names?: string[]): Promise<ProjectParameterDefinitions> {
|
|
34
|
+
return this.http.get<ProjectParameterDefinitions>(`/projects/${projectUuid}/parameters`, {
|
|
35
|
+
params: names !== undefined ? { names } : undefined,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Project role assignments API client (v2). Manage project-level role assignments for users and groups.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { components } from '@lightdash-tools/common';
|
|
6
5
|
import { BaseApiClient } from '../base-client';
|
|
7
6
|
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
8
9
|
type RoleAssignment = components['schemas']['RoleAssignment'];
|
|
9
10
|
type UpsertUserRoleAssignmentRequest = components['schemas']['UpsertUserRoleAssignmentRequest'];
|
|
10
11
|
type UpdateRoleAssignmentRequest = components['schemas']['UpdateRoleAssignmentRequest'];
|
package/src/api/v2/query.test.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
2
3
|
import { QueryClientV2 } from './query';
|
|
4
|
+
|
|
3
5
|
import type { HttpClient } from '../../http/http-client';
|
|
4
6
|
import type {
|
|
5
7
|
ExecuteAsyncMetricQueryRequestParams,
|
|
@@ -78,4 +80,22 @@ describe('QueryClientV2', () => {
|
|
|
78
80
|
expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/underlying-data', body);
|
|
79
81
|
expect(result).toEqual(results);
|
|
80
82
|
});
|
|
83
|
+
|
|
84
|
+
it('getAsyncQueryResults should call GET /projects/{projectUuid}/query/{queryUuid}', async () => {
|
|
85
|
+
const client = new QueryClientV2(mockHttp);
|
|
86
|
+
const results = { queryUuid: 'q1', status: 'ready', rows: [] };
|
|
87
|
+
vi.mocked(mockHttp.get).mockResolvedValue(results);
|
|
88
|
+
const result = await client.getAsyncQueryResults('p1', 'q1', { page: 1, pageSize: 100 });
|
|
89
|
+
expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/query/q1', {
|
|
90
|
+
params: { page: 1, pageSize: 100 },
|
|
91
|
+
});
|
|
92
|
+
expect(result).toEqual(results);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('cancelAsyncQuery should call POST /projects/{projectUuid}/query/{queryUuid}/cancel', async () => {
|
|
96
|
+
const client = new QueryClientV2(mockHttp);
|
|
97
|
+
vi.mocked(mockHttp.post).mockResolvedValue(undefined);
|
|
98
|
+
await client.cancelAsyncQuery('p1', 'q1');
|
|
99
|
+
expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/q1/cancel');
|
|
100
|
+
});
|
|
81
101
|
});
|
package/src/api/v2/query.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Query API client for v2 endpoints. Run metric/SQL/underlying data queries using v2 API.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { BaseApiClient } from '../base-client';
|
|
6
|
+
|
|
5
7
|
import type {
|
|
6
8
|
ExecuteAsyncMetricQueryRequestParams,
|
|
7
9
|
ExecuteAsyncSqlQueryRequestParams,
|
|
@@ -11,8 +13,19 @@ import type {
|
|
|
11
13
|
ExecuteAsyncMetricQueryResults,
|
|
12
14
|
ExecuteAsyncDashboardChartResults,
|
|
13
15
|
ExecuteAsyncSqlQueryResults,
|
|
16
|
+
components,
|
|
14
17
|
} from '@lightdash-tools/common';
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
export type AsyncQueryResults = components['schemas']['ApiGetAsyncQueryResults'];
|
|
20
|
+
export type ExecuteAsyncSqlChartRequestParams =
|
|
21
|
+
components['schemas']['ExecuteAsyncSqlChartRequestParams'];
|
|
22
|
+
export type ExecuteAsyncDashboardSqlChartRequestParams =
|
|
23
|
+
components['schemas']['ExecuteAsyncDashboardSqlChartRequestParams'];
|
|
24
|
+
|
|
25
|
+
export type GetAsyncQueryResultsParams = {
|
|
26
|
+
page?: number;
|
|
27
|
+
pageSize?: number;
|
|
28
|
+
};
|
|
16
29
|
|
|
17
30
|
export class QueryClientV2 extends BaseApiClient {
|
|
18
31
|
/** Run a metric query (v2 endpoint). */
|
|
@@ -66,4 +79,45 @@ export class QueryClientV2 extends BaseApiClient {
|
|
|
66
79
|
body,
|
|
67
80
|
);
|
|
68
81
|
}
|
|
82
|
+
|
|
83
|
+
/** Run a saved SQL chart query (v2). Present for completeness; MCP content-reader keeps SQL off by default. */
|
|
84
|
+
async runSqlChartQuery(
|
|
85
|
+
projectUuid: string,
|
|
86
|
+
body: ExecuteAsyncSqlChartRequestParams,
|
|
87
|
+
): Promise<ExecuteAsyncSqlQueryResults> {
|
|
88
|
+
return this.http.post<ExecuteAsyncSqlQueryResults>(
|
|
89
|
+
`/projects/${projectUuid}/query/sql-chart`,
|
|
90
|
+
body,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Run a dashboard SQL chart query (v2). Present for completeness; MCP content-reader keeps SQL off by default. */
|
|
95
|
+
async runDashboardSqlChartQuery(
|
|
96
|
+
projectUuid: string,
|
|
97
|
+
body: ExecuteAsyncDashboardSqlChartRequestParams,
|
|
98
|
+
): Promise<ExecuteAsyncSqlQueryResults> {
|
|
99
|
+
return this.http.post<ExecuteAsyncSqlQueryResults>(
|
|
100
|
+
`/projects/${projectUuid}/query/dashboard-sql-chart`,
|
|
101
|
+
body,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Poll paginated async query results. */
|
|
106
|
+
async getAsyncQueryResults(
|
|
107
|
+
projectUuid: string,
|
|
108
|
+
queryUuid: string,
|
|
109
|
+
params?: GetAsyncQueryResultsParams,
|
|
110
|
+
): Promise<AsyncQueryResults> {
|
|
111
|
+
return this.http.get<AsyncQueryResults>(
|
|
112
|
+
`/projects/${projectUuid}/query/${encodeURIComponent(queryUuid)}`,
|
|
113
|
+
{ params },
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Cancel a running async query. */
|
|
118
|
+
async cancelAsyncQuery(projectUuid: string, queryUuid: string): Promise<void> {
|
|
119
|
+
await this.http.post<unknown>(
|
|
120
|
+
`/projects/${projectUuid}/query/${encodeURIComponent(queryUuid)}/cancel`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
69
123
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation API client (v2). Paginated validation results with search, filter, and sort support.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BaseApiClient } from '../base-client';
|
|
6
|
+
|
|
7
|
+
import type { components } from '@lightdash-tools/common';
|
|
8
|
+
|
|
9
|
+
/** Query params for listing validation results (v2). */
|
|
10
|
+
export interface ListValidationResultsParams {
|
|
11
|
+
page?: number;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
searchQuery?: string;
|
|
14
|
+
sortBy?: 'createdAt' | 'errorType' | 'name' | 'source';
|
|
15
|
+
sortDirection?: 'asc' | 'desc';
|
|
16
|
+
sourceTypes?: string;
|
|
17
|
+
errorTypes?: string;
|
|
18
|
+
includeChartConfigWarnings?: boolean;
|
|
19
|
+
fromSettings?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class ValidationClientV2 extends BaseApiClient {
|
|
23
|
+
/**
|
|
24
|
+
* List validation results for a project (v2 endpoint).
|
|
25
|
+
* Returns paginated results with search, filter, and sort support.
|
|
26
|
+
*/
|
|
27
|
+
async listValidationResults(
|
|
28
|
+
projectUuid: string,
|
|
29
|
+
params?: ListValidationResultsParams,
|
|
30
|
+
): Promise<components['schemas']['ApiPaginatedValidateResponse']> {
|
|
31
|
+
return this.http.get<components['schemas']['ApiPaginatedValidateResponse']>(
|
|
32
|
+
`/projects/${projectUuid}/validate`,
|
|
33
|
+
{ params },
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get a single validation result by ID (v2 endpoint).
|
|
39
|
+
*/
|
|
40
|
+
async getValidationResult(
|
|
41
|
+
projectUuid: string,
|
|
42
|
+
validationId: number,
|
|
43
|
+
): Promise<components['schemas']['ApiSingleValidationResponse']> {
|
|
44
|
+
return this.http.get<components['schemas']['ApiSingleValidationResponse']>(
|
|
45
|
+
`/projects/${projectUuid}/validate/${validationId}`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/client.test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
2
3
|
import { LightdashClient } from './client';
|
|
3
4
|
|
|
4
5
|
describe('LightdashClient', () => {
|
|
@@ -41,6 +42,8 @@ describe('LightdashClient', () => {
|
|
|
41
42
|
const client = new LightdashClient(config);
|
|
42
43
|
expect(client.v2).toBeDefined();
|
|
43
44
|
expect(client.v2.query).toBeDefined();
|
|
45
|
+
expect(client.v2.charts).toBeDefined();
|
|
46
|
+
expect(client.v2.parameters).toBeDefined();
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
it('v2.query.runMetricQuery should be a function', () => {
|