Use the first Auth0 connection instead of prompt
Oh right, we have another prompt we need to not prompt for, lol :p Here, I just assume that there's one database connection on the Auth0 account. If that's not true, the script will error—not because this is a fundamentally unresolvable problem, but because I don't want to write code for configuring a situation that doesn't exist yet :p
This commit is contained in:
parent
357061221f
commit
eb2eb241ba
1 changed files with 8 additions and 9 deletions
|
@ -19,7 +19,6 @@
|
||||||
// as a opt-in flag for now, in case I'm forgetting something 😅
|
// as a opt-in flag for now, in case I'm forgetting something 😅
|
||||||
const { argv } = require("yargs");
|
const { argv } = require("yargs");
|
||||||
const { ManagementClient } = require("auth0");
|
const { ManagementClient } = require("auth0");
|
||||||
const inquirer = require("inquirer");
|
|
||||||
const PromisePool = require("es6-promise-pool");
|
const PromisePool = require("es6-promise-pool");
|
||||||
|
|
||||||
const connectToDb = require("../src/server/db");
|
const connectToDb = require("../src/server/db");
|
||||||
|
@ -41,14 +40,14 @@ async function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
const connections = await connectionsPromise;
|
const connections = await connectionsPromise;
|
||||||
const { connectionId } = await inquirer.prompt([
|
if (connections.length === 0) {
|
||||||
{
|
throw new Error(`no connections found on the Auth0 account`);
|
||||||
name: "connectionId",
|
} else if (connections.length > 1) {
|
||||||
type: "list",
|
throw new Error(
|
||||||
message: "Which Auth0 connection should we import to?",
|
`Not yet implemented: when there is more than one Auth0 connection, specify which one to use.`
|
||||||
choices: connections.map((c) => ({ name: c.name, value: c.id })),
|
);
|
||||||
},
|
}
|
||||||
]);
|
const connectionId = connections[0].id;
|
||||||
|
|
||||||
let conditionSQL = "1";
|
let conditionSQL = "1";
|
||||||
let conditionValues = [];
|
let conditionValues = [];
|
||||||
|
|
Loading…
Reference in a new issue