Tag: typescript
-
Validation Error: Using global entity manager instance methods for context specific actions is disallowed
20 Using MikroORM and getting this error: ValidationError: Using global EntityManager instance methods for context specific actions is disallowed. If you need to work with the global instance’s identity map, use `allowGlobalContext` configuration option or `fork()` instead The code that it corresponds to is below: import { MikroORM } from "@mikro-orm/core"; import { __prod__ }…
-
How to update apollo cache
0 I am wondering why it’s very hard to update a data inside of apollo client cache, comparing to similar libraries like react-query it’s too complicated For example, When I have a query with pagination (offset and limit) and get an array of items, When I perform a mutation on one item , and from…
-
Why does @graphql-codegen/typescript declare the resolver parent type to be an output type?
0 I am using @graphql-codegen/typescript to generate types for this graphql schema: type Book { title: String author: String comment: String } type Query { books: [Book] } Excerpt from the generated code: export type Book = { __typename?: ‘Book’; author?: Maybe<Scalars[‘String’][‘output’]>; comment?: Maybe<Scalars[‘String’][‘output’]>; title?: Maybe<Scalars[‘String’][‘output’]>; }; The TS type "Book" is the type used…
-
How to dynamically define GraphQL query string, given typescript types based on GraphQL schema?
0 I have a Node application where I have generated typescript types from GraphQL schema. My service is going to receive GraphQL Object and attributes details in an API request. The service has to form a GraphQL query string and return in the response. For example, If the request is ‘Object.attribute = value’, then the…
-
Prisma query returns null, when data exists
2 I’ve built a Nestjs app with Prisma and GQL. I just changed computer (from a Mac to PC) and all of a sudden my login mutation seems to have stopped working, literally the only one… Here is some code: auth.resolver.ts: @Mutation((returns) => AuthenticatedUser) async login( @Context() { res }: Auth.GqlContext, @Args(‘payload’, { type: ()…
-
Graphql codegen configuration does not load documents with Glob Expression
0 My API is written with TypeScript/Apollo and I am able to run queries/mutations on https://localhost:4000/graphql. My front-end is with Next.js and Apollo client. I use GraphQL Codegenerator to generate the client-side code I need. I am using: "@graphql-codegen/cli": "1.20.1", "@graphql-codegen/typescript": "1.20.2", "@graphql-codegen/typescript-operations": "1.17.14", "@graphql-codegen/typescript-react-apollo": "2.2.1", and my codegen.yml file is overwrite: true schema: "https://localhost:4000/graphql"…
-
How to use graphql with remix.run
0 I have an endpoint https://localhost:1337/graphql where i query a lot of things from strapi but i am trying to use remix.run (tsx) as. my framework, there are no latest tutorials as to how to integrate the graphql endpoint to the remix loaders so that i can query directly from the graphql endpoint. export async…
-
Correctly cast “unknown” into type in Typescript
0 I am using the graphql-request library to fetch data froma GraphQL endpoint. The endpoint returns some information about a user, based on a certain token associated to that user. Here is the type I’ve defined: export type PlayerInfo = { country: string, name: string|undefined, email: string, id: string, } Here are the two approaches…
-
Correctly coerce “unknown” GraphQL response into type
0 I am using the graphql-request library to fetch data froma GraphQL endpoint. The endpoint returns some information about a user, based on a certain token associated to that user. Here is the type I’ve defined: export type PlayerInfo = { country: string, name: string|undefined, email: string, id: string, } Here are the two approaches…
-
Astro dynamic routing (SSR mode) and 404 page
0 I am using Astro and Apollo client to fetch data using GraphQL. In Astro I am using SSR only. I have set up the following Astro dynamic routing (SSR mode): // […slug].astro — import Page from ‘../components/page/Page.astro’; import Layout from ‘../layouts/Layout.astro’; — <Layout title="Test"> <Page /> </Layout> And Page.astro: // Page.astro — import PageOne…