@lightdash-tools/client 0.23.0 → 0.25.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.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Applies a computed bundle diff to Lightdash.
3
3
  */
4
- import type { ApplyBundleDiffFailure } from './apply-context';
5
4
  import type { LightdashClient } from '../client';
5
+ import type { ApplyBundleDiffFailure } from './apply-context';
6
6
  import type { BundleDiffChange, LightdashAiAgentBundle } from '@lightdash-tools/common';
7
7
  export type { ApplyBundleDiffFailure } from './apply-context';
8
8
  export interface ApplyBundleDiffResult {
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import { BaseApiClient } from '../../base-client';
6
6
  import { type StartConversationThreadBody } from './threads';
7
- import type { RequestOptions } from './request-options';
8
7
  import type { HttpClient } from '../../../http/http-client';
9
- import type { AgentSuggestions, AiAgent, AiAgentDocument, AiAgentDocumentContent, AiAgentDocumentSummary, AiAgentEvaluation, AiAgentEvaluationRun, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationSummary, AiAgentExploreAccessSummary, AiAgentMcpServerTool, AiAgentsAdminThreadsResult, AiAgentSummary, AiAgentThread, AiAgentThreadMessageVizQuery, AiAgentThreadSummary, AiAgentUserPreferences, AiAgentVerifiedArtifactsListResult, AiAgentVerifiedQuestion, AiArtifact, AiMcpServer, AiMcpServerTool, AiModelOption, AiRouterRouteRequest, AiRouterRouteResponseResult, AppendEvaluationBody, CloneThreadBody, CreateAgentThreadBody, CreateAgentThreadMessageResult, CreateAgentDocumentBody, CreateAiAgent, CreateEvaluationBody, CreateEvaluationResult, CreateProjectMcpServerBody, ExploreAccessSummaryBody, GenerateAgentThreadBody, GenerateAgentThreadResult, GenerateThreadTitleResult, GetAdminThreadsParams, GetAgentSuggestionsParams, GetAiOrganizationSettingsResult, ListVerifiedArtifactsParams, ReadinessScore, SubmitSqlApprovalBody, SubmitSqlApprovalResult, UpdateAiAgent, UpdateAiOrganizationSettings, UpdateAgentDocumentContentBody, UpdateAgentDocumentSettingsBody, UpdateAiOrganizationSettingsResult, UpdateAgentMcpServerToolsBody, UpdateEvaluationBody, UpdateMessageFeedbackBody } from '@lightdash-tools/common';
8
+ import type { RequestOptions } from './request-options';
9
+ import type { AgentSuggestions, AiAgent, AiAgentDocument, AiAgentDocumentContent, AiAgentDocumentSummary, AiAgentEvaluation, AiAgentEvaluationRun, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationSummary, AiAgentExploreAccessSummary, AiAgentMcpServerTool, AiAgentsAdminThreadsResult, AiAgentSummary, AiAgentThread, AiAgentThreadMessageVizQuery, AiAgentThreadSummary, AiAgentUserPreferences, AiAgentVerifiedArtifactsListResult, AiAgentVerifiedQuestion, AiArtifact, AiMcpServer, AiMcpServerTool, AiProjectMcpServer, AiModelOption, AiRouterRouteRequest, AiRouterRouteResponseResult, AppendEvaluationBody, CloneThreadBody, CreateAgentThreadBody, CreateAgentThreadMessageResult, CreateAgentDocumentBody, CreateAiAgent, CreateEvaluationBody, CreateEvaluationResult, CreateProjectMcpServerBody, ExploreAccessSummaryBody, GenerateAgentThreadBody, GenerateAgentThreadResult, GenerateThreadTitleResult, GetAdminThreadsParams, GetAgentSuggestionsParams, GetAiOrganizationSettingsResult, ListVerifiedArtifactsParams, ReadinessScore, SubmitSqlApprovalBody, SubmitSqlApprovalResult, UpdateAiAgent, UpdateAiOrganizationSettings, UpdateAgentDocumentContentBody, UpdateAgentDocumentSettingsBody, UpdateAiOrganizationSettingsResult, UpdateAgentMcpServerToolsBody, UpdateEvaluationBody, UpdateMessageFeedbackBody } from '@lightdash-tools/common';
10
10
  export declare class AiAgentsClient extends BaseApiClient {
11
11
  private readonly admin;
12
12
  private readonly agents;
@@ -64,7 +64,7 @@ export declare class AiAgentsClient extends BaseApiClient {
64
64
  getArtifactVersionVizQuery(projectUuid: string, agentUuid: string, artifactUuid: string, versionUuid: string): Promise<AiAgentThreadMessageVizQuery>;
65
65
  getDashboardArtifactChartVizQuery(projectUuid: string, agentUuid: string, artifactUuid: string, versionUuid: string, chartIndex: number): Promise<AiAgentThreadMessageVizQuery>;
66
66
  updateMessageFeedback(projectUuid: string, agentUuid: string, threadUuid: string, messageUuid: string, body: UpdateMessageFeedbackBody): Promise<void>;
67
- listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]>;
67
+ listProjectMcpServers(projectUuid: string): Promise<AiProjectMcpServer[]>;
68
68
  createProjectMcpServer(projectUuid: string, body: CreateProjectMcpServerBody): Promise<AiMcpServer>;
69
69
  listMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
70
70
  refreshMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
@@ -3,10 +3,10 @@
3
3
  * Endpoints: /api/v1/projects/{projectUuid}/aiAgents/mcpServers/...
4
4
  */
5
5
  import { BaseApiClient } from '../../base-client';
6
- import type { AiAgentMcpServerTool, AiMcpServer, AiMcpServerTool, CreateProjectMcpServerBody, UpdateAgentMcpServerToolsBody } from '@lightdash-tools/common';
6
+ import type { AiAgentMcpServerTool, AiMcpServer, AiMcpServerTool, AiProjectMcpServer, CreateProjectMcpServerBody, UpdateAgentMcpServerToolsBody } from '@lightdash-tools/common';
7
7
  export declare class AiAgentsMcpServersClient extends BaseApiClient {
8
8
  /** List MCP servers configured for a project (GET …/mcpServers). */
9
- listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]>;
9
+ listProjectMcpServers(projectUuid: string): Promise<AiProjectMcpServer[]>;
10
10
  /** Create a project MCP server (POST …/mcpServers). */
11
11
  createProjectMcpServer(projectUuid: string, body: CreateProjectMcpServerBody): Promise<AiMcpServer>;
12
12
  /** List tools exposed by a project MCP server (GET …/mcpServers/{mcpServerUuid}/tools). */
@@ -14,12 +14,14 @@ const mcp_servers_1 = require("./mcp-servers");
14
14
  };
15
15
  });
16
16
  (0, vitest_1.it)('listProjectMcpServers should call GET …/mcpServers', async () => {
17
+ var _a;
17
18
  const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
18
- const servers = [{ uuid: 'mcp1', name: 'GitHub' }];
19
+ const servers = [{ uuid: 'mcp1', name: 'GitHub', attachedAgentCount: 2 }];
19
20
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(servers);
20
21
  const result = await client.listProjectMcpServers('proj1');
21
22
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers');
22
23
  (0, vitest_1.expect)(result).toEqual(servers);
24
+ (0, vitest_1.expect)((_a = result[0]) === null || _a === void 0 ? void 0 : _a.attachedAgentCount).toBe(2);
23
25
  });
24
26
  (0, vitest_1.it)('createProjectMcpServer should call POST …/mcpServers', async () => {
25
27
  const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
@@ -23,9 +23,16 @@ const ai_agents_1 = require("./ai-agents");
23
23
  pageSize: 20,
24
24
  sortField: 'createdAt',
25
25
  sortDirection: 'desc',
26
+ createdFrom: 'data_app',
26
27
  });
27
28
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/aiAgents/admin/threads', {
28
- params: { page: 1, pageSize: 20, sortField: 'createdAt', sortDirection: 'desc' },
29
+ params: {
30
+ page: 1,
31
+ pageSize: 20,
32
+ sortField: 'createdAt',
33
+ sortDirection: 'desc',
34
+ createdFrom: 'data_app',
35
+ },
29
36
  });
30
37
  (0, vitest_1.expect)(result).toEqual(results);
31
38
  });
@@ -11,6 +11,6 @@ export declare class ProjectsClient extends BaseApiClient {
11
11
  listProjects(): Promise<OrganizationProject[]>;
12
12
  /** List charts in a project. */
13
13
  listChartsInProject(projectUuid: string): Promise<SpaceQuery[]>;
14
- /** List admin-verified charts and dashboards in a project. */
14
+ /** List admin-verified charts, dashboards, data apps, and documents in a project. */
15
15
  listVerifiedContent(projectUuid: string): Promise<VerifiedContentListItem[]>;
16
16
  }
@@ -18,7 +18,7 @@ class ProjectsClient extends base_client_1.BaseApiClient {
18
18
  async listChartsInProject(projectUuid) {
19
19
  return this.http.get(`/projects/${projectUuid}/charts`);
20
20
  }
21
- /** List admin-verified charts and dashboards in a project. */
21
+ /** List admin-verified charts, dashboards, data apps, and documents in a project. */
22
22
  async listVerifiedContent(projectUuid) {
23
23
  return this.http.get(`/projects/${projectUuid}/content-verification`);
24
24
  }
@@ -39,22 +39,21 @@ const projects_1 = require("./projects");
39
39
  });
40
40
  (0, vitest_1.it)('listVerifiedContent should call GET /projects/{projectUuid}/content-verification', async () => {
41
41
  const client = new projects_1.ProjectsClient(mockHttp);
42
+ const verifiedBy = { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' };
43
+ const shared = {
44
+ description: null,
45
+ spaceUuid: 's1',
46
+ spaceName: 'Space',
47
+ views: 10,
48
+ lastUpdatedAt: null,
49
+ verifiedAt: '2026-01-01T00:00:00.000Z',
50
+ verifiedBy,
51
+ };
42
52
  const items = [
43
- {
44
- contentType: 'chart',
45
- uuid: 'c1',
46
- contentUuid: 'c1',
47
- name: 'Verified chart',
48
- description: null,
49
- spaceUuid: 's1',
50
- spaceName: 'Space',
51
- views: 10,
52
- lastUpdatedAt: null,
53
- verifiedAt: '2026-01-01T00:00:00.000Z',
54
- verifiedBy: { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' },
55
- chartKind: 'vertical_bar',
56
- exploreName: 'orders',
57
- },
53
+ Object.assign(Object.assign({}, shared), { contentType: 'chart', uuid: 'c1', contentUuid: 'c1', name: 'Verified chart', slug: 'verified-chart', chartKind: 'vertical_bar', exploreName: 'orders' }),
54
+ Object.assign(Object.assign({}, shared), { contentType: 'dashboard', uuid: 'd1', contentUuid: 'd1', name: 'Verified dashboard', slug: 'verified-dashboard' }),
55
+ Object.assign(Object.assign({}, shared), { contentType: 'data_app', uuid: 'a1', contentUuid: 'a1', name: 'Verified data app', slug: 'verified-data-app' }),
56
+ Object.assign(Object.assign({}, shared), { contentType: 'document', uuid: 'doc1', contentUuid: 'doc1', name: 'Verified document', slug: 'verified-document' }),
58
57
  ];
59
58
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(items);
60
59
  const result = await client.listVerifiedContent('p1');
@@ -0,0 +1,31 @@
1
+ /**
2
+ * v1 rename API: field dropdowns, impact preview, and chart, dashboard-filter,
3
+ * and project renames. The HTTP client unwraps `{ results }`.
4
+ */
5
+ import { BaseApiClient } from '../base-client';
6
+ import type { components } from '@lightdash-tools/common';
7
+ type Schemas = components['schemas'];
8
+ type RenameFieldsResult = Schemas['ApiRenameFieldsResponse']['results'];
9
+ type RenamePreviewResult = Schemas['ApiRenameResponse']['results'];
10
+ type RenameChartResult = Schemas['ApiRenameChartResponse']['results'];
11
+ type RenameDashboardResult = Schemas['ApiRenameDashboardResponse']['results'];
12
+ type RenameResourcesResult = Schemas['ApiJobScheduledResponse']['results'];
13
+ /**
14
+ * Client for Lightdash rename endpoints (the Validator "Fix" engine).
15
+ * Does not reject `from === to` locally; the server returns ParameterError.
16
+ */
17
+ export declare class RenameClient extends BaseApiClient {
18
+ listChartFields(projectUuid: string, chartUuid: string): Promise<RenameFieldsResult>;
19
+ listDashboardFields(projectUuid: string, dashboardUuid: string, table?: string): Promise<RenameFieldsResult>;
20
+ /** Project-wide impact list. Pass `dryRun: true` to avoid scheduling a job. */
21
+ previewRename(projectUuid: string, body: Schemas['ApiRenameBody']): Promise<RenamePreviewResult>;
22
+ /**
23
+ * Rewrite one chart. `jobId` is present only when the server scheduled a project job.
24
+ * This client does not set `fixAll`.
25
+ */
26
+ renameChart(projectUuid: string, chartUuid: string, body: Schemas['ApiRenameChartBody']): Promise<RenameChartResult>;
27
+ renameDashboardFilter(projectUuid: string, dashboardUuid: string, body: Schemas['ApiRenameDashboardBody']): Promise<RenameDashboardResult>;
28
+ /** Schedule a project-wide rename. Returns the scheduler `jobId`. Does not poll. */
29
+ renameResources(projectUuid: string, body: Schemas['ApiRenameBody']): Promise<RenameResourcesResult>;
30
+ }
31
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * v1 rename API: field dropdowns, impact preview, and chart, dashboard-filter,
4
+ * and project renames. The HTTP client unwraps `{ results }`.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RenameClient = void 0;
8
+ const base_client_1 = require("../base-client");
9
+ /**
10
+ * Client for Lightdash rename endpoints (the Validator "Fix" engine).
11
+ * Does not reject `from === to` locally; the server returns ParameterError.
12
+ */
13
+ class RenameClient extends base_client_1.BaseApiClient {
14
+ async listChartFields(projectUuid, chartUuid) {
15
+ return this.http.get(`/projects/${encodeURIComponent(projectUuid)}/rename/chart/${encodeURIComponent(chartUuid)}/fields`);
16
+ }
17
+ async listDashboardFields(projectUuid, dashboardUuid, table) {
18
+ const path = `/projects/${encodeURIComponent(projectUuid)}/rename/dashboard/${encodeURIComponent(dashboardUuid)}/fields`;
19
+ return this.http.get(path, table === undefined ? undefined : { params: { table } });
20
+ }
21
+ /** Project-wide impact list. Pass `dryRun: true` to avoid scheduling a job. */
22
+ async previewRename(projectUuid, body) {
23
+ return this.http.post(`/projects/${encodeURIComponent(projectUuid)}/rename/preview`, body);
24
+ }
25
+ /**
26
+ * Rewrite one chart. `jobId` is present only when the server scheduled a project job.
27
+ * This client does not set `fixAll`.
28
+ */
29
+ async renameChart(projectUuid, chartUuid, body) {
30
+ return this.http.post(`/projects/${encodeURIComponent(projectUuid)}/rename/chart/${encodeURIComponent(chartUuid)}`, body);
31
+ }
32
+ async renameDashboardFilter(projectUuid, dashboardUuid, body) {
33
+ return this.http.post(`/projects/${encodeURIComponent(projectUuid)}/rename/dashboard/${encodeURIComponent(dashboardUuid)}`, body);
34
+ }
35
+ /** Schedule a project-wide rename. Returns the scheduler `jobId`. Does not poll. */
36
+ async renameResources(projectUuid, body) {
37
+ return this.http.post(`/projects/${encodeURIComponent(projectUuid)}/rename`, body);
38
+ }
39
+ }
40
+ exports.RenameClient = RenameClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const rename_1 = require("./rename");
5
+ (0, vitest_1.describe)('RenameClient', () => {
6
+ let mockHttp;
7
+ (0, vitest_1.beforeEach)(() => {
8
+ mockHttp = {
9
+ get: vitest_1.vi.fn(),
10
+ post: vitest_1.vi.fn(),
11
+ put: vitest_1.vi.fn(),
12
+ patch: vitest_1.vi.fn(),
13
+ delete: vitest_1.vi.fn(),
14
+ };
15
+ });
16
+ (0, vitest_1.it)('listChartFields encodes path segments', async () => {
17
+ const client = new rename_1.RenameClient(mockHttp);
18
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue({ fields: {} });
19
+ await client.listChartFields('p/1', '../c1');
20
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p%2F1/rename/chart/..%2Fc1/fields');
21
+ });
22
+ (0, vitest_1.it)('listChartFields should call GET /projects/{projectUuid}/rename/chart/{chartUuid}/fields', async () => {
23
+ const client = new rename_1.RenameClient(mockHttp);
24
+ const mockResponse = { fields: { orders: ['orders_status'] } };
25
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
26
+ const result = await client.listChartFields('p1', 'c1');
27
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/rename/chart/c1/fields');
28
+ (0, vitest_1.expect)(result).toEqual(mockResponse);
29
+ });
30
+ (0, vitest_1.it)('listDashboardFields should call GET with a table query when table is set', async () => {
31
+ const client = new rename_1.RenameClient(mockHttp);
32
+ const mockResponse = { fields: { orders: ['orders_status'] } };
33
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
34
+ const result = await client.listDashboardFields('p1', 'd1', 'orders');
35
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/rename/dashboard/d1/fields', {
36
+ params: { table: 'orders' },
37
+ });
38
+ (0, vitest_1.expect)(result).toEqual(mockResponse);
39
+ });
40
+ (0, vitest_1.it)('previewRename should POST /projects/{projectUuid}/rename/preview', async () => {
41
+ const client = new rename_1.RenameClient(mockHttp);
42
+ const body = { type: 'field', from: 'old', to: 'new', dryRun: true };
43
+ const mockResponse = { charts: [], dashboards: [], alerts: [], dashboardSchedulers: [] };
44
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
45
+ const result = await client.previewRename('p1', body);
46
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/preview', body);
47
+ (0, vitest_1.expect)(result).toEqual(mockResponse);
48
+ });
49
+ (0, vitest_1.it)('renameChart should POST the chart path and return the response body', async () => {
50
+ const client = new rename_1.RenameClient(mockHttp);
51
+ const body = { type: 'field', from: 'orders_old', to: 'orders_new' };
52
+ const mockResponse = {};
53
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
54
+ const result = await client.renameChart('p1', 'c1', body);
55
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/chart/c1', body);
56
+ (0, vitest_1.expect)(result).toEqual(mockResponse);
57
+ });
58
+ (0, vitest_1.it)('renameDashboardFilter should POST /projects/{projectUuid}/rename/dashboard/{dashboardUuid}', async () => {
59
+ const client = new rename_1.RenameClient(mockHttp);
60
+ const body = { type: 'field', from: 'orders_old', to: 'orders_new' };
61
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({});
62
+ await client.renameDashboardFilter('p1', 'd1', body);
63
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/dashboard/d1', body);
64
+ });
65
+ (0, vitest_1.it)('renameResources should POST /projects/{projectUuid}/rename and return jobId', async () => {
66
+ const client = new rename_1.RenameClient(mockHttp);
67
+ const body = { type: 'field', from: 'old', to: 'new' };
68
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({ jobId: 'job-1' });
69
+ const result = await client.renameResources('p1', body);
70
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename', body);
71
+ (0, vitest_1.expect)(result).toEqual({ jobId: 'job-1' });
72
+ });
73
+ (0, vitest_1.it)('posts from and to unchanged when they are equal', async () => {
74
+ const client = new rename_1.RenameClient(mockHttp);
75
+ const body = { type: 'field', from: 'orders_status', to: 'orders_status' };
76
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue({});
77
+ await client.renameChart('p1', 'c1', body);
78
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/chart/c1', body);
79
+ });
80
+ });
@@ -10,21 +10,23 @@ export interface SearchContentParams {
10
10
  /** Exact content UUID filter (OpenAPI List content `uuids`). */
11
11
  uuids?: string[];
12
12
  parentSpaceUuid?: string;
13
- contentTypes?: ('chart' | 'dashboard' | 'data_app' | 'space')[];
13
+ contentTypes?: LightdashApi.Content.ContentType[];
14
+ /** When true, include the caller's personal documents. Omitted leaves the server default. */
15
+ includePersonalDocuments?: boolean;
14
16
  pageSize?: number;
15
17
  page?: number;
16
18
  search?: string;
17
19
  sortBy?: LightdashApi.Content.ContentSortByColumns;
18
20
  sortDirection?: 'asc' | 'desc';
19
21
  }
20
- /** Body for moving a single content item (chart, dashboard, or space) to another space. */
22
+ /** Body for moving a single content item to another space. */
21
23
  export type MoveContentBody = components['schemas']['ApiContentActionBody_ContentActionMove_'];
22
24
  /** Body for moving multiple content items (charts, dashboards, spaces) to another space. */
23
25
  export type BulkMoveContentBody = components['schemas']['ApiContentBulkActionBody_ContentActionMove_'];
24
26
  /** Body for permanently deleting soft-deleted content (irrecoverable). */
25
27
  export type PermanentlyDeleteContentBody = components['schemas']['ApiPermanentlyDeleteContentBody'];
26
28
  export declare class ContentClient extends BaseApiClient {
27
- /** Search project content (charts, dashboards, spaces). */
29
+ /** Search project content (charts, dashboards, spaces, data apps, and documents). */
28
30
  searchContent(params?: SearchContentParams): Promise<LightdashApi.Content.ApiContentResponse>;
29
31
  /** Move a single content item (chart, dashboard, or space) to another space. */
30
32
  moveContent(projectUuid: string, body: MoveContentBody): Promise<void>;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContentClient = void 0;
7
7
  const base_client_1 = require("../base-client");
8
8
  class ContentClient extends base_client_1.BaseApiClient {
9
- /** Search project content (charts, dashboards, spaces). */
9
+ /** Search project content (charts, dashboards, spaces, data apps, and documents). */
10
10
  async searchContent(params) {
11
11
  return this.http.get('/content', {
12
12
  params,
@@ -23,6 +23,17 @@ const content_1 = require("./content");
23
23
  });
24
24
  (0, vitest_1.expect)(result).toEqual(mockResponse);
25
25
  });
26
+ (0, vitest_1.it)('searchContent passes document filters including personal documents', async () => {
27
+ const client = new content_1.ContentClient(mockHttp);
28
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue({ status: 'ok', results: [] });
29
+ await client.searchContent({
30
+ contentTypes: ['document'],
31
+ includePersonalDocuments: true,
32
+ });
33
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/content', {
34
+ params: { contentTypes: ['document'], includePersonalDocuments: true },
35
+ });
36
+ });
26
37
  (0, vitest_1.it)('searchContent passes exact uuids filter', async () => {
27
38
  const client = new content_1.ContentClient(mockHttp);
28
39
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue({ status: 'ok', results: [] });
package/dist/client.d.ts CHANGED
@@ -12,6 +12,7 @@ import { OrganizationsClient } from './api/v1/organizations';
12
12
  import { ProjectAccessClient } from './api/v1/project-access';
13
13
  import { ProjectsClient } from './api/v1/projects';
14
14
  import { QueryClient } from './api/v1/query';
15
+ import { RenameClient } from './api/v1/rename';
15
16
  import { SchedulersClient } from './api/v1/schedulers';
16
17
  import { SpacesClient } from './api/v1/spaces';
17
18
  import { SqlRunnerClient } from './api/v1/sql-runner';
@@ -44,6 +45,7 @@ export declare class V1ApiClients {
44
45
  readonly projectAccess: ProjectAccessClient;
45
46
  readonly explores: ExploresClient;
46
47
  readonly validation: ValidationClient;
48
+ readonly rename: RenameClient;
47
49
  readonly metrics: MetricsClient;
48
50
  readonly schedulers: SchedulersClient;
49
51
  readonly tags: TagsClient;
package/dist/client.js CHANGED
@@ -15,6 +15,7 @@ const organizations_1 = require("./api/v1/organizations");
15
15
  const project_access_1 = require("./api/v1/project-access");
16
16
  const projects_1 = require("./api/v1/projects");
17
17
  const query_1 = require("./api/v1/query");
18
+ const rename_1 = require("./api/v1/rename");
18
19
  const schedulers_1 = require("./api/v1/schedulers");
19
20
  const spaces_1 = require("./api/v1/spaces");
20
21
  const sql_runner_1 = require("./api/v1/sql-runner");
@@ -50,6 +51,7 @@ class V1ApiClients {
50
51
  this.projectAccess = new project_access_1.ProjectAccessClient(http);
51
52
  this.explores = new explores_1.ExploresClient(http);
52
53
  this.validation = new validation_1.ValidationClient(http);
54
+ this.rename = new rename_1.RenameClient(http);
53
55
  this.metrics = new metrics_1.MetricsClient(http);
54
56
  this.schedulers = new schedulers_1.SchedulersClient(http);
55
57
  this.tags = new tags_1.TagsClient(http);
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { ProjectRoleAssignmentsClient } from './api/v2/project-role-assignments'
7
7
  export { AiAgentsClient } from './api/v1/ai-agents';
8
8
  export { ProjectAccessClient } from './api/v1/project-access';
9
9
  export { ValidationClient } from './api/v1/validation';
10
+ export { RenameClient } from './api/v1/rename';
10
11
  export { ValidationClientV2 } from './api/v2/validation';
11
12
  export { MetricsClient } from './api/v1/metrics';
12
13
  export { SchedulersClient } from './api/v1/schedulers';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SecretString = exports.RateLimiter = exports.isApiSuccessEnvelope = exports.HttpClient = exports.ENV_LIGHTDASH_PROXY_AUTHORIZATION = exports.ENV_LIGHTDASH_URL = exports.ENV_LIGHTDASH_API_KEY = exports.createBearerConfig = exports.mergeConfig = exports.loadConfigFromEnv = exports.isBlockedBinaryHostname = exports.DEFAULT_BINARY_MAX_BYTES = exports.CHART_IMAGE_MAX_BYTES = exports.CHART_IMAGE_EXPORT_TIMEOUT_MS = exports.CONTRACT_ERROR_MESSAGE = exports.CONTRACT_ERROR_NAME = exports.ChartImageSizeError = exports.NetworkError = exports.RateLimitError = exports.LightdashApiError = exports.DEFAULT_RETRY = exports.DEFAULT_TIMEOUT = exports.DEFAULT_RATE_LIMIT = exports.consoleLogger = exports.noopLogger = exports.DashboardsClientV2 = exports.ChartsClientV2 = exports.ContentClient = exports.SqlRunnerClient = exports.AnalyticsClient = exports.TagsClient = exports.SchedulersClient = exports.MetricsClient = exports.ValidationClientV2 = exports.ValidationClient = exports.ProjectAccessClient = exports.AiAgentsClient = exports.ProjectRoleAssignmentsClient = exports.OrganizationRolesClient = exports.GroupsClient = exports.UsersClient = exports.resolveEvaluationRun = exports.applyBundleDiff = exports.fetchBundleCurrentState = exports.V2ApiClients = exports.V1ApiClients = exports.LightdashClient = void 0;
3
+ exports.SecretString = exports.RateLimiter = exports.isApiSuccessEnvelope = exports.HttpClient = exports.ENV_LIGHTDASH_PROXY_AUTHORIZATION = exports.ENV_LIGHTDASH_URL = exports.ENV_LIGHTDASH_API_KEY = exports.createBearerConfig = exports.mergeConfig = exports.loadConfigFromEnv = exports.isBlockedBinaryHostname = exports.DEFAULT_BINARY_MAX_BYTES = exports.CHART_IMAGE_MAX_BYTES = exports.CHART_IMAGE_EXPORT_TIMEOUT_MS = exports.CONTRACT_ERROR_MESSAGE = exports.CONTRACT_ERROR_NAME = exports.ChartImageSizeError = exports.NetworkError = exports.RateLimitError = exports.LightdashApiError = exports.DEFAULT_RETRY = exports.DEFAULT_TIMEOUT = exports.DEFAULT_RATE_LIMIT = exports.consoleLogger = exports.noopLogger = exports.DashboardsClientV2 = exports.ChartsClientV2 = exports.ContentClient = exports.SqlRunnerClient = exports.AnalyticsClient = exports.TagsClient = exports.SchedulersClient = exports.MetricsClient = exports.ValidationClientV2 = exports.RenameClient = exports.ValidationClient = exports.ProjectAccessClient = exports.AiAgentsClient = exports.ProjectRoleAssignmentsClient = exports.OrganizationRolesClient = exports.GroupsClient = exports.UsersClient = exports.resolveEvaluationRun = exports.applyBundleDiff = exports.fetchBundleCurrentState = exports.V2ApiClients = exports.V1ApiClients = exports.LightdashClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "LightdashClient", { enumerable: true, get: function () { return client_1.LightdashClient; } });
6
6
  Object.defineProperty(exports, "V1ApiClients", { enumerable: true, get: function () { return client_1.V1ApiClients; } });
@@ -23,6 +23,8 @@ var project_access_1 = require("./api/v1/project-access");
23
23
  Object.defineProperty(exports, "ProjectAccessClient", { enumerable: true, get: function () { return project_access_1.ProjectAccessClient; } });
24
24
  var validation_1 = require("./api/v1/validation");
25
25
  Object.defineProperty(exports, "ValidationClient", { enumerable: true, get: function () { return validation_1.ValidationClient; } });
26
+ var rename_1 = require("./api/v1/rename");
27
+ Object.defineProperty(exports, "RenameClient", { enumerable: true, get: function () { return rename_1.RenameClient; } });
26
28
  var validation_2 = require("./api/v2/validation");
27
29
  Object.defineProperty(exports, "ValidationClientV2", { enumerable: true, get: function () { return validation_2.ValidationClientV2; } });
28
30
  var metrics_1 = require("./api/v1/metrics");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash-tools/client",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Client library for Lightdash AI.",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -13,9 +13,9 @@
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "dependencies": {
16
- "axios": "^1.19.0",
16
+ "axios": "1.21.1",
17
17
  "bottleneck": "^2.19.5",
18
- "@lightdash-tools/common": "0.23.0"
18
+ "@lightdash-tools/common": "0.25.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^25.9.3"
@@ -6,8 +6,8 @@ import { applyAgentChange } from './apply-agent-change';
6
6
  import { recordApplyFailure } from './apply-context';
7
7
  import { applyEvaluationChange } from './apply-evaluation-change';
8
8
 
9
- import type { ApplyBundleContext, ApplyBundleDiffFailure } from './apply-context';
10
9
  import type { LightdashClient } from '../client';
10
+ import type { ApplyBundleContext, ApplyBundleDiffFailure } from './apply-context';
11
11
  import type { BundleDiffChange, LightdashAiAgentBundle } from '@lightdash-tools/common';
12
12
 
13
13
  export type { ApplyBundleDiffFailure } from './apply-context';
@@ -17,8 +17,8 @@ import { AiAgentsRouterClient } from './router';
17
17
  import { AiAgentsSqlApprovalClient } from './sql-approval';
18
18
  import { AiAgentsThreadsClient, type StartConversationThreadBody } from './threads';
19
19
 
20
- import type { RequestOptions } from './request-options';
21
20
  import type { HttpClient } from '../../../http/http-client';
21
+ import type { RequestOptions } from './request-options';
22
22
  import type {
23
23
  AgentSuggestions,
24
24
  AiAgent,
@@ -43,6 +43,7 @@ import type {
43
43
  AiArtifact,
44
44
  AiMcpServer,
45
45
  AiMcpServerTool,
46
+ AiProjectMcpServer,
46
47
  AiModelOption,
47
48
  AiRouterRouteRequest,
48
49
  AiRouterRouteResponseResult,
@@ -401,7 +402,7 @@ export class AiAgentsClient extends BaseApiClient {
401
402
 
402
403
  // ─── MCP servers (EE-guarded upstream) ───────────────────────────────────────
403
404
 
404
- listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]> {
405
+ listProjectMcpServers(projectUuid: string): Promise<AiProjectMcpServer[]> {
405
406
  return this.mcpServers.listProjectMcpServers(projectUuid);
406
407
  }
407
408
 
@@ -19,11 +19,12 @@ describe('AiAgentsMcpServersClient', () => {
19
19
 
20
20
  it('listProjectMcpServers should call GET …/mcpServers', async () => {
21
21
  const client = new AiAgentsMcpServersClient(mockHttp);
22
- const servers = [{ uuid: 'mcp1', name: 'GitHub' }];
22
+ const servers = [{ uuid: 'mcp1', name: 'GitHub', attachedAgentCount: 2 }];
23
23
  vi.mocked(mockHttp.get).mockResolvedValue(servers);
24
24
  const result = await client.listProjectMcpServers('proj1');
25
25
  expect(mockHttp.get).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers');
26
26
  expect(result).toEqual(servers);
27
+ expect(result[0]?.attachedAgentCount).toBe(2);
27
28
  });
28
29
 
29
30
  it('createProjectMcpServer should call POST …/mcpServers', async () => {
@@ -9,14 +9,15 @@ import type {
9
9
  AiAgentMcpServerTool,
10
10
  AiMcpServer,
11
11
  AiMcpServerTool,
12
+ AiProjectMcpServer,
12
13
  CreateProjectMcpServerBody,
13
14
  UpdateAgentMcpServerToolsBody,
14
15
  } from '@lightdash-tools/common';
15
16
 
16
17
  export class AiAgentsMcpServersClient extends BaseApiClient {
17
18
  /** List MCP servers configured for a project (GET …/mcpServers). */
18
- async listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]> {
19
- return this.http.get<AiMcpServer[]>(`/projects/${projectUuid}/aiAgents/mcpServers`);
19
+ async listProjectMcpServers(projectUuid: string): Promise<AiProjectMcpServer[]> {
20
+ return this.http.get<AiProjectMcpServer[]>(`/projects/${projectUuid}/aiAgents/mcpServers`);
20
21
  }
21
22
 
22
23
  /** Create a project MCP server (POST …/mcpServers). */
@@ -28,9 +28,16 @@ describe('AiAgentsClient', () => {
28
28
  pageSize: 20,
29
29
  sortField: 'createdAt',
30
30
  sortDirection: 'desc',
31
+ createdFrom: 'data_app',
31
32
  });
32
33
  expect(mockHttp.get).toHaveBeenCalledWith('/aiAgents/admin/threads', {
33
- params: { page: 1, pageSize: 20, sortField: 'createdAt', sortDirection: 'desc' },
34
+ params: {
35
+ page: 1,
36
+ pageSize: 20,
37
+ sortField: 'createdAt',
38
+ sortDirection: 'desc',
39
+ createdFrom: 'data_app',
40
+ },
34
41
  });
35
42
  expect(result).toEqual(results);
36
43
  });
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
 
3
- import { ProjectsClient } from './projects';
3
+ import { ProjectsClient, type VerifiedContentListItem } from './projects';
4
4
 
5
5
  import type { HttpClient } from '../../http/http-client';
6
6
 
@@ -46,22 +46,51 @@ describe('ProjectsClient', () => {
46
46
 
47
47
  it('listVerifiedContent should call GET /projects/{projectUuid}/content-verification', async () => {
48
48
  const client = new ProjectsClient(mockHttp);
49
- const items = [
49
+ const verifiedBy = { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' };
50
+ const shared = {
51
+ description: null,
52
+ spaceUuid: 's1',
53
+ spaceName: 'Space',
54
+ views: 10,
55
+ lastUpdatedAt: null,
56
+ verifiedAt: '2026-01-01T00:00:00.000Z',
57
+ verifiedBy,
58
+ };
59
+ const items: VerifiedContentListItem[] = [
50
60
  {
51
- contentType: 'chart' as const,
61
+ ...shared,
62
+ contentType: 'chart',
52
63
  uuid: 'c1',
53
64
  contentUuid: 'c1',
54
65
  name: 'Verified chart',
55
- description: null,
56
- spaceUuid: 's1',
57
- spaceName: 'Space',
58
- views: 10,
59
- lastUpdatedAt: null,
60
- verifiedAt: '2026-01-01T00:00:00.000Z',
61
- verifiedBy: { userUuid: 'u1', firstName: 'Ada', lastName: 'Lovelace' },
62
- chartKind: 'vertical_bar' as const,
66
+ slug: 'verified-chart',
67
+ chartKind: 'vertical_bar',
63
68
  exploreName: 'orders',
64
69
  },
70
+ {
71
+ ...shared,
72
+ contentType: 'dashboard',
73
+ uuid: 'd1',
74
+ contentUuid: 'd1',
75
+ name: 'Verified dashboard',
76
+ slug: 'verified-dashboard',
77
+ },
78
+ {
79
+ ...shared,
80
+ contentType: 'data_app',
81
+ uuid: 'a1',
82
+ contentUuid: 'a1',
83
+ name: 'Verified data app',
84
+ slug: 'verified-data-app',
85
+ },
86
+ {
87
+ ...shared,
88
+ contentType: 'document',
89
+ uuid: 'doc1',
90
+ contentUuid: 'doc1',
91
+ name: 'Verified document',
92
+ slug: 'verified-document',
93
+ },
65
94
  ];
66
95
  vi.mocked(mockHttp.get).mockResolvedValue(items);
67
96
  const result = await client.listVerifiedContent('p1');
@@ -24,7 +24,7 @@ export class ProjectsClient extends BaseApiClient {
24
24
  return this.http.get<SpaceQuery[]>(`/projects/${projectUuid}/charts`);
25
25
  }
26
26
 
27
- /** List admin-verified charts and dashboards in a project. */
27
+ /** List admin-verified charts, dashboards, data apps, and documents in a project. */
28
28
  async listVerifiedContent(projectUuid: string): Promise<VerifiedContentListItem[]> {
29
29
  return this.http.get<VerifiedContentListItem[]>(
30
30
  `/projects/${projectUuid}/content-verification`,
@@ -0,0 +1,91 @@
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+
3
+ import { RenameClient } from './rename';
4
+
5
+ import type { HttpClient } from '../../http/http-client';
6
+
7
+ describe('RenameClient', () => {
8
+ let mockHttp: HttpClient;
9
+
10
+ beforeEach(() => {
11
+ mockHttp = {
12
+ get: vi.fn(),
13
+ post: vi.fn(),
14
+ put: vi.fn(),
15
+ patch: vi.fn(),
16
+ delete: vi.fn(),
17
+ } as unknown as HttpClient;
18
+ });
19
+
20
+ it('listChartFields encodes path segments', async () => {
21
+ const client = new RenameClient(mockHttp);
22
+ vi.mocked(mockHttp.get).mockResolvedValue({ fields: {} });
23
+ await client.listChartFields('p/1', '../c1');
24
+ expect(mockHttp.get).toHaveBeenCalledWith('/projects/p%2F1/rename/chart/..%2Fc1/fields');
25
+ });
26
+
27
+ it('listChartFields should call GET /projects/{projectUuid}/rename/chart/{chartUuid}/fields', async () => {
28
+ const client = new RenameClient(mockHttp);
29
+ const mockResponse = { fields: { orders: ['orders_status'] } };
30
+ vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
31
+ const result = await client.listChartFields('p1', 'c1');
32
+ expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/rename/chart/c1/fields');
33
+ expect(result).toEqual(mockResponse);
34
+ });
35
+
36
+ it('listDashboardFields should call GET with a table query when table is set', async () => {
37
+ const client = new RenameClient(mockHttp);
38
+ const mockResponse = { fields: { orders: ['orders_status'] } };
39
+ vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
40
+ const result = await client.listDashboardFields('p1', 'd1', 'orders');
41
+ expect(mockHttp.get).toHaveBeenCalledWith('/projects/p1/rename/dashboard/d1/fields', {
42
+ params: { table: 'orders' },
43
+ });
44
+ expect(result).toEqual(mockResponse);
45
+ });
46
+
47
+ it('previewRename should POST /projects/{projectUuid}/rename/preview', async () => {
48
+ const client = new RenameClient(mockHttp);
49
+ const body = { type: 'field' as const, from: 'old', to: 'new', dryRun: true };
50
+ const mockResponse = { charts: [], dashboards: [], alerts: [], dashboardSchedulers: [] };
51
+ vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
52
+ const result = await client.previewRename('p1', body);
53
+ expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/preview', body);
54
+ expect(result).toEqual(mockResponse);
55
+ });
56
+
57
+ it('renameChart should POST the chart path and return the response body', async () => {
58
+ const client = new RenameClient(mockHttp);
59
+ const body = { type: 'field' as const, from: 'orders_old', to: 'orders_new' };
60
+ const mockResponse = {};
61
+ vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
62
+ const result = await client.renameChart('p1', 'c1', body);
63
+ expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/chart/c1', body);
64
+ expect(result).toEqual(mockResponse);
65
+ });
66
+
67
+ it('renameDashboardFilter should POST /projects/{projectUuid}/rename/dashboard/{dashboardUuid}', async () => {
68
+ const client = new RenameClient(mockHttp);
69
+ const body = { type: 'field' as const, from: 'orders_old', to: 'orders_new' };
70
+ vi.mocked(mockHttp.post).mockResolvedValue({});
71
+ await client.renameDashboardFilter('p1', 'd1', body);
72
+ expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/dashboard/d1', body);
73
+ });
74
+
75
+ it('renameResources should POST /projects/{projectUuid}/rename and return jobId', async () => {
76
+ const client = new RenameClient(mockHttp);
77
+ const body = { type: 'field' as const, from: 'old', to: 'new' };
78
+ vi.mocked(mockHttp.post).mockResolvedValue({ jobId: 'job-1' });
79
+ const result = await client.renameResources('p1', body);
80
+ expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename', body);
81
+ expect(result).toEqual({ jobId: 'job-1' });
82
+ });
83
+
84
+ it('posts from and to unchanged when they are equal', async () => {
85
+ const client = new RenameClient(mockHttp);
86
+ const body = { type: 'field' as const, from: 'orders_status', to: 'orders_status' };
87
+ vi.mocked(mockHttp.post).mockResolvedValue({});
88
+ await client.renameChart('p1', 'c1', body);
89
+ expect(mockHttp.post).toHaveBeenCalledWith('/projects/p1/rename/chart/c1', body);
90
+ });
91
+ });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * v1 rename API: field dropdowns, impact preview, and chart, dashboard-filter,
3
+ * and project renames. The HTTP client unwraps `{ results }`.
4
+ */
5
+
6
+ import { BaseApiClient } from '../base-client';
7
+
8
+ import type { components } from '@lightdash-tools/common';
9
+
10
+ type Schemas = components['schemas'];
11
+
12
+ type RenameFieldsResult = Schemas['ApiRenameFieldsResponse']['results'];
13
+ type RenamePreviewResult = Schemas['ApiRenameResponse']['results'];
14
+ type RenameChartResult = Schemas['ApiRenameChartResponse']['results'];
15
+ type RenameDashboardResult = Schemas['ApiRenameDashboardResponse']['results'];
16
+ type RenameResourcesResult = Schemas['ApiJobScheduledResponse']['results'];
17
+
18
+ /**
19
+ * Client for Lightdash rename endpoints (the Validator "Fix" engine).
20
+ * Does not reject `from === to` locally; the server returns ParameterError.
21
+ */
22
+ export class RenameClient extends BaseApiClient {
23
+ async listChartFields(projectUuid: string, chartUuid: string): Promise<RenameFieldsResult> {
24
+ return this.http.get<RenameFieldsResult>(
25
+ `/projects/${encodeURIComponent(projectUuid)}/rename/chart/${encodeURIComponent(chartUuid)}/fields`,
26
+ );
27
+ }
28
+
29
+ async listDashboardFields(
30
+ projectUuid: string,
31
+ dashboardUuid: string,
32
+ table?: string,
33
+ ): Promise<RenameFieldsResult> {
34
+ const path = `/projects/${encodeURIComponent(projectUuid)}/rename/dashboard/${encodeURIComponent(dashboardUuid)}/fields`;
35
+ return this.http.get<RenameFieldsResult>(
36
+ path,
37
+ table === undefined ? undefined : { params: { table } },
38
+ );
39
+ }
40
+
41
+ /** Project-wide impact list. Pass `dryRun: true` to avoid scheduling a job. */
42
+ async previewRename(
43
+ projectUuid: string,
44
+ body: Schemas['ApiRenameBody'],
45
+ ): Promise<RenamePreviewResult> {
46
+ return this.http.post<RenamePreviewResult>(
47
+ `/projects/${encodeURIComponent(projectUuid)}/rename/preview`,
48
+ body,
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Rewrite one chart. `jobId` is present only when the server scheduled a project job.
54
+ * This client does not set `fixAll`.
55
+ */
56
+ async renameChart(
57
+ projectUuid: string,
58
+ chartUuid: string,
59
+ body: Schemas['ApiRenameChartBody'],
60
+ ): Promise<RenameChartResult> {
61
+ return this.http.post<RenameChartResult>(
62
+ `/projects/${encodeURIComponent(projectUuid)}/rename/chart/${encodeURIComponent(chartUuid)}`,
63
+ body,
64
+ );
65
+ }
66
+
67
+ async renameDashboardFilter(
68
+ projectUuid: string,
69
+ dashboardUuid: string,
70
+ body: Schemas['ApiRenameDashboardBody'],
71
+ ): Promise<RenameDashboardResult> {
72
+ return this.http.post<RenameDashboardResult>(
73
+ `/projects/${encodeURIComponent(projectUuid)}/rename/dashboard/${encodeURIComponent(dashboardUuid)}`,
74
+ body,
75
+ );
76
+ }
77
+
78
+ /** Schedule a project-wide rename. Returns the scheduler `jobId`. Does not poll. */
79
+ async renameResources(
80
+ projectUuid: string,
81
+ body: Schemas['ApiRenameBody'],
82
+ ): Promise<RenameResourcesResult> {
83
+ return this.http.post<RenameResourcesResult>(
84
+ `/projects/${encodeURIComponent(projectUuid)}/rename`,
85
+ body,
86
+ );
87
+ }
88
+ }
@@ -28,6 +28,18 @@ describe('ContentClient', () => {
28
28
  expect(result).toEqual(mockResponse);
29
29
  });
30
30
 
31
+ it('searchContent passes document filters including personal documents', async () => {
32
+ const client = new ContentClient(mockHttp);
33
+ vi.mocked(mockHttp.get).mockResolvedValue({ status: 'ok', results: [] });
34
+ await client.searchContent({
35
+ contentTypes: ['document'],
36
+ includePersonalDocuments: true,
37
+ });
38
+ expect(mockHttp.get).toHaveBeenCalledWith('/content', {
39
+ params: { contentTypes: ['document'], includePersonalDocuments: true },
40
+ });
41
+ });
42
+
31
43
  it('searchContent passes exact uuids filter', async () => {
32
44
  const client = new ContentClient(mockHttp);
33
45
  vi.mocked(mockHttp.get).mockResolvedValue({ status: 'ok', results: [] });
@@ -13,7 +13,9 @@ export interface SearchContentParams {
13
13
  /** Exact content UUID filter (OpenAPI List content `uuids`). */
14
14
  uuids?: string[];
15
15
  parentSpaceUuid?: string;
16
- contentTypes?: ('chart' | 'dashboard' | 'data_app' | 'space')[];
16
+ contentTypes?: LightdashApi.Content.ContentType[];
17
+ /** When true, include the caller's personal documents. Omitted leaves the server default. */
18
+ includePersonalDocuments?: boolean;
17
19
  pageSize?: number;
18
20
  page?: number;
19
21
  search?: string;
@@ -21,7 +23,7 @@ export interface SearchContentParams {
21
23
  sortDirection?: 'asc' | 'desc';
22
24
  }
23
25
 
24
- /** Body for moving a single content item (chart, dashboard, or space) to another space. */
26
+ /** Body for moving a single content item to another space. */
25
27
  export type MoveContentBody = components['schemas']['ApiContentActionBody_ContentActionMove_'];
26
28
 
27
29
  /** Body for moving multiple content items (charts, dashboards, spaces) to another space. */
@@ -32,7 +34,7 @@ export type BulkMoveContentBody =
32
34
  export type PermanentlyDeleteContentBody = components['schemas']['ApiPermanentlyDeleteContentBody'];
33
35
 
34
36
  export class ContentClient extends BaseApiClient {
35
- /** Search project content (charts, dashboards, spaces). */
37
+ /** Search project content (charts, dashboards, spaces, data apps, and documents). */
36
38
  async searchContent(
37
39
  params?: SearchContentParams,
38
40
  ): Promise<LightdashApi.Content.ApiContentResponse> {
package/src/client.ts CHANGED
@@ -13,6 +13,7 @@ import { OrganizationsClient } from './api/v1/organizations';
13
13
  import { ProjectAccessClient } from './api/v1/project-access';
14
14
  import { ProjectsClient } from './api/v1/projects';
15
15
  import { QueryClient } from './api/v1/query';
16
+ import { RenameClient } from './api/v1/rename';
16
17
  import { SchedulersClient } from './api/v1/schedulers';
17
18
  import { SpacesClient } from './api/v1/spaces';
18
19
  import { SqlRunnerClient } from './api/v1/sql-runner';
@@ -50,6 +51,7 @@ export class V1ApiClients {
50
51
  readonly projectAccess: ProjectAccessClient;
51
52
  readonly explores: ExploresClient;
52
53
  readonly validation: ValidationClient;
54
+ readonly rename: RenameClient;
53
55
  readonly metrics: MetricsClient;
54
56
  readonly schedulers: SchedulersClient;
55
57
  readonly tags: TagsClient;
@@ -69,6 +71,7 @@ export class V1ApiClients {
69
71
  this.projectAccess = new ProjectAccessClient(http);
70
72
  this.explores = new ExploresClient(http);
71
73
  this.validation = new ValidationClient(http);
74
+ this.rename = new RenameClient(http);
72
75
  this.metrics = new MetricsClient(http);
73
76
  this.schedulers = new SchedulersClient(http);
74
77
  this.tags = new TagsClient(http);
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export { ProjectRoleAssignmentsClient } from './api/v2/project-role-assignments'
15
15
  export { AiAgentsClient } from './api/v1/ai-agents';
16
16
  export { ProjectAccessClient } from './api/v1/project-access';
17
17
  export { ValidationClient } from './api/v1/validation';
18
+ export { RenameClient } from './api/v1/rename';
18
19
  export { ValidationClientV2 } from './api/v2/validation';
19
20
  export { MetricsClient } from './api/v1/metrics';
20
21
  export { SchedulersClient } from './api/v1/schedulers';