🔥 Write V9 like Firestore Admin code with extreme type safety.
MIT License
Published by tylim88 about 1 year ago
doc
JSDoc not working properlythe rest updates:
https://github.com/tylim88/FirelordJS/releases/tag/2.6.5
Published by tylim88 about 1 year ago
expose types Unsubscribe and OnSnapshot
Published by tylim88 over 1 year ago
/**
* listen to filtered collection, entire collection or single document
*
* Attaches a listener for {@link DocumentSnapshot} Or {@link QuerySnapshot} events. You may either pass
* individual {@link onNext} and {@link onError} callbacks. The listener can be cancelled by
* calling the function that is returned when {@link OnSnapshot} is called.
*
* related documentation:
* - {@link https://firelordjs.com/firelord/quick_start#onsnapshot}
*
* @param reference
*
* Type 1: {@link Query} eg: query(example.collection(...), ...) listen to filtered collection
*
* Type 2: CollectionGroup({@link Query}) eg: query(example.collectionGroup(...), ...) listen to filtered {@link Query}
*
* Type 3: {@link CollectionReference} eg: example.collection(...) listen to entire collection
*
* Type 4: CollectionGroup({@link Query}) reference eg: example.collectionGroup(...) listen to entire {@link Query}
*
* Type 5: {@link DocumentReference} eg: example.doc(...) listen to a single document
* @param onNext - A callback to be called every time a new {@link DocumentSnapshot} or {@link QuerySnapshot} is available.
*
* Type 1: receive {@link DocumentSnapshot} if {@link reference} is {@link DocumentReference} eg: (value: {@link DocumentSnapshot}) => { handle data here }
*
* Type 2: receive {@link QuerySnapshot} if {@link reference} is CollectionGroup or {@link Query} or {@link CollectionReference} eg: (value: {@link QuerySnapshot}) => { handle data here }
*
* @param onError - optional parameter. A callback to be called if the listen fails or is cancelled. No further callbacks will occur. Eg: (error: {@link FirestoreError})=> { handle error here}
*
* @returns An unsubscribe function that can be called to cancel
* the snapshot listener.
*/
Published by tylim88 over 1 year ago
Published by tylim88 over 1 year ago
AbstractMetaTypeCreator
not exportedinternal:
installLatest
script into codeForDoc
Published by tylim88 over 1 year ago
Published by tylim88 over 1 year ago
updateDocNoFlatten
still flattenupdateDocNoFlatten
was not exportedundefined
or never
typePublished by tylim88 over 1 year ago
Record<string, something>
data type, please note Typescript keys collapsing behavior:compare
and writeFlatten
indexes with dot notation keys if keys consisting of string
.User['compare'][`a.${string}.b`]
will return never
because of a.${string}
.User['compare']['a'][string]['b']
transaction.updateNoFlatten
, batch.updateNoFlatten
, and updateDocNoFlatten
. These APIs behave exactly the same as official update
: they will delete nested properties(non-top level properties) that are NOT included.related issue: https://github.com/tylim88/Firelord/issues/20
Published by tylim88 over 1 year ago
documentId()
now return __name__
, this is to simplify the typing logic. documentId
field value is probably meaningless right now as we could just use __name__
, but will keep it for backward compatibility
fix when orderby documentId, the cursor require full document path regardless of whether the reference is collection reference or collection group reference.
old behavior
query(colRef, orderBy(documentId()), endAt('abc')) // error: require full document path, eg 'a/b', reject plain document id <--incorrect behavior
query(colGroupRef, orderBy(documentId()), endAt('a/b') // ok, accept full document path and reject plain document id
new behavior
query(colRef, orderBy(documentId()), endAt('abc')) // ok, now need only plain document id and reject full path
query(colGroupRef, orderBy(documentId()), endAt('a/b') // ok, accept full document path and reject plain document id
the logic behind these type rules:
Published by tylim88 over 1 year ago
2.4.9
GetDocIds
, useful if you want to abstract document id, see https://firelordjs.com/guides/abstractdocandcolids/
2.4.10
GetCollectionIds
, useful if you want to abstract collection id, see https://firelordjs.com/guides/abstractdocandcolids/
2.4.12
query(collectionRef, where(documentId(), '!=', 'a' as string))
use to always throw error, now only throw if document id type is is string literal(not wide type string)
Published by tylim88 over 1 year ago
Published by tylim88 over 1 year ago
Published by tylim88 over 1 year ago
add native Byte
type
Published by tylim88 over 1 year ago
Bytes
, please import Bytes
from Firestore insteadPublished by tylim88 over 1 year ago
Published by tylim88 about 2 years ago
id
, path
, and parent
types of collection referenceid
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