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.
- package/README.md +7 -9
- package/lib/bin/firebase-functions.js +13 -15
- package/lib/common/app.d.ts +14 -0
- package/lib/common/app.js +62 -0
- package/lib/common/change.d.ts +0 -5
- package/lib/common/change.js +5 -7
- package/lib/common/config.d.ts +6 -0
- package/lib/common/config.js +49 -0
- package/lib/common/debug.js +2 -2
- package/lib/common/encoding.d.ts +0 -8
- package/lib/common/encoding.js +6 -29
- package/lib/common/options.d.ts +14 -0
- package/lib/common/options.js +44 -0
- package/lib/common/params.d.ts +32 -0
- package/lib/common/params.js +23 -0
- package/lib/common/providers/database.d.ts +17 -19
- package/lib/common/providers/database.js +68 -39
- package/lib/common/providers/https.d.ts +11 -52
- package/lib/common/providers/https.js +115 -110
- package/lib/common/providers/identity.d.ts +8 -8
- package/lib/common/providers/identity.js +71 -79
- package/lib/common/providers/tasks.d.ts +11 -10
- package/lib/common/providers/tasks.js +10 -9
- package/lib/common/timezone.js +538 -538
- package/lib/common/trace.d.ts +14 -0
- package/lib/common/trace.js +69 -0
- package/lib/{encoder.d.ts → common/utilities/encoder.d.ts} +0 -0
- package/lib/{encoder.js → common/utilities/encoder.js} +1 -1
- package/lib/{utilities → common/utilities}/path-pattern.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path-pattern.js +17 -16
- package/lib/{utilities → common/utilities}/path.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path.js +5 -7
- package/lib/{utils.d.ts → common/utilities/utils.d.ts} +1 -1
- package/lib/{utils.js → common/utilities/utils.js} +18 -12
- package/lib/logger/common.d.ts +1 -3
- package/lib/logger/common.js +9 -14
- package/lib/logger/compat.js +9 -9
- package/lib/logger/index.d.ts +1 -1
- package/lib/logger/index.js +24 -30
- package/lib/{v2/params → params}/index.d.ts +22 -9
- package/lib/{v2/params → params}/index.js +22 -14
- package/lib/params/types.d.ts +180 -0
- package/lib/params/types.js +289 -0
- package/lib/runtime/loader.js +12 -14
- package/lib/runtime/manifest.d.ts +56 -24
- package/lib/runtime/manifest.js +114 -4
- package/lib/v1/cloud-functions.d.ts +232 -0
- package/lib/v1/cloud-functions.js +205 -0
- package/lib/v1/config.d.ts +8 -0
- package/lib/v1/config.js +75 -0
- package/lib/{function-builder.d.ts → v1/function-builder.d.ts} +16 -16
- package/lib/{function-builder.js → v1/function-builder.js} +56 -46
- package/lib/v1/function-configuration.d.ts +197 -0
- package/lib/v1/function-configuration.js +70 -0
- package/lib/v1/index.d.ts +20 -0
- package/lib/{index.js → v1/index.js} +5 -10
- package/lib/{providers → v1/providers}/analytics.d.ts +5 -11
- package/lib/{providers → v1/providers}/analytics.js +49 -43
- package/lib/{providers → v1/providers}/auth.d.ts +28 -18
- package/lib/{providers → v1/providers}/auth.js +45 -34
- package/lib/{providers → v1/providers}/database.d.ts +25 -42
- package/lib/{providers → v1/providers}/database.js +46 -46
- package/lib/{providers → v1/providers}/firestore.d.ts +15 -33
- package/lib/{providers → v1/providers}/firestore.js +40 -44
- package/lib/{providers → v1/providers}/https.d.ts +3 -8
- package/lib/{providers → v1/providers}/https.js +14 -22
- package/lib/{providers → v1/providers}/pubsub.d.ts +8 -16
- package/lib/{providers → v1/providers}/pubsub.js +22 -26
- package/lib/{providers → v1/providers}/remoteConfig.d.ts +2 -11
- package/lib/{providers → v1/providers}/remoteConfig.js +9 -9
- package/lib/{providers → v1/providers}/storage.d.ts +11 -26
- package/lib/{providers → v1/providers}/storage.js +24 -29
- package/lib/{providers → v1/providers}/tasks.d.ts +6 -8
- package/lib/{providers → v1/providers}/tasks.js +12 -17
- package/lib/{providers → v1/providers}/testLab.d.ts +86 -46
- package/lib/{providers → v1/providers}/testLab.js +14 -14
- package/lib/v2/core.d.ts +4 -5
- package/lib/v2/index.d.ts +16 -14
- package/lib/v2/index.js +5 -1
- package/lib/v2/options.d.ts +52 -32
- package/lib/v2/options.js +32 -47
- package/lib/v2/providers/alerts/alerts.d.ts +20 -18
- package/lib/v2/providers/alerts/alerts.js +9 -6
- package/lib/v2/providers/alerts/appDistribution.d.ts +28 -26
- package/lib/v2/providers/alerts/appDistribution.js +8 -7
- package/lib/v2/providers/alerts/billing.d.ts +5 -5
- package/lib/v2/providers/alerts/billing.js +5 -4
- package/lib/v2/providers/alerts/crashlytics.d.ts +32 -30
- package/lib/v2/providers/alerts/crashlytics.js +10 -9
- package/lib/v2/providers/alerts/index.d.ts +5 -5
- package/lib/v2/providers/alerts/performance.d.ts +3 -3
- package/lib/v2/providers/alerts/performance.js +5 -7
- package/lib/v2/providers/database.d.ts +41 -38
- package/lib/v2/providers/database.js +22 -17
- package/lib/v2/providers/eventarc.d.ts +25 -23
- package/lib/v2/providers/eventarc.js +10 -7
- package/lib/v2/providers/https.d.ts +43 -33
- package/lib/v2/providers/https.js +18 -56
- package/lib/v2/providers/identity.d.ts +25 -23
- package/lib/v2/providers/identity.js +10 -7
- package/lib/v2/providers/pubsub.d.ts +25 -23
- package/lib/v2/providers/pubsub.js +11 -27
- package/lib/v2/providers/remoteConfig.d.ts +63 -0
- package/lib/v2/providers/remoteConfig.js +65 -0
- package/lib/v2/providers/scheduler.d.ts +14 -12
- package/lib/v2/providers/scheduler.js +16 -14
- package/lib/v2/providers/storage.d.ts +32 -30
- package/lib/v2/providers/storage.js +16 -32
- package/lib/v2/providers/tasks.d.ts +30 -26
- package/lib/v2/providers/tasks.js +14 -31
- package/lib/v2/providers/testLab.d.ts +110 -0
- package/lib/v2/providers/testLab.js +65 -0
- package/lib/v2/trace.d.ts +4 -0
- package/lib/v2/trace.js +21 -0
- package/package.json +61 -66
- package/lib/apps.d.ts +0 -35
- package/lib/apps.js +0 -112
- package/lib/cloud-functions.d.ts +0 -231
- package/lib/cloud-functions.js +0 -251
- package/lib/config.d.ts +0 -24
- package/lib/config.js +0 -117
- package/lib/function-configuration.d.ts +0 -108
- package/lib/function-configuration.js +0 -71
- package/lib/handler-builder.d.ts +0 -256
- package/lib/handler-builder.js +0 -349
- package/lib/index.d.ts +0 -19
- package/lib/setup.d.ts +0 -1
- package/lib/setup.js +0 -60
- package/lib/v2/params/types.d.ts +0 -118
- package/lib/v2/params/types.js +0 -196
|
@@ -29,9 +29,11 @@ exports.onTaskDispatched = void 0;
|
|
|
29
29
|
const encoding_1 = require("../../common/encoding");
|
|
30
30
|
const tasks_1 = require("../../common/providers/tasks");
|
|
31
31
|
const options = require("../options");
|
|
32
|
+
const trace_1 = require("../trace");
|
|
33
|
+
const manifest_1 = require("../../runtime/manifest");
|
|
32
34
|
function onTaskDispatched(optsOrHandler, handler) {
|
|
33
35
|
let opts;
|
|
34
|
-
if (arguments.length
|
|
36
|
+
if (arguments.length === 1) {
|
|
35
37
|
opts = {};
|
|
36
38
|
handler = optsOrHandler;
|
|
37
39
|
}
|
|
@@ -41,49 +43,30 @@ function onTaskDispatched(optsOrHandler, handler) {
|
|
|
41
43
|
// onDispatchHandler sniffs the function length to determine which API to present.
|
|
42
44
|
// fix the length to prevent api versions from being mismatched.
|
|
43
45
|
const fixedLen = (req) => handler(req);
|
|
44
|
-
const func = (0, tasks_1.onDispatchHandler)(fixedLen);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());
|
|
48
|
-
// global options calls region a scalar and https allows it to be an array,
|
|
49
|
-
// but optionsToTriggerAnnotations handles both cases.
|
|
50
|
-
const specificOpts = options.optionsToTriggerAnnotations(opts);
|
|
51
|
-
const taskQueueTrigger = {};
|
|
52
|
-
(0, encoding_1.copyIfPresent)(taskQueueTrigger, opts, 'retryConfig', 'rateLimits');
|
|
53
|
-
(0, encoding_1.convertIfPresent)(taskQueueTrigger, opts, 'invoker', 'invoker', encoding_1.convertInvoker);
|
|
54
|
-
return {
|
|
55
|
-
platform: 'gcfv2',
|
|
56
|
-
...baseOpts,
|
|
57
|
-
...specificOpts,
|
|
58
|
-
labels: {
|
|
59
|
-
...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
|
|
60
|
-
...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
|
|
61
|
-
},
|
|
62
|
-
taskQueueTrigger,
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
const baseOpts = options.optionsToEndpoint(options.getGlobalOptions());
|
|
46
|
+
const func = (0, trace_1.wrapTraceContext)((0, tasks_1.onDispatchHandler)(fixedLen));
|
|
47
|
+
const globalOpts = options.getGlobalOptions();
|
|
48
|
+
const baseOpts = options.optionsToEndpoint(globalOpts);
|
|
67
49
|
// global options calls region a scalar and https allows it to be an array,
|
|
68
50
|
// but optionsToManifestEndpoint handles both cases.
|
|
69
51
|
const specificOpts = options.optionsToEndpoint(opts);
|
|
70
52
|
func.__endpoint = {
|
|
71
|
-
platform:
|
|
53
|
+
platform: "gcfv2",
|
|
54
|
+
...(0, manifest_1.initV2Endpoint)(options.getGlobalOptions(), opts),
|
|
72
55
|
...baseOpts,
|
|
73
56
|
...specificOpts,
|
|
74
57
|
labels: {
|
|
75
58
|
...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
|
|
76
59
|
...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
|
|
77
60
|
},
|
|
78
|
-
taskQueueTrigger:
|
|
61
|
+
taskQueueTrigger: (0, manifest_1.initTaskQueueTrigger)(options.getGlobalOptions(), opts),
|
|
79
62
|
};
|
|
80
|
-
(0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts,
|
|
81
|
-
(0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts,
|
|
82
|
-
(0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, opts,
|
|
63
|
+
(0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts, "retryConfig");
|
|
64
|
+
(0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger, opts, "rateLimits");
|
|
65
|
+
(0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, opts, "invoker", "invoker", encoding_1.convertInvoker);
|
|
83
66
|
func.__requiredAPIs = [
|
|
84
67
|
{
|
|
85
|
-
api:
|
|
86
|
-
reason:
|
|
68
|
+
api: "cloudtasks.googleapis.com",
|
|
69
|
+
reason: "Needed for task queue functions",
|
|
87
70
|
},
|
|
88
71
|
];
|
|
89
72
|
func.run = handler;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { CloudEvent, CloudFunction } from "../core";
|
|
2
|
+
import { EventHandlerOptions } from "../options";
|
|
3
|
+
/** Possible test states for a test matrix. */
|
|
4
|
+
export declare type TestState =
|
|
5
|
+
/** The default value. This value is used if the state is omitted. */
|
|
6
|
+
"TEST_STATE_UNSPECIFIED"
|
|
7
|
+
/** The test matrix is being validated. */
|
|
8
|
+
| "VALIDATING"
|
|
9
|
+
/** The test matrix is waiting for resources to become available. */
|
|
10
|
+
| "PENDING"
|
|
11
|
+
/** The test matrix has completed normally. */
|
|
12
|
+
| "FINISHED"
|
|
13
|
+
/** The test matrix has completed because of an infrastructure failure. */
|
|
14
|
+
| "ERROR"
|
|
15
|
+
/** The test matrix was not run because the provided inputs are not valid. */
|
|
16
|
+
| "INVALID";
|
|
17
|
+
/** Outcome summary for a finished test matrix. */
|
|
18
|
+
export declare type OutcomeSummary =
|
|
19
|
+
/** The default value. This value is used if the state is omitted. */
|
|
20
|
+
"OUTCOME_SUMMARY_UNSPECIFIED"
|
|
21
|
+
/**
|
|
22
|
+
* The test matrix run was successful, for instance:
|
|
23
|
+
* - All test cases passed.
|
|
24
|
+
* - No crash of the application under test was detected.
|
|
25
|
+
*/
|
|
26
|
+
| "SUCCESS"
|
|
27
|
+
/**
|
|
28
|
+
* A run failed, for instance:
|
|
29
|
+
* - One or more test case failed.
|
|
30
|
+
* - A test timed out.
|
|
31
|
+
* - The application under test crashed.
|
|
32
|
+
*/
|
|
33
|
+
| "FAILURE"
|
|
34
|
+
/**
|
|
35
|
+
* Something unexpected happened. The test run should still be considered
|
|
36
|
+
* unsuccessful but this is likely a transient problem and re-running the
|
|
37
|
+
* test might be successful.
|
|
38
|
+
*/
|
|
39
|
+
| "INCONCLUSIVE"
|
|
40
|
+
/** All tests were skipped. */
|
|
41
|
+
| "SKIPPED";
|
|
42
|
+
/** Locations where test results are stored. */
|
|
43
|
+
export interface ResultStorage {
|
|
44
|
+
/**
|
|
45
|
+
* Tool Results history resource containing test results. Format is
|
|
46
|
+
* `projects/{project_id}/histories/{history_id}`.
|
|
47
|
+
* See https://firebase.google.com/docs/test-lab/reference/toolresults/rest
|
|
48
|
+
* for more information.
|
|
49
|
+
*/
|
|
50
|
+
toolResultsHistory: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tool Results execution resource containing test results. Format is
|
|
53
|
+
* `projects/{project_id}/histories/{history_id}/executions/{execution_id}`.
|
|
54
|
+
* Optional, can be omitted in erroneous test states.
|
|
55
|
+
* See https://firebase.google.com/docs/test-lab/reference/toolresults/rest
|
|
56
|
+
* for more information.
|
|
57
|
+
*/
|
|
58
|
+
toolResultsExecution: string;
|
|
59
|
+
/** URI to the test results in the Firebase Web Console. */
|
|
60
|
+
resultsUri: string;
|
|
61
|
+
/**
|
|
62
|
+
* Location in Google Cloud Storage where test results are written to.
|
|
63
|
+
* In the form "gs://bucket/path/to/somewhere".
|
|
64
|
+
*/
|
|
65
|
+
gcsPath: string;
|
|
66
|
+
}
|
|
67
|
+
/** Information about the client which invoked the test. */
|
|
68
|
+
export interface ClientInfo {
|
|
69
|
+
/** Client name, such as "gcloud". */
|
|
70
|
+
client: string;
|
|
71
|
+
/** Map of detailed information about the client. */
|
|
72
|
+
details: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
/** The data within all Firebase test matrix completed events. */
|
|
75
|
+
export interface TestMatrixCompletedData {
|
|
76
|
+
/** Time the test matrix was created. */
|
|
77
|
+
createTime: string;
|
|
78
|
+
/** State of the test matrix. */
|
|
79
|
+
state: TestState;
|
|
80
|
+
/**
|
|
81
|
+
* Code that describes why the test matrix is considered invalid. Only set for
|
|
82
|
+
* matrices in the INVALID state.
|
|
83
|
+
*/
|
|
84
|
+
invalidMatrixDetails: string;
|
|
85
|
+
/** Outcome summary of the test matrix. */
|
|
86
|
+
outcomeSummary: OutcomeSummary;
|
|
87
|
+
/** Locations where test results are stored. */
|
|
88
|
+
resultStorage: ResultStorage;
|
|
89
|
+
/** Information provided by the client that created the test matrix. */
|
|
90
|
+
clientInfo: ClientInfo;
|
|
91
|
+
/** ID of the test matrix this event belongs to. */
|
|
92
|
+
testMatrixId: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Event handler which triggers when a Firebase test matrix completes.
|
|
96
|
+
*
|
|
97
|
+
* @param handler - Event handler which is run every time a Firebase test matrix completes.
|
|
98
|
+
* @returns A Cloud Function that you can export and deploy.
|
|
99
|
+
* @alpha
|
|
100
|
+
*/
|
|
101
|
+
export declare function onTestMatrixCompleted(handler: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>): CloudFunction<CloudEvent<TestMatrixCompletedData>>;
|
|
102
|
+
/**
|
|
103
|
+
* Event handler which triggers when a Firebase test matrix completes.
|
|
104
|
+
*
|
|
105
|
+
* @param opts - Options that can be set on an individual event-handling function.
|
|
106
|
+
* @param handler - Event handler which is run every time a Firebase test matrix completes.
|
|
107
|
+
* @returns A Cloud Function that you can export and deploy.
|
|
108
|
+
* @alpha
|
|
109
|
+
*/
|
|
110
|
+
export declare function onTestMatrixCompleted(opts: EventHandlerOptions, handler: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>): CloudFunction<CloudEvent<TestMatrixCompletedData>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.onTestMatrixCompleted = exports.eventType = void 0;
|
|
25
|
+
const options_1 = require("../options");
|
|
26
|
+
const trace_1 = require("../trace");
|
|
27
|
+
/** @internal */
|
|
28
|
+
exports.eventType = "google.firebase.testlab.testMatrix.v1.completed";
|
|
29
|
+
/**
|
|
30
|
+
* Event handler which triggers when a Firebase test matrix completes.
|
|
31
|
+
*
|
|
32
|
+
* @param optsOrHandler - Options or an event handler.
|
|
33
|
+
* @param handler - Event handler which is run every time a Firebase test matrix completes.
|
|
34
|
+
* @returns A Cloud Function that you can export and deploy.
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
function onTestMatrixCompleted(optsOrHandler, handler) {
|
|
38
|
+
if (typeof optsOrHandler === "function") {
|
|
39
|
+
handler = optsOrHandler;
|
|
40
|
+
optsOrHandler = {};
|
|
41
|
+
}
|
|
42
|
+
const baseOpts = (0, options_1.optionsToEndpoint)((0, options_1.getGlobalOptions)());
|
|
43
|
+
const specificOpts = (0, options_1.optionsToEndpoint)(optsOrHandler);
|
|
44
|
+
const func = (raw) => {
|
|
45
|
+
return (0, trace_1.wrapTraceContext)(handler(raw));
|
|
46
|
+
};
|
|
47
|
+
func.run = handler;
|
|
48
|
+
const ep = {
|
|
49
|
+
platform: "gcfv2",
|
|
50
|
+
...baseOpts,
|
|
51
|
+
...specificOpts,
|
|
52
|
+
labels: {
|
|
53
|
+
...baseOpts === null || baseOpts === void 0 ? void 0 : baseOpts.labels,
|
|
54
|
+
...specificOpts === null || specificOpts === void 0 ? void 0 : specificOpts.labels,
|
|
55
|
+
},
|
|
56
|
+
eventTrigger: {
|
|
57
|
+
eventType: exports.eventType,
|
|
58
|
+
eventFilters: {},
|
|
59
|
+
retry: !!optsOrHandler.retry,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
func.__endpoint = ep;
|
|
63
|
+
return func;
|
|
64
|
+
}
|
|
65
|
+
exports.onTestMatrixCompleted = onTestMatrixCompleted;
|
package/lib/v2/trace.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapTraceContext = void 0;
|
|
4
|
+
const trace_1 = require("../common/trace");
|
|
5
|
+
function wrapTraceContext(handler) {
|
|
6
|
+
return (...args) => {
|
|
7
|
+
let traceParent;
|
|
8
|
+
if (args.length === 1) {
|
|
9
|
+
traceParent = (0, trace_1.extractTraceContext)(args[0]);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
traceParent = (0, trace_1.extractTraceContext)(args[0].headers);
|
|
13
|
+
}
|
|
14
|
+
if (!traceParent) {
|
|
15
|
+
// eslint-disable-next-line prefer-spread
|
|
16
|
+
return handler.apply(null, args);
|
|
17
|
+
}
|
|
18
|
+
trace_1.traceContext.run(traceParent, handler, ...args);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.wrapTraceContext = wrapTraceContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-functions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
4
4
|
"description": "Firebase SDK for Cloud Functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"firebase",
|
|
@@ -21,42 +21,30 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"lib"
|
|
23
23
|
],
|
|
24
|
-
"main": "lib/index.js",
|
|
24
|
+
"main": "lib/v1/index.js",
|
|
25
25
|
"bin": {
|
|
26
26
|
"firebase-functions": "./lib/bin/firebase-functions.js"
|
|
27
27
|
},
|
|
28
|
-
"types": "lib/index.d.ts",
|
|
28
|
+
"types": "lib/v1/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
|
-
".": "./lib/index.js",
|
|
30
|
+
".": "./lib/v1/index.js",
|
|
31
31
|
"./logger/compat": "./lib/logger/compat.js",
|
|
32
|
-
"./lib/logger/compat": "./lib/logger/compat.js",
|
|
33
32
|
"./logger": "./lib/logger/index.js",
|
|
34
|
-
"./
|
|
35
|
-
"./
|
|
36
|
-
"./
|
|
37
|
-
"./
|
|
38
|
-
"./
|
|
39
|
-
"./
|
|
40
|
-
"./
|
|
41
|
-
"./
|
|
42
|
-
"./
|
|
43
|
-
"./
|
|
44
|
-
"./
|
|
45
|
-
"./v1": "./lib/index.js",
|
|
46
|
-
"./v1/analytics": "./lib/providers/analytics.js",
|
|
47
|
-
"./v1/auth": "./lib/providers/auth.js",
|
|
48
|
-
"./v1/database": "./lib/providers/database.js",
|
|
49
|
-
"./v1/firestore": "./lib/providers/firestore.js",
|
|
50
|
-
"./v1/https": "./lib/providers/https.js",
|
|
51
|
-
"./v1/pubsub": "./lib/providers/pubsub.js",
|
|
52
|
-
"./v1/remoteConfig": "./lib/providers/remoteConfig.js",
|
|
53
|
-
"./v1/storage": "./lib/providers/storage.js",
|
|
54
|
-
"./v1/testLab": "./lib/providers/testLab.js",
|
|
33
|
+
"./params": "./lib/params/index.js",
|
|
34
|
+
"./v1": "./lib/v1/index.js",
|
|
35
|
+
"./v1/analytics": "./lib/v1/providers/analytics.js",
|
|
36
|
+
"./v1/auth": "./lib/v1/providers/auth.js",
|
|
37
|
+
"./v1/database": "./lib/v1/providers/database.js",
|
|
38
|
+
"./v1/firestore": "./lib/v1/providers/firestore.js",
|
|
39
|
+
"./v1/pubsub": "./lib/v1/providers/pubsub.js",
|
|
40
|
+
"./v1/remoteConfig": "./lib/v1/providers/remoteConfig.js",
|
|
41
|
+
"./v1/storage": "./lib/v1/providers/storage.js",
|
|
42
|
+
"./v1/tasks": "./lib/v1/providers/tasks.js",
|
|
43
|
+
"./v1/testLab": "./lib/v1/providers/testLab.js",
|
|
55
44
|
"./v2": "./lib/v2/index.js",
|
|
56
45
|
"./v2/core": "./lib/v2/core.js",
|
|
57
46
|
"./v2/options": "./lib/v2/options.js",
|
|
58
47
|
"./v2/https": "./lib/v2/providers/https.js",
|
|
59
|
-
"./v2/params": "./lib/v2/params/index.js",
|
|
60
48
|
"./v2/pubsub": "./lib/v2/providers/pubsub.js",
|
|
61
49
|
"./v2/storage": "./lib/v2/providers/storage.js",
|
|
62
50
|
"./v2/tasks": "./lib/v2/providers/tasks.js",
|
|
@@ -68,7 +56,9 @@
|
|
|
68
56
|
"./v2/eventarc": "./lib/v2/providers/eventarc.js",
|
|
69
57
|
"./v2/identity": "./lib/v2/providers/identity.js",
|
|
70
58
|
"./v2/database": "./lib/v2/providers/database.js",
|
|
71
|
-
"./v2/scheduler": "./lib/v2/providers/scheduler.js"
|
|
59
|
+
"./v2/scheduler": "./lib/v2/providers/scheduler.js",
|
|
60
|
+
"./v2/remoteConfig": "./lib/v2/providers/remoteConfig.js",
|
|
61
|
+
"./v2/testLab": "./lib/v2/providers/testLab.js"
|
|
72
62
|
},
|
|
73
63
|
"typesVersions": {
|
|
74
64
|
"*": {
|
|
@@ -78,38 +68,38 @@
|
|
|
78
68
|
"logger/compat": [
|
|
79
69
|
"lib/logger/compat"
|
|
80
70
|
],
|
|
71
|
+
"params": [
|
|
72
|
+
"lib/params"
|
|
73
|
+
],
|
|
81
74
|
"v1": [
|
|
82
|
-
"lib"
|
|
75
|
+
"lib/v1"
|
|
83
76
|
],
|
|
84
77
|
"v1/analytics": [
|
|
85
|
-
"lib/providers/analytics"
|
|
78
|
+
"./lib/v1/providers/analytics"
|
|
86
79
|
],
|
|
87
80
|
"v1/auth": [
|
|
88
|
-
"lib/providers/auth"
|
|
81
|
+
"./lib/v1/providers/auth"
|
|
89
82
|
],
|
|
90
83
|
"v1/database": [
|
|
91
|
-
"lib/
|
|
84
|
+
"./lib/v1/privders/database"
|
|
92
85
|
],
|
|
93
86
|
"v1/firestore": [
|
|
94
|
-
"lib/providers/firestore"
|
|
95
|
-
],
|
|
96
|
-
"v1/https": [
|
|
97
|
-
"lib/providers/https"
|
|
87
|
+
"./lib/v1/providers/firestore"
|
|
98
88
|
],
|
|
99
89
|
"v1/pubsub": [
|
|
100
|
-
"lib/providers/pubsub"
|
|
90
|
+
"./lib/v1/providers/pubsub"
|
|
101
91
|
],
|
|
102
|
-
"v1/remoteConfig": [
|
|
103
|
-
"lib/providers/remoteConfig"
|
|
92
|
+
"/v1/remoteConfig": [
|
|
93
|
+
"./lib/v1/providers/remoteConfig"
|
|
104
94
|
],
|
|
105
|
-
"v1/storage": [
|
|
106
|
-
"lib/providers/storage"
|
|
95
|
+
"/v1/storage": [
|
|
96
|
+
"./lib/v1/providers/storage"
|
|
107
97
|
],
|
|
108
|
-
"v1/tasks": [
|
|
109
|
-
"lib/providers/tasks"
|
|
98
|
+
"/v1/tasks": [
|
|
99
|
+
"./lib/v1/providers/tasks"
|
|
110
100
|
],
|
|
111
|
-
"v1/testLab": [
|
|
112
|
-
"lib/providers/testLab"
|
|
101
|
+
"/v1/testLab": [
|
|
102
|
+
"./lib/v1/providers/testLab"
|
|
113
103
|
],
|
|
114
104
|
"v2": [
|
|
115
105
|
"lib/v2"
|
|
@@ -147,9 +137,6 @@
|
|
|
147
137
|
"v2/https": [
|
|
148
138
|
"lib/v2/providers/https"
|
|
149
139
|
],
|
|
150
|
-
"v2/params": [
|
|
151
|
-
"lib/v2/params"
|
|
152
|
-
],
|
|
153
140
|
"v2/pubsub": [
|
|
154
141
|
"lib/v2/providers/pubsub"
|
|
155
142
|
],
|
|
@@ -161,6 +148,12 @@
|
|
|
161
148
|
],
|
|
162
149
|
"v2/scheduler": [
|
|
163
150
|
"lib/v2/providers/scheduler"
|
|
151
|
+
],
|
|
152
|
+
"v2/remoteConfig": [
|
|
153
|
+
"lib/v2/providers/remoteConfig"
|
|
154
|
+
],
|
|
155
|
+
"v2/testLab": [
|
|
156
|
+
"lib/v2/providers/testLab"
|
|
164
157
|
]
|
|
165
158
|
}
|
|
166
159
|
},
|
|
@@ -168,23 +161,25 @@
|
|
|
168
161
|
"registry": "https://wombat-dressing-room.appspot.com"
|
|
169
162
|
},
|
|
170
163
|
"scripts": {
|
|
171
|
-
"apidocs": "node docgen/generate-docs.js",
|
|
172
164
|
"docgen:v1:extract": "api-extractor run -c docgen/api-extractor.v1.json --local",
|
|
173
|
-
"docgen:v1:toc": "ts-node docgen/toc.ts --input docgen/v1
|
|
165
|
+
"docgen:v1:toc": "ts-node docgen/toc.ts --input docgen/v1 --output docgen/v1/markdown/toc --path /docs/reference/functions",
|
|
174
166
|
"docgen:v1:gen": "api-documenter-fire markdown -i docgen/v1 -o docgen/v1/markdown --project functions && npm run docgen:v1:toc",
|
|
175
167
|
"docgen:v1": "npm run build && npm run docgen:v1:extract && npm run docgen:v1:gen",
|
|
176
168
|
"docgen:v2:extract": "api-extractor run -c docgen/api-extractor.v2.json --local",
|
|
177
|
-
"docgen:v2:toc": "ts-node docgen/toc.ts --input docgen/v2
|
|
169
|
+
"docgen:v2:toc": "ts-node docgen/toc.ts --input docgen/v2 --output docgen/v2/markdown/toc --path /docs/functions/beta/reference",
|
|
178
170
|
"docgen:v2:gen": "api-documenter-fire markdown -i docgen/v2 -o docgen/v2/markdown --project functions && npm run docgen:v2:toc",
|
|
179
171
|
"docgen:v2": "npm run build && npm run docgen:v2:extract && npm run docgen:v2:gen",
|
|
180
172
|
"build:pack": "rm -rf lib && npm install && tsc -p tsconfig.release.json && npm pack",
|
|
181
173
|
"build:release": "npm ci --production && npm install --no-save typescript firebase-admin && tsc -p tsconfig.release.json",
|
|
182
174
|
"build": "tsc -p tsconfig.release.json",
|
|
183
175
|
"build:watch": "npm run build -- -w",
|
|
184
|
-
"format": "
|
|
185
|
-
"format:
|
|
186
|
-
"
|
|
187
|
-
"lint
|
|
176
|
+
"format": "npm run format:ts && npm run format:other",
|
|
177
|
+
"format:other": "npm run lint:other -- --write",
|
|
178
|
+
"format:ts": "npm run lint:ts -- --fix --quiet",
|
|
179
|
+
"lint": "npm run lint:ts && npm run lint:other",
|
|
180
|
+
"lint:other": "prettier --check '**/*.{md,yaml,yml}'",
|
|
181
|
+
"lint:quiet": "npm run lint:ts -- --quiet && npm run lint:other",
|
|
182
|
+
"lint:ts": "eslint --config .eslintrc.js --ext .ts,.js .",
|
|
188
183
|
"test": "mocha --file ./mocha/setup.ts \"spec/**/*.spec.ts\"",
|
|
189
184
|
"test:bin": "./scripts/bin-test/run.sh",
|
|
190
185
|
"test:postmerge": "./integration_test/run_tests.sh"
|
|
@@ -194,7 +189,6 @@
|
|
|
194
189
|
"@types/express": "4.17.3",
|
|
195
190
|
"cors": "^2.8.5",
|
|
196
191
|
"express": "^4.17.1",
|
|
197
|
-
"lodash": "^4.17.14",
|
|
198
192
|
"node-fetch": "^2.6.7"
|
|
199
193
|
},
|
|
200
194
|
"devDependencies": {
|
|
@@ -204,17 +198,23 @@
|
|
|
204
198
|
"@types/chai": "^4.1.7",
|
|
205
199
|
"@types/chai-as-promised": "^7.1.0",
|
|
206
200
|
"@types/jsonwebtoken": "^8.3.2",
|
|
207
|
-
"@types/lodash": "^4.14.135",
|
|
208
201
|
"@types/mocha": "^5.2.7",
|
|
209
202
|
"@types/mock-require": "^2.0.0",
|
|
210
203
|
"@types/nock": "^10.0.3",
|
|
211
|
-
"@types/node": "^
|
|
204
|
+
"@types/node": "^14.18.24",
|
|
212
205
|
"@types/node-fetch": "^3.0.3",
|
|
213
206
|
"@types/sinon": "^7.0.13",
|
|
207
|
+
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
|
208
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
214
209
|
"api-extractor-model-me": "^0.1.1",
|
|
215
210
|
"chai": "^4.2.0",
|
|
216
211
|
"chai-as-promised": "^7.1.1",
|
|
217
212
|
"child-process-promise": "^2.2.1",
|
|
213
|
+
"eslint": "^8.6.0",
|
|
214
|
+
"eslint-config-google": "^0.14.0",
|
|
215
|
+
"eslint-config-prettier": "^8.3.0",
|
|
216
|
+
"eslint-plugin-jsdoc": "^39.2.9",
|
|
217
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
218
218
|
"firebase-admin": "^10.3.0",
|
|
219
219
|
"js-yaml": "^3.13.1",
|
|
220
220
|
"jsdom": "^16.2.1",
|
|
@@ -226,22 +226,17 @@
|
|
|
226
226
|
"nock": "^10.0.6",
|
|
227
227
|
"node-fetch": "^2.6.7",
|
|
228
228
|
"portfinder": "^1.0.28",
|
|
229
|
-
"prettier": "^
|
|
229
|
+
"prettier": "^2.7.1",
|
|
230
230
|
"semver": "^7.3.5",
|
|
231
231
|
"sinon": "^7.3.2",
|
|
232
232
|
"ts-node": "^10.4.0",
|
|
233
|
-
"tslint": "^5.18.0",
|
|
234
|
-
"tslint-config-prettier": "^1.18.0",
|
|
235
|
-
"tslint-no-unused-expression-chai": "^0.1.4",
|
|
236
|
-
"tslint-plugin-prettier": "^2.0.1",
|
|
237
|
-
"typedoc": "0.23.7",
|
|
238
233
|
"typescript": "^4.3.5",
|
|
239
234
|
"yargs": "^15.3.1"
|
|
240
235
|
},
|
|
241
236
|
"peerDependencies": {
|
|
242
|
-
"firebase-admin": "^
|
|
237
|
+
"firebase-admin": "^10.0.0 || ^11.0.0"
|
|
243
238
|
},
|
|
244
239
|
"engines": {
|
|
245
|
-
"node": "
|
|
240
|
+
"node": ">=14.10.0"
|
|
246
241
|
}
|
|
247
242
|
}
|
package/lib/apps.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as firebase from 'firebase-admin';
|
|
2
|
-
export declare function apps(): apps.Apps;
|
|
3
|
-
export declare namespace apps {
|
|
4
|
-
/** @hidden */
|
|
5
|
-
const garbageCollectionInterval: number;
|
|
6
|
-
/** @hidden */
|
|
7
|
-
function delay(delay: number): Promise<unknown>;
|
|
8
|
-
let singleton: apps.Apps;
|
|
9
|
-
let init: () => Apps;
|
|
10
|
-
interface AuthMode {
|
|
11
|
-
admin: boolean;
|
|
12
|
-
variable?: any;
|
|
13
|
-
}
|
|
14
|
-
/** @hidden */
|
|
15
|
-
interface RefCounter {
|
|
16
|
-
[appName: string]: number;
|
|
17
|
-
}
|
|
18
|
-
class Apps {
|
|
19
|
-
private _refCounter;
|
|
20
|
-
private _emulatedAdminApp?;
|
|
21
|
-
constructor();
|
|
22
|
-
_appAlive(appName: string): boolean;
|
|
23
|
-
_destroyApp(appName: string): void;
|
|
24
|
-
retain(): void;
|
|
25
|
-
release(): Promise<void>;
|
|
26
|
-
get admin(): firebase.app.App;
|
|
27
|
-
/**
|
|
28
|
-
* This function allows the Firebase Emulator Suite to override the FirebaseApp instance
|
|
29
|
-
* used by the Firebase Functions SDK. Developers should never call this function for
|
|
30
|
-
* other purposes.
|
|
31
|
-
*/
|
|
32
|
-
setEmulatedAdminApp(app: firebase.app.App): void;
|
|
33
|
-
private get firebaseArgs();
|
|
34
|
-
}
|
|
35
|
-
}
|