index.js 987 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.stripSensitiveLiterals = void 0;
  4. const graphql_1 = require("graphql");
  5. function stripSensitiveLiterals(ast, options = {
  6. hideListAndObjectLiterals: false,
  7. }) {
  8. const listAndObjectVisitorIfEnabled = options.hideListAndObjectLiterals
  9. ? {
  10. ListValue(node) {
  11. return { ...node, values: [] };
  12. },
  13. ObjectValue(node) {
  14. return { ...node, fields: [] };
  15. },
  16. }
  17. : {};
  18. return (0, graphql_1.visit)(ast, {
  19. IntValue(node) {
  20. return { ...node, value: "0" };
  21. },
  22. FloatValue(node) {
  23. return { ...node, value: "0" };
  24. },
  25. StringValue(node) {
  26. return { ...node, value: "", block: false };
  27. },
  28. ...listAndObjectVisitorIfEnabled,
  29. });
  30. }
  31. exports.stripSensitiveLiterals = stripSensitiveLiterals;
  32. //# sourceMappingURL=index.js.map