firebase-functions 3.20.1 → 3.21.2

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 (65) 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 +59 -207
  10. package/lib/common/providers/tasks.d.ts +9 -0
  11. package/lib/function-builder.d.ts +2 -2
  12. package/lib/function-builder.js +1 -1
  13. package/lib/handler-builder.js +3 -3
  14. package/lib/index.js +6 -2
  15. package/lib/logger/common.js +21 -0
  16. package/lib/logger/compat.js +22 -1
  17. package/lib/logger/index.d.ts +14 -6
  18. package/lib/logger/index.js +33 -6
  19. package/lib/providers/analytics.js +1 -1
  20. package/lib/providers/auth.d.ts +44 -10
  21. package/lib/providers/auth.js +80 -14
  22. package/lib/providers/database.js +11 -11
  23. package/lib/providers/firestore.js +7 -7
  24. package/lib/providers/https.js +7 -7
  25. package/lib/providers/pubsub.d.ts +6 -6
  26. package/lib/providers/pubsub.js +8 -8
  27. package/lib/providers/remoteConfig.js +1 -1
  28. package/lib/providers/storage.js +2 -2
  29. package/lib/providers/tasks.d.ts +30 -15
  30. package/lib/providers/tasks.js +19 -12
  31. package/lib/providers/testLab.js +1 -1
  32. package/lib/runtime/loader.js +9 -7
  33. package/lib/runtime/manifest.d.ts +5 -0
  34. package/lib/setup.js +3 -3
  35. package/lib/v2/core.d.ts +24 -20
  36. package/lib/v2/index.d.ts +11 -4
  37. package/lib/v2/index.js +12 -5
  38. package/lib/v2/options.d.ts +25 -35
  39. package/lib/v2/options.js +28 -88
  40. package/lib/v2/params/index.d.ts +4 -1
  41. package/lib/v2/params/index.js +25 -1
  42. package/lib/v2/params/types.js +21 -0
  43. package/lib/v2/providers/alerts/alerts.d.ts +107 -8
  44. package/lib/v2/providers/alerts/alerts.js +23 -7
  45. package/lib/v2/providers/alerts/appDistribution.d.ts +112 -12
  46. package/lib/v2/providers/alerts/appDistribution.js +29 -2
  47. package/lib/v2/providers/alerts/billing.d.ts +39 -12
  48. package/lib/v2/providers/alerts/billing.js +38 -1
  49. package/lib/v2/providers/alerts/crashlytics.d.ts +255 -47
  50. package/lib/v2/providers/alerts/crashlytics.js +63 -2
  51. package/lib/v2/providers/alerts/index.d.ts +6 -0
  52. package/lib/v2/providers/alerts/index.js +32 -1
  53. package/lib/v2/providers/eventarc.d.ts +90 -6
  54. package/lib/v2/providers/eventarc.js +7 -3
  55. package/lib/v2/providers/https.d.ts +128 -4
  56. package/lib/v2/providers/https.js +18 -14
  57. package/lib/v2/providers/identity.d.ts +126 -0
  58. package/lib/v2/providers/identity.js +104 -0
  59. package/lib/v2/providers/pubsub.d.ts +125 -8
  60. package/lib/v2/providers/pubsub.js +60 -7
  61. package/lib/v2/providers/storage.d.ts +209 -17
  62. package/lib/v2/providers/storage.js +57 -13
  63. package/lib/v2/providers/tasks.d.ts +107 -7
  64. package/lib/v2/providers/tasks.js +11 -8
  65. package/package.json +18 -3
@@ -1,123 +1,331 @@
1
+ /**
2
+ * Cloud functions to handle Crashlytics events from Firebase Alerts.
3
+ * @packageDocumentation
4
+ */
1
5
  import { FirebaseAlertData } from '.';
2
6
  import { CloudEvent, CloudFunction } from '../../core';
3
7
  import * as options from '../../options';
4
- /** Generic crashlytics issue interface */
5
- interface Issue {
8
+ /** Generic Crashlytics issue interface */
9
+ export interface Issue {
10
+ /** The ID of the Crashlytics issue */
6
11
  id: string;
12
+ /** The title of the Crashlytics issue */
7
13
  title: string;
14
+ /** The subtitle of the Crashlytics issue */
8
15
  subtitle: string;
16
+ /** The application version of the Crashlytics issue */
9
17
  appVersion: string;
10
18
  }
11
19
  /**
12
20
  * The internal payload object for a new fatal issue.
13
- * Payload is wrapped inside a FirebaseAlertData object.
21
+ * Payload is wrapped inside a `FirebaseAlertData` object.
14
22
  */
15
23
  export interface NewFatalIssuePayload {
16
- ['@type']: 'com.google.firebase.firebasealerts.CrashlyticsNewFatalIssuePayload';
24
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewFatalIssuePayload';
25
+ /** Basic information of the Crashlytics issue */
17
26
  issue: Issue;
18
27
  }
19
28
  /**
20
29
  * The internal payload object for a new non-fatal issue.
21
- * Payload is wrapped inside a FirebaseAlertData object.
30
+ * Payload is wrapped inside a `FirebaseAlertData` object.
22
31
  */
23
32
  export interface NewNonfatalIssuePayload {
24
- ['@type']: 'com.google.firebase.firebasealerts.CrashlyticsNewNonfatalIssuePayload';
33
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewNonfatalIssuePayload';
34
+ /** Basic information of the Crashlytics issue */
25
35
  issue: Issue;
26
36
  }
27
37
  /**
28
38
  * The internal payload object for a regression alert.
29
- * Payload is wrapped inside a FirebaseAlertData object.
39
+ * Payload is wrapped inside a `FirebaseAlertData` object.
30
40
  */
31
41
  export interface RegressionAlertPayload {
32
- ['@type']: 'com.google.firebase.firebasealerts.CrashlyticsRegressionAlertPayload';
42
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsRegressionAlertPayload';
43
+ /** The type of the Crashlytics issue, e.g. new fatal, new nonfatal, ANR */
33
44
  type: string;
45
+ /** Basic information of the Crashlytics issue */
34
46
  issue: Issue;
47
+ /**
48
+ * The time that the Crashlytics issues was most recently resolved before it
49
+ * began to reoccur.
50
+ */
35
51
  resolveTime: string;
36
52
  }
37
- /** Generic crashlytics trending issue interface */
38
- interface TrendingIssueDetails {
53
+ /** Generic Crashlytics trending issue interface */
54
+ export interface TrendingIssueDetails {
55
+ /** The type of the Crashlytics issue, e.g. new fatal, new nonfatal, ANR */
39
56
  type: string;
57
+ /** Basic information of the Crashlytics issue */
40
58
  issue: Issue;
59
+ /** The number of crashes that occurred with the issue */
41
60
  eventCount: number;
61
+ /** The number of distinct users that were affected by the issue */
42
62
  userCount: number;
43
63
  }
44
64
  /**
45
65
  * The internal payload object for a stability digest.
46
- * Payload is wrapped inside a FirebaseAlertData object.
66
+ * Payload is wrapped inside a `FirebaseAlertData` object.
47
67
  */
48
68
  export interface StabilityDigestPayload {
49
- ['@type']: 'com.google.firebase.firebasealerts.CrashlyticsStabilityDigestPayload';
69
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsStabilityDigestPayload';
70
+ /**
71
+ * The date that the digest gets created. Issues in the digest should have the
72
+ * same date as the digest date
73
+ */
50
74
  digestDate: string;
75
+ /** A stability digest containing several trending Crashlytics issues */
51
76
  trendingIssues: TrendingIssueDetails[];
52
77
  }
53
78
  /**
54
79
  * The internal payload object for a velocity alert.
55
- * Payload is wrapped inside a FirebaseAlertData object.
80
+ * Payload is wrapped inside a `FirebaseAlertData` object.
56
81
  */
57
82
  export interface VelocityAlertPayload {
58
- ['@type']: 'com.google.firebase.firebasealerts.VelocityAlertPayload';
83
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsVelocityAlertPayload';
84
+ /** Basic information of the Crashlytics issue */
59
85
  issue: Issue;
86
+ /** The time that the Crashlytics issue gets created */
60
87
  createTime: string;
88
+ /**
89
+ * The number of user sessions for the given app version that had this
90
+ * specific crash issue in the time period used to trigger the velocity alert.
91
+ */
61
92
  crashCount: number;
93
+ /**
94
+ * The percentage of user sessions for the given app version that had this
95
+ * specific crash issue in the time period used to trigger the velocity alert.
96
+ */
62
97
  crashPercentage: number;
98
+ /**
99
+ * The first app version where this issue was seen, and not necessarily the
100
+ * version that has triggered the alert.
101
+ */
63
102
  firstVersion: string;
64
103
  }
65
104
  /**
66
105
  * The internal payload object for a new Application Not Responding issue.
67
- * Payload is wrapped inside a FirebaseAlertData object.
106
+ * Payload is wrapped inside a `FirebaseAlertData` object.
68
107
  */
69
108
  export interface NewAnrIssuePayload {
70
- ['@type']: 'com.google.firebase.firebasealerts.NewAnrIssuePayload';
109
+ ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewAnrIssuePayload';
110
+ /** Basic information of the Crashlytics issue */
71
111
  issue: Issue;
72
112
  }
73
- interface WithAlertTypeAndApp {
74
- alertType: string;
75
- appId: string;
76
- }
77
113
  /**
78
114
  * A custom CloudEvent for Firebase Alerts (with custom extension attributes).
115
+ * @typeParam T - the data type for Crashlytics alerts that is wrapped in a `FirebaseAlertData` object.
79
116
  */
80
- export declare type CrashlyticsEvent<T> = CloudEvent<FirebaseAlertData<T>, WithAlertTypeAndApp>;
117
+ export interface CrashlyticsEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
118
+ /** The type of the alerts that got triggered. */
119
+ alertType: string;
120
+ /** The Firebase App ID that’s associated with the alert. */
121
+ appId: string;
122
+ }
81
123
  /**
82
- * Configuration for crashlytics functions.
124
+ * Configuration for Crashlytics functions.
83
125
  */
84
126
  export interface CrashlyticsOptions extends options.EventHandlerOptions {
127
+ /** Scope the function to trigger on a specific application. */
85
128
  appId?: string;
129
+ /**
130
+ * Region where functions should be deployed.
131
+ */
132
+ region?: options.SupportedRegion | string;
133
+ /**
134
+ * Amount of memory to allocate to a function.
135
+ * A value of null restores the defaults of 256MB.
136
+ */
137
+ memory?: options.MemoryOption | null;
138
+ /**
139
+ * Timeout for the function in sections, possible values are 0 to 540.
140
+ * HTTPS functions can specify a higher timeout.
141
+ * A value of null restores the default of 60s
142
+ * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
143
+ * function depends on the type of function: Event handling functions have a
144
+ * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
145
+ * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
146
+ * timeout of 1,800s (30 minutes)
147
+ */
148
+ timeoutSeconds?: number | null;
149
+ /**
150
+ * Min number of actual instances to be running at a given time.
151
+ * Instances will be billed for memory allocation and 10% of CPU allocation
152
+ * while idle.
153
+ * A value of null restores the default min instances.
154
+ */
155
+ minInstances?: number | null;
156
+ /**
157
+ * Max number of instances to be running in parallel.
158
+ * A value of null restores the default max instances.
159
+ */
160
+ maxInstances?: number | null;
161
+ /**
162
+ * Number of requests a function can serve at once.
163
+ * Can only be applied to functions running on Cloud Functions v2.
164
+ * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
165
+ * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
166
+ * The maximum value for concurrency is 1,000.
167
+ */
168
+ concurrency?: number | null;
169
+ /**
170
+ * Fractional number of CPUs to allocate to a function.
171
+ * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
172
+ * This is different from the defaults when using the gcloud utility and is different from
173
+ * the fixed amount assigned in Google Cloud Functions generation 1.
174
+ * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
175
+ * to the value "gcf_gen1"
176
+ */
177
+ cpu?: number | 'gcf_gen1';
178
+ /**
179
+ * Connect cloud function to specified VPC connector.
180
+ * A value of null removes the VPC connector
181
+ */
182
+ vpcConnector?: string | null;
183
+ /**
184
+ * Egress settings for VPC connector.
185
+ * A value of null turns off VPC connector egress settings
186
+ */
187
+ vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
188
+ /**
189
+ * Specific service account for the function to run as.
190
+ * A value of null restores the default service account.
191
+ */
192
+ serviceAccount?: string | null;
193
+ /**
194
+ * Ingress settings which control where this function can be called from.
195
+ * A value of null turns off ingress settings.
196
+ */
197
+ ingressSettings?: options.IngressSetting | null;
198
+ /**
199
+ * User labels to set on the function.
200
+ */
201
+ labels?: Record<string, string>;
202
+ secrets?: string[];
203
+ /** Whether failed executions should be delivered again. */
204
+ retry?: boolean;
86
205
  }
87
206
  /**
88
- * Declares a function that can handle a new fatal issue published to crashlytics.
207
+ * Declares a function that can handle a new fatal issue published to Crashlytics.
208
+ * @param handler - Event handler that is triggered when a new fatal issue is published to Crashlytics.
209
+ * @returns A function that you can export and deploy.
210
+ */
211
+ export declare function onNewFatalIssuePublished(handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>;
212
+ /**
213
+ * Declares a function that can handle a new fatal issue published to Crashlytics.
214
+ * @param appId - A specific application the handler will trigger on.
215
+ * @param handler - Event handler that is triggered when a new fatal issue is published to Crashlytics.
216
+ * @returns A function that you can export and deploy.
217
+ */
218
+ export declare function onNewFatalIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>;
219
+ /**
220
+ * Declares a function that can handle a new fatal issue published to Crashlytics.
221
+ * @param opts - Options that can be set on the function.
222
+ * @param handler - Event handler that is triggered when a new fatal issue is published to Crashlytics.
223
+ * @returns A function that you can export and deploy.
224
+ */
225
+ export declare function onNewFatalIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewFatalIssuePayload>>;
226
+ /**
227
+ * Declares a function that can handle a new non-fatal issue published to Crashlytics.
228
+ * @param handler - Event handler that is triggered when a new fatal issue is published to Crashlytics.
229
+ * @returns A function that you can export and deploy.
230
+ */
231
+ export declare function onNewNonfatalIssuePublished(handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>;
232
+ /**
233
+ * Declares a function that can handle a new non-fatal issue published to Crashlytics.
234
+ * @param appId - A specific application the handler will trigger on.
235
+ * @param handler - Event handler that is triggered when a new non-fatal issue is published to Crashlytics.
236
+ * @returns A function that you can export and deploy.
237
+ */
238
+ export declare function onNewNonfatalIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>;
239
+ /**
240
+ * Declares a function that can handle a new non-fatal issue published to Crashlytics.
241
+ * @param opts - Options that can be set on the function.
242
+ * @param handler - Event handler that is triggered when a new non-fatal issue is published to Crashlytics.
243
+ * @returns A function that you can export and deploy.
244
+ */
245
+ export declare function onNewNonfatalIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewNonfatalIssuePayload>>;
246
+ /**
247
+ * Declares a function that can handle a regression alert published to Crashlytics.
248
+ * @param handler - Event handler that is triggered when a regression alert is published to Crashlytics.
249
+ * @returns A function that you can export and deploy.
250
+ */
251
+ export declare function onRegressionAlertPublished(handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>;
252
+ /**
253
+ * Declares a function that can handle a regression alert published to Crashlytics.
254
+ * @param appId - A specific application the handler will trigger on.
255
+ * @param handler - Event handler that is triggered when a regression alert is published to Crashlytics.
256
+ * @returns A function that you can export and deploy.
257
+
258
+ */
259
+ export declare function onRegressionAlertPublished(appId: string, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>;
260
+ /**
261
+ * Declares a function that can handle a regression alert published to Crashlytics.
262
+ * @param opts - Options that can be set on the function.
263
+ * @param handler - Event handler that is triggered when a regression alert is published to Crashlytics.
264
+ * @returns A function that you can export and deploy.
265
+
266
+ */
267
+ export declare function onRegressionAlertPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<RegressionAlertPayload>>;
268
+ /**
269
+ * Declares a function that can handle a stability digest published to Crashlytics.
270
+ * @param handler - Event handler that is triggered when a stability digest is published to Crashlytics.
271
+ * @returns A function that you can export and deploy.
272
+ */
273
+ export declare function onStabilityDigestPublished(handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>;
274
+ /**
275
+ * Declares a function that can handle a stability digest published to Crashlytics.
276
+ * @param appId - A specific application the handler will trigger on.
277
+ * @param handler - Event handler that is triggered when a stability digest is published to Crashlytics.
278
+ * @returns A function that you can export and deploy.
279
+
280
+ */
281
+ export declare function onStabilityDigestPublished(appId: string, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>;
282
+ /**
283
+ * Declares a function that can handle a stability digest published to Crashlytics.
284
+ * @param opts - Options that can be set on the function.
285
+ * @param handler - Event handler that is triggered when a stability digest is published to Crashlytics.
286
+ * @returns A function that you can export and deploy.
287
+
288
+ */
289
+ export declare function onStabilityDigestPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<StabilityDigestPayload>>;
290
+ /**
291
+ * Declares a function that can handle a velocity alert published to Crashlytics.
292
+ * @param handler - Event handler that is triggered when a velocity alert is published to Crashlytics.
293
+ * @returns A function that you can export and deploy.
89
294
  */
90
- export declare function onNewFatalIssuePublished(handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewFatalIssuePayload>>;
91
- export declare function onNewFatalIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewFatalIssuePayload>>;
92
- export declare function onNewFatalIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewFatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewFatalIssuePayload>>;
295
+ export declare function onVelocityAlertPublished(handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>;
93
296
  /**
94
- * Declares a function that can handle aa new non-fatal issue published to crashlytics.
297
+ * Declares a function that can handle a velocity alert published to Crashlytics.
298
+ * @param appId - A specific application the handler will trigger on.
299
+ * @param handler - Event handler that is triggered when a velocity alert is published to Crashlytics.
300
+ * @returns A function that you can export and deploy.
95
301
  */
96
- export declare function onNewNonfatalIssuePublished(handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewNonfatalIssuePayload>>;
97
- export declare function onNewNonfatalIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewNonfatalIssuePayload>>;
98
- export declare function onNewNonfatalIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewNonfatalIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewNonfatalIssuePayload>>;
302
+ export declare function onVelocityAlertPublished(appId: string, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>;
99
303
  /**
100
- * Declares a function that can handle a regression alert published to crashlytics.
304
+ * Declares a function that can handle a velocity alert published to Crashlytics.
305
+ * @param opts - Options that can be set on the function.
306
+ * @param handler - Event handler that is triggered when a velocity alert is published to Crashlytics.
307
+ * @returns A function that you can export and deploy.
101
308
  */
102
- export declare function onRegressionAlertPublished(handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<RegressionAlertPayload>>;
103
- export declare function onRegressionAlertPublished(appId: string, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<RegressionAlertPayload>>;
104
- export declare function onRegressionAlertPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<RegressionAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<RegressionAlertPayload>>;
309
+ export declare function onVelocityAlertPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<VelocityAlertPayload>>;
105
310
  /**
106
- * Declares a function that can handle a stability digest published to crashlytics.
311
+ * Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
312
+ * @param handler - Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
313
+ * @returns A function that you can export and deploy.
107
314
  */
108
- export declare function onStabilityDigestPublished(handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<StabilityDigestPayload>>;
109
- export declare function onStabilityDigestPublished(appId: string, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<StabilityDigestPayload>>;
110
- export declare function onStabilityDigestPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<StabilityDigestPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<StabilityDigestPayload>>;
315
+ export declare function onNewAnrIssuePublished(handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>;
111
316
  /**
112
- * Declares a function that can handle a velocity alert published to crashlytics.
317
+ * Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
318
+ * @param appId - A specific application the handler will trigger on.
319
+ * @param handler - Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
320
+ * @returns A function that you can export and deploy.
321
+
113
322
  */
114
- export declare function onVelocityAlertPublished(handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<VelocityAlertPayload>>;
115
- export declare function onVelocityAlertPublished(appId: string, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<VelocityAlertPayload>>;
116
- export declare function onVelocityAlertPublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<VelocityAlertPayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<VelocityAlertPayload>>;
323
+ export declare function onNewAnrIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>;
117
324
  /**
118
- * Declares a function that can handle a new Application Not Responding issue published to crashlytics.
325
+ * Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
326
+ * @param opts - Options that can be set on the function.
327
+ * @param handler - Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
328
+ * @returns A function that you can export and deploy.
329
+
119
330
  */
120
- export declare function onNewAnrIssuePublished(handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewAnrIssuePayload>>;
121
- export declare function onNewAnrIssuePublished(appId: string, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewAnrIssuePayload>>;
122
- export declare function onNewAnrIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<NewAnrIssuePayload>>;
123
- export {};
331
+ export declare function onNewAnrIssuePublished(opts: CrashlyticsOptions, handler: (event: CrashlyticsEvent<NewAnrIssuePayload>) => any | Promise<any>): CloudFunction<CrashlyticsEvent<NewAnrIssuePayload>>;
@@ -1,6 +1,31 @@
1
1
  "use strict";
2
+ // The MIT License (MIT)
3
+ //
4
+ // Copyright (c) 2022 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.
2
23
  Object.defineProperty(exports, "__esModule", { value: true });
3
24
  exports.getOptsAndApp = exports.onOperation = exports.onNewAnrIssuePublished = exports.onVelocityAlertPublished = exports.onStabilityDigestPublished = exports.onRegressionAlertPublished = exports.onNewNonfatalIssuePublished = exports.onNewFatalIssuePublished = exports.newAnrIssueAlert = exports.velocityAlert = exports.stabilityDigestAlert = exports.regressionAlert = exports.newNonfatalIssueAlert = exports.newFatalIssueAlert = void 0;
25
+ /**
26
+ * Cloud functions to handle Crashlytics events from Firebase Alerts.
27
+ * @packageDocumentation
28
+ */
4
29
  const _1 = require(".");
5
30
  /** @internal */
6
31
  exports.newFatalIssueAlert = 'crashlytics.newFatalIssue';
@@ -14,26 +39,62 @@ exports.stabilityDigestAlert = 'crashlytics.stabilityDigest';
14
39
  exports.velocityAlert = 'crashlytics.velocity';
15
40
  /** @internal */
16
41
  exports.newAnrIssueAlert = 'crashlytics.newAnrIssue';
42
+ /**
43
+ * Declares a function that can handle a new fatal issue published to Crashlytics.
44
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
45
+ * @param handler - Event handler that is triggered when a new fatal issue is published to Crashlytics.
46
+ * @returns A function that you can export and deploy.
47
+ */
17
48
  function onNewFatalIssuePublished(appIdOrOptsOrHandler, handler) {
18
49
  return onOperation(exports.newFatalIssueAlert, appIdOrOptsOrHandler, handler);
19
50
  }
20
51
  exports.onNewFatalIssuePublished = onNewFatalIssuePublished;
52
+ /**
53
+ * Declares a function that can handle a new non-fatal issue published to Crashlytics.
54
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
55
+ * @param handler - Event handler that is triggered when a new non-fatal issue is published to Crashlytics.
56
+ * @returns A function that you can export and deploy.
57
+ */
21
58
  function onNewNonfatalIssuePublished(appIdOrOptsOrHandler, handler) {
22
59
  return onOperation(exports.newNonfatalIssueAlert, appIdOrOptsOrHandler, handler);
23
60
  }
24
61
  exports.onNewNonfatalIssuePublished = onNewNonfatalIssuePublished;
62
+ /**
63
+ * Declares a function that can handle a regression alert published to Crashlytics.
64
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
65
+ * @param handler - Event handler that is triggered when a regression alert is published to Crashlytics.
66
+ * @returns A function that you can export and deploy.
67
+ */
25
68
  function onRegressionAlertPublished(appIdOrOptsOrHandler, handler) {
26
69
  return onOperation(exports.regressionAlert, appIdOrOptsOrHandler, handler);
27
70
  }
28
71
  exports.onRegressionAlertPublished = onRegressionAlertPublished;
72
+ /**
73
+ * Declares a function that can handle a stability digest published to Crashlytics.
74
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
75
+ * @param handler - Event handler that is triggered when a stability digest is published to Crashlytics.
76
+ * @returns A function that you can export and deploy.
77
+ */
29
78
  function onStabilityDigestPublished(appIdOrOptsOrHandler, handler) {
30
79
  return onOperation(exports.stabilityDigestAlert, appIdOrOptsOrHandler, handler);
31
80
  }
32
81
  exports.onStabilityDigestPublished = onStabilityDigestPublished;
82
+ /**
83
+ * Declares a function that can handle a velocity alert published to Crashlytics.
84
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
85
+ * @param handler - Event handler that is triggered when a velocity alert is published to Crashlytics.
86
+ * @returns A function that you can export and deploy.
87
+ */
33
88
  function onVelocityAlertPublished(appIdOrOptsOrHandler, handler) {
34
89
  return onOperation(exports.velocityAlert, appIdOrOptsOrHandler, handler);
35
90
  }
36
91
  exports.onVelocityAlertPublished = onVelocityAlertPublished;
92
+ /**
93
+ * Declares a function that can handle a new Application Not Responding issue published to Crashlytics.
94
+ * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
95
+ * @param handler - Event handler that is triggered when a new Application Not Responding issue is published to Crashlytics.
96
+ * @returns A function that you can export and deploy.
97
+ */
37
98
  function onNewAnrIssuePublished(appIdOrOptsOrHandler, handler) {
38
99
  return onOperation(exports.newAnrIssueAlert, appIdOrOptsOrHandler, handler);
39
100
  }
@@ -49,13 +110,13 @@ function onOperation(alertType, appIdOrOptsOrHandler, handler) {
49
110
  return handler(raw);
50
111
  };
51
112
  func.run = handler;
52
- func.__endpoint = _1.getEndpointAnnotation(opts, alertType, appId);
113
+ func.__endpoint = (0, _1.getEndpointAnnotation)(opts, alertType, appId);
53
114
  return func;
54
115
  }
55
116
  exports.onOperation = onOperation;
56
117
  /**
57
- * @internal
58
118
  * Helper function to parse the function opts and appId.
119
+ * @internal
59
120
  */
60
121
  function getOptsAndApp(appIdOrOpts) {
61
122
  let opts;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Cloud functions to handle events from Firebase Alerts.
3
+ * Subpackages give stronger typing to specific services which
4
+ * notify users via Firebase Alerts.
5
+ * @packageDocumentation
6
+ */
1
7
  import * as appDistribution from './appDistribution';
2
8
  import * as billing from './billing';
3
9
  import * as crashlytics from './crashlytics';
@@ -1,7 +1,32 @@
1
1
  "use strict";
2
+ // The MIT License (MIT)
3
+ //
4
+ // Copyright (c) 2022 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.
2
23
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
24
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
5
30
  }) : (function(o, m, k, k2) {
6
31
  if (k2 === undefined) k2 = k;
7
32
  o[k2] = m[k];
@@ -11,6 +36,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
36
  };
12
37
  Object.defineProperty(exports, "__esModule", { value: true });
13
38
  exports.crashlytics = exports.billing = exports.appDistribution = void 0;
39
+ /**
40
+ * Cloud functions to handle events from Firebase Alerts.
41
+ * Subpackages give stronger typing to specific services which
42
+ * notify users via Firebase Alerts.
43
+ * @packageDocumentation
44
+ */
14
45
  const appDistribution = require("./appDistribution");
15
46
  exports.appDistribution = appDistribution;
16
47
  const billing = require("./billing");
@@ -1,9 +1,9 @@
1
- import * as options from '../options';
2
1
  import { CloudEvent, CloudFunction } from '../core';
2
+ import * as options from '../options';
3
3
  /** Options that can be set on an Eventarc trigger. */
4
4
  export interface EventarcTriggerOptions extends options.EventHandlerOptions {
5
5
  /**
6
- * Type of the event.
6
+ * Type of the event to trigger on.
7
7
  */
8
8
  eventType: string;
9
9
  /**
@@ -25,8 +25,92 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions {
25
25
  * Eventarc event exact match filter.
26
26
  */
27
27
  filters?: Record<string, string>;
28
+ /**
29
+ * Region where functions should be deployed.
30
+ */
31
+ region?: options.SupportedRegion | string;
32
+ /**
33
+ * Amount of memory to allocate to a function.
34
+ * A value of null restores the defaults of 256MB.
35
+ */
36
+ memory?: options.MemoryOption | null;
37
+ /**
38
+ * Timeout for the function in sections, possible values are 0 to 540.
39
+ * HTTPS functions can specify a higher timeout.
40
+ * A value of null restores the default of 60s
41
+ * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
42
+ * function depends on the type of function: Event handling functions have a
43
+ * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
44
+ * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
45
+ * timeout of 1,800s (30 minutes)
46
+ */
47
+ timeoutSeconds?: number | null;
48
+ /**
49
+ * Min number of actual instances to be running at a given time.
50
+ * Instances will be billed for memory allocation and 10% of CPU allocation
51
+ * while idle.
52
+ * A value of null restores the default min instances.
53
+ */
54
+ minInstances?: number | null;
55
+ /**
56
+ * Max number of instances to be running in parallel.
57
+ * A value of null restores the default max instances.
58
+ */
59
+ maxInstances?: number | null;
60
+ /**
61
+ * Number of requests a function can serve at once.
62
+ * Can only be applied to functions running on Cloud Functions v2.
63
+ * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
64
+ * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
65
+ * The maximum value for concurrency is 1,000.
66
+ */
67
+ concurrency?: number | null;
68
+ /**
69
+ * Fractional number of CPUs to allocate to a function.
70
+ * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
71
+ * This is different from the defaults when using the gcloud utility and is different from
72
+ * the fixed amount assigned in Google Cloud Functions generation 1.
73
+ * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
74
+ * to the value "gcf_gen1"
75
+ */
76
+ cpu?: number | 'gcf_gen1';
77
+ /**
78
+ * Connect cloud function to specified VPC connector.
79
+ * A value of null removes the VPC connector
80
+ */
81
+ vpcConnector?: string | null;
82
+ /**
83
+ * Egress settings for VPC connector.
84
+ * A value of null turns off VPC connector egress settings
85
+ */
86
+ vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
87
+ /**
88
+ * Specific service account for the function to run as.
89
+ * A value of null restores the default service account.
90
+ */
91
+ serviceAccount?: string | null;
92
+ /**
93
+ * Ingress settings which control where this function can be called from.
94
+ * A value of null turns off ingress settings.
95
+ */
96
+ ingressSettings?: options.IngressSetting | null;
97
+ /**
98
+ * User labels to set on the function.
99
+ */
100
+ labels?: Record<string, string>;
101
+ secrets?: string[];
102
+ /** Whether failed executions should be delivered again. */
103
+ retry?: boolean;
28
104
  }
29
- export declare type CloudEventHandler = (event: CloudEvent<any>) => any | Promise<any>;
30
- /** Handle an Eventarc event published on the default channel. */
31
- export declare function onCustomEventPublished<T = any>(eventType: string, handler: CloudEventHandler): CloudFunction<CloudEvent<T>>;
32
- export declare function onCustomEventPublished<T = any>(opts: EventarcTriggerOptions, handler: CloudEventHandler): CloudFunction<CloudEvent<T>>;
105
+ /** Handles an Eventarc event published on the default channel.
106
+ * @param eventType - Type of the event to trigger on.
107
+ * @param handler - A function to execute when triggered.
108
+ * @returns A function that you can export and deploy.
109
+ */
110
+ export declare function onCustomEventPublished<T = any>(eventType: string, handler: (event: CloudEvent<T>) => any | Promise<any>): CloudFunction<CloudEvent<T>>;
111
+ /** Handles an Eventarc event.
112
+ * @param opts - Options to set on this function
113
+ * @param handler - A function to execute when triggered.
114
+ * @returns A function that you can export and deploy.
115
+ */
116
+ export declare function onCustomEventPublished<T = any>(opts: EventarcTriggerOptions, handler: (event: CloudEvent<T>) => any | Promise<any>): CloudFunction<CloudEvent<T>>;