├── .gitignore ├── LICENSE ├── README.md ├── es6-promise.d.ts └── firebase.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For firebase-3-typescript software 4 | 5 | * Usage: 6 | Use in source and binary forms as part of an application/software, with or without modification is permitted and does not require any attribution. 7 | 8 | * Redistribution: 9 | Redistribution, with or without modification, are permitted provided that a proper attribution to this repository is included. i.e. a link to the repo is included. 10 | 11 | Any use 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #firebase-3-typescript 2 | 3 | A firebase v3 TypeScript definition file. I've followed the firebase v3 documentation to create this file. 4 | As according to the documentation, firebase uses ES6 Promises I've included a copy of es6-promise.d.ts. This is however not required if tsconfig.json is set to target es6. 5 | 6 | 7 | #License 8 | firebase-3-typescript is BSD-licensed. Please refer to LICENSE for more information. 9 | -------------------------------------------------------------------------------- /es6-promise.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for es6-promise 2 | // Project: https://github.com/jakearchibald/ES6-Promise 3 | // Definitions by: François de Campredon , vvakame 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | interface Thenable { 7 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; 8 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Thenable; 9 | catch(onRejected?: (error: any) => U | Thenable): Thenable; 10 | } 11 | 12 | declare class Promise implements Thenable { 13 | /** 14 | * If you call resolve in the body of the callback passed to the constructor, 15 | * your promise is fulfilled with result object passed to resolve. 16 | * If you call reject your promise is rejected with the object passed to reject. 17 | * For consistency and debugging (eg stack traces), obj should be an instanceof Error. 18 | * Any errors thrown in the constructor callback will be implicitly passed to reject(). 19 | */ 20 | constructor(callback: (resolve : (value?: T | Thenable) => void, reject: (error?: any) => void) => void); 21 | 22 | /** 23 | * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. 24 | * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. 25 | * Both callbacks have a single parameter , the fulfillment value or rejection reason. 26 | * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. 27 | * If an error is thrown in the callback, the returned promise rejects with that error. 28 | * 29 | * @param onFulfilled called when/if "promise" resolves 30 | * @param onRejected called when/if "promise" rejects 31 | */ 32 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; 33 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Promise; 34 | 35 | /** 36 | * Sugar for promise.then(undefined, onRejected) 37 | * 38 | * @param onRejected called when/if "promise" rejects 39 | */ 40 | catch(onRejected?: (error: any) => U | Thenable): Promise; 41 | } 42 | 43 | declare namespace Promise { 44 | /** 45 | * Make a new promise from the thenable. 46 | * A thenable is promise-like in as far as it has a "then" method. 47 | */ 48 | function resolve(value?: T | Thenable): Promise; 49 | 50 | /** 51 | * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error 52 | */ 53 | function reject(error: any): Promise; 54 | function reject(error: T): Promise; 55 | 56 | /** 57 | * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. 58 | * the array passed to all can be a mixture of promise-like objects and other objects. 59 | * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. 60 | */ 61 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; 62 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; 63 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; 64 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; 65 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; 66 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; 67 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; 68 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; 69 | function all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; 70 | function all(values: (T | Thenable)[]): Promise; 71 | 72 | /** 73 | * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. 74 | */ 75 | function race(promises: (T | Thenable)[]): Promise; 76 | } 77 | 78 | declare module 'es6-promise' { 79 | var foo: typeof Promise; // Temp variable to reference Promise in local context 80 | namespace rsvp { 81 | export var Promise: typeof foo; 82 | } 83 | export = rsvp; 84 | } -------------------------------------------------------------------------------- /firebase.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for firebase v3.0.5 2 | // Project: https://www.npmjs.com/package/firebase 3 | // Definitions by: Suhail Abood 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | declare namespace firebase { 7 | export namespace database { 8 | export enum ServerValue{ 9 | TIMESTAMP, 10 | } 11 | 12 | export function enableLogging(enable: boolean):void; 13 | } 14 | 15 | 16 | 17 | /** 18 | * Browser configuration object. 19 | * 20 | * @export 21 | * @interface FirebaseConfig 22 | */ 23 | export interface FirebaseConfig{ 24 | apiKey:string; 25 | authDomain:string; 26 | databaseURL:string; 27 | storageBucket:string; 28 | } 29 | 30 | var SDK_VERSION:string; 31 | 32 | export interface ServiceAccountDefinition{ 33 | projectId: string; 34 | clientEmail: string; 35 | privateKey: string; 36 | } 37 | 38 | /** 39 | * Server configuration object 40 | */ 41 | export interface FirebaseServiceConfig { 42 | /** 43 | * Either a string representing the path to the key.json of the service account or an object literal of type {ServiceAccountDefinition} 44 | */ 45 | serviceAccount: string|ServiceAccountDefinition; 46 | databaseURL: string; 47 | } 48 | 49 | var apps:FirebaseApplication[]; 50 | 51 | 52 | /** 53 | * Initializes the firebase application. 54 | * 55 | * @export 56 | * @param {FirebaseConfig} config the firebase configuration, this can be either a user 57 | * @param {string} [name] the name of the application defaults to [DEFAULT] 58 | * @returns {FirebaseApplication} the initialized firebase application instance. 59 | */ 60 | export function initializeApp(config:FirebaseConfig|FirebaseServiceConfig, 61 | name?:string):FirebaseApplication; 62 | 63 | 64 | /** 65 | * The namespace for all Firebase Storage functionality. The returned service is initialized with a particular app which contains the project's storage location, or uses the default app if none is provided. 66 | * 67 | * @export 68 | * @param {FirebaseApplication} [app] The app to create a storage service for. If not passed, uses the default app. Value must not be null. 69 | * @returns {FirebaseStorage} non-null {firebase.storage.Storage} 70 | */ 71 | export function storage(app?:FirebaseApplication):FirebaseStorage; 72 | 73 | /** 74 | * (description) 75 | * 76 | * @export 77 | * @interface UserInfo 78 | */ 79 | export interface UserInfo { 80 | /** 81 | * (description) 82 | * 83 | * @type {string} 84 | */ 85 | displayName:string; 86 | /** 87 | * (description) 88 | * 89 | * @type {string} 90 | */ 91 | email:string; 92 | /** 93 | * (description) 94 | * 95 | * @type {string} 96 | */ 97 | photoURL:string; 98 | /** 99 | * (description) 100 | * 101 | * @type {string} 102 | */ 103 | providerId:string; 104 | /** 105 | * (description) 106 | * 107 | * @type {string} 108 | */ 109 | uid:string; 110 | } 111 | 112 | /** 113 | * (description) 114 | * 115 | * @export 116 | * @interface SettableMetadata 117 | */ 118 | export interface SettableMetadata{ 119 | /** 120 | * (description) 121 | * 122 | * @type {string} 123 | */ 124 | cacheControl:string; 125 | /** 126 | * (description) 127 | * 128 | * @type {string} 129 | */ 130 | contentDisposition:string; 131 | /** 132 | * (description) 133 | * 134 | * @type {string} 135 | */ 136 | contentEncoding:string; 137 | /** 138 | * (description) 139 | * 140 | * @type {string} 141 | */ 142 | contentLanguage:string; 143 | /** 144 | * (description) 145 | * 146 | * @type {string} 147 | */ 148 | contentType:string; 149 | /** 150 | * (description) 151 | * 152 | * @type {*} 153 | */ 154 | customMetadata:any; 155 | } 156 | 157 | /** 158 | * (description) 159 | * 160 | * @export 161 | * @interface FullMetadata 162 | * @extends {SettableMetadata} 163 | */ 164 | export interface FullMetadata extends SettableMetadata{ 165 | /** 166 | * (description) 167 | * 168 | * @type {string} 169 | */ 170 | bucket:string; 171 | /** 172 | * (description) 173 | * 174 | * @type {string[]} 175 | */ 176 | downloadURLs:string[]; 177 | /** 178 | * (description) 179 | * 180 | * @type {string} 181 | */ 182 | fullPath:string; 183 | /** 184 | * (description) 185 | * 186 | * @type {string} 187 | */ 188 | generation:string; 189 | /** 190 | * (description) 191 | * 192 | * @type {string} 193 | */ 194 | md5Hash:string; 195 | /** 196 | * (description) 197 | * 198 | * @type {string} 199 | */ 200 | metageneration:string; 201 | /** 202 | * (description) 203 | * 204 | * @type {string} 205 | */ 206 | name:string; 207 | /** 208 | * (description) 209 | * 210 | * @type {number} 211 | */ 212 | size:number; 213 | /** 214 | * (description) 215 | * 216 | * @type {string} 217 | */ 218 | timeCreated:string; 219 | /** 220 | * (description) 221 | * 222 | * @type {string} 223 | */ 224 | updated:string; 225 | 226 | } 227 | 228 | /** 229 | * (description) 230 | * 231 | * @export 232 | * @enum {number} 233 | */ 234 | export enum TaskEvent { 235 | /** 236 | * (description) 237 | */ 238 | STATE_CHANGED 239 | } 240 | 241 | 242 | 243 | /** 244 | * (description) 245 | * 246 | * @export 247 | * @enum {number} 248 | */ 249 | export enum TaskState { 250 | /** 251 | * (description) 252 | */ 253 | RUNNING, 254 | /** 255 | * (description) 256 | */ 257 | PAUSED, 258 | /** 259 | * (description) 260 | */ 261 | SUCCESS, 262 | /** 263 | * (description) 264 | */ 265 | CANCELED, 266 | /** 267 | * (description) 268 | */ 269 | ERROR 270 | } 271 | 272 | /** 273 | * (description) 274 | * 275 | * @export 276 | * @interface UploadTaskSnapshot 277 | */ 278 | export interface UploadTaskSnapshot{ 279 | /** 280 | * (description) 281 | * 282 | * @type {number} 283 | */ 284 | bytesTransferred:number; 285 | /** 286 | * (description) 287 | * 288 | * @type {string} 289 | */ 290 | downloadURL:string; 291 | /** 292 | * (description) 293 | * 294 | * @type {FullMetadata} 295 | */ 296 | metadata:FullMetadata; 297 | /** 298 | * (description) 299 | * 300 | * @type {StorageReference} 301 | */ 302 | ref:StorageReference; 303 | /** 304 | * (description) 305 | * 306 | * @type {TaskState} 307 | */ 308 | state:TaskState; 309 | /** 310 | * (description) 311 | * 312 | * @type {UploadTask} 313 | */ 314 | task:UploadTask; 315 | /** 316 | * (description) 317 | * 318 | * @type {number} 319 | */ 320 | totalBytes:number; 321 | } 322 | 323 | /** 324 | * (description) 325 | * 326 | * @export 327 | * @interface Observer 328 | */ 329 | export interface Observer { 330 | /** 331 | * (description) 332 | * 333 | * @type {Function} 334 | */ 335 | next?:Function; 336 | /** 337 | * (description) 338 | * 339 | * @type {Function} 340 | */ 341 | error?:Function; 342 | /** 343 | * (description) 344 | * 345 | * @type {Function} 346 | */ 347 | complete?:Function; 348 | } 349 | 350 | /** 351 | * (description) 352 | * 353 | * @export 354 | * @interface SubscribeFn 355 | */ 356 | export interface SubscribeFn{ 357 | (next?:Function,error?:Function,complete?:Function):void; 358 | } 359 | 360 | /** 361 | * (description) 362 | * 363 | * @export 364 | * @interface UnsubscribeFn 365 | */ 366 | export interface UnsubscribeFn{ 367 | ():void; 368 | } 369 | 370 | /** 371 | * (description) 372 | * 373 | * @export 374 | * @interface UploadMetadata 375 | * @extends {SettableMetadata} 376 | */ 377 | export interface UploadMetadata extends SettableMetadata{ 378 | /** 379 | * (description) 380 | * 381 | * @type {string} 382 | */ 383 | md5Hash:string; 384 | } 385 | 386 | /** 387 | * (description) 388 | * 389 | * @export 390 | * @interface UploadTask 391 | */ 392 | export interface UploadTask{ 393 | /** 394 | * (description) 395 | * 396 | * @type {UploadTaskSnapshot} 397 | */ 398 | snapshot:UploadTaskSnapshot; 399 | /** 400 | * (description) 401 | * 402 | * @returns {boolean} (description) 403 | */ 404 | cancel():boolean; 405 | /** 406 | * (description) 407 | * 408 | * @param {string} eventType (description) 409 | * @param {(Function|Observer)} [nextOrObserver] (description) 410 | * @param {Function} [error] (description) 411 | * @param {Function} [complete] (description) 412 | * @returns {(SubscribeFn|UnsubscribeFn)} (description) 413 | */ 414 | on(eventType:string,nextOrObserver?:Function|Observer,error?:Function,complete?:Function):SubscribeFn|UnsubscribeFn; 415 | /** 416 | * (description) 417 | * 418 | * @returns {boolean} (description) 419 | */ 420 | pause():boolean; 421 | /** 422 | * (description) 423 | * 424 | * @returns {boolean} (description) 425 | */ 426 | resume():boolean; 427 | 428 | 429 | } 430 | 431 | /** 432 | * (description) 433 | * 434 | * @export 435 | * @interface StorageReference 436 | */ 437 | export interface StorageReference{ 438 | /** 439 | * (description) 440 | * 441 | * @type {string} 442 | */ 443 | bucket:string; 444 | /** 445 | * (description) 446 | * 447 | * @type {string} 448 | */ 449 | fullPath:string; 450 | /** 451 | * (description) 452 | * 453 | * @type {string} 454 | */ 455 | name:string; 456 | /** 457 | * (description) 458 | * 459 | * @type {StorageReference} 460 | */ 461 | parent:StorageReference; 462 | /** 463 | * (description) 464 | * 465 | * @type {StorageReference} 466 | */ 467 | root:StorageReference; 468 | /** 469 | * (description) 470 | * 471 | * @type {FirebaseStorage} 472 | */ 473 | storage:FirebaseStorage; 474 | /** 475 | * (description) 476 | * 477 | * @param {string} path (description) 478 | * @returns {StorageReference} (description) 479 | */ 480 | child(path:string):StorageReference; 481 | /** 482 | * (description) 483 | * 484 | * @returns {Promise} (description) 485 | */ 486 | delete():Promise; 487 | /** 488 | * (description) 489 | * 490 | * @returns {Promise} (description) 491 | */ 492 | getDownloadURL():Promise; 493 | /** 494 | * (description) 495 | * 496 | * @returns {Promise} (description) 497 | */ 498 | getMetaData():Promise; 499 | /** 500 | * (description) 501 | * 502 | * @param {Blob} blob (description) 503 | * @param {UploadMetadata} metadata (description) 504 | * @returns {UploadTask} (description) 505 | */ 506 | put(blob:Blob|File, metadata?:UploadMetadata):UploadTask; 507 | } 508 | 509 | /** 510 | * (description) 511 | * 512 | * @export 513 | * @interface FirebaseStorage 514 | */ 515 | export interface FirebaseStorage{ 516 | /** 517 | * (description) 518 | * 519 | * @type {number} 520 | */ 521 | maxOperationRetryTime:number; 522 | /** 523 | * (description) 524 | * 525 | * @type {number} 526 | */ 527 | maxUploadRetryTime:number; 528 | /** 529 | * (description) 530 | * 531 | * @param {string} path (description) 532 | * @returns {StorageReference} (description) 533 | */ 534 | ref(path:string):StorageReference; 535 | /** 536 | * (description) 537 | * 538 | * @param {string} url (description) 539 | * @returns {StorageReference} (description) 540 | */ 541 | refFromURL(url:string):StorageReference; 542 | /** 543 | * (description) 544 | * 545 | * @param {number} time (description) 546 | */ 547 | setMaxOperationRetryTime(time:number):void; 548 | /** 549 | * (description) 550 | * 551 | * @param {number} time (description) 552 | */ 553 | setMaxUploadRetryTime(time:number):void; 554 | } 555 | 556 | 557 | 558 | 559 | 560 | export namespace auth { 561 | /** 562 | * (description) 563 | * 564 | * @export 565 | * @interface UserCredential 566 | */ 567 | export interface UserCredential{ 568 | /** 569 | * (description) 570 | * 571 | * @type {User} 572 | */ 573 | user:User; 574 | /** 575 | * (description) 576 | * 577 | * @type {AuthCredential} 578 | */ 579 | credential:auth.AuthCredential; 580 | } 581 | 582 | /** 583 | * (description) 584 | * 585 | * @export 586 | * @interface AuthCredential 587 | */ 588 | export interface AuthCredential{ 589 | /** 590 | * (description) 591 | * 592 | * @type {string} 593 | */ 594 | provider:string; 595 | } 596 | 597 | /** 598 | * (description) 599 | * 600 | * @export 601 | * @interface EmailAuthProvider 602 | * @extends {AuthProvider} 603 | */ 604 | export class EmailAuthProvider implements AuthProvider { 605 | providerId:string; 606 | /** 607 | * (description) 608 | * 609 | * @type {string} 610 | */ 611 | PROVIDER_ID:string; 612 | /** 613 | * (description) 614 | * 615 | * @param {string} email (description) 616 | * @param {string} password (description) 617 | * @returns {AuthCredential} (description) 618 | */ 619 | credential(email:string,password:string):AuthCredential; 620 | setCustomParameters(params:any); 621 | } 622 | 623 | /** 624 | * (description) 625 | * 626 | * @export 627 | * @interface GithubAuthProider 628 | * @extends {AuthProvider} 629 | */ 630 | export class GithubAuthProider implements AuthProvider{ 631 | providerId:string; 632 | /** 633 | * (description) 634 | * 635 | * @type {string} 636 | */ 637 | PROVIDER_ID:string; 638 | /** 639 | * (description) 640 | * 641 | * @param {string} scope (description) 642 | */ 643 | addScope(scope:string):void; 644 | /** 645 | * (description) 646 | * 647 | * @param {string} token (description) 648 | * @returns {AuthCredential} (description) 649 | */ 650 | credential(token:string):AuthCredential; 651 | setCustomParameters(params:any); 652 | } 653 | 654 | /** 655 | * (description) 656 | * 657 | * @export 658 | * @interface GoogleAuthProvider 659 | * @extends {AuthProvider} 660 | */ 661 | export class GoogleAuthProvider implements AuthProvider{ 662 | providerId:string; 663 | /** 664 | * (description) 665 | * 666 | * @param {string} scope (description) 667 | */ 668 | addScope(scope:string):void; 669 | /** 670 | * (description) 671 | * 672 | * @param {string} idToken (description) 673 | * @param {string} accessToken (description) 674 | * @returns {AuthCredential} (description) 675 | */ 676 | credential(idToken:string,accessToken:string):AuthCredential; 677 | /** 678 | * (description) 679 | * 680 | * @type {string} 681 | */ 682 | PROVIDER_ID:string; 683 | setCustomParameters(params:any); 684 | } 685 | 686 | /** 687 | * (description) 688 | * 689 | * @export 690 | * @interface FacebookAuthProvider 691 | * @extends {AuthProvider} 692 | */ 693 | export class FacebookAuthProvider implements AuthProvider{ 694 | providerId:string; 695 | /** 696 | * (description) 697 | * 698 | * @type {string} 699 | */ 700 | PROVIDER_ID:string; 701 | /** 702 | * (description) 703 | * 704 | * @param {string} scope (description) 705 | */ 706 | addScope(scope:string):void; 707 | /** 708 | * (description) 709 | * 710 | * @param {string} token (description) 711 | * @returns {AuthCredential} (description) 712 | */ 713 | credential(token:string):AuthCredential; 714 | setCustomParameters(params:any); 715 | } 716 | 717 | /** 718 | * (description) 719 | * 720 | * @export 721 | * @interface TwitterAuthProvider 722 | * @extends {AuthProvider} 723 | */ 724 | export class TwitterAuthProvider implements AuthProvider{ 725 | providerId:string; 726 | /** 727 | * (description) 728 | * 729 | * @type {string} 730 | */ 731 | PROVIDER_ID:string; 732 | /** 733 | * (description) 734 | * 735 | * @param {string} token (description) 736 | * @param {string} secret (description) 737 | * @returns {AuthCredential} (description) 738 | */ 739 | crendential(token:string,secret:string):AuthCredential; 740 | setCustomParameters(params:any); 741 | } 742 | 743 | /** 744 | * (description) 745 | * 746 | * @export 747 | * @interface ActionCodeInfoData 748 | */ 749 | export interface ActionCodeInfoData{ 750 | /** 751 | * (description) 752 | * 753 | * @type {string} 754 | */ 755 | email:string; 756 | } 757 | 758 | /** 759 | * (description) 760 | * 761 | * @export 762 | * @interface ActionCodeInfo 763 | */ 764 | export interface ActionCodeInfo { 765 | /** 766 | * (description) 767 | * 768 | * @type {ActionCodeInfoData} 769 | */ 770 | data:ActionCodeInfoData; 771 | } 772 | 773 | /** 774 | * (description) 775 | * 776 | * @export 777 | * @interface AuthProvider 778 | */ 779 | export interface AuthProvider { 780 | /** 781 | * (description) 782 | * 783 | * @type {string} 784 | */ 785 | providerId:string; 786 | 787 | setCustomParameters(params:any); 788 | } 789 | } 790 | 791 | 792 | 793 | 794 | 795 | /** 796 | * (description) 797 | * 798 | * @export 799 | * @interface UserProfile 800 | */ 801 | export interface UserProfile { 802 | /** 803 | * (description) 804 | * 805 | * @type {string} 806 | */ 807 | displayName:string; 808 | /** 809 | * (description) 810 | * 811 | * @type {string} 812 | */ 813 | photoURL:string; 814 | } 815 | 816 | 817 | 818 | /** 819 | * (description) 820 | * 821 | * @export 822 | * @interface User 823 | * @extends {UserInfo} 824 | */ 825 | export interface User extends UserInfo{ 826 | /** 827 | * (description) 828 | * 829 | * @type {boolean} 830 | */ 831 | emailVerified:boolean; 832 | /** 833 | * (description) 834 | * 835 | * @type {boolean} 836 | */ 837 | isAnonymous:boolean; 838 | /** 839 | * (description) 840 | * 841 | * @type {UserInfo[]} 842 | */ 843 | providerData:UserInfo[]; 844 | /** 845 | * (description) 846 | * 847 | * @type {string} 848 | */ 849 | refreshToken:string; 850 | /** 851 | * (description) 852 | * 853 | * @returns {Promise} (description) 854 | */ 855 | delete():Promise; 856 | /** 857 | * (description) 858 | * 859 | * @param {boolean} [forceRefresh] (description) 860 | * @returns {Promise} (description) 861 | */ 862 | getToken(forceRefresh?:boolean):Promise; 863 | /** 864 | * (description) 865 | * 866 | * @param {AuthCredential} credentials (description) 867 | * @returns {Promise} (description) 868 | */ 869 | link(credentials:auth.AuthCredential):Promise; 870 | /** 871 | * (description) 872 | * 873 | * @param {AuthProvider} provider (description) 874 | * @returns {Promise} (description) 875 | */ 876 | linkWithPopup(provider:auth.AuthProvider):Promise; 877 | /** 878 | * (description) 879 | * 880 | * @param {AuthCredential} credentil (description) 881 | * @returns {Promise} (description) 882 | */ 883 | reauthenticate(credentil:auth.AuthCredential):Promise; 884 | /** 885 | * (description) 886 | * 887 | * @returns {Promise} (description) 888 | */ 889 | reload():Promise; 890 | /** 891 | * (description) 892 | * 893 | * @returns {Promise} (description) 894 | */ 895 | sendEmailVerification():Promise; 896 | /** 897 | * (description) 898 | * 899 | * @param {string} providerId (description) 900 | * @returns {Promise} (description) 901 | */ 902 | unlink(providerId:string):Promise; 903 | /** 904 | * (description) 905 | * 906 | * @param {string} newEmail (description) 907 | * @returns {Promise} (description) 908 | */ 909 | updateEmail(newEmail:string):Promise; 910 | /** 911 | * (description) 912 | * 913 | * @param {string} newPassword (description) 914 | * @returns {Promise} (description) 915 | */ 916 | updatePassword(newPassword:string):Promise; 917 | /** 918 | * (description) 919 | * 920 | * @param {UserProfile} profile (description) 921 | * @returns {Promise} (description) 922 | */ 923 | updateProfile(profile:UserProfile):Promise; 924 | } 925 | 926 | export interface ObserverFn{ 927 | (user:firebase.User):void; 928 | } 929 | 930 | export namespace auth { 931 | export interface Error { 932 | code:string; 933 | message:string; 934 | } 935 | } 936 | 937 | /** 938 | * (description) 939 | * 940 | * @export 941 | * @class Auth 942 | */ 943 | export class Auth { 944 | /** 945 | * Sign out. 946 | * 947 | * @type {Promise} 948 | */ 949 | signOut(): Promise; 950 | 951 | /** 952 | * Sign in via email/password. 953 | * 954 | * @type {Promise} 955 | */ 956 | signInWithEmailAndPassword(email: string, password:string): Promise; 957 | 958 | /** 959 | * Creates a user via email/password. 960 | * 961 | * @type {Promise} 962 | */ 963 | createUserWithEmailAndPassword(email: string, password:string): Promise; 964 | 965 | /** 966 | * (description) 967 | * 968 | * @type {FirebaseApplication} 969 | */ 970 | app:FirebaseApplication; 971 | /** 972 | * (description) 973 | * 974 | * @type {User} 975 | */ 976 | currentUser:User; 977 | 978 | /** 979 | * Adds an observer for auth state changes. 980 | * 981 | * @param {(firebase.Observer|ObserverFn)} nextOrObserver An observer object or a function triggered on change. 982 | * @param {Function} [opt_error] Optional A function triggered on auth error. 983 | * @param {Function} [opt_completed] Optional A function triggered when the observer is removed. 984 | * @returns {Function} The unsubscribe function for the observer. 985 | 986 | */ 987 | onAuthStateChanged(nextOrObserver:firebase.Observer|ObserverFn, opt_error?:(err:firebase.auth.Error)=>void, opt_completed?:()=>void):Function; 988 | 989 | /** 990 | * getRedirectResult() returns firebase.Promise containing non-null firebase.auth.UserCredential 991 | * 992 | * Returns a UserCredential from the redirect-based sign-in flow. 993 | * 994 | * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an error. If no redirect operation was called, returns a UserCredential with a null User. 995 | * 996 | * @returns {Promise} 997 | * 998 | * @memberOf Auth 999 | */ 1000 | getRedirectResult():Promise; 1001 | 1002 | /** 1003 | * fetchProvidersForEmail(email) returns firebase.Promise containing non-null Array of string 1004 | * 1005 | * Gets the list of provider IDs that can be used to sign in for the given email address. Useful for an "identifier-first" sign-in flow. 1006 | * 1007 | * @param {string} email 1008 | * @returns {Promise} 1009 | * 1010 | * @memberOf Auth 1011 | */ 1012 | fetchProvidersForEmail(email:string):Promise; 1013 | 1014 | /** 1015 | * sendPasswordResetEmail(email) returns firebase.Promise containing void 1016 | * 1017 | * Sends a password reset email to the given email address. 1018 | * To complete the password reset, call firebase.auth.Auth#confirmPasswordReset with the code supplied in the email sent to the user, along with the new password specified by the user. 1019 | * 1020 | * @param {string} email 1021 | * 1022 | * @memberOf Auth 1023 | */ 1024 | sendPasswordResetEmail(email:string):Promise; 1025 | 1026 | /** 1027 | * Asynchronously signs in as an anonymous user. 1028 | * 1029 | * If there is already an anonymous user signed in, that user will be returned; otherwise, a new anonymous user identity will be created and returned. 1030 | * 1031 | * 1032 | * @memberOf Auth 1033 | */ 1034 | signInAnonymously():Promise; 1035 | 1036 | signInWithCredential(credential:firebase.auth.AuthCredential):Promise; 1037 | 1038 | signInWithCustomToken(token:string):Promise; 1039 | 1040 | signInWithPopup(provider:auth.AuthProvider):Promise; 1041 | 1042 | signInWithRedirect(provider:auth.AuthProvider):Promise; 1043 | 1044 | /** 1045 | * verifyPasswordResetCode(code) returns firebase.Promise containing string. 1046 | * 1047 | * Checks a password reset code sent to the user by email or other out-of-band mechanism. 1048 | * 1049 | * Returns the user's email address if valid. 1050 | * 1051 | * Error Codes 1052 | *

auth/expired-action-code

1053 | * Thrown if the password reset code has expired. 1054 | *

auth/invalid-action-code

1055 | * Thrown if the password reset code is invalid. This can happen if the code is malformed or has already been used. 1056 | *

auth/user-disabled

1057 | * Thrown if the user corresponding to the given password reset code has been disabled. 1058 | *

auth/user-not-found

1059 | * Thrown if there is no user corresponding to the password reset code. This may have happened if the user was deleted between when the code was issued and when this method was called. 1060 | * 1061 | * @param {string} code 1062 | * @returns {Promise} 1063 | * 1064 | * @memberOf Auth 1065 | */ 1066 | verifyPasswordResetCode(code:string):Promise; 1067 | 1068 | 1069 | } 1070 | 1071 | /** 1072 | * (description) 1073 | * 1074 | * @export 1075 | * @interface CallbackWithError 1076 | */ 1077 | export interface CallbackWithError{ 1078 | (err:Error):void; 1079 | } 1080 | 1081 | /** 1082 | * (description) 1083 | * 1084 | * @export 1085 | * @interface OnDisconnect 1086 | */ 1087 | export interface OnDisconnect{ 1088 | /** 1089 | * (description) 1090 | * 1091 | * @param {CallbackWithError} onComplete (description) 1092 | * @returns {Promise} (description) 1093 | */ 1094 | cancel(onComplete?:CallbackWithError):Promise; 1095 | /** 1096 | * (description) 1097 | * 1098 | * @param {CallbackWithError} onComplete (description) 1099 | * @returns {Promise} (description) 1100 | */ 1101 | remove(onComplete?:CallbackWithError):Promise; 1102 | /** 1103 | * (description) 1104 | * 1105 | * @param {*} value (description) 1106 | * @param {CallbackWithError} onComplete (description) 1107 | * @returns {Promise} (description) 1108 | */ 1109 | set(value:any,onComplete?:CallbackWithError):Promise; 1110 | /** 1111 | * (description) 1112 | * 1113 | * @param {*} value (description) 1114 | * @param {number} priority (description) 1115 | * @param {CallbackWithError} onComplete (description) 1116 | * @returns {Promise} (description) 1117 | */ 1118 | setWithPriority(value:any,priority:number,onComplete?:CallbackWithError):Promise; 1119 | /** 1120 | * (description) 1121 | * 1122 | * @param {*} objectToMerge (description) 1123 | * @param {CallbackWithError} onComplete (description) 1124 | */ 1125 | update(objectToMerge:any,onComplete:CallbackWithError):void; 1126 | 1127 | 1128 | } 1129 | 1130 | /** 1131 | * (description) 1132 | * 1133 | * @export 1134 | * @interface ThenableReference 1135 | * @extends {DatabaseReference} 1136 | * @extends {DatabaseQuery} 1137 | */ 1138 | export interface ThenableReference extends DatabaseReference, Promise{ 1139 | 1140 | } 1141 | 1142 | /** 1143 | * (description) 1144 | * 1145 | * @export 1146 | * @interface ActionFunction 1147 | */ 1148 | export interface ActionFunction{ 1149 | (snapshot:DataSnapshot):void; 1150 | } 1151 | 1152 | /** 1153 | * A Query sorts and filters the data at a database location so only a subset of the child data is included. 1154 | * This can be used to order a collection of data by some attribute (e.g. height of dinosaurs) as well as to restrict a large list of items (e.g. chat messages) down to a number suitable 1155 | * for synchronizing to the client. Queries are created by chaining together one or more of the filter methods defined here. 1156 | * 1157 | * Just as with a Reference, you can receive data from a Query by using the on() method. 1158 | * You will only receive events and DataSnapshots for the subset of the data that matches your query. 1159 | * 1160 | * @export 1161 | * @interface DatabaseQuery 1162 | */ 1163 | export interface DatabaseQuery{ 1164 | /** 1165 | * Returns a Reference to the Query's location. 1166 | */ 1167 | ref:DatabaseReference; 1168 | /** 1169 | * Creates a Query with the specified starting point. 1170 | * 1171 | * Using startAt(), endAt(), and equalTo() allows you to choose arbitrary starting and ending points for your queries. 1172 | * 1173 | * The starting point is inclusive, so children with exactly the specified value will be included in the query. 1174 | * The optional key argument can be used to further limit the range of the query. If it is specified, then children that have exactly the specified value must also have a key name greater than or equal to the specified key. 1175 | * 1176 | * @param {any} value The value to start at. The argument type depends on which orderBy*() function was used in this query. Specify a value that matches the orderBy*() type. When used in combination with orderByKey(), the value must be a string. 1177 | * @param {any} [key] The child key to start at, among the children with the previously specified priority. This argument is only allowed if ordering by priority. 1178 | * @returns {DatabaseQuery} 1179 | */ 1180 | startAt(value:any,key?:any):DatabaseQuery; 1181 | /** 1182 | * Creates a Query with the specified ending point. 1183 | * 1184 | * Using startAt(), endAt(), and equalTo() allows you to choose arbitrary starting and ending points for your queries. 1185 | * 1186 | * The ending point is inclusive, so children with exactly the specified value will be included in the query. 1187 | * The optional key argument can be used to further limit the range of the query. If it is specified, then children that have exactly the specified value must also have a key name less than or equal to the specified key. 1188 | * 1189 | * @param {any} value The value to end at. The argument type depends on which orderBy*() function was used in this query. Specify a value that matches the orderBy*() type. When used in combination with orderByKey(), the value must be a string. 1190 | * @param {any} [key] The child key to end at, among the children with the previously specified priority. This argument is only allowed if ordering by priority. 1191 | * @returns {DatabaseQuery} 1192 | */ 1193 | endAt(value:any,key?:any):DatabaseQuery; 1194 | 1195 | /** 1196 | * Creates a Query which includes children which match the specified value. 1197 | * 1198 | * Using startAt(), endAt(), and equalTo() allows us to choose arbitrary starting and ending points for our queries. 1199 | * 1200 | * The optional key argument can be used to further limit the range of the query. 1201 | * If it is specified, then children that have exactly the specified value must also have exactly the specified key as their key name. 1202 | * This can be used to filter result sets with many matches for the same value. 1203 | * 1204 | * @param {*} value The value to match for. The argument type depends on which orderBy*() function was used in this query. Specify a value that matches the orderBy*() type. When used in combination with orderByKey(), the value must be a string. 1205 | * @param {*} [key] The child key to start at, among the children with the previously specified priority. This argument is only allowed if ordering by priority. 1206 | * @returns {DatabaseQuery} 1207 | */ 1208 | equalTo(value:any,key?:any):DatabaseQuery; 1209 | /** 1210 | * Generates a new Query limited to the first specific number of children. 1211 | * 1212 | * The limitToFirst() method is used to set a maximum number of children to be synced for a given callback. 1213 | * If we set a limit of 100, we will initially only receive up to 100 child_added events. 1214 | * If we have less than 100 messages stored in our database, a child_added event will fire for each message. 1215 | * However, if we have over 100 messages, we will only receive a child_added event for the first 100 ordered messages. 1216 | * As items change, we will receive child_removed events for each item that drops out of the active list, so that the total number stays at 100. 1217 | * 1218 | * @param {number} limit The maximum number of nodes to include in this query. Value must not be null. 1219 | * @returns {DatabaseQuery} (description) 1220 | * 1221 | * 1222 | */ 1223 | limitToFirst(limit:number):DatabaseQuery; 1224 | /** 1225 | * (description) 1226 | * 1227 | * @param {number} limit (description) 1228 | * @returns {DatabaseQuery} (description) 1229 | */ 1230 | limitToLast(limit:number):DatabaseQuery; 1231 | /** 1232 | * (description) 1233 | * 1234 | * @param {string} [eventType] (description) 1235 | * @param {Function} [callback] (description) 1236 | * @param {*} [context] (description) 1237 | */ 1238 | off(eventType?:string,callback?:Function,context?:any):void; 1239 | /** 1240 | * (description) 1241 | * 1242 | * @param {string} eventType (description) 1243 | * @param {Function} callback (description) 1244 | * @param {(Function|any)} [cancelCallbackOrContext] (description) 1245 | * @param {*} [context] (description) 1246 | * @returns {Function} (description) 1247 | */ 1248 | on(eventType:string,callback:Function,cancelCallbackOrContext?:Function|any,context?:any):Function; 1249 | /** 1250 | * (description) 1251 | * 1252 | * @param {string} eventType (description) 1253 | * @param {Function} userCallback (description) 1254 | * @returns {Promise} (description) 1255 | */ 1256 | once(eventType:string,userCallback?:Function):Promise; 1257 | /** 1258 | * (description) 1259 | * 1260 | * @returns {OnDisconnect} (description) 1261 | */ 1262 | onDisconnect():OnDisconnect; 1263 | /** 1264 | * (description) 1265 | * 1266 | * @param {string} path (description) 1267 | * @returns {DatabaseQuery} (description) 1268 | */ 1269 | orderByChild(path:string):DatabaseQuery; 1270 | /** 1271 | * (description) 1272 | * 1273 | * @returns {DatabaseQuery} (description) 1274 | */ 1275 | orderByKey():DatabaseQuery; 1276 | /** 1277 | * (description) 1278 | * 1279 | * @returns {DatabaseQuery} (description) 1280 | */ 1281 | orderByPriority():DatabaseQuery; 1282 | /** 1283 | * (description) 1284 | * 1285 | * @returns {DatabaseQuery} (description) 1286 | */ 1287 | orderByValue():DatabaseQuery; 1288 | /** 1289 | * (description) 1290 | * 1291 | * @param {*} value (description) 1292 | * @param {CallbackWithError} onComplete (description) 1293 | * @returns {ThenableReference} (description) 1294 | */ 1295 | push(value?:any,onComplete?:CallbackWithError):ThenableReference; 1296 | /** 1297 | * (description) 1298 | * 1299 | * @returns {string} (description) 1300 | */ 1301 | toString():string; 1302 | } 1303 | 1304 | /** 1305 | * (description) 1306 | * 1307 | * @export 1308 | * @interface DataSnapshot 1309 | */ 1310 | export interface DataSnapshot{ 1311 | /** 1312 | * (description) 1313 | * 1314 | * @type {string} 1315 | */ 1316 | key:string; 1317 | /** 1318 | * (description) 1319 | * 1320 | * @type {DatabaseReference} 1321 | */ 1322 | ref:DatabaseReference; 1323 | /** 1324 | * (description) 1325 | * 1326 | * @param {string} path (description) 1327 | * @returns {DataSnapshot} (description) 1328 | */ 1329 | child(path:string):DataSnapshot; 1330 | /** 1331 | * (description) 1332 | * 1333 | * @returns {boolean} (description) 1334 | */ 1335 | exists():boolean; 1336 | /** 1337 | * (description) 1338 | * 1339 | * @returns {*} (description) 1340 | */ 1341 | exportVal():any; 1342 | /** 1343 | * (description) 1344 | * 1345 | * @param {ActionFunction} action (description) 1346 | * @returns {boolean} (description) 1347 | */ 1348 | forEach(action:ActionFunction):boolean; 1349 | /** 1350 | * (description) 1351 | * 1352 | * @returns {(string|number)} (description) 1353 | */ 1354 | getPriority():string|number; 1355 | /** 1356 | * (description) 1357 | * 1358 | * @param {string} path (description) 1359 | * @returns {boolean} (description) 1360 | */ 1361 | hasChild(path:string):boolean; 1362 | /** 1363 | * (description) 1364 | * 1365 | * @returns {boolean} (description) 1366 | */ 1367 | hasChildren():boolean; 1368 | /** 1369 | * (description) 1370 | * 1371 | * @returns {number} (description) 1372 | */ 1373 | numChildren():number; 1374 | /** 1375 | * (description) 1376 | * 1377 | * @returns {*} (description) 1378 | */ 1379 | val():any; 1380 | } 1381 | 1382 | /** 1383 | * (description) 1384 | * 1385 | * @export 1386 | * @interface TransactionResult 1387 | */ 1388 | export interface TransactionResult{ 1389 | /** 1390 | * (description) 1391 | * 1392 | * @type {boolean} 1393 | */ 1394 | committed:boolean; 1395 | /** 1396 | * (description) 1397 | * 1398 | * @type {DataSnapshot} 1399 | */ 1400 | snapshot:DataSnapshot; 1401 | } 1402 | 1403 | /** 1404 | * A Reference represents a specific location in your database and can be used for reading or writing data to that database location. 1405 | * 1406 | * You can reference the root, or child location in your database by calling firebase.database().ref() or 1407 | * firebase.database().ref("child/path"). 1408 | * 1409 | * Writing is done with the set() method and reading can be done with the on() method. 1410 | * 1411 | * @export 1412 | * @interface DatabaseReference 1413 | * @extends {DatabaseQuery} 1414 | */ 1415 | export interface DatabaseReference extends DatabaseQuery{ 1416 | /** 1417 | * The last part of the current path. 1418 | * 1419 | * For example, "ada" is the key for https://sample-app.firebaseio.com/users/ada. 1420 | * 1421 | * The key of the root Reference is null. 1422 | * 1423 | * @type {string} 1424 | */ 1425 | key:string; 1426 | /** 1427 | * The parent location of a Reference. 1428 | * 1429 | * @type {DatabaseReference} 1430 | */ 1431 | parent:DatabaseReference; 1432 | /** 1433 | * Returns a Reference to the Query's location. 1434 | * 1435 | * @type {*} 1436 | */ 1437 | ref:any; 1438 | /** 1439 | * (description) 1440 | * 1441 | * @type {DatabaseReference} 1442 | */ 1443 | root:DatabaseReference; 1444 | /** 1445 | * (description) 1446 | * 1447 | * @param {string} path (description) 1448 | * @returns {DatabaseReference} (description) 1449 | */ 1450 | child(path:string):DatabaseReference; 1451 | /** 1452 | * (description) 1453 | * 1454 | * @param {number} priority (description) 1455 | * @param {CallbackWithError} onComplete (description) 1456 | * @returns {Promise} (description) 1457 | */ 1458 | setPriority(priority:number,onComplete?:CallbackWithError):Promise; 1459 | /** 1460 | * (description) 1461 | * 1462 | * @param {*} newVal (description) 1463 | * @param {number} newPriority (description) 1464 | * @param {CallbackWithError} onComplete (description) 1465 | * @returns {Promise} (description) 1466 | */ 1467 | setWithPriority(newVal:any,newPriority:number,onComplete?:CallbackWithError):Promise; 1468 | /** 1469 | * (description) 1470 | * 1471 | * @param {*} transationUpdate (description) 1472 | * @param {CallbackWithError} onComplete (description) 1473 | * @param {boolean} applyLocally (description) 1474 | * @returns {Promise} (description) 1475 | */ 1476 | transaction(transationUpdate:any,onComplete?:CallbackWithError, 1477 | applyLocally?:boolean):Promise; 1478 | /** 1479 | * (description) 1480 | * 1481 | * @param {*} objectToMerge (description) 1482 | * @param {CallbackWithError} onComplete (description) 1483 | * @returns {Promise} (description) 1484 | */ 1485 | update(objectToMerge:any,onComplete?:CallbackWithError):Promise; 1486 | /** 1487 | * (description) 1488 | * 1489 | * @param {CallbackWithError} onComplete (description) 1490 | * @returns {Promise} (description) 1491 | */ 1492 | remove(onComplete?:CallbackWithError):Promise; 1493 | /** 1494 | * (description) 1495 | * 1496 | * @param {*} newVal (description) 1497 | * @param {CallbackWithError} onComplete (description) 1498 | * @returns {Promise} (description) 1499 | */ 1500 | set(newVal:any,onComplete?:CallbackWithError):Promise; 1501 | 1502 | } 1503 | 1504 | /** 1505 | * The Firebase Database service interface. 1506 | * 1507 | * @export 1508 | * @class Database 1509 | */ 1510 | export class Database { 1511 | /** 1512 | * The App associated with the Database service instance. 1513 | * 1514 | * @type {FirebaseApplication} 1515 | */ 1516 | app:FirebaseApplication; 1517 | /** 1518 | * Disconnect from the server (all database operations will be completed offline). 1519 | * 1520 | * The client automatically maintains a persistent connection to the database server, 1521 | * which will remain active indefinitely and reconnect when disconnected. However, 1522 | * the goOffline() and goOnline() methods may be used to control the client 1523 | * connection in cases where a persistent connection is undesirable. 1524 | * 1525 | * While offline, the client will no longer receive data updates from the database. 1526 | * However, all database operations performed locally will continue to immediately fire events, 1527 | * allowing your application to continue behaving normally. Additionally, 1528 | * each operation performed locally will automatically be queued and retried upon reconnection to the database server. 1529 | */ 1530 | goOffline():void; 1531 | /** 1532 | * (Re)connect to the server and synchronize the offline database state with the server state. 1533 | * 1534 | * This method should be used after disabling the active connection with goOffline(). 1535 | * Once reconnected, the client will transmit the proper data and fire the appropriate events so that your client 1536 | * "catches up" automatically. 1537 | */ 1538 | goOnline():void; 1539 | /** 1540 | * Returns a {DatabaseReference} to the root or the specified path. 1541 | * 1542 | * @param {string} path the path to get a reference to. 1543 | * @returns {DatabaseReference} 1544 | */ 1545 | ref(path?:string):DatabaseReference; 1546 | /** 1547 | * Returns a reference to the root or the path specified in url. 1548 | * An exception is thrown if the url is not in the same domain as the current database. 1549 | * 1550 | * @param {string} url the reference's URL 1551 | * @returns {DatabaseReference} 1552 | */ 1553 | refFromURL(url:string):DatabaseReference; 1554 | } 1555 | 1556 | /** 1557 | * A Firebase App holds the initialization information for a collection of services. 1558 | * 1559 | * @export 1560 | * @class FirebaseApplication 1561 | */ 1562 | export class FirebaseApplication{ 1563 | /** 1564 | * The (read-only) name (identifier) for this App. '[DEFAULT]' is the name of the default App. 1565 | * 1566 | * @type {string} 1567 | */ 1568 | name:string; 1569 | /** 1570 | * The (read-only) configuration options (the original parameters given in firebase.initializeApp()). 1571 | * 1572 | * @type {FirebaseConfig} 1573 | */ 1574 | options:FirebaseConfig; 1575 | /** 1576 | * Gets the Firebase Auth Service object for an App. 1577 | * 1578 | * @returns {Auth} 1579 | */ 1580 | auth():Auth; 1581 | /** 1582 | * Access the Database service from an App instance. 1583 | * 1584 | * @returns {Database} 1585 | */ 1586 | database():Database; 1587 | 1588 | /** 1589 | * Access the Storage service from an App instance. 1590 | * 1591 | * @returns {FirebaseStorage} 1592 | */ 1593 | storage():FirebaseStorage; 1594 | /** 1595 | * Make the given App unusable and free the resources of all associated services. 1596 | */ 1597 | delete():Promise; 1598 | } 1599 | 1600 | } 1601 | 1602 | declare module "firebase" { 1603 | export = firebase 1604 | } 1605 | --------------------------------------------------------------------------------