### Install Firestore to BigQuery Export Extension via CLI Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/get-started.md Use this command to install the extension. You will be prompted to configure parameters during installation. ```bash firebase ext:install firebase/firestore-bigquery-export --project=projectId-or-alias ``` -------------------------------- ### Install and Configure Storage Resize Images Extension Source: https://context7.com/firebase/extensions/llms.txt Install the storage-resize-images extension to automatically resize images uploaded to Cloud Storage. Configure parameters like IMG_BUCKET, IMG_SIZES, and DELETE_ORIGINAL_FILE. ```bash firebase ext:install firebase/storage-resize-images --project=my-project-id ``` -------------------------------- ### Install firestore-counter Mod Source: https://github.com/firebase/extensions/blob/next/firestore-counter/CONTRIBUTING.md Install the firestore-counter mod using the Firebase CLI. Ensure to check the post-install message for final setup steps. ```bash firebase mods:install . --project= ``` -------------------------------- ### Install firestore-shorten-urls-bitly Extension Source: https://context7.com/firebase/extensions/llms.txt Install the firestore-shorten-urls-bitly extension using the Firebase CLI. Ensure you have a Bitly access token and configure collection and field paths. ```bash firebase ext:install firebase/firestore-shorten-urls-bitly --project=my-project-id ``` -------------------------------- ### Install and Manage Firebase Extensions via CLI Source: https://context7.com/firebase/extensions/llms.txt Use these commands to install, list, configure, and uninstall extensions from your Firebase project. ```bash firebase ext:install firebase/delete-user-data --project=my-project-id ``` ```bash firebase ext:list --project=my-project-id ``` ```bash firebase ext:configure delete-user-data --project=my-project-id ``` ```bash firebase ext:uninstall delete-user-data --project=my-project-id ``` -------------------------------- ### Build Extension Components Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/CONTRIBUTING.md Installs dependencies and builds the extension components in the correct order. This should be run after updating local package.json files. ```bash export PKGS="firestore-bigquery-change-tracker scripts/import . scripts/gen-schema-view" for pkg in $PKGS; do pushd . && cd $pkg && npm install && npm run build popd done; ``` -------------------------------- ### Example ParamDefinition Usage Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bundle-builder/api-reference.md Illustrates how to define a required string parameter named 'name' for dynamic bundle generation. ```javascript params: { name: { required: true, type: ‘string’, } } ``` -------------------------------- ### Install firestore-translate-text Extension Source: https://context7.com/firebase/extensions/llms.txt Install the firestore-translate-text extension using the Firebase CLI. Configure languages, collection paths, and the translation provider. ```bash firebase ext:install firebase/firestore-translate-text --project=my-project-id ``` -------------------------------- ### Run Test Data Population Source: https://github.com/firebase/extensions/blob/next/delete-user-data/test-data/README.md Execute this command to start the test data population process. Follow the on-screen prompts for configuration. ```bash npm run populate ``` -------------------------------- ### Example Query Definition Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bundle-builder/api-reference.md Demonstrates creating a named query 'products' on the 'products' collection with a 'featured' type filter and a limit of 10. ```javascript queries: { products: { collection: ‘products’, conditions: [ { where: [‘type’, ‘==’, ‘featured’] }, { limit: 10 }, ], } } ``` -------------------------------- ### Install and Configure RTDB Limit Child Nodes Extension Source: https://context7.com/firebase/extensions/llms.txt Install the rtdb-limit-child-nodes extension to automatically cap the number of child nodes in a Realtime Database path. Configure NODE_PATH, SELECTED_DATABASE_INSTANCE, and MAX_COUNT. ```bash firebase ext:install firebase/rtdb-limit-child-nodes --project=my-project-id ``` -------------------------------- ### Install firebase-functions Source: https://github.com/firebase/extensions/blob/next/docs/storage-resize-images/handle-resize-image-extension-events.md Ensure you have the latest firebase-functions package installed for your Node.js project. ```json { "firebase-functions": "^3.21.1" } ``` -------------------------------- ### Install and Configure Firestore to BigQuery Export Extension Source: https://context7.com/firebase/extensions/llms.txt Install the firestore-bigquery-export extension to mirror Firestore document writes to a BigQuery dataset in real time. Configure parameters for collection path, dataset ID, table ID, BigQuery project, dataset location, table partitioning, clustering, view type, and dispatch rate. ```bash # Install the extension firebase ext:install firebase/firestore-bigquery-export --project=my-project-id # Key parameters during setup: # COLLECTION_PATH: posts (or chatrooms/{chatId}/messages for subcollections) # DATASET_ID: firestore_export # TABLE_ID: posts # BIGQUERY_PROJECT_ID: my-project-id # DATASET_LOCATION: us # TABLE_PARTITIONING: DAY # CLUSTERING: document_id,timestamp # VIEW_TYPE: materialized_incremental # MAX_DISPATCHES_PER_SECOND: 100 ``` -------------------------------- ### Install Firestore Counter Extension via CLI Source: https://github.com/firebase/extensions/blob/next/docs/firestore-counter/get-started.md Use the Firebase CLI to install the Firestore Counter extension. Replace 'projectId-or-alias' with your actual project ID or alias. ```bash firebase ext:install firebase/storage-resize-images --project=projectId-or-alias ``` -------------------------------- ### Example Usage with Transform Function Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md Use this command to import documents while applying a transform function. Replace placeholders with your project ID, collection path, dataset ID, and transform function URL. ```shell npx @firebaseextensions/fs-bq-import-collection --non-interactive \ -P \ -s \ -d \ -f https://us-west1-my-project.cloudfunctions.net/transformFunction ``` -------------------------------- ### Build firestore-counter from Source Source: https://github.com/firebase/extensions/blob/next/firestore-counter/CONTRIBUTING.md Build the firestore-counter extension from its source code. This involves navigating to the functions directory, installing dependencies, and running the build script. ```bash cd functions/ npm install npm run build ``` -------------------------------- ### Example Wildcard Value Structure Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/Wildcards.md When a wildcard parameter is configured, its extracted value is stored as a JSON string. This example shows the typical structure of such a value. ```json { "regionId": "Central America"; } ``` -------------------------------- ### Install extension using Firebase CLI Source: https://github.com/firebase/extensions/blob/next/docs/firestore-translate-text/get-started.md Install the Translate Text in Firestore extension using the Firebase CLI. You will be prompted to configure collection path, input field, and target languages. ```bash firebase ext:install firebase/firestore-translate-text --project=projectId-or-alias ``` -------------------------------- ### Document with translations Source: https://github.com/firebase/extensions/blob/next/docs/firestore-translate-text/get-started.md This is an example of how a document appears after the extension has processed it, including the original input and the translated fields. ```json { input: 'Hello from Firebase!', translations: { 'fr': 'Bonjour de Firebase!', 'de': 'Hallo von Firebase!', }, } ``` -------------------------------- ### Install extension using Firebase CLI Source: https://github.com/firebase/extensions/blob/next/docs/firestore-send-email/get-started.md Install the Trigger Email from Firestore extension using the Firebase CLI. You will be prompted for SMTP and collection configuration. ```bash firebase ext:install firebase/firestore-send-email --project=projectId-or-alias ``` -------------------------------- ### Example Document Structure Source: https://github.com/firebase/extensions/blob/next/firestore-shorten-urls-bitly/POSTINSTALL.md Illustrates the document structure before and after the extension processes a URL. The extension adds the `${param:SHORT_URL_FIELD_NAME}` field containing the shortened URL. ```json { "${param:URL_FIELD_NAME}": "https://my.super.long-link.example.com/api/user/profile/-jEHitne10395-k3593085", "${param:SHORT_URL_FIELD_NAME}": "https://bit.ly/EKDdza" } ``` -------------------------------- ### Example Schema Configuration Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/GENERATE_SCHEMA_VIEWS.md Define your Firestore schema using JSON format. This example showcases various supported field types including string, array, timestamp, geopoint, and map. ```json { "fields": [ { "name": "name", "type": "string" }, { "name": "favorite_numbers", "type": "array" }, { "name": "last_login", "type": "timestamp" }, { "name": "last_location", "type": "geopoint" }, { "name": "geo_point", "type": "stringified_map" }, { "name": "friends", "type": "map", "fields": [ { "name": "name", "type": "string" } ] } ] } ``` -------------------------------- ### Download OAuth2 Refresh Token Helper Script Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/PREINSTALL.md Use curl or wget to download the helper script for generating a refresh token. This script simplifies the process without requiring npm installations. ```bash # Using curl curl -o oauth2-refresh-token-helper.js https://raw.githubusercontent.com/firebase/extensions/refs/heads/master/firestore-send-email/scripts/oauth2-refresh-token-helper.js # Using wget wget https://raw.githubusercontent.com/firebase/extensions/refs/heads/master/firestore-send-email/scripts/oauth2-refresh-token-helper.js ``` -------------------------------- ### Example Failed Batch Output Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md When using the failed batch output option, the specified file will list the paths of documents that encountered import errors. ```text projects/my-project/databases/(default)/documents/users/user123 projects/my-project/databases/(default)/documents/orders/order456 projects/my-project/databases/(default)/documents/posts/post789 ``` -------------------------------- ### Initialize and Use Web SDK for Sharded Counter Source: https://github.com/firebase/extensions/blob/next/firestore-counter/CONTRIBUTING.md Initialize Firebase and the sharded counter client-side. This example shows how to increment a counter and listen to both locally consistent and eventually consistent views. ```javascript ``` -------------------------------- ### Combine Filters for Specific Logs Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/OBSERVABILITY.md This example demonstrates how to combine multiple filters using 'AND' to narrow down log results. It targets logs from a specific Cloud Function instance (`ext--syncBigQuery`) that also received an event via the onDispatch trigger. ```plaintext resource.labels.function_name="ext--syncBigQuery" AND jsonPayload.message="Firestore event received by onDispatch trigger" ``` -------------------------------- ### Run Schema Views Script with npm Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/generating-schemas.md Execute the `fs-bq-schema-views` script using npx to generate BigQuery views. Ensure Node.js and npx are installed. This command requires project, dataset, table prefix, and schema file path parameters. ```bash $ npx @firebaseextensions/fs-bq-schema-views \ --non-interactive \ --project=${param:PROJECT_ID} \ --dataset=${param:DATASET_ID} \ --table-name-prefix=${param:TABLE_ID} \ --schema-files=./test_schema.json ``` -------------------------------- ### Define Basic Schema Fields Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/generating-schemas.md Create a JSON schema file to define the fields and their types for your BigQuery views. This example shows basic string and number types. ```json { "fields": [ { "name": "name", "type": "string" }, { "name": "age", "type": "number" } ] } ``` -------------------------------- ### Web Client Counter Increment ( ``` -------------------------------- ### Example Event Handler for Successful Resize Operation Source: https://github.com/firebase/extensions/blob/next/storage-resize-images/PREINSTALL.md This TypeScript code demonstrates how to create a custom event handler for the onSuccess event emitted by the extension. It logs information about the successful resize operation and can be extended for further custom logic. ```typescript import * as functions from 'firebase-functions'; import { onCustomEventPublished } from 'firebase-functions/v2/eventarc'; export const onImageResized = onCustomEventPublished( "firebase.extensions.storage-resize-images.v1.onSuccess", (event) => { functions.logger.info("Resize Image is successful", event); // Additional operations based on the event data can be performed here return Promise.resolve(); } ); ``` -------------------------------- ### Listen for Storage Resize Images Extension Events Source: https://context7.com/firebase/extensions/llms.txt Listen for events emitted by the storage-resize-images extension to get metadata about resized images or error details. Available events include onSuccess, onError, and onStartResize. ```javascript // firebase.extensions.storage-resize-images.v1.onSuccess — contains output paths & sizes // firebase.extensions.storage-resize-images.v1.onError — error details // firebase.extensions.storage-resize-images.v1.onStartResize — fires per successful resize op ``` -------------------------------- ### Get Document Data from Bundle Cache Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bundle-builder/get-started.md Retrieve document data from a loaded bundle using its document ID. This example assumes the bundle contains the specified document. ```javascript import { getFirestore, doc, getDocFromCache } from "firebase/firestore"; // Bundle Document IDs: ['users/92x1NgSWYKUC4AG4s2nHGMR2ikZ2'] const ref = doc(getFirestore(), "users/92x1NgSWYKUC4AG4s2nHGMR2ikZ2"); const snapshot = await getDocFromCache(ref); ``` -------------------------------- ### Node.js Admin Sample Implementation Source: https://github.com/firebase/extensions/blob/next/firestore-counter/README.md This Node.js sample demonstrates how to use the distributed counter from a server environment using the Firebase Admin SDK. ```javascript const firebaseAdmin = require("firebase-admin"); // Initialize Firebase Admin SDK (replace with your service account key) const serviceAccount = require("./path/to/your/serviceAccountKey.json"); firebaseAdmin.initializeApp({ credential: firebaseAdmin.credential.cert(serviceAccount), }); const db = firebaseAdmin.firestore(); // Function to increment a counter async function incrementCounter(counterPath, incrementValue) { const counterRef = db.doc(counterPath); const shardsRef = counterRef.collection("_counter_shards_"); // Create a new shard document with the increment value await shardsRef.add({ value: incrementValue, timestamp: firebaseAdmin.firestore.FieldValue.serverTimestamp(), }); } // Example usage: // incrementCounter("/counters/myCounter", 1); // incrementCounter("/counters/anotherCounter", 10); ``` -------------------------------- ### Run the Refresh Token Helper Script Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/PREINSTALL.md Execute the downloaded helper script using Node.js. You can provide credentials via command-line arguments or environment variables. ```bash node oauth2-refresh-token-helper.js ``` ```bash # Using environment variables export CLIENT_ID=your_client_id export CLIENT_SECRET=your_client_secret node oauth2-refresh-token-helper.js # Using command-line arguments node oauth2-refresh-token-helper.js --id=your_client_id --secret=your_client_secret ``` -------------------------------- ### Authenticate with Google Cloud Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/generating-schemas.md Set up Application Default Credentials for the schema-views script to authenticate with BigQuery. This command initiates the login process. ```bash gcloud auth application-default login ``` -------------------------------- ### Run fs-bq-schema-views in Interactive Mode Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/GENERATE_SCHEMA_VIEWS.md Use this command to interactively generate a schema file. You will be prompted for necessary project and collection details. ```bash npx @firebaseextensions/fs-bq-schema-views ``` -------------------------------- ### Run the Import Script Interactively Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md Execute the import script using npx. The script will prompt for necessary configuration values like collection path and dataset ID. ```shell npx @firebaseextensions/fs-bq-import-collection ``` -------------------------------- ### Generate Refresh Token using google-auth-library Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/PREINSTALL.md If you are building your own application in a Node.js environment with npm, use the official google-auth-library to generate a refresh token. Ensure you have installed the library using 'npm install google-auth-library'. ```javascript import { OAuth2Client } from "google-auth-library"; // Initialize OAuth client const oAuth2Client = new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI); // Generate authorization URL const authorizeUrl = oAuth2Client.generateAuthUrl({ access_type: "offline", prompt: "consent", scope: ["https://mail.google.com/"], // Full Gmail access }); // After receiving the code from the callback: const { tokens } = await oAuth2Client.getToken(code); const refreshToken = tokens.refresh_token; ``` -------------------------------- ### Install and Use Firestore Distributed Counter Source: https://context7.com/firebase/extensions/llms.txt Install the firestore-counter extension to enable high-velocity counters in Firestore. Use the client-side SDK (web or Node.js) to increment counters and retrieve their aggregated values. The extension shards increments and periodically aggregates them. ```bash firebase ext:install firebase/firestore-counter --project=my-project-id ``` ```javascript import { initializeApp } from "firebase/app"; import { getFirestore, doc } from "firebase/firestore"; import { Counter } from "./sharded-counter.js"; const app = initializeApp({ projectId: "my-project-id" /* ... */ }); const db = getFirestore(app); // Create a counter at a Firestore document path const articleRef = doc(db, "articles", "post-123"); const counter = new Counter(articleRef, "views"); // "views" = field name // Increment the counter (client writes to a unique shard) await counter.incrementBy(1); // Read the current aggregated counter value const count = await counter.get(); console.log("View count:", count); // e.g. 4821 ``` ```javascript const admin = require("firebase-admin"); const { Counter } = require("./clients/node/index.js"); admin.initializeApp(); const db = admin.firestore(); const postRef = db.collection("articles").doc("post-123"); const adminCounter = new Counter(postRef, "likes"); await adminCounter.incrementBy(1); ``` -------------------------------- ### Install Firestore Send Email Extension Source: https://context7.com/firebase/extensions/llms.txt Install the firestore-send-email extension to send emails triggered by Firestore document changes. Configure SMTP connection details, mail collection, default sender, and optional user/template collections. Supports attachments, templating, and automatic cleanup. ```bash firebase ext:install firebase/firestore-send-email --project=my-project-id ``` -------------------------------- ### Install and Configure Delete User Data Extension Source: https://context7.com/firebase/extensions/llms.txt Install the delete-user-data extension and configure its parameters for automatic GDPR-compliant user data removal. This extension listens for Firebase Authentication user deletion events and purges associated data from Firestore, Realtime Database, and Cloud Storage. ```bash # Install the extension firebase ext:install firebase/delete-user-data --project=my-project-id # During installation, provide these parameters: # FIRESTORE_PATHS: users/{UID},admins/{UID},posts/{UID} # FIRESTORE_DELETE_MODE: recursive # RTDB_PATHS: users/{UID},sessions/{UID} # STORAGE_PATHS: {DEFAULT}/{UID}-avatar.png,user-logs/{UID}-logs.txt,{DEFAULT}/media/{UID} # ENABLE_AUTO_DISCOVERY: yes # AUTO_DISCOVERY_SEARCH_DEPTH: 3 # AUTO_DISCOVERY_SEARCH_FIELDS: id,uid,userId # After a user is deleted via Firebase Auth, all configured paths are automatically purged. # To test: delete a user in the Firebase console Authentication dashboard. # Within seconds the data at the configured paths is removed. # Optional: provide a custom search function to return additional Firestore paths # SEARCH_FUNCTION: https://us-central1-my-project.cloudfunctions.net/getUserPaths # The function receives: { "uid": "abc123" } # And must return: ["custom/collection/abc123", "another/doc/path"] # Listen for extension lifecycle events (emitted on each deletion batch): # firebase.extensions.delete-user-data.v1.firestore # firebase.extensions.delete-user-data.v1.database # firebase.extensions.delete-user-data.v1.storage ``` -------------------------------- ### Authenticate with Google Cloud Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/importing-data.md Set up Application Default Credentials for the import script to communicate with BigQuery. This command initiates an interactive login process. ```bash gcloud auth application-default login ``` -------------------------------- ### Configure Sharp Output Options Source: https://github.com/firebase/extensions/blob/next/storage-resize-images/POSTINSTALL.md Provide a stringified JSON object to configure Sharp output options for specific image formats. Incorrect options or unselected formats will be ignored. ```javascript {"jpeg": {"quality": 5,"chromaSubsampling": '4:4:4'}, "png": { "pallete": true}} ``` -------------------------------- ### Run OAuth2 Refresh Token Helper Script Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/README.md Execute the downloaded helper script using Node.js. It supports command-line options for port, client ID, client secret, and output file. ```bash node oauth2-refresh-token-helper.js ``` -------------------------------- ### Run fs-bq-schema-views with Collection Group Query Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/GENERATE_SCHEMA_VIEWS.md Use the `--query-collection-group` flag for non-interactive schema generation when you need to query all collections with the same name across your database, regardless of their parent path. ```bash npx @firebaseextensions/fs-bq-schema-views \ --non-interactive \ --project=my-firebase-project \ --big-query-project=my-bq-project \ --dataset=firestore_changelog \ --table-name-prefix=user_profiles \ --use-gemini=secure \ --query-collection-group \ --google-ai-key=$GOOGLE_API_KEY \ --schema-directory=./schemas \ --gemini-schema-file-name=user_schema ``` -------------------------------- ### Initialize and Use FirestoreCounter in iOS (Swift) Source: https://github.com/firebase/extensions/blob/next/firestore-counter/POSTINSTALL.md Demonstrates how to initialize and use the FirestoreCounter in an iOS Swift application. Includes listening for snapshots and incrementing the counter. ```swift import UIKit import FirestoreCounter import FirebaseFirestore class ViewController: UIViewController { // somewhere in your app code initialize Firestore instance var db = Firestore.firestore() // create reference to the collection and the document you wish to use var doc = db.collection("pages").document("hello-world") // initialize FirestoreShardedCounter with the document and the property which will hold the counter value var controller = FirestoreShardCounter(docRef: doc, field: "visits") override func viewDidLoad() { super.viewDidLoad() // event listener which returns total amount controller.onSnapshot { (value, error) in if let error = error { // handle error } else if let value = value { // 'value' param is total amount of pages visits } } } @IBAction func getLatest(_ sender: Any) { // get current total controller.get() { (value, error) in if let error = error { // handle error } else if let value = value { // 'value' param is total amount of pages visits } } } @IBAction func incrementer(_ sender: Any) { // to increment counter controller.incrementBy(val: Double(1)) } } ``` -------------------------------- ### Example Handlebars Template Structure Source: https://github.com/firebase/extensions/blob/next/docs/firestore-send-email/use-handlebars-template.md Defines the structure for a Handlebars template document in Firestore, including subject, HTML content, and attachments with dynamic placeholders. ```json { subject: "@{{username}} is now following you!", html: "Just writing to let you know that @{{username}} ({{name}}) is now following you.", attachments: [ { filename: "{{username}}.jpg", path: "{{imagePath}}" } ] } ``` -------------------------------- ### Run All Integration Tests Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/CONTRIBUTING.md Executes all integration tests for the firestore-bigquery-change-tracker package. Ensure GCP authentication is configured correctly. ```bash npm test ``` -------------------------------- ### CMEK Resource Name Format Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/PREINSTALL.md This is the expected format for the customer-managed encryption key resource name when installing the extension. Replace placeholders with your specific project details. ```plaintext projects//locations//keyRings//cryptoKeys/ ``` -------------------------------- ### SMTP Connection URL with Inline Password Source: https://github.com/firebase/extensions/blob/next/docs/firestore-send-email/smtp-connection-url.md Include your password directly in the connection URL for a less secure but simpler setup. This method is not recommended for production environments. ```plaintext smtps://username@gmail.com:password@smtp.gmail.com:465 ``` -------------------------------- ### SendGrid Categories Example Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/POSTINSTALL.md Include a 'categories' field in the Firestore document to assign categories to emails sent via SendGrid. This helps in organizing and analyzing email campaigns. ```json { "to": ["example@example.com"], "categories": ["Example_Category"], "message": { "subject": "Test Email with Categories", "text": "This is a test email to see if categories work.", "html": "This is a test email to see if categories work." } } ``` -------------------------------- ### Backfill Firestore Collection to BigQuery Source: https://context7.com/firebase/extensions/llms.txt Use this command to backfill an existing Firestore collection into BigQuery. Supports interactive prompts for configuration and can be run non-interactively with specified parameters. It also supports pause/resume functionality using a local cursor file. ```bash npx @firebaseextensions/fs-bq-import-collection ``` ```bash npx @firebaseextensions/fs-bq-import-collection \ --project=my-project-id \ --collection=landmarks \ --dataset=firestore_export \ --collection-group=true ``` -------------------------------- ### Specify Multiple Schema Files Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/GENERATE_SCHEMA_VIEWS.md Provide multiple schema definition files by separating their paths with commas. This allows for complex data structures and multiple view generations. ```bash --schema-files=./schema1.json,./schema2.json ``` -------------------------------- ### SendGrid Dynamic Templates Example Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/POSTINSTALL.md Use the 'sendGrid' object in the Firestore document to specify a SendGrid 'templateId' and 'dynamicTemplateData'. This enables sending emails using pre-designed SendGrid templates. ```json { "to": ["example@example.com"], "sendGrid": { "templateId": "d-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "dynamicTemplateData": { "name": "John Doe", "company": "Example Corp", "position": "Developer" } } } ``` -------------------------------- ### Web Client Counter Increment (v9+) Source: https://github.com/firebase/extensions/blob/next/firestore-counter/POSTINSTALL.md This example demonstrates how to initialize and use the sharded counter with Firebase SDK v9+ modular API. It shows incrementing a counter and listening to its values. ```html ``` -------------------------------- ### Run Generator for Collection Group Queries Source: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/guides/GENERATE_SCHEMA_VIEWS.md Enable collection group queries by adding the `--query-collection-group` flag. This is useful for querying data across multiple collections. ```bash npx @firebaseextensions/fs-bq-schema-views \ --non-interactive \ --project=YOUR_PROJECT_ID \ --big-query-project=YOUR_BIGQUERY_PROJECT_ID \ --dataset=YOUR_DATASET_ID \ --table-name-prefix=YOUR_TABLE_PREFIX \ --schema-files=./test_schema.json \ --query-collection-group ``` -------------------------------- ### Customize JPEG and PNG Output Options Source: https://github.com/firebase/extensions/blob/next/docs/storage-resize-images/customize-output-options.md Define custom output options for multiple image formats, including JPEG quality and chroma subsampling, and PNG palette settings. Formats not specified will use default values. ```json { "jpeg": { "quality": 5, "chromaSubsampling": "4:4:4" }, "png": { "pallete": true } } ``` -------------------------------- ### Example Schema File Configuration Source: https://github.com/firebase/extensions/blob/next/docs/firestore-bigquery-export/generating-schemas.md This JSON defines the structure of your Firestore data for schema generation. It includes fields with various types like string, array, timestamp, geopoint, and nested maps. ```json { "fields": [ { "name": "name", "type": "string" }, { "name": "favorite_numbers", "type": "array" }, { "name": "last_login", "type": "timestamp" }, { "name": "last_location", "type": "geopoint" }, { "name": "geo_point", "type": "stringified_map" }, { "fields": [ { "name": "name", "type": "string" } ], "name": "friends", "type": "map" } ] } ``` -------------------------------- ### Provide Credentials for Refresh Token Script Source: https://github.com/firebase/extensions/blob/next/firestore-send-email/README.md Supply Google OAuth Client ID and Secret either as environment variables or command-line arguments when running the helper script. ```bash # Using environment variables export CLIENT_ID=your_client_id export CLIENT_SECRET=your_client_secret node oauth2-refresh-token-helper.js # Using command-line arguments node oauth2-refresh-token-helper.js --id=your_client_id --secret=your_client_secret ```