New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xyo-network/node-network

Package Overview
Dependencies
Maintainers
5
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/node-network - npm Package Compare versions

Comparing version

to
0.18.3

1

dist/index.d.ts
export { IXyoComponentFeatureResponse as IComponentFeatureResponse, IXyoComponentArchivistFeatureDetail, IXyoComponentDivinerFeatureDetail, IXyoComponentFeatureDetail, IXyoNodeNetwork, IXyoComponentFeatureResponse } from './@types';
export { unsubscribeFn } from '@xyo-network/p2p';
export { XyoNodeNetwork } from './xyo-node-network';
//# sourceMappingURL=index.d.ts.map

2

dist/index.js

@@ -8,3 +8,3 @@ "use strict";

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 29th January 2019 11:13:49 am
* @Last modified time: Tuesday, 29th January 2019 1:01:42 pm
* @License: All Rights Reserved

@@ -11,0 +11,0 @@ * @Copyright: Copyright XY | The Findables Company

import { IXyoNodeNetwork, IXyoComponentFeatureResponse } from "./@types";
import { unsubscribeFn, IXyoP2PService } from "@xyo-network/p2p";
export declare class XyoNodeNetwork implements IXyoNodeNetwork {
import { XyoBase } from "@xyo-network/base";
export declare class XyoNodeNetwork extends XyoBase implements IXyoNodeNetwork {
private readonly p2pService;

@@ -5,0 +6,0 @@ private unsubscribeComponentFeature;

@@ -8,3 +8,3 @@ "use strict";

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 29th January 2019 9:57:32 am
* @Last modified time: Tuesday, 29th January 2019 1:13:36 pm
* @License: All Rights Reserved

@@ -14,8 +14,10 @@ * @Copyright: Copyright XY | The Findables Company

Object.defineProperty(exports, "__esModule", { value: true });
class XyoNodeNetwork {
const base_1 = require("@xyo-network/base");
class XyoNodeNetwork extends base_1.XyoBase {
constructor(p2pService) {
super();
this.p2pService = p2pService;
}
setFeatures(features) {
const featureJSON = Buffer.from(JSON.stringify(features));
const featureJSON = Buffer.from(JSON.stringify(features, null, 2));
if (this.unsubscribeComponentFeature) {

@@ -25,2 +27,3 @@ this.unsubscribeComponentFeature();

this.unsubscribeComponentFeature = this.p2pService.subscribe('component-feature:request', (senderPublicKey) => {
this.logInfo(`Received component-feature:request from ${senderPublicKey}`);
this.p2pService.publishMessageToPeer('component-feature:response', featureJSON, senderPublicKey);

@@ -30,5 +33,7 @@ });

requestFeatures(callback) {
this.logInfo(`Requesting features from network`);
this.p2pService.publish('component-feature:request', Buffer.alloc(0));
return this.p2pService.subscribe('component-feature:response', (pk, message) => {
const parseFeatureResponse = message.toString();
const parseFeatureResponse = JSON.parse(message.toString());
this.logInfo(`Received component-feature:response from ${pk} and payload:\n${message.toString()}`);
callback(pk, parseFeatureResponse);

@@ -35,0 +40,0 @@ });

{
"name": "@xyo-network/node-network",
"version": "0.18.0",
"version": "0.18.3",
"description": "High level node network protocol for communication between nodes",

@@ -10,2 +10,3 @@ "main": "dist/index.js",

"dependencies": {
"@xyo-network/base": "^0.18.0",
"@xyo-network/p2p": "^0.18.0"

@@ -22,3 +23,3 @@ },

},
"gitHead": "d6512e001722b5a34c11d1eac4ce22bdc75649b2"
"gitHead": "5ea139daa3ed7081eabb965e7b617522857b7103"
}

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 29th January 2019 11:13:49 am
* @Last modified time: Tuesday, 29th January 2019 1:01:42 pm
* @License: All Rights Reserved

@@ -22,2 +22,3 @@ * @Copyright: Copyright XY | The Findables Company

export { unsubscribeFn } from'@xyo-network/p2p'
export { XyoNodeNetwork } from './xyo-node-network'

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 29th January 2019 9:57:32 am
* @Last modified time: Tuesday, 29th January 2019 1:13:36 pm
* @License: All Rights Reserved

@@ -15,10 +15,13 @@ * @Copyright: Copyright XY | The Findables Company

import { unsubscribeFn, IXyoP2PService } from "@xyo-network/p2p"
import { XyoBase } from "@xyo-network/base"
export class XyoNodeNetwork implements IXyoNodeNetwork {
export class XyoNodeNetwork extends XyoBase implements IXyoNodeNetwork {
private unsubscribeComponentFeature: unsubscribeFn | undefined
constructor (private readonly p2pService: IXyoP2PService) {}
constructor (private readonly p2pService: IXyoP2PService) {
super()
}
public setFeatures(features: IXyoComponentFeatureResponse): void {
const featureJSON = Buffer.from(JSON.stringify(features))
const featureJSON = Buffer.from(JSON.stringify(features, null, 2))

@@ -30,2 +33,3 @@ if (this.unsubscribeComponentFeature) {

this.unsubscribeComponentFeature = this.p2pService.subscribe('component-feature:request', (senderPublicKey) => {
this.logInfo(`Received component-feature:request from ${senderPublicKey}`)
this.p2pService.publishMessageToPeer('component-feature:response',

@@ -40,6 +44,7 @@ featureJSON,

): unsubscribeFn {
this.logInfo(`Requesting features from network`)
this.p2pService.publish('component-feature:request', Buffer.alloc(0))
return this.p2pService.subscribe('component-feature:response', (pk, message) => {
const parseFeatureResponse = message.toString() as IXyoComponentFeatureResponse
const parseFeatureResponse = JSON.parse(message.toString()) as IXyoComponentFeatureResponse
this.logInfo(`Received component-feature:response from ${pk} and payload:\n${message.toString()}`)
callback(pk, parseFeatureResponse)

@@ -46,0 +51,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet