@ssb-graphql/profile

    5.3.0 • Public • Published

    @ssb-graphql/profile

    GraphQL types and resolvers for Secure Scuttlebutt profile plugin (ssb-profile)

    Usage

    Install ssb-graphql's main and profile packages:

    npm i -S @ssb-graphql/main @ssb-graphql/profile

    Example Usage

    const { ApolloServer } = require('apollo-server-express')
    const { buildFederatedSchema } = require('@apollo/federation');
    
    const ssbProfileGraphql = require('ssb-profile-graphql')
    const Server = require('ssb-server')
    const Config = require('ssb-config/inject')
    
    const config = Config({})
    
    const sbot = Server
      .use(require('backlinks'))
      .use(require('ssb-profile'))
      .call(null, config)
    
    const main = require('@ssb-graphql/main')(sbot)
    const profile = require('@ssb-graphql/profile')(sbot)
    
    main.loadContext((err, context) => {
      const server = new ApolloServer({
        schema: buildFederatedSchema([
          main,
          profile // { typeDefs, resolvers }
                  // ... add more here
        ]),
        context
      })
    
      // ... 
    })

    API

    Things provided by instantiating @ssb-graphql/profile:

    • typeDefs
    • resolvers
    • gettersWithCache: an object with callback-style getters (currently for getProfile

    In general, this module adds functionality:

    • ssb-profile methods
      • create profiles (person, community)
      • read profiles
      • create links: feed-profile, group-profile
      • find profiles by a name
    • resolve further profile details on the whoami query (@ssb-graphql/main)
    • get all tribes (community) profiles
    • get all peers you're within range of (profiles grouped by type)
    • get all peers you're currented connected to (profiles grouped by type)

    See /src/typeDefs.js for the most up to date definition of what's offered here.

    Requirements

    An ssb-server with the following plugins :

    • ssb-backlinks
    • ssb-profile
    • ssb-query

    Note if running @ssb-graphql/main, that also has requirements

    TODO

    run npm test to run tests

    Install

    npm i @ssb-graphql/profile

    DownloadsWeekly Downloads

    22

    Version

    5.3.0

    License

    AGPL-3.0

    Unpacked Size

    67.4 kB

    Total Files

    33

    Last publish

    Collaborators

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