Skip to content

Commit f5d190a

Browse files
committed
Merge branch 'master' into mmermerkaya-refactor-obj
2 parents 3a3c7bd + ae32b2b commit f5d190a

File tree

34 files changed

+220
-72
lines changed

34 files changed

+220
-72
lines changed

integration/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "6.0.2"
10+
"firebase": "6.0.3"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.4.4",

integration/firebase-typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "tsc index.ts --outDir dist"
77
},
88
"dependencies": {
9-
"firebase": "6.0.2"
9+
"firebase": "6.0.3"
1010
},
1111
"devDependencies": {
1212
"typescript": "3.4.5"

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:manual": "mocha --exit"
99
},
1010
"dependencies": {
11-
"firebase": "6.0.2"
11+
"firebase": "6.0.3"
1212
},
1313
"devDependencies": {
1414
"chai": "4.2.0",

integration/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "karma start --single-run"
77
},
88
"dependencies": {
9-
"firebase": "6.0.2"
9+
"firebase": "6.0.3"
1010
},
1111
"devDependencies": {
1212
"@babel/core": "7.4.4",

integration/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "6.0.2"
10+
"firebase": "6.0.3"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.4.4",

packages/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/app",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "The primary entrypoint to the Firebase JS SDK",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -25,7 +25,7 @@
2525
"license": "Apache-2.0",
2626
"dependencies": {
2727
"@firebase/app-types": "0.4.0",
28-
"@firebase/util": "0.2.15",
28+
"@firebase/util": "0.2.16",
2929
"@firebase/logger": "0.1.14",
3030
"tslib": "1.9.3",
3131
"dom-storage": "2.1.0",

packages/app/src/errors.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ const ERRORS: ErrorMap<AppError> = {
4040
'Firebase App instance.'
4141
};
4242

43-
const appErrors = new ErrorFactory<AppError>('app', 'Firebase', ERRORS);
43+
type ErrorParams = { [key in AppError]: { name: string } };
4444

45-
export function error(code: AppError, args?: { [name: string]: any }) {
46-
throw appErrors.create(code, args);
47-
}
45+
export const ERROR_FACTORY = new ErrorFactory<AppError, ErrorParams>(
46+
'app',
47+
'Firebase',
48+
ERRORS
49+
);

packages/app/src/firebaseApp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
FirebaseAppInternals
2828
} from '@firebase/app-types/private';
2929
import { deepCopy, deepExtend } from '@firebase/util';
30-
import { error, AppError } from './errors';
30+
import { AppError, ERROR_FACTORY } from './errors';
3131
import { DEFAULT_ENTRY_NAME } from './constants';
3232

3333
interface ServicesCache {
@@ -202,7 +202,7 @@ export class FirebaseAppImpl implements FirebaseApp {
202202
*/
203203
private checkDestroyed_(): void {
204204
if (this.isDeleted_) {
205-
error(AppError.APP_DELETED, { name: this.name_ });
205+
throw ERROR_FACTORY.create(AppError.APP_DELETED, { name: this.name_ });
206206
}
207207
}
208208
}

packages/app/src/firebaseNamespaceCore.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '@firebase/app-types/private';
3232
import { deepExtend, patchProperty } from '@firebase/util';
3333
import { FirebaseAppImpl } from './firebaseApp';
34-
import { error, AppError } from './errors';
34+
import { ERROR_FACTORY, AppError } from './errors';
3535
import { FirebaseAppLiteImpl } from './lite/firebaseAppLite';
3636
import { DEFAULT_ENTRY_NAME } from './constants';
3737
import { version } from '../../firebase/package.json';
@@ -105,7 +105,7 @@ export function createFirebaseNamespaceCore(
105105
function app(name?: string): FirebaseApp {
106106
name = name || DEFAULT_ENTRY_NAME;
107107
if (!contains(apps, name)) {
108-
error(AppError.NO_APP, { name: name });
108+
throw ERROR_FACTORY.create(AppError.NO_APP, { name: name });
109109
}
110110
return apps[name];
111111
}
@@ -134,11 +134,11 @@ export function createFirebaseNamespaceCore(
134134
const { name } = config;
135135

136136
if (typeof name !== 'string' || !name) {
137-
error(AppError.BAD_APP_NAME, { name: String(name) });
137+
throw ERROR_FACTORY.create(AppError.BAD_APP_NAME, { name: String(name) });
138138
}
139139

140140
if (contains(apps, name)) {
141-
error(AppError.DUPLICATE_APP, { name: name });
141+
throw ERROR_FACTORY.create(AppError.DUPLICATE_APP, { name: name });
142142
}
143143

144144
const app = new firebaseAppImpl(
@@ -177,7 +177,7 @@ export function createFirebaseNamespaceCore(
177177
): FirebaseServiceNamespace<FirebaseService> {
178178
// Cannot re-register a service that already exists
179179
if (factories[name]) {
180-
error(AppError.DUPLICATE_SERVICE, { name: name });
180+
throw ERROR_FACTORY.create(AppError.DUPLICATE_SERVICE, { name: name });
181181
}
182182

183183
// Capture the service factory for later service instantiation
@@ -198,7 +198,9 @@ export function createFirebaseNamespaceCore(
198198
if (typeof appArg[name] !== 'function') {
199199
// Invalid argument.
200200
// This happens in the following case: firebase.storage('gs:/')
201-
error(AppError.INVALID_APP_ARGUMENT, { name: name });
201+
throw ERROR_FACTORY.create(AppError.INVALID_APP_ARGUMENT, {
202+
name: name
203+
});
202204
}
203205

204206
// Forward service instance lookup to the FirebaseApp.

packages/app/src/lite/firebaseAppLite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
FirebaseService
2727
} from '@firebase/app-types/private';
2828
import { deepCopy, deepExtend } from '@firebase/util';
29-
import { error, AppError } from '../errors';
29+
import { ERROR_FACTORY, AppError } from '../errors';
3030
import { DEFAULT_ENTRY_NAME } from '../constants';
3131

3232
interface ServicesCache {
@@ -168,7 +168,7 @@ export class FirebaseAppLiteImpl implements FirebaseApp {
168168
*/
169169
private checkDestroyed_(): void {
170170
if (this.isDeleted_) {
171-
error(AppError.APP_DELETED, { name: this.name_ });
171+
throw ERROR_FACTORY.create(AppError.APP_DELETED, { name: this.name_ });
172172
}
173173
}
174174
}

packages/database/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -28,7 +28,7 @@
2828
"dependencies": {
2929
"@firebase/database-types": "0.4.0",
3030
"@firebase/logger": "0.1.14",
31-
"@firebase/util": "0.2.15",
31+
"@firebase/util": "0.2.16",
3232
"faye-websocket": "0.11.1",
3333
"tslib": "1.9.3"
3434
},

packages/firebase/index.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,20 @@ declare namespace firebase.app {
11301130
* ```
11311131
*/
11321132
delete(): Promise<any>;
1133+
/**
1134+
* Gets the {@link firebase.installations.Installations `Installations`} service for the
1135+
* current app.
1136+
*
1137+
* @webonly
1138+
*
1139+
* @example
1140+
* ```javascript
1141+
* const installations = app.installations();
1142+
* // The above is shorthand for:
1143+
* // const installations = firebase.installations(app);
1144+
* ```
1145+
*/
1146+
installations(): firebase.installations.Installations;
11331147
/**
11341148
* Gets the {@link firebase.messaging.Messaging `Messaging`} service for the
11351149
* current app.
@@ -1220,6 +1234,39 @@ declare namespace firebase.app {
12201234
}
12211235
}
12221236

1237+
/**
1238+
* @webonly
1239+
*/
1240+
declare namespace firebase.installations {
1241+
/**
1242+
* The Firebase Installations service interface.
1243+
*
1244+
* Do not call this constructor directly. Instead, use
1245+
* {@link firebase.installations `firebase.installations()`}.
1246+
*/
1247+
export interface Installations {
1248+
/**
1249+
* Creates a Firebase Installation if there isn't one for the app and
1250+
* returns the Installation ID.
1251+
*
1252+
* @return Firebase Installation ID
1253+
*/
1254+
getId(): Promise<string>;
1255+
1256+
/**
1257+
* Returns an Authentication Token for the current Firebase Installation.
1258+
*
1259+
* @return Firebase Installation Authentication Token
1260+
*/
1261+
getToken(): Promise<string>;
1262+
1263+
/**
1264+
* Deletes the Firebase Installation and all associated data.
1265+
*/
1266+
delete(): Promise<void>;
1267+
}
1268+
}
1269+
12231270
/**
12241271
* @webonly
12251272
*/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright 2019 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import '@firebase/installations';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "firebase/installations",
3+
"main": "dist/index.cjs.js",
4+
"module": "dist/index.esm.js",
5+
"typings": "../empty-import.d.ts"
6+
}

packages/firebase/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase",
3-
"version": "6.0.2",
3+
"version": "6.0.3",
44
"description": "Firebase JavaScript library for web and Node.js",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",
@@ -37,17 +37,18 @@
3737
"module": "dist/index.esm.js",
3838
"react-native": "dist/index.rn.cjs.js",
3939
"dependencies": {
40-
"@firebase/app": "0.4.1",
40+
"@firebase/app": "0.4.2",
4141
"@firebase/app-types": "0.4.0",
4242
"@firebase/auth": "0.11.2",
43-
"@firebase/database": "0.4.1",
44-
"@firebase/firestore": "1.3.1",
43+
"@firebase/database": "0.4.2",
44+
"@firebase/firestore": "1.3.2",
4545
"@firebase/functions": "0.4.7",
46-
"@firebase/messaging": "0.3.20",
46+
"@firebase/installations": "0.1.2",
47+
"@firebase/messaging": "0.3.21",
4748
"@firebase/polyfill": "0.3.14",
4849
"@firebase/storage": "0.2.16",
49-
"@firebase/performance": "0.2.2",
50-
"@firebase/util": "0.2.15"
50+
"@firebase/performance": "0.2.3",
51+
"@firebase/util": "0.2.16"
5152
},
5253
"devDependencies": {
5354
"git-rev-sync": "1.12.0",
@@ -68,6 +69,7 @@
6869
"database",
6970
"firestore",
7071
"functions",
72+
"installations",
7173
"messaging",
7274
"storage",
7375
"performance"
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"name": "firebase/performance",
3-
"main": "dist/index.cjs.js",
4-
"module": "dist/index.esm.js"
5-
}
2+
"name": "firebase/performance",
3+
"main": "dist/index.cjs.js",
4+
"module": "dist/index.esm.js",
5+
"typings": "../empty-import.d.ts"
6+
}

packages/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/firestore",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"scripts": {
@@ -31,8 +31,8 @@
3131
"@firebase/firestore-types": "1.3.0",
3232
"@firebase/logger": "0.1.14",
3333
"@firebase/webchannel-wrapper": "0.2.20",
34-
"@grpc/grpc-js": "0.4.0",
3534
"@grpc/proto-loader": "^0.5.0",
35+
"grpc": "1.20.3",
3636
"tslib": "1.9.3"
3737
},
3838
"peerDependencies": {

packages/firestore/src/platform_node/grpc_connection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18-
import * as grpc from '@grpc/grpc-js';
18+
import * as grpc from 'grpc';
1919

2020
import firebase from '@firebase/app';
2121
const SDK_VERSION = firebase.SDK_VERSION;
2222

23-
const grpcVersion = require('@grpc/grpc-js/package.json').version;
23+
const grpcVersion = require('grpc/package.json').version;
2424

2525
import { Token } from '../api/credentials';
2626
import { DatabaseInfo } from '../core/database_info';

packages/firestore/src/platform_node/load_protos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18-
import * as grpc from '@grpc/grpc-js';
1918
import * as protoLoader from '@grpc/proto-loader';
19+
import * as grpc from 'grpc';
2020
import * as path from 'path';
2121
import * as ProtobufJS from 'protobufjs';
2222

packages/installations-types/index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
import { FirebaseApp } from '@firebase/app-types';
1919

2020
export interface FirebaseInstallations {
21+
/**
22+
* Creates a Firebase Installation if there isn't one for the app and
23+
* returns the Installation ID.
24+
*
25+
* @return Firebase Installation ID
26+
*/
2127
getId(): Promise<string>;
28+
29+
/**
30+
* Returns an Authentication Token for the current Firebase Installation.
31+
*
32+
* @return Firebase Installation Authentication Token
33+
*/
2234
getToken(): Promise<string>;
35+
36+
/**
37+
* Deletes the Firebase Installation and all associated data.
38+
*/
2339
delete(): Promise<void>;
2440
}

0 commit comments

Comments
 (0)