Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to node 18 #63

Merged
merged 18 commits into from
Jan 15, 2024
8 changes: 8 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"projects": {
"default": "ts-integration-aaf0c"
},
"targets": {},
"etags": {
"ts-integration-aaf0c": {
"extensionInstances": {
"firestore-typesense-search": "fd2b1a2d8f4bcfe149d42c706040827ee1ce311307b1f29b0347a63754af2d26"
}
}
}
}
25 changes: 20 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
name: tests

on: [push, pull_request]
on: [push, pull_request_target]

jobs:
# Source: https://iterative.ai/blog/testing-external-contributions-using-github-actions-secrets
authorize:
environment:
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'sandbox' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true

build_and_test:
needs: authorize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1
cache: npm
- uses: actions/cache@v3
with:
path: |
~/.cache/firebase/emulators
key: ${{ runner.os }}-firebase-emulators
- run: npm install
- run: npm install -g [email protected]
- run: firebase --open-sesame extdev
- run: npm install -g firebase-tools
- run: cd functions && npm install
- run: npm run test -- --ci --color
- name: Run Tests
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: npm run test -- --ci --color
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ node_modules/
# dotenv environment variables file
.env
test-params.env
extensions/test-params.env
/typesense-server-data/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version 1.2.0

- Upgrade to Node 18

## Version 1.1.0

- Add random jitter to retries to handle potential thundering herd issues for high volume writes.
Expand Down
6 changes: 3 additions & 3 deletions extension.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: firestore-typesense-search
version: 1.1.0
version: 1.2.0
specVersion: v1beta # Firebase Extensions specification version (do not edit)

displayName: Search Firestore with Typesense
Expand All @@ -21,7 +21,7 @@ resources:
description: A function that indexes data into Typesense when it's triggered by Firestore changes
type: firebaseextensions.v1beta.function
properties:
runtime: nodejs16
runtime: nodejs18
sourceDirectory: functions
timeout: 540s
location: ${LOCATION}
Expand All @@ -35,7 +35,7 @@ resources:
triggered when a Firestore document with the path `typesense_sync/backfill` has the contents of `trigger: true`.
type: firebaseextensions.v1beta.function
properties:
runtime: nodejs16
runtime: nodejs18
sourceDirectory: functions
timeout: 540s
maxInstances: 1
Expand Down
1 change: 1 addition & 0 deletions extensions/firestore-typesense-search.secret.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TYPESENSE_API_KEY=xyz
9 changes: 9 additions & 0 deletions extensions/test-params-flatten-nested-false.local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
LOCATION=us-central1
FIRESTORE_COLLECTION_PATH=books
FIRESTORE_COLLECTION_FIELDS=author,title,rating,isAvailable,location,createdAt,nested_field,tags,nullField,ref
FLATTEN_NESTED_DOCUMENTS=false
TYPESENSE_HOSTS=localhost
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=http
TYPESENSE_COLLECTION_NAME=books_firestore/1
TYPESENSE_API_KEY=xyz
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FIRESTORE_COLLECTION_FIELDS=author,title
FLATTEN_NESTED_DOCUMENTS=true
TYPESENSE_HOSTS=xxx-1.a1.typesense.net
TYPESENSE_COLLECTION_NAME=books
TYPESENSE_API_KEY=xyz
TYPESENSE_API_KEY=projects/9258397723/secrets/ext-firestore-typesense-search-TYPESENSE_API_KEY/versions/1
37 changes: 28 additions & 9 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,40 @@
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
],
"source": "functions"
},
"emulators": {
"functions": {
"port": 5001
"port": 5001,
"host": "127.0.0.1"
},
"firestore": {
"port": 5002
"port": 8080,
"host": "127.0.0.1"
},
"ui": {
"enabled": true
},
"extensions": {

},
"singleProjectMode": true
},
"extensions": {
"firestore-typesense-search": "."
},
"functions": [
{
"source": "functions",
"codebase": "functions",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
}
]
}
Loading