Skip to content

Commit 736196b

Browse files
authored
Merge pull request #2356 from firebase/next
Release 25/03/2025
2 parents fa26a9d + 748fe5c commit 736196b

34 files changed

+8836
-3748
lines changed

.github/workflows/npm_publish_bq_scripts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup node
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 18
19+
node-version: 20
2020
- name: NPM install
2121
run: npm install
2222
- name: Publish BigQuery Schema Views

.github/workflows/readmes-updated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Set up Node.js
3333
uses: actions/setup-node@v3
3434
with:
35-
node-version: 18
35+
node-version: 22
3636
cache: "npm"
3737
cache-dependency-path: "**/functions/package-lock.json"
3838

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: ["18"]
14+
node: ["20"]
1515
name: node.js_${{ matrix.node }}_test
1616
steps:
1717
- uses: actions/checkout@v3

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup node
1414
uses: actions/setup-node@v3
1515
with:
16-
node-version: 18
16+
node-version: 20
1717
- name: NPM install
1818
run: SKIP_POSTINSTALL=yes npm i
1919
- name: Prettier Lint Check

firestore-shorten-urls-bitly/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Version 0.2.0
2+
3+
feat: use v2 firestore trigger
4+
5+
feat: allow non-(default) firestore instances
6+
17
## Version 0.1.18
28

39
feat - move to Node.js 20 runtimes

firestore-shorten-urls-bitly/POSTINSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You can test out this extension right away!
44

5-
1. Go to your [Cloud Firestore dashboard](https://console.firebase.google.com/project/${param:PROJECT_ID}/firestore/data) in the Firebase console.
5+
1. Go to your [Cloud Firestore dashboard](https://console.firebase.google.com/project/${param:PROJECT_ID}/firestore/data) in the Firebase console. Note that, if you have configured a non-default firestore database, you may have to view it via the [Google Cloud Console](https://console.cloud.google.com/firestore/databases/${param:DATABASE}).
66

77
1. If it doesn't exist already, create a collection called `${param:COLLECTION_PATH}`.
88

firestore-shorten-urls-bitly/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ To install an extension, your project must be on the [Blaze (pay as you go) plan
4949
* Short URL field name: What is the name of the field where you want to store your shortened URLs?
5050

5151

52+
* Firestore Instance ID: The Firestore database to use. Use "(default)" for the default database. You can view your available Firestore databases at [https://console.cloud.google.com/firestore/databases](https://console.cloud.google.com/firestore/databases).
5253

5354

54-
**Cloud Functions:**
55+
* Firestore Instance Location: Where is the Firestore database located? You can check your current database location at [https://console.cloud.google.com/firestore/databases](https://console.cloud.google.com/firestore/databases).
5556

56-
* **fsurlshortener:** Listens for writes of new URLs to your specified Cloud Firestore collection, shortens the URLs, then writes the shortened form back to the same document.
57+
58+
59+
60+
**Other Resources**:
61+
62+
* fsurlshortener (firebaseextensions.v1beta.v2function)
5763

5864

5965

firestore-shorten-urls-bitly/extension.yaml

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

1515
name: firestore-shorten-urls-bitly
16-
version: 0.1.18
16+
version: 0.2.0
1717
specVersion: v1beta
1818

1919
displayName: Shorten URLs in Firestore
@@ -48,16 +48,26 @@ roles:
4848

4949
resources:
5050
- name: fsurlshortener
51-
type: firebaseextensions.v1beta.function
51+
type: firebaseextensions.v1beta.v2function
5252
description:
5353
Listens for writes of new URLs to your specified Cloud Firestore
5454
collection, shortens the URLs, then writes the shortened form back to the
5555
same document.
5656
properties:
57-
runtime: nodejs20
57+
sourceDirectory: functions
58+
buildConfig:
59+
runtime: nodejs22
60+
serviceConfig:
61+
timeoutSeconds: 120
5862
eventTrigger:
59-
eventType: providers/cloud.firestore/eventTypes/document.write
60-
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/${param:COLLECTION_PATH}/{documentId}
63+
eventType: google.cloud.firestore.document.v1.written
64+
triggerRegion: ${DATABASE_REGION}
65+
eventFilters:
66+
- attribute: database
67+
value: ${DATABASE}
68+
- attribute: document
69+
value: ${COLLECTION_PATH}/{documentId}
70+
operator: match-path-pattern
6171

6272
externalServices:
6373
- name: Bitly
@@ -101,16 +111,143 @@ params:
101111
default: shortUrl
102112
required: true
103113

114+
- param: DATABASE
115+
label: Firestore Instance ID
116+
description: >
117+
The Firestore database to use. Use "(default)" for the default database.
118+
You can view your available Firestore databases at
119+
[https://console.cloud.google.com/firestore/databases](https://console.cloud.google.com/firestore/databases).
120+
example: (default)
121+
default: (default)
122+
required: true
123+
124+
- param: DATABASE_REGION
125+
label: Firestore Instance Location
126+
description: >
127+
Where is the Firestore database located? You can check your current
128+
database location at
129+
[https://console.cloud.google.com/firestore/databases](https://console.cloud.google.com/firestore/databases).
130+
type: select
131+
options:
132+
# Multi-region locations
133+
- label: Europe (multi-regional, eur3)
134+
value: eur3
135+
- label: United States (multi-regional, nam5)
136+
value: nam5
137+
- label: Europe (multi-regional)
138+
value: eu
139+
- label: United States (multi-regional)
140+
value: us
141+
142+
# North America
143+
- label: Iowa (us-central1)
144+
value: us-central1
145+
- label: Oregon (us-west1)
146+
value: us-west1
147+
- label: Los Angeles (us-west2)
148+
value: us-west2
149+
- label: Salt Lake City (us-west3)
150+
value: us-west3
151+
- label: Las Vegas (us-west4)
152+
value: us-west4
153+
- label: South Carolina (us-east1)
154+
value: us-east1
155+
- label: Northern Virginia (us-east4)
156+
value: us-east4
157+
- label: Columbus (us-east5)
158+
value: us-east5
159+
- label: Dallas (us-south1)
160+
value: us-south1
161+
- label: Montreal (northamerica-northeast1)
162+
value: northamerica-northeast1
163+
- label: Toronto (northamerica-northeast2)
164+
value: northamerica-northeast2
165+
- label: Queretaro (northamerica-south1)
166+
value: northamerica-south1
167+
168+
# South America
169+
- label: Sao Paulo (southamerica-east1)
170+
value: southamerica-east1
171+
- label: Santiago (southamerica-west1)
172+
value: southamerica-west1
173+
174+
# Europe
175+
- label: Belgium (europe-west1)
176+
value: europe-west1
177+
- label: London (europe-west2)
178+
value: europe-west2
179+
- label: Frankfurt (europe-west3)
180+
value: europe-west3
181+
- label: Netherlands (europe-west4)
182+
value: europe-west4
183+
- label: Zurich (europe-west6)
184+
value: europe-west6
185+
- label: Milan (europe-west8)
186+
value: europe-west8
187+
- label: Paris (europe-west9)
188+
value: europe-west9
189+
- label: Berlin (europe-west10)
190+
value: europe-west10
191+
- label: Turin (europe-west12)
192+
value: europe-west12
193+
- label: Madrid (europe-southwest1)
194+
value: europe-southwest1
195+
- label: Finland (europe-north1)
196+
value: europe-north1
197+
- label: Stockholm (europe-north2)
198+
value: europe-north2
199+
- label: Warsaw (europe-central2)
200+
value: europe-central2
201+
202+
# Middle East
203+
- label: Doha (me-central1)
204+
value: me-central1
205+
- label: Dammam (me-central2)
206+
value: me-central2
207+
- label: Tel Aviv (me-west1)
208+
value: me-west1
209+
210+
# Asia
211+
- label: Mumbai (asia-south1)
212+
value: asia-south1
213+
- label: Delhi (asia-south2)
214+
value: asia-south2
215+
- label: Singapore (asia-southeast1)
216+
value: asia-southeast1
217+
- label: Jakarta (asia-southeast2)
218+
value: asia-southeast2
219+
- label: Taiwan (asia-east1)
220+
value: asia-east1
221+
- label: Hong Kong (asia-east2)
222+
value: asia-east2
223+
- label: Tokyo (asia-northeast1)
224+
value: asia-northeast1
225+
- label: Osaka (asia-northeast2)
226+
value: asia-northeast2
227+
- label: Seoul (asia-northeast3)
228+
value: asia-northeast3
229+
230+
# Australia
231+
- label: Sydney (australia-southeast1)
232+
value: australia-southeast1
233+
- label: Melbourne (australia-southeast2)
234+
value: australia-southeast2
235+
236+
# Africa
237+
- label: Johannesburg (africa-south1)
238+
value: africa-south1
239+
default: us
240+
required: true
241+
immutable: true
242+
104243
events:
105244
- type: firebase.extensions.firestore-shorten-urls-bitly.v1.onStart
106245
description:
107246
Occurs when a trigger has been called within the Extension, and will
108247
include data such as the context of the trigger request.
109248

110249
- type: firebase.extensions.firestore-shorten-urls-bitly.v1.onSuccess
111-
description:
112-
Occurs when image resizing completes successfully. The event will contain
113-
further details about specific formats and sizes.
250+
description: Occurs when URL shortening completes successfully.
114251

115252
- type: firebase.extensions.firestore-shorten-urls-bitly.v1.onError
116253
description:

0 commit comments

Comments
 (0)