Skip to content

Releases: tylim88/FirelordJS

2.3.6

19 Feb 22:22
585486a
Compare
Choose a tag to compare
  • fix getDocs cannot infer type from collection reference, getDocs(example.collection('...')) now return accurate type

will fix other related problems in the next version

2.3.2

12 Feb 22:36
Compare
Choose a tag to compare
  • fix incorrect error message when in or not-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

11 Feb 01:19
Compare
Choose a tag to compare
  • 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

09 Feb 12:51
Compare
Choose a tag to compare
  • 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

07 Feb 18:59
7186dde
Compare
Choose a tag to compare
  • (web only)transpiling to cjs now does not transpile import to require(fix not working with firebase 9.17.1 #91)
  • support auto generate document reference ID (v2.2.2). usage example:
const autoIdDocRef = example.doc(example.collection())

2.2.1

27 Jan 21:15
Compare
Choose a tag to compare
  • add AbstractMetaTypeCreator to make abstractig meta type easier, see use case #90 (comment)
  • expose DocumentData type

2.2.0

26 Jan 21:00
Compare
Choose a tag to compare
  • allow all 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) #89
  • must turn onexactOptionalPropertyTypes in tsconfig, it is no longer optional (breaking)
  • expose RunTransaction and WriteBatch types

2.1.0

19 Sep 10:08
Compare
Choose a tag to compare
  • narrow the id type of document reference
  • add more tests and more code for doc

1.8.0

19 Sep 10:07
Compare
Choose a tag to compare
  • fix incorrect id, path, and parent types of collection reference
  • narrow the id type of document reference

2.0.0

14 Sep 17:38
b7532d5
Compare
Choose a tag to compare
  • new way to create firelord ref
  • new interface for doc, collection and collection group
  • this is a big change, please read the documentation for more details
  • add check for InvalidID (Cannot match the regular expression __.*__)