openkbs-pulse 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pulse.js +1 -1
- package/server.js +8 -6
package/package.json
CHANGED
package/pulse.js
CHANGED
package/server.js
CHANGED
|
@@ -44,10 +44,11 @@ const pulse = {
|
|
|
44
44
|
* @param {string} channel - Channel name
|
|
45
45
|
* @param {string} event - Event type
|
|
46
46
|
* @param {object} data - Event data
|
|
47
|
+
* @param {object} options - Optional { kbId, apiKey } overrides
|
|
47
48
|
*/
|
|
48
|
-
async publish(channel, event, data) {
|
|
49
|
-
const kbId = process.env.OPENKBS_KB_ID;
|
|
50
|
-
const apiKey = process.env.OPENKBS_API_KEY;
|
|
49
|
+
async publish(channel, event, data, options = {}) {
|
|
50
|
+
const kbId = options.kbId || process.env.OPENKBS_KB_ID;
|
|
51
|
+
const apiKey = options.apiKey || process.env.OPENKBS_API_KEY;
|
|
51
52
|
|
|
52
53
|
if (!kbId || !apiKey) {
|
|
53
54
|
console.log('[Pulse] Not configured, skipping publish');
|
|
@@ -77,10 +78,11 @@ const pulse = {
|
|
|
77
78
|
/**
|
|
78
79
|
* Get presence info for a channel
|
|
79
80
|
* @param {string} channel - Channel name
|
|
81
|
+
* @param {object} options - Optional { kbId, apiKey } overrides
|
|
80
82
|
*/
|
|
81
|
-
async presence(channel) {
|
|
82
|
-
const kbId = process.env.OPENKBS_KB_ID;
|
|
83
|
-
const apiKey = process.env.OPENKBS_API_KEY;
|
|
83
|
+
async presence(channel, options = {}) {
|
|
84
|
+
const kbId = options.kbId || process.env.OPENKBS_KB_ID;
|
|
85
|
+
const apiKey = options.apiKey || process.env.OPENKBS_API_KEY;
|
|
84
86
|
|
|
85
87
|
if (!kbId || !apiKey) {
|
|
86
88
|
return { count: 0, members: [] };
|