firebase-functions 3.21.0 → 3.22.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/bin/firebase-functions.js +21 -0
- package/lib/cloud-functions.d.ts +54 -88
- package/lib/cloud-functions.js +2 -59
- package/lib/common/change.d.ts +46 -0
- package/lib/common/change.js +82 -0
- package/lib/common/encoding.js +21 -1
- package/lib/common/providers/database.d.ts +145 -0
- package/lib/common/providers/database.js +271 -0
- package/lib/common/providers/https.d.ts +37 -17
- package/lib/common/providers/https.js +3 -0
- package/lib/common/providers/identity.d.ts +5 -1
- package/lib/common/providers/identity.js +12 -4
- package/lib/common/providers/tasks.d.ts +9 -0
- package/lib/common/providers/tasks.js +13 -12
- package/lib/function-builder.d.ts +3 -3
- package/lib/function-builder.js +2 -2
- package/lib/logger/common.js +21 -0
- package/lib/logger/compat.js +21 -0
- package/lib/logger/index.d.ts +14 -6
- package/lib/logger/index.js +33 -6
- package/lib/providers/auth.d.ts +26 -5
- package/lib/providers/auth.js +18 -4
- package/lib/providers/database.d.ts +4 -146
- package/lib/providers/database.js +7 -251
- package/lib/providers/firestore.d.ts +2 -1
- package/lib/providers/firestore.js +2 -1
- package/lib/providers/pubsub.d.ts +6 -6
- package/lib/providers/pubsub.js +6 -6
- package/lib/providers/tasks.d.ts +29 -14
- package/lib/providers/tasks.js +10 -3
- package/lib/utilities/path-pattern.d.ts +1 -0
- package/lib/utilities/path-pattern.js +142 -0
- package/lib/v2/core.d.ts +25 -1
- package/lib/v2/core.js +7 -0
- package/lib/v2/index.d.ts +11 -3
- package/lib/v2/index.js +12 -3
- package/lib/v2/options.d.ts +13 -34
- package/lib/v2/options.js +6 -58
- package/lib/v2/params/index.d.ts +4 -1
- package/lib/v2/params/index.js +25 -1
- package/lib/v2/params/types.js +21 -0
- package/lib/v2/providers/alerts/alerts.d.ts +94 -3
- package/lib/v2/providers/alerts/alerts.js +23 -7
- package/lib/v2/providers/alerts/appDistribution.d.ts +101 -1
- package/lib/v2/providers/alerts/appDistribution.js +28 -1
- package/lib/v2/providers/alerts/billing.d.ts +23 -2
- package/lib/v2/providers/alerts/billing.js +37 -0
- package/lib/v2/providers/alerts/crashlytics.d.ts +193 -18
- package/lib/v2/providers/alerts/crashlytics.js +62 -1
- package/lib/v2/providers/alerts/index.d.ts +6 -0
- package/lib/v2/providers/alerts/index.js +27 -0
- package/lib/v2/providers/database.d.ts +182 -0
- package/lib/v2/providers/database.js +204 -0
- package/lib/v2/providers/eventarc.d.ts +89 -5
- package/lib/v2/providers/eventarc.js +4 -0
- package/lib/v2/providers/https.d.ts +123 -2
- package/lib/v2/providers/https.js +13 -3
- package/lib/v2/providers/identity.d.ts +108 -4
- package/lib/v2/providers/identity.js +33 -2
- package/lib/v2/providers/pubsub.d.ts +122 -5
- package/lib/v2/providers/pubsub.js +58 -2
- package/lib/v2/providers/storage.d.ts +192 -4
- package/lib/v2/providers/storage.js +52 -9
- package/lib/v2/providers/tasks.d.ts +106 -6
- package/lib/v2/providers/tasks.js +4 -0
- package/package.json +12 -6
package/lib/v2/params/index.js
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// The MIT License (MIT)
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021 Firebase
|
|
5
|
+
//
|
|
6
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
// in the Software without restriction, including without limitation the rights
|
|
9
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
// furnished to do so, subject to the following conditions:
|
|
12
|
+
//
|
|
13
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
// copies or substantial portions of the Software.
|
|
15
|
+
//
|
|
16
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
// SOFTWARE.
|
|
2
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
24
|
exports.defineJSON = exports.defineList = exports.defineFloat = exports.defineInt = exports.defineBoolean = exports.defineString = exports.declaredParams = void 0;
|
|
4
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
5
29
|
const types_1 = require("./types");
|
|
6
30
|
exports.declaredParams = [];
|
|
7
31
|
/**
|
package/lib/v2/params/types.js
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// The MIT License (MIT)
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021 Firebase
|
|
5
|
+
//
|
|
6
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
// in the Software without restriction, including without limitation the rights
|
|
9
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
// furnished to do so, subject to the following conditions:
|
|
12
|
+
//
|
|
13
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
// copies or substantial portions of the Software.
|
|
15
|
+
//
|
|
16
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
// SOFTWARE.
|
|
2
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
24
|
exports.JSONParam = exports.ListParam = exports.BooleanParam = exports.FloatParam = exports.IntParam = exports.StringParam = exports.Param = void 0;
|
|
4
25
|
class Param {
|
|
@@ -2,6 +2,7 @@ import { CloudEvent, CloudFunction } from '../../core';
|
|
|
2
2
|
import * as options from '../../options';
|
|
3
3
|
/**
|
|
4
4
|
* The CloudEvent data emitted by Firebase Alerts.
|
|
5
|
+
* @typeParam T - the payload type that is expected for this alert.
|
|
5
6
|
*/
|
|
6
7
|
export interface FirebaseAlertData<T = any> {
|
|
7
8
|
/** Time that the event has created. */
|
|
@@ -13,6 +14,7 @@ export interface FirebaseAlertData<T = any> {
|
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* A custom CloudEvent for Firebase Alerts (with custom extension attributes).
|
|
17
|
+
* @typeParam T - the data type for this alert that is wrapped in a `FirebaseAlertData` object.
|
|
16
18
|
*/
|
|
17
19
|
export interface AlertEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
18
20
|
/** The type of the alerts that got triggered. */
|
|
@@ -22,7 +24,7 @@ export interface AlertEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
|
22
24
|
* and only present when the alert is targeting at a specific Firebase App.
|
|
23
25
|
*/
|
|
24
26
|
appId?: string;
|
|
25
|
-
/** Data for an AlertEvent is a FirebaseAlertData with a given payload. */
|
|
27
|
+
/** Data for an `AlertEvent` is a `FirebaseAlertData` object with a given payload. */
|
|
26
28
|
data: FirebaseAlertData<T>;
|
|
27
29
|
}
|
|
28
30
|
/** The underlying alert type of the Firebase Alerts provider. */
|
|
@@ -31,14 +33,103 @@ export declare type AlertType = 'crashlytics.newFatalIssue' | 'crashlytics.newNo
|
|
|
31
33
|
* Configuration for Firebase Alert functions.
|
|
32
34
|
*/
|
|
33
35
|
export interface FirebaseAlertOptions extends options.EventHandlerOptions {
|
|
36
|
+
/** Scope the handler to trigger on an alert type. */
|
|
34
37
|
alertType: AlertType;
|
|
38
|
+
/** Scope the function to trigger on a specific application. */
|
|
35
39
|
appId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Region where functions should be deployed.
|
|
42
|
+
*/
|
|
43
|
+
region?: options.SupportedRegion | string;
|
|
44
|
+
/**
|
|
45
|
+
* Amount of memory to allocate to a function.
|
|
46
|
+
* A value of null restores the defaults of 256MB.
|
|
47
|
+
*/
|
|
48
|
+
memory?: options.MemoryOption | null;
|
|
49
|
+
/**
|
|
50
|
+
* Timeout for the function in sections, possible values are 0 to 540.
|
|
51
|
+
* HTTPS functions can specify a higher timeout.
|
|
52
|
+
* A value of null restores the default of 60s
|
|
53
|
+
* The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
|
|
54
|
+
* function depends on the type of function: Event handling functions have a
|
|
55
|
+
* maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
|
|
56
|
+
* maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
|
|
57
|
+
* timeout of 1,800s (30 minutes)
|
|
58
|
+
*/
|
|
59
|
+
timeoutSeconds?: number | null;
|
|
60
|
+
/**
|
|
61
|
+
* Min number of actual instances to be running at a given time.
|
|
62
|
+
* Instances will be billed for memory allocation and 10% of CPU allocation
|
|
63
|
+
* while idle.
|
|
64
|
+
* A value of null restores the default min instances.
|
|
65
|
+
*/
|
|
66
|
+
minInstances?: number | null;
|
|
67
|
+
/**
|
|
68
|
+
* Max number of instances to be running in parallel.
|
|
69
|
+
* A value of null restores the default max instances.
|
|
70
|
+
*/
|
|
71
|
+
maxInstances?: number | null;
|
|
72
|
+
/**
|
|
73
|
+
* Number of requests a function can serve at once.
|
|
74
|
+
* Can only be applied to functions running on Cloud Functions v2.
|
|
75
|
+
* A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
|
|
76
|
+
* Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
|
|
77
|
+
* The maximum value for concurrency is 1,000.
|
|
78
|
+
*/
|
|
79
|
+
concurrency?: number | null;
|
|
80
|
+
/**
|
|
81
|
+
* Fractional number of CPUs to allocate to a function.
|
|
82
|
+
* Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
|
|
83
|
+
* This is different from the defaults when using the gcloud utility and is different from
|
|
84
|
+
* the fixed amount assigned in Google Cloud Functions generation 1.
|
|
85
|
+
* To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
|
|
86
|
+
* to the value "gcf_gen1"
|
|
87
|
+
*/
|
|
88
|
+
cpu?: number | 'gcf_gen1';
|
|
89
|
+
/**
|
|
90
|
+
* Connect cloud function to specified VPC connector.
|
|
91
|
+
* A value of null removes the VPC connector
|
|
92
|
+
*/
|
|
93
|
+
vpcConnector?: string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Egress settings for VPC connector.
|
|
96
|
+
* A value of null turns off VPC connector egress settings
|
|
97
|
+
*/
|
|
98
|
+
vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
|
|
99
|
+
/**
|
|
100
|
+
* Specific service account for the function to run as.
|
|
101
|
+
* A value of null restores the default service account.
|
|
102
|
+
*/
|
|
103
|
+
serviceAccount?: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Ingress settings which control where this function can be called from.
|
|
106
|
+
* A value of null turns off ingress settings.
|
|
107
|
+
*/
|
|
108
|
+
ingressSettings?: options.IngressSetting | null;
|
|
109
|
+
/**
|
|
110
|
+
* User labels to set on the function.
|
|
111
|
+
*/
|
|
112
|
+
labels?: Record<string, string>;
|
|
113
|
+
secrets?: string[];
|
|
114
|
+
/** Whether failed executions should be delivered again. */
|
|
115
|
+
retry?: boolean;
|
|
36
116
|
}
|
|
37
117
|
/**
|
|
38
118
|
* Declares a function that can handle Firebase Alerts from CloudEvents.
|
|
39
|
-
* @
|
|
119
|
+
* @typeParam T - the type of event.data.payload.
|
|
120
|
+
* @param alertType - the alert type or Firebase Alert function configuration.
|
|
121
|
+
* @param handler a function that can handle the Firebase Alert inside a CloudEvent.
|
|
122
|
+
* @returns A function that you can export and deploy.
|
|
123
|
+
*/
|
|
124
|
+
export declare function onAlertPublished<T extends {
|
|
125
|
+
['@type']: string;
|
|
126
|
+
} = any>(alertType: AlertType, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
|
|
127
|
+
/**
|
|
128
|
+
* Declares a function that can handle Firebase Alerts from CloudEvents.
|
|
129
|
+
* @typeParam T - the type of event.data.payload.
|
|
130
|
+
* @param options - the alert type and other options for this cloud function.
|
|
40
131
|
* @param handler a function that can handle the Firebase Alert inside a CloudEvent.
|
|
41
132
|
*/
|
|
42
133
|
export declare function onAlertPublished<T extends {
|
|
43
134
|
['@type']: string;
|
|
44
|
-
} = any>(
|
|
135
|
+
} = any>(options: FirebaseAlertOptions, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
|
|
@@ -1,14 +1,30 @@
|
|
|
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.getOptsAndAlertTypeAndApp = exports.getEndpointAnnotation = exports.onAlertPublished = exports.eventType = void 0;
|
|
4
25
|
const options = require("../../options");
|
|
5
26
|
/** @internal */
|
|
6
27
|
exports.eventType = 'google.firebase.firebasealerts.alerts.v1.published';
|
|
7
|
-
/**
|
|
8
|
-
* Declares a function that can handle Firebase Alerts from CloudEvents.
|
|
9
|
-
* @param alertTypeOrOpts the alert type or Firebase Alert function configuration.
|
|
10
|
-
* @param handler a function that can handle the Firebase Alert inside a CloudEvent.
|
|
11
|
-
*/
|
|
12
28
|
function onAlertPublished(alertTypeOrOpts, handler) {
|
|
13
29
|
const [opts, alertType, appId] = getOptsAndAlertTypeAndApp(alertTypeOrOpts);
|
|
14
30
|
const func = (raw) => {
|
|
@@ -20,8 +36,8 @@ function onAlertPublished(alertTypeOrOpts, handler) {
|
|
|
20
36
|
}
|
|
21
37
|
exports.onAlertPublished = onAlertPublished;
|
|
22
38
|
/**
|
|
23
|
-
* @internal
|
|
24
39
|
* Helper function for getting the endpoint annotation used in alert handling functions.
|
|
40
|
+
* @internal
|
|
25
41
|
*/
|
|
26
42
|
function getEndpointAnnotation(opts, alertType, appId) {
|
|
27
43
|
const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
|
|
@@ -49,8 +65,8 @@ function getEndpointAnnotation(opts, alertType, appId) {
|
|
|
49
65
|
}
|
|
50
66
|
exports.getEndpointAnnotation = getEndpointAnnotation;
|
|
51
67
|
/**
|
|
52
|
-
* @internal
|
|
53
68
|
* Helper function to parse the function opts, alert type, and appId.
|
|
69
|
+
* @internal
|
|
54
70
|
*/
|
|
55
71
|
function getOptsAndAlertTypeAndApp(alertTypeOrOpts) {
|
|
56
72
|
let opts;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud functions to handle Firebase App Distribution events from Firebase Alerts.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import { CloudEvent, CloudFunction } from '../../core';
|
|
2
6
|
import * as options from '../../options';
|
|
3
7
|
import { FirebaseAlertData } from './alerts';
|
|
4
8
|
/**
|
|
5
9
|
* The internal payload object for adding a new tester device to app distribution.
|
|
6
|
-
* Payload is wrapped inside a FirebaseAlertData object.
|
|
10
|
+
* Payload is wrapped inside a `FirebaseAlertData` object.
|
|
7
11
|
*/
|
|
8
12
|
export interface NewTesterDevicePayload {
|
|
9
13
|
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.AppDistroNewTesterIosDevicePayload';
|
|
14
|
+
/** Name of the tester */
|
|
10
15
|
testerName: string;
|
|
16
|
+
/** Email of the tester */
|
|
11
17
|
testerEmail: string;
|
|
18
|
+
/** The device model name */
|
|
12
19
|
testerDeviceModelName: string;
|
|
20
|
+
/** The device ID */
|
|
13
21
|
testerDeviceIdentifier: string;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* A custom CloudEvent for Firebase Alerts (with custom extension attributes).
|
|
25
|
+
* @typeParam T - the data type for app distribution alerts that is wrapped in a `FirebaseAlertData` object.
|
|
17
26
|
*/
|
|
18
27
|
export interface AppDistributionEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
19
28
|
/** The type of the alerts that got triggered. */
|
|
@@ -25,11 +34,102 @@ export interface AppDistributionEvent<T> extends CloudEvent<FirebaseAlertData<T>
|
|
|
25
34
|
* Configuration for app distribution functions.
|
|
26
35
|
*/
|
|
27
36
|
export interface AppDistributionOptions extends options.EventHandlerOptions {
|
|
37
|
+
/** Scope the function to trigger on a specific application. */
|
|
28
38
|
appId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Region where functions should be deployed.
|
|
41
|
+
*/
|
|
42
|
+
region?: options.SupportedRegion | string;
|
|
43
|
+
/**
|
|
44
|
+
* Amount of memory to allocate to a function.
|
|
45
|
+
* A value of null restores the defaults of 256MB.
|
|
46
|
+
*/
|
|
47
|
+
memory?: options.MemoryOption | null;
|
|
48
|
+
/**
|
|
49
|
+
* Timeout for the function in sections, possible values are 0 to 540.
|
|
50
|
+
* HTTPS functions can specify a higher timeout.
|
|
51
|
+
* A value of null restores the default of 60s
|
|
52
|
+
* The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
|
|
53
|
+
* function depends on the type of function: Event handling functions have a
|
|
54
|
+
* maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
|
|
55
|
+
* maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
|
|
56
|
+
* timeout of 1,800s (30 minutes)
|
|
57
|
+
*/
|
|
58
|
+
timeoutSeconds?: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* Min number of actual instances to be running at a given time.
|
|
61
|
+
* Instances will be billed for memory allocation and 10% of CPU allocation
|
|
62
|
+
* while idle.
|
|
63
|
+
* A value of null restores the default min instances.
|
|
64
|
+
*/
|
|
65
|
+
minInstances?: number | null;
|
|
66
|
+
/**
|
|
67
|
+
* Max number of instances to be running in parallel.
|
|
68
|
+
* A value of null restores the default max instances.
|
|
69
|
+
*/
|
|
70
|
+
maxInstances?: number | null;
|
|
71
|
+
/**
|
|
72
|
+
* Number of requests a function can serve at once.
|
|
73
|
+
* Can only be applied to functions running on Cloud Functions v2.
|
|
74
|
+
* A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
|
|
75
|
+
* Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
|
|
76
|
+
* The maximum value for concurrency is 1,000.
|
|
77
|
+
*/
|
|
78
|
+
concurrency?: number | null;
|
|
79
|
+
/**
|
|
80
|
+
* Fractional number of CPUs to allocate to a function.
|
|
81
|
+
* Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
|
|
82
|
+
* This is different from the defaults when using the gcloud utility and is different from
|
|
83
|
+
* the fixed amount assigned in Google Cloud Functions generation 1.
|
|
84
|
+
* To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
|
|
85
|
+
* to the value "gcf_gen1"
|
|
86
|
+
*/
|
|
87
|
+
cpu?: number | 'gcf_gen1';
|
|
88
|
+
/**
|
|
89
|
+
* Connect cloud function to specified VPC connector.
|
|
90
|
+
* A value of null removes the VPC connector
|
|
91
|
+
*/
|
|
92
|
+
vpcConnector?: string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Egress settings for VPC connector.
|
|
95
|
+
* A value of null turns off VPC connector egress settings
|
|
96
|
+
*/
|
|
97
|
+
vpcConnectorEgressSettings?: options.VpcEgressSetting | null;
|
|
98
|
+
/**
|
|
99
|
+
* Specific service account for the function to run as.
|
|
100
|
+
* A value of null restores the default service account.
|
|
101
|
+
*/
|
|
102
|
+
serviceAccount?: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* Ingress settings which control where this function can be called from.
|
|
105
|
+
* A value of null turns off ingress settings.
|
|
106
|
+
*/
|
|
107
|
+
ingressSettings?: options.IngressSetting | null;
|
|
108
|
+
/**
|
|
109
|
+
* User labels to set on the function.
|
|
110
|
+
*/
|
|
111
|
+
labels?: Record<string, string>;
|
|
112
|
+
secrets?: string[];
|
|
113
|
+
/** Whether failed executions should be delivered again. */
|
|
114
|
+
retry?: boolean;
|
|
29
115
|
}
|
|
30
116
|
/**
|
|
31
117
|
* Declares a function that can handle adding a new tester iOS device.
|
|
118
|
+
* @param handler - Event handler which is run every time a new tester iOS device is added.
|
|
119
|
+
* @returns A function that you can export and deploy.
|
|
32
120
|
*/
|
|
33
121
|
export declare function onNewTesterIosDevicePublished(handler: (event: AppDistributionEvent<NewTesterDevicePayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>;
|
|
122
|
+
/**
|
|
123
|
+
* Declares a function that can handle adding a new tester iOS device.
|
|
124
|
+
* @param appId - A specific application the handler will trigger on.
|
|
125
|
+
* @param handler - Event handler which is run every time a new tester iOS device is added.
|
|
126
|
+
* @returns A function that you can export and deploy.
|
|
127
|
+
*/
|
|
34
128
|
export declare function onNewTesterIosDevicePublished(appId: string, handler: (event: AppDistributionEvent<NewTesterDevicePayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>;
|
|
129
|
+
/**
|
|
130
|
+
* Declares a function that can handle adding a new tester iOS device.
|
|
131
|
+
* @param opts - Options that can be set on the function.
|
|
132
|
+
* @param handler - Event handler which is run every time a new tester iOS device is added.
|
|
133
|
+
* @returns A function that you can export and deploy.
|
|
134
|
+
*/
|
|
35
135
|
export declare function onNewTesterIosDevicePublished(opts: AppDistributionOptions, handler: (event: AppDistributionEvent<NewTesterDevicePayload>) => any | Promise<any>): CloudFunction<AppDistributionEvent<NewTesterDevicePayload>>;
|
|
@@ -1,9 +1,36 @@
|
|
|
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.onNewTesterIosDevicePublished = exports.newTesterIosDeviceAlert = void 0;
|
|
4
25
|
const alerts_1 = require("./alerts");
|
|
5
26
|
/** @internal */
|
|
6
27
|
exports.newTesterIosDeviceAlert = 'appDistribution.newTesterIosDevice';
|
|
28
|
+
/**
|
|
29
|
+
* Declares a function that can handle adding a new tester iOS device.
|
|
30
|
+
* @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
|
|
31
|
+
* @param handler - Event handler which is run every time a new tester iOS device is added.
|
|
32
|
+
* @returns A function that you can export and deploy.
|
|
33
|
+
*/
|
|
7
34
|
function onNewTesterIosDevicePublished(appIdOrOptsOrHandler, handler) {
|
|
8
35
|
if (typeof appIdOrOptsOrHandler === 'function') {
|
|
9
36
|
handler = appIdOrOptsOrHandler;
|
|
@@ -19,8 +46,8 @@ function onNewTesterIosDevicePublished(appIdOrOptsOrHandler, handler) {
|
|
|
19
46
|
}
|
|
20
47
|
exports.onNewTesterIosDevicePublished = onNewTesterIosDevicePublished;
|
|
21
48
|
/**
|
|
22
|
-
* @internal
|
|
23
49
|
* Helper function to parse the function opts and appId.
|
|
50
|
+
* @internal
|
|
24
51
|
*/
|
|
25
52
|
function getOptsAndApp(appIdOrOpts) {
|
|
26
53
|
let opts;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud functions to handle billing 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
8
|
/**
|
|
5
9
|
* The internal payload object for billing plan updates.
|
|
6
|
-
* Payload is wrapped inside a FirebaseAlertData object.
|
|
10
|
+
* Payload is wrapped inside a `FirebaseAlertData` object.
|
|
7
11
|
*/
|
|
8
12
|
export interface PlanUpdatePayload {
|
|
9
13
|
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanUpdatePayload';
|
|
@@ -16,7 +20,7 @@ export interface PlanUpdatePayload {
|
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* The internal payload object for billing plan automated updates.
|
|
19
|
-
* Payload is wrapped inside a FirebaseAlertData object.
|
|
23
|
+
* Payload is wrapped inside a `FirebaseAlertData` object.
|
|
20
24
|
*/
|
|
21
25
|
export interface PlanAutomatedUpdatePayload {
|
|
22
26
|
['@type']: 'type.googleapis.com/google.events.firebase.firebasealerts.v1.BillingPlanAutomatedUpdatePayload';
|
|
@@ -27,6 +31,7 @@ export interface PlanAutomatedUpdatePayload {
|
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* A custom CloudEvent for billing Firebase Alerts (with custom extension attributes).
|
|
34
|
+
* @typeParam T - the data type for billing alerts that is wrapped in a `FirebaseAlertData` object.
|
|
30
35
|
*/
|
|
31
36
|
export interface BillingEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
32
37
|
/** The type of the alerts that got triggered. */
|
|
@@ -34,11 +39,27 @@ export interface BillingEvent<T> extends CloudEvent<FirebaseAlertData<T>> {
|
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* Declares a function that can handle a billing plan update event.
|
|
42
|
+
* @param handler - Event handler which is run every time a billing plan is updated.
|
|
43
|
+
* @returns A function that you can export and deploy.
|
|
37
44
|
*/
|
|
38
45
|
export declare function onPlanUpdatePublished(handler: (event: BillingEvent<PlanUpdatePayload>) => any | Promise<any>): CloudFunction<BillingEvent<PlanUpdatePayload>>;
|
|
46
|
+
/**
|
|
47
|
+
* Declares a function that can handle a billing plan update event.
|
|
48
|
+
* @param opts - Options that can be set on the function.
|
|
49
|
+
* @param handler - Event handler which is run every time a billing plan is updated.
|
|
50
|
+
* @returns A function that you can export and deploy.
|
|
51
|
+
*/
|
|
39
52
|
export declare function onPlanUpdatePublished(opts: options.EventHandlerOptions, handler: (event: BillingEvent<PlanUpdatePayload>) => any | Promise<any>): CloudFunction<BillingEvent<PlanUpdatePayload>>;
|
|
40
53
|
/**
|
|
41
54
|
* Declares a function that can handle an automated billing plan update event.
|
|
55
|
+
* @param handler - Event handler which is run every time an automated billing plan update occurs.
|
|
56
|
+
* @returns A function that you can export and deploy.
|
|
42
57
|
*/
|
|
43
58
|
export declare function onPlanAutomatedUpdatePublished(handler: (event: BillingEvent<PlanAutomatedUpdatePayload>) => any | Promise<any>): CloudFunction<BillingEvent<PlanAutomatedUpdatePayload>>;
|
|
59
|
+
/**
|
|
60
|
+
* Declares a function that can handle an automated billing plan update event.
|
|
61
|
+
* @param opts - Options that can be set on the function.
|
|
62
|
+
* @param handler - Event handler which is run every time an automated billing plan update occurs.
|
|
63
|
+
* @returns A function that you can export and deploy.
|
|
64
|
+
*/
|
|
44
65
|
export declare function onPlanAutomatedUpdatePublished(opts: options.EventHandlerOptions, handler: (event: BillingEvent<PlanAutomatedUpdatePayload>) => any | Promise<any>): CloudFunction<BillingEvent<PlanAutomatedUpdatePayload>>;
|
|
@@ -1,15 +1,52 @@
|
|
|
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.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
|
+
*/
|
|
4
29
|
const _1 = require(".");
|
|
5
30
|
/** @internal */
|
|
6
31
|
exports.planUpdateAlert = 'billing.planUpdate';
|
|
7
32
|
/** @internal */
|
|
8
33
|
exports.planAutomatedUpdateAlert = 'billing.planAutomatedUpdate';
|
|
34
|
+
/**
|
|
35
|
+
* Declares a function that can handle a billing plan update event.
|
|
36
|
+
* @param optsOrHandler - Options or an event-handling function.
|
|
37
|
+
* @param handler - Event handler which is run every time a billing plan is updated.
|
|
38
|
+
* @returns A function that you can export and deploy.
|
|
39
|
+
*/
|
|
9
40
|
function onPlanUpdatePublished(optsOrHandler, handler) {
|
|
10
41
|
return onOperation(exports.planUpdateAlert, optsOrHandler, handler);
|
|
11
42
|
}
|
|
12
43
|
exports.onPlanUpdatePublished = onPlanUpdatePublished;
|
|
44
|
+
/**
|
|
45
|
+
* Declares a function that can handle an automated billing plan update event.
|
|
46
|
+
* @param optsOrHandler - Options or an event-handling function.
|
|
47
|
+
* @param handler - Event handler which is run every time an automated billing plan update occurs.
|
|
48
|
+
* @returns A function that you can export and deploy.
|
|
49
|
+
*/
|
|
13
50
|
function onPlanAutomatedUpdatePublished(optsOrHandler, handler) {
|
|
14
51
|
return onOperation(exports.planAutomatedUpdateAlert, optsOrHandler, handler);
|
|
15
52
|
}
|