FirelordJS

🔥High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience

MIT License

Downloads
1.2K
Stars
84
Committers
5
FirelordJS - 2.3.6

Published by tylim88 over 1 year ago

  • fix getDocs cannot infer type from collection reference, getDocs(example.collection('...')) now return accurate type

will fix other related problems in the next version

FirelordJS - 2.3.2

Published by tylim88 over 1 year ago

  • 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
FirelordJS - 2.3.1

Published by tylim88 over 1 year ago

  • 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
FirelordJS - 2.3.0

Published by tylim88 over 1 year ago

  • 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

FirelordJS - 2.2.6

Published by tylim88 over 1 year ago

const autoIdDocRef = example.doc(example.collection())
FirelordJS - 2.2.1

Published by tylim88 over 1 year ago

FirelordJS - 2.2.0

Published by tylim88 over 1 year ago

  • 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) https://github.com/tylim88/FirelordJS/issues/89
  • must turn onexactOptionalPropertyTypes in tsconfig, it is no longer optional (breaking)
  • expose RunTransaction and WriteBatch types
FirelordJS - 2.1.0

Published by tylim88 about 2 years ago

  • narrow the id type of document reference
  • add more tests and more code for doc
FirelordJS - 1.8.0

Published by tylim88 about 2 years ago

  • fix incorrect id, path, and parent types of collection reference
  • narrow the id type of document reference
FirelordJS - 2.0.0

Published by tylim88 about 2 years ago

  • 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 __.*__)
FirelordJS - remove the need for crypto module

Published by tylim88 about 2 years ago

  • fix missing in code documentation
  • housekeeping in code documentation (internal)
  • refactor types (internal)
  • add new argument TransactionOptions to runTransaction (new feature)
  • add firebase as peerDependencies
  • remove the need for crypto module, this module may cause a lot of issues because it is a nodejs module(important)
  • reduce compile size
  • further simplify typing (internal)
  • update eslint (internal)
FirelordJS - v1.5.0

Published by tylim88 over 2 years ago

tons of housekeeping and simplification

2 breaking changes:

  • rename MetaTypeCreator setting allFieldsPossiblyUndefined as allFieldsPossiblyReadAsUndefined
  • remove onSnapshot onCompletion parameter (remove 1 function overload)
FirelordJS - 1.4.2

Published by tylim88 over 2 years ago

collection path now check for number of forward slash

FirelordJS - 1.3.0

Published by tylim88 over 2 years ago

when using cursor(eg startAt) with orderBy('name'), cursor will only accept full document path as value

FirelordJS - 1.1.18

Published by tylim88 over 2 years ago

compile to es5 instead of es6

FirelordJS - 1.1.16

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

FirelordJS - 1.1.2

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

FirelordJS - 1.1.0

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

FirelordJS - 1.0.11

Published by tylim88 over 2 years ago

ok this one is good, stable

Package Rankings
Top 6.7% on Proxy.golang.org
Top 5.58% on Npmjs.org
Related Projects