@lightdash-tools/client 0.6.0 → 0.7.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 +5 -2
- package/dist/api/v1/charts.js +18 -30
- package/dist/api/v1/charts.test.js +19 -28
- package/dist/api/v1/dashboards.d.ts +11 -2
- package/dist/api/v1/dashboards.js +19 -14
- package/dist/api/v1/dashboards.test.js +54 -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 +5 -2
- package/dist/api/v1/validation.js +8 -18
- package/dist/api/v1/validation.test.js +6 -15
- package/dist/api/v2/content.d.ts +2 -2
- package/dist/api/v2/content.js +3 -14
- package/dist/api/v2/content.test.js +3 -12
- package/dist/api/v2/dashboards.d.ts +10 -0
- package/dist/api/v2/dashboards.js +14 -0
- package/dist/api/v2/dashboards.test.d.ts +4 -0
- package/dist/api/v2/dashboards.test.js +27 -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/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 +1 -1
- package/dist/api/v2/query.js +10 -29
- package/dist/api/v2/query.test.js +15 -24
- package/dist/api/v2/validation.d.ts +28 -0
- package/dist/api/v2/validation.js +23 -0
- package/dist/client.d.ts +20 -14
- package/dist/client.js +22 -16
- package/dist/config.d.ts +35 -10
- package/dist/http/axios-client.d.ts +4 -4
- package/dist/http/http-client.d.ts +3 -3
- package/dist/http/http-client.js +19 -40
- 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/index.d.ts +7 -2
- package/dist/index.js +12 -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 +8 -6
- package/src/api/v1/charts.ts +8 -4
- package/src/api/v1/dashboards.test.ts +57 -0
- package/src/api/v1/dashboards.ts +41 -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 +2 -0
- package/src/api/v1/validation.ts +6 -2
- package/src/api/v2/content.test.ts +2 -0
- package/src/api/v2/content.ts +3 -2
- package/src/api/v2/dashboards.test.ts +32 -0
- package/src/api/v2/dashboards.ts +18 -0
- package/src/api/v2/organization-roles.test.ts +2 -0
- package/src/api/v2/organization-roles.ts +2 -1
- 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 +2 -0
- package/src/api/v2/query.ts +2 -1
- package/src/api/v2/validation.ts +48 -0
- package/src/client.test.ts +1 -0
- package/src/client.ts +27 -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 -6
- 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/index.test.ts +16 -7
- package/src/index.ts +16 -1
- 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 organization_roles_1 = require("./organization-roles");
|
|
@@ -22,68 +13,68 @@ const organization_roles_1 = require("./organization-roles");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('getRoles should call GET /orgs/{orgUuid}/roles with optional params', () =>
|
|
16
|
+
(0, vitest_1.it)('getRoles should call GET /orgs/{orgUuid}/roles with optional params', async () => {
|
|
26
17
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
27
18
|
const results = [{ roleUuid: 'r1', name: 'Role 1' }];
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(results);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.getRoles('org-1');
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/orgs/org-1/roles', {
|
|
31
22
|
params: undefined,
|
|
32
23
|
});
|
|
33
24
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
34
|
-
})
|
|
35
|
-
(0, vitest_1.it)('getRoles with params should pass query params', () =>
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.it)('getRoles with params should pass query params', async () => {
|
|
36
27
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
37
28
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue([]);
|
|
38
|
-
|
|
29
|
+
await client.getRoles('org-1', { load: 'scopes', roleTypeFilter: 'custom' });
|
|
39
30
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/orgs/org-1/roles', {
|
|
40
31
|
params: { load: 'scopes', roleTypeFilter: 'custom' },
|
|
41
32
|
});
|
|
42
|
-
})
|
|
43
|
-
(0, vitest_1.it)('createRole should call POST /orgs/{orgUuid}/roles with body', () =>
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.it)('createRole should call POST /orgs/{orgUuid}/roles with body', async () => {
|
|
44
35
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
45
36
|
const body = { name: 'Editor', description: 'Can edit' };
|
|
46
37
|
const role = { roleUuid: 'r1', name: 'Editor' };
|
|
47
38
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(role);
|
|
48
|
-
const result =
|
|
39
|
+
const result = await client.createRole('org-1', body);
|
|
49
40
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/orgs/org-1/roles', body);
|
|
50
41
|
(0, vitest_1.expect)(result).toEqual(role);
|
|
51
|
-
})
|
|
52
|
-
(0, vitest_1.it)('getRole should call GET /orgs/{orgUuid}/roles/{roleUuid}', () =>
|
|
42
|
+
});
|
|
43
|
+
(0, vitest_1.it)('getRole should call GET /orgs/{orgUuid}/roles/{roleUuid}', async () => {
|
|
53
44
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
54
45
|
const role = { roleUuid: 'r1', name: 'Editor', scopes: [] };
|
|
55
46
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(role);
|
|
56
|
-
const result =
|
|
47
|
+
const result = await client.getRole('org-1', 'r1');
|
|
57
48
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/orgs/org-1/roles/r1');
|
|
58
49
|
(0, vitest_1.expect)(result).toEqual(role);
|
|
59
|
-
})
|
|
60
|
-
(0, vitest_1.it)('updateRole should call PATCH /orgs/{orgUuid}/roles/{roleUuid}', () =>
|
|
50
|
+
});
|
|
51
|
+
(0, vitest_1.it)('updateRole should call PATCH /orgs/{orgUuid}/roles/{roleUuid}', async () => {
|
|
61
52
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
62
53
|
const body = { name: 'Updated' };
|
|
63
54
|
vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue({ roleUuid: 'r1', name: 'Updated' });
|
|
64
|
-
|
|
55
|
+
await client.updateRole('org-1', 'r1', body);
|
|
65
56
|
(0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/orgs/org-1/roles/r1', body);
|
|
66
|
-
})
|
|
67
|
-
(0, vitest_1.it)('deleteRole should call DELETE /orgs/{orgUuid}/roles/{roleUuid}', () =>
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('deleteRole should call DELETE /orgs/{orgUuid}/roles/{roleUuid}', async () => {
|
|
68
59
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
69
60
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
70
|
-
|
|
61
|
+
await client.deleteRole('org-1', 'r1');
|
|
71
62
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/orgs/org-1/roles/r1');
|
|
72
|
-
})
|
|
73
|
-
(0, vitest_1.it)('addScopesToRole should call POST .../scopes with body', () =>
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.it)('addScopesToRole should call POST .../scopes with body', async () => {
|
|
74
65
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
75
66
|
const body = { scopeNames: ['project:read'] };
|
|
76
67
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(undefined);
|
|
77
|
-
|
|
68
|
+
await client.addScopesToRole('org-1', 'r1', body);
|
|
78
69
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/orgs/org-1/roles/r1/scopes', body);
|
|
79
|
-
})
|
|
80
|
-
(0, vitest_1.it)('removeScopeFromRole should call DELETE .../scopes/{scopeName}', () =>
|
|
70
|
+
});
|
|
71
|
+
(0, vitest_1.it)('removeScopeFromRole should call DELETE .../scopes/{scopeName}', async () => {
|
|
81
72
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
82
73
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
83
|
-
|
|
74
|
+
await client.removeScopeFromRole('org-1', 'r1', 'project:read');
|
|
84
75
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/orgs/org-1/roles/r1/scopes/project%3Aread');
|
|
85
|
-
})
|
|
86
|
-
(0, vitest_1.it)('duplicateRole should call POST .../duplicate with body', () =>
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.it)('duplicateRole should call POST .../duplicate with body', async () => {
|
|
87
78
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
88
79
|
const body = { name: 'Copy of Role' };
|
|
89
80
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({
|
|
@@ -91,22 +82,22 @@ const organization_roles_1 = require("./organization-roles");
|
|
|
91
82
|
name: 'Copy of Role',
|
|
92
83
|
scopes: [],
|
|
93
84
|
});
|
|
94
|
-
|
|
85
|
+
await client.duplicateRole('org-1', 'r1', body);
|
|
95
86
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/orgs/org-1/roles/r1/duplicate', body);
|
|
96
|
-
})
|
|
97
|
-
(0, vitest_1.it)('listRoleAssignments should call GET /orgs/{orgUuid}/roles/assignments', () =>
|
|
87
|
+
});
|
|
88
|
+
(0, vitest_1.it)('listRoleAssignments should call GET /orgs/{orgUuid}/roles/assignments', async () => {
|
|
98
89
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
99
90
|
const assignments = [{ roleId: 'r1', roleName: 'Admin' }];
|
|
100
91
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(assignments);
|
|
101
|
-
const result =
|
|
92
|
+
const result = await client.listRoleAssignments('org-1');
|
|
102
93
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/orgs/org-1/roles/assignments');
|
|
103
94
|
(0, vitest_1.expect)(result).toEqual(assignments);
|
|
104
|
-
})
|
|
105
|
-
(0, vitest_1.it)('assignRoleToUser should call POST .../assignments/user/{userId}', () =>
|
|
95
|
+
});
|
|
96
|
+
(0, vitest_1.it)('assignRoleToUser should call POST .../assignments/user/{userId}', async () => {
|
|
106
97
|
const client = new organization_roles_1.OrganizationRolesClient(mockHttp);
|
|
107
98
|
const body = { roleId: 'r1' };
|
|
108
99
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({ roleId: 'r1' });
|
|
109
|
-
|
|
100
|
+
await client.assignRoleToUser('org-1', 'user-1', body);
|
|
110
101
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/orgs/org-1/roles/assignments/user/user-1', body);
|
|
111
|
-
})
|
|
102
|
+
});
|
|
112
103
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project role assignments API client (v2). Manage project-level role assignments for users and groups.
|
|
3
3
|
*/
|
|
4
|
-
import type { components } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { components } from '@lightdash-tools/common';
|
|
6
6
|
type RoleAssignment = components['schemas']['RoleAssignment'];
|
|
7
7
|
type UpsertUserRoleAssignmentRequest = components['schemas']['UpsertUserRoleAssignmentRequest'];
|
|
8
8
|
type UpdateRoleAssignmentRequest = components['schemas']['UpdateRoleAssignmentRequest'];
|
|
@@ -2,54 +2,33 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Project role assignments API client (v2). Manage project-level role assignments for users and groups.
|
|
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.ProjectRoleAssignmentsClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class ProjectRoleAssignmentsClient extends base_client_1.BaseApiClient {
|
|
18
9
|
/** List project role assignments. */
|
|
19
|
-
listAssignments(projectId) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.get(`/projects/${projectId}/roles/assignments`);
|
|
22
|
-
});
|
|
10
|
+
async listAssignments(projectId) {
|
|
11
|
+
return this.http.get(`/projects/${projectId}/roles/assignments`);
|
|
23
12
|
}
|
|
24
13
|
/** Create or update project role assignment for a user (upsert). */
|
|
25
|
-
upsertUserAssignment(projectId, userId, body) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.post(`/projects/${projectId}/roles/assignments/user/${userId}`, body);
|
|
28
|
-
});
|
|
14
|
+
async upsertUserAssignment(projectId, userId, body) {
|
|
15
|
+
return this.http.post(`/projects/${projectId}/roles/assignments/user/${userId}`, body);
|
|
29
16
|
}
|
|
30
17
|
/** Delete project role assignment for a user. */
|
|
31
|
-
deleteUserAssignment(projectId, userId) {
|
|
32
|
-
|
|
33
|
-
yield this.http.delete(`/projects/${projectId}/roles/assignments/user/${userId}`);
|
|
34
|
-
});
|
|
18
|
+
async deleteUserAssignment(projectId, userId) {
|
|
19
|
+
await this.http.delete(`/projects/${projectId}/roles/assignments/user/${userId}`);
|
|
35
20
|
}
|
|
36
21
|
/** Create or update project role assignment for a group (upsert). */
|
|
37
|
-
upsertGroupAssignment(projectId, groupId, body) {
|
|
38
|
-
return
|
|
39
|
-
return this.http.post(`/projects/${projectId}/roles/assignments/group/${groupId}`, body);
|
|
40
|
-
});
|
|
22
|
+
async upsertGroupAssignment(projectId, groupId, body) {
|
|
23
|
+
return this.http.post(`/projects/${projectId}/roles/assignments/group/${groupId}`, body);
|
|
41
24
|
}
|
|
42
25
|
/** Delete project role assignment for a group. */
|
|
43
|
-
deleteGroupAssignment(projectId, groupId) {
|
|
44
|
-
|
|
45
|
-
yield this.http.delete(`/projects/${projectId}/roles/assignments/group/${groupId}`);
|
|
46
|
-
});
|
|
26
|
+
async deleteGroupAssignment(projectId, groupId) {
|
|
27
|
+
await this.http.delete(`/projects/${projectId}/roles/assignments/group/${groupId}`);
|
|
47
28
|
}
|
|
48
29
|
/** Update project role assignment for a group. */
|
|
49
|
-
updateGroupAssignment(projectId, groupId, body) {
|
|
50
|
-
return
|
|
51
|
-
return this.http.patch(`/projects/${projectId}/roles/assignments/group/${groupId}`, body);
|
|
52
|
-
});
|
|
30
|
+
async updateGroupAssignment(projectId, groupId, body) {
|
|
31
|
+
return this.http.patch(`/projects/${projectId}/roles/assignments/group/${groupId}`, body);
|
|
53
32
|
}
|
|
54
33
|
}
|
|
55
34
|
exports.ProjectRoleAssignmentsClient = ProjectRoleAssignmentsClient;
|
|
@@ -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 project_role_assignments_1 = require("./project-role-assignments");
|
|
@@ -22,45 +13,45 @@ const project_role_assignments_1 = require("./project-role-assignments");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('listAssignments should call GET /projects/{projectId}/roles/assignments', () =>
|
|
16
|
+
(0, vitest_1.it)('listAssignments should call GET /projects/{projectId}/roles/assignments', async () => {
|
|
26
17
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
27
18
|
const assignments = [{ roleId: 'r1', roleName: 'Editor' }];
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(assignments);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.listAssignments('proj-1');
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/proj-1/roles/assignments');
|
|
31
22
|
(0, vitest_1.expect)(result).toEqual(assignments);
|
|
32
|
-
})
|
|
33
|
-
(0, vitest_1.it)('upsertUserAssignment should call POST .../user/{userId} with body', () =>
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('upsertUserAssignment should call POST .../user/{userId} with body', async () => {
|
|
34
25
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
35
26
|
const body = { roleId: 'r1' };
|
|
36
27
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({ roleId: 'r1' });
|
|
37
|
-
|
|
28
|
+
await client.upsertUserAssignment('proj-1', 'user-1', body);
|
|
38
29
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/proj-1/roles/assignments/user/user-1', body);
|
|
39
|
-
})
|
|
40
|
-
(0, vitest_1.it)('deleteUserAssignment should call DELETE .../user/{userId}', () =>
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.it)('deleteUserAssignment should call DELETE .../user/{userId}', async () => {
|
|
41
32
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
42
33
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
43
|
-
|
|
34
|
+
await client.deleteUserAssignment('proj-1', 'user-1');
|
|
44
35
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/projects/proj-1/roles/assignments/user/user-1');
|
|
45
|
-
})
|
|
46
|
-
(0, vitest_1.it)('upsertGroupAssignment should call POST .../group/{groupId} with body', () =>
|
|
36
|
+
});
|
|
37
|
+
(0, vitest_1.it)('upsertGroupAssignment should call POST .../group/{groupId} with body', async () => {
|
|
47
38
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
48
39
|
const body = { roleId: 'r1' };
|
|
49
40
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({ roleId: 'r1' });
|
|
50
|
-
|
|
41
|
+
await client.upsertGroupAssignment('proj-1', 'group-1', body);
|
|
51
42
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/proj-1/roles/assignments/group/group-1', body);
|
|
52
|
-
})
|
|
53
|
-
(0, vitest_1.it)('deleteGroupAssignment should call DELETE .../group/{groupId}', () =>
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.it)('deleteGroupAssignment should call DELETE .../group/{groupId}', async () => {
|
|
54
45
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
55
46
|
vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
|
|
56
|
-
|
|
47
|
+
await client.deleteGroupAssignment('proj-1', 'group-1');
|
|
57
48
|
(0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/projects/proj-1/roles/assignments/group/group-1');
|
|
58
|
-
})
|
|
59
|
-
(0, vitest_1.it)('updateGroupAssignment should call PATCH .../group/{groupId}', () =>
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('updateGroupAssignment should call PATCH .../group/{groupId}', async () => {
|
|
60
51
|
const client = new project_role_assignments_1.ProjectRoleAssignmentsClient(mockHttp);
|
|
61
52
|
const body = { roleId: 'r2' };
|
|
62
53
|
vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue({ roleId: 'r2' });
|
|
63
|
-
|
|
54
|
+
await client.updateGroupAssignment('proj-1', 'group-1', body);
|
|
64
55
|
(0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/projects/proj-1/roles/assignments/group/group-1', body);
|
|
65
|
-
})
|
|
56
|
+
});
|
|
66
57
|
});
|
package/dist/api/v2/query.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Query API client for v2 endpoints. Run metric/SQL/underlying data queries using v2 API.
|
|
3
3
|
*/
|
|
4
|
-
import type { ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults } from '@lightdash-tools/common';
|
|
6
6
|
export declare class QueryClientV2 extends BaseApiClient {
|
|
7
7
|
/** Run a metric query (v2 endpoint). */
|
|
8
8
|
runMetricQuery(projectUuid: string, body: ExecuteAsyncMetricQueryRequestParams): Promise<ExecuteAsyncMetricQueryResults>;
|
package/dist/api/v2/query.js
CHANGED
|
@@ -2,48 +2,29 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Query API client for v2 endpoints. Run metric/SQL/underlying data queries using v2 API.
|
|
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.QueryClientV2 = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class QueryClientV2 extends base_client_1.BaseApiClient {
|
|
18
9
|
/** Run a metric query (v2 endpoint). */
|
|
19
|
-
runMetricQuery(projectUuid, body) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.post(`/projects/${projectUuid}/query/metric-query`, body);
|
|
22
|
-
});
|
|
10
|
+
async runMetricQuery(projectUuid, body) {
|
|
11
|
+
return this.http.post(`/projects/${projectUuid}/query/metric-query`, body);
|
|
23
12
|
}
|
|
24
13
|
/** Run a SQL query (v2 endpoint). */
|
|
25
|
-
runSqlQuery(projectUuid, body) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.post(`/projects/${projectUuid}/query/sql`, body);
|
|
28
|
-
});
|
|
14
|
+
async runSqlQuery(projectUuid, body) {
|
|
15
|
+
return this.http.post(`/projects/${projectUuid}/query/sql`, body);
|
|
29
16
|
}
|
|
30
17
|
/** Run a chart query (v2 endpoint). */
|
|
31
|
-
runChartQuery(projectUuid, body) {
|
|
32
|
-
return
|
|
33
|
-
return this.http.post(`/projects/${projectUuid}/query/chart`, body);
|
|
34
|
-
});
|
|
18
|
+
async runChartQuery(projectUuid, body) {
|
|
19
|
+
return this.http.post(`/projects/${projectUuid}/query/chart`, body);
|
|
35
20
|
}
|
|
36
21
|
/** Run a dashboard chart query (v2 endpoint). */
|
|
37
|
-
runDashboardChartQuery(projectUuid, body) {
|
|
38
|
-
return
|
|
39
|
-
return this.http.post(`/projects/${projectUuid}/query/dashboard-chart`, body);
|
|
40
|
-
});
|
|
22
|
+
async runDashboardChartQuery(projectUuid, body) {
|
|
23
|
+
return this.http.post(`/projects/${projectUuid}/query/dashboard-chart`, body);
|
|
41
24
|
}
|
|
42
25
|
/** Run an underlying data query (v2 endpoint). */
|
|
43
|
-
runUnderlyingDataQuery(projectUuid, body) {
|
|
44
|
-
return
|
|
45
|
-
return this.http.post(`/projects/${projectUuid}/query/underlying-data`, body);
|
|
46
|
-
});
|
|
26
|
+
async runUnderlyingDataQuery(projectUuid, body) {
|
|
27
|
+
return this.http.post(`/projects/${projectUuid}/query/underlying-data`, body);
|
|
47
28
|
}
|
|
48
29
|
}
|
|
49
30
|
exports.QueryClientV2 = QueryClientV2;
|
|
@@ -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 query_1 = require("./query");
|
|
@@ -22,7 +13,7 @@ const query_1 = require("./query");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('runMetricQuery should call POST /projects/{projectUuid}/query/metric-query with body', () =>
|
|
16
|
+
(0, vitest_1.it)('runMetricQuery should call POST /projects/{projectUuid}/query/metric-query with body', async () => {
|
|
26
17
|
const client = new query_1.QueryClientV2(mockHttp);
|
|
27
18
|
const body = {
|
|
28
19
|
exploreName: 'e1',
|
|
@@ -30,40 +21,40 @@ const query_1 = require("./query");
|
|
|
30
21
|
};
|
|
31
22
|
const results = { queryId: 'q1', status: 'running' };
|
|
32
23
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
33
|
-
const result =
|
|
24
|
+
const result = await client.runMetricQuery('p1', body);
|
|
34
25
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/metric-query', body);
|
|
35
26
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
36
|
-
})
|
|
37
|
-
(0, vitest_1.it)('runSqlQuery should call POST /projects/{projectUuid}/query/sql with body', () =>
|
|
27
|
+
});
|
|
28
|
+
(0, vitest_1.it)('runSqlQuery should call POST /projects/{projectUuid}/query/sql with body', async () => {
|
|
38
29
|
const client = new query_1.QueryClientV2(mockHttp);
|
|
39
30
|
const body = { sql: 'SELECT 1' };
|
|
40
31
|
const results = { queryId: 'q1', status: 'running' };
|
|
41
32
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
42
|
-
const result =
|
|
33
|
+
const result = await client.runSqlQuery('p1', body);
|
|
43
34
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/sql', body);
|
|
44
35
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
45
|
-
})
|
|
46
|
-
(0, vitest_1.it)('runChartQuery should call POST /projects/{projectUuid}/query/chart with body', () =>
|
|
36
|
+
});
|
|
37
|
+
(0, vitest_1.it)('runChartQuery should call POST /projects/{projectUuid}/query/chart with body', async () => {
|
|
47
38
|
const client = new query_1.QueryClientV2(mockHttp);
|
|
48
39
|
const body = { chartUuid: 'c1' };
|
|
49
40
|
const results = { queryId: 'q1', status: 'running' };
|
|
50
41
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
51
|
-
const result =
|
|
42
|
+
const result = await client.runChartQuery('p1', body);
|
|
52
43
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/chart', body);
|
|
53
44
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
54
|
-
})
|
|
55
|
-
(0, vitest_1.it)('runDashboardChartQuery should call POST /projects/{projectUuid}/query/dashboard-chart with body', () =>
|
|
45
|
+
});
|
|
46
|
+
(0, vitest_1.it)('runDashboardChartQuery should call POST /projects/{projectUuid}/query/dashboard-chart with body', async () => {
|
|
56
47
|
const client = new query_1.QueryClientV2(mockHttp);
|
|
57
48
|
const body = {
|
|
58
49
|
dashboardChartUuid: 'dc1',
|
|
59
50
|
};
|
|
60
51
|
const results = { queryId: 'q1', status: 'running' };
|
|
61
52
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
62
|
-
const result =
|
|
53
|
+
const result = await client.runDashboardChartQuery('p1', body);
|
|
63
54
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/dashboard-chart', body);
|
|
64
55
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
65
|
-
})
|
|
66
|
-
(0, vitest_1.it)('runUnderlyingDataQuery should call POST /projects/{projectUuid}/query/underlying-data with body', () =>
|
|
56
|
+
});
|
|
57
|
+
(0, vitest_1.it)('runUnderlyingDataQuery should call POST /projects/{projectUuid}/query/underlying-data with body', async () => {
|
|
67
58
|
const client = new query_1.QueryClientV2(mockHttp);
|
|
68
59
|
const body = {
|
|
69
60
|
exploreName: 'e1',
|
|
@@ -71,8 +62,8 @@ const query_1 = require("./query");
|
|
|
71
62
|
};
|
|
72
63
|
const results = { queryId: 'q1', status: 'running' };
|
|
73
64
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
74
|
-
const result =
|
|
65
|
+
const result = await client.runUnderlyingDataQuery('p1', body);
|
|
75
66
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/query/underlying-data', body);
|
|
76
67
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
77
|
-
})
|
|
68
|
+
});
|
|
78
69
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation API client (v2). Paginated validation results with search, filter, and sort support.
|
|
3
|
+
*/
|
|
4
|
+
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { components } from '@lightdash-tools/common';
|
|
6
|
+
/** Query params for listing validation results (v2). */
|
|
7
|
+
export interface ListValidationResultsParams {
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
searchQuery?: string;
|
|
11
|
+
sortBy?: 'createdAt' | 'errorType' | 'name' | 'source';
|
|
12
|
+
sortDirection?: 'asc' | 'desc';
|
|
13
|
+
sourceTypes?: string;
|
|
14
|
+
errorTypes?: string;
|
|
15
|
+
includeChartConfigWarnings?: boolean;
|
|
16
|
+
fromSettings?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class ValidationClientV2 extends BaseApiClient {
|
|
19
|
+
/**
|
|
20
|
+
* List validation results for a project (v2 endpoint).
|
|
21
|
+
* Returns paginated results with search, filter, and sort support.
|
|
22
|
+
*/
|
|
23
|
+
listValidationResults(projectUuid: string, params?: ListValidationResultsParams): Promise<components['schemas']['ApiPaginatedValidateResponse']>;
|
|
24
|
+
/**
|
|
25
|
+
* Get a single validation result by ID (v2 endpoint).
|
|
26
|
+
*/
|
|
27
|
+
getValidationResult(projectUuid: string, validationId: number): Promise<components['schemas']['ApiSingleValidationResponse']>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validation API client (v2). Paginated validation results with search, filter, and sort support.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValidationClientV2 = void 0;
|
|
7
|
+
const base_client_1 = require("../base-client");
|
|
8
|
+
class ValidationClientV2 extends base_client_1.BaseApiClient {
|
|
9
|
+
/**
|
|
10
|
+
* List validation results for a project (v2 endpoint).
|
|
11
|
+
* Returns paginated results with search, filter, and sort support.
|
|
12
|
+
*/
|
|
13
|
+
async listValidationResults(projectUuid, params) {
|
|
14
|
+
return this.http.get(`/projects/${projectUuid}/validate`, { params });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get a single validation result by ID (v2 endpoint).
|
|
18
|
+
*/
|
|
19
|
+
async getValidationResult(projectUuid, validationId) {
|
|
20
|
+
return this.http.get(`/projects/${projectUuid}/validate/${validationId}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ValidationClientV2 = ValidationClientV2;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Main Lightdash API client. Configuration can be explicit or loaded from environment variables.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { ProjectsClient } from './api/v1/projects';
|
|
7
|
-
import { OrganizationsClient } from './api/v1/organizations';
|
|
4
|
+
import { AiAgentsClient } from './api/v1/ai-agents';
|
|
5
|
+
import { AnalyticsClient } from './api/v1/analytics';
|
|
8
6
|
import { ChartsClient } from './api/v1/charts';
|
|
9
7
|
import { DashboardsClient } from './api/v1/dashboards';
|
|
10
|
-
import { SpacesClient } from './api/v1/spaces';
|
|
11
|
-
import { QueryClient } from './api/v1/query';
|
|
12
|
-
import { QueryClientV2 } from './api/v2/query';
|
|
13
|
-
import { OrganizationRolesClient } from './api/v2/organization-roles';
|
|
14
|
-
import { ProjectRoleAssignmentsClient } from './api/v2/project-role-assignments';
|
|
15
|
-
import { UsersClient } from './api/v1/users';
|
|
16
|
-
import { GroupsClient } from './api/v1/groups';
|
|
17
|
-
import { AiAgentsClient } from './api/v1/ai-agents';
|
|
18
|
-
import { ProjectAccessClient } from './api/v1/project-access';
|
|
19
8
|
import { ExploresClient } from './api/v1/explores';
|
|
20
|
-
import {
|
|
9
|
+
import { GroupsClient } from './api/v1/groups';
|
|
21
10
|
import { MetricsClient } from './api/v1/metrics';
|
|
11
|
+
import { OrganizationsClient } from './api/v1/organizations';
|
|
12
|
+
import { ProjectAccessClient } from './api/v1/project-access';
|
|
13
|
+
import { ProjectsClient } from './api/v1/projects';
|
|
14
|
+
import { QueryClient } from './api/v1/query';
|
|
22
15
|
import { SchedulersClient } from './api/v1/schedulers';
|
|
16
|
+
import { SpacesClient } from './api/v1/spaces';
|
|
23
17
|
import { TagsClient } from './api/v1/tags';
|
|
18
|
+
import { UsersClient } from './api/v1/users';
|
|
19
|
+
import { ValidationClient } from './api/v1/validation';
|
|
24
20
|
import { ContentClient } from './api/v2/content';
|
|
21
|
+
import { DashboardsClientV2 } from './api/v2/dashboards';
|
|
22
|
+
import { OrganizationRolesClient } from './api/v2/organization-roles';
|
|
23
|
+
import { ProjectRoleAssignmentsClient } from './api/v2/project-role-assignments';
|
|
24
|
+
import { QueryClientV2 } from './api/v2/query';
|
|
25
|
+
import { ValidationClientV2 } from './api/v2/validation';
|
|
26
|
+
import { HttpClient } from './http/http-client';
|
|
27
|
+
import type { PartialLightdashClientConfig } from './config';
|
|
25
28
|
/**
|
|
26
29
|
* V1 API clients namespace. Contains all v1 API clients.
|
|
27
30
|
*/
|
|
@@ -41,6 +44,7 @@ export declare class V1ApiClients {
|
|
|
41
44
|
readonly metrics: MetricsClient;
|
|
42
45
|
readonly schedulers: SchedulersClient;
|
|
43
46
|
readonly tags: TagsClient;
|
|
47
|
+
readonly analytics: AnalyticsClient;
|
|
44
48
|
constructor(http: HttpClient);
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
@@ -51,6 +55,8 @@ export declare class V2ApiClients {
|
|
|
51
55
|
readonly organizationRoles: OrganizationRolesClient;
|
|
52
56
|
readonly projectRoleAssignments: ProjectRoleAssignmentsClient;
|
|
53
57
|
readonly content: ContentClient;
|
|
58
|
+
readonly validation: ValidationClientV2;
|
|
59
|
+
readonly dashboards: DashboardsClientV2;
|
|
54
60
|
constructor(http: HttpClient);
|
|
55
61
|
}
|
|
56
62
|
/**
|