From b5f7a3763bdad0c1cd41679213e1ae710c9a634f Mon Sep 17 00:00:00 2001 From: fauna-chase Date: Mon, 9 Oct 2023 20:19:05 -0500 Subject: [PATCH] fix Connected to undefined message ENG-5604 --- src/commands/shell.js | 6 ++---- src/lib/fauna-command.js | 5 +---- src/lib/misc.js | 12 ------------ 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/commands/shell.js b/src/commands/shell.js index 42fa4b40..0d4aca53 100644 --- a/src/commands/shell.js +++ b/src/commands/shell.js @@ -1,5 +1,5 @@ const FaunaCommand = require("../lib/fauna-command.js").default; -const { runQueries, stringifyEndpoint } = require("../lib/misc.js"); +const { runQueries } = require("../lib/misc.js"); const faunadb = require("faunadb"); const { Flags, Args } = require("@oclif/core"); const q = faunadb.query; @@ -41,9 +41,7 @@ class ShellCommand extends EvalCommand { this.log(`Starting shell for database ${db_path}`); } - this.log( - `Connected to ${stringifyEndpoint(this.connection.connectionOptions)}` - ); + this.log(`Connected to ${this.connection.connectionOptions.url}`); this.log("Type Ctrl+D or .exit to exit the shell"); this.repl = repl.start({ diff --git a/src/lib/fauna-command.js b/src/lib/fauna-command.js index 456e6413..e4a2f27d 100644 --- a/src/lib/fauna-command.js +++ b/src/lib/fauna-command.js @@ -1,6 +1,5 @@ import { Command, Flags } from "@oclif/core"; import { ShellConfig } from "./config"; -import { stringifyEndpoint } from "./misc"; import { query as q, errors, Client } from "faunadb"; import { green } from "chalk"; import FaunaClient from "./fauna-client"; @@ -85,9 +84,7 @@ class FaunaCommand extends Command { mapConnectionError({ err, connectionOptions }) { if (err instanceof errors.Unauthorized) { return this.error( - `Could not Connect to ${stringifyEndpoint( - connectionOptions - )} Unauthorized Secret` + `Could not Connect to ${connectionOptions.url} Unauthorized Secret` ); } return this.error(err); diff --git a/src/lib/misc.js b/src/lib/misc.js index c1a4750a..e1c3210a 100644 --- a/src/lib/misc.js +++ b/src/lib/misc.js @@ -382,15 +382,3 @@ export function runQueries(expressions, client) { return promiseSerial(wrapQueries(expressions, client)); } } - -export function stringifyEndpoint(endpoint) { - var res = ""; - if (endpoint.scheme) { - res += endpoint.scheme + "://"; - } - res += endpoint.domain; - if (endpoint.port) { - res += ":" + endpoint.port; - } - return res; -}