firebase-functions 6.5.0 → 7.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/lib/_virtual/rolldown_runtime.js +34 -0
- package/lib/bin/firebase-functions.js +78 -103
- package/lib/common/app.js +35 -55
- package/lib/common/change.js +54 -75
- package/lib/common/config.js +41 -41
- package/lib/common/debug.js +23 -47
- package/lib/common/encoding.js +59 -82
- package/lib/common/onInit.js +26 -28
- package/lib/common/options.js +22 -42
- package/lib/common/params.d.ts +6 -6
- package/lib/common/params.js +0 -23
- package/lib/common/providers/database.js +270 -300
- package/lib/common/providers/firestore.js +66 -92
- package/lib/common/providers/https.d.ts +0 -1
- package/lib/common/providers/https.js +537 -539
- package/lib/common/providers/identity.js +393 -444
- package/lib/common/providers/tasks.js +64 -98
- package/lib/common/timezone.js +544 -542
- package/lib/common/trace.d.ts +0 -1
- package/lib/common/trace.js +63 -55
- package/lib/common/utilities/assertions.d.ts +11 -0
- package/lib/common/utilities/assertions.js +18 -0
- package/lib/common/utilities/encoder.js +20 -37
- package/lib/common/utilities/path-pattern.js +106 -132
- package/lib/common/utilities/path.js +28 -27
- package/lib/common/utilities/utils.js +23 -45
- package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
- package/lib/esm/bin/firebase-functions.mjs +91 -0
- package/lib/esm/common/app.mjs +39 -0
- package/lib/esm/common/change.mjs +57 -0
- package/lib/esm/common/config.mjs +45 -0
- package/lib/esm/common/debug.mjs +28 -0
- package/lib/esm/common/encoding.mjs +69 -0
- package/lib/esm/common/onInit.mjs +33 -0
- package/lib/esm/common/options.mjs +22 -0
- package/lib/esm/common/params.mjs +1 -0
- package/lib/esm/common/providers/database.mjs +269 -0
- package/lib/esm/common/providers/firestore.mjs +78 -0
- package/lib/esm/common/providers/https.mjs +573 -0
- package/lib/esm/common/providers/identity.mjs +428 -0
- package/lib/esm/common/providers/tasks.mjs +67 -0
- package/lib/esm/common/timezone.mjs +544 -0
- package/lib/esm/common/trace.mjs +73 -0
- package/lib/esm/common/utilities/assertions.mjs +17 -0
- package/lib/esm/common/utilities/encoder.mjs +21 -0
- package/lib/esm/common/utilities/path-pattern.mjs +116 -0
- package/lib/esm/common/utilities/path.mjs +35 -0
- package/lib/esm/common/utilities/utils.mjs +29 -0
- package/lib/esm/function-configuration.mjs +1 -0
- package/lib/esm/logger/common.mjs +23 -0
- package/lib/esm/logger/compat.mjs +25 -0
- package/lib/esm/logger/index.mjs +131 -0
- package/lib/esm/params/index.mjs +160 -0
- package/lib/esm/params/types.mjs +400 -0
- package/lib/esm/runtime/loader.mjs +132 -0
- package/lib/esm/runtime/manifest.mjs +134 -0
- package/lib/esm/types/global.d.mjs +1 -0
- package/lib/esm/v1/cloud-functions.mjs +206 -0
- package/lib/esm/v1/config.mjs +14 -0
- package/lib/esm/v1/function-builder.mjs +252 -0
- package/lib/esm/v1/function-configuration.mjs +72 -0
- package/lib/esm/v1/index.mjs +27 -0
- package/lib/esm/v1/providers/analytics.mjs +212 -0
- package/lib/esm/v1/providers/auth.mjs +156 -0
- package/lib/esm/v1/providers/database.mjs +243 -0
- package/lib/esm/v1/providers/firestore.mjs +131 -0
- package/lib/esm/v1/providers/https.mjs +82 -0
- package/lib/esm/v1/providers/pubsub.mjs +175 -0
- package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
- package/lib/esm/v1/providers/storage.mjs +163 -0
- package/lib/esm/v1/providers/tasks.mjs +63 -0
- package/lib/esm/v1/providers/testLab.mjs +94 -0
- package/lib/esm/v2/core.mjs +4 -0
- package/lib/esm/v2/index.mjs +28 -0
- package/lib/esm/v2/options.mjs +102 -0
- package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
- package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
- package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
- package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
- package/lib/esm/v2/providers/alerts/index.mjs +22 -0
- package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
- package/lib/esm/v2/providers/database.mjs +197 -0
- package/lib/esm/v2/providers/dataconnect.mjs +130 -0
- package/lib/esm/v2/providers/eventarc.mjs +51 -0
- package/lib/esm/v2/providers/firestore.mjs +294 -0
- package/lib/esm/v2/providers/https.mjs +210 -0
- package/lib/esm/v2/providers/identity.mjs +103 -0
- package/lib/esm/v2/providers/pubsub.mjs +148 -0
- package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
- package/lib/esm/v2/providers/scheduler.mjs +84 -0
- package/lib/esm/v2/providers/storage.mjs +155 -0
- package/lib/esm/v2/providers/tasks.mjs +65 -0
- package/lib/esm/v2/providers/testLab.mjs +53 -0
- package/lib/esm/v2/trace.mjs +20 -0
- package/lib/function-configuration.d.ts +0 -0
- package/lib/function-configuration.js +0 -0
- package/lib/logger/common.js +21 -41
- package/lib/logger/compat.js +18 -33
- package/lib/logger/index.js +119 -130
- package/lib/params/index.d.ts +19 -4
- package/lib/params/index.js +153 -129
- package/lib/params/types.d.ts +17 -0
- package/lib/params/types.js +390 -382
- package/lib/runtime/loader.js +114 -148
- package/lib/runtime/manifest.js +106 -126
- package/lib/types/global.d.js +0 -0
- package/lib/v1/cloud-functions.d.ts +2 -2
- package/lib/v1/cloud-functions.js +193 -241
- package/lib/v1/config.d.ts +4 -7
- package/lib/v1/config.js +13 -75
- package/lib/v1/function-builder.js +239 -368
- package/lib/v1/function-configuration.js +70 -63
- package/lib/v1/index.js +118 -73
- package/lib/v1/providers/analytics.js +189 -210
- package/lib/v1/providers/auth.d.ts +2 -1
- package/lib/v1/providers/auth.js +159 -164
- package/lib/v1/providers/database.js +237 -242
- package/lib/v1/providers/firestore.js +131 -130
- package/lib/v1/providers/https.d.ts +2 -1
- package/lib/v1/providers/https.js +79 -86
- package/lib/v1/providers/pubsub.js +175 -172
- package/lib/v1/providers/remoteConfig.js +64 -68
- package/lib/v1/providers/storage.js +161 -163
- package/lib/v1/providers/tasks.d.ts +1 -1
- package/lib/v1/providers/tasks.js +65 -80
- package/lib/v1/providers/testLab.js +94 -94
- package/lib/v2/core.d.ts +1 -1
- package/lib/v2/core.js +5 -32
- package/lib/v2/index.d.ts +6 -3
- package/lib/v2/index.js +123 -75
- package/lib/v2/options.js +88 -114
- package/lib/v2/providers/alerts/alerts.js +76 -95
- package/lib/v2/providers/alerts/appDistribution.js +73 -78
- package/lib/v2/providers/alerts/billing.js +49 -53
- package/lib/v2/providers/alerts/crashlytics.js +110 -102
- package/lib/v2/providers/alerts/index.js +56 -53
- package/lib/v2/providers/alerts/performance.js +64 -74
- package/lib/v2/providers/database.js +177 -180
- package/lib/v2/providers/dataconnect.d.ts +95 -0
- package/lib/v2/providers/dataconnect.js +137 -0
- package/lib/v2/providers/eventarc.js +55 -77
- package/lib/v2/providers/firestore.js +262 -260
- package/lib/v2/providers/https.d.ts +3 -2
- package/lib/v2/providers/https.js +210 -247
- package/lib/v2/providers/identity.d.ts +2 -1
- package/lib/v2/providers/identity.js +96 -105
- package/lib/v2/providers/pubsub.js +149 -167
- package/lib/v2/providers/remoteConfig.js +54 -63
- package/lib/v2/providers/scheduler.js +84 -96
- package/lib/v2/providers/storage.js +147 -162
- package/lib/v2/providers/tasks.d.ts +1 -1
- package/lib/v2/providers/tasks.js +68 -95
- package/lib/v2/providers/testLab.js +55 -64
- package/lib/v2/trace.js +18 -19
- package/package.json +290 -226
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
|
@@ -1,68 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.onConfigUpdated = exports.eventType = void 0;
|
|
25
|
-
const onInit_1 = require("../../common/onInit");
|
|
26
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
27
|
-
const options_1 = require("../options");
|
|
28
|
-
const trace_1 = require("../trace");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_runtime_manifest = require('../../runtime/manifest.js');
|
|
3
|
+
const require_common_onInit = require('../../common/onInit.js');
|
|
4
|
+
const require_v2_trace = require('../trace.js');
|
|
5
|
+
const require_v2_options = require('../options.js');
|
|
6
|
+
|
|
7
|
+
//#region src/v2/providers/remoteConfig.ts
|
|
8
|
+
var remoteConfig_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
9
|
+
eventType: () => eventType,
|
|
10
|
+
onConfigUpdated: () => onConfigUpdated
|
|
11
|
+
});
|
|
29
12
|
/** @internal */
|
|
30
|
-
|
|
13
|
+
const eventType = "google.firebase.remoteconfig.remoteConfig.v1.updated";
|
|
31
14
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
* Event handler which triggers when data is updated in a Remote Config.
|
|
16
|
+
*
|
|
17
|
+
* @param optsOrHandler - Options or an event handler.
|
|
18
|
+
* @param handler - Event handler which is run every time a Remote Config update occurs.
|
|
19
|
+
* @returns A function that you can export and deploy.
|
|
20
|
+
*/
|
|
38
21
|
function onConfigUpdated(optsOrHandler, handler) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return func;
|
|
22
|
+
if (typeof optsOrHandler === "function") {
|
|
23
|
+
handler = optsOrHandler;
|
|
24
|
+
optsOrHandler = {};
|
|
25
|
+
}
|
|
26
|
+
const baseOpts = require_v2_options.optionsToEndpoint(require_v2_options.getGlobalOptions());
|
|
27
|
+
const specificOpts = require_v2_options.optionsToEndpoint(optsOrHandler);
|
|
28
|
+
const func = require_v2_trace.wrapTraceContext(require_common_onInit.withInit((raw) => {
|
|
29
|
+
return handler(raw);
|
|
30
|
+
}));
|
|
31
|
+
func.run = handler;
|
|
32
|
+
const ep = {
|
|
33
|
+
...require_runtime_manifest.initV2Endpoint(require_v2_options.getGlobalOptions(), optsOrHandler),
|
|
34
|
+
platform: "gcfv2",
|
|
35
|
+
...baseOpts,
|
|
36
|
+
...specificOpts,
|
|
37
|
+
labels: {
|
|
38
|
+
...baseOpts?.labels,
|
|
39
|
+
...specificOpts?.labels
|
|
40
|
+
},
|
|
41
|
+
eventTrigger: {
|
|
42
|
+
eventType,
|
|
43
|
+
eventFilters: {},
|
|
44
|
+
retry: optsOrHandler.retry ?? false
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
func.__endpoint = ep;
|
|
48
|
+
return func;
|
|
67
49
|
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.eventType = eventType;
|
|
68
53
|
exports.onConfigUpdated = onConfigUpdated;
|
|
54
|
+
Object.defineProperty(exports, 'remoteConfig_exports', {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return remoteConfig_exports;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
@@ -1,103 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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.onSchedule = exports.getOpts = void 0;
|
|
25
|
-
const encoding_1 = require("../../common/encoding");
|
|
26
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
27
|
-
const trace_1 = require("../trace");
|
|
28
|
-
const logger = require("../../logger");
|
|
29
|
-
const options = require("../options");
|
|
30
|
-
const onInit_1 = require("../../common/onInit");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_logger_index = require('../../logger/index.js');
|
|
3
|
+
const require_runtime_manifest = require('../../runtime/manifest.js');
|
|
4
|
+
const require_common_encoding = require('../../common/encoding.js');
|
|
5
|
+
const require_common_onInit = require('../../common/onInit.js');
|
|
6
|
+
const require_v2_trace = require('../trace.js');
|
|
7
|
+
const require_v2_options = require('../options.js');
|
|
8
|
+
|
|
9
|
+
//#region src/v2/providers/scheduler.ts
|
|
10
|
+
var scheduler_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
11
|
+
getOpts: () => getOpts,
|
|
12
|
+
onSchedule: () => onSchedule
|
|
13
|
+
});
|
|
31
14
|
/** @internal */
|
|
32
15
|
function getOpts(args) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
if (typeof args === "string") {
|
|
17
|
+
return {
|
|
18
|
+
schedule: args,
|
|
19
|
+
opts: {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
schedule: args.schedule,
|
|
24
|
+
timeZone: args.timeZone,
|
|
25
|
+
retryConfig: {
|
|
26
|
+
retryCount: args.retryCount,
|
|
27
|
+
maxRetrySeconds: args.maxRetrySeconds,
|
|
28
|
+
minBackoffSeconds: args.minBackoffSeconds,
|
|
29
|
+
maxBackoffSeconds: args.maxBackoffSeconds,
|
|
30
|
+
maxDoublings: args.maxDoublings
|
|
31
|
+
},
|
|
32
|
+
opts: args
|
|
33
|
+
};
|
|
51
34
|
}
|
|
52
|
-
exports.getOpts = getOpts;
|
|
53
35
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
* Handler for scheduled functions. Triggered whenever the associated
|
|
37
|
+
* scheduler job sends a http request.
|
|
38
|
+
* @param args - Either a schedule or an object containing function options.
|
|
39
|
+
* @param handler - A function to execute when triggered.
|
|
40
|
+
* @returns A function that you can export and deploy.
|
|
41
|
+
*/
|
|
60
42
|
function onSchedule(args, handler) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
return func;
|
|
43
|
+
const separatedOpts = getOpts(args);
|
|
44
|
+
const httpFunc = async (req, res) => {
|
|
45
|
+
const event = {
|
|
46
|
+
jobName: req.header("X-CloudScheduler-JobName") || undefined,
|
|
47
|
+
scheduleTime: req.header("X-CloudScheduler-ScheduleTime") || new Date().toISOString()
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
await handler(event);
|
|
51
|
+
res.status(200).send();
|
|
52
|
+
} catch (err) {
|
|
53
|
+
require_logger_index.error(err.message);
|
|
54
|
+
res.status(500).send();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const func = require_v2_trace.wrapTraceContext(require_common_onInit.withInit(httpFunc));
|
|
58
|
+
func.run = handler;
|
|
59
|
+
const globalOpts = require_v2_options.getGlobalOptions();
|
|
60
|
+
const baseOptsEndpoint = require_v2_options.optionsToEndpoint(globalOpts);
|
|
61
|
+
const specificOptsEndpoint = require_v2_options.optionsToEndpoint(separatedOpts.opts);
|
|
62
|
+
const ep = {
|
|
63
|
+
...require_runtime_manifest.initV2Endpoint(globalOpts, separatedOpts.opts),
|
|
64
|
+
platform: "gcfv2",
|
|
65
|
+
...baseOptsEndpoint,
|
|
66
|
+
...specificOptsEndpoint,
|
|
67
|
+
labels: {
|
|
68
|
+
...baseOptsEndpoint?.labels,
|
|
69
|
+
...specificOptsEndpoint?.labels
|
|
70
|
+
},
|
|
71
|
+
scheduleTrigger: require_runtime_manifest.initV2ScheduleTrigger(separatedOpts.schedule, globalOpts, separatedOpts.opts)
|
|
72
|
+
};
|
|
73
|
+
require_common_encoding.copyIfPresent(ep.scheduleTrigger, separatedOpts, "timeZone");
|
|
74
|
+
require_common_encoding.copyIfPresent(ep.scheduleTrigger.retryConfig, separatedOpts.retryConfig, "retryCount", "maxRetrySeconds", "minBackoffSeconds", "maxBackoffSeconds", "maxDoublings");
|
|
75
|
+
func.__endpoint = ep;
|
|
76
|
+
func.__requiredAPIs = [{
|
|
77
|
+
api: "cloudscheduler.googleapis.com",
|
|
78
|
+
reason: "Needed for scheduled functions."
|
|
79
|
+
}];
|
|
80
|
+
return func;
|
|
102
81
|
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.getOpts = getOpts;
|
|
103
85
|
exports.onSchedule = onSchedule;
|
|
86
|
+
Object.defineProperty(exports, 'scheduler_exports', {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return scheduler_exports;
|
|
90
|
+
}
|
|
91
|
+
});
|