
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
@getcircuit/firestore-utils
Advanced tools
A collection of utilities to work with Circuit's Firestore. This package is intended to be used by both client and server Firebase instances.
@getcircuit/firestore-utilsA collection of utilities to work with Circuit's Firestore. This package is intended to be used by both client and server Firebase instances.
isFirestoreError(error?: unknown, code?: FirebaseErrorCode): booleanChecks if the given error is a Firestore error with the given code. If the code is not provided, it will check if the error is a Firestore error.
isModelDocumentRef(modelName: string, ref: DocumentReference): booleanChecks if the given reference is a reference to a document of the given model and asserts the reference type.
function myFunction(rootRef: DocumentReference<Team | User>) {
if (isModelDocumentRef('Team', rootRef)) {
// rootRef is a DocumentReference<Team>
} else if (isModelDocumentRef('User', rootRef)) {
// rootRef is a DocumentReference<User>
}
}
isModelCollectionRef(modelName: string, ref: CollectionReference): booleanChecks if the given reference is a reference to a collection of the given model and asserts the reference type.
function myFunction(rootRef: CollectionReference<Team | User>) {
if (isModelCollectionRef('Team', rootRef)) {
// rootRef is a CollectionReference<Team>
} else if (isModelCollectionRef('User', rootRef)) {
// rootRef is a CollectionReference<User>
}
}
isEqualDocumentData<Data>(data1: Data, data2: Data): booleanCompare two document data objects and return true if they are equivalent.
getQueryId(query: Query): stringReturns a unique ID for the given query. This is useful to uniquely identify a query, as in a cache.
Note: mostly used internally by our custom query snapshot watcher in Snappy.
normalizeRefPath(path: string): stringNormalizes a string Firestore path by removing leading and trailing slashes.
normalizeRefPath('/users/123/') // 'users/123'
getRefId(ref: DocumentReference | CollectionReference | string): stringReturns the ID of the given reference. If the reference is a string, it is assumed to be a Firestore path and the ID is extracted from the last segment of the path.
getRefId(userRef) // '123'
getRefId('users/123') // '123'
getRefPath(ref: DocumentReference | CollectionReference | string): stringReturns the path of the given reference. If the reference is a string path, it is assumed to be a Firestore path and the path is normalized via normalizeRefPath.
getRefPath(userRef) // 'users/123'
getRefPath('users/123') // 'users/123'
isSameRef(ref1: DocumentReference | CollectionReference | string, ref2: DocumentReference | CollectionReference | string): booleanChecks if two references are the same by comparing their path. If the references are string paths, they are assumed to be Firestore paths and are normalized via normalizeRefPath.
const userRef = doc(firestore, 'users/123')
isSameRef(userRef, 'users/123') // true
isSameRef(userRef, 'users/456') // false
isFirestoreRef(ref: unknown): booleanType guard to check if the given reference is a Firestore reference. It doesn't use instance checks, but rather checks if the reference has the expected properties of a Firestore reference: firestore, id and path.
FAQs
A collection of utilities to work with Circuit's Firestore. This package is intended to be used by both client and server Firebase instances.
The npm package @getcircuit/firestore-utils receives a total of 0 weekly downloads. As such, @getcircuit/firestore-utils popularity was classified as not popular.
We found that @getcircuit/firestore-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.