@polyglot-sql/sdk 0.1.10 → 0.1.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/index.cjs CHANGED
@@ -1933,6 +1933,30 @@ function lineage_sql$1(sql, column, dialect, trim_selects) {
1933
1933
  wasm$3.__wbindgen_export4(deferred4_0, deferred4_1, 1);
1934
1934
  }
1935
1935
  }
1936
+ function lineage_sql_with_schema$1(sql, column, schema_json, dialect, trim_selects) {
1937
+ let deferred5_0;
1938
+ let deferred5_1;
1939
+ try {
1940
+ const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
1941
+ const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
1942
+ const len0 = WASM_VECTOR_LEN;
1943
+ const ptr1 = passStringToWasm0(column, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
1944
+ const len1 = WASM_VECTOR_LEN;
1945
+ const ptr2 = passStringToWasm0(schema_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
1946
+ const len2 = WASM_VECTOR_LEN;
1947
+ const ptr3 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
1948
+ const len3 = WASM_VECTOR_LEN;
1949
+ wasm$3.lineage_sql_with_schema(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, trim_selects);
1950
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1951
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1952
+ deferred5_0 = r0;
1953
+ deferred5_1 = r1;
1954
+ return getStringFromWasm0(r0, r1);
1955
+ } finally {
1956
+ wasm$3.__wbindgen_add_to_stack_pointer(16);
1957
+ wasm$3.__wbindgen_export4(deferred5_0, deferred5_1, 1);
1958
+ }
1959
+ }
1936
1960
  function parse$2(sql, dialect) {
1937
1961
  let deferred3_0;
1938
1962
  let deferred3_1;
@@ -2841,6 +2865,7 @@ async function __polyglot_init_wasm() {
2841
2865
  get_dialects = __vite__wasmModule.get_dialects;
2842
2866
  get_dialects_value = __vite__wasmModule.get_dialects_value;
2843
2867
  lineage_sql = __vite__wasmModule.lineage_sql;
2868
+ lineage_sql_with_schema = __vite__wasmModule.lineage_sql_with_schema;
2844
2869
  parse$1 = __vite__wasmModule.parse;
2845
2870
  parse_value = __vite__wasmModule.parse_value;
2846
2871
  plan$1 = __vite__wasmModule.plan;
@@ -3024,6 +3049,7 @@ let generate_value;
3024
3049
  let get_dialects;
3025
3050
  let get_dialects_value;
3026
3051
  let lineage_sql;
3052
+ let lineage_sql_with_schema;
3027
3053
  let parse$1;
3028
3054
  let parse_value;
3029
3055
  let plan$1;
@@ -3209,6 +3235,7 @@ const wasm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
3209
3235
  get_dialects,
3210
3236
  get_dialects_value,
3211
3237
  lineage_sql,
3238
+ lineage_sql_with_schema,
3212
3239
  memory,
3213
3240
  parse: parse$1,
3214
3241
  parse_value,
@@ -3386,6 +3413,7 @@ const wasmModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
3386
3413
  get_dialects: get_dialects$1,
3387
3414
  get_dialects_value: get_dialects_value$1,
3388
3415
  lineage_sql: lineage_sql$1,
3416
+ lineage_sql_with_schema: lineage_sql_with_schema$1,
3389
3417
  parse: parse$2,
3390
3418
  parse_value: parse_value$1,
3391
3419
  plan: plan$2,
@@ -4992,6 +5020,16 @@ function lineage(column, sql, dialect = "generic", trimSelects = false) {
4992
5020
  const resultJson = lineage_sql$1(sql, column, dialect, trimSelects);
4993
5021
  return JSON.parse(resultJson);
4994
5022
  }
5023
+ function lineageWithSchema(column, sql, schema, dialect = "generic", trimSelects = false) {
5024
+ const resultJson = lineage_sql_with_schema$1(
5025
+ sql,
5026
+ column,
5027
+ JSON.stringify(schema),
5028
+ dialect,
5029
+ trimSelects
5030
+ );
5031
+ return JSON.parse(resultJson);
5032
+ }
4995
5033
  function getSourceTables(column, sql, dialect = "generic") {
4996
5034
  const resultJson = source_tables$1(sql, column, dialect);
4997
5035
  return JSON.parse(resultJson);
@@ -5256,6 +5294,7 @@ const index = {
5256
5294
  getDialects,
5257
5295
  getVersion,
5258
5296
  lineage,
5297
+ lineageWithSchema,
5259
5298
  getSourceTables,
5260
5299
  diff,
5261
5300
  hasChanges,
@@ -5330,6 +5369,7 @@ exports.isSelect = isSelect;
5330
5369
  exports.least = least;
5331
5370
  exports.length = length;
5332
5371
  exports.lineage = lineage;
5372
+ exports.lineageWithSchema = lineageWithSchema;
5333
5373
  exports.lit = lit;
5334
5374
  exports.ln = ln;
5335
5375
  exports.lower = lower;
package/dist/index.d.cts CHANGED
@@ -1465,6 +1465,13 @@ declare type ClusterBy = {
1465
1465
  expressions: Array<Ordered>;
1466
1466
  };
1467
1467
 
1468
+ /**
1469
+ * BigQuery CLUSTER BY property in CREATE TABLE statements.
1470
+ */
1471
+ declare type ClusterByColumnsProperty = {
1472
+ columns: Array<Identifier>;
1473
+ };
1474
+
1468
1475
  /**
1469
1476
  * ClusteredByProperty
1470
1477
  */
@@ -3141,6 +3148,7 @@ declare const _default: {
3141
3148
  getDialects: typeof getDialects;
3142
3149
  getVersion: typeof getVersion;
3143
3150
  lineage: typeof lineage;
3151
+ lineageWithSchema: typeof lineageWithSchema;
3144
3152
  getSourceTables: typeof getSourceTables;
3145
3153
  diff: typeof diff;
3146
3154
  hasChanges: typeof hasChanges;
@@ -5092,8 +5100,12 @@ declare type Expression = {
5092
5100
  "on_commit_property": OnCommitProperty;
5093
5101
  } | {
5094
5102
  "partitioned_by_property": PartitionedByProperty;
5103
+ } | {
5104
+ "partition_by_property": PartitionByProperty;
5095
5105
  } | {
5096
5106
  "partitioned_by_bucket": PartitionedByBucket;
5107
+ } | {
5108
+ "cluster_by_columns_property": ClusterByColumnsProperty;
5097
5109
  } | {
5098
5110
  "partition_by_truncate": PartitionByTruncate;
5099
5111
  } | {
@@ -5186,6 +5198,8 @@ declare type Expression = {
5186
5198
  "include_property": IncludeProperty;
5187
5199
  } | {
5188
5200
  "properties": Properties;
5201
+ } | {
5202
+ "options_property": OptionsProperty;
5189
5203
  } | {
5190
5204
  "input_output_format": InputOutputFormat;
5191
5205
  } | {
@@ -8597,6 +8611,17 @@ export declare interface LineageResult {
8597
8611
  error?: string;
8598
8612
  }
8599
8613
 
8614
+ /**
8615
+ * Trace the lineage of a column through a SQL query using schema metadata.
8616
+ *
8617
+ * @param column - Column name to trace
8618
+ * @param sql - SQL string to analyze
8619
+ * @param schema - ValidationSchema-compatible schema object
8620
+ * @param dialect - Dialect for parsing/qualification (default: 'generic')
8621
+ * @param trimSelects - Trim SELECT to only target column (default: false)
8622
+ */
8623
+ export declare function lineageWithSchema(column: string, sql: string, schema: Schema, dialect?: string, trimSelects?: boolean): LineageResult;
8624
+
8600
8625
  /**
8601
8626
  * List
8602
8627
  */
@@ -9470,6 +9495,21 @@ declare type Operator = {
9470
9495
  comments?: Array<string>;
9471
9496
  };
9472
9497
 
9498
+ /**
9499
+ * Key/value pair in a BigQuery OPTIONS (...) clause.
9500
+ */
9501
+ declare type OptionEntry = {
9502
+ key: Identifier;
9503
+ value: Expression;
9504
+ };
9505
+
9506
+ /**
9507
+ * Typed BigQuery OPTIONS (...) property for CREATE TABLE and related DDL.
9508
+ */
9509
+ declare type OptionsProperty = {
9510
+ entries: Array<OptionEntry>;
9511
+ };
9512
+
9473
9513
  /** Chain multiple conditions with OR. */
9474
9514
  export declare function or(...conditions: ExprInput[]): Expr;
9475
9515
 
@@ -9793,6 +9833,13 @@ declare type PartitionByListProperty = {
9793
9833
  create_expressions: Expression | null;
9794
9834
  };
9795
9835
 
9836
+ /**
9837
+ * BigQuery PARTITION BY property in CREATE TABLE statements.
9838
+ */
9839
+ declare type PartitionByProperty = {
9840
+ expressions: Array<Expression>;
9841
+ };
9842
+
9796
9843
  /**
9797
9844
  * PartitionByRangeProperty
9798
9845
  */
package/dist/index.d.ts CHANGED
@@ -1465,6 +1465,13 @@ declare type ClusterBy = {
1465
1465
  expressions: Array<Ordered>;
1466
1466
  };
1467
1467
 
1468
+ /**
1469
+ * BigQuery CLUSTER BY property in CREATE TABLE statements.
1470
+ */
1471
+ declare type ClusterByColumnsProperty = {
1472
+ columns: Array<Identifier>;
1473
+ };
1474
+
1468
1475
  /**
1469
1476
  * ClusteredByProperty
1470
1477
  */
@@ -3141,6 +3148,7 @@ declare const _default: {
3141
3148
  getDialects: typeof getDialects;
3142
3149
  getVersion: typeof getVersion;
3143
3150
  lineage: typeof lineage;
3151
+ lineageWithSchema: typeof lineageWithSchema;
3144
3152
  getSourceTables: typeof getSourceTables;
3145
3153
  diff: typeof diff;
3146
3154
  hasChanges: typeof hasChanges;
@@ -5092,8 +5100,12 @@ declare type Expression = {
5092
5100
  "on_commit_property": OnCommitProperty;
5093
5101
  } | {
5094
5102
  "partitioned_by_property": PartitionedByProperty;
5103
+ } | {
5104
+ "partition_by_property": PartitionByProperty;
5095
5105
  } | {
5096
5106
  "partitioned_by_bucket": PartitionedByBucket;
5107
+ } | {
5108
+ "cluster_by_columns_property": ClusterByColumnsProperty;
5097
5109
  } | {
5098
5110
  "partition_by_truncate": PartitionByTruncate;
5099
5111
  } | {
@@ -5186,6 +5198,8 @@ declare type Expression = {
5186
5198
  "include_property": IncludeProperty;
5187
5199
  } | {
5188
5200
  "properties": Properties;
5201
+ } | {
5202
+ "options_property": OptionsProperty;
5189
5203
  } | {
5190
5204
  "input_output_format": InputOutputFormat;
5191
5205
  } | {
@@ -8597,6 +8611,17 @@ export declare interface LineageResult {
8597
8611
  error?: string;
8598
8612
  }
8599
8613
 
8614
+ /**
8615
+ * Trace the lineage of a column through a SQL query using schema metadata.
8616
+ *
8617
+ * @param column - Column name to trace
8618
+ * @param sql - SQL string to analyze
8619
+ * @param schema - ValidationSchema-compatible schema object
8620
+ * @param dialect - Dialect for parsing/qualification (default: 'generic')
8621
+ * @param trimSelects - Trim SELECT to only target column (default: false)
8622
+ */
8623
+ export declare function lineageWithSchema(column: string, sql: string, schema: Schema, dialect?: string, trimSelects?: boolean): LineageResult;
8624
+
8600
8625
  /**
8601
8626
  * List
8602
8627
  */
@@ -9470,6 +9495,21 @@ declare type Operator = {
9470
9495
  comments?: Array<string>;
9471
9496
  };
9472
9497
 
9498
+ /**
9499
+ * Key/value pair in a BigQuery OPTIONS (...) clause.
9500
+ */
9501
+ declare type OptionEntry = {
9502
+ key: Identifier;
9503
+ value: Expression;
9504
+ };
9505
+
9506
+ /**
9507
+ * Typed BigQuery OPTIONS (...) property for CREATE TABLE and related DDL.
9508
+ */
9509
+ declare type OptionsProperty = {
9510
+ entries: Array<OptionEntry>;
9511
+ };
9512
+
9473
9513
  /** Chain multiple conditions with OR. */
9474
9514
  export declare function or(...conditions: ExprInput[]): Expr;
9475
9515
 
@@ -9793,6 +9833,13 @@ declare type PartitionByListProperty = {
9793
9833
  create_expressions: Expression | null;
9794
9834
  };
9795
9835
 
9836
+ /**
9837
+ * BigQuery PARTITION BY property in CREATE TABLE statements.
9838
+ */
9839
+ declare type PartitionByProperty = {
9840
+ expressions: Array<Expression>;
9841
+ };
9842
+
9796
9843
  /**
9797
9844
  * PartitionByRangeProperty
9798
9845
  */
package/dist/index.js CHANGED
@@ -2221,6 +2221,50 @@ function lineage_sql$1(sql, column, dialect, trim_selects) {
2221
2221
  }
2222
2222
  }
2223
2223
 
2224
+ /**
2225
+ * Trace column lineage through a SQL query using schema metadata.
2226
+ *
2227
+ * # Arguments
2228
+ * * `sql` - SQL string to analyze
2229
+ * * `column` - Column name to trace
2230
+ * * `schema_json` - Schema JSON matching `ValidationSchema`
2231
+ * * `dialect` - Dialect for parsing/qualification
2232
+ * * `trim_selects` - Trim SELECT to only target column
2233
+ *
2234
+ * # Returns
2235
+ * JSON string containing LineageResult
2236
+ * @param {string} sql
2237
+ * @param {string} column
2238
+ * @param {string} schema_json
2239
+ * @param {string} dialect
2240
+ * @param {boolean} trim_selects
2241
+ * @returns {string}
2242
+ */
2243
+ function lineage_sql_with_schema$1(sql, column, schema_json, dialect, trim_selects) {
2244
+ let deferred5_0;
2245
+ let deferred5_1;
2246
+ try {
2247
+ const retptr = wasm$3.__wbindgen_add_to_stack_pointer(-16);
2248
+ const ptr0 = passStringToWasm0(sql, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
2249
+ const len0 = WASM_VECTOR_LEN;
2250
+ const ptr1 = passStringToWasm0(column, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
2251
+ const len1 = WASM_VECTOR_LEN;
2252
+ const ptr2 = passStringToWasm0(schema_json, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
2253
+ const len2 = WASM_VECTOR_LEN;
2254
+ const ptr3 = passStringToWasm0(dialect, wasm$3.__wbindgen_export, wasm$3.__wbindgen_export2);
2255
+ const len3 = WASM_VECTOR_LEN;
2256
+ wasm$3.lineage_sql_with_schema(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, trim_selects);
2257
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2258
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2259
+ deferred5_0 = r0;
2260
+ deferred5_1 = r1;
2261
+ return getStringFromWasm0(r0, r1);
2262
+ } finally {
2263
+ wasm$3.__wbindgen_add_to_stack_pointer(16);
2264
+ wasm$3.__wbindgen_export4(deferred5_0, deferred5_1, 1);
2265
+ }
2266
+ }
2267
+
2224
2268
  /**
2225
2269
  * Parse SQL into an AST (returned as JSON).
2226
2270
  *
@@ -3404,6 +3448,7 @@ const generate_value = __vite__wasmModule.generate_value;
3404
3448
  const get_dialects = __vite__wasmModule.get_dialects;
3405
3449
  const get_dialects_value = __vite__wasmModule.get_dialects_value;
3406
3450
  const lineage_sql = __vite__wasmModule.lineage_sql;
3451
+ const lineage_sql_with_schema = __vite__wasmModule.lineage_sql_with_schema;
3407
3452
  const parse$1 = __vite__wasmModule.parse;
3408
3453
  const parse_value = __vite__wasmModule.parse_value;
3409
3454
  const plan$1 = __vite__wasmModule.plan;
@@ -3590,6 +3635,7 @@ const wasm$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3590
3635
  get_dialects,
3591
3636
  get_dialects_value,
3592
3637
  lineage_sql,
3638
+ lineage_sql_with_schema,
3593
3639
  memory,
3594
3640
  parse: parse$1,
3595
3641
  parse_value,
@@ -3772,6 +3818,7 @@ const wasmModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
3772
3818
  get_dialects: get_dialects$1,
3773
3819
  get_dialects_value: get_dialects_value$1,
3774
3820
  lineage_sql: lineage_sql$1,
3821
+ lineage_sql_with_schema: lineage_sql_with_schema$1,
3775
3822
  parse: parse$2,
3776
3823
  parse_value: parse_value$1,
3777
3824
  plan: plan$2,
@@ -5389,6 +5436,16 @@ function lineage(column, sql, dialect = "generic", trimSelects = false) {
5389
5436
  const resultJson = lineage_sql$1(sql, column, dialect, trimSelects);
5390
5437
  return JSON.parse(resultJson);
5391
5438
  }
5439
+ function lineageWithSchema(column, sql, schema, dialect = "generic", trimSelects = false) {
5440
+ const resultJson = lineage_sql_with_schema$1(
5441
+ sql,
5442
+ column,
5443
+ JSON.stringify(schema),
5444
+ dialect,
5445
+ trimSelects
5446
+ );
5447
+ return JSON.parse(resultJson);
5448
+ }
5392
5449
  function getSourceTables(column, sql, dialect = "generic") {
5393
5450
  const resultJson = source_tables$1(sql, column, dialect);
5394
5451
  return JSON.parse(resultJson);
@@ -5656,6 +5713,7 @@ const index = {
5656
5713
  getDialects,
5657
5714
  getVersion,
5658
5715
  lineage: lineage,
5716
+ lineageWithSchema: lineageWithSchema,
5659
5717
  getSourceTables: getSourceTables,
5660
5718
  diff: diff,
5661
5719
  hasChanges: hasChanges,
@@ -5665,4 +5723,4 @@ const index = {
5665
5723
  Polyglot
5666
5724
  };
5667
5725
 
5668
- export { CaseBuilder, DeleteBuilder, Dialect, Expr, InsertBuilder, MergeBuilder, Polyglot, SelectBuilder, SetOpBuilder, UpdateBuilder, ValidationSeverity, WindowDefBuilder, abs, alias, and, index$1 as ast, avg, boolean, caseOf, caseWhen, cast, ceil, changesOnly, coalesce, col, concatWs, condition, count, countDistinct, currentDate, currentTime, currentTimestamp, index as default, del, deleteFrom, denseRank, diff, except, exp, extract, findAll, floor, format, formatWithOptions, func, generate, getColumns, getDialects, getSourceTables, getVersion, greatest, hasChanges, ifNull, init, initcap, insert, insertInto, intersect, isColumn, isFunction, isInitialized, isLiteral, isSelect, least, length, lineage, lit, ln, lower, ltrim, max, mergeInto, min, not, nullIf, 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 };
5726
+ export { CaseBuilder, DeleteBuilder, Dialect, Expr, InsertBuilder, MergeBuilder, Polyglot, SelectBuilder, SetOpBuilder, UpdateBuilder, ValidationSeverity, WindowDefBuilder, abs, alias, and, index$1 as ast, avg, boolean, caseOf, caseWhen, cast, ceil, changesOnly, coalesce, col, concatWs, condition, count, countDistinct, currentDate, currentTime, currentTimestamp, index as default, del, deleteFrom, denseRank, diff, except, exp, extract, findAll, floor, format, formatWithOptions, func, generate, getColumns, getDialects, 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, 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 };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polyglot-sql/sdk",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "SQL dialect translator powered by WebAssembly",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -14,6 +14,7 @@
14
14
  "import": "./dist/index.d.ts",
15
15
  "require": "./dist/index.d.cts"
16
16
  },
17
+ "browser": "./dist/index.js",
17
18
  "import": "./dist/index.js",
18
19
  "require": "./dist/index.cjs"
19
20
  },