question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cruddl with Typescript project

See original GitHub issue

Having a heckuva time even following your demo/setup code in the Readme due to Typescript errors on cruddl dependencies. Getting errors such as:

node_modules/graphql-yoga/dist/types.d.ts:8:29 - error TS2307: Cannot find module 'apollo-server-core'.
8 import { LogFunction } from 'apollo-server-core';

I’ve tried mucking with my tsconfig.json and importing several different @types/ to my package.json to no avail. What am I missing?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Yogucommented, Aug 30, 2019

I think we can just switch to ApolloServer. graphql-yoga has caused quite a few headaches by just trying to update it a few times…

1reaction
itsezccommented, Aug 29, 2019

I did that anyway, and got another error:

node_modules/graphql-yoga/dist/types.d.ts:8:10 - error TS2305: Module '"../../../../../../../Code/learning/graphql/cruddl/node_modules/apollo-server-core/dist"' has no exported member 'LogFunction'.

8 import { LogFunction } from 'apollo-server-core';

Yup, as expected it was the apollo-server-core package not being installed, your best bet is using the code I provided above, and here’s the rest to generate the schema:

import { ArangoDBAdapter, Project as ProjectConfiguration } from 'cruddl'
import DataModel from './schema.graphql'

const Database = new ArangoDBAdapter({
	databaseName: '',
	url: '',
	user: '',
	password: ''
})

const Project = new ProjectConfiguration({
	sources: [
		{
			name: 'schema.graphql',
			body: DataModel
		},
		{
			name: 'permission-profiles.json',
			body: JSON.stringify({
				permissionProfiles: {
					default: {
						permissions: [
							{
								roles: ['admin'],
								access: 'readWrite'
							},
							{
								roles: ['user*'],
								access: 'read'
							}
						]

					}
				}
			})
		}
	],
	getExecutionOptions: ({ context }) => ({ authRoles: ['users'] })
})

const schema = Project.createSchema(Database)
Database.updateSchema(Project.getModel())
Read more comments on GitHub >

github_iconTop Results From Across the Web

AEB-labs/cruddl: Create a GraphQL API for your ... - GitHub
This TypeScript library creates an executable GraphQL schema from a model definition and provides queries and mutations to access a database. Currently, it ......
Read more >
Cruddl - Reviews, Pros & Cons - StackShare
It is a library that creates an executable GraphQL schema from a model definition and provides queries and mutations to access a database....
Read more >
TypeScript with Apollo Client - Apollo GraphQL Docs
Below, we'll guide you through installing and configuring GraphQL Code Generator to generate types for your hooks and components. Setting up your project....
Read more >
Graphql Language Service Utils Examples - StackBlitz
Browse StackBlitz projects using graphql-language-service-utils, crack open the code and ... React + TypeScript starter project ... Playground for cruddl.
Read more >
Typescript GraphQL CRUD Tutorial - YouTube
Learn how to build a GraphQL server with Typescript in this CRUD example. We will use Apollo, TypeORM, and Type-GraphQLCode: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found