@google-cloud/paginator
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -168,13 +168,17 @@ "use strict"; | ||
const results = new Array(); | ||
let otherArgs = []; | ||
const promise = new Promise((resolve, reject) => { | ||
paginator | ||
.runAsStream_(parsedArguments, originalMethod) | ||
const stream = paginator.runAsStream_(parsedArguments, originalMethod); | ||
stream | ||
.on('error', reject) | ||
.on('data', (data) => results.push(data)) | ||
.on('end', () => resolve(results)); | ||
.on('end', () => { | ||
otherArgs = stream._otherArgs || []; | ||
resolve(results); | ||
}); | ||
}); | ||
if (!callback) { | ||
return promise.then(results => [results]); | ||
return promise.then(results => [results, ...otherArgs]); | ||
} | ||
promise.then(results => callback(null, results), (err) => callback(err)); | ||
promise.then(results => callback(null, results, ...otherArgs), (err) => callback(err)); | ||
} | ||
@@ -181,0 +185,0 @@ /** |
@@ -32,2 +32,3 @@ /*! | ||
_nextQuery: {} | null; | ||
_otherArgs: unknown[]; | ||
_reading: boolean; | ||
@@ -34,0 +35,0 @@ _requestFn: Function; |
@@ -31,2 +31,3 @@ "use strict"; | ||
this._resultsToSend = args.maxResults === -1 ? Infinity : args.maxResults; | ||
this._otherArgs = []; | ||
} | ||
@@ -47,3 +48,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
try { | ||
this._requestFn(this._nextQuery, (err, results, nextQuery) => { | ||
this._requestFn(this._nextQuery, (err, results, nextQuery, ...otherArgs) => { | ||
if (err) { | ||
@@ -53,2 +54,3 @@ this.destroy(err); | ||
} | ||
this._otherArgs = otherArgs; | ||
this._nextQuery = nextQuery; | ||
@@ -55,0 +57,0 @@ if (this._resultsToSend !== Infinity) { |
@@ -7,2 +7,9 @@ # Changelog | ||
## [5.0.1](https://github.com/googleapis/nodejs-paginator/compare/v5.0.0...v5.0.1) (2024-05-22) | ||
### Bug Fixes | ||
* Should pass extra callback arguments back to consumer ([#361](https://github.com/googleapis/nodejs-paginator/issues/361)) ([cc5c48b](https://github.com/googleapis/nodejs-paginator/commit/cc5c48b95b21e9c6a4e555ff98de267258657b6e)) | ||
## [5.0.0](https://github.com/googleapis/nodejs-paginator/compare/v4.0.1...v5.0.0) (2023-08-09) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/paginator", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "A result paging utility used by Google node.js modules", | ||
@@ -33,3 +33,3 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@compodoc/compodoc": "^1.1.7", | ||
"@compodoc/compodoc": "1.1.23", | ||
"@types/extend": "^3.0.0", | ||
@@ -39,5 +39,5 @@ "@types/mocha": "^9.0.0", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^10.0.0", | ||
"@types/sinon": "^17.0.0", | ||
"@types/uuid": "^9.0.0", | ||
"c8": "^8.0.0", | ||
"c8": "^9.0.0", | ||
"codecov": "^3.0.4", | ||
@@ -48,3 +48,3 @@ "gts": "^5.0.0", | ||
"proxyquire": "^2.0.1", | ||
"sinon": "^15.0.0", | ||
"sinon": "^17.0.0", | ||
"typescript": "^5.1.6", | ||
@@ -51,0 +51,0 @@ "uuid": "^9.0.0" |
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
50599
462