feat(pubsub): split GAPIC from the pubsub handwritten package#8854
feat(pubsub): split GAPIC from the pubsub handwritten package#8854feywind wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the auto-generated GAPIC client files and configuration JSONs, delegating them to the newly added external dependency @google-cloud/pubsub-api. However, two critical runtime issues were identified in the review: first, requiring a configuration JSON directly from the src/ directory of @google-cloud/pubsub-api in message-stream.ts will fail when published; second, using a namespace import for p-defer in subscriber.ts will cause a runtime TypeError when invoked.
| import {replaceProjectIdToken} from '@google-cloud/projectify'; | ||
| import {promisify} from '@google-cloud/promisify'; | ||
| import defer = require('p-defer'); | ||
| import * as defer from 'p-defer'; |
There was a problem hiding this comment.
p-defer exports its main functionality as a default export. Importing it using import * as defer binds defer to a namespace object (e.g., { default: [Function] }), which will cause a runtime TypeError: defer is not a function when called as defer(). Use a default import instead.
| import * as defer from 'p-defer'; | |
| import defer from 'p-defer'; |
There was a problem hiding this comment.
The default import version causes other issues. It might be simplest to just revert this to a require if we don't like the new * version.
This will split out the GAPIC classes into their own package (-api) and change the main handwritten library to use them instead of a built-in copy.
We're waiting on a release next week to link -api - please don't merge.