firebase-functions
- Version 6.2.0
- Published
- 897 kB
- 5 dependencies
- MIT license
Install
npm i firebase-functions
yarn add firebase-functions
pnpm add firebase-functions
Overview
The 2nd gen API for Cloud Functions for Firebase. This SDK supports deep imports. For example, the namespace pubsub
is available at firebase-functions/v2
or is directly importable from firebase-functions/v2/pubsub
.
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Namespaces
crashlytics
- CrashlyticsEvent
- CrashlyticsOptions
- Issue
- NewAnrIssuePayload
- NewFatalIssuePayload
- NewNonfatalIssuePayload
- onNewAnrIssuePublished()
- onNewFatalIssuePublished()
- onNewNonfatalIssuePublished()
- onRegressionAlertPublished()
- onStabilityDigestPublished()
- onVelocityAlertPublished()
- RegressionAlertPayload
- StabilityDigestPayload
- TrendingIssueDetails
- VelocityAlertPayload
firestore
- AuthType
- Change
- DocumentOptions
- DocumentSnapshot
- FirestoreAuthEvent
- FirestoreEvent
- onDocumentCreated()
- onDocumentCreatedWithAuthContext()
- onDocumentDeleted()
- onDocumentDeletedWithAuthContext()
- onDocumentUpdated()
- onDocumentUpdatedWithAuthContext()
- onDocumentWritten()
- onDocumentWrittenWithAuthContext()
- QueryDocumentSnapshot
Variables
variable app
const app: { setEmulatedAdminApp: typeof setEmulatedAdminApp };
Functions
function config
config: () => Record<string, any>;
Store and retrieve project configuration data such as third-party API keys or other settings. You can set configuration values using the Firebase CLI as described in https://firebase.google.com/docs/functions/config-env.
Deprecated
Using functions.config() is discouraged. See https://firebase.google.com/docs/functions/config-env.
function onInit
onInit: (callback: () => unknown) => void;
Registers a callback that should be run when in a production environment before executing any functions code. Calling this function more than once leads to undefined behavior.
Parameter callback
initialization callback to be run before any function executes.
function setGlobalOptions
setGlobalOptions: (options: GlobalOptions) => void;
Sets default options for all functions written using the 2nd gen SDK.
Parameter options
Options to set as default
Classes
class Change
class Change<T> {}
The Cloud Functions interface for events that change state, such as Realtime Database or Cloud Firestore
onWrite
andonUpdate
events.For more information about the format used to construct
Change
objects, see ChangeJson below.
constructor
constructor(before: {}, after: {});
property after
after: {};
property before
before: {};
method fromJSON
static fromJSON: <T>(json: ChangeJson, customizer?: (x: any) => T) => Change<T>;
Factory method for creating a
Change
from JSON and an optional customizer function to be applied to both thebefore
and theafter
fields.
method fromObjects
static fromObjects: <T>(before: T, after: T) => Change<T>;
Factory method for creating a
Change
from abefore
object and anafter
object.
Interfaces
interface CloudEvent
interface CloudEvent<T> {}
A
CloudEventBase
is the base of a cross-platform format for encoding a serverless event. For more information, see https://github.com/cloudevents/spec.Modifiers
@beta
property data
data: T;
Information about this specific event.
property id
id: string;
A globally unique ID for this event.
property source
source: string;
The resource that published this event.
property specversion
readonly specversion: '1.0';
Version of the CloudEvents spec for this event.
property subject
subject?: string;
The resource, provided by source, that this event relates to.
property time
time: string;
When this event occurred.
property type
type: string;
The type of event that this represents.
interface CloudFunction
interface CloudFunction<EventType extends CloudEvent<unknown>> {}
A handler for CloudEvents.
Modifiers
@beta
method run
run: (event: EventType) => any | Promise<any>;
The callback passed to the
CloudFunction
constructor. Userun
to test a function.Parameter event
The parsed event to handle.
Returns
Any return value. Cloud Functions awaits any promise before shutting down your function. Resolved return values are only used for unit testing purposes.
Modifiers
@beta
call signature
(raw: CloudEvent<unknown>): any | Promise<any>;
interface EventHandlerOptions
interface EventHandlerOptions extends Omit<GlobalOptions, 'enforceAppCheck'> {}
Additional fields that can be set on any event-handling function.
property channel
channel?: string;
The name of the channel where the function receives events.
property eventFilterPathPatterns
eventFilterPathPatterns?: Record<string, string | Expression<string>>;
TODO
property eventFilters
eventFilters?: Record<string, string | Expression<string>>;
TODO
property eventType
eventType?: string;
Type of the event. Valid values are TODO
property region
region?: string | Expression<string> | ResetValue;
Region of the EventArc trigger.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
The service account that EventArc should use to invoke this function. Requires the P4SA to have ActAs permission on this service account.
interface GlobalOptions
interface GlobalOptions {}
GlobalOptions
are options that can be set across an entire project. These options are common to HTTPS and event handling functions.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can be applied only to functions running on Cloud Functions (2nd gen)). A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Cloud Functions (1st gen). To revert to the CPU amounts used in gcloud or in Cloud Functions (1st gen), set this to the value "gcf_gen1"
property enforceAppCheck
enforceAppCheck?: boolean;
Determines whether Firebase App Check is enforced. Defaults to false.
Remarks
When true, requests with invalid tokens autorespond with a 401 (Unauthorized) error. When false, requests with invalid tokens set
event.app
toundefined
.
property ingressSettings
ingressSettings?: IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property invoker
invoker?: 'public' | 'private' | string | string[];
Invoker to set access control on HTTPS functions.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances that can be running in parallel.
property memory
memory?: MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Minimum number of actual instances to be running at a given time.
Remarks
Instances are billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property preserveExternalChanges
preserveExternalChanges?: boolean;
Controls whether function configuration modified outside of function source is preserved. Defaults to false.
Remarks
When setting configuration available in an underlying platform that is not yet available in the Firebase SDK for Cloud Functions, we recommend setting
preserveExternalChanges
totrue
. Otherwise, when Google releases a new version of the SDK with support for the missing configuration, your function's manually configured setting may inadvertently be wiped out.
property region
region?: SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a 2nd gen function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 3,600s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes).
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect a function to a specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
Type Aliases
type IngressSetting
type IngressSetting = | 'ALLOW_ALL' | 'ALLOW_INTERNAL_ONLY' | 'ALLOW_INTERNAL_AND_GCLB';
List of available options for
IngressSettings
.
type MemoryOption
type MemoryOption = | '128MiB' | '256MiB' | '512MiB' | '1GiB' | '2GiB' | '4GiB' | '8GiB' | '16GiB' | '32GiB';
List of available memory options supported by Cloud Functions.
type ParamsOf
type ParamsOf<PathPattern extends string | Expression<string>> = PathPattern extends Expression<string> ? Record<string, string> : string extends PathPattern ? Record<string, string> : { [Key in Extract< Split< NullSafe<Exclude<PathPattern, Expression<string>>>, '/' >[number] >]: string; };
A type that maps all parameter capture gropus into keys of a record. For example, ParamsOf<"users/{uid}"> is { uid: string } ParamsOf<"users/{uid}/logs/{log}"> is { uid: string; log: string } ParamsOf<"some/static/data"> is {}
For flexibility reasons, ParamsOf is Record<string, string>
type SupportedRegion
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';
List of all regions supported by Cloud Functions (2nd gen).
type VpcEgressSetting
type VpcEgressSetting = 'PRIVATE_RANGES_ONLY' | 'ALL_TRAFFIC';
List of available options for
VpcConnectorEgressSettings
.
Namespaces
namespace alerts
module 'lib/v2/providers/alerts/index.d.ts' {}
Cloud functions to handle events from Firebase Alerts. Subpackages give stronger typing to specific services which notify users via Firebase Alerts.
function onAlertPublished
onAlertPublished: { <T extends { '@type': string } = any>( alertType: AlertType, handler: (event: AlertEvent<T>) => any | Promise<any> ): CloudFunction<AlertEvent<T>>; <T extends { '@type': string } = any>( options: FirebaseAlertOptions, handler: (event: AlertEvent<T>) => any ): CloudFunction<AlertEvent<T>>;};
Declares a function that can handle Firebase Alerts from CloudEvents.
Parameter alertType
the alert type or Firebase Alert function configuration.
Parameter handler
a function that can handle the Firebase Alert inside a CloudEvent.
Returns
A function that you can export and deploy.
Declares a function that can handle Firebase Alerts from CloudEvents.
Parameter options
the alert type and other options for this cloud function.
Parameter handler
a function that can handle the Firebase Alert inside a CloudEvent.
interface AlertEvent
interface AlertEvent<T> extends CloudEvent<FirebaseAlertData<T>> {}
A custom CloudEvent for Firebase Alerts (with custom extension attributes).
property alertType
alertType: string;
The type of the alerts that got triggered.
property appId
appId?: string;
The Firebase App ID that’s associated with the alert. This is optional, and only present when the alert is targeting at a specific Firebase App.
property data
data: FirebaseAlertData<T>;
Data for an
AlertEvent
is aFirebaseAlertData
object with a given payload.
interface FirebaseAlertData
interface FirebaseAlertData<T = any> {}
The CloudEvent data emitted by Firebase Alerts.
property createTime
createTime: string;
Time that the event has created.
property endTime
endTime: string;
Time that the event has ended. Optional, only present for ongoing alerts.
property payload
payload: T;
Payload of the event, which includes the details of the specific alert.
interface FirebaseAlertOptions
interface FirebaseAlertOptions extends options.EventHandlerOptions {}
Configuration for Firebase Alert functions.
property alertType
alertType: AlertType;
Scope the handler to trigger on an alert type.
property appId
appId?: string;
Scope the function to trigger on a specific application.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once. Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function. Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from. A value of null turns off ingress settings.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel. A value of null restores the default max instances.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function. A value of null restores the defaults of 256MB.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time. Instances will be billed for memory allocation and 10% of CPU allocation while idle. A value of null restores the default min instances.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as. A value of null restores the default service account.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout. A value of null restores the default of 60s The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector. A value of null removes the VPC connector
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector. A value of null turns off VPC connector egress settings
type AlertType
type AlertType = | 'crashlytics.newFatalIssue' | 'crashlytics.newNonfatalIssue' | 'crashlytics.regression' | 'crashlytics.stabilityDigest' | 'crashlytics.velocity' | 'crashlytics.newAnrIssue' | 'billing.planUpdate' | 'billing.planAutomatedUpdate' | 'appDistribution.newTesterIosDevice' | 'appDistribution.inAppFeedback' | 'performance.threshold' | string;
The underlying alert type of the Firebase Alerts provider.
namespace appDistribution
module 'lib/v2/providers/alerts/appDistribution.d.ts' {}
Cloud functions to handle Firebase App Distribution events from Firebase Alerts.
function onInAppFeedbackPublished
onInAppFeedbackPublished: { ( handler: ( event: AppDistributionEvent<InAppFeedbackPayload> ) => any | Promise<any> ): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>; ( appId: string, handler: (event: AppDistributionEvent<InAppFeedbackPayload>) => any ): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>; ( opts: AppDistributionOptions, handler: (event: AppDistributionEvent<InAppFeedbackPayload>) => any ): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>;};
Declares a function that can handle receiving new in-app feedback from a tester.
Parameter handler
Event handler which is run every time new feedback is received.
Returns
A function that you can export and deploy.
Declares a function that can handle receiving new in-app feedback from a tester.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler which is run every time new feedback is received.
Returns
A function that you can export and deploy.
Declares a function that can handle receiving new in-app feedback from a tester.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler which is run every time new feedback is received.
Returns
A function that you can export and deploy.
function onNewTesterIosDevicePublished
onNewTesterIosDevicePublished: { ( handler: ( event: AppDistributionEvent<NewTesterDevicePayload> ) => any | Promise<any> ): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>; ( appId: string, handler: (event: AppDistributionEvent<NewTesterDevicePayload>) => any ): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>; ( opts: AppDistributionOptions, handler: (event: AppDistributionEvent<NewTesterDevicePayload>) => any ): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>;};
Declares a function that can handle adding a new tester iOS device.
Parameter handler
Event handler which is run every time a new tester iOS device is added.
Returns
A function that you can export and deploy.
Declares a function that can handle adding a new tester iOS device.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler which is run every time a new tester iOS device is added.
Returns
A function that you can export and deploy.
Declares a function that can handle adding a new tester iOS device.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler which is run every time a new tester iOS device is added.
Returns
A function that you can export and deploy.
interface AppDistributionEvent
interface AppDistributionEvent<T> extends CloudEvent<FirebaseAlertData<T>> {}
A custom CloudEvent for Firebase Alerts (with custom extension attributes).
interface AppDistributionOptions
interface AppDistributionOptions extends options.EventHandlerOptions {}
Configuration for app distribution functions.
property appId
appId?: string;
Scope the function to trigger on a specific application.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
interface InAppFeedbackPayload
interface InAppFeedbackPayload {}
The internal payload object for receiving in-app feedback from a tester. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroInAppFeedbackPayload';
property appVersion
appVersion: string;
Version consisting of
versionName
andversionCode
for Android andCFBundleShortVersionString
andCFBundleVersion
for iOS.
property feedbackConsoleUri
feedbackConsoleUri: string;
Deep link back to the Firebase console.
property feedbackReport
feedbackReport: string;
Resource name. Format:
projects/{project_number}/apps/{app_id}/releases/{release_id}/feedbackReports/{feedback_id}
property screenshotUri
screenshotUri?: string;
URI to download screenshot. This URI is fast expiring.
property testerEmail
testerEmail: string;
Email of the tester
property testerName
testerName?: string;
Name of the tester
property text
text: string;
Text entered by the tester
interface NewTesterDevicePayload
interface NewTesterDevicePayload {}
The internal payload object for adding a new tester device to app distribution. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroNewTesterIosDevicePayload';
property testerDeviceIdentifier
testerDeviceIdentifier: string;
The device ID
property testerDeviceModelName
testerDeviceModelName: string;
The device model name
property testerEmail
testerEmail: string;
Email of the tester
property testerName
testerName: string;
Name of the tester
namespace billing
module 'lib/v2/providers/alerts/billing.d.ts' {}
Cloud functions to handle billing events from Firebase Alerts.
function onPlanAutomatedUpdatePublished
onPlanAutomatedUpdatePublished: { ( handler: ( event: BillingEvent<PlanAutomatedUpdatePayload> ) => any | Promise<any> ): CloudFunction<BillingEvent<PlanAutomatedUpdatePayload>>; ( opts: options.EventHandlerOptions, handler: (event: BillingEvent<PlanAutomatedUpdatePayload>) => any ): CloudFunction<BillingEvent<PlanAutomatedUpdatePayload>>;};
Declares a function that can handle an automated billing plan update event.
Parameter handler
Event handler which is run every time an automated billing plan update occurs.
Returns
A function that you can export and deploy.
Declares a function that can handle an automated billing plan update event.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler which is run every time an automated billing plan update occurs.
Returns
A function that you can export and deploy.
function onPlanUpdatePublished
onPlanUpdatePublished: { ( handler: (event: BillingEvent<PlanUpdatePayload>) => any | Promise<any> ): CloudFunction<BillingEvent<PlanUpdatePayload>>; ( opts: options.EventHandlerOptions, handler: (event: BillingEvent<PlanUpdatePayload>) => any ): CloudFunction<BillingEvent<PlanUpdatePayload>>;};
Declares a function that can handle a billing plan update event.
Parameter handler
Event handler which is run every time a billing plan is updated.
Returns
A function that you can export and deploy.
Declares a function that can handle a billing plan update event.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler which is run every time a billing plan is updated.
Returns
A function that you can export and deploy.
interface BillingEvent
interface BillingEvent<T> extends CloudEvent<FirebaseAlertData<T>> {}
A custom CloudEvent for billing Firebase Alerts (with custom extension attributes).
property alertType
alertType: string;
The type of the alerts that got triggered.
interface PlanAutomatedUpdatePayload
interface PlanAutomatedUpdatePayload {}
The internal payload object for billing plan automated updates. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanAutomatedUpdatePayload';
property billingPlan
billingPlan: string;
A Firebase billing plan.
property notificationType
notificationType: string;
The type of the notification, e.g. upgrade, downgrade
interface PlanUpdatePayload
interface PlanUpdatePayload {}
The internal payload object for billing plan updates. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanUpdatePayload';
property billingPlan
billingPlan: string;
A Firebase billing plan.
property notificationType
notificationType: string;
The type of the notification, e.g. upgrade, downgrade
property principalEmail
principalEmail: string;
The email address of the person that triggered billing plan change
namespace crashlytics
module 'lib/v2/providers/alerts/crashlytics.d.ts' {}
Cloud functions to handle Crashlytics events from Firebase Alerts.
function onNewAnrIssuePublished
onNewAnrIssuePublished: { ( handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>; ( appId: string, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>;};
Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
Parameter handler
Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
Returns
A function that you can export and deploy.
function onNewFatalIssuePublished
onNewFatalIssuePublished: { ( handler: ( event: CrashlyticsEvent<NewFatalIssuePayload> ) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>; ( appId: string, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>;};
Declares a function that can handle a new fatal issue published to Crashlytics.
Parameter handler
Event handler that is triggered when a new fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new fatal issue published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a new fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new fatal issue published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a new fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
function onNewNonfatalIssuePublished
onNewNonfatalIssuePublished: { ( handler: ( event: CrashlyticsEvent<NewNonfatalIssuePayload> ) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>; ( appId: string, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any ): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>;};
Declares a function that can handle a new non-fatal issue published to Crashlytics.
Parameter handler
Event handler that is triggered when a new fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new non-fatal issue published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a new non-fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a new non-fatal issue published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a new non-fatal issue is published to Crashlytics.
Returns
A function that you can export and deploy.
function onRegressionAlertPublished
onRegressionAlertPublished: { ( handler: ( event: CrashlyticsEvent<RegressionAlertPayload> ) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>; ( appId: string, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any ): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any ): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>;};
Declares a function that can handle a regression alert published to Crashlytics.
Parameter handler
Event handler that is triggered when a regression alert is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a regression alert published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a regression alert is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a regression alert published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a regression alert is published to Crashlytics.
Returns
A function that you can export and deploy.
function onStabilityDigestPublished
onStabilityDigestPublished: { ( handler: ( event: CrashlyticsEvent<StabilityDigestPayload> ) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>; ( appId: string, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any ): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any ): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>;};
Declares a function that can handle a stability digest published to Crashlytics.
Parameter handler
Event handler that is triggered when a stability digest is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a stability digest published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a stability digest is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a stability digest published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a stability digest is published to Crashlytics.
Returns
A function that you can export and deploy.
function onVelocityAlertPublished
onVelocityAlertPublished: { ( handler: ( event: CrashlyticsEvent<VelocityAlertPayload> ) => any | Promise<any> ): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>; ( appId: string, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any ): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>; ( opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any ): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>;};
Declares a function that can handle a velocity alert published to Crashlytics.
Parameter handler
Event handler that is triggered when a velocity alert is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a velocity alert published to Crashlytics.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler that is triggered when a velocity alert is published to Crashlytics.
Returns
A function that you can export and deploy.
Declares a function that can handle a velocity alert published to Crashlytics.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler that is triggered when a velocity alert is published to Crashlytics.
Returns
A function that you can export and deploy.
interface CrashlyticsEvent
interface CrashlyticsEvent<T> extends CloudEvent<FirebaseAlertData<T>> {}
A custom CloudEvent for Firebase Alerts (with custom extension attributes).
interface CrashlyticsOptions
interface CrashlyticsOptions extends options.EventHandlerOptions {}
Configuration for Crashlytics functions.
property appId
appId?: string;
Scope the function to trigger on a specific application.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
interface Issue
interface Issue {}
Generic Crashlytics issue interface
property appVersion
appVersion: string;
The application version of the Crashlytics issue
property id
id: string;
The ID of the Crashlytics issue
property subtitle
subtitle: string;
The subtitle of the Crashlytics issue
property title
title: string;
The title of the Crashlytics issue
interface NewAnrIssuePayload
interface NewAnrIssuePayload {}
The internal payload object for a new Application Not Responding issue. Payload is wrapped inside a
FirebaseAlertData
object.
interface NewFatalIssuePayload
interface NewFatalIssuePayload {}
The internal payload object for a new fatal issue. Payload is wrapped inside a
FirebaseAlertData
object.
interface NewNonfatalIssuePayload
interface NewNonfatalIssuePayload {}
The internal payload object for a new non-fatal issue. Payload is wrapped inside a
FirebaseAlertData
object.
interface RegressionAlertPayload
interface RegressionAlertPayload {}
The internal payload object for a regression alert. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsRegressionAlertPayload';
property issue
issue: Issue;
Basic information of the Crashlytics issue
property resolveTime
resolveTime: string;
The time that the Crashlytics issues was most recently resolved before it began to reoccur.
property type
type: string;
The type of the Crashlytics issue, e.g. new fatal, new nonfatal, ANR
interface StabilityDigestPayload
interface StabilityDigestPayload {}
The internal payload object for a stability digest. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsStabilityDigestPayload';
property digestDate
digestDate: string;
The date that the digest gets created. Issues in the digest should have the same date as the digest date
property trendingIssues
trendingIssues: TrendingIssueDetails[];
A stability digest containing several trending Crashlytics issues
interface TrendingIssueDetails
interface TrendingIssueDetails {}
Generic Crashlytics trending issue interface
property eventCount
eventCount: number;
The number of crashes that occurred with the issue
property issue
issue: Issue;
Basic information of the Crashlytics issue
property type
type: string;
The type of the Crashlytics issue, e.g. new fatal, new nonfatal, ANR
property userCount
userCount: number;
The number of distinct users that were affected by the issue
interface VelocityAlertPayload
interface VelocityAlertPayload {}
The internal payload object for a velocity alert. Payload is wrapped inside a
FirebaseAlertData
object.
property ["@type"]
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsVelocityAlertPayload';
property crashCount
crashCount: number;
The number of user sessions for the given app version that had this specific crash issue in the time period used to trigger the velocity alert.
property crashPercentage
crashPercentage: number;
The percentage of user sessions for the given app version that had this specific crash issue in the time period used to trigger the velocity alert.
property createTime
createTime: string;
The time that the Crashlytics issue gets created
property firstVersion
firstVersion: string;
The first app version where this issue was seen, and not necessarily the version that has triggered the alert.
property issue
issue: Issue;
Basic information of the Crashlytics issue
namespace performance
module 'lib/v2/providers/alerts/performance.d.ts' {}
The internal payload object for a performance threshold alert. Payload is wrapped inside a FirebaseAlertData object.
function onThresholdAlertPublished
onThresholdAlertPublished: { ( handler: ( event: PerformanceEvent<ThresholdAlertPayload> ) => any | Promise<any> ): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>; ( appId: string, handler: (event: PerformanceEvent<ThresholdAlertPayload>) => any ): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>; ( opts: PerformanceOptions, handler: (event: PerformanceEvent<ThresholdAlertPayload>) => any ): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>;};
Declares a function that can handle receiving performance threshold alerts.
Parameter handler
Event handler which is run every time a threshold alert is received.
Returns
A function that you can export and deploy.
Declares a function that can handle receiving performance threshold alerts.
Parameter appId
A specific application the handler will trigger on.
Parameter handler
Event handler which is run every time a threshold alert is received.
Returns
A function that you can export and deploy.
Declares a function that can handle receiving performance threshold alerts.
Parameter opts
Options that can be set on the function.
Parameter handler
Event handler which is run every time a threshold alert is received.
Returns
A function that you can export and deploy.
interface PerformanceEvent
interface PerformanceEvent<T> extends CloudEvent<FirebaseAlertData<T>> {}
A custom CloudEvent for Firebase Alerts (with custom extension attributes).
interface PerformanceOptions
interface PerformanceOptions extends EventHandlerOptions {}
Configuration for app distribution functions.
property appId
appId?: string;
Scope the function to trigger on a specific application.
interface ThresholdAlertPayload
interface ThresholdAlertPayload {}
The internal payload object for a performance threshold alert. Payload is wrapped inside a FirebaseAlertData object.
property appVersion
appVersion?: string;
The app version this alert was triggered for, can be omitted if the alert is for a network request (because the alert was checked against data from all versions of app) or a web app (where the app is versionless)
property conditionPercentile
conditionPercentile?: number;
The percentile of the alert condition, can be 0 if percentile is not applicable to the alert condition and omitted; range: [1, 100]
property eventName
eventName: string;
Name of the trace or network request this alert is for (e.g. my_custom_trace, firebase.com/api/123)
property eventType
eventType: string;
The resource type this alert is for (i.e. trace, network request, screen rendering, etc.)
property investigateUri
investigateUri: string;
The link to Fireconsole to investigate more into this alert
property metricType
metricType: string;
The metric type this alert is for (i.e. success rate, response time, duration, etc.)
property numSamples
numSamples: number;
The number of events checked for this alert condition
property thresholdUnit
thresholdUnit: string;
The unit for the alert threshold (e.g. "percent", "seconds")
property thresholdValue
thresholdValue: number;
The threshold value of the alert condition without units (e.g. "75", "2.1")
property violationUnit
violationUnit: string;
The unit for the violation value (e.g. "percent", "seconds")
property violationValue
violationValue: number;
The value that violated the alert condition (e.g. "76.5", "3")
namespace database
module 'lib/v2/providers/database.d.ts' {}
function onValueCreated
onValueCreated: { <Ref extends string>( ref: Ref, handler: ( event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> ) => any | Promise<any> ): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>; <Ref extends string>( opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any ): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;};
Event handler which triggers when data is created in Realtime Database.
Parameter reference
The database reference path to trigger on.
Parameter handler
Event handler which is run every time a Realtime Database create occurs.
Event handler which triggers when data is created in Realtime Database.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Realtime Database create occurs.
function onValueDeleted
onValueDeleted: { <Ref extends string>( ref: Ref, handler: ( event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> ) => any | Promise<any> ): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>; <Ref extends string>( opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any ): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;};
Event handler which triggers when data is deleted in Realtime Database.
Parameter reference
The database reference path to trigger on.
Parameter handler
Event handler which is run every time a Realtime Database deletion occurs.
Event handler which triggers when data is deleted in Realtime Database.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Realtime Database deletion occurs.
function onValueUpdated
onValueUpdated: { <Ref extends string>( ref: Ref, handler: ( event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> ) => any | Promise<any> ): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>; <Ref extends string>( opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any ): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;};
Event handler which triggers when data is updated in Realtime Database.
Parameter reference
The database reference path to trigger on.
Parameter handler
Event handler which is run every time a Realtime Database update occurs.
Event handler which triggers when data is updated in Realtime Database.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Realtime Database update occurs.
function onValueWritten
onValueWritten: { <Ref extends string>( ref: Ref, handler: ( event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> ) => any | Promise<any> ): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>; <Ref extends string>( opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any ): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;};
Event handler which triggers when data is created, updated, or deleted in Realtime Database.
Parameter reference
The database reference path to trigger on.
Parameter handler
Event handler which is run every time a Realtime Database create, update, or delete occurs.
Event handler which triggers when data is created, updated, or deleted in Realtime Database.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Realtime Database create, update, or delete occurs.
class DataSnapshot
class DataSnapshot implements database.DataSnapshot {}
Interface representing a Firebase Realtime database data snapshot.
constructor
constructor(data: any, path?: string, app?: App, instance?: string);
property instance
instance: string;
property key
readonly key: string;
The key (last part of the path) of the location of this
DataSnapshot
.The last token in a database location is considered its key. For example, "ada" is the key for the
/users/ada/
node. Accessing the key on anyDataSnapshot
returns the key for the location that generated it. However, accessing the key on the root URL of a database returnsnull
.
property ref
readonly ref: database.Reference;
Returns a [
Reference
](/docs/reference/admin/node/admin.database.Reference) to the database location where the triggering write occurred. Has full read and write access.
method child
child: (childPath: string) => DataSnapshot;
Gets a
DataSnapshot
for the location at the specified relative path.The relative path can either be a simple child name (for example, "ada") or a deeper slash-separated path (for example, "ada/name/first").
Parameter path
A relative path from this location to the desired child location. The specified child location.
method exists
exists: () => boolean;
Returns
true
if thisDataSnapshot
contains any data. It is slightly more efficient than usingsnapshot.val() !== null
.true
if thisDataSnapshot
contains any data; otherwise,false
.
method exportVal
exportVal: () => any;
Exports the entire contents of the
DataSnapshot
as a JavaScript object.The contents of the
DataSnapshot
as a JavaScript value (Object, Array, string, number, boolean, ornull
).
method forEach
forEach: (action: (a: IteratedDataSnapshot) => boolean | void) => boolean;
Enumerates the
DataSnapshot
s of the children items.Because of the way JavaScript objects work, the ordering of data in the JavaScript object returned by
val()
is not guaranteed to match the ordering on the server nor the ordering ofchild_added
events. That is whereforEach()
comes in handy. It guarantees the children of aDataSnapshot
can be iterated in their query order.If no explicit
orderBy*()
method is used, results are returned ordered by key (unless priorities are used, in which case, results are returned by priority).Parameter action
A function that is called for each child
DataSnapshot
. The callback can returntrue
to cancel further enumeration.true
if enumeration was canceled due to your callback returningtrue
.
method getPriority
getPriority: () => string | number | null;
Gets the priority value of the data in this
DataSnapshot
.As an alternative to using priority, applications can order collections by ordinary properties. See [Sorting and filtering data](/docs/database/web/lists-of-data#sorting_and_filtering_data).
The priority value of the data.
method hasChild
hasChild: (childPath: string) => boolean;
Returns
true
if the specified child path has (non-null
) data.Parameter path
A relative path to the location of a potential child.
true
if data exists at the specified child path; otherwise,false
.
method hasChildren
hasChildren: () => boolean;
Returns whether or not the
DataSnapshot
has any non-null
child properties.You can use
hasChildren()
to determine if aDataSnapshot
has any children. If it does, you can enumerate them usingforEach()
. If it doesn't, then either this snapshot contains a primitive value (which can be retrieved withval()
) or it is empty (in which case,val()
returnsnull
).true
if this snapshot has any children; elsefalse
.
method numChildren
numChildren: () => number;
Returns the number of child properties of this
DataSnapshot
.Number of child properties of this
DataSnapshot
.
method toJSON
toJSON: () => Record<string, unknown>;
Returns a JSON-serializable representation of this object.
A JSON-serializable representation of this object.
method val
val: () => any;
Extracts a JavaScript value from a
DataSnapshot
.Depending on the data in a
DataSnapshot
, theval()
method may return a scalar type (string, number, or boolean), an array, or an object. It may also returnnull
, indicating that theDataSnapshot
is empty (contains no data).The snapshot's contents as a JavaScript value (Object, Array, string, number, boolean, or
null
).
interface DatabaseEvent
interface DatabaseEvent<T, Params = Record<string, string>> extends CloudEvent<T> {}
A CloudEvent that contains a DataSnapshot or a Change
property firebaseDatabaseHost
firebaseDatabaseHost: string;
The domain of the database instance
property instance
instance: string;
The instance ID portion of the fully qualified resource name
property location
location: string;
The location of the database
property params
params: Params;
An object containing the values of the path patterns. Only named capture groups will be populated - {key}, {key=*}, {key=**}
property ref
ref: string;
The database reference path
interface RawRTDBCloudEvent
interface RawRTDBCloudEvent extends CloudEvent<RawRTDBCloudEventData> {}
property firebasedatabasehost
firebasedatabasehost: string;
property instance
instance: string;
property location
location: string;
property ref
ref: string;
interface RawRTDBCloudEventData
interface RawRTDBCloudEventData {}
interface ReferenceOptions
interface ReferenceOptions<Ref extends string = string> extends options.EventHandlerOptions {}
ReferenceOptions extend EventHandlerOptions with provided ref and optional instance
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property instance
instance?: string;
Specify the handler to trigger on a database instance(s). If present, this value can either be a single instance or a pattern. Examples: 'my-instance-1', 'my-instance-*' Note: The capture syntax cannot be used for 'instance'.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property ref
ref: Ref;
Specify the handler to trigger on a database reference(s). This value can either be a single reference or a pattern. Examples: '/foo/bar', '/foo/{bar}'
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 3,600s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
namespace eventarc
module 'lib/v2/providers/eventarc.d.ts' {}
Options that can be set on an Eventarc trigger.
function onCustomEventPublished
onCustomEventPublished: { <T = any>( eventType: string, handler: (event: CloudEvent<T>) => any | Promise<any> ): CloudFunction<CloudEvent<T>>; <T = any>( opts: EventarcTriggerOptions, handler: (event: CloudEvent<T>) => any ): CloudFunction<CloudEvent<T>>;};
Handles an Eventarc event published on the default channel.
Parameter eventType
Type of the event to trigger on.
Parameter handler
A function to execute when triggered.
Returns
A function that you can export and deploy.
Handles an Eventarc event.
Parameter opts
Options to set on this function
Parameter handler
A function to execute when triggered.
Returns
A function that you can export and deploy.
interface EventarcTriggerOptions
interface EventarcTriggerOptions extends options.EventHandlerOptions {}
Options that can be set on an Eventarc trigger.
property channel
channel?: string;
ID of the channel. Can be either: * fully qualified channel resource name:
projects/{project}/locations/{location}/channels/{channel-id}
* partial resource name with location and channel ID, in which case the runtime project ID of the function will be used:locations/{location}/channels/{channel-id}
* partial channel ID, in which case the runtime project ID of the function andus-central1
as location will be used:{channel-id}
If not specified, the default Firebase channel will be used:
projects/{project}/locations/us-central1/channels/firebase
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property eventType
eventType: string;
Type of the event to trigger on.
property filters
filters?: Record<string, string>;
Eventarc event exact match filter.
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
namespace firestore
module 'lib/v2/providers/firestore.d.ts' {}
A Firestore DocumentSnapshot
function onDocumentCreated
onDocumentCreated: { <Document extends string>( document: Document, handler: ( event: FirestoreEvent< QueryDocumentSnapshot | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<any, ParamsOf<Document>>) => any ): CloudFunction<FirestoreEvent<any, ParamsOf<Document>>>;};
Event handler that triggers when a document is created in Firestore.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore create occurs.
Event handler that triggers when a document is created in Firestore.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore create occurs.
function onDocumentCreatedWithAuthContext
onDocumentCreatedWithAuthContext: { <Document extends string>( document: Document, handler: ( event: FirestoreAuthEvent< QueryDocumentSnapshot | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<any, ParamsOf<Document>>) => any ): CloudFunction<FirestoreAuthEvent<any, ParamsOf<Document>>>;};
Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore create occurs.
Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore create occurs.
function onDocumentDeleted
onDocumentDeleted: { <Document extends string>( document: Document, handler: ( event: FirestoreEvent< QueryDocumentSnapshot | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<any, ParamsOf<Document>>) => any ): CloudFunction<FirestoreEvent<any, ParamsOf<Document>>>;};
Event handler that triggers when a document is deleted in Firestore.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore delete occurs.
Event handler that triggers when a document is deleted in Firestore.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore delete occurs.
function onDocumentDeletedWithAuthContext
onDocumentDeletedWithAuthContext: { <Document extends string>( document: Document, handler: ( event: FirestoreAuthEvent< QueryDocumentSnapshot | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<any, ParamsOf<Document>>) => any ): CloudFunction<FirestoreAuthEvent<any, ParamsOf<Document>>>;};
Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore delete occurs.
Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore delete occurs.
function onDocumentUpdated
onDocumentUpdated: { <Document extends string>( document: Document, handler: ( event: FirestoreEvent< Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: ( event: FirestoreEvent< Change<firestore.QueryDocumentSnapshot>, ParamsOf<Document> > ) => any ): CloudFunction< FirestoreEvent<Change<firestore.QueryDocumentSnapshot>, ParamsOf<Document>> >;};
Event handler that triggers when a document is updated in Firestore.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore update occurs.
Event handler that triggers when a document is updated in Firestore.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore update occurs.
function onDocumentUpdatedWithAuthContext
onDocumentUpdatedWithAuthContext: { <Document extends string>( document: Document, handler: ( event: FirestoreAuthEvent< Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreAuthEvent< Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document> > >; <Document extends string>( opts: DocumentOptions<Document>, handler: ( event: FirestoreAuthEvent< Change<firestore.QueryDocumentSnapshot>, ParamsOf<Document> > ) => any ): CloudFunction< FirestoreAuthEvent< Change<firestore.QueryDocumentSnapshot>, ParamsOf<Document> > >;};
Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore update occurs.
Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore update occurs.
function onDocumentWritten
onDocumentWritten: { <Document extends string>( document: Document, handler: ( event: FirestoreEvent< Change<DocumentSnapshot> | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: ( event: FirestoreEvent< Change<firestore.DocumentSnapshot>, ParamsOf<Document> > ) => any ): CloudFunction< FirestoreEvent<Change<firestore.DocumentSnapshot>, ParamsOf<Document>> >;};
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore create, update, or delete occurs.
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore create, update, or delete occurs.
function onDocumentWrittenWithAuthContext
onDocumentWrittenWithAuthContext: { <Document extends string>( document: Document, handler: ( event: FirestoreAuthEvent< Change<DocumentSnapshot> | undefined, ParamsOf<Document> > ) => any | Promise<any> ): CloudFunction< FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> >; <Document extends string>( opts: DocumentOptions<Document>, handler: ( event: FirestoreAuthEvent< Change<firestore.DocumentSnapshot>, ParamsOf<Document> > ) => any ): CloudFunction< FirestoreAuthEvent<Change<firestore.DocumentSnapshot>, ParamsOf<Document>> >;};
Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter document
The Firestore document path to trigger on.
Parameter handler
Event handler which is run every time a Firestore create, update, or delete occurs.
Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firestore create, update, or delete occurs.
class Change
class Change<T> {}
The Cloud Functions interface for events that change state, such as Realtime Database or Cloud Firestore
onWrite
andonUpdate
events.For more information about the format used to construct
Change
objects, see ChangeJson below.
constructor
constructor(before: {}, after: {});
property after
after: {};
property before
before: {};
method fromJSON
static fromJSON: <T>(json: ChangeJson, customizer?: (x: any) => T) => Change<T>;
Factory method for creating a
Change
from JSON and an optional customizer function to be applied to both thebefore
and theafter
fields.
method fromObjects
static fromObjects: <T>(before: T, after: T) => Change<T>;
Factory method for creating a
Change
from abefore
object and anafter
object.
interface DocumentOptions
interface DocumentOptions<Document extends string = string> extends EventHandlerOptions {}
DocumentOptions extend EventHandlerOptions with provided document and optional database and namespace.
interface FirestoreAuthEvent
interface FirestoreAuthEvent<T, Params = Record<string, string>> extends FirestoreEvent<T, Params> {}
interface FirestoreEvent
interface FirestoreEvent<T, Params = Record<string, string>> extends CloudEvent<T> {}
A CloudEvent that contains a DocumentSnapshot or a Change
property database
database: string;
The Firestore database
property document
document: string;
The document path
property location
location: string;
The location of the Firestore instance
property namespace
namespace: string;
The Firestore namespace
property params
params: Params;
An object containing the values of the path patterns. Only named capture groups will be populated - {key}, {key=*}, {key=**}
property project
project: string;
The project identifier
type AuthType
type AuthType = | 'service_account' | 'api_key' | 'system' | 'unauthenticated' | 'unknown';
AuthType defines the possible values for the authType field in a Firestore event with auth context. - service_account: a non-user principal used to identify a workload or machine user. - api_key: a non-user client API key. - system: an obscured identity used when Cloud Platform or another system triggered the event. Examples include a database record which was deleted based on a TTL. - unauthenticated: an unauthenticated action. - unknown: a general type to capture all other principals not captured in the other auth types.
type DocumentSnapshot
type DocumentSnapshot = firestore.DocumentSnapshot;
A Firestore DocumentSnapshot
type QueryDocumentSnapshot
type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;
A Firestore QueryDocumentSnapshot
namespace https
module 'lib/v2/providers/https.d.ts' {}
Options that can be set on an onRequest HTTPS function.
function hasClaim
hasClaim: (claim: string, value?: string) => (auth: AuthData | null) => boolean;
An auth policy that requires a user to be both signed in and have a specific claim (optionally with a specific value)
function isSignedIn
isSignedIn: () => (auth: AuthData | null) => boolean;
An auth policy that requires a user to be signed in.
function onCall
onCall: { <T = any, Return = any, Stream = unknown>( opts: CallableOptions<T>, handler: ( request: CallableRequest<T>, response?: CallableResponse<Stream> ) => Return ): CallableFunction< T, Return extends Promise<unknown> ? Return : Promise<Return>, Stream >; <T = any, Return = any, Stream = unknown>( handler: ( request: CallableRequest<T>, response?: CallableResponse<Stream> ) => Return ): CallableFunction< T, Return extends Promise<unknown> ? Return : Promise<Return>, unknown >;};
Declares a callable method for clients to call using a Firebase SDK.
Parameter opts
Options to set on this function.
Parameter handler
A function that takes a https.CallableRequest.
Returns
A function that you can export and deploy.
Declares a callable method for clients to call using a Firebase SDK.
Parameter handler
A function that takes a https.CallableRequest.
Returns
A function that you can export and deploy.
function onRequest
onRequest: { ( opts: HttpsOptions, handler: ( request: Request, response: express.Response ) => void | Promise<void> ): HttpsFunction; ( handler: ( request: Request, response: express.Response ) => void | Promise<void> ): HttpsFunction;};
Handles HTTPS requests.
Parameter opts
Options to set on this function
Parameter handler
A function that takes a https.Request and response object, same signature as an Express app.
Returns
A function that you can export and deploy.
Handles HTTPS requests.
Parameter handler
A function that takes a https.Request and response object, same signature as an Express app.
Returns
A function that you can export and deploy.
class HttpsError
class HttpsError extends Error {}
An explicit error that can be thrown from a handler to send an error to the client that called the function.
constructor
constructor(code: FunctionsErrorCode, message: string, details?: {});
property code
readonly code: FunctionsErrorCode;
A standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto.
property details
readonly details: {};
Extra data to be converted to JSON and included in the error response.
property httpErrorCode
readonly httpErrorCode: HttpErrorCode;
A wire format representation of a provided error code.
method toJSON
toJSON: () => HttpErrorWireFormat;
Returns a JSON-serializable representation of this object.
interface CallableFunction
interface CallableFunction<T, Return, Stream = unknown> extends HttpsFunction {}
Creates a callable method for clients to call using a Firebase SDK.
method run
run: (request: CallableRequest<T>) => Return;
Executes the handler function with the provided data as input. Used for unit testing.
Parameter data
An input for the handler function.
Returns
The output of the handler function.
method stream
stream: ( request: CallableRequest<T>, response: CallableResponse<Stream>) => { stream: AsyncIterator<Stream>; output: Return };
interface CallableOptions
interface CallableOptions<T = any> extends HttpsOptions {}
Options that can be set on a callable HTTPS function.
property authPolicy
authPolicy?: (auth: AuthData | null, data: T) => boolean | Promise<boolean>;
Callback for whether a request is authorized.
Designed to allow reusable auth policies to be passed as an options object. Two built-in reusable policies exist: isSignedIn and hasClaim.
property consumeAppCheckToken
consumeAppCheckToken?: boolean;
Determines whether Firebase App Check token is consumed on request. Defaults to false.
Remarks
Set this to true to enable the App Check replay protection feature by consuming the App Check token on callable request. Tokens that are found to be already consumed will have request.app.alreadyConsumed property set true.
Tokens are only considered to be consumed if it is sent to the App Check service by setting this option to true. Other uses of the token do not consume it.
This replay protection feature requires an additional network call to the App Check backend and forces the clients to obtain a fresh attestation from the chosen attestation providers. This can therefore negatively impact performance and can potentially deplete your attestation providers' quotas faster. Use this feature only for protecting low volume, security critical, or expensive operations.
This option does not affect the enforceAppCheck option. Setting the latter to true will cause the callable function to automatically respond with a 401 Unauthorized status code when request includes an invalid App Check token. When request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead, the request.app.alreadyConsumed property will be set to true and pass the execution to the handler code for making further decisions, such as requiring additional security checks or rejecting the request.
property enforceAppCheck
enforceAppCheck?: boolean;
Determines whether Firebase AppCheck is enforced. When true, requests with invalid tokens autorespond with a 401 (Unauthorized) error. When false, requests with invalid tokens set event.app to undefiend.
property heartbeatSeconds
heartbeatSeconds?: number | null;
Time in seconds between sending heartbeat messages to keep the connection alive. Set to
null
to disable heartbeats.Defaults to 30 seconds.
interface CallableRequest
interface CallableRequest<T = any> {}
The request used to call a callable function.
property acceptsStreaming
acceptsStreaming: boolean;
Whether this is a streaming request. Code can be optimized by not trying to generate a stream of chunks to call response.sendChunk on if request.acceptsStreaming is false. It is always safe, however, to call response.sendChunk as this will noop if acceptsStreaming is false.
property app
app?: AppCheckData;
The result of decoding and verifying a Firebase AppCheck token.
property auth
auth?: AuthData;
The result of decoding and verifying a Firebase Auth ID token.
property data
data: T;
The parameters used by a client when calling this function.
property instanceIdToken
instanceIdToken?: string;
An unverified token for a Firebase Instance ID.
property rawRequest
rawRequest: Request;
The raw request handled by the callable.
interface HttpsOptions
interface HttpsOptions extends Omit<GlobalOptions, 'region' | 'enforceAppCheck'> {}
Options that can be set on an onRequest HTTPS function.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cors
cors?: string | boolean | RegExp | Array<string | RegExp>;
If true, allows CORS on requests to this function. If this is a
string
orRegExp
, allows requests from domains that match the provided value. If this is anArray
, allows requests from domains matching at least one entry of the array. Defaults to true for https.CallableFunction and false otherwise.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property invoker
invoker?: 'public' | 'private' | string | string[];
Invoker to set access control on https functions.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: | SupportedRegion | string | Array<SupportedRegion | string> | Expression<string> | ResetValue;
HTTP functions can override global options and can specify multiple regions to deploy to.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
interface Request
interface Request extends express.Request {}
An express request with the wire format representation of the request body.
property rawBody
rawBody: Buffer;
The wire format representation of the request body.
type FunctionsErrorCode
type FunctionsErrorCode = | 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
The set of Firebase Functions status codes. The codes are the same at the ones exposed by gRPC.
Remarks
Possible values:
-
cancelled
: The operation was cancelled (typically by the caller).-
unknown
: Unknown error or an error from a different error domain.-
invalid-argument
: Client specified an invalid argument. Note that this differs fromfailed-precondition
.invalid-argument
indicates arguments that are problematic regardless of the state of the system (e.g. an invalid field name).-
deadline-exceeded
: Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.-
not-found
: Some requested document was not found.-
already-exists
: Some document that we attempted to create already exists.-
permission-denied
: The caller does not have permission to execute the specified operation.-
resource-exhausted
: Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.-
failed-precondition
: Operation was rejected because the system is not in a state required for the operation's execution.-
aborted
: The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.-
out-of-range
: Operation was attempted past the valid range.-
unimplemented
: Operation is not implemented or not supported/enabled.-
internal
: Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.-
unavailable
: The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.-
data-loss
: Unrecoverable data loss or corruption.-
unauthenticated
: The request does not have valid authentication credentials for the operation.
type HttpsFunction
type HttpsFunction = (( /** An Express request object representing the HTTPS call to the function. */ req: Request, /** An Express response object, for this function to respond to callers. */ res: express.Response) => void | Promise<void>) & { /** @alpha */ __trigger?: unknown; /** @alpha */ __endpoint: ManifestEndpoint;};
Handles HTTPS requests.
namespace identity
module 'lib/v2/providers/identity.d.ts' {}
Cloud functions to handle events from Google Cloud Identity Platform.
function beforeEmailSent
beforeEmailSent: { ( handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeEmailResponse | void> ): BlockingFunction; ( opts: Omit<BlockingOptions, 'idToken' | 'accessToken' | 'refreshToken'>, handler: (event: AuthBlockingEvent) => MaybeAsync<void | BeforeEmailResponse> ): BlockingFunction;};
Handles an event that is triggered before an email is sent to a user.
Parameter handler
Event handler that is run before an email is sent to a user.
Handles an event that is triggered before an email is sent to a user.
Parameter opts
Object containing function options.
Parameter handler
Event handler that is run before an email is sent to a user.
function beforeOperation
beforeOperation: ( eventType: AuthBlockingEventType, optsOrHandler: | BlockingOptions | (( event: AuthBlockingEvent ) => MaybeAsync< | BeforeCreateResponse | BeforeSignInResponse | BeforeEmailResponse | BeforeSmsResponse | void >), handler: HandlerV2) => BlockingFunction;
function beforeSmsSent
beforeSmsSent: { ( handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeSmsResponse | void> ): BlockingFunction; ( opts: Omit<BlockingOptions, 'idToken' | 'accessToken' | 'refreshToken'>, handler: (event: AuthBlockingEvent) => MaybeAsync<void | BeforeSmsResponse> ): BlockingFunction;};
Handles an event that is triggered before an SMS is sent to a user.
Parameter handler
Event handler that is run before an SMS is sent to a user.
Handles an event that is triggered before an SMS is sent to a user.
Parameter opts
Object containing function options.
Parameter handler
Event handler that is run before an SMS is sent to a user.
function beforeUserCreated
beforeUserCreated: { ( handler: ( event: AuthBlockingEvent ) => MaybeAsync<BeforeCreateResponse | void> ): BlockingFunction; ( opts: BlockingOptions, handler: ( event: AuthBlockingEvent ) => MaybeAsync<void | BeforeCreateResponse> ): BlockingFunction;};
Handles an event that is triggered before a user is created.
Parameter handler
Event handler which is run every time before a user is created.
Handles an event that is triggered before a user is created.
Parameter opts
Object containing function options.
Parameter handler
Event handler which is run every time before a user is created.
function beforeUserSignedIn
beforeUserSignedIn: { ( handler: ( event: AuthBlockingEvent ) => MaybeAsync<BeforeSignInResponse | void> ): BlockingFunction; ( opts: BlockingOptions, handler: ( event: AuthBlockingEvent ) => MaybeAsync<void | BeforeSignInResponse> ): BlockingFunction;};
Handles an event that is triggered before a user is signed in.
Parameter handler
Event handler which is run every time before a user is signed in.
Handles an event that is triggered before a user is signed in.
Parameter opts
Object containing function options.
Parameter handler
Event handler which is run every time before a user is signed in.
function getOpts
getOpts: (blockingOptions: BlockingOptions) => InternalOptions;
class HttpsError
class HttpsError extends Error {}
An explicit error that can be thrown from a handler to send an error to the client that called the function.
constructor
constructor(code: FunctionsErrorCode, message: string, details?: {});
property code
readonly code: FunctionsErrorCode;
A standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto.
property details
readonly details: {};
Extra data to be converted to JSON and included in the error response.
property httpErrorCode
readonly httpErrorCode: HttpErrorCode;
A wire format representation of a provided error code.
method toJSON
toJSON: () => HttpErrorWireFormat;
Returns a JSON-serializable representation of this object.
interface AuthBlockingEvent
interface AuthBlockingEvent extends AuthEventContext {}
Defines the auth event for 2nd gen blocking events
property data
data?: AuthUserRecord;
interface AuthUserRecord
interface AuthUserRecord {}
The
UserRecord
passed to auth blocking functions from the identity platform.
property customClaims
customClaims?: Record<string, any>;
The user's custom claims object if available, typically used to define user roles and propagated to an authenticated user's ID token.
property disabled
disabled: boolean;
Whether or not the user is disabled:
true
for disabled;false
for enabled.
property displayName
displayName?: string;
The user's display name.
property email
email?: string;
The user's primary email, if set.
property emailVerified
emailVerified: boolean;
Whether or not the user's primary email is verified.
property metadata
metadata: AuthUserMetadata;
Additional metadata about the user.
property multiFactor
multiFactor?: AuthMultiFactorSettings;
The multi-factor related properties for the current user, if available.
property passwordHash
passwordHash?: string;
The user's hashed password (base64-encoded).
property passwordSalt
passwordSalt?: string;
The user's password salt (base64-encoded).
property phoneNumber
phoneNumber?: string;
The user's primary phone number, if set.
property photoURL
photoURL?: string;
The user's photo URL.
property providerData
providerData: AuthUserInfo[];
An array of providers (for example, Google, Facebook) linked to the user.
property tenantId
tenantId?: string | null;
The ID of the tenant the user belongs to, if available.
property tokensValidAfterTime
tokensValidAfterTime?: string;
The date the user's tokens are valid after, formatted as a UTC string.
property uid
uid: string;
The user's
uid
.
interface BlockingOptions
interface BlockingOptions {}
All function options plus idToken, accessToken, and refreshToken.
property accessToken
accessToken?: boolean;
Pass the Access Token credential to the function.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property idToken
idToken?: boolean;
Pass the ID Token credential to the function.
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property refreshToken
refreshToken?: boolean;
Pass the Refresh Token credential to the function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
namespace logger
module 'lib/logger/index.d.ts' {}
LogSeverity
indicates the detailed severity of the log entry. See [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity).Modifiers
@public
function debug
debug: (...args: any[]) => void;
Writes a
DEBUG
severity log. If the last argument provided is a plain object, it is added to thejsonPayload
in the Cloud Logging entry.Parameter args
Arguments, concatenated into the log message with space separators.
Modifiers
@public
function error
error: (...args: any[]) => void;
Writes an
ERROR
severity log. If the last argument provided is a plain object, it is added to thejsonPayload
in the Cloud Logging entry.Parameter args
Arguments, concatenated into the log message with space separators.
Modifiers
@public
function info
info: (...args: any[]) => void;
Writes an
INFO
severity log. If the last argument provided is a plain object, it is added to thejsonPayload
in the Cloud Logging entry.Parameter args
Arguments, concatenated into the log message with space separators.
Modifiers
@public
function log
log: (...args: any[]) => void;
Writes an
INFO
severity log. If the last argument provided is a plain object, it is added to thejsonPayload
in the Cloud Logging entry.Parameter args
Arguments, concatenated into the log message with space separators.
Modifiers
@public
function warn
warn: (...args: any[]) => void;
Writes a
WARNING
severity log. If the last argument provided is a plain object, it is added to thejsonPayload
in the Cloud Logging entry.Parameter args
Arguments, concatenated into the log message with space separators.
Modifiers
@public
function write
write: (entry: LogEntry) => void;
Writes a
LogEntry
tostdout
/stderr
(depending on severity).Parameter entry
The
LogEntry
including severity, message, and any additional structured metadata.Modifiers
@public
interface LogEntry
interface LogEntry {}
LogEntry
represents a [structured Cloud Logging](https://cloud.google.com/logging/docs/structured-logging) entry. All keys aside fromseverity
andmessage
are included in thejsonPayload
of the logged entry.Modifiers
@public
property message
message?: string;
property severity
severity: LogSeverity;
index signature
[key: string]: any;
type LogSeverity
type LogSeverity = | 'DEBUG' | 'INFO' | 'NOTICE' | 'WARNING' | 'ERROR' | 'CRITICAL' | 'ALERT' | 'EMERGENCY';
LogSeverity
indicates the detailed severity of the log entry. See [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity).Modifiers
@public
namespace params
module 'lib/params/index.d.ts' {}
Modifiers
@alpha
variable BUCKET_PICKER
const BUCKET_PICKER: ResourceInput;
Autogenerate a list of buckets in a project that a user can select from.
variable databaseURL
const databaseURL: Param<string>;
A built-in parameter that resolves to the default RTDB database URL associated with the project, without prompting the deployer. Empty string if none exists.
variable declaredParams
const declaredParams: SecretOrExpr[];
variable gcloudProject
const gcloudProject: Param<string>;
A built-in parameter that resolves to the Cloud project ID, without prompting the deployer.
variable projectID
const projectID: Param<string>;
A built-in parameter that resolves to the Cloud project ID associated with the project, without prompting the deployer.
variable storageBucket
const storageBucket: Param<string>;
A builtin parameter that resolves to the Cloud storage bucket associated with the function, without prompting the deployer. Empty string if not defined.
function defineBoolean
defineBoolean: (name: string, options?: ParamOptions<boolean>) => BooleanParam;
Declare a boolean parameter.
Parameter name
The name of the environment variable to use to load the parameter.
Parameter options
Configuration options for the parameter.
Returns
A parameter with a
boolean
return type for.value
.
function defineInt
defineInt: (name: string, options?: ParamOptions<number>) => IntParam;
Declare an integer parameter.
Parameter name
The name of the environment variable to use to load the parameter.
Parameter options
Configuration options for the parameter.
Returns
A parameter with a
number
return type for.value
.
function defineList
defineList: (name: string, options?: ParamOptions<string[]>) => ListParam;
Declare a list parameter.
Parameter name
The name of the environment variable to use to load the parameter.
Parameter options
Configuration options for the parameter.
Returns
A parameter with a
string[]
return type for.value
.
function defineSecret
defineSecret: (name: string) => SecretParam;
Declares a secret param, that will persist values only in Cloud Secret Manager. Secrets are stored internally as bytestrings. Use
ParamOptions.as
to provide type hinting during parameter resolution.Parameter name
The name of the environment variable to use to load the parameter.
Returns
A parameter with a
string
return type for.value
.
function defineString
defineString: (name: string, options?: ParamOptions<string>) => StringParam;
Declare a string parameter.
Parameter name
The name of the environment variable to use to load the parameter.
Parameter options
Configuration options for the parameter.
Returns
A parameter with a
string
return type for.value
.
function multiSelect
multiSelect: { (options: string[]): MultiSelectInput; (options: Record<string, string>): MultiSelectInput;};
Create a multi-select input from a series of values.
Create a multi-select input from map of labels to values.
function select
select: { <T>(options: T[]): SelectInput<T>; <T>(optionsWithLabels: Record<string, T>): SelectInput<T>;};
Create a select input from a series of values.
Create a select input from a map of labels to values.
class Expression
abstract class Expression<T extends string | number | boolean | string[]> {}
interface MultiSelectInput
interface MultiSelectInput {}
Specifies that a parameter's value should be determined by having the user select a subset from a list of pre-canned options interactively at deploy time. Will result in errors if used on parameters of type other than
string[]
.
property multiSelect
multiSelect: { options: Array<SelectOptions<string>>;};
interface SelectInput
interface SelectInput<T = unknown> {}
Specifies that a parameter's value should be determined by having the user select from a list of pre-canned options interactively at deploy time.
property select
select: { options: Array<SelectOptions<T>>;};
interface SelectOptions
interface SelectOptions<T = unknown> {}
One of the options provided to a
SelectInput
, containing a value and optionally a human-readable label to display in the selection interface.
interface TextInput
interface TextInput<T = unknown> {}
Specifies that a parameter's value should be determined by prompting the user to type it in interactively at deploy time. Input that does not match the provided validationRegex, if present, will be retried.
property text
text: { example?: string; /** * A regular expression (or an escaped string to compile into a regular * expression) which the prompted text must satisfy; the prompt will retry * until input matching the regex is provided. */ validationRegex?: string | RegExp; /** * A custom error message to display when retrying the prompt based on input * failing to conform to the validationRegex, */ validationErrorMessage?: string;};
type ParamOptions
type ParamOptions<T extends string | number | boolean | string[]> = Omit< ParamSpec<T>, 'name' | 'type'>;
Configuration options which can be used to customize the prompting behavior of a parameter.
namespace pubsub
module 'lib/v2/providers/pubsub.d.ts' {}
Google Cloud Pub/Sub is a globally distributed message bus that automatically scales as you need it. You can create a function (onMessagePublished) that handles pub/sub events by using functions.pubsub.
This function triggers whenever a new pub/sub message is sent to a specific topic. You must specify the Pub/Sub topic name that you want to trigger your function, and set the event within the onPublish() event handler.
PubSub Topic: A resource that you can publish messages to and then consume those messages via subscriptions. An isolated data stream for pub/sub messages. Messages are published to a topic. Messages are listened to via a subscription. Each subscription listens to the messages published to exactly one topic.
Subscriptions - Resource that listens to the messages published by exactly one topic.
[More info here](https://firebase.google.com/docs/functions/pubsub-events)
function onMessagePublished
onMessagePublished: { <T = any>( topic: string, handler: (event: CloudEvent<MessagePublishedData<T>>) => any | Promise<any> ): CloudFunction<CloudEvent<MessagePublishedData<T>>>; <T = any>( options: PubSubOptions, handler: (event: CloudEvent<MessagePublishedData<T>>) => any ): CloudFunction<CloudEvent<MessagePublishedData<T>>>;};
Handle a message being published to a Pub/Sub topic.
Parameter topic
The Pub/Sub topic to watch for message events.
Parameter handler
runs every time a Cloud Pub/Sub message is published
Handle a message being published to a Pub/Sub topic.
Parameter options
Option containing information (topic) for event
Parameter handler
runs every time a Cloud Pub/Sub message is published
class Message
class Message<T> {}
Interface representing a Google Cloud Pub/Sub message.
Parameter data
Payload of a Pub/Sub message.
constructor
constructor(data: any);
Modifiers
@alpha
property attributes
readonly attributes: { [key: string]: string };
User-defined attributes published with the message, if any.
property data
readonly data: string;
The data payload of this message object as a base64-encoded string.
property json
readonly json: {};
The JSON data payload of this message object, if any.
property messageId
readonly messageId: string;
Autogenerated ID that uniquely identifies this message.
property orderingKey
readonly orderingKey: string;
User-defined key used to ensure ordering amongst messages with the same key.
property publishTime
readonly publishTime: string;
Time the message was published
method toJSON
toJSON: () => any;
Returns a JSON-serializable representation of this object.
Returns
A JSON-serializable representation of this object.
interface MessagePublishedData
interface MessagePublishedData<T = any> {}
The interface published in a Pub/Sub publish subscription.
property message
readonly message: Message<T>;
Google Cloud Pub/Sub message.
property subscription
readonly subscription: string;
A subscription resource.
interface PubSubOptions
interface PubSubOptions extends options.EventHandlerOptions {}
PubSubOptions extend EventHandlerOptions but must include a topic.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property topic
topic: string;
The Pub/Sub topic to watch for message events
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
namespace remoteConfig
module 'lib/v2/providers/remoteConfig.d.ts' {}
All the fields associated with the person/service account that wrote a Remote Config template.
function onConfigUpdated
onConfigUpdated: { ( handler: (event: CloudEvent<ConfigUpdateData>) => any | Promise<any> ): CloudFunction<CloudEvent<ConfigUpdateData>>; ( opts: EventHandlerOptions, handler: (event: CloudEvent<ConfigUpdateData>) => any ): CloudFunction<CloudEvent<ConfigUpdateData>>;};
Event handler which triggers when data is updated in a Remote Config.
Parameter handler
Event handler which is run every time a Remote Config update occurs.
Returns
A function that you can export and deploy.
Event handler which triggers when data is updated in a Remote Config.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Remote Config update occurs.
Returns
A function that you can export and deploy.
interface ConfigUpdateData
interface ConfigUpdateData {}
The data within Firebase Remote Config update events.
property description
description: string;
The user-provided description of the corresponding Remote Config template.
property rollbackSource
rollbackSource: number;
Only present if this version is the result of a rollback, and will be the version number of the Remote Config template that was rolled-back to.
property updateOrigin
updateOrigin: ConfigUpdateOrigin;
Where the update action originated.
property updateTime
updateTime: string;
When the Remote Config template was written to the Remote Config server.
property updateType
updateType: ConfigUpdateType;
What type of update was made.
property updateUser
updateUser: ConfigUser;
Aggregation of all metadata fields about the account that performed the update.
property versionNumber
versionNumber: number;
The version number of the version's corresponding Remote Config template.
interface ConfigUser
interface ConfigUser {}
All the fields associated with the person/service account that wrote a Remote Config template.
type ConfigUpdateOrigin
type ConfigUpdateOrigin = /** Catch-all for unrecognized values. */ | 'REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' /** The update came from the Firebase UI. */ | 'CONSOLE' /** The update came from the Remote Config REST API. */ | 'REST_API' /** The update came from the Firebase Admin Node SDK. */ | 'ADMIN_SDK_NODE';
What type of update was associated with the Remote Config template version.
type ConfigUpdateType
type ConfigUpdateType = /** Catch-all for unrecognized enum values */ | 'REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' /** A regular incremental update */ | 'INCREMENTAL_UPDATE' /** A forced update. The ETag was specified as "*" in an UpdateRemoteConfigRequest request or the "Force Update" button was pressed on the console */ | 'FORCED_UPDATE' /** A rollback to a previous Remote Config template */ | 'ROLLBACK';
Where the Remote Config update action originated.
namespace scheduler
module 'lib/v2/providers/scheduler.d.ts' {}
Interface representing a ScheduleEvent that is passed to the function handler.
function onSchedule
onSchedule: { ( schedule: string, handler: (event: ScheduledEvent) => void | Promise<void> ): ScheduleFunction; ( options: ScheduleOptions, handler: (event: ScheduledEvent) => void | Promise<void> ): ScheduleFunction;};
Handler for scheduled functions. Triggered whenever the associated scheduler job sends a http request.
Parameter schedule
The schedule, in Unix Crontab or AppEngine syntax.
Parameter handler
A function to execute when triggered.
Returns
A function that you can export and deploy.
Handler for scheduled functions. Triggered whenever the associated scheduler job sends a http request.
Parameter options
Options to set on scheduled functions.
Parameter handler
A function to execute when triggered.
Returns
A function that you can export and deploy.
interface ScheduledEvent
interface ScheduledEvent {}
Interface representing a ScheduleEvent that is passed to the function handler.
property jobName
jobName?: string;
The Cloud Scheduler job name. Populated via the X-CloudScheduler-JobName header.
If invoked manually, this field is undefined.
property scheduleTime
scheduleTime: string;
For Cloud Scheduler jobs specified in the unix-cron format, this is the job schedule time in RFC3339 UTC "Zulu" format. Populated via the X-CloudScheduler-ScheduleTime header.
If the schedule is manually triggered, this field will be the function execution time.
interface ScheduleFunction
interface ScheduleFunction extends HttpsFunction {}
The Cloud Function type for Schedule triggers.
method run
run: (data: ScheduledEvent) => void | Promise<void>;
interface ScheduleOptions
interface ScheduleOptions extends options.GlobalOptions {}
Options that can be set on a Schedule trigger.
property maxBackoffSeconds
maxBackoffSeconds?: number | Expression<number> | ResetValue;
The maximum time to wait before retrying.
property maxDoublings
maxDoublings?: number | Expression<number> | ResetValue;
The time between will double max doublings times.
property maxRetrySeconds
maxRetrySeconds?: number | Expression<number> | ResetValue;
The time limit for retrying.
property minBackoffSeconds
minBackoffSeconds?: number | Expression<number> | ResetValue;
The minimum time to wait before retying.
property retryCount
retryCount?: number | Expression<number> | ResetValue;
The number of retry attempts for a failed run.
property schedule
schedule: string;
The schedule, in Unix Crontab or AppEngine syntax.
property timeZone
timeZone?: timezone | Expression<string> | ResetValue;
The timezone that the schedule executes in.
namespace storage
module 'lib/v2/providers/storage.d.ts' {}
An object within Google Cloud Storage. Ref: https://github.com/googleapis/google-cloudevents-nodejs/blob/main/cloud/storage/v1/StorageObjectData.ts
function onObjectArchived
onObjectArchived: { ( handler: (event: StorageEvent) => any | Promise<any> ): CloudFunction<StorageEvent>; ( bucket: string | Expression<string>, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>; ( opts: StorageOptions, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>;};
Event handler sent only when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.
Parameter handler
Event handler which is run every time a Google Cloud Storage archival occurs.
Event handler sent only when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.
Parameter bucket
The name of the bucket containing this object.
Parameter handler
Event handler which is run every time a Google Cloud Storage archival occurs.
Event handler sent only when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Google Cloud Storage archival occurs.
function onObjectDeleted
onObjectDeleted: { ( handler: (event: StorageEvent) => any | Promise<any> ): CloudFunction<StorageEvent>; ( bucket: string | Expression<string>, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>; ( opts: StorageOptions, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>;};
Event handler which fires every time a Google Cloud Storage deletion occurs.
Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived, even if archival occurs via the
storage.objects.delete
method.Parameter handler
Event handler which is run every time a Google Cloud Storage object deletion occurs.
Event handler which fires every time a Google Cloud Storage deletion occurs.
Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived, even if archival occurs via the
storage.objects.delete
method.Parameter bucket
The name of the bucket containing this object.
Parameter handler
Event handler which is run every time a Google Cloud Storage object deletion occurs.
Event handler which fires every time a Google Cloud Storage deletion occurs.
Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived, even if archival occurs via the
storage.objects.delete
method.Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Google Cloud Storage object deletion occurs.
function onObjectFinalized
onObjectFinalized: { ( handler: (event: StorageEvent) => any | Promise<any> ): CloudFunction<StorageEvent>; ( bucket: string | Expression<string>, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>; ( opts: StorageOptions, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>;};
Event handler which fires every time a Google Cloud Storage object creation occurs.
Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.
Parameter handler
Event handler which is run every time a Google Cloud Storage object creation occurs.
Event handler which fires every time a Google Cloud Storage object creation occurs.
Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.
Parameter bucket
The name of the bucket containing this object.
Parameter handler
Event handler which is run every time a Google Cloud Storage object creation occurs.
Event handler which fires every time a Google Cloud Storage object creation occurs.
Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Google Cloud Storage object creation occurs.
function onObjectMetadataUpdated
onObjectMetadataUpdated: { ( handler: (event: StorageEvent) => any | Promise<any> ): CloudFunction<StorageEvent>; ( bucket: string | Expression<string>, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>; ( opts: StorageOptions, handler: (event: StorageEvent) => any ): CloudFunction<StorageEvent>;};
Event handler which fires every time the metadata of an existing object changes.
Parameter bucketOrOptsOrHandler
Options or string that may (or may not) define the bucket to be used.
Parameter handler
Event handler which is run every time a Google Cloud Storage object metadata update occurs.
Event handler which fires every time the metadata of an existing object changes.
Parameter bucket
The name of the bucket containing this object.
Parameter handler
Event handler which is run every time a Google Cloud Storage object metadata update occurs.
Event handler which fires every time the metadata of an existing object changes.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Google Cloud Storage object metadata update occurs.
interface CustomerEncryption
interface CustomerEncryption {}
Metadata of customer-supplied encryption key, if the object is encrypted by such a key.
property encryptionAlgorithm
encryptionAlgorithm?: string;
The encryption algorithm.
property keySha256
keySha256?: string;
SHA256 hash value of the encryption key.
interface StorageEvent
interface StorageEvent extends CloudEvent<StorageObjectData> {}
A CloudEvent that contains StorageObjectData
property bucket
bucket: string;
The name of the bucket containing this object.
interface StorageObjectData
interface StorageObjectData {}
An object within Google Cloud Storage. Ref: https://github.com/googleapis/google-cloudevents-nodejs/blob/main/cloud/storage/v1/StorageObjectData.ts
property bucket
bucket: string;
The name of the bucket containing this object.
property cacheControl
cacheControl?: string;
Cache-Control directive for the object data, matching [https://tools.ietf.org/html/rfc7234#section-5.2"][RFC 7234 §5.2].
property componentCount
componentCount?: number;
Number of underlying components that make up this object. Components are accumulated by compose operations. Attempting to set this field will result in an error.
property contentDisposition
contentDisposition?: string;
Content-Disposition of the object data, matching [https://tools.ietf.org/html/rfc6266][RFC 6266].
property contentEncoding
contentEncoding?: string;
Content-Encoding of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.2.2][RFC 7231 §3.1.2.2]
property contentLanguage
contentLanguage?: string;
Content-Language of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.3.2][RFC 7231 §3.1.3.2].
property contentType
contentType?: string;
Content-Type of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.1.5][RFC 7231 §3.1.1.5]. If an object is stored without a Content-Type, it is served as
application/octet-stream
.
property crc32c
crc32c?: string;
CRC32c checksum. For more information about using the CRC32c checksum, see [https://cloud.google.com/storage/docs/hashes-etags#_JSONAPI][Hashes and ETags: Best Practices].
property customerEncryption
customerEncryption?: CustomerEncryption;
Metadata of customer-supplied encryption key, if the object is encrypted by such a key.
property etag
etag?: string;
HTTP 1.1 Entity tag for the object. See [https://tools.ietf.org/html/rfc7232#section-2.3][RFC 7232 §2.3].
property generation
generation: number;
The content generation of this object. Used for object versioning. Attempting to set this field will result in an error.
property id
id: string;
The ID of the object, including the bucket name, object name, and generation number.
property kind
kind?: string;
The kind of item this is. For objects, this is always "storage#object".
property md5Hash
md5Hash?: string;
MD5 hash of the data; encoded using base64 as per [https://tools.ietf.org/html/rfc4648#section-4][RFC 4648 §4]. For more information about using the MD5 hash, see [https://cloud.google.com/storage/docs/hashes-etags#_JSONAPI][Hashes and ETags: Best Practices].
property mediaLink
mediaLink?: string;
Media download link.
property metadata
metadata?: { [key: string]: string;};
User-provided metadata, in key/value pairs.
property metageneration
metageneration: number;
The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object.
property name
name: string;
The name of the object.
property selfLink
selfLink?: string;
The link to this object.
property size
size: number;
Content-Length of the object data in bytes, matching [https://tools.ietf.org/html/rfc7230#section-3.3.2][RFC 7230 §3.3.2].
property storageClass
storageClass: string;
Storage class of the object.
property timeCreated
timeCreated?: Date | string;
The creation time of the object. Attempting to set this field will result in an error.
property timeDeleted
timeDeleted?: Date | string;
The deletion time of the object. Will be returned if and only if this version of the object has been deleted.
property timeStorageClassUpdated
timeStorageClassUpdated?: Date | string;
The time at which the object's storage class was last changed.
property updated
updated?: Date | string;
The modification time of the object metadata.
interface StorageOptions
interface StorageOptions extends options.EventHandlerOptions {}
StorageOptions extend EventHandlerOptions with a bucket name
property bucket
bucket?: string | Expression<string>;
The name of the bucket containing this object.
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean | Expression<boolean> | ResetValue;
Whether failed executions should be delivered again.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
namespace tasks
module 'lib/v2/providers/tasks.d.ts' {}
How a task should be retried in the event of a non-2xx return.
function onTaskDispatched
onTaskDispatched: { <Args = any>( handler: (request: Request<Args>) => void | Promise<void> ): TaskQueueFunction<Args>; <Args = any>( options: TaskQueueOptions, handler: (request: Request<Args>) => void | Promise<void> ): TaskQueueFunction<Args>;};
Creates a handler for tasks sent to a Google Cloud Tasks queue.
Parameter handler
A callback to handle task requests.
Returns
A function you can export and deploy.
Creates a handler for tasks sent to a Google Cloud Tasks queue.
Parameter options
Configuration for the task queue or Cloud Function.
Parameter handler
A callback to handle task requests.
Returns
A function you can export and deploy.
interface AuthData
interface AuthData {}
Metadata about the authorization used to invoke a function.
interface RateLimits
interface RateLimits {}
How congestion control should be applied to the function.
property maxConcurrentDispatches
maxConcurrentDispatches?: number | Expression<number> | ResetValue;
The maximum number of requests that can be processed at a time. If left unspecified, will default to 1000.
property maxDispatchesPerSecond
maxDispatchesPerSecond?: number | Expression<number> | ResetValue;
The maximum number of requests that can be invoked per second. If left unspecified, will default to 500.
interface RetryConfig
interface RetryConfig {}
How a task should be retried in the event of a non-2xx return.
property maxAttempts
maxAttempts?: number | Expression<number> | ResetValue;
Maximum number of times a request should be attempted. If left unspecified, will default to 3.
property maxBackoffSeconds
maxBackoffSeconds?: number | Expression<number> | ResetValue;
The maximum amount of time to wait between attempts. If left unspecified will default to 1hr.
property maxDoublings
maxDoublings?: number | Expression<number> | ResetValue;
The maximum number of times to double the backoff between retries. If left unspecified will default to 16.
property maxRetrySeconds
maxRetrySeconds?: number | Expression<number> | ResetValue;
Maximum amount of time for retrying failed task. If left unspecified will retry indefinitely.
property minBackoffSeconds
minBackoffSeconds?: number | Expression<number> | ResetValue;
The minimum time to wait between attempts. If left unspecified will default to 100ms.
interface TaskQueueFunction
interface TaskQueueFunction<T = any> extends HttpsFunction {}
A handler for tasks.
method run
run: (request: Request<T>) => void | Promise<void>;
The callback passed to the
TaskQueueFunction
constructor.Parameter request
A TaskRequest containing data and auth information.
Returns
Any return value. Google Cloud Functions will await any promise before shutting down your function. Resolved return values are only used for unit testing purposes.
interface TaskQueueOptions
interface TaskQueueOptions extends options.EventHandlerOptions {}
property concurrency
concurrency?: number | Expression<number> | ResetValue;
Number of requests a function can serve at once.
Remarks
Can only be applied to functions running on Cloud Functions v2. A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise). Concurrency cannot be set to any value other than 1 if
cpu
is less than 1. The maximum value for concurrency is 1,000.
property cpu
cpu?: number | 'gcf_gen1';
Fractional number of CPUs to allocate to a function.
Remarks
Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes. This is different from the defaults when using the gcloud utility and is different from the fixed amount assigned in Google Cloud Functions generation 1. To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this to the value "gcf_gen1"
property ingressSettings
ingressSettings?: options.IngressSetting | ResetValue;
Ingress settings which control where this function can be called from.
property invoker
invoker?: 'private' | string | string[];
Who can enqueue tasks for this function.
If left unspecified, only service accounts which have
roles/cloudtasks.enqueuer
androles/cloudfunctions.invoker
will have permissions.
property labels
labels?: Record<string, string>;
User labels to set on the function.
property maxInstances
maxInstances?: number | Expression<number> | ResetValue;
Max number of instances to be running in parallel.
property memory
memory?: options.MemoryOption | Expression<number> | ResetValue;
Amount of memory to allocate to a function.
property minInstances
minInstances?: number | Expression<number> | ResetValue;
Min number of actual instances to be running at a given time.
Remarks
Instances will be billed for memory allocation and 10% of CPU allocation while idle.
property omit
omit?: boolean | Expression<boolean>;
If true, do not deploy or emulate this function.
property rateLimits
rateLimits?: RateLimits;
How congestion control should be applied to the function.
property region
region?: options.SupportedRegion | string | Expression<string> | ResetValue;
Region where functions should be deployed.
property retry
retry?: boolean;
Whether failed executions should be delivered again.
property retryConfig
retryConfig?: RetryConfig;
How a task should be retried in the event of a non-2xx return.
property secrets
secrets?: (string | SecretParam)[];
property serviceAccount
serviceAccount?: string | Expression<string> | ResetValue;
Specific service account for the function to run as.
property timeoutSeconds
timeoutSeconds?: number | Expression<number> | ResetValue;
Timeout for the function in seconds, possible values are 0 to 540. HTTPS functions can specify a higher timeout.
Remarks
The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 36,00s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)
property vpcConnector
vpcConnector?: string | Expression<string> | ResetValue;
Connect cloud function to specified VPC connector.
property vpcConnectorEgressSettings
vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
Egress settings for VPC connector.
type Request
type Request<T = any> = TaskContext & { /** * The parameters used by a client when calling this function. */ data: T;};
The request used to call a task queue function.
namespace testLab
module 'lib/v2/providers/testLab.d.ts' {}
Possible test states for a test matrix.
function onTestMatrixCompleted
onTestMatrixCompleted: { ( handler: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any> ): CloudFunction<CloudEvent<TestMatrixCompletedData>>; ( opts: EventHandlerOptions, handler: (event: CloudEvent<TestMatrixCompletedData>) => any ): CloudFunction<CloudEvent<TestMatrixCompletedData>>;};
Event handler which triggers when a Firebase test matrix completes.
Parameter handler
Event handler which is run every time a Firebase test matrix completes.
Returns
A Cloud Function that you can export and deploy.
Modifiers
@alpha
Event handler which triggers when a Firebase test matrix completes.
Parameter opts
Options that can be set on an individual event-handling function.
Parameter handler
Event handler which is run every time a Firebase test matrix completes.
Returns
A Cloud Function that you can export and deploy.
Modifiers
@alpha
interface ClientInfo
interface ClientInfo {}
Information about the client which invoked the test.
interface ResultStorage
interface ResultStorage {}
Locations where test results are stored.
property gcsPath
gcsPath: string;
Location in Google Cloud Storage where test results are written to. In the form "gs://bucket/path/to/somewhere".
property resultsUri
resultsUri: string;
URI to the test results in the Firebase Web Console.
property toolResultsExecution
toolResultsExecution: string;
Tool Results execution resource containing test results. Format is
projects/{project_id}/histories/{history_id}/executions/{execution_id}
. Optional, can be omitted in erroneous test states. See https://firebase.google.com/docs/test-lab/reference/toolresults/rest for more information.
property toolResultsHistory
toolResultsHistory: string;
Tool Results history resource containing test results. Format is
projects/{project_id}/histories/{history_id}
. See https://firebase.google.com/docs/test-lab/reference/toolresults/rest for more information.
interface TestMatrixCompletedData
interface TestMatrixCompletedData {}
The data within all Firebase test matrix completed events.
property clientInfo
clientInfo: ClientInfo;
Information provided by the client that created the test matrix.
property createTime
createTime: string;
Time the test matrix was created.
property invalidMatrixDetails
invalidMatrixDetails: string;
Code that describes why the test matrix is considered invalid. Only set for matrices in the INVALID state.
property outcomeSummary
outcomeSummary: OutcomeSummary;
Outcome summary of the test matrix.
property resultStorage
resultStorage: ResultStorage;
Locations where test results are stored.
property state
state: TestState;
State of the test matrix.
property testMatrixId
testMatrixId: string;
ID of the test matrix this event belongs to.
type OutcomeSummary
type OutcomeSummary = /** The default value. This value is used if the state is omitted. */ | 'OUTCOME_SUMMARY_UNSPECIFIED' /** * The test matrix run was successful, for instance: * - All test cases passed. * - No crash of the application under test was detected. */ | 'SUCCESS' /** * A run failed, for instance: * - One or more test case failed. * - A test timed out. * - The application under test crashed. */ | 'FAILURE' /** * Something unexpected happened. The test run should still be considered * unsuccessful but this is likely a transient problem and re-running the * test might be successful. */ | 'INCONCLUSIVE' /** All tests were skipped. */ | 'SKIPPED';
Outcome summary for a finished test matrix.
type TestState
type TestState = /** The default value. This value is used if the state is omitted. */ | 'TEST_STATE_UNSPECIFIED' /** The test matrix is being validated. */ | 'VALIDATING' /** The test matrix is waiting for resources to become available. */ | 'PENDING' /** The test matrix has completed normally. */ | 'FINISHED' /** The test matrix has completed because of an infrastructure failure. */ | 'ERROR' /** The test matrix was not run because the provided inputs are not valid. */ | 'INVALID';
Possible test states for a test matrix.
Package Files (31)
- lib/common/change.d.ts
- lib/common/onInit.d.ts
- lib/common/params.d.ts
- lib/common/providers/database.d.ts
- lib/common/providers/https.d.ts
- lib/common/providers/identity.d.ts
- lib/common/providers/tasks.d.ts
- lib/logger/index.d.ts
- lib/params/index.d.ts
- lib/params/types.d.ts
- lib/v1/config.d.ts
- lib/v2/core.d.ts
- lib/v2/index.d.ts
- lib/v2/options.d.ts
- lib/v2/providers/alerts/alerts.d.ts
- lib/v2/providers/alerts/appDistribution.d.ts
- lib/v2/providers/alerts/billing.d.ts
- lib/v2/providers/alerts/crashlytics.d.ts
- lib/v2/providers/alerts/index.d.ts
- lib/v2/providers/alerts/performance.d.ts
- lib/v2/providers/database.d.ts
- lib/v2/providers/eventarc.d.ts
- lib/v2/providers/firestore.d.ts
- lib/v2/providers/https.d.ts
- lib/v2/providers/identity.d.ts
- lib/v2/providers/pubsub.d.ts
- lib/v2/providers/remoteConfig.d.ts
- lib/v2/providers/scheduler.d.ts
- lib/v2/providers/storage.d.ts
- lib/v2/providers/tasks.d.ts
- lib/v2/providers/testLab.d.ts
Dependencies (5)
Dev Dependencies (41)
- @firebase/api-documenter
- @microsoft/api-documenter
- @microsoft/api-extractor
- @types/chai
- @types/chai-as-promised
- @types/jsonwebtoken
- @types/mocha
- @types/mock-require
- @types/nock
- @types/node
- @types/node-fetch
- @types/sinon
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- api-extractor-model-me
- chai
- chai-as-promised
- child-process-promise
- eslint
- eslint-config-google
- eslint-config-prettier
- eslint-plugin-jsdoc
- eslint-plugin-prettier
- firebase-admin
- js-yaml
- jsdom
- jsonwebtoken
- jwk-to-pem
- mocha
- mock-require
- mz
- nock
- node-fetch
- portfinder
- prettier
- protobufjs-cli
- semver
- sinon
- ts-node
- typescript
- yargs
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/firebase-functions
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/firebase-functions)
- HTML<a href="https://www.jsdocs.io/package/firebase-functions"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 10695 ms. - Missing or incorrect documentation? Open an issue for this package.