Skip to content

Commit

Permalink
refactor: use geofirestore-core
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSolati committed Jun 22, 2020
1 parent a31b11c commit 4fa8603
Show file tree
Hide file tree
Showing 26 changed files with 469 additions and 2,750 deletions.
738 changes: 324 additions & 414 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
"postinstall.js",
"README.md"
],
"dependencies": {
"geofirestore-core": "^4.0.0"
},
"optionalDependencies": {
"@google-cloud/firestore": ">= 2.0.0",
"@types/node": ">= 8.0.0",
"firebase": ">= 6.0.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^8.0.1",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
Expand All @@ -66,6 +68,7 @@
"coveralls": "^3.1.0",
"firebase-tools": "^8.4.2",
"generate-changelog": "^1.8.0",
"geokit": "^1.1.0",
"gts": "^2.0.2",
"jsdom": "^16.2.2",
"jsdom-global": "^3.0.2",
Expand Down
23 changes: 9 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import {terser} from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
Expand All @@ -11,17 +10,13 @@ const onwarn = (warning, rollupWarn) => {
}
};

const plugins = [
typescript({
tsconfigOverride: {
compilerOptions: {
module: 'ESNext',
},
const ts = typescript({
tsconfigOverride: {
compilerOptions: {
module: 'ESNext',
},
}),
resolve(),
commonjs(),
];
},
});

export default [
{
Expand All @@ -36,8 +31,8 @@ export default [
format: 'es',
},
],
external: ['@types/node'],
plugins,
external: ['@types/node', 'geofirestore-core'],
plugins: [ts],
onwarn,
},
{
Expand All @@ -49,7 +44,7 @@ export default [
extend: true,
},
external: ['@types/node'],
plugins: [...plugins, terser()],
plugins: [ts, resolve(), terser()],
onwarn,
},
];
6 changes: 3 additions & 3 deletions src/GeoCollectionReference.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {GeoFirestoreTypes} from './GeoFirestoreTypes';
import {GeoFirestoreTypes, encodeDocumentAdd} from 'geofirestore-core';

import {GeoDocumentReference} from './GeoDocumentReference';
import {GeoQuery} from './GeoQuery';
import {encodeAddDocument} from './utils';

/**
* A `GeoCollectionReference` object can be used for adding documents, getting document references, and querying for documents (using the
Expand Down Expand Up @@ -61,7 +61,7 @@ export class GeoCollectionReference extends GeoQuery {
customKey?: string
): Promise<GeoDocumentReference> {
return (this._collection as GeoFirestoreTypes.cloud.CollectionReference)
.add(encodeAddDocument(documentData, customKey))
.add(encodeDocumentAdd(documentData, customKey))
.then(doc => new GeoDocumentReference(doc));
}

Expand Down
15 changes: 8 additions & 7 deletions src/GeoDocumentReference.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {GeoFirestoreTypes} from './GeoFirestoreTypes';
import {
encodeSetDocument,
encodeUpdateDocument,
sanitizeSetOptions,
} from './utils';
GeoFirestoreTypes,
encodeDocumentSet,
encodeDocumentUpdate,
} from 'geofirestore-core';

import {sanitizeSetOptions} from './utils';
import {GeoCollectionReference} from './GeoCollectionReference';
import {GeoDocumentSnapshot} from './GeoDocumentSnapshot';
import {GeoFirestore} from './GeoFirestore';
Expand Down Expand Up @@ -165,7 +166,7 @@ export class GeoDocumentReference {
): Promise<void> {
return (this._document as GeoFirestoreTypes.web.DocumentReference)
.set(
encodeSetDocument(documentData, options),
encodeDocumentSet(documentData, options),
sanitizeSetOptions(options)
)
.then(() => null);
Expand All @@ -185,7 +186,7 @@ export class GeoDocumentReference {
customKey?: string
): Promise<void> {
return (this._document as GeoFirestoreTypes.web.DocumentReference)
.update(encodeUpdateDocument(data, customKey))
.update(encodeDocumentUpdate(data, customKey))
.then(() => null);
}
}
3 changes: 2 additions & 1 deletion src/GeoDocumentSnapshot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {GeoFirestoreTypes} from './GeoFirestoreTypes';
import {GeoFirestoreTypes} from 'geofirestore-core';

import {GeoDocumentReference} from './GeoDocumentReference';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GeoFirestore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {GeoFirestoreTypes} from './GeoFirestoreTypes';
import {GeoFirestoreTypes} from 'geofirestore-core';

import {GeoCollectionReference} from './GeoCollectionReference';
import {GeoWriteBatch} from './GeoWriteBatch';

Expand Down
80 changes: 0 additions & 80 deletions src/GeoFirestoreTypes.ts

This file was deleted.

76 changes: 0 additions & 76 deletions src/GeoJoinerGet.ts

This file was deleted.

Loading

0 comments on commit 4fa8603

Please sign in to comment.