@polyglot-sql/sdk 0.4.4 → 0.5.1

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/dist/index.d.cts CHANGED
@@ -593,6 +593,18 @@ declare type AnalyzeListChainedRows = {
593
593
  expression: Expression | null;
594
594
  };
595
595
 
596
+ /**
597
+ * Return compact query analysis facts for a SELECT or set operation.
598
+ */
599
+ export declare function analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
600
+
601
+ export declare interface AnalyzeQueryOptions {
602
+ /** Dialect used for parsing and dialect-aware rendering */
603
+ dialect?: Dialect | string;
604
+ /** Optional schema used for qualification and type annotation */
605
+ schema?: Schema;
606
+ }
607
+
596
608
  /**
597
609
  * AnalyzeSample
598
610
  */
@@ -1817,6 +1829,16 @@ declare type ColumnPrefix = {
1817
1829
  expression: Expression;
1818
1830
  };
1819
1831
 
1832
+ export declare interface ColumnReferenceFact {
1833
+ sourceName?: string;
1834
+ sourceAlias?: string;
1835
+ sourceKind: QueryAnalysisSourceKind;
1836
+ table?: string;
1837
+ column: string;
1838
+ unqualified: boolean;
1839
+ confidence: ReferenceConfidence;
1840
+ }
1841
+
1820
1842
  /**
1821
1843
  * Columns
1822
1844
  */
@@ -3021,7 +3043,7 @@ declare type DataDeletionProperty = {
3021
3043
  * Types that do not match any known variant fall through to `Custom { name }`,
3022
3044
  * preserving the original type name for round-trip fidelity.
3023
3045
  */
3024
- declare type DataType = {
3046
+ export declare type DataType = {
3025
3047
  "data_type": "boolean";
3026
3048
  } | {
3027
3049
  "data_type": "tiny_int";
@@ -3158,6 +3180,23 @@ declare type DataType = {
3158
3180
  "data_type": "unknown";
3159
3181
  };
3160
3182
 
3183
+ /**
3184
+ * Result of a standalone data type parse operation
3185
+ */
3186
+ export declare interface DataTypeResult {
3187
+ success: boolean;
3188
+ dataType?: DataType;
3189
+ error?: string;
3190
+ /** 1-based line number where the error occurred */
3191
+ errorLine?: number;
3192
+ /** 1-based column number where the error occurred */
3193
+ errorColumn?: number;
3194
+ /** Start byte offset of the error range */
3195
+ errorStart?: number;
3196
+ /** End byte offset of the error range (exclusive) */
3197
+ errorEnd?: number;
3198
+ }
3199
+
3161
3200
  /**
3162
3201
  * DATE_ADD / DATE_SUB function
3163
3202
  */
@@ -3366,10 +3405,13 @@ declare const _default: {
3366
3405
  isInitialized: typeof isInitialized;
3367
3406
  transpile: typeof transpile;
3368
3407
  parse: typeof parse;
3408
+ parseDataType: typeof parseDataType;
3369
3409
  tokenize: typeof tokenize;
3370
3410
  generate: typeof generate;
3411
+ generateDataType: typeof generateDataType;
3371
3412
  format: typeof format;
3372
3413
  annotateTypes: typeof annotateTypes;
3414
+ analyzeQuery: typeof analyzeQuery;
3373
3415
  getDialects: typeof getDialects;
3374
3416
  getVersion: typeof getVersion;
3375
3417
  lineage: typeof lineage;
@@ -6702,6 +6744,39 @@ declare type GeneratedAsRowColumnConstraint = {
6702
6744
  hidden: Expression | null;
6703
6745
  };
6704
6746
 
6747
+ /**
6748
+ * Generate SQL from a standalone DataType AST node.
6749
+ *
6750
+ * @param dataType - The DataType object to render
6751
+ * @param dialect - The target dialect
6752
+ * @returns The generated data type SQL
6753
+ *
6754
+ * @example
6755
+ * ```typescript
6756
+ * const parsed = parseDataType("VARCHAR(255)", Dialect.DuckDB);
6757
+ * const rendered = generateDataType(parsed.dataType!, Dialect.PostgreSQL);
6758
+ * // rendered.sql = "VARCHAR(255)"
6759
+ * ```
6760
+ */
6761
+ export declare function generateDataType(dataType: DataType, dialect?: Dialect): GenerateDataTypeResult;
6762
+
6763
+ /**
6764
+ * Result of a standalone data type generation operation
6765
+ */
6766
+ export declare interface GenerateDataTypeResult {
6767
+ success: boolean;
6768
+ sql?: string;
6769
+ error?: string;
6770
+ /** 1-based line number where the error occurred */
6771
+ errorLine?: number;
6772
+ /** 1-based column number where the error occurred */
6773
+ errorColumn?: number;
6774
+ /** Start byte offset of the error range */
6775
+ errorStart?: number;
6776
+ /** End byte offset of the error range (exclusive) */
6777
+ errorEnd?: number;
6778
+ }
6779
+
6705
6780
  /**
6706
6781
  * GenerateDateArray
6707
6782
  */
@@ -10227,6 +10302,21 @@ declare type Paren = {
10227
10302
  */
10228
10303
  export declare function parse(sql: string, dialect?: Dialect): ParseResult;
10229
10304
 
10305
+ /**
10306
+ * Parse a standalone SQL data type.
10307
+ *
10308
+ * @param sql - The data type string to parse
10309
+ * @param dialect - The dialect to use
10310
+ * @returns The parsed DataType AST node
10311
+ *
10312
+ * @example
10313
+ * ```typescript
10314
+ * const result = parseDataType("DECIMAL(10, 2)", Dialect.DuckDB);
10315
+ * console.log(result.dataType);
10316
+ * ```
10317
+ */
10318
+ export declare function parseDataType(sql: string, dialect?: Dialect): DataTypeResult;
10319
+
10230
10320
  /**
10231
10321
  * ParseDatetime
10232
10322
  */
@@ -10590,11 +10680,15 @@ export declare class Polyglot {
10590
10680
  * Per-dialect builds only support same-dialect and to/from Generic transpilation.
10591
10681
  * Use {@link Polyglot.getDialects} to check available dialects.
10592
10682
  */
10593
- transpile(sql: string, read: Dialect, write: Dialect): TranspileResult;
10683
+ transpile(sql: string, read: Dialect, write: Dialect, options?: TranspileOptions): TranspileResult;
10594
10684
  /**
10595
10685
  * Parse SQL into an AST.
10596
10686
  */
10597
10687
  parse(sql: string, dialect?: Dialect): ParseResult;
10688
+ /**
10689
+ * Parse a standalone SQL data type.
10690
+ */
10691
+ parseDataType(sql: string, dialect?: Dialect): DataTypeResult;
10598
10692
  /**
10599
10693
  * Tokenize SQL into a token stream.
10600
10694
  */
@@ -10603,6 +10697,10 @@ export declare class Polyglot {
10603
10697
  * Generate SQL from an AST.
10604
10698
  */
10605
10699
  generate(ast: any, dialect?: Dialect): TranspileResult;
10700
+ /**
10701
+ * Generate SQL from a standalone DataType AST node.
10702
+ */
10703
+ generateDataType(dataType: DataType, dialect?: Dialect): GenerateDataTypeResult;
10606
10704
  /**
10607
10705
  * Format SQL.
10608
10706
  */
@@ -10624,6 +10722,10 @@ export declare class Polyglot {
10624
10722
  * Parse SQL and annotate the AST with inferred type information.
10625
10723
  */
10626
10724
  annotateTypes(sql: string, dialect?: Dialect, schema?: Schema): AnnotateTypesResult;
10725
+ /**
10726
+ * Return compact query analysis facts for a SELECT or set operation.
10727
+ */
10728
+ analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
10627
10729
  }
10628
10730
 
10629
10731
  /**
@@ -10759,6 +10861,17 @@ declare type ProjectionDef = {
10759
10861
  expression: Expression;
10760
10862
  };
10761
10863
 
10864
+ export declare interface ProjectionFact {
10865
+ index: number;
10866
+ name?: string;
10867
+ isStar: boolean;
10868
+ starTable?: string;
10869
+ transformKind: TransformKind;
10870
+ castType?: string;
10871
+ typeHint?: string;
10872
+ upstream: ColumnReferenceFact[];
10873
+ }
10874
+
10762
10875
  /**
10763
10876
  * Properties
10764
10877
  */
@@ -10887,6 +11000,22 @@ declare type Quantile = {
10887
11000
  quantile: Expression | null;
10888
11001
  };
10889
11002
 
11003
+ export declare interface QueryAnalysis {
11004
+ shape: QueryShape;
11005
+ ctes: string[];
11006
+ projections: ProjectionFact[];
11007
+ relations: RelationFact[];
11008
+ setOperations: SetOperationFact[];
11009
+ }
11010
+
11011
+ export declare interface QueryAnalysisResult {
11012
+ success: boolean;
11013
+ analysis?: QueryAnalysis;
11014
+ error?: string;
11015
+ }
11016
+
11017
+ export declare type QueryAnalysisSourceKind = 'root' | 'table' | 'derived_table' | 'cte' | 'virtual' | 'unknown';
11018
+
10890
11019
  /**
10891
11020
  * QueryBand
10892
11021
  */
@@ -10916,6 +11045,8 @@ export declare interface QueryPlan {
10916
11045
  leaves: PlanStep[];
10917
11046
  }
10918
11047
 
11048
+ export declare type QueryShape = 'select' | 'set_operation';
11049
+
10919
11050
  /**
10920
11051
  * QueryTransform
10921
11052
  */
@@ -11048,6 +11179,8 @@ declare type Reference = {
11048
11179
  options: Array<Expression>;
11049
11180
  };
11050
11181
 
11182
+ export declare type ReferenceConfidence = 'resolved' | 'ambiguous' | 'unknown';
11183
+
11051
11184
  /**
11052
11185
  * Union of all reference expression types (identifiers, columns, tables)
11053
11186
  */
@@ -11271,6 +11404,13 @@ declare type RegrValy = {
11271
11404
  expression: Expression;
11272
11405
  };
11273
11406
 
11407
+ export declare interface RelationFact {
11408
+ name: string;
11409
+ alias?: string;
11410
+ kind: QueryAnalysisSourceKind;
11411
+ columns: string[];
11412
+ }
11413
+
11274
11414
  /**
11275
11415
  * RemoteWithConnectionModelProperty
11276
11416
  */
@@ -12141,11 +12281,24 @@ declare type SetOperation = {
12141
12281
  on: Expression | null;
12142
12282
  };
12143
12283
 
12284
+ export declare interface SetOperationBranchFact {
12285
+ index: number;
12286
+ projections: ProjectionFact[];
12287
+ }
12288
+
12144
12289
  /**
12145
12290
  * Union of all set operation expression types
12146
12291
  */
12147
12292
  declare type SetOperationExpression = ExpressionByType<'union'> | ExpressionByType<'intersect'> | ExpressionByType<'except'>;
12148
12293
 
12294
+ export declare interface SetOperationFact {
12295
+ kind: 'union' | 'intersect' | 'except' | string;
12296
+ all: boolean;
12297
+ distinct: boolean;
12298
+ outputColumns: string[];
12299
+ branches: SetOperationBranchFact[];
12300
+ }
12301
+
12149
12302
  export declare type SetOperationType = 'union' | 'union_all' | 'intersect' | 'except';
12150
12303
 
12151
12304
  /**
@@ -13561,6 +13714,8 @@ declare type TransformFunc = {
13561
13714
  transform: Expression;
13562
13715
  };
13563
13716
 
13717
+ export declare type TransformKind = 'direct' | 'cast' | 'aggregation' | 'constant' | 'expression' | 'star';
13718
+
13564
13719
  /**
13565
13720
  * TransformModelProperty
13566
13721
  */
@@ -13619,11 +13774,17 @@ declare type TranslateCharacters = {
13619
13774
  * // result.sql[0] = "SELECT COALESCE(a, b)"
13620
13775
  * ```
13621
13776
  */
13622
- export declare function transpile(sql: string, read: Dialect, write: Dialect): TranspileResult;
13777
+ export declare function transpile(sql: string, read: Dialect, write: Dialect, options?: TranspileOptions): TranspileResult;
13778
+
13779
+ export declare interface TranspileOptions {
13780
+ /** Pretty-print the generated SQL */
13781
+ pretty?: boolean;
13782
+ /** How unsupported target-dialect constructs should be handled */
13783
+ unsupportedLevel?: UnsupportedLevel;
13784
+ /** Maximum number of unsupported diagnostics to include in raised errors */
13785
+ maxUnsupported?: number;
13786
+ }
13623
13787
 
13624
- /**
13625
- * Transpilation options
13626
- */
13627
13788
  /**
13628
13789
  * Result of a transpilation operation
13629
13790
  */
@@ -14171,6 +14332,11 @@ declare type UnpivotColumns = {
14171
14332
  expressions: Array<Expression>;
14172
14333
  };
14173
14334
 
14335
+ /**
14336
+ * Transpilation options
14337
+ */
14338
+ export declare type UnsupportedLevel = 'ignore' | 'warn' | 'raise' | 'immediate';
14339
+
14174
14340
  /**
14175
14341
  * UPDATE statement
14176
14342
  */
package/dist/index.d.ts CHANGED
@@ -593,6 +593,18 @@ declare type AnalyzeListChainedRows = {
593
593
  expression: Expression | null;
594
594
  };
595
595
 
596
+ /**
597
+ * Return compact query analysis facts for a SELECT or set operation.
598
+ */
599
+ export declare function analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
600
+
601
+ export declare interface AnalyzeQueryOptions {
602
+ /** Dialect used for parsing and dialect-aware rendering */
603
+ dialect?: Dialect | string;
604
+ /** Optional schema used for qualification and type annotation */
605
+ schema?: Schema;
606
+ }
607
+
596
608
  /**
597
609
  * AnalyzeSample
598
610
  */
@@ -1817,6 +1829,16 @@ declare type ColumnPrefix = {
1817
1829
  expression: Expression;
1818
1830
  };
1819
1831
 
1832
+ export declare interface ColumnReferenceFact {
1833
+ sourceName?: string;
1834
+ sourceAlias?: string;
1835
+ sourceKind: QueryAnalysisSourceKind;
1836
+ table?: string;
1837
+ column: string;
1838
+ unqualified: boolean;
1839
+ confidence: ReferenceConfidence;
1840
+ }
1841
+
1820
1842
  /**
1821
1843
  * Columns
1822
1844
  */
@@ -3021,7 +3043,7 @@ declare type DataDeletionProperty = {
3021
3043
  * Types that do not match any known variant fall through to `Custom { name }`,
3022
3044
  * preserving the original type name for round-trip fidelity.
3023
3045
  */
3024
- declare type DataType = {
3046
+ export declare type DataType = {
3025
3047
  "data_type": "boolean";
3026
3048
  } | {
3027
3049
  "data_type": "tiny_int";
@@ -3158,6 +3180,23 @@ declare type DataType = {
3158
3180
  "data_type": "unknown";
3159
3181
  };
3160
3182
 
3183
+ /**
3184
+ * Result of a standalone data type parse operation
3185
+ */
3186
+ export declare interface DataTypeResult {
3187
+ success: boolean;
3188
+ dataType?: DataType;
3189
+ error?: string;
3190
+ /** 1-based line number where the error occurred */
3191
+ errorLine?: number;
3192
+ /** 1-based column number where the error occurred */
3193
+ errorColumn?: number;
3194
+ /** Start byte offset of the error range */
3195
+ errorStart?: number;
3196
+ /** End byte offset of the error range (exclusive) */
3197
+ errorEnd?: number;
3198
+ }
3199
+
3161
3200
  /**
3162
3201
  * DATE_ADD / DATE_SUB function
3163
3202
  */
@@ -3366,10 +3405,13 @@ declare const _default: {
3366
3405
  isInitialized: typeof isInitialized;
3367
3406
  transpile: typeof transpile;
3368
3407
  parse: typeof parse;
3408
+ parseDataType: typeof parseDataType;
3369
3409
  tokenize: typeof tokenize;
3370
3410
  generate: typeof generate;
3411
+ generateDataType: typeof generateDataType;
3371
3412
  format: typeof format;
3372
3413
  annotateTypes: typeof annotateTypes;
3414
+ analyzeQuery: typeof analyzeQuery;
3373
3415
  getDialects: typeof getDialects;
3374
3416
  getVersion: typeof getVersion;
3375
3417
  lineage: typeof lineage;
@@ -6702,6 +6744,39 @@ declare type GeneratedAsRowColumnConstraint = {
6702
6744
  hidden: Expression | null;
6703
6745
  };
6704
6746
 
6747
+ /**
6748
+ * Generate SQL from a standalone DataType AST node.
6749
+ *
6750
+ * @param dataType - The DataType object to render
6751
+ * @param dialect - The target dialect
6752
+ * @returns The generated data type SQL
6753
+ *
6754
+ * @example
6755
+ * ```typescript
6756
+ * const parsed = parseDataType("VARCHAR(255)", Dialect.DuckDB);
6757
+ * const rendered = generateDataType(parsed.dataType!, Dialect.PostgreSQL);
6758
+ * // rendered.sql = "VARCHAR(255)"
6759
+ * ```
6760
+ */
6761
+ export declare function generateDataType(dataType: DataType, dialect?: Dialect): GenerateDataTypeResult;
6762
+
6763
+ /**
6764
+ * Result of a standalone data type generation operation
6765
+ */
6766
+ export declare interface GenerateDataTypeResult {
6767
+ success: boolean;
6768
+ sql?: string;
6769
+ error?: string;
6770
+ /** 1-based line number where the error occurred */
6771
+ errorLine?: number;
6772
+ /** 1-based column number where the error occurred */
6773
+ errorColumn?: number;
6774
+ /** Start byte offset of the error range */
6775
+ errorStart?: number;
6776
+ /** End byte offset of the error range (exclusive) */
6777
+ errorEnd?: number;
6778
+ }
6779
+
6705
6780
  /**
6706
6781
  * GenerateDateArray
6707
6782
  */
@@ -10227,6 +10302,21 @@ declare type Paren = {
10227
10302
  */
10228
10303
  export declare function parse(sql: string, dialect?: Dialect): ParseResult;
10229
10304
 
10305
+ /**
10306
+ * Parse a standalone SQL data type.
10307
+ *
10308
+ * @param sql - The data type string to parse
10309
+ * @param dialect - The dialect to use
10310
+ * @returns The parsed DataType AST node
10311
+ *
10312
+ * @example
10313
+ * ```typescript
10314
+ * const result = parseDataType("DECIMAL(10, 2)", Dialect.DuckDB);
10315
+ * console.log(result.dataType);
10316
+ * ```
10317
+ */
10318
+ export declare function parseDataType(sql: string, dialect?: Dialect): DataTypeResult;
10319
+
10230
10320
  /**
10231
10321
  * ParseDatetime
10232
10322
  */
@@ -10590,11 +10680,15 @@ export declare class Polyglot {
10590
10680
  * Per-dialect builds only support same-dialect and to/from Generic transpilation.
10591
10681
  * Use {@link Polyglot.getDialects} to check available dialects.
10592
10682
  */
10593
- transpile(sql: string, read: Dialect, write: Dialect): TranspileResult;
10683
+ transpile(sql: string, read: Dialect, write: Dialect, options?: TranspileOptions): TranspileResult;
10594
10684
  /**
10595
10685
  * Parse SQL into an AST.
10596
10686
  */
10597
10687
  parse(sql: string, dialect?: Dialect): ParseResult;
10688
+ /**
10689
+ * Parse a standalone SQL data type.
10690
+ */
10691
+ parseDataType(sql: string, dialect?: Dialect): DataTypeResult;
10598
10692
  /**
10599
10693
  * Tokenize SQL into a token stream.
10600
10694
  */
@@ -10603,6 +10697,10 @@ export declare class Polyglot {
10603
10697
  * Generate SQL from an AST.
10604
10698
  */
10605
10699
  generate(ast: any, dialect?: Dialect): TranspileResult;
10700
+ /**
10701
+ * Generate SQL from a standalone DataType AST node.
10702
+ */
10703
+ generateDataType(dataType: DataType, dialect?: Dialect): GenerateDataTypeResult;
10606
10704
  /**
10607
10705
  * Format SQL.
10608
10706
  */
@@ -10624,6 +10722,10 @@ export declare class Polyglot {
10624
10722
  * Parse SQL and annotate the AST with inferred type information.
10625
10723
  */
10626
10724
  annotateTypes(sql: string, dialect?: Dialect, schema?: Schema): AnnotateTypesResult;
10725
+ /**
10726
+ * Return compact query analysis facts for a SELECT or set operation.
10727
+ */
10728
+ analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
10627
10729
  }
10628
10730
 
10629
10731
  /**
@@ -10759,6 +10861,17 @@ declare type ProjectionDef = {
10759
10861
  expression: Expression;
10760
10862
  };
10761
10863
 
10864
+ export declare interface ProjectionFact {
10865
+ index: number;
10866
+ name?: string;
10867
+ isStar: boolean;
10868
+ starTable?: string;
10869
+ transformKind: TransformKind;
10870
+ castType?: string;
10871
+ typeHint?: string;
10872
+ upstream: ColumnReferenceFact[];
10873
+ }
10874
+
10762
10875
  /**
10763
10876
  * Properties
10764
10877
  */
@@ -10887,6 +11000,22 @@ declare type Quantile = {
10887
11000
  quantile: Expression | null;
10888
11001
  };
10889
11002
 
11003
+ export declare interface QueryAnalysis {
11004
+ shape: QueryShape;
11005
+ ctes: string[];
11006
+ projections: ProjectionFact[];
11007
+ relations: RelationFact[];
11008
+ setOperations: SetOperationFact[];
11009
+ }
11010
+
11011
+ export declare interface QueryAnalysisResult {
11012
+ success: boolean;
11013
+ analysis?: QueryAnalysis;
11014
+ error?: string;
11015
+ }
11016
+
11017
+ export declare type QueryAnalysisSourceKind = 'root' | 'table' | 'derived_table' | 'cte' | 'virtual' | 'unknown';
11018
+
10890
11019
  /**
10891
11020
  * QueryBand
10892
11021
  */
@@ -10916,6 +11045,8 @@ export declare interface QueryPlan {
10916
11045
  leaves: PlanStep[];
10917
11046
  }
10918
11047
 
11048
+ export declare type QueryShape = 'select' | 'set_operation';
11049
+
10919
11050
  /**
10920
11051
  * QueryTransform
10921
11052
  */
@@ -11048,6 +11179,8 @@ declare type Reference = {
11048
11179
  options: Array<Expression>;
11049
11180
  };
11050
11181
 
11182
+ export declare type ReferenceConfidence = 'resolved' | 'ambiguous' | 'unknown';
11183
+
11051
11184
  /**
11052
11185
  * Union of all reference expression types (identifiers, columns, tables)
11053
11186
  */
@@ -11271,6 +11404,13 @@ declare type RegrValy = {
11271
11404
  expression: Expression;
11272
11405
  };
11273
11406
 
11407
+ export declare interface RelationFact {
11408
+ name: string;
11409
+ alias?: string;
11410
+ kind: QueryAnalysisSourceKind;
11411
+ columns: string[];
11412
+ }
11413
+
11274
11414
  /**
11275
11415
  * RemoteWithConnectionModelProperty
11276
11416
  */
@@ -12141,11 +12281,24 @@ declare type SetOperation = {
12141
12281
  on: Expression | null;
12142
12282
  };
12143
12283
 
12284
+ export declare interface SetOperationBranchFact {
12285
+ index: number;
12286
+ projections: ProjectionFact[];
12287
+ }
12288
+
12144
12289
  /**
12145
12290
  * Union of all set operation expression types
12146
12291
  */
12147
12292
  declare type SetOperationExpression = ExpressionByType<'union'> | ExpressionByType<'intersect'> | ExpressionByType<'except'>;
12148
12293
 
12294
+ export declare interface SetOperationFact {
12295
+ kind: 'union' | 'intersect' | 'except' | string;
12296
+ all: boolean;
12297
+ distinct: boolean;
12298
+ outputColumns: string[];
12299
+ branches: SetOperationBranchFact[];
12300
+ }
12301
+
12149
12302
  export declare type SetOperationType = 'union' | 'union_all' | 'intersect' | 'except';
12150
12303
 
12151
12304
  /**
@@ -13561,6 +13714,8 @@ declare type TransformFunc = {
13561
13714
  transform: Expression;
13562
13715
  };
13563
13716
 
13717
+ export declare type TransformKind = 'direct' | 'cast' | 'aggregation' | 'constant' | 'expression' | 'star';
13718
+
13564
13719
  /**
13565
13720
  * TransformModelProperty
13566
13721
  */
@@ -13619,11 +13774,17 @@ declare type TranslateCharacters = {
13619
13774
  * // result.sql[0] = "SELECT COALESCE(a, b)"
13620
13775
  * ```
13621
13776
  */
13622
- export declare function transpile(sql: string, read: Dialect, write: Dialect): TranspileResult;
13777
+ export declare function transpile(sql: string, read: Dialect, write: Dialect, options?: TranspileOptions): TranspileResult;
13778
+
13779
+ export declare interface TranspileOptions {
13780
+ /** Pretty-print the generated SQL */
13781
+ pretty?: boolean;
13782
+ /** How unsupported target-dialect constructs should be handled */
13783
+ unsupportedLevel?: UnsupportedLevel;
13784
+ /** Maximum number of unsupported diagnostics to include in raised errors */
13785
+ maxUnsupported?: number;
13786
+ }
13623
13787
 
13624
- /**
13625
- * Transpilation options
13626
- */
13627
13788
  /**
13628
13789
  * Result of a transpilation operation
13629
13790
  */
@@ -14171,6 +14332,11 @@ declare type UnpivotColumns = {
14171
14332
  expressions: Array<Expression>;
14172
14333
  };
14173
14334
 
14335
+ /**
14336
+ * Transpilation options
14337
+ */
14338
+ export declare type UnsupportedLevel = 'ignore' | 'warn' | 'raise' | 'immediate';
14339
+
14174
14340
  /**
14175
14341
  * UPDATE statement
14176
14342
  */