All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. This change log follows the format documented in Keep a CHANGELOG.
- Added
asmethod to collections and collections groups. The method allows sharing functionality between collections and collections groups. Read the sharing functionality guide.
- Deprecated
Typesaurus.Collection,Typesaurus.Ref, andTypesaurus.Docin favor ofTypesaurus.SharedCollection,Typesaurus.SharedRef, andTypesaurus.SharedDocto reflect the new sharing functionality. Read the sharing functionality guide.
This release has no user-facing changes, it's a dev release powering the Typesaurus Point-in-Time Recovery adapter.
- Fixed the native Firebase reference/query object not being exposed.
- Renamed
nativetonativeSymolin the adapters.
- Added ability to access the database instance from subscription promisesa via
dbSymbolsymbol.
This release has no user-facing changes, it's a dev release powering the Typesaurus Point-in-Time Recovery adapter.
- Added native Firestore reference/query object to the subscription promise object, which is accessible via
nativesymbol to enable low-level access for advanced use cases, like Typesaurus Point-in-Time Recovery adapter. Don't use it!
This release has no user-facing changes, it's a dev release powering the Typesaurus Point-in-Time Recovery adapter.
- Export admin & web adapters to enable low-level access for advanced use cases, like Typesaurus Point-in-Time Recovery adapter. Don't use those!
-
Fixed
Typesaurus.Refbeing incompatible with theReftype inferred from the actual database API. -
Fixed
updatewidening the model type when passing an object. It was allowed to pass an object with extra fields. It is now fixed except for data returned from the function argument, which is still prone to the problem, which is a TypeScript limitation.
- Added type-safe way to share functionality between refs and docs. Read the sharing functionality guide. Read the architecture desicion record (ADR-2).
- Fixed
batchnot using respecting collections renaming.
- Made the
Namegeneric inTypesaurus.CollectionandTypesaurus.Reftypes optional.
- Added
sumandaverageaggregation methods to collections, queries and collection groups.
- Fixed subcollections path for renamed with
.namecollections.
Completely revamped Typesaurus with a new API and new features. Follow this guide to learn how it works.
- Replace deprecated
@firebase/rules-testingwith@firebase/rules-unit-testing.
- Third argument in
doc(meta) now optional.
-
BREAKING: Transaction write functions now synchronous and don't return promises.
-
Added
metato doc, which presents only in the web environment.
- Added
docIdconstant-helper that allows to sort or filter by the document ID.
- Added collection group support to
allandonAll.
-
BREAKING: When using with ESM-enabled bundler, you should transpile
node_modules. TypeScript preserves many modern languages features when it compiles to ESM code. So if you have to support older browsers, use Babel to process the dependencies code. -
BREAKING:
addnow returnRefinstead ofDocto avoid confusion that the returned data match the current database state which might be not a case when using with field values i.e.value('serverDate'). -
BREAKING:
set,transaction.setandbatch.setnow returnPromise<void>(orvoidin case ofbatch.set). The same reasoning as for theadd(see above). -
BREAKING:
set,transaction.setandbatch.setnow don't acceptmergeoption. Instead use the newupsetfunction that provides better typing and ensures data consistency. -
BREAKING:
value('serverDate')now returns a simple object instead of monkey-patchedDateinstance. -
BREAKING:
ModelUpdaterenamed toUpdateModelfor consitency withSetModelandUpsetModel. -
BREAKING:
refnow don't generate id if the second argument is omitted, useidfunction to generate new id instead. -
updatenow allows passing partial data into nested fields. Previously only root fields were optional. -
Now the browser adaptor imports
firebase/appandfirebase/firestoreon-demand (using ESM'simport()) rather than in the root level of the library. That dramatically improves initial paint time and helps with bundle caching. Now every time you make a small change in the app, the user won't have to downloadfirestoremodules as well.
-
Added ESM version of the code that enables tree-shaking.
-
Added new
upset,batch.setandtransaction.setfunctions that sets or updates the value of given document. It replacesmergeoption available in the previous version of Typesaurus. -
Added new
idfunction that generates random id for a document.
- Added
onGetManyfunction.
- Added testing module
typesaurus/testingwithinjectTestingAdaptorandsetAppthat allow to use Typesaurus with@w.
- Added ability to use docs in cursors (
startAt,startAfter, etc.). #28
-
BREAKING: Rework the
subcollectionfunction to support nested subcollections. #18 -
BREAKING: Rework the
transactionfunction. Now it accepts two functions as arguments. The first function allows only reading, and another allows only writing. It will make it impossible to perform reads after writes, which would throw an exception as it's a Firebase limitation. #16 -
Define the
transactionfunction result type. #16 -
Remove
@google-cloud/firestore,firebase, andfirebase-adminfrom the peer dependencies to get rid of unavoidable warnings when Typesaurus is used only in the web or Node.js environment. #17
- Add
Batchtype that defines the object returned from thebatchfunction.
- Make
serverDatevalue to actually call Firebase'sserverTimestampinstead of passing current date.
- Fix
array-containsfilter support inwhere.
-
BREAKING:
untypedWhereArrayContainswas removed in favor of native support ofarray-containsfilter inwhere. -
BREAKING: Update Firebase dependencies to the latest versions:
@google-cloud/firestore:>=2.6.0firebase:>=7.5.0firebase-admin:>=8.8.0
- Added
inandarray-contains-anyfilters support towhere. Read more about these filters in the Firebase announcement.
-
BREAKING: Remove deprecated
clearthat was renamed toremove. -
BREAKING: Return
nullinstead ofundefinedwhen a document isn't found.
- Loose up peer dependency requirements. See #5 for the reasoning.
- Add
getManyfunction. Kudos to @thomastoye!
- BREAKING: Move Firebase packages to the peer dependencies to prevent npm from installing two or more firebase-admin versions which cause obscure errors like "The default Firebase app does not exist".
- Now
refgenerates an id when one isn't passed.
- Rename
cleartoremoveeverywhere keepingclearas an alias which will be removed in the next major version.
-
Export
fieldfrom the package root -
Added support for
value(i.e.value('increment', 1)) in the field paths. -
Add support for merge set that use the current document values as defaults:
await set(user.ref, { name: "Sasha", date: new Date(1987, 1, 11) }); await set(user.ref, { name: "Sasha" }, { merge: true }); await get(user.ref); //=> { data: { name: 'Sasha', date: new Date(1987, 1, 11) }, ... }
First public release.