@lightdash/common 0.1460.0 → 0.1461.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/dist/authorization/organizationMemberAbility.js +6 -0
- package/dist/authorization/projectMemberAbility.js +6 -0
- package/dist/authorization/types.d.ts +1 -1
- package/dist/compiler/translator.js +18 -4
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -0
- package/dist/types/api/spotlight.d.ts +5 -0
- package/dist/types/api/spotlight.js +2 -0
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/errors.js +3 -1
- package/dist/types/explore.d.ts +3 -0
- package/dist/types/spotlightTableConfig.d.ts +18 -0
- package/dist/types/spotlightTableConfig.js +19 -0
- package/dist/utils/item.d.ts +3 -0
- package/package.json +1 -1
@@ -70,6 +70,9 @@ const applyOrganizationMemberStaticAbilities = {
|
|
70
70
|
can('view', 'MetricsTree', {
|
71
71
|
organizationUuid: member.organizationUuid,
|
72
72
|
});
|
73
|
+
can('view', 'SpotlightTableConfig', {
|
74
|
+
organizationUuid: member.organizationUuid,
|
75
|
+
});
|
73
76
|
},
|
74
77
|
interactive_viewer(member, { can }) {
|
75
78
|
applyOrganizationMemberStaticAbilities.viewer(member, { can });
|
@@ -225,6 +228,9 @@ const applyOrganizationMemberStaticAbilities = {
|
|
225
228
|
organizationUuid: member.organizationUuid,
|
226
229
|
type: projects_1.ProjectType.PREVIEW,
|
227
230
|
});
|
231
|
+
can('manage', 'SpotlightTableConfig', {
|
232
|
+
organizationUuid: member.organizationUuid,
|
233
|
+
});
|
228
234
|
},
|
229
235
|
admin(member, { can }) {
|
230
236
|
applyOrganizationMemberStaticAbilities.developer(member, { can });
|
@@ -54,6 +54,9 @@ exports.projectMemberAbilities = {
|
|
54
54
|
can('view', 'MetricsTree', {
|
55
55
|
projectUuid: member.projectUuid,
|
56
56
|
});
|
57
|
+
can('view', 'SpotlightTableConfig', {
|
58
|
+
projectUuid: member.projectUuid,
|
59
|
+
});
|
57
60
|
},
|
58
61
|
interactive_viewer(member, { can }) {
|
59
62
|
exports.projectMemberAbilities.viewer(member, { can });
|
@@ -205,6 +208,9 @@ exports.projectMemberAbilities = {
|
|
205
208
|
upstreamProjectUuid: member.projectUuid,
|
206
209
|
type: projects_1.ProjectType.PREVIEW,
|
207
210
|
});
|
211
|
+
can('manage', 'SpotlightTableConfig', {
|
212
|
+
projectUuid: member.projectUuid,
|
213
|
+
});
|
208
214
|
},
|
209
215
|
admin(member, { can }) {
|
210
216
|
exports.projectMemberAbilities.developer(member, { can });
|
@@ -8,7 +8,7 @@ interface Project {
|
|
8
8
|
interface Organization {
|
9
9
|
organizationUuid: string;
|
10
10
|
}
|
11
|
-
type Subject = Project | Organization | OrganizationMemberProfile | 'Project' | 'Organization' | 'OrganizationMemberProfile' | 'Dashboard' | 'Space' | 'SavedChart' | 'InviteLink' | 'Job' | 'SqlRunner' | 'Analytics' | 'Explore' | 'UnderlyingData' | 'ExportCsv' | 'CsvJobResult' | 'PinnedItems' | 'Validation' | 'Group' | 'ChangeCsvResults' | 'ScheduledDeliveries' | 'DashboardComments' | 'CustomSql' | 'CompileProject' | 'SemanticViewer' | 'VirtualView' | 'Tags' | 'PersonalAccessToken' | 'MetricsTree' | 'all';
|
11
|
+
type Subject = Project | Organization | OrganizationMemberProfile | 'Project' | 'Organization' | 'OrganizationMemberProfile' | 'Dashboard' | 'Space' | 'SavedChart' | 'InviteLink' | 'Job' | 'SqlRunner' | 'Analytics' | 'Explore' | 'UnderlyingData' | 'ExportCsv' | 'CsvJobResult' | 'PinnedItems' | 'Validation' | 'Group' | 'ChangeCsvResults' | 'ScheduledDeliveries' | 'DashboardComments' | 'CustomSql' | 'CompileProject' | 'SemanticViewer' | 'VirtualView' | 'Tags' | 'PersonalAccessToken' | 'MetricsTree' | 'SpotlightTableConfig' | 'all';
|
12
12
|
type PossibleAbilities = [
|
13
13
|
AbilityAction,
|
14
14
|
Subject | ForcedSubject<Exclude<Subject, 'all'>>
|
@@ -4,6 +4,7 @@ exports.getSchemaStructureFromDbtModels = exports.attachTypesToModels = exports.
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const dbt_1 = require("../types/dbt");
|
6
6
|
const errors_1 = require("../types/errors");
|
7
|
+
const explore_1 = require("../types/explore");
|
7
8
|
const field_1 = require("../types/field");
|
8
9
|
const filterGrammar_1 = require("../types/filterGrammar");
|
9
10
|
const table_1 = require("../types/table");
|
@@ -401,9 +402,12 @@ const convertExplores = async (models, loadSources, adapterType, metrics, wareho
|
|
401
402
|
groupLabel: meta.group_label,
|
402
403
|
errors: [
|
403
404
|
{
|
404
|
-
type: e.
|
405
|
-
|
406
|
-
|
405
|
+
type: e instanceof errors_1.ParseError
|
406
|
+
? explore_1.InlineErrorType.METADATA_PARSE_ERROR
|
407
|
+
: explore_1.InlineErrorType.NO_DIMENSIONS_FOUND,
|
408
|
+
message: e instanceof Error
|
409
|
+
? e.message
|
410
|
+
: `Could not convert dbt model: "${model.name}" in to a Lightdash explore`,
|
407
411
|
},
|
408
412
|
],
|
409
413
|
};
|
@@ -444,7 +448,17 @@ const convertExplores = async (models, loadSources, adapterType, metrics, wareho
|
|
444
448
|
name: model.name,
|
445
449
|
label: meta.label || (0, field_1.friendlyName)(model.name),
|
446
450
|
groupLabel: meta.group_label,
|
447
|
-
errors: [
|
451
|
+
errors: [
|
452
|
+
{
|
453
|
+
// TODO improve parsing of error type
|
454
|
+
type: e instanceof errors_1.ParseError
|
455
|
+
? explore_1.InlineErrorType.METADATA_PARSE_ERROR
|
456
|
+
: explore_1.InlineErrorType.NO_DIMENSIONS_FOUND,
|
457
|
+
message: e instanceof Error
|
458
|
+
? e.message
|
459
|
+
: `Could not convert dbt model: "${model.name}" is not a valid model`,
|
460
|
+
},
|
461
|
+
],
|
448
462
|
};
|
449
463
|
}
|
450
464
|
});
|
package/dist/index.d.ts
CHANGED
@@ -45,6 +45,7 @@ import { type ApiPromotionChangesResponse } from './types/promotion';
|
|
45
45
|
import { type ApiSemanticLayerClientInfo, type ApiSemanticViewerChartCreate, type ApiSemanticViewerChartGet, type ApiSemanticViewerChartUpdate } from './types/semanticLayer';
|
46
46
|
import { type ApiCreateSqlChart, type ApiCreateVirtualView, type ApiGithubDbtWritePreview, type ApiSqlChart, type ApiSqlRunnerJobStatusResponse, type ApiUpdateSqlChart } from './types/sqlRunner';
|
47
47
|
import { type ApiWarehouseTableFields } from './types/warehouse';
|
48
|
+
import { type ApiGetSpotlightTableConfig } from './types/api/spotlight';
|
48
49
|
export * from './authorization/index';
|
49
50
|
export * from './authorization/types';
|
50
51
|
export * from './compiler/exploreCompiler';
|
@@ -63,6 +64,7 @@ export * from './types/api/share';
|
|
63
64
|
export * from './types/api/sort';
|
64
65
|
export * from './types/api/success';
|
65
66
|
export * from './types/api/uuid';
|
67
|
+
export * from './types/api/spotlight';
|
66
68
|
export * from './types/catalog';
|
67
69
|
export * from './types/coder';
|
68
70
|
export * from './types/comments';
|
@@ -149,6 +151,7 @@ export * from './visualizations/PieChartDataModel';
|
|
149
151
|
export * from './visualizations/TableDataModel';
|
150
152
|
export * from './visualizations/types';
|
151
153
|
export * from './visualizations/types/IResultsRunner';
|
154
|
+
export * from './types/spotlightTableConfig';
|
152
155
|
export declare const validateEmail: (email: string) => boolean;
|
153
156
|
export declare const getEmailSchema: () => z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
154
157
|
export declare const getPasswordSchema: () => z.ZodString;
|
@@ -292,7 +295,7 @@ export type UpdateMetadata = {
|
|
292
295
|
};
|
293
296
|
export type ApiCompiledQueryResults = string;
|
294
297
|
export type ApiExploresResults = SummaryExplore[];
|
295
|
-
export type ApiExploreResults = Explore
|
298
|
+
export type ApiExploreResults = Omit<Explore, 'unfilteredTables'>;
|
296
299
|
export type ApiStatusResults = 'loading' | 'ready' | 'error';
|
297
300
|
export type ApiRefreshResults = {
|
298
301
|
jobUuid: string;
|
@@ -382,7 +385,7 @@ export type ApiAiGetDashboardSummaryResponse = {
|
|
382
385
|
status: 'ok';
|
383
386
|
results: DashboardSummary;
|
384
387
|
};
|
385
|
-
type ApiResults = ApiQueryResults | ApiSqlQueryResults | ApiCompiledQueryResults | ApiExploresResults | ApiExploreResults | ApiStatusResults | ApiRefreshResults | ApiHealthResults | Organization | LightdashUser | LoginOptions | SavedChart | SavedChart[] | Space[] | InviteLink | OrganizationProject[] | Project | WarehouseCredentials | OrganizationMemberProfile[] | ProjectCatalog | TablesConfiguration | Dashboard | DashboardBasicDetails[] | OnboardingStatus | Dashboard[] | DeleteOpenIdentity | ApiFlashResults | Record<OpenIdIdentitySummary['issuerType'], OpenIdIdentitySummary[]> | FilterableField[] | DashboardAvailableFilters | ProjectSavedChartStatus | null | Array<unknown> | ApiJobStartedResults | ApiCreateUserTokenResults | CreatePersonalAccessToken | PersonalAccessToken | ProjectMemberProfile[] | ProjectGroupAccess | SearchResults | Space | ShareUrl | SlackSettings | ApiSlackChannelsResponse['results'] | UserActivity | SchedulerAndTargets | SchedulerAndTargets[] | FieldValueSearchResult | ApiDownloadCsv | AllowedEmailDomains | UpdateAllowedEmailDomains | UserAllowedOrganization[] | EmailStatusExpiring | ApiScheduledDownloadCsv | PinnedItems | ViewStatistics | SchedulerWithLogs | ValidationResponse[] | ChartHistory | ChartVersion | Array<GitRepo> | PullRequestCreated | GitIntegrationConfiguration | UserWarehouseCredentials | ApiJobStatusResponse['results'] | ApiJobScheduledResponse['results'] | ApiSshKeyPairResponse['results'] | MostPopularAndRecentlyUpdated | ApiCalculateTotalResponse['results'] | Record<string, DbtExposure> | ApiCreateComment['results'] | ApiGetComments['results'] | ApiDeleteComment | ApiSuccessEmpty | ApiCreateProjectResults | ApiAiDashboardSummaryResponse['results'] | ApiAiGetDashboardSummaryResponse['results'] | ApiCatalogMetadataResults | ApiCatalogAnalyticsResults | ApiPromotionChangesResponse['results'] | ApiWarehouseTableFields['results'] | ApiTogglePinnedItem['results'] | ApiOrganizationMemberProfiles['results'] | ApiSqlChart['results'] | ApiCreateSqlChart['results'] | ApiUpdateSqlChart['results'] | ApiContentResponse['results'] | ApiChartContentResponse['results'] | ApiSqlRunnerJobStatusResponse['results'] | ApiSemanticLayerClientInfo['results'] | ApiSemanticViewerChartCreate['results'] | ApiSemanticViewerChartGet['results'] | ApiSemanticViewerChartUpdate['results'] | ApiCreateVirtualView['results'] | ApiGithubDbtWritePreview['results'] | ApiMetricsCatalog['results'] | ApiMetricsExplorerQueryResults['results'] | ApiGroupListResponse['results'] | ApiCreateTagResponse['results'] | ApiChartAsCodeListResponse['results'] | ApiDashboardAsCodeListResponse['results'] | ApiChartAsCodeUpsertResponse['results'] | ApiGetMetricsTree['results'] | ApiMetricsExplorerTotalResults['results'];
|
388
|
+
type ApiResults = ApiQueryResults | ApiSqlQueryResults | ApiCompiledQueryResults | ApiExploresResults | ApiExploreResults | ApiStatusResults | ApiRefreshResults | ApiHealthResults | Organization | LightdashUser | LoginOptions | SavedChart | SavedChart[] | Space[] | InviteLink | OrganizationProject[] | Project | WarehouseCredentials | OrganizationMemberProfile[] | ProjectCatalog | TablesConfiguration | Dashboard | DashboardBasicDetails[] | OnboardingStatus | Dashboard[] | DeleteOpenIdentity | ApiFlashResults | Record<OpenIdIdentitySummary['issuerType'], OpenIdIdentitySummary[]> | FilterableField[] | DashboardAvailableFilters | ProjectSavedChartStatus | null | Array<unknown> | ApiJobStartedResults | ApiCreateUserTokenResults | CreatePersonalAccessToken | PersonalAccessToken | ProjectMemberProfile[] | ProjectGroupAccess | SearchResults | Space | ShareUrl | SlackSettings | ApiSlackChannelsResponse['results'] | UserActivity | SchedulerAndTargets | SchedulerAndTargets[] | FieldValueSearchResult | ApiDownloadCsv | AllowedEmailDomains | UpdateAllowedEmailDomains | UserAllowedOrganization[] | EmailStatusExpiring | ApiScheduledDownloadCsv | PinnedItems | ViewStatistics | SchedulerWithLogs | ValidationResponse[] | ChartHistory | ChartVersion | Array<GitRepo> | PullRequestCreated | GitIntegrationConfiguration | UserWarehouseCredentials | ApiJobStatusResponse['results'] | ApiJobScheduledResponse['results'] | ApiSshKeyPairResponse['results'] | MostPopularAndRecentlyUpdated | ApiCalculateTotalResponse['results'] | Record<string, DbtExposure> | ApiCreateComment['results'] | ApiGetComments['results'] | ApiDeleteComment | ApiSuccessEmpty | ApiCreateProjectResults | ApiAiDashboardSummaryResponse['results'] | ApiAiGetDashboardSummaryResponse['results'] | ApiCatalogMetadataResults | ApiCatalogAnalyticsResults | ApiPromotionChangesResponse['results'] | ApiWarehouseTableFields['results'] | ApiTogglePinnedItem['results'] | ApiOrganizationMemberProfiles['results'] | ApiSqlChart['results'] | ApiCreateSqlChart['results'] | ApiUpdateSqlChart['results'] | ApiContentResponse['results'] | ApiChartContentResponse['results'] | ApiSqlRunnerJobStatusResponse['results'] | ApiSemanticLayerClientInfo['results'] | ApiSemanticViewerChartCreate['results'] | ApiSemanticViewerChartGet['results'] | ApiSemanticViewerChartUpdate['results'] | ApiCreateVirtualView['results'] | ApiGithubDbtWritePreview['results'] | ApiMetricsCatalog['results'] | ApiMetricsExplorerQueryResults['results'] | ApiGroupListResponse['results'] | ApiCreateTagResponse['results'] | ApiChartAsCodeListResponse['results'] | ApiDashboardAsCodeListResponse['results'] | ApiChartAsCodeUpsertResponse['results'] | ApiGetMetricsTree['results'] | ApiMetricsExplorerTotalResults['results'] | ApiGetSpotlightTableConfig['results'];
|
386
389
|
export type ApiResponse<T extends ApiResults = ApiResults> = {
|
387
390
|
status: 'ok';
|
388
391
|
results: T;
|
package/dist/index.js
CHANGED
@@ -32,6 +32,7 @@ tslib_1.__exportStar(require("./types/api/share"), exports);
|
|
32
32
|
tslib_1.__exportStar(require("./types/api/sort"), exports);
|
33
33
|
tslib_1.__exportStar(require("./types/api/success"), exports);
|
34
34
|
tslib_1.__exportStar(require("./types/api/uuid"), exports);
|
35
|
+
tslib_1.__exportStar(require("./types/api/spotlight"), exports);
|
35
36
|
tslib_1.__exportStar(require("./types/catalog"), exports);
|
36
37
|
tslib_1.__exportStar(require("./types/coder"), exports);
|
37
38
|
tslib_1.__exportStar(require("./types/comments"), exports);
|
@@ -119,6 +120,7 @@ tslib_1.__exportStar(require("./visualizations/PieChartDataModel"), exports);
|
|
119
120
|
tslib_1.__exportStar(require("./visualizations/TableDataModel"), exports);
|
120
121
|
tslib_1.__exportStar(require("./visualizations/types"), exports);
|
121
122
|
tslib_1.__exportStar(require("./visualizations/types/IResultsRunner"), exports);
|
123
|
+
tslib_1.__exportStar(require("./types/spotlightTableConfig"), exports);
|
122
124
|
const validateEmail = (email) => {
|
123
125
|
if (/\s/.test(email)) {
|
124
126
|
return false;
|
package/dist/types/errors.d.ts
CHANGED
package/dist/types/errors.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.UnexpectedGoogleSheetsError = exports.SlackInstallationNotFoundError = exports.KnexPaginationError = exports.NotEnoughResults = exports.MissingConfigError = exports.AlreadyExistsError = exports.AlreadyProcessingError = exports.SmptError = exports.WarehouseQueryError = exports.WarehouseConnectionError = exports.InvalidUser = exports.NotFoundError = exports.DbtError = exports.FieldReferenceError = exports.CompileError = exports.ParseError = exports.UnexpectedDatabaseError = exports.UnexpectedGitError = exports.UnexpectedServerError = exports.MissingWarehouseCredentialsError = exports.MissingCatalogEntryError = exports.NonCompiledModelError = exports.ParameterError = exports.ExpiredError = exports.NotExistsError = exports.AuthorizationError = exports.DeactivatedAccountError = exports.ForbiddenError = exports.LightdashError = void 0;
|
3
|
+
exports.getErrorMessage = exports.UnexpectedGoogleSheetsError = exports.SlackInstallationNotFoundError = exports.KnexPaginationError = exports.NotEnoughResults = exports.MissingConfigError = exports.AlreadyExistsError = exports.AlreadyProcessingError = exports.SmptError = exports.WarehouseQueryError = exports.WarehouseConnectionError = exports.InvalidUser = exports.NotFoundError = exports.DbtError = exports.FieldReferenceError = exports.CompileError = exports.ParseError = exports.UnexpectedDatabaseError = exports.UnexpectedGitError = exports.UnexpectedServerError = exports.MissingWarehouseCredentialsError = exports.MissingCatalogEntryError = exports.NonCompiledModelError = exports.ParameterError = exports.ExpiredError = exports.NotExistsError = exports.AuthorizationError = exports.DeactivatedAccountError = exports.ForbiddenError = exports.LightdashError = void 0;
|
4
4
|
class LightdashError extends Error {
|
5
5
|
constructor({ message, name, statusCode, data }) {
|
6
6
|
super(message);
|
@@ -319,3 +319,5 @@ class UnexpectedGoogleSheetsError extends LightdashError {
|
|
319
319
|
}
|
320
320
|
}
|
321
321
|
exports.UnexpectedGoogleSheetsError = UnexpectedGoogleSheetsError;
|
322
|
+
const getErrorMessage = (e) => e instanceof Error ? e.message : `Unknown ${typeof e} error`;
|
323
|
+
exports.getErrorMessage = getErrorMessage;
|
package/dist/types/explore.d.ts
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
export declare enum SpotlightTableColumns {
|
2
|
+
METRIC = "label",
|
3
|
+
TABLE = "tableLabel",
|
4
|
+
DESCRIPTION = "description",
|
5
|
+
CATEGORIES = "categories",
|
6
|
+
CHART_USAGE = "chartUsage"
|
7
|
+
}
|
8
|
+
type ColumnConfig = Array<{
|
9
|
+
column: SpotlightTableColumns;
|
10
|
+
isVisible: boolean;
|
11
|
+
}>;
|
12
|
+
export type SpotlightTableConfig = {
|
13
|
+
spotlightTableConfigUuid: string;
|
14
|
+
projectUuid: string;
|
15
|
+
columnConfig: ColumnConfig;
|
16
|
+
};
|
17
|
+
export declare const DEFAULT_SPOTLIGHT_TABLE_COLUMN_CONFIG: ColumnConfig;
|
18
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DEFAULT_SPOTLIGHT_TABLE_COLUMN_CONFIG = exports.SpotlightTableColumns = void 0;
|
4
|
+
var SpotlightTableColumns;
|
5
|
+
(function (SpotlightTableColumns) {
|
6
|
+
// These must match the keys of CatalogField type
|
7
|
+
SpotlightTableColumns["METRIC"] = "label";
|
8
|
+
SpotlightTableColumns["TABLE"] = "tableLabel";
|
9
|
+
SpotlightTableColumns["DESCRIPTION"] = "description";
|
10
|
+
SpotlightTableColumns["CATEGORIES"] = "categories";
|
11
|
+
SpotlightTableColumns["CHART_USAGE"] = "chartUsage";
|
12
|
+
})(SpotlightTableColumns = exports.SpotlightTableColumns || (exports.SpotlightTableColumns = {}));
|
13
|
+
exports.DEFAULT_SPOTLIGHT_TABLE_COLUMN_CONFIG = [
|
14
|
+
{ column: SpotlightTableColumns.METRIC, isVisible: true },
|
15
|
+
{ column: SpotlightTableColumns.TABLE, isVisible: false },
|
16
|
+
{ column: SpotlightTableColumns.DESCRIPTION, isVisible: true },
|
17
|
+
{ column: SpotlightTableColumns.CATEGORIES, isVisible: true },
|
18
|
+
{ column: SpotlightTableColumns.CHART_USAGE, isVisible: true },
|
19
|
+
];
|
package/dist/utils/item.d.ts
CHANGED
@@ -43,6 +43,9 @@ export declare const replaceDimensionInExplore: (explore: Explore, dimension: Co
|
|
43
43
|
groupLabel?: string | undefined;
|
44
44
|
baseTable: string;
|
45
45
|
joinedTables: import("../types/explore").CompiledExploreJoin[];
|
46
|
+
unfilteredTables?: {
|
47
|
+
[tableName: string]: import("../types/explore").CompiledTable;
|
48
|
+
} | undefined;
|
46
49
|
targetDatabase: import("..").SupportedDbtAdapter;
|
47
50
|
warehouse?: string | undefined;
|
48
51
|
ymlPath?: string | undefined;
|