Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mx-puppet-bridge

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mx-puppet-bridge - npm Package Compare versions

Comparing version 0.0.39 to 0.0.40

20

lib/src/botprovisioner.js

@@ -112,4 +112,5 @@ "use strict";

if (!retData.success) {
const print = retData.fn || retData.data ? retData.error : `ERROR: ${retData.error}`;
yield this.sendMessage(roomId, print || "");
if (retData.fn) {
yield this.sendMessage(roomId, `${retData.error}`);
this.fnCollectListeners.set(sender, {

@@ -119,6 +120,6 @@ fn: retData.fn,

});
}
if (!retData.data) {
break;
}
yield this.sendMessage(roomId, `ERROR: ${retData.error}`);
break;
}

@@ -132,5 +133,14 @@ if (!senderInfo.token) {

}
let data;
try {
data = (yield Promise.resolve(retData.data)) || {};
}
catch (err) {
log.warn("Failed to create/update link", err);
yield this.sendMessage(roomId, `ERROR: ${err}`);
break;
}
if (puppetId === -1) {
// we need to create a new link
puppetId = yield this.provisioner.new(sender, retData.data || {}, retData.userId);
puppetId = yield this.provisioner.new(sender, data, retData.userId);
yield this.sendMessage(roomId, `Created new link with ID ${puppetId}`);

@@ -140,3 +150,3 @@ }

// we need to update an existing link
yield this.provisioner.update(sender, puppetId, retData.data || {}, retData.userId);
yield this.provisioner.update(sender, puppetId, data, retData.userId);
yield this.sendMessage(roomId, `Updated link with ID ${puppetId}`);

@@ -143,0 +153,0 @@ }

@@ -89,3 +89,3 @@ /// <reference types="node" />

error?: string;
data?: IPuppetData;
data?: IPuppetData | Promise<IPuppetData>;
userId?: string;

@@ -92,0 +92,0 @@ fn?: RetDataFn;

{
"name": "mx-puppet-bridge",
"version": "0.0.39",
"version": "0.0.40",
"description": "Matrix Puppeting Bridge library",

@@ -5,0 +5,0 @@ "repository": {

@@ -15,3 +15,3 @@ /*

import { PuppetBridge } from "./puppetbridge";
import { RetDataFn, IRetData, IRemoteRoom } from "./interfaces";
import { RetDataFn, IRetData, IRemoteRoom, IPuppetData } from "./interfaces";
import { Provisioner } from "./provisioner";

@@ -130,4 +130,5 @@ import { PuppetType, PUPPET_TYPES } from "./db/puppetstore";

if (!retData.success) {
const print = retData.fn || retData.data ? retData.error : `ERROR: ${retData.error}`;
await this.sendMessage(roomId, print || "");
if (retData.fn) {
await this.sendMessage(roomId, `${retData.error}`);
this.fnCollectListeners.set(sender, {

@@ -137,6 +138,6 @@ fn: retData.fn,

});
}
if (!retData.data) {
break;
}
await this.sendMessage(roomId, `ERROR: ${retData.error}`);
break;
}

@@ -150,9 +151,17 @@ if (!senderInfo.token) {

}
let data: IPuppetData;
try {
data = (await Promise.resolve(retData.data)) || {};
} catch (err) {
log.warn("Failed to create/update link", err);
await this.sendMessage(roomId, `ERROR: ${err}`);
break;
}
if (puppetId === -1) {
// we need to create a new link
puppetId = await this.provisioner.new(sender, retData.data || {}, retData.userId);
puppetId = await this.provisioner.new(sender, data, retData.userId);
await this.sendMessage(roomId, `Created new link with ID ${puppetId}`);
} else {
// we need to update an existing link
await this.provisioner.update(sender, puppetId, retData.data || {}, retData.userId);
await this.provisioner.update(sender, puppetId, data, retData.userId);
await this.sendMessage(roomId, `Updated link with ID ${puppetId}`);

@@ -159,0 +168,0 @@ }

@@ -129,3 +129,3 @@ /*

error?: string;
data?: IPuppetData;
data?: IPuppetData | Promise<IPuppetData>;
userId?: string;

@@ -132,0 +132,0 @@ fn?: RetDataFn;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc