firebase-tools-with-isolate 13.3.1 → 13.6.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 +1 -1
- package/lib/accountImporter.js +1 -1
- package/lib/api.js +112 -55
- package/lib/apiv2.js +10 -3
- package/lib/appdistribution/client.js +4 -4
- package/lib/auth.js +17 -17
- package/lib/commands/apphosting-backends-delete.js +3 -38
- package/lib/commands/apphosting-backends-get.js +2 -32
- package/lib/commands/apphosting-backends-list.js +12 -5
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/database/metadata.js +3 -3
- package/lib/defaultCredentials.js +2 -2
- package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
- package/lib/deploy/functions/backend.js +5 -1
- package/lib/deploy/functions/build.js +10 -7
- package/lib/deploy/functions/containerCleaner.js +4 -4
- package/lib/deploy/functions/deploy.js +8 -2
- package/lib/deploy/functions/ensure.js +2 -2
- package/lib/deploy/functions/prepare.js +6 -9
- package/lib/deploy/functions/release/fabricator.js +9 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +2 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -2
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/index.js +1 -1
- package/lib/deploy/remoteconfig/functions.js +1 -1
- package/lib/emulator/adminSdkConfig.js +1 -1
- package/lib/emulator/commandUtils.js +7 -4
- package/lib/emulator/controller.js +3 -4
- package/lib/emulator/downloadableEmulators.js +10 -10
- package/lib/emulator/functionsEmulator.js +21 -1
- package/lib/ensureApiEnabled.js +9 -7
- package/lib/extensions/extensionsApi.js +5 -5
- package/lib/extensions/extensionsHelper.js +4 -4
- package/lib/extensions/provisioningHelper.js +2 -2
- package/lib/extensions/publishHelpers.js +1 -1
- package/lib/extensions/publisherApi.js +3 -3
- package/lib/extensions/resolveSource.js +1 -1
- package/lib/extensions/secretsUtils.js +2 -1
- package/lib/extensions/tos.js +1 -1
- package/lib/fetchMOTD.js +1 -1
- package/lib/fetchWebSetup.js +4 -3
- package/lib/firestore/api-sort.js +17 -0
- package/lib/firestore/api.js +9 -2
- package/lib/firestore/checkDatabaseType.js +1 -1
- package/lib/firestore/delete.js +1 -1
- package/lib/firestore/pretty-print.js +11 -2
- package/lib/frameworks/index.js +6 -2
- package/lib/frameworks/next/constants.js +38 -1
- package/lib/frameworks/next/index.js +25 -3
- package/lib/frameworks/next/utils.js +20 -1
- package/lib/functions/secrets.js +3 -3
- package/lib/functionsConfig.js +1 -1
- package/lib/gcp/apphosting.js +22 -17
- package/lib/gcp/artifactregistry.js +1 -1
- package/lib/gcp/auth.js +6 -3
- package/lib/gcp/cloudbilling.js +1 -1
- package/lib/gcp/cloudbuild.js +1 -1
- package/lib/gcp/cloudfunctions.js +1 -1
- package/lib/gcp/cloudfunctionsv2.js +4 -1
- package/lib/gcp/cloudlogging.js +1 -1
- package/lib/gcp/cloudmonitoring.js +1 -1
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudtasks.js +1 -1
- package/lib/gcp/devConnect.js +84 -0
- package/lib/gcp/eventarc.js +1 -1
- package/lib/gcp/firestore.js +2 -2
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/identityPlatform.js +1 -1
- package/lib/gcp/pubsub.js +1 -1
- package/lib/gcp/resourceManager.js +2 -1
- package/lib/gcp/rules.js +1 -1
- package/lib/gcp/run.js +1 -1
- package/lib/gcp/runtimeconfig.js +1 -1
- package/lib/gcp/secretManager.js +1 -1
- package/lib/gcp/serviceusage.js +1 -1
- package/lib/gcp/storage.js +12 -8
- package/lib/hosting/api.js +14 -3
- package/lib/hosting/cloudRunProxy.js +1 -1
- package/lib/init/features/apphosting/index.js +5 -5
- package/lib/init/features/apphosting/repo.js +84 -99
- package/lib/init/features/database.js +2 -1
- package/lib/init/features/extensions/index.js +2 -1
- package/lib/init/features/functions/index.js +3 -2
- package/lib/init/features/hosting/github.js +4 -3
- package/lib/management/apps.js +4 -4
- package/lib/management/database.js +1 -1
- package/lib/management/projects.js +4 -4
- package/lib/remoteconfig/get.js +1 -1
- package/lib/remoteconfig/rollback.js +1 -1
- package/lib/remoteconfig/versionslist.js +1 -1
- package/lib/serve/functions.js +2 -0
- package/lib/shortenUrl.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +5 -5
|
@@ -8,6 +8,7 @@ const error_1 = require("../../error");
|
|
|
8
8
|
const ensureApiEnabled_1 = require("../../ensureApiEnabled");
|
|
9
9
|
const planner = require("./planner");
|
|
10
10
|
const projectUtils_1 = require("../../projectUtils");
|
|
11
|
+
const api_1 = require("../../api");
|
|
11
12
|
const SERVICE_AGENT_ROLE = "roles/eventarc.eventReceiver";
|
|
12
13
|
async function checkSpecForV2Functions(i) {
|
|
13
14
|
const extensionSpec = await planner.getExtensionSpec(i);
|
|
@@ -16,7 +17,7 @@ async function checkSpecForV2Functions(i) {
|
|
|
16
17
|
exports.checkSpecForV2Functions = checkSpecForV2Functions;
|
|
17
18
|
async function ensureNecessaryV2ApisAndRoles(options) {
|
|
18
19
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
19
|
-
await (0, ensureApiEnabled_1.ensure)(projectId,
|
|
20
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.computeOrigin)(), "extensions", options.markdown);
|
|
20
21
|
await ensureComputeP4SARole(projectId);
|
|
21
22
|
}
|
|
22
23
|
exports.ensureNecessaryV2ApisAndRoles = ensureNecessaryV2ApisAndRoles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.findEndpoint = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.merge = exports.of = exports.empty = exports.isBlockingTriggered = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isCallableTriggered = exports.isHttpsTriggered = exports.AllFunctionsPlatforms = exports.secretVersionName = exports.SCHEDULED_FUNCTION_LABEL = exports.MIN_CPU_FOR_CONCURRENCY = exports.DEFAULT_MEMORY = exports.DEFAULT_CONCURRENCY = exports.memoryToGen2Cpu = exports.memoryToGen1Cpu = exports.memoryOptionDisplayName = exports.isValidMemoryOption = exports.AllIngressSettings = exports.AllVpcEgressSettings = exports.endpointTriggerType = void 0;
|
|
3
|
+
exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.findEndpoint = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.merge = exports.of = exports.empty = exports.isBlockingTriggered = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isCallableTriggered = exports.isHttpsTriggered = exports.AllFunctionsPlatforms = exports.secretVersionName = exports.SCHEDULED_FUNCTION_LABEL = exports.MIN_CPU_FOR_CONCURRENCY = exports.DEFAULT_MEMORY = exports.DEFAULT_CONCURRENCY = exports.memoryToGen2Cpu = exports.memoryToGen1Cpu = exports.memoryOptionDisplayName = exports.isValidEgressSetting = exports.isValidMemoryOption = exports.AllIngressSettings = exports.AllVpcEgressSettings = exports.endpointTriggerType = void 0;
|
|
4
4
|
const gcf = require("../../gcp/cloudfunctions");
|
|
5
5
|
const gcfV2 = require("../../gcp/cloudfunctionsv2");
|
|
6
6
|
const utils = require("../../utils");
|
|
@@ -41,6 +41,10 @@ function isValidMemoryOption(mem) {
|
|
|
41
41
|
return allMemoryOptions.includes(mem);
|
|
42
42
|
}
|
|
43
43
|
exports.isValidMemoryOption = isValidMemoryOption;
|
|
44
|
+
function isValidEgressSetting(egress) {
|
|
45
|
+
return egress === "PRIVATE_RANGES_ONLY" || egress === "ALL_TRAFFIC";
|
|
46
|
+
}
|
|
47
|
+
exports.isValidEgressSetting = isValidEgressSetting;
|
|
44
48
|
function memoryOptionDisplayName(option) {
|
|
45
49
|
return {
|
|
46
50
|
128: "128MB",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBackend = exports.resolveBackend = exports.AllIngressSettings = exports.AllVpcEgressSettings = exports.AllFunctionsPlatforms = exports.
|
|
3
|
+
exports.toBackend = exports.resolveBackend = exports.AllIngressSettings = exports.AllVpcEgressSettings = exports.AllFunctionsPlatforms = exports.isBlockingTriggered = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isCallableTriggered = exports.isHttpsTriggered = exports.of = exports.empty = void 0;
|
|
4
4
|
const backend = require("./backend");
|
|
5
5
|
const proto = require("../../gcp/proto");
|
|
6
6
|
const api = require("../../.../../api");
|
|
@@ -48,10 +48,6 @@ function isBlockingTriggered(triggered) {
|
|
|
48
48
|
}
|
|
49
49
|
exports.isBlockingTriggered = isBlockingTriggered;
|
|
50
50
|
const allMemoryOptions = [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768];
|
|
51
|
-
function isValidMemoryOption(mem) {
|
|
52
|
-
return allMemoryOptions.includes(mem);
|
|
53
|
-
}
|
|
54
|
-
exports.isValidMemoryOption = isValidMemoryOption;
|
|
55
51
|
exports.AllFunctionsPlatforms = ["gcfv1", "gcfv2"];
|
|
56
52
|
exports.AllVpcEgressSettings = ["PRIVATE_RANGES_ONLY", "ALL_TRAFFIC"];
|
|
57
53
|
exports.AllIngressSettings = [
|
|
@@ -175,7 +171,7 @@ function toBackend(build, paramValues) {
|
|
|
175
171
|
}
|
|
176
172
|
let regions = [];
|
|
177
173
|
if (!bdEndpoint.region) {
|
|
178
|
-
regions = [api.functionsDefaultRegion];
|
|
174
|
+
regions = [api.functionsDefaultRegion()];
|
|
179
175
|
}
|
|
180
176
|
else if (Array.isArray(bdEndpoint.region)) {
|
|
181
177
|
regions = params.resolveList(bdEndpoint.region, paramValues);
|
|
@@ -230,7 +226,14 @@ function toBackend(build, paramValues) {
|
|
|
230
226
|
bdEndpoint.vpc.connector = `projects/${bdEndpoint.project}/locations/${region}/connectors/${bdEndpoint.vpc.connector}`;
|
|
231
227
|
}
|
|
232
228
|
bkEndpoint.vpc = { connector: bdEndpoint.vpc.connector };
|
|
233
|
-
|
|
229
|
+
if (bdEndpoint.vpc.egressSettings) {
|
|
230
|
+
const egressSettings = r.resolveString(bdEndpoint.vpc.egressSettings);
|
|
231
|
+
if (!backend.isValidEgressSetting(egressSettings)) {
|
|
232
|
+
throw new error_1.FirebaseError(`Value "${egressSettings}" is an invalid ` +
|
|
233
|
+
"egress setting. Valid values are PRIVATE_RANGES_ONLY and ALL_TRAFFIC");
|
|
234
|
+
}
|
|
235
|
+
bkEndpoint.vpc.egressSettings = egressSettings;
|
|
236
|
+
}
|
|
234
237
|
}
|
|
235
238
|
else if (bdEndpoint.vpc === null) {
|
|
236
239
|
bkEndpoint.vpc = null;
|
|
@@ -124,7 +124,7 @@ class ArtifactRegistryCleaner {
|
|
|
124
124
|
}
|
|
125
125
|
exports.ArtifactRegistryCleaner = ArtifactRegistryCleaner;
|
|
126
126
|
ArtifactRegistryCleaner.POLLER_OPTIONS = {
|
|
127
|
-
apiOrigin: api_1.artifactRegistryDomain,
|
|
127
|
+
apiOrigin: (0, api_1.artifactRegistryDomain)(),
|
|
128
128
|
apiVersion: artifactregistry.API_VERSION,
|
|
129
129
|
masterTimeout: 5 * 60 * 1000,
|
|
130
130
|
};
|
|
@@ -144,7 +144,7 @@ class ContainerRegistryCleaner {
|
|
|
144
144
|
helper(location) {
|
|
145
145
|
const subdomain = docker.GCR_SUBDOMAIN_MAPPING[location] || "us";
|
|
146
146
|
if (!this.helpers[subdomain]) {
|
|
147
|
-
const origin = `https://${subdomain}.${api_1.containerRegistryDomain}`;
|
|
147
|
+
const origin = `https://${subdomain}.${(0, api_1.containerRegistryDomain)()}`;
|
|
148
148
|
this.helpers[subdomain] = new DockerHelper(origin);
|
|
149
149
|
}
|
|
150
150
|
return this.helpers[subdomain];
|
|
@@ -176,7 +176,7 @@ class ContainerRegistryCleaner {
|
|
|
176
176
|
exports.ContainerRegistryCleaner = ContainerRegistryCleaner;
|
|
177
177
|
function getHelper(cache, subdomain) {
|
|
178
178
|
if (!cache[subdomain]) {
|
|
179
|
-
cache[subdomain] = new DockerHelper(`https://${subdomain}.${api_1.containerRegistryDomain}`);
|
|
179
|
+
cache[subdomain] = new DockerHelper(`https://${subdomain}.${(0, api_1.containerRegistryDomain)()}`);
|
|
180
180
|
}
|
|
181
181
|
return cache[subdomain];
|
|
182
182
|
}
|
|
@@ -220,7 +220,7 @@ async function listGcfPaths(projectId, locations, dockerHelpers = {}) {
|
|
|
220
220
|
throw new error_1.FirebaseError(`Failed to search the following subdomains: ${failedSubdomains.join(",")}`);
|
|
221
221
|
}
|
|
222
222
|
return gcfDirs.map((loc) => {
|
|
223
|
-
return `${docker.GCR_SUBDOMAIN_MAPPING[loc]}.${api_1.containerRegistryDomain}/${projectId}/gcf/${loc}`;
|
|
223
|
+
return `${docker.GCR_SUBDOMAIN_MAPPING[loc]}.${(0, api_1.containerRegistryDomain)()}/${projectId}/gcf/${loc}`;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
exports.listGcfPaths = listGcfPaths;
|
|
@@ -24,9 +24,12 @@ async function uploadSourceV1(projectId, source, wantBackend) {
|
|
|
24
24
|
file: source.functionsSourceV1,
|
|
25
25
|
stream: fs.createReadStream(source.functionsSourceV1),
|
|
26
26
|
};
|
|
27
|
+
if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
|
|
28
|
+
(0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUTOA_PROJECT is not usable when uploading source for Cloud Functions.");
|
|
29
|
+
}
|
|
27
30
|
await gcs.upload(uploadOpts, uploadUrl, {
|
|
28
31
|
"x-goog-content-length-range": "0,104857600",
|
|
29
|
-
});
|
|
32
|
+
}, true);
|
|
30
33
|
return uploadUrl;
|
|
31
34
|
}
|
|
32
35
|
async function uploadSourceV2(projectId, source, wantBackend) {
|
|
@@ -40,7 +43,10 @@ async function uploadSourceV2(projectId, source, wantBackend) {
|
|
|
40
43
|
file: source.functionsSourceV2,
|
|
41
44
|
stream: fs.createReadStream(source.functionsSourceV2),
|
|
42
45
|
};
|
|
43
|
-
|
|
46
|
+
if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
|
|
47
|
+
(0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUTOA_PROJECT is not usable when uploading source for Cloud Functions.");
|
|
48
|
+
}
|
|
49
|
+
await gcs.upload(uploadOpts, res.uploadUrl, undefined, true);
|
|
44
50
|
return res.storageSource;
|
|
45
51
|
}
|
|
46
52
|
async function uploadCodebase(context, codebase, wantBackend) {
|
|
@@ -8,9 +8,9 @@ const utils_1 = require("../../utils");
|
|
|
8
8
|
const secretManager_1 = require("../../gcp/secretManager");
|
|
9
9
|
const projects_1 = require("../../management/projects");
|
|
10
10
|
const functional_1 = require("../../functional");
|
|
11
|
+
const api_1 = require("../../api");
|
|
11
12
|
const backend = require("./backend");
|
|
12
13
|
const FAQ_URL = "https://firebase.google.com/support/faq#functions-runtime";
|
|
13
|
-
const CLOUD_BUILD_API = "cloudbuild.googleapis.com";
|
|
14
14
|
const metadataCallCache = new Map();
|
|
15
15
|
async function defaultServiceAccount(e) {
|
|
16
16
|
let metadataCall = metadataCallCache.get(e.project);
|
|
@@ -53,7 +53,7 @@ function isPermissionError(e) {
|
|
|
53
53
|
}
|
|
54
54
|
async function cloudBuildEnabled(projectId) {
|
|
55
55
|
try {
|
|
56
|
-
await (0, ensureApiEnabled_1.ensure)(projectId,
|
|
56
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.cloudbuildOrigin)(), "functions");
|
|
57
57
|
}
|
|
58
58
|
catch (e) {
|
|
59
59
|
if ((0, error_1.isBillingError)(e)) {
|
|
@@ -10,6 +10,7 @@ const functionsEnv = require("../../functions/env");
|
|
|
10
10
|
const runtimes = require("./runtimes");
|
|
11
11
|
const validate = require("./validate");
|
|
12
12
|
const ensure = require("./ensure");
|
|
13
|
+
const api_1 = require("../../api");
|
|
13
14
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
15
16
|
const prepareFunctionsUpload_1 = require("./prepareFunctionsUpload");
|
|
@@ -39,10 +40,10 @@ async function prepare(context, options, payload) {
|
|
|
39
40
|
(0, utils_1.logLabeledBullet)("functions", `preparing codebase ${clc.bold(codebase)} for deployment`);
|
|
40
41
|
}
|
|
41
42
|
const checkAPIsEnabled = await Promise.all([
|
|
42
|
-
ensureApiEnabled.ensure(projectId,
|
|
43
|
-
ensureApiEnabled.check(projectId,
|
|
43
|
+
ensureApiEnabled.ensure(projectId, (0, api_1.functionsOrigin)(), "functions"),
|
|
44
|
+
ensureApiEnabled.check(projectId, (0, api_1.runtimeconfigOrigin)(), "runtimeconfig", true),
|
|
44
45
|
ensure.cloudBuildEnabled(projectId),
|
|
45
|
-
ensureApiEnabled.ensure(projectId,
|
|
46
|
+
ensureApiEnabled.ensure(projectId, (0, api_1.artifactRegistryDomain)(), "artifactregistry"),
|
|
46
47
|
]);
|
|
47
48
|
const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
|
|
48
49
|
context.firebaseConfig = firebaseConfig;
|
|
@@ -156,12 +157,7 @@ async function prepare(context, options, payload) {
|
|
|
156
157
|
return ensureApiEnabled.ensure(projectId, api, "functions", false);
|
|
157
158
|
}));
|
|
158
159
|
if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
|
|
159
|
-
const V2_APIS = [
|
|
160
|
-
"run.googleapis.com",
|
|
161
|
-
"eventarc.googleapis.com",
|
|
162
|
-
"pubsub.googleapis.com",
|
|
163
|
-
"storage.googleapis.com",
|
|
164
|
-
];
|
|
160
|
+
const V2_APIS = [(0, api_1.cloudRunApiOrigin)(), (0, api_1.eventarcOrigin)(), (0, api_1.pubsubOrigin)(), (0, api_1.storageOrigin)()];
|
|
165
161
|
const enablements = V2_APIS.map((api) => {
|
|
166
162
|
return ensureApiEnabled.ensure(context.projectId, api, "functions");
|
|
167
163
|
});
|
|
@@ -191,6 +187,7 @@ function inferDetailsFromExisting(want, have, usedDotenv) {
|
|
|
191
187
|
if (!haveE) {
|
|
192
188
|
continue;
|
|
193
189
|
}
|
|
190
|
+
wantE.runServiceId = haveE.runServiceId;
|
|
194
191
|
if (!usedDotenv) {
|
|
195
192
|
wantE.environmentVariables = {
|
|
196
193
|
...haveE.environmentVariables,
|
|
@@ -28,19 +28,19 @@ const v1_1 = require("../../../functions/events/v1");
|
|
|
28
28
|
const checkIam_1 = require("../checkIam");
|
|
29
29
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
30
30
|
const gcfV1PollerOptions = {
|
|
31
|
-
apiOrigin: api_1.functionsOrigin,
|
|
31
|
+
apiOrigin: (0, api_1.functionsOrigin)(),
|
|
32
32
|
apiVersion: gcf.API_VERSION,
|
|
33
33
|
masterTimeout: 25 * 60 * 1000,
|
|
34
34
|
maxBackoff: 10000,
|
|
35
35
|
};
|
|
36
36
|
const gcfV2PollerOptions = {
|
|
37
|
-
apiOrigin: api_1.functionsV2Origin,
|
|
37
|
+
apiOrigin: (0, api_1.functionsV2Origin)(),
|
|
38
38
|
apiVersion: gcfV2.API_VERSION,
|
|
39
39
|
masterTimeout: 25 * 60 * 1000,
|
|
40
40
|
maxBackoff: 10000,
|
|
41
41
|
};
|
|
42
42
|
const eventarcPollerOptions = {
|
|
43
|
-
apiOrigin: api_1.eventarcOrigin,
|
|
43
|
+
apiOrigin: (0, api_1.eventarcOrigin)(),
|
|
44
44
|
apiVersion: "v1",
|
|
45
45
|
masterTimeout: 25 * 60 * 1000,
|
|
46
46
|
maxBackoff: 10000,
|
|
@@ -342,7 +342,9 @@ class Fabricator {
|
|
|
342
342
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
343
343
|
}
|
|
344
344
|
else if (backend.isScheduleTriggered(endpoint)) {
|
|
345
|
-
const invoker =
|
|
345
|
+
const invoker = endpoint.serviceAccount
|
|
346
|
+
? [endpoint.serviceAccount]
|
|
347
|
+
: [(0, checkIam_1.getDefaultComputeServiceAgent)(this.projectNumber)];
|
|
346
348
|
await this.executor
|
|
347
349
|
.run(() => run.setInvokerCreate(endpoint.project, serviceName, invoker))
|
|
348
350
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
@@ -431,7 +433,9 @@ class Fabricator {
|
|
|
431
433
|
invoker = ["public"];
|
|
432
434
|
}
|
|
433
435
|
else if (backend.isScheduleTriggered(endpoint)) {
|
|
434
|
-
invoker =
|
|
436
|
+
invoker = endpoint.serviceAccount
|
|
437
|
+
? [endpoint.serviceAccount]
|
|
438
|
+
: [(0, checkIam_1.getDefaultComputeServiceAgent)(this.projectNumber)];
|
|
435
439
|
}
|
|
436
440
|
if (invoker) {
|
|
437
441
|
await this.executor
|
|
@@ -42,7 +42,7 @@ async function detectFromYaml(directory, project, runtime) {
|
|
|
42
42
|
}
|
|
43
43
|
logger_1.logger.debug("Found functions.yaml. Got spec:", text);
|
|
44
44
|
const parsed = yaml.load(text);
|
|
45
|
-
return yamlToBuild(parsed, project, api.functionsDefaultRegion, runtime);
|
|
45
|
+
return yamlToBuild(parsed, project, api.functionsDefaultRegion(), runtime);
|
|
46
46
|
}
|
|
47
47
|
exports.detectFromYaml = detectFromYaml;
|
|
48
48
|
async function detectFromPort(port, project, runtime, timeout = 10000) {
|
|
@@ -80,6 +80,6 @@ async function detectFromPort(port, project, runtime, timeout = 10000) {
|
|
|
80
80
|
logger_1.logger.debug("Failed to parse functions.yaml", err);
|
|
81
81
|
throw new error_1.FirebaseError(`Failed to load function definition from source: ${text}`);
|
|
82
82
|
}
|
|
83
|
-
return yamlToBuild(parsed, project, api.functionsDefaultRegion, runtime);
|
|
83
|
+
return yamlToBuild(parsed, project, api.functionsDefaultRegion(), runtime);
|
|
84
84
|
}
|
|
85
85
|
exports.detectFromPort = detectFromPort;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildFromV1Alpha1 = void 0;
|
|
4
4
|
const build = require("../../build");
|
|
5
|
+
const backend = require("../../backend");
|
|
5
6
|
const proto_1 = require("../../../../gcp/proto");
|
|
6
7
|
const parsing_1 = require("./parsing");
|
|
7
8
|
const error_1 = require("../../../../error");
|
|
@@ -52,7 +53,7 @@ function assertBuildEndpoint(ep, id) {
|
|
|
52
53
|
platform: (platform) => build.AllFunctionsPlatforms.includes(platform),
|
|
53
54
|
entryPoint: "string",
|
|
54
55
|
omit: "Field<boolean>?",
|
|
55
|
-
availableMemoryMb: (mem) => mem === null || isCEL(mem) ||
|
|
56
|
+
availableMemoryMb: (mem) => mem === null || isCEL(mem) || backend.isValidMemoryOption(mem),
|
|
56
57
|
maxInstances: "Field<number>?",
|
|
57
58
|
minInstances: "Field<number>?",
|
|
58
59
|
concurrency: "Field<number>?",
|
|
@@ -91,7 +91,7 @@ exports.mergeRequiredAPIs = mergeRequiredAPIs;
|
|
|
91
91
|
function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
92
92
|
Object.freeze(annotation);
|
|
93
93
|
const toSeconds = (0, functional_1.nullsafeVisitor)(proto.secondsFromDuration);
|
|
94
|
-
const regions = annotation.regions || [api.functionsDefaultRegion];
|
|
94
|
+
const regions = annotation.regions || [api.functionsDefaultRegion()];
|
|
95
95
|
let triggered;
|
|
96
96
|
const triggerCount = +!!annotation.httpsTrigger +
|
|
97
97
|
+!!annotation.eventTrigger +
|
|
@@ -219,7 +219,7 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
219
219
|
exports.addResourcesToBuild = addResourcesToBuild;
|
|
220
220
|
function addResourcesToBackend(projectId, runtime, annotation, want) {
|
|
221
221
|
Object.freeze(annotation);
|
|
222
|
-
for (const region of annotation.regions || [api.functionsDefaultRegion]) {
|
|
222
|
+
for (const region of annotation.regions || [api.functionsDefaultRegion()]) {
|
|
223
223
|
let triggered;
|
|
224
224
|
const triggerCount = +!!annotation.httpsTrigger +
|
|
225
225
|
+!!annotation.eventTrigger +
|
|
@@ -24,7 +24,7 @@ function progressMessage(message, current, total) {
|
|
|
24
24
|
class Uploader {
|
|
25
25
|
constructor(options) {
|
|
26
26
|
this.hashClient = new apiv2_1.Client({
|
|
27
|
-
urlPrefix: api_1.hostingApiOrigin,
|
|
27
|
+
urlPrefix: (0, api_1.hostingApiOrigin)(),
|
|
28
28
|
auth: true,
|
|
29
29
|
apiVersion: "v1beta1",
|
|
30
30
|
});
|
package/lib/deploy/index.js
CHANGED
|
@@ -115,7 +115,7 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
115
115
|
logger_1.logger.info((0, colorette_1.bold)("Project Console:"), (0, utils_1.consoleUrl)(options.project, "/overview"));
|
|
116
116
|
if (deployedHosting) {
|
|
117
117
|
(0, lodash_1.each)(context.hosting.deploys, (deploy) => {
|
|
118
|
-
logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)(api_1.hostingOrigin, deploy.config.site));
|
|
118
|
+
logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)((0, api_1.hostingOrigin)(), deploy.config.site));
|
|
119
119
|
});
|
|
120
120
|
const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
|
|
121
121
|
return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
|
|
@@ -5,7 +5,7 @@ const api_1 = require("../../api");
|
|
|
5
5
|
const apiv2_1 = require("../../apiv2");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const TIMEOUT = 30000;
|
|
8
|
-
const client = new apiv2_1.Client({ urlPrefix: api_1.remoteConfigApiOrigin, apiVersion: "v1" });
|
|
8
|
+
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.remoteConfigApiOrigin)(), apiVersion: "v1" });
|
|
9
9
|
async function getEtag(projectNumber, versionNumber) {
|
|
10
10
|
const reqPath = `/projects/${projectNumber}/remoteConfig`;
|
|
11
11
|
const queryParams = {};
|
|
@@ -35,7 +35,7 @@ async function getProjectAdminSdkConfig(projectId) {
|
|
|
35
35
|
const apiClient = new apiv2.Client({
|
|
36
36
|
auth: true,
|
|
37
37
|
apiVersion: "v1beta1",
|
|
38
|
-
urlPrefix: api_1.firebaseApiOrigin,
|
|
38
|
+
urlPrefix: (0, api_1.firebaseApiOrigin)(),
|
|
39
39
|
});
|
|
40
40
|
if (projectId.startsWith("demo-")) {
|
|
41
41
|
logger_1.logger.debug(`Detected demo- project: ${projectId}. Using default adminSdkConfig instead of calling firebase API.`);
|
|
@@ -120,13 +120,16 @@ async function beforeEmulatorCommand(options) {
|
|
|
120
120
|
}
|
|
121
121
|
exports.beforeEmulatorCommand = beforeEmulatorCommand;
|
|
122
122
|
function parseInspectionPort(options) {
|
|
123
|
-
|
|
124
|
-
if (port ===
|
|
125
|
-
|
|
123
|
+
const port = options.inspectFunctions;
|
|
124
|
+
if (typeof port === "undefined") {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
else if (typeof port === "boolean") {
|
|
128
|
+
return port;
|
|
126
129
|
}
|
|
127
130
|
const parsed = Number(port);
|
|
128
131
|
if (isNaN(parsed) || parsed < 1024 || parsed > 65535) {
|
|
129
|
-
throw new error_1.FirebaseError(`"${port}" is not a valid port for debugging, please pass an integer between 1024 and 65535.`);
|
|
132
|
+
throw new error_1.FirebaseError(`"${port}" is not a valid port for debugging, please pass an integer between 1024 and 65535 or true for a dynamic port.`);
|
|
130
133
|
}
|
|
131
134
|
return parsed;
|
|
132
135
|
}
|
|
@@ -336,10 +336,9 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
336
336
|
const functionsLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FUNCTIONS);
|
|
337
337
|
const functionsAddr = legacyGetFirstAddr(types_1.Emulators.FUNCTIONS);
|
|
338
338
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
339
|
-
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
functionsLogger.logLabeled("WARN", "functions", `You are running the Functions emulator in debug mode (port=${inspectFunctions}). This means that functions will execute in sequence rather than in parallel.`);
|
|
339
|
+
const inspectFunctions = commandUtils.parseInspectionPort(options);
|
|
340
|
+
if (inspectFunctions) {
|
|
341
|
+
functionsLogger.logLabeled("WARN", "functions", `You are running the Functions emulator in debug mode. This means that functions will execute in sequence rather than in parallel.`);
|
|
343
342
|
}
|
|
344
343
|
const emulatorsNotRunning = types_1.ALL_SERVICE_EMULATORS.filter((e) => {
|
|
345
344
|
return e !== types_1.Emulators.FUNCTIONS && !listenForEmulator[e];
|
|
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
|
|
|
23
23
|
expectedChecksum: "2fd771101c0e1f7898c04c9204f2ce63",
|
|
24
24
|
},
|
|
25
25
|
firestore: {
|
|
26
|
-
version: "1.19.
|
|
27
|
-
expectedSize:
|
|
28
|
-
expectedChecksum: "
|
|
26
|
+
version: "1.19.4",
|
|
27
|
+
expectedSize: 65913000,
|
|
28
|
+
expectedChecksum: "a861bfa9d12ef69645b41e2f3bd8db8d",
|
|
29
29
|
},
|
|
30
30
|
storage: {
|
|
31
31
|
version: "1.1.3",
|
|
@@ -35,14 +35,14 @@ const EMULATOR_UPDATE_DETAILS = {
|
|
|
35
35
|
ui: experiments.isEnabled("emulatoruisnapshot")
|
|
36
36
|
? { version: "SNAPSHOT", expectedSize: -1, expectedChecksum: "" }
|
|
37
37
|
: {
|
|
38
|
-
version: "1.11.
|
|
39
|
-
expectedSize:
|
|
40
|
-
expectedChecksum: "
|
|
38
|
+
version: "1.11.8",
|
|
39
|
+
expectedSize: 3523907,
|
|
40
|
+
expectedChecksum: "49f6dc1911dda9d10df62a6c09aaf9a0",
|
|
41
41
|
},
|
|
42
42
|
pubsub: {
|
|
43
|
-
version: "0.
|
|
44
|
-
expectedSize:
|
|
45
|
-
expectedChecksum: "
|
|
43
|
+
version: "0.8.2",
|
|
44
|
+
expectedSize: 65611398,
|
|
45
|
+
expectedChecksum: "70bb840321423e6ae621a3ae2f314903",
|
|
46
46
|
},
|
|
47
47
|
};
|
|
48
48
|
exports.DownloadDetails = {
|
|
@@ -83,7 +83,7 @@ exports.DownloadDetails = {
|
|
|
83
83
|
version: EMULATOR_UPDATE_DETAILS.ui.version,
|
|
84
84
|
downloadPath: path.join(CACHE_DIR, `ui-v${EMULATOR_UPDATE_DETAILS.ui.version}.zip`),
|
|
85
85
|
unzipDir: path.join(CACHE_DIR, `ui-v${EMULATOR_UPDATE_DETAILS.ui.version}`),
|
|
86
|
-
binaryPath: path.join(CACHE_DIR, `ui-v${EMULATOR_UPDATE_DETAILS.ui.version}`, "server", "server.
|
|
86
|
+
binaryPath: path.join(CACHE_DIR, `ui-v${EMULATOR_UPDATE_DETAILS.ui.version}`, "server", "server.mjs"),
|
|
87
87
|
opts: {
|
|
88
88
|
cacheDir: CACHE_DIR,
|
|
89
89
|
remoteUrl: `https://storage.googleapis.com/firebase-preview-drop/emulator/ui-v${EMULATOR_UPDATE_DETAILS.ui.version}.zip`,
|
|
@@ -84,6 +84,11 @@ class FunctionsEmulator {
|
|
|
84
84
|
this.debugMode = false;
|
|
85
85
|
emulatorLogger_1.EmulatorLogger.setVerbosity(this.args.verbosity ? emulatorLogger_1.Verbosity[this.args.verbosity] : emulatorLogger_1.Verbosity["DEBUG"]);
|
|
86
86
|
if (this.args.debugPort) {
|
|
87
|
+
const maybeNodeCodebases = this.args.emulatableBackends.filter((b) => !b.runtime || b.runtime.startsWith("node"));
|
|
88
|
+
if (maybeNodeCodebases.length > 1 && typeof this.args.debugPort === "number") {
|
|
89
|
+
throw new error_1.FirebaseError("Cannot debug on a single port with multiple codebases. " +
|
|
90
|
+
"Use --inspect-functions=true to assign dynamic ports to each codebase");
|
|
91
|
+
}
|
|
87
92
|
this.args.disabledRuntimeFeatures = this.args.disabledRuntimeFeatures || {};
|
|
88
93
|
this.args.disabledRuntimeFeatures.timeout = true;
|
|
89
94
|
this.debugMode = true;
|
|
@@ -869,8 +874,22 @@ class FunctionsEmulator {
|
|
|
869
874
|
this.logger.log("WARN", `To enable function inspection, please run "npm i node@${semver.coerce(backend.runtime || "18.0.0")} --save-dev" in your functions directory`);
|
|
870
875
|
}
|
|
871
876
|
else {
|
|
877
|
+
let port;
|
|
878
|
+
if (typeof this.args.debugPort === "number") {
|
|
879
|
+
port = this.args.debugPort;
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
port = await portfinder.getPortPromise({ port: 9229 });
|
|
883
|
+
if (port === 9229) {
|
|
884
|
+
this.logger.logLabeled("SUCCESS", "functions", `Using debug port 9229 for functions codebase ${backend.codebase}`);
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
this.logger.logLabeled("SUCCESS", "functions", `Using debug port ${port} for functions codebase ${backend.codebase}. ` +
|
|
888
|
+
"You may need to add manually add this port to your inspector.");
|
|
889
|
+
}
|
|
890
|
+
}
|
|
872
891
|
const { host } = this.getInfo();
|
|
873
|
-
args.unshift(`--inspect=${(0, utils_1.connectableHostname)(host)}:${
|
|
892
|
+
args.unshift(`--inspect=${(0, utils_1.connectableHostname)(host)}:${port}`);
|
|
874
893
|
}
|
|
875
894
|
}
|
|
876
895
|
const pnpPath = path.join(backend.functionsDir, ".pnp.js");
|
|
@@ -889,6 +908,7 @@ class FunctionsEmulator {
|
|
|
889
908
|
cwd: backend.functionsDir,
|
|
890
909
|
env: {
|
|
891
910
|
node: backend.bin,
|
|
911
|
+
METADATA_SERVER_DETECTION: "none",
|
|
892
912
|
...process.env,
|
|
893
913
|
...envs,
|
|
894
914
|
PORT: socketPath,
|
package/lib/ensureApiEnabled.js
CHANGED
|
@@ -12,10 +12,11 @@ exports.POLL_SETTINGS = {
|
|
|
12
12
|
pollsBeforeRetry: 12,
|
|
13
13
|
};
|
|
14
14
|
const apiClient = new apiv2_1.Client({
|
|
15
|
-
urlPrefix: api_1.serviceUsageOrigin,
|
|
15
|
+
urlPrefix: (0, api_1.serviceUsageOrigin)(),
|
|
16
16
|
apiVersion: "v1",
|
|
17
17
|
});
|
|
18
|
-
async function check(projectId,
|
|
18
|
+
async function check(projectId, apiUri, prefix, silent = false) {
|
|
19
|
+
const apiName = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
|
|
19
20
|
const res = await apiClient.get(`/projects/${projectId}/services/${apiName}`, {
|
|
20
21
|
headers: { "x-goog-quota-user": `projects/${projectId}` },
|
|
21
22
|
skipLog: { resBody: true },
|
|
@@ -89,18 +90,19 @@ async function enableApiWithRetries(projectId, apiName, prefix, silent, enableme
|
|
|
89
90
|
await enable(projectId, apiName);
|
|
90
91
|
return pollCheckEnabled(projectId, apiName, prefix, silent, enablementRetries);
|
|
91
92
|
}
|
|
92
|
-
async function ensure(projectId,
|
|
93
|
+
async function ensure(projectId, apiUri, prefix, silent = false) {
|
|
94
|
+
const hostname = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
|
|
93
95
|
if (!silent) {
|
|
94
|
-
utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(
|
|
96
|
+
utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(hostname)} is enabled...`);
|
|
95
97
|
}
|
|
96
|
-
const isEnabled = await check(projectId,
|
|
98
|
+
const isEnabled = await check(projectId, hostname, prefix, silent);
|
|
97
99
|
if (isEnabled) {
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
100
102
|
if (!silent) {
|
|
101
|
-
utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(
|
|
103
|
+
utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(hostname)}. Enabling now...`);
|
|
102
104
|
}
|
|
103
|
-
return enableApiWithRetries(projectId,
|
|
105
|
+
return enableApiWithRetries(projectId, hostname, prefix, silent);
|
|
104
106
|
}
|
|
105
107
|
exports.ensure = ensure;
|
|
106
108
|
function enableApiURI(projectId, apiName) {
|
|
@@ -12,7 +12,7 @@ const refs = require("./refs");
|
|
|
12
12
|
const EXTENSIONS_API_VERSION = "v1beta";
|
|
13
13
|
const PAGE_SIZE_MAX = 100;
|
|
14
14
|
const extensionsApiClient = new apiv2_1.Client({
|
|
15
|
-
urlPrefix: api_1.extensionsOrigin,
|
|
15
|
+
urlPrefix: (0, api_1.extensionsOrigin)(),
|
|
16
16
|
apiVersion: EXTENSIONS_API_VERSION,
|
|
17
17
|
});
|
|
18
18
|
async function createInstanceHelper(projectId, instanceId, config, validateOnly = false) {
|
|
@@ -28,7 +28,7 @@ async function createInstanceHelper(projectId, instanceId, config, validateOnly
|
|
|
28
28
|
return createRes.body;
|
|
29
29
|
}
|
|
30
30
|
const pollRes = await operationPoller.pollOperation({
|
|
31
|
-
apiOrigin: api_1.extensionsOrigin,
|
|
31
|
+
apiOrigin: (0, api_1.extensionsOrigin)(),
|
|
32
32
|
apiVersion: EXTENSIONS_API_VERSION,
|
|
33
33
|
operationResourceName: createRes.body.name,
|
|
34
34
|
masterTimeout: 3600000,
|
|
@@ -68,7 +68,7 @@ exports.createInstance = createInstance;
|
|
|
68
68
|
async function deleteInstance(projectId, instanceId) {
|
|
69
69
|
const deleteRes = await extensionsApiClient.delete(`/projects/${projectId}/instances/${instanceId}`);
|
|
70
70
|
const pollRes = await operationPoller.pollOperation({
|
|
71
|
-
apiOrigin: api_1.extensionsOrigin,
|
|
71
|
+
apiOrigin: (0, api_1.extensionsOrigin)(),
|
|
72
72
|
apiVersion: EXTENSIONS_API_VERSION,
|
|
73
73
|
operationResourceName: deleteRes.body.name,
|
|
74
74
|
masterTimeout: 600000,
|
|
@@ -213,7 +213,7 @@ async function patchInstance(args) {
|
|
|
213
213
|
return updateRes;
|
|
214
214
|
}
|
|
215
215
|
const pollRes = await operationPoller.pollOperation({
|
|
216
|
-
apiOrigin: api_1.extensionsOrigin,
|
|
216
|
+
apiOrigin: (0, api_1.extensionsOrigin)(),
|
|
217
217
|
apiVersion: EXTENSIONS_API_VERSION,
|
|
218
218
|
operationResourceName: updateRes.body.name,
|
|
219
219
|
masterTimeout: 600000,
|
|
@@ -243,7 +243,7 @@ async function createSource(projectId, packageUri, extensionRoot) {
|
|
|
243
243
|
extensionRoot,
|
|
244
244
|
});
|
|
245
245
|
const pollRes = await operationPoller.pollOperation({
|
|
246
|
-
apiOrigin: api_1.extensionsOrigin,
|
|
246
|
+
apiOrigin: (0, api_1.extensionsOrigin)(),
|
|
247
247
|
apiVersion: EXTENSIONS_API_VERSION,
|
|
248
248
|
operationResourceName: createRes.body.name,
|
|
249
249
|
masterTimeout: 600000,
|
|
@@ -352,7 +352,7 @@ async function ensureExtensionsApiEnabled(options) {
|
|
|
352
352
|
if (!projectId) {
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
return await (0, ensureApiEnabled_1.ensure)(projectId,
|
|
355
|
+
return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.extensionsOrigin)(), "extensions", options.markdown);
|
|
356
356
|
}
|
|
357
357
|
exports.ensureExtensionsApiEnabled = ensureExtensionsApiEnabled;
|
|
358
358
|
async function ensureExtensionsPublisherApiEnabled(options) {
|
|
@@ -360,7 +360,7 @@ async function ensureExtensionsPublisherApiEnabled(options) {
|
|
|
360
360
|
if (!projectId) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
return await (0, ensureApiEnabled_1.ensure)(projectId,
|
|
363
|
+
return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.extensionsPublisherOrigin)(), "extensions", options.markdown);
|
|
364
364
|
}
|
|
365
365
|
exports.ensureExtensionsPublisherApiEnabled = ensureExtensionsPublisherApiEnabled;
|
|
366
366
|
async function archiveAndUploadSource(extPath, bucketName) {
|
|
@@ -671,7 +671,7 @@ async function uploadExtensionVersionFromLocalSource(args) {
|
|
|
671
671
|
uploadSpinner.start();
|
|
672
672
|
objectPath = await archiveAndUploadSource(args.rootDirectory, exports.EXTENSIONS_BUCKET_NAME);
|
|
673
673
|
uploadSpinner.succeed("Uploaded extension source code");
|
|
674
|
-
packageUri = api_1.storageOrigin + objectPath + "?alt=media";
|
|
674
|
+
packageUri = (0, api_1.storageOrigin)() + objectPath + "?alt=media";
|
|
675
675
|
}
|
|
676
676
|
catch (err) {
|
|
677
677
|
uploadSpinner.fail();
|
|
@@ -710,7 +710,7 @@ async function createSourceFromLocation(projectId, sourceUri) {
|
|
|
710
710
|
spinner.start();
|
|
711
711
|
objectPath = await archiveAndUploadSource(sourceUri, exports.EXTENSIONS_BUCKET_NAME);
|
|
712
712
|
spinner.succeed(" Uploaded extension source code");
|
|
713
|
-
packageUri = api_1.storageOrigin + objectPath + "?alt=media";
|
|
713
|
+
packageUri = (0, api_1.storageOrigin)() + objectPath + "?alt=media";
|
|
714
714
|
const res = await (0, extensionsApi_1.createSource)(projectId, packageUri, extensionRoot);
|
|
715
715
|
logger_1.logger.debug("Created new Extension Source %s", res.name);
|
|
716
716
|
await deleteUploadedSource(objectPath);
|
|
@@ -89,7 +89,7 @@ function getTriggerType(propertiesYaml) {
|
|
|
89
89
|
return propertiesYaml?.match(/eventType:\ ([\S]+)/)?.[1];
|
|
90
90
|
}
|
|
91
91
|
async function isStorageProvisioned(projectId) {
|
|
92
|
-
const client = new apiv2_1.Client({ urlPrefix: api_1.firebaseStorageOrigin, apiVersion: "v1beta" });
|
|
92
|
+
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseStorageOrigin)(), apiVersion: "v1beta" });
|
|
93
93
|
const resp = await client.get(`/projects/${projectId}/buckets`);
|
|
94
94
|
return !!resp.body?.buckets?.find((bucket) => {
|
|
95
95
|
const bucketResourceName = bucket.name;
|
|
@@ -99,7 +99,7 @@ async function isStorageProvisioned(projectId) {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
async function isAuthProvisioned(projectId) {
|
|
102
|
-
const client = new apiv2_1.Client({ urlPrefix: api_1.firedataOrigin, apiVersion: "v1" });
|
|
102
|
+
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firedataOrigin)(), apiVersion: "v1" });
|
|
103
103
|
const resp = await client.get(`/projects/${projectId}/products`);
|
|
104
104
|
return !!resp.body?.activation?.map((a) => a.service).includes("FIREBASE_AUTH");
|
|
105
105
|
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.consoleInstallLink = void 0;
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
function consoleInstallLink(extVersionRef) {
|
|
6
|
-
return `${api_1.consoleOrigin}/project/_/extensions/install?ref=${extVersionRef}`;
|
|
6
|
+
return `${(0, api_1.consoleOrigin)()}/project/_/extensions/install?ref=${extVersionRef}`;
|
|
7
7
|
}
|
|
8
8
|
exports.consoleInstallLink = consoleInstallLink;
|