Comparing version 4.3.5 to 5.0.0
"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== |
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2Vic29ja2V0VHJhbnNwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RyYW5zcG9ydHMvV2Vic29ja2V0VHJhbnNwb3J0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsaUNBQXlCO0FBR3pCLGlEQUE2QztBQUU3QyxNQUFNLGdCQUFnQjtDQUtyQjtBQUVELE1BQWEsZUFBZTtDQU8zQjtBQVBELDBDQU9DO0FBRUQsTUFBYSxrQkFBbUIsU0FBUSw2QkFBYTtJQUFyRDs7UUFLVSxjQUFTLEdBQVksS0FBSyxDQUFBO1FBQzFCLFdBQU0sR0FBYSxlQUFLLENBQUMseUJBQXlCLENBQUMsQ0FBQTtJQStGN0QsQ0FBQztJQTdGQyxJQUFJLENBQUUsTUFBdUI7UUFDM0IsSUFBSSxJQUFJLENBQUMsU0FBUyxLQUFLLElBQUksRUFBRTtZQUMzQixPQUFPLENBQUMsS0FBSyxDQUFDLCtDQUErQyxDQUFDLENBQUE7WUFDOUQsT0FBTyxJQUFJLENBQUE7U0FDWjtRQUNELElBQUksQ0FBQyxTQUFTLEdBQUcsSUFBSSxDQUFBO1FBQ3JCLE1BQU0sU0FBUyxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxDQUFBO1FBQzVDLElBQUksQ0FBQyxNQUFNLENBQUMsNEJBQTRCLENBQUMsQ0FBQTtRQUN6QyxJQUFJLENBQUMsTUFBTSxHQUFHLE1BQU0sQ0FBQTtRQUNwQixJQUFJLENBQUMsT0FBTyxHQUFHO1lBQ2IsV0FBVyxFQUFFLEVBQUU7WUFDZixXQUFXLEVBQUUsRUFBRTtZQUNm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SUFFRCxrQkFBa0I7UUFDaEIsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxrQkFBa0IsQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLFNBQVMsQ0FBQyxDQUFBO0lBQ3ZFLENBQUM7SUFFRCxFQUFFO1FBQ0EsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxTQUFTLENBQUMsQ0FBQTtJQUN2RCxDQUFDO0NBQ0Y7QUFyR0QsZ0RBcUdDIn0= | ||
//# 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
559662
6696
+ Addeddebug@4.3.7(transitive)
- Removed@pm2/agent-node@^1.1.10
- Removed@pm2/agent-node@1.1.10(transitive)
- Removedagent-base@4.2.14.3.0(transitive)
- Removedast-types@0.16.1(transitive)
- Removedasync-limiter@1.0.1(transitive)
- Removedbytes@3.1.2(transitive)
- Removedco@4.6.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddata-uri-to-buffer@1.2.0(transitive)
- Removeddebug@2.6.93.1.03.2.74.1.1(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddegenerator@1.0.4(transitive)
- Removeddepd@2.0.0(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@3.1.34.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedeventemitter2@5.0.1(transitive)
- Removedextend@3.0.2(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedftp@0.3.10(transitive)
- Removedget-uri@2.0.4(transitive)
- Removedhttp-errors@2.0.0(transitive)
- Removedhttp-proxy-agent@2.1.0(transitive)
- Removedhttps-proxy-agent@3.0.1(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinherits@2.0.4(transitive)
- Removedip@1.1.51.1.9(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedlevn@0.3.0(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedms@2.0.0(transitive)
- Removednetmask@1.0.6(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedpac-proxy-agent@3.0.1(transitive)
- Removedpac-resolver@3.0.0(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedproxy-agent@3.1.1(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedraw-body@2.5.2(transitive)
- Removedreadable-stream@1.1.142.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedsmart-buffer@4.2.0(transitive)
- Removedsocks@2.3.3(transitive)
- Removedsocks-proxy-agent@4.0.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstatuses@2.0.1(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedthunkify@2.1.2(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtslib@2.8.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedws@6.2.3(transitive)
- Removedxregexp@2.0.0(transitive)
- Removedyallist@3.1.1(transitive)
Updateddebug@~4.3.1