firebase-functions 3.20.0 → 3.21.1

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 (66) hide show
  1. package/lib/apps.js +1 -1
  2. package/lib/bin/firebase-functions.js +22 -1
  3. package/lib/cloud-functions.d.ts +56 -35
  4. package/lib/cloud-functions.js +12 -12
  5. package/lib/common/encoding.js +21 -1
  6. package/lib/common/providers/https.d.ts +37 -17
  7. package/lib/common/providers/https.js +11 -6
  8. package/lib/common/providers/identity.d.ts +11 -1
  9. package/lib/common/providers/identity.js +55 -207
  10. package/lib/common/providers/tasks.d.ts +9 -0
  11. package/lib/common/providers/tasks.js +12 -3
  12. package/lib/function-builder.d.ts +2 -2
  13. package/lib/function-builder.js +1 -1
  14. package/lib/handler-builder.js +3 -3
  15. package/lib/index.js +6 -2
  16. package/lib/logger/common.js +21 -0
  17. package/lib/logger/compat.js +22 -1
  18. package/lib/logger/index.d.ts +14 -6
  19. package/lib/logger/index.js +33 -6
  20. package/lib/providers/analytics.js +1 -1
  21. package/lib/providers/auth.d.ts +44 -10
  22. package/lib/providers/auth.js +80 -14
  23. package/lib/providers/database.js +11 -11
  24. package/lib/providers/firestore.js +7 -7
  25. package/lib/providers/https.js +7 -7
  26. package/lib/providers/pubsub.d.ts +6 -6
  27. package/lib/providers/pubsub.js +8 -8
  28. package/lib/providers/remoteConfig.js +1 -1
  29. package/lib/providers/storage.js +2 -2
  30. package/lib/providers/tasks.d.ts +30 -15
  31. package/lib/providers/tasks.js +19 -12
  32. package/lib/providers/testLab.js +1 -1
  33. package/lib/runtime/loader.js +9 -7
  34. package/lib/runtime/manifest.d.ts +5 -0
  35. package/lib/setup.js +3 -3
  36. package/lib/v2/core.d.ts +24 -20
  37. package/lib/v2/index.d.ts +11 -3
  38. package/lib/v2/index.js +12 -3
  39. package/lib/v2/options.d.ts +25 -35
  40. package/lib/v2/options.js +28 -88
  41. package/lib/v2/params/index.d.ts +4 -1
  42. package/lib/v2/params/index.js +25 -1
  43. package/lib/v2/params/types.js +21 -0
  44. package/lib/v2/providers/alerts/alerts.d.ts +107 -8
  45. package/lib/v2/providers/alerts/alerts.js +23 -7
  46. package/lib/v2/providers/alerts/appDistribution.d.ts +112 -12
  47. package/lib/v2/providers/alerts/appDistribution.js +29 -2
  48. package/lib/v2/providers/alerts/billing.d.ts +39 -12
  49. package/lib/v2/providers/alerts/billing.js +38 -1
  50. package/lib/v2/providers/alerts/crashlytics.d.ts +255 -47
  51. package/lib/v2/providers/alerts/crashlytics.js +63 -2
  52. package/lib/v2/providers/alerts/index.d.ts +6 -0
  53. package/lib/v2/providers/alerts/index.js +32 -1
  54. package/lib/v2/providers/eventarc.d.ts +116 -0
  55. package/lib/v2/providers/eventarc.js +69 -0
  56. package/lib/v2/providers/https.d.ts +128 -4
  57. package/lib/v2/providers/https.js +18 -14
  58. package/lib/v2/providers/identity.d.ts +126 -0
  59. package/lib/v2/providers/identity.js +104 -0
  60. package/lib/v2/providers/pubsub.d.ts +125 -8
  61. package/lib/v2/providers/pubsub.js +60 -7
  62. package/lib/v2/providers/storage.d.ts +209 -17
  63. package/lib/v2/providers/storage.js +57 -13
  64. package/lib/v2/providers/tasks.d.ts +107 -7
  65. package/lib/v2/providers/tasks.js +11 -8
  66. package/package.json +22 -3
package/lib/apps.js CHANGED
@@ -103,7 +103,7 @@ exports.apps = apps;
103
103
  this._emulatedAdminApp = app;
104
104
  }
105
105
  get firebaseArgs() {
106
- return _.assign({}, config_1.firebaseConfig(), {
106
+ return _.assign({}, (0, config_1.firebaseConfig)(), {
107
107
  credential: firebase.credential.applicationDefault(),
108
108
  });
109
109
  }
@@ -1,5 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ // The MIT License (MIT)
4
+ //
5
+ // Copyright (c) 2022 Firebase
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ // of this software and associated documentation files (the "Software"), to deal
9
+ // in the Software without restriction, including without limitation the rights
10
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the Software is
12
+ // furnished to do so, subject to the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be included in all
15
+ // copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ // SOFTWARE.
3
24
  Object.defineProperty(exports, "__esModule", { value: true });
4
25
  const express = require("express");
5
26
  const loader_1 = require("../runtime/loader");
@@ -31,7 +52,7 @@ app.post('/__/quitquitquit', handleQuitquitquit);
31
52
  if (process.env.FUNCTIONS_CONTROL_API === 'true') {
32
53
  app.get('/__/functions.yaml', async (req, res) => {
33
54
  try {
34
- const stack = await loader_1.loadStack(functionsDir);
55
+ const stack = await (0, loader_1.loadStack)(functionsDir);
35
56
  res.setHeader('content-type', 'text/yaml');
36
57
  res.send(JSON.stringify(stack));
37
58
  }
@@ -173,42 +173,35 @@ export interface Resource {
173
173
  };
174
174
  }
175
175
  /**
176
- * @hidden
177
- * TriggerAnnotated is used internally by the firebase CLI to understand what
176
+ * TriggerAnnotion is used internally by the firebase CLI to understand what
178
177
  * type of Cloud Function to deploy.
179
178
  */
180
- export interface TriggerAnnotated {
181
- __trigger: {
182
- availableMemoryMb?: number;
183
- eventTrigger?: {
184
- eventType: string;
185
- resource: string;
186
- service: string;
187
- };
188
- failurePolicy?: FailurePolicy;
189
- httpsTrigger?: {
190
- invoker?: string[];
191
- };
192
- labels?: {
193
- [key: string]: string;
194
- };
195
- regions?: string[];
196
- schedule?: Schedule;
197
- timeout?: Duration;
198
- vpcConnector?: string;
199
- vpcConnectorEgressSettings?: string;
200
- serviceAccountEmail?: string;
201
- ingressSettings?: string;
202
- secrets?: string[];
179
+ interface TriggerAnnotation {
180
+ availableMemoryMb?: number;
181
+ blockingTrigger?: {
182
+ eventType: string;
183
+ options?: Record<string, unknown>;
203
184
  };
204
- }
205
- /**
206
- * @hidden
207
- * EndpointAnnotated is used to generate the manifest that conforms to the container contract.
208
- */
209
- export interface EndpointAnnotated {
210
- __endpoint: ManifestEndpoint;
211
- __requiredAPIs?: ManifestRequiredAPI[];
185
+ eventTrigger?: {
186
+ eventType: string;
187
+ resource: string;
188
+ service: string;
189
+ };
190
+ failurePolicy?: FailurePolicy;
191
+ httpsTrigger?: {
192
+ invoker?: string[];
193
+ };
194
+ labels?: {
195
+ [key: string]: string;
196
+ };
197
+ regions?: string[];
198
+ schedule?: Schedule;
199
+ timeout?: Duration;
200
+ vpcConnector?: string;
201
+ vpcConnectorEgressSettings?: string;
202
+ serviceAccountEmail?: string;
203
+ ingressSettings?: string;
204
+ secrets?: string[];
212
205
  }
213
206
  /**
214
207
  * A Runnable has a `run` method which directly invokes the user-defined
@@ -226,7 +219,27 @@ export interface Runnable<T> {
226
219
  * [`Response`](https://expressjs.com/en/api.html#res) objects as its only
227
220
  * arguments.
228
221
  */
229
- export declare type HttpsFunction = TriggerAnnotated & EndpointAnnotated & ((req: Request, resp: Response) => void | Promise<void>);
222
+ export interface HttpsFunction {
223
+ (req: Request, resp: Response): void | Promise<void>;
224
+ /** @alpha */
225
+ __trigger: TriggerAnnotation;
226
+ /** @alpha */
227
+ __endpoint: ManifestEndpoint;
228
+ /** @alpha */
229
+ __requiredAPIs?: ManifestRequiredAPI[];
230
+ }
231
+ /**
232
+ * The Cloud Function type for Blocking triggers.
233
+ */
234
+ export interface BlockingFunction {
235
+ (req: Request, resp: Response): void | Promise<void>;
236
+ /** @alpha */
237
+ __trigger: TriggerAnnotation;
238
+ /** @alpha */
239
+ __endpoint: ManifestEndpoint;
240
+ /** @alpha */
241
+ __requiredAPIs?: ManifestRequiredAPI[];
242
+ }
230
243
  /**
231
244
  * The Cloud Function type for all non-HTTPS triggers. This should be exported
232
245
  * from your JavaScript file to define a Cloud Function.
@@ -234,7 +247,15 @@ export declare type HttpsFunction = TriggerAnnotated & EndpointAnnotated & ((req
234
247
  * This type is a special JavaScript function which takes a templated
235
248
  * `Event` object as its only argument.
236
249
  */
237
- export declare type CloudFunction<T> = Runnable<T> & TriggerAnnotated & EndpointAnnotated & ((input: any, context?: any) => PromiseLike<any> | any);
250
+ export interface CloudFunction<T> extends Runnable<T> {
251
+ (input: any, context?: any): PromiseLike<any> | any;
252
+ /** @alpha */
253
+ __trigger: TriggerAnnotation;
254
+ /** @alpha */
255
+ __endpoint: ManifestEndpoint;
256
+ /** @alpha */
257
+ __requiredAPIs?: ManifestRequiredAPI[];
258
+ }
238
259
  /** @hidden */
239
260
  export interface MakeCloudFunctionArgs<EventData> {
240
261
  after?: (raw: Event) => void;
@@ -135,7 +135,7 @@ function makeCloudFunction({ after = () => { }, before = () => { }, contextOnlyH
135
135
  promise = handler(dataOrChange, context);
136
136
  }
137
137
  if (typeof promise === 'undefined') {
138
- logger_1.warn('Function returned undefined, expected Promise or value');
138
+ (0, logger_1.warn)('Function returned undefined, expected Promise or value');
139
139
  }
140
140
  return Promise.resolve(promise)
141
141
  .then((result) => {
@@ -252,8 +252,8 @@ function _detectAuthType(event) {
252
252
  /** @hidden */
253
253
  function optionsToTrigger(options) {
254
254
  const trigger = {};
255
- encoding_1.copyIfPresent(trigger, options, 'regions', 'schedule', 'minInstances', 'maxInstances', 'ingressSettings', 'vpcConnectorEgressSettings', 'vpcConnector', 'labels', 'secrets');
256
- encoding_1.convertIfPresent(trigger, options, 'failurePolicy', 'failurePolicy', (policy) => {
255
+ (0, encoding_1.copyIfPresent)(trigger, options, 'regions', 'schedule', 'minInstances', 'maxInstances', 'ingressSettings', 'vpcConnectorEgressSettings', 'vpcConnector', 'labels', 'secrets');
256
+ (0, encoding_1.convertIfPresent)(trigger, options, 'failurePolicy', 'failurePolicy', (policy) => {
257
257
  if (policy === false) {
258
258
  return undefined;
259
259
  }
@@ -264,8 +264,8 @@ function optionsToTrigger(options) {
264
264
  return policy;
265
265
  }
266
266
  });
267
- encoding_1.convertIfPresent(trigger, options, 'timeout', 'timeoutSeconds', encoding_1.durationFromSeconds);
268
- encoding_1.convertIfPresent(trigger, options, 'availableMemoryMb', 'memory', (mem) => {
267
+ (0, encoding_1.convertIfPresent)(trigger, options, 'timeout', 'timeoutSeconds', encoding_1.durationFromSeconds);
268
+ (0, encoding_1.convertIfPresent)(trigger, options, 'availableMemoryMb', 'memory', (mem) => {
269
269
  const memoryLookup = {
270
270
  '128MB': 128,
271
271
  '256MB': 256,
@@ -277,21 +277,21 @@ function optionsToTrigger(options) {
277
277
  };
278
278
  return memoryLookup[mem];
279
279
  });
280
- encoding_1.convertIfPresent(trigger, options, 'serviceAccountEmail', 'serviceAccount', encoding_1.serviceAccountFromShorthand);
280
+ (0, encoding_1.convertIfPresent)(trigger, options, 'serviceAccountEmail', 'serviceAccount', encoding_1.serviceAccountFromShorthand);
281
281
  return trigger;
282
282
  }
283
283
  exports.optionsToTrigger = optionsToTrigger;
284
284
  function optionsToEndpoint(options) {
285
285
  const endpoint = {};
286
- encoding_1.copyIfPresent(endpoint, options, 'minInstances', 'maxInstances', 'ingressSettings', 'labels', 'timeoutSeconds');
287
- encoding_1.convertIfPresent(endpoint, options, 'region', 'regions');
288
- encoding_1.convertIfPresent(endpoint, options, 'serviceAccountEmail', 'serviceAccount', (sa) => sa);
289
- encoding_1.convertIfPresent(endpoint, options, 'secretEnvironmentVariables', 'secrets', (secrets) => secrets.map((secret) => ({ secret, key: secret })));
286
+ (0, encoding_1.copyIfPresent)(endpoint, options, 'minInstances', 'maxInstances', 'ingressSettings', 'labels', 'timeoutSeconds');
287
+ (0, encoding_1.convertIfPresent)(endpoint, options, 'region', 'regions');
288
+ (0, encoding_1.convertIfPresent)(endpoint, options, 'serviceAccountEmail', 'serviceAccount', (sa) => sa);
289
+ (0, encoding_1.convertIfPresent)(endpoint, options, 'secretEnvironmentVariables', 'secrets', (secrets) => secrets.map((secret) => ({ key: secret })));
290
290
  if (options === null || options === void 0 ? void 0 : options.vpcConnector) {
291
291
  endpoint.vpc = { connector: options.vpcConnector };
292
- encoding_1.convertIfPresent(endpoint.vpc, options, 'egressSettings', 'vpcConnectorEgressSettings');
292
+ (0, encoding_1.convertIfPresent)(endpoint.vpc, options, 'egressSettings', 'vpcConnectorEgressSettings');
293
293
  }
294
- encoding_1.convertIfPresent(endpoint, options, 'availableMemoryMb', 'memory', (mem) => {
294
+ (0, encoding_1.convertIfPresent)(endpoint, options, 'availableMemoryMb', 'memory', (mem) => {
295
295
  const memoryLookup = {
296
296
  '128MB': 128,
297
297
  '256MB': 256,
@@ -1,5 +1,25 @@
1
1
  "use strict";
2
- // Copied from firebase-tools/src/gcp/proto
2
+ // The MIT License (MIT)
3
+ //
4
+ // Copyright (c) 2021 Firebase
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ // of this software and associated documentation files (the "Software"), to deal
8
+ // in the Software without restriction, including without limitation the rights
9
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ // copies of the Software, and to permit persons to whom the Software is
11
+ // furnished to do so, subject to the following conditions:
12
+ //
13
+ // The above copyright notice and this permission notice shall be included in all
14
+ // copies or substantial portions of the Software.
15
+ //
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ // SOFTWARE.
3
23
  Object.defineProperty(exports, "__esModule", { value: true });
4
24
  exports.convertInvoker = exports.serviceAccountFromShorthand = exports.convertIfPresent = exports.copyIfPresent = exports.durationFromSeconds = void 0;
5
25
  /** Get a google.protobuf.Duration for a number of seconds. */
@@ -4,6 +4,7 @@ import * as firebase from 'firebase-admin';
4
4
  import { TaskContext } from './tasks';
5
5
  /** @hidden */
6
6
  export interface Request extends express.Request {
7
+ /** The wire format representation of the request body. */
7
8
  rawBody: Buffer;
8
9
  }
9
10
  interface DecodedAppCheckToken {
@@ -114,37 +115,53 @@ export interface CallableRequest<T = any> {
114
115
  * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
115
116
  *
116
117
  * Possible values:
117
- * - 'cancelled': The operation was cancelled (typically by the caller).
118
- * - 'unknown': Unknown error or an error from a different error domain.
119
- * - 'invalid-argument': Client specified an invalid argument. Note that this
120
- * differs from 'failed-precondition'. 'invalid-argument' indicates
118
+ *
119
+ * - `cancelled`: The operation was cancelled (typically by the caller).
120
+ *
121
+ * - `unknown`: Unknown error or an error from a different error domain.
122
+ *
123
+ * - `invalid-argument`: Client specified an invalid argument. Note that this
124
+ * differs from `failed-precondition`. `invalid-argument` indicates
121
125
  * arguments that are problematic regardless of the state of the system
122
126
  * (e.g. an invalid field name).
123
- * - 'deadline-exceeded': Deadline expired before operation could complete.
127
+ *
128
+ * - `deadline-exceeded`: Deadline expired before operation could complete.
124
129
  * For operations that change the state of the system, this error may be
125
130
  * returned even if the operation has completed successfully. For example,
126
131
  * a successful response from a server could have been delayed long enough
127
132
  * for the deadline to expire.
128
- * - 'not-found': Some requested document was not found.
129
- * - 'already-exists': Some document that we attempted to create already
133
+ *
134
+ * - `not-found`: Some requested document was not found.
135
+ *
136
+ * - `already-exists`: Some document that we attempted to create already
130
137
  * exists.
131
- * - 'permission-denied': The caller does not have permission to execute the
138
+ *
139
+ * - `permission-denied`: The caller does not have permission to execute the
132
140
  * specified operation.
133
- * - 'resource-exhausted': Some resource has been exhausted, perhaps a
141
+ *
142
+ * - `resource-exhausted`: Some resource has been exhausted, perhaps a
134
143
  * per-user quota, or perhaps the entire file system is out of space.
135
- * - 'failed-precondition': Operation was rejected because the system is not
144
+ *
145
+ * - `failed-precondition`: Operation was rejected because the system is not
136
146
  * in a state required for the operation's execution.
137
- * - 'aborted': The operation was aborted, typically due to a concurrency
147
+ *
148
+ * - `aborted`: The operation was aborted, typically due to a concurrency
138
149
  * issue like transaction aborts, etc.
139
- * - 'out-of-range': Operation was attempted past the valid range.
140
- * - 'unimplemented': Operation is not implemented or not supported/enabled.
141
- * - 'internal': Internal errors. Means some invariants expected by
150
+ *
151
+ * - `out-of-range`: Operation was attempted past the valid range.
152
+ *
153
+ * - `unimplemented`: Operation is not implemented or not supported/enabled.
154
+ *
155
+ * - `internal`: Internal errors. Means some invariants expected by
142
156
  * underlying system has been broken. If you see one of these errors,
143
157
  * something is very broken.
144
- * - 'unavailable': The service is currently unavailable. This is most likely
158
+ *
159
+ * - `unavailable`: The service is currently unavailable. This is most likely
145
160
  * a transient condition and may be corrected by retrying with a backoff.
146
- * - 'data-loss': Unrecoverable data loss or corruption.
147
- * - 'unauthenticated': The request does not have valid authentication
161
+ *
162
+ * - `data-loss`: Unrecoverable data loss or corruption.
163
+ *
164
+ * - `unauthenticated`: The request does not have valid authentication
148
165
  * credentials for the operation.
149
166
  */
150
167
  export declare type FunctionsErrorCode = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
@@ -182,6 +199,9 @@ export declare class HttpsError extends Error {
182
199
  */
183
200
  readonly httpErrorCode: HttpErrorCode;
184
201
  constructor(code: FunctionsErrorCode, message: string, details?: unknown);
202
+ /**
203
+ * Returns a JSON-serializable representation of this object.
204
+ */
185
205
  toJSON(): HttpErrorWireFormat;
186
206
  }
187
207
  /** @hidden */
@@ -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.onCallHandler = exports.checkAuthToken = exports.unsafeDecodeAppCheckToken = exports.unsafeDecodeIdToken = exports.decode = exports.encode = exports.isValidRequest = exports.HttpsError = void 0;
24
+ exports.onCallHandler = exports.checkAuthToken = exports.unsafeDecodeAppCheckToken = exports.unsafeDecodeIdToken = exports.unsafeDecodeToken = exports.decode = exports.encode = exports.isValidRequest = exports.HttpsError = void 0;
25
25
  const cors = require("cors");
26
26
  const logger = require("../../logger");
27
27
  // TODO(inlined): Decide whether we want to un-version apps or whether we want a
@@ -72,6 +72,9 @@ class HttpsError extends Error {
72
72
  this.details = details;
73
73
  this.httpErrorCode = errorCodeMap[code];
74
74
  }
75
+ /**
76
+ * Returns a JSON-serializable representation of this object.
77
+ */
75
78
  toJSON() {
76
79
  const { details, httpErrorCode: { canonicalName: status }, message, } = this;
77
80
  return {
@@ -209,6 +212,7 @@ function decode(data) {
209
212
  return data;
210
213
  }
211
214
  exports.decode = decode;
215
+ /** @internal */
212
216
  function unsafeDecodeToken(token) {
213
217
  if (!JWT_REGEX.test(token)) {
214
218
  return {};
@@ -228,6 +232,7 @@ function unsafeDecodeToken(token) {
228
232
  }
229
233
  return payload;
230
234
  }
235
+ exports.unsafeDecodeToken = unsafeDecodeToken;
231
236
  /**
232
237
  * Decode, but not verify, a Auth ID token.
233
238
  *
@@ -310,11 +315,11 @@ async function checkAuthToken(req, ctx) {
310
315
  const idToken = match[1];
311
316
  try {
312
317
  let authToken;
313
- if (debug_1.isDebugFeatureEnabled('skipTokenVerification')) {
318
+ if ((0, debug_1.isDebugFeatureEnabled)('skipTokenVerification')) {
314
319
  authToken = unsafeDecodeIdToken(idToken);
315
320
  }
316
321
  else {
317
- authToken = await apps_1.apps()
322
+ authToken = await (0, apps_1.apps)()
318
323
  .admin.auth()
319
324
  .verifyIdToken(idToken);
320
325
  }
@@ -338,16 +343,16 @@ async function checkAppCheckToken(req, ctx) {
338
343
  return 'MISSING';
339
344
  }
340
345
  try {
341
- if (!apps_1.apps().admin.appCheck) {
346
+ if (!(0, apps_1.apps)().admin.appCheck) {
342
347
  throw new Error('Cannot validate AppCheck token. Please update Firebase Admin SDK to >= v9.8.0');
343
348
  }
344
349
  let appCheckData;
345
- if (debug_1.isDebugFeatureEnabled('skipTokenVerification')) {
350
+ if ((0, debug_1.isDebugFeatureEnabled)('skipTokenVerification')) {
346
351
  const decodedToken = unsafeDecodeAppCheckToken(appCheck);
347
352
  appCheckData = { appId: decodedToken.app_id, token: decodedToken };
348
353
  }
349
354
  else {
350
- appCheckData = await apps_1.apps()
355
+ appCheckData = await (0, apps_1.apps)()
351
356
  .admin.appCheck()
352
357
  .verifyToken(appCheck);
353
358
  }
@@ -1,7 +1,13 @@
1
1
  import * as firebase from 'firebase-admin';
2
- import { HttpsError } from './https';
3
2
  import { EventContext } from '../../cloud-functions';
3
+ import { HttpsError } from './https';
4
4
  export { HttpsError };
5
+ /**
6
+ * Shorthand auth blocking events from GCIP.
7
+ * @hidden
8
+ * @alpha
9
+ */
10
+ export declare type AuthBlockingEventType = 'beforeCreate' | 'beforeSignIn';
5
11
  /**
6
12
  * The UserRecord passed to Cloud Functions is the same UserRecord that is returned by the Firebase Admin
7
13
  * SDK.
@@ -198,6 +204,10 @@ export interface AuthEventContext extends EventContext {
198
204
  additionalUserInfo?: AdditionalUserInfo;
199
205
  credential?: Credential;
200
206
  }
207
+ /** Defines the auth event for v2 blocking events */
208
+ export interface AuthBlockingEvent extends AuthEventContext {
209
+ data: AuthUserRecord;
210
+ }
201
211
  /** The handler response type for beforeCreate blocking events */
202
212
  export interface BeforeCreateResponse {
203
213
  displayName?: string;