push all website files

This commit is contained in:
Jacob Levine 2019-01-06 13:14:45 -06:00
parent 476d8c19cf
commit 0a9f515fae
335 changed files with 144108 additions and 0 deletions

8
functions/index.js Normal file
View File

@ -0,0 +1,8 @@
const functions = require('firebase-functions');
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });

15
functions/node_modules/.bin/acorn generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
ret=$?
else
node "$basedir/../acorn/bin/acorn" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/acorn.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\acorn\bin\acorn" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\acorn\bin\acorn" %*
)

15
functions/node_modules/.bin/atob generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../atob/bin/atob.js" "$@"
ret=$?
else
node "$basedir/../atob/bin/atob.js" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/atob.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\atob\bin\atob.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\atob\bin\atob.js" %*
)

15
functions/node_modules/.bin/gcs-upload generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../gcs-resumable-upload/build/src/cli.js" "$@"
ret=$?
else
node "$basedir/../gcs-resumable-upload/build/src/cli.js" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/gcs-upload.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\gcs-resumable-upload\build\src\cli.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\gcs-resumable-upload\build\src\cli.js" %*
)

15
functions/node_modules/.bin/gp12-pem generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
ret=$?
else
node "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/gp12-pem.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\google-p12-pem\build\src\bin\gp12-pem.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\google-p12-pem\build\src\bin\gp12-pem.js" %*
)

15
functions/node_modules/.bin/mime generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../mime/cli.js" "$@"
ret=$?
else
node "$basedir/../mime/cli.js" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/mime.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\mime\cli.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\mime\cli.js" %*
)

15
functions/node_modules/.bin/pbjs generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/pbjs.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\protobufjs\bin\pbjs" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\protobufjs\bin\pbjs" %*
)

15
functions/node_modules/.bin/pbts generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/pbts.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\protobufjs\bin\pbts" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\protobufjs\bin\pbts" %*
)

15
functions/node_modules/.bin/sshpk-conv generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-conv" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/sshpk-conv.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-conv" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\sshpk\bin\sshpk-conv" %*
)

15
functions/node_modules/.bin/sshpk-sign generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-sign" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-sign" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/sshpk-sign.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-sign" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\sshpk\bin\sshpk-sign" %*
)

15
functions/node_modules/.bin/sshpk-verify generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-verify" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/sshpk-verify.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-verify" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\sshpk\bin\sshpk-verify" %*
)

15
functions/node_modules/.bin/uuid generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
ret=$?
else
node "$basedir/../uuid/bin/uuid" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/uuid.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\uuid\bin\uuid" %*
)

15
functions/node_modules/.bin/window-size generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../window-size/cli.js" "$@"
ret=$?
else
node "$basedir/../window-size/cli.js" "$@"
ret=$?
fi
exit $ret

7
functions/node_modules/.bin/window-size.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\window-size\cli.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\window-size\cli.js" %*
)

3
functions/node_modules/@firebase/app-types/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# @firebase/app-types
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

105
functions/node_modules/@firebase/app-types/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,105 @@
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
export type FirebaseOptions = {
apiKey?: string;
authDomain?: string;
databaseURL?: string;
projectId?: string;
storageBucket?: string;
messagingSenderId?: string;
[name: string]: any;
};
export interface FirebaseAppConfig {
name?: string;
automaticDataCollectionEnabled?: boolean;
}
export class FirebaseApp {
/**
* The (read-only) name (identifier) for this App. '[DEFAULT]' is the default
* App.
*/
name: string;
/**
* The (read-only) configuration options from the app initialization.
*/
options: FirebaseOptions;
/**
* The settable config flag for GDPR opt-in/opt-out
*/
automaticDataCollectionEnabled: boolean;
/**
* Make the given App unusable and free resources.
*/
delete(): Promise<void>;
}
export interface FirebaseNamespace {
/**
* Create (and initialize) a FirebaseApp.
*
* @param options Options to configure the services used in the App.
* @param config The optional config for your firebase app
*/
initializeApp(
options: FirebaseOptions,
config?: FirebaseAppConfig
): FirebaseApp;
/**
* Create (and initialize) a FirebaseApp.
*
* @param options Options to configure the services used in the App.
* @param name The optional name of the app to initialize ('[DEFAULT]' if
* omitted)
*/
initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
app: {
/**
* Retrieve an instance of a FirebaseApp.
*
* Usage: firebase.app()
*
* @param name The optional name of the app to return ('[DEFAULT]' if omitted)
*/
(name?: string): FirebaseApp;
/**
* For testing FirebaseApp instances:
* app() instanceof firebase.app.App
*
* DO NOT call this constuctor directly (use firebase.app() instead).
*/
App: typeof FirebaseApp;
};
/**
* A (read-only) array of all the initialized Apps.
*/
apps: FirebaseApp[];
// Inherit the type information of our exported Promise implementation from
// es6-promises.
Promise: typeof Promise;
// The current SDK version.
SDK_VERSION: string;
}

View File

@ -0,0 +1,54 @@
{
"_from": "@firebase/app-types@0.3.2",
"_id": "@firebase/app-types@0.3.2",
"_inBundle": false,
"_integrity": "sha512-ZD8lTgW07NGgo75bTyBJA8Lt9+NweNzot7lrsBtIvfciwUzaFJLsv2EShqjBeuhF7RpG6YFucJ6m67w5buCtzw==",
"_location": "/@firebase/app-types",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@firebase/app-types@0.3.2",
"name": "@firebase/app-types",
"escapedName": "@firebase%2fapp-types",
"scope": "@firebase",
"rawSpec": "0.3.2",
"saveSpec": null,
"fetchSpec": "0.3.2"
},
"_requiredBy": [
"/@firebase/app"
],
"_resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.3.2.tgz",
"_shasum": "a92dc544290e2893bd8c02a81e684dae3d8e7c85",
"_spec": "@firebase/app-types@0.3.2",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\@firebase\\app",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "@firebase/app Types",
"devDependencies": {
"typescript": "2.8.1"
},
"files": [
"index.d.ts",
"private.d.ts"
],
"license": "Apache-2.0",
"name": "@firebase/app-types",
"repository": {
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk/tree/master/packages/app-types"
},
"scripts": {
"test": "tsc"
},
"version": "0.3.2"
}

159
functions/node_modules/@firebase/app-types/private.d.ts generated vendored Normal file
View File

@ -0,0 +1,159 @@
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* THIS FILE IS FOR INTERNAL USAGE ONLY, IF YOU ARE NOT DEVELOPING THE FIREBASE
* SDKs, PLEASE DO NOT REFERENCE THIS FILE AS IT MAY CHANGE WITHOUT WARNING
*/
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
import { Observer, Subscribe } from '@firebase/util';
import { FirebaseError } from '@firebase/util';
export interface FirebaseServiceInternals {
/**
* Delete the service and free it's resources - called from
* app.delete().
*/
delete(): Promise<void>;
}
// Services are exposed through instances - each of which is associated with a
// FirebaseApp.
export interface FirebaseService {
app: FirebaseApp;
INTERNAL?: FirebaseServiceInternals;
}
export type AppHook = (event: string, app: FirebaseApp) => void;
/**
* Firebase Services create instances given a Firebase App instance and can
* optionally add properties and methods to each FirebaseApp via the extendApp()
* function.
*/
export interface FirebaseServiceFactory {
(
app: FirebaseApp,
extendApp?: (props: { [prop: string]: any }) => void,
instanceString?: string
): FirebaseService;
}
/**
* All ServiceNamespaces extend from FirebaseServiceNamespace
*/
export interface FirebaseServiceNamespace<T extends FirebaseService> {
(app?: FirebaseApp): T;
}
export interface FirebaseErrorFactory<T> {
create(code: T, data?: { [prop: string]: any }): FirebaseError;
}
export interface FirebaseErrorFactoryClass {
new (
service: string,
serviceName: string,
errors: { [code: string]: string }
): FirebaseErrorFactory<any>;
}
export interface FirebaseAuthTokenData {
accessToken: string;
}
export interface FirebaseAppInternals {
getToken(refreshToken?: boolean): Promise<FirebaseAuthTokenData | null>;
getUid(): string | null;
addAuthTokenListener(fn: (token: string | null) => void): void;
removeAuthTokenListener(fn: (token: string | null) => void): void;
}
export interface _FirebaseApp extends FirebaseApp {
INTERNAL: FirebaseAppInternals;
}
export interface _FirebaseNamespace extends FirebaseNamespace {
INTERNAL: {
/**
* Internal API to register a Firebase Service into the firebase namespace.
*
* Each service will create a child namespace (firebase.<name>) which acts as
* both a namespace for service specific properties, and also as a service
* accessor function (firebase.<name>() or firebase.<name>(app)).
*
* @param name The Firebase Service being registered.
* @param createService Factory function to create a service instance.
* @param serviceProperties Properties to copy to the service's namespace.
* @param appHook All appHooks called before initializeApp returns to caller.
* @param allowMultipleInstances Whether the registered service supports
* multiple instances per app. If not specified, the default is false.
*/
registerService(
name: string,
createService: FirebaseServiceFactory,
serviceProperties?: { [prop: string]: any },
appHook?: AppHook,
allowMultipleInstances?: boolean
): FirebaseServiceNamespace<FirebaseService>;
/**
* Just used for testing to start from a fresh namespace.
*/
createFirebaseNamespace(): FirebaseNamespace;
/**
* Internal API to install properties on the top-level firebase namespace.
* @prop props The top level properties of this object are copied to the
* namespace.
*/
extendNamespace(props: { [prop: string]: any }): void;
/**
* Create a Subscribe function. A proxy Observer is created so that
* events can be sent to single Observer to be fanned out automatically.
*/
createSubscribe<T>(
executor: (observer: Observer<T>) => void,
onNoObservers?: (observer: Observer<T>) => void
): Subscribe<T>;
/**
* Utility exposed for internal testing.
*/
deepExtend(target: any, source: any): any;
/**
* Internal API to remove an app from the list of registered apps.
*/
removeApp(name: string): void;
/**
* Service factories for each registered service.
*/
factories: { [name: string]: FirebaseServiceFactory };
/*
* Convert service name to factory name to use.
*/
useAsService(app: FirebaseApp, serviceName: string): string | null;
/**
* Use to construct all thrown FirebaseError's.
*/
ErrorFactory: FirebaseErrorFactoryClass;
};
}

6
functions/node_modules/@firebase/app/README.md generated vendored Normal file
View File

@ -0,0 +1,6 @@
# @firebase/app
This package coordinates the communication between the different Firebase components and
exposes the API surface to the user
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

398
functions/node_modules/@firebase/app/dist/index.cjs.js generated vendored Normal file
View File

@ -0,0 +1,398 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var util = require('@firebase/util');
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var contains = function (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
};
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
// An array to capture listeners before the true auth functions
// exist
var tokenListeners = [];
/**
* Global context object for a collection of services using
* a shared authentication state.
*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.services_ = {};
this.name_ = config.name;
this._automaticDataCollectionEnabled =
config.automaticDataCollectionEnabled || false;
this.options_ = util.deepCopy(options);
this.INTERNAL = {
getUid: function () { return null; },
getToken: function () { return Promise.resolve(null); },
addAuthTokenListener: function (callback) {
tokenListeners.push(callback);
// Make sure callback is called, asynchronously, in the absence of the auth module
setTimeout(function () { return callback(null); }, 0);
},
removeAuthTokenListener: function (callback) {
tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; });
}
};
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed_();
return this._automaticDataCollectionEnabled;
},
set: function (val) {
this.checkDestroyed_();
this._automaticDataCollectionEnabled = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed_();
return this.name_;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed_();
return this.options_;
},
enumerable: true,
configurable: true
});
FirebaseAppImpl.prototype.delete = function () {
var _this = this;
return new Promise(function (resolve) {
_this.checkDestroyed_();
resolve();
})
.then(function () {
_this.firebase_.INTERNAL.removeApp(_this.name_);
var services = [];
Object.keys(_this.services_).forEach(function (serviceKey) {
Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) {
services.push(_this.services_[serviceKey][instanceKey]);
});
});
return Promise.all(services.map(function (service) {
return service.INTERNAL.delete();
}));
})
.then(function () {
_this.isDeleted_ = true;
_this.services_ = {};
});
};
/**
* Return a service instance associated with this app (creating it
* on demand), identified by the passed instanceIdentifier.
*
* NOTE: Currently storage is the only one that is leveraging this
* functionality. They invoke it by calling:
*
* ```javascript
* firebase.app().storage('STORAGE BUCKET ID')
* ```
*
* The service name is passed to this already
* @internal
*/
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
this.checkDestroyed_();
if (!this.services_[name]) {
this.services_[name] = {};
}
if (!this.services_[name][instanceIdentifier]) {
/**
* If a custom instance has been defined (i.e. not '[DEFAULT]')
* then we will pass that instance on, otherwise we pass `null`
*/
var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME
? instanceIdentifier
: undefined;
var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier);
this.services_[name][instanceIdentifier] = service;
}
return this.services_[name][instanceIdentifier];
};
/**
* Callback function used to extend an App instance at the time
* of service instance creation.
*/
FirebaseAppImpl.prototype.extendApp = function (props) {
var _this = this;
// Copy the object onto the FirebaseAppImpl prototype
util.deepExtend(this, props);
/**
* If the app has overwritten the addAuthTokenListener stub, forward
* the active token listeners on to the true fxn.
*
* TODO: This function is required due to our current module
* structure. Once we are able to rely strictly upon a single module
* implementation, this code should be refactored and Auth should
* provide these stubs and the upgrade logic
*/
if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) {
tokenListeners.forEach(function (listener) {
_this.INTERNAL.addAuthTokenListener(listener);
});
tokenListeners = [];
}
};
/**
* This function will throw an Error if the App has already been deleted -
* use before performing API actions on the App.
*/
FirebaseAppImpl.prototype.checkDestroyed_ = function () {
if (this.isDeleted_) {
error('app-deleted', { name: this.name_ });
}
};
return FirebaseAppImpl;
}());
// Prevent dead-code elimination of these methods w/o invalid property
// copying.
(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
FirebaseAppImpl.prototype.delete ||
console.log('dc');
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
function createFirebaseNamespace() {
var apps_ = {};
var factories = {};
var appHooks = {};
// A namespace is a plain JavaScript Object.
var namespace = {
// Hack to prevent Babel from modifying the object returned
// as the firebase namespace.
__esModule: true,
initializeApp: initializeApp,
app: app,
apps: null,
Promise: Promise,
SDK_VERSION: '5.5.9',
INTERNAL: {
registerService: registerService,
createFirebaseNamespace: createFirebaseNamespace,
extendNamespace: extendNamespace,
createSubscribe: util.createSubscribe,
ErrorFactory: util.ErrorFactory,
removeApp: removeApp,
factories: factories,
useAsService: useAsService,
Promise: Promise,
deepExtend: util.deepExtend
}
};
// Inject a circular default export to allow Babel users who were previously
// using:
//
// import firebase from 'firebase';
// which becomes: var firebase = require('firebase').default;
//
// instead of
//
// import * as firebase from 'firebase';
// which becomes: var firebase = require('firebase');
util.patchProperty(namespace, 'default', namespace);
// firebase.apps is a read-only getter.
Object.defineProperty(namespace, 'apps', {
get: getApps
});
/**
* Called by App.delete() - but before any services associated with the App
* are deleted.
*/
function removeApp(name) {
var app = apps_[name];
callAppHooks(app, 'delete');
delete apps_[name];
}
/**
* Get the App object for a given name (or DEFAULT).
*/
function app(name) {
name = name || DEFAULT_ENTRY_NAME;
if (!contains(apps_, name)) {
error('no-app', { name: name });
}
return apps_[name];
}
util.patchProperty(app, 'App', FirebaseAppImpl);
function initializeApp(options, rawConfig) {
if (rawConfig === void 0) { rawConfig = {}; }
if (typeof rawConfig !== 'object' || rawConfig === null) {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
}
var config = rawConfig;
if (config.name === undefined) {
config.name = DEFAULT_ENTRY_NAME;
}
var name = config.name;
if (typeof name !== 'string' || !name) {
error('bad-app-name', { name: name + '' });
}
if (contains(apps_, name)) {
error('duplicate-app', { name: name });
}
var app = new FirebaseAppImpl(options, config, namespace);
apps_[name] = app;
callAppHooks(app, 'create');
return app;
}
/*
* Return an array of all the non-deleted FirebaseApps.
*/
function getApps() {
// Make a copy so caller cannot mutate the apps list.
return Object.keys(apps_).map(function (name) { return apps_[name]; });
}
/*
* Register a Firebase Service.
*
* firebase.INTERNAL.registerService()
*
* TODO: Implement serviceProperties.
*/
function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) {
// Cannot re-register a service that already exists
if (factories[name]) {
error('duplicate-service', { name: name });
}
// Capture the service factory for later service instantiation
factories[name] = createService;
// Capture the appHook, if passed
if (appHook) {
appHooks[name] = appHook;
// Run the **new** app hook on all existing apps
getApps().forEach(function (app) {
appHook('create', app);
});
}
// The Service namespace is an accessor function ...
var serviceNamespace = function (appArg) {
if (appArg === void 0) { appArg = app(); }
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
error('invalid-app-argument', { name: name });
}
// Forward service instance lookup to the FirebaseApp.
return appArg[name]();
};
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
util.deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
FirebaseAppImpl.prototype[name] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, name);
return serviceFxn.apply(this, allowMultipleInstances ? args : []);
};
return serviceNamespace;
}
/**
* Patch the top-level firebase namespace with additional properties.
*
* firebase.INTERNAL.extendNamespace()
*/
function extendNamespace(props) {
util.deepExtend(namespace, props);
}
function callAppHooks(app, eventName) {
Object.keys(factories).forEach(function (serviceName) {
// Ignore virtual services
var factoryName = useAsService(app, serviceName);
if (factoryName === null) {
return;
}
if (appHooks[factoryName]) {
appHooks[factoryName](eventName, app);
}
});
}
// Map the requested service to a registered service name
// (used to map auth to serverAuth service when needed).
function useAsService(app, name) {
if (name === 'serverAuth') {
return null;
}
var useService = name;
var options = app.options;
return useService;
}
return namespace;
}
function error(code, args) {
throw appErrors.create(code, args);
}
// TypeScript does not support non-string indexes!
// let errors: {[code: AppError: string} = {
var errors = {
'no-app': "No Firebase App '{$name}' has been created - " +
'call Firebase App.initializeApp()',
'bad-app-name': "Illegal App name: '{$name}",
'duplicate-app': "Firebase App named '{$name}' already exists",
'app-deleted': "Firebase App named '{$name}' already deleted",
'duplicate-service': "Firebase service named '{$name}' already registered",
'sa-not-supported': 'Initializing the Firebase SDK with a service ' +
'account is only allowed in a Node.js environment. On client ' +
'devices, you should instead initialize the SDK with an api key and ' +
'auth domain',
'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' +
'Firebase App instance.'
};
var appErrors = new util.ErrorFactory('app', 'Firebase', errors);
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var firebase = createFirebaseNamespace();
exports.firebase = firebase;
exports.default = firebase;

18
functions/node_modules/@firebase/app/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,18 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { FirebaseNamespace } from '@firebase/app-types';
export declare const firebase: FirebaseNamespace;
export default firebase;

394
functions/node_modules/@firebase/app/dist/index.esm.js generated vendored Normal file
View File

@ -0,0 +1,394 @@
import { createSubscribe, deepCopy, deepExtend, ErrorFactory, patchProperty } from '@firebase/util';
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var contains = function (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
};
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
// An array to capture listeners before the true auth functions
// exist
var tokenListeners = [];
/**
* Global context object for a collection of services using
* a shared authentication state.
*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.services_ = {};
this.name_ = config.name;
this._automaticDataCollectionEnabled =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.INTERNAL = {
getUid: function () { return null; },
getToken: function () { return Promise.resolve(null); },
addAuthTokenListener: function (callback) {
tokenListeners.push(callback);
// Make sure callback is called, asynchronously, in the absence of the auth module
setTimeout(function () { return callback(null); }, 0);
},
removeAuthTokenListener: function (callback) {
tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; });
}
};
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed_();
return this._automaticDataCollectionEnabled;
},
set: function (val) {
this.checkDestroyed_();
this._automaticDataCollectionEnabled = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed_();
return this.name_;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed_();
return this.options_;
},
enumerable: true,
configurable: true
});
FirebaseAppImpl.prototype.delete = function () {
var _this = this;
return new Promise(function (resolve) {
_this.checkDestroyed_();
resolve();
})
.then(function () {
_this.firebase_.INTERNAL.removeApp(_this.name_);
var services = [];
Object.keys(_this.services_).forEach(function (serviceKey) {
Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) {
services.push(_this.services_[serviceKey][instanceKey]);
});
});
return Promise.all(services.map(function (service) {
return service.INTERNAL.delete();
}));
})
.then(function () {
_this.isDeleted_ = true;
_this.services_ = {};
});
};
/**
* Return a service instance associated with this app (creating it
* on demand), identified by the passed instanceIdentifier.
*
* NOTE: Currently storage is the only one that is leveraging this
* functionality. They invoke it by calling:
*
* ```javascript
* firebase.app().storage('STORAGE BUCKET ID')
* ```
*
* The service name is passed to this already
* @internal
*/
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
this.checkDestroyed_();
if (!this.services_[name]) {
this.services_[name] = {};
}
if (!this.services_[name][instanceIdentifier]) {
/**
* If a custom instance has been defined (i.e. not '[DEFAULT]')
* then we will pass that instance on, otherwise we pass `null`
*/
var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME
? instanceIdentifier
: undefined;
var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier);
this.services_[name][instanceIdentifier] = service;
}
return this.services_[name][instanceIdentifier];
};
/**
* Callback function used to extend an App instance at the time
* of service instance creation.
*/
FirebaseAppImpl.prototype.extendApp = function (props) {
var _this = this;
// Copy the object onto the FirebaseAppImpl prototype
deepExtend(this, props);
/**
* If the app has overwritten the addAuthTokenListener stub, forward
* the active token listeners on to the true fxn.
*
* TODO: This function is required due to our current module
* structure. Once we are able to rely strictly upon a single module
* implementation, this code should be refactored and Auth should
* provide these stubs and the upgrade logic
*/
if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) {
tokenListeners.forEach(function (listener) {
_this.INTERNAL.addAuthTokenListener(listener);
});
tokenListeners = [];
}
};
/**
* This function will throw an Error if the App has already been deleted -
* use before performing API actions on the App.
*/
FirebaseAppImpl.prototype.checkDestroyed_ = function () {
if (this.isDeleted_) {
error('app-deleted', { name: this.name_ });
}
};
return FirebaseAppImpl;
}());
// Prevent dead-code elimination of these methods w/o invalid property
// copying.
(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
FirebaseAppImpl.prototype.delete ||
console.log('dc');
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
function createFirebaseNamespace() {
var apps_ = {};
var factories = {};
var appHooks = {};
// A namespace is a plain JavaScript Object.
var namespace = {
// Hack to prevent Babel from modifying the object returned
// as the firebase namespace.
__esModule: true,
initializeApp: initializeApp,
app: app,
apps: null,
Promise: Promise,
SDK_VERSION: '5.5.9',
INTERNAL: {
registerService: registerService,
createFirebaseNamespace: createFirebaseNamespace,
extendNamespace: extendNamespace,
createSubscribe: createSubscribe,
ErrorFactory: ErrorFactory,
removeApp: removeApp,
factories: factories,
useAsService: useAsService,
Promise: Promise,
deepExtend: deepExtend
}
};
// Inject a circular default export to allow Babel users who were previously
// using:
//
// import firebase from 'firebase';
// which becomes: var firebase = require('firebase').default;
//
// instead of
//
// import * as firebase from 'firebase';
// which becomes: var firebase = require('firebase');
patchProperty(namespace, 'default', namespace);
// firebase.apps is a read-only getter.
Object.defineProperty(namespace, 'apps', {
get: getApps
});
/**
* Called by App.delete() - but before any services associated with the App
* are deleted.
*/
function removeApp(name) {
var app = apps_[name];
callAppHooks(app, 'delete');
delete apps_[name];
}
/**
* Get the App object for a given name (or DEFAULT).
*/
function app(name) {
name = name || DEFAULT_ENTRY_NAME;
if (!contains(apps_, name)) {
error('no-app', { name: name });
}
return apps_[name];
}
patchProperty(app, 'App', FirebaseAppImpl);
function initializeApp(options, rawConfig) {
if (rawConfig === void 0) { rawConfig = {}; }
if (typeof rawConfig !== 'object' || rawConfig === null) {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
}
var config = rawConfig;
if (config.name === undefined) {
config.name = DEFAULT_ENTRY_NAME;
}
var name = config.name;
if (typeof name !== 'string' || !name) {
error('bad-app-name', { name: name + '' });
}
if (contains(apps_, name)) {
error('duplicate-app', { name: name });
}
var app = new FirebaseAppImpl(options, config, namespace);
apps_[name] = app;
callAppHooks(app, 'create');
return app;
}
/*
* Return an array of all the non-deleted FirebaseApps.
*/
function getApps() {
// Make a copy so caller cannot mutate the apps list.
return Object.keys(apps_).map(function (name) { return apps_[name]; });
}
/*
* Register a Firebase Service.
*
* firebase.INTERNAL.registerService()
*
* TODO: Implement serviceProperties.
*/
function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) {
// Cannot re-register a service that already exists
if (factories[name]) {
error('duplicate-service', { name: name });
}
// Capture the service factory for later service instantiation
factories[name] = createService;
// Capture the appHook, if passed
if (appHook) {
appHooks[name] = appHook;
// Run the **new** app hook on all existing apps
getApps().forEach(function (app) {
appHook('create', app);
});
}
// The Service namespace is an accessor function ...
var serviceNamespace = function (appArg) {
if (appArg === void 0) { appArg = app(); }
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
error('invalid-app-argument', { name: name });
}
// Forward service instance lookup to the FirebaseApp.
return appArg[name]();
};
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
FirebaseAppImpl.prototype[name] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, name);
return serviceFxn.apply(this, allowMultipleInstances ? args : []);
};
return serviceNamespace;
}
/**
* Patch the top-level firebase namespace with additional properties.
*
* firebase.INTERNAL.extendNamespace()
*/
function extendNamespace(props) {
deepExtend(namespace, props);
}
function callAppHooks(app, eventName) {
Object.keys(factories).forEach(function (serviceName) {
// Ignore virtual services
var factoryName = useAsService(app, serviceName);
if (factoryName === null) {
return;
}
if (appHooks[factoryName]) {
appHooks[factoryName](eventName, app);
}
});
}
// Map the requested service to a registered service name
// (used to map auth to serverAuth service when needed).
function useAsService(app, name) {
if (name === 'serverAuth') {
return null;
}
var useService = name;
var options = app.options;
return useService;
}
return namespace;
}
function error(code, args) {
throw appErrors.create(code, args);
}
// TypeScript does not support non-string indexes!
// let errors: {[code: AppError: string} = {
var errors = {
'no-app': "No Firebase App '{$name}' has been created - " +
'call Firebase App.initializeApp()',
'bad-app-name': "Illegal App name: '{$name}",
'duplicate-app': "Firebase App named '{$name}' already exists",
'app-deleted': "Firebase App named '{$name}' already deleted",
'duplicate-service': "Firebase service named '{$name}' already registered",
'sa-not-supported': 'Initializing the Firebase SDK with a service ' +
'account is only allowed in a Node.js environment. On client ' +
'devices, you should instead initialize the SDK with an api key and ' +
'auth domain',
'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' +
'Firebase App instance.'
};
var appErrors = new ErrorFactory('app', 'Firebase', errors);
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var firebase = createFirebaseNamespace();
export default firebase;
export { firebase };

View File

@ -0,0 +1,412 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var util = require('@firebase/util');
var Storage = _interopDefault(require('dom-storage'));
var xmlhttprequest = require('xmlhttprequest');
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var contains = function (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
};
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
// An array to capture listeners before the true auth functions
// exist
var tokenListeners = [];
/**
* Global context object for a collection of services using
* a shared authentication state.
*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.services_ = {};
this.name_ = config.name;
this._automaticDataCollectionEnabled =
config.automaticDataCollectionEnabled || false;
this.options_ = util.deepCopy(options);
this.INTERNAL = {
getUid: function () { return null; },
getToken: function () { return Promise.resolve(null); },
addAuthTokenListener: function (callback) {
tokenListeners.push(callback);
// Make sure callback is called, asynchronously, in the absence of the auth module
setTimeout(function () { return callback(null); }, 0);
},
removeAuthTokenListener: function (callback) {
tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; });
}
};
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed_();
return this._automaticDataCollectionEnabled;
},
set: function (val) {
this.checkDestroyed_();
this._automaticDataCollectionEnabled = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed_();
return this.name_;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed_();
return this.options_;
},
enumerable: true,
configurable: true
});
FirebaseAppImpl.prototype.delete = function () {
var _this = this;
return new Promise(function (resolve) {
_this.checkDestroyed_();
resolve();
})
.then(function () {
_this.firebase_.INTERNAL.removeApp(_this.name_);
var services = [];
Object.keys(_this.services_).forEach(function (serviceKey) {
Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) {
services.push(_this.services_[serviceKey][instanceKey]);
});
});
return Promise.all(services.map(function (service) {
return service.INTERNAL.delete();
}));
})
.then(function () {
_this.isDeleted_ = true;
_this.services_ = {};
});
};
/**
* Return a service instance associated with this app (creating it
* on demand), identified by the passed instanceIdentifier.
*
* NOTE: Currently storage is the only one that is leveraging this
* functionality. They invoke it by calling:
*
* ```javascript
* firebase.app().storage('STORAGE BUCKET ID')
* ```
*
* The service name is passed to this already
* @internal
*/
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
this.checkDestroyed_();
if (!this.services_[name]) {
this.services_[name] = {};
}
if (!this.services_[name][instanceIdentifier]) {
/**
* If a custom instance has been defined (i.e. not '[DEFAULT]')
* then we will pass that instance on, otherwise we pass `null`
*/
var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME
? instanceIdentifier
: undefined;
var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier);
this.services_[name][instanceIdentifier] = service;
}
return this.services_[name][instanceIdentifier];
};
/**
* Callback function used to extend an App instance at the time
* of service instance creation.
*/
FirebaseAppImpl.prototype.extendApp = function (props) {
var _this = this;
// Copy the object onto the FirebaseAppImpl prototype
util.deepExtend(this, props);
/**
* If the app has overwritten the addAuthTokenListener stub, forward
* the active token listeners on to the true fxn.
*
* TODO: This function is required due to our current module
* structure. Once we are able to rely strictly upon a single module
* implementation, this code should be refactored and Auth should
* provide these stubs and the upgrade logic
*/
if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) {
tokenListeners.forEach(function (listener) {
_this.INTERNAL.addAuthTokenListener(listener);
});
tokenListeners = [];
}
};
/**
* This function will throw an Error if the App has already been deleted -
* use before performing API actions on the App.
*/
FirebaseAppImpl.prototype.checkDestroyed_ = function () {
if (this.isDeleted_) {
error('app-deleted', { name: this.name_ });
}
};
return FirebaseAppImpl;
}());
// Prevent dead-code elimination of these methods w/o invalid property
// copying.
(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
FirebaseAppImpl.prototype.delete ||
console.log('dc');
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
function createFirebaseNamespace() {
var apps_ = {};
var factories = {};
var appHooks = {};
// A namespace is a plain JavaScript Object.
var namespace = {
// Hack to prevent Babel from modifying the object returned
// as the firebase namespace.
__esModule: true,
initializeApp: initializeApp,
app: app,
apps: null,
Promise: Promise,
SDK_VERSION: '5.5.9',
INTERNAL: {
registerService: registerService,
createFirebaseNamespace: createFirebaseNamespace,
extendNamespace: extendNamespace,
createSubscribe: util.createSubscribe,
ErrorFactory: util.ErrorFactory,
removeApp: removeApp,
factories: factories,
useAsService: useAsService,
Promise: Promise,
deepExtend: util.deepExtend
}
};
// Inject a circular default export to allow Babel users who were previously
// using:
//
// import firebase from 'firebase';
// which becomes: var firebase = require('firebase').default;
//
// instead of
//
// import * as firebase from 'firebase';
// which becomes: var firebase = require('firebase');
util.patchProperty(namespace, 'default', namespace);
// firebase.apps is a read-only getter.
Object.defineProperty(namespace, 'apps', {
get: getApps
});
/**
* Called by App.delete() - but before any services associated with the App
* are deleted.
*/
function removeApp(name) {
var app = apps_[name];
callAppHooks(app, 'delete');
delete apps_[name];
}
/**
* Get the App object for a given name (or DEFAULT).
*/
function app(name) {
name = name || DEFAULT_ENTRY_NAME;
if (!contains(apps_, name)) {
error('no-app', { name: name });
}
return apps_[name];
}
util.patchProperty(app, 'App', FirebaseAppImpl);
function initializeApp(options, rawConfig) {
if (rawConfig === void 0) { rawConfig = {}; }
if (typeof rawConfig !== 'object' || rawConfig === null) {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
}
var config = rawConfig;
if (config.name === undefined) {
config.name = DEFAULT_ENTRY_NAME;
}
var name = config.name;
if (typeof name !== 'string' || !name) {
error('bad-app-name', { name: name + '' });
}
if (contains(apps_, name)) {
error('duplicate-app', { name: name });
}
var app = new FirebaseAppImpl(options, config, namespace);
apps_[name] = app;
callAppHooks(app, 'create');
return app;
}
/*
* Return an array of all the non-deleted FirebaseApps.
*/
function getApps() {
// Make a copy so caller cannot mutate the apps list.
return Object.keys(apps_).map(function (name) { return apps_[name]; });
}
/*
* Register a Firebase Service.
*
* firebase.INTERNAL.registerService()
*
* TODO: Implement serviceProperties.
*/
function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) {
// Cannot re-register a service that already exists
if (factories[name]) {
error('duplicate-service', { name: name });
}
// Capture the service factory for later service instantiation
factories[name] = createService;
// Capture the appHook, if passed
if (appHook) {
appHooks[name] = appHook;
// Run the **new** app hook on all existing apps
getApps().forEach(function (app) {
appHook('create', app);
});
}
// The Service namespace is an accessor function ...
var serviceNamespace = function (appArg) {
if (appArg === void 0) { appArg = app(); }
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
error('invalid-app-argument', { name: name });
}
// Forward service instance lookup to the FirebaseApp.
return appArg[name]();
};
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
util.deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
FirebaseAppImpl.prototype[name] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, name);
return serviceFxn.apply(this, allowMultipleInstances ? args : []);
};
return serviceNamespace;
}
/**
* Patch the top-level firebase namespace with additional properties.
*
* firebase.INTERNAL.extendNamespace()
*/
function extendNamespace(props) {
util.deepExtend(namespace, props);
}
function callAppHooks(app, eventName) {
Object.keys(factories).forEach(function (serviceName) {
// Ignore virtual services
var factoryName = useAsService(app, serviceName);
if (factoryName === null) {
return;
}
if (appHooks[factoryName]) {
appHooks[factoryName](eventName, app);
}
});
}
// Map the requested service to a registered service name
// (used to map auth to serverAuth service when needed).
function useAsService(app, name) {
if (name === 'serverAuth') {
return null;
}
var useService = name;
var options = app.options;
return useService;
}
return namespace;
}
function error(code, args) {
throw appErrors.create(code, args);
}
// TypeScript does not support non-string indexes!
// let errors: {[code: AppError: string} = {
var errors = {
'no-app': "No Firebase App '{$name}' has been created - " +
'call Firebase App.initializeApp()',
'bad-app-name': "Illegal App name: '{$name}",
'duplicate-app': "Firebase App named '{$name}' already exists",
'app-deleted': "Firebase App named '{$name}' already deleted",
'duplicate-service': "Firebase service named '{$name}' already registered",
'sa-not-supported': 'Initializing the Firebase SDK with a service ' +
'account is only allowed in a Node.js environment. On client ' +
'devices, you should instead initialize the SDK with an api key and ' +
'auth domain',
'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' +
'Firebase App instance.'
};
var appErrors = new util.ErrorFactory('app', 'Firebase', errors);
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var _firebase = createFirebaseNamespace();
_firebase.INTERNAL.extendNamespace({
INTERNAL: {
node: {
localStorage: new Storage(null, { strict: true }),
sessionStorage: new Storage(null, { strict: true }),
XMLHttpRequest: xmlhttprequest.XMLHttpRequest
}
}
});
var firebase = _firebase;
exports.firebase = firebase;
exports.default = firebase;

View File

@ -0,0 +1,18 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { FirebaseNamespace } from '@firebase/app-types';
export declare const firebase: FirebaseNamespace;
export default firebase;

View File

@ -0,0 +1,412 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var util = require('@firebase/util');
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var contains = function (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
};
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
// An array to capture listeners before the true auth functions
// exist
var tokenListeners = [];
/**
* Global context object for a collection of services using
* a shared authentication state.
*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.services_ = {};
this.name_ = config.name;
this._automaticDataCollectionEnabled =
config.automaticDataCollectionEnabled || false;
this.options_ = util.deepCopy(options);
this.INTERNAL = {
getUid: function () { return null; },
getToken: function () { return Promise.resolve(null); },
addAuthTokenListener: function (callback) {
tokenListeners.push(callback);
// Make sure callback is called, asynchronously, in the absence of the auth module
setTimeout(function () { return callback(null); }, 0);
},
removeAuthTokenListener: function (callback) {
tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; });
}
};
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed_();
return this._automaticDataCollectionEnabled;
},
set: function (val) {
this.checkDestroyed_();
this._automaticDataCollectionEnabled = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed_();
return this.name_;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed_();
return this.options_;
},
enumerable: true,
configurable: true
});
FirebaseAppImpl.prototype.delete = function () {
var _this = this;
return new Promise(function (resolve) {
_this.checkDestroyed_();
resolve();
})
.then(function () {
_this.firebase_.INTERNAL.removeApp(_this.name_);
var services = [];
Object.keys(_this.services_).forEach(function (serviceKey) {
Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) {
services.push(_this.services_[serviceKey][instanceKey]);
});
});
return Promise.all(services.map(function (service) {
return service.INTERNAL.delete();
}));
})
.then(function () {
_this.isDeleted_ = true;
_this.services_ = {};
});
};
/**
* Return a service instance associated with this app (creating it
* on demand), identified by the passed instanceIdentifier.
*
* NOTE: Currently storage is the only one that is leveraging this
* functionality. They invoke it by calling:
*
* ```javascript
* firebase.app().storage('STORAGE BUCKET ID')
* ```
*
* The service name is passed to this already
* @internal
*/
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
this.checkDestroyed_();
if (!this.services_[name]) {
this.services_[name] = {};
}
if (!this.services_[name][instanceIdentifier]) {
/**
* If a custom instance has been defined (i.e. not '[DEFAULT]')
* then we will pass that instance on, otherwise we pass `null`
*/
var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME
? instanceIdentifier
: undefined;
var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier);
this.services_[name][instanceIdentifier] = service;
}
return this.services_[name][instanceIdentifier];
};
/**
* Callback function used to extend an App instance at the time
* of service instance creation.
*/
FirebaseAppImpl.prototype.extendApp = function (props) {
var _this = this;
// Copy the object onto the FirebaseAppImpl prototype
util.deepExtend(this, props);
/**
* If the app has overwritten the addAuthTokenListener stub, forward
* the active token listeners on to the true fxn.
*
* TODO: This function is required due to our current module
* structure. Once we are able to rely strictly upon a single module
* implementation, this code should be refactored and Auth should
* provide these stubs and the upgrade logic
*/
if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) {
tokenListeners.forEach(function (listener) {
_this.INTERNAL.addAuthTokenListener(listener);
});
tokenListeners = [];
}
};
/**
* This function will throw an Error if the App has already been deleted -
* use before performing API actions on the App.
*/
FirebaseAppImpl.prototype.checkDestroyed_ = function () {
if (this.isDeleted_) {
error('app-deleted', { name: this.name_ });
}
};
return FirebaseAppImpl;
}());
// Prevent dead-code elimination of these methods w/o invalid property
// copying.
(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
FirebaseAppImpl.prototype.delete ||
console.log('dc');
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
function createFirebaseNamespace() {
var apps_ = {};
var factories = {};
var appHooks = {};
// A namespace is a plain JavaScript Object.
var namespace = {
// Hack to prevent Babel from modifying the object returned
// as the firebase namespace.
__esModule: true,
initializeApp: initializeApp,
app: app,
apps: null,
Promise: Promise,
SDK_VERSION: '5.5.9',
INTERNAL: {
registerService: registerService,
createFirebaseNamespace: createFirebaseNamespace,
extendNamespace: extendNamespace,
createSubscribe: util.createSubscribe,
ErrorFactory: util.ErrorFactory,
removeApp: removeApp,
factories: factories,
useAsService: useAsService,
Promise: Promise,
deepExtend: util.deepExtend
}
};
// Inject a circular default export to allow Babel users who were previously
// using:
//
// import firebase from 'firebase';
// which becomes: var firebase = require('firebase').default;
//
// instead of
//
// import * as firebase from 'firebase';
// which becomes: var firebase = require('firebase');
util.patchProperty(namespace, 'default', namespace);
// firebase.apps is a read-only getter.
Object.defineProperty(namespace, 'apps', {
get: getApps
});
/**
* Called by App.delete() - but before any services associated with the App
* are deleted.
*/
function removeApp(name) {
var app = apps_[name];
callAppHooks(app, 'delete');
delete apps_[name];
}
/**
* Get the App object for a given name (or DEFAULT).
*/
function app(name) {
name = name || DEFAULT_ENTRY_NAME;
if (!contains(apps_, name)) {
error('no-app', { name: name });
}
return apps_[name];
}
util.patchProperty(app, 'App', FirebaseAppImpl);
function initializeApp(options, rawConfig) {
if (rawConfig === void 0) { rawConfig = {}; }
if (typeof rawConfig !== 'object' || rawConfig === null) {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
}
var config = rawConfig;
if (config.name === undefined) {
config.name = DEFAULT_ENTRY_NAME;
}
var name = config.name;
if (typeof name !== 'string' || !name) {
error('bad-app-name', { name: name + '' });
}
if (contains(apps_, name)) {
error('duplicate-app', { name: name });
}
var app = new FirebaseAppImpl(options, config, namespace);
apps_[name] = app;
callAppHooks(app, 'create');
return app;
}
/*
* Return an array of all the non-deleted FirebaseApps.
*/
function getApps() {
// Make a copy so caller cannot mutate the apps list.
return Object.keys(apps_).map(function (name) { return apps_[name]; });
}
/*
* Register a Firebase Service.
*
* firebase.INTERNAL.registerService()
*
* TODO: Implement serviceProperties.
*/
function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) {
// Cannot re-register a service that already exists
if (factories[name]) {
error('duplicate-service', { name: name });
}
// Capture the service factory for later service instantiation
factories[name] = createService;
// Capture the appHook, if passed
if (appHook) {
appHooks[name] = appHook;
// Run the **new** app hook on all existing apps
getApps().forEach(function (app) {
appHook('create', app);
});
}
// The Service namespace is an accessor function ...
var serviceNamespace = function (appArg) {
if (appArg === void 0) { appArg = app(); }
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
error('invalid-app-argument', { name: name });
}
// Forward service instance lookup to the FirebaseApp.
return appArg[name]();
};
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
util.deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
FirebaseAppImpl.prototype[name] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, name);
return serviceFxn.apply(this, allowMultipleInstances ? args : []);
};
return serviceNamespace;
}
/**
* Patch the top-level firebase namespace with additional properties.
*
* firebase.INTERNAL.extendNamespace()
*/
function extendNamespace(props) {
util.deepExtend(namespace, props);
}
function callAppHooks(app, eventName) {
Object.keys(factories).forEach(function (serviceName) {
// Ignore virtual services
var factoryName = useAsService(app, serviceName);
if (factoryName === null) {
return;
}
if (appHooks[factoryName]) {
appHooks[factoryName](eventName, app);
}
});
}
// Map the requested service to a registered service name
// (used to map auth to serverAuth service when needed).
function useAsService(app, name) {
if (name === 'serverAuth') {
return null;
}
var useService = name;
var options = app.options;
return useService;
}
return namespace;
}
function error(code, args) {
throw appErrors.create(code, args);
}
// TypeScript does not support non-string indexes!
// let errors: {[code: AppError: string} = {
var errors = {
'no-app': "No Firebase App '{$name}' has been created - " +
'call Firebase App.initializeApp()',
'bad-app-name': "Illegal App name: '{$name}",
'duplicate-app': "Firebase App named '{$name}' already exists",
'app-deleted': "Firebase App named '{$name}' already deleted",
'duplicate-service': "Firebase service named '{$name}' already registered",
'sa-not-supported': 'Initializing the Firebase SDK with a service ' +
'account is only allowed in a Node.js environment. On client ' +
'devices, you should instead initialize the SDK with an api key and ' +
'auth domain',
'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' +
'Firebase App instance.'
};
var appErrors = new util.ErrorFactory('app', 'Firebase', errors);
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* To avoid having to include the @types/react-native package, which breaks
* some of our tests because of duplicate symbols, we are using require syntax
* here
*/
var AsyncStorage = require('react-native').AsyncStorage;
var _firebase = createFirebaseNamespace();
_firebase.INTERNAL.extendNamespace({
INTERNAL: {
reactNative: {
AsyncStorage: AsyncStorage
}
}
});
var firebase = _firebase;
exports.firebase = firebase;
exports.default = firebase;

View File

@ -0,0 +1,18 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { FirebaseNamespace } from '@firebase/app-types';
export declare const firebase: FirebaseNamespace;
export default firebase;

View File

@ -0,0 +1,24 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { FirebaseNamespace } from '@firebase/app-types';
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
export declare function createFirebaseNamespace(): FirebaseNamespace;

View File

@ -0,0 +1 @@
export {};

104
functions/node_modules/@firebase/app/package.json generated vendored Normal file
View File

@ -0,0 +1,104 @@
{
"_from": "@firebase/app@^0.3.1",
"_id": "@firebase/app@0.3.5",
"_inBundle": false,
"_integrity": "sha512-DaAlb74yzwXbkFXvfsUVFeurSETPJAvKNtVpAKlS6RThyD+Y+ci1/8JVw4INm2hihbj/edxlAUelg9eoOZNCKA==",
"_location": "/@firebase/app",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@firebase/app@^0.3.1",
"name": "@firebase/app",
"escapedName": "@firebase%2fapp",
"scope": "@firebase",
"rawSpec": "^0.3.1",
"saveSpec": null,
"fetchSpec": "^0.3.1"
},
"_requiredBy": [
"/firebase-admin"
],
"_resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.3.5.tgz",
"_shasum": "7011ab5a16604d6c1b2964d513b88c61a0a5387c",
"_spec": "@firebase/app@^0.3.1",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\firebase-admin",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"browser": "dist/index.cjs.js",
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"dependencies": {
"@firebase/app-types": "0.3.2",
"@firebase/util": "0.2.3",
"dom-storage": "2.1.0",
"tslib": "1.9.0",
"xmlhttprequest": "1.8.0"
},
"deprecated": false,
"description": "The primary entrypoint to the Firebase JS SDK",
"devDependencies": {
"@types/chai": "4.1.2",
"@types/mocha": "5.0.0",
"@types/sinon": "4.3.1",
"chai": "4.1.2",
"karma": "2.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.4.2",
"karma-firefox-launcher": "1.1.0",
"karma-mocha": "1.3.0",
"karma-sauce-launcher": "1.2.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "2.0.9",
"mocha": "5.2.0",
"npm-run-all": "4.1.2",
"nyc": "11.6.0",
"rollup": "0.57.1",
"rollup-plugin-commonjs": "9.1.0",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-replace": "2.0.0",
"rollup-plugin-typescript2": "0.12.0",
"sinon": "4.5.0",
"source-map-loader": "0.2.3",
"ts-loader": "3.5.0",
"ts-node": "5.0.1",
"typescript": "2.8.1",
"webpack": "3.11.0"
},
"files": [
"dist"
],
"license": "Apache-2.0",
"main": "dist/index.node.cjs.js",
"module": "dist/index.esm.js",
"name": "@firebase/app",
"nyc": {
"extension": [
".ts"
],
"reportDir": "./coverage/node"
},
"react-native": "dist/index.rn.cjs.js",
"repository": {
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk/tree/master/packages/app"
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"prepare": "npm run build",
"test": "run-p test:browser test:node",
"test:browser": "karma start --single-run",
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register/type-check --exit"
},
"typings": "dist/index.d.ts",
"version": "0.3.5"
}

View File

@ -0,0 +1,3 @@
# @firebase/database-types
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

View File

@ -0,0 +1,133 @@
/**
* Copyright 2017 Google Inc.
*
* 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';
export interface DataSnapshot {
child(path: string): DataSnapshot;
exists(): boolean;
exportVal(): any;
forEach(action: (a: DataSnapshot) => boolean | void): boolean;
getPriority(): string | number | null;
hasChild(path: string): boolean;
hasChildren(): boolean;
key: string | null;
numChildren(): number;
ref: Reference;
toJSON(): Object | null;
val(): any;
}
export class FirebaseDatabase {
private constructor();
app: FirebaseApp;
goOffline(): void;
goOnline(): void;
ref(path?: string | Reference): Reference;
refFromURL(url: string): Reference;
}
export interface OnDisconnect {
cancel(onComplete?: (a: Error | null) => any): Promise<void>;
remove(onComplete?: (a: Error | null) => any): Promise<void>;
set(value: any, onComplete?: (a: Error | null) => any): Promise<void>;
setWithPriority(
value: any,
priority: number | string | null,
onComplete?: (a: Error | null) => any
): Promise<any>;
update(values: Object, onComplete?: (a: Error | null) => any): Promise<any>;
}
type EventType =
| 'value'
| 'child_added'
| 'child_changed'
| 'child_moved'
| 'child_removed';
export interface Query {
endAt(value: number | string | boolean | null, key?: string): Query;
equalTo(value: number | string | boolean | null, key?: string): Query;
isEqual(other: Query | null): boolean;
limitToFirst(limit: number): Query;
limitToLast(limit: number): Query;
off(
eventType?: EventType,
callback?: (a: DataSnapshot, b?: string | null) => any,
context?: Object | null
): any;
on(
eventType: EventType,
callback: (a: DataSnapshot | null, b?: string) => any,
cancelCallbackOrContext?: Object | null,
context?: Object | null
): (a: DataSnapshot | null, b?: string) => any;
once(
eventType: EventType,
successCallback?: (a: DataSnapshot, b?: string) => any,
failureCallbackOrContext?: Object | null,
context?: Object | null
): Promise<DataSnapshot>;
orderByChild(path: string): Query;
orderByKey(): Query;
orderByPriority(): Query;
orderByValue(): Query;
ref: Reference;
startAt(value: number | string | boolean | null, key?: string): Query;
toJSON(): Object;
toString(): string;
}
export interface Reference extends Query {
child(path: string): Reference;
key: string | null;
onDisconnect(): OnDisconnect;
parent: Reference | null;
push(value?: any, onComplete?: (a: Error | null) => any): ThenableReference;
remove(onComplete?: (a: Error | null) => any): Promise<any>;
root: Reference;
set(value: any, onComplete?: (a: Error | null) => any): Promise<any>;
setPriority(
priority: string | number | null,
onComplete: (a: Error | null) => any
): Promise<any>;
setWithPriority(
newVal: any,
newPriority: string | number | null,
onComplete?: (a: Error | null) => any
): Promise<any>;
transaction(
transactionUpdate: (a: any) => any,
onComplete?: (a: Error | null, b: boolean, c: DataSnapshot | null) => any,
applyLocally?: boolean
): Promise<any>;
update(values: Object, onComplete?: (a: Error | null) => any): Promise<any>;
}
export interface ServerValue {
TIMESTAMP: {
'.sv': string;
};
}
export interface ThenableReference extends Reference, PromiseLike<Reference> {}
export function enableLogging(
logger?: boolean | ((a: string) => any),
persistent?: boolean
): any;

View File

@ -0,0 +1,56 @@
{
"_from": "@firebase/database-types@0.3.2",
"_id": "@firebase/database-types@0.3.2",
"_inBundle": false,
"_integrity": "sha512-9ZYdvYQ6r3aaHJarhUM5Hf6lQWu3ZJme+RR0o8qfBb9L04TL3uNjt+AJFku1ysVPntTn+9GqJjiIB2/OC3JtwA==",
"_location": "/@firebase/database-types",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@firebase/database-types@0.3.2",
"name": "@firebase/database-types",
"escapedName": "@firebase%2fdatabase-types",
"scope": "@firebase",
"rawSpec": "0.3.2",
"saveSpec": null,
"fetchSpec": "0.3.2"
},
"_requiredBy": [
"/@firebase/database"
],
"_resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.3.2.tgz",
"_shasum": "70611a64dd460e0e253c7427f860d56a1afd86fe",
"_spec": "@firebase/database-types@0.3.2",
"_where": "C:\\Users\\jlevi\\Downloads\\tr2022-strategy-master\\tr2022-strategy-master\\data analysis\\functions\\node_modules\\@firebase\\database",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "@firebase/database Types",
"devDependencies": {
"typescript": "2.8.1"
},
"files": [
"index.d.ts"
],
"license": "Apache-2.0",
"name": "@firebase/database-types",
"peerDependencies": {
"@firebase/app-types": "0.x"
},
"repository": {
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk/tree/master/packages/database-types"
},
"scripts": {
"test": "tsc"
},
"version": "0.3.2"
}

5
functions/node_modules/@firebase/database/README.md generated vendored Normal file
View File

@ -0,0 +1,5 @@
# @firebase/database
This is the Firebase Realtime Database component of the Firebase JS SDK.
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
import { FirebaseNamespace } from '@firebase/app-types';
import { Database } from './src/api/Database';
import { Query } from './src/api/Query';
import { Reference } from './src/api/Reference';
import { enableLogging } from './src/core/util/util';
import * as types from '@firebase/database-types';
declare const ServerValue: {
TIMESTAMP: {
'.sv': string;
};
};
export declare function registerDatabase(instance: FirebaseNamespace): void;
export { Database, Query, Reference, enableLogging, ServerValue };
export { DataSnapshot } from './src/api/DataSnapshot';
export { OnDisconnect } from './src/api/onDisconnect';
declare module '@firebase/app-types' {
interface FirebaseNamespace {
database?: {
(app?: FirebaseApp): types.FirebaseDatabase;
enableLogging: typeof types.enableLogging;
ServerValue: types.ServerValue;
Database: typeof types.FirebaseDatabase;
};
}
interface FirebaseApp {
database?(databaseURL?: string): types.FirebaseDatabase;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
import { FirebaseNamespace } from '@firebase/app-types';
import { Database } from './src/api/Database';
import { Query } from './src/api/Query';
import { Reference } from './src/api/Reference';
import { enableLogging } from './src/core/util/util';
import * as INTERNAL from './src/api/internal';
import * as TEST_ACCESS from './src/api/test_access';
import './src/nodePatches';
import * as types from '@firebase/database-types';
/**
* A one off register function which returns a database based on the app and
* passed database URL.
*
* @param app A valid FirebaseApp-like object
* @param url A valid Firebase databaseURL
*/
declare const ServerValue: {
TIMESTAMP: {
'.sv': string;
};
};
export declare function initStandalone(app: any, url: any, version?: string): {
instance: Database;
namespace: {
Reference: typeof Reference;
Query: typeof Query;
Database: typeof Database;
enableLogging: (logger_?: boolean | ((a: string) => void), persistent?: boolean) => void;
INTERNAL: typeof INTERNAL;
ServerValue: {
TIMESTAMP: {
'.sv': string;
};
};
TEST_ACCESS: typeof TEST_ACCESS;
};
};
export declare function registerDatabase(instance: FirebaseNamespace): void;
export { Database, Query, Reference, enableLogging, ServerValue };
export { DataSnapshot } from './src/api/DataSnapshot';
export { OnDisconnect } from './src/api/onDisconnect';
declare module '@firebase/app-types' {
interface FirebaseNamespace {
database?: {
(app?: FirebaseApp): types.FirebaseDatabase;
enableLogging: typeof types.enableLogging;
ServerValue: types.ServerValue;
Database: typeof types.FirebaseDatabase;
};
}
interface FirebaseApp {
database?(): types.FirebaseDatabase;
}
}

View File

@ -0,0 +1,28 @@
import { FirebaseNamespace } from '@firebase/app-types';
import { Database } from './src/api/Database';
import { Query } from './src/api/Query';
import { Reference } from './src/api/Reference';
import { enableLogging } from './src/core/util/util';
import * as types from '@firebase/database-types';
declare const ServerValue: {
TIMESTAMP: {
'.sv': string;
};
};
export declare function registerDatabase(instance: FirebaseNamespace): void;
export { Database, Query, Reference, enableLogging, ServerValue };
export { DataSnapshot } from './src/api/DataSnapshot';
export { OnDisconnect } from './src/api/onDisconnect';
declare module '@firebase/app-types' {
interface FirebaseNamespace {
database?: {
(app?: FirebaseApp): types.FirebaseDatabase;
enableLogging: typeof types.enableLogging;
ServerValue: types.ServerValue;
Database: typeof types.FirebaseDatabase;
};
}
interface FirebaseApp {
database?(databaseURL?: string): types.FirebaseDatabase;
}
}

View File

@ -0,0 +1,16 @@
import { Reference } from './Reference';
/**
* INTERNAL methods for internal-use only (tests, etc.).
*
* Customers shouldn't use these or else should be aware that they could break at any time.
*
* @const
*/
export declare const forceLongPolling: () => void;
export declare const forceWebSockets: () => void;
export declare const isWebSocketsAvailable: () => boolean;
export declare const setSecurityDebugCallback: (ref: Reference, callback: (a: Object) => void) => void;
export declare const stats: (ref: Reference, showDelta?: boolean) => void;
export declare const statsIncrementCounter: (ref: Reference, metric: string) => void;
export declare const dataUpdateCount: (ref: Reference) => number;
export declare const interceptServerData: (ref: Reference, callback: (a: string, b: any) => void) => void;

View File

@ -0,0 +1,46 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { RepoInfo } from '../core/RepoInfo';
import { PersistentConnection } from '../core/PersistentConnection';
import { Connection } from '../realtime/Connection';
import { Query } from './Query';
export declare const DataConnection: typeof PersistentConnection;
export declare const RealTimeConnection: typeof Connection;
/**
* @param {function(): string} newHash
* @return {function()}
*/
export declare const hijackHash: (newHash: () => string) => () => void;
/**
* @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined}
*/
export declare const ConnectionTarget: typeof RepoInfo;
/**
* @param {!Query} query
* @return {!string}
*/
export declare const queryIdentifier: (query: Query) => string;
/**
* @param {!Query} firebaseRef
* @return {!Object}
*/
export declare const listens: (firebaseRef: Query) => any;
/**
* Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.
*
* @param {boolean} forceRestClient
*/
export declare const forceRestClient: (forceRestClient: boolean) => void;

View File

@ -0,0 +1,194 @@
import { ServerActions } from './ServerActions';
import { AuthTokenProvider } from './AuthTokenProvider';
import { RepoInfo } from './RepoInfo';
import { Query } from '../api/Query';
/**
* Firebase connection. Abstracts wire protocol and handles reconnecting.
*
* NOTE: All JSON objects sent to the realtime connection must have property names enclosed
* in quotes to make sure the closure compiler does not minify them.
*/
export declare class PersistentConnection extends ServerActions {
private repoInfo_;
private onDataUpdate_;
private onConnectStatus_;
private onServerInfoUpdate_;
private authTokenProvider_;
private authOverride_;
id: number;
private log_;
/** @private {Object} */
private interruptReasons_;
private listens_;
private outstandingPuts_;
private outstandingPutCount_;
private onDisconnectRequestQueue_;
private connected_;
private reconnectDelay_;
private maxReconnectDelay_;
private securityDebugCallback_;
lastSessionId: string | null;
/** @private {number|null} */
private establishConnectionTimer_;
/** @private {boolean} */
private visible_;
private requestCBHash_;
private requestNumber_;
/** @private {?{
* sendRequest(Object),
* close()
* }} */
private realtime_;
/** @private {string|null} */
private authToken_;
private forceTokenRefresh_;
private invalidAuthTokenCount_;
private firstConnection_;
private lastConnectionAttemptTime_;
private lastConnectionEstablishedTime_;
/**
* @private
*/
private static nextPersistentConnectionId_;
/**
* Counter for number of connections created. Mainly used for tagging in the logs
* @type {number}
* @private
*/
private static nextConnectionId_;
/**
* @implements {ServerActions}
* @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to
* @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server
* @param onConnectStatus_
* @param onServerInfoUpdate_
* @param authTokenProvider_
* @param authOverride_
*/
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: any, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: any) => void, authTokenProvider_: AuthTokenProvider, authOverride_?: Object | null);
/**
* @param {!string} action
* @param {*} body
* @param {function(*)=} onResponse
* @protected
*/
protected sendRequest(action: string, body: any, onResponse?: (a: any) => void): void;
/**
* @inheritDoc
*/
listen(query: Query, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: any) => void): void;
/**
* @param {!{onComplete(),
* hashFn():!string,
* query: !Query,
* tag: ?number}} listenSpec
* @private
*/
private sendListen_(listenSpec);
/**
* @param {*} payload
* @param {!Query} query
* @private
*/
private static warnOnListenWarnings_(payload, query);
/**
* @inheritDoc
*/
refreshAuthToken(token: string): void;
/**
* @param {!string} credential
* @private
*/
private reduceReconnectDelayIfAdminCredential_(credential);
/**
* Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like
* a auth revoked (the connection is closed).
*/
tryAuth(): void;
/**
* @inheritDoc
*/
unlisten(query: Query, tag: number | null): void;
private sendUnlisten_(pathString, queryId, queryObj, tag);
/**
* @inheritDoc
*/
onDisconnectPut(pathString: string, data: any, onComplete?: (a: string, b: string) => void): void;
/**
* @inheritDoc
*/
onDisconnectMerge(pathString: string, data: any, onComplete?: (a: string, b: string) => void): void;
/**
* @inheritDoc
*/
onDisconnectCancel(pathString: string, onComplete?: (a: string, b: string) => void): void;
private sendOnDisconnect_(action, pathString, data, onComplete);
/**
* @inheritDoc
*/
put(pathString: string, data: any, onComplete?: (a: string, b: string) => void, hash?: string): void;
/**
* @inheritDoc
*/
merge(pathString: string, data: any, onComplete: (a: string, b: string | null) => void, hash?: string): void;
putInternal(action: string, pathString: string, data: any, onComplete: (a: string, b: string | null) => void, hash?: string): void;
private sendPut_(index);
/**
* @inheritDoc
*/
reportStats(stats: {
[k: string]: any;
}): void;
/**
* @param {*} message
* @private
*/
private onDataMessage_(message);
private onDataPush_(action, body);
private onReady_(timestamp, sessionId);
private scheduleConnect_(timeout);
/**
* @param {boolean} visible
* @private
*/
private onVisible_(visible);
private onOnline_(online);
private onRealtimeDisconnect_();
private establishConnection_();
/**
* @param {string} reason
*/
interrupt(reason: string): void;
/**
* @param {string} reason
*/
resume(reason: string): void;
private handleTimestamp_(timestamp);
private cancelSentTransactions_();
/**
* @param {!string} pathString
* @param {Array.<*>=} query
* @private
*/
private onListenRevoked_(pathString, query?);
/**
* @param {!string} pathString
* @param {!string} queryId
* @return {{queries:Array.<Query>, onComplete:function(string)}}
* @private
*/
private removeListen_(pathString, queryId);
private onAuthRevoked_(statusCode, explanation);
private onSecurityDebugPacket_(body);
private restoreState_();
/**
* Sends client stats for first connection
* @private
*/
private sendConnectStats_();
/**
* @return {boolean}
* @private
*/
private shouldReconnect_();
}

View File

@ -0,0 +1,56 @@
import { ServerActions } from './ServerActions';
import { RepoInfo } from './RepoInfo';
import { AuthTokenProvider } from './AuthTokenProvider';
import { Query } from '../api/Query';
/**
* An implementation of ServerActions that communicates with the server via REST requests.
* This is mostly useful for compatibility with crawlers, where we don't want to spin up a full
* persistent connection (using WebSockets or long-polling)
*/
export declare class ReadonlyRestClient extends ServerActions {
private repoInfo_;
private onDataUpdate_;
private authTokenProvider_;
reportStats(stats: {
[k: string]: any;
}): void;
/** @private {function(...[*])} */
private log_;
/**
* We don't actually need to track listens, except to prevent us calling an onComplete for a listen
* that's been removed. :-/
*
* @private {!Object.<string, !Object>}
*/
private listens_;
/**
* @param {!Query} query
* @param {?number=} tag
* @return {string}
* @private
*/
static getListenId_(query: Query, tag?: number | null): string;
/**
* @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to
* @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server
* @param {AuthTokenProvider} authTokenProvider_
* @implements {ServerActions}
*/
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: any, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider);
/** @inheritDoc */
listen(query: Query, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: any) => void): void;
/** @inheritDoc */
unlisten(query: Query, tag: number | null): void;
/** @inheritDoc */
refreshAuthToken(token: string): void;
/**
* Performs a REST request to the given path, with the provided query string parameters,
* and any auth credentials we have.
*
* @param {!string} pathString
* @param {!Object.<string, *>} queryStringParameters
* @param {?function(?number, *=)} callback
* @private
*/
private restRequest_(pathString, queryStringParameters, callback);
}

View File

@ -0,0 +1,64 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { Repo } from './Repo';
import './Repo_transaction';
import { Database } from '../api/Database';
import { RepoInfo } from './RepoInfo';
/**
* Creates and caches Repo instances.
*/
export declare class RepoManager {
/**
* @private {!Object.<string, Object<string, !fb.core.Repo>>}
*/
private repos_;
/**
* If true, new Repos will be created to use ReadonlyRestClient (for testing purposes).
* @private {boolean}
*/
private useRestClient_;
static getInstance(): RepoManager;
interrupt(): void;
resume(): void;
/**
* This function should only ever be called to CREATE a new database instance.
*
* @param {!FirebaseApp} app
* @return {!Database}
*/
databaseFromApp(app: FirebaseApp, url?: string): Database;
/**
* Remove the repo and make sure it is disconnected.
*
* @param {!Repo} repo
*/
deleteRepo(repo: Repo): void;
/**
* Ensures a repo doesn't already exist and then creates one using the
* provided app.
*
* @param {!RepoInfo} repoInfo The metadata about the Repo
* @param {!FirebaseApp} app
* @return {!Repo} The Repo object for the specified server / repoName.
*/
createRepo(repoInfo: RepoInfo, app: FirebaseApp): Repo;
/**
* Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos.
* @param {boolean} forceRestClient
*/
forceRestClient(forceRestClient: boolean): void;
}

View File

@ -0,0 +1,17 @@
import { DataSnapshot } from '../api/DataSnapshot';
import { Path } from './util/Path';
/**
* @enum {number}
*/
export declare enum TransactionStatus {
RUN = 0,
SENT = 1,
COMPLETED = 2,
SENT_NEEDS_ABORT = 3,
NEEDS_ABORT = 4,
}
declare module './Repo' {
interface Repo {
startTransaction(path: Path, transactionUpdate: (a: any) => void, onComplete: ((a: Error, b: boolean, c: DataSnapshot) => void) | null, applyLocally: boolean): void;
}
}

View File

@ -0,0 +1,80 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { Query } from '../api/Query';
/**
* Interface defining the set of actions that can be performed against the Firebase server
* (basically corresponds to our wire protocol).
*
* @interface
*/
export declare abstract class ServerActions {
/**
* @param {!Query} query
* @param {function():string} currentHashFn
* @param {?number} tag
* @param {function(string, *)} onComplete
*/
abstract listen(query: Query, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: any) => void): void;
/**
* Remove a listen.
*
* @param {!Query} query
* @param {?number} tag
*/
abstract unlisten(query: Query, tag: number | null): void;
/**
* @param {string} pathString
* @param {*} data
* @param {function(string, string)=} onComplete
* @param {string=} hash
*/
put(pathString: string, data: any, onComplete?: (a: string, b: string) => void, hash?: string): void;
/**
* @param {string} pathString
* @param {*} data
* @param {function(string, ?string)} onComplete
* @param {string=} hash
*/
merge(pathString: string, data: any, onComplete: (a: string, b: string | null) => void, hash?: string): void;
/**
* Refreshes the auth token for the current connection.
* @param {string} token The authentication token
*/
refreshAuthToken(token: string): void;
/**
* @param {string} pathString
* @param {*} data
* @param {function(string, string)=} onComplete
*/
onDisconnectPut(pathString: string, data: any, onComplete?: (a: string, b: string) => void): void;
/**
* @param {string} pathString
* @param {*} data
* @param {function(string, string)=} onComplete
*/
onDisconnectMerge(pathString: string, data: any, onComplete?: (a: string, b: string) => void): void;
/**
* @param {string} pathString
* @param {function(string, string)=} onComplete
*/
onDisconnectCancel(pathString: string, onComplete?: (a: string, b: string) => void): void;
/**
* @param {Object.<string, *>} stats
*/
reportStats(stats: {
[k: string]: any;
}): void;
}

View File

@ -0,0 +1,29 @@
/**
* Base class to be used if you want to emit events. Call the constructor with
* the set of allowed event names.
*/
export declare abstract class EventEmitter {
private allowedEvents_;
private listeners_;
/**
* @param {!Array.<string>} allowedEvents_
*/
constructor(allowedEvents_: Array<string>);
/**
* To be overridden by derived classes in order to fire an initial event when
* somebody subscribes for data.
*
* @param {!string} eventType
* @return {Array.<*>} Array of parameters to trigger initial event with.
*/
abstract getInitialEvent(eventType: string): any[];
/**
* To be called by derived classes to trigger events.
* @param {!string} eventType
* @param {...*} var_args
*/
protected trigger(eventType: string, ...var_args: any[]): void;
on(eventType: string, callback: (a: any) => void, context: any): void;
off(eventType: string, callback: (a: any) => void, context: any): void;
private validateEventType_(eventType);
}

View File

@ -0,0 +1,24 @@
import { EventEmitter } from './EventEmitter';
/**
* Monitors online state (as reported by window.online/offline events).
*
* The expectation is that this could have many false positives (thinks we are online
* when we're not), but no false negatives. So we can safely use it to determine when
* we definitely cannot reach the internet.
*
* @extends {EventEmitter}
*/
export declare class OnlineMonitor extends EventEmitter {
private online_;
static getInstance(): OnlineMonitor;
constructor();
/**
* @param {!string} eventType
* @return {Array.<boolean>}
*/
getInitialEvent(eventType: string): boolean[];
/**
* @return {boolean}
*/
currentlyOnline(): boolean;
}

View File

@ -0,0 +1,118 @@
import { Path } from './Path';
/**
* Node in a Tree.
*/
export declare class TreeNode<T> {
children: {
[name: string]: TreeNode<T>;
};
childCount: number;
value: T | null;
}
/**
* A light-weight tree, traversable by path. Nodes can have both values and children.
* Nodes are not enumerated (by forEachChild) unless they have a value or non-empty
* children.
*/
export declare class Tree<T> {
private name_;
private parent_;
private node_;
/**
* @template T
* @param {string=} name_ Optional name of the node.
* @param {Tree=} parent_ Optional parent node.
* @param {TreeNode=} node_ Optional node to wrap.
*/
constructor(name_?: string, parent_?: Tree<T> | null, node_?: TreeNode<T>);
/**
* Returns a sub-Tree for the given path.
*
* @param {!(string|Path)} pathObj Path to look up.
* @return {!Tree.<T>} Tree for path.
*/
subTree(pathObj: string | Path): Tree<T>;
/**
* Returns the data associated with this tree node.
*
* @return {?T} The data or null if no data exists.
*/
getValue(): T | null;
/**
* Sets data to this tree node.
*
* @param {!T} value Value to set.
*/
setValue(value: T): void;
/**
* Clears the contents of the tree node (its value and all children).
*/
clear(): void;
/**
* @return {boolean} Whether the tree has any children.
*/
hasChildren(): boolean;
/**
* @return {boolean} Whether the tree is empty (no value or children).
*/
isEmpty(): boolean;
/**
* Calls action for each child of this tree node.
*
* @param {function(!Tree.<T>)} action Action to be called for each child.
*/
forEachChild(action: (tree: Tree<T>) => void): void;
/**
* Does a depth-first traversal of this node's descendants, calling action for each one.
*
* @param {function(!Tree.<T>)} action Action to be called for each child.
* @param {boolean=} includeSelf Whether to call action on this node as well. Defaults to
* false.
* @param {boolean=} childrenFirst Whether to call action on children before calling it on
* parent.
*/
forEachDescendant(action: (tree: Tree<T>) => void, includeSelf?: boolean, childrenFirst?: boolean): void;
/**
* Calls action on each ancestor node.
*
* @param {function(!Tree.<T>)} action Action to be called on each parent; return
* true to abort.
* @param {boolean=} includeSelf Whether to call action on this node as well.
* @return {boolean} true if the action callback returned true.
*/
forEachAncestor(action: (tree: Tree<T>) => void, includeSelf?: boolean): boolean;
/**
* Does a depth-first traversal of this node's descendants. When a descendant with a value
* is found, action is called on it and traversal does not continue inside the node.
* Action is *not* called on this node.
*
* @param {function(!Tree.<T>)} action Action to be called for each child.
*/
forEachImmediateDescendantWithValue(action: (tree: Tree<T>) => void): void;
/**
* @return {!Path} The path of this tree node, as a Path.
*/
path(): Path;
/**
* @return {string} The name of the tree node.
*/
name(): string;
/**
* @return {?Tree} The parent tree node, or null if this is the root of the tree.
*/
parent(): Tree<T> | null;
/**
* Adds or removes this child from its parent based on whether it's empty or not.
*
* @private
*/
private updateParents_();
/**
* Adds or removes the passed child to this tree node, depending on whether it's empty.
*
* @param {string} childName The name of the child to update.
* @param {!Tree.<T>} child The child to update.
* @private
*/
private updateChild_(childName, child);
}

View File

@ -0,0 +1,29 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { EventEmitter } from './EventEmitter';
/**
* @extends {EventEmitter}
*/
export declare class VisibilityMonitor extends EventEmitter {
private visible_;
static getInstance(): VisibilityMonitor;
constructor();
/**
* @param {!string} eventType
* @return {Array.<boolean>}
*/
getInitialEvent(eventType: string): boolean[];
}

View File

@ -0,0 +1,154 @@
import { NodeFilter } from './filter/NodeFilter';
import { Index } from '../snap/indexes/Index';
/**
* This class is an immutable-from-the-public-api struct containing a set of query parameters defining a
* range to be returned for a particular location. It is assumed that validation of parameters is done at the
* user-facing API level, so it is not done here.
* @constructor
*/
export declare class QueryParams {
private limitSet_;
private startSet_;
private startNameSet_;
private endSet_;
private endNameSet_;
private limit_;
private viewFrom_;
private indexStartValue_;
private indexStartName_;
private indexEndValue_;
private indexEndName_;
private index_;
/**
* Wire Protocol Constants
* @const
* @enum {string}
* @private
*/
private static readonly WIRE_PROTOCOL_CONSTANTS_;
/**
* REST Query Constants
* @const
* @enum {string}
* @private
*/
private static readonly REST_QUERY_CONSTANTS_;
/**
* Default, empty query parameters
* @type {!QueryParams}
* @const
*/
static readonly DEFAULT: QueryParams;
/**
* @return {boolean}
*/
hasStart(): boolean;
/**
* @return {boolean} True if it would return from left.
*/
isViewFromLeft(): boolean;
/**
* Only valid to call if hasStart() returns true
* @return {*}
*/
getIndexStartValue(): any;
/**
* Only valid to call if hasStart() returns true.
* Returns the starting key name for the range defined by these query parameters
* @return {!string}
*/
getIndexStartName(): string;
/**
* @return {boolean}
*/
hasEnd(): boolean;
/**
* Only valid to call if hasEnd() returns true.
* @return {*}
*/
getIndexEndValue(): any;
/**
* Only valid to call if hasEnd() returns true.
* Returns the end key name for the range defined by these query parameters
* @return {!string}
*/
getIndexEndName(): string;
/**
* @return {boolean}
*/
hasLimit(): boolean;
/**
* @return {boolean} True if a limit has been set and it has been explicitly anchored
*/
hasAnchoredLimit(): boolean;
/**
* Only valid to call if hasLimit() returns true
* @return {!number}
*/
getLimit(): number;
/**
* @return {!Index}
*/
getIndex(): Index;
/**
* @return {!QueryParams}
* @private
*/
private copy_();
/**
* @param {!number} newLimit
* @return {!QueryParams}
*/
limit(newLimit: number): QueryParams;
/**
* @param {!number} newLimit
* @return {!QueryParams}
*/
limitToFirst(newLimit: number): QueryParams;
/**
* @param {!number} newLimit
* @return {!QueryParams}
*/
limitToLast(newLimit: number): QueryParams;
/**
* @param {*} indexValue
* @param {?string=} key
* @return {!QueryParams}
*/
startAt(indexValue: any, key?: string | null): QueryParams;
/**
* @param {*} indexValue
* @param {?string=} key
* @return {!QueryParams}
*/
endAt(indexValue: any, key?: string | null): QueryParams;
/**
* @param {!Index} index
* @return {!QueryParams}
*/
orderBy(index: Index): QueryParams;
/**
* @return {!Object}
*/
getQueryObject(): Object;
/**
* @return {boolean}
*/
loadsAllData(): boolean;
/**
* @return {boolean}
*/
isDefault(): boolean;
/**
* @return {!NodeFilter}
*/
getNodeFilter(): NodeFilter;
/**
* Returns a set of REST query string parameters representing this query.
*
* @return {!Object.<string,*>} query string parameters
*/
toRestQueryStringParameters(): {
[k: string]: any;
};
}

View File

@ -0,0 +1,78 @@
import { Node } from '../../snap/Node';
import { NodeFilter } from './NodeFilter';
import { Index } from '../../snap/indexes/Index';
import { IndexedFilter } from './IndexedFilter';
import { QueryParams } from '../QueryParams';
import { Path } from '../../util/Path';
import { CompleteChildSource } from '../CompleteChildSource';
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
/**
* Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible
*
* @constructor
* @implements {NodeFilter}
*/
export declare class LimitedFilter implements NodeFilter {
/**
* @const
* @type {RangedFilter}
* @private
*/
private readonly rangedFilter_;
/**
* @const
* @type {!Index}
* @private
*/
private readonly index_;
/**
* @const
* @type {number}
* @private
*/
private readonly limit_;
/**
* @const
* @type {boolean}
* @private
*/
private readonly reverse_;
/**
* @param {!QueryParams} params
*/
constructor(params: QueryParams);
/**
* @inheritDoc
*/
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* @inheritDoc
*/
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* @inheritDoc
*/
updatePriority(oldSnap: Node, newPriority: Node): Node;
/**
* @inheritDoc
*/
filtersNodes(): boolean;
/**
* @inheritDoc
*/
getIndexedFilter(): IndexedFilter;
/**
* @inheritDoc
*/
getIndex(): Index;
/**
* @param {!Node} snap
* @param {string} childKey
* @param {!Node} childSnap
* @param {!CompleteChildSource} source
* @param {?ChildChangeAccumulator} changeAccumulator
* @return {!Node}
* @private
*/
private fullLimitUpdateChild_(snap, childKey, childSnap, source, changeAccumulator);
}

View File

@ -0,0 +1,74 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { Node } from '../../snap/Node';
import { Path } from '../../util/Path';
import { CompleteChildSource } from '../CompleteChildSource';
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
import { Index } from '../../snap/indexes/Index';
/**
* NodeFilter is used to update nodes and complete children of nodes while applying queries on the fly and keeping
* track of any child changes. This class does not track value changes as value changes depend on more
* than just the node itself. Different kind of queries require different kind of implementations of this interface.
* @interface
*/
export interface NodeFilter {
/**
* Update a single complete child in the snap. If the child equals the old child in the snap, this is a no-op.
* The method expects an indexed snap.
*
* @param {!Node} snap
* @param {string} key
* @param {!Node} newChild
* @param {!Path} affectedPath
* @param {!CompleteChildSource} source
* @param {?ChildChangeAccumulator} optChangeAccumulator
* @return {!Node}
*/
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* Update a node in full and output any resulting change from this complete update.
*
* @param {!Node} oldSnap
* @param {!Node} newSnap
* @param {?ChildChangeAccumulator} optChangeAccumulator
* @return {!Node}
*/
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* Update the priority of the root node
*
* @param {!Node} oldSnap
* @param {!Node} newPriority
* @return {!Node}
*/
updatePriority(oldSnap: Node, newPriority: Node): Node;
/**
* Returns true if children might be filtered due to query criteria
*
* @return {boolean}
*/
filtersNodes(): boolean;
/**
* Returns the index filter that this filter uses to get a NodeFilter that doesn't filter any children.
* @return {!NodeFilter}
*/
getIndexedFilter(): NodeFilter;
/**
* Returns the index that this filter uses
* @return {!Index}
*/
getIndex(): Index;
}

View File

@ -0,0 +1,108 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { IndexedFilter } from './IndexedFilter';
import { NamedNode, Node } from '../../../core/snap/Node';
import { NodeFilter } from './NodeFilter';
import { QueryParams } from '../QueryParams';
import { Index } from '../../snap/indexes/Index';
import { Path } from '../../util/Path';
import { CompleteChildSource } from '../CompleteChildSource';
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
/**
* Filters nodes by range and uses an IndexFilter to track any changes after filtering the node
*
* @constructor
* @implements {NodeFilter}
*/
export declare class RangedFilter implements NodeFilter {
/**
* @type {!IndexedFilter}
* @const
* @private
*/
private indexedFilter_;
/**
* @const
* @type {!Index}
* @private
*/
private index_;
/**
* @const
* @type {!NamedNode}
* @private
*/
private startPost_;
/**
* @const
* @type {!NamedNode}
* @private
*/
private endPost_;
/**
* @param {!QueryParams} params
*/
constructor(params: QueryParams);
/**
* @return {!NamedNode}
*/
getStartPost(): NamedNode;
/**
* @return {!NamedNode}
*/
getEndPost(): NamedNode;
/**
* @param {!NamedNode} node
* @return {boolean}
*/
matches(node: NamedNode): boolean;
/**
* @inheritDoc
*/
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* @inheritDoc
*/
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
/**
* @inheritDoc
*/
updatePriority(oldSnap: Node, newPriority: Node): Node;
/**
* @inheritDoc
*/
filtersNodes(): boolean;
/**
* @inheritDoc
*/
getIndexedFilter(): IndexedFilter;
/**
* @inheritDoc
*/
getIndex(): Index;
/**
* @param {!QueryParams} params
* @return {!NamedNode}
* @private
*/
private static getStartPost_(params);
/**
* @param {!QueryParams} params
* @return {!NamedNode}
* @private
*/
private static getEndPost_(params);
}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,194 @@
import { CountedSet } from '../core/util/CountedSet';
import { PacketReceiver } from './polling/PacketReceiver';
import { Transport } from './Transport';
import { RepoInfo } from '../core/RepoInfo';
export declare const FIREBASE_LONGPOLL_START_PARAM = "start";
export declare const FIREBASE_LONGPOLL_CLOSE_COMMAND = "close";
export declare const FIREBASE_LONGPOLL_COMMAND_CB_NAME = "pLPCommand";
export declare const FIREBASE_LONGPOLL_DATA_CB_NAME = "pRTLPCB";
export declare const FIREBASE_LONGPOLL_ID_PARAM = "id";
export declare const FIREBASE_LONGPOLL_PW_PARAM = "pw";
export declare const FIREBASE_LONGPOLL_SERIAL_PARAM = "ser";
export declare const FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = "cb";
export declare const FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = "seg";
export declare const FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = "ts";
export declare const FIREBASE_LONGPOLL_DATA_PARAM = "d";
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = "disconn";
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = "dframe";
/**
* This class manages a single long-polling connection.
*
* @constructor
* @implements {Transport}
*/
export declare class BrowserPollConnection implements Transport {
connId: string;
repoInfo: RepoInfo;
transportSessionId: string;
lastSessionId: string;
bytesSent: number;
bytesReceived: number;
urlFn: (params: object) => string;
scriptTagHolder: FirebaseIFrameScriptHolder;
myDisconnFrame: HTMLIFrameElement;
curSegmentNum: number;
myPacketOrderer: PacketReceiver;
id: string;
password: string;
private log_;
private stats_;
private everConnected_;
private isClosed_;
private connectTimeoutTimer_;
private onDisconnect_;
/**
* @param {string} connId An identifier for this connection, used for logging
* @param {RepoInfo} repoInfo The info for the endpoint to send data to.
* @param {string=} transportSessionId Optional transportSessionid if we are reconnecting for an existing
* transport session
* @param {string=} lastSessionId Optional lastSessionId if the PersistentConnection has already created a
* connection previously
*/
constructor(connId: string, repoInfo: RepoInfo, transportSessionId?: string, lastSessionId?: string);
/**
*
* @param {function(Object)} onMessage Callback when messages arrive
* @param {function()} onDisconnect Callback with connection lost.
*/
open(onMessage: (msg: Object) => void, onDisconnect: (a?: boolean) => void): void;
/**
* Call this when a handshake has completed successfully and we want to consider the connection established
*/
start(): void;
private static forceAllow_;
/**
* Forces long polling to be considered as a potential transport
*/
static forceAllow(): void;
private static forceDisallow_;
/**
* Forces longpolling to not be considered as a potential transport
*/
static forceDisallow(): void;
static isAvailable(): boolean;
/**
* No-op for polling
*/
markConnectionHealthy(): void;
/**
* Stops polling and cleans up the iframe
* @private
*/
private shutdown_();
/**
* Triggered when this transport is closed
* @private
*/
private onClosed_();
/**
* External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server
* that we've left.
*/
close(): void;
/**
* Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then
* broken into chunks (since URLs have a small maximum length).
* @param {!Object} data The JSON data to transmit.
*/
send(data: Object): void;
/**
* This is how we notify the server that we're leaving.
* We aren't able to send requests with DHTML on a window close event, but we can
* trigger XHR requests in some browsers (everything but Opera basically).
* @param {!string} id
* @param {!string} pw
*/
addDisconnectPingFrame(id: string, pw: string): void;
/**
* Used to track the bytes received by this client
* @param {*} args
* @private
*/
private incrementIncomingBytes_(args);
}
export interface IFrameElement extends HTMLIFrameElement {
doc: Document;
}
/*********************************************************************************************
* A wrapper around an iframe that is used as a long-polling script holder.
* @constructor
*********************************************************************************************/
export declare class FirebaseIFrameScriptHolder {
onDisconnect: () => void;
urlFn: (a: object) => string;
/**
* @type {CountedSet.<number, number>}
*/
outstandingRequests: CountedSet<number, number>;
pendingSegs: {
seg: number;
ts: number;
d: any;
}[];
currentSerial: number;
sendNewPolls: boolean;
uniqueCallbackIdentifier: number;
myIFrame: IFrameElement;
alive: boolean;
myID: string;
myPW: string;
commandCB: (command: string, ...args: any[]) => void;
onMessageCB: (...args: any[]) => void;
/**
* @param commandCB - The callback to be called when control commands are recevied from the server.
* @param onMessageCB - The callback to be triggered when responses arrive from the server.
* @param onDisconnect - The callback to be triggered when this tag holder is closed
* @param urlFn - A function that provides the URL of the endpoint to send data to.
*/
constructor(commandCB: (command: string, ...args: any[]) => void, onMessageCB: (...args: any[]) => void, onDisconnect: () => void, urlFn: (a: object) => string);
/**
* Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can
* actually use.
* @private
* @return {Element}
*/
private static createIFrame_();
/**
* Cancel all outstanding queries and remove the frame.
*/
close(): void;
/**
* Actually start the long-polling session by adding the first script tag(s) to the iframe.
* @param {!string} id - The ID of this connection
* @param {!string} pw - The password for this connection
*/
startLongPoll(id: string, pw: string): void;
/**
* This is called any time someone might want a script tag to be added. It adds a script tag when there aren't
* too many outstanding requests and we are still alive.
*
* If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if
* needed.
*/
private newRequest_();
/**
* Queue a packet for transmission to the server.
* @param segnum - A sequential id for this packet segment used for reassembly
* @param totalsegs - The total number of segments in this packet
* @param data - The data for this segment.
*/
enqueueSegment(segnum: number, totalsegs: number, data: any): void;
/**
* Add a script tag for a regular long-poll request.
* @param {!string} url - The URL of the script tag.
* @param {!number} serial - The serial number of the request.
* @private
*/
private addLongPollTag_(url, serial);
/**
* Add an arbitrary script tag to the iframe.
* @param {!string} url - The URL for the script tag source.
* @param {!function()} loadCB - A callback to be triggered once the script has loaded.
*/
addTag(url: string, loadCB: () => void): void;
}

View File

@ -0,0 +1,101 @@
import { RepoInfo } from '../core/RepoInfo';
/**
* Creates a new real-time connection to the server using whichever method works
* best in the current browser.
*
* @constructor
*/
export declare class Connection {
id: string;
private repoInfo_;
private onMessage_;
private onReady_;
private onDisconnect_;
private onKill_;
lastSessionId: string;
connectionCount: number;
pendingDataMessages: any[];
sessionId: string;
private conn_;
private healthyTimeout_;
private isHealthy_;
private log_;
private primaryResponsesRequired_;
private rx_;
private secondaryConn_;
private secondaryResponsesRequired_;
private state_;
private transportManager_;
private tx_;
/**
* @param {!string} id - an id for this connection
* @param {!RepoInfo} repoInfo_ - the info for the endpoint to connect to
* @param {function(Object)} onMessage_ - the callback to be triggered when a server-push message arrives
* @param {function(number, string)} onReady_ - the callback to be triggered when this connection is ready to send messages.
* @param {function()} onDisconnect_ - the callback to be triggered when a connection was lost
* @param {function(string)} onKill_ - the callback to be triggered when this connection has permanently shut down.
* @param {string=} lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server
*/
constructor(id: string, repoInfo_: RepoInfo, onMessage_: (a: Object) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
/**
* Starts a connection attempt
* @private
*/
private start_();
/**
* @return {!string}
* @private
*/
private nextTransportId_();
private disconnReceiver_(conn);
private connReceiver_(conn);
/**
*
* @param {Object} dataMsg An arbitrary data message to be sent to the server
*/
sendRequest(dataMsg: object): void;
tryCleanupConnection(): void;
private onSecondaryControl_(controlData);
private onSecondaryMessageReceived_(parsedData);
private upgradeIfSecondaryHealthy_();
private proceedWithUpgrade_();
private onPrimaryMessageReceived_(parsedData);
private onDataMessage_(message);
private onPrimaryResponse_();
private onControl_(controlData);
/**
*
* @param {Object} handshake The handshake data returned from the server
* @private
*/
private onHandshake_(handshake);
private tryStartUpgrade_();
private startUpgrade_(conn);
private onReset_(host);
private onConnectionEstablished_(conn, timestamp);
private sendPingOnPrimaryIfNecessary_();
private onSecondaryConnectionLost_();
/**
*
* @param {boolean} everConnected Whether or not the connection ever reached a server. Used to determine if
* we should flush the host cache
* @private
*/
private onConnectionLost_(everConnected);
/**
*
* @param {string} reason
* @private
*/
private onConnectionShutdown_(reason);
private sendData_(data);
/**
* Cleans up this connection, calling the appropriate callbacks
*/
close(): void;
/**
*
* @private
*/
private closeConnections_();
}

View File

@ -0,0 +1,64 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { RepoInfo } from '../core/RepoInfo';
export interface TransportConstructor {
new (connId: string, repoInfo: RepoInfo, transportSessionId?: string, lastSessionId?: string): Transport;
isAvailable: () => boolean;
responsesRequiredToBeHealthy?: number;
healthyTimeout?: number;
}
export declare abstract class Transport {
/**
* Bytes received since connection started.
* @type {number}
*/
abstract bytesReceived: number;
/**
* Bytes sent since connection started.
* @type {number}
*/
abstract bytesSent: number;
/**
* An identifier for this connection, used for logging
* @type {string}
*/
abstract connId: string;
/**
*
* @param {string} connId An identifier for this connection, used for logging
* @param {RepoInfo} repoInfo The info for the endpoint to send data to.
* @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport session
* @param {string=} lastSessionId Optional lastSessionId if there was a previous connection
* @interface
*/
constructor(connId: string, repoInfo: RepoInfo, transportSessionId?: string, lastSessionId?: string);
/**
* @param {function(Object)} onMessage Callback when messages arrive
* @param {function()} onDisconnect Callback with connection lost.
*/
abstract open(onMessage: (a: Object) => void, onDisconnect: (a?: boolean) => void): void;
abstract start(): void;
abstract close(): void;
/**
* @param {!Object} data The JSON data to transmit
*/
abstract send(data: Object): void;
abstract markConnectionHealthy(): void;
abstract markConnectionHealthy(): void;
}
export interface TransportConstructor {
new (connId: string, RepoInfo: any, transportSessionId?: string, lastSessionId?: string): any;
}

View File

@ -0,0 +1,54 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { BrowserPollConnection } from './BrowserPollConnection';
import { WebSocketConnection } from './WebSocketConnection';
import { TransportConstructor } from './Transport';
import { RepoInfo } from '../core/RepoInfo';
/**
* Currently simplistic, this class manages what transport a Connection should use at various stages of its
* lifecycle.
*
* It starts with longpolling in a browser, and httppolling on node. It then upgrades to websockets if
* they are available.
* @constructor
*/
export declare class TransportManager {
private transports_;
/**
* @const
* @type {!Array.<function(new:Transport, string, RepoInfo, string=)>}
*/
static readonly ALL_TRANSPORTS: (typeof BrowserPollConnection | typeof WebSocketConnection)[];
/**
* @param {!RepoInfo} repoInfo Metadata around the namespace we're connecting to
*/
constructor(repoInfo: RepoInfo);
/**
* @param {!RepoInfo} repoInfo
* @private
*/
private initTransports_(repoInfo);
/**
* @return {function(new:Transport, !string, !RepoInfo, string=, string=)} The constructor for the
* initial transport to use
*/
initialTransport(): TransportConstructor;
/**
* @return {?function(new:Transport, function(),function(), string=)} The constructor for the next
* transport, or null
*/
upgradeTransport(): TransportConstructor | null;
}

View File

@ -0,0 +1,129 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { RepoInfo } from '../core/RepoInfo';
import { Transport } from './Transport';
export declare function setWebSocketImpl(impl: any): void;
/**
* Create a new websocket connection with the given callbacks.
* @constructor
* @implements {Transport}
*/
export declare class WebSocketConnection implements Transport {
connId: string;
keepaliveTimer: number | null;
frames: string[] | null;
totalFrames: number;
bytesSent: number;
bytesReceived: number;
connURL: string;
onDisconnect: (a?: boolean) => void;
onMessage: (msg: Object) => void;
mySock: any | null;
private log_;
private stats_;
private everConnected_;
private isClosed_;
/**
* @param {string} connId identifier for this transport
* @param {RepoInfo} repoInfo The info for the websocket endpoint.
* @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport
* session
* @param {string=} lastSessionId Optional lastSessionId if there was a previous connection
*/
constructor(connId: string, repoInfo: RepoInfo, transportSessionId?: string, lastSessionId?: string);
/**
* @param {RepoInfo} repoInfo The info for the websocket endpoint.
* @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport
* session
* @param {string=} lastSessionId Optional lastSessionId if there was a previous connection
* @return {string} connection url
* @private
*/
private static connectionURL_(repoInfo, transportSessionId?, lastSessionId?);
/**
*
* @param onMessage Callback when messages arrive
* @param onDisconnect Callback with connection lost.
*/
open(onMessage: (msg: Object) => void, onDisconnect: (a?: boolean) => void): void;
/**
* No-op for websockets, we don't need to do anything once the connection is confirmed as open
*/
start(): void;
static forceDisallow_: Boolean;
static forceDisallow(): void;
static isAvailable(): boolean;
/**
* Number of response before we consider the connection "healthy."
* @type {number}
*/
static responsesRequiredToBeHealthy: number;
/**
* Time to wait for the connection te become healthy before giving up.
* @type {number}
*/
static healthyTimeout: number;
/**
* Returns true if we previously failed to connect with this transport.
* @return {boolean}
*/
static previouslyFailed(): boolean;
markConnectionHealthy(): void;
private appendFrame_(data);
/**
* @param {number} frameCount The number of frames we are expecting from the server
* @private
*/
private handleNewFrameCount_(frameCount);
/**
* Attempts to parse a frame count out of some text. If it can't, assumes a value of 1
* @param {!String} data
* @return {?String} Any remaining data to be process, or null if there is none
* @private
*/
private extractFrameCount_(data);
/**
* Process a websocket frame that has arrived from the server.
* @param mess The frame data
*/
handleIncomingFrame(mess: {
[k: string]: any;
}): void;
/**
* Send a message to the server
* @param {Object} data The JSON object to transmit
*/
send(data: Object): void;
private shutdown_();
private onClosed_();
/**
* External-facing close handler.
* Close the websocket and kill the connection.
*/
close(): void;
/**
* Kill the current keepalive timer and start a new one, to ensure that it always fires N seconds after
* the last activity.
*/
resetKeepAlive(): void;
/**
* Send a string over the websocket.
*
* @param {string} str String to send.
* @private
*/
private sendString_(str);
}

View File

@ -0,0 +1,25 @@
/**
* This class ensures the packets from the server arrive in order
* This class takes data from the server and ensures it gets passed into the callbacks in order.
* @constructor
*/
export declare class PacketReceiver {
private onMessage_;
pendingResponses: any[];
currentResponseNum: number;
closeAfterResponse: number;
onClose: (() => void) | null;
/**
* @param onMessage_
*/
constructor(onMessage_: (a: Object) => void);
closeAfter(responseNum: number, callback: () => void): void;
/**
* Each message from the server comes with a response number, and an array of data. The responseNumber
* allows us to ensure that we process them in the right order, since we can't be guaranteed that all
* browsers will respond in the same order as the requests we sent
* @param {number} requestNum
* @param {Array} data
*/
handleResponse(requestNum: number, data: any[]): void;
}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
import '../index';

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,33 @@
/**
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare const EventAccumulatorFactory: {
waitsForCount: (maxCount: any) => EventAccumulator;
};
export declare class EventAccumulator {
condition: Function;
eventData: any[];
promise: any;
resolve: any;
reject: any;
private onResetFxn;
private onEventFxn;
constructor(condition: Function);
addEvent(eventData?: any): void;
reset(condition?: Function): void;
onEvent(cb: Function): void;
onReset(cb: Function): void;
_testCondition(): any;
}

View File

@ -0,0 +1,21 @@
/**
* A set of functions to clean up event handlers.
* @type {function()}
*/
export declare let eventCleanupHandlers: any[];
/** Clean up outstanding event handlers */
export declare function eventCleanup(): void;
/**
* Creates a struct which waits for many events.
* @param {Array<Array>} pathAndEvents an array of tuples of [Firebase, [event type strings]]
* @param {string=} helperName
* @return {{waiter: waiter, watchesInitializedWaiter: watchesInitializedWaiter, unregister: unregister, addExpectedEvents: addExpectedEvents}}
*/
export declare function eventTestHelper(pathAndEvents: any, helperName?: any): {
promise: Promise<{}>;
initPromise: Promise<{}>;
waiter: () => boolean;
watchesInitializedWaiter: () => boolean;
unregister: () => void;
addExpectedEvents: (moreEvents: any) => void;
};

View File

@ -0,0 +1,44 @@
import '../../index';
import { Reference } from '../../src/api/Reference';
import { Query } from '../../src/api/Query';
export declare const TEST_PROJECT: any;
export declare const DATABASE_ADDRESS: any;
export declare const DATABASE_URL: any;
/**
* Fake Firebase App Authentication functions for testing.
* @param {!FirebaseApp} app
* @return {!FirebaseApp}
*/
export declare function patchFakeAuthFunctions(app: any): any;
export declare function createTestApp(): FirebaseApp;
/**
* Gets or creates a root node to the test namespace. All calls sharing the
* value of opt_i will share an app context.
* @param {number=} i
* @param {string=} ref
* @return {Reference}
*/
export declare function getRootNode(i?: number, ref?: string): any;
/**
* Create multiple refs to the same top level
* push key - each on it's own Firebase.Context.
* @param {int=} numNodes
* @return {Reference|Array<Reference>}
*/
export declare function getRandomNode(numNodes?: any): Reference | Array<Reference>;
export declare function getQueryValue(query: Query): Promise<any>;
export declare function pause(milliseconds: number): Promise<{}>;
export declare function getPath(query: Query): string;
export declare function shuffle(arr: any, randFn?: () => number): void;
export declare function testAuthTokenProvider(app: any): {
setToken: (token: any) => Promise<void>;
setNextToken: (token: any) => void;
};
export declare function getFreshRepo(path: any): any;
export declare function getFreshRepoFromReference(ref: any): any;
export declare function getSnap(path: any): any;
export declare function getVal(path: any): any;
export declare function canCreateExtraConnections(): boolean;
export declare function buildObjFromKey(key: any): {};
export declare function testRepoInfo(url: any): RepoInfo;
export declare function repoInfoForConnectionTest(): RepoInfo;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
import '../src/core/snap/ChildrenNode';

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
import '../index';

View File

@ -0,0 +1,83 @@
import { Node } from '../core/snap/Node';
import { Reference } from './Reference';
import { Index } from '../core/snap/indexes/Index';
/**
* Class representing a firebase data snapshot. It wraps a SnapshotNode and
* surfaces the public methods (val, forEach, etc.) we want to expose.
*/
export declare class DataSnapshot {
private readonly node_;
private readonly ref_;
private readonly index_;
/**
* @param {!Node} node_ A SnapshotNode to wrap.
* @param {!Reference} ref_ The ref of the location this snapshot came from.
* @param {!Index} index_ The iteration order for this snapshot
*/
constructor(node_: Node, ref_: Reference, index_: Index);
/**
* Retrieves the snapshot contents as JSON. Returns null if the snapshot is
* empty.
*
* @return {*} JSON representation of the DataSnapshot contents, or null if empty.
*/
val(): any;
/**
* Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting
* the entire node contents.
* @return {*} JSON representation of the DataSnapshot contents, or null if empty.
*/
exportVal(): any;
toJSON(): any;
/**
* Returns whether the snapshot contains a non-null value.
*
* @return {boolean} Whether the snapshot contains a non-null value, or is empty.
*/
exists(): boolean;
/**
* Returns a DataSnapshot of the specified child node's contents.
*
* @param {!string} childPathString Path to a child.
* @return {!DataSnapshot} DataSnapshot for child node.
*/
child(childPathString: string): DataSnapshot;
/**
* Returns whether the snapshot contains a child at the specified path.
*
* @param {!string} childPathString Path to a child.
* @return {boolean} Whether the child exists.
*/
hasChild(childPathString: string): boolean;
/**
* Returns the priority of the object, or null if no priority was set.
*
* @return {string|number|null} The priority.
*/
getPriority(): string | number | null;
/**
* Iterates through child nodes and calls the specified action for each one.
*
* @param {function(!DataSnapshot)} action Callback function to be called
* for each child.
* @return {boolean} True if forEach was canceled by action returning true for
* one of the child nodes.
*/
forEach(action: (d: DataSnapshot) => boolean | void): boolean;
/**
* Returns whether this DataSnapshot has children.
* @return {boolean} True if the DataSnapshot contains 1 or more child nodes.
*/
hasChildren(): boolean;
readonly key: string;
/**
* Returns the number of children for this DataSnapshot.
* @return {number} The number of children that this DataSnapshot contains.
*/
numChildren(): number;
/**
* @return {Reference} The Firebase reference for the location this snapshot's data came from.
*/
getRef(): Reference;
readonly ref: Reference;
}

View File

@ -0,0 +1,57 @@
import { Reference } from './Reference';
import { Repo } from '../core/Repo';
import { FirebaseApp } from '@firebase/app-types';
import { FirebaseService } from '@firebase/app-types/private';
/**
* Class representing a firebase database.
* @implements {FirebaseService}
*/
export declare class Database implements FirebaseService {
private repo_;
INTERNAL: DatabaseInternals;
private root_;
static readonly ServerValue: {
TIMESTAMP: {
'.sv': string;
};
};
/**
* The constructor should not be called by users of our public API.
* @param {!Repo} repo_
*/
constructor(repo_: Repo);
readonly app: FirebaseApp;
/**
* Returns a reference to the root or to the path specified in the provided
* argument.
* @param {string|Reference=} path The relative string path or an existing
* Reference to a database location.
* @throws If a Reference is provided, throws if it does not belong to the
* same project.
* @return {!Reference} Firebase reference.
**/
ref(path?: string): Reference;
ref(path?: Reference): Reference;
/**
* Returns a reference to the root or the path specified in url.
* We throw a exception if the url is not in the same domain as the
* current repo.
* @param {string} url
* @return {!Reference} Firebase reference.
*/
refFromURL(url: string): Reference;
/**
* @param {string} apiName
*/
private checkDeleted_(apiName);
goOffline(): void;
goOnline(): void;
}
export declare class DatabaseInternals {
database: Database;
/** @param {!Database} database */
constructor(database: Database);
/** @return {Promise<void>} */
delete(): Promise<void>;
}

View File

@ -0,0 +1,170 @@
import { Path } from '../core/util/Path';
import { Repo } from '../core/Repo';
import { QueryParams } from '../core/view/QueryParams';
import { Reference } from './Reference';
import { DataSnapshot } from './DataSnapshot';
export interface SnapshotCallback {
(a: DataSnapshot, b?: string): any;
}
/**
* A Query represents a filter to be applied to a firebase location. This object purely represents the
* query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js.
*
* Since every Firebase reference is a query, Firebase inherits from this object.
*/
export declare class Query {
repo: Repo;
path: Path;
private queryParams_;
private orderByCalled_;
static __referenceConstructor: new (repo: Repo, path: Path) => Query;
constructor(repo: Repo, path: Path, queryParams_: QueryParams, orderByCalled_: boolean);
/**
* Validates start/end values for queries.
* @param {!QueryParams} params
* @private
*/
private static validateQueryEndpoints_(params);
/**
* Validates that limit* has been called with the correct combination of parameters
* @param {!QueryParams} params
* @private
*/
private static validateLimit_(params);
/**
* Validates that no other order by call has been made
* @param {!string} fnName
* @private
*/
private validateNoPreviousOrderByCall_(fnName);
/**
* @return {!QueryParams}
*/
getQueryParams(): QueryParams;
/**
* @return {!Reference}
*/
getRef(): Reference;
/**
* @param {!string} eventType
* @param {!function(DataSnapshot, string=)} callback
* @param {(function(Error)|Object)=} cancelCallbackOrContext
* @param {Object=} context
* @return {!function(DataSnapshot, string=)}
*/
on(eventType: string, callback: SnapshotCallback, cancelCallbackOrContext?: ((a: Error) => any) | Object, context?: Object): SnapshotCallback;
/**
* @param {!function(!DataSnapshot)} callback
* @param {?function(Error)} cancelCallback
* @param {?Object} context
* @protected
*/
protected onValueEvent(callback: (a: DataSnapshot) => void, cancelCallback: ((a: Error) => void) | null, context: Object | null): void;
/**
* @param {!Object.<string, !function(!DataSnapshot, ?string)>} callbacks
* @param {?function(Error)} cancelCallback
* @param {?Object} context
* @protected
*/
onChildEvent(callbacks: {
[k: string]: SnapshotCallback;
}, cancelCallback: ((a: Error) => any) | null, context: Object | null): void;
/**
* @param {string=} eventType
* @param {(function(!DataSnapshot, ?string=))=} callback
* @param {Object=} context
*/
off(eventType?: string, callback?: SnapshotCallback, context?: Object): void;
/**
* Attaches a listener, waits for the first event, and then removes the listener
* @param {!string} eventType
* @param {!function(!DataSnapshot, string=)} userCallback
* @param cancelOrContext
* @param context
* @return {!firebase.Promise}
*/
once(eventType: string, userCallback?: SnapshotCallback, cancelOrContext?: ((a: Error) => void) | Object, context?: Object): Promise<DataSnapshot>;
/**
* Set a limit and anchor it to the start of the window.
* @param {!number} limit
* @return {!Query}
*/
limitToFirst(limit: number): Query;
/**
* Set a limit and anchor it to the end of the window.
* @param {!number} limit
* @return {!Query}
*/
limitToLast(limit: number): Query;
/**
* Given a child path, return a new query ordered by the specified grandchild path.
* @param {!string} path
* @return {!Query}
*/
orderByChild(path: string): Query;
/**
* Return a new query ordered by the KeyIndex
* @return {!Query}
*/
orderByKey(): Query;
/**
* Return a new query ordered by the PriorityIndex
* @return {!Query}
*/
orderByPriority(): Query;
/**
* Return a new query ordered by the ValueIndex
* @return {!Query}
*/
orderByValue(): Query;
/**
* @param {number|string|boolean|null} value
* @param {?string=} name
* @return {!Query}
*/
startAt(value?: number | string | boolean | null, name?: string | null): Query;
/**
* @param {number|string|boolean|null} value
* @param {?string=} name
* @return {!Query}
*/
endAt(value?: number | string | boolean | null, name?: string | null): Query;
/**
* Load the selection of children with exactly the specified value, and, optionally,
* the specified name.
* @param {number|string|boolean|null} value
* @param {string=} name
* @return {!Query}
*/
equalTo(value: number | string | boolean | null, name?: string): Query;
/**
* @return {!string} URL for this location.
*/
toString(): string;
toJSON(): string;
/**
* An object representation of the query parameters used by this Query.
* @return {!Object}
*/
queryObject(): Object;
/**
* @return {!string}
*/
queryIdentifier(): string;
/**
* Return true if this query and the provided query are equivalent; otherwise, return false.
* @param {Query} other
* @return {boolean}
*/
isEqual(other: Query): boolean;
/**
* Helper used by .on and .once to extract the context and or cancel arguments.
* @param {!string} fnName The function name (on or once)
* @param {(function(Error)|Object)=} cancelOrContext
* @param {Object=} context
* @return {{cancel: ?function(Error), context: ?Object}}
* @private
*/
private static getCancelAndContextArgs_(fnName, cancelOrContext?, context?);
readonly ref: Reference;
}

View File

@ -0,0 +1,105 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { OnDisconnect } from './onDisconnect';
import { TransactionResult } from './TransactionResult';
import { Query } from './Query';
import { Repo } from '../core/Repo';
import { Path } from '../core/util/Path';
import { Database } from './Database';
import { DataSnapshot } from './DataSnapshot';
export interface ReferenceConstructor {
new (repo: Repo, path: Path): Reference;
}
export declare class Reference extends Query {
then: (a?: any) => Promise<any>;
catch: (a?: Error) => Promise<any>;
/**
* Call options:
* new Reference(Repo, Path) or
* new Reference(url: string, string|RepoManager)
*
* Externally - this is the firebase.database.Reference type.
*
* @param {!Repo} repo
* @param {(!Path)} path
* @extends {Query}
*/
constructor(repo: Repo, path: Path);
/** @return {?string} */
getKey(): string | null;
/**
* @param {!(string|Path)} pathString
* @return {!Reference}
*/
child(pathString: string | Path): Reference;
/** @return {?Reference} */
getParent(): Reference | null;
/** @return {!Reference} */
getRoot(): Reference;
/** @return {!Database} */
databaseProp(): Database;
/**
* @param {*} newVal
* @param {function(?Error)=} onComplete
* @return {!Promise}
*/
set(newVal: any, onComplete?: (a: Error | null) => void): Promise<any>;
/**
* @param {!Object} objectToMerge
* @param {function(?Error)=} onComplete
* @return {!Promise}
*/
update(objectToMerge: Object, onComplete?: (a: Error | null) => void): Promise<any>;
/**
* @param {*} newVal
* @param {string|number|null} newPriority
* @param {function(?Error)=} onComplete
* @return {!Promise}
*/
setWithPriority(newVal: any, newPriority: string | number | null, onComplete?: (a: Error | null) => void): Promise<any>;
/**
* @param {function(?Error)=} onComplete
* @return {!Promise}
*/
remove(onComplete?: (a: Error | null) => void): Promise<any>;
/**
* @param {function(*):*} transactionUpdate
* @param {(function(?Error, boolean, ?DataSnapshot))=} onComplete
* @param {boolean=} applyLocally
* @return {!Promise}
*/
transaction(transactionUpdate: (a: any) => any, onComplete?: (a: Error | null, b: boolean, c: DataSnapshot | null) => void, applyLocally?: boolean): Promise<TransactionResult>;
/**
* @param {string|number|null} priority
* @param {function(?Error)=} onComplete
* @return {!Promise}
*/
setPriority(priority: string | number | null, onComplete?: (a: Error | null) => void): Promise<any>;
/**
* @param {*=} value
* @param {function(?Error)=} onComplete
* @return {!Reference}
*/
push(value?: any, onComplete?: (a: Error | null) => void): Reference;
/**
* @return {!OnDisconnect}
*/
onDisconnect(): OnDisconnect;
readonly database: Database;
readonly key: string | null;
readonly parent: Reference | null;
readonly root: Reference;
}

View File

@ -0,0 +1,29 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { DataSnapshot } from './DataSnapshot';
export declare class TransactionResult {
committed: boolean;
snapshot: DataSnapshot;
/**
* A type for the resolve value of Firebase.transaction.
* @constructor
* @dict
* @param {boolean} committed
* @param {DataSnapshot} snapshot
*/
constructor(committed: boolean, snapshot: DataSnapshot);
toJSON(): object;
}

View File

@ -0,0 +1,16 @@
import { Reference } from './Reference';
/**
* INTERNAL methods for internal-use only (tests, etc.).
*
* Customers shouldn't use these or else should be aware that they could break at any time.
*
* @const
*/
export declare const forceLongPolling: () => void;
export declare const forceWebSockets: () => void;
export declare const isWebSocketsAvailable: () => boolean;
export declare const setSecurityDebugCallback: (ref: Reference, callback: (a: Object) => void) => void;
export declare const stats: (ref: Reference, showDelta?: boolean) => void;
export declare const statsIncrementCounter: (ref: Reference, metric: string) => void;
export declare const dataUpdateCount: (ref: Reference) => number;
export declare const interceptServerData: (ref: Reference, callback: (a: string, b: any) => void) => void;

View File

@ -0,0 +1,43 @@
import { Repo } from '../core/Repo';
import { Path } from '../core/util/Path';
/**
* @constructor
*/
export declare class OnDisconnect {
private repo_;
private path_;
/**
* @param {!Repo} repo_
* @param {!Path} path_
*/
constructor(repo_: Repo, path_: Path);
/**
* @param {function(?Error)=} onComplete
* @return {!firebase.Promise}
*/
cancel(onComplete?: (a: Error | null) => void): Promise<void>;
/**
* @param {function(?Error)=} onComplete
* @return {!firebase.Promise}
*/
remove(onComplete?: (a: Error | null) => void): Promise<void>;
/**
* @param {*} value
* @param {function(?Error)=} onComplete
* @return {!firebase.Promise}
*/
set(value: any, onComplete?: (a: Error | null) => void): Promise<void>;
/**
* @param {*} value
* @param {number|string|null} priority
* @param {function(?Error)=} onComplete
* @return {!firebase.Promise}
*/
setWithPriority(value: any, priority: number | string | null, onComplete?: (a: Error | null) => void): Promise<void>;
/**
* @param {!Object} objectToMerge
* @param {function(?Error)=} onComplete
* @return {!firebase.Promise}
*/
update(objectToMerge: object, onComplete?: (a: Error | null) => void): Promise<void>;
}

View File

@ -0,0 +1,46 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { RepoInfo } from '../core/RepoInfo';
import { PersistentConnection } from '../core/PersistentConnection';
import { Connection } from '../realtime/Connection';
import { Query } from './Query';
export declare const DataConnection: typeof PersistentConnection;
export declare const RealTimeConnection: typeof Connection;
/**
* @param {function(): string} newHash
* @return {function()}
*/
export declare const hijackHash: (newHash: () => string) => () => void;
/**
* @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined}
*/
export declare const ConnectionTarget: typeof RepoInfo;
/**
* @param {!Query} query
* @return {!string}
*/
export declare const queryIdentifier: (query: Query) => string;
/**
* @param {!Query} firebaseRef
* @return {!Object}
*/
export declare const listens: (firebaseRef: Query) => any;
/**
* Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.
*
* @param {boolean} forceRestClient
*/
export declare const forceRestClient: (forceRestClient: boolean) => void;

View File

@ -0,0 +1,35 @@
/**
* Copyright 2017 Google Inc.
*
* 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 { FirebaseAuthTokenData } from '@firebase/app-types/private';
/**
* Abstraction around FirebaseApp's token fetching capabilities.
*/
export declare class AuthTokenProvider {
private app_;
/**
* @param {!FirebaseApp} app_
*/
constructor(app_: FirebaseApp);
/**
* @param {boolean} forceRefresh
* @return {!Promise<FirebaseAuthTokenData>}
*/
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;
addTokenChangeListener(listener: (token: string | null) => void): void;
removeTokenChangeListener(listener: (token: string | null) => void): void;
notifyForInvalidToken(): void;
}

Some files were not shown because too many files have changed in this diff Show More