firebase-functions 4.5.0 → 4.7.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.
@@ -1,5 +1,12 @@
1
1
  import { App } from "firebase-admin/app";
2
2
  import * as database from "firebase-admin/database";
3
+ /**
4
+ * Pulled from @firebase/database-types, make sure the interface is updated on dependencies upgrades.
5
+ * Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
6
+ */
7
+ interface IteratedDataSnapshot extends DataSnapshot {
8
+ key: string;
9
+ }
3
10
  /**
4
11
  * Interface representing a Firebase Realtime database data snapshot.
5
12
  */
@@ -97,7 +104,7 @@ export declare class DataSnapshot implements database.DataSnapshot {
97
104
  * @return `true` if enumeration was canceled due to your callback
98
105
  * returning `true`.
99
106
  */
100
- forEach(action: (a: DataSnapshot) => boolean | void): boolean;
107
+ forEach(action: (a: IteratedDataSnapshot) => boolean | void): boolean;
101
108
  /**
102
109
  * Returns `true` if the specified child path has (non-`null`) data.
103
110
  *
@@ -141,3 +148,4 @@ export declare class DataSnapshot implements database.DataSnapshot {
141
148
  /** @hidden */
142
149
  private _fullPath;
143
150
  }
151
+ export {};
@@ -101,6 +101,9 @@ class DataSnapshot {
101
101
  let source = this._data;
102
102
  if (parts.length) {
103
103
  for (const part of parts) {
104
+ if (source[part] === undefined) {
105
+ return null;
106
+ }
104
107
  source = source[part];
105
108
  }
106
109
  }
@@ -9,16 +9,17 @@ export { HttpsError };
9
9
  */
10
10
  export type AuthBlockingEventType = "beforeCreate" | "beforeSignIn";
11
11
  /**
12
- * The UserRecord passed to Cloud Functions is the same UserRecord that is returned by the Firebase Admin
13
- * SDK.
12
+ * The `UserRecord` passed to Cloud Functions is the same
13
+ * {@link https://firebase.google.com/docs/reference/admin/node/firebase-admin.auth.userrecord | UserRecord}
14
+ * that is returned by the Firebase Admin SDK.
14
15
  */
15
16
  export type UserRecord = auth.UserRecord;
16
17
  /**
17
- * UserInfo that is part of the UserRecord
18
+ * `UserInfo` that is part of the `UserRecord`.
18
19
  */
19
20
  export type UserInfo = auth.UserInfo;
20
21
  /**
21
- * Helper class to create the user metadata in a UserRecord object
22
+ * Helper class to create the user metadata in a `UserRecord` object.
22
23
  */
23
24
  export declare class UserRecordMetadata implements auth.UserMetadata {
24
25
  creationTime: string;
@@ -28,13 +29,13 @@ export declare class UserRecordMetadata implements auth.UserMetadata {
28
29
  toJSON(): AuthUserMetadata;
29
30
  }
30
31
  /**
31
- * Helper function that creates a UserRecord Class from data sent over the wire.
32
+ * Helper function that creates a `UserRecord` class from data sent over the wire.
32
33
  * @param wireData data sent over the wire
33
- * @returns an instance of UserRecord with correct toJSON functions
34
+ * @returns an instance of `UserRecord` with correct toJSON functions
34
35
  */
35
36
  export declare function userRecordConstructor(wireData: Record<string, unknown>): UserRecord;
36
37
  /**
37
- * User info that is part of the AuthUserRecord
38
+ * User info that is part of the `AuthUserRecord`.
38
39
  */
39
40
  export interface AuthUserInfo {
40
41
  /**
@@ -110,7 +111,7 @@ export interface AuthMultiFactorSettings {
110
111
  enrolledFactors: AuthMultiFactorInfo[];
111
112
  }
112
113
  /**
113
- * The UserRecord passed to auth blocking Cloud Functions from the identity platform.
114
+ * The `UserRecord` passed to auth blocking functions from the identity platform.
114
115
  */
115
116
  export interface AuthUserRecord {
116
117
  /**
@@ -205,7 +206,7 @@ export interface AuthEventContext extends EventContext {
205
206
  additionalUserInfo?: AdditionalUserInfo;
206
207
  credential?: Credential;
207
208
  }
208
- /** Defines the auth event for v2 blocking events */
209
+ /** Defines the auth event for 2nd gen blocking events */
209
210
  export interface AuthBlockingEvent extends AuthEventContext {
210
211
  data: AuthUserRecord;
211
212
  }
@@ -213,7 +214,7 @@ export interface AuthBlockingEvent extends AuthEventContext {
213
214
  * The reCAPTCHA action options.
214
215
  */
215
216
  export type RecaptchaActionOptions = "ALLOW" | "BLOCK";
216
- /** The handler response type for beforeCreate blocking events */
217
+ /** The handler response type for `beforeCreate` blocking events */
217
218
  export interface BeforeCreateResponse {
218
219
  displayName?: string;
219
220
  disabled?: boolean;
@@ -222,7 +223,7 @@ export interface BeforeCreateResponse {
222
223
  customClaims?: object;
223
224
  recaptchaActionOverride?: RecaptchaActionOptions;
224
225
  }
225
- /** The handler response type for beforeSignIn blocking events */
226
+ /** The handler response type for `beforeSignIn` blocking events */
226
227
  export interface BeforeSignInResponse extends BeforeCreateResponse {
227
228
  sessionClaims?: object;
228
229
  }
@@ -51,7 +51,7 @@ const EVENT_MAPPING = {
51
51
  beforeSignIn: "providers/cloud.auth/eventTypes/user.beforeSignIn",
52
52
  };
53
53
  /**
54
- * Helper class to create the user metadata in a UserRecord object
54
+ * Helper class to create the user metadata in a `UserRecord` object.
55
55
  */
56
56
  class UserRecordMetadata {
57
57
  constructor(creationTime, lastSignInTime) {
@@ -68,9 +68,9 @@ class UserRecordMetadata {
68
68
  }
69
69
  exports.UserRecordMetadata = UserRecordMetadata;
70
70
  /**
71
- * Helper function that creates a UserRecord Class from data sent over the wire.
71
+ * Helper function that creates a `UserRecord` class from data sent over the wire.
72
72
  * @param wireData data sent over the wire
73
- * @returns an instance of UserRecord with correct toJSON functions
73
+ * @returns an instance of `UserRecord` with correct toJSON functions
74
74
  */
75
75
  function userRecordConstructor(wireData) {
76
76
  // Falsey values from the wire format proto get lost when converted to JSON, this adds them back.
@@ -122,7 +122,7 @@ function userRecordConstructor(wireData) {
122
122
  }
123
123
  exports.userRecordConstructor = userRecordConstructor;
124
124
  /**
125
- * Checks for a valid identity platform web request, otherwise throws an HttpsError
125
+ * Checks for a valid identity platform web request, otherwise throws an HttpsError.
126
126
  * @internal
127
127
  */
128
128
  function isValidRequest(req) {
@@ -156,7 +156,7 @@ function unsafeDecodeAuthBlockingToken(token) {
156
156
  return decoded;
157
157
  }
158
158
  /**
159
- * Helper function to parse the decoded metadata object into a UserMetaData object
159
+ * Helper function to parse the decoded metadata object into a `UserMetaData` object
160
160
  * @internal
161
161
  */
162
162
  function parseMetadata(metadata) {
@@ -173,7 +173,7 @@ function parseMetadata(metadata) {
173
173
  }
174
174
  exports.parseMetadata = parseMetadata;
175
175
  /**
176
- * Helper function to parse the decoded user info array into an AuthUserInfo array
176
+ * Helper function to parse the decoded user info array into an `AuthUserInfo` array.
177
177
  * @internal
178
178
  */
179
179
  function parseProviderData(providerData) {
@@ -192,7 +192,7 @@ function parseProviderData(providerData) {
192
192
  }
193
193
  exports.parseProviderData = parseProviderData;
194
194
  /**
195
- * Helper function to parse the date into a UTC string
195
+ * Helper function to parse the date into a UTC string.
196
196
  * @internal
197
197
  */
198
198
  function parseDate(tokensValidAfterTime) {
@@ -276,7 +276,7 @@ function parseAuthUserRecord(decodedJWTUserRecord) {
276
276
  };
277
277
  }
278
278
  exports.parseAuthUserRecord = parseAuthUserRecord;
279
- /** Helper to get the AdditionalUserInfo from the decoded jwt */
279
+ /** Helper to get the `AdditionalUserInfo` from the decoded JWT */
280
280
  function parseAdditionalUserInfo(decodedJWT) {
281
281
  let profile;
282
282
  let username;
@@ -327,7 +327,7 @@ function generateResponsePayload(authResponse) {
327
327
  return result;
328
328
  }
329
329
  exports.generateResponsePayload = generateResponsePayload;
330
- /** Helper to get the Credential from the decoded jwt */
330
+ /** Helper to get the Credential from the decoded JWT */
331
331
  function parseAuthCredential(decodedJWT, time) {
332
332
  if (!decodedJWT.sign_in_attributes &&
333
333
  !decodedJWT.oauth_id_token &&
@@ -61,8 +61,8 @@ export interface TaskContext {
61
61
  /**
62
62
  * The "short" name of the task, or, if no name was specified at creation, a unique
63
63
  * system-generated id.
64
- * This is the my-task-id value in the complete task name, ie, task_name =
65
- * projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id.
64
+ * This is the "my-task-id" value in the complete task name, such as "task_name =
65
+ * projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id."
66
66
  * Populated via the `X-CloudTasks-TaskName` header.
67
67
  */
68
68
  id: string;
@@ -3,6 +3,7 @@
3
3
  * @alpha
4
4
  */
5
5
  import { BooleanParam, Expression, IntParam, Param, ParamOptions, SecretParam, StringParam, ListParam } from "./types";
6
+ export { BUCKET_PICKER, TextInput, SelectInput, SelectOptions, MultiSelectInput, select, multiSelect, } from "./types";
6
7
  export { ParamOptions, Expression };
7
8
  type SecretOrExpr = Param<any> | SecretParam;
8
9
  export declare const declaredParams: SecretOrExpr[];
@@ -21,13 +21,17 @@
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.defineList = exports.defineFloat = exports.defineInt = exports.defineBoolean = exports.defineString = exports.defineSecret = exports.storageBucket = exports.gcloudProject = exports.projectID = exports.databaseURL = exports.clearParams = exports.declaredParams = exports.Expression = void 0;
24
+ exports.defineList = exports.defineFloat = exports.defineInt = exports.defineBoolean = exports.defineString = exports.defineSecret = exports.storageBucket = exports.gcloudProject = exports.projectID = exports.databaseURL = exports.clearParams = exports.declaredParams = exports.Expression = exports.multiSelect = exports.select = exports.BUCKET_PICKER = void 0;
25
25
  /**
26
26
  * @hidden
27
27
  * @alpha
28
28
  */
29
29
  const types_1 = require("./types");
30
30
  Object.defineProperty(exports, "Expression", { enumerable: true, get: function () { return types_1.Expression; } });
31
+ var types_2 = require("./types");
32
+ Object.defineProperty(exports, "BUCKET_PICKER", { enumerable: true, get: function () { return types_2.BUCKET_PICKER; } });
33
+ Object.defineProperty(exports, "select", { enumerable: true, get: function () { return types_2.select; } });
34
+ Object.defineProperty(exports, "multiSelect", { enumerable: true, get: function () { return types_2.multiSelect; } });
31
35
  exports.declaredParams = [];
32
36
  /**
33
37
  * Use a helper to manage the list such that params are uniquely
@@ -30,33 +30,35 @@ export declare class CompareExpression<T extends string | number | boolean | str
30
30
  }
31
31
  /** @hidden */
32
32
  type ParamValueType = "string" | "list" | "boolean" | "int" | "float" | "secret";
33
- type ParamInput<T> = {
34
- text: TextInput<T>;
35
- } | {
36
- select: SelectInput<T>;
37
- } | {
38
- multiSelect: MultiSelectInput;
39
- } | {
40
- resource: ResourceInput;
41
- };
33
+ /** Create a select input from a series of values. */
34
+ export declare function select<T>(options: T[]): SelectInput<T>;
35
+ /** Create a select input from a map of labels to vaues. */
36
+ export declare function select<T>(optionsWithLabels: Record<string, T>): SelectInput<T>;
37
+ /** Create a multi-select input from a series of values. */
38
+ export declare function multiSelect(options: string[]): MultiSelectInput;
39
+ /** Create a multi-select input from map of labels to values. */
40
+ export declare function multiSelect(options: Record<string, string>): MultiSelectInput;
41
+ type ParamInput<T> = TextInput<T> | SelectInput<T> | (T extends string[] ? MultiSelectInput : never) | (T extends string ? ResourceInput : never);
42
42
  /**
43
43
  * Specifies that a Param's value should be determined by prompting the user
44
44
  * to type it in interactively at deploy-time. Input that does not match the
45
45
  * provided validationRegex, if present, will be retried.
46
46
  */
47
47
  export interface TextInput<T = unknown> {
48
- example?: string;
49
- /**
50
- * A regular expression (or an escaped string to compile into a regular
51
- * expression) which the prompted text must satisfy; the prompt will retry
52
- * until input matching the regex is provided.
53
- */
54
- validationRegex?: string | RegExp;
55
- /**
56
- * A custom error message to display when retrying the prompt based on input
57
- * failing to conform to the validationRegex,
58
- */
59
- validationErrorMessage?: string;
48
+ text: {
49
+ example?: string;
50
+ /**
51
+ * A regular expression (or an escaped string to compile into a regular
52
+ * expression) which the prompted text must satisfy; the prompt will retry
53
+ * until input matching the regex is provided.
54
+ */
55
+ validationRegex?: string | RegExp;
56
+ /**
57
+ * A custom error message to display when retrying the prompt based on input
58
+ * failing to conform to the validationRegex,
59
+ */
60
+ validationErrorMessage?: string;
61
+ };
60
62
  }
61
63
  /**
62
64
  * Specifies that a Param's value should be determined by having the user
@@ -65,15 +67,18 @@ export interface TextInput<T = unknown> {
65
67
  */
66
68
  export interface ResourceInput {
67
69
  resource: {
68
- type: string;
70
+ type: "storage.googleapis.com/Bucket";
69
71
  };
70
72
  }
73
+ export declare const BUCKET_PICKER: ResourceInput;
71
74
  /**
72
75
  * Specifies that a Param's value should be determined by having the user select
73
76
  * from a list of pre-canned options interactively at deploy-time.
74
77
  */
75
78
  export interface SelectInput<T = unknown> {
76
- options: Array<SelectOptions<T>>;
79
+ select: {
80
+ options: Array<SelectOptions<T>>;
81
+ };
77
82
  }
78
83
  /**
79
84
  * Specifies that a Param's value should be determined by having the user select
@@ -81,7 +86,9 @@ export interface SelectInput<T = unknown> {
81
86
  * Will result in errors if used on Params of type other than string[].
82
87
  */
83
88
  export interface MultiSelectInput {
84
- options: Array<SelectOptions<string>>;
89
+ multiSelect: {
90
+ options: Array<SelectOptions<string>>;
91
+ };
85
92
  }
86
93
  /**
87
94
  * One of the options provided to a SelectInput, containing a value and
@@ -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.ListParam = exports.BooleanParam = exports.FloatParam = exports.IntParam = exports.InternalExpression = exports.StringParam = exports.SecretParam = exports.Param = exports.CompareExpression = exports.TernaryExpression = exports.Expression = void 0;
24
+ exports.ListParam = exports.BooleanParam = exports.FloatParam = exports.IntParam = exports.InternalExpression = exports.StringParam = exports.SecretParam = exports.Param = exports.BUCKET_PICKER = exports.multiSelect = exports.select = exports.CompareExpression = exports.TernaryExpression = exports.Expression = void 0;
25
25
  const logger = require("../logger");
26
26
  /*
27
27
  * A CEL expression which can be evaluated during function deployment, and
@@ -142,6 +142,43 @@ class CompareExpression extends Expression {
142
142
  }
143
143
  }
144
144
  exports.CompareExpression = CompareExpression;
145
+ /** Create a select input from a series of values or a map of labels to values */
146
+ function select(options) {
147
+ let wireOpts;
148
+ if (Array.isArray(options)) {
149
+ wireOpts = options.map((opt) => ({ value: opt }));
150
+ }
151
+ else {
152
+ wireOpts = Object.entries(options).map(([label, value]) => ({ label, value }));
153
+ }
154
+ return {
155
+ select: {
156
+ options: wireOpts,
157
+ },
158
+ };
159
+ }
160
+ exports.select = select;
161
+ /** Create a multi-select input from a series of values or map of labels to values. */
162
+ function multiSelect(options) {
163
+ let wireOpts;
164
+ if (Array.isArray(options)) {
165
+ wireOpts = options.map((opt) => ({ value: opt }));
166
+ }
167
+ else {
168
+ wireOpts = Object.entries(options).map(([label, value]) => ({ label, value }));
169
+ }
170
+ return {
171
+ multiSelect: {
172
+ options: wireOpts,
173
+ },
174
+ };
175
+ }
176
+ exports.multiSelect = multiSelect;
177
+ exports.BUCKET_PICKER = {
178
+ resource: {
179
+ type: "storage.googleapis.com/Bucket",
180
+ },
181
+ };
145
182
  /**
146
183
  * Represents a parametrized value that will be read from .env files if present,
147
184
  * or prompted for by the CLI if missing. Instantiate these with the defineX
@@ -177,7 +177,8 @@ export interface RuntimeOptions {
177
177
  *
178
178
  * @remarks
179
179
  * Set this to true to enable the App Check replay protection feature by consuming the App Check token on callable
180
- * request. Tokens that are found to be already consumed will have request.app.alreadyConsumed property set true.
180
+ * request. Tokens that are found to be already consumed will have the `request.app.alreadyConsumed` property set
181
+ * to true.
181
182
  *
182
183
  *
183
184
  * Tokens are only considered to be consumed if it is sent to the App Check service by setting this option to true.
@@ -188,10 +189,10 @@ export interface RuntimeOptions {
188
189
  * performance and can potentially deplete your attestation providers' quotas faster. Use this feature only for
189
190
  * protecting low volume, security critical, or expensive operations.
190
191
  *
191
- * This option does not affect the enforceAppCheck option. Setting the latter to true will cause the callable function
192
- * to automatically respond with a 401 Unauthorized status code when request includes an invalid App Check token.
193
- * When request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead,
194
- * the request.app.alreadyConsumed property will be set to true and pass the execution to the handler code for making
192
+ * This option does not affect the `enforceAppCheck` option. Setting the latter to true will cause the callable function
193
+ * to automatically respond with a 401 Unauthorized status code when the request includes an invalid App Check token.
194
+ * When the request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead,
195
+ * the `request.app.alreadyConsumed` property will be set to true and pass the execution to the handler code for making
195
196
  * further decisions, such as requiring additional security checks or rejecting the request.
196
197
  */
197
198
  consumeAppCheckToken?: boolean;
@@ -119,11 +119,12 @@ function onCall(optsOrHandler, handler) {
119
119
  // onCallHandler sniffs the function length to determine which API to present.
120
120
  // fix the length to prevent api versions from being mismatched.
121
121
  const fixedLen = (req) => handler(req);
122
- const func = (0, https_1.onCallHandler)({
122
+ let func = (0, https_1.onCallHandler)({
123
123
  cors: { origin, methods: "POST" },
124
124
  enforceAppCheck: (_a = opts.enforceAppCheck) !== null && _a !== void 0 ? _a : options.getGlobalOptions().enforceAppCheck,
125
125
  consumeAppCheckToken: opts.consumeAppCheckToken,
126
126
  }, fixedLen);
127
+ func = (0, trace_1.wrapTraceContext)(func);
127
128
  Object.defineProperty(func, "__trigger", {
128
129
  get: () => {
129
130
  const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
@@ -159,7 +159,7 @@ export interface StorageEvent extends CloudEvent<StorageObjectData> {
159
159
  /** StorageOptions extend EventHandlerOptions with a bucket name */
160
160
  export interface StorageOptions extends options.EventHandlerOptions {
161
161
  /** The name of the bucket containing this object. */
162
- bucket?: string;
162
+ bucket?: string | Expression<string>;
163
163
  /**
164
164
  * If true, do not deploy or emulate this function.
165
165
  */
@@ -259,7 +259,7 @@ export declare function onObjectArchived(handler: (event: StorageEvent) => any |
259
259
  * @param bucket - The name of the bucket containing this object.
260
260
  * @param handler - Event handler which is run every time a Google Cloud Storage archival occurs.
261
261
  */
262
- export declare function onObjectArchived(bucket: string, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
262
+ export declare function onObjectArchived(bucket: string | Expression<string>, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
263
263
  /**
264
264
  * Event handler sent only when a bucket has enabled object versioning.
265
265
  * This event indicates that the live version of an object has become an
@@ -292,7 +292,7 @@ export declare function onObjectFinalized(handler: (event: StorageEvent) => any
292
292
  * @param bucket - The name of the bucket containing this object.
293
293
  * @param handler - Event handler which is run every time a Google Cloud Storage object creation occurs.
294
294
  */
295
- export declare function onObjectFinalized(bucket: string, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
295
+ export declare function onObjectFinalized(bucket: string | Expression<string>, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
296
296
  /**
297
297
  * Event handler which fires every time a Google Cloud Storage object
298
298
  * creation occurs.
@@ -329,7 +329,7 @@ export declare function onObjectDeleted(handler: (event: StorageEvent) => any |
329
329
  * @param bucket - The name of the bucket containing this object.
330
330
  * @param handler - Event handler which is run every time a Google Cloud Storage object deletion occurs.
331
331
  */
332
- export declare function onObjectDeleted(bucket: string, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
332
+ export declare function onObjectDeleted(bucket: string | Expression<string>, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
333
333
  /**
334
334
  * Event handler which fires every time a Google Cloud Storage deletion occurs.
335
335
  *
@@ -358,7 +358,7 @@ export declare function onObjectMetadataUpdated(handler: (event: StorageEvent) =
358
358
  * @param bucket - The name of the bucket containing this object.
359
359
  * @param handler - Event handler which is run every time a Google Cloud Storage object metadata update occurs.
360
360
  */
361
- export declare function onObjectMetadataUpdated(bucket: string, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
361
+ export declare function onObjectMetadataUpdated(bucket: string | Expression<string>, handler: (event: StorageEvent) => any | Promise<any>): CloudFunction<StorageEvent>;
362
362
  /**
363
363
  * Event handler which fires every time the metadata of an existing object
364
364
  * changes.
@@ -161,7 +161,8 @@ function getOptsAndBucket(bucketOrOpts) {
161
161
  var _a;
162
162
  let bucket;
163
163
  let opts;
164
- if (typeof bucketOrOpts === "string") {
164
+ // If bucket is a string or Expression<string>
165
+ if (typeof bucketOrOpts === "string" || "value" in bucketOrOpts) {
165
166
  bucket = bucketOrOpts;
166
167
  opts = {};
167
168
  }
@@ -174,7 +175,7 @@ function getOptsAndBucket(bucketOrOpts) {
174
175
  throw new Error("Missing bucket name. If you are unit testing, please provide a bucket name" +
175
176
  " by providing bucket name directly in the event handler or by setting process.env.FIREBASE_CONFIG.");
176
177
  }
177
- if (!/^[a-z\d][a-z\d\\._-]{1,230}[a-z\d]$/.test(bucket)) {
178
+ if (typeof bucket === "string" && !/^[a-z\d][a-z\d\\._-]{1,230}[a-z\d]$/.test(bucket)) {
178
179
  throw new Error(`Invalid bucket name ${bucket}`);
179
180
  }
180
181
  return [opts, bucket];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-functions",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "Firebase SDK for Cloud Functions",
5
5
  "keywords": [
6
6
  "firebase",
@@ -225,7 +225,7 @@
225
225
  "eslint-config-prettier": "^8.3.0",
226
226
  "eslint-plugin-jsdoc": "^39.2.9",
227
227
  "eslint-plugin-prettier": "^4.0.0",
228
- "firebase-admin": "^11.8.0",
228
+ "firebase-admin": "^12.0.0",
229
229
  "js-yaml": "^3.13.1",
230
230
  "jsdom": "^16.2.1",
231
231
  "jsonwebtoken": "^9.0.0",
@@ -245,7 +245,7 @@
245
245
  "yargs": "^15.3.1"
246
246
  },
247
247
  "peerDependencies": {
248
- "firebase-admin": "^10.0.0 || ^11.0.0"
248
+ "firebase-admin": "^10.0.0 || ^11.0.0 || ^12.0.0"
249
249
  },
250
250
  "engines": {
251
251
  "node": ">=14.10.0"