firebase-tools 13.19.0 → 13.20.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.
Files changed (54) hide show
  1. package/lib/commands/dataconnect-sdk-generate.js +5 -2
  2. package/lib/commands/emulators-start.js +3 -0
  3. package/lib/commands/init.js +20 -16
  4. package/lib/commands/setup-emulators-dataconnect.js +0 -14
  5. package/lib/dataconnect/fileUtils.js +16 -4
  6. package/lib/dataconnect/freeTrial.js +8 -6
  7. package/lib/dataconnect/provisionCloudSql.js +4 -4
  8. package/lib/dataconnect/types.js +1 -0
  9. package/lib/dataconnect/webhook.js +31 -0
  10. package/lib/deploy/dataconnect/deploy.js +2 -0
  11. package/lib/deploy/dataconnect/prepare.js +2 -0
  12. package/lib/deploy/dataconnect/release.js +10 -5
  13. package/lib/deploy/functions/runtimes/node/index.js +6 -1
  14. package/lib/emulator/commandUtils.js +6 -1
  15. package/lib/emulator/constants.js +1 -1
  16. package/lib/emulator/controller.js +17 -3
  17. package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +11 -0
  18. package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +69 -0
  19. package/lib/emulator/dataconnect/pg-gateway/auth/index.js +22 -0
  20. package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +135 -0
  21. package/lib/emulator/dataconnect/pg-gateway/auth/password.js +65 -0
  22. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +34 -0
  23. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +298 -0
  24. package/lib/emulator/dataconnect/pg-gateway/auth/trust.js +2 -0
  25. package/lib/emulator/dataconnect/pg-gateway/backend-error.js +75 -0
  26. package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +55 -0
  27. package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +79 -0
  28. package/lib/emulator/dataconnect/pg-gateway/connection.js +419 -0
  29. package/lib/emulator/dataconnect/pg-gateway/connection.types.js +8 -0
  30. package/lib/emulator/dataconnect/pg-gateway/crypto.js +40 -0
  31. package/lib/emulator/dataconnect/pg-gateway/duplex.js +53 -0
  32. package/lib/emulator/dataconnect/pg-gateway/index.js +27 -0
  33. package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +96 -0
  34. package/lib/emulator/dataconnect/pg-gateway/message-codes.js +54 -0
  35. package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +13 -0
  36. package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +36 -0
  37. package/lib/emulator/dataconnect/pg-gateway/utils.js +40 -0
  38. package/lib/emulator/dataconnect/pgliteServer.js +134 -0
  39. package/lib/emulator/dataconnectEmulator.js +55 -73
  40. package/lib/emulator/dataconnectToolkitController.js +44 -0
  41. package/lib/emulator/downloadableEmulators.js +22 -11
  42. package/lib/emulator/hub.js +2 -1
  43. package/lib/emulator/portUtils.js +9 -11
  44. package/lib/emulator/storage/rules/runtime.js +1 -1
  45. package/lib/experiments.js +1 -0
  46. package/lib/init/features/dataconnect/index.js +148 -111
  47. package/lib/init/features/dataconnect/sdk.js +40 -27
  48. package/lib/init/features/emulators.js +2 -14
  49. package/lib/prompt.js +1 -1
  50. package/lib/rc.js +1 -9
  51. package/package.json +3 -1
  52. package/schema/connector-yaml.json +14 -0
  53. package/schema/firebase-config.json +6 -0
  54. package/templates/init/dataconnect/queries.gql +1 -2
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doSetup = exports.DEFAULT_POSTGRES_CONNECTION = void 0;
3
+ exports.doSetup = void 0;
4
4
  const clc = require("colorette");
5
- const _ = require("lodash");
6
5
  const utils = require("../../utils");
7
6
  const prompt_1 = require("../../prompt");
8
7
  const types_1 = require("../../emulator/types");
9
8
  const constants_1 = require("../../emulator/constants");
10
9
  const downloadableEmulators_1 = require("../../emulator/downloadableEmulators");
11
- exports.DEFAULT_POSTGRES_CONNECTION = "postgresql://localhost:5432?sslmode=disable";
12
10
  async function doSetup(setup, config) {
13
11
  var _a, _b, _c;
14
12
  const choices = types_1.ALL_SERVICE_EMULATORS.map((e) => {
@@ -78,16 +76,6 @@ async function doSetup(setup, config) {
78
76
  ui.port = isNaN(portNum) ? undefined : portNum;
79
77
  }
80
78
  }
81
- if (selections.emulators.includes(types_1.Emulators.DATACONNECT)) {
82
- const defaultConnectionString = (_c = (_b = (_a = setup.rcfile.dataconnectEmulatorConfig) === null || _a === void 0 ? void 0 : _a.postgres) === null || _b === void 0 ? void 0 : _b.localConnectionString) !== null && _c !== void 0 ? _c : exports.DEFAULT_POSTGRES_CONNECTION;
83
- const localConnectionString = await (0, prompt_1.promptOnce)({
84
- type: "input",
85
- name: "localConnectionString",
86
- message: `What is the connection string of the local Postgres instance you would like to use with the Data Connect emulator?`,
87
- default: defaultConnectionString,
88
- });
89
- setup.rcfile.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
90
- }
91
79
  await (0, prompt_1.prompt)(selections, [
92
80
  {
93
81
  name: "download",
@@ -106,7 +94,7 @@ async function doSetup(setup, config) {
106
94
  await (0, downloadableEmulators_1.downloadIfNecessary)(selected);
107
95
  }
108
96
  }
109
- if (_.get(setup, "config.emulators.ui.enabled")) {
97
+ if ((_c = (_b = (_a = setup === null || setup === void 0 ? void 0 : setup.config) === null || _a === void 0 ? void 0 : _a.emulators) === null || _b === void 0 ? void 0 : _b.ui) === null || _c === void 0 ? void 0 : _c.enabled) {
110
98
  (0, downloadableEmulators_1.downloadIfNecessary)(types_1.Emulators.UI);
111
99
  }
112
100
  }
package/lib/prompt.js CHANGED
@@ -55,7 +55,7 @@ async function promptForDirectory(args) {
55
55
  let dir = "";
56
56
  while (!dir) {
57
57
  const target = args.config.path(await promptOnce({
58
- message: "Where is your app directory?",
58
+ message: args.message,
59
59
  }));
60
60
  if ((0, fsutils_1.fileExistsSync)(target)) {
61
61
  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 = Object.assign({ projects: {}, targets: {}, etags: {}, dataconnectEmulatorConfig: {} }, data);
40
+ this.data = Object.assign({ projects: {}, targets: {}, etags: {} }, data);
41
41
  }
42
42
  set(key, value) {
43
43
  _.set(this.data, key, value);
@@ -152,14 +152,6 @@ class RC {
152
152
  this.data.etags[projectId][resourceType] = etagData;
153
153
  this.save();
154
154
  }
155
- getDataconnect() {
156
- var _a;
157
- return (_a = this.data.dataconnectEmulatorConfig) !== null && _a !== void 0 ? _a : {};
158
- }
159
- setDataconnect(localConnectionString) {
160
- this.data.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
161
- this.save();
162
- }
163
155
  save() {
164
156
  if (this.path) {
165
157
  fs.writeFileSync(this.path, JSON.stringify(this.data, null, 2), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "13.19.0",
3
+ "version": "13.20.0",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -60,6 +60,7 @@
60
60
  ]
61
61
  },
62
62
  "dependencies": {
63
+ "@electric-sql/pglite": "^0.2.0",
63
64
  "@google-cloud/cloud-sql-connector": "^1.3.3",
64
65
  "@google-cloud/pubsub": "^4.5.0",
65
66
  "abort-controller": "^3.0.0",
@@ -94,6 +95,7 @@
94
95
  "leven": "^3.1.0",
95
96
  "libsodium-wrappers": "^0.7.10",
96
97
  "lodash": "^4.17.21",
98
+ "lsofi": "1.0.0",
97
99
  "marked": "^13.0.2",
98
100
  "marked-terminal": "^7.0.0",
99
101
  "mime": "^2.5.2",
@@ -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",
@@ -401,6 +401,12 @@
401
401
  },
402
402
  "port": {
403
403
  "type": "number"
404
+ },
405
+ "postgresHost": {
406
+ "type": "string"
407
+ },
408
+ "postgresPort": {
409
+ "type": "number"
404
410
  }
405
411
  },
406
412
  "type": "object"
@@ -44,8 +44,7 @@
44
44
  # title
45
45
  # imageUrl
46
46
  # genre
47
- # metadata: movieMetadatas_on_movie {
48
- # director
47
+ # metadata: movieMetadata_on_movie {
49
48
  # rating
50
49
  # releaseYear
51
50
  # description