-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
71 lines (61 loc) · 1.74 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module.exports = {
strategy: {
compose: require('./strategy/compose'),
overwrite: require('./strategy/overwrite'),
simpleSet: require('./strategy/simple-set')
},
graphTools: {
dijkstra: require('./graph-tools/dijkstra'),
findTimeTravellers: require('./graph-tools/find-time-travellers'),
getHeads: require('./graph-tools/get-heads'),
reduce: require('./graph-tools/reduce')
}
}
// This is the ssb-tangle@1.0.0
// const pull = require('pull-stream')
// const { isMsg } = require('ssb-ref')
// const { heads } = require('ssb-sort')
// module.exports = {
// name: 'tangle',
// version: require('./package.json').version,
// manifest: {
// branch: 'async'
// },
// init: (server) => {
// checkBacklinks(server)
// return {
// branch: getBranch(server)
// }
// }
// }
// function checkBacklinks (server) {
// setTimeout(() => {
// if (!server.backlinks) throw new Error('ssb-tangle require ssb-backlinks to be installed')
// }, 2e3)
// }
// function getBranch (server) {
// if (arguments.length !== 1 || typeof arguments[0] !== 'object') throw new Error('getBacklinks needs a server as it\'s first argument!')
// return function (rootMsgKey, cb) {
// if (!isMsg(rootMsgKey)) return cb(new Error('getBranch requires a valid message'))
// const query = [{
// $filter: {
// dest: rootMsgKey,
// value: {
// content: {
// root: rootMsgKey
// }
// }
// }
// }]
// pull(
// server.backlinks.read({ query }),
// pull.collect((err, msgs) => {
// if (err) return cb(err)
// cb(null, heads([
// { key: rootMsgKey },
// ...msgs
// ]))
// })
// )
// }
// }