From 5762ef1a3e59640a272ef2b82e2ceb486b9d311b Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Thu, 3 Nov 2022 15:18:09 -0700 Subject: [PATCH 1/2] Allow v1 and v2 functions to set the Omit option on a function --- src/runtime/manifest.ts | 1 + src/v1/cloud-functions.ts | 1 + src/v1/function-configuration.ts | 4 ++++ src/v2/options.ts | 6 ++++++ src/v2/providers/alerts/alerts.ts | 5 +++++ src/v2/providers/alerts/appDistribution.ts | 5 +++++ src/v2/providers/alerts/crashlytics.ts | 5 +++++ src/v2/providers/database.ts | 5 +++++ src/v2/providers/eventarc.ts | 5 +++++ src/v2/providers/https.ts | 5 +++++ src/v2/providers/identity.ts | 5 +++++ src/v2/providers/pubsub.ts | 5 +++++ src/v2/providers/storage.ts | 5 +++++ src/v2/providers/tasks.ts | 5 +++++ 14 files changed, 62 insertions(+) diff --git a/src/runtime/manifest.ts b/src/runtime/manifest.ts index 9780b1af4..65cb28dec 100644 --- a/src/runtime/manifest.ts +++ b/src/runtime/manifest.ts @@ -32,6 +32,7 @@ import { WireParamSpec } from "../params/types"; export interface ManifestEndpoint { entryPoint?: string; region?: string[]; + omit?: boolean | Expression; platform?: string; availableMemoryMb?: number | Expression | ResetValue; maxInstances?: number | Expression | ResetValue; diff --git a/src/v1/cloud-functions.ts b/src/v1/cloud-functions.ts index d2551e516..7909fc10d 100644 --- a/src/v1/cloud-functions.ts +++ b/src/v1/cloud-functions.ts @@ -597,6 +597,7 @@ export function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint copyIfPresent( endpoint, options, + "omit", "minInstances", "maxInstances", "ingressSettings", diff --git a/src/v1/function-configuration.ts b/src/v1/function-configuration.ts index 1f0d9c4b5..188e6e9de 100644 --- a/src/v1/function-configuration.ts +++ b/src/v1/function-configuration.ts @@ -252,6 +252,10 @@ export interface RuntimeOptions { * Configuration options for a function that applies during function deployment. */ export interface DeploymentOptions extends RuntimeOptions { + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; /** * Regions where function should be deployed. */ diff --git a/src/v2/options.ts b/src/v2/options.ts index cfe951917..b2a025035 100644 --- a/src/v2/options.ts +++ b/src/v2/options.ts @@ -94,6 +94,11 @@ export type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLOW_INTERN * These options are common to HTTPS and Event handling functions. */ export interface GlobalOptions { + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ @@ -317,6 +322,7 @@ export function optionsToEndpoint( copyIfPresent( endpoint, opts, + "omit", "concurrency", "minInstances", "maxInstances", diff --git a/src/v2/providers/alerts/alerts.ts b/src/v2/providers/alerts/alerts.ts index 3b544ecd1..d03e35622 100644 --- a/src/v2/providers/alerts/alerts.ts +++ b/src/v2/providers/alerts/alerts.ts @@ -86,6 +86,11 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/alerts/appDistribution.ts b/src/v2/providers/alerts/appDistribution.ts index e98085f84..90d7e4c6d 100644 --- a/src/v2/providers/alerts/appDistribution.ts +++ b/src/v2/providers/alerts/appDistribution.ts @@ -97,6 +97,11 @@ export interface AppDistributionOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/alerts/crashlytics.ts b/src/v2/providers/alerts/crashlytics.ts index e142406b6..23c113a47 100644 --- a/src/v2/providers/alerts/crashlytics.ts +++ b/src/v2/providers/alerts/crashlytics.ts @@ -177,6 +177,11 @@ export interface CrashlyticsOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/database.ts b/src/v2/providers/database.ts index af9ced565..5a9f6a667 100644 --- a/src/v2/providers/database.ts +++ b/src/v2/providers/database.ts @@ -98,6 +98,11 @@ export interface ReferenceOptions extends options.E */ instance?: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index 4f425faef..08c220019 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -62,6 +62,11 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { */ filters?: Record; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/https.ts b/src/v2/providers/https.ts index 010a4a355..eff52f2ba 100644 --- a/src/v2/providers/https.ts +++ b/src/v2/providers/https.ts @@ -50,6 +50,11 @@ export { Request, CallableRequest, FunctionsErrorCode, HttpsError }; * Options that can be set on an onRequest HTTPS function. */ export interface HttpsOptions extends Omit { + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** HTTP functions can override global options and can specify multiple regions to deploy to. */ region?: SupportedRegion | string | Array; diff --git a/src/v2/providers/identity.ts b/src/v2/providers/identity.ts index a1a29a252..8ac35e608 100644 --- a/src/v2/providers/identity.ts +++ b/src/v2/providers/identity.ts @@ -64,6 +64,11 @@ export interface BlockingOptions { /** Pass the Refresh Token credential to the function. */ refreshToken?: boolean; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/pubsub.ts b/src/v2/providers/pubsub.ts index 2f215d52b..fc6589a09 100644 --- a/src/v2/providers/pubsub.ts +++ b/src/v2/providers/pubsub.ts @@ -155,6 +155,11 @@ export interface PubSubOptions extends options.EventHandlerOptions { /** The Pub/Sub topic to watch for message events */ topic: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/storage.ts b/src/v2/providers/storage.ts index cf88cdc51..1506f6ac9 100644 --- a/src/v2/providers/storage.ts +++ b/src/v2/providers/storage.ts @@ -203,6 +203,11 @@ export interface StorageOptions extends options.EventHandlerOptions { /** The name of the bucket containing this object. */ bucket?: string; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/tasks.ts b/src/v2/providers/tasks.ts index d5974b722..8112ba194 100644 --- a/src/v2/providers/tasks.ts +++ b/src/v2/providers/tasks.ts @@ -60,6 +60,11 @@ export interface TaskQueueOptions extends options.EventHandlerOptions { */ invoker?: "private" | string | string[]; + /** + * If true (or resolving to true), do not deploy this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ From 8a595dad9d6eacbb81ac74137257cbec02829e63 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 8 Nov 2022 23:09:06 -0800 Subject: [PATCH 2/2] reword the jsdoc comment for omit field --- src/v1/function-configuration.ts | 2 +- src/v2/options.ts | 2 +- src/v2/providers/alerts/alerts.ts | 2 +- src/v2/providers/alerts/appDistribution.ts | 2 +- src/v2/providers/alerts/crashlytics.ts | 2 +- src/v2/providers/database.ts | 2 +- src/v2/providers/eventarc.ts | 2 +- src/v2/providers/https.ts | 2 +- src/v2/providers/identity.ts | 2 +- src/v2/providers/pubsub.ts | 2 +- src/v2/providers/storage.ts | 2 +- src/v2/providers/tasks.ts | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/v1/function-configuration.ts b/src/v1/function-configuration.ts index 188e6e9de..504e392ca 100644 --- a/src/v1/function-configuration.ts +++ b/src/v1/function-configuration.ts @@ -253,7 +253,7 @@ export interface RuntimeOptions { */ export interface DeploymentOptions extends RuntimeOptions { /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; /** diff --git a/src/v2/options.ts b/src/v2/options.ts index b2a025035..a4cc00eef 100644 --- a/src/v2/options.ts +++ b/src/v2/options.ts @@ -95,7 +95,7 @@ export type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLOW_INTERN */ export interface GlobalOptions { /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/alerts/alerts.ts b/src/v2/providers/alerts/alerts.ts index d03e35622..0eb9176e3 100644 --- a/src/v2/providers/alerts/alerts.ts +++ b/src/v2/providers/alerts/alerts.ts @@ -87,7 +87,7 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions { appId?: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/alerts/appDistribution.ts b/src/v2/providers/alerts/appDistribution.ts index 90d7e4c6d..0d2c5ccd4 100644 --- a/src/v2/providers/alerts/appDistribution.ts +++ b/src/v2/providers/alerts/appDistribution.ts @@ -98,7 +98,7 @@ export interface AppDistributionOptions extends options.EventHandlerOptions { appId?: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/alerts/crashlytics.ts b/src/v2/providers/alerts/crashlytics.ts index 23c113a47..6fd255430 100644 --- a/src/v2/providers/alerts/crashlytics.ts +++ b/src/v2/providers/alerts/crashlytics.ts @@ -178,7 +178,7 @@ export interface CrashlyticsOptions extends options.EventHandlerOptions { appId?: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/database.ts b/src/v2/providers/database.ts index 5a9f6a667..4ceb6ac97 100644 --- a/src/v2/providers/database.ts +++ b/src/v2/providers/database.ts @@ -99,7 +99,7 @@ export interface ReferenceOptions extends options.E instance?: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index 08c220019..e765eb268 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -63,7 +63,7 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { filters?: Record; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/https.ts b/src/v2/providers/https.ts index eff52f2ba..f45c19254 100644 --- a/src/v2/providers/https.ts +++ b/src/v2/providers/https.ts @@ -51,7 +51,7 @@ export { Request, CallableRequest, FunctionsErrorCode, HttpsError }; */ export interface HttpsOptions extends Omit { /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/identity.ts b/src/v2/providers/identity.ts index 8ac35e608..13cb1ee6e 100644 --- a/src/v2/providers/identity.ts +++ b/src/v2/providers/identity.ts @@ -65,7 +65,7 @@ export interface BlockingOptions { refreshToken?: boolean; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/pubsub.ts b/src/v2/providers/pubsub.ts index fc6589a09..98b966c45 100644 --- a/src/v2/providers/pubsub.ts +++ b/src/v2/providers/pubsub.ts @@ -156,7 +156,7 @@ export interface PubSubOptions extends options.EventHandlerOptions { topic: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/storage.ts b/src/v2/providers/storage.ts index 1506f6ac9..7e38f1ee7 100644 --- a/src/v2/providers/storage.ts +++ b/src/v2/providers/storage.ts @@ -204,7 +204,7 @@ export interface StorageOptions extends options.EventHandlerOptions { bucket?: string; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression; diff --git a/src/v2/providers/tasks.ts b/src/v2/providers/tasks.ts index 8112ba194..6a493fe51 100644 --- a/src/v2/providers/tasks.ts +++ b/src/v2/providers/tasks.ts @@ -61,7 +61,7 @@ export interface TaskQueueOptions extends options.EventHandlerOptions { invoker?: "private" | string | string[]; /** - * If true (or resolving to true), do not deploy this function. + * If true, do not deploy or emulate this function. */ omit?: boolean | Expression;