From 611b8152818d753cdbb9b628543f5c3eef732346 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 08:53:23 -0700 Subject: [PATCH 01/12] Fixed issue where webSocketOnly was incorrectly set to nodeAdmin --- packages/database/src/core/util/libs/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/database/src/core/util/libs/parser.ts b/packages/database/src/core/util/libs/parser.ts index 92be50daa2f..61fcef35979 100644 --- a/packages/database/src/core/util/libs/parser.ts +++ b/packages/database/src/core/util/libs/parser.ts @@ -92,8 +92,8 @@ export const parseRepoInfo = function ( parsedUrl.host, parsedUrl.secure, namespace, - nodeAdmin, webSocketOnly, + nodeAdmin, /*persistenceKey=*/ '', /*includeNamespaceInQueryParams=*/ namespace !== parsedUrl.subdomain ), From c15a4cf53f200108bce5e9b3cde76fd449d68632 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 09:52:04 -0700 Subject: [PATCH 02/12] Removed link to non-existent section --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b4e6fb104e..8684de9a07e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,7 +77,7 @@ Before you start working on a larger contribution, you should get in touch with * Create your patch, **including appropriate test cases**. Patches with tests are more likely to be merged. * Avoid checking in files that shouldn't be tracked (e.g `node_modules`, `gulp-cache`, `.tmp`, `.idea`). If your development setup automatically creates some of these files, please add them to the `.gitignore` at the root of the package (click [here][gitignore] to read more on how to add entries to the `.gitignore`). -* Commit your changes using a commit message that follows our [commit message guidelines](#commit-message-guidelines). +* Commit your changes ```shell git commit -a From c3265b171e89eba6fbed3558b7498ebb8f44edca Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 13:36:53 -0700 Subject: [PATCH 03/12] Create twenty-shoes-cheer.md --- .changeset/twenty-shoes-cheer.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/twenty-shoes-cheer.md diff --git a/.changeset/twenty-shoes-cheer.md b/.changeset/twenty-shoes-cheer.md new file mode 100644 index 00000000000..4d329ed6933 --- /dev/null +++ b/.changeset/twenty-shoes-cheer.md @@ -0,0 +1,5 @@ +--- +"@firebase/database": patch +--- + +Fix websocketonly field to be set to true when using websocket db url. From 111921e0bdbda043f8ef83c5cbb21ee298ea307c Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 14:01:23 -0700 Subject: [PATCH 04/12] Added test for websocketonly --- packages/database/test/parser.test.ts | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/database/test/parser.test.ts diff --git a/packages/database/test/parser.test.ts b/packages/database/test/parser.test.ts new file mode 100644 index 00000000000..90b1e1804c8 --- /dev/null +++ b/packages/database/test/parser.test.ts @@ -0,0 +1,31 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { expect } from "chai"; + +import { parseRepoInfo } from "../src/core/util/libs/parser"; + +describe('parser', () => { + it('should set websocketUrl correctly based on the protocol', () => { + const httpsRepoInfo = parseRepoInfo('https://test-ns.firebaseio.com', false); + expect(httpsRepoInfo.repoInfo.webSocketOnly).to.equal(false); + const wssRepoInfo = parseRepoInfo('wss://test-ns.firebaseio.com', false); + expect(wssRepoInfo.repoInfo.webSocketOnly).to.equal(true); + const wsRepoInfo = parseRepoInfo('ws://test-ns.firebaseio.com', false); + expect(wsRepoInfo.repoInfo.webSocketOnly).to.equal(true); + }); +}); \ No newline at end of file From b90fec218574000b497959780d17592047ff90cc Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 14:02:50 -0700 Subject: [PATCH 05/12] Added EOL --- packages/database/test/parser.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/database/test/parser.test.ts b/packages/database/test/parser.test.ts index 90b1e1804c8..d18049409c2 100644 --- a/packages/database/test/parser.test.ts +++ b/packages/database/test/parser.test.ts @@ -28,4 +28,4 @@ describe('parser', () => { const wsRepoInfo = parseRepoInfo('ws://test-ns.firebaseio.com', false); expect(wsRepoInfo.repoInfo.webSocketOnly).to.equal(true); }); -}); \ No newline at end of file +}); From 78c9ba2691a6c4420e54462a86ea737bb19d84b9 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 15:02:55 -0700 Subject: [PATCH 06/12] Updated formatting --- packages/database/test/parser.test.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/database/test/parser.test.ts b/packages/database/test/parser.test.ts index d18049409c2..57b165684db 100644 --- a/packages/database/test/parser.test.ts +++ b/packages/database/test/parser.test.ts @@ -15,17 +15,20 @@ * limitations under the License. */ -import { expect } from "chai"; +import { expect } from 'chai'; -import { parseRepoInfo } from "../src/core/util/libs/parser"; +import { parseRepoInfo } from '../src/core/util/libs/parser'; describe('parser', () => { - it('should set websocketUrl correctly based on the protocol', () => { - const httpsRepoInfo = parseRepoInfo('https://test-ns.firebaseio.com', false); - expect(httpsRepoInfo.repoInfo.webSocketOnly).to.equal(false); - const wssRepoInfo = parseRepoInfo('wss://test-ns.firebaseio.com', false); - expect(wssRepoInfo.repoInfo.webSocketOnly).to.equal(true); - const wsRepoInfo = parseRepoInfo('ws://test-ns.firebaseio.com', false); - expect(wsRepoInfo.repoInfo.webSocketOnly).to.equal(true); - }); + it('should set websocketUrl correctly based on the protocol', () => { + const httpsRepoInfo = parseRepoInfo( + 'https://test-ns.firebaseio.com', + false + ); + expect(httpsRepoInfo.repoInfo.webSocketOnly).to.equal(false); + const wssRepoInfo = parseRepoInfo('wss://test-ns.firebaseio.com', false); + expect(wssRepoInfo.repoInfo.webSocketOnly).to.equal(true); + const wsRepoInfo = parseRepoInfo('ws://test-ns.firebaseio.com', false); + expect(wsRepoInfo.repoInfo.webSocketOnly).to.equal(true); + }); }); From 832bc4e74a31f9cbaf5c3343f086642decd222b0 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 15:09:20 -0700 Subject: [PATCH 07/12] Updated changeset --- .changeset/twenty-shoes-cheer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-shoes-cheer.md b/.changeset/twenty-shoes-cheer.md index 4d329ed6933..44ce1a7ae1e 100644 --- a/.changeset/twenty-shoes-cheer.md +++ b/.changeset/twenty-shoes-cheer.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fix websocketonly field to be set to true when using websocket db url. +Fix websocketonly field to be set to true when using databaseURL (when using `wss` or `ws` in the RTDB URLs, webSocketOnly will be true and longPolling will be disabled) From a1aba2b162a301f63f6c0faff42ee49decadf501 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 15:19:14 -0700 Subject: [PATCH 08/12] Updated README to include linking instructions --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 3e04371b1d4..f9810c99638 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,20 @@ implementation. The SDK is built via a combination of all of these packages which are published under the [`firebase` scope](https://www.npmjs.com/search?q=scope%3Afirebase) on NPM. +### Testing the SDK Locally + +Please be sure to build your repo before proceeding any further. +In order to manually test your SDK changes locally, you must use [yarn link](https://classic.yarnpkg.com/en/docs/cli/link): + +```shell +$ cd packages/firebase +$ yarn link # initialize the linking to the other folder +$ cd ../ # cd into your personal project directory +$ yarn link firebase # tell yarn to use the locally built firebase SDK instead +``` + +This will create a symlink and point your `` to the locally built version of the firebase SDK. + ### Helper Scripts Each package in the `packages` directory exposes a `dev` script. This script From a37b4226de379005ee6e40b5459bb588f5fe28de Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 15:20:55 -0700 Subject: [PATCH 09/12] Fixed some wording --- .changeset/twenty-shoes-cheer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-shoes-cheer.md b/.changeset/twenty-shoes-cheer.md index 44ce1a7ae1e..98d5bb7dcf7 100644 --- a/.changeset/twenty-shoes-cheer.md +++ b/.changeset/twenty-shoes-cheer.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fix websocketonly field to be set to true when using databaseURL (when using `wss` or `ws` in the RTDB URLs, webSocketOnly will be true and longPolling will be disabled) +Fix websocketonly field to be set to true when using the websocket protocol (when using `wss` or `ws` in the RTDB URL, webSocketOnly will be true and longPolling will be disabled) From 634973877b0cd20c32856e1ec2a1304640d13c00 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Wed, 6 Apr 2022 15:21:52 -0700 Subject: [PATCH 10/12] Further cleared up some wording --- .changeset/twenty-shoes-cheer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-shoes-cheer.md b/.changeset/twenty-shoes-cheer.md index 98d5bb7dcf7..f8f85ceb1ce 100644 --- a/.changeset/twenty-shoes-cheer.md +++ b/.changeset/twenty-shoes-cheer.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fix websocketonly field to be set to true when using the websocket protocol (when using `wss` or `ws` in the RTDB URL, webSocketOnly will be true and longPolling will be disabled) +Fix `webSocketOnly` field to be set to true in `RepoInfo` when using the websocket protocol in the databaseURL in firebase configuration (when using `wss` or `ws` in the RTDB URL, webSocketOnly will be true and longPolling will be disabled) From 0d6232934e552cf6eb4499f494a4f482f3f00d17 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Thu, 7 Apr 2022 11:17:56 -0700 Subject: [PATCH 11/12] Cleared up wording for changeset --- .changeset/twenty-shoes-cheer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-shoes-cheer.md b/.changeset/twenty-shoes-cheer.md index f8f85ceb1ce..5b2f43d20f4 100644 --- a/.changeset/twenty-shoes-cheer.md +++ b/.changeset/twenty-shoes-cheer.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fix `webSocketOnly` field to be set to true in `RepoInfo` when using the websocket protocol in the databaseURL in firebase configuration (when using `wss` or `ws` in the RTDB URL, webSocketOnly will be true and longPolling will be disabled) +Fix issue where if a websocket protocol was used in the databaseURL, `webSocketOnly` field was incorrectly set to undefined. (When using `wss` or `ws` protocols in the databaseURL, webSocketOnly will be true and longPolling will be disabled) From f058ac3102a0b16239f2536ac86c89bb7ef2e278 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Fri, 8 Apr 2022 08:47:20 -0700 Subject: [PATCH 12/12] Updated license year --- packages/database/test/parser.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/database/test/parser.test.ts b/packages/database/test/parser.test.ts index 57b165684db..9776d0a1fa6 100644 --- a/packages/database/test/parser.test.ts +++ b/packages/database/test/parser.test.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google LLC + * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.