Repository navigation
hidane 0.4.0
hidane 0.4.0 delivers Firestore events to the Cloud Functions emulator: Firestore-triggered functions, v1 and v2, fire under firebase emulators:start and emulators:exec with the same data as with the official emulator (v1.22.0), recorded from it and replayed by the test suite.
Functions events (#70)
Every commit sends an event to each registered trigger that watches a document it changed, as the official emulator sends them:
- v1 (
providers/cloud.firestore/eventTypes/document.*): JSON with the document before and after, one event ID shared by the v1 triggers of a change. - v2 (
google.cloud.firestore.document.v1.*,withAuthContexttoo): binary CloudEvents with thece-*headers and aDocumentEventDatain protobuf. - Path patterns and named databases; batches, transactions,
:batchWrite, the Write stream, recursive deletes and cleared databases send events, imports andPOST /resetdo not. - Delivered in the background, one at a time, in the official emulator's order; a failed delivery, or a missing
--functions_emulator, is aWARNING, as there.
End to end, a functions project (firebase-functions 6.6.0) under firebase emulators:exec --only functions,firestore (firebase-tools 15.33.0) gets the same events with the same data under hidane exec as with the official emulator. Four differences are intentional and documented in parity exceptions: ce-source names the project once (the official emulator writes projects/projects/…); a write that changes nothing and the delete of a missing document send no v2 event (as production and the official emulator's own v1 events); POST /reset keeps the registered triggers (the official emulator forgets them, and functions stop firing silently); a v2 trigger registered without a database watches (default) (the official emulator answers every write with a 500).
Commit checks (#202, #203)
- A commit with several problems now gets the official emulator's first error: names over every write, then the commit as a whole (verifies, sequences of writes to one document), then values, then preconditions and sizes; recorded over REST, gRPC,
:batchWriteand the Write stream (4,644 answers). - Writes to another database's documents stay refused with
INVALID_ARGUMENT. The official emulator acknowledges them and keeps them where no read in either database finds them; this is documented as an intentional difference.
Also
- The Go (
cloud.google.com/go/firestore), Python (google-cloud-firestore) and Java (google-cloud-firestore) server SDKs are verified against both emulators: documents, queries, transactions, listeners (#187). - The parity table now counts 20,224 answers recorded from the official emulator.
Install
curl -fsSL https://hidane.dev/install.sh | sh
brew install hidane-dev/tap/hidane
npm install --save-dev hidane
cargo binstall hidane # or cargo install hidane
dart pub global activate hidane
docker run --rm -p 8080:8080 ghcr.io/hidane-dev/hidane:0.4.0Full changelog: v0.3.0...v0.4.0