@lightdash-tools/client 0.5.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
package/dist/api/v1/projects.js
CHANGED
|
@@ -2,36 +2,21 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Projects API client. Endpoints for project and project-scoped resources.
|
|
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.ProjectsClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class ProjectsClient extends base_client_1.BaseApiClient {
|
|
18
9
|
/** Get a project by UUID. */
|
|
19
|
-
getProject(projectUuid) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.get(`/projects/${projectUuid}`);
|
|
22
|
-
});
|
|
10
|
+
async getProject(projectUuid) {
|
|
11
|
+
return this.http.get(`/projects/${projectUuid}`);
|
|
23
12
|
}
|
|
24
13
|
/** List all projects in the current organization. */
|
|
25
|
-
listProjects() {
|
|
26
|
-
return
|
|
27
|
-
return this.http.get('/org/projects');
|
|
28
|
-
});
|
|
14
|
+
async listProjects() {
|
|
15
|
+
return this.http.get('/org/projects');
|
|
29
16
|
}
|
|
30
17
|
/** List charts in a project. */
|
|
31
|
-
listChartsInProject(projectUuid) {
|
|
32
|
-
return
|
|
33
|
-
return this.http.get(`/projects/${projectUuid}/charts`);
|
|
34
|
-
});
|
|
18
|
+
async listChartsInProject(projectUuid) {
|
|
19
|
+
return this.http.get(`/projects/${projectUuid}/charts`);
|
|
35
20
|
}
|
|
36
21
|
}
|
|
37
22
|
exports.ProjectsClient = ProjectsClient;
|
|
@@ -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 projects_1 = require("./projects");
|
|
@@ -22,28 +13,28 @@ const projects_1 = require("./projects");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('getProject should call GET /projects/{projectUuid}', () =>
|
|
16
|
+
(0, vitest_1.it)('getProject should call GET /projects/{projectUuid}', async () => {
|
|
26
17
|
const client = new projects_1.ProjectsClient(mockHttp);
|
|
27
18
|
const project = { projectUuid: 'p1', name: 'Test' };
|
|
28
19
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(project);
|
|
29
|
-
const result =
|
|
20
|
+
const result = await client.getProject('p1');
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1');
|
|
31
22
|
(0, vitest_1.expect)(result).toEqual(project);
|
|
32
|
-
})
|
|
33
|
-
(0, vitest_1.it)('listProjects should call GET /org/projects', () =>
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('listProjects should call GET /org/projects', async () => {
|
|
34
25
|
const client = new projects_1.ProjectsClient(mockHttp);
|
|
35
26
|
const list = [{ projectUuid: 'p1', name: 'P1' }];
|
|
36
27
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(list);
|
|
37
|
-
const result =
|
|
28
|
+
const result = await client.listProjects();
|
|
38
29
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/projects');
|
|
39
30
|
(0, vitest_1.expect)(result).toEqual(list);
|
|
40
|
-
})
|
|
41
|
-
(0, vitest_1.it)('listChartsInProject should call GET /projects/{projectUuid}/charts', () =>
|
|
31
|
+
});
|
|
32
|
+
(0, vitest_1.it)('listChartsInProject should call GET /projects/{projectUuid}/charts', async () => {
|
|
42
33
|
const client = new projects_1.ProjectsClient(mockHttp);
|
|
43
34
|
const charts = [];
|
|
44
35
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(charts);
|
|
45
|
-
const result =
|
|
36
|
+
const result = await client.listChartsInProject('p1');
|
|
46
37
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/charts');
|
|
47
38
|
(0, vitest_1.expect)(result).toEqual(charts);
|
|
48
|
-
})
|
|
39
|
+
});
|
|
49
40
|
});
|
package/dist/api/v1/query.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Query API client. Run metric/SQL/underlying data queries.
|
|
3
3
|
*/
|
|
4
|
-
import type { MetricQueryRequest, RunQueryResults, CompileQueryRequest, CompiledQueryResults } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { MetricQueryRequest, RunQueryResults, CompileQueryRequest, CompiledQueryResults } from '@lightdash-tools/common';
|
|
6
6
|
export declare class QueryClient extends BaseApiClient {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Run a metric query for an explore.
|
|
9
|
+
* @deprecated This API endpoint is deprecated in Lightdash. Use v2 query API instead.
|
|
10
|
+
*/
|
|
8
11
|
runQuery(projectUuid: string, exploreId: string, body: MetricQueryRequest): Promise<RunQueryResults>;
|
|
9
12
|
/** Compile a metric query for an explore. */
|
|
10
13
|
compileQuery(projectUuid: string, exploreId: string, body: CompileQueryRequest): Promise<CompiledQueryResults>;
|
package/dist/api/v1/query.js
CHANGED
|
@@ -2,30 +2,20 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Query API client. Run metric/SQL/underlying data queries.
|
|
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.QueryClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class QueryClient extends base_client_1.BaseApiClient {
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Run a metric query for an explore.
|
|
11
|
+
* @deprecated This API endpoint is deprecated in Lightdash. Use v2 query API instead.
|
|
12
|
+
*/
|
|
13
|
+
async runQuery(projectUuid, exploreId, body) {
|
|
14
|
+
return this.http.post(`/projects/${projectUuid}/explores/${exploreId}/runQuery`, body);
|
|
23
15
|
}
|
|
24
16
|
/** Compile a metric query for an explore. */
|
|
25
|
-
compileQuery(projectUuid, exploreId, body) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.post(`/projects/${projectUuid}/explores/${exploreId}/compileQuery`, body);
|
|
28
|
-
});
|
|
17
|
+
async compileQuery(projectUuid, exploreId, body) {
|
|
18
|
+
return this.http.post(`/projects/${projectUuid}/explores/${exploreId}/compileQuery`, body);
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
21
|
exports.QueryClient = QueryClient;
|
|
@@ -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,16 +13,16 @@ const query_1 = require("./query");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('runQuery should call POST /projects/{projectUuid}/explores/{exploreId}/runQuery with body', () =>
|
|
16
|
+
(0, vitest_1.it)('runQuery should call POST /projects/{projectUuid}/explores/{exploreId}/runQuery with body', async () => {
|
|
26
17
|
const client = new query_1.QueryClient(mockHttp);
|
|
27
18
|
const body = { dimensions: [], metrics: [], filters: {} };
|
|
28
19
|
const results = { rows: [], metricQuery: {} };
|
|
29
20
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
30
|
-
const result =
|
|
21
|
+
const result = await client.runQuery('p1', 'explore1', body);
|
|
31
22
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/explores/explore1/runQuery', body);
|
|
32
23
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
33
|
-
})
|
|
34
|
-
(0, vitest_1.it)('compileQuery should call POST /projects/{projectUuid}/explores/{exploreId}/compileQuery with body', () =>
|
|
24
|
+
});
|
|
25
|
+
(0, vitest_1.it)('compileQuery should call POST /projects/{projectUuid}/explores/{exploreId}/compileQuery with body', async () => {
|
|
35
26
|
const client = new query_1.QueryClient(mockHttp);
|
|
36
27
|
const body = {
|
|
37
28
|
dimensions: [],
|
|
@@ -44,8 +35,8 @@ const query_1 = require("./query");
|
|
|
44
35
|
};
|
|
45
36
|
const results = { query: 'SELECT ...', parameterReferences: [] };
|
|
46
37
|
vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(results);
|
|
47
|
-
const result =
|
|
38
|
+
const result = await client.compileQuery('p1', 'explore1', body);
|
|
48
39
|
(0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/explores/explore1/compileQuery', body);
|
|
49
40
|
(0, vitest_1.expect)(result).toEqual(results);
|
|
50
|
-
})
|
|
41
|
+
});
|
|
51
42
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Schedulers 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 schedulers. */
|
|
7
7
|
export interface ListSchedulersParams {
|
|
8
8
|
pageSize?: number;
|
|
9
9
|
page?: number;
|
|
10
10
|
searchQuery?: string;
|
|
11
|
-
sortBy?: '
|
|
11
|
+
sortBy?: 'createdAt' | 'name';
|
|
12
12
|
sortDirection?: 'asc' | 'desc';
|
|
13
13
|
createdByUserUuids?: string;
|
|
14
14
|
formats?: string;
|
|
@@ -2,30 +2,17 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Schedulers 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.SchedulersClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class SchedulersClient extends base_client_1.BaseApiClient {
|
|
18
9
|
/** List schedulers in a project. */
|
|
19
|
-
listSchedulers(projectUuid, params) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.get(`/schedulers/${projectUuid}/list`, { params });
|
|
22
|
-
});
|
|
10
|
+
async listSchedulers(projectUuid, params) {
|
|
11
|
+
return this.http.get(`/schedulers/${projectUuid}/list`, { params });
|
|
23
12
|
}
|
|
24
13
|
/** Get a scheduler by UUID. */
|
|
25
|
-
getScheduler(schedulerUuid) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.get(`/schedulers/${schedulerUuid}`);
|
|
28
|
-
});
|
|
14
|
+
async getScheduler(schedulerUuid) {
|
|
15
|
+
return this.http.get(`/schedulers/${schedulerUuid}`);
|
|
29
16
|
}
|
|
30
17
|
}
|
|
31
18
|
exports.SchedulersClient = SchedulersClient;
|
|
@@ -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 schedulers_1 = require("./schedulers");
|
|
@@ -22,22 +13,22 @@ const schedulers_1 = require("./schedulers");
|
|
|
22
13
|
delete: vitest_1.vi.fn(),
|
|
23
14
|
};
|
|
24
15
|
});
|
|
25
|
-
(0, vitest_1.it)('listSchedulers should call GET /schedulers/{projectUuid}/list', () =>
|
|
16
|
+
(0, vitest_1.it)('listSchedulers should call GET /schedulers/{projectUuid}/list', async () => {
|
|
26
17
|
const client = new schedulers_1.SchedulersClient(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.listSchedulers('p1', { page: 1 });
|
|
30
21
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/schedulers/p1/list', {
|
|
31
22
|
params: { page: 1 },
|
|
32
23
|
});
|
|
33
24
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
34
|
-
})
|
|
35
|
-
(0, vitest_1.it)('getScheduler should call GET /schedulers/{schedulerUuid}', () =>
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.it)('getScheduler should call GET /schedulers/{schedulerUuid}', async () => {
|
|
36
27
|
const client = new schedulers_1.SchedulersClient(mockHttp);
|
|
37
28
|
const mockResponse = { status: 'ok', results: {} };
|
|
38
29
|
vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
|
|
39
|
-
const result =
|
|
30
|
+
const result = await client.getScheduler('s1');
|
|
40
31
|
(0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/schedulers/s1');
|
|
41
32
|
(0, vitest_1.expect)(result).toEqual(mockResponse);
|
|
42
|
-
})
|
|
33
|
+
});
|
|
43
34
|
});
|
package/dist/api/v1/spaces.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Spaces API client.
|
|
3
3
|
*/
|
|
4
|
-
import type { LightdashApi, SpaceSummary, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess } from '@lightdash-tools/common';
|
|
5
4
|
import { BaseApiClient } from '../base-client';
|
|
5
|
+
import type { LightdashApi, SpaceSummary, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess } from '@lightdash-tools/common';
|
|
6
6
|
export declare class SpacesClient extends BaseApiClient {
|
|
7
7
|
/** List spaces in a project. */
|
|
8
8
|
listSpacesInProject(projectUuid: string): Promise<SpaceSummary[]>;
|
package/dist/api/v1/spaces.js
CHANGED
|
@@ -2,72 +2,45 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Spaces 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.SpacesClient = void 0;
|
|
16
7
|
const base_client_1 = require("../base-client");
|
|
17
8
|
class SpacesClient extends base_client_1.BaseApiClient {
|
|
18
9
|
/** List spaces in a project. */
|
|
19
|
-
listSpacesInProject(projectUuid) {
|
|
20
|
-
return
|
|
21
|
-
return this.http.get(`/projects/${projectUuid}/spaces`);
|
|
22
|
-
});
|
|
10
|
+
async listSpacesInProject(projectUuid) {
|
|
11
|
+
return this.http.get(`/projects/${projectUuid}/spaces`);
|
|
23
12
|
}
|
|
24
13
|
/** Get a space by project and space UUID. */
|
|
25
|
-
getSpace(projectUuid, spaceUuid) {
|
|
26
|
-
return
|
|
27
|
-
return this.http.get(`/projects/${projectUuid}/spaces/${spaceUuid}`);
|
|
28
|
-
});
|
|
14
|
+
async getSpace(projectUuid, spaceUuid) {
|
|
15
|
+
return this.http.get(`/projects/${projectUuid}/spaces/${spaceUuid}`);
|
|
29
16
|
}
|
|
30
17
|
/** Create a space in a project. */
|
|
31
|
-
createSpace(projectUuid, body) {
|
|
32
|
-
return
|
|
33
|
-
return this.http.post(`/projects/${projectUuid}/spaces`, body);
|
|
34
|
-
});
|
|
18
|
+
async createSpace(projectUuid, body) {
|
|
19
|
+
return this.http.post(`/projects/${projectUuid}/spaces`, body);
|
|
35
20
|
}
|
|
36
21
|
/** Update a space. */
|
|
37
|
-
updateSpace(projectUuid, spaceUuid, body) {
|
|
38
|
-
return
|
|
39
|
-
return this.http.patch(`/projects/${projectUuid}/spaces/${spaceUuid}`, body);
|
|
40
|
-
});
|
|
22
|
+
async updateSpace(projectUuid, spaceUuid, body) {
|
|
23
|
+
return this.http.patch(`/projects/${projectUuid}/spaces/${spaceUuid}`, body);
|
|
41
24
|
}
|
|
42
25
|
/** Delete a space. */
|
|
43
|
-
deleteSpace(projectUuid, spaceUuid) {
|
|
44
|
-
|
|
45
|
-
yield this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}`);
|
|
46
|
-
});
|
|
26
|
+
async deleteSpace(projectUuid, spaceUuid) {
|
|
27
|
+
await this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}`);
|
|
47
28
|
}
|
|
48
29
|
/** Grant a user access to a space. */
|
|
49
|
-
grantUserAccessToSpace(projectUuid, spaceUuid, body) {
|
|
50
|
-
|
|
51
|
-
yield this.http.post(`/projects/${projectUuid}/spaces/${spaceUuid}/share`, body);
|
|
52
|
-
});
|
|
30
|
+
async grantUserAccessToSpace(projectUuid, spaceUuid, body) {
|
|
31
|
+
await this.http.post(`/projects/${projectUuid}/spaces/${spaceUuid}/share`, body);
|
|
53
32
|
}
|
|
54
33
|
/** Revoke a user's access to a space. */
|
|
55
|
-
revokeUserAccessToSpace(projectUuid, spaceUuid, userUuid) {
|
|
56
|
-
|
|
57
|
-
yield this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}/share/${userUuid}`);
|
|
58
|
-
});
|
|
34
|
+
async revokeUserAccessToSpace(projectUuid, spaceUuid, userUuid) {
|
|
35
|
+
await this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}/share/${userUuid}`);
|
|
59
36
|
}
|
|
60
37
|
/** Grant a group access to a space. */
|
|
61
|
-
grantGroupAccessToSpace(projectUuid, spaceUuid, body) {
|
|
62
|
-
|
|
63
|
-
yield this.http.post(`/projects/${projectUuid}/spaces/${spaceUuid}/group/share`, body);
|
|
64
|
-
});
|
|
38
|
+
async grantGroupAccessToSpace(projectUuid, spaceUuid, body) {
|
|
39
|
+
await this.http.post(`/projects/${projectUuid}/spaces/${spaceUuid}/group/share`, body);
|
|
65
40
|
}
|
|
66
41
|
/** Revoke a group's access to a space. */
|
|
67
|
-
revokeGroupAccessToSpace(projectUuid, spaceUuid, groupUuid) {
|
|
68
|
-
|
|
69
|
-
yield this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}/group/share/${groupUuid}`);
|
|
70
|
-
});
|
|
42
|
+
async revokeGroupAccessToSpace(projectUuid, spaceUuid, groupUuid) {
|
|
43
|
+
await this.http.delete(`/projects/${projectUuid}/spaces/${spaceUuid}/group/share/${groupUuid}`);
|
|
71
44
|
}
|
|
72
45
|
}
|
|
73
46
|
exports.SpacesClient = SpacesClient;
|
|
@@ -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
|
}
|