A GraphQL interface over a connected Hyperdrive Daemon Client.
$ npm install hyperdrive-daemon-client-graphql
See schema.graphql for the GraphQL schema you can query.
const { HyperdriveClient } = require('hyperdrive-daemon-client')
const createSchema = require('hyperdrive-daemon-client-graphql')
const { graphql } = require('graphql')
const client = new HyperdriveClient()
const schema = createSchema(client)
client.ready(async () => {
const { drives, stats } = await graphql(schema, `
query {
stats { path metadata { key } content { peers} }
drives { key discoveryKey }
}
`)
})
Input types like DrivesFilterInput
support special suffix values in
keys to support various filters:
<key>
- strictly equal to<key>_ne
- strictly not equal to<key>_gt
- greater than<key>_lt
- less than<key>_gte
- greater than or equal to<key>_lte
- less than or equal to
query {
## query for drives that have at least 1 peer
drives(where: { peers_gte 1 }) {
key discoveryKey
}
}
Creates a GraphQL schema for a given HyperdriveClient
.
const { HyperdriveClient } = require('hyperdrive-daemon-client')
const createSchema = require('hyperdrive-daemon-client-graphql')
const client = new HyperdriveClient()
const schema = createSchema(client)
MIT