@apollo/client#TypedDocumentNode TypeScript Examples
The following examples show how to use
@apollo/client#TypedDocumentNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: createDeleteMutation.ts From jmix-frontend with Apache License 2.0 | 6 votes |
export function createDeleteMutation(entityName: string): DocumentNode | TypedDocumentNode {
const graphqlSafeEntityName = dollarsToUnderscores(entityName);
const mutationString = `
mutation Delete_${graphqlSafeEntityName}($id: String!) {
delete_${graphqlSafeEntityName}(id: $id)
}
`;
return gql(mutationString);
}
Example #2
Source File: createDeleteMutation.ts From jmix-frontend with Apache License 2.0 | 6 votes |
export function createDeleteMutationForSomeEntities(entityName: string, entityIds: string[]): DocumentNode | TypedDocumentNode {
const graphqlSafeEntityName = dollarsToUnderscores(entityName);
const deleteEntities = entityIds.map((entityId, index)=> `${graphqlSafeEntityName}${index}: delete_${graphqlSafeEntityName}(id: "${entityId}")`).join('\n')
const mutationString = `
mutation Delete_some_${graphqlSafeEntityName} {
${deleteEntities}
}
`;
return gql(mutationString);
}
Example #3
Source File: graphql.ts From jmix-frontend with Apache License 2.0 | 5 votes |
export function editorQueryIncludesRelationOptions(documentNode: DocumentNode | TypedDocumentNode): boolean {
if (!('selectionSet' in documentNode.definitions[0])) {
return false;
}
return documentNode.definitions[0].selectionSet.selections.length > 1;
}