"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeHelper = void 0;
const handlebars_1 = __importDefault(require("handlebars"));
/**
 * Defines and registers custom handlebar helper - code
 */
class CodeHelper {
    constructor() {
        /**
         * Registers code helper
         * - Define request and logger in the scope of the code helper context, allowing user to use request, logger in their mock files
         * - If file path is passed, check if file exists and send the return value to HttpParser to process
         * - Evaluate the response of the function passed in and return the resulting response object to HttpParser
         * @returns {void}
         */
        this.register = () => {
            handlebars_1.default.registerHelper("code", (context) => {
                /* eslint-disable no-unused-vars */
                const request = context.data.root.request;
                const logger = context.data.root.logger;
                /* eslint-disable no-unused-vars */
                const code = eval(context.fn(this));
                code["CamouflageResponseType"] = "code";
                return JSON.stringify(code);
            });
        };
    }
}
exports.CodeHelper = CodeHelper;
//# sourceMappingURL=CodeHelper.js.map