Skip to content

Commit 8a0f25d

Browse files
author
Lauren Long
committed
Merge remote-tracking branch 'pub/master'
2 parents c6f49ef + 302ebaa commit 8a0f25d

File tree

8 files changed

+140
-7
lines changed

8 files changed

+140
-7
lines changed
File renamed without changes.

.github/ISSUE_TEMPLATE.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!--
2+
3+
Thank you for contributing to the Firebase community!
4+
5+
Have a usage question?
6+
=======================
7+
We get lots of those and we love helping you, but GitHub is not the best place for them and they
8+
will be closed. Here are some resources to get help:
9+
10+
- Start with the quickstart: https://firebase.google.com/docs/functions/write-firebase-functions
11+
- Go through the guide: https://firebase.google.com/docs/functions/
12+
- Read the full API reference: https://firebase.google.com/docs/reference/functions/
13+
- Browse some examples: https://github.com/firebase/functions-samples
14+
15+
If the official documentation doesn't help, try asking through our official support channels:
16+
17+
https://firebase.google.com/support/
18+
19+
*Please avoid double posting across multiple channels!*
20+
21+
Think you found a bug?
22+
=======================
23+
Yeah, we're definitely not perfect! Please use the bug report template below and include a minimal
24+
repro when opening the issue.
25+
26+
27+
Have a feature request?
28+
========================
29+
Great, we love hearing how we can improve our products! Please submit your feature requests to:
30+
https://firebase.google.com/support/contact/bugs-features/. Select 'Functions' as the 'component'.
31+
32+
-->
33+
34+
35+
### Version info
36+
37+
<!-- What versions of the following libraries are you using? Note that your issue may already
38+
be fixed in the latest versions. -->
39+
40+
**firebase-functions:**
41+
42+
**firebase-tools:**
43+
44+
**firebase-admin:**
45+
46+
### Test case
47+
48+
<!-- Provide a minimal, complete, and verifiable example (http://stackoverflow.com/help/mcve) -->
49+
50+
51+
### Steps to reproduce
52+
53+
<!-- Provide the steps needed to reproduce the issue given the above test case. -->
54+
55+
56+
### Were you able to successfully deploy your functions?
57+
58+
<!-- When you ran `firebase deploy`, did you see any error messages? -->
59+
60+
61+
### Expected behavior
62+
63+
<!-- What is the expected behavior? -->
64+
65+
66+
### Actual behavior
67+
68+
<!-- Please copy and paste any error logs from https://console.firebase.google.com/project/_/functions/logs.
69+
If you're experiencing a deployment issue, please copy and paste the entirety of firebase-debug.log -->

.github/PULL_REQUEST_TEMPLATE.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
3+
Thank you for contributing to the Firebase community! Please fill out the pull request form below
4+
and make note of the following:
5+
6+
Run the linter and test suite
7+
==============================
8+
Run `npm test` to make sure your changes compile properly and the tests all pass on your local machine.
9+
We've hooked up this repo with continuous integration to double check those things for you.
10+
11+
Add tests (if applicable)
12+
==============================
13+
Most non-trivial changes should include some extra test coverage. If you aren't sure how to add
14+
tests, feel free to submit regardless and ask us for some advice.
15+
16+
Sign our CLA
17+
==============================
18+
Please sign our Contributor License Agreement (https://cla.developers.google.com/about/google-individual)
19+
before sending PRs. We cannot accept code without this.
20+
21+
-->
22+
23+
24+
### Description
25+
26+
<!-- Are you fixing a bug? Implementing a new feature? Make sure we have the context around your change.
27+
Link to other relevant issues or pull requests. -->
28+
29+
### Code sample
30+
31+
<!-- Proposing an API change? Provide code samples showing how the API will be used. -->

changelog.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
fixed - Updated public README.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-functions",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "Firebase SDK for Cloud Functions",
55
"main": "lib/index.js",
66
"scripts": {

spec/providers/database.spec.ts

+37-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('DeltaSnapshot', () => {
208208
});
209209
});
210210

211-
describe('#forEach(childAction: Function)', () => {
211+
describe('#forEach(action: (a: DeltaSnapshot) => boolean): boolean', () => {
212212
it('should iterate through child snapshots', () => {
213213
populate({ a: 'b' }, { c: 'd' });
214214
let out = '';
@@ -223,12 +223,46 @@ describe('DeltaSnapshot', () => {
223223
let count = 0;
224224
let counter = snap => count++;
225225

226-
subject.forEach(counter);
226+
expect(subject.forEach(counter)).to.equal(false);
227227
populate(23, null);
228228

229-
subject.forEach(counter);
229+
expect(subject.forEach(counter)).to.equal(false);
230230
expect(count).to.eq(0);
231231
});
232+
233+
it('should cancel further enumeration if callback returns true', () => {
234+
populate(null, { a: 'b', c: 'd', e: 'f', g: 'h' });
235+
let out = '';
236+
const ret = subject.forEach(snap => {
237+
if (snap.val() === 'f') {
238+
return true;
239+
}
240+
out += snap.val();
241+
});
242+
expect(out).to.equal('bd');
243+
expect(ret).to.equal(true);
244+
});
245+
246+
it('should not cancel further enumeration if callback returns a truthy value', () => {
247+
populate(null, { a: 'b', c: 'd', e: 'f', g: 'h' });
248+
let out = '';
249+
const ret = subject.forEach(snap => {
250+
out += snap.val();
251+
return 1;
252+
});
253+
expect(out).to.equal('bdfh');
254+
expect(ret).to.equal(false);
255+
});
256+
257+
it('should not cancel further enumeration if callback does not return', () => {
258+
populate(null, { a: 'b', c: 'd', e: 'f', g: 'h' });
259+
let out = '';
260+
const ret = subject.forEach(snap => {
261+
out += snap.val();
262+
});
263+
expect(out).to.equal('bdfh');
264+
expect(ret).to.equal(false);
265+
});
232266
});
233267

234268
describe('#numChildren()', () => {

src/providers/database.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,10 @@ export class DeltaSnapshot implements firebase.database.DataSnapshot {
206206
return valAt(this._delta, this._childPath) !== undefined;
207207
}
208208

209-
// TODO(inlined) what is this boolean for?
210209
forEach(action: (a: DeltaSnapshot) => boolean): boolean {
211210
let val = this.val();
212211
if (_.isPlainObject(val)) {
213-
_.keys(val).forEach(key => action(this.child(key)));
212+
return _.some(val, (value, key: string) => action(this.child(key)) === true);
214213
}
215214
return false;
216215
}

src/providers/storage.ts

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class ObjectBuilder {
7979
export interface ObjectMetadata {
8080
kind: string;
8181
id: string;
82+
resourceState: string;
8283
selfLink?: string;
8384
name?: string;
8485
bucket: string;

0 commit comments

Comments
 (0)