fix(#354): use Handlebars instead of deprecated Mustache

This commit is contained in:
Jonathan Gruber 2023-10-06 23:23:57 +02:00
parent 3c0770b792
commit d2b35beb6f

View File

@ -1,16 +1,12 @@
const Mustache = require('mustache');
const Handlebars = require('handlebars');
const { getIntrospectionQuery } = require('graphql');
const { get } = require('lodash');
// override the default escape function to prevent escaping
Mustache.escape = function (value) {
return value;
};
const prepareGqlIntrospectionRequest = (endpoint, envVars, request) => {
if (endpoint && endpoint.length) {
endpoint = Mustache.render(endpoint, envVars);
endpoint = Handlebars.compile(endpoint, { noEscape: true })(envVars);
}
const introspectionQuery = getIntrospectionQuery();
const queryParams = {
query: introspectionQuery