You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert project to V8 Runtime with Classes. #83#56
Convert JavaScript to Typescript and create custom typings. #64
Added Typings from gapi.client, google-apps-script, and jsonwebtoken.
Generated typings from Firestore Discovery URL from google-api-typings-generator.
Embraced ESLint and Prettier for code style.
Integrated Unit Tests utilizing GSUnit.
Added a plethora of badges and updated documentation.
Create workaround for duplicate "console" definitions (DefinitelyTyped/DefinitelyTyped#32585).
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+22-12Lines changed: 22 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,30 @@
2
2
Contributions are welcome! To contribute, fork this repository and create a pull request with your changes.
3
3
4
4
#### Pull requests
5
-
* Please create an issue before creating a pull request. Your changes are more likely to be pulled in after we discuss implementation, scope, etc. in an issue.
5
+
* Please create (or link to) an issue before creating a pull request. Your changes are more likely to be pulled in after we discuss implementation, scope, etc. in the issue.
6
6
* Please be responsive to change requests on your pull request.
7
7
8
8
#### Checklist for your code
9
-
* Have you tested the code yourself?
9
+
-[ ] Have you all the appropriate dependencies (after `git clone`)?
10
+
* Install all packages from `package.json` with a bare `npm install`.
* Create a Test.js file which creates a Firestore instance (via. `getFirestore()`)
14
-
* Debug/Test your code against your database
15
-
* Have you [documented your functions and their parameters and return values with JSDoc](http://usejsdoc.org/about-getting-started.html)?
16
-
* Have you made all functions that an end user of the library should not see private? (You can make a function private by adding `_` to the end of its name, as in `publicFunction()` and `privateFunction_()`).
17
-
* Add new "global" functions to `package.json`
18
-
* Does your code follow the [Standard Javascript Style Guide](https://github.com/standard/standard)?
### A Google Apps Script library for accessing Google Cloud Firestore.
7
13
@@ -10,6 +16,8 @@ This library allows a user (or service account) to authenticate with Firestore a
10
16
11
17
Read how this project was started [here](http://grahamearley.website/blog/2017/10/18/firestore-in-google-apps-script.html).
12
18
19
+
As of **v27**, this project has been updated to use the [GAS V8 runtime](https://developers.google.com/apps-script/guides/v8-runtime) with [Typescript](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html)! This introduces a number of [breaking changes](#breaking-changes).
20
+
13
21
## Installation
14
22
In the Google online script editor, select the `Resources` menu item and choose `Libraries...`. In the "Add a library" input box, enter `1VUSl4b1r1eoNcRWotZM3e87ygkxvXltOgyDZhixqncz9lQ3MjfT1iKFw` and click "Add." Choose the most recent version number.
15
23
@@ -28,10 +36,10 @@ To make a service account,
28
36
5. When you press "Create," your browser will download a `.json` file with your private key (`private_key`), service account email (`client_email`), and project ID (`project_id`). Copy these values into your Google Apps Script — you'll need them to authenticate with Firestore.
29
37
30
38
#### Create a test document in Firestore from your script
31
-
Now, with your service account client email address `email`, private key `key`, project ID `projectId`, and Firestore API version, we will authenticate with Firestore to get our `Firestore` object. To do this, get the `Firestore` object from the library:
39
+
Now, with your service account client email address `email`, private key `key`, project ID `projectId`, we will authenticate with Firestore to get our `Firestore` object. To do this, get the `Firestore` object from the library:
32
40
33
41
```javascript
34
-
var firestore =FirestoreApp.getFirestore(email, key, projectId, "v1");
**Note:** Although you can call `updateDocument` without using `createDocument` to create the document, any documents in your path will not be created and thus you can only access the document by using the path explicitly.
69
+
To update only specific fields of a document at this location, we can set the `mask` parameter to `true`:
***v27:** Library rewritten with Typescript and Prettier.
122
+
* Query function names have been capitalized (`Select`, `Where`, `OrderBy`, `Limit`, `Offset`, `Range`).
123
+
***All functions return `Document` or `Document[]` types directly from Firebase. Use `document.obj` to extract the raw object.**
124
+
* Undo breaking change from v23. `document.createTime` and `document.updateTime` will remain as timestamped strings. However `document.created`, `document.updated`, and `document.read` are Date objects.
125
+
***v23:** When retrieving documents the createTime and updateTime document properties are JS Date objects and not Timestamp Strings.
> Utilize `createDocument(path + '/' + documentId, fields)` instead to create a document with a specific ID.
94
128
95
129
## Contributions
96
-
Contributions are welcome — send a pull request! This library is a work in progress. See [here](https://github.com/grahamearley/FirestoreGoogleAppsScript/blob/master/.github/CONTRIBUTING.md) for more information on contributing.
130
+
Contributions are welcome — send a pull request! See [here](/grahamearley/FirestoreGoogleAppsScript/blob/master/.github/CONTRIBUTING.md) for more information on contributing.
97
131
98
132
After cloning this repository, you can push it to your own private copy of this Google Apps Script project to test it yourself. See [here](https://github.com/google/clasp) for directions on using `clasp` to develop App Scripts locally.
133
+
Install all packages from `package.json` with a bare `npm install`.
134
+
99
135
100
-
If you want to view the source code directly on Google Apps Script, where you can make a copy for yourself to edit, click [here](https://script.google.com/d/1VUSl4b1r1eoNcRWotZM3e87ygkxvXltOgyDZhixqncz9lQ3MjfT1iKFw/edit?usp=sharing).
136
+
If you want to view the source code directly on Google Apps Script, where you can make a copy for yourself to edit, click [here](https://script.google.com/d/1VUSl4b1r1eoNcRWotZM3e87ygkxvXltOgyDZhixqncz9lQ3MjfT1iKFw/edit).
0 commit comments