15270821319 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ
..
dist 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ
src 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ
LICENSE 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ
README.md 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ
package.json 4e5c5d37f9 初步设计数据库,注册登录 6 mēneši atpakaļ

README.md

dropUnusedDefinitions

Given an operation document and an operation name, this function will return a new document with only the definitions required for the operation name provided.

If the provided operation name doesn't match any operation in the document, dropUnusedDefinitions will return the original document.

Usage

import { dropUnusedDefinitions } from "@apollo/utils.dropunuseddefinitions";

const operation = parse(`#graphql
  query Drop { ...DroppedFragment }
  fragment DroppedFragment on Query { abc }
  query Keep { ...KeptFragment }
  fragment KeptFragment on Query { def }
`);
const keepOperation = dropUnusedDefinitions(operation, "Keep");
/**
query Keep {
  ...KeptFragment
}

fragment KeptFragment on Query {
  def
}
*/