@lightdash-tools/common 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +119 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +9 -0
- package/dist/types/ai-agents.d.ts +38 -0
- package/dist/types/ai-agents.js +6 -0
- package/dist/types/charts.d.ts +20 -0
- package/dist/types/charts.js +6 -0
- package/dist/types/dashboards.d.ts +9 -0
- package/dist/types/dashboards.js +6 -0
- package/dist/types/explores.d.ts +10 -0
- package/dist/types/explores.js +5 -0
- package/dist/types/generated/openapi-types.d.ts +22523 -0
- package/dist/types/generated/openapi-types.js +7 -0
- package/dist/types/groups.d.ts +27 -0
- package/dist/types/groups.js +6 -0
- package/dist/types/lightdash-api.d.ts +337 -0
- package/dist/types/lightdash-api.js +9 -0
- package/dist/types/organizations.d.ts +9 -0
- package/dist/types/organizations.js +6 -0
- package/dist/types/project-access.d.ts +21 -0
- package/dist/types/project-access.js +6 -0
- package/dist/types/projects.d.ts +11 -0
- package/dist/types/projects.js +6 -0
- package/dist/types/queries.d.ts +44 -0
- package/dist/types/queries.js +6 -0
- package/dist/types/space-access.d.ts +13 -0
- package/dist/types/space-access.js +6 -0
- package/dist/types/spaces.d.ts +15 -0
- package/dist/types/spaces.js +6 -0
- package/dist/types/users.d.ts +17 -0
- package/dist/types/users.js +6 -0
- package/dist/types/v1/index.d.ts +93 -0
- package/dist/types/v1/index.js +6 -0
- package/dist/types/v2/index.d.ts +93 -0
- package/dist/types/v2/index.js +6 -0
- package/package.json +17 -0
- package/src/index.test.ts +8 -0
- package/src/index.ts +10 -0
- package/src/types/ai-agents.ts +44 -0
- package/src/types/charts.ts +28 -0
- package/src/types/dashboards.ts +12 -0
- package/src/types/explores.ts +12 -0
- package/src/types/generated/openapi-types.ts +23085 -0
- package/src/types/groups.ts +30 -0
- package/src/types/lightdash-api.ts +439 -0
- package/src/types/organizations.ts +11 -0
- package/src/types/project-access.ts +24 -0
- package/src/types/projects.ts +13 -0
- package/src/types/queries.ts +54 -0
- package/src/types/space-access.ts +15 -0
- package/src/types/spaces.ts +17 -0
- package/src/types/users.ts +22 -0
- package/src/types/v1/index.ts +105 -0
- package/src/types/v2/index.ts +105 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
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).
|
|
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';
|
|
16
|
+
export declare namespace V1 {
|
|
17
|
+
namespace Projects {
|
|
18
|
+
type Project = P.Project;
|
|
19
|
+
type OrganizationProject = P.OrganizationProject;
|
|
20
|
+
}
|
|
21
|
+
namespace Organizations {
|
|
22
|
+
type Organization = O.Organization;
|
|
23
|
+
}
|
|
24
|
+
namespace Queries {
|
|
25
|
+
namespace Requests {
|
|
26
|
+
type MetricQuery = Q.Requests.MetricQuery;
|
|
27
|
+
type ExecuteAsyncMetricQuery = Q.Requests.ExecuteAsyncMetricQuery;
|
|
28
|
+
type ExecuteAsyncSqlQuery = Q.Requests.ExecuteAsyncSqlQuery;
|
|
29
|
+
type ExecuteAsyncSavedChart = Q.Requests.ExecuteAsyncSavedChart;
|
|
30
|
+
type ExecuteAsyncDashboardChart = Q.Requests.ExecuteAsyncDashboardChart;
|
|
31
|
+
type ExecuteAsyncUnderlyingData = Q.Requests.ExecuteAsyncUnderlyingData;
|
|
32
|
+
}
|
|
33
|
+
namespace Responses {
|
|
34
|
+
type RunQueryResults = Q.Responses.RunQueryResults;
|
|
35
|
+
type ExecuteAsyncMetricQueryResults = Q.Responses.ExecuteAsyncMetricQueryResults;
|
|
36
|
+
type ExecuteAsyncDashboardChartResults = Q.Responses.ExecuteAsyncDashboardChartResults;
|
|
37
|
+
type ExecuteAsyncSqlQueryResults = Q.Responses.ExecuteAsyncSqlQueryResults;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
namespace Charts {
|
|
41
|
+
type SpaceQuery = C.SpaceQuery;
|
|
42
|
+
}
|
|
43
|
+
namespace Dashboards {
|
|
44
|
+
type DashboardBasicDetailsWithTileTypes = D.DashboardBasicDetailsWithTileTypes;
|
|
45
|
+
}
|
|
46
|
+
namespace Spaces {
|
|
47
|
+
type SpaceSummary = S.SpaceSummary;
|
|
48
|
+
type Space = S.Space;
|
|
49
|
+
type CreateSpace = S.CreateSpace;
|
|
50
|
+
type UpdateSpace = S.UpdateSpace;
|
|
51
|
+
}
|
|
52
|
+
namespace SpaceAccess {
|
|
53
|
+
type AddSpaceUserAccess = SA.AddSpaceUserAccess;
|
|
54
|
+
type AddSpaceGroupAccess = SA.AddSpaceGroupAccess;
|
|
55
|
+
type SpaceMemberRole = SA.SpaceMemberRole;
|
|
56
|
+
}
|
|
57
|
+
namespace ProjectAccess {
|
|
58
|
+
type ProjectMemberProfile = PA.ProjectMemberProfile;
|
|
59
|
+
type ProjectMemberRole = PA.ProjectMemberRole;
|
|
60
|
+
type CreateProjectMember = PA.CreateProjectMember;
|
|
61
|
+
type UpdateProjectMember = PA.UpdateProjectMember;
|
|
62
|
+
type ProjectGroupAccess = PA.ProjectGroupAccess;
|
|
63
|
+
type CreateProjectGroupAccessBody = PA.CreateProjectGroupAccessBody;
|
|
64
|
+
type UpdateProjectGroupAccess = PA.UpdateProjectGroupAccess;
|
|
65
|
+
}
|
|
66
|
+
namespace Users {
|
|
67
|
+
type OrganizationMemberProfile = U.OrganizationMemberProfile;
|
|
68
|
+
type OrganizationMemberProfilesResult = U.OrganizationMemberProfilesResult;
|
|
69
|
+
type ApiOrganizationMemberProfile = U.ApiOrganizationMemberProfile;
|
|
70
|
+
type ApiOrganizationMemberProfiles = U.ApiOrganizationMemberProfiles;
|
|
71
|
+
type OrganizationMemberProfileUpdate = U.OrganizationMemberProfileUpdate;
|
|
72
|
+
}
|
|
73
|
+
namespace Groups {
|
|
74
|
+
type Group = G.Group;
|
|
75
|
+
type GroupWithMembers = G.GroupWithMembers;
|
|
76
|
+
type CreateGroup = G.CreateGroup;
|
|
77
|
+
type UpdateGroupWithMembers = G.UpdateGroupWithMembers;
|
|
78
|
+
type GroupListResult = G.GroupListResult;
|
|
79
|
+
type ApiGroupResponse = G.ApiGroupResponse;
|
|
80
|
+
type ApiGroupListResponse = G.ApiGroupListResponse;
|
|
81
|
+
type ApiCreateGroupResponse = G.ApiCreateGroupResponse;
|
|
82
|
+
type ApiGroupMembersResponse = G.ApiGroupMembersResponse;
|
|
83
|
+
type GroupMember = G.GroupMember;
|
|
84
|
+
}
|
|
85
|
+
namespace AiAgents {
|
|
86
|
+
type AiAgentSummary = A.AiAgentSummary;
|
|
87
|
+
type AiAgentAdminSortField = A.AiAgentAdminSortField;
|
|
88
|
+
type AdminThreadsResult = A.AdminThreadsResult;
|
|
89
|
+
type GetAiOrganizationSettingsResult = A.GetAiOrganizationSettingsResult;
|
|
90
|
+
type UpdateAiOrganizationSettings = A.UpdateAiOrganizationSettings;
|
|
91
|
+
type UpdateAiOrganizationSettingsResult = A.UpdateAiOrganizationSettingsResult;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
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).
|
|
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';
|
|
16
|
+
export declare namespace V2 {
|
|
17
|
+
namespace Projects {
|
|
18
|
+
type Project = P.Project;
|
|
19
|
+
type OrganizationProject = P.OrganizationProject;
|
|
20
|
+
}
|
|
21
|
+
namespace Organizations {
|
|
22
|
+
type Organization = O.Organization;
|
|
23
|
+
}
|
|
24
|
+
namespace Queries {
|
|
25
|
+
namespace Requests {
|
|
26
|
+
type MetricQuery = Q.Requests.MetricQuery;
|
|
27
|
+
type ExecuteAsyncMetricQuery = Q.Requests.ExecuteAsyncMetricQuery;
|
|
28
|
+
type ExecuteAsyncSqlQuery = Q.Requests.ExecuteAsyncSqlQuery;
|
|
29
|
+
type ExecuteAsyncSavedChart = Q.Requests.ExecuteAsyncSavedChart;
|
|
30
|
+
type ExecuteAsyncDashboardChart = Q.Requests.ExecuteAsyncDashboardChart;
|
|
31
|
+
type ExecuteAsyncUnderlyingData = Q.Requests.ExecuteAsyncUnderlyingData;
|
|
32
|
+
}
|
|
33
|
+
namespace Responses {
|
|
34
|
+
type RunQueryResults = Q.Responses.RunQueryResults;
|
|
35
|
+
type ExecuteAsyncMetricQueryResults = Q.Responses.ExecuteAsyncMetricQueryResults;
|
|
36
|
+
type ExecuteAsyncDashboardChartResults = Q.Responses.ExecuteAsyncDashboardChartResults;
|
|
37
|
+
type ExecuteAsyncSqlQueryResults = Q.Responses.ExecuteAsyncSqlQueryResults;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
namespace Charts {
|
|
41
|
+
type SpaceQuery = C.SpaceQuery;
|
|
42
|
+
}
|
|
43
|
+
namespace Dashboards {
|
|
44
|
+
type DashboardBasicDetailsWithTileTypes = D.DashboardBasicDetailsWithTileTypes;
|
|
45
|
+
}
|
|
46
|
+
namespace Spaces {
|
|
47
|
+
type SpaceSummary = S.SpaceSummary;
|
|
48
|
+
type Space = S.Space;
|
|
49
|
+
type CreateSpace = S.CreateSpace;
|
|
50
|
+
type UpdateSpace = S.UpdateSpace;
|
|
51
|
+
}
|
|
52
|
+
namespace SpaceAccess {
|
|
53
|
+
type AddSpaceUserAccess = SA.AddSpaceUserAccess;
|
|
54
|
+
type AddSpaceGroupAccess = SA.AddSpaceGroupAccess;
|
|
55
|
+
type SpaceMemberRole = SA.SpaceMemberRole;
|
|
56
|
+
}
|
|
57
|
+
namespace ProjectAccess {
|
|
58
|
+
type ProjectMemberProfile = PA.ProjectMemberProfile;
|
|
59
|
+
type ProjectMemberRole = PA.ProjectMemberRole;
|
|
60
|
+
type CreateProjectMember = PA.CreateProjectMember;
|
|
61
|
+
type UpdateProjectMember = PA.UpdateProjectMember;
|
|
62
|
+
type ProjectGroupAccess = PA.ProjectGroupAccess;
|
|
63
|
+
type CreateProjectGroupAccessBody = PA.CreateProjectGroupAccessBody;
|
|
64
|
+
type UpdateProjectGroupAccess = PA.UpdateProjectGroupAccess;
|
|
65
|
+
}
|
|
66
|
+
namespace Users {
|
|
67
|
+
type OrganizationMemberProfile = U.OrganizationMemberProfile;
|
|
68
|
+
type OrganizationMemberProfilesResult = U.OrganizationMemberProfilesResult;
|
|
69
|
+
type ApiOrganizationMemberProfile = U.ApiOrganizationMemberProfile;
|
|
70
|
+
type ApiOrganizationMemberProfiles = U.ApiOrganizationMemberProfiles;
|
|
71
|
+
type OrganizationMemberProfileUpdate = U.OrganizationMemberProfileUpdate;
|
|
72
|
+
}
|
|
73
|
+
namespace Groups {
|
|
74
|
+
type Group = G.Group;
|
|
75
|
+
type GroupWithMembers = G.GroupWithMembers;
|
|
76
|
+
type CreateGroup = G.CreateGroup;
|
|
77
|
+
type UpdateGroupWithMembers = G.UpdateGroupWithMembers;
|
|
78
|
+
type GroupListResult = G.GroupListResult;
|
|
79
|
+
type ApiGroupResponse = G.ApiGroupResponse;
|
|
80
|
+
type ApiGroupListResponse = G.ApiGroupListResponse;
|
|
81
|
+
type ApiCreateGroupResponse = G.ApiCreateGroupResponse;
|
|
82
|
+
type ApiGroupMembersResponse = G.ApiGroupMembersResponse;
|
|
83
|
+
type GroupMember = G.GroupMember;
|
|
84
|
+
}
|
|
85
|
+
namespace AiAgents {
|
|
86
|
+
type AiAgentSummary = A.AiAgentSummary;
|
|
87
|
+
type AiAgentAdminSortField = A.AiAgentAdminSortField;
|
|
88
|
+
type AdminThreadsResult = A.AdminThreadsResult;
|
|
89
|
+
type GetAiOrganizationSettingsResult = A.GetAiOrganizationSettingsResult;
|
|
90
|
+
type UpdateAiOrganizationSettings = A.UpdateAiOrganizationSettings;
|
|
91
|
+
type UpdateAiOrganizationSettingsResult = A.UpdateAiOrganizationSettingsResult;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lightdash-tools/common",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared utilities and types for Lightdash AI.",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"author": "",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"openapi-typescript": "^7.12.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"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"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function greet(name: string): string {
|
|
2
|
+
return `Hello, ${name}!`;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// Export Lightdash API models
|
|
6
|
+
export * from './types/lightdash-api';
|
|
7
|
+
export type { LightdashApi } from './types/lightdash-api';
|
|
8
|
+
|
|
9
|
+
// Export raw OpenAPI types for direct use (e.g., by client package)
|
|
10
|
+
export type { paths, components, operations } from './types/generated/openapi-types';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI agents domain models.
|
|
3
|
+
* Extracted from OpenAPI specification for better maintainability.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { components } from './generated/openapi-types';
|
|
7
|
+
|
|
8
|
+
export namespace AiAgents {
|
|
9
|
+
/** Summary of an AI agent (admin list). */
|
|
10
|
+
export type AiAgentSummary = components['schemas']['AiAgentSummary'];
|
|
11
|
+
/** Sort field for admin thread list. */
|
|
12
|
+
export type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
|
|
13
|
+
/** Paginated result for admin threads (API response results). */
|
|
14
|
+
export type AdminThreadsResult =
|
|
15
|
+
components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
|
|
16
|
+
/** Query params for listing admin threads (getAllThreads). */
|
|
17
|
+
export interface GetAdminThreadsParams {
|
|
18
|
+
page?: number;
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
projectUuids?: string[];
|
|
21
|
+
agentUuids?: string[];
|
|
22
|
+
userUuids?: string[];
|
|
23
|
+
createdFrom?: 'slack' | 'web_app';
|
|
24
|
+
humanScore?: number;
|
|
25
|
+
dateFrom?: string;
|
|
26
|
+
dateTo?: string;
|
|
27
|
+
search?: string;
|
|
28
|
+
sortField?: components['schemas']['AiAgentAdminSortField'];
|
|
29
|
+
sortDirection?: 'asc' | 'desc';
|
|
30
|
+
}
|
|
31
|
+
/** AI organization settings (get response). */
|
|
32
|
+
export type AiOrganizationSettings = components['schemas']['AiOrganizationSettings'];
|
|
33
|
+
/** Computed AI org settings (included in get response). */
|
|
34
|
+
export type ComputedAiOrganizationSettings =
|
|
35
|
+
components['schemas']['ComputedAiOrganizationSettings'];
|
|
36
|
+
/** Get AI org settings response results (settings + computed). */
|
|
37
|
+
export type GetAiOrganizationSettingsResult =
|
|
38
|
+
components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
|
|
39
|
+
/** Update AI org settings request body. */
|
|
40
|
+
export type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
|
|
41
|
+
/** Update AI org settings response results. */
|
|
42
|
+
export type UpdateAiOrganizationSettingsResult =
|
|
43
|
+
components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charts domain models.
|
|
3
|
+
* Extracted from OpenAPI specification for better maintainability.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { components } from './generated/openapi-types';
|
|
7
|
+
|
|
8
|
+
export namespace Charts {
|
|
9
|
+
/** Space query (chart listing item). */
|
|
10
|
+
export type SpaceQuery = components['schemas']['SpaceQuery'];
|
|
11
|
+
|
|
12
|
+
/** Results of GET charts/code (list charts as code). */
|
|
13
|
+
export type ChartAsCodeListResults =
|
|
14
|
+
components['schemas']['ApiChartAsCodeListResponse']['results'];
|
|
15
|
+
|
|
16
|
+
/** Results of POST charts/{slug}/code (upsert chart as code). */
|
|
17
|
+
export type ChartAsCodeUpsertResults =
|
|
18
|
+
components['schemas']['ApiChartAsCodeUpsertResponse']['results'];
|
|
19
|
+
|
|
20
|
+
/** Request body for POST charts/{slug}/code (upsert chart as code). */
|
|
21
|
+
export type UpsertChartAsCodeBody =
|
|
22
|
+
components['schemas']['Omit_ChartAsCode.chartConfig-or-description_'] & {
|
|
23
|
+
description?: string | null;
|
|
24
|
+
chartConfig: components['schemas']['AnyType'];
|
|
25
|
+
publicSpaceCreate?: boolean;
|
|
26
|
+
skipSpaceCreate?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboards domain models.
|
|
3
|
+
* Extracted from OpenAPI specification for better maintainability.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { components } from './generated/openapi-types';
|
|
7
|
+
|
|
8
|
+
export namespace Dashboards {
|
|
9
|
+
/** Dashboard basic details with tile types. */
|
|
10
|
+
export type DashboardBasicDetailsWithTileTypes =
|
|
11
|
+
components['schemas']['DashboardBasicDetailsWithTileTypes'];
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explores domain models (list and get response types from the Lightdash v1 API).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { components } from './generated/openapi-types';
|
|
6
|
+
|
|
7
|
+
export namespace Explores {
|
|
8
|
+
/** List explores response (array of summary explore). */
|
|
9
|
+
export type ApiExploresResults = components['schemas']['ApiExploresResults'];
|
|
10
|
+
/** Get single explore response (full explore). */
|
|
11
|
+
export type ApiExploreResults = components['schemas']['ApiExploreResults'];
|
|
12
|
+
}
|