包详细信息

@apollo/utils.stripsensitiveliterals

apollographql7.8mMIT3.0.0

Remove literals from an AST which might contain PII (strings and numbers, and optionally lists and objects)

apollo, graphql, typescript, node

自述文件

stripSensitiveLiterals

The stripSensitiveLiterals function is used to remove string and numeric literals from a graphql DocumentNode which could be sensitive. Consider using variables instead!

Usage

import { stripSensitiveLiterals } from "@apollo/utils.stripsensitiveliterals";

stripSensitiveLiterals(
  parse(`#graphql
  query User {
    user(name: "Ada Lovelace", age: 31, ids: ["1", "2", "3"]) 
  }
`),
);
/**
  query User {
    user(name: "", age: 0, ids: ["", "", ""]) 
  }
*/