Skip to content

Commit 8a081c3

Browse files
Merge branch 'master' into mrschmidt/standalonescript
2 parents 1e359b5 + 3c3c5fa commit 8a081c3

File tree

29 files changed

+175
-103
lines changed

29 files changed

+175
-103
lines changed

.changeset/blue-geese-approve.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/curvy-planets-sneeze.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/many-snails-kneel.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/proud-pigs-work.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/firestore": patch
3+
"@firebase/webchannel-wrapper": patch
4+
---
5+
6+
Fix an issue that prevented `experimentalAutoDetectLongPolling` from working correctly.

integration/firebase/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 -s test"
88
},
99
"devDependencies": {
10-
"firebase": "8.0.2",
10+
"firebase": "8.1.0",
1111
"@types/chai": "4.2.14",
1212
"@types/mocha": "7.0.2",
1313
"chai": "4.2.0",

integration/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"devDependencies": {
1717
"@firebase/app": "0.6.13",
18-
"@firebase/firestore": "2.0.2",
18+
"@firebase/firestore": "2.0.3",
1919
"@types/mocha": "7.0.2",
2020
"gulp": "4.0.2",
2121
"gulp-filter": "6.0.0",

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test:manual": "mocha --exit"
1010
},
1111
"devDependencies": {
12-
"firebase": "8.0.2",
12+
"firebase": "8.1.0",
1313
"chai": "4.2.0",
1414
"chromedriver": "86.0.0",
1515
"express": "4.17.1",

packages-exp/firebase-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@firebase/app-compat": "0.0.900",
4242
"@firebase/auth-exp": "0.0.900",
4343
"@firebase/functions-exp": "0.0.900",
44-
"@firebase/firestore": "2.0.2",
44+
"@firebase/firestore": "2.0.3",
4545
"@firebase/performance-exp": "0.0.900",
4646
"@firebase/remote-config-exp": "0.0.900"
4747
},

packages/database/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Unreleased
22

3+
## 0.8.0
4+
5+
### Minor Changes
6+
7+
- [`34973cde2`](https://github.com/firebase/firebase-js-sdk/commit/34973cde218e570baccd235d5bb6c6146559f80b) [#3812](https://github.com/firebase/firebase-js-sdk/pull/3812) - Add a `get` method for database queries that returns server result when connected
8+
39
## 0.7.1
410

511
### Patch Changes

packages/database/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database",
3-
"version": "0.7.1",
3+
"version": "0.8.0",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",

packages/firebase/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# firebase
22

3+
## 8.1.0
4+
5+
### Minor Changes
6+
7+
- [`34973cde2`](https://github.com/firebase/firebase-js-sdk/commit/34973cde218e570baccd235d5bb6c6146559f80b) [#3812](https://github.com/firebase/firebase-js-sdk/pull/3812) - Add a `get` method for database queries that returns server result when connected
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [[`6c6c49ad6`](https://github.com/firebase/firebase-js-sdk/commit/6c6c49ad6b3c3d66e9ecb8397c4ac39bea256e80), [`e0bf3f70b`](https://github.com/firebase/firebase-js-sdk/commit/e0bf3f70bf82f3587e60ab4484fe37d01cea0051), [`34973cde2`](https://github.com/firebase/firebase-js-sdk/commit/34973cde218e570baccd235d5bb6c6146559f80b)]:
12+
- @firebase/firestore@2.0.3
13+
- @firebase/database@0.8.0
14+
315
## 8.0.2
416

517
### Patch Changes

packages/firebase/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase",
3-
"version": "8.0.2",
3+
"version": "8.1.0",
44
"description": "Firebase JavaScript library for web and Node.js",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",
@@ -48,8 +48,8 @@
4848
"@firebase/app": "0.6.13",
4949
"@firebase/app-types": "0.6.1",
5050
"@firebase/auth": "0.15.2",
51-
"@firebase/database": "0.7.1",
52-
"@firebase/firestore": "2.0.2",
51+
"@firebase/database": "0.8.0",
52+
"@firebase/firestore": "2.0.3",
5353
"@firebase/functions": "0.6.1",
5454
"@firebase/installations": "0.4.19",
5555
"@firebase/messaging": "0.7.3",

packages/firestore/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @firebase/firestore
22

3+
## 2.0.3
4+
5+
### Patch Changes
6+
7+
- [`6c6c49ad6`](https://github.com/firebase/firebase-js-sdk/commit/6c6c49ad6b3c3d66e9ecb8397c4ac39bea256e80) [#4053](https://github.com/firebase/firebase-js-sdk/pull/4053) - Internal changes for the upcoming modular API.
8+
9+
* [`e0bf3f70b`](https://github.com/firebase/firebase-js-sdk/commit/e0bf3f70bf82f3587e60ab4484fe37d01cea0051) [#4080](https://github.com/firebase/firebase-js-sdk/pull/4080) (fixes [#4071](https://github.com/firebase/firebase-js-sdk/issues/4071)) - Fixes a regression introduced in v8.0.2 that returned invalid values for `DocumentChange.newIndex`.
10+
311
## 2.0.2
412

513
### Patch Changes

packages/firestore/lite/src/api/bytes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Bytes {
4040
} catch (e) {
4141
throw new FirestoreError(
4242
Code.INVALID_ARGUMENT,
43-
'Failed to construct Bytes from Base64 string: ' + e
43+
'Failed to construct data from Base64 string: ' + e
4444
);
4545
}
4646
}

packages/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/firestore",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"engines": {
55
"node": "^8.13.0 || >=10.10.0"
66
},

packages/firestore/src/api/blob.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import { isBase64Available } from '../platform/base64';
1919
import { Code, FirestoreError } from '../util/error';
20-
import { ByteString } from '../util/byte_string';
2120
import { Bytes } from '../../lite/src/api/bytes';
21+
import { Compat } from '../compat/compat';
2222

2323
/** Helper function to assert Uint8Array is available at runtime. */
2424
function assertUint8ArrayAvailable(): void {
@@ -40,42 +40,30 @@ function assertBase64Available(): void {
4040
}
4141
}
4242

43-
/**
44-
* Immutable class holding a blob (binary data).
45-
*
46-
* This class is directly exposed in the public API. It extends the Bytes class
47-
* of the firestore-exp API to support `instanceof Bytes` checks during user
48-
* data conversion.
49-
*
50-
* Note that while you can't hide the constructor in JavaScript code, we are
51-
* using the hack above to make sure no-one outside this module can call it.
52-
*/
53-
export class Blob extends Bytes {
43+
/** Immutable class holding a blob (binary data) */
44+
export class Blob extends Compat<Bytes> {
5445
static fromBase64String(base64: string): Blob {
5546
assertBase64Available();
56-
try {
57-
return new Blob(ByteString.fromBase64String(base64));
58-
} catch (e) {
59-
throw new FirestoreError(
60-
Code.INVALID_ARGUMENT,
61-
'Failed to construct Blob from Base64 string: ' + e
62-
);
63-
}
47+
return new Blob(Bytes.fromBase64String(base64));
6448
}
6549

6650
static fromUint8Array(array: Uint8Array): Blob {
6751
assertUint8ArrayAvailable();
68-
return new Blob(ByteString.fromUint8Array(array));
52+
return new Blob(Bytes.fromUint8Array(array));
6953
}
7054

7155
toBase64(): string {
7256
assertBase64Available();
73-
return super.toBase64();
57+
return this._delegate.toBase64();
7458
}
7559

7660
toUint8Array(): Uint8Array {
7761
assertUint8ArrayAvailable();
78-
return super.toUint8Array();
62+
return this._delegate.toUint8Array();
63+
}
64+
65+
isEqual(other: Blob): boolean {
66+
return this._delegate.isEqual(other._delegate);
7967
}
8068

8169
toString(): string {

packages/firestore/src/api/user_data_writer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { isValidResourceName } from '../remote/serializer';
4646
import { logError } from '../util/log';
4747
import { ByteString } from '../util/byte_string';
4848
import { Blob } from './blob';
49+
import { Bytes } from '../../lite/src/api/bytes';
4950
import { DocumentReference, Firestore } from './database';
5051

5152
export type ServerTimestampBehavior = 'estimate' | 'previous' | 'none';
@@ -174,7 +175,7 @@ export class UserDataWriter extends AbstractUserDataWriter {
174175
}
175176

176177
protected convertBytes(bytes: ByteString): Blob {
177-
return new Blob(bytes);
178+
return new Blob(new Bytes(bytes));
178179
}
179180

180181
protected convertReference(name: string): DocumentReference {

packages/firestore/src/platform/browser/webchannel_connection.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ import {
2222
WebChannel,
2323
WebChannelError,
2424
WebChannelOptions,
25-
XhrIo
25+
XhrIo,
26+
getStatEventTarget,
27+
EventTarget,
28+
StatEvent,
29+
Event,
30+
Stat
2631
} from '@firebase/webchannel-wrapper';
2732

2833
import {
@@ -164,6 +169,7 @@ export class WebChannelConnection extends RestConnection {
164169
'/channel'
165170
];
166171
const webchannelTransport = createWebChannelTransport();
172+
const requestStats = getStatEventTarget();
167173
const request: WebChannelOptions = {
168174
// Required for backend stickiness, routing behavior is based on this
169175
// parameter.
@@ -257,12 +263,13 @@ export class WebChannelConnection extends RestConnection {
257263
// Note that eventually this function could go away if we are confident
258264
// enough the code is exception free.
259265
const unguardedEventListen = <T>(
260-
type: string,
261-
fn: (param?: T) => void
266+
target: EventTarget,
267+
type: string | number,
268+
fn: (param: T) => void
262269
): void => {
263270
// TODO(dimond): closure typing seems broken because WebChannel does
264271
// not implement goog.events.Listenable
265-
channel.listen(type, (param: unknown) => {
272+
target.listen(type, (param: unknown) => {
266273
try {
267274
fn(param as T);
268275
} catch (e) {
@@ -273,21 +280,21 @@ export class WebChannelConnection extends RestConnection {
273280
});
274281
};
275282

276-
unguardedEventListen(WebChannel.EventType.OPEN, () => {
283+
unguardedEventListen(channel, WebChannel.EventType.OPEN, () => {
277284
if (!closed) {
278285
logDebug(LOG_TAG, 'WebChannel transport opened.');
279286
}
280287
});
281288

282-
unguardedEventListen(WebChannel.EventType.CLOSE, () => {
289+
unguardedEventListen(channel, WebChannel.EventType.CLOSE, () => {
283290
if (!closed) {
284291
closed = true;
285292
logDebug(LOG_TAG, 'WebChannel transport closed');
286293
streamBridge.callOnClose();
287294
}
288295
});
289296

290-
unguardedEventListen<Error>(WebChannel.EventType.ERROR, err => {
297+
unguardedEventListen<Error>(channel, WebChannel.EventType.ERROR, err => {
291298
if (!closed) {
292299
closed = true;
293300
logWarn(LOG_TAG, 'WebChannel transport errored:', err);
@@ -308,10 +315,11 @@ export class WebChannelConnection extends RestConnection {
308315
}
309316

310317
unguardedEventListen<WebChannelResponse>(
318+
channel,
311319
WebChannel.EventType.MESSAGE,
312320
msg => {
313321
if (!closed) {
314-
const msgData = msg!.data[0];
322+
const msgData = msg.data[0];
315323
hardAssert(!!msgData, 'Got a webchannel message without data.');
316324
// TODO(b/35143891): There is a bug in One Platform that caused errors
317325
// (and only errors) to be wrapped in an extra array. To be forward
@@ -348,6 +356,14 @@ export class WebChannelConnection extends RestConnection {
348356
}
349357
);
350358

359+
unguardedEventListen<StatEvent>(requestStats, Event.STAT_EVENT, event => {
360+
if (event.stat === Stat.PROXY) {
361+
logDebug(LOG_TAG, 'Detected buffering proxy');
362+
} else if (event.stat === Stat.NOPROXY) {
363+
logDebug(LOG_TAG, 'Detected no buffering proxy');
364+
}
365+
});
366+
351367
setTimeout(() => {
352368
// Technically we could/should wait for the WebChannel opened event,
353369
// but because we want to send the first message with the WebChannel

packages/firestore/src/platform/node_lite/serializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
* limitations under the License.
1616
*/
1717

18-
export * from '../node/serializer';
18+
export * from '../browser_lite/serializer';

packages/firestore/test/unit/api/blob.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Blob', () => {
4848

4949
it('Blob throws on invalid Base64 strings', () => {
5050
expect(() => Blob.fromBase64String('not-base64!')).to.throw(
51-
/Failed to construct Blob from Base64 string:/
51+
/Failed to construct data from Base64 string:/
5252
);
5353
});
5454

packages/rules-unit-testing/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @firebase/rules-unit-testing
22

3+
## 1.1.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`34973cde2`](https://github.com/firebase/firebase-js-sdk/commit/34973cde218e570baccd235d5bb6c6146559f80b)]:
8+
9+
310
## 1.1.1
411

512
### Patch Changes

packages/rules-unit-testing/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/rules-unit-testing",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
@@ -19,7 +19,7 @@
1919
},
2020
"license": "Apache-2.0",
2121
"dependencies": {
22-
"firebase": "8.0.2",
22+
"firebase": "8.1.0",
2323
"@firebase/logger": "0.2.6",
2424
"@firebase/util": "0.3.4",
2525
"request": "2.88.2"

packages/rxfire/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"rxjs": "6.x.x"
4141
},
4242
"devDependencies": {
43-
"firebase": "8.0.2",
43+
"firebase": "8.1.0",
4444
"rollup": "2.33.2",
4545
"@rollup/plugin-commonjs": "15.1.0",
4646
"@rollup/plugin-node-resolve": "9.0.0",

packages/webchannel-wrapper/externs/overrides.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,16 @@ goog.net.WebChannel.Options.internalChannelParams;
6464

6565
/** @type {boolean|undefined} */
6666
goog.net.WebChannel.Options.forceLongPolling;
67+
68+
/** @type {boolean|undefined} */
69+
goog.net.WebChannel.Options.detectBufferingProxy;
70+
71+
goog.labs.net.webChannel.requestStats.Event = {};
72+
goog.labs.net.webChannel.requestStats.Event.STAT_EVENT;
73+
74+
goog.labs.net.webChannel.requestStats.StatEvent = {};
75+
goog.labs.net.webChannel.requestStats.StatEvent.stat;
76+
77+
goog.labs.net.webChannel.requestStats.Stat = {};
78+
goog.labs.net.webChannel.requestStats.Stat.PROXY;
79+
goog.labs.net.webChannel.requestStats.Stat.NOPROXY;

0 commit comments

Comments
 (0)