firebase-functions 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/common/encoding.d.ts +8 -0
  2. package/lib/common/encoding.js +24 -2
  3. package/lib/params/types.d.ts +7 -0
  4. package/lib/params/types.js +20 -2
  5. package/lib/runtime/manifest.d.ts +1 -0
  6. package/lib/runtime/manifest.js +12 -10
  7. package/lib/v1/cloud-functions.d.ts +41 -0
  8. package/lib/v1/cloud-functions.js +53 -3
  9. package/lib/v1/function-configuration.d.ts +15 -10
  10. package/lib/v1/function-configuration.js +4 -1
  11. package/lib/v1/providers/auth.js +12 -0
  12. package/lib/v1/providers/https.js +11 -0
  13. package/lib/v1/providers/tasks.d.ts +2 -0
  14. package/lib/v1/providers/tasks.js +10 -2
  15. package/lib/v2/core.d.ts +2 -0
  16. package/lib/v2/options.d.ts +4 -0
  17. package/lib/v2/options.js +26 -2
  18. package/lib/v2/providers/alerts/alerts.d.ts +4 -0
  19. package/lib/v2/providers/alerts/appDistribution.d.ts +4 -8
  20. package/lib/v2/providers/alerts/appDistribution.js +0 -2
  21. package/lib/v2/providers/alerts/crashlytics.d.ts +4 -0
  22. package/lib/v2/providers/database.d.ts +4 -0
  23. package/lib/v2/providers/eventarc.d.ts +4 -0
  24. package/lib/v2/providers/https.d.ts +6 -0
  25. package/lib/v2/providers/https.js +43 -0
  26. package/lib/v2/providers/identity.d.ts +4 -0
  27. package/lib/v2/providers/pubsub.d.ts +4 -0
  28. package/lib/v2/providers/pubsub.js +19 -0
  29. package/lib/v2/providers/scheduler.js +8 -6
  30. package/lib/v2/providers/storage.d.ts +4 -0
  31. package/lib/v2/providers/storage.js +19 -0
  32. package/lib/v2/providers/tasks.d.ts +4 -0
  33. package/lib/v2/providers/tasks.js +24 -4
  34. package/lib/v2/providers/testLab.js +2 -0
  35. package/package.json +18 -14
@@ -1,3 +1,10 @@
1
+ /**
2
+ * A type alias used to annotate interfaces as using a google.protobuf.Duration.
3
+ * This type is parsed/encoded as a string of seconds + the "s" prefix.
4
+ */
5
+ export declare type Duration = string;
6
+ /** Get a google.protobuf.Duration for a number of seconds. */
7
+ export declare function durationFromSeconds(s: number): Duration;
1
8
  /**
2
9
  * Utility function to help copy fields from type A to B.
3
10
  * As a safety net, catches typos or fields that aren't named the same
@@ -5,4 +12,5 @@
5
12
  */
6
13
  export declare function copyIfPresent<Src, Dest>(dest: Dest, src: Src, ...fields: Array<keyof Src & keyof Dest>): void;
7
14
  export declare function convertIfPresent<Src, Dest>(dest: Dest, src: Src, destField: keyof Dest, srcField: keyof Src, converter?: (from: any) => any): void;
15
+ export declare function serviceAccountFromShorthand(serviceAccount: string): string | null;
8
16
  export declare function convertInvoker(invoker: string | string[]): string[];
@@ -21,8 +21,12 @@
21
21
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.convertInvoker = exports.convertIfPresent = exports.copyIfPresent = void 0;
25
- // Copied from firebase-tools/src/gcp/proto
24
+ exports.convertInvoker = exports.serviceAccountFromShorthand = exports.convertIfPresent = exports.copyIfPresent = exports.durationFromSeconds = void 0;
25
+ /** Get a google.protobuf.Duration for a number of seconds. */
26
+ function durationFromSeconds(s) {
27
+ return `${s}s`;
28
+ }
29
+ exports.durationFromSeconds = durationFromSeconds;
26
30
  /**
27
31
  * Utility function to help copy fields from type A to B.
28
32
  * As a safety net, catches typos or fields that aren't named the same
@@ -52,6 +56,24 @@ function convertIfPresent(dest, src, destField, srcField, converter = (from) =>
52
56
  dest[destField] = converter(src[srcField]);
53
57
  }
54
58
  exports.convertIfPresent = convertIfPresent;
59
+ function serviceAccountFromShorthand(serviceAccount) {
60
+ if (serviceAccount === "default") {
61
+ return null;
62
+ }
63
+ else if (serviceAccount.endsWith("@")) {
64
+ if (!process.env.GCLOUD_PROJECT) {
65
+ throw new Error(`Unable to determine email for service account '${serviceAccount}' because process.env.GCLOUD_PROJECT is not set.`);
66
+ }
67
+ return `${serviceAccount}${process.env.GCLOUD_PROJECT}.iam.gserviceaccount.com`;
68
+ }
69
+ else if (serviceAccount.includes("@")) {
70
+ return serviceAccount;
71
+ }
72
+ else {
73
+ throw new Error(`Invalid option for serviceAccount: '${serviceAccount}'. Valid options are 'default', a service account email, or '{serviceAccountName}@'`);
74
+ }
75
+ }
76
+ exports.serviceAccountFromShorthand = serviceAccountFromShorthand;
55
77
  function convertInvoker(invoker) {
56
78
  if (typeof invoker === "string") {
57
79
  invoker = [invoker];
@@ -135,6 +135,11 @@ export declare abstract class Param<T extends string | number | boolean | string
135
135
  /** Returns a parametrized expression of Boolean type, based on comparing the value of this param to a literal or a different expression. */
136
136
  lessThan(rhs: T | Expression<T>): CompareExpression<T>;
137
137
  /** Returns a parametrized expression of Boolean type, based on comparing the value of this param to a literal or a different expression. */
138
+ lessThanOrEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
139
+ /**
140
+ * Returns a parametrized expression of Boolean type, based on comparing the value of this param to a literal or a different expression.
141
+ * @deprecated A typo. Use lessThanOrEqualTo instead.
142
+ */
138
143
  lessThanorEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
139
144
  toString(): string;
140
145
  }
@@ -148,6 +153,8 @@ export declare class SecretParam {
148
153
  static type: ParamValueType;
149
154
  name: string;
150
155
  constructor(name: string);
156
+ /** Returns the secret's value at runtime. Throws an error if accessed during deployment. */
157
+ value(): string;
151
158
  }
152
159
  /**
153
160
  * A parametrized value of String type that will be read from .env files
@@ -164,9 +164,16 @@ class Param extends Expression {
164
164
  return this.cmp("<", rhs);
165
165
  }
166
166
  /** Returns a parametrized expression of Boolean type, based on comparing the value of this param to a literal or a different expression. */
167
- lessThanorEqualTo(rhs) {
167
+ lessThanOrEqualTo(rhs) {
168
168
  return this.cmp("<=", rhs);
169
169
  }
170
+ /**
171
+ * Returns a parametrized expression of Boolean type, based on comparing the value of this param to a literal or a different expression.
172
+ * @deprecated A typo. Use lessThanOrEqualTo instead.
173
+ */
174
+ lessThanorEqualTo(rhs) {
175
+ return this.lessThanOrEqualTo(rhs);
176
+ }
170
177
  toString() {
171
178
  return `params.${this.name}`;
172
179
  }
@@ -204,7 +211,11 @@ class SecretParam {
204
211
  }
205
212
  /** @internal */
206
213
  runtimeValue() {
207
- return process.env[this.name] || "";
214
+ const val = process.env[this.name];
215
+ if (val === undefined) {
216
+ logger.warn(`No value found for secret parameter "${this.name}". A function can only access a secret if you include the secret in the function's dependency array.`);
217
+ }
218
+ return val || "";
208
219
  }
209
220
  /** @internal */
210
221
  toSpec() {
@@ -213,6 +224,13 @@ class SecretParam {
213
224
  name: this.name,
214
225
  };
215
226
  }
227
+ /** Returns the secret's value at runtime. Throws an error if accessed during deployment. */
228
+ value() {
229
+ if (process.env.FUNCTIONS_CONTROL_API === "true") {
230
+ throw new Error(`Cannot access the value of secret "${this.name}" during function deployment. Secret values are only available at runtime.`);
231
+ }
232
+ return this.runtimeValue();
233
+ }
216
234
  }
217
235
  exports.SecretParam = SecretParam;
218
236
  SecretParam.type = "secret";
@@ -9,6 +9,7 @@ import { WireParamSpec } from "../params/types";
9
9
  export interface ManifestEndpoint {
10
10
  entryPoint?: string;
11
11
  region?: string[];
12
+ omit?: boolean | Expression<boolean>;
12
13
  platform?: string;
13
14
  availableMemoryMb?: number | Expression<number> | ResetValue;
14
15
  maxInstances?: number | Expression<number> | ResetValue;
@@ -101,17 +101,17 @@ const RESETTABLE_RATE_LIMITS_OPTIONS = {
101
101
  * @internal
102
102
  */
103
103
  function initTaskQueueTrigger(...opts) {
104
- let taskQueueTrigger = {};
104
+ const taskQueueTrigger = {
105
+ retryConfig: {},
106
+ rateLimits: {},
107
+ };
105
108
  if (opts.every((opt) => !(opt === null || opt === void 0 ? void 0 : opt.preserveExternalChanges))) {
106
- const retryConfig = {};
107
109
  for (const key of Object.keys(RESETTABLE_RETRY_CONFIG_OPTIONS)) {
108
- retryConfig[key] = options_1.RESET_VALUE;
110
+ taskQueueTrigger.retryConfig[key] = options_1.RESET_VALUE;
109
111
  }
110
- const rateLimits = {};
111
112
  for (const key of Object.keys(RESETTABLE_RATE_LIMITS_OPTIONS)) {
112
- rateLimits[key] = options_1.RESET_VALUE;
113
+ taskQueueTrigger.rateLimits[key] = options_1.RESET_VALUE;
113
114
  }
114
- taskQueueTrigger = { retryConfig, rateLimits };
115
115
  }
116
116
  return taskQueueTrigger;
117
117
  }
@@ -131,13 +131,15 @@ const RESETTABLE_V2_SCHEDULE_OPTIONS = {
131
131
  maxBackoffSeconds: null,
132
132
  };
133
133
  function initScheduleTrigger(resetOptions, schedule, ...opts) {
134
- let scheduleTrigger = { schedule };
134
+ let scheduleTrigger = {
135
+ schedule,
136
+ retryConfig: {},
137
+ };
135
138
  if (opts.every((opt) => !(opt === null || opt === void 0 ? void 0 : opt.preserveExternalChanges))) {
136
- const retryConfig = {};
137
139
  for (const key of Object.keys(resetOptions)) {
138
- retryConfig[key] = options_1.RESET_VALUE;
140
+ scheduleTrigger.retryConfig[key] = options_1.RESET_VALUE;
139
141
  }
140
- scheduleTrigger = { ...scheduleTrigger, timeZone: options_1.RESET_VALUE, retryConfig };
142
+ scheduleTrigger = { ...scheduleTrigger, timeZone: options_1.RESET_VALUE };
141
143
  }
142
144
  return scheduleTrigger;
143
145
  }
@@ -1,4 +1,5 @@
1
1
  import { Request, Response } from "express";
2
+ import { DeploymentOptions, FailurePolicy, Schedule } from "./function-configuration";
2
3
  export { Request, Response };
3
4
  import { ManifestEndpoint, ManifestRequiredAPI } from "../runtime/manifest";
4
5
  export { Change } from "../common/change";
@@ -174,6 +175,37 @@ export interface Resource {
174
175
  [tag: string]: string;
175
176
  };
176
177
  }
178
+ /**
179
+ * TriggerAnnotion is used internally by the firebase CLI to understand what
180
+ * type of Cloud Function to deploy.
181
+ */
182
+ interface TriggerAnnotation {
183
+ availableMemoryMb?: number;
184
+ blockingTrigger?: {
185
+ eventType: string;
186
+ options?: Record<string, unknown>;
187
+ };
188
+ eventTrigger?: {
189
+ eventType: string;
190
+ resource: string;
191
+ service: string;
192
+ };
193
+ failurePolicy?: FailurePolicy;
194
+ httpsTrigger?: {
195
+ invoker?: string[];
196
+ };
197
+ labels?: {
198
+ [key: string]: string;
199
+ };
200
+ regions?: string[];
201
+ schedule?: Schedule;
202
+ timeout?: string;
203
+ vpcConnector?: string;
204
+ vpcConnectorEgressSettings?: string;
205
+ serviceAccountEmail?: string;
206
+ ingressSettings?: string;
207
+ secrets?: string[];
208
+ }
177
209
  /**
178
210
  * A Runnable has a `run` method which directly invokes the user-defined
179
211
  * function - useful for unit testing.
@@ -195,6 +227,8 @@ export interface Runnable<T> {
195
227
  export interface HttpsFunction {
196
228
  (req: Request, resp: Response): void | Promise<void>;
197
229
  /** @alpha */
230
+ __trigger: TriggerAnnotation;
231
+ /** @alpha */
198
232
  __endpoint: ManifestEndpoint;
199
233
  /** @alpha */
200
234
  __requiredAPIs?: ManifestRequiredAPI[];
@@ -212,6 +246,8 @@ export interface BlockingFunction {
212
246
  /** @public */
213
247
  (req: Request, resp: Response): void | Promise<void>;
214
248
  /** @alpha */
249
+ __trigger: TriggerAnnotation;
250
+ /** @alpha */
215
251
  __endpoint: ManifestEndpoint;
216
252
  /** @alpha */
217
253
  __requiredAPIs?: ManifestRequiredAPI[];
@@ -226,7 +262,12 @@ export interface BlockingFunction {
226
262
  export interface CloudFunction<T> extends Runnable<T> {
227
263
  (input: any, context?: any): PromiseLike<any> | any;
228
264
  /** @alpha */
265
+ __trigger: TriggerAnnotation;
266
+ /** @alpha */
229
267
  __endpoint: ManifestEndpoint;
230
268
  /** @alpha */
231
269
  __requiredAPIs?: ManifestRequiredAPI[];
232
270
  }
271
+ /** @hidden */
272
+ export declare function optionsToTrigger(options: DeploymentOptions): any;
273
+ export declare function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint;
@@ -21,7 +21,7 @@
21
21
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.optionsToEndpoint = exports.makeCloudFunction = exports.Change = void 0;
24
+ exports.optionsToEndpoint = exports.optionsToTrigger = exports.makeCloudFunction = exports.Change = void 0;
25
25
  const logger_1 = require("../logger");
26
26
  const function_configuration_1 = require("./function-configuration");
27
27
  const encoding_1 = require("../common/encoding");
@@ -83,6 +83,25 @@ function makeCloudFunction({ contextOnlyHandler, dataConstructor = (raw) => raw.
83
83
  }
84
84
  return Promise.resolve(promise);
85
85
  };
86
+ Object.defineProperty(cloudFunction, "__trigger", {
87
+ get: () => {
88
+ if (triggerResource() == null) {
89
+ return {};
90
+ }
91
+ const trigger = {
92
+ ...optionsToTrigger(options),
93
+ eventTrigger: {
94
+ resource: triggerResource(),
95
+ eventType: legacyEventType || provider + "." + eventType,
96
+ service,
97
+ },
98
+ };
99
+ if (!!labels && Object.keys(labels).length) {
100
+ trigger.labels = { ...trigger.labels, ...labels };
101
+ }
102
+ return trigger;
103
+ },
104
+ });
86
105
  Object.defineProperty(cloudFunction, "__endpoint", {
87
106
  get: () => {
88
107
  if (triggerResource() == null) {
@@ -171,10 +190,41 @@ function _detectAuthType(event) {
171
190
  }
172
191
  return "UNAUTHENTICATED";
173
192
  }
174
- /** @internal */
193
+ /** @hidden */
194
+ function optionsToTrigger(options) {
195
+ const trigger = {};
196
+ (0, encoding_1.copyIfPresent)(trigger, options, "regions", "schedule", "minInstances", "maxInstances", "ingressSettings", "vpcConnectorEgressSettings", "vpcConnector", "labels", "secrets");
197
+ (0, encoding_1.convertIfPresent)(trigger, options, "failurePolicy", "failurePolicy", (policy) => {
198
+ if (policy === false) {
199
+ return undefined;
200
+ }
201
+ else if (policy === true) {
202
+ return function_configuration_1.DEFAULT_FAILURE_POLICY;
203
+ }
204
+ else {
205
+ return policy;
206
+ }
207
+ });
208
+ (0, encoding_1.convertIfPresent)(trigger, options, "timeout", "timeoutSeconds", encoding_1.durationFromSeconds);
209
+ (0, encoding_1.convertIfPresent)(trigger, options, "availableMemoryMb", "memory", (mem) => {
210
+ const memoryLookup = {
211
+ "128MB": 128,
212
+ "256MB": 256,
213
+ "512MB": 512,
214
+ "1GB": 1024,
215
+ "2GB": 2048,
216
+ "4GB": 4096,
217
+ "8GB": 8192,
218
+ };
219
+ return memoryLookup[mem];
220
+ });
221
+ (0, encoding_1.convertIfPresent)(trigger, options, "serviceAccountEmail", "serviceAccount", encoding_1.serviceAccountFromShorthand);
222
+ return trigger;
223
+ }
224
+ exports.optionsToTrigger = optionsToTrigger;
175
225
  function optionsToEndpoint(options) {
176
226
  const endpoint = {};
177
- (0, encoding_1.copyIfPresent)(endpoint, options, "minInstances", "maxInstances", "ingressSettings", "labels", "timeoutSeconds");
227
+ (0, encoding_1.copyIfPresent)(endpoint, options, "omit", "minInstances", "maxInstances", "ingressSettings", "labels", "timeoutSeconds");
178
228
  (0, encoding_1.convertIfPresent)(endpoint, options, "region", "regions");
179
229
  (0, encoding_1.convertIfPresent)(endpoint, options, "serviceAccountEmail", "serviceAccount", (sa) => sa);
180
230
  (0, encoding_1.convertIfPresent)(endpoint, options, "secretEnvironmentVariables", "secrets", (secrets) => secrets.map((secret) => ({ key: secret instanceof types_1.SecretParam ? secret.name : secret })));
@@ -107,6 +107,7 @@ export interface FailurePolicy {
107
107
  */
108
108
  retry: Record<string, never>;
109
109
  }
110
+ export declare const DEFAULT_FAILURE_POLICY: FailurePolicy;
110
111
  export declare const MAX_NUMBER_USER_LABELS = 58;
111
112
  /**
112
113
  * Configuration options for a function that applicable at runtime.
@@ -171,11 +172,25 @@ export interface RuntimeOptions {
171
172
  * When false, requests with invalid tokens set context.app to undefiend.
172
173
  */
173
174
  enforceAppCheck?: boolean;
175
+ /**
176
+ * Controls whether function configuration modified outside of function source is preserved. Defaults to false.
177
+ *
178
+ * @remarks
179
+ * When setting configuration available in the underlying platform that is not yet available in the Firebase Functions
180
+ * SDK, we highly recommend setting `preserveExternalChanges` to `true`. Otherwise, when the Firebase Functions SDK releases
181
+ * a new version of the SDK with support for the missing configuration, your function's manually configured setting
182
+ * may inadvertently be wiped out.
183
+ */
184
+ preserveExternalChanges?: boolean;
174
185
  }
175
186
  /**
176
187
  * Configuration options for a function that applies during function deployment.
177
188
  */
178
189
  export interface DeploymentOptions extends RuntimeOptions {
190
+ /**
191
+ * If true, do not deploy or emulate this function.
192
+ */
193
+ omit?: boolean | Expression<boolean>;
179
194
  /**
180
195
  * Regions where function should be deployed.
181
196
  */
@@ -184,14 +199,4 @@ export interface DeploymentOptions extends RuntimeOptions {
184
199
  * Schedule for the scheduled function.
185
200
  */
186
201
  schedule?: Schedule;
187
- /**
188
- * Controls whether function configuration modified outside of function source is preserved. Defaults to false.
189
- *
190
- * @remarks
191
- * When setting configuration available in the underlying platform that is not yet available in the Firebase Functions
192
- * SDK, we highly recommend setting `preserveExternalChanges` to `true`. Otherwise, when the Firebase Functions SDK releases
193
- * a new version of the SDK with support for the missing configuration, your function's manually configured setting
194
- * may inadvertently be wiped out.
195
- */
196
- preserveExternalChanges?: boolean;
197
202
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_NUMBER_USER_LABELS = exports.INGRESS_SETTINGS_OPTIONS = exports.VPC_EGRESS_SETTINGS_OPTIONS = exports.VALID_MEMORY_OPTIONS = exports.MAX_TIMEOUT_SECONDS = exports.MIN_TIMEOUT_SECONDS = exports.SUPPORTED_REGIONS = exports.RESET_VALUE = void 0;
3
+ exports.MAX_NUMBER_USER_LABELS = exports.DEFAULT_FAILURE_POLICY = exports.INGRESS_SETTINGS_OPTIONS = exports.VPC_EGRESS_SETTINGS_OPTIONS = exports.VALID_MEMORY_OPTIONS = exports.MAX_TIMEOUT_SECONDS = exports.MIN_TIMEOUT_SECONDS = exports.SUPPORTED_REGIONS = exports.RESET_VALUE = void 0;
4
4
  var options_1 = require("../common/options");
5
5
  Object.defineProperty(exports, "RESET_VALUE", { enumerable: true, get: function () { return options_1.RESET_VALUE; } });
6
6
  /**
@@ -67,4 +67,7 @@ exports.INGRESS_SETTINGS_OPTIONS = [
67
67
  "ALLOW_INTERNAL_ONLY",
68
68
  "ALLOW_INTERNAL_AND_GCLB",
69
69
  ];
70
+ exports.DEFAULT_FAILURE_POLICY = {
71
+ retry: {},
72
+ };
70
73
  exports.MAX_NUMBER_USER_LABELS = 58;
@@ -131,6 +131,18 @@ class UserBuilder {
131
131
  const wrappedHandler = (user, context) => handler(user, context);
132
132
  const func = (0, identity_1.wrapHandler)(eventType, wrappedHandler);
133
133
  const legacyEventType = `providers/cloud.auth/eventTypes/user.${eventType}`;
134
+ func.__trigger = {
135
+ labels: {},
136
+ ...(0, cloud_functions_1.optionsToTrigger)(this.options),
137
+ blockingTrigger: {
138
+ eventType: legacyEventType,
139
+ options: {
140
+ accessToken,
141
+ idToken,
142
+ refreshToken,
143
+ },
144
+ },
145
+ };
134
146
  func.__endpoint = {
135
147
  platform: "gcfv1",
136
148
  labels: {},
@@ -50,6 +50,11 @@ function _onRequestWithOptions(handler, options) {
50
50
  const cloudFunction = (req, res) => {
51
51
  return handler(req, res);
52
52
  };
53
+ cloudFunction.__trigger = {
54
+ ...(0, cloud_functions_1.optionsToTrigger)(options),
55
+ httpsTrigger: {},
56
+ };
57
+ (0, encoding_1.convertIfPresent)(cloudFunction.__trigger.httpsTrigger, options, "invoker", "invoker", encoding_1.convertInvoker);
53
58
  // TODO parse the options
54
59
  cloudFunction.__endpoint = {
55
60
  platform: "gcfv1",
@@ -71,6 +76,12 @@ function _onCallWithOptions(handler, options) {
71
76
  enforceAppCheck: options.enforceAppCheck,
72
77
  cors: { origin: true, methods: "POST" },
73
78
  }, fixedLen);
79
+ func.__trigger = {
80
+ labels: {},
81
+ ...(0, cloud_functions_1.optionsToTrigger)(options),
82
+ httpsTrigger: {},
83
+ };
84
+ func.__trigger.labels["deployment-callable"] = "true";
74
85
  func.__endpoint = {
75
86
  platform: "gcfv1",
76
87
  labels: {},
@@ -25,6 +25,8 @@ export interface TaskQueueOptions {
25
25
  export interface TaskQueueFunction {
26
26
  (req: Request, res: express.Response): Promise<void>;
27
27
  /** @alpha */
28
+ __trigger: unknown;
29
+ /** @alpha */
28
30
  __endpoint: ManifestEndpoint;
29
31
  /** @alpha */
30
32
  __requiredAPIs?: ManifestRequiredAPI[];
@@ -41,19 +41,27 @@ class TaskQueueBuilder {
41
41
  * @returns A function you can export and deploy.
42
42
  */
43
43
  onDispatch(handler) {
44
+ var _a, _b;
44
45
  // onEnqueueHandler sniffs the function length of the passed-in callback
45
46
  // and the user could have only tried to listen to data. Wrap their handler
46
47
  // in another handler to avoid accidentally triggering the v2 API
47
48
  const fixedLen = (data, context) => handler(data, context);
48
49
  const func = (0, tasks_1.onDispatchHandler)(fixedLen);
50
+ func.__trigger = {
51
+ ...(0, cloud_functions_1.optionsToTrigger)(this.depOpts || {}),
52
+ taskQueueTrigger: {},
53
+ };
54
+ (0, encoding_1.copyIfPresent)(func.__trigger.taskQueueTrigger, this.tqOpts, "retryConfig");
55
+ (0, encoding_1.copyIfPresent)(func.__trigger.taskQueueTrigger, this.tqOpts, "rateLimits");
56
+ (0, encoding_1.convertIfPresent)(func.__trigger.taskQueueTrigger, this.tqOpts, "invoker", "invoker", encoding_1.convertInvoker);
49
57
  func.__endpoint = {
50
58
  platform: "gcfv1",
51
59
  ...(0, manifest_1.initV1Endpoint)(this.depOpts),
52
60
  ...(0, cloud_functions_1.optionsToEndpoint)(this.depOpts),
53
61
  taskQueueTrigger: (0, manifest_1.initTaskQueueTrigger)(this.depOpts),
54
62
  };
55
- (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, this.tqOpts, "retryConfig");
56
- (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, this.tqOpts, "rateLimits");
63
+ (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger.retryConfig, ((_a = this.tqOpts) === null || _a === void 0 ? void 0 : _a.retryConfig) || {}, "maxAttempts", "maxBackoffSeconds", "maxDoublings", "maxRetrySeconds", "minBackoffSeconds");
64
+ (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger.rateLimits, ((_b = this.tqOpts) === null || _b === void 0 ? void 0 : _b.rateLimits) || {}, "maxConcurrentDispatches", "maxDispatchesPerSecond");
57
65
  (0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, this.tqOpts, "invoker", "invoker", encoding_1.convertInvoker);
58
66
  func.__requiredAPIs = [
59
67
  {
package/lib/v2/core.d.ts CHANGED
@@ -37,6 +37,8 @@ export interface CloudEvent<T> {
37
37
  export interface CloudFunction<EventType extends CloudEvent<unknown>> {
38
38
  (raw: CloudEvent<unknown>): any | Promise<any>;
39
39
  /** @alpha */
40
+ __trigger?: unknown;
41
+ /** @alpha */
40
42
  __endpoint: ManifestEndpoint;
41
43
  /**
42
44
  * The callback passed to the CloudFunction constructor.
@@ -23,6 +23,10 @@ export declare type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLO
23
23
  * These options are common to HTTPS and Event handling functions.
24
24
  */
25
25
  export interface GlobalOptions {
26
+ /**
27
+ * If true, do not deploy or emulate this function.
28
+ */
29
+ omit?: boolean | Expression<boolean>;
26
30
  /**
27
31
  * Region where functions should be deployed.
28
32
  */
package/lib/v2/options.js CHANGED
@@ -21,7 +21,7 @@
21
21
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.__getSpec = exports.optionsToEndpoint = exports.getGlobalOptions = exports.setGlobalOptions = exports.RESET_VALUE = void 0;
24
+ exports.__getSpec = exports.optionsToEndpoint = exports.optionsToTriggerAnnotations = exports.getGlobalOptions = exports.setGlobalOptions = exports.RESET_VALUE = void 0;
25
25
  /**
26
26
  * Options to configure cloud functions.
27
27
  * @packageDocumentation
@@ -65,13 +65,37 @@ function getGlobalOptions() {
65
65
  return globalOptions || {};
66
66
  }
67
67
  exports.getGlobalOptions = getGlobalOptions;
68
+ /**
69
+ * Apply GlobalOptions to trigger definitions.
70
+ * @internal
71
+ */
72
+ function optionsToTriggerAnnotations(opts) {
73
+ const annotation = {};
74
+ (0, encoding_1.copyIfPresent)(annotation, opts, "concurrency", "minInstances", "maxInstances", "ingressSettings", "labels", "vpcConnector", "vpcConnectorEgressSettings", "secrets");
75
+ (0, encoding_1.convertIfPresent)(annotation, opts, "availableMemoryMb", "memory", (mem) => {
76
+ return MemoryOptionToMB[mem];
77
+ });
78
+ (0, encoding_1.convertIfPresent)(annotation, opts, "regions", "region", (region) => {
79
+ if (typeof region === "string") {
80
+ return [region];
81
+ }
82
+ return region;
83
+ });
84
+ (0, encoding_1.convertIfPresent)(annotation, opts, "serviceAccountEmail", "serviceAccount", encoding_1.serviceAccountFromShorthand);
85
+ (0, encoding_1.convertIfPresent)(annotation, opts, "timeout", "timeoutSeconds", encoding_1.durationFromSeconds);
86
+ (0, encoding_1.convertIfPresent)(annotation, opts, "failurePolicy", "retry", (retry) => {
87
+ return retry ? { retry: true } : null;
88
+ });
89
+ return annotation;
90
+ }
91
+ exports.optionsToTriggerAnnotations = optionsToTriggerAnnotations;
68
92
  /**
69
93
  * Apply GlobalOptions to endpoint manifest.
70
94
  * @internal
71
95
  */
72
96
  function optionsToEndpoint(opts) {
73
97
  const endpoint = {};
74
- (0, encoding_1.copyIfPresent)(endpoint, opts, "concurrency", "minInstances", "maxInstances", "ingressSettings", "labels", "timeoutSeconds", "cpu");
98
+ (0, encoding_1.copyIfPresent)(endpoint, opts, "omit", "concurrency", "minInstances", "maxInstances", "ingressSettings", "labels", "timeoutSeconds", "cpu");
75
99
  (0, encoding_1.convertIfPresent)(endpoint, opts, "serviceAccountEmail", "serviceAccount");
76
100
  if (opts.vpcConnector !== undefined) {
77
101
  if (opts.vpcConnector === null || opts.vpcConnector instanceof options_1.ResetValue) {
@@ -40,6 +40,10 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
40
40
  alertType: AlertType;
41
41
  /** Scope the function to trigger on a specific application. */
42
42
  appId?: string;
43
+ /**
44
+ * If true, do not deploy or emulate this function.
45
+ */
46
+ omit?: boolean | Expression<boolean>;
43
47
  /**
44
48
  * Region where functions should be deployed.
45
49
  */
@@ -26,8 +26,6 @@ export interface NewTesterDevicePayload {
26
26
  /**
27
27
  * The internal payload object for receiving in-app feedback from a tester.
28
28
  * Payload is wrapped inside a `FirebaseAlertData` object.
29
- *
30
- * @alpha
31
29
  */
32
30
  export interface InAppFeedbackPayload {
33
31
  ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroInAppFeedbackPayload";
@@ -65,6 +63,10 @@ export interface AppDistributionEvent<T> extends CloudEvent<FirebaseAlertData<T>
65
63
  export interface AppDistributionOptions extends options.EventHandlerOptions {
66
64
  /** Scope the function to trigger on a specific application. */
67
65
  appId?: string;
66
+ /**
67
+ * If true, do not deploy or emulate this function.
68
+ */
69
+ omit?: boolean | Expression<boolean>;
68
70
  /**
69
71
  * Region where functions should be deployed.
70
72
  */
@@ -166,8 +168,6 @@ export declare function onNewTesterIosDevicePublished(opts: AppDistributionOptio
166
168
  * Declares a function that can handle receiving new in-app feedback from a tester.
167
169
  * @param handler - Event handler which is run every time new feedback is received.
168
170
  * @returns A function that you can export and deploy.
169
- *
170
- * @alpha
171
171
  */
172
172
  export declare function onInAppFeedbackPublished(handler: (event: AppDistributionEvent<InAppFeedbackPayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>;
173
173
  /**
@@ -175,8 +175,6 @@ export declare function onInAppFeedbackPublished(handler: (event: AppDistributio
175
175
  * @param appId - A specific application the handler will trigger on.
176
176
  * @param handler - Event handler which is run every time new feedback is received.
177
177
  * @returns A function that you can export and deploy.
178
- *
179
- * @alpha
180
178
  */
181
179
  export declare function onInAppFeedbackPublished(appId: string, handler: (event: AppDistributionEvent<InAppFeedbackPayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>;
182
180
  /**
@@ -184,7 +182,5 @@ export declare function onInAppFeedbackPublished(appId: string, handler: (event:
184
182
  * @param opts - Options that can be set on the function.
185
183
  * @param handler - Event handler which is run every time new feedback is received.
186
184
  * @returns A function that you can export and deploy.
187
- *
188
- * @alpha
189
185
  */
190
186
  export declare function onInAppFeedbackPublished(opts: AppDistributionOptions, handler: (event: AppDistributionEvent<InAppFeedbackPayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<InAppFeedbackPayload>>;
@@ -53,8 +53,6 @@ exports.onNewTesterIosDevicePublished = onNewTesterIosDevicePublished;
53
53
  * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
54
54
  * @param handler - Event handler which is run every time new feedback is received.
55
55
  * @returns A function that you can export and deploy.
56
- *
57
- * @alpha
58
56
  */
59
57
  function onInAppFeedbackPublished(appIdOrOptsOrHandler, handler) {
60
58
  if (typeof appIdOrOptsOrHandler === "function") {
@@ -129,6 +129,10 @@ export interface CrashlyticsEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
129
129
  export interface CrashlyticsOptions extends options.EventHandlerOptions {
130
130
  /** Scope the function to trigger on a specific application. */
131
131
  appId?: string;
132
+ /**
133
+ * If true, do not deploy or emulate this function.
134
+ */
135
+ omit?: boolean | Expression<boolean>;
132
136
  /**
133
137
  * Region where functions should be deployed.
134
138
  */
@@ -51,6 +51,10 @@ export interface ReferenceOptions<Ref extends string = string> extends options.E
51
51
  * Note: The capture syntax cannot be used for 'instance'.
52
52
  */
53
53
  instance?: string;
54
+ /**
55
+ * If true, do not deploy or emulate this function.
56
+ */
57
+ omit?: boolean | Expression<boolean>;
54
58
  /**
55
59
  * Region where functions should be deployed.
56
60
  */
@@ -28,6 +28,10 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions {
28
28
  * Eventarc event exact match filter.
29
29
  */
30
30
  filters?: Record<string, string>;
31
+ /**
32
+ * If true, do not deploy or emulate this function.
33
+ */
34
+ omit?: boolean | Expression<boolean>;
31
35
  /**
32
36
  * Region where functions should be deployed.
33
37
  */
@@ -11,6 +11,10 @@ export { Request, CallableRequest, FunctionsErrorCode, HttpsError };
11
11
  * Options that can be set on an onRequest HTTPS function.
12
12
  */
13
13
  export interface HttpsOptions extends Omit<GlobalOptions, "region"> {
14
+ /**
15
+ * If true, do not deploy or emulate this function.
16
+ */
17
+ omit?: boolean | Expression<boolean>;
14
18
  /** HTTP functions can override global options and can specify multiple regions to deploy to. */
15
19
  region?: SupportedRegion | string | Array<SupportedRegion | string>;
16
20
  /** If true, allows CORS on requests to this function.
@@ -114,6 +118,8 @@ export declare type HttpsFunction = ((
114
118
  req: Request,
115
119
  /** An Express response object, for this function to respond to callers. */
116
120
  res: express.Response) => void | Promise<void>) & {
121
+ /** @alpha */
122
+ __trigger?: unknown;
117
123
  /** @alpha */
118
124
  __endpoint: ManifestEndpoint;
119
125
  };
@@ -56,6 +56,28 @@ function onRequest(optsOrHandler, handler) {
56
56
  };
57
57
  }
58
58
  handler = (0, trace_1.wrapTraceContext)(handler);
59
+ Object.defineProperty(handler, "__trigger", {
60
+ get: () => {
61
+ const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
62
+ // global options calls region a scalar and https allows it to be an array,
63
+ // but optionsToTriggerAnnotations handles both cases.
64
+ const specificOpts = options.optionsToTriggerAnnotations(opts);
65
+ const trigger = {
66
+ platform: "gcfv2",
67
+ ...baseOpts,
68
+ ...specificOpts,
69
+ labels: {
70
+ ...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
71
+ ...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
72
+ },
73
+ httpsTrigger: {
74
+ allowInsecure: false,
75
+ },
76
+ };
77
+ (0, encoding_1.convertIfPresent)(trigger.httpsTrigger, opts, "invoker", "invoker", encoding_1.convertInvoker);
78
+ return trigger;
79
+ },
80
+ });
59
81
  const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
60
82
  // global options calls region a scalar and https allows it to be an array,
61
83
  // but optionsToTriggerAnnotations handles both cases.
@@ -94,6 +116,27 @@ function onCall(optsOrHandler, handler) {
94
116
  cors: { origin, methods: "POST" },
95
117
  enforceAppCheck: (_a = opts.enforceAppCheck) !== null && _a !== void 0 ? _a : options.getGlobalOptions().enforceAppCheck,
96
118
  }, fixedLen);
119
+ Object.defineProperty(func, "__trigger", {
120
+ get: () => {
121
+ const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
122
+ // global options calls region a scalar and https allows it to be an array,
123
+ // but optionsToTriggerAnnotations handles both cases.
124
+ const specificOpts = options.optionsToTriggerAnnotations(opts);
125
+ return {
126
+ platform: "gcfv2",
127
+ ...baseOpts,
128
+ ...specificOpts,
129
+ labels: {
130
+ ...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
131
+ ...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
132
+ "deployment-callable": "true",
133
+ },
134
+ httpsTrigger: {
135
+ allowInsecure: false,
136
+ },
137
+ };
138
+ },
139
+ });
97
140
  const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
98
141
  // global options calls region a scalar and https allows it to be an array,
99
142
  // but optionsToEndpoint handles both cases.
@@ -26,6 +26,10 @@ export interface BlockingOptions {
26
26
  accessToken?: boolean;
27
27
  /** Pass the Refresh Token credential to the function. */
28
28
  refreshToken?: boolean;
29
+ /**
30
+ * If true, do not deploy or emulate this function.
31
+ */
32
+ omit?: boolean | Expression<boolean>;
29
33
  /**
30
34
  * Region where functions should be deployed.
31
35
  */
@@ -84,6 +84,10 @@ export interface MessagePublishedData<T = any> {
84
84
  export interface PubSubOptions extends options.EventHandlerOptions {
85
85
  /** The Pub/Sub topic to watch for message events */
86
86
  topic: string;
87
+ /**
88
+ * If true, do not deploy or emulate this function.
89
+ */
90
+ omit?: boolean | Expression<boolean>;
87
91
  /**
88
92
  * Region where functions should be deployed.
89
93
  */
@@ -128,6 +128,25 @@ function onMessagePublished(topicOrOptions, handler) {
128
128
  return (0, trace_1.wrapTraceContext)(handler)(raw);
129
129
  };
130
130
  func.run = handler;
131
+ Object.defineProperty(func, "__trigger", {
132
+ get: () => {
133
+ const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
134
+ const specificOpts = options.optionsToTriggerAnnotations(opts);
135
+ return {
136
+ platform: "gcfv2",
137
+ ...baseOpts,
138
+ ...specificOpts,
139
+ labels: {
140
+ ...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
141
+ ...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
142
+ },
143
+ eventTrigger: {
144
+ eventType: "google.cloud.pubsub.topic.v1.messagePublished",
145
+ resource: `projects/${process.env.GCLOUD_PROJECT}/topics/${topic}`,
146
+ },
147
+ };
148
+ },
149
+ });
131
150
  const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
132
151
  const specificOpts = options.optionsToEndpoint(opts);
133
152
  const endpoint = {
@@ -38,11 +38,13 @@ function getOpts(args) {
38
38
  return {
39
39
  schedule: args.schedule,
40
40
  timeZone: args.timeZone,
41
- retryCount: args.retryCount,
42
- maxRetrySeconds: args.maxRetrySeconds,
43
- minBackoffSeconds: args.minBackoffSeconds,
44
- maxBackoffSeconds: args.maxBackoffSeconds,
45
- maxDoublings: args.maxDoublings,
41
+ retryConfig: {
42
+ retryCount: args.retryCount,
43
+ maxRetrySeconds: args.maxRetrySeconds,
44
+ minBackoffSeconds: args.minBackoffSeconds,
45
+ maxBackoffSeconds: args.maxBackoffSeconds,
46
+ maxDoublings: args.maxDoublings,
47
+ },
46
48
  opts: args,
47
49
  };
48
50
  }
@@ -87,7 +89,7 @@ function onSchedule(args, handler) {
87
89
  scheduleTrigger: (0, manifest_1.initV2ScheduleTrigger)(separatedOpts.schedule, globalOpts, separatedOpts.opts),
88
90
  };
89
91
  (0, encoding_1.copyIfPresent)(ep.scheduleTrigger, separatedOpts, "timeZone");
90
- (0, encoding_1.copyIfPresent)(ep.scheduleTrigger.retryConfig, separatedOpts, "retryCount", "maxRetrySeconds", "minBackoffSeconds", "maxBackoffSeconds", "maxDoublings");
92
+ (0, encoding_1.copyIfPresent)(ep.scheduleTrigger.retryConfig, separatedOpts.retryConfig, "retryCount", "maxRetrySeconds", "minBackoffSeconds", "maxBackoffSeconds", "maxDoublings");
91
93
  func.__endpoint = ep;
92
94
  func.__requiredAPIs = [
93
95
  {
@@ -160,6 +160,10 @@ export interface StorageEvent extends CloudEvent<StorageObjectData> {
160
160
  export interface StorageOptions extends options.EventHandlerOptions {
161
161
  /** The name of the bucket containing this object. */
162
162
  bucket?: string;
163
+ /**
164
+ * If true, do not deploy or emulate this function.
165
+ */
166
+ omit?: boolean | Expression<boolean>;
163
167
  /**
164
168
  * Region where functions should be deployed.
165
169
  */
@@ -105,6 +105,25 @@ function onOperation(eventType, bucketOrOptsOrHandler, handler) {
105
105
  return (0, trace_1.wrapTraceContext)(handler)(raw);
106
106
  };
107
107
  func.run = handler;
108
+ Object.defineProperty(func, "__trigger", {
109
+ get: () => {
110
+ const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
111
+ const specificOpts = options.optionsToTriggerAnnotations(opts);
112
+ return {
113
+ platform: "gcfv2",
114
+ ...baseOpts,
115
+ ...specificOpts,
116
+ labels: {
117
+ ...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
118
+ ...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
119
+ },
120
+ eventTrigger: {
121
+ eventType,
122
+ resource: bucket, // TODO(colerogers): replace with 'bucket,' eventually
123
+ },
124
+ };
125
+ },
126
+ });
108
127
  // TypeScript doesn't recognize defineProperty as adding a property and complains
109
128
  // that __endpoint doesn't exist. We can either cast to any and lose all type safety
110
129
  // or we can just assign a meaningless value before calling defineProperty.
@@ -19,6 +19,10 @@ export interface TaskQueueOptions extends options.EventHandlerOptions {
19
19
  * will have permissions.
20
20
  */
21
21
  invoker?: "private" | string | string[];
22
+ /**
23
+ * If true, do not deploy or emulate this function.
24
+ */
25
+ omit?: boolean | Expression<boolean>;
22
26
  /**
23
27
  * Region where functions should be deployed.
24
28
  */
@@ -44,8 +44,28 @@ function onTaskDispatched(optsOrHandler, handler) {
44
44
  // fix the length to prevent api versions from being mismatched.
45
45
  const fixedLen = (req) => handler(req);
46
46
  const func = (0, trace_1.wrapTraceContext)((0, tasks_1.onDispatchHandler)(fixedLen));
47
- const globalOpts = options.getGlobalOptions();
48
- const baseOpts = options.optionsToEndpoint(globalOpts);
47
+ Object.defineProperty(func, "__trigger", {
48
+ get: () => {
49
+ const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
50
+ // global options calls region a scalar and https allows it to be an array,
51
+ // but optionsToTriggerAnnotations handles both cases.
52
+ const specificOpts = options.optionsToTriggerAnnotations(opts);
53
+ const taskQueueTrigger = {};
54
+ (0, encoding_1.copyIfPresent)(taskQueueTrigger, opts, "retryConfig", "rateLimits");
55
+ (0, encoding_1.convertIfPresent)(taskQueueTrigger, opts, "invoker", "invoker", encoding_1.convertInvoker);
56
+ return {
57
+ platform: "gcfv2",
58
+ ...baseOpts,
59
+ ...specificOpts,
60
+ labels: {
61
+ ...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
62
+ ...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
63
+ },
64
+ taskQueueTrigger,
65
+ };
66
+ },
67
+ });
68
+ const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
49
69
  // global options calls region a scalar and https allows it to be an array,
50
70
  // but optionsToManifestEndpoint handles both cases.
51
71
  const specificOpts = options.optionsToEndpoint(opts);
@@ -60,8 +80,8 @@ function onTaskDispatched(optsOrHandler, handler) {
60
80
  },
61
81
  taskQueueTrigger: (0, manifest_1.initTaskQueueTrigger)(options.getGlobalOptions(), opts),
62
82
  };
63
- (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts, "retryConfig");
64
- (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts, "rateLimits");
83
+ (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger.retryConfig, opts.retryConfig, "maxAttempts", "maxBackoffSeconds", "maxDoublings", "maxRetrySeconds", "minBackoffSeconds");
84
+ (0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger.rateLimits, opts.rateLimits, "maxConcurrentDispatches", "maxDispatchesPerSecond");
65
85
  (0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, opts, "invoker", "invoker", encoding_1.convertInvoker);
66
86
  func.__requiredAPIs = [
67
87
  {
@@ -22,6 +22,7 @@
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.onTestMatrixCompleted = exports.eventType = void 0;
25
+ const manifest_1 = require("../../runtime/manifest");
25
26
  const options_1 = require("../options");
26
27
  const trace_1 = require("../trace");
27
28
  /** @internal */
@@ -46,6 +47,7 @@ function onTestMatrixCompleted(optsOrHandler, handler) {
46
47
  };
47
48
  func.run = handler;
48
49
  const ep = {
50
+ ...(0, manifest_1.initV2Endpoint)((0, options_1.getGlobalOptions)(), optsOrHandler),
49
51
  platform: "gcfv2",
50
52
  ...baseOpts,
51
53
  ...specificOpts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-functions",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "Firebase SDK for Cloud Functions",
5
5
  "keywords": [
6
6
  "firebase",
@@ -36,6 +36,7 @@
36
36
  "./v1/auth": "./lib/v1/providers/auth.js",
37
37
  "./v1/database": "./lib/v1/providers/database.js",
38
38
  "./v1/firestore": "./lib/v1/providers/firestore.js",
39
+ "./v1/https": "./lib/v1/providers/https.js",
39
40
  "./v1/pubsub": "./lib/v1/providers/pubsub.js",
40
41
  "./v1/remoteConfig": "./lib/v1/providers/remoteConfig.js",
41
42
  "./v1/storage": "./lib/v1/providers/storage.js",
@@ -75,31 +76,34 @@
75
76
  "lib/v1"
76
77
  ],
77
78
  "v1/analytics": [
78
- "./lib/v1/providers/analytics"
79
+ "lib/v1/providers/analytics"
79
80
  ],
80
81
  "v1/auth": [
81
- "./lib/v1/providers/auth"
82
+ "lib/v1/providers/auth"
82
83
  ],
83
84
  "v1/database": [
84
- "./lib/v1/privders/database"
85
+ "lib/v1/privders/database"
85
86
  ],
86
87
  "v1/firestore": [
87
- "./lib/v1/providers/firestore"
88
+ "lib/v1/providers/firestore"
89
+ ],
90
+ "v1/https": [
91
+ "./lib/v1/providers/https"
88
92
  ],
89
93
  "v1/pubsub": [
90
- "./lib/v1/providers/pubsub"
94
+ "lib/v1/providers/pubsub"
91
95
  ],
92
- "/v1/remoteConfig": [
93
- "./lib/v1/providers/remoteConfig"
96
+ "v1/remoteConfig": [
97
+ "lib/v1/providers/remoteConfig"
94
98
  ],
95
- "/v1/storage": [
96
- "./lib/v1/providers/storage"
99
+ "v1/storage": [
100
+ "lib/v1/providers/storage"
97
101
  ],
98
- "/v1/tasks": [
99
- "./lib/v1/providers/tasks"
102
+ "v1/tasks": [
103
+ "lib/v1/providers/tasks"
100
104
  ],
101
- "/v1/testLab": [
102
- "./lib/v1/providers/testLab"
105
+ "v1/testLab": [
106
+ "lib/v1/providers/testLab"
103
107
  ],
104
108
  "v2": [
105
109
  "lib/v2"