firebase-tools-with-isolate 13.16.0 → 13.26.0-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/api.js +3 -1
- package/lib/apiv2.js +10 -3
- package/lib/appdistribution/client.js +62 -8
- package/lib/appdistribution/distribution.js +1 -1
- package/lib/apphosting/backend.js +299 -0
- package/lib/apphosting/config.js +31 -8
- package/lib/apphosting/githubConnections.js +70 -22
- package/lib/apphosting/index.js +3 -312
- package/lib/apphosting/rollout.js +138 -0
- package/lib/apphosting/secrets/index.js +70 -5
- package/lib/apphosting/utils.js +41 -0
- package/lib/apphosting/yaml.js +82 -0
- package/lib/archiveDirectory.js +1 -1
- package/lib/auth.js +31 -5
- package/lib/bin/firebase.js +2 -2
- package/lib/command.js +18 -4
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/{appdistribution-group-create.js → appdistribution-groups-create.js} +2 -1
- package/lib/commands/{appdistribution-group-delete.js → appdistribution-groups-delete.js} +3 -2
- package/lib/commands/appdistribution-groups-list.js +55 -0
- package/lib/commands/appdistribution-testers-list.js +52 -0
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +4 -4
- package/lib/commands/apphosting-backends-delete.js +7 -15
- package/lib/commands/apphosting-backends-get.js +1 -1
- package/lib/commands/apphosting-config-export.js +51 -0
- package/lib/commands/apphosting-repos-create.js +23 -0
- package/lib/commands/apphosting-rollouts-create.js +14 -15
- package/lib/commands/apphosting-secrets-grantaccess.js +2 -2
- package/lib/commands/database-import.js +4 -2
- package/lib/commands/database-push.js +4 -2
- package/lib/commands/database-set.js +4 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/dataconnect-sdk-generate.js +4 -1
- package/lib/commands/dataconnect-services-list.js +4 -3
- package/lib/commands/dataconnect-sql-diff.js +1 -1
- package/lib/commands/dataconnect-sql-grant.js +37 -0
- package/lib/commands/dataconnect-sql-migrate.js +1 -1
- package/lib/commands/dataconnect-sql-shell.js +115 -0
- package/lib/commands/deploy.js +2 -0
- package/lib/commands/emulators-start.js +4 -1
- package/lib/commands/ext-dev-init.js +2 -2
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-register.js +2 -2
- package/lib/commands/ext-dev-upload.js +2 -2
- package/lib/commands/ext-dev-usage.js +2 -2
- package/lib/commands/ext-info.js +3 -1
- package/lib/commands/ext-install.js +2 -2
- package/lib/commands/ext-sdk-install.js +88 -0
- package/lib/commands/ext.js +1 -0
- package/lib/commands/firestore-databases-restore.js +39 -1
- package/lib/commands/functions-secrets-access.js +2 -4
- package/lib/commands/index.js +15 -2
- package/lib/commands/init.js +25 -15
- package/lib/commands/setup-emulators-dataconnect.js +0 -13
- package/lib/commands/use.js +1 -1
- package/lib/config.js +14 -4
- package/lib/crashlytics/buildToolsJarHelper.js +2 -2
- package/lib/dataconnect/client.js +1 -1
- package/lib/dataconnect/dataplaneClient.js +12 -9
- package/lib/dataconnect/ensureApis.js +6 -1
- package/lib/dataconnect/fileUtils.js +15 -39
- package/lib/dataconnect/freeTrial.js +45 -9
- package/lib/dataconnect/load.js +3 -1
- package/lib/dataconnect/provisionCloudSql.js +39 -26
- package/lib/dataconnect/schemaMigration.js +215 -74
- package/lib/dataconnect/types.js +4 -1
- package/lib/dataconnect/webhook.js +32 -0
- package/lib/deploy/dataconnect/deploy.js +18 -15
- package/lib/deploy/dataconnect/prepare.js +41 -0
- package/lib/deploy/dataconnect/release.js +16 -7
- package/lib/deploy/extensions/deploy.js +3 -1
- package/lib/deploy/extensions/deploymentSummary.js +7 -3
- package/lib/deploy/extensions/planner.js +44 -5
- package/lib/deploy/extensions/prepare.js +45 -73
- package/lib/deploy/extensions/release.js +11 -10
- package/lib/deploy/extensions/tasks.js +32 -21
- package/lib/deploy/firestore/prepare.js +9 -0
- package/lib/deploy/firestore/release.js +3 -6
- package/lib/deploy/functions/checkIam.js +7 -2
- package/lib/deploy/functions/ensure.js +11 -3
- package/lib/deploy/functions/prepare.js +32 -21
- package/lib/deploy/functions/prepareFunctionsUpload.js +15 -16
- package/lib/deploy/functions/release/planner.js +2 -1
- package/lib/deploy/functions/runtimes/discovery/index.js +6 -2
- package/lib/deploy/functions/runtimes/node/index.js +5 -0
- package/lib/deploy/functions/services/auth.js +34 -3
- package/lib/deploy/functions/services/index.js +2 -0
- package/lib/deploy/index.js +8 -5
- package/lib/deploy/lifecycleHooks.js +2 -1
- package/lib/emulator/apphosting/config.js +27 -0
- package/lib/emulator/apphosting/index.js +38 -0
- package/lib/emulator/apphosting/serve.js +50 -0
- package/lib/emulator/apphosting/utils.js +18 -0
- package/lib/emulator/auth/handlers.js +27 -0
- package/lib/emulator/auth/operations.js +41 -2
- package/lib/emulator/auth/state.js +2 -1
- package/lib/emulator/commandUtils.js +8 -3
- package/lib/emulator/constants.js +4 -1
- package/lib/emulator/controller.js +48 -5
- package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +11 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +58 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/index.js +22 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +124 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/password.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +34 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +270 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/trust.js +2 -0
- package/lib/emulator/dataconnect/pg-gateway/backend-error.js +75 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +79 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.js +315 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.types.js +8 -0
- package/lib/emulator/dataconnect/pg-gateway/crypto.js +40 -0
- package/lib/emulator/dataconnect/pg-gateway/duplex.js +53 -0
- package/lib/emulator/dataconnect/pg-gateway/index.js +27 -0
- package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +82 -0
- package/lib/emulator/dataconnect/pg-gateway/message-codes.js +52 -0
- package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +16 -0
- package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +35 -0
- package/lib/emulator/dataconnect/pg-gateway/utils.js +40 -0
- package/lib/emulator/dataconnect/pgliteServer.js +95 -0
- package/lib/emulator/dataconnectEmulator.js +58 -75
- package/lib/emulator/dataconnectToolkitController.js +44 -0
- package/lib/emulator/downloadableEmulators.js +27 -16
- package/lib/emulator/emulatorLogger.js +3 -0
- package/lib/emulator/eventarcEmulator.js +1 -1
- package/lib/emulator/extensionsEmulator.js +38 -6
- package/lib/emulator/functionsEmulator.js +85 -41
- package/lib/emulator/functionsEmulatorShared.js +2 -1
- package/lib/emulator/functionsRuntimeWorker.js +2 -1
- package/lib/emulator/hub.js +13 -9
- package/lib/emulator/hubExport.js +10 -3
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/portUtils.js +10 -11
- package/lib/emulator/registry.js +1 -0
- package/lib/emulator/storage/persistence.js +2 -2
- package/lib/emulator/storage/rules/runtime.js +1 -1
- package/lib/emulator/tasksEmulator.js +5 -2
- package/lib/emulator/types.js +3 -0
- package/lib/emulator/ui.js +51 -25
- package/lib/error.js +31 -1
- package/lib/experiments.js +5 -0
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/extensionsApi.js +14 -10
- package/lib/extensions/extensionsHelper.js +15 -6
- package/lib/extensions/localHelper.js +31 -0
- package/lib/extensions/runtimes/common.js +179 -39
- package/lib/extensions/runtimes/node.js +401 -0
- package/lib/extensions/types.js +25 -14
- package/lib/extensions/warnings.js +5 -2
- package/lib/firestore/api.js +2 -1
- package/lib/firestore/checkDatabaseType.js +10 -3
- package/lib/firestore/delete.js +11 -0
- package/lib/firestore/options.js +7 -0
- package/lib/frameworks/angular/index.js +15 -3
- package/lib/frameworks/constants.js +1 -1
- package/lib/frameworks/flutter/index.js +6 -6
- package/lib/frameworks/flutter/utils.js +34 -1
- package/lib/frameworks/next/index.js +10 -2
- package/lib/frameworks/next/utils.js +8 -5
- package/lib/frameworks/vite/index.js +2 -2
- package/lib/fsutils.js +13 -1
- package/lib/functions/constants.js +4 -0
- package/lib/functions/events/v1.js +9 -2
- package/lib/gcp/apphosting.js +1 -1
- package/lib/gcp/cloudmonitoring.js +3 -3
- package/lib/gcp/cloudsql/cloudsqladmin.js +32 -20
- package/lib/gcp/cloudsql/connect.js +49 -37
- package/lib/gcp/cloudsql/interactive.js +49 -0
- package/lib/gcp/cloudsql/permissions.js +165 -0
- package/lib/gcp/devConnect.js +38 -1
- package/lib/gcp/firestore.js +5 -1
- package/lib/gcp/secretManager.js +12 -5
- package/lib/getProjectNumber.js +1 -1
- package/lib/init/features/apphosting.js +15 -0
- package/lib/init/features/dataconnect/index.js +159 -120
- package/lib/init/features/dataconnect/sdk.js +77 -84
- package/lib/init/features/emulators.js +2 -15
- package/lib/init/features/firestore/index.js +20 -1
- package/lib/init/features/firestore/indexes.js +4 -4
- package/lib/init/features/genkit/index.js +444 -0
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/init/features/index.js +1 -1
- package/lib/init/features/project.js +6 -6
- package/lib/init/features/storage.js +0 -2
- package/lib/init/index.js +1 -0
- package/lib/init/spawn.js +23 -2
- package/lib/logger.js +2 -2
- package/lib/management/projects.js +24 -4
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +1 -1
- package/lib/rc.js +1 -8
- package/lib/requireAuth.js +19 -5
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requirePermissions.js +1 -1
- package/lib/responseToError.js +5 -2
- package/lib/rulesDeploy.js +1 -1
- package/lib/templates.js +2 -2
- package/lib/utils.js +16 -11
- package/lib/vsCodeUtils.js +8 -0
- package/package.json +7 -6
- package/schema/connector-yaml.json +57 -17
- package/schema/firebase-config.json +24 -0
- package/templates/extensions/javascript/package.lint.json +2 -2
- package/templates/extensions/javascript/package.nolint.json +2 -2
- package/templates/extensions/typescript/package.lint.json +2 -2
- package/templates/extensions/typescript/package.nolint.json +2 -2
- package/templates/genkit/firebase.0.9.0.template +57 -0
- package/templates/init/apphosting/apphosting.yaml +23 -0
- package/templates/init/dataconnect/connector.yaml +0 -1
- package/templates/init/dataconnect/dataconnect-fdccompatiblemode.yaml +12 -0
- package/templates/init/dataconnect/dataconnect.yaml +1 -1
- package/templates/init/dataconnect/queries.gql +1 -2
- package/templates/init/functions/javascript/package.lint.json +2 -2
- package/templates/init/functions/javascript/package.nolint.json +2 -2
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +2 -2
- package/lib/ensureCloudResourceLocation.js +0 -12
- package/lib/init/features/genkit.js +0 -53
package/lib/prompt.js
CHANGED
|
@@ -53,7 +53,7 @@ async function promptForDirectory(args) {
|
|
|
53
53
|
let dir = "";
|
|
54
54
|
while (!dir) {
|
|
55
55
|
const target = args.config.path(await promptOnce({
|
|
56
|
-
message:
|
|
56
|
+
message: args.message,
|
|
57
57
|
}));
|
|
58
58
|
if ((0, fsutils_1.fileExistsSync)(target)) {
|
|
59
59
|
logger_1.logger.error(`Expected a directory, but ${target} is a file. Please provide a path to a directory.`);
|
package/lib/rc.js
CHANGED
|
@@ -37,7 +37,7 @@ class RC {
|
|
|
37
37
|
}
|
|
38
38
|
constructor(rcpath, data) {
|
|
39
39
|
this.path = rcpath;
|
|
40
|
-
this.data = { projects: {}, targets: {}, etags: {},
|
|
40
|
+
this.data = { projects: {}, targets: {}, etags: {}, ...data };
|
|
41
41
|
}
|
|
42
42
|
set(key, value) {
|
|
43
43
|
_.set(this.data, key, value);
|
|
@@ -150,13 +150,6 @@ class RC {
|
|
|
150
150
|
this.data.etags[projectId][resourceType] = etagData;
|
|
151
151
|
this.save();
|
|
152
152
|
}
|
|
153
|
-
getDataconnect() {
|
|
154
|
-
return this.data.dataconnectEmulatorConfig ?? {};
|
|
155
|
-
}
|
|
156
|
-
setDataconnect(localConnectionString) {
|
|
157
|
-
this.data.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
|
|
158
|
-
this.save();
|
|
159
|
-
}
|
|
160
153
|
save() {
|
|
161
154
|
if (this.path) {
|
|
162
155
|
fs.writeFileSync(this.path, JSON.stringify(this.data, null, 2), {
|
package/lib/requireAuth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requireAuth = void 0;
|
|
3
|
+
exports.requireAuth = exports.refreshAuth = void 0;
|
|
4
4
|
const google_auth_library_1 = require("google-auth-library");
|
|
5
5
|
const clc = require("colorette");
|
|
6
6
|
const api = require("./api");
|
|
@@ -12,6 +12,7 @@ const scopes = require("./scopes");
|
|
|
12
12
|
const auth_1 = require("./auth");
|
|
13
13
|
const AUTH_ERROR_MESSAGE = `Command requires authentication, please run ${clc.bold("firebase login")}`;
|
|
14
14
|
let authClient;
|
|
15
|
+
let lastOptions;
|
|
15
16
|
function getAuthClient(config) {
|
|
16
17
|
if (authClient) {
|
|
17
18
|
return authClient;
|
|
@@ -32,16 +33,29 @@ async function autoAuth(options, authScopes) {
|
|
|
32
33
|
logger_1.logger.debug(`Error getting account credentials.`);
|
|
33
34
|
}
|
|
34
35
|
if (process.env.MONOSPACE_ENV && token && clientEmail) {
|
|
35
|
-
|
|
36
|
+
const activeAccount = {
|
|
36
37
|
user: { email: clientEmail },
|
|
37
|
-
tokens: {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
tokens: {
|
|
39
|
+
access_token: token,
|
|
40
|
+
expires_at: client.cachedCredential?.credentials.expiry_date,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
(0, auth_1.setActiveAccount)(options, activeAccount);
|
|
44
|
+
(0, auth_1.setGlobalDefaultAccount)(activeAccount);
|
|
40
45
|
options.projectId = await client.getProjectId();
|
|
41
46
|
}
|
|
42
47
|
return clientEmail;
|
|
43
48
|
}
|
|
49
|
+
async function refreshAuth() {
|
|
50
|
+
if (!lastOptions) {
|
|
51
|
+
throw new error_1.FirebaseError("Unable to refresh auth: not yet authenticated.");
|
|
52
|
+
}
|
|
53
|
+
await requireAuth(lastOptions);
|
|
54
|
+
return lastOptions.tokens;
|
|
55
|
+
}
|
|
56
|
+
exports.refreshAuth = refreshAuth;
|
|
44
57
|
async function requireAuth(options) {
|
|
58
|
+
lastOptions = options;
|
|
45
59
|
api.setScopes([scopes.CLOUD_PLATFORM, scopes.FIREBASE_PLATFORM]);
|
|
46
60
|
options.authScopes = api.getScopes();
|
|
47
61
|
const tokens = options.tokens;
|
|
@@ -15,7 +15,7 @@ async function requireDatabaseInstance(options) {
|
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
17
|
throw new error_1.FirebaseError(`Failed to get details for project: ${options.project}.`, {
|
|
18
|
-
original: err,
|
|
18
|
+
original: (0, error_1.getError)(err),
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
if (instance === "") {
|
|
@@ -23,7 +23,7 @@ async function requirePermissions(options, permissions = []) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
catch (err) {
|
|
26
|
-
logger_1.logger.debug(`[iam] error while checking permissions, command may fail: ${err}`);
|
|
26
|
+
logger_1.logger.debug(`[iam] error while checking permissions, command may fail: ${(0, error_1.getErrMsg)(err)}`);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
}
|
package/lib/responseToError.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.responseToError = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
|
-
function responseToError(response, body) {
|
|
6
|
+
function responseToError(response, body, url) {
|
|
7
7
|
if (response.statusCode < 400) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -37,7 +37,10 @@ function responseToError(response, body) {
|
|
|
37
37
|
message: errMessage,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
let message = "HTTP Error: " + response.statusCode + ", " + (body.error.message || body.error);
|
|
41
|
+
if (url) {
|
|
42
|
+
message = "Request to " + url + " had " + message;
|
|
43
|
+
}
|
|
41
44
|
let exitCode;
|
|
42
45
|
if (response.statusCode >= 500) {
|
|
43
46
|
exitCode = 2;
|
package/lib/rulesDeploy.js
CHANGED
|
@@ -112,7 +112,7 @@ class RulesDeploy {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
catch (err) {
|
|
115
|
-
if (err
|
|
115
|
+
if ((0, error_1.getErrStatus)(err) !== QUOTA_EXCEEDED_STATUS_CODE) {
|
|
116
116
|
throw err;
|
|
117
117
|
}
|
|
118
118
|
utils.logLabeledBullet(RulesetType[this.type], "quota exceeded error while uploading rules");
|
package/lib/templates.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.readTemplate = exports.readTemplateSync = exports.absoluteTemplateFilePa
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
7
|
+
const vsCodeUtils_1 = require("./vsCodeUtils");
|
|
8
8
|
const TEMPLATE_ENCODING = "utf8";
|
|
9
9
|
function absoluteTemplateFilePath(relPath) {
|
|
10
|
-
if ((0,
|
|
10
|
+
if ((0, vsCodeUtils_1.isVSCodeExtension)()) {
|
|
11
11
|
return (0, path_1.resolve)(__dirname, "templates", relPath);
|
|
12
12
|
}
|
|
13
13
|
return (0, path_1.resolve)(__dirname, "../templates", relPath);
|
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.
|
|
4
|
-
exports.readSecretValue = exports.generateId = exports.wrappedSafeLoad = exports.readFileFromDirectory = exports.getHostnameFromUrl = exports.openInBrowserPopup =
|
|
3
|
+
exports.openInBrowser = exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.sleep = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.withTimeout = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.setVSCodeEnvVars = exports.getInheritedOption = exports.consoleUrl = exports.vscodeEnvVars = exports.envOverrides = exports.IS_WINDOWS = void 0;
|
|
4
|
+
exports.readSecretValue = exports.generateId = exports.wrappedSafeLoad = exports.readFileFromDirectory = exports.getHostnameFromUrl = exports.openInBrowserPopup = void 0;
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
6
|
const tty = require("tty");
|
|
7
7
|
const path = require("node:path");
|
|
@@ -17,13 +17,14 @@ const stream_1 = require("stream");
|
|
|
17
17
|
const winston = require("winston");
|
|
18
18
|
const triple_beam_1 = require("triple-beam");
|
|
19
19
|
const assert_1 = require("assert");
|
|
20
|
-
const
|
|
20
|
+
const node_util_1 = require("node:util");
|
|
21
21
|
const portfinder_1 = require("portfinder");
|
|
22
22
|
const configstore_1 = require("./configstore");
|
|
23
23
|
const error_1 = require("./error");
|
|
24
24
|
const logger_1 = require("./logger");
|
|
25
25
|
const prompt_1 = require("./prompt");
|
|
26
26
|
const templates_1 = require("./templates");
|
|
27
|
+
const vsCodeUtils_1 = require("./vsCodeUtils");
|
|
27
28
|
exports.IS_WINDOWS = process.platform === "win32";
|
|
28
29
|
const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
|
|
29
30
|
const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
|
|
@@ -51,7 +52,7 @@ function setVSCodeEnvVars(envVar, value) {
|
|
|
51
52
|
}
|
|
52
53
|
exports.setVSCodeEnvVars = setVSCodeEnvVars;
|
|
53
54
|
function envOverride(envname, value, coerce) {
|
|
54
|
-
const currentEnvValue = isVSCodeExtension() && exports.vscodeEnvVars[envname] ? exports.vscodeEnvVars[envname] : process.env[envname];
|
|
55
|
+
const currentEnvValue = (0, vsCodeUtils_1.isVSCodeExtension)() && exports.vscodeEnvVars[envname] ? exports.vscodeEnvVars[envname] : process.env[envname];
|
|
55
56
|
if (currentEnvValue && currentEnvValue.length) {
|
|
56
57
|
exports.envOverrides.push(envname);
|
|
57
58
|
if (coerce) {
|
|
@@ -315,7 +316,7 @@ function setupLoggers() {
|
|
|
315
316
|
level: "debug",
|
|
316
317
|
format: winston.format.printf((info) => {
|
|
317
318
|
const segments = [info.message, ...(info[triple_beam_1.SPLAT] || [])].map(tryStringify);
|
|
318
|
-
return `${
|
|
319
|
+
return `${(0, node_util_1.stripVTControlCharacters)(segments.join(" "))}`;
|
|
319
320
|
}),
|
|
320
321
|
}));
|
|
321
322
|
}
|
|
@@ -385,10 +386,6 @@ function isCloudEnvironment() {
|
|
|
385
386
|
return !!process.env.CODESPACES || !!process.env.GOOGLE_CLOUD_WORKSTATIONS;
|
|
386
387
|
}
|
|
387
388
|
exports.isCloudEnvironment = isCloudEnvironment;
|
|
388
|
-
function isVSCodeExtension() {
|
|
389
|
-
return !!process.env.VSCODE_CWD;
|
|
390
|
-
}
|
|
391
|
-
exports.isVSCodeExtension = isVSCodeExtension;
|
|
392
389
|
function isRunningInWSL() {
|
|
393
390
|
return !!process.env.WSL_DISTRO_NAME;
|
|
394
391
|
}
|
|
@@ -563,7 +560,7 @@ function wrappedSafeLoad(source) {
|
|
|
563
560
|
return yaml.parse(source);
|
|
564
561
|
}
|
|
565
562
|
catch (err) {
|
|
566
|
-
throw new error_1.FirebaseError(`YAML Error: ${err
|
|
563
|
+
throw new error_1.FirebaseError(`YAML Error: ${(0, error_1.getErrMsg)(err)}`, { original: (0, error_1.getError)(err) });
|
|
567
564
|
}
|
|
568
565
|
}
|
|
569
566
|
exports.wrappedSafeLoad = wrappedSafeLoad;
|
|
@@ -589,6 +586,14 @@ function readSecretValue(prompt, dataFile) {
|
|
|
589
586
|
if (dataFile && dataFile !== "-") {
|
|
590
587
|
input = dataFile;
|
|
591
588
|
}
|
|
592
|
-
|
|
589
|
+
try {
|
|
590
|
+
return Promise.resolve(fs.readFileSync(input, "utf-8"));
|
|
591
|
+
}
|
|
592
|
+
catch (e) {
|
|
593
|
+
if (e.code === "ENOENT") {
|
|
594
|
+
throw new error_1.FirebaseError(`File not found: ${input}`, { original: e });
|
|
595
|
+
}
|
|
596
|
+
throw e;
|
|
597
|
+
}
|
|
593
598
|
}
|
|
594
599
|
exports.readSecretValue = readSecretValue;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isVSCodeExtension = void 0;
|
|
4
|
+
const process_1 = require("process");
|
|
5
|
+
function isVSCodeExtension() {
|
|
6
|
+
return !!process_1.env.VSCODE_CWD;
|
|
7
|
+
}
|
|
8
|
+
exports.isVSCodeExtension = isVSCodeExtension;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools-with-isolate",
|
|
3
|
-
"version": "13.16.0",
|
|
4
3
|
"description": "Command-Line Interface for Firebase with monorepo support",
|
|
4
|
+
"version": "13.26.0-1",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"firebase": "lib/bin/firebase.js"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build": "tsc && npm run copyfiles",
|
|
11
11
|
"build:publish": "tsc --build tsconfig.publish.json && npm run copyfiles",
|
|
12
12
|
"build:watch": "npm run build && tsc --watch",
|
|
13
|
-
"clean": "
|
|
13
|
+
"clean": "node -e \"fs.rmSync('lib', { recursive: true, force: true }); fs.rmSync('dev', { recursive: true, force: true });\"",
|
|
14
14
|
"copyfiles": "node -e \"const fs = require('fs'); fs.mkdirSync('./lib', {recursive:true}); fs.copyFileSync('./src/dynamicImport.js', './lib/dynamicImport.js')\"",
|
|
15
15
|
"format": "npm run format:ts && npm run format:other",
|
|
16
16
|
"format:other": "npm run lint:other -- --write",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
]
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
+
"@electric-sql/pglite": "^0.2.0",
|
|
100
101
|
"@google-cloud/cloud-sql-connector": "^1.3.3",
|
|
101
102
|
"@google-cloud/pubsub": "^4.5.0",
|
|
102
103
|
"abort-controller": "^3.0.0",
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"cjson": "^0.3.1",
|
|
109
110
|
"cli-table": "0.3.11",
|
|
110
111
|
"colorette": "^2.0.19",
|
|
111
|
-
"commander": "^
|
|
112
|
+
"commander": "^5.1.0",
|
|
112
113
|
"configstore": "^5.0.1",
|
|
113
114
|
"cors": "^2.8.5",
|
|
114
115
|
"cross-env": "^5.1.3",
|
|
@@ -127,11 +128,12 @@
|
|
|
127
128
|
"google-auth-library": "^9.11.0",
|
|
128
129
|
"inquirer": "^8.2.6",
|
|
129
130
|
"inquirer-autocomplete-prompt": "^2.0.1",
|
|
130
|
-
"isolate-package": "^1.
|
|
131
|
+
"isolate-package": "^1.20.0",
|
|
131
132
|
"jsonwebtoken": "^9.0.0",
|
|
132
133
|
"leven": "^3.1.0",
|
|
133
134
|
"libsodium-wrappers": "^0.7.10",
|
|
134
135
|
"lodash": "^4.17.21",
|
|
136
|
+
"lsofi": "1.0.0",
|
|
135
137
|
"marked": "^13.0.2",
|
|
136
138
|
"marked-terminal": "^7.0.0",
|
|
137
139
|
"mime": "^2.5.2",
|
|
@@ -146,12 +148,10 @@
|
|
|
146
148
|
"progress": "^2.0.3",
|
|
147
149
|
"proxy-agent": "^6.3.0",
|
|
148
150
|
"retry": "^0.13.1",
|
|
149
|
-
"rimraf": "^5.0.0",
|
|
150
151
|
"semver": "^7.5.2",
|
|
151
152
|
"sql-formatter": "^15.3.0",
|
|
152
153
|
"stream-chain": "^2.2.4",
|
|
153
154
|
"stream-json": "^1.7.3",
|
|
154
|
-
"strip-ansi": "^6.0.1",
|
|
155
155
|
"superstatic": "^9.0.3",
|
|
156
156
|
"tar": "^6.1.11",
|
|
157
157
|
"tcp-port-used": "^1.0.2",
|
|
@@ -190,6 +190,7 @@
|
|
|
190
190
|
"@types/jsonwebtoken": "^9.0.5",
|
|
191
191
|
"@types/libsodium-wrappers": "^0.7.9",
|
|
192
192
|
"@types/lodash": "^4.14.149",
|
|
193
|
+
"@types/lsofi": "1.0.2",
|
|
193
194
|
"@types/marked-terminal": "^6.1.1",
|
|
194
195
|
"@types/mocha": "^9.0.0",
|
|
195
196
|
"@types/mock-fs": "4.13.4",
|
|
@@ -20,6 +20,20 @@
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
+
"dartSdk": {
|
|
24
|
+
"additionalProperties": true,
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"outputDir": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Path to the directory where generated files should be written to."
|
|
30
|
+
},
|
|
31
|
+
"package": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The package name to use for the generated code."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
23
37
|
"kotlinSdk": {
|
|
24
38
|
"additionalProperties": true,
|
|
25
39
|
"type": "object",
|
|
@@ -43,6 +57,16 @@
|
|
|
43
57
|
"description": "Path to the directory where generated files should be written to."
|
|
44
58
|
}
|
|
45
59
|
}
|
|
60
|
+
},
|
|
61
|
+
"llmTools": {
|
|
62
|
+
"additionalProperties": true,
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"outputFile": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "Path where the JSON LLM tool definitions file should be generated."
|
|
68
|
+
}
|
|
69
|
+
}
|
|
46
70
|
}
|
|
47
71
|
},
|
|
48
72
|
"properties": {
|
|
@@ -50,35 +74,51 @@
|
|
|
50
74
|
"type": "string",
|
|
51
75
|
"description": "The ID of the Firebase Data Connect connector."
|
|
52
76
|
},
|
|
53
|
-
"authMode": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"description": "The authentication strategy to use for this connector"
|
|
56
|
-
|
|
57
|
-
},
|
|
58
77
|
"generate": {
|
|
59
78
|
"type": "object",
|
|
60
79
|
"additionalProperties": false,
|
|
61
80
|
"properties": {
|
|
62
81
|
"javascriptSdk": {
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
"oneOf": [
|
|
83
|
+
{ "$ref": "#/definitions/javascriptSdk" },
|
|
84
|
+
{
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"$ref": "#/definitions/javascriptSdk"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
],
|
|
67
91
|
"description": "Configuration for a generated Javascript SDK"
|
|
68
92
|
},
|
|
69
93
|
"kotlinSdk": {
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
"oneOf": [
|
|
95
|
+
{ "$ref": "#/definitions/kotlinSdk" },
|
|
96
|
+
{
|
|
97
|
+
"type": "array",
|
|
98
|
+
"items": {
|
|
99
|
+
"$ref": "#/definitions/kotlinSdk"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
],
|
|
74
103
|
"description": "Configuration for a generated Kotlin SDK"
|
|
75
104
|
},
|
|
76
105
|
"swiftSdk": {
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
"oneOf": [
|
|
107
|
+
{ "$ref": "#/definitions/swiftSdk" },
|
|
108
|
+
{
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {
|
|
111
|
+
"$ref": "#/definitions/swiftSdk"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
81
115
|
"description": "Configuration for a generated Swift SDK"
|
|
116
|
+
},
|
|
117
|
+
"llmTools": {
|
|
118
|
+
"oneOf": [
|
|
119
|
+
{ "$ref": "#/definitions/llmTools" },
|
|
120
|
+
{ "type": "array", "items": { "$ref": "#/definitions/llmTools" } }
|
|
121
|
+
]
|
|
82
122
|
}
|
|
83
123
|
}
|
|
84
124
|
}
|
|
@@ -357,6 +357,24 @@
|
|
|
357
357
|
"emulators": {
|
|
358
358
|
"additionalProperties": false,
|
|
359
359
|
"properties": {
|
|
360
|
+
"apphosting": {
|
|
361
|
+
"additionalProperties": false,
|
|
362
|
+
"properties": {
|
|
363
|
+
"host": {
|
|
364
|
+
"type": "string"
|
|
365
|
+
},
|
|
366
|
+
"port": {
|
|
367
|
+
"type": "number"
|
|
368
|
+
},
|
|
369
|
+
"rootDirectory": {
|
|
370
|
+
"type": "string"
|
|
371
|
+
},
|
|
372
|
+
"startCommandOverride": {
|
|
373
|
+
"type": "string"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"type": "object"
|
|
377
|
+
},
|
|
360
378
|
"auth": {
|
|
361
379
|
"additionalProperties": false,
|
|
362
380
|
"properties": {
|
|
@@ -389,6 +407,12 @@
|
|
|
389
407
|
},
|
|
390
408
|
"port": {
|
|
391
409
|
"type": "number"
|
|
410
|
+
},
|
|
411
|
+
"postgresHost": {
|
|
412
|
+
"type": "string"
|
|
413
|
+
},
|
|
414
|
+
"postgresPort": {
|
|
415
|
+
"type": "number"
|
|
392
416
|
}
|
|
393
417
|
},
|
|
394
418
|
"type": "object"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Import the Genkit core libraries and plugins.
|
|
2
|
+
import {genkit, z} from "genkit";
|
|
3
|
+
$GENKIT_CONFIG_IMPORTS
|
|
4
|
+
$GENKIT_MODEL_IMPORT
|
|
5
|
+
|
|
6
|
+
// From the Firebase plugin, import the functions needed to deploy flows using
|
|
7
|
+
// Cloud Functions.
|
|
8
|
+
import {firebaseAuth} from "@genkit-ai/firebase/auth";
|
|
9
|
+
import {onFlow} from "@genkit-ai/firebase/functions";
|
|
10
|
+
|
|
11
|
+
const ai = genkit({
|
|
12
|
+
plugins: [
|
|
13
|
+
$GENKIT_CONFIG_PLUGINS
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Define a simple flow that prompts an LLM to generate menu suggestions.
|
|
18
|
+
export const menuSuggestionFlow = onFlow(
|
|
19
|
+
ai,
|
|
20
|
+
{
|
|
21
|
+
name: "menuSuggestionFlow",
|
|
22
|
+
inputSchema: z.string(),
|
|
23
|
+
outputSchema: z.string(),
|
|
24
|
+
authPolicy: firebaseAuth((user) => {
|
|
25
|
+
// By default, the firebaseAuth policy requires that all requests have an
|
|
26
|
+
// `Authorization: Bearer` header containing the user's Firebase
|
|
27
|
+
// Authentication ID token. All other requests are rejected with error
|
|
28
|
+
// 403. If your app client uses the Cloud Functions for Firebase callable
|
|
29
|
+
// functions feature, the library automatically attaches this header to
|
|
30
|
+
// requests.
|
|
31
|
+
|
|
32
|
+
// You should also set additional policy requirements as appropriate for
|
|
33
|
+
// your app. For example:
|
|
34
|
+
// if (!user.email_verified) {
|
|
35
|
+
// throw new Error("Verified email required to run flow");
|
|
36
|
+
// }
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
async (subject) => {
|
|
40
|
+
// Construct a request and send it to the model API.
|
|
41
|
+
const prompt =
|
|
42
|
+
`Suggest an item for the menu of a ${subject} themed restaurant`;
|
|
43
|
+
const llmResponse = await ai.generate({
|
|
44
|
+
model: $GENKIT_MODEL,
|
|
45
|
+
prompt: prompt,
|
|
46
|
+
config: {
|
|
47
|
+
temperature: 1,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Handle the response from the model API. In this sample, we just
|
|
52
|
+
// convert it to a string, but more complicated flows might coerce the
|
|
53
|
+
// response into structured output or chain the response into another
|
|
54
|
+
// LLM call, etc.
|
|
55
|
+
return llmResponse.text;
|
|
56
|
+
}
|
|
57
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Settings for Backend (on Cloud Run).
|
|
2
|
+
# See https://firebase.google.com/docs/app-hosting/configure#cloud-run
|
|
3
|
+
runConfig:
|
|
4
|
+
minInstances: 0
|
|
5
|
+
# maxInstances: 100
|
|
6
|
+
# concurrency: 80
|
|
7
|
+
# cpu: 1
|
|
8
|
+
# memoryMiB: 512
|
|
9
|
+
|
|
10
|
+
# Environment variables and secrets.
|
|
11
|
+
# env:
|
|
12
|
+
# Configure environment variables.
|
|
13
|
+
# See https://firebase.google.com/docs/app-hosting/configure#user-defined-environment
|
|
14
|
+
# - variable: MESSAGE
|
|
15
|
+
# value: Hello world!
|
|
16
|
+
# availability:
|
|
17
|
+
# - BUILD
|
|
18
|
+
# - RUNTIME
|
|
19
|
+
|
|
20
|
+
# Grant access to secrets in Cloud Secret Manager.
|
|
21
|
+
# See https://firebase.google.com/docs/app-hosting/configure#secret-parameters
|
|
22
|
+
# - variable: MY_SECRET
|
|
23
|
+
# secret: mySecretRef
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
specVersion: "v1beta"
|
|
2
|
+
serviceId: __serviceId__
|
|
3
|
+
location: __location__
|
|
4
|
+
schema:
|
|
5
|
+
source: "./schema"
|
|
6
|
+
datasource:
|
|
7
|
+
postgresql:
|
|
8
|
+
database: __cloudSqlDatabase__
|
|
9
|
+
cloudSql:
|
|
10
|
+
instanceId: __cloudSqlInstanceId__
|
|
11
|
+
# schemaValidation: "COMPATIBLE"
|
|
12
|
+
connectorDirs: __connectorDirs__
|