firebase-tools 15.3.1 → 15.4.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/apiv2.js +7 -2
- package/lib/apphosting/rollout.js +1 -1
- package/lib/commands/dataconnect-execute.js +14 -12
- package/lib/dataconnect/types.js +8 -1
- package/lib/emulator/dataconnectEmulator.js +0 -1
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/env.js +18 -0
- package/lib/track.js +1 -16
- package/package.json +1 -1
package/lib/apiv2.js
CHANGED
|
@@ -13,15 +13,20 @@ const node_fetch_1 = require("node-fetch");
|
|
|
13
13
|
const util_1 = require("util");
|
|
14
14
|
const auth = require("./auth");
|
|
15
15
|
const error_1 = require("./error");
|
|
16
|
+
const env_1 = require("./env");
|
|
16
17
|
const logger_1 = require("./logger");
|
|
17
18
|
const responseToError_1 = require("./responseToError");
|
|
18
19
|
const FormData = require("form-data");
|
|
19
20
|
const pkg = require("../package.json");
|
|
20
21
|
const CLI_VERSION = pkg.version;
|
|
22
|
+
const agent = (0, env_1.detectAIAgent)();
|
|
23
|
+
const agentStr = agent === "unknown" ? "" : ` agent-name/${agent}`;
|
|
24
|
+
const platform = (0, env_1.isFirebaseMcp)() ? "FirebaseMCP" : "FirebaseCLI";
|
|
25
|
+
const clientVersion = `${platform}/${CLI_VERSION}${agentStr}`;
|
|
21
26
|
exports.STANDARD_HEADERS = {
|
|
22
27
|
Connection: "keep-alive",
|
|
23
|
-
"User-Agent":
|
|
24
|
-
"X-Client-Version":
|
|
28
|
+
"User-Agent": clientVersion,
|
|
29
|
+
"X-Client-Version": clientVersion,
|
|
25
30
|
};
|
|
26
31
|
const GOOG_QUOTA_USER_HEADER = "x-goog-quota-user";
|
|
27
32
|
const GOOG_USER_PROJECT_HEADER = "x-goog-user-project";
|
|
@@ -125,7 +125,7 @@ async function orchestrateRollout(args) {
|
|
|
125
125
|
throw new error_1.FirebaseError("Failed to build your app, but failed to get build logs as well. " +
|
|
126
126
|
"This is an internal error and should be reported");
|
|
127
127
|
}
|
|
128
|
-
throw new error_1.FirebaseError(`Failed to build your app. Please inspect the build logs at ${build.buildLogsUri}
|
|
128
|
+
throw new error_1.FirebaseError(`Failed to build your app. Please inspect the build logs at ${build.buildLogsUri}`, { children: [build.error] });
|
|
129
129
|
}
|
|
130
130
|
return { rollout, build };
|
|
131
131
|
}
|
|
@@ -106,13 +106,15 @@ exports.command = new command_1.Command("dataconnect:execute [file] [operationNa
|
|
|
106
106
|
operationName,
|
|
107
107
|
variables: parseJsonObject(unparsedVars, "--variables"),
|
|
108
108
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const body = response.body;
|
|
110
|
+
let err = (0, responseToError_1.responseToError)(response, body);
|
|
111
|
+
if ((0, types_1.isGraphQLResponseError)(body)) {
|
|
112
|
+
const status = body.status || body.error?.status;
|
|
113
|
+
const message = body.message || body.error?.message || "unknown error";
|
|
112
114
|
if (!err) {
|
|
113
115
|
err = new error_1.FirebaseError(message, {
|
|
114
116
|
context: {
|
|
115
|
-
body:
|
|
117
|
+
body: body,
|
|
116
118
|
response: response,
|
|
117
119
|
},
|
|
118
120
|
status: response.status,
|
|
@@ -125,35 +127,35 @@ exports.command = new command_1.Command("dataconnect:execute [file] [operationNa
|
|
|
125
127
|
if (err) {
|
|
126
128
|
throw err;
|
|
127
129
|
}
|
|
128
|
-
if (!(0, types_1.isGraphQLResponse)(
|
|
130
|
+
if (!(0, types_1.isGraphQLResponse)(body)) {
|
|
129
131
|
throw new error_1.FirebaseError("Got invalid response body with neither .data or .errors", {
|
|
130
132
|
context: {
|
|
131
|
-
body:
|
|
133
|
+
body: body,
|
|
132
134
|
response: response,
|
|
133
135
|
},
|
|
134
136
|
status: response.status,
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
|
-
logger_1.logger.info(JSON.stringify(
|
|
138
|
-
if (!
|
|
139
|
+
logger_1.logger.info(JSON.stringify(body, null, 2));
|
|
140
|
+
if (!body.data) {
|
|
139
141
|
throw new error_1.FirebaseError("GraphQL request error(s). See response body (above) for details.", {
|
|
140
142
|
context: {
|
|
141
|
-
body:
|
|
143
|
+
body: body,
|
|
142
144
|
response: response,
|
|
143
145
|
},
|
|
144
146
|
status: response.status,
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
|
-
if (
|
|
149
|
+
if (body.errors && body.errors.length > 0) {
|
|
148
150
|
throw new error_1.FirebaseError("Execution completed with error(s). See response body (above) for details.", {
|
|
149
151
|
context: {
|
|
150
|
-
body:
|
|
152
|
+
body: body,
|
|
151
153
|
response: response,
|
|
152
154
|
},
|
|
153
155
|
status: response.status,
|
|
154
156
|
});
|
|
155
157
|
}
|
|
156
|
-
return
|
|
158
|
+
return body;
|
|
157
159
|
async function readQueryFromDir(dir) {
|
|
158
160
|
const opDisplay = operationName ? clc.bold(operationName) : "operation";
|
|
159
161
|
process.stderr.write(`${clc.cyan(`Executing ${opDisplay} in ${clc.bold(dir)}`)}${node_os_1.EOL}`);
|
package/lib/dataconnect/types.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.isGraphQLResponseError = exports.isGraphQLResponse = exports.MAIN_SCHEMA
|
|
|
4
4
|
exports.requiresVector = requiresVector;
|
|
5
5
|
exports.toDatasource = toDatasource;
|
|
6
6
|
exports.mainSchemaYaml = mainSchemaYaml;
|
|
7
|
+
exports.secondarySchemaYamls = secondarySchemaYamls;
|
|
7
8
|
exports.mainSchema = mainSchema;
|
|
8
9
|
exports.isMainSchema = isMainSchema;
|
|
9
10
|
exports.MAIN_SCHEMA_ID = "main";
|
|
@@ -42,6 +43,12 @@ function mainSchemaYaml(dataconnectYaml) {
|
|
|
42
43
|
}
|
|
43
44
|
return mainSch;
|
|
44
45
|
}
|
|
46
|
+
function secondarySchemaYamls(dataconnectYaml) {
|
|
47
|
+
if (dataconnectYaml.schema) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return (dataconnectYaml.schemas || []).filter((s) => s.id && s.id !== exports.MAIN_SCHEMA_ID);
|
|
51
|
+
}
|
|
45
52
|
function mainSchema(schemas) {
|
|
46
53
|
const mainSch = schemas.find((s) => isMainSchema(s));
|
|
47
54
|
if (!mainSch) {
|
|
@@ -54,5 +61,5 @@ function isMainSchema(schema) {
|
|
|
54
61
|
}
|
|
55
62
|
const isGraphQLResponse = (g) => !!g.data || !!g.errors;
|
|
56
63
|
exports.isGraphQLResponse = isGraphQLResponse;
|
|
57
|
-
const isGraphQLResponseError = (g) => !!g.error;
|
|
64
|
+
const isGraphQLResponseError = (g) => !!g.error?.message || !!g.message;
|
|
58
65
|
exports.isGraphQLResponseError = isGraphQLResponseError;
|
|
@@ -231,7 +231,6 @@ class DataConnectEmulator {
|
|
|
231
231
|
connectionString: connectionString.toString(),
|
|
232
232
|
database,
|
|
233
233
|
serviceId,
|
|
234
|
-
maxOpenConnections: 1,
|
|
235
234
|
});
|
|
236
235
|
this.logger.logLabeled("DEBUG", "Data Connect", `Successfully connected to ${connectionString}}`);
|
|
237
236
|
return true;
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "3.0
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.0
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.0
|
|
57
|
+
"version": "3.1.0",
|
|
58
|
+
"expectedSize": 30315360,
|
|
59
|
+
"expectedChecksum": "f9bffb5f86bcff271d75e79a8439cb8d",
|
|
60
|
+
"expectedChecksumSHA256": "a9dac9a7dc90063d12ba5201d6e21cd7e62e68f1f10a537a9b302a21d9ffdef6",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.1.0",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.1.0"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.0
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.0
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.0
|
|
65
|
+
"version": "3.1.0",
|
|
66
|
+
"expectedSize": 29796738,
|
|
67
|
+
"expectedChecksum": "668bb418e970aa90874afa3ac4e84d48",
|
|
68
|
+
"expectedChecksumSHA256": "ab94429f31f9354ead44ff3b3e0cc548b06244da0feb1f2c971a8f9c33519623",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.1.0",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.1.0"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.0
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.0
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.0.
|
|
73
|
+
"version": "3.1.0",
|
|
74
|
+
"expectedSize": 30815744,
|
|
75
|
+
"expectedChecksum": "179244e68571a7fdc97a15921eeffa16",
|
|
76
|
+
"expectedChecksumSHA256": "c8b1dbf4c21046c09ed065952523a72678644423afc99b6ea4d0f559735b3437",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.1.0",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.1.0.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.0
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.0
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.0
|
|
81
|
+
"version": "3.1.0",
|
|
82
|
+
"expectedSize": 30236856,
|
|
83
|
+
"expectedChecksum": "4314f5cb06307974bce9d0da1d4034fb",
|
|
84
|
+
"expectedChecksumSHA256": "6ced51471ba1dae0e0bd12263f558ce371901393ebbbb4ba8d2c298866600218",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.1.0",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.1.0"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
package/lib/env.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFirebaseStudio = isFirebaseStudio;
|
|
4
4
|
exports.isFirebaseMcp = isFirebaseMcp;
|
|
5
|
+
exports.detectAIAgent = detectAIAgent;
|
|
5
6
|
const fsutils_1 = require("./fsutils");
|
|
6
7
|
let googleIdxFolderExists;
|
|
7
8
|
function isFirebaseStudio() {
|
|
@@ -15,3 +16,20 @@ function isFirebaseStudio() {
|
|
|
15
16
|
function isFirebaseMcp() {
|
|
16
17
|
return !!process.env.IS_FIREBASE_MCP;
|
|
17
18
|
}
|
|
19
|
+
function detectAIAgent() {
|
|
20
|
+
if (process.env.ANTIGRAVITY_CLI_ALIAS)
|
|
21
|
+
return "antigravity";
|
|
22
|
+
if (process.env.CLAUDECODE)
|
|
23
|
+
return "claude_code";
|
|
24
|
+
if (process.env.CLINE_ACTIVE)
|
|
25
|
+
return "cline";
|
|
26
|
+
if (process.env.CODEX_SANDBOX)
|
|
27
|
+
return "codex_cli";
|
|
28
|
+
if (process.env.CURSOR_AGENT)
|
|
29
|
+
return "cursor";
|
|
30
|
+
if (process.env.GEMINI_CLI)
|
|
31
|
+
return "gemini_cli";
|
|
32
|
+
if (process.env.OPENCODE)
|
|
33
|
+
return "open_code";
|
|
34
|
+
return "unknown";
|
|
35
|
+
}
|
package/lib/track.js
CHANGED
|
@@ -15,21 +15,6 @@ const configstore_1 = require("./configstore");
|
|
|
15
15
|
const logger_1 = require("./logger");
|
|
16
16
|
const env_1 = require("./env");
|
|
17
17
|
const pkg = require("../package.json");
|
|
18
|
-
function detectAIAgent() {
|
|
19
|
-
if (process.env.CLAUDECODE)
|
|
20
|
-
return "claude_code";
|
|
21
|
-
if (process.env.CLINE_ACTIVE)
|
|
22
|
-
return "cline";
|
|
23
|
-
if (process.env.CODEX_SANDBOX)
|
|
24
|
-
return "codex_cli";
|
|
25
|
-
if (process.env.CURSOR_AGENT)
|
|
26
|
-
return "cursor";
|
|
27
|
-
if (process.env.GEMINI_CLI)
|
|
28
|
-
return "gemini_cli";
|
|
29
|
-
if (process.env.OPENCODE)
|
|
30
|
-
return "open_code";
|
|
31
|
-
return "unknown";
|
|
32
|
-
}
|
|
33
18
|
exports.GA4_PROPERTIES = {
|
|
34
19
|
cli: {
|
|
35
20
|
measurementId: process.env.FIREBASE_CLI_GA4_MEASUREMENT_ID || "G-PDN0QWHQJR",
|
|
@@ -67,7 +52,7 @@ const GA4_USER_PROPS = {
|
|
|
67
52
|
value: (0, env_1.isFirebaseStudio)().toString(),
|
|
68
53
|
},
|
|
69
54
|
ai_agent: {
|
|
70
|
-
value: detectAIAgent(),
|
|
55
|
+
value: (0, env_1.detectAIAgent)(),
|
|
71
56
|
},
|
|
72
57
|
};
|
|
73
58
|
async function trackGA4(eventName, params, duration = 1) {
|