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

daf-message-handler

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daf-message-handler - npm Package Compare versions

Comparing version 7.0.0-beta.45 to 7.0.0-beta.46

6

build/message-handler.d.ts

@@ -1,3 +0,1 @@

/// <reference types="node" />
import { EventEmitter } from 'events';
import { IDataStore, IAgentPlugin, IAgentContext, IMessageHandler, IHandleMessageArgs } from 'daf-core';

@@ -14,3 +12,3 @@ import { Message } from './message';

*/
export declare class MessageHandler extends EventEmitter implements IAgentPlugin {
export declare class MessageHandler implements IAgentPlugin {
/**

@@ -65,3 +63,3 @@ * Plugin methods

id: {
type: string;
type: string; /** {@inheritDoc daf-core#IMessageHandler.handleMessage} */
description: string;

@@ -68,0 +66,0 @@ };

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -67,3 +54,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

exports.MessageHandler = exports.EventTypes = void 0;
var events_1 = require("events");
var message_1 = require("./message");

@@ -81,16 +67,14 @@ var IMessageHandler_1 = __importDefault(require("daf-core/build/schemas/IMessageHandler"));

*/
var MessageHandler = /** @class */ (function (_super) {
__extends(MessageHandler, _super);
var MessageHandler = /** @class */ (function () {
function MessageHandler(options) {
var e_1, _a;
var _this = _super.call(this) || this;
_this.schema = IMessageHandler_1.default;
this.schema = IMessageHandler_1.default;
try {
for (var _b = __values(options.messageHandlers), _c = _b.next(); !_c.done; _c = _b.next()) {
var messageHandler = _c.value;
if (!_this.messageHandler) {
_this.messageHandler = messageHandler;
if (!this.messageHandler) {
this.messageHandler = messageHandler;
}
else {
var lastHandler = _this.messageHandler;
var lastHandler = this.messageHandler;
while (lastHandler.nextMessageHandler !== undefined) {

@@ -110,7 +94,6 @@ lastHandler = lastHandler.nextMessageHandler;

}
_this.handleMessage = _this.handleMessage.bind(_this);
_this.methods = {
handleMessage: _this.handleMessage,
this.handleMessage = this.handleMessage.bind(this);
this.methods = {
handleMessage: this.handleMessage,
};
return _this;
}

@@ -137,3 +120,3 @@ /** {@inheritDoc daf-core#IMessageHandler.handleMessage} */

debug('Emitting event', exports.EventTypes.validatedMessage);
this.emit(exports.EventTypes.validatedMessage, message);
context.agent.emit(exports.EventTypes.validatedMessage, message);
}

@@ -146,3 +129,3 @@ debug('Validated message %o', message);

debug('Emitting event', exports.EventTypes.savedMessage);
this.emit(exports.EventTypes.savedMessage, message);
context.agent.emit(exports.EventTypes.savedMessage, message);
_a.label = 4;

@@ -153,3 +136,3 @@ case 4: return [2 /*return*/, message];

debug('Error', error_1);
this.emit(exports.EventTypes.error, error_1);
context.agent.emit(exports.EventTypes.error, error_1);
return [2 /*return*/, Promise.reject(error_1)];

@@ -162,4 +145,4 @@ case 6: return [2 /*return*/];

return MessageHandler;
}(events_1.EventEmitter));
}());
exports.MessageHandler = MessageHandler;
//# sourceMappingURL=message-handler.js.map

@@ -6,2 +6,13 @@ # Change Log

# [7.0.0-beta.46](https://github.com/uport-project/daf/compare/v7.0.0-beta.45...v7.0.0-beta.46) (2020-11-19)
### Features
* Add event system to agent ([#262](https://github.com/uport-project/daf/issues/262)) ([9a6747e](https://github.com/uport-project/daf/commit/9a6747e84037613d396e14a6f68cb2de8275ddca))
# [7.0.0-beta.45](https://github.com/uport-project/daf/compare/v7.0.0-beta.44...v7.0.0-beta.45) (2020-10-22)

@@ -8,0 +19,0 @@

{
"name": "daf-message-handler",
"description": "DAF Message Handler",
"version": "7.0.0-beta.45",
"version": "7.0.0-beta.46",
"main": "build/index.js",

@@ -12,3 +12,3 @@ "types": "build/index.d.ts",

"dependencies": {
"daf-core": "^7.0.0-beta.45"
"daf-core": "^7.0.0-beta.46"
},

@@ -28,3 +28,3 @@ "devDependencies": {

"keywords": [],
"gitHead": "a50275b95d273399882aad4eba702b6169aea61d"
"gitHead": "b97ff3b0a7c34d49215173e4ec76b2d093892c36"
}

@@ -19,3 +19,3 @@ import { EventEmitter } from 'events'

*/
export class MessageHandler extends EventEmitter implements IAgentPlugin {
export class MessageHandler implements IAgentPlugin {
/**

@@ -30,4 +30,2 @@ * Plugin methods

constructor(options: { messageHandlers: AbstractMessageHandler[] }) {
super()
for (const messageHandler of options.messageHandlers) {

@@ -63,3 +61,3 @@ if (!this.messageHandler) {

debug('Emitting event', EventTypes.validatedMessage)
this.emit(EventTypes.validatedMessage, message)
context.agent.emit(EventTypes.validatedMessage, message)
}

@@ -71,3 +69,3 @@

debug('Emitting event', EventTypes.savedMessage)
this.emit(EventTypes.savedMessage, message)
context.agent.emit(EventTypes.savedMessage, message)
}

@@ -77,3 +75,3 @@ return message

debug('Error', error)
this.emit(EventTypes.error, error)
context.agent.emit(EventTypes.error, error)
return Promise.reject(error)

@@ -80,0 +78,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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