-
Notifications
You must be signed in to change notification settings - Fork 293
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
Update Vectorize types for GA release #2421
Update Vectorize types for GA release #2421
Conversation
* Here, `mutationId` is the identifier for the last mutation processed by Vectorize. | ||
*/ | ||
interface VectorizeVectorMutationV2 { | ||
/* The identifier for the last mutation processed by Vectorize. */ |
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.
If I understand correctly, this previous comment was incorrect - each mutation gets a unique mutation id specific to the operation
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 new comment is more accurate description of a mutation id.
Hi @ndisidore, I'm really excited for Vectorize GA, it has great potential. However, I have a few concerns about this PR, which I hope you don't mind me raising, in order of most to least important:
My suggestion for keeping it one type is to use a generic with a default to distinguish between the types. Here's a link to a quick example: https://www.typescriptlang.org/play/?#code/C4TwDgpgBAsgrsAhsAlgewHYDUCMUC8UA3lHAM4QBOAkgCYBcUZwlKGA5lAL4BQoksBMnTYATAWKkKlAHKIAthEbNWHANxQUDJizadefcNHhJUmADxYqZEVAgAPYBAy0yUAOS53UAD4esot6EnjjuAHwSVpQ2mHaOzq7+oVAA-IKmIrhQjCbCmAE8PLQQAMYANoiU0CWYzFDyODlCZhg8APRtUF3dPV0AeimFxeWV1bXA9aJNGRYh4e2dvUsDQ6UVVVA1GHXyAMzTeRjmnoFhC0vLg0A The key points are: if nothing changes, the old one is used, to avoid changing existing v1 indexes. Users could be told to use either the type with a generic or the V2 override. Wrangler will probably have a way to detect which type a binding should be and it can emit the correct type. |
0c4fc3e
to
200065f
Compare
Hey @DaniFoldi 👋 The generics approach you linked to is a fun one and is certainly something we can consider. We'd looked at something vaguely similar but opted against it primarily because with that, the "naked" type, while it wouldn't be breaking, would default users to the depreciated legacy binding format. This would likely be the case for the forseeable future lest we push the breaking change problem to a later date. For most folks, this should be a 1 line change: Given the above, that Vectorize is in beta, and that this change is strictly for types, we've decided that we're okay with a breaking change here, but we still welcome (and are gathering) feedback. It should be stressed that once this enters GA, our approach here would look very different. |
Hey @ndisidore 👋, Thanks for the response, I appreciate your time! While I understand your reasoning, I firmly believe that the workers-types package does follow semver (and I believe the original intention was to expose unsafe types only in the I hope that this api type change will be communicated to users via docs (and I would also add an inline jsdoc mentioning the legacy types for anyone still using v1 and seeing errors after they update) and changelog so users are aware of the changes they need to make. Going forward it could also help if you marked beta types (or all types of beta products that are available in "stable" workers-types entrypoints) with |
200065f
to
d0dc999
Compare
df9165c
to
ae26ca9
Compare
ae26ca9
to
5b48b9d
Compare
5b48b9d
to
22829e1
Compare
Overview
This updates the types for Vectorize ahead of the GA release.
We have intentionally moved the "current" Vectorize Index to a legacy type, promoting the "new" index to the default
VectorizeIndex
such that it becomes the standard going forward.This is strictly a types change and sister to
cloudflare/workers-sdk#6252