EventContext interface

イベントが発生したコンテキスト。

EventContext には次の内容が記述されます。 - イベントが発生した時刻。 - イベントの一意の識別子。 - イベントが発生したリソース (該当する場合)。 - イベントをトリガーしたリクエストの承認 (該当し、利用可能な場合)。

サイン:

export interface EventContext<Params = Record<string, string>> 

プロパティ

財産タイプ説明
認証{ トークン: オブジェクト; uid: 文字列; }関数をトリガーしたユーザーの認証情報。
認証タイプ"管理者" | "ユーザー" | 「未認証」ユーザーの権限のレベル。
イベントIDイベントの一意の識別子。
イベントタイプイベントの種類。
パラメータパラメータRealtime Database トリガーのメソッドに提供されるpathパラメーター内のワイルドカードの値を含むオブジェクト。
リソースリソースイベントを発行したリソース。
タイムスタンプRFC 3339文字列としてのイベントのタイムスタンプ。

イベントコンテキスト.auth

関数をトリガーしたユーザーの認証情報。

このオブジェクトには、認証されたユーザーのuidプロパティとtokenプロパティが含まれています。トークン キーなどの詳細については、セキュリティ ルールのリファレンスを参照してください。

このフィールドは、Realtime Database トリガーおよび呼び出し可能な関数に対してのみ入力されます。認証されていないユーザーの場合、このフィールドは null です。 Firebase 管理者ユーザーおよびユーザー情報を提供しないイベント タイプの場合、このフィールドは存在しません。

サイン:

auth?: {
        token: object;
        uid: string;
    };

EventContext.authType

ユーザーの権限のレベル。

有効な値は次のとおりです。

  • ADMIN : 開発者ユーザーまたはサービス アカウント経由で認証されたユーザー。

  • USER : 既知のユーザー。

  • UNAUTHENTICATED :認証されていないアクション

  • null : ユーザー情報を提供しないイベント タイプの場合 (Realtime Database を除くすべて)。

サイン:

authType?: "ADMIN" | "USER" | "UNAUTHENTICATED";

EventContext.eventId

イベントの一意の識別子。

サイン:

eventId: string;

EventContext.eventType

イベントの種類。

可能な値は次のとおりです。

  • google.analytics.event.log

  • google.firebase.auth.user.create

  • google.firebase.auth.user.delete

  • google.firebase.database.ref.write

  • google.firebase.database.ref.create

  • google.firebase.database.ref.update

  • google.firebase.database.ref.delete

  • google.firestore.document.write

  • google.firestore.document.create

  • google.firestore.document.update

  • google.firestore.document.delete

  • google.pubsub.topic.publish

  • google.firebase.remoteconfig.update

  • google.storage.object.finalize

  • google.storage.object.archive

  • google.storage.object.delete

  • google.storage.object.metadataUpdate

  • google.testing.testMatrix.complete

サイン:

eventType: string;

EventContext.params

Realtime Database トリガーのメソッドに提供されるpathパラメーター内のワイルドカードの値を含むオブジェクト。

サイン:

params: Params;

EventContext.リソース

イベントを発行したリソース。

有効な値は次のとおりです。

分析: projects/<projectId>/events/<analyticsEventType>

リアルタイム データベース: projects/_/instances/<databaseInstance>/refs/<databasePath>

ストレージ: projects/_/buckets/<bucketName>/objects/<fileName>#<generation>

認証: projects/<projectId>

Pub/Sub: projects/<projectId>/topics/<topicName>

Realtime Database インスタンスと Cloud Storage バケットはグローバルに一意であり、プロジェクトに関連付けられていないため、それらのリソースはprojects/_で始まります。 。アンダースコアは有効なプロジェクト名ではありません。

サイン:

resource: Resource;

EventContext.タイムスタンプ

RFC 3339文字列としてのイベントのタイムスタンプ。

サイン:

timestamp: string;