@graphql-mesh/transport-common
Version: 
16 lines (15 loc) • 478 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjMapScalar = void 0;
const graphql_1 = require("graphql");
exports.ObjMapScalar = new graphql_1.GraphQLScalarType({
    name: 'ObjMap',
    serialize: value => JSON.stringify(value),
    parseValue: value => JSON.parse(value.toString()),
    parseLiteral: ast => {
        if (ast.kind === 'StringValue') {
            return JSON.parse(ast.value);
        }
        return null;
    },
});