diff --git a/dist/lib.cli.js b/dist/lib.cli.js index 11b2c72..f873c81 100644 --- a/dist/lib.cli.js +++ b/dist/lib.cli.js @@ -25,6 +25,9 @@ const mainMenu = [ function validateCLIParams() { return __awaiter(this, void 0, void 0, function* () { let credentials = new types_1.Credentials(); + credentials.logger = logger; + if (logger.level.toString() == "TRACE") + credentials.trace = true; credentials.host = process.env.DS_BR_HOST; if ((0, lib_misc_1.isNotAnAcceptableValue)(process.env.DS_BR_HOST)) { logger.info("Env var DS_BR_HOST not set or is invalid."); @@ -43,6 +46,7 @@ function validateCLIParams() { global.host = credentials.host || ""; (0, lib_misc_1.printInfo)(`Host : ${credentials.host}`); (0, lib_misc_1.printInfo)(`Username : ${credentials.username}`); + logger.trace(`Credentials : ${JSON.stringify(credentials)}`); return credentials; }); } diff --git a/dist/manager.api.js b/dist/manager.api.js index 93b4ad9..2994e36 100644 --- a/dist/manager.api.js +++ b/dist/manager.api.js @@ -15,12 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.del = exports.put = exports.post = exports.get = exports.getApps = exports.login = void 0; const got_1 = __importDefault(require("got")); const ds_sdk_1 = require("@appveen/ds-sdk"); +const types_1 = require("@appveen/ds-sdk/dist/types"); const lib_misc_1 = require("./lib.misc"); var logger = global.logger; var dataStack; function login(config) { return __awaiter(this, void 0, void 0, function* () { - logger.trace(config); + logger.trace(JSON.stringify(config)); try { dataStack = yield (0, ds_sdk_1.authenticateByCredentials)(config); (0, lib_misc_1.printInfo)("Logged into data.stack."); @@ -29,6 +30,7 @@ function login(config) { catch (e) { (0, lib_misc_1.printError)("Unable to login to data.stack server"); logger.error(e); + logger.trace(e); (0, lib_misc_1.killThySelf)(400); } }); @@ -36,7 +38,9 @@ function login(config) { exports.login = login; function getApps() { return __awaiter(this, void 0, void 0, function* () { - let apps = yield dataStack.ListApps(); + let listOptions = new types_1.ListOptions(); + listOptions.count = -1; + let apps = yield dataStack.ListApps(listOptions); return apps.map(a => a.app._id).sort(); }); } diff --git a/package.json b/package.json index 908e4d6..f750038 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "bin": "dist/app.js", "homepage": "https://github.com/appveen/datastack-backup-restore#readme", "dependencies": { - "@appveen/ds-sdk": "^2.3.0", + "@appveen/ds-sdk": "^2.3.2", "commander": "^9.3.0", "got": "^11.8.3", "inquirer": "^8.2.1", diff --git a/src/lib.cli.ts b/src/lib.cli.ts index 759064b..62f9c6e 100644 --- a/src/lib.cli.ts +++ b/src/lib.cli.ts @@ -15,6 +15,8 @@ const mainMenu = [ export async function validateCLIParams(): Promise { let credentials = new Credentials(); + credentials.logger = logger; + if (logger.level.toString() == "TRACE") credentials.trace = true; credentials.host = process.env.DS_BR_HOST; if (isNotAnAcceptableValue(process.env.DS_BR_HOST)) { logger.info("Env var DS_BR_HOST not set or is invalid."); @@ -37,6 +39,8 @@ export async function validateCLIParams(): Promise { printInfo(`Host : ${credentials.host}`); printInfo(`Username : ${credentials.username}`); + logger.trace(`Credentials : ${JSON.stringify(credentials)}`); + return credentials; } diff --git a/src/manager.api.ts b/src/manager.api.ts index a12f86d..32501e1 100644 --- a/src/manager.api.ts +++ b/src/manager.api.ts @@ -1,6 +1,6 @@ import got, { HTTPError } from "got"; import { authenticateByCredentials, DataStack } from "@appveen/ds-sdk"; -import { Credentials } from "@appveen/ds-sdk/dist/types"; +import { Credentials, ListOptions } from "@appveen/ds-sdk/dist/types"; import { killThySelf, printError, printInfo } from "./lib.misc"; var logger = global.logger; @@ -8,7 +8,7 @@ var dataStack: DataStack; export async function login(config: Credentials) { - logger.trace(config); + logger.trace(JSON.stringify(config)); try { dataStack = await authenticateByCredentials(config); printInfo("Logged into data.stack."); @@ -16,12 +16,15 @@ export async function login(config: Credentials) { } catch (e) { printError("Unable to login to data.stack server"); logger.error(e); + logger.trace(e); killThySelf(400); } } export async function getApps() { - let apps = await dataStack.ListApps(); + let listOptions = new ListOptions(); + listOptions.count = -1; + let apps = await dataStack.ListApps(listOptions); return apps.map(a => a.app._id).sort(); }