firebase-tools 15.17.0 → 15.19.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 +13 -6
- package/lib/accountImporter.js +18 -1
- package/lib/apphosting/constants.js +2 -1
- package/lib/apphosting/localbuilds.js +105 -37
- package/lib/apphosting/universalMakerDownload.js +72 -0
- package/lib/apphosting/universalMakerInfo.json +16 -0
- package/lib/archiveDirectory.js +1 -1
- package/lib/commands/dataconnect-sql-shell.js +21 -3
- package/lib/deploy/apphosting/deploy.js +39 -23
- package/lib/deploy/apphosting/prepare.js +28 -6
- package/lib/deploy/apphosting/release.js +26 -12
- package/lib/deploy/apphosting/util.js +35 -37
- package/lib/deploy/functions/backend.js +2 -1
- package/lib/deploy/functions/prepare.js +50 -57
- package/lib/deploy/functions/prepareFunctionsUpload.js +1 -1
- package/lib/deploy/functions/services/ailogic.js +14 -6
- package/lib/deploy/functions/validate.js +1 -1
- package/lib/downloadUtils.js +24 -0
- package/lib/emulator/download.js +2 -24
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/fsAsync.js +53 -10
- package/lib/gcp/cloudsql/connect.js +49 -25
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +21 -6
- package/templates/init/functions/dart/_gitignore +1 -9
|
@@ -58,38 +58,62 @@ async function execute(sqlStatements, opts) {
|
|
|
58
58
|
: cloud_sql_connector_1.IpAddressTypes.PRIVATE,
|
|
59
59
|
authType: authType,
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
password: opts.password,
|
|
64
|
-
user: opts.username,
|
|
65
|
-
database: opts.databaseId,
|
|
66
|
-
});
|
|
67
|
-
const cleanUpFn = async () => {
|
|
68
|
-
conn.release();
|
|
69
|
-
await pool.end();
|
|
70
|
-
connector.close();
|
|
71
|
-
};
|
|
72
|
-
const conn = await pool.connect();
|
|
61
|
+
let pool;
|
|
62
|
+
let conn;
|
|
73
63
|
const results = [];
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
try {
|
|
65
|
+
pool = new pg.Pool({
|
|
66
|
+
...(await connector.getOptions(connectionOpts)),
|
|
67
|
+
password: opts.password,
|
|
68
|
+
user: opts.username,
|
|
69
|
+
database: opts.databaseId,
|
|
70
|
+
});
|
|
71
|
+
pool.on("error", (err) => {
|
|
72
|
+
logger_1.logger.debug("[cloudsql] pool error (ignored during teardown):", err);
|
|
73
|
+
});
|
|
74
|
+
conn = await pool.connect();
|
|
75
|
+
logFn(`Logged in as ${opts.username}`);
|
|
76
|
+
if (opts.transaction) {
|
|
77
|
+
sqlStatements.unshift("BEGIN;");
|
|
78
|
+
sqlStatements.push("COMMIT;");
|
|
79
|
+
}
|
|
80
|
+
for (const s of sqlStatements) {
|
|
81
|
+
logFn(`> ${s}`);
|
|
82
|
+
try {
|
|
83
|
+
results.push(await conn.query(s));
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
logFn(`Rolling back transaction due to error ${err}}`);
|
|
87
|
+
await conn.query("ROLLBACK;");
|
|
88
|
+
throw new error_1.FirebaseError(`Error executing SQL statement: ${s}: ${err}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
logFn(``);
|
|
78
92
|
}
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
finally {
|
|
94
|
+
if (conn) {
|
|
95
|
+
try {
|
|
96
|
+
conn.release();
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
logger_1.logger.debug("[cloudsql] error releasing connection during cleanup:", err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (pool) {
|
|
103
|
+
try {
|
|
104
|
+
await pool.end();
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
logger_1.logger.debug("[cloudsql] error ending pool during cleanup:", err);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
81
110
|
try {
|
|
82
|
-
|
|
111
|
+
connector.close();
|
|
83
112
|
}
|
|
84
113
|
catch (err) {
|
|
85
|
-
|
|
86
|
-
await conn.query("ROLLBACK;");
|
|
87
|
-
await cleanUpFn();
|
|
88
|
-
throw new error_1.FirebaseError(`Error executing ${err}`);
|
|
114
|
+
logger_1.logger.debug("[cloudsql] error closing connector during cleanup:", err);
|
|
89
115
|
}
|
|
90
116
|
}
|
|
91
|
-
await cleanUpFn();
|
|
92
|
-
logFn(``);
|
|
93
117
|
return results;
|
|
94
118
|
}
|
|
95
119
|
async function executeSqlCmdsAsIamUser(options, instanceId, databaseId, cmds, silent = false, transaction = false) {
|