@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/manual.js
CHANGED
|
@@ -1552,6 +1552,46 @@ class WasmWindowDefBuilder {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
if (Symbol.dispose) WasmWindowDefBuilder.prototype[Symbol.dispose] = WasmWindowDefBuilder.prototype.free;
|
|
1554
1554
|
|
|
1555
|
+
/**
|
|
1556
|
+
* Return compact query analysis facts for a SELECT or set operation.
|
|
1557
|
+
* @param {string} sql
|
|
1558
|
+
* @param {string} options_json
|
|
1559
|
+
* @returns {string}
|
|
1560
|
+
*/
|
|
1561
|
+
function analyze_query(sql, options_json) {
|
|
1562
|
+
let deferred3_0;
|
|
1563
|
+
let deferred3_1;
|
|
1564
|
+
try {
|
|
1565
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
1566
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
1567
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1568
|
+
const ptr1 = passStringToWasm0(options_json, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
1569
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1570
|
+
wasm$2.analyze_query(retptr, ptr0, len0, ptr1, len1);
|
|
1571
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1572
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1573
|
+
deferred3_0 = r0;
|
|
1574
|
+
deferred3_1 = r1;
|
|
1575
|
+
return getStringFromWasm0(r0, r1);
|
|
1576
|
+
} finally {
|
|
1577
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
1578
|
+
wasm$2.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Return compact query analysis facts as a structured JS value.
|
|
1584
|
+
* @param {string} sql
|
|
1585
|
+
* @param {any} options
|
|
1586
|
+
* @returns {any}
|
|
1587
|
+
*/
|
|
1588
|
+
function analyze_query_value(sql, options) {
|
|
1589
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
1590
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1591
|
+
const ret = wasm$2.analyze_query_value(ptr0, len0, addHeapObject(options));
|
|
1592
|
+
return takeObject(ret);
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1555
1595
|
/**
|
|
1556
1596
|
* Annotate types on a parsed SQL AST in-place.
|
|
1557
1597
|
*
|
|
@@ -2217,6 +2257,46 @@ function generate$1(ast_json, dialect) {
|
|
|
2217
2257
|
}
|
|
2218
2258
|
}
|
|
2219
2259
|
|
|
2260
|
+
/**
|
|
2261
|
+
* Generate SQL from a standalone DataType JSON object.
|
|
2262
|
+
* @param {string} data_type_json
|
|
2263
|
+
* @param {string} dialect
|
|
2264
|
+
* @returns {string}
|
|
2265
|
+
*/
|
|
2266
|
+
function generate_data_type(data_type_json, dialect) {
|
|
2267
|
+
let deferred3_0;
|
|
2268
|
+
let deferred3_1;
|
|
2269
|
+
try {
|
|
2270
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
2271
|
+
const ptr0 = passStringToWasm0(data_type_json, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2273
|
+
const ptr1 = passStringToWasm0(dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2274
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2275
|
+
wasm$2.generate_data_type(retptr, ptr0, len0, ptr1, len1);
|
|
2276
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2277
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2278
|
+
deferred3_0 = r0;
|
|
2279
|
+
deferred3_1 = r1;
|
|
2280
|
+
return getStringFromWasm0(r0, r1);
|
|
2281
|
+
} finally {
|
|
2282
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
2283
|
+
wasm$2.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* Generate SQL from a standalone DataType represented as a structured JS value.
|
|
2289
|
+
* @param {any} data_type
|
|
2290
|
+
* @param {string} dialect
|
|
2291
|
+
* @returns {any}
|
|
2292
|
+
*/
|
|
2293
|
+
function generate_data_type_value(data_type, dialect) {
|
|
2294
|
+
const ptr0 = passStringToWasm0(dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2296
|
+
const ret = wasm$2.generate_data_type_value(addHeapObject(data_type), ptr0, len0);
|
|
2297
|
+
return takeObject(ret);
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2220
2300
|
/**
|
|
2221
2301
|
* Generate SQL from an AST represented as a structured JS value.
|
|
2222
2302
|
* @param {any} ast
|
|
@@ -2462,6 +2542,48 @@ function parse$1(sql, dialect) {
|
|
|
2462
2542
|
}
|
|
2463
2543
|
}
|
|
2464
2544
|
|
|
2545
|
+
/**
|
|
2546
|
+
* Parse a standalone SQL data type and return a JSON string payload.
|
|
2547
|
+
* @param {string} sql
|
|
2548
|
+
* @param {string} dialect
|
|
2549
|
+
* @returns {string}
|
|
2550
|
+
*/
|
|
2551
|
+
function parse_data_type(sql, dialect) {
|
|
2552
|
+
let deferred3_0;
|
|
2553
|
+
let deferred3_1;
|
|
2554
|
+
try {
|
|
2555
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
2556
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2557
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2558
|
+
const ptr1 = passStringToWasm0(dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2559
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2560
|
+
wasm$2.parse_data_type(retptr, ptr0, len0, ptr1, len1);
|
|
2561
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2562
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2563
|
+
deferred3_0 = r0;
|
|
2564
|
+
deferred3_1 = r1;
|
|
2565
|
+
return getStringFromWasm0(r0, r1);
|
|
2566
|
+
} finally {
|
|
2567
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
2568
|
+
wasm$2.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Parse a standalone SQL data type and return a structured JS value payload.
|
|
2574
|
+
* @param {string} sql
|
|
2575
|
+
* @param {string} dialect
|
|
2576
|
+
* @returns {any}
|
|
2577
|
+
*/
|
|
2578
|
+
function parse_data_type_value(sql, dialect) {
|
|
2579
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2580
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2581
|
+
const ptr1 = passStringToWasm0(dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2582
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2583
|
+
const ret = wasm$2.parse_data_type_value(ptr0, len0, ptr1, len1);
|
|
2584
|
+
return takeObject(ret);
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2465
2587
|
/**
|
|
2466
2588
|
* Parse SQL and return a structured JS object with AST values.
|
|
2467
2589
|
* @param {string} sql
|
|
@@ -2654,6 +2776,58 @@ function transpile_value(sql, read_dialect, write_dialect) {
|
|
|
2654
2776
|
return takeObject(ret);
|
|
2655
2777
|
}
|
|
2656
2778
|
|
|
2779
|
+
/**
|
|
2780
|
+
* Transpile SQL with explicit options encoded as a JSON string.
|
|
2781
|
+
* @param {string} sql
|
|
2782
|
+
* @param {string} read_dialect
|
|
2783
|
+
* @param {string} write_dialect
|
|
2784
|
+
* @param {string} options_json
|
|
2785
|
+
* @returns {string}
|
|
2786
|
+
*/
|
|
2787
|
+
function transpile_with_options(sql, read_dialect, write_dialect, options_json) {
|
|
2788
|
+
let deferred5_0;
|
|
2789
|
+
let deferred5_1;
|
|
2790
|
+
try {
|
|
2791
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
2792
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2793
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2794
|
+
const ptr1 = passStringToWasm0(read_dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2795
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2796
|
+
const ptr2 = passStringToWasm0(write_dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2797
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2798
|
+
const ptr3 = passStringToWasm0(options_json, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2799
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2800
|
+
wasm$2.transpile_with_options(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2801
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2802
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2803
|
+
deferred5_0 = r0;
|
|
2804
|
+
deferred5_1 = r1;
|
|
2805
|
+
return getStringFromWasm0(r0, r1);
|
|
2806
|
+
} finally {
|
|
2807
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
2808
|
+
wasm$2.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Transpile SQL with explicit options and return a structured JS object.
|
|
2814
|
+
* @param {string} sql
|
|
2815
|
+
* @param {string} read_dialect
|
|
2816
|
+
* @param {string} write_dialect
|
|
2817
|
+
* @param {any} options
|
|
2818
|
+
* @returns {any}
|
|
2819
|
+
*/
|
|
2820
|
+
function transpile_with_options_value(sql, read_dialect, write_dialect, options) {
|
|
2821
|
+
const ptr0 = passStringToWasm0(sql, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2822
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2823
|
+
const ptr1 = passStringToWasm0(read_dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2824
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2825
|
+
const ptr2 = passStringToWasm0(write_dialect, wasm$2.__wbindgen_export, wasm$2.__wbindgen_export2);
|
|
2826
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2827
|
+
const ret = wasm$2.transpile_with_options_value(ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(options));
|
|
2828
|
+
return takeObject(ret);
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2657
2831
|
/**
|
|
2658
2832
|
* Validate SQL syntax.
|
|
2659
2833
|
*
|
|
@@ -3642,6 +3816,8 @@ const wasmModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
|
|
|
3642
3816
|
WasmSetOpBuilder,
|
|
3643
3817
|
WasmUpdateBuilder,
|
|
3644
3818
|
WasmWindowDefBuilder,
|
|
3819
|
+
analyze_query,
|
|
3820
|
+
analyze_query_value,
|
|
3645
3821
|
annotate_types,
|
|
3646
3822
|
annotate_types_value,
|
|
3647
3823
|
ast_add_where,
|
|
@@ -3667,6 +3843,8 @@ const wasmModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
|
|
|
3667
3843
|
format_sql_with_options,
|
|
3668
3844
|
format_sql_with_options_value,
|
|
3669
3845
|
generate: generate$1,
|
|
3846
|
+
generate_data_type,
|
|
3847
|
+
generate_data_type_value,
|
|
3670
3848
|
generate_value,
|
|
3671
3849
|
get_dialects,
|
|
3672
3850
|
get_dialects_value,
|
|
@@ -3679,6 +3857,8 @@ const wasmModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
|
|
|
3679
3857
|
openlineage_job_event,
|
|
3680
3858
|
openlineage_run_event,
|
|
3681
3859
|
parse: parse$1,
|
|
3860
|
+
parse_data_type,
|
|
3861
|
+
parse_data_type_value,
|
|
3682
3862
|
parse_value,
|
|
3683
3863
|
plan: plan$1,
|
|
3684
3864
|
source_tables,
|
|
@@ -3686,6 +3866,8 @@ const wasmModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
|
|
|
3686
3866
|
tokenize_value,
|
|
3687
3867
|
transpile: transpile$1,
|
|
3688
3868
|
transpile_value,
|
|
3869
|
+
transpile_with_options,
|
|
3870
|
+
transpile_with_options_value,
|
|
3689
3871
|
validate: validate$1,
|
|
3690
3872
|
validate_with_options,
|
|
3691
3873
|
validate_with_schema,
|
|
@@ -5443,20 +5625,62 @@ function parseFailure(context, error) {
|
|
|
5443
5625
|
errorColumn: void 0
|
|
5444
5626
|
};
|
|
5445
5627
|
}
|
|
5628
|
+
function dataTypeFailure(context, error) {
|
|
5629
|
+
return {
|
|
5630
|
+
success: false,
|
|
5631
|
+
dataType: void 0,
|
|
5632
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`,
|
|
5633
|
+
errorLine: void 0,
|
|
5634
|
+
errorColumn: void 0
|
|
5635
|
+
};
|
|
5636
|
+
}
|
|
5637
|
+
function generateDataTypeFailure(context, error) {
|
|
5638
|
+
return {
|
|
5639
|
+
success: false,
|
|
5640
|
+
sql: void 0,
|
|
5641
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`,
|
|
5642
|
+
errorLine: void 0,
|
|
5643
|
+
errorColumn: void 0
|
|
5644
|
+
};
|
|
5645
|
+
}
|
|
5446
5646
|
function decodeWasmPayload(payload) {
|
|
5447
5647
|
if (typeof payload === "string") {
|
|
5448
5648
|
return JSON.parse(payload);
|
|
5449
5649
|
}
|
|
5450
5650
|
return payload;
|
|
5451
5651
|
}
|
|
5652
|
+
function queryAnalysisFailure(context, error) {
|
|
5653
|
+
return {
|
|
5654
|
+
success: false,
|
|
5655
|
+
analysis: void 0,
|
|
5656
|
+
error: `WASM ${context} failed: ${errorMessage(error)}`
|
|
5657
|
+
};
|
|
5658
|
+
}
|
|
5452
5659
|
async function init$1() {
|
|
5453
5660
|
return Promise.resolve();
|
|
5454
5661
|
}
|
|
5455
5662
|
function isInitialized$1() {
|
|
5456
5663
|
return true;
|
|
5457
5664
|
}
|
|
5458
|
-
function transpile(sql, read, write) {
|
|
5665
|
+
function transpile(sql, read, write, options) {
|
|
5459
5666
|
try {
|
|
5667
|
+
if (options && Object.keys(options).length > 0) {
|
|
5668
|
+
if (typeof wasm.transpile_with_options_value === "function") {
|
|
5669
|
+
return decodeWasmPayload(
|
|
5670
|
+
wasm.transpile_with_options_value(sql, read, write, options)
|
|
5671
|
+
);
|
|
5672
|
+
}
|
|
5673
|
+
if (typeof wasm.transpile_with_options === "function") {
|
|
5674
|
+
return JSON.parse(
|
|
5675
|
+
wasm.transpile_with_options(sql, read, write, JSON.stringify(options))
|
|
5676
|
+
);
|
|
5677
|
+
}
|
|
5678
|
+
return {
|
|
5679
|
+
success: false,
|
|
5680
|
+
sql: void 0,
|
|
5681
|
+
error: "WASM transpile options are not available in this build"
|
|
5682
|
+
};
|
|
5683
|
+
}
|
|
5460
5684
|
if (typeof wasm.transpile_value === "function") {
|
|
5461
5685
|
return decodeWasmPayload(
|
|
5462
5686
|
wasm.transpile_value(sql, read, write)
|
|
@@ -5481,6 +5705,24 @@ function parse(sql, dialect = "generic" /* Generic */) {
|
|
|
5481
5705
|
return parseFailure("parse", error);
|
|
5482
5706
|
}
|
|
5483
5707
|
}
|
|
5708
|
+
function parseDataType(sql, dialect = "generic" /* Generic */) {
|
|
5709
|
+
try {
|
|
5710
|
+
if (typeof wasm.parse_data_type_value === "function") {
|
|
5711
|
+
return decodeWasmPayload(
|
|
5712
|
+
wasm.parse_data_type_value(sql, dialect)
|
|
5713
|
+
);
|
|
5714
|
+
}
|
|
5715
|
+
const result = JSON.parse(
|
|
5716
|
+
wasm.parse_data_type(sql, dialect)
|
|
5717
|
+
);
|
|
5718
|
+
if (result.success && typeof result.dataType === "string") {
|
|
5719
|
+
result.dataType = JSON.parse(result.dataType);
|
|
5720
|
+
}
|
|
5721
|
+
return result;
|
|
5722
|
+
} catch (error) {
|
|
5723
|
+
return dataTypeFailure("parseDataType", error);
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5484
5726
|
function tokenize(sql, dialect = "generic" /* Generic */) {
|
|
5485
5727
|
try {
|
|
5486
5728
|
if (typeof wasm.tokenize_value === "function") {
|
|
@@ -5510,6 +5752,21 @@ function generate(ast2, dialect = "generic" /* Generic */) {
|
|
|
5510
5752
|
return transpileFailure("generate", error);
|
|
5511
5753
|
}
|
|
5512
5754
|
}
|
|
5755
|
+
function generateDataType(dataType, dialect = "generic" /* Generic */) {
|
|
5756
|
+
try {
|
|
5757
|
+
if (typeof wasm.generate_data_type_value === "function") {
|
|
5758
|
+
return decodeWasmPayload(
|
|
5759
|
+
wasm.generate_data_type_value(dataType, dialect)
|
|
5760
|
+
);
|
|
5761
|
+
}
|
|
5762
|
+
const dataTypeJson = JSON.stringify(dataType);
|
|
5763
|
+
return JSON.parse(
|
|
5764
|
+
wasm.generate_data_type(dataTypeJson, dialect)
|
|
5765
|
+
);
|
|
5766
|
+
} catch (error) {
|
|
5767
|
+
return generateDataTypeFailure("generateDataType", error);
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5513
5770
|
function format(sql, dialect = "generic" /* Generic */) {
|
|
5514
5771
|
return formatWithOptions(sql, dialect, {});
|
|
5515
5772
|
}
|
|
@@ -5544,6 +5801,30 @@ function getDialects() {
|
|
|
5544
5801
|
function getVersion() {
|
|
5545
5802
|
return wasm.version();
|
|
5546
5803
|
}
|
|
5804
|
+
function analyzeQuery(sql, options = {}) {
|
|
5805
|
+
try {
|
|
5806
|
+
const normalized = {
|
|
5807
|
+
dialect: "generic" /* Generic */,
|
|
5808
|
+
...options
|
|
5809
|
+
};
|
|
5810
|
+
if (typeof wasm.analyze_query_value === "function") {
|
|
5811
|
+
return decodeWasmPayload(
|
|
5812
|
+
wasm.analyze_query_value(sql, normalized)
|
|
5813
|
+
);
|
|
5814
|
+
}
|
|
5815
|
+
if (typeof wasm.analyze_query === "function") {
|
|
5816
|
+
return JSON.parse(
|
|
5817
|
+
wasm.analyze_query(sql, JSON.stringify(normalized))
|
|
5818
|
+
);
|
|
5819
|
+
}
|
|
5820
|
+
return {
|
|
5821
|
+
success: false,
|
|
5822
|
+
error: "analyze_query not available in this WASM build"
|
|
5823
|
+
};
|
|
5824
|
+
} catch (error) {
|
|
5825
|
+
return queryAnalysisFailure("analyzeQuery", error);
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5547
5828
|
function annotateTypes(sql, dialect = "generic" /* Generic */, schema) {
|
|
5548
5829
|
try {
|
|
5549
5830
|
const schemaJson = schema ? JSON.stringify(schema) : "";
|
|
@@ -5589,8 +5870,8 @@ class Polyglot {
|
|
|
5589
5870
|
* Per-dialect builds only support same-dialect and to/from Generic transpilation.
|
|
5590
5871
|
* Use {@link Polyglot.getDialects} to check available dialects.
|
|
5591
5872
|
*/
|
|
5592
|
-
transpile(sql, read, write) {
|
|
5593
|
-
return transpile(sql, read, write);
|
|
5873
|
+
transpile(sql, read, write, options) {
|
|
5874
|
+
return transpile(sql, read, write, options);
|
|
5594
5875
|
}
|
|
5595
5876
|
/**
|
|
5596
5877
|
* Parse SQL into an AST.
|
|
@@ -5598,6 +5879,12 @@ class Polyglot {
|
|
|
5598
5879
|
parse(sql, dialect = "generic" /* Generic */) {
|
|
5599
5880
|
return parse(sql, dialect);
|
|
5600
5881
|
}
|
|
5882
|
+
/**
|
|
5883
|
+
* Parse a standalone SQL data type.
|
|
5884
|
+
*/
|
|
5885
|
+
parseDataType(sql, dialect = "generic" /* Generic */) {
|
|
5886
|
+
return parseDataType(sql, dialect);
|
|
5887
|
+
}
|
|
5601
5888
|
/**
|
|
5602
5889
|
* Tokenize SQL into a token stream.
|
|
5603
5890
|
*/
|
|
@@ -5610,6 +5897,12 @@ class Polyglot {
|
|
|
5610
5897
|
generate(ast2, dialect = "generic" /* Generic */) {
|
|
5611
5898
|
return generate(ast2, dialect);
|
|
5612
5899
|
}
|
|
5900
|
+
/**
|
|
5901
|
+
* Generate SQL from a standalone DataType AST node.
|
|
5902
|
+
*/
|
|
5903
|
+
generateDataType(dataType, dialect = "generic" /* Generic */) {
|
|
5904
|
+
return generateDataType(dataType, dialect);
|
|
5905
|
+
}
|
|
5613
5906
|
/**
|
|
5614
5907
|
* Format SQL.
|
|
5615
5908
|
*/
|
|
@@ -5641,16 +5934,25 @@ class Polyglot {
|
|
|
5641
5934
|
annotateTypes(sql, dialect = "generic" /* Generic */, schema) {
|
|
5642
5935
|
return annotateTypes(sql, dialect, schema);
|
|
5643
5936
|
}
|
|
5937
|
+
/**
|
|
5938
|
+
* Return compact query analysis facts for a SELECT or set operation.
|
|
5939
|
+
*/
|
|
5940
|
+
analyzeQuery(sql, options = {}) {
|
|
5941
|
+
return analyzeQuery(sql, options);
|
|
5942
|
+
}
|
|
5644
5943
|
}
|
|
5645
5944
|
const autoDefault = {
|
|
5646
5945
|
init: init$1,
|
|
5647
5946
|
isInitialized: isInitialized$1,
|
|
5648
5947
|
transpile,
|
|
5649
5948
|
parse,
|
|
5949
|
+
parseDataType,
|
|
5650
5950
|
tokenize,
|
|
5651
5951
|
generate,
|
|
5952
|
+
generateDataType,
|
|
5652
5953
|
format,
|
|
5653
5954
|
annotateTypes,
|
|
5955
|
+
analyzeQuery,
|
|
5654
5956
|
getDialects,
|
|
5655
5957
|
getVersion,
|
|
5656
5958
|
lineage: lineage,
|
|
@@ -5679,4 +5981,4 @@ const manual = {
|
|
|
5679
5981
|
isInitialized
|
|
5680
5982
|
};
|
|
5681
5983
|
|
|
5682
|
-
export { CaseBuilder, DeleteBuilder, Dialect, Expr, InsertBuilder, MergeBuilder, Polyglot, SelectBuilder, SetOpBuilder, UpdateBuilder, ValidationSeverity, WindowDefBuilder, abs, alias, and, annotateTypes, index as ast, avg, boolean, caseOf, caseWhen, cast, ceil, changesOnly, coalesce, col, concatWs, condition, count, countDistinct, currentDate, currentTime, currentTimestamp, manual as default, del, deleteFrom, denseRank, diff, except, exp, extract, findAll, floor, format, formatWithOptions, func, generate, getColumns, getDialects, getInferredType, getSourceTables, getVersion, greatest, hasChanges, ifNull, init, initcap, insert, insertInto, intersect, isColumn, isFunction, isInitialized, isLiteral, isSelect, least, length, lineage, lineageWithSchema, lit, ln, lower, ltrim, max, mergeInto, min, not, nullIf, openLineageColumnLineage, openLineageJobEvent, openLineageRunEvent, or, parse, plan, power, rank, renameColumns, replace, reverse, round, rowNumber, rtrim, select, sign, sqlExpr, sqlNull, sqrt, star, subquery, substring, sum, table, tokenize, transform, transpile, trim, union, unionAll, update, upper, validate, validateWithSchema, walk };
|
|
5984
|
+
export { CaseBuilder, DeleteBuilder, Dialect, Expr, InsertBuilder, MergeBuilder, Polyglot, SelectBuilder, SetOpBuilder, UpdateBuilder, ValidationSeverity, WindowDefBuilder, abs, alias, analyzeQuery, and, annotateTypes, index as ast, avg, boolean, caseOf, caseWhen, cast, ceil, changesOnly, coalesce, col, concatWs, condition, count, countDistinct, currentDate, currentTime, currentTimestamp, manual as default, del, deleteFrom, denseRank, diff, except, exp, extract, findAll, floor, format, formatWithOptions, func, generate, generateDataType, getColumns, getDialects, getInferredType, getSourceTables, getVersion, greatest, hasChanges, ifNull, init, initcap, insert, insertInto, intersect, isColumn, isFunction, isInitialized, isLiteral, isSelect, least, length, lineage, lineageWithSchema, lit, ln, lower, ltrim, max, mergeInto, min, not, nullIf, openLineageColumnLineage, openLineageJobEvent, openLineageRunEvent, or, parse, parseDataType, plan, power, rank, renameColumns, replace, reverse, round, rowNumber, rtrim, select, sign, sqlExpr, sqlNull, sqrt, star, subquery, substring, sum, table, tokenize, transform, transpile, trim, union, unionAll, update, upper, validate, validateWithSchema, walk };
|
package/dist/polyglot_sql.wasm
CHANGED
|
Binary file
|