@lightdash-tools/common 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 (94) hide show
  1. package/dist/agentops/extract-yaml-project.d.ts +7 -0
  2. package/dist/agentops/extract-yaml-project.js +42 -0
  3. package/dist/agentops/formatters.d.ts +5 -0
  4. package/dist/agentops/formatters.js +47 -0
  5. package/dist/agentops/snapshots.d.ts +32 -0
  6. package/dist/agentops/snapshots.js +34 -0
  7. package/dist/agentops/types.d.ts +224 -0
  8. package/dist/agentops/types.js +430 -0
  9. package/dist/argument-validation.d.ts +25 -0
  10. package/dist/argument-validation.js +199 -0
  11. package/dist/argument-validation.test.d.ts +1 -0
  12. package/dist/argument-validation.test.js +183 -0
  13. package/dist/audit.d.ts +9 -2
  14. package/dist/audit.js +17 -2
  15. package/dist/audit.test.d.ts +1 -0
  16. package/dist/audit.test.js +73 -0
  17. package/dist/env.d.ts +8 -0
  18. package/dist/env.js +9 -1
  19. package/dist/index.d.ts +7 -1
  20. package/dist/index.js +14 -0
  21. package/dist/input-validation.d.ts +35 -0
  22. package/dist/input-validation.js +87 -0
  23. package/dist/input-validation.test.js +93 -0
  24. package/dist/operations/agent-safe.d.ts +7 -0
  25. package/dist/operations/agent-safe.js +16 -0
  26. package/dist/operations/ai-agents.d.ts +6 -0
  27. package/dist/operations/ai-agents.js +411 -0
  28. package/dist/operations/index.d.ts +5 -0
  29. package/dist/operations/index.js +16 -0
  30. package/dist/operations/parity.test.d.ts +1 -0
  31. package/dist/operations/parity.test.js +28 -0
  32. package/dist/operations/registry.d.ts +10 -0
  33. package/dist/operations/registry.js +35 -0
  34. package/dist/operations/registry.test.d.ts +1 -0
  35. package/dist/operations/registry.test.js +196 -0
  36. package/dist/operations/types.d.ts +69 -0
  37. package/dist/operations/types.js +70 -0
  38. package/dist/operations/types.test.d.ts +1 -0
  39. package/dist/operations/types.test.js +104 -0
  40. package/dist/operations/users.d.ts +6 -0
  41. package/dist/operations/users.js +60 -0
  42. package/dist/safety.d.ts +27 -2
  43. package/dist/safety.js +52 -5
  44. package/dist/safety.test.js +217 -4
  45. package/dist/types/generated/openapi-types.d.ts +35895 -10622
  46. package/dist/types/generated/openapi-types.js +0 -1
  47. package/dist/types/lightdash-api.d.ts +1 -1
  48. package/dist/types/v1/ai-agents.d.ts +112 -3
  49. package/dist/types/v1/charts.d.ts +5 -3
  50. package/dist/types/v1/dashboards.d.ts +13 -0
  51. package/dist/types/v1/index.d.ts +45 -8
  52. package/dist/types/v1/index.js +1 -1
  53. package/dist/types/v1/lightdash-api.d.ts +107 -16
  54. package/dist/types/v1/users.d.ts +4 -0
  55. package/dist/types/v2/content.d.ts +2 -0
  56. package/dist/types/v2/content.js +8 -0
  57. package/dist/types/v2/index.d.ts +11 -9
  58. package/dist/types/v2/index.js +1 -1
  59. package/package.json +16 -3
  60. package/src/agentops/extract-yaml-project.ts +42 -0
  61. package/src/agentops/formatters.ts +52 -0
  62. package/src/agentops/snapshots.ts +56 -0
  63. package/src/agentops/types.ts +599 -0
  64. package/src/argument-validation.test.ts +270 -0
  65. package/src/argument-validation.ts +240 -0
  66. package/src/audit.test.ts +87 -0
  67. package/src/audit.ts +21 -3
  68. package/src/env.ts +9 -0
  69. package/src/index.test.ts +1 -0
  70. package/src/index.ts +16 -1
  71. package/src/input-validation.test.ts +157 -1
  72. package/src/input-validation.ts +95 -0
  73. package/src/operations/agent-safe.ts +18 -0
  74. package/src/operations/ai-agents.ts +451 -0
  75. package/src/operations/index.ts +19 -0
  76. package/src/operations/parity.test.ts +35 -0
  77. package/src/operations/registry.test.ts +219 -0
  78. package/src/operations/registry.ts +44 -0
  79. package/src/operations/types.test.ts +148 -0
  80. package/src/operations/types.ts +168 -0
  81. package/src/operations/users.ts +67 -0
  82. package/src/safety.test.ts +276 -4
  83. package/src/safety.ts +72 -4
  84. package/src/types/generated/openapi-types.ts +37017 -11241
  85. package/src/types/lightdash-api.ts +39 -0
  86. package/src/types/v1/ai-agents.ts +133 -3
  87. package/src/types/v1/charts.ts +5 -3
  88. package/src/types/v1/dashboards.ts +19 -0
  89. package/src/types/v1/index.ts +51 -8
  90. package/src/types/v1/lightdash-api.ts +129 -20
  91. package/src/types/v1/users.ts +4 -0
  92. package/src/types/v2/content.ts +8 -0
  93. package/src/types/v2/index.ts +11 -9
  94. package/tsconfig.json +1 -0
@@ -3,5 +3,4 @@
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
5
5
  */
6
- /* eslint-disable no-irregular-whitespace */
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -25,4 +25,4 @@ export declare namespace LightdashApi {
25
25
  export import V1 = V1Api.V1;
26
26
  export import V2 = V2Api;
27
27
  }
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, AiAgent, CreateAiAgent, UpdateAiAgent, AiAgentThreadSummary, AiAgentThread, CreateAgentThreadBody, GenerateAgentThreadBody, GenerateAgentThreadResult, CreateEvaluationPrompt, CreateEvaluationBody, CreateEvaluationResult, UpdateEvaluationBody, AppendEvaluationBody, AiAgentEvaluationSummary, AiAgentEvaluation, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationRun, AiAgentEvaluationRunResult, ApiExploresResults, ApiExploreResults, } from './v1/lightdash-api';
28
+ export type { Project, OrganizationProject, Organization, SpaceQuery, ChartAsCodeListResults, ChartAsCodeUpsertResults, UpsertChartAsCodeBody, DashboardBasicDetailsWithTileTypes, DashboardAsCodeListResults, DashboardAsCodeUpsertResults, UpsertDashboardAsCodeBody, SpaceSummary, Space, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess, SpaceMemberRole, ProjectMemberProfile, ProjectMemberRole, CreateProjectMember, UpdateProjectMember, ProjectGroupAccess, CreateProjectGroupAccessBody, UpdateProjectGroupAccess, AuthenticatedUser, MetricQueryRequest, CompileQueryRequest, ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, RunQueryResults, CompiledQueryResults, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults, AiAgentSummary, AiAgentAdminSortField, AiAgentsAdminThreadsResult, GetAiOrganizationSettingsResult, UpdateAiOrganizationSettings, UpdateAiOrganizationSettingsResult, GetAdminThreadsParams, AiAgent, CreateAiAgent, UpdateAiAgent, AiAgentThreadSummary, AiAgentThread, CreateAgentThreadBody, CreateAgentThreadMessageBody, CreateAgentThreadMessageResult, GenerateAgentThreadBody, GenerateAgentThreadResult, CreateEvaluationPrompt, CreateEvaluationBody, CreateEvaluationResult, UpdateEvaluationBody, AppendEvaluationBody, AiAgentEvaluationSummary, AiAgentEvaluation, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationRun, AiAgentEvaluationRunResult, AiModelOption, ReadinessScore, AiAgentExploreAccessSummary, ExploreAccessSummaryBody, AiAgentUserPreferences, GetAgentSuggestionsParams, AgentSuggestion, AgentSuggestionPromptChip, AgentSuggestionNavigateChip, AgentSuggestionTool, AgentSuggestionChip, AgentSuggestions, GenerateThreadTitleResult, CloneThreadBody, AiAgentVerifiedArtifact, AiAgentVerifiedArtifactsListResult, ListVerifiedArtifactsParams, AiAgentVerifiedQuestion, AiArtifact, AiAgentThreadMessageVizQuery, UpdateMessageFeedbackBody, AiMcpServerAuthType, AiMcpCredentialScope, AiMcpServerConnectionStatus, AiMcpServer, AiMcpServerTool, AiAgentMcpServerTool, CreateProjectMcpServerBody, AiAgentMcpServerToolUpdate, UpdateAgentMcpServerToolsBody, SqlApprovalDecision, SubmitSqlApprovalBody, SubmitSqlApprovalResult, ApiExploresResults, ApiExploreResults, } from './v1/lightdash-api';
@@ -55,10 +55,17 @@ export declare namespace AiAgents {
55
55
  */
56
56
  type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
57
57
  /**
58
- * Request body for generating/continuing a thread response
59
- * (POST …/threads/{threadUuid}/generate).
58
+ * Request body for adding a user message to a thread
59
+ * (POST …/threads/{threadUuid}/messages).
60
60
  */
61
- type GenerateAgentThreadBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
61
+ type CreateAgentThreadMessageBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
62
+ /** User message returned after creating a thread message. */
63
+ type CreateAgentThreadMessageResult = components['schemas']['ApiAiAgentThreadMessageCreateResponse']['results'];
64
+ /**
65
+ * Request body for generating/continuing a thread response.
66
+ * @deprecated Use {@link CreateAgentThreadMessageBody} with the messages endpoint.
67
+ */
68
+ type GenerateAgentThreadBody = CreateAgentThreadMessageBody;
62
69
  /** Response returned by the generate endpoint. */
63
70
  type GenerateAgentThreadResult = components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
64
71
  /** A prompt used in an evaluation (string prompt or reference to existing thread message). */
@@ -91,4 +98,106 @@ export declare namespace AiAgents {
91
98
  type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
92
99
  /** Assessment type: human or llm. */
93
100
  type AssessmentType = components['schemas']['AssessmentType'];
101
+ /** Available AI model option for an agent (GET …/{agentUuid}/models). */
102
+ type AiModelOption = components['schemas']['AiModelOption'];
103
+ /** Agent readiness evaluation score (POST …/{agentUuid}/evaluateReadiness). */
104
+ type ReadinessScore = components['schemas']['ReadinessScore'];
105
+ /** Per-explore field access summary (POST …/explore-access-summary). */
106
+ type AiAgentExploreAccessSummary = components['schemas']['AiAgentExploreAccessSummary'];
107
+ /** Request body for explore access summary. */
108
+ interface ExploreAccessSummaryBody {
109
+ tags: string[] | null;
110
+ }
111
+ /** User default agent preferences (GET/POST/DELETE …/preferences). */
112
+ type AiAgentUserPreferences = components['schemas']['AiAgentUserPreferences'];
113
+ /** Query params for agent suggestion chips (GET …/{agentUuid}/suggestions). */
114
+ interface GetAgentSuggestionsParams {
115
+ threadUuid?: string;
116
+ afterMessageUuid?: string;
117
+ enableSqlMode?: boolean;
118
+ }
119
+ /** Discriminated suggestion chip (`kind: 'prompt'` or `kind: 'navigate'`). */
120
+ type AgentSuggestion = components['schemas']['AgentSuggestion'];
121
+ /** Prompt suggestion chip (`kind: 'prompt'`). */
122
+ type AgentSuggestionPromptChip = components['schemas']['AgentSuggestionPromptChip'];
123
+ /** Navigate suggestion chip (`kind: 'navigate'`). */
124
+ type AgentSuggestionNavigateChip = components['schemas']['AgentSuggestionNavigateChip'];
125
+ /** Tool invoked by a prompt suggestion chip. */
126
+ type AgentSuggestionTool = components['schemas']['AgentSuggestionTool'];
127
+ /** @deprecated Use {@link AgentSuggestion}. */
128
+ type AgentSuggestionChip = AgentSuggestion;
129
+ /** Suggestion chips wrapper (inner `results` of suggestions response). */
130
+ type AgentSuggestions = components['schemas']['ApiAgentSuggestionsResponse']['results'];
131
+ /** Title generated for a thread (POST …/threads/{threadUuid}/generate-title). */
132
+ type GenerateThreadTitleResult = components['schemas']['ApiAiAgentThreadGenerateTitleResponse']['results'];
133
+ /** Options for cloning a thread from a prompt (POST …/clone/{promptUuid}). */
134
+ interface CloneThreadBody {
135
+ promptUuid: string;
136
+ createdFrom?: 'evals' | 'web_app';
137
+ }
138
+ /** Verified artifact summary (GET …/verified-artifacts). */
139
+ type AiAgentVerifiedArtifact = components['schemas']['AiAgentVerifiedArtifact'];
140
+ /** Paginated verified artifacts list (`results` of verified-artifacts response). */
141
+ type AiAgentVerifiedArtifactsListResult = components['schemas']['KnexPaginatedData_AiAgentVerifiedArtifact-Array_'];
142
+ /** Query params for listing verified artifacts. */
143
+ interface ListVerifiedArtifactsParams {
144
+ page?: number;
145
+ pageSize?: number;
146
+ }
147
+ /** Verified question entry (GET …/verified-questions). */
148
+ type AiAgentVerifiedQuestion = components['schemas']['ApiAiAgentVerifiedQuestionsResponse']['results'][number];
149
+ /** Full artifact payload (GET …/artifacts/{artifactUuid}). */
150
+ type AiArtifact = components['schemas']['AiArtifactTSOACompat'];
151
+ /** Viz query payload for a thread message or artifact version. */
152
+ type AiAgentThreadMessageVizQuery = components['schemas']['ApiAiAgentThreadMessageVizQuery'];
153
+ /** Request body for PATCH …/messages/{messageUuid}/feedback. */
154
+ interface UpdateMessageFeedbackBody {
155
+ humanScore: number;
156
+ humanFeedback?: string | null;
157
+ }
158
+ /** MCP server auth type. */
159
+ type AiMcpServerAuthType = components['schemas']['AiMcpServerAuthType'];
160
+ /** MCP credential scope. */
161
+ type AiMcpCredentialScope = components['schemas']['AiMcpCredentialScope'];
162
+ /** MCP server connection status. */
163
+ type AiMcpServerConnectionStatus = components['schemas']['AiMcpServerConnectionStatus'];
164
+ /** Project MCP server record. */
165
+ type AiMcpServer = components['schemas']['AiMcpServer'];
166
+ /** MCP tool discovered on a project server. */
167
+ type AiMcpServerTool = components['schemas']['AiMcpServerTool'];
168
+ /** MCP tool with per-agent enablement. */
169
+ type AiAgentMcpServerTool = AiMcpServerTool & {
170
+ enabled: boolean;
171
+ agentUuid: string;
172
+ };
173
+ /** Request body for creating a project MCP server. */
174
+ interface CreateProjectMcpServerBody {
175
+ name: string;
176
+ url: string;
177
+ authType: AiMcpServerAuthType;
178
+ allowOAuthCredentialSharing?: boolean;
179
+ credentialScope?: string | null;
180
+ credentials?: {
181
+ bearerToken: string;
182
+ } | null;
183
+ }
184
+ /** Tool enablement update for an agent MCP server. */
185
+ interface AiAgentMcpServerToolUpdate {
186
+ toolName: string;
187
+ enabled: boolean;
188
+ }
189
+ /** Request body for PATCH …/{agentUuid}/mcpServers/{mcpServerUuid}/tools. */
190
+ interface UpdateAgentMcpServerToolsBody {
191
+ toolSettings: AiAgentMcpServerToolUpdate[];
192
+ }
193
+ /** SQL approval decision. */
194
+ type SqlApprovalDecision = 'approved' | 'rejected';
195
+ /** Request body for POST …/tool-calls/{toolCallId}/sql-approval. */
196
+ interface SubmitSqlApprovalBody {
197
+ decision: SqlApprovalDecision;
198
+ }
199
+ /** SQL approval response (`results` of sql-approval response). */
200
+ interface SubmitSqlApprovalResult {
201
+ decision: SqlApprovalDecision;
202
+ }
94
203
  }
@@ -6,14 +6,16 @@ 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'];
9
- /** Results of GET charts/code (list charts as code). */
9
+ /** Results of GET code/charts (list charts as code). */
10
10
  type ChartAsCodeListResults = components['schemas']['ApiChartAsCodeListResponse']['results'];
11
- /** Results of POST charts/{slug}/code (upsert chart as code). */
11
+ /** Results of POST code/charts/{slug} (upsert chart as code). */
12
12
  type ChartAsCodeUpsertResults = components['schemas']['ApiChartAsCodeUpsertResponse']['results'];
13
- /** Request body for POST charts/{slug}/code (upsert chart as code). */
13
+ /** Request body for POST code/charts/{slug} (upsert chart as code). */
14
14
  type UpsertChartAsCodeBody = components['schemas']['Omit_ChartAsCode.chartConfig-or-description_'] & {
15
15
  description?: string | null;
16
16
  chartConfig: components['schemas']['AnyType'];
17
+ spaceNames?: components['schemas']['Record_string.string_'];
18
+ force?: boolean;
17
19
  publicSpaceCreate?: boolean;
18
20
  skipSpaceCreate?: boolean;
19
21
  };
@@ -6,4 +6,17 @@ 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'];
9
+ /** Results of GET code/dashboards (list dashboards as code). */
10
+ type DashboardAsCodeListResults = components['schemas']['ApiDashboardAsCodeListResponse']['results'];
11
+ /** Results of POST code/dashboards/{slug} (upsert dashboard as code). */
12
+ type DashboardAsCodeUpsertResults = components['schemas']['ApiDashboardAsCodeUpsertResponse']['results'];
13
+ /** Request body for POST code/dashboards/{slug} (upsert dashboard as code). */
14
+ type UpsertDashboardAsCodeBody = components['schemas']['Omit_DashboardAsCode.tiles-or-description_'] & {
15
+ description?: string | null;
16
+ tiles: components['schemas']['AnyType'];
17
+ spaceNames?: components['schemas']['Record_string.string_'];
18
+ force?: boolean;
19
+ publicSpaceCreate?: boolean;
20
+ skipSpaceCreate?: boolean;
21
+ };
9
22
  }
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * V1 API type barrel. Re-exports the same surface as LightdashApi.V1.
3
- * Domain files remain at types/*.ts; see ADR-0008 (file layout follow-up).
3
+ * Domain files remain at types/*.ts; see ADR-0003 (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';
5
+ import type { AiAgents as A } from './ai-agents';
8
6
  import type { Charts as C } from './charts';
9
7
  import type { Dashboards as D } from './dashboards';
10
- import type { Spaces as S } from './spaces';
11
- import type { SpaceAccess as SA } from './space-access';
8
+ import type { Groups as G } from './groups';
9
+ import type { Organizations as O } from './organizations';
12
10
  import type { ProjectAccess as PA } from './project-access';
11
+ import type { Projects as P } from './projects';
12
+ import type { Queries as Q } from './queries';
13
+ import type { SpaceAccess as SA } from './space-access';
14
+ import type { Spaces as S } from './spaces';
13
15
  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;
@@ -42,6 +42,9 @@ export declare namespace V1 {
42
42
  }
43
43
  namespace Dashboards {
44
44
  type DashboardBasicDetailsWithTileTypes = D.DashboardBasicDetailsWithTileTypes;
45
+ type DashboardAsCodeListResults = D.DashboardAsCodeListResults;
46
+ type DashboardAsCodeUpsertResults = D.DashboardAsCodeUpsertResults;
47
+ type UpsertDashboardAsCodeBody = D.UpsertDashboardAsCodeBody;
45
48
  }
46
49
  namespace Spaces {
47
50
  type SpaceSummary = S.SpaceSummary;
@@ -69,6 +72,7 @@ export declare namespace V1 {
69
72
  type ApiOrganizationMemberProfile = U.ApiOrganizationMemberProfile;
70
73
  type ApiOrganizationMemberProfiles = U.ApiOrganizationMemberProfiles;
71
74
  type OrganizationMemberProfileUpdate = U.OrganizationMemberProfileUpdate;
75
+ type AuthenticatedUser = U.AuthenticatedUser;
72
76
  }
73
77
  namespace Groups {
74
78
  type Group = G.Group;
@@ -107,5 +111,38 @@ export declare namespace V1 {
107
111
  type AiAgentEvaluationRunSummary = A.AiAgentEvaluationRunSummary;
108
112
  type AiAgentEvaluationRun = A.AiAgentEvaluationRun;
109
113
  type AiAgentEvaluationRunResult = A.AiAgentEvaluationRunResult;
114
+ type AiModelOption = A.AiModelOption;
115
+ type ReadinessScore = A.ReadinessScore;
116
+ type AiAgentExploreAccessSummary = A.AiAgentExploreAccessSummary;
117
+ type ExploreAccessSummaryBody = A.ExploreAccessSummaryBody;
118
+ type AiAgentUserPreferences = A.AiAgentUserPreferences;
119
+ type GetAgentSuggestionsParams = A.GetAgentSuggestionsParams;
120
+ type AgentSuggestion = A.AgentSuggestion;
121
+ type AgentSuggestionPromptChip = A.AgentSuggestionPromptChip;
122
+ type AgentSuggestionNavigateChip = A.AgentSuggestionNavigateChip;
123
+ type AgentSuggestionTool = A.AgentSuggestionTool;
124
+ type AgentSuggestionChip = A.AgentSuggestionChip;
125
+ type AgentSuggestions = A.AgentSuggestions;
126
+ type GenerateThreadTitleResult = A.GenerateThreadTitleResult;
127
+ type CloneThreadBody = A.CloneThreadBody;
128
+ type AiAgentVerifiedArtifact = A.AiAgentVerifiedArtifact;
129
+ type AiAgentVerifiedArtifactsListResult = A.AiAgentVerifiedArtifactsListResult;
130
+ type ListVerifiedArtifactsParams = A.ListVerifiedArtifactsParams;
131
+ type AiAgentVerifiedQuestion = A.AiAgentVerifiedQuestion;
132
+ type AiArtifact = A.AiArtifact;
133
+ type AiAgentThreadMessageVizQuery = A.AiAgentThreadMessageVizQuery;
134
+ type UpdateMessageFeedbackBody = A.UpdateMessageFeedbackBody;
135
+ type AiMcpServerAuthType = A.AiMcpServerAuthType;
136
+ type AiMcpCredentialScope = A.AiMcpCredentialScope;
137
+ type AiMcpServerConnectionStatus = A.AiMcpServerConnectionStatus;
138
+ type AiMcpServer = A.AiMcpServer;
139
+ type AiMcpServerTool = A.AiMcpServerTool;
140
+ type AiAgentMcpServerTool = A.AiAgentMcpServerTool;
141
+ type CreateProjectMcpServerBody = A.CreateProjectMcpServerBody;
142
+ type AiAgentMcpServerToolUpdate = A.AiAgentMcpServerToolUpdate;
143
+ type UpdateAgentMcpServerToolsBody = A.UpdateAgentMcpServerToolsBody;
144
+ type SqlApprovalDecision = A.SqlApprovalDecision;
145
+ type SubmitSqlApprovalBody = A.SubmitSqlApprovalBody;
146
+ type SubmitSqlApprovalResult = A.SubmitSqlApprovalResult;
110
147
  }
111
148
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
3
  * V1 API type barrel. Re-exports the same surface as LightdashApi.V1.
4
- * Domain files remain at types/*.ts; see ADR-0008 (file layout follow-up).
4
+ * Domain files remain at types/*.ts; see ADR-0003 (file layout follow-up).
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,27 +5,27 @@
5
5
  * Models are type aliases to generated OpenAPI types, ensuring they remain aligned with the spec.
6
6
  * Models are split into domain-specific files for better maintainability.
7
7
  */
8
- import type { Projects } from './projects';
9
- import type { Organizations } from './organizations';
10
- import type { Queries } from './queries';
8
+ import { V2 as V2Namespace } from '../v2/index';
9
+ import { V1 as V1Namespace } from './index';
10
+ import type { AiAgents, AiAgents as AiAgentsTypes } from './ai-agents';
11
11
  import type { Charts } from './charts';
12
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
13
  import type { Explores } from './explores';
20
- import type { Validation } from './validation';
14
+ import type { Groups } from './groups';
21
15
  import type { Metrics } from './metrics';
16
+ import type { Organizations } from './organizations';
17
+ import type { ProjectAccess } from './project-access';
18
+ import type { Projects } from './projects';
19
+ import type { Queries } from './queries';
22
20
  import type { Schedulers } from './schedulers';
21
+ import type { SpaceAccess } from './space-access';
22
+ import type { Spaces } from './spaces';
23
23
  import type { Tags } from './tags';
24
+ import type { Users } from './users';
25
+ import type { Validation } from './validation';
26
+ import type { components } from '../generated/openapi-types';
24
27
  import type { Content } from '../v2/content';
25
28
  export type { Projects, Organizations, Queries, Charts, Dashboards, Spaces, SpaceAccess, Users, Groups, AiAgents, ProjectAccess, Explores, Validation, Metrics, Schedulers, Tags, Content, };
26
- import type { components } from '../generated/openapi-types';
27
- import { V1 as V1Namespace } from './index';
28
- import { V2 as V2Namespace } from '../v2/index';
29
29
  /**
30
30
  * Main namespace for all Lightdash API models.
31
31
  * Provides organized access to all domain models.
@@ -72,12 +72,24 @@ export declare namespace LightdashApi {
72
72
  type UpsertChartAsCodeBody = components['schemas']['Omit_ChartAsCode.chartConfig-or-description_'] & {
73
73
  description?: string | null;
74
74
  chartConfig: components['schemas']['AnyType'];
75
+ spaceNames?: components['schemas']['Record_string.string_'];
76
+ force?: boolean;
75
77
  publicSpaceCreate?: boolean;
76
78
  skipSpaceCreate?: boolean;
77
79
  };
78
80
  }
79
81
  namespace Dashboards {
80
82
  type DashboardBasicDetailsWithTileTypes = components['schemas']['DashboardBasicDetailsWithTileTypes'];
83
+ type DashboardAsCodeListResults = components['schemas']['ApiDashboardAsCodeListResponse']['results'];
84
+ type DashboardAsCodeUpsertResults = components['schemas']['ApiDashboardAsCodeUpsertResponse']['results'];
85
+ type UpsertDashboardAsCodeBody = components['schemas']['Omit_DashboardAsCode.tiles-or-description_'] & {
86
+ description?: string | null;
87
+ tiles: components['schemas']['AnyType'];
88
+ spaceNames?: components['schemas']['Record_string.string_'];
89
+ force?: boolean;
90
+ publicSpaceCreate?: boolean;
91
+ skipSpaceCreate?: boolean;
92
+ };
81
93
  }
82
94
  namespace Spaces {
83
95
  type SpaceSummary = components['schemas']['SpaceSummary'];
@@ -105,6 +117,9 @@ export declare namespace LightdashApi {
105
117
  type ApiOrganizationMemberProfile = components['schemas']['ApiOrganizationMemberProfile'];
106
118
  type ApiOrganizationMemberProfiles = components['schemas']['ApiOrganizationMemberProfiles'];
107
119
  type OrganizationMemberProfileUpdate = components['schemas']['OrganizationMemberProfileUpdate'];
120
+ type AuthenticatedUser = components['schemas']['LightdashUser'] & {
121
+ impersonation: components['schemas']['ImpersonationInfo'] | null;
122
+ };
108
123
  }
109
124
  namespace Groups {
110
125
  type Group = components['schemas']['Group'];
@@ -131,6 +146,8 @@ export declare namespace LightdashApi {
131
146
  type AiAgentThreadSummary = components['schemas']['AiAgentThreadSummary'];
132
147
  type AiAgentThread = components['schemas']['AiAgentThread'];
133
148
  type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
149
+ type CreateAgentThreadMessageBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
150
+ type CreateAgentThreadMessageResult = components['schemas']['ApiAiAgentThreadMessageCreateResponse']['results'];
134
151
  type GenerateAgentThreadBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
135
152
  type GenerateAgentThreadResult = components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
136
153
  type CreateEvaluationPrompt = components['schemas']['CreateEvaluationPrompt'];
@@ -146,6 +163,39 @@ export declare namespace LightdashApi {
146
163
  type AiAgentEvaluationRunResult = components['schemas']['AiAgentEvaluationRunResult'];
147
164
  type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
148
165
  type AssessmentType = components['schemas']['AssessmentType'];
166
+ type AiModelOption = AiAgentsTypes.AiModelOption;
167
+ type ReadinessScore = AiAgentsTypes.ReadinessScore;
168
+ type AiAgentExploreAccessSummary = AiAgentsTypes.AiAgentExploreAccessSummary;
169
+ type ExploreAccessSummaryBody = AiAgentsTypes.ExploreAccessSummaryBody;
170
+ type AiAgentUserPreferences = AiAgentsTypes.AiAgentUserPreferences;
171
+ type GetAgentSuggestionsParams = AiAgentsTypes.GetAgentSuggestionsParams;
172
+ type AgentSuggestion = AiAgentsTypes.AgentSuggestion;
173
+ type AgentSuggestionPromptChip = AiAgentsTypes.AgentSuggestionPromptChip;
174
+ type AgentSuggestionNavigateChip = AiAgentsTypes.AgentSuggestionNavigateChip;
175
+ type AgentSuggestionTool = AiAgentsTypes.AgentSuggestionTool;
176
+ type AgentSuggestionChip = AiAgentsTypes.AgentSuggestionChip;
177
+ type AgentSuggestions = AiAgentsTypes.AgentSuggestions;
178
+ type GenerateThreadTitleResult = AiAgentsTypes.GenerateThreadTitleResult;
179
+ type CloneThreadBody = AiAgentsTypes.CloneThreadBody;
180
+ type AiAgentVerifiedArtifact = AiAgentsTypes.AiAgentVerifiedArtifact;
181
+ type AiAgentVerifiedArtifactsListResult = AiAgentsTypes.AiAgentVerifiedArtifactsListResult;
182
+ type ListVerifiedArtifactsParams = AiAgentsTypes.ListVerifiedArtifactsParams;
183
+ type AiAgentVerifiedQuestion = AiAgentsTypes.AiAgentVerifiedQuestion;
184
+ type AiArtifact = AiAgentsTypes.AiArtifact;
185
+ type AiAgentThreadMessageVizQuery = AiAgentsTypes.AiAgentThreadMessageVizQuery;
186
+ type UpdateMessageFeedbackBody = AiAgentsTypes.UpdateMessageFeedbackBody;
187
+ type AiMcpServerAuthType = AiAgentsTypes.AiMcpServerAuthType;
188
+ type AiMcpCredentialScope = AiAgentsTypes.AiMcpCredentialScope;
189
+ type AiMcpServerConnectionStatus = AiAgentsTypes.AiMcpServerConnectionStatus;
190
+ type AiMcpServer = AiAgentsTypes.AiMcpServer;
191
+ type AiMcpServerTool = AiAgentsTypes.AiMcpServerTool;
192
+ type AiAgentMcpServerTool = AiAgentsTypes.AiAgentMcpServerTool;
193
+ type CreateProjectMcpServerBody = AiAgentsTypes.CreateProjectMcpServerBody;
194
+ type AiAgentMcpServerToolUpdate = AiAgentsTypes.AiAgentMcpServerToolUpdate;
195
+ type UpdateAgentMcpServerToolsBody = AiAgentsTypes.UpdateAgentMcpServerToolsBody;
196
+ type SqlApprovalDecision = AiAgentsTypes.SqlApprovalDecision;
197
+ type SubmitSqlApprovalBody = AiAgentsTypes.SubmitSqlApprovalBody;
198
+ type SubmitSqlApprovalResult = AiAgentsTypes.SubmitSqlApprovalResult;
149
199
  }
150
200
  namespace Explores {
151
201
  type ApiExploresResults = components['schemas']['ApiExploresResults'];
@@ -168,7 +218,7 @@ export declare namespace LightdashApi {
168
218
  pageSize?: number;
169
219
  page?: number;
170
220
  searchQuery?: string;
171
- sortBy?: 'name' | 'createdAt';
221
+ sortBy?: 'createdAt' | 'name';
172
222
  sortDirection?: 'asc' | 'desc';
173
223
  };
174
224
  }
@@ -181,10 +231,12 @@ export declare namespace LightdashApi {
181
231
  }
182
232
  namespace Content {
183
233
  type ApiContentResponse = components['schemas']['ApiContentResponse'];
234
+ type ContentType = components['schemas']['ContentType'];
235
+ type ContentSortByColumns = components['schemas']['ContentSortByColumns'];
184
236
  }
185
- /** Types for Lightdash API v1 endpoints (ADR-0008). */
237
+ /** Types for Lightdash API v1 endpoints (ADR-0003). */
186
238
  export import V1 = V1Namespace;
187
- /** Types for Lightdash API v2 endpoints (ADR-0008). */
239
+ /** Types for Lightdash API v2 endpoints (ADR-0003). */
188
240
  export import V2 = V2Namespace;
189
241
  }
190
242
  export type Project = Projects.Project;
@@ -195,6 +247,9 @@ export type ChartAsCodeListResults = Charts.ChartAsCodeListResults;
195
247
  export type ChartAsCodeUpsertResults = Charts.ChartAsCodeUpsertResults;
196
248
  export type UpsertChartAsCodeBody = Charts.UpsertChartAsCodeBody;
197
249
  export type DashboardBasicDetailsWithTileTypes = Dashboards.DashboardBasicDetailsWithTileTypes;
250
+ export type DashboardAsCodeListResults = Dashboards.DashboardAsCodeListResults;
251
+ export type DashboardAsCodeUpsertResults = Dashboards.DashboardAsCodeUpsertResults;
252
+ export type UpsertDashboardAsCodeBody = Dashboards.UpsertDashboardAsCodeBody;
198
253
  export type SpaceSummary = Spaces.SpaceSummary;
199
254
  export type Space = Spaces.Space;
200
255
  export type CreateSpace = Spaces.CreateSpace;
@@ -209,6 +264,7 @@ export type UpdateProjectMember = ProjectAccess.UpdateProjectMember;
209
264
  export type ProjectGroupAccess = ProjectAccess.ProjectGroupAccess;
210
265
  export type CreateProjectGroupAccessBody = ProjectAccess.CreateProjectGroupAccessBody;
211
266
  export type UpdateProjectGroupAccess = ProjectAccess.UpdateProjectGroupAccess;
267
+ export type AuthenticatedUser = Users.AuthenticatedUser;
212
268
  export type MetricQueryRequest = Queries.Requests.MetricQuery;
213
269
  export type CompileQueryRequest = Queries.Requests.CompileQuery;
214
270
  export type ExecuteAsyncMetricQueryRequestParams = Queries.Requests.ExecuteAsyncMetricQuery;
@@ -234,6 +290,8 @@ export type UpdateAiAgent = AiAgents.UpdateAiAgent;
234
290
  export type AiAgentThreadSummary = AiAgents.AiAgentThreadSummary;
235
291
  export type AiAgentThread = AiAgents.AiAgentThread;
236
292
  export type CreateAgentThreadBody = AiAgents.CreateAgentThreadBody;
293
+ export type CreateAgentThreadMessageBody = AiAgents.CreateAgentThreadMessageBody;
294
+ export type CreateAgentThreadMessageResult = AiAgents.CreateAgentThreadMessageResult;
237
295
  export type GenerateAgentThreadBody = AiAgents.GenerateAgentThreadBody;
238
296
  export type GenerateAgentThreadResult = AiAgents.GenerateAgentThreadResult;
239
297
  export type CreateEvaluationPrompt = AiAgents.CreateEvaluationPrompt;
@@ -247,5 +305,38 @@ export type AiAgentEvaluationRunSummary = AiAgents.AiAgentEvaluationRunSummary;
247
305
  export type AiAgentEvaluationRunsListResponse = AiAgents.AiAgentEvaluationRunsListResponse;
248
306
  export type AiAgentEvaluationRun = AiAgents.AiAgentEvaluationRun;
249
307
  export type AiAgentEvaluationRunResult = AiAgents.AiAgentEvaluationRunResult;
308
+ export type AiModelOption = AiAgents.AiModelOption;
309
+ export type ReadinessScore = AiAgents.ReadinessScore;
310
+ export type AiAgentExploreAccessSummary = AiAgents.AiAgentExploreAccessSummary;
311
+ export type ExploreAccessSummaryBody = AiAgents.ExploreAccessSummaryBody;
312
+ export type AiAgentUserPreferences = AiAgents.AiAgentUserPreferences;
313
+ export type GetAgentSuggestionsParams = AiAgents.GetAgentSuggestionsParams;
314
+ export type AgentSuggestion = AiAgents.AgentSuggestion;
315
+ export type AgentSuggestionPromptChip = AiAgents.AgentSuggestionPromptChip;
316
+ export type AgentSuggestionNavigateChip = AiAgents.AgentSuggestionNavigateChip;
317
+ export type AgentSuggestionTool = AiAgents.AgentSuggestionTool;
318
+ export type AgentSuggestionChip = AiAgents.AgentSuggestionChip;
319
+ export type AgentSuggestions = AiAgents.AgentSuggestions;
320
+ export type GenerateThreadTitleResult = AiAgents.GenerateThreadTitleResult;
321
+ export type CloneThreadBody = AiAgents.CloneThreadBody;
322
+ export type AiAgentVerifiedArtifact = AiAgents.AiAgentVerifiedArtifact;
323
+ export type AiAgentVerifiedArtifactsListResult = AiAgents.AiAgentVerifiedArtifactsListResult;
324
+ export type ListVerifiedArtifactsParams = AiAgents.ListVerifiedArtifactsParams;
325
+ export type AiAgentVerifiedQuestion = AiAgents.AiAgentVerifiedQuestion;
326
+ export type AiArtifact = AiAgents.AiArtifact;
327
+ export type AiAgentThreadMessageVizQuery = AiAgents.AiAgentThreadMessageVizQuery;
328
+ export type UpdateMessageFeedbackBody = AiAgents.UpdateMessageFeedbackBody;
329
+ export type AiMcpServerAuthType = AiAgents.AiMcpServerAuthType;
330
+ export type AiMcpCredentialScope = AiAgents.AiMcpCredentialScope;
331
+ export type AiMcpServerConnectionStatus = AiAgents.AiMcpServerConnectionStatus;
332
+ export type AiMcpServer = AiAgents.AiMcpServer;
333
+ export type AiMcpServerTool = AiAgents.AiMcpServerTool;
334
+ export type AiAgentMcpServerTool = AiAgents.AiAgentMcpServerTool;
335
+ export type CreateProjectMcpServerBody = AiAgents.CreateProjectMcpServerBody;
336
+ export type AiAgentMcpServerToolUpdate = AiAgents.AiAgentMcpServerToolUpdate;
337
+ export type UpdateAgentMcpServerToolsBody = AiAgents.UpdateAgentMcpServerToolsBody;
338
+ export type SqlApprovalDecision = AiAgents.SqlApprovalDecision;
339
+ export type SubmitSqlApprovalBody = AiAgents.SubmitSqlApprovalBody;
340
+ export type SubmitSqlApprovalResult = AiAgents.SubmitSqlApprovalResult;
250
341
  export type ApiExploresResults = Explores.ApiExploresResults;
251
342
  export type ApiExploreResults = Explores.ApiExploreResults;
@@ -14,4 +14,8 @@ export declare namespace Users {
14
14
  type ApiOrganizationMemberProfiles = components['schemas']['ApiOrganizationMemberProfiles'];
15
15
  /** Update payload for organization member (e.g. role). */
16
16
  type OrganizationMemberProfileUpdate = components['schemas']['OrganizationMemberProfileUpdate'];
17
+ /** Currently authenticated Lightdash user (`GET /api/v1/user`). */
18
+ type AuthenticatedUser = components['schemas']['LightdashUser'] & {
19
+ impersonation: components['schemas']['ImpersonationInfo'] | null;
20
+ };
17
21
  }
@@ -1,4 +1,6 @@
1
1
  import type { components } from '../generated/openapi-types';
2
+ /** Runtime values for OpenAPI ContentSortByColumns (MCP Zod + client). */
3
+ export declare const CONTENT_SORT_BY_COLUMNS: readonly ["last_updated_at", "name", "space_name", "views"];
2
4
  export declare namespace Content {
3
5
  type ApiContentResponse = components['schemas']['ApiContentResponse'];
4
6
  type ContentType = components['schemas']['ContentType'];
@@ -1,2 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTENT_SORT_BY_COLUMNS = void 0;
4
+ /** Runtime values for OpenAPI ContentSortByColumns (MCP Zod + client). */
5
+ exports.CONTENT_SORT_BY_COLUMNS = [
6
+ 'last_updated_at',
7
+ 'name',
8
+ 'space_name',
9
+ 'views',
10
+ ];
@@ -1,22 +1,24 @@
1
1
  /**
2
2
  * V2 API type barrel. Re-exports the same surface as LightdashApi.V2.
3
- * Domain files remain at types/*.ts; see ADR-0008 (file layout follow-up).
3
+ * Domain files remain at types/*.ts; see ADR-0003 (file layout follow-up).
4
4
  */
5
- import type { Projects as P } from '../v1/projects';
6
- import type { Organizations as O } from '../v1/organizations';
7
- import type { Queries as Q } from '../v1/queries';
5
+ import type { Content as Con } from './content';
6
+ import type { AiAgents as A } from '../v1/ai-agents';
8
7
  import type { Charts as C } from '../v1/charts';
9
8
  import type { Dashboards as D } from '../v1/dashboards';
10
- import type { Spaces as S } from '../v1/spaces';
11
- import type { SpaceAccess as SA } from '../v1/space-access';
9
+ import type { Groups as G } from '../v1/groups';
10
+ import type { Organizations as O } from '../v1/organizations';
12
11
  import type { ProjectAccess as PA } from '../v1/project-access';
12
+ import type { Projects as P } from '../v1/projects';
13
+ import type { Queries as Q } from '../v1/queries';
14
+ import type { SpaceAccess as SA } from '../v1/space-access';
15
+ import type { Spaces as S } from '../v1/spaces';
13
16
  import type { Users as U } from '../v1/users';
14
- import type { Groups as G } from '../v1/groups';
15
- import type { AiAgents as A } from '../v1/ai-agents';
16
- import type { Content as Con } from './content';
17
17
  export declare namespace V2 {
18
18
  namespace Content {
19
19
  type ApiContentResponse = Con.ApiContentResponse;
20
+ type ContentType = Con.ContentType;
21
+ type ContentSortByColumns = Con.ContentSortByColumns;
20
22
  }
21
23
  namespace Projects {
22
24
  type Project = P.Project;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
3
  * V2 API type barrel. Re-exports the same surface as LightdashApi.V2.
4
- * Domain files remain at types/*.ts; see ADR-0008 (file layout follow-up).
4
+ * Domain files remain at types/*.ts; see ADR-0003 (file layout follow-up).
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,18 +1,31 @@
1
1
  {
2
2
  "name": "@lightdash-tools/common",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared utilities and types for Lightdash AI.",
5
5
  "keywords": [],
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/yu-iskw/lightdash-tools.git",
9
+ "directory": "packages/common"
10
+ },
6
11
  "license": "Apache-2.0",
7
12
  "author": "",
8
13
  "main": "dist/index.js",
9
14
  "types": "dist/index.d.ts",
15
+ "dependencies": {
16
+ "yaml": "^2.9.0",
17
+ "zod": "^4.4.3"
18
+ },
10
19
  "devDependencies": {
11
- "@types/node": "^25.3.4",
20
+ "@types/node": "^25.9.3",
12
21
  "openapi-typescript": "^7.13.0"
13
22
  },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
14
26
  "scripts": {
15
27
  "build": "tsc",
16
- "generate:types": "openapi-typescript https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json -o src/types/generated/openapi-types.ts"
28
+ "generate:operation-registry": "node ../../scripts/generate-operation-registry.mjs",
29
+ "generate:types": "node ../../scripts/openapi-types-url.mjs | xargs -I{} openapi-typescript {} -o src/types/generated/openapi-types.ts && node ../../scripts/fix-openapi-duplicate-operations.mjs && prettier --write src/types/generated/openapi-types.ts"
17
30
  }
18
31
  }