@cognigy/rest-api-client
Version:
Cognigy REST-Client
30 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.logFullConfigToDebugMode = void 0;
function logFullConfigToDebugMode(cognigy, config, header) {
var _a;
const { input, api } = cognigy;
// sort the object "config" by keys in alphabetic order
const sortedConfig = Object.keys(config).sort().reduce((acc, key) => {
acc[key] = config[key];
return acc;
}, {});
if (input.endpointType === "adminconsole" || api.getMetadata().isFollowSessionActive) {
let totalSettingsString = "";
Object.keys(sortedConfig).forEach((key) => {
if (typeof config[key] === "object") {
totalSettingsString += `${key}:<br>`;
Object.keys(config[key]).forEach((subkey) => {
totalSettingsString += `- ${subkey}: ${JSON.stringify(config[key][subkey])}<br>`;
});
totalSettingsString += `<br>`;
}
else {
totalSettingsString += `${key}: ${config[key]}<br>`;
}
});
(_a = api === null || api === void 0 ? void 0 : api.logDebugMessage) === null || _a === void 0 ? void 0 : _a.call(api, `${totalSettingsString}`, header);
}
}
exports.logFullConfigToDebugMode = logFullConfigToDebugMode;
//# sourceMappingURL=logFullConfigToDebugMode.js.map