Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/common/providers/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const CLAIMS_MAX_PAYLOAD_SIZE = 1000;

/**
* Shorthand auth blocking events from GCIP.
* @internal
* @hidden
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Internal should have been fine, but API Extractor was crashing so I changed it.

* @alpha
*/
export type AuthBlockingEventType = 'beforeCreate' | 'beforeSignIn';

Expand Down
3 changes: 2 additions & 1 deletion src/v2/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export interface GlobalOptions {
invoker?: 'public' | 'private' | string | string[];

/*
* Secrets to bind to a functions.
* Secrets to bind to a function.
*/
secrets?: string[];
}
Expand Down Expand Up @@ -212,6 +212,7 @@ export function getGlobalOptions(): GlobalOptions {
* Additional fields that can be set on any event-handling Cloud Function.
*/
export interface EventHandlerOptions extends GlobalOptions {
/** Whether failed executions should be delivered again. */
retry?: boolean;
}

Expand Down
114 changes: 112 additions & 2 deletions src/v2/providers/alerts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,127 @@ export type AlertType =
export interface FirebaseAlertOptions extends options.EventHandlerOptions {
/** Scope the handler to trigger on an alert type. */
alertType: AlertType;

/** Scope the function to trigger on a specific application. */
appId?: string;

/**
* Region where functions should be deployed.
*/
region?: options.SupportedRegion | string;

/**
* Amount of memory to allocate to a function.
* A value of null restores the defaults of 256MB.
*/
memory?: options.MemoryOption | null;

/**
* Timeout for the function in sections, 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)
*/
timeoutSeconds?: number | null;

/**
* 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.
*/
minInstances?: number | null;

/**
* Max number of instances to be running in parallel.
* A value of null restores the default max instances.
*/
maxInstances?: number | null;

/**
* 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.
*/
concurrency?: number | null;

/**
* 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"
*/
cpu?: number | 'gcf_gen1';

/**
* Connect cloud function to specified VPC connector.
* A value of null removes the VPC connector
*/
vpcConnector?: string | null;

/**
* Egress settings for VPC connector.
* A value of null turns off VPC connector egress settings
*/
vpcConnectorEgressSettings?: options.VpcEgressSetting | null;

/**
* Specific service account for the function to run as.
* A value of null restores the default service account.
*/
serviceAccount?: string | null;

/**
* Ingress settings which control where this function can be called from.
* A value of null turns off ingress settings.
*/
ingressSettings?: options.IngressSetting | null;

/**
* User labels to set on the function.
*/
labels?: Record<string, string>;

/*
* Secrets to bind to a function.
*/
secrets?: string[];

/** Whether failed executions should be delivered again. */
retry?: boolean;
}

/**
* Declares a function that can handle Firebase Alerts from CloudEvents.
* @typeParam T - The data type of the `FirebaseAlertData` object the function receives.
* @param alertTypeOrOpts the alert type or Firebase Alert function configuration.
* @typeParam T - the type of event.data.payload.
* @param alertType - the alert type or Firebase Alert function configuration.
* @param handler a function that can handle the Firebase Alert inside a CloudEvent.
* @returns A function that you can export and deploy.
*/
export function onAlertPublished<T extends { ['@type']: string } = any>(
alertType: AlertType,
handler: (event: AlertEvent<T>) => any | Promise<any>
): CloudFunction<AlertEvent<T>>;

/**
* Declares a function that can handle Firebase Alerts from CloudEvents.
* @typeParam T - the type of event.data.payload.
* @param options - the alert type and other options for this cloud function.
* @param handler a function that can handle the Firebase Alert inside a CloudEvent.
*/
export function onAlertPublished<T extends { ['@type']: string } = any>(
options: FirebaseAlertOptions,
handler: (event: AlertEvent<T>) => any | Promise<any>
): CloudFunction<AlertEvent<T>>;

export function onAlertPublished<T extends { ['@type']: string } = any>(
alertTypeOrOpts: AlertType | FirebaseAlertOptions,
handler: (event: AlertEvent<T>) => any | Promise<any>
Expand Down
93 changes: 93 additions & 0 deletions src/v2/providers/alerts/appDistribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,99 @@ export const newTesterIosDeviceAlert = 'appDistribution.newTesterIosDevice';
export interface AppDistributionOptions extends options.EventHandlerOptions {
/** Scope the function to trigger on a specific application. */
appId?: string;

/**
* Region where functions should be deployed.
*/
region?: options.SupportedRegion | string;

/**
* Amount of memory to allocate to a function.
* A value of null restores the defaults of 256MB.
*/
memory?: options.MemoryOption | null;

/**
* Timeout for the function in sections, 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)
*/
timeoutSeconds?: number | null;

/**
* 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.
*/
minInstances?: number | null;

/**
* Max number of instances to be running in parallel.
* A value of null restores the default max instances.
*/
maxInstances?: number | null;

/**
* 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.
*/
concurrency?: number | null;

/**
* 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"
*/
cpu?: number | 'gcf_gen1';

/**
* Connect cloud function to specified VPC connector.
* A value of null removes the VPC connector
*/
vpcConnector?: string | null;

/**
* Egress settings for VPC connector.
* A value of null turns off VPC connector egress settings
*/
vpcConnectorEgressSettings?: options.VpcEgressSetting | null;

/**
* Specific service account for the function to run as.
* A value of null restores the default service account.
*/
serviceAccount?: string | null;

/**
* Ingress settings which control where this function can be called from.
* A value of null turns off ingress settings.
*/
ingressSettings?: options.IngressSetting | null;

/**
* User labels to set on the function.
*/
labels?: Record<string, string>;

/*
* Secrets to bind to a function.
*/
secrets?: string[];

/** Whether failed executions should be delivered again. */
retry?: boolean;
}

/**
Expand Down
93 changes: 93 additions & 0 deletions src/v2/providers/alerts/crashlytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,99 @@ export const newAnrIssueAlert = 'crashlytics.newAnrIssue';
export interface CrashlyticsOptions extends options.EventHandlerOptions {
/** Scope the function to trigger on a specific application. */
appId?: string;

/**
* Region where functions should be deployed.
*/
region?: options.SupportedRegion | string;

/**
* Amount of memory to allocate to a function.
* A value of null restores the defaults of 256MB.
*/
memory?: options.MemoryOption | null;

/**
* Timeout for the function in sections, 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)
*/
timeoutSeconds?: number | null;

/**
* 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.
*/
minInstances?: number | null;

/**
* Max number of instances to be running in parallel.
* A value of null restores the default max instances.
*/
maxInstances?: number | null;

/**
* 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.
*/
concurrency?: number | null;

/**
* 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"
*/
cpu?: number | 'gcf_gen1';

/**
* Connect cloud function to specified VPC connector.
* A value of null removes the VPC connector
*/
vpcConnector?: string | null;

/**
* Egress settings for VPC connector.
* A value of null turns off VPC connector egress settings
*/
vpcConnectorEgressSettings?: options.VpcEgressSetting | null;

/**
* Specific service account for the function to run as.
* A value of null restores the default service account.
*/
serviceAccount?: string | null;

/**
* Ingress settings which control where this function can be called from.
* A value of null turns off ingress settings.
*/
ingressSettings?: options.IngressSetting | null;

/**
* User labels to set on the function.
*/
labels?: Record<string, string>;

/*
* Secrets to bind to a function.
*/
secrets?: string[];

/** Whether failed executions should be delivered again. */
retry?: boolean;
}

/**
Expand Down
Loading