-
Notifications
You must be signed in to change notification settings - Fork 948
Included initStandalone #7258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Included initStandalone #7258
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0ea5ada
Included standalone POC
maneesht 76396fa
Fixed api standalone issue
maneesht 7b13fd1
Fixed paths
maneesht 59e724d
Added appcheck internal param
maneesht 2e5b903
Fixed comments and liinting
maneesht 83ca363
Fixed linting
maneesht a539032
Fixed linting
maneesht da88cf6
Merge remote-tracking branch 'origin/master' into mtewani/add-init-st…
maneesht a1343cc
Included appcheck in initStandalone
maneesht 2ccc5b1
Addressed linting
maneesht ecc3150
Ran formatter
maneesht a07b14f
Create pretty-donkeys-brush.md
maneesht 642285a
Added customappcheckimpl
maneesht 8ee6f1d
Merge branch 'mtewani/add-init-standalone' of https://github.com/fire…
maneesht 1f088bb
Added appcheckinternal component
maneesht 1357fe1
Updated license
maneesht 0cf69f5
Updated types
maneesht 4fcedf5
Updated formatting
maneesht 02f1c16
Revert "Updated formatting"
maneesht 2887b72
Revert "Updated types"
maneesht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@firebase/database-compat": patch | ||
"@firebase/database": patch | ||
--- | ||
|
||
Included `initStandalone` as an internal method to RTDB. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* @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 { | ||
FirebaseAppCheckInternal, | ||
AppCheckInternalComponentName | ||
} from '@firebase/app-check-interop-types'; | ||
import { FirebaseApp } from '@firebase/app-types'; | ||
import { | ||
FirebaseAuthInternal, | ||
FirebaseAuthInternalName | ||
} from '@firebase/auth-interop-types'; | ||
import { | ||
Component, | ||
ComponentContainer, | ||
ComponentType, | ||
Provider | ||
} from '@firebase/component'; | ||
|
||
import { Database } from '../api.standalone'; | ||
import { repoManagerDatabaseFromApp } from '../api/Database'; | ||
import { setSDKVersion } from '../core/version'; | ||
|
||
/** | ||
* Used by console to create a database based on the app, | ||
* passed database URL and a custom auth implementation. | ||
* @internal | ||
* @param app - A valid FirebaseApp-like object | ||
* @param url - A valid Firebase databaseURL | ||
* @param version - custom version e.g. firebase-admin version | ||
* @param customAppCheckImpl - custom app check implementation | ||
* @param customAuthImpl - custom auth implementation | ||
*/ | ||
export function _initStandalone({ | ||
app, | ||
url, | ||
version, | ||
customAuthImpl, | ||
customAppCheckImpl, | ||
nodeAdmin = false | ||
}: { | ||
app: FirebaseApp; | ||
url: string; | ||
version: string; | ||
customAuthImpl: FirebaseAuthInternal; | ||
customAppCheckImpl?: FirebaseAppCheckInternal; | ||
nodeAdmin?: boolean; | ||
}): Database { | ||
setSDKVersion(version); | ||
|
||
/** | ||
* ComponentContainer('database-standalone') is just a placeholder that doesn't perform | ||
* any actual function. | ||
*/ | ||
const componentContainer = new ComponentContainer('database-standalone'); | ||
const authProvider = new Provider<FirebaseAuthInternalName>( | ||
'auth-internal', | ||
componentContainer | ||
); | ||
let appCheckProvider: Provider<AppCheckInternalComponentName>; | ||
if (customAppCheckImpl) { | ||
appCheckProvider = new Provider<AppCheckInternalComponentName>( | ||
'app-check-internal', | ||
componentContainer | ||
); | ||
appCheckProvider.setComponent( | ||
new Component( | ||
'app-check-internal', | ||
() => customAppCheckImpl, | ||
ComponentType.PRIVATE | ||
) | ||
); | ||
} | ||
authProvider.setComponent( | ||
new Component('auth-internal', () => customAuthImpl, ComponentType.PRIVATE) | ||
); | ||
|
||
return repoManagerDatabaseFromApp( | ||
app, | ||
authProvider, | ||
appCheckProvider, | ||
url, | ||
nodeAdmin | ||
); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.