CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lightdash--common

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

Overall
score

72%

Evaluation72%

1.09x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-7/

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

Install with Tessl CLI

npx tessl i tessl/npm-lightdash--common

tile.json