roboto-js 1.6.14 → 1.6.16
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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/rbt_metrics_api.cjs +38 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/rbt_metrics_api.js +16 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/rbt_metrics_api.js +17 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
70
70
|
* sendEvent({ event: 'foo', ... });
|
|
71
71
|
*
|
|
72
72
|
roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
|
|
73
|
-
|
|
73
|
+
This will POST a payload like:
|
|
74
74
|
{
|
|
75
75
|
"event": "UIMain.userAction.login",
|
|
76
76
|
"category": "UIMain",
|
|
@@ -146,6 +146,43 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
146
146
|
return _sendEvent.apply(this, arguments);
|
|
147
147
|
}
|
|
148
148
|
return sendEvent;
|
|
149
|
+
}()
|
|
150
|
+
/**
|
|
151
|
+
* Count-based metric event (requires `count` param).
|
|
152
|
+
* Example:
|
|
153
|
+
* roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
154
|
+
*
|
|
155
|
+
* is equivalent to:
|
|
156
|
+
* roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
157
|
+
*/
|
|
158
|
+
)
|
|
159
|
+
}, {
|
|
160
|
+
key: "countEvents",
|
|
161
|
+
value: (function () {
|
|
162
|
+
var _countEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventOrObj) {
|
|
163
|
+
var paramsObj,
|
|
164
|
+
_args2 = arguments;
|
|
165
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
166
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
paramsObj = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
169
|
+
if (!(!paramsObj || typeof paramsObj.count !== 'number')) {
|
|
170
|
+
_context2.next = 3;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
throw new Error('countEvent requires a count param (number)');
|
|
174
|
+
case 3:
|
|
175
|
+
return _context2.abrupt("return", this.sendEvent(eventOrObj, paramsObj));
|
|
176
|
+
case 4:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context2.stop();
|
|
179
|
+
}
|
|
180
|
+
}, _callee2, this);
|
|
181
|
+
}));
|
|
182
|
+
function countEvents(_x2) {
|
|
183
|
+
return _countEvents.apply(this, arguments);
|
|
184
|
+
}
|
|
185
|
+
return countEvents;
|
|
149
186
|
}())
|
|
150
187
|
}]);
|
|
151
188
|
return RbtMetricsApi;
|
package/dist/esm/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
40
40
|
* sendEvent({ event: 'foo', ... });
|
|
41
41
|
*
|
|
42
42
|
roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
|
|
43
|
-
|
|
43
|
+
This will POST a payload like:
|
|
44
44
|
{
|
|
45
45
|
"event": "UIMain.userAction.login",
|
|
46
46
|
"category": "UIMain",
|
|
@@ -82,4 +82,19 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
82
82
|
throw err;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Count-based metric event (requires `count` param).
|
|
88
|
+
* Example:
|
|
89
|
+
* roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
90
|
+
*
|
|
91
|
+
* is equivalent to:
|
|
92
|
+
* roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
93
|
+
*/
|
|
94
|
+
async countEvents(eventOrObj, paramsObj = {}) {
|
|
95
|
+
if (!paramsObj || typeof paramsObj.count !== 'number') {
|
|
96
|
+
throw new Error('countEvent requires a count param (number)');
|
|
97
|
+
}
|
|
98
|
+
return this.sendEvent(eventOrObj, paramsObj);
|
|
99
|
+
}
|
|
85
100
|
}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
package/src/rbt_metrics_api.js
CHANGED
|
@@ -42,6 +42,7 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
42
42
|
* sendEvent({ event: 'foo', ... });
|
|
43
43
|
*
|
|
44
44
|
roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
|
|
45
|
+
|
|
45
46
|
This will POST a payload like:
|
|
46
47
|
{
|
|
47
48
|
"event": "UIMain.userAction.login",
|
|
@@ -87,4 +88,20 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
87
88
|
throw err;
|
|
88
89
|
}
|
|
89
90
|
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Count-based metric event (requires `count` param).
|
|
94
|
+
* Example:
|
|
95
|
+
* roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
96
|
+
*
|
|
97
|
+
* is equivalent to:
|
|
98
|
+
* roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
|
|
99
|
+
*/
|
|
100
|
+
async countEvents(eventOrObj, paramsObj = {}) {
|
|
101
|
+
if (!paramsObj || typeof paramsObj.count !== 'number') {
|
|
102
|
+
throw new Error('countEvent requires a count param (number)');
|
|
103
|
+
}
|
|
104
|
+
return this.sendEvent(eventOrObj, paramsObj);
|
|
105
|
+
}
|
|
106
|
+
|
|
90
107
|
}
|