GithubHelp home page GithubHelp logo

open-source-labs / obsidian Goto Github PK

View Code? Open in Web Editor NEW
750.0 750.0 111.0 4.22 MB

GraphQL, built for Deno - a native GraphQL caching client and server module

License: MIT License

JavaScript 12.80% TypeScript 87.17% Dockerfile 0.03%
deno graphql javascript typescript

obsidian's People

Contributors

aswilson87 avatar caliskanburak avatar christygomez avatar cjamesb avatar davidmnorman avatar djdalfaro avatar dsymiller avatar esmashr avatar exlxxn avatar gealarcon avatar guananthony avatar johnwongfc avatar joshreed104 avatar kevin-06-huang avatar kyunglee1 avatar laj52 avatar lourentflores avatar lzhao15 avatar meekle avatar mikechin37 avatar mmeigs avatar nhantly avatar okunod avatar olivia-code avatar pjmsullivan avatar sarkamedo avatar tonstock avatar travismfrank avatar yogipaturu avatar yuriishchyrba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obsidian's Issues

Error while running demo code. InvalidData: data did not match any variant of untagged enum ArgsEnum

─ deno run --allow-env --allow-read server.ts                                                                                                                        ─╯ 
error: Uncaught (in promise) InvalidData: data did not match any variant of untagged enum ArgsEnum
    throw new ErrorClass(res.err.message);
          ^
    at processResponse (deno:core/core.js:213:11)
    at Object.jsonOpAsync (deno:core/core.js:231:12)
    at async Object.connect (deno:runtime/js/30_net.js:199:13)
    at async RedisConnection.connectThunkified (https://raw.githubusercontent.com/keroxp/deno-redis/master/connection.ts:74:11)
    at async RedisConnection.connect (https://raw.githubusercontent.com/keroxp/deno-redis/master/connection.ts:123:5)
    at async connect (https://raw.githubusercontent.com/keroxp/deno-redis/master/redis.ts:2240:3)    at async https://deno.land/x/[email protected]/src/CacheClassServer.js:10:11

Delete stale branches. Delete normalize and DS_Fix from open-source-labs/obsidian

If these branches do not have an active purpose, let's delete them
Delete normalize and DS_Fix.
https://github.com/open-source-labs/obsidian/tree/normalize
https://github.com/open-source-labs/obsidian/tree/DS_Fix
@TravisFrankMTG Are these still in use for release processes?

[expected]
only keep active branches for development

[actual]
normalize
Updated 14 months ago by TravisFrankMTG
DS_Fix
Updated 14 months ago by TravisFrankMTG

Error: Cannot read properties of undefined (reading 'indexOf')

I have a simple app setup as follows:

import { importQL } from 'https://deno.land/x/importql/mod.ts';
import { Application } from 'https://deno.land/x/[email protected]/mod.ts';
import { Router } from 'https://deno.land/x/[email protected]/mod.ts';
import { ObsidianRouter } from 'https://deno.land/x/obsidian/mod.ts';
import { resolvers } from './resolvers.ts';
const types = importQL('schema.graphql');

const PORT = 1111;
const app = new Application();
const router = new Router();

interface ObsRouter extends Router {
  obsidianSchema?: any;
}

const GraphQLRouter = await ObsidianRouter<ObsRouter>({
  Router,
  typeDefs: types,
  resolvers: resolvers,
  useCache: true,
  usePlayground: true,
  context: (request) => {
    return {
      ...request,
      secret: request?.request?.headers?.get('apiKey'),
      ip: request?.request?.headers?.get('x-forwarded-for') || request?.request?.ip,
      referer: request?.request?.headers?.get('referer'),
    };
  },
});

app.use(router.routes(), router.allowedMethods());
app.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());

await app.listen({
  port: PORT,
});

When I run a simple query in my graphql playground such as

query getBook {
  book(id:"1") {
    id
  }
}

I get an error Cannot read properties of undefined (reading 'indexOf'). If I set useCache: false then this error does not occur. Redis is running on the default port. Is there something wrong with my setup or is this a bug?

Integration with Pothos

Hey!

I am the author of Pothos (https://pothos-graphql.dev/) and was just working on updating some outdated docs on building graphql APIs in deno. I was wondering if it would make sense to support obsidian as well, and describe how to get that set up in the pothos/deno docs.

It looks like currently it might be a little tricky because Obsidian only accepts typedefs/resolvers and builds an executable schema. Pothos generates a schema directly with resolvers already added to the GraphQL types. Would be great if we could just pass in a schema directly!

TypeError: Error parsing args: data did not match any variant of untagged enum ArgsEnum on import

$ deno repl --eval 'import { gql } from "https://deno.land/x/[email protected]/mod.ts"'
error in --eval flag. Uncaught TypeError: Error parsing args: data did not match any variant of untagged enum ArgsEnum
    at deno:core/01_core.js:101:46
    at unwrapOpResult (deno:core/01_core.js:121:13)
    at Object.opAsync (deno:core/01_core.js:130:28)
    at opConnect (deno:ext/net/01_net.js:42:17)
    at Object.connect (deno:ext/net/01_net.js:219:19)
    at RedisConnection.connectThunkified (https://deno.land/x/[email protected]/connection.ts:74:22)
    at RedisConnection.connect (https://deno.land/x/[email protected]/connection.ts:123:16)
    at connect (https://deno.land/x/[email protected]/redis.ts:2275:20)
    at https://deno.land/x/[email protected]/src/quickCache.js:12:17
Deno 1.14.3
exit using ctrl+d or close()
>

Client Usage Without React?

Is there a way to use the obsidian client without needing react? I'm wanting to use it for an API client in a server-side application.

Error when trying to run the 'Getting Started' code

Hi everyone, thanks for the hard work! I'm having some trouble trying to run a simple API with the code provided on the Getting Started section, I'll leave the details and my findings and please tell me if there's something I'm doing wrong.
First some specs:

OS: W10 with Ubuntu 20.04 (WSL)
Deno: v1.9.0
Obsidian: v3.0.0
Redis-server: v5.0.7

This is the code I have from the docs:

// server.tsx
import { Application, Router } from 'https://deno.land/x/[email protected]/mod.ts';
import { ObsidianRouter, gql } from 'https://deno.land/x/obsidian/mod.ts';

const PORT = 8000;

const app = new Application();

const types = (gql as any)`
  type Movie {
    id: ID
    title: String
    releaseYear: Int
  }

  type Query {
    getMovie: Movie
  }
`;

const resolvers = {
  Query: {
    getMovie: () => {
      return {
        id: "1",
        title: "Up",
        releaseYear: 2009
      };
    },
  },
};

interface ObsRouter extends Router {
  obsidianSchema?: any;
}

const GraphQLRouter = await ObsidianRouter<ObsRouter>({
  Router,
  typeDefs: types,
  resolvers: resolvers,
  useCache: false,
});

app.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());

app.addEventListener('listen', () => {
  console.log(`Listening at http://localhost:${PORT}`);
});

await app.listen({ port: PORT });

And when I try to run with the flags that the CLI needed deno run --allow-net --allow-read --allow-env --unstable server.tsx and also creating a .env file with REDIS_HOST=6379 I'm getting this error:

error: Uncaught (in promise) TypeError: Invalid argument (os error 22)
        : await Deno.connect(dialOpts);
          ^
    at unwrapOpResult (deno:core/core.js:100:13)
    at async Object.connect (deno:runtime/js/30_net.js:199:13)
    at async RedisConnection.connectThunkified (https://deno.land/x/[email protected]/connection.ts:74:11)
    at async RedisConnection.connect (https://deno.land/x/[email protected]/connection.ts:123:5)
    at async connect (https://deno.land/x/[email protected]/redis.ts:2265:3)
    at async https://deno.land/x/[email protected]/src/CacheClassServer.js:10:11

Doing some research seems like the os error 22 has something to do with sockets? And also I found that that line (: await Deno.connect(dialOpts) is here on the redis repo https://deno.land/x/[email protected]/connection.ts#L74 and I don't know why it could be failing since I've tried to run this simple file to check if the redis server connection is alive and I'm seeing PONG as a response:

import { connect } from "https://deno.land/x/redis/mod.ts";
const redis = await connect({
  hostname: "127.0.0.1",
  port: 6379
});
console.log(await redis.ping())

I guess I'm missing something since I don't know much about redis, hope someone can point me in the right direction

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.