@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/README.md +63 -1
- package/dist/cdn/polyglot.esm.js +1849 -1670
- package/dist/index.cjs +272 -3
- package/dist/index.d.cts +172 -6
- package/dist/index.d.ts +172 -6
- package/dist/index.js +322 -4
- package/dist/index.node.js +264 -3
- package/dist/manual.js +306 -4
- package/dist/polyglot_sql.wasm +0 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1513,6 +1513,32 @@ class WasmWindowDefBuilder {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
if (Symbol.dispose) WasmWindowDefBuilder.prototype[Symbol.dispose] = WasmWindowDefBuilder.prototype.free;
|
|
1516
|
+
function analyze_query$1(sql, options_json) {
|
|
1517
|
+
let deferred3_0;
|
|
1518
|
+
let deferred3_1;
|
|
1519
|
+
try {
|
|
1520
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
1521
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1523
|
+
const ptr1 = passStringToWasm0(options_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1524
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1525
|
+
wasm$3.analyze_query(retptr, ptr0, len0, ptr1, len1);
|
|
1526
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1527
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1528
|
+
deferred3_0 = r0;
|
|
1529
|
+
deferred3_1 = r1;
|
|
1530
|
+
return getStringFromWasm0(r0, r1);
|
|
1531
|
+
} finally {
|
|
1532
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
1533
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
function analyze_query_value$1(sql, options) {
|
|
1537
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1538
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1539
|
+
const ret = wasm$3.analyze_query_value(ptr0, len0, addHeapObject(options));
|
|
1540
|
+
return takeObject(ret);
|
|
1541
|
+
}
|
|
1516
1542
|
function annotate_types$1(sql, dialect, schema_json) {
|
|
1517
1543
|
let deferred4_0;
|
|
1518
1544
|
let deferred4_1;
|
|
@@ -1965,6 +1991,32 @@ function generate$2(ast_json, dialect) {
|
|
|
1965
1991
|
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1966
1992
|
}
|
|
1967
1993
|
}
|
|
1994
|
+
function generate_data_type$1(data_type_json, dialect) {
|
|
1995
|
+
let deferred3_0;
|
|
1996
|
+
let deferred3_1;
|
|
1997
|
+
try {
|
|
1998
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
1999
|
+
const ptr0 = passStringToWasm0(data_type_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2000
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2001
|
+
const ptr1 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2002
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2003
|
+
wasm$3.generate_data_type(retptr, ptr0, len0, ptr1, len1);
|
|
2004
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2005
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2006
|
+
deferred3_0 = r0;
|
|
2007
|
+
deferred3_1 = r1;
|
|
2008
|
+
return getStringFromWasm0(r0, r1);
|
|
2009
|
+
} finally {
|
|
2010
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
2011
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
function generate_data_type_value$1(data_type, dialect) {
|
|
2015
|
+
const ptr0 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2016
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2017
|
+
const ret = wasm$3.generate_data_type_value(addHeapObject(data_type), ptr0, len0);
|
|
2018
|
+
return takeObject(ret);
|
|
2019
|
+
}
|
|
1968
2020
|
function generate_value$1(ast, dialect) {
|
|
1969
2021
|
const ptr0 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
1970
2022
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -2117,6 +2169,34 @@ function parse$2(sql, dialect) {
|
|
|
2117
2169
|
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2118
2170
|
}
|
|
2119
2171
|
}
|
|
2172
|
+
function parse_data_type$1(sql, dialect) {
|
|
2173
|
+
let deferred3_0;
|
|
2174
|
+
let deferred3_1;
|
|
2175
|
+
try {
|
|
2176
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
2177
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2178
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2179
|
+
const ptr1 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2180
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2181
|
+
wasm$3.parse_data_type(retptr, ptr0, len0, ptr1, len1);
|
|
2182
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2183
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2184
|
+
deferred3_0 = r0;
|
|
2185
|
+
deferred3_1 = r1;
|
|
2186
|
+
return getStringFromWasm0(r0, r1);
|
|
2187
|
+
} finally {
|
|
2188
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
2189
|
+
wasm$3.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
function parse_data_type_value$1(sql, dialect) {
|
|
2193
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2194
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2195
|
+
const ptr1 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2196
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2197
|
+
const ret = wasm$3.parse_data_type_value(ptr0, len0, ptr1, len1);
|
|
2198
|
+
return takeObject(ret);
|
|
2199
|
+
}
|
|
2120
2200
|
function parse_value$1(sql, dialect) {
|
|
2121
2201
|
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2122
2202
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -2227,6 +2307,40 @@ function transpile_value$1(sql, read_dialect, write_dialect) {
|
|
|
2227
2307
|
const ret = wasm$3.transpile_value(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2228
2308
|
return takeObject(ret);
|
|
2229
2309
|
}
|
|
2310
|
+
function transpile_with_options$1(sql, read_dialect, write_dialect, options_json) {
|
|
2311
|
+
let deferred5_0;
|
|
2312
|
+
let deferred5_1;
|
|
2313
|
+
try {
|
|
2314
|
+
const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
|
|
2315
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2317
|
+
const ptr1 = passStringToWasm0(read_dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2318
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2319
|
+
const ptr2 = passStringToWasm0(write_dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2320
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2321
|
+
const ptr3 = passStringToWasm0(options_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2322
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2323
|
+
wasm$3.transpile_with_options(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2324
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2325
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2326
|
+
deferred5_0 = r0;
|
|
2327
|
+
deferred5_1 = r1;
|
|
2328
|
+
return getStringFromWasm0(r0, r1);
|
|
2329
|
+
} finally {
|
|
2330
|
+
wasm$3.__wbindgen_add_to_stack_pointer(16);
|
|
2331
|
+
wasm$3.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
function transpile_with_options_value$1(sql, read_dialect, write_dialect, options) {
|
|
2335
|
+
const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2337
|
+
const ptr1 = passStringToWasm0(read_dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2338
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2339
|
+
const ptr2 = passStringToWasm0(write_dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
|
|
2340
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2341
|
+
const ret = wasm$3.transpile_with_options_value(ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(options));
|
|
2342
|
+
return takeObject(ret);
|
|
2343
|
+
}
|
|
2230
2344
|
function validate$2(sql, dialect) {
|
|
2231
2345
|
let deferred3_0;
|
|
2232
2346
|
let deferred3_1;
|
|
@@ -2980,6 +3094,8 @@ async function __polyglot_init_wasm() {
|
|
|
2980
3094
|
__wbg_wasmsetopbuilder_free = __vite__wasmModule.__wbg_wasmsetopbuilder_free;
|
|
2981
3095
|
__wbg_wasmupdatebuilder_free = __vite__wasmModule.__wbg_wasmupdatebuilder_free;
|
|
2982
3096
|
__wbg_wasmwindowdefbuilder_free = __vite__wasmModule.__wbg_wasmwindowdefbuilder_free;
|
|
3097
|
+
analyze_query = __vite__wasmModule.analyze_query;
|
|
3098
|
+
analyze_query_value = __vite__wasmModule.analyze_query_value;
|
|
2983
3099
|
annotate_types = __vite__wasmModule.annotate_types;
|
|
2984
3100
|
annotate_types_value = __vite__wasmModule.annotate_types_value;
|
|
2985
3101
|
ast_add_where = __vite__wasmModule.ast_add_where;
|
|
@@ -3005,6 +3121,8 @@ async function __polyglot_init_wasm() {
|
|
|
3005
3121
|
format_sql_with_options = __vite__wasmModule.format_sql_with_options;
|
|
3006
3122
|
format_sql_with_options_value = __vite__wasmModule.format_sql_with_options_value;
|
|
3007
3123
|
generate$1 = __vite__wasmModule.generate;
|
|
3124
|
+
generate_data_type = __vite__wasmModule.generate_data_type;
|
|
3125
|
+
generate_data_type_value = __vite__wasmModule.generate_data_type_value;
|
|
3008
3126
|
generate_value = __vite__wasmModule.generate_value;
|
|
3009
3127
|
get_dialects = __vite__wasmModule.get_dialects;
|
|
3010
3128
|
get_dialects_value = __vite__wasmModule.get_dialects_value;
|
|
@@ -3014,6 +3132,8 @@ async function __polyglot_init_wasm() {
|
|
|
3014
3132
|
openlineage_job_event = __vite__wasmModule.openlineage_job_event;
|
|
3015
3133
|
openlineage_run_event = __vite__wasmModule.openlineage_run_event;
|
|
3016
3134
|
parse$1 = __vite__wasmModule.parse;
|
|
3135
|
+
parse_data_type = __vite__wasmModule.parse_data_type;
|
|
3136
|
+
parse_data_type_value = __vite__wasmModule.parse_data_type_value;
|
|
3017
3137
|
parse_value = __vite__wasmModule.parse_value;
|
|
3018
3138
|
plan$1 = __vite__wasmModule.plan;
|
|
3019
3139
|
source_tables = __vite__wasmModule.source_tables;
|
|
@@ -3021,6 +3141,8 @@ async function __polyglot_init_wasm() {
|
|
|
3021
3141
|
tokenize_value = __vite__wasmModule.tokenize_value;
|
|
3022
3142
|
transpile$1 = __vite__wasmModule.transpile;
|
|
3023
3143
|
transpile_value = __vite__wasmModule.transpile_value;
|
|
3144
|
+
transpile_with_options = __vite__wasmModule.transpile_with_options;
|
|
3145
|
+
transpile_with_options_value = __vite__wasmModule.transpile_with_options_value;
|
|
3024
3146
|
validate$1 = __vite__wasmModule.validate;
|
|
3025
3147
|
validate_with_options = __vite__wasmModule.validate_with_options;
|
|
3026
3148
|
validate_with_schema = __vite__wasmModule.validate_with_schema;
|
|
@@ -3171,6 +3293,8 @@ let __wbg_wasmselectbuilder_free;
|
|
|
3171
3293
|
let __wbg_wasmsetopbuilder_free;
|
|
3172
3294
|
let __wbg_wasmupdatebuilder_free;
|
|
3173
3295
|
let __wbg_wasmwindowdefbuilder_free;
|
|
3296
|
+
let analyze_query;
|
|
3297
|
+
let analyze_query_value;
|
|
3174
3298
|
let annotate_types;
|
|
3175
3299
|
let annotate_types_value;
|
|
3176
3300
|
let ast_add_where;
|
|
@@ -3196,6 +3320,8 @@ let format_sql_value;
|
|
|
3196
3320
|
let format_sql_with_options;
|
|
3197
3321
|
let format_sql_with_options_value;
|
|
3198
3322
|
let generate$1;
|
|
3323
|
+
let generate_data_type;
|
|
3324
|
+
let generate_data_type_value;
|
|
3199
3325
|
let generate_value;
|
|
3200
3326
|
let get_dialects;
|
|
3201
3327
|
let get_dialects_value;
|
|
@@ -3205,6 +3331,8 @@ let openlineage_column_lineage;
|
|
|
3205
3331
|
let openlineage_job_event;
|
|
3206
3332
|
let openlineage_run_event;
|
|
3207
3333
|
let parse$1;
|
|
3334
|
+
let parse_data_type;
|
|
3335
|
+
let parse_data_type_value;
|
|
3208
3336
|
let parse_value;
|
|
3209
3337
|
let plan$1;
|
|
3210
3338
|
let source_tables;
|
|
@@ -3212,6 +3340,8 @@ let tokenize$1;
|
|
|
3212
3340
|
let tokenize_value;
|
|
3213
3341
|
let transpile$1;
|
|
3214
3342
|
let transpile_value;
|
|
3343
|
+
let transpile_with_options;
|
|
3344
|
+
let transpile_with_options_value;
|
|
3215
3345
|
let validate$1;
|
|
3216
3346
|
let validate_with_options;
|
|
3217
3347
|
let validate_with_schema;
|
|
@@ -3364,6 +3494,8 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
3364
3494
|
__wbindgen_export2,
|
|
3365
3495
|
__wbindgen_export3,
|
|
3366
3496
|
__wbindgen_export4,
|
|
3497
|
+
analyze_query,
|
|
3498
|
+
analyze_query_value,
|
|
3367
3499
|
annotate_types,
|
|
3368
3500
|
annotate_types_value,
|
|
3369
3501
|
ast_add_where,
|
|
@@ -3389,6 +3521,8 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
3389
3521
|
format_sql_with_options,
|
|
3390
3522
|
format_sql_with_options_value,
|
|
3391
3523
|
generate: generate$1,
|
|
3524
|
+
generate_data_type,
|
|
3525
|
+
generate_data_type_value,
|
|
3392
3526
|
generate_value,
|
|
3393
3527
|
get_dialects,
|
|
3394
3528
|
get_dialects_value,
|
|
@@ -3399,6 +3533,8 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
3399
3533
|
openlineage_job_event,
|
|
3400
3534
|
openlineage_run_event,
|
|
3401
3535
|
parse: parse$1,
|
|
3536
|
+
parse_data_type,
|
|
3537
|
+
parse_data_type_value,
|
|
3402
3538
|
parse_value,
|
|
3403
3539
|
plan: plan$1,
|
|
3404
3540
|
source_tables,
|
|
@@ -3406,6 +3542,8 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
3406
3542
|
tokenize_value,
|
|
3407
3543
|
transpile: transpile$1,
|
|
3408
3544
|
transpile_value,
|
|
3545
|
+
transpile_with_options,
|
|
3546
|
+
transpile_with_options_value,
|
|
3409
3547
|
validate: validate$1,
|
|
3410
3548
|
validate_with_options,
|
|
3411
3549
|
validate_with_schema,
|
|
@@ -3549,6 +3687,8 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
3549
3687
|
WasmSetOpBuilder,
|
|
3550
3688
|
WasmUpdateBuilder,
|
|
3551
3689
|
WasmWindowDefBuilder,
|
|
3690
|
+
analyze_query: analyze_query$1,
|
|
3691
|
+
analyze_query_value: analyze_query_value$1,
|
|
3552
3692
|
annotate_types: annotate_types$1,
|
|
3553
3693
|
annotate_types_value: annotate_types_value$1,
|
|
3554
3694
|
ast_add_where: ast_add_where$1,
|
|
@@ -3574,6 +3714,8 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
3574
3714
|
format_sql_with_options: format_sql_with_options$1,
|
|
3575
3715
|
format_sql_with_options_value: format_sql_with_options_value$1,
|
|
3576
3716
|
generate: generate$2,
|
|
3717
|
+
generate_data_type: generate_data_type$1,
|
|
3718
|
+
generate_data_type_value: generate_data_type_value$1,
|
|
3577
3719
|
generate_value: generate_value$1,
|
|
3578
3720
|
get_dialects: get_dialects$1,
|
|
3579
3721
|
get_dialects_value: get_dialects_value$1,
|
|
@@ -3583,6 +3725,8 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
3583
3725
|
openlineage_job_event: openlineage_job_event$1,
|
|
3584
3726
|
openlineage_run_event: openlineage_run_event$1,
|
|
3585
3727
|
parse: parse$2,
|
|
3728
|
+
parse_data_type: parse_data_type$1,
|
|
3729
|
+
parse_data_type_value: parse_data_type_value$1,
|
|
3586
3730
|
parse_value: parse_value$1,
|
|
3587
3731
|
plan: plan$2,
|
|
3588
3732
|
source_tables: source_tables$1,
|
|
@@ -3590,6 +3734,8 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
3590
3734
|
tokenize_value: tokenize_value$1,
|
|
3591
3735
|
transpile: transpile$2,
|
|
3592
3736
|
transpile_value: transpile_value$1,
|
|
3737
|
+
transpile_with_options: transpile_with_options$1,
|
|
3738
|
+
transpile_with_options_value: transpile_with_options_value$1,
|
|
3593
3739
|
validate: validate$2,
|
|
3594
3740
|
validate_with_options: validate_with_options$1,
|
|
3595
3741
|
validate_with_schema: validate_with_schema$1,
|
|
@@ -5332,20 +5478,62 @@ function parseFailure(context, error) {
|
|
|
5332
5478
|
errorColumn: void 0
|
|
5333
5479
|
};
|
|
5334
5480
|
}
|
|
5481
|
+
function dataTypeFailure(context, error) {
|
|
5482
|
+
return {
|
|
5483
|
+
success: false,
|
|
5484
|
+
dataType: void 0,
|
|
5485
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`,
|
|
5486
|
+
errorLine: void 0,
|
|
5487
|
+
errorColumn: void 0
|
|
5488
|
+
};
|
|
5489
|
+
}
|
|
5490
|
+
function generateDataTypeFailure(context, error) {
|
|
5491
|
+
return {
|
|
5492
|
+
success: false,
|
|
5493
|
+
sql: void 0,
|
|
5494
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`,
|
|
5495
|
+
errorLine: void 0,
|
|
5496
|
+
errorColumn: void 0
|
|
5497
|
+
};
|
|
5498
|
+
}
|
|
5335
5499
|
function decodeWasmPayload(payload) {
|
|
5336
5500
|
if (typeof payload === "string") {
|
|
5337
5501
|
return JSON.parse(payload);
|
|
5338
5502
|
}
|
|
5339
5503
|
return payload;
|
|
5340
5504
|
}
|
|
5505
|
+
function queryAnalysisFailure(context, error) {
|
|
5506
|
+
return {
|
|
5507
|
+
success: false,
|
|
5508
|
+
analysis: void 0,
|
|
5509
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`
|
|
5510
|
+
};
|
|
5511
|
+
}
|
|
5341
5512
|
async function init() {
|
|
5342
5513
|
await __polyglot_init_wasm();
|
|
5343
5514
|
}
|
|
5344
5515
|
function isInitialized() {
|
|
5345
5516
|
return !!__vite__wasmModule;
|
|
5346
5517
|
}
|
|
5347
|
-
function transpile(sql, read, write) {
|
|
5518
|
+
function transpile(sql, read, write, options) {
|
|
5348
5519
|
try {
|
|
5520
|
+
if (options && Object.keys(options).length > 0) {
|
|
5521
|
+
if (typeof wasm.transpile_with_options_value === "function") {
|
|
5522
|
+
return decodeWasmPayload(
|
|
5523
|
+
wasm.transpile_with_options_value(sql, read, write, options)
|
|
5524
|
+
);
|
|
5525
|
+
}
|
|
5526
|
+
if (typeof wasm.transpile_with_options === "function") {
|
|
5527
|
+
return JSON.parse(
|
|
5528
|
+
wasm.transpile_with_options(sql, read, write, JSON.stringify(options))
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5531
|
+
return {
|
|
5532
|
+
success: false,
|
|
5533
|
+
sql: void 0,
|
|
5534
|
+
error: "WASM transpile options are not available in this build"
|
|
5535
|
+
};
|
|
5536
|
+
}
|
|
5349
5537
|
if (typeof wasm.transpile_value === "function") {
|
|
5350
5538
|
return decodeWasmPayload(
|
|
5351
5539
|
wasm.transpile_value(sql, read, write)
|
|
@@ -5370,6 +5558,24 @@ function parse(sql, dialect = "generic") {
|
|
|
5370
5558
|
return parseFailure("parse", error);
|
|
5371
5559
|
}
|
|
5372
5560
|
}
|
|
5561
|
+
function parseDataType(sql, dialect = "generic") {
|
|
5562
|
+
try {
|
|
5563
|
+
if (typeof wasm.parse_data_type_value === "function") {
|
|
5564
|
+
return decodeWasmPayload(
|
|
5565
|
+
wasm.parse_data_type_value(sql, dialect)
|
|
5566
|
+
);
|
|
5567
|
+
}
|
|
5568
|
+
const result = JSON.parse(
|
|
5569
|
+
wasm.parse_data_type(sql, dialect)
|
|
5570
|
+
);
|
|
5571
|
+
if (result.success && typeof result.dataType === "string") {
|
|
5572
|
+
result.dataType = JSON.parse(result.dataType);
|
|
5573
|
+
}
|
|
5574
|
+
return result;
|
|
5575
|
+
} catch (error) {
|
|
5576
|
+
return dataTypeFailure("parseDataType", error);
|
|
5577
|
+
}
|
|
5578
|
+
}
|
|
5373
5579
|
function tokenize(sql, dialect = "generic") {
|
|
5374
5580
|
try {
|
|
5375
5581
|
if (typeof wasm.tokenize_value === "function") {
|
|
@@ -5399,6 +5605,21 @@ function generate(ast2, dialect = "generic") {
|
|
|
5399
5605
|
return transpileFailure("generate", error);
|
|
5400
5606
|
}
|
|
5401
5607
|
}
|
|
5608
|
+
function generateDataType(dataType, dialect = "generic") {
|
|
5609
|
+
try {
|
|
5610
|
+
if (typeof wasm.generate_data_type_value === "function") {
|
|
5611
|
+
return decodeWasmPayload(
|
|
5612
|
+
wasm.generate_data_type_value(dataType, dialect)
|
|
5613
|
+
);
|
|
5614
|
+
}
|
|
5615
|
+
const dataTypeJson = JSON.stringify(dataType);
|
|
5616
|
+
return JSON.parse(
|
|
5617
|
+
wasm.generate_data_type(dataTypeJson, dialect)
|
|
5618
|
+
);
|
|
5619
|
+
} catch (error) {
|
|
5620
|
+
return generateDataTypeFailure("generateDataType", error);
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5402
5623
|
function format(sql, dialect = "generic") {
|
|
5403
5624
|
return formatWithOptions(sql, dialect, {});
|
|
5404
5625
|
}
|
|
@@ -5433,6 +5654,30 @@ function getDialects() {
|
|
|
5433
5654
|
function getVersion() {
|
|
5434
5655
|
return wasm.version();
|
|
5435
5656
|
}
|
|
5657
|
+
function analyzeQuery(sql, options = {}) {
|
|
5658
|
+
try {
|
|
5659
|
+
const normalized = {
|
|
5660
|
+
dialect: "generic",
|
|
5661
|
+
...options
|
|
5662
|
+
};
|
|
5663
|
+
if (typeof wasm.analyze_query_value === "function") {
|
|
5664
|
+
return decodeWasmPayload(
|
|
5665
|
+
wasm.analyze_query_value(sql, normalized)
|
|
5666
|
+
);
|
|
5667
|
+
}
|
|
5668
|
+
if (typeof wasm.analyze_query === "function") {
|
|
5669
|
+
return JSON.parse(
|
|
5670
|
+
wasm.analyze_query(sql, JSON.stringify(normalized))
|
|
5671
|
+
);
|
|
5672
|
+
}
|
|
5673
|
+
return {
|
|
5674
|
+
success: false,
|
|
5675
|
+
error: "analyze_query not available in this WASM build"
|
|
5676
|
+
};
|
|
5677
|
+
} catch (error) {
|
|
5678
|
+
return queryAnalysisFailure("analyzeQuery", error);
|
|
5679
|
+
}
|
|
5680
|
+
}
|
|
5436
5681
|
function annotateTypes(sql, dialect = "generic", schema) {
|
|
5437
5682
|
try {
|
|
5438
5683
|
const schemaJson = schema ? JSON.stringify(schema) : "";
|
|
@@ -5478,8 +5723,8 @@ class Polyglot {
|
|
|
5478
5723
|
* Per-dialect builds only support same-dialect and to/from Generic transpilation.
|
|
5479
5724
|
* Use {@link Polyglot.getDialects} to check available dialects.
|
|
5480
5725
|
*/
|
|
5481
|
-
transpile(sql, read, write) {
|
|
5482
|
-
return transpile(sql, read, write);
|
|
5726
|
+
transpile(sql, read, write, options) {
|
|
5727
|
+
return transpile(sql, read, write, options);
|
|
5483
5728
|
}
|
|
5484
5729
|
/**
|
|
5485
5730
|
* Parse SQL into an AST.
|
|
@@ -5487,6 +5732,12 @@ class Polyglot {
|
|
|
5487
5732
|
parse(sql, dialect = "generic") {
|
|
5488
5733
|
return parse(sql, dialect);
|
|
5489
5734
|
}
|
|
5735
|
+
/**
|
|
5736
|
+
* Parse a standalone SQL data type.
|
|
5737
|
+
*/
|
|
5738
|
+
parseDataType(sql, dialect = "generic") {
|
|
5739
|
+
return parseDataType(sql, dialect);
|
|
5740
|
+
}
|
|
5490
5741
|
/**
|
|
5491
5742
|
* Tokenize SQL into a token stream.
|
|
5492
5743
|
*/
|
|
@@ -5499,6 +5750,12 @@ class Polyglot {
|
|
|
5499
5750
|
generate(ast2, dialect = "generic") {
|
|
5500
5751
|
return generate(ast2, dialect);
|
|
5501
5752
|
}
|
|
5753
|
+
/**
|
|
5754
|
+
* Generate SQL from a standalone DataType AST node.
|
|
5755
|
+
*/
|
|
5756
|
+
generateDataType(dataType, dialect = "generic") {
|
|
5757
|
+
return generateDataType(dataType, dialect);
|
|
5758
|
+
}
|
|
5502
5759
|
/**
|
|
5503
5760
|
* Format SQL.
|
|
5504
5761
|
*/
|
|
@@ -5530,16 +5787,25 @@ class Polyglot {
|
|
|
5530
5787
|
annotateTypes(sql, dialect = "generic", schema) {
|
|
5531
5788
|
return annotateTypes(sql, dialect, schema);
|
|
5532
5789
|
}
|
|
5790
|
+
/**
|
|
5791
|
+
* Return compact query analysis facts for a SELECT or set operation.
|
|
5792
|
+
*/
|
|
5793
|
+
analyzeQuery(sql, options = {}) {
|
|
5794
|
+
return analyzeQuery(sql, options);
|
|
5795
|
+
}
|
|
5533
5796
|
}
|
|
5534
5797
|
const index = {
|
|
5535
5798
|
init,
|
|
5536
5799
|
isInitialized,
|
|
5537
5800
|
transpile,
|
|
5538
5801
|
parse,
|
|
5802
|
+
parseDataType,
|
|
5539
5803
|
tokenize,
|
|
5540
5804
|
generate,
|
|
5805
|
+
generateDataType,
|
|
5541
5806
|
format,
|
|
5542
5807
|
annotateTypes,
|
|
5808
|
+
analyzeQuery,
|
|
5543
5809
|
getDialects,
|
|
5544
5810
|
getVersion,
|
|
5545
5811
|
lineage,
|
|
@@ -5569,6 +5835,7 @@ exports.ValidationSeverity = ValidationSeverity;
|
|
|
5569
5835
|
exports.WindowDefBuilder = WindowDefBuilder;
|
|
5570
5836
|
exports.abs = abs;
|
|
5571
5837
|
exports.alias = alias;
|
|
5838
|
+
exports.analyzeQuery = analyzeQuery;
|
|
5572
5839
|
exports.and = and;
|
|
5573
5840
|
exports.annotateTypes = annotateTypes;
|
|
5574
5841
|
exports.ast = index$1;
|
|
@@ -5602,6 +5869,7 @@ exports.format = format;
|
|
|
5602
5869
|
exports.formatWithOptions = formatWithOptions;
|
|
5603
5870
|
exports.func = func;
|
|
5604
5871
|
exports.generate = generate;
|
|
5872
|
+
exports.generateDataType = generateDataType;
|
|
5605
5873
|
exports.getColumns = getColumns;
|
|
5606
5874
|
exports.getDialects = getDialects;
|
|
5607
5875
|
exports.getInferredType = getInferredType;
|
|
@@ -5638,6 +5906,7 @@ exports.openLineageJobEvent = openLineageJobEvent;
|
|
|
5638
5906
|
exports.openLineageRunEvent = openLineageRunEvent;
|
|
5639
5907
|
exports.or = or;
|
|
5640
5908
|
exports.parse = parse;
|
|
5909
|
+
exports.parseDataType = parseDataType;
|
|
5641
5910
|
exports.plan = plan;
|
|
5642
5911
|
exports.power = power;
|
|
5643
5912
|
exports.rank = rank;
|