🔥High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
MIT License
Published by tylim88 over 1 year ago
getDocs
cannot infer type from collection reference, getDocs(example.collection('...'))
now return accurate typewill fix other related problems in the next version
Published by tylim88 over 1 year ago
in
or not-in
comparators trigger error (error is correct but message is not)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
Published by tylim88 over 1 year ago
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
Published by tylim88 over 1 year ago
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
Published by tylim88 over 1 year ago
const autoIdDocRef = example.doc(example.collection())
Published by tylim88 over 1 year ago
AbstractMetaTypeCreator
to make abstractig meta type easier, see use case https://github.com/tylim88/FirelordJS/issues/90#issuecomment-1407071081
DocumentData
typePublished by tylim88 over 1 year ago
update
operations and set merge
to accept value with optional type (this sacrificed some granularity because of how exactOptionalPropertyTypes
works but this is trivial, also added minimum related tests) https://github.com/tylim88/FirelordJS/issues/89
exactOptionalPropertyTypes
in tsconfig, it is no longer optional (breaking)RunTransaction
and WriteBatch
typesPublished by tylim88 about 2 years ago
id
type of document referencePublished by tylim88 about 2 years ago
id
, path
, and parent
types of collection referenceid
type of document referencePublished by tylim88 about 2 years ago
__.*__
)Published by tylim88 about 2 years ago
Published by tylim88 over 2 years ago
tons of housekeeping and simplification
2 breaking changes:
allFieldsPossiblyUndefined
as allFieldsPossiblyReadAsUndefined
Published by tylim88 over 2 years ago
collection path now check for number of forward slash
Published by tylim88 over 2 years ago
when using cursor(eg startAt) with orderBy('name'), cursor will only accept full document path as value
Published by tylim88 over 2 years ago
compile to es5 instead of es6
Published by tylim88 over 2 years ago
remove sourcemap because sourcemap requires src code to be included, which is very redundant and can cause issues to creat-react-app
Published by tylim88 over 2 years ago
now support @firebase/rules-unit-testing
example: https://github.com/tylim88/Firelordjs/blob/main/codeForDoc/src/rulesUnitTesting.test.ts
will update the doc
Published by tylim88 over 2 years ago
MetaType now able to refer to itself, CollectionReference Parent props no longer need type casting
if you already type cast it, you can remove it or leave it
Published by tylim88 over 2 years ago
ok this one is good, stable