Firelord

🔥 Write V9 like Firestore Admin code with extreme type safety.

MIT License

Downloads
4.6K
Stars
40
Committers
4
Firelord - 2.6.5

Published by tylim88 about 1 year ago

  1. fix doc JSDoc not working properly

the rest updates:
https://github.com/tylim88/FirelordJS/releases/tag/2.6.5

Firelord - 2.6.4

Published by tylim88 about 1 year ago

expose types Unsubscribe and OnSnapshot

Firelord - 2.6.3

Published by tylim88 over 1 year ago

  1. better onSnapshot JSDoc
    /**
     * 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.
     */
  1. remove onSnapshot overloading
Firelord - 2.6.2

Published by tylim88 over 1 year ago

sync with web's

Firelord - 2.5.2

Published by tylim88 over 1 year ago

Firelord - 2.5.1

Published by tylim88 over 1 year ago

  • fix AbstractMetaTypeCreator not exported

internal:

  1. fix built code ci does not fail when tests fail
  2. restructure scripts
  3. fix published code does not utilize codeForDoc node_modules
  4. housekeeping tsconfig
  5. move installLatest script into codeForDoc
  6. remove root directory babel config
  7. refactor MetaTypeCreator
Firelord - 2.5.0

Published by tylim88 over 1 year ago

Firelord - 2.4.18

Published by tylim88 over 1 year ago

  • synced with FirelordJS 2.5.6
  • housekeeping and fixed a minor bug
Firelord - 2.4.17

Published by tylim88 over 1 year ago

  1. fixed updateDocNoFlatten still flatten
  2. fixed updateDocNoFlatten was not exported
  3. fixed in some edge cases mapped type resolves into undefined or never type
Firelord - 2.4.16

Published by tylim88 over 1 year ago

  1. support Record<string, something> data type, please note Typescript keys collapsing behavior:
    image
    playground
  • due to keys collapsing issue, be careful when accessing meta type compare and writeFlatten indexes with dot notation keys if keys consisting of string.
    For example: User['compare'][`a.${string}.b`] will return never because of a.${string}.
    The solution is to access indexes by layer: User['compare']['a'][string]['b']
  • This update changed some core logics while ensuring backward compatibility, so existing code should be fine. New data type requires a lot of tests but because of time constraint and complexity, I only added minimum amount of tests. Helps are appreciated
  1. new APIs: 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

Firelord - 2.4.13

Published by tylim88 over 1 year ago

  1. 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

  2. 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:

  1. collection reference require only plain document id,
  2. collection group reference require full document path
Firelord - 2.4.9, 2.4.10. 2.4.12

Published by tylim88 over 1 year ago

2.4.9

2.4.10

2.4.12

  • fix, when filtering by document id and the value type is string, throw error even though document id type is string

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)

Firelord - 2.4.7

Published by tylim88 over 1 year ago

Firelord - 2.4.0

Published by tylim88 over 1 year ago

Firelord - 2.3.10

Published by tylim88 over 1 year ago

add native Byte type

Firelord - 2.3.7

Published by tylim88 over 1 year ago

  • No longer export Firestore Bytes, please import Bytes from Firestore instead
Firelord - 2.3.1

Published by tylim88 over 1 year ago

Firelord - 2.1.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
  • add more tests and more code for doc
  • remove offset prop of collection reference
Firelord - 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
Firelord - add new arguments for runTransaction and better in code documentation

Published by tylim88 about 2 years ago

  • fix missing code documentation
  • housekeeping in code documentation
  • refactor types
  • add new argument TransactionOptions to runTransaction (new feature)
  • add firebase-admin as peerDependencies
  • reduce compile size
  • further simplify typing
  • update eslint (internal)