Skip to content

Commit fc3a3fb

Browse files
authored
Merge branch 'master' into test
2 parents dc4cca8 + 712dfde commit fc3a3fb

File tree

85 files changed

+2883
-469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2883
-469
lines changed

integration/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:ci": "node ../../scripts/run_tests_in_ci.js"
99
},
1010
"dependencies": {
11-
"firebase": "7.14.6"
11+
"firebase": "7.15.1"
1212
},
1313
"devDependencies": {
1414
"@babel/core": "7.9.6",

integration/firebase-typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js"
88
},
99
"dependencies": {
10-
"firebase": "7.14.6"
10+
"firebase": "7.15.1"
1111
},
1212
"devDependencies": {
1313
"typescript": "3.8.3"

integration/firestore/gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -51,6 +51,7 @@ function copyTests() {
5151
testBase + '/integration/api/*.ts',
5252
testBase + '/integration/util/events_accumulator.ts',
5353
testBase + '/integration/util/helpers.ts',
54+
testBase + '/integration/util/settings.ts',
5455
testBase + '/util/equality_matcher.ts',
5556
testBase + '/util/promise.ts'
5657
],

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:manual": "mocha --exit"
99
},
1010
"dependencies": {
11-
"firebase": "7.14.6"
11+
"firebase": "7.15.1"
1212
},
1313
"devDependencies": {
1414
"chai": "4.2.0",

integration/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js"
88
},
99
"dependencies": {
10-
"firebase": "7.14.6"
10+
"firebase": "7.15.1"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.9.6",

integration/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:ci": "node ../../scripts/run_tests_in_ci.js"
99
},
1010
"dependencies": {
11-
"firebase": "7.14.6"
11+
"firebase": "7.15.1"
1212
},
1313
"devDependencies": {
1414
"@babel/core": "7.9.6",

packages-exp/app-exp/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
},
3434
"dependencies": {
3535
"@firebase/app-types-exp": "0.0.800",
36-
"@firebase/util": "0.2.47",
37-
"@firebase/logger": "0.2.4",
38-
"@firebase/component": "0.1.12",
39-
"tslib": "1.11.1"
36+
"@firebase/util": "0.2.48",
37+
"@firebase/logger": "0.2.5",
38+
"@firebase/component": "0.1.13",
39+
"tslib": "^1.11.1"
4040
},
4141
"license": "Apache-2.0",
4242
"devDependencies": {

packages/analytics/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/analytics",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "A analytics package for new firebase packages",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
@@ -27,11 +27,11 @@
2727
},
2828
"dependencies": {
2929
"@firebase/analytics-types": "0.3.1",
30-
"@firebase/installations": "0.4.10",
31-
"@firebase/logger": "0.2.4",
32-
"@firebase/util": "0.2.47",
33-
"@firebase/component": "0.1.12",
34-
"tslib": "1.11.1"
30+
"@firebase/installations": "0.4.11",
31+
"@firebase/logger": "0.2.5",
32+
"@firebase/util": "0.2.48",
33+
"@firebase/component": "0.1.13",
34+
"tslib": "^1.11.1"
3535
},
3636
"license": "Apache-2.0",
3737
"devDependencies": {

packages/app/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/app",
3-
"version": "0.6.4",
3+
"version": "0.6.5",
44
"description": "The primary entrypoint to the Firebase JS SDK",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -30,10 +30,10 @@
3030
"license": "Apache-2.0",
3131
"dependencies": {
3232
"@firebase/app-types": "0.6.1",
33-
"@firebase/util": "0.2.47",
34-
"@firebase/logger": "0.2.4",
35-
"@firebase/component": "0.1.12",
36-
"tslib": "1.11.1",
33+
"@firebase/util": "0.2.48",
34+
"@firebase/logger": "0.2.5",
35+
"@firebase/component": "0.1.13",
36+
"tslib": "^1.11.1",
3737
"dom-storage": "2.1.0",
3838
"xmlhttprequest": "1.8.0"
3939
},

packages/component/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/component",
3-
"version": "0.1.12",
3+
"version": "0.1.13",
44
"description": "Firebase Component Platform",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
@@ -24,8 +24,8 @@
2424
"prepare": "yarn build"
2525
},
2626
"dependencies": {
27-
"@firebase/util": "0.2.47",
28-
"tslib": "1.11.1"
27+
"@firebase/util": "0.2.48",
28+
"tslib": "^1.11.1"
2929
},
3030
"license": "Apache-2.0",
3131
"devDependencies": {

packages/database/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
- [changed] Added internal HTTP header to the WebChannel connection.
23
- [feature] Added ServerValue.increment() to support atomic field value increments
34
without transactions.
45
- [fixed] Fixed Realtime Database URL parsing bug to support domains with more than 3 components.

packages/database/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database",
3-
"version": "0.6.3",
3+
"version": "0.6.4",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -28,15 +28,15 @@
2828
"peerDependencies": {},
2929
"dependencies": {
3030
"@firebase/database-types": "0.5.1",
31-
"@firebase/logger": "0.2.4",
32-
"@firebase/util": "0.2.47",
33-
"@firebase/component": "0.1.12",
31+
"@firebase/logger": "0.2.5",
32+
"@firebase/util": "0.2.48",
33+
"@firebase/component": "0.1.13",
3434
"@firebase/auth-interop-types": "0.1.5",
3535
"faye-websocket": "0.11.3",
36-
"tslib": "1.11.1"
36+
"tslib": "^1.11.1"
3737
},
3838
"devDependencies": {
39-
"@firebase/app": "0.6.4",
39+
"@firebase/app": "0.6.5",
4040
"@firebase/app-types": "0.6.1",
4141
"rollup": "2.7.6",
4242
"rollup-plugin-typescript2": "0.27.0",

packages/database/src/core/PersistentConnection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ export class PersistentConnection extends ServerActions {
132132
/**
133133
* @implements {ServerActions}
134134
* @param repoInfo_ Data about the namespace we are connecting to
135+
* @param applicationId_ The Firebase App ID for this project
135136
* @param onDataUpdate_ A callback for new data from the server
136137
*/
137138
constructor(
138139
private repoInfo_: RepoInfo,
140+
private applicationId_: string,
139141
private onDataUpdate_: (
140142
a: string,
141143
b: unknown,
@@ -782,6 +784,7 @@ export class PersistentConnection extends ServerActions {
782784
connection = new Connection(
783785
connId,
784786
self.repoInfo_,
787+
self.applicationId_,
785788
onDataMessage,
786789
onReady,
787790
onDisconnect,

packages/database/src/core/Repo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export class Repo {
116116

117117
this.persistentConnection_ = new PersistentConnection(
118118
this.repoInfo_,
119+
app.options.appId,
119120
this.onDataUpdate_.bind(this),
120121
this.onConnectStatus_.bind(this),
121122
this.onServerInfoUpdate_.bind(this),

packages/database/src/realtime/BrowserPollConnection.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { StatsManager } from '../core/stats/StatsManager';
2828
import { PacketReceiver } from './polling/PacketReceiver';
2929
import {
30+
APPLICATION_ID_PARAM,
3031
FORGE_DOMAIN,
3132
FORGE_REF,
3233
LAST_SESSION_PARAM,
@@ -104,16 +105,18 @@ export class BrowserPollConnection implements Transport {
104105
private onDisconnect_: ((a?: boolean) => void) | null;
105106

106107
/**
107-
* @param {string} connId An identifier for this connection, used for logging
108-
* @param {RepoInfo} repoInfo The info for the endpoint to send data to.
109-
* @param {string=} transportSessionId Optional transportSessionid if we are reconnecting for an existing
108+
* @param connId An identifier for this connection, used for logging
109+
* @param repoInfo The info for the endpoint to send data to.
110+
* @param applicationId The Firebase App ID for this project.
111+
* @param transportSessionId Optional transportSessionid if we are reconnecting for an existing
110112
* transport session
111-
* @param {string=} lastSessionId Optional lastSessionId if the PersistentConnection has already created a
113+
* @param lastSessionId Optional lastSessionId if the PersistentConnection has already created a
112114
* connection previously
113115
*/
114116
constructor(
115117
public connId: string,
116118
public repoInfo: RepoInfo,
119+
private applicationId?: string,
117120
public transportSessionId?: string,
118121
public lastSessionId?: string
119122
) {
@@ -214,6 +217,9 @@ export class BrowserPollConnection implements Transport {
214217
if (this.lastSessionId) {
215218
urlParams[LAST_SESSION_PARAM] = this.lastSessionId;
216219
}
220+
if (this.applicationId) {
221+
urlParams[APPLICATION_ID_PARAM] = this.applicationId;
222+
}
217223
if (
218224
typeof location !== 'undefined' &&
219225
location.href &&

packages/database/src/realtime/Connection.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,19 @@ export class Connection {
8484
private tx_: Transport;
8585

8686
/**
87-
* @param {!string} id - an id for this connection
88-
* @param {!RepoInfo} repoInfo_ - the info for the endpoint to connect to
89-
* @param {function(Object)} onMessage_ - the callback to be triggered when a server-push message arrives
90-
* @param {function(number, string)} onReady_ - the callback to be triggered when this connection is ready to send messages.
91-
* @param {function()} onDisconnect_ - the callback to be triggered when a connection was lost
92-
* @param {function(string)} onKill_ - the callback to be triggered when this connection has permanently shut down.
93-
* @param {string=} lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server
87+
* @param id - an id for this connection
88+
* @param repoInfo_ - the info for the endpoint to connect to
89+
* @param applicationId_ - the Firebase App ID for this project
90+
* @param onMessage_ - the callback to be triggered when a server-push message arrives
91+
* @param onReady_ - the callback to be triggered when this connection is ready to send messages.
92+
* @param onDisconnect_ - the callback to be triggered when a connection was lost
93+
* @param onKill_ - the callback to be triggered when this connection has permanently shut down.
94+
* @param lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server
9495
*/
9596
constructor(
9697
public id: string,
9798
private repoInfo_: RepoInfo,
99+
private applicationId_: string | undefined,
98100
private onMessage_: (a: {}) => void,
99101
private onReady_: (a: number, b: string) => void,
100102
private onDisconnect_: () => void,
@@ -116,6 +118,7 @@ export class Connection {
116118
this.conn_ = new conn(
117119
this.nextTransportId_(),
118120
this.repoInfo_,
121+
this.applicationId_,
119122
undefined,
120123
this.lastSessionId
121124
);
@@ -409,6 +412,7 @@ export class Connection {
409412
this.secondaryConn_ = new conn(
410413
this.nextTransportId_(),
411414
this.repoInfo_,
415+
this.applicationId_,
412416
this.sessionId
413417
);
414418
// For certain transports (WebSockets), we need to send and receive several messages back and forth before we

packages/database/src/realtime/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const FORGE_DOMAIN = 'firebaseio.com';
2929

3030
export const LAST_SESSION_PARAM = 'ls';
3131

32+
export const APPLICATION_ID_PARAM = 'p';
33+
3234
export const WEBSOCKET = 'websocket';
3335

3436
export const LONG_POLLING = 'long_polling';

packages/database/src/realtime/Transport.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface TransportConstructor {
2121
new (
2222
connId: string,
2323
repoInfo: RepoInfo,
24+
applicationId?: string,
2425
transportSessionId?: string,
2526
lastSessionId?: string
2627
): Transport;
@@ -86,12 +87,3 @@ export abstract class Transport {
8687

8788
abstract markConnectionHealthy(): void;
8889
}
89-
90-
export interface TransportConstructor {
91-
new (
92-
connId: string,
93-
RepoInfo,
94-
transportSessionId?: string,
95-
lastSessionId?: string
96-
);
97-
}

packages/database/src/realtime/TransportManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { BrowserPollConnection } from './BrowserPollConnection';
1919
import { WebSocketConnection } from './WebSocketConnection';
20-
import { warn, each } from '../core/util/util';
20+
import { warn } from '../core/util/util';
2121
import { TransportConstructor } from './Transport';
2222
import { RepoInfo } from '../core/RepoInfo';
2323

packages/database/src/realtime/WebSocketConnection.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@ export class WebSocketConnection implements Transport {
7878
private isClosed_: boolean;
7979

8080
/**
81-
* @param {string} connId identifier for this transport
82-
* @param {RepoInfo} repoInfo The info for the websocket endpoint.
83-
* @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport
81+
* @param connId identifier for this transport
82+
* @param repoInfo The info for the websocket endpoint.
83+
* @param applicationId The Firebase App ID for this project.
84+
* @param transportSessionId Optional transportSessionId if this is connecting to an existing transport
8485
* session
85-
* @param {string=} lastSessionId Optional lastSessionId if there was a previous connection
86+
* @param lastSessionId Optional lastSessionId if there was a previous connection
8687
*/
8788
constructor(
8889
public connId: string,
8990
repoInfo: RepoInfo,
91+
private applicationId?: string,
9092
transportSessionId?: string,
9193
lastSessionId?: string
9294
) {
@@ -153,7 +155,8 @@ export class WebSocketConnection implements Transport {
153155
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
154156
const options: { [k: string]: object } = {
155157
headers: {
156-
'User-Agent': `Firebase/${PROTOCOL_VERSION}/${SDK_VERSION}/${process.platform}/${device}`
158+
'User-Agent': `Firebase/${PROTOCOL_VERSION}/${SDK_VERSION}/${process.platform}/${device}`,
159+
'X-Firebase-GMPID': this.applicationId || ''
157160
}
158161
};
159162

@@ -170,7 +173,12 @@ export class WebSocketConnection implements Transport {
170173

171174
this.mySock = new WebSocketImpl(this.connURL, [], options);
172175
} else {
173-
this.mySock = new WebSocketImpl(this.connURL);
176+
const options: { [k: string]: object } = {
177+
headers: {
178+
'X-Firebase-GMPID': this.applicationId || ''
179+
}
180+
};
181+
this.mySock = new WebSocketImpl(this.connURL, [], options);
174182
}
175183
} catch (e) {
176184
this.log_('Error instantiating WebSocket.');

packages/database/test/connection.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe('Connection', () => {
2424
new Connection(
2525
'1',
2626
repoInfoForConnectionTest(),
27+
'fake-app-id',
2728
message => {},
2829
(timestamp, sessionId) => {
2930
expect(sessionId).not.to.be.null;
@@ -43,11 +44,13 @@ describe('Connection', () => {
4344
new Connection(
4445
'1',
4546
info,
47+
'fake-app-id',
4648
message => {},
4749
(timestamp, sessionId) => {
4850
new Connection(
4951
'2',
5052
info,
53+
'fake-app-id',
5154
message => {},
5255
(timestamp, sessionId) => {},
5356
() => {},

0 commit comments

Comments
 (0)