Skip to content

Commit d75baad

Browse files
author
Robert-Jan Huijsman
committed
Remove the obsolete fields 'messageId' and 'publishTime' from the PubsubMessage class.
The contents of these fields have moved to the Event envelope, as 'eventId' and 'timestamp', while the fields in PubsubMessage will always be empty. To avoid confusion, we remove the fields entirely.
1 parent 121f3e9 commit d75baad

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/builders/pubsub-builder.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import { FirebaseEnv } from '../env';
55
export class PubsubMessage {
66
data: string;
77
attributes: { [key: string]: string };
8-
publishTime: string;
9-
messageId: string;
108
private _json: any;
119

1210
constructor(data: any) {
13-
[this.data, this.attributes, this.publishTime, this.messageId, this._json] =
14-
[data.data, data.attributes || {}, data.publishTime || null, data.messageId || null, data.json];
11+
[this.data, this.attributes, this._json] =
12+
[data.data, data.attributes || {}, data.json];
1513
}
1614

1715
get json(): any {
@@ -28,8 +26,6 @@ export class PubsubMessage {
2826
return {
2927
data: this.data,
3028
attributes: this.attributes,
31-
publishTime: this.publishTime,
32-
messageId: this.messageId,
3329
};
3430
}
3531
}

test/builders/pubsub-builder.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@ describe('PubsubMessage', () => {
2626
describe('#toJSON', () => {
2727
it('should be JSON stringify-able', () => {
2828
let encoded = new Buffer('{"hello":"world"}', 'utf8').toString('base64');
29-
let publishTime = new Date().toISOString();
3029
let message = new PubsubMessage({
3130
data: encoded,
32-
messageId: 'abc',
33-
publishTime,
3431
});
3532

3633
expect(JSON.parse(JSON.stringify(message))).to.deep.equal({
3734
data: encoded,
3835
attributes: {},
39-
messageId: 'abc',
40-
publishTime,
4136
});
4237
});
4338
});

0 commit comments

Comments
 (0)