Skip to content

Commit 19c55d3

Browse files
committed
update: v0.0.2 fixes
1 parent e262afe commit 19c55d3

5 files changed

Lines changed: 18 additions & 24 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ const collection = geo.collection('cities', ref => ref.where('zip', '==', 90201)
7171

7272
#### Performing Geo-Queries
7373

74-
`collection.within(center: _GeoFirePoint_, radius: _`number`_, field: _`string`_, opts?: GeoQueryOptions):`Observable`<`object`[]>`
74+
`collection.within(center: GeoFirePoint, radius: number, field: string)`
7575

76-
Query by geographic distance. `within` queries parent Firestore collection for documents that exist within X kilometers of the centerpoint.
76+
Query the parent Firestore collection by geographic distance. It will return documents that exist within X kilometers of the centerpoint.
7777

78-
Each doc also contains returns distance and bearing calculated on the query on the `queryMetadata` property.
78+
Each doc also contains returns _distance_ and _bearing_ calculated on the query on the `queryMetadata` property.
7979

80-
**Returns:** `Observable`<`object`[]>
80+
**Returns:** `Observable<object[]>`
8181

8282
#### Write Data
8383

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "geofirex",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Realtime Firestore GeoQueries with RxJS",
55
"main": "dist/index.node.cjs.js",
66
"module": "dist/index.esm.js",

rollup.config.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ const external = ['firebase/app']
1414

1515
export default {
1616
input: './src/index.ts',
17-
// output: {
18-
// file: 'dist/bundle.js',
19-
// format: 'umd',
20-
// sourcemap: true,
21-
// extend: true,
22-
// name: 'gfx',
23-
// external: ['firebase']
24-
// },
2517
output: [{
2618
file: pkg.main,
2719
format: 'cjs',
@@ -41,7 +33,6 @@ export default {
4133
}),
4234
resolve(),
4335
cjs(),
44-
sizes(),
45-
uglify()
36+
sizes()
4637
]
4738
};

src/collection.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { firestore } from './interfaces';
22

33
import { Observable, combineLatest } from 'rxjs';
4-
import { shareReplay, map, first, distinct } from 'rxjs/operators';
4+
import { shareReplay, map, first } from 'rxjs/operators';
55
import { GeoFirePoint, Latitude, Longitude } from './geohash';
66
import { setPrecsion } from './util';
77
import { FeatureCollection, Geometry } from 'geojson';
8-
// import isEqual from 'lodash.isequal';
98

109
export type QueryFn = (ref: firestore.CollectionReference) => firestore.Query;
1110

@@ -97,6 +96,10 @@ export class GeoFireCollectionRef {
9796
this.stream = createStream(this.query || this.ref).pipe(shareReplay(1));
9897
}
9998

99+
obsv() {
100+
return new Observable();
101+
}
102+
100103
// GEO QUERIES
101104
/**
102105
* Queries the Firestore collection based on geograpic radius
@@ -118,13 +121,10 @@ export class GeoFireCollectionRef {
118121

119122
const queries = area.map(hash => {
120123
const query = this.queryPoint(hash, field);
121-
return createStream(query).pipe(
122-
snapToData()
123-
// distinct(isEqual)
124-
);
124+
return createStream(query).pipe(snapToData());
125125
});
126126

127-
return combineLatest(...queries).pipe(
127+
const combo = combineLatest(...queries).pipe(
128128
map(arr => {
129129
const reduced = arr.reduce((acc, cur) => acc.concat(cur));
130130
return reduced
@@ -146,6 +146,8 @@ export class GeoFireCollectionRef {
146146
}),
147147
shareReplay(1)
148148
);
149+
150+
return combo;
149151
}
150152

151153
private queryPoint(geohash: string, field: string) {

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
"importHelpers": true,
66
"outDir": "dist",
77
"lib": ["es2015", "dom"],
8-
"module": "es2015",
98
"moduleResolution": "node",
109
"noImplicitAny": false,
1110
"sourceMap": true,
12-
"target": "es2017",
11+
"experimentalDecorators": true,
12+
"module": "es2015",
13+
"target": "es5",
1314
"typeRoots": ["../node_modules/@types"]
1415
},
1516
"include": ["src"],

0 commit comments

Comments
 (0)