firebase-functions 3.18.1 → 3.19.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/cloud-functions.js +6 -3
- package/lib/index.js +5 -1
- package/lib/providers/database.js +1 -1
- package/lib/runtime/manifest.d.ts +13 -4
- package/lib/v2/options.d.ts +2 -2
- package/lib/v2/options.js +12 -3
- package/lib/v2/providers/alerts/alerts.js +10 -4
- package/lib/v2/providers/alerts/billing.d.ts +2 -2
- package/lib/v2/providers/alerts/billing.js +5 -5
- package/lib/v2/providers/alerts/index.js +5 -1
- package/lib/v2/providers/pubsub.js +1 -1
- package/lib/v2/providers/storage.js +1 -3
- package/package.json +2 -2
package/lib/cloud-functions.js
CHANGED
|
@@ -180,9 +180,12 @@ function makeCloudFunction({ after = () => { }, before = () => { }, contextOnlyH
|
|
|
180
180
|
else {
|
|
181
181
|
endpoint.eventTrigger = {
|
|
182
182
|
eventType: legacyEventType || provider + '.' + eventType,
|
|
183
|
-
eventFilters:
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
eventFilters: [
|
|
184
|
+
{
|
|
185
|
+
attribute: 'resource',
|
|
186
|
+
value: triggerResource(),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
186
189
|
retry: !!options.failurePolicy,
|
|
187
190
|
};
|
|
188
191
|
}
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
// SOFTWARE.
|
|
23
23
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
24
|
if (k2 === undefined) k2 = k;
|
|
25
|
-
Object.
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
26
30
|
}) : (function(o, m, k, k2) {
|
|
27
31
|
if (k2 === undefined) k2 = k;
|
|
28
32
|
o[k2] = m[k];
|
|
@@ -229,6 +229,7 @@ class RefBuilder {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
exports.RefBuilder = RefBuilder;
|
|
232
|
+
const resourceRegex = /^projects\/([^/]+)\/instances\/([a-zA-Z0-9-]+)\/refs(\/.+)?/;
|
|
232
233
|
/**
|
|
233
234
|
* Utility function to extract database reference from resource string
|
|
234
235
|
*
|
|
@@ -239,7 +240,6 @@ exports.RefBuilder = RefBuilder;
|
|
|
239
240
|
*/
|
|
240
241
|
/** @hidden */
|
|
241
242
|
function extractInstanceAndPath(resource, domain = 'firebaseio.com') {
|
|
242
|
-
const resourceRegex = `projects/([^/]+)/instances/([a-zA-Z0-9\-^/]+)/refs(/.+)?`;
|
|
243
243
|
const match = resource.match(new RegExp(resourceRegex));
|
|
244
244
|
if (!match) {
|
|
245
245
|
throw new Error(`Unexpected resource string for Firebase Realtime Database event: ${resource}. ` +
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One or more event filters restrict the set of events delivered to an EventTrigger.
|
|
3
|
+
*/
|
|
4
|
+
interface EventFilter {
|
|
5
|
+
attribute: string;
|
|
6
|
+
value: string;
|
|
7
|
+
operator?: string;
|
|
8
|
+
}
|
|
1
9
|
/**
|
|
2
10
|
* An definition of a function as appears in the Manifest.
|
|
3
11
|
*/
|
|
@@ -18,16 +26,16 @@ export interface ManifestEndpoint {
|
|
|
18
26
|
labels?: Record<string, string>;
|
|
19
27
|
ingressSettings?: string;
|
|
20
28
|
environmentVariables?: Record<string, string>;
|
|
21
|
-
secretEnvironmentVariables?: {
|
|
29
|
+
secretEnvironmentVariables?: Array<{
|
|
22
30
|
key: string;
|
|
23
31
|
secret?: string;
|
|
24
|
-
}
|
|
32
|
+
}>;
|
|
25
33
|
httpsTrigger?: {
|
|
26
34
|
invoker?: string[];
|
|
27
35
|
};
|
|
28
36
|
callableTrigger?: {};
|
|
29
37
|
eventTrigger?: {
|
|
30
|
-
eventFilters:
|
|
38
|
+
eventFilters: EventFilter[];
|
|
31
39
|
eventType: string;
|
|
32
40
|
retry: boolean;
|
|
33
41
|
region?: string;
|
|
@@ -51,9 +59,10 @@ export interface ManifestRequiredAPI {
|
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
53
61
|
* An definition of a function deployment as appears in the Manifest.
|
|
54
|
-
|
|
62
|
+
*/
|
|
55
63
|
export interface ManifestStack {
|
|
56
64
|
specVersion: 'v1alpha1';
|
|
57
65
|
requiredAPIs: ManifestRequiredAPI[];
|
|
58
66
|
endpoints: Record<string, ManifestEndpoint>;
|
|
59
67
|
}
|
|
68
|
+
export {};
|
package/lib/v2/options.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ParamSpec } from './params/types';
|
|
|
2
2
|
/**
|
|
3
3
|
* List of all regions supported by Cloud Functions v2
|
|
4
4
|
*/
|
|
5
|
-
export declare const SUPPORTED_REGIONS: readonly ["
|
|
5
|
+
export declare const SUPPORTED_REGIONS: readonly ["asia-northeast1", "europe-north1", "europe-west1", "europe-west4", "us-central1", "us-east1", "us-west1"];
|
|
6
6
|
/**
|
|
7
7
|
* A region known to be supported by CloudFunctions v2
|
|
8
8
|
*/
|
|
@@ -26,7 +26,7 @@ export declare const MAX_CONCURRENCY = 1000;
|
|
|
26
26
|
/**
|
|
27
27
|
* List of available memory options supported by Cloud Functions.
|
|
28
28
|
*/
|
|
29
|
-
export declare const SUPPORTED_MEMORY_OPTIONS: readonly ["256MB", "512MB", "1GB", "2GB", "4GB", "8GB"];
|
|
29
|
+
export declare const SUPPORTED_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB", "4GB", "8GB", "16GB", "32GB"];
|
|
30
30
|
/**
|
|
31
31
|
* A supported memory option.
|
|
32
32
|
*/
|
package/lib/v2/options.js
CHANGED
|
@@ -29,10 +29,13 @@ const params_1 = require("./params");
|
|
|
29
29
|
* List of all regions supported by Cloud Functions v2
|
|
30
30
|
*/
|
|
31
31
|
exports.SUPPORTED_REGIONS = [
|
|
32
|
-
'us-west1',
|
|
33
|
-
'us-central1',
|
|
34
|
-
'europe-west4',
|
|
35
32
|
'asia-northeast1',
|
|
33
|
+
'europe-north1',
|
|
34
|
+
'europe-west1',
|
|
35
|
+
'europe-west4',
|
|
36
|
+
'us-central1',
|
|
37
|
+
'us-east1',
|
|
38
|
+
'us-west1',
|
|
36
39
|
];
|
|
37
40
|
/**
|
|
38
41
|
* Cloud Functions v2 min timeout value.
|
|
@@ -54,20 +57,26 @@ exports.MAX_CONCURRENCY = 1000;
|
|
|
54
57
|
* List of available memory options supported by Cloud Functions.
|
|
55
58
|
*/
|
|
56
59
|
exports.SUPPORTED_MEMORY_OPTIONS = [
|
|
60
|
+
'128MB',
|
|
57
61
|
'256MB',
|
|
58
62
|
'512MB',
|
|
59
63
|
'1GB',
|
|
60
64
|
'2GB',
|
|
61
65
|
'4GB',
|
|
62
66
|
'8GB',
|
|
67
|
+
'16GB',
|
|
68
|
+
'32GB',
|
|
63
69
|
];
|
|
64
70
|
const MemoryOptionToMB = {
|
|
71
|
+
'128MB': 128,
|
|
65
72
|
'256MB': 256,
|
|
66
73
|
'512MB': 512,
|
|
67
74
|
'1GB': 1024,
|
|
68
75
|
'2GB': 2048,
|
|
69
76
|
'4GB': 4096,
|
|
70
77
|
'8GB': 8192,
|
|
78
|
+
'16GB': 16384,
|
|
79
|
+
'32GB': 32768,
|
|
71
80
|
};
|
|
72
81
|
/**
|
|
73
82
|
* List of available options for VpcConnectorEgressSettings.
|
|
@@ -36,14 +36,20 @@ function getEndpointAnnotation(opts, alertType, appId) {
|
|
|
36
36
|
},
|
|
37
37
|
eventTrigger: {
|
|
38
38
|
eventType: exports.eventType,
|
|
39
|
-
eventFilters:
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
eventFilters: [
|
|
40
|
+
{
|
|
41
|
+
attribute: 'alerttype',
|
|
42
|
+
value: alertType,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
42
45
|
retry: !!opts.retry,
|
|
43
46
|
},
|
|
44
47
|
};
|
|
45
48
|
if (appId) {
|
|
46
|
-
endpoint.eventTrigger.eventFilters.
|
|
49
|
+
endpoint.eventTrigger.eventFilters.push({
|
|
50
|
+
attribute: 'appid',
|
|
51
|
+
value: appId,
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
return endpoint;
|
|
49
55
|
}
|
|
@@ -33,6 +33,6 @@ export declare function onPlanUpdatePublished(opts: options.EventHandlerOptions,
|
|
|
33
33
|
/**
|
|
34
34
|
* Declares a function that can handle an automated billing plan update event.
|
|
35
35
|
*/
|
|
36
|
-
export declare function
|
|
37
|
-
export declare function
|
|
36
|
+
export declare function onPlanAutomatedUpdatePublished(handler: (event: BillingEvent<PlanAutomatedUpdatePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<PlanAutomatedUpdatePayload>>;
|
|
37
|
+
export declare function onPlanAutomatedUpdatePublished(opts: options.EventHandlerOptions, handler: (event: BillingEvent<PlanAutomatedUpdatePayload>) => any | Promise<any>): CloudFunction<FirebaseAlertData<PlanAutomatedUpdatePayload>>;
|
|
38
38
|
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.onOperation = exports.
|
|
3
|
+
exports.onOperation = exports.onPlanAutomatedUpdatePublished = exports.onPlanUpdatePublished = exports.planAutomatedUpdateAlert = exports.planUpdateAlert = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
/** @internal */
|
|
6
6
|
exports.planUpdateAlert = 'billing.planUpdate';
|
|
7
7
|
/** @internal */
|
|
8
|
-
exports.
|
|
8
|
+
exports.planAutomatedUpdateAlert = 'billing.planAutomatedUpdate';
|
|
9
9
|
function onPlanUpdatePublished(optsOrHandler, handler) {
|
|
10
10
|
return onOperation(exports.planUpdateAlert, optsOrHandler, handler);
|
|
11
11
|
}
|
|
12
12
|
exports.onPlanUpdatePublished = onPlanUpdatePublished;
|
|
13
|
-
function
|
|
14
|
-
return onOperation(exports.
|
|
13
|
+
function onPlanAutomatedUpdatePublished(optsOrHandler, handler) {
|
|
14
|
+
return onOperation(exports.planAutomatedUpdateAlert, optsOrHandler, handler);
|
|
15
15
|
}
|
|
16
|
-
exports.
|
|
16
|
+
exports.onPlanAutomatedUpdatePublished = onPlanAutomatedUpdatePublished;
|
|
17
17
|
/** @internal */
|
|
18
18
|
function onOperation(alertType, optsOrHandler, handler) {
|
|
19
19
|
if (typeof optsOrHandler === 'function') {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -104,7 +104,7 @@ function onMessagePublished(topicOrOptions, handler) {
|
|
|
104
104
|
},
|
|
105
105
|
eventTrigger: {
|
|
106
106
|
eventType: 'google.cloud.pubsub.topic.v1.messagePublished',
|
|
107
|
-
eventFilters: { topic },
|
|
107
|
+
eventFilters: [{ attribute: 'topic', value: topic }],
|
|
108
108
|
retry: false,
|
|
109
109
|
},
|
|
110
110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-functions",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "Firebase SDK for Cloud Functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"firebase",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"format:fix": "prettier --write '**/*.{json,md,ts,yml,yaml}'",
|
|
150
150
|
"lint": "tslint --config tslint.json --project tsconfig.json ",
|
|
151
151
|
"lint:fix": "tslint --config tslint.json --fix --project tsconfig.json",
|
|
152
|
-
"test": "mocha --file ./mocha/setup.ts spec/**/*.spec.ts
|
|
152
|
+
"test": "mocha --file ./mocha/setup.ts \"spec/**/*.spec.ts\"",
|
|
153
153
|
"test:bin": "./scripts/bin-test/run.sh"
|
|
154
154
|
},
|
|
155
155
|
"dependencies": {
|