Skip to content

Commit c847e36

Browse files
Merge branch 'master' into mrschmidt-onblocked
2 parents 59f5d48 + 1bc1c46 commit c847e36

File tree

19 files changed

+61
-24
lines changed

19 files changed

+61
-24
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": "5.0.4"
10+
"firebase": "5.1.0"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.0.0-beta.47",

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": "5.0.4"
9+
"firebase": "5.1.0"
1010
},
1111
"devDependencies": {
1212
"typescript": "2.8.1"

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": "5.0.4"
11+
"firebase": "5.1.0"
1212
},
1313
"devDependencies": {
1414
"chai": "4.1.2",

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": "5.0.4"
9+
"firebase": "5.1.0"
1010
},
1111
"devDependencies": {
1212
"@babel/core": "7.0.0-beta.47",

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": "5.0.4"
10+
"firebase": "5.1.0"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.0.0-beta.47",

packages/auth-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/auth-types",
3-
"version": "0.3.3",
3+
"version": "0.3.4",
44
"description": "@firebase/auth Types",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",

packages/auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/auth",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"main": "dist/auth.js",
55
"module": "dist/auth.esm.js",
66
"description": "Javascript library for Firebase Auth SDK",
@@ -19,7 +19,7 @@
1919
},
2020
"license": "Apache-2.0",
2121
"dependencies": {
22-
"@firebase/auth-types": "0.3.3"
22+
"@firebase/auth-types": "0.3.4"
2323
},
2424
"devDependencies": {
2525
"closure-builder": "2.2.39",

packages/database/src/core/util/libs/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function decodePath(pathString: string): string {
4343
*/
4444
function decodeQuery(queryString: string): { [key: string]: string } {
4545
let results = {};
46-
if (queryString.startsWith('?')) {
46+
if (queryString.charAt(0) === '?') {
4747
queryString = queryString.substring(1);
4848
}
4949
for (const segment of queryString.split('&')) {

packages/firebase/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ declare namespace firebase.app {
132132
options: Object;
133133
storage(url?: string): firebase.storage.Storage;
134134
firestore(): firebase.firestore.Firestore;
135-
functions(): firebase.functions.Functions;
135+
functions(region?: string): firebase.functions.Functions;
136136
}
137137
}
138138

packages/firebase/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase",
3-
"version": "5.0.4",
3+
"version": "5.1.0",
44
"description": "Firebase JavaScript library for web and Node.js",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",
@@ -36,11 +36,11 @@
3636
"react-native": "dist/index.rn.cjs.js",
3737
"dependencies": {
3838
"@firebase/app": "0.3.3",
39-
"@firebase/auth": "0.5.3",
39+
"@firebase/auth": "0.7.0",
4040
"@firebase/database": "0.3.3",
41-
"@firebase/firestore": "0.5.4",
41+
"@firebase/firestore": "0.5.5",
4242
"@firebase/functions": "0.2.4",
43-
"@firebase/messaging": "0.3.4",
43+
"@firebase/messaging": "0.3.5",
4444
"@firebase/polyfill": "0.3.3",
4545
"@firebase/storage": "0.2.3"
4646
},

packages/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/firestore",
3-
"version": "0.5.4",
3+
"version": "0.5.5",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"scripts": {

packages/functions-types/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ export class FirebaseFunctions {
4444
* @return The `HttpsCallable` instance.
4545
*/
4646
httpsCallable(name: string): HttpsCallable;
47+
48+
/**
49+
* Changes this instance to point to a Cloud Functions emulator running
50+
* locally. See https://firebase.google.com/docs/functions/local-emulator
51+
*
52+
* @param origin The origin of the local emulator, such as
53+
* "http://localhost:5005".
54+
*/
55+
useFunctionsEmulator(origin: string);
4756
}
4857

4958
/**

packages/functions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ declare module '@firebase/app-types' {
5858
};
5959
}
6060
interface FirebaseApp {
61-
functions?(): types.FirebaseFunctions;
61+
functions?(region?: string): types.FirebaseFunctions;
6262
}
6363
}

packages/functions/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"test:browser": "karma start --single-run",
1717
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
1818
"test:node": "nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --retries 5 --timeout 5000 --exit",
19+
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p test:node",
1920
"prepare": "npm run build"
2021
},
2122
"license": "Apache-2.0",

packages/functions/src/api/service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ interface HttpResponse {
4040
export class Service implements FirebaseFunctions {
4141
private readonly contextProvider: ContextProvider;
4242
private readonly serializer = new Serializer();
43+
private emulatorOrigin: string | null = null;
4344

4445
/**
4546
* Creates a new Functions service for the given app and (optional) region.
@@ -64,9 +65,24 @@ export class Service implements FirebaseFunctions {
6465
_url(name: string): string {
6566
const projectId = this.app_.options.projectId;
6667
const region = this.region_;
68+
if (this.emulatorOrigin !== null) {
69+
const origin = this.emulatorOrigin;
70+
return `${origin}/${projectId}/${region}/${name}`;
71+
}
6772
return `https://${region}-${projectId}.cloudfunctions.net/${name}`;
6873
}
6974

75+
/**
76+
* Changes this instance to point to a Cloud Functions emulator running
77+
* locally. See https://firebase.google.com/docs/functions/local-emulator
78+
*
79+
* @param origin The origin of the local emulator, such as
80+
* "http://localhost:5005".
81+
*/
82+
useFunctionsEmulator(origin: string) {
83+
this.emulatorOrigin = origin;
84+
}
85+
7086
/**
7187
* Returns a reference to the callable https trigger with the given name.
7288
* @param name The name of the trigger.

packages/functions/test/callable.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ describe('Firebase Functions > Call', () => {
5151
let functions: Service;
5252

5353
before(() => {
54-
const projectId = TEST_PROJECT.projectId;
54+
const useEmulator = !!process.env.FIREBASE_FUNCTIONS_EMULATOR_ORIGIN;
55+
const projectId = useEmulator
56+
? 'functions-integration-test'
57+
: TEST_PROJECT.projectId;
5558
const messagingSenderId = 'messaging-sender-id';
5659
const region = 'us-central1';
5760
try {
@@ -63,6 +66,11 @@ describe('Firebase Functions > Call', () => {
6366
);
6467
}
6568
functions = new Service(app, region);
69+
if (useEmulator) {
70+
functions.useFunctionsEmulator(
71+
process.env.FIREBASE_FUNCTIONS_EMULATOR_ORIGIN
72+
);
73+
}
6674
});
6775

6876
it('simple data', async () => {

packages/functions/test/service.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ describe('Firebase Functions > Service', () => {
3131
'https://us-central1-my-project.cloudfunctions.net/foo'
3232
);
3333
});
34+
35+
it('can use emulator', () => {
36+
service.useFunctionsEmulator('http://localhost:5005');
37+
assert.equal(
38+
service._url('foo'),
39+
'http://localhost:5005/my-project/us-central1/foo'
40+
);
41+
service.useFunctionsEmulator(null);
42+
});
3443
});
3544

3645
describe('custom region constructor', () => {

packages/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/messaging",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",

yarn.lock

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,6 @@
516516
"@firebase/util" "0.1.10"
517517
tslib "^1.9.0"
518518

519-
"@firebase/[email protected]":
520-
version "0.5.3"
521-
resolved "https://registry.npmjs.org/@firebase/auth/-/auth-0.5.3.tgz#4f0d83cd5a7c173d3a7a06f904bb1084acd8a0c4"
522-
dependencies:
523-
"@firebase/auth-types" "0.3.3"
524-
525519
"@firebase/[email protected]":
526520
version "0.2.1"
527521
resolved "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.2.1.tgz#f83a6d03af5f8c93276ceb89e1f31e4664c9df1b"

0 commit comments

Comments
 (0)