firebase-functions package

Firebase Cloud Functions 的第二代 API。此SDK支援深度導入。例如,命名空間pubsubfirebase-functions/v2中可用,或可以直接從firebase-functions/v2/pubsub導入

功能

功能描述
設定全域選項(選項)為使用第二代 SDK 編寫的所有函數設定預設選項。

課程

班級描述
改變用於更改狀態的事件的 Cloud Functions 接口,例如即時資料庫或 Cloud Firestore onWriteonUpdate事件。有關用於構造Change物件的格式的更多信息,請參閱下文。

介面

介面描述
雲端事件(測試版) CloudEventBase是用於編碼無伺服器事件的跨平台格式的基礎。有關更多信息,請參閱 https://github.com/cloudevents/spec。
雲函數(測試版) CloudEvents 的處理程序。
事件處理選項可以在任何事件處理函數上設定的附加欄位。
全域選項GlobalOptions是可以在整個專案中設定的選項。這些選項對於 HTTPS 和事件處理函數是通用的。

命名空間

命名空間描述
警報
資料庫
事件弧
火庫
https
身分
記錄器
參數
發布訂閱
遠端配置
調度程式
貯存
任務
測試實驗室

類型別名

類型別名描述
入口設置IngressSettings的可用選項清單。
記憶體選項Cloud Functions 支援的可用記憶體選項清單。
參數將所有參數擷取組對應到記錄的鍵的類型。例如,ParamsOf < “用戶/ { uid } > 是 { uid: string } ParamsOf < “用戶/ { uid } /紀錄/ {紀錄} > 是 { uid: 字串;日誌:字串 } ParamsOf < “一些/靜態/數據” > 是 { }出於靈活性原因,ParamsOf是記錄<字串,字串>
支援地區Cloud Functions(第二代)支援的所有區域的清單。
Vpc出口設定VpcConnectorEgressSettings的可用選項清單。

設定全域選項()

為使用第二代 SDK 編寫的所有函數設定預設選項。

簽名:

export declare function setGlobalOptions(options: GlobalOptions): void;

參數

範圍類型描述
選項全域選項設定為預設值的選項

返回:

空白

入口設置

IngressSettings的可用選項列表

簽名:

export type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLOW_INTERNAL_AND_GCLB";

記憶體選項

Cloud Functions 支援的可用記憶體選項清單。

簽名:

export type MemoryOption = "128MiB" | "256MiB" | "512MiB" | "1GiB" | "2GiB" | "4GiB" | "8GiB" | "16GiB" | "32GiB";

參數

將所有參數擷取組對應到記錄的鍵的類型。例如,ParamsOf < “用戶/ { uid } > 是 { uid: string } ParamsOf < “用戶/ { uid } /紀錄/ {紀錄} > 是 { uid: 字串;日誌:字串 } ParamsOf < “一些/靜態/數據” > 是 { }

出於靈活性原因,ParamsOf是記錄<字串,字串>

簽名:

export type ParamsOf<PathPattern extends string> = string extends PathPattern ? Record<string, string> : {
    [Key in Extract<Split<NullSafe<PathPattern>, "/">[number]>]: string;
};

支援地區

Cloud Functions(第二代)支援的所有區域的清單。

簽名:

export type SupportedRegion = "asia-east1" | "asia-northeast1" | "asia-northeast2" | "europe-north1" | "europe-west1" | "europe-west4" | "us-central1" | "us-east1" | "us-east4" | "us-west1" | "asia-east2" | "asia-northeast3" | "asia-southeast1" | "asia-southeast2" | "asia-south1" | "australia-southeast1" | "europe-central2" | "europe-west2" | "europe-west3" | "europe-west6" | "northamerica-northeast1" | "southamerica-east1" | "us-west2" | "us-west3" | "us-west4";

Vpc出口設定

VpcConnectorEgressSettings的可用選項列表

簽名:

export type VpcEgressSetting = "PRIVATE_RANGES_ONLY" | "ALL_TRAFFIC";