tessl install tessl/npm-lightdash--common@0.2231.5Shared 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%
A utility module for extracting and validating parameter references from SQL queries in a BI (Business Intelligence) system. The system supports parameterized SQL queries where parameters can be referenced using special syntax, and needs robust extraction and validation to ensure queries are properly constructed before execution.
In a BI platform, users write SQL queries with dynamic parameter references. These parameters can be:
region, date_range)customers.status, orders.priority)Parameters are referenced in SQL using the syntax: ${lightdash.parameters.param_name} or ${ld.parameters.param_name} (shorthand).
For model-level parameters, the syntax includes a model prefix: ${ld.parameters.model_name.param_name}.
Implement a function getParameterReferences(sql: string): string[] that:
${lightdash.parameters. or ${ld.parameters. wrapper)lightdash.parameters) and shorthand (ld.parameters)status from ${ld.parameters.status})customers.status from ${ld.parameters.customers.status})Implement a function validateParameterNames(parameters: Record<string, ParameterConfig> | undefined): ValidationResult that:
isInvalid: boolean - true if any parameter has an invalid nameinvalidParameters: string[] - array of parameter names that don't match the patternundefined or empty parameter objects gracefullyexport type ParameterConfig = {
label: string;
default?: string;
description?: string;
};
export type ValidationResult = {
isInvalid: boolean;
invalidParameters: string[];
};
export function getParameterReferences(sql: string): string[];
export function validateParameterNames(
parameters: Record<string, ParameterConfig> | undefined
): ValidationResult;lightdash.parameters format @testld.parameters shorthand @testcustomers.status) @test@generates
Provides TypeScript types and utilities for the Lightdash BI platform.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20