git ssb

0+

Piet / ssb-loomio



Commit a36bb14c1220b36accf4f8fa76de5117992a3ff7

Get pull streams working with inject

Piet Geursen committed on 6/6/2018, 10:45:35 PM
Parent: ca77c54d481c41a3dbb9f2c43454de9dd9dde4c1

Files changed

lib/inject.jschanged
package-lock.jsonchanged
package.jsonchanged
lib/inject.jsView
@@ -1,7 +1,8 @@
11 const { each, map } = require('libnested')
22 const { onceTrue, watch, Value } = require('mutant')
33 const assert = require('assert')
4 +const Defer = require('pull-defer').source
45 // const Struct = require('../struct')
56
67 // auto-inject the ssb-server to all methods to reduce repitition
78 module.exports = function inject (server, methods, pluginDeps = []) {
@@ -33,8 +34,22 @@
3334 )
3435 }
3536 }
3637
38 + if (path.includes('pull')) {
39 + return function () {
40 + const source = Defer()
41 + onceTrue(
42 + server,
43 + server => {
44 + var _source = fn(server).apply(null, arguments)
45 + source.resolve(_source)
46 + }
47 + )
48 + return source
49 + }
50 + }
51 +
3752 // NOTE - both `obs` and `sync` methods will return observeables
3853 return function () {
3954 var result = Value({})
4055 // var result = Struct({}) // WARNING - this shouldn't be copied for other apps, only works with obs.get method here. Probably breaks sync.isBlog
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 194817 bytes
New file size: 196200 bytes
package.jsonView
@@ -28,8 +28,9 @@
2828 "libnested": "^1.2.1",
2929 "lodash.clonedeep": "^4.5.0",
3030 "mutant": "^3.22.1",
3131 "pull-async": "^1.0.0",
32 + "pull-next-query": "^1.0.0",
3233 "pull-stream": "^3.6.2",
3334 "ssb-msg-content": "^1.0.1",
3435 "ssb-msg-schemas": "^6.3.0",
3536 "ssb-poll-schema": "^1.6.1",

Built with git-ssb-web