@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
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const vitest_1 = require("vitest");
|
|
13
4
|
const spaces_1 = require("./spaces");
|
|
@@ -22,70 +13,70 @@ const spaces_1 = require("./spaces");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('listSpacesInProject should call GET /projects/{projectUuid}/spaces', () =>
|
|
16
|
+
(0, vitest_1.it)('listSpacesInProject should call GET /projects/{projectUuid}/spaces', async () => {
|
|
26
17
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
27
18
|
const spaces = [{ uuid: 's1', name: 'Space 1', projectUuid: 'p1' }];
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(spaces);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.listSpacesInProject('p1');
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/spaces');
|
|
31
22
|
(0, vitest_1.expect)(result).toEqual(spaces);
|
|
32
|
-
})
|
|
33
|
-
(0, vitest_1.it)('getSpace should call GET /projects/{projectUuid}/spaces/{spaceUuid}', () =>
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('getSpace should call GET /projects/{projectUuid}/spaces/{spaceUuid}', async () => {
|
|
34
25
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
35
26
|
const space = { uuid: 's1', name: 'Space 1', projectUuid: 'p1', organizationUuid: 'o1' };
|
|
36
27
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(space);
|
|
37
|
-
const result =
|
|
28
|
+
const result = await client.getSpace('p1', 's1');
|
|
38
29
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/spaces/s1');
|
|
39
30
|
(0, vitest_1.expect)(result).toEqual(space);
|
|
40
|
-
})
|
|
41
|
-
(0, vitest_1.it)('createSpace should call POST /projects/{projectUuid}/spaces with body', () =>
|
|
31
|
+
});
|
|
32
|
+
(0, vitest_1.it)('createSpace should call POST /projects/{projectUuid}/spaces with body', async () => {
|
|
42
33
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
43
34
|
const created = { uuid: 's1', name: 'New Space', projectUuid: 'p1' };
|
|
44
35
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(created);
|
|
45
36
|
const body = { name: 'New Space' };
|
|
46
|
-
const result =
|
|
37
|
+
const result = await client.createSpace('p1', body);
|
|
47
38
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/spaces', body);
|
|
48
39
|
(0, vitest_1.expect)(result).toEqual(created);
|
|
49
|
-
})
|
|
50
|
-
(0, vitest_1.it)('updateSpace should call PATCH /projects/{projectUuid}/spaces/{spaceUuid} with body', () =>
|
|
40
|
+
});
|
|
41
|
+
(0, vitest_1.it)('updateSpace should call PATCH /projects/{projectUuid}/spaces/{spaceUuid} with body', async () => {
|
|
51
42
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
52
43
|
const updated = { uuid: 's1', name: 'Updated', projectUuid: 'p1' };
|
|
53
44
|
vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue(updated);
|
|
54
45
|
const body = { name: 'Updated' };
|
|
55
|
-
const result =
|
|
46
|
+
const result = await client.updateSpace('p1', 's1', body);
|
|
56
47
|
(0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/projects/p1/spaces/s1', body);
|
|
57
48
|
(0, vitest_1.expect)(result).toEqual(updated);
|
|
58
|
-
})
|
|
59
|
-
(0, vitest_1.it)('deleteSpace should call DELETE /projects/{projectUuid}/spaces/{spaceUuid}', () =>
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('deleteSpace should call DELETE /projects/{projectUuid}/spaces/{spaceUuid}', async () => {
|
|
60
51
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
61
52
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
62
|
-
|
|
53
|
+
await client.deleteSpace('p1', 's1');
|
|
63
54
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/spaces/s1');
|
|
64
|
-
})
|
|
65
|
-
(0, vitest_1.it)('grantUserAccessToSpace should call POST .../share with body', () =>
|
|
55
|
+
});
|
|
56
|
+
(0, vitest_1.it)('grantUserAccessToSpace should call POST .../share with body', async () => {
|
|
66
57
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
67
58
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(undefined);
|
|
68
59
|
const body = { userUuid: 'u1', spaceRole: 'editor' };
|
|
69
|
-
|
|
60
|
+
await client.grantUserAccessToSpace('p1', 's1', body);
|
|
70
61
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/spaces/s1/share', body);
|
|
71
|
-
})
|
|
72
|
-
(0, vitest_1.it)('revokeUserAccessToSpace should call DELETE .../share/{userUuid}', () =>
|
|
62
|
+
});
|
|
63
|
+
(0, vitest_1.it)('revokeUserAccessToSpace should call DELETE .../share/{userUuid}', async () => {
|
|
73
64
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
74
65
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
75
|
-
|
|
66
|
+
await client.revokeUserAccessToSpace('p1', 's1', 'u1');
|
|
76
67
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/spaces/s1/share/u1');
|
|
77
|
-
})
|
|
78
|
-
(0, vitest_1.it)('grantGroupAccessToSpace should call POST .../group/share with body', () =>
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.it)('grantGroupAccessToSpace should call POST .../group/share with body', async () => {
|
|
79
70
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
80
71
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(undefined);
|
|
81
72
|
const body = { groupUuid: 'g1', spaceRole: 'viewer' };
|
|
82
|
-
|
|
73
|
+
await client.grantGroupAccessToSpace('p1', 's1', body);
|
|
83
74
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/spaces/s1/group/share', body);
|
|
84
|
-
})
|
|
85
|
-
(0, vitest_1.it)('revokeGroupAccessToSpace should call DELETE .../group/share/{groupUuid}', () =>
|
|
75
|
+
});
|
|
76
|
+
(0, vitest_1.it)('revokeGroupAccessToSpace should call DELETE .../group/share/{groupUuid}', async () => {
|
|
86
77
|
const client = new spaces_1.SpacesClient(mockHttp);
|
|
87
78
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
88
|
-
|
|
79
|
+
await client.revokeGroupAccessToSpace('p1', 's1', 'g1');
|
|
89
80
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/projects/p1/spaces/s1/group/share/g1');
|
|
90
|
-
})
|
|
81
|
+
});
|
|
91
82
|
});
|
package/dist/api/v1/tags.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tags API client.
|
|
3
3
|
*/
|
|
4
|
-
import type { LightdashApi } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { LightdashApi } from '@lightdash-tools/common';
|
|
6
6
|
export declare class TagsClient extends BaseApiClient {
|
|
7
7
|
/** List tags in a project. */
|
|
8
8
|
listTags(projectUuid: string): Promise<LightdashApi.Tags.ApiGetTagsResponse>;
|
package/dist/api/v1/tags.js
CHANGED
|
@@ -2,30 +2,17 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Tags API client.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.TagsClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class TagsClient extends base_client_1.BaseApiClient {
|
|
18
9
|
/** List tags in a project. */
|
|
19
|
-
listTags(projectUuid) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.get(`/projects/${projectUuid}/tags`);
|
|
22
|
-
});
|
|
10
|
+
async listTags(projectUuid) {
|
|
11
|
+
return this.http.get(`/projects/${projectUuid}/tags`);
|
|
23
12
|
}
|
|
24
13
|
/** Get a tag by UUID. */
|
|
25
|
-
getTag(projectUuid, tagUuid) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.get(`/projects/${projectUuid}/tags/${tagUuid}`);
|
|
28
|
-
});
|
|
14
|
+
async getTag(projectUuid, tagUuid) {
|
|
15
|
+
return this.http.get(`/projects/${projectUuid}/tags/${tagUuid}`);
|
|
29
16
|
}
|
|
30
17
|
}
|
|
31
18
|
exports.TagsClient = TagsClient;
|
package/dist/api/v1/tags.test.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const vitest_1 = require("vitest");
|
|
13
4
|
const tags_1 = require("./tags");
|
|
@@ -22,20 +13,20 @@ const tags_1 = require("./tags");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('listTags should call GET /projects/{projectUuid}/tags', () =>
|
|
16
|
+
(0, vitest_1.it)('listTags should call GET /projects/{projectUuid}/tags', async () => {
|
|
26
17
|
const client = new tags_1.TagsClient(mockHttp);
|
|
27
18
|
const mockResponse = { status: 'ok', results: [] };
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.listTags('p1');
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/tags');
|
|
31
22
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
32
|
-
})
|
|
33
|
-
(0, vitest_1.it)('getTag should call GET /projects/{projectUuid}/tags/{tagUuid}', () =>
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('getTag should call GET /projects/{projectUuid}/tags/{tagUuid}', async () => {
|
|
34
25
|
const client = new tags_1.TagsClient(mockHttp);
|
|
35
26
|
const mockResponse = { status: 'ok', results: {} };
|
|
36
27
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
37
|
-
const result =
|
|
28
|
+
const result = await client.getTag('p1', 't1');
|
|
38
29
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/tags/t1');
|
|
39
30
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
40
|
-
})
|
|
31
|
+
});
|
|
41
32
|
});
|
package/dist/api/v1/users.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Users (organization members) API client.
|
|
3
3
|
*/
|
|
4
|
-
import type { LightdashApi } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { LightdashApi } from '@lightdash-tools/common';
|
|
6
6
|
/** Query params for listing organization members. */
|
|
7
7
|
export interface ListMembersParams {
|
|
8
8
|
includeGroups?: number;
|
|
@@ -32,4 +32,6 @@ export declare class UsersClient extends BaseApiClient {
|
|
|
32
32
|
updateMember(userUuid: string, body: LightdashApi.Users.OrganizationMemberProfileUpdate): Promise<LightdashApi.Users.OrganizationMemberProfile>;
|
|
33
33
|
/** Delete (remove) a user from the current organization. */
|
|
34
34
|
deleteMember(userUuid: string): Promise<void>;
|
|
35
|
+
/** Get the currently authenticated Lightdash user (`GET /api/v1/user`). */
|
|
36
|
+
getAuthenticatedUser(): Promise<LightdashApi.Users.AuthenticatedUser>;
|
|
35
37
|
}
|
package/dist/api/v1/users.js
CHANGED
|
@@ -2,65 +2,48 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Users (organization members) API client.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.UsersClient = void 0;
|
|
16
|
-
const base_client_1 = require("../base-client");
|
|
17
7
|
const fetch_all_pages_1 = require("../../pagination/fetch-all-pages");
|
|
8
|
+
const base_client_1 = require("../base-client");
|
|
18
9
|
class UsersClient extends base_client_1.BaseApiClient {
|
|
19
10
|
/** List one page of members (use listAllMembers for all pages). */
|
|
20
|
-
listMembers(params) {
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
params,
|
|
24
|
-
});
|
|
11
|
+
async listMembers(params) {
|
|
12
|
+
return this.http.get('/org/users', {
|
|
13
|
+
params,
|
|
25
14
|
});
|
|
26
15
|
}
|
|
27
16
|
/** List all members of the current organization (fetches all pages). */
|
|
28
|
-
listAllMembers(params, options) {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
35
|
-
});
|
|
17
|
+
async listAllMembers(params, options) {
|
|
18
|
+
return (0, fetch_all_pages_1.fetchAllPages)({
|
|
19
|
+
fetchPage: (page, pageSize) => this.http.get('/org/users', {
|
|
20
|
+
params: Object.assign(Object.assign({}, params), { page, pageSize }),
|
|
21
|
+
}),
|
|
22
|
+
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
36
23
|
});
|
|
37
24
|
}
|
|
38
25
|
/** Get organization member by UUID. */
|
|
39
|
-
getMemberByUuid(userUuid) {
|
|
40
|
-
return
|
|
41
|
-
return this.http.get(`/org/users/${userUuid}`);
|
|
42
|
-
});
|
|
26
|
+
async getMemberByUuid(userUuid) {
|
|
27
|
+
return this.http.get(`/org/users/${userUuid}`);
|
|
43
28
|
}
|
|
44
29
|
/** Get organization member by email. */
|
|
45
|
-
getMemberByEmail(email) {
|
|
46
|
-
return
|
|
47
|
-
return this.http.get(`/org/users/email/${encodeURIComponent(email)}`);
|
|
48
|
-
});
|
|
30
|
+
async getMemberByEmail(email) {
|
|
31
|
+
return this.http.get(`/org/users/email/${encodeURIComponent(email)}`);
|
|
49
32
|
}
|
|
50
33
|
/**
|
|
51
34
|
* Update organization member (e.g. role).
|
|
52
35
|
* @deprecated This API is deprecated in Lightdash.
|
|
53
36
|
*/
|
|
54
|
-
updateMember(userUuid, body) {
|
|
55
|
-
return
|
|
56
|
-
return this.http.patch(`/org/users/${userUuid}`, body);
|
|
57
|
-
});
|
|
37
|
+
async updateMember(userUuid, body) {
|
|
38
|
+
return this.http.patch(`/org/users/${userUuid}`, body);
|
|
58
39
|
}
|
|
59
40
|
/** Delete (remove) a user from the current organization. */
|
|
60
|
-
deleteMember(userUuid) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
41
|
+
async deleteMember(userUuid) {
|
|
42
|
+
await this.http.delete(`/org/user/${userUuid}`);
|
|
43
|
+
}
|
|
44
|
+
/** Get the currently authenticated Lightdash user (`GET /api/v1/user`). */
|
|
45
|
+
async getAuthenticatedUser() {
|
|
46
|
+
return this.http.get('/user');
|
|
64
47
|
}
|
|
65
48
|
}
|
|
66
49
|
exports.UsersClient = UsersClient;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const vitest_1 = require("vitest");
|
|
13
4
|
const users_1 = require("./users");
|
|
@@ -22,17 +13,40 @@ const users_1 = require("./users");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('listMembers should call GET /org/users with optional params', () =>
|
|
16
|
+
(0, vitest_1.it)('listMembers should call GET /org/users with optional params', async () => {
|
|
26
17
|
const client = new users_1.UsersClient(mockHttp);
|
|
27
18
|
const results = { data: [], pagination: { totalResults: 0, totalPageCount: 0 } };
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(results);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.listMembers({ pageSize: 10, page: 1 });
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users', {
|
|
31
22
|
params: { pageSize: 10, page: 1 },
|
|
32
23
|
});
|
|
33
24
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
34
|
-
})
|
|
35
|
-
(0, vitest_1.it)('
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.it)('getAuthenticatedUser should call GET /user (resolved to /api/v1/user)', async () => {
|
|
27
|
+
const client = new users_1.UsersClient(mockHttp);
|
|
28
|
+
const user = {
|
|
29
|
+
userUuid: 'u1',
|
|
30
|
+
email: 'a@example.com',
|
|
31
|
+
firstName: 'A',
|
|
32
|
+
lastName: 'User',
|
|
33
|
+
userId: 1,
|
|
34
|
+
isTrackingAnonymized: false,
|
|
35
|
+
isMarketingOptedIn: false,
|
|
36
|
+
isSetupComplete: true,
|
|
37
|
+
isActive: true,
|
|
38
|
+
createdAt: '2026-01-01T00:00:00.000Z',
|
|
39
|
+
updatedAt: '2026-01-01T00:00:00.000Z',
|
|
40
|
+
timezone: null,
|
|
41
|
+
organizationUuid: 'org-1',
|
|
42
|
+
impersonation: null,
|
|
43
|
+
};
|
|
44
|
+
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(user);
|
|
45
|
+
const result = await client.getAuthenticatedUser();
|
|
46
|
+
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/user');
|
|
47
|
+
(0, vitest_1.expect)(result).toEqual(user);
|
|
48
|
+
});
|
|
49
|
+
(0, vitest_1.it)('getMemberByUuid should call GET /org/users/{userUuid}', async () => {
|
|
36
50
|
const client = new users_1.UsersClient(mockHttp);
|
|
37
51
|
const member = {
|
|
38
52
|
userUuid: 'u1',
|
|
@@ -42,11 +56,11 @@ const users_1 = require("./users");
|
|
|
42
56
|
role: 'editor',
|
|
43
57
|
};
|
|
44
58
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(member);
|
|
45
|
-
const result =
|
|
59
|
+
const result = await client.getMemberByUuid('u1');
|
|
46
60
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users/u1');
|
|
47
61
|
(0, vitest_1.expect)(result).toEqual(member);
|
|
48
|
-
})
|
|
49
|
-
(0, vitest_1.it)('getMemberByEmail should call GET /org/users/email/{encodedEmail}', () =>
|
|
62
|
+
});
|
|
63
|
+
(0, vitest_1.it)('getMemberByEmail should call GET /org/users/email/{encodedEmail}', async () => {
|
|
50
64
|
const client = new users_1.UsersClient(mockHttp);
|
|
51
65
|
const member = {
|
|
52
66
|
userUuid: 'u1',
|
|
@@ -56,11 +70,11 @@ const users_1 = require("./users");
|
|
|
56
70
|
role: 'editor',
|
|
57
71
|
};
|
|
58
72
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(member);
|
|
59
|
-
const result =
|
|
73
|
+
const result = await client.getMemberByEmail('user+test@example.com');
|
|
60
74
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users/email/user%2Btest%40example.com');
|
|
61
75
|
(0, vitest_1.expect)(result).toEqual(member);
|
|
62
|
-
})
|
|
63
|
-
(0, vitest_1.it)('updateMember should call PATCH /org/users/{userUuid} with body', () =>
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.it)('updateMember should call PATCH /org/users/{userUuid} with body', async () => {
|
|
64
78
|
const client = new users_1.UsersClient(mockHttp);
|
|
65
79
|
const body = { role: 'admin' };
|
|
66
80
|
const updated = {
|
|
@@ -71,17 +85,17 @@ const users_1 = require("./users");
|
|
|
71
85
|
role: 'admin',
|
|
72
86
|
};
|
|
73
87
|
vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue(updated);
|
|
74
|
-
const result =
|
|
88
|
+
const result = await client.updateMember('u1', body);
|
|
75
89
|
(0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/org/users/u1', body);
|
|
76
90
|
(0, vitest_1.expect)(result).toEqual(updated);
|
|
77
|
-
})
|
|
78
|
-
(0, vitest_1.it)('deleteMember should call DELETE /org/user/{userUuid}', () =>
|
|
91
|
+
});
|
|
92
|
+
(0, vitest_1.it)('deleteMember should call DELETE /org/user/{userUuid}', async () => {
|
|
79
93
|
const client = new users_1.UsersClient(mockHttp);
|
|
80
94
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
81
|
-
|
|
95
|
+
await client.deleteMember('u1');
|
|
82
96
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/org/user/u1');
|
|
83
|
-
})
|
|
84
|
-
(0, vitest_1.it)('listAllMembers should fetch all pages and return concatenated array', () =>
|
|
97
|
+
});
|
|
98
|
+
(0, vitest_1.it)('listAllMembers should fetch all pages and return concatenated array', async () => {
|
|
85
99
|
const client = new users_1.UsersClient(mockHttp);
|
|
86
100
|
const page1 = {
|
|
87
101
|
data: [
|
|
@@ -96,7 +110,7 @@ const users_1 = require("./users");
|
|
|
96
110
|
pagination: { page: 2, pageSize: 1, totalResults: 2, totalPageCount: 2 },
|
|
97
111
|
};
|
|
98
112
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValueOnce(page1).mockResolvedValueOnce(page2);
|
|
99
|
-
const result =
|
|
113
|
+
const result = await client.listAllMembers(undefined, { pageSize: 1 });
|
|
100
114
|
(0, vitest_1.expect)(result).toHaveLength(2);
|
|
101
115
|
(0, vitest_1.expect)(result[0]).toMatchObject({ userUuid: 'u1', email: 'a@example.com' });
|
|
102
116
|
(0, vitest_1.expect)(result[1]).toMatchObject({ userUuid: 'u2', email: 'b@example.com' });
|
|
@@ -107,16 +121,16 @@ const users_1 = require("./users");
|
|
|
107
121
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenNthCalledWith(2, '/org/users', {
|
|
108
122
|
params: { page: 2, pageSize: 1 },
|
|
109
123
|
});
|
|
110
|
-
})
|
|
111
|
-
(0, vitest_1.it)('listAllMembers should pass through list params (e.g. searchQuery)', () =>
|
|
124
|
+
});
|
|
125
|
+
(0, vitest_1.it)('listAllMembers should pass through list params (e.g. searchQuery)', async () => {
|
|
112
126
|
const client = new users_1.UsersClient(mockHttp);
|
|
113
127
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValueOnce({
|
|
114
128
|
data: [],
|
|
115
129
|
pagination: { page: 1, pageSize: 100, totalResults: 0, totalPageCount: 1 },
|
|
116
130
|
});
|
|
117
|
-
|
|
131
|
+
await client.listAllMembers({ searchQuery: 'foo' });
|
|
118
132
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users', {
|
|
119
133
|
params: { searchQuery: 'foo', page: 1, pageSize: 100 },
|
|
120
134
|
});
|
|
121
|
-
})
|
|
135
|
+
});
|
|
122
136
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validation API client.
|
|
3
3
|
*/
|
|
4
|
-
import type { LightdashApi } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { components, LightdashApi } from '@lightdash-tools/common';
|
|
6
6
|
/** Query params for getting validation results. */
|
|
7
7
|
export interface GetValidationResultsParams {
|
|
8
8
|
fromSettings?: boolean;
|
|
@@ -15,8 +15,15 @@ export interface ValidateProjectBody {
|
|
|
15
15
|
onlyValidateExploresInArgs?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export declare class ValidationClient extends BaseApiClient {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Get validation results for a project.
|
|
20
|
+
* @deprecated Use v2 validation API (ListValidationResults) instead.
|
|
21
|
+
*/
|
|
19
22
|
getValidationResults(projectUuid: string, params?: GetValidationResultsParams): Promise<LightdashApi.Validation.ApiValidateResponse>;
|
|
20
23
|
/** Validate content inside a project. Starts a validation job and returns the job ID. */
|
|
21
24
|
validateProject(projectUuid: string, body?: ValidateProjectBody): Promise<LightdashApi.Validation.ApiJobScheduledResponse>;
|
|
25
|
+
/** Validate a single chart's fields against its underlying explore/table. */
|
|
26
|
+
validateChart(projectUuid: string, chartUuid: string): Promise<components['schemas']['ApiChartValidationResponse']['results']>;
|
|
27
|
+
/** Validate a single dashboard's fields against its underlying explores/tables. */
|
|
28
|
+
validateDashboard(projectUuid: string, dashboardUuid: string): Promise<components['schemas']['ApiDashboardValidationResponse']['results']>;
|
|
22
29
|
}
|
|
@@ -2,30 +2,28 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Validation API client.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.ValidationClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class ValidationClient extends base_client_1.BaseApiClient {
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Get validation results for a project.
|
|
11
|
+
* @deprecated Use v2 validation API (ListValidationResults) instead.
|
|
12
|
+
*/
|
|
13
|
+
async getValidationResults(projectUuid, params) {
|
|
14
|
+
return this.http.get(`/projects/${projectUuid}/validate`, { params });
|
|
23
15
|
}
|
|
24
16
|
/** Validate content inside a project. Starts a validation job and returns the job ID. */
|
|
25
|
-
validateProject(projectUuid, body) {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
async validateProject(projectUuid, body) {
|
|
18
|
+
return this.http.post(`/projects/${projectUuid}/validate`, body);
|
|
19
|
+
}
|
|
20
|
+
/** Validate a single chart's fields against its underlying explore/table. */
|
|
21
|
+
async validateChart(projectUuid, chartUuid) {
|
|
22
|
+
return this.http.post(`/projects/${projectUuid}/validate/chart/${chartUuid}`);
|
|
23
|
+
}
|
|
24
|
+
/** Validate a single dashboard's fields against its underlying explores/tables. */
|
|
25
|
+
async validateDashboard(projectUuid, dashboardUuid) {
|
|
26
|
+
return this.http.post(`/projects/${projectUuid}/validate/dashboard/${dashboardUuid}`);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
exports.ValidationClient = ValidationClient;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const vitest_1 = require("vitest");
|
|
13
4
|
const validation_1 = require("./validation");
|
|
@@ -22,22 +13,38 @@ const validation_1 = require("./validation");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('getValidationResults should call GET /projects/{projectUuid}/validate', () =>
|
|
16
|
+
(0, vitest_1.it)('getValidationResults should call GET /projects/{projectUuid}/validate', async () => {
|
|
26
17
|
const client = new validation_1.ValidationClient(mockHttp);
|
|
27
18
|
const mockResponse = { status: 'ok', results: [] };
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.getValidationResults('p1', { jobId: 'j1' });
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/validate', {
|
|
31
22
|
params: { jobId: 'j1' },
|
|
32
23
|
});
|
|
33
24
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
34
|
-
})
|
|
35
|
-
(0, vitest_1.it)('validateProject should call POST /projects/{projectUuid}/validate', () =>
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.it)('validateProject should call POST /projects/{projectUuid}/validate', async () => {
|
|
36
27
|
const client = new validation_1.ValidationClient(mockHttp);
|
|
37
28
|
const mockResponse = { status: 'ok', results: { jobId: 'j1' } };
|
|
38
29
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
|
|
39
|
-
const result =
|
|
30
|
+
const result = await client.validateProject('p1');
|
|
40
31
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/validate', undefined);
|
|
41
32
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
42
|
-
})
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.it)('validateChart should call POST /projects/{projectUuid}/validate/chart/{chartUuid}', async () => {
|
|
35
|
+
const client = new validation_1.ValidationClient(mockHttp);
|
|
36
|
+
const mockResponse = { errors: [] };
|
|
37
|
+
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
|
|
38
|
+
const result = await client.validateChart('p1', 'c1');
|
|
39
|
+
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/validate/chart/c1');
|
|
40
|
+
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.it)('validateDashboard should call POST /projects/{projectUuid}/validate/dashboard/{dashboardUuid}', async () => {
|
|
43
|
+
const client = new validation_1.ValidationClient(mockHttp);
|
|
44
|
+
const mockResponse = { errors: [] };
|
|
45
|
+
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
|
|
46
|
+
const result = await client.validateDashboard('p1', 'd1');
|
|
47
|
+
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/validate/dashboard/d1');
|
|
48
|
+
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
49
|
+
});
|
|
43
50
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charts API client (v2). Metadata reads and soft-delete (no query execution).
|
|
3
|
+
*/
|
|
4
|
+
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { components } from '@lightdash-tools/common';
|
|
6
|
+
export type SavedChart = components['schemas']['SavedChart'];
|
|
7
|
+
export declare class ChartsClientV2 extends BaseApiClient {
|
|
8
|
+
/** Get saved chart metadata by UUID or slug within a project. Does not run queries. */
|
|
9
|
+
getSavedChart(projectUuid: string, chartUuidOrSlug: string): Promise<SavedChart>;
|
|
10
|
+
/** Soft-delete a saved chart by UUID or slug within a project. */
|
|
11
|
+
deleteSavedChart(projectUuid: string, chartUuidOrSlug: string): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Charts API client (v2). Metadata reads and soft-delete (no query execution).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ChartsClientV2 = void 0;
|
|
7
|
+
const base_client_1 = require("../base-client");
|
|
8
|
+
class ChartsClientV2 extends base_client_1.BaseApiClient {
|
|
9
|
+
/** Get saved chart metadata by UUID or slug within a project. Does not run queries. */
|
|
10
|
+
async getSavedChart(projectUuid, chartUuidOrSlug) {
|
|
11
|
+
return this.http.get(`/projects/${projectUuid}/saved/${encodeURIComponent(chartUuidOrSlug)}`);
|
|
12
|
+
}
|
|
13
|
+
/** Soft-delete a saved chart by UUID or slug within a project. */
|
|
14
|
+
async deleteSavedChart(projectUuid, chartUuidOrSlug) {
|
|
15
|
+
await this.http.delete(`/projects/${projectUuid}/saved/${encodeURIComponent(chartUuidOrSlug)}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ChartsClientV2 = ChartsClientV2;
|