firebase-tools 11.0.0 → 11.2.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/accountExporter.js +11 -4
- package/lib/accountImporter.js +93 -95
- package/lib/api.js +77 -218
- package/lib/apiv2.js +5 -4
- package/lib/appdistribution/client.js +23 -34
- package/lib/auth.js +72 -52
- package/lib/bin/firebase.js +42 -47
- package/lib/checkValidTargetFilters.js +36 -25
- package/lib/commands/appdistribution-distribute.js +2 -1
- package/lib/commands/appdistribution-testers-add.js +2 -1
- package/lib/commands/appdistribution-testers-remove.js +2 -1
- package/lib/commands/apps-android-sha-create.js +2 -1
- package/lib/commands/apps-android-sha-delete.js +2 -1
- package/lib/commands/apps-android-sha-list.js +2 -1
- package/lib/commands/apps-create.js +2 -1
- package/lib/commands/apps-list.js +2 -1
- package/lib/commands/apps-sdkconfig.js +2 -1
- package/lib/commands/auth-export.js +2 -1
- package/lib/commands/auth-import.js +7 -10
- package/lib/commands/crashlytics-symbols-upload.js +2 -1
- package/lib/commands/database-get.js +4 -3
- package/lib/commands/database-instances-create.js +2 -1
- package/lib/commands/database-instances-list.js +3 -3
- package/lib/commands/database-profile.js +4 -4
- package/lib/commands/database-push.js +4 -4
- package/lib/commands/database-remove.js +3 -3
- package/lib/commands/database-rules-canary.js +2 -1
- package/lib/commands/database-rules-get.js +2 -1
- package/lib/commands/database-rules-list.js +2 -1
- package/lib/commands/database-rules-release.js +2 -1
- package/lib/commands/database-rules-stage.js +2 -1
- package/lib/commands/database-set.js +3 -3
- package/lib/commands/database-settings-get.js +2 -1
- package/lib/commands/database-settings-set.js +2 -1
- package/lib/commands/database-update.js +2 -1
- package/lib/commands/deploy.js +26 -25
- package/lib/commands/emulators-exec.js +2 -1
- package/lib/commands/emulators-export.js +2 -1
- package/lib/commands/emulators-start.js +2 -1
- package/lib/commands/experimental-functions-shell.js +10 -8
- package/lib/commands/ext-configure.js +6 -1
- package/lib/commands/ext-dev-deprecate.js +2 -1
- package/lib/commands/ext-dev-emulators-exec.js +3 -2
- package/lib/commands/ext-dev-emulators-start.js +3 -2
- package/lib/commands/ext-dev-extension-delete.js +2 -1
- package/lib/commands/ext-dev-init.js +2 -1
- package/lib/commands/ext-dev-list.js +8 -8
- package/lib/commands/ext-dev-publish.js +2 -1
- package/lib/commands/ext-dev-register.js +2 -1
- package/lib/commands/ext-dev-undeprecate.js +2 -1
- package/lib/commands/ext-dev-unpublish.js +2 -1
- package/lib/commands/ext-dev-usage.js +2 -1
- package/lib/commands/ext-export.js +2 -1
- package/lib/commands/ext-info.js +14 -14
- package/lib/commands/ext-install.js +6 -1
- package/lib/commands/ext-list.js +2 -1
- package/lib/commands/ext-sources-create.js +2 -1
- package/lib/commands/ext-uninstall.js +7 -1
- package/lib/commands/ext-update.js +6 -1
- package/lib/commands/ext.js +4 -4
- package/lib/commands/firestore-delete.js +2 -1
- package/lib/commands/firestore-indexes-list.js +2 -1
- package/lib/commands/functions-config-clone.js +4 -3
- package/lib/commands/functions-config-export.js +2 -1
- package/lib/commands/functions-config-get.js +2 -1
- package/lib/commands/functions-config-set.js +2 -1
- package/lib/commands/functions-config-unset.js +2 -1
- package/lib/commands/functions-delete.js +3 -8
- package/lib/commands/functions-deletegcfartifacts.js +2 -1
- package/lib/commands/functions-list.js +2 -1
- package/lib/commands/functions-log.js +2 -1
- package/lib/commands/functions-secrets-access.js +2 -1
- package/lib/commands/functions-secrets-destroy.js +2 -1
- package/lib/commands/functions-secrets-get.js +2 -1
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +2 -1
- package/lib/commands/functions-shell.js +12 -10
- package/lib/commands/help.js +2 -1
- package/lib/commands/hosting-channel-create.js +2 -1
- package/lib/commands/hosting-channel-delete.js +2 -1
- package/lib/commands/hosting-channel-deploy.js +2 -1
- package/lib/commands/hosting-channel-list.js +2 -1
- package/lib/commands/hosting-channel-open.js +2 -1
- package/lib/commands/hosting-clone.js +2 -1
- package/lib/commands/hosting-disable.js +2 -1
- package/lib/commands/hosting-sites-create.js +2 -1
- package/lib/commands/hosting-sites-delete.js +2 -1
- package/lib/commands/hosting-sites-get.js +2 -1
- package/lib/commands/hosting-sites-list.js +2 -1
- package/lib/commands/index.js +23 -13
- package/lib/commands/init.js +47 -43
- package/lib/commands/login-add.js +2 -1
- package/lib/commands/login-ci.js +2 -1
- package/lib/commands/login-list.js +2 -1
- package/lib/commands/login-use.js +2 -1
- package/lib/commands/login.js +2 -1
- package/lib/commands/logout.js +2 -1
- package/lib/commands/open.js +7 -7
- package/lib/commands/projects-addfirebase.js +2 -1
- package/lib/commands/projects-create.js +2 -1
- package/lib/commands/projects-list.js +2 -1
- package/lib/commands/remoteconfig-get.js +2 -1
- package/lib/commands/remoteconfig-rollback.js +2 -1
- package/lib/commands/remoteconfig-versions-list.js +2 -1
- package/lib/commands/serve.js +30 -30
- package/lib/commands/setup-emulators-database.js +2 -1
- package/lib/commands/setup-emulators-firestore.js +2 -1
- package/lib/commands/setup-emulators-pubsub.js +2 -1
- package/lib/commands/setup-emulators-storage.js +2 -1
- package/lib/commands/setup-emulators-ui.js +2 -1
- package/lib/commands/target-apply.js +2 -1
- package/lib/commands/target-clear.js +2 -1
- package/lib/commands/target-remove.js +2 -1
- package/lib/commands/target.js +2 -1
- package/lib/commands/use.js +54 -53
- package/lib/config.js +7 -6
- package/lib/deploy/database/deploy.js +3 -2
- package/lib/deploy/database/index.js +8 -5
- package/lib/deploy/database/prepare.js +22 -20
- package/lib/deploy/database/release.js +12 -9
- package/lib/deploy/extensions/secrets.js +3 -3
- package/lib/deploy/firestore/prepare.js +2 -2
- package/lib/deploy/functions/build.js +33 -20
- package/lib/deploy/functions/ensure.js +1 -11
- package/lib/deploy/functions/prepare.js +3 -13
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -3
- package/lib/deploy/functions/release/fabricator.js +0 -1
- package/lib/deploy/functions/release/index.js +1 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +18 -3
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +188 -54
- package/lib/deploy/functions/runtimes/golang/index.js +2 -22
- package/lib/deploy/functions/runtimes/node/index.js +3 -7
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +15 -3
- package/lib/deploy/functions/services/database.js +14 -0
- package/lib/deploy/functions/services/index.js +14 -0
- package/lib/deploy/index.js +3 -3
- package/lib/deploy/lifecycleHooks.js +27 -27
- package/lib/deploy/remoteconfig/functions.js +18 -14
- package/lib/deploy/remoteconfig/prepare.js +2 -2
- package/lib/deploy/storage/prepare.js +1 -1
- package/lib/emulator/auth/apiSpec.js +14 -46
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +342 -93
- package/lib/emulator/auth/server.js +2 -2
- package/lib/emulator/auth/state.js +34 -32
- package/lib/emulator/commandUtils.js +1 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/controller.js +7 -6
- package/lib/emulator/databaseEmulator.js +11 -9
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/events/types.js +2 -3
- package/lib/emulator/firestoreEmulator.js +12 -14
- package/lib/emulator/functionsEmulator.js +65 -77
- package/lib/emulator/functionsEmulatorRuntime.js +7 -7
- package/lib/emulator/hostingEmulator.js +1 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/hubClient.js +11 -22
- package/lib/emulator/hubExport.js +26 -16
- package/lib/emulator/loggingEmulator.js +1 -1
- package/lib/emulator/pubsubEmulator.js +1 -1
- package/lib/emulator/storage/crc.js +4 -4
- package/lib/emulator/storage/index.js +1 -1
- package/lib/emulator/types.js +1 -1
- package/lib/errorOut.js +2 -2
- package/lib/extensions/askUserForConsent.js +1 -2
- package/lib/extensions/askUserForParam.js +15 -18
- package/lib/extensions/emulator/optionsHelper.js +4 -4
- package/lib/extensions/extensionsApi.js +1 -22
- package/lib/extensions/extensionsHelper.js +6 -6
- package/lib/extensions/listExtensions.js +9 -10
- package/lib/extensions/manifest.js +2 -2
- package/lib/extensions/resolveSource.js +11 -7
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/types.js +24 -0
- package/lib/extensions/updateHelper.js +1 -1
- package/lib/extensions/utils.js +1 -2
- package/lib/extensions/warnings.js +3 -3
- package/lib/firestore/checkDatabaseType.js +4 -5
- package/lib/firestore/encodeFirestoreValue.js +11 -8
- package/lib/firestore/indexes.js +17 -34
- package/lib/fsAsync.js +3 -3
- package/lib/functions/events/v2.js +7 -1
- package/lib/functionsConfig.js +17 -14
- package/lib/functionsConfigClone.js +46 -46
- package/lib/gcp/cloudfunctions.js +2 -15
- package/lib/gcp/cloudfunctionsv2.js +17 -2
- package/lib/gcp/iam.js +1 -1
- package/lib/gcp/index.js +10 -10
- package/lib/gcp/rules.js +1 -1
- package/lib/gcp/runtimeconfig.js +45 -47
- package/lib/gcp/storage.js +2 -4
- package/lib/hosting/cloudRunProxy.js +19 -15
- package/lib/hosting/proxy.js +1 -1
- package/lib/index.js +29 -28
- package/lib/init/features/database.js +11 -5
- package/lib/init/features/functions/index.js +1 -1
- package/lib/init/features/functions/javascript.js +23 -20
- package/lib/init/features/functions/npm-dependencies.js +17 -14
- package/lib/init/features/functions/typescript.js +27 -24
- package/lib/init/features/hosting/github.js +6 -5
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/loadCJSON.js +9 -6
- package/lib/localFunction.js +4 -4
- package/lib/logError.js +15 -12
- package/lib/management/apps.js +47 -43
- package/lib/management/database.js +33 -31
- package/lib/management/projects.js +13 -7
- package/lib/parseBoltRules.js +15 -14
- package/lib/previews.js +1 -1
- package/lib/profileReport.js +504 -512
- package/lib/profiler.js +4 -4
- package/lib/prompt.js +1 -2
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +0 -1
- package/lib/responseToError.js +8 -5
- package/lib/rtdb.js +31 -29
- package/lib/rulesDeploy.js +2 -2
- package/lib/scopes.js +9 -9
- package/lib/serve/index.js +4 -5
- package/lib/utils.js +30 -6
- package/npm-shrinkwrap.json +877 -279
- package/package.json +19 -16
- package/standalone/package.json +1 -1
|
@@ -105,7 +105,7 @@ class Proxied {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
async function resolveDeveloperNodeModule(frb, name) {
|
|
108
|
-
const pkg = requirePackageJson(
|
|
108
|
+
const pkg = requirePackageJson();
|
|
109
109
|
if (!pkg) {
|
|
110
110
|
new types_1.EmulatorLog("SYSTEM", "missing-package-json", "").log();
|
|
111
111
|
throw new Error("Could not find package.json");
|
|
@@ -159,7 +159,7 @@ async function verifyDeveloperNodeModules(frb) {
|
|
|
159
159
|
}
|
|
160
160
|
return true;
|
|
161
161
|
}
|
|
162
|
-
function requirePackageJson(
|
|
162
|
+
function requirePackageJson() {
|
|
163
163
|
if (developerPkgJSON) {
|
|
164
164
|
return developerPkgJSON;
|
|
165
165
|
}
|
|
@@ -176,7 +176,7 @@ function requirePackageJson(frb) {
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
function initializeNetworkFiltering(
|
|
179
|
+
function initializeNetworkFiltering() {
|
|
180
180
|
const networkingModules = [
|
|
181
181
|
{ name: "http", module: require("http"), path: ["request"] },
|
|
182
182
|
{ name: "http", module: require("http"), path: ["get"] },
|
|
@@ -323,7 +323,7 @@ function wrapCallableHandler(handler) {
|
|
|
323
323
|
function getDefaultConfig() {
|
|
324
324
|
return JSON.parse(process.env.FIREBASE_CONFIG || "{}");
|
|
325
325
|
}
|
|
326
|
-
function initializeRuntimeConfig(
|
|
326
|
+
function initializeRuntimeConfig() {
|
|
327
327
|
if (!process.env.CLOUD_RUNTIME_CONFIG) {
|
|
328
328
|
const configPath = `${process.cwd()}/.runtimeconfig.json`;
|
|
329
329
|
try {
|
|
@@ -470,7 +470,7 @@ async function initializeFunctionsConfigHelper(frb) {
|
|
|
470
470
|
.finalize();
|
|
471
471
|
const functionsModuleProxy = new Proxied(localFunctionsModule);
|
|
472
472
|
const proxiedFunctionsModule = functionsModuleProxy
|
|
473
|
-
.when("config", (
|
|
473
|
+
.when("config", () => () => {
|
|
474
474
|
return proxiedConfig;
|
|
475
475
|
})
|
|
476
476
|
.finalize();
|
|
@@ -669,8 +669,8 @@ async function initializeRuntime(frb) {
|
|
|
669
669
|
new types_1.EmulatorLog("INFO", "runtime-status", `Your functions could not be parsed due to an issue with your node_modules (see above)`).log();
|
|
670
670
|
return;
|
|
671
671
|
}
|
|
672
|
-
initializeRuntimeConfig(
|
|
673
|
-
initializeNetworkFiltering(
|
|
672
|
+
initializeRuntimeConfig();
|
|
673
|
+
initializeNetworkFiltering();
|
|
674
674
|
await initializeFunctionsConfigHelper(frb);
|
|
675
675
|
await initializeFirebaseFunctionsStubs(frb);
|
|
676
676
|
await initializeFirebaseAdminStubs(frb);
|
|
@@ -20,7 +20,7 @@ class HostingEmulator {
|
|
|
20
20
|
return serveHosting.stop();
|
|
21
21
|
}
|
|
22
22
|
getInfo() {
|
|
23
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
23
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
24
24
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.HOSTING);
|
|
25
25
|
return {
|
|
26
26
|
name: this.getName(),
|
package/lib/emulator/hub.js
CHANGED
|
@@ -105,7 +105,7 @@ class EmulatorHub {
|
|
|
105
105
|
await this.deleteLocatorFile();
|
|
106
106
|
}
|
|
107
107
|
getInfo() {
|
|
108
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
108
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
109
109
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.HUB);
|
|
110
110
|
return {
|
|
111
111
|
name: this.getName(),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmulatorHubClient = void 0;
|
|
4
|
-
const api = require("../api");
|
|
5
4
|
const hub_1 = require("./hub");
|
|
6
5
|
const error_1 = require("../error");
|
|
6
|
+
const apiv2_1 = require("../apiv2");
|
|
7
7
|
class EmulatorHubClient {
|
|
8
8
|
constructor(projectId) {
|
|
9
9
|
this.projectId = projectId;
|
|
@@ -12,29 +12,18 @@ class EmulatorHubClient {
|
|
|
12
12
|
foundHub() {
|
|
13
13
|
return this.locator !== undefined;
|
|
14
14
|
}
|
|
15
|
-
getStatus() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
15
|
+
async getStatus() {
|
|
16
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: this.origin, auth: false });
|
|
17
|
+
await apiClient.get("/");
|
|
19
18
|
}
|
|
20
|
-
getEmulators() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
json: true,
|
|
25
|
-
})
|
|
26
|
-
.then((res) => {
|
|
27
|
-
return res.body;
|
|
28
|
-
});
|
|
19
|
+
async getEmulators() {
|
|
20
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: this.origin, auth: false });
|
|
21
|
+
const res = await apiClient.get(hub_1.EmulatorHub.PATH_EMULATORS);
|
|
22
|
+
return res.body;
|
|
29
23
|
}
|
|
30
|
-
postExport(path) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
json: true,
|
|
34
|
-
data: {
|
|
35
|
-
path,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
24
|
+
async postExport(path) {
|
|
25
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: this.origin, auth: false });
|
|
26
|
+
await apiClient.post(hub_1.EmulatorHub.PATH_EXPORT, { path });
|
|
38
27
|
}
|
|
39
28
|
get origin() {
|
|
40
29
|
const locator = this.assertLocator();
|
|
@@ -5,7 +5,6 @@ const path = require("path");
|
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const fse = require("fs-extra");
|
|
7
7
|
const http = require("http");
|
|
8
|
-
const api = require("../api");
|
|
9
8
|
const logger_1 = require("../logger");
|
|
10
9
|
const types_1 = require("./types");
|
|
11
10
|
const registry_1 = require("./registry");
|
|
@@ -13,6 +12,7 @@ const error_1 = require("../error");
|
|
|
13
12
|
const hub_1 = require("./hub");
|
|
14
13
|
const downloadableEmulators_1 = require("./downloadableEmulators");
|
|
15
14
|
const rimraf = require("rimraf");
|
|
15
|
+
const apiv2_1 = require("../apiv2");
|
|
16
16
|
class HubExport {
|
|
17
17
|
constructor(projectId, exportPath) {
|
|
18
18
|
this.projectId = projectId;
|
|
@@ -80,24 +80,27 @@ class HubExport {
|
|
|
80
80
|
export_directory: this.tmpDir,
|
|
81
81
|
export_name: metadata.firestore.path,
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
json: true,
|
|
86
|
-
data: firestoreExportBody,
|
|
87
|
-
});
|
|
83
|
+
const client = new apiv2_1.Client({ urlPrefix: firestoreHost, auth: false });
|
|
84
|
+
await client.post(`/emulator/v1/projects/${this.projectId}:export`, firestoreExportBody);
|
|
88
85
|
}
|
|
89
86
|
async exportDatabase(metadata) {
|
|
90
87
|
const databaseEmulator = registry_1.EmulatorRegistry.get(types_1.Emulators.DATABASE);
|
|
91
88
|
const databaseAddr = `http://${registry_1.EmulatorRegistry.getInfoHostString(databaseEmulator.getInfo())}`;
|
|
92
|
-
const
|
|
93
|
-
const
|
|
89
|
+
const client = new apiv2_1.Client({ urlPrefix: databaseAddr, auth: true });
|
|
90
|
+
const inspectURL = `/.inspect/databases.json`;
|
|
91
|
+
const inspectRes = await client.get(inspectURL, {
|
|
92
|
+
queryParams: { ns: this.projectId },
|
|
93
|
+
});
|
|
94
94
|
const namespaces = inspectRes.body.map((instance) => instance.name);
|
|
95
95
|
const namespacesToExport = [];
|
|
96
96
|
for (const ns of namespaces) {
|
|
97
|
-
const checkDataPath = `/.json
|
|
98
|
-
const checkDataRes = await
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const checkDataPath = `/.json`;
|
|
98
|
+
const checkDataRes = await client.get(checkDataPath, {
|
|
99
|
+
queryParams: {
|
|
100
|
+
ns,
|
|
101
|
+
shallow: "true",
|
|
102
|
+
limitToFirst: 1,
|
|
103
|
+
},
|
|
101
104
|
});
|
|
102
105
|
if (checkDataRes.body !== null) {
|
|
103
106
|
namespacesToExport.push(ns);
|
|
@@ -162,11 +165,18 @@ class HubExport {
|
|
|
162
165
|
const storageExportBody = {
|
|
163
166
|
path: storageExportPath,
|
|
164
167
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
const client = new apiv2_1.Client({ urlPrefix: storageHost, auth: false });
|
|
169
|
+
const res = await client.request({
|
|
170
|
+
method: "POST",
|
|
171
|
+
path: "/internal/export",
|
|
172
|
+
headers: { "Content-Type": "application/json" },
|
|
173
|
+
body: storageExportBody,
|
|
174
|
+
responseType: "stream",
|
|
175
|
+
resolveOnHTTPError: true,
|
|
169
176
|
});
|
|
177
|
+
if (res.status >= 400) {
|
|
178
|
+
throw new error_1.FirebaseError(`Failed to export storage: ${await res.response.text()}`);
|
|
179
|
+
}
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
exports.HubExport = HubExport;
|
|
@@ -28,7 +28,7 @@ class LoggingEmulator {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
getInfo() {
|
|
31
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
31
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
32
32
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.LOGGING);
|
|
33
33
|
return {
|
|
34
34
|
name: this.getName(),
|
|
@@ -32,7 +32,7 @@ class PubsubEmulator {
|
|
|
32
32
|
await downloadableEmulators.stop(types_1.Emulators.PUBSUB);
|
|
33
33
|
}
|
|
34
34
|
getInfo() {
|
|
35
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
35
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
36
36
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.PUBSUB);
|
|
37
37
|
return {
|
|
38
38
|
name: this.getName(),
|
|
@@ -25,9 +25,9 @@ function crc32c(bytes) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.crc32c = crc32c;
|
|
27
27
|
function crc32cToString(crc32cValue) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
28
|
+
const value = typeof crc32cValue === "string" ? Number.parseInt(crc32cValue) : crc32cValue;
|
|
29
|
+
const buffer = Buffer.alloc(4);
|
|
30
|
+
buffer.writeUint32BE(value);
|
|
31
|
+
return buffer.toString("base64");
|
|
32
32
|
}
|
|
33
33
|
exports.crc32cToString = crc32cToString;
|
|
@@ -68,7 +68,7 @@ class StorageEmulator {
|
|
|
68
68
|
return this.destroyServer ? this.destroyServer() : Promise.resolve();
|
|
69
69
|
}
|
|
70
70
|
getInfo() {
|
|
71
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
71
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
72
72
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.STORAGE);
|
|
73
73
|
return {
|
|
74
74
|
name: this.getName(),
|
package/lib/emulator/types.js
CHANGED
|
@@ -104,7 +104,7 @@ class EmulatorLog {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
static waitForLog(emitter, level, type, filter) {
|
|
107
|
-
return new Promise((resolve
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
108
|
const listener = (el) => {
|
|
109
109
|
const levelTypeMatch = el.level === level && el.type === type;
|
|
110
110
|
let filterMatch = true;
|
package/lib/errorOut.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.errorOut = void 0;
|
|
4
|
-
const
|
|
4
|
+
const logError_1 = require("./logError");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
6
|
function errorOut(error) {
|
|
7
7
|
let fbError;
|
|
@@ -14,7 +14,7 @@ function errorOut(error) {
|
|
|
14
14
|
exit: 2,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
logError(fbError);
|
|
17
|
+
(0, logError_1.logError)(fbError);
|
|
18
18
|
process.exitCode = fbError.exit || 2;
|
|
19
19
|
setTimeout(() => {
|
|
20
20
|
process.exit();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.promptForPublisherTOS = exports.displayApis = exports.displayRoles = exports.retrieveRoleInfo = exports.formatDescription = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const clc = require("cli-color");
|
|
6
5
|
const { marked } = require("marked");
|
|
7
6
|
const TerminalRenderer = require("marked-terminal");
|
|
@@ -19,7 +18,7 @@ async function formatDescription(extensionName, projectId, roles) {
|
|
|
19
18
|
return retrieveRoleInfo(role);
|
|
20
19
|
}));
|
|
21
20
|
results.unshift(question);
|
|
22
|
-
return
|
|
21
|
+
return results.join("\n");
|
|
23
22
|
}
|
|
24
23
|
exports.formatDescription = formatDescription;
|
|
25
24
|
async function retrieveRoleInfo(role) {
|
|
@@ -4,7 +4,7 @@ exports.getInquirerDefault = exports.promptCreateSecret = exports.askForParam =
|
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
6
|
const { marked } = require("marked");
|
|
7
|
-
const
|
|
7
|
+
const types_1 = require("./types");
|
|
8
8
|
const secretManagerApi = require("../gcp/secretManager");
|
|
9
9
|
const secretsUtils = require("./secretsUtils");
|
|
10
10
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
@@ -24,13 +24,14 @@ var SecretUpdateAction;
|
|
|
24
24
|
SecretUpdateAction[SecretUpdateAction["SET_NEW"] = 2] = "SET_NEW";
|
|
25
25
|
})(SecretUpdateAction || (SecretUpdateAction = {}));
|
|
26
26
|
function checkResponse(response, spec) {
|
|
27
|
+
var _a;
|
|
27
28
|
let valid = true;
|
|
28
29
|
let responses;
|
|
29
30
|
if (spec.required && (response === "" || response === undefined)) {
|
|
30
31
|
utils.logWarning(`Param ${spec.param} is required, but no value was provided.`);
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
33
|
-
if (spec.type ===
|
|
34
|
+
if (spec.type === types_1.ParamType.MULTISELECT) {
|
|
34
35
|
responses = response.split(",");
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
@@ -38,25 +39,23 @@ function checkResponse(response, spec) {
|
|
|
38
39
|
}
|
|
39
40
|
if (spec.validationRegex && !!response) {
|
|
40
41
|
const re = new RegExp(spec.validationRegex);
|
|
41
|
-
|
|
42
|
+
for (const resp of responses) {
|
|
42
43
|
if ((spec.required || resp !== "") && !re.test(resp)) {
|
|
43
44
|
const genericWarn = `${resp} is not a valid value for ${spec.param} since it` +
|
|
44
45
|
` does not meet the requirements of the regex validation: "${spec.validationRegex}"`;
|
|
45
46
|
utils.logWarning(spec.validationErrorMessage || genericWarn);
|
|
46
47
|
valid = false;
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
|
-
if (spec.type && (spec.type ===
|
|
51
|
-
|
|
52
|
-
const validChoice =
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
if (!validChoice) {
|
|
51
|
+
if (spec.type && (spec.type === types_1.ParamType.MULTISELECT || spec.type === types_1.ParamType.SELECT)) {
|
|
52
|
+
for (const r of responses) {
|
|
53
|
+
const validChoice = (_a = spec.options) === null || _a === void 0 ? void 0 : _a.some((option) => r === option.value);
|
|
54
|
+
if (r && !validChoice) {
|
|
56
55
|
utils.logWarning(`${r} is not a valid option for ${spec.param}.`);
|
|
57
56
|
valid = false;
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
}
|
|
60
59
|
}
|
|
61
60
|
return valid;
|
|
62
61
|
}
|
|
@@ -69,7 +68,7 @@ async function ask(args) {
|
|
|
69
68
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, "answer the questions below to configure your extension:");
|
|
70
69
|
const substituted = (0, extensionsHelper_1.substituteParams)(args.paramSpecs, args.firebaseProjectParams);
|
|
71
70
|
const result = {};
|
|
72
|
-
const promises =
|
|
71
|
+
const promises = substituted.map((paramSpec) => {
|
|
73
72
|
return async () => {
|
|
74
73
|
result[paramSpec.param] = await askForParam({
|
|
75
74
|
projectId: args.projectId,
|
|
@@ -95,7 +94,7 @@ async function askForParam(args) {
|
|
|
95
94
|
logger_1.logger.info(`\n${clc.bold(label)}${clc.bold(paramSpec.required ? "" : " (Optional)")}: ${marked(description).trim()}`);
|
|
96
95
|
while (!valid) {
|
|
97
96
|
switch (paramSpec.type) {
|
|
98
|
-
case
|
|
97
|
+
case types_1.ParamType.SELECT:
|
|
99
98
|
response = await (0, prompt_1.promptOnce)({
|
|
100
99
|
name: "input",
|
|
101
100
|
type: "list",
|
|
@@ -111,7 +110,7 @@ async function askForParam(args) {
|
|
|
111
110
|
});
|
|
112
111
|
valid = checkResponse(response, paramSpec);
|
|
113
112
|
break;
|
|
114
|
-
case
|
|
113
|
+
case types_1.ParamType.MULTISELECT:
|
|
115
114
|
response = await (0, utils_1.onceWithJoin)({
|
|
116
115
|
name: "input",
|
|
117
116
|
type: "checkbox",
|
|
@@ -129,7 +128,7 @@ async function askForParam(args) {
|
|
|
129
128
|
});
|
|
130
129
|
valid = checkResponse(response, paramSpec);
|
|
131
130
|
break;
|
|
132
|
-
case
|
|
131
|
+
case types_1.ParamType.SECRET:
|
|
133
132
|
do {
|
|
134
133
|
secretLocations = await promptSecretLocations(paramSpec);
|
|
135
134
|
} while (!isValidSecretLocations(secretLocations, paramSpec));
|
|
@@ -302,9 +301,7 @@ async function addNewSecretVersion(projectId, instanceId, secret, paramSpec, sec
|
|
|
302
301
|
return `projects/${version.secret.projectId}/secrets/${version.secret.name}/versions/${version.versionId}`;
|
|
303
302
|
}
|
|
304
303
|
function getInquirerDefault(options, def) {
|
|
305
|
-
const defaultOption =
|
|
306
|
-
return option.value === def;
|
|
307
|
-
});
|
|
304
|
+
const defaultOption = options.find((o) => o.value === def);
|
|
308
305
|
return defaultOption ? defaultOption.label || defaultOption.value : "";
|
|
309
306
|
}
|
|
310
307
|
exports.getInquirerDefault = getInquirerDefault;
|
|
@@ -7,14 +7,14 @@ const paramHelper = require("../paramHelper");
|
|
|
7
7
|
const specHelper = require("./specHelper");
|
|
8
8
|
const localHelper = require("../localHelper");
|
|
9
9
|
const triggerHelper = require("./triggerHelper");
|
|
10
|
-
const
|
|
10
|
+
const types_1 = require("../types");
|
|
11
11
|
const extensionsHelper = require("../extensionsHelper");
|
|
12
12
|
const planner = require("../../deploy/extensions/planner");
|
|
13
13
|
const config_1 = require("../../config");
|
|
14
14
|
const error_1 = require("../../error");
|
|
15
15
|
const emulatorLogger_1 = require("../../emulator/emulatorLogger");
|
|
16
16
|
const projectUtils_1 = require("../../projectUtils");
|
|
17
|
-
const
|
|
17
|
+
const types_2 = require("../../emulator/types");
|
|
18
18
|
async function buildOptions(options) {
|
|
19
19
|
const extDevDir = localHelper.findExtensionYaml(process.cwd());
|
|
20
20
|
options.extDevDir = extDevDir;
|
|
@@ -56,7 +56,7 @@ async function getExtensionFunctionInfo(instance, paramValues) {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
|
|
59
|
-
const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type ===
|
|
59
|
+
const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type === types_1.ParamType.SECRET;
|
|
60
60
|
function getNonSecretEnv(params, paramValues) {
|
|
61
61
|
const getNonSecretEnv = Object.assign({}, paramValues);
|
|
62
62
|
const secretParams = params.filter(isSecretParam);
|
|
@@ -99,7 +99,7 @@ function getParams(options, extensionSpec) {
|
|
|
99
99
|
}
|
|
100
100
|
exports.getParams = getParams;
|
|
101
101
|
function checkTestConfig(testConfig, functionResources) {
|
|
102
|
-
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(
|
|
102
|
+
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.FUNCTIONS);
|
|
103
103
|
if (!testConfig.functions && functionResources.length) {
|
|
104
104
|
logger.log("WARN", "This extension uses functions," +
|
|
105
105
|
"but 'firebase.json' provided by --test-config is missing a top-level 'functions' object." +
|
|
@@ -1,6 +1,6 @@
|
|
|
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.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 =
|
|
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 = void 0;
|
|
4
4
|
const yaml = require("js-yaml");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
6
|
const { marked } = require("marked");
|
|
@@ -13,27 +13,6 @@ const refs = require("./refs");
|
|
|
13
13
|
const VERSION = "v1beta";
|
|
14
14
|
const PAGE_SIZE_MAX = 100;
|
|
15
15
|
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.extensionsOrigin, apiVersion: VERSION });
|
|
16
|
-
var RegistryLaunchStage;
|
|
17
|
-
(function (RegistryLaunchStage) {
|
|
18
|
-
RegistryLaunchStage["EXPERIMENTAL"] = "EXPERIMENTAL";
|
|
19
|
-
RegistryLaunchStage["BETA"] = "BETA";
|
|
20
|
-
RegistryLaunchStage["GA"] = "GA";
|
|
21
|
-
RegistryLaunchStage["DEPRECATED"] = "DEPRECATED";
|
|
22
|
-
RegistryLaunchStage["REGISTRY_LAUNCH_STAGE_UNSPECIFIED"] = "REGISTRY_LAUNCH_STAGE_UNSPECIFIED";
|
|
23
|
-
})(RegistryLaunchStage = exports.RegistryLaunchStage || (exports.RegistryLaunchStage = {}));
|
|
24
|
-
var Visibility;
|
|
25
|
-
(function (Visibility) {
|
|
26
|
-
Visibility["UNLISTED"] = "unlisted";
|
|
27
|
-
Visibility["PUBLIC"] = "public";
|
|
28
|
-
})(Visibility = exports.Visibility || (exports.Visibility = {}));
|
|
29
|
-
exports.FUNCTIONS_RESOURCE_TYPE = "firebaseextensions.v1beta.function";
|
|
30
|
-
var ParamType;
|
|
31
|
-
(function (ParamType) {
|
|
32
|
-
ParamType["STRING"] = "STRING";
|
|
33
|
-
ParamType["SELECT"] = "SELECT";
|
|
34
|
-
ParamType["MULTISELECT"] = "MULTISELECT";
|
|
35
|
-
ParamType["SECRET"] = "SECRET";
|
|
36
|
-
})(ParamType = exports.ParamType || (exports.ParamType = {}));
|
|
37
16
|
async function createInstanceHelper(projectId, instanceId, config, validateOnly = false) {
|
|
38
17
|
const createRes = await apiClient.post(`/projects/${projectId}/instances/`, {
|
|
39
18
|
name: `projects/${projectId}/instances/${instanceId}`,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.canonicalizeRefInput = exports.diagnoseAndFixProject = exports.confirm = exports.getSourceOrigin = exports.isLocalOrURLPath = exports.isLocalPath = exports.isUrlPath = exports.instanceIdExists = exports.promptForRepeatInstance = exports.promptForOfficialExtension = exports.displayReleaseNotes = exports.getPublisherProjectFromName = 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
|
-
const _ = require("lodash");
|
|
5
4
|
const clc = require("cli-color");
|
|
6
5
|
const ora = require("ora");
|
|
7
6
|
const semver = require("semver");
|
|
@@ -116,9 +115,10 @@ function substituteParams(original, params) {
|
|
|
116
115
|
const substituteRegexMatches = (unsubstituted, regex) => {
|
|
117
116
|
return unsubstituted.replace(regex, paramVal);
|
|
118
117
|
};
|
|
119
|
-
return
|
|
118
|
+
return regexes.reduce(substituteRegexMatches, str);
|
|
120
119
|
};
|
|
121
|
-
|
|
120
|
+
const s = Object.entries(params).reduce((str, [key, val]) => applySubstitution(str, val, key), startingString);
|
|
121
|
+
return JSON.parse(s);
|
|
122
122
|
}
|
|
123
123
|
exports.substituteParams = substituteParams;
|
|
124
124
|
function populateDefaultParams(paramVars, paramSpecs) {
|
|
@@ -207,8 +207,8 @@ function validateSpec(spec) {
|
|
|
207
207
|
if (!param.label) {
|
|
208
208
|
errors.push(`Param${param.param ? ` ${param.param}` : ""} is missing required field: label`);
|
|
209
209
|
}
|
|
210
|
-
if (param.type && !
|
|
211
|
-
errors.push(`Invalid type ${param.type} for param${param.param ? ` ${param.param}` : ""}. Valid types are ${
|
|
210
|
+
if (param.type && !Object.values(SpecParamType).includes(param.type)) {
|
|
211
|
+
errors.push(`Invalid type ${param.type} for param${param.param ? ` ${param.param}` : ""}. Valid types are ${Object.values(SpecParamType).join(", ")}`);
|
|
212
212
|
}
|
|
213
213
|
if (!param.type || param.type === SpecParamType.STRING) {
|
|
214
214
|
if (param.options) {
|
|
@@ -422,7 +422,7 @@ async function promptForOfficialExtension(message) {
|
|
|
422
422
|
type: "list",
|
|
423
423
|
message,
|
|
424
424
|
choices: (0, utils_1.convertOfficialExtensionsToList)(officialExts),
|
|
425
|
-
pageSize:
|
|
425
|
+
pageSize: Object.keys(officialExts).length,
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
exports.promptForOfficialExtension = promptForOfficialExtension;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listExtensions = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const clc = require("cli-color");
|
|
6
5
|
const Table = require("cli-table");
|
|
7
6
|
const extensionsApi_1 = require("./extensionsApi");
|
|
7
|
+
const logger_1 = require("../logger");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
8
9
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
9
|
-
const utils = require("../utils");
|
|
10
10
|
const extensionsUtils = require("./utils");
|
|
11
|
-
const logger_1 = require("../logger");
|
|
12
11
|
async function listExtensions(projectId) {
|
|
13
12
|
const instances = await (0, extensionsApi_1.listInstances)(projectId);
|
|
14
13
|
if (instances.length < 1) {
|
|
15
|
-
|
|
14
|
+
(0, utils_1.logLabeledBullet)(extensionsHelper_1.logPrefix, `there are no extensions installed on project ${clc.bold(projectId)}.`);
|
|
16
15
|
return [];
|
|
17
16
|
}
|
|
18
17
|
const table = new Table({
|
|
19
18
|
head: ["Extension", "Publisher", "Instance ID", "State", "Version", "Your last update"],
|
|
20
19
|
style: { head: ["yellow"] },
|
|
21
20
|
});
|
|
22
|
-
const sorted =
|
|
21
|
+
const sorted = instances.sort((a, b) => new Date(b.createTime).valueOf() - new Date(a.createTime).valueOf());
|
|
23
22
|
const formatted = [];
|
|
24
23
|
sorted.forEach((instance) => {
|
|
25
24
|
var _a, _b, _c, _d;
|
|
26
|
-
let extension =
|
|
25
|
+
let extension = instance.config.extensionRef || "";
|
|
27
26
|
let publisher;
|
|
28
27
|
if (extension === "") {
|
|
29
|
-
extension =
|
|
28
|
+
extension = instance.config.source.spec.name || "";
|
|
30
29
|
publisher = "N/A";
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
33
32
|
publisher = extension.split("/")[0];
|
|
34
33
|
}
|
|
35
|
-
const instanceId = (_a =
|
|
34
|
+
const instanceId = (_a = (0, utils_1.last)(instance.name.split("/"))) !== null && _a !== void 0 ? _a : "";
|
|
36
35
|
const state = instance.state +
|
|
37
|
-
(
|
|
36
|
+
((instance.config.source.state || "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
|
|
38
37
|
const version = (_d = (_c = (_b = instance === null || instance === void 0 ? void 0 : instance.config) === null || _b === void 0 ? void 0 : _b.source) === null || _c === void 0 ? void 0 : _c.spec) === null || _d === void 0 ? void 0 : _d.version;
|
|
39
38
|
const updateTime = extensionsUtils.formatTimestamp(instance.updateTime);
|
|
40
39
|
table.push([extension, publisher, instanceId, state, version, updateTime]);
|
|
@@ -47,7 +46,7 @@ async function listExtensions(projectId) {
|
|
|
47
46
|
updateTime,
|
|
48
47
|
});
|
|
49
48
|
});
|
|
50
|
-
|
|
49
|
+
(0, utils_1.logLabeledBullet)(extensionsHelper_1.logPrefix, `list of extensions installed in ${clc.bold(projectId)}:`);
|
|
51
50
|
logger_1.logger.info(table.toString());
|
|
52
51
|
return formatted;
|
|
53
52
|
}
|
|
@@ -12,7 +12,7 @@ const paramHelper_1 = require("./paramHelper");
|
|
|
12
12
|
const error_1 = require("../error");
|
|
13
13
|
const utils = require("../utils");
|
|
14
14
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
15
|
-
const
|
|
15
|
+
const types_1 = require("./types");
|
|
16
16
|
exports.ENV_DIRECTORY = "extensions";
|
|
17
17
|
async function writeToManifest(specs, config, options, allowOverwrite = false) {
|
|
18
18
|
if (config.has("extensions") &&
|
|
@@ -48,7 +48,7 @@ async function writeLocalSecrets(specs, config, force) {
|
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
50
|
const writeBuffer = {};
|
|
51
|
-
const locallyOverridenSecretParams = extensionSpec.params.filter((p) => { var _a; return p.type ===
|
|
51
|
+
const locallyOverridenSecretParams = extensionSpec.params.filter((p) => { var _a; return p.type === types_1.ParamType.SECRET && ((_a = spec.params[p.param]) === null || _a === void 0 ? void 0 : _a.local); });
|
|
52
52
|
for (const paramSpec of locallyOverridenSecretParams) {
|
|
53
53
|
const key = paramSpec.param;
|
|
54
54
|
const localValue = spec.params[key].local;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTrustedPublishers = exports.getExtensionRegistry = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const logger_1 = require("../logger");
|
|
6
5
|
const apiv2_1 = require("../apiv2");
|
|
7
6
|
const api_1 = require("../api");
|
|
8
7
|
const EXTENSIONS_REGISTRY_ENDPOINT = "/extensions.json";
|
|
9
|
-
async function getExtensionRegistry(onlyFeatured) {
|
|
8
|
+
async function getExtensionRegistry(onlyFeatured = false) {
|
|
9
|
+
var _a;
|
|
10
10
|
const client = new apiv2_1.Client({ urlPrefix: api_1.firebaseExtensionsRegistryOrigin });
|
|
11
11
|
const res = await client.get(EXTENSIONS_REGISTRY_ENDPOINT);
|
|
12
|
-
const extensions =
|
|
12
|
+
const extensions = res.body.mods || {};
|
|
13
13
|
if (onlyFeatured) {
|
|
14
|
-
const featuredList =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const featuredList = new Set(((_a = res.body.featured) === null || _a === void 0 ? void 0 : _a.discover) || []);
|
|
15
|
+
const filteredExtensions = {};
|
|
16
|
+
for (const [name, extension] of Object.entries(extensions)) {
|
|
17
|
+
if (featuredList.has(name)) {
|
|
18
|
+
filteredExtensions[name] = extension;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return filteredExtensions;
|
|
18
22
|
}
|
|
19
23
|
return extensions;
|
|
20
24
|
}
|