@polyglot-sql/sdk 0.5.1 → 0.5.2

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
@@ -5509,6 +5509,15 @@ function queryAnalysisFailure(context, error) {
5509
5509
  error: `WASM ${context} failed: ${errorMessage(error)}`
5510
5510
  };
5511
5511
  }
5512
+ function normalizeAnalyzeQueryOptions(optionsOrDialect = {}) {
5513
+ if (typeof optionsOrDialect === "string") {
5514
+ return { dialect: optionsOrDialect };
5515
+ }
5516
+ return {
5517
+ dialect: "generic",
5518
+ ...optionsOrDialect
5519
+ };
5520
+ }
5512
5521
  async function init() {
5513
5522
  await __polyglot_init_wasm();
5514
5523
  }
@@ -5654,12 +5663,9 @@ function getDialects() {
5654
5663
  function getVersion() {
5655
5664
  return wasm.version();
5656
5665
  }
5657
- function analyzeQuery(sql, options = {}) {
5666
+ function analyzeQuery(sql, optionsOrDialect = {}) {
5658
5667
  try {
5659
- const normalized = {
5660
- dialect: "generic",
5661
- ...options
5662
- };
5668
+ const normalized = normalizeAnalyzeQueryOptions(optionsOrDialect);
5663
5669
  if (typeof wasm.analyze_query_value === "function") {
5664
5670
  return decodeWasmPayload(
5665
5671
  wasm.analyze_query_value(sql, normalized)
@@ -5787,11 +5793,8 @@ class Polyglot {
5787
5793
  annotateTypes(sql, dialect = "generic", schema) {
5788
5794
  return annotateTypes(sql, dialect, schema);
5789
5795
  }
5790
- /**
5791
- * Return compact query analysis facts for a SELECT or set operation.
5792
- */
5793
- analyzeQuery(sql, options = {}) {
5794
- return analyzeQuery(sql, options);
5796
+ analyzeQuery(sql, optionsOrDialect = {}) {
5797
+ return analyzeQuery(sql, normalizeAnalyzeQueryOptions(optionsOrDialect));
5795
5798
  }
5796
5799
  }
5797
5800
  const index = {
package/dist/index.d.cts CHANGED
@@ -596,6 +596,8 @@ declare type AnalyzeListChainedRows = {
596
596
  /**
597
597
  * Return compact query analysis facts for a SELECT or set operation.
598
598
  */
599
+ export declare function analyzeQuery(sql: string, dialect: Dialect | string): QueryAnalysisResult;
600
+
599
601
  export declare function analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
600
602
 
601
603
  export declare interface AnalyzeQueryOptions {
@@ -10725,6 +10727,7 @@ export declare class Polyglot {
10725
10727
  /**
10726
10728
  * Return compact query analysis facts for a SELECT or set operation.
10727
10729
  */
10730
+ analyzeQuery(sql: string, dialect: Dialect | string): QueryAnalysisResult;
10728
10731
  analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
10729
10732
  }
10730
10733
 
@@ -11005,6 +11008,7 @@ export declare interface QueryAnalysis {
11005
11008
  ctes: string[];
11006
11009
  projections: ProjectionFact[];
11007
11010
  relations: RelationFact[];
11011
+ baseTables: RelationFact[];
11008
11012
  setOperations: SetOperationFact[];
11009
11013
  }
11010
11014
 
package/dist/index.d.ts CHANGED
@@ -596,6 +596,8 @@ declare type AnalyzeListChainedRows = {
596
596
  /**
597
597
  * Return compact query analysis facts for a SELECT or set operation.
598
598
  */
599
+ export declare function analyzeQuery(sql: string, dialect: Dialect | string): QueryAnalysisResult;
600
+
599
601
  export declare function analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
600
602
 
601
603
  export declare interface AnalyzeQueryOptions {
@@ -10725,6 +10727,7 @@ export declare class Polyglot {
10725
10727
  /**
10726
10728
  * Return compact query analysis facts for a SELECT or set operation.
10727
10729
  */
10730
+ analyzeQuery(sql: string, dialect: Dialect | string): QueryAnalysisResult;
10728
10731
  analyzeQuery(sql: string, options?: AnalyzeQueryOptions): QueryAnalysisResult;
10729
10732
  }
10730
10733
 
@@ -11005,6 +11008,7 @@ export declare interface QueryAnalysis {
11005
11008
  ctes: string[];
11006
11009
  projections: ProjectionFact[];
11007
11010
  relations: RelationFact[];
11011
+ baseTables: RelationFact[];
11008
11012
  setOperations: SetOperationFact[];
11009
11013
  }
11010
11014
 
package/dist/index.js CHANGED
@@ -6037,6 +6037,15 @@ function queryAnalysisFailure(context, error) {
6037
6037
  error: `WASM ${context} failed: ${errorMessage(error)}`
6038
6038
  };
6039
6039
  }
6040
+ function normalizeAnalyzeQueryOptions(optionsOrDialect = {}) {
6041
+ if (typeof optionsOrDialect === "string") {
6042
+ return { dialect: optionsOrDialect };
6043
+ }
6044
+ return {
6045
+ dialect: "generic" /* Generic */,
6046
+ ...optionsOrDialect
6047
+ };
6048
+ }
6040
6049
  async function init() {
6041
6050
  return Promise.resolve();
6042
6051
  }
@@ -6182,12 +6191,9 @@ function getDialects() {
6182
6191
  function getVersion() {
6183
6192
  return wasm.version();
6184
6193
  }
6185
- function analyzeQuery(sql, options = {}) {
6194
+ function analyzeQuery(sql, optionsOrDialect = {}) {
6186
6195
  try {
6187
- const normalized = {
6188
- dialect: "generic" /* Generic */,
6189
- ...options
6190
- };
6196
+ const normalized = normalizeAnalyzeQueryOptions(optionsOrDialect);
6191
6197
  if (typeof wasm.analyze_query_value === "function") {
6192
6198
  return decodeWasmPayload(
6193
6199
  wasm.analyze_query_value(sql, normalized)
@@ -6315,11 +6321,8 @@ class Polyglot {
6315
6321
  annotateTypes(sql, dialect = "generic" /* Generic */, schema) {
6316
6322
  return annotateTypes(sql, dialect, schema);
6317
6323
  }
6318
- /**
6319
- * Return compact query analysis facts for a SELECT or set operation.
6320
- */
6321
- analyzeQuery(sql, options = {}) {
6322
- return analyzeQuery(sql, options);
6324
+ analyzeQuery(sql, optionsOrDialect = {}) {
6325
+ return analyzeQuery(sql, normalizeAnalyzeQueryOptions(optionsOrDialect));
6323
6326
  }
6324
6327
  }
6325
6328
  const index = {
@@ -5330,6 +5330,15 @@ function queryAnalysisFailure(context, error) {
5330
5330
  error: `WASM ${context} failed: ${errorMessage(error)}`
5331
5331
  };
5332
5332
  }
5333
+ function normalizeAnalyzeQueryOptions(optionsOrDialect = {}) {
5334
+ if (typeof optionsOrDialect === "string") {
5335
+ return { dialect: optionsOrDialect };
5336
+ }
5337
+ return {
5338
+ dialect: "generic",
5339
+ ...optionsOrDialect
5340
+ };
5341
+ }
5333
5342
  async function init() {
5334
5343
  return Promise.resolve();
5335
5344
  }
@@ -5475,12 +5484,9 @@ function getDialects() {
5475
5484
  function getVersion() {
5476
5485
  return wasm.version();
5477
5486
  }
5478
- function analyzeQuery(sql, options = {}) {
5487
+ function analyzeQuery(sql, optionsOrDialect = {}) {
5479
5488
  try {
5480
- const normalized = {
5481
- dialect: "generic",
5482
- ...options
5483
- };
5489
+ const normalized = normalizeAnalyzeQueryOptions(optionsOrDialect);
5484
5490
  if (typeof wasm.analyze_query_value === "function") {
5485
5491
  return decodeWasmPayload(
5486
5492
  wasm.analyze_query_value(sql, normalized)
@@ -5608,11 +5614,8 @@ class Polyglot {
5608
5614
  annotateTypes(sql, dialect = "generic", schema) {
5609
5615
  return annotateTypes(sql, dialect, schema);
5610
5616
  }
5611
- /**
5612
- * Return compact query analysis facts for a SELECT or set operation.
5613
- */
5614
- analyzeQuery(sql, options = {}) {
5615
- return analyzeQuery(sql, options);
5617
+ analyzeQuery(sql, optionsOrDialect = {}) {
5618
+ return analyzeQuery(sql, normalizeAnalyzeQueryOptions(optionsOrDialect));
5616
5619
  }
5617
5620
  }
5618
5621
  const index = {
package/dist/manual.js CHANGED
@@ -5656,6 +5656,15 @@ function queryAnalysisFailure(context, error) {
5656
5656
  error: `WASM ${context} failed: ${errorMessage(error)}`
5657
5657
  };
5658
5658
  }
5659
+ function normalizeAnalyzeQueryOptions(optionsOrDialect = {}) {
5660
+ if (typeof optionsOrDialect === "string") {
5661
+ return { dialect: optionsOrDialect };
5662
+ }
5663
+ return {
5664
+ dialect: "generic" /* Generic */,
5665
+ ...optionsOrDialect
5666
+ };
5667
+ }
5659
5668
  async function init$1() {
5660
5669
  return Promise.resolve();
5661
5670
  }
@@ -5801,12 +5810,9 @@ function getDialects() {
5801
5810
  function getVersion() {
5802
5811
  return wasm.version();
5803
5812
  }
5804
- function analyzeQuery(sql, options = {}) {
5813
+ function analyzeQuery(sql, optionsOrDialect = {}) {
5805
5814
  try {
5806
- const normalized = {
5807
- dialect: "generic" /* Generic */,
5808
- ...options
5809
- };
5815
+ const normalized = normalizeAnalyzeQueryOptions(optionsOrDialect);
5810
5816
  if (typeof wasm.analyze_query_value === "function") {
5811
5817
  return decodeWasmPayload(
5812
5818
  wasm.analyze_query_value(sql, normalized)
@@ -5934,11 +5940,8 @@ class Polyglot {
5934
5940
  annotateTypes(sql, dialect = "generic" /* Generic */, schema) {
5935
5941
  return annotateTypes(sql, dialect, schema);
5936
5942
  }
5937
- /**
5938
- * Return compact query analysis facts for a SELECT or set operation.
5939
- */
5940
- analyzeQuery(sql, options = {}) {
5941
- return analyzeQuery(sql, options);
5943
+ analyzeQuery(sql, optionsOrDialect = {}) {
5944
+ return analyzeQuery(sql, normalizeAnalyzeQueryOptions(optionsOrDialect));
5942
5945
  }
5943
5946
  }
5944
5947
  const autoDefault = {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polyglot-sql/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "SQL dialect translator powered by WebAssembly",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",