@sqlanvil/cli 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/bundle.js +17 -5
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -38608,7 +38608,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
38608
38608
  .filter(validationQuery => !!validationQuery.query);
38609
38609
  }
38610
38610
 
38611
- const version = "1.1.0";
38611
+ const version = "1.1.2";
38612
38612
  const dataformVersion = "3.0.59";
38613
38613
 
38614
38614
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -38844,6 +38844,17 @@ class CompileChildProcess extends BaseWorker {
38844
38844
  }
38845
38845
  }
38846
38846
 
38847
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
38848
+ var t = {};
38849
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38850
+ t[p] = s[p];
38851
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
38852
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
38853
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
38854
+ t[p[i]] = s[p[i]];
38855
+ }
38856
+ return t;
38857
+ };
38847
38858
  const CREDENTIALS_FILENAME = ".df-credentials.json";
38848
38859
  function read(credentialsPath, warehouse = "bigquery") {
38849
38860
  var _a;
@@ -38857,16 +38868,17 @@ function read(credentialsPath, warehouse = "bigquery") {
38857
38868
  catch (e) {
38858
38869
  throw new Error(`Error reading credentials file: ${e.message}`);
38859
38870
  }
38871
+ const warehouseCredentials = __rest(credentialsAsJson, ["connections"]);
38860
38872
  const isPostgres = warehouse.toLowerCase() === "postgres" || warehouse.toLowerCase() === "supabase";
38861
38873
  if (isPostgres) {
38862
- const credentials = verifyObjectMatchesProto(sqlanvil.PostgresConnection, credentialsAsJson);
38874
+ const credentials = verifyObjectMatchesProto(sqlanvil.PostgresConnection, warehouseCredentials);
38863
38875
  if (!credentials.host) {
38864
38876
  throw new Error(`Error reading credentials file: the host field is required`);
38865
38877
  }
38866
38878
  return credentials;
38867
38879
  }
38868
38880
  else {
38869
- const credentials = verifyObjectMatchesProto(sqlanvil.BigQuery, credentialsAsJson);
38881
+ const credentials = verifyObjectMatchesProto(sqlanvil.BigQuery, warehouseCredentials);
38870
38882
  if (!((_a = Object.keys(credentials).find(key => key === "projectId")) === null || _a === void 0 ? void 0 : _a.length)) {
38871
38883
  throw new Error(`Error reading credentials file: the projectId field is required`);
38872
38884
  }
@@ -39082,10 +39094,10 @@ function resolveConnection(projectDir, connectionName) {
39082
39094
  throw new Error(`Missing .df-credentials.json in ${projectDir}.`);
39083
39095
  }
39084
39096
  const allCreds = JSON.parse(fs__namespace.readFileSync(credsPath, "utf8"));
39085
- const credentials = allCreds[connectionName];
39097
+ const credentials = allCreds.connections && allCreds.connections[connectionName];
39086
39098
  if (!credentials) {
39087
39099
  throw new Error(`No credentials for connection "${connectionName}" in .df-credentials.json ` +
39088
- `(expected a top-level "${connectionName}" key).`);
39100
+ `(expected a "connections.${connectionName}" entry).`);
39089
39101
  }
39090
39102
  return { name: connectionName, definition, credentials };
39091
39103
  }
package/package.json CHANGED
@@ -61,7 +61,7 @@
61
61
  "bin": {
62
62
  "sqlanvil": "bundle.js"
63
63
  },
64
- "version": "1.1.0",
64
+ "version": "1.1.2",
65
65
  "name": "@sqlanvil/cli",
66
66
  "description": "sqlanvil command line interface.",
67
67
  "main": "bundle.js"