firebase-tools 13.14.2 → 13.15.1
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/bin/firebase.js +2 -4
- package/lib/commands/deploy.js +10 -2
- package/lib/commands/ext-configure.js +1 -6
- package/lib/commands/ext-dev-init.js +2 -4
- package/lib/commands/ext-dev-upload.js +4 -6
- package/lib/commands/ext-info.js +3 -5
- package/lib/commands/ext-install.js +0 -5
- package/lib/commands/ext-uninstall.js +0 -5
- package/lib/commands/ext-update.js +0 -5
- package/lib/commands/firestore-databases-create.js +19 -1
- package/lib/commands/functions-secrets-set.js +9 -6
- package/lib/commands/hosting-channel-create.js +1 -1
- package/lib/commands/hosting-channel-delete.js +1 -1
- package/lib/commands/hosting-channel-deploy.js +1 -1
- package/lib/commands/hosting-clone.js +1 -2
- package/lib/dataconnect/fileUtils.js +63 -1
- package/lib/dataconnect/provisionCloudSql.js +5 -1
- package/lib/dataconnect/types.js +8 -1
- package/lib/deploy/extensions/planner.js +46 -1
- package/lib/deploy/extensions/prepare.js +99 -23
- package/lib/deploy/functions/build.js +5 -5
- package/lib/deploy/functions/deploy.js +12 -12
- package/lib/deploy/functions/params.js +5 -3
- package/lib/deploy/functions/prepare.js +16 -1
- package/lib/deploy/functions/release/index.js +4 -0
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +46 -0
- package/lib/emulator/dataconnectEmulator.js +2 -0
- package/lib/emulator/downloadableEmulators.js +11 -12
- package/lib/emulator/functionsEmulator.js +8 -1
- package/lib/extensions/askUserForEventsConfig.js +18 -8
- package/lib/extensions/askUserForParam.js +3 -2
- package/lib/extensions/change-log.js +2 -4
- package/lib/extensions/displayExtensionInfo.js +5 -10
- package/lib/extensions/extensionsApi.js +1 -1
- package/lib/extensions/extensionsHelper.js +47 -10
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/provisioningHelper.js +1 -1
- package/lib/extensions/refs.js +26 -11
- package/lib/extensions/runtimes/common.js +75 -0
- package/lib/extensions/types.js +56 -1
- package/lib/extensions/updateHelper.js +1 -2
- package/lib/extensions/warnings.js +2 -7
- package/lib/firestore/api.js +8 -7
- package/lib/firestore/pretty-print.js +21 -1
- package/lib/firestore/pretty-print.test.js +8 -0
- package/lib/frameworks/constants.js +1 -1
- package/lib/frameworks/next/constants.js +1 -1
- package/lib/frameworks/next/index.js +26 -14
- package/lib/frameworks/next/utils.js +45 -1
- package/lib/init/features/dataconnect/index.js +29 -15
- package/lib/init/features/dataconnect/sdk.js +72 -56
- package/lib/prompt.js +22 -1
- package/lib/rulesDeploy.js +14 -12
- package/package.json +3 -3
- package/templates/init/dataconnect/connector.yaml +5 -3
- package/templates/init/dataconnect/dataconnect.yaml +5 -5
- package/templates/init/dataconnect/mutations.gql +44 -29
- package/templates/init/dataconnect/queries.gql +66 -38
- package/templates/init/dataconnect/schema.gql +38 -21
- package/lib/extensions/billingMigrationHelper.js +0 -61
package/lib/bin/firebase.js
CHANGED
|
@@ -10,12 +10,10 @@ if (!semver.satisfies(nodeVersion, pkg.engines.node)) {
|
|
|
10
10
|
}
|
|
11
11
|
const updateNotifierPkg = require("update-notifier-cjs");
|
|
12
12
|
const clc = require("colorette");
|
|
13
|
-
const
|
|
13
|
+
const marked_terminal_1 = require("marked-terminal");
|
|
14
14
|
const updateNotifier = updateNotifierPkg({ pkg });
|
|
15
15
|
const marked_1 = require("marked");
|
|
16
|
-
marked_1.marked.
|
|
17
|
-
renderer: new TerminalRenderer(),
|
|
18
|
-
});
|
|
16
|
+
marked_1.marked.use((0, marked_terminal_1.markedTerminal)());
|
|
19
17
|
const node_path_1 = require("node:path");
|
|
20
18
|
const triple_beam_1 = require("triple-beam");
|
|
21
19
|
const stripAnsi = require("strip-ansi");
|
package/lib/commands/deploy.js
CHANGED
|
@@ -80,7 +80,9 @@ exports.command = new command_1.Command("deploy")
|
|
|
80
80
|
.option("--only <targets>", 'only deploy to specified, comma-separated targets (e.g. "hosting,storage"). For functions, ' +
|
|
81
81
|
'can specify filters with colons to scope function deploys to only those functions (e.g. "--only functions:func1,functions:func2"). ' +
|
|
82
82
|
"When filtering based on export groups (the exported module object keys), use dots to specify group names " +
|
|
83
|
-
'(e.g. "--only functions:group1.subgroup1,functions:group2)
|
|
83
|
+
'(e.g. "--only functions:group1.subgroup1,functions:group2"). ' +
|
|
84
|
+
"When filtering based on codebases, use colons to specify codebase names " +
|
|
85
|
+
'(e.g. "--only functions:codebase1:func1,functions:codebase2:group1.subgroup1"). ' +
|
|
84
86
|
"For data connect, can specify filters with colons to deploy only a service, connector, or schema" +
|
|
85
87
|
'(e.g. "--only dataconnect:serviceId,dataconnect:serviceId:connectorId,dataconnect:serviceId:schema"). ')
|
|
86
88
|
.option("--except <targets>", 'deploy to all targets except specified (e.g. "database")')
|
|
@@ -107,7 +109,13 @@ exports.command = new command_1.Command("deploy")
|
|
|
107
109
|
await (0, requireHostingSite_1.requireHostingSite)(options);
|
|
108
110
|
}
|
|
109
111
|
catch (err) {
|
|
110
|
-
|
|
112
|
+
const isPermissionError = err instanceof error_1.FirebaseError &&
|
|
113
|
+
err.original instanceof error_1.FirebaseError &&
|
|
114
|
+
err.original.status === 403;
|
|
115
|
+
if (isPermissionError) {
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
118
|
+
else if (err === getDefaultHostingSite_1.errNoDefaultSite) {
|
|
111
119
|
createSite = true;
|
|
112
120
|
}
|
|
113
121
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
-
const marked_1 = require("marked");
|
|
5
|
-
const TerminalRenderer = require("marked-terminal");
|
|
6
4
|
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
7
5
|
const command_1 = require("../command");
|
|
8
6
|
const error_1 = require("../error");
|
|
@@ -19,9 +17,6 @@ const functional_1 = require("../functional");
|
|
|
19
17
|
const paramHelper_1 = require("../extensions/paramHelper");
|
|
20
18
|
const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
|
|
21
19
|
const tos_1 = require("../extensions/tos");
|
|
22
|
-
marked_1.marked.setOptions({
|
|
23
|
-
renderer: new TerminalRenderer(),
|
|
24
|
-
});
|
|
25
20
|
exports.command = new command_1.Command("ext:configure <extensionInstanceId>")
|
|
26
21
|
.description("configure an existing extension instance")
|
|
27
22
|
.withForce()
|
|
@@ -99,7 +94,7 @@ function infoImmutableParams(immutableParams, paramValues) {
|
|
|
99
94
|
return;
|
|
100
95
|
}
|
|
101
96
|
const plural = immutableParams.length > 1;
|
|
102
|
-
utils.logLabeledWarning(extensionsHelper_1.logPrefix,
|
|
97
|
+
utils.logLabeledWarning(extensionsHelper_1.logPrefix, `The following param${plural ? "s are" : " is"} immutable and won't be changed:`);
|
|
103
98
|
for (const { param } of immutableParams) {
|
|
104
99
|
logger_1.logger.info(`param: ${param}, value: ${paramValues[param]}`);
|
|
105
100
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const marked_1 = require("marked");
|
|
5
|
-
const
|
|
5
|
+
const marked_terminal_1 = require("marked-terminal");
|
|
6
6
|
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
7
7
|
const command_1 = require("../command");
|
|
8
8
|
const config_1 = require("../config");
|
|
@@ -11,9 +11,7 @@ const prompt_1 = require("../prompt");
|
|
|
11
11
|
const logger_1 = require("../logger");
|
|
12
12
|
const npmDependencies = require("../init/features/functions/npm-dependencies");
|
|
13
13
|
const templates_1 = require("../templates");
|
|
14
|
-
marked_1.marked.
|
|
15
|
-
renderer: new TerminalRenderer(),
|
|
16
|
-
});
|
|
14
|
+
marked_1.marked.use((0, marked_terminal_1.markedTerminal)());
|
|
17
15
|
function readCommonTemplates() {
|
|
18
16
|
return {
|
|
19
17
|
integrationTestFirebaseJsonTemplate: (0, templates_1.readTemplateSync)("extensions/integration-test.json"),
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.uploadExtensionAction = exports.command = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const marked_1 = require("marked");
|
|
6
|
-
const
|
|
6
|
+
const marked_terminal_1 = require("marked-terminal");
|
|
7
7
|
const command_1 = require("../command");
|
|
8
8
|
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
9
9
|
const refs = require("../extensions/refs");
|
|
@@ -16,9 +16,7 @@ const utils = require("../utils");
|
|
|
16
16
|
const publisherApi_1 = require("../extensions/publisherApi");
|
|
17
17
|
const extensionsHelper_2 = require("../extensions/extensionsHelper");
|
|
18
18
|
const projects_1 = require("../management/projects");
|
|
19
|
-
marked_1.marked.
|
|
20
|
-
renderer: new TerminalRenderer(),
|
|
21
|
-
});
|
|
19
|
+
marked_1.marked.use((0, marked_terminal_1.markedTerminal)());
|
|
22
20
|
exports.command = new command_1.Command("ext:dev:upload <extensionRef>")
|
|
23
21
|
.description(`upload a new version of an extension`)
|
|
24
22
|
.option(`-s, --stage <stage>`, `release stage (supports "alpha", "beta", "rc", and "stable")`)
|
|
@@ -79,9 +77,9 @@ async function uploadExtensionAction(extensionRef, options) {
|
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
if (res) {
|
|
82
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
|
|
80
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, await (0, marked_1.marked)(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
|
|
83
81
|
const version = res.ref.split("@")[1];
|
|
84
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`[View in Console](${utils.consoleUrl(projectId, `/publisher/extensions/${extensionId}/v/${version}`)})`));
|
|
82
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, await (0, marked_1.marked)(`[View in Console](${utils.consoleUrl(projectId, `/publisher/extensions/${extensionId}/v/${version}`)})`));
|
|
85
83
|
}
|
|
86
84
|
return res;
|
|
87
85
|
}
|
package/lib/commands/ext-info.js
CHANGED
|
@@ -11,7 +11,7 @@ const logger_1 = require("../logger");
|
|
|
11
11
|
const requirePermissions_1 = require("../requirePermissions");
|
|
12
12
|
const utils = require("../utils");
|
|
13
13
|
const marked_1 = require("marked");
|
|
14
|
-
const
|
|
14
|
+
const marked_terminal_1 = require("marked-terminal");
|
|
15
15
|
const FUNCTION_TYPE_REGEX = /\..+\.function/;
|
|
16
16
|
exports.command = new command_1.Command("ext:info <extensionName>")
|
|
17
17
|
.description("display information about an extension by name (extensionName@x.y.z for a specific version)")
|
|
@@ -108,10 +108,8 @@ exports.command = new command_1.Command("ext:info <extensionName>")
|
|
|
108
108
|
logger_1.logger.info(lines.join("\n\n"));
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
marked_1.marked.
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
logger_1.logger.info((0, marked_1.marked)(lines.join("\n")));
|
|
111
|
+
marked_1.marked.use((0, marked_terminal_1.markedTerminal)());
|
|
112
|
+
logger_1.logger.info(await (0, marked_1.marked)(lines.join("\n")));
|
|
115
113
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension, type ` +
|
|
116
114
|
clc.bold(`firebase ext:install ${extensionName} --project=YOUR_PROJECT`));
|
|
117
115
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
-
const marked_1 = require("marked");
|
|
6
5
|
const semver = require("semver");
|
|
7
|
-
const TerminalRenderer = require("marked-terminal");
|
|
8
6
|
const displayExtensionInfo_1 = require("../extensions/displayExtensionInfo");
|
|
9
7
|
const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
|
|
10
8
|
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
@@ -25,9 +23,6 @@ const track_1 = require("../track");
|
|
|
25
23
|
const prompt_1 = require("../prompt");
|
|
26
24
|
const manifest = require("../extensions/manifest");
|
|
27
25
|
const tos_1 = require("../extensions/tos");
|
|
28
|
-
marked_1.marked.setOptions({
|
|
29
|
-
renderer: new TerminalRenderer(),
|
|
30
|
-
});
|
|
31
26
|
exports.command = new command_1.Command("ext:install [extensionRef]")
|
|
32
27
|
.description("add an uploaded extension to firebase.json if [publisherId/extensionId] is provided;" +
|
|
33
28
|
"or, add a local extension if [localPath] is provided")
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
-
const marked_1 = require("marked");
|
|
5
|
-
const TerminalRenderer = require("marked-terminal");
|
|
6
4
|
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
7
5
|
const command_1 = require("../command");
|
|
8
6
|
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
9
7
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
8
|
const utils_1 = require("../utils");
|
|
11
9
|
const manifest = require("../extensions/manifest");
|
|
12
|
-
marked_1.marked.setOptions({
|
|
13
|
-
renderer: new TerminalRenderer(),
|
|
14
|
-
});
|
|
15
10
|
exports.command = new command_1.Command("ext:uninstall <extensionInstanceId>")
|
|
16
11
|
.description("uninstall an extension that is installed in your Firebase project by instance ID")
|
|
17
12
|
.option("--local", "deprecated")
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
-
const marked_1 = require("marked");
|
|
6
|
-
const TerminalRenderer = require("marked-terminal");
|
|
7
5
|
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
8
6
|
const command_1 = require("../command");
|
|
9
7
|
const error_1 = require("../error");
|
|
@@ -20,9 +18,6 @@ const prompt_1 = require("../prompt");
|
|
|
20
18
|
const manifest = require("../extensions/manifest");
|
|
21
19
|
const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
|
|
22
20
|
const tos_1 = require("../extensions/tos");
|
|
23
|
-
marked_1.marked.setOptions({
|
|
24
|
-
renderer: new TerminalRenderer(),
|
|
25
|
-
});
|
|
26
21
|
exports.command = new command_1.Command("ext:update <extensionInstanceId> [updateSource]")
|
|
27
22
|
.description("update an existing extension instance to the latest version, or to a specific version if provided")
|
|
28
23
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -16,6 +16,9 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
16
16
|
.option("--location <locationId>", "Region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations. (required)")
|
|
17
17
|
.option("--delete-protection <deleteProtectionState>", "Whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
18
18
|
.option("--point-in-time-recovery <enablement>", "Whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
19
|
+
.option("-k, --kms-key-name <kmsKeyName>", "The resource ID of a Cloud KMS key. If set, the database created will be a " +
|
|
20
|
+
"Customer-managed Encryption Key (CMEK) database encrypted with this key. " +
|
|
21
|
+
"This feature is allowlist only in initial launch.")
|
|
19
22
|
.before(requirePermissions_1.requirePermissions, ["datastore.databases.create"])
|
|
20
23
|
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
21
24
|
.action(async (database, options) => {
|
|
@@ -42,7 +45,22 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
42
45
|
const pointInTimeRecoveryEnablement = options.pointInTimeRecovery === types.PointInTimeRecoveryEnablementOption.ENABLED
|
|
43
46
|
? types.PointInTimeRecoveryEnablement.ENABLED
|
|
44
47
|
: types.PointInTimeRecoveryEnablement.DISABLED;
|
|
45
|
-
|
|
48
|
+
let cmekConfig;
|
|
49
|
+
if (options.kmsKeyName) {
|
|
50
|
+
cmekConfig = {
|
|
51
|
+
kmsKeyName: options.kmsKeyName,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const createDatabaseReq = {
|
|
55
|
+
project: options.project,
|
|
56
|
+
databaseId: database,
|
|
57
|
+
locationId: options.location,
|
|
58
|
+
type,
|
|
59
|
+
deleteProtectionState,
|
|
60
|
+
pointInTimeRecoveryEnablement,
|
|
61
|
+
cmekConfig,
|
|
62
|
+
};
|
|
63
|
+
const databaseResp = await api.createDatabase(createDatabaseReq);
|
|
46
64
|
if (options.json) {
|
|
47
65
|
logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
|
|
48
66
|
}
|
|
@@ -54,12 +54,15 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
|
|
|
54
54
|
(0, utils_1.logBullet)(`${endpointsToUpdate.length} functions are using stale version of secret ${secret.name}:\n\t` +
|
|
55
55
|
endpointsToUpdate.map((e) => `${e.id}(${e.region})`).join("\n\t"));
|
|
56
56
|
if (!options.force) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
let confirm = false;
|
|
58
|
+
if (!options.nonInteractive) {
|
|
59
|
+
confirm = await (0, prompt_1.promptOnce)({
|
|
60
|
+
name: "redeploy",
|
|
61
|
+
type: "confirm",
|
|
62
|
+
default: true,
|
|
63
|
+
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`,
|
|
64
|
+
}, options);
|
|
65
|
+
}
|
|
63
66
|
if (!confirm) {
|
|
64
67
|
(0, utils_1.logBullet)("Please deploy your functions for the change to take effect by running:\n\t" +
|
|
65
68
|
clc.bold("firebase deploy --only functions"));
|
|
@@ -65,7 +65,7 @@ exports.command = new command_1.Command("hosting:channel:create [channelId]")
|
|
|
65
65
|
await (0, api_1.addAuthDomains)(projectId, [channel.url]);
|
|
66
66
|
}
|
|
67
67
|
catch (e) {
|
|
68
|
-
(0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
68
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, await (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
69
69
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
70
70
|
}
|
|
71
71
|
logger_1.logger.info();
|
|
@@ -39,7 +39,7 @@ exports.command = new command_1.Command("hosting:channel:delete <channelId>")
|
|
|
39
39
|
await (0, api_1.removeAuthDomain)(projectId, channel.url);
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
|
-
(0, utils_1.logLabeledWarning)("hosting:channel", (0, marked_1.marked)(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
42
|
+
(0, utils_1.logLabeledWarning)("hosting:channel", await (0, marked_1.marked)(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
43
43
|
logger_1.logger.debug("[hosting] unable to remove auth domain", e);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -133,7 +133,7 @@ async function syncAuthState(projectId, sites) {
|
|
|
133
133
|
logger_1.logger.debug("[hosting] added auth domain for urls", urlNames);
|
|
134
134
|
}
|
|
135
135
|
catch (e) {
|
|
136
|
-
(0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
136
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, await (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
137
137
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
@@ -8,7 +8,6 @@ const error_1 = require("../error");
|
|
|
8
8
|
const api_1 = require("../hosting/api");
|
|
9
9
|
const utils = require("../utils");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
|
-
const marked_1 = require("marked");
|
|
12
11
|
const logger_1 = require("../logger");
|
|
13
12
|
exports.command = new command_1.Command("hosting:clone <source> <targetChannel>")
|
|
14
13
|
.description("clone a version from one site to another")
|
|
@@ -68,7 +67,7 @@ For example, to copy the content for a site \`my-site\` from a preview channel \
|
|
|
68
67
|
await (0, api_1.addAuthDomains)(tProjectId, [tChannel.url]);
|
|
69
68
|
}
|
|
70
69
|
catch (e) {
|
|
71
|
-
utils.logLabeledWarning("hosting:clone",
|
|
70
|
+
utils.logLabeledWarning("hosting:clone", `Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`);
|
|
72
71
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pickService = exports.readGQLFiles = exports.readConnectorYaml = exports.readDataConnectYaml = exports.readFirebaseJson = void 0;
|
|
3
|
+
exports.generateSdkYaml = exports.directoryHasPackageJson = exports.getPlatformFromFolder = exports.pickService = exports.readGQLFiles = exports.readConnectorYaml = exports.readDataConnectYaml = exports.readFirebaseJson = void 0;
|
|
4
4
|
const fs = require("fs-extra");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const error_1 = require("../error");
|
|
7
|
+
const types_1 = require("./types");
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
const load_1 = require("./load");
|
|
9
10
|
function readFirebaseJson(config) {
|
|
@@ -92,3 +93,64 @@ async function pickService(projectId, config, serviceId) {
|
|
|
92
93
|
return serviceInfo;
|
|
93
94
|
}
|
|
94
95
|
exports.pickService = pickService;
|
|
96
|
+
const WEB_INDICATORS = ["package.json", "package-lock.json", "node_modules"];
|
|
97
|
+
const IOS_INDICATORS = ["info.plist", "podfile", "package.swift"];
|
|
98
|
+
const ANDROID_INDICATORS = ["androidmanifest.xml", "build.gradle", "build.gradle.kts"];
|
|
99
|
+
const IOS_POSTFIX_INDICATORS = [".xcworkspace", ".xcodeproj"];
|
|
100
|
+
async function getPlatformFromFolder(dirPath) {
|
|
101
|
+
const fileNames = await fs.readdir(dirPath);
|
|
102
|
+
let hasWeb = false;
|
|
103
|
+
let hasAndroid = false;
|
|
104
|
+
let hasIOS = false;
|
|
105
|
+
for (const fileName of fileNames) {
|
|
106
|
+
const cleanedFileName = fileName.toLowerCase();
|
|
107
|
+
hasWeb || (hasWeb = WEB_INDICATORS.some((indicator) => indicator === cleanedFileName));
|
|
108
|
+
hasAndroid || (hasAndroid = ANDROID_INDICATORS.some((indicator) => indicator === cleanedFileName));
|
|
109
|
+
hasIOS || (hasIOS = IOS_INDICATORS.some((indicator) => indicator === cleanedFileName) ||
|
|
110
|
+
IOS_POSTFIX_INDICATORS.some((indicator) => cleanedFileName.endsWith(indicator)));
|
|
111
|
+
}
|
|
112
|
+
if (hasWeb && !hasAndroid && !hasIOS) {
|
|
113
|
+
return types_1.Platform.WEB;
|
|
114
|
+
}
|
|
115
|
+
else if (hasAndroid && !hasWeb && !hasIOS) {
|
|
116
|
+
return types_1.Platform.ANDROID;
|
|
117
|
+
}
|
|
118
|
+
else if (hasIOS && !hasWeb && !hasAndroid) {
|
|
119
|
+
return types_1.Platform.IOS;
|
|
120
|
+
}
|
|
121
|
+
return types_1.Platform.UNDETERMINED;
|
|
122
|
+
}
|
|
123
|
+
exports.getPlatformFromFolder = getPlatformFromFolder;
|
|
124
|
+
async function directoryHasPackageJson(dirPath) {
|
|
125
|
+
const fileNames = await fs.readdir(dirPath);
|
|
126
|
+
return fileNames.some((f) => f.toLowerCase() === "package.json");
|
|
127
|
+
}
|
|
128
|
+
exports.directoryHasPackageJson = directoryHasPackageJson;
|
|
129
|
+
function generateSdkYaml(platform, connectorYaml, connectorYamlFolder, appFolder) {
|
|
130
|
+
const relPath = path.relative(connectorYamlFolder, appFolder);
|
|
131
|
+
const outputDir = path.join(relPath, "dataconnect-generated");
|
|
132
|
+
if (!connectorYaml.generate) {
|
|
133
|
+
connectorYaml.generate = {};
|
|
134
|
+
}
|
|
135
|
+
if (platform === types_1.Platform.WEB) {
|
|
136
|
+
connectorYaml.generate.javascriptSdk = {
|
|
137
|
+
outputDir,
|
|
138
|
+
package: `@firebasegen/${connectorYaml.connectorId}`,
|
|
139
|
+
packageJsonDir: appFolder,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (platform === types_1.Platform.IOS) {
|
|
143
|
+
connectorYaml.generate.swiftSdk = {
|
|
144
|
+
outputDir,
|
|
145
|
+
package: connectorYaml.connectorId,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (platform === types_1.Platform.ANDROID) {
|
|
149
|
+
connectorYaml.generate.kotlinSdk = {
|
|
150
|
+
outputDir,
|
|
151
|
+
package: `connectors.${connectorYaml.connectorId}`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return connectorYaml;
|
|
155
|
+
}
|
|
156
|
+
exports.generateSdkYaml = generateSdkYaml;
|
|
@@ -5,6 +5,7 @@ const cloudSqlAdminClient = require("../gcp/cloudsql/cloudsqladmin");
|
|
|
5
5
|
const utils = require("../utils");
|
|
6
6
|
const checkIam_1 = require("./checkIam");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
+
const logger_1 = require("../logger");
|
|
8
9
|
const GOOGLE_ML_INTEGRATION_ROLE = "roles/aiplatform.user";
|
|
9
10
|
const freeTrial_1 = require("./freeTrial");
|
|
10
11
|
const error_1 = require("../error");
|
|
@@ -44,7 +45,9 @@ async function provisionCloudSql(args) {
|
|
|
44
45
|
connectionName = (newInstance === null || newInstance === void 0 ? void 0 : newInstance.connectionName) || "";
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
silent ||
|
|
48
|
+
silent ||
|
|
49
|
+
utils.logLabeledBullet("dataconnect", "Cloud SQL instance creation started - it should be ready shortly. Database and users will be created on your next deploy.");
|
|
50
|
+
return connectionName;
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
try {
|
|
@@ -59,6 +62,7 @@ async function provisionCloudSql(args) {
|
|
|
59
62
|
silent || utils.logLabeledBullet("dataconnect", `Database ${databaseId} created.`);
|
|
60
63
|
}
|
|
61
64
|
else {
|
|
65
|
+
logger_1.logger.debug(`Unexpected error from CloudSQL: ${err}`);
|
|
62
66
|
silent || utils.logLabeledWarning("dataconnect", `Database ${databaseId} is not accessible.`);
|
|
63
67
|
}
|
|
64
68
|
}
|
package/lib/dataconnect/types.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toDatasource = exports.requiresVector = exports.SCHEMA_ID = void 0;
|
|
3
|
+
exports.toDatasource = exports.Platform = exports.requiresVector = exports.SCHEMA_ID = void 0;
|
|
4
4
|
exports.SCHEMA_ID = "main";
|
|
5
5
|
function requiresVector(dm) {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
7
7
|
return (_d = (_c = (_b = (_a = dm === null || dm === void 0 ? void 0 : dm.primaryDataSource) === null || _a === void 0 ? void 0 : _a.postgres) === null || _b === void 0 ? void 0 : _b.requiredExtensions) === null || _c === void 0 ? void 0 : _c.includes("vector")) !== null && _d !== void 0 ? _d : false;
|
|
8
8
|
}
|
|
9
9
|
exports.requiresVector = requiresVector;
|
|
10
|
+
var Platform;
|
|
11
|
+
(function (Platform) {
|
|
12
|
+
Platform["ANDROID"] = "ANDROID";
|
|
13
|
+
Platform["WEB"] = "WEB";
|
|
14
|
+
Platform["IOS"] = "IOS";
|
|
15
|
+
Platform["UNDETERMINED"] = "UNDETERMINED";
|
|
16
|
+
})(Platform = exports.Platform || (exports.Platform = {}));
|
|
10
17
|
function toDatasource(projectId, locationId, ds) {
|
|
11
18
|
if (ds.postgresql) {
|
|
12
19
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveVersion = exports.want = exports.have = exports.getExtensionSpec = exports.getExtension = exports.getExtensionVersion = void 0;
|
|
3
|
+
exports.resolveVersion = exports.want = exports.wantDynamic = exports.have = exports.getExtensionSpec = exports.getExtension = exports.getExtensionVersion = void 0;
|
|
4
4
|
const semver = require("semver");
|
|
5
5
|
const extensionsApi = require("../../extensions/extensionsApi");
|
|
6
6
|
const refs = require("../../extensions/refs");
|
|
@@ -11,6 +11,7 @@ const manifest_1 = require("../../extensions/manifest");
|
|
|
11
11
|
const paramHelper_1 = require("../../extensions/paramHelper");
|
|
12
12
|
const specHelper_1 = require("../../extensions/emulator/specHelper");
|
|
13
13
|
const functional_1 = require("../../functional");
|
|
14
|
+
const askUserForEventsConfig_1 = require("../../extensions/askUserForEventsConfig");
|
|
14
15
|
async function getExtensionVersion(i) {
|
|
15
16
|
if (!i.extensionVersion) {
|
|
16
17
|
if (!i.ref) {
|
|
@@ -69,6 +70,50 @@ async function have(projectId) {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
exports.have = have;
|
|
73
|
+
async function wantDynamic(args) {
|
|
74
|
+
const instanceSpecs = [];
|
|
75
|
+
const errors = [];
|
|
76
|
+
for (const [instanceId, ext] of Object.entries(args.extensions)) {
|
|
77
|
+
const autoPopulatedParams = await (0, extensionsHelper_1.getFirebaseProjectParams)(args.projectId, args.emulatorMode);
|
|
78
|
+
const subbedParams = (0, extensionsHelper_1.substituteParams)(ext.params, autoPopulatedParams);
|
|
79
|
+
const eventarcChannel = ext.params["_EVENT_ARC_REGION"]
|
|
80
|
+
? (0, askUserForEventsConfig_1.getEventArcChannel)(args.projectId, ext.params["_EVENT_ARC_REGION"])
|
|
81
|
+
: undefined;
|
|
82
|
+
delete subbedParams["_EVENT_ARC_REGION"];
|
|
83
|
+
const subbedSecretParams = await (0, extensionsHelper_1.substituteSecretParams)(args.projectNumber, subbedParams);
|
|
84
|
+
const [systemParams, params] = (0, functional_1.partitionRecord)(subbedSecretParams, paramHelper_1.isSystemParam);
|
|
85
|
+
const allowedEventTypes = ext.events.length ? ext.events : undefined;
|
|
86
|
+
if (allowedEventTypes && !eventarcChannel) {
|
|
87
|
+
errors.push(new error_1.FirebaseError("EventArcRegion must be specified if event handlers are defined"));
|
|
88
|
+
}
|
|
89
|
+
if (ext.localPath) {
|
|
90
|
+
instanceSpecs.push({
|
|
91
|
+
instanceId,
|
|
92
|
+
localPath: ext.localPath,
|
|
93
|
+
params,
|
|
94
|
+
systemParams,
|
|
95
|
+
allowedEventTypes,
|
|
96
|
+
eventarcChannel,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (ext.ref) {
|
|
100
|
+
instanceSpecs.push({
|
|
101
|
+
instanceId,
|
|
102
|
+
ref: refs.parse(ext.ref),
|
|
103
|
+
params,
|
|
104
|
+
systemParams,
|
|
105
|
+
allowedEventTypes,
|
|
106
|
+
eventarcChannel,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (errors.length) {
|
|
111
|
+
const messages = errors.map((err) => `- ${err.message}`).join("\n");
|
|
112
|
+
throw new error_1.FirebaseError(`Errors while reading 'extensions' in app code\n${messages}`);
|
|
113
|
+
}
|
|
114
|
+
return instanceSpecs;
|
|
115
|
+
}
|
|
116
|
+
exports.wantDynamic = wantDynamic;
|
|
72
117
|
async function want(args) {
|
|
73
118
|
const instanceSpecs = [];
|
|
74
119
|
const errors = [];
|