@polyglot-sql/sdk 0.3.9 → 0.3.11
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/cdn/polyglot.esm.js +1388 -1350
- package/dist/index.cjs +101 -34
- package/dist/index.d.cts +40 -9
- package/dist/index.d.ts +40 -9
- package/dist/index.js +112 -32
- package/dist/polyglot_sql_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -96,32 +96,35 @@ class WasmCaseBuilder {
|
|
|
96
96
|
return this;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Generate SQL string
|
|
99
|
+
* Generate SQL string for the given dialect.
|
|
100
|
+
* @param {string} dialect
|
|
100
101
|
* @returns {string}
|
|
101
102
|
*/
|
|
102
|
-
to_sql() {
|
|
103
|
-
let
|
|
104
|
-
let
|
|
103
|
+
to_sql(dialect) {
|
|
104
|
+
let deferred3_0;
|
|
105
|
+
let deferred3_1;
|
|
105
106
|
try {
|
|
106
107
|
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
107
|
-
wasm$3.
|
|
108
|
+
const ptr0 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
110
|
+
wasm$3.wasmcasebuilder_to_sql(retptr, this.__wbg_ptr, ptr0, len0);
|
|
108
111
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
109
112
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
110
113
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
111
114
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
112
|
-
var
|
|
113
|
-
var
|
|
115
|
+
var ptr2 = r0;
|
|
116
|
+
var len2 = r1;
|
|
114
117
|
if (r3) {
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
ptr2 = 0;
|
|
119
|
+
len2 = 0;
|
|
117
120
|
throw takeObject(r2);
|
|
118
121
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return getStringFromWasm0(
|
|
122
|
+
deferred3_0 = ptr2;
|
|
123
|
+
deferred3_1 = len2;
|
|
124
|
+
return getStringFromWasm0(ptr2, len2);
|
|
122
125
|
} finally {
|
|
123
126
|
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
124
|
-
wasm$3.__wbindgen_export4(
|
|
127
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
/**
|
|
@@ -502,32 +505,35 @@ class WasmExpr {
|
|
|
502
505
|
}
|
|
503
506
|
}
|
|
504
507
|
/**
|
|
505
|
-
* Generate SQL string
|
|
508
|
+
* Generate SQL string for the given dialect.
|
|
509
|
+
* @param {string} dialect
|
|
506
510
|
* @returns {string}
|
|
507
511
|
*/
|
|
508
|
-
to_sql() {
|
|
509
|
-
let
|
|
510
|
-
let
|
|
512
|
+
to_sql(dialect) {
|
|
513
|
+
let deferred3_0;
|
|
514
|
+
let deferred3_1;
|
|
511
515
|
try {
|
|
512
516
|
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
513
|
-
wasm$3.
|
|
517
|
+
const ptr0 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
wasm$3.wasmexpr_to_sql(retptr, this.__wbg_ptr, ptr0, len0);
|
|
514
520
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
515
521
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
516
522
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
517
523
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
518
|
-
var
|
|
519
|
-
var
|
|
524
|
+
var ptr2 = r0;
|
|
525
|
+
var len2 = r1;
|
|
520
526
|
if (r3) {
|
|
521
|
-
|
|
522
|
-
|
|
527
|
+
ptr2 = 0;
|
|
528
|
+
len2 = 0;
|
|
523
529
|
throw takeObject(r2);
|
|
524
530
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return getStringFromWasm0(
|
|
531
|
+
deferred3_0 = ptr2;
|
|
532
|
+
deferred3_1 = len2;
|
|
533
|
+
return getStringFromWasm0(ptr2, len2);
|
|
528
534
|
} finally {
|
|
529
535
|
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
530
|
-
wasm$3.__wbindgen_export4(
|
|
536
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
531
537
|
}
|
|
532
538
|
}
|
|
533
539
|
/**
|
|
@@ -1723,6 +1729,26 @@ function ast_qualify_columns$1(ast_json, table_name) {
|
|
|
1723
1729
|
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1724
1730
|
}
|
|
1725
1731
|
}
|
|
1732
|
+
function ast_qualify_tables$1(ast_json, options_json) {
|
|
1733
|
+
let deferred3_0;
|
|
1734
|
+
let deferred3_1;
|
|
1735
|
+
try {
|
|
1736
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
1737
|
+
const ptr0 = passStringToWasm0(ast_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1738
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1739
|
+
const ptr1 = passStringToWasm0(options_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1740
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1741
|
+
wasm$3.ast_qualify_tables(retptr, ptr0, len0, ptr1, len1);
|
|
1742
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1743
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1744
|
+
deferred3_0 = r0;
|
|
1745
|
+
deferred3_1 = r1;
|
|
1746
|
+
return getStringFromWasm0(r0, r1);
|
|
1747
|
+
} finally {
|
|
1748
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
1749
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1726
1752
|
function ast_remove_where$1(ast_json) {
|
|
1727
1753
|
let deferred2_0;
|
|
1728
1754
|
let deferred2_1;
|
|
@@ -1781,6 +1807,28 @@ function ast_rename_tables$1(ast_json, mapping_json) {
|
|
|
1781
1807
|
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1782
1808
|
}
|
|
1783
1809
|
}
|
|
1810
|
+
function ast_rename_tables_with_options$1(ast_json, mapping_json, options_json) {
|
|
1811
|
+
let deferred4_0;
|
|
1812
|
+
let deferred4_1;
|
|
1813
|
+
try {
|
|
1814
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
1815
|
+
const ptr0 = passStringToWasm0(ast_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1816
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1817
|
+
const ptr1 = passStringToWasm0(mapping_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1818
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1819
|
+
const ptr2 = passStringToWasm0(options_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1820
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1821
|
+
wasm$3.ast_rename_tables_with_options(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1822
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1823
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1824
|
+
deferred4_0 = r0;
|
|
1825
|
+
deferred4_1 = r1;
|
|
1826
|
+
return getStringFromWasm0(r0, r1);
|
|
1827
|
+
} finally {
|
|
1828
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
1829
|
+
wasm$3.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1784
1832
|
function ast_set_distinct$1(ast_json, distinct) {
|
|
1785
1833
|
let deferred2_0;
|
|
1786
1834
|
let deferred2_1;
|
|
@@ -2884,9 +2932,11 @@ async function __polyglot_init_wasm() {
|
|
|
2884
2932
|
ast_get_window_functions = __vite__wasmModule.ast_get_window_functions;
|
|
2885
2933
|
ast_node_count = __vite__wasmModule.ast_node_count;
|
|
2886
2934
|
ast_qualify_columns = __vite__wasmModule.ast_qualify_columns;
|
|
2935
|
+
ast_qualify_tables = __vite__wasmModule.ast_qualify_tables;
|
|
2887
2936
|
ast_remove_where = __vite__wasmModule.ast_remove_where;
|
|
2888
2937
|
ast_rename_columns = __vite__wasmModule.ast_rename_columns;
|
|
2889
2938
|
ast_rename_tables = __vite__wasmModule.ast_rename_tables;
|
|
2939
|
+
ast_rename_tables_with_options = __vite__wasmModule.ast_rename_tables_with_options;
|
|
2890
2940
|
ast_set_distinct = __vite__wasmModule.ast_set_distinct;
|
|
2891
2941
|
ast_set_limit = __vite__wasmModule.ast_set_limit;
|
|
2892
2942
|
diff_sql = __vite__wasmModule.diff_sql;
|
|
@@ -3070,9 +3120,11 @@ let ast_get_table_names;
|
|
|
3070
3120
|
let ast_get_window_functions;
|
|
3071
3121
|
let ast_node_count;
|
|
3072
3122
|
let ast_qualify_columns;
|
|
3123
|
+
let ast_qualify_tables;
|
|
3073
3124
|
let ast_remove_where;
|
|
3074
3125
|
let ast_rename_columns;
|
|
3075
3126
|
let ast_rename_tables;
|
|
3127
|
+
let ast_rename_tables_with_options;
|
|
3076
3128
|
let ast_set_distinct;
|
|
3077
3129
|
let ast_set_limit;
|
|
3078
3130
|
let diff_sql;
|
|
@@ -3258,9 +3310,11 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
3258
3310
|
ast_get_window_functions,
|
|
3259
3311
|
ast_node_count,
|
|
3260
3312
|
ast_qualify_columns,
|
|
3313
|
+
ast_qualify_tables,
|
|
3261
3314
|
ast_remove_where,
|
|
3262
3315
|
ast_rename_columns,
|
|
3263
3316
|
ast_rename_tables,
|
|
3317
|
+
ast_rename_tables_with_options,
|
|
3264
3318
|
ast_set_distinct,
|
|
3265
3319
|
ast_set_limit,
|
|
3266
3320
|
diff_sql,
|
|
@@ -3438,9 +3492,11 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
3438
3492
|
ast_get_window_functions: ast_get_window_functions$1,
|
|
3439
3493
|
ast_node_count: ast_node_count$1,
|
|
3440
3494
|
ast_qualify_columns: ast_qualify_columns$1,
|
|
3495
|
+
ast_qualify_tables: ast_qualify_tables$1,
|
|
3441
3496
|
ast_remove_where: ast_remove_where$1,
|
|
3442
3497
|
ast_rename_columns: ast_rename_columns$1,
|
|
3443
3498
|
ast_rename_tables: ast_rename_tables$1,
|
|
3499
|
+
ast_rename_tables_with_options: ast_rename_tables_with_options$1,
|
|
3444
3500
|
ast_set_distinct: ast_set_distinct$1,
|
|
3445
3501
|
ast_set_limit: ast_set_limit$1,
|
|
3446
3502
|
diff_sql: diff_sql$1,
|
|
@@ -3729,9 +3785,13 @@ function renameColumns(node, mapping) {
|
|
|
3729
3785
|
);
|
|
3730
3786
|
return result ?? node;
|
|
3731
3787
|
}
|
|
3732
|
-
function renameTables(node, mapping) {
|
|
3788
|
+
function renameTables(node, mapping, options) {
|
|
3733
3789
|
const result = parseAstResult(
|
|
3734
|
-
|
|
3790
|
+
options ? ast_rename_tables_with_options$1(
|
|
3791
|
+
exprToJson$1(node),
|
|
3792
|
+
JSON.stringify(mapping),
|
|
3793
|
+
JSON.stringify(options)
|
|
3794
|
+
) : ast_rename_tables$1(exprToJson$1(node), JSON.stringify(mapping))
|
|
3735
3795
|
);
|
|
3736
3796
|
return result ?? node;
|
|
3737
3797
|
}
|
|
@@ -3741,6 +3801,12 @@ function qualifyColumns(node, tableName) {
|
|
|
3741
3801
|
);
|
|
3742
3802
|
return result ?? node;
|
|
3743
3803
|
}
|
|
3804
|
+
function qualifyTables(node, options = {}) {
|
|
3805
|
+
const result = parseAstResult(
|
|
3806
|
+
ast_qualify_tables$1(exprToJson$1(node), JSON.stringify(options))
|
|
3807
|
+
);
|
|
3808
|
+
return result ?? node;
|
|
3809
|
+
}
|
|
3744
3810
|
function addWhere(node, condition2, operator = "and") {
|
|
3745
3811
|
const result = parseAstResult(
|
|
3746
3812
|
ast_add_where$1(exprToJson$1(node), exprToJson$1(condition2), operator === "or")
|
|
@@ -4182,6 +4248,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
4182
4248
|
makeExpr,
|
|
4183
4249
|
nodeCount,
|
|
4184
4250
|
qualifyColumns,
|
|
4251
|
+
qualifyTables,
|
|
4185
4252
|
remove,
|
|
4186
4253
|
removeLimitOffset,
|
|
4187
4254
|
removeSelectColumns,
|
|
@@ -4320,9 +4387,9 @@ class Expr {
|
|
|
4320
4387
|
return new Expr(this._w.desc());
|
|
4321
4388
|
}
|
|
4322
4389
|
// -- Output --
|
|
4323
|
-
/** Generate SQL string
|
|
4324
|
-
toSql() {
|
|
4325
|
-
return this._w.to_sql();
|
|
4390
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
4391
|
+
toSql(dialect = "generic") {
|
|
4392
|
+
return this._w.to_sql(dialect);
|
|
4326
4393
|
}
|
|
4327
4394
|
/** Return the expression AST as a plain JS object. */
|
|
4328
4395
|
toJSON() {
|
|
@@ -4858,9 +4925,9 @@ class CaseBuilder {
|
|
|
4858
4925
|
build() {
|
|
4859
4926
|
return new Expr(this._w.build_expr());
|
|
4860
4927
|
}
|
|
4861
|
-
/** Generate SQL string
|
|
4862
|
-
toSql() {
|
|
4863
|
-
return this._w.to_sql();
|
|
4928
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
4929
|
+
toSql(dialect = "generic") {
|
|
4930
|
+
return this._w.to_sql(dialect);
|
|
4864
4931
|
}
|
|
4865
4932
|
}
|
|
4866
4933
|
function caseWhen() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1039,6 +1039,7 @@ export declare namespace ast {
|
|
|
1039
1039
|
addWhere,
|
|
1040
1040
|
clone,
|
|
1041
1041
|
qualifyColumns,
|
|
1042
|
+
qualifyTables,
|
|
1042
1043
|
remove,
|
|
1043
1044
|
removeLimitOffset,
|
|
1044
1045
|
removeSelectColumns,
|
|
@@ -1058,6 +1059,8 @@ export declare namespace ast {
|
|
|
1058
1059
|
VisitorCallback,
|
|
1059
1060
|
VisitorConfig,
|
|
1060
1061
|
VisitorContext,
|
|
1062
|
+
QualifyTablesOptions,
|
|
1063
|
+
RenameTablesOptions,
|
|
1061
1064
|
countNodes,
|
|
1062
1065
|
every,
|
|
1063
1066
|
findAll,
|
|
@@ -1381,8 +1384,8 @@ export declare class CaseBuilder {
|
|
|
1381
1384
|
else_(result: ExprInput): this;
|
|
1382
1385
|
/** Build the CASE expression as an Expr. */
|
|
1383
1386
|
build(): Expr;
|
|
1384
|
-
/** Generate SQL string
|
|
1385
|
-
toSql(): string;
|
|
1387
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
1388
|
+
toSql(dialect?: string): string;
|
|
1386
1389
|
}
|
|
1387
1390
|
|
|
1388
1391
|
/** Create a simple CASE builder (CASE operand WHEN value THEN ...). */
|
|
@@ -4216,8 +4219,8 @@ export declare class Expr {
|
|
|
4216
4219
|
cast(to: string): Expr;
|
|
4217
4220
|
asc(): Expr;
|
|
4218
4221
|
desc(): Expr;
|
|
4219
|
-
/** Generate SQL string
|
|
4220
|
-
toSql(): string;
|
|
4222
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
4223
|
+
toSql(dialect?: string): string;
|
|
4221
4224
|
/** Return the expression AST as a plain JS object. */
|
|
4222
4225
|
toJSON(): any;
|
|
4223
4226
|
/** Free the underlying WASM handle. */
|
|
@@ -10716,6 +10719,29 @@ declare type Qualify = {
|
|
|
10716
10719
|
*/
|
|
10717
10720
|
declare function qualifyColumns(node: Expression, tableName: string): Expression;
|
|
10718
10721
|
|
|
10722
|
+
/**
|
|
10723
|
+
* Qualify table references and optionally generate stable aliases (via WASM)
|
|
10724
|
+
*
|
|
10725
|
+
* @example
|
|
10726
|
+
* ```typescript
|
|
10727
|
+
* const newAst = qualifyTables(ast, {
|
|
10728
|
+
* canonicalizeTableAliases: true
|
|
10729
|
+
* });
|
|
10730
|
+
* ```
|
|
10731
|
+
*/
|
|
10732
|
+
declare function qualifyTables(node: Expression, options?: QualifyTablesOptions): Expression;
|
|
10733
|
+
|
|
10734
|
+
declare interface QualifyTablesOptions {
|
|
10735
|
+
db?: string;
|
|
10736
|
+
catalog?: string;
|
|
10737
|
+
dialect?: string;
|
|
10738
|
+
canonicalizeTableAliases?: boolean;
|
|
10739
|
+
aliasUnaliasedTables?: boolean;
|
|
10740
|
+
aliasUnaliasedSubqueries?: boolean;
|
|
10741
|
+
aliasPrefix?: string;
|
|
10742
|
+
normalizeSetOperationSubqueries?: boolean;
|
|
10743
|
+
}
|
|
10744
|
+
|
|
10719
10745
|
/**
|
|
10720
10746
|
* ANY / ALL quantified expression
|
|
10721
10747
|
*/
|
|
@@ -11184,7 +11210,12 @@ export declare function renameColumns(node: Expression, mapping: Record<string,
|
|
|
11184
11210
|
* });
|
|
11185
11211
|
* ```
|
|
11186
11212
|
*/
|
|
11187
|
-
declare function renameTables(node: Expression, mapping: Record<string, string
|
|
11213
|
+
declare function renameTables(node: Expression, mapping: Record<string, string>, options?: RenameTablesOptions): Expression;
|
|
11214
|
+
|
|
11215
|
+
declare interface RenameTablesOptions {
|
|
11216
|
+
aliasRenamedTables?: boolean;
|
|
11217
|
+
preserveExistingAliases?: boolean;
|
|
11218
|
+
}
|
|
11188
11219
|
|
|
11189
11220
|
/**
|
|
11190
11221
|
* REPEAT function
|
|
@@ -14471,9 +14502,9 @@ declare class WasmCaseBuilder {
|
|
|
14471
14502
|
*/
|
|
14472
14503
|
constructor();
|
|
14473
14504
|
/**
|
|
14474
|
-
* Generate SQL string
|
|
14505
|
+
* Generate SQL string for the given dialect.
|
|
14475
14506
|
*/
|
|
14476
|
-
to_sql(): string;
|
|
14507
|
+
to_sql(dialect: string): string;
|
|
14477
14508
|
/**
|
|
14478
14509
|
* Add a WHEN condition THEN result branch.
|
|
14479
14510
|
*/
|
|
@@ -14617,9 +14648,9 @@ declare class WasmExpr {
|
|
|
14617
14648
|
*/
|
|
14618
14649
|
to_json(): any;
|
|
14619
14650
|
/**
|
|
14620
|
-
* Generate SQL string
|
|
14651
|
+
* Generate SQL string for the given dialect.
|
|
14621
14652
|
*/
|
|
14622
|
-
to_sql(): string;
|
|
14653
|
+
to_sql(dialect: string): string;
|
|
14623
14654
|
/**
|
|
14624
14655
|
* Produce `self XOR other`.
|
|
14625
14656
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1039,6 +1039,7 @@ export declare namespace ast {
|
|
|
1039
1039
|
addWhere,
|
|
1040
1040
|
clone,
|
|
1041
1041
|
qualifyColumns,
|
|
1042
|
+
qualifyTables,
|
|
1042
1043
|
remove,
|
|
1043
1044
|
removeLimitOffset,
|
|
1044
1045
|
removeSelectColumns,
|
|
@@ -1058,6 +1059,8 @@ export declare namespace ast {
|
|
|
1058
1059
|
VisitorCallback,
|
|
1059
1060
|
VisitorConfig,
|
|
1060
1061
|
VisitorContext,
|
|
1062
|
+
QualifyTablesOptions,
|
|
1063
|
+
RenameTablesOptions,
|
|
1061
1064
|
countNodes,
|
|
1062
1065
|
every,
|
|
1063
1066
|
findAll,
|
|
@@ -1381,8 +1384,8 @@ export declare class CaseBuilder {
|
|
|
1381
1384
|
else_(result: ExprInput): this;
|
|
1382
1385
|
/** Build the CASE expression as an Expr. */
|
|
1383
1386
|
build(): Expr;
|
|
1384
|
-
/** Generate SQL string
|
|
1385
|
-
toSql(): string;
|
|
1387
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
1388
|
+
toSql(dialect?: string): string;
|
|
1386
1389
|
}
|
|
1387
1390
|
|
|
1388
1391
|
/** Create a simple CASE builder (CASE operand WHEN value THEN ...). */
|
|
@@ -4216,8 +4219,8 @@ export declare class Expr {
|
|
|
4216
4219
|
cast(to: string): Expr;
|
|
4217
4220
|
asc(): Expr;
|
|
4218
4221
|
desc(): Expr;
|
|
4219
|
-
/** Generate SQL string
|
|
4220
|
-
toSql(): string;
|
|
4222
|
+
/** Generate SQL string. Defaults to generic dialect. */
|
|
4223
|
+
toSql(dialect?: string): string;
|
|
4221
4224
|
/** Return the expression AST as a plain JS object. */
|
|
4222
4225
|
toJSON(): any;
|
|
4223
4226
|
/** Free the underlying WASM handle. */
|
|
@@ -10716,6 +10719,29 @@ declare type Qualify = {
|
|
|
10716
10719
|
*/
|
|
10717
10720
|
declare function qualifyColumns(node: Expression, tableName: string): Expression;
|
|
10718
10721
|
|
|
10722
|
+
/**
|
|
10723
|
+
* Qualify table references and optionally generate stable aliases (via WASM)
|
|
10724
|
+
*
|
|
10725
|
+
* @example
|
|
10726
|
+
* ```typescript
|
|
10727
|
+
* const newAst = qualifyTables(ast, {
|
|
10728
|
+
* canonicalizeTableAliases: true
|
|
10729
|
+
* });
|
|
10730
|
+
* ```
|
|
10731
|
+
*/
|
|
10732
|
+
declare function qualifyTables(node: Expression, options?: QualifyTablesOptions): Expression;
|
|
10733
|
+
|
|
10734
|
+
declare interface QualifyTablesOptions {
|
|
10735
|
+
db?: string;
|
|
10736
|
+
catalog?: string;
|
|
10737
|
+
dialect?: string;
|
|
10738
|
+
canonicalizeTableAliases?: boolean;
|
|
10739
|
+
aliasUnaliasedTables?: boolean;
|
|
10740
|
+
aliasUnaliasedSubqueries?: boolean;
|
|
10741
|
+
aliasPrefix?: string;
|
|
10742
|
+
normalizeSetOperationSubqueries?: boolean;
|
|
10743
|
+
}
|
|
10744
|
+
|
|
10719
10745
|
/**
|
|
10720
10746
|
* ANY / ALL quantified expression
|
|
10721
10747
|
*/
|
|
@@ -11184,7 +11210,12 @@ export declare function renameColumns(node: Expression, mapping: Record<string,
|
|
|
11184
11210
|
* });
|
|
11185
11211
|
* ```
|
|
11186
11212
|
*/
|
|
11187
|
-
declare function renameTables(node: Expression, mapping: Record<string, string
|
|
11213
|
+
declare function renameTables(node: Expression, mapping: Record<string, string>, options?: RenameTablesOptions): Expression;
|
|
11214
|
+
|
|
11215
|
+
declare interface RenameTablesOptions {
|
|
11216
|
+
aliasRenamedTables?: boolean;
|
|
11217
|
+
preserveExistingAliases?: boolean;
|
|
11218
|
+
}
|
|
11188
11219
|
|
|
11189
11220
|
/**
|
|
11190
11221
|
* REPEAT function
|
|
@@ -14471,9 +14502,9 @@ declare class WasmCaseBuilder {
|
|
|
14471
14502
|
*/
|
|
14472
14503
|
constructor();
|
|
14473
14504
|
/**
|
|
14474
|
-
* Generate SQL string
|
|
14505
|
+
* Generate SQL string for the given dialect.
|
|
14475
14506
|
*/
|
|
14476
|
-
to_sql(): string;
|
|
14507
|
+
to_sql(dialect: string): string;
|
|
14477
14508
|
/**
|
|
14478
14509
|
* Add a WHEN condition THEN result branch.
|
|
14479
14510
|
*/
|
|
@@ -14617,9 +14648,9 @@ declare class WasmExpr {
|
|
|
14617
14648
|
*/
|
|
14618
14649
|
to_json(): any;
|
|
14619
14650
|
/**
|
|
14620
|
-
* Generate SQL string
|
|
14651
|
+
* Generate SQL string for the given dialect.
|
|
14621
14652
|
*/
|
|
14622
|
-
to_sql(): string;
|
|
14653
|
+
to_sql(dialect: string): string;
|
|
14623
14654
|
/**
|
|
14624
14655
|
* Produce `self XOR other`.
|
|
14625
14656
|
*/
|