Skip to content

Commit

Permalink
Shorten function names to fix issue with local emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbosco committed Feb 7, 2024
1 parent 913e276 commit 35e0b5e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version 1.4.0

- Shorten function names to fix issue with local emulator

## Version 1.3.0

- Use `action=upsert` for back-filling data
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ This will trigger the backfill background Cloud function, which will read data f

## ☁️ Cloud Functions

* **indexToTypesenseOnFirestoreWrite:** A function that indexes data into Typesense when it's triggered by Firestore changes.
* **indexOnWrite:** A function that indexes data into Typesense when it's triggered by Firestore changes.

* **backfillToTypesenseFromFirestore:** A function that backfills data from a Firestore collection into Typesense, triggered when a Firestore document with the path `typesense_sync/backfill` has the contents of `trigger: true`.
* **backfill:** A function that backfills data from a Firestore collection into Typesense, triggered when a Firestore document with the path `typesense_sync/backfill` has the contents of `trigger: true`.


## 🔑 Access Required
Expand Down Expand Up @@ -154,4 +154,4 @@ firebase ext:info ./ --markdown > README.md

## ℹ️ Support

Please open a Github issue or join our [Slack community](https://join.slack.com/t/typesense-community/shared_invite/zt-mx4nbsbn-AuOL89O7iBtvkz136egSJg).
Please open a GitHub issue or join our [Slack community](https://join.slack.com/t/typesense-community/shared_invite/zt-mx4nbsbn-AuOL89O7iBtvkz136egSJg).
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.3.0
version: 1.4.0
specVersion: v1beta # Firebase Extensions specification version (do not edit)

displayName: Search Firestore with Typesense
Expand All @@ -17,7 +17,7 @@ releaseNotesUrl: https://github.com/typesense/firestore-typesense-search/release
billingRequired: true

resources:
- name: indexToTypesenseOnFirestoreWrite
- name: indexOnWrite
description: A function that indexes data into Typesense when it's triggered by Firestore changes
type: firebaseextensions.v1beta.function
properties:
Expand All @@ -29,7 +29,7 @@ resources:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/${param:FIRESTORE_COLLECTION_PATH}/{documentID}

- name: backfillToTypesenseFromFirestore
- name: backfill
description: >-
A function that backfills data from a Firestore collection into Typesense,
triggered when a Firestore document with the path `typesense_sync/backfill` has the contents of `trigger: true`.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions functions/src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
exports.indexToTypesenseOnFirestoreWrite = require("./indexToTypesenseOnFirestoreWrite.js");
exports.backfillToTypesenseFromFirestore = require("./backfillToTypesenseFromFirestore.js");
exports.indexOnWrite = require("./indexOnWrite.js");
exports.backfill = require("./backfill.js");
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"emulator": "DOTENV_CONFIG=extensions/test-params-flatten-nested-false.local.env firebase emulators:start --import=emulator_data",
"export": "firebase emulators:export emulator_data",
"test": "npm run test-part-1 && npm run test-part-2",
"test-part-1": "cp -f extensions/test-params-flatten-nested-true.local.env extensions/firestore-typesense-search.env.local && NODE_OPTIONS=--experimental-vm-modules DOTENV_CONFIG=extensions/test-params-flatten-nested-true.local.env firebase emulators:exec --only functions,firestore,extensions 'jest --testPathIgnorePatterns=test/indexToTypesenseOnFirestoreWriteWithoutFlattening.spec.js'",
"test-part-2": "cp -f extensions/test-params-flatten-nested-false.local.env extensions/firestore-typesense-search.env.local && NODE_OPTIONS=--experimental-vm-modules DOTENV_CONFIG=extensions/test-params-flatten-nested-false.local.env firebase emulators:exec --only functions,firestore,extensions 'jest --testPathPattern=test/indexToTypesenseOnFirestoreWriteWithoutFlattening.spec.js'",
"test-part-1": "cp -f extensions/test-params-flatten-nested-true.local.env extensions/firestore-typesense-search.env.local && NODE_OPTIONS=--experimental-vm-modules DOTENV_CONFIG=extensions/test-params-flatten-nested-true.local.env firebase emulators:exec --only functions,firestore,extensions 'jest --testPathIgnorePatterns=test/indexOnWriteWithoutFlattening.spec.js'",
"test-part-2": "cp -f extensions/test-params-flatten-nested-false.local.env extensions/firestore-typesense-search.env.local && NODE_OPTIONS=--experimental-vm-modules DOTENV_CONFIG=extensions/test-params-flatten-nested-false.local.env firebase emulators:exec --only functions,firestore,extensions 'jest --testPathPattern=test/indexOnWriteWithoutFlattening.spec.js'",
"typesenseServer": "mkdir -p $(pwd)/typesense-server-data && docker run -i -p 8108:8108 -v$(pwd)/typesense-server-data/:/data typesense/typesense:0.25.1 --data-dir /data --api-key=xyz --listen-port 8108 --enable-cors",
"lint": "eslint . --fix"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const app = firebase.initializeApp({
});
const firestore = app.firestore();

describe("backfillToTypesenseFromFirestore", () => {
describe("backfill", () => {
beforeEach(async () => {
// Clear the database between tests
await firestore.recursiveDelete(firestore.collection(config.firestoreCollectionPath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const app = firebase.initializeApp({
});
const firestore = app.firestore();

describe("indexToTypesenseOnFirestoreWrite", () => {
describe("indexOnWrite", () => {
beforeEach(async () => {
// delete the Firestore collection
await firestore.recursiveDelete(firestore.collection(config.firestoreCollectionPath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const app = firebase.initializeApp({
});
const firestore = app.firestore();

describe("indexToTypesenseOnFirestoreWriteWithoutFlattening", () => {
describe("indexOnWriteWithoutFlattening", () => {
beforeEach(async () => {
// delete the Firestore collection
await firestore.recursiveDelete(firestore.collection(config.firestoreCollectionPath));
Expand Down

0 comments on commit 35e0b5e

Please sign in to comment.