Releases: tylim88/FirelordJS
Releases · tylim88/FirelordJS
2.3.6
2.3.2
- fix incorrect error message when
in
ornot-in
comparators trigger error (error is correct but message is not) - Fix array const assertion (recursively)
import {
MetaTypeCreator,
getFirelord,
query,
where,
getFirestore,
} from 'firelordjs'
const fs = getFirestore()
type ABC = MetaTypeCreator<
{
a: 1 | 2 | 3 // literal type
b: ('a' | 'b' | 'c')[] // literal array type
},
'ABC'
>
const ColRef = getFirelord<ABC>(db, 'ABC').collection()
// literal type
query(ColRef, where('a', '>', 1)) // ok, not dealing with array
query(ColRef, where('a', 'in', [1])) // not ok, it is an array AND literal type, need const assertion!
query(ColRef, where('a', 'in', [1 as const])) // ok, const assertion!
query(ColRef, where('a', 'in', [1] as const)) // error before v2.3.2, now it is fixed
// literal array type
query(ColRef, where('b', '==', ['a'])) // not ok, dealing with array AND literal type, need const assertion!
query(ColRef, where('b', '==', ['a' as const])) // ok, const assertion!
query(ColRef, where('b', 'in', [['a' as const]])) // ok, const assertion!
query(ColRef, where('b', '==', ['a'] as const)) // // error before v2.3.2, now it is fixed
query(ColRef, where('b', 'in', [['a'] as const])) // error before v2.3.2, now it is fixed
query(ColRef, where('b', 'in', [['a']] as const)) // error before v2.3.2, now it is fixed
2.3.1
- remove most of the need to assert as const, greatly improve user experience when dealing with literal types (very few cases still need to assert as const)
type ABC = MetaTypeCreator<
{
a: 1 | 2 | 3 // literal type
},
'ABC'
>
const ColRef = getFirelord<ABC>(db, 'ABC').collection()
query(ColRef, where('a', '>', 1)) // before v2.3.1 this will error and require const assertion `1 as const`, now it no longer requires const assertion
- tons of housekeeping
2.3.0
- update documentation to the latest
- add
getCountFromServer
api and related tests, example:
getCountFromServer(query(example.collection(), where('a', '>', 1))).then(
aggregatedQuerySnapshot => {
const count = aggregatedQuerySnapshot.data().count
}
)
Breaking:
no longer expose firestore terminate, initializeFirestore, loadBundle, clearIndexedDbPersistence, connectFirestoreEmulator, disableNetwork, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, onSnapshotsInSync, namedQuery, waitForPendingWrites, CACHE_SIZE_UNLIMITED and DocumentData
to offload firelordjs responsibility
Breaking(Admin):
no longer expose firestore BulkWriter, GrpcStatus, BundleBuilder, setLogFunction, and DocumentData
to offload firelord responsibility
2.2.6
2.2.1
- add
AbstractMetaTypeCreator
to make abstractig meta type easier, see use case #90 (comment) - expose
DocumentData
type
2.2.0
- allow all
update
operations andset merge
to accept value with optional type (this sacrificed some granularity because of howexactOptionalPropertyTypes
works but this is trivial, also added minimum related tests) #89 - must turn on
exactOptionalPropertyTypes
in tsconfig, it is no longer optional (breaking) - expose
RunTransaction
andWriteBatch
types