firebase-tools-with-isolate 15.36.0 → 15.38.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/accountExporter.js +1 -1
- package/lib/accountImporter.js +15 -10
- package/lib/apiv2.js +66 -12
- package/lib/appUtils.js +103 -40
- package/lib/appdistribution/client.js +5 -1
- package/lib/apptesting/parseTestFiles.js +1 -1
- package/lib/auth.js +1 -1
- package/lib/bin/progressiveHelp.js +1 -1
- package/lib/command.js +1 -2
- package/lib/commands/appdistribution-distribute.js +5 -3
- package/lib/commands/crashlytics-events-get.js +46 -0
- package/lib/commands/crashlytics-events-list.js +68 -0
- package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
- package/lib/commands/crashlytics-heapdumps-status.js +5 -3
- package/lib/commands/crashlytics-issues-get.js +65 -0
- package/lib/commands/crashlytics-reports-get.js +267 -0
- package/lib/commands/crashlytics-reports-list.js +42 -0
- package/lib/commands/dataconnect-services-list.js +8 -2
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/hosting-channel-open.js +4 -1
- package/lib/commands/index.js +10 -0
- package/lib/commands/open.js +3 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/use.js +1 -1
- package/lib/config.js +1 -1
- package/lib/crashlytics/commandUtils.js +227 -0
- package/lib/crashlytics/events.js +71 -73
- package/lib/crashlytics/filters.js +1 -1
- package/lib/crashlytics/profilingManager.js +63 -16
- package/lib/crashlytics/reports.js +5 -1
- package/lib/dataconnect/client.js +14 -8
- package/lib/deploy/dataconnect/release.js +2 -2
- package/lib/deploy/firestore/prepare.js +23 -17
- package/lib/deploy/functions/cel.js +1 -1
- package/lib/deploy/functions/deploy.js +2 -1
- package/lib/deploy/functions/prepare.js +28 -0
- package/lib/deploy/functions/release/fabricator.js +27 -3
- package/lib/deploy/functions/release/planner.js +3 -0
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/python/index.js +3 -0
- package/lib/deploy/functions/runtimes/supported/index.js +10 -4
- package/lib/deploy/functions/runtimes/supported/types.js +13 -1
- package/lib/deploy/run/deploy.js +40 -35
- package/lib/deploy/run/prereqs.js +0 -3
- package/lib/downloadUtils.js +2 -1
- package/lib/emulator/download.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/downloadableEmulators.js +14 -2
- package/lib/emulator/events/types.js +0 -6
- package/lib/emulator/functionsEmulator.js +73 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +0 -1
- package/lib/emulator/storage/rules/runtime.js +0 -3
- package/lib/emulator/taskQueue.js +0 -12
- package/lib/experiments.js +10 -0
- package/lib/extensions/extensionsHelper.js +1 -4
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/replacements.json +2 -1
- package/lib/firestore/delete.js +2 -3
- package/lib/firestore/fsConfig.js +100 -41
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +2 -2
- package/lib/frameworks/next/utils.js +6 -8
- package/lib/gcp/cloudbilling.js +2 -2
- package/lib/gcp/cloudbuild.js +0 -77
- package/lib/gcp/cloudscheduler.js +12 -0
- package/lib/gcp/cloudtasks.js +0 -4
- package/lib/gcp/devConnect.js +0 -6
- package/lib/gcp/iam.js +15 -1
- package/lib/gcp/resourceManager.js +1 -14
- package/lib/gcp/runv2.js +0 -27
- package/lib/gcp/secretManager.js +2 -2
- package/lib/gcp/storage.js +87 -4
- package/lib/hosting/api.js +29 -23
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +1 -1
- package/lib/init/features/dataconnect/sdk.js +15 -5
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/index.js +2 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -1
- package/lib/init/features/storage/rules.js +1 -1
- package/lib/localFunction.js +3 -3
- package/lib/management/apps.js +7 -0
- package/lib/management/database.js +1 -1
- package/lib/mcp/apps/init/mcp-app.js +1 -1
- package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
- package/lib/mcp/index.js +10 -4
- package/lib/mcp/tools/core/get_environment.js +1 -1
- package/lib/mcp/tools/crashlytics/events.js +2 -5
- package/lib/mcp/tools/crashlytics/reports.js +5 -14
- package/lib/mcp/util/apptesting/availability.js +3 -2
- package/lib/mcp/util/crashlytics/availability.js +59 -12
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/mcp/util.js +4 -0
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/requireAuth.js +11 -7
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +1 -1
- package/package.json +15 -12
- package/schema/firebase-config.json +9 -3
- package/standalone/package.json +6 -1
|
@@ -30,6 +30,7 @@ const experiments = require("../experiments");
|
|
|
30
30
|
const process = require("process");
|
|
31
31
|
const emulatorUpdateDetails = require("./downloadableEmulatorInfo.json");
|
|
32
32
|
const EMULATOR_INSTANCE_KILL_TIMEOUT = 4000;
|
|
33
|
+
const JAVA_DEFENSIVE_ARGS = ["-XX:+IgnoreUnrecognizedVMOptions", "-XX:UseAVX=2"];
|
|
33
34
|
const CACHE_DIR = process.env.FIREBASE_EMULATORS_PATH || path.join(os.homedir(), ".cache", "firebase", "emulators");
|
|
34
35
|
const EMULATOR_UPDATE_DETAILS = emulatorUpdateDetails;
|
|
35
36
|
function generateDownloadDetails(emulator) {
|
|
@@ -175,7 +176,7 @@ const EmulatorDetails = {
|
|
|
175
176
|
const Commands = {
|
|
176
177
|
database: {
|
|
177
178
|
binary: "java",
|
|
178
|
-
args: ["-Duser.language=en", "-jar", getExecPath(types_1.Emulators.DATABASE)],
|
|
179
|
+
args: [...JAVA_DEFENSIVE_ARGS, "-Duser.language=en", "-jar", getExecPath(types_1.Emulators.DATABASE)],
|
|
179
180
|
optionalArgs: [
|
|
180
181
|
"port",
|
|
181
182
|
"host",
|
|
@@ -189,6 +190,7 @@ const Commands = {
|
|
|
189
190
|
firestore: {
|
|
190
191
|
binary: "java",
|
|
191
192
|
args: [
|
|
193
|
+
...JAVA_DEFENSIVE_ARGS,
|
|
192
194
|
"-Dgoogle.cloud_firestore.debug_log_level=FINE",
|
|
193
195
|
"-Duser.language=en",
|
|
194
196
|
"-jar",
|
|
@@ -212,6 +214,7 @@ const Commands = {
|
|
|
212
214
|
storage: {
|
|
213
215
|
binary: "java",
|
|
214
216
|
args: [
|
|
217
|
+
...JAVA_DEFENSIVE_ARGS,
|
|
215
218
|
"-Djava.security.manager=disallow",
|
|
216
219
|
"-Duser.language=en",
|
|
217
220
|
"-jar",
|
|
@@ -273,6 +276,7 @@ function _getCommand(emulator, args) {
|
|
|
273
276
|
const useDirectPubsubJarOnWindows = emulator === types_1.Emulators.PUBSUB && utils.IS_WINDOWS && !process.env.PUBSUB_EMULATOR_BINARY_PATH;
|
|
274
277
|
const cmdLineArgs = useDirectPubsubJarOnWindows
|
|
275
278
|
? [
|
|
279
|
+
...JAVA_DEFENSIVE_ARGS,
|
|
276
280
|
"-Duser.language=en",
|
|
277
281
|
...splitEnvOpts(process.env.JAVA_OPTS),
|
|
278
282
|
...splitEnvOpts(process.env.CLOUD_PUBSUB_EMULATOR_OPTS),
|
|
@@ -359,8 +363,16 @@ async function _runBinary(emulator, command, extraEnv) {
|
|
|
359
363
|
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(emulator.name);
|
|
360
364
|
emulator.stdout = fs.createWriteStream(getLogFileName(emulator.name));
|
|
361
365
|
try {
|
|
366
|
+
const env = { ...process.env, ...extraEnv };
|
|
367
|
+
if (emulator.name === types_1.Emulators.PUBSUB && command.shell) {
|
|
368
|
+
const defensiveOpts = JAVA_DEFENSIVE_ARGS.join(" ");
|
|
369
|
+
const existingOpts = env.CLOUD_PUBSUB_EMULATOR_OPTS?.trim();
|
|
370
|
+
env.CLOUD_PUBSUB_EMULATOR_OPTS = existingOpts
|
|
371
|
+
? `${defensiveOpts} ${existingOpts}`
|
|
372
|
+
: defensiveOpts;
|
|
373
|
+
}
|
|
362
374
|
const opts = {
|
|
363
|
-
env
|
|
375
|
+
env,
|
|
364
376
|
detached: true,
|
|
365
377
|
stdio: ["ignore", "pipe", "pipe"],
|
|
366
378
|
};
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventUtils = void 0;
|
|
4
4
|
class EventUtils {
|
|
5
|
-
static isEvent(proto) {
|
|
6
|
-
return proto.context && proto.data;
|
|
7
|
-
}
|
|
8
|
-
static isLegacyEvent(proto) {
|
|
9
|
-
return proto.data && proto.resource;
|
|
10
|
-
}
|
|
11
5
|
static isBinaryCloudEvent(req) {
|
|
12
6
|
return !!(req.header("ce-type") &&
|
|
13
7
|
req.header("ce-specversion") &&
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionsEmulator = exports.TCPConn = exports.IPCConn = void 0;
|
|
4
4
|
exports.createIgnoredFilter = createIgnoredFilter;
|
|
5
|
+
exports.getAllowedEmulatorUIOrigins = getAllowedEmulatorUIOrigins;
|
|
5
6
|
const fs = require("fs");
|
|
6
7
|
const path = require("path");
|
|
7
8
|
const express = require("express");
|
|
@@ -14,6 +15,7 @@ const events_1 = require("events");
|
|
|
14
15
|
const logger_1 = require("../logger");
|
|
15
16
|
const track_1 = require("../track");
|
|
16
17
|
const constants_1 = require("./constants");
|
|
18
|
+
const dns_1 = require("./dns");
|
|
17
19
|
const types_1 = require("./types");
|
|
18
20
|
const chokidar = require("chokidar");
|
|
19
21
|
const minimatch = require("minimatch");
|
|
@@ -85,6 +87,60 @@ function createIgnoredFilter(ignore) {
|
|
|
85
87
|
}
|
|
86
88
|
return ignored;
|
|
87
89
|
}
|
|
90
|
+
const LOOPBACK_AND_WILDCARD_HOSTS = [
|
|
91
|
+
"localhost",
|
|
92
|
+
dns_1.IPV4_LOOPBACK.address,
|
|
93
|
+
dns_1.IPV6_LOOPBACK.address,
|
|
94
|
+
dns_1.IPV4_UNSPECIFIED.address,
|
|
95
|
+
dns_1.IPV6_UNSPECIFIED.address,
|
|
96
|
+
];
|
|
97
|
+
function addOrigin(origins, options) {
|
|
98
|
+
const { protocol, host, port } = options;
|
|
99
|
+
const formattedHost = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
|
100
|
+
const portSuffix = port !== undefined ? `:${port}` : "";
|
|
101
|
+
try {
|
|
102
|
+
origins.add(new url_1.URL(`${protocol}://${formattedHost}${portSuffix}`).origin);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function getAllowedEmulatorUIOrigins() {
|
|
108
|
+
const uiInfo = registry_1.EmulatorRegistry.getInfo(types_1.Emulators.UI);
|
|
109
|
+
if (!uiInfo) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
const origins = new Set();
|
|
113
|
+
const specs = uiInfo.listen?.length
|
|
114
|
+
? uiInfo.listen
|
|
115
|
+
: [
|
|
116
|
+
{
|
|
117
|
+
address: uiInfo.host,
|
|
118
|
+
port: uiInfo.port,
|
|
119
|
+
family: uiInfo.host.includes(":") ? "IPv6" : "IPv4",
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
for (const spec of specs) {
|
|
123
|
+
const { address, port } = spec;
|
|
124
|
+
if (LOOPBACK_AND_WILDCARD_HOSTS.includes(address)) {
|
|
125
|
+
addOrigin(origins, { protocol: "http", host: "localhost", port });
|
|
126
|
+
addOrigin(origins, { protocol: "http", host: dns_1.IPV4_LOOPBACK.address, port });
|
|
127
|
+
addOrigin(origins, { protocol: "http", host: dns_1.IPV6_LOOPBACK.address, port });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
addOrigin(origins, { protocol: "http", host: address, port });
|
|
131
|
+
}
|
|
132
|
+
if (process.env.WEB_HOST) {
|
|
133
|
+
addOrigin(origins, { protocol: "https", host: `${port}-${process.env.WEB_HOST}` });
|
|
134
|
+
}
|
|
135
|
+
if (process.env.CODESPACE_NAME && process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN) {
|
|
136
|
+
addOrigin(origins, {
|
|
137
|
+
protocol: "https",
|
|
138
|
+
host: `${process.env.CODESPACE_NAME}-${port}.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return Array.from(origins);
|
|
143
|
+
}
|
|
88
144
|
class FunctionsEmulator {
|
|
89
145
|
static getHttpFunctionUrl(projectId, name, region, info) {
|
|
90
146
|
let url;
|
|
@@ -223,10 +279,26 @@ class FunctionsEmulator {
|
|
|
223
279
|
}
|
|
224
280
|
res.json({ status: "multicast_acknowledged" });
|
|
225
281
|
};
|
|
282
|
+
const rejectDisallowedBackendsOrigin = (req, res, next) => {
|
|
283
|
+
const origin = req.headers.origin;
|
|
284
|
+
if (origin && !getAllowedEmulatorUIOrigins().includes(origin)) {
|
|
285
|
+
res.status(403).json({
|
|
286
|
+
message: `/backends cannot be accessed by external callers.`,
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
next();
|
|
291
|
+
};
|
|
292
|
+
const listBackendsCors = cors({
|
|
293
|
+
origin: (origin, callback) => {
|
|
294
|
+
callback(null, Boolean(origin));
|
|
295
|
+
},
|
|
296
|
+
});
|
|
226
297
|
const listBackendsHandler = (req, res) => {
|
|
227
298
|
res.json({ backends: this.getBackendInfo() });
|
|
228
299
|
};
|
|
229
|
-
hub.
|
|
300
|
+
hub.options(listBackendsRoute, rejectDisallowedBackendsOrigin, listBackendsCors);
|
|
301
|
+
hub.get(listBackendsRoute, rejectDisallowedBackendsOrigin, listBackendsCors, listBackendsHandler);
|
|
230
302
|
hub.post(backgroundFunctionRoute, dataMiddleware, httpsHandler);
|
|
231
303
|
hub.post(multicastFunctionRoute, dataMiddleware, multicastHandler);
|
|
232
304
|
hub.all(httpsFunctionRoutes, dataMiddleware, httpsHandler);
|
|
@@ -293,8 +293,8 @@ async function initializeFirebaseAdminStubs() {
|
|
|
293
293
|
new types_1.EmulatorLog("WARN_ONCE", "runtime-status", "The Firebase Authentication emulator is running, but your 'firebase-admin' dependency is below version 9.3.0, so calls to Firebase Authentication will affect production.").log();
|
|
294
294
|
}
|
|
295
295
|
else if ((0, functionsEmulatorUtils_1.compareVersionStrings)(adminResolution.version, "9.4.2") <= 0) {
|
|
296
|
-
const auth = defaultApp.auth();
|
|
297
|
-
if (typeof auth
|
|
296
|
+
const auth = typeof defaultApp.auth === "function" ? defaultApp.auth() : undefined;
|
|
297
|
+
if (typeof auth?.setJwtVerificationEnabled === "function") {
|
|
298
298
|
logDebug("auth.setJwtVerificationEnabled(false)", {});
|
|
299
299
|
auth.setJwtVerificationEnabled(false);
|
|
300
300
|
}
|
|
@@ -14,7 +14,6 @@ const STORAGE_V2_ACTION_MAP = {
|
|
|
14
14
|
};
|
|
15
15
|
class StorageCloudFunctions {
|
|
16
16
|
constructor(projectId) {
|
|
17
|
-
this.projectId = projectId;
|
|
18
17
|
this.logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.STORAGE);
|
|
19
18
|
this.multicastPath = "";
|
|
20
19
|
this.enabled = false;
|
|
@@ -35,9 +35,6 @@ class StorageRulesetInstance {
|
|
|
35
35
|
}
|
|
36
36
|
return this.runtime.verifyWithRuleset(this.rulesetName, opts, runtimeVariableOverrides);
|
|
37
37
|
}
|
|
38
|
-
unload() {
|
|
39
|
-
throw new Error("NOT_IMPLEMENTED");
|
|
40
|
-
}
|
|
41
38
|
}
|
|
42
39
|
exports.StorageRulesetInstance = StorageRulesetInstance;
|
|
43
40
|
class StorageRulesIssues {
|
|
@@ -313,18 +313,6 @@ class TaskQueue {
|
|
|
313
313
|
delete(taskId) {
|
|
314
314
|
this.queue.remove(taskId);
|
|
315
315
|
}
|
|
316
|
-
getDebugInfo() {
|
|
317
|
-
return `
|
|
318
|
-
Task Queue (${this.key}):
|
|
319
|
-
- Active: ${this.isActive().toString()}
|
|
320
|
-
- Tokens: ${this.tokens}
|
|
321
|
-
- In Queue: ${this.queue.size()}
|
|
322
|
-
- Dispatch: [
|
|
323
|
-
${this.dispatches.map((t) => (t === null ? "empty" : t.task.name)).join(",\n")}
|
|
324
|
-
]
|
|
325
|
-
- Open Locations: [${this.openDispatches.join(", ")}]
|
|
326
|
-
`;
|
|
327
|
-
}
|
|
328
316
|
getStatistics() {
|
|
329
317
|
const fiveMinutesAgo = Date.now() - 5 * 60 * 1000;
|
|
330
318
|
const oneMinuteAgo = Date.now() - 60 * 1000;
|
package/lib/experiments.js
CHANGED
|
@@ -228,6 +228,16 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
228
228
|
default: false,
|
|
229
229
|
public: false,
|
|
230
230
|
},
|
|
231
|
+
crashlyticscli: {
|
|
232
|
+
shortDescription: "Enable read-only Crashlytics commands for issues, events, and reports.",
|
|
233
|
+
default: false,
|
|
234
|
+
public: false,
|
|
235
|
+
},
|
|
236
|
+
fdcsqlconnect: {
|
|
237
|
+
shortDescription: "Enable SQL Connect PostgREST and SQL migrations emulator support.",
|
|
238
|
+
default: false,
|
|
239
|
+
public: false,
|
|
240
|
+
},
|
|
231
241
|
});
|
|
232
242
|
function isValidExperiment(name) {
|
|
233
243
|
return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AUTOPOPULATED_PARAM_PLACEHOLDERS = exports.EXTENSIONS_BUCKET_NAME = exports.logPrefix = exports.SourceOrigin = exports.SpecParamType = void 0;
|
|
4
4
|
exports.getDBInstanceFromURL = getDBInstanceFromURL;
|
|
5
5
|
exports.getFirebaseProjectParams = getFirebaseProjectParams;
|
|
6
6
|
exports.substituteParams = substituteParams;
|
|
@@ -83,9 +83,6 @@ exports.AUTOPOPULATED_PARAM_PLACEHOLDERS = {
|
|
|
83
83
|
DATABASE_INSTANCE: "project-id-default-rtdb",
|
|
84
84
|
DATABASE_URL: "https://project-id-default-rtdb.firebaseio.com",
|
|
85
85
|
};
|
|
86
|
-
exports.resourceTypeToNiceName = {
|
|
87
|
-
"firebaseextensions.v1beta.function": "Cloud Function",
|
|
88
|
-
};
|
|
89
86
|
const repoRegex = new RegExp(`^https://github.com/[^/]+/[^/]+$`);
|
|
90
87
|
const stageOptions = ["rc", "alpha", "beta", "stable"];
|
|
91
88
|
function getDBInstanceFromURL(databaseUrl = "") {
|
|
@@ -48,7 +48,7 @@ async function listExtensions(projectId) {
|
|
|
48
48
|
publisher = extension.split("/")[0];
|
|
49
49
|
}
|
|
50
50
|
const instanceId = (0, utils_1.last)(instance.name.split("/")) ?? "";
|
|
51
|
-
const state = instance.state +
|
|
51
|
+
const state = String(instance.state) +
|
|
52
52
|
((instance.config.source.state || "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
|
|
53
53
|
const version = instance?.config?.source?.spec?.version;
|
|
54
54
|
const updateTime = extensionsUtils.formatTimestamp(instance.updateTime);
|
|
@@ -342,7 +342,8 @@
|
|
|
342
342
|
"extensionRepositoryUrl": "https://github.com/FlywheelStudio/pushfire-libs-firebase-extension/tree/main/README.md"
|
|
343
343
|
},
|
|
344
344
|
"revenuecat/firestore-revenuecat-purchases": {
|
|
345
|
-
"status": "
|
|
345
|
+
"status": "REPLACEMENT_AVAILABLE",
|
|
346
|
+
"npmPackage": "@revenuecat/firestore-revenuecat-purchases",
|
|
346
347
|
"extensionRepositoryUrl": "https://github.com/RevenueCat/firestore-revenuecat-purchases/tree/main/README.md"
|
|
347
348
|
},
|
|
348
349
|
"rowy/firestore-user-document": {
|
package/lib/firestore/delete.js
CHANGED
|
@@ -16,7 +16,6 @@ class FirestoreDelete {
|
|
|
16
16
|
this.path = path || "";
|
|
17
17
|
this.recursive = Boolean(options.recursive);
|
|
18
18
|
this.shallow = Boolean(options.shallow);
|
|
19
|
-
this.allCollections = Boolean(options.allCollections);
|
|
20
19
|
this.databaseId = options.databaseId;
|
|
21
20
|
this.urlPrefix = options.urlPrefix ?? (0, api_1.firestoreOriginOrEmulator)();
|
|
22
21
|
this.readBatchSize = 7500;
|
|
@@ -176,7 +175,7 @@ class FirestoreDelete {
|
|
|
176
175
|
return true;
|
|
177
176
|
}
|
|
178
177
|
if (failures.length > 0) {
|
|
179
|
-
logger_1.logger.debug(
|
|
178
|
+
logger_1.logger.debug(`Found ${failures.length} failed operations, failing.`);
|
|
180
179
|
return true;
|
|
181
180
|
}
|
|
182
181
|
if (queue.length <= this.maxQueueSize && pagesRemaining && !pageIncoming) {
|
|
@@ -193,7 +192,7 @@ class FirestoreDelete {
|
|
|
193
192
|
lastDocName = docs[docs.length - 1].name;
|
|
194
193
|
})
|
|
195
194
|
.catch((e) => {
|
|
196
|
-
logger_1.logger.debug(
|
|
195
|
+
logger_1.logger.debug(`Failed to fetch page after ${String(lastDocName)}`, e);
|
|
197
196
|
pageIncoming = false;
|
|
198
197
|
fetchFailures++;
|
|
199
198
|
if (fetchFailures >= 3) {
|
|
@@ -3,79 +3,138 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getFirestoreConfig = getFirestoreConfig;
|
|
4
4
|
const error_1 = require("../error");
|
|
5
5
|
const logger_1 = require("../logger");
|
|
6
|
+
function isFirestoreResource(value) {
|
|
7
|
+
return value === "rules" || value === "indexes";
|
|
8
|
+
}
|
|
9
|
+
function invalidDeployTargetError(value) {
|
|
10
|
+
return new error_1.FirebaseError(`Invalid Firestore deploy target: "${value}". Expected "firestore", "firestore:<databaseId|target>", "firestore:<databaseId|target>:rules", "firestore:<databaseId|target>:indexes", "firestore:rules", or "firestore:indexes".`, { exit: 1 });
|
|
11
|
+
}
|
|
12
|
+
function parseFirestoreSelection(only) {
|
|
13
|
+
const selection = {
|
|
14
|
+
allDatabases: !only,
|
|
15
|
+
allResources: new Set(["rules", "indexes"]),
|
|
16
|
+
byName: new Map(),
|
|
17
|
+
};
|
|
18
|
+
if (!only) {
|
|
19
|
+
return selection;
|
|
20
|
+
}
|
|
21
|
+
selection.allResources.clear();
|
|
22
|
+
const addResources = (name, resources) => {
|
|
23
|
+
const target = name
|
|
24
|
+
? selection.byName.get(name) || new Set()
|
|
25
|
+
: selection.allResources;
|
|
26
|
+
for (const resource of resources) {
|
|
27
|
+
target.add(resource);
|
|
28
|
+
}
|
|
29
|
+
if (name) {
|
|
30
|
+
selection.byName.set(name, target);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (const value of only.split(",")) {
|
|
34
|
+
if (value === "firestore") {
|
|
35
|
+
selection.allDatabases = true;
|
|
36
|
+
addResources(undefined, ["rules", "indexes"]);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (!value.startsWith("firestore:")) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const parts = value.split(":");
|
|
43
|
+
const name = parts[1];
|
|
44
|
+
const resource = parts[2];
|
|
45
|
+
if (!name ||
|
|
46
|
+
parts.length > 3 ||
|
|
47
|
+
(parts.length === 3 && !resource) ||
|
|
48
|
+
(resource && !isFirestoreResource(resource))) {
|
|
49
|
+
throw invalidDeployTargetError(value);
|
|
50
|
+
}
|
|
51
|
+
if (isFirestoreResource(name)) {
|
|
52
|
+
if (resource) {
|
|
53
|
+
throw invalidDeployTargetError(value);
|
|
54
|
+
}
|
|
55
|
+
selection.allDatabases = true;
|
|
56
|
+
addResources(undefined, [name]);
|
|
57
|
+
}
|
|
58
|
+
else if (resource && isFirestoreResource(resource)) {
|
|
59
|
+
addResources(name, [resource]);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
addResources(name, ["rules", "indexes"]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return selection;
|
|
66
|
+
}
|
|
67
|
+
function filterFirestoreConfig(config, resources) {
|
|
68
|
+
return {
|
|
69
|
+
...config,
|
|
70
|
+
rules: resources.has("rules") ? config.rules : undefined,
|
|
71
|
+
indexes: resources.has("indexes") ? config.indexes : undefined,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
6
74
|
function getFirestoreConfig(projectId, options) {
|
|
7
75
|
const fsConfig = options.config.src.firestore;
|
|
8
76
|
if (fsConfig === undefined) {
|
|
9
77
|
return [];
|
|
10
78
|
}
|
|
11
79
|
const rc = options.rc;
|
|
12
|
-
|
|
13
|
-
const onlyDatabases = new Set();
|
|
14
|
-
if (options.only) {
|
|
15
|
-
const split = options.only.split(",");
|
|
16
|
-
if (split.includes("firestore")) {
|
|
17
|
-
allDatabases = true;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
for (const value of split) {
|
|
21
|
-
if (value.startsWith("firestore:")) {
|
|
22
|
-
const target = value.split(":")[1];
|
|
23
|
-
onlyDatabases.add(target);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
80
|
+
const selection = parseFirestoreSelection(options.only);
|
|
28
81
|
if (!Array.isArray(fsConfig)) {
|
|
29
82
|
if (fsConfig) {
|
|
30
83
|
const databaseId = fsConfig.database || `(default)`;
|
|
31
|
-
|
|
84
|
+
const unmatched = [...selection.byName.keys()].filter((name) => name !== databaseId);
|
|
85
|
+
if (!selection.allDatabases && unmatched.length !== 0) {
|
|
86
|
+
throw new error_1.FirebaseError(`Could not find configurations in firebase.json for the following database targets: ${unmatched.join(", ")}`, { exit: 1 });
|
|
87
|
+
}
|
|
88
|
+
if (!selection.allDatabases && !selection.byName.has(databaseId)) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const resources = new Set(selection.allDatabases ? selection.allResources : []);
|
|
92
|
+
for (const resource of selection.byName.get(databaseId) || []) {
|
|
93
|
+
resources.add(resource);
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
filterFirestoreConfig({ rules: fsConfig.rules, indexes: fsConfig.indexes, database: databaseId }, resources),
|
|
97
|
+
];
|
|
32
98
|
}
|
|
33
99
|
else {
|
|
34
100
|
logger_1.logger.debug("Possibly invalid database config: ", JSON.stringify(fsConfig));
|
|
35
101
|
return [];
|
|
36
102
|
}
|
|
37
103
|
}
|
|
38
|
-
if (onlyDatabases.has("rules")) {
|
|
39
|
-
onlyDatabases.delete("rules");
|
|
40
|
-
allDatabases = true;
|
|
41
|
-
}
|
|
42
|
-
if (onlyDatabases.has("indexes")) {
|
|
43
|
-
onlyDatabases.delete("indexes");
|
|
44
|
-
allDatabases = true;
|
|
45
|
-
}
|
|
46
104
|
const results = [];
|
|
47
105
|
for (const c of fsConfig) {
|
|
48
106
|
const { database, target } = c;
|
|
49
107
|
if (target) {
|
|
50
|
-
|
|
108
|
+
const targetSelected = selection.allDatabases || selection.byName.has(target);
|
|
109
|
+
if (targetSelected) {
|
|
51
110
|
rc.requireTarget(projectId, "firestore", target);
|
|
52
111
|
const databases = rc.target(projectId, "firestore", target);
|
|
53
112
|
for (const database of databases) {
|
|
54
|
-
|
|
113
|
+
const resources = new Set(selection.allResources);
|
|
114
|
+
for (const resource of selection.byName.get(target) || []) {
|
|
115
|
+
resources.add(resource);
|
|
116
|
+
}
|
|
117
|
+
results.push(filterFirestoreConfig({ database, rules: c.rules, indexes: c.indexes }, resources));
|
|
55
118
|
}
|
|
56
|
-
onlyDatabases.delete(target);
|
|
57
119
|
}
|
|
58
120
|
}
|
|
59
121
|
else if (database) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
122
|
+
const databaseSelected = selection.allDatabases || selection.byName.has(database);
|
|
123
|
+
if (databaseSelected) {
|
|
124
|
+
const resources = new Set(selection.allResources);
|
|
125
|
+
for (const resource of selection.byName.get(database) || []) {
|
|
126
|
+
resources.add(resource);
|
|
127
|
+
}
|
|
128
|
+
results.push(filterFirestoreConfig({ database, rules: c.rules, indexes: c.indexes }, resources));
|
|
63
129
|
}
|
|
64
130
|
}
|
|
65
131
|
else {
|
|
66
132
|
throw new error_1.FirebaseError('Must supply either "target" or "databaseId" in firestore config');
|
|
67
133
|
}
|
|
68
134
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (onlyDatabases.has("indexes")) {
|
|
73
|
-
onlyDatabases.delete("indexes");
|
|
74
|
-
}
|
|
75
|
-
if (!allDatabases && onlyDatabases.size !== 0) {
|
|
76
|
-
throw new error_1.FirebaseError(`Could not find configurations in firebase.json for the following database targets: ${[
|
|
77
|
-
...onlyDatabases,
|
|
78
|
-
].join(", ")}`);
|
|
135
|
+
const unmatched = [...selection.byName.keys()].filter((name) => !fsConfig.some((config) => config.database === name || config.target === name));
|
|
136
|
+
if (!selection.allDatabases && unmatched.length !== 0) {
|
|
137
|
+
throw new error_1.FirebaseError(`Could not find configurations in firebase.json for the following database targets: ${unmatched.join(", ")}`, { exit: 1 });
|
|
79
138
|
}
|
|
80
139
|
return results;
|
|
81
140
|
}
|
|
@@ -23,42 +23,45 @@ const WEBPACK_LAYERS_NAMES = {
|
|
|
23
23
|
reactServerComponents: "rsc",
|
|
24
24
|
serverSideRendering: "ssr",
|
|
25
25
|
actionBrowser: "action-browser",
|
|
26
|
-
|
|
27
|
-
apiEdge: "api-edge",
|
|
26
|
+
api: "api",
|
|
28
27
|
middleware: "middleware",
|
|
29
|
-
instrument: "instrument",
|
|
30
28
|
edgeAsset: "edge-asset",
|
|
31
29
|
appPagesBrowser: "app-pages-browser",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pagesDirNode: "pages-dir-node",
|
|
30
|
+
appMetadataRoute: "app-metadata-route",
|
|
31
|
+
appRouteHandler: "app-route-handler",
|
|
35
32
|
};
|
|
36
33
|
exports.WEBPACK_LAYERS = {
|
|
37
34
|
...WEBPACK_LAYERS_NAMES,
|
|
35
|
+
pagesDirBrowser: "pages-dir-browser",
|
|
36
|
+
pagesDirEdge: "pages-dir-edge",
|
|
37
|
+
pagesDirNode: "pages-dir-node",
|
|
38
|
+
apiNode: "api-node",
|
|
39
|
+
apiEdge: "api-edge",
|
|
40
|
+
instrument: "instrument",
|
|
38
41
|
GROUP: {
|
|
39
42
|
builtinReact: [WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser],
|
|
40
43
|
serverOnly: [
|
|
44
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
41
45
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
42
46
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
43
|
-
|
|
44
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
47
|
+
"instrument",
|
|
45
48
|
],
|
|
46
|
-
neutralTarget: [
|
|
49
|
+
neutralTarget: ["api-node", "api-edge"],
|
|
47
50
|
clientOnly: [WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser],
|
|
48
51
|
bundled: [
|
|
52
|
+
WEBPACK_LAYERS_NAMES.shared,
|
|
53
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
49
54
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
50
|
-
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
51
55
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
56
|
+
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
57
|
+
"instrument",
|
|
52
58
|
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
53
|
-
WEBPACK_LAYERS_NAMES.shared,
|
|
54
|
-
WEBPACK_LAYERS_NAMES.instrument,
|
|
55
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
56
59
|
],
|
|
57
60
|
appPages: [
|
|
58
61
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
59
62
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
60
|
-
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
61
63
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
64
|
+
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
62
65
|
],
|
|
63
66
|
},
|
|
64
67
|
};
|
|
@@ -290,11 +290,11 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
290
290
|
{
|
|
291
291
|
srcRoute: null,
|
|
292
292
|
initialRevalidateSeconds: false,
|
|
293
|
-
initialExpireSeconds: undefined,
|
|
294
293
|
dataRoute: "",
|
|
295
294
|
experimentalPPR: false,
|
|
296
|
-
renderingMode: undefined,
|
|
297
295
|
prefetchDataRoute: "",
|
|
296
|
+
initialExpireSeconds: undefined,
|
|
297
|
+
renderingMode: undefined,
|
|
298
298
|
allowHeader: [],
|
|
299
299
|
},
|
|
300
300
|
];
|
|
@@ -193,26 +193,24 @@ async function getProductionDependencyNames(sourceDir) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
function getMiddlewareMatcherRegexes(middlewareManifest, functionsConfigManifest) {
|
|
196
|
-
const middlewareObjectValues = Object.values(middlewareManifest.middleware);
|
|
197
196
|
const middlewareMatchers = [];
|
|
198
197
|
if (middlewareManifest.version === 1) {
|
|
199
|
-
|
|
198
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
199
|
+
middlewareMatchers.push(...values.map((page) => ({
|
|
200
200
|
regexp: page.regexp,
|
|
201
201
|
})));
|
|
202
202
|
}
|
|
203
203
|
else if (middlewareManifest.version === 2) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.flat());
|
|
204
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
205
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
207
206
|
}
|
|
208
207
|
else if (middlewareManifest.version === 3) {
|
|
209
208
|
if (functionsConfigManifest?.functions?.["/_middleware"]) {
|
|
210
209
|
middlewareMatchers.push(...(functionsConfigManifest.functions["/_middleware"].matchers || []));
|
|
211
210
|
}
|
|
212
211
|
else {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
.flat());
|
|
212
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
213
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
return middlewareMatchers.map((matcher) => new RegExp(matcher.regexp));
|
package/lib/gcp/cloudbilling.js
CHANGED
|
@@ -86,10 +86,10 @@ function logBillingStatus(enabled, projectId, featureName) {
|
|
|
86
86
|
async function openBillingAccount(projectId, url, open, featureName = "Extensions") {
|
|
87
87
|
if (open) {
|
|
88
88
|
try {
|
|
89
|
-
opn(url);
|
|
89
|
+
await opn(url);
|
|
90
90
|
}
|
|
91
91
|
catch (err) {
|
|
92
|
-
logger_1.logger.debug(
|
|
92
|
+
logger_1.logger.debug(`Unable to open billing URL: ${(0, error_1.getErrStack)(err)}`);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
const target = featureName === "Extensions" ? "your extension" : featureName.toLowerCase();
|