firebase-functions 3.24.1 → 4.0.0-rc.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 (130) hide show
  1. package/README.md +7 -9
  2. package/lib/bin/firebase-functions.js +13 -15
  3. package/lib/common/app.d.ts +14 -0
  4. package/lib/common/app.js +62 -0
  5. package/lib/common/change.d.ts +0 -5
  6. package/lib/common/change.js +5 -7
  7. package/lib/common/config.d.ts +6 -0
  8. package/lib/common/config.js +49 -0
  9. package/lib/common/debug.js +2 -2
  10. package/lib/common/encoding.d.ts +0 -8
  11. package/lib/common/encoding.js +6 -29
  12. package/lib/common/options.d.ts +14 -0
  13. package/lib/common/options.js +44 -0
  14. package/lib/common/params.d.ts +32 -0
  15. package/lib/common/params.js +23 -0
  16. package/lib/common/providers/database.d.ts +17 -19
  17. package/lib/common/providers/database.js +68 -39
  18. package/lib/common/providers/https.d.ts +11 -52
  19. package/lib/common/providers/https.js +115 -110
  20. package/lib/common/providers/identity.d.ts +8 -8
  21. package/lib/common/providers/identity.js +71 -79
  22. package/lib/common/providers/tasks.d.ts +11 -10
  23. package/lib/common/providers/tasks.js +10 -9
  24. package/lib/common/timezone.js +538 -538
  25. package/lib/common/trace.d.ts +14 -0
  26. package/lib/common/trace.js +69 -0
  27. package/lib/{encoder.d.ts → common/utilities/encoder.d.ts} +0 -0
  28. package/lib/{encoder.js → common/utilities/encoder.js} +1 -1
  29. package/lib/{utilities → common/utilities}/path-pattern.d.ts +0 -0
  30. package/lib/{utilities → common/utilities}/path-pattern.js +17 -16
  31. package/lib/{utilities → common/utilities}/path.d.ts +0 -0
  32. package/lib/{utilities → common/utilities}/path.js +5 -7
  33. package/lib/{utils.d.ts → common/utilities/utils.d.ts} +1 -1
  34. package/lib/{utils.js → common/utilities/utils.js} +18 -12
  35. package/lib/logger/common.d.ts +1 -3
  36. package/lib/logger/common.js +9 -14
  37. package/lib/logger/compat.js +9 -9
  38. package/lib/logger/index.d.ts +1 -1
  39. package/lib/logger/index.js +24 -30
  40. package/lib/{v2/params → params}/index.d.ts +22 -9
  41. package/lib/{v2/params → params}/index.js +22 -14
  42. package/lib/params/types.d.ts +180 -0
  43. package/lib/params/types.js +289 -0
  44. package/lib/runtime/loader.js +12 -14
  45. package/lib/runtime/manifest.d.ts +56 -24
  46. package/lib/runtime/manifest.js +114 -4
  47. package/lib/v1/cloud-functions.d.ts +232 -0
  48. package/lib/v1/cloud-functions.js +205 -0
  49. package/lib/v1/config.d.ts +8 -0
  50. package/lib/v1/config.js +75 -0
  51. package/lib/{function-builder.d.ts → v1/function-builder.d.ts} +16 -16
  52. package/lib/{function-builder.js → v1/function-builder.js} +56 -46
  53. package/lib/v1/function-configuration.d.ts +197 -0
  54. package/lib/v1/function-configuration.js +70 -0
  55. package/lib/v1/index.d.ts +20 -0
  56. package/lib/{index.js → v1/index.js} +5 -10
  57. package/lib/{providers → v1/providers}/analytics.d.ts +5 -11
  58. package/lib/{providers → v1/providers}/analytics.js +49 -43
  59. package/lib/{providers → v1/providers}/auth.d.ts +28 -18
  60. package/lib/{providers → v1/providers}/auth.js +45 -34
  61. package/lib/{providers → v1/providers}/database.d.ts +25 -42
  62. package/lib/{providers → v1/providers}/database.js +46 -46
  63. package/lib/{providers → v1/providers}/firestore.d.ts +15 -33
  64. package/lib/{providers → v1/providers}/firestore.js +40 -44
  65. package/lib/{providers → v1/providers}/https.d.ts +3 -8
  66. package/lib/{providers → v1/providers}/https.js +14 -22
  67. package/lib/{providers → v1/providers}/pubsub.d.ts +8 -16
  68. package/lib/{providers → v1/providers}/pubsub.js +22 -26
  69. package/lib/{providers → v1/providers}/remoteConfig.d.ts +2 -11
  70. package/lib/{providers → v1/providers}/remoteConfig.js +9 -9
  71. package/lib/{providers → v1/providers}/storage.d.ts +11 -26
  72. package/lib/{providers → v1/providers}/storage.js +24 -29
  73. package/lib/{providers → v1/providers}/tasks.d.ts +6 -8
  74. package/lib/{providers → v1/providers}/tasks.js +12 -17
  75. package/lib/{providers → v1/providers}/testLab.d.ts +86 -46
  76. package/lib/{providers → v1/providers}/testLab.js +14 -14
  77. package/lib/v2/core.d.ts +4 -5
  78. package/lib/v2/index.d.ts +16 -14
  79. package/lib/v2/index.js +5 -1
  80. package/lib/v2/options.d.ts +52 -32
  81. package/lib/v2/options.js +32 -47
  82. package/lib/v2/providers/alerts/alerts.d.ts +20 -18
  83. package/lib/v2/providers/alerts/alerts.js +9 -6
  84. package/lib/v2/providers/alerts/appDistribution.d.ts +28 -26
  85. package/lib/v2/providers/alerts/appDistribution.js +8 -7
  86. package/lib/v2/providers/alerts/billing.d.ts +5 -5
  87. package/lib/v2/providers/alerts/billing.js +5 -4
  88. package/lib/v2/providers/alerts/crashlytics.d.ts +32 -30
  89. package/lib/v2/providers/alerts/crashlytics.js +10 -9
  90. package/lib/v2/providers/alerts/index.d.ts +5 -5
  91. package/lib/v2/providers/alerts/performance.d.ts +3 -3
  92. package/lib/v2/providers/alerts/performance.js +5 -7
  93. package/lib/v2/providers/database.d.ts +41 -38
  94. package/lib/v2/providers/database.js +22 -17
  95. package/lib/v2/providers/eventarc.d.ts +25 -23
  96. package/lib/v2/providers/eventarc.js +10 -7
  97. package/lib/v2/providers/https.d.ts +43 -33
  98. package/lib/v2/providers/https.js +18 -56
  99. package/lib/v2/providers/identity.d.ts +25 -23
  100. package/lib/v2/providers/identity.js +10 -7
  101. package/lib/v2/providers/pubsub.d.ts +25 -23
  102. package/lib/v2/providers/pubsub.js +11 -27
  103. package/lib/v2/providers/remoteConfig.d.ts +63 -0
  104. package/lib/v2/providers/remoteConfig.js +65 -0
  105. package/lib/v2/providers/scheduler.d.ts +14 -12
  106. package/lib/v2/providers/scheduler.js +16 -14
  107. package/lib/v2/providers/storage.d.ts +32 -30
  108. package/lib/v2/providers/storage.js +16 -32
  109. package/lib/v2/providers/tasks.d.ts +30 -26
  110. package/lib/v2/providers/tasks.js +14 -31
  111. package/lib/v2/providers/testLab.d.ts +110 -0
  112. package/lib/v2/providers/testLab.js +65 -0
  113. package/lib/v2/trace.d.ts +4 -0
  114. package/lib/v2/trace.js +21 -0
  115. package/package.json +61 -66
  116. package/lib/apps.d.ts +0 -35
  117. package/lib/apps.js +0 -112
  118. package/lib/cloud-functions.d.ts +0 -231
  119. package/lib/cloud-functions.js +0 -251
  120. package/lib/config.d.ts +0 -24
  121. package/lib/config.js +0 -117
  122. package/lib/function-configuration.d.ts +0 -108
  123. package/lib/function-configuration.js +0 -71
  124. package/lib/handler-builder.d.ts +0 -256
  125. package/lib/handler-builder.js +0 -349
  126. package/lib/index.d.ts +0 -19
  127. package/lib/setup.d.ts +0 -1
  128. package/lib/setup.js +0 -60
  129. package/lib/v2/params/types.d.ts +0 -118
  130. package/lib/v2/params/types.js +0 -196
@@ -1,6 +1,8 @@
1
- import { CloudEvent, CloudFunction } from '../../core';
2
- import * as options from '../../options';
3
- import { Expression } from '../../params';
1
+ import { ResetValue } from "../../../common/options";
2
+ import { CloudEvent, CloudFunction } from "../../core";
3
+ import { Expression } from "../../../params";
4
+ import * as options from "../../options";
5
+ import { SecretParam } from "../../../params/types";
4
6
  /**
5
7
  * The CloudEvent data emitted by Firebase Alerts.
6
8
  * @typeParam T - the payload type that is expected for this alert.
@@ -29,7 +31,7 @@ export interface AlertEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
29
31
  data: FirebaseAlertData<T>;
30
32
  }
31
33
  /** The underlying alert type of the Firebase Alerts provider. */
32
- export declare type AlertType = 'crashlytics.newFatalIssue' | 'crashlytics.newNonfatalIssue' | 'crashlytics.regression' | 'crashlytics.stabilityDigest' | 'crashlytics.velocity' | 'crashlytics.newAnrIssue' | 'billing.planUpdate' | 'billing.automatedPlanUpdate' | 'appDistribution.newTesterIosDevice' | 'appDistribution.inAppFeedback' | 'performance.threshold' | string;
34
+ export declare type AlertType = "crashlytics.newFatalIssue" | "crashlytics.newNonfatalIssue" | "crashlytics.regression" | "crashlytics.stabilityDigest" | "crashlytics.velocity" | "crashlytics.newAnrIssue" | "billing.planUpdate" | "billing.automatedPlanUpdate" | "appDistribution.newTesterIosDevice" | "appDistribution.inAppFeedback" | "performance.threshold" | string;
33
35
  /**
34
36
  * Configuration for Firebase Alert functions.
35
37
  */
@@ -46,7 +48,7 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
46
48
  * Amount of memory to allocate to a function.
47
49
  * A value of null restores the defaults of 256MB.
48
50
  */
49
- memory?: options.MemoryOption | Expression<number> | null;
51
+ memory?: options.MemoryOption | Expression<number> | ResetValue;
50
52
  /**
51
53
  * Timeout for the function in sections, possible values are 0 to 540.
52
54
  * HTTPS functions can specify a higher timeout.
@@ -57,19 +59,19 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
57
59
  * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
58
60
  * timeout of 1,800s (30 minutes)
59
61
  */
60
- timeoutSeconds?: number | Expression<number> | null;
62
+ timeoutSeconds?: number | Expression<number> | ResetValue;
61
63
  /**
62
64
  * Min number of actual instances to be running at a given time.
63
65
  * Instances will be billed for memory allocation and 10% of CPU allocation
64
66
  * while idle.
65
67
  * A value of null restores the default min instances.
66
68
  */
67
- minInstances?: number | Expression<number> | null;
69
+ minInstances?: number | Expression<number> | ResetValue;
68
70
  /**
69
71
  * Max number of instances to be running in parallel.
70
72
  * A value of null restores the default max instances.
71
73
  */
72
- maxInstances?: number | Expression<number> | null;
74
+ maxInstances?: number | Expression<number> | ResetValue;
73
75
  /**
74
76
  * Number of requests a function can serve at once.
75
77
  * Can only be applied to functions running on Cloud Functions v2.
@@ -77,7 +79,7 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
77
79
  * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
78
80
  * The maximum value for concurrency is 1,000.
79
81
  */
80
- concurrency?: number | Expression<number> | null;
82
+ concurrency?: number | Expression<number> | ResetValue;
81
83
  /**
82
84
  * Fractional number of CPUs to allocate to a function.
83
85
  * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
@@ -86,34 +88,34 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
86
88
  * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
87
89
  * to the value "gcf_gen1"
88
90
  */
89
- cpu?: number | 'gcf_gen1';
91
+ cpu?: number | "gcf_gen1";
90
92
  /**
91
93
  * Connect cloud function to specified VPC connector.
92
94
  * A value of null removes the VPC connector
93
95
  */
94
- vpcConnector?: string | null;
96
+ vpcConnector?: string | ResetValue;
95
97
  /**
96
98
  * Egress settings for VPC connector.
97
99
  * A value of null turns off VPC connector egress settings
98
100
  */
99
- vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
101
+ vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
100
102
  /**
101
103
  * Specific service account for the function to run as.
102
104
  * A value of null restores the default service account.
103
105
  */
104
- serviceAccount?: string | null;
106
+ serviceAccount?: string | ResetValue;
105
107
  /**
106
108
  * Ingress settings which control where this function can be called from.
107
109
  * A value of null turns off ingress settings.
108
110
  */
109
- ingressSettings?: options.IngressSetting | null;
111
+ ingressSettings?: options.IngressSetting | ResetValue;
110
112
  /**
111
113
  * User labels to set on the function.
112
114
  */
113
115
  labels?: Record<string, string>;
114
- secrets?: string[];
116
+ secrets?: (string | SecretParam)[];
115
117
  /** Whether failed executions should be delivered again. */
116
- retry?: boolean;
118
+ retry?: boolean | Expression<boolean> | ResetValue;
117
119
  }
118
120
  /**
119
121
  * Declares a function that can handle Firebase Alerts from CloudEvents.
@@ -123,7 +125,7 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions {
123
125
  * @returns A function that you can export and deploy.
124
126
  */
125
127
  export declare function onAlertPublished<T extends {
126
- ['@type']: string;
128
+ ["@type"]: string;
127
129
  } = any>(alertType: AlertType, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
128
130
  /**
129
131
  * Declares a function that can handle Firebase Alerts from CloudEvents.
@@ -132,5 +134,5 @@ export declare function onAlertPublished<T extends {
132
134
  * @param handler a function that can handle the Firebase Alert inside a CloudEvent.
133
135
  */
134
136
  export declare function onAlertPublished<T extends {
135
- ['@type']: string;
137
+ ["@type"]: string;
136
138
  } = any>(options: FirebaseAlertOptions, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
@@ -22,13 +22,15 @@
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.convertAlertAndApp = exports.getOptsAndAlertTypeAndApp = exports.getEndpointAnnotation = exports.onAlertPublished = exports.eventType = void 0;
25
+ const manifest_1 = require("../../../runtime/manifest");
26
+ const trace_1 = require("../../trace");
25
27
  const options = require("../../options");
26
28
  /** @internal */
27
- exports.eventType = 'google.firebase.firebasealerts.alerts.v1.published';
29
+ exports.eventType = "google.firebase.firebasealerts.alerts.v1.published";
28
30
  function onAlertPublished(alertTypeOrOpts, handler) {
29
31
  const [opts, alertType, appId] = getOptsAndAlertTypeAndApp(alertTypeOrOpts);
30
32
  const func = (raw) => {
31
- return handler(convertAlertAndApp(raw));
33
+ return (0, trace_1.wrapTraceContext)(handler(convertAlertAndApp(raw)));
32
34
  };
33
35
  func.run = handler;
34
36
  func.__endpoint = getEndpointAnnotation(opts, alertType, appId);
@@ -43,7 +45,8 @@ function getEndpointAnnotation(opts, alertType, appId) {
43
45
  const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
44
46
  const specificOpts = options.optionsToEndpoint(opts);
45
47
  const endpoint = {
46
- platform: 'gcfv2',
48
+ ...(0, manifest_1.initV2Endpoint)(options.getGlobalOptions(), opts),
49
+ platform: "gcfv2",
47
50
  ...baseOpts,
48
51
  ...specificOpts,
49
52
  labels: {
@@ -72,7 +75,7 @@ function getOptsAndAlertTypeAndApp(alertTypeOrOpts) {
72
75
  let opts;
73
76
  let alertType;
74
77
  let appId;
75
- if (typeof alertTypeOrOpts === 'string') {
78
+ if (typeof alertTypeOrOpts === "string") {
76
79
  alertType = alertTypeOrOpts;
77
80
  opts = {};
78
81
  }
@@ -92,10 +95,10 @@ exports.getOptsAndAlertTypeAndApp = getOptsAndAlertTypeAndApp;
92
95
  */
93
96
  function convertAlertAndApp(raw) {
94
97
  const event = { ...raw };
95
- if ('alerttype' in event) {
98
+ if ("alerttype" in event) {
96
99
  event.alertType = event.alerttype;
97
100
  }
98
- if ('appid' in event) {
101
+ if ("appid" in event) {
99
102
  event.appId = event.appid;
100
103
  }
101
104
  return event;
@@ -2,16 +2,18 @@
2
2
  * Cloud functions to handle Firebase App Distribution events from Firebase Alerts.
3
3
  * @packageDocumentation
4
4
  */
5
- import { CloudEvent, CloudFunction } from '../../core';
6
- import * as options from '../../options';
7
- import { Expression } from '../../params';
8
- import { FirebaseAlertData } from './alerts';
5
+ import { ResetValue } from "../../../common/options";
6
+ import { Expression } from "../../../params";
7
+ import { CloudEvent, CloudFunction } from "../../core";
8
+ import { FirebaseAlertData } from "./alerts";
9
+ import * as options from "../../options";
10
+ import { SecretParam } from "../../../params/types";
9
11
  /**
10
12
  * The internal payload object for adding a new tester device to app distribution.
11
13
  * Payload is wrapped inside a `FirebaseAlertData` object.
12
14
  */
13
15
  export interface NewTesterDevicePayload {
14
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroNewTesterIosDevicePayload';
16
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroNewTesterIosDevicePayload";
15
17
  /** Name of the tester */
16
18
  testerName: string;
17
19
  /** Email of the tester */
@@ -28,7 +30,7 @@ export interface NewTesterDevicePayload {
28
30
  * @alpha
29
31
  */
30
32
  export interface InAppFeedbackPayload {
31
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroInAppFeedbackPayload';
33
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroInAppFeedbackPayload";
32
34
  /** Resource name. Format: `projects/{project_number}/apps/{app_id}/releases/{release_id}/feedbackReports/{feedback_id}` */
33
35
  feedbackReport: string;
34
36
  /** Deep link back to the Firebase console. */
@@ -69,76 +71,76 @@ export interface AppDistributionOptions extends options.EventHandlerOptions {
69
71
  region?: options.SupportedRegion | string;
70
72
  /**
71
73
  * Amount of memory to allocate to a function.
72
- * A value of null restores the defaults of 256MB.
73
74
  */
74
- memory?: options.MemoryOption | Expression<number> | null;
75
+ memory?: options.MemoryOption | Expression<number> | ResetValue;
75
76
  /**
76
77
  * Timeout for the function in sections, possible values are 0 to 540.
77
78
  * HTTPS functions can specify a higher timeout.
78
- * A value of null restores the default of 60s
79
+ *
80
+ * @remarks
79
81
  * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
80
82
  * function depends on the type of function: Event handling functions have a
81
83
  * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
82
84
  * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
83
85
  * timeout of 1,800s (30 minutes)
84
86
  */
85
- timeoutSeconds?: number | Expression<number> | null;
87
+ timeoutSeconds?: number | Expression<number> | ResetValue;
86
88
  /**
87
89
  * Min number of actual instances to be running at a given time.
90
+ *
91
+ * @remarks
88
92
  * Instances will be billed for memory allocation and 10% of CPU allocation
89
93
  * while idle.
90
- * A value of null restores the default min instances.
91
94
  */
92
- minInstances?: number | Expression<number> | null;
95
+ minInstances?: number | Expression<number> | ResetValue;
93
96
  /**
94
97
  * Max number of instances to be running in parallel.
95
- * A value of null restores the default max instances.
96
98
  */
97
- maxInstances?: number | Expression<number> | null;
99
+ maxInstances?: number | Expression<number> | ResetValue;
98
100
  /**
99
101
  * Number of requests a function can serve at once.
102
+ *
103
+ * @remarks
100
104
  * Can only be applied to functions running on Cloud Functions v2.
101
105
  * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
102
106
  * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
103
107
  * The maximum value for concurrency is 1,000.
104
108
  */
105
- concurrency?: number | Expression<number> | null;
109
+ concurrency?: number | Expression<number> | ResetValue;
106
110
  /**
107
111
  * Fractional number of CPUs to allocate to a function.
112
+ *
113
+ * @remarks
108
114
  * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
109
115
  * This is different from the defaults when using the gcloud utility and is different from
110
116
  * the fixed amount assigned in Google Cloud Functions generation 1.
111
117
  * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
112
118
  * to the value "gcf_gen1"
113
119
  */
114
- cpu?: number | 'gcf_gen1';
120
+ cpu?: number | "gcf_gen1";
115
121
  /**
116
122
  * Connect cloud function to specified VPC connector.
117
- * A value of null removes the VPC connector
118
123
  */
119
- vpcConnector?: string | null;
124
+ vpcConnector?: string | ResetValue;
120
125
  /**
121
126
  * Egress settings for VPC connector.
122
- * A value of null turns off VPC connector egress settings
123
127
  */
124
- vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
128
+ vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
125
129
  /**
126
130
  * Specific service account for the function to run as.
127
- * A value of null restores the default service account.
128
131
  */
129
- serviceAccount?: string | null;
132
+ serviceAccount?: string | ResetValue;
130
133
  /**
131
134
  * Ingress settings which control where this function can be called from.
132
- * A value of null turns off ingress settings.
133
135
  */
134
- ingressSettings?: options.IngressSetting | null;
136
+ ingressSettings?: options.IngressSetting | ResetValue;
135
137
  /**
136
138
  * User labels to set on the function.
137
139
  */
138
140
  labels?: Record<string, string>;
139
- secrets?: string[];
141
+ secrets?: (string | SecretParam)[];
140
142
  /** Whether failed executions should be delivered again. */
141
- retry?: boolean;
143
+ retry?: boolean | Expression<boolean> | ResetValue;
142
144
  }
143
145
  /**
144
146
  * Declares a function that can handle adding a new tester iOS device.
@@ -22,11 +22,12 @@
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.getOptsAndApp = exports.onInAppFeedbackPublished = exports.onNewTesterIosDevicePublished = exports.inAppFeedbackAlert = exports.newTesterIosDeviceAlert = void 0;
25
+ const trace_1 = require("../../trace");
25
26
  const alerts_1 = require("./alerts");
26
27
  /** @internal */
27
- exports.newTesterIosDeviceAlert = 'appDistribution.newTesterIosDevice';
28
+ exports.newTesterIosDeviceAlert = "appDistribution.newTesterIosDevice";
28
29
  /** @internal */
29
- exports.inAppFeedbackAlert = 'appDistribution.inAppFeedback';
30
+ exports.inAppFeedbackAlert = "appDistribution.inAppFeedback";
30
31
  /**
31
32
  * Declares a function that can handle adding a new tester iOS device.
32
33
  * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
@@ -34,13 +35,13 @@ exports.inAppFeedbackAlert = 'appDistribution.inAppFeedback';
34
35
  * @returns A function that you can export and deploy.
35
36
  */
36
37
  function onNewTesterIosDevicePublished(appIdOrOptsOrHandler, handler) {
37
- if (typeof appIdOrOptsOrHandler === 'function') {
38
+ if (typeof appIdOrOptsOrHandler === "function") {
38
39
  handler = appIdOrOptsOrHandler;
39
40
  appIdOrOptsOrHandler = {};
40
41
  }
41
42
  const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
42
43
  const func = (raw) => {
43
- return handler((0, alerts_1.convertAlertAndApp)(raw));
44
+ return (0, trace_1.wrapTraceContext)(handler((0, alerts_1.convertAlertAndApp)(raw)));
44
45
  };
45
46
  func.run = handler;
46
47
  func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, exports.newTesterIosDeviceAlert, appId);
@@ -56,13 +57,13 @@ exports.onNewTesterIosDevicePublished = onNewTesterIosDevicePublished;
56
57
  * @alpha
57
58
  */
58
59
  function onInAppFeedbackPublished(appIdOrOptsOrHandler, handler) {
59
- if (typeof appIdOrOptsOrHandler === 'function') {
60
+ if (typeof appIdOrOptsOrHandler === "function") {
60
61
  handler = appIdOrOptsOrHandler;
61
62
  appIdOrOptsOrHandler = {};
62
63
  }
63
64
  const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
64
65
  const func = (raw) => {
65
- return handler((0, alerts_1.convertAlertAndApp)(raw));
66
+ return (0, trace_1.wrapTraceContext)(handler((0, alerts_1.convertAlertAndApp)(raw)));
66
67
  };
67
68
  func.run = handler;
68
69
  func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, exports.inAppFeedbackAlert, appId);
@@ -76,7 +77,7 @@ exports.onInAppFeedbackPublished = onInAppFeedbackPublished;
76
77
  function getOptsAndApp(appIdOrOpts) {
77
78
  let opts;
78
79
  let appId;
79
- if (typeof appIdOrOpts === 'string') {
80
+ if (typeof appIdOrOpts === "string") {
80
81
  opts = {};
81
82
  appId = appIdOrOpts;
82
83
  }
@@ -2,15 +2,15 @@
2
2
  * Cloud functions to handle billing events from Firebase Alerts.
3
3
  * @packageDocumentation
4
4
  */
5
- import { CloudEvent, CloudFunction } from '../../core';
6
- import * as options from '../../options';
7
- import { FirebaseAlertData } from './alerts';
5
+ import { CloudEvent, CloudFunction } from "../../core";
6
+ import { FirebaseAlertData } from "./alerts";
7
+ import * as options from "../../options";
8
8
  /**
9
9
  * The internal payload object for billing plan updates.
10
10
  * Payload is wrapped inside a `FirebaseAlertData` object.
11
11
  */
12
12
  export interface PlanUpdatePayload {
13
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanUpdatePayload';
13
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanUpdatePayload";
14
14
  /** A Firebase billing plan. */
15
15
  billingPlan: string;
16
16
  /** The email address of the person that triggered billing plan change */
@@ -23,7 +23,7 @@ export interface PlanUpdatePayload {
23
23
  * Payload is wrapped inside a `FirebaseAlertData` object.
24
24
  */
25
25
  export interface PlanAutomatedUpdatePayload {
26
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanAutomatedUpdatePayload';
26
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanAutomatedUpdatePayload";
27
27
  /** A Firebase billing plan. */
28
28
  billingPlan: string;
29
29
  /** The type of the notification, e.g. upgrade, downgrade */
@@ -22,11 +22,12 @@
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.onOperation = exports.onPlanAutomatedUpdatePublished = exports.onPlanUpdatePublished = exports.planAutomatedUpdateAlert = exports.planUpdateAlert = void 0;
25
+ const trace_1 = require("../../trace");
25
26
  const alerts_1 = require("./alerts");
26
27
  /** @internal */
27
- exports.planUpdateAlert = 'billing.planUpdate';
28
+ exports.planUpdateAlert = "billing.planUpdate";
28
29
  /** @internal */
29
- exports.planAutomatedUpdateAlert = 'billing.planAutomatedUpdate';
30
+ exports.planAutomatedUpdateAlert = "billing.planAutomatedUpdate";
30
31
  /**
31
32
  * Declares a function that can handle a billing plan update event.
32
33
  * @param optsOrHandler - Options or an event-handling function.
@@ -49,12 +50,12 @@ function onPlanAutomatedUpdatePublished(optsOrHandler, handler) {
49
50
  exports.onPlanAutomatedUpdatePublished = onPlanAutomatedUpdatePublished;
50
51
  /** @internal */
51
52
  function onOperation(alertType, optsOrHandler, handler) {
52
- if (typeof optsOrHandler === 'function') {
53
+ if (typeof optsOrHandler === "function") {
53
54
  handler = optsOrHandler;
54
55
  optsOrHandler = {};
55
56
  }
56
57
  const func = (raw) => {
57
- return handler((0, alerts_1.convertAlertAndApp)(raw));
58
+ return (0, trace_1.wrapTraceContext)(handler((0, alerts_1.convertAlertAndApp)(raw)));
58
59
  };
59
60
  func.run = handler;
60
61
  func.__endpoint = (0, alerts_1.getEndpointAnnotation)(optsOrHandler, alertType);
@@ -2,10 +2,12 @@
2
2
  * Cloud functions to handle Crashlytics events from Firebase Alerts.
3
3
  * @packageDocumentation
4
4
  */
5
- import { CloudEvent, CloudFunction } from '../../core';
6
- import * as options from '../../options';
7
- import { Expression } from '../../params';
8
- import { FirebaseAlertData } from './alerts';
5
+ import { ResetValue } from "../../../common/options";
6
+ import { Expression } from "../../../params";
7
+ import { CloudEvent, CloudFunction } from "../../core";
8
+ import { FirebaseAlertData } from "./alerts";
9
+ import * as options from "../../options";
10
+ import { SecretParam } from "../../../params/types";
9
11
  /** Generic Crashlytics issue interface */
10
12
  export interface Issue {
11
13
  /** The ID of the Crashlytics issue */
@@ -22,7 +24,7 @@ export interface Issue {
22
24
  * Payload is wrapped inside a `FirebaseAlertData` object.
23
25
  */
24
26
  export interface NewFatalIssuePayload {
25
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewFatalIssuePayload';
27
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewFatalIssuePayload";
26
28
  /** Basic information of the Crashlytics issue */
27
29
  issue: Issue;
28
30
  }
@@ -31,7 +33,7 @@ export interface NewFatalIssuePayload {
31
33
  * Payload is wrapped inside a `FirebaseAlertData` object.
32
34
  */
33
35
  export interface NewNonfatalIssuePayload {
34
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewNonfatalIssuePayload';
36
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewNonfatalIssuePayload";
35
37
  /** Basic information of the Crashlytics issue */
36
38
  issue: Issue;
37
39
  }
@@ -40,7 +42,7 @@ export interface NewNonfatalIssuePayload {
40
42
  * Payload is wrapped inside a `FirebaseAlertData` object.
41
43
  */
42
44
  export interface RegressionAlertPayload {
43
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsRegressionAlertPayload';
45
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsRegressionAlertPayload";
44
46
  /** The type of the Crashlytics issue, e.g. new fatal, new nonfatal, ANR */
45
47
  type: string;
46
48
  /** Basic information of the Crashlytics issue */
@@ -67,7 +69,7 @@ export interface TrendingIssueDetails {
67
69
  * Payload is wrapped inside a `FirebaseAlertData` object.
68
70
  */
69
71
  export interface StabilityDigestPayload {
70
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsStabilityDigestPayload';
72
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsStabilityDigestPayload";
71
73
  /**
72
74
  * The date that the digest gets created. Issues in the digest should have the
73
75
  * same date as the digest date
@@ -81,7 +83,7 @@ export interface StabilityDigestPayload {
81
83
  * Payload is wrapped inside a `FirebaseAlertData` object.
82
84
  */
83
85
  export interface VelocityAlertPayload {
84
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsVelocityAlertPayload';
86
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsVelocityAlertPayload";
85
87
  /** Basic information of the Crashlytics issue */
86
88
  issue: Issue;
87
89
  /** The time that the Crashlytics issue gets created */
@@ -107,7 +109,7 @@ export interface VelocityAlertPayload {
107
109
  * Payload is wrapped inside a `FirebaseAlertData` object.
108
110
  */
109
111
  export interface NewAnrIssuePayload {
110
- ['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewAnrIssuePayload';
112
+ ["@type"]: "type.googleapis.com/google.events.firebase.firebasealerts.v1.CrashlyticsNewAnrIssuePayload";
111
113
  /** Basic information of the Crashlytics issue */
112
114
  issue: Issue;
113
115
  }
@@ -133,76 +135,76 @@ export interface CrashlyticsOptions extends options.EventHandlerOptions {
133
135
  region?: options.SupportedRegion | string;
134
136
  /**
135
137
  * Amount of memory to allocate to a function.
136
- * A value of null restores the defaults of 256MB.
137
138
  */
138
- memory?: options.MemoryOption | Expression<number> | null;
139
+ memory?: options.MemoryOption | Expression<number> | ResetValue;
139
140
  /**
140
141
  * Timeout for the function in sections, possible values are 0 to 540.
141
142
  * HTTPS functions can specify a higher timeout.
142
- * A value of null restores the default of 60s
143
+ *
144
+ * @remarks
143
145
  * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
144
146
  * function depends on the type of function: Event handling functions have a
145
147
  * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
146
148
  * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
147
149
  * timeout of 1,800s (30 minutes)
148
150
  */
149
- timeoutSeconds?: number | Expression<number> | null;
151
+ timeoutSeconds?: number | Expression<number> | ResetValue;
150
152
  /**
151
153
  * Min number of actual instances to be running at a given time.
154
+ *
155
+ * @remarks
152
156
  * Instances will be billed for memory allocation and 10% of CPU allocation
153
157
  * while idle.
154
- * A value of null restores the default min instances.
155
158
  */
156
- minInstances?: number | Expression<number> | null;
159
+ minInstances?: number | Expression<number> | ResetValue;
157
160
  /**
158
161
  * Max number of instances to be running in parallel.
159
- * A value of null restores the default max instances.
160
162
  */
161
- maxInstances?: number | Expression<number> | null;
163
+ maxInstances?: number | Expression<number> | ResetValue;
162
164
  /**
163
165
  * Number of requests a function can serve at once.
166
+ *
167
+ * @remarks
164
168
  * Can only be applied to functions running on Cloud Functions v2.
165
169
  * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
166
170
  * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
167
171
  * The maximum value for concurrency is 1,000.
168
172
  */
169
- concurrency?: number | Expression<number> | null;
173
+ concurrency?: number | Expression<number> | ResetValue;
170
174
  /**
171
175
  * Fractional number of CPUs to allocate to a function.
176
+ *
177
+ * @remarks
172
178
  * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
173
179
  * This is different from the defaults when using the gcloud utility and is different from
174
180
  * the fixed amount assigned in Google Cloud Functions generation 1.
175
181
  * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
176
182
  * to the value "gcf_gen1"
177
183
  */
178
- cpu?: number | 'gcf_gen1';
184
+ cpu?: number | "gcf_gen1";
179
185
  /**
180
186
  * Connect cloud function to specified VPC connector.
181
- * A value of null removes the VPC connector
182
187
  */
183
- vpcConnector?: string | null;
188
+ vpcConnector?: string | ResetValue;
184
189
  /**
185
190
  * Egress settings for VPC connector.
186
- * A value of null turns off VPC connector egress settings
187
191
  */
188
- vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
192
+ vpcConnectorEgressSettings?: options.VpcEgressSetting | ResetValue;
189
193
  /**
190
194
  * Specific service account for the function to run as.
191
- * A value of null restores the default service account.
192
195
  */
193
- serviceAccount?: string | null;
196
+ serviceAccount?: string | ResetValue;
194
197
  /**
195
198
  * Ingress settings which control where this function can be called from.
196
- * A value of null turns off ingress settings.
197
199
  */
198
- ingressSettings?: options.IngressSetting | null;
200
+ ingressSettings?: options.IngressSetting | ResetValue;
199
201
  /**
200
202
  * User labels to set on the function.
201
203
  */
202
204
  labels?: Record<string, string>;
203
- secrets?: string[];
205
+ secrets?: (string | SecretParam)[];
204
206
  /** Whether failed executions should be delivered again. */
205
- retry?: boolean;
207
+ retry?: boolean | Expression<boolean> | ResetValue;
206
208
  }
207
209
  /**
208
210
  * Declares a function that can handle a new fatal issue published to Crashlytics.
@@ -22,19 +22,20 @@
22
22
  // SOFTWARE.
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
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
+ const trace_1 = require("../../trace");
25
26
  const alerts_1 = require("./alerts");
26
27
  /** @internal */
27
- exports.newFatalIssueAlert = 'crashlytics.newFatalIssue';
28
+ exports.newFatalIssueAlert = "crashlytics.newFatalIssue";
28
29
  /** @internal */
29
- exports.newNonfatalIssueAlert = 'crashlytics.newNonfatalIssue';
30
+ exports.newNonfatalIssueAlert = "crashlytics.newNonfatalIssue";
30
31
  /** @internal */
31
- exports.regressionAlert = 'crashlytics.regression';
32
+ exports.regressionAlert = "crashlytics.regression";
32
33
  /** @internal */
33
- exports.stabilityDigestAlert = 'crashlytics.stabilityDigest';
34
+ exports.stabilityDigestAlert = "crashlytics.stabilityDigest";
34
35
  /** @internal */
35
- exports.velocityAlert = 'crashlytics.velocity';
36
+ exports.velocityAlert = "crashlytics.velocity";
36
37
  /** @internal */
37
- exports.newAnrIssueAlert = 'crashlytics.newAnrIssue';
38
+ exports.newAnrIssueAlert = "crashlytics.newAnrIssue";
38
39
  /**
39
40
  * Declares a function that can handle a new fatal issue published to Crashlytics.
40
41
  * @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
@@ -97,13 +98,13 @@ function onNewAnrIssuePublished(appIdOrOptsOrHandler, handler) {
97
98
  exports.onNewAnrIssuePublished = onNewAnrIssuePublished;
98
99
  /** @internal */
99
100
  function onOperation(alertType, appIdOrOptsOrHandler, handler) {
100
- if (typeof appIdOrOptsOrHandler === 'function') {
101
+ if (typeof appIdOrOptsOrHandler === "function") {
101
102
  handler = appIdOrOptsOrHandler;
102
103
  appIdOrOptsOrHandler = {};
103
104
  }
104
105
  const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
105
106
  const func = (raw) => {
106
- return handler((0, alerts_1.convertAlertAndApp)(raw));
107
+ return (0, trace_1.wrapTraceContext)(handler((0, alerts_1.convertAlertAndApp)(raw)));
107
108
  };
108
109
  func.run = handler;
109
110
  func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, alertType, appId);
@@ -117,7 +118,7 @@ exports.onOperation = onOperation;
117
118
  function getOptsAndApp(appIdOrOpts) {
118
119
  let opts;
119
120
  let appId;
120
- if (typeof appIdOrOpts === 'string') {
121
+ if (typeof appIdOrOpts === "string") {
121
122
  opts = {};
122
123
  appId = appIdOrOpts;
123
124
  }
@@ -4,9 +4,9 @@
4
4
  * notify users via Firebase Alerts.
5
5
  * @packageDocumentation
6
6
  */
7
- import * as appDistribution from './appDistribution';
8
- import * as billing from './billing';
9
- import * as crashlytics from './crashlytics';
10
- import * as performance from './performance';
7
+ import * as appDistribution from "./appDistribution";
8
+ import * as billing from "./billing";
9
+ import * as crashlytics from "./crashlytics";
10
+ import * as performance from "./performance";
11
11
  export { appDistribution, billing, crashlytics, performance };
12
- export * from './alerts';
12
+ export * from "./alerts";