ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
39 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Session = void 0;
var log_1 = require("./log");
var Session = /** @class */ (function () {
function Session() {
}
Session.check = function (domo) {
return new Promise(function (resolve, reject) {
var options = {
url: 'https://' + domo.getInstance() + '/auth/validate',
method: 'GET',
};
domo
.processRequest(options)
.then(function (res) {
try {
if (res.isValid) {
resolve(true);
}
else {
reject(false);
}
}
catch (e) {
// couldn't parse as JSON which means the service doesn't exist yet.
// TODO: remove this once the /domoweb/auth/validate service has shipped to prod
resolve(true);
}
})
.catch(function (err) {
log_1.log.clientRequestFailed(err.statusCode + ' - ' + err.message, err.failureMessage);
});
});
};
return Session;
}());
exports.Session = Session;
//# sourceMappingURL=session.js.map