CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-lightdash--common

tessl install tessl/npm-lightdash--common@0.2231.5

Shared TypeScript library for the Lightdash platform containing common types, utilities, and business logic for analytics workflows

Agent Success

Agent success rate when using this tile

72%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.09x

Baseline

Agent success rate without this tile

66%

task.mdevals/scenario-13/

User Registration Validator

Build a user registration validator that processes registration data for a multi-tenant BI platform. The validator must handle email address validation, organization name validation, and ensure that organization email domains are from legitimate business domains rather than public email providers.

Capabilities

Email validation

  • When given a valid corporate email "john.doe@company.com", the validator extracts the domain "company.com" @test
  • When given an invalid email with whitespace "john doe@company.com", the validator throws an error @test
  • When given a malformed email "notanemail", the validator throws an error @test

Organization name validation

  • When given a valid organization name "Acme Corp-123", the validator accepts it @test
  • When given an organization name with only whitespace " ", the validator rejects it @test
  • When given an organization name with special characters "Acme@Corp!", the validator rejects it @test

Organization domain validation

  • When given corporate domains ["company.com", "business.org"], the validator accepts them @test
  • When given public email provider domains ["gmail.com", "yahoo.com"], the validator returns an error message listing the disallowed domains @test
  • When given a mix of corporate and public domains ["company.com", "gmail.com"], the validator returns an error message mentioning only "gmail.com" @test

Implementation

@generates

API

/**
 * Extracts the domain from an email address.
 * Throws an error if the email is invalid or malformed.
 */
export function extractEmailDomain(email: string): string;

/**
 * Validates an organization name.
 * Returns true if valid (letters, numbers, spaces, underscores, dashes only, not empty).
 * Returns false otherwise.
 */
export function isValidOrganizationName(name: string): boolean;

/**
 * Validates organization email domains.
 * Returns undefined if all domains are valid corporate domains.
 * Returns an error message if any domains are public email providers.
 */
export function checkOrganizationDomains(domains: string[]): string | undefined;

Dependencies { .dependencies }

@lightdash/common { .dependency }

Provides validation utilities for email and organization data.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@lightdash/common@0.2231.x
tile.json