{"size": 1214, "ext": "js", "max_stars_repo_path": "src/interfaces/impl/serviceResolvers/RestServiceResolver.js", "max_stars_repo_name": "Samagra-Development/Hulk", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/interfaces/impl/serviceResolvers/RestServiceResolver.js", "max_issues_repo_name": "Samagra-Development/Hulk", "max_issues_repo_issues_event_min_datetime": "2021-04-09T10:39:12.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-12T02:19:11.000Z", "max_forks_repo_path": "src/interfaces/impl/serviceResolvers/RestServiceResolver.js", "max_forks_repo_name": "Samagra-Development/Hulk", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 36.7878787879, "max_line_length": 130, "alphanum_fraction": 0.5123558484}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const got_1 = require("got");
class RestServiceResolver {
    constructor() {
    }
    resolve(context, cadence) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const { protocol, host, path, method, headers } = context;
            const { retries, timeout, linearBackoff } = cadence;
            const url = `${protocol}://${host}${path}`;
            // console.log(url, method, headers, retries, linearBackoff, timeout);
            try {
                return yield got_1.default(url, {
                    method,
                    headers,
                    retry: {
                        limit: retries,
                        calculateDelay: ({ attemptCount, retryOptions }) => retryOptions.limit >= attemptCount ? linearBackoff : 0
                    },
                    timeout
                }).text();
            }
            catch (error) {
                console.error(error);
                throw new Error("ad");
            }
        });
    }
}
exports.default = RestServiceResolver;
//# sourceMappingURL=RestServiceResolver.js.map