firebase-tools 11.0.1 → 11.2.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.
Files changed (214) hide show
  1. package/lib/accountExporter.js +11 -4
  2. package/lib/accountImporter.js +93 -95
  3. package/lib/api.js +77 -218
  4. package/lib/apiv2.js +5 -4
  5. package/lib/appdistribution/client.js +7 -9
  6. package/lib/auth.js +72 -52
  7. package/lib/bin/firebase.js +42 -47
  8. package/lib/checkValidTargetFilters.js +36 -25
  9. package/lib/commands/appdistribution-distribute.js +2 -1
  10. package/lib/commands/appdistribution-testers-add.js +2 -1
  11. package/lib/commands/appdistribution-testers-remove.js +2 -1
  12. package/lib/commands/apps-android-sha-create.js +2 -1
  13. package/lib/commands/apps-android-sha-delete.js +2 -1
  14. package/lib/commands/apps-android-sha-list.js +2 -1
  15. package/lib/commands/apps-create.js +2 -1
  16. package/lib/commands/apps-list.js +2 -1
  17. package/lib/commands/apps-sdkconfig.js +2 -1
  18. package/lib/commands/auth-export.js +2 -1
  19. package/lib/commands/auth-import.js +7 -10
  20. package/lib/commands/crashlytics-symbols-upload.js +2 -1
  21. package/lib/commands/database-get.js +4 -3
  22. package/lib/commands/database-instances-create.js +2 -1
  23. package/lib/commands/database-instances-list.js +3 -3
  24. package/lib/commands/database-profile.js +4 -4
  25. package/lib/commands/database-push.js +4 -4
  26. package/lib/commands/database-remove.js +3 -3
  27. package/lib/commands/database-rules-canary.js +2 -1
  28. package/lib/commands/database-rules-get.js +2 -1
  29. package/lib/commands/database-rules-list.js +2 -1
  30. package/lib/commands/database-rules-release.js +2 -1
  31. package/lib/commands/database-rules-stage.js +2 -1
  32. package/lib/commands/database-set.js +3 -3
  33. package/lib/commands/database-settings-get.js +2 -1
  34. package/lib/commands/database-settings-set.js +2 -1
  35. package/lib/commands/database-update.js +2 -1
  36. package/lib/commands/deploy.js +26 -25
  37. package/lib/commands/emulators-exec.js +2 -1
  38. package/lib/commands/emulators-export.js +2 -1
  39. package/lib/commands/emulators-start.js +2 -1
  40. package/lib/commands/experimental-functions-shell.js +10 -8
  41. package/lib/commands/ext-configure.js +2 -1
  42. package/lib/commands/ext-dev-deprecate.js +2 -1
  43. package/lib/commands/ext-dev-emulators-exec.js +3 -2
  44. package/lib/commands/ext-dev-emulators-start.js +3 -2
  45. package/lib/commands/ext-dev-extension-delete.js +2 -1
  46. package/lib/commands/ext-dev-init.js +2 -1
  47. package/lib/commands/ext-dev-list.js +8 -8
  48. package/lib/commands/ext-dev-publish.js +2 -1
  49. package/lib/commands/ext-dev-register.js +2 -1
  50. package/lib/commands/ext-dev-undeprecate.js +2 -1
  51. package/lib/commands/ext-dev-unpublish.js +2 -1
  52. package/lib/commands/ext-dev-usage.js +2 -1
  53. package/lib/commands/ext-export.js +2 -1
  54. package/lib/commands/ext-info.js +14 -14
  55. package/lib/commands/ext-install.js +2 -1
  56. package/lib/commands/ext-list.js +2 -1
  57. package/lib/commands/ext-sources-create.js +2 -1
  58. package/lib/commands/ext-uninstall.js +2 -1
  59. package/lib/commands/ext-update.js +2 -1
  60. package/lib/commands/ext.js +4 -4
  61. package/lib/commands/firestore-delete.js +2 -1
  62. package/lib/commands/firestore-indexes-list.js +2 -1
  63. package/lib/commands/functions-config-clone.js +4 -3
  64. package/lib/commands/functions-config-export.js +2 -1
  65. package/lib/commands/functions-config-get.js +2 -1
  66. package/lib/commands/functions-config-set.js +2 -1
  67. package/lib/commands/functions-config-unset.js +2 -1
  68. package/lib/commands/functions-delete.js +3 -8
  69. package/lib/commands/functions-deletegcfartifacts.js +2 -1
  70. package/lib/commands/functions-list.js +2 -1
  71. package/lib/commands/functions-log.js +2 -1
  72. package/lib/commands/functions-secrets-access.js +2 -1
  73. package/lib/commands/functions-secrets-destroy.js +2 -1
  74. package/lib/commands/functions-secrets-get.js +2 -1
  75. package/lib/commands/functions-secrets-prune.js +2 -1
  76. package/lib/commands/functions-secrets-set.js +2 -1
  77. package/lib/commands/functions-shell.js +12 -10
  78. package/lib/commands/help.js +2 -1
  79. package/lib/commands/hosting-channel-create.js +2 -1
  80. package/lib/commands/hosting-channel-delete.js +2 -1
  81. package/lib/commands/hosting-channel-deploy.js +2 -1
  82. package/lib/commands/hosting-channel-list.js +2 -1
  83. package/lib/commands/hosting-channel-open.js +2 -1
  84. package/lib/commands/hosting-clone.js +2 -1
  85. package/lib/commands/hosting-disable.js +2 -1
  86. package/lib/commands/hosting-sites-create.js +2 -1
  87. package/lib/commands/hosting-sites-delete.js +2 -1
  88. package/lib/commands/hosting-sites-get.js +2 -1
  89. package/lib/commands/hosting-sites-list.js +2 -1
  90. package/lib/commands/index.js +23 -13
  91. package/lib/commands/init.js +47 -43
  92. package/lib/commands/login-add.js +2 -1
  93. package/lib/commands/login-ci.js +2 -1
  94. package/lib/commands/login-list.js +2 -1
  95. package/lib/commands/login-use.js +2 -1
  96. package/lib/commands/login.js +2 -1
  97. package/lib/commands/logout.js +2 -1
  98. package/lib/commands/open.js +7 -7
  99. package/lib/commands/projects-addfirebase.js +2 -1
  100. package/lib/commands/projects-create.js +2 -1
  101. package/lib/commands/projects-list.js +2 -1
  102. package/lib/commands/remoteconfig-get.js +2 -1
  103. package/lib/commands/remoteconfig-rollback.js +2 -1
  104. package/lib/commands/remoteconfig-versions-list.js +2 -1
  105. package/lib/commands/serve.js +30 -30
  106. package/lib/commands/setup-emulators-database.js +2 -1
  107. package/lib/commands/setup-emulators-firestore.js +2 -1
  108. package/lib/commands/setup-emulators-pubsub.js +2 -1
  109. package/lib/commands/setup-emulators-storage.js +2 -1
  110. package/lib/commands/setup-emulators-ui.js +2 -1
  111. package/lib/commands/target-apply.js +2 -1
  112. package/lib/commands/target-clear.js +2 -1
  113. package/lib/commands/target-remove.js +2 -1
  114. package/lib/commands/target.js +2 -1
  115. package/lib/commands/use.js +54 -53
  116. package/lib/config.js +7 -6
  117. package/lib/deploy/database/deploy.js +3 -2
  118. package/lib/deploy/database/index.js +8 -5
  119. package/lib/deploy/database/prepare.js +22 -20
  120. package/lib/deploy/database/release.js +12 -9
  121. package/lib/deploy/extensions/secrets.js +3 -3
  122. package/lib/deploy/firestore/prepare.js +2 -2
  123. package/lib/deploy/functions/build.js +33 -20
  124. package/lib/deploy/functions/ensure.js +1 -11
  125. package/lib/deploy/functions/prepare.js +3 -13
  126. package/lib/deploy/functions/prepareFunctionsUpload.js +2 -3
  127. package/lib/deploy/functions/release/fabricator.js +0 -1
  128. package/lib/deploy/functions/release/index.js +1 -5
  129. package/lib/deploy/functions/runtimes/discovery/index.js +18 -3
  130. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +188 -54
  131. package/lib/deploy/functions/runtimes/golang/index.js +2 -22
  132. package/lib/deploy/functions/runtimes/node/index.js +3 -7
  133. package/lib/deploy/functions/runtimes/node/parseTriggers.js +16 -4
  134. package/lib/deploy/functions/services/database.js +14 -0
  135. package/lib/deploy/functions/services/index.js +14 -0
  136. package/lib/deploy/index.js +3 -3
  137. package/lib/deploy/lifecycleHooks.js +27 -27
  138. package/lib/deploy/remoteconfig/prepare.js +2 -2
  139. package/lib/deploy/storage/prepare.js +1 -1
  140. package/lib/emulator/auth/apiSpec.js +14 -46
  141. package/lib/emulator/auth/index.js +1 -1
  142. package/lib/emulator/auth/operations.js +342 -93
  143. package/lib/emulator/auth/server.js +2 -2
  144. package/lib/emulator/auth/state.js +34 -32
  145. package/lib/emulator/commandUtils.js +1 -1
  146. package/lib/emulator/constants.js +1 -1
  147. package/lib/emulator/controller.js +7 -6
  148. package/lib/emulator/databaseEmulator.js +4 -4
  149. package/lib/emulator/download.js +1 -1
  150. package/lib/emulator/downloadableEmulators.js +5 -5
  151. package/lib/emulator/events/types.js +2 -3
  152. package/lib/emulator/firestoreEmulator.js +2 -2
  153. package/lib/emulator/functionsEmulator.js +31 -45
  154. package/lib/emulator/functionsEmulatorRuntime.js +12 -16
  155. package/lib/emulator/functionsEmulatorShared.js +7 -5
  156. package/lib/emulator/functionsRuntimeWorker.js +0 -6
  157. package/lib/emulator/hostingEmulator.js +1 -1
  158. package/lib/emulator/hub.js +1 -1
  159. package/lib/emulator/loggingEmulator.js +1 -1
  160. package/lib/emulator/pubsubEmulator.js +1 -1
  161. package/lib/emulator/storage/crc.js +4 -4
  162. package/lib/emulator/storage/index.js +1 -1
  163. package/lib/emulator/types.js +1 -1
  164. package/lib/errorOut.js +2 -2
  165. package/lib/extensions/askUserForConsent.js +1 -2
  166. package/lib/extensions/askUserForParam.js +15 -18
  167. package/lib/extensions/emulator/optionsHelper.js +4 -4
  168. package/lib/extensions/extensionsApi.js +1 -22
  169. package/lib/extensions/extensionsHelper.js +6 -6
  170. package/lib/extensions/listExtensions.js +9 -10
  171. package/lib/extensions/manifest.js +2 -2
  172. package/lib/extensions/resolveSource.js +11 -7
  173. package/lib/extensions/secretsUtils.js +3 -3
  174. package/lib/extensions/types.js +24 -0
  175. package/lib/extensions/updateHelper.js +1 -1
  176. package/lib/extensions/utils.js +1 -2
  177. package/lib/extensions/warnings.js +3 -3
  178. package/lib/firestore/encodeFirestoreValue.js +11 -8
  179. package/lib/fsAsync.js +3 -3
  180. package/lib/functions/events/v2.js +7 -1
  181. package/lib/functionsConfig.js +17 -14
  182. package/lib/functionsConfigClone.js +46 -46
  183. package/lib/gcp/cloudfunctions.js +2 -15
  184. package/lib/gcp/cloudfunctionsv2.js +17 -2
  185. package/lib/gcp/iam.js +1 -1
  186. package/lib/gcp/index.js +10 -10
  187. package/lib/gcp/rules.js +1 -1
  188. package/lib/gcp/runtimeconfig.js +45 -47
  189. package/lib/hosting/proxy.js +1 -1
  190. package/lib/index.js +29 -28
  191. package/lib/init/features/database.js +10 -2
  192. package/lib/init/features/functions/index.js +1 -1
  193. package/lib/init/features/functions/javascript.js +23 -20
  194. package/lib/init/features/functions/npm-dependencies.js +17 -14
  195. package/lib/init/features/functions/typescript.js +27 -24
  196. package/lib/init/features/hosting/github.js +6 -5
  197. package/lib/init/features/hosting/index.js +2 -2
  198. package/lib/loadCJSON.js +9 -6
  199. package/lib/localFunction.js +4 -4
  200. package/lib/logError.js +15 -12
  201. package/lib/parseBoltRules.js +15 -14
  202. package/lib/previews.js +1 -1
  203. package/lib/profileReport.js +504 -512
  204. package/lib/profiler.js +4 -4
  205. package/lib/prompt.js +1 -2
  206. package/lib/rc.js +1 -1
  207. package/lib/requireAuth.js +0 -1
  208. package/lib/responseToError.js +8 -5
  209. package/lib/rulesDeploy.js +2 -2
  210. package/lib/scopes.js +9 -9
  211. package/lib/serve/index.js +4 -5
  212. package/lib/utils.js +30 -6
  213. package/npm-shrinkwrap.json +537 -193
  214. package/package.json +17 -14
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RuntimeWorkerPool = exports.RuntimeWorker = exports.RuntimeWorkerState = void 0;
4
4
  const uuid = require("uuid");
5
5
  const types_1 = require("./types");
6
- const functionsEmulatorShared_1 = require("./functionsEmulatorShared");
7
6
  const events_1 = require("events");
8
7
  const emulatorLogger_1 = require("./emulatorLogger");
9
8
  const error_1 = require("../error");
@@ -42,13 +41,8 @@ class RuntimeWorker {
42
41
  }
43
42
  execute(frb, opts) {
44
43
  const execFrb = Object.assign({}, frb);
45
- if (!execFrb.socketPath) {
46
- execFrb.socketPath = (0, functionsEmulatorShared_1.getTemporarySocketPath)(this.runtime.pid, this.runtime.cwd);
47
- this.log(`Assigning socketPath: ${execFrb.socketPath}`);
48
- }
49
44
  const args = { frb: execFrb, opts };
50
45
  this.state = RuntimeWorkerState.BUSY;
51
- this.lastArgs = args;
52
46
  this.runtime.send(args);
53
47
  }
54
48
  get state() {
@@ -20,7 +20,7 @@ class HostingEmulator {
20
20
  return serveHosting.stop();
21
21
  }
22
22
  getInfo() {
23
- const host = this.args.host || constants_1.Constants.getDefaultHost(types_1.Emulators.HOSTING);
23
+ const host = this.args.host || constants_1.Constants.getDefaultHost();
24
24
  const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.HOSTING);
25
25
  return {
26
26
  name: this.getName(),
@@ -105,7 +105,7 @@ class EmulatorHub {
105
105
  await this.deleteLocatorFile();
106
106
  }
107
107
  getInfo() {
108
- const host = this.args.host || constants_1.Constants.getDefaultHost(types_1.Emulators.HUB);
108
+ const host = this.args.host || constants_1.Constants.getDefaultHost();
109
109
  const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.HUB);
110
110
  return {
111
111
  name: this.getName(),
@@ -28,7 +28,7 @@ class LoggingEmulator {
28
28
  }
29
29
  }
30
30
  getInfo() {
31
- const host = this.args.host || constants_1.Constants.getDefaultHost(types_1.Emulators.LOGGING);
31
+ const host = this.args.host || constants_1.Constants.getDefaultHost();
32
32
  const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.LOGGING);
33
33
  return {
34
34
  name: this.getName(),
@@ -32,7 +32,7 @@ class PubsubEmulator {
32
32
  await downloadableEmulators.stop(types_1.Emulators.PUBSUB);
33
33
  }
34
34
  getInfo() {
35
- const host = this.args.host || constants_1.Constants.getDefaultHost(types_1.Emulators.PUBSUB);
35
+ const host = this.args.host || constants_1.Constants.getDefaultHost();
36
36
  const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.PUBSUB);
37
37
  return {
38
38
  name: this.getName(),
@@ -25,9 +25,9 @@ function crc32c(bytes) {
25
25
  }
26
26
  exports.crc32c = crc32c;
27
27
  function crc32cToString(crc32cValue) {
28
- if (typeof crc32cValue === "string") {
29
- crc32cValue = Number(crc32cValue);
30
- }
31
- return "----" + Buffer.from([crc32cValue]).toString("base64");
28
+ const value = typeof crc32cValue === "string" ? Number.parseInt(crc32cValue) : crc32cValue;
29
+ const buffer = Buffer.alloc(4);
30
+ buffer.writeUint32BE(value);
31
+ return buffer.toString("base64");
32
32
  }
33
33
  exports.crc32cToString = crc32cToString;
@@ -68,7 +68,7 @@ class StorageEmulator {
68
68
  return this.destroyServer ? this.destroyServer() : Promise.resolve();
69
69
  }
70
70
  getInfo() {
71
- const host = this.args.host || constants_1.Constants.getDefaultHost(types_1.Emulators.STORAGE);
71
+ const host = this.args.host || constants_1.Constants.getDefaultHost();
72
72
  const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.STORAGE);
73
73
  return {
74
74
  name: this.getName(),
@@ -104,7 +104,7 @@ class EmulatorLog {
104
104
  });
105
105
  }
106
106
  static waitForLog(emitter, level, type, filter) {
107
- return new Promise((resolve, reject) => {
107
+ return new Promise((resolve) => {
108
108
  const listener = (el) => {
109
109
  const levelTypeMatch = el.level === level && el.type === type;
110
110
  let filterMatch = true;
package/lib/errorOut.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.errorOut = void 0;
4
- const logError = require("./logError");
4
+ const logError_1 = require("./logError");
5
5
  const error_1 = require("./error");
6
6
  function errorOut(error) {
7
7
  let fbError;
@@ -14,7 +14,7 @@ function errorOut(error) {
14
14
  exit: 2,
15
15
  });
16
16
  }
17
- logError(fbError);
17
+ (0, logError_1.logError)(fbError);
18
18
  process.exitCode = fbError.exit || 2;
19
19
  setTimeout(() => {
20
20
  process.exit();
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.promptForPublisherTOS = exports.displayApis = exports.displayRoles = exports.retrieveRoleInfo = exports.formatDescription = void 0;
4
- const _ = require("lodash");
5
4
  const clc = require("cli-color");
6
5
  const { marked } = require("marked");
7
6
  const TerminalRenderer = require("marked-terminal");
@@ -19,7 +18,7 @@ async function formatDescription(extensionName, projectId, roles) {
19
18
  return retrieveRoleInfo(role);
20
19
  }));
21
20
  results.unshift(question);
22
- return _.join(results, "\n");
21
+ return results.join("\n");
23
22
  }
24
23
  exports.formatDescription = formatDescription;
25
24
  async function retrieveRoleInfo(role) {
@@ -4,7 +4,7 @@ exports.getInquirerDefault = exports.promptCreateSecret = exports.askForParam =
4
4
  const _ = require("lodash");
5
5
  const clc = require("cli-color");
6
6
  const { marked } = require("marked");
7
- const extensionsApi_1 = require("./extensionsApi");
7
+ const types_1 = require("./types");
8
8
  const secretManagerApi = require("../gcp/secretManager");
9
9
  const secretsUtils = require("./secretsUtils");
10
10
  const extensionsHelper_1 = require("./extensionsHelper");
@@ -24,13 +24,14 @@ var SecretUpdateAction;
24
24
  SecretUpdateAction[SecretUpdateAction["SET_NEW"] = 2] = "SET_NEW";
25
25
  })(SecretUpdateAction || (SecretUpdateAction = {}));
26
26
  function checkResponse(response, spec) {
27
+ var _a;
27
28
  let valid = true;
28
29
  let responses;
29
30
  if (spec.required && (response === "" || response === undefined)) {
30
31
  utils.logWarning(`Param ${spec.param} is required, but no value was provided.`);
31
32
  return false;
32
33
  }
33
- if (spec.type === extensionsApi_1.ParamType.MULTISELECT) {
34
+ if (spec.type === types_1.ParamType.MULTISELECT) {
34
35
  responses = response.split(",");
35
36
  }
36
37
  else {
@@ -38,25 +39,23 @@ function checkResponse(response, spec) {
38
39
  }
39
40
  if (spec.validationRegex && !!response) {
40
41
  const re = new RegExp(spec.validationRegex);
41
- _.forEach(responses, (resp) => {
42
+ for (const resp of responses) {
42
43
  if ((spec.required || resp !== "") && !re.test(resp)) {
43
44
  const genericWarn = `${resp} is not a valid value for ${spec.param} since it` +
44
45
  ` does not meet the requirements of the regex validation: "${spec.validationRegex}"`;
45
46
  utils.logWarning(spec.validationErrorMessage || genericWarn);
46
47
  valid = false;
47
48
  }
48
- });
49
+ }
49
50
  }
50
- if (spec.type && (spec.type === extensionsApi_1.ParamType.MULTISELECT || spec.type === extensionsApi_1.ParamType.SELECT)) {
51
- _.forEach(responses, (r) => {
52
- const validChoice = _.some(spec.options, (option) => {
53
- return r === option.value;
54
- });
55
- if (!validChoice) {
51
+ if (spec.type && (spec.type === types_1.ParamType.MULTISELECT || spec.type === types_1.ParamType.SELECT)) {
52
+ for (const r of responses) {
53
+ const validChoice = (_a = spec.options) === null || _a === void 0 ? void 0 : _a.some((option) => r === option.value);
54
+ if (r && !validChoice) {
56
55
  utils.logWarning(`${r} is not a valid option for ${spec.param}.`);
57
56
  valid = false;
58
57
  }
59
- });
58
+ }
60
59
  }
61
60
  return valid;
62
61
  }
@@ -69,7 +68,7 @@ async function ask(args) {
69
68
  utils.logLabeledBullet(extensionsHelper_1.logPrefix, "answer the questions below to configure your extension:");
70
69
  const substituted = (0, extensionsHelper_1.substituteParams)(args.paramSpecs, args.firebaseProjectParams);
71
70
  const result = {};
72
- const promises = _.map(substituted, (paramSpec) => {
71
+ const promises = substituted.map((paramSpec) => {
73
72
  return async () => {
74
73
  result[paramSpec.param] = await askForParam({
75
74
  projectId: args.projectId,
@@ -95,7 +94,7 @@ async function askForParam(args) {
95
94
  logger_1.logger.info(`\n${clc.bold(label)}${clc.bold(paramSpec.required ? "" : " (Optional)")}: ${marked(description).trim()}`);
96
95
  while (!valid) {
97
96
  switch (paramSpec.type) {
98
- case extensionsApi_1.ParamType.SELECT:
97
+ case types_1.ParamType.SELECT:
99
98
  response = await (0, prompt_1.promptOnce)({
100
99
  name: "input",
101
100
  type: "list",
@@ -111,7 +110,7 @@ async function askForParam(args) {
111
110
  });
112
111
  valid = checkResponse(response, paramSpec);
113
112
  break;
114
- case extensionsApi_1.ParamType.MULTISELECT:
113
+ case types_1.ParamType.MULTISELECT:
115
114
  response = await (0, utils_1.onceWithJoin)({
116
115
  name: "input",
117
116
  type: "checkbox",
@@ -129,7 +128,7 @@ async function askForParam(args) {
129
128
  });
130
129
  valid = checkResponse(response, paramSpec);
131
130
  break;
132
- case extensionsApi_1.ParamType.SECRET:
131
+ case types_1.ParamType.SECRET:
133
132
  do {
134
133
  secretLocations = await promptSecretLocations(paramSpec);
135
134
  } while (!isValidSecretLocations(secretLocations, paramSpec));
@@ -302,9 +301,7 @@ async function addNewSecretVersion(projectId, instanceId, secret, paramSpec, sec
302
301
  return `projects/${version.secret.projectId}/secrets/${version.secret.name}/versions/${version.versionId}`;
303
302
  }
304
303
  function getInquirerDefault(options, def) {
305
- const defaultOption = _.find(options, (option) => {
306
- return option.value === def;
307
- });
304
+ const defaultOption = options.find((o) => o.value === def);
308
305
  return defaultOption ? defaultOption.label || defaultOption.value : "";
309
306
  }
310
307
  exports.getInquirerDefault = getInquirerDefault;
@@ -7,14 +7,14 @@ const paramHelper = require("../paramHelper");
7
7
  const specHelper = require("./specHelper");
8
8
  const localHelper = require("../localHelper");
9
9
  const triggerHelper = require("./triggerHelper");
10
- const extensionsApi_1 = require("../extensionsApi");
10
+ const types_1 = require("../types");
11
11
  const extensionsHelper = require("../extensionsHelper");
12
12
  const planner = require("../../deploy/extensions/planner");
13
13
  const config_1 = require("../../config");
14
14
  const error_1 = require("../../error");
15
15
  const emulatorLogger_1 = require("../../emulator/emulatorLogger");
16
16
  const projectUtils_1 = require("../../projectUtils");
17
- const types_1 = require("../../emulator/types");
17
+ const types_2 = require("../../emulator/types");
18
18
  async function buildOptions(options) {
19
19
  const extDevDir = localHelper.findExtensionYaml(process.cwd());
20
20
  options.extDevDir = extDevDir;
@@ -56,7 +56,7 @@ async function getExtensionFunctionInfo(instance, paramValues) {
56
56
  };
57
57
  }
58
58
  exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
59
- const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type === extensionsApi_1.ParamType.SECRET;
59
+ const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type === types_1.ParamType.SECRET;
60
60
  function getNonSecretEnv(params, paramValues) {
61
61
  const getNonSecretEnv = Object.assign({}, paramValues);
62
62
  const secretParams = params.filter(isSecretParam);
@@ -99,7 +99,7 @@ function getParams(options, extensionSpec) {
99
99
  }
100
100
  exports.getParams = getParams;
101
101
  function checkTestConfig(testConfig, functionResources) {
102
- const logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FUNCTIONS);
102
+ const logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.FUNCTIONS);
103
103
  if (!testConfig.functions && functionResources.length) {
104
104
  logger.log("WARN", "This extension uses functions," +
105
105
  "but 'firebase.json' provided by --test-config is missing a top-level 'functions' object." +
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExtension = exports.deleteExtension = exports.unpublishExtension = exports.publishExtensionVersion = exports.undeprecateExtensionVersion = exports.deprecateExtensionVersion = exports.registerPublisherProfile = exports.getPublisherProfile = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = exports.ParamType = exports.FUNCTIONS_RESOURCE_TYPE = exports.Visibility = exports.RegistryLaunchStage = void 0;
3
+ exports.getExtension = exports.deleteExtension = exports.unpublishExtension = exports.publishExtensionVersion = exports.undeprecateExtensionVersion = exports.deprecateExtensionVersion = exports.registerPublisherProfile = exports.getPublisherProfile = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = void 0;
4
4
  const yaml = require("js-yaml");
5
5
  const clc = require("cli-color");
6
6
  const { marked } = require("marked");
@@ -13,27 +13,6 @@ const refs = require("./refs");
13
13
  const VERSION = "v1beta";
14
14
  const PAGE_SIZE_MAX = 100;
15
15
  const apiClient = new apiv2_1.Client({ urlPrefix: api_1.extensionsOrigin, apiVersion: VERSION });
16
- var RegistryLaunchStage;
17
- (function (RegistryLaunchStage) {
18
- RegistryLaunchStage["EXPERIMENTAL"] = "EXPERIMENTAL";
19
- RegistryLaunchStage["BETA"] = "BETA";
20
- RegistryLaunchStage["GA"] = "GA";
21
- RegistryLaunchStage["DEPRECATED"] = "DEPRECATED";
22
- RegistryLaunchStage["REGISTRY_LAUNCH_STAGE_UNSPECIFIED"] = "REGISTRY_LAUNCH_STAGE_UNSPECIFIED";
23
- })(RegistryLaunchStage = exports.RegistryLaunchStage || (exports.RegistryLaunchStage = {}));
24
- var Visibility;
25
- (function (Visibility) {
26
- Visibility["UNLISTED"] = "unlisted";
27
- Visibility["PUBLIC"] = "public";
28
- })(Visibility = exports.Visibility || (exports.Visibility = {}));
29
- exports.FUNCTIONS_RESOURCE_TYPE = "firebaseextensions.v1beta.function";
30
- var ParamType;
31
- (function (ParamType) {
32
- ParamType["STRING"] = "STRING";
33
- ParamType["SELECT"] = "SELECT";
34
- ParamType["MULTISELECT"] = "MULTISELECT";
35
- ParamType["SECRET"] = "SECRET";
36
- })(ParamType = exports.ParamType || (exports.ParamType = {}));
37
16
  async function createInstanceHelper(projectId, instanceId, config, validateOnly = false) {
38
17
  const createRes = await apiClient.post(`/projects/${projectId}/instances/`, {
39
18
  name: `projects/${projectId}/instances/${instanceId}`,
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canonicalizeRefInput = exports.diagnoseAndFixProject = exports.confirm = exports.getSourceOrigin = exports.isLocalOrURLPath = exports.isLocalPath = exports.isUrlPath = exports.instanceIdExists = exports.promptForRepeatInstance = exports.promptForOfficialExtension = exports.displayReleaseNotes = exports.getPublisherProjectFromName = exports.createSourceFromLocation = exports.publishExtensionVersionFromLocalSource = exports.ensureExtensionsApiEnabled = exports.promptForValidInstanceId = exports.validateSpec = exports.validateCommandLineParams = exports.populateDefaultParams = exports.substituteParams = exports.getFirebaseProjectParams = exports.getDBInstanceFromURL = exports.resourceTypeToNiceName = exports.AUTOPOULATED_PARAM_PLACEHOLDERS = exports.EXTENSIONS_BUCKET_NAME = exports.URL_REGEX = exports.logPrefix = exports.SourceOrigin = exports.SpecParamType = void 0;
4
- const _ = require("lodash");
5
4
  const clc = require("cli-color");
6
5
  const ora = require("ora");
7
6
  const semver = require("semver");
@@ -116,9 +115,10 @@ function substituteParams(original, params) {
116
115
  const substituteRegexMatches = (unsubstituted, regex) => {
117
116
  return unsubstituted.replace(regex, paramVal);
118
117
  };
119
- return _.reduce(regexes, substituteRegexMatches, str);
118
+ return regexes.reduce(substituteRegexMatches, str);
120
119
  };
121
- return JSON.parse(_.reduce(params, applySubstitution, startingString));
120
+ const s = Object.entries(params).reduce((str, [key, val]) => applySubstitution(str, val, key), startingString);
121
+ return JSON.parse(s);
122
122
  }
123
123
  exports.substituteParams = substituteParams;
124
124
  function populateDefaultParams(paramVars, paramSpecs) {
@@ -207,8 +207,8 @@ function validateSpec(spec) {
207
207
  if (!param.label) {
208
208
  errors.push(`Param${param.param ? ` ${param.param}` : ""} is missing required field: label`);
209
209
  }
210
- if (param.type && !_.includes(SpecParamType, param.type)) {
211
- errors.push(`Invalid type ${param.type} for param${param.param ? ` ${param.param}` : ""}. Valid types are ${_.values(SpecParamType).join(", ")}`);
210
+ if (param.type && !Object.values(SpecParamType).includes(param.type)) {
211
+ errors.push(`Invalid type ${param.type} for param${param.param ? ` ${param.param}` : ""}. Valid types are ${Object.values(SpecParamType).join(", ")}`);
212
212
  }
213
213
  if (!param.type || param.type === SpecParamType.STRING) {
214
214
  if (param.options) {
@@ -422,7 +422,7 @@ async function promptForOfficialExtension(message) {
422
422
  type: "list",
423
423
  message,
424
424
  choices: (0, utils_1.convertOfficialExtensionsToList)(officialExts),
425
- pageSize: _.size(officialExts),
425
+ pageSize: Object.keys(officialExts).length,
426
426
  });
427
427
  }
428
428
  exports.promptForOfficialExtension = promptForOfficialExtension;
@@ -1,40 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listExtensions = void 0;
4
- const _ = require("lodash");
5
4
  const clc = require("cli-color");
6
5
  const Table = require("cli-table");
7
6
  const extensionsApi_1 = require("./extensionsApi");
7
+ const logger_1 = require("../logger");
8
+ const utils_1 = require("../utils");
8
9
  const extensionsHelper_1 = require("./extensionsHelper");
9
- const utils = require("../utils");
10
10
  const extensionsUtils = require("./utils");
11
- const logger_1 = require("../logger");
12
11
  async function listExtensions(projectId) {
13
12
  const instances = await (0, extensionsApi_1.listInstances)(projectId);
14
13
  if (instances.length < 1) {
15
- utils.logLabeledBullet(extensionsHelper_1.logPrefix, `there are no extensions installed on project ${clc.bold(projectId)}.`);
14
+ (0, utils_1.logLabeledBullet)(extensionsHelper_1.logPrefix, `there are no extensions installed on project ${clc.bold(projectId)}.`);
16
15
  return [];
17
16
  }
18
17
  const table = new Table({
19
18
  head: ["Extension", "Publisher", "Instance ID", "State", "Version", "Your last update"],
20
19
  style: { head: ["yellow"] },
21
20
  });
22
- const sorted = _.sortBy(instances, "createTime", "asc").reverse();
21
+ const sorted = instances.sort((a, b) => new Date(b.createTime).valueOf() - new Date(a.createTime).valueOf());
23
22
  const formatted = [];
24
23
  sorted.forEach((instance) => {
25
24
  var _a, _b, _c, _d;
26
- let extension = _.get(instance, "config.extensionRef", "");
25
+ let extension = instance.config.extensionRef || "";
27
26
  let publisher;
28
27
  if (extension === "") {
29
- extension = _.get(instance, "config.source.spec.name", "");
28
+ extension = instance.config.source.spec.name || "";
30
29
  publisher = "N/A";
31
30
  }
32
31
  else {
33
32
  publisher = extension.split("/")[0];
34
33
  }
35
- const instanceId = (_a = _.last(instance.name.split("/"))) !== null && _a !== void 0 ? _a : "";
34
+ const instanceId = (_a = (0, utils_1.last)(instance.name.split("/"))) !== null && _a !== void 0 ? _a : "";
36
35
  const state = instance.state +
37
- (_.get(instance, "config.source.state", "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
36
+ ((instance.config.source.state || "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
38
37
  const version = (_d = (_c = (_b = instance === null || instance === void 0 ? void 0 : instance.config) === null || _b === void 0 ? void 0 : _b.source) === null || _c === void 0 ? void 0 : _c.spec) === null || _d === void 0 ? void 0 : _d.version;
39
38
  const updateTime = extensionsUtils.formatTimestamp(instance.updateTime);
40
39
  table.push([extension, publisher, instanceId, state, version, updateTime]);
@@ -47,7 +46,7 @@ async function listExtensions(projectId) {
47
46
  updateTime,
48
47
  });
49
48
  });
50
- utils.logLabeledBullet(extensionsHelper_1.logPrefix, `list of extensions installed in ${clc.bold(projectId)}:`);
49
+ (0, utils_1.logLabeledBullet)(extensionsHelper_1.logPrefix, `list of extensions installed in ${clc.bold(projectId)}:`);
51
50
  logger_1.logger.info(table.toString());
52
51
  return formatted;
53
52
  }
@@ -12,7 +12,7 @@ const paramHelper_1 = require("./paramHelper");
12
12
  const error_1 = require("../error");
13
13
  const utils = require("../utils");
14
14
  const extensionsHelper_1 = require("./extensionsHelper");
15
- const extensionsApi_1 = require("./extensionsApi");
15
+ const types_1 = require("./types");
16
16
  exports.ENV_DIRECTORY = "extensions";
17
17
  async function writeToManifest(specs, config, options, allowOverwrite = false) {
18
18
  if (config.has("extensions") &&
@@ -48,7 +48,7 @@ async function writeLocalSecrets(specs, config, force) {
48
48
  continue;
49
49
  }
50
50
  const writeBuffer = {};
51
- const locallyOverridenSecretParams = extensionSpec.params.filter((p) => { var _a; return p.type === extensionsApi_1.ParamType.SECRET && ((_a = spec.params[p.param]) === null || _a === void 0 ? void 0 : _a.local); });
51
+ const locallyOverridenSecretParams = extensionSpec.params.filter((p) => { var _a; return p.type === types_1.ParamType.SECRET && ((_a = spec.params[p.param]) === null || _a === void 0 ? void 0 : _a.local); });
52
52
  for (const paramSpec of locallyOverridenSecretParams) {
53
53
  const key = paramSpec.param;
54
54
  const localValue = spec.params[key].local;
@@ -1,20 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTrustedPublishers = exports.getExtensionRegistry = void 0;
4
- const _ = require("lodash");
5
4
  const logger_1 = require("../logger");
6
5
  const apiv2_1 = require("../apiv2");
7
6
  const api_1 = require("../api");
8
7
  const EXTENSIONS_REGISTRY_ENDPOINT = "/extensions.json";
9
- async function getExtensionRegistry(onlyFeatured) {
8
+ async function getExtensionRegistry(onlyFeatured = false) {
9
+ var _a;
10
10
  const client = new apiv2_1.Client({ urlPrefix: api_1.firebaseExtensionsRegistryOrigin });
11
11
  const res = await client.get(EXTENSIONS_REGISTRY_ENDPOINT);
12
- const extensions = _.get(res, "body.mods");
12
+ const extensions = res.body.mods || {};
13
13
  if (onlyFeatured) {
14
- const featuredList = _.get(res, "body.featured.discover");
15
- return _.pickBy(extensions, (_entry, extensionName) => {
16
- return _.includes(featuredList, extensionName);
17
- });
14
+ const featuredList = new Set(((_a = res.body.featured) === null || _a === void 0 ? void 0 : _a.discover) || []);
15
+ const filteredExtensions = {};
16
+ for (const [name, extension] of Object.entries(extensions)) {
17
+ if (featuredList.has(name)) {
18
+ filteredExtensions[name] = extension;
19
+ }
20
+ }
21
+ return filteredExtensions;
18
22
  }
19
23
  return extensions;
20
24
  }
@@ -5,7 +5,7 @@ const getProjectNumber_1 = require("../getProjectNumber");
5
5
  const utils = require("../utils");
6
6
  const ensureApiEnabled_1 = require("../ensureApiEnabled");
7
7
  const projectUtils_1 = require("../projectUtils");
8
- const extensionsApi = require("./extensionsApi");
8
+ const types_1 = require("./types");
9
9
  const secretManagerApi = require("../gcp/secretManager");
10
10
  const logger_1 = require("../logger");
11
11
  exports.SECRET_LABEL = "firebase-extensions-managed";
@@ -15,7 +15,7 @@ async function ensureSecretManagerApiEnabled(options) {
15
15
  }
16
16
  exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
17
17
  function usesSecrets(spec) {
18
- return spec.params && !!spec.params.find((p) => p.type === extensionsApi.ParamType.SECRET);
18
+ return spec.params && !!spec.params.find((p) => p.type === types_1.ParamType.SECRET);
19
19
  }
20
20
  exports.usesSecrets = usesSecrets;
21
21
  async function grantFirexServiceAgentSecretAdminRole(secret) {
@@ -38,7 +38,7 @@ async function getManagedSecrets(instance) {
38
38
  exports.getManagedSecrets = getManagedSecrets;
39
39
  function getActiveSecrets(spec, params) {
40
40
  return spec.params
41
- .map((p) => (p.type === extensionsApi.ParamType.SECRET ? params[p.param] : ""))
41
+ .map((p) => (p.type === types_1.ParamType.SECRET ? params[p.param] : ""))
42
42
  .filter((pv) => !!pv);
43
43
  }
44
44
  exports.getActiveSecrets = getActiveSecrets;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParamType = exports.FUNCTIONS_RESOURCE_TYPE = exports.Visibility = exports.RegistryLaunchStage = void 0;
4
+ var RegistryLaunchStage;
5
+ (function (RegistryLaunchStage) {
6
+ RegistryLaunchStage["EXPERIMENTAL"] = "EXPERIMENTAL";
7
+ RegistryLaunchStage["BETA"] = "BETA";
8
+ RegistryLaunchStage["GA"] = "GA";
9
+ RegistryLaunchStage["DEPRECATED"] = "DEPRECATED";
10
+ RegistryLaunchStage["REGISTRY_LAUNCH_STAGE_UNSPECIFIED"] = "REGISTRY_LAUNCH_STAGE_UNSPECIFIED";
11
+ })(RegistryLaunchStage = exports.RegistryLaunchStage || (exports.RegistryLaunchStage = {}));
12
+ var Visibility;
13
+ (function (Visibility) {
14
+ Visibility["UNLISTED"] = "unlisted";
15
+ Visibility["PUBLIC"] = "public";
16
+ })(Visibility = exports.Visibility || (exports.Visibility = {}));
17
+ exports.FUNCTIONS_RESOURCE_TYPE = "firebaseextensions.v1beta.function";
18
+ var ParamType;
19
+ (function (ParamType) {
20
+ ParamType["STRING"] = "STRING";
21
+ ParamType["SELECT"] = "SELECT";
22
+ ParamType["MULTISELECT"] = "MULTISELECT";
23
+ ParamType["SECRET"] = "SECRET";
24
+ })(ParamType = exports.ParamType || (exports.ParamType = {}));
@@ -17,7 +17,7 @@ function invalidSourceErrMsgTemplate(instanceId, source) {
17
17
  - Run \`${clc.bold("firebase ext:update " + instanceId)}\` to update from the published source.\n
18
18
  - Check your directory path or URL, then run \`${clc.bold("firebase ext:update " + instanceId + " <otherSource>")}\` to update from a local directory or URL source.`;
19
19
  }
20
- async function getExistingSourceOrigin(projectId, instanceId, extensionName, existingSource) {
20
+ async function getExistingSourceOrigin(projectId, instanceId) {
21
21
  const instance = await extensionsApi.getInstance(projectId, instanceId);
22
22
  return instance && instance.config.extensionRef
23
23
  ? extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatTimestamp = exports.getRandomString = exports.convertOfficialExtensionsToList = exports.convertExtensionOptionToLabeledList = exports.onceWithJoin = void 0;
4
- const _ = require("lodash");
5
4
  const prompt_1 = require("../prompt");
6
5
  async function onceWithJoin(question) {
7
6
  const response = await (0, prompt_1.promptOnce)(question);
@@ -22,7 +21,7 @@ function convertExtensionOptionToLabeledList(options) {
22
21
  }
23
22
  exports.convertExtensionOptionToLabeledList = convertExtensionOptionToLabeledList;
24
23
  function convertOfficialExtensionsToList(officialExts) {
25
- const l = _.map(officialExts, (entry, key) => {
24
+ const l = Object.entries(officialExts).map(([key, entry]) => {
26
25
  return {
27
26
  checked: false,
28
27
  value: `${entry.publisher}/${key}`,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paramsFlagDeprecationWarning = exports.displayWarningsForDeploy = exports.displayWarningPrompts = void 0;
4
4
  const { marked } = require("marked");
5
5
  const clc = require("cli-color");
6
- const extensionsApi_1 = require("./extensionsApi");
6
+ const types_1 = require("./types");
7
7
  const displayExtensionInfo_1 = require("./displayExtensionInfo");
8
8
  const extensionsHelper_1 = require("./extensionsHelper");
9
9
  const resolveSource_1 = require("./resolveSource");
@@ -31,7 +31,7 @@ async function displayWarningPrompts(publisherId, launchStage, extensionVersion)
31
31
  githubLink: extensionVersion.spec.sourceUrl,
32
32
  });
33
33
  }
34
- else if (launchStage === extensionsApi_1.RegistryLaunchStage.EXPERIMENTAL) {
34
+ else if (launchStage === types_1.RegistryLaunchStage.EXPERIMENTAL) {
35
35
  displayExperimentalWarning();
36
36
  }
37
37
  else {
@@ -55,7 +55,7 @@ async function displayWarningsForDeploy(instancesToCreate) {
55
55
  await (0, planner_1.getExtension)(i);
56
56
  }
57
57
  const [eapExtensions, nonEapExtensions] = (0, functional_1.partition)(publishedExtensionInstances, (i) => { var _a, _b; return !trustedPublishers.includes((_b = (_a = i.ref) === null || _a === void 0 ? void 0 : _a.publisherId) !== null && _b !== void 0 ? _b : ""); });
58
- const experimental = nonEapExtensions.filter((i) => i.extension.registryLaunchStage === extensionsApi_1.RegistryLaunchStage.EXPERIMENTAL);
58
+ const experimental = nonEapExtensions.filter((i) => i.extension.registryLaunchStage === types_1.RegistryLaunchStage.EXPERIMENTAL);
59
59
  if (experimental.length) {
60
60
  const humanReadableList = experimental.map((i) => `\t${(0, deploymentSummary_1.humanReadable)(i)}`).join("\n");
61
61
  utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`The following are instances of ${clc.bold("experimental")} extensions.They may not be production-ready. Their functionality may change in backward-incompatible ways before their official release, or they may be discontinued.\n${humanReadableList}\n`, { gfm: false }));
@@ -9,22 +9,22 @@ function isPlainObject(input) {
9
9
  _.isEqual(Object.getPrototypeOf(input), Object.prototype));
10
10
  }
11
11
  function encodeHelper(val) {
12
- if (_.isString(val)) {
12
+ if (typeof val === "string") {
13
13
  return { stringValue: val };
14
14
  }
15
- if (_.isBoolean(val)) {
15
+ if (val === !!val) {
16
16
  return { booleanValue: val };
17
17
  }
18
- if (_.isInteger(val)) {
18
+ if (Number.isInteger(val)) {
19
19
  return { integerValue: val };
20
20
  }
21
- if (_.isNumber(val)) {
21
+ if (typeof val === "number") {
22
22
  return { doubleValue: val };
23
23
  }
24
- if (_.isDate(val)) {
24
+ if (val instanceof Date && !Number.isNaN(val)) {
25
25
  return { timestampValue: val.toISOString() };
26
26
  }
27
- if (_.isArray(val)) {
27
+ if (Array.isArray(val)) {
28
28
  const encodedElements = [];
29
29
  for (const v of val) {
30
30
  const enc = encodeHelper(v);
@@ -36,7 +36,7 @@ function encodeHelper(val) {
36
36
  arrayValue: { values: encodedElements },
37
37
  };
38
38
  }
39
- if (_.isNull(val)) {
39
+ if (val === null) {
40
40
  return { nullValue: "NULL_VALUE" };
41
41
  }
42
42
  if (val instanceof Buffer || val instanceof Uint8Array) {
@@ -51,6 +51,9 @@ function encodeHelper(val) {
51
51
  "The emulator does not yet support Firestore document reference values or geo points.");
52
52
  }
53
53
  function encodeFirestoreValue(data) {
54
- return _.mapValues(data, encodeHelper);
54
+ return Object.entries(data).reduce((acc, [key, val]) => {
55
+ acc[key] = encodeHelper(val);
56
+ return acc;
57
+ }, {});
55
58
  }
56
59
  exports.encodeFirestoreValue = encodeFirestoreValue;