chore: remove paginator dependency and use gapic to return streams for paginated calls instead#762
Conversation
Codecov Report
@@ Coverage Diff @@
## master #762 +/- ##
=======================================
Coverage 99.13% 99.14%
=======================================
Files 17 17
Lines 15774 15818 +44
Branches 951 959 +8
=======================================
+ Hits 15638 15682 +44
Misses 133 133
Partials 3 3
Continue to review full report at Codecov.
|
|
@AVaksman I know it's still a draft, so sorry if I'm jumping in too soon. But, I was wondering if you could describe the intentions behind this when you get the chance? Thanks! |
paginator and use gapic to return streams for paginated calls instead|
gapic now supports paginated calls and its streamified versions directly. |
|
Does it also retry requests? |
|
Yes, gax supports retries for paged calls. |
src/index.ts
Outdated
| }); | ||
| }; | ||
|
|
||
| const streamified = {listTablesStream: true}; |
There was a problem hiding this comment.
Can we use a different variable name to better describe the difference between a method that is "streamified" and one that isn't? Does this list effectively hold GAPIC streaming methods? If so, maybe const gapicStreamingMethods = {...};?
src/index.ts
Outdated
| }); | ||
| } | ||
|
|
||
| function makeRequestStreamified() { |
There was a problem hiding this comment.
Let's rename this, too, to be more clear. Maybe makeGapicStreamRequest()?
src/instance.ts
Outdated
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-this-alias | ||
| const self = this; | ||
| const transform = function ( |
There was a problem hiding this comment.
Would this work (minus annotations and formatting)?
// name change to indicate purpose of method
const transformToTable = (chunk, enc, next) => { // no "this" argument
const table = this.table(chunk.name); // the Table constructor should support raw input
table.metadata = chunk;
next(null, table);
};There was a problem hiding this comment.
Done!
Have to pass tableId only thought, Table constructor checks for the proper projectId presence.
…lates (googleapis#769) This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@21f1470 Source-Link: googleapis/synthtool@388e10f
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box.
|
Thanks! |
|
@stephenplusplus I added another unit test after the approval |
|
Nice, lgtm! |
gapic supports both paginated calls and its streamified versions.