Skip to content

Commit 4b8724a

Browse files
committed
Migrate to v5.13.0 firebase-admin & new Firestore timestamp format (#207)
1 parent 1f04643 commit 4b8724a

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@types/sinon": "^1.16.29",
4141
"chai": "^3.5.0",
4242
"chai-as-promised": "^5.2.0",
43-
"firebase-admin": "~5.12.1",
43+
"firebase-admin": "~5.13.0",
4444
"istanbul": "^0.4.2",
4545
"mocha": "^2.4.5",
4646
"mock-require": "^2.0.1",
@@ -50,7 +50,7 @@
5050
"typescript": "~2.8.3"
5151
},
5252
"peerDependencies": {
53-
"firebase-admin": "~5.12.1"
53+
"firebase-admin": "~5.13.0"
5454
},
5555
"dependencies": {
5656
"@types/cors": "^2.8.1",

spec/providers/firestore.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,18 @@ describe('Firestore Functions', () => {
500500
});
501501

502502
it('should support #createTime', () => {
503-
expect(Date.parse(snapshot.createTime)).to.equal(
504-
Date.parse('2017-06-17T14:45:17.876479Z')
505-
);
503+
expect(snapshot.createTime.seconds).to.be.a('number');
504+
expect(snapshot.createTime.nanoseconds).to.be.a('number');
506505
});
507506

508507
it('should support #updateTime', () => {
509-
expect(Date.parse(snapshot.updateTime)).to.equal(
510-
Date.parse('2017-08-31T18:05:26.928527Z')
511-
);
508+
expect(snapshot.updateTime.seconds).to.be.a('number');
509+
expect(snapshot.updateTime.nanoseconds).to.be.a('number');
512510
});
513511

514512
it('should support #readTime', () => {
515-
expect(Date.parse(snapshot.readTime)).to.equal(
516-
Date.parse('2017-07-31T18:23:26.928527Z')
517-
);
513+
expect(snapshot.readTime.seconds).to.be.a('number');
514+
expect(snapshot.readTime.nanoseconds).to.be.a('number');
518515
});
519516
});
520517

src/providers/firestore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function _getValueProto(data: any, resource: string, valueFieldName: string) {
145145
export function snapshotConstructor(event: Event): DocumentSnapshot {
146146
if (!firestoreInstance) {
147147
firestoreInstance = firebase.firestore(apps().admin);
148+
firestoreInstance.settings({ timestampsInSnapshots: true });
148149
}
149150
let valueProto = _getValueProto(
150151
event.data,

src/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function onRequest(
4545
*/
4646
export function onCall(
4747
handler: (data: any, context: CallableContext) => any | Promise<any>
48-
) {
48+
): HttpsFunction & Runnable<any> {
4949
return _onCallWithOpts(handler, {});
5050
}
5151

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"lib": ["es6"],
44
"module": "commonjs",
5-
"noImplicitAny": true,
5+
"noImplicitAny": false,
66
"outDir": ".tmp",
77
"sourceMap": true,
88
"target": "es6",

0 commit comments

Comments
 (0)