git ssb

0+

Josiah / patchbay-tags



Tree: 653e7d95783fcb22649a1ce70a47fc0deb571e3f

Files: 653e7d95783fcb22649a1ce70a47fc0deb571e3f / bookmark / obs / bookmark.js

816 bytesRaw
1const nest = require('depnest')
2const pull = require('pull-stream')
3const ref = require('ssb-ref')
4const { computed } = require('mutant')
5
6exports.needs = nest({
7 'about.obs.latestValue': 'first',
8 'about.obs.valueFrom': 'first',
9 'about.obs.groupedValues': 'first',
10 'bookmark.obs.struct': 'first'
11})
12
13exports.gives = nest('bookmark.obs.bookmark')
14
15exports.create = function(api) {
16 return nest('bookmark.obs.bookmark', function(messageId, id) {
17 if (!ref.isLink(messageId)) throw new Error('an id must be specified')
18
19 const { latestValue, valueFrom, groupedValues } = api.about.obs
20
21 const bookmark = api.bookmark.obs.struct({
22 notes: latestValue(messageId, 'notes'),
23 tags: valueFrom(messageId, 'tags', id),
24 recps: latestValue(messageId, 'recps')
25 })
26
27 return bookmark
28 })
29}
30

Built with git-ssb-web