backport
Version:
A CLI tool that automates the process of backporting commits
29 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubV4Exception = exports.getGraphQLClient = void 0;
const core_1 = require("@urql/core");
const responseMetaInterceptorExchange_1 = require("./responseMetaInterceptorExchange");
function getGraphQLClient({ githubApiBaseUrlV4 = 'https://api.github.com/graphql', accessToken, }) {
return new core_1.Client({
url: githubApiBaseUrlV4,
exchanges: [responseMetaInterceptorExchange_1.responseMetaInterceptorExchange, core_1.fetchExchange],
fetchOptions: () => {
return {
'Content-Type': 'application/json',
headers: { Authorization: `bearer ${accessToken}` },
};
},
});
}
exports.getGraphQLClient = getGraphQLClient;
class GithubV4Exception extends Error {
constructor(result) {
const message = `${result.error?.message} (Github API v4)`;
super(message);
this.result = result;
Error.captureStackTrace(this, GithubV4Exception);
this.name = 'GithubV4Exception';
}
}
exports.GithubV4Exception = GithubV4Exception;
//# sourceMappingURL=graphqlClient.js.map