firebase-tools 10.0.1 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.js +1 -0
- 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 +2 -2
- package/lib/commands/database-set.js +2 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +4 -4
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +13 -13
- 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 +2 -2
- 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 +6 -6
- package/lib/deploy/functions/runtimes/node/index.js +3 -3
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- 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/auth/widget_ui.js +1 -1
- 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 +32 -17
- 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 +24926 -0
- package/package.json +23 -23
- package/standalone/firepit.js +4 -4
- package/templates/init/hosting/index.html +1 -1
|
@@ -99,7 +99,7 @@ class StorageLayer {
|
|
|
99
99
|
}
|
|
100
100
|
reset() {
|
|
101
101
|
this._files = new Map();
|
|
102
|
-
this._persistence = new Persistence(`${os_1.tmpdir()}/firebase/storage/blobs`);
|
|
102
|
+
this._persistence = new Persistence(`${(0, os_1.tmpdir)()}/firebase/storage/blobs`);
|
|
103
103
|
this._uploads = new Map();
|
|
104
104
|
this._buckets = new Map();
|
|
105
105
|
}
|
|
@@ -135,7 +135,7 @@ class StorageLayer {
|
|
|
135
135
|
this._files = value;
|
|
136
136
|
}
|
|
137
137
|
startUpload(bucket, object, contentType, metadata) {
|
|
138
|
-
const uploadId = uuid_1.v4();
|
|
138
|
+
const uploadId = (0, uuid_1.v4)();
|
|
139
139
|
const upload = new ResumableUpload(bucket, object, uploadId, contentType, metadata);
|
|
140
140
|
this._uploads.set(uploadId, upload);
|
|
141
141
|
return upload;
|
|
@@ -428,8 +428,8 @@ exports.StorageLayer = StorageLayer;
|
|
|
428
428
|
class Persistence {
|
|
429
429
|
constructor(dirPath) {
|
|
430
430
|
this._dirPath = dirPath;
|
|
431
|
-
if (!fs_1.existsSync(dirPath)) {
|
|
432
|
-
fs_1.mkdirSync(dirPath, {
|
|
431
|
+
if (!(0, fs_1.existsSync)(dirPath)) {
|
|
432
|
+
(0, fs_1.mkdirSync)(dirPath, {
|
|
433
433
|
recursive: true,
|
|
434
434
|
});
|
|
435
435
|
}
|
|
@@ -441,8 +441,8 @@ class Persistence {
|
|
|
441
441
|
const filepath = this.getDiskPath(fileName);
|
|
442
442
|
const encodedSlashIndex = filepath.toLowerCase().lastIndexOf("%2f");
|
|
443
443
|
const dirPath = encodedSlashIndex >= 0 ? filepath.substring(0, encodedSlashIndex) : path.dirname(filepath);
|
|
444
|
-
if (!fs_1.existsSync(dirPath)) {
|
|
445
|
-
fs_1.mkdirSync(dirPath, {
|
|
444
|
+
if (!(0, fs_1.existsSync)(dirPath)) {
|
|
445
|
+
(0, fs_1.mkdirSync)(dirPath, {
|
|
446
446
|
recursive: true,
|
|
447
447
|
});
|
|
448
448
|
}
|
|
@@ -453,7 +453,7 @@ class Persistence {
|
|
|
453
453
|
}
|
|
454
454
|
finally {
|
|
455
455
|
if (fd) {
|
|
456
|
-
fs_1.closeSync(fd);
|
|
456
|
+
(0, fs_1.closeSync)(fd);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
}
|
|
@@ -461,21 +461,21 @@ class Persistence {
|
|
|
461
461
|
const path = this.getDiskPath(fileName);
|
|
462
462
|
let fd;
|
|
463
463
|
try {
|
|
464
|
-
fd = fs_1.openSync(path, "r");
|
|
464
|
+
fd = (0, fs_1.openSync)(path, "r");
|
|
465
465
|
const buf = Buffer.alloc(size);
|
|
466
466
|
const offset = fileOffset && fileOffset > 0 ? fileOffset : 0;
|
|
467
|
-
fs_1.readSync(fd, buf, 0, size, offset);
|
|
467
|
+
(0, fs_1.readSync)(fd, buf, 0, size, offset);
|
|
468
468
|
return buf;
|
|
469
469
|
}
|
|
470
470
|
finally {
|
|
471
471
|
if (fd) {
|
|
472
|
-
fs_1.closeSync(fd);
|
|
472
|
+
(0, fs_1.closeSync)(fd);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
deleteFile(fileName, failSilently = false) {
|
|
477
477
|
try {
|
|
478
|
-
fs_1.unlinkSync(this.getDiskPath(fileName));
|
|
478
|
+
(0, fs_1.unlinkSync)(this.getDiskPath(fileName));
|
|
479
479
|
}
|
|
480
480
|
catch (err) {
|
|
481
481
|
if (!failSilently) {
|
|
@@ -497,12 +497,12 @@ class Persistence {
|
|
|
497
497
|
}
|
|
498
498
|
renameFile(oldName, newName) {
|
|
499
499
|
const dirPath = this.getDiskPath(path.dirname(newName));
|
|
500
|
-
if (!fs_1.existsSync(dirPath)) {
|
|
501
|
-
fs_1.mkdirSync(dirPath, {
|
|
500
|
+
if (!(0, fs_1.existsSync)(dirPath)) {
|
|
501
|
+
(0, fs_1.mkdirSync)(dirPath, {
|
|
502
502
|
recursive: true,
|
|
503
503
|
});
|
|
504
504
|
}
|
|
505
|
-
fs_1.renameSync(this.getDiskPath(oldName), this.getDiskPath(newName));
|
|
505
|
+
(0, fs_1.renameSync)(this.getDiskPath(oldName), this.getDiskPath(newName));
|
|
506
506
|
}
|
|
507
507
|
getDiskPath(fileName) {
|
|
508
508
|
return path.join(this._dirPath, fileName);
|
|
@@ -16,7 +16,7 @@ class StorageEmulator {
|
|
|
16
16
|
constructor(args) {
|
|
17
17
|
this.args = args;
|
|
18
18
|
this._logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.STORAGE);
|
|
19
|
-
const downloadDetails = downloadableEmulators_1.getDownloadDetails(types_1.Emulators.STORAGE);
|
|
19
|
+
const downloadDetails = (0, downloadableEmulators_1.getDownloadDetails)(types_1.Emulators.STORAGE);
|
|
20
20
|
this._rulesRuntime = new runtime_1.StorageRulesRuntime();
|
|
21
21
|
this._storageLayer = new files_1.StorageLayer(args.projectId);
|
|
22
22
|
}
|
|
@@ -32,7 +32,7 @@ class StorageEmulator {
|
|
|
32
32
|
async start() {
|
|
33
33
|
const { host, port } = this.getInfo();
|
|
34
34
|
await this._rulesRuntime.start(this.args.auto_download);
|
|
35
|
-
this._app = await server_1.createApp(this.args.projectId, this);
|
|
35
|
+
this._app = await (0, server_1.createApp)(this.args.projectId, this);
|
|
36
36
|
if (typeof this.args.rules == "string") {
|
|
37
37
|
const rulesFile = this.args.rules;
|
|
38
38
|
this.updateRulesSource(rulesFile);
|
|
@@ -28,7 +28,7 @@ class StoredFileMetadata {
|
|
|
28
28
|
if (bytes) {
|
|
29
29
|
this.size = bytes.byteLength;
|
|
30
30
|
this.md5Hash = generateMd5Hash(bytes);
|
|
31
|
-
this.crc32c = `${crc_1.crc32c(bytes)}`;
|
|
31
|
+
this.crc32c = `${(0, crc_1.crc32c)(bytes)}`;
|
|
32
32
|
}
|
|
33
33
|
else if (opts.size !== undefined && opts.md5Hash && opts.crc32c) {
|
|
34
34
|
this.size = opts.size;
|
|
@@ -268,16 +268,17 @@ class CloudStorageObjectMetadata {
|
|
|
268
268
|
}
|
|
269
269
|
exports.CloudStorageObjectMetadata = CloudStorageObjectMetadata;
|
|
270
270
|
function toSerializedDate(d) {
|
|
271
|
-
const day = `${d.getFullYear()}-${(d.getMonth() + 1)
|
|
271
|
+
const day = `${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, "0")}-${d
|
|
272
|
+
.getDate()
|
|
272
273
|
.toString()
|
|
273
|
-
.padStart(2, "0")}
|
|
274
|
+
.padStart(2, "0")}`;
|
|
274
275
|
const time = `${d.getHours().toString().padStart(2, "0")}:${d
|
|
275
276
|
.getMinutes()
|
|
276
277
|
.toString()
|
|
277
|
-
.padStart(2, "0")}:${d
|
|
278
|
-
.
|
|
278
|
+
.padStart(2, "0")}:${d.getSeconds().toString().padStart(2, "0")}.${d
|
|
279
|
+
.getMilliseconds()
|
|
279
280
|
.toString()
|
|
280
|
-
.padStart(
|
|
281
|
+
.padStart(3, "0")}`;
|
|
281
282
|
return `${day}T${time}Z`;
|
|
282
283
|
}
|
|
283
284
|
exports.toSerializedDate = toSerializedDate;
|
|
@@ -69,7 +69,7 @@ class StorageRulesRuntime {
|
|
|
69
69
|
if (process.env.CI) {
|
|
70
70
|
utils.logWarning(`It appears you are running in a CI environment. You can avoid downloading the ${constants_1.Constants.description(types_2.Emulators.STORAGE)} repeatedly by caching the ${downloadDetails.opts.cacheDir} directory.`);
|
|
71
71
|
}
|
|
72
|
-
await download_1.downloadEmulator(types_2.Emulators.STORAGE);
|
|
72
|
+
await (0, download_1.downloadEmulator)(types_2.Emulators.STORAGE);
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
75
|
utils.logWarning("Setup required, please run: firebase setup:emulators:storage");
|
|
@@ -77,8 +77,8 @@ class StorageRulesRuntime {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
this._alive = true;
|
|
80
|
-
const command = downloadableEmulators_1._getCommand(types_2.Emulators.STORAGE, {});
|
|
81
|
-
this._childprocess = cross_spawn_1.spawn(command.binary, command.args, {
|
|
80
|
+
const command = (0, downloadableEmulators_1._getCommand)(types_2.Emulators.STORAGE, {});
|
|
81
|
+
this._childprocess = (0, cross_spawn_1.spawn)(command.binary, command.args, {
|
|
82
82
|
stdio: ["pipe", "pipe", "pipe"],
|
|
83
83
|
});
|
|
84
84
|
this._childprocess.on("exit", (code) => {
|
|
@@ -97,7 +97,7 @@ class StorageRulesRuntime {
|
|
|
97
97
|
};
|
|
98
98
|
});
|
|
99
99
|
this._childprocess.on("error", (err) => {
|
|
100
|
-
downloadableEmulators_1.handleEmulatorProcessError(types_2.Emulators.STORAGE, err);
|
|
100
|
+
(0, downloadableEmulators_1.handleEmulatorProcessError)(types_2.Emulators.STORAGE, err);
|
|
101
101
|
});
|
|
102
102
|
this._childprocess.stderr.on("data", (buf) => {
|
|
103
103
|
const error = buf.toString();
|
|
@@ -232,7 +232,7 @@ function toExpressionValue(obj) {
|
|
|
232
232
|
}
|
|
233
233
|
if (obj instanceof Date) {
|
|
234
234
|
return {
|
|
235
|
-
timestamp_value: metadata_1.toSerializedDate(obj),
|
|
235
|
+
timestamp_value: (0, metadata_1.toSerializedDate)(obj),
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
if (Array.isArray(obj)) {
|
|
@@ -73,8 +73,8 @@ function createApp(defaultProjectId, emulator) {
|
|
|
73
73
|
storageLayer.reset();
|
|
74
74
|
res.sendStatus(200);
|
|
75
75
|
});
|
|
76
|
-
app.use("/v0", firebase_1.createFirebaseEndpoints(emulator));
|
|
77
|
-
app.use("/", gcloud_1.createCloudEndpoints(emulator));
|
|
76
|
+
app.use("/v0", (0, firebase_1.createFirebaseEndpoints)(emulator));
|
|
77
|
+
app.use("/", (0, gcloud_1.createCloudEndpoints)(emulator));
|
|
78
78
|
return Promise.resolve(app);
|
|
79
79
|
}
|
|
80
80
|
exports.createApp = createApp;
|
package/lib/ensureApiEnabled.js
CHANGED
|
@@ -19,7 +19,7 @@ async function check(projectId, apiName, prefix, silent = false) {
|
|
|
19
19
|
const res = await apiClient.get(`/projects/${projectId}/services/${apiName}`);
|
|
20
20
|
const isEnabled = res.body.state === "ENABLED";
|
|
21
21
|
if (isEnabled && !silent) {
|
|
22
|
-
utils.logLabeledSuccess(prefix, `required API ${cli_color_1.bold(apiName)} is enabled`);
|
|
22
|
+
utils.logLabeledSuccess(prefix, `required API ${(0, cli_color_1.bold)(apiName)} is enabled`);
|
|
23
23
|
}
|
|
24
24
|
return isEnabled;
|
|
25
25
|
}
|
|
@@ -29,8 +29,8 @@ async function enable(projectId, apiName) {
|
|
|
29
29
|
await apiClient.post(`/projects/${projectId}/services/${apiName}:enable`);
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
32
|
-
if (error_1.isBillingError(err)) {
|
|
33
|
-
throw new error_1.FirebaseError(`Your project ${cli_color_1.bold(projectId)} must be on the Blaze (pay-as-you-go) plan to complete this command. Required API ${cli_color_1.bold(apiName)} can't be enabled until the upgrade is complete. To upgrade, visit the following URL:
|
|
32
|
+
if ((0, error_1.isBillingError)(err)) {
|
|
33
|
+
throw new error_1.FirebaseError(`Your project ${(0, cli_color_1.bold)(projectId)} must be on the Blaze (pay-as-you-go) plan to complete this command. Required API ${(0, cli_color_1.bold)(apiName)} can't be enabled until the upgrade is complete. To upgrade, visit the following URL:
|
|
34
34
|
|
|
35
35
|
https://console.firebase.google.com/project/${projectId}/usage/details`);
|
|
36
36
|
}
|
|
@@ -50,27 +50,27 @@ async function pollCheckEnabled(projectId, apiName, prefix, silent, enablementRe
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
if (!silent) {
|
|
53
|
-
utils.logLabeledBullet(prefix, `waiting for API ${cli_color_1.bold(apiName)} to activate...`);
|
|
53
|
+
utils.logLabeledBullet(prefix, `waiting for API ${(0, cli_color_1.bold)(apiName)} to activate...`);
|
|
54
54
|
}
|
|
55
55
|
return pollCheckEnabled(projectId, apiName, prefix, silent, enablementRetries, pollRetries + 1);
|
|
56
56
|
}
|
|
57
57
|
async function enableApiWithRetries(projectId, apiName, prefix, silent, enablementRetries = 0) {
|
|
58
58
|
if (enablementRetries > 1) {
|
|
59
|
-
throw new error_1.FirebaseError(`Timed out waiting for API ${cli_color_1.bold(apiName)} to enable. Please try again in a few minutes.`);
|
|
59
|
+
throw new error_1.FirebaseError(`Timed out waiting for API ${(0, cli_color_1.bold)(apiName)} to enable. Please try again in a few minutes.`);
|
|
60
60
|
}
|
|
61
61
|
await enable(projectId, apiName);
|
|
62
62
|
return pollCheckEnabled(projectId, apiName, prefix, silent, enablementRetries);
|
|
63
63
|
}
|
|
64
64
|
async function ensure(projectId, apiName, prefix, silent = false) {
|
|
65
65
|
if (!silent) {
|
|
66
|
-
utils.logLabeledBullet(prefix, `ensuring required API ${cli_color_1.bold(apiName)} is enabled...`);
|
|
66
|
+
utils.logLabeledBullet(prefix, `ensuring required API ${(0, cli_color_1.bold)(apiName)} is enabled...`);
|
|
67
67
|
}
|
|
68
68
|
const isEnabled = await check(projectId, apiName, prefix, silent);
|
|
69
69
|
if (isEnabled) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (!silent) {
|
|
73
|
-
utils.logLabeledWarning(prefix, `missing required API ${cli_color_1.bold(apiName)}. Enabling now...`);
|
|
73
|
+
utils.logLabeledWarning(prefix, `missing required API ${(0, cli_color_1.bold)(apiName)}. Enabling now...`);
|
|
74
74
|
}
|
|
75
75
|
return enableApiWithRetries(projectId, apiName, prefix, silent);
|
|
76
76
|
}
|
package/lib/error.js
CHANGED
|
@@ -9,12 +9,12 @@ class FirebaseError extends Error {
|
|
|
9
9
|
constructor(message, options = {}) {
|
|
10
10
|
super();
|
|
11
11
|
this.name = "FirebaseError";
|
|
12
|
-
this.children = lodash_1.defaultTo(options.children, DEFAULT_CHILDREN);
|
|
12
|
+
this.children = (0, lodash_1.defaultTo)(options.children, DEFAULT_CHILDREN);
|
|
13
13
|
this.context = options.context;
|
|
14
|
-
this.exit = lodash_1.defaultTo(options.exit, DEFAULT_EXIT);
|
|
14
|
+
this.exit = (0, lodash_1.defaultTo)(options.exit, DEFAULT_EXIT);
|
|
15
15
|
this.message = message;
|
|
16
16
|
this.original = options.original;
|
|
17
|
-
this.status = lodash_1.defaultTo(options.status, DEFAULT_STATUS);
|
|
17
|
+
this.status = (0, lodash_1.defaultTo)(options.status, DEFAULT_STATUS);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.FirebaseError = FirebaseError;
|
|
@@ -56,13 +56,12 @@ async function promptForPublisherTOS() {
|
|
|
56
56
|
" - If Google requests a critical security matter to be patched for your extension, you will respond to Google within 48 hours with either a resolution or a written resolution plan.\n" +
|
|
57
57
|
" - Google may remove your extension or terminate the agreement, if you violate any terms.";
|
|
58
58
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(termsOfServiceMsg));
|
|
59
|
-
const
|
|
59
|
+
const consented = await (0, prompt_1.promptOnce)({
|
|
60
60
|
name: "consent",
|
|
61
61
|
type: "confirm",
|
|
62
62
|
message: marked("Do you accept the [Firebase Extensions Publisher Terms and Conditions](https://firebase.google.com/docs/extensions/alpha/terms-of-service) and acknowledge that your information will be used in accordance with [Google's Privacy Policy](https://policies.google.com/privacy?hl=en)?"),
|
|
63
63
|
default: false,
|
|
64
|
-
};
|
|
65
|
-
const consented = await prompt_1.promptOnce(question);
|
|
64
|
+
});
|
|
66
65
|
if (!consented) {
|
|
67
66
|
throw new error_1.FirebaseError("You must agree to the terms of service to register a publisher ID.", {
|
|
68
67
|
exit: 1,
|
|
@@ -64,7 +64,7 @@ async function askForParam(projectId, instanceId, paramSpec, reconfiguring) {
|
|
|
64
64
|
while (!valid) {
|
|
65
65
|
switch (paramSpec.type) {
|
|
66
66
|
case extensionsApi_1.ParamType.SELECT:
|
|
67
|
-
response = await prompt_1.promptOnce({
|
|
67
|
+
response = await (0, prompt_1.promptOnce)({
|
|
68
68
|
name: "input",
|
|
69
69
|
type: "list",
|
|
70
70
|
default: () => {
|
|
@@ -75,12 +75,12 @@ async function askForParam(projectId, instanceId, paramSpec, reconfiguring) {
|
|
|
75
75
|
message: "Which option do you want enabled for this parameter? " +
|
|
76
76
|
"Select an option with the arrow keys, and use Enter to confirm your choice. " +
|
|
77
77
|
"You may only select one option.",
|
|
78
|
-
choices: utils_1.convertExtensionOptionToLabeledList(paramSpec.options),
|
|
78
|
+
choices: (0, utils_1.convertExtensionOptionToLabeledList)(paramSpec.options),
|
|
79
79
|
});
|
|
80
80
|
valid = checkResponse(response, paramSpec);
|
|
81
81
|
break;
|
|
82
82
|
case extensionsApi_1.ParamType.MULTISELECT:
|
|
83
|
-
response = await utils_1.onceWithJoin({
|
|
83
|
+
response = await (0, utils_1.onceWithJoin)({
|
|
84
84
|
name: "input",
|
|
85
85
|
type: "checkbox",
|
|
86
86
|
default: () => {
|
|
@@ -94,7 +94,7 @@ async function askForParam(projectId, instanceId, paramSpec, reconfiguring) {
|
|
|
94
94
|
message: "Which options do you want enabled for this parameter? " +
|
|
95
95
|
"Press Space to select, then Enter to confirm your choices. " +
|
|
96
96
|
"You may select multiple options.",
|
|
97
|
-
choices: utils_1.convertExtensionOptionToLabeledList(paramSpec.options),
|
|
97
|
+
choices: (0, utils_1.convertExtensionOptionToLabeledList)(paramSpec.options),
|
|
98
98
|
});
|
|
99
99
|
valid = checkResponse(response, paramSpec);
|
|
100
100
|
break;
|
|
@@ -105,7 +105,7 @@ async function askForParam(projectId, instanceId, paramSpec, reconfiguring) {
|
|
|
105
105
|
valid = true;
|
|
106
106
|
break;
|
|
107
107
|
default:
|
|
108
|
-
response = await prompt_1.promptOnce({
|
|
108
|
+
response = await (0, prompt_1.promptOnce)({
|
|
109
109
|
name: paramSpec.param,
|
|
110
110
|
type: "input",
|
|
111
111
|
default: paramSpec.default,
|
|
@@ -118,7 +118,7 @@ async function askForParam(projectId, instanceId, paramSpec, reconfiguring) {
|
|
|
118
118
|
}
|
|
119
119
|
exports.askForParam = askForParam;
|
|
120
120
|
async function promptReconfigureSecret(projectId, instanceId, paramSpec) {
|
|
121
|
-
const action = await prompt_1.promptOnce({
|
|
121
|
+
const action = await (0, prompt_1.promptOnce)({
|
|
122
122
|
type: "list",
|
|
123
123
|
message: `Choose what you would like to do with this secret:`,
|
|
124
124
|
choices: [
|
|
@@ -137,7 +137,7 @@ async function promptReconfigureSecret(projectId, instanceId, paramSpec) {
|
|
|
137
137
|
else {
|
|
138
138
|
secretName = await generateSecretName(projectId, instanceId, paramSpec.param);
|
|
139
139
|
}
|
|
140
|
-
const secretValue = await prompt_1.promptOnce({
|
|
140
|
+
const secretValue = await (0, prompt_1.promptOnce)({
|
|
141
141
|
name: paramSpec.param,
|
|
142
142
|
type: "password",
|
|
143
143
|
message: `This secret will be stored in Cloud Secret Manager as ${secretName}.\nEnter new value for ${paramSpec.label.trim()}:`,
|
|
@@ -167,7 +167,7 @@ async function promptReconfigureSecret(projectId, instanceId, paramSpec) {
|
|
|
167
167
|
}
|
|
168
168
|
async function promptCreateSecret(projectId, instanceId, paramSpec, secretName) {
|
|
169
169
|
const name = secretName !== null && secretName !== void 0 ? secretName : (await generateSecretName(projectId, instanceId, paramSpec.param));
|
|
170
|
-
const secretValue = await prompt_1.promptOnce({
|
|
170
|
+
const secretValue = await (0, prompt_1.promptOnce)({
|
|
171
171
|
name: paramSpec.param,
|
|
172
172
|
type: "password",
|
|
173
173
|
default: paramSpec.default,
|
|
@@ -194,7 +194,7 @@ exports.promptCreateSecret = promptCreateSecret;
|
|
|
194
194
|
async function generateSecretName(projectId, instanceId, paramName) {
|
|
195
195
|
let secretName = `ext-${instanceId}-${paramName}`;
|
|
196
196
|
while (await secretManagerApi.secretExists(projectId, secretName)) {
|
|
197
|
-
secretName += `-${utils_1.getRandomString(3)}`;
|
|
197
|
+
secretName += `-${(0, utils_1.getRandomString)(3)}`;
|
|
198
198
|
}
|
|
199
199
|
return secretName;
|
|
200
200
|
}
|
|
@@ -216,7 +216,7 @@ async function ask(projectId, instanceId, paramSpecs, firebaseProjectParams, rec
|
|
|
216
216
|
return {};
|
|
217
217
|
}
|
|
218
218
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, "answer the questions below to configure your extension:");
|
|
219
|
-
const substituted = extensionsHelper_1.substituteParams(paramSpecs, firebaseProjectParams);
|
|
219
|
+
const substituted = (0, extensionsHelper_1.substituteParams)(paramSpecs, firebaseProjectParams);
|
|
220
220
|
const result = {};
|
|
221
221
|
const promises = _.map(substituted, (paramSpec) => {
|
|
222
222
|
return async () => {
|
|
@@ -46,7 +46,7 @@ async function displayNode10CreateBillingNotice(spec, prompt) {
|
|
|
46
46
|
if (hasRuntime(spec, "nodejs10")) {
|
|
47
47
|
utils.logLabeledWarning(extensionsHelper_1.logPrefix, marked(billingMsgCreate));
|
|
48
48
|
if (prompt) {
|
|
49
|
-
const continueUpdate = await prompt_1.promptOnce({
|
|
49
|
+
const continueUpdate = await (0, prompt_1.promptOnce)({
|
|
50
50
|
type: "confirm",
|
|
51
51
|
message: "Do you wish to continue?",
|
|
52
52
|
default: true,
|
|
@@ -20,7 +20,7 @@ const VERSION_LINE_REGEX = /##.*(\d+\.\d+\.\d+).*/;
|
|
|
20
20
|
async function getReleaseNotesForUpdate(args) {
|
|
21
21
|
const releaseNotes = {};
|
|
22
22
|
const filter = `id<="${args.toVersion}" AND id>"${args.fromVersion}"`;
|
|
23
|
-
const extensionVersions = await extensionsApi_1.listExtensionVersions(args.extensionRef, filter);
|
|
23
|
+
const extensionVersions = await (0, extensionsApi_1.listExtensionVersions)(args.extensionRef, filter);
|
|
24
24
|
extensionVersions.sort((ev1, ev2) => {
|
|
25
25
|
return -semver.compare(ev1.spec.version, ev2.spec.version);
|
|
26
26
|
});
|
|
@@ -47,7 +47,7 @@ function displayReleaseNotes(releaseNotes, fromVersion) {
|
|
|
47
47
|
}
|
|
48
48
|
logger_1.logger.info(clc.bold("What's new with this update:"));
|
|
49
49
|
if (breakingVersions.length) {
|
|
50
|
-
utils_1.logLabeledWarning("warning", "This is a major version update, which means it may contain breaking changes." +
|
|
50
|
+
(0, utils_1.logLabeledWarning)("warning", "This is a major version update, which means it may contain breaking changes." +
|
|
51
51
|
" Read the release notes carefully before continuing with this update.");
|
|
52
52
|
}
|
|
53
53
|
logger_1.logger.info(table.toString());
|
|
@@ -67,7 +67,7 @@ function breakingChangesInUpdate(versionsInUpdate) {
|
|
|
67
67
|
}
|
|
68
68
|
exports.breakingChangesInUpdate = breakingChangesInUpdate;
|
|
69
69
|
function getLocalChangelog(directory) {
|
|
70
|
-
const rawChangelog = localHelper_1.readFile(path.resolve(directory, EXTENSIONS_CHANGELOG));
|
|
70
|
+
const rawChangelog = (0, localHelper_1.readFile)(path.resolve(directory, EXTENSIONS_CHANGELOG));
|
|
71
71
|
return parseChangelog(rawChangelog);
|
|
72
72
|
}
|
|
73
73
|
exports.getLocalChangelog = getLocalChangelog;
|
|
@@ -78,7 +78,7 @@ async function displayUpdateChangesRequiringConfirmation(args) {
|
|
|
78
78
|
deletionColor(args.spec.license ? `- ${args.spec.license}\n` : "- None\n") +
|
|
79
79
|
additionColor(args.newSpec.license ? `+ ${args.newSpec.license}\n` : "+ None\n");
|
|
80
80
|
logger_1.logger.info(message);
|
|
81
|
-
if (!(await extensionsHelper_1.confirm({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
81
|
+
if (!(await (0, extensionsHelper_1.confirm)({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
82
82
|
throw new error_1.FirebaseError("Unable to update this extension instance without explicit consent for the change to 'License'.");
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -93,7 +93,7 @@ async function displayUpdateChangesRequiringConfirmation(args) {
|
|
|
93
93
|
message += additionColor(`+ ${api.apiName} (${api.reason})\n`);
|
|
94
94
|
});
|
|
95
95
|
logger_1.logger.info(message);
|
|
96
|
-
if (!(await extensionsHelper_1.confirm({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
96
|
+
if (!(await (0, extensionsHelper_1.confirm)({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
97
97
|
throw new error_1.FirebaseError("Unable to update this extension instance without explicit consent for the change to 'APIs'.");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -108,7 +108,7 @@ async function displayUpdateChangesRequiringConfirmation(args) {
|
|
|
108
108
|
message += additionColor(`+ ${getResourceReadableName(resource)}`);
|
|
109
109
|
});
|
|
110
110
|
logger_1.logger.info(message);
|
|
111
|
-
if (!(await extensionsHelper_1.confirm({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
111
|
+
if (!(await (0, extensionsHelper_1.confirm)({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
112
112
|
throw new error_1.FirebaseError("Unable to update this extension instance without explicit consent for the change to 'Resources'.");
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -123,13 +123,13 @@ async function displayUpdateChangesRequiringConfirmation(args) {
|
|
|
123
123
|
message += additionColor(`+ ${role.role} (${role.reason})\n`);
|
|
124
124
|
});
|
|
125
125
|
logger_1.logger.info(message);
|
|
126
|
-
if (!(await extensionsHelper_1.confirm({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
126
|
+
if (!(await (0, extensionsHelper_1.confirm)({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
127
127
|
throw new error_1.FirebaseError("Unable to update this extension instance without explicit consent for the change to 'Permissions'.");
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
if (!args.spec.billingRequired && args.newSpec.billingRequired) {
|
|
131
131
|
logger_1.logger.info("Billing is now required for the new version of this extension.");
|
|
132
|
-
if (!(await extensionsHelper_1.confirm({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
132
|
+
if (!(await (0, extensionsHelper_1.confirm)({ nonInteractive: args.nonInteractive, force: args.force, default: true }))) {
|
|
133
133
|
throw new error_1.FirebaseError("Unable to update this extension instance without explicit consent for the change to 'BillingRequired'.");
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -36,7 +36,7 @@ async function buildOptions(options) {
|
|
|
36
36
|
}
|
|
37
37
|
exports.buildOptions = buildOptions;
|
|
38
38
|
function getParams(options, extensionSpec) {
|
|
39
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
39
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
40
40
|
const userParams = paramHelper.readEnvFile(options.testParams);
|
|
41
41
|
const autoParams = {
|
|
42
42
|
PROJECT_ID: projectId,
|
|
@@ -54,7 +54,7 @@ function readFileFromDirectory(directory, file) {
|
|
|
54
54
|
exports.readFileFromDirectory = readFileFromDirectory;
|
|
55
55
|
function getFunctionResourcesWithParamSubstitution(extensionSpec, params) {
|
|
56
56
|
const rawResources = extensionSpec.resources.filter((resource) => validFunctionTypes.includes(resource.type));
|
|
57
|
-
return extensionsHelper_1.substituteParams(rawResources, params);
|
|
57
|
+
return (0, extensionsHelper_1.substituteParams)(rawResources, params);
|
|
58
58
|
}
|
|
59
59
|
exports.getFunctionResourcesWithParamSubstitution = getFunctionResourcesWithParamSubstitution;
|
|
60
60
|
function getFunctionProperties(resources) {
|
|
@@ -25,7 +25,7 @@ function functionResourceToEmulatedTriggerDefintion(resource) {
|
|
|
25
25
|
etd.httpsTrigger = properties.httpsTrigger;
|
|
26
26
|
}
|
|
27
27
|
else if (properties.eventTrigger) {
|
|
28
|
-
properties.eventTrigger.service = functionsEmulatorShared_1.getServiceFromEventType(properties.eventTrigger.eventType);
|
|
28
|
+
properties.eventTrigger.service = (0, functionsEmulatorShared_1.getServiceFromEventType)(properties.eventTrigger.eventType);
|
|
29
29
|
etd.eventTrigger = properties.eventTrigger;
|
|
30
30
|
}
|
|
31
31
|
else {
|
package/lib/extensions/export.js
CHANGED
|
@@ -25,13 +25,13 @@ function parameterizeProject(projectId, projectNumber, spec) {
|
|
|
25
25
|
exports.parameterizeProject = parameterizeProject;
|
|
26
26
|
async function setSecretParamsToLatest(spec) {
|
|
27
27
|
const newParams = Object.assign({}, spec.params);
|
|
28
|
-
const extensionVersion = await planner_1.getExtensionVersion(spec);
|
|
29
|
-
const activeSecrets = secretsUtils_1.getActiveSecrets(extensionVersion.spec, newParams);
|
|
28
|
+
const extensionVersion = await (0, planner_1.getExtensionVersion)(spec);
|
|
29
|
+
const activeSecrets = (0, secretsUtils_1.getActiveSecrets)(extensionVersion.spec, newParams);
|
|
30
30
|
for (const [key, val] of Object.entries(newParams)) {
|
|
31
31
|
if (activeSecrets.includes(val)) {
|
|
32
|
-
const parsed = secretManager_1.parseSecretVersionResourceName(val);
|
|
32
|
+
const parsed = (0, secretManager_1.parseSecretVersionResourceName)(val);
|
|
33
33
|
parsed.versionId = "latest";
|
|
34
|
-
newParams[key] = secretManager_1.toSecretVersionResourceName(parsed);
|
|
34
|
+
newParams[key] = (0, secretManager_1.toSecretVersionResourceName)(parsed);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return Object.assign(Object.assign({}, spec), { params: newParams });
|
|
@@ -52,7 +52,7 @@ exports.displayExportInfo = displayExportInfo;
|
|
|
52
52
|
function displaySpecs(specs) {
|
|
53
53
|
for (let i = 0; i < specs.length; i++) {
|
|
54
54
|
const spec = specs[i];
|
|
55
|
-
logger_1.logger.info(`${i + 1}. ${deploymentSummary_1.humanReadable(spec)}`);
|
|
55
|
+
logger_1.logger.info(`${i + 1}. ${(0, deploymentSummary_1.humanReadable)(spec)}`);
|
|
56
56
|
logger_1.logger.info(`Configuration will be written to 'extensions/${spec.instanceId}.env'`);
|
|
57
57
|
for (const p of Object.entries(spec.params)) {
|
|
58
58
|
logger_1.logger.info(`\t${p[0]}=${p[1]}`);
|
|
@@ -87,7 +87,7 @@ async function writeFiles(have, options) {
|
|
|
87
87
|
const currentExtensions = Object.entries(existingConfig.get("extensions"))
|
|
88
88
|
.map((i) => `${i[0]}: ${i[1]}`)
|
|
89
89
|
.join("\n\t");
|
|
90
|
-
const overwrite = await prompt_1.promptOnce({
|
|
90
|
+
const overwrite = await (0, prompt_1.promptOnce)({
|
|
91
91
|
type: "list",
|
|
92
92
|
message: `firebase.json already contains extensions:\n${currentExtensions}\nWould you like to overwrite or merge?`,
|
|
93
93
|
choices: [
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExtension = exports.deleteExtension = exports.unpublishExtension = exports.publishExtensionVersion = exports.undeprecateExtensionVersion = exports.deprecateExtensionVersion = exports.registerPublisherProfile = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = exports.ParamType = exports.Visibility = exports.RegistryLaunchStage = void 0;
|
|
3
|
+
exports.getExtension = exports.deleteExtension = exports.unpublishExtension = exports.publishExtensionVersion = exports.undeprecateExtensionVersion = exports.deprecateExtensionVersion = exports.registerPublisherProfile = exports.getPublisherProfile = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = exports.ParamType = exports.Visibility = exports.RegistryLaunchStage = void 0;
|
|
4
4
|
const yaml = require("js-yaml");
|
|
5
5
|
const _ = require("lodash");
|
|
6
6
|
const clc = require("cli-color");
|
|
7
7
|
const marked = require("marked");
|
|
8
8
|
const api = require("../api");
|
|
9
|
+
const apiv2 = require("../apiv2");
|
|
9
10
|
const refs = require("./refs");
|
|
10
11
|
const logger_1 = require("../logger");
|
|
11
12
|
const operationPoller = require("../operation-poller");
|
|
@@ -324,6 +325,18 @@ async function listExtensionVersions(ref, filter) {
|
|
|
324
325
|
return extensionVersions;
|
|
325
326
|
}
|
|
326
327
|
exports.listExtensionVersions = listExtensionVersions;
|
|
328
|
+
async function getPublisherProfile(projectId, publisherId) {
|
|
329
|
+
const client = new apiv2.Client({ urlPrefix: api.extensionsOrigin });
|
|
330
|
+
const res = await client.get(`/${VERSION}/projects/${projectId}/publisherProfile`, {
|
|
331
|
+
queryParams: publisherId == undefined
|
|
332
|
+
? undefined
|
|
333
|
+
: {
|
|
334
|
+
publisherId,
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
return res.body;
|
|
338
|
+
}
|
|
339
|
+
exports.getPublisherProfile = getPublisherProfile;
|
|
327
340
|
async function registerPublisherProfile(projectId, publisherId) {
|
|
328
341
|
const res = await api.request("POST", `/${VERSION}/projects/${projectId}/publisherProfile:register`, {
|
|
329
342
|
auth: true,
|