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

@pm2/io

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pm2/io - npm Package Compare versions

Comparing version 4.3.5 to 5.0.0

20

build/main/services/transport.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const IPCTransport_1 = require("../transports/IPCTransport");
const WebsocketTransport_1 = require("../transports/WebsocketTransport");
class TransportConfig {

@@ -9,18 +8,7 @@ }

function createTransport(name, config) {
switch (name) {
case 'ipc': {
const transport = new IPCTransport_1.IPCTransport();
transport.init(config);
return transport;
}
case 'websocket': {
const transport = new WebsocketTransport_1.WebsocketTransport();
transport.init(config);
return transport;
}
}
console.error(`Failed to find transport implementation: ${name}`);
return process.exit(1);
const transport = new IPCTransport_1.IPCTransport();
transport.init(config);
return transport;
}
exports.createTransport = createTransport;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NlcnZpY2VzL3RyYW5zcG9ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLDZEQUF5RDtBQUN6RCx5RUFBcUU7QUFHckUsTUFBYSxlQUFlO0NBMEMzQjtBQTFDRCwwQ0EwQ0M7QUFnQ0QsU0FBZ0IsZUFBZSxDQUFFLElBQVksRUFBRSxNQUF1QjtJQUNwRSxRQUFRLElBQUksRUFBRTtRQUNaLEtBQUssS0FBSyxDQUFDLENBQUM7WUFDVixNQUFNLFNBQVMsR0FBRyxJQUFJLDJCQUFZLEVBQUUsQ0FBQTtZQUNwQyxTQUFTLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFBO1lBQ3RCLE9BQU8sU0FBUyxDQUFBO1NBQ2pCO1FBQ0QsS0FBSyxXQUFXLENBQUMsQ0FBQztZQUNoQixNQUFNLFNBQVMsR0FBRyxJQUFJLHVDQUFrQixFQUFFLENBQUE7WUFDMUMsU0FBUyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQTtZQUN0QixPQUFPLFNBQVMsQ0FBQTtTQUNqQjtLQUNGO0lBQ0QsT0FBTyxDQUFDLEtBQUssQ0FBQyw0Q0FBNEMsSUFBSSxFQUFFLENBQUMsQ0FBQTtJQUNqRSxPQUFPLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7QUFDeEIsQ0FBQztBQWZELDBDQWVDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NlcnZpY2VzL3RyYW5zcG9ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLDZEQUF5RDtBQUl6RCxNQUFhLGVBQWU7Q0EwQzNCO0FBMUNELDBDQTBDQztBQWdDRCxTQUFnQixlQUFlLENBQUUsSUFBWSxFQUFFLE1BQXVCO0lBQ3BFLE1BQU0sU0FBUyxHQUFHLElBQUksMkJBQVksRUFBRSxDQUFBO0lBQ3BDLFNBQVMsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUE7SUFDdEIsT0FBTyxTQUFTLENBQUE7QUFlbEIsQ0FBQztBQWxCRCwwQ0FrQkMifQ==

103

build/main/transports/WebsocketTransport.js

@@ -1,102 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = require("debug");
const eventemitter2_1 = require("eventemitter2");
class SerializedAction {
}
class ProcessMetadata {
}
exports.ProcessMetadata = ProcessMetadata;
class WebsocketTransport extends eventemitter2_1.EventEmitter2 {
constructor() {
super(...arguments);
this.initiated = false;
this.logger = debug_1.default('axm:transport:websocket');
}
init(config) {
if (this.initiated === true) {
console.error(`Trying to re-init the transport, please avoid`);
return this;
}
this.initiated = true;
const AgentNode = require('@pm2/agent-node');
this.logger('Init new transport service');
this.config = config;
this.process = {
axm_actions: [],
axm_options: {},
axm_monitor: {}
};
this.agent = new AgentNode(this.config, this.process);
if (this.agent instanceof Error) {
throw this.agent;
}
this.agent.sendLogs = config.sendLogs || false;
this.agent.start();
this.agent.transport.on('**', (data) => {
this.logger(`Received reverse message from websocket transport`);
this.emit('data', data);
});
this.logger('Agent launched');
return this;
}
setMetrics(metrics) {
return this.process.axm_monitor = metrics.reduce((object, metric) => {
if (typeof metric.name !== 'string')
return object;
object[metric.name] = {
historic: metric.historic,
unit: metric.unit,
type: metric.id,
value: metric.value
};
return object;
}, {});
}
addAction(action) {
this.logger(`Add action: ${action.name}:${action.type}`);
const serializedAction = {
action_name: action.name,
action_type: action.type,
arity: action.arity,
opts: action.opts
};
this.process.axm_actions.push(serializedAction);
}
setOptions(options) {
this.logger(`Set options: [${Object.keys(options).join(',')}]`);
return this.process.axm_options = Object.assign(this.process.axm_options, options);
}
getFormattedPayload(channel, payload) {
switch (channel) {
case 'axm:reply':
return { data: payload };
case 'process:exception':
return { data: payload };
case 'human:event': {
const name = payload.__name;
payload.__name = undefined;
return { name, data: payload };
}
}
return payload;
}
send(channel, payload) {
return this.agent.send(channel, this.getFormattedPayload(channel, payload)) ? 0 : -1;
}
destroy() {
this.agent.transport.disconnect();
this.logger('destroy');
}
removeListener() {
return this.agent.transport.removeListener.apply(this, arguments);
}
removeAllListeners() {
return this.agent.transport.removeAllListeners.apply(this, arguments);
}
on() {
return this.agent.transport.on.apply(this, arguments);
}
}
exports.WebsocketTransport = WebsocketTransport;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2Vic29ja2V0VHJhbnNwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RyYW5zcG9ydHM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0FBSyxDQUFDLElBQUksRUFBRSxTQUFTLENBQUMsQ0FBQTtJQUN2RCxDQUFDO0NBQ0Y7QUFyR0QsZ0RBcUdDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2Vic29ja2V0VHJhbnNwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RyYW5zcG9ydHMvV2Vic29ja2V0VHJhbnNwb3J0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
{
"name": "@pm2/io",
"version": "4.3.5",
"version": "5.0.0",
"description": "PM2.io NodeJS APM",

@@ -43,2 +43,3 @@ "main": "build/main/index.js",

"devDependencies": {
"@pm2/node-runtime-stats": "^0.3.2",
"@types/chai": "4.1.4",

@@ -52,5 +53,13 @@ "@types/express": "~4.16.1",

"chai": "4.1.2",
"express": "^4.17.1",
"ioredis": "^4.16.3",
"koa": "^2.11.0",
"mocha": "~7.1.0",
"mongodb-core": "^3.2.7",
"mysql": "~2.18.1",
"mysql2": "~2.1.0",
"nock": "~10.0.6",
"nyc": "~13.1.0",
"pg": "^7.18.2",
"redis": "^3.0.2",
"source-map-support": "~0.5.9",

@@ -61,11 +70,2 @@ "ts-node": "~7.0.1",

"typescript": "~3.2.2",
"@pm2/node-runtime-stats": "^0.3.2",
"express": "^4.17.1",
"ioredis": "^4.16.3",
"koa": "^2.11.0",
"mongodb-core": "^3.2.7",
"mysql": "^2.18.1",
"mysql2": "^2.1.0",
"pg": "^7.18.2",
"redis": "^3.0.2",
"vue": "^2.6.11",

@@ -91,5 +91,4 @@ "vue-server-renderer": "^2.6.11"

"@opencensus/propagation-b3": "0.0.8",
"@pm2/agent-node": "^1.1.10",
"async": "~2.6.1",
"debug": "4.1.1",
"debug": "~4.3.1",
"eventemitter2": "^6.3.1",

@@ -96,0 +95,0 @@ "require-in-the-middle": "^5.0.0",

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