git ssb

7+

dinoworm ๐Ÿ› / patchcore



Tree: e88968184cc1392c4b3b1ebb85d0a3b0e0523b13

Files: e88968184cc1392c4b3b1ebb85d0a3b0e0523b13 / feed / pull / channel.js

738 bytesRaw
1const nest = require('depnest')
2const extend = require('xtend')
3
4exports.gives = nest('feed.pull.channel')
5exports.needs = nest({
6 'sbot.pull.query': 'first'
7})
8
9exports.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 = {value: {content: { channel }}}
15 var query = {query: [
16 {$filter: filter}
17 ]}
18
19 // HACK: handle lt
20 if (opts.lt != null) {
21 filter.timestamp = {$lt: opts.lt, $gte: 0, $le: 'hack around dominictarr/map-filter-reduce#1'}
22 delete opts.lt
23 }
24
25 return api.sbot.pull.query(extend(opts, query))
26 }
27 })
28}
29

Built with git-ssb-web