firebase-tools-with-isolate 15.37.0 → 15.38.1
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/accountImporter.js +8 -4
- package/lib/apiv2.js +66 -11
- package/lib/appUtils.js +103 -40
- package/lib/appdistribution/client.js +5 -1
- package/lib/commands/appdistribution-distribute.js +5 -3
- package/lib/commands/crashlytics-events-get.js +1 -3
- package/lib/commands/crashlytics-events-list.js +1 -3
- package/lib/commands/crashlytics-issues-get.js +7 -3
- package/lib/commands/crashlytics-reports-get.js +103 -15
- package/lib/crashlytics/commandUtils.js +39 -6
- package/lib/crashlytics/events.js +63 -65
- package/lib/deploy/firestore/prepare.js +2 -14
- package/lib/deploy/functions/runtimes/python/index.js +3 -0
- package/lib/deploy/functions/runtimes/supported/types.js +6 -0
- 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 +24 -24
- package/lib/emulator/downloadableEmulators.js +14 -2
- package/lib/emulator/events/types.js +0 -6
- 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 +5 -0
- package/lib/extensions/extensionsHelper.js +1 -4
- package/lib/extensions/replacements.json +2 -1
- package/lib/firestore/fsConfig.js +100 -41
- package/lib/frameworks/next/index.js +1 -23
- package/lib/gcp/runv2.js +0 -27
- package/lib/gcp/secretManager.js +2 -2
- package/lib/hosting/api.js +29 -16
- package/lib/init/features/dataconnect/sdk.js +15 -5
- package/lib/management/apps.js +7 -0
- package/lib/mcp/index.js +4 -2
- 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 +3 -12
- package/lib/mcp/util/apptesting/availability.js +3 -2
- package/lib/mcp/util/crashlytics/availability.js +59 -12
- package/lib/mcp/util.js +4 -0
- package/lib/requireAuth.js +11 -7
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/schema/firebase-config.json +6 -3
- package/standalone/package.json +6 -1
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "3.4.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
57
|
+
"version": "3.4.29",
|
|
58
|
+
"expectedSize": 38102624,
|
|
59
|
+
"expectedChecksum": "24499c43b5cce5c07064af5ab87046db",
|
|
60
|
+
"expectedChecksumSHA256": "c3bcb0a6dbca1b04ef67630941691af89d8b95bf00ae69efa1f5eff9305f4fdb",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.29",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.4.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
65
|
+
"version": "3.4.29",
|
|
66
|
+
"expectedSize": 35919234,
|
|
67
|
+
"expectedChecksum": "efd8df3f1132a3fb6b4b67f9709c3368",
|
|
68
|
+
"expectedChecksumSHA256": "9a91a2b8eb958aba24f44a3c23e4a97659bb14b62070d96c17418e0b4cb308ee",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.29",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.4.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
73
|
+
"version": "3.4.29",
|
|
74
|
+
"expectedSize": 38045696,
|
|
75
|
+
"expectedChecksum": "5207920425aa2a0ddbe59c882ae4edab",
|
|
76
|
+
"expectedChecksumSHA256": "04e04b118f944ec8076f478a60a30a77c7c9b8e2b089810c2a39f0e63c3fc371",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.29",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.4.
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
81
|
+
"version": "3.4.29",
|
|
82
|
+
"expectedSize": 37007522,
|
|
83
|
+
"expectedChecksum": "7cb21f5c796ebda7e8e76d0a486d6cc0",
|
|
84
|
+
"expectedChecksumSHA256": "aa862456865a237290a7e51bc857c9139d603fe6e8a004116a4f7c400b67ac12",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.29",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -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") &&
|
|
@@ -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
|
@@ -233,6 +233,11 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
233
233
|
default: false,
|
|
234
234
|
public: false,
|
|
235
235
|
},
|
|
236
|
+
fdcsqlconnect: {
|
|
237
|
+
shortDescription: "Enable SQL Connect PostgREST and SQL migrations emulator support.",
|
|
238
|
+
default: false,
|
|
239
|
+
public: false,
|
|
240
|
+
},
|
|
236
241
|
});
|
|
237
242
|
function isValidExperiment(name) {
|
|
238
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 = "") {
|
|
@@ -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": {
|
|
@@ -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
|
}
|
|
@@ -16,7 +16,6 @@ const url_1 = require("url");
|
|
|
16
16
|
const semver_1 = require("semver");
|
|
17
17
|
const clc = require("colorette");
|
|
18
18
|
const fsutils_1 = require("../../fsutils");
|
|
19
|
-
const streamJson_1 = require("../../streamJson");
|
|
20
19
|
const prompt_1 = require("../../prompt");
|
|
21
20
|
const error_1 = require("../../error");
|
|
22
21
|
const utils_1 = require("../utils");
|
|
@@ -395,28 +394,7 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
395
394
|
if (!esbuild) {
|
|
396
395
|
throw new error_1.FirebaseError(`Failed to load esbuild from path: ${esbuildPath}`);
|
|
397
396
|
}
|
|
398
|
-
const
|
|
399
|
-
const productionDeps = await new Promise((resolve) => {
|
|
400
|
-
const dependencies = [];
|
|
401
|
-
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
402
|
-
cwd: sourceDir,
|
|
403
|
-
timeout: constants_1.NPM_COMMAND_TIMEOUT_MILLIES,
|
|
404
|
-
});
|
|
405
|
-
const pipeline = chain([
|
|
406
|
-
npmLs.stdout,
|
|
407
|
-
parser({ packValues: false, packKeys: true, streamValues: false }),
|
|
408
|
-
pick({ filter: "dependencies" }),
|
|
409
|
-
streamObject(),
|
|
410
|
-
({ key, value }) => [
|
|
411
|
-
key,
|
|
412
|
-
...(0, utils_2.allDependencyNames)(value),
|
|
413
|
-
],
|
|
414
|
-
]);
|
|
415
|
-
pipeline.on("data", (it) => dependencies.push(it));
|
|
416
|
-
pipeline.on("end", () => {
|
|
417
|
-
resolve([...new Set(dependencies)]);
|
|
418
|
-
});
|
|
419
|
-
});
|
|
397
|
+
const productionDeps = await (0, utils_2.getProductionDependencyNames)(sourceDir);
|
|
420
398
|
const esbuildArgs = {
|
|
421
399
|
entryPoints: [(0, path_1.join)(sourceDir, configFile)],
|
|
422
400
|
outfile: (0, path_1.join)(destDir, configFile),
|
package/lib/gcp/runv2.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FIREBASE_FUNCTION_METADTA_ANNOTATION = exports.FUNCTION_SIGNATURE_TYPE_ENV = exports.FUNCTION_TARGET_ENV = exports.FUNCTION_ID_ANNOTATION = exports.FUNCTION_TARGET_ANNOTATION = exports.TRIGGER_TYPE_ANNOTATION = exports.CLIENT_NAME_LABEL = exports.RUNTIME_LABEL = exports.API_VERSION = void 0;
|
|
4
|
-
exports.submitBuild = submitBuild;
|
|
5
4
|
exports.updateService = updateService;
|
|
6
5
|
exports.createService = createService;
|
|
7
6
|
exports.deleteService = deleteService;
|
|
@@ -28,32 +27,6 @@ const client = new apiv2_1.Client({
|
|
|
28
27
|
apiVersion: exports.API_VERSION,
|
|
29
28
|
});
|
|
30
29
|
(0, metaprogramming_1.assertImplements)();
|
|
31
|
-
const PENDING_BUILD_STATUSES = ["STATUS_UNKNOWN", "PENDING", "QUEUED", "WORKING"];
|
|
32
|
-
async function submitBuild(projectId, location, build) {
|
|
33
|
-
const res = await client.post(`/projects/${projectId}/locations/${location}/builds:submit`, build);
|
|
34
|
-
if (res.body?.baseImageWarning) {
|
|
35
|
-
logger_1.logger.warn(res.body.baseImageWarning);
|
|
36
|
-
}
|
|
37
|
-
const cloudBuild = res.body?.buildOperation?.metadata?.build;
|
|
38
|
-
if (!cloudBuild) {
|
|
39
|
-
throw new error_1.FirebaseError("Failed to submit build: no build was returned.");
|
|
40
|
-
}
|
|
41
|
-
let status;
|
|
42
|
-
await (0, operation_poller_1.pollOperation)({
|
|
43
|
-
apiOrigin: (0, api_1.cloudbuildOrigin)(),
|
|
44
|
-
apiVersion: "v1",
|
|
45
|
-
operationResourceName: cloudBuild.name,
|
|
46
|
-
masterTimeout: 30 * 60 * 1000,
|
|
47
|
-
maxBackoff: 10000,
|
|
48
|
-
doneFn: (b) => {
|
|
49
|
-
status = b?.status;
|
|
50
|
-
return !b?.status || !PENDING_BUILD_STATUSES.includes(b.status);
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
if (status !== "SUCCESS") {
|
|
54
|
-
throw new error_1.FirebaseError(`Cloud Build failed with status ${status ?? "UNKNOWN"}. View the build logs at ${cloudBuild.logUrl ?? ""}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
30
|
async function updateService(service, opts = {}) {
|
|
58
31
|
let updateMask = opts.updateMask;
|
|
59
32
|
if (!updateMask) {
|
package/lib/gcp/secretManager.js
CHANGED
|
@@ -116,7 +116,7 @@ async function getSecretVersion(projectId, name, version) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
async function accessSecretVersion(projectId, name, version) {
|
|
119
|
-
const res = await client.get(`projects/${projectId}/secrets/${name}/versions/${version}:access
|
|
119
|
+
const res = await client.get(`projects/${projectId}/secrets/${name}/versions/${version}:access`, { skipLog: { resBody: true } });
|
|
120
120
|
return Buffer.from(res.body.payload.data, "base64").toString();
|
|
121
121
|
}
|
|
122
122
|
async function destroySecretVersion(projectId, name, version) {
|
|
@@ -214,7 +214,7 @@ async function addVersion(projectId, name, payloadData) {
|
|
|
214
214
|
payload: {
|
|
215
215
|
data: Buffer.from(payloadData).toString("base64"),
|
|
216
216
|
},
|
|
217
|
-
});
|
|
217
|
+
}, { skipLog: { body: true } });
|
|
218
218
|
return {
|
|
219
219
|
...parseSecretVersionResourceName(res.body.name),
|
|
220
220
|
state: res.body.state,
|
package/lib/hosting/api.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.addAuthDomains = addAuthDomains;
|
|
|
21
21
|
exports.removeAuthDomain = removeAuthDomain;
|
|
22
22
|
exports.getCleanDomains = getCleanDomains;
|
|
23
23
|
exports.cleanAuthState = cleanAuthState;
|
|
24
|
-
exports.
|
|
24
|
+
exports.listCustomDomains = listCustomDomains;
|
|
25
25
|
exports.getAllSiteDomains = getAllSiteDomains;
|
|
26
26
|
exports.getDeploymentDomain = getDeploymentDomain;
|
|
27
27
|
exports.resetEnsureApiEnabledCacheForTests = resetEnsureApiEnabledCacheForTests;
|
|
@@ -266,28 +266,41 @@ async function cleanAuthState(project, sites) {
|
|
|
266
266
|
}
|
|
267
267
|
return siteDomainMap;
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
throw new error_1.FirebaseError(`could not find site "${site}" for project "${project}"`, {
|
|
277
|
-
original: e,
|
|
278
|
-
});
|
|
269
|
+
async function listCustomDomains(project, site) {
|
|
270
|
+
const customDomains = [];
|
|
271
|
+
let pageToken;
|
|
272
|
+
do {
|
|
273
|
+
const queryParams = {};
|
|
274
|
+
if (pageToken) {
|
|
275
|
+
queryParams.pageToken = pageToken;
|
|
279
276
|
}
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
try {
|
|
278
|
+
const res = await apiClient.get(`/projects/${project}/sites/${site}/customDomains`, { queryParams });
|
|
279
|
+
customDomains.push(...(res.body.customDomains ?? []));
|
|
280
|
+
pageToken = res.body.nextPageToken;
|
|
281
|
+
}
|
|
282
|
+
catch (e) {
|
|
283
|
+
if (e instanceof error_1.FirebaseError && e.status === 404) {
|
|
284
|
+
throw new error_1.FirebaseError(`could not find site "${site}" for project "${project}"`, {
|
|
285
|
+
original: e,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
throw e;
|
|
289
|
+
}
|
|
290
|
+
} while (pageToken);
|
|
291
|
+
return customDomains;
|
|
282
292
|
}
|
|
283
293
|
async function getAllSiteDomains(projectId, siteId) {
|
|
284
|
-
const [
|
|
285
|
-
|
|
294
|
+
const [customDomains, defaultDomain] = await Promise.all([
|
|
295
|
+
listCustomDomains(projectId, siteId),
|
|
286
296
|
getSite(projectId, siteId),
|
|
287
297
|
]);
|
|
288
298
|
const defaultDomainWithoutHttp = defaultDomain.defaultUrl.replace(/^https?:\/\//, "");
|
|
299
|
+
const customDomainNames = customDomains
|
|
300
|
+
.map(({ name }) => name?.split("/").pop())
|
|
301
|
+
.filter((domain) => Boolean(domain));
|
|
289
302
|
const allSiteDomains = new Set([
|
|
290
|
-
...
|
|
303
|
+
...customDomainNames,
|
|
291
304
|
defaultDomainWithoutHttp,
|
|
292
305
|
`${siteId}.web.app`,
|
|
293
306
|
`${siteId}.firebaseapp.com`,
|
|
@@ -26,6 +26,13 @@ const cloudbilling_1 = require("../../../gcp/cloudbilling");
|
|
|
26
26
|
exports.FDC_APP_FOLDER = "FDC_APP_FOLDER";
|
|
27
27
|
exports.FDC_SDK_FRAMEWORKS_ENV = "FDC_SDK_FRAMEWORKS";
|
|
28
28
|
exports.FDC_SDK_PLATFORM_ENV = "FDC_SDK_PLATFORM";
|
|
29
|
+
const SUPPORTED_SQL_CONNECT_PLATFORMS = [
|
|
30
|
+
appUtils_1.Platform.ANDROID,
|
|
31
|
+
appUtils_1.Platform.IOS,
|
|
32
|
+
appUtils_1.Platform.WEB,
|
|
33
|
+
appUtils_1.Platform.FLUTTER,
|
|
34
|
+
appUtils_1.Platform.ADMIN_NODE,
|
|
35
|
+
];
|
|
29
36
|
async function askQuestions(setup, config, options) {
|
|
30
37
|
const info = {
|
|
31
38
|
apps: [],
|
|
@@ -187,12 +194,12 @@ function initAppCounters(info) {
|
|
|
187
194
|
async function actuateWithInfo(setup, config, info) {
|
|
188
195
|
if (!info.apps.length) {
|
|
189
196
|
info.apps = await (0, appUtils_1.detectApps)(cwd);
|
|
190
|
-
if (!info.apps.length) {
|
|
191
|
-
(0, utils_1.logLabeledBullet)("dataconnect", "No apps to setup SQL Connect Generated SDKs");
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
197
|
}
|
|
195
198
|
const apps = dedupeAppsByPlatformAndDirectory(info.apps);
|
|
199
|
+
if (!apps.length) {
|
|
200
|
+
(0, utils_1.logLabeledBullet)("dataconnect", "No apps to setup SQL Connect Generated SDKs");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
196
203
|
const connectorInfo = await chooseExistingConnector(setup, config);
|
|
197
204
|
const connectorYaml = JSON.parse(JSON.stringify(connectorInfo.connectorYaml));
|
|
198
205
|
for (const app of apps) {
|
|
@@ -351,12 +358,15 @@ function addSdkGenerateToConnectorYaml(connectorInfo, connectorYaml, app) {
|
|
|
351
358
|
break;
|
|
352
359
|
}
|
|
353
360
|
default:
|
|
354
|
-
throw new error_1.FirebaseError(`Unsupported platform ${app.platform} for SQL Connect SDK generation. Supported platforms are: ${
|
|
361
|
+
throw new error_1.FirebaseError(`Unsupported platform ${app.platform} for SQL Connect SDK generation. Supported platforms are: ${SUPPORTED_SQL_CONNECT_PLATFORMS.join(", ")}\n${JSON.stringify(app)}`);
|
|
355
362
|
}
|
|
356
363
|
}
|
|
357
364
|
function dedupeAppsByPlatformAndDirectory(apps) {
|
|
358
365
|
const uniqueApps = new Map();
|
|
359
366
|
for (const app of apps) {
|
|
367
|
+
if (!SUPPORTED_SQL_CONNECT_PLATFORMS.includes(app.platform)) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
360
370
|
const frameworkKey = app.frameworks ? [...app.frameworks].sort().join(",") : "";
|
|
361
371
|
const key = `${app.platform}:${app.directory}:${frameworkKey}`;
|
|
362
372
|
if (!uniqueApps.has(key)) {
|
package/lib/management/apps.js
CHANGED
|
@@ -75,6 +75,13 @@ async function getPlatform(appDir, config) {
|
|
|
75
75
|
throw new error_1.FirebaseError(`Flutter is not supported by apps:configure.
|
|
76
76
|
Please follow the link below to set up firebase for your Flutter app:
|
|
77
77
|
https://firebase.google.com/docs/flutter/setup
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
else if (targetPlatform === appUtils_1.Platform.UNITY) {
|
|
81
|
+
(0, utils_1.logWarning)(`Detected ${targetPlatform} app in directory ${appDir}`);
|
|
82
|
+
throw new error_1.FirebaseError(`Unity is not supported by apps:configure.
|
|
83
|
+
Please follow the link below to set up firebase for your Unity app:
|
|
84
|
+
https://firebase.google.com/docs/unity/setup
|
|
78
85
|
`);
|
|
79
86
|
}
|
|
80
87
|
else {
|
package/lib/mcp/index.js
CHANGED
|
@@ -254,7 +254,8 @@ class FirebaseMcpServer {
|
|
|
254
254
|
return this.cliCommand;
|
|
255
255
|
}
|
|
256
256
|
async mcpListTools() {
|
|
257
|
-
await
|
|
257
|
+
await this.detectProjectRoot();
|
|
258
|
+
await this.detectActiveFeatures();
|
|
258
259
|
const hasActiveProject = !!(await this.getProjectId());
|
|
259
260
|
await this.trackGA4("mcp_list_tools");
|
|
260
261
|
const skipAutoAuthForStudio = (0, env_1.isFirebaseStudio)();
|
|
@@ -325,7 +326,8 @@ class FirebaseMcpServer {
|
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
async mcpListPrompts() {
|
|
328
|
-
await
|
|
329
|
+
await this.detectProjectRoot();
|
|
330
|
+
await this.detectActiveFeatures();
|
|
329
331
|
const hasActiveProject = !!(await this.getProjectId());
|
|
330
332
|
await this.trackGA4("mcp_list_prompts");
|
|
331
333
|
const skipAutoAuthForStudio = (0, env_1.isFirebaseStudio)();
|
|
@@ -70,7 +70,7 @@ exports.get_environment = (0, tool_1.tool)("core", {
|
|
|
70
70
|
const aliases = projectId ? (0, projectUtils_1.getAliases)({ rc }, projectId) : [];
|
|
71
71
|
const geminiTosAccepted = !!configstore_1.configstore.get("gemini");
|
|
72
72
|
const projectFileExists = config.projectFileExists("firebase.json");
|
|
73
|
-
const detectedApps = await (0, appUtils_1.detectApps)(process.cwd());
|
|
73
|
+
const detectedApps = await (0, appUtils_1.detectApps)(host.cachedProjectDir || process.cwd());
|
|
74
74
|
const allAccounts = (0, auth_1.getAllAccounts)().map((account) => account.user.email);
|
|
75
75
|
const detectedAppsMap = {};
|
|
76
76
|
detectedApps
|