
* Add functions to process the saleor webhooks Co-authored-by: Lukasz Ostrowski <lukasz.ostrowski@saleor.io>
7 lines
304 B
TypeScript
7 lines
304 B
TypeScript
import { ASTNode, print } from "graphql";
|
|
|
|
export const gqlAstToString = (ast: ASTNode) =>
|
|
print(ast) // convert AST to string
|
|
.replaceAll(/\n*/g, "") // remove new lines
|
|
.replaceAll(/\s{2,}/g, " ") // remove unnecessary multiple spaces
|
|
.trim(); // remove whitespace from beginning and end
|