Skip to content

Commit

Permalink
Release v6 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels authored Aug 25, 2021
1 parent d81a565 commit 494dfc0
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 222 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
id: node_modules_cache
with:
path: ./node_modules
key: ${{ runner.os }}-14-next-7-node_modules-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}-14-9-7-node_modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-14-next-7-node_modules-
${{ runner.os }}-14-9-7-node_modules-
${{ runner.os }}-14-node_modules-
- name: Yarn offline cache
if: steps.node_modules_cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
strategy:
matrix:
node: ["12", "14", "16"]
firebase: ["next"]
firebase: ["9"]
rxjs: ["6", "7"]
fail-fast: false
name: Test firebase@${{ matrix.firebase }} rxjs@${{ matrix.rxjs }} on Node.js ${{ matrix.node }}
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
runs-on: ubuntu-latest
name: Publish (NPM)
needs: ['build']
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/exp' || github.event_name == 'release' }}
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
steps:
- name: Setup node
uses: actions/setup-node@v2-beta
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,13 @@ Firebase and RxJS for all frameworks.

Status: Beta


---

> **WARNING**: This branch is the work in progress for version 6 of RxFire. [You can find version 5 here](https://github.com/FirebaseExtended/rxfire/tree/v5), if you're looking for documentation or to contribute to stable.
---

## Install

```bash
# npm
npm i rxfire@next firebase@next rxjs --save
npm i rxfire firebase rxjs --save
# yarn
yarn add rxfire@next firebase@next rxjs
yarn add rxfire firebase rxjs
```

Make sure to install Firebase and RxJS individually as they are peer dependencies of RxFire.
Expand All @@ -45,7 +38,7 @@ const citiesRef = query(
where('state', '==', 'CO')
);

collectionData(citiesRef, 'id')
collectionData(citiesRef, { idField: 'id' })
.pipe(
tap(cities => console.log('This is just an observable!'))
)
Expand Down Expand Up @@ -75,7 +68,7 @@ const citiesRef = query(
where('state', '==', 'CO')
);

collectionData(citiesRef, 'id')
collectionData(citiesRef, { idField: 'id' })
.pipe(
switchMap(cities => {
return combineLatest(...cities.map(c => {
Expand Down Expand Up @@ -114,6 +107,8 @@ import { } from 'rxfire/database';
import { } from 'rxfire/storage';
import { } from 'rxfire/auth';
import { } from 'rxfire/functions';
import { } from 'rxfire/performance';
import { } from 'rxfire/remote-config';
```

## Simple functions
Expand Down
14 changes: 7 additions & 7 deletions docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The `list()` function creates an observable that emits a sorted array for each c
| | |
|-----------------|-------------------------------------------------------|
| **function** | `list()` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, events?: `ListenEvent[]` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, options?: { events?: `ListenEvent[]` } |
| **import path** | `rxfire/database` |
| **return** | `Observable<QueryChange[]>` |

Expand Down Expand Up @@ -86,11 +86,11 @@ list(ref)
.subscribe(users => { console.log(users); })

// Listen only to 'child_added' events
list(ref, [ListenEvent.added] /* 'child_added' for js */)
list(ref, { events: [ListenEvent.added] } /* 'child_added' for js */)
.subscribe(addedChanges => { console.log(addedChanges); });

// Listen only to 'child_added' and 'child_removed' events
list(ref, [ListenEvent.added, ListenEvent.removed] /* 'child_added', 'child_removed' for js */)
list(ref, { events: [ListenEvent.added, ListenEvent.removed] } /* 'child_added', 'child_removed' for js */)
.subscribe(addedChanges => { console.log(addedChanges); });
```
Expand All @@ -100,7 +100,7 @@ The `stateChanges()` function creates an observable that emits each time a chang
| | |
|-----------------|------------------------------------------------------|
| **function** | `stateChanges()` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, events?: `ListenEvent[]` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, options:? { events?: `ListenEvent[]` } |
| **import path** | `rxfire/database` |
| **return** | `Observable<QueryChange>` |
Expand Down Expand Up @@ -137,11 +137,11 @@ stateChanges(ref).pipe(
).subscribe(data => { console.log(data); });

// Listen only to 'child_added' events
stateChanges(ref, [ListenEvent.added] /* 'child_added' for js */)
stateChanges(ref, { events: [ListenEvent.added] } /* 'child_added' for js */)
.subscribe(addedChanges => { console.log(addedChanges); });

// Listen only to 'child_added' and 'child_removed' events
stateChanges(ref, [ListenEvent.added, ListenEvent.removed] /* 'child_added', 'child_removed' for js */)
stateChanges(ref, { events: [ListenEvent.added, ListenEvent.removed] } /* 'child_added', 'child_removed' for js */)
.subscribe(addedChanges => { console.log(addedChanges); });

```
Expand All @@ -152,7 +152,7 @@ The `auditTrail()` function creates an observable that emits the entire state tr
| | |
|-----------------|------------------------------------------------------|
| **function** | `auditTrail()` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, events?: `ListenEvent[]` |
| **params** | ref: `import('firebase/database').Reference` or `import('firebase/database').Query`, options?: { events?: `ListenEvent[]` } |
| **import path** | `rxfire/database` |
| **return** | `Observable<QueryChange[]>` |
Expand Down
22 changes: 11 additions & 11 deletions docs/firestore.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The `docData()` function creates an observable that returns a stream of a docume
| | |
|-----------------|------------------------------------------|
| **function** | `docData()` |
| **params** | ref: `import('firebase/firestore').DocumentReference` <br> idField?: `string` |
| **params** | ref: `import('firebase/firestore').DocumentReference` <br> options?: { idField?: `string` } |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<T>` |

Expand All @@ -55,7 +55,7 @@ const davidDocRef = doc(db, 'users/david');
// Seed the firestore
setDoc(davidDocRef, { name: 'David' });

docData(davidDocRef,'uid').subscribe(userData => {
docData(davidDocRef, { idField: 'uid' }).subscribe(userData => {
console.log(`${userData.name} has id ${userData.uid}`);
});
```
Expand All @@ -68,7 +68,7 @@ The `collection()` function creates an observable that emits changes to the spec
| | |
|-----------------|------------------------------------------|
| **function** | `collection()` |
| **params** | query: `import('firebase/firestore').CollectionReference | import('firebase/firestore').Query` |
| **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query` |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<import('firebase/firestore').QueryDocumentSnapshot[]>` |

Expand All @@ -94,7 +94,7 @@ The `collectionData()` function creates an observable that emits a stream of doc
| | |
|-----------------|------------------------------------------|
| **function** | `collectionData()` |
| **params** | query: `import('firebase/firestore').CollectionReference | import('firebase/firestore').Query` <br> idField?: `string` |
| **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query` <br> options?: { idField?: `string` } |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<T[]>` |

Expand All @@ -109,7 +109,7 @@ const app = initializeApp({ /* config */ });
const db = getFirestore(app);
const collectionRef = collection(db, 'users');

collectionData(collectionRef, 'uid')
collectionData(collectionRef, { idField: 'uid' })
.subscribe(users => { console.log(users) });
```

Expand All @@ -119,7 +119,7 @@ The `collectionChanges()` function creates an observable that emits the changes
| | |
|-----------------|------------------------------------------|
| **function** | `collectionChanges()` |
| **params** | query: `import('firebase/firestore').CollectionReference | import('firebase/firestore').Query` <br> events?: `import('firebase/firestore').DocumentChangeType[]` |
| **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query` <br> options?: { events?: `import('firebase/firestore').DocumentChangeType[]` } |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<import('firebase/firestore').DocumentChange[]>` |

Expand All @@ -140,7 +140,7 @@ collectionChanges(collectionRef)
.subscribe(changes => { console.log(changes) });

// Listen to only 'added' events
collectionChanges(collectionRef, ['added'])
collectionChanges(collectionRef, { events: ['added'] })
.subscribe(addedEvents => { console.log(addedEvents) });
```

Expand All @@ -150,7 +150,7 @@ The `sortedChanges()` function creates an observable that emits the reduced stat
| | |
|-----------------|------------------------------------------|
| **function** | `sortedChanges()` |
| **params** | query: `import('firebase/firestore').CollectionReference | import('firebase/firestore').Query`<br> events?: `import('firebase/firestore').DocumentChangeType[]` |
| **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query` <br> options?: { events?: `import('firebase/firestore').DocumentChangeType[]` } |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<import('firebase/firestore').DocumentChange[]>` |

Expand All @@ -171,7 +171,7 @@ sortedChanges(collectionRef)
.subscribe(changes => { console.log(changes) });

// Listen to only 'added' events
docChanges(collectionRef, ['added'])
docChanges(collectionRef, { events: ['added'] })
.subscribe(addedEvents => { console.log(addedEvents) });
```

Expand All @@ -181,7 +181,7 @@ The `auditTrail()` function creates an observable that emits the entire state tr
| | |
|-----------------|------------------------------------------------------|
| **function** | `auditTrail()` |
| **params** | ref: `import('firebase/firestore').Reference | import('firebase/firestore').Query`<br> events?: `import('firebase/firestore').DocumentChangeType[]` |
| **params** | ref: `import('firebase/firestore').Reference \| import('firebase/firestore').Query` <br> options?: { events?: `import('firebase/firestore').DocumentChangeType[]` } |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<import('firebase/firestore').DocumentChange[]>` |

Expand Down Expand Up @@ -267,7 +267,7 @@ The `fromCollectionRef()` function creates an observable that emits changes to t
| | |
|-----------------|------------------------------------------|
| **function** | `fromCollectionRef()` |
| **params** | ref: `import('firebase/firestore').Reference | import('firebase/firestore').Query`<br> options?: `import('firebase/firestore').SnapshotListenOptions` |
| **params** | ref: `import('firebase/firestore').Reference \| import('firebase/firestore').Query` <br> options?: `import('firebase/firestore').SnapshotListenOptions` |
| **import path** | `rxfire/firestore` |
| **return** | `Observable<import('firebase/firestore').QuerySnapshot>` |

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"tslib": "^1.9.0 || ~2.1.0"
},
"peerDependencies": {
"firebase": "^9.0.0-0",
"firebase": "^9.0.0",
"rxjs": "^6.0.0 || ^7.0.0"
},
"devDependencies": {
Expand All @@ -97,7 +97,7 @@
"cross-fetch": "^3.1.4",
"eslint": "^7.17.0",
"eslint-config-google": "^0.14.0",
"firebase": "9.0.0-202172505352",
"firebase": "^9.0.0",
"firebase-tools": "^9.10.2",
"glob": "^7.1.6",
"jest": "^26.6.3",
Expand Down
Loading

0 comments on commit 494dfc0

Please sign in to comment.