@ssb-graphql/whakapapa

    3.0.0 • Public • Published

    @ssb-graphql/whakapapa

    GraphQL types and resolvers for the ssb-whakapapa plugin.

    Usage

    Install ssb-graphql's main, profile, artefact, story and whakapapa packages:

    npm i -S @ssb-graphql/main @ssb-graphql/profile @ssb-graphql/artefact @ssb-graphql/story @ssb-graphql/whakapapa

    Example Usage

    const { ApolloServer } = require('apollo-server-express')
    const { buildFederatedSchema } = require('@apollo/federation');
    
    const Server = require('ssb-server')
    const Config = require('ssb-config/inject')
    
    const config = Config({})
    
    const sbot = Server
      .use(require('ssb-backlinks'))
      .use(require('ssb-query'))
      .use(require('ssb-profile'))
      .use(require('ssb-artefact'))
      .use(require('ssb-story'))
      .use(require('ssb-whakapapa'))
      .call(null, config)
    
    const main = require('@ssb-graphql/main')(sbot)
    const profile = require('@ssb-graphql/profile')(sbot)
    const artefact = require('@ssb-graphql/artefact')(sbot)
    const story = require('@ssb-graphql/story')(sbot)
    const whakapapa = require('@ssb-graphql/whakapapa')(sbot, { ...profile.gettersWithCache, ...story.gettersWithCache, artefact.gettersWithCache })
    // NOTE we're passing profile getters to whakapapa
    
    profile.Context(sbot, (err, context) => {
      if (err) throw err
      const server = new ApolloServer({
        schema: buildFederatedSchema([
          { typeDefs: main.typeDefs, resolvers: main.resolvers },
          { typeDefs: profile.typeDefs, resolvers: profile.resolvers },
          { typeDefs: artefact.typeDefs, resolvers: artefact.resolvers },
          { typeDefs: story.typeDefs, resolvers: story.resolvers },
          { typeDefs: whakapapa.typeDefs, resolvers: whakapapa.resolvers }
        ]),
        context
      })
    })

    Requirements

    A ssb-server with the following plugins :

    • ssb-backlinks
    • ssb-query // a requirement of ssb-profile
    • ssb-profile
    • ssb-whakapapa

    NOTE - if you have any problems check the requirements of @ssb-graphql/main @ssb-graphql/profile

    TODO

    run npm test to run tests

    Install

    npm i @ssb-graphql/whakapapa

    DownloadsWeekly Downloads

    15

    Version

    3.0.0

    License

    AGPL-3.0

    Unpacked Size

    54.9 kB

    Total Files

    23

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar