@lightdash/common 0.1465.0 → 0.1466.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.
- package/LICENSE +6 -2
- package/dist/ee/Ai/schemas.d.ts +2094 -0
- package/dist/ee/Ai/schemas.js +201 -0
- package/dist/ee/Ai/types.d.ts +136 -0
- package/dist/ee/Ai/types.js +12 -0
- package/dist/ee/commercialFeatureFlags.d.ts +5 -0
- package/dist/ee/commercialFeatureFlags.js +9 -0
- package/dist/ee/embed/index.d.ts +180 -0
- package/dist/ee/embed/index.js +73 -0
- package/dist/ee/index.d.ts +14 -0
- package/dist/ee/index.js +19 -0
- package/dist/ee/scim/errors.d.ts +32 -0
- package/dist/ee/scim/errors.js +24 -0
- package/dist/ee/scim/types.d.ts +119 -0
- package/dist/ee/scim/types.js +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/index.test.js +23 -0
- package/dist/types/analytics.d.ts +2 -0
- package/dist/types/analytics.js +2 -0
- package/dist/types/dashboard.d.ts +2 -2
- package/dist/types/slack.d.ts +1 -0
- package/dist/types/slackSettings.js +1 -0
- package/dist/utils/email.d.ts +1 -0
- package/dist/utils/email.js +3 -1
- package/package.json +1 -1
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            import { type ScimSchemaType } from '..';
         | 
| 2 | 
            +
            import { type ScimErrorPayload } from './types';
         | 
| 3 | 
            +
            export declare class ScimError extends Error {
         | 
| 4 | 
            +
                /**
         | 
| 5 | 
            +
                 * a SCIM-specific error type that provides additional context for the error.
         | 
| 6 | 
            +
                 * @type {ScimErrorPayload['scimType']}
         | 
| 7 | 
            +
                 */
         | 
| 8 | 
            +
                scimType?: ScimErrorPayload['scimType'];
         | 
| 9 | 
            +
                /**
         | 
| 10 | 
            +
                 * The "schemas" attribute is an array of Strings which allows the service provider to declare
         | 
| 11 | 
            +
                 * the schemas it supports. Each String is a URI and can be used to declare both standard and
         | 
| 12 | 
            +
                 * custom schemas.
         | 
| 13 | 
            +
                 * @type {ScimSchemaType[]}
         | 
| 14 | 
            +
                 */
         | 
| 15 | 
            +
                schemas: ScimSchemaType.ERROR[];
         | 
| 16 | 
            +
                /**
         | 
| 17 | 
            +
                 * A human-readable message in English, providing more information about the error.
         | 
| 18 | 
            +
                 * @type {string}
         | 
| 19 | 
            +
                 */
         | 
| 20 | 
            +
                detail: string;
         | 
| 21 | 
            +
                /**
         | 
| 22 | 
            +
                 * The HTTP status code applicable to this error, expressed as a string value.
         | 
| 23 | 
            +
                 * @type {string}
         | 
| 24 | 
            +
                 * */
         | 
| 25 | 
            +
                status: string;
         | 
| 26 | 
            +
                constructor({ detail, scimType, status, }: {
         | 
| 27 | 
            +
                    detail: string;
         | 
| 28 | 
            +
                    scimType?: ScimErrorPayload['scimType'];
         | 
| 29 | 
            +
                    status: number;
         | 
| 30 | 
            +
                });
         | 
| 31 | 
            +
                toJSON(): ScimErrorPayload;
         | 
| 32 | 
            +
            }
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         | 
| 3 | 
            +
            exports.ScimError = void 0;
         | 
| 4 | 
            +
            class ScimError extends Error {
         | 
| 5 | 
            +
                constructor({ detail, scimType, status, }) {
         | 
| 6 | 
            +
                    super(detail);
         | 
| 7 | 
            +
                    this.scimType = scimType;
         | 
| 8 | 
            +
                    this.schemas = [
         | 
| 9 | 
            +
                        'urn:ietf:params:scim:api:messages:2.0:Error',
         | 
| 10 | 
            +
                    ];
         | 
| 11 | 
            +
                    this.detail = detail;
         | 
| 12 | 
            +
                    this.status = status.toString();
         | 
| 13 | 
            +
                }
         | 
| 14 | 
            +
                // Override the toJSON method to return the desired structure directly
         | 
| 15 | 
            +
                toJSON() {
         | 
| 16 | 
            +
                    return {
         | 
| 17 | 
            +
                        ...(this.scimType && { scimType: this.scimType }),
         | 
| 18 | 
            +
                        schemas: this.schemas,
         | 
| 19 | 
            +
                        detail: this.detail,
         | 
| 20 | 
            +
                        status: this.status,
         | 
| 21 | 
            +
                    };
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
            }
         | 
| 24 | 
            +
            exports.ScimError = ScimError;
         | 
| @@ -0,0 +1,119 @@ | |
| 1 | 
            +
            import { type ScimSchemaType } from '..';
         | 
| 2 | 
            +
            export type SessionServiceAccount = {
         | 
| 3 | 
            +
                organizationUuid: string;
         | 
| 4 | 
            +
            };
         | 
| 5 | 
            +
            export interface ScimResource {
         | 
| 6 | 
            +
                schemas: string[];
         | 
| 7 | 
            +
                id: string;
         | 
| 8 | 
            +
                meta?: {
         | 
| 9 | 
            +
                    resourceType?: string;
         | 
| 10 | 
            +
                    created?: Date;
         | 
| 11 | 
            +
                    lastModified?: Date;
         | 
| 12 | 
            +
                    location?: string;
         | 
| 13 | 
            +
                    version?: string;
         | 
| 14 | 
            +
                };
         | 
| 15 | 
            +
            }
         | 
| 16 | 
            +
            export interface ScimUser extends ScimResource {
         | 
| 17 | 
            +
                schemas: string[];
         | 
| 18 | 
            +
                userName: string;
         | 
| 19 | 
            +
                name: {
         | 
| 20 | 
            +
                    givenName: string;
         | 
| 21 | 
            +
                    familyName: string;
         | 
| 22 | 
            +
                };
         | 
| 23 | 
            +
                active: boolean;
         | 
| 24 | 
            +
                emails?: {
         | 
| 25 | 
            +
                    value: string;
         | 
| 26 | 
            +
                    primary: boolean;
         | 
| 27 | 
            +
                }[];
         | 
| 28 | 
            +
            }
         | 
| 29 | 
            +
            export interface ScimGroup extends ScimResource {
         | 
| 30 | 
            +
                schemas: string[];
         | 
| 31 | 
            +
                id: string;
         | 
| 32 | 
            +
                displayName: string;
         | 
| 33 | 
            +
                members: ScimGroupMember[];
         | 
| 34 | 
            +
                meta: ScimResource['meta'] & {
         | 
| 35 | 
            +
                    resourceType: 'Group';
         | 
| 36 | 
            +
                    created: Date;
         | 
| 37 | 
            +
                    lastModified: Date;
         | 
| 38 | 
            +
                    location: string;
         | 
| 39 | 
            +
                };
         | 
| 40 | 
            +
            }
         | 
| 41 | 
            +
            export interface ScimGroupMember {
         | 
| 42 | 
            +
                value: string;
         | 
| 43 | 
            +
                display: string;
         | 
| 44 | 
            +
            }
         | 
| 45 | 
            +
            export type ScimErrorPayload = {
         | 
| 46 | 
            +
                /**
         | 
| 47 | 
            +
                 * NOTE: this is taken from the SCIM spec here: https://datatracker.ietf.org/doc/html/rfc7644#section-3.7.3
         | 
| 48 | 
            +
                 * A SCIM-specific error type that provides additional context for the error.
         | 
| 49 | 
            +
                 * - 'invalidFilter': The specified filter syntax was invalid or the attribute and comparison combination is not supported.
         | 
| 50 | 
            +
                 *   Applicable for GET (Section 3.4.2), POST (Search - Section 3.4.3), PATCH (Path Filter - Section 3.5.2).
         | 
| 51 | 
            +
                 * - 'tooMany': The filter yields too many results for the server to process.
         | 
| 52 | 
            +
                 *   Applicable for GET (Section 3.4.2), POST (Search - Section 3.4.3).
         | 
| 53 | 
            +
                 * - 'uniqueness': One or more attribute values are already in use or reserved.
         | 
| 54 | 
            +
                 *   Applicable for POST (Create - Section 3.3), PUT (Section 3.5.1), PATCH (Section 3.5.2).
         | 
| 55 | 
            +
                 * - 'mutability': The modification is incompatible with the target attribute's mutability.
         | 
| 56 | 
            +
                 *   Applicable for PUT (Section 3.5.1), PATCH (Section 3.5.2).
         | 
| 57 | 
            +
                 * - 'invalidSyntax': The request body structure was invalid or did not conform to the schema.
         | 
| 58 | 
            +
                 *   Applicable for POST (Search - Section 3.4.3, Create - Section 3.3, Bulk - Section 3.7), PUT (Section 3.5.1).
         | 
| 59 | 
            +
                 * - 'invalidPath': The "path" attribute was invalid or malformed.
         | 
| 60 | 
            +
                 *   Applicable for PATCH (Section 3.5.2).
         | 
| 61 | 
            +
                 * - 'noTarget': The specified "path" did not yield an attribute that could be operated on.
         | 
| 62 | 
            +
                 *   Applicable for PATCH (Section 3.5.2).
         | 
| 63 | 
            +
                 * - 'invalidValue': A required value was missing, or the value specified was not compatible with the operation.
         | 
| 64 | 
            +
                 *   Applicable for GET (Section 3.4.2), POST (Create - Section 3.3, Query - Section 3.4.3), PUT (Section 3.5.1), PATCH (Section 3.5.2).
         | 
| 65 | 
            +
                 * - 'invalidVers': The specified SCIM protocol version is not supported.
         | 
| 66 | 
            +
                 *   Applicable for GET (Section 3.4.2), POST (ALL), PUT (Section 3.5.1), PATCH (Section 3.5.2), DELETE (Section 3.6).
         | 
| 67 | 
            +
                 * - 'sensitive': The request cannot be completed due to sensitive information passed in the URI.
         | 
| 68 | 
            +
                 *   Applicable for GET (Section 3.4.2).
         | 
| 69 | 
            +
                 */
         | 
| 70 | 
            +
                scimType?: 'invalidFilter' | 'tooMany' | 'uniqueness' | 'mutability' | 'invalidSyntax' | 'invalidPath' | 'noTarget' | 'invalidValue' | 'invalidVers' | 'sensitive';
         | 
| 71 | 
            +
                /**
         | 
| 72 | 
            +
                 * Array of schema URIs that describe the structure of the SCIM error response.
         | 
| 73 | 
            +
                 * Typically includes "urn:ietf:params:scim:api:messages:2.0:Error".
         | 
| 74 | 
            +
                 */
         | 
| 75 | 
            +
                schemas: ScimSchemaType.ERROR[];
         | 
| 76 | 
            +
                /**
         | 
| 77 | 
            +
                 * Human-readable description of the error, providing details about why the error occurred.
         | 
| 78 | 
            +
                 */
         | 
| 79 | 
            +
                detail: string;
         | 
| 80 | 
            +
                /**
         | 
| 81 | 
            +
                 * HTTP status code as a string, indicating the status of the response.
         | 
| 82 | 
            +
                 * For example: "400" for bad requests, "404" for not found, "500" for server errors.
         | 
| 83 | 
            +
                 */
         | 
| 84 | 
            +
                status: string;
         | 
| 85 | 
            +
            };
         | 
| 86 | 
            +
            export interface ScimListResponse<T extends ScimResource> {
         | 
| 87 | 
            +
                schemas: ScimSchemaType.LIST_RESPONSE[];
         | 
| 88 | 
            +
                totalResults: number;
         | 
| 89 | 
            +
                itemsPerPage: number;
         | 
| 90 | 
            +
                startIndex: number;
         | 
| 91 | 
            +
                Resources: T[];
         | 
| 92 | 
            +
            }
         | 
| 93 | 
            +
            export interface ScimUpsertGroup {
         | 
| 94 | 
            +
                schemas: ScimSchemaType.GROUP[];
         | 
| 95 | 
            +
                displayName: string;
         | 
| 96 | 
            +
                members: ScimGroupMember[];
         | 
| 97 | 
            +
            }
         | 
| 98 | 
            +
            export type ScimUpsertUser = Omit<ScimUser, 'id'> & {
         | 
| 99 | 
            +
                password?: string;
         | 
| 100 | 
            +
                title?: string;
         | 
| 101 | 
            +
            };
         | 
| 102 | 
            +
            export type ScimOrganizationAccessToken = {
         | 
| 103 | 
            +
                uuid: string;
         | 
| 104 | 
            +
                organizationUuid: string;
         | 
| 105 | 
            +
                createdAt: Date;
         | 
| 106 | 
            +
                expiresAt: Date | null;
         | 
| 107 | 
            +
                description: string;
         | 
| 108 | 
            +
                lastUsedAt: Date | null;
         | 
| 109 | 
            +
                rotatedAt: Date | null;
         | 
| 110 | 
            +
            };
         | 
| 111 | 
            +
            export type ScimOrganizationAccessTokenWithToken = ScimOrganizationAccessToken & {
         | 
| 112 | 
            +
                token: string;
         | 
| 113 | 
            +
            };
         | 
| 114 | 
            +
            export type ApiCreateScimTokenRequest = Pick<ScimOrganizationAccessToken, 'expiresAt' | 'description'>;
         | 
| 115 | 
            +
            export type ApiCreateScimTokenResponse = {
         | 
| 116 | 
            +
                token: string;
         | 
| 117 | 
            +
                expiresAt: Date;
         | 
| 118 | 
            +
            };
         | 
| 119 | 
            +
            export type CreateScimOrganizationAccessToken = Pick<ScimOrganizationAccessToken, 'organizationUuid' | 'expiresAt' | 'description'>;
         | 
    
        package/dist/index.d.ts
    CHANGED
    
    | @@ -36,6 +36,7 @@ import { type TableBase } from './types/table'; | |
| 36 36 | 
             
            import { type LightdashUser, type LoginOptions, type UserAllowedOrganization } from './types/user';
         | 
| 37 37 | 
             
            import { type UserWarehouseCredentials } from './types/userWarehouseCredentials';
         | 
| 38 38 | 
             
            import { type ValidationResponse } from './types/validation';
         | 
| 39 | 
            +
            import type { ApiAiConversationMessages, ApiAiConversationResponse, ApiAiConversations, DecodedEmbed, EmbedUrl } from './ee';
         | 
| 39 40 | 
             
            import { type AnyType } from './types/any';
         | 
| 40 41 | 
             
            import { type ApiGetSpotlightTableConfig } from './types/api/spotlight';
         | 
| 41 42 | 
             
            import { type ApiCatalogAnalyticsResults, type ApiCatalogMetadataResults, type ApiGetMetricsTree, type ApiMetricsCatalog } from './types/catalog';
         | 
| @@ -53,6 +54,7 @@ export * from './compiler/exploreCompiler'; | |
| 53 54 | 
             
            export * from './compiler/filtersCompiler';
         | 
| 54 55 | 
             
            export * from './compiler/translator';
         | 
| 55 56 | 
             
            export * from './dbt/validation';
         | 
| 57 | 
            +
            export * from './ee/index';
         | 
| 56 58 | 
             
            export * from './pivotTable/pivotQueryResults';
         | 
| 57 59 | 
             
            export { default as lightdashDbtYamlSchema } from './schemas/json/lightdash-dbt-2.0.json';
         | 
| 58 60 | 
             
            export { default as lightdashProjectConfigSchema } from './schemas/json/lightdash-project-config-1.0.json';
         | 
| @@ -216,6 +218,7 @@ export declare const SEED_ORG_2_ADMIN_EMAIL: { | |
| 216 218 | 
             
            export declare const SEED_ORG_2_ADMIN_PASSWORD: {
         | 
| 217 219 | 
             
                password: string;
         | 
| 218 220 | 
             
            };
         | 
| 221 | 
            +
            export declare const SEED_EMBED_SECRET = "zU3h50saDOO20czNFNRok";
         | 
| 219 222 | 
             
            export declare const SEED_PROJECT: {
         | 
| 220 223 | 
             
                project_uuid: string;
         | 
| 221 224 | 
             
                name: string;
         | 
| @@ -390,7 +393,7 @@ export type ApiAiGetDashboardSummaryResponse = { | |
| 390 393 | 
             
                status: 'ok';
         | 
| 391 394 | 
             
                results: DashboardSummary;
         | 
| 392 395 | 
             
            };
         | 
| 393 | 
            -
            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'];
         | 
| 396 | 
            +
            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 | EmbedUrl | DecodedEmbed | 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 | ApiAiConversations['results'] | ApiAiConversationMessages['results'] | ApiAiConversationResponse['results'] | 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'];
         | 
| 394 397 | 
             
            export type ApiResponse<T extends ApiResults = ApiResults> = {
         | 
| 395 398 | 
             
                status: 'ok';
         | 
| 396 399 | 
             
                results: T;
         | 
    
        package/dist/index.js
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            "use strict";
         | 
| 2 2 | 
             
            Object.defineProperty(exports, "__esModule", { value: true });
         | 
| 3 | 
            -
            exports.getProjectDirectory = exports.deepEqual = exports.removeEmptyProperties = exports.formatRows = exports.itemsInMetricQuery = exports.getTableCalculationsFromItemsMap = exports.getMetricsFromItemsMap = exports.getFilterableDimensionsFromItemsMap = exports.getDimensionsFromItemsMap = exports.getItemMap = exports.getFieldMap = exports.getAxisName = exports.getDateGroupLabel = exports.getResultValueArray = exports.DbtProjectTypeLabels = exports.sensitiveDbtCredentialsFieldNames = exports.DBFieldTypes = exports.LightdashInstallType = exports.isLightdashMode = exports.LightdashMode = exports.isApiError = exports.hasInviteCode = exports.TableSelectionType = exports.hasSpecialCharacters = exports.snakeCaseName = exports.findFieldByIdInExplore = exports.getVisibleFields = exports.SEED_GROUP = exports.SEED_SPACE = exports.SEED_PROJECT = exports.SEED_ORG_2_ADMIN_PASSWORD = exports.SEED_ORG_2_ADMIN_EMAIL = exports.SEED_ORG_2_ADMIN = exports.SEED_ORG_2 = exports.SEED_ORG_1_ADMIN_PASSWORD = exports.SEED_ORG_1_ADMIN_EMAIL = exports.SEED_ORG_1_ADMIN = exports.SEED_ORG_1 = exports.hexToRGB = exports.replaceStringInArray = exports.toggleArrayValue = exports.hasIntersection = exports.validatePassword = exports.getPasswordSchema = exports.getEmailSchema = exports.validateEmail = exports.assertUnreachable = exports.lightdashProjectConfigSchema = exports.lightdashDbtYamlSchema = void 0;
         | 
| 3 | 
            +
            exports.getProjectDirectory = exports.deepEqual = exports.removeEmptyProperties = exports.formatRows = exports.itemsInMetricQuery = exports.getTableCalculationsFromItemsMap = exports.getMetricsFromItemsMap = exports.getFilterableDimensionsFromItemsMap = exports.getDimensionsFromItemsMap = exports.getItemMap = exports.getFieldMap = exports.getAxisName = exports.getDateGroupLabel = exports.getResultValueArray = exports.DbtProjectTypeLabels = exports.sensitiveDbtCredentialsFieldNames = exports.DBFieldTypes = exports.LightdashInstallType = exports.isLightdashMode = exports.LightdashMode = exports.isApiError = exports.hasInviteCode = exports.TableSelectionType = exports.hasSpecialCharacters = exports.snakeCaseName = exports.findFieldByIdInExplore = exports.getVisibleFields = exports.SEED_GROUP = exports.SEED_SPACE = exports.SEED_PROJECT = exports.SEED_EMBED_SECRET = exports.SEED_ORG_2_ADMIN_PASSWORD = exports.SEED_ORG_2_ADMIN_EMAIL = exports.SEED_ORG_2_ADMIN = exports.SEED_ORG_2 = exports.SEED_ORG_1_ADMIN_PASSWORD = exports.SEED_ORG_1_ADMIN_EMAIL = exports.SEED_ORG_1_ADMIN = exports.SEED_ORG_1 = exports.hexToRGB = exports.replaceStringInArray = exports.toggleArrayValue = exports.hasIntersection = exports.validatePassword = exports.getPasswordSchema = exports.getEmailSchema = exports.validateEmail = exports.assertUnreachable = exports.lightdashProjectConfigSchema = exports.lightdashDbtYamlSchema = void 0;
         | 
| 4 4 | 
             
            const tslib_1 = require("tslib");
         | 
| 5 5 | 
             
            const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
         | 
| 6 6 | 
             
            const utc_1 = tslib_1.__importDefault(require("dayjs/plugin/utc"));
         | 
| @@ -19,6 +19,7 @@ tslib_1.__exportStar(require("./compiler/exploreCompiler"), exports); | |
| 19 19 | 
             
            tslib_1.__exportStar(require("./compiler/filtersCompiler"), exports);
         | 
| 20 20 | 
             
            tslib_1.__exportStar(require("./compiler/translator"), exports);
         | 
| 21 21 | 
             
            tslib_1.__exportStar(require("./dbt/validation"), exports);
         | 
| 22 | 
            +
            tslib_1.__exportStar(require("./ee/index"), exports);
         | 
| 22 23 | 
             
            tslib_1.__exportStar(require("./pivotTable/pivotQueryResults"), exports);
         | 
| 23 24 | 
             
            var lightdash_dbt_2_0_json_1 = require("./schemas/json/lightdash-dbt-2.0.json");
         | 
| 24 25 | 
             
            Object.defineProperty(exports, "lightdashDbtYamlSchema", { enumerable: true, get: function () { return tslib_1.__importDefault(lightdash_dbt_2_0_json_1).default; } });
         | 
| @@ -222,6 +223,7 @@ exports.SEED_ORG_2_ADMIN_EMAIL = { | |
| 222 223 | 
             
            exports.SEED_ORG_2_ADMIN_PASSWORD = {
         | 
| 223 224 | 
             
                password: 'demo_password!',
         | 
| 224 225 | 
             
            };
         | 
| 226 | 
            +
            exports.SEED_EMBED_SECRET = 'zU3h50saDOO20czNFNRok';
         | 
| 225 227 | 
             
            exports.SEED_PROJECT = {
         | 
| 226 228 | 
             
                project_uuid: '3675b69e-8324-4110-bdca-059031aa8da3',
         | 
| 227 229 | 
             
                name: 'Jaffle shop',
         | 
    
        package/dist/index.test.js
    CHANGED
    
    | @@ -100,3 +100,26 @@ describe('getDateGroupLabel', () => { | |
| 100 100 | 
             
                    })).toEqual('Day date day'); // doesn't recognize (day) as a valid time frame
         | 
| 101 101 | 
             
                });
         | 
| 102 102 | 
             
            });
         | 
| 103 | 
            +
            describe('email validation', () => {
         | 
| 104 | 
            +
                test.each([
         | 
| 105 | 
            +
                    'demo@lightdash.com',
         | 
| 106 | 
            +
                    'de.mo@lightdash.com',
         | 
| 107 | 
            +
                    'Demo@lightdash.com',
         | 
| 108 | 
            +
                    'user+tag@domain.co.uk',
         | 
| 109 | 
            +
                    'user@sub.domain.com',
         | 
| 110 | 
            +
                    'user@domain.info',
         | 
| 111 | 
            +
                    'user123@domain.org',
         | 
| 112 | 
            +
                ])('valid email: %s', (email) => {
         | 
| 113 | 
            +
                    expect((0, _1.isValidEmailAddress)(email)).toBe(true);
         | 
| 114 | 
            +
                });
         | 
| 115 | 
            +
                test.each([
         | 
| 116 | 
            +
                    ['demo@lightdash', 'Missing top-level domain'],
         | 
| 117 | 
            +
                    ['de mo@lightdash.com', 'Whitespace in email'],
         | 
| 118 | 
            +
                    ['demo@lightdash..com', 'Double dot in domain'],
         | 
| 119 | 
            +
                    ['@lightdash.com', 'Missing local part'],
         | 
| 120 | 
            +
                    ['demo@.com', 'Missing domain name'],
         | 
| 121 | 
            +
                    ['demo@lightdash.c', 'Top-level domain too short'],
         | 
| 122 | 
            +
                ])('invalid email: %s - %s', (email) => {
         | 
| 123 | 
            +
                    expect((0, _1.isValidEmailAddress)(email)).toBe(false);
         | 
| 124 | 
            +
                });
         | 
| 125 | 
            +
            });
         | 
| @@ -55,6 +55,8 @@ export declare enum QueryExecutionContext { | |
| 55 55 | 
             
                SCHEDULED_CHART = "scheduledChart",
         | 
| 56 56 | 
             
                SCHEDULED_DASHBOARD = "scheduledDashboard",
         | 
| 57 57 | 
             
                CALCULATE_TOTAL = "calculateTotal",
         | 
| 58 | 
            +
                EMBED = "embed",
         | 
| 59 | 
            +
                AI = "ai",
         | 
| 58 60 | 
             
                API = "api",
         | 
| 59 61 | 
             
                CLI = "cli",
         | 
| 60 62 | 
             
                SEMANTIC_VIEWER = "semanticViewer",
         | 
    
        package/dist/types/analytics.js
    CHANGED
    
    | @@ -19,6 +19,8 @@ var QueryExecutionContext; | |
| 19 19 | 
             
                QueryExecutionContext["SCHEDULED_CHART"] = "scheduledChart";
         | 
| 20 20 | 
             
                QueryExecutionContext["SCHEDULED_DASHBOARD"] = "scheduledDashboard";
         | 
| 21 21 | 
             
                QueryExecutionContext["CALCULATE_TOTAL"] = "calculateTotal";
         | 
| 22 | 
            +
                QueryExecutionContext["EMBED"] = "embed";
         | 
| 23 | 
            +
                QueryExecutionContext["AI"] = "ai";
         | 
| 22 24 | 
             
                QueryExecutionContext["API"] = "api";
         | 
| 23 25 | 
             
                QueryExecutionContext["CLI"] = "cli";
         | 
| 24 26 | 
             
                QueryExecutionContext["SEMANTIC_VIEWER"] = "semanticViewer";
         | 
| @@ -165,8 +165,8 @@ export type DashboardAvailableFilters = { | |
| 165 165 | 
             
                allFilterableFields: FilterableDimension[];
         | 
| 166 166 | 
             
            };
         | 
| 167 167 | 
             
            export type SavedChartsInfoForDashboardAvailableFilters = {
         | 
| 168 | 
            -
                tileUuid:  | 
| 169 | 
            -
                savedChartUuid:  | 
| 168 | 
            +
                tileUuid: string;
         | 
| 169 | 
            +
                savedChartUuid: string;
         | 
| 170 170 | 
             
            }[];
         | 
| 171 171 | 
             
            export declare const isDashboardUnversionedFields: (data: UpdateDashboard) => data is DashboardUnversionedFields;
         | 
| 172 172 | 
             
            export declare const isDashboardVersionedFields: (data: UpdateDashboard) => data is DashboardVersionedFields;
         | 
    
        package/dist/types/slack.d.ts
    CHANGED
    
    | @@ -13,6 +13,7 @@ export type ApiSlackCustomSettingsResponse = { | |
| 13 13 | 
             
            export type SlackChannelProjectMapping = {
         | 
| 14 14 | 
             
                projectUuid: string;
         | 
| 15 15 | 
             
                slackChannelId: string;
         | 
| 16 | 
            +
                availableTags: string[] | null;
         | 
| 16 17 | 
             
            };
         | 
| 17 18 | 
             
            export type SlackAppCustomSettings = {
         | 
| 18 19 | 
             
                notificationChannel: string | null;
         | 
    
        package/dist/utils/email.d.ts
    CHANGED
    
    | @@ -1,3 +1,4 @@ | |
| 1 1 | 
             
            export declare const getEmailDomain: (email: string) => string;
         | 
| 2 2 | 
             
            export declare const isValidEmailDomain: (value: string) => RegExpMatchArray | null;
         | 
| 3 3 | 
             
            export declare const validateOrganizationEmailDomains: (domains: string[]) => string | undefined;
         | 
| 4 | 
            +
            export declare const isValidEmailAddress: (email: string) => boolean;
         | 
    
        package/dist/utils/email.js
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            "use strict";
         | 
| 2 2 | 
             
            Object.defineProperty(exports, "__esModule", { value: true });
         | 
| 3 | 
            -
            exports.validateOrganizationEmailDomains = exports.isValidEmailDomain = exports.getEmailDomain = void 0;
         | 
| 3 | 
            +
            exports.isValidEmailAddress = exports.validateOrganizationEmailDomains = exports.isValidEmailDomain = exports.getEmailDomain = void 0;
         | 
| 4 4 | 
             
            const getEmailDomain = (email) => {
         | 
| 5 5 | 
             
                if (/\s/.test(email)) {
         | 
| 6 6 | 
             
                    throw new Error(`Invalid email, contains whitespace: ${email}`);
         | 
| @@ -78,3 +78,5 @@ const validateOrganizationEmailDomains = (domains) => { | |
| 78 78 | 
             
                return `${readableDomainList} ${invalidDomains.length === 1 ? 'is' : 'are'} not allowed as organization email(s)`;
         | 
| 79 79 | 
             
            };
         | 
| 80 80 | 
             
            exports.validateOrganizationEmailDomains = validateOrganizationEmailDomains;
         | 
| 81 | 
            +
            const isValidEmailAddress = (email) => /^[\w.+-]+@[\w-]+\.[A-Za-z]{2,}(?:\.[A-Za-z]{2,})*$/.test(email);
         | 
| 82 | 
            +
            exports.isValidEmailAddress = isValidEmailAddress;
         |