Giter VIP home page Giter VIP logo

googleapis / nodejs-firestore Goto Github PK

View Code? Open in Web Editor NEW
633.0 64.0 145.0 11.43 MB

Node.js client for Google Cloud Firestore: a NoSQL document database built for automatic scaling, high performance, and ease of application development.

Home Page: https://cloud.google.com/firestore/

License: Apache License 2.0

JavaScript 63.99% TypeScript 35.81% Python 0.12% Shell 0.08%
nodejs firestore database nosql

nodejs-firestore's Introduction

Google Cloud Platform logo

release level npm version

This is the Node.js Server SDK for Google Cloud Firestore. Google Cloud Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.

This Cloud Firestore Server SDK uses Google’s Cloud Identity and Access Management for authentication and should only be used in trusted environments. Your Cloud Identity credentials allow you bypass all access restrictions and provide read and write access to all data in your Cloud Firestore project.

The Cloud Firestore Server SDKs are designed to manage the full set of data in your Cloud Firestore project and work best with reliable network connectivity. Data operations performed via these SDKs directly access the Cloud Firestore backend and all document reads and writes are optimized for high throughput.

Applications that use Google's Server SDKs should not be used in end-user environments, such as on phones or on publicly hosted websites. If you are developing a Web or Node.js application that accesses Cloud Firestore on behalf of end users, use the firebase Client SDK.

Note: This Cloud Firestore Server SDK does not support Firestore databases created in Datastore mode. To access these databases, use the Datastore SDK.

A comprehensive list of changes in each version may be found in the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Cloud Firestore API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/firestore

Using the client library

const {Firestore} = require('@google-cloud/firestore');

// Create a new client
const firestore = new Firestore();

async function quickstart() {
  // Obtain a document reference.
  const document = firestore.doc('posts/intro-to-firestore');

  // Enter new data into the document.
  await document.set({
    title: 'Welcome to Firestore',
    body: 'Hello World',
  });
  console.log('Entered new data into the document');

  // Update an existing document.
  await document.update({
    body: 'My first Firestore app',
  });
  console.log('Updated an existing document');

  // Read the document.
  const doc = await document.get();
  console.log('Read the document');

  // Delete the document.
  await document.delete();
  console.log('Deleted the document');
}
quickstart();

Samples

Samples are in the samples/ directory. Each sample's README.md has instructions for running its sample.

Sample Source Code Try it
Limit-to-last-query source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell
Solution-counters source code Open in Cloud Shell

The Cloud Firestore Node.js Client API Reference documentation also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-cloud/firestore@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE

nodejs-firestore's People

Contributors

alexander-fenster avatar bcoe avatar cherylenkidu avatar crwilcox avatar dconeybe avatar dpebot avatar ehsannas avatar fhinkel avatar gcf-merge-on-green[bot] avatar gcf-owl-bot[bot] avatar greenkeeper[bot] avatar jkwlui avatar jmdobry avatar justinbeckwith avatar laljikanjareeya avatar lukesneeringer avatar markduckworth avatar mikelehen avatar milaggl avatar release-please[bot] avatar renovate-bot avatar renovate[bot] avatar schmidt-sebastian avatar sk- avatar sofisl avatar summer-ji-eng avatar surferjeffatgoogle avatar tom-andersen avatar wu-hui avatar yoshi-automation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs-firestore's Issues

Add Generic Types

Proposal

Add Generic Types with defaults to DocumentReference, CollectionReference, Query, etc.

export class DocumentReference<D = DocumentData, U = UpdateData, P = CollectionReference<D, U>|null, S = {[subCollectionId: string]: CollectionReference}> {

D and U are pretty straight forward, but P would be for the parent type and S would be for the typing of subcollections. This would still be backwards compatible as providing no types would default to what is currently typed.

Currently if I want to achieve any of this I have to create wrapper interfaces for any Firestore classes I want to use and retype all of the methods, then type the collections/documents with those wrappers.

I'd be happy to make a PR with the necessary changes if you think this change is beneficial.

Reasons

  1. Typed data returned from DocumentSnapshot (i.e. eliminates the need to import types and explicitly type variables containing the data.)
  2. Enforcement of parent types and subcollections and their types
  3. Enforcement of update rules (i.e. if certain values should only be written on create, or if one value is changed, another should also be updated)
  4. Easier to extend Firestore classes for modeling purposes (only as interface since constructors are private)
const chatRooms = firestore.collection<ChatRoom, ChatRoomUpdateRules>('rooms')
const myChatRoomRef = chatRooms.doc(myChatRoomId)
const myChatRoomDoc = await myChatRoomRef.get()
const myChatRoomInfo = myChatRoomDoc.data() //myChatRoomInfo is of type ChatRoom

const members = myChatRoomDoc.ref.collection<Member, MemberUpdateRules>('members')
const certainMembersQuery = members.where('posts', '>=', 3).orderBy('posts').limit(10)
certainMembersQuery.onSnapshot((membersSnapshot) => {
  membersSnapshot.docChanges.forEach((change) => {
    const memberInfo = change.doc.data() //memberInfo is of type Member
  })
  membersSnapshot.docs.forEach((doc) => {
    const memberInfo = doc.data() //memberInfo is of type Member
    const otherChatRoomRef = doc.ref.parent.parent.parent.doc(otherChatRoomId) // Maintains typings of parents
  })
})

Enforcing subcollections

import * as admin from 'firebase-admin'
import * as Event from './event'

interface IOrganizationModel {
  ...
}

interface IOrganizationUpdateRules {
  ...
}

interface IOrganizationSubcollections {
  events: Event
}

export default admin.firestore().collection<IOrganizationModel, IOrganizationUpdateRules, null, IOrganizationSubcollections>('organizations')
import Organizations from './organizations'

const myOrgDoc = await Organization.doc('myOrgId').get()
const myCurrentEvents = await myOrgDoc.ref.collection('events').where('end', '>=', new Date().getTime()).orderBy('end').get() // type checks successfully and holds the Event model types
const myCurrentMembers = await myOrgDoc.ref.collection('members').get() // collection('members') fails type check since 'members' is not a keyof IOrganizationSubcollections

Errors when importing library into Vue.js webpack template

I'm trying to implement a Firestore DB into a new Vue.js project based on webpack, but I cannot make it work and I don't know how.

In plain Javascript it works properly.

Environment details

  • OS: macOS Sierra 10.12.6 (16G29)
  • Node.js version: v8.5.0
  • npm version: 5.4.2
  • @google-cloud/firestore version: ^0.8.2

Steps to reproduce

  1. Install Vue.js cli: npm install -g vue-cli
  2. Create a project form scratch: vue init webpack firestore
  3. Create a file and initialize Firestore
  4. Import that file into main.js
  5. Start app with npm run dev; default home page now does not work.

I have tried to configure webpack with some changes, like adding a β€œnode” object with the packages or targeting β€œnode”, but none works correctly. Here I describe the two attempts and the results.

I think it's related with the template's webpack configuration, but as I don't know who to ask I may post the problem here asking for your assistance.

Thank you very much in advance!

Trigger into firestore not called -> exception thrown

Thanks for stopping by to let us know something could be better!

Please run down the following list and make sure you've tried the usual "quick
fixes":

If you are still having issues, please be sure to include as much information as
possible:

Environment details

  • OS:Google Cloud
  • Node.js version: 6.11
  • npm version:
  • @google-cloud/firestore version: 0.10

Steps to reproduce

  1. Create trigger to subcollection document create, change, Insert into firestore subcollection document with array value
  2. You will see

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined at convertValue (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/convert.js:182:44) at convertDocument (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/convert.js:226:22) at Firestore.snapshot_ (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/index.js:376:11) at dataConstructor (/user_code/node_modules/firebase-functions/lib/providers/firestore.js:100:38) at Object. (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:57:31) at next (native) at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71 at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12) at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:53:36) at /var/tmp/worker/worker.js:695:26

Following these steps will guarantee the quickest resolution possible.

Thanks!

DocumentSnapshot in startAt or startAfter cause an error: Error: Cannot encode type ([object Object]) to a Firestore Value

Hello,

According to the https://firebase.google.com/docs/firestore/query-data/query-cursors
we could be able to use a document snapshot to define the query cursor.

but in the fact, it throws an error: "Error: Cannot encode type ([object Object]) to a Firestore Value".

Environment details

  • OS: Windows 10
  • Node.js version: 9.2.0
  • npm version: 5.5.1
  • @google-cloud/firestore version: 0.10.0

Steps to reproduce

const first = firestore.collection("collectionName")
  .orderBy("population")
  .limit(25)
  .get()
  .then(function (documentSnapshots) {
    // Get the last visible document
    const lastVisible = documentSnapshots.docs[documentSnapshots.docs.length-1];

    const next = firestore.collection("collectionName")
      .orderBy("population")
      .startAfter(lastVisible)
      .limit(25)
      .get()
      .then(data => {
        console.log(data.docs.length);
      });
  });

I tried the same with @firebase/firestore and it works just fine.

Error: Firestore: Operation was rejected because the system is not in a state required for the operation`s execution.

According to the Firebase Cloud Firestore documentation for orderBy this should work:

var facultyQuery = facultyRef.where("Middle School", "==", true).orderBy('bb_last_name', 'desc');

I also tried this to make sure it wasn't the Map data causing issues:

var facultyQuery = facultyRef.where("department", "==", "Core Teacher").orderBy('bb_last_name', 'desc');

However it produces the error:

Error: Firestore: Operation was rejected because the system is not in a state required for the operations execution. (firestore/failed-precondition).`

Both of these simpler cases work just fine:

var facultyQuery = facultyRef.orderBy('bb_last_name', 'asc');
var facultyQuery = facultyRef.where("department", "==", "Core Teacher");

But when I combine the where and the orderBy, something I have done before with other Firestore collections, it fails. The documentation also states that "...queries that only use equality clauses don't need additional indexes" so I did not think I needed one.

spkcb

An in-range update of prettier is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 1.11.1 of prettier was just published.

Branch Build failing 🚨
Dependency prettier
Current Version 1.11.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ❌ ci/circleci: node9 Your tests failed on CircleCI Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of prettier is breaking the build 🚨

Version 1.8.0 of prettier was just published.

Branch Build failing 🚨
Dependency prettier
Current Version 1.7.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node7 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: docs Your tests passed on CircleCI! Details
  • ❌ ci/circleci: lint Your tests failed on CircleCI Details

Release Notes 1.8.0: Markdown Support

image

This release adds Markdown support, a new --insert-pragma flag, fixes a number of formatting issues, adds support for some new experimental operators, and improves our editor integration support.

Highlights

Markdown Support

Support markdown (#2943) by @ikatyang

You can now run Prettier on Markdown files! πŸŽ‰

The implementation is highly compliant with the CommonMark spec, and backed by the excellent remark-parse package.

Word Wrap

One of Prettier's core features is its ability to wrap code at a specified line length. This applies to Markdown too, which means you can maintain nice and clean 80-character-wide Markdown files without having to re-adjust line breaks manually when you add or delete words.

Input:

VoilΓ ! In view, a humble vaudevillian veteran cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valourous visitation of a bygone vexation stands vivified and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition! The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honour to meet you and you may call me V.

Output:

VoilΓ ! In view, a humble vaudevillian veteran cast vicariously as both victim
and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity,
is a vestige of the vox populi, now vacant, vanished. However, this valourous
visitation of a bygone vexation stands vivified and has vowed to vanquish these
venal and virulent vermin vanguarding vice and vouchsafing the violently vicious
and voracious violation of volition! The only verdict is vengeance; a vendetta
held as a votive, not in vain, for the value and veracity of such shall one day
vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage
veers most verbose, so let me simply add that it's my very good honour to meet
you and you may call me V.

Note for CJK users: If your markdown renderer does not support CJK line ending, you'll have to use plugin like markdown-it-perfect-newline-for-cjk, hexo-filter-fix-cjk-spacing, etc. to remove additional spaces.

// Source
δΈ€δΊŒδΈ‰
ε››δΊ”ε…­
七八九

// Rendered content with unsupported renderer
δΈ€δΊŒδΈ‰ ε››δΊ”ε…­ 七八九

// Rendered content with supported renderer or via plugin
δΈ€δΊŒδΈ‰ε››δΊ”ε…­δΈƒε…«δΉ

Code Formatting

Powered by Prettier's generic "multiparser", Prettier will format code blocks in Markdown! We use the language code provided with the code block to determine which language it is, and thus we can format any language that Prettier supports (including Markdown itself, if you're into that).

Input:

```js
reallyUgly    (
javascript
  )
```
.h1 {     color : red }
```</pre></div>
<p>Output:</p>
<div class="highlight highlight-source-lisp"><pre>```js
reallyUgly(javascript)<span class="pl-c"><span class="pl-c">;</span></span>
.h1 {
  color: red<span class="pl-c"><span class="pl-c">;</span></span>
}
```</pre></div>
<blockquote>
<p>Note: In some cases you may not want to format your code in Markdown, and just like in other languages, in Markdown you can use <code>&lt;!-- prettier-ignore --&gt;</code> before the code block to ignore it from formatting.</p>
</blockquote>
<p><strong>Lists</strong></p>
<p>When rearranging list items, after running Prettier all the numbers will be fixed!</p>
<p><a href="https://camo.githubusercontent.com/50f76500c503763c50019ad61ff531716ff7f3c9/687474703a2f2f672e7265636f726469742e636f2f4d4174616e5a4d5a526f2e676966" target="_blank"><img src="https://camo.githubusercontent.com/50f76500c503763c50019ad61ff531716ff7f3c9/687474703a2f2f672e7265636f726469742e636f2f4d4174616e5a4d5a526f2e676966" alt="Markdown Lists" style="max-width:100%;"></a></p>
<blockquote>
<p>Note: you can actually opt out of this by using <code>1.</code> for all list items if you want to optimize for cleaner diffs.</p>
</blockquote>
<p><strong>Tables</strong></p>
<p>Tables will also automatically be adjusted to fit their contents. This could be completely unmaintainable without an automated tool.</p>
<p><a href="https://camo.githubusercontent.com/7f33126347f155262873500e5068016d2e71a773/687474703a2f2f672e7265636f726469742e636f2f33356a61383836636b542e676966" target="_blank"><img src="https://camo.githubusercontent.com/7f33126347f155262873500e5068016d2e71a773/687474703a2f2f672e7265636f726469742e636f2f33356a61383836636b542e676966" alt="Markdown Tables" style="max-width:100%;"></a></p>
<p><strong>Markdown-in-JS</strong></p>
<p>By using either <code>md</code> or <code>markdown</code> tagged template literals, you can format markdown code inside JavaScript.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-k">const</span> <span class="pl-c1">markdown</span> <span class="pl-k">=</span> md<span class="pl-s"><span class="pl-pds">`</span></span>
<span class="pl-s">  # heading</span>
<span class="pl-s"></span>
<span class="pl-s">  1. list item</span>
<span class="pl-s"><span class="pl-pds">`</span></span>;</pre></div>
<h2>CLI</h2>
<h3>Add option to insert <code>@format</code> to first docblock if absent (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2865" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="258974830" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2865">#2865</a>) by <a href="https://urls.greenkeeper.io/samouri" class="user-mention">@samouri</a></h3>
<p>In 1.7, we added an option called <code>--require-pragma</code> to require files contain an <code>/** @format */</code> pragma to be formatted. In order to add this pragma to a large set of files you can now use <a href="https://prettier.io/docs/en/cli.html#insert-pragma"><code>--insert-pragma</code></a> flag.</p>
<pre><code>prettier --write "folder/**/*.js" --insert-pragma
</code></pre>
<h3>Add <code>--loglevel</code> option (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2992" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263707174" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2992">#2992</a>) by <a href="https://urls.greenkeeper.io/ikatyang" class="user-mention">@ikatyang</a></h3>
<p>This <a href="https://prettier.io/docs/en/cli.html#loglevel">nifty feature</a> allows you to opt in (or out) of Prettier's logging. We've also cleaned up the logging substantially since 1.7.</p>
<div class="highlight highlight-source-shell"><pre>$ prettier --loglevel=debug blarg
$ ./bin/prettier.js --loglevel=debug blarg
[debug] normalized argv: {<span class="pl-s"><span class="pl-pds">"</span>_<span class="pl-pds">"</span></span>:[<span class="pl-s"><span class="pl-pds">"</span>blarg<span class="pl-pds">"</span></span>],<span class="pl-s"><span class="pl-pds">"</span>bracket-spacing<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>color<span class="pl-pds">"</span></span>:true,<span class="pl-s"><span class="pl-pds">"</span>debug-check<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>debug-print-doc<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>flow-parser<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>insert-pragma<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>jsx-bracket-same-line<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>list-different<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>require-pragma<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>semi<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>single-quote<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>stdin<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>use-tabs<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>version<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>with-node-modules<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>write<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>loglevel<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>debug<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>ignore-path<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>.prettierignore<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>config-precedence<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>cli-override<span class="pl-pds">"</span></span>}
[error] No matching files. Patterns tried: blarg <span class="pl-k">!</span><span class="pl-k">**</span>/node_modules/<span class="pl-k">**</span> <span class="pl-k">!</span>./node_modules/<span class="pl-k">**</span>
</pre></div>
<h2>JavaScript</h2>
<h3>Fix indentation for JSDoc comments (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2470" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="242554023" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2470">#2470</a>) by <a href="https://urls.greenkeeper.io/maxdeviant" class="user-mention">@maxdeviant</a></h3>
<p>This has been a long-time known issue with Prettier. When formatting code that results in a change of indentation level, the JSDoc comments would end up being out of alignment. We're happy to report this is now fixed!</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">function</span> <span class="pl-en">theFunction2</span>(<span class="pl-smi">action$</span>, <span class="pl-smi">store</span>) {
  <span class="pl-c"><span class="pl-c">/*</span></span>
<span class="pl-c">     * comments</span>
<span class="pl-c">     <span class="pl-c">*/</span></span>
  <span class="pl-k">return</span> <span class="pl-c1">true</span>;
}

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">function</span> <span class="pl-en">theFunction2</span>(<span class="pl-smi">action$</span>, <span class="pl-smi">store</span>) {
  <span class="pl-c"><span class="pl-c">/*</span></span>
<span class="pl-c">   * comments</span>
<span class="pl-c">   <span class="pl-c">*/</span></span>
  <span class="pl-k">return</span> <span class="pl-c1">true</span>;
}</pre></div>
<h3>Print pipeline and nullish-coalescing operators (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3036" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265544605" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3036">#3036</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>We've added support for two new proposed operators to Prettier: the <em>pipeline operator</em> and the <em>nullish coalescing operator</em>.</p>
<p>The <a href="https://urls.greenkeeper.io/tc39/proposal-pipeline-operator/">pipeline operator</a> is currently a stage one proposal.</p>
<blockquote>
<p>This proposal introduces a new operator |&gt; similar to F#, OCaml, Elixir, Elm, Julia, Hack, and LiveScript, as well as UNIX pipes. It's a backwards-compatible way of streamlining chained function calls in a readable, functional manner, and provides a practical alternative to extending built-in prototypes.</p>
</blockquote>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">let</span> result <span class="pl-k">=</span> <span class="pl-en">exclaim</span>(<span class="pl-en">capitalize</span>(<span class="pl-en">doubleSay</span>(<span class="pl-s"><span class="pl-pds">"</span>hello<span class="pl-pds">"</span></span>)));

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">let</span> result <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>hello<span class="pl-pds">"</span></span>
  <span class="pl-k">|</span><span class="pl-k">&gt;</span> doubleSay
  <span class="pl-k">|</span><span class="pl-k">&gt;</span> capitalize
  <span class="pl-k">|</span><span class="pl-k">&gt;</span> exclaim;</pre></div>
<p>The <a href="https://urls.greenkeeper.io/tc39-transfer/proposal-nullish-coalescing">nullish coalescing operator</a> is another stage one proposal.</p>
<blockquote>
<p>When performing optional property access in a nested structure in conjunction with the optional chaining operator, it is often desired to provide a default value if the result of that property access is null or undefined.</p>
</blockquote>
<p>This operator is similar to <code>||</code> except it only evaluates the right-hand-side if the left is <code>undefined</code> or <code>null</code>, not <code>""</code>, <code>0</code>, <code>NaN</code>, etc.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-k">const</span> <span class="pl-c1">foo</span> <span class="pl-k">=</span> <span class="pl-smi">object</span>.<span class="pl-smi">foo</span> <span class="pl-k">??</span> <span class="pl-s"><span class="pl-pds">"</span>default<span class="pl-pds">"</span></span>;</pre></div>
<h3>Improved template literal expresions line breaks (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3124" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="269808048" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3124">#3124</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>This was another known issue with Prettier, when printing a template literal string with expressions inside that went over the print width, it would wrap the code in weird places inside the expressions. Now, if Prettier needs to insert a line break, it should happen right between <code>${</code> and <code>}</code>.</p>
<div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">const</span> <span class="pl-smi">description</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">The value of the <span class="pl-e">${<span class="pl-smi">cssName</span>}</span> css of the <span class="pl-e">${<span class="pl-c1">this</span></span></span></span>
<span class="pl-s"><span class="pl-s"><span class="pl-e">  <span class="pl-k">.</span><span class="pl-smi">_name</span>}</span> element</span><span class="pl-s">`</span></span>;

<span class="pl-k">const</span> <span class="pl-smi">foo</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">mdl-textfield mdl-js-textfield <span class="pl-e">${<span class="pl-smi">className</span>}</span> <span class="pl-e">${<span class="pl-smi">content</span><span class="pl-k">.</span><span class="pl-smi">length</span><span class="pl-k"> &gt;</span> <span class="pl-c1">0</span></span></span></span>
<span class="pl-s"><span class="pl-s"><span class="pl-e">  <span class="pl-k">?</span> <span class="pl-s"><span class="pl-pds">"</span>is-dirty<span class="pl-pds">"</span></span></span></span></span>
<span class="pl-s"><span class="pl-s"><span class="pl-e">  <span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>}</span> combo-box__input</span><span class="pl-s">`</span></span>;

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">const</span> <span class="pl-smi">description</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">The value of the \${cssName} css of the \${</span></span>
<span class="pl-s"><span class="pl-s">  this._name</span></span>
<span class="pl-s"><span class="pl-s">} element</span><span class="pl-s">`</span></span>;

<span class="pl-k">const</span> <span class="pl-smi">foo</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">mdl-textfield mdl-js-textfield <span class="pl-e">${<span class="pl-smi">className</span>}</span> <span class="pl-e">${</span></span></span>
<span class="pl-s"><span class="pl-s"><span class="pl-e"><span class="pl-smi">  content</span><span class="pl-k">.</span><span class="pl-smi">length</span><span class="pl-k"> &gt;</span> <span class="pl-c1">0</span> <span class="pl-k">?</span> <span class="pl-s"><span class="pl-pds">'</span>is-dirty<span class="pl-pds">'</span></span> <span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span></span></span></span>
<span class="pl-s"><span class="pl-s"><span class="pl-e">}</span> combo-box__input</span><span class="pl-s">`</span></span></pre></div>
<h2>JSX</h2>
<h3>Don't inline trailing <code>}</code> for arrow functions attributes (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3110" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="268739661" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3110">#3110</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>In order to align closer to the <a href="https://urls.greenkeeper.io/airbnb/javascript/">Airbnb style guide</a>, and since it was never intentionally printed this way, we've moved the <code>}</code> from to the next line in JSX. This is more diff friendly, and makes it easier to move code around by shifting lines in your editor.</p>
<div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
&lt;<span class="pl-ent"><span class="pl-c1">BookingIntroPanel</span></span>
  <span class="pl-e">logClick</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">data</span> <span class="pl-k">=&gt;</span></span>
<span class="pl-s1">    <span class="pl-en">doLogClick</span>(<span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>,<span class="pl-smi"> data</span>)</span><span class="pl-pse">}</span>
/&gt;;

<span class="pl-c"><span class="pl-c">//</span> After</span>
&lt;<span class="pl-ent"><span class="pl-c1">BookingIntroPanel</span></span>
  <span class="pl-e">logClick</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">data</span> <span class="pl-k">=&gt;</span></span>
<span class="pl-s1">    <span class="pl-en">doLogClick</span>(<span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>,<span class="pl-smi"> data</span>)</span>
<span class="pl-s1">  </span><span class="pl-pse">}</span>
/&gt;;</pre></div>
<h1>Other Changes</h1>
<h2>JavaScript</h2>
<h3>Make the factory detection handle multiple elements (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3112" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="268967545" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3112">#3112</a>) by <a href="https://urls.greenkeeper.io/vjeux" class="user-mention">@vjeux</a></h3>
<p>There was a bug in the heuristic that Prettier uses to determine whether an expression is a factory or not. It now works correctly with longer member expressions.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-c1">window</span>.<span class="pl-smi">FooClient</span>
  .<span class="pl-en">setVars</span>({
    locale<span class="pl-k">:</span> <span class="pl-en">getFooLocale</span>({ page }),
    authorizationToken<span class="pl-k">:</span> <span class="pl-smi">data</span>.<span class="pl-smi">token</span>
  })
  .<span class="pl-en">initVerify</span>(<span class="pl-s"><span class="pl-pds">"</span>foo_container<span class="pl-pds">"</span></span>);

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-c1">window</span>.<span class="pl-smi">FooClient</span>.<span class="pl-en">setVars</span>({
  locale<span class="pl-k">:</span> <span class="pl-en">getFooLocale</span>({ page }),
  authorizationToken<span class="pl-k">:</span> <span class="pl-smi">data</span>.<span class="pl-smi">token</span>
}).<span class="pl-en">initVerify</span>(<span class="pl-s"><span class="pl-pds">"</span>foo_container<span class="pl-pds">"</span></span>);</pre></div>
<h3>Handle comments between function name and open paren (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2979" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263070152" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2979">#2979</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>Printing comments in the right place is an endless challenge <g-emoji alias="wink" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f609.png" ios-version="6.0">πŸ˜‰</g-emoji>. This fix ensures that comments next to function names are re-printed correctly.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">function</span> <span class="pl-en">f</span>(<span class="pl-c"><span class="pl-c">/*</span> comment<span class="pl-c">*/</span></span> <span class="pl-smi">promise</span>) {}

<span class="pl-c"><span class="pl-c">//</span> After </span>
<span class="pl-k">function</span> f <span class="pl-c"><span class="pl-c">/*</span> comment<span class="pl-c">*/</span></span>(<span class="pl-smi">promise</span>) {}</pre></div>
<h3>Support sequential CallExpressions in member chains (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2990" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263677479" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2990">#2990</a>) by <a href="https://urls.greenkeeper.io/chrisvoll" class="user-mention">@chrisvoll</a></h3>
<p>Member chains are one of the most complex parts of Prettier. This PR fixes an issue where repeated calls lead to the next method not being pushed to the next line.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
wrapper
  .<span class="pl-c1">find</span>(<span class="pl-s"><span class="pl-pds">"</span>SomewhatLongNodeName<span class="pl-pds">"</span></span>)
  .<span class="pl-en">prop</span>(<span class="pl-s"><span class="pl-pds">"</span>longPropFunctionName<span class="pl-pds">"</span></span>)().<span class="pl-en">then</span>(<span class="pl-k">function</span>() {
  <span class="pl-en">doSomething</span>();
});

<span class="pl-c"><span class="pl-c">//</span> After</span>
wrapper
  .<span class="pl-c1">find</span>(<span class="pl-s"><span class="pl-pds">"</span>SomewhatLongNodeName<span class="pl-pds">"</span></span>)
  .<span class="pl-en">prop</span>(<span class="pl-s"><span class="pl-pds">"</span>longPropFunctionName<span class="pl-pds">"</span></span>)()
  .<span class="pl-en">then</span>(<span class="pl-k">function</span>() {
    <span class="pl-en">doSomething</span>();
  });</pre></div>
<h3>Account for empty lines in long member call chain (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3035" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265515302" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3035">#3035</a>) by <a href="https://urls.greenkeeper.io/jackyho112" class="user-mention">@jackyho112</a></h3>
<p>Previously, Prettier would delete all newlines within a member chain. Now we keep up to one if it's in the source. This is nice for fluent APIs that you want to break up over multiple lines.</p>
<div class="highlight highlight-source-js"><pre>angular
  .<span class="pl-en">module</span>(<span class="pl-s"><span class="pl-pds">"</span>AngularAppModule<span class="pl-pds">"</span></span>)

  <span class="pl-c"><span class="pl-c">//</span> Constants.</span>
  .<span class="pl-en">constant</span>(<span class="pl-s"><span class="pl-pds">"</span>API_URL<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>http://localhost:8080/api<span class="pl-pds">"</span></span>)

  <span class="pl-c"><span class="pl-c">//</span> App configuration.</span>
  .<span class="pl-en">config</span>(appConfig)
  .<span class="pl-en">run</span>(appRun);</pre></div>
<h3>Fix issue where first argument is left behind when line breaks (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3079" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267371127" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3079">#3079</a>) by <a href="https://urls.greenkeeper.io/mutdmour" class="user-mention">@mutdmour</a></h3>
<p>This addresses an issue where due to our special object inline behaviour, the indentation missing from the function call.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-smi">db</span>.<span class="pl-en">collection</span>(<span class="pl-s"><span class="pl-pds">"</span>indexOptionDefault<span class="pl-pds">"</span></span>).<span class="pl-en">createIndex</span>({ a<span class="pl-k">:</span> <span class="pl-c1">1</span> },
{
  indexOptionDefaults<span class="pl-k">:</span> <span class="pl-c1">true</span>
},
<span class="pl-k">function</span>(<span class="pl-smi">err</span>) {
  <span class="pl-c"><span class="pl-c">//</span> code</span>
});

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-smi">db</span>.<span class="pl-en">collection</span>(<span class="pl-s"><span class="pl-pds">"</span>indexOptionDefault<span class="pl-pds">"</span></span>).<span class="pl-en">createIndex</span>(
  { a<span class="pl-k">:</span> <span class="pl-c1">1</span> },
  {
    indexOptionDefaults<span class="pl-k">:</span> <span class="pl-c1">true</span>
  },
  <span class="pl-k">function</span>(<span class="pl-smi">err</span>) {
    <span class="pl-c"><span class="pl-c">//</span> code</span>
  }
);</pre></div>
<h3>Break parens for binaries in member expression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2958" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262164203" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2958">#2958</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>Similarly, there was another edge case where indentation was missing from logical expressions. This is fixed, too.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">const</span> <span class="pl-c1">someLongVariable</span> <span class="pl-k">=</span> (<span class="pl-en">idx</span>(
  <span class="pl-c1">this</span>.<span class="pl-smi">props</span>,
  <span class="pl-smi">props</span> <span class="pl-k">=&gt;</span> <span class="pl-smi">props</span>.<span class="pl-smi">someLongPropertyName</span>
) <span class="pl-k">||</span> []
).<span class="pl-en">map</span>(<span class="pl-smi">edge</span> <span class="pl-k">=&gt;</span> <span class="pl-smi">edge</span>.<span class="pl-smi">node</span>);

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">const</span> <span class="pl-c1">someLongVariable</span> <span class="pl-k">=</span> (
  <span class="pl-en">idx</span>(<span class="pl-c1">this</span>.<span class="pl-smi">props</span>, <span class="pl-smi">props</span> <span class="pl-k">=&gt;</span> <span class="pl-smi">props</span>.<span class="pl-smi">someLongPropertyName</span>) <span class="pl-k">||</span> []
).<span class="pl-en">map</span>(<span class="pl-smi">edge</span> <span class="pl-k">=&gt;</span> <span class="pl-smi">edge</span>.<span class="pl-smi">node</span>);</pre></div>
<h3>Prevent breaking MemberExpression inside NewExpression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3075" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267232001" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3075">#3075</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>There are so many ways to break a line. Some of them look much worse than others. Breaking between in this case looked really weird, so it has been fixed!</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-k">function</span> <span class="pl-en">functionName</span>() {
  <span class="pl-k">if</span> (<span class="pl-c1">true</span>) {
    <span class="pl-c1">this</span>.<span class="pl-smi">_aVeryLongVariableNameToForceLineBreak</span> <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-en">this</span>
      .<span class="pl-en">Promise</span>((<span class="pl-smi">resolve</span>, <span class="pl-smi">reject</span>) <span class="pl-k">=&gt;</span> {
        <span class="pl-c"><span class="pl-c">//</span> do something</span>
      });
  }
}

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">function</span> <span class="pl-en">functionName</span>() {
  <span class="pl-k">if</span> (<span class="pl-c1">true</span>) {
    <span class="pl-c1">this</span>.<span class="pl-smi">_aVeryLongVariableNameToForceLineBreak</span> <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-en">this.Promise</span>(
      (<span class="pl-smi">resolve</span>, <span class="pl-smi">reject</span>) <span class="pl-k">=&gt;</span> {
        <span class="pl-c"><span class="pl-c">//</span> do something</span>
      }
    );
  }
}</pre></div>
<h3>Fix array acessors in method chains (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3137" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="270637812" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3137">#3137</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>In a method chain we split lines by grouping elements together and accessing an array should be printed in the end of a group instead of the beginning.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-en">find</span>(<span class="pl-s"><span class="pl-pds">'</span>.org-lclp-edit-copy-url-banner__link<span class="pl-pds">'</span></span>)
  [<span class="pl-c1">0</span>].<span class="pl-c1">getAttribute</span>(<span class="pl-s"><span class="pl-pds">'</span>href<span class="pl-pds">'</span></span>)
  .<span class="pl-c1">indexOf</span>(<span class="pl-c1">this</span>.<span class="pl-smi">landingPageLink</span>)

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-en">find</span>(<span class="pl-s"><span class="pl-pds">'</span>.org-lclp-edit-copy-url-banner__link<span class="pl-pds">'</span></span>)[<span class="pl-c1">0</span>]
  .<span class="pl-c1">getAttribute</span>(<span class="pl-s"><span class="pl-pds">'</span>href<span class="pl-pds">'</span></span>)
  .<span class="pl-c1">indexOf</span>(<span class="pl-c1">this</span>.<span class="pl-smi">landingPageLink</span>)</pre></div>
<h2>Flow and TypeScript</h2>
<h3>Fix indentation of intersection object types (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3074" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267225804" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3074">#3074</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>This was a minor alignment bug in intersection types, and has now been fixed.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
type intersectionTest <span class="pl-k">=</span> {
  propA<span class="pl-k">:</span> <span class="pl-c1">X</span>
} <span class="pl-k">&amp;</span> {
  propB<span class="pl-k">:</span> <span class="pl-c1">X</span>
} <span class="pl-k">&amp;</span> {
    propC<span class="pl-k">:</span> <span class="pl-c1">X</span>
  } <span class="pl-k">&amp;</span> {
    propD<span class="pl-k">:</span> <span class="pl-c1">X</span>
  };

<span class="pl-c"><span class="pl-c">//</span> After</span>
type Props <span class="pl-k">=</span> {
  propA<span class="pl-k">:</span> <span class="pl-c1">X</span>
} <span class="pl-k">&amp;</span> {
  propB<span class="pl-k">:</span> <span class="pl-c1">X</span>
} <span class="pl-k">&amp;</span> {
  propC<span class="pl-k">:</span> <span class="pl-c1">X</span>
} <span class="pl-k">&amp;</span> {
  propD<span class="pl-k">:</span> <span class="pl-c1">X</span>
};</pre></div>
<h3>Keep parens around TSAsExpression in ConditionalExpression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3053" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="266402555" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3053">#3053</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>We missed a case where we need to keep the parenthesis with TypeScript's <code>as</code> assertions. This is now fixed.</p>
<div class="highlight highlight-source-ts"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
<span class="pl-c"></span><span class="pl-smi">aValue</span> <span class="pl-k">as</span> <span class="pl-c1">boolean</span> ? <span class="pl-c1">0</span> : <span class="pl-k">-</span><span class="pl-c1">1</span>;

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-c"></span>(<span class="pl-smi">aValue</span> <span class="pl-k">as</span> <span class="pl-c1">boolean</span>) <span class="pl-k">?</span> <span class="pl-c1">0</span> <span class="pl-k">:</span> <span class="pl-k">-</span><span class="pl-c1">1</span>;</pre></div>
<h2>JSX</h2>
<h3>Collapse multiple JSX whitespaces (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2973" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262564212" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2973">#2973</a>) by <a href="https://urls.greenkeeper.io/karl" class="user-mention">@karl</a></h3>
<p>This fixes up the issue where JSX formatting occasionally needed to be run twice to become stable. This occurred when you had multiple JSX whitespace elements or JSX whitespace followed by a space.</p>
<div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
&lt;<span class="pl-ent">div</span>&gt;
    <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span></span><span class="pl-pse">}</span> &lt;<span class="pl-ent"><span class="pl-c1">Badge</span></span> <span class="pl-e">src</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">notificationIconPng</span></span><span class="pl-pse">}</span> /&gt;
&lt;/<span class="pl-ent">div</span>&gt;;

<span class="pl-c"><span class="pl-c">//</span> After</span>
&lt;<span class="pl-ent">div</span>&gt;
  <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span></span><span class="pl-pse">}</span>
  &lt;<span class="pl-ent"><span class="pl-c1">Badge</span></span> <span class="pl-e">src</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">notificationIconPng</span></span><span class="pl-pse">}</span> /&gt;
&lt;/<span class="pl-ent">div</span>&gt;</pre></div>
<h3>Don't print JSX bracket on same line when it has trailing comments (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3088" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267549517" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3088">#3088</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>This was an issue with the <code>--jsx-bracket-same-line</code> option. Turns out you can't <em>always</em> put the bracket on the same line...</p>
<div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Input</span>
&lt;<span class="pl-ent">div</span>
<span class="pl-c">  <span class="pl-c">//</span> comment</span>
&gt;
  <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span>
&lt;/<span class="pl-ent">div</span>&gt;

<span class="pl-c"><span class="pl-c">//</span> Before</span>
&lt;<span class="pl-ent">div</span>&gt;
// comment
  <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span>
&lt;/<span class="pl-ent">div</span>&gt;;

<span class="pl-c"><span class="pl-c">//</span> After</span>
&lt;<span class="pl-ent">div</span>
<span class="pl-c"><span class="pl-c">//</span> comment</span>
&gt;
  <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span>
&lt;/<span class="pl-ent">div</span>&gt;;</pre></div>
<h2>CSS</h2>
<h3>Preserve line breaks in grid declarations (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3133" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="270384528" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3133">#3133</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>Prettier will now preserve line breaks included in the source code when formatting the <code>grid</code> and <code>grid-template-*</code> rules, since those are important to keep in separate lines, but still applies the formatting like other rules (e.g., numbers and quotes).</p>
<div class="highlight highlight-source-css"><pre><span class="pl-c"><span class="pl-c">/*</span> Original Input <span class="pl-c">*/</span></span>
<span class="pl-ent">div</span> {
  <span class="pl-c1"><span class="pl-c1">grid</span></span>:
    [wide-start] <span class="pl-s"><span class="pl-pds">'</span>header header header<span class="pl-pds">'</span></span> <span class="pl-c1">200.000<span class="pl-k">px</span></span>
    [wide-end] <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">.50<span class="pl-k">fr</span></span>
    / <span class="pl-c1">auto</span> <span class="pl-c1">50.000<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>;
}

<span class="pl-c"><span class="pl-c">/*</span> Before <span class="pl-c">*/</span></span>
<span class="pl-ent">div</span> {
  <span class="pl-c1"><span class="pl-c1">grid</span></span>: [wide-start] <span class="pl-s"><span class="pl-pds">"</span>header header header<span class="pl-pds">"</span></span> <span class="pl-c1">200<span class="pl-k">px</span></span> [wide-end]
    <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">0.5<span class="pl-k">fr</span></span> / <span class="pl-c1">auto</span> <span class="pl-c1">50<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>;
}

<span class="pl-c"><span class="pl-c">/*</span> After <span class="pl-c">*/</span></span>
<span class="pl-ent">div</span> {
  <span class="pl-c1"><span class="pl-c1">grid</span></span>:
    [wide-start] <span class="pl-s"><span class="pl-pds">"</span>header header header<span class="pl-pds">"</span></span> <span class="pl-c1">200<span class="pl-k">px</span></span>
    [wide-end] <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">0.5<span class="pl-k">fr</span></span>
    / <span class="pl-c1">auto</span> <span class="pl-c1">50<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>;
}</pre></div>
<h2>SCSS</h2>
<h3>Format SCSS maps like CSS rules (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3070" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267054763" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3070">#3070</a>) by <a href="https://urls.greenkeeper.io/asmockler" class="user-mention">@asmockler</a></h3>
<p>Turns out SCSS maps are much prettier when printed over multiple lines.</p>
<div class="highlight highlight-source-scss"><pre><span class="pl-c">// Before</span>
<span class="pl-smi">$map</span>: (color: <span class="pl-c1">#111111</span>, <span class="pl-c1">text</span><span class="pl-c1">-</span>shadow:<span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 0</span> <span class="pl-bu">salmon</span>)

// After
<span class="pl-smi">$map</span>: (
  color: <span class="pl-c1">#111111</span>,
  <span class="pl-c1">text</span><span class="pl-c1">-</span>shadow:<span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 0</span> <span class="pl-bu">salmon</span>
);</pre></div>
<h2>CSS-in-JS</h2>
<h3>Fix formatting styled(Foo).attrs(...)`` (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3073" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267192603" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3073">#3073</a>) by <a href="https://urls.greenkeeper.io/existentialism" class="user-mention">@existentialism</a></h3>
<p>Prettier will now format the CSS in styled-components code that looks like this:</p>
<div class="highlight highlight-source-js"><pre><span class="pl-en">styled</span>(Component).<span class="pl-en">attrs</span>({})<span class="pl-s"><span class="pl-pds">`</span></span>
<span class="pl-s">  color: red;</span>
<span class="pl-s"><span class="pl-pds">`</span></span>;</pre></div>
<h2>GraphQL</h2>
<h3>Prevent formatting GraphQL template literals with expressions (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2975" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262809788" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2975">#2975</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3>
<p>Prettier doesn't support formatting JavaScript expressions in GraphQL. See <a href="https://urls.greenkeeper.io/prettier/prettier/issues/2640" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="251412470" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2640">#2640</a> for tracking. There was a bug where formatting an expression lead to invalid code, so we've completely disabled formatting GraphQL when it contains JavaScript expressions until we fully support it.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span>
(invalid code)

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-en">graphql</span>(schema, <span class="pl-s"><span class="pl-pds">`</span>{ query test { id }} <span class="pl-s1"><span class="pl-pse">${</span>fragment<span class="pl-pse">}</span></span><span class="pl-pds">`</span></span>)</pre></div>
<h2>CLI</h2>
<h3>Don't use ANSI codes if stdout isn't a TTY (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2903" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="260810621" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2903">#2903</a>) by <a href="https://urls.greenkeeper.io/narigo" class="user-mention">@Narigo</a></h3>
<p>Previously, piping the output of <code>--list-different</code> to other tools was troublesome due to the ANSI color codes we use to show whether a file was modified or not. This PR disables the use of color when Prettier is piped to a different process.</p>
<h2>Configuration</h2>
<h3>Use relative paths with CLI (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2969" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262449905" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2969">#2969</a>) by <a href="https://urls.greenkeeper.io/ahmedelgabri" class="user-mention">@ahmedelgabri</a></h3>
<p>This fixes a bug where passing a path starting with <code>./</code> to the CLI wouldn't match patterns used in <code>.prettierignore</code>.</p>
<pre><code># .prettierignore
path/to/*.js
</code></pre>
<p>After this fix, no files will be written to when executing:</p>
<div class="highlight highlight-source-shell"><pre>$ prettier --write ./path/to/<span class="pl-k">*</span>.js</pre></div>
<h3>Resolve file paths relative to config file (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3037" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265550594" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3037">#3037</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>This fixes an issue where <code>.prettierrc</code> overrides, under certain conditions, were not being respected for absolute paths with the <code>resolveConfig</code> API.</p>
<h2>Core</h2>
<h3>Respect CJK width and Combined Characters (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3003" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264227112" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3003">#3003</a>,  <a href="https://urls.greenkeeper.io/prettier/prettier/pull/3015" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264803229" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3015">#3015</a>) by <a href="https://urls.greenkeeper.io/ikatyang" class="user-mention">@ikatyang</a></h3>
<p>Chinese, Japanese and Korean characters are now considered two characters wide.</p>
<div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before (exceeds print width when CJK characters are 2x monospace chars)</span>
<span class="pl-k">const</span> <span class="pl-c1">x</span> <span class="pl-k">=</span> [<span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>];

<span class="pl-c"><span class="pl-c">//</span> After</span>
<span class="pl-k">const</span> <span class="pl-c1">x</span> <span class="pl-k">=</span> [
  <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>,
   <span class="pl-c"><span class="pl-c">//</span> ...</span>
  <span class="pl-s"><span class="pl-pds">"</span>δΈ­ζ–‡<span class="pl-pds">"</span></span>
];</pre></div>
<p><a href="https://urls.greenkeeper.io/prettier/prettier/pull/3015" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264803229" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3015">#3015</a> also ensures that combining characters (e.g. <code>Á</code>) are counted as one character.</p>
<h2>Editor Support</h2>
<h3>Implement getSupportInfo() and use it for inference (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3033" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265494522" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3033">#3033</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3>
<p>We've added a new function to the API (<code>prettier.getSupportInfo([version])</code>), and the CLI <code>--support-info</code>. This can be used to interrogate Prettier to find out which languages the current version, or an older version, supports. It also provides useful information such as CodeMirror IDs, tmScopes, etc, which can be used to automate some of the work done with lookup tables in text editor integrations.</p>
<p>Internally, we use this information to drive which extensions trigger which parsers, and support some common files that don't have extensions, like <code>.prettierrc</code>, <code>Jakefile</code>, etc.</p>
<div class="highlight highlight-source-shell"><pre><span class="pl-c"><span class="pl-c">#</span> prettier knows that this file is JSON now.</span>
$ prettier --write .prettierrc</pre></div>
<h3>Split source elements relative to their language. (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3069" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="266872265" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3069">#3069</a>) by <a href="https://urls.greenkeeper.io/cigit" class="user-mention">@CiGit</a></h3>
<p>This fixes an issue in editors that support range formatting, where formatting an object would cause Prettier to crash.</p>
<hr>
<h1>Thanks! <g-emoji alias="heart" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/2764.png" ios-version="6.0">❀️</g-emoji></h1>
<p>Thanks to everyone who contributed to this release, as well as those who raised issues! Prettier has become a highly stable piece of software that a large amount of people trust with their code. We take that trust seriously, and fix rare issues that break code with the highest priority. We can't fix these issues if we don't know about them, so never be afraid to <a href="https://urls.greenkeeper.io/prettier/prettier/issues/new">create an issue</a>!</p>
</details>



<details>
<summary>FAQ and help</summary>

There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>


---


Your [Greenkeeper](https://greenkeeper.io) Bot :palm_tree:

An in-range update of eslint-config-prettier is breaking the build 🚨

Version 2.9.0 of eslint-config-prettier was just published.

Branch Build failing 🚨
Dependency eslint-config-prettier
Current Version 2.8.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint-config-prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node9 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node7 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • ❌ ci/circleci: docs CircleCI is running your tests Details
  • ❌ ci/circleci: lint Your tests failed on CircleCI Details

Commits

The new version differs by 2 commits.

  • 984de70 eslint-config-prettier v2.9.0
  • 0ea836f Add implicit-arrow-linebreak

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

"Error 3: Order must include __name__" when using "limit"

Environment details

  • OS: 10.12.6 (16G29)
  • Node.js version: v8.1.4
  • npm version: 5.4.2
  • @google-cloud/firestore version: 0.9.0

Steps to reproduce

  1. Follow instructions for setting up Nodejs Firestore here
  2. Run this file
  3. If you add orderBy('__name__'), it gets past the error, but fails at return value of query.comparator() (specifically reference.js:1679:19).

Extra info

Proto built from query (without orderBy('__name__')):

{
  "parent":"projects/<projectId>/databases/(default)",
  "structuredQuery":{
    "from":[
      {
        "collectionId":"collectionId"
      }
    ],
    "orderBy":[
      {
        "field":{
          "fieldPath":"index"
        },
        "direction":"ASCENDING"
      }
    ],
    "limit":{
      "value":5
    }
  }
}

(with orderBy('__name__')):

{
  "parent":"projects/<projectId>/databases/(default)",
  "structuredQuery":{
    "from":[
      {
        "collectionId":"collectionId"
      }
    ],
    "orderBy":[
      {
        "field":{
          "fieldPath":"index"
        },
        "direction":"ASCENDING"
      },
      {
        "field":{
          "fieldPath":"__name__"
        },
        "direction":"ASCENDING"
      }
    ],
    "limit":{
      "value":5
    }
  }
}

Request built using the web version (follow setup here; file here):

{
  "database":"projects/<projectId>/databases/(default)",
  "addTarget":{
    "query":{
      "structuredQuery":{
        "from":[
          {
            "collectionId":"collectionId"
          }
        ],
        "orderBy":[
          {
            "field":{
              "fieldPath":"index"
            },
            "direction":"DESCENDING"
          },
          {
            "field":{
              "fieldPath":"__name__"
            },
            "direction":"DESCENDING"
          }
        ],
        "limit":2
      },
      "parent":"projects/<projectId>/databases/(default)"
    },
    "targetId":2
  }
}

An in-range update of @types/node is breaking the build 🚨

Version 8.0.50 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.49
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node7 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • ❌ ci/circleci: docs CircleCI is running your tests Details
  • ❌ ci/circleci: lint Your tests failed on CircleCI Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @google-cloud/nodejs-repo-tools is breaking the build 🚨

Version 2.0.11 of @google-cloud/nodejs-repo-tools was just published.

Branch Build failing 🚨
Dependency @google-cloud/nodejs-repo-tools
Current Version 2.0.10
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@google-cloud/nodejs-repo-tools is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: node6 Your tests are queued behind your running builds Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • ❌ ci/circleci: node8 CircleCI is running your tests Details
  • ❌ ci/circleci: node7 Your tests failed on CircleCI Details

Commits

The new version differs by 2 commits.

  • f3fe73d Small fix.
  • f20e86a Successfully ignore the new package-lock.json-12345 files. (#56)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Firestore includes two copies of grpc in node_modules which are both very large

The node_modules for a project containing only firestore as it's dependency are quite large (~150MB depending on exact OS/configuration). Most of this comes from the grpc dependency which is about 50MB and most unfortunately is included twice. Once at the top level node_modules/grpc and once within the node_modules for firestore ./node_modules/@google-cloud/firestore/node_modules/grpc.

Is there any way to only include grpc once when installed? Having this massive dependency makes deploying packages with firestore difficult where the size of the deployment package is constrained.

Environment details

  • OS: mac osx and linux (node 6.10.3 docker image)
  • Node.js version: 6.10
  • npm version: npm 3.10.10 and yarn 1.3.2
  • @google-cloud/firestore version: 0.10.0 and 0.10.1

Steps to reproduce

  1. Create a package.json file with a single dependency: "@google-cloud/firestore": "^0.10.1"
  2. Run yarn install --production or npm install --production
  3. run find . -name grpc and note the two copies of grpc.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Pipelined vs batched writes

I am noticing some odd behavior trying to execute many write operations at once.

At first I was looping over an array of data with for...of using await on each set/update iteration. This is very slow of course because you are waiting for the db to respond to each action.

So I started using the db.batch() API and that works a lot faster. But unfortunately batches are limited to 500 items, so I wrote an abstraction to handle the chunking.

Then I learned from this video that requests can be pipelined, so I tried to map my data to an array of promises and awaited on Promise.all.

But I discovered that if I do this with a lot of items the SDK quickly fails on me. For example the code below tries to update data for 2.2k airlines (the data itself is only a few props).

    const airlines = await getAirlines();
    console.log(`Fetched data for ${airlines.length} airlines`);

    const promisedUpdates = airlines.map(airline =>
      db
        .collection("airlines")
        .doc(airline.id)
        .update(airline.data, { create: true })
    );

    await Promise.all(promisedUpdates);

The result is:

Fetched data for 2250 airlines
Error: Deadline Exceeded
at /Users/me/myproject/node_modules/@google-cloud/firestore/node_modules/grpc/src/client.js:554:15

It also takes a very long time for it to fail with this timeout.

If I cut the processing in chunks of 500, everything runs smoothly and the whole process takes about 11 seconds:

  const airlines = await getAirlines();
  console.log(`Fetched data for ${airlines.length} airlines`);

  const chunks = chunk(airlines, 500);

  for (const airlines of chunks) {
    const promisedUpdates = airlines.map(airline =>
      db
        .collection("airlines")
        .doc(airline.id)
        .update(airline.data, { create: true })
    );

    await Promise.all(promisedUpdates);
    console.log(`Committed ${airlines.length}`);
  }

Fetched data for 2250 airlines
Committed 500
Committed 500
Committed 500
Committed 500
Committed 250
Updated 2250 airlines

I find it odd that something that takes 10s in batches like this, takes forever if you send 4x as many requests at once. So I wonder if this is a bug in the grpc client.

If requests to Firebase can be pipelined but there is somehow a maximum of what can be handled at once, I think this should be made clear in the documentation. And if everything should be chunked in certain numbers it would be helpful to have abstractions for that. It feels wrong to leave this complexity to the client logic.

For example here is the abstraction I use to do batched writes without having to count to 500 in my client code everywhere. This is not super generic / a bit specific to my needs but I think that a similar abstraction would be a welcome addition to the API.

interface BatchMutation {
  ref: FirebaseFirestore.DocumentReference;
  data: object;
}

interface BatchUpdateOptions {
  create: boolean;
}

type BatchType = "set" | "update";

export async function commitBatch(
  type: BatchType,
  mutations: BatchMutation[],
  options?: BatchUpdateOptions
): Promise<void> {
  let batch = db.batch();
  let counter = 0;

  for (const mutation of mutations) {
    counter++;
    const { ref, data } = mutation;

    type === "update" ? batch.update(ref, data, options) : batch.set(ref, data);

    if (counter >= BATCH_LIMIT) {
      await batch.commit();
      counter = 0;
      batch = db.batch();
    }
  }

  /**
   * Finally commit the remaining batched items
   */
  await batch.commit();
}

Can not access to customClaims object into firestore security rules auth.token.customProp.

Thanks for stopping by to let us know something could be better!

Please run down the following list and make sure you've tried the usual "quick
fixes":

If you are still having issues, please be sure to include as much information as
possible:

Environment details

  • OS:
  • Node.js version:
  • npm version:
  • @google-cloud/firestore version:

Steps to reproduce

  1. Create customClaims object into user
  2. Try to access into customClaims into security rules like described at https://firebase.google.com/docs/auth/admin/custom-claims - customClaims not passed into auth.token from security rules scope;

Following these steps will guarantee the quickest resolution possible.

Thanks!

Error when persisting nested objects

Environment details

  • OS: Linux Mint
  • Node.js version: 8.9.4 LTS
  • npm version: 5.6.0
  • @google-cloud/firestore version: 0.11.2

Steps to reproduce

  1. call function ref.doc(id).set(params, options), which params is a object like:
{
  "notifications": {
    "web": "a random token string"
  },
  "updatedAt": 1519320011313
}

Expected behavior

  • Persist the object

Actual behavior

  • I got error Cannot encode type ([object Object]) to a Firestore Value. The [object Object] is the nested object ( {web : a random token string} ).

I realized the function isPlainObject at line 1428 returns true for {notifications...}, but returns false for the nested object {web: ....}, as it has no Object.prototype property.

//firestore/src/document.js 1428

function isPlainObject(input) {
  return (
    typeof input === 'object' &&
    input !== null &&
    Object.getPrototypeOf(input) === Object.prototype
  );
}

When I tried to force input to be an object

function isPlainObject(input) {
  return (
    typeof input === 'object' &&
    input !== null &&
(Object.getPrototypeOf(input) === Object.prototype) || (Object.getPrototypeOf(Object.create(input)) === Object.prototype)
  );
}

I got another error for the other value at not nested object:
Argument \"data\" is not a valid Document. Object prototype may only be an Object or null: 1519320772620.

Using lodash 's isObject method:

function isPlainObject(input) {
    return require('lodash').isObject(input) //returns true for both objects
}

I got the error
Argument \"data\" is not a valid Document. obj.hasOwnProperty is not a function

How can I handle this problem? Thank you in advance.

An in-range update of @types/node is breaking the build 🚨

Version 8.5.2 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.5.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: node4 CircleCI is running your tests Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ❌ ci/circleci: node6 CircleCI is running your tests Details
  • ❌ ci/circleci: node9 CircleCI is running your tests Details
  • ❌ ci/circleci: node7 CircleCI is running your tests Details
  • ❌ ci/circleci: node8 Your tests failed on CircleCI Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

How to save geo point in firestore document

Hi,
I am not able to save geo point in the same format as it seen after saving it manually in the firestore document.
Please have a look at my code.


const admin = require("firebase-admin");
const serviceAccount = require(process.env.FBASE_AUTH_FILE);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: process.env.dbURL
});
let d = new Date();
let data = {
name: 'Amit',
location: new admin.firestore.GeoPoint(28.52038,77.28073),
created_at: d.getTime()
}
setDoc = db.collection('users').doc().set(data);
if (setDoc) {
console.log('User added');
}

// Error which I am receiving is as follows.
Error: Cannot encode type ([object Object]) to a Firestore Value

Typeings seem to be broken with the firebase sdk

Environment details

  • OS: mac
  • Node.js version: v8.7.0
  • npm version: npm: '5.4.2',
  • @google-cloud/firestore version:
    "version": "0.8.2",

included by firebase admin sdk

Steps to reproduce

  1. just trying to build with the firebase admin sdk. maybe the firebase admin sdk is outdated with the version of firestore? In frankness I'm not even using firestore.

node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(688,22): error TS2694: Namespace 'NodeJS' has no exported member 'ReadStream'.

https://puu.sh/yfw7o/bc470729fc.png

Cloud function - Cannot read property 'Symbol(Symbol.iterator)' of undefined at convertValue

Hey guys,

My cloud firestone function are getting the following error whenever they are triggered, I have seen some people are getting similar error on here and the fix was to upgrade the cloud function library. Unfortunately I have upgraded to version 0.8.0 and still get the following error.

exports.cleanSubmittedUrls = functions.firestore.document('url/{urlid}').onWrite((event) =>  {
	console.log('event.data', event)
	return true;
})

package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "version": "1.0.0",
  "dependencies": {
    "cors": "2.8.3",
    "express": "4.15.3",
    "firebase-admin": "5.7.0",
    "firebase-functions": "0.8.0",
    "secure-compare": "3.0.1",
    "string": "3.3.3"
  },
  "private": true
}

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined at convertValue (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/convert.js:182:44) at convertDocument (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/convert.js:226:22) at Firestore.snapshot_ (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/index.js:376:11) at dataConstructor (/user_code/node_modules/firebase-functions/lib/providers/firestore.js:100:38) at Object. (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:57:31) at next (native) at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71 at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12) at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:53:36) at /var/tmp/worker/worker.js:695:26

Thanks,
Cameron

this.timestamp.equals is not a function

Started getting this error when i updated to firebase 4.9.0.

seems to be triggered everything my listener gets triggered

database.doc(users/${user}/characters/characterA/data/${type}).onSnapshot(doc => {
}

snapshot_version.js:42 Uncaught (in promise) TypeError: this.timestamp.equals is not a function
at SnapshotVersion../node_modules/@firebase/firestore/dist/esm/src/core/snapshot_version.js.SnapshotVersion.equals (snapshot_version.js:42)
at RemoteStore../node_modules/@firebase/firestore/dist/esm/src/remote/remote_store.js.RemoteStore.onWatchStreamChange (remote_store.js:312)
at PersistentListenStream../node_modules/@firebase/firestore/dist/esm/src/remote/persistent_stream.js.PersistentListenStream.onMessage (persistent_stream.js:393)
at persistent_stream.js:333
at persistent_stream.js:308
at async_queue.js:83
at

GeoPoint lat/lon wrong typings

When i save an item using the GeoPoint class like that: new firestore.GeoPoint(location.lat, location.lng), it is saving on the database with an underscore prefix: _latitude and _longitude, but when i try to retrieve it the GeoPoint class force us to use latitude and longitude objects:

  export class GeoPoint {
    /**
     * Creates a new immutable GeoPoint object with the provided latitude and
     * longitude values.
     * @param latitude The latitude as number between -90 and 90.
     * @param longitude The longitude as number between -180 and 180.
     */
    constructor(latitude: number, longitude: number);

    readonly latitude: number;
    readonly longitude: number;
  }

If i do inspect my GeoPoint variable on my code here is what i get:
{ _latitude: -25.6173489, _longitude: -41.238464 }
So for the moment i can't use the GeoPoint typings.

captura de tela 2017-10-06 as 19 21 42

seller.location.latitude returns undefined
(<any>seller.location)._latitude returns the latitude value

An in-range update of @google-cloud/common is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 0.16.2 of @google-cloud/common was just published.

Branch Build failing 🚨
Dependency @google-cloud/common
Current Version 0.16.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

@google-cloud/common is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node9 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: lint Your tests passed on CircleCI! Details
  • ❌ ci/circleci: docs Your tests failed on CircleCI Details

Release Notes v0.16.2

Fixes

This release contains only dependency updates and some style fixes.

  • (#16) Dependencies with licensing problems
  • (#54) Switch to let/const
Commits

The new version differs by 9 commits.

  • f28620e chore: release 0.16.2 (#56)
  • 98d7795 chore: switch to let/const (#54)
  • 9b9b8bc chore: delete js-green-licenses.json (#51)
  • 375c78e Update js-green-licenses to the latest version πŸš€ (#50)
  • 4ccfb9b chore(package): update proxyquire to version 2.0.0 (#44)
  • c9658d8 chore: run appveyor on node8 only (#48)
  • 5238b0f style: fix prettier incompatibility (#47)
  • 9423884 chore: removing node7 job from CircleCI (#38)
  • 050ebce Update log-driver to the latest version πŸš€ (#37)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 9.4.7 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 9.4.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node9 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • ❌ ci/circleci: docs Your tests failed on CircleCI Details
  • βœ… ci/circleci: lint Your tests passed on CircleCI! Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Dependency on GRPC breaks services that don't enable statically-linked binaries (Serverless Providers)

Hey team. We have a few developers on StdLib dependent upon https://github.com/firebase/firebase-admin-node for interfacing with Firebase.

As of the latest release, with @google-cloud/firestore, the dependency on the node-gyp compiled grpc module breaks builds on our serverless platform: we very explicitly do not support statically-linked binaries in the expected fashion from NPM.

This isn't technically a problem on your end; we can (and probably should) update to support node-gyp / etc., but this is also a gentle ask if there is equivalent functionality of the grpc module not dependent on node-gyp? We can tell our developers to just use older packages - it's just non-standard for something so high-level to use statically-linked binaries.

An in-range update of @types/node is breaking the build 🚨

Version 9.4.1 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 9.4.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: node9 Your tests failed on CircleCI Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node7 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of protobufjs is breaking the build 🚨

Version 6.8.1 of protobufjs was just published.

Branch Build failing 🚨
Dependency protobufjs
Current Version 6.8.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

protobufjs is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ❌ ci/circleci: node4 CircleCI is running your tests Details
  • ❌ ci/circleci: node7 CircleCI is running your tests Details
  • ❌ ci/circleci: node6 CircleCI is running your tests Details
  • ❌ ci/circleci: node8 CircleCI is running your tests Details
  • ❌ ci/circleci: node9 Your tests failed on CircleCI Details

Commits

The new version differs by 42 commits.

  • 86e8904 Other: Update CHANGELOG for 6.8.1
  • cf7b267 Other: Regenerate dist files
  • db2dd49 Fixed: Prevent invalid JSDoc names when generating service methods, see #870
  • 6229799 Fixed: Prevent parse errors when generating service method names, see #870
  • 478f332 Fixed: Support parsing nested option-values with or without ':' (#951, fixes #946)
  • 685adb0 Other: Also check for reserved ids and names in enums
  • 843d0d5 Other: Also support 'reserved' in enum descriptors
  • 83477ca Fixed: Add support for reserved keyword in enums (#950, fixes #949)
  • 20a2627 CLI: Sanitize CR-only line endings (coming from jsdoc?)
  • c482a5b Fixed: Unified safe property escapes and added a test for #834
  • e04ddc4 CLI: Skip defaults when generating proto3 (#902)
  • 34eee42 Other: Regenerate dist files
  • b03dd37 New: Basic support for URL prefixes in google.protobuf.Any types (#851)
  • c7ecc92 CLI: Annotate virtual oneof fields as string literal unions (#880)
  • b8a5b12 Other: Regenerated dist files and fixed linting issues

There are 42 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Failure in update with multiple nested deletions

Update with multiple nested deletions fails in some cases, e.g.:

  const firestore = firebase.firestore();
  const ref = db.collection('test').doc('test');
  return ref.set({
    o: {
      a: { x: 1, y: 1 },
      b: { x: 1, y: 1 },
      c: { x: 1, y: 1 }
    }
  }).then(() =>
    firestore.runTransaction(transaction => {
      transaction.update(ref, {
        'o.b.x': firebase.firestore.FieldValue.delete(),
        'o.b.y': 0,
        'o.c.x': firebase.firestore.FieldValue.delete(),
        'o.c.y': 0
      });
      return Promise.resolve();
    })
  );

Produces an error:
TypeError: Cannot read property 'c' of null

Reproduced with firebase-admin 5.11.0.

  • OS: Windows
  • Node.js version: v6.11.5
  • @google-cloud/firestore version: 0.13.0

Node version

What is the minimum node version of this library?

Support init Firestore instance with POJO

Currently we need to init Firestore with a file:

const firestore = new Firestore({
  projectId: 'YOUR_PROJECT_ID',
  keyFilename: '/path/to/keyfile.json',
});

Could we support a js object too?

const key = require('/path/to/keyfile.json')
const firestore = new Firestore({
  projectId: 'YOUR_PROJECT_ID',
  key: key,
});

So I can load/create this object in runtime (from env or some thing else)

Race condition in documented counter implementation

Hi,

There seems to be race conditions in the documented implementation of a counter using runTransaction. I've seen it in my own project in the update phase so I wrote a quick script to try to reproduce.

Documented counter is here: https://cloud.google.com/nodejs/docs/reference/firestore/0.12.x/Firestore#runTransaction

The code can be found here: https://github.com/toots/firestore-race-condition. When running the script, one can see that the counter is created multiple times. Furthermore, later on multiple threads receives the same value. These two observations runs counter to the documented pessimistic lock that is supposed to be placed on the document once the first get request succeed:

% node ./index.js
[0] Thread starting..
[2] Thread starting..
[1] Thread starting..
[3] Thread starting..
[8] Thread starting..
[6] Thread starting..
[5] Thread starting..
[4] Thread starting..
[7] Thread starting..
[9] Thread starting..
[0] Creating counter..
[2] Creating counter..
[1] Creating counter..
[3] Creating counter..
[6] Got counter value: 1
[5] Got counter value: 1
[8] Got counter value: 1
[1] Got counter value: 1
[9] Got counter value: 1
[7] Got counter value: 1
[2] Got counter value: 2
[3] Got counter value: 2
[4] Got counter value: 2
[5] Got counter value: 2
[8] Got counter value: 2
[1] Got counter value: 3
[9] Got counter value: 3
[7] Got counter value: 3
[5] Got counter value: 3
[2] Got counter value: 3
[8] Got counter value: 3
[3] Got counter value: 4
[1] Got counter value: 4
[7] Got counter value: 4
[8] Got counter value: 5
[5] Got counter value: 5
[2] Got counter value: 5
[1] Got counter value: 6
[7] Got counter value: 6
[8] Got counter value: 7
[2] Got counter value: 7
Worker errored: Error: Too much contention on these documents. Please try again.
    at /private/tmp/firestore-race-condition/node_modules/@google-cloud/firestore/node_modules/grpc/src/client.js:554:15
Worker errored: Error: Too much contention on these documents. Please try again.
    at /private/tmp/firestore-race-condition/node_modules/@google-cloud/firestore/node_modules/grpc/src/client.js:554:15

Tested with package version 0.12.0 and 0.13.0

No grpc pre-built binary

Environment details

  • OS: Arch Linux 4.16.6-1
  • Node.js version: 10.0.0
  • npm version: 6.0.0
  • @google-cloud/common-grpc version: 0.6.0

Steps to reproduce

npm i @google-cloud/firestore

There is a pre-built binary for [email protected]. And there isn't one for [email protected]. So to be able to install @google-cloud/firestore on Node 10 @google-cloud/common-grpc should upgrade grpc dependency to 1.11.0 and @google-cloud/firestore should upgrade @google-cloud/common-grpc dependency to the latest one.

Also created googleapis/nodejs-common-grpc#44

Thanks.

Query class not exported correctly

It seems like the Query class is not properly exported from this module. It is listed three times in the main index.js file's exports, only the second of which looks to be the correct object.

A temporary workaround which gets the Query class from the superclass of CollectionReference:

const Query = Object.getPrototypeOf(CollectionReference.prototype).constructor;

FR: allow DocumentReference.select similar to Query.select

Hey guys,
I have been snooping around the source code and documentation. It seems like the only way to do apply a field mask to the result and returns only the specified subset of fields is through the Query.select method.
https://cloud.google.com/nodejs/docs/reference/firestore/0.8.x/Query#select
https://github.com/googleapis/nodejs-firestore/blob/master/src/reference.js#L1080

Is there any plan or ways to enable the same feature when getting a single document via DocumentReference? The code seems plenty of references to https://cloud.google.com/firestore/docs/reference/rest/v1beta1/DocumentMask which is used to restrict a get or update operation on a document to a subset of its fields, but I didn't have any luck tracking down usage of this in DocumentReference.get

Relevant Code:

// based on the select example at https://cloud.google.com/nodejs/docs/reference/firestore/0.8.x/Query#select
let collectionRef = firestore.collection('col');
let documentRef = collectionRef.doc('doc');

documentRef.set({x:10, y:5}).then(() => {
  return collectionRef.where('x', '>', 5).select('y').get();
}).then((res) => {
  console.log(`y is ${res.docs[0].get('y')}.`);
});
// would like to be able to also do
documentRef.select('y').get().then((snapShot) => {
  console.log(`snapShot only has one field ${snapShot}`);
  // Expected output: {y: 5}
});

An in-range update of @types/node is breaking the build 🚨

Version 9.4.4 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 9.4.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: node9 Your tests failed on CircleCI Details
  • βœ… ci/circleci: node8 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node7 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node6 Your tests passed on CircleCI! Details
  • βœ… ci/circleci: node4 Your tests passed on CircleCI! Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Error: The include `google/api/annotations.proto` was not found.

Thanks for stopping by to let us know something could be better!

Please run down the following list and make sure you've tried the usual "quick
fixes":

If you are still having issues, please be sure to include as much information as
possible:

Environment details

  • OS: OSX
  • Node.js version: 7.1.0
  • npm version: 5.7.1
  • @google-cloud/firestore version:

Steps to reproduce

  1. My package.json
    "dependencies": {
    "@sendgrid/mail": "^6.2.1",
    "config": "^1.30.0",
    "express": "^4.16.2",
    "express-serve-static-core": "^0.1.1",
    "firebase-admin": "^5.12.0",
    "firebase-functions": "^1.0.1",
    ...
    },
    "devDependencies": {
    "@types/express": "^4.0.37",
    "tsc": "^1.20150623.0",
    "tslint": "^5.8.0",
    "typescript": "^2.7.2"
    }
  2. When I try to locally build/ deploy my firebase project, I get the following error

'i functions: Preparing to emulate functions.
Warning: You're using Node.js v7.1.0 but Google Cloud Functions only supports v6.11.5.
⚠ functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
⚠ functions: Error from emulator. Error occurred while parsing your function triggers.

Error: The include google/api/annotations.proto was not found.
at Function.GoogleProtoFilesRoot._findIncludePath (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/lib/grpc.js:312:11)
at GoogleProtoFilesRoot.resolvePath (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/lib/grpc.js:298:31)
at process (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/node_modules/protobufjs/src/root.js:112:45)
at fetch (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/node_modules/protobufjs/src/root.js:166:13)
at GoogleProtoFilesRoot.load (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/node_modules/protobufjs/src/root.js:194:13)
at GoogleProtoFilesRoot.loadSync (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/node_modules/protobufjs/src/root.js:235:17)
at Object.loadSync (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/node_modules/protobufjs/src/index-light.js:69:17)
at GrpcClient.loadProto (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/google-gax/lib/grpc.js:164:14)
at new FirestoreClientBuilder (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/@google-cloud/firestore/src/v1beta1/firestore_client.js:1412:37)
at FirestoreClientBuilder (/Users/himalrandeniya/Dropbox (Future Stars)/Apps/DMS/Sprout/Engine/Functions/functions/node_modules/@google-cloud/firestore/src/v1beta1/firestore_client.js:1409:12)'
Following these steps will guarantee the quickest resolution possible.

Thanks!

runTransaction potentially returning the wrong resolved promise when retrying

Hi,

apologies for not opening a complete issue (with instructions for reproducing it) but I assumed that opening a discussion could help us pinpoint a potential problem quicker.

When implementing a counter-like feature, I noticed that, when a transaction retries, the returned promise has the value of the first try, instead of the last.

This is the line that seems incorrect (the recursive call to runTransaction):

return this.runTransaction(updateFunction, {
              previousTransaction: transaction,
              maxAttempts: attemptsRemaining,
            });

https://github.com/googleapis/nodejs-firestore/blob/master/src/index.js#L496

Changing this line to the following solved my issue:

result = this.runTransaction(updateFunction, {
              previousTransaction: transaction,
              maxAttempts: attemptsRemaining,
            });
return result;

This guarantees that the current execution of runTransaction returns (at line 510) the promise from the previous execution when unstacking the calls.

I wasn't sure how I could quickly add a test for it in a repository fork, so I decided to open this issue to clear things up before any next steps.

Let me know if the issue is still unclear and I'll provide a test project that illustrates it. Also let me know if you think this is not an issue at all.

Thanks!

INTERNAL UNHANDLED ERROR: TypeError: protobufjs.newBuilder is not a function

Thanks for stopping by to let us know something could be better!

Please run down the following list and make sure you've tried the usual "quick
fixes":

If you are still having issues, please be sure to include as much information as
possible:

Environment details

  • OS: Mac OSX High Siera 10.13
  • Node.js version: 8.6.0
  • npm version: 5.5.1
  • @google-cloud/firestore version: '0.57.0'/4.6.0

Steps to reproduce

  1. Simply writing a .get() query on db.collection('collectionName')
  2. See this error in console
    Firestore (4.5.2) 2017-10-29T13:14:59.576Z: INTERNAL UNHANDLED ERROR: TypeError: protobufjs.newBuilder is not a function log.ts:50 at loadProtos (/Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/platform_node/load_protos.js:37:30) at /Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/platform_node/load_protos.js:23:9 at /Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/util/node_api.js:58:9 at Promise (<anonymous>) at Object.nodePromise (/Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/util/node_api.js:57:12) at Object.loadProtosAsync (/Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/platform_node/load_protos.js:22:23) at NodePlatform.loadConnection (/Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/platform_node/node_platform.js:28:30) at FirestoreClient.initializeRest (/Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/core/firestore_client.js:218:14) at /Users/sourav/Documents/TestProjects/nodeTest/node_modules/@firebase/firestore/dist/cjs/src/core/firestore_client.js:109:54 at <anonymous>

Following these steps will guarantee the quickest resolution possible.

Thanks!

error: project contains a Cloud Datastore database and does not support Cloud Firestore API calls

Environment details

  • OS: Mac
  • Node.js version: v6.11.3
  • npm version: 3.10.10
  • @google-cloud/firestore version: "@google-cloud/firestore": "^0.10.0"

OSTML0195470:firestoreNodeJS sma54$

Steps to reproduce

  1. Follow the steps listed here https://cloud.google.com/nodejs/docs/reference/firestore/0.8.x/

I first got the following error:

[Running] node "/Users/sma54/SAN/github/firestoreNodeJS/test.js"
(node:39182) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: The project firestoredemo-186515 does not exist or it does not contain an active Cloud Datastore database. Please visit http://console.cloud.google.com to create a project or https://console.cloud.google.com/datastore/setup?project=firestoredemo-186515 to add a Cloud Datastore database. Note that Cloud Datastore always has an associated App Engine app and this app must not be disabled. [Done] exited with code=0 in 1.691 seconds

Then I clicked on the link and created a Cloud Datastore database.

Then I am getting the following error.

[Running] node "/Users/sma54/SAN/github/firestoreNodeJS/test.js"
(node:39232) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: This project contains a Cloud Datastore database and does not support Cloud Firestore API calls. [Done] exited with code=0 in 2.02 seconds

Enums are not properly documented.

The proto contains enums that are namespaced under the messages that used them, as seen here:

https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/query.proto#L63
https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/query.proto#L82
https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/query.proto#L116

but in the generated proto doc the enums are not properly documented, so the enums don't show up on cloud.google.com

This probably needs to be fixed in googleapis/toolkit

Error with create-react-app: Failed to minify the code from firestore/src/validate.js:27

Environment details

  • OS: Windows 10 Pro
  • Node.js version: 8.9.1
  • npm version: 5.5.1
  • @google-cloud/firestore version: ^0.10.1

I'm using create-react-app, and first added firebase hosting, and deployed it. No problem. Then I added firebase-admin, tried running yarn build, but it gives this error:

yarn build
yarn run v1.3.2
$ cross-env NODE_PATH=src:src/components:src/containers:src/utils react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/@google-cloud/firestore/src/validate.js:27

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried going into validate.js line 27, and changing it from:

function formatPlural(num, str) {
  return `${num} ${str}` + (num === 1 ? '' : 's');
}

to:

function formatPlural(num, str) {
  return "" + num + str;
}

which fixed the issue on that line, however it then couldn't minify line 48, and I wasn't able to find a fix for this line.

create-react-app says this about the error:

npm run build fails to minify

Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.


To resolve this:
  1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
  • Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.
  1. Fork the package and publish a corrected version yourself.

  2. If the dependency is small enough, copy it to your src/ folder and treat it as application code.

In the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.

An in-range update of grpc is breaking the build 🚨

Version 1.7.2 of grpc was just published.

Branch Build failing 🚨
Dependency grpc
Current Version 1.7.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

grpc is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: node6 CircleCI is running your tests Details
  • ❌ ci/circleci: node4 CircleCI is running your tests Details
  • ❌ ci/circleci: node9 CircleCI is running your tests Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ❌ ci/circleci: node7 CircleCI is running your tests Details
  • ❌ ci/circleci: node8 Your tests failed on CircleCI Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

bun dependency

Depends on an outdated library, which restricts node engine to 0.10.x

? Choose which packages to update. [email protected]
info Installing "dependencies"...
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "~0.10.12".
✨  Done in 2.31s.
Error: Found incompatible module
    at checkOne (/usr/local/Cellar/yarn/1.1.0/libexec/lib/cli.js:59750:11)
    at Object.check (/usr/local/Cellar/yarn/1.1.0/libexec/lib/cli.js:59756:5)
    at /usr/local/Cellar/yarn/1.1.0/libexec/lib/cli.js:22277:73
    at Generator.next (<anonymous>)
    at step (/usr/local/Cellar/yarn/1.1.0/libexec/lib/cli.js:92:30)
    at /usr/local/Cellar/yarn/1.1.0/libexec/lib/cli.js:103:13
    at <anonymous>

I didnt personally review the code of the library and it might be just fine, but there is an issue here one way or another

Thanks!

getCollections declaration is missing in firestore.d.ts

Environment details

  • OS: MacOs 10.13
  • Node.js version: 8.1.4
  • npm version: 5.5.1
  • @google-cloud/firestore version: 0.8.2

Steps to reproduce

Typescript declaration file (firestore.d.ts) is missing getCollections() method for Firestore class and DocumentReference class.

Update to 0.14.0 causes "Duplicate identifier" error

Environment details

  • OS: Win 10 (64 bit)
  • Node.js version: 6.11.5
  • npm version: 3.10.10
  • @google-cloud/firestore version: 0.14.0

Steps to reproduce

  1. Update nodejs-firestore from 0.13.1 to 0.14.0

Error description

I've recently bumped up the version of Firestore from 0.13.1 to 0.14.0 but ran into the following errors:

node_modules/@google-cloud/firestore/types/firestore.d.ts(28,15): error TS2300: Duplicate identifier 'DocumentData'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(35,15): error TS2300: Duplicate identifier 'UpdateData'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(46,16): error TS2300: Duplicate identifier 'Firestore'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(122,16): error TS2300: Duplicate identifier 'GeoPoint'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(149,16): error TS2300: Duplicate identifier 'Transaction'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(266,16): error TS2300: Duplicate identifier 'WriteBatch'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(393,16): error TS2300: Duplicate identifier 'WriteResult'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(417,16): error TS2300: Duplicate identifier 'DocumentReference'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(557,16): error TS2300: Duplicate identifier 'DocumentSnapshot'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(626,16): error TS2300: Duplicate identifier 'QueryDocumentSnapshot'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(653,15): error TS2300: Duplicate identifier 'OrderByDirection'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(659,15): error TS2300: Duplicate identifier 'WhereFilterOp'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(665,16): error TS2300: Duplicate identifier 'Query'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(873,16): error TS2300: Duplicate identifier 'QuerySnapshot'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(925,15): error TS2300: Duplicate identifier 'DocumentChangeType'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(968,16): error TS2300: Duplicate identifier 'CollectionReference'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(1019,16): error TS2300: Duplicate identifier 'FieldValue'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(1047,16): error TS2300: Duplicate identifier 'FieldPath'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(1073,12): error TS2300: Duplicate identifier 'FirebaseFirestore'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(28,15): error TS2300: Duplicate identifier 'DocumentData'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(35,15): error TS2300: Duplicate identifier 'UpdateData'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(46,16): error TS2300: Duplicate identifier 'Firestore'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(122,16): error TS2300: Duplicate identifier 'GeoPoint'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(149,16): error TS2300: Duplicate identifier 'Transaction'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(266,16): error TS2300: Duplicate identifier 'WriteBatch'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(383,16): error TS2300: Duplicate identifier 'WriteResult'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(407,16): error TS2300: Duplicate identifier 'DocumentReference'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(547,16): error TS2300: Duplicate identifier 'DocumentSnapshot'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(616,16): error TS2300: Duplicate identifier 'QueryDocumentSnapshot'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(643,15): error TS2300: Duplicate identifier 'OrderByDirection'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(649,15): error TS2300: Duplicate identifier 'WhereFilterOp'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(655,16): error TS2300: Duplicate identifier 'Query'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(863,16): error TS2300: Duplicate identifier 'QuerySnapshot'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(915,15): error TS2300: Duplicate identifier 'DocumentChangeType'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(958,16): error TS2300: Duplicate identifier 'CollectionReference'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(1009,16): error TS2300: Duplicate identifier 'FieldValue'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(1037,16): error TS2300: Duplicate identifier 'FieldPath'.
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts(1063,12): error TS2300: Duplicate identifier 'FirebaseFirestore'.

npm ERR! Windows_NT 10.0.17134
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build script 'tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the functions package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs functions
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls functions
npm ERR! There is likely additional logging output above.

My package.json

{
  "name": "functions",
  "scripts": {
    "yarn_install": "yarn install && yarn outdated",
    "lint": "tslint --project tsconfig.json",
    "build": "tsc",
    "serve": "npm run build && firebase serve --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log",
    "test": "mocha --require ts-node/register ./src/test/*.spec.ts",
    "create_documentation": "typedoc --out ./doc ./src"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@google-cloud/firestore": "^0.14.0",
    "@google-cloud/storage": "^1.6.0",
    "@google-cloud/vision": "^0.19.0",
    "firebase-admin": "^5.12.0",
    "firebase-functions": "^1.0.1"
  },
  "devDependencies": {
    "@types/chai": "^4.1.3",
    "@types/mocha": "^5.2.0",
    "@types/sinon": "^4.3.3",
    "chai": "^4.1.2",
    "firebase-functions-test": "^0.1.2",
    "firebase-tools": "^3.18.4",
    "mocha": "^5.1.1",
    "mocha-junit-reporter": "^1.17.0",
    "node-mocks-http": "^1.5.8",
    "sinon": "^5.0.7",
    "ts-node": "^6.0.3",
    "tslint": "^5.10.0",
    "typedoc": "^0.11.1",
    "typescript": "^2.5.3"
  },
  "private": true
}

Change the src/index module.exports.v1beta1 to use generated method.

What

The generated client samples depend on the the module.export.v1beta1 of the src.index.js file to export a method that instantiates a client. In order for the samples to be correct (and for the future regenerations of the samples to be correct) the export must be changed.

Fix

  1. Make sure nothing depends on the current v1beta1.
  2. Regenerate the firestore client.
  3. Copy the correct method over.
  4. Export as v1beta1 in src/index.js

prior discussion found at: googleapis/gapic-generator#1599

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.