firebase-tools 15.35.0 → 15.36.1-main.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 +7 -6
- package/lib/apiv2.js +0 -1
- package/lib/appcheck/debugTokens.js +293 -0
- package/lib/appcheck/localConfig.js +191 -0
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/apphosting/githubConnections.js +1 -1
- package/lib/apptesting/parseTestFiles.js +1 -1
- package/lib/auth.js +9 -3
- package/lib/bin/progressiveHelp.js +1 -1
- package/lib/command.js +1 -2
- package/lib/commands/appcheck-debugtokens-create.js +60 -35
- package/lib/commands/appcheck-debugtokens-delete.js +21 -7
- package/lib/commands/appcheck-debugtokens-list.js +37 -8
- package/lib/commands/appcheck-debugtokens-prune.js +59 -0
- package/lib/commands/crashlytics-events-get.js +48 -0
- package/lib/commands/crashlytics-events-list.js +70 -0
- package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
- package/lib/commands/crashlytics-heapdumps-status.js +5 -3
- package/lib/commands/crashlytics-issues-get.js +61 -0
- package/lib/commands/crashlytics-reports-get.js +179 -0
- package/lib/commands/crashlytics-reports-list.js +42 -0
- package/lib/commands/deploy.js +1 -3
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/hosting-channel-create.js +1 -3
- package/lib/commands/hosting-channel-delete.js +1 -3
- package/lib/commands/hosting-channel-deploy.js +1 -3
- package/lib/commands/hosting-channel-list.js +1 -3
- package/lib/commands/hosting-channel-open.js +5 -4
- package/lib/commands/hosting-clone.js +3 -5
- package/lib/commands/hosting-disable.js +2 -2
- package/lib/commands/hosting-sites-create.js +1 -3
- package/lib/commands/hosting-sites-delete.js +1 -3
- package/lib/commands/hosting-sites-get.js +1 -3
- package/lib/commands/hosting-sites-list.js +1 -3
- package/lib/commands/index.js +11 -0
- package/lib/commands/open.js +3 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/use.js +1 -1
- package/lib/config.js +1 -1
- package/lib/crashlytics/commandUtils.js +194 -0
- package/lib/crashlytics/events.js +122 -1
- package/lib/crashlytics/filters.js +12 -6
- package/lib/crashlytics/profilingManager.js +77 -50
- package/lib/crashlytics/reports.js +5 -1
- package/lib/crashlytics/utils.js +14 -0
- package/lib/database/import.js +5 -4
- package/lib/dataconnect/names.js +3 -3
- package/lib/dataconnect/schemaMigration.js +1 -1
- package/lib/deploy/firestore/prepare.js +21 -3
- package/lib/deploy/functions/backend.js +0 -10
- package/lib/deploy/functions/cel.js +2 -2
- package/lib/deploy/functions/deploy.js +2 -1
- package/lib/deploy/functions/release/fabricator.js +9 -2
- package/lib/deploy/functions/release/planner.js +3 -0
- package/lib/deploy/functions/release/reporter.js +0 -26
- package/lib/deploy/functions/runtimes/discovery/index.js +4 -1
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +1 -1
- package/lib/deploy/functions/services/index.js +13 -11
- package/lib/deploy/hosting/prepare.js +1 -3
- package/lib/deploy/lifecycleHooks.js +1 -1
- package/lib/emulator/auth/operations.js +2 -2
- package/lib/emulator/auth/server.js +4 -2
- package/lib/emulator/auth/widget_ui.js +1 -1
- package/lib/emulator/commandUtils.js +4 -1
- package/lib/emulator/databaseEmulator.js +16 -11
- package/lib/emulator/dataconnect/pgliteServer.js +30 -24
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/downloadableEmulators.js +2 -2
- package/lib/emulator/extensions/postinstall.js +6 -6
- package/lib/emulator/firestoreEmulator.js +21 -15
- package/lib/emulator/functionsEmulator.js +11 -7
- package/lib/emulator/functionsEmulatorRuntime.js +9 -4
- package/lib/emulator/hub.js +12 -8
- package/lib/emulator/shared/express.js +30 -0
- package/lib/emulator/storage/apis/firebase.js +11 -10
- package/lib/emulator/storage/apis/gcloud.js +21 -20
- package/lib/emulator/storage/files.js +1 -1
- package/lib/emulator/storage/rules/manager.js +15 -12
- package/lib/emulator/storage/server.js +10 -5
- package/lib/experiments.js +5 -0
- package/lib/extensions/extensionsHelper.js +2 -2
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/paramHelper.js +1 -1
- package/lib/extensions/provisioningHelper.js +1 -6
- package/lib/firestore/delete.js +2 -3
- package/lib/firestore/util.js +3 -3
- package/lib/frameworks/angular/utils.js +1 -1
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +25 -3
- package/lib/frameworks/next/utils.js +7 -9
- package/lib/functions/kits/install.js +221 -316
- package/lib/functions/kits/sources/directory.js +32 -0
- package/lib/functions/kits/sources/npm.js +55 -5
- package/lib/functionsConfig.js +0 -4
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/cloudbilling.js +2 -2
- package/lib/gcp/cloudbuild.js +0 -77
- package/lib/gcp/cloudfunctionsv2.js +0 -6
- package/lib/gcp/cloudtasks.js +0 -4
- package/lib/gcp/devConnect.js +2 -8
- package/lib/gcp/iam.js +15 -1
- package/lib/gcp/resourceManager.js +1 -14
- package/lib/gcp/storage.js +87 -4
- package/lib/hosting/api.js +79 -7
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +5 -2
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/index.js +2 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -1
- package/lib/init/features/hosting/github.js +6 -4
- package/lib/init/features/hosting/index.js +4 -0
- package/lib/init/features/storage/rules.js +1 -1
- package/lib/localFunction.js +3 -3
- package/lib/management/database.js +1 -1
- package/lib/mcp/apps/init/mcp-app.js +5 -2
- package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
- package/lib/mcp/index.js +14 -4
- package/lib/mcp/prompts/apptesting/run_test.js +3 -3
- package/lib/mcp/prompts/core/deploy.js +3 -3
- package/lib/mcp/resources/guides/init_ai.js +10 -10
- package/lib/mcp/tools/crashlytics/events.js +18 -93
- package/lib/mcp/tools/crashlytics/index.js +2 -0
- package/lib/mcp/tools/crashlytics/reports.js +3 -3
- package/lib/mcp/tools/crashlytics/setup.js +392 -0
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +5 -11
- package/package.json +4 -4
- package/lib/functions/kits/sources/index.js +0 -19
package/lib/crashlytics/utils.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PLATFORM_PATH = exports.CRASHLYTICS_API_CLIENT = exports.TIMEOUT = void 0;
|
|
4
4
|
exports.parseProjectNumber = parseProjectNumber;
|
|
5
|
+
exports.parseAppPlatform = parseAppPlatform;
|
|
5
6
|
exports.parsePlatform = parsePlatform;
|
|
6
7
|
const error_1 = require("../error");
|
|
7
8
|
const apiv2_1 = require("../apiv2");
|
|
8
9
|
const api_1 = require("../api");
|
|
10
|
+
const apps_1 = require("../management/apps");
|
|
9
11
|
exports.TIMEOUT = 10000;
|
|
10
12
|
exports.CRASHLYTICS_API_CLIENT = new apiv2_1.Client({
|
|
11
13
|
urlPrefix: (0, api_1.crashlyticsApiOrigin)(),
|
|
@@ -23,6 +25,18 @@ function parseProjectNumber(appId) {
|
|
|
23
25
|
}
|
|
24
26
|
throw new error_1.FirebaseError("Unable to get the projectId from the AppId.");
|
|
25
27
|
}
|
|
28
|
+
function parseAppPlatform(appId) {
|
|
29
|
+
const platformSegment = appId?.split(":")[2];
|
|
30
|
+
if (!platformSegment) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return (0, apps_1.getAppPlatform)(platformSegment);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
function parsePlatform(appId) {
|
|
27
41
|
const appIdParts = appId.split(":");
|
|
28
42
|
if (appIdParts.length < 3) {
|
package/lib/database/import.js
CHANGED
|
@@ -124,10 +124,11 @@ class DatabaseImporter {
|
|
|
124
124
|
done();
|
|
125
125
|
};
|
|
126
126
|
const writeBatch = new stream.Transform({ objectMode: true });
|
|
127
|
-
writeBatch._transform =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
writeBatch._transform = function (batch, _, done) {
|
|
128
|
+
void doWriteBatch(batch).then((res) => {
|
|
129
|
+
this.push(res);
|
|
130
|
+
done();
|
|
131
|
+
}, (err) => done(err));
|
|
131
132
|
};
|
|
132
133
|
return new Promise((resolve, reject) => {
|
|
133
134
|
const responses = [];
|
package/lib/dataconnect/names.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.parseConnectorName = parseConnectorName;
|
|
|
5
5
|
exports.parseCloudSQLInstanceName = parseCloudSQLInstanceName;
|
|
6
6
|
exports.isGraphqlName = isGraphqlName;
|
|
7
7
|
const error_1 = require("../error");
|
|
8
|
-
const serviceNameRegex = /projects\/(?<projectId>[
|
|
8
|
+
const serviceNameRegex = /projects\/(?<projectId>[^/]+)\/locations\/(?<location>[^/]+)\/services\/(?<serviceId>[^/]+)/;
|
|
9
9
|
function parseServiceName(serviceName) {
|
|
10
10
|
const res = serviceNameRegex.exec(serviceName);
|
|
11
11
|
const projectId = res?.groups?.projectId;
|
|
@@ -24,7 +24,7 @@ function parseServiceName(serviceName) {
|
|
|
24
24
|
toString,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
const connectorNameRegex = /projects\/(?<projectId>[
|
|
27
|
+
const connectorNameRegex = /projects\/(?<projectId>[^/]+)\/locations\/(?<location>[^/]+)\/services\/(?<serviceId>[^/]+)\/connectors\/(?<connectorId>[^/]+)/;
|
|
28
28
|
function parseConnectorName(connectorName) {
|
|
29
29
|
const res = connectorNameRegex.exec(connectorName);
|
|
30
30
|
const projectId = res?.groups?.projectId;
|
|
@@ -45,7 +45,7 @@ function parseConnectorName(connectorName) {
|
|
|
45
45
|
toString,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
const cloudSQLInstanceNameRegex = /projects\/(?<projectId>[
|
|
48
|
+
const cloudSQLInstanceNameRegex = /projects\/(?<projectId>[^/]+)\/locations\/(?<location>[^/]+)\/instances\/(?<instanceId>[^/]+)/;
|
|
49
49
|
function parseCloudSQLInstanceName(cloudSQLInstanceName) {
|
|
50
50
|
const res = cloudSQLInstanceNameRegex.exec(cloudSQLInstanceName);
|
|
51
51
|
const projectId = res?.groups?.projectId;
|
|
@@ -576,5 +576,5 @@ function diffsToString(diffs) {
|
|
|
576
576
|
return diffs.map(diffToString).join("\n\n");
|
|
577
577
|
}
|
|
578
578
|
function diffToString(diff) {
|
|
579
|
-
return
|
|
579
|
+
return `/** ${diff.destructive ? clc.red("Destructive: ") : ""}${diff.description}*/\n${(0, sql_formatter_1.format)(diff.sql, { language: "postgresql" })}`;
|
|
580
580
|
}
|
|
@@ -12,6 +12,7 @@ const api_1 = require("../../api");
|
|
|
12
12
|
const error_1 = require("../../error");
|
|
13
13
|
const types = require("../../firestore/api-types");
|
|
14
14
|
const api_2 = require("../../firestore/api");
|
|
15
|
+
const DEFAULT_FIRESTORE_LOCATION = "nam5";
|
|
15
16
|
function prepareRules(context, rulesDeploy, databaseId, rulesFile) {
|
|
16
17
|
rulesDeploy.addFile(rulesFile, databaseId);
|
|
17
18
|
context.firestore.rules.push({
|
|
@@ -73,11 +74,18 @@ async function createDatabase(context, options) {
|
|
|
73
74
|
}
|
|
74
75
|
catch (e) {
|
|
75
76
|
if (e.status === 404) {
|
|
77
|
+
const locationId = firestoreCfg.location || DEFAULT_FIRESTORE_LOCATION;
|
|
78
|
+
if (options.dryRun) {
|
|
79
|
+
utils.logLabeledWarning("firestore", `Database ${clc.bold(firestoreCfg.database)} does not exist. A deploy would create it in ` +
|
|
80
|
+
`${clc.bold(locationId)}${firestoreCfg.location ? "" : " (the default, because firebase.json sets no location)"}. ` +
|
|
81
|
+
"Skipping database creation because this is a dry run.");
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
76
84
|
utils.logLabeledBullet("firestore", `Creating the new Firestore database ${firestoreCfg.database}...`);
|
|
77
85
|
const createDatabaseReq = {
|
|
78
86
|
project: options.projectId,
|
|
79
87
|
databaseId: firestoreCfg.database,
|
|
80
|
-
locationId
|
|
88
|
+
locationId,
|
|
81
89
|
type: types.DatabaseType.FIRESTORE_NATIVE,
|
|
82
90
|
databaseEdition: edition,
|
|
83
91
|
deleteProtectionState: types.DatabaseDeleteProtectionState.DISABLED,
|
|
@@ -88,6 +96,7 @@ async function createDatabase(context, options) {
|
|
|
88
96
|
await api.createDatabase(createDatabaseReq);
|
|
89
97
|
}
|
|
90
98
|
}
|
|
99
|
+
return false;
|
|
91
100
|
}
|
|
92
101
|
async function default_1(context, options) {
|
|
93
102
|
await (0, ensureApiEnabled_1.ensure)(context.projectId, (0, api_1.firestoreOrigin)(), "firestore");
|
|
@@ -115,7 +124,7 @@ async function default_1(context, options) {
|
|
|
115
124
|
context.firestore.rules = [];
|
|
116
125
|
const rulesDeploy = new rulesDeploy_1.RulesDeploy(options, rulesDeploy_1.RulesetServiceType.CLOUD_FIRESTORE);
|
|
117
126
|
context.firestore.rulesDeploy = rulesDeploy;
|
|
118
|
-
await createDatabase(context, options);
|
|
127
|
+
const skippedDatabaseCreation = await createDatabase(context, options);
|
|
119
128
|
for (const firestoreConfig of firestoreConfigs) {
|
|
120
129
|
if (firestoreConfig.indexes) {
|
|
121
130
|
prepareIndexes(context, options, firestoreConfig.database, firestoreConfig.indexes);
|
|
@@ -125,7 +134,16 @@ async function default_1(context, options) {
|
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
if (context.firestore.rules.length > 0) {
|
|
128
|
-
|
|
137
|
+
try {
|
|
138
|
+
await rulesDeploy.compile();
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
if (!skippedDatabaseCreation || (0, error_1.getErrStatus)(err) !== 403) {
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
144
|
+
utils.logLabeledWarning("firestore", "Could not check the rules for compilation errors (HTTP 403), most likely because the " +
|
|
145
|
+
"project has no Firestore database yet. A deploy creates the database before it checks the rules.");
|
|
146
|
+
}
|
|
129
147
|
}
|
|
130
148
|
const rulesContext = context?.firestore?.rules;
|
|
131
149
|
for (const ruleContext of rulesContext) {
|
|
@@ -18,7 +18,6 @@ exports.isBlockingTriggered = isBlockingTriggered;
|
|
|
18
18
|
exports.empty = empty;
|
|
19
19
|
exports.of = of;
|
|
20
20
|
exports.merge = merge;
|
|
21
|
-
exports.isEmptyBackend = isEmptyBackend;
|
|
22
21
|
exports.functionName = functionName;
|
|
23
22
|
exports.scheduleIdForFunction = scheduleIdForFunction;
|
|
24
23
|
exports.existingBackend = existingBackend;
|
|
@@ -27,7 +26,6 @@ exports.allEndpoints = allEndpoints;
|
|
|
27
26
|
exports.someEndpoint = someEndpoint;
|
|
28
27
|
exports.findEndpoint = findEndpoint;
|
|
29
28
|
exports.matchingBackend = matchingBackend;
|
|
30
|
-
exports.regionalEndpoints = regionalEndpoints;
|
|
31
29
|
exports.compareFunctions = compareFunctions;
|
|
32
30
|
exports.maybeDeterministicCloudRunUri = maybeDeterministicCloudRunUri;
|
|
33
31
|
const gcf = require("../../gcp/cloudfunctions");
|
|
@@ -192,11 +190,6 @@ function merge(...backends) {
|
|
|
192
190
|
}
|
|
193
191
|
return merged;
|
|
194
192
|
}
|
|
195
|
-
function isEmptyBackend(backend) {
|
|
196
|
-
return (Object.keys(backend.requiredAPIs).length === 0 &&
|
|
197
|
-
Object.keys(backend.endpoints).length === 0 &&
|
|
198
|
-
Object.keys(backend.lifecycleHooks || {}).length === 0);
|
|
199
|
-
}
|
|
200
193
|
function functionName(cloudFunction) {
|
|
201
194
|
return `projects/${cloudFunction.project}/locations/${cloudFunction.region}/functions/${cloudFunction.id}`;
|
|
202
195
|
}
|
|
@@ -345,9 +338,6 @@ function matchingBackend(backend, predicate) {
|
|
|
345
338
|
}
|
|
346
339
|
return filtered;
|
|
347
340
|
}
|
|
348
|
-
function regionalEndpoints(backend, region) {
|
|
349
|
-
return backend.endpoints[region] ? Object.values(backend.endpoints[region]) : [];
|
|
350
|
-
}
|
|
351
341
|
const hasEndpoint = (backend) => (endpoint) => {
|
|
352
342
|
return (!!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id]);
|
|
353
343
|
};
|
|
@@ -100,12 +100,12 @@ function resolveExpression(wantType, expr, params) {
|
|
|
100
100
|
return resolveComparison(expr, params);
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
throw new ExprParseError(
|
|
103
|
+
throw new ExprParseError(`CEL expression '${String(expr)}' is of an unsupported form`);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
function preprocessLists(wantType, expr, params) {
|
|
107
107
|
let rv = expr;
|
|
108
|
-
const listMatcher = /\[[
|
|
108
|
+
const listMatcher = /\[[^[\]]*\]/g;
|
|
109
109
|
let match;
|
|
110
110
|
while ((match = listMatcher.exec(expr)) != null) {
|
|
111
111
|
const list = match[0];
|
|
@@ -18,6 +18,7 @@ const experiments = require("../../experiments");
|
|
|
18
18
|
const supported = require("./runtimes/supported");
|
|
19
19
|
const backend_1 = require("./backend");
|
|
20
20
|
const extensions_1 = require("../extensions");
|
|
21
|
+
const error_1 = require("../../error");
|
|
21
22
|
const getProjectNumber_1 = require("../../getProjectNumber");
|
|
22
23
|
const path = require("path");
|
|
23
24
|
(0, tmp_1.setGracefulCleanup)();
|
|
@@ -115,7 +116,7 @@ async function uploadCodebase(context, projectNumber, codebase, wantBackend) {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
catch (err) {
|
|
118
|
-
(0, utils_1.logWarning)(clc.yellow("functions:")
|
|
119
|
+
(0, utils_1.logWarning)(`${clc.yellow("functions:")} Upload Error: ${(0, error_1.getErrMsg)(err)}`);
|
|
119
120
|
throw err;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
@@ -321,7 +321,7 @@ class Fabricator {
|
|
|
321
321
|
await this.updateV1Function(update.endpoint, scraperV1);
|
|
322
322
|
}
|
|
323
323
|
else if (update.endpoint.platform === "gcfv2") {
|
|
324
|
-
await this.updateV2Function(update.endpoint, scraperV2);
|
|
324
|
+
await this.updateV2Function(update.endpoint, scraperV2, update.failedCreate);
|
|
325
325
|
}
|
|
326
326
|
else if (update.endpoint.platform === "run") {
|
|
327
327
|
await this.updateRunFunction(update);
|
|
@@ -496,6 +496,9 @@ class Fabricator {
|
|
|
496
496
|
utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
|
|
497
497
|
return;
|
|
498
498
|
}
|
|
499
|
+
await this.setV2InvokerCreate(endpoint, serviceName);
|
|
500
|
+
}
|
|
501
|
+
async setV2InvokerCreate(endpoint, serviceName) {
|
|
499
502
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
500
503
|
const invoker = endpoint.httpsTrigger.invoker || ["public"];
|
|
501
504
|
if (!invoker.includes("private")) {
|
|
@@ -584,7 +587,7 @@ class Fabricator {
|
|
|
584
587
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
585
588
|
}
|
|
586
589
|
}
|
|
587
|
-
async updateV2Function(endpoint, scraper) {
|
|
590
|
+
async updateV2Function(endpoint, scraper, failedCreate = false) {
|
|
588
591
|
const storageSource = this.sources[endpoint.codebase]?.storage;
|
|
589
592
|
if (!storageSource) {
|
|
590
593
|
logger_1.logger.debug("Precondition failed. Cannot update a GCFv2 function without storage");
|
|
@@ -628,6 +631,10 @@ class Fabricator {
|
|
|
628
631
|
utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
|
|
629
632
|
return;
|
|
630
633
|
}
|
|
634
|
+
if (failedCreate) {
|
|
635
|
+
await this.setV2InvokerCreate(endpoint, serviceName);
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
631
638
|
let invoker;
|
|
632
639
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
633
640
|
invoker = endpoint.httpsTrigger.invoker === null ? ["public"] : endpoint.httpsTrigger.invoker;
|
|
@@ -74,6 +74,9 @@ function calculateUpdate(want, have) {
|
|
|
74
74
|
if (needsDelete) {
|
|
75
75
|
update.deleteAndRecreate = have;
|
|
76
76
|
}
|
|
77
|
+
else if (have.platform === "gcfv2" && have.state === "FAILED" && !have.runServiceId) {
|
|
78
|
+
update.failedCreate = true;
|
|
79
|
+
}
|
|
77
80
|
return update;
|
|
78
81
|
}
|
|
79
82
|
async function createDeploymentPlan(args) {
|
|
@@ -4,7 +4,6 @@ exports.AbortedDeploymentError = exports.DeploymentError = void 0;
|
|
|
4
4
|
exports.logAndTrackDeployStats = logAndTrackDeployStats;
|
|
5
5
|
exports.printErrors = printErrors;
|
|
6
6
|
exports.printAbortedErrors = printAbortedErrors;
|
|
7
|
-
exports.triggerTag = triggerTag;
|
|
8
7
|
const backend = require("../backend");
|
|
9
8
|
const clc = require("colorette");
|
|
10
9
|
const logger_1 = require("../../../logger");
|
|
@@ -170,28 +169,3 @@ function printAbortedErrors(results) {
|
|
|
170
169
|
aborted.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
|
|
171
170
|
logger_1.logger.info(`To delete these, use ${clc.bold("firebase functions:delete")}`);
|
|
172
171
|
}
|
|
173
|
-
function triggerTag(endpoint) {
|
|
174
|
-
const prefix = endpoint.platform === "gcfv1" ? "v1" : "v2";
|
|
175
|
-
if (backend.isScheduleTriggered(endpoint)) {
|
|
176
|
-
return `${prefix}.scheduled`;
|
|
177
|
-
}
|
|
178
|
-
if (backend.isTaskQueueTriggered(endpoint)) {
|
|
179
|
-
return `${prefix}.taskQueue`;
|
|
180
|
-
}
|
|
181
|
-
if (backend.isCallableTriggered(endpoint)) {
|
|
182
|
-
return `${prefix}.callable`;
|
|
183
|
-
}
|
|
184
|
-
if (backend.isHttpsTriggered(endpoint)) {
|
|
185
|
-
if (endpoint.labels?.["deployment-callable"]) {
|
|
186
|
-
return `${prefix}.callable`;
|
|
187
|
-
}
|
|
188
|
-
return `${prefix}.https`;
|
|
189
|
-
}
|
|
190
|
-
if (backend.isDataConnectGraphqlTriggered(endpoint)) {
|
|
191
|
-
return `${prefix}.dataConnectGraphql`;
|
|
192
|
-
}
|
|
193
|
-
if (backend.isBlockingTriggered(endpoint)) {
|
|
194
|
-
return `${prefix}.blocking`;
|
|
195
|
-
}
|
|
196
|
-
return endpoint.eventTrigger.eventType;
|
|
197
|
-
}
|
|
@@ -109,7 +109,7 @@ async function detectFromOutputPath(childProcess, manifestPath, project, runtime
|
|
|
109
109
|
childProcess.stderr?.on("data", (chunk) => {
|
|
110
110
|
stderrBuffer += chunk.toString();
|
|
111
111
|
});
|
|
112
|
-
|
|
112
|
+
const onExit = async (code) => {
|
|
113
113
|
if (!resolved) {
|
|
114
114
|
clearTimeout(timer);
|
|
115
115
|
resolved = true;
|
|
@@ -133,6 +133,9 @@ async function detectFromOutputPath(childProcess, manifestPath, project, runtime
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
};
|
|
137
|
+
childProcess.on("exit", (code) => {
|
|
138
|
+
void onExit(code);
|
|
136
139
|
});
|
|
137
140
|
childProcess.on("error", (err) => {
|
|
138
141
|
if (!resolved) {
|
|
@@ -88,7 +88,7 @@ function assertKeyTypes(prefix, yaml, schema) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
throw new error_1.FirebaseError(
|
|
91
|
+
throw new error_1.FirebaseError(`YAML validation is missing a handled type ${String(schema[key])}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -80,7 +80,7 @@ function buildFromV1Alpha1(yaml, project, region, runtime) {
|
|
|
80
80
|
}
|
|
81
81
|
return bd;
|
|
82
82
|
}
|
|
83
|
-
const ROLE_REGEX = /^(roles\/[a-zA-Z0-9_
|
|
83
|
+
const ROLE_REGEX = /^(roles\/[a-zA-Z0-9_.-]+|projects\/[a-zA-Z0-9-]+\/roles\/[a-zA-Z0-9_.-]+|organizations\/[0-9]+\/roles\/[a-zA-Z0-9_.-]+)$/;
|
|
84
84
|
function parseRequiredRoles(manifest) {
|
|
85
85
|
const roles = manifest.requiredRoles || [];
|
|
86
86
|
for (const role of roles) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FALLBACK_DEPLOYMENT_REGION = exports.DEFAULT_GLOBAL_TRIGGER_REGION = exports.noopProjectBindings = exports.noop = void 0;
|
|
3
|
+
exports.FALLBACK_DEPLOYMENT_REGION = exports.DEFAULT_GLOBAL_TRIGGER_REGION = exports.noopProjectBindings = exports.syncNoop = exports.noop = void 0;
|
|
4
4
|
exports.serviceForEndpoint = serviceForEndpoint;
|
|
5
5
|
const auth_1 = require("./auth");
|
|
6
6
|
const storage_1 = require("./storage");
|
|
@@ -14,6 +14,8 @@ const ailogic_1 = require("./ailogic");
|
|
|
14
14
|
const authEventarc_1 = require("./authEventarc");
|
|
15
15
|
const noop = () => Promise.resolve();
|
|
16
16
|
exports.noop = noop;
|
|
17
|
+
const syncNoop = () => undefined;
|
|
18
|
+
exports.syncNoop = syncNoop;
|
|
17
19
|
const noopProjectBindings = () => Promise.resolve([]);
|
|
18
20
|
exports.noopProjectBindings = noopProjectBindings;
|
|
19
21
|
exports.DEFAULT_GLOBAL_TRIGGER_REGION = "us-east1";
|
|
@@ -22,7 +24,7 @@ const noOpService = {
|
|
|
22
24
|
name: "noop",
|
|
23
25
|
api: "",
|
|
24
26
|
ensureTriggerRegion: exports.noop,
|
|
25
|
-
validateTrigger: exports.
|
|
27
|
+
validateTrigger: exports.syncNoop,
|
|
26
28
|
registerTrigger: exports.noop,
|
|
27
29
|
unregisterTrigger: exports.noop,
|
|
28
30
|
getDefaultRegion: () => Promise.resolve(exports.FALLBACK_DEPLOYMENT_REGION),
|
|
@@ -32,7 +34,7 @@ const pubSubService = {
|
|
|
32
34
|
api: "pubsub.googleapis.com",
|
|
33
35
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
34
36
|
ensureTriggerRegion: exports.noop,
|
|
35
|
-
validateTrigger: exports.
|
|
37
|
+
validateTrigger: exports.syncNoop,
|
|
36
38
|
registerTrigger: exports.noop,
|
|
37
39
|
unregisterTrigger: exports.noop,
|
|
38
40
|
getDefaultRegion: () => Promise.resolve(exports.DEFAULT_GLOBAL_TRIGGER_REGION),
|
|
@@ -42,7 +44,7 @@ const storageService = {
|
|
|
42
44
|
api: "storage.googleapis.com",
|
|
43
45
|
requiredProjectBindings: storage_1.obtainStorageBindings,
|
|
44
46
|
ensureTriggerRegion: storage_1.ensureStorageTriggerRegion,
|
|
45
|
-
validateTrigger: exports.
|
|
47
|
+
validateTrigger: exports.syncNoop,
|
|
46
48
|
registerTrigger: exports.noop,
|
|
47
49
|
unregisterTrigger: exports.noop,
|
|
48
50
|
getDefaultRegion: storage_1.getDefaultRegion,
|
|
@@ -52,7 +54,7 @@ const firebaseAlertsService = {
|
|
|
52
54
|
api: "firebasealerts.googleapis.com",
|
|
53
55
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
54
56
|
ensureTriggerRegion: firebaseAlerts_1.ensureFirebaseAlertsTriggerRegion,
|
|
55
|
-
validateTrigger: exports.
|
|
57
|
+
validateTrigger: exports.syncNoop,
|
|
56
58
|
registerTrigger: exports.noop,
|
|
57
59
|
unregisterTrigger: exports.noop,
|
|
58
60
|
getDefaultRegion: () => Promise.resolve(exports.DEFAULT_GLOBAL_TRIGGER_REGION),
|
|
@@ -64,7 +66,7 @@ const databaseService = {
|
|
|
64
66
|
api: "firebasedatabase.googleapis.com",
|
|
65
67
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
66
68
|
ensureTriggerRegion: database_1.ensureDatabaseTriggerRegion,
|
|
67
|
-
validateTrigger: exports.
|
|
69
|
+
validateTrigger: exports.syncNoop,
|
|
68
70
|
registerTrigger: exports.noop,
|
|
69
71
|
unregisterTrigger: exports.noop,
|
|
70
72
|
getDefaultRegion: database_1.getDefaultRegion,
|
|
@@ -74,7 +76,7 @@ const remoteConfigService = {
|
|
|
74
76
|
api: "firebaseremoteconfig.googleapis.com",
|
|
75
77
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
76
78
|
ensureTriggerRegion: remoteConfig_1.ensureRemoteConfigTriggerRegion,
|
|
77
|
-
validateTrigger: exports.
|
|
79
|
+
validateTrigger: exports.syncNoop,
|
|
78
80
|
registerTrigger: exports.noop,
|
|
79
81
|
unregisterTrigger: exports.noop,
|
|
80
82
|
getDefaultRegion: () => Promise.resolve(exports.DEFAULT_GLOBAL_TRIGGER_REGION),
|
|
@@ -84,7 +86,7 @@ const testLabService = {
|
|
|
84
86
|
api: "testing.googleapis.com",
|
|
85
87
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
86
88
|
ensureTriggerRegion: testLab_1.ensureTestLabTriggerRegion,
|
|
87
|
-
validateTrigger: exports.
|
|
89
|
+
validateTrigger: exports.syncNoop,
|
|
88
90
|
registerTrigger: exports.noop,
|
|
89
91
|
unregisterTrigger: exports.noop,
|
|
90
92
|
getDefaultRegion: () => Promise.resolve(exports.DEFAULT_GLOBAL_TRIGGER_REGION),
|
|
@@ -94,7 +96,7 @@ const firestoreService = {
|
|
|
94
96
|
api: "firestore.googleapis.com",
|
|
95
97
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
96
98
|
ensureTriggerRegion: firestore_1.ensureFirestoreTriggerRegion,
|
|
97
|
-
validateTrigger: exports.
|
|
99
|
+
validateTrigger: exports.syncNoop,
|
|
98
100
|
registerTrigger: exports.noop,
|
|
99
101
|
unregisterTrigger: exports.noop,
|
|
100
102
|
getDefaultRegion: firestore_1.getDefaultRegion,
|
|
@@ -104,7 +106,7 @@ const dataconnectService = {
|
|
|
104
106
|
api: "firebasedataconnect.googleapis.com",
|
|
105
107
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
106
108
|
ensureTriggerRegion: dataconnect_1.ensureDataConnectTriggerRegion,
|
|
107
|
-
validateTrigger: exports.
|
|
109
|
+
validateTrigger: exports.syncNoop,
|
|
108
110
|
registerTrigger: exports.noop,
|
|
109
111
|
unregisterTrigger: exports.noop,
|
|
110
112
|
getDefaultRegion: dataconnect_1.getDefaultRegion,
|
|
@@ -114,7 +116,7 @@ const authEventarcService = {
|
|
|
114
116
|
api: "eventarc.googleapis.com",
|
|
115
117
|
requiredProjectBindings: exports.noopProjectBindings,
|
|
116
118
|
ensureTriggerRegion: authEventarc_1.ensureAuthEventarcTriggerRegion,
|
|
117
|
-
validateTrigger: exports.
|
|
119
|
+
validateTrigger: exports.syncNoop,
|
|
118
120
|
registerTrigger: exports.noop,
|
|
119
121
|
unregisterTrigger: exports.noop,
|
|
120
122
|
getDefaultRegion: () => Promise.resolve(exports.DEFAULT_GLOBAL_TRIGGER_REGION),
|
|
@@ -15,8 +15,6 @@ const utils = require("../../utils");
|
|
|
15
15
|
const backend = require("../functions/backend");
|
|
16
16
|
const ensureTargeted_1 = require("../../functions/ensureTargeted");
|
|
17
17
|
const frameworks_1 = require("../../frameworks");
|
|
18
|
-
const ensureApiEnabled_1 = require("../../ensureApiEnabled");
|
|
19
|
-
const api_1 = require("../../api");
|
|
20
18
|
function handlePublicDirectoryFlag(options) {
|
|
21
19
|
if (options.public) {
|
|
22
20
|
if (Array.isArray(options.config.get("hosting"))) {
|
|
@@ -75,7 +73,7 @@ async function prepare(context, options) {
|
|
|
75
73
|
if (configs.length === 0) {
|
|
76
74
|
return Promise.resolve();
|
|
77
75
|
}
|
|
78
|
-
await
|
|
76
|
+
await api.ensureApiEnabled(context.projectId);
|
|
79
77
|
const versions = await Promise.all(configs.map(async (config) => {
|
|
80
78
|
await api.getSite(context.projectId, config.site);
|
|
81
79
|
const labels = {
|
|
@@ -10,7 +10,7 @@ const logger_1 = require("../logger");
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const vsCodeUtils_1 = require("../vsCodeUtils");
|
|
12
12
|
function runCommand(command, childOptions) {
|
|
13
|
-
const escapedCommand = command.replace(
|
|
13
|
+
const escapedCommand = command.replace(/"/g, '\\"');
|
|
14
14
|
const nodeExecutable = (0, vsCodeUtils_1.isVSCodeExtension)() ? "node" : process.execPath;
|
|
15
15
|
const crossEnvShellPath = (0, vsCodeUtils_1.isVSCodeExtension)()
|
|
16
16
|
? path.resolve(__dirname, "./cross-env/dist/bin/cross-env-shell.js")
|
|
@@ -165,8 +165,8 @@ async function signUp(state, reqBody, ctx) {
|
|
|
165
165
|
(0, errors_1.assert)(reqBody.password.length >= PASSWORD_MIN_LENGTH, `WEAK_PASSWORD : Password should be at least ${PASSWORD_MIN_LENGTH} characters`);
|
|
166
166
|
updates.salt = "fakeSalt" + (0, utils_1.randomId)(20);
|
|
167
167
|
updates.passwordHash = hashPassword(reqBody.password, updates.salt);
|
|
168
|
-
updates.passwordUpdatedAt =
|
|
169
|
-
updates.validSince = (0, utils_1.toUnixTimestamp)(
|
|
168
|
+
updates.passwordUpdatedAt = timestamp.getTime();
|
|
169
|
+
updates.validSince = (0, utils_1.toUnixTimestamp)(timestamp).toString();
|
|
170
170
|
}
|
|
171
171
|
if (reqBody.mfaInfo) {
|
|
172
172
|
updates.mfaInfo = getMfaEnrollmentsFromRequest(state, reqBody.mfaInfo, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.specForRouter = specForRouter;
|
|
3
4
|
exports.createApp = createApp;
|
|
4
5
|
const cors = require("cors");
|
|
5
6
|
const express = require("express");
|
|
@@ -79,7 +80,7 @@ function specWithEmulatorServer(protocol, host) {
|
|
|
79
80
|
return result;
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
async function createApp(defaultProjectId, singleProjectMode = index_1.SingleProjectMode.NO_WARNING, projectStateForId = new Map()) {
|
|
83
|
+
async function createApp(defaultProjectId, singleProjectMode = index_1.SingleProjectMode.NO_WARNING, projectStateForId = new Map(), options = {}) {
|
|
83
84
|
const app = express();
|
|
84
85
|
app.set("json spaces", 2);
|
|
85
86
|
app.use("/", (req, res, next) => {
|
|
@@ -157,6 +158,7 @@ async function createApp(defaultProjectId, singleProjectMode = index_1.SinglePro
|
|
|
157
158
|
]);
|
|
158
159
|
};
|
|
159
160
|
const apis = await exegesisExpress.middleware(specForRouter(), {
|
|
161
|
+
lazyCompileValidationSchemas: options.lazyCompileValidationSchemas ?? true,
|
|
160
162
|
controllers: { auth: toExegesisController(operations_1.authOperations, getProjectStateById) },
|
|
161
163
|
authenticators: {
|
|
162
164
|
apiKeyQuery: apiKeyAuthenticator,
|
|
@@ -282,7 +284,7 @@ async function createApp(defaultProjectId, singleProjectMode = index_1.SinglePro
|
|
|
282
284
|
const errorString = `Multiple projectIds are not recommended in single project mode. ` +
|
|
283
285
|
`Requested project ID ${projectId}, but the emulator is configured for ` +
|
|
284
286
|
`${defaultProjectId}. To opt-out of single project mode add/set the ` +
|
|
285
|
-
|
|
287
|
+
`'"singleProjectMode"' false' property in the firebase.json emulators config.`;
|
|
286
288
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.AUTH).log("WARN", errorString);
|
|
287
289
|
if (singleProjectMode === index_1.SingleProjectMode.ERROR) {
|
|
288
290
|
throw new errors_2.BadRequestError(errorString);
|
|
@@ -34,7 +34,7 @@ var firebaseAppId = query.get('appId');
|
|
|
34
34
|
var apn = query.get('apn');
|
|
35
35
|
var ibi = query.get('ibi');
|
|
36
36
|
var appIdentifier = apn || ibi;
|
|
37
|
-
var isSamlProvider = !!providerId.match(/^saml
|
|
37
|
+
var isSamlProvider = !!providerId.match(/^saml\\./);
|
|
38
38
|
assert(
|
|
39
39
|
appName || clientId || firebaseAppId || appIdentifier,
|
|
40
40
|
'Missing one of appName / clientId / appId / apn / ibi query params.'
|
|
@@ -168,7 +168,7 @@ function setExportOnExitOptions(options) {
|
|
|
168
168
|
function processKillSignal(signal, res, rej, options) {
|
|
169
169
|
let lastSignal = new Date().getTime();
|
|
170
170
|
let signalCount = 0;
|
|
171
|
-
|
|
171
|
+
const handleSignal = async () => {
|
|
172
172
|
try {
|
|
173
173
|
const now = new Date().getTime();
|
|
174
174
|
const diff = now - lastSignal;
|
|
@@ -221,6 +221,9 @@ function processKillSignal(signal, res, rej, options) {
|
|
|
221
221
|
rej((0, error_2.getError)(e));
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
+
return () => {
|
|
225
|
+
void handleSignal();
|
|
226
|
+
};
|
|
224
227
|
}
|
|
225
228
|
function shutdownWhenKilled(options) {
|
|
226
229
|
return new Promise((res, rej) => {
|
|
@@ -35,17 +35,22 @@ class DatabaseEmulator {
|
|
|
35
35
|
}
|
|
36
36
|
const watcher = chokidar.watch(c.rules, { persistent: true, ignoreInitial: true });
|
|
37
37
|
this.rulesWatchers.push(watcher);
|
|
38
|
-
watcher.on("change",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
watcher.on("change", () => {
|
|
39
|
+
const update = async () => {
|
|
40
|
+
await new Promise((res) => setTimeout(res, 5));
|
|
41
|
+
this.logger.logLabeled("BULLET", "database", `Change detected, updating rules for ${c.instance}...`);
|
|
42
|
+
try {
|
|
43
|
+
await this.updateRules(c.instance, c.rules);
|
|
44
|
+
this.logger.logLabeled("SUCCESS", "database", "Rules updated.");
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
this.logger.logLabeled("WARN", "database", this.prettyPrintRulesError(c.rules, e));
|
|
48
|
+
this.logger.logLabeled("WARN", "database", "Failed to update rules");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
update().catch((err) => {
|
|
52
|
+
this.logger.logLabeled("WARN", "database", `Failed to update rules: ${(0, error_1.getErrMsg)(err)}`);
|
|
53
|
+
});
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
}
|