firebase-functions 3.23.0 → 3.24.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.
- package/lib/runtime/manifest.js +2 -2
- package/lib/v2/params/index.d.ts +1 -1
- package/lib/v2/params/types.d.ts +3 -3
- package/lib/v2/params/types.js +1 -1
- package/lib/v2/providers/alerts/alerts.d.ts +1 -1
- package/lib/v2/providers/alerts/alerts.js +17 -2
- package/lib/v2/providers/alerts/appDistribution.d.ts +1 -1
- package/lib/v2/providers/alerts/appDistribution.js +2 -2
- package/lib/v2/providers/alerts/billing.d.ts +1 -1
- package/lib/v2/providers/alerts/billing.js +3 -7
- package/lib/v2/providers/alerts/crashlytics.d.ts +1 -1
- package/lib/v2/providers/alerts/crashlytics.js +3 -7
- package/lib/v2/providers/alerts/index.d.ts +2 -1
- package/lib/v2/providers/alerts/index.js +3 -1
- package/lib/v2/providers/alerts/performance.d.ts +60 -0
- package/lib/v2/providers/alerts/performance.js +81 -0
- package/lib/v2/providers/tasks.d.ts +1 -1
- package/package.json +5 -1
package/lib/runtime/manifest.js
CHANGED
|
@@ -30,8 +30,8 @@ const params_1 = require("../v2/params");
|
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
32
|
function stackToWire(stack) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const wireStack = stack;
|
|
34
|
+
const traverse = function traverse(obj) {
|
|
35
35
|
for (const [key, val] of Object.entries(obj)) {
|
|
36
36
|
if (val instanceof params_1.Expression) {
|
|
37
37
|
obj[key] = val.toCEL();
|
package/lib/v2/params/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @hidden
|
|
3
3
|
* @alpha
|
|
4
4
|
*/
|
|
5
|
-
import { BooleanParam, FloatParam, IntParam, ListParam, Param, ParamOptions,
|
|
5
|
+
import { BooleanParam, Expression, FloatParam, IntParam, ListParam, Param, ParamOptions, SecretParam, StringParam } from './types';
|
|
6
6
|
export { ParamOptions, Expression };
|
|
7
7
|
declare type SecretOrExpr = Param<any> | SecretParam;
|
|
8
8
|
export declare const declaredParams: SecretOrExpr[];
|
package/lib/v2/params/types.d.ts
CHANGED
|
@@ -67,14 +67,14 @@ export interface SelectOptions<T = unknown> {
|
|
|
67
67
|
label?: string;
|
|
68
68
|
value: T;
|
|
69
69
|
}
|
|
70
|
-
export
|
|
70
|
+
export interface ParamSpec<T = unknown> {
|
|
71
71
|
name: string;
|
|
72
72
|
default?: T;
|
|
73
73
|
label?: string;
|
|
74
74
|
description?: string;
|
|
75
75
|
type: ParamValueType;
|
|
76
76
|
input?: ParamInput<T>;
|
|
77
|
-
}
|
|
77
|
+
}
|
|
78
78
|
export declare type ParamOptions<T = unknown> = Omit<ParamSpec<T>, 'name' | 'type'>;
|
|
79
79
|
export declare abstract class Param<T extends string | number | boolean | string[]> extends Expression<T> {
|
|
80
80
|
readonly name: string;
|
|
@@ -88,8 +88,8 @@ export declare abstract class Param<T extends string | number | boolean | string
|
|
|
88
88
|
toSpec(): ParamSpec<T>;
|
|
89
89
|
}
|
|
90
90
|
export declare class SecretParam {
|
|
91
|
-
name: string;
|
|
92
91
|
static type: ParamValueType;
|
|
92
|
+
name: string;
|
|
93
93
|
constructor(name: string);
|
|
94
94
|
value(): string;
|
|
95
95
|
toSpec(): ParamSpec<string>;
|
package/lib/v2/params/types.js
CHANGED
|
@@ -42,7 +42,7 @@ class Expression {
|
|
|
42
42
|
}
|
|
43
43
|
exports.Expression = Expression;
|
|
44
44
|
function quoteIfString(literal) {
|
|
45
|
-
//TODO(vsfan@): CEL's string escape semantics are slightly different than Javascript's, what do we do here?
|
|
45
|
+
// TODO(vsfan@): CEL's string escape semantics are slightly different than Javascript's, what do we do here?
|
|
46
46
|
return typeof literal === 'string' ? `"${literal}"` : literal;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -29,7 +29,7 @@ export interface AlertEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
|
29
29
|
data: FirebaseAlertData<T>;
|
|
30
30
|
}
|
|
31
31
|
/** 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' | string;
|
|
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;
|
|
33
33
|
/**
|
|
34
34
|
* Configuration for Firebase Alert functions.
|
|
35
35
|
*/
|
|
@@ -21,14 +21,14 @@
|
|
|
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.getOptsAndAlertTypeAndApp = exports.getEndpointAnnotation = exports.onAlertPublished = exports.eventType = void 0;
|
|
24
|
+
exports.convertAlertAndApp = exports.getOptsAndAlertTypeAndApp = exports.getEndpointAnnotation = exports.onAlertPublished = exports.eventType = void 0;
|
|
25
25
|
const options = require("../../options");
|
|
26
26
|
/** @internal */
|
|
27
27
|
exports.eventType = 'google.firebase.firebasealerts.alerts.v1.published';
|
|
28
28
|
function onAlertPublished(alertTypeOrOpts, handler) {
|
|
29
29
|
const [opts, alertType, appId] = getOptsAndAlertTypeAndApp(alertTypeOrOpts);
|
|
30
30
|
const func = (raw) => {
|
|
31
|
-
return handler(raw);
|
|
31
|
+
return handler(convertAlertAndApp(raw));
|
|
32
32
|
};
|
|
33
33
|
func.run = handler;
|
|
34
34
|
func.__endpoint = getEndpointAnnotation(opts, alertType, appId);
|
|
@@ -86,3 +86,18 @@ function getOptsAndAlertTypeAndApp(alertTypeOrOpts) {
|
|
|
86
86
|
return [opts, alertType, appId];
|
|
87
87
|
}
|
|
88
88
|
exports.getOptsAndAlertTypeAndApp = getOptsAndAlertTypeAndApp;
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to covert alert type & app id in the CloudEvent to camel case.
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
function convertAlertAndApp(raw) {
|
|
94
|
+
const event = { ...raw };
|
|
95
|
+
if ('alerttype' in event) {
|
|
96
|
+
event.alertType = event.alerttype;
|
|
97
|
+
}
|
|
98
|
+
if ('appid' in event) {
|
|
99
|
+
event.appId = event.appid;
|
|
100
|
+
}
|
|
101
|
+
return event;
|
|
102
|
+
}
|
|
103
|
+
exports.convertAlertAndApp = convertAlertAndApp;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { CloudEvent, CloudFunction } from '../../core';
|
|
6
6
|
import * as options from '../../options';
|
|
7
|
-
import { FirebaseAlertData } from './alerts';
|
|
8
7
|
import { Expression } from '../../params';
|
|
8
|
+
import { FirebaseAlertData } from './alerts';
|
|
9
9
|
/**
|
|
10
10
|
* The internal payload object for adding a new tester device to app distribution.
|
|
11
11
|
* Payload is wrapped inside a `FirebaseAlertData` object.
|
|
@@ -40,7 +40,7 @@ function onNewTesterIosDevicePublished(appIdOrOptsOrHandler, handler) {
|
|
|
40
40
|
}
|
|
41
41
|
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
42
42
|
const func = (raw) => {
|
|
43
|
-
return handler(raw);
|
|
43
|
+
return handler((0, alerts_1.convertAlertAndApp)(raw));
|
|
44
44
|
};
|
|
45
45
|
func.run = handler;
|
|
46
46
|
func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, exports.newTesterIosDeviceAlert, appId);
|
|
@@ -60,7 +60,7 @@ function onInAppFeedbackPublished(appIdOrOptsOrHandler, handler) {
|
|
|
60
60
|
}
|
|
61
61
|
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
62
62
|
const func = (raw) => {
|
|
63
|
-
return handler(raw);
|
|
63
|
+
return handler((0, alerts_1.convertAlertAndApp)(raw));
|
|
64
64
|
};
|
|
65
65
|
func.run = handler;
|
|
66
66
|
func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, exports.inAppFeedbackAlert, appId);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Cloud functions to handle billing events from Firebase Alerts.
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
|
-
import { FirebaseAlertData } from '.';
|
|
6
5
|
import { CloudEvent, CloudFunction } from '../../core';
|
|
7
6
|
import * as options from '../../options';
|
|
7
|
+
import { FirebaseAlertData } from './alerts';
|
|
8
8
|
/**
|
|
9
9
|
* The internal payload object for billing plan updates.
|
|
10
10
|
* Payload is wrapped inside a `FirebaseAlertData` object.
|
|
@@ -22,11 +22,7 @@
|
|
|
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
|
-
|
|
26
|
-
* Cloud functions to handle billing events from Firebase Alerts.
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
*/
|
|
29
|
-
const _1 = require(".");
|
|
25
|
+
const alerts_1 = require("./alerts");
|
|
30
26
|
/** @internal */
|
|
31
27
|
exports.planUpdateAlert = 'billing.planUpdate';
|
|
32
28
|
/** @internal */
|
|
@@ -58,10 +54,10 @@ function onOperation(alertType, optsOrHandler, handler) {
|
|
|
58
54
|
optsOrHandler = {};
|
|
59
55
|
}
|
|
60
56
|
const func = (raw) => {
|
|
61
|
-
return handler(raw);
|
|
57
|
+
return handler((0, alerts_1.convertAlertAndApp)(raw));
|
|
62
58
|
};
|
|
63
59
|
func.run = handler;
|
|
64
|
-
func.__endpoint = (0,
|
|
60
|
+
func.__endpoint = (0, alerts_1.getEndpointAnnotation)(optsOrHandler, alertType);
|
|
65
61
|
return func;
|
|
66
62
|
}
|
|
67
63
|
exports.onOperation = onOperation;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Cloud functions to handle Crashlytics events from Firebase Alerts.
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
|
-
import { FirebaseAlertData } from '.';
|
|
6
5
|
import { CloudEvent, CloudFunction } from '../../core';
|
|
7
6
|
import * as options from '../../options';
|
|
8
7
|
import { Expression } from '../../params';
|
|
8
|
+
import { FirebaseAlertData } from './alerts';
|
|
9
9
|
/** Generic Crashlytics issue interface */
|
|
10
10
|
export interface Issue {
|
|
11
11
|
/** The ID of the Crashlytics issue */
|
|
@@ -22,11 +22,7 @@
|
|
|
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
|
-
|
|
26
|
-
* Cloud functions to handle Crashlytics events from Firebase Alerts.
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
*/
|
|
29
|
-
const _1 = require(".");
|
|
25
|
+
const alerts_1 = require("./alerts");
|
|
30
26
|
/** @internal */
|
|
31
27
|
exports.newFatalIssueAlert = 'crashlytics.newFatalIssue';
|
|
32
28
|
/** @internal */
|
|
@@ -107,10 +103,10 @@ function onOperation(alertType, appIdOrOptsOrHandler, handler) {
|
|
|
107
103
|
}
|
|
108
104
|
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
109
105
|
const func = (raw) => {
|
|
110
|
-
return handler(raw);
|
|
106
|
+
return handler((0, alerts_1.convertAlertAndApp)(raw));
|
|
111
107
|
};
|
|
112
108
|
func.run = handler;
|
|
113
|
-
func.__endpoint = (0,
|
|
109
|
+
func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, alertType, appId);
|
|
114
110
|
return func;
|
|
115
111
|
}
|
|
116
112
|
exports.onOperation = onOperation;
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
import * as appDistribution from './appDistribution';
|
|
8
8
|
import * as billing from './billing';
|
|
9
9
|
import * as crashlytics from './crashlytics';
|
|
10
|
-
|
|
10
|
+
import * as performance from './performance';
|
|
11
|
+
export { appDistribution, billing, crashlytics, performance };
|
|
11
12
|
export * from './alerts';
|
|
@@ -35,7 +35,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
35
35
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.crashlytics = exports.billing = exports.appDistribution = void 0;
|
|
38
|
+
exports.performance = exports.crashlytics = exports.billing = exports.appDistribution = void 0;
|
|
39
39
|
/**
|
|
40
40
|
* Cloud functions to handle events from Firebase Alerts.
|
|
41
41
|
* Subpackages give stronger typing to specific services which
|
|
@@ -48,4 +48,6 @@ const billing = require("./billing");
|
|
|
48
48
|
exports.billing = billing;
|
|
49
49
|
const crashlytics = require("./crashlytics");
|
|
50
50
|
exports.crashlytics = crashlytics;
|
|
51
|
+
const performance = require("./performance");
|
|
52
|
+
exports.performance = performance;
|
|
51
53
|
__exportStar(require("./alerts"), exports);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud functions to handle Firebase Performance Monitoring events from Firebase Alerts.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import { CloudEvent, CloudFunction } from '../../core';
|
|
6
|
+
import { EventHandlerOptions } from '../../options';
|
|
7
|
+
import { FirebaseAlertData } from './alerts';
|
|
8
|
+
/**
|
|
9
|
+
* The internal payload object for a performance threshold alert.
|
|
10
|
+
* Payload is wrapped inside a {@link FirebaseAlertData} object.
|
|
11
|
+
*/
|
|
12
|
+
export interface ThresholdAlertPayload {
|
|
13
|
+
eventName: string;
|
|
14
|
+
eventType: string;
|
|
15
|
+
metricType: string;
|
|
16
|
+
numSamples: number;
|
|
17
|
+
thresholdValue: number;
|
|
18
|
+
thresholdUnit: string;
|
|
19
|
+
conditionPercentile?: number;
|
|
20
|
+
appVersion?: string;
|
|
21
|
+
violationValue: number;
|
|
22
|
+
violationUnit: string;
|
|
23
|
+
investigateUri: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A custom CloudEvent for Firebase Alerts (with custom extension attributes).
|
|
27
|
+
* @typeParam T - the data type for performance alerts that is wrapped in a `FirebaseAlertData` object.
|
|
28
|
+
*/
|
|
29
|
+
export interface PerformanceEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
30
|
+
/** The type of the alerts that got triggered. */
|
|
31
|
+
alertType: string;
|
|
32
|
+
/** The Firebase App ID that’s associated with the alert. */
|
|
33
|
+
appId: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for app distribution functions.
|
|
37
|
+
*/
|
|
38
|
+
export interface PerformanceOptions extends EventHandlerOptions {
|
|
39
|
+
appId?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Declares a function that can handle receiving performance threshold alerts.
|
|
43
|
+
* @param handler - Event handler which is run every time a threshold alert is received.
|
|
44
|
+
* @returns A function that you can export and deploy.
|
|
45
|
+
*/
|
|
46
|
+
export declare function onThresholdAlertPublished(handler: (event: PerformanceEvent<ThresholdAlertPayload>) => any | Promise<any>): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>;
|
|
47
|
+
/**
|
|
48
|
+
* Declares a function that can handle receiving performance threshold alerts.
|
|
49
|
+
* @param appId - A specific application the handler will trigger on.
|
|
50
|
+
* @param handler - Event handler which is run every time a threshold alert is received.
|
|
51
|
+
* @returns A function that you can export and deploy.
|
|
52
|
+
*/
|
|
53
|
+
export declare function onThresholdAlertPublished(appId: string, handler: (event: PerformanceEvent<ThresholdAlertPayload>) => any | Promise<any>): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>;
|
|
54
|
+
/**
|
|
55
|
+
* Declares a function that can handle receiving performance threshold alerts.
|
|
56
|
+
* @param opts - Options that can be set on the function.
|
|
57
|
+
* @param handler - Event handler which is run every time a threshold alert is received.
|
|
58
|
+
* @returns A function that you can export and deploy.
|
|
59
|
+
*/
|
|
60
|
+
export declare function onThresholdAlertPublished(opts: PerformanceOptions, handler: (event: PerformanceEvent<ThresholdAlertPayload>) => any | Promise<any>): CloudFunction<PerformanceEvent<ThresholdAlertPayload>>;
|
|
@@ -0,0 +1,81 @@
|
|
|
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.
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.convertPayload = exports.getOptsAndApp = exports.onThresholdAlertPublished = exports.thresholdAlert = void 0;
|
|
25
|
+
const alerts_1 = require("./alerts");
|
|
26
|
+
/** @internal */
|
|
27
|
+
exports.thresholdAlert = 'performance.threshold';
|
|
28
|
+
/**
|
|
29
|
+
* Declares a function that can handle receiving performance threshold alerts.
|
|
30
|
+
* @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
|
|
31
|
+
* @param handler - Event handler which is run every time a threshold alert is received.
|
|
32
|
+
* @returns A function that you can export and deploy.
|
|
33
|
+
*/
|
|
34
|
+
function onThresholdAlertPublished(appIdOrOptsOrHandler, handler) {
|
|
35
|
+
if (typeof appIdOrOptsOrHandler === 'function') {
|
|
36
|
+
handler = appIdOrOptsOrHandler;
|
|
37
|
+
appIdOrOptsOrHandler = {};
|
|
38
|
+
}
|
|
39
|
+
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
40
|
+
const func = (raw) => {
|
|
41
|
+
const event = (0, alerts_1.convertAlertAndApp)(raw);
|
|
42
|
+
const convertedPayload = convertPayload(event.data.payload);
|
|
43
|
+
event.data.payload = convertedPayload;
|
|
44
|
+
return handler(event);
|
|
45
|
+
};
|
|
46
|
+
func.run = handler;
|
|
47
|
+
func.__endpoint = (0, alerts_1.getEndpointAnnotation)(opts, exports.thresholdAlert, appId);
|
|
48
|
+
return func;
|
|
49
|
+
}
|
|
50
|
+
exports.onThresholdAlertPublished = onThresholdAlertPublished;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to parse the function opts and appId.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
function getOptsAndApp(appIdOrOpts) {
|
|
56
|
+
if (typeof appIdOrOpts === 'string') {
|
|
57
|
+
return [{}, appIdOrOpts];
|
|
58
|
+
}
|
|
59
|
+
const opts = { ...appIdOrOpts };
|
|
60
|
+
const appId = appIdOrOpts.appId;
|
|
61
|
+
delete opts.appId;
|
|
62
|
+
return [opts, appId];
|
|
63
|
+
}
|
|
64
|
+
exports.getOptsAndApp = getOptsAndApp;
|
|
65
|
+
/**
|
|
66
|
+
* Helper function to convert the raw payload of a {@link PerformanceEvent} to a {@link ThresholdAlertPayload}
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
function convertPayload(raw) {
|
|
70
|
+
const payload = { ...raw };
|
|
71
|
+
if (typeof payload.conditionPercentile !== 'undefined' &&
|
|
72
|
+
payload.conditionPercentile === 0) {
|
|
73
|
+
delete payload.conditionPercentile;
|
|
74
|
+
}
|
|
75
|
+
if (typeof payload.appVersion !== 'undefined' &&
|
|
76
|
+
payload.appVersion.length === 0) {
|
|
77
|
+
delete payload.appVersion;
|
|
78
|
+
}
|
|
79
|
+
return payload;
|
|
80
|
+
}
|
|
81
|
+
exports.convertPayload = convertPayload;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthData, RateLimits, Request, RetryConfig } from '../../common/providers/tasks';
|
|
2
2
|
import * as options from '../options';
|
|
3
|
-
import { HttpsFunction } from './https';
|
|
4
3
|
import { Expression } from '../params';
|
|
4
|
+
import { HttpsFunction } from './https';
|
|
5
5
|
export { AuthData, Request };
|
|
6
6
|
export interface TaskQueueOptions extends options.EventHandlerOptions {
|
|
7
7
|
/** How a task should be retried in the event of a non-2xx return. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-functions",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"description": "Firebase SDK for Cloud Functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"firebase",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"./v2/alerts/appDistribution": "./lib/v2/providers/alerts/appDistribution.js",
|
|
65
65
|
"./v2/alerts/billing": "./lib/v2/providers/alerts/billing.js",
|
|
66
66
|
"./v2/alerts/crashlytics": "./lib/v2/providers/alerts/crashlytics.js",
|
|
67
|
+
"./v2/alerts/performance": "./lib/v2/providers/alerts/performance.js",
|
|
67
68
|
"./v2/eventarc": "./lib/v2/providers/eventarc.js",
|
|
68
69
|
"./v2/identity": "./lib/v2/providers/identity.js",
|
|
69
70
|
"./v2/database": "./lib/v2/providers/database.js",
|
|
@@ -125,6 +126,9 @@
|
|
|
125
126
|
"v2/alerts/crashlytics": [
|
|
126
127
|
"lib/v2/providers/alerts/crashlytics"
|
|
127
128
|
],
|
|
129
|
+
"v2/alerts/performance": [
|
|
130
|
+
"lib/v2/providers/alerts/performance"
|
|
131
|
+
],
|
|
128
132
|
"v2/base": [
|
|
129
133
|
"lib/v2/base"
|
|
130
134
|
],
|