firebase-tools 14.19.0 → 14.20.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/appUtils.js +4 -4
- package/lib/apphosting/localbuilds.js +23 -0
- package/lib/command.js +1 -0
- package/lib/commands/apps-init.js +7 -7
- package/lib/commands/dataconnect-execute.js +229 -0
- package/lib/commands/firestore-backups-delete.js +1 -6
- package/lib/commands/firestore-backups-get.js +2 -8
- package/lib/commands/firestore-backups-list.js +4 -10
- package/lib/commands/firestore-backups-schedules-create.js +1 -6
- package/lib/commands/firestore-backups-schedules-delete.js +1 -6
- package/lib/commands/firestore-backups-schedules-list.js +1 -7
- package/lib/commands/firestore-backups-schedules-update.js +1 -6
- package/lib/commands/firestore-bulkdelete.js +7 -13
- package/lib/commands/firestore-databases-create.js +5 -10
- package/lib/commands/firestore-databases-delete.js +1 -6
- package/lib/commands/firestore-databases-get.js +1 -7
- package/lib/commands/firestore-databases-list.js +1 -7
- package/lib/commands/firestore-databases-restore.js +5 -10
- package/lib/commands/firestore-databases-update.js +1 -6
- package/lib/commands/firestore-locations.js +1 -7
- package/lib/commands/firestore-operations-cancel.js +3 -9
- package/lib/commands/firestore-operations-describe.js +2 -8
- package/lib/commands/firestore-operations-list.js +2 -8
- package/lib/commands/index.js +1 -0
- package/lib/dataconnect/build.js +16 -2
- package/lib/dataconnect/load.js +21 -1
- package/lib/dataconnect/names.js +6 -1
- package/lib/dataconnect/provisionCloudSql.js +38 -11
- package/lib/dataconnect/schemaMigration.js +16 -3
- package/lib/dataconnect/types.js +1 -10
- package/lib/deploy/apphosting/deploy.js +18 -5
- package/lib/deploy/apphosting/prepare.js +23 -1
- package/lib/deploy/apphosting/release.js +5 -0
- package/lib/deploy/apphosting/util.js +4 -3
- package/lib/deploy/dataconnect/context.js +26 -0
- package/lib/deploy/dataconnect/deploy.js +13 -4
- package/lib/deploy/dataconnect/prepare.js +11 -8
- package/lib/deploy/dataconnect/release.js +10 -2
- package/lib/deploy/index.js +39 -20
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/gcp/cloudsql/cloudsqladmin.js +4 -3
- package/lib/init/features/dataconnect/index.js +22 -6
- package/lib/init/features/dataconnect/sdk.js +40 -22
- package/lib/management/apps.js +24 -24
- package/lib/mcp/prompts/core/consult.js +2 -3
- package/lib/mcp/prompts/core/init.js +3 -4
- package/lib/mcp/resources/index.js +0 -4
- package/lib/mcp/tools/dataconnect/execute.js +0 -1
- package/lib/mcp/util/dataconnect/converter.js +5 -4
- package/lib/mcp/util/dataconnect/emulator.js +0 -1
- package/lib/responseToError.js +7 -6
- package/package.json +3 -1
- package/schema/firebase-config.json +6 -0
- package/lib/dataconnect/appFinder.js +0 -103
package/lib/responseToError.js
CHANGED
|
@@ -4,11 +4,12 @@ exports.responseToError = void 0;
|
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
6
|
function responseToError(response, body, url) {
|
|
7
|
-
|
|
7
|
+
const statusCode = (response.statusCode || response.status);
|
|
8
|
+
if (statusCode < 400) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
11
|
if (typeof body === "string") {
|
|
11
|
-
if (
|
|
12
|
+
if (statusCode === 404) {
|
|
12
13
|
body = {
|
|
13
14
|
error: {
|
|
14
15
|
message: "Not Found",
|
|
@@ -32,17 +33,17 @@ function responseToError(response, body, url) {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
if (!body.error) {
|
|
35
|
-
const errMessage =
|
|
36
|
+
const errMessage = statusCode === 404 ? "Not Found" : "Unknown Error";
|
|
36
37
|
body.error = {
|
|
37
38
|
message: errMessage,
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
let message = "HTTP Error: " +
|
|
41
|
+
let message = "HTTP Error: " + statusCode + ", " + (body.error.message || body.error);
|
|
41
42
|
if (url) {
|
|
42
43
|
message = "Request to " + url + " had " + message;
|
|
43
44
|
}
|
|
44
45
|
let exitCode;
|
|
45
|
-
if (
|
|
46
|
+
if (statusCode >= 500) {
|
|
46
47
|
exitCode = 2;
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
@@ -55,7 +56,7 @@ function responseToError(response, body, url) {
|
|
|
55
56
|
response: response,
|
|
56
57
|
},
|
|
57
58
|
exit: exitCode,
|
|
58
|
-
status:
|
|
59
|
+
status: statusCode,
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
exports.responseToError = responseToError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.20.0",
|
|
4
4
|
"description": "Command-Line Interface for Firebase",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
+
"@apphosting/build": "^0.1.6",
|
|
65
|
+
"@apphosting/common": "^0.0.8",
|
|
64
66
|
"@electric-sql/pglite": "^0.3.3",
|
|
65
67
|
"@electric-sql/pglite-tools": "^0.2.8",
|
|
66
68
|
"@google-cloud/cloud-sql-connector": "^1.3.3",
|
|
@@ -1107,6 +1107,9 @@
|
|
|
1107
1107
|
},
|
|
1108
1108
|
"type": "array"
|
|
1109
1109
|
},
|
|
1110
|
+
"localBuild": {
|
|
1111
|
+
"type": "boolean"
|
|
1112
|
+
},
|
|
1110
1113
|
"rootDir": {
|
|
1111
1114
|
"type": "string"
|
|
1112
1115
|
}
|
|
@@ -1134,6 +1137,9 @@
|
|
|
1134
1137
|
},
|
|
1135
1138
|
"type": "array"
|
|
1136
1139
|
},
|
|
1140
|
+
"localBuild": {
|
|
1141
|
+
"type": "boolean"
|
|
1142
|
+
},
|
|
1137
1143
|
"rootDir": {
|
|
1138
1144
|
"type": "string"
|
|
1139
1145
|
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFrameworksFromPackageJson = exports.WEB_FRAMEWORKS_SIGNALS = exports.WEB_FRAMEWORKS = exports.isPathInside = exports.detectApps = exports.getPlatformFromFolder = exports.appDescription = void 0;
|
|
4
|
-
const fs = require("fs-extra");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const glob_1 = require("glob");
|
|
7
|
-
const types_1 = require("./types");
|
|
8
|
-
function appDescription(a) {
|
|
9
|
-
return `${a.directory} (${a.platform.toLowerCase()})`;
|
|
10
|
-
}
|
|
11
|
-
exports.appDescription = appDescription;
|
|
12
|
-
async function getPlatformFromFolder(dirPath) {
|
|
13
|
-
const apps = await detectApps(dirPath);
|
|
14
|
-
const hasWeb = apps.some((app) => app.platform === types_1.Platform.WEB);
|
|
15
|
-
const hasAndroid = apps.some((app) => app.platform === types_1.Platform.ANDROID);
|
|
16
|
-
const hasIOS = apps.some((app) => app.platform === types_1.Platform.IOS);
|
|
17
|
-
const hasDart = apps.some((app) => app.platform === types_1.Platform.FLUTTER);
|
|
18
|
-
if (!hasWeb && !hasAndroid && !hasIOS && !hasDart) {
|
|
19
|
-
return types_1.Platform.NONE;
|
|
20
|
-
}
|
|
21
|
-
else if (hasWeb && !hasAndroid && !hasIOS && !hasDart) {
|
|
22
|
-
return types_1.Platform.WEB;
|
|
23
|
-
}
|
|
24
|
-
else if (hasAndroid && !hasWeb && !hasIOS && !hasDart) {
|
|
25
|
-
return types_1.Platform.ANDROID;
|
|
26
|
-
}
|
|
27
|
-
else if (hasIOS && !hasWeb && !hasAndroid && !hasDart) {
|
|
28
|
-
return types_1.Platform.IOS;
|
|
29
|
-
}
|
|
30
|
-
else if (hasDart && !hasWeb && !hasIOS && !hasAndroid) {
|
|
31
|
-
return types_1.Platform.FLUTTER;
|
|
32
|
-
}
|
|
33
|
-
return types_1.Platform.MULTIPLE;
|
|
34
|
-
}
|
|
35
|
-
exports.getPlatformFromFolder = getPlatformFromFolder;
|
|
36
|
-
async function detectApps(dirPath) {
|
|
37
|
-
const packageJsonFiles = await detectFiles(dirPath, "package.json");
|
|
38
|
-
const pubSpecYamlFiles = await detectFiles(dirPath, "pubspec.yaml");
|
|
39
|
-
const srcMainFolders = await detectFiles(dirPath, "src/main/");
|
|
40
|
-
const xCodeProjects = await detectFiles(dirPath, "*.xcodeproj/");
|
|
41
|
-
const webApps = await Promise.all(packageJsonFiles.map((p) => packageJsonToWebApp(dirPath, p)));
|
|
42
|
-
const flutterApps = pubSpecYamlFiles.map((f) => ({
|
|
43
|
-
platform: types_1.Platform.FLUTTER,
|
|
44
|
-
directory: path.dirname(f),
|
|
45
|
-
}));
|
|
46
|
-
const androidApps = srcMainFolders
|
|
47
|
-
.map((f) => ({
|
|
48
|
-
platform: types_1.Platform.ANDROID,
|
|
49
|
-
directory: path.dirname(path.dirname(f)),
|
|
50
|
-
}))
|
|
51
|
-
.filter((a) => !flutterApps.some((f) => isPathInside(f.directory, a.directory)));
|
|
52
|
-
const iosApps = xCodeProjects
|
|
53
|
-
.map((f) => ({
|
|
54
|
-
platform: types_1.Platform.IOS,
|
|
55
|
-
directory: path.dirname(f),
|
|
56
|
-
}))
|
|
57
|
-
.filter((a) => !flutterApps.some((f) => isPathInside(f.directory, a.directory)));
|
|
58
|
-
return [...webApps, ...flutterApps, ...androidApps, ...iosApps];
|
|
59
|
-
}
|
|
60
|
-
exports.detectApps = detectApps;
|
|
61
|
-
function isPathInside(parent, child) {
|
|
62
|
-
const relativePath = path.relative(parent, child);
|
|
63
|
-
return !relativePath.startsWith(`..`);
|
|
64
|
-
}
|
|
65
|
-
exports.isPathInside = isPathInside;
|
|
66
|
-
async function packageJsonToWebApp(dirPath, packageJsonFile) {
|
|
67
|
-
const fullPath = path.join(dirPath, packageJsonFile);
|
|
68
|
-
const packageJson = JSON.parse((await fs.readFile(fullPath)).toString());
|
|
69
|
-
return {
|
|
70
|
-
platform: types_1.Platform.WEB,
|
|
71
|
-
directory: path.dirname(packageJsonFile),
|
|
72
|
-
frameworks: getFrameworksFromPackageJson(packageJson),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
exports.WEB_FRAMEWORKS = ["react", "angular"];
|
|
76
|
-
exports.WEB_FRAMEWORKS_SIGNALS = {
|
|
77
|
-
react: ["react", "next"],
|
|
78
|
-
angular: ["@angular/core"],
|
|
79
|
-
};
|
|
80
|
-
function getFrameworksFromPackageJson(packageJson) {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
const devDependencies = Object.keys((_a = packageJson.devDependencies) !== null && _a !== void 0 ? _a : {});
|
|
83
|
-
const dependencies = Object.keys((_b = packageJson.dependencies) !== null && _b !== void 0 ? _b : {});
|
|
84
|
-
const allDeps = Array.from(new Set([...devDependencies, ...dependencies]));
|
|
85
|
-
return exports.WEB_FRAMEWORKS.filter((framework) => exports.WEB_FRAMEWORKS_SIGNALS[framework].find((dep) => allDeps.includes(dep)));
|
|
86
|
-
}
|
|
87
|
-
exports.getFrameworksFromPackageJson = getFrameworksFromPackageJson;
|
|
88
|
-
async function detectFiles(dirPath, filePattern) {
|
|
89
|
-
const options = {
|
|
90
|
-
cwd: dirPath,
|
|
91
|
-
ignore: [
|
|
92
|
-
"**/dataconnect*/**",
|
|
93
|
-
"**/node_modules/**",
|
|
94
|
-
"**/dist/**",
|
|
95
|
-
"**/build/**",
|
|
96
|
-
"**/out/**",
|
|
97
|
-
"**/.next/**",
|
|
98
|
-
"**/coverage/**",
|
|
99
|
-
],
|
|
100
|
-
absolute: false,
|
|
101
|
-
};
|
|
102
|
-
return (0, glob_1.glob)(`**/${filePattern}`, options);
|
|
103
|
-
}
|