Files: a959612185d373132b8891bcf18328d98c8a6bc0 / feed / pull / channel.js
756 bytesRaw
1 | const nest = require('depnest') |
2 | const extend = require('xtend') |
3 | |
4 | exports.gives = nest('feed.pull.channel') |
5 | exports.needs = nest({ |
6 | 'sbot.pull.backlinks': 'first' |
7 | }) |
8 | |
9 | exports.create = function (api) { |
10 | return nest('feed.pull.channel', function (channel) { |
11 | if (typeof channel !== 'string') throw new Error('a channel name be specified') |
12 | |
13 | return function (opts) { |
14 | var filter = { |
15 | dest: `#${channel}`, |
16 | timestamp: opts.lt |
17 | ? {$lt: opts.lt, $gt: 0} |
18 | : {$gt: 0} |
19 | } |
20 | |
21 | delete opts.lt |
22 | |
23 | return api.sbot.pull.backlinks(extend(opts, { |
24 | index: 'DTS', // HACK: force index since flumeview-query is choosing the wrong one |
25 | query: [ |
26 | {$filter: filter} |
27 | ] |
28 | })) |
29 | } |
30 | }) |
31 | } |
32 |
Built with git-ssb-web