This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 8 files changed +102
-2
lines changed
8 files changed +102
-2
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,9 @@ const ipfs = IpfsApi({
277
277
278
278
- [ name] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md )
279
279
- [ ` ipfs.name.publish(addr, [options], [callback]) ` ] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md#namepublish )
280
+ - [ ` ipfs.name.pubsub.cancel(arg, [callback]) ` ] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md#namepubsubcancel )
281
+ - [ ` ipfs.name.pubsub.state([callback]) ` ] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md#namepubsubstate )
282
+ - [ ` ipfs.name.pubsub.subs([callback]) ` ] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md#namepubsubsubs )
280
283
- [ ` ipfs.name.resolve(addr, [options], [callback]) ` ] ( https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/NAME.md#nameresolve )
281
284
282
285
#### Node Management
Original file line number Diff line number Diff line change 82
82
"eslint-plugin-react" : " ^7.10.0" ,
83
83
"go-ipfs-dep" : " ~0.4.17" ,
84
84
"gulp" : " ^3.9.1" ,
85
- "interface-ipfs-core" : " ~0.78 .0" ,
85
+ "interface-ipfs-core" : " ~0.80 .0" ,
86
86
"ipfsd-ctl" : " ~0.39.0" ,
87
87
"pull-stream" : " ^3.6.8" ,
88
88
"socket.io" : " ^2.1.1" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module.exports = (arg) => {
7
7
8
8
return {
9
9
publish : require ( './publish' ) ( send ) ,
10
- resolve : require ( './resolve' ) ( send )
10
+ resolve : require ( './resolve' ) ( send ) ,
11
+ pubsub : require ( './pubsub' ) ( send )
11
12
}
12
13
}
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const promisify = require ( 'promisify-es6' )
4
+
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ canceled : res . Canceled === undefined || res . Canceled === true
8
+ } )
9
+ }
10
+
11
+ module . exports = ( send ) => {
12
+ return promisify ( ( args , opts , callback ) => {
13
+ if ( typeof ( opts ) === 'function' ) {
14
+ callback = opts
15
+ opts = { }
16
+ }
17
+
18
+ send . andTransform ( {
19
+ path : 'name/pubsub/cancel' ,
20
+ args : args ,
21
+ qs : opts
22
+ } , transform , callback )
23
+ } )
24
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ module . exports = ( send ) => ( {
4
+ cancel : require ( './cancel' ) ( send ) ,
5
+ state : require ( './state' ) ( send ) ,
6
+ subs : require ( './subs' ) ( send )
7
+ } )
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const promisify = require ( 'promisify-es6' )
4
+
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ enabled : res . Enabled
8
+ } )
9
+ }
10
+
11
+ module . exports = ( send ) => {
12
+ return promisify ( ( opts , callback ) => {
13
+ if ( typeof ( opts ) === 'function' ) {
14
+ callback = opts
15
+ opts = { }
16
+ }
17
+
18
+ send . andTransform ( {
19
+ path : 'name/pubsub/state' ,
20
+ qs : opts
21
+ } , transform , callback )
22
+ } )
23
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const promisify = require ( 'promisify-es6' )
4
+
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , res . Strings || [ ] )
7
+ }
8
+
9
+ module . exports = ( send ) => {
10
+ return promisify ( ( opts , callback ) => {
11
+ if ( typeof ( opts ) === 'function' ) {
12
+ callback = opts
13
+ opts = { }
14
+ }
15
+
16
+ send . andTransform ( {
17
+ path : 'name/pubsub/subs' ,
18
+ qs : opts
19
+ } , transform , callback )
20
+ } )
21
+ }
Original file line number Diff line number Diff line change @@ -183,6 +183,27 @@ describe('interface-ipfs-core tests', () => {
183
183
]
184
184
} )
185
185
186
+ // TODO: uncomment after https://github.com/ipfs/interface-ipfs-core/pull/361 being merged and a new release
187
+ tests . namePubsub ( CommonFactory . create ( {
188
+ spawnOptions : {
189
+ args : [ '--enable-namesys-pubsub' ] ,
190
+ initOptions : { bits : 1024 }
191
+ }
192
+ } ) , {
193
+ skip : [
194
+ // name.pubsub.cancel
195
+ {
196
+ name : 'should cancel a subscription correctly returning true' ,
197
+ reason : 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
198
+ } ,
199
+ // name.pubsub.subs
200
+ {
201
+ name : 'should get the list of subscriptions updated after a resolve' ,
202
+ reason : 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
203
+ }
204
+ ]
205
+ } )
206
+
186
207
tests . object ( defaultCommonFactory )
187
208
188
209
tests . pin ( defaultCommonFactory )
You can’t perform that action at this time.
0 commit comments