Questions tagged [graphql-tag]

GraphQL Tag is a JavaScript template literal tag that parses GraphQL queries.

GraphQL Tag or gql is a open source template literal tag you can use to concisely write a GraphQL query that is parsed into the standard GraphQL AST.

Documentation

71 questions
1
vote
1 answer

How to use custom graphQL types imported from npm package in apollo's graphql-gql

I don't want to write my own custom scalar types, I want to import them from a library. For example, I want UnixTimestamp from this npm package - gnt in my typeDefs.js I try something like this import { gql } from 'apollo-server-express' import {…
Ruslan Zaytsev
  • 424
  • 4
  • 11
1
vote
1 answer

The operation 'FooQuery' wrapping 'Foo' is expecting a variable, but it was not found with react-apollo

I'm having a problem with react-apollo. Even not calling the query in Foo class: The operation 'FooQuery' wrapping 'Foo' is expecting a variable: 'id' but it was not found in the props passed to 'Apollo(Foo)' class Foo extends React.Component { …
Andrey
  • 2,485
  • 3
  • 21
  • 26
0
votes
0 answers

Don't overshadow 'ofuscate' in ng build prod

I'm trying to "obfuscate" my graphql-tag code in my project natively, but I can't Before : enter image description here After: enter image description here How to hide this code after build? Everything else in the project is natively obfuscated by…
0
votes
1 answer

Invariant Violation: fetch is not found globally and no fetcher passed, to fix pass a fetch for your environment

I'm trying to run a NodeJS app with an AWS Lambda handler. My package.json is very simple: ... "dependencies": { "aws-appsync": "^4.1.7", "aws-sdk": "^2.1202.0", "graphql-tag": "^2.12.6" } When I try to run anything I…
JimmyTheCode
  • 3,783
  • 7
  • 29
  • 71
0
votes
1 answer

How to go about using javascript variables inside a graphql-tag mutation

I'm using graphql-tag to setup queries and mutations to an apollo server and haven't been able to use javascript variables inside the tag consistently or successfully. Here's an example: gql` mutation SetDeviceFirebaseToken { …
0
votes
1 answer

Angular 7 ERROR in node_modules/graphql-tag/lib/index.d.ts(2,57): error TS1005: ',' expected

Hi I am facing issue while running ng serve command. My package.json file is { "name": "Myapp", "version": "7.0.0", "scripts": { "ng": "ng", "local-dev": "ng serve --progress --port 4200", "test": "ng test", "lint": "ng lint", …
Dinshaw Raje
  • 933
  • 1
  • 12
  • 33
0
votes
0 answers

react native graphql-tag TypeError: Object is not a function (near '...(0, _graphqlTag.default)...')

this is how am importing gql in my app import gql from "graphql-tag"; but still am getting this error [Sun Jun 06 2021 15:12:57.243] ERROR TypeError: Object is not a function (near '...(0, _graphqlTag.default)...') [Sun Jun 06 2021 15:12:57.243]…
Mshafex
  • 1
  • 3
0
votes
1 answer

Handle progressive disclosure on frontend with Apollo Client

In my project, we plan to implement a progressive disclosure (displaying some part of UI data if the user has permissions). Basically, we are using react + apollo client with hooks + graphqltag. But the problem is no that how to hide some part of UI…
0
votes
0 answers

Nuxt-Apollo-Graphql - Nested mutation with relations

I'm searching for 3 days how to achieve an nested mutation. I'm using Nuxt JS, Strapi with Graphql and graphql-tag module, and MongoDb I have two collections : Heaturls and heatmap, with a relation Heatmap has and belongs to one Heaturl I use store…
FabienC
  • 53
  • 1
  • 7
0
votes
1 answer

How can I combine a GraphQLObjectType with a schema created by graphql-tag with gql-tag?

I use graphql-tag together with apollo-server-express to connect to build a graphQL endpoint for an api. At the moment I create the schema definition like this: properties.js let model = {} const typeDefs = gql` extend type Query { …
anli
  • 515
  • 6
  • 9
0
votes
0 answers

How do I write a graphql-tag when the data is only returning a Boolean?

The server end is using REST to return on a true or a false. How do write a graphql-tag on this? this is what the server returns : { true } I tried: const GET_ACCESS = gql` query getAccess { access @rest(type: "access", method: "GET" path:…
0
votes
1 answer

Typescript GraphQL equivalent to EnumSet

I have a use case to allow only a certain set of enum values into input for a mutation / display. I'm not quite sure how to best handle this. Given the following: import gql from 'graphql-tag'; export default gql` enum DayOfWeek { MONDAY …
Scott
  • 9,458
  • 7
  • 54
  • 81
0
votes
3 answers

How to import GraphQL query as a string instead of an object

I created a .gql file for my query and I'm importing it like this: const query = require("@/hello.gql"); However, if I log the query variable to the console, it shows an object, not a string. What can I do so that my imported query is just a…
Lévi Simeon
  • 13
  • 1
  • 4
0
votes
1 answer

corresponding graphql-tag mutation of nested types in prisma

i wonder how you can apply mutation using graphql-tag in nested types because in prisma i use create to assign fields my datamodel.graphql type Item { id: ID! @id @unique title: String description: String price: Int …
0
votes
0 answers

Cannot query field "me" on type "Query".GraphQL: Validation

Getting this error when trying to use my query. Everything is fine in graphql playground just running into this issue with my app. I;m new to graphql (if it wasnt obvious already) so let me know if there's anything else I need to show. I've tried…
Luke
  • 73
  • 7