firebase-tools
Advanced tools
Comparing version 13.14.2 to 13.15.0
@@ -13,8 +13,6 @@ #!/usr/bin/env node | ||
const clc = require("colorette"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const updateNotifier = updateNotifierPkg({ pkg }); | ||
const marked_1 = require("marked"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
const node_path_1 = require("node:path"); | ||
@@ -21,0 +19,0 @@ const triple_beam_1 = require("triple-beam"); |
@@ -110,3 +110,9 @@ "use strict"; | ||
catch (err) { | ||
if (err === getDefaultHostingSite_1.errNoDefaultSite) { | ||
const isPermissionError = err instanceof error_1.FirebaseError && | ||
err.original instanceof error_1.FirebaseError && | ||
err.original.status === 403; | ||
if (isPermissionError) { | ||
throw err; | ||
} | ||
else if (err === getDefaultHostingSite_1.errNoDefaultSite) { | ||
createSite = true; | ||
@@ -113,0 +119,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.command = void 0; | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion"); | ||
@@ -22,5 +20,2 @@ const command_1 = require("../command"); | ||
const tos_1 = require("../extensions/tos"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
exports.command = new command_1.Command("ext:configure <extensionInstanceId>") | ||
@@ -103,3 +98,3 @@ .description("configure an existing extension instance") | ||
const plural = immutableParams.length > 1; | ||
utils.logLabeledWarning(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`The following param${plural ? "s are" : " is"} immutable and won't be changed:`)); | ||
utils.logLabeledWarning(extensionsHelper_1.logPrefix, `The following param${plural ? "s are" : " is"} immutable and won't be changed:`); | ||
for (const { param } of immutableParams) { | ||
@@ -106,0 +101,0 @@ logger_1.logger.info(`param: ${param}, value: ${paramValues[param]}`); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion"); | ||
@@ -15,5 +15,3 @@ const command_1 = require("../command"); | ||
const templates_1 = require("../templates"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
function readCommonTemplates() { | ||
@@ -20,0 +18,0 @@ return { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const command_1 = require("../command"); | ||
@@ -20,5 +20,3 @@ const extensionsHelper_1 = require("../extensions/extensionsHelper"); | ||
const projects_1 = require("../management/projects"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
exports.command = new command_1.Command("ext:dev:upload <extensionRef>") | ||
@@ -84,5 +82,5 @@ .description(`upload a new version of an extension`) | ||
if (res) { | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`)); | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, await (0, marked_1.marked)(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`)); | ||
const version = res.ref.split("@")[1]; | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`[View in Console](${utils.consoleUrl(projectId, `/publisher/extensions/${extensionId}/v/${version}`)})`)); | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, await (0, marked_1.marked)(`[View in Console](${utils.consoleUrl(projectId, `/publisher/extensions/${extensionId}/v/${version}`)})`)); | ||
} | ||
@@ -89,0 +87,0 @@ return res; |
@@ -14,3 +14,3 @@ "use strict"; | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const FUNCTION_TYPE_REGEX = /\..+\.function/; | ||
@@ -112,6 +112,4 @@ exports.command = new command_1.Command("ext:info <extensionName>") | ||
else { | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
logger_1.logger.info((0, marked_1.marked)(lines.join("\n"))); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
logger_1.logger.info(await (0, marked_1.marked)(lines.join("\n"))); | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension, type ` + | ||
@@ -118,0 +116,0 @@ clc.bold(`firebase ext:install ${extensionName} --project=YOUR_PROJECT`)); |
@@ -5,5 +5,3 @@ "use strict"; | ||
const clc = require("colorette"); | ||
const marked_1 = require("marked"); | ||
const semver = require("semver"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const displayExtensionInfo_1 = require("../extensions/displayExtensionInfo"); | ||
@@ -29,5 +27,2 @@ const askUserForEventsConfig = require("../extensions/askUserForEventsConfig"); | ||
const tos_1 = require("../extensions/tos"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
exports.command = new command_1.Command("ext:install [extensionRef]") | ||
@@ -34,0 +29,0 @@ .description("add an uploaded extension to firebase.json if [publisherId/extensionId] is provided;" + |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.command = void 0; | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion"); | ||
@@ -12,5 +10,2 @@ const command_1 = require("../command"); | ||
const manifest = require("../extensions/manifest"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
exports.command = new command_1.Command("ext:uninstall <extensionInstanceId>") | ||
@@ -17,0 +12,0 @@ .description("uninstall an extension that is installed in your Firebase project by instance ID") |
@@ -5,4 +5,2 @@ "use strict"; | ||
const clc = require("colorette"); | ||
const marked_1 = require("marked"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion"); | ||
@@ -24,5 +22,2 @@ const command_1 = require("../command"); | ||
const tos_1 = require("../extensions/tos"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
exports.command = new command_1.Command("ext:update <extensionInstanceId> [updateSource]") | ||
@@ -29,0 +24,0 @@ .description("update an existing extension instance to the latest version, or to a specific version if provided") |
@@ -19,2 +19,5 @@ "use strict"; | ||
.option("--point-in-time-recovery <enablement>", "Whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'") | ||
.option("-k, --kms-key-name <kmsKeyName>", "The resource ID of a Cloud KMS key. If set, the database created will be a " + | ||
"Customer-managed Encryption Key (CMEK) database encrypted with this key. " + | ||
"This feature is allowlist only in initial launch.") | ||
.before(requirePermissions_1.requirePermissions, ["datastore.databases.create"]) | ||
@@ -46,3 +49,18 @@ .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE) | ||
: types.PointInTimeRecoveryEnablement.DISABLED; | ||
const databaseResp = await api.createDatabase(options.project, database, options.location, type, deleteProtectionState, pointInTimeRecoveryEnablement); | ||
let cmekConfig; | ||
if (options.kmsKeyName) { | ||
cmekConfig = { | ||
kmsKeyName: options.kmsKeyName, | ||
}; | ||
} | ||
const createDatabaseReq = { | ||
project: options.project, | ||
databaseId: database, | ||
locationId: options.location, | ||
type, | ||
deleteProtectionState, | ||
pointInTimeRecoveryEnablement, | ||
cmekConfig, | ||
}; | ||
const databaseResp = await api.createDatabase(createDatabaseReq); | ||
if (options.json) { | ||
@@ -49,0 +67,0 @@ logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2)); |
@@ -57,8 +57,11 @@ "use strict"; | ||
if (!options.force) { | ||
const confirm = await (0, prompt_1.promptOnce)({ | ||
name: "redeploy", | ||
type: "confirm", | ||
default: true, | ||
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`, | ||
}, options); | ||
let confirm = false; | ||
if (!options.nonInteractive) { | ||
confirm = await (0, prompt_1.promptOnce)({ | ||
name: "redeploy", | ||
type: "confirm", | ||
default: true, | ||
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`, | ||
}, options); | ||
} | ||
if (!confirm) { | ||
@@ -65,0 +68,0 @@ (0, utils_1.logBullet)("Please deploy your functions for the change to take effect by running:\n\t" + |
@@ -68,3 +68,3 @@ "use strict"; | ||
catch (e) { | ||
(0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
(0, utils_1.logLabeledWarning)(LOG_TAG, await (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
logger_1.logger.debug("[hosting] unable to add auth domain", e); | ||
@@ -71,0 +71,0 @@ } |
@@ -42,3 +42,3 @@ "use strict"; | ||
catch (e) { | ||
(0, utils_1.logLabeledWarning)("hosting:channel", (0, marked_1.marked)(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
(0, utils_1.logLabeledWarning)("hosting:channel", await (0, marked_1.marked)(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
logger_1.logger.debug("[hosting] unable to remove auth domain", e); | ||
@@ -45,0 +45,0 @@ } |
@@ -136,3 +136,3 @@ "use strict"; | ||
catch (e) { | ||
(0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
(0, utils_1.logLabeledWarning)(LOG_TAG, await (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`)); | ||
logger_1.logger.debug("[hosting] unable to add auth domain", e); | ||
@@ -139,0 +139,0 @@ } |
@@ -11,3 +11,2 @@ "use strict"; | ||
const requireAuth_1 = require("../requireAuth"); | ||
const marked_1 = require("marked"); | ||
const logger_1 = require("../logger"); | ||
@@ -72,3 +71,3 @@ exports.command = new command_1.Command("hosting:clone <source> <targetChannel>") | ||
catch (e) { | ||
utils.logLabeledWarning("hosting:clone", (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`)); | ||
utils.logLabeledWarning("hosting:clone", `Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`); | ||
logger_1.logger.debug("[hosting] unable to add auth domain", e); | ||
@@ -75,0 +74,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pickService = exports.readGQLFiles = exports.readConnectorYaml = exports.readDataConnectYaml = exports.readFirebaseJson = void 0; | ||
exports.getPlatformFromFolder = exports.pickService = exports.readGQLFiles = exports.readConnectorYaml = exports.readDataConnectYaml = exports.readFirebaseJson = void 0; | ||
const fs = require("fs-extra"); | ||
const path = require("path"); | ||
const error_1 = require("../error"); | ||
const types_1 = require("./types"); | ||
const utils_1 = require("../utils"); | ||
@@ -95,1 +96,21 @@ const load_1 = require("./load"); | ||
exports.pickService = pickService; | ||
const WEB_INDICATORS = ["package.json", "package-lock.json", "node_modules"]; | ||
const IOS_INDICATORS = ["info.plist", "podfile", "package.swift"]; | ||
const ANDROID_INDICATORS = ["androidmanifest.xml", "build.gradle"]; | ||
const IOS_INDICATORS_2 = [".xcworkspace", ".xcodeproj"]; | ||
async function getPlatformFromFolder(dirPath) { | ||
const fileNames = await fs.readdir(dirPath); | ||
for (const fileName of fileNames) { | ||
const cleanedFileName = fileName.toLowerCase(); | ||
if (WEB_INDICATORS.some((indicator) => indicator === cleanedFileName)) | ||
return types_1.Platform.WEB; | ||
if (ANDROID_INDICATORS.some((indicator) => indicator === cleanedFileName)) | ||
return types_1.Platform.ANDROID; | ||
if (IOS_INDICATORS.some((indicator) => indicator === cleanedFileName)) | ||
return types_1.Platform.IOS; | ||
if (IOS_INDICATORS_2.some((indicator) => cleanedFileName.endsWith(indicator))) | ||
return types_1.Platform.IOS; | ||
} | ||
return types_1.Platform.UNDETERMINED; | ||
} | ||
exports.getPlatformFromFolder = getPlatformFromFolder; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toDatasource = exports.requiresVector = exports.SCHEMA_ID = void 0; | ||
exports.toDatasource = exports.Platform = exports.requiresVector = exports.SCHEMA_ID = void 0; | ||
exports.SCHEMA_ID = "main"; | ||
@@ -10,2 +10,9 @@ function requiresVector(dm) { | ||
exports.requiresVector = requiresVector; | ||
var Platform; | ||
(function (Platform) { | ||
Platform["ANDROID"] = "ANDROID"; | ||
Platform["WEB"] = "WEB"; | ||
Platform["IOS"] = "IOS"; | ||
Platform["UNDETERMINED"] = "UNDETERMINED"; | ||
})(Platform = exports.Platform || (exports.Platform = {})); | ||
function toDatasource(projectId, locationId, ds) { | ||
@@ -12,0 +19,0 @@ if (ds.postgresql) { |
@@ -56,2 +56,4 @@ "use strict"; | ||
config_dir: resolvedConfigDir, | ||
enable_output_schema_extensions: true, | ||
enable_output_generated_sdk: true, | ||
}); | ||
@@ -58,0 +60,0 @@ this.usingExistingEmulator = false; |
@@ -49,16 +49,16 @@ "use strict"; | ||
? { | ||
version: "1.3.1", | ||
expectedSize: 24175424, | ||
expectedChecksum: "9ce1ee2ed6994ca62df6dfef3fdece62", | ||
version: "1.3.2", | ||
expectedSize: 24195840, | ||
expectedChecksum: "b60f4501c657bec4dc8df3f3ec7ab3fd", | ||
} | ||
: process.platform === "win32" | ||
? { | ||
version: "1.3.1", | ||
expectedSize: 24587264, | ||
expectedChecksum: "1d31fd26506cfc9b822fdb8e8834d14c", | ||
version: "1.3.2", | ||
expectedSize: 24610304, | ||
expectedChecksum: "37d5e08f4df5e07b41160b8f2fd90135", | ||
} | ||
: { | ||
version: "1.3.1", | ||
expectedSize: 24088728, | ||
expectedChecksum: "223f7eebde618ba92788579dd35fec43", | ||
version: "1.3.2", | ||
expectedSize: 24109208, | ||
expectedChecksum: "52b09c69bc9a3a84b01a3a7311817229", | ||
}, | ||
@@ -247,5 +247,4 @@ }; | ||
"config_dir", | ||
"disable_sdk_generation", | ||
"resolvers_emulator", | ||
"rpc_retry_count", | ||
"enable_output_schema_extensions", | ||
"enable_output_generated_sdk", | ||
], | ||
@@ -252,0 +251,0 @@ joinArgs: true, |
@@ -125,3 +125,3 @@ "use strict"; | ||
const label = paramSpec.label.trim(); | ||
logger_1.logger.info(`\n${clc.bold(label)}${clc.bold(paramSpec.required ? "" : " (Optional)")}: ${(0, marked_1.marked)(description).trim()}`); | ||
logger_1.logger.info(`\n${clc.bold(label)}${clc.bold(paramSpec.required ? "" : " (Optional)")}: ${(await (0, marked_1.marked)(description)).trim()}`); | ||
while (!valid) { | ||
@@ -128,0 +128,0 @@ switch (paramSpec.type) { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const semver = require("semver"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const Table = require("cli-table"); | ||
@@ -16,5 +16,3 @@ const extensionsApi_1 = require("./extensionsApi"); | ||
const utils_1 = require("../utils"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
const EXTENSIONS_CHANGELOG = "CHANGELOG.md"; | ||
@@ -21,0 +19,0 @@ const VERSION_LINE_REGEX = /##.+?(\d+\.\d+\.\d+(?:-((\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?).*/; |
@@ -5,5 +5,3 @@ "use strict"; | ||
const clc = require("colorette"); | ||
const marked_1 = require("marked"); | ||
const semver = require("semver"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const path = require("path"); | ||
@@ -15,5 +13,2 @@ const refs = require("../extensions/refs"); | ||
const secretsUtils_1 = require("./secretsUtils"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
const TASKS_ROLE = "cloudtasks.enqueuer"; | ||
@@ -20,0 +15,0 @@ const TASKS_API = "cloudtasks.googleapis.com"; |
@@ -12,7 +12,5 @@ "use strict"; | ||
const marked_1 = require("marked"); | ||
const marked_terminal_1 = require("marked-terminal"); | ||
const unzip_1 = require("./../unzip"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
marked_1.marked.use((0, marked_terminal_1.markedTerminal)()); | ||
const api_1 = require("../api"); | ||
@@ -421,3 +419,3 @@ const archiveDirectory_1 = require("../archiveDirectory"); | ||
"Please create one and add an entry for this version. " + | ||
(0, marked_1.marked)("See https://firebase.google.com/docs/extensions/publishers/user-documentation#writing-changelog for more details.")); | ||
"See https://firebase.google.com/docs/extensions/publishers/user-documentation#writing-changelog for more details."); | ||
} | ||
@@ -427,3 +425,3 @@ if (!notes && !semver.prerelease(newVersion) && extension) { | ||
"Please add one so users know what has changed in this version. " + | ||
(0, marked_1.marked)("See https://firebase.google.com/docs/extensions/publishers/user-documentation#writing-changelog for more details.")); | ||
"See https://firebase.google.com/docs/extensions/publishers/user-documentation#writing-changelog for more details."); | ||
} | ||
@@ -707,3 +705,3 @@ return notes; | ||
function getMissingPublisherError(publisherId) { | ||
return new error_1.FirebaseError((0, marked_1.marked)(`Couldn't find publisher ID '${clc.bold(publisherId)}'. Please ensure that you have registered this ID. For step-by-step instructions on getting started as a publisher, see https://firebase.google.com/docs/extensions/publishers/get-started.`)); | ||
return new error_1.FirebaseError(`Couldn't find publisher ID '${clc.bold(publisherId)}'. Please ensure that you have registered this ID. For step-by-step instructions on getting started as a publisher, see https://firebase.google.com/docs/extensions/publishers/get-started.`); | ||
} | ||
@@ -710,0 +708,0 @@ exports.getMissingPublisherError = getMissingPublisherError; |
@@ -67,3 +67,3 @@ "use strict"; | ||
} | ||
throw new error_1.FirebaseError((0, marked_1.marked)(errorMessage), { exit: 2 }); | ||
throw new error_1.FirebaseError(await (0, marked_1.marked)(errorMessage), { exit: 2 }); | ||
} | ||
@@ -70,0 +70,0 @@ } |
@@ -6,3 +6,2 @@ "use strict"; | ||
const semver = require("semver"); | ||
const marked_1 = require("marked"); | ||
const error_1 = require("../error"); | ||
@@ -51,3 +50,3 @@ const logger_1 = require("../logger"); | ||
const warning = `All the instance's resources and logic will be overwritten to use the source code and files from the ${targetText}.\n`; | ||
logger_1.logger.info((0, marked_1.marked)(warning)); | ||
logger_1.logger.info(warning); | ||
} | ||
@@ -54,0 +53,0 @@ exports.warningUpdateToOtherSource = warningUpdateToOtherSource; |
@@ -5,7 +5,2 @@ "use strict"; | ||
const clc = require("colorette"); | ||
const TerminalRenderer = require("marked-terminal"); | ||
const marked_1 = require("marked"); | ||
marked_1.marked.setOptions({ | ||
renderer: new TerminalRenderer(), | ||
}); | ||
const extensionsHelper_1 = require("./extensionsHelper"); | ||
@@ -33,5 +28,5 @@ const deploymentSummary_1 = require("../deploy/extensions/deploymentSummary"); | ||
const humanReadableList = unpublishedExtensions.map(toListEntry).join("\n"); | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`The following extension versions have not been published to the Firebase Extensions Hub:\n${humanReadableList}\n.` + | ||
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `The following extension versions have not been published to the Firebase Extensions Hub:\n${humanReadableList}\n.` + | ||
"Unpublished extensions have not been reviewed by " + | ||
"Firebase. Please make sure you trust the extension publisher before installing this extension.", { gfm: false })); | ||
"Firebase. Please make sure you trust the extension publisher before installing this extension."); | ||
} | ||
@@ -38,0 +33,0 @@ return unpublishedExtensions.length > 0; |
@@ -423,11 +423,12 @@ "use strict"; | ||
} | ||
async createDatabase(project, databaseId, locationId, type, deleteProtectionState, pointInTimeRecoveryEnablement) { | ||
const url = `/projects/${project}/databases`; | ||
async createDatabase(req) { | ||
const url = `/projects/${req.project}/databases`; | ||
const payload = { | ||
type, | ||
locationId, | ||
deleteProtectionState, | ||
pointInTimeRecoveryEnablement, | ||
locationId: req.locationId, | ||
type: req.type, | ||
deleteProtectionState: req.deleteProtectionState, | ||
pointInTimeRecoveryEnablement: req.pointInTimeRecoveryEnablement, | ||
cmekConfig: req.cmekConfig, | ||
}; | ||
const options = { queryParams: { databaseId: databaseId } }; | ||
const options = { queryParams: { databaseId: req.databaseId } }; | ||
const res = await this.apiClient.post(url, payload, options); | ||
@@ -434,0 +435,0 @@ const database = res.body.response; |
@@ -36,9 +36,29 @@ "use strict"; | ||
prettyPrintDatabase(database) { | ||
let colValueWidth = Math.max(50, 5 + database.name.length); | ||
if (database.cmekConfig) { | ||
colValueWidth = Math.max(140, 20 + database.cmekConfig.kmsKeyName.length); | ||
} | ||
const table = new Table({ | ||
head: ["Field", "Value"], | ||
colWidths: [25, Math.max(50, 5 + database.name.length)], | ||
colWidths: [30, colValueWidth], | ||
}); | ||
table.push(["Name", clc.yellow(database.name)], ["Create Time", clc.yellow(database.createTime)], ["Last Update Time", clc.yellow(database.updateTime)], ["Type", clc.yellow(database.type)], ["Location", clc.yellow(database.locationId)], ["Delete Protection State", clc.yellow(database.deleteProtectionState)], ["Point In Time Recovery", clc.yellow(database.pointInTimeRecoveryEnablement)], ["Earliest Version Time", clc.yellow(database.earliestVersionTime)], ["Version Retention Period", clc.yellow(database.versionRetentionPeriod)]); | ||
if (database.cmekConfig) { | ||
table.push(["KMS Key Name", clc.yellow(database.cmekConfig.kmsKeyName)]); | ||
if (database.cmekConfig.activeKeyVersion) { | ||
table.push([ | ||
"Active Key Versions", | ||
clc.yellow(this.prettyStringArray(database.cmekConfig.activeKeyVersion)), | ||
]); | ||
} | ||
} | ||
logger_1.logger.info(table.toString()); | ||
} | ||
prettyStringArray(stringArray) { | ||
let result = ""; | ||
stringArray.forEach((str) => { | ||
result += `${str}\n`; | ||
}); | ||
return result; | ||
} | ||
prettyPrintBackups(backups) { | ||
@@ -45,0 +65,0 @@ if (backups.length === 0) { |
@@ -54,1 +54,9 @@ "use strict"; | ||
}); | ||
describe("prettyStringArray", () => { | ||
it("should correctly print an array of strings", () => { | ||
(0, chai_1.expect)(printer.prettyStringArray(["kms-key-1", "kms-key-2"])).to.equal("kms-key-1\nkms-key-2\n"); | ||
}); | ||
it("should print nothing if the array is empty", () => { | ||
(0, chai_1.expect)(printer.prettyStringArray([])).to.equal(""); | ||
}); | ||
}); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.doSetup = void 0; | ||
exports.actuate = exports.doSetup = void 0; | ||
const path_1 = require("path"); | ||
@@ -23,3 +23,3 @@ const clc = require("colorette"); | ||
const defaultConnector = { | ||
id: "default-connector", | ||
id: "default", | ||
files: [ | ||
@@ -37,2 +37,9 @@ { | ||
async function doSetup(setup, config) { | ||
const info = await askQuestions(setup, config); | ||
await actuate(setup, config, info); | ||
logger_1.logger.info(""); | ||
(0, utils_1.logSuccess)(`If you'd like to generate an SDK for your new connector, run ${clc.bold("firebase init dataconnect:sdk")}`); | ||
} | ||
exports.doSetup = doSetup; | ||
async function askQuestions(setup, config) { | ||
var _a, _b, _c; | ||
@@ -48,2 +55,3 @@ let info = { | ||
schemaGql: [], | ||
shouldProvisionCSQL: false, | ||
}; | ||
@@ -65,4 +73,3 @@ info = await promptForService(setup, info); | ||
setup.rcfile.dataconnectEmulatorConfig = { postgres: { localConnectionString } }; | ||
await writeFiles(config, info); | ||
if (setup.projectId && | ||
info.shouldProvisionCSQL = !!(setup.projectId && | ||
(info.isNewInstance || info.isNewDatabase) && | ||
@@ -72,3 +79,8 @@ (await (0, prompt_1.confirm)({ | ||
default: true, | ||
}))) { | ||
}))); | ||
return info; | ||
} | ||
async function actuate(setup, config, info) { | ||
await writeFiles(config, info); | ||
if (setup.projectId && info.shouldProvisionCSQL) { | ||
await (0, provisionCloudSql_1.provisionCloudSql)({ | ||
@@ -83,8 +95,7 @@ projectId: setup.projectId, | ||
} | ||
logger_1.logger.info(""); | ||
(0, utils_1.logSuccess)(`If you'd like to generate an SDK for your new connector, run ${clc.bold("firebase init dataconnect:sdk")}`); | ||
} | ||
exports.doSetup = doSetup; | ||
exports.actuate = actuate; | ||
async function writeFiles(config, info) { | ||
const dir = config.get("dataconnect.source") || "dataconnect"; | ||
console.log(dir); | ||
const subbedDataconnectYaml = subDataconnectYamlValues(Object.assign(Object.assign({}, info), { connectorIds: info.connectors.map((c) => `"./${c.id}"`).join(", ") })); | ||
@@ -91,0 +102,0 @@ config.set("dataconnect", { source: dir }); |
@@ -13,2 +13,3 @@ "use strict"; | ||
const error_1 = require("../../../error"); | ||
const lodash_1 = require("lodash"); | ||
const IOS = "ios"; | ||
@@ -44,11 +45,17 @@ const WEB = "web"; | ||
}); | ||
const platforms = await (0, prompt_1.promptOnce)({ | ||
message: "Which platforms do you want to set up a generated SDK for?", | ||
type: "checkbox", | ||
choices: [ | ||
{ name: "iOS (Swift)", value: IOS }, | ||
{ name: "Web (JavaScript)", value: WEB }, | ||
{ name: "Androd (Kotlin)", value: ANDROID }, | ||
], | ||
}); | ||
let platforms = []; | ||
while (!platforms.length) { | ||
platforms = await (0, prompt_1.promptOnce)({ | ||
message: "Which platforms do you want to set up a generated SDK for?", | ||
type: "checkbox", | ||
choices: [ | ||
{ name: "iOS (Swift)", value: IOS }, | ||
{ name: "Web (JavaScript)", value: WEB }, | ||
{ name: "Androd (Kotlin)", value: ANDROID }, | ||
], | ||
}); | ||
if (!platforms.length) { | ||
logger_1.logger.info("You must pick at least one platform."); | ||
} | ||
} | ||
const newConnectorYaml = JSON.parse(JSON.stringify(connectorInfo.connectorYaml)); | ||
@@ -63,5 +70,6 @@ if (!newConnectorYaml.generate) { | ||
default: ((_a = newConnectorYaml.generate.swiftSdk) === null || _a === void 0 ? void 0 : _a.outputDir) || | ||
`./../.dataconnect/generated/${newConnectorYaml.connectorId}/swift-sdk`, | ||
`./../gensdk/${newConnectorYaml.connectorId}/swift-sdk`, | ||
}); | ||
const swiftSdk = { outputDir }; | ||
const pkg = (0, lodash_1.camelCase)(newConnectorYaml.connectorId); | ||
const swiftSdk = { outputDir, package: pkg }; | ||
newConnectorYaml.generate.swiftSdk = swiftSdk; | ||
@@ -74,9 +82,5 @@ } | ||
default: ((_b = newConnectorYaml.generate.javascriptSdk) === null || _b === void 0 ? void 0 : _b.outputDir) || | ||
`./../.dataconnect/generated/${newConnectorYaml.connectorId}/javascript-sdk`, | ||
`./../gensdk/${newConnectorYaml.connectorId}/javascript-sdk`, | ||
}); | ||
const pkg = await (0, prompt_1.promptOnce)({ | ||
message: "What package name do you want to use for your JavaScript SDK?", | ||
type: "input", | ||
default: (_d = (_c = newConnectorYaml.generate.javascriptSdk) === null || _c === void 0 ? void 0 : _c.package) !== null && _d !== void 0 ? _d : `@firebasegen/${connectorInfo.connectorYaml.connectorId}`, | ||
}); | ||
const pkg = (_d = (_c = newConnectorYaml.generate.javascriptSdk) === null || _c === void 0 ? void 0 : _c.package) !== null && _d !== void 0 ? _d : `@firebasegen/${connectorInfo.connectorYaml.connectorId}`; | ||
const packageJSONDir = await (0, prompt_1.promptOnce)({ | ||
@@ -101,9 +105,5 @@ message: "Which directory contains the package.json that you would like to add the JavaScript SDK dependency to? (Leave blank to skip)", | ||
default: ((_f = newConnectorYaml.generate.kotlinSdk) === null || _f === void 0 ? void 0 : _f.outputDir) || | ||
`./../.dataconnect/generated/${newConnectorYaml.connectorId}/kotlin-sdk/src/main/kotlin/${newConnectorYaml.connectorId}`, | ||
`./../gensdk/${newConnectorYaml.connectorId}/kotlin-sdk`, | ||
}); | ||
const pkg = await (0, prompt_1.promptOnce)({ | ||
message: "What package name do you want to use for your Kotlin SDK?", | ||
type: "input", | ||
default: (_h = (_g = newConnectorYaml.generate.kotlinSdk) === null || _g === void 0 ? void 0 : _g.package) !== null && _h !== void 0 ? _h : `com.google.firebase.dataconnect.connectors.${connectorInfo.connectorYaml.connectorId}`, | ||
}); | ||
const pkg = (_h = (_g = newConnectorYaml.generate.kotlinSdk) === null || _g === void 0 ? void 0 : _g.package) !== null && _h !== void 0 ? _h : `connectors.${(0, lodash_1.snakeCase)(connectorInfo.connectorYaml.connectorId)}`; | ||
const kotlinSdk = { | ||
@@ -110,0 +110,0 @@ outputDir, |
@@ -74,8 +74,9 @@ "use strict"; | ||
} | ||
const addRole = await (0, prompt_1.promptOnce)({ | ||
type: "confirm", | ||
name: "rulesRole", | ||
message: `Cloud Storage for Firebase needs an IAM Role to use cross-service rules. Grant the new role?`, | ||
default: true, | ||
}, this.options); | ||
const addRole = this.options.force || | ||
(await (0, prompt_1.promptOnce)({ | ||
type: "confirm", | ||
name: "rulesRole", | ||
message: `Cloud Storage for Firebase needs an IAM Role to use cross-service rules. Grant the new role?`, | ||
default: true, | ||
}, this.options)); | ||
if (addRole) { | ||
@@ -122,8 +123,9 @@ await (0, resourceManager_1.addServiceAccountToRoles)(projectNumber, saEmail, [CROSS_SERVICE_RULES_ROLE], true); | ||
if (history.length > RULESET_COUNT_LIMIT) { | ||
const confirm = await (0, prompt_1.promptOnce)({ | ||
type: "confirm", | ||
name: "force", | ||
message: `You have ${history.length} rules, do you want to delete the oldest ${RULESETS_TO_GC} to free up space?`, | ||
default: false, | ||
}, this.options); | ||
const confirm = this.options.force || | ||
(await (0, prompt_1.promptOnce)({ | ||
type: "confirm", | ||
name: "force", | ||
message: `You have ${history.length} rules, do you want to delete the oldest ${RULESETS_TO_GC} to free up space?`, | ||
default: false, | ||
}, this.options)); | ||
if (confirm) { | ||
@@ -130,0 +132,0 @@ const releases = await gcp.rules.listAllReleases(this.options.project); |
{ | ||
"name": "firebase-tools", | ||
"version": "13.14.2", | ||
"version": "13.15.0", | ||
"description": "Command-Line Interface for Firebase", | ||
@@ -97,4 +97,4 @@ "main": "./lib/index.js", | ||
"lodash": "^4.17.21", | ||
"marked": "^4.0.14", | ||
"marked-terminal": "^5.1.1", | ||
"marked": "^13.0.2", | ||
"marked-terminal": "^7.0.0", | ||
"mime": "^2.5.2", | ||
@@ -101,0 +101,0 @@ "minimatch": "^3.0.4", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3358551
670
73881
+ Added@sindresorhus/is@4.6.0(transitive)
+ Addedansi-escapes@7.0.0(transitive)
+ Addedany-promise@1.3.0(transitive)
+ Addedchar-regex@1.0.2(transitive)
+ Addedcli-highlight@2.1.11(transitive)
+ Addedcliui@7.0.4(transitive)
+ Addedemojilib@2.4.0(transitive)
+ Addedenvironment@1.1.0(transitive)
+ Addedhighlight.js@10.7.3(transitive)
+ Addedmarked@13.0.3(transitive)
+ Addedmarked-terminal@7.1.0(transitive)
+ Addedmz@2.7.0(transitive)
+ Addednode-emoji@2.1.3(transitive)
+ Addedparse5@5.1.16.0.1(transitive)
+ Addedparse5-htmlparser2-tree-adapter@6.0.1(transitive)
+ Addedskin-tone@2.0.0(transitive)
+ Addedsupports-hyperlinks@3.1.0(transitive)
+ Addedthenify@3.3.1(transitive)
+ Addedthenify-all@1.6.0(transitive)
+ Addedunicode-emoji-modifier-base@1.0.0(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
- Removedansi-escapes@6.2.1(transitive)
- Removedansicolors@0.3.2(transitive)
- Removedcardinal@2.1.1(transitive)
- Removedmarked@4.3.0(transitive)
- Removedmarked-terminal@5.2.0(transitive)
- Removednode-emoji@1.11.0(transitive)
- Removedredeyed@2.1.1(transitive)
- Removedsupports-hyperlinks@2.3.0(transitive)
Updatedmarked@^13.0.2
Updatedmarked-terminal@^7.0.0