firebase-tools 12.4.5 → 12.4.6
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 +1 -1
- package/lib/auth.js +1 -1
- package/lib/emulator/constants.js +1 -0
- package/lib/emulator/ui.js +3 -0
- package/lib/extensions/tos.js +35 -23
- package/lib/frameworks/next/utils.js +5 -30
- package/package.json +1 -1
package/lib/apiv2.js
CHANGED
|
@@ -146,7 +146,7 @@ class Client {
|
|
|
146
146
|
if (accessToken) {
|
|
147
147
|
return accessToken;
|
|
148
148
|
}
|
|
149
|
-
const data =
|
|
149
|
+
const data = await auth.getAccessToken(refreshToken, []);
|
|
150
150
|
return data.access_token;
|
|
151
151
|
}
|
|
152
152
|
requestURL(options) {
|
package/lib/auth.js
CHANGED
|
@@ -509,7 +509,7 @@ async function refreshTokens(refreshToken, authScopes) {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
async function getAccessToken(refreshToken, authScopes) {
|
|
512
|
-
if (haveValidTokens(refreshToken, authScopes)) {
|
|
512
|
+
if (haveValidTokens(refreshToken, authScopes) && lastAccessToken) {
|
|
513
513
|
return lastAccessToken;
|
|
514
514
|
}
|
|
515
515
|
return refreshTokens(refreshToken, authScopes);
|
|
@@ -88,6 +88,7 @@ exports.Constants = Constants;
|
|
|
88
88
|
Constants.FAKE_PROJECT_ID_PREFIX = "demo-";
|
|
89
89
|
Constants.FAKE_PROJECT_NUMBER = "0";
|
|
90
90
|
Constants.DEFAULT_DATABASE_EMULATOR_NAMESPACE = "fake-server";
|
|
91
|
+
Constants.FIREBASE_ENABLED_EXPERIMENTS = "FIREBASE_ENABLED_EXPERIMENTS";
|
|
91
92
|
Constants.FIRESTORE_EMULATOR_HOST = "FIRESTORE_EMULATOR_HOST";
|
|
92
93
|
Constants.FIRESTORE_EMULATOR_ENV_ALT = "FIREBASE_FIRESTORE_EMULATOR_ADDRESS";
|
|
93
94
|
Constants.FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST";
|
package/lib/emulator/ui.js
CHANGED
|
@@ -8,6 +8,7 @@ const error_1 = require("../error");
|
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const track_1 = require("../track");
|
|
10
10
|
const ExpressBasedEmulator_1 = require("./ExpressBasedEmulator");
|
|
11
|
+
const experiments_1 = require("../experiments");
|
|
11
12
|
class EmulatorUI {
|
|
12
13
|
constructor(args) {
|
|
13
14
|
this.args = args;
|
|
@@ -26,6 +27,8 @@ class EmulatorUI {
|
|
|
26
27
|
if (session) {
|
|
27
28
|
env[constants_1.Constants.FIREBASE_GA_SESSION] = JSON.stringify(session);
|
|
28
29
|
}
|
|
30
|
+
const enabledExperiments = Object.keys(experiments_1.ALL_EXPERIMENTS).filter((experimentName) => (0, experiments_1.isEnabled)(experimentName));
|
|
31
|
+
env[constants_1.Constants.FIREBASE_ENABLED_EXPERIMENTS] = JSON.stringify(enabledExperiments);
|
|
29
32
|
return downloadableEmulators.start(types_1.Emulators.UI, { auto_download: autoDownload }, env);
|
|
30
33
|
}
|
|
31
34
|
connect() {
|
package/lib/extensions/tos.js
CHANGED
|
@@ -39,36 +39,48 @@ async function acceptPublisherTOS(projectId, tosVersion) {
|
|
|
39
39
|
}
|
|
40
40
|
exports.acceptPublisherTOS = acceptPublisherTOS;
|
|
41
41
|
async function acceptLatestPublisherTOS(options, projectId) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
try {
|
|
43
|
+
logger_1.logger.debug(`Checking if latest publisher TOS has been accepted by ${projectId}...`);
|
|
44
|
+
const currentAcceptance = await getPublisherTOSStatus(projectId);
|
|
45
|
+
if (currentAcceptance.lastAcceptedVersion) {
|
|
46
|
+
logger_1.logger.debug(`Already accepted version ${currentAcceptance.lastAcceptedVersion} of Extensions publisher TOS.`);
|
|
47
|
+
return currentAcceptance;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const tosLink = extensionsTosUrl("publisher");
|
|
51
|
+
logger_1.logger.info(`To continue, you must accept the Firebase Extensions Publisher Terms of Service: ${tosLink}`);
|
|
52
|
+
if (await (0, prompt_1.confirm)(Object.assign(Object.assign({}, options), { message: "Do you accept the Firebase Extensions Publisher Terms of Service?" }))) {
|
|
53
|
+
return acceptPublisherTOS(projectId, currentAcceptance.latestTosVersion);
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
|
-
throw new error_1.FirebaseError("You must accept the terms of service to continue.");
|
|
55
56
|
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
logger_1.logger.debug(`Error when checking Publisher TOS for ${projectId}. This is expected if authenticated via a service account: ${err}`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
throw new error_1.FirebaseError("You must accept the terms of service to continue.");
|
|
56
62
|
}
|
|
57
63
|
exports.acceptLatestPublisherTOS = acceptLatestPublisherTOS;
|
|
58
64
|
async function acceptLatestAppDeveloperTOS(options, projectId, instanceIds) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
try {
|
|
66
|
+
logger_1.logger.debug(`Checking if latest AppDeveloper TOS has been accepted by ${projectId}...`);
|
|
67
|
+
displayDeveloperTOSWarning();
|
|
68
|
+
const currentAcceptance = await getAppDeveloperTOSStatus(projectId);
|
|
69
|
+
if (currentAcceptance.lastAcceptedVersion) {
|
|
70
|
+
logger_1.logger.debug(`User Terms of Service aready accepted on project ${projectId}.`);
|
|
71
|
+
}
|
|
72
|
+
else if (!(await (0, prompt_1.confirm)(Object.assign(Object.assign({}, options), { message: "Do you accept the Firebase Extensions User Terms of Service?" })))) {
|
|
73
|
+
throw new error_1.FirebaseError("You must accept the terms of service to continue.");
|
|
74
|
+
}
|
|
75
|
+
const tosPromises = instanceIds.map((instanceId) => {
|
|
76
|
+
return acceptAppDeveloperTOS(projectId, currentAcceptance.latestTosVersion, instanceId);
|
|
77
|
+
});
|
|
78
|
+
return Promise.all(tosPromises);
|
|
64
79
|
}
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
catch (err) {
|
|
81
|
+
logger_1.logger.debug(`Error when checking App Developer TOS for ${projectId}. This is expected if authenticated via a service account: ${err}`);
|
|
82
|
+
return [];
|
|
67
83
|
}
|
|
68
|
-
const tosPromises = instanceIds.map((instanceId) => {
|
|
69
|
-
return acceptAppDeveloperTOS(projectId, currentAcceptance.latestTosVersion, instanceId);
|
|
70
|
-
});
|
|
71
|
-
return Promise.all(tosPromises);
|
|
72
84
|
}
|
|
73
85
|
exports.acceptLatestAppDeveloperTOS = acceptLatestAppDeveloperTOS;
|
|
74
86
|
function displayDeveloperTOSWarning() {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
3
|
exports.getNextVersion = exports.getBuildId = exports.getHeadersFromMetaFiles = exports.getNonStaticServerComponents = exports.getNonStaticRoutes = exports.getMiddlewareMatcherRegexes = exports.allDependencyNames = exports.isUsingAppDirectory = exports.isUsingNextImageInAppDirectory = exports.isUsingImageOptimization = exports.isUsingMiddleware = exports.hasUnoptimizedImage = exports.usesNextImage = exports.usesAppDirRouter = exports.getNextjsRewritesToUse = exports.isHeaderSupportedByHosting = exports.isRedirectSupportedByHosting = exports.isRewriteSupportedByHosting = exports.cleanI18n = exports.cleanCustomRouteI18n = exports.cleanEscapedChars = exports.I18N_SOURCE = void 0;
|
|
11
4
|
const fs_1 = require("fs");
|
|
@@ -108,31 +101,13 @@ async function isUsingImageOptimization(projectDir, distDir) {
|
|
|
108
101
|
}
|
|
109
102
|
exports.isUsingImageOptimization = isUsingImageOptimization;
|
|
110
103
|
async function isUsingNextImageInAppDirectory(projectDir, nextDir) {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
_d = false;
|
|
117
|
-
try {
|
|
118
|
-
const filepath = _c;
|
|
119
|
-
const fileContents = await (0, promises_1.readFile)(filepath);
|
|
120
|
-
if (fileContents.includes("node_modules/next/dist/client/image")) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
125
|
-
_d = true;
|
|
126
|
-
}
|
|
104
|
+
const files = (0, glob_1.sync)((0, path_1.join)(projectDir, nextDir, "server", "**", "*client-reference-manifest.js"));
|
|
105
|
+
for (const filepath of files) {
|
|
106
|
+
const fileContents = await (0, promises_1.readFile)(filepath);
|
|
107
|
+
if (fileContents.includes("node_modules/next/dist/client/image")) {
|
|
108
|
+
return true;
|
|
127
109
|
}
|
|
128
110
|
}
|
|
129
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
130
|
-
finally {
|
|
131
|
-
try {
|
|
132
|
-
if (!_d && !_a && (_b = files_1.return)) await _b.call(files_1);
|
|
133
|
-
}
|
|
134
|
-
finally { if (e_1) throw e_1.error; }
|
|
135
|
-
}
|
|
136
111
|
return false;
|
|
137
112
|
}
|
|
138
113
|
exports.isUsingNextImageInAppDirectory = isUsingNextImageInAppDirectory;
|