@octopusx/ndk
Version:
octopus x sdk to connect to the octopusx grids and services
27 lines (26 loc) • 970 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("lodash");
const OcxExceptions_1 = require("./Exceptions/OcxExceptions");
exports.default = {
/**
* Returns true or false if the credentials exist or not
* @param {object} args
* @returns {Boolean} returns true if all the credentials are in place
*/
checkCredentials(args) {
// @ts-ignore
if (_.isEmpty(args.headers)) {
throw new OcxExceptions_1.OcxExceptions("you did not provide any valid octopusx credentials");
}
// @ts-ignore
if (!args.headers.hasOwnProperty("clientId")) {
throw new OcxExceptions_1.OcxExceptions("you did not provide the client id");
}
// @ts-ignore
if (!args.headers.hasOwnProperty("clientSecret")) {
throw new OcxExceptions_1.OcxExceptions("you did not provide the client secret");
}
return true;
}
};