Skip to content

Commit 5c06ec7

Browse files
author
Perki
committed
Adding apiCall to handleResult
1 parent 3d3d481 commit 5c06ec7

File tree

9 files changed

+15
-13
lines changed

9 files changed

+15
-13
lines changed

components/pryv-monitor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pryv/monitor",
3-
"version": "2.4.6",
3+
"version": "2.4.7",
44
"description": "Extends `pryv` with event-driven notifications for changes on a Pryv.io account",
55
"keywords": [
66
"Pryv",

components/pryv-socket.io/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pryv/socket.io",
3-
"version": "2.4.6",
3+
"version": "2.4.7",
44
"description": "Extends `pryv` with Socket.IO transport",
55
"keywords": [
66
"Pryv",

components/pryv/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ try {
199199
```js
200200
let count = 0;
201201
// the following will be called on each API method result it was provided for
202-
function handleResult(result) { console.log('Got result ' + count++ + ': ' + JSON.stringify(result)); }
202+
function handleResult(result, apiCall) { console.log('Got result ' + count++ + ': ' + JSON.stringify(result) + ' For call ' + JSON.stringify(apiCall)); }
203203

204204
function progress(percentage) { console.log('Processed: ' + percentage + '%'); }
205205

components/pryv/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pryv",
3-
"version": "2.4.6",
3+
"version": "2.4.7",
44
"description": "Pryv JavaScript library",
55
"keywords": [
66
"Pryv",

components/pryv/src/Connection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ class Connection {
193193
if (arrayOfAPICalls[i + cursor].handleResult) {
194194
await arrayOfAPICalls[i + cursor].handleResult.call(
195195
null,
196-
resRequest.results[i]
196+
resRequest.results[i],
197+
thisBatch[i] // request
197198
);
198199
}
199200
}

components/pryv/src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ declare module 'pryv' {
530530
APICallMethods[K]['res'] & PossibleError;
531531

532532
export type APICallResultHandler<K extends keyof APICallMethods> = (
533-
result: APICallResult<K>,
533+
result: APICallResult<K>, apicall: APICall<K>
534534
) => Promise<any>;
535535
export type StreamedEventsHandler = (event: Event) => void;
536536

components/pryv/test/Connection.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ describe('Connection', () => {
129129
conn.options.chunkSize = 2;
130130

131131
let resultsReceivedCount = 0;
132-
function oneMoreResult (res) {
132+
function oneMoreResult (res, apiCall) {
133133
expect(res.events).to.exist;
134+
expect(apiCall.method).to.equal('events.get');
134135
resultsReceivedCount++;
135136
}
136137

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lib-js",
3-
"version": "2.4.6",
3+
"version": "2.4.7",
44
"private": false,
55
"description": "Pryv JavaScript library and add-ons",
66
"keywords": [

0 commit comments

Comments
 (0)