3.0.0 • Published 1 year ago

@apollo/utils.operationregistrysignature v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

operationRegistrySignature

The operation registry signature function consists of removing extra whitespace, sorting the AST in a deterministic manner, potentially hiding string and numeric literals, and removing unused definitions. This is a less aggressive transform than its usage reporting signature counterpart. This is used to generate a signature used by Apollo's operation registry to identify operations.

Usage

import { operationRegistrySignature } from "@apollo/utils.operationregistrysignature";

const signature = operationRegistrySignature(
  parse(`#graphql
    query Foo {
      bar
    }
  `),
  "Foo",
  { preserveStringAndNumericLiterals: true },
);