firebase-tools 14.11.2 → 14.12.1
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 +3 -1
- package/lib/command.js +9 -3
- package/lib/commands/firestore-databases-create.js +11 -0
- package/lib/commands/init.js +7 -5
- package/lib/commands/internaltesting-functions-discover.js +20 -5
- package/lib/commands/use.js +5 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -2
- package/lib/dataconnect/ensureApis.js +1 -0
- package/lib/deploy/dataconnect/prepare.js +2 -2
- package/lib/deploy/dataconnect/release.js +2 -2
- package/lib/deploy/firestore/deploy.js +10 -0
- package/lib/deploy/functions/prepare.js +5 -5
- package/lib/deploy/functions/prepareFunctionsUpload.js +3 -1
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/firestore/api-sort.js +96 -3
- package/lib/firestore/api-types.js +20 -1
- package/lib/firestore/api.js +68 -1
- package/lib/firestore/pretty-print.js +5 -1
- package/lib/firestore/validator.js +1 -1
- package/lib/functions/deprecationWarnings.js +4 -4
- package/lib/gcp/cloudsql/connect.js +1 -1
- package/lib/init/features/aitools/claude.js +7 -7
- package/lib/init/features/dataconnect/index.js +1 -1
- package/lib/init/features/dataconnect/sdk.js +2 -3
- package/lib/init/features/index.js +3 -1
- package/lib/init/index.js +8 -0
- package/lib/management/studio.js +120 -0
- package/lib/mcp/index.js +75 -2
- package/lib/mcp/prompt.js +10 -0
- package/lib/mcp/prompts/core/deploy.js +58 -0
- package/lib/mcp/prompts/core/index.js +5 -0
- package/lib/mcp/prompts/index.js +45 -0
- package/lib/mcp/tools/core/consult_assistant.js +7 -2
- package/lib/mcp/tools/core/get_sdk_config.js +10 -0
- package/lib/mcp/tools/core/init.js +1 -1
- package/lib/mcp/tools/database/get_data.js +49 -0
- package/lib/mcp/tools/database/get_rules.js +39 -0
- package/lib/mcp/tools/database/index.js +8 -0
- package/lib/mcp/tools/database/set_data.js +57 -0
- package/lib/mcp/tools/database/set_rules.js +41 -0
- package/lib/mcp/tools/database/validate_rules.js +41 -0
- package/lib/mcp/tools/index.js +4 -1
- package/lib/mcp/tools/rules/get_rules.js +1 -1
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/util.js +2 -0
- package/lib/requireAuth.js +5 -1
- package/lib/rtdb.js +10 -6
- package/lib/scopes.js +2 -1
- package/lib/utils.js +24 -1
- package/package.json +1 -1
- package/prompts/FIREBASE.md +1 -2
- package/schema/firebase-config.json +3 -0
- package/templates/init/firestore/firestore.indexes.json +26 -1
package/lib/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.storageOrigin = exports.runtimeconfigOrigin = exports.rulesOrigin = exports.resourceManagerOrigin = exports.crashlyticsApiOrigin = exports.messagingApiOrigin = exports.remoteConfigApiOrigin = exports.rtdbMetadataOrigin = exports.rtdbManagementOrigin = exports.realtimeOrigin = exports.extensionsTOSOrigin = exports.extensionsPublisherOrigin = exports.extensionsOrigin = exports.iamOrigin = exports.identityOrigin = exports.hostingOrigin = exports.googleOrigin = exports.pubsubOrigin = exports.cloudTasksOrigin = exports.cloudschedulerOrigin = exports.cloudbuildOrigin = exports.functionsDefaultRegion = exports.runOrigin = exports.functionsV2Origin = exports.functionsOrigin = exports.firestoreOrigin = exports.firestoreOriginOrEmulator = exports.firedataOrigin = exports.firebaseExtensionsRegistryOrigin = exports.firebaseApiOrigin = exports.eventarcOrigin = exports.dynamicLinksKey = exports.dynamicLinksOrigin = exports.consoleOrigin = exports.authManagementOrigin = exports.authOrigin = exports.apphostingGitHubAppInstallationURL = exports.apphostingP4SADomain = exports.apphostingOrigin = exports.appDistributionOrigin = exports.artifactRegistryDomain = exports.developerConnectP4SADomain = exports.developerConnectOrigin = exports.containerRegistryDomain = exports.cloudMonitoringOrigin = exports.cloudloggingOrigin = exports.cloudbillingOrigin = exports.clientSecret = exports.clientId = exports.authProxyOrigin = void 0;
|
|
4
|
-
exports.setScopes = exports.getScopes = exports.appTestingOrigin = exports.cloudAiCompanionOrigin = exports.vertexAIOrigin = exports.cloudSQLAdminOrigin = exports.dataConnectLocalConnString = exports.dataconnectP4SADomain = exports.dataconnectOrigin = exports.githubClientSecret = exports.githubClientId = exports.computeOrigin = exports.secretManagerOrigin = exports.githubApiOrigin = exports.githubOrigin = exports.serviceUsageOrigin = exports.cloudRunApiOrigin = exports.hostingApiOrigin = exports.firebaseStorageOrigin = void 0;
|
|
4
|
+
exports.setScopes = exports.getScopes = exports.appTestingOrigin = exports.cloudAiCompanionOrigin = exports.vertexAIOrigin = exports.cloudSQLAdminOrigin = exports.dataConnectLocalConnString = exports.dataconnectP4SADomain = exports.dataconnectOrigin = exports.githubClientSecret = exports.githubClientId = exports.computeOrigin = exports.secretManagerOrigin = exports.githubApiOrigin = exports.githubOrigin = exports.studioApiOrigin = exports.serviceUsageOrigin = exports.cloudRunApiOrigin = exports.hostingApiOrigin = exports.firebaseStorageOrigin = void 0;
|
|
5
5
|
const constants_1 = require("./emulator/constants");
|
|
6
6
|
const logger_1 = require("./logger");
|
|
7
7
|
const scopes = require("./scopes");
|
|
@@ -120,6 +120,8 @@ const cloudRunApiOrigin = () => utils.envOverride("CLOUD_RUN_API_URL", "https://
|
|
|
120
120
|
exports.cloudRunApiOrigin = cloudRunApiOrigin;
|
|
121
121
|
const serviceUsageOrigin = () => utils.envOverride("FIREBASE_SERVICE_USAGE_URL", "https://serviceusage.googleapis.com");
|
|
122
122
|
exports.serviceUsageOrigin = serviceUsageOrigin;
|
|
123
|
+
const studioApiOrigin = () => utils.envOverride("FIREBASE_STUDIO_URL", "https://monospace-pa.googleapis.com");
|
|
124
|
+
exports.studioApiOrigin = studioApiOrigin;
|
|
123
125
|
const githubOrigin = () => utils.envOverride("GITHUB_URL", "https://github.com");
|
|
124
126
|
exports.githubOrigin = githubOrigin;
|
|
125
127
|
const githubApiOrigin = () => utils.envOverride("GITHUB_API_URL", "https://api.github.com");
|
package/lib/command.js
CHANGED
|
@@ -12,8 +12,10 @@ const detectProjectRoot_1 = require("./detectProjectRoot");
|
|
|
12
12
|
const track_1 = require("./track");
|
|
13
13
|
const auth_1 = require("./auth");
|
|
14
14
|
const projects_1 = require("./management/projects");
|
|
15
|
+
const studio_1 = require("./management/studio");
|
|
15
16
|
const requireAuth_1 = require("./requireAuth");
|
|
16
17
|
const logger_1 = require("./logger");
|
|
18
|
+
const env_1 = require("./env");
|
|
17
19
|
class Command {
|
|
18
20
|
constructor(cmd) {
|
|
19
21
|
this.cmd = cmd;
|
|
@@ -184,19 +186,23 @@ class Command {
|
|
|
184
186
|
if (activeAccount) {
|
|
185
187
|
(0, auth_1.setActiveAccount)(options, activeAccount);
|
|
186
188
|
}
|
|
187
|
-
this.applyRC(options);
|
|
189
|
+
await this.applyRC(options);
|
|
188
190
|
if (options.project) {
|
|
189
191
|
await this.resolveProjectIdentifiers(options);
|
|
190
192
|
validateProjectId(options.projectId);
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
|
-
applyRC(options) {
|
|
195
|
+
async applyRC(options) {
|
|
194
196
|
var _a, _b;
|
|
195
197
|
const rc = (0, rc_1.loadRC)(options);
|
|
196
198
|
options.rc = rc;
|
|
197
|
-
|
|
199
|
+
let activeProject = options.projectRoot
|
|
198
200
|
? ((_a = configstore_1.configstore.get("activeProjects")) !== null && _a !== void 0 ? _a : {})[options.projectRoot]
|
|
199
201
|
: undefined;
|
|
202
|
+
const isUseCommand = process.argv.includes("use");
|
|
203
|
+
if ((0, env_1.isFirebaseStudio)() && !options.project && !isUseCommand) {
|
|
204
|
+
activeProject = await (0, studio_1.reconcileStudioFirebaseProject)(options, activeProject);
|
|
205
|
+
}
|
|
200
206
|
options.project = (_b = options.project) !== null && _b !== void 0 ? _b : activeProject;
|
|
201
207
|
if (options.config && !options.project) {
|
|
202
208
|
options.project = options.config.defaults.project;
|
|
@@ -14,6 +14,7 @@ const error_1 = require("../error");
|
|
|
14
14
|
exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
15
15
|
.description("create a database in your Firebase project")
|
|
16
16
|
.option("--location <locationId>", "region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations (required)")
|
|
17
|
+
.option("--edition <edition>", "the edition of the database to create, for example 'standard' or 'enterprise'. If not provided, 'standard' is used as a default.")
|
|
17
18
|
.option("--delete-protection <deleteProtectionState>", "whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
18
19
|
.option("--point-in-time-recovery <enablement>", "whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
19
20
|
.option("-k, --kms-key-name <kmsKeyName>", "the resource ID of a Cloud KMS key. If set, the database created will be a " +
|
|
@@ -29,6 +30,15 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
29
30
|
throw new error_1.FirebaseError(`Missing required flag --location. ${helpCommandText}`);
|
|
30
31
|
}
|
|
31
32
|
const type = types.DatabaseType.FIRESTORE_NATIVE;
|
|
33
|
+
let databaseEdition = types.DatabaseEdition.STANDARD;
|
|
34
|
+
if (options.edition) {
|
|
35
|
+
const edition = options.edition.toUpperCase();
|
|
36
|
+
if (edition !== types.DatabaseEdition.STANDARD &&
|
|
37
|
+
edition !== types.DatabaseEdition.ENTERPRISE) {
|
|
38
|
+
throw new error_1.FirebaseError(`Invalid value for flag --edition. ${helpCommandText}`);
|
|
39
|
+
}
|
|
40
|
+
databaseEdition = edition;
|
|
41
|
+
}
|
|
32
42
|
if (options.deleteProtection &&
|
|
33
43
|
options.deleteProtection !== types.DatabaseDeleteProtectionStateOption.ENABLED &&
|
|
34
44
|
options.deleteProtection !== types.DatabaseDeleteProtectionStateOption.DISABLED) {
|
|
@@ -56,6 +66,7 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
56
66
|
databaseId: database,
|
|
57
67
|
locationId: options.location,
|
|
58
68
|
type,
|
|
69
|
+
databaseEdition,
|
|
59
70
|
deleteProtectionState,
|
|
60
71
|
pointInTimeRecoveryEnablement,
|
|
61
72
|
cmekConfig,
|
package/lib/commands/init.js
CHANGED
|
@@ -16,7 +16,6 @@ const utils = require("../utils");
|
|
|
16
16
|
const experiments_1 = require("../experiments");
|
|
17
17
|
const templates_1 = require("../templates");
|
|
18
18
|
const error_1 = require("../error");
|
|
19
|
-
const track_1 = require("../track");
|
|
20
19
|
const homeDir = os.homedir();
|
|
21
20
|
const BANNER_TEXT = (0, templates_1.readTemplateSync)("banner.txt");
|
|
22
21
|
const GITIGNORE_TEMPLATE = (0, templates_1.readTemplateSync)("_gitignore");
|
|
@@ -106,6 +105,12 @@ if ((0, experiments_1.isEnabled)("apptesting")) {
|
|
|
106
105
|
checked: false,
|
|
107
106
|
});
|
|
108
107
|
}
|
|
108
|
+
choices.push({
|
|
109
|
+
value: "aitools",
|
|
110
|
+
name: "AI Tools: Configure AI coding assistants to work with your Firebase project",
|
|
111
|
+
checked: false,
|
|
112
|
+
hidden: true,
|
|
113
|
+
});
|
|
109
114
|
const featureNames = choices.map((choice) => choice.value);
|
|
110
115
|
const HELP = `Interactively configure the current directory as a Firebase project or initialize new features in an already configured Firebase project directory.
|
|
111
116
|
|
|
@@ -122,14 +127,13 @@ exports.command = new command_1.Command("init [feature]")
|
|
|
122
127
|
.before(requireAuth_1.requireAuth)
|
|
123
128
|
.action(initAction);
|
|
124
129
|
async function initAction(feature, options) {
|
|
125
|
-
var _a
|
|
130
|
+
var _a;
|
|
126
131
|
if (feature && !featureNames.includes(feature)) {
|
|
127
132
|
return utils.reject(clc.bold(feature) +
|
|
128
133
|
" is not a supported feature; must be one of " +
|
|
129
134
|
featureNames.join(", ") +
|
|
130
135
|
".");
|
|
131
136
|
}
|
|
132
|
-
const start = process.uptime();
|
|
133
137
|
const cwd = options.cwd || process.cwd();
|
|
134
138
|
const warnings = [];
|
|
135
139
|
let warningText = "";
|
|
@@ -209,8 +213,6 @@ async function initAction(feature, options) {
|
|
|
209
213
|
if (!fsutils.fileExistsSync(config.path(".gitignore"))) {
|
|
210
214
|
config.writeProjectFile(".gitignore", GITIGNORE_TEMPLATE);
|
|
211
215
|
}
|
|
212
|
-
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
213
|
-
await (0, track_1.trackGA4)("product_init", { products_initialized: (_b = setup.features) === null || _b === void 0 ? void 0 : _b.join(",") }, duration);
|
|
214
216
|
logger_1.logger.info();
|
|
215
217
|
utils.logSuccess("Firebase initialization complete!");
|
|
216
218
|
}
|
|
@@ -8,6 +8,10 @@ const projectConfig_1 = require("../functions/projectConfig");
|
|
|
8
8
|
const adminSdkConfig_1 = require("../emulator/adminSdkConfig");
|
|
9
9
|
const projectUtils_1 = require("../projectUtils");
|
|
10
10
|
const error_1 = require("../error");
|
|
11
|
+
const ensureApiEnabled = require("../ensureApiEnabled");
|
|
12
|
+
const api_1 = require("../api");
|
|
13
|
+
const experiments = require("../experiments");
|
|
14
|
+
const prepareFunctionsUpload_1 = require("../deploy/functions/prepareFunctionsUpload");
|
|
11
15
|
exports.command = new command_1.Command("internaltesting:functions:discover")
|
|
12
16
|
.description("discover function triggers defined in the current project directory")
|
|
13
17
|
.action(async (options) => {
|
|
@@ -17,9 +21,20 @@ exports.command = new command_1.Command("internaltesting:functions:discover")
|
|
|
17
21
|
if (!firebaseConfig) {
|
|
18
22
|
throw new error_1.FirebaseError("Admin SDK config unexpectedly undefined - have you run firebase init?");
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let runtimeConfig = { firebase: firebaseConfig };
|
|
25
|
+
const allowFunctionsConfig = experiments.isEnabled("dangerouslyAllowFunctionsConfig");
|
|
26
|
+
if (allowFunctionsConfig) {
|
|
27
|
+
try {
|
|
28
|
+
const runtimeConfigApiEnabled = await ensureApiEnabled.check(projectId, (0, api_1.runtimeconfigOrigin)(), "runtimeconfig", true);
|
|
29
|
+
if (runtimeConfigApiEnabled) {
|
|
30
|
+
runtimeConfig = Object.assign(Object.assign({}, runtimeConfig), (await (0, prepareFunctionsUpload_1.getFunctionsConfig)(projectId)));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
logger_1.logger.debug("Could not check Runtime Config API status, assuming disabled:", err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const wantBuilds = await (0, prepare_1.loadCodebases)(fnConfig, options, firebaseConfig, runtimeConfig, undefined);
|
|
38
|
+
logger_1.logger.info(JSON.stringify(wantBuilds, null, 2));
|
|
39
|
+
return wantBuilds;
|
|
25
40
|
});
|
package/lib/commands/use.js
CHANGED
|
@@ -4,12 +4,14 @@ exports.command = exports.setNewActive = void 0;
|
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const projects_1 = require("../management/projects");
|
|
7
|
+
const studio_1 = require("../management/studio");
|
|
7
8
|
const logger_1 = require("../logger");
|
|
8
9
|
const prompt_1 = require("../prompt");
|
|
9
10
|
const requireAuth_1 = require("../requireAuth");
|
|
10
11
|
const command_2 = require("../command");
|
|
11
12
|
const utils = require("../utils");
|
|
12
13
|
const error_1 = require("../error");
|
|
14
|
+
const env_1 = require("../env");
|
|
13
15
|
function listAliases(options) {
|
|
14
16
|
if (options.rc.hasProjects) {
|
|
15
17
|
logger_1.logger.info("Project aliases for", clc.bold(options.projectRoot || "") + ":");
|
|
@@ -41,6 +43,9 @@ async function setNewActive(projectOrAlias, aliasOpt, rc, projectRoot) {
|
|
|
41
43
|
catch (_a) {
|
|
42
44
|
throw new error_1.FirebaseError("Invalid project selection, " + verifyMessage(projectOrAlias));
|
|
43
45
|
}
|
|
46
|
+
if ((0, env_1.isFirebaseStudio)()) {
|
|
47
|
+
await (0, studio_1.updateStudioFirebaseProject)(resolvedProject);
|
|
48
|
+
}
|
|
44
49
|
if (aliasOpt) {
|
|
45
50
|
if (!project) {
|
|
46
51
|
throw new error_1.FirebaseError(`Cannot create alias ${clc.bold(aliasOpt)}, ${verifyMessage(projectOrAlias)}`);
|
|
@@ -8,7 +8,6 @@ const spawn = require("cross-spawn");
|
|
|
8
8
|
const downloadUtils = require("../downloadUtils");
|
|
9
9
|
const error_1 = require("../error");
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
|
-
const node_fs_1 = require("node:fs");
|
|
12
11
|
const utils = require("../utils");
|
|
13
12
|
const JAR_CACHE_DIR = process.env.FIREBASE_CRASHLYTICS_BUILDTOOLS_PATH ||
|
|
14
13
|
path.join(os.homedir(), ".cache", "firebase", "crashlytics", "buildtools");
|
|
@@ -26,7 +25,7 @@ async function fetchBuildtoolsJar() {
|
|
|
26
25
|
}
|
|
27
26
|
if (fs.existsSync(JAR_CACHE_DIR)) {
|
|
28
27
|
logger_1.logger.debug(`Deleting Jar cache at ${JAR_CACHE_DIR} because the CLI was run with a newer Jar version`);
|
|
29
|
-
|
|
28
|
+
fs.rmSync(JAR_CACHE_DIR, { recursive: true, force: true });
|
|
30
29
|
}
|
|
31
30
|
utils.logBullet("Downloading crashlytics-buildtools.jar to " + jarPath);
|
|
32
31
|
utils.logBullet("For open source licenses used by this command, look in the META-INF directory in the buildtools.jar file");
|
|
@@ -12,6 +12,7 @@ async function ensureApis(projectId) {
|
|
|
12
12
|
exports.ensureApis = ensureApis;
|
|
13
13
|
async function ensureSparkApis(projectId) {
|
|
14
14
|
await (0, ensureApiEnabled_1.ensure)(projectId, api.cloudSQLAdminOrigin(), prefix);
|
|
15
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, api.dataconnectOrigin(), prefix);
|
|
15
16
|
}
|
|
16
17
|
exports.ensureSparkApis = ensureSparkApis;
|
|
17
18
|
async function ensureGIFApis(projectId) {
|
|
@@ -19,7 +19,7 @@ const types_1 = require("../../dataconnect/types");
|
|
|
19
19
|
const schemaMigration_1 = require("../../dataconnect/schemaMigration");
|
|
20
20
|
const freeTrial_1 = require("../../dataconnect/freeTrial");
|
|
21
21
|
async function default_1(context, options) {
|
|
22
|
-
var _a;
|
|
22
|
+
var _a, _b, _c;
|
|
23
23
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
24
24
|
if (!(await (0, cloudbilling_1.checkBillingEnabled)(projectId))) {
|
|
25
25
|
throw new error_1.FirebaseError((0, freeTrial_1.upgradeInstructions)(projectId));
|
|
@@ -53,7 +53,7 @@ async function default_1(context, options) {
|
|
|
53
53
|
utils.logLabeledBullet("dataconnect", `Successfully prepared schema and connectors`);
|
|
54
54
|
if (options.dryRun) {
|
|
55
55
|
for (const si of serviceInfos) {
|
|
56
|
-
await (0, schemaMigration_1.diffSchema)(options, si.schema, (_a = si.dataConnectYaml.schema.datasource.postgresql) === null ||
|
|
56
|
+
await (0, schemaMigration_1.diffSchema)(options, si.schema, (_c = (_b = (_a = si.dataConnectYaml.schema) === null || _a === void 0 ? void 0 : _a.datasource) === null || _b === void 0 ? void 0 : _b.postgresql) === null || _c === void 0 ? void 0 : _c.schemaValidation);
|
|
57
57
|
}
|
|
58
58
|
utils.logLabeledBullet("dataconnect", "Checking for CloudSQL resources...");
|
|
59
59
|
await Promise.all(serviceInfos
|
|
@@ -17,10 +17,10 @@ async function default_1(context, options) {
|
|
|
17
17
|
}));
|
|
18
18
|
})
|
|
19
19
|
.map((s) => {
|
|
20
|
-
var _a;
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
21
|
return ({
|
|
22
22
|
schema: s.schema,
|
|
23
|
-
validationMode: (_a = s.dataConnectYaml.schema.datasource.postgresql) === null ||
|
|
23
|
+
validationMode: (_d = (_c = (_b = (_a = s.dataConnectYaml) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.datasource) === null || _c === void 0 ? void 0 : _c.postgresql) === null || _d === void 0 ? void 0 : _d.schemaValidation,
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
if (wantSchemas.length) {
|
|
@@ -22,6 +22,15 @@ async function createDatabase(context, options) {
|
|
|
22
22
|
if (!firestoreCfg.database) {
|
|
23
23
|
firestoreCfg.database = "(default)";
|
|
24
24
|
}
|
|
25
|
+
let edition = types.DatabaseEdition.STANDARD;
|
|
26
|
+
if (firestoreCfg.edition) {
|
|
27
|
+
const upperEdition = firestoreCfg.edition.toUpperCase();
|
|
28
|
+
if (upperEdition !== types.DatabaseEdition.STANDARD &&
|
|
29
|
+
upperEdition !== types.DatabaseEdition.ENTERPRISE) {
|
|
30
|
+
throw new error_1.FirebaseError(`Invalid edition specified for database in firebase.json: ${firestoreCfg.edition}`);
|
|
31
|
+
}
|
|
32
|
+
edition = upperEdition;
|
|
33
|
+
}
|
|
25
34
|
const api = new api_1.FirestoreApi();
|
|
26
35
|
try {
|
|
27
36
|
await api.getDatabase(options.projectId, firestoreCfg.database);
|
|
@@ -34,6 +43,7 @@ async function createDatabase(context, options) {
|
|
|
34
43
|
databaseId: firestoreCfg.database,
|
|
35
44
|
locationId: firestoreCfg.location || "nam5",
|
|
36
45
|
type: types.DatabaseType.FIRESTORE_NATIVE,
|
|
46
|
+
databaseEdition: edition,
|
|
37
47
|
deleteProtectionState: types.DatabaseDeleteProtectionState.DISABLED,
|
|
38
48
|
pointInTimeRecoveryEnablement: types.PointInTimeRecoveryEnablement.DISABLED,
|
|
39
49
|
};
|
|
@@ -11,6 +11,7 @@ const runtimes = require("./runtimes");
|
|
|
11
11
|
const supported = require("./runtimes/supported");
|
|
12
12
|
const validate = require("./validate");
|
|
13
13
|
const ensure = require("./ensure");
|
|
14
|
+
const experiments = require("../../experiments");
|
|
14
15
|
const api_1 = require("../../api");
|
|
15
16
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
16
17
|
const utils_1 = require("../../utils");
|
|
@@ -51,13 +52,12 @@ async function prepare(context, options, payload) {
|
|
|
51
52
|
]);
|
|
52
53
|
const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
|
|
53
54
|
context.firebaseConfig = firebaseConfig;
|
|
55
|
+
context.codebaseDeployEvents = {};
|
|
54
56
|
let runtimeConfig = { firebase: firebaseConfig };
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
runtimeConfig = Object.assign(Object.assign({}, runtimeConfig),
|
|
58
|
-
context.hasRuntimeConfig = Object.keys(config).length > 0;
|
|
57
|
+
const allowFunctionsConfig = experiments.isEnabled("dangerouslyAllowFunctionsConfig");
|
|
58
|
+
if (allowFunctionsConfig && checkAPIsEnabled[1]) {
|
|
59
|
+
runtimeConfig = Object.assign(Object.assign({}, runtimeConfig), (await (0, prepareFunctionsUpload_1.getFunctionsConfig)(projectId)));
|
|
59
60
|
}
|
|
60
|
-
context.codebaseDeployEvents = {};
|
|
61
61
|
const wantBuilds = await loadCodebases(context.config, options, firebaseConfig, runtimeConfig, context.filters);
|
|
62
62
|
if (Object.values(wantBuilds).some((b) => b.extensions)) {
|
|
63
63
|
const extContext = {};
|
|
@@ -74,7 +74,9 @@ async function packageSource(sourceDir, config, runtimeConfig) {
|
|
|
74
74
|
name: CONFIG_DEST_FILE,
|
|
75
75
|
mode: 420,
|
|
76
76
|
});
|
|
77
|
-
(
|
|
77
|
+
if (Object.keys(runtimeConfig).some((k) => k !== "firebase")) {
|
|
78
|
+
(0, deprecationWarnings_1.logFunctionsConfigDeprecationWarning)();
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
await pipeAsync(archive, fileStream);
|
|
80
82
|
}
|
|
@@ -54,28 +54,28 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "2.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-v2.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.
|
|
57
|
+
"version": "2.11.1",
|
|
58
|
+
"expectedSize": 29352800,
|
|
59
|
+
"expectedChecksum": "52d86a5546bbb9e2fcd67faa90b9f07e",
|
|
60
|
+
"expectedChecksumSHA256": "217b66589c32d4378201100fa968e69f7c94537044b892be1aaa14d7f6ce6b12",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-v2.11.1",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.11.1"
|
|
63
63
|
},
|
|
64
64
|
"win32": {
|
|
65
|
-
"version": "2.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-v2.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.
|
|
65
|
+
"version": "2.11.1",
|
|
66
|
+
"expectedSize": 29841920,
|
|
67
|
+
"expectedChecksum": "704cee75ad2d384cf28ac1683c8d1179",
|
|
68
|
+
"expectedChecksumSHA256": "fadb5a1d0f03160c133389df9d452cc620cfdface041971a5356ac5a69e937ff",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-v2.11.1",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.11.1.exe"
|
|
71
71
|
},
|
|
72
72
|
"linux": {
|
|
73
|
-
"version": "2.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-v2.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.
|
|
73
|
+
"version": "2.11.1",
|
|
74
|
+
"expectedSize": 29282488,
|
|
75
|
+
"expectedChecksum": "435656eab760033228bf7b7e77d56dde",
|
|
76
|
+
"expectedChecksumSHA256": "0abb33c0bba0ed8ef1394cc1cab5a333ec81b3dddf48aa625abe8ca28f38840e",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-v2.11.1",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-2.11.1"
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -8,6 +8,19 @@ const QUERY_SCOPE_SEQUENCE = [
|
|
|
8
8
|
API.QueryScope.COLLECTION,
|
|
9
9
|
undefined,
|
|
10
10
|
];
|
|
11
|
+
const API_SCOPE_SEQUENCE = [
|
|
12
|
+
API.ApiScope.ANY_API,
|
|
13
|
+
API.ApiScope.DATASTORE_MODE_API,
|
|
14
|
+
API.ApiScope.MONGODB_COMPATIBLE_API,
|
|
15
|
+
undefined,
|
|
16
|
+
];
|
|
17
|
+
const DENSITY_SEQUENCE = [
|
|
18
|
+
API.Density.DENSITY_UNSPECIFIED,
|
|
19
|
+
API.Density.SPARSE_ALL,
|
|
20
|
+
API.Density.SPARSE_ANY,
|
|
21
|
+
API.Density.DENSE,
|
|
22
|
+
undefined,
|
|
23
|
+
];
|
|
11
24
|
const ORDER_SEQUENCE = [API.Order.ASCENDING, API.Order.DESCENDING, undefined];
|
|
12
25
|
const ARRAY_CONFIG_SEQUENCE = [API.ArrayConfig.CONTAINS, undefined];
|
|
13
26
|
function compareSpecIndex(a, b) {
|
|
@@ -17,7 +30,23 @@ function compareSpecIndex(a, b) {
|
|
|
17
30
|
if (a.queryScope !== b.queryScope) {
|
|
18
31
|
return compareQueryScope(a.queryScope, b.queryScope);
|
|
19
32
|
}
|
|
20
|
-
|
|
33
|
+
let cmp = compareArrays(a.fields, b.fields, compareIndexField);
|
|
34
|
+
if (cmp !== 0) {
|
|
35
|
+
return cmp;
|
|
36
|
+
}
|
|
37
|
+
cmp = compareApiScope(a.apiScope, b.apiScope);
|
|
38
|
+
if (cmp !== 0) {
|
|
39
|
+
return cmp;
|
|
40
|
+
}
|
|
41
|
+
cmp = compareDensity(a.density, b.density);
|
|
42
|
+
if (cmp !== 0) {
|
|
43
|
+
return cmp;
|
|
44
|
+
}
|
|
45
|
+
cmp = compareBoolean(a.multikey, b.multikey);
|
|
46
|
+
if (cmp !== 0) {
|
|
47
|
+
return cmp;
|
|
48
|
+
}
|
|
49
|
+
return compareBoolean(a.unique, b.unique);
|
|
21
50
|
}
|
|
22
51
|
exports.compareSpecIndex = compareSpecIndex;
|
|
23
52
|
function compareApiIndex(a, b) {
|
|
@@ -31,7 +60,23 @@ function compareApiIndex(a, b) {
|
|
|
31
60
|
if (a.queryScope !== b.queryScope) {
|
|
32
61
|
return compareQueryScope(a.queryScope, b.queryScope);
|
|
33
62
|
}
|
|
34
|
-
|
|
63
|
+
let cmp = compareArrays(a.fields, b.fields, compareIndexField);
|
|
64
|
+
if (cmp !== 0) {
|
|
65
|
+
return cmp;
|
|
66
|
+
}
|
|
67
|
+
cmp = compareApiScope(a.apiScope, b.apiScope);
|
|
68
|
+
if (cmp !== 0) {
|
|
69
|
+
return cmp;
|
|
70
|
+
}
|
|
71
|
+
cmp = compareDensity(a.density, b.density);
|
|
72
|
+
if (cmp !== 0) {
|
|
73
|
+
return cmp;
|
|
74
|
+
}
|
|
75
|
+
cmp = compareBoolean(a.multikey, b.multikey);
|
|
76
|
+
if (cmp !== 0) {
|
|
77
|
+
return cmp;
|
|
78
|
+
}
|
|
79
|
+
return compareBoolean(a.unique, b.unique);
|
|
35
80
|
}
|
|
36
81
|
exports.compareApiIndex = compareApiIndex;
|
|
37
82
|
function compareApiDatabase(a, b) {
|
|
@@ -115,14 +160,62 @@ function compareFieldIndex(a, b) {
|
|
|
115
160
|
if (a.arrayConfig !== b.arrayConfig) {
|
|
116
161
|
return compareArrayConfig(a.arrayConfig, b.arrayConfig);
|
|
117
162
|
}
|
|
118
|
-
|
|
163
|
+
let cmp = compareApiScope(a.apiScope, b.apiScope);
|
|
164
|
+
if (cmp !== 0) {
|
|
165
|
+
return cmp;
|
|
166
|
+
}
|
|
167
|
+
cmp = compareDensity(a.density, b.density);
|
|
168
|
+
if (cmp !== 0) {
|
|
169
|
+
return cmp;
|
|
170
|
+
}
|
|
171
|
+
cmp = compareBoolean(a.multikey, b.multikey);
|
|
172
|
+
if (cmp !== 0) {
|
|
173
|
+
return cmp;
|
|
174
|
+
}
|
|
175
|
+
return compareBoolean(a.unique, b.unique);
|
|
119
176
|
}
|
|
120
177
|
function compareQueryScope(a, b) {
|
|
121
178
|
return QUERY_SCOPE_SEQUENCE.indexOf(a) - QUERY_SCOPE_SEQUENCE.indexOf(b);
|
|
122
179
|
}
|
|
180
|
+
function compareApiScope(a, b) {
|
|
181
|
+
if (a === b) {
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
if (a === undefined) {
|
|
185
|
+
return -1;
|
|
186
|
+
}
|
|
187
|
+
if (b === undefined) {
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
190
|
+
return API_SCOPE_SEQUENCE.indexOf(a) - API_SCOPE_SEQUENCE.indexOf(b);
|
|
191
|
+
}
|
|
192
|
+
function compareDensity(a, b) {
|
|
193
|
+
if (a === b) {
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
if (a === undefined) {
|
|
197
|
+
return -1;
|
|
198
|
+
}
|
|
199
|
+
if (b === undefined) {
|
|
200
|
+
return 1;
|
|
201
|
+
}
|
|
202
|
+
return DENSITY_SEQUENCE.indexOf(a) - DENSITY_SEQUENCE.indexOf(b);
|
|
203
|
+
}
|
|
123
204
|
function compareOrder(a, b) {
|
|
124
205
|
return ORDER_SEQUENCE.indexOf(a) - ORDER_SEQUENCE.indexOf(b);
|
|
125
206
|
}
|
|
207
|
+
function compareBoolean(a, b) {
|
|
208
|
+
if (a === b) {
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
if (a === undefined) {
|
|
212
|
+
return -1;
|
|
213
|
+
}
|
|
214
|
+
if (b === undefined) {
|
|
215
|
+
return 1;
|
|
216
|
+
}
|
|
217
|
+
return Number(a) - Number(b);
|
|
218
|
+
}
|
|
126
219
|
function compareArrayConfig(a, b) {
|
|
127
220
|
return ARRAY_CONFIG_SEQUENCE.indexOf(a) - ARRAY_CONFIG_SEQUENCE.indexOf(b);
|
|
128
221
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RecurrenceType = exports.PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablementOption = exports.DatabaseDeleteProtectionState = exports.DatabaseDeleteProtectionStateOption = exports.DatabaseType = exports.StateTtl = exports.State = exports.ArrayConfig = exports.Order = exports.QueryScope = exports.Mode = void 0;
|
|
3
|
+
exports.RecurrenceType = exports.DatabaseEdition = exports.PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablementOption = exports.DatabaseDeleteProtectionState = exports.DatabaseDeleteProtectionStateOption = exports.DatabaseType = exports.StateTtl = exports.State = exports.ArrayConfig = exports.Order = exports.Density = exports.ApiScope = exports.QueryScope = exports.Mode = void 0;
|
|
4
4
|
var Mode;
|
|
5
5
|
(function (Mode) {
|
|
6
6
|
Mode["ASCENDING"] = "ASCENDING";
|
|
@@ -12,6 +12,19 @@ var QueryScope;
|
|
|
12
12
|
QueryScope["COLLECTION"] = "COLLECTION";
|
|
13
13
|
QueryScope["COLLECTION_GROUP"] = "COLLECTION_GROUP";
|
|
14
14
|
})(QueryScope = exports.QueryScope || (exports.QueryScope = {}));
|
|
15
|
+
var ApiScope;
|
|
16
|
+
(function (ApiScope) {
|
|
17
|
+
ApiScope["ANY_API"] = "ANY_API";
|
|
18
|
+
ApiScope["DATASTORE_MODE_API"] = "DATASTORE_MODE_API";
|
|
19
|
+
ApiScope["MONGODB_COMPATIBLE_API"] = "MONGODB_COMPATIBLE_API";
|
|
20
|
+
})(ApiScope = exports.ApiScope || (exports.ApiScope = {}));
|
|
21
|
+
var Density;
|
|
22
|
+
(function (Density) {
|
|
23
|
+
Density["DENSITY_UNSPECIFIED"] = "DENSITY_UNSPECIFIED";
|
|
24
|
+
Density["SPARSE_ALL"] = "SPARSE_ALL";
|
|
25
|
+
Density["SPARSE_ANY"] = "SPARSE_ANY";
|
|
26
|
+
Density["DENSE"] = "DENSE";
|
|
27
|
+
})(Density = exports.Density || (exports.Density = {}));
|
|
15
28
|
var Order;
|
|
16
29
|
(function (Order) {
|
|
17
30
|
Order["ASCENDING"] = "ASCENDING";
|
|
@@ -58,6 +71,12 @@ var PointInTimeRecoveryEnablement;
|
|
|
58
71
|
PointInTimeRecoveryEnablement["ENABLED"] = "POINT_IN_TIME_RECOVERY_ENABLED";
|
|
59
72
|
PointInTimeRecoveryEnablement["DISABLED"] = "POINT_IN_TIME_RECOVERY_DISABLED";
|
|
60
73
|
})(PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablement || (exports.PointInTimeRecoveryEnablement = {}));
|
|
74
|
+
var DatabaseEdition;
|
|
75
|
+
(function (DatabaseEdition) {
|
|
76
|
+
DatabaseEdition["DATABASE_EDITION_UNSPECIFIED"] = "DATABASE_EDITION_UNSPECIFIED";
|
|
77
|
+
DatabaseEdition["STANDARD"] = "STANDARD";
|
|
78
|
+
DatabaseEdition["ENTERPRISE"] = "ENTERPRISE";
|
|
79
|
+
})(DatabaseEdition = exports.DatabaseEdition || (exports.DatabaseEdition = {}));
|
|
61
80
|
var RecurrenceType;
|
|
62
81
|
(function (RecurrenceType) {
|
|
63
82
|
RecurrenceType["DAILY"] = "DAILY";
|