Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return cb(null, resolveItem(null, item.object, item, options.offset, options.length))
}
const cid = new CID(item.multihash)
dag.get(cid, (err, node) => {
if (err) {
return cb(err)
}
// const name = item.fromPathRest ? item.name : item.path
cb(null, resolveItem(cid, node.value, item, options.offset, options.length))
})
}),
pull.flatten(),
pull.filter(Boolean),
pull.filter((node) => node.depth <= options.maxDepth)
)
function resolveItem (cid, node, item, offset, length) {
return resolve(cid, node, item.name, item.path, item.pathRest, item.size, dag, item.parent || parent, item.depth, offset, length)
}
function resolve (cid, node, name, path, pathRest, size, dag, parentNode, depth, offset, length) {
let type
try {
type = typeOf(node)
} catch (error) {
return pull.error(error)
}
const query = [{
$filter: {
value: {
author: server.id,
timestamp: { $gt: 0 }, // needed for how I set up /query page
content: { type: 'dark-crystal/root' }
}
}
}]
const _opts = Object.assign({}, { query }, opts)
// NOTE - this could benefit from a deeper merge?
return pull(
next(server.query.read, _opts),
pull.filter(isRoot)
)
}
}
function unbox () {
return pull(
pull.map(function (msg) {
return msg.value && typeof msg.value.content === 'string'
? message_unbox(msg)
: msg
}),
pull.filter(Boolean)
)
}