sikanhe / reason-graphql

GraphQL server in pure Reason (Bucklescript)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Can't find GraphqlJsPromise module

danilobjr opened this issue · comments

Hello,

I'm trying to follow the example of reason-graphql-bs-express but I couldn't open GraphqlJsPromise module.

Also, a similar issue happens if I try to follow this another example. Compiler points an error on this line on node_modules related to the same GraphqlJsPromise module.

Where can I locate this module? Am I missing a dependency?

Thanks in advance!

This is my package.json file:

{
  "name": "hello-reason-gql",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "bsb -make-world",
    "dev:re": "bsb -make-world -w",
    "dev:js": "nodemon src/server.bs.js",
    "clean": "bsb -clean-world"
  },
  "devDependencies": {
    "bs-platform": "8.2.0",
    "nodemon": "2.0.4"
  },
  "dependencies": {
    "bs-express": "1.0.2",
    "reason-dataloader": "0.1.1",
    "reason-future": "2.6.0",
    "reason-graphql": "0.7.0-beta.1",
    "reason-graphql-bs-express": "0.6.0"
  }
}

My bsconfig.json file:

{
  "name": "hello-reason-gql",
  "version": "0.1.0",
  "sources": {
    "dir" : "src",
    "subdirs" : true
  },
  "package-specs": {
    "module": "commonjs",
    "in-source": true
  },
  "suffix": ".bs.js",
  "bs-dependencies": [
    "bs-express",
    "reason-dataloader",
    "reason-future",
    "reason-graphql",
    "reason-graphql-bs-express"
  ],
  "warnings": {
    "number" : "-44-45",
    "error" : "+101"
  },
  "namespace": true,
  "refmt": 3
}

I was able to get this to work with the following:

module Schema = Graphql.Schema.Make({
  type t<'a> = Promise.t<'a>

  let return = Promise.resolve

  let bind = (p, continuation) => {
    Promise.then(p, continuation)
  }

  let map = (p, continuation) => {
    Promise.then(p, v => v ->continuation->Js.Promise.resolve)
  }
})
...

Schema.field(...)

(Using https://github.com/ryyppy/rescript-promise)

@jaredramirez Thanks for the answer. I'll close this issue. It's not relevant anymore.