From 322414d1b11cf34a5193e8ed9b58228186806522 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 15:20:54 -0700 Subject: [PATCH 1/6] Add standalone entry point in database-compat --- packages/database-compat/rollup.config.js | 34 +++++++- packages/database-compat/src/index.node.ts | 73 ++-------------- .../database-compat/src/index.standalone.ts | 68 +++++++++++++++ packages/database-compat/src/index.ts | 22 ++--- .../database-compat/standalone/package.json | 8 ++ packages/database/package.json | 1 + packages/database/rollup.config.js | 15 +++- packages/database/src/index.standalone.ts | 87 +++++++++++++++++++ 8 files changed, 222 insertions(+), 86 deletions(-) create mode 100644 packages/database-compat/src/index.standalone.ts create mode 100644 packages/database-compat/standalone/package.json create mode 100644 packages/database/src/index.standalone.ts diff --git a/packages/database-compat/rollup.config.js b/packages/database-compat/rollup.config.js index 14afce274e0..0eb868e7b12 100644 --- a/packages/database-compat/rollup.config.js +++ b/packages/database-compat/rollup.config.js @@ -18,12 +18,13 @@ import json from '@rollup/plugin-json'; import typescriptPlugin from 'rollup-plugin-typescript2'; import typescript from 'typescript'; +import commonjs from '@rollup/plugin-commonjs'; +import resolveModule from '@rollup/plugin-node-resolve'; import pkg from './package.json'; +import standalonePkg from './standalone/package.json'; -const deps = Object.keys( - Object.assign({}, pkg.peerDependencies, pkg.dependencies) -); +const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies }); function onWarn(warning, defaultWarn) { if (warning.code === 'CIRCULAR_DEPENDENCY') { @@ -81,6 +82,33 @@ const es5Builds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), onwarn: onWarn + }, + /** + * Standalone Build (used by Admin SDK). + * @firebase/database and only @firebase/database is bundled in this build. + */ + { + input: 'src/index.standalone.ts', + output: [ + { + file: standalonePkg.main.replace('../', ''), + format: 'cjs', + sourcemap: true + } + ], + plugins: [ + ...es5BuildPlugins, + resolveModule({ + mainFields: ['standalone'], + preferBuiltins: true + }), + commonjs() + ], + treeshake: { + moduleSideEffects: false + }, + external: id => deps.filter(dep => dep !== '@firebase/database').some(dep => id === dep || id.startsWith(`${dep}/`)), + onwarn: onWarn } ]; diff --git a/packages/database-compat/src/index.node.ts b/packages/database-compat/src/index.node.ts index 24e21de61c1..165c165cea2 100644 --- a/packages/database-compat/src/index.node.ts +++ b/packages/database-compat/src/index.node.ts @@ -14,14 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types'; +import firebase from '@firebase/app-compat'; +import { FirebaseNamespace } from '@firebase/app-types'; import { _FirebaseNamespace } from '@firebase/app-types/private'; -import { FirebaseAuthInternal } from '@firebase/auth-interop-types'; import { Component, ComponentType } from '@firebase/component'; import { enableLogging } from '@firebase/database'; import * as types from '@firebase/database-types'; -import { CONSTANTS, isNodeSdk } from '@firebase/util'; import { name, version } from '../package.json'; import { Database } from '../src/api/Database'; @@ -30,45 +28,9 @@ import { DataSnapshot, Query, Reference } from '../src/api/Reference'; const ServerValue = Database.ServerValue; -/** - * A one off register function which returns a database based on the app and - * passed database URL. (Used by the Admin SDK) - * - * @param app - A valid FirebaseApp-like object - * @param url - A valid Firebase databaseURL - * @param version - custom version e.g. firebase-admin version - * @param nodeAdmin - true if the SDK is being initialized from Firebase Admin. - */ -export function initStandalone( - app: FirebaseApp, - url: string, - version: string, - nodeAdmin = true -) { - CONSTANTS.NODE_ADMIN = nodeAdmin; - return INTERNAL.initStandalone({ - app, - url, - version, - // firebase-admin-node's app.INTERNAL implements FirebaseAuthInternal interface - // eslint-disable-next-line @typescript-eslint/no-explicit-any - customAuthImpl: (app as any).INTERNAL as FirebaseAuthInternal, - namespace: { - Reference, - Query, - Database, - DataSnapshot, - enableLogging, - INTERNAL, - ServerValue - }, - nodeAdmin - }); -} - -export function registerDatabase(instance: FirebaseNamespace) { +function registerDatabase(instance: FirebaseNamespace) { // Register the Database Service with the 'firebase' namespace. - const namespace = (instance as _FirebaseNamespace).INTERNAL.registerComponent( + (instance as _FirebaseNamespace).INTERNAL.registerComponent( new Component( 'database-compat', (container, { instanceIdentifier: url }) => { @@ -98,33 +60,9 @@ export function registerDatabase(instance: FirebaseNamespace) { ); instance.registerVersion(name, version, 'node'); - - if (isNodeSdk()) { - module.exports = Object.assign({}, namespace, { initStandalone }); - } -} - -try { - // If @firebase/app is not present, skip registering database. - // It could happen when this package is used in firebase-admin which doesn't depend on @firebase/app. - // Previously firebase-admin depends on @firebase/app, which causes version conflict on - // @firebase/app when used together with the js sdk. More detail: - // https://github.com/firebase/firebase-js-sdk/issues/1696#issuecomment-501546596 - // eslint-disable-next-line import/no-extraneous-dependencies, @typescript-eslint/no-require-imports - const firebase = require('@firebase/app-compat').default; - registerDatabase(firebase); -} catch (err) { - // catch and ignore 'MODULE_NOT_FOUND' error in firebase-admin context - // we can safely ignore this error because RTDB in firebase-admin works without @firebase/app - if (err.code !== 'MODULE_NOT_FOUND') { - throw err; - } } -// Types to export for the admin SDK -export { Database, Query, Reference, enableLogging, ServerValue }; - -export { OnDisconnect } from '@firebase/database'; +registerDatabase(firebase); declare module '@firebase/app-compat' { interface FirebaseNamespace { @@ -139,4 +77,3 @@ declare module '@firebase/app-compat' { database?(): types.FirebaseDatabase; } } -export { DataSnapshot } from '../src/api/Reference'; diff --git a/packages/database-compat/src/index.standalone.ts b/packages/database-compat/src/index.standalone.ts new file mode 100644 index 00000000000..f996e2e42b1 --- /dev/null +++ b/packages/database-compat/src/index.standalone.ts @@ -0,0 +1,68 @@ +/** + * @license + * Copyright 2021 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 { FirebaseApp } from '@firebase/app-types'; +import { FirebaseAuthInternal } from '@firebase/auth-interop-types'; +import { enableLogging } from '@firebase/database'; +import { CONSTANTS } from '@firebase/util'; + +import { Database } from './api/Database'; +import * as INTERNAL from './api/internal'; +import { DataSnapshot, Query, Reference } from './api/Reference'; + +const ServerValue = Database.ServerValue; + +/** + * A one off register function which returns a database based on the app and + * passed database URL. (Used by the Admin SDK) + * + * @param app - A valid FirebaseApp-like object + * @param url - A valid Firebase databaseURL + * @param version - custom version e.g. firebase-admin version + * @param nodeAdmin - true if the SDK is being initialized from Firebase Admin. + */ +export function initStandalone( + app: FirebaseApp, + url: string, + version: string, + nodeAdmin = true +) { + CONSTANTS.NODE_ADMIN = nodeAdmin; + return INTERNAL.initStandalone({ + app, + url, + version, + // firebase-admin-node's app.INTERNAL implements FirebaseAuthInternal interface + // eslint-disable-next-line @typescript-eslint/no-explicit-any + customAuthImpl: (app as any).INTERNAL as FirebaseAuthInternal, + namespace: { + Reference, + Query, + Database, + DataSnapshot, + enableLogging, + INTERNAL, + ServerValue + }, + nodeAdmin + }); +} + +// Types to export for the admin SDK +export { Database, Query, Reference, enableLogging, ServerValue }; +export { OnDisconnect } from '@firebase/database'; +export { DataSnapshot } from './api/Reference'; diff --git a/packages/database-compat/src/index.ts b/packages/database-compat/src/index.ts index 0c17bf00a01..2bc11a82a12 100644 --- a/packages/database-compat/src/index.ts +++ b/packages/database-compat/src/index.ts @@ -23,16 +23,15 @@ import { enableLogging } from '@firebase/database'; import * as types from '@firebase/database-types'; import { name, version } from '../package.json'; -import { Database as DatabaseCompat } from '../src/api/Database'; +import { Database } from '../src/api/Database'; import * as INTERNAL from '../src/api/internal'; -// rename the imports to avoid conflicts with imports that will be added by "yarn add-compat-overloads" during a release build -import { DataSnapshot as DataSnapshotCompat, Query as QueryCompat, Reference } from '../src/api/Reference'; +import { DataSnapshot, Query, Reference } from '../src/api/Reference'; -const ServerValue = DatabaseCompat.ServerValue; +const ServerValue = Database.ServerValue; export function registerDatabase(instance: FirebaseNamespace) { // Register the Database Service with the 'firebase' namespace. - const namespace = ( + ( instance as unknown as _FirebaseNamespace ).INTERNAL.registerComponent( new Component( @@ -44,7 +43,7 @@ export function registerDatabase(instance: FirebaseNamespace) { const databaseExp = container .getProvider('database') .getImmediate({ identifier: url }); - return new DatabaseCompat(databaseExp, app); + return new Database(databaseExp, app); }, ComponentType.PUBLIC ) @@ -52,9 +51,9 @@ export function registerDatabase(instance: FirebaseNamespace) { // firebase.database namespace properties { Reference, - Query: QueryCompat, - Database: DatabaseCompat, - DataSnapshot: DataSnapshotCompat, + Query, + Database, + DataSnapshot, enableLogging, INTERNAL, ServerValue @@ -68,11 +67,6 @@ export function registerDatabase(instance: FirebaseNamespace) { registerDatabase(firebase); -// Types to export for the admin SDK. They are exported here in the browser entry point only for types -// The same symbol should be exported from the node entry point so their values can be accessed at runtime by admin SDK -export { DatabaseCompat as Database, QueryCompat as Query, Reference, enableLogging, ServerValue, DataSnapshotCompat as DataSnapshot }; -export { OnDisconnect } from '@firebase/database'; - declare module '@firebase/app-compat' { interface FirebaseNamespace { database?: { diff --git a/packages/database-compat/standalone/package.json b/packages/database-compat/standalone/package.json new file mode 100644 index 00000000000..f4330af6d2d --- /dev/null +++ b/packages/database-compat/standalone/package.json @@ -0,0 +1,8 @@ +{ + "name": "@firebase/database-compat/standalone", + "description": "The entry point for sharing code with Admin SDK", + "main": "../dist/index.standalone.js", + "typings": "../dist/database-compat/src/index.standalone.d.ts", + "private": true + } + \ No newline at end of file diff --git a/packages/database/package.json b/packages/database/package.json index a8fb1f585e2..a9d50a1accd 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -7,6 +7,7 @@ "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", "esm5": "dist/index.esm5.js", + "standalone": "dist/index.standalone.js", "files": [ "dist" ], diff --git a/packages/database/rollup.config.js b/packages/database/rollup.config.js index d334f2a0486..f0bf3430d75 100644 --- a/packages/database/rollup.config.js +++ b/packages/database/rollup.config.js @@ -75,7 +75,20 @@ const es5Builds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), onwarn: onWarn - } + }, + /** + * Standalone Build + */ + { + input: 'src/index.standalone.ts', + output: [{ file: pkg.standalone, format: 'cjs', sourcemap: true }], + plugins: es5BuildPlugins, + treeshake: { + moduleSideEffects: false + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + onwarn: onWarn + }, ]; /** diff --git a/packages/database/src/index.standalone.ts b/packages/database/src/index.standalone.ts new file mode 100644 index 00000000000..a7c6bc72d37 --- /dev/null +++ b/packages/database/src/index.standalone.ts @@ -0,0 +1,87 @@ +import { Client } from 'faye-websocket'; +import { setWebSocketImpl } from './realtime/WebSocketConnection'; + +setWebSocketImpl(Client); + +// Identical to the exports from api.ts, but doesn't include getDatabase() +// to avoid dependency on @firebase/app. +// This entry point should only be consumed by Admin SDK +export { + Database, + EmulatorMockTokenOptions, + enableLogging, + goOffline, + goOnline, + connectDatabaseEmulator + } from './api/Database'; + export { + Query, + DatabaseReference, + ListenOptions, + Unsubscribe, + ThenableReference + } from './api/Reference'; + export { OnDisconnect } from './api/OnDisconnect'; + export { + DataSnapshot, + EventType, + QueryConstraint, + QueryConstraintType, + endAt, + endBefore, + equalTo, + get, + limitToFirst, + limitToLast, + off, + onChildAdded, + onChildChanged, + onChildMoved, + onChildRemoved, + onDisconnect, + onValue, + orderByChild, + orderByKey, + orderByPriority, + orderByValue, + push, + query, + ref, + refFromURL, + remove, + set, + setPriority, + setWithPriority, + startAfter, + startAt, + update, + child + } from './api/Reference_impl'; + export { increment, serverTimestamp } from './api/ServerValue'; + export { + runTransaction, + TransactionOptions, + TransactionResult + } from './api/Transaction'; + + // internal exports + export { setSDKVersion as _setSDKVersion } from './core/version'; + export { + ReferenceImpl as _ReferenceImpl, + QueryImpl as _QueryImpl + } from './api/Reference_impl'; + export { repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from './api/Database'; + export { + validatePathString as _validatePathString, + validateWritablePath as _validateWritablePath + } from './core/util/validation'; + export { UserCallback as _UserCallback } from './core/view/EventRegistration'; + export { QueryParams as _QueryParams } from './core/view/QueryParams'; + + /* eslint-disable camelcase */ + export { + hijackHash as _TEST_ACCESS_hijackHash, + forceRestClient as _TEST_ACCESS_forceRestClient + } from './api/test_access'; + /* eslint-enable camelcase */ + \ No newline at end of file From c14c477617864ca8a3ffbf73efe1789689b7165b Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 15:26:44 -0700 Subject: [PATCH 2/6] add exports field --- packages/database-compat/package.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/database-compat/package.json b/packages/database-compat/package.json index ea63f64e6b6..504cd516219 100644 --- a/packages/database-compat/package.json +++ b/packages/database-compat/package.json @@ -9,6 +9,19 @@ "esm5": "dist/index.esm5.js", "license": "Apache-2.0", "typings": "dist/database-compat/src/index.d.ts", + "files": [ + "dist", + "standalone/package.json" + ], + "exports": { + ".": { + "node": "./dist/index.js", + "default": "./dist/index.esm2017.js" + }, + "./standalone": { + "node": "./dist/index.standalone.js" + } + }, "scripts": { "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", From 2b1ddb9daff96915291ef966c9f4dc76937adf12 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 15:40:53 -0700 Subject: [PATCH 3/6] fix lint --- packages/database/src/index.standalone.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/database/src/index.standalone.ts b/packages/database/src/index.standalone.ts index a7c6bc72d37..9ce7c0b5c1a 100644 --- a/packages/database/src/index.standalone.ts +++ b/packages/database/src/index.standalone.ts @@ -1,4 +1,5 @@ import { Client } from 'faye-websocket'; + import { setWebSocketImpl } from './realtime/WebSocketConnection'; setWebSocketImpl(Client); From 19c310bbf21cbd077fb40dd097c936517432ba41 Mon Sep 17 00:00:00 2001 From: Feiyang Date: Thu, 23 Sep 2021 15:42:30 -0700 Subject: [PATCH 4/6] Create afraid-boxes-roll.md --- .changeset/afraid-boxes-roll.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/afraid-boxes-roll.md diff --git a/.changeset/afraid-boxes-roll.md b/.changeset/afraid-boxes-roll.md new file mode 100644 index 00000000000..6b970b3be5b --- /dev/null +++ b/.changeset/afraid-boxes-roll.md @@ -0,0 +1,6 @@ +--- +"@firebase/database-compat": patch +"@firebase/database": patch +--- + +Added an entry point `@firebase/database-compat/standalone` to share code with Admin SDK properly From d2b9d8c6d75542cda784fb5b5383bf7ecc90cbf8 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 22:30:55 -0700 Subject: [PATCH 5/6] address comments --- .../database-compat/standalone/package.json | 13 ++- packages/database/src/api.standalone.ts | 96 ++++++++++++++++++ packages/database/src/api.ts | 81 +-------------- packages/database/src/index.standalone.ts | 99 ++++--------------- 4 files changed, 122 insertions(+), 167 deletions(-) create mode 100644 packages/database/src/api.standalone.ts diff --git a/packages/database-compat/standalone/package.json b/packages/database-compat/standalone/package.json index f4330af6d2d..f9d3982435b 100644 --- a/packages/database-compat/standalone/package.json +++ b/packages/database-compat/standalone/package.json @@ -1,8 +1,7 @@ { - "name": "@firebase/database-compat/standalone", - "description": "The entry point for sharing code with Admin SDK", - "main": "../dist/index.standalone.js", - "typings": "../dist/database-compat/src/index.standalone.d.ts", - "private": true - } - \ No newline at end of file + "name": "@firebase/database-compat/standalone", + "description": "The entry point for sharing code with Admin SDK", + "main": "../dist/index.standalone.js", + "typings": "../dist/database-compat/src/index.standalone.d.ts", + "private": true +} \ No newline at end of file diff --git a/packages/database/src/api.standalone.ts b/packages/database/src/api.standalone.ts new file mode 100644 index 00000000000..e064e046702 --- /dev/null +++ b/packages/database/src/api.standalone.ts @@ -0,0 +1,96 @@ +/** + * @license + * Copyright 2021 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. + */ + +// APIs that don't depend on @firebase/app +export { + Database, + EmulatorMockTokenOptions, + enableLogging, + goOffline, + goOnline, + connectDatabaseEmulator +} from './api/Database'; +export { + Query, + DatabaseReference, + ListenOptions, + Unsubscribe, + ThenableReference +} from './api/Reference'; +export { OnDisconnect } from './api/OnDisconnect'; +export { + DataSnapshot, + EventType, + QueryConstraint, + QueryConstraintType, + endAt, + endBefore, + equalTo, + get, + limitToFirst, + limitToLast, + off, + onChildAdded, + onChildChanged, + onChildMoved, + onChildRemoved, + onDisconnect, + onValue, + orderByChild, + orderByKey, + orderByPriority, + orderByValue, + push, + query, + ref, + refFromURL, + remove, + set, + setPriority, + setWithPriority, + startAfter, + startAt, + update, + child +} from './api/Reference_impl'; +export { increment, serverTimestamp } from './api/ServerValue'; +export { + runTransaction, + TransactionOptions, + TransactionResult +} from './api/Transaction'; + +// internal exports +export { setSDKVersion as _setSDKVersion } from './core/version'; +export { + ReferenceImpl as _ReferenceImpl, + QueryImpl as _QueryImpl +} from './api/Reference_impl'; +export { repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from './api/Database'; +export { + validatePathString as _validatePathString, + validateWritablePath as _validateWritablePath +} from './core/util/validation'; +export { UserCallback as _UserCallback } from './core/view/EventRegistration'; +export { QueryParams as _QueryParams } from './core/view/QueryParams'; + +/* eslint-disable camelcase */ +export { + hijackHash as _TEST_ACCESS_hijackHash, + forceRestClient as _TEST_ACCESS_forceRestClient +} from './api/test_access'; + /* eslint-enable camelcase */ diff --git a/packages/database/src/api.ts b/packages/database/src/api.ts index 7884685df04..72aa40de90e 100644 --- a/packages/database/src/api.ts +++ b/packages/database/src/api.ts @@ -15,82 +15,5 @@ * limitations under the License. */ -export { - Database, - EmulatorMockTokenOptions, - enableLogging, - getDatabase, - goOffline, - goOnline, - connectDatabaseEmulator -} from './api/Database'; -export { - Query, - DatabaseReference, - ListenOptions, - Unsubscribe, - ThenableReference -} from './api/Reference'; -export { OnDisconnect } from './api/OnDisconnect'; -export { - DataSnapshot, - EventType, - QueryConstraint, - QueryConstraintType, - endAt, - endBefore, - equalTo, - get, - limitToFirst, - limitToLast, - off, - onChildAdded, - onChildChanged, - onChildMoved, - onChildRemoved, - onDisconnect, - onValue, - orderByChild, - orderByKey, - orderByPriority, - orderByValue, - push, - query, - ref, - refFromURL, - remove, - set, - setPriority, - setWithPriority, - startAfter, - startAt, - update, - child -} from './api/Reference_impl'; -export { increment, serverTimestamp } from './api/ServerValue'; -export { - runTransaction, - TransactionOptions, - TransactionResult -} from './api/Transaction'; - -// internal exports -export { setSDKVersion as _setSDKVersion } from './core/version'; -export { - ReferenceImpl as _ReferenceImpl, - QueryImpl as _QueryImpl -} from './api/Reference_impl'; -export { repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from './api/Database'; -export { - validatePathString as _validatePathString, - validateWritablePath as _validateWritablePath -} from './core/util/validation'; -export { UserCallback as _UserCallback } from './core/view/EventRegistration'; -export { QueryParams as _QueryParams } from './core/view/QueryParams'; - -/* eslint-disable camelcase */ -export { - hijackHash as _TEST_ACCESS_hijackHash, - forceRestClient as _TEST_ACCESS_forceRestClient -} from './api/test_access'; -/* eslint-enable camelcase */ +export * from './api.standalone'; +export { getDatabase } from './api/Database'; \ No newline at end of file diff --git a/packages/database/src/index.standalone.ts b/packages/database/src/index.standalone.ts index 9ce7c0b5c1a..c365a039dd9 100644 --- a/packages/database/src/index.standalone.ts +++ b/packages/database/src/index.standalone.ts @@ -1,88 +1,25 @@ +/** + * @license + * Copyright 2021 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 { Client } from 'faye-websocket'; import { setWebSocketImpl } from './realtime/WebSocketConnection'; setWebSocketImpl(Client); -// Identical to the exports from api.ts, but doesn't include getDatabase() -// to avoid dependency on @firebase/app. // This entry point should only be consumed by Admin SDK -export { - Database, - EmulatorMockTokenOptions, - enableLogging, - goOffline, - goOnline, - connectDatabaseEmulator - } from './api/Database'; - export { - Query, - DatabaseReference, - ListenOptions, - Unsubscribe, - ThenableReference - } from './api/Reference'; - export { OnDisconnect } from './api/OnDisconnect'; - export { - DataSnapshot, - EventType, - QueryConstraint, - QueryConstraintType, - endAt, - endBefore, - equalTo, - get, - limitToFirst, - limitToLast, - off, - onChildAdded, - onChildChanged, - onChildMoved, - onChildRemoved, - onDisconnect, - onValue, - orderByChild, - orderByKey, - orderByPriority, - orderByValue, - push, - query, - ref, - refFromURL, - remove, - set, - setPriority, - setWithPriority, - startAfter, - startAt, - update, - child - } from './api/Reference_impl'; - export { increment, serverTimestamp } from './api/ServerValue'; - export { - runTransaction, - TransactionOptions, - TransactionResult - } from './api/Transaction'; - - // internal exports - export { setSDKVersion as _setSDKVersion } from './core/version'; - export { - ReferenceImpl as _ReferenceImpl, - QueryImpl as _QueryImpl - } from './api/Reference_impl'; - export { repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from './api/Database'; - export { - validatePathString as _validatePathString, - validateWritablePath as _validateWritablePath - } from './core/util/validation'; - export { UserCallback as _UserCallback } from './core/view/EventRegistration'; - export { QueryParams as _QueryParams } from './core/view/QueryParams'; - - /* eslint-disable camelcase */ - export { - hijackHash as _TEST_ACCESS_hijackHash, - forceRestClient as _TEST_ACCESS_forceRestClient - } from './api/test_access'; - /* eslint-enable camelcase */ - \ No newline at end of file +export * from './api.standalone'; \ No newline at end of file From 7ad9ecd316970e202bccd1e8519a08050c50bb5b Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Fri, 24 Sep 2021 10:06:27 -0700 Subject: [PATCH 6/6] add an emptry line to the end of file --- packages/database/src/index.standalone.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/database/src/index.standalone.ts b/packages/database/src/index.standalone.ts index c365a039dd9..c056613c7d0 100644 --- a/packages/database/src/index.standalone.ts +++ b/packages/database/src/index.standalone.ts @@ -22,4 +22,4 @@ import { setWebSocketImpl } from './realtime/WebSocketConnection'; setWebSocketImpl(Client); // This entry point should only be consumed by Admin SDK -export * from './api.standalone'; \ No newline at end of file +export * from './api.standalone';