-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(cleanup)!: Remove redundant callback types, move storage.ts to … #2445
Conversation
Gigantic WIP / PoC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC the bulk of this PR is refactoring all the common options to "Storage-Transport" and wiring everything back together? If thats right, it would be helpful to add context in the StorageTransport docs.
Also, if this is the case, maybe create a seperate PR that introduces the concept of "storage-transport", and then the PRs after that can incrementally refactor specific files that need to be refactored (e.g. ACL, Bucket, HMAC, etc.)
[hmacKey] = await storage.createHmacKey( | ||
`${TESTS_PREFIX}@email.com` | ||
); | ||
hmacKey = await storage.createHmacKey(`${TESTS_PREFIX}@email.com`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im guessing we can remove this once #2461 is complete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a conformance test, it already runs against test bench. The change here is that it no longer returns an array, only a single element.
|
||
storage.interceptors.push({ | ||
//TODO: Interceptors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a bug here with more info on the TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can actually be fixed now. When I started this was dependent on adding interceptors to gaxios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this.
@@ -795,7 +795,7 @@ export async function notificationGetMetadata(options: ConformanceTestOptions) { | |||
|
|||
export async function createBucket(options: ConformanceTestOptions) { | |||
const bucket = options.storage!.bucket('test-creating-bucket'); | |||
const [exists] = await bucket.exists(); | |||
const exists = await bucket.exists(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the change here? previously we were returning an array, and now its an object?
It would be helpful to start a README doc with a list of "breaking" changes so that we make sure we cover everything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or update PR description with a checklist of # of changes that need to happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were returning arrays for no reason all over the place. I'm trying to bring responses much more in line with the standard JSON API responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of breaking changes is going to be too big for comments / PR commit messsages. I have created an issue in buganizer to create a migration guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing out some random ideas here... It seems like migrating for returning an array vs object is the big breaking change here. Is there anyway to have some kind of flag for customers who want to keep the current behavior? We can eventually deprecate the flag but it would give customers some more time to keep the current behavior while we modernize the library
(err: GaxiosError<T> | null, data?: T): void; | ||
} | ||
|
||
interface TransportParameters extends Omit<GoogleAuthOptions, 'authClient'> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where's Omit coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v cool. TIL
} | ||
|
||
interface TransportParameters extends Omit<GoogleAuthOptions, 'authClient'> { | ||
apiEndpoint: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these options all copied from somewhere? What's the source and how do we know nothing is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is extending GoogleAuthOptions
but omitting authClient
.
|
||
const keyIndex = this.interceptors.indexOf( | ||
// TODO: INTERCEPTORS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same request about adding a bug or notes
src/file.ts
Outdated
this.bucket.name | ||
}/${encodeURIComponent(this.name)}`, | ||
headers, | ||
//headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why comment this out?
@@ -13,33 +13,13 @@ | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file even necessary anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not. I was going to sweep up all the garbage once I got things back to a working state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg, can you add it to some tracking list of TODOs
@@ -779,6 +755,10 @@ export class Storage extends Service { | |||
|
|||
this.retryOptions = config.retryOptions; | |||
|
|||
this.storageTransport = new StorageTransport({...config, ...options}); | |||
//this.interceptors = []; | |||
this.universeDomain = options.universeDomain || DEFAULT_UNIVERSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wheres this change coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What change are you referring to? It probably shows all three lines as new because I commented out the interceptors and added StorageTransport. I didn't touch universedomain.
@@ -654,7 +655,7 @@ export class TransferManager { | |||
: fileOrName; | |||
|
|||
const fileInfo = await file.get(); | |||
const size = parseInt(fileInfo[0].metadata.size!.toString()); | |||
const size = parseInt(fileInfo.metadata.size!.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question here about expecting an array vs a single object
Sort of. StorageTransport is replacing the mixture of transport level options and functionality that was spread across several files (Service, ServiceObject, util). I think we are a bit too far past just introducing Storage Transport. I think at this point our best path forward is to merge this into the feature branch and then do as you suggest and work on each file / section individually. |
…calling gaxios
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕