@lightdash-tools/common 0.1.2 → 0.2.1

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 (73) hide show
  1. package/README.md +15 -6
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/safety.d.ts +33 -0
  5. package/dist/safety.js +60 -0
  6. package/dist/safety.test.d.ts +1 -0
  7. package/dist/safety.test.js +27 -0
  8. package/dist/types/lightdash-api.d.ts +24 -333
  9. package/dist/types/lightdash-api.js +7 -5
  10. package/dist/types/{ai-agents.d.ts → v1/ai-agents.d.ts} +1 -1
  11. package/dist/types/{charts.d.ts → v1/charts.d.ts} +1 -1
  12. package/dist/types/{dashboards.d.ts → v1/dashboards.d.ts} +1 -1
  13. package/dist/types/{explores.d.ts → v1/explores.d.ts} +3 -1
  14. package/dist/types/{groups.d.ts → v1/groups.d.ts} +1 -1
  15. package/dist/types/v1/index.d.ts +11 -11
  16. package/dist/types/v1/lightdash-api.d.ts +211 -0
  17. package/dist/types/v1/lightdash-api.js +23 -0
  18. package/dist/types/v1/metrics.d.ts +6 -0
  19. package/dist/types/v1/metrics.js +2 -0
  20. package/dist/types/{organizations.d.ts → v1/organizations.d.ts} +1 -1
  21. package/dist/types/{project-access.d.ts → v1/project-access.d.ts} +1 -1
  22. package/dist/types/{projects.d.ts → v1/projects.d.ts} +1 -1
  23. package/dist/types/{queries.d.ts → v1/queries.d.ts} +1 -1
  24. package/dist/types/v1/schedulers.d.ts +7 -0
  25. package/dist/types/v1/schedulers.js +2 -0
  26. package/dist/types/{space-access.d.ts → v1/space-access.d.ts} +1 -1
  27. package/dist/types/{spaces.d.ts → v1/spaces.d.ts} +1 -1
  28. package/dist/types/v1/tags.d.ts +9 -0
  29. package/dist/types/v1/tags.js +2 -0
  30. package/dist/types/{users.d.ts → v1/users.d.ts} +1 -1
  31. package/dist/types/v1/validation.d.ts +7 -0
  32. package/dist/types/v1/validation.js +2 -0
  33. package/dist/types/v2/content.d.ts +6 -0
  34. package/dist/types/v2/content.js +2 -0
  35. package/dist/types/v2/index.d.ts +15 -11
  36. package/package.json +2 -1
  37. package/src/index.ts +3 -0
  38. package/src/safety.test.ts +36 -0
  39. package/src/safety.ts +71 -0
  40. package/src/types/lightdash-api.ts +73 -432
  41. package/src/types/{ai-agents.ts → v1/ai-agents.ts} +1 -1
  42. package/src/types/{charts.ts → v1/charts.ts} +1 -1
  43. package/src/types/{dashboards.ts → v1/dashboards.ts} +1 -1
  44. package/src/types/{explores.ts → v1/explores.ts} +3 -1
  45. package/src/types/{groups.ts → v1/groups.ts} +1 -1
  46. package/src/types/v1/index.ts +11 -11
  47. package/src/types/v1/lightdash-api.ts +287 -0
  48. package/src/types/v1/metrics.ts +7 -0
  49. package/src/types/{organizations.ts → v1/organizations.ts} +1 -1
  50. package/src/types/{project-access.ts → v1/project-access.ts} +1 -1
  51. package/src/types/{projects.ts → v1/projects.ts} +1 -1
  52. package/src/types/{queries.ts → v1/queries.ts} +1 -1
  53. package/src/types/v1/schedulers.ts +9 -0
  54. package/src/types/{space-access.ts → v1/space-access.ts} +1 -1
  55. package/src/types/{spaces.ts → v1/spaces.ts} +1 -1
  56. package/src/types/v1/tags.ts +11 -0
  57. package/src/types/{users.ts → v1/users.ts} +1 -1
  58. package/src/types/v1/validation.ts +8 -0
  59. package/src/types/v2/content.ts +7 -0
  60. package/src/types/v2/index.ts +16 -11
  61. package/tsconfig.json +3 -2
  62. /package/dist/types/{ai-agents.js → v1/ai-agents.js} +0 -0
  63. /package/dist/types/{charts.js → v1/charts.js} +0 -0
  64. /package/dist/types/{dashboards.js → v1/dashboards.js} +0 -0
  65. /package/dist/types/{explores.js → v1/explores.js} +0 -0
  66. /package/dist/types/{groups.js → v1/groups.js} +0 -0
  67. /package/dist/types/{organizations.js → v1/organizations.js} +0 -0
  68. /package/dist/types/{project-access.js → v1/project-access.js} +0 -0
  69. /package/dist/types/{projects.js → v1/projects.js} +0 -0
  70. /package/dist/types/{queries.js → v1/queries.js} +0 -0
  71. /package/dist/types/{space-access.js → v1/space-access.js} +0 -0
  72. /package/dist/types/{spaces.js → v1/spaces.js} +0 -0
  73. /package/dist/types/{users.js → v1/users.js} +0 -0
package/README.md CHANGED
@@ -16,12 +16,21 @@ Domain models are type aliases to generated OpenAPI types (using `openapi-typesc
16
16
 
17
17
  Models are split into domain-specific files for better maintainability:
18
18
 
19
- - `types/projects.ts` - Projects domain models
20
- - `types/organizations.ts` - Organizations domain models
21
- - `types/queries.ts` - Queries domain models (requests and responses)
22
- - `types/charts.ts` - Charts domain models
23
- - `types/dashboards.ts` - Dashboards domain models
24
- - `types/spaces.ts` - Spaces domain models
19
+ - `types/v1/projects.ts` - Projects domain models
20
+ - `types/v1/organizations.ts` - Organizations domain models
21
+ - `types/v1/queries.ts` - Queries domain models (requests and responses)
22
+ - `types/v1/charts.ts` - Charts domain models
23
+ - `types/v1/dashboards.ts` - Dashboards domain models
24
+ - `types/v1/spaces.ts` - Spaces domain models
25
+ - `types/v1/metrics.ts` - Metrics domain models
26
+ - `types/v1/schedulers.ts` - Schedulers domain models
27
+ - `types/v1/tags.ts` - Tags domain models
28
+ - `types/v1/users.ts` - Users domain models
29
+ - `types/v1/groups.ts` - Groups domain models
30
+ - `types/v1/ai-agents.ts` - AI Agents domain models
31
+ - `types/v1/project-access.ts` - Project Access domain models
32
+ - `types/v1/validation.ts` - Validation domain models
33
+ - `types/v2/content.ts` - Content domain models (v2)
25
34
 
26
35
  The main `types/lightdash-api.ts` file imports all domains and assembles the `LightdashApi` namespace, providing flat exports for backward compatibility. All existing imports continue to work without changes.
27
36
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare function greet(name: string): string;
2
+ export * from './safety';
2
3
  export * from './types/lightdash-api';
3
4
  export type { LightdashApi } from './types/lightdash-api';
4
5
  export type { paths, components, operations } from './types/generated/openapi-types';
package/dist/index.js CHANGED
@@ -18,5 +18,7 @@ exports.greet = greet;
18
18
  function greet(name) {
19
19
  return `Hello, ${name}!`;
20
20
  }
21
+ // Export safety logic
22
+ __exportStar(require("./safety"), exports);
21
23
  // Export Lightdash API models
22
24
  __exportStar(require("./types/lightdash-api"), exports);
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Hierarchical safety modes for Lightdash AI tools and CLI.
3
+ */
4
+ export declare enum SafetyMode {
5
+ READ_ONLY = "read-only",
6
+ WRITE_IDEMPOTENT = "write-idempotent",
7
+ WRITE_DESTRUCTIVE = "write-destructive"
8
+ }
9
+ /**
10
+ * MCP tool annotations (hints for client display and approval).
11
+ * See MCP spec Tool annotations.
12
+ */
13
+ export type ToolAnnotations = {
14
+ title?: string;
15
+ readOnlyHint?: boolean;
16
+ destructiveHint?: boolean;
17
+ idempotentHint?: boolean;
18
+ openWorldHint?: boolean;
19
+ };
20
+ /** Preset: read-only, non-destructive, idempotent, closed-world. Use for list/get/compile tools. */
21
+ export declare const READ_ONLY_DEFAULT: ToolAnnotations;
22
+ /** Preset: write, non-destructive, idempotent (e.g. upsert by slug). Use for create/update tools. */
23
+ export declare const WRITE_IDEMPOTENT: ToolAnnotations;
24
+ /** Preset: write, destructive, non-idempotent. Use for delete/remove tools. */
25
+ export declare const WRITE_DESTRUCTIVE: ToolAnnotations;
26
+ /**
27
+ * Validates if an operation is allowed in the current safety mode.
28
+ */
29
+ export declare function isAllowed(mode: SafetyMode | string, annotations: ToolAnnotations): boolean;
30
+ /**
31
+ * Resolves safety mode from environment variable.
32
+ */
33
+ export declare function getSafetyModeFromEnv(): SafetyMode;
package/dist/safety.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITE_DESTRUCTIVE = exports.WRITE_IDEMPOTENT = exports.READ_ONLY_DEFAULT = exports.SafetyMode = void 0;
4
+ exports.isAllowed = isAllowed;
5
+ exports.getSafetyModeFromEnv = getSafetyModeFromEnv;
6
+ /**
7
+ * Hierarchical safety modes for Lightdash AI tools and CLI.
8
+ */
9
+ var SafetyMode;
10
+ (function (SafetyMode) {
11
+ SafetyMode["READ_ONLY"] = "read-only";
12
+ SafetyMode["WRITE_IDEMPOTENT"] = "write-idempotent";
13
+ SafetyMode["WRITE_DESTRUCTIVE"] = "write-destructive";
14
+ })(SafetyMode || (exports.SafetyMode = SafetyMode = {}));
15
+ /** Preset: read-only, non-destructive, idempotent, closed-world. Use for list/get/compile tools. */
16
+ exports.READ_ONLY_DEFAULT = {
17
+ readOnlyHint: true,
18
+ openWorldHint: false,
19
+ destructiveHint: false,
20
+ idempotentHint: true,
21
+ };
22
+ /** Preset: write, non-destructive, idempotent (e.g. upsert by slug). Use for create/update tools. */
23
+ exports.WRITE_IDEMPOTENT = {
24
+ readOnlyHint: false,
25
+ openWorldHint: false,
26
+ destructiveHint: false,
27
+ idempotentHint: true,
28
+ };
29
+ /** Preset: write, destructive, non-idempotent. Use for delete/remove tools. */
30
+ exports.WRITE_DESTRUCTIVE = {
31
+ readOnlyHint: false,
32
+ openWorldHint: false,
33
+ destructiveHint: true,
34
+ idempotentHint: false,
35
+ };
36
+ /**
37
+ * Validates if an operation is allowed in the current safety mode.
38
+ */
39
+ function isAllowed(mode, annotations) {
40
+ switch (mode) {
41
+ case SafetyMode.READ_ONLY:
42
+ return !!annotations.readOnlyHint;
43
+ case SafetyMode.WRITE_IDEMPOTENT:
44
+ return !!annotations.readOnlyHint || !annotations.destructiveHint;
45
+ case SafetyMode.WRITE_DESTRUCTIVE:
46
+ return true;
47
+ default:
48
+ return true; // Default to most permissive if mode is unknown
49
+ }
50
+ }
51
+ /**
52
+ * Resolves safety mode from environment variable.
53
+ */
54
+ function getSafetyModeFromEnv() {
55
+ const mode = process.env.LIGHTDASH_AI_MODE;
56
+ if (Object.values(SafetyMode).includes(mode)) {
57
+ return mode;
58
+ }
59
+ return SafetyMode.WRITE_DESTRUCTIVE;
60
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const safety_1 = require("./safety");
5
+ (0, vitest_1.describe)('Safety Logic', () => {
6
+ (0, vitest_1.describe)('isAllowed', () => {
7
+ (0, vitest_1.it)('should allow read-only operations in read-only mode', () => {
8
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.READ_ONLY, safety_1.READ_ONLY_DEFAULT)).toBe(true);
9
+ });
10
+ (0, vitest_1.it)('should forbid non-read-only operations in read-only mode', () => {
11
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.READ_ONLY, safety_1.WRITE_IDEMPOTENT)).toBe(false);
12
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.READ_ONLY, safety_1.WRITE_DESTRUCTIVE)).toBe(false);
13
+ });
14
+ (0, vitest_1.it)('should allow read-only and idempotent-write in write-idempotent mode', () => {
15
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_IDEMPOTENT, safety_1.READ_ONLY_DEFAULT)).toBe(true);
16
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_IDEMPOTENT, safety_1.WRITE_IDEMPOTENT)).toBe(true);
17
+ });
18
+ (0, vitest_1.it)('should forbid destructive operations in write-idempotent mode', () => {
19
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_IDEMPOTENT, safety_1.WRITE_DESTRUCTIVE)).toBe(false);
20
+ });
21
+ (0, vitest_1.it)('should allow all operations in write-destructive mode', () => {
22
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_DESTRUCTIVE, safety_1.READ_ONLY_DEFAULT)).toBe(true);
23
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_DESTRUCTIVE, safety_1.WRITE_IDEMPOTENT)).toBe(true);
24
+ (0, vitest_1.expect)((0, safety_1.isAllowed)(safety_1.SafetyMode.WRITE_DESTRUCTIVE, safety_1.WRITE_DESTRUCTIVE)).toBe(true);
25
+ });
26
+ });
27
+ });
@@ -1,337 +1,28 @@
1
1
  /**
2
- * Lightdash API models extracted from OpenAPI specification.
3
- * These models are organized by domain for better discoverability and reuse across packages.
4
- *
5
- * Models are type aliases to generated OpenAPI types, ensuring they remain aligned with the spec.
6
- * Models are split into domain-specific files for better maintainability.
7
- */
8
- import type { Projects } from './projects';
9
- import type { Organizations } from './organizations';
10
- import type { Queries } from './queries';
11
- import type { Charts } from './charts';
12
- import type { Dashboards } from './dashboards';
13
- import type { Spaces } from './spaces';
14
- import type { SpaceAccess } from './space-access';
15
- import type { Users } from './users';
16
- import type { Groups } from './groups';
17
- import type { AiAgents } from './ai-agents';
18
- import type { ProjectAccess } from './project-access';
19
- import type { Explores } from './explores';
20
- export type { Projects, Organizations, Queries, Charts, Dashboards, Spaces, SpaceAccess, Users, Groups, AiAgents, ProjectAccess, Explores, };
21
- import type { components } from './generated/openapi-types';
22
- /**
23
- * Main namespace for all Lightdash API models.
24
- * Provides organized access to all domain models.
25
- *
26
- * Usage:
27
- * ```typescript
28
- * import type { LightdashApi } from '@lightdash-tools/common';
29
- * const project: LightdashApi.Projects.Project = ...;
30
- * ```
2
+ * Lightdash API models entry point.
3
+ * Consolidates v1 and v2 types while maintaining backward compatibility.
31
4
  */
5
+ import { LightdashApi as V1Api } from './v1/lightdash-api';
6
+ import { V2 as V2Api } from './v2/index';
32
7
  export declare namespace LightdashApi {
33
- namespace Projects {
34
- type Project = components['schemas']['Project'];
35
- type OrganizationProject = components['schemas']['OrganizationProject'];
36
- }
37
- namespace Organizations {
38
- type Organization = components['schemas']['Organization'];
39
- }
40
- namespace Queries {
41
- namespace Requests {
42
- type MetricQuery = components['schemas']['MetricQueryRequest'];
43
- type CompileQuery = components['schemas']['MetricQuery'] & {
44
- pivotConfiguration?: components['schemas']['PivotConfiguration'];
45
- parameters?: components['schemas']['ParametersValuesMap'];
46
- };
47
- type ExecuteAsyncMetricQuery = components['schemas']['ExecuteAsyncMetricQueryRequestParams'];
48
- type ExecuteAsyncSqlQuery = components['schemas']['ExecuteAsyncSqlQueryRequestParams'];
49
- type ExecuteAsyncSavedChart = components['schemas']['ExecuteAsyncSavedChartRequestParams'];
50
- type ExecuteAsyncDashboardChart = components['schemas']['ExecuteAsyncDashboardChartRequestParams'];
51
- type ExecuteAsyncUnderlyingData = components['schemas']['ExecuteAsyncUnderlyingDataRequestParams'];
52
- }
53
- namespace Responses {
54
- type RunQueryResults = components['schemas']['ApiRunQueryResponse']['results'];
55
- type CompiledQueryResults = components['schemas']['ApiCompiledQueryResults'];
56
- type ExecuteAsyncMetricQueryResults = components['schemas']['ApiExecuteAsyncMetricQueryResults'];
57
- type ExecuteAsyncDashboardChartResults = components['schemas']['ApiExecuteAsyncDashboardChartQueryResults'];
58
- type ExecuteAsyncSqlQueryResults = components['schemas']['ApiExecuteAsyncSqlQueryResults'];
59
- }
60
- }
61
- namespace Charts {
62
- type SpaceQuery = components['schemas']['SpaceQuery'];
63
- type ChartAsCodeListResults = components['schemas']['ApiChartAsCodeListResponse']['results'];
64
- type ChartAsCodeUpsertResults = components['schemas']['ApiChartAsCodeUpsertResponse']['results'];
65
- type UpsertChartAsCodeBody = components['schemas']['Omit_ChartAsCode.chartConfig-or-description_'] & {
66
- description?: string | null;
67
- chartConfig: components['schemas']['AnyType'];
68
- publicSpaceCreate?: boolean;
69
- skipSpaceCreate?: boolean;
70
- };
71
- }
72
- namespace Dashboards {
73
- type DashboardBasicDetailsWithTileTypes = components['schemas']['DashboardBasicDetailsWithTileTypes'];
74
- }
75
- namespace Spaces {
76
- type SpaceSummary = components['schemas']['SpaceSummary'];
77
- type Space = components['schemas']['Space'];
78
- type CreateSpace = components['schemas']['CreateSpace'];
79
- type UpdateSpace = components['schemas']['UpdateSpace'];
80
- }
81
- namespace SpaceAccess {
82
- type AddSpaceUserAccess = components['schemas']['AddSpaceUserAccess'];
83
- type AddSpaceGroupAccess = components['schemas']['AddSpaceGroupAccess'];
84
- type SpaceMemberRole = components['schemas']['SpaceMemberRole'];
85
- }
86
- namespace ProjectAccess {
87
- type ProjectMemberProfile = components['schemas']['ProjectMemberProfile'];
88
- type ProjectMemberRole = components['schemas']['ProjectMemberRole'];
89
- type CreateProjectMember = components['schemas']['CreateProjectMember'];
90
- type UpdateProjectMember = components['schemas']['UpdateProjectMember'];
91
- type ProjectGroupAccess = components['schemas']['ProjectGroupAccess'];
92
- type CreateProjectGroupAccessBody = components['schemas']['Pick_CreateProjectGroupAccess.role_'];
93
- type UpdateProjectGroupAccess = components['schemas']['UpdateDBProjectGroupAccess'];
94
- }
95
- namespace Users {
96
- type OrganizationMemberProfile = components['schemas']['OrganizationMemberProfile'];
97
- type OrganizationMemberProfilesResult = components['schemas']['KnexPaginatedData_OrganizationMemberProfile-Array_'];
98
- type ApiOrganizationMemberProfile = components['schemas']['ApiOrganizationMemberProfile'];
99
- type ApiOrganizationMemberProfiles = components['schemas']['ApiOrganizationMemberProfiles'];
100
- type OrganizationMemberProfileUpdate = components['schemas']['OrganizationMemberProfileUpdate'];
101
- }
102
- namespace Groups {
103
- type Group = components['schemas']['Group'];
104
- type GroupWithMembers = components['schemas']['GroupWithMembers'];
105
- type CreateGroup = components['schemas']['CreateGroup'];
106
- type UpdateGroupWithMembers = components['schemas']['UpdateGroupWithMembers'];
107
- type GroupListResult = components['schemas']['KnexPaginatedData_Group-Array-or-GroupWithMembers-Array_'];
108
- type ApiGroupResponse = components['schemas']['ApiGroupResponse'];
109
- type ApiGroupListResponse = components['schemas']['ApiGroupListResponse'];
110
- type ApiCreateGroupResponse = components['schemas']['ApiCreateGroupResponse'];
111
- type ApiGroupMembersResponse = components['schemas']['ApiGroupMembersResponse'];
112
- type GroupMember = components['schemas']['GroupMember'];
113
- }
114
- namespace AiAgents {
115
- type AiAgentSummary = components['schemas']['AiAgentSummary'];
116
- type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
117
- type AdminThreadsResult = components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
118
- type GetAiOrganizationSettingsResult = components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
119
- type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
120
- type UpdateAiOrganizationSettingsResult = components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
121
- }
122
- namespace Explores {
123
- type ApiExploresResults = components['schemas']['ApiExploresResults'];
124
- type ApiExploreResults = components['schemas']['ApiExploreResults'];
125
- }
126
- /** Types for Lightdash API v1 endpoints (ADR-0008). */
127
- namespace V1 {
128
- namespace Projects {
129
- type Project = components['schemas']['Project'];
130
- type OrganizationProject = components['schemas']['OrganizationProject'];
131
- }
132
- namespace Organizations {
133
- type Organization = components['schemas']['Organization'];
134
- }
135
- namespace Queries {
136
- namespace Requests {
137
- type MetricQuery = components['schemas']['MetricQueryRequest'];
138
- type CompileQuery = components['schemas']['MetricQuery'] & {
139
- pivotConfiguration?: components['schemas']['PivotConfiguration'];
140
- parameters?: components['schemas']['ParametersValuesMap'];
141
- };
142
- type ExecuteAsyncMetricQuery = components['schemas']['ExecuteAsyncMetricQueryRequestParams'];
143
- type ExecuteAsyncSqlQuery = components['schemas']['ExecuteAsyncSqlQueryRequestParams'];
144
- type ExecuteAsyncSavedChart = components['schemas']['ExecuteAsyncSavedChartRequestParams'];
145
- type ExecuteAsyncDashboardChart = components['schemas']['ExecuteAsyncDashboardChartRequestParams'];
146
- type ExecuteAsyncUnderlyingData = components['schemas']['ExecuteAsyncUnderlyingDataRequestParams'];
147
- }
148
- namespace Responses {
149
- type RunQueryResults = components['schemas']['ApiRunQueryResponse']['results'];
150
- type CompiledQueryResults = components['schemas']['ApiCompiledQueryResults'];
151
- type ExecuteAsyncMetricQueryResults = components['schemas']['ApiExecuteAsyncMetricQueryResults'];
152
- type ExecuteAsyncDashboardChartResults = components['schemas']['ApiExecuteAsyncDashboardChartQueryResults'];
153
- type ExecuteAsyncSqlQueryResults = components['schemas']['ApiExecuteAsyncSqlQueryResults'];
154
- }
155
- }
156
- namespace Charts {
157
- type SpaceQuery = components['schemas']['SpaceQuery'];
158
- }
159
- namespace Dashboards {
160
- type DashboardBasicDetailsWithTileTypes = components['schemas']['DashboardBasicDetailsWithTileTypes'];
161
- }
162
- namespace Spaces {
163
- type SpaceSummary = components['schemas']['SpaceSummary'];
164
- type Space = components['schemas']['Space'];
165
- type CreateSpace = components['schemas']['CreateSpace'];
166
- type UpdateSpace = components['schemas']['UpdateSpace'];
167
- }
168
- namespace SpaceAccess {
169
- type AddSpaceUserAccess = components['schemas']['AddSpaceUserAccess'];
170
- type AddSpaceGroupAccess = components['schemas']['AddSpaceGroupAccess'];
171
- type SpaceMemberRole = components['schemas']['SpaceMemberRole'];
172
- }
173
- namespace ProjectAccess {
174
- type ProjectMemberProfile = components['schemas']['ProjectMemberProfile'];
175
- type ProjectMemberRole = components['schemas']['ProjectMemberRole'];
176
- type CreateProjectMember = components['schemas']['CreateProjectMember'];
177
- type UpdateProjectMember = components['schemas']['UpdateProjectMember'];
178
- type ProjectGroupAccess = components['schemas']['ProjectGroupAccess'];
179
- type CreateProjectGroupAccessBody = components['schemas']['Pick_CreateProjectGroupAccess.role_'];
180
- type UpdateProjectGroupAccess = components['schemas']['UpdateDBProjectGroupAccess'];
181
- }
182
- namespace Users {
183
- type OrganizationMemberProfile = components['schemas']['OrganizationMemberProfile'];
184
- type OrganizationMemberProfilesResult = components['schemas']['KnexPaginatedData_OrganizationMemberProfile-Array_'];
185
- type ApiOrganizationMemberProfile = components['schemas']['ApiOrganizationMemberProfile'];
186
- type ApiOrganizationMemberProfiles = components['schemas']['ApiOrganizationMemberProfiles'];
187
- type OrganizationMemberProfileUpdate = components['schemas']['OrganizationMemberProfileUpdate'];
188
- }
189
- namespace Groups {
190
- type Group = components['schemas']['Group'];
191
- type GroupWithMembers = components['schemas']['GroupWithMembers'];
192
- type CreateGroup = components['schemas']['CreateGroup'];
193
- type UpdateGroupWithMembers = components['schemas']['UpdateGroupWithMembers'];
194
- type GroupListResult = components['schemas']['KnexPaginatedData_Group-Array-or-GroupWithMembers-Array_'];
195
- type ApiGroupResponse = components['schemas']['ApiGroupResponse'];
196
- type ApiGroupListResponse = components['schemas']['ApiGroupListResponse'];
197
- type ApiCreateGroupResponse = components['schemas']['ApiCreateGroupResponse'];
198
- type ApiGroupMembersResponse = components['schemas']['ApiGroupMembersResponse'];
199
- type GroupMember = components['schemas']['GroupMember'];
200
- }
201
- namespace AiAgents {
202
- type AiAgentSummary = components['schemas']['AiAgentSummary'];
203
- type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
204
- type AdminThreadsResult = components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
205
- type GetAiOrganizationSettingsResult = components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
206
- type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
207
- type UpdateAiOrganizationSettingsResult = components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
208
- }
209
- }
210
- /** Types for Lightdash API v2 endpoints (ADR-0008). */
211
- namespace V2 {
212
- namespace Projects {
213
- type Project = components['schemas']['Project'];
214
- type OrganizationProject = components['schemas']['OrganizationProject'];
215
- }
216
- namespace Organizations {
217
- type Organization = components['schemas']['Organization'];
218
- }
219
- namespace Queries {
220
- namespace Requests {
221
- type MetricQuery = components['schemas']['MetricQueryRequest'];
222
- type CompileQuery = components['schemas']['MetricQuery'] & {
223
- pivotConfiguration?: components['schemas']['PivotConfiguration'];
224
- parameters?: components['schemas']['ParametersValuesMap'];
225
- };
226
- type ExecuteAsyncMetricQuery = components['schemas']['ExecuteAsyncMetricQueryRequestParams'];
227
- type ExecuteAsyncSqlQuery = components['schemas']['ExecuteAsyncSqlQueryRequestParams'];
228
- type ExecuteAsyncSavedChart = components['schemas']['ExecuteAsyncSavedChartRequestParams'];
229
- type ExecuteAsyncDashboardChart = components['schemas']['ExecuteAsyncDashboardChartRequestParams'];
230
- type ExecuteAsyncUnderlyingData = components['schemas']['ExecuteAsyncUnderlyingDataRequestParams'];
231
- }
232
- namespace Responses {
233
- type RunQueryResults = components['schemas']['ApiRunQueryResponse']['results'];
234
- type CompiledQueryResults = components['schemas']['ApiCompiledQueryResults'];
235
- type ExecuteAsyncMetricQueryResults = components['schemas']['ApiExecuteAsyncMetricQueryResults'];
236
- type ExecuteAsyncDashboardChartResults = components['schemas']['ApiExecuteAsyncDashboardChartQueryResults'];
237
- type ExecuteAsyncSqlQueryResults = components['schemas']['ApiExecuteAsyncSqlQueryResults'];
238
- }
239
- }
240
- namespace Charts {
241
- type SpaceQuery = components['schemas']['SpaceQuery'];
242
- }
243
- namespace Dashboards {
244
- type DashboardBasicDetailsWithTileTypes = components['schemas']['DashboardBasicDetailsWithTileTypes'];
245
- }
246
- namespace Spaces {
247
- type SpaceSummary = components['schemas']['SpaceSummary'];
248
- type Space = components['schemas']['Space'];
249
- type CreateSpace = components['schemas']['CreateSpace'];
250
- type UpdateSpace = components['schemas']['UpdateSpace'];
251
- }
252
- namespace SpaceAccess {
253
- type AddSpaceUserAccess = components['schemas']['AddSpaceUserAccess'];
254
- type AddSpaceGroupAccess = components['schemas']['AddSpaceGroupAccess'];
255
- type SpaceMemberRole = components['schemas']['SpaceMemberRole'];
256
- }
257
- namespace ProjectAccess {
258
- type ProjectMemberProfile = components['schemas']['ProjectMemberProfile'];
259
- type ProjectMemberRole = components['schemas']['ProjectMemberRole'];
260
- type CreateProjectMember = components['schemas']['CreateProjectMember'];
261
- type UpdateProjectMember = components['schemas']['UpdateProjectMember'];
262
- type ProjectGroupAccess = components['schemas']['ProjectGroupAccess'];
263
- type CreateProjectGroupAccessBody = components['schemas']['Pick_CreateProjectGroupAccess.role_'];
264
- type UpdateProjectGroupAccess = components['schemas']['UpdateDBProjectGroupAccess'];
265
- }
266
- namespace Users {
267
- type OrganizationMemberProfile = components['schemas']['OrganizationMemberProfile'];
268
- type OrganizationMemberProfilesResult = components['schemas']['KnexPaginatedData_OrganizationMemberProfile-Array_'];
269
- type ApiOrganizationMemberProfile = components['schemas']['ApiOrganizationMemberProfile'];
270
- type ApiOrganizationMemberProfiles = components['schemas']['ApiOrganizationMemberProfiles'];
271
- type OrganizationMemberProfileUpdate = components['schemas']['OrganizationMemberProfileUpdate'];
272
- }
273
- namespace Groups {
274
- type Group = components['schemas']['Group'];
275
- type GroupWithMembers = components['schemas']['GroupWithMembers'];
276
- type CreateGroup = components['schemas']['CreateGroup'];
277
- type UpdateGroupWithMembers = components['schemas']['UpdateGroupWithMembers'];
278
- type GroupListResult = components['schemas']['KnexPaginatedData_Group-Array-or-GroupWithMembers-Array_'];
279
- type ApiGroupResponse = components['schemas']['ApiGroupResponse'];
280
- type ApiGroupListResponse = components['schemas']['ApiGroupListResponse'];
281
- type ApiCreateGroupResponse = components['schemas']['ApiCreateGroupResponse'];
282
- type ApiGroupMembersResponse = components['schemas']['ApiGroupMembersResponse'];
283
- type GroupMember = components['schemas']['GroupMember'];
284
- }
285
- namespace AiAgents {
286
- type AiAgentSummary = components['schemas']['AiAgentSummary'];
287
- type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
288
- type AdminThreadsResult = components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
289
- type GetAiOrganizationSettingsResult = components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
290
- type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
291
- type UpdateAiOrganizationSettingsResult = components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
292
- }
293
- }
8
+ export import Projects = V1Api.Projects;
9
+ export import Organizations = V1Api.Organizations;
10
+ export import Queries = V1Api.Queries;
11
+ export import Charts = V1Api.Charts;
12
+ export import Dashboards = V1Api.Dashboards;
13
+ export import Spaces = V1Api.Spaces;
14
+ export import SpaceAccess = V1Api.SpaceAccess;
15
+ export import Users = V1Api.Users;
16
+ export import Groups = V1Api.Groups;
17
+ export import AiAgents = V1Api.AiAgents;
18
+ export import ProjectAccess = V1Api.ProjectAccess;
19
+ export import Explores = V1Api.Explores;
20
+ export import Validation = V1Api.Validation;
21
+ export import Metrics = V1Api.Metrics;
22
+ export import Schedulers = V1Api.Schedulers;
23
+ export import Tags = V1Api.Tags;
24
+ export import Content = V1Api.Content;
25
+ export import V1 = V1Api.V1;
26
+ export import V2 = V2Api;
294
27
  }
295
- export type Project = Projects.Project;
296
- export type OrganizationProject = Projects.OrganizationProject;
297
- export type Organization = Organizations.Organization;
298
- export type SpaceQuery = Charts.SpaceQuery;
299
- export type ChartAsCodeListResults = Charts.ChartAsCodeListResults;
300
- export type ChartAsCodeUpsertResults = Charts.ChartAsCodeUpsertResults;
301
- export type UpsertChartAsCodeBody = Charts.UpsertChartAsCodeBody;
302
- export type DashboardBasicDetailsWithTileTypes = Dashboards.DashboardBasicDetailsWithTileTypes;
303
- export type SpaceSummary = Spaces.SpaceSummary;
304
- export type Space = Spaces.Space;
305
- export type CreateSpace = Spaces.CreateSpace;
306
- export type UpdateSpace = Spaces.UpdateSpace;
307
- export type AddSpaceUserAccess = SpaceAccess.AddSpaceUserAccess;
308
- export type AddSpaceGroupAccess = SpaceAccess.AddSpaceGroupAccess;
309
- export type SpaceMemberRole = SpaceAccess.SpaceMemberRole;
310
- export type ProjectMemberProfile = ProjectAccess.ProjectMemberProfile;
311
- export type ProjectMemberRole = ProjectAccess.ProjectMemberRole;
312
- export type CreateProjectMember = ProjectAccess.CreateProjectMember;
313
- export type UpdateProjectMember = ProjectAccess.UpdateProjectMember;
314
- export type ProjectGroupAccess = ProjectAccess.ProjectGroupAccess;
315
- export type CreateProjectGroupAccessBody = ProjectAccess.CreateProjectGroupAccessBody;
316
- export type UpdateProjectGroupAccess = ProjectAccess.UpdateProjectGroupAccess;
317
- export type MetricQueryRequest = Queries.Requests.MetricQuery;
318
- export type CompileQueryRequest = Queries.Requests.CompileQuery;
319
- export type ExecuteAsyncMetricQueryRequestParams = Queries.Requests.ExecuteAsyncMetricQuery;
320
- export type ExecuteAsyncSqlQueryRequestParams = Queries.Requests.ExecuteAsyncSqlQuery;
321
- export type ExecuteAsyncSavedChartRequestParams = Queries.Requests.ExecuteAsyncSavedChart;
322
- export type ExecuteAsyncDashboardChartRequestParams = Queries.Requests.ExecuteAsyncDashboardChart;
323
- export type ExecuteAsyncUnderlyingDataRequestParams = Queries.Requests.ExecuteAsyncUnderlyingData;
324
- export type RunQueryResults = Queries.Responses.RunQueryResults;
325
- export type CompiledQueryResults = Queries.Responses.CompiledQueryResults;
326
- export type ExecuteAsyncMetricQueryResults = Queries.Responses.ExecuteAsyncMetricQueryResults;
327
- export type ExecuteAsyncDashboardChartResults = Queries.Responses.ExecuteAsyncDashboardChartResults;
328
- export type ExecuteAsyncSqlQueryResults = Queries.Responses.ExecuteAsyncSqlQueryResults;
329
- export type AiAgentSummary = AiAgents.AiAgentSummary;
330
- export type AiAgentAdminSortField = AiAgents.AiAgentAdminSortField;
331
- export type AiAgentsAdminThreadsResult = AiAgents.AdminThreadsResult;
332
- export type GetAiOrganizationSettingsResult = AiAgents.GetAiOrganizationSettingsResult;
333
- export type UpdateAiOrganizationSettings = AiAgents.UpdateAiOrganizationSettings;
334
- export type UpdateAiOrganizationSettingsResult = AiAgents.UpdateAiOrganizationSettingsResult;
335
- export type GetAdminThreadsParams = AiAgents.GetAdminThreadsParams;
336
- export type ApiExploresResults = Explores.ApiExploresResults;
337
- export type ApiExploreResults = Explores.ApiExploreResults;
28
+ export type { Project, OrganizationProject, Organization, SpaceQuery, ChartAsCodeListResults, ChartAsCodeUpsertResults, UpsertChartAsCodeBody, DashboardBasicDetailsWithTileTypes, SpaceSummary, Space, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess, SpaceMemberRole, ProjectMemberProfile, ProjectMemberRole, CreateProjectMember, UpdateProjectMember, ProjectGroupAccess, CreateProjectGroupAccessBody, UpdateProjectGroupAccess, MetricQueryRequest, CompileQueryRequest, ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, RunQueryResults, CompiledQueryResults, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults, AiAgentSummary, AiAgentAdminSortField, AiAgentsAdminThreadsResult, GetAiOrganizationSettingsResult, UpdateAiOrganizationSettings, UpdateAiOrganizationSettingsResult, GetAdminThreadsParams, ApiExploresResults, ApiExploreResults, } from './v1/lightdash-api';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  /**
3
- * Lightdash API models extracted from OpenAPI specification.
4
- * These models are organized by domain for better discoverability and reuse across packages.
5
- *
6
- * Models are type aliases to generated OpenAPI types, ensuring they remain aligned with the spec.
7
- * Models are split into domain-specific files for better maintainability.
3
+ * Lightdash API models entry point.
4
+ * Consolidates v1 and v2 types while maintaining backward compatibility.
8
5
  */
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.LightdashApi = void 0;
8
+ // Re-export the unified namespace
9
+ var LightdashApi;
10
+ (function (LightdashApi) {
11
+ })(LightdashApi || (exports.LightdashApi = LightdashApi = {}));
@@ -2,7 +2,7 @@
2
2
  * AI agents domain models.
3
3
  * Extracted from OpenAPI specification for better maintainability.
4
4
  */
5
- import type { components } from './generated/openapi-types';
5
+ import type { components } from '../generated/openapi-types';
6
6
  export declare namespace AiAgents {
7
7
  /** Summary of an AI agent (admin list). */
8
8
  type AiAgentSummary = components['schemas']['AiAgentSummary'];
@@ -2,7 +2,7 @@
2
2
  * Charts domain models.
3
3
  * Extracted from OpenAPI specification for better maintainability.
4
4
  */
5
- import type { components } from './generated/openapi-types';
5
+ import type { components } from '../generated/openapi-types';
6
6
  export declare namespace Charts {
7
7
  /** Space query (chart listing item). */
8
8
  type SpaceQuery = components['schemas']['SpaceQuery'];
@@ -2,7 +2,7 @@
2
2
  * Dashboards domain models.
3
3
  * Extracted from OpenAPI specification for better maintainability.
4
4
  */
5
- import type { components } from './generated/openapi-types';
5
+ import type { components } from '../generated/openapi-types';
6
6
  export declare namespace Dashboards {
7
7
  /** Dashboard basic details with tile types. */
8
8
  type DashboardBasicDetailsWithTileTypes = components['schemas']['DashboardBasicDetailsWithTileTypes'];
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Explores domain models (list and get response types from the Lightdash v1 API).
3
3
  */
4
- import type { components } from './generated/openapi-types';
4
+ import type { components } from '../generated/openapi-types';
5
5
  export declare namespace Explores {
6
6
  /** List explores response (array of summary explore). */
7
7
  type ApiExploresResults = components['schemas']['ApiExploresResults'];
8
8
  /** Get single explore response (full explore). */
9
9
  type ApiExploreResults = components['schemas']['ApiExploreResults'];
10
+ /** Compiled table within an explore. */
11
+ type CompiledTable = components['schemas']['CompiledTable'];
10
12
  }
@@ -2,7 +2,7 @@
2
2
  * Groups domain models.
3
3
  * Extracted from OpenAPI specification for better maintainability.
4
4
  */
5
- import type { components } from './generated/openapi-types';
5
+ import type { components } from '../generated/openapi-types';
6
6
  export declare namespace Groups {
7
7
  /** Group entity. */
8
8
  type Group = components['schemas']['Group'];
@@ -2,17 +2,17 @@
2
2
  * V1 API type barrel. Re-exports the same surface as LightdashApi.V1.
3
3
  * Domain files remain at types/*.ts; see ADR-0008 (file layout follow-up).
4
4
  */
5
- import type { Projects as P } from '../projects';
6
- import type { Organizations as O } from '../organizations';
7
- import type { Queries as Q } from '../queries';
8
- import type { Charts as C } from '../charts';
9
- import type { Dashboards as D } from '../dashboards';
10
- import type { Spaces as S } from '../spaces';
11
- import type { SpaceAccess as SA } from '../space-access';
12
- import type { ProjectAccess as PA } from '../project-access';
13
- import type { Users as U } from '../users';
14
- import type { Groups as G } from '../groups';
15
- import type { AiAgents as A } from '../ai-agents';
5
+ import type { Projects as P } from './projects';
6
+ import type { Organizations as O } from './organizations';
7
+ import type { Queries as Q } from './queries';
8
+ import type { Charts as C } from './charts';
9
+ import type { Dashboards as D } from './dashboards';
10
+ import type { Spaces as S } from './spaces';
11
+ import type { SpaceAccess as SA } from './space-access';
12
+ import type { ProjectAccess as PA } from './project-access';
13
+ import type { Users as U } from './users';
14
+ import type { Groups as G } from './groups';
15
+ import type { AiAgents as A } from './ai-agents';
16
16
  export declare namespace V1 {
17
17
  namespace Projects {
18
18
  type Project = P.Project;