mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-28 08:49:38 +02:00
* feat: add searchable setup prompt pickers * fix: make snowflake scope discovery single query * fix: make bigquery table discovery schema scoped * fix: honor mysql and clickhouse database scope * feat: wire schema scope discovery for all relational setup drivers * feat: add schema-first database scope picker * test: update setup prompt stubs for type-check * docs: document database scope picker fields * Fix database setup edit preservation --------- Co-authored-by: Andrey Avtomonov <7889985+andreybavt@users.noreply.github.com>
17 lines
678 B
TypeScript
17 lines
678 B
TypeScript
const BIGQUERY_PROJECT_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
const BIGQUERY_REGION_PATTERN = /^[a-z0-9-]+$/;
|
|
|
|
export function normalizeBigQueryProjectId(value: string, context = 'historic-SQL ingest'): string {
|
|
if (!BIGQUERY_PROJECT_ID_PATTERN.test(value)) {
|
|
throw new Error(`Invalid BigQuery project id for ${context}: ${value}`);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
export function normalizeBigQueryRegion(value: string, context = 'historic-SQL ingest'): string {
|
|
const normalized = value.trim().toLowerCase().replace(/^region-/, '');
|
|
if (!BIGQUERY_REGION_PATTERN.test(normalized)) {
|
|
throw new Error(`Invalid BigQuery region for ${context}: ${value}`);
|
|
}
|
|
return normalized;
|
|
}
|