firebase-tools 12.4.7 → 12.5.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/bin/firebase.js +0 -0
- package/lib/deploy/functions/release/fabricator.js +8 -6
- package/lib/deploy/functions/release/sourceTokenScraper.js +9 -2
- package/lib/deploy/lifecycleHooks.js +6 -7
- package/lib/emulator/auth/apiSpec.js +712 -51
- package/lib/emulator/extensionsEmulator.js +1 -5
- package/lib/emulator/functionsEmulatorRuntime.js +5 -4
- package/lib/extensions/emulator/optionsHelper.js +4 -130
- package/lib/extensions/emulator/specHelper.js +12 -1
- package/lib/frameworks/astro/index.js +1 -5
- package/lib/frameworks/astro/utils.js +22 -4
- package/lib/frameworks/next/constants.js +2 -1
- package/lib/frameworks/next/index.js +2 -2
- package/lib/gcp/frameworks.js +8 -2
- package/lib/init/features/frameworks/index.js +52 -8
- package/lib/init/features/frameworks/repo.js +1 -1
- package/lib/utils.js +5 -1
- package/package.json +1 -1
package/lib/bin/firebase.js
CHANGED
|
File without changes
|
|
@@ -132,7 +132,7 @@ class Fabricator {
|
|
|
132
132
|
await this.createV1Function(endpoint, scraper);
|
|
133
133
|
}
|
|
134
134
|
else if (endpoint.platform === "gcfv2") {
|
|
135
|
-
await this.createV2Function(endpoint);
|
|
135
|
+
await this.createV2Function(endpoint, scraper);
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
138
|
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
@@ -150,7 +150,7 @@ class Fabricator {
|
|
|
150
150
|
await this.updateV1Function(update.endpoint, scraper);
|
|
151
151
|
}
|
|
152
152
|
else if (update.endpoint.platform === "gcfv2") {
|
|
153
|
-
await this.updateV2Function(update.endpoint);
|
|
153
|
+
await this.updateV2Function(update.endpoint, scraper);
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
156
|
(0, functional_1.assertExhaustive)(update.endpoint.platform);
|
|
@@ -221,7 +221,7 @@ class Fabricator {
|
|
|
221
221
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
async createV2Function(endpoint) {
|
|
224
|
+
async createV2Function(endpoint, scraper) {
|
|
225
225
|
var _a, _b, _c, _d, _e;
|
|
226
226
|
const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
|
|
227
227
|
if (!storageSource) {
|
|
@@ -275,8 +275,9 @@ class Fabricator {
|
|
|
275
275
|
while (!resultFunction) {
|
|
276
276
|
resultFunction = await this.functionExecutor
|
|
277
277
|
.run(async () => {
|
|
278
|
+
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
278
279
|
const op = await gcfV2.createFunction(apiFunction);
|
|
279
|
-
return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name }));
|
|
280
|
+
return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name, onPoll: scraper.poller }));
|
|
280
281
|
})
|
|
281
282
|
.catch(async (err) => {
|
|
282
283
|
if (err.code === CLOUD_RUN_RESOURCE_EXHAUSTED_CODE) {
|
|
@@ -366,7 +367,7 @@ class Fabricator {
|
|
|
366
367
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
|
-
async updateV2Function(endpoint) {
|
|
370
|
+
async updateV2Function(endpoint, scraper) {
|
|
370
371
|
var _a, _b, _c, _d;
|
|
371
372
|
const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
|
|
372
373
|
if (!storageSource) {
|
|
@@ -379,8 +380,9 @@ class Fabricator {
|
|
|
379
380
|
}
|
|
380
381
|
const resultFunction = await this.functionExecutor
|
|
381
382
|
.run(async () => {
|
|
383
|
+
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
382
384
|
const op = await gcfV2.updateFunction(apiFunction);
|
|
383
|
-
return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name }));
|
|
385
|
+
return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name, onPoll: scraper.poller }));
|
|
384
386
|
}, { retryCodes: [...executor_1.DEFAULT_RETRY_CODES, CLOUD_RUN_RESOURCE_EXHAUSTED_CODE] })
|
|
385
387
|
.catch(rethrowAs(endpoint, "update"));
|
|
386
388
|
endpoint.uri = (_c = resultFunction.serviceConfig) === null || _c === void 0 ? void 0 : _c.uri;
|
|
@@ -5,8 +5,9 @@ const error_1 = require("../../../error");
|
|
|
5
5
|
const functional_1 = require("../../../functional");
|
|
6
6
|
const logger_1 = require("../../../logger");
|
|
7
7
|
class SourceTokenScraper {
|
|
8
|
-
constructor(validDurationMs = 1500000) {
|
|
8
|
+
constructor(validDurationMs = 1500000, fetchTimeoutMs = 180000) {
|
|
9
9
|
this.tokenValidDurationMs = validDurationMs;
|
|
10
|
+
this.fetchTimeoutMs = fetchTimeoutMs;
|
|
10
11
|
this.promise = new Promise((resolve) => (this.resolve = resolve));
|
|
11
12
|
this.fetchState = "NONE";
|
|
12
13
|
}
|
|
@@ -16,7 +17,13 @@ class SourceTokenScraper {
|
|
|
16
17
|
return undefined;
|
|
17
18
|
}
|
|
18
19
|
else if (this.fetchState === "FETCHING") {
|
|
19
|
-
|
|
20
|
+
const timeout = new Promise((resolve) => {
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
this.fetchState = "NONE";
|
|
23
|
+
resolve(undefined);
|
|
24
|
+
}, this.fetchTimeoutMs);
|
|
25
|
+
});
|
|
26
|
+
return Promise.race([this.promise, timeout]);
|
|
20
27
|
}
|
|
21
28
|
else if (this.fetchState === "VALID") {
|
|
22
29
|
if (this.isTokenExpired()) {
|
|
@@ -10,13 +10,12 @@ const logger_1 = require("../logger");
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
function runCommand(command, childOptions) {
|
|
12
12
|
const escapedCommand = command.replace(/\"/g, '\\"');
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
path.resolve(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'"';
|
|
13
|
+
const isVSCode = utils.isVSCodeExtension();
|
|
14
|
+
const nodeExecutable = isVSCode ? "node" : process.execPath;
|
|
15
|
+
const crossEnvShellPath = isVSCode
|
|
16
|
+
? path.resolve(__dirname, "./cross-env/dist/bin/cross-env-shell.js")
|
|
17
|
+
: path.resolve(require.resolve("cross-env"), "..", "bin", "cross-env-shell.js");
|
|
18
|
+
const translatedCommand = '"' + nodeExecutable + '" "' + crossEnvShellPath + '" "' + escapedCommand + '"';
|
|
20
19
|
return new Promise((resolve, reject) => {
|
|
21
20
|
logger_1.logger.info("Running command: " + command);
|
|
22
21
|
if (translatedCommand === "") {
|