-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(firestore): add VectorValue type and vector() API #8739
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
base: main
Are you sure you want to change the base?
Conversation
|
@Pelleking is attempting to deploy a commit to the Invertase Team on Vercel. A member of the Team first needs to authorize it. |
|
The issue it resolves #8442 |
|
Hey @Pelleking 👋 ! Sorry this has sat, it's through no fault of your own, I've got quite a stack of PRs to review right now in this repo and this is definitely one of them. One thing I can do is approve the workflows though - in particular, you might like the output of the "patches" workflow that generates a set of patches compatible with patch-package, so you may continue to rely on the public packages we publish on npmjs.org, but apply the changes you need on top of them until this is merged |
38a52cd to
7af280b
Compare
|
@mikehardy Could you please rerun the workflows? |
|
Reviewer note - need to pull this along with withConverter PR support to check intersectionality - both of these are going to land, then after we can stage firestore for typescript-native conversion Re-running CI now and there have been a few CI fixes recently that may need to be rebased in here - in particular an android emulator hang when v36 of the emu came out a few days ago resolved with a version pin |
16d20b9 to
3475835
Compare
feat(firestore): add VectorValue type and vector() API
Adds Firestore Vector field support to React Native Firebase:
VectorValueclass andvector(values?: number[])constructorMotivation
Brings RNFB Firestore to parity with Firebase SDKs that added Vector support:
JS SDK APIs (10.13): PR reference
iOS (11.10.0): release notes
Android (25.1.0): release notes
Fixes 🐛 [Firestore] Vector Type Support #8442
API
import { VectorValue, vector } from '@react-native-firebase/firestore'await setDoc(docRef, { embedding: vector([0.1, 0.2, 0.3]) })firebase.firestore.VectorValue,firebase.firestore.vector(values)Implementation
VectorValuewith validation,isEqual,toJSONvectortype; wired intogenerateNativeDataandparseNativeDataVectorValueinweb/convert.jsFIRVectorValue(no hard crash on older SDKs)com.google.firebase.firestore.VectorValueVectorValuetype andvector()declaration; added toDocumentFieldTypeMinimum native versions for full functionality:
Older SDKs won’t crash (reflection guards), but vectors will not function.
Usage Example
Tests
packages/firestore/__tests__/vector.test.tsTypes
packages/firestore/lib/index.d.tsto includeVectorValue,vector(), andDocumentFieldTypeunionChecklist
I read the Contributor Guide and followed the process outlined there for submitting PRs.
My change supports the following platforms;
My change includes tests;
packages/**/e2epackages/**/__tests__I have updated TypeScript types that are affected by my change.
This is a breaking change;
Notes