firebase-tools 9.23.3 → 10.1.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 +1 -1
- package/lib/apiv2.js +2 -2
- package/lib/appdistribution/client.js +1 -1
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/auth.js +2 -2
- package/lib/command.js +26 -26
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/appdistribution-testers-add.js +2 -2
- package/lib/commands/appdistribution-testers-remove.js +2 -2
- package/lib/commands/apps-android-sha-create.js +2 -2
- package/lib/commands/apps-android-sha-delete.js +2 -2
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +9 -9
- package/lib/commands/apps-list.js +3 -3
- package/lib/commands/apps-sdkconfig.js +8 -8
- package/lib/commands/database-get.js +1 -1
- package/lib/commands/database-instances-create.js +4 -4
- package/lib/commands/database-instances-list.js +4 -4
- package/lib/commands/database-profile.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +4 -4
- package/lib/commands/database-set.js +4 -4
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +4 -4
- package/lib/commands/ext-configure.js +2 -2
- package/lib/commands/ext-dev-deprecate.js +4 -4
- package/lib/commands/ext-dev-extension-delete.js +3 -3
- package/lib/commands/ext-dev-init.js +3 -3
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +3 -3
- package/lib/commands/ext-dev-register.js +5 -5
- package/lib/commands/ext-dev-undeprecate.js +4 -4
- package/lib/commands/ext-dev-unpublish.js +3 -3
- package/lib/commands/ext-dev-usage.js +145 -0
- package/lib/commands/ext-export.js +8 -8
- package/lib/commands/ext-info.js +4 -4
- package/lib/commands/ext-install.js +26 -22
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +3 -3
- package/lib/commands/ext-update.js +17 -17
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +3 -3
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-delete.js +3 -3
- package/lib/commands/functions-deletegcfartifacts.js +4 -4
- package/lib/commands/functions-list.js +1 -1
- package/lib/commands/functions-log.js +1 -1
- package/lib/commands/hosting-channel-create.js +12 -12
- package/lib/commands/hosting-channel-delete.js +9 -9
- package/lib/commands/hosting-channel-deploy.js +17 -17
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +15 -15
- package/lib/commands/hosting-disable.js +4 -4
- package/lib/commands/hosting-sites-create.js +7 -7
- package/lib/commands/hosting-sites-delete.js +7 -7
- package/lib/commands/hosting-sites-get.js +2 -2
- package/lib/commands/hosting-sites-list.js +3 -3
- package/lib/commands/index.js +1 -0
- package/lib/commands/login.js +2 -2
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/commands/projects-addfirebase.js +2 -2
- package/lib/commands/projects-create.js +2 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +3 -3
- package/lib/commands/remoteconfig-rollback.js +3 -3
- package/lib/commands/remoteconfig-versions-list.js +1 -1
- package/lib/commands/setup-emulators-storage.js +1 -1
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +5 -4
- package/lib/deploy/extensions/index.js +1 -0
- package/lib/deploy/extensions/params.js +1 -1
- package/lib/deploy/extensions/planner.js +3 -3
- package/lib/deploy/extensions/prepare.js +9 -9
- package/lib/deploy/extensions/release.js +1 -1
- package/lib/deploy/extensions/secrets.js +7 -7
- package/lib/deploy/extensions/validate.js +2 -2
- package/lib/deploy/functions/backend.js +6 -4
- package/lib/deploy/functions/checkIam.js +7 -7
- package/lib/deploy/functions/containerCleaner.js +3 -3
- package/lib/deploy/functions/deploy.js +10 -11
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +27 -21
- package/lib/deploy/functions/prompts.js +5 -5
- package/lib/deploy/functions/release/executor.js +4 -1
- package/lib/deploy/functions/release/fabricator.js +5 -5
- package/lib/deploy/functions/release/index.js +3 -3
- package/lib/deploy/functions/release/planner.js +6 -6
- package/lib/deploy/functions/release/reporter.js +8 -4
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
- package/lib/deploy/functions/runtimes/golang/index.js +9 -13
- package/lib/deploy/functions/runtimes/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/runtimes/node/validate.js +2 -1
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- package/lib/deploy/functions/validate.js +4 -3
- package/lib/deploy/hosting/deploy.js +7 -7
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/hosting/validate.js +3 -3
- package/lib/deploy/remoteconfig/prepare.js +3 -3
- package/lib/deploy/remoteconfig/release.js +3 -3
- package/lib/deploy/storage/deploy.js +1 -1
- package/lib/deploy/storage/release.js +2 -2
- package/lib/detectProjectRoot.js +5 -5
- package/lib/emulator/auth/apiSpec.js +13 -7
- package/lib/emulator/auth/handlers.js +3 -3
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +256 -248
- package/lib/emulator/auth/server.js +11 -8
- package/lib/emulator/auth/state.js +12 -12
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +2 -2
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +101 -74
- package/lib/emulator/functionsEmulatorRuntime.js +33 -18
- package/lib/emulator/functionsEmulatorShell.js +3 -2
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/storage/apis/firebase.js +2 -2
- package/lib/emulator/storage/apis/gcloud.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +1 -1
- package/lib/emulator/storage/files.js +14 -14
- package/lib/emulator/storage/index.js +2 -2
- package/lib/emulator/storage/metadata.js +7 -6
- package/lib/emulator/storage/rules/runtime.js +5 -5
- package/lib/emulator/storage/server.js +2 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/error.js +3 -3
- package/lib/extensions/askUserForConsent.js +2 -3
- package/lib/extensions/askUserForParam.js +10 -10
- package/lib/extensions/billingMigrationHelper.js +1 -1
- package/lib/extensions/changelog.js +3 -3
- package/lib/extensions/displayExtensionInfo.js +5 -5
- package/lib/extensions/emulator/optionsHelper.js +1 -1
- package/lib/extensions/emulator/specHelper.js +1 -1
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/export.js +6 -6
- package/lib/extensions/extensionsApi.js +14 -1
- package/lib/extensions/extensionsHelper.js +38 -29
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +6 -6
- package/lib/extensions/provisioningHelper.js +6 -4
- package/lib/extensions/resolveSource.js +1 -1
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +9 -9
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +10 -9
- package/lib/fetchWebSetup.js +2 -2
- package/lib/filterTargets.js +2 -2
- package/lib/firestore/indexes.js +2 -2
- package/lib/fsAsync.js +3 -3
- package/lib/fsutils.js +2 -2
- package/lib/functional.js +2 -1
- package/lib/functions/env.js +1 -1
- package/lib/functions/runtimeConfigExport.js +4 -4
- package/lib/functionsConfig.js +3 -3
- package/lib/functionsShellCommandAction.js +4 -3
- package/lib/gcp/cloudmonitoring.js +74 -0
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/resourceManager.js +2 -2
- package/lib/gcp/secretManager.js +3 -2
- package/lib/getDefaultDatabaseInstance.js +1 -1
- package/lib/getDefaultHostingSite.js +1 -1
- package/lib/getProjectNumber.js +2 -2
- package/lib/handlePreviewToggles.js +5 -5
- package/lib/hosting/api.js +6 -6
- package/lib/hosting/cloudRunProxy.js +6 -6
- package/lib/hosting/functionsProxy.js +3 -3
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/hosting/proxy.js +2 -2
- package/lib/init/features/account.js +7 -7
- package/lib/init/features/database.js +9 -9
- package/lib/init/features/emulators.js +8 -8
- package/lib/init/features/firestore/index.js +3 -3
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/golang.js +4 -4
- package/lib/init/features/functions/index.js +4 -4
- package/lib/init/features/hosting/github.js +31 -31
- package/lib/init/features/project.js +8 -8
- package/lib/init/features/remoteconfig.js +2 -2
- package/lib/init/features/storage.js +2 -2
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +3 -3
- package/lib/management/projects.js +6 -6
- package/lib/previews.js +2 -2
- package/lib/profiler.js +1 -1
- package/lib/projectPath.js +1 -1
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +2 -2
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requireHostingSite.js +1 -1
- package/lib/requirePermissions.js +4 -4
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/functions.js +14 -7
- package/lib/serve/hosting.js +7 -7
- package/lib/utils.js +3 -2
- package/npm-shrinkwrap.json +24889 -0
- package/package.json +24 -24
- package/templates/init/functions/javascript/package.lint.json +1 -1
- package/templates/init/functions/javascript/package.nolint.json +1 -1
- package/templates/init/functions/typescript/package.lint.json +1 -1
- package/templates/init/functions/typescript/package.nolint.json +1 -1
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.confirm = exports.getSourceOrigin = exports.isLocalOrURLPath = exports.isLocalPath = exports.isUrlPath = exports.instanceIdExists = exports.promptForRepeatInstance = exports.promptForOfficialExtension = exports.displayReleaseNotes = exports.getExtensionSourceFromName = exports.createSourceFromLocation = exports.publishExtensionVersionFromLocalSource = exports.ensureExtensionsApiEnabled = exports.promptForValidInstanceId = exports.validateSpec = exports.validateCommandLineParams = exports.populateDefaultParams = exports.substituteParams = exports.getFirebaseProjectParams = exports.getDBInstanceFromURL = exports.resourceTypeToNiceName = exports.AUTOPOULATED_PARAM_PLACEHOLDERS = exports.EXTENSIONS_BUCKET_NAME = exports.URL_REGEX = exports.logPrefix = exports.SourceOrigin = exports.SpecParamType = void 0;
|
|
3
|
+
exports.confirm = exports.getSourceOrigin = exports.isLocalOrURLPath = exports.isLocalPath = exports.isUrlPath = exports.instanceIdExists = exports.promptForRepeatInstance = exports.promptForOfficialExtension = exports.displayReleaseNotes = exports.getPublisherProjectFromName = exports.getExtensionSourceFromName = exports.createSourceFromLocation = exports.publishExtensionVersionFromLocalSource = exports.ensureExtensionsApiEnabled = exports.promptForValidInstanceId = exports.validateSpec = exports.validateCommandLineParams = exports.populateDefaultParams = exports.substituteParams = exports.getFirebaseProjectParams = exports.getDBInstanceFromURL = exports.resourceTypeToNiceName = exports.AUTOPOULATED_PARAM_PLACEHOLDERS = exports.EXTENSIONS_BUCKET_NAME = exports.URL_REGEX = exports.logPrefix = exports.SourceOrigin = exports.SpecParamType = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
6
|
const ora = require("ora");
|
|
@@ -48,7 +48,7 @@ var SourceOrigin;
|
|
|
48
48
|
exports.logPrefix = "extensions";
|
|
49
49
|
const VALID_LICENSES = ["apache-2.0"];
|
|
50
50
|
exports.URL_REGEX = /^https:/;
|
|
51
|
-
exports.EXTENSIONS_BUCKET_NAME = utils_2.envOverride("FIREBASE_EXTENSIONS_UPLOAD_BUCKET", "firebase-ext-eap-uploads");
|
|
51
|
+
exports.EXTENSIONS_BUCKET_NAME = (0, utils_2.envOverride)("FIREBASE_EXTENSIONS_UPLOAD_BUCKET", "firebase-ext-eap-uploads");
|
|
52
52
|
const AUTOPOPULATED_PARAM_NAMES = [
|
|
53
53
|
"PROJECT_ID",
|
|
54
54
|
"STORAGE_BUCKET",
|
|
@@ -76,8 +76,8 @@ function getDBInstanceFromURL(databaseUrl = "") {
|
|
|
76
76
|
}
|
|
77
77
|
exports.getDBInstanceFromURL = getDBInstanceFromURL;
|
|
78
78
|
async function getFirebaseProjectParams(projectId) {
|
|
79
|
-
const body = await functionsConfig_1.getFirebaseConfig({ project: projectId });
|
|
80
|
-
const projectNumber = await getProjectNumber_1.getProjectNumber({ projectId });
|
|
79
|
+
const body = await (0, functionsConfig_1.getFirebaseConfig)({ project: projectId });
|
|
80
|
+
const projectNumber = await (0, getProjectNumber_1.getProjectNumber)({ projectId });
|
|
81
81
|
const FIREBASE_CONFIG = JSON.stringify({
|
|
82
82
|
projectId: body.projectId,
|
|
83
83
|
databaseURL: body.databaseURL,
|
|
@@ -134,7 +134,7 @@ function validateCommandLineParams(envVars, paramSpec) {
|
|
|
134
134
|
}
|
|
135
135
|
let allParamsValid = true;
|
|
136
136
|
for (const param of paramSpec) {
|
|
137
|
-
if (!askUserForParam_1.checkResponse(envVars[param.param], param)) {
|
|
137
|
+
if (!(0, askUserForParam_1.checkResponse)(envVars[param.param], param)) {
|
|
138
138
|
allParamsValid = false;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -233,7 +233,7 @@ async function promptForValidInstanceId(instanceId) {
|
|
|
233
233
|
let newInstanceId = "";
|
|
234
234
|
const instanceIdRegex = /^[a-z][a-z\d\-]*[a-z\d]$/;
|
|
235
235
|
while (!instanceIdIsValid) {
|
|
236
|
-
newInstanceId = await prompt_1.promptOnce({
|
|
236
|
+
newInstanceId = await (0, prompt_1.promptOnce)({
|
|
237
237
|
type: "input",
|
|
238
238
|
default: instanceId,
|
|
239
239
|
message: `Please enter a new name for this instance:`,
|
|
@@ -253,20 +253,20 @@ async function promptForValidInstanceId(instanceId) {
|
|
|
253
253
|
}
|
|
254
254
|
exports.promptForValidInstanceId = promptForValidInstanceId;
|
|
255
255
|
async function ensureExtensionsApiEnabled(options) {
|
|
256
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
257
|
-
return await ensureApiEnabled_1.ensure(projectId, "firebaseextensions.googleapis.com", "extensions", options.markdown);
|
|
256
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
257
|
+
return await (0, ensureApiEnabled_1.ensure)(projectId, "firebaseextensions.googleapis.com", "extensions", options.markdown);
|
|
258
258
|
}
|
|
259
259
|
exports.ensureExtensionsApiEnabled = ensureExtensionsApiEnabled;
|
|
260
260
|
async function archiveAndUploadSource(extPath, bucketName) {
|
|
261
|
-
const zippedSource = await archiveDirectory_1.archiveDirectory(extPath, {
|
|
261
|
+
const zippedSource = await (0, archiveDirectory_1.archiveDirectory)(extPath, {
|
|
262
262
|
type: "zip",
|
|
263
263
|
ignore: ["node_modules", ".git"],
|
|
264
264
|
});
|
|
265
|
-
const res = await storage_1.uploadObject(zippedSource, bucketName);
|
|
265
|
+
const res = await (0, storage_1.uploadObject)(zippedSource, bucketName);
|
|
266
266
|
return `/${res.bucket}/${res.object}`;
|
|
267
267
|
}
|
|
268
268
|
async function publishExtensionVersionFromLocalSource(args) {
|
|
269
|
-
const extensionSpec = await localHelper_1.getLocalExtensionSpec(args.rootDirectory);
|
|
269
|
+
const extensionSpec = await (0, localHelper_1.getLocalExtensionSpec)(args.rootDirectory);
|
|
270
270
|
if (extensionSpec.name != args.extensionId) {
|
|
271
271
|
throw new error_1.FirebaseError(`Extension ID '${clc.bold(args.extensionId)}' does not match the name in extension.yaml '${clc.bold(extensionSpec.name)}'.`);
|
|
272
272
|
}
|
|
@@ -275,13 +275,13 @@ async function publishExtensionVersionFromLocalSource(args) {
|
|
|
275
275
|
validateSpec(subbedSpec);
|
|
276
276
|
let extension;
|
|
277
277
|
try {
|
|
278
|
-
extension = await extensionsApi_1.getExtension(`${args.publisherId}/${args.extensionId}`);
|
|
278
|
+
extension = await (0, extensionsApi_1.getExtension)(`${args.publisherId}/${args.extensionId}`);
|
|
279
279
|
}
|
|
280
280
|
catch (err) {
|
|
281
281
|
}
|
|
282
282
|
let notes;
|
|
283
283
|
try {
|
|
284
|
-
const changes = changelog_1.getLocalChangelog(args.rootDirectory);
|
|
284
|
+
const changes = (0, changelog_1.getLocalChangelog)(args.rootDirectory);
|
|
285
285
|
notes = changes[extensionSpec.version];
|
|
286
286
|
}
|
|
287
287
|
catch (err) {
|
|
@@ -315,7 +315,7 @@ async function publishExtensionVersionFromLocalSource(args) {
|
|
|
315
315
|
const ref = `${args.publisherId}/${args.extensionId}@${extensionSpec.version}`;
|
|
316
316
|
let packageUri;
|
|
317
317
|
let objectPath = "";
|
|
318
|
-
const uploadSpinner = ora
|
|
318
|
+
const uploadSpinner = ora(" Archiving and uploading extension source code");
|
|
319
319
|
try {
|
|
320
320
|
uploadSpinner.start();
|
|
321
321
|
objectPath = await archiveAndUploadSource(args.rootDirectory, exports.EXTENSIONS_BUCKET_NAME);
|
|
@@ -326,11 +326,11 @@ async function publishExtensionVersionFromLocalSource(args) {
|
|
|
326
326
|
uploadSpinner.fail();
|
|
327
327
|
throw err;
|
|
328
328
|
}
|
|
329
|
-
const publishSpinner = ora
|
|
329
|
+
const publishSpinner = ora(`Publishing ${clc.bold(ref)}`);
|
|
330
330
|
let res;
|
|
331
331
|
try {
|
|
332
332
|
publishSpinner.start();
|
|
333
|
-
res = await extensionsApi_1.publishExtensionVersion(ref, packageUri);
|
|
333
|
+
res = await (0, extensionsApi_1.publishExtensionVersion)(ref, packageUri);
|
|
334
334
|
publishSpinner.succeed(` Successfully published ${clc.bold(ref)}`);
|
|
335
335
|
}
|
|
336
336
|
catch (err) {
|
|
@@ -349,7 +349,7 @@ async function createSourceFromLocation(projectId, sourceUri) {
|
|
|
349
349
|
let extensionRoot;
|
|
350
350
|
let objectPath = "";
|
|
351
351
|
if (!exports.URL_REGEX.test(sourceUri)) {
|
|
352
|
-
const uploadSpinner = ora
|
|
352
|
+
const uploadSpinner = ora(" Archiving and uploading extension source code");
|
|
353
353
|
try {
|
|
354
354
|
uploadSpinner.start();
|
|
355
355
|
objectPath = await archiveAndUploadSource(sourceUri, exports.EXTENSIONS_BUCKET_NAME);
|
|
@@ -365,7 +365,7 @@ async function createSourceFromLocation(projectId, sourceUri) {
|
|
|
365
365
|
else {
|
|
366
366
|
[packageUri, extensionRoot] = sourceUri.split("#");
|
|
367
367
|
}
|
|
368
|
-
const res = await extensionsApi_1.createSource(projectId, packageUri, extensionRoot);
|
|
368
|
+
const res = await (0, extensionsApi_1.createSource)(projectId, packageUri, extensionRoot);
|
|
369
369
|
logger_1.logger.debug("Created new Extension Source %s", res.name);
|
|
370
370
|
await deleteUploadedSource(objectPath);
|
|
371
371
|
return res;
|
|
@@ -374,7 +374,7 @@ exports.createSourceFromLocation = createSourceFromLocation;
|
|
|
374
374
|
async function deleteUploadedSource(objectPath) {
|
|
375
375
|
if (objectPath.length) {
|
|
376
376
|
try {
|
|
377
|
-
await storage_1.deleteObject(objectPath);
|
|
377
|
+
await (0, storage_1.deleteObject)(objectPath);
|
|
378
378
|
logger_1.logger.debug("Cleaned up uploaded source archive");
|
|
379
379
|
}
|
|
380
380
|
catch (err) {
|
|
@@ -387,17 +387,26 @@ async function getExtensionSourceFromName(extensionName) {
|
|
|
387
387
|
const existingSourceRegex = /projects\/.+\/sources\/.+/;
|
|
388
388
|
if (officialExtensionRegex.test(extensionName)) {
|
|
389
389
|
const [name, version] = extensionName.split("@");
|
|
390
|
-
const registryEntry = await resolveSource_1.resolveRegistryEntry(name);
|
|
391
|
-
const sourceUrl = resolveSource_1.resolveSourceUrl(registryEntry, name, version);
|
|
392
|
-
return await extensionsApi_1.getSource(sourceUrl);
|
|
390
|
+
const registryEntry = await (0, resolveSource_1.resolveRegistryEntry)(name);
|
|
391
|
+
const sourceUrl = (0, resolveSource_1.resolveSourceUrl)(registryEntry, name, version);
|
|
392
|
+
return await (0, extensionsApi_1.getSource)(sourceUrl);
|
|
393
393
|
}
|
|
394
394
|
else if (existingSourceRegex.test(extensionName)) {
|
|
395
395
|
logger_1.logger.info(`Fetching the source "${extensionName}"...`);
|
|
396
|
-
return await extensionsApi_1.getSource(extensionName);
|
|
396
|
+
return await (0, extensionsApi_1.getSource)(extensionName);
|
|
397
397
|
}
|
|
398
398
|
throw new error_1.FirebaseError(`Could not find an extension named '${extensionName}'. `);
|
|
399
399
|
}
|
|
400
400
|
exports.getExtensionSourceFromName = getExtensionSourceFromName;
|
|
401
|
+
function getPublisherProjectFromName(publisherName) {
|
|
402
|
+
const publisherNameRegex = /projects\/.+\/publisherProfile/;
|
|
403
|
+
if (publisherNameRegex.test(publisherName)) {
|
|
404
|
+
const [_, projectNumber, __] = publisherName.split("/");
|
|
405
|
+
return Number.parseInt(projectNumber);
|
|
406
|
+
}
|
|
407
|
+
throw new error_1.FirebaseError(`Could not find publisher with name '${publisherName}'.`);
|
|
408
|
+
}
|
|
409
|
+
exports.getPublisherProjectFromName = getPublisherProjectFromName;
|
|
401
410
|
function displayReleaseNotes(publisherId, extensionId, versionId, releaseNotes) {
|
|
402
411
|
const releaseNotesMessage = releaseNotes
|
|
403
412
|
? ` Release notes for this version:\n${marked(releaseNotes)}\n`
|
|
@@ -408,12 +417,12 @@ function displayReleaseNotes(publisherId, extensionId, versionId, releaseNotes)
|
|
|
408
417
|
}
|
|
409
418
|
exports.displayReleaseNotes = displayReleaseNotes;
|
|
410
419
|
async function promptForOfficialExtension(message) {
|
|
411
|
-
const officialExts = await resolveSource_1.getExtensionRegistry(true);
|
|
412
|
-
return await prompt_1.promptOnce({
|
|
420
|
+
const officialExts = await (0, resolveSource_1.getExtensionRegistry)(true);
|
|
421
|
+
return await (0, prompt_1.promptOnce)({
|
|
413
422
|
name: "input",
|
|
414
423
|
type: "list",
|
|
415
424
|
message,
|
|
416
|
-
choices: utils_1.convertOfficialExtensionsToList(officialExts),
|
|
425
|
+
choices: (0, utils_1.convertOfficialExtensionsToList)(officialExts),
|
|
417
426
|
pageSize: _.size(officialExts),
|
|
418
427
|
});
|
|
419
428
|
}
|
|
@@ -425,7 +434,7 @@ async function promptForRepeatInstance(projectName, extensionName) {
|
|
|
425
434
|
{ name: "Install a new instance with a different ID", value: "installNew" },
|
|
426
435
|
{ name: "Cancel extension installation", value: "cancel" },
|
|
427
436
|
];
|
|
428
|
-
return await prompt_1.promptOnce({
|
|
437
|
+
return await (0, prompt_1.promptOnce)({
|
|
429
438
|
type: "list",
|
|
430
439
|
message,
|
|
431
440
|
choices,
|
|
@@ -433,7 +442,7 @@ async function promptForRepeatInstance(projectName, extensionName) {
|
|
|
433
442
|
}
|
|
434
443
|
exports.promptForRepeatInstance = promptForRepeatInstance;
|
|
435
444
|
async function instanceIdExists(projectId, instanceId) {
|
|
436
|
-
const instanceRes = await extensionsApi_1.getInstance(projectId, instanceId, {
|
|
445
|
+
const instanceRes = await (0, extensionsApi_1.getInstance)(projectId, instanceId, {
|
|
437
446
|
resolveOnHTTPError: true,
|
|
438
447
|
});
|
|
439
448
|
if (instanceRes.error) {
|
|
@@ -493,7 +502,7 @@ exports.getSourceOrigin = getSourceOrigin;
|
|
|
493
502
|
async function confirm(args) {
|
|
494
503
|
if (!args.nonInteractive && !args.force) {
|
|
495
504
|
const message = `Do you wish to continue?`;
|
|
496
|
-
return await prompt_1.promptOnce({
|
|
505
|
+
return await (0, prompt_1.promptOnce)({
|
|
497
506
|
type: "confirm",
|
|
498
507
|
message,
|
|
499
508
|
default: args.default,
|
|
@@ -9,7 +9,7 @@ const extensionsHelper_1 = require("./extensionsHelper");
|
|
|
9
9
|
const utils = require("../utils");
|
|
10
10
|
const extensionsUtils = require("./utils");
|
|
11
11
|
async function listExtensions(projectId) {
|
|
12
|
-
const instances = await extensionsApi_1.listInstances(projectId);
|
|
12
|
+
const instances = await (0, extensionsApi_1.listInstances)(projectId);
|
|
13
13
|
if (instances.length < 1) {
|
|
14
14
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `there are no extensions installed on project ${clc.bold(projectId)}.`);
|
|
15
15
|
return [];
|
|
@@ -22,7 +22,7 @@ async function getLocalExtensionSpec(directory) {
|
|
|
22
22
|
}
|
|
23
23
|
exports.getLocalExtensionSpec = getLocalExtensionSpec;
|
|
24
24
|
function findExtensionYaml(directory) {
|
|
25
|
-
while (!fsutils_1.fileExistsSync(path.resolve(directory, EXTENSIONS_SPEC_FILE))) {
|
|
25
|
+
while (!(0, fsutils_1.fileExistsSync)(path.resolve(directory, EXTENSIONS_SPEC_FILE))) {
|
|
26
26
|
const parentDir = path.dirname(directory);
|
|
27
27
|
if (parentDir === directory) {
|
|
28
28
|
throw new error_1.FirebaseError("Couldn't find an extension.yaml file. Check that you are in the root directory of your extension.");
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildMetricsTableRow = exports.parseBucket = exports.parseTimeseriesResponse = void 0;
|
|
4
|
+
const semver = require("semver");
|
|
5
|
+
const clc = require("cli-color");
|
|
6
|
+
function parseTimeseriesResponse(series) {
|
|
7
|
+
const ret = [];
|
|
8
|
+
for (const s of series) {
|
|
9
|
+
const ref = buildRef(s);
|
|
10
|
+
if (ref == undefined) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
let valueToday;
|
|
14
|
+
let value7dAgo;
|
|
15
|
+
let value28dAgo;
|
|
16
|
+
if (s.points.length >= 28 && s.points[27].value.int64Value != undefined) {
|
|
17
|
+
value28dAgo = parseBucket(s.points[27].value.int64Value);
|
|
18
|
+
}
|
|
19
|
+
if (s.points.length >= 7 && s.points[6].value.int64Value != undefined) {
|
|
20
|
+
value7dAgo = parseBucket(s.points[6].value.int64Value);
|
|
21
|
+
}
|
|
22
|
+
if (s.points.length >= 1 && s.points[0].value.int64Value != undefined) {
|
|
23
|
+
valueToday = parseBucket(s.points[0].value.int64Value);
|
|
24
|
+
}
|
|
25
|
+
ret.push({
|
|
26
|
+
ref,
|
|
27
|
+
valueToday,
|
|
28
|
+
value7dAgo,
|
|
29
|
+
value28dAgo,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
ret.sort((a, b) => {
|
|
33
|
+
if (a.ref.version === "all") {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
if (b.ref.version === "all") {
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
return semver.lt(a.ref.version, b.ref.version) ? 1 : -1;
|
|
40
|
+
});
|
|
41
|
+
return ret;
|
|
42
|
+
}
|
|
43
|
+
exports.parseTimeseriesResponse = parseTimeseriesResponse;
|
|
44
|
+
function parseBucket(value) {
|
|
45
|
+
const v = Number(value);
|
|
46
|
+
if (v >= 200) {
|
|
47
|
+
return { low: v - 100, high: v };
|
|
48
|
+
}
|
|
49
|
+
if (v >= 10) {
|
|
50
|
+
return { low: v - 10, high: v };
|
|
51
|
+
}
|
|
52
|
+
return { low: 0, high: 0 };
|
|
53
|
+
}
|
|
54
|
+
exports.parseBucket = parseBucket;
|
|
55
|
+
function buildMetricsTableRow(metric) {
|
|
56
|
+
const ret = [metric.ref.version];
|
|
57
|
+
if (metric.valueToday) {
|
|
58
|
+
ret.push(`${metric.valueToday.low} - ${metric.valueToday.high}`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
ret.push("Insufficient data");
|
|
62
|
+
}
|
|
63
|
+
ret.push(renderChangeCell(metric.value7dAgo, metric.valueToday));
|
|
64
|
+
ret.push(renderChangeCell(metric.value28dAgo, metric.valueToday));
|
|
65
|
+
return ret;
|
|
66
|
+
}
|
|
67
|
+
exports.buildMetricsTableRow = buildMetricsTableRow;
|
|
68
|
+
function renderChangeCell(before, after) {
|
|
69
|
+
if (!(before && after)) {
|
|
70
|
+
return "Insufficient data";
|
|
71
|
+
}
|
|
72
|
+
if (before.high === after.high) {
|
|
73
|
+
return "-";
|
|
74
|
+
}
|
|
75
|
+
if (before.high > after.high) {
|
|
76
|
+
const diff = before.high - after.high;
|
|
77
|
+
const tolerance = diff < 100 ? 10 : 100;
|
|
78
|
+
return clc.red("▼ ") + `-${diff} (±${tolerance})`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const diff = after.high - before.high;
|
|
82
|
+
const tolerance = diff < 100 ? 10 : 100;
|
|
83
|
+
return clc.green("▲ ") + `${diff} (±${tolerance})`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function buildRef(ts) {
|
|
87
|
+
const publisherId = ts.resource.labels["publisher"];
|
|
88
|
+
const extensionId = ts.resource.labels["extension"];
|
|
89
|
+
const version = ts.resource.labels["version"];
|
|
90
|
+
if (!(publisherId && extensionId && version)) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
publisherId,
|
|
95
|
+
extensionId,
|
|
96
|
+
version,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -46,7 +46,7 @@ async function getParams(args) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
const firebaseProjectParams = await extensionsHelper_1.getFirebaseProjectParams(args.projectId);
|
|
49
|
+
const firebaseProjectParams = await (0, extensionsHelper_1.getFirebaseProjectParams)(args.projectId);
|
|
50
50
|
params = await askUserForParam.ask(args.projectId, args.instanceId, args.paramSpecs, firebaseProjectParams, !!args.reconfiguring);
|
|
51
51
|
}
|
|
52
52
|
track("Extension Params", _.isEmpty(params) ? "Not Present" : "Present", _.size(params));
|
|
@@ -87,14 +87,14 @@ async function getParamsForUpdate(args) {
|
|
|
87
87
|
}
|
|
88
88
|
exports.getParamsForUpdate = getParamsForUpdate;
|
|
89
89
|
async function promptForNewParams(args) {
|
|
90
|
-
const firebaseProjectParams = await extensionsHelper_1.getFirebaseProjectParams(args.projectId);
|
|
90
|
+
const firebaseProjectParams = await (0, extensionsHelper_1.getFirebaseProjectParams)(args.projectId);
|
|
91
91
|
const comparer = (param1, param2) => {
|
|
92
92
|
return param1.type === param2.type && param1.param === param2.param;
|
|
93
93
|
};
|
|
94
94
|
let paramsDiffDeletions = _.differenceWith(args.spec.params, _.get(args.newSpec, "params", []), comparer);
|
|
95
|
-
paramsDiffDeletions = extensionsHelper_1.substituteParams(paramsDiffDeletions, firebaseProjectParams);
|
|
95
|
+
paramsDiffDeletions = (0, extensionsHelper_1.substituteParams)(paramsDiffDeletions, firebaseProjectParams);
|
|
96
96
|
let paramsDiffAdditions = _.differenceWith(args.newSpec.params, _.get(args.spec, "params", []), comparer);
|
|
97
|
-
paramsDiffAdditions = extensionsHelper_1.substituteParams(paramsDiffAdditions, firebaseProjectParams);
|
|
97
|
+
paramsDiffAdditions = (0, extensionsHelper_1.substituteParams)(paramsDiffAdditions, firebaseProjectParams);
|
|
98
98
|
if (paramsDiffDeletions.length) {
|
|
99
99
|
logger_1.logger.info("The following params will no longer be used:");
|
|
100
100
|
paramsDiffDeletions.forEach((param) => {
|
|
@@ -122,8 +122,8 @@ function getParamsFromFile(args) {
|
|
|
122
122
|
track("Extension Env File", "Invalid");
|
|
123
123
|
throw new error_1.FirebaseError(`Error reading env file: ${err.message}\n`, { original: err });
|
|
124
124
|
}
|
|
125
|
-
const params = extensionsHelper_1.populateDefaultParams(envParams, args.paramSpecs);
|
|
126
|
-
extensionsHelper_1.validateCommandLineParams(params, args.paramSpecs);
|
|
125
|
+
const params = (0, extensionsHelper_1.populateDefaultParams)(envParams, args.paramSpecs);
|
|
126
|
+
(0, extensionsHelper_1.validateCommandLineParams)(params, args.paramSpecs);
|
|
127
127
|
logger_1.logger.info(`Using param values from ${args.paramsEnvPath}`);
|
|
128
128
|
return params;
|
|
129
129
|
}
|
|
@@ -18,10 +18,10 @@ async function checkProductsProvisioned(projectId, spec) {
|
|
|
18
18
|
exports.checkProductsProvisioned = checkProductsProvisioned;
|
|
19
19
|
async function bulkCheckProductsProvisioned(projectId, instanceSpecs) {
|
|
20
20
|
const usedProducts = await Promise.all(instanceSpecs.map(async (i) => {
|
|
21
|
-
const extensionVersion = await planner_1.getExtensionVersion(i);
|
|
21
|
+
const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
|
|
22
22
|
return getUsedProducts(extensionVersion.spec);
|
|
23
23
|
}));
|
|
24
|
-
await checkProducts(projectId, [...functional_1.flattenArray(usedProducts)]);
|
|
24
|
+
await checkProducts(projectId, [...(0, functional_1.flattenArray)(usedProducts)]);
|
|
25
25
|
}
|
|
26
26
|
exports.bulkCheckProductsProvisioned = bulkCheckProductsProvisioned;
|
|
27
27
|
async function checkProducts(projectId, usedProducts) {
|
|
@@ -66,11 +66,13 @@ function getUsedProducts(spec) {
|
|
|
66
66
|
const usedApis = (_a = spec.apis) === null || _a === void 0 ? void 0 : _a.map((api) => api.apiName);
|
|
67
67
|
const usedRoles = (_b = spec.roles) === null || _b === void 0 ? void 0 : _b.map((r) => r.role.split(".")[0]);
|
|
68
68
|
const usedTriggers = spec.resources.map((r) => getTriggerType(r.propertiesYaml));
|
|
69
|
-
if ((usedApis === null || usedApis === void 0 ? void 0 : usedApis.includes("storage-component.googleapis.com")) ||
|
|
69
|
+
if ((usedApis === null || usedApis === void 0 ? void 0 : usedApis.includes("storage-component.googleapis.com")) ||
|
|
70
|
+
(usedRoles === null || usedRoles === void 0 ? void 0 : usedRoles.includes("storage")) ||
|
|
70
71
|
usedTriggers.find((t) => t === null || t === void 0 ? void 0 : t.startsWith("google.storage."))) {
|
|
71
72
|
usedProducts.push(DeferredProduct.STORAGE);
|
|
72
73
|
}
|
|
73
|
-
if ((usedApis === null || usedApis === void 0 ? void 0 : usedApis.includes("identitytoolkit.googleapis.com")) ||
|
|
74
|
+
if ((usedApis === null || usedApis === void 0 ? void 0 : usedApis.includes("identitytoolkit.googleapis.com")) ||
|
|
75
|
+
(usedRoles === null || usedRoles === void 0 ? void 0 : usedRoles.includes("firebaseauth")) ||
|
|
74
76
|
usedTriggers.find((t) => t === null || t === void 0 ? void 0 : t.startsWith("providers/firebase.auth/"))) {
|
|
75
77
|
usedProducts.push(DeferredProduct.AUTH);
|
|
76
78
|
}
|
|
@@ -14,7 +14,7 @@ async function confirmUpdateWarning(updateWarning) {
|
|
|
14
14
|
if (updateWarning.action) {
|
|
15
15
|
logger_1.logger.info(marked(updateWarning.action));
|
|
16
16
|
}
|
|
17
|
-
const continueUpdate = await prompt_1.promptOnce({
|
|
17
|
+
const continueUpdate = await (0, prompt_1.promptOnce)({
|
|
18
18
|
type: "confirm",
|
|
19
19
|
message: "Do you wish to continue with this update?",
|
|
20
20
|
default: false,
|
|
@@ -10,8 +10,8 @@ const secretManagerApi = require("../gcp/secretManager");
|
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
11
|
exports.SECRET_LABEL = "firebase-extensions-managed";
|
|
12
12
|
async function ensureSecretManagerApiEnabled(options) {
|
|
13
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
14
|
-
return await ensureApiEnabled_1.ensure(projectId, "secretmanager.googleapis.com", "extensions", options.markdown);
|
|
13
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
14
|
+
return await (0, ensureApiEnabled_1.ensure)(projectId, "secretmanager.googleapis.com", "extensions", options.markdown);
|
|
15
15
|
}
|
|
16
16
|
exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
|
|
17
17
|
function usesSecrets(spec) {
|
|
@@ -19,7 +19,7 @@ function usesSecrets(spec) {
|
|
|
19
19
|
}
|
|
20
20
|
exports.usesSecrets = usesSecrets;
|
|
21
21
|
async function grantFirexServiceAgentSecretAdminRole(secret) {
|
|
22
|
-
const projectNumber = await getProjectNumber_1.getProjectNumber({ projectId: secret.projectId });
|
|
22
|
+
const projectNumber = await (0, getProjectNumber_1.getProjectNumber)({ projectId: secret.projectId });
|
|
23
23
|
const firexSaProjectId = utils.envOverride("FIREBASE_EXTENSIONS_SA_PROJECT_ID", "gcp-sa-firebasemods");
|
|
24
24
|
const saEmail = `service-${projectNumber}@${firexSaProjectId}.iam.gserviceaccount.com`;
|
|
25
25
|
return secretManagerApi.grantServiceAgentRole(secret, saEmail, "roles/secretmanager.admin");
|
|
@@ -55,8 +55,8 @@ function warningUpdateToOtherSource(sourceOrigin) {
|
|
|
55
55
|
exports.warningUpdateToOtherSource = warningUpdateToOtherSource;
|
|
56
56
|
async function displayChanges(args) {
|
|
57
57
|
utils.logLabeledBullet("extensions", "This update contains the following changes:");
|
|
58
|
-
displayExtensionInfo_1.displayUpdateChangesNoInput(args.spec, args.newSpec);
|
|
59
|
-
await displayExtensionInfo_1.displayUpdateChangesRequiringConfirmation(args);
|
|
58
|
+
(0, displayExtensionInfo_1.displayUpdateChangesNoInput)(args.spec, args.newSpec);
|
|
59
|
+
await (0, displayExtensionInfo_1.displayUpdateChangesRequiringConfirmation)(args);
|
|
60
60
|
}
|
|
61
61
|
exports.displayChanges = displayChanges;
|
|
62
62
|
async function update(updateOptions) {
|
|
@@ -81,10 +81,10 @@ async function update(updateOptions) {
|
|
|
81
81
|
}
|
|
82
82
|
exports.update = update;
|
|
83
83
|
async function updateFromLocalSource(projectId, instanceId, localSource, existingSpec) {
|
|
84
|
-
displayExtensionInfo_1.displayExtInfo(instanceId, "", existingSpec, false);
|
|
84
|
+
(0, displayExtensionInfo_1.displayExtInfo)(instanceId, "", existingSpec, false);
|
|
85
85
|
let source;
|
|
86
86
|
try {
|
|
87
|
-
source = await extensionsHelper_1.createSourceFromLocation(projectId, localSource);
|
|
87
|
+
source = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, localSource);
|
|
88
88
|
}
|
|
89
89
|
catch (err) {
|
|
90
90
|
throw new error_1.FirebaseError(invalidSourceErrMsgTemplate(instanceId, localSource));
|
|
@@ -96,10 +96,10 @@ async function updateFromLocalSource(projectId, instanceId, localSource, existin
|
|
|
96
96
|
}
|
|
97
97
|
exports.updateFromLocalSource = updateFromLocalSource;
|
|
98
98
|
async function updateFromUrlSource(projectId, instanceId, urlSource, existingSpec) {
|
|
99
|
-
displayExtensionInfo_1.displayExtInfo(instanceId, "", existingSpec, false);
|
|
99
|
+
(0, displayExtensionInfo_1.displayExtInfo)(instanceId, "", existingSpec, false);
|
|
100
100
|
let source;
|
|
101
101
|
try {
|
|
102
|
-
source = await extensionsHelper_1.createSourceFromLocation(projectId, urlSource);
|
|
102
|
+
source = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, urlSource);
|
|
103
103
|
}
|
|
104
104
|
catch (err) {
|
|
105
105
|
throw new error_1.FirebaseError(invalidSourceErrMsgTemplate(instanceId, urlSource));
|
|
@@ -115,7 +115,7 @@ async function updateToVersionFromPublisherSource(projectId, instanceId, extVers
|
|
|
115
115
|
const ref = refs.parse(extVersionRef);
|
|
116
116
|
const version = ref.version;
|
|
117
117
|
const extensionRef = refs.toExtensionRef(ref);
|
|
118
|
-
displayExtensionInfo_1.displayExtInfo(instanceId, ref.publisherId, existingSpec, true);
|
|
118
|
+
(0, displayExtensionInfo_1.displayExtInfo)(instanceId, ref.publisherId, existingSpec, true);
|
|
119
119
|
const extension = await extensionsApi.getExtension(extensionRef);
|
|
120
120
|
try {
|
|
121
121
|
source = await extensionsApi.getExtensionVersion(extVersionRef);
|
|
@@ -160,12 +160,12 @@ function inferUpdateSource(updateSource, existingRef) {
|
|
|
160
160
|
if (semver.valid(updateSource)) {
|
|
161
161
|
return `${existingRef}@${updateSource}`;
|
|
162
162
|
}
|
|
163
|
-
if (!extensionsHelper_1.isLocalOrURLPath(updateSource) && updateSource.split("/").length < 2) {
|
|
163
|
+
if (!(0, extensionsHelper_1.isLocalOrURLPath)(updateSource) && updateSource.split("/").length < 2) {
|
|
164
164
|
return updateSource.includes("@")
|
|
165
165
|
? `firebase/${updateSource}`
|
|
166
166
|
: `firebase/${updateSource}@latest`;
|
|
167
167
|
}
|
|
168
|
-
if (!extensionsHelper_1.isLocalOrURLPath(updateSource) && !updateSource.includes("@")) {
|
|
168
|
+
if (!(0, extensionsHelper_1.isLocalOrURLPath)(updateSource) && !updateSource.includes("@")) {
|
|
169
169
|
return `${updateSource}@latest`;
|
|
170
170
|
}
|
|
171
171
|
return updateSource;
|
package/lib/extensions/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.formatTimestamp = exports.getRandomString = exports.convertOfficialExten
|
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const prompt_1 = require("../prompt");
|
|
6
6
|
async function onceWithJoin(question) {
|
|
7
|
-
const response = await prompt_1.promptOnce(question);
|
|
7
|
+
const response = await (0, prompt_1.promptOnce)(question);
|
|
8
8
|
if (Array.isArray(response)) {
|
|
9
9
|
return response.join(",");
|
|
10
10
|
}
|
|
@@ -16,13 +16,13 @@ function displayEAPWarning({ publisherId, sourceDownloadUri, githubLink, }) {
|
|
|
16
16
|
const warningMsg = `This extension is in preview and is built by a developer in the [Extensions Publisher Early Access Program](http://bit.ly/firex-provider). Its functionality might change in backward-incompatible ways. Since this extension isn't built by Firebase, reach out to ${publisherNameLink} with questions about this extension.`;
|
|
17
17
|
const legalMsg = "\n\nIt is provided “AS IS”, without any warranty, express or implied, from Google. Google disclaims all liability for any damages, direct or indirect, resulting from the use of the extension, and its functionality might change in backward - incompatible ways.";
|
|
18
18
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(warningMsg + legalMsg));
|
|
19
|
-
displayExtensionInfo_1.printSourceDownloadLink(sourceDownloadUri);
|
|
19
|
+
(0, displayExtensionInfo_1.printSourceDownloadLink)(sourceDownloadUri);
|
|
20
20
|
}
|
|
21
21
|
function displayExperimentalWarning() {
|
|
22
22
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`${clc.yellow.bold("Important")}: This extension is ${clc.bold("experimental")} and may not be production-ready. Its functionality might change in backward-incompatible ways before its official release, or it may be discontinued.`));
|
|
23
23
|
}
|
|
24
24
|
async function displayWarningPrompts(publisherId, launchStage, extensionVersion) {
|
|
25
|
-
const trustedPublishers = await resolveSource_1.getTrustedPublishers();
|
|
25
|
+
const trustedPublishers = await (0, resolveSource_1.getTrustedPublishers)();
|
|
26
26
|
if (!trustedPublishers.includes(publisherId)) {
|
|
27
27
|
displayEAPWarning({
|
|
28
28
|
publisherId,
|
|
@@ -40,22 +40,23 @@ async function displayWarningPrompts(publisherId, launchStage, extensionVersion)
|
|
|
40
40
|
exports.displayWarningPrompts = displayWarningPrompts;
|
|
41
41
|
const toListEntry = (i) => {
|
|
42
42
|
var _a, _b, _c, _d;
|
|
43
|
-
const idAndRef = deploymentSummary_1.humanReadable(i);
|
|
43
|
+
const idAndRef = (0, deploymentSummary_1.humanReadable)(i);
|
|
44
44
|
const sourceCodeLink = `\n\t[Source Code](${(_a = i.extensionVersion) === null || _a === void 0 ? void 0 : _a.sourceDownloadUri})`;
|
|
45
|
-
const githubLink = ((_c = (_b = i.extensionVersion) === null || _b === void 0 ? void 0 : _b.spec) === null || _c === void 0 ? void 0 : _c.sourceUrl)
|
|
45
|
+
const githubLink = ((_c = (_b = i.extensionVersion) === null || _b === void 0 ? void 0 : _b.spec) === null || _c === void 0 ? void 0 : _c.sourceUrl)
|
|
46
|
+
? `\n\t[Publisher Contact](${(_d = i.extensionVersion) === null || _d === void 0 ? void 0 : _d.spec.sourceUrl})`
|
|
46
47
|
: "";
|
|
47
48
|
return `${idAndRef}${sourceCodeLink}${githubLink}`;
|
|
48
49
|
};
|
|
49
50
|
async function displayWarningsForDeploy(instancesToCreate) {
|
|
50
|
-
const trustedPublishers = await resolveSource_1.getTrustedPublishers();
|
|
51
|
+
const trustedPublishers = await (0, resolveSource_1.getTrustedPublishers)();
|
|
51
52
|
for (const i of instancesToCreate) {
|
|
52
|
-
await planner_1.getExtension(i);
|
|
53
|
-
await planner_1.getExtensionVersion(i);
|
|
53
|
+
await (0, planner_1.getExtension)(i);
|
|
54
|
+
await (0, planner_1.getExtensionVersion)(i);
|
|
54
55
|
}
|
|
55
|
-
const [eapExtensions, nonEapExtensions] = functional_1.partition(instancesToCreate, (i) => { var _a, _b; return !trustedPublishers.includes((_b = (_a = i.ref) === null || _a === void 0 ? void 0 : _a.publisherId) !== null && _b !== void 0 ? _b : ""); });
|
|
56
|
+
const [eapExtensions, nonEapExtensions] = (0, functional_1.partition)(instancesToCreate, (i) => { var _a, _b; return !trustedPublishers.includes((_b = (_a = i.ref) === null || _a === void 0 ? void 0 : _a.publisherId) !== null && _b !== void 0 ? _b : ""); });
|
|
56
57
|
const experimental = nonEapExtensions.filter((i) => i.extension.registryLaunchStage === extensionsApi_1.RegistryLaunchStage.EXPERIMENTAL);
|
|
57
58
|
if (experimental.length) {
|
|
58
|
-
const humanReadableList = experimental.map((i) => `\t${deploymentSummary_1.humanReadable(i)}`).join("\n");
|
|
59
|
+
const humanReadableList = experimental.map((i) => `\t${(0, deploymentSummary_1.humanReadable)(i)}`).join("\n");
|
|
59
60
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`The following are instances of ${clc.bold("experimental")} extensions.They may not be production-ready. Their functionality may change in backward-incompatible ways before their official release, or they may be discontinued.\n${humanReadableList}\n`));
|
|
60
61
|
}
|
|
61
62
|
if (eapExtensions.length) {
|
package/lib/fetchWebSetup.js
CHANGED
|
@@ -20,7 +20,7 @@ function setCachedWebSetup(projectId, config) {
|
|
|
20
20
|
configstore_1.configstore.set(CONFIGSTORE_KEY, allConfigs);
|
|
21
21
|
}
|
|
22
22
|
function getCachedWebSetup(options) {
|
|
23
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
23
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
24
24
|
const allConfigs = configstore_1.configstore.get(CONFIGSTORE_KEY) || {};
|
|
25
25
|
return allConfigs[projectId];
|
|
26
26
|
}
|
|
@@ -47,7 +47,7 @@ function constructDefaultWebSetup(projectId) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
async function fetchWebSetup(options) {
|
|
50
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
50
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
51
51
|
if (constants_1.Constants.isDemoProject(projectId)) {
|
|
52
52
|
return constructDefaultWebSetup(projectId);
|
|
53
53
|
}
|
package/lib/filterTargets.js
CHANGED
|
@@ -8,12 +8,12 @@ function filterTargets(options, validTargets) {
|
|
|
8
8
|
return options.config.has(t);
|
|
9
9
|
});
|
|
10
10
|
if (options.only) {
|
|
11
|
-
targets = lodash_1.intersection(targets, options.only.split(",").map((opt) => {
|
|
11
|
+
targets = (0, lodash_1.intersection)(targets, options.only.split(",").map((opt) => {
|
|
12
12
|
return opt.split(":")[0];
|
|
13
13
|
}));
|
|
14
14
|
}
|
|
15
15
|
else if (options.except) {
|
|
16
|
-
targets = lodash_1.difference(targets, options.except.split(","));
|
|
16
|
+
targets = (0, lodash_1.difference)(targets, options.except.split(","));
|
|
17
17
|
}
|
|
18
18
|
if (targets.length === 0) {
|
|
19
19
|
let msg = "Cannot understand what targets to deploy/serve.";
|
package/lib/firestore/indexes.js
CHANGED
|
@@ -49,7 +49,7 @@ class FirestoreIndexes {
|
|
|
49
49
|
utils.logLabeledBullet("firestore", `The following indexes are defined in your project but are not present in your firestore indexes file:\n\t${indexesString}`);
|
|
50
50
|
}
|
|
51
51
|
if (!shouldDeleteIndexes) {
|
|
52
|
-
shouldDeleteIndexes = await prompt_1.promptOnce({
|
|
52
|
+
shouldDeleteIndexes = await (0, prompt_1.promptOnce)({
|
|
53
53
|
type: "confirm",
|
|
54
54
|
name: "confirm",
|
|
55
55
|
default: false,
|
|
@@ -86,7 +86,7 @@ class FirestoreIndexes {
|
|
|
86
86
|
utils.logLabeledBullet("firestore", `The following field overrides are defined in your project but are not present in your firestore indexes file:\n\t${indexesString}`);
|
|
87
87
|
}
|
|
88
88
|
if (!shouldDeleteFields) {
|
|
89
|
-
shouldDeleteFields = await prompt_1.promptOnce({
|
|
89
|
+
shouldDeleteFields = await (0, prompt_1.promptOnce)({
|
|
90
90
|
type: "confirm",
|
|
91
91
|
name: "confirm",
|
|
92
92
|
default: false,
|
package/lib/fsAsync.js
CHANGED
|
@@ -6,12 +6,12 @@ const fs_extra_1 = require("fs-extra");
|
|
|
6
6
|
const _ = require("lodash");
|
|
7
7
|
const minimatch = require("minimatch");
|
|
8
8
|
async function readdirRecursiveHelper(options) {
|
|
9
|
-
const dirContents = fs_extra_1.readdirSync(options.path);
|
|
10
|
-
const fullPaths = dirContents.map((n) => path_1.join(options.path, n));
|
|
9
|
+
const dirContents = (0, fs_extra_1.readdirSync)(options.path);
|
|
10
|
+
const fullPaths = dirContents.map((n) => (0, path_1.join)(options.path, n));
|
|
11
11
|
const filteredPaths = _.reject(fullPaths, options.filter);
|
|
12
12
|
const filePromises = [];
|
|
13
13
|
for (const p of filteredPaths) {
|
|
14
|
-
const fstat = fs_extra_1.statSync(p);
|
|
14
|
+
const fstat = (0, fs_extra_1.statSync)(p);
|
|
15
15
|
if (fstat.isFile()) {
|
|
16
16
|
filePromises.push(Promise.resolve({ name: p, mode: fstat.mode }));
|
|
17
17
|
}
|
package/lib/fsutils.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.dirExistsSync = exports.fileExistsSync = void 0;
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
function fileExistsSync(path) {
|
|
6
6
|
try {
|
|
7
|
-
return fs_1.statSync(path).isFile();
|
|
7
|
+
return (0, fs_1.statSync)(path).isFile();
|
|
8
8
|
}
|
|
9
9
|
catch (e) {
|
|
10
10
|
return false;
|
|
@@ -13,7 +13,7 @@ function fileExistsSync(path) {
|
|
|
13
13
|
exports.fileExistsSync = fileExistsSync;
|
|
14
14
|
function dirExistsSync(path) {
|
|
15
15
|
try {
|
|
16
|
-
return fs_1.statSync(path).isDirectory();
|
|
16
|
+
return (0, fs_1.statSync)(path).isDirectory();
|
|
17
17
|
}
|
|
18
18
|
catch (e) {
|
|
19
19
|
return false;
|