@pm2/js-api
Advanced tools
Comparing version 0.5.48 to 0.5.49
{ | ||
"name": "@pm2/js-api", | ||
"version": "0.5.48", | ||
"version": "0.5.49", | ||
"description": "PM2.io API Client for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -278,2 +278,7 @@ # PM2.io API Client for Javascript | ||
client.data.notifications.retrieve -> GET /api/bucket/:id/data/notifications/:notification | ||
client.bucket.application.list -> GET /api/bucket/:id/applications | ||
client.bucket.application.get -> GET /api/bucket/:id/applications/:application | ||
client.bucket.application.create -> POST /api/bucket/:id/applications | ||
client.bucket.application.update -> PUT /api/bucket/:id/applications/:application | ||
client.bucket.application.delete -> DELETE /api/bucket/:id/applications/:application | ||
``` | ||
@@ -280,0 +285,0 @@ |
@@ -31,2 +31,3 @@ | ||
this._endpoints = new Map() | ||
this._bucketFilters = new Map() | ||
@@ -307,13 +308,16 @@ this.apiDateLag = 0 | ||
const socket = this._websockets.find(socket => socket.bucketPublic === bucketPublicId) | ||
if (!this._bucketFilters.has(bucketPublicId)) this._bucketFilters.set(bucketPublicId, []) | ||
const filters = this._bucketFilters.get(bucketPublicId) | ||
if (!socket) return | ||
if (type === 'push') { | ||
socket.filters.push(filter) | ||
filters.push(filter) | ||
} else { | ||
socket.filters.splice(socket.filters.indexOf(filter), 1) | ||
filters.splice(filters.indexOf(filter), 1) | ||
} | ||
if (!socket) return | ||
socket.send(JSON.stringify({ | ||
action: 'sub', | ||
public_id: bucketPublicId, | ||
filters: Array.from(new Set(socket.filters)) // avoid duplicates | ||
filters: Array.from(new Set(filters)) // avoid duplicates | ||
})) | ||
@@ -347,3 +351,2 @@ } | ||
let socket = new WS(`${endpoint}/primus`, this.tokens.access_token) | ||
socket.filters = [] | ||
socket.bucketPublic = bucket.public_id | ||
@@ -366,3 +369,3 @@ socket.connected = false | ||
public_id: bucket.public_id, | ||
filters: Array.from(new Set(socket.filters)) // avoid duplicates | ||
filters: Array.from(new Set(this._bucketFilters.get(bucket.public_id))) // avoid duplicates | ||
})) | ||
@@ -369,0 +372,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1021085
365
21
11625