Skip to content

Commit 8c0ce7c

Browse files
authored
Merge pull request #1986 from firebase/next
2 parents 9a94f26 + 01ca755 commit 8c0ce7c

32 files changed

+621
-9960
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ jobs:
2121
node-version: ${{ matrix.node }}
2222
cache: "npm"
2323
cache-dependency-path: "**/package-lock.json"
24-
- name: NPM INSTALL
24+
- name: npm install
2525
run: npm i
26-
- name: build emulator functions
26+
- name: Build emulator functions
2727
run: cd _emulator/functions && npm i && npm run build & cd ../..
28-
- name: Install firebase CLI
28+
- name: Install Firebase CLI
2929
uses: nick-invision/retry@v1
3030
with:
3131
timeout_minutes: 10
3232
retry_wait_seconds: 60
3333
max_attempts: 3
3434
command: npm i -g firebase-tools@11
35+
- name: Setup e2e secrets
36+
run: |
37+
echo SMTP_PASSWORD=${{ secrets.SENDGRID_API_KEY }} >> _emulator/extensions/firestore-send-email-sendgrid.secret.local
3538
- name: npm test
3639
run: npm run test:ci

_emulator/.firebaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"projects": {
33
"default": "demo-test"
44
}
5-
}
5+
}

_emulator/extensions/firestore-bigquery-export.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
BIGQUERY_PROJECT_ID=dev-extensions-testing
2+
DATABASE_ID=(default)
23
COLLECTION_PATH=posts
34
DATASET_ID=firestore_export
45
DATASET_LOCATION=us-central1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
firebaseextensions.v1beta.function/location=us-central1
3+
MAIL_COLLECTION=mail-sg
4+
SMTP_CONNECTION_URI=smtps://[email protected]:465
5+
TTL_EXPIRE_TYPE=never
6+
TTL_EXPIRE_VALUE=1

_emulator/extensions/firestore-send-email-sendgrid.secret.local

Whitespace-only changes.

_emulator/firebase.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"delete-user-data": "../delete-user-data",
55
"storage-resize-images": "../storage-resize-images",
66
"firestore-counter": "../firestore-counter",
7-
"firestore-bigquery-export": "../firestore-bigquery-export"
7+
"firestore-bigquery-export": "../firestore-bigquery-export",
8+
"firestore-send-email-sendgrid": "../firestore-send-email"
89
},
910
"storage": {
1011
"rules": "storage.rules"

firestore-bigquery-export/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## Version 0.1.46
2+
3+
feature - add the ability to select Firestore database instance
4+
5+
fix - specify Cloud Task task retry config in `extension.yaml`
6+
7+
fix - specify the location in the `fsimportexistingdocs` Cloud Task
8+
9+
docs - fix typos, remove mention of BigQuery updating on import
10+
111
## Version 0.1.45
212

313
feature - bring back the backfill parameter `DO_BACKFILL`

firestore-bigquery-export/PREINSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The extension creates and updates a [dataset](https://cloud.google.com/bigquery/
77

88
*Warning*: A BigQuery table corresponding to your configuration will be automatically generated upon installing or updating this extension. Manual table creation may result in discrepancies with your configured settings.
99

10-
If you create, update, delete, or import a document in the specified collection, this extension sends that update to BigQuery. You can then run queries on this mirrored dataset.
10+
If you create, update, or delete a document in the specified collection, this extension sends that update to BigQuery. You can then run queries on this mirrored dataset.
1111

1212
Note that this extension only listens for _document_ changes in the collection, but not changes in any _subcollection_. You can, though, install additional instances of this extension to specifically listen to a subcollection or other collections in your database. Or if you have the same subcollection across documents in a given collection, you can use `{wildcard}` notation to listen to all those subcollections (for example: `chats/{chatid}/posts`).
1313

firestore-bigquery-export/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The extension creates and updates a [dataset](https://cloud.google.com/bigquery/
1515

1616
*Warning*: A BigQuery table corresponding to your configuration will be automatically generated upon installing or updating this extension. Manual table creation may result in discrepancies with your configured settings.
1717

18-
If you create, update, delete, or import a document in the specified collection, this extension sends that update to BigQuery. You can then run queries on this mirrored dataset.
18+
If you create, update, or delete a document in the specified collection, this extension sends that update to BigQuery. You can then run queries on this mirrored dataset.
1919

2020
Note that this extension only listens for _document_ changes in the collection, but not changes in any _subcollection_. You can, though, install additional instances of this extension to specifically listen to a subcollection or other collections in your database. Or if you have the same subcollection across documents in a given collection, you can use `{wildcard}` notation to listen to all those subcollections (for example: `chats/{chatid}/posts`).
2121

@@ -124,6 +124,8 @@ To install an extension, your project must be on the [Blaze (pay as you go) plan
124124

125125
* BigQuery Project ID: Override the default project for BigQuery instance. This can allow updates to be directed to to a BigQuery instance on another GCP project.
126126

127+
* Database ID: Override the default project Firestore database. Learn more about managing multiple Firestore databases [here](https://cloud.google.com/firestore/docs/manage-databases).
128+
127129
* Collection path: What is the path of the collection that you would like to export? You may use `{wildcard}` notation to match a subcollection of all documents in a collection (for example: `chatrooms/{chatid}/posts`). Parent Firestore Document IDs from `{wildcards}` can be returned in `path_params` as a JSON formatted string.
128130

129131
* Enable Wildcard Column field with Parent Firestore Document IDs: If enabled, creates a column containing a JSON object of all wildcard ids from a documents path.
@@ -146,7 +148,7 @@ essential for the script to insert data into an already partitioned table.)
146148

147149
* BigQuery SQL table clustering: This parameter will allow you to set up Clustering for the BigQuery Table created by the extension. (for example: `data,document_id,timestamp`- no whitespaces). You can select up to 4 comma separated fields. The order of the specified columns determines the sort order of the data. Available schema extensions table fields for clustering: `document_id, document_name, timestamp, event_id, operation, data`.
148150

149-
* Maximum number of synced documents per second: This parameter will set the maximum number of syncronised documents per second with BQ. Please note, any other external updates to a Big Query table will be included within this quota. Ensure that you have a set a low enough number to componsate. Defaults to 10.
151+
* Maximum number of synced documents per second: This parameter will set the maximum number of syncronised documents per second with BQ. Please note, any other external updates to a Big Query table will be included within this quota. Ensure that you have a set a low enough number to compensate. Defaults to 10.
150152

151153
* Backup Collection Name: This (optional) parameter will allow you to specify a collection for which failed BigQuery updates will be written to.
152154

firestore-bigquery-export/extension.yaml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
name: firestore-bigquery-export
16-
version: 0.1.45
16+
version: 0.1.46
1717
specVersion: v1beta
1818

1919
displayName: Stream Firestore to BigQuery
@@ -58,7 +58,7 @@ resources:
5858
runtime: nodejs18
5959
eventTrigger:
6060
eventType: providers/cloud.firestore/eventTypes/document.write
61-
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/${param:COLLECTION_PATH}/{documentId}
61+
resource: projects/${param:PROJECT_ID}/databases/${param:DATABASE_ID}/documents/${param:COLLECTION_PATH}/{documentId}
6262

6363
- name: fsimportexistingdocs
6464
type: firebaseextensions.v1beta.function
@@ -68,7 +68,10 @@ resources:
6868
`IMPORT` and the timestamp of epoch.
6969
properties:
7070
runtime: nodejs18
71-
taskQueueTrigger: {}
71+
taskQueueTrigger:
72+
retryConfig:
73+
maxAttempts: 15
74+
minBackoffSeconds: 60
7275

7376
- name: syncBigQuery
7477
type: firebaseextensions.v1beta.function
@@ -90,15 +93,21 @@ resources:
9093
Runs configuration for sycning with BigQuery
9194
properties:
9295
runtime: nodejs18
93-
taskQueueTrigger: {}
96+
taskQueueTrigger:
97+
retryConfig:
98+
maxAttempts: 15
99+
minBackoffSeconds: 60
94100

95101
- name: setupBigQuerySync
96102
type: firebaseextensions.v1beta.function
97103
description: >-
98104
Runs configuration for sycning with BigQuery
99105
properties:
100106
runtime: nodejs18
101-
taskQueueTrigger: {}
107+
taskQueueTrigger:
108+
retryConfig:
109+
maxAttempts: 15
110+
minBackoffSeconds: 60
102111

103112
params:
104113
- param: DATASET_LOCATION
@@ -180,6 +189,16 @@ params:
180189
default: ${PROJECT_ID}
181190
required: true
182191

192+
- param: DATABASE_ID
193+
label: Database ID
194+
description: >-
195+
Override the default project Firestore database. Learn more about managing
196+
multiple Firestore databases
197+
[here](https://cloud.google.com/firestore/docs/manage-databases).
198+
type: string
199+
default: (default)
200+
required: true
201+
183202
- param: COLLECTION_PATH
184203
label: Collection path
185204
description: >-
@@ -333,7 +352,7 @@ params:
333352
This parameter will set the maximum number of syncronised documents per
334353
second with BQ. Please note, any other external updates to a Big Query
335354
table will be included within this quota. Ensure that you have a set a low
336-
enough number to componsate. Defaults to 10.
355+
enough number to compensate. Defaults to 10.
337356
type: string
338357
validationRegex: ^([1-9]|[1-9][0-9]|[1-4][0-9]{2}|500)$
339358
validationErrorMessage: Please select a number between 1 and 500

0 commit comments

Comments
 (0)