firebase-tools-with-isolate 15.31.0 → 15.33.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/accountImporter.js +6 -3
- package/lib/api.js +3 -3
- package/lib/apphosting/secrets/index.js +7 -2
- package/lib/command.js +1 -1
- package/lib/commands/apps-create.js +34 -3
- package/lib/commands/auth-import.js +5 -6
- package/lib/commands/functions-kits-uninstall.js +43 -21
- package/lib/commands/functions-lifecycle-list.js +5 -6
- package/lib/commands/hosting-channel-deploy.js +3 -3
- package/lib/commands/hosting-clone.js +60 -29
- package/lib/commands/hosting-disable.js +5 -1
- package/lib/config.js +1 -0
- package/lib/crashlytics/alerts.js +122 -0
- package/lib/crashlytics/onboarding.js +71 -3
- package/lib/crashlytics/sourcemap.js +46 -11
- package/lib/crashlytics/types.js +6 -1
- package/lib/database/import.js +6 -7
- package/lib/deploy/functions/build.js +3 -0
- package/lib/deploy/functions/cel.js +89 -58
- package/lib/deploy/functions/functionsDeployHelper.js +10 -0
- package/lib/deploy/functions/params.js +7 -4
- package/lib/deploy/functions/prepare.js +25 -8
- package/lib/deploy/functions/release/fabricator.js +1 -5
- package/lib/deploy/functions/release/planner.js +3 -2
- package/lib/deploy/functions/validate.js +16 -0
- package/lib/deploy/hosting/prepare.js +1 -1
- package/lib/deploy/hosting/release.js +2 -2
- package/lib/emulator/auth/operations.js +8 -4
- package/lib/emulator/databaseEmulator.js +7 -3
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/emulatorLogger.js +2 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -1
- package/lib/experiments.js +23 -6
- package/lib/extensions/warnings.js +48 -7
- package/lib/frameworks/next/constants.js +20 -12
- package/lib/frameworks/next/index.js +4 -25
- package/lib/frameworks/next/utils.js +28 -0
- package/lib/functions/env.js +4 -2
- package/lib/functions/kits/install.js +17 -1
- package/lib/gcp/artifactregistry.js +20 -0
- package/lib/gcp/cloudmonitoring.js +80 -3
- package/lib/gcp/cloudtasks.js +15 -1
- package/lib/gcp/cloudtrace.js +38 -0
- package/lib/gcp/resourceManager.js +1 -1
- package/lib/gcp/run.js +5 -0
- package/lib/gcp/runv2.js +32 -11
- package/lib/hosting/api.js +15 -15
- package/lib/hosting/runTags.js +1 -1
- package/lib/init/features/auth.js +46 -8
- package/lib/init/features/hosting/index.js +4 -2
- package/lib/management/apps.js +4 -2
- package/lib/management/projects.js +1 -1
- package/lib/mcp/tools/firestore/converter.js +2 -2
- package/lib/mcp/util.js +11 -10
- package/lib/profileReport.js +4 -4
- package/lib/scopes.js +1 -3
- package/lib/streamJson.js +37 -0
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +0 -15
- package/package.json +11 -10
- package/schema/firebase-config.json +41 -0
- package/lib/firestore/checkDatabaseType.js +0 -24
|
@@ -417,7 +417,7 @@ async function promptIntParam(param, resolvedDefault) {
|
|
|
417
417
|
async function promptResourceString(prompt, input, projectId, resolvedDefault) {
|
|
418
418
|
const notFound = new error_1.FirebaseError(`No instances of ${input.resource.type} found.`);
|
|
419
419
|
switch (input.resource.type) {
|
|
420
|
-
case "storage.googleapis.com/Bucket":
|
|
420
|
+
case "storage.googleapis.com/Bucket": {
|
|
421
421
|
const buckets = (await (0, storage_1.listBuckets)(projectId)).map((b) => b.name);
|
|
422
422
|
if (buckets.length === 0) {
|
|
423
423
|
throw notFound;
|
|
@@ -430,6 +430,7 @@ async function promptResourceString(prompt, input, projectId, resolvedDefault) {
|
|
|
430
430
|
},
|
|
431
431
|
};
|
|
432
432
|
return promptSelect(prompt, forgedInput, resolvedDefault, (res) => res);
|
|
433
|
+
}
|
|
433
434
|
default:
|
|
434
435
|
logger_1.logger.warn(`Warning: unknown resource type ${input.resource.type}; defaulting to raw text input...`);
|
|
435
436
|
return promptText(prompt, { text: {} }, resolvedDefault, true, (res) => res);
|
|
@@ -438,7 +439,7 @@ async function promptResourceString(prompt, input, projectId, resolvedDefault) {
|
|
|
438
439
|
async function promptResourceStrings(prompt, input, projectId, enforceNonEmpty) {
|
|
439
440
|
const notFound = new error_1.FirebaseError(`No instances of ${input.resource.type} found.`);
|
|
440
441
|
switch (input.resource.type) {
|
|
441
|
-
case "storage.googleapis.com/Bucket":
|
|
442
|
+
case "storage.googleapis.com/Bucket": {
|
|
442
443
|
const buckets = (await (0, storage_1.listBuckets)(projectId)).map((b) => b.name);
|
|
443
444
|
if (buckets.length === 0) {
|
|
444
445
|
throw notFound;
|
|
@@ -451,6 +452,7 @@ async function promptResourceStrings(prompt, input, projectId, enforceNonEmpty)
|
|
|
451
452
|
},
|
|
452
453
|
};
|
|
453
454
|
return promptSelectMultiple(prompt, forgedInput, undefined, enforceNonEmpty, (res) => res);
|
|
455
|
+
}
|
|
454
456
|
default:
|
|
455
457
|
logger_1.logger.warn(`Warning: unknown resource type ${input.resource.type}; defaulting to raw text input...`);
|
|
456
458
|
return promptText(prompt, { text: {} }, undefined, enforceNonEmpty, (res) => res.split(","));
|
|
@@ -485,7 +487,7 @@ async function promptText(prompt, textInput, resolvedDefault, enforceNonEmpty =
|
|
|
485
487
|
}
|
|
486
488
|
async function promptSelect(prompt, input, resolvedDefault, converter) {
|
|
487
489
|
const response = await (0, prompt_1.select)({
|
|
488
|
-
default: resolvedDefault,
|
|
490
|
+
default: resolvedDefault?.toString(),
|
|
489
491
|
message: prompt,
|
|
490
492
|
instructions: "(Use arrow keys to navigate, and Enter to confirm your choice)",
|
|
491
493
|
choices: input.select.options.map((option) => {
|
|
@@ -504,13 +506,14 @@ async function promptSelect(prompt, input, resolvedDefault, converter) {
|
|
|
504
506
|
return converted;
|
|
505
507
|
}
|
|
506
508
|
async function promptSelectMultiple(prompt, input, resolvedDefault, enforceNonEmpty = false, converter) {
|
|
509
|
+
const preselected = new Set((resolvedDefault ?? []).map(String));
|
|
507
510
|
const response = await (0, prompt_1.checkbox)({
|
|
508
511
|
default: resolvedDefault,
|
|
509
512
|
message: prompt,
|
|
510
513
|
instructions: "(Press Space to select, and Enter to confirm your choices)",
|
|
511
514
|
choices: input.multiSelect.options.map((option) => {
|
|
512
515
|
return {
|
|
513
|
-
checked:
|
|
516
|
+
checked: preselected.has(option.value.toString()),
|
|
514
517
|
name: option.label,
|
|
515
518
|
value: option.value.toString(),
|
|
516
519
|
};
|
|
@@ -23,6 +23,7 @@ const experiments = require("../../experiments");
|
|
|
23
23
|
const ensureApiEnabled = require("../../ensureApiEnabled");
|
|
24
24
|
const functionsConfig = require("../../functionsConfig");
|
|
25
25
|
const functionsEnv = require("../../functions/env");
|
|
26
|
+
const params = require("./params");
|
|
26
27
|
const runtimes = require("./runtimes");
|
|
27
28
|
const supported = require("./runtimes/supported");
|
|
28
29
|
const validate = require("./validate");
|
|
@@ -206,12 +207,11 @@ async function prepare(context, options, payload) {
|
|
|
206
207
|
const rawUserEnvs = functionsEnv.loadUserEnvs(userEnvOpt);
|
|
207
208
|
const { userEnvs: userEnvs, secretRefs: secretRefs } = partitionUserEnvs(rawUserEnvs);
|
|
208
209
|
const envs = { ...userEnvs, ...firebaseEnvs };
|
|
210
|
+
const parsedSecretRefs = (0, functional_1.mapObject)(secretRefs, (unparsed) => build.parseSecretRef(unparsed));
|
|
211
|
+
await build.applyEnvSecretBindingsToBuild(wantBuild, parsedSecretRefs);
|
|
209
212
|
const relevantEndpoints = backend
|
|
210
213
|
.allEndpoints(existingBackend)
|
|
211
214
|
.filter((e) => e.codebase === codebase || e.codebase === undefined);
|
|
212
|
-
await resolveDefaultRegionsForBuild(wantBuild, backend.of(...relevantEndpoints));
|
|
213
|
-
const parsedSecretRefs = (0, functional_1.mapObject)(secretRefs, (unparsed) => build.parseSecretRef(unparsed));
|
|
214
|
-
await build.applyEnvSecretBindingsToBuild(wantBuild, parsedSecretRefs);
|
|
215
215
|
const { backend: wantBackend, envs: resolvedEnvs, secretRefs: resolvedSecretRefs, } = await build.resolveBackend({
|
|
216
216
|
build: wantBuild,
|
|
217
217
|
firebaseConfig,
|
|
@@ -219,6 +219,7 @@ async function prepare(context, options, payload) {
|
|
|
219
219
|
codebase,
|
|
220
220
|
nonInteractive: options.nonInteractive,
|
|
221
221
|
isEmulator: false,
|
|
222
|
+
resolveRegions: (b, paramValues) => resolveDefaultRegionsForBuild(b, backend.of(...relevantEndpoints), paramValues),
|
|
222
223
|
});
|
|
223
224
|
functionsEnv.writeResolvedParams(resolvedEnvs, userEnvs, userEnvOpt);
|
|
224
225
|
if (experiments.isEnabled("secretEnvParams") &&
|
|
@@ -276,6 +277,7 @@ async function prepare(context, options, payload) {
|
|
|
276
277
|
context.codebaseDeployEvents[codebase].runtime = wantBuild.runtime;
|
|
277
278
|
}
|
|
278
279
|
validate.endpointsAreUnique(wantBackends);
|
|
280
|
+
validate.noGenerationDowngrades(wantBackends, existingBackend);
|
|
279
281
|
context.sources = {};
|
|
280
282
|
for (const [codebase, wantBackend] of Object.entries(wantBackends)) {
|
|
281
283
|
const cfg = (0, projectConfig_1.configForCodebase)(context.config, codebase);
|
|
@@ -358,7 +360,7 @@ async function prepare(context, options, payload) {
|
|
|
358
360
|
validate.checkFiltersIntegrity(wantBackends, context.filters);
|
|
359
361
|
(0, applyHash_1.applyBackendHashToBackends)(wantBackends, context);
|
|
360
362
|
}
|
|
361
|
-
async function resolveDefaultRegionsForBuild(buildObj, have) {
|
|
363
|
+
async function resolveDefaultRegionsForBuild(buildObj, have, paramValues = {}) {
|
|
362
364
|
for (const [id, endpoint] of Object.entries(buildObj.endpoints)) {
|
|
363
365
|
if (!endpoint.region?.length || endpoint.region.includes(build.REGION_TBD)) {
|
|
364
366
|
let resolvedRegion = services_1.FALLBACK_DEPLOYMENT_REGION;
|
|
@@ -376,7 +378,7 @@ async function resolveDefaultRegionsForBuild(buildObj, have) {
|
|
|
376
378
|
}
|
|
377
379
|
else {
|
|
378
380
|
try {
|
|
379
|
-
resolvedRegion = await resolveRegionForTrigger(endpoint);
|
|
381
|
+
resolvedRegion = await resolveRegionForTrigger(endpoint, paramValues);
|
|
380
382
|
}
|
|
381
383
|
catch (err) {
|
|
382
384
|
logger_1.logger.debug(`Failed to resolve region for endpoint ${id}. Defaulting to ${services_1.FALLBACK_DEPLOYMENT_REGION}.`, (0, error_1.getErrStack)(err));
|
|
@@ -386,9 +388,24 @@ async function resolveDefaultRegionsForBuild(buildObj, have) {
|
|
|
386
388
|
}
|
|
387
389
|
}
|
|
388
390
|
}
|
|
389
|
-
async function resolveRegionForTrigger(endpoint) {
|
|
390
|
-
|
|
391
|
-
|
|
391
|
+
async function resolveRegionForTrigger(endpoint, paramValues = {}) {
|
|
392
|
+
let targetEndpoint = endpoint;
|
|
393
|
+
if (Object.keys(paramValues).length > 0 && build.isEventTriggered(endpoint)) {
|
|
394
|
+
targetEndpoint = {
|
|
395
|
+
...endpoint,
|
|
396
|
+
eventTrigger: {
|
|
397
|
+
...endpoint.eventTrigger,
|
|
398
|
+
...(endpoint.eventTrigger.eventFilters && {
|
|
399
|
+
eventFilters: (0, functional_1.mapObject)(endpoint.eventTrigger.eventFilters, (v) => params.resolveString(v, paramValues)),
|
|
400
|
+
}),
|
|
401
|
+
...(endpoint.eventTrigger.eventFilterPathPatterns && {
|
|
402
|
+
eventFilterPathPatterns: (0, functional_1.mapObject)(endpoint.eventTrigger.eventFilterPathPatterns, (v) => params.resolveString(v, paramValues)),
|
|
403
|
+
}),
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
const service = (0, services_1.serviceForEndpoint)(targetEndpoint);
|
|
408
|
+
return await service.getDefaultRegion(targetEndpoint);
|
|
392
409
|
}
|
|
393
410
|
function inferDetailsFromExisting(want, have, usedDotenv) {
|
|
394
411
|
for (const wantE of backend.allEndpoints(want)) {
|
|
@@ -871,12 +871,8 @@ class Fabricator {
|
|
|
871
871
|
.catch(rethrowAsUnlessNotFound(endpoint, "delete schedule"));
|
|
872
872
|
}
|
|
873
873
|
async disableTaskQueue(endpoint) {
|
|
874
|
-
const update = {
|
|
875
|
-
name: cloudtasks.queueNameForEndpoint(endpoint),
|
|
876
|
-
state: "DISABLED",
|
|
877
|
-
};
|
|
878
874
|
await this.executor
|
|
879
|
-
.run(() => cloudtasks.
|
|
875
|
+
.run(() => cloudtasks.disableQueue(cloudtasks.queueNameForEndpoint(endpoint)))
|
|
880
876
|
.catch(rethrowAs(endpoint, "disable task queue"));
|
|
881
877
|
}
|
|
882
878
|
async unregisterBlockingTrigger(endpoint) {
|
|
@@ -250,8 +250,9 @@ function checkForIllegalUpdate(want, have) {
|
|
|
250
250
|
if (wantType !== haveType && !upgradingHttpsFunction) {
|
|
251
251
|
throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_1.getFunctionLabel)(want)}] Changing from ${haveType} function to ${wantType} function is not allowed. Please delete your function and create a new one instead.`);
|
|
252
252
|
}
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
const downgrade = (0, functionsDeployHelper_1.generationDowngradeMessage)(want, have);
|
|
254
|
+
if (downgrade) {
|
|
255
|
+
throw new error_1.FirebaseError(downgrade);
|
|
255
256
|
}
|
|
256
257
|
exports.checkForV2Upgrade(want, have);
|
|
257
258
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MAX_V2_SCHEDULE_ATTEMPT_DEADLINE_SECONDS = exports.DEFAULT_V2_SCHEDULE_ATTEMPT_DEADLINE_SECONDS = void 0;
|
|
4
4
|
exports.endpointsAreValid = endpointsAreValid;
|
|
5
|
+
exports.noGenerationDowngrades = noGenerationDowngrades;
|
|
5
6
|
exports.cpuConfigIsValid = cpuConfigIsValid;
|
|
6
7
|
exports.validateTimeoutConfig = validateTimeoutConfig;
|
|
7
8
|
exports.endpointsAreUnique = endpointsAreUnique;
|
|
@@ -85,6 +86,21 @@ function endpointsAreValid(wantBackend, existingBackend) {
|
|
|
85
86
|
}
|
|
86
87
|
cpuConfigIsValid(endpoints);
|
|
87
88
|
}
|
|
89
|
+
function noGenerationDowngrades(wantBackends, existingBackend) {
|
|
90
|
+
const msgs = [];
|
|
91
|
+
for (const wantBackend of Object.values(wantBackends)) {
|
|
92
|
+
for (const want of backend.allEndpoints(wantBackend).sort(backend.compareFunctions)) {
|
|
93
|
+
const have = existingBackend.endpoints[want.region]?.[want.id];
|
|
94
|
+
const msg = have && (0, functionsDeployHelper_1.generationDowngradeMessage)(want, have);
|
|
95
|
+
if (msg) {
|
|
96
|
+
msgs.push(msg);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (msgs.length) {
|
|
101
|
+
throw new error_1.FirebaseError(msgs.join("\n"));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
88
104
|
function cpuConfigIsValid(endpoints) {
|
|
89
105
|
const gcfV1WithCPU = matchingIds(endpoints, (endpoint) => endpoint.platform === "gcfv1" && typeof endpoint["cpu"] !== "undefined");
|
|
90
106
|
if (gcfV1WithCPU.length) {
|
|
@@ -105,7 +105,7 @@ async function prepare(context, options) {
|
|
|
105
105
|
(0, track_1.trackGA4)("hosting_version", {
|
|
106
106
|
framework: config.webFramework || "classic",
|
|
107
107
|
}),
|
|
108
|
-
api.createVersion(config.site, version),
|
|
108
|
+
api.createVersion(context.projectId, config.site, version),
|
|
109
109
|
]);
|
|
110
110
|
return versionName;
|
|
111
111
|
}));
|
|
@@ -21,7 +21,7 @@ async function release(context, options, functionsPayload) {
|
|
|
21
21
|
config: await (0, convertConfig_1.convertConfig)(context, functionsPayload, deploy),
|
|
22
22
|
};
|
|
23
23
|
const versionId = utils.last(deploy.version.split("/"));
|
|
24
|
-
const finalizedVersion = await api.updateVersion(deploy.config.site, versionId, update);
|
|
24
|
+
const finalizedVersion = await api.updateVersion(context.projectId, deploy.config.site, versionId, update);
|
|
25
25
|
logger_1.logger.debug(`[hosting] finalized version for ${deploy.config.site}:${finalizedVersion}`);
|
|
26
26
|
utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "version finalized");
|
|
27
27
|
utils.logLabeledBullet(`hosting[${deploy.config.site}]`, "releasing new version...");
|
|
@@ -32,7 +32,7 @@ async function release(context, options, functionsPayload) {
|
|
|
32
32
|
if (options.message) {
|
|
33
33
|
otherReleaseOpts.message = options.message;
|
|
34
34
|
}
|
|
35
|
-
const release = await api.createRelease(deploy.config.site, context.hostingChannel || "live", deploy.version, otherReleaseOpts);
|
|
35
|
+
const release = await api.createRelease(context.projectId, deploy.config.site, context.hostingChannel || "live", deploy.version, otherReleaseOpts);
|
|
36
36
|
logger_1.logger.debug("[hosting] release:", release);
|
|
37
37
|
utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "release complete");
|
|
38
38
|
}));
|
|
@@ -660,7 +660,7 @@ function sendOobCode(state, reqBody, ctx) {
|
|
|
660
660
|
(0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
|
|
661
661
|
email = (0, utils_1.canonicalizeEmailAddress)(reqBody.email);
|
|
662
662
|
break;
|
|
663
|
-
case "PASSWORD_RESET":
|
|
663
|
+
case "PASSWORD_RESET": {
|
|
664
664
|
mode = "resetPassword";
|
|
665
665
|
(0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
|
|
666
666
|
email = (0, utils_1.canonicalizeEmailAddress)(reqBody.email);
|
|
@@ -673,6 +673,7 @@ function sendOobCode(state, reqBody, ctx) {
|
|
|
673
673
|
}
|
|
674
674
|
(0, errors_1.assert)(maybeUser, "EMAIL_NOT_FOUND");
|
|
675
675
|
break;
|
|
676
|
+
}
|
|
676
677
|
case "VERIFY_EMAIL":
|
|
677
678
|
mode = "verifyEmail";
|
|
678
679
|
if (reqBody.returnOobLink && !reqBody.idToken) {
|
|
@@ -798,7 +799,7 @@ function setAccountInfoImpl(state, reqBody, { privileged = false, emulatorUrl =
|
|
|
798
799
|
}
|
|
799
800
|
break;
|
|
800
801
|
}
|
|
801
|
-
case "VERIFY_AND_CHANGE_EMAIL":
|
|
802
|
+
case "VERIFY_AND_CHANGE_EMAIL": {
|
|
802
803
|
state.deleteOobCode(reqBody.oobCode);
|
|
803
804
|
const maybeUser = state.getUserByEmail(oob.email);
|
|
804
805
|
(0, errors_1.assert)(maybeUser, "INVALID_OOB_CODE");
|
|
@@ -811,6 +812,7 @@ function setAccountInfoImpl(state, reqBody, { privileged = false, emulatorUrl =
|
|
|
811
812
|
newEmail = oob.newEmail;
|
|
812
813
|
}
|
|
813
814
|
break;
|
|
815
|
+
}
|
|
814
816
|
case "RECOVER_EMAIL": {
|
|
815
817
|
state.deleteOobCode(reqBody.oobCode);
|
|
816
818
|
const maybeUser = state.getUserByInitialEmail(oob.email);
|
|
@@ -1954,12 +1956,13 @@ function fakeFetchUserInfoFromIdp(providerId, claims, samlResponse) {
|
|
|
1954
1956
|
});
|
|
1955
1957
|
break;
|
|
1956
1958
|
}
|
|
1957
|
-
case /^saml\./.exec(providerId)?.input:
|
|
1959
|
+
case /^saml\./.exec(providerId)?.input: {
|
|
1958
1960
|
const nameId = samlResponse?.assertion?.subject?.nameId;
|
|
1959
1961
|
response.email = nameId && (0, utils_1.isValidEmailAddress)(nameId) ? nameId : response.email;
|
|
1960
1962
|
response.emailVerified = true;
|
|
1961
1963
|
response.rawUserInfo = JSON.stringify(samlResponse?.assertion?.attributeStatements);
|
|
1962
1964
|
break;
|
|
1965
|
+
}
|
|
1963
1966
|
case /^oidc\./.exec(providerId)?.input:
|
|
1964
1967
|
default:
|
|
1965
1968
|
response.rawUserInfo = JSON.stringify(claims);
|
|
@@ -2256,11 +2259,12 @@ function processBlockingFunctionResponse(event, response) {
|
|
|
2256
2259
|
case "emailVerified":
|
|
2257
2260
|
updates[field] = !!userRecord[field];
|
|
2258
2261
|
break;
|
|
2259
|
-
case "customClaims":
|
|
2262
|
+
case "customClaims": {
|
|
2260
2263
|
const customClaims = JSON.stringify(userRecord.customClaims);
|
|
2261
2264
|
validateSerializedCustomClaims(customClaims);
|
|
2262
2265
|
updates.customAttributes = customClaims;
|
|
2263
2266
|
break;
|
|
2267
|
+
}
|
|
2264
2268
|
case "sessionClaims":
|
|
2265
2269
|
if (event !== state_1.BlockingFunctionEvents.BEFORE_SIGN_IN) {
|
|
2266
2270
|
break;
|
|
@@ -17,6 +17,7 @@ class DatabaseEmulator {
|
|
|
17
17
|
constructor(args) {
|
|
18
18
|
this.args = args;
|
|
19
19
|
this.importedNamespaces = [];
|
|
20
|
+
this.rulesWatchers = [];
|
|
20
21
|
this.logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.DATABASE);
|
|
21
22
|
}
|
|
22
23
|
async start() {
|
|
@@ -32,8 +33,9 @@ class DatabaseEmulator {
|
|
|
32
33
|
this.logger.logLabeled("WARN_ONCE", "database", "Could not determine your Realtime Database instance name, so rules hot reloading is disabled.");
|
|
33
34
|
continue;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
this.
|
|
36
|
+
const watcher = chokidar.watch(c.rules, { persistent: true, ignoreInitial: true });
|
|
37
|
+
this.rulesWatchers.push(watcher);
|
|
38
|
+
watcher.on("change", async () => {
|
|
37
39
|
await new Promise((res) => setTimeout(res, 5));
|
|
38
40
|
this.logger.logLabeled("BULLET", "database", `Change detected, updating rules for ${c.instance}...`);
|
|
39
41
|
try {
|
|
@@ -67,7 +69,9 @@ class DatabaseEmulator {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
|
-
stop() {
|
|
72
|
+
async stop() {
|
|
73
|
+
await Promise.allSettled(this.rulesWatchers.map((w) => w.close()));
|
|
74
|
+
this.rulesWatchers = [];
|
|
71
75
|
return downloadableEmulators.stop(types_1.Emulators.DATABASE);
|
|
72
76
|
}
|
|
73
77
|
getInfo() {
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "3.4.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
57
|
+
"version": "3.4.22",
|
|
58
|
+
"expectedSize": 33825952,
|
|
59
|
+
"expectedChecksum": "525d67a835615fae6dd2f0a2bfd4611c",
|
|
60
|
+
"expectedChecksumSHA256": "cb4e770c275e4b1202ecc5a05e5897636998ed7410f22c3fc594f4c17b0456b3",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.22",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.4.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
65
|
+
"version": "3.4.22",
|
|
66
|
+
"expectedSize": 31935234,
|
|
67
|
+
"expectedChecksum": "f329037c0651536096e7233ead853857",
|
|
68
|
+
"expectedChecksumSHA256": "df4e0db2970d64e1176dda4875ca38ec4c20cc189bc80a758f462b638addda9c",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.22",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.4.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
73
|
+
"version": "3.4.22",
|
|
74
|
+
"expectedSize": 33855488,
|
|
75
|
+
"expectedChecksum": "7cdc7e6b54e22b61b2b6426df10bdd02",
|
|
76
|
+
"expectedChecksumSHA256": "05454f691c6b2259d2b838e715952105e89dd73184f5eac7dbfe131804f2dc26",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.22",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.4.
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
81
|
+
"version": "3.4.22",
|
|
82
|
+
"expectedSize": 32948408,
|
|
83
|
+
"expectedChecksum": "7ba899a01fc2819c3235b57c1badaf6e",
|
|
84
|
+
"expectedChecksumSHA256": "2a6eb1ccb8b5419cf22f3fdf87d94b6caf1c6c573115fdcd9baa7ea78274c024",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.22",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -181,7 +181,7 @@ You can probably fix this by running "npm install ${systemLog.data.name}@latest"
|
|
|
181
181
|
case "missing-package-json":
|
|
182
182
|
this.log("WARN", `The Cloud Functions directory you specified does not have a "package.json" file, so we can't load it.`);
|
|
183
183
|
break;
|
|
184
|
-
case "function-code-resolution-failed":
|
|
184
|
+
case "function-code-resolution-failed": {
|
|
185
185
|
this.log("WARN", systemLog.data.error);
|
|
186
186
|
const helper = ["We were unable to load your functions code. (see above)"];
|
|
187
187
|
if (systemLog.data.isPotentially.wrong_directory) {
|
|
@@ -195,6 +195,7 @@ You can probably fix this by running "npm install ${systemLog.data.name}@latest"
|
|
|
195
195
|
}
|
|
196
196
|
utils.logWarning(helper.join("\n"), "warn", this.data);
|
|
197
197
|
break;
|
|
198
|
+
}
|
|
198
199
|
case "function-runtimeconfig-json-invalid":
|
|
199
200
|
this.log("WARN", "Found .runtimeconfig.json but the JSON format is invalid.");
|
|
200
201
|
break;
|
|
@@ -575,7 +575,7 @@ async function main() {
|
|
|
575
575
|
}
|
|
576
576
|
switch (FUNCTION_SIGNATURE) {
|
|
577
577
|
case "event":
|
|
578
|
-
case "cloudevent":
|
|
578
|
+
case "cloudevent": {
|
|
579
579
|
let reqBody;
|
|
580
580
|
const rawBody = req.rawBody;
|
|
581
581
|
if (types_2.EventUtils.isBinaryCloudEvent(req)) {
|
|
@@ -588,6 +588,7 @@ async function main() {
|
|
|
588
588
|
await processBackground(trigger, reqBody, FUNCTION_SIGNATURE);
|
|
589
589
|
res.send({ status: "acknowledged" });
|
|
590
590
|
break;
|
|
591
|
+
}
|
|
591
592
|
case "http":
|
|
592
593
|
await runHTTPS(trigger, [req, res]);
|
|
593
594
|
}
|
package/lib/experiments.js
CHANGED
|
@@ -81,8 +81,8 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
81
81
|
kits: {
|
|
82
82
|
shortDescription: "Enable Functions Kits.",
|
|
83
83
|
fullDescription: "Adds support for Function Kits.",
|
|
84
|
-
public:
|
|
85
|
-
default:
|
|
84
|
+
public: true,
|
|
85
|
+
default: true,
|
|
86
86
|
},
|
|
87
87
|
emulatoruisnapshot: {
|
|
88
88
|
shortDescription: "Load pre-release versions of the emulator UI",
|
|
@@ -150,6 +150,13 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
150
150
|
default: true,
|
|
151
151
|
public: true,
|
|
152
152
|
},
|
|
153
|
+
directcloudrun: {
|
|
154
|
+
shortDescription: "Build and deploy web apps directly to Cloud Run services",
|
|
155
|
+
fullDescription: "Enables `firebase init run`, `firebase deploy --only run`, and the " +
|
|
156
|
+
"`firebase run:services:update` command. " +
|
|
157
|
+
"These are in preview and may change.",
|
|
158
|
+
public: false,
|
|
159
|
+
},
|
|
153
160
|
dataconnect: {
|
|
154
161
|
shortDescription: "Deprecated. Previosuly, enabled SQL Connect related features.",
|
|
155
162
|
fullDescription: "Deprecated. Previously, enabled SQL Connect related features.",
|
|
@@ -206,11 +213,21 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
206
213
|
default: false,
|
|
207
214
|
public: true,
|
|
208
215
|
},
|
|
209
|
-
|
|
210
|
-
shortDescription: "Enable
|
|
216
|
+
crashlyticsWebAlerts: {
|
|
217
|
+
shortDescription: "Enable configuring Crashlytics email alerts during web app onboarding.",
|
|
218
|
+
default: false,
|
|
219
|
+
public: false,
|
|
220
|
+
},
|
|
221
|
+
crashlyticsWebTrace: {
|
|
222
|
+
shortDescription: "Enable provisioning Cloud Trace storage during web app onboarding.",
|
|
211
223
|
default: false,
|
|
212
224
|
public: false,
|
|
213
225
|
},
|
|
226
|
+
secretEnvParams: {
|
|
227
|
+
shortDescription: "Enable reading the backing resource binding for a Functions secret param from .env",
|
|
228
|
+
default: true,
|
|
229
|
+
public: true,
|
|
230
|
+
},
|
|
214
231
|
extdeprecationwarnings: {
|
|
215
232
|
shortDescription: "Show deprecation warnings for Firebase Extensions CLI commands.",
|
|
216
233
|
default: true,
|
|
@@ -218,8 +235,8 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
218
235
|
},
|
|
219
236
|
extMigrationFeatures: {
|
|
220
237
|
shortDescription: "Enable features intended to assist with the migration of Extension instances to Kits.",
|
|
221
|
-
default:
|
|
222
|
-
public:
|
|
238
|
+
default: true,
|
|
239
|
+
public: true,
|
|
223
240
|
},
|
|
224
241
|
fdcapimigration: {
|
|
225
242
|
shortDescription: "Enable the FDC API schema migration path.",
|
|
@@ -12,6 +12,9 @@ const planner_1 = require("../deploy/extensions/planner");
|
|
|
12
12
|
const error_1 = require("../error");
|
|
13
13
|
const logger_1 = require("../logger");
|
|
14
14
|
const utils = require("../utils");
|
|
15
|
+
const replacementRegistry_1 = require("./replacementRegistry");
|
|
16
|
+
const manifest = require("./manifest");
|
|
17
|
+
const refs = require("./refs");
|
|
15
18
|
const toListEntry = (i) => {
|
|
16
19
|
const idAndRef = (0, deploymentSummary_1.humanReadable)(i);
|
|
17
20
|
const sourceCodeLink = `\n\t[Source Code](${i.extensionVersion?.buildSourceUri ?? i.extensionVersion?.sourceDownloadUri})`;
|
|
@@ -43,6 +46,7 @@ function outOfBandChangesWarning(instanceIds, isDynamic) {
|
|
|
43
46
|
`\nIf you proceed with this deployment, those changes will be overwritten.${extra}`);
|
|
44
47
|
}
|
|
45
48
|
const FAQ_URL = "https://firebase.google.com/docs/extensions/faq-and-troubleshooting";
|
|
49
|
+
const BANNER_BORDER = "=".repeat(80);
|
|
46
50
|
const WARN_BEFORE_COMMANDS = new Set([
|
|
47
51
|
"ext:install",
|
|
48
52
|
"ext:configure",
|
|
@@ -56,7 +60,7 @@ const WARN_STRONGLY_BEFORE_COMMANDS = new Set([
|
|
|
56
60
|
"ext:dev:usage",
|
|
57
61
|
"ext:dev:undeprecate",
|
|
58
62
|
]);
|
|
59
|
-
const WARN_AFTER_COMMANDS = new Set(["ext:list", "ext:info"]);
|
|
63
|
+
const WARN_AFTER_COMMANDS = new Set(["ext:list", "ext:info", "ext:export"]);
|
|
60
64
|
function isSilenced(options) {
|
|
61
65
|
const opts = options;
|
|
62
66
|
if (opts?.json ||
|
|
@@ -77,7 +81,23 @@ function isSilenced(options) {
|
|
|
77
81
|
}
|
|
78
82
|
return false;
|
|
79
83
|
}
|
|
80
|
-
function
|
|
84
|
+
function resolveExtensionRef(commandName, options, args = []) {
|
|
85
|
+
const firstArg = typeof args[0] === "string" ? args[0] : undefined;
|
|
86
|
+
if (!firstArg || (0, extensionsHelper_1.isLocalPath)(firstArg)) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const ref = commandName === "ext:configure" || commandName === "ext:update"
|
|
91
|
+
? manifest.getInstanceRef(firstArg, manifest.loadConfig(options))
|
|
92
|
+
: refs.parse(firstArg);
|
|
93
|
+
return refs.toExtensionRef(ref);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
logger_1.logger.debug(`Could not resolve extension ref for deprecation warning: ${String(err)}`);
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function showDeprecationWarningBefore(commandName, options, args = []) {
|
|
81
101
|
if (commandName === "ext:dev:register") {
|
|
82
102
|
throw new error_1.FirebaseError(`ext:dev:register is disabled. Registering new publisher profile IDs is no longer supported.\n` +
|
|
83
103
|
`The Firebase Extensions service will shut down on March 31, 2027.\n` +
|
|
@@ -87,18 +107,39 @@ function showDeprecationWarningBefore(commandName, options) {
|
|
|
87
107
|
return;
|
|
88
108
|
}
|
|
89
109
|
if (WARN_BEFORE_COMMANDS.has(commandName)) {
|
|
90
|
-
|
|
110
|
+
let actionLine = "We recommend migrating active instances to function kits.";
|
|
111
|
+
const ref = resolveExtensionRef(commandName, options, args);
|
|
112
|
+
if (ref) {
|
|
113
|
+
try {
|
|
114
|
+
const registry = await (0, replacementRegistry_1.getReplacementsRegistry)();
|
|
115
|
+
const npmPackage = (0, replacementRegistry_1.getReplacementPackageName)(ref, registry);
|
|
116
|
+
if (npmPackage) {
|
|
117
|
+
actionLine = `Recommended replacement: ${npmPackage}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
logger_1.logger.debug(`Failed to resolve replacement info for warning: ${String(err)}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
logger_1.logger.warn(clc.yellow(`${BANNER_BORDER}\n` +
|
|
125
|
+
`⚠ Firebase Extensions will shut down on March 31, 2027.\n` +
|
|
126
|
+
`${actionLine}\n` +
|
|
127
|
+
`Learn more & view migration steps: ${FAQ_URL}\n` +
|
|
128
|
+
`${BANNER_BORDER}`));
|
|
91
129
|
}
|
|
92
130
|
else if (WARN_STRONGLY_BEFORE_COMMANDS.has(commandName)) {
|
|
93
|
-
logger_1.logger.warn(clc.yellow(
|
|
131
|
+
logger_1.logger.warn(clc.yellow(`${BANNER_BORDER}\n` +
|
|
94
132
|
`⚠ Notice for Publishers: Firebase Extensions will shut down on March 31, 2027.\n` +
|
|
95
|
-
`Learn more: ${FAQ_URL}\n` +
|
|
96
|
-
|
|
133
|
+
`Learn more & view migration steps: ${FAQ_URL}\n` +
|
|
134
|
+
`${BANNER_BORDER}`));
|
|
97
135
|
}
|
|
98
136
|
}
|
|
99
137
|
function showDeprecationWarningAfter(commandName, options) {
|
|
100
138
|
if (isSilenced(options) || !WARN_AFTER_COMMANDS.has(commandName)) {
|
|
101
139
|
return;
|
|
102
140
|
}
|
|
103
|
-
|
|
141
|
+
if (commandName === "ext:export" && options.mode === "functions") {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
logger_1.logger.warn(clc.yellow(`⚠ Notice: Firebase Extensions will shut down on March 31, 2027. Learn more & view migration steps: ${FAQ_URL}`));
|
|
104
145
|
}
|
|
@@ -23,34 +23,42 @@ const WEBPACK_LAYERS_NAMES = {
|
|
|
23
23
|
reactServerComponents: "rsc",
|
|
24
24
|
serverSideRendering: "ssr",
|
|
25
25
|
actionBrowser: "action-browser",
|
|
26
|
-
|
|
26
|
+
apiNode: "api-node",
|
|
27
|
+
apiEdge: "api-edge",
|
|
27
28
|
middleware: "middleware",
|
|
29
|
+
instrument: "instrument",
|
|
28
30
|
edgeAsset: "edge-asset",
|
|
29
31
|
appPagesBrowser: "app-pages-browser",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
pagesDirBrowser: "pages-dir-browser",
|
|
33
|
+
pagesDirEdge: "pages-dir-edge",
|
|
34
|
+
pagesDirNode: "pages-dir-node",
|
|
32
35
|
};
|
|
33
36
|
exports.WEBPACK_LAYERS = {
|
|
34
37
|
...WEBPACK_LAYERS_NAMES,
|
|
35
38
|
GROUP: {
|
|
36
|
-
|
|
39
|
+
builtinReact: [WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser],
|
|
40
|
+
serverOnly: [
|
|
37
41
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
38
42
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
39
|
-
WEBPACK_LAYERS_NAMES.
|
|
40
|
-
WEBPACK_LAYERS_NAMES.appRouteHandler,
|
|
41
|
-
],
|
|
42
|
-
nonClientServerTarget: [
|
|
43
|
+
WEBPACK_LAYERS_NAMES.instrument,
|
|
43
44
|
WEBPACK_LAYERS_NAMES.middleware,
|
|
44
|
-
WEBPACK_LAYERS_NAMES.api,
|
|
45
45
|
],
|
|
46
|
-
|
|
46
|
+
neutralTarget: [WEBPACK_LAYERS_NAMES.apiNode, WEBPACK_LAYERS_NAMES.apiEdge],
|
|
47
|
+
clientOnly: [WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser],
|
|
48
|
+
bundled: [
|
|
47
49
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
48
50
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
49
|
-
WEBPACK_LAYERS_NAMES.appMetadataRoute,
|
|
50
|
-
WEBPACK_LAYERS_NAMES.appRouteHandler,
|
|
51
51
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
52
52
|
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
53
53
|
WEBPACK_LAYERS_NAMES.shared,
|
|
54
|
+
WEBPACK_LAYERS_NAMES.instrument,
|
|
55
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
56
|
+
],
|
|
57
|
+
appPages: [
|
|
58
|
+
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
59
|
+
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
60
|
+
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
61
|
+
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
54
62
|
],
|
|
55
63
|
},
|
|
56
64
|
};
|