ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

TypeError: sbot.links is not a function #285

Closed nichoth closed 2 years ago

nichoth commented 2 years ago

This is when using the module ssb-viewer -- https://github.com/planetary-social/planetary-pub/blob/main/index.js#L48

The viewer seems to require sbot.links, but when I add it, it gives an error:

TypeError: ssb._flumeUse is not a function

This is when I'm including the compat module

    .use(require('ssb-db2/compat')) // include all compatibility plugins
arj03 commented 2 years ago

ssb-db2 doesn't use flume. ssb-viewer needs to be fixed to use db2 queries instead.

nichoth commented 2 years ago

Now to figure out what is the equivalent query to sbot.links

staltz commented 2 years ago

How does the sbot.links query look like exactly?

nichoth commented 2 years ago

It looks like it is line 344 here -- https://github.com/ssbc/ssb-viewer/blob/master/index.js#L344

      pull(
        sbot.links({dest: id, values: true, rel: 'root' }),
        pull.unique('key'),
        pull.collect(function (err, links) {
          if (err) return respond(res, 500, err.stack || err)
          if(includeRoot)
            links.unshift(root)
          render(links)
        })
      )
staltz commented 2 years ago

Ah, in that case you could use an approach such as the one I used in ssb-threads (see source code)

nichoth commented 2 years ago

Thanks @staltz ! So it looks like ssb-threads supersedes that call to sbot.links in the old version of ssb, and I should be installing & using ssb-threads instead.

staltz commented 2 years ago

Oh yeah, of course, just using ssb-threads directly is a good alternative, that didn't occur to me.