firebase-tools-with-isolate 13.11.2 → 13.15.0-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/api.js +4 -2
- package/lib/apphosting/githubConnections.js +125 -37
- package/lib/apphosting/index.js +3 -8
- package/lib/auth.js +14 -15
- package/lib/bin/firebase.js +7 -5
- package/lib/commands/dataconnect-sdk-generate.js +5 -9
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/deploy.js +7 -1
- package/lib/commands/ext-configure.js +1 -6
- package/lib/commands/ext-dev-init.js +27 -30
- package/lib/commands/ext-dev-upload.js +4 -6
- package/lib/commands/ext-info.js +3 -5
- package/lib/commands/ext-install.js +0 -5
- package/lib/commands/ext-uninstall.js +0 -5
- package/lib/commands/ext-update.js +0 -5
- package/lib/commands/firestore-backups-schedules-create.js +11 -14
- package/lib/commands/firestore-backups-schedules-list.js +1 -1
- package/lib/commands/firestore-backups-schedules-update.js +4 -3
- package/lib/commands/firestore-databases-create.js +24 -7
- package/lib/commands/firestore-databases-restore.js +4 -4
- package/lib/commands/firestore-databases-update.js +5 -6
- package/lib/commands/functions-secrets-set.js +9 -6
- package/lib/commands/help.js +2 -0
- package/lib/commands/hosting-channel-create.js +1 -1
- package/lib/commands/hosting-channel-delete.js +1 -1
- package/lib/commands/hosting-channel-deploy.js +1 -1
- package/lib/commands/hosting-clone.js +1 -2
- package/lib/commands/index.js +9 -11
- package/lib/commands/init.js +16 -12
- package/lib/commands/login.js +1 -2
- package/lib/commands/setup-emulators-dataconnect.js +22 -3
- package/lib/config.js +5 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -1
- package/lib/dataconnect/client.js +55 -8
- package/lib/dataconnect/fileUtils.js +30 -7
- package/lib/dataconnect/filters.js +12 -1
- package/lib/dataconnect/load.js +9 -7
- package/lib/dataconnect/schemaMigration.js +21 -0
- package/lib/dataconnect/types.js +8 -1
- package/lib/deploy/dataconnect/prepare.js +16 -2
- package/lib/deploy/functions/build.js +10 -1
- package/lib/emulator/adminSdkConfig.test.js +16 -0
- package/lib/emulator/constants.js +1 -0
- package/lib/emulator/controller.js +3 -9
- package/lib/emulator/dataconnectEmulator.js +122 -18
- package/lib/emulator/downloadableEmulators.js +21 -22
- package/lib/emulator/eventarcEmulator.js +68 -18
- package/lib/emulator/functionsEmulator.js +89 -0
- package/lib/emulator/functionsEmulatorShared.js +4 -0
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/portUtils.js +9 -0
- package/lib/emulator/pubsubEmulator.js +1 -1
- package/lib/emulator/registry.js +1 -1
- package/lib/emulator/storage/apis/shared.js +2 -1
- package/lib/emulator/storage/persistence.js +5 -13
- package/lib/emulator/storage/rfc.js +9 -0
- package/lib/emulator/storage/rules/config.js +4 -2
- package/lib/experiments.js +8 -3
- package/lib/extensions/askUserForParam.js +1 -1
- package/lib/extensions/change-log.js +2 -4
- package/lib/extensions/displayExtensionInfo.js +0 -5
- package/lib/extensions/extensionsHelper.js +5 -7
- package/lib/extensions/provisioningHelper.js +1 -1
- package/lib/extensions/updateHelper.js +1 -2
- package/lib/extensions/warnings.js +2 -7
- package/lib/firestore/api-sort.test.js +74 -0
- package/lib/firestore/api.js +8 -7
- package/lib/firestore/backupUtils.test.js +18 -0
- package/lib/firestore/pretty-print.js +21 -1
- package/lib/firestore/pretty-print.test.js +61 -0
- package/lib/firestore/util.test.js +42 -0
- package/lib/frameworks/angular/utils.js +13 -5
- package/lib/frameworks/compose/discover/mockFileSystem.js +36 -0
- package/lib/frameworks/index.js +2 -6
- package/lib/frameworks/next/utils.js +2 -8
- package/lib/frameworks/nuxt/index.js +3 -3
- package/lib/functions/events/v2.js +2 -1
- package/lib/gcp/cloudsql/cloudsqladmin.js +6 -1
- package/lib/gcp/devConnect.js +36 -1
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/init/features/dataconnect/index.js +97 -31
- package/lib/init/features/dataconnect/sdk.js +131 -0
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/javascript.js +6 -8
- package/lib/init/features/functions/python.js +4 -6
- package/lib/init/features/functions/typescript.js +8 -10
- package/lib/init/features/hosting/github.js +43 -21
- package/lib/init/features/hosting/index.js +3 -3
- package/lib/init/features/index.js +3 -1
- package/lib/init/features/storage.js +2 -2
- package/lib/init/index.js +1 -0
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +2 -2
- package/lib/rc.js +1 -0
- package/lib/requireAuth.js +8 -3
- package/lib/rulesDeploy.js +14 -12
- package/lib/templates.js +23 -0
- package/lib/utils.js +2 -2
- package/package.json +25 -24
- package/schema/connector-yaml.json +36 -4
- package/schema/dataconnect-yaml.json +4 -0
- package/schema/firebase-config.json +0 -8
- package/templates/_gitignore +3 -0
- package/templates/init/dataconnect/connector.yaml +11 -0
- package/templates/init/dataconnect/dataconnect.yaml +2 -1
- package/templates/init/dataconnect/mutations.gql +19 -14
- package/templates/init/dataconnect/queries.gql +28 -23
- package/templates/init/dataconnect/schema.gql +1 -1
- package/lib/extensions/billingMigrationHelper.js +0 -61
|
@@ -69,7 +69,7 @@ async function initGitHub(setup) {
|
|
|
69
69
|
if (setup.config.hosting.predeploy) {
|
|
70
70
|
(0, utils_1.logBullet)(`You have a predeploy script configured in firebase.json.`);
|
|
71
71
|
}
|
|
72
|
-
const { script } = await promptForBuildScript();
|
|
72
|
+
const { script } = await promptForBuildScript(setup?.hosting?.useWebFrameworks);
|
|
73
73
|
const ymlDeployDoc = loadYMLDeploy();
|
|
74
74
|
let shouldWriteYMLHostingFile = true;
|
|
75
75
|
let shouldWriteYMLDeployFile = false;
|
|
@@ -80,7 +80,7 @@ async function initGitHub(setup) {
|
|
|
80
80
|
shouldWriteYMLHostingFile = overwrite;
|
|
81
81
|
}
|
|
82
82
|
if (shouldWriteYMLHostingFile) {
|
|
83
|
-
writeChannelActionYMLFile(YML_FULL_PATH_PULL_REQUEST, githubSecretName, setup.projectId, script);
|
|
83
|
+
writeChannelActionYMLFile(YML_FULL_PATH_PULL_REQUEST, githubSecretName, setup.projectId, script, setup?.hosting?.useWebFrameworks, setup?.hosting?.source);
|
|
84
84
|
logger_1.logger.info();
|
|
85
85
|
(0, utils_1.logSuccess)(`Created workflow file ${(0, colorette_1.bold)(YML_FULL_PATH_PULL_REQUEST)}`);
|
|
86
86
|
}
|
|
@@ -101,7 +101,7 @@ async function initGitHub(setup) {
|
|
|
101
101
|
shouldWriteYMLDeployFile = true;
|
|
102
102
|
}
|
|
103
103
|
if (shouldWriteYMLDeployFile) {
|
|
104
|
-
writeDeployToProdActionYMLFile(YML_FULL_PATH_MERGE, branch, githubSecretName, setup.projectId, script);
|
|
104
|
+
writeDeployToProdActionYMLFile(YML_FULL_PATH_MERGE, branch, githubSecretName, setup.projectId, script, setup?.hosting?.useWebFrameworks, setup?.hosting?.source);
|
|
105
105
|
logger_1.logger.info();
|
|
106
106
|
(0, utils_1.logSuccess)(`Created workflow file ${(0, colorette_1.bold)(YML_FULL_PATH_MERGE)}`);
|
|
107
107
|
}
|
|
@@ -155,7 +155,7 @@ function mkdirNotExists(dir) {
|
|
|
155
155
|
fs.mkdirSync(dir);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function writeChannelActionYMLFile(ymlPath, secretName, projectId, script) {
|
|
158
|
+
function writeChannelActionYMLFile(ymlPath, secretName, projectId, script, useWebFrameworks, hostingSource) {
|
|
159
159
|
const workflowConfig = {
|
|
160
160
|
name: "Deploy to Firebase Hosting on PR",
|
|
161
161
|
on: "pull_request",
|
|
@@ -172,19 +172,31 @@ function writeChannelActionYMLFile(ymlPath, secretName, projectId, script) {
|
|
|
172
172
|
},
|
|
173
173
|
},
|
|
174
174
|
};
|
|
175
|
-
|
|
176
|
-
workflowConfig.jobs.build_and_preview.steps.push({
|
|
177
|
-
run: script,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
workflowConfig.jobs.build_and_preview.steps.push({
|
|
175
|
+
const buildAndPreviewParams = {
|
|
181
176
|
uses: HOSTING_GITHUB_ACTION_NAME,
|
|
182
177
|
with: {
|
|
183
178
|
repoToken: "${{ secrets.GITHUB_TOKEN }}",
|
|
184
179
|
firebaseServiceAccount: `\${{ secrets.${secretName} }}`,
|
|
185
180
|
projectId: projectId,
|
|
186
181
|
},
|
|
187
|
-
}
|
|
182
|
+
};
|
|
183
|
+
if (useWebFrameworks) {
|
|
184
|
+
workflowConfig.jobs.build_and_preview.steps.push({ run: "npm ci" });
|
|
185
|
+
buildAndPreviewParams.env = {
|
|
186
|
+
FIREBASE_CLI_EXPERIMENTS: "webframeworks",
|
|
187
|
+
};
|
|
188
|
+
if (hostingSource && hostingSource !== ".") {
|
|
189
|
+
workflowConfig.jobs.build_and_preview.defaults = {
|
|
190
|
+
run: { "working-directory": hostingSource },
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (script) {
|
|
195
|
+
workflowConfig.jobs.build_and_preview.steps.push({
|
|
196
|
+
run: script,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
workflowConfig.jobs.build_and_preview.steps.push(buildAndPreviewParams);
|
|
188
200
|
const ymlContents = `# This file was auto-generated by the Firebase CLI
|
|
189
201
|
# https://github.com/firebase/firebase-tools
|
|
190
202
|
|
|
@@ -193,7 +205,7 @@ ${yaml.stringify(workflowConfig)}`;
|
|
|
193
205
|
mkdirNotExists(WORKFLOW_DIR);
|
|
194
206
|
fs.writeFileSync(ymlPath, ymlContents, "utf8");
|
|
195
207
|
}
|
|
196
|
-
function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId, script) {
|
|
208
|
+
function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId, script, useWebFrameworks, hostingSource) {
|
|
197
209
|
const workflowConfig = {
|
|
198
210
|
name: "Deploy to Firebase Hosting on merge",
|
|
199
211
|
on: { push: { branches: [branch || "master"] } },
|
|
@@ -204,12 +216,7 @@ function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId,
|
|
|
204
216
|
},
|
|
205
217
|
},
|
|
206
218
|
};
|
|
207
|
-
|
|
208
|
-
workflowConfig.jobs.build_and_deploy.steps.push({
|
|
209
|
-
run: script,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
workflowConfig.jobs.build_and_deploy.steps.push({
|
|
219
|
+
const buildAndDeployParams = {
|
|
213
220
|
uses: HOSTING_GITHUB_ACTION_NAME,
|
|
214
221
|
with: {
|
|
215
222
|
repoToken: "${{ secrets.GITHUB_TOKEN }}",
|
|
@@ -217,7 +224,22 @@ function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId,
|
|
|
217
224
|
channelId: "live",
|
|
218
225
|
projectId: projectId,
|
|
219
226
|
},
|
|
220
|
-
}
|
|
227
|
+
};
|
|
228
|
+
if (useWebFrameworks) {
|
|
229
|
+
workflowConfig.jobs.build_and_deploy.steps.push({ run: "npm ci" });
|
|
230
|
+
buildAndDeployParams.env = {
|
|
231
|
+
FIREBASE_CLI_EXPERIMENTS: "webframeworks",
|
|
232
|
+
};
|
|
233
|
+
if (hostingSource && hostingSource !== ".") {
|
|
234
|
+
workflowConfig.jobs.build_and_deploy.defaults = {
|
|
235
|
+
run: { "working-directory": hostingSource },
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (script) {
|
|
240
|
+
workflowConfig.jobs.build_and_deploy.steps.push({ run: script });
|
|
241
|
+
}
|
|
242
|
+
workflowConfig.jobs.build_and_deploy.steps.push(buildAndDeployParams);
|
|
221
243
|
const ymlContents = `# This file was auto-generated by the Firebase CLI
|
|
222
244
|
# https://github.com/firebase/firebase-tools
|
|
223
245
|
|
|
@@ -270,7 +292,7 @@ async function promptForRepo(options, ghAccessToken) {
|
|
|
270
292
|
]);
|
|
271
293
|
return { repo, key, keyId };
|
|
272
294
|
}
|
|
273
|
-
async function promptForBuildScript() {
|
|
295
|
+
async function promptForBuildScript(useWebFrameworks) {
|
|
274
296
|
const { shouldSetupScript } = await (0, prompt_1.prompt)({}, [
|
|
275
297
|
{
|
|
276
298
|
type: "confirm",
|
|
@@ -286,7 +308,7 @@ async function promptForBuildScript() {
|
|
|
286
308
|
{
|
|
287
309
|
type: "input",
|
|
288
310
|
name: "script",
|
|
289
|
-
default: "npm ci && npm run build",
|
|
311
|
+
default: useWebFrameworks ? undefined : "npm ci && npm run build",
|
|
290
312
|
message: "What script should be run before every deploy?",
|
|
291
313
|
},
|
|
292
314
|
]);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.doSetup = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
-
const fs = require("fs");
|
|
6
5
|
const rimraf_1 = require("rimraf");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const apiv2_1 = require("../../../apiv2");
|
|
@@ -15,8 +14,9 @@ const experiments = require("../../../experiments");
|
|
|
15
14
|
const getDefaultHostingSite_1 = require("../../../getDefaultHostingSite");
|
|
16
15
|
const utils_1 = require("../../../utils");
|
|
17
16
|
const interactive_1 = require("../../../hosting/interactive");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const templates_1 = require("../../../templates");
|
|
18
|
+
const INDEX_TEMPLATE = (0, templates_1.readTemplateSync)("init/hosting/index.html");
|
|
19
|
+
const MISSING_TEMPLATE = (0, templates_1.readTemplateSync)("init/hosting/404.html");
|
|
20
20
|
const DEFAULT_IGNORES = ["firebase.json", "**/.*", "**/node_modules/**"];
|
|
21
21
|
async function doSetup(setup, config, options) {
|
|
22
22
|
setup.hosting = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genkit = exports.apphosting = exports.dataconnect = exports.hostingGithub = exports.remoteconfig = exports.project = exports.extensions = exports.emulators = exports.storage = exports.hosting = exports.functions = exports.firestore = exports.database = exports.account = void 0;
|
|
3
|
+
exports.genkit = exports.apphosting = exports.dataconnectSdk = exports.dataconnect = exports.hostingGithub = exports.remoteconfig = exports.project = exports.extensions = exports.emulators = exports.storage = exports.hosting = exports.functions = exports.firestore = exports.database = exports.account = void 0;
|
|
4
4
|
var account_1 = require("./account");
|
|
5
5
|
Object.defineProperty(exports, "account", { enumerable: true, get: function () { return account_1.doSetup; } });
|
|
6
6
|
var database_1 = require("./database");
|
|
@@ -25,6 +25,8 @@ var github_1 = require("./hosting/github");
|
|
|
25
25
|
Object.defineProperty(exports, "hostingGithub", { enumerable: true, get: function () { return github_1.initGitHub; } });
|
|
26
26
|
var dataconnect_1 = require("./dataconnect");
|
|
27
27
|
Object.defineProperty(exports, "dataconnect", { enumerable: true, get: function () { return dataconnect_1.doSetup; } });
|
|
28
|
+
var sdk_1 = require("./dataconnect/sdk");
|
|
29
|
+
Object.defineProperty(exports, "dataconnectSdk", { enumerable: true, get: function () { return sdk_1.doSetup; } });
|
|
28
30
|
var apphosting_1 = require("../../apphosting");
|
|
29
31
|
Object.defineProperty(exports, "apphosting", { enumerable: true, get: function () { return apphosting_1.doSetup; } });
|
|
30
32
|
var genkit_1 = require("./genkit");
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.doSetup = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
-
const fs = require("fs");
|
|
6
5
|
const logger_1 = require("../../logger");
|
|
7
6
|
const prompt_1 = require("../../prompt");
|
|
8
7
|
const ensureCloudResourceLocation_1 = require("../../ensureCloudResourceLocation");
|
|
9
|
-
const
|
|
8
|
+
const templates_1 = require("../../templates");
|
|
9
|
+
const RULES_TEMPLATE = (0, templates_1.readTemplateSync)("init/storage/storage.rules");
|
|
10
10
|
async function doSetup(setup, config) {
|
|
11
11
|
setup.config.storage = {};
|
|
12
12
|
(0, ensureCloudResourceLocation_1.ensureLocationSet)(setup.projectLocation, "Cloud Storage");
|
package/lib/init/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const featureFns = new Map([
|
|
|
11
11
|
["database", features.database],
|
|
12
12
|
["firestore", features.firestore],
|
|
13
13
|
["dataconnect", features.dataconnect],
|
|
14
|
+
["dataconnect:sdk", features.dataconnectSdk],
|
|
14
15
|
["functions", features.functions],
|
|
15
16
|
["hosting", features.hosting],
|
|
16
17
|
["storage", features.storage],
|
package/lib/listFiles.js
CHANGED
package/lib/management/apps.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteAppAndroidSha = exports.createAppAndroidSha = exports.listAppAndroidSha = exports.getAppConfig = exports.getAppConfigFile = exports.listFirebaseApps = exports.createWebApp = exports.createAndroidApp = exports.createIosApp = exports.getAppPlatform = exports.ShaCertificateType = exports.AppPlatform = exports.APP_LIST_PAGE_SIZE = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
4
|
const apiv2_1 = require("../apiv2");
|
|
6
5
|
const api_1 = require("../api");
|
|
7
6
|
const error_1 = require("../error");
|
|
8
7
|
const logger_1 = require("../logger");
|
|
9
8
|
const operation_poller_1 = require("../operation-poller");
|
|
9
|
+
const templates_1 = require("../templates");
|
|
10
10
|
const TIMEOUT_MILLIS = 30000;
|
|
11
11
|
exports.APP_LIST_PAGE_SIZE = 100;
|
|
12
12
|
const CREATE_APP_API_REQUEST_TIMEOUT_MILLIS = 15000;
|
|
@@ -182,7 +182,7 @@ function getAppConfigResourceString(appId, platform) {
|
|
|
182
182
|
}
|
|
183
183
|
function parseConfigFromResponse(responseBody, platform) {
|
|
184
184
|
if (platform === AppPlatform.WEB) {
|
|
185
|
-
const JS_TEMPLATE =
|
|
185
|
+
const JS_TEMPLATE = (0, templates_1.readTemplateSync)("setup/web.js");
|
|
186
186
|
return {
|
|
187
187
|
fileName: WEB_CONFIG_FILE_NAME,
|
|
188
188
|
fileContents: JS_TEMPLATE.replace("{/*--CONFIG--*/}", JSON.stringify(responseBody, null, 2)),
|
package/lib/rc.js
CHANGED
package/lib/requireAuth.js
CHANGED
|
@@ -20,9 +20,6 @@ function getAuthClient(config) {
|
|
|
20
20
|
return authClient;
|
|
21
21
|
}
|
|
22
22
|
async function autoAuth(options, authScopes) {
|
|
23
|
-
if (process.env.MONOSPACE_ENV) {
|
|
24
|
-
throw new error_1.FirebaseError("autoAuth not yet implemented for IDX. Please run 'firebase login'");
|
|
25
|
-
}
|
|
26
23
|
const client = getAuthClient({ scopes: authScopes, projectId: options.project });
|
|
27
24
|
const token = await client.getAccessToken();
|
|
28
25
|
token !== null ? apiv2.setAccessToken(token) : false;
|
|
@@ -34,6 +31,14 @@ async function autoAuth(options, authScopes) {
|
|
|
34
31
|
catch (e) {
|
|
35
32
|
logger_1.logger.debug(`Error getting account credentials.`);
|
|
36
33
|
}
|
|
34
|
+
if (process.env.MONOSPACE_ENV && token && clientEmail) {
|
|
35
|
+
(0, auth_1.setActiveAccount)(options, {
|
|
36
|
+
user: { email: clientEmail },
|
|
37
|
+
tokens: { access_token: token },
|
|
38
|
+
});
|
|
39
|
+
(0, auth_1.setGlobalDefaultAccount)({ user: { email: clientEmail }, tokens: { access_token: token } });
|
|
40
|
+
options.projectId = await client.getProjectId();
|
|
41
|
+
}
|
|
37
42
|
return clientEmail;
|
|
38
43
|
}
|
|
39
44
|
async function requireAuth(options) {
|
package/lib/rulesDeploy.js
CHANGED
|
@@ -71,12 +71,13 @@ class RulesDeploy {
|
|
|
71
71
|
if (await (0, resourceManager_1.serviceAccountHasRoles)(projectNumber, saEmail, [CROSS_SERVICE_RULES_ROLE], true)) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const addRole =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const addRole = this.options.force ||
|
|
75
|
+
(await (0, prompt_1.promptOnce)({
|
|
76
|
+
type: "confirm",
|
|
77
|
+
name: "rulesRole",
|
|
78
|
+
message: `Cloud Storage for Firebase needs an IAM Role to use cross-service rules. Grant the new role?`,
|
|
79
|
+
default: true,
|
|
80
|
+
}, this.options));
|
|
80
81
|
if (addRole) {
|
|
81
82
|
await (0, resourceManager_1.addServiceAccountToRoles)(projectNumber, saEmail, [CROSS_SERVICE_RULES_ROLE], true);
|
|
82
83
|
utils.logLabeledBullet(RulesetType[this.type], "updated service account for cross-service rules...");
|
|
@@ -117,12 +118,13 @@ class RulesDeploy {
|
|
|
117
118
|
utils.logLabeledBullet(RulesetType[this.type], "quota exceeded error while uploading rules");
|
|
118
119
|
const history = await gcp.rules.listAllRulesets(this.options.project);
|
|
119
120
|
if (history.length > RULESET_COUNT_LIMIT) {
|
|
120
|
-
const confirm =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
const confirm = this.options.force ||
|
|
122
|
+
(await (0, prompt_1.promptOnce)({
|
|
123
|
+
type: "confirm",
|
|
124
|
+
name: "force",
|
|
125
|
+
message: `You have ${history.length} rules, do you want to delete the oldest ${RULESETS_TO_GC} to free up space?`,
|
|
126
|
+
default: false,
|
|
127
|
+
}, this.options));
|
|
126
128
|
if (confirm) {
|
|
127
129
|
const releases = await gcp.rules.listAllReleases(this.options.project);
|
|
128
130
|
const unreleased = history.filter((ruleset) => {
|
package/lib/templates.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readTemplate = exports.readTemplateSync = exports.absoluteTemplateFilePath = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const promises_1 = require("fs/promises");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const TEMPLATE_ENCODING = "utf8";
|
|
9
|
+
function absoluteTemplateFilePath(relPath) {
|
|
10
|
+
if ((0, utils_1.isVSCodeExtension)()) {
|
|
11
|
+
return (0, path_1.resolve)(__dirname, "templates", relPath);
|
|
12
|
+
}
|
|
13
|
+
return (0, path_1.resolve)(__dirname, "../templates", relPath);
|
|
14
|
+
}
|
|
15
|
+
exports.absoluteTemplateFilePath = absoluteTemplateFilePath;
|
|
16
|
+
function readTemplateSync(relPath) {
|
|
17
|
+
return (0, fs_1.readFileSync)(absoluteTemplateFilePath(relPath), TEMPLATE_ENCODING);
|
|
18
|
+
}
|
|
19
|
+
exports.readTemplateSync = readTemplateSync;
|
|
20
|
+
function readTemplate(relPath) {
|
|
21
|
+
return (0, promises_1.readFile)(absoluteTemplateFilePath(relPath), TEMPLATE_ENCODING);
|
|
22
|
+
}
|
|
23
|
+
exports.readTemplate = readTemplate;
|
package/lib/utils.js
CHANGED
|
@@ -23,6 +23,7 @@ const configstore_1 = require("./configstore");
|
|
|
23
23
|
const error_1 = require("./error");
|
|
24
24
|
const logger_1 = require("./logger");
|
|
25
25
|
const prompt_1 = require("./prompt");
|
|
26
|
+
const templates_1 = require("./templates");
|
|
26
27
|
exports.IS_WINDOWS = process.platform === "win32";
|
|
27
28
|
const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
|
|
28
29
|
const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
|
|
@@ -504,8 +505,7 @@ async function openInBrowser(url) {
|
|
|
504
505
|
}
|
|
505
506
|
exports.openInBrowser = openInBrowser;
|
|
506
507
|
async function openInBrowserPopup(url, buttonText) {
|
|
507
|
-
const popupPage =
|
|
508
|
-
.readFileSync(path.join(__dirname, "../templates/popup.html"), { encoding: "utf-8" })
|
|
508
|
+
const popupPage = (0, templates_1.readTemplateSync)("popup.html")
|
|
509
509
|
.replace("${url}", url)
|
|
510
510
|
.replace("${buttonText}", buttonText);
|
|
511
511
|
const port = await (0, portfinder_1.getPortPromise)();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools-with-isolate",
|
|
3
3
|
"description": "Command-Line Interface for Firebase with monorepo support",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.15.0-0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"firebase": "lib/bin/firebase.js"
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
"format:other": "npm run lint:other -- --write",
|
|
17
17
|
"format:ts": "npm run lint:ts -- --fix --quiet",
|
|
18
18
|
"generate:auth-api": "ts-node scripts/gen-auth-api-spec.ts",
|
|
19
|
-
"generate:json-schema": "typescript-json-schema --strictNullChecks --required --noExtraProps src/firebaseConfig.ts FirebaseConfig > schema/firebase-config.json",
|
|
19
|
+
"generate:json-schema": "typescript-json-schema --strictNullChecks --required --noExtraProps --ignoreErrors src/firebaseConfig.ts FirebaseConfig > schema/firebase-config.json",
|
|
20
20
|
"lint": "npm run lint:ts && npm run lint:other",
|
|
21
21
|
"lint:changed-files": "ts-node ./scripts/lint-changed-files.ts",
|
|
22
22
|
"lint:other": "prettier --check '**/*.{md,yaml,yml}'",
|
|
23
23
|
"lint:quiet": "npm run lint:ts -- --quiet && npm run lint:other",
|
|
24
24
|
"lint:ts": "eslint --config .eslintrc.js --ext .ts,.js .",
|
|
25
|
-
"mocha": "
|
|
25
|
+
"mocha:fast": "mocha 'src/**/*.spec.{ts,js}'",
|
|
26
|
+
"mocha": "nyc mocha 'src/**/*.spec.{ts,js}'",
|
|
26
27
|
"prepare": "npm run clean && npm run build:publish",
|
|
27
28
|
"test": "npm run lint:quiet && npm run test:compile && npm run mocha",
|
|
28
29
|
"test:client-integration": "bash ./scripts/client-integration-tests/run.sh",
|
|
@@ -90,18 +91,20 @@
|
|
|
90
91
|
".ts"
|
|
91
92
|
],
|
|
92
93
|
"exclude": [
|
|
94
|
+
"src/**/*.spec.*",
|
|
95
|
+
"src/**/testing/**/*",
|
|
93
96
|
"src/test/**/*"
|
|
94
97
|
]
|
|
95
98
|
},
|
|
96
99
|
"dependencies": {
|
|
97
|
-
"@google-cloud/cloud-sql-connector": "^1.
|
|
98
|
-
"@google-cloud/pubsub": "^4.
|
|
100
|
+
"@google-cloud/cloud-sql-connector": "^1.3.3",
|
|
101
|
+
"@google-cloud/pubsub": "^4.5.0",
|
|
99
102
|
"abort-controller": "^3.0.0",
|
|
100
103
|
"ajv": "^6.12.6",
|
|
101
|
-
"archiver": "^
|
|
102
|
-
"async-lock": "1.
|
|
104
|
+
"archiver": "^7.0.0",
|
|
105
|
+
"async-lock": "1.4.1",
|
|
103
106
|
"body-parser": "^1.19.0",
|
|
104
|
-
"chokidar": "^3.0
|
|
107
|
+
"chokidar": "^3.6.0",
|
|
105
108
|
"cjson": "^0.3.1",
|
|
106
109
|
"cli-table": "0.3.11",
|
|
107
110
|
"colorette": "^2.0.19",
|
|
@@ -112,25 +115,25 @@
|
|
|
112
115
|
"cross-spawn": "^7.0.3",
|
|
113
116
|
"csv-parse": "^5.0.4",
|
|
114
117
|
"deep-equal-in-any-order": "^2.0.6",
|
|
115
|
-
"exegesis": "^4.
|
|
118
|
+
"exegesis": "^4.2.0",
|
|
116
119
|
"exegesis-express": "^4.0.0",
|
|
117
120
|
"express": "^4.16.4",
|
|
118
121
|
"filesize": "^6.1.0",
|
|
119
122
|
"form-data": "^4.0.0",
|
|
120
123
|
"fs-extra": "^10.1.0",
|
|
121
124
|
"fuzzy": "^0.1.3",
|
|
122
|
-
"gaxios": "^6.
|
|
123
|
-
"glob": "^
|
|
124
|
-
"google-auth-library": "^9.
|
|
125
|
+
"gaxios": "^6.7.0",
|
|
126
|
+
"glob": "^10.4.1",
|
|
127
|
+
"google-auth-library": "^9.11.0",
|
|
125
128
|
"inquirer": "^8.2.6",
|
|
126
129
|
"inquirer-autocomplete-prompt": "^2.0.1",
|
|
127
|
-
"isolate-package": "^1.
|
|
130
|
+
"isolate-package": "^1.20.0-0",
|
|
128
131
|
"jsonwebtoken": "^9.0.0",
|
|
129
132
|
"leven": "^3.1.0",
|
|
130
133
|
"libsodium-wrappers": "^0.7.10",
|
|
131
134
|
"lodash": "^4.17.21",
|
|
132
|
-
"marked": "^
|
|
133
|
-
"marked-terminal": "^
|
|
135
|
+
"marked": "^13.0.2",
|
|
136
|
+
"marked-terminal": "^7.0.0",
|
|
134
137
|
"mime": "^2.5.2",
|
|
135
138
|
"minimatch": "^3.0.4",
|
|
136
139
|
"morgan": "^1.10.0",
|
|
@@ -143,7 +146,7 @@
|
|
|
143
146
|
"progress": "^2.0.3",
|
|
144
147
|
"proxy-agent": "^6.3.0",
|
|
145
148
|
"retry": "^0.13.1",
|
|
146
|
-
"rimraf": "^
|
|
149
|
+
"rimraf": "^5.0.0",
|
|
147
150
|
"semver": "^7.5.2",
|
|
148
151
|
"sql-formatter": "^15.3.0",
|
|
149
152
|
"stream-chain": "^2.2.4",
|
|
@@ -152,7 +155,7 @@
|
|
|
152
155
|
"superstatic": "^9.0.3",
|
|
153
156
|
"tar": "^6.1.11",
|
|
154
157
|
"tcp-port-used": "^1.0.2",
|
|
155
|
-
"tmp": "^0.2.
|
|
158
|
+
"tmp": "^0.2.3",
|
|
156
159
|
"triple-beam": "^1.3.0",
|
|
157
160
|
"universal-analytics": "^0.5.3",
|
|
158
161
|
"update-notifier-cjs": "^5.1.6",
|
|
@@ -166,8 +169,8 @@
|
|
|
166
169
|
"@angular-devkit/architect": "^0.1402.2",
|
|
167
170
|
"@angular-devkit/core": "^14.2.2",
|
|
168
171
|
"@google/events": "^5.1.1",
|
|
169
|
-
"@types/archiver": "^
|
|
170
|
-
"@types/async-lock": "^1.
|
|
172
|
+
"@types/archiver": "^6.0.0",
|
|
173
|
+
"@types/async-lock": "^1.4.2",
|
|
171
174
|
"@types/body-parser": "^1.17.0",
|
|
172
175
|
"@types/chai": "^4.3.0",
|
|
173
176
|
"@types/chai-as-promised": "^7.1.4",
|
|
@@ -180,7 +183,6 @@
|
|
|
180
183
|
"@types/express": "^4.17.0",
|
|
181
184
|
"@types/express-serve-static-core": "^4.17.8",
|
|
182
185
|
"@types/fs-extra": "^9.0.13",
|
|
183
|
-
"@types/glob": "^7.1.1",
|
|
184
186
|
"@types/html-escaper": "^3.0.0",
|
|
185
187
|
"@types/inquirer": "^8.1.3",
|
|
186
188
|
"@types/inquirer-autocomplete-prompt": "^2.0.2",
|
|
@@ -188,19 +190,17 @@
|
|
|
188
190
|
"@types/jsonwebtoken": "^9.0.5",
|
|
189
191
|
"@types/libsodium-wrappers": "^0.7.9",
|
|
190
192
|
"@types/lodash": "^4.14.149",
|
|
191
|
-
"@types/marked": "^
|
|
192
|
-
"@types/marked-terminal": "^3.1.3",
|
|
193
|
+
"@types/marked-terminal": "^6.1.1",
|
|
193
194
|
"@types/mocha": "^9.0.0",
|
|
195
|
+
"@types/mock-fs": "4.13.4",
|
|
194
196
|
"@types/multer": "^1.4.3",
|
|
195
197
|
"@types/node": "^18.19.1",
|
|
196
198
|
"@types/node-fetch": "^2.5.12",
|
|
197
199
|
"@types/pg": "^8.11.2",
|
|
198
200
|
"@types/progress": "^2.0.3",
|
|
199
|
-
"@types/puppeteer": "^5.4.2",
|
|
200
201
|
"@types/react": "^18.2.58",
|
|
201
202
|
"@types/react-dom": "^18.2.19",
|
|
202
203
|
"@types/retry": "^0.12.1",
|
|
203
|
-
"@types/rimraf": "^2.0.3",
|
|
204
204
|
"@types/semver": "^6.0.0",
|
|
205
205
|
"@types/sinon": "^9.0.10",
|
|
206
206
|
"@types/sinon-chai": "^3.2.2",
|
|
@@ -231,6 +231,7 @@
|
|
|
231
231
|
"google-discovery-to-swagger": "^2.1.0",
|
|
232
232
|
"googleapis": "^105.0.0",
|
|
233
233
|
"mocha": "^9.1.3",
|
|
234
|
+
"mock-fs": "5.2.0",
|
|
234
235
|
"next": "^14.1.0",
|
|
235
236
|
"nock": "^13.0.5",
|
|
236
237
|
"node-mocks-http": "^1.11.0",
|
|
@@ -2,7 +2,39 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"additionalProperties": false,
|
|
4
4
|
"definitions": {
|
|
5
|
-
"
|
|
5
|
+
"javascriptSdk": {
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"outputDir": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Path to the directory where generated files should be written to."
|
|
12
|
+
},
|
|
13
|
+
"package": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The package name to use for the generated code."
|
|
16
|
+
},
|
|
17
|
+
"packageJSONDir": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The directory containining the package.json to install the generated package in."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"kotlinSdk": {
|
|
24
|
+
"additionalProperties": true,
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"outputDir": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Path to the directory where generated files should be written to."
|
|
30
|
+
},
|
|
31
|
+
"package": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The package name to use for the generated code."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"swiftSdk": {
|
|
6
38
|
"additionalProperties": true,
|
|
7
39
|
"type": "object",
|
|
8
40
|
"properties": {
|
|
@@ -30,21 +62,21 @@
|
|
|
30
62
|
"javascriptSdk": {
|
|
31
63
|
"type": "array",
|
|
32
64
|
"items": {
|
|
33
|
-
"$ref": "#/definitions/
|
|
65
|
+
"$ref": "#/definitions/javascriptSdk"
|
|
34
66
|
},
|
|
35
67
|
"description": "Configuration for a generated Javascript SDK"
|
|
36
68
|
},
|
|
37
69
|
"kotlinSdk": {
|
|
38
70
|
"type": "array",
|
|
39
71
|
"items": {
|
|
40
|
-
"$ref": "#/definitions/
|
|
72
|
+
"$ref": "#/definitions/kotlinSdk"
|
|
41
73
|
},
|
|
42
74
|
"description": "Configuration for a generated Kotlin SDK"
|
|
43
75
|
},
|
|
44
76
|
"swiftSdk": {
|
|
45
77
|
"type": "array",
|
|
46
78
|
"items": {
|
|
47
|
-
"$ref": "#/definitions/
|
|
79
|
+
"$ref": "#/definitions/swiftSdk"
|
|
48
80
|
},
|
|
49
81
|
"description": "Configuration for a generated Swift SDK"
|
|
50
82
|
}
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"type": "string",
|
|
59
59
|
"description": "The ID of the Firebase Data Connect service."
|
|
60
60
|
},
|
|
61
|
+
"location": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "The region of the Firebase Data Connect service."
|
|
64
|
+
},
|
|
61
65
|
"connectorDirs": {
|
|
62
66
|
"type": "array",
|
|
63
67
|
"items": {
|
|
@@ -276,9 +276,6 @@
|
|
|
276
276
|
{
|
|
277
277
|
"additionalProperties": false,
|
|
278
278
|
"properties": {
|
|
279
|
-
"location": {
|
|
280
|
-
"type": "string"
|
|
281
|
-
},
|
|
282
279
|
"postdeploy": {
|
|
283
280
|
"anyOf": [
|
|
284
281
|
{
|
|
@@ -310,7 +307,6 @@
|
|
|
310
307
|
}
|
|
311
308
|
},
|
|
312
309
|
"required": [
|
|
313
|
-
"location",
|
|
314
310
|
"source"
|
|
315
311
|
],
|
|
316
312
|
"type": "object"
|
|
@@ -319,9 +315,6 @@
|
|
|
319
315
|
"items": {
|
|
320
316
|
"additionalProperties": false,
|
|
321
317
|
"properties": {
|
|
322
|
-
"location": {
|
|
323
|
-
"type": "string"
|
|
324
|
-
},
|
|
325
318
|
"postdeploy": {
|
|
326
319
|
"anyOf": [
|
|
327
320
|
{
|
|
@@ -353,7 +346,6 @@
|
|
|
353
346
|
}
|
|
354
347
|
},
|
|
355
348
|
"required": [
|
|
356
|
-
"location",
|
|
357
349
|
"source"
|
|
358
350
|
],
|
|
359
351
|
"type": "object"
|
package/templates/_gitignore
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
connectorId: "__connectorId__"
|
|
2
2
|
authMode: "PUBLIC"
|
|
3
|
+
## ## Here's an example of how to add generated SDKs.
|
|
4
|
+
## ## You'll need to replace the outputDirs with ones pointing to where you want the generated code in your app.
|
|
5
|
+
# generate:
|
|
6
|
+
# javascriptSdk:
|
|
7
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
8
|
+
# package: "@firebasegen/my-connector"
|
|
9
|
+
# packageJSONDir: < Optional. Path to your Javascript app's package.json>
|
|
10
|
+
# swiftSdk:
|
|
11
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
12
|
+
# kotlinSdk:
|
|
13
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
specVersion: "v1alpha"
|
|
2
2
|
serviceId: "__serviceId__"
|
|
3
|
+
location: "__location__"
|
|
3
4
|
schema:
|
|
4
5
|
source: "./schema"
|
|
5
6
|
datasource:
|
|
@@ -7,4 +8,4 @@ schema:
|
|
|
7
8
|
database: "__cloudSqlDatabase__"
|
|
8
9
|
cloudSql:
|
|
9
10
|
instanceId: "__cloudSqlInstanceId__"
|
|
10
|
-
connectorDirs: [
|
|
11
|
+
connectorDirs: [__connectorIds__]
|