@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.
Files changed (237) hide show
  1. package/README.md +2 -2
  2. package/dist/agentops/apply-agent-change.d.ts +3 -0
  3. package/dist/agentops/apply-agent-change.js +63 -0
  4. package/dist/agentops/apply-bundle-diff.d.ts +13 -0
  5. package/dist/agentops/apply-bundle-diff.js +44 -0
  6. package/dist/agentops/apply-bundle-diff.test.d.ts +1 -0
  7. package/dist/agentops/apply-bundle-diff.test.js +397 -0
  8. package/dist/agentops/apply-context.d.ts +14 -0
  9. package/dist/agentops/apply-context.js +6 -0
  10. package/dist/agentops/apply-evaluation-change.d.ts +3 -0
  11. package/dist/agentops/apply-evaluation-change.js +78 -0
  12. package/dist/agentops/fetch-bundle-state.d.ts +6 -0
  13. package/dist/agentops/fetch-bundle-state.js +20 -0
  14. package/dist/agentops/fetch-bundle-state.test.d.ts +1 -0
  15. package/dist/agentops/fetch-bundle-state.test.js +44 -0
  16. package/dist/agentops/index.d.ts +3 -0
  17. package/dist/agentops/index.js +9 -0
  18. package/dist/agentops/resolve-evaluation-run.d.ts +15 -0
  19. package/dist/agentops/resolve-evaluation-run.js +48 -0
  20. package/dist/api/v1/ai-agents/admin.d.ts +16 -0
  21. package/dist/api/v1/ai-agents/admin.js +29 -0
  22. package/dist/api/v1/ai-agents/agents.d.ts +18 -0
  23. package/dist/api/v1/ai-agents/agents.js +31 -0
  24. package/dist/api/v1/ai-agents/artifacts.d.ts +26 -0
  25. package/dist/api/v1/ai-agents/artifacts.js +41 -0
  26. package/dist/api/v1/ai-agents/artifacts.test.d.ts +1 -0
  27. package/dist/api/v1/ai-agents/artifacts.test.js +69 -0
  28. package/dist/api/v1/ai-agents/discovery.d.ts +28 -0
  29. package/dist/api/v1/ai-agents/discovery.js +46 -0
  30. package/dist/api/v1/ai-agents/discovery.test.d.ts +1 -0
  31. package/dist/api/v1/ai-agents/discovery.test.js +90 -0
  32. package/dist/api/v1/ai-agents/evaluations.d.ts +39 -0
  33. package/dist/api/v1/ai-agents/evaluations.js +70 -0
  34. package/dist/api/v1/ai-agents/facade.d.ts +79 -0
  35. package/dist/api/v1/ai-agents/facade.js +193 -0
  36. package/dist/api/v1/ai-agents/feedback.d.ts +10 -0
  37. package/dist/api/v1/ai-agents/feedback.js +15 -0
  38. package/dist/api/v1/ai-agents/feedback.test.d.ts +1 -0
  39. package/dist/api/v1/ai-agents/feedback.test.js +23 -0
  40. package/dist/api/v1/ai-agents/index.d.ts +1 -0
  41. package/dist/api/v1/ai-agents/index.js +5 -0
  42. package/dist/api/v1/ai-agents/mcp-servers.d.ts +20 -0
  43. package/dist/api/v1/ai-agents/mcp-servers.js +35 -0
  44. package/dist/api/v1/ai-agents/mcp-servers.test.d.ts +1 -0
  45. package/dist/api/v1/ai-agents/mcp-servers.test.js +66 -0
  46. package/dist/api/v1/ai-agents/request-options.d.ts +12 -0
  47. package/dist/api/v1/ai-agents/request-options.js +20 -0
  48. package/dist/api/v1/ai-agents/sql-approval.d.ts +10 -0
  49. package/dist/api/v1/ai-agents/sql-approval.js +15 -0
  50. package/dist/api/v1/ai-agents/sql-approval.test.d.ts +1 -0
  51. package/dist/api/v1/ai-agents/sql-approval.test.js +25 -0
  52. package/dist/api/v1/ai-agents/threads.d.ts +56 -0
  53. package/dist/api/v1/ai-agents/threads.js +97 -0
  54. package/dist/api/v1/ai-agents/threads.test.d.ts +1 -0
  55. package/dist/api/v1/ai-agents/threads.test.js +39 -0
  56. package/dist/api/v1/ai-agents.test.js +172 -89
  57. package/dist/api/v1/analytics.d.ts +10 -0
  58. package/dist/api/v1/analytics.js +14 -0
  59. package/dist/api/v1/analytics.test.d.ts +4 -0
  60. package/dist/api/v1/analytics.test.js +27 -0
  61. package/dist/api/v1/charts.d.ts +5 -2
  62. package/dist/api/v1/charts.js +18 -30
  63. package/dist/api/v1/charts.test.js +19 -28
  64. package/dist/api/v1/dashboards.d.ts +11 -2
  65. package/dist/api/v1/dashboards.js +19 -14
  66. package/dist/api/v1/dashboards.test.js +54 -12
  67. package/dist/api/v1/explores.d.ts +4 -2
  68. package/dist/api/v1/explores.js +20 -29
  69. package/dist/api/v1/explores.test.js +31 -21
  70. package/dist/api/v1/groups.d.ts +1 -1
  71. package/dist/api/v1/groups.js +25 -51
  72. package/dist/api/v1/groups.test.js +15 -24
  73. package/dist/api/v1/metrics.d.ts +2 -2
  74. package/dist/api/v1/metrics.js +4 -17
  75. package/dist/api/v1/metrics.test.js +6 -15
  76. package/dist/api/v1/organizations.d.ts +1 -1
  77. package/dist/api/v1/organizations.js +2 -13
  78. package/dist/api/v1/organizations.test.js +3 -12
  79. package/dist/api/v1/project-access.d.ts +1 -1
  80. package/dist/api/v1/project-access.js +18 -45
  81. package/dist/api/v1/project-access.test.js +27 -36
  82. package/dist/api/v1/projects.d.ts +1 -1
  83. package/dist/api/v1/projects.js +6 -21
  84. package/dist/api/v1/projects.test.js +9 -18
  85. package/dist/api/v1/query.d.ts +5 -2
  86. package/dist/api/v1/query.js +8 -18
  87. package/dist/api/v1/query.test.js +6 -15
  88. package/dist/api/v1/schedulers.d.ts +2 -2
  89. package/dist/api/v1/schedulers.js +4 -17
  90. package/dist/api/v1/schedulers.test.js +6 -15
  91. package/dist/api/v1/spaces.d.ts +1 -1
  92. package/dist/api/v1/spaces.js +18 -45
  93. package/dist/api/v1/spaces.test.js +27 -36
  94. package/dist/api/v1/tags.d.ts +1 -1
  95. package/dist/api/v1/tags.js +4 -17
  96. package/dist/api/v1/tags.test.js +6 -15
  97. package/dist/api/v1/users.d.ts +3 -1
  98. package/dist/api/v1/users.js +22 -39
  99. package/dist/api/v1/users.test.js +44 -30
  100. package/dist/api/v1/validation.d.ts +5 -2
  101. package/dist/api/v1/validation.js +8 -18
  102. package/dist/api/v1/validation.test.js +6 -15
  103. package/dist/api/v2/content.d.ts +2 -2
  104. package/dist/api/v2/content.js +3 -14
  105. package/dist/api/v2/content.test.js +3 -12
  106. package/dist/api/v2/dashboards.d.ts +10 -0
  107. package/dist/api/v2/dashboards.js +14 -0
  108. package/dist/api/v2/dashboards.test.d.ts +4 -0
  109. package/dist/api/v2/dashboards.test.js +27 -0
  110. package/dist/api/v2/organization-roles.d.ts +1 -1
  111. package/dist/api/v2/organization-roles.js +21 -50
  112. package/dist/api/v2/organization-roles.test.js +33 -42
  113. package/dist/api/v2/project-role-assignments.d.ts +1 -1
  114. package/dist/api/v2/project-role-assignments.js +12 -33
  115. package/dist/api/v2/project-role-assignments.test.js +18 -27
  116. package/dist/api/v2/query.d.ts +1 -1
  117. package/dist/api/v2/query.js +10 -29
  118. package/dist/api/v2/query.test.js +15 -24
  119. package/dist/api/v2/validation.d.ts +28 -0
  120. package/dist/api/v2/validation.js +23 -0
  121. package/dist/client.d.ts +20 -14
  122. package/dist/client.js +22 -16
  123. package/dist/config.d.ts +35 -10
  124. package/dist/http/axios-client.d.ts +4 -4
  125. package/dist/http/http-client.d.ts +3 -3
  126. package/dist/http/http-client.js +19 -40
  127. package/dist/http/interceptors.d.ts +3 -3
  128. package/dist/http/interceptors.js +16 -3
  129. package/dist/http/rate-limiter.js +2 -13
  130. package/dist/http/rate-limiter.test.js +15 -24
  131. package/dist/index.d.ts +7 -2
  132. package/dist/index.js +12 -1
  133. package/dist/index.test.js +13 -5
  134. package/dist/pagination/fetch-all-pages.js +18 -29
  135. package/dist/pagination/fetch-all-pages.test.js +15 -24
  136. package/dist/types/api.d.ts +1 -1
  137. package/dist/utils/env.d.ts +11 -2
  138. package/dist/utils/env.js +41 -8
  139. package/dist/utils/env.test.js +14 -4
  140. package/dist/utils/logger.js +5 -4
  141. package/dist/utils/retry.js +17 -28
  142. package/dist/utils/retry.test.js +9 -18
  143. package/dist/utils/secret-string.test.d.ts +1 -0
  144. package/dist/utils/secret-string.test.js +25 -0
  145. package/package.json +12 -4
  146. package/src/agentops/apply-agent-change.ts +82 -0
  147. package/src/agentops/apply-bundle-diff.test.ts +453 -0
  148. package/src/agentops/apply-bundle-diff.ts +63 -0
  149. package/src/agentops/apply-context.ts +23 -0
  150. package/src/agentops/apply-evaluation-change.ts +125 -0
  151. package/src/agentops/fetch-bundle-state.test.ts +51 -0
  152. package/src/agentops/fetch-bundle-state.ts +33 -0
  153. package/src/agentops/index.ts +11 -0
  154. package/src/agentops/resolve-evaluation-run.ts +94 -0
  155. package/src/api/v1/ai-agents/admin.ts +41 -0
  156. package/src/api/v1/ai-agents/agents.ts +40 -0
  157. package/src/api/v1/ai-agents/artifacts.test.ts +84 -0
  158. package/src/api/v1/ai-agents/artifacts.ts +92 -0
  159. package/src/api/v1/ai-agents/discovery.test.ts +102 -0
  160. package/src/api/v1/ai-agents/discovery.ts +79 -0
  161. package/src/api/v1/ai-agents/evaluations.ts +152 -0
  162. package/src/api/v1/ai-agents/facade.ts +489 -0
  163. package/src/api/v1/ai-agents/feedback.test.ts +30 -0
  164. package/src/api/v1/ai-agents/feedback.ts +24 -0
  165. package/src/api/v1/ai-agents/index.ts +1 -0
  166. package/src/api/v1/ai-agents/mcp-servers.test.ts +81 -0
  167. package/src/api/v1/ai-agents/mcp-servers.ts +67 -0
  168. package/src/api/v1/ai-agents/request-options.ts +32 -0
  169. package/src/api/v1/ai-agents/sql-approval.test.ts +32 -0
  170. package/src/api/v1/ai-agents/sql-approval.ts +24 -0
  171. package/src/api/v1/ai-agents/threads.test.ts +55 -0
  172. package/src/api/v1/ai-agents/threads.ts +216 -0
  173. package/src/api/v1/ai-agents.test.ts +189 -13
  174. package/src/api/v1/analytics.test.ts +32 -0
  175. package/src/api/v1/analytics.ts +16 -0
  176. package/src/api/v1/charts.test.ts +8 -6
  177. package/src/api/v1/charts.ts +8 -4
  178. package/src/api/v1/dashboards.test.ts +57 -0
  179. package/src/api/v1/dashboards.ts +41 -2
  180. package/src/api/v1/explores.test.ts +22 -0
  181. package/src/api/v1/explores.ts +13 -2
  182. package/src/api/v1/groups.test.ts +2 -0
  183. package/src/api/v1/groups.ts +9 -7
  184. package/src/api/v1/metrics.test.ts +2 -0
  185. package/src/api/v1/metrics.ts +3 -2
  186. package/src/api/v1/organizations.test.ts +2 -0
  187. package/src/api/v1/organizations.ts +2 -1
  188. package/src/api/v1/project-access.test.ts +3 -1
  189. package/src/api/v1/project-access.ts +2 -1
  190. package/src/api/v1/projects.test.ts +2 -0
  191. package/src/api/v1/projects.ts +2 -1
  192. package/src/api/v1/query.test.ts +2 -0
  193. package/src/api/v1/query.ts +6 -2
  194. package/src/api/v1/schedulers.test.ts +2 -0
  195. package/src/api/v1/schedulers.ts +3 -2
  196. package/src/api/v1/spaces.test.ts +2 -0
  197. package/src/api/v1/spaces.ts +2 -1
  198. package/src/api/v1/tags.test.ts +2 -0
  199. package/src/api/v1/tags.ts +2 -1
  200. package/src/api/v1/users.test.ts +26 -0
  201. package/src/api/v1/users.ts +8 -2
  202. package/src/api/v1/validation.test.ts +2 -0
  203. package/src/api/v1/validation.ts +6 -2
  204. package/src/api/v2/content.test.ts +2 -0
  205. package/src/api/v2/content.ts +3 -2
  206. package/src/api/v2/dashboards.test.ts +32 -0
  207. package/src/api/v2/dashboards.ts +18 -0
  208. package/src/api/v2/organization-roles.test.ts +2 -0
  209. package/src/api/v2/organization-roles.ts +2 -1
  210. package/src/api/v2/project-role-assignments.test.ts +2 -0
  211. package/src/api/v2/project-role-assignments.ts +2 -1
  212. package/src/api/v2/query.test.ts +2 -0
  213. package/src/api/v2/query.ts +2 -1
  214. package/src/api/v2/validation.ts +48 -0
  215. package/src/client.test.ts +1 -0
  216. package/src/client.ts +27 -17
  217. package/src/config.ts +38 -10
  218. package/src/errors.test.ts +1 -0
  219. package/src/http/axios-client.ts +8 -5
  220. package/src/http/http-client.ts +8 -6
  221. package/src/http/interceptors.ts +23 -10
  222. package/src/http/rate-limiter.test.ts +1 -0
  223. package/src/http/rate-limiter.ts +3 -1
  224. package/src/index.test.ts +16 -7
  225. package/src/index.ts +16 -1
  226. package/src/pagination/fetch-all-pages.test.ts +2 -0
  227. package/src/types/api.ts +1 -1
  228. package/src/utils/env.test.ts +16 -4
  229. package/src/utils/env.ts +61 -10
  230. package/src/utils/logger.ts +6 -4
  231. package/src/utils/retry.test.ts +1 -0
  232. package/src/utils/retry.ts +2 -1
  233. package/src/utils/secret-string.test.ts +27 -0
  234. package/tsconfig.json +4 -2
  235. package/dist/api/v1/ai-agents.d.ts +0 -63
  236. package/dist/api/v1/ai-agents.js +0 -173
  237. package/src/api/v1/ai-agents.ts +0 -252
@@ -2,65 +2,48 @@
2
2
  /**
3
3
  * Users (organization members) API client.
4
4
  */
5
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.UsersClient = void 0;
16
- const base_client_1 = require("../base-client");
17
7
  const fetch_all_pages_1 = require("../../pagination/fetch-all-pages");
8
+ const base_client_1 = require("../base-client");
18
9
  class UsersClient extends base_client_1.BaseApiClient {
19
10
  /** List one page of members (use listAllMembers for all pages). */
20
- listMembers(params) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- return this.http.get('/org/users', {
23
- params,
24
- });
11
+ async listMembers(params) {
12
+ return this.http.get('/org/users', {
13
+ params,
25
14
  });
26
15
  }
27
16
  /** List all members of the current organization (fetches all pages). */
28
- listAllMembers(params, options) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- return (0, fetch_all_pages_1.fetchAllPages)({
31
- fetchPage: (page, pageSize) => this.http.get('/org/users', {
32
- params: Object.assign(Object.assign({}, params), { page, pageSize }),
33
- }),
34
- pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
35
- });
17
+ async listAllMembers(params, options) {
18
+ return (0, fetch_all_pages_1.fetchAllPages)({
19
+ fetchPage: (page, pageSize) => this.http.get('/org/users', {
20
+ params: Object.assign(Object.assign({}, params), { page, pageSize }),
21
+ }),
22
+ pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
36
23
  });
37
24
  }
38
25
  /** Get organization member by UUID. */
39
- getMemberByUuid(userUuid) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- return this.http.get(`/org/users/${userUuid}`);
42
- });
26
+ async getMemberByUuid(userUuid) {
27
+ return this.http.get(`/org/users/${userUuid}`);
43
28
  }
44
29
  /** Get organization member by email. */
45
- getMemberByEmail(email) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- return this.http.get(`/org/users/email/${encodeURIComponent(email)}`);
48
- });
30
+ async getMemberByEmail(email) {
31
+ return this.http.get(`/org/users/email/${encodeURIComponent(email)}`);
49
32
  }
50
33
  /**
51
34
  * Update organization member (e.g. role).
52
35
  * @deprecated This API is deprecated in Lightdash.
53
36
  */
54
- updateMember(userUuid, body) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- return this.http.patch(`/org/users/${userUuid}`, body);
57
- });
37
+ async updateMember(userUuid, body) {
38
+ return this.http.patch(`/org/users/${userUuid}`, body);
58
39
  }
59
40
  /** Delete (remove) a user from the current organization. */
60
- deleteMember(userUuid) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- yield this.http.delete(`/org/user/${userUuid}`);
63
- });
41
+ async deleteMember(userUuid) {
42
+ await this.http.delete(`/org/user/${userUuid}`);
43
+ }
44
+ /** Get the currently authenticated Lightdash user (`GET /api/v1/user`). */
45
+ async getAuthenticatedUser() {
46
+ return this.http.get('/user');
64
47
  }
65
48
  }
66
49
  exports.UsersClient = UsersClient;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  const vitest_1 = require("vitest");
13
4
  const users_1 = require("./users");
@@ -22,17 +13,40 @@ const users_1 = require("./users");
22
13
  delete: vitest_1.vi.fn(),
23
14
  };
24
15
  });
25
- (0, vitest_1.it)('listMembers should call GET /org/users with optional params', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ (0, vitest_1.it)('listMembers should call GET /org/users with optional params', async () => {
26
17
  const client = new users_1.UsersClient(mockHttp);
27
18
  const results = { data: [], pagination: { totalResults: 0, totalPageCount: 0 } };
28
19
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(results);
29
- const result = yield client.listMembers({ pageSize: 10, page: 1 });
20
+ const result = await client.listMembers({ pageSize: 10, page: 1 });
30
21
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users', {
31
22
  params: { pageSize: 10, page: 1 },
32
23
  });
33
24
  (0, vitest_1.expect)(result).toEqual(results);
34
- }));
35
- (0, vitest_1.it)('getMemberByUuid should call GET /org/users/{userUuid}', () => __awaiter(void 0, void 0, void 0, function* () {
25
+ });
26
+ (0, vitest_1.it)('getAuthenticatedUser should call GET /user (resolved to /api/v1/user)', async () => {
27
+ const client = new users_1.UsersClient(mockHttp);
28
+ const user = {
29
+ userUuid: 'u1',
30
+ email: 'a@example.com',
31
+ firstName: 'A',
32
+ lastName: 'User',
33
+ userId: 1,
34
+ isTrackingAnonymized: false,
35
+ isMarketingOptedIn: false,
36
+ isSetupComplete: true,
37
+ isActive: true,
38
+ createdAt: '2026-01-01T00:00:00.000Z',
39
+ updatedAt: '2026-01-01T00:00:00.000Z',
40
+ timezone: null,
41
+ organizationUuid: 'org-1',
42
+ impersonation: null,
43
+ };
44
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(user);
45
+ const result = await client.getAuthenticatedUser();
46
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/user');
47
+ (0, vitest_1.expect)(result).toEqual(user);
48
+ });
49
+ (0, vitest_1.it)('getMemberByUuid should call GET /org/users/{userUuid}', async () => {
36
50
  const client = new users_1.UsersClient(mockHttp);
37
51
  const member = {
38
52
  userUuid: 'u1',
@@ -42,11 +56,11 @@ const users_1 = require("./users");
42
56
  role: 'editor',
43
57
  };
44
58
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(member);
45
- const result = yield client.getMemberByUuid('u1');
59
+ const result = await client.getMemberByUuid('u1');
46
60
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users/u1');
47
61
  (0, vitest_1.expect)(result).toEqual(member);
48
- }));
49
- (0, vitest_1.it)('getMemberByEmail should call GET /org/users/email/{encodedEmail}', () => __awaiter(void 0, void 0, void 0, function* () {
62
+ });
63
+ (0, vitest_1.it)('getMemberByEmail should call GET /org/users/email/{encodedEmail}', async () => {
50
64
  const client = new users_1.UsersClient(mockHttp);
51
65
  const member = {
52
66
  userUuid: 'u1',
@@ -56,11 +70,11 @@ const users_1 = require("./users");
56
70
  role: 'editor',
57
71
  };
58
72
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(member);
59
- const result = yield client.getMemberByEmail('user+test@example.com');
73
+ const result = await client.getMemberByEmail('user+test@example.com');
60
74
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users/email/user%2Btest%40example.com');
61
75
  (0, vitest_1.expect)(result).toEqual(member);
62
- }));
63
- (0, vitest_1.it)('updateMember should call PATCH /org/users/{userUuid} with body', () => __awaiter(void 0, void 0, void 0, function* () {
76
+ });
77
+ (0, vitest_1.it)('updateMember should call PATCH /org/users/{userUuid} with body', async () => {
64
78
  const client = new users_1.UsersClient(mockHttp);
65
79
  const body = { role: 'admin' };
66
80
  const updated = {
@@ -71,17 +85,17 @@ const users_1 = require("./users");
71
85
  role: 'admin',
72
86
  };
73
87
  vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue(updated);
74
- const result = yield client.updateMember('u1', body);
88
+ const result = await client.updateMember('u1', body);
75
89
  (0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/org/users/u1', body);
76
90
  (0, vitest_1.expect)(result).toEqual(updated);
77
- }));
78
- (0, vitest_1.it)('deleteMember should call DELETE /org/user/{userUuid}', () => __awaiter(void 0, void 0, void 0, function* () {
91
+ });
92
+ (0, vitest_1.it)('deleteMember should call DELETE /org/user/{userUuid}', async () => {
79
93
  const client = new users_1.UsersClient(mockHttp);
80
94
  vitest_1.vi.mocked(mockHttp.delete).mockResolvedValue(undefined);
81
- yield client.deleteMember('u1');
95
+ await client.deleteMember('u1');
82
96
  (0, vitest_1.expect)(mockHttp.delete).toHaveBeenCalledWith('/org/user/u1');
83
- }));
84
- (0, vitest_1.it)('listAllMembers should fetch all pages and return concatenated array', () => __awaiter(void 0, void 0, void 0, function* () {
97
+ });
98
+ (0, vitest_1.it)('listAllMembers should fetch all pages and return concatenated array', async () => {
85
99
  const client = new users_1.UsersClient(mockHttp);
86
100
  const page1 = {
87
101
  data: [
@@ -96,7 +110,7 @@ const users_1 = require("./users");
96
110
  pagination: { page: 2, pageSize: 1, totalResults: 2, totalPageCount: 2 },
97
111
  };
98
112
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValueOnce(page1).mockResolvedValueOnce(page2);
99
- const result = yield client.listAllMembers(undefined, { pageSize: 1 });
113
+ const result = await client.listAllMembers(undefined, { pageSize: 1 });
100
114
  (0, vitest_1.expect)(result).toHaveLength(2);
101
115
  (0, vitest_1.expect)(result[0]).toMatchObject({ userUuid: 'u1', email: 'a@example.com' });
102
116
  (0, vitest_1.expect)(result[1]).toMatchObject({ userUuid: 'u2', email: 'b@example.com' });
@@ -107,16 +121,16 @@ const users_1 = require("./users");
107
121
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenNthCalledWith(2, '/org/users', {
108
122
  params: { page: 2, pageSize: 1 },
109
123
  });
110
- }));
111
- (0, vitest_1.it)('listAllMembers should pass through list params (e.g. searchQuery)', () => __awaiter(void 0, void 0, void 0, function* () {
124
+ });
125
+ (0, vitest_1.it)('listAllMembers should pass through list params (e.g. searchQuery)', async () => {
112
126
  const client = new users_1.UsersClient(mockHttp);
113
127
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValueOnce({
114
128
  data: [],
115
129
  pagination: { page: 1, pageSize: 100, totalResults: 0, totalPageCount: 1 },
116
130
  });
117
- yield client.listAllMembers({ searchQuery: 'foo' });
131
+ await client.listAllMembers({ searchQuery: 'foo' });
118
132
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/org/users', {
119
133
  params: { searchQuery: 'foo', page: 1, pageSize: 100 },
120
134
  });
121
- }));
135
+ });
122
136
  });
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Validation API client.
3
3
  */
4
- import type { LightdashApi } from '@lightdash-tools/common';
5
4
  import { BaseApiClient } from '../base-client';
5
+ import type { LightdashApi } from '@lightdash-tools/common';
6
6
  /** Query params for getting validation results. */
7
7
  export interface GetValidationResultsParams {
8
8
  fromSettings?: boolean;
@@ -15,7 +15,10 @@ export interface ValidateProjectBody {
15
15
  onlyValidateExploresInArgs?: boolean;
16
16
  }
17
17
  export declare class ValidationClient extends BaseApiClient {
18
- /** Get validation results for a project. */
18
+ /**
19
+ * Get validation results for a project.
20
+ * @deprecated Use v2 validation API (ListValidationResults) instead.
21
+ */
19
22
  getValidationResults(projectUuid: string, params?: GetValidationResultsParams): Promise<LightdashApi.Validation.ApiValidateResponse>;
20
23
  /** Validate content inside a project. Starts a validation job and returns the job ID. */
21
24
  validateProject(projectUuid: string, body?: ValidateProjectBody): Promise<LightdashApi.Validation.ApiJobScheduledResponse>;
@@ -2,30 +2,20 @@
2
2
  /**
3
3
  * Validation API client.
4
4
  */
5
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.ValidationClient = void 0;
16
7
  const base_client_1 = require("../base-client");
17
8
  class ValidationClient extends base_client_1.BaseApiClient {
18
- /** Get validation results for a project. */
19
- getValidationResults(projectUuid, params) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return this.http.get(`/projects/${projectUuid}/validate`, { params });
22
- });
9
+ /**
10
+ * Get validation results for a project.
11
+ * @deprecated Use v2 validation API (ListValidationResults) instead.
12
+ */
13
+ async getValidationResults(projectUuid, params) {
14
+ return this.http.get(`/projects/${projectUuid}/validate`, { params });
23
15
  }
24
16
  /** Validate content inside a project. Starts a validation job and returns the job ID. */
25
- validateProject(projectUuid, body) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return this.http.post(`/projects/${projectUuid}/validate`, body);
28
- });
17
+ async validateProject(projectUuid, body) {
18
+ return this.http.post(`/projects/${projectUuid}/validate`, body);
29
19
  }
30
20
  }
31
21
  exports.ValidationClient = ValidationClient;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  const vitest_1 = require("vitest");
13
4
  const validation_1 = require("./validation");
@@ -22,22 +13,22 @@ const validation_1 = require("./validation");
22
13
  delete: vitest_1.vi.fn(),
23
14
  };
24
15
  });
25
- (0, vitest_1.it)('getValidationResults should call GET /projects/{projectUuid}/validate', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ (0, vitest_1.it)('getValidationResults should call GET /projects/{projectUuid}/validate', async () => {
26
17
  const client = new validation_1.ValidationClient(mockHttp);
27
18
  const mockResponse = { status: 'ok', results: [] };
28
19
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
29
- const result = yield client.getValidationResults('p1', { jobId: 'j1' });
20
+ const result = await client.getValidationResults('p1', { jobId: 'j1' });
30
21
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/validate', {
31
22
  params: { jobId: 'j1' },
32
23
  });
33
24
  (0, vitest_1.expect)(result).toEqual(mockResponse);
34
- }));
35
- (0, vitest_1.it)('validateProject should call POST /projects/{projectUuid}/validate', () => __awaiter(void 0, void 0, void 0, function* () {
25
+ });
26
+ (0, vitest_1.it)('validateProject should call POST /projects/{projectUuid}/validate', async () => {
36
27
  const client = new validation_1.ValidationClient(mockHttp);
37
28
  const mockResponse = { status: 'ok', results: { jobId: 'j1' } };
38
29
  vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(mockResponse);
39
- const result = yield client.validateProject('p1');
30
+ const result = await client.validateProject('p1');
40
31
  (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/p1/validate', undefined);
41
32
  (0, vitest_1.expect)(result).toEqual(mockResponse);
42
- }));
33
+ });
43
34
  });
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Content API client (v2).
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 searching content. */
7
7
  export interface SearchContentParams {
8
8
  projectUuids?: string[];
@@ -12,7 +12,7 @@ export interface SearchContentParams {
12
12
  pageSize?: number;
13
13
  page?: number;
14
14
  search?: string;
15
- sortBy?: 'name' | 'createdAt' | 'updatedAt' | 'lastViewedAt' | 'views';
15
+ sortBy?: LightdashApi.Content.ContentSortByColumns;
16
16
  sortDirection?: 'asc' | 'desc';
17
17
  }
18
18
  export declare class ContentClient extends BaseApiClient {
@@ -2,25 +2,14 @@
2
2
  /**
3
3
  * Content API client (v2).
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.ContentClient = void 0;
16
7
  const base_client_1 = require("../base-client");
17
8
  class ContentClient extends base_client_1.BaseApiClient {
18
9
  /** Search project content (charts, dashboards, spaces). */
19
- searchContent(params) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return this.http.get('/content', {
22
- params,
23
- });
10
+ async searchContent(params) {
11
+ return this.http.get('/content', {
12
+ params,
24
13
  });
25
14
  }
26
15
  }
@@ -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 content_1 = require("./content");
@@ -22,14 +13,14 @@ const content_1 = require("./content");
22
13
  delete: vitest_1.vi.fn(),
23
14
  };
24
15
  });
25
- (0, vitest_1.it)('searchContent should call GET /content', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ (0, vitest_1.it)('searchContent should call GET /content', async () => {
26
17
  const client = new content_1.ContentClient(mockHttp);
27
18
  const mockResponse = { status: 'ok', results: [] };
28
19
  vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
29
- const result = yield client.searchContent({ search: 'test' });
20
+ const result = await client.searchContent({ search: 'test' });
30
21
  (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/content', {
31
22
  params: { search: 'test' },
32
23
  });
33
24
  (0, vitest_1.expect)(result).toEqual(mockResponse);
34
- }));
25
+ });
35
26
  });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Dashboards API client (v2). Metadata reads only (no query execution).
3
+ */
4
+ import { BaseApiClient } from '../base-client';
5
+ import type { components } from '@lightdash-tools/common';
6
+ export type Dashboard = components['schemas']['Dashboard'];
7
+ export declare class DashboardsClientV2 extends BaseApiClient {
8
+ /** Get dashboard metadata by UUID or slug within a project. Does not run queries. */
9
+ getDashboard(projectUuid: string, dashboardUuidOrSlug: string): Promise<Dashboard>;
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Dashboards API client (v2). Metadata reads only (no query execution).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DashboardsClientV2 = void 0;
7
+ const base_client_1 = require("../base-client");
8
+ class DashboardsClientV2 extends base_client_1.BaseApiClient {
9
+ /** Get dashboard metadata by UUID or slug within a project. Does not run queries. */
10
+ async getDashboard(projectUuid, dashboardUuidOrSlug) {
11
+ return this.http.get(`/projects/${projectUuid}/dashboards/${encodeURIComponent(dashboardUuidOrSlug)}`);
12
+ }
13
+ }
14
+ exports.DashboardsClientV2 = DashboardsClientV2;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * V2 dashboards client unit tests.
3
+ */
4
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * V2 dashboards client unit tests.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vitest_1 = require("vitest");
7
+ const dashboards_1 = require("./dashboards");
8
+ (0, vitest_1.describe)('DashboardsClientV2', () => {
9
+ let mockHttp;
10
+ (0, vitest_1.beforeEach)(() => {
11
+ mockHttp = {
12
+ get: vitest_1.vi.fn(),
13
+ post: vitest_1.vi.fn(),
14
+ put: vitest_1.vi.fn(),
15
+ patch: vitest_1.vi.fn(),
16
+ delete: vitest_1.vi.fn(),
17
+ };
18
+ });
19
+ (0, vitest_1.it)('getDashboard calls GET /projects/{projectUuid}/dashboards/{id}', async () => {
20
+ const client = new dashboards_1.DashboardsClientV2(mockHttp);
21
+ const mockResponse = { uuid: 'd1', name: 'Sales' };
22
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(mockResponse);
23
+ const result = await client.getDashboard('p1', 'd1');
24
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/p1/dashboards/d1');
25
+ (0, vitest_1.expect)(result).toEqual(mockResponse);
26
+ });
27
+ });
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Organization roles API client (v2). Manage org-level roles and role assignments.
3
3
  */
4
- import type { components } from '@lightdash-tools/common';
5
4
  import { BaseApiClient } from '../base-client';
5
+ import type { components } from '@lightdash-tools/common';
6
6
  type CreateRole = components['schemas']['CreateRole'];
7
7
  type UpdateRole = components['schemas']['UpdateRole'];
8
8
  type AddScopesToRole = components['schemas']['AddScopesToRole'];
@@ -2,80 +2,51 @@
2
2
  /**
3
3
  * Organization roles API client (v2). Manage org-level roles and role assignments.
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.OrganizationRolesClient = void 0;
16
7
  const base_client_1 = require("../base-client");
17
8
  class OrganizationRolesClient extends base_client_1.BaseApiClient {
18
9
  /** Get roles for an organization. */
19
- getRoles(orgUuid, params) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return this.http.get(`/orgs/${orgUuid}/roles`, {
22
- params,
23
- });
10
+ async getRoles(orgUuid, params) {
11
+ return this.http.get(`/orgs/${orgUuid}/roles`, {
12
+ params,
24
13
  });
25
14
  }
26
15
  /** Create a custom role in the organization. */
27
- createRole(orgUuid, body) {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- return this.http.post(`/orgs/${orgUuid}/roles`, body);
30
- });
16
+ async createRole(orgUuid, body) {
17
+ return this.http.post(`/orgs/${orgUuid}/roles`, body);
31
18
  }
32
19
  /** Get a custom role by UUID. */
33
- getRole(orgUuid, roleUuid) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- return this.http.get(`/orgs/${orgUuid}/roles/${roleUuid}`);
36
- });
20
+ async getRole(orgUuid, roleUuid) {
21
+ return this.http.get(`/orgs/${orgUuid}/roles/${roleUuid}`);
37
22
  }
38
23
  /** Update a custom role. */
39
- updateRole(orgUuid, roleUuid, body) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- return this.http.patch(`/orgs/${orgUuid}/roles/${roleUuid}`, body);
42
- });
24
+ async updateRole(orgUuid, roleUuid, body) {
25
+ return this.http.patch(`/orgs/${orgUuid}/roles/${roleUuid}`, body);
43
26
  }
44
27
  /** Delete a custom role from the organization. */
45
- deleteRole(orgUuid, roleUuid) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- yield this.http.delete(`/orgs/${orgUuid}/roles/${roleUuid}`);
48
- });
28
+ async deleteRole(orgUuid, roleUuid) {
29
+ await this.http.delete(`/orgs/${orgUuid}/roles/${roleUuid}`);
49
30
  }
50
31
  /** Add scopes to a role. */
51
- addScopesToRole(orgUuid, roleUuid, body) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- yield this.http.post(`/orgs/${orgUuid}/roles/${roleUuid}/scopes`, body);
54
- });
32
+ async addScopesToRole(orgUuid, roleUuid, body) {
33
+ await this.http.post(`/orgs/${orgUuid}/roles/${roleUuid}/scopes`, body);
55
34
  }
56
35
  /** Remove a scope from a role. */
57
- removeScopeFromRole(orgUuid, roleUuid, scopeName) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- yield this.http.delete(`/orgs/${orgUuid}/roles/${roleUuid}/scopes/${encodeURIComponent(scopeName)}`);
60
- });
36
+ async removeScopeFromRole(orgUuid, roleUuid, scopeName) {
37
+ await this.http.delete(`/orgs/${orgUuid}/roles/${roleUuid}/scopes/${encodeURIComponent(scopeName)}`);
61
38
  }
62
39
  /** Duplicate a role. */
63
- duplicateRole(orgUuid, roleId, body) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- return this.http.post(`/orgs/${orgUuid}/roles/${roleId}/duplicate`, body);
66
- });
40
+ async duplicateRole(orgUuid, roleId, body) {
41
+ return this.http.post(`/orgs/${orgUuid}/roles/${roleId}/duplicate`, body);
67
42
  }
68
43
  /** List organization role assignments (system roles only). */
69
- listRoleAssignments(orgUuid) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- return this.http.get(`/orgs/${orgUuid}/roles/assignments`);
72
- });
44
+ async listRoleAssignments(orgUuid) {
45
+ return this.http.get(`/orgs/${orgUuid}/roles/assignments`);
73
46
  }
74
47
  /** Assign an organization role to a user. */
75
- assignRoleToUser(orgUuid, userId, body) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- return this.http.post(`/orgs/${orgUuid}/roles/assignments/user/${userId}`, body);
78
- });
48
+ async assignRoleToUser(orgUuid, userId, body) {
49
+ return this.http.post(`/orgs/${orgUuid}/roles/assignments/user/${userId}`, body);
79
50
  }
80
51
  }
81
52
  exports.OrganizationRolesClient = OrganizationRolesClient;