@altimateai/altimate-core 0.1.4 → 0.1.6
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/index.d.ts +788 -17
- package/index.js +52 -54
- package/package.json +8 -8
package/index.d.ts
CHANGED
|
@@ -1,4 +1,791 @@
|
|
|
1
|
-
// ── sqlguard TypeScript type definitions ────────────────────────────── // These interfaces mirror the JSON shapes returned by sqlguard-core. // All field names are snake_case (Rust default serialization). // ── Shared / Utility ────────────────────────────────────────────────── export interface SourceLocation { line: number column: number } // ── Validation ──────────────────────────────────────────────────────── export type ErrorCode = 'E000' | 'E001' | 'E002' | 'E003' | 'E004' | 'E005' | 'E006' | 'E099' export type ErrorKind = | { type: 'SyntaxError' } | { type: 'TableNotFound'; table: string } | { type: 'ColumnNotFound'; table: string | null; column: string } | { type: 'TypeMismatch'; expected: string; found: string } | { type: 'AmbiguousColumn'; column: string; candidates: string[] } | { type: 'InvalidJoin'; reason: string } | { type: 'UnsupportedDialectFeature'; feature: string; dialect: string } | { type: 'Other'; detail: string } export type SuggestionKind = | { type: 'DidYouMean'; name: string } | { type: 'AddQualification'; qualified: string } | { type: 'UseAlternative'; alternative: string } export interface Suggestion { kind: SuggestionKind message: string confidence: number } export interface ValidationError { code: ErrorCode kind: ErrorKind message: string location: SourceLocation | null suggestions: Suggestion[] } export interface ValidationWarning { code: string message: string location: SourceLocation | null } export type Complexity = 'low' | 'medium' | 'high' export interface QueryMetadata { tables_referenced: string[] join_count: number has_aggregation: boolean has_subquery: boolean complexity: Complexity } export interface ValidationResult { valid: boolean errors: ValidationError[] warnings: ValidationWarning[] metadata: QueryMetadata } // ── Explanation ─────────────────────────────────────────────────────── export type JoinKind = | 'inner' | 'left' | 'right' | 'full' | 'cross' | 'left_semi' | 'left_anti' | 'right_semi' | 'right_anti' export interface SortKey { column: string direction: 'asc' | 'desc' nulls_first: boolean } export type PlanOperation = | { type: 'table_scan'; table: string; columns_read: string[]; filters: string[] } | { type: 'join'; join_type: JoinKind; left: string; right: string; condition: string } | { type: 'filter'; predicate: string } | { type: 'aggregate'; group_by: string[]; functions: string[] } | { type: 'sort'; order_by: SortKey[] } | { type: 'limit'; limit?: number; offset?: number } | { type: 'projection'; columns: string[] } | { type: 'window'; function: string; partition_by: string[]; order_by: string[] } | { type: 'subquery'; alias: string; inner_steps: PlanStep[] } | { type: 'union'; all: boolean; branches: number } | { type: 'distinct' } | { type: 'empty_relation' } export interface PlanStep { step: number operation: PlanOperation notes?: string } export interface ColumnRef { table: string column: string } export type ColumnSource = | { type: 'direct_ref'; table: string; column: string } | { type: 'aggregation'; function: string } | { type: 'expression'; expr: string } | { type: 'window_function'; function: string } | { type: 'literal'; value: string } export interface OutputColumn { alias: string source: ColumnSource } export interface JoinEdge { left_table: string right_table: string join_type: JoinKind on_columns: [string, string][] } export interface QueryLineage { tables: string[] columns_read: ColumnRef[] columns_output: OutputColumn[] join_graph: JoinEdge[] } export type QueryComplexity = 'low' | 'moderate' | 'high' | 'extreme' export type RiskSeverity = 'info' | 'warning' | 'critical' export interface RiskFlag { severity: RiskSeverity flag: string detail: string } export type SuggestionType = | 'add_filter' | 'add_limit' | 'avoid_cross_join' | 'remove_select_star' | 'use_specific_columns' | 'remove_redundant_distinct' | 'consider_index' export type SuggestionPriority = 'low' | 'medium' | 'high' export interface OptimizationSuggestion { kind: SuggestionType message: string priority: SuggestionPriority } export interface CostSignals { complexity: QueryComplexity complexity_score: number join_count: number has_aggregation: boolean has_subquery: boolean has_window_function: boolean has_limit: boolean has_cross_join: boolean uses_select_star: boolean has_distinct: boolean has_union: boolean table_count: number filter_count: number unfiltered_scans: string[] risk_flags: RiskFlag[] cost_estimate?: CostEstimate complexity_score_v2?: ComplexityScoreV2 } export interface QueryExplanation { summary: string plan_steps: PlanStep[] lineage: QueryLineage cost_signals: CostSignals suggestions: OptimizationSuggestion[] } export interface ValidationSummary { error_count: number warning_count: number errors: ValidationError[] warnings: ValidationWarning[] } export interface AnalysisMetadata { dialect: string plan_node_count: number analysis_time_ms: number } export interface ExplanationResult { valid: boolean explanation?: QueryExplanation validation: ValidationSummary metadata: AnalysisMetadata } // ── Fix ─────────────────────────────────────────────────────────────── export type FixActionType = | 'replace_table' | 'replace_column' | 'qualify_column' | 'remove_alias' | 'add_alias' | 'use_alternative' export interface FixAction { action: FixActionType original: string replacement: string confidence: number explanation: string location?: SourceLocation } export interface UnfixableError { error: ValidationError reason: string } export interface FixResult { original_sql: string fixed: boolean fixed_sql: string fixes_applied: FixAction[] unfixable_errors: UnfixableError[] post_fix_valid: boolean iterations: number fix_time_ms: number } // ── Policy / Guardrails ─────────────────────────────────────────────── export type PolicyCategory = 'cost_control' | 'data_protection' | 'query_patterns' | 'tag_rules' | 'custom' export type ViolationSeverity = 'error' | 'warning' | 'info' export type ViolationDetail = | { type: 'blocked_column'; table: string; column: string } | { type: 'blocked_table'; table: string } | { type: 'exceeded_limit'; metric: string; limit: number; actual: number } | { type: 'blocked_statement'; statement: string } | { type: 'blocked_pattern'; pattern: string } | { type: 'tag_violation'; tag: string; table: string; column: string } | { type: 'custom_rule'; detail: string } export interface PolicyViolation { rule: string category: PolicyCategory severity: ViolationSeverity message: string remediation?: string detail: ViolationDetail } export interface PolicyWarning { rule: string category: PolicyCategory message: string } export interface AuditEntry { timestamp: string sql_hash: string allowed: boolean violation_count: number warning_count: number policies_checked: number evaluation_time_ms: number } export interface PolicyResult { allowed: boolean violations: PolicyViolation[] warnings: PolicyWarning[] policies_evaluated: number audit: AuditEntry } // ── Lint ────────────────────────────────────────────────────────────── export type LintSeverity = 'error' | 'warning' | 'info' export interface LintFinding { code: string rule: string severity: LintSeverity message: string suggestion?: string line?: number column?: number } export interface LintResult { sql: string findings: LintFinding[] error_count: number warning_count: number clean: boolean } // ── Safety ──────────────────────────────────────────────────────────── export type SafetyRule = | 'multi_statement' | 'union_injection' | 'comment_injection' | 'transaction_escape' | 'stacked_queries' | 'tautology_attack' | 'sleep_attack' | 'info_schema_probe' | 'string_concat_predicate' | 'encoding_bypass' export type SafetySeverity = 'low' | 'medium' | 'high' | 'critical' export interface ThreatFinding { rule: SafetyRule severity: SafetySeverity message: string detail: string location?: [number, number] matched_pattern: string } export interface SafetyScanResult { safe: boolean threats: ThreatFinding[] risk_score: number statement_count: number statement_types: string[] } // ── PII ─────────────────────────────────────────────────────────────── export type PiiClassification = | 'Email' | 'Phone' | 'SSN' | 'Name' | 'Address' | 'Financial' | 'Health' | 'DateOfBirth' | 'IPAddress' | { Custom: string } | 'None' export type PiiRiskLevel = 'None' | 'Low' | 'Medium' | 'High' export interface PiiColumnResult { table: string column: string classification: PiiClassification confidence: number detection_method: string suggested_masking: string | null } export interface PiiReport { columns: PiiColumnResult[] pii_count: number total_columns: number risk_level: PiiRiskLevel } export interface PiiColumnAccess { table: string column: string classification: PiiClassification suggested_masking: string | null } export interface PiiQueryResult { accesses_pii: boolean pii_columns: PiiColumnAccess[] suggested_alternatives: string[] risk_level: PiiRiskLevel } // ── Semantic ────────────────────────────────────────────────────────── export type SemanticSeverity = 'error' | 'warning' | 'info' export interface SemanticFinding { rule: string severity: SemanticSeverity message: string explanation: string suggestion?: string confidence: number } export interface SemanticResult { valid: boolean semantic_score: number findings: SemanticFinding[] passed_checks: string[] validation_errors: string[] } // ── Cost / Complexity ───────────────────────────────────────────────── export type CostTier = 'cheap' | 'moderate' | 'expensive' | 'dangerous' | 'unknown' export type EstimationConfidence = 'high' | 'medium' | 'low' export type EstimationMethod = 'historical_median' | 'explain_corrected' | 'static_analysis' | 'mixed' export type RecommendationPriority = 'high' | 'medium' | 'low' export interface CostRange { low: number expected: number high: number } export interface TableCostBreakdown { table: string bytes_scanned: number estimated_rows: number selectivity: number has_statistics: boolean } export interface CostRecommendation { action: string detail: string estimated_savings_pct: number priority: RecommendationPriority } export interface TimeCostEstimate { estimated_execution_secs: number billable_secs: number warehouse_size: string credits: number cost_usd: number query_type: string query_type_multiplier: number } export interface CostEstimate { bytes_scanned: number cost_usd: number cost_tier: CostTier table_breakdown: TableCostBreakdown[] warnings: string[] disclaimer?: string cost_range?: CostRange recommendations?: CostRecommendation[] confidence: EstimationConfidence confidence_factors?: string[] estimation_method?: EstimationMethod time_based_cost?: TimeCostEstimate } export type ComplexityTier = 'simple' | 'moderate' | 'complex' | 'very_complex' | 'extreme' export interface DimensionScore { score: number max: number factors: string[] } export interface ComplexityFactor { name: string points: number description: string } export interface ComplexityScoreV2 { total: number structural: DimensionScore semantic: DimensionScore cost: DimensionScore tier: ComplexityTier factors: ComplexityFactor[] } // ── Equivalence ─────────────────────────────────────────────────────── export type DiffSeverity = 'structural' | 'semantic' | 'minor' export interface EquivalenceDiff { aspect: string description: string severity: DiffSeverity } export interface EquivalenceResult { equivalent: boolean confidence: number differences: EquivalenceDiff[] output_compatible: boolean validation_errors: string[] } // ── Correction ──────────────────────────────────────────────────────── export type CorrectionStatus = 'already_valid' | 'fixed' | 'partial_fix' | 'unfixable' export type IterationResult = 'fixed' | 'still_invalid' | 'new_errors' | 'skipped' export interface CorrectionIteration { iteration: number input_sql: string validation_errors: string[] fix_applied?: string fix_description?: string result: IterationResult } export interface QualityScore { syntax_valid: boolean lint_score: number safety_score: number complexity_score: number overall: number } export interface CorrectionResult { status: CorrectionStatus original_sql: string corrected_sql?: string iterations: CorrectionIteration[] final_validation?: any final_score: QualityScore total_time_ms: number } // ── Evaluation / Observability ──────────────────────────────────────── export type Grade = 'A' | 'B' | 'C' | 'D' | 'F' export interface QualityScorecard { syntax: number style: number safety: number complexity: number overall: number } export interface EvalResult { sql: string scores: QualityScorecard validation?: any lint?: any safety?: any explain?: any overall_grade: Grade total_time_ms: number } // ── Polyglot ────────────────────────────────────────────────────────── export interface TranspileResult { original_sql: string source_dialect: string target_dialect: string transpiled_sql: string[] success: boolean error?: string } export interface FormatResult { original_sql: string formatted_sql: string dialect: string success: boolean error?: string } export interface ExtractResult { tables: string[] columns: string[] functions: string[] has_subqueries: boolean has_aggregation: boolean has_window_functions: boolean node_count: number } export interface DiffEntry { change_type: string description: string } export interface CompareResult { identical: boolean diff_count: number diffs: DiffEntry[] } // ── Completion ──────────────────────────────────────────────────────── export type CompletionKind = 'table' | 'column' | 'function' | 'keyword' | 'alias' | 'join_condition' | 'schema' export interface CompletionItem { label: string kind: CompletionKind detail: string documentation?: string score: number } export interface CompletionResult { cursor_offset: number context: string items: CompletionItem[] } // ── Rewrite ─────────────────────────────────────────────────────────── export interface RewriteSuggestion { rule: string explanation: string rewritten_sql: string improvement: string confidence: number } export interface IndexSuggestion { table: string columns: string[] reason: string ddl: string } export interface RewriteResult { original_sql: string suggestions: RewriteSuggestion[] index_suggestions: IndexSuggestion[] } // ── Test Generation ─────────────────────────────────────────────────── export type TestExpectation = 'returns_rows' | 'returns_empty' | 'should_error' | { row_count: number } export interface TestInput { column: string value: string data_type: string } export interface TestCase { name: string category: string description: string inputs: TestInput[] expected: TestExpectation } export interface TestGenResult { sql: string test_cases: TestCase[] columns_analyzed: string[] tables_referenced: string[] } // ── Migration ───────────────────────────────────────────────────────── export type MigrationRisk = 'safe' | 'caution' | 'dangerous' | 'destructive' export interface MigrationFinding { risk: MigrationRisk operation: string message: string mitigation?: string rollback_sql?: string } export interface MigrationResult { sql: string overall_risk: MigrationRisk findings: MigrationFinding[] safe: boolean rollback_sql?: string } // ── dbt ─────────────────────────────────────────────────────────────── export interface DbtSourceRef { source_name: string table_name: string } export interface DbtModel { name: string path: string sql: string raw_sql: string materialization?: string description?: string refs: string[] sources: DbtSourceRef[] } export interface DbtProject { name: string models: DbtModel[] build_order: string[] warnings: string[] } // ── Lineage ─────────────────────────────────────────────────────────── export type LineageType = 'direct' | 'indirect' export type LensClassification = 'Original' | 'Alias' | 'Transformation' | 'Not sure' | 'Non select' export interface LensStep { expression: string step_type: string } export interface LineageEntry { source: string target: string lineage_type: LineageType lens_type: LensClassification lens_code: LensStep[] } export interface CompleteLineageResult { column_dict: Record<string, string[]> column_lineage: LineageEntry[] source_tables: string[] errors: string[] default_database: string | null default_schema: string | null } export interface LineageColumnRef { table: string column: string } export interface LineageEdge { source: LineageColumnRef target: LineageColumnRef transform_type: string } export interface LineageQueryInfo { source_tables: string[] target_tables: string[] edges: LineageEdge[] output_columns: string[] } export interface ImpactEntry { source: LineageColumnRef affected: LineageColumnRef[] } export interface LineageResult { queries: LineageQueryInfo[] dependency_order: string[] impact_map: ImpactEntry[] } // ── Context ─────────────────────────────────────────────────────────── export type DisclosureLevel = 'fingerprint' | 'table_list' | 'column_names' | 'full_relevant' | 'full' export interface ContextResult { compressed_schema: string level_used: DisclosureLevel estimated_tokens: number tables_included: number tables_total: number compression_ratio: number fingerprint: string } // ── Schema Diff ─────────────────────────────────────────────────────── export type SchemaChange = | { type: 'table_added'; table: string } | { type: 'table_removed'; table: string } | { type: 'column_added'; table: string; column: string; data_type: string } | { type: 'column_removed'; table: string; column: string } | { type: 'column_type_changed'; table: string; column: string; old_type: string; new_type: string } | { type: 'nullability_changed'; table: string; column: string; old_nullable: boolean; new_nullable: boolean } export interface SchemaDiff { changes: SchemaChange[] has_breaking_changes: boolean summary: string } // ── Schema Definition (pruned) ──────────────────────────────────────── export interface McvEntry { value: string frequency: number } export interface ColumnStatistics { n_distinct?: number null_fraction?: number min_value?: string max_value?: string most_common_values?: McvEntry[] avg_bytes?: number compression_ratio?: number } export interface ForeignKeyRef { table: string columns: string[] } export interface ForeignKeyDef { columns: string[] references: ForeignKeyRef } export interface TableStatistics { row_count?: number avg_row_bytes?: number partitioned?: boolean partition_columns?: string[] correlated_columns?: string[][] partition_count?: number total_bytes?: number historical_scan_median?: number } export interface ColumnDef { name: string type: string nullable: boolean description?: string tags?: string[] synonyms?: string[] statistics?: ColumnStatistics } export interface TableDef { description?: string database?: string schema?: string columns: ColumnDef[] primary_key?: string[] foreign_keys?: ForeignKeyDef[] statistics?: TableStatistics clustering_keys?: string[] } export interface SchemaDefinition { version: string dialect: string database: string | null schema_name: string | null tables: Record<string, TableDef> glossary?: any } // ── Introspection ───────────────────────────────────────────────────── export interface IntrospectionSql { database_type: string columns_query: string primary_keys_query: string foreign_keys_query: string } // ── Glossary ────────────────────────────────────────────────────────── export interface ColumnReference { table: string column: string } export type MatchSource = 'ExactTerm' | 'Synonym' | 'Description' | 'FuzzyName' | 'ColumnSynonym' export interface GlossaryMatch { term: string matched_column: ColumnReference | null matched_definition: string | null confidence: number source: MatchSource }/**
|
|
1
|
+
// ── sqlguard TypeScript type definitions ──────────────────────────────
|
|
2
|
+
// These interfaces mirror the JSON shapes returned by sqlguard-core.
|
|
3
|
+
// All field names are snake_case (Rust default serialization).
|
|
4
|
+
|
|
5
|
+
// ── Shared / Utility ──────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export interface SourceLocation {
|
|
8
|
+
line: number
|
|
9
|
+
column: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ── Validation ────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
export type ErrorCode = 'E000' | 'E001' | 'E002' | 'E003' | 'E004' | 'E005' | 'E006' | 'E099'
|
|
15
|
+
|
|
16
|
+
export type ErrorKind =
|
|
17
|
+
| { type: 'SyntaxError' }
|
|
18
|
+
| { type: 'TableNotFound'; table: string }
|
|
19
|
+
| { type: 'ColumnNotFound'; table: string | null; column: string }
|
|
20
|
+
| { type: 'TypeMismatch'; expected: string; found: string }
|
|
21
|
+
| { type: 'AmbiguousColumn'; column: string; candidates: string[] }
|
|
22
|
+
| { type: 'InvalidJoin'; reason: string }
|
|
23
|
+
| { type: 'UnsupportedDialectFeature'; feature: string; dialect: string }
|
|
24
|
+
| { type: 'Other'; detail: string }
|
|
25
|
+
|
|
26
|
+
export type SuggestionKind =
|
|
27
|
+
| { type: 'DidYouMean'; name: string }
|
|
28
|
+
| { type: 'AddQualification'; qualified: string }
|
|
29
|
+
| { type: 'UseAlternative'; alternative: string }
|
|
30
|
+
|
|
31
|
+
export interface Suggestion {
|
|
32
|
+
kind: SuggestionKind
|
|
33
|
+
message: string
|
|
34
|
+
confidence: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ValidationError {
|
|
38
|
+
code: ErrorCode
|
|
39
|
+
kind: ErrorKind
|
|
40
|
+
message: string
|
|
41
|
+
location: SourceLocation | null
|
|
42
|
+
suggestions: Suggestion[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ValidationWarning {
|
|
46
|
+
code: string
|
|
47
|
+
message: string
|
|
48
|
+
location: SourceLocation | null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type Complexity = 'low' | 'medium' | 'high'
|
|
52
|
+
|
|
53
|
+
export interface QueryMetadata {
|
|
54
|
+
tables_referenced: string[]
|
|
55
|
+
join_count: number
|
|
56
|
+
has_aggregation: boolean
|
|
57
|
+
has_subquery: boolean
|
|
58
|
+
complexity: Complexity
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ValidationResult {
|
|
62
|
+
valid: boolean
|
|
63
|
+
errors: ValidationError[]
|
|
64
|
+
warnings: ValidationWarning[]
|
|
65
|
+
metadata: QueryMetadata
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── Explanation ───────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
export type JoinKind =
|
|
71
|
+
| 'inner' | 'left' | 'right' | 'full' | 'cross'
|
|
72
|
+
| 'left_semi' | 'left_anti' | 'right_semi' | 'right_anti'
|
|
73
|
+
|
|
74
|
+
export interface SortKey {
|
|
75
|
+
column: string
|
|
76
|
+
direction: 'asc' | 'desc'
|
|
77
|
+
nulls_first: boolean
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type PlanOperation =
|
|
81
|
+
| { type: 'table_scan'; table: string; columns_read: string[]; filters: string[] }
|
|
82
|
+
| { type: 'join'; join_type: JoinKind; left: string; right: string; condition: string }
|
|
83
|
+
| { type: 'filter'; predicate: string }
|
|
84
|
+
| { type: 'aggregate'; group_by: string[]; functions: string[] }
|
|
85
|
+
| { type: 'sort'; order_by: SortKey[] }
|
|
86
|
+
| { type: 'limit'; limit?: number; offset?: number }
|
|
87
|
+
| { type: 'projection'; columns: string[] }
|
|
88
|
+
| { type: 'window'; function: string; partition_by: string[]; order_by: string[] }
|
|
89
|
+
| { type: 'subquery'; alias: string; inner_steps: PlanStep[] }
|
|
90
|
+
| { type: 'union'; all: boolean; branches: number }
|
|
91
|
+
| { type: 'distinct' }
|
|
92
|
+
| { type: 'empty_relation' }
|
|
93
|
+
|
|
94
|
+
export interface PlanStep {
|
|
95
|
+
step: number
|
|
96
|
+
operation: PlanOperation
|
|
97
|
+
notes?: string
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ColumnRef {
|
|
101
|
+
table: string
|
|
102
|
+
column: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type ColumnSource =
|
|
106
|
+
| { type: 'direct_ref'; table: string; column: string }
|
|
107
|
+
| { type: 'aggregation'; function: string }
|
|
108
|
+
| { type: 'expression'; expr: string }
|
|
109
|
+
| { type: 'window_function'; function: string }
|
|
110
|
+
| { type: 'literal'; value: string }
|
|
111
|
+
|
|
112
|
+
export interface OutputColumn {
|
|
113
|
+
alias: string
|
|
114
|
+
source: ColumnSource
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface JoinEdge {
|
|
118
|
+
left_table: string
|
|
119
|
+
right_table: string
|
|
120
|
+
join_type: JoinKind
|
|
121
|
+
on_columns: [string, string][]
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface QueryLineage {
|
|
125
|
+
tables: string[]
|
|
126
|
+
columns_read: ColumnRef[]
|
|
127
|
+
columns_output: OutputColumn[]
|
|
128
|
+
join_graph: JoinEdge[]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type QueryComplexity = 'low' | 'moderate' | 'high' | 'extreme'
|
|
132
|
+
export type RiskSeverity = 'info' | 'warning' | 'critical'
|
|
133
|
+
|
|
134
|
+
export interface RiskFlag {
|
|
135
|
+
severity: RiskSeverity
|
|
136
|
+
flag: string
|
|
137
|
+
detail: string
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type SuggestionType =
|
|
141
|
+
| 'add_filter' | 'add_limit' | 'avoid_cross_join' | 'remove_select_star'
|
|
142
|
+
| 'use_specific_columns' | 'remove_redundant_distinct' | 'consider_index'
|
|
143
|
+
|
|
144
|
+
export type SuggestionPriority = 'low' | 'medium' | 'high'
|
|
145
|
+
|
|
146
|
+
export interface OptimizationSuggestion {
|
|
147
|
+
kind: SuggestionType
|
|
148
|
+
message: string
|
|
149
|
+
priority: SuggestionPriority
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface CostSignals {
|
|
153
|
+
complexity: QueryComplexity
|
|
154
|
+
complexity_score: number
|
|
155
|
+
join_count: number
|
|
156
|
+
has_aggregation: boolean
|
|
157
|
+
has_subquery: boolean
|
|
158
|
+
has_window_function: boolean
|
|
159
|
+
has_limit: boolean
|
|
160
|
+
has_cross_join: boolean
|
|
161
|
+
uses_select_star: boolean
|
|
162
|
+
has_distinct: boolean
|
|
163
|
+
has_union: boolean
|
|
164
|
+
table_count: number
|
|
165
|
+
filter_count: number
|
|
166
|
+
unfiltered_scans: string[]
|
|
167
|
+
risk_flags: RiskFlag[]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface QueryExplanation {
|
|
171
|
+
summary: string
|
|
172
|
+
plan_steps: PlanStep[]
|
|
173
|
+
lineage: QueryLineage
|
|
174
|
+
cost_signals: CostSignals
|
|
175
|
+
suggestions: OptimizationSuggestion[]
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface ValidationSummary {
|
|
179
|
+
error_count: number
|
|
180
|
+
warning_count: number
|
|
181
|
+
errors: ValidationError[]
|
|
182
|
+
warnings: ValidationWarning[]
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface AnalysisMetadata {
|
|
186
|
+
dialect: string
|
|
187
|
+
plan_node_count: number
|
|
188
|
+
analysis_time_ms: number
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface ExplanationResult {
|
|
192
|
+
valid: boolean
|
|
193
|
+
explanation?: QueryExplanation
|
|
194
|
+
validation: ValidationSummary
|
|
195
|
+
metadata: AnalysisMetadata
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ── Fix ───────────────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
export type FixActionType =
|
|
201
|
+
| 'replace_table' | 'replace_column' | 'qualify_column'
|
|
202
|
+
| 'remove_alias' | 'add_alias' | 'use_alternative'
|
|
203
|
+
|
|
204
|
+
export interface FixAction {
|
|
205
|
+
action: FixActionType
|
|
206
|
+
original: string
|
|
207
|
+
replacement: string
|
|
208
|
+
confidence: number
|
|
209
|
+
explanation: string
|
|
210
|
+
location?: SourceLocation
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface UnfixableError {
|
|
214
|
+
error: ValidationError
|
|
215
|
+
reason: string
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface FixResult {
|
|
219
|
+
original_sql: string
|
|
220
|
+
fixed: boolean
|
|
221
|
+
fixed_sql: string
|
|
222
|
+
fixes_applied: FixAction[]
|
|
223
|
+
unfixable_errors: UnfixableError[]
|
|
224
|
+
post_fix_valid: boolean
|
|
225
|
+
iterations: number
|
|
226
|
+
fix_time_ms: number
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ── Policy / Guardrails ───────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
export type PolicyCategory = 'cost_control' | 'data_protection' | 'query_patterns' | 'tag_rules' | 'custom'
|
|
232
|
+
export type ViolationSeverity = 'error' | 'warning' | 'info'
|
|
233
|
+
|
|
234
|
+
export type ViolationDetail =
|
|
235
|
+
| { type: 'blocked_column'; table: string; column: string }
|
|
236
|
+
| { type: 'blocked_table'; table: string }
|
|
237
|
+
| { type: 'exceeded_limit'; metric: string; limit: number; actual: number }
|
|
238
|
+
| { type: 'blocked_statement'; statement: string }
|
|
239
|
+
| { type: 'blocked_pattern'; pattern: string }
|
|
240
|
+
| { type: 'tag_violation'; tag: string; table: string; column: string }
|
|
241
|
+
| { type: 'custom_rule'; detail: string }
|
|
242
|
+
|
|
243
|
+
export interface PolicyViolation {
|
|
244
|
+
rule: string
|
|
245
|
+
category: PolicyCategory
|
|
246
|
+
severity: ViolationSeverity
|
|
247
|
+
message: string
|
|
248
|
+
remediation?: string
|
|
249
|
+
detail: ViolationDetail
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface PolicyWarning {
|
|
253
|
+
rule: string
|
|
254
|
+
category: PolicyCategory
|
|
255
|
+
message: string
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface AuditEntry {
|
|
259
|
+
timestamp: string
|
|
260
|
+
sql_hash: string
|
|
261
|
+
allowed: boolean
|
|
262
|
+
violation_count: number
|
|
263
|
+
warning_count: number
|
|
264
|
+
policies_checked: number
|
|
265
|
+
evaluation_time_ms: number
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface PolicyResult {
|
|
269
|
+
allowed: boolean
|
|
270
|
+
violations: PolicyViolation[]
|
|
271
|
+
warnings: PolicyWarning[]
|
|
272
|
+
policies_evaluated: number
|
|
273
|
+
audit: AuditEntry
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// ── Lint ──────────────────────────────────────────────────────────────
|
|
277
|
+
|
|
278
|
+
export type LintSeverity = 'error' | 'warning' | 'info'
|
|
279
|
+
|
|
280
|
+
export interface LintFinding {
|
|
281
|
+
code: string
|
|
282
|
+
rule: string
|
|
283
|
+
severity: LintSeverity
|
|
284
|
+
message: string
|
|
285
|
+
suggestion?: string
|
|
286
|
+
line?: number
|
|
287
|
+
column?: number
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface LintResult {
|
|
291
|
+
sql: string
|
|
292
|
+
findings: LintFinding[]
|
|
293
|
+
error_count: number
|
|
294
|
+
warning_count: number
|
|
295
|
+
clean: boolean
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// ── Safety ────────────────────────────────────────────────────────────
|
|
299
|
+
|
|
300
|
+
export type SafetyRule =
|
|
301
|
+
| 'multi_statement' | 'union_injection' | 'comment_injection' | 'transaction_escape'
|
|
302
|
+
| 'stacked_queries' | 'tautology_attack' | 'sleep_attack' | 'info_schema_probe'
|
|
303
|
+
| 'string_concat_predicate' | 'encoding_bypass'
|
|
304
|
+
|
|
305
|
+
export type SafetySeverity = 'low' | 'medium' | 'high' | 'critical'
|
|
306
|
+
|
|
307
|
+
export interface ThreatFinding {
|
|
308
|
+
rule: SafetyRule
|
|
309
|
+
severity: SafetySeverity
|
|
310
|
+
message: string
|
|
311
|
+
detail: string
|
|
312
|
+
location?: [number, number]
|
|
313
|
+
matched_pattern: string
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface SafetyScanResult {
|
|
317
|
+
safe: boolean
|
|
318
|
+
threats: ThreatFinding[]
|
|
319
|
+
risk_score: number
|
|
320
|
+
statement_count: number
|
|
321
|
+
statement_types: string[]
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// ── PII ───────────────────────────────────────────────────────────────
|
|
325
|
+
|
|
326
|
+
export type PiiClassification =
|
|
327
|
+
| 'Email' | 'Phone' | 'SSN' | 'Name' | 'Address'
|
|
328
|
+
| 'Financial' | 'Health' | 'DateOfBirth' | 'IPAddress'
|
|
329
|
+
| { Custom: string } | 'None'
|
|
330
|
+
|
|
331
|
+
export type PiiRiskLevel = 'None' | 'Low' | 'Medium' | 'High'
|
|
332
|
+
|
|
333
|
+
export interface PiiColumnResult {
|
|
334
|
+
table: string
|
|
335
|
+
column: string
|
|
336
|
+
classification: PiiClassification
|
|
337
|
+
confidence: number
|
|
338
|
+
detection_method: string
|
|
339
|
+
suggested_masking: string | null
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export interface PiiReport {
|
|
343
|
+
columns: PiiColumnResult[]
|
|
344
|
+
pii_count: number
|
|
345
|
+
total_columns: number
|
|
346
|
+
risk_level: PiiRiskLevel
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface PiiColumnAccess {
|
|
350
|
+
table: string
|
|
351
|
+
column: string
|
|
352
|
+
classification: PiiClassification
|
|
353
|
+
suggested_masking: string | null
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface PiiQueryResult {
|
|
357
|
+
accesses_pii: boolean
|
|
358
|
+
pii_columns: PiiColumnAccess[]
|
|
359
|
+
suggested_alternatives: string[]
|
|
360
|
+
risk_level: PiiRiskLevel
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// ── Semantic ──────────────────────────────────────────────────────────
|
|
364
|
+
|
|
365
|
+
export type SemanticSeverity = 'error' | 'warning' | 'info'
|
|
366
|
+
|
|
367
|
+
export interface SemanticFinding {
|
|
368
|
+
rule: string
|
|
369
|
+
severity: SemanticSeverity
|
|
370
|
+
message: string
|
|
371
|
+
explanation: string
|
|
372
|
+
suggestion?: string
|
|
373
|
+
confidence: number
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface SemanticResult {
|
|
377
|
+
valid: boolean
|
|
378
|
+
semantic_score: number
|
|
379
|
+
findings: SemanticFinding[]
|
|
380
|
+
passed_checks: string[]
|
|
381
|
+
validation_errors: string[]
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ── Equivalence ───────────────────────────────────────────────────────
|
|
385
|
+
|
|
386
|
+
export type DiffSeverity = 'structural' | 'semantic' | 'minor'
|
|
387
|
+
|
|
388
|
+
export interface EquivalenceDiff {
|
|
389
|
+
aspect: string
|
|
390
|
+
description: string
|
|
391
|
+
severity: DiffSeverity
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface EquivalenceResult {
|
|
395
|
+
equivalent: boolean
|
|
396
|
+
confidence: number
|
|
397
|
+
differences: EquivalenceDiff[]
|
|
398
|
+
output_compatible: boolean
|
|
399
|
+
validation_errors: string[]
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// ── Correction ────────────────────────────────────────────────────────
|
|
403
|
+
|
|
404
|
+
export type CorrectionStatus = 'already_valid' | 'fixed' | 'partial_fix' | 'unfixable'
|
|
405
|
+
export type IterationResult = 'fixed' | 'still_invalid' | 'new_errors' | 'skipped'
|
|
406
|
+
|
|
407
|
+
export interface CorrectionIteration {
|
|
408
|
+
iteration: number
|
|
409
|
+
input_sql: string
|
|
410
|
+
validation_errors: string[]
|
|
411
|
+
fix_applied?: string
|
|
412
|
+
fix_description?: string
|
|
413
|
+
result: IterationResult
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface QualityScore {
|
|
417
|
+
syntax_valid: boolean
|
|
418
|
+
lint_score: number
|
|
419
|
+
safety_score: number
|
|
420
|
+
complexity_score: number
|
|
421
|
+
overall: number
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface CorrectionResult {
|
|
425
|
+
status: CorrectionStatus
|
|
426
|
+
original_sql: string
|
|
427
|
+
corrected_sql?: string
|
|
428
|
+
iterations: CorrectionIteration[]
|
|
429
|
+
final_validation?: any
|
|
430
|
+
final_score: QualityScore
|
|
431
|
+
total_time_ms: number
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// ── Evaluation / Observability ────────────────────────────────────────
|
|
435
|
+
|
|
436
|
+
export type Grade = 'A' | 'B' | 'C' | 'D' | 'F'
|
|
437
|
+
|
|
438
|
+
export interface QualityScorecard {
|
|
439
|
+
syntax: number
|
|
440
|
+
style: number
|
|
441
|
+
safety: number
|
|
442
|
+
complexity: number
|
|
443
|
+
overall: number
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface EvalResult {
|
|
447
|
+
sql: string
|
|
448
|
+
scores: QualityScorecard
|
|
449
|
+
validation?: any
|
|
450
|
+
lint?: any
|
|
451
|
+
safety?: any
|
|
452
|
+
explain?: any
|
|
453
|
+
overall_grade: Grade
|
|
454
|
+
total_time_ms: number
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// ── Polyglot ──────────────────────────────────────────────────────────
|
|
458
|
+
|
|
459
|
+
export interface TranspileResult {
|
|
460
|
+
original_sql: string
|
|
461
|
+
source_dialect: string
|
|
462
|
+
target_dialect: string
|
|
463
|
+
transpiled_sql: string[]
|
|
464
|
+
success: boolean
|
|
465
|
+
error?: string
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface FormatResult {
|
|
469
|
+
original_sql: string
|
|
470
|
+
formatted_sql: string
|
|
471
|
+
dialect: string
|
|
472
|
+
success: boolean
|
|
473
|
+
error?: string
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface ExtractResult {
|
|
477
|
+
tables: string[]
|
|
478
|
+
columns: string[]
|
|
479
|
+
functions: string[]
|
|
480
|
+
has_subqueries: boolean
|
|
481
|
+
has_aggregation: boolean
|
|
482
|
+
has_window_functions: boolean
|
|
483
|
+
node_count: number
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface DiffEntry {
|
|
487
|
+
change_type: string
|
|
488
|
+
description: string
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface CompareResult {
|
|
492
|
+
identical: boolean
|
|
493
|
+
diff_count: number
|
|
494
|
+
diffs: DiffEntry[]
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// ── Completion ────────────────────────────────────────────────────────
|
|
498
|
+
|
|
499
|
+
export type CompletionKind = 'table' | 'column' | 'function' | 'keyword' | 'alias' | 'join_condition' | 'schema'
|
|
500
|
+
|
|
501
|
+
export interface CompletionItem {
|
|
502
|
+
label: string
|
|
503
|
+
kind: CompletionKind
|
|
504
|
+
detail: string
|
|
505
|
+
documentation?: string
|
|
506
|
+
score: number
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export interface CompletionResult {
|
|
510
|
+
cursor_offset: number
|
|
511
|
+
context: string
|
|
512
|
+
items: CompletionItem[]
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// ── Rewrite ───────────────────────────────────────────────────────────
|
|
516
|
+
|
|
517
|
+
export interface RewriteSuggestion {
|
|
518
|
+
rule: string
|
|
519
|
+
explanation: string
|
|
520
|
+
rewritten_sql: string
|
|
521
|
+
improvement: string
|
|
522
|
+
confidence: number
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface IndexSuggestion {
|
|
526
|
+
table: string
|
|
527
|
+
columns: string[]
|
|
528
|
+
reason: string
|
|
529
|
+
ddl: string
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface RewriteResult {
|
|
533
|
+
original_sql: string
|
|
534
|
+
suggestions: RewriteSuggestion[]
|
|
535
|
+
index_suggestions: IndexSuggestion[]
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// ── Test Generation ───────────────────────────────────────────────────
|
|
539
|
+
|
|
540
|
+
export type TestExpectation = 'returns_rows' | 'returns_empty' | 'should_error' | { row_count: number }
|
|
541
|
+
|
|
542
|
+
export interface TestInput {
|
|
543
|
+
column: string
|
|
544
|
+
value: string
|
|
545
|
+
data_type: string
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export interface TestCase {
|
|
549
|
+
name: string
|
|
550
|
+
category: string
|
|
551
|
+
description: string
|
|
552
|
+
inputs: TestInput[]
|
|
553
|
+
expected: TestExpectation
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export interface TestGenResult {
|
|
557
|
+
sql: string
|
|
558
|
+
test_cases: TestCase[]
|
|
559
|
+
columns_analyzed: string[]
|
|
560
|
+
tables_referenced: string[]
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// ── Migration ─────────────────────────────────────────────────────────
|
|
564
|
+
|
|
565
|
+
export type MigrationRisk = 'safe' | 'caution' | 'dangerous' | 'destructive'
|
|
566
|
+
|
|
567
|
+
export interface MigrationFinding {
|
|
568
|
+
risk: MigrationRisk
|
|
569
|
+
operation: string
|
|
570
|
+
message: string
|
|
571
|
+
mitigation?: string
|
|
572
|
+
rollback_sql?: string
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export interface MigrationResult {
|
|
576
|
+
sql: string
|
|
577
|
+
overall_risk: MigrationRisk
|
|
578
|
+
findings: MigrationFinding[]
|
|
579
|
+
safe: boolean
|
|
580
|
+
rollback_sql?: string
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// ── dbt ───────────────────────────────────────────────────────────────
|
|
584
|
+
|
|
585
|
+
export interface DbtSourceRef {
|
|
586
|
+
source_name: string
|
|
587
|
+
table_name: string
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export interface DbtModel {
|
|
591
|
+
name: string
|
|
592
|
+
path: string
|
|
593
|
+
sql: string
|
|
594
|
+
raw_sql: string
|
|
595
|
+
materialization?: string
|
|
596
|
+
description?: string
|
|
597
|
+
refs: string[]
|
|
598
|
+
sources: DbtSourceRef[]
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export interface DbtProject {
|
|
602
|
+
name: string
|
|
603
|
+
models: DbtModel[]
|
|
604
|
+
build_order: string[]
|
|
605
|
+
warnings: string[]
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// ── Lineage ───────────────────────────────────────────────────────────
|
|
609
|
+
|
|
610
|
+
export type LineageType = 'direct' | 'indirect'
|
|
611
|
+
export type LensClassification = 'Original' | 'Alias' | 'Transformation' | 'Not sure' | 'Non select'
|
|
612
|
+
|
|
613
|
+
export interface LensStep {
|
|
614
|
+
expression: string
|
|
615
|
+
step_type: string
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface LineageEntry {
|
|
619
|
+
source: string
|
|
620
|
+
target: string
|
|
621
|
+
lineage_type: LineageType
|
|
622
|
+
lens_type: LensClassification
|
|
623
|
+
lens_code: LensStep[]
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface CompleteLineageResult {
|
|
627
|
+
column_dict: Record<string, string[]>
|
|
628
|
+
column_lineage: LineageEntry[]
|
|
629
|
+
source_tables: string[]
|
|
630
|
+
errors: string[]
|
|
631
|
+
default_database: string | null
|
|
632
|
+
default_schema: string | null
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export interface LineageColumnRef {
|
|
636
|
+
table: string
|
|
637
|
+
column: string
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export interface LineageEdge {
|
|
641
|
+
source: LineageColumnRef
|
|
642
|
+
target: LineageColumnRef
|
|
643
|
+
transform_type: string
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export interface LineageQueryInfo {
|
|
647
|
+
source_tables: string[]
|
|
648
|
+
target_tables: string[]
|
|
649
|
+
edges: LineageEdge[]
|
|
650
|
+
output_columns: string[]
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export interface ImpactEntry {
|
|
654
|
+
source: LineageColumnRef
|
|
655
|
+
affected: LineageColumnRef[]
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
export interface LineageResult {
|
|
659
|
+
queries: LineageQueryInfo[]
|
|
660
|
+
dependency_order: string[]
|
|
661
|
+
impact_map: ImpactEntry[]
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// ── Context ───────────────────────────────────────────────────────────
|
|
665
|
+
|
|
666
|
+
export type DisclosureLevel = 'fingerprint' | 'table_list' | 'column_names' | 'full_relevant' | 'full'
|
|
667
|
+
|
|
668
|
+
export interface ContextResult {
|
|
669
|
+
compressed_schema: string
|
|
670
|
+
level_used: DisclosureLevel
|
|
671
|
+
estimated_tokens: number
|
|
672
|
+
tables_included: number
|
|
673
|
+
tables_total: number
|
|
674
|
+
compression_ratio: number
|
|
675
|
+
fingerprint: string
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// ── Schema Diff ───────────────────────────────────────────────────────
|
|
679
|
+
|
|
680
|
+
export type SchemaChange =
|
|
681
|
+
| { type: 'table_added'; table: string }
|
|
682
|
+
| { type: 'table_removed'; table: string }
|
|
683
|
+
| { type: 'column_added'; table: string; column: string; data_type: string }
|
|
684
|
+
| { type: 'column_removed'; table: string; column: string }
|
|
685
|
+
| { type: 'column_type_changed'; table: string; column: string; old_type: string; new_type: string }
|
|
686
|
+
| { type: 'nullability_changed'; table: string; column: string; old_nullable: boolean; new_nullable: boolean }
|
|
687
|
+
|
|
688
|
+
export interface SchemaDiff {
|
|
689
|
+
changes: SchemaChange[]
|
|
690
|
+
has_breaking_changes: boolean
|
|
691
|
+
summary: string
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// ── Schema Definition (pruned) ────────────────────────────────────────
|
|
695
|
+
|
|
696
|
+
export interface McvEntry {
|
|
697
|
+
value: string
|
|
698
|
+
frequency: number
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export interface ColumnStatistics {
|
|
702
|
+
n_distinct?: number
|
|
703
|
+
null_fraction?: number
|
|
704
|
+
min_value?: string
|
|
705
|
+
max_value?: string
|
|
706
|
+
most_common_values?: McvEntry[]
|
|
707
|
+
avg_bytes?: number
|
|
708
|
+
compression_ratio?: number
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export interface ForeignKeyRef {
|
|
712
|
+
table: string
|
|
713
|
+
columns: string[]
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
export interface ForeignKeyDef {
|
|
717
|
+
columns: string[]
|
|
718
|
+
references: ForeignKeyRef
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export interface TableStatistics {
|
|
722
|
+
row_count?: number
|
|
723
|
+
avg_row_bytes?: number
|
|
724
|
+
partitioned?: boolean
|
|
725
|
+
partition_columns?: string[]
|
|
726
|
+
correlated_columns?: string[][]
|
|
727
|
+
partition_count?: number
|
|
728
|
+
total_bytes?: number
|
|
729
|
+
historical_scan_median?: number
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
export interface ColumnDef {
|
|
733
|
+
name: string
|
|
734
|
+
type: string
|
|
735
|
+
nullable: boolean
|
|
736
|
+
description?: string
|
|
737
|
+
tags?: string[]
|
|
738
|
+
synonyms?: string[]
|
|
739
|
+
statistics?: ColumnStatistics
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
export interface TableDef {
|
|
743
|
+
description?: string
|
|
744
|
+
database?: string
|
|
745
|
+
schema?: string
|
|
746
|
+
columns: ColumnDef[]
|
|
747
|
+
primary_key?: string[]
|
|
748
|
+
foreign_keys?: ForeignKeyDef[]
|
|
749
|
+
statistics?: TableStatistics
|
|
750
|
+
clustering_keys?: string[]
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export interface SchemaDefinition {
|
|
754
|
+
version: string
|
|
755
|
+
dialect: string
|
|
756
|
+
database: string | null
|
|
757
|
+
schema_name: string | null
|
|
758
|
+
tables: Record<string, TableDef>
|
|
759
|
+
glossary?: any
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// ── Introspection ─────────────────────────────────────────────────────
|
|
763
|
+
|
|
764
|
+
export interface IntrospectionSql {
|
|
765
|
+
database_type: string
|
|
766
|
+
columns_query: string
|
|
767
|
+
primary_keys_query: string
|
|
768
|
+
foreign_keys_query: string
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// ── Glossary ──────────────────────────────────────────────────────────
|
|
772
|
+
|
|
773
|
+
export interface ColumnReference {
|
|
774
|
+
table: string
|
|
775
|
+
column: string
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
export type MatchSource = 'ExactTerm' | 'Synonym' | 'Description' | 'FuzzyName' | 'ColumnSynonym'
|
|
779
|
+
|
|
780
|
+
export interface GlossaryMatch {
|
|
781
|
+
term: string
|
|
782
|
+
matched_column: ColumnReference | null
|
|
783
|
+
matched_definition: string | null
|
|
784
|
+
confidence: number
|
|
785
|
+
source: MatchSource
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
2
789
|
* Schema definition for SQL validation.
|
|
3
790
|
*
|
|
4
791
|
* Load from YAML, JSON, file, or DDL. Pass to validation functions.
|
|
@@ -61,28 +848,12 @@ export declare function compareQueries(leftSql: string, rightSql: string, dialec
|
|
|
61
848
|
/** SQL completion engine: suggest tables, columns, functions, keywords at cursor position. */
|
|
62
849
|
export declare function complete(sql: string, cursorPos: number, schema: Schema): CompletionResult
|
|
63
850
|
|
|
64
|
-
/**
|
|
65
|
-
* Compute a multi-dimensional complexity score (0-100) for a SQL query.
|
|
66
|
-
*
|
|
67
|
-
* Combines structural, semantic, and cost dimensions. Returns tier classification
|
|
68
|
-
* (Trivial, Simple, Moderate, Complex, VeryComplex).
|
|
69
|
-
*/
|
|
70
|
-
export declare function complexityScore(sql: string, schema: Schema): Promise<ComplexityScoreV2>
|
|
71
|
-
|
|
72
851
|
/** Iterative correction protocol: propose-verify-refine loop. */
|
|
73
852
|
export declare function correct(sql: string, schema: Schema): Promise<CorrectionResult>
|
|
74
853
|
|
|
75
854
|
/** Diff two schemas with breaking change detection. */
|
|
76
855
|
export declare function diffSchemas(oldSchema: Schema, newSchema: Schema): SchemaDiff
|
|
77
856
|
|
|
78
|
-
/**
|
|
79
|
-
* Estimate bytes scanned and USD cost for a SQL query.
|
|
80
|
-
*
|
|
81
|
-
* Internally runs `explain` to get plan steps, then feeds them to the cost
|
|
82
|
-
* estimator. The `dialect` determines pricing model (BigQuery, Snowflake, etc.).
|
|
83
|
-
*/
|
|
84
|
-
export declare function estimateCost(sql: string, schema: Schema, dialect?: string | undefined | null): Promise<CostEstimate>
|
|
85
|
-
|
|
86
857
|
/** SQL quality scoring and grading (A-F scale). */
|
|
87
858
|
export declare function evaluate(sql: string, schema: Schema): Promise<EvalResult>
|
|
88
859
|
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@altimateai/altimate-core-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@altimateai/altimate-core-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@altimateai/altimate-core-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@altimateai/altimate-core-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@altimateai/altimate-core-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@altimateai/altimate-core-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@altimateai/altimate-core-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@altimateai/altimate-core-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@altimateai/altimate-core-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@altimateai/altimate-core-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@altimateai/altimate-core-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@altimateai/altimate-core-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@altimateai/altimate-core-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@altimateai/altimate-core-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@altimateai/altimate-core-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@altimateai/altimate-core-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@altimateai/altimate-core-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@altimateai/altimate-core-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@altimateai/altimate-core-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@altimateai/altimate-core-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@altimateai/altimate-core-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@altimateai/altimate-core-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@altimateai/altimate-core-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@altimateai/altimate-core-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@altimateai/altimate-core-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@altimateai/altimate-core-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@altimateai/altimate-core-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@altimateai/altimate-core-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@altimateai/altimate-core-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@altimateai/altimate-core-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@altimateai/altimate-core-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@altimateai/altimate-core-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@altimateai/altimate-core-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@altimateai/altimate-core-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@altimateai/altimate-core-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@altimateai/altimate-core-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@altimateai/altimate-core-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@altimateai/altimate-core-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@altimateai/altimate-core-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@altimateai/altimate-core-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@altimateai/altimate-core-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -586,10 +586,8 @@ module.exports.classifyPii = nativeBinding.classifyPii
|
|
|
586
586
|
module.exports.columnLineage = nativeBinding.columnLineage
|
|
587
587
|
module.exports.compareQueries = nativeBinding.compareQueries
|
|
588
588
|
module.exports.complete = nativeBinding.complete
|
|
589
|
-
module.exports.complexityScore = nativeBinding.complexityScore
|
|
590
589
|
module.exports.correct = nativeBinding.correct
|
|
591
590
|
module.exports.diffSchemas = nativeBinding.diffSchemas
|
|
592
|
-
module.exports.estimateCost = nativeBinding.estimateCost
|
|
593
591
|
module.exports.evaluate = nativeBinding.evaluate
|
|
594
592
|
module.exports.explain = nativeBinding.explain
|
|
595
593
|
module.exports.exportDdl = nativeBinding.exportDdl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altimateai/altimate-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Type-check your SQL. No database required.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"url": "https://github.com/AltimateAI/altimate-core"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "napi build --release --platform --dts-header \"
|
|
34
|
-
"build:debug": "napi build --platform --dts-header \"
|
|
33
|
+
"build": "napi build --release --platform --no-dts-header && node -e \"const fs=require('fs');const h=fs.readFileSync('types-preamble.d.ts','utf8');const g=fs.readFileSync('index.d.ts','utf8');fs.writeFileSync('index.d.ts',h+'\\n'+g)\"",
|
|
34
|
+
"build:debug": "napi build --platform --no-dts-header && node -e \"const fs=require('fs');const h=fs.readFileSync('types-preamble.d.ts','utf8');const g=fs.readFileSync('index.d.ts','utf8');fs.writeFileSync('index.d.ts',h+'\\n'+g)\""
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@altimateai/altimate-core-darwin-arm64": "0.1.
|
|
38
|
-
"@altimateai/altimate-core-darwin-x64": "0.1.
|
|
39
|
-
"@altimateai/altimate-core-linux-arm64-gnu": "0.1.
|
|
40
|
-
"@altimateai/altimate-core-linux-x64-gnu": "0.1.
|
|
41
|
-
"@altimateai/altimate-core-win32-x64-msvc": "0.1.
|
|
37
|
+
"@altimateai/altimate-core-darwin-arm64": "0.1.6",
|
|
38
|
+
"@altimateai/altimate-core-darwin-x64": "0.1.6",
|
|
39
|
+
"@altimateai/altimate-core-linux-arm64-gnu": "0.1.6",
|
|
40
|
+
"@altimateai/altimate-core-linux-x64-gnu": "0.1.6",
|
|
41
|
+
"@altimateai/altimate-core-win32-x64-msvc": "0.1.6"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@napi-rs/cli": "^3"
|